1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-mode))
45 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
46 (autoload 'gnus-cache-write-active "gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
48 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
49 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
50 (autoload 'mm-uu-dissect "mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
52 "Deuglify broken Outlook (Express) articles and redisplay."
54 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
55 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
56 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
58 (defcustom gnus-kill-summary-on-exit t
59 "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group 'gnus-summary-exit
65 (defcustom gnus-fetch-old-headers nil
66 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
67 If an unread article in the group refers to an older, already
68 read (or just marked as read) article, the old article will not
69 normally be displayed in the Summary buffer. If this variable is
70 t, Gnus will attempt to grab the headers to the old articles, and
71 thereby build complete threads. If it has the value `some', all
72 old headers will be fetched but only enough headers to connect
73 otherwise loose threads will be displayed. This variable can
74 also be a number. In that case, no more than that number of old
75 headers will be fetched. If it has the value `invisible', all
76 old headers will be fetched, but none will be displayed.
78 The server has to support NOV for any of this to work.
80 This feature can seriously impact performance it ignores all
81 locally cached header entries."
83 :type '(choice (const :tag "off" nil)
88 (sexp :menu-tag "other" t)))
90 (defcustom gnus-refer-thread-limit 500
91 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
92 If t, fetch all the available old headers."
95 (sexp :menu-tag "other" t)))
97 (defcustom gnus-summary-make-false-root 'adopt
98 "*nil means that Gnus won't gather loose threads.
99 If the root of a thread has expired or been read in a previous
100 session, the information necessary to build a complete thread has been
101 lost. Instead of having many small sub-threads from this original thread
102 scattered all over the summary buffer, Gnus can gather them.
104 If non-nil, Gnus will try to gather all loose sub-threads from an
105 original thread into one large thread.
107 If this variable is non-nil, it should be one of `none', `adopt',
110 If this variable is `none', Gnus will not make a false root, but just
111 present the sub-threads after another.
112 If this variable is `dummy', Gnus will create a dummy root that will
113 have all the sub-threads as children.
114 If this variable is `adopt', Gnus will make one of the \"children\"
115 the parent and mark all the step-children as such.
116 If this variable is `empty', the \"children\" are printed with empty
117 subject fields. (Or rather, they will be printed with a string
118 given by the `gnus-summary-same-subject' variable.)"
120 :type '(choice (const :tag "off" nil)
126 (defcustom gnus-summary-make-false-root-always nil
127 "Always make a false dummy root."
132 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
133 "*A regexp to match subjects to be excluded from loose thread gathering.
134 As loose thread gathering is done on subjects only, that means that
135 there can be many false gatherings performed. By rooting out certain
136 common subjects, gathering might become saner."
140 (defcustom gnus-summary-gather-subject-limit nil
141 "*Maximum length of subject comparisons when gathering loose threads.
142 Use nil to compare full subjects. Setting this variable to a low
143 number will help gather threads that have been corrupted by
144 newsreaders chopping off subject lines, but it might also mean that
145 unrelated articles that have subject that happen to begin with the
146 same few characters will be incorrectly gathered.
148 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
151 :type '(choice (const :tag "off" nil)
153 (sexp :menu-tag "on" t)))
155 (defcustom gnus-simplify-subject-functions nil
156 "List of functions taking a string argument that simplify subjects.
157 The functions are applied recursively.
159 Useful functions to put in this list include:
160 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
161 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
163 :type '(repeat function))
165 (defcustom gnus-simplify-ignored-prefixes nil
166 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
168 :type '(choice (const :tag "off" nil)
171 (defcustom gnus-build-sparse-threads nil
172 "*If non-nil, fill in the gaps in threads.
173 If `some', only fill in the gaps that are needed to tie loose threads
174 together. If `more', fill in all leaf nodes that Gnus can find. If
175 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
177 :type '(choice (const :tag "off" nil)
180 (sexp :menu-tag "all" t)))
182 (defcustom gnus-summary-thread-gathering-function
183 'gnus-gather-threads-by-subject
184 "*Function used for gathering loose threads.
185 There are two pre-defined functions: `gnus-gather-threads-by-subject',
186 which only takes Subjects into consideration; and
187 `gnus-gather-threads-by-references', which compared the References
188 headers of the articles to find matches."
190 :type '(radio (function-item gnus-gather-threads-by-subject)
191 (function-item gnus-gather-threads-by-references)
192 (function :tag "other")))
194 (defcustom gnus-summary-same-subject ""
195 "*String indicating that the current article has the same subject as the previous.
196 This variable will only be used if the value of
197 `gnus-summary-make-false-root' is `empty'."
198 :group 'gnus-summary-format
201 (defcustom gnus-summary-goto-unread t
202 "*If t, many commands will go to the next unread article.
203 This applies to marking commands as well as other commands that
204 \"naturally\" select the next article, like, for instance, `SPC' at
205 the end of an article.
207 If nil, the marking commands do NOT go to the next unread article
208 \(they go to the next article instead). If `never', commands that
209 usually go to the next unread article, will go to the next article,
210 whether it is read or not."
211 :group 'gnus-summary-marks
212 :link '(custom-manual "(gnus)Setting Marks")
213 :type '(choice (const :tag "off" nil)
215 (sexp :menu-tag "on" t)))
217 (defcustom gnus-summary-default-score 0
218 "*Default article score level.
219 All scores generated by the score files will be added to this score.
220 If this variable is nil, scoring will be disabled."
221 :group 'gnus-score-default
222 :type '(choice (const :tag "disable")
225 (defcustom gnus-summary-default-high-score 0
226 "*Default threshold for a high scored article.
227 An article will be highlighted as high scored if its score is greater
230 :group 'gnus-score-default
233 (defcustom gnus-summary-default-low-score 0
234 "*Default threshold for a low scored article.
235 An article will be highlighted as low scored if its score is smaller
238 :group 'gnus-score-default
241 (defcustom gnus-summary-zcore-fuzz 0
242 "*Fuzziness factor for the zcore in the summary buffer.
243 Articles with scores closer than this to `gnus-summary-default-score'
245 :group 'gnus-summary-format
248 (defcustom gnus-simplify-subject-fuzzy-regexp nil
249 "*Strings to be removed when doing fuzzy matches.
250 This can either be a regular expression or list of regular expressions
251 that will be removed from subject strings if fuzzy subject
252 simplification is selected."
254 :type '(repeat regexp))
256 (defcustom gnus-show-threads t
257 "*If non-nil, display threads in summary mode."
261 (defcustom gnus-thread-hide-subtree nil
262 "*If non-nil, hide all threads initially.
263 This can be a predicate specifier which says which threads to hide.
264 If threads are hidden, you have to run the command
265 `gnus-summary-show-thread' by hand or select an article."
267 :type '(radio (sexp :format "Non-nil\n"
268 :match (lambda (widget value)
269 (not (or (consp value) (functionp value))))
272 (sexp :tag "Predicate specifier")))
274 (defcustom gnus-thread-hide-killed t
275 "*If non-nil, hide killed threads automatically."
279 (defcustom gnus-thread-ignore-subject t
280 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
281 If nil, articles that have different subjects from their parents will
282 start separate threads."
286 (defcustom gnus-thread-operation-ignore-subject t
287 "*If non-nil, subjects will be ignored when doing thread commands.
288 This affects commands like `gnus-summary-kill-thread' and
289 `gnus-summary-lower-thread'.
291 If this variable is nil, articles in the same thread with different
292 subjects will not be included in the operation in question. If this
293 variable is `fuzzy', only articles that have subjects that are fuzzily
294 equal will be included."
296 :type '(choice (const :tag "off" nil)
300 (defcustom gnus-thread-indent-level 4
301 "*Number that says how much each sub-thread should be indented."
305 (defcustom gnus-auto-extend-newsgroup t
306 "*If non-nil, extend newsgroup forward and backward when requested."
307 :group 'gnus-summary-choose
310 (defcustom gnus-auto-select-first t
311 "If non-nil, select an article on group entry.
312 An article is selected automatically when entering a group
313 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
314 `gnus-summary-catchup-and-goto-next-group'.
316 Which article is selected is controlled by the variable
317 `gnus-auto-select-subject'.
319 If you want to prevent automatic selection of articles in some
320 newsgroups, set the variable to nil in `gnus-select-group-hook'."
321 ;; Commands include...
322 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
323 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
324 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
325 :group 'gnus-group-select
326 :type '(choice (const :tag "none" nil)
327 (sexp :menu-tag "first" t)))
329 (defcustom gnus-auto-select-subject 'unread
330 "*Says what subject to place under point when entering a group.
332 This variable can either be the symbols `first' (place point on the
333 first subject), `unread' (place point on the subject line of the first
334 unread article), `best' (place point on the subject line of the
335 higest-scored article), `unseen' (place point on the subject line of
336 the first unseen article), `unseen-or-unread' (place point on the subject
337 line of the first unseen article or, if all article have been seen, on the
338 subject line of the first unread article), or a function to be called to
339 place point on some subject line."
341 :group 'gnus-group-select
342 :type '(choice (const best)
346 (const unseen-or-unread)))
348 (defcustom gnus-auto-select-next t
349 "*If non-nil, offer to go to the next group from the end of the previous.
350 If the value is t and the next newsgroup is empty, Gnus will exit
351 summary mode and go back to group mode. If the value is neither nil
352 nor t, Gnus will select the following unread newsgroup. In
353 particular, if the value is the symbol `quietly', the next unread
354 newsgroup will be selected without any confirmation, and if it is
355 `almost-quietly', the next group will be selected without any
356 confirmation if you are located on the last article in the group.
357 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
358 will go to the next group without confirmation."
359 :group 'gnus-summary-maneuvering
360 :type '(choice (const :tag "off" nil)
362 (const almost-quietly)
363 (const slightly-quietly)
364 (sexp :menu-tag "on" t)))
366 (defcustom gnus-auto-select-same nil
367 "*If non-nil, select the next article with the same subject.
368 If there are no more articles with the same subject, go to
369 the first unread article."
370 :group 'gnus-summary-maneuvering
373 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
374 "What article should be selected after exiting an ephemeral group.
375 Valid values include:
378 Select the next article.
380 Select the next unread article.
382 Move the cursor to the next article. This is the default.
383 `next-unread-noselect'
384 Move the cursor to the next unread article.
386 If it has any other value or there is no next (unread) article, the
387 article selected before entering to the ephemeral group will appear."
388 :version "23.0" ;; No Gnus
389 :group 'gnus-summary-maneuvering
390 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
391 (const next) (const next-unread)
392 (const next-noselect) (const next-unread-noselect)
393 (sexp :tag "other" :value nil)))
395 (defcustom gnus-auto-goto-ignores 'unfetched
396 "*Says how to handle unfetched articles when maneuvering.
398 This variable can either be the symbols nil (maneuver to any
399 article), `undownloaded' (maneuvering while unplugged ignores articles
400 that have not been fetched), `always-undownloaded' (maneuvering always
401 ignores articles that have not been fetched), `unfetched' (maneuvering
402 ignores articles whose headers have not been fetched).
404 NOTE: The list of unfetched articles will always be nil when plugged
405 and, when unplugged, a subset of the undownloaded article list."
407 :group 'gnus-summary-maneuvering
408 :type '(choice (const :tag "None" nil)
409 (const :tag "Undownloaded when unplugged" undownloaded)
410 (const :tag "Undownloaded" always-undownloaded)
411 (const :tag "Unfetched" unfetched)))
413 (defcustom gnus-summary-check-current nil
414 "*If non-nil, consider the current article when moving.
415 The \"unread\" movement commands will stay on the same line if the
416 current article is unread."
417 :group 'gnus-summary-maneuvering
420 (defcustom gnus-auto-center-summary 2
421 "*If non-nil, always center the current summary buffer.
422 In particular, if `vertical' do only vertical recentering. If non-nil
423 and non-`vertical', do both horizontal and vertical recentering."
424 :group 'gnus-summary-maneuvering
425 :type '(choice (const :tag "none" nil)
427 (integer :tag "height")
428 (sexp :menu-tag "both" t)))
430 (defvar gnus-auto-center-group t
431 "*If non-nil, always center the group buffer.")
433 (defcustom gnus-show-all-headers nil
434 "*If non-nil, don't hide any headers."
435 :group 'gnus-article-hiding
436 :group 'gnus-article-headers
439 (defcustom gnus-summary-ignore-duplicates nil
440 "*If non-nil, ignore articles with identical Message-ID headers."
444 (defcustom gnus-single-article-buffer t
445 "*If non-nil, display all articles in the same buffer.
446 If nil, each group will get its own article buffer."
447 :group 'gnus-article-various
450 (defcustom gnus-break-pages t
451 "*If non-nil, do page breaking on articles.
452 The page delimiter is specified by the `gnus-page-delimiter'
454 :group 'gnus-article-various
457 (defcustom gnus-move-split-methods nil
458 "*Variable used to suggest where articles are to be moved to.
459 It uses the same syntax as the `gnus-split-methods' variable.
460 However, whereas `gnus-split-methods' specifies file names as targets,
461 this variable specifies group names."
462 :group 'gnus-summary-mail
463 :type '(repeat (choice (list :value (fun) function)
464 (cons :value ("" "") regexp (repeat string))
467 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
468 "Function used to compute default prefix for article move/copy/etc prompts.
469 The function should take one argument, a group name, and return a
470 string with the suggested prefix."
471 :group 'gnus-summary-mail
474 ;; FIXME: Although the custom type is `character' for the following variables,
475 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
477 (defcustom gnus-unread-mark ? ;Whitespace
478 "*Mark used for unread articles."
479 :group 'gnus-summary-marks
482 (defcustom gnus-ticked-mark ?!
483 "*Mark used for ticked articles."
484 :group 'gnus-summary-marks
487 (defcustom gnus-dormant-mark ??
488 "*Mark used for dormant articles."
489 :group 'gnus-summary-marks
492 (defcustom gnus-del-mark ?r
493 "*Mark used for del'd articles."
494 :group 'gnus-summary-marks
497 (defcustom gnus-read-mark ?R
498 "*Mark used for read articles."
499 :group 'gnus-summary-marks
502 (defcustom gnus-expirable-mark ?E
503 "*Mark used for expirable articles."
504 :group 'gnus-summary-marks
507 (defcustom gnus-killed-mark ?K
508 "*Mark used for killed articles."
509 :group 'gnus-summary-marks
512 (defcustom gnus-spam-mark ?$
513 "*Mark used for spam articles."
515 :group 'gnus-summary-marks
518 (defcustom gnus-souped-mark ?F
519 "*Mark used for souped articles."
520 :group 'gnus-summary-marks
523 (defcustom gnus-kill-file-mark ?X
524 "*Mark used for articles killed by kill files."
525 :group 'gnus-summary-marks
528 (defcustom gnus-low-score-mark ?Y
529 "*Mark used for articles with a low score."
530 :group 'gnus-summary-marks
533 (defcustom gnus-catchup-mark ?C
534 "*Mark used for articles that are caught up."
535 :group 'gnus-summary-marks
538 (defcustom gnus-replied-mark ?A
539 "*Mark used for articles that have been replied to."
540 :group 'gnus-summary-marks
543 (defcustom gnus-forwarded-mark ?F
544 "*Mark used for articles that have been forwarded."
546 :group 'gnus-summary-marks
549 (defcustom gnus-recent-mark ?N
550 "*Mark used for articles that are recent."
552 :group 'gnus-summary-marks
555 (defcustom gnus-cached-mark ?*
556 "*Mark used for articles that are in the cache."
557 :group 'gnus-summary-marks
560 (defcustom gnus-saved-mark ?S
561 "*Mark used for articles that have been saved."
562 :group 'gnus-summary-marks
565 (defcustom gnus-unseen-mark ?.
566 "*Mark used for articles that haven't been seen."
568 :group 'gnus-summary-marks
571 (defcustom gnus-no-mark ? ;Whitespace
572 "*Mark used for articles that have no other secondary mark."
574 :group 'gnus-summary-marks
577 (defcustom gnus-ancient-mark ?O
578 "*Mark used for ancient articles."
579 :group 'gnus-summary-marks
582 (defcustom gnus-sparse-mark ?Q
583 "*Mark used for sparsely reffed articles."
584 :group 'gnus-summary-marks
587 (defcustom gnus-canceled-mark ?G
588 "*Mark used for canceled articles."
589 :group 'gnus-summary-marks
592 (defcustom gnus-duplicate-mark ?M
593 "*Mark used for duplicate articles."
594 :group 'gnus-summary-marks
597 (defcustom gnus-undownloaded-mark ?-
598 "*Mark used for articles that weren't downloaded."
600 :group 'gnus-summary-marks
603 (defcustom gnus-downloaded-mark ?+
604 "*Mark used for articles that were downloaded."
605 :group 'gnus-summary-marks
608 (defcustom gnus-downloadable-mark ?%
609 "*Mark used for articles that are to be downloaded."
610 :group 'gnus-summary-marks
613 (defcustom gnus-unsendable-mark ?=
614 "*Mark used for articles that won't be sent."
615 :group 'gnus-summary-marks
618 (defcustom gnus-score-over-mark ?+
619 "*Score mark used for articles with high scores."
620 :group 'gnus-summary-marks
623 (defcustom gnus-score-below-mark ?-
624 "*Score mark used for articles with low scores."
625 :group 'gnus-summary-marks
628 (defcustom gnus-empty-thread-mark ? ;Whitespace
629 "*There is no thread under the article."
630 :group 'gnus-summary-marks
633 (defcustom gnus-not-empty-thread-mark ?=
634 "*There is a thread under the article."
635 :group 'gnus-summary-marks
638 (defcustom gnus-view-pseudo-asynchronously nil
639 "*If non-nil, Gnus will view pseudo-articles asynchronously."
640 :group 'gnus-extract-view
643 (defcustom gnus-auto-expirable-marks
644 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
645 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
646 gnus-souped-mark gnus-duplicate-mark)
647 "*The list of marks converted into expiration if a group is auto-expirable."
650 :type '(repeat character))
652 (defcustom gnus-inhibit-user-auto-expire t
653 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
658 (defcustom gnus-view-pseudos nil
659 "*If `automatic', pseudo-articles will be viewed automatically.
660 If `not-confirm', pseudos will be viewed automatically, and the user
661 will not be asked to confirm the command."
662 :group 'gnus-extract-view
663 :type '(choice (const :tag "off" nil)
665 (const not-confirm)))
667 (defcustom gnus-view-pseudos-separately t
668 "*If non-nil, one pseudo-article will be created for each file to be viewed.
669 If nil, all files that use the same viewing command will be given as a
670 list of parameters to that command."
671 :group 'gnus-extract-view
674 (defcustom gnus-insert-pseudo-articles t
675 "*If non-nil, insert pseudo-articles when decoding articles."
676 :group 'gnus-extract-view
679 (defcustom gnus-summary-dummy-line-format
681 "*The format specification for the dummy roots in the summary buffer.
682 It works along the same lines as a normal formatting string,
683 with some simple extensions.
687 General format specifiers can also be used.
688 See `(gnus)Formatting Variables'."
689 :link '(custom-manual "(gnus)Formatting Variables")
690 :group 'gnus-threading
693 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
694 "*The format specification for the summary mode line.
695 It works along the same lines as a normal formatting string,
696 with some simple extensions:
699 %p Unprefixed group name
700 %A Current article number
701 %z Current article score
703 %U Number of unread articles in the group
704 %e Number of unselected articles in the group
705 %Z A string with unread/unselected article counts
706 %g Shortish group name
707 %S Subject of the current article
709 %s Current score file name
710 %d Number of dormant articles
711 %r Number of articles that have been marked as read in this session
712 %E Number of articles expunged by the score files"
713 :group 'gnus-summary-format
716 (defcustom gnus-list-identifiers nil
717 "Regexp that matches list identifiers to be removed from subject.
718 This can also be a list of regexps."
720 :group 'gnus-summary-format
721 :group 'gnus-article-hiding
722 :type '(choice (const :tag "none" nil)
724 (repeat :value (".*") regexp)))
726 (defcustom gnus-summary-mark-below 0
727 "*Mark all articles with a score below this variable as read.
728 This variable is local to each summary buffer and usually set by the
730 :group 'gnus-score-default
733 (defun gnus-widget-reversible-match (widget value)
734 "Ignoring WIDGET, convert VALUE to internal form.
735 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
739 (eq (length value) 2)
740 (eq (nth 0 value) 'not)
741 (symbolp (nth 1 value)))))
743 (defun gnus-widget-reversible-to-internal (widget value)
744 "Ignoring WIDGET, convert VALUE to internal form.
745 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
746 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
750 (list (nth 1 value) t)))
752 (defun gnus-widget-reversible-to-external (widget value)
753 "Ignoring WIDGET, convert VALUE to external form.
754 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
755 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
758 (list 'not (nth 0 value))
761 (define-widget 'gnus-widget-reversible 'group
762 "A `group' that convert values."
763 :match 'gnus-widget-reversible-match
764 :value-to-internal 'gnus-widget-reversible-to-internal
765 :value-to-external 'gnus-widget-reversible-to-external)
767 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
768 "*List of functions used for sorting articles in the summary buffer.
770 Each function takes two articles and returns non-nil if the first
771 article should be sorted before the other. If you use more than one
772 function, the primary sort function should be the last. You should
773 probably always include `gnus-article-sort-by-number' in the list of
774 sorting functions -- preferably first. Also note that sorting by date
775 is often much slower than sorting by number, and the sorting order is
776 very similar. (Sorting by date means sorting by the time the message
777 was sent, sorting by number means sorting by arrival time.)
779 Each item can also be a list `(not F)' where F is a function;
780 this reverses the sort order.
782 Ready-made functions include `gnus-article-sort-by-number',
783 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
784 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
785 and `gnus-article-sort-by-score'.
787 When threading is turned on, the variable `gnus-thread-sort-functions'
788 controls how articles are sorted."
789 :group 'gnus-summary-sort
790 :type '(repeat (gnus-widget-reversible
791 (choice (function-item gnus-article-sort-by-number)
792 (function-item gnus-article-sort-by-author)
793 (function-item gnus-article-sort-by-subject)
794 (function-item gnus-article-sort-by-date)
795 (function-item gnus-article-sort-by-score)
796 (function-item gnus-article-sort-by-random)
797 (function :tag "other"))
798 (boolean :tag "Reverse order"))))
801 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
802 "*List of functions used for sorting threads in the summary buffer.
803 By default, threads are sorted by article number.
805 Each function takes two threads and returns non-nil if the first
806 thread should be sorted before the other. If you use more than one
807 function, the primary sort function should be the last. You should
808 probably always include `gnus-thread-sort-by-number' in the list of
809 sorting functions -- preferably first. Also note that sorting by date
810 is often much slower than sorting by number, and the sorting order is
811 very similar. (Sorting by date means sorting by the time the message
812 was sent, sorting by number means sorting by arrival time.)
814 Each list item can also be a list `(not F)' where F is a
815 function; this specifies reversed sort order.
817 Ready-made functions include `gnus-thread-sort-by-number',
818 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
819 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
820 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
821 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
822 and `gnus-thread-sort-by-total-score' (see
823 `gnus-thread-score-function').
825 When threading is turned off, the variable
826 `gnus-article-sort-functions' controls how articles are sorted."
827 :group 'gnus-summary-sort
829 (gnus-widget-reversible
830 (choice (function-item gnus-thread-sort-by-number)
831 (function-item gnus-thread-sort-by-author)
832 (function-item gnus-thread-sort-by-recipient)
833 (function-item gnus-thread-sort-by-subject)
834 (function-item gnus-thread-sort-by-date)
835 (function-item gnus-thread-sort-by-score)
836 (function-item gnus-thread-sort-by-most-recent-number)
837 (function-item gnus-thread-sort-by-most-recent-date)
838 (function-item gnus-thread-sort-by-random)
839 (function-item gnus-thread-sort-by-total-score)
840 (function :tag "other"))
841 (boolean :tag "Reverse order"))))
843 (defcustom gnus-thread-score-function '+
844 "*Function used for calculating the total score of a thread.
846 The function is called with the scores of the article and each
847 subthread and should then return the score of the thread.
849 Some functions you can use are `+', `max', or `min'."
850 :group 'gnus-summary-sort
853 (defcustom gnus-summary-expunge-below nil
854 "All articles that have a score less than this variable will be expunged.
855 This variable is local to the summary buffers."
856 :group 'gnus-score-default
857 :type '(choice (const :tag "off" nil)
860 (defcustom gnus-thread-expunge-below nil
861 "All threads that have a total score less than this variable will be expunged.
862 See `gnus-thread-score-function' for en explanation of what a
865 This variable is local to the summary buffers."
866 :group 'gnus-threading
867 :group 'gnus-score-default
868 :type '(choice (const :tag "off" nil)
871 (defcustom gnus-summary-mode-hook nil
872 "*A hook for Gnus summary mode.
873 This hook is run before any variables are set in the summary buffer."
874 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
875 :group 'gnus-summary-various
878 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
879 (when (featurep 'xemacs)
880 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
881 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
882 (add-hook 'gnus-summary-mode-hook
883 'gnus-xmas-switch-horizontal-scrollbar-off))
885 (defcustom gnus-summary-menu-hook nil
886 "*Hook run after the creation of the summary mode menu."
887 :group 'gnus-summary-visual
890 (defcustom gnus-summary-exit-hook nil
891 "*A hook called on exit from the summary buffer.
892 It will be called with point in the group buffer."
893 :group 'gnus-summary-exit
896 (defcustom gnus-summary-prepare-hook nil
897 "*A hook called after the summary buffer has been generated.
898 If you want to modify the summary buffer, you can use this hook."
899 :group 'gnus-summary-various
902 (defcustom gnus-summary-prepared-hook nil
903 "*A hook called as the last thing after the summary buffer has been generated."
904 :group 'gnus-summary-various
907 (defcustom gnus-summary-generate-hook nil
908 "*A hook run just before generating the summary buffer.
909 This hook is commonly used to customize threading variables and the
911 :group 'gnus-summary-various
914 (defcustom gnus-select-group-hook nil
915 "*A hook called when a newsgroup is selected.
917 If you'd like to simplify subjects like the
918 `gnus-summary-next-same-subject' command does, you can use the
921 (add-hook gnus-select-group-hook
923 (mapcar (lambda (header)
924 (mail-header-set-subject
926 (gnus-simplify-subject
927 (mail-header-subject header) 're-only)))
928 gnus-newsgroup-headers)))"
929 :group 'gnus-group-select
932 (defcustom gnus-select-article-hook nil
933 "*A hook called when an article is selected."
934 :group 'gnus-summary-choose
935 :options '(gnus-agent-fetch-selected-article)
938 (defcustom gnus-visual-mark-article-hook
939 (list 'gnus-highlight-selected-summary)
940 "*Hook run after selecting an article in the summary buffer.
941 It is meant to be used for highlighting the article in some way. It
942 is not run if `gnus-visual' is nil."
943 :group 'gnus-summary-visual
946 (defcustom gnus-parse-headers-hook nil
947 "*A hook called before parsing the headers."
951 (defcustom gnus-exit-group-hook nil
952 "*A hook called when exiting summary mode.
953 This hook is not called from the non-updating exit commands like `Q'."
957 (defcustom gnus-summary-update-hook
958 (list 'gnus-summary-highlight-line)
959 "*A hook called when a summary line is changed.
960 The hook will not be called if `gnus-visual' is nil.
962 The default function `gnus-summary-highlight-line' will
963 highlight the line according to the `gnus-summary-highlight'
965 :group 'gnus-summary-visual
968 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
969 "*A hook called when an article is selected for the first time.
970 The hook is intended to mark an article as read (or unread)
971 automatically when it is selected."
972 :group 'gnus-summary-choose
975 (defcustom gnus-group-no-more-groups-hook nil
976 "*A hook run when returning to group mode having no more (unread) groups."
977 :group 'gnus-group-select
980 (defcustom gnus-ps-print-hook nil
981 "*A hook run before ps-printing something from Gnus."
985 (defcustom gnus-summary-article-move-hook nil
986 "*A hook called after an article is moved, copied, respooled, or crossposted."
991 (defcustom gnus-summary-article-delete-hook nil
992 "*A hook called after an article is deleted."
997 (defcustom gnus-summary-article-expire-hook nil
998 "*A hook called after an article is expired."
1000 :group 'gnus-summary
1003 (defcustom gnus-summary-display-arrow
1004 (and (fboundp 'display-graphic-p)
1005 (display-graphic-p))
1006 "*If non-nil, display an arrow highlighting the current article."
1008 :group 'gnus-summary
1011 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1012 "Face used for highlighting the current article in the summary buffer."
1013 :group 'gnus-summary-visual
1016 (defvar gnus-tmp-downloaded nil)
1018 (defcustom gnus-summary-highlight
1019 '(((eq mark gnus-canceled-mark)
1020 . gnus-summary-cancelled)
1021 ((and uncached (> score default-high))
1022 . gnus-summary-high-undownloaded)
1023 ((and uncached (< score default-low))
1024 . gnus-summary-low-undownloaded)
1026 . gnus-summary-normal-undownloaded)
1027 ((and (> score default-high)
1028 (or (eq mark gnus-dormant-mark)
1029 (eq mark gnus-ticked-mark)))
1030 . gnus-summary-high-ticked)
1031 ((and (< score default-low)
1032 (or (eq mark gnus-dormant-mark)
1033 (eq mark gnus-ticked-mark)))
1034 . gnus-summary-low-ticked)
1035 ((or (eq mark gnus-dormant-mark)
1036 (eq mark gnus-ticked-mark))
1037 . gnus-summary-normal-ticked)
1038 ((and (> score default-high) (eq mark gnus-ancient-mark))
1039 . gnus-summary-high-ancient)
1040 ((and (< score default-low) (eq mark gnus-ancient-mark))
1041 . gnus-summary-low-ancient)
1042 ((eq mark gnus-ancient-mark)
1043 . gnus-summary-normal-ancient)
1044 ((and (> score default-high) (eq mark gnus-unread-mark))
1045 . gnus-summary-high-unread)
1046 ((and (< score default-low) (eq mark gnus-unread-mark))
1047 . gnus-summary-low-unread)
1048 ((eq mark gnus-unread-mark)
1049 . gnus-summary-normal-unread)
1050 ((> score default-high)
1051 . gnus-summary-high-read)
1052 ((< score default-low)
1053 . gnus-summary-low-read)
1055 . gnus-summary-normal-read))
1056 "*Controls the highlighting of summary buffer lines.
1058 A list of (FORM . FACE) pairs. When deciding how a a particular
1059 summary line should be displayed, each form is evaluated. The content
1060 of the face field after the first true form is used. You can change
1061 how those summary lines are displayed, by editing the face field.
1063 You can use the following variables in the FORM field.
1065 score: The article's score
1066 default: The default article score.
1067 default-high: The default score for high scored articles.
1068 default-low: The default score for low scored articles.
1069 below: The score below which articles are automatically marked as read.
1070 mark: The article's mark.
1071 uncached: Non-nil if the article is uncached."
1072 :group 'gnus-summary-visual
1073 :type '(repeat (cons (sexp :tag "Form" nil)
1076 (defcustom gnus-alter-header-function nil
1077 "Function called to allow alteration of article header structures.
1078 The function is called with one parameter, the article header vector,
1079 which it may alter in any way."
1080 :type '(choice (const :tag "None" nil)
1082 :group 'gnus-summary)
1084 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1085 "Function used to decode a string with encoded words.")
1087 (defvar gnus-decode-encoded-address-function
1088 'mail-decode-encoded-address-string
1089 "Function used to decode addresses with encoded words.")
1091 (defcustom gnus-extra-headers '(To Newsgroups)
1092 "*Extra headers to parse."
1094 :group 'gnus-summary
1095 :type '(repeat symbol))
1097 (defcustom gnus-ignored-from-addresses
1098 (and user-mail-address
1099 (not (string= user-mail-address ""))
1100 (regexp-quote user-mail-address))
1101 "*From headers that may be suppressed in favor of To headers.
1102 This can be a regexp or a list of regexps."
1104 :group 'gnus-summary
1105 :type '(choice regexp
1106 (repeat :tag "Regexp List" regexp)))
1108 (defsubst gnus-ignored-from-addresses ()
1109 (gmm-regexp-concat gnus-ignored-from-addresses))
1111 (defcustom gnus-summary-to-prefix "-> "
1112 "*String prefixed to the To field in the summary line when
1113 using `gnus-ignored-from-addresses'."
1115 :group 'gnus-summary
1118 (defcustom gnus-summary-newsgroup-prefix "=> "
1119 "*String prefixed to the Newsgroup field in the summary
1120 line when using `gnus-ignored-from-addresses'."
1122 :group 'gnus-summary
1125 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1126 "List of charsets that should be ignored.
1127 When these charsets are used in the \"charset\" parameter, the
1128 default charset will be used instead."
1130 :type '(repeat symbol)
1131 :group 'gnus-charset)
1133 (gnus-define-group-parameter
1137 "Return the ignored charsets of GROUP."
1138 :variable gnus-group-ignored-charsets-alist
1140 '(("alt\\.chinese\\.text" iso-8859-1))
1142 "Alist of regexps (to match group names) and charsets that should be ignored.
1143 When these charsets are used in the \"charset\" parameter, the
1144 default charset will be used instead."
1145 :variable-group gnus-charset
1146 :variable-type '(repeat (cons (regexp :tag "Group")
1148 :parameter-type '(choice :tag "Ignored charsets"
1151 :parameter-document "\
1152 List of charsets that should be ignored.
1154 When these charsets are used in the \"charset\" parameter, the
1155 default charset will be used instead.")
1157 (defcustom gnus-group-highlight-words-alist nil
1158 "Alist of group regexps and highlight regexps.
1159 This variable uses the same syntax as `gnus-emphasis-alist'."
1161 :type '(repeat (cons (regexp :tag "Group")
1162 (repeat (list (regexp :tag "Highlight regexp")
1163 (number :tag "Group for entire word" 0)
1164 (number :tag "Group for displayed part" 0)
1166 gnus-emphasis-highlight-words)))))
1167 :group 'gnus-summary-visual)
1169 (defcustom gnus-summary-show-article-charset-alist
1171 "Alist of number and charset.
1172 The article will be shown with the charset corresponding to the
1174 For example: ((1 . cn-gb-2312) (2 . big5))."
1176 :type '(repeat (cons (number :tag "Argument" 1)
1177 (symbol :tag "Charset")))
1178 :group 'gnus-charset)
1180 (defcustom gnus-preserve-marks t
1181 "Whether marks are preserved when moving, copying and respooling messages."
1184 :group 'gnus-summary-marks)
1186 (defcustom gnus-alter-articles-to-read-function nil
1187 "Function to be called to alter the list of articles to be selected."
1188 :type '(choice (const nil) function)
1189 :group 'gnus-summary)
1191 (defcustom gnus-orphan-score nil
1192 "*All orphans get this score added. Set in the score file."
1193 :group 'gnus-score-default
1194 :type '(choice (const nil)
1197 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1198 "*A regexp to match MIME parts when saving multiple parts of a
1199 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1200 This regexp will be used by default when prompting the user for which
1201 type of files to save."
1202 :group 'gnus-summary
1205 (defcustom gnus-read-all-available-headers nil
1206 "Whether Gnus should parse all headers made available to it.
1207 This is mostly relevant for slow back ends where the user may
1208 wish to widen the summary buffer to include all headers
1209 that were fetched. Say, for nnultimate groups."
1211 :group 'gnus-summary
1212 :type '(choice boolean regexp))
1214 (defcustom gnus-summary-muttprint-program "muttprint"
1215 "Command (and optional arguments) used to run Muttprint."
1217 :group 'gnus-summary
1220 (defcustom gnus-article-loose-mime t
1221 "If non-nil, don't require MIME-Version header.
1222 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1223 supply the MIME-Version header or deliberately strip it from the mail.
1224 If non-nil (the default), Gnus will treat some articles as MIME
1225 even if the MIME-Version header is missing."
1228 :group 'gnus-article-mime)
1230 (defcustom gnus-article-emulate-mime t
1231 "If non-nil, use MIME emulation for uuencode and the like.
1232 This means that Gnus will search message bodies for text that look
1233 like uuencoded bits, yEncoded bits, and so on, and present that using
1234 the normal Gnus MIME machinery."
1237 :group 'gnus-article-mime)
1239 ;;; Internal variables
1241 (defvar gnus-summary-display-cache nil)
1242 (defvar gnus-article-mime-handles nil)
1243 (defvar gnus-article-decoded-p nil)
1244 (defvar gnus-article-charset nil)
1245 (defvar gnus-article-ignored-charsets nil)
1246 (defvar gnus-scores-exclude-files nil)
1247 (defvar gnus-page-broken nil)
1249 (defvar gnus-original-article nil)
1250 (defvar gnus-article-internal-prepare-hook nil)
1251 (defvar gnus-newsgroup-process-stack nil)
1253 (defvar gnus-thread-indent-array nil)
1254 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1255 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1256 "Function called to sort the articles within a thread after it has been gathered together.")
1258 (defvar gnus-summary-save-parts-type-history nil)
1259 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1261 ;; Avoid highlighting in kill files.
1262 (defvar gnus-summary-inhibit-highlight nil)
1263 (defvar gnus-newsgroup-selected-overlay nil)
1264 (defvar gnus-inhibit-limiting nil)
1265 (defvar gnus-newsgroup-adaptive-score-file nil)
1266 (defvar gnus-current-score-file nil)
1267 (defvar gnus-current-move-group nil)
1268 (defvar gnus-current-copy-group nil)
1269 (defvar gnus-current-crosspost-group nil)
1270 (defvar gnus-newsgroup-display nil)
1272 (defvar gnus-newsgroup-dependencies nil)
1273 (defvar gnus-newsgroup-adaptive nil)
1274 (defvar gnus-summary-display-article-function nil)
1275 (defvar gnus-summary-highlight-line-function nil
1276 "Function called after highlighting a summary line.")
1278 (defvar gnus-summary-line-format-alist
1279 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1280 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1281 (?s gnus-tmp-subject-or-nil ?s)
1282 (?n gnus-tmp-name ?s)
1283 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1285 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1287 (?F gnus-tmp-from ?s)
1288 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1289 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1290 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1291 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1292 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1293 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1294 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1295 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1296 (?L gnus-tmp-lines ?s)
1297 (?O gnus-tmp-downloaded ?c)
1298 (?I gnus-tmp-indentation ?s)
1299 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1300 (?R gnus-tmp-replied ?c)
1301 (?\[ gnus-tmp-opening-bracket ?c)
1302 (?\] gnus-tmp-closing-bracket ?c)
1303 (?\> (make-string gnus-tmp-level ? ) ?s)
1304 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1305 (?i gnus-tmp-score ?d)
1306 (?z gnus-tmp-score-char ?c)
1307 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1308 (?U gnus-tmp-unread ?c)
1309 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1311 (?t (gnus-summary-number-of-articles-in-thread
1312 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1314 (?e (gnus-summary-number-of-articles-in-thread
1315 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1317 (?u gnus-tmp-user-defined ?s)
1318 (?P (gnus-pick-line-number) ?d)
1319 (?B gnus-tmp-thread-tree-header-string ?s)
1320 (user-date (gnus-user-date
1321 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1322 "An alist of format specifications that can appear in summary lines.
1323 These are paired with what variables they correspond with, along with
1324 the type of the variable (string, integer, character, etc).")
1326 (defvar gnus-summary-dummy-line-format-alist
1327 `((?S gnus-tmp-subject ?s)
1328 (?N gnus-tmp-number ?d)
1329 (?u gnus-tmp-user-defined ?s)))
1331 (defvar gnus-summary-mode-line-format-alist
1332 `((?G gnus-tmp-group-name ?s)
1333 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1334 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1335 (?A gnus-tmp-article-number ?d)
1336 (?Z gnus-tmp-unread-and-unselected ?s)
1337 (?V gnus-version ?s)
1338 (?U gnus-tmp-unread-and-unticked ?d)
1339 (?S gnus-tmp-subject ?s)
1340 (?e gnus-tmp-unselected ?d)
1341 (?u gnus-tmp-user-defined ?s)
1342 (?d (length gnus-newsgroup-dormant) ?d)
1343 (?t (length gnus-newsgroup-marked) ?d)
1344 (?h (length gnus-newsgroup-spam-marked) ?d)
1345 (?r (length gnus-newsgroup-reads) ?d)
1346 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1347 (?E gnus-newsgroup-expunged-tally ?d)
1348 (?s (gnus-current-score-file-nondirectory) ?s)))
1350 (defvar gnus-last-search-regexp nil
1351 "Default regexp for article search command.")
1353 (defvar gnus-last-shell-command nil
1354 "Default shell command on article.")
1356 (defvar gnus-newsgroup-agentized nil
1357 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1358 (defvar gnus-newsgroup-begin nil)
1359 (defvar gnus-newsgroup-end nil)
1360 (defvar gnus-newsgroup-last-rmail nil)
1361 (defvar gnus-newsgroup-last-mail nil)
1362 (defvar gnus-newsgroup-last-folder nil)
1363 (defvar gnus-newsgroup-last-file nil)
1364 (defvar gnus-newsgroup-last-directory nil)
1365 (defvar gnus-newsgroup-auto-expire nil)
1366 (defvar gnus-newsgroup-active nil)
1368 (defvar gnus-newsgroup-data nil)
1369 (defvar gnus-newsgroup-data-reverse nil)
1370 (defvar gnus-newsgroup-limit nil)
1371 (defvar gnus-newsgroup-limits nil)
1372 (defvar gnus-summary-use-undownloaded-faces nil)
1374 (defvar gnus-newsgroup-unreads nil
1375 "Sorted list of unread articles in the current newsgroup.")
1377 (defvar gnus-newsgroup-unselected nil
1378 "Sorted list of unselected unread articles in the current newsgroup.")
1380 (defvar gnus-newsgroup-reads nil
1381 "Alist of read articles and article marks in the current newsgroup.")
1383 (defvar gnus-newsgroup-expunged-tally nil)
1385 (defvar gnus-newsgroup-marked nil
1386 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1388 (defvar gnus-newsgroup-spam-marked nil
1389 "List of ranges of articles that have been marked as spam.")
1391 (defvar gnus-newsgroup-killed nil
1392 "List of ranges of articles that have been through the scoring process.")
1394 (defvar gnus-newsgroup-cached nil
1395 "Sorted list of articles that come from the article cache.")
1397 (defvar gnus-newsgroup-saved nil
1398 "List of articles that have been saved.")
1400 (defvar gnus-newsgroup-kill-headers nil)
1402 (defvar gnus-newsgroup-replied nil
1403 "List of articles that have been replied to in the current newsgroup.")
1405 (defvar gnus-newsgroup-forwarded nil
1406 "List of articles that have been forwarded in the current newsgroup.")
1408 (defvar gnus-newsgroup-recent nil
1409 "List of articles that have are recent in the current newsgroup.")
1411 (defvar gnus-newsgroup-expirable nil
1412 "Sorted list of articles in the current newsgroup that can be expired.")
1414 (defvar gnus-newsgroup-processable nil
1415 "List of articles in the current newsgroup that can be processed.")
1417 (defvar gnus-newsgroup-downloadable nil
1418 "Sorted list of articles in the current newsgroup that can be processed.")
1420 (defvar gnus-newsgroup-unfetched nil
1421 "Sorted list of articles in the current newsgroup whose headers have
1422 not been fetched into the agent.
1424 This list will always be a subset of gnus-newsgroup-undownloaded.")
1426 (defvar gnus-newsgroup-undownloaded nil
1427 "List of articles in the current newsgroup that haven't been downloaded.")
1429 (defvar gnus-newsgroup-unsendable nil
1430 "List of articles in the current newsgroup that won't be sent.")
1432 (defvar gnus-newsgroup-bookmarks nil
1433 "List of articles in the current newsgroup that have bookmarks.")
1435 (defvar gnus-newsgroup-dormant nil
1436 "Sorted list of dormant articles in the current newsgroup.")
1438 (defvar gnus-newsgroup-unseen nil
1439 "List of unseen articles in the current newsgroup.")
1441 (defvar gnus-newsgroup-seen nil
1442 "Range of seen articles in the current newsgroup.")
1444 (defvar gnus-newsgroup-articles nil
1445 "List of articles in the current newsgroup.")
1447 (defvar gnus-newsgroup-scored nil
1448 "List of scored articles in the current newsgroup.")
1450 (defvar gnus-newsgroup-headers nil
1451 "List of article headers in the current newsgroup.")
1453 (defvar gnus-newsgroup-threads nil)
1455 (defvar gnus-newsgroup-prepared nil
1456 "Whether the current group has been prepared properly.")
1458 (defvar gnus-newsgroup-ancient nil
1459 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1461 (defvar gnus-newsgroup-sparse nil)
1463 (defvar gnus-current-article nil)
1464 (defvar gnus-article-current nil)
1465 (defvar gnus-current-headers nil)
1466 (defvar gnus-have-all-headers nil)
1467 (defvar gnus-last-article nil)
1468 (defvar gnus-newsgroup-history nil)
1469 (defvar gnus-newsgroup-charset nil)
1470 (defvar gnus-newsgroup-ephemeral-charset nil)
1471 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1473 (defvar gnus-article-before-search nil)
1475 (defvar gnus-summary-local-variables
1476 '(gnus-newsgroup-name
1477 gnus-newsgroup-begin gnus-newsgroup-end
1478 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1479 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1480 gnus-newsgroup-last-directory
1481 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1482 gnus-newsgroup-unselected gnus-newsgroup-marked
1483 gnus-newsgroup-spam-marked
1484 gnus-newsgroup-reads gnus-newsgroup-saved
1485 gnus-newsgroup-replied gnus-newsgroup-forwarded
1486 gnus-newsgroup-recent
1487 gnus-newsgroup-expirable
1488 gnus-newsgroup-processable gnus-newsgroup-killed
1489 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1490 gnus-newsgroup-unfetched
1491 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1492 gnus-newsgroup-seen gnus-newsgroup-articles
1493 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1494 gnus-newsgroup-headers gnus-newsgroup-threads
1495 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1496 gnus-current-article gnus-current-headers gnus-have-all-headers
1497 gnus-last-article gnus-article-internal-prepare-hook
1498 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1499 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1500 gnus-thread-expunge-below
1501 gnus-score-alist gnus-current-score-file
1502 (gnus-summary-expunge-below . global)
1503 (gnus-summary-mark-below . global)
1504 (gnus-orphan-score . global)
1505 gnus-newsgroup-active gnus-scores-exclude-files
1506 gnus-newsgroup-history gnus-newsgroup-ancient
1507 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1508 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1509 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1510 (gnus-newsgroup-expunged-tally . 0)
1511 gnus-cache-removable-articles gnus-newsgroup-cached
1512 gnus-newsgroup-data gnus-newsgroup-data-reverse
1513 gnus-newsgroup-limit gnus-newsgroup-limits
1514 gnus-newsgroup-charset gnus-newsgroup-display
1515 gnus-summary-use-undownloaded-faces)
1516 "Variables that are buffer-local to the summary buffers.")
1518 (defvar gnus-newsgroup-variables nil
1519 "A list of variables that have separate values in different newsgroups.
1520 A list of newsgroup (summary buffer) local variables, or cons of
1521 variables and their default expressions to be evalled (when the default
1522 values are not nil), that should be made global while the summary buffer
1525 Note: The default expressions will be evaluated (using function `eval')
1526 before assignment to the local variable rather than just assigned to it.
1527 If the default expression is the symbol `global', that symbol will not
1528 be evaluated but the global value of the local variable will be used
1531 These variables can be used to set variables in the group parameters
1532 while still allowing them to affect operations done in other buffers.
1535 \(setq gnus-newsgroup-variables
1536 '(message-use-followup-to
1537 (gnus-visible-headers .
1538 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1541 ;; Byte-compiler warning.
1543 ;; Bind features so that require will believe that gnus-sum has
1544 ;; already been loaded (avoids infinite recursion)
1545 (let ((features (cons 'gnus-sum features)))
1546 ;; Several of the declarations in gnus-sum are needed to load the
1547 ;; following files. Right now, these definitions have been
1548 ;; compiled but not defined (evaluated). We could either do a
1549 ;; eval-and-compile about all of the declarations or evaluate the
1551 (if (boundp 'gnus-newsgroup-variables)
1553 (load "gnus-sum.el" t t t))
1555 (require 'gnus-art)))
1559 (defvar gnus-decode-encoded-word-methods
1560 '(mail-decode-encoded-word-string)
1561 "List of methods used to decode encoded words.
1563 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1564 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1565 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1566 whose names match REGEXP.
1569 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1570 mail-decode-encoded-word-string
1571 (\"chinese\" . rfc1843-decode-string))")
1573 (defvar gnus-decode-encoded-word-methods-cache nil)
1575 (defun gnus-multi-decode-encoded-word-string (string)
1576 "Apply the functions from `gnus-encoded-word-methods' that match."
1577 (unless (and gnus-decode-encoded-word-methods-cache
1578 (eq gnus-newsgroup-name
1579 (car gnus-decode-encoded-word-methods-cache)))
1580 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1583 (nconc gnus-decode-encoded-word-methods-cache (list x))
1584 (if (and gnus-newsgroup-name
1585 (string-match (car x) gnus-newsgroup-name))
1586 (nconc gnus-decode-encoded-word-methods-cache
1588 gnus-decode-encoded-word-methods))
1589 (let ((xlist gnus-decode-encoded-word-methods-cache))
1592 (setq string (funcall (pop xlist) string))))
1595 ;; Subject simplification.
1597 (defun gnus-simplify-whitespace (str)
1598 "Remove excessive whitespace from STR."
1600 (while (string-match "[ \t][ \t]+" str)
1601 (setq str (concat (substring str 0 (match-beginning 0))
1603 (substring str (match-end 0)))))
1605 (when (string-match "^[ \t]+" str)
1606 (setq str (substring str (match-end 0))))
1608 (when (string-match "[ \t]+$" str)
1609 (setq str (substring str 0 (match-beginning 0))))
1612 (defun gnus-simplify-all-whitespace (str)
1613 "Remove all whitespace from STR."
1614 (while (string-match "[ \t\n]+" str)
1615 (setq str (replace-match "" nil nil str)))
1618 (defsubst gnus-simplify-subject-re (subject)
1619 "Remove \"Re:\" from subject lines."
1620 (if (string-match message-subject-re-regexp subject)
1621 (substring subject (match-end 0))
1624 (defun gnus-simplify-subject (subject &optional re-only)
1625 "Remove `Re:' and words in parentheses.
1626 If RE-ONLY is non-nil, strip leading `Re:'s only."
1627 (let ((case-fold-search t)) ;Ignore case.
1628 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1629 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1630 (setq subject (substring subject (match-end 0))))
1631 ;; Remove uninteresting prefixes.
1632 (when (and (not re-only)
1633 gnus-simplify-ignored-prefixes
1634 (string-match gnus-simplify-ignored-prefixes subject))
1635 (setq subject (substring subject (match-end 0))))
1636 ;; Remove words in parentheses from end.
1638 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1639 (setq subject (substring subject 0 (match-beginning 0)))))
1640 ;; Return subject string.
1643 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1645 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1646 (goto-char (point-min))
1647 (while (re-search-forward regexp nil t)
1648 (replace-match (or newtext ""))))
1650 (defun gnus-simplify-buffer-fuzzy ()
1651 "Simplify string in the buffer fuzzily.
1652 The string in the accessible portion of the current buffer is simplified.
1653 It is assumed to be a single-line subject.
1654 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1655 matter is removed. Additional things can be deleted by setting
1656 `gnus-simplify-subject-fuzzy-regexp'."
1657 (let ((case-fold-search t)
1659 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1661 (while (not (eq modified-tick (buffer-modified-tick)))
1662 (setq modified-tick (buffer-modified-tick))
1664 ((listp gnus-simplify-subject-fuzzy-regexp)
1665 (mapcar 'gnus-simplify-buffer-fuzzy-step
1666 gnus-simplify-subject-fuzzy-regexp))
1667 (gnus-simplify-subject-fuzzy-regexp
1668 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1669 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1670 (gnus-simplify-buffer-fuzzy-step
1671 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1672 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1674 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1675 (gnus-simplify-buffer-fuzzy-step " +" " ")
1676 (gnus-simplify-buffer-fuzzy-step " $")
1677 (gnus-simplify-buffer-fuzzy-step "^ +")))
1679 (defun gnus-simplify-subject-fuzzy (subject)
1680 "Simplify a subject string fuzzily.
1681 See `gnus-simplify-buffer-fuzzy' for details."
1683 (gnus-set-work-buffer)
1684 (let ((case-fold-search t))
1685 ;; Remove uninteresting prefixes.
1686 (when (and gnus-simplify-ignored-prefixes
1687 (string-match gnus-simplify-ignored-prefixes subject))
1688 (setq subject (substring subject (match-end 0))))
1690 (inline (gnus-simplify-buffer-fuzzy))
1693 (defsubst gnus-simplify-subject-fully (subject)
1694 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1696 (gnus-simplify-subject-functions
1697 (gnus-map-function gnus-simplify-subject-functions subject))
1698 ((null gnus-summary-gather-subject-limit)
1699 (gnus-simplify-subject-re subject))
1700 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1701 (gnus-simplify-subject-fuzzy subject))
1702 ((numberp gnus-summary-gather-subject-limit)
1703 (gnus-limit-string (gnus-simplify-subject-re subject)
1704 gnus-summary-gather-subject-limit))
1708 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1709 "Check whether two subjects are equal.
1710 If optional argument SIMPLE-FIRST is t, first argument is already
1713 ((null simple-first)
1714 (equal (gnus-simplify-subject-fully s1)
1715 (gnus-simplify-subject-fully s2)))
1718 (gnus-simplify-subject-fully s2)))))
1720 (defun gnus-summary-bubble-group ()
1721 "Increase the score of the current group.
1722 This is a handy function to add to `gnus-summary-exit-hook' to
1723 increase the score of each group you read."
1724 (gnus-group-add-score gnus-newsgroup-name))
1728 ;;; Gnus summary mode
1731 (put 'gnus-summary-mode 'mode-class 'special)
1733 (defvar gnus-article-commands-menu)
1735 ;; Non-orthogonal keys
1737 (gnus-define-keys gnus-summary-mode-map
1738 " " gnus-summary-next-page
1739 "\177" gnus-summary-prev-page
1740 [delete] gnus-summary-prev-page
1741 [backspace] gnus-summary-prev-page
1742 "\r" gnus-summary-scroll-up
1743 "\M-\r" gnus-summary-scroll-down
1744 "n" gnus-summary-next-unread-article
1745 "p" gnus-summary-prev-unread-article
1746 "N" gnus-summary-next-article
1747 "P" gnus-summary-prev-article
1748 "\M-\C-n" gnus-summary-next-same-subject
1749 "\M-\C-p" gnus-summary-prev-same-subject
1750 "\M-n" gnus-summary-next-unread-subject
1751 "\M-p" gnus-summary-prev-unread-subject
1752 "." gnus-summary-first-unread-article
1753 "," gnus-summary-best-unread-article
1754 "\M-s" gnus-summary-search-article-forward
1755 "\M-r" gnus-summary-search-article-backward
1756 "\M-S" gnus-summary-repeat-search-article-forward
1757 "\M-R" gnus-summary-repeat-search-article-backward
1758 "<" gnus-summary-beginning-of-article
1759 ">" gnus-summary-end-of-article
1760 "j" gnus-summary-goto-article
1761 "^" gnus-summary-refer-parent-article
1762 "\M-^" gnus-summary-refer-article
1763 "u" gnus-summary-tick-article-forward
1764 "!" gnus-summary-tick-article-forward
1765 "U" gnus-summary-tick-article-backward
1766 "d" gnus-summary-mark-as-read-forward
1767 "D" gnus-summary-mark-as-read-backward
1768 "E" gnus-summary-mark-as-expirable
1769 "\M-u" gnus-summary-clear-mark-forward
1770 "\M-U" gnus-summary-clear-mark-backward
1771 "k" gnus-summary-kill-same-subject-and-select
1772 "\C-k" gnus-summary-kill-same-subject
1773 "\M-\C-k" gnus-summary-kill-thread
1774 "\M-\C-l" gnus-summary-lower-thread
1775 "e" gnus-summary-edit-article
1776 "#" gnus-summary-mark-as-processable
1777 "\M-#" gnus-summary-unmark-as-processable
1778 "\M-\C-t" gnus-summary-toggle-threads
1779 "\M-\C-s" gnus-summary-show-thread
1780 "\M-\C-h" gnus-summary-hide-thread
1781 "\M-\C-f" gnus-summary-next-thread
1782 "\M-\C-b" gnus-summary-prev-thread
1783 [(meta down)] gnus-summary-next-thread
1784 [(meta up)] gnus-summary-prev-thread
1785 "\M-\C-u" gnus-summary-up-thread
1786 "\M-\C-d" gnus-summary-down-thread
1787 "&" gnus-summary-execute-command
1788 "c" gnus-summary-catchup-and-exit
1789 "\C-w" gnus-summary-mark-region-as-read
1790 "\C-t" gnus-summary-toggle-truncation
1791 "?" gnus-summary-mark-as-dormant
1792 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1793 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1794 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1795 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1796 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1797 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1798 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1799 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1800 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1801 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1802 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1803 "=" gnus-summary-expand-window
1804 "\C-x\C-s" gnus-summary-reselect-current-group
1805 "\M-g" gnus-summary-rescan-group
1806 "w" gnus-summary-stop-page-breaking
1807 "\C-c\C-r" gnus-summary-caesar-message
1808 "f" gnus-summary-followup
1809 "F" gnus-summary-followup-with-original
1810 "C" gnus-summary-cancel-article
1811 "r" gnus-summary-reply
1812 "R" gnus-summary-reply-with-original
1813 "\C-c\C-f" gnus-summary-mail-forward
1814 "o" gnus-summary-save-article
1815 "\C-o" gnus-summary-save-article-mail
1816 "|" gnus-summary-pipe-output
1817 "\M-k" gnus-summary-edit-local-kill
1818 "\M-K" gnus-summary-edit-global-kill
1820 "\C-c\C-d" gnus-summary-describe-group
1821 "q" gnus-summary-exit
1822 "Q" gnus-summary-exit-no-update
1823 "\C-c\C-i" gnus-info-find-node
1824 gnus-mouse-2 gnus-mouse-pick-article
1825 [follow-link] mouse-face
1826 "m" gnus-summary-mail-other-window
1827 "a" gnus-summary-post-news
1828 "i" gnus-summary-news-other-window
1829 "x" gnus-summary-limit-to-unread
1830 "s" gnus-summary-isearch-article
1831 "t" gnus-summary-toggle-header
1832 "g" gnus-summary-show-article
1833 "l" gnus-summary-goto-last-article
1834 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1835 "\C-d" gnus-summary-enter-digest-group
1836 "\M-\C-d" gnus-summary-read-document
1837 "\M-\C-e" gnus-summary-edit-parameters
1838 "\M-\C-a" gnus-summary-customize-parameters
1840 "*" gnus-cache-enter-article
1841 "\M-*" gnus-cache-remove-article
1842 "\M-&" gnus-summary-universal-argument
1843 "\C-l" gnus-recenter
1844 "I" gnus-summary-increase-score
1845 "L" gnus-summary-lower-score
1846 "\M-i" gnus-symbolic-argument
1847 "h" gnus-summary-select-article-buffer
1849 "b" gnus-article-view-part
1850 "\M-t" gnus-summary-toggle-display-buttonized
1852 "V" gnus-summary-score-map
1853 "X" gnus-uu-extract-map
1854 "S" gnus-summary-send-map)
1856 ;; Sort of orthogonal keymap
1857 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1858 "t" gnus-summary-tick-article-forward
1859 "!" gnus-summary-tick-article-forward
1860 "d" gnus-summary-mark-as-read-forward
1861 "r" gnus-summary-mark-as-read-forward
1862 "c" gnus-summary-clear-mark-forward
1863 " " gnus-summary-clear-mark-forward
1864 "e" gnus-summary-mark-as-expirable
1865 "x" gnus-summary-mark-as-expirable
1866 "?" gnus-summary-mark-as-dormant
1867 "b" gnus-summary-set-bookmark
1868 "B" gnus-summary-remove-bookmark
1869 "#" gnus-summary-mark-as-processable
1870 "\M-#" gnus-summary-unmark-as-processable
1871 "S" gnus-summary-limit-include-expunged
1872 "C" gnus-summary-catchup
1873 "H" gnus-summary-catchup-to-here
1874 "h" gnus-summary-catchup-from-here
1875 "\C-c" gnus-summary-catchup-all
1876 "k" gnus-summary-kill-same-subject-and-select
1877 "K" gnus-summary-kill-same-subject
1878 "P" gnus-uu-mark-map)
1880 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1881 "c" gnus-summary-clear-above
1882 "u" gnus-summary-tick-above
1883 "m" gnus-summary-mark-above
1884 "k" gnus-summary-kill-below)
1886 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1887 "/" gnus-summary-limit-to-subject
1888 "n" gnus-summary-limit-to-articles
1889 "b" gnus-summary-limit-to-bodies
1890 "h" gnus-summary-limit-to-headers
1891 "w" gnus-summary-pop-limit
1892 "s" gnus-summary-limit-to-subject
1893 "a" gnus-summary-limit-to-author
1894 "u" gnus-summary-limit-to-unread
1895 "m" gnus-summary-limit-to-marks
1896 "M" gnus-summary-limit-exclude-marks
1897 "v" gnus-summary-limit-to-score
1898 "*" gnus-summary-limit-include-cached
1899 "D" gnus-summary-limit-include-dormant
1900 "T" gnus-summary-limit-include-thread
1901 "d" gnus-summary-limit-exclude-dormant
1902 "t" gnus-summary-limit-to-age
1903 "." gnus-summary-limit-to-unseen
1904 "x" gnus-summary-limit-to-extra
1905 "p" gnus-summary-limit-to-display-predicate
1906 "E" gnus-summary-limit-include-expunged
1907 "c" gnus-summary-limit-exclude-childless-dormant
1908 "C" gnus-summary-limit-mark-excluded-as-read
1909 "o" gnus-summary-insert-old-articles
1910 "N" gnus-summary-insert-new-articles
1911 "S" gnus-summary-limit-to-singletons
1912 "r" gnus-summary-limit-to-replied
1913 "R" gnus-summary-limit-to-recipient)
1915 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1916 "n" gnus-summary-next-unread-article
1917 "p" gnus-summary-prev-unread-article
1918 "N" gnus-summary-next-article
1919 "P" gnus-summary-prev-article
1920 "\C-n" gnus-summary-next-same-subject
1921 "\C-p" gnus-summary-prev-same-subject
1922 "\M-n" gnus-summary-next-unread-subject
1923 "\M-p" gnus-summary-prev-unread-subject
1924 "f" gnus-summary-first-unread-article
1925 "b" gnus-summary-best-unread-article
1926 "j" gnus-summary-goto-article
1927 "g" gnus-summary-goto-subject
1928 "l" gnus-summary-goto-last-article
1929 "o" gnus-summary-pop-article)
1931 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1932 "k" gnus-summary-kill-thread
1933 "l" gnus-summary-lower-thread
1934 "i" gnus-summary-raise-thread
1935 "T" gnus-summary-toggle-threads
1936 "t" gnus-summary-rethread-current
1937 "^" gnus-summary-reparent-thread
1938 "\M-^" gnus-summary-reparent-children
1939 "s" gnus-summary-show-thread
1940 "S" gnus-summary-show-all-threads
1941 "h" gnus-summary-hide-thread
1942 "H" gnus-summary-hide-all-threads
1943 "n" gnus-summary-next-thread
1944 "p" gnus-summary-prev-thread
1945 "u" gnus-summary-up-thread
1946 "o" gnus-summary-top-thread
1947 "d" gnus-summary-down-thread
1948 "#" gnus-uu-mark-thread
1949 "\M-#" gnus-uu-unmark-thread)
1951 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1952 "g" gnus-summary-prepare
1953 "c" gnus-summary-insert-cached-articles
1954 "d" gnus-summary-insert-dormant-articles
1955 "t" gnus-summary-insert-ticked-articles)
1957 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1958 "c" gnus-summary-catchup-and-exit
1959 "C" gnus-summary-catchup-all-and-exit
1960 "E" gnus-summary-exit-no-update
1961 "Q" gnus-summary-exit
1962 "Z" gnus-summary-exit
1963 "n" gnus-summary-catchup-and-goto-next-group
1964 "p" gnus-summary-catchup-and-goto-prev-group
1965 "R" gnus-summary-reselect-current-group
1966 "G" gnus-summary-rescan-group
1967 "N" gnus-summary-next-group
1968 "s" gnus-summary-save-newsrc
1969 "P" gnus-summary-prev-group)
1971 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1972 " " gnus-summary-next-page
1973 "n" gnus-summary-next-page
1974 "\177" gnus-summary-prev-page
1975 [delete] gnus-summary-prev-page
1976 "p" gnus-summary-prev-page
1977 "\r" gnus-summary-scroll-up
1978 "\M-\r" gnus-summary-scroll-down
1979 "<" gnus-summary-beginning-of-article
1980 ">" gnus-summary-end-of-article
1981 "b" gnus-summary-beginning-of-article
1982 "e" gnus-summary-end-of-article
1983 "^" gnus-summary-refer-parent-article
1984 "r" gnus-summary-refer-parent-article
1985 "D" gnus-summary-enter-digest-group
1986 "R" gnus-summary-refer-references
1987 "T" gnus-summary-refer-thread
1988 "g" gnus-summary-show-article
1989 "s" gnus-summary-isearch-article
1990 "P" gnus-summary-print-article
1991 "M" gnus-mailing-list-insinuate
1992 "t" gnus-article-babel)
1994 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1995 "b" gnus-article-add-buttons
1996 "B" gnus-article-add-buttons-to-head
1997 "o" gnus-article-treat-overstrike
1998 "e" gnus-article-emphasize
1999 "w" gnus-article-fill-cited-article
2000 "Q" gnus-article-fill-long-lines
2001 "L" gnus-article-toggle-truncate-lines
2002 "C" gnus-article-capitalize-sentences
2003 "c" gnus-article-remove-cr
2004 "q" gnus-article-de-quoted-unreadable
2005 "6" gnus-article-de-base64-unreadable
2006 "Z" gnus-article-decode-HZ
2007 "A" gnus-article-treat-ansi-sequences
2008 "h" gnus-article-wash-html
2009 "u" gnus-article-unsplit-urls
2010 "s" gnus-summary-force-verify-and-decrypt
2011 "f" gnus-article-display-x-face
2012 "l" gnus-summary-stop-page-breaking
2013 "r" gnus-summary-caesar-message
2014 "m" gnus-summary-morse-message
2015 "t" gnus-summary-toggle-header
2016 "g" gnus-treat-smiley
2017 "v" gnus-summary-verbose-headers
2018 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2019 "p" gnus-article-verify-x-pgp-sig
2020 "d" gnus-article-treat-dumbquotes
2021 "i" gnus-summary-idna-message)
2023 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2024 ;; mnemonic: deuglif*Y*
2025 "u" gnus-article-outlook-unwrap-lines
2026 "a" gnus-article-outlook-repair-attribution
2027 "c" gnus-article-outlook-rearrange-citation
2028 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2030 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2031 "a" gnus-article-hide
2032 "h" gnus-article-hide-headers
2033 "b" gnus-article-hide-boring-headers
2034 "s" gnus-article-hide-signature
2035 "c" gnus-article-hide-citation
2036 "C" gnus-article-hide-citation-in-followups
2037 "l" gnus-article-hide-list-identifiers
2038 "B" gnus-article-strip-banner
2039 "P" gnus-article-hide-pem
2040 "\C-c" gnus-article-hide-citation-maybe)
2042 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2043 "a" gnus-article-highlight
2044 "h" gnus-article-highlight-headers
2045 "c" gnus-article-highlight-citation
2046 "s" gnus-article-highlight-signature)
2048 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2049 "f" gnus-article-treat-fold-headers
2050 "u" gnus-article-treat-unfold-headers
2051 "n" gnus-article-treat-fold-newsgroups)
2053 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2054 "x" gnus-article-display-x-face
2055 "d" gnus-article-display-face
2056 "s" gnus-treat-smiley
2057 "D" gnus-article-remove-images
2058 "f" gnus-treat-from-picon
2059 "m" gnus-treat-mail-picon
2060 "n" gnus-treat-newsgroups-picon)
2062 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2063 "w" gnus-article-decode-mime-words
2064 "c" gnus-article-decode-charset
2065 "v" gnus-mime-view-all-parts
2066 "b" gnus-article-view-part)
2068 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2069 "z" gnus-article-date-ut
2070 "u" gnus-article-date-ut
2071 "l" gnus-article-date-local
2072 "p" gnus-article-date-english
2073 "e" gnus-article-date-lapsed
2074 "o" gnus-article-date-original
2075 "i" gnus-article-date-iso8601
2076 "s" gnus-article-date-user)
2078 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2079 "t" gnus-article-remove-trailing-blank-lines
2080 "l" gnus-article-strip-leading-blank-lines
2081 "m" gnus-article-strip-multiple-blank-lines
2082 "a" gnus-article-strip-blank-lines
2083 "A" gnus-article-strip-all-blank-lines
2084 "s" gnus-article-strip-leading-space
2085 "e" gnus-article-strip-trailing-space
2086 "w" gnus-article-remove-leading-whitespace)
2088 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2090 "f" gnus-summary-fetch-faq
2091 "d" gnus-summary-describe-group
2092 "h" gnus-summary-describe-briefly
2093 "i" gnus-info-find-node
2094 "c" gnus-group-fetch-charter
2095 "C" gnus-group-fetch-control)
2097 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2098 "e" gnus-summary-expire-articles
2099 "\M-\C-e" gnus-summary-expire-articles-now
2100 "\177" gnus-summary-delete-article
2101 [delete] gnus-summary-delete-article
2102 [backspace] gnus-summary-delete-article
2103 "m" gnus-summary-move-article
2104 "r" gnus-summary-respool-article
2105 "w" gnus-summary-edit-article
2106 "c" gnus-summary-copy-article
2107 "B" gnus-summary-crosspost-article
2108 "q" gnus-summary-respool-query
2109 "t" gnus-summary-respool-trace
2110 "i" gnus-summary-import-article
2111 "I" gnus-summary-create-article
2112 "p" gnus-summary-article-posted-p)
2114 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2115 "o" gnus-summary-save-article
2116 "m" gnus-summary-save-article-mail
2117 "F" gnus-summary-write-article-file
2118 "r" gnus-summary-save-article-rmail
2119 "f" gnus-summary-save-article-file
2120 "b" gnus-summary-save-article-body-file
2121 "B" gnus-summary-write-article-body-file
2122 "h" gnus-summary-save-article-folder
2123 "v" gnus-summary-save-article-vm
2124 "p" gnus-summary-pipe-output
2125 "P" gnus-summary-muttprint
2126 "s" gnus-soup-add-article)
2128 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2129 "b" gnus-summary-display-buttonized
2130 "m" gnus-summary-repair-multipart
2131 "v" gnus-article-view-part
2132 "o" gnus-article-save-part
2133 "O" gnus-article-save-part-and-strip
2134 "r" gnus-article-replace-part
2135 "d" gnus-article-delete-part
2136 "t" gnus-article-view-part-as-type
2137 "j" gnus-article-jump-to-part
2138 "c" gnus-article-copy-part
2139 "C" gnus-article-view-part-as-charset
2140 "e" gnus-article-view-part-externally
2141 "H" gnus-article-browse-html-article
2142 "E" gnus-article-encrypt-body
2143 "i" gnus-article-inline-part
2144 "|" gnus-article-pipe-part)
2146 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2147 "p" gnus-summary-mark-as-processable
2148 "u" gnus-summary-unmark-as-processable
2149 "U" gnus-summary-unmark-all-processable
2150 "v" gnus-uu-mark-over
2151 "s" gnus-uu-mark-series
2152 "r" gnus-uu-mark-region
2153 "g" gnus-uu-unmark-region
2154 "R" gnus-uu-mark-by-regexp
2155 "G" gnus-uu-unmark-by-regexp
2156 "t" gnus-uu-mark-thread
2157 "T" gnus-uu-unmark-thread
2158 "a" gnus-uu-mark-all
2159 "b" gnus-uu-mark-buffer
2160 "S" gnus-uu-mark-sparse
2161 "k" gnus-summary-kill-process-mark
2162 "y" gnus-summary-yank-process-mark
2163 "w" gnus-summary-save-process-mark
2164 "i" gnus-uu-invert-processable)
2166 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2167 ;;"x" gnus-uu-extract-any
2168 "m" gnus-summary-save-parts
2169 "u" gnus-uu-decode-uu
2170 "U" gnus-uu-decode-uu-and-save
2171 "s" gnus-uu-decode-unshar
2172 "S" gnus-uu-decode-unshar-and-save
2173 "o" gnus-uu-decode-save
2174 "O" gnus-uu-decode-save
2175 "b" gnus-uu-decode-binhex
2176 "B" gnus-uu-decode-binhex
2177 "p" gnus-uu-decode-postscript
2178 "P" gnus-uu-decode-postscript-and-save)
2181 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2182 "u" gnus-uu-decode-uu-view
2183 "U" gnus-uu-decode-uu-and-save-view
2184 "s" gnus-uu-decode-unshar-view
2185 "S" gnus-uu-decode-unshar-and-save-view
2186 "o" gnus-uu-decode-save-view
2187 "O" gnus-uu-decode-save-view
2188 "b" gnus-uu-decode-binhex-view
2189 "B" gnus-uu-decode-binhex-view
2190 "p" gnus-uu-decode-postscript-view
2191 "P" gnus-uu-decode-postscript-and-save-view)
2193 (defvar gnus-article-post-menu nil)
2195 (defconst gnus-summary-menu-maxlen 20)
2197 (defun gnus-summary-menu-split (menu)
2198 ;; If we have lots of elements, divide them into groups of 20
2199 ;; and make a pane (or submenu) for each one.
2200 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2201 (let ((menu menu) sublists next
2204 ;; Pull off the next gnus-summary-menu-maxlen elements
2205 ;; and make them the next element of sublist.
2206 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2208 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2210 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2211 (aref (car (last menu)) 0)) menu)
2215 (nreverse sublists))
2216 ;; Few elements--put them all in one pane.
2219 (defun gnus-summary-make-menu-bar ()
2220 (gnus-turn-off-edit-menu 'summary)
2222 (unless (boundp 'gnus-summary-misc-menu)
2225 gnus-summary-kill-menu gnus-summary-mode-map ""
2230 ["Customize" gnus-score-customize t])
2231 (gnus-make-score-map 'increase)
2232 (gnus-make-score-map 'lower)
2234 ["Kill below" gnus-summary-kill-below t]
2235 ["Mark above" gnus-summary-mark-above t]
2236 ["Tick above" gnus-summary-tick-above t]
2237 ["Clear above" gnus-summary-clear-above t])
2238 ["Current score" gnus-summary-current-score t]
2239 ["Set score" gnus-summary-set-score t]
2240 ["Switch current score file..." gnus-score-change-score-file t]
2241 ["Set mark below..." gnus-score-set-mark-below t]
2242 ["Set expunge below..." gnus-score-set-expunge-below t]
2243 ["Edit current score file" gnus-score-edit-current-scores t]
2244 ["Edit score file" gnus-score-edit-file t]
2245 ["Trace score" gnus-score-find-trace t]
2246 ["Find words" gnus-score-find-favourite-words t]
2247 ["Rescore buffer" gnus-summary-rescore t]
2248 ["Increase score..." gnus-summary-increase-score t]
2249 ["Lower score..." gnus-summary-lower-score t]))))
2251 ;; Define both the Article menu in the summary buffer and the
2252 ;; equivalent Commands menu in the article buffer here for
2256 ["All" gnus-article-hide t]
2257 ["Headers" gnus-article-hide-headers t]
2258 ["Signature" gnus-article-hide-signature t]
2259 ["Citation" gnus-article-hide-citation t]
2260 ["List identifiers" gnus-article-hide-list-identifiers t]
2261 ["Banner" gnus-article-strip-banner t]
2262 ["Boring headers" gnus-article-hide-boring-headers t])
2264 ["All" gnus-article-highlight t]
2265 ["Headers" gnus-article-highlight-headers t]
2266 ["Signature" gnus-article-highlight-signature t]
2267 ["Citation" gnus-article-highlight-citation t])
2269 ["Words" gnus-article-decode-mime-words t]
2270 ["Charset" gnus-article-decode-charset t]
2271 ["QP" gnus-article-de-quoted-unreadable t]
2272 ["Base64" gnus-article-de-base64-unreadable t]
2273 ["View MIME buttons" gnus-summary-display-buttonized t]
2274 ["View all" gnus-mime-view-all-parts t]
2275 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2276 ["Encrypt body" gnus-article-encrypt-body
2277 :active (not (gnus-group-read-only-p))
2278 ,@(if (featurep 'xemacs) nil
2279 '(:help "Encrypt the message body on disk"))]
2280 ["Extract all parts..." gnus-summary-save-parts t]
2282 ["Repair multipart" gnus-summary-repair-multipart t]
2283 ["Pipe part..." gnus-article-pipe-part t]
2284 ["Inline part" gnus-article-inline-part t]
2285 ["View part as type..." gnus-article-view-part-as-type t]
2286 ["Encrypt body" gnus-article-encrypt-body
2287 :active (not (gnus-group-read-only-p))
2288 ,@(if (featurep 'xemacs) nil
2289 '(:help "Encrypt the message body on disk"))]
2290 ["View part externally" gnus-article-view-part-externally t]
2291 ["View HTML parts in browser" gnus-article-browse-html-article t]
2292 ["View part with charset..." gnus-article-view-part-as-charset t]
2293 ["Copy part" gnus-article-copy-part t]
2294 ["Save part..." gnus-article-save-part t]
2295 ["View part" gnus-article-view-part t]))
2297 ["Local" gnus-article-date-local t]
2298 ["ISO8601" gnus-article-date-iso8601 t]
2299 ["UT" gnus-article-date-ut t]
2300 ["Original" gnus-article-date-original t]
2301 ["Lapsed" gnus-article-date-lapsed t]
2302 ["User-defined" gnus-article-date-user t])
2304 ["Remove images" gnus-article-remove-images t]
2305 ["Toggle smiley" gnus-treat-smiley t]
2306 ["Show X-Face" gnus-article-display-x-face t]
2307 ["Show picons in From" gnus-treat-from-picon t]
2308 ["Show picons in mail headers" gnus-treat-mail-picon t]
2309 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2310 ("View as different encoding"
2311 ,@(gnus-summary-menu-split
2314 ;; Since easymenu under Emacs doesn't allow
2315 ;; lambda forms for menu commands, we should
2316 ;; provide intern'ed function symbols.
2317 (let ((command (intern (format "\
2318 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2322 (let ((gnus-summary-show-article-charset-alist
2324 (gnus-summary-show-article 1))))
2325 `[,(symbol-name cs) ,command t]))
2326 (sort (if (fboundp 'coding-system-list)
2327 (coding-system-list)
2328 (mapcar 'car mm-mime-mule-charset-alist))
2332 ["Leading" gnus-article-strip-leading-blank-lines t]
2333 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2334 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2335 ["All of the above" gnus-article-strip-blank-lines t]
2336 ["All" gnus-article-strip-all-blank-lines t]
2337 ["Leading space" gnus-article-strip-leading-space t]
2338 ["Trailing space" gnus-article-strip-trailing-space t]
2339 ["Leading space in headers"
2340 gnus-article-remove-leading-whitespace t])
2341 ["Overstrike" gnus-article-treat-overstrike t]
2342 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2343 ["Emphasis" gnus-article-emphasize t]
2344 ["Word wrap" gnus-article-fill-cited-article t]
2345 ["Fill long lines" gnus-article-fill-long-lines t]
2346 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2347 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2348 ["Remove CR" gnus-article-remove-cr t]
2349 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2350 ["Base64" gnus-article-de-base64-unreadable t]
2351 ["Rot 13" gnus-summary-caesar-message
2352 ,@(if (featurep 'xemacs) '(t)
2353 '(:help "\"Caesar rotate\" article by 13"))]
2354 ["De-IDNA" gnus-summary-idna-message t]
2355 ["Morse decode" gnus-summary-morse-message t]
2356 ["Unix pipe..." gnus-summary-pipe-message t]
2357 ["Add buttons" gnus-article-add-buttons t]
2358 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2359 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2360 ["Verbose header" gnus-summary-verbose-headers t]
2361 ["Toggle header" gnus-summary-toggle-header t]
2362 ["Unfold headers" gnus-article-treat-unfold-headers t]
2363 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2364 ["Html" gnus-article-wash-html t]
2365 ["Unsplit URLs" gnus-article-unsplit-urls t]
2366 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2367 ["Decode HZ" gnus-article-decode-HZ t]
2368 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2369 ("(Outlook) Deuglify"
2370 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2371 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2372 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2373 ["Full (Outlook) deuglify"
2374 gnus-article-outlook-deuglify-article t])
2377 ["Save in default format..." gnus-summary-save-article
2378 ,@(if (featurep 'xemacs) '(t)
2379 '(:help "Save article using default method"))]
2380 ["Save in file..." gnus-summary-save-article-file
2381 ,@(if (featurep 'xemacs) '(t)
2382 '(:help "Save article in file"))]
2383 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2384 ["Save in MH folder..." gnus-summary-save-article-folder t]
2385 ["Save in VM folder..." gnus-summary-save-article-vm t]
2386 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2387 ["Save body in file..." gnus-summary-save-article-body-file t]
2388 ["Pipe through a filter..." gnus-summary-pipe-output t]
2389 ["Add to SOUP packet" gnus-soup-add-article t]
2390 ["Print with Muttprint..." gnus-summary-muttprint t]
2391 ["Print" gnus-summary-print-article
2392 ,@(if (featurep 'xemacs) '(t)
2393 '(:help "Generate and print a PostScript image"))])
2394 ("Copy, move,... (Backend)"
2395 ,@(if (featurep 'xemacs) nil
2396 '(:help "Copying, moving, expiring articles..."))
2397 ["Respool article..." gnus-summary-respool-article t]
2398 ["Move article..." gnus-summary-move-article
2399 (gnus-check-backend-function
2400 'request-move-article gnus-newsgroup-name)]
2401 ["Copy article..." gnus-summary-copy-article t]
2402 ["Crosspost article..." gnus-summary-crosspost-article
2403 (gnus-check-backend-function
2404 'request-replace-article gnus-newsgroup-name)]
2405 ["Import file..." gnus-summary-import-article
2406 (gnus-check-backend-function
2407 'request-accept-article gnus-newsgroup-name)]
2408 ["Create article..." gnus-summary-create-article
2409 (gnus-check-backend-function
2410 'request-accept-article gnus-newsgroup-name)]
2411 ["Check if posted" gnus-summary-article-posted-p t]
2412 ["Edit article" gnus-summary-edit-article
2413 (not (gnus-group-read-only-p))]
2414 ["Delete article" gnus-summary-delete-article
2415 (gnus-check-backend-function
2416 'request-expire-articles gnus-newsgroup-name)]
2417 ["Query respool" gnus-summary-respool-query t]
2418 ["Trace respool" gnus-summary-respool-trace t]
2419 ["Delete expirable articles" gnus-summary-expire-articles-now
2420 (gnus-check-backend-function
2421 'request-expire-articles gnus-newsgroup-name)])
2423 ["Uudecode" gnus-uu-decode-uu
2424 ,@(if (featurep 'xemacs) '(t)
2425 '(:help "Decode uuencoded article(s)"))]
2426 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2427 ["Unshar" gnus-uu-decode-unshar t]
2428 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2429 ["Save" gnus-uu-decode-save t]
2430 ["Binhex" gnus-uu-decode-binhex t]
2431 ["Postscript" gnus-uu-decode-postscript t]
2432 ["All MIME parts" gnus-summary-save-parts t])
2434 ["Enter article" gnus-cache-enter-article t]
2435 ["Remove article" gnus-cache-remove-article t])
2436 ["Translate" gnus-article-babel t]
2437 ["Select article buffer" gnus-summary-select-article-buffer t]
2438 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2439 ["Isearch article..." gnus-summary-isearch-article t]
2440 ["Beginning of the article" gnus-summary-beginning-of-article t]
2441 ["End of the article" gnus-summary-end-of-article t]
2442 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2443 ["Fetch referenced articles" gnus-summary-refer-references t]
2444 ["Fetch current thread" gnus-summary-refer-thread t]
2445 ["Fetch article with id..." gnus-summary-refer-article t]
2446 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2447 ["Redisplay" gnus-summary-show-article t]
2448 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2450 gnus-summary-article-menu gnus-summary-mode-map ""
2451 (cons "Article" innards))
2453 (if (not (keymapp gnus-summary-article-menu))
2455 gnus-article-commands-menu gnus-article-mode-map ""
2456 (cons "Commands" innards))
2457 ;; in Emacs, don't share menu.
2458 (setq gnus-article-commands-menu
2459 (copy-keymap gnus-summary-article-menu))
2460 (define-key gnus-article-mode-map [menu-bar commands]
2461 (cons "Commands" gnus-article-commands-menu))))
2464 gnus-summary-thread-menu gnus-summary-mode-map ""
2466 ["Find all messages in thread" gnus-summary-refer-thread t]
2467 ["Toggle threading" gnus-summary-toggle-threads t]
2468 ["Hide threads" gnus-summary-hide-all-threads t]
2469 ["Show threads" gnus-summary-show-all-threads t]
2470 ["Hide thread" gnus-summary-hide-thread t]
2471 ["Show thread" gnus-summary-show-thread t]
2472 ["Go to next thread" gnus-summary-next-thread t]
2473 ["Go to previous thread" gnus-summary-prev-thread t]
2474 ["Go down thread" gnus-summary-down-thread t]
2475 ["Go up thread" gnus-summary-up-thread t]
2476 ["Top of thread" gnus-summary-top-thread t]
2477 ["Mark thread as read" gnus-summary-kill-thread t]
2478 ["Lower thread score" gnus-summary-lower-thread t]
2479 ["Raise thread score" gnus-summary-raise-thread t]
2480 ["Rethread current" gnus-summary-rethread-current t]))
2483 gnus-summary-post-menu gnus-summary-mode-map ""
2485 ["Send a message (mail or news)" gnus-summary-post-news
2486 ,@(if (featurep 'xemacs) '(t)
2487 '(:help "Compose a new message (mail or news)"))]
2488 ["Followup" gnus-summary-followup
2489 ,@(if (featurep 'xemacs) '(t)
2490 '(:help "Post followup to this article"))]
2491 ["Followup and yank" gnus-summary-followup-with-original
2492 ,@(if (featurep 'xemacs) '(t)
2493 '(:help "Post followup to this article, quoting its contents"))]
2494 ["Supersede article" gnus-summary-supersede-article t]
2495 ["Cancel article" gnus-summary-cancel-article
2496 ,@(if (featurep 'xemacs) '(t)
2497 '(:help "Cancel an article you posted"))]
2498 ["Reply" gnus-summary-reply t]
2499 ["Reply and yank" gnus-summary-reply-with-original t]
2500 ["Wide reply" gnus-summary-wide-reply t]
2501 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2502 ,@(if (featurep 'xemacs) '(t)
2503 '(:help "Mail a reply, quoting this article"))]
2504 ["Very wide reply" gnus-summary-very-wide-reply t]
2505 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2506 ,@(if (featurep 'xemacs) '(t)
2507 '(:help "Mail a very wide reply, quoting this article"))]
2508 ["Mail forward" gnus-summary-mail-forward t]
2509 ["Post forward" gnus-summary-post-forward t]
2510 ["Digest and mail" gnus-uu-digest-mail-forward t]
2511 ["Digest and post" gnus-uu-digest-post-forward t]
2512 ["Resend message" gnus-summary-resend-message t]
2513 ["Resend message edit" gnus-summary-resend-message-edit t]
2514 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2515 ["Send a mail" gnus-summary-mail-other-window t]
2516 ["Create a local message" gnus-summary-news-other-window t]
2517 ["Uuencode and post" gnus-uu-post-news
2518 ,@(if (featurep 'xemacs) '(t)
2519 '(:help "Post a uuencoded article"))]
2520 ["Followup via news" gnus-summary-followup-to-mail t]
2521 ["Followup via news and yank"
2522 gnus-summary-followup-to-mail-with-original t]
2524 ;;["Send" gnus-summary-send-draft t]
2525 ;;["Send bounced" gnus-resend-bounced-mail t])
2529 ((not (keymapp gnus-summary-post-menu))
2530 (setq gnus-article-post-menu gnus-summary-post-menu))
2531 ((not gnus-article-post-menu)
2532 ;; Don't share post menu.
2533 (setq gnus-article-post-menu
2534 (copy-keymap gnus-summary-post-menu))))
2535 (define-key gnus-article-mode-map [menu-bar post]
2536 (cons "Post" gnus-article-post-menu))
2539 gnus-summary-misc-menu gnus-summary-mode-map ""
2542 ["Mark as read" gnus-summary-mark-as-read-forward t]
2543 ["Mark same subject and select"
2544 gnus-summary-kill-same-subject-and-select t]
2545 ["Mark same subject" gnus-summary-kill-same-subject t]
2546 ["Catchup" gnus-summary-catchup
2547 ,@(if (featurep 'xemacs) '(t)
2548 '(:help "Mark unread articles in this group as read"))]
2549 ["Catchup all" gnus-summary-catchup-all t]
2550 ["Catchup to here" gnus-summary-catchup-to-here t]
2551 ["Catchup from here" gnus-summary-catchup-from-here t]
2552 ["Catchup region" gnus-summary-mark-region-as-read
2553 (gnus-mark-active-p)]
2554 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2556 ["Tick" gnus-summary-tick-article-forward t]
2557 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2558 ["Remove marks" gnus-summary-clear-mark-forward t]
2559 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2560 ["Set bookmark" gnus-summary-set-bookmark t]
2561 ["Remove bookmark" gnus-summary-remove-bookmark t])
2563 ["Marks..." gnus-summary-limit-to-marks t]
2564 ["Subject..." gnus-summary-limit-to-subject t]
2565 ["Author..." gnus-summary-limit-to-author t]
2566 ["Recipient..." gnus-summary-limit-to-recipient t]
2567 ["Age..." gnus-summary-limit-to-age t]
2568 ["Extra..." gnus-summary-limit-to-extra t]
2569 ["Score..." gnus-summary-limit-to-score t]
2570 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2571 ["Unread" gnus-summary-limit-to-unread t]
2572 ["Unseen" gnus-summary-limit-to-unseen t]
2573 ["Singletons" gnus-summary-limit-to-singletons t]
2574 ["Replied" gnus-summary-limit-to-replied t]
2575 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2576 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2577 ["Pop limit" gnus-summary-pop-limit t]
2578 ["Show dormant" gnus-summary-limit-include-dormant t]
2579 ["Hide childless dormant"
2580 gnus-summary-limit-exclude-childless-dormant t]
2581 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2582 ["Hide marked" gnus-summary-limit-exclude-marks t]
2583 ["Show expunged" gnus-summary-limit-include-expunged t])
2585 ["Set mark" gnus-summary-mark-as-processable t]
2586 ["Remove mark" gnus-summary-unmark-as-processable t]
2587 ["Remove all marks" gnus-summary-unmark-all-processable t]
2588 ["Invert marks" gnus-uu-invert-processable t]
2589 ["Mark above" gnus-uu-mark-over t]
2590 ["Mark series" gnus-uu-mark-series t]
2591 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2592 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2593 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2594 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2595 ["Mark all" gnus-uu-mark-all t]
2596 ["Mark buffer" gnus-uu-mark-buffer t]
2597 ["Mark sparse" gnus-uu-mark-sparse t]
2598 ["Mark thread" gnus-uu-mark-thread t]
2599 ["Unmark thread" gnus-uu-unmark-thread t]
2600 ("Process Mark Sets"
2601 ["Kill" gnus-summary-kill-process-mark t]
2602 ["Yank" gnus-summary-yank-process-mark
2603 gnus-newsgroup-process-stack]
2604 ["Save" gnus-summary-save-process-mark t]
2605 ["Run command on marked..." gnus-summary-universal-argument t]))
2607 ["Page forward" gnus-summary-next-page
2608 ,@(if (featurep 'xemacs) '(t)
2609 '(:help "Show next page of article"))]
2610 ["Page backward" gnus-summary-prev-page
2611 ,@(if (featurep 'xemacs) '(t)
2612 '(:help "Show previous page of article"))]
2613 ["Line forward" gnus-summary-scroll-up t])
2615 ["Next unread article" gnus-summary-next-unread-article t]
2616 ["Previous unread article" gnus-summary-prev-unread-article t]
2617 ["Next article" gnus-summary-next-article t]
2618 ["Previous article" gnus-summary-prev-article t]
2619 ["Next unread subject" gnus-summary-next-unread-subject t]
2620 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2621 ["Next article same subject" gnus-summary-next-same-subject t]
2622 ["Previous article same subject" gnus-summary-prev-same-subject t]
2623 ["First unread article" gnus-summary-first-unread-article t]
2624 ["Best unread article" gnus-summary-best-unread-article t]
2625 ["Go to subject number..." gnus-summary-goto-subject t]
2626 ["Go to article number..." gnus-summary-goto-article t]
2627 ["Go to the last article" gnus-summary-goto-last-article t]
2628 ["Pop article off history" gnus-summary-pop-article t])
2630 ["Sort by number" gnus-summary-sort-by-number t]
2631 ["Sort by author" gnus-summary-sort-by-author t]
2632 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2633 ["Sort by subject" gnus-summary-sort-by-subject t]
2634 ["Sort by date" gnus-summary-sort-by-date t]
2635 ["Sort by score" gnus-summary-sort-by-score t]
2636 ["Sort by lines" gnus-summary-sort-by-lines t]
2637 ["Sort by characters" gnus-summary-sort-by-chars t]
2638 ["Randomize" gnus-summary-sort-by-random t]
2639 ["Original sort" gnus-summary-sort-by-original t])
2641 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2642 ["Describe group" gnus-summary-describe-group t]
2643 ["Fetch charter" gnus-group-fetch-charter
2644 ,@(if (featurep 'xemacs) nil
2645 '(:help "Display the charter of the current group"))]
2646 ["Fetch control message" gnus-group-fetch-control
2647 ,@(if (featurep 'xemacs) nil
2648 '(:help "Display the archived control message for the current group"))]
2649 ["Read manual" gnus-info-find-node t])
2651 ["Pick and read" gnus-pick-mode t]
2652 ["Binary" gnus-binary-mode t])
2654 ["Regenerate" gnus-summary-prepare t]
2655 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2656 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2657 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2658 ["Toggle threading" gnus-summary-toggle-threads t])
2659 ["See old articles" gnus-summary-insert-old-articles t]
2660 ["See new articles" gnus-summary-insert-new-articles t]
2661 ["Filter articles..." gnus-summary-execute-command t]
2662 ["Run command on articles..." gnus-summary-universal-argument t]
2663 ["Search articles forward..." gnus-summary-search-article-forward t]
2664 ["Search articles backward..." gnus-summary-search-article-backward t]
2665 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2666 ["Expand window" gnus-summary-expand-window t]
2667 ["Expire expirable articles" gnus-summary-expire-articles
2668 (gnus-check-backend-function
2669 'request-expire-articles gnus-newsgroup-name)]
2670 ["Edit local kill file" gnus-summary-edit-local-kill t]
2671 ["Edit main kill file" gnus-summary-edit-global-kill t]
2672 ["Edit group parameters" gnus-summary-edit-parameters t]
2673 ["Customize group parameters" gnus-summary-customize-parameters t]
2674 ["Send a bug report" gnus-bug t]
2676 ["Catchup and exit" gnus-summary-catchup-and-exit
2677 ,@(if (featurep 'xemacs) '(t)
2678 '(:help "Mark unread articles in this group as read, then exit"))]
2679 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2680 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2681 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2682 ["Exit group" gnus-summary-exit
2683 ,@(if (featurep 'xemacs) '(t)
2684 '(:help "Exit current group, return to group selection mode"))]
2685 ["Exit group without updating" gnus-summary-exit-no-update t]
2686 ["Exit and goto next group" gnus-summary-next-group t]
2687 ["Exit and goto prev group" gnus-summary-prev-group t]
2688 ["Reselect group" gnus-summary-reselect-current-group t]
2689 ["Rescan group" gnus-summary-rescan-group t]
2690 ["Update dribble" gnus-summary-save-newsrc t])))
2692 (gnus-run-hooks 'gnus-summary-menu-hook)))
2694 (defvar gnus-summary-tool-bar-map nil)
2696 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2697 ;; affect _new_ message buffers. We might add a function that walks thru all
2698 ;; summary-mode buffers and force the update.
2699 (defun gnus-summary-tool-bar-update (&optional symbol value)
2700 "Update summary mode toolbar.
2701 Setter function for custom variables."
2702 (setq-default gnus-summary-tool-bar-map nil)
2704 ;; When used as ":set" function:
2705 (set-default symbol value))
2706 (when (gnus-buffer-live-p gnus-summary-buffer)
2707 (with-current-buffer gnus-summary-buffer
2708 (gnus-summary-make-tool-bar))))
2710 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2711 'gnus-summary-tool-bar-gnome
2712 'gnus-summary-tool-bar-retro)
2713 "Specifies the Gnus summary tool bar.
2715 It can be either a list or a symbol refering to a list. See
2716 `gmm-tool-bar-from-list' for the format of the list. The
2717 default key map is `gnus-summary-mode-map'.
2719 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2720 `gnus-summary-tool-bar-retro'."
2721 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2722 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2723 (repeat :tag "User defined list" gmm-tool-bar-item)
2725 :version "23.0" ;; No Gnus
2726 :initialize 'custom-initialize-default
2727 :set 'gnus-summary-tool-bar-update
2728 :group 'gnus-summary)
2730 (defcustom gnus-summary-tool-bar-gnome
2731 '((gnus-summary-post-news "mail/compose" nil)
2732 (gnus-summary-insert-new-articles "mail/inbox" nil
2733 :visible (or (not gnus-agent)
2735 (gnus-summary-reply-with-original "mail/reply")
2736 (gnus-summary-reply "mail/reply" nil :visible nil)
2737 (gnus-summary-followup-with-original "mail/reply-all")
2738 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2739 (gnus-summary-mail-forward "mail/forward")
2740 (gnus-summary-save-article "mail/save")
2741 (gnus-summary-search-article-forward "search" nil :visible nil)
2742 (gnus-summary-print-article "print")
2743 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2744 ;; Some new commands that may need more suitable icons:
2745 (gnus-summary-save-newsrc "save" nil :visible nil)
2746 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2747 (gnus-summary-prev-article "left-arrow")
2748 (gnus-summary-next-article "right-arrow")
2749 (gnus-summary-next-page "next-page")
2750 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2752 ;; Maybe some sort-by-... could be added:
2753 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2754 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2755 (gnus-summary-mark-as-expirable
2757 :visible (gnus-check-backend-function 'request-expire-articles
2758 gnus-newsgroup-name))
2759 (gnus-summary-mark-as-spam
2761 :visible (and (fboundp 'spam-group-ham-contents-p)
2762 (spam-group-ham-contents-p gnus-newsgroup-name))
2763 :help "Mark as spam")
2764 (gnus-summary-mark-as-read-forward
2766 :visible (and (fboundp 'spam-group-spam-contents-p)
2767 (spam-group-spam-contents-p gnus-newsgroup-name)))
2769 (gnus-summary-exit "exit")
2770 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2771 (gnus-info-find-node "help"))
2772 "List of functions for the summary tool bar (GNOME style).
2774 See `gmm-tool-bar-from-list' for the format of the list."
2775 :type '(repeat gmm-tool-bar-item)
2776 :version "23.0" ;; No Gnus
2777 :initialize 'custom-initialize-default
2778 :set 'gnus-summary-tool-bar-update
2779 :group 'gnus-summary)
2781 (defcustom gnus-summary-tool-bar-retro
2782 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2783 (gnus-summary-next-unread-article "gnus/next-ur")
2784 (gnus-summary-post-news "gnus/post")
2785 (gnus-summary-followup-with-original "gnus/fuwo")
2786 (gnus-summary-followup "gnus/followup")
2787 (gnus-summary-reply-with-original "gnus/reply-wo")
2788 (gnus-summary-reply "gnus/reply")
2789 (gnus-summary-caesar-message "gnus/rot13")
2790 (gnus-uu-decode-uu "gnus/uu-decode")
2791 (gnus-summary-save-article-file "gnus/save-aif")
2792 (gnus-summary-save-article "gnus/save-art")
2793 (gnus-uu-post-news "gnus/uu-post")
2794 (gnus-summary-catchup "gnus/catchup")
2795 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2796 (gnus-summary-exit "gnus/exit-summ")
2797 ;; Some new command that may need more suitable icons:
2798 (gnus-summary-print-article "gnus/print" nil :visible nil)
2799 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2800 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2801 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2802 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2803 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2804 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2806 (gnus-info-find-node "gnus/help" nil :visible nil))
2807 "List of functions for the summary tool bar (retro look).
2809 See `gmm-tool-bar-from-list' for the format of the list."
2810 :type '(repeat gmm-tool-bar-item)
2811 :version "23.0" ;; No Gnus
2812 :initialize 'custom-initialize-default
2813 :set 'gnus-summary-tool-bar-update
2814 :group 'gnus-summary)
2816 (defcustom gnus-summary-tool-bar-zap-list t
2817 "List of icon items from the global tool bar.
2818 These items are not displayed in the Gnus summary mode tool bar.
2820 See `gmm-tool-bar-from-list' for the format of the list."
2821 :type 'gmm-tool-bar-zap-list
2822 :version "23.0" ;; No Gnus
2823 :initialize 'custom-initialize-default
2824 :set 'gnus-summary-tool-bar-update
2825 :group 'gnus-summary)
2827 (defvar image-load-path)
2829 (defun gnus-summary-make-tool-bar (&optional force)
2830 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2831 When FORCE, rebuild the tool bar."
2832 (when (and (not (featurep 'xemacs))
2833 (boundp 'tool-bar-mode)
2835 (or (not gnus-summary-tool-bar-map) force))
2837 (gmm-image-load-path-for-library "gnus"
2840 (image-load-path (cons (car load-path)
2841 (when (boundp 'image-load-path)
2843 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2844 gnus-summary-tool-bar-zap-list
2845 'gnus-summary-mode-map)))
2847 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2849 (setq gnus-summary-tool-bar-map map))))
2850 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2852 (defun gnus-score-set-default (var value)
2853 "A version of set that updates the GNU Emacs menu-bar."
2855 ;; It is the message that forces the active status to be updated.
2858 (defun gnus-make-score-map (type)
2859 "Make a summary score map of type TYPE."
2862 (let ((headers '(("author" "from" string)
2863 ("subject" "subject" string)
2864 ("article body" "body" string)
2865 ("article head" "head" string)
2866 ("xref" "xref" string)
2867 ("extra header" "extra" string)
2868 ("lines" "lines" number)
2869 ("followups to author" "followup" string)))
2870 (types '((number ("less than" <)
2873 (string ("substring" s)
2877 (perms '(("temporary" (current-time-string))
2885 (if (eq type 'lower)
2890 (setq header (car headers))
2896 (let ((ts (cdr (assoc (nth 2 header) types)))
2912 'gnus-summary-score-entry
2914 (if (or (string= (nth 1 header)
2916 (string= (nth 1 header)
2919 (list 'gnus-summary-header
2921 (list 'quote (nth 1 (car ts)))
2922 (list 'gnus-score-delta-default
2929 (list (nreverse outp))))
2932 (list (nreverse outt))))
2934 (setq headers (cdr headers)))
2935 (list (nreverse outh))))))))
2939 (defun gnus-summary-mode (&optional group)
2940 "Major mode for reading articles.
2942 All normal editing commands are switched off.
2943 \\<gnus-summary-mode-map>
2944 Each line in this buffer represents one article. To read an
2945 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2946 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2949 You can also post articles and send mail from this buffer. To
2950 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2951 of an article, type `\\[gnus-summary-reply]'.
2953 There are approx. one gazillion commands you can execute in this
2954 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2956 The following commands are available:
2958 \\{gnus-summary-mode-map}"
2960 (kill-all-local-variables)
2961 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2962 (gnus-summary-make-local-variables))
2963 (gnus-summary-make-local-variables)
2964 (setq gnus-newsgroup-name group)
2965 (when (gnus-visual-p 'summary-menu 'menu)
2966 (gnus-summary-make-menu-bar)
2967 (gnus-summary-make-tool-bar))
2968 (gnus-make-thread-indent-array)
2969 (gnus-simplify-mode-line)
2970 (setq major-mode 'gnus-summary-mode)
2971 (setq mode-name "Summary")
2972 (make-local-variable 'minor-mode-alist)
2973 (use-local-map gnus-summary-mode-map)
2974 (buffer-disable-undo)
2975 (setq buffer-read-only t ;Disable modification
2976 show-trailing-whitespace nil)
2977 (setq truncate-lines t)
2978 (setq selective-display t)
2979 (setq selective-display-ellipses t) ;Display `...'
2980 (gnus-summary-set-display-table)
2981 (gnus-set-default-directory)
2982 (make-local-variable 'gnus-summary-line-format)
2983 (make-local-variable 'gnus-summary-line-format-spec)
2984 (make-local-variable 'gnus-summary-dummy-line-format)
2985 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2986 (make-local-variable 'gnus-summary-mark-positions)
2987 (gnus-make-local-hook 'pre-command-hook)
2988 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2989 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2990 (turn-on-gnus-mailing-list-mode)
2991 (mm-enable-multibyte)
2992 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2993 (gnus-update-summary-mark-positions))
2995 (defun gnus-summary-make-local-variables ()
2996 "Make all the local summary buffer variables."
2998 (dolist (local gnus-summary-local-variables)
3001 (if (eq (cdr local) 'global)
3002 ;; Copy the global value of the variable.
3003 (setq global (symbol-value (car local)))
3004 ;; Use the value from the list.
3005 (setq global (eval (cdr local))))
3006 (set (make-local-variable (car local)) global))
3007 ;; Simple nil-valued local variable.
3008 (set (make-local-variable local) nil)))))
3010 (defun gnus-summary-clear-local-variables ()
3011 (let ((locals gnus-summary-local-variables))
3013 (if (consp (car locals))
3014 (and (symbolp (caar locals))
3015 (set (caar locals) nil))
3016 (and (symbolp (car locals))
3017 (set (car locals) nil)))
3018 (setq locals (cdr locals)))))
3020 ;; Summary data functions.
3022 (defmacro gnus-data-number (data)
3025 (defmacro gnus-data-set-number (data number)
3026 `(setcar ,data ,number))
3028 (defmacro gnus-data-mark (data)
3031 (defmacro gnus-data-set-mark (data mark)
3032 `(setcar (nthcdr 1 ,data) ,mark))
3034 (defmacro gnus-data-pos (data)
3037 (defmacro gnus-data-set-pos (data pos)
3038 `(setcar (nthcdr 2 ,data) ,pos))
3040 (defmacro gnus-data-header (data)
3043 (defmacro gnus-data-set-header (data header)
3044 `(setf (nth 3 ,data) ,header))
3046 (defmacro gnus-data-level (data)
3049 (defmacro gnus-data-unread-p (data)
3050 `(= (nth 1 ,data) gnus-unread-mark))
3052 (defmacro gnus-data-read-p (data)
3053 `(/= (nth 1 ,data) gnus-unread-mark))
3055 (defmacro gnus-data-pseudo-p (data)
3056 `(consp (nth 3 ,data)))
3058 (defmacro gnus-data-find (number)
3059 `(assq ,number gnus-newsgroup-data))
3061 (defmacro gnus-data-find-list (number &optional data)
3062 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3063 (memq (assq ,number bdata)
3066 (defmacro gnus-data-make (number mark pos header level)
3067 `(list ,number ,mark ,pos ,header ,level))
3069 (defun gnus-data-enter (after-article number mark pos header level offset)
3070 (let ((data (gnus-data-find-list after-article)))
3072 (error "No such article: %d" after-article))
3073 (setcdr data (cons (gnus-data-make number mark pos header level)
3075 (setq gnus-newsgroup-data-reverse nil)
3076 (gnus-data-update-list (cddr data) offset)))
3078 (defun gnus-data-enter-list (after-article list &optional offset)
3080 (let ((data (and after-article (gnus-data-find-list after-article)))
3084 (let ((odata gnus-newsgroup-data))
3085 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3087 (gnus-data-update-list odata offset)))
3088 ;; Find the last element in the list to be spliced into the main
3090 (setq list (last list))
3093 (setcdr list gnus-newsgroup-data)
3094 (setq gnus-newsgroup-data ilist)
3096 (gnus-data-update-list (cdr list) offset)))
3097 (setcdr list (cdr data))
3100 (gnus-data-update-list (cdr list) offset))))
3101 (setq gnus-newsgroup-data-reverse nil))))
3103 (defun gnus-data-remove (article &optional offset)
3104 (let ((data gnus-newsgroup-data))
3105 (if (= (gnus-data-number (car data)) article)
3107 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3108 gnus-newsgroup-data-reverse nil)
3110 (gnus-data-update-list gnus-newsgroup-data offset)))
3112 (when (= (gnus-data-number (cadr data)) article)
3113 (setcdr data (cddr data))
3115 (gnus-data-update-list (cdr data) offset))
3117 gnus-newsgroup-data-reverse nil))
3118 (setq data (cdr data))))))
3120 (defmacro gnus-data-list (backward)
3122 (or gnus-newsgroup-data-reverse
3123 (setq gnus-newsgroup-data-reverse
3124 (reverse gnus-newsgroup-data)))
3125 gnus-newsgroup-data))
3127 (defun gnus-data-update-list (data offset)
3128 "Add OFFSET to the POS of all data entries in DATA."
3129 (setq gnus-newsgroup-data-reverse nil)
3131 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3132 (setq data (cdr data))))
3134 (defun gnus-summary-article-pseudo-p (article)
3135 "Say whether this article is a pseudo article or not."
3136 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3138 (defmacro gnus-summary-article-sparse-p (article)
3139 "Say whether this article is a sparse article or not."
3140 `(memq ,article gnus-newsgroup-sparse))
3142 (defmacro gnus-summary-article-ancient-p (article)
3143 "Say whether this article is a sparse article or not."
3144 `(memq ,article gnus-newsgroup-ancient))
3146 (defun gnus-article-parent-p (number)
3147 "Say whether this article is a parent or not."
3148 (let ((data (gnus-data-find-list number)))
3149 (and (cdr data) ; There has to be an article after...
3150 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3151 (gnus-data-level (nth 1 data))))))
3153 (defun gnus-article-children (number)
3154 "Return a list of all children to NUMBER."
3155 (let* ((data (gnus-data-find-list number))
3156 (level (gnus-data-level (car data)))
3158 (setq data (cdr data))
3160 (= (gnus-data-level (car data)) (1+ level)))
3161 (push (gnus-data-number (car data)) children)
3162 (setq data (cdr data)))
3165 (defmacro gnus-summary-skip-intangible ()
3166 "If the current article is intangible, then jump to a different article."
3167 '(let ((to (get-text-property (point) 'gnus-intangible)))
3168 (and to (gnus-summary-goto-subject to))))
3170 (defmacro gnus-summary-article-intangible-p ()
3171 "Say whether this article is intangible or not."
3172 '(get-text-property (point) 'gnus-intangible))
3174 (defun gnus-article-read-p (article)
3175 "Say whether ARTICLE is read or not."
3176 (not (or (memq article gnus-newsgroup-marked)
3177 (memq article gnus-newsgroup-spam-marked)
3178 (memq article gnus-newsgroup-unreads)
3179 (memq article gnus-newsgroup-unselected)
3180 (memq article gnus-newsgroup-dormant))))
3182 ;; Some summary mode macros.
3184 (defmacro gnus-summary-article-number ()
3185 "The article number of the article on the current line.
3186 If there isn't an article number here, then we return the current
3189 (gnus-summary-skip-intangible)
3190 (or (get-text-property (point) 'gnus-number)
3191 (gnus-summary-last-subject))))
3193 (defmacro gnus-summary-article-header (&optional number)
3194 "Return the header of article NUMBER."
3195 `(gnus-data-header (gnus-data-find
3196 ,(or number '(gnus-summary-article-number)))))
3198 (defmacro gnus-summary-thread-level (&optional number)
3199 "Return the level of thread that starts with article NUMBER."
3200 `(if (and (eq gnus-summary-make-false-root 'dummy)
3201 (get-text-property (point) 'gnus-intangible))
3203 (gnus-data-level (gnus-data-find
3204 ,(or number '(gnus-summary-article-number))))))
3206 (defmacro gnus-summary-article-mark (&optional number)
3207 "Return the mark of article NUMBER."
3208 `(gnus-data-mark (gnus-data-find
3209 ,(or number '(gnus-summary-article-number)))))
3211 (defmacro gnus-summary-article-pos (&optional number)
3212 "Return the position of the line of article NUMBER."
3213 `(gnus-data-pos (gnus-data-find
3214 ,(or number '(gnus-summary-article-number)))))
3216 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3217 (defmacro gnus-summary-article-subject (&optional number)
3218 "Return current subject string or nil if nothing."
3221 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3222 '(gnus-data-header (assq (gnus-summary-article-number)
3223 gnus-newsgroup-data)))))
3226 (mail-header-subject headers))))
3228 (defmacro gnus-summary-article-score (&optional number)
3229 "Return current article score."
3230 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3231 gnus-newsgroup-scored))
3232 gnus-summary-default-score 0))
3234 (defun gnus-summary-article-children (&optional number)
3235 "Return a list of article numbers that are children of article NUMBER."
3236 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3237 (level (gnus-data-level (car data)))
3239 (while (and (setq data (cdr data))
3240 (> (setq l (gnus-data-level (car data))) level))
3241 (and (= (1+ level) l)
3242 (push (gnus-data-number (car data))
3244 (nreverse children)))
3246 (defun gnus-summary-article-parent (&optional number)
3247 "Return the article number of the parent of article NUMBER."
3248 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3249 (gnus-data-list t)))
3250 (level (gnus-data-level (car data))))
3252 () ; This is a root.
3253 ;; We search until we find an article with a level less than
3254 ;; this one. That function has to be the parent.
3255 (while (and (setq data (cdr data))
3256 (not (< (gnus-data-level (car data)) level))))
3257 (and data (gnus-data-number (car data))))))
3259 (defun gnus-unread-mark-p (mark)
3260 "Say whether MARK is the unread mark."
3261 (= mark gnus-unread-mark))
3263 (defun gnus-read-mark-p (mark)
3264 "Say whether MARK is one of the marks that mark as read.
3265 This is all marks except unread, ticked, dormant, and expirable."
3266 (not (or (= mark gnus-unread-mark)
3267 (= mark gnus-ticked-mark)
3268 (= mark gnus-spam-mark)
3269 (= mark gnus-dormant-mark)
3270 (= mark gnus-expirable-mark))))
3272 (defmacro gnus-article-mark (number)
3273 "Return the MARK of article NUMBER.
3274 This macro should only be used when computing the mark the \"first\"
3275 time; i.e., when generating the summary lines. After that,
3276 `gnus-summary-article-mark' should be used to examine the
3279 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3280 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3281 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3282 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3283 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3284 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3285 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3286 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3287 gnus-ancient-mark))))
3289 ;; Saving hidden threads.
3291 (defmacro gnus-save-hidden-threads (&rest forms)
3292 "Save hidden threads, eval FORMS, and restore the hidden threads."
3293 (let ((config (make-symbol "config")))
3294 `(let ((,config (gnus-hidden-threads-configuration)))
3298 (gnus-restore-hidden-threads-configuration ,config)))))
3299 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3300 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3302 (defun gnus-data-compute-positions ()
3303 "Compute the positions of all articles."
3304 (setq gnus-newsgroup-data-reverse nil)
3305 (let ((data gnus-newsgroup-data))
3307 (gnus-save-hidden-threads
3308 (gnus-summary-show-all-threads)
3309 (goto-char (point-min))
3311 (while (get-text-property (point) 'gnus-intangible)
3313 (gnus-data-set-pos (car data) (+ (point) 3))
3314 (setq data (cdr data))
3315 (forward-line 1))))))
3317 (defun gnus-hidden-threads-configuration ()
3318 "Return the current hidden threads configuration."
3321 (goto-char (point-min))
3322 (while (search-forward "\r" nil t)
3323 (push (1- (point)) config))
3326 (defun gnus-restore-hidden-threads-configuration (config)
3327 "Restore hidden threads configuration from CONFIG."
3329 (let (point buffer-read-only)
3330 (while (setq point (pop config))
3331 (when (and (< point (point-max))
3333 (eq (char-after) ?\n))
3334 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3336 ;; Various summary mode internalish functions.
3338 (defun gnus-mouse-pick-article (e)
3341 (gnus-summary-next-page nil t))
3343 (defun gnus-summary-set-display-table ()
3344 "Change the display table.
3345 Odd characters have a tendency to mess
3346 up nicely formatted displays - we make all possible glyphs
3347 display only a single character."
3349 ;; We start from the standard display table, if any.
3350 (let ((table (or (copy-sequence standard-display-table)
3351 (make-display-table)))
3353 ;; Nix out all the control chars...
3354 (while (>= (setq i (1- i)) 0)
3355 (aset table i [??]))
3356 ;; ... but not newline and cr, of course. (cr is necessary for the
3357 ;; selective display).
3358 (aset table ?\n nil)
3359 (aset table ?\r nil)
3360 ;; We keep TAB as well.
3361 (aset table ?\t nil)
3362 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3363 ;; Emacs 23 (unicode), that are not set already.
3364 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3367 (while (>= (setq i (1- i)) 127)
3368 ;; Only modify if the entry is nil.
3369 (unless (aref table i)
3370 (aset table i [??]))))
3371 (setq buffer-display-table table)))
3373 (defun gnus-summary-set-article-display-arrow (pos)
3374 "Update the overlay arrow to point to line at position POS."
3375 (when (and gnus-summary-display-arrow
3376 (boundp 'overlay-arrow-position)
3377 (boundp 'overlay-arrow-string))
3381 (unless overlay-arrow-position
3382 (setq overlay-arrow-position (make-marker)))
3383 (setq overlay-arrow-string "=>"
3384 overlay-arrow-position (set-marker overlay-arrow-position
3386 (current-buffer))))))
3388 (defun gnus-summary-setup-buffer (group)
3389 "Initialize summary buffer."
3390 (let ((buffer (gnus-summary-buffer-name group))
3391 (dead-name (concat "*Dead Summary "
3392 (gnus-group-decoded-name group) "*")))
3393 ;; If a dead summary buffer exists, we kill it.
3394 (when (gnus-buffer-live-p dead-name)
3395 (gnus-kill-buffer dead-name))
3396 (if (get-buffer buffer)
3399 (setq gnus-summary-buffer (current-buffer))
3400 (not gnus-newsgroup-prepared))
3401 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3402 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3403 (gnus-summary-mode group)
3405 (gnus-carpal-setup-buffer 'summary))
3406 (when (gnus-group-quit-config group)
3407 (set (make-local-variable 'gnus-single-article-buffer) nil))
3408 (make-local-variable 'gnus-article-buffer)
3409 (make-local-variable 'gnus-article-current)
3410 (make-local-variable 'gnus-original-article-buffer)
3411 (setq gnus-newsgroup-name group)
3412 ;; Set any local variables in the group parameters.
3413 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3416 (defun gnus-set-global-variables ()
3417 "Set the global equivalents of the buffer-local variables.
3418 They are set to the latest values they had. These reflect the summary
3419 buffer that was in action when the last article was fetched."
3420 (when (eq major-mode 'gnus-summary-mode)
3421 (setq gnus-summary-buffer (current-buffer))
3422 (let ((name gnus-newsgroup-name)
3423 (marked gnus-newsgroup-marked)
3424 (spam gnus-newsgroup-spam-marked)
3425 (unread gnus-newsgroup-unreads)
3426 (headers gnus-current-headers)
3427 (data gnus-newsgroup-data)
3428 (summary gnus-summary-buffer)
3429 (article-buffer gnus-article-buffer)
3430 (original gnus-original-article-buffer)
3431 (gac gnus-article-current)
3432 (reffed gnus-reffed-article-number)
3433 (score-file gnus-current-score-file)
3434 (default-charset gnus-newsgroup-charset)
3436 (let ((locals gnus-newsgroup-variables))
3438 (if (consp (car locals))
3439 (push (eval (caar locals)) vlist)
3440 (push (eval (car locals)) vlist))
3441 (setq locals (cdr locals)))
3442 (setq vlist (nreverse vlist)))
3443 (with-current-buffer gnus-group-buffer
3444 (setq gnus-newsgroup-name name
3445 gnus-newsgroup-marked marked
3446 gnus-newsgroup-spam-marked spam
3447 gnus-newsgroup-unreads unread
3448 gnus-current-headers headers
3449 gnus-newsgroup-data data
3450 gnus-article-current gac
3451 gnus-summary-buffer summary
3452 gnus-article-buffer article-buffer
3453 gnus-original-article-buffer original
3454 gnus-reffed-article-number reffed
3455 gnus-current-score-file score-file
3456 gnus-newsgroup-charset default-charset)
3457 (let ((locals gnus-newsgroup-variables))
3459 (if (consp (car locals))
3460 (set (caar locals) (pop vlist))
3461 (set (car locals) (pop vlist)))
3462 (setq locals (cdr locals))))
3463 ;; The article buffer also has local variables.
3464 (when (gnus-buffer-live-p gnus-article-buffer)
3465 (set-buffer gnus-article-buffer)
3466 (setq gnus-summary-buffer summary))))))
3468 (defun gnus-summary-article-unread-p (article)
3469 "Say whether ARTICLE is unread or not."
3470 (memq article gnus-newsgroup-unreads))
3472 (defun gnus-summary-first-article-p (&optional article)
3473 "Return whether ARTICLE is the first article in the buffer."
3474 (if (not (setq article (or article (gnus-summary-article-number))))
3476 (eq article (caar gnus-newsgroup-data))))
3478 (defun gnus-summary-last-article-p (&optional article)
3479 "Return whether ARTICLE is the last article in the buffer."
3480 (if (not (setq article (or article (gnus-summary-article-number))))
3481 ;; All non-existent numbers are the last article. :-)
3483 (not (cdr (gnus-data-find-list article)))))
3485 (defun gnus-make-thread-indent-array (&optional n)
3487 (progn (setq n 200) nil)
3488 (null gnus-thread-indent-array)
3489 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3490 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3491 gnus-thread-indent-array-level gnus-thread-indent-level)
3493 (aset gnus-thread-indent-array n
3494 (make-string (* n gnus-thread-indent-level) ? ))
3497 (defun gnus-update-summary-mark-positions ()
3498 "Compute where the summary marks are to go."
3500 (when (gnus-buffer-exists-p gnus-summary-buffer)
3501 (set-buffer gnus-summary-buffer))
3502 (let ((spec gnus-summary-line-format-spec)
3505 (gnus-set-work-buffer)
3506 (let ((gnus-tmp-unread ?Z)
3507 (gnus-replied-mark ?Z)
3508 (gnus-score-below-mark ?Z)
3509 (gnus-score-over-mark ?Z)
3510 (gnus-undownloaded-mark ?Z)
3511 (gnus-summary-line-format-spec spec)
3512 (gnus-newsgroup-downloadable '(0))
3513 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3514 case-fold-search ignores)
3515 ;; Here, all marks are bound to Z.
3516 (gnus-summary-insert-line header
3517 0 nil t gnus-tmp-unread t nil "" nil 1)
3518 (goto-char (point-min))
3519 ;; Memorize the positions of the same characters as dummy marks.
3520 (while (re-search-forward "[A-D]" nil t)
3521 (push (point) ignores))
3523 ;; We use A-D as dummy marks in order to know column positions
3524 ;; where marks should be inserted.
3525 (setq gnus-tmp-unread ?A
3526 gnus-replied-mark ?B
3527 gnus-score-below-mark ?C
3528 gnus-score-over-mark ?C
3529 gnus-undownloaded-mark ?D)
3530 (gnus-summary-insert-line header
3531 0 nil t gnus-tmp-unread t nil "" nil 1)
3532 ;; Ignore characters which aren't dummy marks.
3534 (delete-region (goto-char (1- p)) p)
3536 (goto-char (point-min))
3537 (setq pos (list (cons 'unread
3538 (and (search-forward "A" nil t)
3539 (- (point) (point-min) 1)))))
3540 (goto-char (point-min))
3541 (push (cons 'replied (and (search-forward "B" nil t)
3542 (- (point) (point-min) 1)))
3544 (goto-char (point-min))
3545 (push (cons 'score (and (search-forward "C" nil t)
3546 (- (point) (point-min) 1)))
3548 (goto-char (point-min))
3549 (push (cons 'download (and (search-forward "D" nil t)
3550 (- (point) (point-min) 1)))
3552 (setq gnus-summary-mark-positions pos))))
3554 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3555 "Insert a dummy root in the summary buffer."
3557 (gnus-add-text-properties
3558 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3559 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3561 (defun gnus-summary-extract-address-component (from)
3562 (or (car (funcall gnus-extract-address-components from))
3565 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3566 (let ((mail-parse-charset gnus-newsgroup-charset)
3567 (ignored-from-addresses (gnus-ignored-from-addresses))
3568 ; Is it really necessary to do this next part for each summary line?
3569 ; Luckily, doesn't seem to slow things down much.
3570 (mail-parse-ignored-charsets
3571 (with-current-buffer gnus-summary-buffer
3572 gnus-newsgroup-ignored-charsets)))
3574 (and ignored-from-addresses
3575 (string-match ignored-from-addresses gnus-tmp-from)
3576 (let ((extra-headers (mail-header-extra header))
3580 ((setq to (cdr (assq 'To extra-headers)))
3581 (concat gnus-summary-to-prefix
3583 (gnus-summary-extract-address-component
3584 (funcall gnus-decode-encoded-address-function to)))))
3587 (cdr (assq 'Newsgroups extra-headers))
3589 (memq 'Newsgroups gnus-extra-headers)
3590 (eq (car (gnus-find-method-for-group
3591 gnus-newsgroup-name)) 'nntp)
3592 (gnus-group-real-name gnus-newsgroup-name))))
3593 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3594 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3596 (defun gnus-summary-insert-line (gnus-tmp-header
3597 gnus-tmp-level gnus-tmp-current
3598 undownloaded gnus-tmp-unread gnus-tmp-replied
3599 gnus-tmp-expirable gnus-tmp-subject-or-nil
3600 &optional gnus-tmp-dummy gnus-tmp-score
3602 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3603 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3605 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3606 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3607 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3608 (gnus-tmp-score-char
3609 (if (or (null gnus-summary-default-score)
3610 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3611 gnus-summary-zcore-fuzz))
3613 (if (< gnus-tmp-score gnus-summary-default-score)
3614 gnus-score-below-mark gnus-score-over-mark)))
3615 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3617 (cond (gnus-tmp-process gnus-process-mark)
3618 ((memq gnus-tmp-current gnus-newsgroup-cached)
3620 (gnus-tmp-replied gnus-replied-mark)
3621 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3622 gnus-forwarded-mark)
3623 ((memq gnus-tmp-current gnus-newsgroup-saved)
3625 ((memq gnus-tmp-number gnus-newsgroup-recent)
3627 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3630 (gnus-tmp-downloaded
3632 gnus-undownloaded-mark)
3633 (gnus-newsgroup-agentized
3634 gnus-downloaded-mark)
3637 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3640 ((string-match "<[^>]+> *$" gnus-tmp-from)
3641 (let ((beg (match-beginning 0)))
3642 (or (and (string-match "^\".+\"" gnus-tmp-from)
3643 (substring gnus-tmp-from 1 (1- (match-end 0))))
3644 (substring gnus-tmp-from 0 beg))))
3645 ((string-match "(.+)" gnus-tmp-from)
3646 (substring gnus-tmp-from
3647 (1+ (match-beginning 0)) (1- (match-end 0))))
3649 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3650 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3651 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3652 (buffer-read-only nil))
3653 (when (string= gnus-tmp-name "")
3654 (setq gnus-tmp-name gnus-tmp-from))
3655 (unless (numberp gnus-tmp-lines)
3656 (setq gnus-tmp-lines -1))
3657 (if (= gnus-tmp-lines -1)
3658 (setq gnus-tmp-lines "?")
3659 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3660 (gnus-put-text-property
3662 (progn (eval gnus-summary-line-format-spec) (point))
3663 'gnus-number gnus-tmp-number)
3664 (when (gnus-visual-p 'summary-highlight 'highlight)
3666 (gnus-run-hooks 'gnus-summary-update-hook)
3669 (defun gnus-summary-update-line (&optional dont-update)
3670 "Update summary line after change."
3671 (when (and gnus-summary-default-score
3672 (not gnus-summary-inhibit-highlight))
3673 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3674 (article (gnus-summary-article-number))
3675 (score (gnus-summary-article-score article)))
3677 (if (and gnus-summary-mark-below
3678 (< (gnus-summary-article-score)
3679 gnus-summary-mark-below))
3680 ;; This article has a low score, so we mark it as read.
3681 (when (memq article gnus-newsgroup-unreads)
3682 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3683 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3684 ;; This article was previously marked as read on account
3685 ;; of a low score, but now it has risen, so we mark it as
3687 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3688 (gnus-summary-update-mark
3689 (if (or (null gnus-summary-default-score)
3690 (<= (abs (- score gnus-summary-default-score))
3691 gnus-summary-zcore-fuzz))
3693 (if (< score gnus-summary-default-score)
3694 gnus-score-below-mark gnus-score-over-mark))
3696 ;; Do visual highlighting.
3697 (when (gnus-visual-p 'summary-highlight 'highlight)
3698 (gnus-run-hooks 'gnus-summary-update-hook)))))
3700 (defvar gnus-tmp-new-adopts nil)
3702 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3703 "Return the number of articles in THREAD.
3704 This may be 0 in some cases -- if none of the articles in
3705 the thread are to be displayed."
3707 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3709 ((not (listp thread))
3711 ((and (consp thread) (cdr thread))
3714 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3717 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3720 (when (and level (zerop level) gnus-tmp-new-adopts)
3723 'gnus-summary-number-of-articles-in-thread
3724 gnus-tmp-new-adopts))))
3726 (if (> number 1) gnus-not-empty-thread-mark
3727 gnus-empty-thread-mark)
3730 (defsubst gnus-summary-line-message-size (head)
3731 "Return pretty-printed version of message size.
3732 This function is intended to be used in
3733 `gnus-summary-line-format-alist'."
3734 (let ((c (or (mail-header-chars head) -1)))
3735 (cond ((< c 0) "n/a") ; chars not available
3736 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3737 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3738 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3739 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3742 (defun gnus-summary-set-local-parameters (group)
3743 "Go through the local params of GROUP and set all variable specs in that list."
3744 (let ((vars '(quit-config))) ; Ignore quit-config.
3745 (dolist (elem (gnus-group-find-parameter group))
3746 (and (consp elem) ; Has to be a cons.
3747 (consp (cdr elem)) ; The cdr has to be a list.
3748 (symbolp (car elem)) ; Has to be a symbol in there.
3749 (not (memq (car elem) vars))
3750 (ignore-errors ; So we set it.
3751 (push (car elem) vars)
3752 (make-local-variable (car elem))
3753 (set (car elem) (eval (nth 1 elem))))))))
3755 (defun gnus-summary-read-group (group &optional show-all no-article
3756 kill-buffer no-display backward
3758 "Start reading news in newsgroup GROUP.
3759 If SHOW-ALL is non-nil, already read articles are also listed.
3760 If NO-ARTICLE is non-nil, no article is selected initially.
3761 If NO-DISPLAY, don't generate a summary buffer."
3765 (let ((gnus-auto-select-next nil))
3766 (or (gnus-summary-read-group-1
3767 group show-all no-article
3768 kill-buffer no-display
3771 select-articles nil)))))
3772 (eq gnus-auto-select-next 'quietly))
3773 (set-buffer gnus-group-buffer)
3774 ;; The entry function called above goes to the next
3775 ;; group automatically, so we go two groups back
3776 ;; if we are searching for the previous group.
3778 (gnus-group-prev-unread-group 2))
3779 (if (not (equal group (gnus-group-group-name)))
3780 (setq group (gnus-group-group-name))
3784 (defun gnus-summary-read-group-1 (group show-all no-article
3785 kill-buffer no-display
3786 &optional select-articles)
3787 ;; Killed foreign groups can't be entered.
3788 ;; (when (and (not (gnus-group-native-p group))
3789 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3790 ;; (error "Dead non-native groups can't be entered"))
3791 (gnus-message 5 "Retrieving newsgroup: %s..."
3792 (gnus-group-decoded-name group))
3793 (let* ((new-group (gnus-summary-setup-buffer group))
3794 (quit-config (gnus-group-quit-config group))
3795 (did-select (and new-group (gnus-select-newsgroup
3796 group show-all select-articles))))
3798 ;; This summary buffer exists already, so we just select it.
3800 (gnus-set-global-variables)
3802 (gnus-kill-or-deaden-summary kill-buffer))
3803 (gnus-configure-windows 'summary 'force)
3804 (gnus-set-mode-line 'summary)
3805 (gnus-summary-position-point)
3808 ;; We couldn't select this group.
3810 (when (and (eq major-mode 'gnus-summary-mode)
3811 (not (equal (current-buffer) kill-buffer)))
3812 (kill-buffer (current-buffer))
3813 (if (not quit-config)
3815 ;; Update the info -- marks might need to be removed,
3817 (gnus-summary-update-info)
3818 (set-buffer gnus-group-buffer)
3819 (gnus-group-jump-to-group group)
3820 (gnus-group-next-unread-group 1))
3821 (gnus-handle-ephemeral-exit quit-config)))
3822 (let ((grpinfo (gnus-get-info group)))
3823 (if (null (gnus-info-read grpinfo))
3824 (gnus-message 3 "Group %s contains no messages"
3825 (gnus-group-decoded-name group))
3826 (gnus-message 3 "Can't select group")))
3828 ;; The user did a `C-g' while prompting for number of articles,
3829 ;; so we exit this group.
3830 ((eq did-select 'quit)
3831 (and (eq major-mode 'gnus-summary-mode)
3832 (not (equal (current-buffer) kill-buffer))
3833 (kill-buffer (current-buffer)))
3835 (gnus-kill-or-deaden-summary kill-buffer))
3836 (if (not quit-config)
3838 (set-buffer gnus-group-buffer)
3839 (gnus-group-jump-to-group group)
3840 (gnus-group-next-unread-group 1)
3841 (gnus-configure-windows 'group 'force))
3842 (gnus-handle-ephemeral-exit quit-config))
3843 ;; Finally signal the quit.
3845 ;; The group was successfully selected.
3847 (gnus-set-global-variables)
3848 ;; Save the active value in effect when the group was entered.
3849 (setq gnus-newsgroup-active
3851 (gnus-active gnus-newsgroup-name)))
3852 ;; You can change the summary buffer in some way with this hook.
3853 (gnus-run-hooks 'gnus-select-group-hook)
3854 (when (memq 'summary (gnus-update-format-specifications
3855 nil 'summary 'summary-mode 'summary-dummy))
3856 ;; The format specification for the summary line was updated,
3857 ;; so we need to update the mark positions as well.
3858 (gnus-update-summary-mark-positions))
3859 ;; Do score processing.
3860 (when gnus-use-scoring
3861 (gnus-possibly-score-headers))
3862 ;; Check whether to fill in the gaps in the threads.
3863 (when gnus-build-sparse-threads
3864 (gnus-build-sparse-threads))
3865 ;; Find the initial limit.
3867 (let ((gnus-newsgroup-dormant nil))
3868 (gnus-summary-initial-limit show-all))
3869 (gnus-summary-initial-limit show-all))
3870 ;; Generate the summary buffer.
3872 (gnus-summary-prepare))
3873 (when gnus-use-trees
3874 (gnus-tree-open group)
3875 (setq gnus-summary-highlight-line-function
3876 'gnus-tree-highlight-article))
3877 ;; If the summary buffer is empty, but there are some low-scored
3878 ;; articles or some excluded dormants, we include these in the
3880 (when (and (zerop (buffer-size))
3882 (cond (gnus-newsgroup-dormant
3883 (gnus-summary-limit-include-dormant))
3884 ((and gnus-newsgroup-scored show-all)
3885 (gnus-summary-limit-include-expunged t))))
3886 ;; Function `gnus-apply-kill-file' must be called in this hook.
3887 (gnus-run-hooks 'gnus-apply-kill-hook)
3888 (if (and (zerop (buffer-size))
3891 ;; This newsgroup is empty.
3892 (gnus-summary-catchup-and-exit nil t)
3893 (gnus-message 6 "No unread news")
3895 (gnus-kill-or-deaden-summary kill-buffer))
3896 ;; Return nil from this function.
3898 ;; Hide conversation thread subtrees. We cannot do this in
3899 ;; gnus-summary-prepare-hook since kill processing may not
3900 ;; work with hidden articles.
3901 (gnus-summary-maybe-hide-threads)
3903 (gnus-kill-or-deaden-summary kill-buffer))
3904 (gnus-summary-auto-select-subject)
3905 ;; Show first unread article if requested.
3906 (if (and (not no-article)
3908 gnus-newsgroup-unreads
3909 gnus-auto-select-first)
3911 (gnus-configure-windows 'summary)
3912 (let ((art (gnus-summary-article-number)))
3913 (unless (and (not gnus-plugged)
3914 (or (memq art gnus-newsgroup-undownloaded)
3915 (memq art gnus-newsgroup-downloadable)))
3916 (gnus-summary-goto-article art))))
3917 ;; Don't select any articles.
3918 (gnus-summary-position-point)
3919 (gnus-configure-windows 'summary 'force)
3920 (gnus-set-mode-line 'summary))
3921 (when (and gnus-auto-center-group
3922 (get-buffer-window gnus-group-buffer t))
3923 ;; Gotta use windows, because recenter does weird stuff if
3924 ;; the current buffer ain't the displayed window.
3925 (let ((owin (selected-window)))
3926 (select-window (get-buffer-window gnus-group-buffer t))
3927 (when (gnus-group-goto-group group)
3929 (select-window owin)))
3930 ;; Mark this buffer as "prepared".
3931 (setq gnus-newsgroup-prepared t)
3932 (gnus-run-hooks 'gnus-summary-prepared-hook)
3933 (unless (gnus-ephemeral-group-p group)
3934 (gnus-group-update-group group))
3937 (defun gnus-summary-auto-select-subject ()
3938 "Select the subject line on initial group entry."
3939 (goto-char (point-min))
3941 ((eq gnus-auto-select-subject 'best)
3942 (gnus-summary-best-unread-subject))
3943 ((eq gnus-auto-select-subject 'unread)
3944 (gnus-summary-first-unread-subject))
3945 ((eq gnus-auto-select-subject 'unseen)
3946 (gnus-summary-first-unseen-subject))
3947 ((eq gnus-auto-select-subject 'unseen-or-unread)
3948 (gnus-summary-first-unseen-or-unread-subject))
3949 ((eq gnus-auto-select-subject 'first)
3952 ((functionp gnus-auto-select-subject)
3953 (funcall gnus-auto-select-subject))))
3955 (defun gnus-summary-prepare ()
3956 "Generate the summary buffer."
3958 (let ((buffer-read-only nil))
3960 (setq gnus-newsgroup-data nil
3961 gnus-newsgroup-data-reverse nil)
3962 (gnus-run-hooks 'gnus-summary-generate-hook)
3963 ;; Generate the buffer, either with threads or without.
3964 (when gnus-newsgroup-headers
3965 (gnus-summary-prepare-threads
3966 (if gnus-show-threads
3967 (gnus-sort-gathered-threads
3968 (funcall gnus-summary-thread-gathering-function
3970 (gnus-cut-threads (gnus-make-threads)))))
3971 ;; Unthreaded display.
3972 (gnus-sort-articles gnus-newsgroup-headers))))
3973 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3974 ;; Call hooks for modifying summary buffer.
3975 (goto-char (point-min))
3976 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3978 (defsubst gnus-general-simplify-subject (subject)
3979 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3982 ;; Truncate the subject.
3983 (gnus-simplify-subject-functions
3984 (gnus-map-function gnus-simplify-subject-functions subject))
3985 ((numberp gnus-summary-gather-subject-limit)
3986 (setq subject (gnus-simplify-subject-re subject))
3987 (if (> (length subject) gnus-summary-gather-subject-limit)
3988 (substring subject 0 gnus-summary-gather-subject-limit)
3990 ;; Fuzzily simplify it.
3991 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3992 (gnus-simplify-subject-fuzzy subject))
3993 ;; Just remove the leading "Re:".
3995 (gnus-simplify-subject-re subject))))
3997 (if (and gnus-summary-gather-exclude-subject
3998 (string-match gnus-summary-gather-exclude-subject subject))
3999 nil ; This article shouldn't be gathered
4002 (defun gnus-summary-simplify-subject-query ()
4003 "Query where the respool algorithm would put this article."
4005 (gnus-summary-select-article)
4006 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
4008 (defun gnus-gather-threads-by-subject (threads)
4009 "Gather threads by looking at Subject headers."
4010 (if (not gnus-summary-make-false-root)
4012 (let ((hashtb (gnus-make-hashtable 1024))
4015 subject hthread whole-subject)
4017 (setq subject (gnus-general-simplify-subject
4018 (setq whole-subject (mail-header-subject
4021 (if (setq hthread (gnus-gethash subject hashtb))
4023 ;; We enter a dummy root into the thread, if we
4024 ;; haven't done that already.
4025 (unless (stringp (caar hthread))
4026 (setcar hthread (list whole-subject (car hthread))))
4027 ;; We add this new gathered thread to this gathered
4029 (setcdr (car hthread)
4030 (nconc (cdar hthread) (list (car threads))))
4031 ;; Remove it from the list of threads.
4032 (setcdr prev (cdr threads))
4033 (setq threads prev))
4034 ;; Enter this thread into the hash table.
4035 (gnus-sethash subject
4036 (if gnus-summary-make-false-root-always
4038 ;; If you want a dummy root above all
4040 (setcar threads (list whole-subject
4046 (setq threads (cdr threads)))
4049 (defun gnus-gather-threads-by-references (threads)
4050 "Gather threads by looking at References headers."
4051 (let ((idhashtb (gnus-make-hashtable 1024))
4052 (thhashtb (gnus-make-hashtable 1024))
4055 ids references id gthread gid entered ref)
4057 (when (setq references (mail-header-references (caar threads)))
4058 (setq id (mail-header-id (caar threads))
4059 ids (inline (gnus-split-references references))
4061 (while (setq ref (pop ids))
4062 (setq ids (delete ref ids))
4063 (if (not (setq gid (gnus-gethash ref idhashtb)))
4065 (gnus-sethash ref id idhashtb)
4066 (gnus-sethash id threads thhashtb))
4067 (setq gthread (gnus-gethash gid thhashtb))
4069 ;; We enter a dummy root into the thread, if we
4070 ;; haven't done that already.
4071 (unless (stringp (caar gthread))
4072 (setcar gthread (list (mail-header-subject (caar gthread))
4074 ;; We add this new gathered thread to this gathered
4076 (setcdr (car gthread)
4077 (nconc (cdar gthread) (list (car threads)))))
4078 ;; Add it into the thread hash table.
4079 (gnus-sethash id gthread thhashtb)
4081 ;; Remove it from the list of threads.
4082 (setcdr prev (cdr threads))
4083 (setq threads prev))))
4085 (setq threads (cdr threads)))
4088 (defun gnus-sort-gathered-threads (threads)
4089 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4090 (let ((result threads))
4092 (when (stringp (caar threads))
4093 (setcdr (car threads)
4094 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4095 (setq threads (cdr threads)))
4098 (defun gnus-thread-loop-p (root thread)
4099 "Say whether ROOT is in THREAD."
4100 (let ((stack (list thread))
4103 (while (setq thread (pop stack))
4104 (setq th (cdr thread))
4106 (not (eq (caar th) root)))
4109 ;; We have found a loop.
4111 (setcdr thread (delq (car th) (cdr thread)))
4112 (if (boundp (setq ref-dep (intern "none"
4113 gnus-newsgroup-dependencies)))
4114 (setcdr (symbol-value ref-dep)
4115 (nconc (cdr (symbol-value ref-dep))
4117 (set ref-dep (list nil (car th))))
4120 ;; Push all the subthreads onto the stack.
4121 (push (cdr thread) stack)))
4124 (defun gnus-make-threads ()
4125 "Go through the dependency hashtb and find the roots. Return all threads."
4127 (while (catch 'infloop
4130 ;; Deal with self-referencing References loops.
4131 (when (and (car (symbol-value refs))
4138 (car (symbol-value refs)) thread))
4139 (cdr (symbol-value refs)))))))
4142 (unless (car (symbol-value refs))
4143 ;; These threads do not refer back to any other
4144 ;; articles, so they're roots.
4145 (setq threads (append (cdr (symbol-value refs)) threads))))
4146 gnus-newsgroup-dependencies)))
4149 ;; Build the thread tree.
4150 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4151 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4153 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4154 if it was already present.
4156 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4157 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4158 Message-IDs will be renamed to a unique Message-ID before being
4161 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4162 (let* ((id (mail-header-id header))
4163 (id-dep (and id (intern id dependencies)))
4164 parent-id ref ref-dep ref-header replaced)
4165 ;; Enter this `header' in the `dependencies' table.
4169 ;; The first two cases do the normal part: enter a new `header'
4170 ;; in the `dependencies' table.
4171 ((not (boundp id-dep))
4172 (set id-dep (list header)))
4173 ((null (car (symbol-value id-dep)))
4174 (setcar (symbol-value id-dep) header))
4176 ;; From here the `header' was already present in the
4177 ;; `dependencies' table.
4179 ;; Overrides an existing entry;
4180 ;; just set the header part of the entry.
4181 (setcar (symbol-value id-dep) header)
4184 ;; Renames the existing `header' to a unique Message-ID.
4185 ((not gnus-summary-ignore-duplicates)
4186 ;; An article with this Message-ID has already been seen.
4187 ;; We rename the Message-ID.
4188 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4190 (mail-header-set-id header id))
4192 ;; The last case ignores an existing entry, except it adds any
4193 ;; additional Xrefs (in case the two articles came from different
4195 ;; Also sets `header' to `nil' meaning that the `dependencies'
4196 ;; table was *not* modified.
4198 (mail-header-set-xref
4199 (car (symbol-value id-dep))
4200 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4202 (or (mail-header-xref header) "")))
4205 (when (and header (not replaced))
4206 ;; First check that we are not creating a References loop.
4207 (setq parent-id (gnus-parent-id (mail-header-references header)))
4208 (setq ref parent-id)
4210 (setq ref-dep (intern-soft ref dependencies))
4212 (setq ref-header (car (symbol-value ref-dep))))
4213 (if (string= id ref)
4214 ;; Yuk! This is a reference loop. Make the article be a
4217 (mail-header-set-references (car (symbol-value id-dep)) "none")
4219 (setq parent-id nil))
4220 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4221 (setq ref-dep (intern (or parent-id "none") dependencies))
4222 (if (boundp ref-dep)
4223 (setcdr (symbol-value ref-dep)
4224 (nconc (cdr (symbol-value ref-dep))
4225 (list (symbol-value id-dep))))
4226 (set ref-dep (list nil (symbol-value id-dep)))))
4229 (defun gnus-extract-message-id-from-in-reply-to (string)
4230 (if (string-match "<[^>]+>" string)
4231 (substring string (match-beginning 0) (match-end 0))
4234 (defun gnus-build-sparse-threads ()
4235 (let ((headers gnus-newsgroup-headers)
4236 (mail-parse-charset gnus-newsgroup-charset)
4237 (gnus-summary-ignore-duplicates t)
4238 header references generation relations
4239 subject child end new-child date)
4240 ;; First we create an alist of generations/relations, where
4241 ;; generations is how much we trust the relation, and the relation
4243 (gnus-message 7 "Making sparse threads...")
4245 (nnheader-set-temp-buffer " *gnus sparse threads*")
4246 (while (setq header (pop headers))
4247 (when (and (setq references (mail-header-references header))
4248 (not (string= references "")))
4250 (setq child (mail-header-id header)
4251 subject (mail-header-subject header)
4252 date (mail-header-date header)
4254 (while (search-backward ">" nil t)
4255 (setq end (1+ (point)))
4256 (when (search-backward "<" nil t)
4257 (setq new-child (buffer-substring (point) end))
4258 (push (list (incf generation)
4259 child (setq child new-child)
4263 (push (list (1+ generation) child nil subject) relations))
4265 (kill-buffer (current-buffer)))
4266 ;; Sort over trustworthiness.
4269 (when (gnus-dependencies-add-header
4270 (make-full-mail-header
4271 gnus-reffed-article-number
4272 (nth 3 relation) "" (or (nth 4 relation) "")
4274 (or (nth 2 relation) "") 0 0 "")
4275 gnus-newsgroup-dependencies nil)
4276 (push gnus-reffed-article-number gnus-newsgroup-limit)
4277 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4278 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4279 gnus-newsgroup-reads)
4280 (decf gnus-reffed-article-number)))
4281 (sort relations 'car-less-than-car))
4282 (gnus-message 7 "Making sparse threads...done")))
4284 (defun gnus-build-old-threads ()
4285 ;; Look at all the articles that refer back to old articles, and
4286 ;; fetch the headers for the articles that aren't there. This will
4287 ;; build complete threads - if the roots haven't been expired by the
4289 (let ((mail-parse-charset gnus-newsgroup-charset)
4293 (when (not (car (symbol-value refs)))
4294 (setq heads (cdr (symbol-value refs)))
4296 (if (memq (mail-header-number (caar heads))
4297 gnus-newsgroup-dormant)
4298 (setq heads (cdr heads))
4299 (setq id (symbol-name refs))
4300 (while (and (setq id (gnus-build-get-header id))
4301 (not (car (gnus-id-to-thread id)))))
4302 (setq heads nil)))))
4303 gnus-newsgroup-dependencies)))
4305 (defsubst gnus-remove-odd-characters (string)
4306 "Translate STRING into something that doesn't contain weird characters."
4307 (mm-subst-char-in-string
4309 (mm-subst-char-in-string ?\n ?\- string t) t))
4311 ;; This function has to be called with point after the article number
4312 ;; on the beginning of the line.
4313 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4314 (let ((eol (point-at-eol))
4315 (buffer (current-buffer))
4316 header references in-reply-to)
4318 ;; overview: [num subject from date id refs chars lines misc]
4321 (narrow-to-region (point) eol)
4326 (make-full-mail-header
4328 (condition-case () ; subject
4329 (gnus-remove-odd-characters
4330 (funcall gnus-decode-encoded-word-function
4331 (setq x (nnheader-nov-field))))
4333 (condition-case () ; from
4334 (gnus-remove-odd-characters
4335 (funcall gnus-decode-encoded-address-function
4336 (setq x (nnheader-nov-field))))
4338 (nnheader-nov-field) ; date
4339 (nnheader-nov-read-message-id number) ; id
4340 (setq references (nnheader-nov-field)) ; refs
4341 (nnheader-nov-read-integer) ; chars
4342 (nnheader-nov-read-integer) ; lines
4344 (if (looking-at "Xref: ")
4345 (goto-char (match-end 0)))
4346 (nnheader-nov-field)) ; Xref
4347 (nnheader-nov-parse-extra)))) ; extra
4351 (when (and (string= references "")
4352 (setq in-reply-to (mail-header-extra header))
4353 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4354 (mail-header-set-references
4355 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4357 (when gnus-alter-header-function
4358 (funcall gnus-alter-header-function header))
4359 (gnus-dependencies-add-header header dependencies force-new)))
4361 (defun gnus-build-get-header (id)
4362 "Look through the buffer of NOV lines and find the header to ID.
4363 Enter this line into the dependencies hash table, and return
4364 the id of the parent article (if any)."
4365 (let ((deps gnus-newsgroup-dependencies)
4369 (set-buffer nntp-server-buffer)
4370 (let ((case-fold-search nil))
4371 (goto-char (point-min))
4372 (while (and (not found)
4373 (search-forward id nil t))
4375 (setq found (looking-at
4376 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4377 (regexp-quote id))))
4378 (or found (beginning-of-line 2)))
4382 (setq header (gnus-nov-parse-line
4383 (read (current-buffer)) deps))
4384 (gnus-parent-id (mail-header-references header))))))
4386 (let ((number (mail-header-number header)))
4387 (push number gnus-newsgroup-limit)
4388 (push header gnus-newsgroup-headers)
4389 (if (memq number gnus-newsgroup-unselected)
4391 (setq gnus-newsgroup-unreads
4392 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4394 (setq gnus-newsgroup-unselected
4395 (delq number gnus-newsgroup-unselected)))
4396 (push number gnus-newsgroup-ancient)))))))
4398 (defun gnus-build-all-threads ()
4399 "Read all the headers."
4400 (let ((gnus-summary-ignore-duplicates t)
4401 (mail-parse-charset gnus-newsgroup-charset)
4402 (dependencies gnus-newsgroup-dependencies)
4405 (set-buffer nntp-server-buffer)
4406 (let ((case-fold-search nil))
4407 (goto-char (point-min))
4410 (setq article (read (current-buffer))
4411 header (gnus-nov-parse-line article dependencies)))
4413 (with-current-buffer gnus-summary-buffer
4414 (push header gnus-newsgroup-headers)
4415 (if (memq (setq article (mail-header-number header))
4416 gnus-newsgroup-unselected)
4418 (setq gnus-newsgroup-unreads
4419 (gnus-add-to-sorted-list
4420 gnus-newsgroup-unreads article))
4421 (setq gnus-newsgroup-unselected
4422 (delq article gnus-newsgroup-unselected)))
4423 (push article gnus-newsgroup-ancient)))
4424 (forward-line 1)))))))
4426 (defun gnus-summary-update-article-line (article header)
4427 "Update the line for ARTICLE using HEADER."
4428 (let* ((id (mail-header-id header))
4429 (thread (gnus-id-to-thread id)))
4431 (error "Article in no thread"))
4432 ;; Update the thread.
4433 (setcar thread header)
4434 (gnus-summary-goto-subject article)
4435 (let* ((datal (gnus-data-find-list article))
4437 (buffer-read-only nil)
4438 (level (gnus-summary-thread-level)))
4440 (let ((inserted (- (point)
4442 (gnus-summary-insert-line
4444 (memq article gnus-newsgroup-undownloaded)
4445 (gnus-article-mark article)
4446 (memq article gnus-newsgroup-replied)
4447 (memq article gnus-newsgroup-expirable)
4448 ;; Only insert the Subject string when it's different
4449 ;; from the previous Subject string.
4454 (mail-header-subject
4457 (gnus-data-find-list
4459 (gnus-data-list t)))))
4460 ;; Error on the side of excessive subjects.
4462 (mail-header-subject header)))
4464 (mail-header-subject header))
4465 nil (cdr (assq article gnus-newsgroup-scored))
4466 (memq article gnus-newsgroup-processable))
4469 (gnus-data-update-list
4471 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4473 (defun gnus-summary-update-article (article &optional iheader)
4474 "Update ARTICLE in the summary buffer."
4475 (set-buffer gnus-summary-buffer)
4476 (let* ((header (gnus-summary-article-header article))
4477 (id (mail-header-id header))
4478 (data (gnus-data-find article))
4479 (thread (gnus-id-to-thread id))
4480 (references (mail-header-references header))
4484 (when (and references
4485 (not (equal "" references)))
4488 (buffer-read-only nil)
4494 (delq thread parent)))
4495 (if (gnus-summary-insert-subject id header)
4496 ;; Set the (possibly) new article number in the data structure.
4497 (gnus-data-set-number data (gnus-id-to-article id))
4501 (defun gnus-rebuild-thread (id &optional line)
4502 "Rebuild the thread containing ID.
4503 If LINE, insert the rebuilt thread starting on line LINE."
4504 (let ((buffer-read-only nil)
4505 old-pos current thread data)
4506 (if (not gnus-show-threads)
4507 (setq thread (list (car (gnus-id-to-thread id))))
4508 ;; Get the thread this article is part of.
4509 (setq thread (gnus-remove-thread id)))
4510 (setq old-pos (point-at-bol))
4511 (setq current (save-excursion
4512 (and (re-search-backward "[\r\n]" nil t)
4513 (gnus-summary-article-number))))
4514 ;; If this is a gathered thread, we have to go some re-gathering.
4515 (when (stringp (car thread))
4516 (let ((subject (car thread))
4518 (setq thread (cdr thread))
4520 (unless (memq (setq thr (gnus-id-to-thread
4522 (mail-header-id (caar thread)))))
4525 (setq thread (cdr thread)))
4526 ;; We now have all (unique) roots.
4527 (if (= (length roots) 1)
4528 ;; All the loose roots are now one solid root.
4529 (setq thread (car roots))
4530 (setq thread (cons subject (gnus-sort-threads roots))))))
4532 ;; We then insert this thread into the summary buffer.
4534 (goto-char (point-min))
4535 (forward-line (1- line)))
4536 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4537 (if gnus-show-threads
4538 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4539 (gnus-summary-prepare-unthreaded thread))
4540 (setq data (nreverse gnus-newsgroup-data))
4541 (setq threads gnus-newsgroup-threads))
4542 ;; We splice the new data into the data structure.
4543 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4544 ;;!!! then we want to insert at the beginning of the buffer.
4545 ;;!!! That happens to be true with Gnus now, but that may
4546 ;;!!! change in the future. Perhaps.
4547 (gnus-data-enter-list
4548 (if line nil current) data (- (point) old-pos))
4549 (setq gnus-newsgroup-threads
4550 (nconc threads gnus-newsgroup-threads))
4551 (gnus-data-compute-positions))))
4553 (defun gnus-number-to-header (number)
4554 "Return the header for article NUMBER."
4555 (let ((headers gnus-newsgroup-headers))
4557 (not (= number (mail-header-number (car headers)))))
4562 (defun gnus-parent-headers (in-headers &optional generation)
4563 "Return the headers of the GENERATIONeth parent of HEADERS."
4565 (setq generation 1))
4567 (headers in-headers)
4570 (not (zerop generation))
4571 (setq references (mail-header-references headers)))
4572 (setq headers (if (and references
4573 (setq parent (gnus-parent-id references)))
4574 (car (gnus-id-to-thread parent))
4577 (and (not (eq headers in-headers))
4580 (defun gnus-id-to-thread (id)
4581 "Return the (sub-)thread where ID appears."
4582 (gnus-gethash id gnus-newsgroup-dependencies))
4584 (defun gnus-id-to-article (id)
4585 "Return the article number of ID."
4586 (let ((thread (gnus-id-to-thread id)))
4589 (mail-header-number (car thread)))))
4591 (defun gnus-id-to-header (id)
4592 "Return the article headers of ID."
4593 (car (gnus-id-to-thread id)))
4595 (defun gnus-article-displayed-root-p (article)
4596 "Say whether ARTICLE is a root(ish) article."
4597 (let ((level (gnus-summary-thread-level article))
4598 (refs (mail-header-references (gnus-summary-article-header article)))
4604 ((null (gnus-parent-id refs)) t)
4606 (null (setq particle (gnus-id-to-article
4607 (gnus-parent-id refs))))
4608 (null (gnus-summary-thread-level particle)))))))
4610 (defun gnus-root-id (id)
4611 "Return the id of the root of the thread where ID appears."
4613 (while (and id (setq prev (car (gnus-id-to-thread id))))
4615 id (gnus-parent-id (mail-header-references prev))))
4618 (defun gnus-articles-in-thread (thread)
4619 "Return the list of articles in THREAD."
4620 (cons (mail-header-number (car thread))
4621 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4623 (defun gnus-remove-thread (id &optional dont-remove)
4624 "Remove the thread that has ID in it."
4625 (let (headers thread last-id)
4626 ;; First go up in this thread until we find the root.
4627 (setq last-id (gnus-root-id id)
4628 headers (message-flatten-list (gnus-id-to-thread last-id)))
4629 ;; We have now found the real root of this thread. It might have
4630 ;; been gathered into some loose thread, so we have to search
4631 ;; through the threads to find the thread we wanted.
4632 (let ((threads gnus-newsgroup-threads)
4635 (setq sub (car threads))
4636 (if (stringp (car sub))
4637 ;; This is a gathered thread, so we look at the roots
4638 ;; below it to find whether this article is in this
4641 (setq sub (cdr sub))
4643 (when (member (caar sub) headers)
4644 (setq thread (car threads)
4647 (setq sub (cdr sub))))
4648 ;; It's an ordinary thread, so we check it.
4649 (when (eq (car sub) (car headers))
4652 (setq threads (cdr threads)))
4653 ;; If this article is in no thread, then it's a root.
4656 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4657 (setq thread (gnus-id-to-thread last-id)))
4660 thread ; We return this thread.
4662 (if (stringp (car thread))
4664 ;; If we use dummy roots, then we have to remove the
4665 ;; dummy root as well.
4666 (when (eq gnus-summary-make-false-root 'dummy)
4667 ;; We go to the dummy root by going to
4668 ;; the first sub-"thread", and then one line up.
4669 (gnus-summary-goto-article
4670 (mail-header-number (caadr thread)))
4673 (gnus-data-compute-positions))
4674 (setq thread (cdr thread))
4676 (gnus-remove-thread-1 (car thread))
4677 (setq thread (cdr thread))))
4678 (gnus-remove-thread-1 thread))))))))
4680 (defun gnus-remove-thread-1 (thread)
4681 "Remove the thread THREAD recursively."
4682 (let ((number (mail-header-number (pop thread)))
4684 (setq thread (reverse thread))
4686 (gnus-remove-thread-1 (pop thread)))
4687 (when (setq d (gnus-data-find number))
4688 (goto-char (gnus-data-pos d))
4689 (gnus-summary-show-thread)
4695 (gnus-delete-line)))))))
4697 (defun gnus-sort-threads-recursive (threads func)
4698 (sort (mapcar (lambda (thread)
4701 (gnus-sort-threads-recursive (cdr thread) func))))
4704 (defun gnus-sort-threads-loop (threads func)
4705 (let* ((superthread (cons nil threads))
4706 (stack (list (cons superthread threads)))
4707 remaining-threads thread)
4709 (setq remaining-threads (cdr (car stack)))
4710 (if remaining-threads
4711 (progn (setq thread (car remaining-threads))
4712 (setcdr (car stack) (cdr remaining-threads))
4714 (push (cons thread (cdr thread)) stack)))
4715 (setq thread (caar stack))
4716 (setcdr thread (sort (cdr thread) func))
4720 (defun gnus-sort-threads (threads)
4722 (if (not gnus-thread-sort-functions)
4724 (gnus-message 8 "Sorting threads...")
4727 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4728 (gnus-sort-threads-recursive
4729 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4730 ;; Even after binding max-lisp-eval-depth, the recursive
4731 ;; sorter might fail for very long threads. In that case,
4732 ;; try using a (less well-tested) non-recursive sorter.
4733 (error (gnus-sort-threads-loop
4734 threads (gnus-make-sort-function
4735 gnus-thread-sort-functions))))
4736 (gnus-message 8 "Sorting threads...done"))))
4738 (defun gnus-sort-articles (articles)
4740 (when gnus-article-sort-functions
4741 (gnus-message 7 "Sorting articles...")
4743 (setq gnus-newsgroup-headers
4744 (sort articles (gnus-make-sort-function
4745 gnus-article-sort-functions)))
4746 (gnus-message 7 "Sorting articles...done"))))
4748 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4749 (defmacro gnus-thread-header (thread)
4750 "Return header of first article in THREAD.
4751 Note that THREAD must never, ever be anything else than a variable -
4752 using some other form will lead to serious barfage."
4753 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4754 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4755 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4758 (defsubst gnus-article-sort-by-number (h1 h2)
4759 "Sort articles by article number."
4760 (< (mail-header-number h1)
4761 (mail-header-number h2)))
4763 (defun gnus-thread-sort-by-number (h1 h2)
4764 "Sort threads by root article number."
4765 (gnus-article-sort-by-number
4766 (gnus-thread-header h1) (gnus-thread-header h2)))
4768 (defsubst gnus-article-sort-by-random (h1 h2)
4769 "Sort articles by article number."
4772 (defun gnus-thread-sort-by-random (h1 h2)
4773 "Sort threads by root article number."
4774 (gnus-article-sort-by-random
4775 (gnus-thread-header h1) (gnus-thread-header h2)))
4777 (defsubst gnus-article-sort-by-lines (h1 h2)
4778 "Sort articles by article Lines header."
4779 (< (mail-header-lines h1)
4780 (mail-header-lines h2)))
4782 (defun gnus-thread-sort-by-lines (h1 h2)
4783 "Sort threads by root article Lines header."
4784 (gnus-article-sort-by-lines
4785 (gnus-thread-header h1) (gnus-thread-header h2)))
4787 (defsubst gnus-article-sort-by-chars (h1 h2)
4788 "Sort articles by octet length."
4789 (< (mail-header-chars h1)
4790 (mail-header-chars h2)))
4792 (defun gnus-thread-sort-by-chars (h1 h2)
4793 "Sort threads by root article octet length."
4794 (gnus-article-sort-by-chars
4795 (gnus-thread-header h1) (gnus-thread-header h2)))
4797 (defsubst gnus-article-sort-by-author (h1 h2)
4798 "Sort articles by root author."
4800 (let ((extract (funcall
4801 gnus-extract-address-components
4802 (mail-header-from h1))))
4803 (or (car extract) (cadr extract) ""))
4804 (let ((extract (funcall
4805 gnus-extract-address-components
4806 (mail-header-from h2))))
4807 (or (car extract) (cadr extract) ""))))
4809 (defun gnus-thread-sort-by-author (h1 h2)
4810 "Sort threads by root author."
4811 (gnus-article-sort-by-author
4812 (gnus-thread-header h1) (gnus-thread-header h2)))
4814 (defsubst gnus-article-sort-by-recipient (h1 h2)
4815 "Sort articles by recipient."
4817 (let ((extract (funcall
4818 gnus-extract-address-components
4819 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4820 (or (car extract) (cadr extract)))
4821 (let ((extract (funcall
4822 gnus-extract-address-components
4823 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4824 (or (car extract) (cadr extract)))))
4826 (defun gnus-thread-sort-by-recipient (h1 h2)
4827 "Sort threads by root recipient."
4828 (gnus-article-sort-by-recipient
4829 (gnus-thread-header h1) (gnus-thread-header h2)))
4831 (defsubst gnus-article-sort-by-subject (h1 h2)
4832 "Sort articles by root subject."
4834 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4835 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4837 (defun gnus-thread-sort-by-subject (h1 h2)
4838 "Sort threads by root subject."
4839 (gnus-article-sort-by-subject
4840 (gnus-thread-header h1) (gnus-thread-header h2)))
4842 (defsubst gnus-article-sort-by-date (h1 h2)
4843 "Sort articles by root article date."
4845 (gnus-date-get-time (mail-header-date h1))
4846 (gnus-date-get-time (mail-header-date h2))))
4848 (defun gnus-thread-sort-by-date (h1 h2)
4849 "Sort threads by root article date."
4850 (gnus-article-sort-by-date
4851 (gnus-thread-header h1) (gnus-thread-header h2)))
4853 (defsubst gnus-article-sort-by-score (h1 h2)
4854 "Sort articles by root article score.
4855 Unscored articles will be counted as having a score of zero."
4856 (> (or (cdr (assq (mail-header-number h1)
4857 gnus-newsgroup-scored))
4858 gnus-summary-default-score 0)
4859 (or (cdr (assq (mail-header-number h2)
4860 gnus-newsgroup-scored))
4861 gnus-summary-default-score 0)))
4863 (defun gnus-thread-sort-by-score (h1 h2)
4864 "Sort threads by root article score."
4865 (gnus-article-sort-by-score
4866 (gnus-thread-header h1) (gnus-thread-header h2)))
4868 (defun gnus-thread-sort-by-total-score (h1 h2)
4869 "Sort threads by the sum of all scores in the thread.
4870 Unscored articles will be counted as having a score of zero."
4871 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4873 (defun gnus-thread-total-score (thread)
4874 ;; This function find the total score of THREAD.
4879 (if (stringp (car thread))
4880 (apply gnus-thread-score-function 0
4881 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4882 (gnus-thread-total-score-1 thread)))
4884 (gnus-thread-total-score-1 (list thread)))))
4886 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4887 "Sort threads such that the thread with the most recently arrived article comes first."
4888 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4890 (defun gnus-thread-highest-number (thread)
4891 "Return the highest article number in THREAD."
4892 (apply 'max (mapcar (lambda (header)
4893 (mail-header-number header))
4894 (message-flatten-list thread))))
4896 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4897 "Sort threads such that the thread with the most recently dated article comes first."
4898 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4900 (defun gnus-thread-latest-date (thread)
4901 "Return the highest article date in THREAD."
4902 (let ((previous-time 0))
4908 (time-to-seconds (mail-header-parse-date
4909 (mail-header-date header)))
4910 (error previous-time))))
4912 (message-flatten-list thread)
4914 (< (mail-header-number h1)
4915 (mail-header-number h2))))))))
4917 (defun gnus-thread-total-score-1 (root)
4918 ;; This function find the total score of the thread below ROOT.
4919 (setq root (car root))
4920 (apply gnus-thread-score-function
4922 (mapcar 'gnus-thread-total-score
4923 (cdr (gnus-id-to-thread (mail-header-id root))))
4924 (when (> (mail-header-number root) 0)
4925 (list (or (cdr (assq (mail-header-number root)
4926 gnus-newsgroup-scored))
4927 gnus-summary-default-score 0))))
4928 (list gnus-summary-default-score)
4931 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4932 (defvar gnus-tmp-prev-subject nil)
4933 (defvar gnus-tmp-false-parent nil)
4934 (defvar gnus-tmp-root-expunged nil)
4935 (defvar gnus-tmp-dummy-line nil)
4937 (eval-when-compile (defvar gnus-tmp-header))
4938 (defun gnus-extra-header (type &optional header)
4939 "Return the extra header of TYPE."
4940 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4943 (defvar gnus-tmp-thread-tree-header-string "")
4945 (defcustom gnus-sum-thread-tree-root "> "
4946 "With %B spec, used for the root of a thread.
4947 If nil, use subject instead."
4949 :type '(radio (const :format "%v " nil) string)
4950 :group 'gnus-thread)
4952 (defcustom gnus-sum-thread-tree-false-root "> "
4953 "With %B spec, used for a false root of a thread.
4954 If nil, use subject instead."
4956 :type '(radio (const :format "%v " nil) string)
4957 :group 'gnus-thread)
4959 (defcustom gnus-sum-thread-tree-single-indent ""
4960 "With %B spec, used for a thread with just one message.
4961 If nil, use subject instead."
4963 :type '(radio (const :format "%v " nil) string)
4964 :group 'gnus-thread)
4966 (defcustom gnus-sum-thread-tree-vertical "| "
4967 "With %B spec, used for drawing a vertical line."
4970 :group 'gnus-thread)
4972 (defcustom gnus-sum-thread-tree-indent " "
4973 "With %B spec, used for indenting."
4976 :group 'gnus-thread)
4978 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4979 "With %B spec, used for a leaf with brothers."
4982 :group 'gnus-thread)
4984 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4985 "With %B spec, used for a leaf without brothers."
4988 :group 'gnus-thread)
4990 (defun gnus-summary-prepare-threads (threads)
4991 "Prepare summary buffer from THREADS and indentation LEVEL.
4992 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4993 or a straight list of headers."
4994 (gnus-message 7 "Generating summary...")
4996 (setq gnus-newsgroup-threads threads)
4999 (let ((gnus-tmp-level 0)
5000 (default-score (or gnus-summary-default-score 0))
5001 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5002 (building-line-count gnus-summary-display-while-building)
5003 (building-count (integerp gnus-summary-display-while-building))
5004 thread number subject stack state gnus-tmp-gathered beg-match
5005 new-roots gnus-tmp-new-adopts thread-end simp-subject
5006 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5007 gnus-tmp-replied gnus-tmp-subject-or-nil
5008 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5009 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5010 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5013 (setq gnus-tmp-prev-subject nil
5014 gnus-tmp-thread-tree-header-string "")
5016 (if (vectorp (car threads))
5017 ;; If this is a straight (sic) list of headers, then a
5018 ;; threaded summary display isn't required, so we just create
5019 ;; an unthreaded one.
5020 (gnus-summary-prepare-unthreaded threads)
5022 ;; Do the threaded display.
5024 (if gnus-summary-display-while-building
5025 (switch-to-buffer (buffer-name)))
5026 (while (or threads stack gnus-tmp-new-adopts new-roots)
5028 (if (and (= gnus-tmp-level 0)
5031 (not gnus-tmp-false-parent)
5032 (or gnus-tmp-new-adopts new-roots))
5033 (if gnus-tmp-new-adopts
5034 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5035 thread (list (car gnus-tmp-new-adopts))
5036 gnus-tmp-header (caar thread)
5037 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5039 (setq thread (list (car new-roots))
5040 gnus-tmp-header (caar thread)
5041 new-roots (cdr new-roots))))
5044 ;; If there are some threads, we do them before the
5045 ;; threads on the stack.
5046 (setq thread threads
5047 gnus-tmp-header (caar thread))
5048 ;; There were no current threads, so we pop something off
5050 (setq state (car stack)
5051 gnus-tmp-level (car state)
5052 tree-stack (cadr state)
5053 thread (caddr state)
5055 gnus-tmp-header (caar thread))))
5057 (setq gnus-tmp-false-parent nil)
5058 (setq gnus-tmp-root-expunged nil)
5059 (setq thread-end nil)
5061 (if (stringp gnus-tmp-header)
5062 ;; The header is a dummy root.
5064 ((eq gnus-summary-make-false-root 'adopt)
5065 ;; We let the first article adopt the rest.
5066 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5068 (setq gnus-tmp-gathered
5070 (lambda (h) (mail-header-number (car h)))
5073 (setq thread (cons (list (caar thread)
5076 (setq gnus-tmp-level -1
5077 gnus-tmp-false-parent t))
5078 ((eq gnus-summary-make-false-root 'empty)
5079 ;; We print adopted articles with empty subject fields.
5080 (setq gnus-tmp-gathered
5082 (lambda (h) (mail-header-number (car h)))
5085 (setq gnus-tmp-level -1))
5086 ((eq gnus-summary-make-false-root 'dummy)
5087 ;; We remember that we probably want to output a dummy
5089 (setq gnus-tmp-dummy-line gnus-tmp-header)
5090 (setq gnus-tmp-prev-subject gnus-tmp-header))
5092 ;; We do not make a root for the gathered
5093 ;; sub-threads at all.
5094 (setq gnus-tmp-level -1)))
5096 (setq number (mail-header-number gnus-tmp-header)
5097 subject (mail-header-subject gnus-tmp-header)
5098 simp-subject (gnus-simplify-subject-fully subject))
5101 ;; If the thread has changed subject, we might want to make
5102 ;; this subthread into a root.
5103 ((and (null gnus-thread-ignore-subject)
5104 (not (zerop gnus-tmp-level))
5105 gnus-tmp-prev-subject
5106 (not (string= gnus-tmp-prev-subject simp-subject)))
5107 (setq new-roots (nconc new-roots (list (car thread)))
5109 gnus-tmp-header nil))
5110 ;; If the article lies outside the current limit,
5111 ;; then we do not display it.
5112 ((not (memq number gnus-newsgroup-limit))
5113 (setq gnus-tmp-gathered
5115 (lambda (h) (mail-header-number (car h)))
5118 (setq gnus-tmp-new-adopts (if (cdar thread)
5119 (append gnus-tmp-new-adopts
5121 gnus-tmp-new-adopts)
5123 gnus-tmp-header nil)
5124 (when (zerop gnus-tmp-level)
5125 (setq gnus-tmp-root-expunged t)))
5126 ;; Perhaps this article is to be marked as read?
5127 ((and gnus-summary-mark-below
5128 (< (or (cdr (assq number gnus-newsgroup-scored))
5130 gnus-summary-mark-below)
5131 ;; Don't touch sparse articles.
5132 (not (gnus-summary-article-sparse-p number))
5133 (not (gnus-summary-article-ancient-p number)))
5134 (setq gnus-newsgroup-unreads
5135 (delq number gnus-newsgroup-unreads))
5136 (if gnus-newsgroup-auto-expire
5137 (setq gnus-newsgroup-expirable
5138 (gnus-add-to-sorted-list
5139 gnus-newsgroup-expirable number))
5140 (push (cons number gnus-low-score-mark)
5141 gnus-newsgroup-reads))))
5143 (when gnus-tmp-header
5144 ;; We may have an old dummy line to output before this
5146 (when (and gnus-tmp-dummy-line
5149 (mail-header-subject gnus-tmp-header)))
5150 (gnus-summary-insert-dummy-line
5151 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5152 (setq gnus-tmp-dummy-line nil))
5154 ;; Compute the mark.
5155 (setq gnus-tmp-unread (gnus-article-mark number))
5157 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5158 gnus-tmp-header gnus-tmp-level)
5159 gnus-newsgroup-data)
5161 ;; Actually insert the line.
5163 gnus-tmp-subject-or-nil
5165 ((and gnus-thread-ignore-subject
5166 gnus-tmp-prev-subject
5167 (not (string= gnus-tmp-prev-subject simp-subject)))
5169 ((zerop gnus-tmp-level)
5170 (if (and (eq gnus-summary-make-false-root 'empty)
5171 (memq number gnus-tmp-gathered)
5172 gnus-tmp-prev-subject
5173 (string= gnus-tmp-prev-subject simp-subject))
5174 gnus-summary-same-subject
5176 (t gnus-summary-same-subject)))
5177 (if (and (eq gnus-summary-make-false-root 'adopt)
5178 (= gnus-tmp-level 1)
5179 (memq number gnus-tmp-gathered))
5180 (setq gnus-tmp-opening-bracket ?\<
5181 gnus-tmp-closing-bracket ?\>)
5182 (setq gnus-tmp-opening-bracket ?\[
5183 gnus-tmp-closing-bracket ?\]))
5184 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5185 (gnus-make-thread-indent-array
5186 (max (* 2 (length gnus-thread-indent-array))
5189 gnus-tmp-indentation
5190 (aref gnus-thread-indent-array gnus-tmp-level)
5191 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5192 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5193 gnus-summary-default-score 0)
5195 (if (or (null gnus-summary-default-score)
5196 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5197 gnus-summary-zcore-fuzz))
5199 (if (< gnus-tmp-score gnus-summary-default-score)
5200 gnus-score-below-mark gnus-score-over-mark))
5202 (cond ((memq number gnus-newsgroup-processable)
5204 ((memq number gnus-newsgroup-cached)
5206 ((memq number gnus-newsgroup-replied)
5208 ((memq number gnus-newsgroup-forwarded)
5209 gnus-forwarded-mark)
5210 ((memq number gnus-newsgroup-saved)
5212 ((memq number gnus-newsgroup-recent)
5214 ((memq number gnus-newsgroup-unseen)
5218 (cond ((memq number gnus-newsgroup-undownloaded)
5219 gnus-undownloaded-mark)
5220 (gnus-newsgroup-agentized
5221 gnus-downloaded-mark)
5224 gnus-tmp-from (mail-header-from gnus-tmp-header)
5227 ((string-match "<[^>]+> *$" gnus-tmp-from)
5228 (setq beg-match (match-beginning 0))
5229 (or (and (string-match "^\".+\"" gnus-tmp-from)
5230 (substring gnus-tmp-from 1 (1- (match-end 0))))
5231 (substring gnus-tmp-from 0 beg-match)))
5232 ((string-match "(.+)" gnus-tmp-from)
5233 (substring gnus-tmp-from
5234 (1+ (match-beginning 0)) (1- (match-end 0))))
5238 gnus-tmp-thread-tree-header-string
5240 ((not gnus-show-threads) "")
5241 ((zerop gnus-tmp-level)
5242 (cond ((cdar thread)
5243 (or gnus-sum-thread-tree-root subject))
5244 (gnus-tmp-new-adopts
5245 (or gnus-sum-thread-tree-false-root subject))
5247 (or gnus-sum-thread-tree-single-indent subject))))
5249 (concat (apply 'concat
5250 (mapcar (lambda (item)
5252 gnus-sum-thread-tree-vertical
5253 gnus-sum-thread-tree-indent))
5254 (cdr (reverse tree-stack))))
5256 gnus-sum-thread-tree-leaf-with-other
5257 gnus-sum-thread-tree-single-leaf)))))
5258 (when (string= gnus-tmp-name "")
5259 (setq gnus-tmp-name gnus-tmp-from))
5260 (unless (numberp gnus-tmp-lines)
5261 (setq gnus-tmp-lines -1))
5262 (if (= gnus-tmp-lines -1)
5263 (setq gnus-tmp-lines "?")
5264 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5265 (gnus-put-text-property
5267 (progn (eval gnus-summary-line-format-spec) (point))
5268 'gnus-number number)
5271 (gnus-run-hooks 'gnus-summary-update-hook)
5274 (setq gnus-tmp-prev-subject simp-subject)))
5276 (when (nth 1 thread)
5277 (push (list (max 0 gnus-tmp-level)
5278 (copy-sequence tree-stack)
5281 (push (if (nth 1 thread) 1 0) tree-stack)
5282 (incf gnus-tmp-level)
5283 (setq threads (if thread-end nil (cdar thread)))
5284 (if gnus-summary-display-while-building
5287 ;; use a set frequency
5288 (setq building-line-count (1- building-line-count))
5289 (when (= building-line-count 0)
5291 (setq building-line-count
5292 gnus-summary-display-while-building)))
5296 (setq gnus-tmp-level 0)))))
5297 (gnus-message 7 "Generating summary...done"))
5299 (defun gnus-summary-prepare-unthreaded (headers)
5300 "Generate an unthreaded summary buffer based on HEADERS."
5301 (let (header number mark)
5306 ;; We may have to root out some bad articles...
5307 (when (memq (setq number (mail-header-number
5308 (setq header (pop headers))))
5309 gnus-newsgroup-limit)
5310 ;; Mark article as read when it has a low score.
5311 (when (and gnus-summary-mark-below
5312 (< (or (cdr (assq number gnus-newsgroup-scored))
5313 gnus-summary-default-score 0)
5314 gnus-summary-mark-below)
5315 (not (gnus-summary-article-ancient-p number)))
5316 (setq gnus-newsgroup-unreads
5317 (delq number gnus-newsgroup-unreads))
5318 (if gnus-newsgroup-auto-expire
5319 (push number gnus-newsgroup-expirable)
5320 (push (cons number gnus-low-score-mark)
5321 gnus-newsgroup-reads)))
5323 (setq mark (gnus-article-mark number))
5324 (push (gnus-data-make number mark (1+ (point)) header 0)
5325 gnus-newsgroup-data)
5326 (gnus-summary-insert-line
5328 (memq number gnus-newsgroup-undownloaded)
5329 mark (memq number gnus-newsgroup-replied)
5330 (memq number gnus-newsgroup-expirable)
5331 (mail-header-subject header) nil
5332 (cdr (assq number gnus-newsgroup-scored))
5333 (memq number gnus-newsgroup-processable))))))
5335 (defun gnus-summary-remove-list-identifiers ()
5336 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5337 (let ((regexp (if (consp gnus-list-identifiers)
5338 (mapconcat 'identity gnus-list-identifiers " *\\|")
5339 gnus-list-identifiers))
5342 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5343 (dolist (header gnus-newsgroup-headers)
5344 (setq subject (mail-header-subject header)
5346 (while (string-match regexp subject)
5348 (concat (substring subject 0 (match-beginning 1))
5349 (substring subject (match-end 0)))
5352 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5354 (concat (substring subject 0 (match-beginning 1))
5355 (substring subject (match-end 1)))))
5356 (mail-header-set-subject header subject))))))
5358 (defun gnus-fetch-headers (articles)
5359 "Fetch headers of ARTICLES."
5360 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5361 (gnus-message 5 "Fetching headers for %s..." name)
5364 (setq gnus-headers-retrieved-by
5365 (gnus-retrieve-headers
5366 articles gnus-newsgroup-name
5367 ;; We might want to fetch old headers, but
5368 ;; not if there is only 1 article.
5370 (not (eq gnus-fetch-old-headers 'some))
5371 (not (numberp gnus-fetch-old-headers)))
5372 (> (length articles) 1))
5373 gnus-fetch-old-headers))))
5374 (gnus-get-newsgroup-headers-xover
5375 articles nil nil gnus-newsgroup-name t)
5376 (gnus-get-newsgroup-headers))
5377 (gnus-message 5 "Fetching headers for %s...done" name))))
5379 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5380 "Select newsgroup GROUP.
5381 If READ-ALL is non-nil, all articles in the group are selected.
5382 If SELECT-ARTICLES, only select those articles from GROUP."
5383 (let* ((entry (gnus-group-entry group))
5384 ;;!!! Dirty hack; should be removed.
5385 (gnus-summary-ignore-duplicates
5386 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5388 gnus-summary-ignore-duplicates))
5389 (info (nth 2 entry))
5390 articles fetched-articles cached)
5392 (unless (gnus-check-server
5393 (set (make-local-variable 'gnus-current-select-method)
5394 (gnus-find-method-for-group group)))
5395 (error "Couldn't open server"))
5397 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5398 (gnus-activate-group group) ; Or we can activate it...
5399 (progn ; Or we bug out.
5400 (when (equal major-mode 'gnus-summary-mode)
5401 (gnus-kill-buffer (current-buffer)))
5402 (error "Couldn't activate group %s: %s"
5403 (gnus-group-decoded-name group) (gnus-status-message group))))
5405 (unless (gnus-request-group group t)
5406 (when (equal major-mode 'gnus-summary-mode)
5407 (gnus-kill-buffer (current-buffer)))
5408 (error "Couldn't request group %s: %s"
5409 (gnus-group-decoded-name group) (gnus-status-message group)))
5412 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5414 (setq gnus-summary-use-undownloaded-faces
5415 (gnus-agent-find-parameter
5417 'agent-enable-undownloaded-faces)))
5419 (setq gnus-newsgroup-name group
5420 gnus-newsgroup-unselected nil
5421 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5423 (let ((display (gnus-group-find-parameter group 'display)))
5424 (setq gnus-newsgroup-display
5426 ((not (zerop (or (car-safe read-all) 0)))
5427 ;; The user entered the group with C-u SPC/RET, let's show
5433 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5435 ;; The following is probably the "correct" solution, but
5436 ;; it makes Gnus fetch all headers and then limit the
5437 ;; articles (which is slow), so instead we hack the
5438 ;; select-articles parameter instead. -- Simon Josefsson
5441 ;; (gnus-byte-compile
5442 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5444 (setq select-articles
5445 (gnus-uncompress-range
5446 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5450 (cdr (gnus-active group)))))
5455 (gnus-summary-setup-default-charset)
5457 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5458 (when (gnus-virtual-group-p group)
5459 (setq cached gnus-newsgroup-cached))
5461 (setq gnus-newsgroup-unreads
5462 (gnus-sorted-ndifference
5463 (gnus-sorted-ndifference gnus-newsgroup-unreads
5464 gnus-newsgroup-marked)
5465 gnus-newsgroup-dormant))
5467 (setq gnus-newsgroup-processable nil)
5469 (gnus-update-read-articles group gnus-newsgroup-unreads)
5471 ;; Adjust and set lists of article marks.
5473 (gnus-adjust-marked-articles info))
5474 (if (setq articles select-articles)
5475 (setq gnus-newsgroup-unselected
5476 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5477 (setq articles (gnus-articles-to-read group read-all)))
5481 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5483 ((eq articles 0) nil)
5485 ;; Init the dependencies hash table.
5486 (setq gnus-newsgroup-dependencies
5487 (gnus-make-hashtable (length articles)))
5488 (gnus-set-global-variables)
5489 ;; Retrieve the headers and read them in.
5491 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5493 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5495 (setq gnus-newsgroup-cached cached))
5497 ;; Suppress duplicates?
5498 (when gnus-suppress-duplicates
5499 (gnus-dup-suppress-articles))
5501 ;; Set the initial limit.
5502 (setq gnus-newsgroup-limit (copy-sequence articles))
5503 ;; Remove canceled articles from the list of unread articles.
5504 (setq fetched-articles
5505 (mapcar (lambda (headers) (mail-header-number headers))
5506 gnus-newsgroup-headers))
5507 (setq gnus-newsgroup-articles fetched-articles)
5508 (setq gnus-newsgroup-unreads
5509 (gnus-sorted-nintersection
5510 gnus-newsgroup-unreads fetched-articles))
5511 (gnus-compute-unseen-list)
5513 ;; Removed marked articles that do not exist.
5514 (gnus-update-missing-marks
5515 (gnus-sorted-difference articles fetched-articles))
5516 ;; We might want to build some more threads first.
5517 (when (and gnus-fetch-old-headers
5518 (eq gnus-headers-retrieved-by 'nov))
5519 (if (eq gnus-fetch-old-headers 'invisible)
5520 (gnus-build-all-threads)
5521 (gnus-build-old-threads)))
5522 ;; Let the Gnus agent mark articles as read.
5524 (gnus-agent-get-undownloaded-list))
5525 ;; Remove list identifiers from subject
5526 (when gnus-list-identifiers
5527 (gnus-summary-remove-list-identifiers))
5528 ;; Check whether auto-expire is to be done in this group.
5529 (setq gnus-newsgroup-auto-expire
5530 (gnus-group-auto-expirable-p group))
5531 ;; Set up the article buffer now, if necessary.
5532 (unless (and gnus-single-article-buffer
5533 (equal gnus-article-buffer "*Article*"))
5534 (gnus-article-setup-buffer))
5535 ;; First and last article in this newsgroup.
5536 (when gnus-newsgroup-headers
5537 (setq gnus-newsgroup-begin
5538 (mail-header-number (car gnus-newsgroup-headers))
5541 (gnus-last-element gnus-newsgroup-headers))))
5542 ;; GROUP is successfully selected.
5543 (or gnus-newsgroup-headers t)))))
5545 (defun gnus-compute-unseen-list ()
5546 ;; The `seen' marks are treated specially.
5547 (if (not gnus-newsgroup-seen)
5548 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5549 (setq gnus-newsgroup-unseen
5550 (gnus-inverse-list-range-intersection
5551 gnus-newsgroup-articles gnus-newsgroup-seen))))
5553 (defun gnus-summary-display-make-predicate (display)
5554 (require 'gnus-agent)
5555 (when (= (length display) 1)
5556 (setq display (car display)))
5557 (unless gnus-summary-display-cache
5558 (dolist (elem (append '((unread . unread)
5561 gnus-article-mark-lists))
5562 (push (cons (cdr elem)
5564 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5565 gnus-summary-display-cache)))
5566 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5567 (gnus-category-predicate-cache gnus-summary-display-cache))
5568 (gnus-get-predicate display)))
5570 ;; Uses the dynamically bound `number' variable.
5573 (defun gnus-article-marked-p (type &optional article)
5574 (let ((article (or article number)))
5577 (memq article gnus-newsgroup-marked))
5579 (memq article gnus-newsgroup-spam-marked))
5581 (memq article gnus-newsgroup-unsendable))
5582 ((eq type 'undownload)
5583 (memq article gnus-newsgroup-undownloaded))
5584 ((eq type 'download)
5585 (memq article gnus-newsgroup-downloadable))
5587 (memq article gnus-newsgroup-unreads))
5589 (memq article gnus-newsgroup-reads))
5591 (memq article gnus-newsgroup-dormant) )
5593 (memq article gnus-newsgroup-expirable))
5595 (memq article gnus-newsgroup-replied))
5597 (memq article gnus-newsgroup-killed))
5598 ((eq type 'bookmark)
5599 (assq article gnus-newsgroup-bookmarks))
5601 (assq article gnus-newsgroup-scored))
5603 (memq article gnus-newsgroup-saved))
5605 (memq article gnus-newsgroup-cached))
5607 (memq article gnus-newsgroup-forwarded))
5609 (not (memq article gnus-newsgroup-unseen)))
5611 (memq article gnus-newsgroup-recent))
5614 (defun gnus-articles-to-read (group &optional read-all)
5615 "Find out what articles the user wants to read."
5617 ;; Select all articles if `read-all' is non-nil, or if there
5618 ;; are no unread articles.
5620 (and (zerop (length gnus-newsgroup-marked))
5621 (zerop (length gnus-newsgroup-unreads)))
5622 ;; Fetch all if the predicate is non-nil.
5623 gnus-newsgroup-display)
5624 ;; We want to select the headers for all the articles in
5625 ;; the group, so we select either all the active
5626 ;; articles in the group, or (if that's nil), the
5627 ;; articles in the cache.
5629 (gnus-uncompress-range (gnus-active group))
5630 (gnus-cache-articles-in-group group))
5631 ;; Select only the "normal" subset of articles.
5633 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5634 gnus-newsgroup-unreads)))
5635 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5636 (scored (length scored-list))
5637 (number (length articles))
5638 (marked (+ (length gnus-newsgroup-marked)
5639 (length gnus-newsgroup-dormant)))
5644 ((numberp gnus-newsgroup-display)
5645 gnus-newsgroup-display)
5649 ((and (or (<= scored marked) (= scored number))
5650 (numberp gnus-large-newsgroup)
5651 (> number gnus-large-newsgroup))
5652 (let* ((cursor-in-echo-area nil)
5653 (initial (gnus-parameter-large-newsgroup-initial
5654 gnus-newsgroup-name))
5658 "How many articles from %s (%s %d): "
5660 (gnus-group-decoded-name gnus-newsgroup-name)
5662 (if initial "max" "default")
5665 (cons (number-to-string initial)
5667 (if (string-match "^[ \t]*$" input) number input)))
5668 ((and (> scored marked) (< scored number)
5669 (> (- scored number) 20))
5672 (format "%s %s (%d scored, %d total): "
5673 "How many articles from"
5674 (gnus-group-decoded-name group)
5676 (if (string-match "^[ \t]*$" input)
5680 (message "Quit getting the articles to read")
5682 (setq select (if (stringp select) (string-to-number select) select))
5683 (if (or (null select) (zerop select))
5685 (if (and (not (zerop scored)) (<= (abs select) scored))
5687 (setq articles (sort scored-list '<))
5688 (setq number (length articles)))
5689 (setq articles (copy-sequence articles)))
5691 (when (< (abs select) number)
5693 ;; Select the N oldest articles.
5694 (setcdr (nthcdr (1- (abs select)) articles) nil)
5695 ;; Select the N most recent articles.
5696 (setq articles (nthcdr (- number select) articles))))
5697 (setq gnus-newsgroup-unselected
5698 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5699 (when gnus-alter-articles-to-read-function
5702 (funcall gnus-alter-articles-to-read-function
5703 gnus-newsgroup-name articles)
5707 (defun gnus-killed-articles (killed articles)
5710 (when (inline (gnus-member-of-range (car articles) killed))
5711 (push (car articles) out))
5712 (setq articles (cdr articles)))
5715 (defun gnus-uncompress-marks (marks)
5716 "Uncompress the mark ranges in MARKS."
5717 (let ((uncompressed '(score bookmark))
5720 (if (memq (caar marks) uncompressed)
5721 (push (car marks) out)
5722 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5723 (setq marks (cdr marks)))
5726 (defun gnus-article-mark-to-type (mark)
5727 "Return the type of MARK."
5728 (or (cadr (assq mark gnus-article-special-mark-lists))
5731 (defun gnus-article-unpropagatable-p (mark)
5732 "Return whether MARK should be propagated to back end."
5733 (memq mark gnus-article-unpropagated-mark-lists))
5735 (defun gnus-adjust-marked-articles (info)
5736 "Set all article lists and remove all marks that are no longer valid."
5737 (let* ((marked-lists (gnus-info-marks info))
5738 (active (gnus-active (gnus-info-group info)))
5741 (types gnus-article-mark-lists)
5742 marks var articles article mark mark-type
5745 (dolist (marks marked-lists)
5746 (setq mark (car marks)
5747 mark-type (gnus-article-mark-to-type mark)
5748 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5750 ;; We set the variable according to the type of the marks list,
5751 ;; and then adjust the marks to a subset of the active articles.
5753 ;; Adjust "simple" lists - compressed yet unsorted
5754 ((eq mark-type 'list)
5755 ;; Simultaneously uncompress and clip to active range
5756 ;; See gnus-uncompress-range for a description of possible marks
5758 (if (not (cadr marks))
5760 (setq articles (if (numberp (cddr marks))
5766 (while (setq article (pop articles))
5767 (cond ((consp article)
5768 (setq bgn (max (car article) min)
5769 end (min (cdr article) max))
5771 (setq l (setcdr l (cons bgn nil))
5773 ((and (<= min article)
5775 (setq l (setcdr l (cons article nil))))))
5776 (set var (cdr lh)))))
5778 ((eq mark-type 'tuple)
5779 (set var (setq articles (cdr marks)))
5780 (when (not (listp (cdr (symbol-value var))))
5781 (set var (list (symbol-value var))))
5782 (when (not (listp (cdr articles)))
5783 (setq articles (list articles)))
5785 (when (or (not (consp (setq article (pop articles))))
5786 (< (car article) min)
5787 (> (car article) max))
5788 (set var (delq article (symbol-value var))))))
5789 ;; Adjust ranges (sloppily).
5790 ((eq mark-type 'range)
5793 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5794 ;; It should be (seen (NUM1 . NUM2)).
5795 (when (numberp (cddr marks))
5796 (setcdr marks (list (cdr marks))))
5797 (setq articles (cdr marks))
5798 (while (and articles
5799 (or (and (consp (car articles))
5800 (> min (cdar articles)))
5801 (and (numberp (car articles))
5802 (> min (car articles)))))
5804 (set var articles))))))))
5806 (defun gnus-update-missing-marks (missing)
5807 "Go through the list of MISSING articles and remove them from the mark lists."
5810 ;; Go through all types.
5811 (dolist (elem gnus-article-mark-lists)
5812 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5813 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5814 (when (symbol-value var)
5815 ;; This list has articles. So we delete all missing
5816 ;; articles from it.
5819 (set var (delq (pop m) (symbol-value var))))))))))
5821 (defun gnus-update-marks ()
5822 "Enter the various lists of marked articles into the newsgroup info list."
5823 (let ((types gnus-article-mark-lists)
5824 (info (gnus-get-info gnus-newsgroup-name))
5825 type list newmarked symbol delta-marks)
5827 ;; Add all marks lists to the list of marks lists.
5828 (while (setq type (pop types))
5829 (setq list (symbol-value
5831 (intern (format "gnus-newsgroup-%s" (car type))))))
5834 ;; Get rid of the entries of the articles that have the
5836 (when (and (eq (cdr type) 'score)
5840 (prev (cons nil list))
5843 (if (or (not (consp (car arts)))
5844 (= (cdar arts) gnus-summary-default-score))
5845 (setcdr prev (cdr arts))
5847 (setq arts (cdr arts)))
5848 (setq list (cdr all)))))
5850 (when (eq (cdr type) 'seen)
5851 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5853 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5854 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5856 (when (and (gnus-check-backend-function
5857 'request-set-mark gnus-newsgroup-name)
5858 (not (gnus-article-unpropagatable-p (cdr type))))
5859 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5860 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5861 (add (gnus-remove-from-range
5862 (gnus-copy-sequence list) old)))
5864 (push (list add 'add (list (cdr type))) delta-marks))
5866 (push (list del 'del (list (cdr type))) delta-marks))))
5869 (push (cons (cdr type) list) newmarked)))
5872 (unless (gnus-check-group gnus-newsgroup-name)
5873 (error "Can't open server for %s" gnus-newsgroup-name))
5874 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5876 ;; Enter these new marks into the info of the group.
5878 (setcar (nthcdr 3 info) newmarked)
5879 ;; Add the marks lists to the end of the info.
5881 (setcdr (nthcdr 2 info) (list newmarked))))
5883 ;; Cut off the end of the info if there's nothing else there.
5887 (when (nthcdr (decf i) info)
5888 (setcdr (nthcdr i info) nil)))))))
5890 (defun gnus-set-mode-line (where)
5891 "Set the mode line of the article or summary buffers.
5892 If WHERE is `summary', the summary mode line format will be used."
5893 ;; Is this mode line one we keep updated?
5894 (when (and (memq where gnus-updated-mode-lines)
5896 (intern (format "gnus-%s-mode-line-format-spec" where))))
5899 ;; We evaluate this in the summary buffer since these
5900 ;; variables are buffer-local to that buffer.
5901 (set-buffer gnus-summary-buffer)
5902 ;; We bind all these variables that are used in the `eval' form
5904 (let* ((mformat (symbol-value
5906 (format "gnus-%s-mode-line-format-spec" where))))
5907 (gnus-tmp-group-name (gnus-mode-string-quote
5908 (gnus-group-decoded-name
5909 gnus-newsgroup-name)))
5910 (gnus-tmp-article-number (or gnus-current-article 0))
5911 (gnus-tmp-unread gnus-newsgroup-unreads)
5912 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5913 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5914 (gnus-tmp-unread-and-unselected
5915 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5916 (zerop gnus-tmp-unselected))
5918 ((zerop gnus-tmp-unselected)
5919 (format "{%d more}" gnus-tmp-unread-and-unticked))
5920 (t (format "{%d(+%d) more}"
5921 gnus-tmp-unread-and-unticked
5922 gnus-tmp-unselected))))
5924 (if (and gnus-current-headers
5925 (vectorp gnus-current-headers))
5926 (gnus-mode-string-quote
5927 (mail-header-subject gnus-current-headers))
5929 bufname-length max-len
5930 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5931 (setq mode-string (eval mformat))
5932 (setq bufname-length (if (string-match "%b" mode-string)
5935 (if (eq where 'summary)
5937 (get-buffer gnus-article-buffer))))
5940 (setq max-len (max 4 (if gnus-mode-non-string-length
5942 gnus-mode-non-string-length
5944 (length mode-string))))
5945 ;; We might have to chop a bit of the string off...
5946 (when (> (length mode-string) max-len)
5948 (concat (truncate-string-to-width mode-string (- max-len 3))
5950 ;; Pad the mode string a bit.
5951 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5952 ;; Update the mode line.
5953 (setq mode-line-buffer-identification
5954 (gnus-mode-line-buffer-identification (list mode-string)))
5955 (set-buffer-modified-p t))))
5957 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5958 "Go through the HEADERS list and add all Xrefs to a hash table.
5959 The resulting hash table is returned, or nil if no Xrefs were found."
5960 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5961 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5962 (xref-hashtb (gnus-make-hashtable))
5963 start group entry number xrefs header)
5965 (setq header (pop headers))
5966 (when (and (setq xrefs (mail-header-xref header))
5967 (not (memq (setq number (mail-header-number header))
5970 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5971 (setq start (match-end 0))
5972 (setq group (if prefix
5973 (concat prefix (substring xrefs (match-beginning 1)
5975 (substring xrefs (match-beginning 1) (match-end 1))))
5977 (string-to-number (substring xrefs (match-beginning 2)
5979 (if (setq entry (gnus-gethash group xref-hashtb))
5980 (setcdr entry (cons number (cdr entry)))
5981 (gnus-sethash group (cons number nil) xref-hashtb)))))
5982 (and start xref-hashtb)))
5984 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5985 "Look through all the headers and mark the Xrefs as read."
5986 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5987 name info xref-hashtb idlist method nth4)
5989 (set-buffer gnus-group-buffer)
5990 (when (setq xref-hashtb
5991 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5994 (unless (string= from-newsgroup (setq name (symbol-name group)))
5995 (setq idlist (symbol-value group))
5996 ;; Dead groups are not updated.
5998 (setq info (gnus-get-info name))
5999 (when (stringp (setq nth4 (gnus-info-method info)))
6000 (setq nth4 (gnus-server-to-method nth4))))
6001 ;; Only do the xrefs if the group has the same
6002 ;; select method as the group we have just read.
6003 (or (gnus-methods-equal-p
6004 nth4 (gnus-find-method-for-group from-newsgroup))
6006 (equal nth4 (setq method (gnus-find-method-for-group
6008 (and (equal (car nth4) (car method))
6009 (equal (nth 1 nth4) (nth 1 method))))
6010 gnus-use-cross-reference
6011 (or (not (eq gnus-use-cross-reference t))
6013 ;; Only do cross-references on subscribed
6014 ;; groups, if that is what is wanted.
6015 (<= (gnus-info-level info) gnus-level-subscribed))
6016 (gnus-group-make-articles-read name idlist))))
6019 (defun gnus-compute-read-articles (group articles)
6020 (let* ((entry (gnus-group-entry group))
6021 (info (nth 2 entry))
6022 (active (gnus-active group))
6025 ;; First peel off all invalid article numbers.
6027 (let ((ids articles)
6029 (while (setq id (pop ids))
6030 (when (and first (> id (cdr active)))
6031 ;; We'll end up in this situation in one particular
6032 ;; obscure situation. If you re-scan a group and get
6033 ;; a new article that is cross-posted to a different
6034 ;; group that has not been re-scanned, you might get
6035 ;; crossposted article that has a higher number than
6036 ;; Gnus believes possible. So we re-activate this
6037 ;; group as well. This might mean doing the
6038 ;; crossposting thingy will *increase* the number
6039 ;; of articles in some groups. Tsk, tsk.
6040 (setq active (or (gnus-activate-group group) active)))
6041 (when (or (> id (cdr active))
6042 (< id (car active)))
6043 (setq articles (delq id articles))))))
6044 ;; If the read list is nil, we init it.
6046 (null (gnus-info-read info))
6048 (setq ninfo (cons 1 (1- (car active))))
6049 (setq ninfo (gnus-info-read info)))
6050 ;; Then we add the read articles to the range.
6052 ninfo (setq articles (sort articles '<))))))
6054 (defun gnus-group-make-articles-read (group articles)
6055 "Update the info of GROUP to say that ARTICLES are read."
6057 (entry (gnus-group-entry group))
6058 (info (nth 2 entry))
6059 (active (gnus-active group))
6062 (setq range (gnus-compute-read-articles group articles))
6063 (with-current-buffer gnus-group-buffer
6066 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6067 (gnus-info-set-read ',info ',(gnus-info-read info))
6068 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6069 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6070 (gnus-group-update-group ,group t))))
6071 ;; Add the read articles to the range.
6072 (gnus-info-set-read info range)
6073 (gnus-request-set-mark group (list (list range 'add '(read))))
6074 ;; Then we have to re-compute how many unread
6075 ;; articles there are in this group.
6079 (setq num (- (1+ (cdr active)) (car active))))
6080 ((not (listp (cdr range)))
6081 (setq num (- (cdr active) (- (1+ (cdr range))
6085 (if (numberp (car range))
6087 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6088 (setq range (cdr range)))
6089 (setq num (- (cdr active) num))))
6090 ;; Update the number of unread articles.
6092 ;; Update the group buffer.
6093 (unless (gnus-ephemeral-group-p group)
6094 (gnus-group-update-group group t))))))
6096 (defvar gnus-newsgroup-none-id 0)
6098 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6099 (let ((cur nntp-server-buffer)
6102 (with-current-buffer gnus-summary-buffer
6103 gnus-newsgroup-dependencies)))
6104 headers id end ref number
6105 (mail-parse-charset gnus-newsgroup-charset)
6106 (mail-parse-ignored-charsets
6107 (save-excursion (condition-case nil
6108 (set-buffer gnus-summary-buffer)
6110 gnus-newsgroup-ignored-charsets)))
6112 (set-buffer nntp-server-buffer)
6113 ;; Translate all TAB characters into SPACE characters.
6114 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6115 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6116 (ietf-drums-unfold-fws)
6117 (gnus-run-hooks 'gnus-parse-headers-hook)
6118 (let ((case-fold-search t)
6119 in-reply-to header p lines chars)
6120 (goto-char (point-min))
6121 ;; Search to the beginning of the next header. Error messages
6122 ;; do not begin with 2 or 3.
6123 (while (re-search-forward "^[23][0-9]+ " nil t)
6126 ;; This implementation of this function, with nine
6127 ;; search-forwards instead of the one re-search-forward and
6128 ;; a case (which basically was the old function) is actually
6129 ;; about twice as fast, even though it looks messier. You
6130 ;; can't have everything, I guess. Speed and elegance
6131 ;; doesn't always go hand in hand.
6137 (setq number (read cur))
6140 (narrow-to-region (point)
6141 (or (and (search-forward "\n.\n" nil t)
6147 (if (search-forward "\nsubject:" nil t)
6148 (funcall gnus-decode-encoded-word-function
6149 (nnheader-header-value))
6154 (if (search-forward "\nfrom:" nil t)
6155 (funcall gnus-decode-encoded-address-function
6156 (nnheader-header-value))
6161 (if (search-forward "\ndate:" nil t)
6162 (nnheader-header-value) ""))
6166 (setq id (if (re-search-forward
6167 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6168 ;; We do it this way to make sure the Message-ID
6169 ;; is (somewhat) syntactically valid.
6170 (buffer-substring (match-beginning 1)
6172 ;; If there was no message-id, we just fake one
6173 ;; to make subsequent routines simpler.
6174 (nnheader-generate-fake-message-id number))))
6178 (if (search-forward "\nreferences:" nil t)
6182 (nnheader-header-value)
6187 (search-backward ">" end t)
6190 (search-backward "<" end t)
6192 ;; Get the references from the in-reply-to header if there
6193 ;; were no references and the in-reply-to header looks
6195 (if (and (search-forward "\nin-reply-to:" nil t)
6196 (setq in-reply-to (nnheader-header-value))
6197 (string-match "<[^>]+>" in-reply-to))
6199 (setq ref (substring in-reply-to (match-beginning 0)
6201 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6202 (setq ref2 (substring in-reply-to (match-beginning 0)
6204 (when (> (length ref2) (length ref))
6211 (if (search-forward "\nchars: " nil t)
6212 (if (numberp (setq chars (ignore-errors (read cur))))
6218 (if (search-forward "\nlines: " nil t)
6219 (if (numberp (setq lines (ignore-errors (read cur))))
6225 (and (search-forward "\nxref:" nil t)
6226 (nnheader-header-value)))
6228 (when gnus-extra-headers
6229 (let ((extra gnus-extra-headers)
6233 (when (search-forward
6234 (concat "\n" (symbol-name (car extra)) ":") nil t)
6235 (push (cons (car extra) (nnheader-header-value))
6239 (when (equal id ref)
6242 (when gnus-alter-header-function
6243 (funcall gnus-alter-header-function header)
6244 (setq id (mail-header-id header)
6245 ref (gnus-parent-id (mail-header-references header))))
6248 (gnus-dependencies-add-header
6249 header dependencies force-new))
6250 (push header headers))
6251 (goto-char (point-max))
6253 (nreverse headers)))))
6255 ;; Goes through the xover lines and returns a list of vectors
6256 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6257 force-new dependencies
6258 group also-fetch-heads)
6259 "Parse the news overview data in the server buffer.
6260 Return a list of headers that match SEQUENCE (see
6261 `nntp-retrieve-headers')."
6262 ;; Get the Xref when the users reads the articles since most/some
6263 ;; NNTP servers do not include Xrefs when using XOVER.
6264 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6265 (let ((mail-parse-charset gnus-newsgroup-charset)
6266 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6267 (cur nntp-server-buffer)
6268 (dependencies (or dependencies gnus-newsgroup-dependencies))
6270 ((eq gnus-read-all-available-headers t)
6272 ((and (stringp gnus-read-all-available-headers)
6274 (string-match gnus-read-all-available-headers group))
6277 number headers header)
6279 (set-buffer nntp-server-buffer)
6280 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6281 ;; Allow the user to mangle the headers before parsing them.
6282 (gnus-run-hooks 'gnus-parse-headers-hook)
6283 (goto-char (point-min))
6284 (gnus-parse-without-error
6285 (while (and (or sequence allp)
6287 (setq number (read cur))
6289 (while (and sequence
6290 (< (car sequence) number))
6291 (setq sequence (cdr sequence))))
6294 (eq number (car sequence))))
6296 (setq sequence (cdr sequence))
6297 (setq header (inline
6298 (gnus-nov-parse-line
6299 number dependencies force-new)))))
6300 (push header headers))
6302 ;; A common bug in inn is that if you have posted an article and
6303 ;; then retrieves the active file, it will answer correctly --
6304 ;; the new article is included. However, a NOV entry for the
6305 ;; article may not have been generated yet, so this may fail.
6306 ;; We work around this problem by retrieving the last few
6307 ;; headers using HEAD.
6308 (if (or (not also-fetch-heads)
6310 ;; We (probably) got all the headers.
6312 (let ((gnus-nov-is-evil t))
6315 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6316 (gnus-get-newsgroup-headers))))))))
6318 (defun gnus-article-get-xrefs ()
6319 "Fill in the Xref value in `gnus-current-headers', if necessary.
6320 This is meant to be called in `gnus-article-internal-prepare-hook'."
6321 (let ((headers (with-current-buffer gnus-summary-buffer
6322 gnus-current-headers)))
6323 (or (not gnus-use-cross-reference)
6325 (and (mail-header-xref headers)
6326 (not (string= (mail-header-xref headers) "")))
6327 (let ((case-fold-search t)
6330 (nnheader-narrow-to-headers)
6331 (goto-char (point-min))
6332 (when (or (and (not (eobp))
6333 (eq (downcase (char-after)) ?x)
6334 (looking-at "Xref:"))
6335 (search-forward "\nXref:" nil t))
6336 (goto-char (1+ (match-end 0)))
6337 (setq xref (buffer-substring (point) (point-at-eol)))
6338 (mail-header-set-xref headers xref)))))))
6340 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6341 "Find article ID and insert the summary line for that article.
6342 OLD-HEADER can either be a header or a line number to insert
6343 the subject line on."
6344 (let* ((line (and (numberp old-header) old-header))
6345 (old-header (and (vectorp old-header) old-header))
6346 (header (cond ((and old-header use-old-header)
6349 (gnus-number-to-header id))
6350 (gnus-number-to-header id))
6352 (gnus-read-header id))))
6353 (number (and (numberp id) id))
6356 ;; Rebuild the thread that this article is part of and go to the
6357 ;; article we have fetched.
6358 (when (and (not gnus-show-threads)
6361 (setq d (gnus-data-find (mail-header-number old-header))))
6362 (goto-char (gnus-data-pos d))
6368 (gnus-delete-line))))))
6369 ;; Remove list identifiers from subject.
6370 (when gnus-list-identifiers
6371 (let ((gnus-newsgroup-headers (list header)))
6372 (gnus-summary-remove-list-identifiers)))
6374 (mail-header-set-number header (mail-header-number old-header)))
6375 (setq gnus-newsgroup-sparse
6376 (delq (setq number (mail-header-number header))
6377 gnus-newsgroup-sparse))
6378 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6379 (push number gnus-newsgroup-limit)
6380 (gnus-rebuild-thread (mail-header-id header) line)
6381 (gnus-summary-goto-subject number nil t))
6382 (when (and (numberp number)
6384 ;; We have to update the boundaries even if we can't fetch the
6385 ;; article if ID is a number -- so that the next `P' or `N'
6386 ;; command will fetch the previous (or next) article even
6387 ;; if the one we tried to fetch this time has been canceled.
6388 (when (> number gnus-newsgroup-end)
6389 (setq gnus-newsgroup-end number))
6390 (when (< number gnus-newsgroup-begin)
6391 (setq gnus-newsgroup-begin number))
6392 (setq gnus-newsgroup-unselected
6393 (delq number gnus-newsgroup-unselected)))
6394 ;; Report back a success?
6395 (and header (mail-header-number header))))
6397 ;;; Process/prefix in the summary buffer
6399 (defun gnus-summary-work-articles (n)
6400 "Return a list of articles to be worked upon.
6401 The prefix argument, the list of process marked articles, and the
6402 current article will be taken into consideration."
6404 (set-buffer gnus-summary-buffer)
6407 ;; A numerical prefix has been given.
6408 (setq n (prefix-numeric-value n))
6409 (let ((backward (< n 0))
6410 (n (abs (prefix-numeric-value n)))
6415 (push (setq article (gnus-summary-article-number))
6418 (gnus-summary-find-prev nil article)
6419 (gnus-summary-find-next nil article)))
6421 (nreverse articles)))
6422 ((and (gnus-region-active-p) (mark))
6423 (message "region active")
6424 ;; Work on the region between point and mark.
6425 (let ((max (max (point) (mark)))
6428 (goto-char (min (point) (mark)))
6431 (push (setq article (gnus-summary-article-number)) articles)
6432 (gnus-summary-find-next nil article)
6434 (nreverse articles))))
6435 (gnus-newsgroup-processable
6436 ;; There are process-marked articles present.
6437 ;; Save current state.
6438 (gnus-summary-save-process-mark)
6440 (reverse gnus-newsgroup-processable))
6442 ;; Just return the current article.
6443 (list (gnus-summary-article-number))))))
6445 (defmacro gnus-summary-iterate (arg &rest forms)
6446 "Iterate over the process/prefixed articles and do FORMS.
6447 ARG is the interactive prefix given to the command. FORMS will be
6448 executed with point over the summary line of the articles."
6449 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6450 `(let ((,articles (gnus-summary-work-articles ,arg)))
6452 (gnus-summary-goto-subject (car ,articles))
6456 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6457 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6459 (defun gnus-summary-save-process-mark ()
6460 "Push the current set of process marked articles on the stack."
6462 (push (copy-sequence gnus-newsgroup-processable)
6463 gnus-newsgroup-process-stack))
6465 (defun gnus-summary-kill-process-mark ()
6466 "Push the current set of process marked articles on the stack and unmark."
6468 (gnus-summary-save-process-mark)
6469 (gnus-summary-unmark-all-processable))
6471 (defun gnus-summary-yank-process-mark ()
6472 "Pop the last process mark state off the stack and restore it."
6474 (unless gnus-newsgroup-process-stack
6475 (error "Empty mark stack"))
6476 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6478 (defun gnus-summary-process-mark-set (set)
6479 "Make SET into the current process marked articles."
6480 (gnus-summary-unmark-all-processable)
6481 (mapc 'gnus-summary-set-process-mark set))
6483 ;;; Searching and stuff
6485 (defun gnus-summary-search-group (&optional backward use-level)
6486 "Search for next unread newsgroup.
6487 If optional argument BACKWARD is non-nil, search backward instead."
6489 (set-buffer gnus-group-buffer)
6490 (when (gnus-group-search-forward
6491 backward nil (if use-level (gnus-group-group-level) nil))
6492 (gnus-group-group-name))))
6494 (defun gnus-summary-best-group (&optional exclude-group)
6495 "Find the name of the best unread group.
6496 If EXCLUDE-GROUP, do not go to this group."
6497 (with-current-buffer gnus-group-buffer
6499 (gnus-group-best-unread-group exclude-group))))
6501 (defun gnus-summary-find-next (&optional unread article backward)
6503 (gnus-summary-find-prev unread article)
6504 (let* ((dummy (gnus-summary-article-intangible-p))
6505 (article (or article (gnus-summary-article-number)))
6506 (data (gnus-data-find-list article))
6508 (when (and (not dummy)
6509 (or (not gnus-summary-check-current)
6511 (not (gnus-data-unread-p (car data)))))
6512 (setq data (cdr data)))
6517 (unless (memq (gnus-data-number (car data))
6519 ((eq gnus-auto-goto-ignores
6520 'always-undownloaded)
6521 gnus-newsgroup-undownloaded)
6524 ((eq gnus-auto-goto-ignores
6526 gnus-newsgroup-unfetched)
6527 ((eq gnus-auto-goto-ignores
6529 gnus-newsgroup-undownloaded)))
6530 (when (gnus-data-unread-p (car data))
6531 (setq result (car data)
6533 (setq data (cdr data)))
6536 (goto-char (gnus-data-pos result))
6537 (gnus-data-number result)))))
6539 (defun gnus-summary-find-prev (&optional unread article)
6540 (let* ((eobp (eobp))
6541 (article (or article (gnus-summary-article-number)))
6542 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6544 (when (and (not eobp)
6545 (or (not gnus-summary-check-current)
6547 (not (gnus-data-unread-p (car data)))))
6548 (setq data (cdr data)))
6553 (unless (memq (gnus-data-number (car data))
6555 ((eq gnus-auto-goto-ignores
6556 'always-undownloaded)
6557 gnus-newsgroup-undownloaded)
6560 ((eq gnus-auto-goto-ignores
6562 gnus-newsgroup-unfetched)
6563 ((eq gnus-auto-goto-ignores
6565 gnus-newsgroup-undownloaded)))
6566 (when (gnus-data-unread-p (car data))
6567 (setq result (car data)
6569 (setq data (cdr data)))
6572 (goto-char (gnus-data-pos result))
6573 (gnus-data-number result))))
6575 (defun gnus-summary-find-subject (subject &optional unread backward article)
6576 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6577 (article (or article (gnus-summary-article-number)))
6578 (articles (gnus-data-list backward))
6579 (arts (gnus-data-find-list article articles))
6581 (when (or (not gnus-summary-check-current)
6583 (not (gnus-data-unread-p (car arts))))
6584 (setq arts (cdr arts)))
6586 (and (or (not unread)
6587 (gnus-data-unread-p (car arts)))
6588 (vectorp (gnus-data-header (car arts)))
6590 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6591 (setq result (car arts)
6593 (setq arts (cdr arts)))
6595 (goto-char (gnus-data-pos result))
6596 (gnus-data-number result))))
6598 (defun gnus-summary-search-forward (&optional unread subject backward)
6599 "Search forward for an article.
6600 If UNREAD, look for unread articles. If SUBJECT, look for
6601 articles with that subject. If BACKWARD, search backward instead."
6602 (cond (subject (gnus-summary-find-subject subject unread backward))
6603 (backward (gnus-summary-find-prev unread))
6604 (t (gnus-summary-find-next unread))))
6606 (defun gnus-recenter (&optional n)
6607 "Center point in window and redisplay frame.
6608 Also do horizontal recentering."
6610 (when (and gnus-auto-center-summary
6611 (not (eq gnus-auto-center-summary 'vertical)))
6612 (gnus-horizontal-recenter))
6615 (defun gnus-summary-recenter ()
6616 "Center point in the summary window.
6617 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6618 displayed, no centering will be performed."
6619 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6620 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6622 ;; The user has to want it.
6623 (when gnus-auto-center-summary
6624 (let* ((top (cond ((< (window-height) 4) 0)
6625 ((< (window-height) 7) 1)
6626 (t (if (numberp gnus-auto-center-summary)
6627 gnus-auto-center-summary
6628 (/ (1- (window-height)) 2)))))
6629 (height (1- (window-height)))
6630 (bottom (save-excursion (goto-char (point-max))
6631 (forward-line (- height))
6633 (window (get-buffer-window (current-buffer))))
6634 (when (get-buffer-window gnus-article-buffer)
6635 ;; Only do recentering when the article buffer is displayed,
6636 ;; Set the window start to either `bottom', which is the biggest
6637 ;; possible valid number, or the second line from the top,
6638 ;; whichever is the least.
6639 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6640 (if (> bottom top-pos)
6641 ;; Keep the second line from the top visible
6642 (set-window-start window top-pos)
6643 ;; Try to keep the bottom line visible; if it's partially
6644 ;; obscured, either scroll one more line to make it fully
6645 ;; visible, or revert to using TOP-POS.
6647 (goto-char (point-max))
6649 (let ((last-line-start (point)))
6651 (set-window-start window (point) t)
6652 (when (not (pos-visible-in-window-p last-line-start window))
6654 (set-window-start window (min (point) top-pos) t)))))))
6655 ;; Do horizontal recentering while we're at it.
6656 (when (and (get-buffer-window (current-buffer) t)
6657 (not (eq gnus-auto-center-summary 'vertical)))
6658 (let ((selected (selected-window)))
6659 (select-window (get-buffer-window (current-buffer) t))
6660 (gnus-summary-position-point)
6661 (gnus-horizontal-recenter)
6662 (select-window selected))))))
6664 (defun gnus-summary-jump-to-group (newsgroup)
6665 "Move point to NEWSGROUP in group mode buffer."
6666 ;; Keep update point of group mode buffer if visible.
6667 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6668 (save-window-excursion
6669 ;; Take care of tree window mode.
6670 (when (get-buffer-window gnus-group-buffer)
6671 (pop-to-buffer gnus-group-buffer))
6672 (gnus-group-jump-to-group newsgroup))
6674 ;; Take care of tree window mode.
6675 (if (get-buffer-window gnus-group-buffer)
6676 (pop-to-buffer gnus-group-buffer)
6677 (set-buffer gnus-group-buffer))
6678 (gnus-group-jump-to-group newsgroup))))
6680 ;; This function returns a list of article numbers based on the
6681 ;; difference between the ranges of read articles in this group and
6682 ;; the range of active articles.
6683 (defun gnus-list-of-unread-articles (group)
6684 (let* ((read (gnus-info-read (gnus-get-info group)))
6685 (active (or (gnus-active group) (gnus-activate-group group)))
6686 (last (or (cdr active)
6687 (error "Group %s couldn't be activated " group)))
6689 ;; If none are read, then all are unread.
6691 (setq first (car active))
6692 ;; If the range of read articles is a single range, then the
6693 ;; first unread article is the article after the last read
6694 ;; article. Sounds logical, doesn't it?
6695 (if (and (not (listp (cdr read)))
6696 (or (< (car read) (car active))
6697 (progn (setq read (list read))
6699 (setq first (max (car active) (1+ (cdr read))))
6700 ;; `read' is a list of ranges.
6701 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6704 (setq first (car active)))
6707 (while (< first nlast)
6708 (setq unread (cons first unread)
6710 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6711 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6712 (setq read (cdr read)))))
6713 ;; And add the last unread articles.
6714 (while (<= first last)
6715 (setq unread (cons first unread)
6717 ;; Return the list of unread articles.
6718 (delq 0 (nreverse unread))))
6720 (defun gnus-list-of-read-articles (group)
6721 "Return a list of unread, unticked and non-dormant articles."
6722 (let* ((info (gnus-get-info group))
6723 (marked (gnus-info-marks info))
6724 (active (gnus-active group)))
6726 (gnus-list-range-difference
6727 (gnus-list-range-difference
6728 (gnus-sorted-complement
6729 (gnus-uncompress-range active)
6730 (gnus-list-of-unread-articles group))
6731 (cdr (assq 'dormant marked)))
6732 (cdr (assq 'tick marked))))))
6734 ;; This function returns a sequence of article numbers based on the
6735 ;; difference between the ranges of read articles in this group and
6736 ;; the range of active articles.
6737 (defun gnus-sequence-of-unread-articles (group)
6738 (let* ((read (gnus-info-read (gnus-get-info group)))
6739 (active (or (gnus-active group) (gnus-activate-group group)))
6742 ;; If none are read, then all are unread.
6744 (setq first (car active))
6745 ;; If the range of read articles is a single range, then the
6746 ;; first unread article is the article after the last read
6747 ;; article. Sounds logical, doesn't it?
6748 (if (and (not (listp (cdr read)))
6749 (or (< (car read) (car active))
6750 (progn (setq read (list read))
6752 (setq first (max (car active) (1+ (cdr read))))
6753 ;; `read' is a list of ranges.
6754 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6757 (setq first (car active)))
6760 (push (cons first nlast) unread))
6761 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6762 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6763 (setq read (cdr read)))))
6764 ;; And add the last unread articles.
6765 (cond ((not (and first last))
6768 (push (cons first last) unread))
6770 (push first unread)))
6771 ;; Return the sequence of unread articles.
6772 (delq 0 (nreverse unread))))
6774 ;; Various summary commands
6776 (defun gnus-summary-select-article-buffer ()
6777 "Reconfigure windows to show article buffer."
6779 (if (not (gnus-buffer-live-p gnus-article-buffer))
6780 (error "There is no article buffer for this summary buffer")
6781 (gnus-configure-windows 'article)
6782 (select-window (get-buffer-window gnus-article-buffer))))
6784 (defun gnus-summary-universal-argument (arg)
6785 "Perform any operation on all articles that are process/prefixed."
6787 (let ((articles (gnus-summary-work-articles arg))
6794 (substitute-command-keys
6795 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6797 (gnus-error 1 "Undefined key")
6800 (gnus-summary-goto-subject (setq article (pop articles)))
6801 (let (gnus-newsgroup-processable)
6802 (command-execute func))
6803 (gnus-summary-remove-process-mark article)))))
6804 (gnus-summary-position-point))
6806 (defun gnus-summary-toggle-truncation (&optional arg)
6807 "Toggle truncation of summary lines.
6808 With ARG, turn line truncation on if ARG is positive."
6810 (setq truncate-lines
6811 (if (null arg) (not truncate-lines)
6812 (> (prefix-numeric-value arg) 0)))
6815 (defun gnus-summary-find-for-reselect ()
6816 "Return the number of an article to stay on across a reselect.
6817 The current article is considered, then following articles, then previous
6818 articles. An article is sought which is not cancelled and isn't a temporary
6819 insertion from another group. If there's no such then return a dummy 0."
6821 (dolist (rev '(nil t))
6822 (unless found ; don't demand the reverse list if we don't need it
6823 (let ((data (gnus-data-find-list
6824 (gnus-summary-article-number) (gnus-data-list rev))))
6825 (while (and data (not found))
6826 (if (and (< 0 (gnus-data-number (car data)))
6827 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6828 (setq found (gnus-data-number (car data))))
6829 (setq data (cdr data))))))
6832 (defun gnus-summary-reselect-current-group (&optional all rescan)
6833 "Exit and then reselect the current newsgroup.
6834 The prefix argument ALL means to select all articles."
6836 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6837 (error "Ephemeral groups can't be reselected"))
6838 (let ((current-subject (gnus-summary-find-for-reselect))
6839 (group gnus-newsgroup-name))
6840 (setq gnus-newsgroup-begin nil)
6841 (gnus-summary-exit nil 'leave-hidden)
6842 ;; We have to adjust the point of group mode buffer because
6843 ;; point was moved to the next unread newsgroup by exiting.
6844 (gnus-summary-jump-to-group group)
6847 (gnus-group-get-new-news-this-group 1)))
6848 (gnus-group-read-group all t)
6849 (gnus-summary-goto-subject current-subject nil t)))
6851 (defun gnus-summary-rescan-group (&optional all)
6852 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6854 (gnus-summary-reselect-current-group all t))
6856 (defun gnus-summary-update-info (&optional non-destructive)
6858 (let ((group gnus-newsgroup-name))
6860 (when gnus-newsgroup-kill-headers
6861 (setq gnus-newsgroup-killed
6862 (gnus-compress-sequence
6864 (gnus-list-range-intersection
6865 gnus-newsgroup-unselected gnus-newsgroup-killed)
6866 gnus-newsgroup-unreads)
6868 (unless (listp (cdr gnus-newsgroup-killed))
6869 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6870 (let ((headers gnus-newsgroup-headers))
6871 ;; Set the new ranges of read articles.
6872 (with-current-buffer gnus-group-buffer
6873 (gnus-undo-force-boundary))
6874 (gnus-update-read-articles
6875 group (gnus-sorted-union
6876 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6877 ;; Set the current article marks.
6878 (let ((gnus-newsgroup-scored
6879 (if (and (not gnus-save-score)
6880 (not non-destructive))
6882 gnus-newsgroup-scored)))
6884 (gnus-update-marks)))
6885 ;; Do the cross-ref thing.
6886 (when gnus-use-cross-reference
6887 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6888 ;; Do not switch windows but change the buffer to work.
6889 (set-buffer gnus-group-buffer)
6890 (unless (gnus-ephemeral-group-p group)
6891 (gnus-group-update-group group)))))))
6893 (defun gnus-summary-save-newsrc (&optional force)
6894 "Save the current number of read/marked articles in the dribble buffer.
6895 The dribble buffer will then be saved.
6896 If FORCE (the prefix), also save the .newsrc file(s)."
6898 (gnus-summary-update-info t)
6900 (gnus-save-newsrc-file)
6901 (gnus-dribble-save)))
6903 (defun gnus-summary-exit (&optional temporary leave-hidden)
6904 "Exit reading current newsgroup, and then return to group selection mode.
6905 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6907 (gnus-set-global-variables)
6908 (when (gnus-buffer-live-p gnus-article-buffer)
6910 (set-buffer gnus-article-buffer)
6911 (mm-destroy-parts gnus-article-mime-handles)
6912 ;; Set it to nil for safety reason.
6913 (setq gnus-article-mime-handle-alist nil)
6914 (setq gnus-article-mime-handles nil)))
6915 (gnus-kill-save-kill-buffer)
6916 (gnus-async-halt-prefetch)
6917 (let* ((group gnus-newsgroup-name)
6918 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6919 (gnus-group-is-exiting-p t)
6922 (buf (current-buffer)))
6924 ;; Do adaptive scoring, and possibly save score files.
6925 (when gnus-newsgroup-adaptive
6926 (gnus-score-adaptive))
6927 (when gnus-use-scoring
6929 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6930 ;; If we have several article buffers, we kill them at exit.
6931 (unless gnus-single-article-buffer
6932 (gnus-kill-buffer gnus-article-buffer)
6933 (gnus-kill-buffer gnus-original-article-buffer)
6934 (setq gnus-article-current nil))
6935 (when gnus-use-cache
6936 (gnus-cache-possibly-remove-articles)
6937 (gnus-cache-save-buffers))
6938 (gnus-async-prefetch-remove-group group)
6939 (when gnus-suppress-duplicates
6940 (gnus-dup-enter-articles))
6941 (when gnus-use-trees
6942 (gnus-tree-close group))
6943 (when gnus-use-cache
6944 (gnus-cache-write-active))
6945 ;; Remove entries for this group.
6946 (nnmail-purge-split-history (gnus-group-real-name group))
6947 ;; Make all changes in this group permanent.
6949 (gnus-run-hooks 'gnus-exit-group-hook)
6950 (gnus-summary-update-info))
6951 (gnus-close-group group)
6952 ;; Make sure where we were, and go to next newsgroup.
6953 (set-buffer gnus-group-buffer)
6955 (gnus-group-jump-to-group group))
6956 (gnus-run-hooks 'gnus-summary-exit-hook)
6957 (unless (or quit-config
6958 ;; If this group has disappeared from the summary
6959 ;; buffer, don't skip forwards.
6960 (not (string= group (gnus-group-group-name))))
6961 (gnus-group-next-unread-group 1))
6962 (setq group-point (point))
6965 ;; If we have several article buffers, we kill them at exit.
6966 (unless gnus-single-article-buffer
6967 (gnus-kill-buffer gnus-article-buffer)
6968 (gnus-kill-buffer gnus-original-article-buffer)
6969 (setq gnus-article-current nil))
6971 (if (not gnus-kill-summary-on-exit)
6973 (gnus-deaden-summary)
6975 ;; We set all buffer-local variables to nil. It is unclear why
6976 ;; this is needed, but if we don't, buffer-local variables are
6977 ;; not garbage-collected, it seems. This would the lead to en
6978 ;; ever-growing Emacs.
6979 (gnus-summary-clear-local-variables)
6980 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6981 (gnus-summary-clear-local-variables))
6982 (when (get-buffer gnus-article-buffer)
6983 (bury-buffer gnus-article-buffer))
6984 ;; Return to group mode buffer.
6985 (when (eq mode 'gnus-summary-mode)
6986 (gnus-kill-buffer buf)))
6987 (setq gnus-current-select-method gnus-select-method)
6988 (set-buffer gnus-group-buffer)
6990 (gnus-handle-ephemeral-exit quit-config)
6991 (goto-char group-point)
6992 ;; If gnus-group-buffer is already displayed, make sure we also move
6993 ;; the cursor in the window that displays it.
6994 (let ((win (get-buffer-window (current-buffer) 0)))
6995 (if win (set-window-point win (point))))
6996 (unless leave-hidden
6997 (gnus-configure-windows 'group 'force)))
6998 ;; Clear the current group name.
7000 (setq gnus-newsgroup-name nil)))))
7002 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7003 (defun gnus-summary-exit-no-update (&optional no-questions)
7004 "Quit reading current newsgroup without updating read article info."
7006 (let* ((group gnus-newsgroup-name)
7007 (gnus-group-is-exiting-p t)
7008 (gnus-group-is-exiting-without-update-p t)
7009 (quit-config (gnus-group-quit-config group)))
7010 (when (or no-questions
7012 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7013 (gnus-async-halt-prefetch)
7014 (run-hooks 'gnus-summary-prepare-exit-hook)
7015 (when (gnus-buffer-live-p gnus-article-buffer)
7017 (set-buffer gnus-article-buffer)
7018 (mm-destroy-parts gnus-article-mime-handles)
7019 ;; Set it to nil for safety reason.
7020 (setq gnus-article-mime-handle-alist nil)
7021 (setq gnus-article-mime-handles nil)))
7022 ;; If we have several article buffers, we kill them at exit.
7023 (unless gnus-single-article-buffer
7024 (gnus-kill-buffer gnus-article-buffer)
7025 (gnus-kill-buffer gnus-original-article-buffer)
7026 (setq gnus-article-current nil))
7027 (if (not gnus-kill-summary-on-exit)
7028 (gnus-deaden-summary)
7029 (gnus-close-group group)
7030 (gnus-summary-clear-local-variables)
7031 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7032 (gnus-summary-clear-local-variables))
7033 (gnus-kill-buffer gnus-summary-buffer))
7034 (unless gnus-single-article-buffer
7035 (setq gnus-article-current nil))
7036 (when gnus-use-trees
7037 (gnus-tree-close group))
7038 (gnus-async-prefetch-remove-group group)
7039 (when (get-buffer gnus-article-buffer)
7040 (bury-buffer gnus-article-buffer))
7041 ;; Return to the group buffer.
7042 (gnus-configure-windows 'group 'force)
7043 ;; Clear the current group name.
7044 (setq gnus-newsgroup-name nil)
7045 (unless (gnus-ephemeral-group-p group)
7046 (gnus-group-update-group group))
7047 (when (equal (gnus-group-group-name) group)
7048 (gnus-group-next-unread-group 1))
7050 (gnus-handle-ephemeral-exit quit-config)))))
7052 (defun gnus-handle-ephemeral-exit (quit-config)
7053 "Handle movement when leaving an ephemeral group.
7054 The state which existed when entering the ephemeral is reset."
7055 (if (not (buffer-name (car quit-config)))
7056 (gnus-configure-windows 'group 'force)
7057 (set-buffer (car quit-config))
7058 (cond ((eq major-mode 'gnus-summary-mode)
7059 (gnus-set-global-variables))
7060 ((eq major-mode 'gnus-article-mode)
7062 ;; The `gnus-summary-buffer' variable may point
7063 ;; to the old summary buffer when using a single
7065 (unless (gnus-buffer-live-p gnus-summary-buffer)
7066 (set-buffer gnus-group-buffer))
7067 (set-buffer gnus-summary-buffer)
7068 (gnus-set-global-variables))))
7069 (if (or (eq (cdr quit-config) 'article)
7070 (eq (cdr quit-config) 'pick))
7071 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7072 (gnus-configure-windows 'pick 'force)
7073 (gnus-configure-windows (cdr quit-config) 'force))
7074 (gnus-configure-windows (cdr quit-config) 'force))
7075 (when (eq major-mode 'gnus-summary-mode)
7076 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7077 next-unread-noselect))
7078 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7080 (gnus-summary-next-subject 1 nil t))
7081 ((eq gnus-auto-select-on-ephemeral-exit
7082 'next-unread-noselect)
7083 (gnus-summary-next-subject 1 t t))))
7084 ;; Hide the article buffer which displays the article different
7085 ;; from the one that the cursor points to in the summary buffer.
7086 (gnus-configure-windows 'summary 'force))
7087 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7088 (gnus-summary-next-subject 1))
7089 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7090 (gnus-summary-next-subject 1 t))))
7091 (gnus-summary-recenter)
7092 (gnus-summary-position-point))))
7096 (defvar gnus-dead-summary-mode-map nil)
7098 (unless gnus-dead-summary-mode-map
7099 (setq gnus-dead-summary-mode-map (make-keymap))
7100 (suppress-keymap gnus-dead-summary-mode-map)
7101 (substitute-key-definition
7102 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7103 (dolist (key '("\C-d" "\r" "\177" [delete]))
7104 (define-key gnus-dead-summary-mode-map
7105 key 'gnus-summary-wake-up-the-dead))
7106 (dolist (key '("q" "Q"))
7107 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
7109 (defvar gnus-dead-summary-mode nil
7110 "Minor mode for Gnus summary buffers.")
7112 (defun gnus-dead-summary-mode (&optional arg)
7113 "Minor mode for Gnus summary buffers."
7115 (when (eq major-mode 'gnus-summary-mode)
7116 (make-local-variable 'gnus-dead-summary-mode)
7117 (setq gnus-dead-summary-mode
7118 (if (null arg) (not gnus-dead-summary-mode)
7119 (> (prefix-numeric-value arg) 0)))
7120 (when gnus-dead-summary-mode
7122 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7124 (defun gnus-deaden-summary ()
7125 "Make the current summary buffer into a dead summary buffer."
7126 ;; Kill any previous dead summary buffer.
7127 (when (and gnus-dead-summary
7128 (buffer-name gnus-dead-summary))
7129 (with-current-buffer gnus-dead-summary
7130 (when gnus-dead-summary-mode
7131 (kill-buffer (current-buffer)))))
7132 ;; Make this the current dead summary.
7133 (setq gnus-dead-summary (current-buffer))
7134 (gnus-dead-summary-mode 1)
7135 (let ((name (buffer-name)))
7136 (when (string-match "Summary" name)
7138 (concat (substring name 0 (match-beginning 0)) "Dead "
7139 (substring name (match-beginning 0)))
7143 (defun gnus-kill-or-deaden-summary (buffer)
7144 "Kill or deaden the summary BUFFER."
7146 (when (and (buffer-name buffer)
7147 (not gnus-single-article-buffer))
7148 (with-current-buffer buffer
7149 (gnus-kill-buffer gnus-article-buffer)
7150 (gnus-kill-buffer gnus-original-article-buffer)))
7153 (gnus-kill-summary-on-exit
7154 (when (and gnus-use-trees
7155 (gnus-buffer-exists-p buffer))
7158 (gnus-tree-close gnus-newsgroup-name)))
7159 (gnus-kill-buffer buffer))
7160 ;; Deaden the buffer.
7161 ((gnus-buffer-exists-p buffer)
7164 (gnus-deaden-summary))))))
7166 (defun gnus-summary-wake-up-the-dead (&rest args)
7167 "Wake up the dead summary buffer."
7169 (gnus-dead-summary-mode -1)
7170 (let ((name (buffer-name)))
7171 (when (string-match "Dead " name)
7173 (concat (substring name 0 (match-beginning 0))
7174 (substring name (match-end 0)))
7176 (gnus-message 3 "This dead summary is now alive again"))
7178 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7179 (defun gnus-summary-fetch-faq (&optional faq-dir)
7180 "Fetch the FAQ for the current group.
7181 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7185 (when current-prefix-arg
7187 "FAQ dir: " (and (listp gnus-group-faq-directory)
7189 gnus-group-faq-directory))))))
7190 (let (gnus-faq-buffer)
7191 (when (setq gnus-faq-buffer
7192 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7193 (gnus-configure-windows 'summary-faq))))
7195 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7196 (defun gnus-summary-describe-group (&optional force)
7197 "Describe the current newsgroup."
7199 (gnus-group-describe-group force gnus-newsgroup-name))
7201 (defun gnus-summary-describe-briefly ()
7202 "Describe summary mode commands briefly."
7204 (gnus-message 6 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
7206 ;; Walking around group mode buffer from summary mode.
7208 (defun gnus-summary-next-group (&optional no-article target-group backward)
7209 "Exit current newsgroup and then select next unread newsgroup.
7210 If prefix argument NO-ARTICLE is non-nil, no article is selected
7211 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7212 previous group instead."
7214 ;; Stop pre-fetching.
7215 (gnus-async-halt-prefetch)
7216 (let ((current-group gnus-newsgroup-name)
7217 (current-buffer (current-buffer))
7219 ;; First we semi-exit this group to update Xrefs and all variables.
7220 ;; We can't do a real exit, because the window conf must remain
7221 ;; the same in case the user is prompted for info, and we don't
7222 ;; want the window conf to change before that...
7223 (gnus-summary-exit t)
7224 (while (not entered)
7225 ;; Then we find what group we are supposed to enter.
7226 (set-buffer gnus-group-buffer)
7227 (gnus-group-jump-to-group current-group)
7230 (if (eq gnus-keep-same-level 'best)
7231 (gnus-summary-best-group gnus-newsgroup-name)
7232 (gnus-summary-search-group backward gnus-keep-same-level))))
7233 (if (not target-group)
7234 ;; There are no further groups, so we return to the group
7237 (gnus-message 5 "Returning to the group buffer")
7239 (when (gnus-buffer-live-p current-buffer)
7240 (set-buffer current-buffer)
7241 (gnus-summary-exit))
7242 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7243 ;; We try to enter the target group.
7244 (gnus-group-jump-to-group target-group)
7245 (let ((unreads (gnus-group-group-unread)))
7246 (if (and (or (eq t unreads)
7247 (and unreads (not (zerop unreads))))
7248 (gnus-summary-read-group
7249 target-group nil no-article
7250 (and (buffer-name current-buffer) current-buffer)
7253 (setq current-group target-group
7254 target-group nil)))))))
7256 (defun gnus-summary-prev-group (&optional no-article)
7257 "Exit current newsgroup and then select previous unread newsgroup.
7258 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7260 (gnus-summary-next-group no-article nil t))
7262 ;; Walking around summary lines.
7264 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7265 "Go to the first subject satisfying any non-nil constraint.
7266 If UNREAD is non-nil, the article should be unread.
7267 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7268 If UNSEEN is non-nil, the article should be unseen.
7269 Returns the article selected or nil if there are no matching articles."
7273 ((null gnus-newsgroup-data)
7274 (gnus-message 3 "No articles in the group")
7276 ;; Pick the first article.
7277 ((not (or unread undownloaded unseen))
7278 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7279 (gnus-data-number (car gnus-newsgroup-data)))
7280 ;; Find the first unread article.
7282 (let ((data gnus-newsgroup-data))
7284 (let ((num (gnus-data-number (car data))))
7285 (or (memq num gnus-newsgroup-unfetched)
7286 (not (or (and unread
7287 (memq num gnus-newsgroup-unreads))
7289 (memq num gnus-newsgroup-undownloaded))
7291 (memq num gnus-newsgroup-unseen)))))))
7292 (setq data (cdr data)))
7296 (goto-char (gnus-data-pos (car data)))
7297 (gnus-data-number (car data)))
7298 (gnus-message 3 "No more%s articles"
7299 (let* ((r (when unread " unread"))
7300 (d (when undownloaded " undownloaded"))
7301 (s (when unseen " unseen"))
7302 (l (delq nil (list r d s))))
7303 (cond ((= 3 (length l))
7304 (concat r "," d ", or" s))
7306 (concat (car l) ", or" (cadr l)))
7313 (gnus-summary-position-point))))))
7315 (defun gnus-summary-next-subject (n &optional unread dont-display)
7316 "Go to next N'th summary line.
7317 If N is negative, go to the previous N'th subject line.
7318 If UNREAD is non-nil, only unread articles are selected.
7319 The difference between N and the actual number of steps taken is
7322 (let ((backward (< n 0))
7326 (gnus-summary-find-prev unread)
7327 (gnus-summary-find-next unread)))
7328 (unless (zerop (setq n (1- n)))
7329 (gnus-summary-show-thread)))
7331 (gnus-message 7 "No more%s articles"
7332 (if unread " unread" "")))
7333 (unless dont-display
7334 (gnus-summary-recenter)
7335 (gnus-summary-position-point))
7338 (defun gnus-summary-next-unread-subject (n)
7339 "Go to next N'th unread summary line."
7341 (gnus-summary-next-subject n t))
7343 (defun gnus-summary-prev-subject (n &optional unread)
7344 "Go to previous N'th summary line.
7345 If optional argument UNREAD is non-nil, only unread article is selected."
7347 (gnus-summary-next-subject (- n) unread))
7349 (defun gnus-summary-prev-unread-subject (n)
7350 "Go to previous N'th unread summary line."
7352 (gnus-summary-next-subject (- n) t))
7354 (defun gnus-summary-goto-subjects (articles)
7355 "Insert the subject header for ARTICLES in the current buffer."
7357 (dolist (article articles)
7358 (gnus-summary-goto-subject article t)))
7359 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7360 (gnus-summary-position-point))
7362 (defun gnus-summary-goto-subject (article &optional force silent)
7363 "Go the subject line of ARTICLE.
7364 If FORCE, also allow jumping to articles not currently shown."
7365 (interactive "nArticle number: ")
7366 (unless (numberp article)
7367 (error "Article %s is not a number" article))
7369 (data (gnus-data-find article)))
7370 ;; We read in the article if we have to.
7373 (gnus-summary-insert-subject
7375 (if (or (numberp force) (vectorp force)) force)
7377 (setq data (gnus-data-find article)))
7382 (gnus-message 3 "Can't find article %d" article))
7384 (let ((pt (gnus-data-pos data)))
7386 (gnus-summary-set-article-display-arrow pt))
7387 (gnus-summary-position-point)
7390 ;; Walking around summary lines with displaying articles.
7392 (defun gnus-summary-expand-window (&optional arg)
7393 "Make the summary buffer take up the entire Emacs frame.
7394 Given a prefix, will force an `article' buffer configuration."
7397 (gnus-configure-windows 'article 'force)
7398 (gnus-configure-windows 'summary 'force)))
7400 (defun gnus-summary-display-article (article &optional all-header)
7401 "Display ARTICLE in article buffer."
7402 (when (gnus-buffer-live-p gnus-article-buffer)
7403 (with-current-buffer gnus-article-buffer
7404 (mm-enable-multibyte)))
7405 (gnus-set-global-variables)
7406 (when (gnus-buffer-live-p gnus-article-buffer)
7407 (with-current-buffer gnus-article-buffer
7408 (setq gnus-article-charset gnus-newsgroup-charset)
7409 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7410 (mm-enable-multibyte)))
7414 (if gnus-summary-display-article-function
7415 (funcall gnus-summary-display-article-function article all-header)
7416 (gnus-article-prepare article all-header))
7417 (gnus-run-hooks 'gnus-select-article-hook)
7418 (when (and gnus-current-article
7419 (not (zerop gnus-current-article)))
7420 (gnus-summary-goto-subject gnus-current-article))
7421 (gnus-summary-recenter)
7422 (when (and gnus-use-trees gnus-show-threads)
7423 (gnus-possibly-generate-tree article)
7424 (gnus-highlight-selected-tree article))
7425 ;; Successfully display article.
7426 (gnus-article-set-window-start
7427 (cdr (assq article gnus-newsgroup-bookmarks))))))
7429 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7430 "Select the current article.
7431 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7432 non-nil, the article will be re-fetched even if it already present in
7433 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7435 ;; Make sure we are in the summary buffer to work around bbdb bug.
7436 (unless (eq major-mode 'gnus-summary-mode)
7437 (set-buffer gnus-summary-buffer))
7438 (let ((article (or article (gnus-summary-article-number)))
7439 (all-headers (not (not all-headers))) ;Must be t or nil.
7440 gnus-summary-display-article-function)
7442 (gnus-summary-article-pseudo-p article)
7443 (error "This is a pseudo-article"))
7445 (set-buffer gnus-summary-buffer)
7446 (if (or (and gnus-single-article-buffer
7447 (or (null gnus-current-article)
7448 (null gnus-article-current)
7449 (null (get-buffer gnus-article-buffer))
7450 (not (eq article (cdr gnus-article-current)))
7451 (not (equal (car gnus-article-current)
7452 gnus-newsgroup-name))))
7453 (and (not gnus-single-article-buffer)
7454 (or (null gnus-current-article)
7455 (not (eq gnus-current-article article))))
7457 ;; The requested article is different from the current article.
7459 (gnus-summary-display-article article all-headers)
7460 (when (gnus-buffer-live-p gnus-article-buffer)
7461 (with-current-buffer gnus-article-buffer
7462 (if (not gnus-article-decoded-p) ;; a local variable
7463 (mm-disable-multibyte))))
7464 (gnus-article-set-window-start
7465 (cdr (assq article gnus-newsgroup-bookmarks)))
7469 (defun gnus-summary-force-verify-and-decrypt ()
7470 "Display buttons for signed/encrypted parts and verify/decrypt them."
7472 (let ((mm-verify-option 'known)
7473 (mm-decrypt-option 'known)
7474 (gnus-article-emulate-mime t)
7475 (gnus-buttonized-mime-types (append (list "multipart/signed"
7476 "multipart/encrypted")
7477 gnus-buttonized-mime-types)))
7478 (gnus-summary-select-article nil 'force)))
7480 (defun gnus-summary-set-current-mark (&optional current-mark)
7481 "Obsolete function."
7484 (defun gnus-summary-next-article (&optional unread subject backward push)
7485 "Select the next article.
7486 If UNREAD, only unread articles are selected.
7487 If SUBJECT, only articles with SUBJECT are selected.
7488 If BACKWARD, the previous article is selected instead of the next."
7490 ;; Make sure we are in the summary buffer.
7491 (unless (eq major-mode 'gnus-summary-mode)
7492 (set-buffer gnus-summary-buffer))
7494 ;; Is there such an article?
7495 ((and (gnus-summary-search-forward unread subject backward)
7496 (or (gnus-summary-display-article (gnus-summary-article-number))
7497 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7498 (gnus-summary-position-point))
7499 ;; If not, we try the first unread, if that is wanted.
7501 gnus-auto-select-same
7502 (gnus-summary-first-unread-article))
7503 (gnus-summary-position-point)
7504 (gnus-message 6 "Wrapped"))
7505 ;; Try to get next/previous article not displayed in this group.
7506 ((and gnus-auto-extend-newsgroup
7507 (not unread) (not subject))
7508 (gnus-summary-goto-article
7509 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7510 nil (count-lines (point-min) (point))))
7511 ;; Go to next/previous group.
7513 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7514 (gnus-summary-jump-to-group gnus-newsgroup-name))
7515 (let ((cmd last-command-char)
7517 (with-current-buffer gnus-group-buffer
7520 (if (eq gnus-keep-same-level 'best)
7521 (gnus-summary-best-group gnus-newsgroup-name)
7522 (gnus-summary-search-group backward gnus-keep-same-level))))
7523 ;; For some reason, the group window gets selected. We change
7525 (select-window (get-buffer-window (current-buffer)))
7526 ;; Select next unread newsgroup automagically.
7528 ((or (not gnus-auto-select-next)
7530 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7531 ((or (eq gnus-auto-select-next 'quietly)
7532 (and (eq gnus-auto-select-next 'slightly-quietly)
7534 (and (eq gnus-auto-select-next 'almost-quietly)
7535 (gnus-summary-last-article-p)))
7537 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7539 (gnus-message 7 "No more%s articles (%s)..."
7540 (if unread " unread" "")
7541 (if group (concat "selecting " group)
7543 (gnus-summary-next-group nil group backward)))
7545 (when (gnus-key-press-event-p last-input-event)
7546 (gnus-summary-walk-group-buffer
7547 gnus-newsgroup-name cmd unread backward point))))))))
7549 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7550 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7551 (?\C-p (gnus-group-prev-unread-group 1))))
7552 (cursor-in-echo-area t)
7553 keve key group ended prompt)
7555 (set-buffer gnus-group-buffer)
7558 (if (eq gnus-keep-same-level 'best)
7559 (gnus-summary-best-group gnus-newsgroup-name)
7560 (gnus-summary-search-group backward gnus-keep-same-level))))
7564 "No more%s articles%s " (if unread " unread" "")
7566 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7567 (format " (Type %s for %s [%s])"
7568 (single-key-description cmd)
7569 (gnus-group-decoded-name group)
7570 (gnus-group-unread group))
7571 (format " (Type %s to exit %s)"
7572 (single-key-description cmd)
7573 (gnus-group-decoded-name gnus-newsgroup-name)))))
7574 ;; Confirm auto selection.
7575 (setq key (car (setq keve (gnus-read-event-char prompt)))
7578 ((assq key keystrokes)
7579 (let ((obuf (current-buffer)))
7580 (switch-to-buffer gnus-group-buffer)
7582 (gnus-group-jump-to-group group))
7583 (eval (cadr (assq key keystrokes)))
7584 (setq group (gnus-group-group-name))
7585 (switch-to-buffer obuf))
7589 (gnus-ephemeral-group-p gnus-newsgroup-name))
7591 (gnus-summary-next-group nil group backward)))
7593 (push (cdr keve) unread-command-events))))))
7595 (defun gnus-summary-next-unread-article ()
7596 "Select unread article after current one."
7598 (gnus-summary-next-article
7599 (or (not (eq gnus-summary-goto-unread 'never))
7600 (gnus-summary-last-article-p (gnus-summary-article-number)))
7601 (and gnus-auto-select-same
7602 (gnus-summary-article-subject))))
7604 (defun gnus-summary-prev-article (&optional unread subject)
7605 "Select the article after the current one.
7606 If UNREAD is non-nil, only unread articles are selected."
7608 (gnus-summary-next-article unread subject t))
7610 (defun gnus-summary-prev-unread-article ()
7611 "Select unread article before current one."
7613 (gnus-summary-prev-article
7614 (or (not (eq gnus-summary-goto-unread 'never))
7615 (gnus-summary-first-article-p (gnus-summary-article-number)))
7616 (and gnus-auto-select-same
7617 (gnus-summary-article-subject))))
7619 (defun gnus-summary-next-page (&optional lines circular stop)
7620 "Show next page of the selected article.
7621 If at the end of the current article, select the next article.
7622 LINES says how many lines should be scrolled up.
7624 If CIRCULAR is non-nil, go to the start of the article instead of
7625 selecting the next article when reaching the end of the current
7628 If STOP is non-nil, just stop when reaching the end of the message.
7630 Also see the variable `gnus-article-skip-boring'."
7632 (setq gnus-summary-buffer (current-buffer))
7633 (gnus-set-global-variables)
7634 (let ((article (gnus-summary-article-number))
7635 (article-window (get-buffer-window gnus-article-buffer t))
7637 ;; If the buffer is empty, we have no article.
7639 (error "No article to select"))
7640 (gnus-configure-windows 'article)
7641 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7642 (if (and (eq gnus-summary-goto-unread 'never)
7643 (not (gnus-summary-last-article-p article)))
7644 (gnus-summary-next-article)
7645 (gnus-summary-next-unread-article))
7646 (if (or (null gnus-current-article)
7647 (null gnus-article-current)
7648 (/= article (cdr gnus-article-current))
7649 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7650 ;; Selected subject is different from current article's.
7651 (gnus-summary-display-article article)
7652 (when article-window
7653 (gnus-eval-in-buffer-window gnus-article-buffer
7654 (setq endp (or (gnus-article-next-page lines)
7655 (gnus-article-only-boring-p))))
7658 (gnus-message 3 "End of message"))
7660 (gnus-summary-beginning-of-article))
7662 (gnus-message 3 "End of message"))
7664 (if (and (eq gnus-summary-goto-unread 'never)
7665 (not (gnus-summary-last-article-p article)))
7666 (gnus-summary-next-article)
7667 (gnus-summary-next-unread-article))))))))
7668 (gnus-summary-recenter)
7669 (gnus-summary-position-point)))
7671 (defun gnus-summary-prev-page (&optional lines move)
7672 "Show previous page of selected article.
7673 Argument LINES specifies lines to be scrolled down.
7674 If MOVE, move to the previous unread article if point is at
7675 the beginning of the buffer."
7677 (let ((article (gnus-summary-article-number))
7678 (article-window (get-buffer-window gnus-article-buffer t))
7680 (gnus-configure-windows 'article)
7681 (if (or (null gnus-current-article)
7682 (null gnus-article-current)
7683 (/= article (cdr gnus-article-current))
7684 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7685 ;; Selected subject is different from current article's.
7686 (gnus-summary-display-article article)
7687 (gnus-summary-recenter)
7688 (when article-window
7689 (gnus-eval-in-buffer-window gnus-article-buffer
7690 (setq endp (gnus-article-prev-page lines)))
7691 (when (and move endp)
7693 (gnus-message 3 "Beginning of message"))
7695 (if (and (eq gnus-summary-goto-unread 'never)
7696 (not (gnus-summary-first-article-p article)))
7697 (gnus-summary-prev-article)
7698 (gnus-summary-prev-unread-article))))))))
7699 (gnus-summary-position-point))
7701 (defun gnus-summary-prev-page-or-article (&optional lines)
7702 "Show previous page of selected article.
7703 Argument LINES specifies lines to be scrolled down.
7704 If at the beginning of the article, go to the next article."
7706 (gnus-summary-prev-page lines t))
7708 (defun gnus-summary-scroll-up (lines)
7709 "Scroll up (or down) one line current article.
7710 Argument LINES specifies lines to be scrolled up (or down if negative)."
7712 (gnus-configure-windows 'article)
7713 (gnus-summary-show-thread)
7714 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7715 (gnus-eval-in-buffer-window gnus-article-buffer
7717 (when (gnus-article-next-page lines)
7718 (gnus-message 3 "End of message")))
7720 (gnus-article-prev-page (- lines))))))
7721 (gnus-summary-recenter)
7722 (gnus-summary-position-point))
7724 (defun gnus-summary-scroll-down (lines)
7725 "Scroll down (or up) one line current article.
7726 Argument LINES specifies lines to be scrolled down (or up if negative)."
7728 (gnus-summary-scroll-up (- lines)))
7730 (defun gnus-summary-next-same-subject ()
7731 "Select next article which has the same subject as current one."
7733 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7735 (defun gnus-summary-prev-same-subject ()
7736 "Select previous article which has the same subject as current one."
7738 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7740 (defun gnus-summary-next-unread-same-subject ()
7741 "Select next unread article which has the same subject as current one."
7743 (gnus-summary-next-article t (gnus-summary-article-subject)))
7745 (defun gnus-summary-prev-unread-same-subject ()
7746 "Select previous unread article which has the same subject as current one."
7748 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7750 (defun gnus-summary-first-unread-article ()
7751 "Select the first unread article.
7752 Return nil if there are no unread articles."
7755 (when (gnus-summary-first-subject t)
7756 (gnus-summary-show-thread)
7757 (gnus-summary-first-subject t)
7758 (gnus-summary-display-article (gnus-summary-article-number)))
7759 (gnus-summary-position-point)))
7761 (defun gnus-summary-first-unread-subject ()
7762 "Place the point on the subject line of the first unread article.
7763 Return nil if there are no unread articles."
7766 (when (gnus-summary-first-subject t)
7767 (gnus-summary-show-thread)
7768 (gnus-summary-first-subject t))
7769 (gnus-summary-position-point)))
7771 (defun gnus-summary-first-unseen-subject ()
7772 "Place the point on the subject line of the first unseen article.
7773 Return nil if there are no unseen articles."
7776 (when (gnus-summary-first-subject nil nil t)
7777 (gnus-summary-show-thread)
7778 (gnus-summary-first-subject nil nil t))
7779 (gnus-summary-position-point)))
7781 (defun gnus-summary-first-unseen-or-unread-subject ()
7782 "Place the point on the subject line of the first unseen article or,
7783 if all article have been seen, on the subject line of the first unread
7787 (unless (when (gnus-summary-first-subject nil nil t)
7788 (gnus-summary-show-thread)
7789 (gnus-summary-first-subject nil nil t))
7790 (when (gnus-summary-first-subject t)
7791 (gnus-summary-show-thread)
7792 (gnus-summary-first-subject t)))
7793 (gnus-summary-position-point)))
7795 (defun gnus-summary-first-article ()
7796 "Select the first article.
7797 Return nil if there are no articles."
7800 (when (gnus-summary-first-subject)
7801 (gnus-summary-show-thread)
7802 (gnus-summary-first-subject)
7803 (gnus-summary-display-article (gnus-summary-article-number)))
7804 (gnus-summary-position-point)))
7806 (defun gnus-summary-best-unread-article (&optional arg)
7807 "Select the unread article with the highest score.
7808 If given a prefix argument, select the next unread article that has a
7809 score higher than the default score."
7811 (let ((article (if arg
7812 (gnus-summary-better-unread-subject)
7813 (gnus-summary-best-unread-subject))))
7815 (gnus-summary-goto-article article)
7816 (error "No unread articles"))))
7818 (defun gnus-summary-best-unread-subject ()
7819 "Select the unread subject with the highest score."
7821 (let ((best -1000000)
7822 (data gnus-newsgroup-data)
7825 (and (gnus-data-unread-p (car data))
7827 (gnus-summary-article-score (gnus-data-number (car data))))
7830 article (gnus-data-number (car data))))
7831 (setq data (cdr data)))
7833 (gnus-summary-goto-subject article))
7834 (gnus-summary-position-point)
7837 (defun gnus-summary-better-unread-subject ()
7838 "Select the first unread subject that has a score over the default score."
7840 (let ((data gnus-newsgroup-data)
7842 (while (and (setq article (gnus-data-number (car data)))
7843 (or (gnus-data-read-p (car data))
7844 (not (> (gnus-summary-article-score article)
7845 gnus-summary-default-score))))
7846 (setq data (cdr data)))
7848 (gnus-summary-goto-subject article))
7849 (gnus-summary-position-point)
7852 (defun gnus-summary-last-subject ()
7853 "Go to the last displayed subject line in the group."
7854 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7856 (gnus-summary-goto-subject article))))
7858 (defun gnus-summary-goto-article (article &optional all-headers force)
7859 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7860 If ALL-HEADERS is non-nil, no header lines are hidden.
7861 If FORCE, go to the article even if it isn't displayed. If FORCE
7862 is a number, it is the line the article is to be displayed on."
7866 "Article number or Message-ID: "
7867 (mapcar (lambda (number) (list (int-to-string number)))
7868 gnus-newsgroup-limit))
7872 (if (and (stringp article)
7873 (string-match "@\\|%40" article))
7874 (gnus-summary-refer-article article)
7875 (when (stringp article)
7876 (setq article (string-to-number article)))
7877 (if (gnus-summary-goto-subject article force)
7878 (gnus-summary-display-article article all-headers)
7879 (gnus-message 4 "Couldn't go to article %s" article) nil))
7880 (gnus-summary-position-point)))
7882 (defun gnus-summary-goto-last-article ()
7883 "Go to the previously read article."
7886 (when gnus-last-article
7887 (gnus-summary-goto-article gnus-last-article nil t))
7888 (gnus-summary-position-point)))
7890 (defun gnus-summary-pop-article (number)
7891 "Pop one article off the history and go to the previous.
7892 NUMBER articles will be popped off."
7895 (setq gnus-newsgroup-history
7896 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7898 (gnus-summary-goto-article (car to) nil t)
7899 (error "Article history empty")))
7900 (gnus-summary-position-point))
7902 ;; Summary commands and functions for limiting the summary buffer.
7904 (defun gnus-summary-limit-to-articles (n)
7905 "Limit the summary buffer to the next N articles.
7906 If not given a prefix, use the process marked articles instead."
7909 (let ((articles (gnus-summary-work-articles n)))
7910 (setq gnus-newsgroup-processable nil)
7911 (gnus-summary-limit articles))
7912 (gnus-summary-position-point)))
7914 (defun gnus-summary-pop-limit (&optional total)
7915 "Restore the previous limit.
7916 If given a prefix, remove all limits."
7919 (setq gnus-newsgroup-limits
7920 (list (mapcar (lambda (h) (mail-header-number h))
7921 gnus-newsgroup-headers))))
7922 (unless gnus-newsgroup-limits
7923 (error "No limit to pop"))
7925 (gnus-summary-limit nil 'pop)
7926 (gnus-summary-position-point)))
7928 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7929 "Limit the summary buffer to articles that have subjects that match a regexp.
7930 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7932 (list (read-string (if current-prefix-arg
7933 "Exclude subject (regexp): "
7934 "Limit to subject (regexp): "))
7935 nil current-prefix-arg))
7937 (setq header "subject"))
7938 (when (not (equal "" subject))
7940 (let ((articles (gnus-summary-find-matching
7941 (or header "subject") subject 'all nil nil
7944 (error "Found no matches for \"%s\"" subject))
7945 (gnus-summary-limit articles))
7946 (gnus-summary-position-point))))
7948 (defun gnus-summary-limit-to-author (from &optional not-matching)
7949 "Limit the summary buffer to articles that have authors that match a regexp.
7950 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7952 (list (read-string (if current-prefix-arg
7953 "Exclude author (regexp): "
7954 "Limit to author (regexp): "))
7955 current-prefix-arg))
7956 (gnus-summary-limit-to-subject from "from" not-matching))
7958 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7959 "Limit the summary buffer to articles with the given RECIPIENT.
7961 If NOT-MATCHING, exclude RECIPIENT.
7963 To and Cc headers are checked. You need to include them in
7964 `nnmail-extra-headers'."
7965 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7967 (list (read-string (format "%s recipient (regexp): "
7968 (if current-prefix-arg "Exclude" "Limit to")))
7969 current-prefix-arg))
7970 (when (not (equal "" recipient))
7972 (if (memq 'To nnmail-extra-headers)
7973 (gnus-summary-find-matching
7974 (cons 'extra 'To) recipient 'all nil nil
7977 1 "`To' isn't present in `nnmail-extra-headers'")
7981 (if (memq 'Cc nnmail-extra-headers)
7982 (gnus-summary-find-matching
7983 (cons 'extra 'Cc) recipient 'all nil nil
7986 1 "`Cc' isn't present in `nnmail-extra-headers'")
7991 ;; We need the numbers that are in both lists:
7993 (and (memq a to) a))
7997 (error "Found no matches for \"%s\"" recipient))
7998 (gnus-summary-limit articles))
7999 (gnus-summary-position-point))))
8001 (defun gnus-summary-limit-strange-charsets-predicate (header)
8002 (let ((string (concat (mail-header-subject header)
8003 (mail-header-from header)))
8005 (dotimes (i (1- (length string)))
8006 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8007 (when (string-match "unicode\\|big\\|japanese" charset)
8011 (defun gnus-summary-limit-to-predicate (predicate)
8012 "Limit to articles where PREDICATE returns non-nil.
8013 PREDICATE will be called with the header structures of the
8015 (let ((articles nil)
8016 (case-fold-search t))
8017 (dolist (header gnus-newsgroup-headers)
8018 (when (funcall predicate header)
8019 (push (mail-header-number header) articles)))
8020 (gnus-summary-limit (nreverse articles))))
8022 (defun gnus-summary-limit-to-age (age &optional younger-p)
8023 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8024 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8025 articles that are younger than AGE days."
8027 (let ((younger current-prefix-arg)
8030 (while (not days-got)
8031 (setq days (if younger
8032 (read-string "Limit to articles younger than (in days, older when negative): ")
8034 "Limit to articles older than (in days, younger when negative): ")))
8035 (when (> (length days) 0)
8036 (setq days (read days)))
8041 (setq younger (not younger))
8042 (setq days (* days -1))))
8043 (message "Please enter a number.")
8045 (list days younger)))
8047 (let ((data gnus-newsgroup-data)
8048 (cutoff (days-to-time age))
8049 articles d date is-younger)
8050 (while (setq d (pop data))
8051 (when (and (vectorp (gnus-data-header d))
8052 (setq date (mail-header-date (gnus-data-header d))))
8053 (setq is-younger (time-less-p
8054 (time-since (condition-case ()
8061 (push (gnus-data-number d) articles))))
8062 (gnus-summary-limit (nreverse articles)))
8063 (gnus-summary-position-point)))
8065 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8066 "Limit the summary buffer to articles that match an 'extra' header."
8070 (gnus-completing-read-with-default
8071 (symbol-name (car gnus-extra-headers))
8072 (if current-prefix-arg
8073 "Exclude extra header"
8074 "Limit extra header")
8076 (cons (symbol-name x) x))
8081 (read-string (format "%s header %s (regexp): "
8082 (if current-prefix-arg "Exclude" "Limit to")
8084 current-prefix-arg)))
8085 (when (not (equal "" regexp))
8087 (let ((articles (gnus-summary-find-matching
8088 (cons 'extra header) regexp 'all nil nil
8091 (error "Found no matches for \"%s\"" regexp))
8092 (gnus-summary-limit articles))
8093 (gnus-summary-position-point))))
8095 (defun gnus-summary-limit-to-display-predicate ()
8096 "Limit the summary buffer to the predicated in the `display' group parameter."
8098 (unless gnus-newsgroup-display
8099 (error "There is no `display' group parameter"))
8101 (dolist (number gnus-newsgroup-articles)
8102 (when (funcall gnus-newsgroup-display)
8103 (push number articles)))
8104 (gnus-summary-limit articles))
8105 (gnus-summary-position-point))
8107 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8109 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8111 (defun gnus-summary-limit-to-unread (&optional all)
8112 "Limit the summary buffer to articles that are not marked as read.
8113 If ALL is non-nil, limit strictly to unread articles."
8116 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8117 (gnus-summary-limit-to-marks
8118 ;; Concat all the marks that say that an article is read and have
8120 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8121 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8122 gnus-low-score-mark gnus-expirable-mark
8123 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8124 gnus-duplicate-mark gnus-souped-mark)
8127 (defun gnus-summary-limit-to-headers (match &optional reverse)
8128 "Limit the summary buffer to articles that have headers that match MATCH.
8129 If REVERSE (the prefix), limit to articles that don't match."
8130 (interactive "sMatch headers (regexp): \nP")
8131 (gnus-summary-limit-to-bodies match reverse t))
8133 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8134 "Limit the summary buffer to articles that have bodies that match MATCH.
8135 If REVERSE (the prefix), limit to articles that don't match."
8136 (interactive "sMatch body (regexp): \nP")
8137 (let ((articles nil)
8138 (gnus-select-article-hook nil) ;Disable hook.
8139 (gnus-article-prepare-hook nil)
8140 (gnus-use-article-prefetch nil)
8141 (gnus-keep-backlog nil)
8142 (gnus-break-pages nil)
8143 (gnus-summary-display-arrow nil)
8144 (gnus-updated-mode-lines nil)
8145 (gnus-auto-center-summary nil)
8146 (gnus-display-mime-function nil))
8147 (dolist (data gnus-newsgroup-data)
8148 (let (gnus-mark-article-hook)
8149 (gnus-summary-select-article t t nil (gnus-data-number data)))
8151 (set-buffer gnus-article-buffer)
8153 (let* ((case-fold-search t)
8155 (re-search-backward match nil t)
8156 (re-search-forward match nil t))))
8157 (when (or (and found
8161 (push (gnus-data-number data) articles)))))
8163 (message "No messages matched")
8164 (gnus-summary-limit articles)))
8165 (gnus-summary-position-point))
8167 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8168 "Limit the summary buffer to articles that aren't part on any thread.
8169 If THREADSP (the prefix), limit to articles that are in threads."
8171 (let ((articles nil)
8174 (dolist (thread gnus-newsgroup-threads)
8175 (if (stringp (car thread))
8176 (dolist (thread (cdr thread))
8177 (push thread threads))
8178 (push thread threads)))
8179 (dolist (thread threads)
8180 (setq thread-articles (gnus-articles-in-thread thread))
8181 (when (or (and threadsp
8182 (> (length thread-articles) 1))
8184 (= (length thread-articles) 1)))
8185 (setq articles (nconc thread-articles articles))))
8187 (message "No messages matched")
8188 (gnus-summary-limit articles))
8189 (gnus-summary-position-point)))
8191 (defun gnus-summary-limit-to-replied (&optional unreplied)
8192 "Limit the summary buffer to replied articles.
8193 If UNREPLIED (the prefix), limit to unreplied articles."
8197 (gnus-set-difference gnus-newsgroup-articles
8198 gnus-newsgroup-replied))
8199 (gnus-summary-limit gnus-newsgroup-replied))
8200 (gnus-summary-position-point))
8202 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8203 (make-obsolete 'gnus-summary-delete-marked-with
8204 'gnus-summary-limit-exclude-marks)
8206 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8207 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8208 If REVERSE, limit the summary buffer to articles that are marked
8209 with MARKS. MARKS can either be a string of marks or a list of marks.
8210 Returns how many articles were removed."
8211 (interactive "sMarks: ")
8212 (gnus-summary-limit-to-marks marks t))
8214 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8215 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8216 If REVERSE (the prefix), limit the summary buffer to articles that are
8217 not marked with MARKS. MARKS can either be a string of marks or a
8219 Returns how many articles were removed."
8220 (interactive "sMarks: \nP")
8222 (let ((data gnus-newsgroup-data)
8223 (marks (if (listp marks) marks
8224 (append marks nil))) ; Transform to list.
8227 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8228 (memq (gnus-data-mark (car data)) marks))
8229 (push (gnus-data-number (car data)) articles))
8230 (setq data (cdr data)))
8231 (gnus-summary-limit articles))
8232 (gnus-summary-position-point)))
8234 (defun gnus-summary-limit-to-score (score)
8235 "Limit to articles with score at or above SCORE."
8236 (interactive "NLimit to articles with score of at least: ")
8237 (let ((data gnus-newsgroup-data)
8240 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8242 (push (gnus-data-number (car data)) articles))
8243 (setq data (cdr data)))
8245 (gnus-summary-limit articles)
8246 (gnus-summary-position-point))))
8248 (defun gnus-summary-limit-to-unseen ()
8249 "Limit to unseen articles."
8252 (gnus-summary-limit gnus-newsgroup-unseen)
8253 (gnus-summary-position-point)))
8255 (defun gnus-summary-limit-include-thread (id)
8256 "Display all the hidden articles that is in the thread with ID in it.
8257 When called interactively, ID is the Message-ID of the current
8259 (interactive (list (mail-header-id (gnus-summary-article-header))))
8260 (let ((articles (gnus-articles-in-thread
8261 (gnus-id-to-thread (gnus-root-id id)))))
8263 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8264 (gnus-summary-limit-include-matching-articles
8266 (regexp-quote (gnus-simplify-subject-re
8267 (mail-header-subject (gnus-id-to-header id)))))
8268 (gnus-summary-position-point))))
8270 (defun gnus-summary-limit-include-matching-articles (header regexp)
8271 "Display all the hidden articles that have HEADERs that match REGEXP."
8272 (interactive (list (read-string "Match on header: ")
8273 (read-string "Regexp: ")))
8274 (let ((articles (gnus-find-matching-articles header regexp)))
8276 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8277 (gnus-summary-position-point))))
8279 (defun gnus-summary-insert-dormant-articles ()
8280 "Insert all the dormant articles for this group into the current buffer."
8282 (let ((gnus-verbose (max 6 gnus-verbose)))
8283 (if (not gnus-newsgroup-dormant)
8284 (gnus-message 3 "No dormant articles for this group")
8285 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8287 (defun gnus-summary-insert-ticked-articles ()
8288 "Insert ticked articles for this group into the current buffer."
8290 (let ((gnus-verbose (max 6 gnus-verbose)))
8291 (if (not gnus-newsgroup-marked)
8292 (gnus-message 3 "No ticked articles for this group")
8293 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8295 (defun gnus-summary-limit-include-dormant ()
8296 "Display all the hidden articles that are marked as dormant.
8297 Note that this command only works on a subset of the articles currently
8298 fetched for this group."
8300 (unless gnus-newsgroup-dormant
8301 (error "There are no dormant articles in this group"))
8303 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8304 (gnus-summary-position-point)))
8306 (defun gnus-summary-limit-exclude-dormant ()
8307 "Hide all dormant articles."
8310 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8311 (gnus-summary-position-point)))
8313 (defun gnus-summary-limit-exclude-childless-dormant ()
8314 "Hide all dormant articles that have no children."
8316 (let ((data (gnus-data-list t))
8317 articles d children)
8318 ;; Find all articles that are either not dormant or have
8320 (while (setq d (pop data))
8321 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8323 (gnus-article-children (gnus-data-number d)))
8326 (when (memq (car children) articles)
8331 (push (gnus-data-number d) articles)))
8334 (gnus-summary-limit articles)
8335 (gnus-summary-position-point))))
8337 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8338 "Mark all unread excluded articles as read.
8339 If ALL, mark even excluded ticked and dormants as read."
8341 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8342 (let ((articles (gnus-sorted-ndifference
8344 (mapcar (lambda (h) (mail-header-number h))
8345 gnus-newsgroup-headers)
8347 gnus-newsgroup-limit))
8349 (setq gnus-newsgroup-unreads
8350 (gnus-sorted-intersection gnus-newsgroup-unreads
8351 gnus-newsgroup-limit))
8353 (setq gnus-newsgroup-dormant nil
8354 gnus-newsgroup-marked nil
8355 gnus-newsgroup-reads
8357 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8358 gnus-newsgroup-reads))
8359 (while (setq article (pop articles))
8360 (unless (or (memq article gnus-newsgroup-dormant)
8361 (memq article gnus-newsgroup-marked))
8362 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8364 (defun gnus-summary-limit (articles &optional pop)
8366 ;; We pop the previous limit off the stack and use that.
8367 (setq articles (car gnus-newsgroup-limits)
8368 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8369 ;; We use the new limit, so we push the old limit on the stack.
8370 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8372 (setq gnus-newsgroup-limit articles)
8373 (let ((total (length gnus-newsgroup-data))
8374 (data (gnus-data-find-list (gnus-summary-article-number)))
8375 (gnus-summary-mark-below nil) ; Inhibit this.
8377 ;; This will do all the work of generating the new summary buffer
8378 ;; according to the new limit.
8379 (gnus-summary-prepare)
8380 ;; Hide any threads, possibly.
8381 (gnus-summary-maybe-hide-threads)
8382 ;; Try to return to the article you were at, or one in the
8385 ;; We try to find some article after the current one.
8387 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8390 (setq data (cdr data))))
8392 ;; If there is no data, that means that we were after the last
8393 ;; article. The same goes when we can't find any articles
8394 ;; after the current one.
8395 (goto-char (point-max))
8396 (gnus-summary-find-prev))
8397 (gnus-set-mode-line 'summary)
8398 ;; We return how many articles were removed from the summary
8399 ;; buffer as a result of the new limit.
8400 (- total (length gnus-newsgroup-data))))
8402 (defsubst gnus-invisible-cut-children (threads)
8405 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8410 (defsubst gnus-cut-thread (thread)
8411 "Go forwards in the thread until we find an article that we want to display."
8412 (when (or (eq gnus-fetch-old-headers 'some)
8413 (eq gnus-fetch-old-headers 'invisible)
8414 (numberp gnus-fetch-old-headers)
8415 (eq gnus-build-sparse-threads 'some)
8416 (eq gnus-build-sparse-threads 'more))
8417 ;; Deal with old-fetched headers and sparse threads.
8421 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8422 (gnus-summary-article-ancient-p
8423 (mail-header-number (car thread))))
8424 (if (or (<= (length (cdr thread)) 1)
8425 (eq gnus-fetch-old-headers 'invisible))
8426 (setq gnus-newsgroup-limit
8427 (delq (mail-header-number (car thread))
8428 gnus-newsgroup-limit)
8429 thread (cadr thread))
8430 (when (gnus-invisible-cut-children (cdr thread))
8431 (let ((th (cdr thread)))
8433 (if (memq (mail-header-number (caar th))
8434 gnus-newsgroup-limit)
8435 (setq thread (car th)
8437 (setq th (cdr th))))))))))
8440 (defun gnus-cut-threads (threads)
8441 "Cut off all uninteresting articles from the beginning of THREADS."
8442 (when (or (eq gnus-fetch-old-headers 'some)
8443 (eq gnus-fetch-old-headers 'invisible)
8444 (numberp gnus-fetch-old-headers)
8445 (eq gnus-build-sparse-threads 'some)
8446 (eq gnus-build-sparse-threads 'more))
8449 (setcar th (gnus-cut-thread (car th)))
8450 (setq th (cdr th)))))
8451 ;; Remove nixed out threads.
8454 (defun gnus-summary-initial-limit (&optional show-if-empty)
8455 "Figure out what the initial limit is supposed to be on group entry.
8456 This entails weeding out unwanted dormants, low-scored articles,
8457 fetch-old-headers verbiage, and so on."
8458 ;; Most groups have nothing to remove.
8459 (if (or gnus-inhibit-limiting
8460 (and (null gnus-newsgroup-dormant)
8461 (eq gnus-newsgroup-display 'gnus-not-ignore)
8462 (not (eq gnus-fetch-old-headers 'some))
8463 (not (numberp gnus-fetch-old-headers))
8464 (not (eq gnus-fetch-old-headers 'invisible))
8465 (null gnus-summary-expunge-below)
8466 (not (eq gnus-build-sparse-threads 'some))
8467 (not (eq gnus-build-sparse-threads 'more))
8468 (null gnus-thread-expunge-below)
8469 (not gnus-use-nocem)))
8471 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8472 (setq gnus-newsgroup-limit nil)
8475 (unless (car (symbol-value node))
8476 ;; These threads have no parents -- they are roots.
8477 (let ((nodes (cdr (symbol-value node)))
8480 (if (and gnus-thread-expunge-below
8481 (< (gnus-thread-total-score (car nodes))
8482 gnus-thread-expunge-below))
8483 (gnus-expunge-thread (pop nodes))
8484 (setq thread (pop nodes))
8485 (gnus-summary-limit-children thread))))))
8486 gnus-newsgroup-dependencies)
8487 ;; If this limitation resulted in an empty group, we might
8488 ;; pop the previous limit and use it instead.
8489 (when (and (not gnus-newsgroup-limit)
8491 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8492 gnus-newsgroup-limit))
8494 (defun gnus-summary-limit-children (thread)
8495 "Return 1 if this subthread is visible and 0 if it is not."
8496 ;; First we get the number of visible children to this thread. This
8497 ;; is done by recursing down the thread using this function, so this
8498 ;; will really go down to a leaf article first, before slowly
8499 ;; working its way up towards the root.
8501 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8504 (apply '+ (mapcar 'gnus-summary-limit-children
8507 (number (mail-header-number (car thread)))
8510 (not (memq number gnus-newsgroup-marked))
8512 ;; If this article is dormant and has absolutely no visible
8513 ;; children, then this article isn't visible.
8514 (and (memq number gnus-newsgroup-dormant)
8516 ;; If this is "fetch-old-headered" and there is no
8517 ;; visible children, then we don't want this article.
8518 (and (or (eq gnus-fetch-old-headers 'some)
8519 (numberp gnus-fetch-old-headers))
8520 (gnus-summary-article-ancient-p number)
8522 ;; If this is "fetch-old-headered" and `invisible', then
8523 ;; we don't want this article.
8524 (and (eq gnus-fetch-old-headers 'invisible)
8525 (gnus-summary-article-ancient-p number))
8526 ;; If this is a sparsely inserted article with no children,
8527 ;; we don't want it.
8528 (and (eq gnus-build-sparse-threads 'some)
8529 (gnus-summary-article-sparse-p number)
8531 ;; If we use expunging, and this article is really
8532 ;; low-scored, then we don't want this article.
8533 (when (and gnus-summary-expunge-below
8535 (or (cdr (assq number gnus-newsgroup-scored))
8536 gnus-summary-default-score))
8537 gnus-summary-expunge-below))
8538 ;; We increase the expunge-tally here, but that has
8539 ;; nothing to do with the limits, really.
8540 (incf gnus-newsgroup-expunged-tally)
8541 ;; We also mark as read here, if that's wanted.
8542 (when (and gnus-summary-mark-below
8543 (< score gnus-summary-mark-below))
8544 (setq gnus-newsgroup-unreads
8545 (delq number gnus-newsgroup-unreads))
8546 (if gnus-newsgroup-auto-expire
8547 (push number gnus-newsgroup-expirable)
8548 (push (cons number gnus-low-score-mark)
8549 gnus-newsgroup-reads)))
8551 ;; Do the `display' group parameter.
8552 (and gnus-newsgroup-display
8553 (not (funcall gnus-newsgroup-display)))
8554 ;; Check NoCeM things.
8555 (when (and gnus-use-nocem
8556 (gnus-nocem-unwanted-article-p
8557 (mail-header-id (car thread))))
8558 (setq gnus-newsgroup-unreads
8559 (delq number gnus-newsgroup-unreads))
8561 ;; Nope, invisible article.
8563 ;; Ok, this article is to be visible, so we add it to the limit
8565 (push number gnus-newsgroup-limit)
8568 (defun gnus-expunge-thread (thread)
8569 "Mark all articles in THREAD as read."
8570 (let* ((number (mail-header-number (car thread))))
8571 (incf gnus-newsgroup-expunged-tally)
8572 ;; We also mark as read here, if that's wanted.
8573 (setq gnus-newsgroup-unreads
8574 (delq number gnus-newsgroup-unreads))
8575 (if gnus-newsgroup-auto-expire
8576 (push number gnus-newsgroup-expirable)
8577 (push (cons number gnus-low-score-mark)
8578 gnus-newsgroup-reads)))
8579 ;; Go recursively through all subthreads.
8580 (mapcar 'gnus-expunge-thread (cdr thread)))
8582 ;; Summary article oriented commands
8584 (defun gnus-summary-refer-parent-article (n)
8585 "Refer parent article N times.
8586 If N is negative, go to ancestor -N instead.
8587 The difference between N and the number of articles fetched is returned."
8591 (when (not (natnump n))
8596 (setq header (gnus-summary-article-header))
8597 (if (and (eq (mail-header-number header)
8598 (cdr gnus-article-current))
8599 (equal gnus-newsgroup-name
8600 (car gnus-article-current)))
8601 ;; If we try to find the parent of the currently
8602 ;; displayed article, then we take a look at the actual
8603 ;; References header, since this is slightly more
8604 ;; reliable than the References field we got from the
8607 (set-buffer gnus-original-article-buffer)
8608 (nnheader-narrow-to-headers)
8609 (unless (setq ref (message-fetch-field "references"))
8610 (when (setq ref (message-fetch-field "in-reply-to"))
8611 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8614 ;; It's not the current article, so we take a bet on
8615 ;; the value we got from the server.
8616 (mail-header-references header)))
8618 (not (equal ref "")))
8619 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8620 (gnus-message 1 "Couldn't find parent"))
8621 (gnus-message 1 "No references in article %d"
8622 (gnus-summary-article-number))
8625 (gnus-summary-position-point)
8628 (defun gnus-summary-refer-references ()
8629 "Fetch all articles mentioned in the References header.
8630 Return the number of articles fetched."
8632 (let ((ref (mail-header-references (gnus-summary-article-header)))
8633 (current (gnus-summary-article-number))
8637 (error "No References in the current article")
8638 ;; For each Message-ID in the References header...
8639 (while (string-match "<[^>]*>" ref)
8641 ;; ... fetch that article.
8642 (gnus-summary-refer-article
8643 (prog1 (match-string 0 ref)
8644 (setq ref (substring ref (match-end 0))))))
8645 (gnus-summary-goto-subject current)
8646 (gnus-summary-position-point)
8649 (defun gnus-summary-refer-thread (&optional limit)
8650 "Fetch all articles in the current thread.
8651 If LIMIT (the numerical prefix), fetch that many old headers instead
8652 of what's specified by the `gnus-refer-thread-limit' variable."
8654 (let ((id (mail-header-id (gnus-summary-article-header)))
8655 (limit (if limit (prefix-numeric-value limit)
8656 gnus-refer-thread-limit)))
8657 (unless (eq gnus-fetch-old-headers 'invisible)
8658 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8659 ;; Retrieve the headers and read them in.
8660 (if (eq (if (numberp limit)
8661 (gnus-retrieve-headers
8663 (+ (mail-header-number
8664 (gnus-summary-article-header))
8666 gnus-newsgroup-end))
8667 gnus-newsgroup-name (* limit 2))
8668 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8670 (gnus-retrieve-headers (list gnus-newsgroup-end)
8671 gnus-newsgroup-name limit))
8673 (gnus-build-all-threads)
8674 (error "Can't fetch thread from back ends that don't support NOV"))
8675 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8676 (gnus-summary-limit-include-thread id)))
8678 (defun gnus-summary-refer-article (message-id)
8679 "Fetch an article specified by MESSAGE-ID."
8680 (interactive "sMessage-ID: ")
8681 (when (and (stringp message-id)
8682 (not (zerop (length message-id))))
8683 (setq message-id (gnus-replace-in-string message-id " " ""))
8684 ;; Construct the correct Message-ID if necessary.
8685 ;; Suggested by tale@pawl.rpi.edu.
8686 (unless (string-match "^<" message-id)
8687 (setq message-id (concat "<" message-id)))
8688 (unless (string-match ">$" message-id)
8689 (setq message-id (concat message-id ">")))
8690 ;; People often post MIDs from URLs, so unhex it:
8691 (unless (string-match "@" message-id)
8692 (setq message-id (gnus-url-unhex-string message-id)))
8693 (let* ((header (gnus-id-to-header message-id))
8695 (gnus-summary-article-sparse-p
8696 (mail-header-number header))
8697 (memq (mail-header-number header)
8698 gnus-newsgroup-limit)))
8701 ;; If the article is present in the buffer we just go to it.
8703 (or (not (gnus-summary-article-sparse-p
8704 (mail-header-number header)))
8707 (gnus-summary-goto-article
8708 (mail-header-number header) nil t)
8710 (gnus-summary-update-article (mail-header-number header)))))
8712 ;; We fetch the article.
8714 (dolist (gnus-override-method (gnus-refer-article-methods))
8715 (when (and (gnus-check-server gnus-override-method)
8716 ;; Fetch the header,
8717 (setq number (gnus-summary-insert-subject message-id)))
8718 ;; and display the article.
8719 (gnus-summary-select-article nil nil nil number)
8721 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8723 (defun gnus-refer-article-methods ()
8724 "Return a list of referable methods."
8726 ;; No method, so we default to current and native.
8727 ((null gnus-refer-article-method)
8728 (list gnus-current-select-method gnus-select-method))
8730 ((eq 'current gnus-refer-article-method)
8731 (list gnus-current-select-method))
8732 ;; List of select methods.
8733 ((not (and (symbolp (car gnus-refer-article-method))
8734 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8736 (dolist (method gnus-refer-article-method)
8737 (push (if (eq 'current method)
8738 gnus-current-select-method
8742 ;; One single select method.
8744 (list gnus-refer-article-method))))
8746 (defun gnus-summary-edit-parameters ()
8747 "Edit the group parameters of the current group."
8749 (gnus-group-edit-group gnus-newsgroup-name 'params))
8751 (defun gnus-summary-customize-parameters ()
8752 "Customize the group parameters of the current group."
8754 (gnus-group-customize gnus-newsgroup-name))
8756 (defun gnus-summary-enter-digest-group (&optional force)
8757 "Enter an nndoc group based on the current article.
8758 If FORCE, force a digest interpretation. If not, try
8759 to guess what the document format is."
8761 (let ((conf gnus-current-window-configuration))
8762 (save-window-excursion
8764 (let (gnus-article-prepare-hook
8765 gnus-display-mime-function
8767 (gnus-summary-select-article))))
8768 (setq gnus-current-window-configuration conf)
8769 (let* ((name (format "%s-%d"
8770 (gnus-group-prefixed-name
8771 gnus-newsgroup-name (list 'nndoc ""))
8772 (with-current-buffer gnus-summary-buffer
8773 gnus-current-article)))
8774 (ogroup gnus-newsgroup-name)
8775 (params (append (gnus-info-params (gnus-get-info ogroup))
8776 (list (cons 'to-group ogroup))
8777 (list (cons 'parent-group ogroup))
8778 (list (cons 'save-article-group ogroup))))
8779 (case-fold-search t)
8780 (buf (current-buffer))
8783 (set-buffer gnus-original-article-buffer)
8784 ;; Have the digest group inherit the main mail address of
8785 ;; the parent article.
8786 (when (setq to-address (or (gnus-fetch-field "reply-to")
8787 (gnus-fetch-field "from")))
8790 (list (cons 'to-address
8791 (funcall gnus-decode-encoded-address-function
8793 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8794 (insert-buffer-substring gnus-original-article-buffer)
8795 ;; Remove lines that may lead nndoc to misinterpret the
8798 (goto-char (point-min))
8799 (or (search-forward "\n\n" nil t) (point)))
8800 (goto-char (point-min))
8801 (delete-matching-lines "^Path:\\|^From ")
8804 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8805 (gnus-newsgroup-ephemeral-ignored-charsets
8806 gnus-newsgroup-ignored-charsets))
8807 (gnus-group-read-ephemeral-group
8808 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8810 ,(if force 'mbox 'guess)))
8812 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8814 ;; Make all postings to this group go to the parent group.
8815 (nconc (gnus-info-params (gnus-get-info name))
8817 ;; Couldn't select this doc group.
8818 (switch-to-buffer buf)
8819 (gnus-set-global-variables)
8820 (gnus-configure-windows 'summary)
8821 (gnus-message 3 "Article couldn't be entered?"))
8822 (kill-buffer dig)))))
8824 (defun gnus-summary-read-document (n)
8825 "Open a new group based on the current article(s).
8826 This will allow you to read digests and other similar
8827 documents as newsgroups.
8828 Obeys the standard process/prefix convention."
8830 (let* ((ogroup gnus-newsgroup-name)
8831 (params (append (gnus-info-params (gnus-get-info ogroup))
8832 (list (cons 'to-group ogroup))))
8833 group egroup groups vgroup)
8834 (dolist (article (gnus-summary-work-articles n))
8835 (setq group (format "%s-%d" gnus-newsgroup-name article))
8836 (gnus-summary-remove-process-mark article)
8837 (when (gnus-summary-display-article article)
8840 (insert-buffer-substring gnus-original-article-buffer)
8841 ;; Remove some headers that may lead nndoc to make
8843 (message-narrow-to-head)
8844 (goto-char (point-min))
8845 (delete-matching-lines "^Path:\\|^From ")
8848 (gnus-group-read-ephemeral-group
8849 group `(nndoc ,group (nndoc-address ,(current-buffer))
8850 (nndoc-article-type guess))
8853 ;; Make all postings to this group go to the parent group.
8854 (nconc (gnus-info-params (gnus-get-info egroup))
8856 (push egroup groups))
8857 ;; Couldn't select this doc group.
8858 (gnus-error 3 "Article couldn't be entered"))))))
8859 ;; Now we have selected all the documents.
8862 (error "None of the articles could be interpreted as documents"))
8863 ((gnus-group-read-ephemeral-group
8864 (setq vgroup (format
8865 "nnvirtual:%s-%s" gnus-newsgroup-name
8866 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8867 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8869 (cons (current-buffer) 'summary)))
8871 (error "Couldn't select virtual nndoc group")))))
8873 (defun gnus-summary-isearch-article (&optional regexp-p)
8874 "Do incremental search forward on the current article.
8875 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8877 (gnus-summary-select-article)
8878 (gnus-configure-windows 'article)
8879 (gnus-eval-in-buffer-window gnus-article-buffer
8882 (isearch-forward regexp-p))))
8884 (defun gnus-summary-repeat-search-article-forward ()
8885 "Repeat the previous search forwards."
8887 (unless gnus-last-search-regexp
8888 (error "No previous search"))
8889 (gnus-summary-search-article-forward gnus-last-search-regexp))
8891 (defun gnus-summary-repeat-search-article-backward ()
8892 "Repeat the previous search backwards."
8894 (unless gnus-last-search-regexp
8895 (error "No previous search"))
8896 (gnus-summary-search-article-forward gnus-last-search-regexp t))
8898 (defun gnus-summary-search-article-forward (regexp &optional backward)
8899 "Search for an article containing REGEXP forward.
8900 If BACKWARD, search backward instead."
8903 (format "Search article %s (regexp%s): "
8904 (if current-prefix-arg "backward" "forward")
8905 (if gnus-last-search-regexp
8906 (concat ", default " gnus-last-search-regexp)
8908 current-prefix-arg))
8909 (if (string-equal regexp "")
8910 (setq regexp (or gnus-last-search-regexp ""))
8911 (setq gnus-last-search-regexp regexp)
8912 (setq gnus-article-before-search gnus-current-article))
8913 ;; Intentionally set gnus-last-article.
8914 (setq gnus-last-article gnus-article-before-search)
8915 (let ((gnus-last-article gnus-last-article))
8916 (if (gnus-summary-search-article regexp backward)
8917 (gnus-summary-show-thread)
8918 (signal 'search-failed (list regexp)))))
8920 (defun gnus-summary-search-article-backward (regexp)
8921 "Search for an article containing REGEXP backward."
8924 (format "Search article backward (regexp%s): "
8925 (if gnus-last-search-regexp
8926 (concat ", default " gnus-last-search-regexp)
8928 (gnus-summary-search-article-forward regexp 'backward))
8930 (defun gnus-summary-search-article (regexp &optional backward)
8931 "Search for an article containing REGEXP.
8932 Optional argument BACKWARD means do search for backward.
8933 `gnus-select-article-hook' is not called during the search."
8934 ;; We have to require this here to make sure that the following
8935 ;; dynamic binding isn't shadowed by autoloading.
8936 (require 'gnus-async)
8938 (let ((gnus-select-article-hook nil) ;Disable hook.
8939 (gnus-article-prepare-hook nil)
8940 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8941 (gnus-use-article-prefetch nil)
8942 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8943 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8945 (gnus-keep-backlog nil)
8946 (gnus-break-pages nil)
8947 (gnus-summary-display-arrow nil)
8948 (gnus-updated-mode-lines nil)
8949 (gnus-auto-center-summary nil)
8950 (sum (current-buffer))
8951 (gnus-display-mime-function nil)
8954 (gnus-save-hidden-threads
8955 (gnus-summary-select-article)
8956 (set-buffer gnus-article-buffer)
8957 (goto-char (window-point (get-buffer-window (current-buffer))))
8961 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8963 (re-search-backward regexp nil t)
8964 (re-search-forward regexp nil t))
8965 ;; We found the regexp.
8970 (get-buffer-window (current-buffer))
8974 (get-buffer-window (current-buffer))
8977 (setq point (point)))
8978 ;; We didn't find it, so we go to the next article.
8981 (while (eq found 'not)
8982 (if (not (if backward (gnus-summary-find-prev)
8983 (gnus-summary-find-next)))
8984 ;; No more articles.
8986 ;; Select the next article and adjust point.
8987 (unless (gnus-summary-article-sparse-p
8988 (gnus-summary-article-number))
8990 (gnus-summary-select-article)
8991 (set-buffer gnus-article-buffer)
8993 (goto-char (if backward (point-max) (point-min))))))))
8994 (gnus-message 7 ""))
8995 ;; Return whether we found the regexp.
8996 (when (eq found 'found)
8998 (gnus-summary-show-thread)
8999 (gnus-summary-goto-subject gnus-current-article)
9000 (gnus-summary-position-point)
9003 (defun gnus-find-matching-articles (header regexp)
9004 "Return a list of all articles that match REGEXP on HEADER.
9005 This search includes all articles in the current group that Gnus has
9006 fetched headers for, whether they are displayed or not."
9007 (let ((articles nil)
9008 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9009 (case-fold-search t))
9010 (dolist (header gnus-newsgroup-headers)
9011 (when (string-match regexp (funcall func header))
9012 (push (mail-header-number header) articles)))
9013 (nreverse articles)))
9015 (defun gnus-summary-find-matching (header regexp &optional backward unread
9016 not-case-fold not-matching)
9017 "Return a list of all articles that match REGEXP on HEADER.
9018 The search stars on the current article and goes forwards unless
9019 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9020 If UNREAD is non-nil, only unread articles will
9021 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9022 in the comparisons. If NOT-MATCHING, return a list of all articles that
9023 not match REGEXP on HEADER."
9024 (let ((case-fold-search (not not-case-fold))
9027 (if (eq (car header) 'extra)
9030 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9032 (error "%s is an invalid header" header))
9033 (unless (fboundp (intern (concat "mail-header-" header)))
9034 (error "%s is not a valid header" header))
9035 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9036 (dolist (d (if (eq backward 'all)
9038 (gnus-data-find-list
9039 (gnus-summary-article-number)
9040 (gnus-data-list backward))))
9041 (when (and (or (not unread) ; We want all articles...
9042 (gnus-data-unread-p d)) ; Or just unreads.
9043 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9047 (funcall func (gnus-data-header d))))
9048 (string-match regexp
9049 (funcall func (gnus-data-header d)))))
9050 (push (gnus-data-number d) articles))) ; Success!
9051 (nreverse articles)))
9053 (defun gnus-summary-execute-command (header regexp command &optional backward)
9054 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9055 If HEADER is an empty string (or nil), the match is done on the entire
9056 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9058 (list (let ((completion-ignore-case t))
9061 (mapcar (lambda (header) (list (format "%s" header)))
9063 '("Number" "Subject" "From" "Lines" "Date"
9064 "Message-ID" "Xref" "References" "Body")
9065 gnus-extra-headers))
9066 nil 'require-match))
9067 (read-string "Regexp: ")
9068 (read-key-sequence "Command: ")
9069 current-prefix-arg))
9070 (when (equal header "Body")
9072 ;; Hidden thread subtrees must be searched as well.
9073 (gnus-summary-show-all-threads)
9074 ;; We don't want to change current point nor window configuration.
9076 (save-window-excursion
9078 gnus-treat-strip-trailing-blank-lines
9079 gnus-treat-strip-leading-blank-lines
9080 gnus-treat-strip-multiple-blank-lines
9081 gnus-treat-hide-boring-headers
9082 gnus-treat-fold-newsgroups
9083 gnus-article-prepare-hook)
9084 (gnus-message 6 "Executing %s..." (key-description command))
9085 ;; We'd like to execute COMMAND interactively so as to give arguments.
9086 (gnus-execute header regexp
9087 `(call-interactively ',(key-binding command))
9089 (gnus-message 6 "Executing %s...done" (key-description command))))))
9091 (defun gnus-summary-beginning-of-article ()
9092 "Scroll the article back to the beginning."
9094 (gnus-summary-select-article)
9095 (gnus-configure-windows 'article)
9096 (gnus-eval-in-buffer-window gnus-article-buffer
9098 (goto-char (point-min))
9099 (when gnus-break-pages
9100 (gnus-narrow-to-page))))
9102 (defun gnus-summary-end-of-article ()
9103 "Scroll to the end of the article."
9105 (gnus-summary-select-article)
9106 (gnus-configure-windows 'article)
9107 (gnus-eval-in-buffer-window gnus-article-buffer
9109 (goto-char (point-max))
9111 (when gnus-break-pages
9112 (when (re-search-backward page-delimiter nil t)
9113 (narrow-to-region (match-end 0) (point-max)))
9114 (gnus-narrow-to-page))))
9116 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9117 "Truncate to LEN and quote all \"(\"'s in STRING."
9118 (gnus-replace-in-string (if (and len (> (length string) len))
9119 (substring string 0 len)
9123 (defun gnus-summary-print-article (&optional filename n)
9124 "Generate and print a PostScript image of the process-marked (mail) articles.
9126 If used interactively, print the current article if none are
9127 process-marked. With prefix arg, prompt the user for the name of the
9130 When used from Lisp, accept two optional args FILENAME and N. N means
9131 to print the next N articles. If N is negative, print the N previous
9132 articles. If N is nil and articles have been marked with the process
9133 mark, print these instead.
9135 If the optional first argument FILENAME is nil, send the image to the
9136 printer. If FILENAME is a string, save the PostScript image in a file with
9137 that name. If FILENAME is a number, prompt the user for the name of the file
9139 (interactive (list (ps-print-preprint current-prefix-arg)))
9140 (dolist (article (gnus-summary-work-articles n))
9141 (gnus-summary-select-article nil nil 'pseudo article)
9142 (gnus-eval-in-buffer-window gnus-article-buffer
9143 (gnus-print-buffer))
9144 (gnus-summary-remove-process-mark article))
9145 (ps-despool filename))
9147 (defun gnus-print-buffer ()
9148 (let ((buffer (generate-new-buffer " *print*")))
9151 (copy-to-buffer buffer (point-min) (point-max))
9153 (gnus-remove-text-with-property 'gnus-decoration)
9154 (when (gnus-visual-p 'article-highlight 'highlight)
9155 ;; Copy-to-buffer doesn't copy overlay. So redo
9157 (let ((gnus-article-buffer buffer))
9158 (gnus-article-highlight-citation t)
9159 (gnus-article-highlight-signature)
9160 (gnus-article-emphasize)
9161 (gnus-article-delete-invisible-text)))
9162 (let ((ps-left-header
9165 (gnus-summary-print-truncate-and-quote
9166 (mail-header-subject gnus-current-headers)
9169 (gnus-summary-print-truncate-and-quote
9170 (mail-header-from gnus-current-headers)
9174 "/pagenumberstring load"
9176 (mail-header-date gnus-current-headers) ")"))))
9177 (gnus-run-hooks 'gnus-ps-print-hook)
9180 (ps-spool-buffer-with-faces)
9181 (ps-spool-buffer)))))
9182 (kill-buffer buffer))))
9184 (defun gnus-summary-show-article (&optional arg)
9185 "Force redisplaying of the current article.
9186 If ARG (the prefix) is a number, show the article with the charset
9187 defined in `gnus-summary-show-article-charset-alist', or the charset
9189 If ARG (the prefix) is non-nil and not a number, show the raw article
9190 without any article massaging functions being run. Normally, the key
9191 strokes are `C-u g'."
9195 (gnus-summary-show-article t)
9196 (let ((gnus-newsgroup-charset
9197 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9198 (mm-read-coding-system
9199 "View as charset: " ;; actually it is coding system.
9200 (with-current-buffer gnus-article-buffer
9201 (mm-detect-coding-region (point) (point-max))))))
9202 (gnus-newsgroup-ignored-charsets 'gnus-all))
9203 (gnus-summary-select-article nil 'force)
9204 (let ((deps gnus-newsgroup-dependencies)
9207 (set-buffer gnus-original-article-buffer)
9209 (message-narrow-to-head)
9210 (setq head (buffer-string))
9211 (goto-char (point-min))
9212 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9213 (goto-char (point-max))
9215 (setq lines (1- (count-lines (point) (point-max))))))
9217 (insert (format "211 %d Article retrieved.\n"
9218 (cdr gnus-article-current)))
9220 (if lines (insert (format "Lines: %d\n" lines)))
9222 (let ((nntp-server-buffer (current-buffer)))
9223 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9224 (gnus-data-set-header
9225 (gnus-data-find (cdr gnus-article-current))
9227 (gnus-summary-update-article-line
9228 (cdr gnus-article-current) header)
9229 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9230 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9232 ;; Select the article the normal way.
9233 (gnus-summary-select-article nil 'force))
9235 ;; We have to require this here to make sure that the following
9236 ;; dynamic binding isn't shadowed by autoloading.
9237 (require 'gnus-async)
9239 ;; Bind the article treatment functions to nil.
9240 (let ((gnus-have-all-headers t)
9241 gnus-article-prepare-hook
9242 gnus-article-decode-hook
9243 gnus-display-mime-function
9245 ;; Destroy any MIME parts.
9246 (when (gnus-buffer-live-p gnus-article-buffer)
9248 (set-buffer gnus-article-buffer)
9249 (mm-destroy-parts gnus-article-mime-handles)
9250 ;; Set it to nil for safety reason.
9251 (setq gnus-article-mime-handle-alist nil)
9252 (setq gnus-article-mime-handles nil)))
9253 (gnus-summary-select-article nil 'force))))
9254 (gnus-summary-goto-subject gnus-current-article)
9255 (gnus-summary-position-point))
9257 (defun gnus-summary-show-raw-article ()
9258 "Show the raw article without any article massaging functions being run."
9260 (gnus-summary-show-article t))
9262 (defun gnus-summary-verbose-headers (&optional arg)
9263 "Toggle permanent full header display.
9264 If ARG is a positive number, turn header display on.
9265 If ARG is a negative number, turn header display off."
9267 (setq gnus-show-all-headers
9268 (cond ((or (not (numberp arg))
9270 (not gnus-show-all-headers))
9273 (gnus-summary-show-article))
9275 (defun gnus-summary-toggle-header (&optional arg)
9276 "Show the headers if they are hidden, or hide them if they are shown.
9277 If ARG is a positive number, show the entire header.
9278 If ARG is a negative number, hide the unwanted header lines."
9280 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9281 (get-buffer-window gnus-article-buffer t))))
9282 (with-current-buffer gnus-article-buffer
9284 (article-narrow-to-head)
9285 (let* ((buffer-read-only nil)
9286 (inhibit-point-motion-hooks t)
9287 (hidden (if (numberp arg)
9289 (or (not (looking-at "[^ \t\n]+:"))
9290 (gnus-article-hidden-text-p 'headers))))
9292 (delete-region (point-min) (point-max))
9293 (with-current-buffer gnus-original-article-buffer
9294 (goto-char (setq s (point-min)))
9295 (setq e (if (search-forward "\n\n" nil t)
9298 (insert-buffer-substring gnus-original-article-buffer s e)
9299 (run-hooks 'gnus-article-decode-hook)
9301 (let ((gnus-treat-hide-headers nil)
9302 (gnus-treat-hide-boring-headers nil))
9303 (gnus-delete-wash-type 'headers)
9304 (gnus-treat-article 'head))
9305 (gnus-treat-article 'head))
9308 (set-window-start window (goto-char (point-min))))
9309 (if gnus-break-pages
9310 (gnus-narrow-to-page)
9311 (when (gnus-visual-p 'page-marker)
9312 (let ((buffer-read-only nil))
9313 (gnus-remove-text-with-property 'gnus-prev)
9314 (gnus-remove-text-with-property 'gnus-next))))
9315 (gnus-set-mode-line 'article)))))
9317 (defun gnus-summary-show-all-headers ()
9318 "Make all header lines visible."
9320 (gnus-summary-toggle-header 1))
9322 (defun gnus-summary-caesar-message (&optional arg)
9323 "Caesar rotate the current article by 13.
9324 With a non-numerical prefix, also rotate headers. A numerical
9325 prefix specifies how many places to rotate each letter forward."
9327 (gnus-summary-select-article)
9328 (let ((mail-header-separator ""))
9329 (gnus-eval-in-buffer-window gnus-article-buffer
9332 (let ((start (window-start))
9334 (if (equal arg '(4))
9335 (message-caesar-buffer-body nil t)
9336 (message-caesar-buffer-body arg))
9337 (set-window-start (get-buffer-window (current-buffer)) start)))))
9338 ;; Create buttons and stuff...
9339 (gnus-treat-article nil))
9341 (defun gnus-summary-idna-message (&optional arg)
9342 "Decode IDNA encoded domain names in the current articles.
9343 IDNA encoded domain names looks like `xn--bar'. If a string
9344 remain unencoded after running this function, it is likely an
9345 invalid IDNA string (`xn--bar' is invalid).
9347 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9348 installed for this command to work."
9350 (if (not (and (condition-case nil (require 'idna)
9352 (mm-coding-system-p 'utf-8)
9353 (executable-find (symbol-value 'idna-program))))
9355 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9356 (gnus-summary-select-article)
9357 (let ((mail-header-separator ""))
9358 (gnus-eval-in-buffer-window gnus-article-buffer
9361 (let ((start (window-start))
9363 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9364 (replace-match (idna-to-unicode (match-string 1))))
9365 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9367 (defun gnus-summary-morse-message (&optional arg)
9368 "Morse decode the current article."
9370 (gnus-summary-select-article)
9371 (let ((mail-header-separator ""))
9372 (gnus-eval-in-buffer-window gnus-article-buffer
9376 (let ((pos (window-start))
9378 (goto-char (point-min))
9379 (when (message-goto-body)
9380 (gnus-narrow-to-body))
9381 (goto-char (point-min))
9382 (while (search-forward "·" (point-max) t)
9383 (replace-match "."))
9384 (unmorse-region (point-min) (point-max))
9386 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9388 (defun gnus-summary-stop-page-breaking ()
9389 "Stop page breaking in the current article."
9391 (gnus-summary-select-article)
9392 (gnus-eval-in-buffer-window gnus-article-buffer
9394 (when (gnus-visual-p 'page-marker)
9395 (let ((buffer-read-only nil))
9396 (gnus-remove-text-with-property 'gnus-prev)
9397 (gnus-remove-text-with-property 'gnus-next))
9398 (setq gnus-page-broken nil))))
9400 (defun gnus-summary-move-article (&optional n to-newsgroup
9401 select-method action)
9402 "Move the current article to a different newsgroup.
9403 If N is a positive number, move the N next articles.
9404 If N is a negative number, move the N previous articles.
9405 If N is nil and any articles have been marked with the process mark,
9406 move those articles instead.
9407 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9408 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9409 re-spool using this method.
9411 When called interactively with TO-NEWSGROUP being nil, the value of
9412 the variable `gnus-move-split-methods' is used for finding a default
9413 for the target newsgroup.
9415 For this function to work, both the current newsgroup and the
9416 newsgroup that you want to move to have to support the `request-move'
9417 and `request-accept' functions.
9419 ACTION can be either `move' (the default), `crosspost' or `copy'."
9422 (setq action 'move))
9423 ;; Check whether the source group supports the required functions.
9424 (cond ((and (eq action 'move)
9425 (not (gnus-check-backend-function
9426 'request-move-article gnus-newsgroup-name)))
9427 (error "The current group does not support article moving"))
9428 ((and (eq action 'crosspost)
9429 (not (gnus-check-backend-function
9430 'request-replace-article gnus-newsgroup-name)))
9431 (error "The current group does not support article editing")))
9432 (let ((articles (gnus-summary-work-articles n))
9433 (prefix (if (gnus-check-backend-function
9434 'request-move-article gnus-newsgroup-name)
9435 (funcall gnus-move-group-prefix-function
9436 gnus-newsgroup-name)
9438 (names '((move "Move" "Moving")
9439 (copy "Copy" "Copying")
9440 (crosspost "Crosspost" "Crossposting")))
9441 (copy-buf (save-excursion
9442 (nnheader-set-temp-buffer " *copy article*")))
9443 art-group to-method new-xref article to-groups articles-to-update-marks)
9444 (unless (assq action names)
9445 (error "Unknown action %s" action))
9446 ;; Read the newsgroup name.
9447 (when (and (not to-newsgroup)
9448 (not select-method))
9449 (if (and gnus-move-split-methods
9451 (and (memq gnus-current-article articles)
9452 (gnus-buffer-live-p gnus-original-article-buffer))))
9453 ;; When `gnus-move-split-methods' is non-nil, we have to
9454 ;; select an article to give `gnus-read-move-group-name' an
9455 ;; opportunity to suggest an appropriate default. However,
9456 ;; we needn't render or mark the article.
9457 (let ((gnus-display-mime-function nil)
9458 (gnus-article-prepare-hook nil)
9459 (gnus-mark-article-hook nil))
9460 (gnus-summary-select-article nil nil nil (car articles))))
9462 (gnus-read-move-group-name
9463 (cadr (assq action names))
9464 (symbol-value (intern (format "gnus-current-%s-group" action)))
9466 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9467 (setq to-method (or select-method
9468 (gnus-server-to-method
9469 (gnus-group-method to-newsgroup))))
9470 ;; Check the method we are to move this article to...
9471 (unless (gnus-check-backend-function
9472 'request-accept-article (car to-method))
9473 (error "%s does not support article copying" (car to-method)))
9474 (unless (gnus-check-server to-method)
9475 (error "Can't open server %s" (car to-method)))
9476 (gnus-message 6 "%s to %s: %s..."
9477 (caddr (assq action names))
9478 (or (car select-method) to-newsgroup) articles)
9480 (setq article (pop articles))
9484 ;; Move the article.
9486 ;; Remove this article from future suppression.
9487 (gnus-dup-unsuppress-article article)
9488 (let* ((from-method (gnus-find-method-for-group
9489 gnus-newsgroup-name))
9490 (to-method (gnus-find-method-for-group
9492 (move-is-internal (gnus-method-equal from-method to-method)))
9493 (gnus-request-move-article
9494 article ; Article to move
9495 gnus-newsgroup-name ; From newsgroup
9496 (nth 1 (gnus-find-method-for-group
9497 gnus-newsgroup-name)) ; Server
9498 (list 'gnus-request-accept-article
9499 to-newsgroup (list 'quote select-method)
9500 (not articles) t) ; Accept form
9501 (not articles) ; Only save nov last time
9502 move-is-internal))) ; is this move internal?
9503 ;; Copy the article.
9506 (set-buffer copy-buf)
9507 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9509 (nnheader-narrow-to-headers)
9510 (dolist (hdr gnus-copy-article-ignored-headers)
9511 (message-remove-header hdr t)))
9512 (gnus-request-accept-article
9513 to-newsgroup select-method (not articles) t))))
9514 ;; Crosspost the article.
9515 ((eq action 'crosspost)
9516 (let ((xref (message-tokenize-header
9517 (mail-header-xref (gnus-summary-article-header article))
9519 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9520 ":" (number-to-string article)))
9522 (setq xref (list (system-name))))
9525 (mapconcat 'identity
9526 (delete "Xref:" (delete new-xref xref))
9530 (set-buffer copy-buf)
9531 ;; First put the article in the destination group.
9532 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9533 (when (consp (setq art-group
9534 (gnus-request-accept-article
9535 to-newsgroup select-method (not articles) t)))
9536 (setq new-xref (concat new-xref " " (car art-group)
9538 (number-to-string (cdr art-group))))
9539 ;; Now we have the new Xrefs header, so we insert
9540 ;; it and replace the new article.
9541 (nnheader-replace-header "Xref" new-xref)
9542 (gnus-request-replace-article
9543 (cdr art-group) to-newsgroup (current-buffer) t)
9547 (gnus-message 1 "Couldn't %s article %s: %s"
9548 (cadr (assq action names)) article
9549 (nnheader-get-report (car to-method))))
9550 ((eq art-group 'junk)
9551 (when (eq action 'move)
9552 (gnus-summary-mark-article article gnus-canceled-mark)
9553 (gnus-message 4 "Deleted article %s" article)
9554 ;; run the delete hook
9555 (run-hook-with-args 'gnus-summary-article-delete-hook
9558 (assoc article (gnus-data-list nil)))
9559 gnus-newsgroup-name nil
9562 (let* ((pto-group (gnus-group-prefixed-name
9563 (car art-group) to-method))
9564 (info (gnus-get-info pto-group))
9565 (to-group (gnus-info-group info))
9567 ;; Update the group that has been moved to.
9569 (memq action '(move copy)))
9570 (unless (member to-group to-groups)
9571 (push to-group to-groups))
9573 (unless (memq article gnus-newsgroup-unreads)
9574 (push 'read to-marks)
9576 info (gnus-add-to-range (gnus-info-read info)
9577 (list (cdr art-group)))))
9579 ;; See whether the article is to be put in the cache.
9580 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9581 gnus-article-mark-lists
9582 (delete '(expirable . expire)
9583 (copy-sequence gnus-article-mark-lists))))
9584 (to-article (cdr art-group)))
9586 ;; Enter the article into the cache in the new group,
9587 ;; if that is required.
9588 (when gnus-use-cache
9589 (gnus-cache-possibly-enter-article
9591 (memq article gnus-newsgroup-marked)
9592 (memq article gnus-newsgroup-dormant)
9593 (memq article gnus-newsgroup-unreads)))
9595 (when gnus-preserve-marks
9596 ;; Copy any marks over to the new group.
9597 (when (and (equal to-group gnus-newsgroup-name)
9598 (not (memq article gnus-newsgroup-unreads)))
9599 ;; Mark this article as read in this group.
9600 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9601 (setcdr (gnus-active to-group) to-article)
9602 (setcdr gnus-newsgroup-active to-article))
9605 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9606 (when (memq article (symbol-value
9607 (intern (format "gnus-newsgroup-%s"
9609 (push (cdar marks) to-marks)
9610 ;; If the other group is the same as this group,
9611 ;; then we have to add the mark to the list.
9612 (when (equal to-group gnus-newsgroup-name)
9613 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9616 (intern (format "gnus-newsgroup-%s"
9618 ;; Copy the marks to other group.
9619 (gnus-add-marked-articles
9620 to-group (cdar marks) (list to-article) info)))
9621 (setq marks (cdr marks)))
9623 (gnus-request-set-mark
9624 to-group (list (list (list to-article) 'add to-marks))))
9627 (concat "(gnus-group-set-info '"
9628 (gnus-prin1-to-string (gnus-get-info to-group))
9631 ;; Update the Xref header in this article to point to
9632 ;; the new crossposted article we have just created.
9633 (when (eq action 'crosspost)
9635 (set-buffer copy-buf)
9636 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9637 (nnheader-replace-header "Xref" new-xref)
9638 (gnus-request-replace-article
9639 article gnus-newsgroup-name (current-buffer) t)))
9641 ;; run the move/copy/crosspost/respool hook
9642 (run-hook-with-args 'gnus-summary-article-move-hook
9645 (assoc article (gnus-data-list nil)))
9650 ;;;!!!Why is this necessary?
9651 (set-buffer gnus-summary-buffer)
9653 (gnus-summary-goto-subject article)
9654 (when (eq action 'move)
9655 (gnus-summary-mark-article article gnus-canceled-mark))))
9656 (push article articles-to-update-marks))
9658 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9659 ;; Re-activate all groups that have been moved to.
9661 (set-buffer gnus-group-buffer)
9662 (let ((gnus-group-marked to-groups))
9663 (gnus-group-get-new-news-this-group nil t)))
9665 (gnus-kill-buffer copy-buf)
9666 (gnus-summary-position-point)
9667 (gnus-set-mode-line 'summary)))
9669 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9670 "Copy the current article to some other group.
9671 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9672 When called interactively, if TO-NEWSGROUP is nil, use the value of
9673 the variable `gnus-move-split-methods' for finding a default target
9675 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9676 re-spool using this method."
9678 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9680 (defun gnus-summary-crosspost-article (&optional n)
9681 "Crosspost the current article to some other group."
9683 (gnus-summary-move-article n nil nil 'crosspost))
9685 (defcustom gnus-summary-respool-default-method nil
9686 "Default method type for respooling an article.
9687 If nil, use to the current newsgroup method."
9689 :group 'gnus-summary-mail)
9691 (defcustom gnus-summary-display-while-building nil
9692 "If non-nil, show and update the summary buffer as it's being built.
9693 If the value is t, update the buffer after every line is inserted. If
9694 the value is an integer (N), update the display every N lines."
9697 :type '(choice (const :tag "off" nil)
9699 (const :tag "frequently" t)))
9701 (defun gnus-summary-respool-article (&optional n method)
9702 "Respool the current article.
9703 The article will be squeezed through the mail spooling process again,
9704 which means that it will be put in some mail newsgroup or other
9705 depending on `nnmail-split-methods'.
9706 If N is a positive number, respool the N next articles.
9707 If N is a negative number, respool the N previous articles.
9708 If N is nil and any articles have been marked with the process mark,
9709 respool those articles instead.
9711 Respooling can be done both from mail groups and \"real\" newsgroups.
9712 In the former case, the articles in question will be moved from the
9713 current group into whatever groups they are destined to. In the
9714 latter case, they will be copied into the relevant groups."
9716 (list current-prefix-arg
9717 (let* ((methods (gnus-methods-using 'respool))
9719 (symbol-name (or gnus-summary-respool-default-method
9720 (car (gnus-find-method-for-group
9721 gnus-newsgroup-name)))))
9723 (gnus-completing-read-with-default
9724 methname "Backend to use when respooling"
9725 methods nil t nil 'gnus-mail-method-history))
9728 ((zerop (length (setq ms (gnus-servers-using-backend
9730 (list (intern method) ""))
9734 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9735 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9738 (error "No method given for respooling"))
9739 (if (assoc (symbol-name
9740 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9741 (gnus-methods-using 'respool))
9742 (gnus-summary-move-article n nil method)
9743 (gnus-summary-copy-article n nil method)))
9745 (defun gnus-summary-import-article (file &optional edit)
9746 "Import an arbitrary file into a mail newsgroup."
9747 (interactive "fImport file: \nP")
9748 (let ((group gnus-newsgroup-name)
9749 (now (current-time))
9750 atts lines group-art)
9751 (unless (gnus-check-backend-function 'request-accept-article group)
9752 (error "%s does not support article importing" group))
9753 (or (file-readable-p file)
9754 (not (file-regular-p file))
9755 (error "Can't read %s" file))
9757 (set-buffer (gnus-get-buffer-create " *import file*"))
9759 (nnheader-insert-file-contents file)
9760 (goto-char (point-min))
9761 (if (nnheader-article-p)
9763 (goto-char (point-min))
9764 (search-forward "\n\n" nil t)
9765 (narrow-to-region (point-min) (1- (point)))
9766 (goto-char (point-min))
9767 (unless (re-search-forward "^date:" nil t)
9768 (goto-char (point-max))
9769 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9770 ;; This doesn't look like an article, so we fudge some headers.
9771 (setq atts (file-attributes file)
9772 lines (count-lines (point-min) (point-max)))
9773 (insert "From: " (read-string "From: ") "\n"
9774 "Subject: " (read-string "Subject: ") "\n"
9775 "Date: " (message-make-date (nth 5 atts)) "\n"
9776 "Message-ID: " (message-make-message-id) "\n"
9777 "Lines: " (int-to-string lines) "\n"
9778 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9779 (setq group-art (gnus-request-accept-article group nil t))
9780 (kill-buffer (current-buffer)))
9781 (setq gnus-newsgroup-active (gnus-activate-group group))
9783 (gnus-summary-goto-article (cdr group-art) nil t)
9785 (gnus-summary-edit-article))))
9787 (defun gnus-summary-create-article ()
9788 "Create an article in a mail newsgroup."
9790 (let ((group gnus-newsgroup-name)
9791 (now (current-time))
9793 (unless (gnus-check-backend-function 'request-accept-article group)
9794 (error "%s does not support article importing" group))
9796 (set-buffer (gnus-get-buffer-create " *import file*"))
9798 (goto-char (point-min))
9799 ;; This doesn't look like an article, so we fudge some headers.
9800 (insert "From: " (read-string "From: ") "\n"
9801 "Subject: " (read-string "Subject: ") "\n"
9802 "Date: " (message-make-date now) "\n"
9803 "Message-ID: " (message-make-message-id) "\n")
9804 (setq group-art (gnus-request-accept-article group nil t))
9805 (kill-buffer (current-buffer)))
9806 (setq gnus-newsgroup-active (gnus-activate-group group))
9808 (gnus-summary-goto-article (cdr group-art) nil t)
9809 (gnus-summary-edit-article)))
9811 (defun gnus-summary-article-posted-p ()
9812 "Say whether the current (mail) article is available from news as well.
9813 This will be the case if the article has both been mailed and posted."
9815 (let ((id (mail-header-references (gnus-summary-article-header)))
9816 (gnus-override-method (car (gnus-refer-article-methods))))
9817 (if (gnus-request-head id "")
9818 (gnus-message 2 "The current message was found on %s"
9819 gnus-override-method)
9820 (gnus-message 2 "The current message couldn't be found on %s"
9821 gnus-override-method)
9824 (defun gnus-summary-expire-articles (&optional now)
9825 "Expire all articles that are marked as expirable in the current group."
9827 (when (and (not gnus-group-is-exiting-without-update-p)
9828 (gnus-check-backend-function
9829 'request-expire-articles gnus-newsgroup-name))
9830 ;; This backend supports expiry.
9831 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9832 (expirable (if total
9834 ;; We need to update the info for
9835 ;; this group for `gnus-list-of-read-articles'
9836 ;; to give us the right answer.
9837 (gnus-run-hooks 'gnus-exit-group-hook)
9838 (gnus-summary-update-info)
9839 (gnus-list-of-read-articles gnus-newsgroup-name))
9840 (setq gnus-newsgroup-expirable
9841 (sort gnus-newsgroup-expirable '<))))
9842 (expiry-wait (if now 'immediate
9843 (gnus-group-find-parameter
9844 gnus-newsgroup-name 'expiry-wait)))
9845 (nnmail-expiry-target
9846 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9847 nnmail-expiry-target))
9850 ;; There are expirable articles in this group, so we run them
9851 ;; through the expiry process.
9852 (gnus-message 6 "Expiring articles...")
9853 (unless (gnus-check-group gnus-newsgroup-name)
9854 (error "Can't open server for %s" gnus-newsgroup-name))
9855 ;; The list of articles that weren't expired is returned.
9858 (let ((nnmail-expiry-wait-function nil)
9859 (nnmail-expiry-wait expiry-wait))
9860 (setq es (gnus-request-expire-articles
9861 expirable gnus-newsgroup-name)))
9862 (setq es (gnus-request-expire-articles
9863 expirable gnus-newsgroup-name)))
9865 (setq gnus-newsgroup-expirable es))
9866 ;; We go through the old list of expirable, and mark all
9867 ;; really expired articles as nonexistent.
9868 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9869 (let ((gnus-use-cache nil))
9870 (dolist (article expirable)
9871 (when (and (not (memq article es))
9872 (gnus-data-find article))
9873 (gnus-summary-mark-article article gnus-canceled-mark)
9874 (run-hook-with-args 'gnus-summary-article-expire-hook
9877 (assoc article (gnus-data-list nil)))
9881 (gnus-message 6 "Expiring articles...done")))))
9883 (defun gnus-summary-expire-articles-now ()
9884 "Expunge all expirable articles in the current group.
9885 This means that *all* articles that are marked as expirable will be
9886 deleted forever, right now."
9888 (or gnus-expert-user
9890 "Are you really, really sure you want to delete all expirable messages? ")
9892 (gnus-summary-expire-articles t))
9894 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9895 (defun gnus-summary-delete-article (&optional n)
9896 "Delete the N next (mail) articles.
9897 This command actually deletes articles. This is not a marking
9898 command. The article will disappear forever from your life, never to
9901 If N is negative, delete backwards.
9902 If N is nil and articles have been marked with the process mark,
9903 delete these instead.
9905 If `gnus-novice-user' is non-nil you will be asked for
9906 confirmation before the articles are deleted."
9908 (unless (gnus-check-backend-function 'request-expire-articles
9909 gnus-newsgroup-name)
9910 (error "The current newsgroup does not support article deletion"))
9911 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9912 (error "Couldn't open server"))
9913 ;; Compute the list of articles to delete.
9914 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9915 (nnmail-expiry-target 'delete)
9917 (if (and gnus-novice-user
9918 (not (gnus-yes-or-no-p
9919 (format "Do you really want to delete %s forever? "
9920 (if (> (length articles) 1)
9921 (format "these %s articles" (length articles))
9924 ;; Delete the articles.
9925 (setq not-deleted (gnus-request-expire-articles
9926 articles gnus-newsgroup-name 'force))
9928 (gnus-summary-remove-process-mark (car articles))
9929 ;; The backend might not have been able to delete the article
9931 (unless (memq (car articles) not-deleted)
9932 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9933 (let* ((article (car articles))
9934 (ghead (gnus-data-header
9935 (assoc article (gnus-data-list nil)))))
9936 (run-hook-with-args 'gnus-summary-article-delete-hook
9937 'delete ghead gnus-newsgroup-name nil
9939 (setq articles (cdr articles)))
9941 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9942 (gnus-summary-position-point)
9943 (gnus-set-mode-line 'summary)
9946 (defun gnus-summary-edit-article (&optional arg)
9947 "Edit the current article.
9948 This will have permanent effect only in mail groups.
9949 If ARG is nil, edit the decoded articles.
9950 If ARG is 1, edit the raw articles.
9951 If ARG is 2, edit the raw articles even in read-only groups.
9952 If ARG is 3, edit the articles with the current handles.
9953 Otherwise, allow editing of articles even in read-only
9956 (let (force raw current-handles)
9965 (setq current-handles
9966 (and (gnus-buffer-live-p gnus-article-buffer)
9967 (with-current-buffer gnus-article-buffer
9969 gnus-article-mime-handles
9970 (setq gnus-article-mime-handles nil))))))
9973 (when (and raw (not force)
9974 (member gnus-newsgroup-name '("nndraft:delayed"
9977 (error "Can't edit the raw article in group %s"
9978 gnus-newsgroup-name))
9980 (set-buffer gnus-summary-buffer)
9981 (let ((mail-parse-charset gnus-newsgroup-charset)
9982 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9983 (gnus-set-global-variables)
9984 (when (and (not force)
9985 (gnus-group-read-only-p))
9986 (error "The current newsgroup does not support article editing"))
9987 (gnus-summary-show-article t)
9988 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9989 (with-current-buffer gnus-article-buffer
9990 (mm-enable-multibyte)))
9991 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9993 (gnus-article-edit-article
9996 (let ((mbl mml-buffer-list))
9997 (setq mml-buffer-list nil)
9998 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
9999 (mime-to-mml ,'current-handles))
10000 (let ((mbl1 mml-buffer-list))
10001 (setq mml-buffer-list mbl)
10002 (set (make-local-variable 'mml-buffer-list) mbl1))
10003 (gnus-make-local-hook 'kill-buffer-hook)
10004 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10005 `(lambda (no-highlight)
10006 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10007 (message-options message-options)
10008 (message-options-set-recipient)
10009 (mail-parse-ignored-charsets
10010 ',gnus-newsgroup-ignored-charsets))
10011 ,(if (not raw) '(progn
10013 (mml-destroy-buffers)
10014 (remove-hook 'kill-buffer-hook
10015 'mml-destroy-buffers t)
10016 (kill-local-variable 'mml-buffer-list)))
10017 (gnus-summary-edit-article-done
10018 ,(or (mail-header-references gnus-current-headers) "")
10019 ,(gnus-group-read-only-p)
10020 ,gnus-summary-buffer no-highlight))))))))
10022 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10024 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10026 "Make edits to the current article permanent."
10029 ;; The buffer restriction contains the entire article if it exists.
10030 (when (article-goto-body)
10031 (let ((lines (count-lines (point) (point-max)))
10032 (length (- (point-max) (point)))
10033 (case-fold-search t)
10034 (body (copy-marker (point))))
10035 (goto-char (point-min))
10036 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10037 (delete-region (match-beginning 1) (match-end 1))
10038 (insert (number-to-string length)))
10039 (goto-char (point-min))
10040 (when (re-search-forward
10041 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10042 (delete-region (match-beginning 1) (match-end 1))
10043 (insert (number-to-string length)))
10044 (goto-char (point-min))
10045 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10046 (delete-region (match-beginning 1) (match-end 1))
10047 (insert (number-to-string lines))))))
10048 ;; Replace the article.
10049 (let ((buf (current-buffer)))
10051 (insert-buffer-substring buf)
10053 (if (and (not read-only)
10054 (not (gnus-request-replace-article
10055 (cdr gnus-article-current) (car gnus-article-current)
10056 (current-buffer) t)))
10057 (error "Couldn't replace article")
10058 ;; Update the summary buffer.
10059 (if (and references
10060 (equal (message-tokenize-header references " ")
10061 (message-tokenize-header
10062 (or (message-fetch-field "references") "") " ")))
10063 ;; We only have to update this line.
10066 (message-narrow-to-head)
10067 (let ((head (buffer-substring-no-properties
10068 (point-min) (point-max)))
10071 (insert (format "211 %d Article retrieved.\n"
10072 (cdr gnus-article-current)))
10075 (let ((nntp-server-buffer (current-buffer)))
10076 (setq header (car (gnus-get-newsgroup-headers
10079 (set-buffer gnus-summary-buffer)
10080 (gnus-data-set-header
10081 (gnus-data-find (cdr gnus-article-current))
10083 (gnus-summary-update-article-line
10084 (cdr gnus-article-current) header)
10085 (if (gnus-summary-goto-subject
10086 (cdr gnus-article-current) nil t)
10087 (gnus-summary-update-secondary-mark
10088 (cdr gnus-article-current))))))))
10090 (set-buffer (or buffer gnus-summary-buffer))
10091 (gnus-summary-update-article (cdr gnus-article-current))
10092 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10093 (gnus-summary-update-secondary-mark
10094 (cdr gnus-article-current))))
10095 ;; Prettify the article buffer again.
10096 (unless no-highlight
10098 (set-buffer gnus-article-buffer)
10099 ;;;!!! Fix this -- article should be rehighlighted.
10100 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10101 (set-buffer gnus-original-article-buffer)
10102 (gnus-request-article
10103 (cdr gnus-article-current)
10104 (car gnus-article-current) (current-buffer))))
10105 ;; Prettify the summary buffer line.
10106 (when (gnus-visual-p 'summary-highlight 'highlight)
10107 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10109 (defun gnus-summary-edit-wash (key)
10110 "Perform editing command KEY in the article buffer."
10114 (message "%s" (concat (this-command-keys) "- "))
10117 (gnus-summary-edit-article)
10118 (execute-kbd-macro (concat (this-command-keys) key))
10119 (gnus-article-edit-done))
10123 (defun gnus-summary-respool-query (&optional silent trace)
10124 "Query where the respool algorithm would put this article."
10126 (let (gnus-mark-article-hook)
10127 (gnus-summary-select-article)
10129 (set-buffer gnus-original-article-buffer)
10130 (let ((groups (nnmail-article-group 'identity trace)))
10133 (message "This message would go to %s"
10134 (mapconcat 'car groups ", "))
10135 (message "This message would go to no groups"))
10138 (defun gnus-summary-respool-trace ()
10139 "Trace where the respool algorithm would put this article.
10140 Display a buffer showing all fancy splitting patterns which matched."
10142 (gnus-summary-respool-query nil t))
10144 ;; Summary marking commands.
10146 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10147 "Mark articles which has the same subject as read, and then select the next.
10148 If UNMARK is positive, remove any kind of mark.
10149 If UNMARK is negative, tick articles."
10152 (setq unmark (prefix-numeric-value unmark)))
10154 (gnus-summary-mark-same-subject
10155 (gnus-summary-article-subject) unmark)))
10156 ;; Select next unread article. If auto-select-same mode, should
10157 ;; select the first unread article.
10158 (gnus-summary-next-article t (and gnus-auto-select-same
10159 (gnus-summary-article-subject)))
10160 (gnus-message 7 "%d article%s marked as %s"
10161 count (if (= count 1) " is" "s are")
10162 (if unmark "unread" "read"))))
10164 (defun gnus-summary-kill-same-subject (&optional unmark)
10165 "Mark articles which has the same subject as read.
10166 If UNMARK is positive, remove any kind of mark.
10167 If UNMARK is negative, tick articles."
10170 (setq unmark (prefix-numeric-value unmark)))
10172 (gnus-summary-mark-same-subject
10173 (gnus-summary-article-subject) unmark)))
10174 ;; If marked as read, go to next unread subject.
10175 (when (null unmark)
10176 ;; Go to next unread subject.
10177 (gnus-summary-next-subject 1 t))
10178 (gnus-message 7 "%d articles are marked as %s"
10179 count (if unmark "unread" "read"))))
10181 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10182 "Mark articles with same SUBJECT as read, and return marked number.
10183 If optional argument UNMARK is positive, remove any kinds of marks.
10184 If optional argument UNMARK is negative, mark articles as unread instead."
10188 ((null unmark) ; Mark as read.
10191 (gnus-summary-mark-article-as-read gnus-killed-mark)
10192 (gnus-summary-show-thread) t)
10193 (gnus-summary-find-subject subject))
10194 (setq count (1+ count))))
10195 ((> unmark 0) ; Tick.
10198 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10199 (gnus-summary-show-thread) t)
10200 (gnus-summary-find-subject subject))
10201 (setq count (1+ count))))
10202 (t ; Mark as unread.
10205 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10206 (gnus-summary-show-thread) t)
10207 (gnus-summary-find-subject subject))
10208 (setq count (1+ count)))))
10209 (gnus-set-mode-line 'summary)
10210 ;; Return the number of marked articles.
10213 (defun gnus-summary-mark-as-processable (n &optional unmark)
10214 "Set the process mark on the next N articles.
10215 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10216 the process mark instead. The difference between N and the actual
10217 number of articles marked is returned."
10219 (if (and (null n) (gnus-region-active-p))
10220 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10221 (setq n (prefix-numeric-value n))
10222 (let ((backward (< n 0))
10227 (gnus-summary-remove-process-mark
10228 (gnus-summary-article-number))
10229 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10230 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10233 (gnus-message 7 "No more articles"))
10234 (gnus-summary-recenter)
10235 (gnus-summary-position-point)
10238 (defun gnus-summary-unmark-as-processable (n)
10239 "Remove the process mark from the next N articles.
10240 If N is negative, unmark backward instead. The difference between N and
10241 the actual number of articles unmarked is returned."
10243 (gnus-summary-mark-as-processable n t))
10245 (defun gnus-summary-unmark-all-processable ()
10246 "Remove the process mark from all articles."
10249 (while gnus-newsgroup-processable
10250 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10251 (gnus-summary-position-point))
10253 (defun gnus-summary-add-mark (article type)
10254 "Mark ARTICLE with a mark of TYPE."
10255 (let ((vtype (car (assq type gnus-article-mark-lists)))
10258 (error "No such mark type: %s" type)
10259 (setq var (intern (format "gnus-newsgroup-%s" type)))
10260 (set var (cons article (symbol-value var)))
10261 (if (memq type '(processable cached replied forwarded recent saved))
10262 (gnus-summary-update-secondary-mark article)
10263 ;;; !!! This is bogus. We should find out what primary
10264 ;;; !!! mark we want to set.
10265 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10267 (defun gnus-summary-mark-as-expirable (n)
10268 "Mark N articles forward as expirable.
10269 If N is negative, mark backward instead. The difference between N and
10270 the actual number of articles marked is returned."
10272 (gnus-summary-mark-forward n gnus-expirable-mark))
10274 (defun gnus-summary-mark-as-spam (n)
10275 "Mark N articles forward as spam.
10276 If N is negative, mark backward instead. The difference between N and
10277 the actual number of articles marked is returned."
10279 (gnus-summary-mark-forward n gnus-spam-mark))
10281 (defun gnus-summary-mark-article-as-replied (article)
10282 "Mark ARTICLE as replied to and update the summary line.
10283 ARTICLE can also be a list of articles."
10284 (interactive (list (gnus-summary-article-number)))
10285 (let ((articles (if (listp article) article (list article))))
10286 (dolist (article articles)
10287 (unless (numberp article)
10288 (error "%s is not a number" article))
10289 (push article gnus-newsgroup-replied)
10290 (let ((buffer-read-only nil))
10291 (when (gnus-summary-goto-subject article nil t)
10292 (gnus-summary-update-secondary-mark article))))))
10294 (defun gnus-summary-mark-article-as-forwarded (article)
10295 "Mark ARTICLE as forwarded and update the summary line.
10296 ARTICLE can also be a list of articles."
10297 (let ((articles (if (listp article) article (list article))))
10298 (dolist (article articles)
10299 (push article gnus-newsgroup-forwarded)
10300 (let ((buffer-read-only nil))
10301 (when (gnus-summary-goto-subject article nil t)
10302 (gnus-summary-update-secondary-mark article))))))
10304 (defun gnus-summary-set-bookmark (article)
10305 "Set a bookmark in current article."
10306 (interactive (list (gnus-summary-article-number)))
10307 (when (or (not (get-buffer gnus-article-buffer))
10308 (not gnus-current-article)
10309 (not gnus-article-current)
10310 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10311 (error "No current article selected"))
10312 ;; Remove old bookmark, if one exists.
10313 (gnus-pull article gnus-newsgroup-bookmarks)
10314 ;; Set the new bookmark, which is on the form
10315 ;; (article-number . line-number-in-body).
10318 (with-current-buffer gnus-article-buffer
10322 (article-goto-body)
10325 gnus-newsgroup-bookmarks)
10326 (gnus-message 6 "A bookmark has been added to the current article."))
10328 (defun gnus-summary-remove-bookmark (article)
10329 "Remove the bookmark from the current article."
10330 (interactive (list (gnus-summary-article-number)))
10331 ;; Remove old bookmark, if one exists.
10332 (if (not (assq article gnus-newsgroup-bookmarks))
10333 (gnus-message 6 "No bookmark in current article.")
10334 (gnus-pull article gnus-newsgroup-bookmarks)
10335 (gnus-message 6 "Removed bookmark.")))
10337 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10338 (defun gnus-summary-mark-as-dormant (n)
10339 "Mark N articles forward as dormant.
10340 If N is negative, mark backward instead. The difference between N and
10341 the actual number of articles marked is returned."
10343 (gnus-summary-mark-forward n gnus-dormant-mark))
10345 (defun gnus-summary-set-process-mark (article)
10346 "Set the process mark on ARTICLE and update the summary line."
10347 (setq gnus-newsgroup-processable
10349 (delq article gnus-newsgroup-processable)))
10350 (when (gnus-summary-goto-subject article)
10351 (gnus-summary-show-thread)
10352 (gnus-summary-goto-subject article)
10353 (gnus-summary-update-secondary-mark article)))
10355 (defun gnus-summary-remove-process-mark (&rest articles)
10356 "Remove the process mark from ARTICLES and update the summary line."
10357 (dolist (article articles)
10358 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10359 (when (gnus-summary-goto-subject article)
10360 (gnus-summary-show-thread)
10361 (gnus-summary-goto-subject article)
10362 (gnus-summary-update-secondary-mark article)))
10365 (defun gnus-summary-set-saved-mark (article)
10366 "Set the process mark on ARTICLE and update the summary line."
10367 (push article gnus-newsgroup-saved)
10368 (when (gnus-summary-goto-subject article)
10369 (gnus-summary-update-secondary-mark article)))
10371 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10372 "Mark N articles as read forwards.
10373 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10374 The difference between N and the actual number of articles marked is
10376 If NO-EXPIRE, auto-expiry will be inhibited."
10378 (gnus-summary-show-thread)
10379 (let ((backward (< n 0))
10380 (gnus-summary-goto-unread
10381 (and gnus-summary-goto-unread
10382 (not (eq gnus-summary-goto-unread 'never))
10383 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10384 gnus-ticked-mark gnus-dormant-mark)))))
10386 (mark (or mark gnus-del-mark)))
10387 (while (and (> n 0)
10388 (gnus-summary-mark-article nil mark no-expire)
10389 (zerop (gnus-summary-next-subject
10391 (and gnus-summary-goto-unread
10392 (not (eq gnus-summary-goto-unread 'never)))
10396 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10397 (gnus-summary-recenter)
10398 (gnus-summary-position-point)
10399 (gnus-set-mode-line 'summary)
10402 (defun gnus-summary-mark-article-as-read (mark)
10403 "Mark the current article quickly as read with MARK."
10404 (let ((article (gnus-summary-article-number)))
10405 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10406 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10407 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10408 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10409 (push (cons article mark) gnus-newsgroup-reads)
10410 ;; Possibly remove from cache, if that is used.
10411 (when gnus-use-cache
10412 (gnus-cache-enter-remove-article article))
10413 ;; Allow the backend to change the mark.
10414 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10415 ;; Check for auto-expiry.
10416 (when (and gnus-newsgroup-auto-expire
10417 (memq mark gnus-auto-expirable-marks))
10418 (setq mark gnus-expirable-mark)
10419 ;; Let the backend know about the mark change.
10420 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10421 (push article gnus-newsgroup-expirable))
10422 ;; Set the mark in the buffer.
10423 (gnus-summary-update-mark mark 'unread)
10426 (defun gnus-summary-mark-article-as-unread (mark)
10427 "Mark the current article quickly as unread with MARK."
10428 (let* ((article (gnus-summary-article-number))
10429 (old-mark (gnus-summary-article-mark article)))
10430 ;; Allow the backend to change the mark.
10431 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10432 (if (eq mark old-mark)
10436 (gnus-error 1 "Can't mark negative article numbers")
10438 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10439 (setq gnus-newsgroup-spam-marked
10440 (delq article gnus-newsgroup-spam-marked))
10441 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10442 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10443 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10444 (cond ((= mark gnus-ticked-mark)
10445 (setq gnus-newsgroup-marked
10446 (gnus-add-to-sorted-list gnus-newsgroup-marked
10448 ((= mark gnus-spam-mark)
10449 (setq gnus-newsgroup-spam-marked
10450 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10452 ((= mark gnus-dormant-mark)
10453 (setq gnus-newsgroup-dormant
10454 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10457 (setq gnus-newsgroup-unreads
10458 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10460 (gnus-pull article gnus-newsgroup-reads)
10462 ;; See whether the article is to be put in the cache.
10463 (and gnus-use-cache
10464 (vectorp (gnus-summary-article-header article))
10466 (gnus-cache-possibly-enter-article
10467 gnus-newsgroup-name article
10468 (= mark gnus-ticked-mark)
10469 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10472 (gnus-summary-update-mark mark 'unread)
10475 (defun gnus-summary-mark-article (&optional article mark no-expire)
10476 "Mark ARTICLE with MARK. MARK can be any character.
10477 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10478 `??' (dormant) and `?E' (expirable).
10479 If MARK is nil, then the default character `?r' is used.
10480 If ARTICLE is nil, then the article on the current line will be
10482 If NO-EXPIRE, auto-expiry will be inhibited."
10483 ;; The mark might be a string.
10484 (when (stringp mark)
10485 (setq mark (aref mark 0)))
10486 ;; If no mark is given, then we check auto-expiring.
10488 (setq mark gnus-del-mark))
10489 (when (and (not no-expire)
10490 gnus-newsgroup-auto-expire
10491 (memq mark gnus-auto-expirable-marks))
10492 (setq mark gnus-expirable-mark))
10493 (let ((article (or article (gnus-summary-article-number)))
10494 (old-mark (gnus-summary-article-mark article)))
10495 ;; Allow the backend to change the mark.
10496 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10497 (if (eq mark old-mark)
10500 (error "No article on current line"))
10501 (if (not (if (or (= mark gnus-unread-mark)
10502 (= mark gnus-ticked-mark)
10503 (= mark gnus-spam-mark)
10504 (= mark gnus-dormant-mark))
10505 (gnus-mark-article-as-unread article mark)
10506 (gnus-mark-article-as-read article mark)))
10508 ;; See whether the article is to be put in the cache.
10509 (and gnus-use-cache
10510 (not (= mark gnus-canceled-mark))
10511 (vectorp (gnus-summary-article-header article))
10513 (gnus-cache-possibly-enter-article
10514 gnus-newsgroup-name article
10515 (= mark gnus-ticked-mark)
10516 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10518 (when (gnus-summary-goto-subject article nil t)
10519 (let ((buffer-read-only nil))
10520 (gnus-summary-show-thread)
10522 (gnus-summary-update-mark mark 'unread)
10525 (defun gnus-summary-update-secondary-mark (article)
10526 "Update the secondary (read, process, cache) mark."
10527 (gnus-summary-update-mark
10528 (cond ((memq article gnus-newsgroup-processable)
10530 ((memq article gnus-newsgroup-cached)
10532 ((memq article gnus-newsgroup-replied)
10534 ((memq article gnus-newsgroup-forwarded)
10535 gnus-forwarded-mark)
10536 ((memq article gnus-newsgroup-saved)
10538 ((memq article gnus-newsgroup-recent)
10540 ((memq article gnus-newsgroup-unseen)
10544 (when (gnus-visual-p 'summary-highlight 'highlight)
10545 (gnus-run-hooks 'gnus-summary-update-hook))
10548 (defun gnus-summary-update-download-mark (article)
10549 "Update the download mark."
10550 (gnus-summary-update-mark
10551 (cond ((memq article gnus-newsgroup-undownloaded)
10552 gnus-undownloaded-mark)
10553 (gnus-newsgroup-agentized
10554 gnus-downloaded-mark)
10558 (gnus-summary-update-line t)
10561 (defun gnus-summary-update-mark (mark type)
10562 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10563 (buffer-read-only nil))
10564 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10566 (when (looking-at "\r")
10568 (when (<= (+ forward (point)) (point-max))
10569 ;; Go to the right position on the line.
10570 (goto-char (+ forward (point)))
10571 ;; Replace the old mark with the new mark.
10572 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10573 ;; Optionally update the marks by some user rule.
10574 (when (eq type 'unread)
10575 (gnus-data-set-mark
10576 (gnus-data-find (gnus-summary-article-number)) mark)
10577 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10579 (defun gnus-mark-article-as-read (article &optional mark)
10580 "Enter ARTICLE in the pertinent lists and remove it from others."
10581 ;; Make the article expirable.
10582 (let ((mark (or mark gnus-del-mark)))
10583 (setq gnus-newsgroup-expirable
10584 (if (= mark gnus-expirable-mark)
10585 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10586 (delq article gnus-newsgroup-expirable)))
10587 ;; Remove from unread and marked lists.
10588 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10589 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10590 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10591 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10592 (push (cons article mark) gnus-newsgroup-reads)
10593 ;; Possibly remove from cache, if that is used.
10594 (when gnus-use-cache
10595 (gnus-cache-enter-remove-article article))
10598 (defun gnus-mark-article-as-unread (article &optional mark)
10599 "Enter ARTICLE in the pertinent lists and remove it from others."
10600 (let ((mark (or mark gnus-ticked-mark)))
10603 (gnus-error 1 "Can't mark negative article numbers")
10605 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10606 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10607 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10608 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10609 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10611 ;; Unsuppress duplicates?
10612 (when gnus-suppress-duplicates
10613 (gnus-dup-unsuppress-article article))
10615 (cond ((= mark gnus-ticked-mark)
10616 (setq gnus-newsgroup-marked
10617 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10618 ((= mark gnus-spam-mark)
10619 (setq gnus-newsgroup-spam-marked
10620 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10622 ((= mark gnus-dormant-mark)
10623 (setq gnus-newsgroup-dormant
10624 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10626 (setq gnus-newsgroup-unreads
10627 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10628 (gnus-pull article gnus-newsgroup-reads)
10631 (defalias 'gnus-summary-mark-as-unread-forward
10632 'gnus-summary-tick-article-forward)
10633 (make-obsolete 'gnus-summary-mark-as-unread-forward
10634 'gnus-summary-tick-article-forward)
10635 (defun gnus-summary-tick-article-forward (n)
10636 "Tick N articles forwards.
10637 If N is negative, tick backwards instead.
10638 The difference between N and the number of articles ticked is returned."
10640 (gnus-summary-mark-forward n gnus-ticked-mark))
10642 (defalias 'gnus-summary-mark-as-unread-backward
10643 'gnus-summary-tick-article-backward)
10644 (make-obsolete 'gnus-summary-mark-as-unread-backward
10645 'gnus-summary-tick-article-backward)
10646 (defun gnus-summary-tick-article-backward (n)
10647 "Tick N articles backwards.
10648 The difference between N and the number of articles ticked is returned."
10650 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10652 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10653 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10654 (defun gnus-summary-tick-article (&optional article clear-mark)
10655 "Mark current article as unread.
10656 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10657 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10659 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10660 gnus-ticked-mark)))
10662 (defun gnus-summary-mark-as-read-forward (n)
10663 "Mark N articles as read forwards.
10664 If N is negative, mark backwards instead.
10665 The difference between N and the actual number of articles marked is
10668 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10670 (defun gnus-summary-mark-as-read-backward (n)
10671 "Mark the N articles as read backwards.
10672 The difference between N and the actual number of articles marked is
10675 (gnus-summary-mark-forward
10676 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10678 (defun gnus-summary-mark-as-read (&optional article mark)
10679 "Mark current article as read.
10680 ARTICLE specifies the article to be marked as read.
10681 MARK specifies a string to be inserted at the beginning of the line."
10682 (gnus-summary-mark-article article mark))
10684 (defun gnus-summary-clear-mark-forward (n)
10685 "Clear marks from N articles forward.
10686 If N is negative, clear backward instead.
10687 The difference between N and the number of marks cleared is returned."
10689 (gnus-summary-mark-forward n gnus-unread-mark))
10691 (defun gnus-summary-clear-mark-backward (n)
10692 "Clear marks from N articles backward.
10693 The difference between N and the number of marks cleared is returned."
10695 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10697 (defun gnus-summary-mark-unread-as-read ()
10698 "Intended to be used by `gnus-summary-mark-article-hook'."
10699 (when (memq gnus-current-article gnus-newsgroup-unreads)
10700 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10702 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10703 "Intended to be used by `gnus-summary-mark-article-hook'."
10704 (let ((mark (gnus-summary-article-mark)))
10705 (when (or (gnus-unread-mark-p mark)
10706 (gnus-read-mark-p mark))
10707 (gnus-summary-mark-article gnus-current-article
10708 (or new-mark gnus-read-mark)))))
10710 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10711 "Intended to be used by `gnus-summary-mark-article-hook'."
10712 (let ((mark (gnus-summary-article-mark)))
10713 (when (or (gnus-unread-mark-p mark)
10714 (gnus-read-mark-p mark))
10715 (gnus-summary-mark-article (gnus-summary-article-number)
10716 (or new-mark gnus-read-mark)))))
10718 (defun gnus-summary-mark-unread-as-ticked ()
10719 "Intended to be used by `gnus-summary-mark-article-hook'."
10720 (when (memq gnus-current-article gnus-newsgroup-unreads)
10721 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10723 (defun gnus-summary-mark-region-as-read (point mark all)
10724 "Mark all unread articles between point and mark as read.
10725 If given a prefix, mark all articles between point and mark as read,
10726 even ticked and dormant ones."
10727 (interactive "r\nP")
10731 (beginning-of-line)
10736 (memq (setq article (gnus-summary-article-number))
10737 gnus-newsgroup-unreads))
10738 (gnus-summary-mark-article article gnus-del-mark))
10740 (gnus-summary-find-next))))))
10742 (defun gnus-summary-mark-below (score mark)
10743 "Mark articles with score less than SCORE with MARK."
10744 (interactive "P\ncMark: ")
10745 (setq score (if score
10746 (prefix-numeric-value score)
10747 (or gnus-summary-default-score 0)))
10749 (set-buffer gnus-summary-buffer)
10750 (goto-char (point-min))
10753 (and (< (gnus-summary-article-score) score)
10754 (gnus-summary-mark-article nil mark))
10755 (gnus-summary-find-next)))))
10757 (defun gnus-summary-kill-below (&optional score)
10758 "Mark articles with score below SCORE as read."
10760 (gnus-summary-mark-below score gnus-killed-mark))
10762 (defun gnus-summary-clear-above (&optional score)
10763 "Clear all marks from articles with score above SCORE."
10765 (gnus-summary-mark-above score gnus-unread-mark))
10767 (defun gnus-summary-tick-above (&optional score)
10768 "Tick all articles with score above SCORE."
10770 (gnus-summary-mark-above score gnus-ticked-mark))
10772 (defun gnus-summary-mark-above (score mark)
10773 "Mark articles with score over SCORE with MARK."
10774 (interactive "P\ncMark: ")
10775 (setq score (if score
10776 (prefix-numeric-value score)
10777 (or gnus-summary-default-score 0)))
10779 (set-buffer gnus-summary-buffer)
10780 (goto-char (point-min))
10782 (when (> (gnus-summary-article-score) score)
10783 (gnus-summary-mark-article nil mark))
10785 (gnus-summary-find-next)))))
10787 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10788 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10789 (defun gnus-summary-limit-include-expunged (&optional no-error)
10790 "Display all the hidden articles that were expunged for low scores."
10792 (let ((buffer-read-only nil))
10793 (let ((scored gnus-newsgroup-scored)
10796 (unless (gnus-summary-article-header (caar scored))
10797 (and (setq h (gnus-number-to-header (caar scored)))
10798 (< (cdar scored) gnus-summary-expunge-below)
10800 (setq scored (cdr scored)))
10802 (when (not no-error)
10803 (error "No expunged articles hidden"))
10804 (goto-char (point-min))
10805 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10806 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10807 (mapcar (lambda (x) (push (mail-header-number x)
10808 gnus-newsgroup-limit))
10810 (gnus-summary-prepare-unthreaded (nreverse headers))
10811 (goto-char (point-min))
10812 (gnus-summary-position-point)
10815 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10816 "Mark all unread articles in this newsgroup as read.
10817 If prefix argument ALL is non-nil, ticked and dormant articles will
10818 also be marked as read.
10819 If QUIETLY is non-nil, no questions will be asked.
10821 If TO-HERE is non-nil, it should be a point in the buffer. All
10822 articles before (after, if REVERSE is set) this point will be marked
10825 Note that this function will only catch up the unread article
10826 in the current summary buffer limitation.
10828 The number of articles marked as read is returned."
10833 (not gnus-interactive-catchup) ;Without confirmation?
10837 "Mark absolutely all articles as read? "
10838 "Mark all unread articles as read? ")))
10840 (not gnus-newsgroup-adaptive)
10841 (not gnus-newsgroup-auto-expire)
10842 (not gnus-suppress-duplicates)
10843 (or (not gnus-use-cache)
10844 (eq gnus-use-cache 'passive)))
10847 (setq gnus-newsgroup-marked nil
10848 gnus-newsgroup-spam-marked nil
10849 gnus-newsgroup-dormant nil))
10850 (setq gnus-newsgroup-unreads
10851 (gnus-sorted-nunion
10852 (gnus-sorted-intersection gnus-newsgroup-unreads
10853 gnus-newsgroup-downloadable)
10854 gnus-newsgroup-unfetched)))
10855 ;; We actually mark all articles as canceled, which we
10856 ;; have to do when using auto-expiry or adaptive scoring.
10857 (gnus-summary-show-all-threads)
10858 (if (and to-here reverse)
10860 (goto-char to-here)
10861 (gnus-summary-mark-current-read-and-unread-as-read
10863 (while (gnus-summary-find-next (not all))
10864 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10865 (when (gnus-summary-first-subject (not all))
10867 (if to-here (< (point) to-here) t)
10868 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10869 (gnus-summary-find-next (not all))))))
10870 (gnus-set-mode-line 'summary))
10872 (gnus-summary-position-point)))
10874 (defun gnus-summary-catchup-to-here (&optional all)
10875 "Mark all unticked articles before the current one as read.
10876 If ALL is non-nil, also mark ticked and dormant articles as read."
10879 (gnus-save-hidden-threads
10880 (let ((beg (point)))
10881 ;; We check that there are unread articles.
10882 (when (or all (gnus-summary-find-prev))
10883 (gnus-summary-catchup all t beg)))))
10884 (gnus-summary-position-point))
10886 (defun gnus-summary-catchup-from-here (&optional all)
10887 "Mark all unticked articles after (and including) the current one as read.
10888 If ALL is non-nil, also mark ticked and dormant articles as read."
10891 (gnus-save-hidden-threads
10892 (let ((beg (point)))
10893 ;; We check that there are unread articles.
10894 (when (or all (gnus-summary-find-next))
10895 (gnus-summary-catchup all t beg nil t)))))
10896 (gnus-summary-position-point))
10898 (defun gnus-summary-catchup-all (&optional quietly)
10899 "Mark all articles in this newsgroup as read.
10900 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10901 instead, which marks only unread articles as read."
10903 (gnus-summary-catchup t quietly))
10905 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10906 "Mark all unread articles in this group as read, then exit.
10907 If prefix argument ALL is non-nil, all articles are marked as read.
10908 If QUIETLY is non-nil, no questions will be asked."
10910 (when (gnus-summary-catchup all quietly nil 'fast)
10911 ;; Select next newsgroup or exit.
10912 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10913 (eq gnus-auto-select-next 'quietly))
10914 (gnus-summary-next-group nil)
10915 (gnus-summary-exit))))
10917 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10918 "Mark all articles in this newsgroup as read, and then exit.
10919 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10920 instead, which marks only unread articles as read."
10922 (gnus-summary-catchup-and-exit t quietly))
10924 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10925 "Mark all articles in this group as read and select the next group.
10926 If given a prefix, mark all articles, unread as well as ticked, as
10930 (gnus-summary-catchup all))
10931 (gnus-summary-next-group))
10933 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10934 "Mark all articles in this group as read and select the previous group.
10935 If given a prefix, mark all articles, unread as well as ticked, as
10939 (gnus-summary-catchup all))
10940 (gnus-summary-next-group nil nil t))
10946 (defmacro gnus-with-article (article &rest forms)
10947 "Select ARTICLE and perform FORMS in the original article buffer.
10948 Then replace the article with the result."
10950 ;; We don't want the article to be marked as read.
10951 (let (gnus-mark-article-hook)
10952 (gnus-summary-select-article t t nil ,article))
10953 (set-buffer gnus-original-article-buffer)
10955 (if (not (gnus-check-backend-function
10956 'request-replace-article (car gnus-article-current)))
10957 (gnus-message 5 "Read-only group; not replacing")
10958 (unless (gnus-request-replace-article
10959 ,article (car gnus-article-current)
10960 (current-buffer) t)
10961 (error "Couldn't replace article")))
10962 ;; The cache and backlog have to be flushed somewhat.
10963 (when gnus-keep-backlog
10964 (gnus-backlog-remove-article
10965 (car gnus-article-current) (cdr gnus-article-current)))
10966 (when gnus-use-cache
10967 (gnus-cache-update-article
10968 (car gnus-article-current) (cdr gnus-article-current)))))
10970 (put 'gnus-with-article 'lisp-indent-function 1)
10971 (put 'gnus-with-article 'edebug-form-spec '(form body))
10973 ;; Thread-based commands.
10975 (defun gnus-summary-articles-in-thread (&optional article)
10976 "Return a list of all articles in the current thread.
10977 If ARTICLE is non-nil, return all articles in the thread that starts
10978 with that article."
10979 (let* ((article (or article (gnus-summary-article-number)))
10980 (data (gnus-data-find-list article))
10981 (top-level (gnus-data-level (car data)))
10983 (cond ((null gnus-thread-operation-ignore-subject)
10984 (gnus-simplify-subject-re
10985 (mail-header-subject (gnus-data-header (car data)))))
10986 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10987 (gnus-simplify-subject-fuzzy
10988 (mail-header-subject (gnus-data-header (car data)))))
10990 (end-point (save-excursion
10991 (if (gnus-summary-go-to-next-thread)
10992 (point) (point-max))))
10995 (< (gnus-data-pos (car data)) end-point))
10996 (when (or (not top-subject)
10997 (string= top-subject
10998 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10999 (gnus-simplify-subject-fuzzy
11000 (mail-header-subject
11001 (gnus-data-header (car data))))
11002 (gnus-simplify-subject-re
11003 (mail-header-subject
11004 (gnus-data-header (car data)))))))
11005 (push (gnus-data-number (car data)) articles))
11006 (unless (and (setq data (cdr data))
11007 (> (gnus-data-level (car data)) top-level))
11009 ;; Return the list of articles.
11010 (nreverse articles)))
11012 (defun gnus-summary-rethread-current ()
11013 "Rethread the thread the current article is part of."
11015 (let* ((gnus-show-threads t)
11016 (article (gnus-summary-article-number))
11017 (id (mail-header-id (gnus-summary-article-header)))
11018 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11020 (error "No article on the current line"))
11021 (gnus-rebuild-thread id)
11022 (gnus-summary-goto-subject article)))
11024 (defun gnus-summary-reparent-thread ()
11025 "Make the current article child of the marked (or previous) article.
11027 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11028 is non-nil or the Subject: of both articles are the same."
11030 (unless (not (gnus-group-read-only-p))
11031 (error "The current newsgroup does not support article editing"))
11032 (unless (<= (length gnus-newsgroup-processable) 1)
11033 (error "No more than one article may be marked"))
11034 (let ((child (gnus-summary-article-number))
11035 ;; First grab the marked article, otherwise one line up.
11036 (parent (if (not (null gnus-newsgroup-processable))
11037 (car gnus-newsgroup-processable)
11039 (if (eq (forward-line -1) 0)
11040 (gnus-summary-article-number)
11041 (error "Beginning of summary buffer"))))))
11042 (gnus-summary-reparent-children parent (list child))))
11044 (defun gnus-summary-reparent-children (parent children)
11045 "Make PARENT the parent of CHILDREN.
11046 When called interactively, PARENT is the current article and CHILDREN
11047 are the process-marked articles."
11049 (list (gnus-summary-article-number)
11050 (gnus-summary-work-articles nil)))
11051 (dolist (child children)
11052 (save-window-excursion
11053 (let ((gnus-article-buffer " *reparent*"))
11054 (unless (not (eq parent child))
11055 (error "An article may not be self-referential"))
11056 (let ((message-id (mail-header-id
11057 (gnus-summary-article-header parent))))
11058 (unless (and message-id (not (equal message-id "")))
11059 (error "No message-id in desired parent"))
11060 (gnus-with-article child
11062 (goto-char (point-min))
11063 (message-narrow-to-head)
11064 (if (re-search-forward "^References: " nil t)
11066 (re-search-forward "^[^ \t]" nil t)
11069 (insert " " message-id))
11070 (insert "References: " message-id "\n"))))
11071 (set-buffer gnus-summary-buffer)
11072 (gnus-summary-unmark-all-processable)
11073 (gnus-summary-update-article child)
11074 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11075 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11076 (gnus-summary-rethread-current)
11077 (gnus-message 3 "Article %d is now the child of article %d"
11080 (defun gnus-summary-toggle-threads (&optional arg)
11081 "Toggle showing conversation threads.
11082 If ARG is positive number, turn showing conversation threads on."
11084 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11085 (setq gnus-show-threads
11086 (if (null arg) (not gnus-show-threads)
11087 (> (prefix-numeric-value arg) 0)))
11088 (gnus-summary-prepare)
11089 (gnus-summary-goto-subject current)
11090 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11091 (gnus-summary-position-point)))
11093 (defun gnus-summary-show-all-threads ()
11094 "Show all threads."
11097 (let ((buffer-read-only nil))
11098 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
11099 (gnus-summary-position-point))
11101 (defun gnus-summary-show-thread ()
11102 "Show thread subtrees.
11103 Returns nil if no thread was there to be shown."
11105 (let ((buffer-read-only nil)
11107 (end (point-at-eol))
11108 ;; Leave point at bol
11109 (beg (progn (beginning-of-line) (point))))
11111 ;; Any hidden lines here?
11112 (search-forward "\r" end t)
11113 (subst-char-in-region beg end ?\^M ?\n t)
11115 (gnus-summary-position-point))))
11117 (defun gnus-summary-maybe-hide-threads ()
11118 "If requested, hide the threads that should be hidden."
11119 (when (and gnus-show-threads
11120 gnus-thread-hide-subtree)
11121 (gnus-summary-hide-all-threads
11122 (if (or (consp gnus-thread-hide-subtree)
11123 (functionp gnus-thread-hide-subtree))
11124 (gnus-make-predicate gnus-thread-hide-subtree)
11127 ;;; Hiding predicates.
11129 (defun gnus-article-unread-p (header)
11130 (memq (mail-header-number header) gnus-newsgroup-unreads))
11132 (defun gnus-article-unseen-p (header)
11133 (memq (mail-header-number header) gnus-newsgroup-unseen))
11135 (defun gnus-map-articles (predicate articles)
11136 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11137 (apply 'gnus-or (mapcar predicate
11138 (mapcar (lambda (number)
11139 (gnus-summary-article-header number))
11142 (defun gnus-summary-hide-all-threads (&optional predicate)
11143 "Hide all thread subtrees.
11144 If PREDICATE is supplied, threads that satisfy this predicate
11145 will not be hidden."
11148 (goto-char (point-min))
11151 (when (or (not predicate)
11153 predicate (gnus-summary-article-children)))
11154 (gnus-summary-hide-thread))
11155 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11156 (gnus-summary-position-point))
11158 (defun gnus-summary-hide-thread ()
11159 "Hide thread subtrees.
11160 If PREDICATE is supplied, threads that satisfy this predicate
11161 will not be hidden.
11162 Returns nil if no threads were there to be hidden."
11164 (let ((buffer-read-only nil)
11166 (article (gnus-summary-article-number)))
11168 ;; Go forward until either the buffer ends or the subthread
11170 (when (and (not (eobp))
11171 (or (zerop (gnus-summary-next-thread 1 t))
11172 (goto-char (point-max))))
11174 (if (and (> (point) start)
11175 (search-backward "\n" start t))
11177 (subst-char-in-region start (point) ?\n ?\^M)
11178 (gnus-summary-goto-subject article))
11182 (defun gnus-summary-go-to-next-thread (&optional previous)
11183 "Go to the same level (or less) next thread.
11184 If PREVIOUS is non-nil, go to previous thread instead.
11185 Return the article number moved to, or nil if moving was impossible."
11186 (let ((level (gnus-summary-thread-level))
11187 (way (if previous -1 1))
11190 (while (and (not (eobp))
11191 (< level (gnus-summary-thread-level)))
11192 (forward-line way))
11199 (gnus-summary-article-number)
11200 (goto-char beg)))))
11202 (defun gnus-summary-next-thread (n &optional silent)
11203 "Go to the same level next N'th thread.
11204 If N is negative, search backward instead.
11205 Returns the difference between N and the number of skips actually
11208 If SILENT, don't output messages."
11210 (let ((backward (< n 0))
11212 (while (and (> n 0)
11213 (gnus-summary-go-to-next-thread backward))
11216 (gnus-summary-position-point))
11217 (when (and (not silent) (/= 0 n))
11218 (gnus-message 7 "No more threads"))
11221 (defun gnus-summary-prev-thread (n)
11222 "Go to the same level previous N'th thread.
11223 Returns the difference between N and the number of skips actually
11226 (gnus-summary-next-thread (- n)))
11228 (defun gnus-summary-go-down-thread ()
11229 "Go down one level in the current thread."
11230 (let ((children (gnus-summary-article-children)))
11232 (gnus-summary-goto-subject (car children)))))
11234 (defun gnus-summary-go-up-thread ()
11235 "Go up one level in the current thread."
11236 (let ((parent (gnus-summary-article-parent)))
11238 (gnus-summary-goto-subject parent))))
11240 (defun gnus-summary-down-thread (n)
11241 "Go down thread N steps.
11242 If N is negative, go up instead.
11243 Returns the difference between N and how many steps down that were
11248 (while (and (> n 0)
11249 (if up (gnus-summary-go-up-thread)
11250 (gnus-summary-go-down-thread)))
11252 (gnus-summary-position-point)
11254 (gnus-message 7 "Can't go further"))
11257 (defun gnus-summary-up-thread (n)
11258 "Go up thread N steps.
11259 If N is negative, go down instead.
11260 Returns the difference between N and how many steps down that were
11263 (gnus-summary-down-thread (- n)))
11265 (defun gnus-summary-top-thread ()
11266 "Go to the top of the thread."
11268 (while (gnus-summary-go-up-thread))
11269 (gnus-summary-article-number))
11271 (defun gnus-summary-kill-thread (&optional unmark)
11272 "Mark articles under current thread as read.
11273 If the prefix argument is positive, remove any kinds of marks.
11274 If the prefix argument is negative, tick articles instead."
11277 (setq unmark (prefix-numeric-value unmark)))
11278 (let ((articles (gnus-summary-articles-in-thread)))
11280 ;; Expand the thread.
11281 (gnus-summary-show-thread)
11282 ;; Mark all the articles.
11284 (gnus-summary-goto-subject (car articles))
11285 (cond ((null unmark)
11286 (gnus-summary-mark-article-as-read gnus-killed-mark))
11288 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11290 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11291 (setq articles (cdr articles))))
11292 ;; Hide killed subtrees.
11294 gnus-thread-hide-killed
11295 (gnus-summary-hide-thread))
11296 ;; If marked as read, go to next unread subject.
11297 (when (null unmark)
11298 ;; Go to next unread subject.
11299 (gnus-summary-next-subject 1 t)))
11300 (gnus-set-mode-line 'summary))
11302 ;; Summary sorting commands
11304 (defun gnus-summary-sort-by-number (&optional reverse)
11305 "Sort the summary buffer by article number.
11306 Argument REVERSE means reverse order."
11308 (gnus-summary-sort 'number reverse))
11310 (defun gnus-summary-sort-by-random (&optional reverse)
11311 "Randomize the order in the summary buffer.
11312 Argument REVERSE means to randomize in reverse order."
11314 (gnus-summary-sort 'random reverse))
11316 (defun gnus-summary-sort-by-author (&optional reverse)
11317 "Sort the summary buffer by author name alphabetically.
11318 If `case-fold-search' is non-nil, case of letters is ignored.
11319 Argument REVERSE means reverse order."
11321 (gnus-summary-sort 'author reverse))
11323 (defun gnus-summary-sort-by-recipient (&optional reverse)
11324 "Sort the summary buffer by recipient name alphabetically.
11325 If `case-fold-search' is non-nil, case of letters is ignored.
11326 Argument REVERSE means reverse order."
11328 (gnus-summary-sort 'recipient reverse))
11330 (defun gnus-summary-sort-by-subject (&optional reverse)
11331 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11332 If `case-fold-search' is non-nil, case of letters is ignored.
11333 Argument REVERSE means reverse order."
11335 (gnus-summary-sort 'subject reverse))
11337 (defun gnus-summary-sort-by-date (&optional reverse)
11338 "Sort the summary buffer by date.
11339 Argument REVERSE means reverse order."
11341 (gnus-summary-sort 'date reverse))
11343 (defun gnus-summary-sort-by-score (&optional reverse)
11344 "Sort the summary buffer by score.
11345 Argument REVERSE means reverse order."
11347 (gnus-summary-sort 'score reverse))
11349 (defun gnus-summary-sort-by-lines (&optional reverse)
11350 "Sort the summary buffer by the number of lines.
11351 Argument REVERSE means reverse order."
11353 (gnus-summary-sort 'lines reverse))
11355 (defun gnus-summary-sort-by-chars (&optional reverse)
11356 "Sort the summary buffer by article length.
11357 Argument REVERSE means reverse order."
11359 (gnus-summary-sort 'chars reverse))
11361 (defun gnus-summary-sort-by-original (&optional reverse)
11362 "Sort the summary buffer using the default sorting method.
11363 Argument REVERSE means reverse order."
11365 (let* ((buffer-read-only)
11366 (gnus-summary-prepare-hook nil))
11367 ;; We do the sorting by regenerating the threads.
11368 (gnus-summary-prepare)
11369 ;; Hide subthreads if needed.
11370 (gnus-summary-maybe-hide-threads)))
11372 (defun gnus-summary-sort (predicate reverse)
11373 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11374 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11375 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11376 (gnus-thread-sort-functions
11381 (gnus-sort-gathered-threads-function
11382 gnus-thread-sort-functions)
11383 (gnus-article-sort-functions
11387 (,article t2 t1))))
11389 (gnus-summary-prepare-hook nil))
11390 ;; We do the sorting by regenerating the threads.
11391 (gnus-summary-prepare)
11392 ;; Hide subthreads if needed.
11393 (gnus-summary-maybe-hide-threads)))
11395 ;; Summary saving commands.
11397 (defun gnus-summary-save-article (&optional n not-saved)
11398 "Save the current article using the default saver function.
11399 If N is a positive number, save the N next articles.
11400 If N is a negative number, save the N previous articles.
11401 If N is nil and any articles have been marked with the process mark,
11402 save those articles instead.
11403 The variable `gnus-default-article-saver' specifies the saver function.
11405 If the optional second argument NOT-SAVED is non-nil, articles saved
11406 will not be marked as saved."
11408 (require 'gnus-art)
11409 (let* ((articles (gnus-summary-work-articles n))
11410 (save-buffer (save-excursion
11411 (nnheader-set-temp-buffer " *Gnus Save*")))
11412 (num (length articles))
11413 ;; Whether to save decoded articles or raw articles.
11414 (decode (when gnus-article-save-coding-system
11415 (get gnus-default-article-saver :decode)))
11416 ;; When saving many articles in a single file, use the other
11417 ;; function to save articles other than the first one.
11418 (saver2 (get gnus-default-article-saver :function))
11419 (gnus-prompt-before-saving (if saver2
11421 gnus-prompt-before-saving))
11422 (gnus-default-article-saver gnus-default-article-saver)
11424 (dolist (article articles)
11425 (setq header (gnus-summary-article-header article))
11426 (if (not (vectorp header))
11427 ;; This is a pseudo-article.
11428 (if (assq 'name header)
11429 (gnus-copy-file (cdr (assq 'name header)))
11430 (gnus-message 1 "Article %d is unsaveable" article))
11431 ;; This is a real article.
11432 (save-window-excursion
11433 (let ((gnus-display-mime-function (when decode
11434 gnus-display-mime-function))
11435 (gnus-article-prepare-hook (when decode
11436 gnus-article-prepare-hook)))
11437 (gnus-summary-select-article t nil nil article)
11438 (gnus-summary-goto-subject article)))
11440 (set-buffer save-buffer)
11442 (insert-buffer-substring (if decode
11443 gnus-article-buffer
11444 gnus-original-article-buffer)))
11445 (setq file (gnus-article-save save-buffer file num))
11446 (gnus-summary-remove-process-mark article)
11448 (gnus-summary-set-saved-mark article)))
11450 (setq gnus-default-article-saver saver2
11452 (gnus-kill-buffer save-buffer)
11453 (gnus-summary-position-point)
11454 (gnus-set-mode-line 'summary)
11457 (defun gnus-summary-pipe-output (&optional arg headers)
11458 "Pipe the current article to a subprocess.
11459 If N is a positive number, pipe the N next articles.
11460 If N is a negative number, pipe the N previous articles.
11461 If N is nil and any articles have been marked with the process mark,
11462 pipe those articles instead.
11463 If HEADERS (the symbolic prefix), include the headers, too."
11464 (interactive (gnus-interactive "P\ny"))
11465 (require 'gnus-art)
11466 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11467 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11468 (gnus-summary-save-article arg t))
11469 (let ((buffer (get-buffer "*Shell Command Output*")))
11471 (not (zerop (buffer-size buffer))))
11472 (gnus-configure-windows 'pipe))))
11474 (defun gnus-summary-save-article-mail (&optional arg)
11475 "Append the current article to a Unix mail box file.
11476 If N is a positive number, save the N next articles.
11477 If N is a negative number, save the N previous articles.
11478 If N is nil and any articles have been marked with the process mark,
11479 save those articles instead."
11481 (require 'gnus-art)
11482 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11483 (gnus-summary-save-article arg)))
11485 (defun gnus-summary-save-article-rmail (&optional arg)
11486 "Append the current article to an rmail file.
11487 If N is a positive number, save the N next articles.
11488 If N is a negative number, save the N previous articles.
11489 If N is nil and any articles have been marked with the process mark,
11490 save those articles instead."
11492 (require 'gnus-art)
11493 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11494 (gnus-summary-save-article arg)))
11496 (defun gnus-summary-save-article-file (&optional arg)
11497 "Append the current article to a file.
11498 If N is a positive number, save the N next articles.
11499 If N is a negative number, save the N previous articles.
11500 If N is nil and any articles have been marked with the process mark,
11501 save those articles instead."
11503 (require 'gnus-art)
11504 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11505 (gnus-summary-save-article arg)))
11507 (defun gnus-summary-write-article-file (&optional arg)
11508 "Write the current article to a file, deleting the previous file.
11509 If N is a positive number, save the N next articles.
11510 If N is a negative number, save the N previous articles.
11511 If N is nil and any articles have been marked with the process mark,
11512 save those articles instead."
11514 (require 'gnus-art)
11515 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11516 (gnus-summary-save-article arg)))
11518 (defun gnus-summary-save-article-body-file (&optional arg)
11519 "Append the current article body to a file.
11520 If N is a positive number, save the N next articles.
11521 If N is a negative number, save the N previous articles.
11522 If N is nil and any articles have been marked with the process mark,
11523 save those articles instead."
11525 (require 'gnus-art)
11526 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11527 (gnus-summary-save-article arg)))
11529 (defun gnus-summary-write-article-body-file (&optional arg)
11530 "Write the current article body to a file, deleting the previous file.
11531 If N is a positive number, save the N next articles.
11532 If N is a negative number, save the N previous articles.
11533 If N is nil and any articles have been marked with the process mark,
11534 save those articles instead."
11536 (require 'gnus-art)
11537 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
11538 (gnus-summary-save-article arg)))
11540 (defun gnus-summary-muttprint (&optional arg)
11541 "Print the current article using Muttprint.
11542 If N is a positive number, save the N next articles.
11543 If N is a negative number, save the N previous articles.
11544 If N is nil and any articles have been marked with the process mark,
11545 save those articles instead."
11547 (require 'gnus-art)
11548 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11549 (gnus-summary-save-article arg t)))
11551 (defun gnus-summary-pipe-message (program)
11552 "Pipe the current article through PROGRAM."
11553 (interactive "sProgram: ")
11554 (gnus-summary-select-article)
11555 (let ((mail-header-separator ""))
11556 (gnus-eval-in-buffer-window gnus-article-buffer
11559 (let ((start (window-start))
11561 (message-pipe-buffer-body program)
11562 (set-window-start (get-buffer-window (current-buffer)) start))))))
11564 (defun gnus-get-split-value (methods)
11565 "Return a value based on the split METHODS."
11566 (let (split-name method result match)
11569 (set-buffer gnus-original-article-buffer)
11571 (nnheader-narrow-to-headers)
11572 (while (and methods (not split-name))
11573 (goto-char (point-min))
11574 (setq method (pop methods))
11575 (setq match (car method))
11578 ;; Regular expression.
11580 (re-search-forward match nil t)))
11585 (setq result (funcall match gnus-newsgroup-name))))
11590 (setq result (eval match)))))
11591 (setq split-name (cdr method))
11592 (cond ((stringp result)
11593 (push (expand-file-name
11594 result gnus-article-save-directory)
11597 (setq split-name (append result split-name)))))))))
11598 (nreverse split-name)))
11600 (defun gnus-valid-move-group-p (group)
11601 (and (boundp group)
11602 (symbol-name group)
11603 (symbol-value group)
11604 (gnus-get-function (gnus-find-method-for-group
11605 (symbol-name group)) 'request-accept-article t)))
11607 (defun gnus-read-move-group-name (prompt default articles prefix)
11608 "Read a group name."
11609 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11610 (minibuffer-confirm-incomplete nil) ; XEmacs
11614 (if (> (length articles) 1)
11615 (format "these %d articles" (length articles))
11620 (gnus-completing-read-with-default
11623 'gnus-valid-move-group-p
11625 'gnus-group-history))
11626 ((= 1 (length split-name))
11627 (gnus-completing-read-with-default
11628 (car split-name) prom
11630 'gnus-valid-move-group-p
11632 'gnus-group-history))
11634 (gnus-completing-read-with-default
11636 (mapcar 'list (nreverse split-name))
11638 'gnus-group-history))))
11639 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11641 (if (or (string= to-newsgroup "")
11642 (string= to-newsgroup prefix))
11643 (setq to-newsgroup default))
11644 (unless to-newsgroup
11645 (error "No group name entered"))
11646 (or (gnus-active to-newsgroup)
11647 (gnus-activate-group to-newsgroup nil nil to-method)
11648 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11650 (or (and (gnus-request-create-group to-newsgroup to-method)
11651 (gnus-activate-group
11652 to-newsgroup nil nil to-method)
11653 (gnus-subscribe-group to-newsgroup))
11654 (error "Couldn't create group %s" to-newsgroup)))
11655 (error "No such group: %s" to-newsgroup)))
11658 (defvar gnus-summary-save-parts-counter)
11660 (defun gnus-summary-save-parts (type dir n &optional reverse)
11661 "Save parts matching TYPE to DIR.
11662 If REVERSE, save parts that do not match TYPE."
11664 (list (read-string "Save parts of type: "
11665 (or (car gnus-summary-save-parts-type-history)
11666 gnus-summary-save-parts-default-mime)
11667 'gnus-summary-save-parts-type-history)
11668 (setq gnus-summary-save-parts-last-directory
11669 (read-file-name "Save to directory: "
11670 gnus-summary-save-parts-last-directory
11672 current-prefix-arg))
11673 (gnus-summary-iterate n
11674 (let ((gnus-display-mime-function nil)
11675 (gnus-inhibit-treatment t))
11676 (gnus-summary-select-article))
11678 (set-buffer gnus-article-buffer)
11679 (let ((handles (or gnus-article-mime-handles
11680 (mm-dissect-buffer nil gnus-article-loose-mime)
11681 (and gnus-article-emulate-mime
11683 (gnus-summary-save-parts-counter 1))
11685 (gnus-summary-save-parts-1 type dir handles reverse)
11686 (unless gnus-article-mime-handles ;; Don't destroy this case.
11687 (mm-destroy-parts handles)))))))
11689 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11690 (if (stringp (car handle))
11691 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11694 (not (string-match type (mm-handle-media-type handle)))
11695 (string-match type (mm-handle-media-type handle)))
11696 (let ((file (expand-file-name
11698 mm-file-name-rewrite-functions
11699 (file-name-nondirectory
11701 (mail-content-type-get
11702 (mm-handle-disposition handle) 'filename)
11703 (mail-content-type-get
11704 (mm-handle-type handle) 'name)
11705 (format "%s.%d.%d" gnus-newsgroup-name
11706 (cdr gnus-article-current)
11707 gnus-summary-save-parts-counter))))
11709 (incf gnus-summary-save-parts-counter)
11710 (unless (file-exists-p file)
11711 (mm-save-part-to-file handle file))))))
11713 ;; Summary extract commands
11715 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11716 (let ((buffer-read-only nil)
11717 (article (gnus-summary-article-number))
11719 (unless (gnus-summary-goto-subject article)
11720 (error "No such article: %d" article))
11721 (gnus-summary-position-point)
11722 ;; If all commands are to be bunched up on one line, we collect
11724 (unless gnus-view-pseudos-separately
11725 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11728 (setq action (cdr (assq 'action (car ps))))
11729 (setq files (list (cdr (assq 'name (car ps)))))
11730 (while (and ps (cdr ps)
11731 (string= (or action "1")
11732 (or (cdr (assq 'action (cadr ps))) "2")))
11733 (push (cdr (assq 'name (cadr ps))) files)
11734 (setcdr ps (cddr ps)))
11736 (when (not (string-match "%s" action))
11739 (when (assq 'execute (car ps))
11740 (setcdr (assq 'execute (car ps))
11741 (funcall (if (string-match "%s" action)
11748 (shell-quote-argument f)))
11750 (setq ps (cdr ps)))))
11751 (if (and gnus-view-pseudos (not not-view))
11753 (when (assq 'execute (car pslist))
11754 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11755 (eq gnus-view-pseudos 'not-confirm)))
11756 (setq pslist (cdr pslist)))
11759 (setq after-article (or (cdr (assq 'article (car pslist)))
11760 (gnus-summary-article-number)))
11761 (gnus-summary-goto-subject after-article)
11764 (insert " " (file-name-nondirectory
11765 (cdr (assq 'name (car pslist))))
11766 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11768 (forward-line -1) ; back to `b'
11769 (gnus-add-text-properties
11770 b (1- e) (list 'gnus-number gnus-reffed-article-number
11771 gnus-mouse-face-prop gnus-mouse-face))
11773 after-article gnus-reffed-article-number
11774 gnus-unread-mark b (car pslist) 0 (- e b))
11775 (setq gnus-newsgroup-unreads
11776 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11777 gnus-reffed-article-number))
11778 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11779 (setq pslist (cdr pslist)))))))
11781 (defun gnus-pseudos< (p1 p2)
11782 (let ((c1 (cdr (assq 'action p1)))
11783 (c2 (cdr (assq 'action p2))))
11784 (and c1 c2 (string< c1 c2))))
11786 (defun gnus-request-pseudo-article (props)
11787 (cond ((assq 'execute props)
11788 (gnus-execute-command (cdr (assq 'execute props)))))
11789 (let ((gnus-current-article (gnus-summary-article-number)))
11790 (gnus-run-hooks 'gnus-mark-article-hook)))
11792 (defun gnus-execute-command (command &optional automatic)
11794 (gnus-article-setup-buffer)
11795 (set-buffer gnus-article-buffer)
11796 (setq buffer-read-only nil)
11797 (let ((command (if automatic command
11798 (read-string "Command: " (cons command 0)))))
11800 (insert "$ " command "\n\n")
11801 (if gnus-view-pseudo-asynchronously
11802 (start-process "gnus-execute" (current-buffer) shell-file-name
11803 shell-command-switch command)
11804 (call-process shell-file-name nil t nil
11805 shell-command-switch command)))))
11807 ;; Summary kill commands.
11809 (defun gnus-summary-edit-global-kill (article)
11810 "Edit the \"global\" kill file."
11811 (interactive (list (gnus-summary-article-number)))
11812 (gnus-group-edit-global-kill article))
11814 (defun gnus-summary-edit-local-kill ()
11815 "Edit a local kill file applied to the current newsgroup."
11817 (setq gnus-current-headers (gnus-summary-article-header))
11818 (gnus-group-edit-local-kill
11819 (gnus-summary-article-number) gnus-newsgroup-name))
11821 ;;; Header reading.
11823 (defun gnus-read-header (id &optional header)
11824 "Read the headers of article ID and enter them into the Gnus system."
11825 (let ((group gnus-newsgroup-name)
11826 (gnus-override-method
11828 gnus-override-method
11829 (and (gnus-news-group-p gnus-newsgroup-name)
11830 (car (gnus-refer-article-methods)))))
11832 ;; First we check to see whether the header in question is already
11835 ;; This is a Message-ID.
11836 (setq header (or header (gnus-id-to-header id)))
11837 ;; This is an article number.
11838 (setq header (or header (gnus-summary-article-header id))))
11840 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11841 ;; We have found the header.
11843 ;; We have to really fetch the header to this article.
11845 (set-buffer nntp-server-buffer)
11846 (when (setq where (gnus-request-head id group))
11847 (nnheader-fold-continuation-lines)
11848 (goto-char (point-max))
11850 (goto-char (point-min))
11854 ((cdr where) (cdr where))
11855 (header (mail-header-number header))
11856 (t gnus-reffed-article-number))
11858 (insert " Article retrieved.\n"))
11859 (if (or (not where)
11860 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11861 () ; Malformed head.
11862 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11863 (when (and (stringp id)
11865 (not (string= (gnus-group-real-name group)
11867 (not (gnus-server-equal gnus-override-method
11868 (gnus-group-method group)))))
11869 ;; If we fetched by Message-ID and the article came from
11870 ;; a different group (or server), we fudge some bogus
11871 ;; article numbers for this article.
11872 (mail-header-set-number header gnus-reffed-article-number))
11874 (set-buffer gnus-summary-buffer)
11875 (decf gnus-reffed-article-number)
11876 (gnus-remove-header (mail-header-number header))
11877 (push header gnus-newsgroup-headers)
11878 (setq gnus-current-headers header)
11879 (push (mail-header-number header) gnus-newsgroup-limit)))
11882 (defun gnus-remove-header (number)
11883 "Remove header NUMBER from `gnus-newsgroup-headers'."
11884 (if (and gnus-newsgroup-headers
11885 (= number (mail-header-number (car gnus-newsgroup-headers))))
11886 (pop gnus-newsgroup-headers)
11887 (let ((headers gnus-newsgroup-headers))
11888 (while (and (cdr headers)
11889 (not (= number (mail-header-number (cadr headers)))))
11891 (when (cdr headers)
11892 (setcdr headers (cddr headers))))))
11895 ;;; summary highlights
11898 (defun gnus-highlight-selected-summary ()
11899 "Highlight selected article in summary buffer."
11900 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11901 (when gnus-summary-selected-face
11903 (let* ((beg (point-at-bol))
11904 (end (point-at-eol))
11905 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11906 (from (if (get-text-property beg gnus-mouse-face-prop)
11908 (or (next-single-property-change
11909 beg gnus-mouse-face-prop nil end)
11914 (or (next-single-property-change
11915 from gnus-mouse-face-prop nil end)
11917 ;; If no mouse-face prop on line we will have to = from = end,
11918 ;; so we highlight the entire line instead.
11919 (when (= (+ to 2) from)
11922 (if gnus-newsgroup-selected-overlay
11923 ;; Move old overlay.
11925 gnus-newsgroup-selected-overlay from to (current-buffer))
11926 ;; Create new overlay.
11928 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11929 'face gnus-summary-selected-face))))))
11931 (defvar gnus-summary-highlight-line-cached nil)
11932 (defvar gnus-summary-highlight-line-trigger nil)
11934 (defun gnus-summary-highlight-line-0 ()
11935 (if (and (eq gnus-summary-highlight-line-trigger
11936 gnus-summary-highlight)
11937 gnus-summary-highlight-line-cached)
11938 gnus-summary-highlight-line-cached
11939 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11940 gnus-summary-highlight-line-cached
11941 (let* ((cond (list 'cond))
11943 (list gnus-summary-highlight))
11945 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11949 (gnus-byte-compile (list 'lambda nil cond))))))
11951 (defun gnus-summary-highlight-line ()
11952 "Highlight current line according to `gnus-summary-highlight'."
11953 (let* ((beg (point-at-bol))
11954 (article (or (gnus-summary-article-number) gnus-current-article))
11955 (score (or (cdr (assq article
11956 gnus-newsgroup-scored))
11957 gnus-summary-default-score 0))
11958 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11959 (inhibit-read-only t)
11960 (default gnus-summary-default-score)
11961 (default-high gnus-summary-default-high-score)
11962 (default-low gnus-summary-default-low-score)
11963 (uncached (and gnus-summary-use-undownloaded-faces
11964 (memq article gnus-newsgroup-undownloaded)
11965 (not (memq article gnus-newsgroup-cached)))))
11966 (let ((face (funcall (gnus-summary-highlight-line-0))))
11967 (unless (eq face (get-text-property beg 'face))
11968 (gnus-put-text-property-excluding-characters-with-faces
11969 beg (point-at-eol) 'face
11970 (setq face (if (boundp face) (symbol-value face) face)))
11971 (when gnus-summary-highlight-line-function
11972 (funcall gnus-summary-highlight-line-function article face))))))
11974 (defun gnus-update-read-articles (group unread &optional compute)
11975 "Update the list of read articles in GROUP.
11976 UNREAD is a sorted list."
11977 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11978 (info (gnus-get-info group))
11981 (if (or (not info) (not active))
11982 ;; There is no info on this group if it was, in fact,
11983 ;; killed. Gnus stores no information on killed groups, so
11984 ;; there's nothing to be done.
11985 ;; One could store the information somewhere temporarily,
11986 ;; perhaps... Hmmm...
11988 ;; Remove any negative articles numbers.
11989 (while (and unread (< (car unread) 0))
11990 (setq unread (cdr unread)))
11991 ;; Remove any expired article numbers
11992 (while (and unread (< (car unread) (car active)))
11993 (setq unread (cdr unread)))
11994 ;; Compute the ranges of read articles by looking at the list of
11995 ;; unread articles.
11997 (when (/= (car unread) prev)
11998 (push (if (= prev (1- (car unread))) prev
11999 (cons prev (1- (car unread))))
12001 (setq prev (1+ (car unread)))
12002 (setq unread (cdr unread)))
12003 (when (<= prev (cdr active))
12004 (push (cons prev (cdr active)) read))
12005 (setq read (if (> (length read) 1) (nreverse read) read))
12010 ;; Propagate the read marks to the backend.
12011 (when (gnus-check-backend-function 'request-set-mark group)
12012 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12013 (add (gnus-remove-from-range read (gnus-info-read info))))
12015 (unless (gnus-check-group group)
12016 (error "Can't open server for %s" group))
12017 (gnus-request-set-mark
12018 group (delq nil (list (if add (list add 'add '(read)))
12019 (if del (list del 'del '(read))))))
12021 `(gnus-request-set-mark
12024 (if del (list del 'add '(read)))
12025 (if add (list add 'del '(read))))))))))
12026 (set-buffer gnus-group-buffer)
12027 (gnus-undo-register
12029 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12030 (gnus-info-set-read ',info ',(gnus-info-read info))
12031 (gnus-get-unread-articles-in-group ',info
12032 (gnus-active ,group))
12033 (gnus-group-update-group ,group t)
12035 ;; Enter this list into the group info.
12036 (gnus-info-set-read info read)
12037 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12038 (gnus-get-unread-articles-in-group info (gnus-active group))
12041 (defun gnus-offer-save-summaries ()
12042 "Offer to save all active summary buffers."
12044 ;; Go through all buffers and find all summaries.
12045 (dolist (buffer (buffer-list))
12046 (when (and (setq buffer (buffer-name buffer))
12047 (string-match "Summary" buffer)
12048 (with-current-buffer buffer
12049 ;; We check that this is, indeed, a summary buffer.
12050 (and (eq major-mode 'gnus-summary-mode)
12051 ;; Also make sure this isn't bogus.
12052 gnus-newsgroup-prepared
12053 ;; Also make sure that this isn't a
12054 ;; dead summary buffer.
12055 (not gnus-dead-summary-mode))))
12056 (push buffer buffers)))
12057 ;; Go through all these summary buffers and offer to save them.
12061 "Update summary buffer %s? "
12063 (switch-to-buffer buf)
12064 (gnus-summary-exit))
12067 (defun gnus-summary-setup-default-charset ()
12068 "Setup newsgroup default charset."
12069 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12070 (setq gnus-newsgroup-charset nil)
12071 (let* ((ignored-charsets
12072 (or gnus-newsgroup-ephemeral-ignored-charsets
12074 (and gnus-newsgroup-name
12075 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12076 gnus-newsgroup-ignored-charsets))))
12077 (setq gnus-newsgroup-charset
12078 (or gnus-newsgroup-ephemeral-charset
12079 (and gnus-newsgroup-name
12080 (gnus-parameter-charset gnus-newsgroup-name))
12081 gnus-default-charset))
12082 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12083 ignored-charsets))))
12089 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12090 "Display the current article buffer fully MIME-buttonized.
12091 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12092 treated as multipart/mixed."
12094 (require 'gnus-art)
12095 (let ((gnus-unbuttonized-mime-types nil)
12096 (gnus-mime-display-multipart-as-mixed show-all-parts))
12097 (gnus-summary-show-article)))
12099 (defun gnus-summary-repair-multipart (article)
12100 "Add a Content-Type header to a multipart article without one."
12101 (interactive (list (gnus-summary-article-number)))
12102 (gnus-with-article article
12103 (message-narrow-to-head)
12104 (message-remove-header "Mime-Version")
12105 (goto-char (point-max))
12106 (insert "Mime-Version: 1.0\n")
12108 (when (search-forward "\n--" nil t)
12109 (let ((separator (buffer-substring (point) (point-at-eol))))
12110 (message-narrow-to-head)
12111 (message-remove-header "Content-Type")
12112 (goto-char (point-max))
12113 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12116 (let (gnus-mark-article-hook)
12117 (gnus-summary-select-article t t nil article)))
12119 (defun gnus-summary-toggle-display-buttonized ()
12120 "Toggle the buttonizing of the article buffer."
12122 (require 'gnus-art)
12123 (if (setq gnus-inhibit-mime-unbuttonizing
12124 (not gnus-inhibit-mime-unbuttonizing))
12125 (let ((gnus-unbuttonized-mime-types nil))
12126 (gnus-summary-show-article))
12127 (gnus-summary-show-article)))
12130 ;;; Generic summary marking commands
12133 (defvar gnus-summary-marking-alist
12134 '((read gnus-del-mark "d")
12135 (unread gnus-unread-mark "u")
12136 (ticked gnus-ticked-mark "!")
12137 (dormant gnus-dormant-mark "?")
12138 (expirable gnus-expirable-mark "e"))
12139 "An alist of names/marks/keystrokes.")
12141 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12142 (defvar gnus-summary-mark-map)
12144 (defun gnus-summary-make-all-marking-commands ()
12145 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12146 (dolist (elem gnus-summary-marking-alist)
12147 (apply 'gnus-summary-make-marking-command elem)))
12149 (defun gnus-summary-make-marking-command (name mark keystroke)
12150 (let ((map (make-sparse-keymap)))
12151 (define-key gnus-summary-generic-mark-map keystroke map)
12152 (dolist (lway `((next "next" next nil "n")
12153 (next-unread "next unread" next t "N")
12154 (prev "previous" prev nil "p")
12155 (prev-unread "previous unread" prev t "P")
12156 (nomove "" nil nil ,keystroke)))
12157 (let ((func (gnus-summary-make-marking-command-1
12158 mark (car lway) lway name)))
12159 (setq func (eval func))
12160 (define-key map (nth 4 lway) func)))))
12162 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12164 (format "gnus-summary-put-mark-as-%s%s"
12165 name (if (eq way 'nomove)
12167 (concat "-" (symbol-name way)))))
12170 "Mark the current article as %s%s.
12171 If N, the prefix, then repeat N times.
12172 If N is negative, move in reverse order.
12173 The difference between N and the actual number of articles marked is
12177 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12179 (defun gnus-summary-generic-mark (n mark move unread)
12180 "Mark N articles with MARK."
12181 (unless (eq major-mode 'gnus-summary-mode)
12182 (error "This command can only be used in the summary buffer"))
12183 (gnus-summary-show-thread)
12186 ((eq move 'next) 1)
12187 ((eq move 'prev) -1)
12189 (if (zerop nummove)
12193 nummove (* -1 nummove))))
12194 (while (and (> n 0)
12195 (gnus-summary-mark-article nil mark)
12196 (zerop (gnus-summary-next-subject nummove unread t)))
12199 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12200 (gnus-summary-recenter)
12201 (gnus-summary-position-point)
12202 (gnus-set-mode-line 'summary)
12205 (defun gnus-summary-insert-articles (articles)
12206 (when (setq articles
12207 (gnus-sorted-difference articles
12208 (mapcar (lambda (h)
12209 (mail-header-number h))
12210 gnus-newsgroup-headers)))
12211 (setq gnus-newsgroup-headers
12213 gnus-newsgroup-headers
12214 (gnus-fetch-headers articles)
12215 'gnus-article-sort-by-number))
12216 ;; Suppress duplicates?
12217 (when gnus-suppress-duplicates
12218 (gnus-dup-suppress-articles))
12220 ;; We might want to build some more threads first.
12221 (when (and gnus-fetch-old-headers
12222 (eq gnus-headers-retrieved-by 'nov))
12223 (if (eq gnus-fetch-old-headers 'invisible)
12224 (gnus-build-all-threads)
12225 (gnus-build-old-threads)))
12226 ;; Let the Gnus agent mark articles as read.
12228 (gnus-agent-get-undownloaded-list))
12229 ;; Remove list identifiers from subject
12230 (when gnus-list-identifiers
12231 (gnus-summary-remove-list-identifiers))
12232 ;; First and last article in this newsgroup.
12233 (when gnus-newsgroup-headers
12234 (setq gnus-newsgroup-begin
12235 (mail-header-number (car gnus-newsgroup-headers))
12237 (mail-header-number
12238 (gnus-last-element gnus-newsgroup-headers))))
12239 (when gnus-use-scoring
12240 (gnus-possibly-score-headers))))
12242 (defun gnus-summary-insert-old-articles (&optional all)
12243 "Insert all old articles in this group.
12244 If ALL is non-nil, already read articles become readable.
12245 If ALL is a number, fetch this number of articles."
12248 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12251 ;; Some nntp servers lie about their active range. When
12252 ;; this happens, the active range can be in the millions.
12253 ;; Use a compressed range to avoid creating a huge list.
12254 (gnus-range-difference (list gnus-newsgroup-active) old))
12255 (setq len (gnus-range-length older))
12260 (let ((older-range (nreverse older)))
12264 (let* ((r (pop older-range))
12265 (min (if (numberp r) r (car r)))
12266 (max (if (numberp r) r (cdr r))))
12267 (while (and (<= min max)
12272 (setq older (gnus-uncompress-range older))))
12274 (setq older (gnus-uncompress-range older)))
12276 (when (and (numberp gnus-large-newsgroup)
12277 (> len gnus-large-newsgroup))
12278 (let* ((cursor-in-echo-area nil)
12279 (initial (gnus-parameter-large-newsgroup-initial
12280 gnus-newsgroup-name))
12284 "How many articles from %s (%s %d): "
12286 (gnus-group-decoded-name gnus-newsgroup-name) 35)
12287 (if initial "max" "default")
12290 (cons (number-to-string initial)
12292 (unless (string-match "^[ \t]*$" input)
12293 (setq all (string-to-number input))
12295 (let ((older-range (nreverse older)))
12299 (let* ((r (pop older-range))
12300 (min (if (numberp r) r (car r)))
12301 (max (if (numberp r) r (cdr r))))
12302 (while (and (<= min max)
12306 max (1- max))))))))))
12307 (setq older (gnus-uncompress-range older))))
12309 (message "No old news.")
12310 (gnus-summary-insert-articles older)
12311 (gnus-summary-limit (gnus-sorted-nunion old older))))
12312 (gnus-summary-position-point)))
12314 (defun gnus-summary-insert-new-articles ()
12315 "Insert all new articles in this group."
12318 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12319 (old-active gnus-newsgroup-active)
12320 (nnmail-fetched-sources (list t))
12322 (setq gnus-newsgroup-active
12323 (gnus-activate-group gnus-newsgroup-name 'scan))
12324 (setq i (cdr gnus-newsgroup-active))
12325 (while (> i (cdr old-active))
12329 (message "No gnus is bad news")
12330 (gnus-summary-insert-articles new)
12331 (setq gnus-newsgroup-unreads
12332 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12333 (gnus-summary-limit (gnus-sorted-nunion old new))))
12334 (gnus-summary-position-point)))
12336 (gnus-summary-make-all-marking-commands)
12338 (gnus-ems-redefine)
12340 (provide 'gnus-sum)
12342 (run-hooks 'gnus-sum-load-hook)
12344 ;; Local Variables:
12345 ;; coding: iso-8859-1
12348 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12349 ;;; gnus-sum.el ends here