1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; For Emacs <22.2 and XEmacs.
30 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
34 (when (featurep 'xemacs)
35 (require 'easy-mmode))) ; for `define-minor-mode'
37 (defvar tool-bar-mode)
38 (defvar gnus-tmp-header)
51 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
52 (autoload 'gnus-cache-write-active "gnus-cache")
53 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
54 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
55 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
56 (autoload 'mm-uu-dissect "mm-uu")
57 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
58 "Deuglify broken Outlook (Express) articles and redisplay."
60 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
61 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
62 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
64 (defcustom gnus-kill-summary-on-exit t
65 "*If non-nil, kill the summary buffer when you exit from it.
66 If nil, the summary will become a \"*Dead Summary*\" buffer, and
67 it will be killed sometime later."
68 :group 'gnus-summary-exit
71 (defcustom gnus-summary-next-group-on-exit t
72 "If non-nil, go to the next unread newsgroup on summary exit.
73 See `gnus-group-goto-unread'."
74 :link '(custom-manual "(gnus)Group Maneuvering")
75 :group 'gnus-summary-exit
76 :version "23.1" ;; No Gnus
79 (defcustom gnus-summary-stop-at-end-of-message nil
80 "If non-nil, don't select the next message when using `SPC'."
81 :link '(custom-manual "(gnus)Group Maneuvering")
82 :group 'gnus-summary-maneuvering
86 (defcustom gnus-fetch-old-headers nil
87 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
88 If an unread article in the group refers to an older, already
89 read (or just marked as read) article, the old article will not
90 normally be displayed in the Summary buffer. If this variable is
91 t, Gnus will attempt to grab the headers to the old articles, and
92 thereby build complete threads. If it has the value `some', all
93 old headers will be fetched but only enough headers to connect
94 otherwise loose threads will be displayed. This variable can
95 also be a number. In that case, no more than that number of old
96 headers will be fetched. If it has the value `invisible', all
97 old headers will be fetched, but none will be displayed.
99 The server has to support NOV for any of this to work.
101 This feature can seriously impact performance it ignores all
102 locally cached header entries. Setting it to t for groups for a
103 server that doesn't expire articles (such as news.gmane.org),
104 leads to very slow summary generation."
106 :type '(choice (const :tag "off" nil)
111 (sexp :menu-tag "other" t)))
113 (defcustom gnus-refer-thread-limit 500
114 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
115 If t, fetch all the available old headers."
117 :type '(choice number
118 (sexp :menu-tag "other" t)))
120 (defcustom gnus-summary-make-false-root 'adopt
121 "*nil means that Gnus won't gather loose threads.
122 If the root of a thread has expired or been read in a previous
123 session, the information necessary to build a complete thread has been
124 lost. Instead of having many small sub-threads from this original thread
125 scattered all over the summary buffer, Gnus can gather them.
127 If non-nil, Gnus will try to gather all loose sub-threads from an
128 original thread into one large thread.
130 If this variable is non-nil, it should be one of `none', `adopt',
133 If this variable is `none', Gnus will not make a false root, but just
134 present the sub-threads after another.
135 If this variable is `dummy', Gnus will create a dummy root that will
136 have all the sub-threads as children.
137 If this variable is `adopt', Gnus will make one of the \"children\"
138 the parent and mark all the step-children as such.
139 If this variable is `empty', the \"children\" are printed with empty
140 subject fields. (Or rather, they will be printed with a string
141 given by the `gnus-summary-same-subject' variable.)"
143 :type '(choice (const :tag "off" nil)
149 (defcustom gnus-summary-make-false-root-always nil
150 "Always make a false dummy root."
155 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
156 "*A regexp to match subjects to be excluded from loose thread gathering.
157 As loose thread gathering is done on subjects only, that means that
158 there can be many false gatherings performed. By rooting out certain
159 common subjects, gathering might become saner."
163 (defcustom gnus-summary-gather-subject-limit nil
164 "*Maximum length of subject comparisons when gathering loose threads.
165 Use nil to compare full subjects. Setting this variable to a low
166 number will help gather threads that have been corrupted by
167 newsreaders chopping off subject lines, but it might also mean that
168 unrelated articles that have subject that happen to begin with the
169 same few characters will be incorrectly gathered.
171 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
174 :type '(choice (const :tag "off" nil)
176 (sexp :menu-tag "on" t)))
178 (defcustom gnus-simplify-subject-functions nil
179 "List of functions taking a string argument that simplify subjects.
180 The functions are applied recursively.
182 Useful functions to put in this list include:
183 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
184 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
186 :type '(repeat function))
188 (defcustom gnus-simplify-ignored-prefixes nil
189 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
191 :type '(choice (const :tag "off" nil)
194 (defcustom gnus-build-sparse-threads nil
195 "*If non-nil, fill in the gaps in threads.
196 If `some', only fill in the gaps that are needed to tie loose threads
197 together. If `more', fill in all leaf nodes that Gnus can find. If
198 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
200 :type '(choice (const :tag "off" nil)
203 (sexp :menu-tag "all" t)))
205 (defcustom gnus-summary-thread-gathering-function
206 'gnus-gather-threads-by-subject
207 "*Function used for gathering loose threads.
208 There are two pre-defined functions: `gnus-gather-threads-by-subject',
209 which only takes Subjects into consideration; and
210 `gnus-gather-threads-by-references', which compared the References
211 headers of the articles to find matches."
213 :type '(radio (function-item gnus-gather-threads-by-subject)
214 (function-item gnus-gather-threads-by-references)
215 (function :tag "other")))
217 (defcustom gnus-summary-same-subject ""
218 "*String indicating that the current article has the same subject as the previous.
219 This variable will only be used if the value of
220 `gnus-summary-make-false-root' is `empty'."
221 :group 'gnus-summary-format
224 (defcustom gnus-summary-goto-unread nil
225 "*If t, many commands will go to the next unread article.
226 This applies to marking commands as well as other commands that
227 \"naturally\" select the next article, like, for instance, `SPC' at
228 the end of an article.
230 If nil, the marking commands do NOT go to the next unread article
231 \(they go to the next article instead). If `never', commands that
232 usually go to the next unread article, will go to the next article,
233 whether it is read or not."
235 :group 'gnus-summary-marks
236 :link '(custom-manual "(gnus)Setting Marks")
237 :type '(choice (const :tag "off" nil)
239 (sexp :menu-tag "on" t)))
241 (defcustom gnus-summary-default-score 0
242 "*Default article score level.
243 All scores generated by the score files will be added to this score.
244 If this variable is nil, scoring will be disabled."
245 :group 'gnus-score-default
246 :type '(choice (const :tag "disable")
249 (defcustom gnus-summary-default-high-score 0
250 "*Default threshold for a high scored article.
251 An article will be highlighted as high scored if its score is greater
254 :group 'gnus-score-default
257 (defcustom gnus-summary-default-low-score 0
258 "*Default threshold for a low scored article.
259 An article will be highlighted as low scored if its score is smaller
262 :group 'gnus-score-default
265 (defcustom gnus-summary-zcore-fuzz 0
266 "*Fuzziness factor for the zcore in the summary buffer.
267 Articles with scores closer than this to `gnus-summary-default-score'
269 :group 'gnus-summary-format
272 (defcustom gnus-simplify-subject-fuzzy-regexp nil
273 "*Strings to be removed when doing fuzzy matches.
274 This can either be a regular expression or list of regular expressions
275 that will be removed from subject strings if fuzzy subject
276 simplification is selected."
278 :type '(repeat regexp))
280 (defcustom gnus-show-threads t
281 "*If non-nil, display threads in summary mode."
285 (defcustom gnus-thread-hide-subtree nil
286 "*If non-nil, hide all threads initially.
287 This can be a predicate specifier which says which threads to hide.
288 If threads are hidden, you have to run the command
289 `gnus-summary-show-thread' by hand or select an article."
291 :type '(radio (sexp :format "Non-nil\n"
292 :match (lambda (widget value)
293 (not (or (consp value) (functionp value))))
296 (sexp :tag "Predicate specifier")))
298 (defcustom gnus-thread-hide-killed t
299 "*If non-nil, hide killed threads automatically."
303 (defcustom gnus-thread-ignore-subject t
304 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
305 If nil, articles that have different subjects from their parents will
306 start separate threads."
310 (defcustom gnus-thread-operation-ignore-subject t
311 "*If non-nil, subjects will be ignored when doing thread commands.
312 This affects commands like `gnus-summary-kill-thread' and
313 `gnus-summary-lower-thread'.
315 If this variable is nil, articles in the same thread with different
316 subjects will not be included in the operation in question. If this
317 variable is `fuzzy', only articles that have subjects that are fuzzily
318 equal will be included."
320 :type '(choice (const :tag "off" nil)
324 (defcustom gnus-thread-indent-level 4
325 "*Number that says how much each sub-thread should be indented."
329 (defcustom gnus-auto-extend-newsgroup t
330 "*If non-nil, extend newsgroup forward and backward when requested."
331 :group 'gnus-summary-choose
334 (defcustom gnus-auto-select-first t
335 "If non-nil, select an article on group entry.
336 An article is selected automatically when entering a group
337 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
338 `gnus-summary-catchup-and-goto-next-group'.
340 Which article is selected is controlled by the variable
341 `gnus-auto-select-subject'.
343 If you want to prevent automatic selection of articles in some
344 newsgroups, set the variable to nil in `gnus-select-group-hook'."
345 ;; Commands include...
346 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
347 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
348 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
349 :group 'gnus-group-select
350 :type '(choice (const :tag "none" nil)
351 (sexp :menu-tag "first" t)))
353 (defcustom gnus-auto-select-subject 'unseen-or-unread
354 "*Says what subject to place under point when entering a group.
356 This variable can either be the symbols `first' (place point on the
357 first subject), `unread' (place point on the subject line of the first
358 unread article), `best' (place point on the subject line of the
359 higest-scored article), `unseen' (place point on the subject line of
360 the first unseen article), `unseen-or-unread' (place point on the subject
361 line of the first unseen article or, if all article have been seen, on the
362 subject line of the first unread article), or a function to be called to
363 place point on some subject line."
365 :group 'gnus-group-select
366 :type '(choice (const best)
370 (const unseen-or-unread)))
372 (defcustom gnus-auto-select-next t
373 "*If non-nil, offer to go to the next group from the end of the previous.
374 If the value is t and the next newsgroup is empty, Gnus will exit
375 summary mode and go back to group mode. If the value is neither nil
376 nor t, Gnus will select the following unread newsgroup. In
377 particular, if the value is the symbol `quietly', the next unread
378 newsgroup will be selected without any confirmation, and if it is
379 `almost-quietly', the next group will be selected without any
380 confirmation if you are located on the last article in the group.
381 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
382 will go to the next group without confirmation."
383 :group 'gnus-summary-maneuvering
384 :type '(choice (const :tag "off" nil)
386 (const almost-quietly)
387 (const slightly-quietly)
388 (sexp :menu-tag "on" t)))
390 (defcustom gnus-auto-select-same nil
391 "*If non-nil, select the next article with the same subject.
392 If there are no more articles with the same subject, go to
393 the first unread article."
394 :group 'gnus-summary-maneuvering
397 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
398 "What article should be selected after exiting an ephemeral group.
399 Valid values include:
402 Select the next article.
404 Select the next unread article.
406 Move the cursor to the next article. This is the default.
407 `next-unread-noselect'
408 Move the cursor to the next unread article.
410 If it has any other value or there is no next (unread) article, the
411 article selected before entering to the ephemeral group will appear."
412 :version "23.1" ;; No Gnus
413 :group 'gnus-summary-maneuvering
414 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
415 (const next) (const next-unread)
416 (const next-noselect) (const next-unread-noselect)
417 (sexp :tag "other" :value nil)))
419 (defcustom gnus-auto-goto-ignores 'unfetched
420 "*Says how to handle unfetched articles when maneuvering.
422 This variable can either be the symbols nil (maneuver to any
423 article), `undownloaded' (maneuvering while unplugged ignores articles
424 that have not been fetched), `always-undownloaded' (maneuvering always
425 ignores articles that have not been fetched), `unfetched' (maneuvering
426 ignores articles whose headers have not been fetched).
428 NOTE: The list of unfetched articles will always be nil when plugged
429 and, when unplugged, a subset of the undownloaded article list."
431 :group 'gnus-summary-maneuvering
432 :type '(choice (const :tag "None" nil)
433 (const :tag "Undownloaded when unplugged" undownloaded)
434 (const :tag "Undownloaded" always-undownloaded)
435 (const :tag "Unfetched" unfetched)))
437 (defcustom gnus-summary-check-current nil
438 "*If non-nil, consider the current article when moving.
439 The \"unread\" movement commands will stay on the same line if the
440 current article is unread."
441 :group 'gnus-summary-maneuvering
444 (defcustom gnus-auto-center-summary 2
445 "*If non-nil, always center the current summary buffer.
446 In particular, if `vertical' do only vertical recentering. If non-nil
447 and non-`vertical', do both horizontal and vertical recentering."
448 :group 'gnus-summary-maneuvering
449 :type '(choice (const :tag "none" nil)
451 (integer :tag "height")
452 (sexp :menu-tag "both" t)))
454 (defcustom gnus-auto-center-group t
455 "If non-nil, always center the group buffer."
456 :group 'gnus-summary-maneuvering
459 (defcustom gnus-show-all-headers nil
460 "*If non-nil, don't hide any headers."
461 :group 'gnus-article-hiding
462 :group 'gnus-article-headers
465 (defcustom gnus-summary-ignore-duplicates nil
466 "*If non-nil, ignore articles with identical Message-ID headers."
470 (defcustom gnus-single-article-buffer nil
471 "*If non-nil, display all articles in the same buffer.
472 If nil, each group will get its own article buffer."
474 :group 'gnus-article-various
477 (defcustom gnus-widen-article-window nil
478 "If non-nil, selecting the article buffer will display only the article buffer."
480 :group 'gnus-article-various
483 (defcustom gnus-break-pages t
484 "*If non-nil, do page breaking on articles.
485 The page delimiter is specified by the `gnus-page-delimiter'
487 :group 'gnus-article-various
490 (defcustom gnus-move-split-methods nil
491 "*Variable used to suggest where articles are to be moved to.
492 It uses the same syntax as the `gnus-split-methods' variable.
493 However, whereas `gnus-split-methods' specifies file names as targets,
494 this variable specifies group names."
495 :group 'gnus-summary-mail
496 :type '(repeat (choice (list :value (fun) function)
497 (cons :value ("" "") regexp (repeat string))
500 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
501 "Function used to compute default prefix for article move/copy/etc prompts.
502 The function should take one argument, a group name, and return a
503 string with the suggested prefix."
504 :group 'gnus-summary-mail
507 ;; FIXME: Although the custom type is `character' for the following variables,
508 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
510 (defcustom gnus-unread-mark ? ;Whitespace
511 "*Mark used for unread articles."
512 :group 'gnus-summary-marks
515 (defcustom gnus-ticked-mark ?!
516 "*Mark used for ticked articles."
517 :group 'gnus-summary-marks
520 (defcustom gnus-dormant-mark ??
521 "*Mark used for dormant articles."
522 :group 'gnus-summary-marks
525 (defcustom gnus-del-mark ?r
526 "*Mark used for del'd articles."
527 :group 'gnus-summary-marks
530 (defcustom gnus-read-mark ?R
531 "*Mark used for read articles."
532 :group 'gnus-summary-marks
535 (defcustom gnus-expirable-mark ?E
536 "*Mark used for expirable articles."
537 :group 'gnus-summary-marks
540 (defcustom gnus-killed-mark ?K
541 "*Mark used for killed articles."
542 :group 'gnus-summary-marks
545 (defcustom gnus-spam-mark ?$
546 "*Mark used for spam articles."
548 :group 'gnus-summary-marks
551 (defcustom gnus-kill-file-mark ?X
552 "*Mark used for articles killed by kill files."
553 :group 'gnus-summary-marks
556 (defcustom gnus-low-score-mark ?Y
557 "*Mark used for articles with a low score."
558 :group 'gnus-summary-marks
561 (defcustom gnus-catchup-mark ?C
562 "*Mark used for articles that are caught up."
563 :group 'gnus-summary-marks
566 (defcustom gnus-replied-mark ?A
567 "*Mark used for articles that have been replied to."
568 :group 'gnus-summary-marks
571 (defcustom gnus-forwarded-mark ?F
572 "*Mark used for articles that have been forwarded."
574 :group 'gnus-summary-marks
577 (defcustom gnus-recent-mark ?N
578 "*Mark used for articles that are recent."
580 :group 'gnus-summary-marks
583 (defcustom gnus-cached-mark ?*
584 "*Mark used for articles that are in the cache."
585 :group 'gnus-summary-marks
588 (defcustom gnus-saved-mark ?S
589 "*Mark used for articles that have been saved."
590 :group 'gnus-summary-marks
593 (defcustom gnus-unseen-mark ?.
594 "*Mark used for articles that haven't been seen."
596 :group 'gnus-summary-marks
599 (defcustom gnus-no-mark ? ;Whitespace
600 "*Mark used for articles that have no other secondary mark."
602 :group 'gnus-summary-marks
605 (defcustom gnus-ancient-mark ?O
606 "*Mark used for ancient articles."
607 :group 'gnus-summary-marks
610 (defcustom gnus-sparse-mark ?Q
611 "*Mark used for sparsely reffed articles."
612 :group 'gnus-summary-marks
615 (defcustom gnus-canceled-mark ?G
616 "*Mark used for canceled articles."
617 :group 'gnus-summary-marks
620 (defcustom gnus-duplicate-mark ?M
621 "*Mark used for duplicate articles."
622 :group 'gnus-summary-marks
625 (defcustom gnus-undownloaded-mark ?-
626 "*Mark used for articles that weren't downloaded."
628 :group 'gnus-summary-marks
631 (defcustom gnus-downloaded-mark ?+
632 "*Mark used for articles that were downloaded."
633 :group 'gnus-summary-marks
636 (defcustom gnus-downloadable-mark ?%
637 "*Mark used for articles that are to be downloaded."
638 :group 'gnus-summary-marks
641 (defcustom gnus-unsendable-mark ?=
642 "*Mark used for articles that won't be sent."
643 :group 'gnus-summary-marks
646 (defcustom gnus-score-over-mark ?+
647 "*Score mark used for articles with high scores."
648 :group 'gnus-summary-marks
651 (defcustom gnus-score-below-mark ?-
652 "*Score mark used for articles with low scores."
653 :group 'gnus-summary-marks
656 (defcustom gnus-empty-thread-mark ? ;Whitespace
657 "*There is no thread under the article."
658 :group 'gnus-summary-marks
661 (defcustom gnus-not-empty-thread-mark ?=
662 "*There is a thread under the article."
663 :group 'gnus-summary-marks
666 (defcustom gnus-view-pseudo-asynchronously nil
667 "*If non-nil, Gnus will view pseudo-articles asynchronously."
668 :group 'gnus-extract-view
671 (defcustom gnus-auto-expirable-marks
672 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
673 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
675 "*The list of marks converted into expiration if a group is auto-expirable."
678 :type '(repeat character))
680 (defcustom gnus-inhibit-user-auto-expire t
681 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
686 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
687 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
688 If nil, the expirable marks will be unchanged except that the marks
689 will be removed when copying or moving articles to a group that has
690 not turned auto-expire on. If non-nil, articles that have been read
691 will be marked as expirable when being copied or moved to a group in
692 which auto-expire is turned on."
695 :group 'gnus-summary-marks)
697 (defcustom gnus-view-pseudos nil
698 "*If `automatic', pseudo-articles will be viewed automatically.
699 If `not-confirm', pseudos will be viewed automatically, and the user
700 will not be asked to confirm the command."
701 :group 'gnus-extract-view
702 :type '(choice (const :tag "off" nil)
704 (const not-confirm)))
706 (defcustom gnus-view-pseudos-separately t
707 "*If non-nil, one pseudo-article will be created for each file to be viewed.
708 If nil, all files that use the same viewing command will be given as a
709 list of parameters to that command."
710 :group 'gnus-extract-view
713 (defcustom gnus-insert-pseudo-articles t
714 "*If non-nil, insert pseudo-articles when decoding articles."
715 :group 'gnus-extract-view
718 (defcustom gnus-summary-dummy-line-format
720 "*The format specification for the dummy roots in the summary buffer.
721 It works along the same lines as a normal formatting string,
722 with some simple extensions.
726 General format specifiers can also be used.
727 See `(gnus)Formatting Variables'."
728 :link '(custom-manual "(gnus)Formatting Variables")
729 :group 'gnus-threading
732 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
733 "*The format specification for the summary mode line.
734 It works along the same lines as a normal formatting string,
735 with some simple extensions:
738 %p Unprefixed group name
739 %A Current article number
740 %z Current article score
742 %U Number of unread articles in the group
743 %e Number of unselected articles in the group
744 %Z A string with unread/unselected article counts
745 %g Shortish group name
746 %S Subject of the current article
748 %s Current score file name
749 %d Number of dormant articles
750 %r Number of articles that have been marked as read in this session
751 %E Number of articles expunged by the score files"
752 :group 'gnus-summary-format
755 (defcustom gnus-list-identifiers nil
756 "Regexp that matches list identifiers to be removed from subject.
757 This can also be a list of regexps."
759 :group 'gnus-summary-format
760 :group 'gnus-article-hiding
761 :type '(choice (const :tag "none" nil)
763 (repeat :value (".*") regexp)))
765 (defcustom gnus-summary-mark-below 0
766 "*Mark all articles with a score below this variable as read.
767 This variable is local to each summary buffer and usually set by the
769 :group 'gnus-score-default
772 (defun gnus-widget-reversible-match (widget value)
773 "Ignoring WIDGET, convert VALUE to internal form.
774 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
778 (eq (length value) 2)
779 (eq (nth 0 value) 'not)
780 (symbolp (nth 1 value)))))
782 (defun gnus-widget-reversible-to-internal (widget value)
783 "Ignoring WIDGET, convert VALUE to internal form.
784 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
785 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
789 (list (nth 1 value) t)))
791 (defun gnus-widget-reversible-to-external (widget value)
792 "Ignoring WIDGET, convert VALUE to external form.
793 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
794 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
797 (list 'not (nth 0 value))
800 (define-widget 'gnus-widget-reversible 'group
801 "A `group' that convert values."
802 :match 'gnus-widget-reversible-match
803 :value-to-internal 'gnus-widget-reversible-to-internal
804 :value-to-external 'gnus-widget-reversible-to-external)
806 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
807 "*List of functions used for sorting articles in the summary buffer.
809 Each function takes two articles and returns non-nil if the first
810 article should be sorted before the other. If you use more than one
811 function, the primary sort function should be the last. You should
812 probably always include `gnus-article-sort-by-number' in the list of
813 sorting functions -- preferably first. Also note that sorting by date
814 is often much slower than sorting by number, and the sorting order is
815 very similar. (Sorting by date means sorting by the time the message
816 was sent, sorting by number means sorting by arrival time.)
818 Each item can also be a list `(not F)' where F is a function;
819 this reverses the sort order.
821 Ready-made functions include `gnus-article-sort-by-number',
822 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
823 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
824 and `gnus-article-sort-by-score'.
826 When threading is turned on, the variable `gnus-thread-sort-functions'
827 controls how articles are sorted."
828 :group 'gnus-summary-sort
829 :type '(repeat (gnus-widget-reversible
830 (choice (function-item gnus-article-sort-by-number)
831 (function-item gnus-article-sort-by-author)
832 (function-item gnus-article-sort-by-subject)
833 (function-item gnus-article-sort-by-date)
834 (function-item gnus-article-sort-by-score)
835 (function-item gnus-article-sort-by-random)
836 (function :tag "other"))
837 (boolean :tag "Reverse order"))))
840 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
841 "*List of functions used for sorting threads in the summary buffer.
842 By default, threads are sorted by article number.
844 Each function takes two threads and returns non-nil if the first
845 thread should be sorted before the other. If you use more than one
846 function, the primary sort function should be the last. You should
847 probably always include `gnus-thread-sort-by-number' in the list of
848 sorting functions -- preferably first. Also note that sorting by date
849 is often much slower than sorting by number, and the sorting order is
850 very similar. (Sorting by date means sorting by the time the message
851 was sent, sorting by number means sorting by arrival time.)
853 Each list item can also be a list `(not F)' where F is a
854 function; this specifies reversed sort order.
856 Ready-made functions include `gnus-thread-sort-by-number',
857 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
858 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
859 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
860 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
861 and `gnus-thread-sort-by-total-score' (see
862 `gnus-thread-score-function').
864 When threading is turned off, the variable
865 `gnus-article-sort-functions' controls how articles are sorted."
866 :group 'gnus-summary-sort
868 (gnus-widget-reversible
869 (choice (function-item gnus-thread-sort-by-number)
870 (function-item gnus-thread-sort-by-author)
871 (function-item gnus-thread-sort-by-recipient)
872 (function-item gnus-thread-sort-by-subject)
873 (function-item gnus-thread-sort-by-date)
874 (function-item gnus-thread-sort-by-score)
875 (function-item gnus-thread-sort-by-most-recent-number)
876 (function-item gnus-thread-sort-by-most-recent-date)
877 (function-item gnus-thread-sort-by-random)
878 (function-item gnus-thread-sort-by-total-score)
879 (function :tag "other"))
880 (boolean :tag "Reverse order"))))
882 (defcustom gnus-thread-score-function '+
883 "*Function used for calculating the total score of a thread.
885 The function is called with the scores of the article and each
886 subthread and should then return the score of the thread.
888 Some functions you can use are `+', `max', or `min'."
889 :group 'gnus-summary-sort
892 (defcustom gnus-summary-expunge-below nil
893 "All articles that have a score less than this variable will be expunged.
894 This variable is local to the summary buffers."
895 :group 'gnus-score-default
896 :type '(choice (const :tag "off" nil)
899 (defcustom gnus-thread-expunge-below nil
900 "All threads that have a total score less than this variable will be expunged.
901 See `gnus-thread-score-function' for en explanation of what a
904 This variable is local to the summary buffers."
905 :group 'gnus-threading
906 :group 'gnus-score-default
907 :type '(choice (const :tag "off" nil)
910 (defcustom gnus-summary-mode-hook nil
911 "*A hook for Gnus summary mode.
912 This hook is run before any variables are set in the summary buffer."
913 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
914 :group 'gnus-summary-various
917 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
918 (when (featurep 'xemacs)
919 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
920 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
921 (add-hook 'gnus-summary-mode-hook
922 'gnus-xmas-switch-horizontal-scrollbar-off))
924 (defcustom gnus-summary-menu-hook nil
925 "*Hook run after the creation of the summary mode menu."
926 :group 'gnus-summary-visual
929 (defcustom gnus-summary-exit-hook nil
930 "*A hook called on exit from the summary buffer.
931 It will be called with point in the group buffer."
932 :group 'gnus-summary-exit
935 (defcustom gnus-summary-prepare-hook nil
936 "*A hook called after the summary buffer has been generated.
937 If you want to modify the summary buffer, you can use this hook."
938 :group 'gnus-summary-various
941 (defcustom gnus-summary-prepared-hook nil
942 "*A hook called as the last thing after the summary buffer has been generated."
943 :group 'gnus-summary-various
946 (defcustom gnus-summary-generate-hook nil
947 "*A hook run just before generating the summary buffer.
948 This hook is commonly used to customize threading variables and the
950 :group 'gnus-summary-various
953 (defcustom gnus-select-group-hook nil
954 "*A hook called when a newsgroup is selected.
956 If you'd like to simplify subjects like the
957 `gnus-summary-next-same-subject' command does, you can use the
960 (add-hook gnus-select-group-hook
962 (mapcar (lambda (header)
963 (mail-header-set-subject
965 (gnus-simplify-subject
966 (mail-header-subject header) 're-only)))
967 gnus-newsgroup-headers)))"
968 :group 'gnus-group-select
971 (defcustom gnus-select-article-hook nil
972 "*A hook called when an article is selected."
973 :group 'gnus-summary-choose
974 :options '(gnus-agent-fetch-selected-article)
977 (defcustom gnus-visual-mark-article-hook
978 (list 'gnus-highlight-selected-summary)
979 "*Hook run after selecting an article in the summary buffer.
980 It is meant to be used for highlighting the article in some way. It
981 is not run if `gnus-visual' is nil."
982 :group 'gnus-summary-visual
985 (defcustom gnus-parse-headers-hook nil
986 "*A hook called before parsing the headers."
990 (defcustom gnus-exit-group-hook nil
991 "*A hook called when exiting summary mode.
992 This hook is not called from the non-updating exit commands like `Q'."
996 (defcustom gnus-summary-update-hook nil
997 "*A hook called when a summary line is changed.
998 The hook will not be called if `gnus-visual' is nil.
1000 The default function `gnus-summary-highlight-line' will
1001 highlight the line according to the `gnus-summary-highlight'
1003 :group 'gnus-summary-visual
1006 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
1007 "*A hook called when an article is selected for the first time.
1008 The hook is intended to mark an article as read (or unread)
1009 automatically when it is selected."
1010 :group 'gnus-summary-choose
1013 (defcustom gnus-group-no-more-groups-hook nil
1014 "*A hook run when returning to group mode having no more (unread) groups."
1015 :group 'gnus-group-select
1018 (defcustom gnus-ps-print-hook nil
1019 "*A hook run before ps-printing something from Gnus."
1020 :group 'gnus-summary
1023 (defcustom gnus-summary-article-move-hook nil
1024 "*A hook called after an article is moved, copied, respooled, or crossposted."
1026 :group 'gnus-summary
1029 (defcustom gnus-summary-article-delete-hook nil
1030 "*A hook called after an article is deleted."
1032 :group 'gnus-summary
1035 (defcustom gnus-summary-article-expire-hook nil
1036 "*A hook called after an article is expired."
1038 :group 'gnus-summary
1041 (defcustom gnus-summary-display-arrow
1042 (and (fboundp 'display-graphic-p)
1043 (display-graphic-p))
1044 "*If non-nil, display an arrow highlighting the current article."
1046 :group 'gnus-summary
1049 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1050 "Face used for highlighting the current article in the summary buffer."
1051 :group 'gnus-summary-visual
1054 (defvar gnus-tmp-downloaded nil)
1056 (defcustom gnus-summary-highlight
1057 '(((eq mark gnus-canceled-mark)
1058 . gnus-summary-cancelled)
1059 ((and uncached (> score default-high))
1060 . gnus-summary-high-undownloaded)
1061 ((and uncached (< score default-low))
1062 . gnus-summary-low-undownloaded)
1064 . gnus-summary-normal-undownloaded)
1065 ((and (> score default-high)
1066 (or (eq mark gnus-dormant-mark)
1067 (eq mark gnus-ticked-mark)))
1068 . gnus-summary-high-ticked)
1069 ((and (< score default-low)
1070 (or (eq mark gnus-dormant-mark)
1071 (eq mark gnus-ticked-mark)))
1072 . gnus-summary-low-ticked)
1073 ((or (eq mark gnus-dormant-mark)
1074 (eq mark gnus-ticked-mark))
1075 . gnus-summary-normal-ticked)
1076 ((and (> score default-high) (eq mark gnus-ancient-mark))
1077 . gnus-summary-high-ancient)
1078 ((and (< score default-low) (eq mark gnus-ancient-mark))
1079 . gnus-summary-low-ancient)
1080 ((eq mark gnus-ancient-mark)
1081 . gnus-summary-normal-ancient)
1082 ((and (> score default-high) (eq mark gnus-unread-mark))
1083 . gnus-summary-high-unread)
1084 ((and (< score default-low) (eq mark gnus-unread-mark))
1085 . gnus-summary-low-unread)
1086 ((eq mark gnus-unread-mark)
1087 . gnus-summary-normal-unread)
1088 ((> score default-high)
1089 . gnus-summary-high-read)
1090 ((< score default-low)
1091 . gnus-summary-low-read)
1093 . gnus-summary-normal-read))
1094 "*Controls the highlighting of summary buffer lines.
1096 A list of (FORM . FACE) pairs. When deciding how a particular
1097 summary line should be displayed, each form is evaluated. The content
1098 of the face field after the first true form is used. You can change
1099 how those summary lines are displayed, by editing the face field.
1101 You can use the following variables in the FORM field.
1103 score: The article's score.
1104 default: The default article score.
1105 default-high: The default score for high scored articles.
1106 default-low: The default score for low scored articles.
1107 below: The score below which articles are automatically marked as read.
1108 mark: The article's mark.
1109 uncached: Non-nil if the article is uncached."
1110 :group 'gnus-summary-visual
1111 :type '(repeat (cons (sexp :tag "Form" nil)
1113 (put 'gnus-summary-highlight 'risky-local-variable t)
1115 (defcustom gnus-alter-header-function nil
1116 "Function called to allow alteration of article header structures.
1117 The function is called with one parameter, the article header vector,
1118 which it may alter in any way."
1119 :type '(choice (const :tag "None" nil)
1121 :group 'gnus-summary)
1123 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1124 "Function used to decode a string with encoded words.")
1126 (defvar gnus-decode-encoded-address-function
1127 'mail-decode-encoded-address-string
1128 "Function used to decode addresses with encoded words.")
1130 (defcustom gnus-extra-headers '(To Newsgroups)
1131 "*Extra headers to parse."
1133 :group 'gnus-summary
1134 :type '(repeat symbol))
1136 (defcustom gnus-ignored-from-addresses
1137 (and user-mail-address
1138 (not (string= user-mail-address ""))
1139 (regexp-quote user-mail-address))
1140 "*From headers that may be suppressed in favor of To headers.
1141 This can be a regexp or a list of regexps."
1143 :group 'gnus-summary
1144 :type '(choice regexp
1145 (repeat :tag "Regexp List" regexp)))
1147 (defsubst gnus-ignored-from-addresses ()
1148 (gmm-regexp-concat gnus-ignored-from-addresses))
1150 (defcustom gnus-summary-to-prefix "-> "
1151 "*String prefixed to the To field in the summary line when
1152 using `gnus-ignored-from-addresses'."
1154 :group 'gnus-summary
1157 (defcustom gnus-summary-newsgroup-prefix "=> "
1158 "*String prefixed to the Newsgroup field in the summary
1159 line when using `gnus-ignored-from-addresses'."
1161 :group 'gnus-summary
1164 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1165 "List of charsets that should be ignored.
1166 When these charsets are used in the \"charset\" parameter, the
1167 default charset will be used instead."
1169 :type '(repeat symbol)
1170 :group 'gnus-charset)
1172 (defcustom gnus-newsgroup-maximum-articles nil
1173 "The maximum number of articles a newsgroup.
1174 If this is a number, old articles in a newsgroup exceeding this number
1175 are silently ignored. If it is nil, no article is ignored. Note that
1176 setting this variable to a number might prevent you from reading very
1178 :group 'gnus-group-select
1180 :type '(choice (const :tag "No limit" nil)
1183 (gnus-define-group-parameter
1187 "Return the ignored charsets of GROUP."
1188 :variable gnus-group-ignored-charsets-alist
1190 '(("alt\\.chinese\\.text" iso-8859-1))
1192 "Alist of regexps (to match group names) and charsets that should be ignored.
1193 When these charsets are used in the \"charset\" parameter, the
1194 default charset will be used instead."
1195 :variable-group gnus-charset
1196 :variable-type '(repeat (cons (regexp :tag "Group")
1198 :parameter-type '(choice :tag "Ignored charsets"
1201 :parameter-document "\
1202 List of charsets that should be ignored.
1204 When these charsets are used in the \"charset\" parameter, the
1205 default charset will be used instead.")
1207 (defcustom gnus-group-highlight-words-alist nil
1208 "Alist of group regexps and highlight regexps.
1209 This variable uses the same syntax as `gnus-emphasis-alist'."
1211 :type '(repeat (cons (regexp :tag "Group")
1212 (repeat (list (regexp :tag "Highlight regexp")
1213 (number :tag "Group for entire word" 0)
1214 (number :tag "Group for displayed part" 0)
1216 gnus-emphasis-highlight-words)))))
1217 :group 'gnus-summary-visual)
1219 (defcustom gnus-summary-show-article-charset-alist
1221 "Alist of number and charset.
1222 The article will be shown with the charset corresponding to the
1224 For example: ((1 . cn-gb-2312) (2 . big5))."
1226 :type '(repeat (cons (number :tag "Argument" 1)
1227 (symbol :tag "Charset")))
1228 :group 'gnus-charset)
1230 (defcustom gnus-preserve-marks t
1231 "Whether marks are preserved when moving, copying and respooling messages."
1234 :group 'gnus-summary-marks)
1236 (defcustom gnus-propagate-marks t
1237 "If non-nil, do not propagate marks to the backends."
1238 :version "23.1" ;; No Gnus
1240 :group 'gnus-summary-marks)
1242 (defcustom gnus-alter-articles-to-read-function nil
1243 "Function to be called to alter the list of articles to be selected."
1244 :type '(choice (const nil) function)
1245 :group 'gnus-summary)
1247 (defcustom gnus-orphan-score nil
1248 "*All orphans get this score added. Set in the score file."
1249 :group 'gnus-score-default
1250 :type '(choice (const nil)
1253 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1254 "*A regexp to match MIME parts when saving multiple parts of a
1255 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1256 This regexp will be used by default when prompting the user for which
1257 type of files to save."
1258 :group 'gnus-summary
1261 (defcustom gnus-read-all-available-headers nil
1262 "Whether Gnus should parse all headers made available to it.
1263 This is mostly relevant for slow back ends where the user may
1264 wish to widen the summary buffer to include all headers
1267 :group 'gnus-summary
1268 :type '(choice boolean regexp))
1270 (defcustom gnus-summary-pipe-output-default-command nil
1271 "Command (and optional arguments) used to pipe article to subprocess.
1272 This will be used as the default command if it is non-nil. The value
1273 will be updated if you modify it when executing the command
1274 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1275 :version "23.1" ;; No Gnus
1276 :group 'gnus-summary
1277 :type '(radio (const :tag "None" nil) (string :tag "Command")))
1279 (defcustom gnus-summary-muttprint-program "muttprint"
1280 "Command (and optional arguments) used to run Muttprint.
1281 The value will be updated if you modify it when executing the command
1282 `gnus-summary-muttprint'."
1284 :group 'gnus-summary
1287 (defcustom gnus-article-loose-mime t
1288 "If non-nil, don't require MIME-Version header.
1289 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1290 supply the MIME-Version header or deliberately strip it from the mail.
1291 If non-nil (the default), Gnus will treat some articles as MIME
1292 even if the MIME-Version header is missing."
1295 :group 'gnus-article-mime)
1297 (defcustom gnus-article-emulate-mime t
1298 "If non-nil, use MIME emulation for uuencode and the like.
1299 This means that Gnus will search message bodies for text that look
1300 like uuencoded bits, yEncoded bits, and so on, and present that using
1301 the normal Gnus MIME machinery."
1304 :group 'gnus-article-mime)
1306 ;;; Internal variables
1308 (defvar gnus-summary-display-cache nil)
1309 (defvar gnus-article-mime-handles nil)
1310 (defvar gnus-article-decoded-p nil)
1311 (defvar gnus-article-charset nil)
1312 (defvar gnus-article-ignored-charsets nil)
1313 (defvar gnus-scores-exclude-files nil)
1314 (defvar gnus-page-broken nil)
1316 (defvar gnus-original-article nil)
1317 (defvar gnus-article-internal-prepare-hook nil)
1318 (defvar gnus-newsgroup-process-stack nil)
1320 (defvar gnus-thread-indent-array nil)
1321 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1322 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1323 "Function called to sort the articles within a thread after it has been gathered together.")
1325 (defvar gnus-summary-save-parts-type-history nil)
1326 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1328 ;; Avoid highlighting in kill files.
1329 (defvar gnus-summary-inhibit-highlight nil)
1330 (defvar gnus-newsgroup-selected-overlay nil)
1331 (defvar gnus-inhibit-limiting nil)
1332 (defvar gnus-newsgroup-adaptive-score-file nil)
1333 (defvar gnus-current-score-file nil)
1334 (defvar gnus-current-move-group nil)
1335 (defvar gnus-current-copy-group nil)
1336 (defvar gnus-current-crosspost-group nil)
1337 (defvar gnus-newsgroup-display nil)
1339 (defvar gnus-newsgroup-dependencies nil)
1340 (defvar gnus-newsgroup-adaptive nil)
1341 (defvar gnus-summary-display-article-function nil)
1342 (defvar gnus-summary-highlight-line-function nil
1343 "Function called after highlighting a summary line.")
1345 (defvar gnus-summary-line-format-alist
1346 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1347 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1348 (?s gnus-tmp-subject-or-nil ?s)
1349 (?n gnus-tmp-name ?s)
1350 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1352 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1354 (?F gnus-tmp-from ?s)
1355 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1356 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1357 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1358 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1359 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1360 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1361 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1362 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1363 (?L gnus-tmp-lines ?s)
1364 (?O gnus-tmp-downloaded ?c)
1365 (?I gnus-tmp-indentation ?s)
1366 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1367 (?R gnus-tmp-replied ?c)
1368 (?\[ gnus-tmp-opening-bracket ?c)
1369 (?\] gnus-tmp-closing-bracket ?c)
1370 (?\> (make-string gnus-tmp-level ? ) ?s)
1371 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1372 (?i gnus-tmp-score ?d)
1373 (?z gnus-tmp-score-char ?c)
1374 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1375 (?U gnus-tmp-unread ?c)
1376 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1378 (?t (gnus-summary-number-of-articles-in-thread
1379 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1381 (?e (gnus-summary-number-of-articles-in-thread
1382 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1384 (?u gnus-tmp-user-defined ?s)
1385 (?P (gnus-pick-line-number) ?d)
1386 (?B gnus-tmp-thread-tree-header-string ?s)
1387 (user-date (gnus-user-date
1388 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1389 "An alist of format specifications that can appear in summary lines.
1390 These are paired with what variables they correspond with, along with
1391 the type of the variable (string, integer, character, etc).")
1393 (defvar gnus-summary-dummy-line-format-alist
1394 `((?S gnus-tmp-subject ?s)
1395 (?N gnus-tmp-number ?d)
1396 (?u gnus-tmp-user-defined ?s)))
1398 (defvar gnus-summary-mode-line-format-alist
1399 `((?G gnus-tmp-group-name ?s)
1400 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1401 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1402 (?A gnus-tmp-article-number ?d)
1403 (?Z gnus-tmp-unread-and-unselected ?s)
1404 (?V gnus-version ?s)
1405 (?U gnus-tmp-unread-and-unticked ?d)
1406 (?S gnus-tmp-subject ?s)
1407 (?e gnus-tmp-unselected ?d)
1408 (?u gnus-tmp-user-defined ?s)
1409 (?d (length gnus-newsgroup-dormant) ?d)
1410 (?t (length gnus-newsgroup-marked) ?d)
1411 (?h (length gnus-newsgroup-spam-marked) ?d)
1412 (?r (length gnus-newsgroup-reads) ?d)
1413 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1414 (?E gnus-newsgroup-expunged-tally ?d)
1415 (?s (gnus-current-score-file-nondirectory) ?s)))
1417 ;; This is here rather than in gnus-art for compilation reasons.
1418 (defvar gnus-article-mode-line-format-alist
1419 (nconc '((?w (gnus-article-wash-status) ?s)
1420 (?m (gnus-article-mime-part-status) ?s))
1421 gnus-summary-mode-line-format-alist))
1423 (defvar gnus-last-search-regexp nil
1424 "Default regexp for article search command.")
1426 (defvar gnus-last-shell-command nil
1427 "Default shell command on article.")
1429 (defvar gnus-newsgroup-agentized nil
1430 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1431 (defvar gnus-newsgroup-begin nil)
1432 (defvar gnus-newsgroup-end nil)
1433 (defvar gnus-newsgroup-last-rmail nil)
1434 (defvar gnus-newsgroup-last-mail nil)
1435 (defvar gnus-newsgroup-last-folder nil)
1436 (defvar gnus-newsgroup-last-file nil)
1437 (defvar gnus-newsgroup-last-directory nil)
1438 (defvar gnus-newsgroup-auto-expire nil)
1439 (defvar gnus-newsgroup-active nil)
1440 (defvar gnus-newsgroup-highest nil)
1442 (defvar gnus-newsgroup-data nil)
1443 (defvar gnus-newsgroup-data-reverse nil)
1444 (defvar gnus-newsgroup-limit nil)
1445 (defvar gnus-newsgroup-limits nil)
1446 (defvar gnus-summary-use-undownloaded-faces nil)
1448 (defvar gnus-newsgroup-unreads nil
1449 "Sorted list of unread articles in the current newsgroup.")
1451 (defvar gnus-newsgroup-unselected nil
1452 "Sorted list of unselected unread articles in the current newsgroup.")
1454 (defvar gnus-newsgroup-reads nil
1455 "Alist of read articles and article marks in the current newsgroup.")
1457 (defvar gnus-newsgroup-expunged-tally nil)
1459 (defvar gnus-newsgroup-marked nil
1460 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1462 (defvar gnus-newsgroup-spam-marked nil
1463 "List of ranges of articles that have been marked as spam.")
1465 (defvar gnus-newsgroup-killed nil
1466 "List of ranges of articles that have been through the scoring process.")
1468 (defvar gnus-newsgroup-cached nil
1469 "Sorted list of articles that come from the article cache.")
1471 (defvar gnus-newsgroup-saved nil
1472 "List of articles that have been saved.")
1474 (defvar gnus-newsgroup-kill-headers nil)
1476 (defvar gnus-newsgroup-replied nil
1477 "List of articles that have been replied to in the current newsgroup.")
1479 (defvar gnus-newsgroup-forwarded nil
1480 "List of articles that have been forwarded in the current newsgroup.")
1482 (defvar gnus-newsgroup-recent nil
1483 "List of articles that have are recent in the current newsgroup.")
1485 (defvar gnus-newsgroup-expirable nil
1486 "Sorted list of articles in the current newsgroup that can be expired.")
1488 (defvar gnus-newsgroup-processable nil
1489 "List of articles in the current newsgroup that can be processed.")
1491 (defvar gnus-newsgroup-downloadable nil
1492 "Sorted list of articles in the current newsgroup that can be processed.")
1494 (defvar gnus-newsgroup-unfetched nil
1495 "Sorted list of articles in the current newsgroup whose headers have
1496 not been fetched into the agent.
1498 This list will always be a subset of gnus-newsgroup-undownloaded.")
1500 (defvar gnus-newsgroup-undownloaded nil
1501 "List of articles in the current newsgroup that haven't been downloaded.")
1503 (defvar gnus-newsgroup-unsendable nil
1504 "List of articles in the current newsgroup that won't be sent.")
1506 (defvar gnus-newsgroup-bookmarks nil
1507 "List of articles in the current newsgroup that have bookmarks.")
1509 (defvar gnus-newsgroup-dormant nil
1510 "Sorted list of dormant articles in the current newsgroup.")
1512 (defvar gnus-newsgroup-unseen nil
1513 "List of unseen articles in the current newsgroup.")
1515 (defvar gnus-newsgroup-seen nil
1516 "Range of seen articles in the current newsgroup.")
1518 (defvar gnus-newsgroup-articles nil
1519 "List of articles in the current newsgroup.")
1521 (defvar gnus-newsgroup-scored nil
1522 "List of scored articles in the current newsgroup.")
1524 (defvar gnus-newsgroup-headers nil
1525 "List of article headers in the current newsgroup.")
1527 (defvar gnus-newsgroup-threads nil)
1529 (defvar gnus-newsgroup-prepared nil
1530 "Whether the current group has been prepared properly.")
1532 (defvar gnus-newsgroup-ancient nil
1533 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1535 (defvar gnus-newsgroup-sparse nil)
1537 (defvar gnus-current-article nil)
1538 (defvar gnus-article-current nil)
1539 (defvar gnus-current-headers nil)
1540 (defvar gnus-have-all-headers nil)
1541 (defvar gnus-last-article nil)
1542 (defvar gnus-newsgroup-history nil)
1543 (defvar gnus-newsgroup-charset nil)
1544 (defvar gnus-newsgroup-ephemeral-charset nil)
1545 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1547 (defvar gnus-article-before-search nil)
1549 (defvar gnus-summary-local-variables
1550 '(gnus-newsgroup-name
1553 gnus-newsgroup-unreads
1554 gnus-newsgroup-unselected
1555 gnus-newsgroup-marked
1556 gnus-newsgroup-spam-marked
1557 gnus-newsgroup-reads
1558 gnus-newsgroup-saved
1559 gnus-newsgroup-replied
1560 gnus-newsgroup-forwarded
1561 gnus-newsgroup-recent
1562 gnus-newsgroup-expirable
1563 gnus-newsgroup-killed
1564 gnus-newsgroup-unseen
1566 gnus-newsgroup-cached
1567 gnus-newsgroup-downloadable
1568 gnus-newsgroup-undownloaded
1569 gnus-newsgroup-unsendable
1571 gnus-newsgroup-begin gnus-newsgroup-end
1572 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1573 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1574 gnus-newsgroup-last-directory
1575 gnus-newsgroup-auto-expire
1576 gnus-newsgroup-processable
1577 gnus-newsgroup-unfetched
1578 gnus-newsgroup-articles
1579 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1580 gnus-newsgroup-headers gnus-newsgroup-threads
1581 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1582 gnus-current-article gnus-current-headers gnus-have-all-headers
1583 gnus-last-article gnus-article-internal-prepare-hook
1584 (gnus-summary-article-delete-hook . global)
1585 (gnus-summary-article-move-hook . global)
1586 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1587 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1588 gnus-thread-expunge-below
1589 gnus-score-alist gnus-current-score-file
1590 (gnus-summary-expunge-below . global)
1591 (gnus-summary-mark-below . global)
1592 (gnus-orphan-score . global)
1593 gnus-newsgroup-active gnus-scores-exclude-files
1594 gnus-newsgroup-highest
1595 gnus-newsgroup-history gnus-newsgroup-ancient
1596 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1597 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1598 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1599 (gnus-newsgroup-expunged-tally . 0)
1600 gnus-cache-removable-articles
1601 gnus-newsgroup-data gnus-newsgroup-data-reverse
1602 gnus-newsgroup-limit gnus-newsgroup-limits
1603 gnus-newsgroup-charset gnus-newsgroup-display
1604 gnus-summary-use-undownloaded-faces)
1605 "Variables that are buffer-local to the summary buffers.")
1607 (defvar gnus-newsgroup-variables nil
1608 "A list of variables that have separate values in different newsgroups.
1609 A list of newsgroup (summary buffer) local variables, or cons of
1610 variables and their default expressions to be evalled (when the default
1611 values are not nil), that should be made global while the summary buffer
1614 Note: The default expressions will be evaluated (using function `eval')
1615 before assignment to the local variable rather than just assigned to it.
1616 If the default expression is the symbol `global', that symbol will not
1617 be evaluated but the global value of the local variable will be used
1620 These variables can be used to set variables in the group parameters
1621 while still allowing them to affect operations done in other buffers.
1624 \(setq gnus-newsgroup-variables
1625 '(message-use-followup-to
1626 (gnus-visible-headers .
1627 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1631 ;; Bind features so that require will believe that gnus-sum has
1632 ;; already been loaded (avoids infinite recursion)
1633 (let ((features (cons 'gnus-sum features)))
1634 (require 'gnus-art)))
1638 (defvar gnus-decode-encoded-word-methods
1639 '(mail-decode-encoded-word-string)
1640 "List of methods used to decode encoded words.
1642 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1643 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1644 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1645 whose names match REGEXP.
1648 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1649 mail-decode-encoded-word-string
1650 (\"chinese\" . rfc1843-decode-string))")
1652 (defvar gnus-decode-encoded-word-methods-cache nil)
1654 (defun gnus-multi-decode-encoded-word-string (string)
1655 "Apply the functions from `gnus-encoded-word-methods' that match."
1656 (unless (and gnus-decode-encoded-word-methods-cache
1657 (eq gnus-newsgroup-name
1658 (car gnus-decode-encoded-word-methods-cache)))
1659 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1660 (dolist (method gnus-decode-encoded-word-methods)
1661 (if (symbolp method)
1662 (nconc gnus-decode-encoded-word-methods-cache (list method))
1663 (if (and gnus-newsgroup-name
1664 (string-match (car method) gnus-newsgroup-name))
1665 (nconc gnus-decode-encoded-word-methods-cache
1666 (list (cdr method)))))))
1667 (dolist (method (cdr gnus-decode-encoded-word-methods-cache) string)
1668 (setq string (funcall method string))))
1670 ;; Subject simplification.
1672 (defun gnus-simplify-whitespace (str)
1673 "Remove excessive whitespace from STR."
1675 (while (string-match "[ \t][ \t]+" str)
1676 (setq str (concat (substring str 0 (match-beginning 0))
1678 (substring str (match-end 0)))))
1680 (when (string-match "^[ \t]+" str)
1681 (setq str (substring str (match-end 0))))
1683 (when (string-match "[ \t]+$" str)
1684 (setq str (substring str 0 (match-beginning 0))))
1687 (defun gnus-simplify-all-whitespace (str)
1688 "Remove all whitespace from STR."
1689 (while (string-match "[ \t\n]+" str)
1690 (setq str (replace-match "" nil nil str)))
1693 (defsubst gnus-simplify-subject-re (subject)
1694 "Remove \"Re:\" from subject lines."
1695 (if (string-match message-subject-re-regexp subject)
1696 (substring subject (match-end 0))
1699 (defun gnus-simplify-subject (subject &optional re-only)
1700 "Remove `Re:' and words in parentheses.
1701 If RE-ONLY is non-nil, strip leading `Re:'s only."
1702 (let ((case-fold-search t)) ;Ignore case.
1703 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1704 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1705 (setq subject (substring subject (match-end 0))))
1706 ;; Remove uninteresting prefixes.
1707 (when (and (not re-only)
1708 gnus-simplify-ignored-prefixes
1709 (string-match gnus-simplify-ignored-prefixes subject))
1710 (setq subject (substring subject (match-end 0))))
1711 ;; Remove words in parentheses from end.
1713 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1714 (setq subject (substring subject 0 (match-beginning 0)))))
1715 ;; Return subject string.
1718 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1720 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1721 (goto-char (point-min))
1722 (while (re-search-forward regexp nil t)
1723 (replace-match (or newtext ""))))
1725 (defun gnus-simplify-buffer-fuzzy ()
1726 "Simplify string in the buffer fuzzily.
1727 The string in the accessible portion of the current buffer is simplified.
1728 It is assumed to be a single-line subject.
1729 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1730 matter is removed. Additional things can be deleted by setting
1731 `gnus-simplify-subject-fuzzy-regexp'."
1732 (let ((case-fold-search t)
1734 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1736 (while (not (eq modified-tick (buffer-modified-tick)))
1737 (setq modified-tick (buffer-modified-tick))
1739 ((listp gnus-simplify-subject-fuzzy-regexp)
1740 (mapc 'gnus-simplify-buffer-fuzzy-step
1741 gnus-simplify-subject-fuzzy-regexp))
1742 (gnus-simplify-subject-fuzzy-regexp
1743 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1744 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1745 (gnus-simplify-buffer-fuzzy-step
1746 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1747 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1749 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1750 (gnus-simplify-buffer-fuzzy-step " +" " ")
1751 (gnus-simplify-buffer-fuzzy-step " $")
1752 (gnus-simplify-buffer-fuzzy-step "^ +")))
1754 (defun gnus-simplify-subject-fuzzy (subject)
1755 "Simplify a subject string fuzzily.
1756 See `gnus-simplify-buffer-fuzzy' for details."
1758 (gnus-set-work-buffer)
1759 (let ((case-fold-search t))
1760 ;; Remove uninteresting prefixes.
1761 (when (and gnus-simplify-ignored-prefixes
1762 (string-match gnus-simplify-ignored-prefixes subject))
1763 (setq subject (substring subject (match-end 0))))
1765 (inline (gnus-simplify-buffer-fuzzy))
1768 (defsubst gnus-simplify-subject-fully (subject)
1769 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1771 (gnus-simplify-subject-functions
1772 (gnus-map-function gnus-simplify-subject-functions subject))
1773 ((null gnus-summary-gather-subject-limit)
1774 (gnus-simplify-subject-re subject))
1775 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1776 (gnus-simplify-subject-fuzzy subject))
1777 ((numberp gnus-summary-gather-subject-limit)
1778 (truncate-string-to-width (gnus-simplify-subject-re subject)
1779 gnus-summary-gather-subject-limit))
1783 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1784 "Check whether two subjects are equal.
1785 If optional argument SIMPLE-FIRST is t, first argument is already
1788 ((null simple-first)
1789 (equal (gnus-simplify-subject-fully s1)
1790 (gnus-simplify-subject-fully s2)))
1793 (gnus-simplify-subject-fully s2)))))
1795 (defun gnus-summary-bubble-group ()
1796 "Increase the score of the current group.
1797 This is a handy function to add to `gnus-summary-exit-hook' to
1798 increase the score of each group you read."
1799 (gnus-group-add-score gnus-newsgroup-name))
1803 ;;; Gnus summary mode
1806 (put 'gnus-summary-mode 'mode-class 'special)
1808 (defvar gnus-article-commands-menu)
1810 ;; Non-orthogonal keys
1812 (gnus-define-keys gnus-summary-mode-map
1813 " " gnus-summary-next-page
1814 "\177" gnus-summary-prev-page
1815 [delete] gnus-summary-prev-page
1816 [backspace] gnus-summary-prev-page
1817 "\r" gnus-summary-scroll-up
1818 "\M-\r" gnus-summary-scroll-down
1819 "n" gnus-summary-next-unread-article
1820 "p" gnus-summary-prev-unread-article
1821 "N" gnus-summary-next-article
1822 "P" gnus-summary-prev-article
1823 "\M-\C-n" gnus-summary-next-same-subject
1824 "\M-\C-p" gnus-summary-prev-same-subject
1825 "\M-n" gnus-summary-next-unread-subject
1826 "\M-p" gnus-summary-prev-unread-subject
1827 "." gnus-summary-first-unread-article
1828 "," gnus-summary-best-unread-article
1829 "\M-s" gnus-summary-search-article-forward
1830 "\M-r" gnus-summary-search-article-backward
1831 "\M-S" gnus-summary-repeat-search-article-forward
1832 "\M-R" gnus-summary-repeat-search-article-backward
1833 "<" gnus-summary-beginning-of-article
1834 ">" gnus-summary-end-of-article
1835 "j" gnus-summary-goto-article
1836 "^" gnus-summary-refer-parent-article
1837 "\M-^" gnus-summary-refer-article
1838 "u" gnus-summary-tick-article-forward
1839 "!" gnus-summary-tick-article-forward
1840 "U" gnus-summary-tick-article-backward
1841 "d" gnus-summary-mark-as-read-forward
1842 "D" gnus-summary-mark-as-read-backward
1843 "E" gnus-summary-mark-as-expirable
1844 "\M-u" gnus-summary-clear-mark-forward
1845 "\M-U" gnus-summary-clear-mark-backward
1846 "k" gnus-summary-kill-same-subject-and-select
1847 "\C-k" gnus-summary-kill-same-subject
1848 "\M-\C-k" gnus-summary-kill-thread
1849 "\M-\C-l" gnus-summary-lower-thread
1850 "e" gnus-summary-edit-article
1851 "#" gnus-summary-mark-as-processable
1852 "\M-#" gnus-summary-unmark-as-processable
1853 "\M-\C-t" gnus-summary-toggle-threads
1854 "\M-\C-s" gnus-summary-show-thread
1855 "\M-\C-h" gnus-summary-hide-thread
1856 "\M-\C-f" gnus-summary-next-thread
1857 "\M-\C-b" gnus-summary-prev-thread
1858 [(meta down)] gnus-summary-next-thread
1859 [(meta up)] gnus-summary-prev-thread
1860 "\M-\C-u" gnus-summary-up-thread
1861 "\M-\C-d" gnus-summary-down-thread
1862 "&" gnus-summary-execute-command
1863 "c" gnus-summary-catchup-and-exit
1864 "\C-w" gnus-summary-mark-region-as-read
1865 "\C-t" gnus-summary-toggle-truncation
1866 "?" gnus-summary-mark-as-dormant
1867 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1868 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1869 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1870 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1871 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1872 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1873 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1874 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1875 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1876 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1877 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1878 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1879 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1880 "=" gnus-summary-expand-window
1881 "\C-x\C-s" gnus-summary-reselect-current-group
1882 "\M-g" gnus-summary-rescan-group
1883 "\C-c\C-r" gnus-summary-caesar-message
1884 "f" gnus-summary-followup
1885 "F" gnus-summary-followup-with-original
1886 "C" gnus-summary-cancel-article
1887 "r" gnus-summary-reply
1888 "R" gnus-summary-reply-with-original
1889 "\C-c\C-f" gnus-summary-mail-forward
1890 "o" gnus-summary-save-article
1891 "\C-o" gnus-summary-save-article-mail
1892 "|" gnus-summary-pipe-output
1893 "\M-k" gnus-summary-edit-local-kill
1894 "\M-K" gnus-summary-edit-global-kill
1896 "\C-c\C-d" gnus-summary-describe-group
1897 "q" gnus-summary-exit
1898 "Q" gnus-summary-exit-no-update
1899 "\C-c\C-i" gnus-info-find-node
1900 gnus-mouse-2 gnus-mouse-pick-article
1901 [follow-link] mouse-face
1902 "m" gnus-summary-mail-other-window
1903 "a" gnus-summary-post-news
1904 "x" gnus-summary-limit-to-unread
1905 "s" gnus-summary-isearch-article
1906 [tab] gnus-summary-widget-forward
1907 "t" gnus-summary-toggle-header
1908 "g" gnus-summary-show-article
1909 "l" gnus-summary-goto-last-article
1910 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1911 "\C-d" gnus-summary-enter-digest-group
1912 "\M-\C-d" gnus-summary-read-document
1913 "\M-\C-e" gnus-summary-edit-parameters
1914 "\M-\C-a" gnus-summary-customize-parameters
1916 "*" gnus-cache-enter-article
1917 "\M-*" gnus-cache-remove-article
1918 "\M-&" gnus-summary-universal-argument
1919 "\C-l" gnus-recenter
1920 "I" gnus-summary-increase-score
1921 "L" gnus-summary-lower-score
1922 "\M-i" gnus-symbolic-argument
1923 "h" gnus-summary-select-article-buffer
1925 "b" gnus-article-view-part
1926 "\M-t" gnus-summary-toggle-display-buttonized
1928 "V" gnus-summary-score-map
1929 "X" gnus-uu-extract-map
1930 "S" gnus-summary-send-map)
1932 ;; Sort of orthogonal keymap
1933 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1934 "t" gnus-summary-tick-article-forward
1935 "!" gnus-summary-tick-article-forward
1936 "d" gnus-summary-mark-as-read-forward
1937 "r" gnus-summary-mark-as-read-forward
1938 "c" gnus-summary-clear-mark-forward
1939 " " gnus-summary-clear-mark-forward
1940 "e" gnus-summary-mark-as-expirable
1941 "x" gnus-summary-mark-as-expirable
1942 "?" gnus-summary-mark-as-dormant
1943 "b" gnus-summary-set-bookmark
1944 "B" gnus-summary-remove-bookmark
1945 "#" gnus-summary-mark-as-processable
1946 "\M-#" gnus-summary-unmark-as-processable
1947 "S" gnus-summary-limit-include-expunged
1948 "C" gnus-summary-catchup
1949 "H" gnus-summary-catchup-to-here
1950 "h" gnus-summary-catchup-from-here
1951 "\C-c" gnus-summary-catchup-all
1952 "k" gnus-summary-kill-same-subject-and-select
1953 "K" gnus-summary-kill-same-subject
1954 "P" gnus-uu-mark-map)
1956 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1957 "c" gnus-summary-clear-above
1958 "u" gnus-summary-tick-above
1959 "m" gnus-summary-mark-above
1960 "k" gnus-summary-kill-below)
1962 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1963 "/" gnus-summary-limit-to-subject
1964 "n" gnus-summary-limit-to-articles
1965 "b" gnus-summary-limit-to-bodies
1966 "h" gnus-summary-limit-to-headers
1967 "w" gnus-summary-pop-limit
1968 "s" gnus-summary-limit-to-subject
1969 "a" gnus-summary-limit-to-author
1970 "u" gnus-summary-limit-to-unread
1971 "m" gnus-summary-limit-to-marks
1972 "M" gnus-summary-limit-exclude-marks
1973 "v" gnus-summary-limit-to-score
1974 "*" gnus-summary-limit-include-cached
1975 "D" gnus-summary-limit-include-dormant
1976 "T" gnus-summary-limit-include-thread
1977 "d" gnus-summary-limit-exclude-dormant
1978 "t" gnus-summary-limit-to-age
1979 "." gnus-summary-limit-to-unseen
1980 "x" gnus-summary-limit-to-extra
1981 "p" gnus-summary-limit-to-display-predicate
1982 "E" gnus-summary-limit-include-expunged
1983 "c" gnus-summary-limit-exclude-childless-dormant
1984 "C" gnus-summary-limit-mark-excluded-as-read
1985 "o" gnus-summary-insert-old-articles
1986 "N" gnus-summary-insert-new-articles
1987 "S" gnus-summary-limit-to-singletons
1988 "r" gnus-summary-limit-to-replied
1989 "R" gnus-summary-limit-to-recipient
1990 "A" gnus-summary-limit-to-address)
1992 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1993 "n" gnus-summary-next-unread-article
1994 "p" gnus-summary-prev-unread-article
1995 "N" gnus-summary-next-article
1996 "P" gnus-summary-prev-article
1997 "\C-n" gnus-summary-next-same-subject
1998 "\C-p" gnus-summary-prev-same-subject
1999 "\M-n" gnus-summary-next-unread-subject
2000 "\M-p" gnus-summary-prev-unread-subject
2001 "f" gnus-summary-first-unread-article
2002 "b" gnus-summary-best-unread-article
2003 "j" gnus-summary-goto-article
2004 "g" gnus-summary-goto-subject
2005 "l" gnus-summary-goto-last-article
2006 "o" gnus-summary-pop-article)
2008 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2009 "k" gnus-summary-kill-thread
2010 "E" gnus-summary-expire-thread
2011 "l" gnus-summary-lower-thread
2012 "i" gnus-summary-raise-thread
2013 "T" gnus-summary-toggle-threads
2014 "t" gnus-summary-rethread-current
2015 "^" gnus-summary-reparent-thread
2016 "\M-^" gnus-summary-reparent-children
2017 "s" gnus-summary-show-thread
2018 "S" gnus-summary-show-all-threads
2019 "h" gnus-summary-hide-thread
2020 "H" gnus-summary-hide-all-threads
2021 "n" gnus-summary-next-thread
2022 "p" gnus-summary-prev-thread
2023 "u" gnus-summary-up-thread
2024 "o" gnus-summary-top-thread
2025 "d" gnus-summary-down-thread
2026 "#" gnus-uu-mark-thread
2027 "\M-#" gnus-uu-unmark-thread)
2029 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2030 "g" gnus-summary-prepare
2031 "c" gnus-summary-insert-cached-articles
2032 "d" gnus-summary-insert-dormant-articles
2033 "t" gnus-summary-insert-ticked-articles)
2035 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2036 "c" gnus-summary-catchup-and-exit
2037 "C" gnus-summary-catchup-all-and-exit
2038 "E" gnus-summary-exit-no-update
2039 "Q" gnus-summary-exit
2040 "Z" gnus-summary-exit
2041 "n" gnus-summary-catchup-and-goto-next-group
2042 "p" gnus-summary-catchup-and-goto-prev-group
2043 "R" gnus-summary-reselect-current-group
2044 "G" gnus-summary-rescan-group
2045 "N" gnus-summary-next-group
2046 "s" gnus-summary-save-newsrc
2047 "P" gnus-summary-prev-group)
2049 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2050 " " gnus-summary-next-page
2051 "n" gnus-summary-next-page
2052 "\177" gnus-summary-prev-page
2053 [delete] gnus-summary-prev-page
2054 "p" gnus-summary-prev-page
2055 "\r" gnus-summary-scroll-up
2056 "\M-\r" gnus-summary-scroll-down
2057 "<" gnus-summary-beginning-of-article
2058 ">" gnus-summary-end-of-article
2059 "b" gnus-summary-beginning-of-article
2060 "e" gnus-summary-end-of-article
2061 "^" gnus-summary-refer-parent-article
2062 "r" gnus-summary-refer-parent-article
2063 "C" gnus-summary-show-complete-article
2064 "D" gnus-summary-enter-digest-group
2065 "R" gnus-summary-refer-references
2066 "T" gnus-summary-refer-thread
2067 "W" gnus-warp-to-article
2068 "g" gnus-summary-show-article
2069 "s" gnus-summary-isearch-article
2070 [tab] gnus-summary-widget-forward
2071 "P" gnus-summary-print-article
2072 "S" gnus-sticky-article
2073 "M" gnus-mailing-list-insinuate
2074 "t" gnus-article-babel)
2076 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2077 "b" gnus-article-add-buttons
2078 "B" gnus-article-add-buttons-to-head
2079 "o" gnus-article-treat-overstrike
2080 "e" gnus-article-emphasize
2081 "w" gnus-article-fill-cited-article
2082 "Q" gnus-article-fill-long-lines
2083 "L" gnus-article-toggle-truncate-lines
2084 "C" gnus-article-capitalize-sentences
2085 "c" gnus-article-remove-cr
2086 "q" gnus-article-de-quoted-unreadable
2087 "6" gnus-article-de-base64-unreadable
2088 "Z" gnus-article-decode-HZ
2089 "A" gnus-article-treat-ansi-sequences
2090 "h" gnus-article-wash-html
2091 "u" gnus-article-unsplit-urls
2092 "s" gnus-summary-force-verify-and-decrypt
2093 "f" gnus-article-display-x-face
2094 "l" gnus-summary-stop-page-breaking
2095 "r" gnus-summary-caesar-message
2096 "m" gnus-summary-morse-message
2097 "t" gnus-summary-toggle-header
2098 "g" gnus-treat-smiley
2099 "v" gnus-summary-verbose-headers
2100 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2101 "p" gnus-article-verify-x-pgp-sig
2102 "d" gnus-article-treat-dumbquotes
2103 "U" gnus-article-treat-non-ascii
2104 "i" gnus-summary-idna-message)
2106 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2107 ;; mnemonic: deuglif*Y*
2108 "u" gnus-article-outlook-unwrap-lines
2109 "a" gnus-article-outlook-repair-attribution
2110 "c" gnus-article-outlook-rearrange-citation
2111 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2113 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2114 "a" gnus-article-hide
2115 "h" gnus-article-hide-headers
2116 "b" gnus-article-hide-boring-headers
2117 "s" gnus-article-hide-signature
2118 "c" gnus-article-hide-citation
2119 "C" gnus-article-hide-citation-in-followups
2120 "l" gnus-article-hide-list-identifiers
2121 "B" gnus-article-strip-banner
2122 "P" gnus-article-hide-pem
2123 "\C-c" gnus-article-hide-citation-maybe)
2125 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2126 "a" gnus-article-highlight
2127 "h" gnus-article-highlight-headers
2128 "c" gnus-article-highlight-citation
2129 "s" gnus-article-highlight-signature)
2131 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2132 "f" gnus-article-treat-fold-headers
2133 "u" gnus-article-treat-unfold-headers
2134 "n" gnus-article-treat-fold-newsgroups)
2136 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2137 "x" gnus-article-display-x-face
2138 "d" gnus-article-display-face
2139 "s" gnus-treat-smiley
2140 "D" gnus-article-remove-images
2141 "W" gnus-article-show-images
2142 "f" gnus-treat-from-picon
2143 "m" gnus-treat-mail-picon
2144 "n" gnus-treat-newsgroups-picon
2145 "g" gnus-treat-from-gravatar
2146 "h" gnus-treat-mail-gravatar)
2148 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2149 "w" gnus-article-decode-mime-words
2150 "c" gnus-article-decode-charset
2151 "v" gnus-mime-view-all-parts
2152 "b" gnus-article-view-part)
2154 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2155 "z" gnus-article-date-ut
2156 "u" gnus-article-date-ut
2157 "l" gnus-article-date-local
2158 "p" gnus-article-date-english
2159 "e" gnus-article-date-lapsed
2160 "o" gnus-article-date-original
2161 "i" gnus-article-date-iso8601
2162 "s" gnus-article-date-user)
2164 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2165 "t" gnus-article-remove-trailing-blank-lines
2166 "l" gnus-article-strip-leading-blank-lines
2167 "m" gnus-article-strip-multiple-blank-lines
2168 "a" gnus-article-strip-blank-lines
2169 "A" gnus-article-strip-all-blank-lines
2170 "s" gnus-article-strip-leading-space
2171 "e" gnus-article-strip-trailing-space
2172 "w" gnus-article-remove-leading-whitespace)
2174 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2176 "d" gnus-summary-describe-group
2177 "h" gnus-summary-describe-briefly
2178 "i" gnus-info-find-node)
2180 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2181 "e" gnus-summary-expire-articles
2182 "\M-\C-e" gnus-summary-expire-articles-now
2183 "\177" gnus-summary-delete-article
2184 [delete] gnus-summary-delete-article
2185 [backspace] gnus-summary-delete-article
2186 "m" gnus-summary-move-article
2187 "r" gnus-summary-respool-article
2188 "w" gnus-summary-edit-article
2189 "c" gnus-summary-copy-article
2190 "B" gnus-summary-crosspost-article
2191 "q" gnus-summary-respool-query
2192 "t" gnus-summary-respool-trace
2193 "i" gnus-summary-import-article
2194 "I" gnus-summary-create-article
2195 "p" gnus-summary-article-posted-p)
2197 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2198 "o" gnus-summary-save-article
2199 "m" gnus-summary-save-article-mail
2200 "F" gnus-summary-write-article-file
2201 "r" gnus-summary-save-article-rmail
2202 "f" gnus-summary-save-article-file
2203 "b" gnus-summary-save-article-body-file
2204 "B" gnus-summary-write-article-body-file
2205 "h" gnus-summary-save-article-folder
2206 "v" gnus-summary-save-article-vm
2207 "p" gnus-summary-pipe-output
2208 "P" gnus-summary-muttprint)
2210 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2211 "b" gnus-summary-display-buttonized
2212 "m" gnus-summary-repair-multipart
2213 "v" gnus-article-view-part
2214 "o" gnus-article-save-part
2215 "O" gnus-article-save-part-and-strip
2216 "r" gnus-article-replace-part
2217 "d" gnus-article-delete-part
2218 "t" gnus-article-view-part-as-type
2219 "j" gnus-article-jump-to-part
2220 "c" gnus-article-copy-part
2221 "C" gnus-article-view-part-as-charset
2222 "e" gnus-article-view-part-externally
2223 "H" gnus-article-browse-html-article
2224 "E" gnus-article-encrypt-body
2225 "i" gnus-article-inline-part
2226 "|" gnus-article-pipe-part)
2228 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2229 "p" gnus-summary-mark-as-processable
2230 "u" gnus-summary-unmark-as-processable
2231 "U" gnus-summary-unmark-all-processable
2232 "v" gnus-uu-mark-over
2233 "s" gnus-uu-mark-series
2234 "r" gnus-uu-mark-region
2235 "g" gnus-uu-unmark-region
2236 "R" gnus-uu-mark-by-regexp
2237 "G" gnus-uu-unmark-by-regexp
2238 "t" gnus-uu-mark-thread
2239 "T" gnus-uu-unmark-thread
2240 "a" gnus-uu-mark-all
2241 "b" gnus-uu-mark-buffer
2242 "S" gnus-uu-mark-sparse
2243 "k" gnus-summary-kill-process-mark
2244 "y" gnus-summary-yank-process-mark
2245 "w" gnus-summary-save-process-mark
2246 "i" gnus-uu-invert-processable)
2248 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2249 ;;"x" gnus-uu-extract-any
2250 "m" gnus-summary-save-parts
2251 "u" gnus-uu-decode-uu
2252 "U" gnus-uu-decode-uu-and-save
2253 "s" gnus-uu-decode-unshar
2254 "S" gnus-uu-decode-unshar-and-save
2255 "o" gnus-uu-decode-save
2256 "O" gnus-uu-decode-save
2257 "b" gnus-uu-decode-binhex
2258 "B" gnus-uu-decode-binhex
2259 "Y" gnus-uu-decode-yenc
2260 "p" gnus-uu-decode-postscript
2261 "P" gnus-uu-decode-postscript-and-save)
2264 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2265 "u" gnus-uu-decode-uu-view
2266 "U" gnus-uu-decode-uu-and-save-view
2267 "s" gnus-uu-decode-unshar-view
2268 "S" gnus-uu-decode-unshar-and-save-view
2269 "o" gnus-uu-decode-save-view
2270 "O" gnus-uu-decode-save-view
2271 "b" gnus-uu-decode-binhex-view
2272 "B" gnus-uu-decode-binhex-view
2273 "p" gnus-uu-decode-postscript-view
2274 "P" gnus-uu-decode-postscript-and-save-view)
2276 (defvar gnus-article-post-menu nil)
2278 (defconst gnus-summary-menu-maxlen 20)
2280 (defun gnus-summary-menu-split (menu)
2281 ;; If we have lots of elements, divide them into groups of 20
2282 ;; and make a pane (or submenu) for each one.
2283 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2284 (let ((menu menu) sublists next
2287 ;; Pull off the next gnus-summary-menu-maxlen elements
2288 ;; and make them the next element of sublist.
2289 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2291 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2293 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2294 (aref (car (last menu)) 0)) menu)
2298 (nreverse sublists))
2299 ;; Few elements--put them all in one pane.
2302 (defun gnus-summary-make-menu-bar ()
2303 (gnus-turn-off-edit-menu 'summary)
2305 (unless (boundp 'gnus-summary-misc-menu)
2308 gnus-summary-kill-menu gnus-summary-mode-map ""
2313 ["Customize" gnus-score-customize t])
2314 (gnus-make-score-map 'increase)
2315 (gnus-make-score-map 'lower)
2317 ["Kill below" gnus-summary-kill-below t]
2318 ["Mark above" gnus-summary-mark-above t]
2319 ["Tick above" gnus-summary-tick-above t]
2320 ["Clear above" gnus-summary-clear-above t])
2321 ["Current score" gnus-summary-current-score t]
2322 ["Set score" gnus-summary-set-score t]
2323 ["Switch current score file..." gnus-score-change-score-file t]
2324 ["Set mark below..." gnus-score-set-mark-below t]
2325 ["Set expunge below..." gnus-score-set-expunge-below t]
2326 ["Edit current score file" gnus-score-edit-current-scores t]
2327 ["Edit score file..." gnus-score-edit-file t]
2328 ["Trace score" gnus-score-find-trace t]
2329 ["Find words" gnus-score-find-favourite-words t]
2330 ["Rescore buffer" gnus-summary-rescore t]
2331 ["Increase score..." gnus-summary-increase-score t]
2332 ["Lower score..." gnus-summary-lower-score t]))))
2334 ;; Define both the Article menu in the summary buffer and the
2335 ;; equivalent Commands menu in the article buffer here for
2339 ["All" gnus-article-hide t]
2340 ["Headers" gnus-article-hide-headers t]
2341 ["Signature" gnus-article-hide-signature t]
2342 ["Citation" gnus-article-hide-citation t]
2343 ["List identifiers" gnus-article-hide-list-identifiers t]
2344 ["Banner" gnus-article-strip-banner t]
2345 ["Boring headers" gnus-article-hide-boring-headers t])
2347 ["All" gnus-article-highlight t]
2348 ["Headers" gnus-article-highlight-headers t]
2349 ["Signature" gnus-article-highlight-signature t]
2350 ["Citation" gnus-article-highlight-citation t])
2352 ["Words" gnus-article-decode-mime-words t]
2353 ["Charset" gnus-article-decode-charset t]
2354 ["QP" gnus-article-de-quoted-unreadable t]
2355 ["Base64" gnus-article-de-base64-unreadable t]
2356 ["View MIME buttons" gnus-summary-display-buttonized t]
2357 ["View all" gnus-mime-view-all-parts t]
2358 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2359 ["Encrypt body" gnus-article-encrypt-body
2360 :active (not (gnus-group-read-only-p))
2361 ,@(if (featurep 'xemacs) nil
2362 '(:help "Encrypt the message body on disk"))]
2363 ["Extract all parts..." gnus-summary-save-parts t]
2365 ["Repair multipart" gnus-summary-repair-multipart t]
2366 ["Pipe part..." gnus-article-pipe-part t]
2367 ["Inline part" gnus-article-inline-part t]
2368 ["View part as type..." gnus-article-view-part-as-type t]
2369 ["Encrypt body" gnus-article-encrypt-body
2370 :active (not (gnus-group-read-only-p))
2371 ,@(if (featurep 'xemacs) nil
2372 '(:help "Encrypt the message body on disk"))]
2373 ["View part externally" gnus-article-view-part-externally t]
2374 ["View HTML parts in browser" gnus-article-browse-html-article t]
2375 ["View part with charset..." gnus-article-view-part-as-charset t]
2376 ["Copy part" gnus-article-copy-part t]
2377 ["Save part..." gnus-article-save-part t]
2378 ["View part" gnus-article-view-part t]))
2380 ["Local" gnus-article-date-local t]
2381 ["ISO8601" gnus-article-date-iso8601 t]
2382 ["UT" gnus-article-date-ut t]
2383 ["Original" gnus-article-date-original t]
2384 ["Lapsed" gnus-article-date-lapsed t]
2385 ["User-defined" gnus-article-date-user t])
2387 ["Remove images" gnus-article-remove-images t]
2388 ["Toggle smiley" gnus-treat-smiley t]
2389 ["Show X-Face" gnus-article-display-x-face t]
2390 ["Show picons in From" gnus-treat-from-picon t]
2391 ["Show picons in mail headers" gnus-treat-mail-picon t]
2392 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2393 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2394 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2395 ("View as different encoding"
2396 ,@(gnus-summary-menu-split
2399 ;; Since easymenu under Emacs doesn't allow
2400 ;; lambda forms for menu commands, we should
2401 ;; provide intern'ed function symbols.
2402 (let ((command (intern (format "\
2403 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2407 (let ((gnus-summary-show-article-charset-alist
2409 (gnus-summary-show-article 1))))
2410 `[,(symbol-name cs) ,command t]))
2411 (sort (if (fboundp 'coding-system-list)
2412 (coding-system-list)
2413 (mapcar 'car mm-mime-mule-charset-alist))
2417 ["Leading" gnus-article-strip-leading-blank-lines t]
2418 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2419 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2420 ["All of the above" gnus-article-strip-blank-lines t]
2421 ["All" gnus-article-strip-all-blank-lines t]
2422 ["Leading space" gnus-article-strip-leading-space t]
2423 ["Trailing space" gnus-article-strip-trailing-space t]
2424 ["Leading space in headers"
2425 gnus-article-remove-leading-whitespace t])
2426 ["Overstrike" gnus-article-treat-overstrike t]
2427 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2428 ["Non-ASCII" gnus-article-treat-non-ascii t]
2429 ["Emphasis" gnus-article-emphasize t]
2430 ["Word wrap" gnus-article-fill-cited-article t]
2431 ["Fill long lines" gnus-article-fill-long-lines t]
2432 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2433 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2434 ["Remove CR" gnus-article-remove-cr t]
2435 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2436 ["Base64" gnus-article-de-base64-unreadable t]
2437 ["Rot 13" gnus-summary-caesar-message
2438 ,@(if (featurep 'xemacs) '(t)
2439 '(:help "\"Caesar rotate\" article by 13"))]
2440 ["De-IDNA" gnus-summary-idna-message t]
2441 ["Morse decode" gnus-summary-morse-message t]
2442 ["Unix pipe..." gnus-summary-pipe-message t]
2443 ["Add buttons" gnus-article-add-buttons t]
2444 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2445 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2446 ["Verbose header" gnus-summary-verbose-headers t]
2447 ["Toggle header" gnus-summary-toggle-header t]
2448 ["Unfold headers" gnus-article-treat-unfold-headers t]
2449 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2450 ["Html" gnus-article-wash-html t]
2451 ["Unsplit URLs" gnus-article-unsplit-urls t]
2452 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2453 ["Decode HZ" gnus-article-decode-HZ t]
2454 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2455 ("(Outlook) Deuglify"
2456 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2457 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2458 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2459 ["Full (Outlook) deuglify"
2460 gnus-article-outlook-deuglify-article t])
2463 ["Save in default format..." gnus-summary-save-article
2464 ,@(if (featurep 'xemacs) '(t)
2465 '(:help "Save article using default method"))]
2466 ["Save in file..." gnus-summary-save-article-file
2467 ,@(if (featurep 'xemacs) '(t)
2468 '(:help "Save article in file"))]
2469 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2470 ["Save in MH folder..." gnus-summary-save-article-folder t]
2471 ["Save in VM folder..." gnus-summary-save-article-vm t]
2472 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2473 ["Save body in file..." gnus-summary-save-article-body-file t]
2474 ["Pipe through a filter..." gnus-summary-pipe-output t]
2475 ["Print with Muttprint..." gnus-summary-muttprint t]
2476 ["Print" gnus-summary-print-article
2477 ,@(if (featurep 'xemacs) '(t)
2478 '(:help "Generate and print a PostScript image"))])
2479 ("Copy, move,... (Backend)"
2480 ,@(if (featurep 'xemacs) nil
2481 '(:help "Copying, moving, expiring articles..."))
2482 ["Respool article..." gnus-summary-respool-article t]
2483 ["Move article..." gnus-summary-move-article
2484 (gnus-check-backend-function
2485 'request-move-article gnus-newsgroup-name)]
2486 ["Copy article..." gnus-summary-copy-article t]
2487 ["Crosspost article..." gnus-summary-crosspost-article
2488 (gnus-check-backend-function
2489 'request-replace-article gnus-newsgroup-name)]
2490 ["Import file..." gnus-summary-import-article
2491 (gnus-check-backend-function
2492 'request-accept-article gnus-newsgroup-name)]
2493 ["Create article..." gnus-summary-create-article
2494 (gnus-check-backend-function
2495 'request-accept-article gnus-newsgroup-name)]
2496 ["Check if posted" gnus-summary-article-posted-p t]
2497 ["Edit article" gnus-summary-edit-article
2498 (not (gnus-group-read-only-p))]
2499 ["Delete article" gnus-summary-delete-article
2500 (gnus-check-backend-function
2501 'request-expire-articles gnus-newsgroup-name)]
2502 ["Query respool" gnus-summary-respool-query t]
2503 ["Trace respool" gnus-summary-respool-trace t]
2504 ["Delete expirable articles" gnus-summary-expire-articles-now
2505 (gnus-check-backend-function
2506 'request-expire-articles gnus-newsgroup-name)])
2508 ["Uudecode" gnus-uu-decode-uu
2509 ,@(if (featurep 'xemacs) '(t)
2510 '(:help "Decode uuencoded article(s)"))]
2511 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2512 ["Unshar" gnus-uu-decode-unshar t]
2513 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2514 ["Save" gnus-uu-decode-save t]
2515 ["Binhex" gnus-uu-decode-binhex t]
2516 ["Postscript" gnus-uu-decode-postscript t]
2517 ["All MIME parts" gnus-summary-save-parts t])
2519 ["Enter article" gnus-cache-enter-article t]
2520 ["Remove article" gnus-cache-remove-article t])
2521 ["Translate" gnus-article-babel t]
2522 ["Select article buffer" gnus-summary-select-article-buffer t]
2523 ["Make article buffer sticky" gnus-sticky-article t]
2524 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2525 ["Isearch article..." gnus-summary-isearch-article t]
2526 ["Beginning of the article" gnus-summary-beginning-of-article t]
2527 ["End of the article" gnus-summary-end-of-article t]
2528 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2529 ["Fetch referenced articles" gnus-summary-refer-references t]
2530 ["Fetch current thread" gnus-summary-refer-thread t]
2531 ["Fetch article with id..." gnus-summary-refer-article t]
2532 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2533 ["Redisplay" gnus-summary-show-article t]
2534 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2536 gnus-summary-article-menu gnus-summary-mode-map ""
2537 (cons "Article" innards))
2539 (if (not (keymapp gnus-summary-article-menu))
2541 gnus-article-commands-menu gnus-article-mode-map ""
2542 (cons "Commands" innards))
2543 ;; in Emacs, don't share menu.
2544 (setq gnus-article-commands-menu
2545 (copy-keymap gnus-summary-article-menu))
2546 (define-key gnus-article-mode-map [menu-bar commands]
2547 (cons "Commands" gnus-article-commands-menu))))
2550 gnus-summary-thread-menu gnus-summary-mode-map ""
2552 ["Find all messages in thread" gnus-summary-refer-thread t]
2553 ["Toggle threading" gnus-summary-toggle-threads t]
2554 ["Hide threads" gnus-summary-hide-all-threads t]
2555 ["Show threads" gnus-summary-show-all-threads t]
2556 ["Hide thread" gnus-summary-hide-thread t]
2557 ["Show thread" gnus-summary-show-thread t]
2558 ["Go to next thread" gnus-summary-next-thread t]
2559 ["Go to previous thread" gnus-summary-prev-thread t]
2560 ["Go down thread" gnus-summary-down-thread t]
2561 ["Go up thread" gnus-summary-up-thread t]
2562 ["Top of thread" gnus-summary-top-thread t]
2563 ["Mark thread as read" gnus-summary-kill-thread t]
2564 ["Mark thread as expired" gnus-summary-expire-thread t]
2565 ["Lower thread score" gnus-summary-lower-thread t]
2566 ["Raise thread score" gnus-summary-raise-thread t]
2567 ["Rethread current" gnus-summary-rethread-current t]))
2570 gnus-summary-post-menu gnus-summary-mode-map ""
2572 ["Send a message (mail or news)" gnus-summary-post-news
2573 ,@(if (featurep 'xemacs) '(t)
2574 '(:help "Compose a new message (mail or news)"))]
2575 ["Followup" gnus-summary-followup
2576 ,@(if (featurep 'xemacs) '(t)
2577 '(:help "Post followup to this article"))]
2578 ["Followup and yank" gnus-summary-followup-with-original
2579 ,@(if (featurep 'xemacs) '(t)
2580 '(:help "Post followup to this article, quoting its contents"))]
2581 ["Supersede article" gnus-summary-supersede-article t]
2582 ["Cancel article" gnus-summary-cancel-article
2583 ,@(if (featurep 'xemacs) '(t)
2584 '(:help "Cancel an article you posted"))]
2585 ["Reply" gnus-summary-reply t]
2586 ["Reply and yank" gnus-summary-reply-with-original t]
2587 ["Wide reply" gnus-summary-wide-reply t]
2588 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2589 ,@(if (featurep 'xemacs) '(t)
2590 '(:help "Mail a reply, quoting this article"))]
2591 ["Very wide reply" gnus-summary-very-wide-reply t]
2592 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2593 ,@(if (featurep 'xemacs) '(t)
2594 '(:help "Mail a very wide reply, quoting this article"))]
2595 ["Mail forward" gnus-summary-mail-forward t]
2596 ["Post forward" gnus-summary-post-forward t]
2597 ["Digest and mail" gnus-uu-digest-mail-forward t]
2598 ["Digest and post" gnus-uu-digest-post-forward t]
2599 ["Resend message" gnus-summary-resend-message t]
2600 ["Resend message edit" gnus-summary-resend-message-edit t]
2601 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2602 ["Send a mail" gnus-summary-mail-other-window t]
2603 ["Create a local message" gnus-summary-news-other-window t]
2604 ["Uuencode and post" gnus-uu-post-news
2605 ,@(if (featurep 'xemacs) '(t)
2606 '(:help "Post a uuencoded article"))]
2607 ["Followup via news" gnus-summary-followup-to-mail t]
2608 ["Followup via news and yank"
2609 gnus-summary-followup-to-mail-with-original t]
2610 ["Strip signature on reply"
2613 (if (not (memq message-cite-function
2614 '(message-cite-original-without-signature
2615 message-cite-original)))
2616 ;; Stupid workaround for XEmacs not honoring :visible.
2617 (message "Can't toggle this value of `message-cite-function'")
2618 (setq message-cite-function
2619 (if (eq message-cite-function
2620 'message-cite-original-without-signature)
2621 'message-cite-original
2622 'message-cite-original-without-signature))))
2623 ;; XEmacs barfs on :visible.
2624 ,@(if (featurep 'xemacs) nil
2625 '(:visible (memq message-cite-function
2626 '(message-cite-original-without-signature
2627 message-cite-original))))
2629 :selected (eq message-cite-function
2630 'message-cite-original-without-signature)
2631 ,@(if (featurep 'xemacs) nil
2632 '(:help "Strip signature from cited article when replying."))]
2634 ;;["Send" gnus-summary-send-draft t]
2635 ;;["Send bounced" gnus-resend-bounced-mail t])
2639 ((not (keymapp gnus-summary-post-menu))
2640 (setq gnus-article-post-menu gnus-summary-post-menu))
2641 ((not gnus-article-post-menu)
2642 ;; Don't share post menu.
2643 (setq gnus-article-post-menu
2644 (copy-keymap gnus-summary-post-menu))))
2645 (define-key gnus-article-mode-map [menu-bar post]
2646 (cons "Post" gnus-article-post-menu))
2649 gnus-summary-misc-menu gnus-summary-mode-map ""
2652 ["Mark as read" gnus-summary-mark-as-read-forward t]
2653 ["Mark same subject and select"
2654 gnus-summary-kill-same-subject-and-select t]
2655 ["Mark same subject" gnus-summary-kill-same-subject t]
2656 ["Catchup" gnus-summary-catchup
2657 ,@(if (featurep 'xemacs) '(t)
2658 '(:help "Mark unread articles in this group as read"))]
2659 ["Catchup all" gnus-summary-catchup-all t]
2660 ["Catchup to here" gnus-summary-catchup-to-here t]
2661 ["Catchup from here" gnus-summary-catchup-from-here t]
2662 ["Catchup region" gnus-summary-mark-region-as-read
2663 (gnus-mark-active-p)]
2664 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2666 ["Tick" gnus-summary-tick-article-forward t]
2667 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2668 ["Remove marks" gnus-summary-clear-mark-forward t]
2669 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2670 ["Set bookmark" gnus-summary-set-bookmark t]
2671 ["Remove bookmark" gnus-summary-remove-bookmark t])
2673 ["Marks..." gnus-summary-limit-to-marks t]
2674 ["Subject..." gnus-summary-limit-to-subject t]
2675 ["Author..." gnus-summary-limit-to-author t]
2676 ["Recipient..." gnus-summary-limit-to-recipient t]
2677 ["Address..." gnus-summary-limit-to-address t]
2678 ["Age..." gnus-summary-limit-to-age t]
2679 ["Extra..." gnus-summary-limit-to-extra t]
2680 ["Score..." gnus-summary-limit-to-score t]
2681 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2682 ["Unread" gnus-summary-limit-to-unread t]
2683 ["Unseen" gnus-summary-limit-to-unseen t]
2684 ["Singletons" gnus-summary-limit-to-singletons t]
2685 ["Replied" gnus-summary-limit-to-replied t]
2686 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2687 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2688 ["Pop limit" gnus-summary-pop-limit t]
2689 ["Show dormant" gnus-summary-limit-include-dormant t]
2690 ["Hide childless dormant"
2691 gnus-summary-limit-exclude-childless-dormant t]
2692 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2693 ["Hide marked" gnus-summary-limit-exclude-marks t]
2694 ["Show expunged" gnus-summary-limit-include-expunged t])
2696 ["Set mark" gnus-summary-mark-as-processable t]
2697 ["Remove mark" gnus-summary-unmark-as-processable t]
2698 ["Remove all marks" gnus-summary-unmark-all-processable t]
2699 ["Invert marks" gnus-uu-invert-processable t]
2700 ["Mark above" gnus-uu-mark-over t]
2701 ["Mark series" gnus-uu-mark-series t]
2702 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2703 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2704 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2705 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2706 ["Mark all" gnus-uu-mark-all t]
2707 ["Mark buffer" gnus-uu-mark-buffer t]
2708 ["Mark sparse" gnus-uu-mark-sparse t]
2709 ["Mark thread" gnus-uu-mark-thread t]
2710 ["Unmark thread" gnus-uu-unmark-thread t]
2711 ("Process Mark Sets"
2712 ["Kill" gnus-summary-kill-process-mark t]
2713 ["Yank" gnus-summary-yank-process-mark
2714 gnus-newsgroup-process-stack]
2715 ["Save" gnus-summary-save-process-mark t]
2716 ["Run command on marked..." gnus-summary-universal-argument t]))
2719 ["Page forward" gnus-summary-next-page
2720 ,@(if (featurep 'xemacs) '(t)
2721 '(:help "Show next page of article"))]
2722 ["Page backward" gnus-summary-prev-page
2723 ,@(if (featurep 'xemacs) '(t)
2724 '(:help "Show previous page of article"))]
2725 ["Line forward" gnus-summary-scroll-up t])
2727 ["Next unread article" gnus-summary-next-unread-article t]
2728 ["Previous unread article" gnus-summary-prev-unread-article t]
2729 ["Next article" gnus-summary-next-article t]
2730 ["Previous article" gnus-summary-prev-article t]
2731 ["Next unread subject" gnus-summary-next-unread-subject t]
2732 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2733 ["Next article same subject" gnus-summary-next-same-subject t]
2734 ["Previous article same subject" gnus-summary-prev-same-subject t]
2735 ["First unread article" gnus-summary-first-unread-article t]
2736 ["Best unread article" gnus-summary-best-unread-article t]
2737 ["Go to subject number..." gnus-summary-goto-subject t]
2738 ["Go to article number..." gnus-summary-goto-article t]
2739 ["Go to the last article" gnus-summary-goto-last-article t]
2740 ["Pop article off history" gnus-summary-pop-article t])
2742 ["Sort by number" gnus-summary-sort-by-number t]
2743 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2744 ["Sort by author" gnus-summary-sort-by-author t]
2745 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2746 ["Sort by subject" gnus-summary-sort-by-subject t]
2747 ["Sort by date" gnus-summary-sort-by-date t]
2748 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2749 ["Sort by score" gnus-summary-sort-by-score t]
2750 ["Sort by lines" gnus-summary-sort-by-lines t]
2751 ["Sort by characters" gnus-summary-sort-by-chars t]
2752 ["Randomize" gnus-summary-sort-by-random t]
2753 ["Original sort" gnus-summary-sort-by-original t])
2755 ["Describe group" gnus-summary-describe-group t]
2756 ["Read manual" gnus-info-find-node t])
2758 ["Pick and read" gnus-pick-mode t]
2759 ["Binary" gnus-binary-mode t])
2761 ["Regenerate" gnus-summary-prepare t]
2762 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2763 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2764 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2765 ["Toggle threading" gnus-summary-toggle-threads t])
2766 ["See old articles" gnus-summary-insert-old-articles t]
2767 ["See new articles" gnus-summary-insert-new-articles t]
2768 ["Filter articles..." gnus-summary-execute-command t]
2769 ["Run command on articles..." gnus-summary-universal-argument t]
2770 ["Search articles forward..." gnus-summary-search-article-forward t]
2771 ["Search articles backward..." gnus-summary-search-article-backward t]
2772 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2773 ["Expand window" gnus-summary-expand-window t]
2774 ["Expire expirable articles" gnus-summary-expire-articles
2775 (gnus-check-backend-function
2776 'request-expire-articles gnus-newsgroup-name)]
2777 ["Edit local kill file" gnus-summary-edit-local-kill t]
2778 ["Edit main kill file" gnus-summary-edit-global-kill t]
2779 ["Edit group parameters" gnus-summary-edit-parameters t]
2780 ["Customize group parameters" gnus-summary-customize-parameters t]
2781 ["Send a bug report" gnus-bug t]
2783 ["Catchup and exit" gnus-summary-catchup-and-exit
2784 ,@(if (featurep 'xemacs) '(t)
2785 '(:help "Mark unread articles in this group as read, then exit"))]
2786 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2787 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2788 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2789 ["Exit group" gnus-summary-exit
2790 ,@(if (featurep 'xemacs) '(t)
2791 '(:help "Exit current group, return to group selection mode"))]
2792 ["Exit group without updating" gnus-summary-exit-no-update t]
2793 ["Exit and goto next group" gnus-summary-next-group t]
2794 ["Exit and goto prev group" gnus-summary-prev-group t]
2795 ["Reselect group" gnus-summary-reselect-current-group t]
2796 ["Rescan group" gnus-summary-rescan-group t]
2797 ["Update dribble" gnus-summary-save-newsrc t])))
2799 (gnus-run-hooks 'gnus-summary-menu-hook)))
2801 (defvar gnus-summary-tool-bar-map nil)
2803 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2804 ;; affect _new_ message buffers. We might add a function that walks thru all
2805 ;; summary-mode buffers and force the update.
2806 (defun gnus-summary-tool-bar-update (&optional symbol value)
2807 "Update summary mode toolbar.
2808 Setter function for custom variables."
2809 (setq-default gnus-summary-tool-bar-map nil)
2811 ;; When used as ":set" function:
2812 (set-default symbol value))
2813 (when (gnus-buffer-live-p gnus-summary-buffer)
2814 (with-current-buffer gnus-summary-buffer
2815 (gnus-summary-make-tool-bar))))
2817 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2818 'gnus-summary-tool-bar-gnome
2819 'gnus-summary-tool-bar-retro)
2820 "Specifies the Gnus summary tool bar.
2822 It can be either a list or a symbol refering to a list. See
2823 `gmm-tool-bar-from-list' for the format of the list. The
2824 default key map is `gnus-summary-mode-map'.
2826 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2827 `gnus-summary-tool-bar-retro'."
2828 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2829 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2830 (repeat :tag "User defined list" gmm-tool-bar-item)
2832 :version "23.1" ;; No Gnus
2833 :initialize 'custom-initialize-default
2834 :set 'gnus-summary-tool-bar-update
2835 :group 'gnus-summary)
2837 (defcustom gnus-summary-tool-bar-gnome
2838 '((gnus-summary-post-news "mail/compose" nil)
2839 (gnus-summary-insert-new-articles "mail/inbox" nil
2840 :visible (or (not gnus-agent)
2842 (gnus-summary-reply-with-original "mail/reply")
2843 (gnus-summary-reply "mail/reply" nil :visible nil)
2844 (gnus-summary-followup-with-original "mail/reply-all")
2845 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2846 (gnus-summary-mail-forward "mail/forward")
2847 (gnus-summary-save-article "mail/save")
2848 (gnus-summary-search-article-forward "search" nil :visible nil)
2849 (gnus-summary-print-article "print")
2850 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2851 ;; Some new commands that may need more suitable icons:
2852 (gnus-summary-save-newsrc "save" nil :visible nil)
2853 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2854 (gnus-summary-prev-article "left-arrow")
2855 (gnus-summary-next-article "right-arrow")
2856 (gnus-summary-next-page "next-page")
2857 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2859 ;; Maybe some sort-by-... could be added:
2860 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2861 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2862 (gnus-summary-mark-as-expirable
2864 :visible (gnus-check-backend-function 'request-expire-articles
2865 gnus-newsgroup-name))
2866 (gnus-summary-mark-as-spam
2868 :visible (and (fboundp 'spam-group-ham-contents-p)
2869 (spam-group-ham-contents-p gnus-newsgroup-name))
2870 :help "Mark as spam")
2871 (gnus-summary-mark-as-read-forward
2873 :visible (and (fboundp 'spam-group-spam-contents-p)
2874 (spam-group-spam-contents-p gnus-newsgroup-name)))
2876 (gnus-summary-exit "exit")
2877 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2878 (gnus-info-find-node "help"))
2879 "List of functions for the summary tool bar (GNOME style).
2881 See `gmm-tool-bar-from-list' for the format of the list."
2882 :type '(repeat gmm-tool-bar-item)
2883 :version "23.1" ;; No Gnus
2884 :initialize 'custom-initialize-default
2885 :set 'gnus-summary-tool-bar-update
2886 :group 'gnus-summary)
2888 (defcustom gnus-summary-tool-bar-retro
2889 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2890 (gnus-summary-next-unread-article "gnus/next-ur")
2891 (gnus-summary-post-news "gnus/post")
2892 (gnus-summary-followup-with-original "gnus/fuwo")
2893 (gnus-summary-followup "gnus/followup")
2894 (gnus-summary-reply-with-original "gnus/reply-wo")
2895 (gnus-summary-reply "gnus/reply")
2896 (gnus-summary-caesar-message "gnus/rot13")
2897 (gnus-uu-decode-uu "gnus/uu-decode")
2898 (gnus-summary-save-article-file "gnus/save-aif")
2899 (gnus-summary-save-article "gnus/save-art")
2900 (gnus-uu-post-news "gnus/uu-post")
2901 (gnus-summary-catchup "gnus/catchup")
2902 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2903 (gnus-summary-exit "gnus/exit-summ")
2904 ;; Some new command that may need more suitable icons:
2905 (gnus-summary-print-article "gnus/print" nil :visible nil)
2906 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2907 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2908 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2909 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2910 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2911 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2913 (gnus-info-find-node "gnus/help" nil :visible nil))
2914 "List of functions for the summary tool bar (retro look).
2916 See `gmm-tool-bar-from-list' for the format of the list."
2917 :type '(repeat gmm-tool-bar-item)
2918 :version "23.1" ;; No Gnus
2919 :initialize 'custom-initialize-default
2920 :set 'gnus-summary-tool-bar-update
2921 :group 'gnus-summary)
2923 (defcustom gnus-summary-tool-bar-zap-list t
2924 "List of icon items from the global tool bar.
2925 These items are not displayed in the Gnus summary mode tool bar.
2927 See `gmm-tool-bar-from-list' for the format of the list."
2928 :type 'gmm-tool-bar-zap-list
2929 :version "23.1" ;; No Gnus
2930 :initialize 'custom-initialize-default
2931 :set 'gnus-summary-tool-bar-update
2932 :group 'gnus-summary)
2934 (defvar image-load-path)
2935 (defvar tool-bar-map)
2937 (defun gnus-summary-make-tool-bar (&optional force)
2938 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2939 When FORCE, rebuild the tool bar."
2940 (when (and (not (featurep 'xemacs))
2941 (boundp 'tool-bar-mode)
2943 (or (not gnus-summary-tool-bar-map) force))
2945 (gmm-image-load-path-for-library "gnus"
2948 (image-load-path (cons (car load-path)
2949 (when (boundp 'image-load-path)
2951 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2952 gnus-summary-tool-bar-zap-list
2953 'gnus-summary-mode-map)))
2955 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2957 (setq gnus-summary-tool-bar-map map))))
2958 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2960 (defun gnus-score-set-default (var value)
2961 "A version of set that updates the GNU Emacs menu-bar."
2963 ;; It is the message that forces the active status to be updated.
2966 (defun gnus-make-score-map (type)
2967 "Make a summary score map of type TYPE."
2970 (let ((headers '(("author" "from" string)
2971 ("subject" "subject" string)
2972 ("article body" "body" string)
2973 ("article head" "head" string)
2974 ("xref" "xref" string)
2975 ("extra header" "extra" string)
2976 ("lines" "lines" number)
2977 ("followups to author" "followup" string)))
2978 (types '((number ("less than" <)
2981 (string ("substring" s)
2985 (perms '(("temporary" (current-time-string))
2993 (if (eq type 'lower)
2998 (setq header (car headers))
3004 (let ((ts (cdr (assoc (nth 2 header) types)))
3020 'gnus-summary-score-entry
3022 (if (or (string= (nth 1 header)
3024 (string= (nth 1 header)
3027 (list 'gnus-summary-header
3029 (list 'quote (nth 1 (car ts)))
3030 (list 'gnus-score-delta-default
3037 (list (nreverse outp))))
3040 (list (nreverse outt))))
3042 (setq headers (cdr headers)))
3043 (list (nreverse outh))))))))
3046 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3047 (defvar bookmark-make-record-function)
3050 (defun gnus-summary-mode (&optional group)
3051 "Major mode for reading articles.
3053 All normal editing commands are switched off.
3054 \\<gnus-summary-mode-map>
3055 Each line in this buffer represents one article. To read an
3056 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3057 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3060 You can also post articles and send mail from this buffer. To
3061 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3062 of an article, type `\\[gnus-summary-reply]'.
3064 There are approx. one gazillion commands you can execute in this
3065 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3067 The following commands are available:
3069 \\{gnus-summary-mode-map}"
3071 (kill-all-local-variables)
3072 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3073 (gnus-summary-make-local-variables))
3074 (gnus-summary-make-local-variables)
3075 (setq gnus-newsgroup-name group)
3076 (when (gnus-visual-p 'summary-menu 'menu)
3077 (gnus-summary-make-menu-bar)
3078 (gnus-summary-make-tool-bar))
3079 (gnus-make-thread-indent-array)
3080 (gnus-simplify-mode-line)
3081 (setq major-mode 'gnus-summary-mode)
3082 (setq mode-name "Summary")
3083 (use-local-map gnus-summary-mode-map)
3084 (buffer-disable-undo)
3085 (setq buffer-read-only t ;Disable modification
3086 show-trailing-whitespace nil)
3087 (setq truncate-lines t)
3088 (add-to-invisibility-spec '(gnus-sum . t))
3089 (gnus-summary-set-display-table)
3090 (gnus-set-default-directory)
3091 (make-local-variable 'gnus-summary-line-format)
3092 (make-local-variable 'gnus-summary-line-format-spec)
3093 (make-local-variable 'gnus-summary-dummy-line-format)
3094 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3095 (make-local-variable 'gnus-summary-mark-positions)
3096 (gnus-make-local-hook 'pre-command-hook)
3097 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3098 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3099 (turn-on-gnus-mailing-list-mode)
3100 (mm-enable-multibyte)
3101 (set (make-local-variable 'bookmark-make-record-function)
3102 'gnus-summary-bookmark-make-record)
3103 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3104 (gnus-update-summary-mark-positions))
3106 (defun gnus-summary-make-local-variables ()
3107 "Make all the local summary buffer variables."
3109 (dolist (local gnus-summary-local-variables)
3112 (if (eq (cdr local) 'global)
3113 ;; Copy the global value of the variable.
3114 (setq global (symbol-value (car local)))
3115 ;; Use the value from the list.
3116 (setq global (eval (cdr local))))
3117 (set (make-local-variable (car local)) global))
3118 ;; Simple nil-valued local variable.
3119 (set (make-local-variable local) nil)))))
3121 ;; Summary data functions.
3123 (defmacro gnus-data-number (data)
3126 (defmacro gnus-data-set-number (data number)
3127 `(setcar ,data ,number))
3129 (defmacro gnus-data-mark (data)
3132 (defmacro gnus-data-set-mark (data mark)
3133 `(setcar (nthcdr 1 ,data) ,mark))
3135 (defmacro gnus-data-pos (data)
3138 (defmacro gnus-data-set-pos (data pos)
3139 `(setcar (nthcdr 2 ,data) ,pos))
3141 (defmacro gnus-data-header (data)
3144 (defmacro gnus-data-set-header (data header)
3145 `(setf (nth 3 ,data) ,header))
3147 (defmacro gnus-data-level (data)
3150 (defmacro gnus-data-unread-p (data)
3151 `(= (nth 1 ,data) gnus-unread-mark))
3153 (defmacro gnus-data-read-p (data)
3154 `(/= (nth 1 ,data) gnus-unread-mark))
3156 (defmacro gnus-data-pseudo-p (data)
3157 `(consp (nth 3 ,data)))
3159 (defmacro gnus-data-find (number)
3160 `(assq ,number gnus-newsgroup-data))
3162 (defmacro gnus-data-find-list (number &optional data)
3163 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3164 (memq (assq ,number bdata)
3167 (defmacro gnus-data-make (number mark pos header level)
3168 `(list ,number ,mark ,pos ,header ,level))
3170 (defun gnus-data-enter (after-article number mark pos header level offset)
3171 (let ((data (gnus-data-find-list after-article)))
3173 (error "No such article: %d" after-article))
3174 (setcdr data (cons (gnus-data-make number mark pos header level)
3176 (setq gnus-newsgroup-data-reverse nil)
3177 (gnus-data-update-list (cddr data) offset)))
3179 (defun gnus-data-enter-list (after-article list &optional offset)
3181 (let ((data (and after-article (gnus-data-find-list after-article)))
3185 (let ((odata gnus-newsgroup-data))
3186 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3188 (gnus-data-update-list odata offset)))
3189 ;; Find the last element in the list to be spliced into the main
3191 (setq list (last list))
3194 (setcdr list gnus-newsgroup-data)
3195 (setq gnus-newsgroup-data ilist)
3197 (gnus-data-update-list (cdr list) offset)))
3198 (setcdr list (cdr data))
3201 (gnus-data-update-list (cdr list) offset))))
3202 (setq gnus-newsgroup-data-reverse nil))))
3204 (defun gnus-data-remove (article &optional offset)
3205 (let ((data gnus-newsgroup-data))
3206 (if (= (gnus-data-number (car data)) article)
3208 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3209 gnus-newsgroup-data-reverse nil)
3211 (gnus-data-update-list gnus-newsgroup-data offset)))
3213 (when (= (gnus-data-number (cadr data)) article)
3214 (setcdr data (cddr data))
3216 (gnus-data-update-list (cdr data) offset))
3218 gnus-newsgroup-data-reverse nil))
3219 (setq data (cdr data))))))
3221 (defmacro gnus-data-list (backward)
3223 (or gnus-newsgroup-data-reverse
3224 (setq gnus-newsgroup-data-reverse
3225 (reverse gnus-newsgroup-data)))
3226 gnus-newsgroup-data))
3228 (defun gnus-data-update-list (data offset)
3229 "Add OFFSET to the POS of all data entries in DATA."
3230 (setq gnus-newsgroup-data-reverse nil)
3232 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3233 (setq data (cdr data))))
3235 (defun gnus-summary-article-pseudo-p (article)
3236 "Say whether this article is a pseudo article or not."
3237 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3239 (defmacro gnus-summary-article-sparse-p (article)
3240 "Say whether this article is a sparse article or not."
3241 `(memq ,article gnus-newsgroup-sparse))
3243 (defmacro gnus-summary-article-ancient-p (article)
3244 "Say whether this article is a sparse article or not."
3245 `(memq ,article gnus-newsgroup-ancient))
3247 (defun gnus-article-parent-p (number)
3248 "Say whether this article is a parent or not."
3249 (let ((data (gnus-data-find-list number)))
3250 (and (cdr data) ; There has to be an article after...
3251 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3252 (gnus-data-level (nth 1 data))))))
3254 (defun gnus-article-children (number)
3255 "Return a list of all children to NUMBER."
3256 (let* ((data (gnus-data-find-list number))
3257 (level (gnus-data-level (car data)))
3259 (setq data (cdr data))
3261 (= (gnus-data-level (car data)) (1+ level)))
3262 (push (gnus-data-number (car data)) children)
3263 (setq data (cdr data)))
3266 (defmacro gnus-summary-skip-intangible ()
3267 "If the current article is intangible, then jump to a different article."
3268 '(let ((to (get-text-property (point) 'gnus-intangible)))
3269 (and to (gnus-summary-goto-subject to))))
3271 (defmacro gnus-summary-article-intangible-p ()
3272 "Say whether this article is intangible or not."
3273 '(get-text-property (point) 'gnus-intangible))
3275 (defun gnus-article-read-p (article)
3276 "Say whether ARTICLE is read or not."
3277 (not (or (memq article gnus-newsgroup-marked)
3278 (memq article gnus-newsgroup-spam-marked)
3279 (memq article gnus-newsgroup-unreads)
3280 (memq article gnus-newsgroup-unselected)
3281 (memq article gnus-newsgroup-dormant))))
3283 ;; Some summary mode macros.
3285 (defmacro gnus-summary-article-number ()
3286 "The article number of the article on the current line.
3287 If there isn't an article number here, then we return the current
3290 (gnus-summary-skip-intangible)
3291 (or (get-text-property (point) 'gnus-number)
3292 (gnus-summary-last-subject))))
3294 (defmacro gnus-summary-article-header (&optional number)
3295 "Return the header of article NUMBER."
3296 `(gnus-data-header (gnus-data-find
3297 ,(or number '(gnus-summary-article-number)))))
3299 (defmacro gnus-summary-thread-level (&optional number)
3300 "Return the level of thread that starts with article NUMBER."
3301 `(if (and (eq gnus-summary-make-false-root 'dummy)
3302 (get-text-property (point) 'gnus-intangible))
3304 (gnus-data-level (gnus-data-find
3305 ,(or number '(gnus-summary-article-number))))))
3307 (defmacro gnus-summary-article-mark (&optional number)
3308 "Return the mark of article NUMBER."
3309 `(gnus-data-mark (gnus-data-find
3310 ,(or number '(gnus-summary-article-number)))))
3312 (defmacro gnus-summary-article-pos (&optional number)
3313 "Return the position of the line of article NUMBER."
3314 `(gnus-data-pos (gnus-data-find
3315 ,(or number '(gnus-summary-article-number)))))
3317 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3318 (defmacro gnus-summary-article-subject (&optional number)
3319 "Return current subject string or nil if nothing."
3322 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3323 '(gnus-data-header (assq (gnus-summary-article-number)
3324 gnus-newsgroup-data)))))
3327 (mail-header-subject headers))))
3329 (defmacro gnus-summary-article-score (&optional number)
3330 "Return current article score."
3331 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3332 gnus-newsgroup-scored))
3333 gnus-summary-default-score 0))
3335 (defun gnus-summary-article-children (&optional number)
3336 "Return a list of article numbers that are children of article NUMBER."
3337 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3338 (level (gnus-data-level (car data)))
3340 (while (and (setq data (cdr data))
3341 (> (setq l (gnus-data-level (car data))) level))
3342 (and (= (1+ level) l)
3343 (push (gnus-data-number (car data))
3345 (nreverse children)))
3347 (defun gnus-summary-article-parent (&optional number)
3348 "Return the article number of the parent of article NUMBER."
3349 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3350 (gnus-data-list t)))
3351 (level (gnus-data-level (car data))))
3353 () ; This is a root.
3354 ;; We search until we find an article with a level less than
3355 ;; this one. That function has to be the parent.
3356 (while (and (setq data (cdr data))
3357 (not (< (gnus-data-level (car data)) level))))
3358 (and data (gnus-data-number (car data))))))
3360 (defun gnus-unread-mark-p (mark)
3361 "Say whether MARK is the unread mark."
3362 (= mark gnus-unread-mark))
3364 (defun gnus-read-mark-p (mark)
3365 "Say whether MARK is one of the marks that mark as read.
3366 This is all marks except unread, ticked, dormant, and expirable."
3367 (not (or (= mark gnus-unread-mark)
3368 (= mark gnus-ticked-mark)
3369 (= mark gnus-spam-mark)
3370 (= mark gnus-dormant-mark)
3371 (= mark gnus-expirable-mark))))
3373 (defmacro gnus-article-mark (number)
3374 "Return the MARK of article NUMBER.
3375 This macro should only be used when computing the mark the \"first\"
3376 time; i.e., when generating the summary lines. After that,
3377 `gnus-summary-article-mark' should be used to examine the
3380 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3381 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3382 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3383 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3384 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3385 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3386 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3387 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3388 gnus-ancient-mark))))
3390 ;; Saving hidden threads.
3392 (defmacro gnus-save-hidden-threads (&rest forms)
3393 "Save hidden threads, eval FORMS, and restore the hidden threads."
3394 (let ((config (make-symbol "config")))
3395 `(let ((,config (gnus-hidden-threads-configuration)))
3399 (gnus-restore-hidden-threads-configuration ,config)))))
3400 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3401 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3403 (defun gnus-data-compute-positions ()
3404 "Compute the positions of all articles."
3405 (setq gnus-newsgroup-data-reverse nil)
3406 (let ((data gnus-newsgroup-data))
3408 (gnus-save-hidden-threads
3409 (gnus-summary-show-all-threads)
3410 (goto-char (point-min))
3412 (while (get-text-property (point) 'gnus-intangible)
3414 (gnus-data-set-pos (car data) (+ (point) 3))
3415 (setq data (cdr data))
3416 (forward-line 1))))))
3418 (defun gnus-hidden-threads-configuration ()
3419 "Return the current hidden threads configuration."
3422 (goto-char (point-min))
3424 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3425 (push (save-excursion (forward-line 0) (point)) config))
3429 (defun gnus-restore-hidden-threads-configuration (config)
3430 "Restore hidden threads configuration from CONFIG."
3432 (let (point (inhibit-read-only t))
3433 (while (setq point (pop config))
3435 (gnus-summary-hide-thread)))))
3437 ;; Various summary mode internalish functions.
3439 (defun gnus-mouse-pick-article (e)
3442 (gnus-summary-next-page nil t))
3444 (defun gnus-summary-set-display-table ()
3445 "Change the display table.
3446 Odd characters have a tendency to mess
3447 up nicely formatted displays - we make all possible glyphs
3448 display only a single character."
3450 ;; We start from the standard display table, if any.
3451 (let ((table (or (copy-sequence standard-display-table)
3452 (make-display-table)))
3454 ;; Nix out all the control chars...
3455 (while (>= (setq i (1- i)) 0)
3456 (gnus-put-display-table i [??] table))
3457 ;; ... but not newline and cr, of course. (cr is necessary for the
3458 ;; selective display).
3459 (gnus-put-display-table ?\n nil table)
3460 (gnus-put-display-table ?\r nil table)
3461 ;; We keep TAB as well.
3462 (gnus-put-display-table ?\t nil table)
3463 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3464 ;; Emacs 23 (unicode), that are not set already.
3465 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3468 (while (>= (setq i (1- i)) 127)
3469 ;; Only modify if the entry is nil.
3470 (unless (gnus-get-display-table i table)
3471 (gnus-put-display-table i [??] table))))
3472 (setq buffer-display-table table)))
3474 (defun gnus-summary-set-article-display-arrow (pos)
3475 "Update the overlay arrow to point to line at position POS."
3476 (when gnus-summary-display-arrow
3477 (make-local-variable 'overlay-arrow-position)
3478 (make-local-variable 'overlay-arrow-string)
3482 (unless overlay-arrow-position
3483 (setq overlay-arrow-position (make-marker)))
3484 (setq overlay-arrow-string "=>"
3485 overlay-arrow-position (set-marker overlay-arrow-position
3487 (current-buffer))))))
3489 (defun gnus-summary-setup-buffer (group)
3490 "Initialize summary buffer."
3491 (let ((buffer (gnus-summary-buffer-name group))
3492 (dead-name (concat "*Dead Summary "
3493 (gnus-group-decoded-name group) "*")))
3494 ;; If a dead summary buffer exists, we kill it.
3495 (when (gnus-buffer-live-p dead-name)
3496 (gnus-kill-buffer dead-name))
3497 (if (get-buffer buffer)
3500 (setq gnus-summary-buffer (current-buffer))
3501 (not gnus-newsgroup-prepared))
3502 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3503 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3504 (gnus-summary-mode group)
3505 (when (gnus-group-quit-config group)
3506 (set (make-local-variable 'gnus-single-article-buffer) nil))
3507 (make-local-variable 'gnus-article-buffer)
3508 (make-local-variable 'gnus-article-current)
3509 (make-local-variable 'gnus-original-article-buffer)
3510 (setq gnus-newsgroup-name group)
3511 ;; Set any local variables in the group parameters.
3512 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3515 (defun gnus-set-global-variables ()
3516 "Set the global equivalents of the buffer-local variables.
3517 They are set to the latest values they had. These reflect the summary
3518 buffer that was in action when the last article was fetched."
3519 (when (eq major-mode 'gnus-summary-mode)
3520 (setq gnus-summary-buffer (current-buffer))
3521 (let ((name gnus-newsgroup-name)
3522 (marked gnus-newsgroup-marked)
3523 (spam gnus-newsgroup-spam-marked)
3524 (unread gnus-newsgroup-unreads)
3525 (headers gnus-current-headers)
3526 (data gnus-newsgroup-data)
3527 (summary gnus-summary-buffer)
3528 (article-buffer gnus-article-buffer)
3529 (original gnus-original-article-buffer)
3530 (gac gnus-article-current)
3531 (reffed gnus-reffed-article-number)
3532 (score-file gnus-current-score-file)
3533 (default-charset gnus-newsgroup-charset)
3535 (let ((locals gnus-newsgroup-variables))
3537 (if (consp (car locals))
3538 (push (eval (caar locals)) vlist)
3539 (push (eval (car locals)) vlist))
3540 (setq locals (cdr locals)))
3541 (setq vlist (nreverse vlist)))
3542 (with-current-buffer gnus-group-buffer
3543 (setq gnus-newsgroup-name name
3544 gnus-newsgroup-marked marked
3545 gnus-newsgroup-spam-marked spam
3546 gnus-newsgroup-unreads unread
3547 gnus-current-headers headers
3548 gnus-newsgroup-data data
3549 gnus-article-current gac
3550 gnus-summary-buffer summary
3551 gnus-article-buffer article-buffer
3552 gnus-original-article-buffer original
3553 gnus-reffed-article-number reffed
3554 gnus-current-score-file score-file
3555 gnus-newsgroup-charset default-charset)
3556 (let ((locals gnus-newsgroup-variables))
3558 (if (consp (car locals))
3559 (set (caar locals) (pop vlist))
3560 (set (car locals) (pop vlist)))
3561 (setq locals (cdr locals))))
3562 ;; The article buffer also has local variables.
3563 (when (gnus-buffer-live-p gnus-article-buffer)
3564 (set-buffer gnus-article-buffer)
3565 (setq gnus-summary-buffer summary))))))
3567 (defun gnus-summary-article-unread-p (article)
3568 "Say whether ARTICLE is unread or not."
3569 (memq article gnus-newsgroup-unreads))
3571 (defun gnus-summary-first-article-p (&optional article)
3572 "Return whether ARTICLE is the first article in the buffer."
3573 (if (not (setq article (or article (gnus-summary-article-number))))
3575 (eq article (caar gnus-newsgroup-data))))
3577 (defun gnus-summary-last-article-p (&optional article)
3578 "Return whether ARTICLE is the last article in the buffer."
3579 (if (not (setq article (or article (gnus-summary-article-number))))
3580 ;; All non-existent numbers are the last article. :-)
3582 (not (cdr (gnus-data-find-list article)))))
3584 (defun gnus-make-thread-indent-array (&optional n)
3586 (progn (setq n 200) nil)
3587 (null gnus-thread-indent-array)
3588 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3589 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3590 gnus-thread-indent-array-level gnus-thread-indent-level)
3592 (aset gnus-thread-indent-array n
3593 (make-string (* n gnus-thread-indent-level) ? ))
3596 (defun gnus-update-summary-mark-positions ()
3597 "Compute where the summary marks are to go."
3599 (when (gnus-buffer-exists-p gnus-summary-buffer)
3600 (set-buffer gnus-summary-buffer))
3601 (let ((spec gnus-summary-line-format-spec)
3604 (gnus-set-work-buffer)
3605 (let ((gnus-tmp-unread ?Z)
3606 (gnus-replied-mark ?Z)
3607 (gnus-score-below-mark ?Z)
3608 (gnus-score-over-mark ?Z)
3609 (gnus-undownloaded-mark ?Z)
3610 (gnus-summary-line-format-spec spec)
3611 (gnus-newsgroup-downloadable '(0))
3612 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3613 case-fold-search ignores)
3614 ;; Here, all marks are bound to Z.
3615 (gnus-summary-insert-line header
3616 0 nil t gnus-tmp-unread t nil "" nil 1)
3617 (goto-char (point-min))
3618 ;; Memorize the positions of the same characters as dummy marks.
3619 (while (re-search-forward "[A-D]" nil t)
3620 (push (point) ignores))
3622 ;; We use A-D as dummy marks in order to know column positions
3623 ;; where marks should be inserted.
3624 (setq gnus-tmp-unread ?A
3625 gnus-replied-mark ?B
3626 gnus-score-below-mark ?C
3627 gnus-score-over-mark ?C
3628 gnus-undownloaded-mark ?D)
3629 (gnus-summary-insert-line header
3630 0 nil t gnus-tmp-unread t nil "" nil 1)
3631 ;; Ignore characters which aren't dummy marks.
3633 (delete-region (goto-char (1- p)) p)
3635 (goto-char (point-min))
3636 (setq pos (list (cons 'unread
3637 (and (search-forward "A" nil t)
3638 (- (point) (point-min) 1)))))
3639 (goto-char (point-min))
3640 (push (cons 'replied (and (search-forward "B" nil t)
3641 (- (point) (point-min) 1)))
3643 (goto-char (point-min))
3644 (push (cons 'score (and (search-forward "C" nil t)
3645 (- (point) (point-min) 1)))
3647 (goto-char (point-min))
3648 (push (cons 'download (and (search-forward "D" nil t)
3649 (- (point) (point-min) 1)))
3651 (setq gnus-summary-mark-positions pos))))
3653 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3654 "Insert a dummy root in the summary buffer."
3656 (gnus-add-text-properties
3657 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3658 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3660 (defun gnus-summary-extract-address-component (from)
3661 (or (car (funcall gnus-extract-address-components from))
3664 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3665 (let ((mail-parse-charset gnus-newsgroup-charset)
3666 (ignored-from-addresses (gnus-ignored-from-addresses))
3667 ; Is it really necessary to do this next part for each summary line?
3668 ; Luckily, doesn't seem to slow things down much.
3669 (mail-parse-ignored-charsets
3670 (with-current-buffer gnus-summary-buffer
3671 gnus-newsgroup-ignored-charsets)))
3673 (and ignored-from-addresses
3674 (string-match ignored-from-addresses gnus-tmp-from)
3675 (let ((extra-headers (mail-header-extra header))
3679 ((setq to (cdr (assq 'To extra-headers)))
3680 (concat gnus-summary-to-prefix
3682 (gnus-summary-extract-address-component
3683 (funcall gnus-decode-encoded-address-function to)))))
3686 (cdr (assq 'Newsgroups extra-headers))
3688 (memq 'Newsgroups gnus-extra-headers)
3689 (eq (car (gnus-find-method-for-group
3690 gnus-newsgroup-name)) 'nntp)
3691 (gnus-group-real-name gnus-newsgroup-name))))
3692 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3693 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3695 (defun gnus-summary-insert-line (gnus-tmp-header
3696 gnus-tmp-level gnus-tmp-current
3697 undownloaded gnus-tmp-unread gnus-tmp-replied
3698 gnus-tmp-expirable gnus-tmp-subject-or-nil
3699 &optional gnus-tmp-dummy gnus-tmp-score
3701 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3702 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3704 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3705 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3706 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3707 (gnus-tmp-score-char
3708 (if (or (null gnus-summary-default-score)
3709 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3710 gnus-summary-zcore-fuzz))
3712 (if (< gnus-tmp-score gnus-summary-default-score)
3713 gnus-score-below-mark gnus-score-over-mark)))
3714 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3716 (cond (gnus-tmp-process gnus-process-mark)
3717 ((memq gnus-tmp-current gnus-newsgroup-cached)
3719 (gnus-tmp-replied gnus-replied-mark)
3720 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3721 gnus-forwarded-mark)
3722 ((memq gnus-tmp-current gnus-newsgroup-saved)
3724 ((memq gnus-tmp-number gnus-newsgroup-recent)
3726 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3729 (gnus-tmp-downloaded
3731 gnus-undownloaded-mark)
3732 (gnus-newsgroup-agentized
3733 gnus-downloaded-mark)
3736 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3739 ((string-match "<[^>]+> *$" gnus-tmp-from)
3740 (let ((beg (match-beginning 0)))
3741 (or (and (string-match "^\".+\"" gnus-tmp-from)
3742 (substring gnus-tmp-from 1 (1- (match-end 0))))
3743 (substring gnus-tmp-from 0 beg))))
3744 ((string-match "(.+)" gnus-tmp-from)
3745 (substring gnus-tmp-from
3746 (1+ (match-beginning 0)) (1- (match-end 0))))
3748 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3749 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3750 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3751 (inhibit-read-only t))
3752 (when (string= gnus-tmp-name "")
3753 (setq gnus-tmp-name gnus-tmp-from))
3754 (unless (numberp gnus-tmp-lines)
3755 (setq gnus-tmp-lines -1))
3756 (if (= gnus-tmp-lines -1)
3757 (setq gnus-tmp-lines "?")
3758 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3760 (gnus-put-text-property
3762 (progn (eval gnus-summary-line-format-spec) (point))
3763 'gnus-number gnus-tmp-number)
3764 (error (gnus-message 5 "Error updating the summary line")))
3765 (when (gnus-visual-p 'summary-highlight 'highlight)
3767 (gnus-summary-highlight-line)
3768 (gnus-run-hooks 'gnus-summary-update-hook)
3771 (defun gnus-summary-update-line (&optional dont-update)
3772 "Update summary line after change."
3773 (when (and gnus-summary-default-score
3774 (not gnus-summary-inhibit-highlight))
3775 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3776 (article (gnus-summary-article-number))
3777 (score (gnus-summary-article-score article)))
3779 (if (and gnus-summary-mark-below
3780 (< (gnus-summary-article-score)
3781 gnus-summary-mark-below))
3782 ;; This article has a low score, so we mark it as read.
3783 (when (memq article gnus-newsgroup-unreads)
3784 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3785 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3786 ;; This article was previously marked as read on account
3787 ;; of a low score, but now it has risen, so we mark it as
3789 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3790 (gnus-summary-update-mark
3791 (if (or (null gnus-summary-default-score)
3792 (<= (abs (- score gnus-summary-default-score))
3793 gnus-summary-zcore-fuzz))
3795 (if (< score gnus-summary-default-score)
3796 gnus-score-below-mark gnus-score-over-mark))
3798 ;; Do visual highlighting.
3799 (when (gnus-visual-p 'summary-highlight 'highlight)
3800 (gnus-summary-highlight-line)
3801 (gnus-run-hooks 'gnus-summary-update-hook)))))
3803 (defvar gnus-tmp-new-adopts nil)
3805 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3806 "Return the number of articles in THREAD.
3807 This may be 0 in some cases -- if none of the articles in
3808 the thread are to be displayed."
3810 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3812 ((not (listp thread))
3814 ((and (consp thread) (cdr thread))
3817 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3820 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3823 (when (and level (zerop level) gnus-tmp-new-adopts)
3826 'gnus-summary-number-of-articles-in-thread
3827 gnus-tmp-new-adopts))))
3829 (if (> number 1) gnus-not-empty-thread-mark
3830 gnus-empty-thread-mark)
3833 (defsubst gnus-summary-line-message-size (head)
3834 "Return pretty-printed version of message size.
3835 This function is intended to be used in
3836 `gnus-summary-line-format-alist'."
3837 (let ((c (or (mail-header-chars head) -1)))
3838 (cond ((< c 0) "n/a") ; chars not available
3839 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3840 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3841 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3842 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3845 (defun gnus-summary-set-local-parameters (group)
3846 "Go through the local params of GROUP and set all variable specs in that list."
3847 (let ((vars '(quit-config active))) ; Ignore things that aren't
3849 (dolist (elem (gnus-group-find-parameter group))
3850 (and (consp elem) ; Has to be a cons.
3851 (consp (cdr elem)) ; The cdr has to be a list.
3852 (symbolp (car elem)) ; Has to be a symbol in there.
3853 (not (memq (car elem) vars))
3855 (push (car elem) vars)
3856 ;; Variables like `gnus-show-threads' that are globally
3857 ;; bound, if used as group parameters, need to get to be
3858 ;; buffer-local, whereas just parameters like `gcc-self',
3859 ;; `timestamp', etc. should not be bound as variables.
3860 (if (boundp (car elem))
3861 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3862 (eval (nth 1 elem))))))))
3864 (defun gnus-summary-read-group (group &optional show-all no-article
3865 kill-buffer no-display backward
3867 "Start reading news in newsgroup GROUP.
3868 If SHOW-ALL is non-nil, already read articles are also listed.
3869 If NO-ARTICLE is non-nil, no article is selected initially.
3870 If NO-DISPLAY, don't generate a summary buffer."
3874 (let ((gnus-auto-select-next nil))
3875 (or (gnus-summary-read-group-1
3876 group show-all no-article
3877 kill-buffer no-display
3880 select-articles nil)))))
3881 (eq gnus-auto-select-next 'quietly))
3882 (set-buffer gnus-group-buffer)
3883 ;; The entry function called above goes to the next
3884 ;; group automatically, so we go two groups back
3885 ;; if we are searching for the previous group.
3887 (gnus-group-prev-unread-group 2))
3888 (if (not (equal group (gnus-group-group-name)))
3889 (setq group (gnus-group-group-name))
3893 (defun gnus-summary-read-group-1 (group show-all no-article
3894 kill-buffer no-display
3895 &optional select-articles)
3896 ;; Killed foreign groups can't be entered.
3897 ;; (when (and (not (gnus-group-native-p group))
3898 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3899 ;; (error "Dead non-native groups can't be entered"))
3900 (gnus-message 5 "Retrieving newsgroup: %s..."
3901 (gnus-group-decoded-name group))
3902 (let* ((new-group (gnus-summary-setup-buffer group))
3903 (quit-config (gnus-group-quit-config group))
3904 (did-select (and new-group (gnus-select-newsgroup
3905 group show-all select-articles))))
3907 ;; This summary buffer exists already, so we just select it.
3909 (gnus-set-global-variables)
3911 (gnus-kill-or-deaden-summary kill-buffer))
3912 (gnus-configure-windows 'summary 'force)
3913 (gnus-set-mode-line 'summary)
3914 (gnus-summary-position-point)
3917 ;; We couldn't select this group.
3919 (when (and (eq major-mode 'gnus-summary-mode)
3920 (not (equal (current-buffer) kill-buffer)))
3921 (kill-buffer (current-buffer))
3922 (if (not quit-config)
3924 ;; Update the info -- marks might need to be removed,
3926 (gnus-summary-update-info)
3927 (set-buffer gnus-group-buffer)
3928 (gnus-group-jump-to-group group)
3929 (gnus-group-next-unread-group 1))
3930 (gnus-handle-ephemeral-exit quit-config)))
3931 (let ((grpinfo (gnus-get-info group)))
3932 (if (null (gnus-info-read grpinfo))
3933 (gnus-message 3 "Group %s contains no messages"
3934 (gnus-group-decoded-name group))
3935 (gnus-message 3 "Can't select group")))
3937 ;; The user did a `C-g' while prompting for number of articles,
3938 ;; so we exit this group.
3939 ((eq did-select 'quit)
3940 (and (eq major-mode 'gnus-summary-mode)
3941 (not (equal (current-buffer) kill-buffer))
3942 (kill-buffer (current-buffer)))
3944 (gnus-kill-or-deaden-summary kill-buffer))
3945 (if (not quit-config)
3947 (set-buffer gnus-group-buffer)
3948 (gnus-group-jump-to-group group)
3949 (gnus-configure-windows 'group 'force))
3950 (gnus-handle-ephemeral-exit quit-config))
3951 ;; Finally signal the quit.
3953 ;; The group was successfully selected.
3955 (gnus-set-global-variables)
3956 ;; Save the active value in effect when the group was entered.
3957 (setq gnus-newsgroup-active
3959 (gnus-active gnus-newsgroup-name)))
3960 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
3961 ;; You can change the summary buffer in some way with this hook.
3962 (gnus-run-hooks 'gnus-select-group-hook)
3963 (when (memq 'summary (gnus-update-format-specifications
3964 nil 'summary 'summary-mode 'summary-dummy))
3965 ;; The format specification for the summary line was updated,
3966 ;; so we need to update the mark positions as well.
3967 (gnus-update-summary-mark-positions))
3968 ;; Do score processing.
3969 (when gnus-use-scoring
3970 (gnus-possibly-score-headers))
3971 ;; Check whether to fill in the gaps in the threads.
3972 (when gnus-build-sparse-threads
3973 (gnus-build-sparse-threads))
3974 ;; Find the initial limit.
3976 (let ((gnus-newsgroup-dormant nil))
3977 (gnus-summary-initial-limit show-all))
3978 (gnus-summary-initial-limit show-all))
3979 ;; Generate the summary buffer.
3981 (gnus-summary-prepare))
3982 (when gnus-use-trees
3983 (gnus-tree-open group)
3984 (setq gnus-summary-highlight-line-function
3985 'gnus-tree-highlight-article))
3986 ;; If the summary buffer is empty, but there are some low-scored
3987 ;; articles or some excluded dormants, we include these in the
3989 (when (and (zerop (buffer-size))
3991 (cond (gnus-newsgroup-dormant
3992 (gnus-summary-limit-include-dormant))
3993 ((and gnus-newsgroup-scored show-all)
3994 (gnus-summary-limit-include-expunged t))))
3995 ;; Function `gnus-apply-kill-file' must be called in this hook.
3996 (gnus-run-hooks 'gnus-apply-kill-hook)
3997 (if (and (zerop (buffer-size))
4000 ;; This newsgroup is empty.
4001 (gnus-summary-catchup-and-exit nil t)
4002 (gnus-message 6 "No unread news")
4004 (gnus-kill-or-deaden-summary kill-buffer))
4005 ;; Return nil from this function.
4007 ;; Hide conversation thread subtrees. We cannot do this in
4008 ;; gnus-summary-prepare-hook since kill processing may not
4009 ;; work with hidden articles.
4010 (gnus-summary-maybe-hide-threads)
4012 (gnus-kill-or-deaden-summary kill-buffer))
4013 (gnus-summary-auto-select-subject)
4014 ;; Show first unread article if requested.
4015 (if (and (not no-article)
4017 gnus-newsgroup-unreads
4018 gnus-auto-select-first)
4020 (gnus-configure-windows 'summary)
4021 (let ((art (gnus-summary-article-number)))
4022 (unless (and (not gnus-plugged)
4023 (or (memq art gnus-newsgroup-undownloaded)
4024 (memq art gnus-newsgroup-downloadable)))
4025 (gnus-summary-goto-article art))))
4026 ;; Don't select any articles.
4027 (gnus-summary-position-point)
4028 (gnus-configure-windows 'summary 'force)
4029 (gnus-set-mode-line 'summary))
4030 (when (and gnus-auto-center-group
4031 (get-buffer-window gnus-group-buffer t))
4032 ;; Gotta use windows, because recenter does weird stuff if
4033 ;; the current buffer ain't the displayed window.
4034 (let ((owin (selected-window)))
4035 (select-window (get-buffer-window gnus-group-buffer t))
4036 (when (gnus-group-goto-group group)
4038 (select-window owin)))
4039 ;; Mark this buffer as "prepared".
4040 (setq gnus-newsgroup-prepared t)
4041 (gnus-run-hooks 'gnus-summary-prepared-hook)
4042 (unless (gnus-ephemeral-group-p group)
4043 (gnus-group-update-group group))
4046 (defun gnus-summary-auto-select-subject ()
4047 "Select the subject line on initial group entry."
4048 (goto-char (point-min))
4050 ((eq gnus-auto-select-subject 'best)
4051 (gnus-summary-best-unread-subject))
4052 ((eq gnus-auto-select-subject 'unread)
4053 (gnus-summary-first-unread-subject))
4054 ((eq gnus-auto-select-subject 'unseen)
4055 (gnus-summary-first-unseen-subject))
4056 ((eq gnus-auto-select-subject 'unseen-or-unread)
4057 (gnus-summary-first-unseen-or-unread-subject))
4058 ((eq gnus-auto-select-subject 'first)
4061 ((functionp gnus-auto-select-subject)
4062 (funcall gnus-auto-select-subject))))
4064 (defun gnus-summary-prepare ()
4065 "Generate the summary buffer."
4067 (let ((inhibit-read-only t))
4069 (setq gnus-newsgroup-data nil
4070 gnus-newsgroup-data-reverse nil)
4071 (gnus-run-hooks 'gnus-summary-generate-hook)
4072 ;; Generate the buffer, either with threads or without.
4073 (when gnus-newsgroup-headers
4074 (gnus-summary-prepare-threads
4075 (if gnus-show-threads
4076 (gnus-sort-gathered-threads
4077 (funcall gnus-summary-thread-gathering-function
4079 (gnus-cut-threads (gnus-make-threads)))))
4080 ;; Unthreaded display.
4081 (gnus-sort-articles gnus-newsgroup-headers))))
4082 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4083 ;; Call hooks for modifying summary buffer.
4084 (goto-char (point-min))
4085 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4087 (defsubst gnus-general-simplify-subject (subject)
4088 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4091 ;; Truncate the subject.
4092 (gnus-simplify-subject-functions
4093 (gnus-map-function gnus-simplify-subject-functions subject))
4094 ((numberp gnus-summary-gather-subject-limit)
4095 (setq subject (gnus-simplify-subject-re subject))
4096 (if (> (length subject) gnus-summary-gather-subject-limit)
4097 (substring subject 0 gnus-summary-gather-subject-limit)
4099 ;; Fuzzily simplify it.
4100 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4101 (gnus-simplify-subject-fuzzy subject))
4102 ;; Just remove the leading "Re:".
4104 (gnus-simplify-subject-re subject))))
4106 (if (and gnus-summary-gather-exclude-subject
4107 (string-match gnus-summary-gather-exclude-subject subject))
4108 nil ; This article shouldn't be gathered
4111 (defun gnus-summary-simplify-subject-query ()
4112 "Query where the respool algorithm would put this article."
4114 (gnus-summary-select-article)
4115 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4117 (defun gnus-gather-threads-by-subject (threads)
4118 "Gather threads by looking at Subject headers."
4119 (if (not gnus-summary-make-false-root)
4121 (let ((hashtb (gnus-make-hashtable 1024))
4124 subject hthread whole-subject)
4126 (setq subject (gnus-general-simplify-subject
4127 (setq whole-subject (mail-header-subject
4130 (if (setq hthread (gnus-gethash subject hashtb))
4132 ;; We enter a dummy root into the thread, if we
4133 ;; haven't done that already.
4134 (unless (stringp (caar hthread))
4135 (setcar hthread (list whole-subject (car hthread))))
4136 ;; We add this new gathered thread to this gathered
4138 (setcdr (car hthread)
4139 (nconc (cdar hthread) (list (car threads))))
4140 ;; Remove it from the list of threads.
4141 (setcdr prev (cdr threads))
4142 (setq threads prev))
4143 ;; Enter this thread into the hash table.
4144 (gnus-sethash subject
4145 (if gnus-summary-make-false-root-always
4147 ;; If you want a dummy root above all
4149 (setcar threads (list whole-subject
4155 (setq threads (cdr threads)))
4158 (defun gnus-gather-threads-by-references (threads)
4159 "Gather threads by looking at References headers."
4160 (let ((idhashtb (gnus-make-hashtable 1024))
4161 (thhashtb (gnus-make-hashtable 1024))
4164 ids references id gthread gid entered ref)
4166 (when (setq references (mail-header-references (caar threads)))
4167 (setq id (mail-header-id (caar threads))
4168 ids (inline (gnus-split-references references))
4170 (while (setq ref (pop ids))
4171 (setq ids (delete ref ids))
4172 (if (not (setq gid (gnus-gethash ref idhashtb)))
4174 (gnus-sethash ref id idhashtb)
4175 (gnus-sethash id threads thhashtb))
4176 (setq gthread (gnus-gethash gid thhashtb))
4178 ;; We enter a dummy root into the thread, if we
4179 ;; haven't done that already.
4180 (unless (stringp (caar gthread))
4181 (setcar gthread (list (mail-header-subject (caar gthread))
4183 ;; We add this new gathered thread to this gathered
4185 (setcdr (car gthread)
4186 (nconc (cdar gthread) (list (car threads)))))
4187 ;; Add it into the thread hash table.
4188 (gnus-sethash id gthread thhashtb)
4190 ;; Remove it from the list of threads.
4191 (setcdr prev (cdr threads))
4192 (setq threads prev))))
4194 (setq threads (cdr threads)))
4197 (defun gnus-sort-gathered-threads (threads)
4198 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4199 (let ((result threads))
4201 (when (stringp (caar threads))
4202 (setcdr (car threads)
4203 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4204 (setq threads (cdr threads)))
4207 (defun gnus-thread-loop-p (root thread)
4208 "Say whether ROOT is in THREAD."
4209 (let ((stack (list thread))
4212 (while (setq thread (pop stack))
4213 (setq th (cdr thread))
4215 (not (eq (caar th) root)))
4218 ;; We have found a loop.
4220 (setcdr thread (delq (car th) (cdr thread)))
4221 (if (boundp (setq ref-dep (intern "none"
4222 gnus-newsgroup-dependencies)))
4223 (setcdr (symbol-value ref-dep)
4224 (nconc (cdr (symbol-value ref-dep))
4226 (set ref-dep (list nil (car th))))
4229 ;; Push all the subthreads onto the stack.
4230 (push (cdr thread) stack)))
4233 (defun gnus-make-threads ()
4234 "Go through the dependency hashtb and find the roots. Return all threads."
4236 (while (catch 'infloop
4239 ;; Deal with self-referencing References loops.
4240 (when (and (car (symbol-value refs))
4247 (car (symbol-value refs)) thread))
4248 (cdr (symbol-value refs)))))))
4251 (unless (car (symbol-value refs))
4252 ;; These threads do not refer back to any other
4253 ;; articles, so they're roots.
4254 (setq threads (append (cdr (symbol-value refs)) threads))))
4255 gnus-newsgroup-dependencies)))
4258 ;; Build the thread tree.
4259 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4260 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4262 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4263 if it was already present.
4265 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4266 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4267 Message-IDs will be renamed to a unique Message-ID before being
4270 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4271 (let* ((id (mail-header-id header))
4272 (id-dep (and id (intern id dependencies)))
4273 parent-id ref ref-dep ref-header replaced)
4274 ;; Enter this `header' in the `dependencies' table.
4278 ;; The first two cases do the normal part: enter a new `header'
4279 ;; in the `dependencies' table.
4280 ((not (boundp id-dep))
4281 (set id-dep (list header)))
4282 ((null (car (symbol-value id-dep)))
4283 (setcar (symbol-value id-dep) header))
4285 ;; From here the `header' was already present in the
4286 ;; `dependencies' table.
4288 ;; Overrides an existing entry;
4289 ;; just set the header part of the entry.
4290 (setcar (symbol-value id-dep) header)
4293 ;; Renames the existing `header' to a unique Message-ID.
4294 ((not gnus-summary-ignore-duplicates)
4295 ;; An article with this Message-ID has already been seen.
4296 ;; We rename the Message-ID.
4297 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4299 (mail-header-set-id header id))
4301 ;; The last case ignores an existing entry, except it adds any
4302 ;; additional Xrefs (in case the two articles came from different
4304 ;; Also sets `header' to `nil' meaning that the `dependencies'
4305 ;; table was *not* modified.
4307 (mail-header-set-xref
4308 (car (symbol-value id-dep))
4309 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4311 (or (mail-header-xref header) "")))
4314 (when (and header (not replaced))
4315 ;; First check that we are not creating a References loop.
4316 (setq parent-id (gnus-parent-id (mail-header-references header)))
4317 (setq ref parent-id)
4319 (setq ref-dep (intern-soft ref dependencies))
4321 (setq ref-header (car (symbol-value ref-dep))))
4322 (if (string= id ref)
4323 ;; Yuk! This is a reference loop. Make the article be a
4326 (mail-header-set-references (car (symbol-value id-dep)) "none")
4328 (setq parent-id nil))
4329 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4330 (setq ref-dep (intern (or parent-id "none") dependencies))
4331 (if (boundp ref-dep)
4332 (setcdr (symbol-value ref-dep)
4333 (nconc (cdr (symbol-value ref-dep))
4334 (list (symbol-value id-dep))))
4335 (set ref-dep (list nil (symbol-value id-dep)))))
4338 (defun gnus-extract-message-id-from-in-reply-to (string)
4339 (if (string-match "<[^>]+>" string)
4340 (substring string (match-beginning 0) (match-end 0))
4343 (defun gnus-build-sparse-threads ()
4344 (let ((headers gnus-newsgroup-headers)
4345 (mail-parse-charset gnus-newsgroup-charset)
4346 (gnus-summary-ignore-duplicates t)
4347 header references generation relations
4348 subject child end new-child date)
4349 ;; First we create an alist of generations/relations, where
4350 ;; generations is how much we trust the relation, and the relation
4352 (gnus-message 7 "Making sparse threads...")
4354 (nnheader-set-temp-buffer " *gnus sparse threads*")
4355 (while (setq header (pop headers))
4356 (when (and (setq references (mail-header-references header))
4357 (not (string= references "")))
4359 (setq child (mail-header-id header)
4360 subject (mail-header-subject header)
4361 date (mail-header-date header)
4363 (while (search-backward ">" nil t)
4364 (setq end (1+ (point)))
4365 (when (search-backward "<" nil t)
4366 (setq new-child (buffer-substring (point) end))
4367 (push (list (incf generation)
4368 child (setq child new-child)
4372 (push (list (1+ generation) child nil subject) relations))
4374 (kill-buffer (current-buffer)))
4375 ;; Sort over trustworthiness.
4376 (dolist (relation (sort relations 'car-less-than-car))
4377 (when (gnus-dependencies-add-header
4378 (make-full-mail-header
4379 gnus-reffed-article-number
4380 (nth 3 relation) "" (or (nth 4 relation) "")
4382 (or (nth 2 relation) "") 0 0 "")
4383 gnus-newsgroup-dependencies nil)
4384 (push gnus-reffed-article-number gnus-newsgroup-limit)
4385 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4386 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4387 gnus-newsgroup-reads)
4388 (decf gnus-reffed-article-number)))
4389 (gnus-message 7 "Making sparse threads...done")))
4391 (defun gnus-build-old-threads ()
4392 ;; Look at all the articles that refer back to old articles, and
4393 ;; fetch the headers for the articles that aren't there. This will
4394 ;; build complete threads - if the roots haven't been expired by the
4396 (let ((mail-parse-charset gnus-newsgroup-charset)
4400 (when (not (car (symbol-value refs)))
4401 (setq heads (cdr (symbol-value refs)))
4403 (if (memq (mail-header-number (caar heads))
4404 gnus-newsgroup-dormant)
4405 (setq heads (cdr heads))
4406 (setq id (symbol-name refs))
4407 (while (and (setq id (gnus-build-get-header id))
4408 (not (car (gnus-id-to-thread id)))))
4409 (setq heads nil)))))
4410 gnus-newsgroup-dependencies)))
4412 (defsubst gnus-remove-odd-characters (string)
4413 "Translate STRING into something that doesn't contain weird characters."
4414 (mm-subst-char-in-string
4416 (mm-subst-char-in-string ?\n ?\- string t) t))
4418 ;; This function has to be called with point after the article number
4419 ;; on the beginning of the line.
4420 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4421 (let ((eol (point-at-eol))
4422 (buffer (current-buffer))
4423 header references in-reply-to)
4425 ;; overview: [num subject from date id refs chars lines misc]
4428 (narrow-to-region (point) eol)
4433 (make-full-mail-header
4435 (condition-case () ; subject
4436 (gnus-remove-odd-characters
4437 (funcall gnus-decode-encoded-word-function
4438 (setq x (nnheader-nov-field))))
4440 (condition-case () ; from
4441 (gnus-remove-odd-characters
4442 (funcall gnus-decode-encoded-address-function
4443 (setq x (nnheader-nov-field))))
4445 (nnheader-nov-field) ; date
4446 (nnheader-nov-read-message-id number) ; id
4447 (setq references (nnheader-nov-field)) ; refs
4448 (nnheader-nov-read-integer) ; chars
4449 (nnheader-nov-read-integer) ; lines
4451 (if (looking-at "Xref: ")
4452 (goto-char (match-end 0)))
4453 (nnheader-nov-field)) ; Xref
4454 (nnheader-nov-parse-extra)))) ; extra
4458 (when (and (string= references "")
4459 (setq in-reply-to (mail-header-extra header))
4460 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4461 (mail-header-set-references
4462 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4464 (when gnus-alter-header-function
4465 (funcall gnus-alter-header-function header))
4466 (gnus-dependencies-add-header header dependencies force-new)))
4468 (defun gnus-build-get-header (id)
4469 "Look through the buffer of NOV lines and find the header to ID.
4470 Enter this line into the dependencies hash table, and return
4471 the id of the parent article (if any)."
4472 (let ((deps gnus-newsgroup-dependencies)
4475 (with-current-buffer nntp-server-buffer
4476 (let ((case-fold-search nil))
4477 (goto-char (point-min))
4478 (while (and (not found)
4479 (search-forward id nil t))
4481 (setq found (looking-at
4482 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4483 (regexp-quote id))))
4484 (or found (beginning-of-line 2)))
4488 (setq header (gnus-nov-parse-line
4489 (read (current-buffer)) deps))
4490 (gnus-parent-id (mail-header-references header))))))
4492 (let ((number (mail-header-number header)))
4493 (push number gnus-newsgroup-limit)
4494 (push header gnus-newsgroup-headers)
4495 (if (memq number gnus-newsgroup-unselected)
4497 (setq gnus-newsgroup-unreads
4498 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4500 (setq gnus-newsgroup-unselected
4501 (delq number gnus-newsgroup-unselected)))
4502 (push number gnus-newsgroup-ancient)))))))
4504 (defun gnus-build-all-threads ()
4505 "Read all the headers."
4506 (let ((gnus-summary-ignore-duplicates t)
4507 (mail-parse-charset gnus-newsgroup-charset)
4508 (dependencies gnus-newsgroup-dependencies)
4510 (with-current-buffer nntp-server-buffer
4511 (let ((case-fold-search nil))
4512 (goto-char (point-min))
4515 (setq article (read (current-buffer))
4516 header (gnus-nov-parse-line article dependencies t)))
4518 (with-current-buffer gnus-summary-buffer
4519 (push header gnus-newsgroup-headers)
4520 (if (memq (setq article (mail-header-number header))
4521 gnus-newsgroup-unselected)
4523 (setq gnus-newsgroup-unreads
4524 (gnus-add-to-sorted-list
4525 gnus-newsgroup-unreads article))
4526 (setq gnus-newsgroup-unselected
4527 (delq article gnus-newsgroup-unselected)))
4528 (push article gnus-newsgroup-ancient)))
4529 (forward-line 1)))))))
4531 (defun gnus-summary-update-article-line (article header)
4532 "Update the line for ARTICLE using HEADER."
4533 (let* ((id (mail-header-id header))
4534 (thread (gnus-id-to-thread id)))
4536 (error "Article in no thread"))
4537 ;; Update the thread.
4538 (setcar thread header)
4539 (gnus-summary-goto-subject article)
4540 (let* ((datal (gnus-data-find-list article))
4542 (inhibit-read-only t)
4543 (level (gnus-summary-thread-level)))
4545 (let ((inserted (- (point)
4547 (gnus-summary-insert-line
4549 (memq article gnus-newsgroup-undownloaded)
4550 (gnus-article-mark article)
4551 (memq article gnus-newsgroup-replied)
4552 (memq article gnus-newsgroup-expirable)
4553 ;; Only insert the Subject string when it's different
4554 ;; from the previous Subject string.
4559 (mail-header-subject
4562 (gnus-data-find-list
4564 (gnus-data-list t)))))
4565 ;; Error on the side of excessive subjects.
4567 (mail-header-subject header)))
4569 (mail-header-subject header))
4570 nil (cdr (assq article gnus-newsgroup-scored))
4571 (memq article gnus-newsgroup-processable))
4574 (gnus-data-update-list
4576 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4578 (defun gnus-summary-update-article (article &optional iheader)
4579 "Update ARTICLE in the summary buffer."
4580 (set-buffer gnus-summary-buffer)
4581 (let* ((header (gnus-summary-article-header article))
4582 (id (mail-header-id header))
4583 (data (gnus-data-find article))
4584 (thread (gnus-id-to-thread id))
4585 (references (mail-header-references header))
4589 (when (and references
4590 (not (equal "" references)))
4593 (inhibit-read-only t)
4599 (delq thread parent)))
4600 (if (gnus-summary-insert-subject id header)
4601 ;; Set the (possibly) new article number in the data structure.
4602 (gnus-data-set-number data (gnus-id-to-article id))
4606 (defun gnus-rebuild-thread (id &optional line)
4607 "Rebuild the thread containing ID.
4608 If LINE, insert the rebuilt thread starting on line LINE."
4609 (let ((inhibit-read-only t)
4610 old-pos current thread data)
4611 (if (not gnus-show-threads)
4612 (setq thread (list (car (gnus-id-to-thread id))))
4613 ;; Get the thread this article is part of.
4614 (setq thread (gnus-remove-thread id)))
4615 (setq old-pos (point-at-bol))
4616 (setq current (save-excursion
4617 (and (re-search-backward "[\r\n]" nil t)
4618 (gnus-summary-article-number))))
4619 ;; If this is a gathered thread, we have to go some re-gathering.
4620 (when (stringp (car thread))
4621 (let ((subject (car thread))
4623 (setq thread (cdr thread))
4625 (unless (memq (setq thr (gnus-id-to-thread
4627 (mail-header-id (caar thread)))))
4630 (setq thread (cdr thread)))
4631 ;; We now have all (unique) roots.
4632 (if (= (length roots) 1)
4633 ;; All the loose roots are now one solid root.
4634 (setq thread (car roots))
4635 (setq thread (cons subject (gnus-sort-threads roots))))))
4637 ;; We then insert this thread into the summary buffer.
4639 (goto-char (point-min))
4640 (forward-line (1- line)))
4641 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4642 (if gnus-show-threads
4643 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4644 (gnus-summary-prepare-unthreaded thread))
4645 (setq data (nreverse gnus-newsgroup-data))
4646 (setq threads gnus-newsgroup-threads))
4647 ;; We splice the new data into the data structure.
4648 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4649 ;;!!! then we want to insert at the beginning of the buffer.
4650 ;;!!! That happens to be true with Gnus now, but that may
4651 ;;!!! change in the future. Perhaps.
4652 (gnus-data-enter-list
4653 (if line nil current) data (- (point) old-pos))
4654 (setq gnus-newsgroup-threads
4655 (nconc threads gnus-newsgroup-threads))
4656 (gnus-data-compute-positions))))
4658 (defun gnus-number-to-header (number)
4659 "Return the header for article NUMBER."
4660 (let ((headers gnus-newsgroup-headers))
4662 (not (= number (mail-header-number (car headers)))))
4667 (defun gnus-parent-headers (in-headers &optional generation)
4668 "Return the headers of the GENERATIONeth parent of HEADERS."
4670 (setq generation 1))
4672 (headers in-headers)
4675 (not (zerop generation))
4676 (setq references (mail-header-references headers)))
4677 (setq headers (if (and references
4678 (setq parent (gnus-parent-id references)))
4679 (car (gnus-id-to-thread parent))
4682 (and (not (eq headers in-headers))
4685 (defun gnus-id-to-thread (id)
4686 "Return the (sub-)thread where ID appears."
4687 (gnus-gethash id gnus-newsgroup-dependencies))
4689 (defun gnus-id-to-article (id)
4690 "Return the article number of ID."
4691 (let ((thread (gnus-id-to-thread id)))
4694 (mail-header-number (car thread)))))
4696 (defun gnus-id-to-header (id)
4697 "Return the article headers of ID."
4698 (car (gnus-id-to-thread id)))
4700 (defun gnus-article-displayed-root-p (article)
4701 "Say whether ARTICLE is a root(ish) article."
4702 (let ((level (gnus-summary-thread-level article))
4703 (refs (mail-header-references (gnus-summary-article-header article)))
4709 ((null (gnus-parent-id refs)) t)
4711 (null (setq particle (gnus-id-to-article
4712 (gnus-parent-id refs))))
4713 (null (gnus-summary-thread-level particle)))))))
4715 (defun gnus-root-id (id)
4716 "Return the id of the root of the thread where ID appears."
4718 (while (and id (setq prev (car (gnus-id-to-thread id))))
4720 id (gnus-parent-id (mail-header-references prev))))
4723 (defun gnus-articles-in-thread (thread)
4724 "Return the list of articles in THREAD."
4725 (cons (mail-header-number (car thread))
4726 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4728 (defun gnus-remove-thread (id &optional dont-remove)
4729 "Remove the thread that has ID in it."
4730 (let (headers thread last-id)
4731 ;; First go up in this thread until we find the root.
4732 (setq last-id (gnus-root-id id)
4733 headers (message-flatten-list (gnus-id-to-thread last-id)))
4734 ;; We have now found the real root of this thread. It might have
4735 ;; been gathered into some loose thread, so we have to search
4736 ;; through the threads to find the thread we wanted.
4737 (let ((threads gnus-newsgroup-threads)
4740 (setq sub (car threads))
4741 (if (stringp (car sub))
4742 ;; This is a gathered thread, so we look at the roots
4743 ;; below it to find whether this article is in this
4746 (setq sub (cdr sub))
4748 (when (member (caar sub) headers)
4749 (setq thread (car threads)
4752 (setq sub (cdr sub))))
4753 ;; It's an ordinary thread, so we check it.
4754 (when (eq (car sub) (car headers))
4757 (setq threads (cdr threads)))
4758 ;; If this article is in no thread, then it's a root.
4761 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4762 (setq thread (gnus-id-to-thread last-id)))
4765 thread ; We return this thread.
4767 (if (stringp (car thread))
4769 ;; If we use dummy roots, then we have to remove the
4770 ;; dummy root as well.
4771 (when (eq gnus-summary-make-false-root 'dummy)
4772 ;; We go to the dummy root by going to
4773 ;; the first sub-"thread", and then one line up.
4774 (gnus-summary-goto-article
4775 (mail-header-number (caadr thread)))
4778 (gnus-data-compute-positions))
4779 (setq thread (cdr thread))
4781 (gnus-remove-thread-1 (car thread))
4782 (setq thread (cdr thread))))
4783 (gnus-remove-thread-1 thread))))))))
4785 (defun gnus-remove-thread-1 (thread)
4786 "Remove the thread THREAD recursively."
4787 (let ((number (mail-header-number (pop thread)))
4789 (setq thread (reverse thread))
4791 (gnus-remove-thread-1 (pop thread)))
4792 (when (setq d (gnus-data-find number))
4793 (goto-char (gnus-data-pos d))
4794 (gnus-summary-show-thread)
4800 (gnus-delete-line)))))))
4802 (defun gnus-sort-threads-recursive (threads func)
4803 (sort (mapcar (lambda (thread)
4806 (gnus-sort-threads-recursive (cdr thread) func))))
4809 (defun gnus-sort-threads-loop (threads func)
4810 (let* ((superthread (cons nil threads))
4811 (stack (list (cons superthread threads)))
4812 remaining-threads thread)
4814 (setq remaining-threads (cdr (car stack)))
4815 (if remaining-threads
4816 (progn (setq thread (car remaining-threads))
4817 (setcdr (car stack) (cdr remaining-threads))
4819 (push (cons thread (cdr thread)) stack)))
4820 (setq thread (caar stack))
4821 (setcdr thread (sort (cdr thread) func))
4825 (defun gnus-sort-threads (threads)
4827 (if (not gnus-thread-sort-functions)
4829 (gnus-message 8 "Sorting threads...")
4832 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4833 (gnus-sort-threads-recursive
4834 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4835 ;; Even after binding max-lisp-eval-depth, the recursive
4836 ;; sorter might fail for very long threads. In that case,
4837 ;; try using a (less well-tested) non-recursive sorter.
4838 (error (gnus-message 9 "Sorting threads with loop...")
4839 (gnus-sort-threads-loop
4840 threads (gnus-make-sort-function
4841 gnus-thread-sort-functions))))
4842 (gnus-message 8 "Sorting threads...done"))))
4844 (defun gnus-sort-articles (articles)
4846 (when gnus-article-sort-functions
4847 (gnus-message 7 "Sorting articles...")
4849 (setq gnus-newsgroup-headers
4850 (sort articles (gnus-make-sort-function
4851 gnus-article-sort-functions)))
4852 (gnus-message 7 "Sorting articles...done"))))
4854 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4855 (defmacro gnus-thread-header (thread)
4856 "Return header of first article in THREAD.
4857 Note that THREAD must never, ever be anything else than a variable -
4858 using some other form will lead to serious barfage."
4859 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4860 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4861 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4864 (defsubst gnus-article-sort-by-number (h1 h2)
4865 "Sort articles by article number."
4866 (< (mail-header-number h1)
4867 (mail-header-number h2)))
4869 (defun gnus-thread-sort-by-number (h1 h2)
4870 "Sort threads by root article number."
4871 (gnus-article-sort-by-number
4872 (gnus-thread-header h1) (gnus-thread-header h2)))
4874 (defsubst gnus-article-sort-by-random (h1 h2)
4875 "Sort articles randomly."
4878 (defun gnus-thread-sort-by-random (h1 h2)
4879 "Sort threads randomly."
4880 (gnus-article-sort-by-random
4881 (gnus-thread-header h1) (gnus-thread-header h2)))
4883 (defsubst gnus-article-sort-by-lines (h1 h2)
4884 "Sort articles by article Lines header."
4885 (< (mail-header-lines h1)
4886 (mail-header-lines h2)))
4888 (defun gnus-thread-sort-by-lines (h1 h2)
4889 "Sort threads by root article Lines header."
4890 (gnus-article-sort-by-lines
4891 (gnus-thread-header h1) (gnus-thread-header h2)))
4893 (defsubst gnus-article-sort-by-chars (h1 h2)
4894 "Sort articles by octet length."
4895 (< (mail-header-chars h1)
4896 (mail-header-chars h2)))
4898 (defun gnus-thread-sort-by-chars (h1 h2)
4899 "Sort threads by root article octet length."
4900 (gnus-article-sort-by-chars
4901 (gnus-thread-header h1) (gnus-thread-header h2)))
4903 (defsubst gnus-article-sort-by-author (h1 h2)
4904 "Sort articles by root author."
4906 (let ((extract (funcall
4907 gnus-extract-address-components
4908 (mail-header-from h1))))
4909 (or (car extract) (cadr extract) ""))
4910 (let ((extract (funcall
4911 gnus-extract-address-components
4912 (mail-header-from h2))))
4913 (or (car extract) (cadr extract) ""))))
4915 (defun gnus-thread-sort-by-author (h1 h2)
4916 "Sort threads by root author."
4917 (gnus-article-sort-by-author
4918 (gnus-thread-header h1) (gnus-thread-header h2)))
4920 (defsubst gnus-article-sort-by-recipient (h1 h2)
4921 "Sort articles by recipient."
4923 (let ((extract (funcall
4924 gnus-extract-address-components
4925 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4926 (or (car extract) (cadr extract)))
4927 (let ((extract (funcall
4928 gnus-extract-address-components
4929 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4930 (or (car extract) (cadr extract)))))
4932 (defun gnus-thread-sort-by-recipient (h1 h2)
4933 "Sort threads by root recipient."
4934 (gnus-article-sort-by-recipient
4935 (gnus-thread-header h1) (gnus-thread-header h2)))
4937 (defsubst gnus-article-sort-by-subject (h1 h2)
4938 "Sort articles by root subject."
4940 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4941 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4943 (defun gnus-thread-sort-by-subject (h1 h2)
4944 "Sort threads by root subject."
4945 (gnus-article-sort-by-subject
4946 (gnus-thread-header h1) (gnus-thread-header h2)))
4948 (defsubst gnus-article-sort-by-date (h1 h2)
4949 "Sort articles by root article date."
4951 (gnus-date-get-time (mail-header-date h1))
4952 (gnus-date-get-time (mail-header-date h2))))
4954 (defun gnus-thread-sort-by-date (h1 h2)
4955 "Sort threads by root article date."
4956 (gnus-article-sort-by-date
4957 (gnus-thread-header h1) (gnus-thread-header h2)))
4959 (defsubst gnus-article-sort-by-score (h1 h2)
4960 "Sort articles by root article score.
4961 Unscored articles will be counted as having a score of zero."
4962 (> (or (cdr (assq (mail-header-number h1)
4963 gnus-newsgroup-scored))
4964 gnus-summary-default-score 0)
4965 (or (cdr (assq (mail-header-number h2)
4966 gnus-newsgroup-scored))
4967 gnus-summary-default-score 0)))
4969 (defun gnus-thread-sort-by-score (h1 h2)
4970 "Sort threads by root article score."
4971 (gnus-article-sort-by-score
4972 (gnus-thread-header h1) (gnus-thread-header h2)))
4974 (defun gnus-thread-sort-by-total-score (h1 h2)
4975 "Sort threads by the sum of all scores in the thread.
4976 Unscored articles will be counted as having a score of zero."
4977 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4979 (defun gnus-thread-total-score (thread)
4980 ;; This function find the total score of THREAD.
4985 (if (stringp (car thread))
4986 (apply gnus-thread-score-function 0
4987 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4988 (gnus-thread-total-score-1 thread)))
4990 (gnus-thread-total-score-1 (list thread)))))
4992 (defun gnus-article-sort-by-most-recent-number (h1 h2)
4993 "Sort articles by number."
4994 (gnus-article-sort-by-number h1 h2))
4996 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4997 "Sort threads such that the thread with the most recently arrived article comes first."
4998 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5000 (defun gnus-thread-highest-number (thread)
5001 "Return the highest article number in THREAD."
5002 (apply 'max (mapcar (lambda (header)
5003 (mail-header-number header))
5004 (message-flatten-list thread))))
5006 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5007 "Sort articles by number."
5008 (gnus-article-sort-by-date h1 h2))
5010 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5011 "Sort threads such that the thread with the most recently dated article comes first."
5012 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5014 ; Since this is called not only to sort the top-level threads, but
5015 ; also in recursive sorts to order the articles within a thread, each
5016 ; article will be processed many times. Thus it speeds things up
5017 ; quite a bit to use gnus-date-get-time, which caches the time value.
5018 (defun gnus-thread-latest-date (thread)
5019 "Return the highest article date in THREAD."
5021 (mapcar (lambda (header) (gnus-float-time
5023 (mail-header-date header))))
5024 (message-flatten-list thread))))
5026 (defun gnus-thread-total-score-1 (root)
5027 ;; This function find the total score of the thread below ROOT.
5028 (setq root (car root))
5029 (apply gnus-thread-score-function
5031 (mapcar 'gnus-thread-total-score
5032 (cdr (gnus-id-to-thread (mail-header-id root))))
5033 (when (> (mail-header-number root) 0)
5034 (list (or (cdr (assq (mail-header-number root)
5035 gnus-newsgroup-scored))
5036 gnus-summary-default-score 0))))
5037 (list gnus-summary-default-score)
5040 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5041 (defvar gnus-tmp-prev-subject nil)
5042 (defvar gnus-tmp-false-parent nil)
5043 (defvar gnus-tmp-root-expunged nil)
5044 (defvar gnus-tmp-dummy-line nil)
5046 (defun gnus-extra-header (type &optional header)
5047 "Return the extra header of TYPE."
5048 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5051 (defvar gnus-tmp-thread-tree-header-string "")
5053 (defcustom gnus-sum-thread-tree-root "> "
5054 "With %B spec, used for the root of a thread.
5055 If nil, use subject instead."
5057 :type '(radio (const :format "%v " nil) string)
5058 :group 'gnus-thread)
5060 (defcustom gnus-sum-thread-tree-false-root "> "
5061 "With %B spec, used for a false root of a thread.
5062 If nil, use subject instead."
5064 :type '(radio (const :format "%v " nil) string)
5065 :group 'gnus-thread)
5067 (defcustom gnus-sum-thread-tree-single-indent ""
5068 "With %B spec, used for a thread with just one message.
5069 If nil, use subject instead."
5071 :type '(radio (const :format "%v " nil) string)
5072 :group 'gnus-thread)
5074 (defcustom gnus-sum-thread-tree-vertical "| "
5075 "With %B spec, used for drawing a vertical line."
5078 :group 'gnus-thread)
5080 (defcustom gnus-sum-thread-tree-indent " "
5081 "With %B spec, used for indenting."
5084 :group 'gnus-thread)
5086 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5087 "With %B spec, used for a leaf with brothers."
5090 :group 'gnus-thread)
5092 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5093 "With %B spec, used for a leaf without brothers."
5096 :group 'gnus-thread)
5098 (defcustom gnus-summary-display-while-building nil
5099 "If non-nil, show and update the summary buffer as it's being built.
5100 If the value is t, update the buffer after every line is inserted. If
5101 the value is an integer (N), update the display every N lines."
5104 :type '(choice (const :tag "off" nil)
5106 (const :tag "frequently" t)))
5108 (defun gnus-summary-prepare-threads (threads)
5109 "Prepare summary buffer from THREADS and indentation LEVEL.
5110 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5111 or a straight list of headers."
5112 (gnus-message 7 "Generating summary...")
5114 (setq gnus-newsgroup-threads threads)
5117 (let ((gnus-tmp-level 0)
5118 (default-score (or gnus-summary-default-score 0))
5119 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5120 (building-line-count gnus-summary-display-while-building)
5121 (building-count (integerp gnus-summary-display-while-building))
5122 thread number subject stack state gnus-tmp-gathered beg-match
5123 new-roots gnus-tmp-new-adopts thread-end simp-subject
5124 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5125 gnus-tmp-replied gnus-tmp-subject-or-nil
5126 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5127 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5128 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5131 (setq gnus-tmp-prev-subject nil
5132 gnus-tmp-thread-tree-header-string "")
5134 (if (vectorp (car threads))
5135 ;; If this is a straight (sic) list of headers, then a
5136 ;; threaded summary display isn't required, so we just create
5137 ;; an unthreaded one.
5138 (gnus-summary-prepare-unthreaded threads)
5140 ;; Do the threaded display.
5142 (if gnus-summary-display-while-building
5143 (switch-to-buffer (buffer-name)))
5144 (while (or threads stack gnus-tmp-new-adopts new-roots)
5146 (if (and (= gnus-tmp-level 0)
5149 (not gnus-tmp-false-parent)
5150 (or gnus-tmp-new-adopts new-roots))
5151 (if gnus-tmp-new-adopts
5152 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5153 thread (list (car gnus-tmp-new-adopts))
5154 gnus-tmp-header (caar thread)
5155 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5157 (setq thread (list (car new-roots))
5158 gnus-tmp-header (caar thread)
5159 new-roots (cdr new-roots))))
5162 ;; If there are some threads, we do them before the
5163 ;; threads on the stack.
5164 (setq thread threads
5165 gnus-tmp-header (caar thread))
5166 ;; There were no current threads, so we pop something off
5168 (setq state (car stack)
5169 gnus-tmp-level (car state)
5170 tree-stack (cadr state)
5171 thread (caddr state)
5173 gnus-tmp-header (caar thread))))
5175 (setq gnus-tmp-false-parent nil)
5176 (setq gnus-tmp-root-expunged nil)
5177 (setq thread-end nil)
5179 (if (stringp gnus-tmp-header)
5180 ;; The header is a dummy root.
5182 ((eq gnus-summary-make-false-root 'adopt)
5183 ;; We let the first article adopt the rest.
5184 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5186 (setq gnus-tmp-gathered
5188 (lambda (h) (mail-header-number (car h)))
5191 (setq thread (cons (list (caar thread)
5194 (setq gnus-tmp-level -1
5195 gnus-tmp-false-parent t))
5196 ((eq gnus-summary-make-false-root 'empty)
5197 ;; We print adopted articles with empty subject fields.
5198 (setq gnus-tmp-gathered
5200 (lambda (h) (mail-header-number (car h)))
5203 (setq gnus-tmp-level -1))
5204 ((eq gnus-summary-make-false-root 'dummy)
5205 ;; We remember that we probably want to output a dummy
5207 (setq gnus-tmp-dummy-line gnus-tmp-header)
5208 (setq gnus-tmp-prev-subject gnus-tmp-header))
5210 ;; We do not make a root for the gathered
5211 ;; sub-threads at all.
5212 (setq gnus-tmp-level -1)))
5214 (setq number (mail-header-number gnus-tmp-header)
5215 subject (mail-header-subject gnus-tmp-header)
5216 simp-subject (gnus-simplify-subject-fully subject))
5219 ;; If the thread has changed subject, we might want to make
5220 ;; this subthread into a root.
5221 ((and (null gnus-thread-ignore-subject)
5222 (not (zerop gnus-tmp-level))
5223 gnus-tmp-prev-subject
5224 (not (string= gnus-tmp-prev-subject simp-subject)))
5225 (setq new-roots (nconc new-roots (list (car thread)))
5227 gnus-tmp-header nil))
5228 ;; If the article lies outside the current limit,
5229 ;; then we do not display it.
5230 ((not (memq number gnus-newsgroup-limit))
5231 (setq gnus-tmp-gathered
5233 (lambda (h) (mail-header-number (car h)))
5236 (setq gnus-tmp-new-adopts (if (cdar thread)
5237 (append gnus-tmp-new-adopts
5239 gnus-tmp-new-adopts)
5241 gnus-tmp-header nil)
5242 (when (zerop gnus-tmp-level)
5243 (setq gnus-tmp-root-expunged t)))
5244 ;; Perhaps this article is to be marked as read?
5245 ((and gnus-summary-mark-below
5246 (< (or (cdr (assq number gnus-newsgroup-scored))
5248 gnus-summary-mark-below)
5249 ;; Don't touch sparse articles.
5250 (not (gnus-summary-article-sparse-p number))
5251 (not (gnus-summary-article-ancient-p number)))
5252 (setq gnus-newsgroup-unreads
5253 (delq number gnus-newsgroup-unreads))
5254 (if gnus-newsgroup-auto-expire
5255 (setq gnus-newsgroup-expirable
5256 (gnus-add-to-sorted-list
5257 gnus-newsgroup-expirable number))
5258 (push (cons number gnus-low-score-mark)
5259 gnus-newsgroup-reads))))
5261 (when gnus-tmp-header
5262 ;; We may have an old dummy line to output before this
5264 (when (and gnus-tmp-dummy-line
5267 (mail-header-subject gnus-tmp-header)))
5268 (gnus-summary-insert-dummy-line
5269 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5270 (setq gnus-tmp-dummy-line nil))
5272 ;; Compute the mark.
5273 (setq gnus-tmp-unread (gnus-article-mark number))
5275 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5276 gnus-tmp-header gnus-tmp-level)
5277 gnus-newsgroup-data)
5279 ;; Actually insert the line.
5281 gnus-tmp-subject-or-nil
5283 ((and gnus-thread-ignore-subject
5284 gnus-tmp-prev-subject
5285 (not (string= gnus-tmp-prev-subject simp-subject)))
5287 ((zerop gnus-tmp-level)
5288 (if (and (eq gnus-summary-make-false-root 'empty)
5289 (memq number gnus-tmp-gathered)
5290 gnus-tmp-prev-subject
5291 (string= gnus-tmp-prev-subject simp-subject))
5292 gnus-summary-same-subject
5294 (t gnus-summary-same-subject)))
5295 (if (and (eq gnus-summary-make-false-root 'adopt)
5296 (= gnus-tmp-level 1)
5297 (memq number gnus-tmp-gathered))
5298 (setq gnus-tmp-opening-bracket ?\<
5299 gnus-tmp-closing-bracket ?\>)
5300 (setq gnus-tmp-opening-bracket ?\[
5301 gnus-tmp-closing-bracket ?\]))
5302 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5303 (gnus-make-thread-indent-array
5304 (max (* 2 (length gnus-thread-indent-array))
5307 gnus-tmp-indentation
5308 (aref gnus-thread-indent-array gnus-tmp-level)
5309 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5310 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5311 gnus-summary-default-score 0)
5313 (if (or (null gnus-summary-default-score)
5314 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5315 gnus-summary-zcore-fuzz))
5317 (if (< gnus-tmp-score gnus-summary-default-score)
5318 gnus-score-below-mark gnus-score-over-mark))
5320 (cond ((memq number gnus-newsgroup-processable)
5322 ((memq number gnus-newsgroup-cached)
5324 ((memq number gnus-newsgroup-replied)
5326 ((memq number gnus-newsgroup-forwarded)
5327 gnus-forwarded-mark)
5328 ((memq number gnus-newsgroup-saved)
5330 ((memq number gnus-newsgroup-recent)
5332 ((memq number gnus-newsgroup-unseen)
5336 (cond ((memq number gnus-newsgroup-undownloaded)
5337 gnus-undownloaded-mark)
5338 (gnus-newsgroup-agentized
5339 gnus-downloaded-mark)
5342 gnus-tmp-from (mail-header-from gnus-tmp-header)
5345 ((string-match "<[^>]+> *$" gnus-tmp-from)
5346 (setq beg-match (match-beginning 0))
5347 (or (and (string-match "^\".+\"" gnus-tmp-from)
5348 (substring gnus-tmp-from 1 (1- (match-end 0))))
5349 (substring gnus-tmp-from 0 beg-match)))
5350 ((string-match "(.+)" gnus-tmp-from)
5351 (substring gnus-tmp-from
5352 (1+ (match-beginning 0)) (1- (match-end 0))))
5356 gnus-tmp-thread-tree-header-string
5358 ((not gnus-show-threads) "")
5359 ((zerop gnus-tmp-level)
5360 (cond ((cdar thread)
5361 (or gnus-sum-thread-tree-root subject))
5362 (gnus-tmp-new-adopts
5363 (or gnus-sum-thread-tree-false-root subject))
5365 (or gnus-sum-thread-tree-single-indent subject))))
5367 (concat (apply 'concat
5368 (mapcar (lambda (item)
5370 gnus-sum-thread-tree-vertical
5371 gnus-sum-thread-tree-indent))
5372 (cdr (reverse tree-stack))))
5374 gnus-sum-thread-tree-leaf-with-other
5375 gnus-sum-thread-tree-single-leaf)))))
5376 (when (string= gnus-tmp-name "")
5377 (setq gnus-tmp-name gnus-tmp-from))
5378 (unless (numberp gnus-tmp-lines)
5379 (setq gnus-tmp-lines -1))
5380 (if (= gnus-tmp-lines -1)
5381 (setq gnus-tmp-lines "?")
5382 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5383 (gnus-put-text-property
5385 (progn (eval gnus-summary-line-format-spec) (point))
5386 'gnus-number number)
5389 (gnus-summary-highlight-line)
5390 (when gnus-summary-update-hook
5391 (gnus-run-hooks 'gnus-summary-update-hook))
5394 (setq gnus-tmp-prev-subject simp-subject)))
5396 (when (nth 1 thread)
5397 (push (list (max 0 gnus-tmp-level)
5398 (copy-sequence tree-stack)
5401 (push (if (nth 1 thread) 1 0) tree-stack)
5402 (incf gnus-tmp-level)
5403 (setq threads (if thread-end nil (cdar thread)))
5404 (if gnus-summary-display-while-building
5407 ;; use a set frequency
5408 (setq building-line-count (1- building-line-count))
5409 (when (= building-line-count 0)
5411 (setq building-line-count
5412 gnus-summary-display-while-building)))
5416 (setq gnus-tmp-level 0)))))
5417 (gnus-message 7 "Generating summary...done"))
5419 (defun gnus-summary-prepare-unthreaded (headers)
5420 "Generate an unthreaded summary buffer based on HEADERS."
5421 (let (header number mark)
5426 ;; We may have to root out some bad articles...
5427 (when (memq (setq number (mail-header-number
5428 (setq header (pop headers))))
5429 gnus-newsgroup-limit)
5430 ;; Mark article as read when it has a low score.
5431 (when (and gnus-summary-mark-below
5432 (< (or (cdr (assq number gnus-newsgroup-scored))
5433 gnus-summary-default-score 0)
5434 gnus-summary-mark-below)
5435 (not (gnus-summary-article-ancient-p number)))
5436 (setq gnus-newsgroup-unreads
5437 (delq number gnus-newsgroup-unreads))
5438 (if gnus-newsgroup-auto-expire
5439 (push number gnus-newsgroup-expirable)
5440 (push (cons number gnus-low-score-mark)
5441 gnus-newsgroup-reads)))
5443 (setq mark (gnus-article-mark number))
5444 (push (gnus-data-make number mark (1+ (point)) header 0)
5445 gnus-newsgroup-data)
5446 (gnus-summary-insert-line
5448 (memq number gnus-newsgroup-undownloaded)
5449 mark (memq number gnus-newsgroup-replied)
5450 (memq number gnus-newsgroup-expirable)
5451 (mail-header-subject header) nil
5452 (cdr (assq number gnus-newsgroup-scored))
5453 (memq number gnus-newsgroup-processable))))))
5455 (defun gnus-summary-remove-list-identifiers ()
5456 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5457 (let ((regexp (if (consp gnus-list-identifiers)
5458 (mapconcat 'identity gnus-list-identifiers " *\\|")
5459 gnus-list-identifiers))
5462 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5463 (dolist (header gnus-newsgroup-headers)
5464 (setq subject (mail-header-subject header)
5466 (while (string-match regexp subject)
5468 (concat (substring subject 0 (match-beginning 1))
5469 (substring subject (match-end 0)))
5472 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5474 (concat (substring subject 0 (match-beginning 1))
5475 (substring subject (match-end 1)))))
5476 (mail-header-set-subject header subject))))))
5478 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5479 "Fetch headers of ARTICLES."
5480 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5481 (gnus-message 5 "Fetching headers for %s..." name)
5484 (setq gnus-headers-retrieved-by
5485 (gnus-retrieve-headers
5486 articles gnus-newsgroup-name
5488 ;; We might want to fetch old headers, but
5489 ;; not if there is only 1 article.
5491 (not (eq gnus-fetch-old-headers 'some))
5492 (not (numberp gnus-fetch-old-headers)))
5493 (> (length articles) 1))
5494 gnus-fetch-old-headers)))))
5495 (gnus-get-newsgroup-headers-xover
5496 articles force-new dependencies gnus-newsgroup-name t)
5497 (gnus-get-newsgroup-headers dependencies force-new))
5498 (gnus-message 5 "Fetching headers for %s...done" name))))
5500 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5501 "Select newsgroup GROUP.
5502 If READ-ALL is non-nil, all articles in the group are selected.
5503 If SELECT-ARTICLES, only select those articles from GROUP."
5504 (let* ((entry (gnus-group-entry group))
5505 ;;!!! Dirty hack; should be removed.
5506 (gnus-summary-ignore-duplicates
5507 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5509 gnus-summary-ignore-duplicates))
5510 (info (nth 2 entry))
5511 charset articles fetched-articles cached)
5513 (unless (gnus-check-server
5514 (set (make-local-variable 'gnus-current-select-method)
5515 (gnus-find-method-for-group group)))
5516 (error "Couldn't open server"))
5517 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5519 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5520 (gnus-activate-group group) ; Or we can activate it...
5521 (progn ; Or we bug out.
5522 (when (equal major-mode 'gnus-summary-mode)
5523 (gnus-kill-buffer (current-buffer)))
5525 "Couldn't activate group %s: %s"
5526 (mm-decode-coding-string group charset)
5527 (mm-decode-coding-string (gnus-status-message group) charset))))
5529 (unless (gnus-request-group group t)
5530 (when (equal major-mode 'gnus-summary-mode)
5531 (gnus-kill-buffer (current-buffer)))
5532 (error "Couldn't request group %s: %s"
5533 (mm-decode-coding-string group charset)
5534 (mm-decode-coding-string (gnus-status-message group) charset)))
5537 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5539 (setq gnus-summary-use-undownloaded-faces
5540 (gnus-agent-find-parameter
5542 'agent-enable-undownloaded-faces)))
5544 (setq gnus-newsgroup-name group
5545 gnus-newsgroup-unselected nil
5546 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5548 (let ((display (gnus-group-find-parameter group 'display)))
5549 (setq gnus-newsgroup-display
5551 ((not (zerop (or (car-safe read-all) 0)))
5552 ;; The user entered the group with C-u SPC/RET, let's show
5558 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5560 ;; The following is probably the "correct" solution, but
5561 ;; it makes Gnus fetch all headers and then limit the
5562 ;; articles (which is slow), so instead we hack the
5563 ;; select-articles parameter instead. -- Simon Josefsson
5566 ;; (gnus-byte-compile
5567 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5569 (setq select-articles
5570 (gnus-uncompress-range
5571 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5575 (cdr (gnus-active group)))))
5580 (gnus-summary-setup-default-charset)
5582 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5583 (when (gnus-virtual-group-p group)
5584 (setq cached gnus-newsgroup-cached))
5586 (setq gnus-newsgroup-unreads
5587 (gnus-sorted-ndifference
5588 (gnus-sorted-ndifference gnus-newsgroup-unreads
5589 gnus-newsgroup-marked)
5590 gnus-newsgroup-dormant))
5592 (setq gnus-newsgroup-processable nil)
5594 (gnus-update-read-articles group gnus-newsgroup-unreads)
5596 ;; Adjust and set lists of article marks.
5598 (gnus-adjust-marked-articles info))
5599 (if (setq articles select-articles)
5600 (setq gnus-newsgroup-unselected
5601 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5602 (setq articles (gnus-articles-to-read group read-all)))
5606 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5608 ((eq articles 0) nil)
5610 ;; Init the dependencies hash table.
5611 (setq gnus-newsgroup-dependencies
5612 (gnus-make-hashtable (length articles)))
5613 (gnus-set-global-variables)
5614 ;; Retrieve the headers and read them in.
5616 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5618 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5620 (setq gnus-newsgroup-cached cached))
5622 ;; Suppress duplicates?
5623 (when gnus-suppress-duplicates
5624 (gnus-dup-suppress-articles))
5626 ;; Set the initial limit.
5627 (setq gnus-newsgroup-limit (copy-sequence articles))
5628 ;; Remove canceled articles from the list of unread articles.
5629 (setq fetched-articles
5630 (mapcar (lambda (headers) (mail-header-number headers))
5631 gnus-newsgroup-headers))
5632 (setq gnus-newsgroup-articles fetched-articles)
5633 (setq gnus-newsgroup-unreads
5634 (gnus-sorted-nintersection
5635 gnus-newsgroup-unreads fetched-articles))
5636 (gnus-compute-unseen-list)
5638 ;; Removed marked articles that do not exist.
5639 (gnus-update-missing-marks
5640 (gnus-sorted-difference articles fetched-articles))
5641 ;; We might want to build some more threads first.
5642 (when (and gnus-fetch-old-headers
5643 (eq gnus-headers-retrieved-by 'nov))
5644 (if (eq gnus-fetch-old-headers 'invisible)
5645 (gnus-build-all-threads)
5646 (gnus-build-old-threads)))
5647 ;; Let the Gnus agent mark articles as read.
5649 (gnus-agent-get-undownloaded-list))
5650 ;; Remove list identifiers from subject
5651 (when gnus-list-identifiers
5652 (gnus-summary-remove-list-identifiers))
5653 ;; Check whether auto-expire is to be done in this group.
5654 (setq gnus-newsgroup-auto-expire
5655 (gnus-group-auto-expirable-p group))
5656 ;; Set up the article buffer now, if necessary.
5657 (unless (and gnus-single-article-buffer
5658 (equal gnus-article-buffer "*Article*"))
5659 (gnus-article-setup-buffer))
5660 ;; First and last article in this newsgroup.
5661 (when gnus-newsgroup-headers
5662 (setq gnus-newsgroup-begin
5663 (mail-header-number (car gnus-newsgroup-headers))
5666 (gnus-last-element gnus-newsgroup-headers))))
5667 ;; GROUP is successfully selected.
5668 (or gnus-newsgroup-headers t)))))
5670 (defun gnus-compute-unseen-list ()
5671 ;; The `seen' marks are treated specially.
5672 (if (not gnus-newsgroup-seen)
5673 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5674 (setq gnus-newsgroup-unseen
5675 (gnus-inverse-list-range-intersection
5676 gnus-newsgroup-articles gnus-newsgroup-seen))))
5678 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5680 (defun gnus-summary-display-make-predicate (display)
5681 (require 'gnus-agent)
5682 (when (= (length display) 1)
5683 (setq display (car display)))
5684 (unless gnus-summary-display-cache
5685 (dolist (elem (append '((unread . unread)
5688 gnus-article-mark-lists))
5689 (push (cons (cdr elem)
5690 (gnus-byte-compile ;Why bother?
5691 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5692 gnus-summary-display-cache)))
5693 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5694 (gnus-category-predicate-cache gnus-summary-display-cache))
5695 (gnus-get-predicate display)))
5697 ;; Uses the dynamically bound `gnus-number' variable.
5698 (defvar gnus-number)
5699 (defun gnus-article-marked-p (type &optional article)
5700 (let ((article (or article gnus-number)))
5703 (memq article gnus-newsgroup-marked))
5705 (memq article gnus-newsgroup-spam-marked))
5707 (memq article gnus-newsgroup-unsendable))
5708 ((eq type 'undownload)
5709 (memq article gnus-newsgroup-undownloaded))
5710 ((eq type 'download)
5711 (memq article gnus-newsgroup-downloadable))
5713 (memq article gnus-newsgroup-unreads))
5715 (memq article gnus-newsgroup-reads))
5717 (memq article gnus-newsgroup-dormant) )
5719 (memq article gnus-newsgroup-expirable))
5721 (memq article gnus-newsgroup-replied))
5723 (memq article gnus-newsgroup-killed))
5724 ((eq type 'bookmark)
5725 (assq article gnus-newsgroup-bookmarks))
5727 (assq article gnus-newsgroup-scored))
5729 (memq article gnus-newsgroup-saved))
5731 (memq article gnus-newsgroup-cached))
5733 (memq article gnus-newsgroup-forwarded))
5735 (not (memq article gnus-newsgroup-unseen)))
5737 (memq article gnus-newsgroup-recent))
5740 (defun gnus-articles-to-read (group &optional read-all)
5741 "Find out what articles the user wants to read."
5743 ;; Select all articles if `read-all' is non-nil, or if there
5744 ;; are no unread articles.
5746 (and (zerop (length gnus-newsgroup-marked))
5747 (zerop (length gnus-newsgroup-unreads)))
5748 ;; Fetch all if the predicate is non-nil.
5749 gnus-newsgroup-display)
5750 ;; We want to select the headers for all the articles in
5751 ;; the group, so we select either all the active
5752 ;; articles in the group, or (if that's nil), the
5753 ;; articles in the cache.
5755 (if gnus-newsgroup-maximum-articles
5756 (let ((active (gnus-active group)))
5757 (gnus-uncompress-range
5758 (cons (max (car active)
5760 gnus-newsgroup-maximum-articles
5763 (gnus-uncompress-range (gnus-active group)))
5764 (gnus-cache-articles-in-group group))
5765 ;; Select only the "normal" subset of articles.
5767 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5768 gnus-newsgroup-unreads)))
5769 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5770 (scored (length scored-list))
5771 (number (length articles))
5772 (marked (+ (length gnus-newsgroup-marked)
5773 (length gnus-newsgroup-dormant)))
5778 ((numberp gnus-newsgroup-display)
5779 gnus-newsgroup-display)
5783 ((and (or (<= scored marked) (= scored number))
5784 (numberp gnus-large-newsgroup)
5785 (> number gnus-large-newsgroup))
5786 (let* ((cursor-in-echo-area nil)
5787 (initial (gnus-parameter-large-newsgroup-initial
5788 gnus-newsgroup-name))
5792 "How many articles from %s (%s %d): "
5793 (gnus-group-decoded-name gnus-newsgroup-name)
5794 (if initial "max" "default")
5797 (cons (number-to-string initial)
5799 (if (string-match "^[ \t]*$" input) number input)))
5800 ((and (> scored marked) (< scored number)
5801 (> (- scored number) 20))
5804 (format "%s %s (%d scored, %d total): "
5805 "How many articles from"
5806 (gnus-group-decoded-name group)
5808 (if (string-match "^[ \t]*$" input)
5812 (message "Quit getting the articles to read")
5814 (setq select (if (stringp select) (string-to-number select) select))
5815 (if (or (null select) (zerop select))
5817 (if (and (not (zerop scored)) (<= (abs select) scored))
5819 (setq articles (sort scored-list '<))
5820 (setq number (length articles)))
5821 (setq articles (copy-sequence articles)))
5823 (when (< (abs select) number)
5825 ;; Select the N oldest articles.
5826 (setcdr (nthcdr (1- (abs select)) articles) nil)
5827 ;; Select the N most recent articles.
5828 (setq articles (nthcdr (- number select) articles))))
5829 (setq gnus-newsgroup-unselected
5830 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5831 (when gnus-alter-articles-to-read-function
5834 (funcall gnus-alter-articles-to-read-function
5835 gnus-newsgroup-name articles)
5839 (defun gnus-killed-articles (killed articles)
5842 (when (inline (gnus-member-of-range (car articles) killed))
5843 (push (car articles) out))
5844 (setq articles (cdr articles)))
5847 (defun gnus-uncompress-marks (marks)
5848 "Uncompress the mark ranges in MARKS."
5849 (let ((uncompressed '(score bookmark))
5852 (if (memq (caar marks) uncompressed)
5853 (push (car marks) out)
5854 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5855 (setq marks (cdr marks)))
5858 (defun gnus-article-mark-to-type (mark)
5859 "Return the type of MARK."
5860 (or (cadr (assq mark gnus-article-special-mark-lists))
5863 (defun gnus-article-unpropagatable-p (mark)
5864 "Return whether MARK should be propagated to back end."
5865 (memq mark gnus-article-unpropagated-mark-lists))
5867 (defun gnus-adjust-marked-articles (info)
5868 "Set all article lists and remove all marks that are no longer valid."
5869 (let* ((marked-lists (gnus-info-marks info))
5870 (active (gnus-active (gnus-info-group info)))
5873 (types gnus-article-mark-lists)
5874 marks var articles article mark mark-type
5876 ;; Hack to avoid adjusting marks for imap.
5877 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5881 (dolist (marks marked-lists)
5882 (setq mark (car marks)
5883 mark-type (gnus-article-mark-to-type mark)
5884 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5886 ;; We set the variable according to the type of the marks list,
5887 ;; and then adjust the marks to a subset of the active articles.
5889 ;; Adjust "simple" lists - compressed yet unsorted
5890 ((eq mark-type 'list)
5891 ;; Simultaneously uncompress and clip to active range
5892 ;; See gnus-uncompress-range for a description of possible marks
5894 (if (not (cadr marks))
5896 (setq articles (if (numberp (cddr marks))
5902 (while (setq article (pop articles))
5903 (cond ((consp article)
5904 (setq bgn (max (car article) min)
5905 end (min (cdr article) max))
5907 (setq l (setcdr l (cons bgn nil))
5909 ((and (<= min article)
5911 (setq l (setcdr l (cons article nil))))))
5912 (set var (cdr lh)))))
5914 ((eq mark-type 'tuple)
5915 (set var (setq articles (cdr marks)))
5916 (when (not (listp (cdr (symbol-value var))))
5917 (set var (list (symbol-value var))))
5918 (when (not (listp (cdr articles)))
5919 (setq articles (list articles)))
5921 (when (or (not (consp (setq article (pop articles))))
5922 (< (car article) min)
5923 (> (car article) max))
5924 (set var (delq article (symbol-value var))))))
5925 ;; Adjust ranges (sloppily).
5926 ((eq mark-type 'range)
5929 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5930 ;; It should be (seen (NUM1 . NUM2)).
5931 (when (numberp (cddr marks))
5932 (setcdr marks (list (cdr marks))))
5933 (setq articles (cdr marks))
5934 (while (and articles
5935 (or (and (consp (car articles))
5936 (> min (cdar articles)))
5937 (and (numberp (car articles))
5938 (> min (car articles)))))
5940 (set var articles))))))))
5942 (defun gnus-update-missing-marks (missing)
5943 "Go through the list of MISSING articles and remove them from the mark lists."
5946 ;; Go through all types.
5947 (dolist (elem gnus-article-mark-lists)
5948 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5949 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5950 (when (symbol-value var)
5951 ;; This list has articles. So we delete all missing
5952 ;; articles from it.
5955 (set var (delq (pop m) (symbol-value var))))))))))
5957 (defun gnus-update-marks ()
5958 "Enter the various lists of marked articles into the newsgroup info list."
5959 (let ((types gnus-article-mark-lists)
5960 (info (gnus-get-info gnus-newsgroup-name))
5961 type list newmarked symbol delta-marks)
5963 ;; Add all marks lists to the list of marks lists.
5964 (while (setq type (pop types))
5965 (setq list (symbol-value
5967 (intern (format "gnus-newsgroup-%s" (car type))))))
5970 ;; Get rid of the entries of the articles that have the
5972 (when (and (eq (cdr type) 'score)
5976 (prev (cons nil list))
5979 (if (or (not (consp (car arts)))
5980 (= (cdar arts) gnus-summary-default-score))
5981 (setcdr prev (cdr arts))
5983 (setq arts (cdr arts)))
5984 (setq list (cdr all)))))
5986 (when (eq (cdr type) 'seen)
5987 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5989 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5990 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5992 (when (and (gnus-check-backend-function
5993 'request-set-mark gnus-newsgroup-name)
5994 (not (gnus-article-unpropagatable-p (cdr type))))
5995 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5996 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5997 (add (gnus-remove-from-range
5998 (gnus-copy-sequence list) old)))
6000 (push (list add 'add (list (cdr type))) delta-marks))
6002 ;; Don't delete marks from outside the active range. This
6003 ;; shouldn't happen, but is a sanity check.
6004 (setq del (gnus-sorted-range-intersection
6005 (gnus-active gnus-newsgroup-name) del))
6006 (push (list del 'del (list (cdr type))) delta-marks))))
6009 (push (cons (cdr type) list) newmarked)))
6012 (unless (gnus-check-group gnus-newsgroup-name)
6013 (error "Can't open server for %s" gnus-newsgroup-name))
6014 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6016 ;; Enter these new marks into the info of the group.
6018 (setcar (nthcdr 3 info) newmarked)
6019 ;; Add the marks lists to the end of the info.
6021 (setcdr (nthcdr 2 info) (list newmarked))))
6023 ;; Cut off the end of the info if there's nothing else there.
6027 (when (nthcdr (decf i) info)
6028 (setcdr (nthcdr i info) nil)))))))
6030 (defun gnus-set-mode-line (where)
6031 "Set the mode line of the article or summary buffers.
6032 If WHERE is `summary', the summary mode line format will be used."
6033 ;; Is this mode line one we keep updated?
6034 (when (and (memq where gnus-updated-mode-lines)
6036 (intern (format "gnus-%s-mode-line-format-spec" where))))
6038 ;; We evaluate this in the summary buffer since these
6039 ;; variables are buffer-local to that buffer.
6040 (with-current-buffer gnus-summary-buffer
6041 ;; We bind all these variables that are used in the `eval' form
6043 (let* ((mformat (symbol-value
6045 (format "gnus-%s-mode-line-format-spec" where))))
6046 (gnus-tmp-group-name (gnus-mode-string-quote
6047 (gnus-group-decoded-name
6048 gnus-newsgroup-name)))
6049 (gnus-tmp-article-number (or gnus-current-article 0))
6050 (gnus-tmp-unread gnus-newsgroup-unreads)
6051 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6052 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6053 (gnus-tmp-unread-and-unselected
6054 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6055 (zerop gnus-tmp-unselected))
6057 ((zerop gnus-tmp-unselected)
6058 (format "{%d more}" gnus-tmp-unread-and-unticked))
6059 (t (format "{%d(+%d) more}"
6060 gnus-tmp-unread-and-unticked
6061 gnus-tmp-unselected))))
6063 (if (and gnus-current-headers
6064 (vectorp gnus-current-headers))
6065 (gnus-mode-string-quote
6066 (mail-header-subject gnus-current-headers))
6068 bufname-length max-len
6069 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6070 (setq mode-string (eval mformat))
6071 (setq bufname-length (if (string-match "%b" mode-string)
6074 (if (eq where 'summary)
6076 (get-buffer gnus-article-buffer))))
6079 (setq max-len (max 4 (if gnus-mode-non-string-length
6081 gnus-mode-non-string-length
6083 (length mode-string))))
6084 ;; We might have to chop a bit of the string off...
6085 (when (> (length mode-string) max-len)
6087 (concat (truncate-string-to-width mode-string (- max-len 3))
6089 ;; Update the mode line.
6090 (setq mode-line-buffer-identification
6091 (gnus-mode-line-buffer-identification (list mode-string)))
6092 (set-buffer-modified-p t))))
6094 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6095 "Go through the HEADERS list and add all Xrefs to a hash table.
6096 The resulting hash table is returned, or nil if no Xrefs were found."
6097 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6098 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6099 (xref-hashtb (gnus-make-hashtable))
6100 start group entry number xrefs header)
6102 (setq header (pop headers))
6103 (when (and (setq xrefs (mail-header-xref header))
6104 (not (memq (setq number (mail-header-number header))
6107 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6108 (setq start (match-end 0))
6109 (setq group (if prefix
6110 (concat prefix (substring xrefs (match-beginning 1)
6112 (substring xrefs (match-beginning 1) (match-end 1))))
6114 (string-to-number (substring xrefs (match-beginning 2)
6116 (if (setq entry (gnus-gethash group xref-hashtb))
6117 (setcdr entry (cons number (cdr entry)))
6118 (gnus-sethash group (cons number nil) xref-hashtb)))))
6119 (and start xref-hashtb)))
6121 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6122 "Look through all the headers and mark the Xrefs as read."
6123 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6124 name info xref-hashtb idlist method nth4)
6125 (with-current-buffer gnus-group-buffer
6126 (when (setq xref-hashtb
6127 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6130 (unless (string= from-newsgroup (setq name (symbol-name group)))
6131 (setq idlist (symbol-value group))
6132 ;; Dead groups are not updated.
6134 (setq info (gnus-get-info name))
6135 (when (stringp (setq nth4 (gnus-info-method info)))
6136 (setq nth4 (gnus-server-to-method nth4))))
6137 ;; Only do the xrefs if the group has the same
6138 ;; select method as the group we have just read.
6139 (or (gnus-methods-equal-p
6140 nth4 (gnus-find-method-for-group from-newsgroup))
6142 (equal nth4 (setq method (gnus-find-method-for-group
6144 (and (equal (car nth4) (car method))
6145 (equal (nth 1 nth4) (nth 1 method))))
6146 gnus-use-cross-reference
6147 (or (not (eq gnus-use-cross-reference t))
6149 ;; Only do cross-references on subscribed
6150 ;; groups, if that is what is wanted.
6151 (<= (gnus-info-level info) gnus-level-subscribed))
6152 (gnus-group-make-articles-read name idlist))))
6155 (defun gnus-compute-read-articles (group articles)
6156 (let* ((entry (gnus-group-entry group))
6157 (info (nth 2 entry))
6158 (active (gnus-active group))
6161 ;; First peel off all invalid article numbers.
6163 (let ((ids articles)
6165 (while (setq id (pop ids))
6166 (when (and first (> id (cdr active)))
6167 ;; We'll end up in this situation in one particular
6168 ;; obscure situation. If you re-scan a group and get
6169 ;; a new article that is cross-posted to a different
6170 ;; group that has not been re-scanned, you might get
6171 ;; crossposted article that has a higher number than
6172 ;; Gnus believes possible. So we re-activate this
6173 ;; group as well. This might mean doing the
6174 ;; crossposting thingy will *increase* the number
6175 ;; of articles in some groups. Tsk, tsk.
6176 (setq active (or (gnus-activate-group group) active)))
6177 (when (or (> id (cdr active))
6178 (< id (car active)))
6179 (setq articles (delq id articles))))))
6180 ;; If the read list is nil, we init it.
6182 (null (gnus-info-read info))
6184 (setq ninfo (cons 1 (1- (car active))))
6185 (setq ninfo (gnus-info-read info)))
6186 ;; Then we add the read articles to the range.
6188 ninfo (setq articles (sort articles '<))))))
6190 (defun gnus-group-make-articles-read (group articles)
6191 "Update the info of GROUP to say that ARTICLES are read."
6193 (entry (gnus-group-entry group))
6194 (info (nth 2 entry))
6195 (active (gnus-active group))
6198 ;; Group that Gnus doesn't know exists, but still allow the
6199 ;; backend to set marks.
6200 (gnus-request-set-mark
6201 group (list (list (gnus-compress-sequence (sort articles #'<))
6203 ;; Normal, subscribed groups.
6204 (setq range (gnus-compute-read-articles group articles))
6205 (with-current-buffer gnus-group-buffer
6208 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6209 (gnus-info-set-read ',info ',(gnus-info-read info))
6210 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6211 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6212 (gnus-group-update-group ,group t))))
6213 ;; Add the read articles to the range.
6214 (gnus-info-set-read info range)
6215 (gnus-request-set-mark group (list (list range 'add '(read))))
6216 ;; Then we have to re-compute how many unread
6217 ;; articles there are in this group.
6221 (setq num (- (1+ (cdr active)) (car active))))
6222 ((not (listp (cdr range)))
6223 (setq num (- (cdr active) (- (1+ (cdr range))
6227 (if (numberp (car range))
6229 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6230 (setq range (cdr range)))
6231 (setq num (- (cdr active) num))))
6232 ;; Update the number of unread articles.
6234 ;; Update the group buffer.
6235 (unless (gnus-ephemeral-group-p group)
6236 (gnus-group-update-group group t))))))
6238 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6239 (let ((cur nntp-server-buffer)
6242 (with-current-buffer gnus-summary-buffer
6243 gnus-newsgroup-dependencies)))
6244 headers id end ref number
6245 (mail-parse-charset gnus-newsgroup-charset)
6246 (mail-parse-ignored-charsets
6247 (save-current-buffer (condition-case nil
6248 (set-buffer gnus-summary-buffer)
6250 gnus-newsgroup-ignored-charsets)))
6251 (with-current-buffer nntp-server-buffer
6252 ;; Translate all TAB characters into SPACE characters.
6253 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6254 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6255 (ietf-drums-unfold-fws)
6256 (gnus-run-hooks 'gnus-parse-headers-hook)
6257 (let ((case-fold-search t)
6258 in-reply-to header p lines chars)
6259 (goto-char (point-min))
6260 ;; Search to the beginning of the next header. Error messages
6261 ;; do not begin with 2 or 3.
6262 (while (re-search-forward "^[23][0-9]+ " nil t)
6265 ;; This implementation of this function, with nine
6266 ;; search-forwards instead of the one re-search-forward and
6267 ;; a case (which basically was the old function) is actually
6268 ;; about twice as fast, even though it looks messier. You
6269 ;; can't have everything, I guess. Speed and elegance
6270 ;; doesn't always go hand in hand.
6276 (setq number (read cur))
6279 (narrow-to-region (point)
6280 (or (and (search-forward "\n.\n" nil t)
6286 (if (search-forward "\nsubject:" nil t)
6287 (funcall gnus-decode-encoded-word-function
6288 (nnheader-header-value))
6293 (if (search-forward "\nfrom:" nil t)
6294 (funcall gnus-decode-encoded-address-function
6295 (nnheader-header-value))
6300 (if (search-forward "\ndate:" nil t)
6301 (nnheader-header-value) ""))
6305 (setq id (if (re-search-forward
6306 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6307 ;; We do it this way to make sure the Message-ID
6308 ;; is (somewhat) syntactically valid.
6309 (buffer-substring (match-beginning 1)
6311 ;; If there was no message-id, we just fake one
6312 ;; to make subsequent routines simpler.
6313 (nnheader-generate-fake-message-id number))))
6317 (if (search-forward "\nreferences:" nil t)
6321 (nnheader-header-value)
6326 (search-backward ">" end t)
6329 (search-backward "<" end t)
6331 ;; Get the references from the in-reply-to header if there
6332 ;; were no references and the in-reply-to header looks
6334 (if (and (search-forward "\nin-reply-to:" nil t)
6335 (setq in-reply-to (nnheader-header-value))
6336 (string-match "<[^>]+>" in-reply-to))
6338 (setq ref (substring in-reply-to (match-beginning 0)
6340 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6341 (setq ref2 (substring in-reply-to (match-beginning 0)
6343 (when (> (length ref2) (length ref))
6350 (if (search-forward "\nchars: " nil t)
6351 (if (numberp (setq chars (ignore-errors (read cur))))
6357 (if (search-forward "\nlines: " nil t)
6358 (if (numberp (setq lines (ignore-errors (read cur))))
6364 (and (search-forward "\nxref:" nil t)
6365 (nnheader-header-value)))
6367 (when gnus-extra-headers
6368 (let ((extra gnus-extra-headers)
6372 (when (search-forward
6373 (concat "\n" (symbol-name (car extra)) ":") nil t)
6374 (push (cons (car extra) (nnheader-header-value))
6378 (when (equal id ref)
6381 (when gnus-alter-header-function
6382 (funcall gnus-alter-header-function header)
6383 (setq id (mail-header-id header)
6384 ref (gnus-parent-id (mail-header-references header))))
6387 (gnus-dependencies-add-header
6388 header dependencies force-new))
6389 (push header headers))
6390 (goto-char (point-max))
6392 (nreverse headers)))))
6394 ;; Goes through the xover lines and returns a list of vectors
6395 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6396 force-new dependencies
6397 group also-fetch-heads)
6398 "Parse the news overview data in the server buffer.
6399 Return a list of headers that match SEQUENCE (see
6400 `nntp-retrieve-headers')."
6401 ;; Get the Xref when the users reads the articles since most/some
6402 ;; NNTP servers do not include Xrefs when using XOVER.
6403 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6404 (let ((mail-parse-charset gnus-newsgroup-charset)
6405 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6406 (cur nntp-server-buffer)
6407 (dependencies (or dependencies gnus-newsgroup-dependencies))
6409 ((eq gnus-read-all-available-headers t)
6411 ((and (stringp gnus-read-all-available-headers)
6413 (string-match gnus-read-all-available-headers group))
6416 number headers header)
6417 (with-current-buffer nntp-server-buffer
6418 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6419 ;; Allow the user to mangle the headers before parsing them.
6420 (gnus-run-hooks 'gnus-parse-headers-hook)
6421 (goto-char (point-min))
6422 (gnus-parse-without-error
6423 (while (and (or sequence allp)
6425 (setq number (read cur))
6427 (while (and sequence
6428 (< (car sequence) number))
6429 (setq sequence (cdr sequence))))
6432 (eq number (car sequence))))
6434 (setq sequence (cdr sequence))
6435 (setq header (inline
6436 (gnus-nov-parse-line
6437 number dependencies force-new)))))
6438 (push header headers))
6440 ;; A common bug in inn is that if you have posted an article and
6441 ;; then retrieves the active file, it will answer correctly --
6442 ;; the new article is included. However, a NOV entry for the
6443 ;; article may not have been generated yet, so this may fail.
6444 ;; We work around this problem by retrieving the last few
6445 ;; headers using HEAD.
6446 (if (or (not also-fetch-heads)
6448 ;; We (probably) got all the headers.
6450 (let ((gnus-nov-is-evil t))
6453 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6454 (gnus-get-newsgroup-headers))))))))
6456 (defun gnus-article-get-xrefs ()
6457 "Fill in the Xref value in `gnus-current-headers', if necessary.
6458 This is meant to be called in `gnus-article-internal-prepare-hook'."
6459 (let ((headers (with-current-buffer gnus-summary-buffer
6460 gnus-current-headers)))
6461 (or (not gnus-use-cross-reference)
6463 (and (mail-header-xref headers)
6464 (not (string= (mail-header-xref headers) "")))
6465 (let ((case-fold-search t)
6468 (nnheader-narrow-to-headers)
6469 (goto-char (point-min))
6470 (when (or (and (not (eobp))
6471 (eq (downcase (char-after)) ?x)
6472 (looking-at "Xref:"))
6473 (search-forward "\nXref:" nil t))
6474 (goto-char (1+ (match-end 0)))
6475 (setq xref (buffer-substring (point) (point-at-eol)))
6476 (mail-header-set-xref headers xref)))))))
6478 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6479 "Find article ID and insert the summary line for that article.
6480 OLD-HEADER can either be a header or a line number to insert
6481 the subject line on."
6482 (let* ((line (and (numberp old-header) old-header))
6483 (old-header (and (vectorp old-header) old-header))
6484 (header (cond ((and old-header use-old-header)
6487 (gnus-number-to-header id))
6488 (gnus-number-to-header id))
6490 (gnus-read-header id))))
6491 (number (and (numberp id) id))
6494 ;; Rebuild the thread that this article is part of and go to the
6495 ;; article we have fetched.
6496 (when (and (not gnus-show-threads)
6499 (setq d (gnus-data-find (mail-header-number old-header))))
6500 (goto-char (gnus-data-pos d))
6506 (gnus-delete-line))))))
6507 ;; Remove list identifiers from subject.
6508 (when gnus-list-identifiers
6509 (let ((gnus-newsgroup-headers (list header)))
6510 (gnus-summary-remove-list-identifiers)))
6512 (mail-header-set-number header (mail-header-number old-header)))
6513 (setq gnus-newsgroup-sparse
6514 (delq (setq number (mail-header-number header))
6515 gnus-newsgroup-sparse))
6516 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6517 (push number gnus-newsgroup-limit)
6518 (gnus-rebuild-thread (mail-header-id header) line)
6519 (gnus-summary-goto-subject number nil t))
6520 (when (and (numberp number)
6522 ;; We have to update the boundaries even if we can't fetch the
6523 ;; article if ID is a number -- so that the next `P' or `N'
6524 ;; command will fetch the previous (or next) article even
6525 ;; if the one we tried to fetch this time has been canceled.
6526 (when (> number gnus-newsgroup-end)
6527 (setq gnus-newsgroup-end number))
6528 (when (< number gnus-newsgroup-begin)
6529 (setq gnus-newsgroup-begin number))
6530 (setq gnus-newsgroup-unselected
6531 (delq number gnus-newsgroup-unselected)))
6532 ;; Report back a success?
6533 (and header (mail-header-number header))))
6535 ;;; Process/prefix in the summary buffer
6537 (defun gnus-summary-work-articles (n)
6538 "Return a list of articles to be worked upon.
6539 The prefix argument, the list of process marked articles, and the
6540 current article will be taken into consideration."
6541 (with-current-buffer gnus-summary-buffer
6544 ;; A numerical prefix has been given.
6545 (setq n (prefix-numeric-value n))
6546 (let ((backward (< n 0))
6547 (n (abs (prefix-numeric-value n)))
6552 (push (setq article (gnus-summary-article-number))
6555 (gnus-summary-find-prev nil article)
6556 (gnus-summary-find-next nil article)))
6558 (nreverse articles)))
6559 ((and (gnus-region-active-p) (mark))
6560 (message "region active")
6561 ;; Work on the region between point and mark.
6562 (let ((max (max (point) (mark)))
6565 (goto-char (min (point) (mark)))
6568 (push (setq article (gnus-summary-article-number)) articles)
6569 (gnus-summary-find-next nil article)
6571 (nreverse articles))))
6572 (gnus-newsgroup-processable
6573 ;; There are process-marked articles present.
6574 ;; Save current state.
6575 (gnus-summary-save-process-mark)
6577 (reverse gnus-newsgroup-processable))
6579 ;; Just return the current article.
6580 (list (gnus-summary-article-number))))))
6582 (defmacro gnus-summary-iterate (arg &rest forms)
6583 "Iterate over the process/prefixed articles and do FORMS.
6584 ARG is the interactive prefix given to the command. FORMS will be
6585 executed with point over the summary line of the articles."
6586 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6587 `(let ((,articles (gnus-summary-work-articles ,arg)))
6589 (gnus-summary-goto-subject (car ,articles))
6593 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6594 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6596 (defun gnus-summary-save-process-mark ()
6597 "Push the current set of process marked articles on the stack."
6599 (push (copy-sequence gnus-newsgroup-processable)
6600 gnus-newsgroup-process-stack))
6602 (defun gnus-summary-kill-process-mark ()
6603 "Push the current set of process marked articles on the stack and unmark."
6605 (gnus-summary-save-process-mark)
6606 (gnus-summary-unmark-all-processable))
6608 (defun gnus-summary-yank-process-mark ()
6609 "Pop the last process mark state off the stack and restore it."
6611 (unless gnus-newsgroup-process-stack
6612 (error "Empty mark stack"))
6613 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6615 (defun gnus-summary-process-mark-set (set)
6616 "Make SET into the current process marked articles."
6617 (gnus-summary-unmark-all-processable)
6618 (mapc 'gnus-summary-set-process-mark set))
6620 ;;; Searching and stuff
6622 (defun gnus-summary-search-group (&optional backward use-level)
6623 "Search for next unread newsgroup.
6624 If optional argument BACKWARD is non-nil, search backward instead."
6625 (with-current-buffer gnus-group-buffer
6626 (when (gnus-group-search-forward
6627 backward nil (if use-level (gnus-group-group-level) nil))
6628 (gnus-group-group-name))))
6630 (defun gnus-summary-best-group (&optional exclude-group)
6631 "Find the name of the best unread group.
6632 If EXCLUDE-GROUP, do not go to this group."
6633 (with-current-buffer gnus-group-buffer
6635 (gnus-group-best-unread-group exclude-group))))
6637 (defun gnus-summary-find-next (&optional unread article backward)
6639 (gnus-summary-find-prev unread article)
6640 (let* ((dummy (gnus-summary-article-intangible-p))
6641 (article (or article (gnus-summary-article-number)))
6642 (data (gnus-data-find-list article))
6644 (when (and (not dummy)
6645 (or (not gnus-summary-check-current)
6647 (not (gnus-data-unread-p (car data)))))
6648 (setq data (cdr data)))
6653 (unless (memq (gnus-data-number (car data))
6655 ((eq gnus-auto-goto-ignores
6656 'always-undownloaded)
6657 gnus-newsgroup-undownloaded)
6660 ((eq gnus-auto-goto-ignores
6662 gnus-newsgroup-unfetched)
6663 ((eq gnus-auto-goto-ignores
6665 gnus-newsgroup-undownloaded)))
6666 (when (gnus-data-unread-p (car data))
6667 (setq result (car data)
6669 (setq data (cdr data)))
6672 (goto-char (gnus-data-pos result))
6673 (gnus-data-number result)))))
6675 (defun gnus-summary-find-prev (&optional unread article)
6676 (let* ((eobp (eobp))
6677 (article (or article (gnus-summary-article-number)))
6678 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6680 (when (and (not eobp)
6681 (or (not gnus-summary-check-current)
6683 (not (gnus-data-unread-p (car data)))))
6684 (setq data (cdr data)))
6689 (unless (memq (gnus-data-number (car data))
6691 ((eq gnus-auto-goto-ignores
6692 'always-undownloaded)
6693 gnus-newsgroup-undownloaded)
6696 ((eq gnus-auto-goto-ignores
6698 gnus-newsgroup-unfetched)
6699 ((eq gnus-auto-goto-ignores
6701 gnus-newsgroup-undownloaded)))
6702 (when (gnus-data-unread-p (car data))
6703 (setq result (car data)
6705 (setq data (cdr data)))
6708 (goto-char (gnus-data-pos result))
6709 (gnus-data-number result))))
6711 (defun gnus-summary-find-subject (subject &optional unread backward article)
6712 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6713 (article (or article (gnus-summary-article-number)))
6714 (articles (gnus-data-list backward))
6715 (arts (gnus-data-find-list article articles))
6717 (when (or (not gnus-summary-check-current)
6719 (not (gnus-data-unread-p (car arts))))
6720 (setq arts (cdr arts)))
6722 (and (or (not unread)
6723 (gnus-data-unread-p (car arts)))
6724 (vectorp (gnus-data-header (car arts)))
6726 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6727 (setq result (car arts)
6729 (setq arts (cdr arts)))
6731 (goto-char (gnus-data-pos result))
6732 (gnus-data-number result))))
6734 (defun gnus-summary-search-forward (&optional unread subject backward)
6735 "Search forward for an article.
6736 If UNREAD, look for unread articles. If SUBJECT, look for
6737 articles with that subject. If BACKWARD, search backward instead."
6738 (cond (subject (gnus-summary-find-subject subject unread backward))
6739 (backward (gnus-summary-find-prev unread))
6740 (t (gnus-summary-find-next unread))))
6742 (defun gnus-recenter (&optional n)
6743 "Center point in window and redisplay frame.
6744 Also do horizontal recentering."
6746 (when (and gnus-auto-center-summary
6747 (not (eq gnus-auto-center-summary 'vertical)))
6748 (gnus-horizontal-recenter))
6749 (if (fboundp 'recenter-top-bottom)
6750 (recenter-top-bottom n)
6753 (put 'gnus-recenter 'isearch-scroll t)
6755 (defun gnus-forward-line-ignore-invisible (n)
6756 "Move N lines forward (backward if N is negative).
6757 Like forward-line, but skip over (and don't count) invisible lines."
6759 (while (and (> n 0) (not done))
6760 ;; If the following character is currently invisible,
6761 ;; skip all characters with that same `invisible' property value.
6762 (while (gnus-invisible-p (point))
6763 (goto-char (gnus-next-char-property-change (point))))
6768 (while (and (< n 0) (not done))
6770 (if (bobp) (setq done t)
6772 (while (and (not (bobp)) (gnus-invisible-p (1- (point))))
6773 (goto-char (gnus-previous-char-property-change (point))))))))
6775 (defun gnus-summary-recenter ()
6776 "Center point in the summary window.
6777 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6778 displayed, no centering will be performed."
6779 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6780 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6782 ;; The user has to want it.
6783 (when gnus-auto-center-summary
6784 (let* ((top (cond ((< (window-height) 4) 0)
6785 ((< (window-height) 7) 1)
6786 (t (if (numberp gnus-auto-center-summary)
6787 gnus-auto-center-summary
6788 (/ (1- (window-height)) 2)))))
6789 (height (1- (window-height)))
6790 (bottom (save-excursion
6791 (goto-char (point-max))
6792 (gnus-forward-line-ignore-invisible (- height))
6794 (window (get-buffer-window (current-buffer))))
6795 (when (get-buffer-window gnus-article-buffer)
6796 ;; Only do recentering when the article buffer is displayed,
6797 ;; Set the window start to either `bottom', which is the biggest
6798 ;; possible valid number, or the second line from the top,
6799 ;; whichever is the least.
6800 (let ((top-pos (save-excursion
6801 (gnus-forward-line-ignore-invisible (- top))
6803 (if (> bottom top-pos)
6804 ;; Keep the second line from the top visible
6805 (set-window-start window top-pos)
6806 ;; Try to keep the bottom line visible; if it's partially
6807 ;; obscured, either scroll one more line to make it fully
6808 ;; visible, or revert to using TOP-POS.
6810 (goto-char (point-max))
6811 (gnus-forward-line-ignore-invisible -1)
6812 (let ((last-line-start (point)))
6814 (set-window-start window (point) t)
6815 (when (not (pos-visible-in-window-p last-line-start window))
6816 (gnus-forward-line-ignore-invisible 1)
6817 (set-window-start window (min (point) top-pos) t)))))))
6818 ;; Do horizontal recentering while we're at it.
6819 (when (and (get-buffer-window (current-buffer) t)
6820 (not (eq gnus-auto-center-summary 'vertical)))
6821 (let ((selected (selected-window)))
6822 (select-window (get-buffer-window (current-buffer) t))
6823 (gnus-summary-position-point)
6824 (gnus-horizontal-recenter)
6825 (select-window selected))))))
6827 (defun gnus-summary-jump-to-group (newsgroup)
6828 "Move point to NEWSGROUP in group mode buffer."
6829 ;; Keep update point of group mode buffer if visible.
6830 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6831 (save-window-excursion
6832 ;; Take care of tree window mode.
6833 (when (get-buffer-window gnus-group-buffer)
6834 (pop-to-buffer gnus-group-buffer))
6835 (gnus-group-jump-to-group newsgroup))
6837 ;; Take care of tree window mode.
6838 (if (get-buffer-window gnus-group-buffer 0)
6839 (pop-to-buffer gnus-group-buffer)
6840 (set-buffer gnus-group-buffer))
6841 (gnus-group-jump-to-group newsgroup))))
6843 ;; This function returns a list of article numbers based on the
6844 ;; difference between the ranges of read articles in this group and
6845 ;; the range of active articles.
6846 (defun gnus-list-of-unread-articles (group)
6847 (let* ((read (gnus-info-read (gnus-get-info group)))
6848 (active (or (gnus-active group) (gnus-activate-group group)))
6849 (last (or (cdr active)
6850 (error "Group %s couldn't be activated " group)))
6851 (bottom (if gnus-newsgroup-maximum-articles
6853 (- last gnus-newsgroup-maximum-articles -1))
6856 ;; If none are read, then all are unread.
6859 ;; If the range of read articles is a single range, then the
6860 ;; first unread article is the article after the last read
6861 ;; article. Sounds logical, doesn't it?
6862 (if (and (not (listp (cdr read)))
6863 (or (< (car read) bottom)
6864 (progn (setq read (list read))
6866 (setq first (max bottom (1+ (cdr read))))
6867 ;; `read' is a list of ranges.
6868 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6871 (setq first bottom))
6874 (while (< first nlast)
6875 (setq unread (cons first unread)
6877 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6878 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6879 (setq read (cdr read)))))
6880 ;; And add the last unread articles.
6881 (while (<= first last)
6882 (setq unread (cons first unread)
6884 ;; Return the list of unread articles.
6885 (delq 0 (nreverse unread))))
6887 (defun gnus-list-of-read-articles (group)
6888 "Return a list of unread, unticked and non-dormant articles."
6889 (let* ((info (gnus-get-info group))
6890 (marked (gnus-info-marks info))
6891 (active (gnus-active group)))
6893 (gnus-list-range-difference
6894 (gnus-list-range-difference
6895 (gnus-sorted-complement
6896 (gnus-uncompress-range
6897 (if gnus-newsgroup-maximum-articles
6898 (cons (max (car active)
6900 gnus-newsgroup-maximum-articles
6904 (gnus-list-of-unread-articles group))
6905 (cdr (assq 'dormant marked)))
6906 (cdr (assq 'tick marked))))))
6908 ;; This function returns a sequence of article numbers based on the
6909 ;; difference between the ranges of read articles in this group and
6910 ;; the range of active articles.
6911 (defun gnus-sequence-of-unread-articles (group)
6912 (let* ((read (gnus-info-read (gnus-get-info group)))
6913 (active (or (gnus-active group) (gnus-activate-group group)))
6915 (bottom (if gnus-newsgroup-maximum-articles
6917 (- last gnus-newsgroup-maximum-articles -1))
6920 ;; If none are read, then all are unread.
6923 ;; If the range of read articles is a single range, then the
6924 ;; first unread article is the article after the last read
6925 ;; article. Sounds logical, doesn't it?
6926 (if (and (not (listp (cdr read)))
6927 (or (< (car read) bottom)
6928 (progn (setq read (list read))
6930 (setq first (max bottom (1+ (cdr read))))
6931 ;; `read' is a list of ranges.
6932 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6935 (setq first bottom))
6938 (push (cons first nlast) unread))
6939 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6940 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6941 (setq read (cdr read)))))
6942 ;; And add the last unread articles.
6943 (cond ((not (and first last))
6946 (push (cons first last) unread))
6948 (push first unread)))
6949 ;; Return the sequence of unread articles.
6950 (delq 0 (nreverse unread))))
6952 ;; Various summary commands
6954 (defun gnus-summary-select-article-buffer ()
6955 "Reconfigure windows to show the article buffer.
6956 If `gnus-widen-article-buffer' is set, show only the article
6959 (if (not (gnus-buffer-live-p gnus-article-buffer))
6960 (error "There is no article buffer for this summary buffer")
6961 (unless (get-buffer-window gnus-article-buffer)
6962 (gnus-summary-show-article))
6963 (gnus-configure-windows
6964 (if gnus-widen-article-window
6968 (select-window (get-buffer-window gnus-article-buffer))))
6970 (defun gnus-summary-universal-argument (arg)
6971 "Perform any operation on all articles that are process/prefixed."
6973 (let ((articles (gnus-summary-work-articles arg))
6980 (substitute-command-keys
6981 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6983 (gnus-error 1 "Undefined key")
6986 (gnus-summary-goto-subject (setq article (pop articles)))
6987 (let (gnus-newsgroup-processable)
6988 (command-execute func))
6989 (gnus-summary-remove-process-mark article)))))
6990 (gnus-summary-position-point))
6992 (defun gnus-summary-toggle-truncation (&optional arg)
6993 "Toggle truncation of summary lines.
6994 With ARG, turn line truncation on if ARG is positive."
6996 (setq truncate-lines
6997 (if (null arg) (not truncate-lines)
6998 (> (prefix-numeric-value arg) 0)))
7001 (defun gnus-summary-find-for-reselect ()
7002 "Return the number of an article to stay on across a reselect.
7003 The current article is considered, then following articles, then previous
7004 articles. An article is sought which is not cancelled and isn't a temporary
7005 insertion from another group. If there's no such then return a dummy 0."
7007 (dolist (rev '(nil t))
7008 (unless found ; don't demand the reverse list if we don't need it
7009 (let ((data (gnus-data-find-list
7010 (gnus-summary-article-number) (gnus-data-list rev))))
7011 (while (and data (not found))
7012 (if (and (< 0 (gnus-data-number (car data)))
7013 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
7014 (setq found (gnus-data-number (car data))))
7015 (setq data (cdr data))))))
7018 (defun gnus-summary-reselect-current-group (&optional all rescan)
7019 "Exit and then reselect the current newsgroup.
7020 The prefix argument ALL means to select all articles."
7022 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
7023 (error "Ephemeral groups can't be reselected"))
7024 (let ((current-subject (gnus-summary-find-for-reselect))
7025 (group gnus-newsgroup-name))
7026 (setq gnus-newsgroup-begin nil)
7027 (gnus-summary-exit nil 'leave-hidden)
7028 ;; We have to adjust the point of group mode buffer because
7029 ;; point was moved to the next unread newsgroup by exiting.
7030 (gnus-summary-jump-to-group group)
7033 (gnus-group-get-new-news-this-group 1)))
7034 (gnus-group-read-group all t)
7035 (gnus-summary-goto-subject current-subject nil t)))
7037 (defun gnus-summary-rescan-group (&optional all)
7038 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7040 (let ((config gnus-current-window-configuration))
7041 (gnus-summary-reselect-current-group all t)
7042 (gnus-configure-windows config)
7043 (when (eq config 'article)
7044 (gnus-summary-select-article))))
7046 (defun gnus-summary-update-info (&optional non-destructive)
7048 (let ((group gnus-newsgroup-name))
7050 (when gnus-newsgroup-kill-headers
7051 (setq gnus-newsgroup-killed
7052 (gnus-compress-sequence
7054 (gnus-list-range-intersection
7055 gnus-newsgroup-unselected gnus-newsgroup-killed)
7056 gnus-newsgroup-unreads)
7058 (unless (listp (cdr gnus-newsgroup-killed))
7059 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7060 (let ((headers gnus-newsgroup-headers))
7061 ;; Set the new ranges of read articles.
7062 (with-current-buffer gnus-group-buffer
7063 (gnus-undo-force-boundary))
7064 (gnus-update-read-articles
7065 group (gnus-sorted-union
7066 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7067 ;; Set the current article marks.
7068 (let ((gnus-newsgroup-scored
7069 (if (and (not gnus-save-score)
7070 (not non-destructive))
7072 gnus-newsgroup-scored)))
7074 (gnus-update-marks)))
7075 ;; Do the cross-ref thing.
7076 (when gnus-use-cross-reference
7077 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7078 ;; Do not switch windows but change the buffer to work.
7079 (set-buffer gnus-group-buffer)
7080 (unless (gnus-ephemeral-group-p group)
7081 (gnus-group-update-group group)))))))
7083 (defun gnus-summary-save-newsrc (&optional force)
7084 "Save the current number of read/marked articles in the dribble buffer.
7085 The dribble buffer will then be saved.
7086 If FORCE (the prefix), also save the .newsrc file(s)."
7088 (gnus-summary-update-info t)
7090 (gnus-save-newsrc-file)
7091 (gnus-dribble-save)))
7093 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7095 (defun gnus-summary-exit (&optional temporary leave-hidden)
7096 "Exit reading current newsgroup, and then return to group selection mode.
7097 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7099 (gnus-set-global-variables)
7100 (when (gnus-buffer-live-p gnus-article-buffer)
7101 (with-current-buffer gnus-article-buffer
7102 (mm-destroy-parts gnus-article-mime-handles)
7103 ;; Set it to nil for safety reason.
7104 (setq gnus-article-mime-handle-alist nil)
7105 (setq gnus-article-mime-handles nil)))
7106 (gnus-kill-save-kill-buffer)
7107 (gnus-async-halt-prefetch)
7108 (let* ((group gnus-newsgroup-name)
7109 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7110 (gnus-group-is-exiting-p t)
7113 (buf (current-buffer)))
7115 ;; Do adaptive scoring, and possibly save score files.
7116 (when gnus-newsgroup-adaptive
7117 (gnus-score-adaptive))
7118 (when gnus-use-scoring
7120 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7121 (when gnus-use-cache
7122 (gnus-cache-possibly-remove-articles)
7123 (gnus-cache-save-buffers))
7124 (gnus-async-prefetch-remove-group group)
7125 (when gnus-suppress-duplicates
7126 (gnus-dup-enter-articles))
7127 (when gnus-use-trees
7128 (gnus-tree-close group))
7129 (when gnus-use-cache
7130 (gnus-cache-write-active))
7131 ;; Remove entries for this group.
7132 (nnmail-purge-split-history (gnus-group-real-name group))
7133 ;; Make all changes in this group permanent.
7135 (gnus-run-hooks 'gnus-exit-group-hook)
7136 (gnus-summary-update-info))
7137 (gnus-close-group group)
7138 ;; Make sure where we were, and go to next newsgroup.
7139 (set-buffer gnus-group-buffer)
7141 (gnus-group-jump-to-group group))
7142 (gnus-run-hooks 'gnus-summary-exit-hook)
7143 (unless (or quit-config
7144 (not gnus-summary-next-group-on-exit)
7145 ;; If this group has disappeared from the summary
7146 ;; buffer, don't skip forwards.
7147 (not (string= group (gnus-group-group-name))))
7148 (gnus-group-next-unread-group 1))
7149 (setq group-point (point))
7153 (if (not gnus-kill-summary-on-exit)
7155 (gnus-deaden-summary)
7157 (when (get-buffer gnus-article-buffer)
7158 (bury-buffer gnus-article-buffer))
7159 ;; Return to group mode buffer.
7160 (when (eq mode 'gnus-summary-mode)
7161 (gnus-kill-buffer buf)))
7163 ;; If we have several article buffers, we kill them at exit.
7164 (unless gnus-single-article-buffer
7165 (when (gnus-buffer-live-p gnus-article-buffer)
7166 (with-current-buffer gnus-article-buffer
7167 ;; Don't kill sticky article buffers
7168 (unless (eq major-mode 'gnus-sticky-article-mode)
7169 (gnus-kill-buffer gnus-article-buffer)
7170 (setq gnus-article-current nil))))
7171 (gnus-kill-buffer gnus-original-article-buffer))
7173 (setq gnus-current-select-method gnus-select-method)
7174 (set-buffer gnus-group-buffer)
7176 (gnus-handle-ephemeral-exit quit-config)
7177 (goto-char group-point)
7178 ;; If gnus-group-buffer is already displayed, make sure we also move
7179 ;; the cursor in the window that displays it.
7180 (let ((win (get-buffer-window (current-buffer) 0)))
7181 (if win (set-window-point win (point))))
7182 (unless leave-hidden
7183 (gnus-configure-windows 'group 'force)))
7184 ;; Clear the current group name.
7186 (setq gnus-newsgroup-name nil)))))
7188 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7189 (defun gnus-summary-exit-no-update (&optional no-questions)
7190 "Quit reading current newsgroup without updating read article info."
7192 (let* ((group gnus-newsgroup-name)
7193 (gnus-group-is-exiting-p t)
7194 (gnus-group-is-exiting-without-update-p t)
7195 (quit-config (gnus-group-quit-config group)))
7196 (when (or no-questions
7198 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7199 (gnus-async-halt-prefetch)
7200 (run-hooks 'gnus-summary-prepare-exit-hook)
7201 (when (gnus-buffer-live-p gnus-article-buffer)
7202 (with-current-buffer gnus-article-buffer
7203 (mm-destroy-parts gnus-article-mime-handles)
7204 ;; Set it to nil for safety reason.
7205 (setq gnus-article-mime-handle-alist nil)
7206 (setq gnus-article-mime-handles nil)))
7207 ;; If we have several article buffers, we kill them at exit.
7208 (unless gnus-single-article-buffer
7209 (gnus-kill-buffer gnus-article-buffer)
7210 (gnus-kill-buffer gnus-original-article-buffer)
7211 (setq gnus-article-current nil))
7212 (if (not gnus-kill-summary-on-exit)
7213 (gnus-deaden-summary)
7214 (gnus-close-group group)
7215 (gnus-kill-buffer gnus-summary-buffer))
7216 (unless gnus-single-article-buffer
7217 (setq gnus-article-current nil))
7218 (when gnus-use-trees
7219 (gnus-tree-close group))
7220 (gnus-async-prefetch-remove-group group)
7221 (when (get-buffer gnus-article-buffer)
7222 (bury-buffer gnus-article-buffer))
7223 ;; Return to the group buffer.
7224 (gnus-configure-windows 'group 'force)
7225 ;; Clear the current group name.
7226 (setq gnus-newsgroup-name nil)
7227 (unless (gnus-ephemeral-group-p group)
7228 (gnus-group-update-group group))
7229 (when (equal (gnus-group-group-name) group)
7230 (gnus-group-next-unread-group 1))
7232 (gnus-handle-ephemeral-exit quit-config)))))
7234 (defun gnus-handle-ephemeral-exit (quit-config)
7235 "Handle movement when leaving an ephemeral group.
7236 The state which existed when entering the ephemeral is reset."
7237 (if (not (buffer-name (car quit-config)))
7238 (gnus-configure-windows 'group 'force)
7239 (set-buffer (car quit-config))
7240 (cond ((eq major-mode 'gnus-summary-mode)
7241 (gnus-set-global-variables))
7242 ((eq major-mode 'gnus-article-mode)
7243 (save-current-buffer
7244 ;; The `gnus-summary-buffer' variable may point
7245 ;; to the old summary buffer when using a single
7247 (unless (gnus-buffer-live-p gnus-summary-buffer)
7248 (set-buffer gnus-group-buffer))
7249 (set-buffer gnus-summary-buffer)
7250 (gnus-set-global-variables))))
7251 (if (or (eq (cdr quit-config) 'article)
7252 (eq (cdr quit-config) 'pick))
7253 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7254 (gnus-configure-windows 'pick 'force)
7255 (gnus-configure-windows (cdr quit-config) 'force))
7256 (gnus-configure-windows (cdr quit-config) 'force))
7257 (when (eq major-mode 'gnus-summary-mode)
7258 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7259 next-unread-noselect))
7260 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7262 (gnus-summary-next-subject 1 nil t))
7263 ((eq gnus-auto-select-on-ephemeral-exit
7264 'next-unread-noselect)
7265 (gnus-summary-next-subject 1 t t))))
7266 ;; Hide the article buffer which displays the article different
7267 ;; from the one that the cursor points to in the summary buffer.
7268 (gnus-configure-windows 'summary 'force))
7269 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7270 (gnus-summary-next-subject 1))
7271 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7272 (gnus-summary-next-subject 1 t))))
7273 (gnus-summary-recenter)
7274 (gnus-summary-position-point))))
7278 (defvar gnus-dead-summary-mode-map
7279 (let ((map (make-keymap)))
7280 (suppress-keymap map)
7281 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7282 (dolist (key '("\C-d" "\r" "\177" [delete]))
7283 (define-key map key 'gnus-summary-wake-up-the-dead))
7284 (dolist (key '("q" "Q"))
7285 (define-key map key 'bury-buffer))
7288 (define-minor-mode gnus-dead-summary-mode
7289 "Minor mode for Gnus summary buffers."
7290 :lighter " Dead" :keymap gnus-dead-summary-mode-map
7291 (unless (derived-mode-p 'gnus-summary-mode)
7292 (setq gnus-dead-summary-mode nil)))
7294 (defun gnus-deaden-summary ()
7295 "Make the current summary buffer into a dead summary buffer."
7296 ;; Kill any previous dead summary buffer.
7297 (when (and gnus-dead-summary
7298 (buffer-name gnus-dead-summary))
7299 (with-current-buffer gnus-dead-summary
7300 (when gnus-dead-summary-mode
7301 (kill-buffer (current-buffer)))))
7302 ;; Make this the current dead summary.
7303 (setq gnus-dead-summary (current-buffer))
7304 (gnus-dead-summary-mode 1)
7305 (let ((name (buffer-name)))
7306 (when (string-match "Summary" name)
7308 (concat (substring name 0 (match-beginning 0)) "Dead "
7309 (substring name (match-beginning 0)))
7313 (defun gnus-kill-or-deaden-summary (buffer)
7314 "Kill or deaden the summary BUFFER."
7316 (when (and (buffer-name buffer)
7317 (not gnus-single-article-buffer))
7318 (with-current-buffer buffer
7319 (gnus-kill-buffer gnus-article-buffer)
7320 (gnus-kill-buffer gnus-original-article-buffer)))
7323 (gnus-kill-summary-on-exit
7324 (when (and gnus-use-trees
7325 (gnus-buffer-exists-p buffer))
7326 (with-current-buffer buffer
7327 (gnus-tree-close gnus-newsgroup-name)))
7328 (gnus-kill-buffer buffer))
7329 ;; Deaden the buffer.
7330 ((gnus-buffer-exists-p buffer)
7331 (with-current-buffer buffer
7332 (gnus-deaden-summary))))))
7334 (defun gnus-summary-wake-up-the-dead (&rest args)
7335 "Wake up the dead summary buffer."
7337 (gnus-dead-summary-mode -1)
7338 (let ((name (buffer-name)))
7339 (when (string-match "Dead " name)
7341 (concat (substring name 0 (match-beginning 0))
7342 (substring name (match-end 0)))
7344 (gnus-message 3 "This dead summary is now alive again"))
7346 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7347 (defun gnus-summary-describe-group (&optional force)
7348 "Describe the current newsgroup."
7350 (gnus-group-describe-group force gnus-newsgroup-name))
7352 (defun gnus-summary-describe-briefly ()
7353 "Describe summary mode commands briefly."
7355 (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")))
7357 ;; Walking around group mode buffer from summary mode.
7359 (defun gnus-summary-next-group (&optional no-article target-group backward)
7360 "Exit current newsgroup and then select next unread newsgroup.
7361 If prefix argument NO-ARTICLE is non-nil, no article is selected
7362 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7363 previous group instead."
7365 ;; Stop pre-fetching.
7366 (gnus-async-halt-prefetch)
7367 (let ((current-group gnus-newsgroup-name)
7368 (current-buffer (current-buffer))
7370 ;; First we semi-exit this group to update Xrefs and all variables.
7371 ;; We can't do a real exit, because the window conf must remain
7372 ;; the same in case the user is prompted for info, and we don't
7373 ;; want the window conf to change before that...
7374 (gnus-summary-exit t)
7375 (while (not entered)
7376 ;; Then we find what group we are supposed to enter.
7377 (set-buffer gnus-group-buffer)
7378 (gnus-group-jump-to-group current-group)
7381 (if (eq gnus-keep-same-level 'best)
7382 (gnus-summary-best-group gnus-newsgroup-name)
7383 (gnus-summary-search-group backward gnus-keep-same-level))))
7384 (if (not target-group)
7385 ;; There are no further groups, so we return to the group
7388 (gnus-message 5 "Returning to the group buffer")
7390 (when (gnus-buffer-live-p current-buffer)
7391 (set-buffer current-buffer)
7392 (gnus-summary-exit))
7393 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7394 ;; We try to enter the target group.
7395 (gnus-group-jump-to-group target-group)
7396 (let ((unreads (gnus-group-group-unread)))
7397 (if (and (or (eq t unreads)
7398 (and unreads (not (zerop unreads))))
7399 (gnus-summary-read-group
7400 target-group nil no-article
7401 (and (buffer-name current-buffer) current-buffer)
7404 (setq current-group target-group
7405 target-group nil)))))))
7407 (defun gnus-summary-prev-group (&optional no-article)
7408 "Exit current newsgroup and then select previous unread newsgroup.
7409 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7411 (gnus-summary-next-group no-article nil t))
7413 ;; Walking around summary lines.
7415 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7416 "Go to the first subject satisfying any non-nil constraint.
7417 If UNREAD is non-nil, the article should be unread.
7418 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7419 If UNSEEN is non-nil, the article should be unseen as well as unread.
7420 Returns the article selected or nil if there are no matching articles."
7424 ((null gnus-newsgroup-data)
7425 (gnus-message 3 "No articles in the group")
7427 ;; Pick the first article.
7428 ((not (or unread undownloaded unseen))
7429 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7430 (gnus-data-number (car gnus-newsgroup-data)))
7431 ;; Find the first unread article.
7433 (let ((data gnus-newsgroup-data))
7435 (let ((num (gnus-data-number (car data))))
7436 (or (memq num gnus-newsgroup-unfetched)
7437 (not (or (and unread
7438 (memq num gnus-newsgroup-unreads))
7440 (memq num gnus-newsgroup-undownloaded))
7442 (memq num gnus-newsgroup-unseen)
7443 (memq num gnus-newsgroup-unreads)))))))
7444 (setq data (cdr data)))
7448 (goto-char (gnus-data-pos (car data)))
7449 (gnus-data-number (car data)))
7450 (gnus-message 3 "No more%s articles"
7451 (let* ((r (when unread " unread"))
7452 (d (when undownloaded " undownloaded"))
7453 (s (when unseen " unseen"))
7454 (l (delq nil (list r d s))))
7455 (cond ((= 3 (length l))
7456 (concat r "," d ", or" s))
7458 (concat (car l) ", or" (cadr l)))
7465 (gnus-summary-position-point))))))
7467 (defun gnus-summary-next-subject (n &optional unread dont-display)
7468 "Go to next N'th summary line.
7469 If N is negative, go to the previous N'th subject line.
7470 If UNREAD is non-nil, only unread articles are selected.
7471 The difference between N and the actual number of steps taken is
7474 (let ((backward (< n 0))
7478 (gnus-summary-find-prev unread)
7479 (gnus-summary-find-next unread)))
7480 (unless (zerop (setq n (1- n)))
7481 (gnus-summary-show-thread)))
7483 (gnus-message 7 "No more%s articles"
7484 (if unread " unread" "")))
7485 (unless dont-display
7486 (gnus-summary-recenter)
7487 (gnus-summary-position-point))
7490 (defun gnus-summary-next-unread-subject (n)
7491 "Go to next N'th unread summary line."
7493 (gnus-summary-next-subject n t))
7495 (defun gnus-summary-prev-subject (n &optional unread)
7496 "Go to previous N'th summary line.
7497 If optional argument UNREAD is non-nil, only unread article is selected."
7499 (gnus-summary-next-subject (- n) unread))
7501 (defun gnus-summary-prev-unread-subject (n)
7502 "Go to previous N'th unread summary line."
7504 (gnus-summary-next-subject (- n) t))
7506 (defun gnus-summary-goto-subjects (articles)
7507 "Insert the subject header for ARTICLES in the current buffer."
7509 (dolist (article articles)
7510 (gnus-summary-goto-subject article t)))
7511 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7512 (gnus-summary-position-point))
7514 (defun gnus-summary-goto-subject (article &optional force silent)
7515 "Go to the subject line of ARTICLE.
7516 If FORCE, also allow jumping to articles not currently shown."
7517 (interactive "nArticle number: ")
7518 (unless (numberp article)
7519 (error "Article %s is not a number" article))
7521 (data (gnus-data-find article)))
7522 ;; We read in the article if we have to.
7525 (gnus-summary-insert-subject
7527 (if (or (numberp force) (vectorp force)) force)
7529 (setq data (gnus-data-find article)))
7534 (gnus-message 3 "Can't find article %d" article))
7536 (let ((pt (gnus-data-pos data)))
7538 (gnus-summary-set-article-display-arrow pt))
7539 (gnus-summary-position-point)
7542 ;; Walking around summary lines with displaying articles.
7544 (defun gnus-summary-expand-window (&optional arg)
7545 "Make the summary buffer take up the entire Emacs frame.
7546 Given a prefix, will force an `article' buffer configuration."
7549 (gnus-configure-windows 'article 'force)
7550 (gnus-configure-windows 'summary 'force)))
7552 (defun gnus-summary-display-article (article &optional all-header)
7553 "Display ARTICLE in article buffer."
7554 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7555 (with-current-buffer gnus-article-buffer
7556 (eq major-mode 'gnus-article-mode)))
7557 (gnus-article-setup-buffer))
7558 (gnus-set-global-variables)
7559 (with-current-buffer gnus-article-buffer
7560 (setq gnus-article-charset gnus-newsgroup-charset)
7561 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7562 (mm-enable-multibyte))
7566 (if gnus-summary-display-article-function
7567 (funcall gnus-summary-display-article-function article all-header)
7568 (gnus-article-prepare article all-header))
7569 (gnus-run-hooks 'gnus-select-article-hook)
7570 (when (and gnus-current-article
7571 (not (zerop gnus-current-article)))
7572 (gnus-summary-goto-subject gnus-current-article))
7573 (gnus-summary-recenter)
7574 (when (and gnus-use-trees gnus-show-threads)
7575 (gnus-possibly-generate-tree article)
7576 (gnus-highlight-selected-tree article))
7577 ;; Successfully display article.
7578 (gnus-article-set-window-start
7579 (cdr (assq article gnus-newsgroup-bookmarks))))))
7581 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7582 "Select the current article.
7583 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7584 non-nil, the article will be re-fetched even if it already present in
7585 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7587 ;; Make sure we are in the summary buffer to work around bbdb bug.
7588 (unless (eq major-mode 'gnus-summary-mode)
7589 (set-buffer gnus-summary-buffer))
7590 (let ((article (or article (gnus-summary-article-number)))
7591 (all-headers (not (not all-headers))) ;Must be t or nil.
7592 gnus-summary-display-article-function)
7594 (gnus-summary-article-pseudo-p article)
7595 (error "This is a pseudo-article"))
7596 (with-current-buffer gnus-summary-buffer
7597 (if (or (and gnus-single-article-buffer
7598 (or (null gnus-current-article)
7599 (null gnus-article-current)
7600 (null (get-buffer gnus-article-buffer))
7601 (not (eq article (cdr gnus-article-current)))
7602 (not (equal (car gnus-article-current)
7603 gnus-newsgroup-name))
7604 (not (get-buffer gnus-original-article-buffer))))
7605 (and (not gnus-single-article-buffer)
7606 (or (null gnus-current-article)
7607 (not (get-buffer gnus-original-article-buffer))
7608 (not (eq gnus-current-article article))))
7610 ;; The requested article is different from the current article.
7612 (gnus-summary-display-article article all-headers)
7613 (when (gnus-buffer-live-p gnus-article-buffer)
7614 (with-current-buffer gnus-article-buffer
7615 (if (not gnus-article-decoded-p) ;; a local variable
7616 (mm-disable-multibyte))))
7617 (gnus-article-set-window-start
7618 (cdr (assq article gnus-newsgroup-bookmarks)))
7622 (defun gnus-summary-force-verify-and-decrypt ()
7623 "Display buttons for signed/encrypted parts and verify/decrypt them."
7625 (let ((mm-verify-option 'known)
7626 (mm-decrypt-option 'known)
7627 (gnus-article-emulate-mime t)
7628 (gnus-buttonized-mime-types (append (list "multipart/signed"
7629 "multipart/encrypted")
7630 gnus-buttonized-mime-types)))
7631 (gnus-summary-select-article nil 'force)))
7633 (defun gnus-summary-set-current-mark (&optional current-mark)
7634 "Obsolete function."
7637 (defun gnus-summary-next-article (&optional unread subject backward push)
7638 "Select the next article.
7639 If UNREAD, only unread articles are selected.
7640 If SUBJECT, only articles with SUBJECT are selected.
7641 If BACKWARD, the previous article is selected instead of the next."
7643 ;; Make sure we are in the summary buffer.
7644 (unless (eq major-mode 'gnus-summary-mode)
7645 (set-buffer gnus-summary-buffer))
7647 ;; Is there such an article?
7648 ((and (gnus-summary-search-forward unread subject backward)
7649 (or (gnus-summary-display-article (gnus-summary-article-number))
7650 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7651 (gnus-summary-position-point))
7652 ;; If not, we try the first unread, if that is wanted.
7654 gnus-auto-select-same
7655 (gnus-summary-first-unread-article))
7656 (gnus-summary-position-point)
7657 (gnus-message 6 "Wrapped"))
7658 ;; Try to get next/previous article not displayed in this group.
7659 ((and gnus-auto-extend-newsgroup
7660 (not unread) (not subject))
7661 (gnus-summary-goto-article
7662 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7663 nil (count-lines (point-min) (point))))
7664 ;; Go to next/previous group.
7666 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7667 (gnus-summary-jump-to-group gnus-newsgroup-name))
7668 (let ((cmd (if (featurep 'xemacs)
7670 last-command-event))
7672 (with-current-buffer gnus-group-buffer
7675 (if (eq gnus-keep-same-level 'best)
7676 (gnus-summary-best-group gnus-newsgroup-name)
7677 (gnus-summary-search-group backward gnus-keep-same-level))))
7678 ;; For some reason, the group window gets selected. We change
7680 (select-window (get-buffer-window (current-buffer)))
7681 ;; Select next unread newsgroup automagically.
7683 ((or (not gnus-auto-select-next)
7685 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7686 ((or (eq gnus-auto-select-next 'quietly)
7687 (and (eq gnus-auto-select-next 'slightly-quietly)
7689 (and (eq gnus-auto-select-next 'almost-quietly)
7690 (gnus-summary-last-article-p)))
7692 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7694 (gnus-message 7 "No more%s articles (%s)..."
7695 (if unread " unread" "")
7696 (if group (concat "selecting " group)
7698 (gnus-summary-next-group nil group backward)))
7700 (when (gnus-key-press-event-p last-input-event)
7701 (gnus-summary-walk-group-buffer
7702 gnus-newsgroup-name cmd unread backward point))))))))
7704 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7705 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7706 (?\C-p (gnus-group-prev-unread-group 1))))
7707 (cursor-in-echo-area t)
7708 keve key group ended prompt)
7709 (with-current-buffer gnus-group-buffer
7712 (if (eq gnus-keep-same-level 'best)
7713 (gnus-summary-best-group gnus-newsgroup-name)
7714 (gnus-summary-search-group backward gnus-keep-same-level))))
7718 "No more%s articles%s " (if unread " unread" "")
7720 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7721 (format " (Type %s for %s [%s])"
7722 (single-key-description cmd)
7723 (gnus-group-decoded-name group)
7724 (gnus-group-unread group))
7725 (format " (Type %s to exit %s)"
7726 (single-key-description cmd)
7727 (gnus-group-decoded-name gnus-newsgroup-name)))))
7728 ;; Confirm auto selection.
7729 (setq key (car (setq keve (gnus-read-event-char prompt)))
7732 ((assq key keystrokes)
7733 (let ((obuf (current-buffer)))
7734 (switch-to-buffer gnus-group-buffer)
7736 (gnus-group-jump-to-group group))
7737 (eval (cadr (assq key keystrokes)))
7738 (setq group (gnus-group-group-name))
7739 (switch-to-buffer obuf))
7743 (gnus-ephemeral-group-p gnus-newsgroup-name))
7745 (gnus-summary-next-group nil group backward)))
7747 (push (cdr keve) unread-command-events))))))
7749 (defun gnus-summary-next-unread-article ()
7750 "Select unread article after current one."
7752 (gnus-summary-next-article
7753 (or (not (eq gnus-summary-goto-unread 'never))
7754 (gnus-summary-last-article-p (gnus-summary-article-number)))
7755 (and gnus-auto-select-same
7756 (gnus-summary-article-subject))))
7758 (defun gnus-summary-prev-article (&optional unread subject)
7759 "Select the article before the current one.
7760 If UNREAD is non-nil, only unread articles are selected."
7762 (gnus-summary-next-article unread subject t))
7764 (defun gnus-summary-prev-unread-article ()
7765 "Select unread article before current one."
7767 (gnus-summary-prev-article
7768 (or (not (eq gnus-summary-goto-unread 'never))
7769 (gnus-summary-first-article-p (gnus-summary-article-number)))
7770 (and gnus-auto-select-same
7771 (gnus-summary-article-subject))))
7773 (defun gnus-summary-next-page (&optional lines circular stop)
7774 "Show next page of the selected article.
7775 If at the end of the current article, select the next article.
7776 LINES says how many lines should be scrolled up.
7778 If CIRCULAR is non-nil, go to the start of the article instead of
7779 selecting the next article when reaching the end of the current
7782 If STOP is non-nil, just stop when reaching the end of the message.
7784 Also see the variable `gnus-article-skip-boring'."
7786 (setq gnus-summary-buffer (current-buffer))
7787 (gnus-set-global-variables)
7788 (let ((article (gnus-summary-article-number))
7789 (article-window (get-buffer-window gnus-article-buffer t))
7791 ;; If the buffer is empty, we have no article.
7793 (error "No article to select"))
7794 (gnus-configure-windows 'article)
7795 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7796 (if (and (eq gnus-summary-goto-unread 'never)
7797 (not (gnus-summary-last-article-p article)))
7798 (gnus-summary-next-article)
7799 (gnus-summary-next-unread-article))
7800 (if (or (null gnus-current-article)
7801 (null gnus-article-current)
7802 (/= article (cdr gnus-article-current))
7803 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7804 ;; Selected subject is different from current article's.
7805 (gnus-summary-display-article article)
7806 (when article-window
7807 (gnus-eval-in-buffer-window gnus-article-buffer
7808 (setq endp (or (gnus-article-next-page lines)
7809 (gnus-article-only-boring-p))))
7811 (cond ((or stop gnus-summary-stop-at-end-of-message)
7812 (gnus-message 3 "End of message"))
7814 (gnus-summary-beginning-of-article))
7816 (gnus-message 3 "End of message"))
7818 (if (and (eq gnus-summary-goto-unread 'never)
7819 (not (gnus-summary-last-article-p article)))
7820 (gnus-summary-next-article)
7821 (gnus-summary-next-unread-article))))))))
7822 (gnus-summary-recenter)
7823 (gnus-summary-position-point)))
7825 (defun gnus-summary-prev-page (&optional lines move)
7826 "Show previous page of selected article.
7827 Argument LINES specifies lines to be scrolled down.
7828 If MOVE, move to the previous unread article if point is at
7829 the beginning of the buffer."
7831 (let ((article (gnus-summary-article-number))
7832 (article-window (get-buffer-window gnus-article-buffer t))
7834 (gnus-configure-windows 'article)
7835 (if (or (null gnus-current-article)
7836 (null gnus-article-current)
7837 (/= article (cdr gnus-article-current))
7838 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7839 ;; Selected subject is different from current article's.
7840 (gnus-summary-display-article article)
7841 (gnus-summary-recenter)
7842 (when article-window
7843 (gnus-eval-in-buffer-window gnus-article-buffer
7844 (setq endp (gnus-article-prev-page lines)))
7845 (when (and move endp)
7847 (gnus-message 3 "Beginning of message"))
7849 (if (and (eq gnus-summary-goto-unread 'never)
7850 (not (gnus-summary-first-article-p article)))
7851 (gnus-summary-prev-article)
7852 (gnus-summary-prev-unread-article))))))))
7853 (gnus-summary-position-point))
7855 (defun gnus-summary-prev-page-or-article (&optional lines)
7856 "Show previous page of selected article.
7857 Argument LINES specifies lines to be scrolled down.
7858 If at the beginning of the article, go to the next article."
7860 (gnus-summary-prev-page lines t))
7862 (defun gnus-summary-scroll-up (lines)
7863 "Scroll up (or down) one line current article.
7864 Argument LINES specifies lines to be scrolled up (or down if negative).
7865 If no article is selected, then the current article will be selected first."
7867 (gnus-configure-windows 'article)
7868 (gnus-summary-show-thread)
7869 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7870 (gnus-eval-in-buffer-window gnus-article-buffer
7872 (when (gnus-article-next-page lines)
7873 (gnus-message 3 "End of message")))
7875 (gnus-article-prev-page (- lines))))))
7876 (gnus-summary-recenter)
7877 (gnus-summary-position-point))
7879 (defun gnus-summary-scroll-down (lines)
7880 "Scroll down (or up) one line current article.
7881 Argument LINES specifies lines to be scrolled down (or up if negative).
7882 If no article is selected, then the current article will be selected first."
7884 (gnus-summary-scroll-up (- lines)))
7886 (defun gnus-summary-next-same-subject ()
7887 "Select next article which has the same subject as current one."
7889 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7891 (defun gnus-summary-prev-same-subject ()
7892 "Select previous article which has the same subject as current one."
7894 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7896 (defun gnus-summary-next-unread-same-subject ()
7897 "Select next unread article which has the same subject as current one."
7899 (gnus-summary-next-article t (gnus-summary-article-subject)))
7901 (defun gnus-summary-prev-unread-same-subject ()
7902 "Select previous unread article which has the same subject as current one."
7904 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7906 (defun gnus-summary-first-unread-article ()
7907 "Select the first unread article.
7908 Return nil if there are no unread articles."
7911 (when (gnus-summary-first-subject t)
7912 (gnus-summary-show-thread)
7913 (gnus-summary-first-subject t)
7914 (gnus-summary-display-article (gnus-summary-article-number)))
7915 (gnus-summary-position-point)))
7917 (defun gnus-summary-first-unread-subject ()
7918 "Place the point on the subject line of the first unread article.
7919 Return nil if there are no unread articles."
7922 (when (gnus-summary-first-subject t)
7923 (gnus-summary-show-thread)
7924 (gnus-summary-first-subject t))
7925 (gnus-summary-position-point)))
7927 (defun gnus-summary-first-unseen-subject ()
7928 "Place the point on the subject line of the first unseen article.
7929 Return nil if there are no unseen articles."
7932 (when (gnus-summary-first-subject nil nil t)
7933 (gnus-summary-show-thread)
7934 (gnus-summary-first-subject nil nil t))
7935 (gnus-summary-position-point)))
7937 (defun gnus-summary-first-unseen-or-unread-subject ()
7938 "Place the point on the subject line of the first unseen and unread article.
7939 If all article have been seen, on the subject line of the first unread
7943 (unless (when (gnus-summary-first-subject nil nil t)
7944 (gnus-summary-show-thread)
7945 (gnus-summary-first-subject nil nil t))
7946 (when (gnus-summary-first-subject t)
7947 (gnus-summary-show-thread)
7948 (gnus-summary-first-subject t)))
7949 (gnus-summary-position-point)))
7951 (defun gnus-summary-first-article ()
7952 "Select the first article.
7953 Return nil if there are no articles."
7956 (when (gnus-summary-first-subject)
7957 (gnus-summary-show-thread)
7958 (gnus-summary-first-subject)
7959 (gnus-summary-display-article (gnus-summary-article-number)))
7960 (gnus-summary-position-point)))
7962 (defun gnus-summary-best-unread-article (&optional arg)
7963 "Select the unread article with the highest score.
7964 If given a prefix argument, select the next unread article that has a
7965 score higher than the default score."
7967 (let ((article (if arg
7968 (gnus-summary-better-unread-subject)
7969 (gnus-summary-best-unread-subject))))
7971 (gnus-summary-goto-article article)
7972 (error "No unread articles"))))
7974 (defun gnus-summary-best-unread-subject ()
7975 "Select the unread subject with the highest score."
7977 (let ((best -1000000)
7978 (data gnus-newsgroup-data)
7981 (and (gnus-data-unread-p (car data))
7983 (gnus-summary-article-score (gnus-data-number (car data))))
7986 article (gnus-data-number (car data))))
7987 (setq data (cdr data)))
7989 (gnus-summary-goto-subject article))
7990 (gnus-summary-position-point)
7993 (defun gnus-summary-better-unread-subject ()
7994 "Select the first unread subject that has a score over the default score."
7996 (let ((data gnus-newsgroup-data)
7998 (while (and (setq article (gnus-data-number (car data)))
7999 (or (gnus-data-read-p (car data))
8000 (not (> (gnus-summary-article-score article)
8001 gnus-summary-default-score))))
8002 (setq data (cdr data)))
8004 (gnus-summary-goto-subject article))
8005 (gnus-summary-position-point)
8008 (defun gnus-summary-last-subject ()
8009 "Go to the last displayed subject line in the group."
8010 (let ((article (gnus-data-number (car (gnus-data-list t)))))
8012 (gnus-summary-goto-subject article))))
8014 (defun gnus-summary-goto-article (article &optional all-headers force)
8015 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
8016 If ALL-HEADERS is non-nil, no header lines are hidden.
8017 If FORCE, go to the article even if it isn't displayed. If FORCE
8018 is a number, it is the line the article is to be displayed on."
8021 (gnus-completing-read
8022 "Article number or Message-ID"
8023 (mapcar 'int-to-string gnus-newsgroup-limit))
8027 (if (and (stringp article)
8028 (string-match "@\\|%40" article))
8029 (gnus-summary-refer-article article)
8030 (when (stringp article)
8031 (setq article (string-to-number article)))
8032 (if (gnus-summary-goto-subject article force)
8033 (gnus-summary-display-article article all-headers)
8034 (gnus-message 4 "Couldn't go to article %s" article) nil))
8035 (gnus-summary-position-point)))
8037 (defun gnus-summary-goto-last-article ()
8038 "Go to the previously read article."
8041 (when gnus-last-article
8042 (gnus-summary-goto-article gnus-last-article nil t))
8043 (gnus-summary-position-point)))
8045 (defun gnus-summary-pop-article (number)
8046 "Pop one article off the history and go to the previous.
8047 NUMBER articles will be popped off."
8050 (setq gnus-newsgroup-history
8051 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
8053 (gnus-summary-goto-article (car to) nil t)
8054 (error "Article history empty")))
8055 (gnus-summary-position-point))
8057 ;; Summary commands and functions for limiting the summary buffer.
8059 (defun gnus-summary-limit-to-articles (n)
8060 "Limit the summary buffer to the next N articles.
8061 If not given a prefix, use the process marked articles instead."
8064 (let ((articles (gnus-summary-work-articles n)))
8065 (setq gnus-newsgroup-processable nil)
8066 (gnus-summary-limit articles))
8067 (gnus-summary-position-point)))
8069 (defun gnus-summary-pop-limit (&optional total)
8070 "Restore the previous limit.
8071 If given a prefix, remove all limits."
8074 (setq gnus-newsgroup-limits
8075 (list (mapcar (lambda (h) (mail-header-number h))
8076 gnus-newsgroup-headers))))
8077 (unless gnus-newsgroup-limits
8078 (error "No limit to pop"))
8080 (gnus-summary-limit nil 'pop)
8081 (gnus-summary-position-point)))
8083 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
8084 "Limit the summary buffer to articles that have subjects that match a regexp.
8085 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8087 (list (read-string (if current-prefix-arg
8088 "Exclude subject (regexp): "
8089 "Limit to subject (regexp): "))
8090 nil current-prefix-arg))
8092 (setq header "subject"))
8093 (when (not (equal "" subject))
8095 (let ((articles (gnus-summary-find-matching
8096 (or header "subject") subject 'all nil nil
8099 (error "Found no matches for \"%s\"" subject))
8100 (gnus-summary-limit articles))
8101 (gnus-summary-position-point))))
8103 (defun gnus-summary-limit-to-author (from &optional not-matching)
8104 "Limit the summary buffer to articles that have authors that match a regexp.
8105 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8107 (list (read-string (if current-prefix-arg
8108 "Exclude author (regexp): "
8109 "Limit to author (regexp): "))
8110 current-prefix-arg))
8111 (gnus-summary-limit-to-subject from "from" not-matching))
8113 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
8114 "Limit the summary buffer to articles with the given RECIPIENT.
8116 If NOT-MATCHING, exclude RECIPIENT.
8118 To and Cc headers are checked. You need to include them in
8119 `nnmail-extra-headers'."
8120 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8122 (list (read-string (format "%s recipient (regexp): "
8123 (if current-prefix-arg "Exclude" "Limit to")))
8124 current-prefix-arg))
8125 (when (not (equal "" recipient))
8127 (if (memq 'To nnmail-extra-headers)
8128 (gnus-summary-find-matching
8129 (cons 'extra 'To) recipient 'all nil nil
8132 1 "`To' isn't present in `nnmail-extra-headers'")
8136 (if (memq 'Cc nnmail-extra-headers)
8137 (gnus-summary-find-matching
8138 (cons 'extra 'Cc) recipient 'all nil nil
8141 1 "`Cc' isn't present in `nnmail-extra-headers'")
8146 ;; We need the numbers that are in both lists:
8148 (and (memq a to) a))
8152 (error "Found no matches for \"%s\"" recipient))
8153 (gnus-summary-limit articles))
8154 (gnus-summary-position-point))))
8156 (defun gnus-summary-limit-to-address (address &optional not-matching)
8157 "Limit the summary buffer to articles with the given ADDRESS.
8159 If NOT-MATCHING, exclude ADDRESS.
8161 To, Cc and From headers are checked. You need to include `To' and `Cc'
8162 in `nnmail-extra-headers'."
8164 (list (read-string (format "%s address (regexp): "
8165 (if current-prefix-arg "Exclude" "Limit to")))
8166 current-prefix-arg))
8167 (when (not (equal "" address))
8169 (if (memq 'To nnmail-extra-headers)
8170 (gnus-summary-find-matching
8171 (cons 'extra 'To) address 'all nil nil
8174 1 "`To' isn't present in `nnmail-extra-headers'")
8178 (if (memq 'Cc nnmail-extra-headers)
8179 (gnus-summary-find-matching
8180 (cons 'extra 'Cc) address 'all nil nil
8183 1 "`Cc' isn't present in `nnmail-extra-headers'")
8187 (gnus-summary-find-matching "from" address
8188 'all nil nil not-matching))
8191 ;; We need the numbers that are in all lists:
8195 (mapcar (lambda (a) (car (memq a from))) to))
8197 (mapcar (lambda (a) (car (memq a from))) cc)
8198 (mapcar (lambda (a) (car (memq a from)))
8199 (mapcar (lambda (a) (car (memq a to)))
8201 (nconc (if (eq to t) nil to)
8202 (if (eq cc t) nil cc)
8205 (error "Found no matches for \"%s\"" address))
8206 (gnus-summary-limit articles))
8207 (gnus-summary-position-point))))
8209 (defun gnus-summary-limit-strange-charsets-predicate (header)
8210 (when (fboundp 'char-charset)
8211 (let ((string (concat (mail-header-subject header)
8212 (mail-header-from header)))
8214 (dotimes (i (1- (length string)))
8215 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8216 (when (string-match "unicode\\|big\\|japanese" charset)
8220 (defun gnus-summary-limit-to-predicate (predicate)
8221 "Limit to articles where PREDICATE returns non-nil.
8222 PREDICATE will be called with the header structures of the
8224 (let ((articles nil)
8225 (case-fold-search t))
8226 (dolist (header gnus-newsgroup-headers)
8227 (when (funcall predicate header)
8228 (push (mail-header-number header) articles)))
8229 (gnus-summary-limit (nreverse articles))))
8231 (defun gnus-summary-limit-to-age (age &optional younger-p)
8232 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8233 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8234 articles that are younger than AGE days."
8236 (let ((younger current-prefix-arg)
8239 (while (not days-got)
8240 (setq days (if younger
8241 (read-string "Limit to articles younger than (in days, older when negative): ")
8243 "Limit to articles older than (in days, younger when negative): ")))
8244 (when (> (length days) 0)
8245 (setq days (read days)))
8250 (setq younger (not younger))
8251 (setq days (* days -1))))
8252 (message "Please enter a number.")
8254 (list days younger)))
8256 (let ((data gnus-newsgroup-data)
8257 (cutoff (days-to-time age))
8258 articles d date is-younger)
8259 (while (setq d (pop data))
8260 (when (and (vectorp (gnus-data-header d))
8261 (setq date (mail-header-date (gnus-data-header d))))
8262 (setq is-younger (time-less-p
8263 (time-since (gnus-date-get-time date))
8268 (push (gnus-data-number d) articles))))
8269 (gnus-summary-limit (nreverse articles)))
8270 (gnus-summary-position-point)))
8272 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8273 "Limit the summary buffer to articles that match an 'extra' header."
8277 (gnus-completing-read
8278 (if current-prefix-arg
8279 "Exclude extra header"
8280 "Limit extra header")
8281 (mapcar 'symbol-name gnus-extra-headers)
8283 (symbol-name (car gnus-extra-headers))))))
8285 (read-string (format "%s header %s (regexp): "
8286 (if current-prefix-arg "Exclude" "Limit to")
8288 current-prefix-arg)))
8289 (when (not (equal "" regexp))
8291 (let ((articles (gnus-summary-find-matching
8292 (cons 'extra header) regexp 'all nil nil
8295 (error "Found no matches for \"%s\"" regexp))
8296 (gnus-summary-limit articles))
8297 (gnus-summary-position-point))))
8299 (defun gnus-summary-limit-to-display-predicate ()
8300 "Limit the summary buffer to the predicated in the `display' group parameter."
8302 (unless gnus-newsgroup-display
8303 (error "There is no `display' group parameter"))
8305 (dolist (gnus-number gnus-newsgroup-articles)
8306 (when (funcall gnus-newsgroup-display)
8307 (push gnus-number articles)))
8308 (gnus-summary-limit articles))
8309 (gnus-summary-position-point))
8311 (defun gnus-summary-limit-to-unread (&optional all)
8312 "Limit the summary buffer to articles that are not marked as read.
8313 If ALL is non-nil, limit strictly to unread articles."
8316 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8317 (gnus-summary-limit-to-marks
8318 ;; Concat all the marks that say that an article is read and have
8320 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8321 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8322 gnus-low-score-mark gnus-expirable-mark
8323 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8324 gnus-duplicate-mark)
8327 (defun gnus-summary-limit-to-headers (match &optional reverse)
8328 "Limit the summary buffer to articles that have headers that match MATCH.
8329 If REVERSE (the prefix), limit to articles that don't match."
8330 (interactive "sMatch headers (regexp): \nP")
8331 (gnus-summary-limit-to-bodies match reverse t))
8333 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8334 "Limit the summary buffer to articles that have bodies that match MATCH.
8335 If REVERSE (the prefix), limit to articles that don't match."
8336 (interactive "sMatch body (regexp): \nP")
8337 (let ((articles nil)
8338 (gnus-select-article-hook nil) ;Disable hook.
8339 (gnus-article-prepare-hook nil)
8340 (gnus-use-article-prefetch nil)
8341 (gnus-keep-backlog nil)
8342 (gnus-break-pages nil)
8343 (gnus-summary-display-arrow nil)
8344 (gnus-updated-mode-lines nil)
8345 (gnus-auto-center-summary nil)
8346 (gnus-display-mime-function nil))
8347 (dolist (data gnus-newsgroup-data)
8348 (let (gnus-mark-article-hook)
8349 (gnus-summary-select-article t t nil (gnus-data-number data)))
8350 (with-current-buffer gnus-article-buffer
8352 (let* ((case-fold-search t)
8354 (re-search-backward match nil t)
8355 (re-search-forward match nil t))))
8356 (when (or (and found
8360 (push (gnus-data-number data) articles)))))
8362 (message "No messages matched")
8363 (gnus-summary-limit articles)))
8364 (gnus-summary-position-point))
8366 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8367 "Limit the summary buffer to articles that aren't part on any thread.
8368 If THREADSP (the prefix), limit to articles that are in threads."
8370 (let ((articles nil)
8373 (dolist (thread gnus-newsgroup-threads)
8374 (if (stringp (car thread))
8375 (dolist (thread (cdr thread))
8376 (push thread threads))
8377 (push thread threads)))
8378 (dolist (thread threads)
8379 (setq thread-articles (gnus-articles-in-thread thread))
8380 (when (or (and threadsp
8381 (> (length thread-articles) 1))
8383 (= (length thread-articles) 1)))
8384 (setq articles (nconc thread-articles articles))))
8386 (message "No messages matched")
8387 (gnus-summary-limit articles))
8388 (gnus-summary-position-point)))
8390 (defun gnus-summary-limit-to-replied (&optional unreplied)
8391 "Limit the summary buffer to replied articles.
8392 If UNREPLIED (the prefix), limit to unreplied articles."
8396 (gnus-set-difference gnus-newsgroup-articles
8397 gnus-newsgroup-replied))
8398 (gnus-summary-limit gnus-newsgroup-replied))
8399 (gnus-summary-position-point))
8401 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8402 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8403 If REVERSE, limit the summary buffer to articles that are marked
8404 with MARKS. MARKS can either be a string of marks or a list of marks.
8405 Returns how many articles were removed."
8406 (interactive "sMarks: ")
8407 (gnus-summary-limit-to-marks marks t))
8409 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8410 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8411 If REVERSE (the prefix), limit the summary buffer to articles that are
8412 not marked with MARKS. MARKS can either be a string of marks or a
8414 Returns how many articles were removed."
8415 (interactive "sMarks: \nP")
8417 (let ((data gnus-newsgroup-data)
8418 (marks (if (listp marks) marks
8419 (append marks nil))) ; Transform to list.
8422 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8423 (memq (gnus-data-mark (car data)) marks))
8424 (push (gnus-data-number (car data)) articles))
8425 (setq data (cdr data)))
8426 (gnus-summary-limit articles))
8427 (gnus-summary-position-point)))
8429 (defun gnus-summary-limit-to-score (score)
8430 "Limit to articles with score at or above SCORE."
8431 (interactive "NLimit to articles with score of at least: ")
8432 (let ((data gnus-newsgroup-data)
8435 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8437 (push (gnus-data-number (car data)) articles))
8438 (setq data (cdr data)))
8440 (gnus-summary-limit articles)
8441 (gnus-summary-position-point))))
8443 (defun gnus-summary-limit-to-unseen ()
8444 "Limit to unseen articles."
8447 (gnus-summary-limit gnus-newsgroup-unseen)
8448 (gnus-summary-position-point)))
8450 (defun gnus-summary-limit-include-thread (id)
8451 "Display all the hidden articles that is in the thread with ID in it.
8452 When called interactively, ID is the Message-ID of the current
8454 (interactive (list (mail-header-id (gnus-summary-article-header))))
8455 (let ((articles (gnus-articles-in-thread
8456 (gnus-id-to-thread (gnus-root-id id))))
8457 ;;we REALLY want the whole thread---this prevents cut-threads
8458 ;;from removing the thread we want to include.
8459 (gnus-fetch-old-headers nil)
8460 (gnus-build-sparse-threads nil))
8462 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8463 (gnus-summary-limit-include-matching-articles
8465 (regexp-quote (gnus-simplify-subject-re
8466 (mail-header-subject (gnus-id-to-header id)))))
8467 (gnus-summary-position-point))))
8469 (defun gnus-summary-limit-include-matching-articles (header regexp)
8470 "Display all the hidden articles that have HEADERs that match REGEXP."
8471 (interactive (list (read-string "Match on header: ")
8472 (read-string "Regexp: ")))
8473 (let ((articles (gnus-find-matching-articles header regexp)))
8475 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8476 (gnus-summary-position-point))))
8478 (defun gnus-summary-insert-dormant-articles ()
8479 "Insert all the dormant articles for this group into the current buffer."
8481 (let ((gnus-verbose (max 6 gnus-verbose)))
8482 (if (not gnus-newsgroup-dormant)
8483 (gnus-message 3 "No dormant articles for this group")
8484 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8486 (defun gnus-summary-insert-ticked-articles ()
8487 "Insert ticked articles for this group into the current buffer."
8489 (let ((gnus-verbose (max 6 gnus-verbose)))
8490 (if (not gnus-newsgroup-marked)
8491 (gnus-message 3 "No ticked articles for this group")
8492 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8494 (defun gnus-summary-limit-include-dormant ()
8495 "Display all the hidden articles that are marked as dormant.
8496 Note that this command only works on a subset of the articles currently
8497 fetched for this group."
8499 (unless gnus-newsgroup-dormant
8500 (error "There are no dormant articles in this group"))
8502 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8503 (gnus-summary-position-point)))
8505 (defun gnus-summary-include-articles (articles)
8506 "Fetch the headers for ARTICLES and then display the summary lines."
8507 (let ((gnus-inhibit-demon t)
8509 (gnus-read-all-available-headers t))
8510 (setq gnus-newsgroup-headers
8512 'list gnus-newsgroup-headers
8513 (gnus-fetch-headers articles nil t)
8514 'gnus-article-sort-by-number))
8515 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8517 (defun gnus-summary-limit-exclude-dormant ()
8518 "Hide all dormant articles."
8521 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8522 (gnus-summary-position-point)))
8524 (defun gnus-summary-limit-exclude-childless-dormant ()
8525 "Hide all dormant articles that have no children."
8527 (let ((data (gnus-data-list t))
8528 articles d children)
8529 ;; Find all articles that are either not dormant or have
8531 (while (setq d (pop data))
8532 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8534 (gnus-article-children (gnus-data-number d)))
8537 (when (memq (car children) articles)
8542 (push (gnus-data-number d) articles)))
8545 (gnus-summary-limit articles)
8546 (gnus-summary-position-point))))
8548 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8549 "Mark all unread excluded articles as read.
8550 If ALL, mark even excluded ticked and dormants as read."
8552 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8553 (let ((articles (gnus-sorted-ndifference
8555 (mapcar (lambda (h) (mail-header-number h))
8556 gnus-newsgroup-headers)
8558 gnus-newsgroup-limit))
8560 (setq gnus-newsgroup-unreads
8561 (gnus-sorted-intersection gnus-newsgroup-unreads
8562 gnus-newsgroup-limit))
8564 (setq gnus-newsgroup-dormant nil
8565 gnus-newsgroup-marked nil
8566 gnus-newsgroup-reads
8568 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8569 gnus-newsgroup-reads))
8570 (while (setq article (pop articles))
8571 (unless (or (memq article gnus-newsgroup-dormant)
8572 (memq article gnus-newsgroup-marked))
8573 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8575 (defun gnus-summary-limit (articles &optional pop)
8577 ;; We pop the previous limit off the stack and use that.
8578 (setq articles (car gnus-newsgroup-limits)
8579 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8580 ;; We use the new limit, so we push the old limit on the stack.
8581 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8583 (setq gnus-newsgroup-limit articles)
8584 (let ((total (length gnus-newsgroup-data))
8585 (data (gnus-data-find-list (gnus-summary-article-number)))
8586 (gnus-summary-mark-below nil) ; Inhibit this.
8588 ;; This will do all the work of generating the new summary buffer
8589 ;; according to the new limit.
8590 (gnus-summary-prepare)
8591 ;; Hide any threads, possibly.
8592 (gnus-summary-maybe-hide-threads)
8593 ;; Try to return to the article you were at, or one in the
8596 ;; We try to find some article after the current one.
8598 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8601 (setq data (cdr data))))
8603 ;; If there is no data, that means that we were after the last
8604 ;; article. The same goes when we can't find any articles
8605 ;; after the current one.
8606 (goto-char (point-max))
8607 (gnus-summary-find-prev))
8608 (gnus-set-mode-line 'summary)
8609 ;; We return how many articles were removed from the summary
8610 ;; buffer as a result of the new limit.
8611 (- total (length gnus-newsgroup-data))))
8613 (defsubst gnus-invisible-cut-children (threads)
8616 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8621 (defsubst gnus-cut-thread (thread)
8622 "Go forwards in the thread until we find an article that we want to display."
8623 (when (or (eq gnus-fetch-old-headers 'some)
8624 (eq gnus-fetch-old-headers 'invisible)
8625 (numberp gnus-fetch-old-headers)
8626 (eq gnus-build-sparse-threads 'some)
8627 (eq gnus-build-sparse-threads 'more))
8628 ;; Deal with old-fetched headers and sparse threads.
8632 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8633 (gnus-summary-article-ancient-p
8634 (mail-header-number (car thread))))
8635 (if (or (<= (length (cdr thread)) 1)
8636 (eq gnus-fetch-old-headers 'invisible))
8637 (setq gnus-newsgroup-limit
8638 (delq (mail-header-number (car thread))
8639 gnus-newsgroup-limit)
8640 thread (cadr thread))
8641 (when (gnus-invisible-cut-children (cdr thread))
8642 (let ((th (cdr thread)))
8644 (if (memq (mail-header-number (caar th))
8645 gnus-newsgroup-limit)
8646 (setq thread (car th)
8648 (setq th (cdr th))))))))))
8651 (defun gnus-cut-threads (threads)
8652 "Cut off all uninteresting articles from the beginning of THREADS."
8653 (when (or (eq gnus-fetch-old-headers 'some)
8654 (eq gnus-fetch-old-headers 'invisible)
8655 (numberp gnus-fetch-old-headers)
8656 (eq gnus-build-sparse-threads 'some)
8657 (eq gnus-build-sparse-threads 'more))
8660 (setcar th (gnus-cut-thread (car th)))
8661 (setq th (cdr th)))))
8662 ;; Remove nixed out threads.
8665 (defun gnus-summary-initial-limit (&optional show-if-empty)
8666 "Figure out what the initial limit is supposed to be on group entry.
8667 This entails weeding out unwanted dormants, low-scored articles,
8668 fetch-old-headers verbiage, and so on."
8669 ;; Most groups have nothing to remove.
8670 (unless (or gnus-inhibit-limiting
8671 (and (null gnus-newsgroup-dormant)
8672 (eq gnus-newsgroup-display 'gnus-not-ignore)
8673 (not (eq gnus-fetch-old-headers 'some))
8674 (not (numberp gnus-fetch-old-headers))
8675 (not (eq gnus-fetch-old-headers 'invisible))
8676 (null gnus-summary-expunge-below)
8677 (not (eq gnus-build-sparse-threads 'some))
8678 (not (eq gnus-build-sparse-threads 'more))
8679 (null gnus-thread-expunge-below)))
8680 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8681 (setq gnus-newsgroup-limit nil)
8684 (unless (car (symbol-value node))
8685 ;; These threads have no parents -- they are roots.
8686 (let ((nodes (cdr (symbol-value node)))
8689 (if (and gnus-thread-expunge-below
8690 (< (gnus-thread-total-score (car nodes))
8691 gnus-thread-expunge-below))
8692 (gnus-expunge-thread (pop nodes))
8693 (setq thread (pop nodes))
8694 (gnus-summary-limit-children thread))))))
8695 gnus-newsgroup-dependencies)
8696 ;; If this limitation resulted in an empty group, we might
8697 ;; pop the previous limit and use it instead.
8698 (when (and (not gnus-newsgroup-limit)
8700 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8701 gnus-newsgroup-limit))
8703 (defun gnus-summary-limit-children (thread)
8704 "Return 1 if this subthread is visible and 0 if it is not."
8705 ;; First we get the number of visible children to this thread. This
8706 ;; is done by recursing down the thread using this function, so this
8707 ;; will really go down to a leaf article first, before slowly
8708 ;; working its way up towards the root.
8710 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8713 (apply '+ (mapcar 'gnus-summary-limit-children
8716 (number (mail-header-number (car thread)))
8719 (not (memq number gnus-newsgroup-marked))
8721 ;; If this article is dormant and has absolutely no visible
8722 ;; children, then this article isn't visible.
8723 (and (memq number gnus-newsgroup-dormant)
8725 ;; If this is "fetch-old-headered" and there is no
8726 ;; visible children, then we don't want this article.
8727 (and (or (eq gnus-fetch-old-headers 'some)
8728 (numberp gnus-fetch-old-headers))
8729 (gnus-summary-article-ancient-p number)
8731 ;; If this is "fetch-old-headered" and `invisible', then
8732 ;; we don't want this article.
8733 (and (eq gnus-fetch-old-headers 'invisible)
8734 (gnus-summary-article-ancient-p number))
8735 ;; If this is a sparsely inserted article with no children,
8736 ;; we don't want it.
8737 (and (eq gnus-build-sparse-threads 'some)
8738 (gnus-summary-article-sparse-p number)
8740 ;; If we use expunging, and this article is really
8741 ;; low-scored, then we don't want this article.
8742 (when (and gnus-summary-expunge-below
8744 (or (cdr (assq number gnus-newsgroup-scored))
8745 gnus-summary-default-score))
8746 gnus-summary-expunge-below))
8747 ;; We increase the expunge-tally here, but that has
8748 ;; nothing to do with the limits, really.
8749 (incf gnus-newsgroup-expunged-tally)
8750 ;; We also mark as read here, if that's wanted.
8751 (when (and gnus-summary-mark-below
8752 (< score gnus-summary-mark-below))
8753 (setq gnus-newsgroup-unreads
8754 (delq number gnus-newsgroup-unreads))
8755 (if gnus-newsgroup-auto-expire
8756 (push number gnus-newsgroup-expirable)
8757 (push (cons number gnus-low-score-mark)
8758 gnus-newsgroup-reads)))
8760 ;; Do the `display' group parameter.
8761 (and gnus-newsgroup-display
8762 (let ((gnus-number number))
8763 (not (funcall gnus-newsgroup-display))))))
8764 ;; Nope, invisible article.
8766 ;; Ok, this article is to be visible, so we add it to the limit
8768 (push number gnus-newsgroup-limit)
8771 (defun gnus-expunge-thread (thread)
8772 "Mark all articles in THREAD as read."
8773 (let* ((number (mail-header-number (car thread))))
8774 (incf gnus-newsgroup-expunged-tally)
8775 ;; We also mark as read here, if that's wanted.
8776 (setq gnus-newsgroup-unreads
8777 (delq number gnus-newsgroup-unreads))
8778 (if gnus-newsgroup-auto-expire
8779 (push number gnus-newsgroup-expirable)
8780 (push (cons number gnus-low-score-mark)
8781 gnus-newsgroup-reads)))
8782 ;; Go recursively through all subthreads.
8783 (mapcar 'gnus-expunge-thread (cdr thread)))
8785 ;; Summary article oriented commands
8787 (defun gnus-summary-refer-parent-article (n)
8788 "Refer parent article N times.
8789 If N is negative, go to ancestor -N instead.
8790 The difference between N and the number of articles fetched is returned."
8794 (when (not (natnump n))
8799 (setq header (gnus-summary-article-header))
8800 (if (and (eq (mail-header-number header)
8801 (cdr gnus-article-current))
8802 (equal gnus-newsgroup-name
8803 (car gnus-article-current)))
8804 ;; If we try to find the parent of the currently
8805 ;; displayed article, then we take a look at the actual
8806 ;; References header, since this is slightly more
8807 ;; reliable than the References field we got from the
8809 (with-current-buffer gnus-original-article-buffer
8810 (nnheader-narrow-to-headers)
8811 (unless (setq ref (message-fetch-field "references"))
8812 (when (setq ref (message-fetch-field "in-reply-to"))
8813 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8816 ;; It's not the current article, so we take a bet on
8817 ;; the value we got from the server.
8818 (mail-header-references header)))
8820 (not (equal ref "")))
8821 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8822 (gnus-message 1 "Couldn't find parent"))
8823 (gnus-message 1 "No references in article %d"
8824 (gnus-summary-article-number))
8827 (gnus-summary-position-point)
8830 (defun gnus-summary-refer-references ()
8831 "Fetch all articles mentioned in the References header.
8832 Return the number of articles fetched."
8834 (let ((ref (mail-header-references (gnus-summary-article-header)))
8835 (current (gnus-summary-article-number))
8839 (error "No References in the current article")
8840 ;; For each Message-ID in the References header...
8841 (while (string-match "<[^>]*>" ref)
8843 ;; ... fetch that article.
8844 (gnus-summary-refer-article
8845 (prog1 (match-string 0 ref)
8846 (setq ref (substring ref (match-end 0))))))
8847 (gnus-summary-goto-subject current)
8848 (gnus-summary-position-point)
8851 (defun gnus-summary-refer-thread (&optional limit)
8852 "Fetch all articles in the current thread.
8853 If no backend-specific 'request-thread function is available
8854 fetch LIMIT (the numerical prefix) old headers. If LIMIT is nil
8855 fetch what's specified by the `gnus-refer-thread-limit'
8858 (gnus-warp-to-article)
8859 (let ((id (mail-header-id (gnus-summary-article-header)))
8860 (gnus-inhibit-demon t)
8862 (gnus-summary-ignore-duplicates t)
8863 (gnus-read-all-available-headers t)
8864 (limit (if limit (prefix-numeric-value limit)
8865 gnus-refer-thread-limit)))
8866 (setq gnus-newsgroup-headers
8868 'list gnus-newsgroup-headers
8869 (if (gnus-check-backend-function
8870 'request-thread gnus-newsgroup-name)
8871 (gnus-request-thread id)
8872 (let* ((last (if (numberp limit)
8873 (min (+ (mail-header-number
8874 (gnus-summary-article-header))
8876 gnus-newsgroup-highest)
8877 gnus-newsgroup-highest))
8878 (subject (gnus-simplify-subject
8879 (mail-header-subject
8880 (gnus-summary-article-header))))
8881 (refs (split-string (or (mail-header-references
8882 (gnus-summary-article-header))
8884 (gnus-parse-headers-hook
8885 (lambda () (goto-char (point-min))
8887 (regexp-opt (append refs (list id subject)))))))
8888 (gnus-fetch-headers (list last) (if (numberp limit)
8889 (* 2 limit) limit) t)))
8890 'gnus-article-sort-by-number))
8891 (gnus-summary-limit-include-thread id)))
8893 (defun gnus-summary-refer-article (message-id)
8894 "Fetch an article specified by MESSAGE-ID."
8895 (interactive "sMessage-ID: ")
8896 (when (and (stringp message-id)
8897 (not (zerop (length message-id))))
8898 (setq message-id (gnus-replace-in-string message-id " " ""))
8899 ;; Construct the correct Message-ID if necessary.
8900 ;; Suggested by tale@pawl.rpi.edu.
8901 (unless (string-match "^<" message-id)
8902 (setq message-id (concat "<" message-id)))
8903 (unless (string-match ">$" message-id)
8904 (setq message-id (concat message-id ">")))
8905 ;; People often post MIDs from URLs, so unhex it:
8906 (unless (string-match "@" message-id)
8907 (setq message-id (gnus-url-unhex-string message-id)))
8908 (let* ((header (gnus-id-to-header message-id))
8910 (gnus-summary-article-sparse-p
8911 (mail-header-number header))
8912 (memq (mail-header-number header)
8913 gnus-newsgroup-limit)))
8916 ;; If the article is present in the buffer we just go to it.
8918 (or (not (gnus-summary-article-sparse-p
8919 (mail-header-number header)))
8922 (gnus-summary-goto-article
8923 (mail-header-number header) nil t)
8925 (gnus-summary-update-article (mail-header-number header)))))
8927 ;; We fetch the article.
8929 (dolist (gnus-override-method (gnus-refer-article-methods))
8930 (when (and (gnus-check-server gnus-override-method)
8931 ;; Fetch the header,
8932 (setq number (gnus-summary-insert-subject message-id)))
8933 ;; and display the article.
8934 (gnus-summary-select-article nil nil nil number)
8936 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8938 (defun gnus-refer-article-methods ()
8939 "Return a list of referable methods."
8941 ;; No method, so we default to current and native.
8942 ((null gnus-refer-article-method)
8943 (list gnus-current-select-method gnus-select-method))
8945 ((eq 'current gnus-refer-article-method)
8946 (list gnus-current-select-method))
8947 ;; List of select methods.
8948 ((not (and (symbolp (car gnus-refer-article-method))
8949 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8951 (dolist (method gnus-refer-article-method)
8952 (push (if (eq 'current method)
8953 gnus-current-select-method
8957 ;; One single select method.
8959 (list gnus-refer-article-method))))
8961 (defun gnus-summary-edit-parameters ()
8962 "Edit the group parameters of the current group."
8964 (gnus-group-edit-group gnus-newsgroup-name 'params))
8966 (defun gnus-summary-customize-parameters ()
8967 "Customize the group parameters of the current group."
8969 (gnus-group-customize gnus-newsgroup-name))
8971 (defun gnus-summary-enter-digest-group (&optional force)
8972 "Enter an nndoc group based on the current article.
8973 If FORCE, force a digest interpretation. If not, try
8974 to guess what the document format is."
8976 (let ((conf gnus-current-window-configuration))
8977 (save-window-excursion
8979 (let (gnus-article-prepare-hook
8980 gnus-display-mime-function
8982 (gnus-summary-select-article))))
8983 (setq gnus-current-window-configuration conf)
8984 (let* ((name (format "%s-%d"
8985 (gnus-group-prefixed-name
8986 gnus-newsgroup-name (list 'nndoc ""))
8987 (with-current-buffer gnus-summary-buffer
8988 gnus-current-article)))
8989 (ogroup gnus-newsgroup-name)
8990 (params (append (gnus-info-params (gnus-get-info ogroup))
8991 (list (cons 'to-group ogroup))
8992 (list (cons 'parent-group ogroup))
8993 (list (cons 'save-article-group ogroup))))
8994 (case-fold-search t)
8995 (buf (current-buffer))
8997 (with-current-buffer gnus-original-article-buffer
8998 ;; Have the digest group inherit the main mail address of
8999 ;; the parent article.
9000 (when (setq to-address (or (gnus-fetch-field "reply-to")
9001 (gnus-fetch-field "from")))
9004 (list (cons 'to-address
9005 (funcall gnus-decode-encoded-address-function
9007 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
9008 (insert-buffer-substring gnus-original-article-buffer)
9009 ;; Remove lines that may lead nndoc to misinterpret the
9012 (goto-char (point-min))
9013 (or (search-forward "\n\n" nil t) (point)))
9014 (goto-char (point-min))
9015 (delete-matching-lines "^Path:\\|^From ")
9018 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
9019 (gnus-newsgroup-ephemeral-ignored-charsets
9020 gnus-newsgroup-ignored-charsets))
9021 (gnus-group-read-ephemeral-group
9022 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
9024 ,(if force 'mbox 'guess)))
9026 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
9028 ;; Make all postings to this group go to the parent group.
9029 (nconc (gnus-info-params (gnus-get-info name))
9031 ;; Couldn't select this doc group.
9032 (switch-to-buffer buf)
9033 (gnus-set-global-variables)
9034 (gnus-configure-windows 'summary)
9035 (gnus-message 3 "Article couldn't be entered?"))
9036 (kill-buffer dig)))))
9038 (defun gnus-summary-read-document (n)
9039 "Open a new group based on the current article(s).
9040 This will allow you to read digests and other similar
9041 documents as newsgroups.
9042 Obeys the standard process/prefix convention."
9044 (let* ((ogroup gnus-newsgroup-name)
9045 (params (append (gnus-info-params (gnus-get-info ogroup))
9046 (list (cons 'to-group ogroup))))
9047 group egroup groups vgroup)
9048 (dolist (article (gnus-summary-work-articles n))
9049 (setq group (format "%s-%d" gnus-newsgroup-name article))
9050 (gnus-summary-remove-process-mark article)
9051 (when (gnus-summary-display-article article)
9052 (save-excursion ;;What for?
9054 (insert-buffer-substring gnus-original-article-buffer)
9055 ;; Remove some headers that may lead nndoc to make
9057 (message-narrow-to-head)
9058 (goto-char (point-min))
9059 (delete-matching-lines "^Path:\\|^From ")
9062 (gnus-group-read-ephemeral-group
9063 group `(nndoc ,group (nndoc-address ,(current-buffer))
9064 (nndoc-article-type guess))
9067 ;; Make all postings to this group go to the parent group.
9068 (nconc (gnus-info-params (gnus-get-info egroup))
9070 (push egroup groups))
9071 ;; Couldn't select this doc group.
9072 (gnus-error 3 "Article couldn't be entered"))))))
9073 ;; Now we have selected all the documents.
9076 (error "None of the articles could be interpreted as documents"))
9077 ((gnus-group-read-ephemeral-group
9078 (setq vgroup (format
9079 "nnvirtual:%s-%s" gnus-newsgroup-name
9080 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
9081 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
9083 (cons (current-buffer) 'summary)))
9085 (error "Couldn't select virtual nndoc group")))))
9087 (defun gnus-summary-widget-forward (arg)
9088 "Move point to the next field or button in the article.
9089 With optional ARG, move across that many fields."
9091 (gnus-summary-select-article)
9092 (gnus-configure-windows 'article)
9093 (select-window (gnus-get-buffer-window gnus-article-buffer))
9094 (widget-forward arg))
9096 (defun gnus-summary-isearch-article (&optional regexp-p)
9097 "Do incremental search forward on the current article.
9098 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9100 (gnus-summary-select-article)
9101 (gnus-configure-windows 'article)
9102 (gnus-eval-in-buffer-window gnus-article-buffer
9105 (isearch-forward regexp-p))))
9107 (defun gnus-summary-repeat-search-article-forward ()
9108 "Repeat the previous search forwards."
9110 (unless gnus-last-search-regexp
9111 (error "No previous search"))
9112 (gnus-summary-search-article-forward gnus-last-search-regexp))
9114 (defun gnus-summary-repeat-search-article-backward ()
9115 "Repeat the previous search backwards."
9117 (unless gnus-last-search-regexp
9118 (error "No previous search"))
9119 (gnus-summary-search-article-forward gnus-last-search-regexp t))
9121 (defun gnus-summary-search-article-forward (regexp &optional backward)
9122 "Search for an article containing REGEXP forward.
9123 If BACKWARD, search backward instead."
9126 (format "Search article %s (regexp%s): "
9127 (if current-prefix-arg "backward" "forward")
9128 (if gnus-last-search-regexp
9129 (concat ", default " gnus-last-search-regexp)
9131 current-prefix-arg))
9132 (if (string-equal regexp "")
9133 (setq regexp (or gnus-last-search-regexp ""))
9134 (setq gnus-last-search-regexp regexp)
9135 (setq gnus-article-before-search gnus-current-article))
9136 ;; Intentionally set gnus-last-article.
9137 (setq gnus-last-article gnus-article-before-search)
9138 (let ((gnus-last-article gnus-last-article))
9139 (if (gnus-summary-search-article regexp backward)
9140 (gnus-summary-show-thread)
9141 (signal 'search-failed (list regexp)))))
9143 (defun gnus-summary-search-article-backward (regexp)
9144 "Search for an article containing REGEXP backward."
9147 (format "Search article backward (regexp%s): "
9148 (if gnus-last-search-regexp
9149 (concat ", default " gnus-last-search-regexp)
9151 (gnus-summary-search-article-forward regexp 'backward))
9153 (defun gnus-summary-search-article (regexp &optional backward)
9154 "Search for an article containing REGEXP.
9155 Optional argument BACKWARD means do search for backward.
9156 `gnus-select-article-hook' is not called during the search."
9157 ;; We have to require this here to make sure that the following
9158 ;; dynamic binding isn't shadowed by autoloading.
9159 (require 'gnus-async)
9161 (let ((gnus-select-article-hook nil) ;Disable hook.
9162 (gnus-article-prepare-hook nil)
9163 (gnus-mark-article-hook nil) ;Inhibit marking as read.
9164 (gnus-use-article-prefetch nil)
9165 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
9166 (gnus-use-trees nil) ;Inhibit updating tree buffer.
9168 (gnus-keep-backlog nil)
9169 (gnus-break-pages nil)
9170 (gnus-summary-display-arrow nil)
9171 (gnus-updated-mode-lines nil)
9172 (gnus-auto-center-summary nil)
9173 (sum (current-buffer))
9174 (gnus-display-mime-function nil)
9177 (gnus-save-hidden-threads
9178 (gnus-summary-select-article)
9179 (set-buffer gnus-article-buffer)
9180 (goto-char (window-point (get-buffer-window (current-buffer))))
9184 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
9186 (re-search-backward regexp nil t)
9187 (re-search-forward regexp nil t))
9188 ;; We found the regexp.
9193 (get-buffer-window (current-buffer))
9197 (get-buffer-window (current-buffer))
9200 (setq point (point)))
9201 ;; We didn't find it, so we go to the next article.
9204 (while (eq found 'not)
9205 (if (not (if backward (gnus-summary-find-prev)
9206 (gnus-summary-find-next)))
9207 ;; No more articles.
9209 ;; Select the next article and adjust point.
9210 (unless (gnus-summary-article-sparse-p
9211 (gnus-summary-article-number))
9213 (gnus-summary-select-article)
9214 (set-buffer gnus-article-buffer)
9216 (goto-char (if backward (point-max) (point-min))))))))
9217 (gnus-message 7 ""))
9218 ;; Return whether we found the regexp.
9219 (when (eq found 'found)
9221 (gnus-summary-show-thread)
9222 (gnus-summary-goto-subject gnus-current-article)
9223 (gnus-summary-position-point)
9226 (defun gnus-find-matching-articles (header regexp)
9227 "Return a list of all articles that match REGEXP on HEADER.
9228 This search includes all articles in the current group that Gnus has
9229 fetched headers for, whether they are displayed or not."
9230 (let ((articles nil)
9231 ;; Can't eta-reduce because it's a macro.
9232 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9233 (case-fold-search t))
9234 (dolist (header gnus-newsgroup-headers)
9235 (when (string-match regexp (funcall func header))
9236 (push (mail-header-number header) articles)))
9237 (nreverse articles)))
9239 (defun gnus-summary-find-matching (header regexp &optional backward unread
9240 not-case-fold not-matching)
9241 "Return a list of all articles that match REGEXP on HEADER.
9242 The search stars on the current article and goes forwards unless
9243 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9244 If UNREAD is non-nil, only unread articles will
9245 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9246 in the comparisons. If NOT-MATCHING, return a list of all articles that
9247 not match REGEXP on HEADER."
9248 (let ((case-fold-search (not not-case-fold))
9251 (if (eq (car header) 'extra)
9254 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9256 (error "%s is an invalid header" header))
9257 (unless (fboundp (intern (concat "mail-header-" header)))
9258 (error "%s is not a valid header" header))
9259 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9260 (dolist (d (if (eq backward 'all)
9262 (gnus-data-find-list
9263 (gnus-summary-article-number)
9264 (gnus-data-list backward))))
9265 (when (and (or (not unread) ; We want all articles...
9266 (gnus-data-unread-p d)) ; Or just unreads.
9267 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9271 (funcall func (gnus-data-header d))))
9272 (string-match regexp
9273 (funcall func (gnus-data-header d)))))
9274 (push (gnus-data-number d) articles))) ; Success!
9275 (nreverse articles)))
9277 (defun gnus-summary-execute-command (header regexp command &optional backward)
9278 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9279 If HEADER is an empty string (or nil), the match is done on the entire
9280 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9282 (list (let ((completion-ignore-case t))
9283 (gnus-completing-read
9285 (mapcar 'symbol-name
9287 '(Number Subject From Lines Date
9288 Message-ID Xref References Body)
9289 gnus-extra-headers))
9291 (read-string "Regexp: ")
9292 (read-key-sequence "Command: ")
9293 current-prefix-arg))
9294 (when (equal header "Body")
9296 ;; Hidden thread subtrees must be searched as well.
9297 (gnus-summary-show-all-threads)
9298 ;; We don't want to change current point nor window configuration.
9300 (save-window-excursion
9302 gnus-treat-strip-trailing-blank-lines
9303 gnus-treat-strip-leading-blank-lines
9304 gnus-treat-strip-multiple-blank-lines
9305 gnus-treat-hide-boring-headers
9306 gnus-treat-fold-newsgroups
9307 gnus-article-prepare-hook)
9308 (gnus-message 6 "Executing %s..." (key-description command))
9309 ;; We'd like to execute COMMAND interactively so as to give arguments.
9310 (gnus-execute header regexp
9311 `(call-interactively ',(key-binding command))
9313 (gnus-message 6 "Executing %s...done" (key-description command))))))
9315 (defun gnus-summary-beginning-of-article ()
9316 "Scroll the article back to the beginning."
9318 (gnus-summary-select-article)
9319 (gnus-configure-windows 'article)
9320 (gnus-eval-in-buffer-window gnus-article-buffer
9322 (goto-char (point-min))
9323 (when gnus-break-pages
9324 (gnus-narrow-to-page))))
9326 (defun gnus-summary-end-of-article ()
9327 "Scroll to the end of the article."
9329 (gnus-summary-select-article)
9330 (gnus-configure-windows 'article)
9331 (gnus-eval-in-buffer-window gnus-article-buffer
9333 (goto-char (point-max))
9335 (when gnus-break-pages
9336 (gnus-narrow-to-page))))
9338 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9339 "Truncate to LEN and quote all \"(\"'s in STRING."
9340 (gnus-replace-in-string (if (and len (> (length string) len))
9341 (substring string 0 len)
9345 (defun gnus-summary-print-article (&optional filename n)
9346 "Generate and print a PostScript image of the process-marked (mail) articles.
9348 If used interactively, print the current article if none are
9349 process-marked. With prefix arg, prompt the user for the name of the
9352 When used from Lisp, accept two optional args FILENAME and N. N means
9353 to print the next N articles. If N is negative, print the N previous
9354 articles. If N is nil and articles have been marked with the process
9355 mark, print these instead.
9357 If the optional first argument FILENAME is nil, send the image to the
9358 printer. If FILENAME is a string, save the PostScript image in a file with
9359 that name. If FILENAME is a number, prompt the user for the name of the file
9361 (interactive (list (ps-print-preprint current-prefix-arg)))
9362 (dolist (article (gnus-summary-work-articles n))
9363 (gnus-summary-select-article nil nil 'pseudo article)
9364 (gnus-eval-in-buffer-window gnus-article-buffer
9365 (gnus-print-buffer))
9366 (gnus-summary-remove-process-mark article))
9367 (ps-despool filename))
9369 (defun gnus-print-buffer ()
9370 (let ((ps-left-header
9373 (gnus-summary-print-truncate-and-quote
9374 (mail-header-subject gnus-current-headers)
9377 (gnus-summary-print-truncate-and-quote
9378 (mail-header-from gnus-current-headers)
9382 "/pagenumberstring load"
9384 (mail-header-date gnus-current-headers) ")"))))
9385 (gnus-run-hooks 'gnus-ps-print-hook)
9387 (if ps-print-color-p
9388 (ps-spool-buffer-with-faces)
9389 (ps-spool-buffer)))))
9391 (defun gnus-summary-show-complete-article ()
9392 "Show a complete version of the current article.
9393 This is only useful if you're looking at a partial version of the
9396 (let ((gnus-keep-backlog nil)
9397 (gnus-use-cache nil)
9400 (format "%s-fetch-partial-articles"
9401 (car (gnus-find-method-for-group
9402 gnus-newsgroup-name)))
9407 (setq old-val (symbol-value variable))
9409 (gnus-flush-original-article-buffer)
9410 (gnus-summary-show-article))
9411 (set variable old-val))))
9413 (defun gnus-summary-show-article (&optional arg)
9414 "Force redisplaying of the current article.
9415 If ARG (the prefix) is a number, show the article with the charset
9416 defined in `gnus-summary-show-article-charset-alist', or the charset
9418 If ARG (the prefix) is non-nil and not a number, show the article,
9419 but without running any of the article treatment functions
9420 article. Normally, the keystroke is `C-u g'. When using `C-u
9421 C-u g', show the raw article."
9425 (gnus-summary-show-article t)
9426 (let ((gnus-newsgroup-charset
9427 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9428 (mm-read-coding-system
9429 "View as charset: " ;; actually it is coding system.
9430 (with-current-buffer gnus-article-buffer
9431 (mm-detect-coding-region (point) (point-max))))))
9432 (gnus-newsgroup-ignored-charsets 'gnus-all))
9433 (gnus-summary-select-article nil 'force)
9434 (let ((deps gnus-newsgroup-dependencies)
9436 (with-current-buffer gnus-original-article-buffer
9438 (message-narrow-to-head)
9439 (setq head (buffer-string))
9440 (goto-char (point-min))
9441 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9442 (goto-char (point-max))
9444 (setq lines (1- (count-lines (point) (point-max))))))
9446 (insert (format "211 %d Article retrieved.\n"
9447 (cdr gnus-article-current)))
9449 (if lines (insert (format "Lines: %d\n" lines)))
9451 (let ((nntp-server-buffer (current-buffer)))
9452 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9453 (gnus-data-set-header
9454 (gnus-data-find (cdr gnus-article-current))
9456 (gnus-summary-update-article-line
9457 (cdr gnus-article-current) header)
9458 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9459 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9461 ;; Select the article the normal way.
9462 (gnus-summary-select-article nil 'force))
9463 ((or (equal arg '(16))
9466 ;; We have to require this here to make sure that the following
9467 ;; dynamic binding isn't shadowed by autoloading.
9468 (require 'gnus-async)
9470 ;; Bind the article treatment functions to nil.
9471 (let ((gnus-have-all-headers t)
9472 gnus-article-prepare-hook
9473 gnus-article-decode-hook
9474 gnus-display-mime-function
9476 ;; Destroy any MIME parts.
9477 (when (gnus-buffer-live-p gnus-article-buffer)
9478 (with-current-buffer gnus-article-buffer
9479 (mm-destroy-parts gnus-article-mime-handles)
9480 ;; Set it to nil for safety reason.
9481 (setq gnus-article-mime-handle-alist nil)
9482 (setq gnus-article-mime-handles nil)))
9483 (gnus-summary-select-article nil 'force)))
9485 (let ((gnus-inhibit-article-treatments t))
9486 (gnus-summary-select-article nil 'force))))
9487 (gnus-summary-goto-subject gnus-current-article)
9488 (gnus-summary-position-point))
9490 (defun gnus-summary-show-raw-article ()
9491 "Show the raw article without any article massaging functions being run."
9493 (gnus-summary-show-article t))
9495 (defun gnus-summary-verbose-headers (&optional arg)
9496 "Toggle permanent full header display.
9497 If ARG is a positive number, turn header display on.
9498 If ARG is a negative number, turn header display off."
9500 (setq gnus-show-all-headers
9501 (cond ((or (not (numberp arg))
9503 (not gnus-show-all-headers))
9506 (gnus-summary-show-article))
9508 (defun gnus-summary-toggle-header (&optional arg)
9509 "Show the headers if they are hidden, or hide them if they are shown.
9510 If ARG is a positive number, show the entire header.
9511 If ARG is a negative number, hide the unwanted header lines."
9513 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9514 (get-buffer-window gnus-article-buffer t))))
9515 (with-current-buffer gnus-article-buffer
9517 (article-narrow-to-head)
9518 (let* ((inhibit-read-only t)
9519 (inhibit-point-motion-hooks t)
9520 (hidden (if (numberp arg)
9522 (or (not (looking-at "[^ \t\n]+:"))
9523 (gnus-article-hidden-text-p 'headers))))
9525 (delete-region (point-min) (point-max))
9526 (with-current-buffer gnus-original-article-buffer
9527 (goto-char (setq s (point-min)))
9528 (setq e (if (search-forward "\n\n" nil t)
9531 (insert-buffer-substring gnus-original-article-buffer s e)
9532 (run-hooks 'gnus-article-decode-hook)
9534 (let ((gnus-treat-hide-headers nil)
9535 (gnus-treat-hide-boring-headers nil))
9536 (gnus-delete-wash-type 'headers)
9537 (gnus-treat-article 'head))
9538 (gnus-treat-article 'head))
9541 (set-window-start window (goto-char (point-min))))
9542 (if gnus-break-pages
9543 (gnus-narrow-to-page)
9544 (when (gnus-visual-p 'page-marker)
9545 (let ((inhibit-read-only t))
9546 (gnus-remove-text-with-property 'gnus-prev)
9547 (gnus-remove-text-with-property 'gnus-next))))
9548 (gnus-set-mode-line 'article)))))
9550 (defun gnus-summary-show-all-headers ()
9551 "Make all header lines visible."
9553 (gnus-summary-toggle-header 1))
9555 (defun gnus-summary-caesar-message (&optional arg)
9556 "Caesar rotate the current article by 13.
9557 With a non-numerical prefix, also rotate headers. A numerical
9558 prefix specifies how many places to rotate each letter forward."
9560 (gnus-summary-select-article)
9561 (let ((mail-header-separator ""))
9562 (gnus-eval-in-buffer-window gnus-article-buffer
9565 (let ((start (window-start))
9566 (inhibit-read-only t))
9567 (if (equal arg '(4))
9568 (message-caesar-buffer-body nil t)
9569 (message-caesar-buffer-body arg))
9570 (set-window-start (get-buffer-window (current-buffer)) start)))))
9571 ;; Create buttons and stuff...
9572 (gnus-treat-article nil))
9574 (declare-function idna-to-unicode "ext:idna" (str))
9576 (defun gnus-summary-idna-message (&optional arg)
9577 "Decode IDNA encoded domain names in the current articles.
9578 IDNA encoded domain names looks like `xn--bar'. If a string
9579 remain unencoded after running this function, it is likely an
9580 invalid IDNA string (`xn--bar' is invalid).
9582 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9583 installed for this command to work."
9585 (if (not (and (condition-case nil (require 'idna)
9587 (mm-coding-system-p 'utf-8)
9588 (executable-find (symbol-value 'idna-program))))
9590 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9591 (gnus-summary-select-article)
9592 (let ((mail-header-separator ""))
9593 (gnus-eval-in-buffer-window gnus-article-buffer
9596 (let ((start (window-start))
9598 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9599 (replace-match (idna-to-unicode (match-string 1))))
9600 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9602 (defun gnus-summary-morse-message (&optional arg)
9603 "Morse decode the current article."
9605 (gnus-summary-select-article)
9606 (let ((mail-header-separator ""))
9607 (gnus-eval-in-buffer-window gnus-article-buffer
9611 (let ((pos (window-start))
9612 (inhibit-read-only t))
9613 (goto-char (point-min))
9614 (when (message-goto-body)
9615 (gnus-narrow-to-body))
9616 (goto-char (point-min))
9617 (while (search-forward "·" (point-max) t)
9618 (replace-match "."))
9619 (unmorse-region (point-min) (point-max))
9621 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9623 (defun gnus-summary-stop-page-breaking ()
9624 "Stop page breaking in the current article."
9626 (gnus-summary-select-article)
9627 (gnus-eval-in-buffer-window gnus-article-buffer
9629 (when (gnus-visual-p 'page-marker)
9630 (let ((inhibit-read-only t))
9631 (gnus-remove-text-with-property 'gnus-prev)
9632 (gnus-remove-text-with-property 'gnus-next))
9633 (setq gnus-page-broken nil))))
9635 (defun gnus-summary-move-article (&optional n to-newsgroup
9636 select-method action)
9637 "Move the current article to a different newsgroup.
9638 If N is a positive number, move the N next articles.
9639 If N is a negative number, move the N previous articles.
9640 If N is nil and any articles have been marked with the process mark,
9641 move those articles instead.
9642 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9643 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9644 re-spool using this method.
9646 When called interactively with TO-NEWSGROUP being nil, the value of
9647 the variable `gnus-move-split-methods' is used for finding a default
9648 for the target newsgroup.
9650 For this function to work, both the current newsgroup and the
9651 newsgroup that you want to move to have to support the `request-move'
9652 and `request-accept' functions.
9654 ACTION can be either `move' (the default), `crosspost' or `copy'."
9657 (setq action 'move))
9658 ;; Check whether the source group supports the required functions.
9659 (cond ((and (eq action 'move)
9660 (not (gnus-check-backend-function
9661 'request-move-article gnus-newsgroup-name)))
9662 (error "The current group does not support article moving"))
9663 ((and (eq action 'crosspost)
9664 (not (gnus-check-backend-function
9665 'request-replace-article gnus-newsgroup-name)))
9666 (error "The current group does not support article editing")))
9667 (let ((articles (gnus-summary-work-articles n))
9668 (prefix (if (gnus-check-backend-function
9669 'request-move-article gnus-newsgroup-name)
9670 (funcall gnus-move-group-prefix-function
9671 gnus-newsgroup-name)
9673 (names '((move "Move" "Moving")
9674 (copy "Copy" "Copying")
9675 (crosspost "Crosspost" "Crossposting")))
9676 (copy-buf (save-excursion
9677 (nnheader-set-temp-buffer " *copy article*")))
9678 art-group to-method new-xref article to-groups
9679 articles-to-update-marks encoded)
9680 (unless (assq action names)
9681 (error "Unknown action %s" action))
9682 ;; Read the newsgroup name.
9683 (when (and (not to-newsgroup)
9684 (not select-method))
9685 (if (and gnus-move-split-methods
9687 (and (memq gnus-current-article articles)
9688 (gnus-buffer-live-p gnus-original-article-buffer))))
9689 ;; When `gnus-move-split-methods' is non-nil, we have to
9690 ;; select an article to give `gnus-read-move-group-name' an
9691 ;; opportunity to suggest an appropriate default. However,
9692 ;; we needn't render or mark the article.
9693 (let ((gnus-display-mime-function nil)
9694 (gnus-article-prepare-hook nil)
9695 (gnus-mark-article-hook nil))
9696 (gnus-summary-select-article nil nil nil (car articles))))
9697 (setq to-newsgroup (gnus-read-move-group-name
9698 (cadr (assq action names))
9700 (intern (format "gnus-current-%s-group" action)))
9702 encoded to-newsgroup
9703 to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
9704 (set (intern (format "gnus-current-%s-group" action))
9705 (mm-decode-coding-string
9707 (gnus-group-name-charset to-method to-newsgroup))))
9709 (setq to-method (or select-method
9710 (gnus-server-to-method
9711 (gnus-group-method to-newsgroup)))))
9715 (mm-encode-coding-string
9717 (gnus-group-name-charset to-method to-newsgroup)))))
9718 ;; Check the method we are to move this article to...
9719 (unless (gnus-check-backend-function
9720 'request-accept-article (car to-method))
9721 (error "%s does not support article copying" (car to-method)))
9722 (unless (gnus-check-server to-method)
9723 (error "Can't open server %s" (car to-method)))
9724 (gnus-message 6 "%s to %s: %s..."
9725 (caddr (assq action names))
9726 (or (car select-method)
9727 (gnus-group-decoded-name to-newsgroup))
9730 (setq article (pop articles))
9731 ;; Set any marks that may have changed in the summary buffer.
9732 (when gnus-preserve-marks
9733 (gnus-summary-push-marks-to-backend article))
9737 ;; Move the article.
9739 ;; Remove this article from future suppression.
9740 (gnus-dup-unsuppress-article article)
9741 (let* ((from-method (gnus-find-method-for-group
9742 gnus-newsgroup-name))
9743 (to-method (or select-method
9744 (gnus-find-method-for-group to-newsgroup)))
9745 (move-is-internal (gnus-server-equal from-method to-method)))
9746 (gnus-request-move-article
9747 article ; Article to move
9748 gnus-newsgroup-name ; From newsgroup
9749 (nth 1 (gnus-find-method-for-group
9750 gnus-newsgroup-name)) ; Server
9751 (list 'gnus-request-accept-article
9752 to-newsgroup (list 'quote select-method)
9753 (not articles) t) ; Accept form
9754 (not articles) ; Only save nov last time
9755 (and move-is-internal
9756 to-newsgroup ; Not respooling
9757 ; Is this move internal?
9758 (gnus-group-real-name to-newsgroup)))))
9759 ;; Copy the article.
9761 (with-current-buffer copy-buf
9762 (when (gnus-request-article-this-buffer article
9763 gnus-newsgroup-name)
9765 (nnheader-narrow-to-headers)
9766 (dolist (hdr gnus-copy-article-ignored-headers)
9767 (message-remove-header hdr t)))
9768 (gnus-request-accept-article
9769 to-newsgroup select-method (not articles) t))))
9770 ;; Crosspost the article.
9771 ((eq action 'crosspost)
9772 (let ((xref (message-tokenize-header
9773 (mail-header-xref (gnus-summary-article-header
9776 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9777 ":" (number-to-string article)))
9779 (setq xref (list (system-name))))
9782 (mapconcat 'identity
9783 (delete "Xref:" (delete new-xref xref))
9786 (with-current-buffer copy-buf
9787 ;; First put the article in the destination group.
9788 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9789 (when (consp (setq art-group
9790 (gnus-request-accept-article
9791 to-newsgroup select-method (not articles)
9793 (setq new-xref (concat new-xref " " (car art-group)
9795 (number-to-string (cdr art-group))))
9796 ;; Now we have the new Xrefs header, so we insert
9797 ;; it and replace the new article.
9798 (nnheader-replace-header "Xref" new-xref)
9799 (gnus-request-replace-article
9800 (cdr art-group) to-newsgroup (current-buffer) t)
9804 (gnus-message 1 "Couldn't %s article %s: %s"
9805 (cadr (assq action names)) article
9806 (nnheader-get-report (car to-method))))
9807 ((eq art-group 'junk)
9808 (when (eq action 'move)
9809 (gnus-summary-mark-article article gnus-canceled-mark)
9810 (gnus-message 4 "Deleted article %s" article)
9811 ;; run the delete hook
9812 (run-hook-with-args 'gnus-summary-article-delete-hook
9815 (assoc article (gnus-data-list nil)))
9816 gnus-newsgroup-name nil
9819 (let* ((pto-group (gnus-group-prefixed-name
9820 (car art-group) to-method))
9821 (info (gnus-get-info pto-group))
9822 (to-group (gnus-info-group info))
9824 ;; Update the group that has been moved to.
9826 (memq action '(move copy)))
9827 (unless (member to-group to-groups)
9828 (push to-group to-groups))
9830 (unless (memq article gnus-newsgroup-unreads)
9831 (push 'read to-marks)
9833 info (gnus-add-to-range (gnus-info-read info)
9834 (list (cdr art-group)))))
9836 ;; See whether the article is to be put in the cache.
9837 (let* ((expirable (gnus-group-auto-expirable-p to-group))
9838 (marks (if expirable
9839 gnus-article-mark-lists
9840 (delete '(expirable . expire)
9842 gnus-article-mark-lists))))
9843 (to-article (cdr art-group)))
9845 ;; Enter the article into the cache in the new group,
9846 ;; if that is required.
9847 (when gnus-use-cache
9848 (gnus-cache-possibly-enter-article
9850 (memq article gnus-newsgroup-marked)
9851 (memq article gnus-newsgroup-dormant)
9852 (memq article gnus-newsgroup-unreads)))
9854 (when gnus-preserve-marks
9855 ;; Copy any marks over to the new group.
9856 (when (and (equal to-group gnus-newsgroup-name)
9857 (not (memq article gnus-newsgroup-unreads)))
9858 ;; Mark this article as read in this group.
9859 (push (cons to-article gnus-read-mark)
9860 gnus-newsgroup-reads)
9861 ;; Increase the active status of this group.
9862 (setcdr (gnus-active to-group) to-article)
9863 (setcdr gnus-newsgroup-active to-article))
9866 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9867 (when (memq article (symbol-value
9868 (intern (format "gnus-newsgroup-%s"
9870 (push (cdar marks) to-marks)
9871 ;; If the other group is the same as this group,
9872 ;; then we have to add the mark to the list.
9873 (when (equal to-group gnus-newsgroup-name)
9874 (set (intern (format "gnus-newsgroup-%s"
9878 (intern (format "gnus-newsgroup-%s"
9880 ;; Copy the marks to other group.
9881 (gnus-add-marked-articles
9882 to-group (cdar marks) (list to-article) info)))
9883 (setq marks (cdr marks)))
9885 (when (and expirable
9886 gnus-mark-copied-or-moved-articles-as-expirable
9887 (not (memq 'expire to-marks)))
9888 ;; Mark this article as expirable.
9889 (push 'expire to-marks)
9890 (when (equal to-group gnus-newsgroup-name)
9891 (push to-article gnus-newsgroup-expirable))
9892 ;; Copy the expirable mark to other group.
9893 (gnus-add-marked-articles
9894 to-group 'expire (list to-article) info))
9897 (gnus-request-set-mark
9898 to-group (list (list (list to-article) 'add to-marks)))))
9901 (concat "(gnus-group-set-info '"
9902 (gnus-prin1-to-string (gnus-get-info to-group))
9905 ;; Update the Xref header in this article to point to
9906 ;; the new crossposted article we have just created.
9907 (when (eq action 'crosspost)
9908 (with-current-buffer copy-buf
9909 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9910 (nnheader-replace-header "Xref" new-xref)
9911 (gnus-request-replace-article
9912 article gnus-newsgroup-name (current-buffer) t)))
9914 ;; run the move/copy/crosspost/respool hook
9915 (run-hook-with-args 'gnus-summary-article-move-hook
9918 (assoc article (gnus-data-list nil)))
9923 ;;;!!!Why is this necessary?
9924 (set-buffer gnus-summary-buffer)
9926 (when (eq action 'move)
9928 (gnus-summary-goto-subject article)
9929 (gnus-summary-mark-article article gnus-canceled-mark)))))
9930 (push article articles-to-update-marks))
9933 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
9934 ;; Re-activate all groups that have been moved to.
9935 (with-current-buffer gnus-group-buffer
9936 (let ((gnus-group-marked to-groups))
9937 (gnus-group-get-new-news-this-group nil t)))
9939 (gnus-kill-buffer copy-buf)
9940 (gnus-summary-position-point)
9941 (gnus-set-mode-line 'summary)))
9943 (defun gnus-summary-push-marks-to-backend (article)
9945 (marks gnus-article-mark-lists))
9946 (when (memq article gnus-newsgroup-unreads)
9949 (when (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9950 (memq article (symbol-value
9951 (intern (format "gnus-newsgroup-%s"
9953 (push (cdar marks) set))
9955 (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)))))
9957 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9958 "Copy the current article to some other group.
9959 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9960 When called interactively, if TO-NEWSGROUP is nil, use the value of
9961 the variable `gnus-move-split-methods' for finding a default target
9963 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9964 re-spool using this method."
9966 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9968 (defun gnus-summary-crosspost-article (&optional n)
9969 "Crosspost the current article to some other group."
9971 (gnus-summary-move-article n nil nil 'crosspost))
9973 (defcustom gnus-summary-respool-default-method nil
9974 "Default method type for respooling an article.
9975 If nil, use to the current newsgroup method."
9977 :group 'gnus-summary-mail)
9979 (defun gnus-summary-respool-article (&optional n method)
9980 "Respool the current article.
9981 The article will be squeezed through the mail spooling process again,
9982 which means that it will be put in some mail newsgroup or other
9983 depending on `nnmail-split-methods'.
9984 If N is a positive number, respool the N next articles.
9985 If N is a negative number, respool the N previous articles.
9986 If N is nil and any articles have been marked with the process mark,
9987 respool those articles instead.
9989 Respooling can be done both from mail groups and \"real\" newsgroups.
9990 In the former case, the articles in question will be moved from the
9991 current group into whatever groups they are destined to. In the
9992 latter case, they will be copied into the relevant groups."
9994 (list current-prefix-arg
9995 (let* ((methods (gnus-methods-using 'respool))
9997 (symbol-name (or gnus-summary-respool-default-method
9998 (car (gnus-find-method-for-group
9999 gnus-newsgroup-name)))))
10001 (gnus-completing-read
10002 "Backend to use when respooling"
10003 methods t nil 'gnus-mail-method-history methname))
10006 ((zerop (length (setq ms (gnus-servers-using-backend
10007 (intern method)))))
10008 (list (intern method) ""))
10012 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
10013 (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
10016 (error "No method given for respooling"))
10017 (if (assoc (symbol-name
10018 (car (gnus-find-method-for-group gnus-newsgroup-name)))
10019 (gnus-methods-using 'respool))
10020 (gnus-summary-move-article n nil method)
10021 (gnus-summary-copy-article n nil method)))
10023 (defun gnus-summary-import-article (file &optional edit)
10024 "Import an arbitrary file into a mail newsgroup."
10025 (interactive "fImport file: \nP")
10026 (let ((group gnus-newsgroup-name)
10027 (now (current-time))
10028 atts lines group-art)
10029 (unless (gnus-check-backend-function 'request-accept-article group)
10030 (error "%s does not support article importing" group))
10031 (or (file-readable-p file)
10032 (not (file-regular-p file))
10033 (error "Can't read %s" file))
10034 (with-current-buffer (gnus-get-buffer-create " *import file*")
10036 (nnheader-insert-file-contents file)
10037 (goto-char (point-min))
10038 (if (nnheader-article-p)
10040 (goto-char (point-min))
10041 (search-forward "\n\n" nil t)
10042 (narrow-to-region (point-min) (1- (point)))
10043 (goto-char (point-min))
10044 (unless (re-search-forward "^date:" nil t)
10045 (goto-char (point-max))
10046 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
10047 ;; This doesn't look like an article, so we fudge some headers.
10048 (setq atts (file-attributes file)
10049 lines (count-lines (point-min) (point-max)))
10050 (insert "From: " (read-string "From: ") "\n"
10051 "Subject: " (read-string "Subject: ") "\n"
10052 "Date: " (message-make-date (nth 5 atts)) "\n"
10053 "Message-ID: " (message-make-message-id) "\n"
10054 "Lines: " (int-to-string lines) "\n"
10055 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
10056 (setq group-art (gnus-request-accept-article group nil t))
10057 (kill-buffer (current-buffer)))
10058 (setq gnus-newsgroup-active (gnus-activate-group group))
10060 (gnus-summary-goto-article (cdr group-art) nil t)
10062 (gnus-summary-edit-article))))
10064 (defun gnus-summary-create-article ()
10065 "Create an article in a mail newsgroup."
10067 (let ((group gnus-newsgroup-name)
10068 (now (current-time))
10070 (unless (gnus-check-backend-function 'request-accept-article group)
10071 (error "%s does not support article importing" group))
10072 (with-current-buffer (gnus-get-buffer-create " *import file*")
10074 (goto-char (point-min))
10075 ;; This doesn't look like an article, so we fudge some headers.
10076 (insert "From: " (read-string "From: ") "\n"
10077 "Subject: " (read-string "Subject: ") "\n"
10078 "Date: " (message-make-date now) "\n"
10079 "Message-ID: " (message-make-message-id) "\n")
10080 (setq group-art (gnus-request-accept-article group nil t))
10081 (kill-buffer (current-buffer)))
10082 (setq gnus-newsgroup-active (gnus-activate-group group))
10084 (gnus-summary-goto-article (cdr group-art) nil t)
10085 (gnus-summary-edit-article)))
10087 (defun gnus-summary-article-posted-p ()
10088 "Say whether the current (mail) article is available from news as well.
10089 This will be the case if the article has both been mailed and posted."
10091 (let ((id (mail-header-references (gnus-summary-article-header)))
10092 (gnus-override-method (car (gnus-refer-article-methods))))
10093 (if (gnus-request-head id "")
10094 (gnus-message 2 "The current message was found on %s"
10095 gnus-override-method)
10096 (gnus-message 2 "The current message couldn't be found on %s"
10097 gnus-override-method)
10100 (defun gnus-summary-expire-articles (&optional now)
10101 "Expire all articles that are marked as expirable in the current group."
10103 (when (and (not gnus-group-is-exiting-without-update-p)
10104 (gnus-check-backend-function
10105 'request-expire-articles gnus-newsgroup-name))
10106 ;; This backend supports expiry.
10107 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
10108 (expirable (if total
10110 ;; We need to update the info for
10111 ;; this group for `gnus-list-of-read-articles'
10112 ;; to give us the right answer.
10113 (gnus-run-hooks 'gnus-exit-group-hook)
10114 (gnus-summary-update-info)
10115 (gnus-list-of-read-articles gnus-newsgroup-name))
10116 (setq gnus-newsgroup-expirable
10117 (sort gnus-newsgroup-expirable '<))))
10118 (expiry-wait (if now 'immediate
10119 (gnus-group-find-parameter
10120 gnus-newsgroup-name 'expiry-wait)))
10121 (nnmail-expiry-target
10122 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
10123 nnmail-expiry-target))
10126 ;; There are expirable articles in this group, so we run them
10127 ;; through the expiry process.
10128 (gnus-message 6 "Expiring articles...")
10129 (unless (gnus-check-group gnus-newsgroup-name)
10130 (error "Can't open server for %s" gnus-newsgroup-name))
10131 ;; The list of articles that weren't expired is returned.
10134 (let ((nnmail-expiry-wait-function nil)
10135 (nnmail-expiry-wait expiry-wait))
10136 (setq es (gnus-request-expire-articles
10137 expirable gnus-newsgroup-name)))
10138 (setq es (gnus-request-expire-articles
10139 expirable gnus-newsgroup-name)))
10141 (setq gnus-newsgroup-expirable es))
10142 ;; We go through the old list of expirable, and mark all
10143 ;; really expired articles as nonexistent.
10144 (unless (eq es expirable) ;If nothing was expired, we don't mark.
10145 (let ((gnus-use-cache nil))
10146 (dolist (article expirable)
10147 (when (and (not (memq article es))
10148 (gnus-data-find article))
10149 (gnus-summary-mark-article article gnus-canceled-mark)
10150 (run-hook-with-args 'gnus-summary-article-expire-hook
10153 (assoc article (gnus-data-list nil)))
10154 gnus-newsgroup-name
10157 (gnus-message 6 "Expiring articles...done")))))
10159 (defun gnus-summary-expire-articles-now ()
10160 "Expunge all expirable articles in the current group.
10161 This means that *all* articles that are marked as expirable will be
10162 deleted forever, right now."
10164 (or gnus-expert-user
10166 "Are you really, really sure you want to delete all expirable messages? ")
10168 (gnus-summary-expire-articles t))
10170 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10171 (defun gnus-summary-delete-article (&optional n)
10172 "Delete the N next (mail) articles.
10173 This command actually deletes articles. This is not a marking
10174 command. The article will disappear forever from your life, never to
10177 If N is negative, delete backwards.
10178 If N is nil and articles have been marked with the process mark,
10179 delete these instead.
10181 If `gnus-novice-user' is non-nil you will be asked for
10182 confirmation before the articles are deleted."
10184 (unless (gnus-check-backend-function 'request-expire-articles
10185 gnus-newsgroup-name)
10186 (error "The current newsgroup does not support article deletion"))
10187 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
10188 (error "Couldn't open server"))
10189 ;; Compute the list of articles to delete.
10190 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
10191 (nnmail-expiry-target 'delete)
10193 (if (and gnus-novice-user
10194 (not (gnus-yes-or-no-p
10195 (format "Do you really want to delete %s forever? "
10196 (if (> (length articles) 1)
10197 (format "these %s articles" (length articles))
10198 "this article")))))
10200 ;; Delete the articles.
10201 (setq not-deleted (gnus-request-expire-articles
10202 articles gnus-newsgroup-name 'force))
10205 (gnus-summary-remove-process-mark (car articles))
10206 ;; The backend might not have been able to delete the article
10208 (unless (memq (car articles) not-deleted)
10209 (gnus-summary-mark-article (car articles) gnus-canceled-mark)
10210 (let* ((article (car articles))
10211 (ghead (gnus-data-header
10212 (assoc article (gnus-data-list nil)))))
10213 (run-hook-with-args 'gnus-summary-article-delete-hook
10214 'delete ghead gnus-newsgroup-name nil
10216 (setq articles (cdr articles))))
10218 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10219 (gnus-summary-position-point)
10220 (gnus-set-mode-line 'summary)
10223 (defun gnus-summary-edit-article (&optional arg)
10224 "Edit the current article.
10225 This will have permanent effect only in mail groups.
10226 If ARG is nil, edit the decoded articles.
10227 If ARG is 1, edit the raw articles.
10228 If ARG is 2, edit the raw articles even in read-only groups.
10229 If ARG is 3, edit the articles with the current handles.
10230 Otherwise, allow editing of articles even in read-only
10233 (let (force raw current-handles)
10242 (setq current-handles
10243 (and (gnus-buffer-live-p gnus-article-buffer)
10244 (with-current-buffer gnus-article-buffer
10246 gnus-article-mime-handles
10247 (setq gnus-article-mime-handles nil))))))
10250 (when (and raw (not force)
10251 (member gnus-newsgroup-name '("nndraft:delayed"
10254 (error "Can't edit the raw article in group %s"
10255 gnus-newsgroup-name))
10256 (with-current-buffer gnus-summary-buffer
10257 (let ((mail-parse-charset gnus-newsgroup-charset)
10258 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
10259 (gnus-set-global-variables)
10260 (when (and (not force)
10261 (gnus-group-read-only-p))
10262 (error "The current newsgroup does not support article editing"))
10263 (gnus-summary-show-article t)
10264 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
10265 (with-current-buffer gnus-article-buffer
10266 (mm-enable-multibyte)))
10267 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10269 (gnus-article-edit-article
10272 (let ((mbl mml-buffer-list))
10273 (setq mml-buffer-list nil)
10274 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10275 (mime-to-mml ,'current-handles))
10276 (let ((mbl1 mml-buffer-list))
10277 (setq mml-buffer-list mbl)
10278 (set (make-local-variable 'mml-buffer-list) mbl1))
10279 (gnus-make-local-hook 'kill-buffer-hook)
10280 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10281 `(lambda (no-highlight)
10282 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10283 (message-options message-options)
10284 (message-options-set-recipient)
10285 (mail-parse-ignored-charsets
10286 ',gnus-newsgroup-ignored-charsets)
10287 (rfc2047-header-encoding-alist
10288 ',(let ((charset (gnus-group-name-charset
10289 (gnus-find-method-for-group
10290 gnus-newsgroup-name)
10291 gnus-newsgroup-name)))
10292 (append (list (cons "Newsgroups" charset)
10293 (cons "Followup-To" charset)
10294 (cons "Xref" charset))
10295 rfc2047-header-encoding-alist))))
10296 ,(if (not raw) '(progn
10298 (mml-destroy-buffers)
10299 (remove-hook 'kill-buffer-hook
10300 'mml-destroy-buffers t)
10301 (kill-local-variable 'mml-buffer-list)))
10302 (gnus-summary-edit-article-done
10303 ,(or (mail-header-references gnus-current-headers) "")
10304 ,(gnus-group-read-only-p)
10305 ,gnus-summary-buffer no-highlight))))))))
10307 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10309 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10311 "Make edits to the current article permanent."
10314 ;; The buffer restriction contains the entire article if it exists.
10315 (when (article-goto-body)
10316 (let ((lines (count-lines (point) (point-max)))
10317 (length (- (point-max) (point)))
10318 (case-fold-search t)
10319 (body (copy-marker (point))))
10320 (goto-char (point-min))
10321 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10322 (delete-region (match-beginning 1) (match-end 1))
10323 (insert (number-to-string length)))
10324 (goto-char (point-min))
10325 (when (re-search-forward
10326 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10327 (delete-region (match-beginning 1) (match-end 1))
10328 (insert (number-to-string length)))
10329 (goto-char (point-min))
10330 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10331 (delete-region (match-beginning 1) (match-end 1))
10332 (insert (number-to-string lines))))))
10333 ;; Replace the article.
10334 (let ((buf (current-buffer))
10335 (article (cdr gnus-article-current))
10338 (insert-buffer-substring buf)
10339 (if (and (not read-only)
10340 (not (setq replace-result
10341 (gnus-request-replace-article
10342 article (car gnus-article-current)
10343 (current-buffer) t))))
10344 (error "Couldn't replace article")
10345 ;; If we got a number back, then that's the new article number
10346 ;; for this article. Otherwise, the article number didn't change.
10347 (when (numberp replace-result)
10348 (with-current-buffer gnus-summary-buffer
10349 (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
10350 (gnus-summary-limit gnus-newsgroup-limit)
10351 (setq article replace-result)
10352 (gnus-summary-goto-subject article t)))
10353 ;; Update the summary buffer.
10354 (if (and references
10355 (equal (message-tokenize-header references " ")
10356 (message-tokenize-header
10357 (or (message-fetch-field "references") "") " ")))
10358 ;; We only have to update this line.
10361 (message-narrow-to-head)
10362 (let ((head (buffer-substring-no-properties
10363 (point-min) (point-max)))
10366 (insert (format "211 %d Article retrieved.\n" article))
10369 (let ((nntp-server-buffer (current-buffer)))
10370 (setq header (car (gnus-get-newsgroup-headers nil t))))
10371 (with-current-buffer gnus-summary-buffer
10372 (gnus-data-set-header (gnus-data-find article) header)
10373 (gnus-summary-update-article-line article header)
10374 (if (gnus-summary-goto-subject article nil t)
10375 (gnus-summary-update-secondary-mark article)))))))
10377 (set-buffer (or buffer gnus-summary-buffer))
10378 (gnus-summary-update-article article)
10379 (if (gnus-summary-goto-subject article nil t)
10380 (gnus-summary-update-secondary-mark article)))
10381 ;; Prettify the article buffer again.
10382 (unless no-highlight
10383 (with-current-buffer gnus-article-buffer
10384 ;;!!! Fix this -- article should be rehighlighted.
10385 ;;(gnus-run-hooks 'gnus-article-display-hook)
10386 (set-buffer gnus-original-article-buffer)
10387 (gnus-request-article
10388 article (car gnus-article-current) (current-buffer))))
10389 ;; Prettify the summary buffer line.
10390 (when (gnus-visual-p 'summary-highlight 'highlight)
10391 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10393 (defun gnus-summary-edit-wash (key)
10394 "Perform editing command KEY in the article buffer."
10398 (message "%s" (concat (this-command-keys) "- "))
10401 (gnus-summary-edit-article)
10402 (execute-kbd-macro (concat (this-command-keys) key))
10403 (gnus-article-edit-done))
10407 (defun gnus-summary-respool-query (&optional silent trace)
10408 "Query where the respool algorithm would put this article."
10410 (let (gnus-mark-article-hook)
10411 (gnus-summary-select-article)
10412 (with-current-buffer gnus-original-article-buffer
10413 (let ((groups (nnmail-article-group 'identity trace)))
10416 (message "This message would go to %s"
10417 (mapconcat 'car groups ", "))
10418 (message "This message would go to no groups"))
10421 (defun gnus-summary-respool-trace ()
10422 "Trace where the respool algorithm would put this article.
10423 Display a buffer showing all fancy splitting patterns which matched."
10425 (gnus-summary-respool-query nil t))
10427 ;; Summary marking commands.
10429 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10430 "Mark articles which has the same subject as read, and then select the next.
10431 If UNMARK is positive, remove any kind of mark.
10432 If UNMARK is negative, tick articles."
10435 (setq unmark (prefix-numeric-value unmark)))
10437 (gnus-summary-mark-same-subject
10438 (gnus-summary-article-subject) unmark)))
10439 ;; Select next unread article. If auto-select-same mode, should
10440 ;; select the first unread article.
10441 (gnus-summary-next-article t (and gnus-auto-select-same
10442 (gnus-summary-article-subject)))
10443 (gnus-message 7 "%d article%s marked as %s"
10444 count (if (= count 1) " is" "s are")
10445 (if unmark "unread" "read"))))
10447 (defun gnus-summary-kill-same-subject (&optional unmark)
10448 "Mark articles which has the same subject as read.
10449 If UNMARK is positive, remove any kind of mark.
10450 If UNMARK is negative, tick articles."
10453 (setq unmark (prefix-numeric-value unmark)))
10455 (gnus-summary-mark-same-subject
10456 (gnus-summary-article-subject) unmark)))
10457 ;; If marked as read, go to next unread subject.
10458 (when (null unmark)
10459 ;; Go to next unread subject.
10460 (gnus-summary-next-subject 1 t))
10461 (gnus-message 7 "%d articles are marked as %s"
10462 count (if unmark "unread" "read"))))
10464 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10465 "Mark articles with same SUBJECT as read, and return marked number.
10466 If optional argument UNMARK is positive, remove any kinds of marks.
10467 If optional argument UNMARK is negative, mark articles as unread instead."
10471 ((null unmark) ; Mark as read.
10474 (gnus-summary-mark-article-as-read gnus-killed-mark)
10475 (gnus-summary-show-thread) t)
10476 (gnus-summary-find-subject subject))
10477 (setq count (1+ count))))
10478 ((> unmark 0) ; Tick.
10481 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10482 (gnus-summary-show-thread) t)
10483 (gnus-summary-find-subject subject))
10484 (setq count (1+ count))))
10485 (t ; Mark as unread.
10488 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10489 (gnus-summary-show-thread) t)
10490 (gnus-summary-find-subject subject))
10491 (setq count (1+ count)))))
10492 (gnus-set-mode-line 'summary)
10493 ;; Return the number of marked articles.
10496 (defun gnus-summary-mark-as-processable (n &optional unmark)
10497 "Set the process mark on the next N articles.
10498 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10499 the process mark instead. The difference between N and the actual
10500 number of articles marked is returned."
10502 (if (and (null n) (gnus-region-active-p))
10503 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10504 (setq n (prefix-numeric-value n))
10505 (let ((backward (< n 0))
10510 (gnus-summary-remove-process-mark
10511 (gnus-summary-article-number))
10512 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10513 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10516 (gnus-message 7 "No more articles"))
10517 (gnus-summary-recenter)
10518 (gnus-summary-position-point)
10521 (defun gnus-summary-unmark-as-processable (n)
10522 "Remove the process mark from the next N articles.
10523 If N is negative, unmark backward instead. The difference between N and
10524 the actual number of articles unmarked is returned."
10526 (gnus-summary-mark-as-processable n t))
10528 (defun gnus-summary-unmark-all-processable ()
10529 "Remove the process mark from all articles."
10532 (while gnus-newsgroup-processable
10533 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10534 (gnus-summary-position-point))
10536 (defun gnus-summary-add-mark (article type)
10537 "Mark ARTICLE with a mark of TYPE."
10538 (let ((vtype (car (assq type gnus-article-mark-lists)))
10541 (error "No such mark type: %s" type)
10542 (setq var (intern (format "gnus-newsgroup-%s" type)))
10543 (set var (cons article (symbol-value var)))
10544 (if (memq type '(processable cached replied forwarded recent saved))
10545 (gnus-summary-update-secondary-mark article)
10546 ;;; !!! This is bogus. We should find out what primary
10547 ;;; !!! mark we want to set.
10548 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10550 (defun gnus-summary-mark-as-expirable (n)
10551 "Mark N articles forward as expirable.
10552 If N is negative, mark backward instead. The difference between N and
10553 the actual number of articles marked is returned."
10555 (gnus-summary-mark-forward n gnus-expirable-mark))
10557 (defun gnus-summary-mark-as-spam (n)
10558 "Mark N articles forward as spam.
10559 If N is negative, mark backward instead. The difference between N and
10560 the actual number of articles marked is returned."
10562 (gnus-summary-mark-forward n gnus-spam-mark))
10564 (defun gnus-summary-mark-article-as-replied (article)
10565 "Mark ARTICLE as replied to and update the summary line.
10566 ARTICLE can also be a list of articles."
10567 (interactive (list (gnus-summary-article-number)))
10568 (let ((articles (if (listp article) article (list article))))
10569 (dolist (article articles)
10570 (unless (numberp article)
10571 (error "%s is not a number" article))
10572 (push article gnus-newsgroup-replied)
10573 (let ((inhibit-read-only t))
10574 (when (gnus-summary-goto-subject article nil t)
10575 (gnus-summary-update-secondary-mark article))))))
10577 (defun gnus-summary-mark-article-as-forwarded (article)
10578 "Mark ARTICLE as forwarded and update the summary line.
10579 ARTICLE can also be a list of articles."
10580 (let ((articles (if (listp article) article (list article))))
10581 (dolist (article articles)
10582 (push article gnus-newsgroup-forwarded)
10583 (let ((inhibit-read-only t))
10584 (when (gnus-summary-goto-subject article nil t)
10585 (gnus-summary-update-secondary-mark article))))))
10587 (defun gnus-summary-set-bookmark (article)
10588 "Set a bookmark in current article."
10589 (interactive (list (gnus-summary-article-number)))
10590 (when (or (not (get-buffer gnus-article-buffer))
10591 (not gnus-current-article)
10592 (not gnus-article-current)
10593 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10594 (error "No current article selected"))
10595 ;; Remove old bookmark, if one exists.
10596 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10597 ;; Set the new bookmark, which is on the form
10598 ;; (article-number . line-number-in-body).
10601 (with-current-buffer gnus-article-buffer
10605 (article-goto-body)
10608 gnus-newsgroup-bookmarks)
10609 (gnus-message 6 "A bookmark has been added to the current article."))
10611 (defun gnus-summary-remove-bookmark (article)
10612 "Remove the bookmark from the current article."
10613 (interactive (list (gnus-summary-article-number)))
10614 ;; Remove old bookmark, if one exists.
10615 (if (not (assq article gnus-newsgroup-bookmarks))
10616 (gnus-message 6 "No bookmark in current article.")
10617 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10618 (gnus-message 6 "Removed bookmark.")))
10620 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10621 (defun gnus-summary-mark-as-dormant (n)
10622 "Mark N articles forward as dormant.
10623 If N is negative, mark backward instead. The difference between N and
10624 the actual number of articles marked is returned."
10626 (gnus-summary-mark-forward n gnus-dormant-mark))
10628 (defun gnus-summary-set-process-mark (article)
10629 "Set the process mark on ARTICLE and update the summary line."
10630 (setq gnus-newsgroup-processable
10632 (delq article gnus-newsgroup-processable)))
10633 (when (gnus-summary-goto-subject article)
10634 (gnus-summary-show-thread)
10635 (gnus-summary-goto-subject article)
10636 (gnus-summary-update-secondary-mark article)))
10638 (defun gnus-summary-remove-process-mark (&rest articles)
10639 "Remove the process mark from ARTICLES and update the summary line."
10640 (dolist (article articles)
10641 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10642 (when (gnus-summary-goto-subject article)
10643 (gnus-summary-show-thread)
10644 (gnus-summary-goto-subject article)
10645 (gnus-summary-update-secondary-mark article)))
10648 (defun gnus-summary-set-saved-mark (article)
10649 "Set the process mark on ARTICLE and update the summary line."
10650 (push article gnus-newsgroup-saved)
10651 (when (gnus-summary-goto-subject article)
10652 (gnus-summary-update-secondary-mark article)))
10654 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10655 "Mark N articles as read forwards.
10656 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10657 The difference between N and the actual number of articles marked is
10659 If NO-EXPIRE, auto-expiry will be inhibited."
10661 (gnus-summary-show-thread)
10662 (let ((backward (< n 0))
10663 (gnus-summary-goto-unread
10664 (and gnus-summary-goto-unread
10665 (not (eq gnus-summary-goto-unread 'never))
10666 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10667 gnus-ticked-mark gnus-dormant-mark)))))
10669 (mark (or mark gnus-del-mark)))
10670 (while (and (> n 0)
10671 (gnus-summary-mark-article nil mark no-expire)
10672 (zerop (gnus-summary-next-subject
10674 (and gnus-summary-goto-unread
10675 (not (eq gnus-summary-goto-unread 'never)))
10679 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10680 (gnus-summary-recenter)
10681 (gnus-summary-position-point)
10682 (gnus-set-mode-line 'summary)
10685 (defun gnus-summary-mark-article-as-read (mark)
10686 "Mark the current article quickly as read with MARK."
10687 (let ((article (gnus-summary-article-number)))
10688 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10689 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10690 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10691 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10692 (push (cons article mark) gnus-newsgroup-reads)
10693 ;; Possibly remove from cache, if that is used.
10694 (when gnus-use-cache
10695 (gnus-cache-enter-remove-article article))
10696 ;; Allow the backend to change the mark.
10697 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10698 ;; Check for auto-expiry.
10699 (when (and gnus-newsgroup-auto-expire
10700 (memq mark gnus-auto-expirable-marks))
10701 (setq mark gnus-expirable-mark)
10702 ;; Let the backend know about the mark change.
10703 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10704 (push article gnus-newsgroup-expirable))
10705 ;; Set the mark in the buffer.
10706 (gnus-summary-update-mark mark 'unread)
10709 (defun gnus-summary-mark-article-as-unread (mark)
10710 "Mark the current article quickly as unread with MARK."
10711 (let* ((article (gnus-summary-article-number))
10712 (old-mark (gnus-summary-article-mark article)))
10713 ;; Allow the backend to change the mark.
10714 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10715 (if (eq mark old-mark)
10719 (gnus-error 1 "Can't mark negative article numbers")
10721 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10722 (setq gnus-newsgroup-spam-marked
10723 (delq article gnus-newsgroup-spam-marked))
10724 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10725 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10726 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10727 (cond ((= mark gnus-ticked-mark)
10728 (setq gnus-newsgroup-marked
10729 (gnus-add-to-sorted-list gnus-newsgroup-marked
10731 ((= mark gnus-spam-mark)
10732 (setq gnus-newsgroup-spam-marked
10733 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10735 ((= mark gnus-dormant-mark)
10736 (setq gnus-newsgroup-dormant
10737 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10740 (setq gnus-newsgroup-unreads
10741 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10743 (gnus-alist-pull article gnus-newsgroup-reads)
10745 ;; See whether the article is to be put in the cache.
10746 (and gnus-use-cache
10747 (vectorp (gnus-summary-article-header article))
10749 (gnus-cache-possibly-enter-article
10750 gnus-newsgroup-name article
10751 (= mark gnus-ticked-mark)
10752 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10755 (gnus-summary-update-mark mark 'unread)
10758 (defun gnus-summary-mark-article (&optional article mark no-expire)
10759 "Mark ARTICLE with MARK. MARK can be any character.
10760 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10761 `??' (dormant) and `?E' (expirable).
10762 If MARK is nil, then the default character `?r' is used.
10763 If ARTICLE is nil, then the article on the current line will be
10765 If NO-EXPIRE, auto-expiry will be inhibited."
10766 ;; The mark might be a string.
10767 (when (stringp mark)
10768 (setq mark (aref mark 0)))
10769 ;; If no mark is given, then we check auto-expiring.
10771 (setq mark gnus-del-mark))
10772 (when (and (not no-expire)
10773 gnus-newsgroup-auto-expire
10774 (memq mark gnus-auto-expirable-marks))
10775 (setq mark gnus-expirable-mark))
10776 (let ((article (or article (gnus-summary-article-number)))
10777 (old-mark (gnus-summary-article-mark article)))
10778 ;; Allow the backend to change the mark.
10779 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10780 (if (eq mark old-mark)
10783 (error "No article on current line"))
10784 (if (not (if (or (= mark gnus-unread-mark)
10785 (= mark gnus-ticked-mark)
10786 (= mark gnus-spam-mark)
10787 (= mark gnus-dormant-mark))
10788 (gnus-mark-article-as-unread article mark)
10789 (gnus-mark-article-as-read article mark)))
10791 ;; See whether the article is to be put in the cache.
10792 (and gnus-use-cache
10793 (not (= mark gnus-canceled-mark))
10794 (vectorp (gnus-summary-article-header article))
10796 (gnus-cache-possibly-enter-article
10797 gnus-newsgroup-name article
10798 (= mark gnus-ticked-mark)
10799 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10801 (when (gnus-summary-goto-subject article nil t)
10802 (let ((inhibit-read-only t))
10803 (gnus-summary-show-thread)
10805 (gnus-summary-update-mark mark 'unread)
10808 (defun gnus-summary-update-secondary-mark (article)
10809 "Update the secondary (read, process, cache) mark."
10810 (gnus-summary-update-mark
10811 (cond ((memq article gnus-newsgroup-processable)
10813 ((memq article gnus-newsgroup-cached)
10815 ((memq article gnus-newsgroup-replied)
10817 ((memq article gnus-newsgroup-forwarded)
10818 gnus-forwarded-mark)
10819 ((memq article gnus-newsgroup-saved)
10821 ((memq article gnus-newsgroup-recent)
10823 ((memq article gnus-newsgroup-unseen)
10827 (when (gnus-visual-p 'summary-highlight 'highlight)
10828 (gnus-summary-highlight-line)
10829 (gnus-run-hooks 'gnus-summary-update-hook))
10832 (defun gnus-summary-update-download-mark (article)
10833 "Update the download mark."
10834 (gnus-summary-update-mark
10835 (cond ((memq article gnus-newsgroup-undownloaded)
10836 gnus-undownloaded-mark)
10837 (gnus-newsgroup-agentized
10838 gnus-downloaded-mark)
10842 (gnus-summary-update-line t)
10845 (defun gnus-summary-update-mark (mark type)
10846 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10847 (inhibit-read-only t))
10848 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10850 (when (looking-at "\r")
10852 (when (<= (+ forward (point)) (point-max))
10853 ;; Go to the right position on the line.
10854 (goto-char (+ forward (point)))
10855 ;; Replace the old mark with the new mark.
10857 (mm-subst-char-in-string
10859 (buffer-substring (point) (1+ (point))))))
10860 (delete-region (point) (1+ (point)))
10861 (insert to-insert))
10862 ;; Optionally update the marks by some user rule.
10863 (when (eq type 'unread)
10864 (gnus-data-set-mark
10865 (gnus-data-find (gnus-summary-article-number)) mark)
10866 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10868 (defun gnus-mark-article-as-read (article &optional mark)
10869 "Enter ARTICLE in the pertinent lists and remove it from others."
10870 ;; Make the article expirable.
10871 (let ((mark (or mark gnus-del-mark)))
10872 (setq gnus-newsgroup-expirable
10873 (if (= mark gnus-expirable-mark)
10874 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10875 (delq article gnus-newsgroup-expirable)))
10876 ;; Remove from unread and marked lists.
10877 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10878 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10879 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10880 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10881 (push (cons article mark) gnus-newsgroup-reads)
10882 ;; Possibly remove from cache, if that is used.
10883 (when gnus-use-cache
10884 (gnus-cache-enter-remove-article article))
10887 (defun gnus-mark-article-as-unread (article &optional mark)
10888 "Enter ARTICLE in the pertinent lists and remove it from others."
10889 (let ((mark (or mark gnus-ticked-mark)))
10892 (gnus-error 1 "Can't mark negative article numbers")
10894 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10895 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10896 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10897 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10898 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10900 ;; Unsuppress duplicates?
10901 (when gnus-suppress-duplicates
10902 (gnus-dup-unsuppress-article article))
10904 (cond ((= mark gnus-ticked-mark)
10905 (setq gnus-newsgroup-marked
10906 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10907 ((= mark gnus-spam-mark)
10908 (setq gnus-newsgroup-spam-marked
10909 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10911 ((= mark gnus-dormant-mark)
10912 (setq gnus-newsgroup-dormant
10913 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10915 (setq gnus-newsgroup-unreads
10916 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10917 (gnus-alist-pull article gnus-newsgroup-reads)
10920 (defun gnus-summary-tick-article-forward (n)
10921 "Tick N articles forwards.
10922 If N is negative, tick backwards instead.
10923 The difference between N and the number of articles ticked is returned."
10925 (gnus-summary-mark-forward n gnus-ticked-mark))
10927 (defun gnus-summary-tick-article-backward (n)
10928 "Tick N articles backwards.
10929 The difference between N and the number of articles ticked is returned."
10931 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10933 (defun gnus-summary-tick-article (&optional article clear-mark)
10934 "Mark current article as unread.
10935 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10936 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10938 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10939 gnus-ticked-mark)))
10941 (defun gnus-summary-mark-as-read-forward (n)
10942 "Mark N articles as read forwards.
10943 If N is negative, mark backwards instead.
10944 The difference between N and the actual number of articles marked is
10947 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10949 (defun gnus-summary-mark-as-read-backward (n)
10950 "Mark the N articles as read backwards.
10951 The difference between N and the actual number of articles marked is
10954 (gnus-summary-mark-forward
10955 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10957 (defun gnus-summary-mark-as-read (&optional article mark)
10958 "Mark current article as read.
10959 ARTICLE specifies the article to be marked as read.
10960 MARK specifies a string to be inserted at the beginning of the line."
10961 (gnus-summary-mark-article article mark))
10963 (defun gnus-summary-clear-mark-forward (n)
10964 "Clear marks from N articles forward.
10965 If N is negative, clear backward instead.
10966 The difference between N and the number of marks cleared is returned."
10968 (gnus-summary-mark-forward n gnus-unread-mark))
10970 (defun gnus-summary-clear-mark-backward (n)
10971 "Clear marks from N articles backward.
10972 The difference between N and the number of marks cleared is returned."
10974 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10976 (defun gnus-summary-mark-unread-as-read ()
10977 "Intended to be used by `gnus-mark-article-hook'."
10978 (when (memq gnus-current-article gnus-newsgroup-unreads)
10979 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10981 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10982 "Intended to be used by `gnus-mark-article-hook'."
10983 (let ((mark (gnus-summary-article-mark)))
10984 (when (or (gnus-unread-mark-p mark)
10985 (gnus-read-mark-p mark))
10986 (gnus-summary-mark-article gnus-current-article
10987 (or new-mark gnus-read-mark)))))
10989 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10990 "Intended to be used by `gnus-mark-article-hook'."
10991 (let ((mark (gnus-summary-article-mark)))
10992 (when (or (gnus-unread-mark-p mark)
10993 (gnus-read-mark-p mark))
10994 (gnus-summary-mark-article (gnus-summary-article-number)
10995 (or new-mark gnus-read-mark)))))
10997 (defun gnus-summary-mark-unread-as-ticked ()
10998 "Intended to be used by `gnus-mark-article-hook'."
10999 (when (memq gnus-current-article gnus-newsgroup-unreads)
11000 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
11002 (defun gnus-summary-mark-region-as-read (point mark all)
11003 "Mark all unread articles between point and mark as read.
11004 If given a prefix, mark all articles between point and mark as read,
11005 even ticked and dormant ones."
11006 (interactive "r\nP")
11010 (beginning-of-line)
11015 (memq (setq article (gnus-summary-article-number))
11016 gnus-newsgroup-unreads))
11017 (gnus-summary-mark-article article gnus-del-mark))
11019 (gnus-summary-find-next))))))
11021 (defun gnus-summary-mark-below (score mark)
11022 "Mark articles with score less than SCORE with MARK."
11023 (interactive "P\ncMark: ")
11024 (setq score (if score
11025 (prefix-numeric-value score)
11026 (or gnus-summary-default-score 0)))
11027 (with-current-buffer gnus-summary-buffer
11028 (goto-char (point-min))
11031 (and (< (gnus-summary-article-score) score)
11032 (gnus-summary-mark-article nil mark))
11033 (gnus-summary-find-next)))))
11035 (defun gnus-summary-kill-below (&optional score)
11036 "Mark articles with score below SCORE as read."
11038 (gnus-summary-mark-below score gnus-killed-mark))
11040 (defun gnus-summary-clear-above (&optional score)
11041 "Clear all marks from articles with score above SCORE."
11043 (gnus-summary-mark-above score gnus-unread-mark))
11045 (defun gnus-summary-tick-above (&optional score)
11046 "Tick all articles with score above SCORE."
11048 (gnus-summary-mark-above score gnus-ticked-mark))
11050 (defun gnus-summary-mark-above (score mark)
11051 "Mark articles with score over SCORE with MARK."
11052 (interactive "P\ncMark: ")
11053 (setq score (if score
11054 (prefix-numeric-value score)
11055 (or gnus-summary-default-score 0)))
11056 (with-current-buffer gnus-summary-buffer
11057 (goto-char (point-min))
11059 (when (> (gnus-summary-article-score) score)
11060 (gnus-summary-mark-article nil mark))
11062 (gnus-summary-find-next)))))
11064 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
11065 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
11066 (defun gnus-summary-limit-include-expunged (&optional no-error)
11067 "Display all the hidden articles that were expunged for low scores."
11069 (let ((inhibit-read-only t))
11070 (let ((scored gnus-newsgroup-scored)
11073 (unless (gnus-summary-article-header (caar scored))
11074 (and (setq h (gnus-number-to-header (caar scored)))
11075 (< (cdar scored) gnus-summary-expunge-below)
11077 (setq scored (cdr scored)))
11079 (when (not no-error)
11080 (error "No expunged articles hidden"))
11081 (goto-char (point-min))
11082 (push gnus-newsgroup-limit gnus-newsgroup-limits)
11083 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
11084 (dolist (x headers)
11085 (push (mail-header-number x) gnus-newsgroup-limit))
11086 (gnus-summary-prepare-unthreaded (nreverse headers))
11087 (goto-char (point-min))
11088 (gnus-summary-position-point)
11091 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
11092 "Mark all unread articles in this newsgroup as read.
11093 If prefix argument ALL is non-nil, ticked and dormant articles will
11094 also be marked as read.
11095 If QUIETLY is non-nil, no questions will be asked.
11097 If TO-HERE is non-nil, it should be a point in the buffer. All
11098 articles before (after, if REVERSE is set) this point will be marked
11101 Note that this function will only catch up the unread article
11102 in the current summary buffer limitation.
11104 The number of articles marked as read is returned."
11109 (not gnus-interactive-catchup) ;Without confirmation?
11113 "Mark absolutely all articles as read? "
11114 "Mark all unread articles as read? ")))
11116 (not gnus-newsgroup-adaptive)
11117 (not gnus-newsgroup-auto-expire)
11118 (not gnus-suppress-duplicates)
11119 (or (not gnus-use-cache)
11120 (eq gnus-use-cache 'passive)))
11123 (setq gnus-newsgroup-marked nil
11124 gnus-newsgroup-spam-marked nil
11125 gnus-newsgroup-dormant nil))
11126 (setq gnus-newsgroup-unreads
11127 (gnus-sorted-nunion
11128 (gnus-sorted-intersection gnus-newsgroup-unreads
11129 gnus-newsgroup-downloadable)
11130 (gnus-sorted-difference gnus-newsgroup-unfetched
11131 gnus-newsgroup-cached))))
11132 ;; We actually mark all articles as canceled, which we
11133 ;; have to do when using auto-expiry or adaptive scoring.
11134 (gnus-summary-show-all-threads)
11135 (if (and to-here reverse)
11137 (goto-char to-here)
11138 (gnus-summary-mark-current-read-and-unread-as-read
11140 (while (gnus-summary-find-next (not all))
11141 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
11142 (when (gnus-summary-first-subject (not all))
11144 (if to-here (< (point) to-here) t)
11145 (gnus-summary-mark-article-as-read gnus-catchup-mark)
11146 (gnus-summary-find-next (not all))))))
11147 (gnus-set-mode-line 'summary))
11149 (gnus-summary-position-point)))
11151 (defun gnus-summary-catchup-to-here (&optional all)
11152 "Mark all unticked articles before the current one as read.
11153 If ALL is non-nil, also mark ticked and dormant articles as read."
11156 (gnus-save-hidden-threads
11157 (let ((beg (point)))
11158 ;; We check that there are unread articles.
11159 (when (or all (gnus-summary-find-prev))
11160 (gnus-summary-catchup all t beg)))))
11161 (gnus-summary-position-point))
11163 (defun gnus-summary-catchup-from-here (&optional all)
11164 "Mark all unticked articles after (and including) the current one as read.
11165 If ALL is non-nil, also mark ticked and dormant articles as read."
11168 (gnus-save-hidden-threads
11169 (let ((beg (point)))
11170 ;; We check that there are unread articles.
11171 (when (or all (gnus-summary-find-next))
11172 (gnus-summary-catchup all t beg nil t)))))
11173 (gnus-summary-position-point))
11175 (defun gnus-summary-catchup-all (&optional quietly)
11176 "Mark all articles in this newsgroup as read.
11177 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11178 instead, which marks only unread articles as read."
11180 (gnus-summary-catchup t quietly))
11182 (defun gnus-summary-catchup-and-exit (&optional all quietly)
11183 "Mark all unread articles in this group as read, then exit.
11184 If prefix argument ALL is non-nil, all articles are marked as read.
11185 If QUIETLY is non-nil, no questions will be asked."
11187 (when (gnus-summary-catchup all quietly nil 'fast)
11188 ;; Select next newsgroup or exit.
11189 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
11190 (eq gnus-auto-select-next 'quietly))
11191 (gnus-summary-next-group nil)
11192 (gnus-summary-exit))))
11194 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
11195 "Mark all articles in this newsgroup as read, and then exit.
11196 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11197 instead, which marks only unread articles as read."
11199 (gnus-summary-catchup-and-exit t quietly))
11201 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
11202 "Mark all articles in this group as read and select the next group.
11203 If given a prefix, mark all articles, unread as well as ticked, as
11207 (gnus-summary-catchup all))
11208 (gnus-summary-next-group))
11210 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
11211 "Mark all articles in this group as read and select the previous group.
11212 If given a prefix, mark all articles, unread as well as ticked, as
11216 (gnus-summary-catchup all))
11217 (gnus-summary-next-group nil nil t))
11223 (defmacro gnus-with-article (article &rest forms)
11224 "Select ARTICLE and perform FORMS in the original article buffer.
11225 Then replace the article with the result."
11227 ;; We don't want the article to be marked as read.
11228 (let (gnus-mark-article-hook)
11229 (gnus-summary-select-article t t nil ,article))
11230 (set-buffer gnus-original-article-buffer)
11232 (if (not (gnus-check-backend-function
11233 'request-replace-article (car gnus-article-current)))
11234 (gnus-message 5 "Read-only group; not replacing")
11235 (unless (gnus-request-replace-article
11236 ,article (car gnus-article-current)
11237 (current-buffer) t)
11238 (error "Couldn't replace article")))
11239 ;; The cache and backlog have to be flushed somewhat.
11240 (when gnus-keep-backlog
11241 (gnus-backlog-remove-article
11242 (car gnus-article-current) (cdr gnus-article-current)))
11243 (when gnus-use-cache
11244 (gnus-cache-update-article
11245 (car gnus-article-current) (cdr gnus-article-current)))))
11247 (put 'gnus-with-article 'lisp-indent-function 1)
11248 (put 'gnus-with-article 'edebug-form-spec '(form body))
11250 ;; Thread-based commands.
11252 (defun gnus-summary-articles-in-thread (&optional article)
11253 "Return a list of all articles in the current thread.
11254 If ARTICLE is non-nil, return all articles in the thread that starts
11255 with that article."
11256 (let* ((article (or article (gnus-summary-article-number)))
11257 (data (gnus-data-find-list article))
11258 (top-level (gnus-data-level (car data)))
11260 (cond ((null gnus-thread-operation-ignore-subject)
11261 (gnus-simplify-subject-re
11262 (mail-header-subject (gnus-data-header (car data)))))
11263 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
11264 (gnus-simplify-subject-fuzzy
11265 (mail-header-subject (gnus-data-header (car data)))))
11267 (end-point (save-excursion
11268 (goto-char (gnus-data-pos (car data)))
11269 (if (gnus-summary-go-to-next-thread)
11270 (point) (point-max))))
11273 (< (gnus-data-pos (car data)) end-point))
11274 (when (or (not top-subject)
11275 (string= top-subject
11276 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11277 (gnus-simplify-subject-fuzzy
11278 (mail-header-subject
11279 (gnus-data-header (car data))))
11280 (gnus-simplify-subject-re
11281 (mail-header-subject
11282 (gnus-data-header (car data)))))))
11283 (push (gnus-data-number (car data)) articles))
11284 (unless (and (setq data (cdr data))
11285 (> (gnus-data-level (car data)) top-level))
11287 ;; Return the list of articles.
11288 (nreverse articles)))
11290 (defun gnus-summary-rethread-current ()
11291 "Rethread the thread the current article is part of."
11293 (let* ((gnus-show-threads t)
11294 (article (gnus-summary-article-number))
11295 (id (mail-header-id (gnus-summary-article-header)))
11296 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11298 (error "No article on the current line"))
11299 (gnus-rebuild-thread id)
11300 (gnus-summary-goto-subject article)))
11302 (defun gnus-summary-reparent-thread ()
11303 "Make the current article child of the marked (or previous) article.
11305 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11306 is non-nil or the Subject: of both articles are the same."
11308 (unless (not (gnus-group-read-only-p))
11309 (error "The current newsgroup does not support article editing"))
11310 (unless (<= (length gnus-newsgroup-processable) 1)
11311 (error "No more than one article may be marked"))
11312 (let ((child (gnus-summary-article-number))
11313 ;; First grab the marked article, otherwise one line up.
11314 (parent (if (not (null gnus-newsgroup-processable))
11315 (car gnus-newsgroup-processable)
11317 (if (eq (forward-line -1) 0)
11318 (gnus-summary-article-number)
11319 (error "Beginning of summary buffer"))))))
11320 (gnus-summary-reparent-children parent (list child))))
11322 (defun gnus-summary-reparent-children (parent children)
11323 "Make PARENT the parent of CHILDREN.
11324 When called interactively, PARENT is the current article and CHILDREN
11325 are the process-marked articles."
11327 (list (gnus-summary-article-number)
11328 (gnus-summary-work-articles nil)))
11329 (dolist (child children)
11330 (save-window-excursion
11331 (let ((gnus-article-buffer " *reparent*"))
11332 (unless (not (eq parent child))
11333 (error "An article may not be self-referential"))
11334 (let ((message-id (mail-header-id
11335 (gnus-summary-article-header parent))))
11336 (unless (and message-id (not (equal message-id "")))
11337 (error "No message-id in desired parent"))
11338 (gnus-with-article child
11340 (goto-char (point-min))
11341 (message-narrow-to-head)
11342 (if (re-search-forward "^References: " nil t)
11344 (re-search-forward "^[^ \t]" nil t)
11347 (insert " " message-id))
11348 (insert "References: " message-id "\n"))))
11349 (set-buffer gnus-summary-buffer)
11350 (gnus-summary-unmark-all-processable)
11351 (gnus-summary-update-article child)
11352 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11353 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11354 (gnus-summary-rethread-current)
11355 (gnus-message 3 "Article %d is now the child of article %d"
11358 (defun gnus-summary-toggle-threads (&optional arg)
11359 "Toggle showing conversation threads.
11360 If ARG is positive number, turn showing conversation threads on."
11362 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11363 (setq gnus-show-threads
11364 (if (null arg) (not gnus-show-threads)
11365 (> (prefix-numeric-value arg) 0)))
11366 (gnus-summary-prepare)
11367 (gnus-summary-goto-subject current)
11368 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11369 (gnus-summary-position-point)))
11372 (if (fboundp 'remove-overlays)
11373 (defalias 'gnus-remove-overlays 'remove-overlays)
11374 (defun gnus-remove-overlays (beg end name val)
11375 "Clear BEG and END of overlays whose property NAME has value VAL.
11376 For compatibility with XEmacs."
11377 (dolist (ov (gnus-overlays-in beg end))
11378 (when (eq (gnus-overlay-get ov name) val)
11379 (gnus-delete-overlay ov))))))
11381 (defun gnus-summary-show-all-threads ()
11382 "Show all threads."
11384 (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
11385 (gnus-summary-position-point))
11387 (defsubst gnus-summary--inv (p)
11388 (and (eq (get-char-property p 'invisible) 'gnus-sum) p))
11390 (defun gnus-summary-show-thread ()
11391 "Show thread subtrees.
11392 Returns nil if no thread was there to be shown."
11394 (let* ((orig (point))
11395 (end (point-at-eol))
11396 (end (or (gnus-summary--inv end) (gnus-summary--inv (1- end))))
11397 ;; Leave point at bol
11398 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11400 (if (fboundp 'next-single-char-property-change)
11401 (or (next-single-char-property-change end 'invisible)
11406 (eq (get-char-property (point) 'invisible)
11410 (gnus-remove-overlays beg eoi 'invisible 'gnus-sum)
11412 (gnus-summary-position-point)
11415 (defun gnus-summary-maybe-hide-threads ()
11416 "If requested, hide the threads that should be hidden."
11417 (when (and gnus-show-threads
11418 gnus-thread-hide-subtree)
11419 (gnus-summary-hide-all-threads
11420 (if (or (consp gnus-thread-hide-subtree)
11421 (functionp gnus-thread-hide-subtree))
11422 (gnus-make-predicate gnus-thread-hide-subtree)
11425 ;;; Hiding predicates.
11427 (defun gnus-article-unread-p (header)
11428 (memq (mail-header-number header) gnus-newsgroup-unreads))
11430 (defun gnus-article-unseen-p (header)
11431 (memq (mail-header-number header) gnus-newsgroup-unseen))
11433 (defun gnus-map-articles (predicate articles)
11434 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11435 (apply 'gnus-or (mapcar predicate
11436 (mapcar (lambda (number)
11437 (gnus-summary-article-header number))
11440 (defun gnus-summary-hide-all-threads (&optional predicate)
11441 "Hide all thread subtrees.
11442 If PREDICATE is supplied, threads that satisfy this predicate
11443 will not be hidden."
11446 (goto-char (point-min))
11449 (when (or (not predicate)
11451 predicate (gnus-summary-article-children)))
11452 (gnus-summary-hide-thread))
11453 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11454 (gnus-summary-position-point))
11456 (defun gnus-summary-hide-thread ()
11457 "Hide thread subtrees.
11458 If PREDICATE is supplied, threads that satisfy this predicate
11459 will not be hidden.
11460 Returns nil if no threads were there to be hidden."
11462 (let ((start (point))
11463 (starteol (line-end-position))
11464 (article (gnus-summary-article-number)))
11466 ;; Go forward until either the buffer ends or the subthread ends.
11467 (when (and (not (eobp))
11468 (or (zerop (gnus-summary-next-thread 1 t))
11469 (goto-char (point-max))))
11470 (if (and (> (point) start)
11471 ;; FIXME: this should actually search for a non-invisible \n.
11472 (search-backward "\n" start t))
11474 (when (> (point) starteol)
11475 (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum)
11476 (let ((ol (gnus-make-overlay starteol (point) nil t nil)))
11477 (gnus-overlay-put ol 'invisible 'gnus-sum)
11478 (gnus-overlay-put ol 'evaporate t)))
11479 (gnus-summary-goto-subject article))
11483 (defun gnus-summary-go-to-next-thread (&optional previous)
11484 "Go to the same level (or less) next thread.
11485 If PREVIOUS is non-nil, go to previous thread instead.
11486 Return the article number moved to, or nil if moving was impossible."
11487 (let ((level (gnus-summary-thread-level))
11488 (way (if previous -1 1))
11491 (while (and (not (eobp))
11492 (< level (gnus-summary-thread-level)))
11493 (forward-line way))
11500 (gnus-summary-article-number)
11501 (goto-char beg)))))
11503 (defun gnus-summary-next-thread (n &optional silent)
11504 "Go to the same level next N'th thread.
11505 If N is negative, search backward instead.
11506 Returns the difference between N and the number of skips actually
11509 If SILENT, don't output messages."
11511 (let ((backward (< n 0))
11513 (while (and (> n 0)
11514 (gnus-summary-go-to-next-thread backward))
11517 (gnus-summary-position-point))
11518 (when (and (not silent) (/= 0 n))
11519 (gnus-message 7 "No more threads"))
11522 (defun gnus-summary-prev-thread (n)
11523 "Go to the same level previous N'th thread.
11524 Returns the difference between N and the number of skips actually
11527 (gnus-summary-next-thread (- n)))
11529 (defun gnus-summary-go-down-thread ()
11530 "Go down one level in the current thread."
11531 (let ((children (gnus-summary-article-children)))
11533 (gnus-summary-goto-subject (car children)))))
11535 (defun gnus-summary-go-up-thread ()
11536 "Go up one level in the current thread."
11537 (let ((parent (gnus-summary-article-parent)))
11539 (gnus-summary-goto-subject parent))))
11541 (defun gnus-summary-down-thread (n)
11542 "Go down thread N steps.
11543 If N is negative, go up instead.
11544 Returns the difference between N and how many steps down that were
11549 (while (and (> n 0)
11550 (if up (gnus-summary-go-up-thread)
11551 (gnus-summary-go-down-thread)))
11553 (gnus-summary-position-point)
11555 (gnus-message 7 "Can't go further"))
11558 (defun gnus-summary-up-thread (n)
11559 "Go up thread N steps.
11560 If N is negative, go down instead.
11561 Returns the difference between N and how many steps down that were
11564 (gnus-summary-down-thread (- n)))
11566 (defun gnus-summary-top-thread ()
11567 "Go to the top of the thread."
11569 (while (gnus-summary-go-up-thread))
11570 (gnus-summary-article-number))
11572 (defun gnus-summary-expire-thread ()
11573 "Mark articles under current thread as expired."
11575 (gnus-summary-kill-thread 0))
11577 (defun gnus-summary-kill-thread (&optional unmark)
11578 "Mark articles under current thread as read.
11579 If the prefix argument is positive, remove any kinds of marks.
11580 If the prefix argument is zero, mark thread as expired.
11581 If the prefix argument is negative, tick articles instead."
11584 (setq unmark (prefix-numeric-value unmark)))
11585 (let ((articles (gnus-summary-articles-in-thread))
11586 (hide (or (null unmark) (= unmark 0))))
11588 ;; Expand the thread.
11589 (gnus-summary-show-thread)
11590 ;; Mark all the articles.
11592 (gnus-summary-goto-subject (car articles))
11593 (cond ((null unmark)
11594 (gnus-summary-mark-article-as-read gnus-killed-mark))
11596 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11598 (gnus-summary-mark-article nil gnus-expirable-mark))
11600 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11601 (setq articles (cdr articles))))
11602 ;; Hide killed subtrees when hide is true.
11604 gnus-thread-hide-killed
11605 (gnus-summary-hide-thread))
11606 ;; If hide is t, go to next unread subject.
11608 ;; Go to next unread subject.
11609 (gnus-summary-next-subject 1 t)))
11610 (gnus-set-mode-line 'summary))
11612 ;; Summary sorting commands
11614 (defun gnus-summary-sort-by-number (&optional reverse)
11615 "Sort the summary buffer by article number.
11616 Argument REVERSE means reverse order."
11618 (gnus-summary-sort 'number reverse))
11620 (defun gnus-summary-sort-by-most-recent-number (&optional reverse)
11621 "Sort the summary buffer by most recent article number.
11622 Argument REVERSE means reverse order."
11624 (gnus-summary-sort 'most-recent-number reverse))
11626 (defun gnus-summary-sort-by-random (&optional reverse)
11627 "Randomize the order in the summary buffer.
11628 Argument REVERSE means to randomize in reverse order."
11630 (gnus-summary-sort 'random reverse))
11632 (defun gnus-summary-sort-by-author (&optional reverse)
11633 "Sort the summary buffer by author name alphabetically.
11634 If `case-fold-search' is non-nil, case of letters is ignored.
11635 Argument REVERSE means reverse order."
11637 (gnus-summary-sort 'author reverse))
11639 (defun gnus-summary-sort-by-recipient (&optional reverse)
11640 "Sort the summary buffer by recipient name alphabetically.
11641 If `case-fold-search' is non-nil, case of letters is ignored.
11642 Argument REVERSE means reverse order."
11644 (gnus-summary-sort 'recipient reverse))
11646 (defun gnus-summary-sort-by-subject (&optional reverse)
11647 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11648 If `case-fold-search' is non-nil, case of letters is ignored.
11649 Argument REVERSE means reverse order."
11651 (gnus-summary-sort 'subject reverse))
11653 (defun gnus-summary-sort-by-date (&optional reverse)
11654 "Sort the summary buffer by date.
11655 Argument REVERSE means reverse order."
11657 (gnus-summary-sort 'date reverse))
11659 (defun gnus-summary-sort-by-most-recent-date (&optional reverse)
11660 "Sort the summary buffer by most recent date.
11661 Argument REVERSE means reverse order."
11663 (gnus-summary-sort 'most-recent-date reverse))
11665 (defun gnus-summary-sort-by-score (&optional reverse)
11666 "Sort the summary buffer by score.
11667 Argument REVERSE means reverse order."
11669 (gnus-summary-sort 'score reverse))
11671 (defun gnus-summary-sort-by-lines (&optional reverse)
11672 "Sort the summary buffer by the number of lines.
11673 Argument REVERSE means reverse order."
11675 (gnus-summary-sort 'lines reverse))
11677 (defun gnus-summary-sort-by-chars (&optional reverse)
11678 "Sort the summary buffer by article length.
11679 Argument REVERSE means reverse order."
11681 (gnus-summary-sort 'chars reverse))
11683 (defun gnus-summary-sort-by-original (&optional reverse)
11684 "Sort the summary buffer using the default sorting method.
11685 Argument REVERSE means reverse order."
11687 (let* ((inhibit-read-only t)
11688 (gnus-summary-prepare-hook nil))
11689 ;; We do the sorting by regenerating the threads.
11690 (gnus-summary-prepare)
11691 ;; Hide subthreads if needed.
11692 (gnus-summary-maybe-hide-threads)))
11694 (defun gnus-summary-sort (predicate reverse)
11695 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11696 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11697 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11698 (gnus-thread-sort-functions
11703 (gnus-sort-gathered-threads-function
11704 gnus-thread-sort-functions)
11705 (gnus-article-sort-functions
11709 (,article t2 t1))))
11710 (inhibit-read-only t)
11711 (gnus-summary-prepare-hook nil))
11712 ;; We do the sorting by regenerating the threads.
11713 (gnus-summary-prepare)
11714 ;; Hide subthreads if needed.
11715 (gnus-summary-maybe-hide-threads)))
11717 ;; Summary saving commands.
11719 (defun gnus-summary-save-article (&optional n not-saved)
11720 "Save the current article using the default saver function.
11721 If N is a positive number, save the N next articles.
11722 If N is a negative number, save the N previous articles.
11723 If N is nil and any articles have been marked with the process mark,
11724 save those articles instead.
11725 The variable `gnus-default-article-saver' specifies the saver function.
11727 If the optional second argument NOT-SAVED is non-nil, articles saved
11728 will not be marked as saved."
11730 (require 'gnus-art)
11731 (let* ((articles (gnus-summary-work-articles n))
11732 (save-buffer (save-excursion
11733 (nnheader-set-temp-buffer " *Gnus Save*")))
11734 (num (length articles))
11735 ;; Whether to save decoded articles or raw articles.
11736 (decode (when gnus-article-save-coding-system
11737 (get gnus-default-article-saver :decode)))
11738 ;; When saving many articles in a single file, use the other
11739 ;; function to save articles other than the first one.
11740 (saver2 (get gnus-default-article-saver :function))
11741 (gnus-prompt-before-saving (if saver2
11743 gnus-prompt-before-saving))
11744 (gnus-default-article-saver gnus-default-article-saver)
11746 (dolist (article articles)
11747 (setq header (gnus-summary-article-header article))
11748 (if (not (vectorp header))
11749 ;; This is a pseudo-article.
11750 (if (assq 'name header)
11751 (gnus-copy-file (cdr (assq 'name header)))
11752 (gnus-message 1 "Article %d is unsaveable" article))
11753 ;; This is a real article.
11754 (save-window-excursion
11755 (gnus-summary-select-article decode decode nil article)
11756 (gnus-summary-goto-subject article))
11757 (with-current-buffer save-buffer
11759 (insert-buffer-substring (if decode
11760 gnus-article-buffer
11761 gnus-original-article-buffer)))
11762 (setq file (gnus-article-save save-buffer file num))
11763 (gnus-summary-remove-process-mark article)
11765 (gnus-summary-set-saved-mark article)))
11767 (setq gnus-default-article-saver saver2
11769 (gnus-kill-buffer save-buffer)
11770 (gnus-summary-position-point)
11771 (gnus-set-mode-line 'summary)
11774 (defun gnus-summary-pipe-output (&optional n sym)
11775 "Pipe the current article to a subprocess.
11776 If N is a positive number, pipe the N next articles.
11777 If N is a negative number, pipe the N previous articles.
11778 If N is nil and any articles have been marked with the process mark,
11779 pipe those articles instead.
11780 The default command to which articles are piped is specified by the
11781 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
11782 will be prompted for the command.
11784 The properties `:decode' and `:headers' that are put to the function
11785 symbol `gnus-summary-save-in-pipe' control whether this function
11786 decodes articles and what headers to keep (see the doc string for the
11787 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
11788 is neither omitted nor the symbol `r', force including all headers
11789 regardless of the `:headers' property. If it is the symbol `r',
11790 articles that are not decoded and include all headers will be piped
11791 no matter what the properties `:decode' and `:headers' are."
11792 (interactive (gnus-interactive "P\ny"))
11793 (require 'gnus-art)
11794 (let* ((articles (gnus-summary-work-articles n))
11795 (result-buffer "*Shell Command Output*")
11796 (all-headers (not (memq sym '(nil r))))
11797 (gnus-save-all-headers (or all-headers gnus-save-all-headers))
11799 (headers (get 'gnus-summary-save-in-pipe :headers))
11801 (unless (numberp (car articles))
11802 (error "No article to pipe"))
11803 (setq command (gnus-read-shell-command
11804 (concat "Shell command on "
11806 (format "these %d articles" (length articles))
11809 gnus-summary-pipe-output-default-command))
11810 (when (string-equal command "")
11811 (error "A command is required"))
11813 (put 'gnus-summary-save-in-pipe :headers nil))
11816 (gnus-summary-goto-subject (pop articles))
11817 (save-window-excursion (gnus-summary-save-in-pipe command raw))
11818 (when (and (get-buffer result-buffer)
11819 (not (zerop (buffer-size (get-buffer result-buffer)))))
11820 (setq result (concat result (with-current-buffer result-buffer
11821 (buffer-string))))))
11822 (put 'gnus-summary-save-in-pipe :headers headers))
11823 (unless (zerop (length result))
11824 (if (with-current-buffer (get-buffer-create result-buffer)
11828 (and (= (count-lines (point-min) (point)) 1)
11831 (<= (current-column)
11832 (window-width (minibuffer-window)))))
11833 (goto-char (point-min))))
11834 (message "%s" (substring result 0 -1))
11836 (gnus-configure-windows 'pipe)))))
11838 (defun gnus-summary-save-article-mail (&optional arg)
11839 "Append the current article to a Unix mail box file.
11840 If N is a positive number, save the N next articles.
11841 If N is a negative number, save the N previous articles.
11842 If N is nil and any articles have been marked with the process mark,
11843 save those articles instead."
11845 (require 'gnus-art)
11846 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11847 (gnus-summary-save-article arg)))
11849 (defun gnus-summary-save-article-rmail (&optional arg)
11850 "Append the current article to an rmail file.
11851 If N is a positive number, save the N next articles.
11852 If N is a negative number, save the N previous articles.
11853 If N is nil and any articles have been marked with the process mark,
11854 save those articles instead."
11856 (require 'gnus-art)
11857 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11858 (gnus-summary-save-article arg)))
11860 (defun gnus-summary-save-article-file (&optional arg)
11861 "Append the current article to a file.
11862 If N is a positive number, save the N next articles.
11863 If N is a negative number, save the N previous articles.
11864 If N is nil and any articles have been marked with the process mark,
11865 save those articles instead."
11867 (require 'gnus-art)
11868 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11869 (gnus-summary-save-article arg)))
11871 (defun gnus-summary-write-article-file (&optional arg)
11872 "Write the current article to a file, deleting the previous file.
11873 If N is a positive number, save the N next articles.
11874 If N is a negative number, save the N previous articles.
11875 If N is nil and any articles have been marked with the process mark,
11876 save those articles instead."
11878 (require 'gnus-art)
11879 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11880 (gnus-summary-save-article arg)))
11882 (defun gnus-summary-save-article-body-file (&optional arg)
11883 "Append the current article body to a file.
11884 If N is a positive number, save the N next articles.
11885 If N is a negative number, save the N previous articles.
11886 If N is nil and any articles have been marked with the process mark,
11887 save those articles instead."
11889 (require 'gnus-art)
11890 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11891 (gnus-summary-save-article arg)))
11893 (defun gnus-summary-write-article-body-file (&optional arg)
11894 "Write the current article body to a file, deleting the previous file.
11895 If N is a positive number, save the N next articles.
11896 If N is a negative number, save the N previous articles.
11897 If N is nil and any articles have been marked with the process mark,
11898 save those articles instead."
11900 (require 'gnus-art)
11901 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
11902 (gnus-summary-save-article arg)))
11904 (defun gnus-summary-muttprint (&optional arg)
11905 "Print the current article using Muttprint.
11906 If N is a positive number, save the N next articles.
11907 If N is a negative number, save the N previous articles.
11908 If N is nil and any articles have been marked with the process mark,
11909 save those articles instead."
11911 (require 'gnus-art)
11912 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11913 (gnus-summary-save-article arg t)))
11915 (defun gnus-summary-pipe-message (program)
11916 "Pipe the current article through PROGRAM."
11917 (interactive "sProgram: ")
11918 (gnus-summary-select-article)
11919 (let ((mail-header-separator ""))
11920 (gnus-eval-in-buffer-window gnus-article-buffer
11923 (let ((start (window-start))
11924 (inhibit-read-only t))
11925 (message-pipe-buffer-body program)
11926 (set-window-start (get-buffer-window (current-buffer)) start))))))
11928 (defun gnus-get-split-value (methods)
11929 "Return a value based on the split METHODS."
11930 (let (split-name method result match)
11932 (with-current-buffer gnus-original-article-buffer
11934 (nnheader-narrow-to-headers)
11935 (while (and methods (not split-name))
11936 (goto-char (point-min))
11937 (setq method (pop methods))
11938 (setq match (car method))
11941 ;; Regular expression.
11943 (re-search-forward match nil t)))
11948 (setq result (funcall match gnus-newsgroup-name))))
11953 (setq result (eval match)))))
11954 (setq split-name (cdr method))
11955 (cond ((stringp result)
11956 (push (expand-file-name
11957 result gnus-article-save-directory)
11960 (setq split-name (append result split-name)))))))))
11961 (nreverse split-name)))
11963 (defun gnus-valid-move-group-p (group)
11964 (and (symbolp group)
11966 (symbol-name group)
11967 (symbol-value group)
11968 (gnus-get-function (gnus-find-method-for-group
11969 (symbol-name group)) 'request-accept-article t)))
11971 (defun gnus-read-move-group-name (prompt default articles prefix)
11972 "Read a group name."
11973 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11974 (minibuffer-confirm-incomplete nil) ; XEmacs
11978 (if (> (length articles) 1)
11979 (format "these %d articles" (length articles))
11984 (gnus-group-completing-read
11986 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
11987 nil prefix nil default))
11988 ((= 1 (length split-name))
11989 (gnus-group-completing-read
11991 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
11992 nil prefix 'gnus-group-history (car split-name)))
11994 (gnus-completing-read
11995 prom (nreverse split-name) nil nil 'gnus-group-history))))
11996 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
11999 (if (or (string= to-newsgroup "")
12000 (string= to-newsgroup prefix))
12001 (setq to-newsgroup default))
12002 (unless to-newsgroup
12003 (error "No group name entered"))
12004 (setq encoded (mm-encode-coding-string
12006 (gnus-group-name-charset to-method to-newsgroup)))
12007 (or (gnus-active encoded)
12008 (gnus-activate-group encoded nil nil to-method)
12009 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
12011 (or (and (gnus-request-create-group encoded to-method)
12012 (gnus-activate-group encoded nil nil to-method)
12013 (gnus-subscribe-group encoded))
12014 (error "Couldn't create group %s" to-newsgroup)))
12015 (error "No such group: %s" to-newsgroup))
12018 (defvar gnus-summary-save-parts-counter)
12019 (declare-function mm-uu-dissect "mm-uu" (&optional noheader mime-type))
12021 (defun gnus-summary-save-parts (type dir n &optional reverse)
12022 "Save parts matching TYPE to DIR.
12023 If REVERSE, save parts that do not match TYPE."
12025 (list (read-string "Save parts of type: "
12026 (or (car gnus-summary-save-parts-type-history)
12027 gnus-summary-save-parts-default-mime)
12028 'gnus-summary-save-parts-type-history)
12029 (setq gnus-summary-save-parts-last-directory
12030 (read-file-name "Save to directory: "
12031 gnus-summary-save-parts-last-directory
12033 current-prefix-arg))
12034 (gnus-summary-iterate n
12035 (let ((gnus-display-mime-function nil)
12036 gnus-article-prepare-hook
12037 gnus-article-decode-hook
12038 gnus-display-mime-function
12040 (gnus-inhibit-treatment t))
12041 (gnus-summary-select-article))
12042 (with-current-buffer gnus-article-buffer
12043 (let ((handles (or gnus-article-mime-handles
12044 (mm-dissect-buffer nil gnus-article-loose-mime)
12045 (and gnus-article-emulate-mime
12047 (gnus-summary-save-parts-counter 1))
12049 (gnus-summary-save-parts-1 type dir handles reverse)
12050 (unless gnus-article-mime-handles ;; Don't destroy this case.
12051 (mm-destroy-parts handles)))))))
12053 (defun gnus-summary-save-parts-1 (type dir handle reverse)
12054 (if (stringp (car handle))
12055 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
12058 (not (string-match type (mm-handle-media-type handle)))
12059 (string-match type (mm-handle-media-type handle)))
12060 (let ((file (expand-file-name
12062 mm-file-name-rewrite-functions
12063 (file-name-nondirectory
12065 (mail-content-type-get
12066 (mm-handle-disposition handle) 'filename)
12067 (mail-content-type-get
12068 (mm-handle-type handle) 'name)
12069 (format "%s.%d.%d" gnus-newsgroup-name
12070 (cdr gnus-article-current)
12071 gnus-summary-save-parts-counter))))
12073 (incf gnus-summary-save-parts-counter)
12074 (unless (file-exists-p file)
12075 (mm-save-part-to-file handle file))))))
12077 ;; Summary extract commands
12079 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
12080 (let ((inhibit-read-only t)
12081 (article (gnus-summary-article-number))
12083 (unless (gnus-summary-goto-subject article)
12084 (error "No such article: %d" article))
12085 (gnus-summary-position-point)
12086 ;; If all commands are to be bunched up on one line, we collect
12088 (unless gnus-view-pseudos-separately
12089 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
12092 (setq action (cdr (assq 'action (car ps))))
12093 (setq files (list (cdr (assq 'name (car ps)))))
12094 (while (and ps (cdr ps)
12095 (string= (or action "1")
12096 (or (cdr (assq 'action (cadr ps))) "2")))
12097 (push (cdr (assq 'name (cadr ps))) files)
12098 (setcdr ps (cddr ps)))
12100 (when (not (string-match "%s" action))
12103 (when (assq 'execute (car ps))
12104 (setcdr (assq 'execute (car ps))
12105 (funcall (if (string-match "%s" action)
12112 (shell-quote-argument f)))
12114 (setq ps (cdr ps)))))
12115 (if (and gnus-view-pseudos (not not-view))
12117 (when (assq 'execute (car pslist))
12118 (gnus-execute-command (cdr (assq 'execute (car pslist)))
12119 (eq gnus-view-pseudos 'not-confirm)))
12120 (setq pslist (cdr pslist)))
12123 (setq after-article (or (cdr (assq 'article (car pslist)))
12124 (gnus-summary-article-number)))
12125 (gnus-summary-goto-subject after-article)
12128 (insert " " (file-name-nondirectory
12129 (cdr (assq 'name (car pslist))))
12130 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
12132 (forward-line -1) ; back to `b'
12133 (gnus-add-text-properties
12134 b (1- e) (list 'gnus-number gnus-reffed-article-number
12135 gnus-mouse-face-prop gnus-mouse-face))
12137 after-article gnus-reffed-article-number
12138 gnus-unread-mark b (car pslist) 0 (- e b))
12139 (setq gnus-newsgroup-unreads
12140 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12141 gnus-reffed-article-number))
12142 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
12143 (setq pslist (cdr pslist)))))))
12145 (defun gnus-pseudos< (p1 p2)
12146 (let ((c1 (cdr (assq 'action p1)))
12147 (c2 (cdr (assq 'action p2))))
12148 (and c1 c2 (string< c1 c2))))
12150 (defun gnus-request-pseudo-article (props)
12151 (cond ((assq 'execute props)
12152 (gnus-execute-command (cdr (assq 'execute props)))))
12153 (let ((gnus-current-article (gnus-summary-article-number)))
12154 (gnus-run-hooks 'gnus-mark-article-hook)))
12156 (defun gnus-execute-command (command &optional automatic)
12158 (gnus-article-setup-buffer)
12159 (set-buffer gnus-article-buffer)
12160 (setq buffer-read-only nil)
12161 (let ((command (if automatic command
12162 (read-string "Command: " (cons command 0)))))
12164 (insert "$ " command "\n\n")
12165 (if gnus-view-pseudo-asynchronously
12166 (start-process "gnus-execute" (current-buffer) shell-file-name
12167 shell-command-switch command)
12168 (call-process shell-file-name nil t nil
12169 shell-command-switch command)))))
12171 ;; Summary kill commands.
12173 (defun gnus-summary-edit-global-kill (article)
12174 "Edit the \"global\" kill file."
12175 (interactive (list (gnus-summary-article-number)))
12176 (gnus-group-edit-global-kill article))
12178 (defun gnus-summary-edit-local-kill ()
12179 "Edit a local kill file applied to the current newsgroup."
12181 (setq gnus-current-headers (gnus-summary-article-header))
12182 (gnus-group-edit-local-kill
12183 (gnus-summary-article-number) gnus-newsgroup-name))
12185 ;;; Header reading.
12187 (defun gnus-read-header (id &optional header)
12188 "Read the headers of article ID and enter them into the Gnus system."
12189 (let ((group gnus-newsgroup-name)
12190 (gnus-override-method
12192 gnus-override-method
12193 (and (gnus-news-group-p gnus-newsgroup-name)
12194 (car (gnus-refer-article-methods)))))
12196 ;; First we check to see whether the header in question is already
12199 ;; This is a Message-ID.
12200 (setq header (or header (gnus-id-to-header id)))
12201 ;; This is an article number.
12202 (setq header (or header (gnus-summary-article-header id))))
12204 (not (gnus-summary-article-sparse-p (mail-header-number header))))
12205 ;; We have found the header.
12207 ;; We have to really fetch the header to this article.
12208 (with-current-buffer nntp-server-buffer
12209 (when (setq where (gnus-request-head id group))
12210 (nnheader-fold-continuation-lines)
12211 (goto-char (point-max))
12213 (goto-char (point-min))
12217 ((cdr where) (cdr where))
12218 (header (mail-header-number header))
12219 (t gnus-reffed-article-number))
12221 (insert " Article retrieved.\n"))
12222 (if (or (not where)
12223 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
12224 () ; Malformed head.
12225 (unless (gnus-summary-article-sparse-p (mail-header-number header))
12226 (when (and (stringp id)
12228 (not (string= (gnus-group-real-name group)
12230 (not (gnus-server-equal gnus-override-method
12231 (gnus-group-method group)))))
12232 ;; If we fetched by Message-ID and the article came from
12233 ;; a different group (or server), we fudge some bogus
12234 ;; article numbers for this article.
12235 (mail-header-set-number header gnus-reffed-article-number))
12236 (with-current-buffer gnus-summary-buffer
12237 (decf gnus-reffed-article-number)
12238 (gnus-remove-header (mail-header-number header))
12239 (push header gnus-newsgroup-headers)
12240 (setq gnus-current-headers header)
12241 (push (mail-header-number header) gnus-newsgroup-limit)))
12244 (defun gnus-remove-header (number)
12245 "Remove header NUMBER from `gnus-newsgroup-headers'."
12246 (if (and gnus-newsgroup-headers
12247 (= number (mail-header-number (car gnus-newsgroup-headers))))
12248 (pop gnus-newsgroup-headers)
12249 (let ((headers gnus-newsgroup-headers))
12250 (while (and (cdr headers)
12251 (not (= number (mail-header-number (cadr headers)))))
12253 (when (cdr headers)
12254 (setcdr headers (cddr headers))))))
12257 ;;; summary highlights
12260 (defun gnus-highlight-selected-summary ()
12261 "Highlight selected article in summary buffer."
12262 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12263 (when gnus-summary-selected-face
12265 (let* ((beg (point-at-bol))
12266 (end (point-at-eol))
12267 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12268 (from (if (get-text-property beg gnus-mouse-face-prop)
12270 (or (next-single-property-change
12271 beg gnus-mouse-face-prop nil end)
12276 (or (next-single-property-change
12277 from gnus-mouse-face-prop nil end)
12279 ;; If no mouse-face prop on line we will have to = from = end,
12280 ;; so we highlight the entire line instead.
12281 (when (= (+ to 2) from)
12284 (if gnus-newsgroup-selected-overlay
12285 ;; Move old overlay.
12287 gnus-newsgroup-selected-overlay from to (current-buffer))
12288 ;; Create new overlay.
12290 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
12291 'face gnus-summary-selected-face))))))
12293 (defvar gnus-summary-highlight-line-cached nil)
12294 (defvar gnus-summary-highlight-line-trigger nil)
12296 (defun gnus-summary-highlight-line-0 ()
12297 (if (and (eq gnus-summary-highlight-line-trigger
12298 gnus-summary-highlight)
12299 gnus-summary-highlight-line-cached)
12300 gnus-summary-highlight-line-cached
12301 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12302 gnus-summary-highlight-line-cached
12303 (let* ((cond (list 'cond))
12305 (list gnus-summary-highlight))
12307 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
12311 (gnus-byte-compile (list 'lambda nil cond))))))
12313 (defun gnus-summary-highlight-line ()
12314 "Highlight current line according to `gnus-summary-highlight'."
12315 (let* ((beg (point-at-bol))
12316 (article (or (gnus-summary-article-number) gnus-current-article))
12317 (score (or (cdr (assq article
12318 gnus-newsgroup-scored))
12319 gnus-summary-default-score 0))
12320 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
12321 (inhibit-read-only t)
12322 (default gnus-summary-default-score)
12323 (default-high gnus-summary-default-high-score)
12324 (default-low gnus-summary-default-low-score)
12325 (uncached (and gnus-summary-use-undownloaded-faces
12326 (memq article gnus-newsgroup-undownloaded)
12327 (not (memq article gnus-newsgroup-cached)))))
12328 (let ((face (funcall (gnus-summary-highlight-line-0))))
12329 (unless (eq face (get-text-property beg 'face))
12330 (gnus-put-text-property-excluding-characters-with-faces
12331 beg (point-at-eol) 'face
12332 (setq face (if (boundp face) (symbol-value face) face)))
12333 (when gnus-summary-highlight-line-function
12334 (funcall gnus-summary-highlight-line-function article face))))))
12336 (defun gnus-update-read-articles (group unread &optional compute)
12337 "Update the list of read articles in GROUP.
12338 UNREAD is a sorted list."
12339 (let ((active (or gnus-newsgroup-active (gnus-active group)))
12340 (info (gnus-get-info group))
12343 (if (or (not info) (not active))
12344 ;; There is no info on this group if it was, in fact,
12345 ;; killed. Gnus stores no information on killed groups, so
12346 ;; there's nothing to be done.
12347 ;; One could store the information somewhere temporarily,
12348 ;; perhaps... Hmmm...
12350 ;; Remove any negative articles numbers.
12351 (while (and unread (< (car unread) 0))
12352 (setq unread (cdr unread)))
12353 ;; Remove any expired article numbers
12354 (while (and unread (< (car unread) (car active)))
12355 (setq unread (cdr unread)))
12356 ;; Compute the ranges of read articles by looking at the list of
12357 ;; unread articles.
12359 (when (/= (car unread) prev)
12360 (push (if (= prev (1- (car unread))) prev
12361 (cons prev (1- (car unread))))
12363 (setq prev (1+ (car unread)))
12364 (setq unread (cdr unread)))
12365 (when (<= prev (cdr active))
12366 (push (cons prev (cdr active)) read))
12367 (setq read (if (> (length read) 1) (nreverse read) read))
12372 ;; Propagate the read marks to the backend.
12373 (when (and gnus-propagate-marks
12374 (gnus-check-backend-function 'request-set-mark group))
12375 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12376 (add (gnus-remove-from-range read (gnus-info-read info))))
12378 (unless (gnus-check-group group)
12379 (error "Can't open server for %s" group))
12380 (gnus-request-set-mark
12381 group (delq nil (list (if add (list add 'add '(read)))
12382 (if del (list del 'del '(read))))))
12384 `(gnus-request-set-mark
12387 (if del (list del 'add '(read)))
12388 (if add (list add 'del '(read))))))))))
12389 (set-buffer gnus-group-buffer)
12390 (gnus-undo-register
12392 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12393 (gnus-info-set-read ',info ',(gnus-info-read info))
12394 (gnus-get-unread-articles-in-group ',info
12395 (gnus-active ,group))
12396 (gnus-group-update-group ,group t)
12398 ;; Enter this list into the group info.
12399 (gnus-info-set-read info read)
12400 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12401 (gnus-get-unread-articles-in-group info (gnus-active group))
12404 (defun gnus-offer-save-summaries ()
12405 "Offer to save all active summary buffers."
12407 ;; Go through all buffers and find all summaries.
12408 (dolist (buffer (buffer-list))
12409 (when (and (setq buffer (buffer-name buffer))
12410 (string-match "Summary" buffer)
12411 (with-current-buffer buffer
12412 ;; We check that this is, indeed, a summary buffer.
12413 (and (eq major-mode 'gnus-summary-mode)
12414 ;; Also make sure this isn't bogus.
12415 gnus-newsgroup-prepared
12416 ;; Also make sure that this isn't a
12417 ;; dead summary buffer.
12418 (not gnus-dead-summary-mode))))
12419 (push buffer buffers)))
12420 ;; Go through all these summary buffers and offer to save them.
12424 "Update summary buffer %s? "
12426 (switch-to-buffer buf)
12427 (gnus-summary-exit))
12430 (defun gnus-summary-setup-default-charset ()
12431 "Setup newsgroup default charset."
12432 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12433 (setq gnus-newsgroup-charset nil)
12434 (let* ((ignored-charsets
12435 (or gnus-newsgroup-ephemeral-ignored-charsets
12437 (and gnus-newsgroup-name
12438 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12439 gnus-newsgroup-ignored-charsets))))
12440 (setq gnus-newsgroup-charset
12441 (or gnus-newsgroup-ephemeral-charset
12442 (and gnus-newsgroup-name
12443 (gnus-parameter-charset gnus-newsgroup-name))
12444 gnus-default-charset))
12445 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12446 ignored-charsets))))
12452 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12453 "Display the current article buffer fully MIME-buttonized.
12454 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12455 treated as multipart/mixed."
12457 (require 'gnus-art)
12458 (let ((gnus-unbuttonized-mime-types nil)
12459 (gnus-mime-display-multipart-as-mixed show-all-parts))
12460 (gnus-summary-show-article)))
12462 (defun gnus-summary-repair-multipart (article)
12463 "Add a Content-Type header to a multipart article without one."
12464 (interactive (list (gnus-summary-article-number)))
12465 (gnus-with-article article
12466 (message-narrow-to-head)
12467 (message-remove-header "Mime-Version")
12468 (goto-char (point-max))
12469 (insert "Mime-Version: 1.0\n")
12471 (when (search-forward "\n--" nil t)
12472 (let ((separator (buffer-substring (point) (point-at-eol))))
12473 (message-narrow-to-head)
12474 (message-remove-header "Content-Type")
12475 (goto-char (point-max))
12476 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12479 (let (gnus-mark-article-hook)
12480 (gnus-summary-select-article t t nil article)))
12482 (defun gnus-summary-toggle-display-buttonized ()
12483 "Toggle the buttonizing of the article buffer."
12485 (require 'gnus-art)
12486 (if (setq gnus-inhibit-mime-unbuttonizing
12487 (not gnus-inhibit-mime-unbuttonizing))
12488 (let ((gnus-unbuttonized-mime-types nil))
12489 (gnus-summary-show-article))
12490 (gnus-summary-show-article)))
12493 ;;; Generic summary marking commands
12496 (defvar gnus-summary-marking-alist
12497 '((read gnus-del-mark "d")
12498 (unread gnus-unread-mark "u")
12499 (ticked gnus-ticked-mark "!")
12500 (dormant gnus-dormant-mark "?")
12501 (expirable gnus-expirable-mark "e"))
12502 "An alist of names/marks/keystrokes.")
12504 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12505 (defvar gnus-summary-mark-map)
12507 (defun gnus-summary-make-all-marking-commands ()
12508 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12509 (dolist (elem gnus-summary-marking-alist)
12510 (apply 'gnus-summary-make-marking-command elem)))
12512 (defun gnus-summary-make-marking-command (name mark keystroke)
12513 (let ((map (make-sparse-keymap)))
12514 (define-key gnus-summary-generic-mark-map keystroke map)
12515 (dolist (lway `((next "next" next nil "n")
12516 (next-unread "next unread" next t "N")
12517 (prev "previous" prev nil "p")
12518 (prev-unread "previous unread" prev t "P")
12519 (nomove "" nil nil ,keystroke)))
12520 (let ((func (gnus-summary-make-marking-command-1
12521 mark (car lway) lway name)))
12522 (setq func (eval func))
12523 (define-key map (nth 4 lway) func)))))
12525 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12527 (format "gnus-summary-put-mark-as-%s%s"
12528 name (if (eq way 'nomove)
12530 (concat "-" (symbol-name way)))))
12533 "Mark the current article as %s%s.
12534 If N, the prefix, then repeat N times.
12535 If N is negative, move in reverse order.
12536 The difference between N and the actual number of articles marked is
12540 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12542 (defun gnus-summary-generic-mark (n mark move unread)
12543 "Mark N articles with MARK."
12544 (unless (eq major-mode 'gnus-summary-mode)
12545 (error "This command can only be used in the summary buffer"))
12546 (gnus-summary-show-thread)
12549 ((eq move 'next) 1)
12550 ((eq move 'prev) -1)
12552 (if (zerop nummove)
12556 nummove (* -1 nummove))))
12557 (while (and (> n 0)
12558 (gnus-summary-mark-article nil mark)
12559 (zerop (gnus-summary-next-subject nummove unread t)))
12562 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12563 (gnus-summary-recenter)
12564 (gnus-summary-position-point)
12565 (gnus-set-mode-line 'summary)
12568 (defun gnus-summary-insert-articles (articles)
12569 (when (setq articles
12570 (gnus-sorted-difference articles
12571 (mapcar (lambda (h)
12572 (mail-header-number h))
12573 gnus-newsgroup-headers)))
12574 (setq gnus-newsgroup-headers
12576 gnus-newsgroup-headers
12577 (gnus-fetch-headers articles)
12578 'gnus-article-sort-by-number))
12579 ;; Suppress duplicates?
12580 (when gnus-suppress-duplicates
12581 (gnus-dup-suppress-articles))
12583 (if (and gnus-fetch-old-headers
12584 (eq gnus-headers-retrieved-by 'nov))
12585 ;; We might want to build some more threads first.
12586 (if (eq gnus-fetch-old-headers 'invisible)
12587 (gnus-build-all-threads)
12588 (gnus-build-old-threads))
12589 ;; Mark the inserted articles that are unread as unread.
12590 (setq gnus-newsgroup-unreads
12591 (gnus-sorted-nunion
12592 gnus-newsgroup-unreads
12593 (gnus-sorted-nintersection
12594 (gnus-list-of-unread-articles gnus-newsgroup-name)
12596 ;; Mark the inserted articles as selected so that the information
12597 ;; of the marks having been changed by a user may be updated when
12598 ;; exiting this group. See `gnus-summary-update-info'.
12599 (dolist (art articles)
12600 (setq gnus-newsgroup-unselected (delq art gnus-newsgroup-unselected))))
12601 ;; Let the Gnus agent mark articles as read.
12603 (gnus-agent-get-undownloaded-list))
12604 ;; Remove list identifiers from subject
12605 (when gnus-list-identifiers
12606 (gnus-summary-remove-list-identifiers))
12607 ;; First and last article in this newsgroup.
12608 (when gnus-newsgroup-headers
12609 (setq gnus-newsgroup-begin
12610 (mail-header-number (car gnus-newsgroup-headers))
12612 (mail-header-number
12613 (gnus-last-element gnus-newsgroup-headers))))
12614 (when gnus-use-scoring
12615 (gnus-possibly-score-headers))))
12617 (defun gnus-summary-insert-old-articles (&optional all)
12618 "Insert all old articles in this group.
12619 If ALL is non-nil, already read articles become readable.
12620 If ALL is a number, fetch this number of articles."
12623 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12626 ;; Some nntp servers lie about their active range. When
12627 ;; this happens, the active range can be in the millions.
12628 ;; Use a compressed range to avoid creating a huge list.
12629 (gnus-range-difference (list gnus-newsgroup-active) old))
12630 (setq len (gnus-range-length older))
12635 (let ((older-range (nreverse older)))
12639 (let* ((r (pop older-range))
12640 (min (if (numberp r) r (car r)))
12641 (max (if (numberp r) r (cdr r))))
12642 (while (and (<= min max)
12647 (setq older (gnus-uncompress-range older))))
12649 (setq older (gnus-uncompress-range older)))
12651 (when (and (numberp gnus-large-newsgroup)
12652 (> len gnus-large-newsgroup))
12653 (let* ((cursor-in-echo-area nil)
12654 (initial (gnus-parameter-large-newsgroup-initial
12655 gnus-newsgroup-name))
12659 "How many articles from %s (%s %d): "
12660 (gnus-group-decoded-name gnus-newsgroup-name)
12661 (if initial "max" "default")
12664 (cons (number-to-string initial)
12666 (unless (string-match "^[ \t]*$" input)
12667 (setq all (string-to-number input))
12669 (let ((older-range (nreverse older)))
12673 (let* ((r (pop older-range))
12674 (min (if (numberp r) r (car r)))
12675 (max (if (numberp r) r (cdr r))))
12676 (while (and (<= min max)
12680 max (1- max))))))))))
12681 (setq older (gnus-uncompress-range older))))
12683 (message "No old news.")
12684 (gnus-summary-insert-articles older)
12685 (gnus-summary-limit (gnus-sorted-nunion old older))))
12686 (gnus-summary-position-point)))
12688 (defun gnus-summary-insert-new-articles ()
12689 "Insert all new articles in this group."
12692 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12693 (old-high gnus-newsgroup-highest)
12694 (nnmail-fetched-sources (list t))
12696 (setq gnus-newsgroup-active
12697 (gnus-copy-sequence
12698 (gnus-activate-group gnus-newsgroup-name 'scan)))
12699 (setq i (cdr gnus-newsgroup-active)
12700 gnus-newsgroup-highest i)
12701 (while (> i old-high)
12705 (message "No gnus is bad news")
12706 (gnus-summary-insert-articles new)
12707 (setq gnus-newsgroup-unreads
12708 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12709 (gnus-summary-limit (gnus-sorted-nunion old new))))
12710 (gnus-summary-position-point)))
12712 ;;; Bookmark support for Gnus.
12713 (declare-function bookmark-make-record-default
12714 "bookmark" (&optional no-file no-context posn))
12715 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
12716 (declare-function bookmark-default-handler "bookmark" (bmk))
12717 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
12718 (defvar bookmark-yank-point)
12719 (defvar bookmark-current-buffer)
12721 (defun gnus-summary-bookmark-make-record ()
12722 "Make a bookmark entry for a Gnus summary buffer."
12724 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
12725 (save-restriction ; FIXME is it necessary to widen?
12726 (widen) (setq pos (point))) ; Set position in gnus-article buffer.
12727 (setq buf "art") ; We are recording bookmark from article buffer.
12728 (setq bookmark-yank-point (point))
12729 (setq bookmark-current-buffer (current-buffer))
12730 (gnus-article-show-summary)) ; Go back in summary buffer.
12731 ;; We are now recording bookmark from summary buffer.
12732 (unless buf (setq buf "sum"))
12733 (let* ((subject (elt (gnus-summary-article-header) 1))
12734 (grp (car gnus-article-current))
12735 (art (cdr gnus-article-current))
12736 (head (gnus-summary-article-header art))
12737 (id (mail-header-id head)))
12739 ,@(condition-case nil
12740 (bookmark-make-record-default 'no-file 'no-context pos)
12741 (wrong-number-of-arguments
12742 (bookmark-make-record-default 'point-only)))
12743 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
12744 (group . ,grp) (article . ,art)
12745 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
12748 (defun gnus-summary-bookmark-jump (bookmark)
12749 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12750 BOOKMARK is a bookmark name or a bookmark record."
12751 (let ((group (bookmark-prop-get bookmark 'group))
12752 (article (bookmark-prop-get bookmark 'article))
12753 (id (bookmark-prop-get bookmark 'message-id))
12754 (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
12755 (gnus-fetch-group group (list article))
12756 (gnus-summary-insert-cached-articles)
12757 (gnus-summary-goto-article id nil 'force)
12758 ;; FIXME we have to wait article buffer is ready (only large buffer)
12759 ;; Is there a better solution to know that?
12760 ;; If we don't wait `bookmark-default-handler' will have no chance
12761 ;; to set position. However there is no error, just wrong pos.
12763 (when (string= buf "Gnus-art")
12765 (bookmark-default-handler
12767 (buffer . ,(current-buffer))
12768 . ,(bookmark-get-bookmark-record bookmark)))))
12770 (gnus-summary-make-all-marking-commands)
12772 (gnus-ems-redefine)
12774 (provide 'gnus-sum)
12776 (run-hooks 'gnus-sum-load-hook)
12778 ;; Local Variables:
12779 ;; coding: iso-8859-1
12782 ;;; gnus-sum.el ends here