1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defvar tool-bar-map))
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-cache-write-active "gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
48 (autoload 'mm-uu-dissect "mm-uu")
49 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
50 "Deuglify broken Outlook (Express) articles and redisplay."
52 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
53 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
54 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
56 (defcustom gnus-kill-summary-on-exit t
57 "*If non-nil, kill the summary buffer when you exit from it.
58 If nil, the summary will become a \"*Dead Summary*\" buffer, and
59 it will be killed sometime later."
60 :group 'gnus-summary-exit
63 (defcustom gnus-fetch-old-headers nil
64 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
65 If an unread article in the group refers to an older, already read (or
66 just marked as read) article, the old article will not normally be
67 displayed in the Summary buffer. If this variable is t, Gnus
68 will attempt to grab the headers to the old articles, and thereby
69 build complete threads. If it has the value `some', only enough
70 headers to connect otherwise loose threads will be displayed. This
71 variable can also be a number. In that case, no more than that number
72 of old headers will be fetched. If it has the value `invisible', all
73 old headers will be fetched, but none will be displayed.
75 The server has to support NOV for any of this to work."
77 :type '(choice (const :tag "off" nil)
82 (sexp :menu-tag "other" t)))
84 (defcustom gnus-refer-thread-limit 200
85 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
86 If t, fetch all the available old headers."
89 (sexp :menu-tag "other" t)))
91 (defcustom gnus-summary-make-false-root 'adopt
92 "*nil means that Gnus won't gather loose threads.
93 If the root of a thread has expired or been read in a previous
94 session, the information necessary to build a complete thread has been
95 lost. Instead of having many small sub-threads from this original thread
96 scattered all over the summary buffer, Gnus can gather them.
98 If non-nil, Gnus will try to gather all loose sub-threads from an
99 original thread into one large thread.
101 If this variable is non-nil, it should be one of `none', `adopt',
104 If this variable is `none', Gnus will not make a false root, but just
105 present the sub-threads after another.
106 If this variable is `dummy', Gnus will create a dummy root that will
107 have all the sub-threads as children.
108 If this variable is `adopt', Gnus will make one of the \"children\"
109 the parent and mark all the step-children as such.
110 If this variable is `empty', the \"children\" are printed with empty
111 subject fields. (Or rather, they will be printed with a string
112 given by the `gnus-summary-same-subject' variable.)"
114 :type '(choice (const :tag "off" nil)
120 (defcustom gnus-summary-make-false-root-always nil
121 "Always make a false dummy root."
126 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
127 "*A regexp to match subjects to be excluded from loose thread gathering.
128 As loose thread gathering is done on subjects only, that means that
129 there can be many false gatherings performed. By rooting out certain
130 common subjects, gathering might become saner."
134 (defcustom gnus-summary-gather-subject-limit nil
135 "*Maximum length of subject comparisons when gathering loose threads.
136 Use nil to compare full subjects. Setting this variable to a low
137 number will help gather threads that have been corrupted by
138 newsreaders chopping off subject lines, but it might also mean that
139 unrelated articles that have subject that happen to begin with the
140 same few characters will be incorrectly gathered.
142 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
145 :type '(choice (const :tag "off" nil)
147 (sexp :menu-tag "on" t)))
149 (defcustom gnus-simplify-subject-functions nil
150 "List of functions taking a string argument that simplify subjects.
151 The functions are applied recursively.
153 Useful functions to put in this list include:
154 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
155 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
157 :type '(repeat function))
159 (defcustom gnus-simplify-ignored-prefixes nil
160 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
162 :type '(choice (const :tag "off" nil)
165 (defcustom gnus-build-sparse-threads nil
166 "*If non-nil, fill in the gaps in threads.
167 If `some', only fill in the gaps that are needed to tie loose threads
168 together. If `more', fill in all leaf nodes that Gnus can find. If
169 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
171 :type '(choice (const :tag "off" nil)
174 (sexp :menu-tag "all" t)))
176 (defcustom gnus-summary-thread-gathering-function
177 'gnus-gather-threads-by-subject
178 "*Function used for gathering loose threads.
179 There are two pre-defined functions: `gnus-gather-threads-by-subject',
180 which only takes Subjects into consideration; and
181 `gnus-gather-threads-by-references', which compared the References
182 headers of the articles to find matches."
184 :type '(radio (function-item gnus-gather-threads-by-subject)
185 (function-item gnus-gather-threads-by-references)
186 (function :tag "other")))
188 (defcustom gnus-summary-same-subject ""
189 "*String indicating that the current article has the same subject as the previous.
190 This variable will only be used if the value of
191 `gnus-summary-make-false-root' is `empty'."
192 :group 'gnus-summary-format
195 (defcustom gnus-summary-goto-unread t
196 "*If t, many commands will go to the next unread article.
197 This applies to marking commands as well as other commands that
198 \"naturally\" select the next article, like, for instance, `SPC' at
199 the end of an article.
201 If nil, the marking commands do NOT go to the next unread article
202 \(they go to the next article instead). If `never', commands that
203 usually go to the next unread article, will go to the next article,
204 whether it is read or not."
205 :group 'gnus-summary-marks
206 :link '(custom-manual "(gnus)Setting Marks")
207 :type '(choice (const :tag "off" nil)
209 (sexp :menu-tag "on" t)))
211 (defcustom gnus-summary-default-score 0
212 "*Default article score level.
213 All scores generated by the score files will be added to this score.
214 If this variable is nil, scoring will be disabled."
215 :group 'gnus-score-default
216 :type '(choice (const :tag "disable")
219 (defcustom gnus-summary-default-high-score 0
220 "*Default threshold for a high scored article.
221 An article will be highlighted as high scored if its score is greater
224 :group 'gnus-score-default
227 (defcustom gnus-summary-default-low-score 0
228 "*Default threshold for a low scored article.
229 An article will be highlighted as low scored if its score is smaller
232 :group 'gnus-score-default
235 (defcustom gnus-summary-zcore-fuzz 0
236 "*Fuzziness factor for the zcore in the summary buffer.
237 Articles with scores closer than this to `gnus-summary-default-score'
239 :group 'gnus-summary-format
242 (defcustom gnus-simplify-subject-fuzzy-regexp nil
243 "*Strings to be removed when doing fuzzy matches.
244 This can either be a regular expression or list of regular expressions
245 that will be removed from subject strings if fuzzy subject
246 simplification is selected."
248 :type '(repeat regexp))
250 (defcustom gnus-show-threads t
251 "*If non-nil, display threads in summary mode."
255 (defcustom gnus-thread-hide-subtree nil
256 "*If non-nil, hide all threads initially.
257 This can be a predicate specifier which says which threads to hide.
258 If threads are hidden, you have to run the command
259 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
260 to expose hidden threads."
262 :type '(radio (sexp :format "Non-nil\n"
263 :match (lambda (widget value)
264 (not (or (consp value) (functionp value))))
267 (sexp :tag "Predicate specifier" :size 0)))
269 (defcustom gnus-thread-hide-killed t
270 "*If non-nil, hide killed threads automatically."
274 (defcustom gnus-thread-ignore-subject t
275 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
276 If nil, articles that have different subjects from their parents will
277 start separate threads."
281 (defcustom gnus-thread-operation-ignore-subject t
282 "*If non-nil, subjects will be ignored when doing thread commands.
283 This affects commands like `gnus-summary-kill-thread' and
284 `gnus-summary-lower-thread'.
286 If this variable is nil, articles in the same thread with different
287 subjects will not be included in the operation in question. If this
288 variable is `fuzzy', only articles that have subjects that are fuzzily
289 equal will be included."
291 :type '(choice (const :tag "off" nil)
295 (defcustom gnus-thread-indent-level 4
296 "*Number that says how much each sub-thread should be indented."
300 (defcustom gnus-auto-extend-newsgroup t
301 "*If non-nil, extend newsgroup forward and backward when requested."
302 :group 'gnus-summary-choose
305 (defcustom gnus-auto-select-first t
306 "*If non-nil, select the article under point.
307 Which article this is is controlled by the `gnus-auto-select-subject'
310 If you want to prevent automatic selection of articles in some
311 newsgroups, set the variable to nil in `gnus-select-group-hook'."
312 :group 'gnus-group-select
313 :type '(choice (const :tag "none" nil)
314 (sexp :menu-tag "first" t)))
316 (defcustom gnus-auto-select-subject 'unread
317 "*Says what subject to place under point when entering a group.
319 This variable can either be the symbols `first' (place point on the
320 first subject), `unread' (place point on the subject line of the first
321 unread article), `best' (place point on the subject line of the
322 higest-scored article), `unseen' (place point on the subject line of
323 the first unseen article), 'unseen-or-unread' (place point on the subject
324 line of the first unseen article or, if all article have been seen, on the
325 subject line of the first unread article), or a function to be called to
326 place point on some subject line."
328 :group 'gnus-group-select
329 :type '(choice (const best)
333 (const unseen-or-unread)))
335 (defcustom gnus-auto-select-next t
336 "*If non-nil, offer to go to the next group from the end of the previous.
337 If the value is t and the next newsgroup is empty, Gnus will exit
338 summary mode and go back to group mode. If the value is neither nil
339 nor t, Gnus will select the following unread newsgroup. In
340 particular, if the value is the symbol `quietly', the next unread
341 newsgroup will be selected without any confirmation, and if it is
342 `almost-quietly', the next group will be selected without any
343 confirmation if you are located on the last article in the group.
344 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
345 will go to the next group without confirmation."
346 :group 'gnus-summary-maneuvering
347 :type '(choice (const :tag "off" nil)
349 (const almost-quietly)
350 (const slightly-quietly)
351 (sexp :menu-tag "on" t)))
353 (defcustom gnus-auto-select-same nil
354 "*If non-nil, select the next article with the same subject.
355 If there are no more articles with the same subject, go to
356 the first unread article."
357 :group 'gnus-summary-maneuvering
360 (defcustom gnus-auto-goto-ignores 'unfetched
361 "*Says how to handle unfetched articles when maneuvering.
363 This variable can either be the symbols nil (maneuver to any
364 article), `undownloaded' (maneuvering while unplugged ignores articles
365 that have not been fetched), `always-undownloaded' (maneuvering always
366 ignores articles that have not been fetched), `unfetched' (maneuvering
367 ignores articles whose headers have not been fetched).
369 NOTE: The list of unfetched articles will always be nil when plugged
370 and, when unplugged, a subset of the undownloaded article list."
372 :group 'gnus-summary-maneuvering
373 :type '(choice (const :tag "None" nil)
374 (const :tag "Undownloaded when unplugged" undownloaded)
375 (const :tag "Undownloaded" always-undownloaded)
376 (const :tag "Unfetched" unfetched)))
378 (defcustom gnus-summary-check-current nil
379 "*If non-nil, consider the current article when moving.
380 The \"unread\" movement commands will stay on the same line if the
381 current article is unread."
382 :group 'gnus-summary-maneuvering
385 (defcustom gnus-auto-center-summary 2
386 "*If non-nil, always center the current summary buffer.
387 In particular, if `vertical' do only vertical recentering. If non-nil
388 and non-`vertical', do both horizontal and vertical recentering."
389 :group 'gnus-summary-maneuvering
390 :type '(choice (const :tag "none" nil)
392 (integer :tag "height")
393 (sexp :menu-tag "both" t)))
395 (defvar gnus-auto-center-group t
396 "*If non-nil, always center the group buffer.")
398 (defcustom gnus-show-all-headers nil
399 "*If non-nil, don't hide any headers."
400 :group 'gnus-article-hiding
401 :group 'gnus-article-headers
404 (defcustom gnus-summary-ignore-duplicates nil
405 "*If non-nil, ignore articles with identical Message-ID headers."
409 (defcustom gnus-single-article-buffer t
410 "*If non-nil, display all articles in the same buffer.
411 If nil, each group will get its own article buffer."
412 :group 'gnus-article-various
415 (defcustom gnus-break-pages t
416 "*If non-nil, do page breaking on articles.
417 The page delimiter is specified by the `gnus-page-delimiter'
419 :group 'gnus-article-various
422 (defcustom gnus-move-split-methods nil
423 "*Variable used to suggest where articles are to be moved to.
424 It uses the same syntax as the `gnus-split-methods' variable.
425 However, whereas `gnus-split-methods' specifies file names as targets,
426 this variable specifies group names."
427 :group 'gnus-summary-mail
428 :type '(repeat (choice (list :value (fun) function)
429 (cons :value ("" "") regexp (repeat string))
432 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
433 "Function used to compute default prefix for article move/copy/etc prompts.
434 The function should take one argument, a group name, and return a
435 string with the suggested prefix."
436 :group 'gnus-summary-mail
439 ;; FIXME: Although the custom type is `character' for the following variables,
440 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
442 (defcustom gnus-unread-mark ? ;Whitespace
443 "*Mark used for unread articles."
444 :group 'gnus-summary-marks
447 (defcustom gnus-ticked-mark ?!
448 "*Mark used for ticked articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-dormant-mark ??
453 "*Mark used for dormant articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-del-mark ?r
458 "*Mark used for del'd articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-read-mark ?R
463 "*Mark used for read articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-expirable-mark ?E
468 "*Mark used for expirable articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-killed-mark ?K
473 "*Mark used for killed articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-spam-mark ?$
478 "*Mark used for spam articles."
480 :group 'gnus-summary-marks
483 (defcustom gnus-souped-mark ?F
484 "*Mark used for souped articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-kill-file-mark ?X
489 "*Mark used for articles killed by kill files."
490 :group 'gnus-summary-marks
493 (defcustom gnus-low-score-mark ?Y
494 "*Mark used for articles with a low score."
495 :group 'gnus-summary-marks
498 (defcustom gnus-catchup-mark ?C
499 "*Mark used for articles that are caught up."
500 :group 'gnus-summary-marks
503 (defcustom gnus-replied-mark ?A
504 "*Mark used for articles that have been replied to."
505 :group 'gnus-summary-marks
508 (defcustom gnus-forwarded-mark ?F
509 "*Mark used for articles that have been forwarded."
511 :group 'gnus-summary-marks
514 (defcustom gnus-recent-mark ?N
515 "*Mark used for articles that are recent."
517 :group 'gnus-summary-marks
520 (defcustom gnus-cached-mark ?*
521 "*Mark used for articles that are in the cache."
522 :group 'gnus-summary-marks
525 (defcustom gnus-saved-mark ?S
526 "*Mark used for articles that have been saved."
527 :group 'gnus-summary-marks
530 (defcustom gnus-unseen-mark ?.
531 "*Mark used for articles that haven't been seen."
533 :group 'gnus-summary-marks
536 (defcustom gnus-no-mark ? ;Whitespace
537 "*Mark used for articles that have no other secondary mark."
539 :group 'gnus-summary-marks
542 (defcustom gnus-ancient-mark ?O
543 "*Mark used for ancient articles."
544 :group 'gnus-summary-marks
547 (defcustom gnus-sparse-mark ?Q
548 "*Mark used for sparsely reffed articles."
549 :group 'gnus-summary-marks
552 (defcustom gnus-canceled-mark ?G
553 "*Mark used for canceled articles."
554 :group 'gnus-summary-marks
557 (defcustom gnus-duplicate-mark ?M
558 "*Mark used for duplicate articles."
559 :group 'gnus-summary-marks
562 (defcustom gnus-undownloaded-mark ?-
563 "*Mark used for articles that weren't downloaded."
565 :group 'gnus-summary-marks
568 (defcustom gnus-downloaded-mark ?+
569 "*Mark used for articles that were downloaded."
570 :group 'gnus-summary-marks
573 (defcustom gnus-downloadable-mark ?%
574 "*Mark used for articles that are to be downloaded."
575 :group 'gnus-summary-marks
578 (defcustom gnus-unsendable-mark ?=
579 "*Mark used for articles that won't be sent."
580 :group 'gnus-summary-marks
583 (defcustom gnus-score-over-mark ?+
584 "*Score mark used for articles with high scores."
585 :group 'gnus-summary-marks
588 (defcustom gnus-score-below-mark ?-
589 "*Score mark used for articles with low scores."
590 :group 'gnus-summary-marks
593 (defcustom gnus-empty-thread-mark ? ;Whitespace
594 "*There is no thread under the article."
595 :group 'gnus-summary-marks
598 (defcustom gnus-not-empty-thread-mark ?=
599 "*There is a thread under the article."
600 :group 'gnus-summary-marks
603 (defcustom gnus-view-pseudo-asynchronously nil
604 "*If non-nil, Gnus will view pseudo-articles asynchronously."
605 :group 'gnus-extract-view
608 (defcustom gnus-auto-expirable-marks
609 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
610 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
611 gnus-souped-mark gnus-duplicate-mark)
612 "*The list of marks converted into expiration if a group is auto-expirable."
615 :type '(repeat character))
617 (defcustom gnus-inhibit-user-auto-expire t
618 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
623 (defcustom gnus-view-pseudos nil
624 "*If `automatic', pseudo-articles will be viewed automatically.
625 If `not-confirm', pseudos will be viewed automatically, and the user
626 will not be asked to confirm the command."
627 :group 'gnus-extract-view
628 :type '(choice (const :tag "off" nil)
630 (const not-confirm)))
632 (defcustom gnus-view-pseudos-separately t
633 "*If non-nil, one pseudo-article will be created for each file to be viewed.
634 If nil, all files that use the same viewing command will be given as a
635 list of parameters to that command."
636 :group 'gnus-extract-view
639 (defcustom gnus-insert-pseudo-articles t
640 "*If non-nil, insert pseudo-articles when decoding articles."
641 :group 'gnus-extract-view
644 (defcustom gnus-summary-dummy-line-format
646 "*The format specification for the dummy roots in the summary buffer.
647 It works along the same lines as a normal formatting string,
648 with some simple extensions.
652 General format specifiers can also be used.
653 See `(gnus)Formatting Variables'."
654 :link '(custom-manual "(gnus)Formatting Variables")
655 :group 'gnus-threading
658 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
659 "*The format specification for the summary mode line.
660 It works along the same lines as a normal formatting string,
661 with some simple extensions:
664 %p Unprefixed group name
665 %A Current article number
666 %z Current article score
668 %U Number of unread articles in the group
669 %e Number of unselected articles in the group
670 %Z A string with unread/unselected article counts
671 %g Shortish group name
672 %S Subject of the current article
674 %s Current score file name
675 %d Number of dormant articles
676 %r Number of articles that have been marked as read in this session
677 %E Number of articles expunged by the score files"
678 :group 'gnus-summary-format
681 (defcustom gnus-list-identifiers nil
682 "Regexp that matches list identifiers to be removed from subject.
683 This can also be a list of regexps."
685 :group 'gnus-summary-format
686 :group 'gnus-article-hiding
687 :type '(choice (const :tag "none" nil)
689 (repeat :value (".*") regexp)))
691 (defcustom gnus-summary-mark-below 0
692 "*Mark all articles with a score below this variable as read.
693 This variable is local to each summary buffer and usually set by the
695 :group 'gnus-score-default
698 (defun gnus-widget-reversible-match (widget value)
699 "Ignoring WIDGET, convert VALUE to internal form.
700 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
704 (eq (length value) 2)
705 (eq (nth 0 value) 'not)
706 (symbolp (nth 1 value)))))
708 (defun gnus-widget-reversible-to-internal (widget value)
709 "Ignoring WIDGET, convert VALUE to internal form.
710 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
711 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
715 (list (nth 1 value) t)))
717 (defun gnus-widget-reversible-to-external (widget value)
718 "Ignoring WIDGET, convert VALUE to external form.
719 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
720 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
723 (list 'not (nth 0 value))
726 (define-widget 'gnus-widget-reversible 'group
727 "A `group' that convert values."
728 :match 'gnus-widget-reversible-match
729 :value-to-internal 'gnus-widget-reversible-to-internal
730 :value-to-external 'gnus-widget-reversible-to-external)
732 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
733 "*List of functions used for sorting articles in the summary buffer.
735 Each function takes two articles and returns non-nil if the first
736 article should be sorted before the other. If you use more than one
737 function, the primary sort function should be the last. You should
738 probably always include `gnus-article-sort-by-number' in the list of
739 sorting functions -- preferably first. Also note that sorting by date
740 is often much slower than sorting by number, and the sorting order is
741 very similar. (Sorting by date means sorting by the time the message
742 was sent, sorting by number means sorting by arrival time.)
744 Each item can also be a list `(not F)' where F is a function;
745 this reverses the sort order.
747 Ready-made functions include `gnus-article-sort-by-number',
748 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
749 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
750 and `gnus-article-sort-by-score'.
752 When threading is turned on, the variable `gnus-thread-sort-functions'
753 controls how articles are sorted."
754 :group 'gnus-summary-sort
755 :type '(repeat (gnus-widget-reversible
756 (choice (function-item gnus-article-sort-by-number)
757 (function-item gnus-article-sort-by-author)
758 (function-item gnus-article-sort-by-subject)
759 (function-item gnus-article-sort-by-date)
760 (function-item gnus-article-sort-by-score)
761 (function-item gnus-article-sort-by-random)
762 (function :tag "other"))
763 (boolean :tag "Reverse order"))))
766 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
767 "*List of functions used for sorting threads in the summary buffer.
768 By default, threads are sorted by article number.
770 Each function takes two threads and returns non-nil if the first
771 thread 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-thread-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 list item can also be a list `(not F)' where F is a
780 function; this specifies reversed sort order.
782 Ready-made functions include `gnus-thread-sort-by-number',
783 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
784 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
785 `gnus-thread-sort-by-most-recent-number',
786 `gnus-thread-sort-by-most-recent-date',
787 `gnus-thread-sort-by-random', and
788 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
790 When threading is turned off, the variable
791 `gnus-article-sort-functions' controls how articles are sorted."
792 :group 'gnus-summary-sort
794 (gnus-widget-reversible
795 (choice (function-item gnus-thread-sort-by-number)
796 (function-item gnus-thread-sort-by-author)
797 (function-item gnus-thread-sort-by-subject)
798 (function-item gnus-thread-sort-by-date)
799 (function-item gnus-thread-sort-by-score)
800 (function-item gnus-thread-sort-by-most-recent-number)
801 (function-item gnus-thread-sort-by-most-recent-date)
802 (function-item gnus-thread-sort-by-random)
803 (function-item gnus-thread-sort-by-total-score)
804 (function :tag "other"))
805 (boolean :tag "Reverse order"))))
807 (defcustom gnus-thread-score-function '+
808 "*Function used for calculating the total score of a thread.
810 The function is called with the scores of the article and each
811 subthread and should then return the score of the thread.
813 Some functions you can use are `+', `max', or `min'."
814 :group 'gnus-summary-sort
817 (defcustom gnus-summary-expunge-below nil
818 "All articles that have a score less than this variable will be expunged.
819 This variable is local to the summary buffers."
820 :group 'gnus-score-default
821 :type '(choice (const :tag "off" nil)
824 (defcustom gnus-thread-expunge-below nil
825 "All threads that have a total score less than this variable will be expunged.
826 See `gnus-thread-score-function' for en explanation of what a
829 This variable is local to the summary buffers."
830 :group 'gnus-threading
831 :group 'gnus-score-default
832 :type '(choice (const :tag "off" nil)
835 (defcustom gnus-summary-mode-hook nil
836 "*A hook for Gnus summary mode.
837 This hook is run before any variables are set in the summary buffer."
838 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
839 :group 'gnus-summary-various
842 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
843 (when (featurep 'xemacs)
844 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
845 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
846 (add-hook 'gnus-summary-mode-hook
847 'gnus-xmas-switch-horizontal-scrollbar-off))
849 (defcustom gnus-summary-menu-hook nil
850 "*Hook run after the creation of the summary mode menu."
851 :group 'gnus-summary-visual
854 (defcustom gnus-summary-exit-hook nil
855 "*A hook called on exit from the summary buffer.
856 It will be called with point in the group buffer."
857 :group 'gnus-summary-exit
860 (defcustom gnus-summary-prepare-hook nil
861 "*A hook called after the summary buffer has been generated.
862 If you want to modify the summary buffer, you can use this hook."
863 :group 'gnus-summary-various
866 (defcustom gnus-summary-prepared-hook nil
867 "*A hook called as the last thing after the summary buffer has been generated."
868 :group 'gnus-summary-various
871 (defcustom gnus-summary-generate-hook nil
872 "*A hook run just before generating the summary buffer.
873 This hook is commonly used to customize threading variables and the
875 :group 'gnus-summary-various
878 (defcustom gnus-select-group-hook nil
879 "*A hook called when a newsgroup is selected.
881 If you'd like to simplify subjects like the
882 `gnus-summary-next-same-subject' command does, you can use the
885 (add-hook gnus-select-group-hook
887 (mapcar (lambda (header)
888 (mail-header-set-subject
890 (gnus-simplify-subject
891 (mail-header-subject header) 're-only)))
892 gnus-newsgroup-headers)))"
893 :group 'gnus-group-select
896 (defcustom gnus-select-article-hook nil
897 "*A hook called when an article is selected."
898 :group 'gnus-summary-choose
899 :options '(gnus-agent-fetch-selected-article)
902 (defcustom gnus-visual-mark-article-hook
903 (list 'gnus-highlight-selected-summary)
904 "*Hook run after selecting an article in the summary buffer.
905 It is meant to be used for highlighting the article in some way. It
906 is not run if `gnus-visual' is nil."
907 :group 'gnus-summary-visual
910 (defcustom gnus-parse-headers-hook nil
911 "*A hook called before parsing the headers."
915 (defcustom gnus-exit-group-hook nil
916 "*A hook called when exiting summary mode.
917 This hook is not called from the non-updating exit commands like `Q'."
921 (defcustom gnus-summary-update-hook
922 (list 'gnus-summary-highlight-line)
923 "*A hook called when a summary line is changed.
924 The hook will not be called if `gnus-visual' is nil.
926 The default function `gnus-summary-highlight-line' will
927 highlight the line according to the `gnus-summary-highlight'
929 :group 'gnus-summary-visual
932 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
933 "*A hook called when an article is selected for the first time.
934 The hook is intended to mark an article as read (or unread)
935 automatically when it is selected."
936 :group 'gnus-summary-choose
939 (defcustom gnus-group-no-more-groups-hook nil
940 "*A hook run when returning to group mode having no more (unread) groups."
941 :group 'gnus-group-select
944 (defcustom gnus-ps-print-hook nil
945 "*A hook run before ps-printing something from Gnus."
949 (defcustom gnus-summary-article-move-hook nil
950 "*A hook called after an article is moved, copied, respooled, or crossposted."
955 (defcustom gnus-summary-article-delete-hook nil
956 "*A hook called after an article is deleted."
961 (defcustom gnus-summary-article-expire-hook nil
962 "*A hook called after an article is expired."
967 (defcustom gnus-summary-display-arrow
968 (and (fboundp 'display-graphic-p)
970 "*If non-nil, display an arrow highlighting the current article."
975 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
976 "Face used for highlighting the current article in the summary buffer."
977 :group 'gnus-summary-visual
980 (defvar gnus-tmp-downloaded nil)
982 (defcustom gnus-summary-highlight
983 '(((eq mark gnus-canceled-mark)
984 . gnus-summary-cancelled-face)
985 ((and uncached (> score default-high))
986 . gnus-summary-high-undownloaded-face)
987 ((and uncached (< score default-low))
988 . gnus-summary-low-undownloaded-face)
990 . gnus-summary-normal-undownloaded-face)
991 ((and (> score default-high)
992 (or (eq mark gnus-dormant-mark)
993 (eq mark gnus-ticked-mark)))
994 . gnus-summary-high-ticked-face)
995 ((and (< score default-low)
996 (or (eq mark gnus-dormant-mark)
997 (eq mark gnus-ticked-mark)))
998 . gnus-summary-low-ticked-face)
999 ((or (eq mark gnus-dormant-mark)
1000 (eq mark gnus-ticked-mark))
1001 . gnus-summary-normal-ticked-face)
1002 ((and (> score default-high) (eq mark gnus-ancient-mark))
1003 . gnus-summary-high-ancient-face)
1004 ((and (< score default-low) (eq mark gnus-ancient-mark))
1005 . gnus-summary-low-ancient-face)
1006 ((eq mark gnus-ancient-mark)
1007 . gnus-summary-normal-ancient-face)
1008 ((and (> score default-high) (eq mark gnus-unread-mark))
1009 . gnus-summary-high-unread-face)
1010 ((and (< score default-low) (eq mark gnus-unread-mark))
1011 . gnus-summary-low-unread-face)
1012 ((eq mark gnus-unread-mark)
1013 . gnus-summary-normal-unread-face)
1014 ((> score default-high)
1015 . gnus-summary-high-read-face)
1016 ((< score default-low)
1017 . gnus-summary-low-read-face)
1019 . gnus-summary-normal-read-face))
1020 "*Controls the highlighting of summary buffer lines.
1022 A list of (FORM . FACE) pairs. When deciding how a a particular
1023 summary line should be displayed, each form is evaluated. The content
1024 of the face field after the first true form is used. You can change
1025 how those summary lines are displayed, by editing the face field.
1027 You can use the following variables in the FORM field.
1029 score: The article's score
1030 default: The default article score.
1031 default-high: The default score for high scored articles.
1032 default-low: The default score for low scored articles.
1033 below: The score below which articles are automatically marked as read.
1034 mark: The article's mark.
1035 uncached: Non-nil if the article is uncached."
1036 :group 'gnus-summary-visual
1037 :type '(repeat (cons (sexp :tag "Form" nil)
1040 (defcustom gnus-alter-header-function nil
1041 "Function called to allow alteration of article header structures.
1042 The function is called with one parameter, the article header vector,
1043 which it may alter in any way."
1044 :type '(choice (const :tag "None" nil)
1046 :group 'gnus-summary)
1048 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1049 "Variable that says which function should be used to decode a string with encoded words.")
1051 (defcustom gnus-extra-headers '(To Newsgroups)
1052 "*Extra headers to parse."
1054 :group 'gnus-summary
1055 :type '(repeat symbol))
1057 (defcustom gnus-ignored-from-addresses
1058 (and user-mail-address (regexp-quote user-mail-address))
1059 "*Regexp of From headers that may be suppressed in favor of To headers."
1061 :group 'gnus-summary
1064 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1065 "List of charsets that should be ignored.
1066 When these charsets are used in the \"charset\" parameter, the
1067 default charset will be used instead."
1069 :type '(repeat symbol)
1070 :group 'gnus-charset)
1072 (gnus-define-group-parameter
1076 "Return the ignored charsets of GROUP."
1077 :variable gnus-group-ignored-charsets-alist
1079 '(("alt\\.chinese\\.text" iso-8859-1))
1081 "Alist of regexps (to match group names) and charsets that should be ignored.
1082 When these charsets are used in the \"charset\" parameter, the
1083 default charset will be used instead."
1084 :variable-group gnus-charset
1085 :variable-type '(repeat (cons (regexp :tag "Group")
1087 :parameter-type '(choice :tag "Ignored charsets"
1090 :parameter-document "\
1091 List of charsets that should be ignored.
1093 When these charsets are used in the \"charset\" parameter, the
1094 default charset will be used instead.")
1096 (defcustom gnus-group-highlight-words-alist nil
1097 "Alist of group regexps and highlight regexps.
1098 This variable uses the same syntax as `gnus-emphasis-alist'."
1100 :type '(repeat (cons (regexp :tag "Group")
1101 (repeat (list (regexp :tag "Highlight regexp")
1102 (number :tag "Group for entire word" 0)
1103 (number :tag "Group for displayed part" 0)
1105 gnus-emphasis-highlight-words)))))
1106 :group 'gnus-summary-visual)
1108 (defcustom gnus-summary-show-article-charset-alist
1110 "Alist of number and charset.
1111 The article will be shown with the charset corresponding to the
1113 For example: ((1 . cn-gb-2312) (2 . big5))."
1115 :type '(repeat (cons (number :tag "Argument" 1)
1116 (symbol :tag "Charset")))
1117 :group 'gnus-charset)
1119 (defcustom gnus-preserve-marks t
1120 "Whether marks are preserved when moving, copying and respooling messages."
1123 :group 'gnus-summary-marks)
1125 (defcustom gnus-alter-articles-to-read-function nil
1126 "Function to be called to alter the list of articles to be selected."
1127 :type '(choice (const nil) function)
1128 :group 'gnus-summary)
1130 (defcustom gnus-orphan-score nil
1131 "*All orphans get this score added. Set in the score file."
1132 :group 'gnus-score-default
1133 :type '(choice (const nil)
1136 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1137 "*A regexp to match MIME parts when saving multiple parts of a
1138 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1139 This regexp will be used by default when prompting the user for which
1140 type of files to save."
1141 :group 'gnus-summary
1144 (defcustom gnus-read-all-available-headers nil
1145 "Whether Gnus should parse all headers made available to it.
1146 This is mostly relevant for slow back ends where the user may
1147 wish to widen the summary buffer to include all headers
1148 that were fetched. Say, for nnultimate groups."
1150 :group 'gnus-summary
1151 :type '(choice boolean regexp))
1153 (defcustom gnus-summary-muttprint-program "muttprint"
1154 "Command (and optional arguments) used to run Muttprint."
1156 :group 'gnus-summary
1159 (defcustom gnus-article-loose-mime t
1160 "If non-nil, don't require MIME-Version header.
1161 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1162 supply the MIME-Version header or deliberately strip it from the mail.
1163 If non-nil (the default), Gnus will treat some articles as MIME
1164 even if the MIME-Version header is missing."
1167 :group 'gnus-article-mime)
1169 (defcustom gnus-article-emulate-mime t
1170 "If non-nil, use MIME emulation for uuencode and the like.
1171 This means that Gnus will search message bodies for text that look
1172 like uuencoded bits, yEncoded bits, and so on, and present that using
1173 the normal Gnus MIME machinery."
1176 :group 'gnus-article-mime)
1178 ;;; Internal variables
1180 (defvar gnus-summary-display-cache nil)
1181 (defvar gnus-article-mime-handles nil)
1182 (defvar gnus-article-decoded-p nil)
1183 (defvar gnus-article-charset nil)
1184 (defvar gnus-article-ignored-charsets nil)
1185 (defvar gnus-scores-exclude-files nil)
1186 (defvar gnus-page-broken nil)
1188 (defvar gnus-original-article nil)
1189 (defvar gnus-article-internal-prepare-hook nil)
1190 (defvar gnus-newsgroup-process-stack nil)
1192 (defvar gnus-thread-indent-array nil)
1193 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1194 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1195 "Function called to sort the articles within a thread after it has been gathered together.")
1197 (defvar gnus-summary-save-parts-type-history nil)
1198 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1200 ;; Avoid highlighting in kill files.
1201 (defvar gnus-summary-inhibit-highlight nil)
1202 (defvar gnus-newsgroup-selected-overlay nil)
1203 (defvar gnus-inhibit-limiting nil)
1204 (defvar gnus-newsgroup-adaptive-score-file nil)
1205 (defvar gnus-current-score-file nil)
1206 (defvar gnus-current-move-group nil)
1207 (defvar gnus-current-copy-group nil)
1208 (defvar gnus-current-crosspost-group nil)
1209 (defvar gnus-newsgroup-display nil)
1211 (defvar gnus-newsgroup-dependencies nil)
1212 (defvar gnus-newsgroup-adaptive nil)
1213 (defvar gnus-summary-display-article-function nil)
1214 (defvar gnus-summary-highlight-line-function nil
1215 "Function called after highlighting a summary line.")
1217 (defvar gnus-summary-line-format-alist
1218 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1219 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1220 (?s gnus-tmp-subject-or-nil ?s)
1221 (?n gnus-tmp-name ?s)
1222 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1224 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1226 (?F gnus-tmp-from ?s)
1227 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1228 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1229 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1230 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1231 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1232 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1233 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1234 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1235 (?L gnus-tmp-lines ?s)
1236 (?O gnus-tmp-downloaded ?c)
1237 (?I gnus-tmp-indentation ?s)
1238 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1239 (?R gnus-tmp-replied ?c)
1240 (?\[ gnus-tmp-opening-bracket ?c)
1241 (?\] gnus-tmp-closing-bracket ?c)
1242 (?\> (make-string gnus-tmp-level ? ) ?s)
1243 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1244 (?i gnus-tmp-score ?d)
1245 (?z gnus-tmp-score-char ?c)
1246 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1247 (?U gnus-tmp-unread ?c)
1248 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1250 (?t (gnus-summary-number-of-articles-in-thread
1251 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1253 (?e (gnus-summary-number-of-articles-in-thread
1254 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1256 (?u gnus-tmp-user-defined ?s)
1257 (?P (gnus-pick-line-number) ?d)
1258 (?B gnus-tmp-thread-tree-header-string ?s)
1259 (user-date (gnus-user-date
1260 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1261 "An alist of format specifications that can appear in summary lines.
1262 These are paired with what variables they correspond with, along with
1263 the type of the variable (string, integer, character, etc).")
1265 (defvar gnus-summary-dummy-line-format-alist
1266 `((?S gnus-tmp-subject ?s)
1267 (?N gnus-tmp-number ?d)
1268 (?u gnus-tmp-user-defined ?s)))
1270 (defvar gnus-summary-mode-line-format-alist
1271 `((?G gnus-tmp-group-name ?s)
1272 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1273 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1274 (?A gnus-tmp-article-number ?d)
1275 (?Z gnus-tmp-unread-and-unselected ?s)
1276 (?V gnus-version ?s)
1277 (?U gnus-tmp-unread-and-unticked ?d)
1278 (?S gnus-tmp-subject ?s)
1279 (?e gnus-tmp-unselected ?d)
1280 (?u gnus-tmp-user-defined ?s)
1281 (?d (length gnus-newsgroup-dormant) ?d)
1282 (?t (length gnus-newsgroup-marked) ?d)
1283 (?h (length gnus-newsgroup-spam-marked) ?d)
1284 (?r (length gnus-newsgroup-reads) ?d)
1285 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1286 (?E gnus-newsgroup-expunged-tally ?d)
1287 (?s (gnus-current-score-file-nondirectory) ?s)))
1289 (defvar gnus-last-search-regexp nil
1290 "Default regexp for article search command.")
1292 (defvar gnus-last-shell-command nil
1293 "Default shell command on article.")
1295 (defvar gnus-newsgroup-agentized nil
1296 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1297 (defvar gnus-newsgroup-begin nil)
1298 (defvar gnus-newsgroup-end nil)
1299 (defvar gnus-newsgroup-last-rmail nil)
1300 (defvar gnus-newsgroup-last-mail nil)
1301 (defvar gnus-newsgroup-last-folder nil)
1302 (defvar gnus-newsgroup-last-file nil)
1303 (defvar gnus-newsgroup-auto-expire nil)
1304 (defvar gnus-newsgroup-active nil)
1306 (defvar gnus-newsgroup-data nil)
1307 (defvar gnus-newsgroup-data-reverse nil)
1308 (defvar gnus-newsgroup-limit nil)
1309 (defvar gnus-newsgroup-limits nil)
1310 (defvar gnus-summary-use-undownloaded-faces nil)
1312 (defvar gnus-newsgroup-unreads nil
1313 "Sorted list of unread articles in the current newsgroup.")
1315 (defvar gnus-newsgroup-unselected nil
1316 "Sorted list of unselected unread articles in the current newsgroup.")
1318 (defvar gnus-newsgroup-reads nil
1319 "Alist of read articles and article marks in the current newsgroup.")
1321 (defvar gnus-newsgroup-expunged-tally nil)
1323 (defvar gnus-newsgroup-marked nil
1324 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1326 (defvar gnus-newsgroup-spam-marked nil
1327 "List of ranges of articles that have been marked as spam.")
1329 (defvar gnus-newsgroup-killed nil
1330 "List of ranges of articles that have been through the scoring process.")
1332 (defvar gnus-newsgroup-cached nil
1333 "Sorted list of articles that come from the article cache.")
1335 (defvar gnus-newsgroup-saved nil
1336 "List of articles that have been saved.")
1338 (defvar gnus-newsgroup-kill-headers nil)
1340 (defvar gnus-newsgroup-replied nil
1341 "List of articles that have been replied to in the current newsgroup.")
1343 (defvar gnus-newsgroup-forwarded nil
1344 "List of articles that have been forwarded in the current newsgroup.")
1346 (defvar gnus-newsgroup-recent nil
1347 "List of articles that have are recent in the current newsgroup.")
1349 (defvar gnus-newsgroup-expirable nil
1350 "Sorted list of articles in the current newsgroup that can be expired.")
1352 (defvar gnus-newsgroup-processable nil
1353 "List of articles in the current newsgroup that can be processed.")
1355 (defvar gnus-newsgroup-downloadable nil
1356 "Sorted list of articles in the current newsgroup that can be processed.")
1358 (defvar gnus-newsgroup-unfetched nil
1359 "Sorted list of articles in the current newsgroup whose headers have
1360 not been fetched into the agent.
1362 This list will always be a subset of gnus-newsgroup-undownloaded.")
1364 (defvar gnus-newsgroup-undownloaded nil
1365 "List of articles in the current newsgroup that haven't been downloaded.")
1367 (defvar gnus-newsgroup-unsendable nil
1368 "List of articles in the current newsgroup that won't be sent.")
1370 (defvar gnus-newsgroup-bookmarks nil
1371 "List of articles in the current newsgroup that have bookmarks.")
1373 (defvar gnus-newsgroup-dormant nil
1374 "Sorted list of dormant articles in the current newsgroup.")
1376 (defvar gnus-newsgroup-unseen nil
1377 "List of unseen articles in the current newsgroup.")
1379 (defvar gnus-newsgroup-seen nil
1380 "Range of seen articles in the current newsgroup.")
1382 (defvar gnus-newsgroup-articles nil
1383 "List of articles in the current newsgroup.")
1385 (defvar gnus-newsgroup-scored nil
1386 "List of scored articles in the current newsgroup.")
1388 (defvar gnus-newsgroup-headers nil
1389 "List of article headers in the current newsgroup.")
1391 (defvar gnus-newsgroup-threads nil)
1393 (defvar gnus-newsgroup-prepared nil
1394 "Whether the current group has been prepared properly.")
1396 (defvar gnus-newsgroup-ancient nil
1397 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1399 (defvar gnus-newsgroup-sparse nil)
1401 (defvar gnus-current-article nil)
1402 (defvar gnus-article-current nil)
1403 (defvar gnus-current-headers nil)
1404 (defvar gnus-have-all-headers nil)
1405 (defvar gnus-last-article nil)
1406 (defvar gnus-newsgroup-history nil)
1407 (defvar gnus-newsgroup-charset nil)
1408 (defvar gnus-newsgroup-ephemeral-charset nil)
1409 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1411 (defvar gnus-article-before-search nil)
1413 (defvar gnus-summary-local-variables
1414 '(gnus-newsgroup-name
1415 gnus-newsgroup-begin gnus-newsgroup-end
1416 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1417 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1418 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1419 gnus-newsgroup-unselected gnus-newsgroup-marked
1420 gnus-newsgroup-spam-marked
1421 gnus-newsgroup-reads gnus-newsgroup-saved
1422 gnus-newsgroup-replied gnus-newsgroup-forwarded
1423 gnus-newsgroup-recent
1424 gnus-newsgroup-expirable
1425 gnus-newsgroup-processable gnus-newsgroup-killed
1426 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1427 gnus-newsgroup-unfetched
1428 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1429 gnus-newsgroup-seen gnus-newsgroup-articles
1430 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1431 gnus-newsgroup-headers gnus-newsgroup-threads
1432 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1433 gnus-current-article gnus-current-headers gnus-have-all-headers
1434 gnus-last-article gnus-article-internal-prepare-hook
1435 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1436 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1437 gnus-thread-expunge-below
1438 gnus-score-alist gnus-current-score-file
1439 (gnus-summary-expunge-below . global)
1440 (gnus-summary-mark-below . global)
1441 (gnus-orphan-score . global)
1442 gnus-newsgroup-active gnus-scores-exclude-files
1443 gnus-newsgroup-history gnus-newsgroup-ancient
1444 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1445 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1446 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1447 (gnus-newsgroup-expunged-tally . 0)
1448 gnus-cache-removable-articles gnus-newsgroup-cached
1449 gnus-newsgroup-data gnus-newsgroup-data-reverse
1450 gnus-newsgroup-limit gnus-newsgroup-limits
1451 gnus-newsgroup-charset gnus-newsgroup-display
1452 gnus-summary-use-undownloaded-faces)
1453 "Variables that are buffer-local to the summary buffers.")
1455 (defvar gnus-newsgroup-variables nil
1456 "A list of variables that have separate values in different newsgroups.
1457 A list of newsgroup (summary buffer) local variables, or cons of
1458 variables and their default expressions to be evalled (when the default
1459 values are not nil), that should be made global while the summary buffer
1462 Note: The default expressions will be evaluated (using function `eval')
1463 before assignment to the local variable rather than just assigned to it.
1464 If the default expression is the symbol `global', that symbol will not
1465 be evaluated but the global value of the local variable will be used
1468 These variables can be used to set variables in the group parameters
1469 while still allowing them to affect operations done in other buffers.
1472 \(setq gnus-newsgroup-variables
1473 '(message-use-followup-to
1474 (gnus-visible-headers .
1475 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1478 ;; Byte-compiler warning.
1480 ;; Bind features so that require will believe that gnus-sum has
1481 ;; already been loaded (avoids infinite recursion)
1482 (let ((features (cons 'gnus-sum features)))
1483 ;; Several of the declarations in gnus-sum are needed to load the
1484 ;; following files. Right now, these definitions have been
1485 ;; compiled but not defined (evaluated). We could either do a
1486 ;; eval-and-compile about all of the declarations or evaluate the
1488 (if (boundp 'gnus-newsgroup-variables)
1490 (load "gnus-sum.el" t t t))
1492 (require 'gnus-art)))
1496 (defvar gnus-decode-encoded-word-methods
1497 '(mail-decode-encoded-word-string)
1498 "List of methods used to decode encoded words.
1500 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1501 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1502 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1503 whose names match REGEXP.
1506 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1507 mail-decode-encoded-word-string
1508 (\"chinese\" . rfc1843-decode-string))")
1510 (defvar gnus-decode-encoded-word-methods-cache nil)
1512 (defun gnus-multi-decode-encoded-word-string (string)
1513 "Apply the functions from `gnus-encoded-word-methods' that match."
1514 (unless (and gnus-decode-encoded-word-methods-cache
1515 (eq gnus-newsgroup-name
1516 (car gnus-decode-encoded-word-methods-cache)))
1517 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1520 (nconc gnus-decode-encoded-word-methods-cache (list x))
1521 (if (and gnus-newsgroup-name
1522 (string-match (car x) gnus-newsgroup-name))
1523 (nconc gnus-decode-encoded-word-methods-cache
1525 gnus-decode-encoded-word-methods))
1526 (let ((xlist gnus-decode-encoded-word-methods-cache))
1529 (setq string (funcall (pop xlist) string))))
1532 ;; Subject simplification.
1534 (defun gnus-simplify-whitespace (str)
1535 "Remove excessive whitespace from STR."
1537 (while (string-match "[ \t][ \t]+" str)
1538 (setq str (concat (substring str 0 (match-beginning 0))
1540 (substring str (match-end 0)))))
1542 (when (string-match "^[ \t]+" str)
1543 (setq str (substring str (match-end 0))))
1545 (when (string-match "[ \t]+$" str)
1546 (setq str (substring str 0 (match-beginning 0))))
1549 (defun gnus-simplify-all-whitespace (str)
1550 "Remove all whitespace from STR."
1551 (while (string-match "[ \t\n]+" str)
1552 (setq str (replace-match "" nil nil str)))
1555 (defsubst gnus-simplify-subject-re (subject)
1556 "Remove \"Re:\" from subject lines."
1557 (if (string-match message-subject-re-regexp subject)
1558 (substring subject (match-end 0))
1561 (defun gnus-simplify-subject (subject &optional re-only)
1562 "Remove `Re:' and words in parentheses.
1563 If RE-ONLY is non-nil, strip leading `Re:'s only."
1564 (let ((case-fold-search t)) ;Ignore case.
1565 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1566 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1567 (setq subject (substring subject (match-end 0))))
1568 ;; Remove uninteresting prefixes.
1569 (when (and (not re-only)
1570 gnus-simplify-ignored-prefixes
1571 (string-match gnus-simplify-ignored-prefixes subject))
1572 (setq subject (substring subject (match-end 0))))
1573 ;; Remove words in parentheses from end.
1575 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1576 (setq subject (substring subject 0 (match-beginning 0)))))
1577 ;; Return subject string.
1580 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1582 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1583 (goto-char (point-min))
1584 (while (re-search-forward regexp nil t)
1585 (replace-match (or newtext ""))))
1587 (defun gnus-simplify-buffer-fuzzy ()
1588 "Simplify string in the buffer fuzzily.
1589 The string in the accessible portion of the current buffer is simplified.
1590 It is assumed to be a single-line subject.
1591 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1592 matter is removed. Additional things can be deleted by setting
1593 `gnus-simplify-subject-fuzzy-regexp'."
1594 (let ((case-fold-search t)
1596 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1598 (while (not (eq modified-tick (buffer-modified-tick)))
1599 (setq modified-tick (buffer-modified-tick))
1601 ((listp gnus-simplify-subject-fuzzy-regexp)
1602 (mapcar 'gnus-simplify-buffer-fuzzy-step
1603 gnus-simplify-subject-fuzzy-regexp))
1604 (gnus-simplify-subject-fuzzy-regexp
1605 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1606 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1607 (gnus-simplify-buffer-fuzzy-step
1608 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1609 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1611 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1612 (gnus-simplify-buffer-fuzzy-step " +" " ")
1613 (gnus-simplify-buffer-fuzzy-step " $")
1614 (gnus-simplify-buffer-fuzzy-step "^ +")))
1616 (defun gnus-simplify-subject-fuzzy (subject)
1617 "Simplify a subject string fuzzily.
1618 See `gnus-simplify-buffer-fuzzy' for details."
1620 (gnus-set-work-buffer)
1621 (let ((case-fold-search t))
1622 ;; Remove uninteresting prefixes.
1623 (when (and gnus-simplify-ignored-prefixes
1624 (string-match gnus-simplify-ignored-prefixes subject))
1625 (setq subject (substring subject (match-end 0))))
1627 (inline (gnus-simplify-buffer-fuzzy))
1630 (defsubst gnus-simplify-subject-fully (subject)
1631 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1633 (gnus-simplify-subject-functions
1634 (gnus-map-function gnus-simplify-subject-functions subject))
1635 ((null gnus-summary-gather-subject-limit)
1636 (gnus-simplify-subject-re subject))
1637 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1638 (gnus-simplify-subject-fuzzy subject))
1639 ((numberp gnus-summary-gather-subject-limit)
1640 (gnus-limit-string (gnus-simplify-subject-re subject)
1641 gnus-summary-gather-subject-limit))
1645 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1646 "Check whether two subjects are equal.
1647 If optional argument SIMPLE-FIRST is t, first argument is already
1650 ((null simple-first)
1651 (equal (gnus-simplify-subject-fully s1)
1652 (gnus-simplify-subject-fully s2)))
1655 (gnus-simplify-subject-fully s2)))))
1657 (defun gnus-summary-bubble-group ()
1658 "Increase the score of the current group.
1659 This is a handy function to add to `gnus-summary-exit-hook' to
1660 increase the score of each group you read."
1661 (gnus-group-add-score gnus-newsgroup-name))
1665 ;;; Gnus summary mode
1668 (put 'gnus-summary-mode 'mode-class 'special)
1670 (defvar gnus-article-commands-menu)
1672 ;; Non-orthogonal keys
1674 (gnus-define-keys gnus-summary-mode-map
1675 " " gnus-summary-next-page
1676 "\177" gnus-summary-prev-page
1677 [delete] gnus-summary-prev-page
1678 [backspace] gnus-summary-prev-page
1679 "\r" gnus-summary-scroll-up
1680 "\M-\r" gnus-summary-scroll-down
1681 "n" gnus-summary-next-unread-article
1682 "p" gnus-summary-prev-unread-article
1683 "N" gnus-summary-next-article
1684 "P" gnus-summary-prev-article
1685 "\M-\C-n" gnus-summary-next-same-subject
1686 "\M-\C-p" gnus-summary-prev-same-subject
1687 "\M-n" gnus-summary-next-unread-subject
1688 "\M-p" gnus-summary-prev-unread-subject
1689 "." gnus-summary-first-unread-article
1690 "," gnus-summary-best-unread-article
1691 "\M-s" gnus-summary-search-article-forward
1692 "\M-r" gnus-summary-search-article-backward
1693 "<" gnus-summary-beginning-of-article
1694 ">" gnus-summary-end-of-article
1695 "j" gnus-summary-goto-article
1696 "^" gnus-summary-refer-parent-article
1697 "\M-^" gnus-summary-refer-article
1698 "u" gnus-summary-tick-article-forward
1699 "!" gnus-summary-tick-article-forward
1700 "U" gnus-summary-tick-article-backward
1701 "d" gnus-summary-mark-as-read-forward
1702 "D" gnus-summary-mark-as-read-backward
1703 "E" gnus-summary-mark-as-expirable
1704 "\M-u" gnus-summary-clear-mark-forward
1705 "\M-U" gnus-summary-clear-mark-backward
1706 "k" gnus-summary-kill-same-subject-and-select
1707 "\C-k" gnus-summary-kill-same-subject
1708 "\M-\C-k" gnus-summary-kill-thread
1709 "\M-\C-l" gnus-summary-lower-thread
1710 "e" gnus-summary-edit-article
1711 "#" gnus-summary-mark-as-processable
1712 "\M-#" gnus-summary-unmark-as-processable
1713 "\M-\C-t" gnus-summary-toggle-threads
1714 "\M-\C-s" gnus-summary-show-thread
1715 "\M-\C-h" gnus-summary-hide-thread
1716 "\M-\C-f" gnus-summary-next-thread
1717 "\M-\C-b" gnus-summary-prev-thread
1718 [(meta down)] gnus-summary-next-thread
1719 [(meta up)] gnus-summary-prev-thread
1720 "\M-\C-u" gnus-summary-up-thread
1721 "\M-\C-d" gnus-summary-down-thread
1722 "&" gnus-summary-execute-command
1723 "c" gnus-summary-catchup-and-exit
1724 "\C-w" gnus-summary-mark-region-as-read
1725 "\C-t" gnus-summary-toggle-truncation
1726 "?" gnus-summary-mark-as-dormant
1727 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1728 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1729 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1730 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1731 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1732 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1733 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1734 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1735 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1736 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1737 "=" gnus-summary-expand-window
1738 "\C-x\C-s" gnus-summary-reselect-current-group
1739 "\M-g" gnus-summary-rescan-group
1740 "w" gnus-summary-stop-page-breaking
1741 "\C-c\C-r" gnus-summary-caesar-message
1742 "f" gnus-summary-followup
1743 "F" gnus-summary-followup-with-original
1744 "C" gnus-summary-cancel-article
1745 "r" gnus-summary-reply
1746 "R" gnus-summary-reply-with-original
1747 "\C-c\C-f" gnus-summary-mail-forward
1748 "o" gnus-summary-save-article
1749 "\C-o" gnus-summary-save-article-mail
1750 "|" gnus-summary-pipe-output
1751 "\M-k" gnus-summary-edit-local-kill
1752 "\M-K" gnus-summary-edit-global-kill
1754 "\C-c\C-d" gnus-summary-describe-group
1755 "q" gnus-summary-exit
1756 "Q" gnus-summary-exit-no-update
1757 "\C-c\C-i" gnus-info-find-node
1758 gnus-mouse-2 gnus-mouse-pick-article
1759 "m" gnus-summary-mail-other-window
1760 "a" gnus-summary-post-news
1761 "i" gnus-summary-news-other-window
1762 "x" gnus-summary-limit-to-unread
1763 "s" gnus-summary-isearch-article
1764 "t" gnus-summary-toggle-header
1765 "g" gnus-summary-show-article
1766 "l" gnus-summary-goto-last-article
1767 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1768 "\C-d" gnus-summary-enter-digest-group
1769 "\M-\C-d" gnus-summary-read-document
1770 "\M-\C-e" gnus-summary-edit-parameters
1771 "\M-\C-a" gnus-summary-customize-parameters
1773 "*" gnus-cache-enter-article
1774 "\M-*" gnus-cache-remove-article
1775 "\M-&" gnus-summary-universal-argument
1776 "\C-l" gnus-recenter
1777 "I" gnus-summary-increase-score
1778 "L" gnus-summary-lower-score
1779 "\M-i" gnus-symbolic-argument
1780 "h" gnus-summary-select-article-buffer
1782 "b" gnus-article-view-part
1783 "\M-t" gnus-summary-toggle-display-buttonized
1785 "V" gnus-summary-score-map
1786 "X" gnus-uu-extract-map
1787 "S" gnus-summary-send-map)
1789 ;; Sort of orthogonal keymap
1790 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1791 "t" gnus-summary-tick-article-forward
1792 "!" gnus-summary-tick-article-forward
1793 "d" gnus-summary-mark-as-read-forward
1794 "r" gnus-summary-mark-as-read-forward
1795 "c" gnus-summary-clear-mark-forward
1796 " " gnus-summary-clear-mark-forward
1797 "e" gnus-summary-mark-as-expirable
1798 "x" gnus-summary-mark-as-expirable
1799 "?" gnus-summary-mark-as-dormant
1800 "b" gnus-summary-set-bookmark
1801 "B" gnus-summary-remove-bookmark
1802 "#" gnus-summary-mark-as-processable
1803 "\M-#" gnus-summary-unmark-as-processable
1804 "S" gnus-summary-limit-include-expunged
1805 "C" gnus-summary-catchup
1806 "H" gnus-summary-catchup-to-here
1807 "h" gnus-summary-catchup-from-here
1808 "\C-c" gnus-summary-catchup-all
1809 "k" gnus-summary-kill-same-subject-and-select
1810 "K" gnus-summary-kill-same-subject
1811 "P" gnus-uu-mark-map)
1813 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1814 "c" gnus-summary-clear-above
1815 "u" gnus-summary-tick-above
1816 "m" gnus-summary-mark-above
1817 "k" gnus-summary-kill-below)
1819 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1820 "/" gnus-summary-limit-to-subject
1821 "n" gnus-summary-limit-to-articles
1822 "w" gnus-summary-pop-limit
1823 "s" gnus-summary-limit-to-subject
1824 "a" gnus-summary-limit-to-author
1825 "u" gnus-summary-limit-to-unread
1826 "m" gnus-summary-limit-to-marks
1827 "M" gnus-summary-limit-exclude-marks
1828 "v" gnus-summary-limit-to-score
1829 "*" gnus-summary-limit-include-cached
1830 "D" gnus-summary-limit-include-dormant
1831 "T" gnus-summary-limit-include-thread
1832 "d" gnus-summary-limit-exclude-dormant
1833 "t" gnus-summary-limit-to-age
1834 "." gnus-summary-limit-to-unseen
1835 "x" gnus-summary-limit-to-extra
1836 "p" gnus-summary-limit-to-display-predicate
1837 "E" gnus-summary-limit-include-expunged
1838 "c" gnus-summary-limit-exclude-childless-dormant
1839 "C" gnus-summary-limit-mark-excluded-as-read
1840 "o" gnus-summary-insert-old-articles
1841 "N" gnus-summary-insert-new-articles
1842 "r" gnus-summary-limit-to-replied)
1844 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1845 "n" gnus-summary-next-unread-article
1846 "p" gnus-summary-prev-unread-article
1847 "N" gnus-summary-next-article
1848 "P" gnus-summary-prev-article
1849 "\C-n" gnus-summary-next-same-subject
1850 "\C-p" gnus-summary-prev-same-subject
1851 "\M-n" gnus-summary-next-unread-subject
1852 "\M-p" gnus-summary-prev-unread-subject
1853 "f" gnus-summary-first-unread-article
1854 "b" gnus-summary-best-unread-article
1855 "j" gnus-summary-goto-article
1856 "g" gnus-summary-goto-subject
1857 "l" gnus-summary-goto-last-article
1858 "o" gnus-summary-pop-article)
1860 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1861 "k" gnus-summary-kill-thread
1862 "l" gnus-summary-lower-thread
1863 "i" gnus-summary-raise-thread
1864 "T" gnus-summary-toggle-threads
1865 "t" gnus-summary-rethread-current
1866 "^" gnus-summary-reparent-thread
1867 "s" gnus-summary-show-thread
1868 "S" gnus-summary-show-all-threads
1869 "h" gnus-summary-hide-thread
1870 "H" gnus-summary-hide-all-threads
1871 "n" gnus-summary-next-thread
1872 "p" gnus-summary-prev-thread
1873 "u" gnus-summary-up-thread
1874 "o" gnus-summary-top-thread
1875 "d" gnus-summary-down-thread
1876 "#" gnus-uu-mark-thread
1877 "\M-#" gnus-uu-unmark-thread)
1879 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1880 "g" gnus-summary-prepare
1881 "c" gnus-summary-insert-cached-articles
1882 "d" gnus-summary-insert-dormant-articles)
1884 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1885 "c" gnus-summary-catchup-and-exit
1886 "C" gnus-summary-catchup-all-and-exit
1887 "E" gnus-summary-exit-no-update
1888 "Q" gnus-summary-exit
1889 "Z" gnus-summary-exit
1890 "n" gnus-summary-catchup-and-goto-next-group
1891 "R" gnus-summary-reselect-current-group
1892 "G" gnus-summary-rescan-group
1893 "N" gnus-summary-next-group
1894 "s" gnus-summary-save-newsrc
1895 "P" gnus-summary-prev-group)
1897 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1898 " " gnus-summary-next-page
1899 "n" gnus-summary-next-page
1900 "\177" gnus-summary-prev-page
1901 [delete] gnus-summary-prev-page
1902 "p" gnus-summary-prev-page
1903 "\r" gnus-summary-scroll-up
1904 "\M-\r" gnus-summary-scroll-down
1905 "<" gnus-summary-beginning-of-article
1906 ">" gnus-summary-end-of-article
1907 "b" gnus-summary-beginning-of-article
1908 "e" gnus-summary-end-of-article
1909 "^" gnus-summary-refer-parent-article
1910 "r" gnus-summary-refer-parent-article
1911 "D" gnus-summary-enter-digest-group
1912 "R" gnus-summary-refer-references
1913 "T" gnus-summary-refer-thread
1914 "g" gnus-summary-show-article
1915 "s" gnus-summary-isearch-article
1916 "P" gnus-summary-print-article
1917 "M" gnus-mailing-list-insinuate
1918 "t" gnus-article-babel)
1920 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1921 "b" gnus-article-add-buttons
1922 "B" gnus-article-add-buttons-to-head
1923 "o" gnus-article-treat-overstrike
1924 "e" gnus-article-emphasize
1925 "w" gnus-article-fill-cited-article
1926 "Q" gnus-article-fill-long-lines
1927 "C" gnus-article-capitalize-sentences
1928 "c" gnus-article-remove-cr
1929 "q" gnus-article-de-quoted-unreadable
1930 "6" gnus-article-de-base64-unreadable
1931 "Z" gnus-article-decode-HZ
1932 "A" gnus-article-treat-ansi-sequences
1933 "h" gnus-article-wash-html
1934 "u" gnus-article-unsplit-urls
1935 "s" gnus-summary-force-verify-and-decrypt
1936 "f" gnus-article-display-x-face
1937 "l" gnus-summary-stop-page-breaking
1938 "r" gnus-summary-caesar-message
1939 "m" gnus-summary-morse-message
1940 "t" gnus-summary-toggle-header
1941 "g" gnus-treat-smiley
1942 "v" gnus-summary-verbose-headers
1943 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1944 "p" gnus-article-verify-x-pgp-sig
1945 "d" gnus-article-treat-dumbquotes)
1947 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1948 ;; mnemonic: deuglif*Y*
1949 "u" gnus-article-outlook-unwrap-lines
1950 "a" gnus-article-outlook-repair-attribution
1951 "c" gnus-article-outlook-rearrange-citation
1952 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1954 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1955 "a" gnus-article-hide
1956 "h" gnus-article-hide-headers
1957 "b" gnus-article-hide-boring-headers
1958 "s" gnus-article-hide-signature
1959 "c" gnus-article-hide-citation
1960 "C" gnus-article-hide-citation-in-followups
1961 "l" gnus-article-hide-list-identifiers
1962 "B" gnus-article-strip-banner
1963 "P" gnus-article-hide-pem
1964 "\C-c" gnus-article-hide-citation-maybe)
1966 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1967 "a" gnus-article-highlight
1968 "h" gnus-article-highlight-headers
1969 "c" gnus-article-highlight-citation
1970 "s" gnus-article-highlight-signature)
1972 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1973 "f" gnus-article-treat-fold-headers
1974 "u" gnus-article-treat-unfold-headers
1975 "n" gnus-article-treat-fold-newsgroups)
1977 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1978 "x" gnus-article-display-x-face
1979 "d" gnus-article-display-face
1980 "s" gnus-treat-smiley
1981 "D" gnus-article-remove-images
1982 "f" gnus-treat-from-picon
1983 "m" gnus-treat-mail-picon
1984 "n" gnus-treat-newsgroups-picon)
1986 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1987 "w" gnus-article-decode-mime-words
1988 "c" gnus-article-decode-charset
1989 "v" gnus-mime-view-all-parts
1990 "b" gnus-article-view-part)
1992 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1993 "z" gnus-article-date-ut
1994 "u" gnus-article-date-ut
1995 "l" gnus-article-date-local
1996 "p" gnus-article-date-english
1997 "e" gnus-article-date-lapsed
1998 "o" gnus-article-date-original
1999 "i" gnus-article-date-iso8601
2000 "s" gnus-article-date-user)
2002 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2003 "t" gnus-article-remove-trailing-blank-lines
2004 "l" gnus-article-strip-leading-blank-lines
2005 "m" gnus-article-strip-multiple-blank-lines
2006 "a" gnus-article-strip-blank-lines
2007 "A" gnus-article-strip-all-blank-lines
2008 "s" gnus-article-strip-leading-space
2009 "e" gnus-article-strip-trailing-space
2010 "w" gnus-article-remove-leading-whitespace)
2012 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2014 "f" gnus-summary-fetch-faq
2015 "d" gnus-summary-describe-group
2016 "h" gnus-summary-describe-briefly
2017 "i" gnus-info-find-node
2018 "c" gnus-group-fetch-charter
2019 "C" gnus-group-fetch-control)
2021 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2022 "e" gnus-summary-expire-articles
2023 "\M-\C-e" gnus-summary-expire-articles-now
2024 "\177" gnus-summary-delete-article
2025 [delete] gnus-summary-delete-article
2026 [backspace] gnus-summary-delete-article
2027 "m" gnus-summary-move-article
2028 "r" gnus-summary-respool-article
2029 "w" gnus-summary-edit-article
2030 "c" gnus-summary-copy-article
2031 "B" gnus-summary-crosspost-article
2032 "q" gnus-summary-respool-query
2033 "t" gnus-summary-respool-trace
2034 "i" gnus-summary-import-article
2035 "I" gnus-summary-create-article
2036 "p" gnus-summary-article-posted-p)
2038 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2039 "o" gnus-summary-save-article
2040 "m" gnus-summary-save-article-mail
2041 "F" gnus-summary-write-article-file
2042 "r" gnus-summary-save-article-rmail
2043 "f" gnus-summary-save-article-file
2044 "b" gnus-summary-save-article-body-file
2045 "h" gnus-summary-save-article-folder
2046 "v" gnus-summary-save-article-vm
2047 "p" gnus-summary-pipe-output
2048 "P" gnus-summary-muttprint
2049 "s" gnus-soup-add-article)
2051 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2052 "b" gnus-summary-display-buttonized
2053 "m" gnus-summary-repair-multipart
2054 "v" gnus-article-view-part
2055 "o" gnus-article-save-part
2056 "c" gnus-article-copy-part
2057 "C" gnus-article-view-part-as-charset
2058 "e" gnus-article-view-part-externally
2059 "E" gnus-article-encrypt-body
2060 "i" gnus-article-inline-part
2061 "|" gnus-article-pipe-part)
2063 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2064 "p" gnus-summary-mark-as-processable
2065 "u" gnus-summary-unmark-as-processable
2066 "U" gnus-summary-unmark-all-processable
2067 "v" gnus-uu-mark-over
2068 "s" gnus-uu-mark-series
2069 "r" gnus-uu-mark-region
2070 "g" gnus-uu-unmark-region
2071 "R" gnus-uu-mark-by-regexp
2072 "G" gnus-uu-unmark-by-regexp
2073 "t" gnus-uu-mark-thread
2074 "T" gnus-uu-unmark-thread
2075 "a" gnus-uu-mark-all
2076 "b" gnus-uu-mark-buffer
2077 "S" gnus-uu-mark-sparse
2078 "k" gnus-summary-kill-process-mark
2079 "y" gnus-summary-yank-process-mark
2080 "w" gnus-summary-save-process-mark
2081 "i" gnus-uu-invert-processable)
2083 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2084 ;;"x" gnus-uu-extract-any
2085 "m" gnus-summary-save-parts
2086 "u" gnus-uu-decode-uu
2087 "U" gnus-uu-decode-uu-and-save
2088 "s" gnus-uu-decode-unshar
2089 "S" gnus-uu-decode-unshar-and-save
2090 "o" gnus-uu-decode-save
2091 "O" gnus-uu-decode-save
2092 "b" gnus-uu-decode-binhex
2093 "B" gnus-uu-decode-binhex
2094 "p" gnus-uu-decode-postscript
2095 "P" gnus-uu-decode-postscript-and-save)
2098 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2099 "u" gnus-uu-decode-uu-view
2100 "U" gnus-uu-decode-uu-and-save-view
2101 "s" gnus-uu-decode-unshar-view
2102 "S" gnus-uu-decode-unshar-and-save-view
2103 "o" gnus-uu-decode-save-view
2104 "O" gnus-uu-decode-save-view
2105 "b" gnus-uu-decode-binhex-view
2106 "B" gnus-uu-decode-binhex-view
2107 "p" gnus-uu-decode-postscript-view
2108 "P" gnus-uu-decode-postscript-and-save-view)
2110 (defvar gnus-article-post-menu nil)
2112 (defconst gnus-summary-menu-maxlen 20)
2114 (defun gnus-summary-menu-split (menu)
2115 ;; If we have lots of elements, divide them into groups of 20
2116 ;; and make a pane (or submenu) for each one.
2117 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2118 (let ((menu menu) sublists next
2121 ;; Pull off the next gnus-summary-menu-maxlen elements
2122 ;; and make them the next element of sublist.
2123 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2125 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2127 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2128 (aref (car (last menu)) 0)) menu)
2132 (nreverse sublists))
2133 ;; Few elements--put them all in one pane.
2136 (defun gnus-summary-make-menu-bar ()
2137 (gnus-turn-off-edit-menu 'summary)
2139 (unless (boundp 'gnus-summary-misc-menu)
2142 gnus-summary-kill-menu gnus-summary-mode-map ""
2147 ["Customize" gnus-score-customize t])
2148 (gnus-make-score-map 'increase)
2149 (gnus-make-score-map 'lower)
2151 ["Kill below" gnus-summary-kill-below t]
2152 ["Mark above" gnus-summary-mark-above t]
2153 ["Tick above" gnus-summary-tick-above t]
2154 ["Clear above" gnus-summary-clear-above t])
2155 ["Current score" gnus-summary-current-score t]
2156 ["Set score" gnus-summary-set-score t]
2157 ["Switch current score file..." gnus-score-change-score-file t]
2158 ["Set mark below..." gnus-score-set-mark-below t]
2159 ["Set expunge below..." gnus-score-set-expunge-below t]
2160 ["Edit current score file" gnus-score-edit-current-scores t]
2161 ["Edit score file" gnus-score-edit-file t]
2162 ["Trace score" gnus-score-find-trace t]
2163 ["Find words" gnus-score-find-favourite-words t]
2164 ["Rescore buffer" gnus-summary-rescore t]
2165 ["Increase score..." gnus-summary-increase-score t]
2166 ["Lower score..." gnus-summary-lower-score t]))))
2168 ;; Define both the Article menu in the summary buffer and the
2169 ;; equivalent Commands menu in the article buffer here for
2173 ["All" gnus-article-hide t]
2174 ["Headers" gnus-article-hide-headers t]
2175 ["Signature" gnus-article-hide-signature t]
2176 ["Citation" gnus-article-hide-citation t]
2177 ["List identifiers" gnus-article-hide-list-identifiers t]
2178 ["Banner" gnus-article-strip-banner t]
2179 ["Boring headers" gnus-article-hide-boring-headers t])
2181 ["All" gnus-article-highlight t]
2182 ["Headers" gnus-article-highlight-headers t]
2183 ["Signature" gnus-article-highlight-signature t]
2184 ["Citation" gnus-article-highlight-citation t])
2186 ["Words" gnus-article-decode-mime-words t]
2187 ["Charset" gnus-article-decode-charset t]
2188 ["QP" gnus-article-de-quoted-unreadable t]
2189 ["Base64" gnus-article-de-base64-unreadable t]
2190 ["View MIME buttons" gnus-summary-display-buttonized t]
2191 ["View all" gnus-mime-view-all-parts t]
2192 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2193 ["Encrypt body" gnus-article-encrypt-body
2194 :active (not (gnus-group-read-only-p))
2195 ,@(if (featurep 'xemacs) nil
2196 '(:help "Encrypt the message body on disk"))]
2197 ["Extract all parts..." gnus-summary-save-parts t]
2199 ["Repair multipart" gnus-summary-repair-multipart t]
2200 ["Pipe part..." gnus-article-pipe-part t]
2201 ["Inline part" gnus-article-inline-part t]
2202 ["Encrypt body" gnus-article-encrypt-body
2203 :active (not (gnus-group-read-only-p))
2204 ,@(if (featurep 'xemacs) nil
2205 '(:help "Encrypt the message body on disk"))]
2206 ["View part externally" gnus-article-view-part-externally t]
2207 ["View part with charset..." gnus-article-view-part-as-charset t]
2208 ["Copy part" gnus-article-copy-part t]
2209 ["Save part..." gnus-article-save-part t]
2210 ["View part" gnus-article-view-part t]))
2212 ["Local" gnus-article-date-local t]
2213 ["ISO8601" gnus-article-date-iso8601 t]
2214 ["UT" gnus-article-date-ut t]
2215 ["Original" gnus-article-date-original t]
2216 ["Lapsed" gnus-article-date-lapsed t]
2217 ["User-defined" gnus-article-date-user t])
2219 ["Remove images" gnus-article-remove-images t]
2220 ["Toggle smiley" gnus-treat-smiley t]
2221 ["Show X-Face" gnus-article-display-x-face t]
2222 ["Show picons in From" gnus-treat-from-picon t]
2223 ["Show picons in mail headers" gnus-treat-mail-picon t]
2224 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2225 ("View as different encoding"
2226 ,@(gnus-summary-menu-split
2229 ;; Since easymenu under Emacs doesn't allow
2230 ;; lambda forms for menu commands, we should
2231 ;; provide intern'ed function symbols.
2232 (let ((command (intern (format "\
2233 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2237 (let ((gnus-summary-show-article-charset-alist
2239 (gnus-summary-show-article 1))))
2240 `[,(symbol-name cs) ,command t]))
2241 (sort (if (fboundp 'coding-system-list)
2242 (coding-system-list)
2243 (mapcar 'car mm-mime-mule-charset-alist))
2247 ["Leading" gnus-article-strip-leading-blank-lines t]
2248 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2249 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2250 ["All of the above" gnus-article-strip-blank-lines t]
2251 ["All" gnus-article-strip-all-blank-lines t]
2252 ["Leading space" gnus-article-strip-leading-space t]
2253 ["Trailing space" gnus-article-strip-trailing-space t]
2254 ["Leading space in headers"
2255 gnus-article-remove-leading-whitespace t])
2256 ["Overstrike" gnus-article-treat-overstrike t]
2257 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2258 ["Emphasis" gnus-article-emphasize t]
2259 ["Word wrap" gnus-article-fill-cited-article t]
2260 ["Fill long lines" gnus-article-fill-long-lines t]
2261 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2262 ["Remove CR" gnus-article-remove-cr t]
2263 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2264 ["Base64" gnus-article-de-base64-unreadable t]
2265 ["Rot 13" gnus-summary-caesar-message
2266 ,@(if (featurep 'xemacs) '(t)
2267 '(:help "\"Caesar rotate\" article by 13"))]
2268 ["Morse decode" gnus-summary-morse-message t]
2269 ["Unix pipe..." gnus-summary-pipe-message t]
2270 ["Add buttons" gnus-article-add-buttons t]
2271 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2272 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2273 ["Verbose header" gnus-summary-verbose-headers t]
2274 ["Toggle header" gnus-summary-toggle-header t]
2275 ["Unfold headers" gnus-article-treat-unfold-headers t]
2276 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2277 ["Html" gnus-article-wash-html t]
2278 ["Unsplit URLs" gnus-article-unsplit-urls t]
2279 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2280 ["Decode HZ" gnus-article-decode-HZ t]
2281 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2282 ("(Outlook) Deuglify"
2283 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2284 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2285 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2286 ["Full (Outlook) deuglify"
2287 gnus-article-outlook-deuglify-article t])
2290 ["Save in default format..." gnus-summary-save-article
2291 ,@(if (featurep 'xemacs) '(t)
2292 '(:help "Save article using default method"))]
2293 ["Save in file..." gnus-summary-save-article-file
2294 ,@(if (featurep 'xemacs) '(t)
2295 '(:help "Save article in file"))]
2296 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2297 ["Save in MH folder..." gnus-summary-save-article-folder t]
2298 ["Save in VM folder..." gnus-summary-save-article-vm t]
2299 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2300 ["Save body in file..." gnus-summary-save-article-body-file t]
2301 ["Pipe through a filter..." gnus-summary-pipe-output t]
2302 ["Add to SOUP packet" gnus-soup-add-article t]
2303 ["Print with Muttprint..." gnus-summary-muttprint t]
2304 ["Print" gnus-summary-print-article
2305 ,@(if (featurep 'xemacs) '(t)
2306 '(:help "Generate and print a PostScript image"))])
2307 ("Copy, move,... (Backend)"
2308 ,@(if (featurep 'xemacs) nil
2309 '(:help "Copying, moving, expiring articles..."))
2310 ["Respool article..." gnus-summary-respool-article t]
2311 ["Move article..." gnus-summary-move-article
2312 (gnus-check-backend-function
2313 'request-move-article gnus-newsgroup-name)]
2314 ["Copy article..." gnus-summary-copy-article t]
2315 ["Crosspost article..." gnus-summary-crosspost-article
2316 (gnus-check-backend-function
2317 'request-replace-article gnus-newsgroup-name)]
2318 ["Import file..." gnus-summary-import-article
2319 (gnus-check-backend-function
2320 'request-accept-article gnus-newsgroup-name)]
2321 ["Create article..." gnus-summary-create-article
2322 (gnus-check-backend-function
2323 'request-accept-article gnus-newsgroup-name)]
2324 ["Check if posted" gnus-summary-article-posted-p t]
2325 ["Edit article" gnus-summary-edit-article
2326 (not (gnus-group-read-only-p))]
2327 ["Delete article" gnus-summary-delete-article
2328 (gnus-check-backend-function
2329 'request-expire-articles gnus-newsgroup-name)]
2330 ["Query respool" gnus-summary-respool-query t]
2331 ["Trace respool" gnus-summary-respool-trace t]
2332 ["Delete expirable articles" gnus-summary-expire-articles-now
2333 (gnus-check-backend-function
2334 'request-expire-articles gnus-newsgroup-name)])
2336 ["Uudecode" gnus-uu-decode-uu
2337 ,@(if (featurep 'xemacs) '(t)
2338 '(:help "Decode uuencoded article(s)"))]
2339 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2340 ["Unshar" gnus-uu-decode-unshar t]
2341 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2342 ["Save" gnus-uu-decode-save t]
2343 ["Binhex" gnus-uu-decode-binhex t]
2344 ["Postscript" gnus-uu-decode-postscript t]
2345 ["All MIME parts" gnus-summary-save-parts t])
2347 ["Enter article" gnus-cache-enter-article t]
2348 ["Remove article" gnus-cache-remove-article t])
2349 ["Translate" gnus-article-babel t]
2350 ["Select article buffer" gnus-summary-select-article-buffer t]
2351 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2352 ["Isearch article..." gnus-summary-isearch-article t]
2353 ["Beginning of the article" gnus-summary-beginning-of-article t]
2354 ["End of the article" gnus-summary-end-of-article t]
2355 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2356 ["Fetch referenced articles" gnus-summary-refer-references t]
2357 ["Fetch current thread" gnus-summary-refer-thread t]
2358 ["Fetch article with id..." gnus-summary-refer-article t]
2359 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2360 ["Redisplay" gnus-summary-show-article t]
2361 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2363 gnus-summary-article-menu gnus-summary-mode-map ""
2364 (cons "Article" innards))
2366 (if (not (keymapp gnus-summary-article-menu))
2368 gnus-article-commands-menu gnus-article-mode-map ""
2369 (cons "Commands" innards))
2370 ;; in Emacs, don't share menu.
2371 (setq gnus-article-commands-menu
2372 (copy-keymap gnus-summary-article-menu))
2373 (define-key gnus-article-mode-map [menu-bar commands]
2374 (cons "Commands" gnus-article-commands-menu))))
2377 gnus-summary-thread-menu gnus-summary-mode-map ""
2379 ["Find all messages in thread" gnus-summary-refer-thread t]
2380 ["Toggle threading" gnus-summary-toggle-threads t]
2381 ["Hide threads" gnus-summary-hide-all-threads t]
2382 ["Show threads" gnus-summary-show-all-threads t]
2383 ["Hide thread" gnus-summary-hide-thread t]
2384 ["Show thread" gnus-summary-show-thread t]
2385 ["Go to next thread" gnus-summary-next-thread t]
2386 ["Go to previous thread" gnus-summary-prev-thread t]
2387 ["Go down thread" gnus-summary-down-thread t]
2388 ["Go up thread" gnus-summary-up-thread t]
2389 ["Top of thread" gnus-summary-top-thread t]
2390 ["Mark thread as read" gnus-summary-kill-thread t]
2391 ["Lower thread score" gnus-summary-lower-thread t]
2392 ["Raise thread score" gnus-summary-raise-thread t]
2393 ["Rethread current" gnus-summary-rethread-current t]))
2396 gnus-summary-post-menu gnus-summary-mode-map ""
2398 ["Send a message (mail or news)" gnus-summary-post-news
2399 ,@(if (featurep 'xemacs) '(t)
2400 '(:help "Compose a new message (mail or news)"))]
2401 ["Followup" gnus-summary-followup
2402 ,@(if (featurep 'xemacs) '(t)
2403 '(:help "Post followup to this article"))]
2404 ["Followup and yank" gnus-summary-followup-with-original
2405 ,@(if (featurep 'xemacs) '(t)
2406 '(:help "Post followup to this article, quoting its contents"))]
2407 ["Supersede article" gnus-summary-supersede-article t]
2408 ["Cancel article" gnus-summary-cancel-article
2409 ,@(if (featurep 'xemacs) '(t)
2410 '(:help "Cancel an article you posted"))]
2411 ["Reply" gnus-summary-reply t]
2412 ["Reply and yank" gnus-summary-reply-with-original t]
2413 ["Wide reply" gnus-summary-wide-reply t]
2414 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2415 ,@(if (featurep 'xemacs) '(t)
2416 '(:help "Mail a reply, quoting this article"))]
2417 ["Very wide reply" gnus-summary-very-wide-reply t]
2418 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2419 ,@(if (featurep 'xemacs) '(t)
2420 '(:help "Mail a very wide reply, quoting this article"))]
2421 ["Mail forward" gnus-summary-mail-forward t]
2422 ["Post forward" gnus-summary-post-forward t]
2423 ["Digest and mail" gnus-uu-digest-mail-forward t]
2424 ["Digest and post" gnus-uu-digest-post-forward t]
2425 ["Resend message" gnus-summary-resend-message t]
2426 ["Resend message edit" gnus-summary-resend-message-edit t]
2427 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2428 ["Send a mail" gnus-summary-mail-other-window t]
2429 ["Create a local message" gnus-summary-news-other-window t]
2430 ["Uuencode and post" gnus-uu-post-news
2431 ,@(if (featurep 'xemacs) '(t)
2432 '(:help "Post a uuencoded article"))]
2433 ["Followup via news" gnus-summary-followup-to-mail t]
2434 ["Followup via news and yank"
2435 gnus-summary-followup-to-mail-with-original t]
2437 ;;["Send" gnus-summary-send-draft t]
2438 ;;["Send bounced" gnus-resend-bounced-mail t])
2442 ((not (keymapp gnus-summary-post-menu))
2443 (setq gnus-article-post-menu gnus-summary-post-menu))
2444 ((not gnus-article-post-menu)
2445 ;; Don't share post menu.
2446 (setq gnus-article-post-menu
2447 (copy-keymap gnus-summary-post-menu))))
2448 (define-key gnus-article-mode-map [menu-bar post]
2449 (cons "Post" gnus-article-post-menu))
2452 gnus-summary-misc-menu gnus-summary-mode-map ""
2455 ["Mark as read" gnus-summary-mark-as-read-forward t]
2456 ["Mark same subject and select"
2457 gnus-summary-kill-same-subject-and-select t]
2458 ["Mark same subject" gnus-summary-kill-same-subject t]
2459 ["Catchup" gnus-summary-catchup
2460 ,@(if (featurep 'xemacs) '(t)
2461 '(:help "Mark unread articles in this group as read"))]
2462 ["Catchup all" gnus-summary-catchup-all t]
2463 ["Catchup to here" gnus-summary-catchup-to-here t]
2464 ["Catchup from here" gnus-summary-catchup-from-here t]
2465 ["Catchup region" gnus-summary-mark-region-as-read
2466 (gnus-mark-active-p)]
2467 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2469 ["Tick" gnus-summary-tick-article-forward t]
2470 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2471 ["Remove marks" gnus-summary-clear-mark-forward t]
2472 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2473 ["Set bookmark" gnus-summary-set-bookmark t]
2474 ["Remove bookmark" gnus-summary-remove-bookmark t])
2476 ["Marks..." gnus-summary-limit-to-marks t]
2477 ["Subject..." gnus-summary-limit-to-subject t]
2478 ["Author..." gnus-summary-limit-to-author t]
2479 ["Age..." gnus-summary-limit-to-age t]
2480 ["Extra..." gnus-summary-limit-to-extra t]
2481 ["Score..." gnus-summary-limit-to-score t]
2482 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2483 ["Unread" gnus-summary-limit-to-unread t]
2484 ["Unseen" gnus-summary-limit-to-unseen t]
2485 ["Replied" gnus-summary-limit-to-replied t]
2486 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2487 ["Next articles" gnus-summary-limit-to-articles t]
2488 ["Pop limit" gnus-summary-pop-limit t]
2489 ["Show dormant" gnus-summary-limit-include-dormant t]
2490 ["Hide childless dormant"
2491 gnus-summary-limit-exclude-childless-dormant t]
2492 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2493 ["Hide marked" gnus-summary-limit-exclude-marks t]
2494 ["Show expunged" gnus-summary-limit-include-expunged t])
2496 ["Set mark" gnus-summary-mark-as-processable t]
2497 ["Remove mark" gnus-summary-unmark-as-processable t]
2498 ["Remove all marks" gnus-summary-unmark-all-processable t]
2499 ["Invert marks" gnus-uu-invert-processable t]
2500 ["Mark above" gnus-uu-mark-over t]
2501 ["Mark series" gnus-uu-mark-series t]
2502 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2503 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2504 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2505 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2506 ["Mark all" gnus-uu-mark-all t]
2507 ["Mark buffer" gnus-uu-mark-buffer t]
2508 ["Mark sparse" gnus-uu-mark-sparse t]
2509 ["Mark thread" gnus-uu-mark-thread t]
2510 ["Unmark thread" gnus-uu-unmark-thread t]
2511 ("Process Mark Sets"
2512 ["Kill" gnus-summary-kill-process-mark t]
2513 ["Yank" gnus-summary-yank-process-mark
2514 gnus-newsgroup-process-stack]
2515 ["Save" gnus-summary-save-process-mark t]
2516 ["Run command on marked..." gnus-summary-universal-argument t]))
2518 ["Page forward" gnus-summary-next-page
2519 ,@(if (featurep 'xemacs) '(t)
2520 '(:help "Show next page of article"))]
2521 ["Page backward" gnus-summary-prev-page
2522 ,@(if (featurep 'xemacs) '(t)
2523 '(:help "Show previous page of article"))]
2524 ["Line forward" gnus-summary-scroll-up t])
2526 ["Next unread article" gnus-summary-next-unread-article t]
2527 ["Previous unread article" gnus-summary-prev-unread-article t]
2528 ["Next article" gnus-summary-next-article t]
2529 ["Previous article" gnus-summary-prev-article t]
2530 ["Next unread subject" gnus-summary-next-unread-subject t]
2531 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2532 ["Next article same subject" gnus-summary-next-same-subject t]
2533 ["Previous article same subject" gnus-summary-prev-same-subject t]
2534 ["First unread article" gnus-summary-first-unread-article t]
2535 ["Best unread article" gnus-summary-best-unread-article t]
2536 ["Go to subject number..." gnus-summary-goto-subject t]
2537 ["Go to article number..." gnus-summary-goto-article t]
2538 ["Go to the last article" gnus-summary-goto-last-article t]
2539 ["Pop article off history" gnus-summary-pop-article t])
2541 ["Sort by number" gnus-summary-sort-by-number t]
2542 ["Sort by author" gnus-summary-sort-by-author t]
2543 ["Sort by subject" gnus-summary-sort-by-subject t]
2544 ["Sort by date" gnus-summary-sort-by-date t]
2545 ["Sort by score" gnus-summary-sort-by-score t]
2546 ["Sort by lines" gnus-summary-sort-by-lines t]
2547 ["Sort by characters" gnus-summary-sort-by-chars t]
2548 ["Randomize" gnus-summary-sort-by-random t]
2549 ["Original sort" gnus-summary-sort-by-original t])
2551 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2552 ["Describe group" gnus-summary-describe-group t]
2553 ["Fetch charter" gnus-group-fetch-charter
2554 ,@(if (featurep 'xemacs) nil
2555 '(:help "Display the charter of the current group"))]
2556 ["Fetch control message" gnus-group-fetch-control
2557 ,@(if (featurep 'xemacs) nil
2558 '(:help "Display the archived control message for the current group"))]
2559 ["Read manual" gnus-info-find-node t])
2561 ["Pick and read" gnus-pick-mode t]
2562 ["Binary" gnus-binary-mode t])
2564 ["Regenerate" gnus-summary-prepare t]
2565 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2566 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2567 ["Toggle threading" gnus-summary-toggle-threads t])
2568 ["See old articles" gnus-summary-insert-old-articles t]
2569 ["See new articles" gnus-summary-insert-new-articles t]
2570 ["Filter articles..." gnus-summary-execute-command t]
2571 ["Run command on articles..." gnus-summary-universal-argument t]
2572 ["Search articles forward..." gnus-summary-search-article-forward t]
2573 ["Search articles backward..." gnus-summary-search-article-backward t]
2574 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2575 ["Expand window" gnus-summary-expand-window t]
2576 ["Expire expirable articles" gnus-summary-expire-articles
2577 (gnus-check-backend-function
2578 'request-expire-articles gnus-newsgroup-name)]
2579 ["Edit local kill file" gnus-summary-edit-local-kill t]
2580 ["Edit main kill file" gnus-summary-edit-global-kill t]
2581 ["Edit group parameters" gnus-summary-edit-parameters t]
2582 ["Customize group parameters" gnus-summary-customize-parameters t]
2583 ["Send a bug report" gnus-bug t]
2585 ["Catchup and exit" gnus-summary-catchup-and-exit
2586 ,@(if (featurep 'xemacs) '(t)
2587 '(:help "Mark unread articles in this group as read, then exit"))]
2588 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2589 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2590 ["Exit group" gnus-summary-exit
2591 ,@(if (featurep 'xemacs) '(t)
2592 '(:help "Exit current group, return to group selection mode"))]
2593 ["Exit group without updating" gnus-summary-exit-no-update t]
2594 ["Exit and goto next group" gnus-summary-next-group t]
2595 ["Exit and goto prev group" gnus-summary-prev-group t]
2596 ["Reselect group" gnus-summary-reselect-current-group t]
2597 ["Rescan group" gnus-summary-rescan-group t]
2598 ["Update dribble" gnus-summary-save-newsrc t])))
2600 (gnus-run-hooks 'gnus-summary-menu-hook)))
2602 (defvar gnus-summary-tool-bar-map nil)
2604 ;; Emacs 21 tool bar. Should be no-op otherwise.
2605 (defun gnus-summary-make-tool-bar ()
2606 (if (and (fboundp 'tool-bar-add-item-from-menu)
2607 (default-value 'tool-bar-mode)
2608 (not gnus-summary-tool-bar-map))
2609 (setq gnus-summary-tool-bar-map
2610 (let ((tool-bar-map (make-sparse-keymap))
2611 (load-path (mm-image-load-path)))
2612 (tool-bar-add-item-from-menu
2613 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2614 (tool-bar-add-item-from-menu
2615 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2616 (tool-bar-add-item-from-menu
2617 'gnus-summary-post-news "post" gnus-summary-mode-map)
2618 (tool-bar-add-item-from-menu
2619 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2620 (tool-bar-add-item-from-menu
2621 'gnus-summary-followup "followup" gnus-summary-mode-map)
2622 (tool-bar-add-item-from-menu
2623 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2624 (tool-bar-add-item-from-menu
2625 'gnus-summary-reply "reply" gnus-summary-mode-map)
2626 (tool-bar-add-item-from-menu
2627 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2628 (tool-bar-add-item-from-menu
2629 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2630 (tool-bar-add-item-from-menu
2631 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2632 (tool-bar-add-item-from-menu
2633 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2634 (tool-bar-add-item-from-menu
2635 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2636 (tool-bar-add-item-from-menu
2637 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2638 (tool-bar-add-item-from-menu
2639 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2640 (tool-bar-add-item-from-menu
2641 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2642 (tool-bar-add-item-from-menu
2643 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2645 (if gnus-summary-tool-bar-map
2646 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2648 (defun gnus-score-set-default (var value)
2649 "A version of set that updates the GNU Emacs menu-bar."
2651 ;; It is the message that forces the active status to be updated.
2654 (defun gnus-make-score-map (type)
2655 "Make a summary score map of type TYPE."
2658 (let ((headers '(("author" "from" string)
2659 ("subject" "subject" string)
2660 ("article body" "body" string)
2661 ("article head" "head" string)
2662 ("xref" "xref" string)
2663 ("extra header" "extra" string)
2664 ("lines" "lines" number)
2665 ("followups to author" "followup" string)))
2666 (types '((number ("less than" <)
2669 (string ("substring" s)
2673 (perms '(("temporary" (current-time-string))
2681 (if (eq type 'lower)
2686 (setq header (car headers))
2692 (let ((ts (cdr (assoc (nth 2 header) types)))
2708 'gnus-summary-score-entry
2710 (if (or (string= (nth 1 header)
2712 (string= (nth 1 header)
2715 (list 'gnus-summary-header
2717 (list 'quote (nth 1 (car ts)))
2718 (list 'gnus-score-delta-default
2725 (list (nreverse outp))))
2728 (list (nreverse outt))))
2730 (setq headers (cdr headers)))
2731 (list (nreverse outh))))))))
2735 (defun gnus-summary-mode (&optional group)
2736 "Major mode for reading articles.
2738 All normal editing commands are switched off.
2739 \\<gnus-summary-mode-map>
2740 Each line in this buffer represents one article. To read an
2741 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2742 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2745 You can also post articles and send mail from this buffer. To
2746 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2747 of an article, type `\\[gnus-summary-reply]'.
2749 There are approx. one gazillion commands you can execute in this
2750 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2752 The following commands are available:
2754 \\{gnus-summary-mode-map}"
2756 (kill-all-local-variables)
2757 (when (gnus-visual-p 'summary-menu 'menu)
2758 (gnus-summary-make-menu-bar)
2759 (gnus-summary-make-tool-bar))
2760 (gnus-summary-make-local-variables)
2761 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2762 (gnus-summary-make-local-variables))
2763 (gnus-make-thread-indent-array)
2764 (gnus-simplify-mode-line)
2765 (setq major-mode 'gnus-summary-mode)
2766 (setq mode-name "Summary")
2767 (make-local-variable 'minor-mode-alist)
2768 (use-local-map gnus-summary-mode-map)
2769 (buffer-disable-undo)
2770 (setq buffer-read-only t ;Disable modification
2771 show-trailing-whitespace nil)
2772 (setq truncate-lines t)
2773 (setq selective-display t)
2774 (setq selective-display-ellipses t) ;Display `...'
2775 (gnus-summary-set-display-table)
2776 (gnus-set-default-directory)
2777 (setq gnus-newsgroup-name group)
2778 (make-local-variable 'gnus-summary-line-format)
2779 (make-local-variable 'gnus-summary-line-format-spec)
2780 (make-local-variable 'gnus-summary-dummy-line-format)
2781 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2782 (make-local-variable 'gnus-summary-mark-positions)
2783 (gnus-make-local-hook 'pre-command-hook)
2784 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2785 (gnus-run-hooks 'gnus-summary-mode-hook)
2786 (turn-on-gnus-mailing-list-mode)
2787 (mm-enable-multibyte)
2788 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2789 (gnus-update-summary-mark-positions))
2791 (defun gnus-summary-make-local-variables ()
2792 "Make all the local summary buffer variables."
2794 (dolist (local gnus-summary-local-variables)
2797 (if (eq (cdr local) 'global)
2798 ;; Copy the global value of the variable.
2799 (setq global (symbol-value (car local)))
2800 ;; Use the value from the list.
2801 (setq global (eval (cdr local))))
2802 (set (make-local-variable (car local)) global))
2803 ;; Simple nil-valued local variable.
2804 (set (make-local-variable local) nil)))))
2806 (defun gnus-summary-clear-local-variables ()
2807 (let ((locals gnus-summary-local-variables))
2809 (if (consp (car locals))
2810 (and (symbolp (caar locals))
2811 (set (caar locals) nil))
2812 (and (symbolp (car locals))
2813 (set (car locals) nil)))
2814 (setq locals (cdr locals)))))
2816 ;; Summary data functions.
2818 (defmacro gnus-data-number (data)
2821 (defmacro gnus-data-set-number (data number)
2822 `(setcar ,data ,number))
2824 (defmacro gnus-data-mark (data)
2827 (defmacro gnus-data-set-mark (data mark)
2828 `(setcar (nthcdr 1 ,data) ,mark))
2830 (defmacro gnus-data-pos (data)
2833 (defmacro gnus-data-set-pos (data pos)
2834 `(setcar (nthcdr 2 ,data) ,pos))
2836 (defmacro gnus-data-header (data)
2839 (defmacro gnus-data-set-header (data header)
2840 `(setf (nth 3 ,data) ,header))
2842 (defmacro gnus-data-level (data)
2845 (defmacro gnus-data-unread-p (data)
2846 `(= (nth 1 ,data) gnus-unread-mark))
2848 (defmacro gnus-data-read-p (data)
2849 `(/= (nth 1 ,data) gnus-unread-mark))
2851 (defmacro gnus-data-pseudo-p (data)
2852 `(consp (nth 3 ,data)))
2854 (defmacro gnus-data-find (number)
2855 `(assq ,number gnus-newsgroup-data))
2857 (defmacro gnus-data-find-list (number &optional data)
2858 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2859 (memq (assq ,number bdata)
2862 (defmacro gnus-data-make (number mark pos header level)
2863 `(list ,number ,mark ,pos ,header ,level))
2865 (defun gnus-data-enter (after-article number mark pos header level offset)
2866 (let ((data (gnus-data-find-list after-article)))
2868 (error "No such article: %d" after-article))
2869 (setcdr data (cons (gnus-data-make number mark pos header level)
2871 (setq gnus-newsgroup-data-reverse nil)
2872 (gnus-data-update-list (cddr data) offset)))
2874 (defun gnus-data-enter-list (after-article list &optional offset)
2876 (let ((data (and after-article (gnus-data-find-list after-article)))
2880 (let ((odata gnus-newsgroup-data))
2881 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2883 (gnus-data-update-list odata offset)))
2884 ;; Find the last element in the list to be spliced into the main
2886 (setq list (last list))
2889 (setcdr list gnus-newsgroup-data)
2890 (setq gnus-newsgroup-data ilist)
2892 (gnus-data-update-list (cdr list) offset)))
2893 (setcdr list (cdr data))
2896 (gnus-data-update-list (cdr list) offset))))
2897 (setq gnus-newsgroup-data-reverse nil))))
2899 (defun gnus-data-remove (article &optional offset)
2900 (let ((data gnus-newsgroup-data))
2901 (if (= (gnus-data-number (car data)) article)
2903 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2904 gnus-newsgroup-data-reverse nil)
2906 (gnus-data-update-list gnus-newsgroup-data offset)))
2908 (when (= (gnus-data-number (cadr data)) article)
2909 (setcdr data (cddr data))
2911 (gnus-data-update-list (cdr data) offset))
2913 gnus-newsgroup-data-reverse nil))
2914 (setq data (cdr data))))))
2916 (defmacro gnus-data-list (backward)
2918 (or gnus-newsgroup-data-reverse
2919 (setq gnus-newsgroup-data-reverse
2920 (reverse gnus-newsgroup-data)))
2921 gnus-newsgroup-data))
2923 (defun gnus-data-update-list (data offset)
2924 "Add OFFSET to the POS of all data entries in DATA."
2925 (setq gnus-newsgroup-data-reverse nil)
2927 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2928 (setq data (cdr data))))
2930 (defun gnus-summary-article-pseudo-p (article)
2931 "Say whether this article is a pseudo article or not."
2932 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2934 (defmacro gnus-summary-article-sparse-p (article)
2935 "Say whether this article is a sparse article or not."
2936 `(memq ,article gnus-newsgroup-sparse))
2938 (defmacro gnus-summary-article-ancient-p (article)
2939 "Say whether this article is a sparse article or not."
2940 `(memq ,article gnus-newsgroup-ancient))
2942 (defun gnus-article-parent-p (number)
2943 "Say whether this article is a parent or not."
2944 (let ((data (gnus-data-find-list number)))
2945 (and (cdr data) ; There has to be an article after...
2946 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2947 (gnus-data-level (nth 1 data))))))
2949 (defun gnus-article-children (number)
2950 "Return a list of all children to NUMBER."
2951 (let* ((data (gnus-data-find-list number))
2952 (level (gnus-data-level (car data)))
2954 (setq data (cdr data))
2956 (= (gnus-data-level (car data)) (1+ level)))
2957 (push (gnus-data-number (car data)) children)
2958 (setq data (cdr data)))
2961 (defmacro gnus-summary-skip-intangible ()
2962 "If the current article is intangible, then jump to a different article."
2963 '(let ((to (get-text-property (point) 'gnus-intangible)))
2964 (and to (gnus-summary-goto-subject to))))
2966 (defmacro gnus-summary-article-intangible-p ()
2967 "Say whether this article is intangible or not."
2968 '(get-text-property (point) 'gnus-intangible))
2970 (defun gnus-article-read-p (article)
2971 "Say whether ARTICLE is read or not."
2972 (not (or (memq article gnus-newsgroup-marked)
2973 (memq article gnus-newsgroup-spam-marked)
2974 (memq article gnus-newsgroup-unreads)
2975 (memq article gnus-newsgroup-unselected)
2976 (memq article gnus-newsgroup-dormant))))
2978 ;; Some summary mode macros.
2980 (defmacro gnus-summary-article-number ()
2981 "The article number of the article on the current line.
2982 If there isn't an article number here, then we return the current
2985 (gnus-summary-skip-intangible)
2986 (or (get-text-property (point) 'gnus-number)
2987 (gnus-summary-last-subject))))
2989 (defmacro gnus-summary-article-header (&optional number)
2990 "Return the header of article NUMBER."
2991 `(gnus-data-header (gnus-data-find
2992 ,(or number '(gnus-summary-article-number)))))
2994 (defmacro gnus-summary-thread-level (&optional number)
2995 "Return the level of thread that starts with article NUMBER."
2996 `(if (and (eq gnus-summary-make-false-root 'dummy)
2997 (get-text-property (point) 'gnus-intangible))
2999 (gnus-data-level (gnus-data-find
3000 ,(or number '(gnus-summary-article-number))))))
3002 (defmacro gnus-summary-article-mark (&optional number)
3003 "Return the mark of article NUMBER."
3004 `(gnus-data-mark (gnus-data-find
3005 ,(or number '(gnus-summary-article-number)))))
3007 (defmacro gnus-summary-article-pos (&optional number)
3008 "Return the position of the line of article NUMBER."
3009 `(gnus-data-pos (gnus-data-find
3010 ,(or number '(gnus-summary-article-number)))))
3012 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3013 (defmacro gnus-summary-article-subject (&optional number)
3014 "Return current subject string or nil if nothing."
3017 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3018 '(gnus-data-header (assq (gnus-summary-article-number)
3019 gnus-newsgroup-data)))))
3022 (mail-header-subject headers))))
3024 (defmacro gnus-summary-article-score (&optional number)
3025 "Return current article score."
3026 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3027 gnus-newsgroup-scored))
3028 gnus-summary-default-score 0))
3030 (defun gnus-summary-article-children (&optional number)
3031 "Return a list of article numbers that are children of article NUMBER."
3032 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3033 (level (gnus-data-level (car data)))
3035 (while (and (setq data (cdr data))
3036 (> (setq l (gnus-data-level (car data))) level))
3037 (and (= (1+ level) l)
3038 (push (gnus-data-number (car data))
3040 (nreverse children)))
3042 (defun gnus-summary-article-parent (&optional number)
3043 "Return the article number of the parent of article NUMBER."
3044 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3045 (gnus-data-list t)))
3046 (level (gnus-data-level (car data))))
3048 () ; This is a root.
3049 ;; We search until we find an article with a level less than
3050 ;; this one. That function has to be the parent.
3051 (while (and (setq data (cdr data))
3052 (not (< (gnus-data-level (car data)) level))))
3053 (and data (gnus-data-number (car data))))))
3055 (defun gnus-unread-mark-p (mark)
3056 "Say whether MARK is the unread mark."
3057 (= mark gnus-unread-mark))
3059 (defun gnus-read-mark-p (mark)
3060 "Say whether MARK is one of the marks that mark as read.
3061 This is all marks except unread, ticked, dormant, and expirable."
3062 (not (or (= mark gnus-unread-mark)
3063 (= mark gnus-ticked-mark)
3064 (= mark gnus-spam-mark)
3065 (= mark gnus-dormant-mark)
3066 (= mark gnus-expirable-mark))))
3068 (defmacro gnus-article-mark (number)
3069 "Return the MARK of article NUMBER.
3070 This macro should only be used when computing the mark the \"first\"
3071 time; i.e., when generating the summary lines. After that,
3072 `gnus-summary-article-mark' should be used to examine the
3075 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3076 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3077 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3078 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3079 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3080 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3081 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3082 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3083 gnus-ancient-mark))))
3085 ;; Saving hidden threads.
3087 (defmacro gnus-save-hidden-threads (&rest forms)
3088 "Save hidden threads, eval FORMS, and restore the hidden threads."
3089 (let ((config (make-symbol "config")))
3090 `(let ((,config (gnus-hidden-threads-configuration)))
3094 (gnus-restore-hidden-threads-configuration ,config)))))
3095 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3096 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3098 (defun gnus-data-compute-positions ()
3099 "Compute the positions of all articles."
3100 (setq gnus-newsgroup-data-reverse nil)
3101 (let ((data gnus-newsgroup-data))
3103 (gnus-save-hidden-threads
3104 (gnus-summary-show-all-threads)
3105 (goto-char (point-min))
3107 (while (get-text-property (point) 'gnus-intangible)
3109 (gnus-data-set-pos (car data) (+ (point) 3))
3110 (setq data (cdr data))
3111 (forward-line 1))))))
3113 (defun gnus-hidden-threads-configuration ()
3114 "Return the current hidden threads configuration."
3117 (goto-char (point-min))
3118 (while (search-forward "\r" nil t)
3119 (push (1- (point)) config))
3122 (defun gnus-restore-hidden-threads-configuration (config)
3123 "Restore hidden threads configuration from CONFIG."
3125 (let (point buffer-read-only)
3126 (while (setq point (pop config))
3127 (when (and (< point (point-max))
3129 (eq (char-after) ?\n))
3130 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3132 ;; Various summary mode internalish functions.
3134 (defun gnus-mouse-pick-article (e)
3137 (gnus-summary-next-page nil t))
3139 (defun gnus-summary-set-display-table ()
3140 "Change the display table.
3141 Odd characters have a tendency to mess
3142 up nicely formatted displays - we make all possible glyphs
3143 display only a single character."
3145 ;; We start from the standard display table, if any.
3146 (let ((table (or (copy-sequence standard-display-table)
3147 (make-display-table)))
3149 ;; Nix out all the control chars...
3150 (while (>= (setq i (1- i)) 0)
3151 (aset table i [??]))
3152 ;; ... but not newline and cr, of course. (cr is necessary for the
3153 ;; selective display).
3154 (aset table ?\n nil)
3155 (aset table ?\r nil)
3156 ;; We keep TAB as well.
3157 (aset table ?\t nil)
3158 ;; We nix out any glyphs over 126 that are not set already.
3160 (while (>= (setq i (1- i)) 127)
3161 ;; Only modify if the entry is nil.
3162 (unless (aref table i)
3163 (aset table i [??]))))
3164 (setq buffer-display-table table)))
3166 (defun gnus-summary-set-article-display-arrow (pos)
3167 "Update the overlay arrow to point to line at position POS."
3168 (when (and gnus-summary-display-arrow
3169 (boundp 'overlay-arrow-position)
3170 (boundp 'overlay-arrow-string))
3174 (unless overlay-arrow-position
3175 (setq overlay-arrow-position (make-marker)))
3176 (setq overlay-arrow-string "=>"
3177 overlay-arrow-position (set-marker overlay-arrow-position
3179 (current-buffer))))))
3181 (defun gnus-summary-setup-buffer (group)
3182 "Initialize summary buffer."
3183 (let ((buffer (gnus-summary-buffer-name group))
3184 (dead-name (concat "*Dead Summary "
3185 (gnus-group-decoded-name group) "*")))
3186 ;; If a dead summary buffer exists, we kill it.
3187 (when (gnus-buffer-live-p dead-name)
3188 (gnus-kill-buffer dead-name))
3189 (if (get-buffer buffer)
3192 (setq gnus-summary-buffer (current-buffer))
3193 (not gnus-newsgroup-prepared))
3194 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3195 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3196 (gnus-summary-mode group)
3198 (gnus-carpal-setup-buffer 'summary))
3199 (unless gnus-single-article-buffer
3200 (make-local-variable 'gnus-article-buffer)
3201 (make-local-variable 'gnus-article-current)
3202 (make-local-variable 'gnus-original-article-buffer))
3203 (setq gnus-newsgroup-name group)
3204 ;; Set any local variables in the group parameters.
3205 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3208 (defun gnus-set-global-variables ()
3209 "Set the global equivalents of the buffer-local variables.
3210 They are set to the latest values they had. These reflect the summary
3211 buffer that was in action when the last article was fetched."
3212 (when (eq major-mode 'gnus-summary-mode)
3213 (setq gnus-summary-buffer (current-buffer))
3214 (let ((name gnus-newsgroup-name)
3215 (marked gnus-newsgroup-marked)
3216 (spam gnus-newsgroup-spam-marked)
3217 (unread gnus-newsgroup-unreads)
3218 (headers gnus-current-headers)
3219 (data gnus-newsgroup-data)
3220 (summary gnus-summary-buffer)
3221 (article-buffer gnus-article-buffer)
3222 (original gnus-original-article-buffer)
3223 (gac gnus-article-current)
3224 (reffed gnus-reffed-article-number)
3225 (score-file gnus-current-score-file)
3226 (default-charset gnus-newsgroup-charset)
3228 (let ((locals gnus-newsgroup-variables))
3230 (if (consp (car locals))
3231 (push (eval (caar locals)) vlist)
3232 (push (eval (car locals)) vlist))
3233 (setq locals (cdr locals)))
3234 (setq vlist (nreverse vlist)))
3235 (with-current-buffer gnus-group-buffer
3236 (setq gnus-newsgroup-name name
3237 gnus-newsgroup-marked marked
3238 gnus-newsgroup-spam-marked spam
3239 gnus-newsgroup-unreads unread
3240 gnus-current-headers headers
3241 gnus-newsgroup-data data
3242 gnus-article-current gac
3243 gnus-summary-buffer summary
3244 gnus-article-buffer article-buffer
3245 gnus-original-article-buffer original
3246 gnus-reffed-article-number reffed
3247 gnus-current-score-file score-file
3248 gnus-newsgroup-charset default-charset)
3249 (let ((locals gnus-newsgroup-variables))
3251 (if (consp (car locals))
3252 (set (caar locals) (pop vlist))
3253 (set (car locals) (pop vlist)))
3254 (setq locals (cdr locals))))
3255 ;; The article buffer also has local variables.
3256 (when (gnus-buffer-live-p gnus-article-buffer)
3257 (set-buffer gnus-article-buffer)
3258 (setq gnus-summary-buffer summary))))))
3260 (defun gnus-summary-article-unread-p (article)
3261 "Say whether ARTICLE is unread or not."
3262 (memq article gnus-newsgroup-unreads))
3264 (defun gnus-summary-first-article-p (&optional article)
3265 "Return whether ARTICLE is the first article in the buffer."
3266 (if (not (setq article (or article (gnus-summary-article-number))))
3268 (eq article (caar gnus-newsgroup-data))))
3270 (defun gnus-summary-last-article-p (&optional article)
3271 "Return whether ARTICLE is the last article in the buffer."
3272 (if (not (setq article (or article (gnus-summary-article-number))))
3273 ;; All non-existent numbers are the last article. :-)
3275 (not (cdr (gnus-data-find-list article)))))
3277 (defun gnus-make-thread-indent-array ()
3279 (unless (and gnus-thread-indent-array
3280 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3281 (setq gnus-thread-indent-array (make-vector 201 "")
3282 gnus-thread-indent-array-level gnus-thread-indent-level)
3284 (aset gnus-thread-indent-array n
3285 (make-string (* n gnus-thread-indent-level) ? ))
3288 (defun gnus-update-summary-mark-positions ()
3289 "Compute where the summary marks are to go."
3291 (when (gnus-buffer-exists-p gnus-summary-buffer)
3292 (set-buffer gnus-summary-buffer))
3293 (let ((spec gnus-summary-line-format-spec)
3296 (gnus-set-work-buffer)
3297 (let ((gnus-tmp-unread ?Z)
3298 (gnus-replied-mark ?Z)
3299 (gnus-score-below-mark ?Z)
3300 (gnus-score-over-mark ?Z)
3301 (gnus-undownloaded-mark ?Z)
3302 (gnus-summary-line-format-spec spec)
3303 (gnus-newsgroup-downloadable '(0))
3304 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3305 case-fold-search ignores)
3306 ;; Here, all marks are bound to Z.
3307 (gnus-summary-insert-line header
3308 0 nil t gnus-tmp-unread t nil "" nil 1)
3309 (goto-char (point-min))
3310 ;; Memorize the positions of the same characters as dummy marks.
3311 (while (re-search-forward "[A-D]" nil t)
3312 (push (point) ignores))
3314 ;; We use A-D as dummy marks in order to know column positions
3315 ;; where marks should be inserted.
3316 (setq gnus-tmp-unread ?A
3317 gnus-replied-mark ?B
3318 gnus-score-below-mark ?C
3319 gnus-score-over-mark ?C
3320 gnus-undownloaded-mark ?D)
3321 (gnus-summary-insert-line header
3322 0 nil t gnus-tmp-unread t nil "" nil 1)
3323 ;; Ignore characters which aren't dummy marks.
3325 (delete-region (goto-char (1- p)) p)
3327 (goto-char (point-min))
3328 (setq pos (list (cons 'unread
3329 (and (search-forward "A" nil t)
3330 (- (point) (point-min) 1)))))
3331 (goto-char (point-min))
3332 (push (cons 'replied (and (search-forward "B" nil t)
3333 (- (point) (point-min) 1)))
3335 (goto-char (point-min))
3336 (push (cons 'score (and (search-forward "C" nil t)
3337 (- (point) (point-min) 1)))
3339 (goto-char (point-min))
3340 (push (cons 'download (and (search-forward "D" nil t)
3341 (- (point) (point-min) 1)))
3343 (setq gnus-summary-mark-positions pos))))
3345 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3346 "Insert a dummy root in the summary buffer."
3348 (gnus-add-text-properties
3349 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3350 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3352 (defun gnus-summary-extract-address-component (from)
3353 (or (car (funcall gnus-extract-address-components from))
3356 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3357 (let ((mail-parse-charset gnus-newsgroup-charset)
3358 ; Is it really necessary to do this next part for each summary line?
3359 ; Luckily, doesn't seem to slow things down much.
3360 (mail-parse-ignored-charsets
3361 (with-current-buffer gnus-summary-buffer
3362 gnus-newsgroup-ignored-charsets)))
3364 (and gnus-ignored-from-addresses
3365 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3366 (let ((extra-headers (mail-header-extra header))
3370 ((setq to (cdr (assq 'To extra-headers)))
3373 (gnus-summary-extract-address-component
3374 (funcall gnus-decode-encoded-word-function to)))))
3375 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3376 (concat "=> " newsgroups)))))
3377 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3379 (defun gnus-summary-insert-line (gnus-tmp-header
3380 gnus-tmp-level gnus-tmp-current
3381 undownloaded gnus-tmp-unread gnus-tmp-replied
3382 gnus-tmp-expirable gnus-tmp-subject-or-nil
3383 &optional gnus-tmp-dummy gnus-tmp-score
3385 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3386 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3387 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3388 (gnus-tmp-score-char
3389 (if (or (null gnus-summary-default-score)
3390 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3391 gnus-summary-zcore-fuzz))
3393 (if (< gnus-tmp-score gnus-summary-default-score)
3394 gnus-score-below-mark gnus-score-over-mark)))
3395 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3397 (cond (gnus-tmp-process gnus-process-mark)
3398 ((memq gnus-tmp-current gnus-newsgroup-cached)
3400 (gnus-tmp-replied gnus-replied-mark)
3401 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3402 gnus-forwarded-mark)
3403 ((memq gnus-tmp-current gnus-newsgroup-saved)
3405 ((memq gnus-tmp-number gnus-newsgroup-recent)
3407 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3410 (gnus-tmp-downloaded
3412 gnus-undownloaded-mark)
3413 (gnus-newsgroup-agentized
3414 gnus-downloaded-mark)
3417 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3420 ((string-match "<[^>]+> *$" gnus-tmp-from)
3421 (let ((beg (match-beginning 0)))
3422 (or (and (string-match "^\".+\"" gnus-tmp-from)
3423 (substring gnus-tmp-from 1 (1- (match-end 0))))
3424 (substring gnus-tmp-from 0 beg))))
3425 ((string-match "(.+)" gnus-tmp-from)
3426 (substring gnus-tmp-from
3427 (1+ (match-beginning 0)) (1- (match-end 0))))
3429 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3430 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3431 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3432 (buffer-read-only nil))
3433 (when (string= gnus-tmp-name "")
3434 (setq gnus-tmp-name gnus-tmp-from))
3435 (unless (numberp gnus-tmp-lines)
3436 (setq gnus-tmp-lines -1))
3437 (if (= gnus-tmp-lines -1)
3438 (setq gnus-tmp-lines "?")
3439 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3440 (gnus-put-text-property
3442 (progn (eval gnus-summary-line-format-spec) (point))
3443 'gnus-number gnus-tmp-number)
3444 (when (gnus-visual-p 'summary-highlight 'highlight)
3446 (gnus-run-hooks 'gnus-summary-update-hook)
3449 (defun gnus-summary-update-line (&optional dont-update)
3450 "Update summary line after change."
3451 (when (and gnus-summary-default-score
3452 (not gnus-summary-inhibit-highlight))
3453 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3454 (article (gnus-summary-article-number))
3455 (score (gnus-summary-article-score article)))
3457 (if (and gnus-summary-mark-below
3458 (< (gnus-summary-article-score)
3459 gnus-summary-mark-below))
3460 ;; This article has a low score, so we mark it as read.
3461 (when (memq article gnus-newsgroup-unreads)
3462 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3463 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3464 ;; This article was previously marked as read on account
3465 ;; of a low score, but now it has risen, so we mark it as
3467 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3468 (gnus-summary-update-mark
3469 (if (or (null gnus-summary-default-score)
3470 (<= (abs (- score gnus-summary-default-score))
3471 gnus-summary-zcore-fuzz))
3473 (if (< score gnus-summary-default-score)
3474 gnus-score-below-mark gnus-score-over-mark))
3476 ;; Do visual highlighting.
3477 (when (gnus-visual-p 'summary-highlight 'highlight)
3478 (gnus-run-hooks 'gnus-summary-update-hook)))))
3480 (defvar gnus-tmp-new-adopts nil)
3482 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3483 "Return the number of articles in THREAD.
3484 This may be 0 in some cases -- if none of the articles in
3485 the thread are to be displayed."
3487 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3489 ((not (listp thread))
3491 ((and (consp thread) (cdr thread))
3494 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3497 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3500 (when (and level (zerop level) gnus-tmp-new-adopts)
3503 'gnus-summary-number-of-articles-in-thread
3504 gnus-tmp-new-adopts))))
3506 (if (> number 1) gnus-not-empty-thread-mark
3507 gnus-empty-thread-mark)
3510 (defsubst gnus-summary-line-message-size (head)
3511 "Return pretty-printed version of message size.
3512 This function is intended to be used in
3513 `gnus-summary-line-format-alist'."
3514 (let ((c (or (mail-header-chars head) -1)))
3515 (cond ((< c 0) "n/a") ; chars not available
3516 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3517 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3518 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3519 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3522 (defun gnus-summary-set-local-parameters (group)
3523 "Go through the local params of GROUP and set all variable specs in that list."
3524 (let ((vars '(quit-config))) ; Ignore quit-config.
3525 (dolist (elem (gnus-group-find-parameter group))
3526 (and (consp elem) ; Has to be a cons.
3527 (consp (cdr elem)) ; The cdr has to be a list.
3528 (symbolp (car elem)) ; Has to be a symbol in there.
3529 (not (memq (car elem) vars))
3530 (ignore-errors ; So we set it.
3531 (push (car elem) vars)
3532 (make-local-variable (car elem))
3533 (set (car elem) (eval (nth 1 elem))))))))
3535 (defun gnus-summary-read-group (group &optional show-all no-article
3536 kill-buffer no-display backward
3538 "Start reading news in newsgroup GROUP.
3539 If SHOW-ALL is non-nil, already read articles are also listed.
3540 If NO-ARTICLE is non-nil, no article is selected initially.
3541 If NO-DISPLAY, don't generate a summary buffer."
3545 (let ((gnus-auto-select-next nil))
3546 (or (gnus-summary-read-group-1
3547 group show-all no-article
3548 kill-buffer no-display
3551 select-articles nil)))))
3552 (eq gnus-auto-select-next 'quietly))
3553 (set-buffer gnus-group-buffer)
3554 ;; The entry function called above goes to the next
3555 ;; group automatically, so we go two groups back
3556 ;; if we are searching for the previous group.
3558 (gnus-group-prev-unread-group 2))
3559 (if (not (equal group (gnus-group-group-name)))
3560 (setq group (gnus-group-group-name))
3564 (defun gnus-summary-read-group-1 (group show-all no-article
3565 kill-buffer no-display
3566 &optional select-articles)
3567 ;; Killed foreign groups can't be entered.
3568 ;; (when (and (not (gnus-group-native-p group))
3569 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3570 ;; (error "Dead non-native groups can't be entered"))
3571 (gnus-message 5 "Retrieving newsgroup: %s..."
3572 (gnus-group-decoded-name group))
3573 (let* ((new-group (gnus-summary-setup-buffer group))
3574 (quit-config (gnus-group-quit-config group))
3575 (did-select (and new-group (gnus-select-newsgroup
3576 group show-all select-articles))))
3578 ;; This summary buffer exists already, so we just select it.
3580 (gnus-set-global-variables)
3582 (gnus-kill-or-deaden-summary kill-buffer))
3583 (gnus-configure-windows 'summary 'force)
3584 (gnus-set-mode-line 'summary)
3585 (gnus-summary-position-point)
3588 ;; We couldn't select this group.
3590 (when (and (eq major-mode 'gnus-summary-mode)
3591 (not (equal (current-buffer) kill-buffer)))
3592 (kill-buffer (current-buffer))
3593 (if (not quit-config)
3595 ;; Update the info -- marks might need to be removed,
3597 (gnus-summary-update-info)
3598 (set-buffer gnus-group-buffer)
3599 (gnus-group-jump-to-group group)
3600 (gnus-group-next-unread-group 1))
3601 (gnus-handle-ephemeral-exit quit-config)))
3602 (let ((grpinfo (gnus-get-info group)))
3603 (if (null (gnus-info-read grpinfo))
3604 (gnus-message 3 "Group %s contains no messages"
3605 (gnus-group-decoded-name group))
3606 (gnus-message 3 "Can't select group")))
3608 ;; The user did a `C-g' while prompting for number of articles,
3609 ;; so we exit this group.
3610 ((eq did-select 'quit)
3611 (and (eq major-mode 'gnus-summary-mode)
3612 (not (equal (current-buffer) kill-buffer))
3613 (kill-buffer (current-buffer)))
3615 (gnus-kill-or-deaden-summary kill-buffer))
3616 (if (not quit-config)
3618 (set-buffer gnus-group-buffer)
3619 (gnus-group-jump-to-group group)
3620 (gnus-group-next-unread-group 1)
3621 (gnus-configure-windows 'group 'force))
3622 (gnus-handle-ephemeral-exit quit-config))
3623 ;; Finally signal the quit.
3625 ;; The group was successfully selected.
3627 (gnus-set-global-variables)
3628 ;; Save the active value in effect when the group was entered.
3629 (setq gnus-newsgroup-active
3631 (gnus-active gnus-newsgroup-name)))
3632 ;; You can change the summary buffer in some way with this hook.
3633 (gnus-run-hooks 'gnus-select-group-hook)
3634 (when (memq 'summary (gnus-update-format-specifications
3635 nil 'summary 'summary-mode 'summary-dummy))
3636 ;; The format specification for the summary line was updated,
3637 ;; so we need to update the mark positions as well.
3638 (gnus-update-summary-mark-positions))
3639 ;; Do score processing.
3640 (when gnus-use-scoring
3641 (gnus-possibly-score-headers))
3642 ;; Check whether to fill in the gaps in the threads.
3643 (when gnus-build-sparse-threads
3644 (gnus-build-sparse-threads))
3645 ;; Find the initial limit.
3647 (let ((gnus-newsgroup-dormant nil))
3648 (gnus-summary-initial-limit show-all))
3649 (gnus-summary-initial-limit show-all))
3650 ;; Generate the summary buffer.
3652 (gnus-summary-prepare))
3653 (when gnus-use-trees
3654 (gnus-tree-open group)
3655 (setq gnus-summary-highlight-line-function
3656 'gnus-tree-highlight-article))
3657 ;; If the summary buffer is empty, but there are some low-scored
3658 ;; articles or some excluded dormants, we include these in the
3660 (when (and (zerop (buffer-size))
3662 (cond (gnus-newsgroup-dormant
3663 (gnus-summary-limit-include-dormant))
3664 ((and gnus-newsgroup-scored show-all)
3665 (gnus-summary-limit-include-expunged t))))
3666 ;; Function `gnus-apply-kill-file' must be called in this hook.
3667 (gnus-run-hooks 'gnus-apply-kill-hook)
3668 (if (and (zerop (buffer-size))
3671 ;; This newsgroup is empty.
3672 (gnus-summary-catchup-and-exit nil t)
3673 (gnus-message 6 "No unread news")
3675 (gnus-kill-or-deaden-summary kill-buffer))
3676 ;; Return nil from this function.
3678 ;; Hide conversation thread subtrees. We cannot do this in
3679 ;; gnus-summary-prepare-hook since kill processing may not
3680 ;; work with hidden articles.
3681 (gnus-summary-maybe-hide-threads)
3683 (gnus-kill-or-deaden-summary kill-buffer))
3684 (gnus-summary-auto-select-subject)
3685 ;; Show first unread article if requested.
3686 (if (and (not no-article)
3688 gnus-newsgroup-unreads
3689 gnus-auto-select-first)
3691 (gnus-configure-windows 'summary)
3692 (let ((art (gnus-summary-article-number)))
3693 (unless (and (not gnus-plugged)
3694 (or (memq art gnus-newsgroup-undownloaded)
3695 (memq art gnus-newsgroup-downloadable)))
3696 (gnus-summary-goto-article art))))
3697 ;; Don't select any articles.
3698 (gnus-summary-position-point)
3699 (gnus-configure-windows 'summary 'force)
3700 (gnus-set-mode-line 'summary))
3701 (when (and gnus-auto-center-group
3702 (get-buffer-window gnus-group-buffer t))
3703 ;; Gotta use windows, because recenter does weird stuff if
3704 ;; the current buffer ain't the displayed window.
3705 (let ((owin (selected-window)))
3706 (select-window (get-buffer-window gnus-group-buffer t))
3707 (when (gnus-group-goto-group group)
3709 (select-window owin)))
3710 ;; Mark this buffer as "prepared".
3711 (setq gnus-newsgroup-prepared t)
3712 (gnus-run-hooks 'gnus-summary-prepared-hook)
3713 (unless (gnus-ephemeral-group-p group)
3714 (gnus-group-update-group group))
3717 (defun gnus-summary-auto-select-subject ()
3718 "Select the subject line on initial group entry."
3719 (goto-char (point-min))
3721 ((eq gnus-auto-select-subject 'best)
3722 (gnus-summary-best-unread-subject))
3723 ((eq gnus-auto-select-subject 'unread)
3724 (gnus-summary-first-unread-subject))
3725 ((eq gnus-auto-select-subject 'unseen)
3726 (gnus-summary-first-unseen-subject))
3727 ((eq gnus-auto-select-subject 'unseen-or-unread)
3728 (gnus-summary-first-unseen-or-unread-subject))
3729 ((eq gnus-auto-select-subject 'first)
3732 ((functionp gnus-auto-select-subject)
3733 (funcall gnus-auto-select-subject))))
3735 (defun gnus-summary-prepare ()
3736 "Generate the summary buffer."
3738 (let ((buffer-read-only nil))
3740 (setq gnus-newsgroup-data nil
3741 gnus-newsgroup-data-reverse nil)
3742 (gnus-run-hooks 'gnus-summary-generate-hook)
3743 ;; Generate the buffer, either with threads or without.
3744 (when gnus-newsgroup-headers
3745 (gnus-summary-prepare-threads
3746 (if gnus-show-threads
3747 (gnus-sort-gathered-threads
3748 (funcall gnus-summary-thread-gathering-function
3750 (gnus-cut-threads (gnus-make-threads)))))
3751 ;; Unthreaded display.
3752 (gnus-sort-articles gnus-newsgroup-headers))))
3753 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3754 ;; Call hooks for modifying summary buffer.
3755 (goto-char (point-min))
3756 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3758 (defsubst gnus-general-simplify-subject (subject)
3759 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3762 ;; Truncate the subject.
3763 (gnus-simplify-subject-functions
3764 (gnus-map-function gnus-simplify-subject-functions subject))
3765 ((numberp gnus-summary-gather-subject-limit)
3766 (setq subject (gnus-simplify-subject-re subject))
3767 (if (> (length subject) gnus-summary-gather-subject-limit)
3768 (substring subject 0 gnus-summary-gather-subject-limit)
3770 ;; Fuzzily simplify it.
3771 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3772 (gnus-simplify-subject-fuzzy subject))
3773 ;; Just remove the leading "Re:".
3775 (gnus-simplify-subject-re subject))))
3777 (if (and gnus-summary-gather-exclude-subject
3778 (string-match gnus-summary-gather-exclude-subject subject))
3779 nil ; This article shouldn't be gathered
3782 (defun gnus-summary-simplify-subject-query ()
3783 "Query where the respool algorithm would put this article."
3785 (gnus-summary-select-article)
3786 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3788 (defun gnus-gather-threads-by-subject (threads)
3789 "Gather threads by looking at Subject headers."
3790 (if (not gnus-summary-make-false-root)
3792 (let ((hashtb (gnus-make-hashtable 1024))
3795 subject hthread whole-subject)
3797 (setq subject (gnus-general-simplify-subject
3798 (setq whole-subject (mail-header-subject
3801 (if (setq hthread (gnus-gethash subject hashtb))
3803 ;; We enter a dummy root into the thread, if we
3804 ;; haven't done that already.
3805 (unless (stringp (caar hthread))
3806 (setcar hthread (list whole-subject (car hthread))))
3807 ;; We add this new gathered thread to this gathered
3809 (setcdr (car hthread)
3810 (nconc (cdar hthread) (list (car threads))))
3811 ;; Remove it from the list of threads.
3812 (setcdr prev (cdr threads))
3813 (setq threads prev))
3814 ;; Enter this thread into the hash table.
3815 (gnus-sethash subject
3816 (if gnus-summary-make-false-root-always
3818 ;; If you want a dummy root above all
3820 (setcar threads (list whole-subject
3826 (setq threads (cdr threads)))
3829 (defun gnus-gather-threads-by-references (threads)
3830 "Gather threads by looking at References headers."
3831 (let ((idhashtb (gnus-make-hashtable 1024))
3832 (thhashtb (gnus-make-hashtable 1024))
3835 ids references id gthread gid entered ref)
3837 (when (setq references (mail-header-references (caar threads)))
3838 (setq id (mail-header-id (caar threads))
3839 ids (inline (gnus-split-references references))
3841 (while (setq ref (pop ids))
3842 (setq ids (delete ref ids))
3843 (if (not (setq gid (gnus-gethash ref idhashtb)))
3845 (gnus-sethash ref id idhashtb)
3846 (gnus-sethash id threads thhashtb))
3847 (setq gthread (gnus-gethash gid thhashtb))
3849 ;; We enter a dummy root into the thread, if we
3850 ;; haven't done that already.
3851 (unless (stringp (caar gthread))
3852 (setcar gthread (list (mail-header-subject (caar gthread))
3854 ;; We add this new gathered thread to this gathered
3856 (setcdr (car gthread)
3857 (nconc (cdar gthread) (list (car threads)))))
3858 ;; Add it into the thread hash table.
3859 (gnus-sethash id gthread thhashtb)
3861 ;; Remove it from the list of threads.
3862 (setcdr prev (cdr threads))
3863 (setq threads prev))))
3865 (setq threads (cdr threads)))
3868 (defun gnus-sort-gathered-threads (threads)
3869 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3870 (let ((result threads))
3872 (when (stringp (caar threads))
3873 (setcdr (car threads)
3874 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3875 (setq threads (cdr threads)))
3878 (defun gnus-thread-loop-p (root thread)
3879 "Say whether ROOT is in THREAD."
3880 (let ((stack (list thread))
3883 (while (setq thread (pop stack))
3884 (setq th (cdr thread))
3886 (not (eq (caar th) root)))
3889 ;; We have found a loop.
3891 (setcdr thread (delq (car th) (cdr thread)))
3892 (if (boundp (setq ref-dep (intern "none"
3893 gnus-newsgroup-dependencies)))
3894 (setcdr (symbol-value ref-dep)
3895 (nconc (cdr (symbol-value ref-dep))
3897 (set ref-dep (list nil (car th))))
3900 ;; Push all the subthreads onto the stack.
3901 (push (cdr thread) stack)))
3904 (defun gnus-make-threads ()
3905 "Go through the dependency hashtb and find the roots. Return all threads."
3907 (while (catch 'infloop
3910 ;; Deal with self-referencing References loops.
3911 (when (and (car (symbol-value refs))
3918 (car (symbol-value refs)) thread))
3919 (cdr (symbol-value refs)))))))
3922 (unless (car (symbol-value refs))
3923 ;; These threads do not refer back to any other
3924 ;; articles, so they're roots.
3925 (setq threads (append (cdr (symbol-value refs)) threads))))
3926 gnus-newsgroup-dependencies)))
3929 ;; Build the thread tree.
3930 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3931 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3933 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3934 if it was already present.
3936 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3937 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3938 Message-IDs will be renamed to a unique Message-ID before being
3941 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3942 (let* ((id (mail-header-id header))
3943 (id-dep (and id (intern id dependencies)))
3944 parent-id ref ref-dep ref-header replaced)
3945 ;; Enter this `header' in the `dependencies' table.
3949 ;; The first two cases do the normal part: enter a new `header'
3950 ;; in the `dependencies' table.
3951 ((not (boundp id-dep))
3952 (set id-dep (list header)))
3953 ((null (car (symbol-value id-dep)))
3954 (setcar (symbol-value id-dep) header))
3956 ;; From here the `header' was already present in the
3957 ;; `dependencies' table.
3959 ;; Overrides an existing entry;
3960 ;; just set the header part of the entry.
3961 (setcar (symbol-value id-dep) header)
3964 ;; Renames the existing `header' to a unique Message-ID.
3965 ((not gnus-summary-ignore-duplicates)
3966 ;; An article with this Message-ID has already been seen.
3967 ;; We rename the Message-ID.
3968 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3970 (mail-header-set-id header id))
3972 ;; The last case ignores an existing entry, except it adds any
3973 ;; additional Xrefs (in case the two articles came from different
3975 ;; Also sets `header' to `nil' meaning that the `dependencies'
3976 ;; table was *not* modified.
3978 (mail-header-set-xref
3979 (car (symbol-value id-dep))
3980 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3982 (or (mail-header-xref header) "")))
3985 (when (and header (not replaced))
3986 ;; First check that we are not creating a References loop.
3987 (setq parent-id (gnus-parent-id (mail-header-references header)))
3988 (setq ref parent-id)
3990 (setq ref-dep (intern-soft ref dependencies))
3992 (setq ref-header (car (symbol-value ref-dep))))
3993 (if (string= id ref)
3994 ;; Yuk! This is a reference loop. Make the article be a
3997 (mail-header-set-references (car (symbol-value id-dep)) "none")
3999 (setq parent-id nil))
4000 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4001 (setq ref-dep (intern (or parent-id "none") dependencies))
4002 (if (boundp ref-dep)
4003 (setcdr (symbol-value ref-dep)
4004 (nconc (cdr (symbol-value ref-dep))
4005 (list (symbol-value id-dep))))
4006 (set ref-dep (list nil (symbol-value id-dep)))))
4009 (defun gnus-extract-message-id-from-in-reply-to (string)
4010 (if (string-match "<[^>]+>" string)
4011 (substring string (match-beginning 0) (match-end 0))
4014 (defun gnus-build-sparse-threads ()
4015 (let ((headers gnus-newsgroup-headers)
4016 (mail-parse-charset gnus-newsgroup-charset)
4017 (gnus-summary-ignore-duplicates t)
4018 header references generation relations
4019 subject child end new-child date)
4020 ;; First we create an alist of generations/relations, where
4021 ;; generations is how much we trust the relation, and the relation
4023 (gnus-message 7 "Making sparse threads...")
4025 (nnheader-set-temp-buffer " *gnus sparse threads*")
4026 (while (setq header (pop headers))
4027 (when (and (setq references (mail-header-references header))
4028 (not (string= references "")))
4030 (setq child (mail-header-id header)
4031 subject (mail-header-subject header)
4032 date (mail-header-date header)
4034 (while (search-backward ">" nil t)
4035 (setq end (1+ (point)))
4036 (when (search-backward "<" nil t)
4037 (setq new-child (buffer-substring (point) end))
4038 (push (list (incf generation)
4039 child (setq child new-child)
4043 (push (list (1+ generation) child nil subject) relations))
4045 (kill-buffer (current-buffer)))
4046 ;; Sort over trustworthiness.
4049 (when (gnus-dependencies-add-header
4050 (make-full-mail-header
4051 gnus-reffed-article-number
4052 (nth 3 relation) "" (or (nth 4 relation) "")
4054 (or (nth 2 relation) "") 0 0 "")
4055 gnus-newsgroup-dependencies nil)
4056 (push gnus-reffed-article-number gnus-newsgroup-limit)
4057 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4058 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4059 gnus-newsgroup-reads)
4060 (decf gnus-reffed-article-number)))
4061 (sort relations 'car-less-than-car))
4062 (gnus-message 7 "Making sparse threads...done")))
4064 (defun gnus-build-old-threads ()
4065 ;; Look at all the articles that refer back to old articles, and
4066 ;; fetch the headers for the articles that aren't there. This will
4067 ;; build complete threads - if the roots haven't been expired by the
4069 (let ((mail-parse-charset gnus-newsgroup-charset)
4073 (when (not (car (symbol-value refs)))
4074 (setq heads (cdr (symbol-value refs)))
4076 (if (memq (mail-header-number (caar heads))
4077 gnus-newsgroup-dormant)
4078 (setq heads (cdr heads))
4079 (setq id (symbol-name refs))
4080 (while (and (setq id (gnus-build-get-header id))
4081 (not (car (gnus-id-to-thread id)))))
4082 (setq heads nil)))))
4083 gnus-newsgroup-dependencies)))
4085 (defsubst gnus-remove-odd-characters (string)
4086 "Translate STRING into something that doesn't contain weird characters."
4087 (mm-subst-char-in-string
4089 (mm-subst-char-in-string ?\n ?\- string t) t))
4091 ;; This function has to be called with point after the article number
4092 ;; on the beginning of the line.
4093 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4094 (let ((eol (point-at-eol))
4095 (buffer (current-buffer))
4096 header references in-reply-to)
4098 ;; overview: [num subject from date id refs chars lines misc]
4101 (narrow-to-region (point) eol)
4106 (make-full-mail-header
4108 (condition-case () ; subject
4109 (gnus-remove-odd-characters
4110 (funcall gnus-decode-encoded-word-function
4111 (setq x (nnheader-nov-field))))
4113 (condition-case () ; from
4114 (gnus-remove-odd-characters
4115 (funcall gnus-decode-encoded-word-function
4116 (setq x (nnheader-nov-field))))
4118 (nnheader-nov-field) ; date
4119 (nnheader-nov-read-message-id number) ; id
4120 (setq references (nnheader-nov-field)) ; refs
4121 (nnheader-nov-read-integer) ; chars
4122 (nnheader-nov-read-integer) ; lines
4124 (if (looking-at "Xref: ")
4125 (goto-char (match-end 0)))
4126 (nnheader-nov-field)) ; Xref
4127 (nnheader-nov-parse-extra)))) ; extra
4131 (when (and (string= references "")
4132 (setq in-reply-to (mail-header-extra header))
4133 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4134 (mail-header-set-references
4135 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4137 (when gnus-alter-header-function
4138 (funcall gnus-alter-header-function header))
4139 (gnus-dependencies-add-header header dependencies force-new)))
4141 (defun gnus-build-get-header (id)
4142 "Look through the buffer of NOV lines and find the header to ID.
4143 Enter this line into the dependencies hash table, and return
4144 the id of the parent article (if any)."
4145 (let ((deps gnus-newsgroup-dependencies)
4149 (set-buffer nntp-server-buffer)
4150 (let ((case-fold-search nil))
4151 (goto-char (point-min))
4152 (while (and (not found)
4153 (search-forward id nil t))
4155 (setq found (looking-at
4156 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4157 (regexp-quote id))))
4158 (or found (beginning-of-line 2)))
4162 (setq header (gnus-nov-parse-line
4163 (read (current-buffer)) deps))
4164 (gnus-parent-id (mail-header-references header))))))
4166 (let ((number (mail-header-number header)))
4167 (push number gnus-newsgroup-limit)
4168 (push header gnus-newsgroup-headers)
4169 (if (memq number gnus-newsgroup-unselected)
4171 (setq gnus-newsgroup-unreads
4172 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4174 (setq gnus-newsgroup-unselected
4175 (delq number gnus-newsgroup-unselected)))
4176 (push number gnus-newsgroup-ancient)))))))
4178 (defun gnus-build-all-threads ()
4179 "Read all the headers."
4180 (let ((gnus-summary-ignore-duplicates t)
4181 (mail-parse-charset gnus-newsgroup-charset)
4182 (dependencies gnus-newsgroup-dependencies)
4185 (set-buffer nntp-server-buffer)
4186 (let ((case-fold-search nil))
4187 (goto-char (point-min))
4190 (setq article (read (current-buffer))
4191 header (gnus-nov-parse-line article dependencies)))
4193 (with-current-buffer gnus-summary-buffer
4194 (push header gnus-newsgroup-headers)
4195 (if (memq (setq article (mail-header-number header))
4196 gnus-newsgroup-unselected)
4198 (setq gnus-newsgroup-unreads
4199 (gnus-add-to-sorted-list
4200 gnus-newsgroup-unreads article))
4201 (setq gnus-newsgroup-unselected
4202 (delq article gnus-newsgroup-unselected)))
4203 (push article gnus-newsgroup-ancient)))
4204 (forward-line 1)))))))
4206 (defun gnus-summary-update-article-line (article header)
4207 "Update the line for ARTICLE using HEADER."
4208 (let* ((id (mail-header-id header))
4209 (thread (gnus-id-to-thread id)))
4211 (error "Article in no thread"))
4212 ;; Update the thread.
4213 (setcar thread header)
4214 (gnus-summary-goto-subject article)
4215 (let* ((datal (gnus-data-find-list article))
4217 (buffer-read-only nil)
4218 (level (gnus-summary-thread-level)))
4220 (let ((inserted (- (point)
4222 (gnus-summary-insert-line
4224 (memq article gnus-newsgroup-undownloaded)
4225 (gnus-article-mark article)
4226 (memq article gnus-newsgroup-replied)
4227 (memq article gnus-newsgroup-expirable)
4228 ;; Only insert the Subject string when it's different
4229 ;; from the previous Subject string.
4234 (mail-header-subject
4237 (gnus-data-find-list
4239 (gnus-data-list t)))))
4240 ;; Error on the side of excessive subjects.
4242 (mail-header-subject header)))
4244 (mail-header-subject header))
4245 nil (cdr (assq article gnus-newsgroup-scored))
4246 (memq article gnus-newsgroup-processable))
4249 (gnus-data-update-list
4251 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4253 (defun gnus-summary-update-article (article &optional iheader)
4254 "Update ARTICLE in the summary buffer."
4255 (set-buffer gnus-summary-buffer)
4256 (let* ((header (gnus-summary-article-header article))
4257 (id (mail-header-id header))
4258 (data (gnus-data-find article))
4259 (thread (gnus-id-to-thread id))
4260 (references (mail-header-references header))
4264 (when (and references
4265 (not (equal "" references)))
4268 (buffer-read-only nil)
4274 (delq thread parent)))
4275 (if (gnus-summary-insert-subject id header)
4276 ;; Set the (possibly) new article number in the data structure.
4277 (gnus-data-set-number data (gnus-id-to-article id))
4281 (defun gnus-rebuild-thread (id &optional line)
4282 "Rebuild the thread containing ID.
4283 If LINE, insert the rebuilt thread starting on line LINE."
4284 (let ((buffer-read-only nil)
4285 old-pos current thread data)
4286 (if (not gnus-show-threads)
4287 (setq thread (list (car (gnus-id-to-thread id))))
4288 ;; Get the thread this article is part of.
4289 (setq thread (gnus-remove-thread id)))
4290 (setq old-pos (point-at-bol))
4291 (setq current (save-excursion
4292 (and (re-search-backward "[\r\n]" nil t)
4293 (gnus-summary-article-number))))
4294 ;; If this is a gathered thread, we have to go some re-gathering.
4295 (when (stringp (car thread))
4296 (let ((subject (car thread))
4298 (setq thread (cdr thread))
4300 (unless (memq (setq thr (gnus-id-to-thread
4302 (mail-header-id (caar thread)))))
4305 (setq thread (cdr thread)))
4306 ;; We now have all (unique) roots.
4307 (if (= (length roots) 1)
4308 ;; All the loose roots are now one solid root.
4309 (setq thread (car roots))
4310 (setq thread (cons subject (gnus-sort-threads roots))))))
4312 ;; We then insert this thread into the summary buffer.
4314 (goto-char (point-min))
4315 (forward-line (1- line)))
4316 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4317 (if gnus-show-threads
4318 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4319 (gnus-summary-prepare-unthreaded thread))
4320 (setq data (nreverse gnus-newsgroup-data))
4321 (setq threads gnus-newsgroup-threads))
4322 ;; We splice the new data into the data structure.
4323 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4324 ;;!!! then we want to insert at the beginning of the buffer.
4325 ;;!!! That happens to be true with Gnus now, but that may
4326 ;;!!! change in the future. Perhaps.
4327 (gnus-data-enter-list
4328 (if line nil current) data (- (point) old-pos))
4329 (setq gnus-newsgroup-threads
4330 (nconc threads gnus-newsgroup-threads))
4331 (gnus-data-compute-positions))))
4333 (defun gnus-number-to-header (number)
4334 "Return the header for article NUMBER."
4335 (let ((headers gnus-newsgroup-headers))
4337 (not (= number (mail-header-number (car headers)))))
4342 (defun gnus-parent-headers (in-headers &optional generation)
4343 "Return the headers of the GENERATIONeth parent of HEADERS."
4345 (setq generation 1))
4347 (headers in-headers)
4350 (not (zerop generation))
4351 (setq references (mail-header-references headers)))
4352 (setq headers (if (and references
4353 (setq parent (gnus-parent-id references)))
4354 (car (gnus-id-to-thread parent))
4357 (and (not (eq headers in-headers))
4360 (defun gnus-id-to-thread (id)
4361 "Return the (sub-)thread where ID appears."
4362 (gnus-gethash id gnus-newsgroup-dependencies))
4364 (defun gnus-id-to-article (id)
4365 "Return the article number of ID."
4366 (let ((thread (gnus-id-to-thread id)))
4369 (mail-header-number (car thread)))))
4371 (defun gnus-id-to-header (id)
4372 "Return the article headers of ID."
4373 (car (gnus-id-to-thread id)))
4375 (defun gnus-article-displayed-root-p (article)
4376 "Say whether ARTICLE is a root(ish) article."
4377 (let ((level (gnus-summary-thread-level article))
4378 (refs (mail-header-references (gnus-summary-article-header article)))
4384 ((null (gnus-parent-id refs)) t)
4386 (null (setq particle (gnus-id-to-article
4387 (gnus-parent-id refs))))
4388 (null (gnus-summary-thread-level particle)))))))
4390 (defun gnus-root-id (id)
4391 "Return the id of the root of the thread where ID appears."
4393 (while (and id (setq prev (car (gnus-id-to-thread id))))
4395 id (gnus-parent-id (mail-header-references prev))))
4398 (defun gnus-articles-in-thread (thread)
4399 "Return the list of articles in THREAD."
4400 (cons (mail-header-number (car thread))
4401 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4403 (defun gnus-remove-thread (id &optional dont-remove)
4404 "Remove the thread that has ID in it."
4405 (let (headers thread last-id)
4406 ;; First go up in this thread until we find the root.
4407 (setq last-id (gnus-root-id id)
4408 headers (message-flatten-list (gnus-id-to-thread last-id)))
4409 ;; We have now found the real root of this thread. It might have
4410 ;; been gathered into some loose thread, so we have to search
4411 ;; through the threads to find the thread we wanted.
4412 (let ((threads gnus-newsgroup-threads)
4415 (setq sub (car threads))
4416 (if (stringp (car sub))
4417 ;; This is a gathered thread, so we look at the roots
4418 ;; below it to find whether this article is in this
4421 (setq sub (cdr sub))
4423 (when (member (caar sub) headers)
4424 (setq thread (car threads)
4427 (setq sub (cdr sub))))
4428 ;; It's an ordinary thread, so we check it.
4429 (when (eq (car sub) (car headers))
4432 (setq threads (cdr threads)))
4433 ;; If this article is in no thread, then it's a root.
4436 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4437 (setq thread (gnus-id-to-thread last-id)))
4440 thread ; We return this thread.
4442 (if (stringp (car thread))
4444 ;; If we use dummy roots, then we have to remove the
4445 ;; dummy root as well.
4446 (when (eq gnus-summary-make-false-root 'dummy)
4447 ;; We go to the dummy root by going to
4448 ;; the first sub-"thread", and then one line up.
4449 (gnus-summary-goto-article
4450 (mail-header-number (caadr thread)))
4453 (gnus-data-compute-positions))
4454 (setq thread (cdr thread))
4456 (gnus-remove-thread-1 (car thread))
4457 (setq thread (cdr thread))))
4458 (gnus-remove-thread-1 thread))))))))
4460 (defun gnus-remove-thread-1 (thread)
4461 "Remove the thread THREAD recursively."
4462 (let ((number (mail-header-number (pop thread)))
4464 (setq thread (reverse thread))
4466 (gnus-remove-thread-1 (pop thread)))
4467 (when (setq d (gnus-data-find number))
4468 (goto-char (gnus-data-pos d))
4469 (gnus-summary-show-thread)
4475 (gnus-delete-line)))))))
4477 (defun gnus-sort-threads-1 (threads func)
4478 (sort (mapcar (lambda (thread)
4481 (gnus-sort-threads-1 (cdr thread) func))))
4484 (defun gnus-sort-threads (threads)
4486 (if (not gnus-thread-sort-functions)
4488 (gnus-message 8 "Sorting threads...")
4489 (let ((max-lisp-eval-depth 5000))
4490 (prog1 (gnus-sort-threads-1
4492 (gnus-make-sort-function gnus-thread-sort-functions))
4493 (gnus-message 8 "Sorting threads...done")))))
4495 (defun gnus-sort-articles (articles)
4497 (when gnus-article-sort-functions
4498 (gnus-message 7 "Sorting articles...")
4500 (setq gnus-newsgroup-headers
4501 (sort articles (gnus-make-sort-function
4502 gnus-article-sort-functions)))
4503 (gnus-message 7 "Sorting articles...done"))))
4505 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4506 (defmacro gnus-thread-header (thread)
4507 "Return header of first article in THREAD.
4508 Note that THREAD must never, ever be anything else than a variable -
4509 using some other form will lead to serious barfage."
4510 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4511 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4512 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4515 (defsubst gnus-article-sort-by-number (h1 h2)
4516 "Sort articles by article number."
4517 (< (mail-header-number h1)
4518 (mail-header-number h2)))
4520 (defun gnus-thread-sort-by-number (h1 h2)
4521 "Sort threads by root article number."
4522 (gnus-article-sort-by-number
4523 (gnus-thread-header h1) (gnus-thread-header h2)))
4525 (defsubst gnus-article-sort-by-random (h1 h2)
4526 "Sort articles by article number."
4529 (defun gnus-thread-sort-by-random (h1 h2)
4530 "Sort threads by root article number."
4531 (gnus-article-sort-by-random
4532 (gnus-thread-header h1) (gnus-thread-header h2)))
4534 (defsubst gnus-article-sort-by-lines (h1 h2)
4535 "Sort articles by article Lines header."
4536 (< (mail-header-lines h1)
4537 (mail-header-lines h2)))
4539 (defun gnus-thread-sort-by-lines (h1 h2)
4540 "Sort threads by root article Lines header."
4541 (gnus-article-sort-by-lines
4542 (gnus-thread-header h1) (gnus-thread-header h2)))
4544 (defsubst gnus-article-sort-by-chars (h1 h2)
4545 "Sort articles by octet length."
4546 (< (mail-header-chars h1)
4547 (mail-header-chars h2)))
4549 (defun gnus-thread-sort-by-chars (h1 h2)
4550 "Sort threads by root article octet length."
4551 (gnus-article-sort-by-chars
4552 (gnus-thread-header h1) (gnus-thread-header h2)))
4554 (defsubst gnus-article-sort-by-author (h1 h2)
4555 "Sort articles by root author."
4557 (let ((extract (funcall
4558 gnus-extract-address-components
4559 (mail-header-from h1))))
4560 (or (car extract) (cadr extract) ""))
4561 (let ((extract (funcall
4562 gnus-extract-address-components
4563 (mail-header-from h2))))
4564 (or (car extract) (cadr extract) ""))))
4566 (defun gnus-thread-sort-by-author (h1 h2)
4567 "Sort threads by root author."
4568 (gnus-article-sort-by-author
4569 (gnus-thread-header h1) (gnus-thread-header h2)))
4571 (defsubst gnus-article-sort-by-subject (h1 h2)
4572 "Sort articles by root subject."
4574 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4575 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4577 (defun gnus-thread-sort-by-subject (h1 h2)
4578 "Sort threads by root subject."
4579 (gnus-article-sort-by-subject
4580 (gnus-thread-header h1) (gnus-thread-header h2)))
4582 (defsubst gnus-article-sort-by-date (h1 h2)
4583 "Sort articles by root article date."
4585 (gnus-date-get-time (mail-header-date h1))
4586 (gnus-date-get-time (mail-header-date h2))))
4588 (defun gnus-thread-sort-by-date (h1 h2)
4589 "Sort threads by root article date."
4590 (gnus-article-sort-by-date
4591 (gnus-thread-header h1) (gnus-thread-header h2)))
4593 (defsubst gnus-article-sort-by-score (h1 h2)
4594 "Sort articles by root article score.
4595 Unscored articles will be counted as having a score of zero."
4596 (> (or (cdr (assq (mail-header-number h1)
4597 gnus-newsgroup-scored))
4598 gnus-summary-default-score 0)
4599 (or (cdr (assq (mail-header-number h2)
4600 gnus-newsgroup-scored))
4601 gnus-summary-default-score 0)))
4603 (defun gnus-thread-sort-by-score (h1 h2)
4604 "Sort threads by root article score."
4605 (gnus-article-sort-by-score
4606 (gnus-thread-header h1) (gnus-thread-header h2)))
4608 (defun gnus-thread-sort-by-total-score (h1 h2)
4609 "Sort threads by the sum of all scores in the thread.
4610 Unscored articles will be counted as having a score of zero."
4611 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4613 (defun gnus-thread-total-score (thread)
4614 ;; This function find the total score of THREAD.
4619 (if (stringp (car thread))
4620 (apply gnus-thread-score-function 0
4621 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4622 (gnus-thread-total-score-1 thread)))
4624 (gnus-thread-total-score-1 (list thread)))))
4626 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4627 "Sort threads such that the thread with the most recently arrived article comes first."
4628 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4630 (defun gnus-thread-highest-number (thread)
4631 "Return the highest article number in THREAD."
4632 (apply 'max (mapcar (lambda (header)
4633 (mail-header-number header))
4634 (message-flatten-list thread))))
4636 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4637 "Sort threads such that the thread with the most recently dated article comes first."
4638 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4640 (defun gnus-thread-latest-date (thread)
4641 "Return the highest article date in THREAD."
4642 (let ((previous-time 0))
4648 (time-to-seconds (mail-header-parse-date
4649 (mail-header-date header)))
4650 (error previous-time))))
4652 (message-flatten-list thread)
4654 (< (mail-header-number h1)
4655 (mail-header-number h2))))))))
4657 (defun gnus-thread-total-score-1 (root)
4658 ;; This function find the total score of the thread below ROOT.
4659 (setq root (car root))
4660 (apply gnus-thread-score-function
4662 (mapcar 'gnus-thread-total-score
4663 (cdr (gnus-id-to-thread (mail-header-id root))))
4664 (when (> (mail-header-number root) 0)
4665 (list (or (cdr (assq (mail-header-number root)
4666 gnus-newsgroup-scored))
4667 gnus-summary-default-score 0))))
4668 (list gnus-summary-default-score)
4671 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4672 (defvar gnus-tmp-prev-subject nil)
4673 (defvar gnus-tmp-false-parent nil)
4674 (defvar gnus-tmp-root-expunged nil)
4675 (defvar gnus-tmp-dummy-line nil)
4677 (eval-when-compile (defvar gnus-tmp-header))
4678 (defun gnus-extra-header (type &optional header)
4679 "Return the extra header of TYPE."
4680 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4683 (defvar gnus-tmp-thread-tree-header-string "")
4685 (defcustom gnus-sum-thread-tree-root "> "
4686 "With %B spec, used for the root of a thread.
4687 If nil, use subject instead."
4689 :type '(radio (const :format "%v " nil) (string :size 0))
4690 :group 'gnus-thread)
4691 (defcustom gnus-sum-thread-tree-false-root "> "
4692 "With %B spec, used for a false root of a thread.
4693 If nil, use subject instead."
4695 :type '(radio (const :format "%v " nil) (string :size 0))
4696 :group 'gnus-thread)
4697 (defcustom gnus-sum-thread-tree-single-indent ""
4698 "With %B spec, used for a thread with just one message.
4699 If nil, use subject instead."
4701 :type '(radio (const :format "%v " nil) (string :size 0))
4702 :group 'gnus-thread)
4703 (defcustom gnus-sum-thread-tree-vertical "| "
4704 "With %B spec, used for drawing a vertical line."
4707 :group 'gnus-thread)
4708 (defcustom gnus-sum-thread-tree-indent " "
4709 "With %B spec, used for indenting."
4712 :group 'gnus-thread)
4713 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4714 "With %B spec, used for a leaf with brothers."
4717 :group 'gnus-thread)
4718 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4719 "With %B spec, used for a leaf without brothers."
4722 :group 'gnus-thread)
4724 (defun gnus-summary-prepare-threads (threads)
4725 "Prepare summary buffer from THREADS and indentation LEVEL.
4726 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4727 or a straight list of headers."
4728 (gnus-message 7 "Generating summary...")
4730 (setq gnus-newsgroup-threads threads)
4733 (let ((gnus-tmp-level 0)
4734 (default-score (or gnus-summary-default-score 0))
4735 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4736 (building-line-count gnus-summary-display-while-building)
4737 (building-count (integerp gnus-summary-display-while-building))
4738 thread number subject stack state gnus-tmp-gathered beg-match
4739 new-roots gnus-tmp-new-adopts thread-end simp-subject
4740 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4741 gnus-tmp-replied gnus-tmp-subject-or-nil
4742 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4743 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4744 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4747 (setq gnus-tmp-prev-subject nil
4748 gnus-tmp-thread-tree-header-string "")
4750 (if (vectorp (car threads))
4751 ;; If this is a straight (sic) list of headers, then a
4752 ;; threaded summary display isn't required, so we just create
4753 ;; an unthreaded one.
4754 (gnus-summary-prepare-unthreaded threads)
4756 ;; Do the threaded display.
4758 (if gnus-summary-display-while-building
4759 (switch-to-buffer (buffer-name)))
4760 (while (or threads stack gnus-tmp-new-adopts new-roots)
4762 (if (and (= gnus-tmp-level 0)
4765 (not gnus-tmp-false-parent)
4766 (or gnus-tmp-new-adopts new-roots))
4767 (if gnus-tmp-new-adopts
4768 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4769 thread (list (car gnus-tmp-new-adopts))
4770 gnus-tmp-header (caar thread)
4771 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4773 (setq thread (list (car new-roots))
4774 gnus-tmp-header (caar thread)
4775 new-roots (cdr new-roots))))
4778 ;; If there are some threads, we do them before the
4779 ;; threads on the stack.
4780 (setq thread threads
4781 gnus-tmp-header (caar thread))
4782 ;; There were no current threads, so we pop something off
4784 (setq state (car stack)
4785 gnus-tmp-level (car state)
4786 tree-stack (cadr state)
4787 thread (caddr state)
4789 gnus-tmp-header (caar thread))))
4791 (setq gnus-tmp-false-parent nil)
4792 (setq gnus-tmp-root-expunged nil)
4793 (setq thread-end nil)
4795 (if (stringp gnus-tmp-header)
4796 ;; The header is a dummy root.
4798 ((eq gnus-summary-make-false-root 'adopt)
4799 ;; We let the first article adopt the rest.
4800 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4802 (setq gnus-tmp-gathered
4804 (lambda (h) (mail-header-number (car h)))
4807 (setq thread (cons (list (caar thread)
4810 (setq gnus-tmp-level -1
4811 gnus-tmp-false-parent t))
4812 ((eq gnus-summary-make-false-root 'empty)
4813 ;; We print adopted articles with empty subject fields.
4814 (setq gnus-tmp-gathered
4816 (lambda (h) (mail-header-number (car h)))
4819 (setq gnus-tmp-level -1))
4820 ((eq gnus-summary-make-false-root 'dummy)
4821 ;; We remember that we probably want to output a dummy
4823 (setq gnus-tmp-dummy-line gnus-tmp-header)
4824 (setq gnus-tmp-prev-subject gnus-tmp-header))
4826 ;; We do not make a root for the gathered
4827 ;; sub-threads at all.
4828 (setq gnus-tmp-level -1)))
4830 (setq number (mail-header-number gnus-tmp-header)
4831 subject (mail-header-subject gnus-tmp-header)
4832 simp-subject (gnus-simplify-subject-fully subject))
4835 ;; If the thread has changed subject, we might want to make
4836 ;; this subthread into a root.
4837 ((and (null gnus-thread-ignore-subject)
4838 (not (zerop gnus-tmp-level))
4839 gnus-tmp-prev-subject
4840 (not (string= gnus-tmp-prev-subject simp-subject)))
4841 (setq new-roots (nconc new-roots (list (car thread)))
4843 gnus-tmp-header nil))
4844 ;; If the article lies outside the current limit,
4845 ;; then we do not display it.
4846 ((not (memq number gnus-newsgroup-limit))
4847 (setq gnus-tmp-gathered
4849 (lambda (h) (mail-header-number (car h)))
4852 (setq gnus-tmp-new-adopts (if (cdar thread)
4853 (append gnus-tmp-new-adopts
4855 gnus-tmp-new-adopts)
4857 gnus-tmp-header nil)
4858 (when (zerop gnus-tmp-level)
4859 (setq gnus-tmp-root-expunged t)))
4860 ;; Perhaps this article is to be marked as read?
4861 ((and gnus-summary-mark-below
4862 (< (or (cdr (assq number gnus-newsgroup-scored))
4864 gnus-summary-mark-below)
4865 ;; Don't touch sparse articles.
4866 (not (gnus-summary-article-sparse-p number))
4867 (not (gnus-summary-article-ancient-p number)))
4868 (setq gnus-newsgroup-unreads
4869 (delq number gnus-newsgroup-unreads))
4870 (if gnus-newsgroup-auto-expire
4871 (setq gnus-newsgroup-expirable
4872 (gnus-add-to-sorted-list
4873 gnus-newsgroup-expirable number))
4874 (push (cons number gnus-low-score-mark)
4875 gnus-newsgroup-reads))))
4877 (when gnus-tmp-header
4878 ;; We may have an old dummy line to output before this
4880 (when (and gnus-tmp-dummy-line
4883 (mail-header-subject gnus-tmp-header)))
4884 (gnus-summary-insert-dummy-line
4885 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4886 (setq gnus-tmp-dummy-line nil))
4888 ;; Compute the mark.
4889 (setq gnus-tmp-unread (gnus-article-mark number))
4891 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4892 gnus-tmp-header gnus-tmp-level)
4893 gnus-newsgroup-data)
4895 ;; Actually insert the line.
4897 gnus-tmp-subject-or-nil
4899 ((and gnus-thread-ignore-subject
4900 gnus-tmp-prev-subject
4901 (not (string= gnus-tmp-prev-subject simp-subject)))
4903 ((zerop gnus-tmp-level)
4904 (if (and (eq gnus-summary-make-false-root 'empty)
4905 (memq number gnus-tmp-gathered)
4906 gnus-tmp-prev-subject
4907 (string= gnus-tmp-prev-subject simp-subject))
4908 gnus-summary-same-subject
4910 (t gnus-summary-same-subject)))
4911 (if (and (eq gnus-summary-make-false-root 'adopt)
4912 (= gnus-tmp-level 1)
4913 (memq number gnus-tmp-gathered))
4914 (setq gnus-tmp-opening-bracket ?\<
4915 gnus-tmp-closing-bracket ?\>)
4916 (setq gnus-tmp-opening-bracket ?\[
4917 gnus-tmp-closing-bracket ?\]))
4919 gnus-tmp-indentation
4920 (aref gnus-thread-indent-array gnus-tmp-level)
4921 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4922 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4923 gnus-summary-default-score 0)
4925 (if (or (null gnus-summary-default-score)
4926 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4927 gnus-summary-zcore-fuzz))
4929 (if (< gnus-tmp-score gnus-summary-default-score)
4930 gnus-score-below-mark gnus-score-over-mark))
4932 (cond ((memq number gnus-newsgroup-processable)
4934 ((memq number gnus-newsgroup-cached)
4936 ((memq number gnus-newsgroup-replied)
4938 ((memq number gnus-newsgroup-forwarded)
4939 gnus-forwarded-mark)
4940 ((memq number gnus-newsgroup-saved)
4942 ((memq number gnus-newsgroup-recent)
4944 ((memq number gnus-newsgroup-unseen)
4948 (cond ((memq number gnus-newsgroup-undownloaded)
4949 gnus-undownloaded-mark)
4950 (gnus-newsgroup-agentized
4951 gnus-downloaded-mark)
4954 gnus-tmp-from (mail-header-from gnus-tmp-header)
4957 ((string-match "<[^>]+> *$" gnus-tmp-from)
4958 (setq beg-match (match-beginning 0))
4959 (or (and (string-match "^\".+\"" gnus-tmp-from)
4960 (substring gnus-tmp-from 1 (1- (match-end 0))))
4961 (substring gnus-tmp-from 0 beg-match)))
4962 ((string-match "(.+)" gnus-tmp-from)
4963 (substring gnus-tmp-from
4964 (1+ (match-beginning 0)) (1- (match-end 0))))
4968 gnus-tmp-thread-tree-header-string
4970 ((not gnus-show-threads) "")
4971 ((zerop gnus-tmp-level)
4972 (cond ((cdar thread)
4973 (or gnus-sum-thread-tree-root subject))
4974 (gnus-tmp-new-adopts
4975 (or gnus-sum-thread-tree-false-root subject))
4977 (or gnus-sum-thread-tree-single-indent subject))))
4979 (concat (apply 'concat
4980 (mapcar (lambda (item)
4982 gnus-sum-thread-tree-vertical
4983 gnus-sum-thread-tree-indent))
4984 (cdr (reverse tree-stack))))
4986 gnus-sum-thread-tree-leaf-with-other
4987 gnus-sum-thread-tree-single-leaf)))))
4988 (when (string= gnus-tmp-name "")
4989 (setq gnus-tmp-name gnus-tmp-from))
4990 (unless (numberp gnus-tmp-lines)
4991 (setq gnus-tmp-lines -1))
4992 (if (= gnus-tmp-lines -1)
4993 (setq gnus-tmp-lines "?")
4994 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4995 (gnus-put-text-property
4997 (progn (eval gnus-summary-line-format-spec) (point))
4998 'gnus-number number)
5001 (gnus-run-hooks 'gnus-summary-update-hook)
5004 (setq gnus-tmp-prev-subject simp-subject)))
5006 (when (nth 1 thread)
5007 (push (list (max 0 gnus-tmp-level)
5008 (copy-sequence tree-stack)
5011 (push (if (nth 1 thread) 1 0) tree-stack)
5012 (incf gnus-tmp-level)
5013 (setq threads (if thread-end nil (cdar thread)))
5014 (if gnus-summary-display-while-building
5017 ;; use a set frequency
5018 (setq building-line-count (1- building-line-count))
5019 (when (= building-line-count 0)
5021 (setq building-line-count
5022 gnus-summary-display-while-building)))
5026 (setq gnus-tmp-level 0)))))
5027 (gnus-message 7 "Generating summary...done"))
5029 (defun gnus-summary-prepare-unthreaded (headers)
5030 "Generate an unthreaded summary buffer based on HEADERS."
5031 (let (header number mark)
5036 ;; We may have to root out some bad articles...
5037 (when (memq (setq number (mail-header-number
5038 (setq header (pop headers))))
5039 gnus-newsgroup-limit)
5040 ;; Mark article as read when it has a low score.
5041 (when (and gnus-summary-mark-below
5042 (< (or (cdr (assq number gnus-newsgroup-scored))
5043 gnus-summary-default-score 0)
5044 gnus-summary-mark-below)
5045 (not (gnus-summary-article-ancient-p number)))
5046 (setq gnus-newsgroup-unreads
5047 (delq number gnus-newsgroup-unreads))
5048 (if gnus-newsgroup-auto-expire
5049 (push number gnus-newsgroup-expirable)
5050 (push (cons number gnus-low-score-mark)
5051 gnus-newsgroup-reads)))
5053 (setq mark (gnus-article-mark number))
5054 (push (gnus-data-make number mark (1+ (point)) header 0)
5055 gnus-newsgroup-data)
5056 (gnus-summary-insert-line
5058 (memq number gnus-newsgroup-undownloaded)
5059 mark (memq number gnus-newsgroup-replied)
5060 (memq number gnus-newsgroup-expirable)
5061 (mail-header-subject header) nil
5062 (cdr (assq number gnus-newsgroup-scored))
5063 (memq number gnus-newsgroup-processable))))))
5065 (defun gnus-summary-remove-list-identifiers ()
5066 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5067 (let ((regexp (if (consp gnus-list-identifiers)
5068 (mapconcat 'identity gnus-list-identifiers " *\\|")
5069 gnus-list-identifiers))
5072 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5073 (dolist (header gnus-newsgroup-headers)
5074 (setq subject (mail-header-subject header)
5076 (while (string-match regexp subject)
5078 (concat (substring subject 0 (match-beginning 1))
5079 (substring subject (match-end 0)))
5082 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5084 (concat (substring subject 0 (match-beginning 1))
5085 (substring subject (match-end 1)))))
5086 (mail-header-set-subject header subject))))))
5088 (defun gnus-fetch-headers (articles)
5089 "Fetch headers of ARTICLES."
5090 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5091 (gnus-message 5 "Fetching headers for %s..." name)
5094 (setq gnus-headers-retrieved-by
5095 (gnus-retrieve-headers
5096 articles gnus-newsgroup-name
5097 ;; We might want to fetch old headers, but
5098 ;; not if there is only 1 article.
5100 (not (eq gnus-fetch-old-headers 'some))
5101 (not (numberp gnus-fetch-old-headers)))
5102 (> (length articles) 1))
5103 gnus-fetch-old-headers))))
5104 (gnus-get-newsgroup-headers-xover
5105 articles nil nil gnus-newsgroup-name t)
5106 (gnus-get-newsgroup-headers))
5107 (gnus-message 5 "Fetching headers for %s...done" name))))
5109 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5110 "Select newsgroup GROUP.
5111 If READ-ALL is non-nil, all articles in the group are selected.
5112 If SELECT-ARTICLES, only select those articles from GROUP."
5113 (let* ((entry (gnus-group-entry group))
5114 ;;!!! Dirty hack; should be removed.
5115 (gnus-summary-ignore-duplicates
5116 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5118 gnus-summary-ignore-duplicates))
5119 (info (nth 2 entry))
5120 articles fetched-articles cached)
5122 (unless (gnus-check-server
5123 (set (make-local-variable 'gnus-current-select-method)
5124 (gnus-find-method-for-group group)))
5125 (error "Couldn't open server"))
5127 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5128 (gnus-activate-group group) ; Or we can activate it...
5129 (progn ; Or we bug out.
5130 (when (equal major-mode 'gnus-summary-mode)
5131 (gnus-kill-buffer (current-buffer)))
5132 (error "Couldn't activate group %s: %s"
5133 group (gnus-status-message group))))
5135 (unless (gnus-request-group group t)
5136 (when (equal major-mode 'gnus-summary-mode)
5137 (gnus-kill-buffer (current-buffer)))
5138 (error "Couldn't request group %s: %s"
5139 group (gnus-status-message group)))
5142 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5144 (setq gnus-summary-use-undownloaded-faces
5145 (gnus-agent-find-parameter
5147 'agent-enable-undownloaded-faces)))
5149 (setq gnus-newsgroup-name group
5150 gnus-newsgroup-unselected nil
5151 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5153 (let ((display (gnus-group-find-parameter group 'display)))
5154 (setq gnus-newsgroup-display
5156 ((not (zerop (or (car-safe read-all) 0)))
5157 ;; The user entered the group with C-u SPC/RET, let's show
5163 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5165 ;; The following is probably the "correct" solution, but
5166 ;; it makes Gnus fetch all headers and then limit the
5167 ;; articles (which is slow), so instead we hack the
5168 ;; select-articles parameter instead. -- Simon Josefsson
5171 ;; (gnus-byte-compile
5172 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5174 (setq select-articles
5175 (gnus-uncompress-range
5176 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5180 (cdr (gnus-active group)))))
5185 (gnus-summary-setup-default-charset)
5187 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5188 (when (gnus-virtual-group-p group)
5189 (setq cached gnus-newsgroup-cached))
5191 (setq gnus-newsgroup-unreads
5192 (gnus-sorted-ndifference
5193 (gnus-sorted-ndifference gnus-newsgroup-unreads
5194 gnus-newsgroup-marked)
5195 gnus-newsgroup-dormant))
5197 (setq gnus-newsgroup-processable nil)
5199 (gnus-update-read-articles group gnus-newsgroup-unreads)
5201 ;; Adjust and set lists of article marks.
5203 (gnus-adjust-marked-articles info))
5204 (if (setq articles select-articles)
5205 (setq gnus-newsgroup-unselected
5206 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5207 (setq articles (gnus-articles-to-read group read-all)))
5211 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5213 ((eq articles 0) nil)
5215 ;; Init the dependencies hash table.
5216 (setq gnus-newsgroup-dependencies
5217 (gnus-make-hashtable (length articles)))
5218 (gnus-set-global-variables)
5219 ;; Retrieve the headers and read them in.
5221 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5223 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5225 (setq gnus-newsgroup-cached cached))
5227 ;; Suppress duplicates?
5228 (when gnus-suppress-duplicates
5229 (gnus-dup-suppress-articles))
5231 ;; Set the initial limit.
5232 (setq gnus-newsgroup-limit (copy-sequence articles))
5233 ;; Remove canceled articles from the list of unread articles.
5234 (setq fetched-articles
5235 (mapcar (lambda (headers) (mail-header-number headers))
5236 gnus-newsgroup-headers))
5237 (setq gnus-newsgroup-articles fetched-articles)
5238 (setq gnus-newsgroup-unreads
5239 (gnus-sorted-nintersection
5240 gnus-newsgroup-unreads fetched-articles))
5241 (gnus-compute-unseen-list)
5243 ;; Removed marked articles that do not exist.
5244 (gnus-update-missing-marks
5245 (gnus-sorted-difference articles fetched-articles))
5246 ;; We might want to build some more threads first.
5247 (when (and gnus-fetch-old-headers
5248 (eq gnus-headers-retrieved-by 'nov))
5249 (if (eq gnus-fetch-old-headers 'invisible)
5250 (gnus-build-all-threads)
5251 (gnus-build-old-threads)))
5252 ;; Let the Gnus agent mark articles as read.
5254 (gnus-agent-get-undownloaded-list))
5255 ;; Remove list identifiers from subject
5256 (when gnus-list-identifiers
5257 (gnus-summary-remove-list-identifiers))
5258 ;; Check whether auto-expire is to be done in this group.
5259 (setq gnus-newsgroup-auto-expire
5260 (gnus-group-auto-expirable-p group))
5261 ;; Set up the article buffer now, if necessary.
5262 (unless gnus-single-article-buffer
5263 (gnus-article-setup-buffer))
5264 ;; First and last article in this newsgroup.
5265 (when gnus-newsgroup-headers
5266 (setq gnus-newsgroup-begin
5267 (mail-header-number (car gnus-newsgroup-headers))
5270 (gnus-last-element gnus-newsgroup-headers))))
5271 ;; GROUP is successfully selected.
5272 (or gnus-newsgroup-headers t)))))
5274 (defun gnus-compute-unseen-list ()
5275 ;; The `seen' marks are treated specially.
5276 (if (not gnus-newsgroup-seen)
5277 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5278 (setq gnus-newsgroup-unseen
5279 (gnus-inverse-list-range-intersection
5280 gnus-newsgroup-articles gnus-newsgroup-seen))))
5282 (defun gnus-summary-display-make-predicate (display)
5283 (require 'gnus-agent)
5284 (when (= (length display) 1)
5285 (setq display (car display)))
5286 (unless gnus-summary-display-cache
5287 (dolist (elem (append '((unread . unread)
5290 gnus-article-mark-lists))
5291 (push (cons (cdr elem)
5293 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5294 gnus-summary-display-cache)))
5295 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5296 (gnus-category-predicate-cache gnus-summary-display-cache))
5297 (gnus-get-predicate display)))
5299 ;; Uses the dynamically bound `number' variable.
5302 (defun gnus-article-marked-p (type &optional article)
5303 (let ((article (or article number)))
5306 (memq article gnus-newsgroup-marked))
5308 (memq article gnus-newsgroup-spam-marked))
5310 (memq article gnus-newsgroup-unsendable))
5311 ((eq type 'undownload)
5312 (memq article gnus-newsgroup-undownloaded))
5313 ((eq type 'download)
5314 (memq article gnus-newsgroup-downloadable))
5316 (memq article gnus-newsgroup-unreads))
5318 (memq article gnus-newsgroup-reads))
5320 (memq article gnus-newsgroup-dormant) )
5322 (memq article gnus-newsgroup-expirable))
5324 (memq article gnus-newsgroup-replied))
5326 (memq article gnus-newsgroup-killed))
5327 ((eq type 'bookmark)
5328 (assq article gnus-newsgroup-bookmarks))
5330 (assq article gnus-newsgroup-scored))
5332 (memq article gnus-newsgroup-saved))
5334 (memq article gnus-newsgroup-cached))
5336 (memq article gnus-newsgroup-forwarded))
5338 (not (memq article gnus-newsgroup-unseen)))
5340 (memq article gnus-newsgroup-recent))
5343 (defun gnus-articles-to-read (group &optional read-all)
5344 "Find out what articles the user wants to read."
5346 ;; Select all articles if `read-all' is non-nil, or if there
5347 ;; are no unread articles.
5349 (and (zerop (length gnus-newsgroup-marked))
5350 (zerop (length gnus-newsgroup-unreads)))
5351 ;; Fetch all if the predicate is non-nil.
5352 gnus-newsgroup-display)
5353 ;; We want to select the headers for all the articles in
5354 ;; the group, so we select either all the active
5355 ;; articles in the group, or (if that's nil), the
5356 ;; articles in the cache.
5358 (gnus-uncompress-range (gnus-active group))
5359 (gnus-cache-articles-in-group group))
5360 ;; Select only the "normal" subset of articles.
5362 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5363 gnus-newsgroup-unreads)))
5364 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5365 (scored (length scored-list))
5366 (number (length articles))
5367 (marked (+ (length gnus-newsgroup-marked)
5368 (length gnus-newsgroup-dormant)))
5373 ((numberp gnus-newsgroup-display)
5374 gnus-newsgroup-display)
5378 ((and (or (<= scored marked) (= scored number))
5379 (numberp gnus-large-newsgroup)
5380 (> number gnus-large-newsgroup))
5381 (let* ((cursor-in-echo-area nil)
5382 (initial (gnus-parameter-large-newsgroup-initial
5383 gnus-newsgroup-name))
5387 "How many articles from %s (%s %d): "
5389 (gnus-group-decoded-name gnus-newsgroup-name)
5391 (if initial "max" "default")
5394 (cons (number-to-string initial)
5396 (if (string-match "^[ \t]*$" input) number input)))
5397 ((and (> scored marked) (< scored number)
5398 (> (- scored number) 20))
5401 (format "%s %s (%d scored, %d total): "
5402 "How many articles from"
5403 (gnus-group-decoded-name group)
5405 (if (string-match "^[ \t]*$" input)
5409 (message "Quit getting the articles to read")
5411 (setq select (if (stringp select) (string-to-number select) select))
5412 (if (or (null select) (zerop select))
5414 (if (and (not (zerop scored)) (<= (abs select) scored))
5416 (setq articles (sort scored-list '<))
5417 (setq number (length articles)))
5418 (setq articles (copy-sequence articles)))
5420 (when (< (abs select) number)
5422 ;; Select the N oldest articles.
5423 (setcdr (nthcdr (1- (abs select)) articles) nil)
5424 ;; Select the N most recent articles.
5425 (setq articles (nthcdr (- number select) articles))))
5426 (setq gnus-newsgroup-unselected
5427 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5428 (when gnus-alter-articles-to-read-function
5431 (funcall gnus-alter-articles-to-read-function
5432 gnus-newsgroup-name articles)
5436 (defun gnus-killed-articles (killed articles)
5439 (when (inline (gnus-member-of-range (car articles) killed))
5440 (push (car articles) out))
5441 (setq articles (cdr articles)))
5444 (defun gnus-uncompress-marks (marks)
5445 "Uncompress the mark ranges in MARKS."
5446 (let ((uncompressed '(score bookmark))
5449 (if (memq (caar marks) uncompressed)
5450 (push (car marks) out)
5451 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5452 (setq marks (cdr marks)))
5455 (defun gnus-article-mark-to-type (mark)
5456 "Return the type of MARK."
5457 (or (cadr (assq mark gnus-article-special-mark-lists))
5460 (defun gnus-article-unpropagatable-p (mark)
5461 "Return whether MARK should be propagated to back end."
5462 (memq mark gnus-article-unpropagated-mark-lists))
5464 (defun gnus-adjust-marked-articles (info)
5465 "Set all article lists and remove all marks that are no longer valid."
5466 (let* ((marked-lists (gnus-info-marks info))
5467 (active (gnus-active (gnus-info-group info)))
5470 (types gnus-article-mark-lists)
5471 marks var articles article mark mark-type
5474 (dolist (marks marked-lists)
5475 (setq mark (car marks)
5476 mark-type (gnus-article-mark-to-type mark)
5477 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5479 ;; We set the variable according to the type of the marks list,
5480 ;; and then adjust the marks to a subset of the active articles.
5482 ;; Adjust "simple" lists - compressed yet unsorted
5483 ((eq mark-type 'list)
5484 ;; Simultaneously uncompress and clip to active range
5485 ;; See gnus-uncompress-range for a description of possible marks
5487 (if (not (cadr marks))
5489 (setq articles (if (numberp (cddr marks))
5495 (while (setq article (pop articles))
5496 (cond ((consp article)
5497 (setq bgn (max (car article) min)
5498 end (min (cdr article) max))
5500 (setq l (setcdr l (cons bgn nil))
5502 ((and (<= min article)
5504 (setq l (setcdr l (cons article nil))))))
5505 (set var (cdr lh)))))
5507 ((eq mark-type 'tuple)
5508 (set var (setq articles (cdr marks)))
5509 (when (not (listp (cdr (symbol-value var))))
5510 (set var (list (symbol-value var))))
5511 (when (not (listp (cdr articles)))
5512 (setq articles (list articles)))
5514 (when (or (not (consp (setq article (pop articles))))
5515 (< (car article) min)
5516 (> (car article) max))
5517 (set var (delq article (symbol-value var))))))
5518 ;; Adjust ranges (sloppily).
5519 ((eq mark-type 'range)
5522 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5523 ;; It should be (seen (NUM1 . NUM2)).
5524 (when (numberp (cddr marks))
5525 (setcdr marks (list (cdr marks))))
5526 (setq articles (cdr marks))
5527 (while (and articles
5528 (or (and (consp (car articles))
5529 (> min (cdar articles)))
5530 (and (numberp (car articles))
5531 (> min (car articles)))))
5533 (set var articles))))))))
5535 (defun gnus-update-missing-marks (missing)
5536 "Go through the list of MISSING articles and remove them from the mark lists."
5539 ;; Go through all types.
5540 (dolist (elem gnus-article-mark-lists)
5541 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5542 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5543 (when (symbol-value var)
5544 ;; This list has articles. So we delete all missing
5545 ;; articles from it.
5548 (set var (delq (pop m) (symbol-value var))))))))))
5550 (defun gnus-update-marks ()
5551 "Enter the various lists of marked articles into the newsgroup info list."
5552 (let ((types gnus-article-mark-lists)
5553 (info (gnus-get-info gnus-newsgroup-name))
5554 type list newmarked symbol delta-marks)
5556 ;; Add all marks lists to the list of marks lists.
5557 (while (setq type (pop types))
5558 (setq list (symbol-value
5560 (intern (format "gnus-newsgroup-%s" (car type))))))
5563 ;; Get rid of the entries of the articles that have the
5565 (when (and (eq (cdr type) 'score)
5569 (prev (cons nil list))
5572 (if (or (not (consp (car arts)))
5573 (= (cdar arts) gnus-summary-default-score))
5574 (setcdr prev (cdr arts))
5576 (setq arts (cdr arts)))
5577 (setq list (cdr all)))))
5579 (when (eq (cdr type) 'seen)
5580 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5582 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5583 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5585 (when (and (gnus-check-backend-function
5586 'request-set-mark gnus-newsgroup-name)
5587 (not (gnus-article-unpropagatable-p (cdr type))))
5588 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5589 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5590 (add (gnus-remove-from-range
5591 (gnus-copy-sequence list) old)))
5593 (push (list add 'add (list (cdr type))) delta-marks))
5595 (push (list del 'del (list (cdr type))) delta-marks))))
5598 (push (cons (cdr type) list) newmarked)))
5601 (unless (gnus-check-group gnus-newsgroup-name)
5602 (error "Can't open server for %s" gnus-newsgroup-name))
5603 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5605 ;; Enter these new marks into the info of the group.
5607 (setcar (nthcdr 3 info) newmarked)
5608 ;; Add the marks lists to the end of the info.
5610 (setcdr (nthcdr 2 info) (list newmarked))))
5612 ;; Cut off the end of the info if there's nothing else there.
5616 (when (nthcdr (decf i) info)
5617 (setcdr (nthcdr i info) nil)))))))
5619 (defun gnus-set-mode-line (where)
5620 "Set the mode line of the article or summary buffers.
5621 If WHERE is `summary', the summary mode line format will be used."
5622 ;; Is this mode line one we keep updated?
5623 (when (and (memq where gnus-updated-mode-lines)
5625 (intern (format "gnus-%s-mode-line-format-spec" where))))
5628 ;; We evaluate this in the summary buffer since these
5629 ;; variables are buffer-local to that buffer.
5630 (set-buffer gnus-summary-buffer)
5631 ;; We bind all these variables that are used in the `eval' form
5633 (let* ((mformat (symbol-value
5635 (format "gnus-%s-mode-line-format-spec" where))))
5636 (gnus-tmp-group-name (gnus-group-decoded-name
5637 gnus-newsgroup-name))
5638 (gnus-tmp-article-number (or gnus-current-article 0))
5639 (gnus-tmp-unread gnus-newsgroup-unreads)
5640 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5641 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5642 (gnus-tmp-unread-and-unselected
5643 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5644 (zerop gnus-tmp-unselected))
5646 ((zerop gnus-tmp-unselected)
5647 (format "{%d more}" gnus-tmp-unread-and-unticked))
5648 (t (format "{%d(+%d) more}"
5649 gnus-tmp-unread-and-unticked
5650 gnus-tmp-unselected))))
5652 (if (and gnus-current-headers
5653 (vectorp gnus-current-headers))
5654 (gnus-mode-string-quote
5655 (mail-header-subject gnus-current-headers))
5657 bufname-length max-len
5658 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5659 (setq mode-string (eval mformat))
5660 (setq bufname-length (if (string-match "%b" mode-string)
5663 (if (eq where 'summary)
5665 (get-buffer gnus-article-buffer))))
5668 (setq max-len (max 4 (if gnus-mode-non-string-length
5670 gnus-mode-non-string-length
5672 (length mode-string))))
5673 ;; We might have to chop a bit of the string off...
5674 (when (> (length mode-string) max-len)
5676 (concat (truncate-string-to-width mode-string (- max-len 3))
5678 ;; Pad the mode string a bit.
5679 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5680 ;; Update the mode line.
5681 (setq mode-line-buffer-identification
5682 (gnus-mode-line-buffer-identification (list mode-string)))
5683 (set-buffer-modified-p t))))
5685 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5686 "Go through the HEADERS list and add all Xrefs to a hash table.
5687 The resulting hash table is returned, or nil if no Xrefs were found."
5688 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5689 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5690 (xref-hashtb (gnus-make-hashtable))
5691 start group entry number xrefs header)
5693 (setq header (pop headers))
5694 (when (and (setq xrefs (mail-header-xref header))
5695 (not (memq (setq number (mail-header-number header))
5698 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5699 (setq start (match-end 0))
5700 (setq group (if prefix
5701 (concat prefix (substring xrefs (match-beginning 1)
5703 (substring xrefs (match-beginning 1) (match-end 1))))
5705 (string-to-int (substring xrefs (match-beginning 2)
5707 (if (setq entry (gnus-gethash group xref-hashtb))
5708 (setcdr entry (cons number (cdr entry)))
5709 (gnus-sethash group (cons number nil) xref-hashtb)))))
5710 (and start xref-hashtb)))
5712 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5713 "Look through all the headers and mark the Xrefs as read."
5714 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5715 name info xref-hashtb idlist method nth4)
5717 (set-buffer gnus-group-buffer)
5718 (when (setq xref-hashtb
5719 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5722 (unless (string= from-newsgroup (setq name (symbol-name group)))
5723 (setq idlist (symbol-value group))
5724 ;; Dead groups are not updated.
5726 (setq info (gnus-get-info name))
5727 (when (stringp (setq nth4 (gnus-info-method info)))
5728 (setq nth4 (gnus-server-to-method nth4))))
5729 ;; Only do the xrefs if the group has the same
5730 ;; select method as the group we have just read.
5731 (or (gnus-methods-equal-p
5732 nth4 (gnus-find-method-for-group from-newsgroup))
5734 (equal nth4 (setq method (gnus-find-method-for-group
5736 (and (equal (car nth4) (car method))
5737 (equal (nth 1 nth4) (nth 1 method))))
5738 gnus-use-cross-reference
5739 (or (not (eq gnus-use-cross-reference t))
5741 ;; Only do cross-references on subscribed
5742 ;; groups, if that is what is wanted.
5743 (<= (gnus-info-level info) gnus-level-subscribed))
5744 (gnus-group-make-articles-read name idlist))))
5747 (defun gnus-compute-read-articles (group articles)
5748 (let* ((entry (gnus-group-entry group))
5749 (info (nth 2 entry))
5750 (active (gnus-active group))
5753 ;; First peel off all invalid article numbers.
5755 (let ((ids articles)
5757 (while (setq id (pop ids))
5758 (when (and first (> id (cdr active)))
5759 ;; We'll end up in this situation in one particular
5760 ;; obscure situation. If you re-scan a group and get
5761 ;; a new article that is cross-posted to a different
5762 ;; group that has not been re-scanned, you might get
5763 ;; crossposted article that has a higher number than
5764 ;; Gnus believes possible. So we re-activate this
5765 ;; group as well. This might mean doing the
5766 ;; crossposting thingy will *increase* the number
5767 ;; of articles in some groups. Tsk, tsk.
5768 (setq active (or (gnus-activate-group group) active)))
5769 (when (or (> id (cdr active))
5770 (< id (car active)))
5771 (setq articles (delq id articles))))))
5772 ;; If the read list is nil, we init it.
5774 (null (gnus-info-read info))
5776 (setq ninfo (cons 1 (1- (car active))))
5777 (setq ninfo (gnus-info-read info)))
5778 ;; Then we add the read articles to the range.
5780 ninfo (setq articles (sort articles '<))))))
5782 (defun gnus-group-make-articles-read (group articles)
5783 "Update the info of GROUP to say that ARTICLES are read."
5785 (entry (gnus-group-entry group))
5786 (info (nth 2 entry))
5787 (active (gnus-active group))
5790 (setq range (gnus-compute-read-articles group articles))
5791 (with-current-buffer gnus-group-buffer
5794 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5795 (gnus-info-set-read ',info ',(gnus-info-read info))
5796 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5797 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5798 (gnus-group-update-group ,group t))))
5799 ;; Add the read articles to the range.
5800 (gnus-info-set-read info range)
5801 (gnus-request-set-mark group (list (list range 'add '(read))))
5802 ;; Then we have to re-compute how many unread
5803 ;; articles there are in this group.
5807 (setq num (- (1+ (cdr active)) (car active))))
5808 ((not (listp (cdr range)))
5809 (setq num (- (cdr active) (- (1+ (cdr range))
5813 (if (numberp (car range))
5815 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5816 (setq range (cdr range)))
5817 (setq num (- (cdr active) num))))
5818 ;; Update the number of unread articles.
5820 ;; Update the group buffer.
5821 (unless (gnus-ephemeral-group-p group)
5822 (gnus-group-update-group group t))))))
5824 (defvar gnus-newsgroup-none-id 0)
5826 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5827 (let ((cur nntp-server-buffer)
5830 (with-current-buffer gnus-summary-buffer
5831 gnus-newsgroup-dependencies)))
5832 headers id end ref number
5833 (mail-parse-charset gnus-newsgroup-charset)
5834 (mail-parse-ignored-charsets
5835 (save-excursion (condition-case nil
5836 (set-buffer gnus-summary-buffer)
5838 gnus-newsgroup-ignored-charsets)))
5840 (set-buffer nntp-server-buffer)
5841 ;; Translate all TAB characters into SPACE characters.
5842 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5843 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5844 (ietf-drums-unfold-fws)
5845 (gnus-run-hooks 'gnus-parse-headers-hook)
5846 (let ((case-fold-search t)
5847 in-reply-to header p lines chars)
5848 (goto-char (point-min))
5849 ;; Search to the beginning of the next header. Error messages
5850 ;; do not begin with 2 or 3.
5851 (while (re-search-forward "^[23][0-9]+ " nil t)
5854 ;; This implementation of this function, with nine
5855 ;; search-forwards instead of the one re-search-forward and
5856 ;; a case (which basically was the old function) is actually
5857 ;; about twice as fast, even though it looks messier. You
5858 ;; can't have everything, I guess. Speed and elegance
5859 ;; doesn't always go hand in hand.
5865 (setq number (read cur))
5868 (narrow-to-region (point)
5869 (or (and (search-forward "\n.\n" nil t)
5875 (if (search-forward "\nsubject:" nil t)
5876 (funcall gnus-decode-encoded-word-function
5877 (nnheader-header-value))
5882 (if (search-forward "\nfrom:" nil t)
5883 (funcall gnus-decode-encoded-word-function
5884 (nnheader-header-value))
5889 (if (search-forward "\ndate:" nil t)
5890 (nnheader-header-value) ""))
5894 (setq id (if (re-search-forward
5895 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5896 ;; We do it this way to make sure the Message-ID
5897 ;; is (somewhat) syntactically valid.
5898 (buffer-substring (match-beginning 1)
5900 ;; If there was no message-id, we just fake one
5901 ;; to make subsequent routines simpler.
5902 (nnheader-generate-fake-message-id number))))
5906 (if (search-forward "\nreferences:" nil t)
5910 (nnheader-header-value)
5915 (search-backward ">" end t)
5918 (search-backward "<" end t)
5920 ;; Get the references from the in-reply-to header if there
5921 ;; were no references and the in-reply-to header looks
5923 (if (and (search-forward "\nin-reply-to:" nil t)
5924 (setq in-reply-to (nnheader-header-value))
5925 (string-match "<[^>]+>" in-reply-to))
5927 (setq ref (substring in-reply-to (match-beginning 0)
5929 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5930 (setq ref2 (substring in-reply-to (match-beginning 0)
5932 (when (> (length ref2) (length ref))
5939 (if (search-forward "\nchars: " nil t)
5940 (if (numberp (setq chars (ignore-errors (read cur))))
5946 (if (search-forward "\nlines: " nil t)
5947 (if (numberp (setq lines (ignore-errors (read cur))))
5953 (and (search-forward "\nxref:" nil t)
5954 (nnheader-header-value)))
5956 (when gnus-extra-headers
5957 (let ((extra gnus-extra-headers)
5961 (when (search-forward
5962 (concat "\n" (symbol-name (car extra)) ":") nil t)
5963 (push (cons (car extra) (nnheader-header-value))
5967 (when (equal id ref)
5970 (when gnus-alter-header-function
5971 (funcall gnus-alter-header-function header)
5972 (setq id (mail-header-id header)
5973 ref (gnus-parent-id (mail-header-references header))))
5976 (gnus-dependencies-add-header
5977 header dependencies force-new))
5978 (push header headers))
5979 (goto-char (point-max))
5981 (nreverse headers)))))
5983 ;; Goes through the xover lines and returns a list of vectors
5984 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5985 force-new dependencies
5986 group also-fetch-heads)
5987 "Parse the news overview data in the server buffer.
5988 Return a list of headers that match SEQUENCE (see
5989 `nntp-retrieve-headers')."
5990 ;; Get the Xref when the users reads the articles since most/some
5991 ;; NNTP servers do not include Xrefs when using XOVER.
5992 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5993 (let ((mail-parse-charset gnus-newsgroup-charset)
5994 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5995 (cur nntp-server-buffer)
5996 (dependencies (or dependencies gnus-newsgroup-dependencies))
5998 ((eq gnus-read-all-available-headers t)
6000 ((stringp gnus-read-all-available-headers)
6001 (string-match gnus-read-all-available-headers group))
6004 number headers header)
6006 (set-buffer nntp-server-buffer)
6007 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6008 ;; Allow the user to mangle the headers before parsing them.
6009 (gnus-run-hooks 'gnus-parse-headers-hook)
6010 (goto-char (point-min))
6011 (gnus-parse-without-error
6012 (while (and (or sequence allp)
6014 (setq number (read cur))
6016 (while (and sequence
6017 (< (car sequence) number))
6018 (setq sequence (cdr sequence))))
6021 (eq number (car sequence))))
6023 (setq sequence (cdr sequence))
6024 (setq header (inline
6025 (gnus-nov-parse-line
6026 number dependencies force-new)))))
6027 (push header headers))
6029 ;; A common bug in inn is that if you have posted an article and
6030 ;; then retrieves the active file, it will answer correctly --
6031 ;; the new article is included. However, a NOV entry for the
6032 ;; article may not have been generated yet, so this may fail.
6033 ;; We work around this problem by retrieving the last few
6034 ;; headers using HEAD.
6035 (if (or (not also-fetch-heads)
6037 ;; We (probably) got all the headers.
6039 (let ((gnus-nov-is-evil t))
6042 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6043 (gnus-get-newsgroup-headers))))))))
6045 (defun gnus-article-get-xrefs ()
6046 "Fill in the Xref value in `gnus-current-headers', if necessary.
6047 This is meant to be called in `gnus-article-internal-prepare-hook'."
6048 (let ((headers (with-current-buffer gnus-summary-buffer
6049 gnus-current-headers)))
6050 (or (not gnus-use-cross-reference)
6052 (and (mail-header-xref headers)
6053 (not (string= (mail-header-xref headers) "")))
6054 (let ((case-fold-search t)
6057 (nnheader-narrow-to-headers)
6058 (goto-char (point-min))
6059 (when (or (and (not (eobp))
6060 (eq (downcase (char-after)) ?x)
6061 (looking-at "Xref:"))
6062 (search-forward "\nXref:" nil t))
6063 (goto-char (1+ (match-end 0)))
6064 (setq xref (buffer-substring (point) (point-at-eol)))
6065 (mail-header-set-xref headers xref)))))))
6067 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6068 "Find article ID and insert the summary line for that article.
6069 OLD-HEADER can either be a header or a line number to insert
6070 the subject line on."
6071 (let* ((line (and (numberp old-header) old-header))
6072 (old-header (and (vectorp old-header) old-header))
6073 (header (cond ((and old-header use-old-header)
6076 (gnus-number-to-header id))
6077 (gnus-number-to-header id))
6079 (gnus-read-header id))))
6080 (number (and (numberp id) id))
6083 ;; Rebuild the thread that this article is part of and go to the
6084 ;; article we have fetched.
6085 (when (and (not gnus-show-threads)
6088 (setq d (gnus-data-find (mail-header-number old-header))))
6089 (goto-char (gnus-data-pos d))
6095 (gnus-delete-line))))))
6096 ;; Remove list identifiers from subject.
6097 (when gnus-list-identifiers
6098 (let ((gnus-newsgroup-headers (list header)))
6099 (gnus-summary-remove-list-identifiers)))
6101 (mail-header-set-number header (mail-header-number old-header)))
6102 (setq gnus-newsgroup-sparse
6103 (delq (setq number (mail-header-number header))
6104 gnus-newsgroup-sparse))
6105 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6106 (push number gnus-newsgroup-limit)
6107 (gnus-rebuild-thread (mail-header-id header) line)
6108 (gnus-summary-goto-subject number nil t))
6109 (when (and (numberp number)
6111 ;; We have to update the boundaries even if we can't fetch the
6112 ;; article if ID is a number -- so that the next `P' or `N'
6113 ;; command will fetch the previous (or next) article even
6114 ;; if the one we tried to fetch this time has been canceled.
6115 (when (> number gnus-newsgroup-end)
6116 (setq gnus-newsgroup-end number))
6117 (when (< number gnus-newsgroup-begin)
6118 (setq gnus-newsgroup-begin number))
6119 (setq gnus-newsgroup-unselected
6120 (delq number gnus-newsgroup-unselected)))
6121 ;; Report back a success?
6122 (and header (mail-header-number header))))
6124 ;;; Process/prefix in the summary buffer
6126 (defun gnus-summary-work-articles (n)
6127 "Return a list of articles to be worked upon.
6128 The prefix argument, the list of process marked articles, and the
6129 current article will be taken into consideration."
6131 (set-buffer gnus-summary-buffer)
6134 ;; A numerical prefix has been given.
6135 (setq n (prefix-numeric-value n))
6136 (let ((backward (< n 0))
6137 (n (abs (prefix-numeric-value n)))
6142 (push (setq article (gnus-summary-article-number))
6145 (gnus-summary-find-prev nil article)
6146 (gnus-summary-find-next nil article)))
6148 (nreverse articles)))
6149 ((and (gnus-region-active-p) (mark))
6150 (message "region active")
6151 ;; Work on the region between point and mark.
6152 (let ((max (max (point) (mark)))
6155 (goto-char (min (min (point) (mark))))
6158 (push (setq article (gnus-summary-article-number)) articles)
6159 (gnus-summary-find-next nil article)
6161 (nreverse articles))))
6162 (gnus-newsgroup-processable
6163 ;; There are process-marked articles present.
6164 ;; Save current state.
6165 (gnus-summary-save-process-mark)
6167 (reverse gnus-newsgroup-processable))
6169 ;; Just return the current article.
6170 (list (gnus-summary-article-number))))))
6172 (defmacro gnus-summary-iterate (arg &rest forms)
6173 "Iterate over the process/prefixed articles and do FORMS.
6174 ARG is the interactive prefix given to the command. FORMS will be
6175 executed with point over the summary line of the articles."
6176 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6177 `(let ((,articles (gnus-summary-work-articles ,arg)))
6179 (gnus-summary-goto-subject (car ,articles))
6183 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6184 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6186 (defun gnus-summary-save-process-mark ()
6187 "Push the current set of process marked articles on the stack."
6189 (push (copy-sequence gnus-newsgroup-processable)
6190 gnus-newsgroup-process-stack))
6192 (defun gnus-summary-kill-process-mark ()
6193 "Push the current set of process marked articles on the stack and unmark."
6195 (gnus-summary-save-process-mark)
6196 (gnus-summary-unmark-all-processable))
6198 (defun gnus-summary-yank-process-mark ()
6199 "Pop the last process mark state off the stack and restore it."
6201 (unless gnus-newsgroup-process-stack
6202 (error "Empty mark stack"))
6203 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6205 (defun gnus-summary-process-mark-set (set)
6206 "Make SET into the current process marked articles."
6207 (gnus-summary-unmark-all-processable)
6208 (mapc 'gnus-summary-set-process-mark set))
6210 ;;; Searching and stuff
6212 (defun gnus-summary-search-group (&optional backward use-level)
6213 "Search for next unread newsgroup.
6214 If optional argument BACKWARD is non-nil, search backward instead."
6216 (set-buffer gnus-group-buffer)
6217 (when (gnus-group-search-forward
6218 backward nil (if use-level (gnus-group-group-level) nil))
6219 (gnus-group-group-name))))
6221 (defun gnus-summary-best-group (&optional exclude-group)
6222 "Find the name of the best unread group.
6223 If EXCLUDE-GROUP, do not go to this group."
6224 (with-current-buffer gnus-group-buffer
6226 (gnus-group-best-unread-group exclude-group))))
6228 (defun gnus-summary-find-next (&optional unread article backward)
6230 (gnus-summary-find-prev unread article)
6231 (let* ((dummy (gnus-summary-article-intangible-p))
6232 (article (or article (gnus-summary-article-number)))
6233 (data (gnus-data-find-list article))
6235 (when (and (not dummy)
6236 (or (not gnus-summary-check-current)
6238 (not (gnus-data-unread-p (car data)))))
6239 (setq data (cdr data)))
6244 (unless (memq (gnus-data-number (car data))
6246 ((eq gnus-auto-goto-ignores
6247 'always-undownloaded)
6248 gnus-newsgroup-undownloaded)
6251 ((eq gnus-auto-goto-ignores
6253 gnus-newsgroup-unfetched)
6254 ((eq gnus-auto-goto-ignores
6256 gnus-newsgroup-undownloaded)))
6257 (when (gnus-data-unread-p (car data))
6258 (setq result (car data)
6260 (setq data (cdr data)))
6263 (goto-char (gnus-data-pos result))
6264 (gnus-data-number result)))))
6266 (defun gnus-summary-find-prev (&optional unread article)
6267 (let* ((eobp (eobp))
6268 (article (or article (gnus-summary-article-number)))
6269 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6271 (when (and (not eobp)
6272 (or (not gnus-summary-check-current)
6274 (not (gnus-data-unread-p (car data)))))
6275 (setq data (cdr data)))
6280 (unless (memq (gnus-data-number (car data))
6282 ((eq gnus-auto-goto-ignores
6283 'always-undownloaded)
6284 gnus-newsgroup-undownloaded)
6287 ((eq gnus-auto-goto-ignores
6289 gnus-newsgroup-unfetched)
6290 ((eq gnus-auto-goto-ignores
6292 gnus-newsgroup-undownloaded)))
6293 (when (gnus-data-unread-p (car data))
6294 (setq result (car data)
6296 (setq data (cdr data)))
6299 (goto-char (gnus-data-pos result))
6300 (gnus-data-number result))))
6302 (defun gnus-summary-find-subject (subject &optional unread backward article)
6303 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6304 (article (or article (gnus-summary-article-number)))
6305 (articles (gnus-data-list backward))
6306 (arts (gnus-data-find-list article articles))
6308 (when (or (not gnus-summary-check-current)
6310 (not (gnus-data-unread-p (car arts))))
6311 (setq arts (cdr arts)))
6313 (and (or (not unread)
6314 (gnus-data-unread-p (car arts)))
6315 (vectorp (gnus-data-header (car arts)))
6317 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6318 (setq result (car arts)
6320 (setq arts (cdr arts)))
6322 (goto-char (gnus-data-pos result))
6323 (gnus-data-number result))))
6325 (defun gnus-summary-search-forward (&optional unread subject backward)
6326 "Search forward for an article.
6327 If UNREAD, look for unread articles. If SUBJECT, look for
6328 articles with that subject. If BACKWARD, search backward instead."
6329 (cond (subject (gnus-summary-find-subject subject unread backward))
6330 (backward (gnus-summary-find-prev unread))
6331 (t (gnus-summary-find-next unread))))
6333 (defun gnus-recenter (&optional n)
6334 "Center point in window and redisplay frame.
6335 Also do horizontal recentering."
6337 (when (and gnus-auto-center-summary
6338 (not (eq gnus-auto-center-summary 'vertical)))
6339 (gnus-horizontal-recenter))
6342 (defun gnus-summary-recenter ()
6343 "Center point in the summary window.
6344 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6345 displayed, no centering will be performed."
6346 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6347 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6349 ;; The user has to want it.
6350 (when gnus-auto-center-summary
6351 (let* ((top (cond ((< (window-height) 4) 0)
6352 ((< (window-height) 7) 1)
6353 (t (if (numberp gnus-auto-center-summary)
6354 gnus-auto-center-summary
6355 (/ (1- (window-height)) 2)))))
6356 (height (1- (window-height)))
6357 (bottom (save-excursion (goto-char (point-max))
6358 (forward-line (- height))
6360 (window (get-buffer-window (current-buffer))))
6361 (when (get-buffer-window gnus-article-buffer)
6362 ;; Only do recentering when the article buffer is displayed,
6363 ;; Set the window start to either `bottom', which is the biggest
6364 ;; possible valid number, or the second line from the top,
6365 ;; whichever is the least.
6366 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6367 (if (> bottom top-pos)
6368 ;; Keep the second line from the top visible
6369 (set-window-start window top-pos t)
6370 ;; Try to keep the bottom line visible; if it's partially
6371 ;; obscured, either scroll one more line to make it fully
6372 ;; visible, or revert to using TOP-POS.
6374 (goto-char (point-max))
6376 (let ((last-line-start (point)))
6378 (set-window-start window (point) t)
6379 (when (not (pos-visible-in-window-p last-line-start window))
6381 (set-window-start window (min (point) top-pos) t)))))))
6382 ;; Do horizontal recentering while we're at it.
6383 (when (and (get-buffer-window (current-buffer) t)
6384 (not (eq gnus-auto-center-summary 'vertical)))
6385 (let ((selected (selected-window)))
6386 (select-window (get-buffer-window (current-buffer) t))
6387 (gnus-summary-position-point)
6388 (gnus-horizontal-recenter)
6389 (select-window selected))))))
6391 (defun gnus-summary-jump-to-group (newsgroup)
6392 "Move point to NEWSGROUP in group mode buffer."
6393 ;; Keep update point of group mode buffer if visible.
6394 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6395 (save-window-excursion
6396 ;; Take care of tree window mode.
6397 (when (get-buffer-window gnus-group-buffer)
6398 (pop-to-buffer gnus-group-buffer))
6399 (gnus-group-jump-to-group newsgroup))
6401 ;; Take care of tree window mode.
6402 (if (get-buffer-window gnus-group-buffer)
6403 (pop-to-buffer gnus-group-buffer)
6404 (set-buffer gnus-group-buffer))
6405 (gnus-group-jump-to-group newsgroup))))
6407 ;; This function returns a list of article numbers based on the
6408 ;; difference between the ranges of read articles in this group and
6409 ;; the range of active articles.
6410 (defun gnus-list-of-unread-articles (group)
6411 (let* ((read (gnus-info-read (gnus-get-info group)))
6412 (active (or (gnus-active group) (gnus-activate-group group)))
6415 ;; If none are read, then all are unread.
6417 (setq first (car active))
6418 ;; If the range of read articles is a single range, then the
6419 ;; first unread article is the article after the last read
6420 ;; article. Sounds logical, doesn't it?
6421 (if (and (not (listp (cdr read)))
6422 (or (< (car read) (car active))
6423 (progn (setq read (list read))
6425 (setq first (max (car active) (1+ (cdr read))))
6426 ;; `read' is a list of ranges.
6427 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6430 (setq first (car active)))
6433 (while (< first nlast)
6434 (setq unread (cons first unread)
6436 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6437 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6438 (setq read (cdr read)))))
6439 ;; And add the last unread articles.
6440 (while (<= first last)
6441 (setq unread (cons first unread)
6443 ;; Return the list of unread articles.
6444 (delq 0 (nreverse unread))))
6446 (defun gnus-list-of-read-articles (group)
6447 "Return a list of unread, unticked and non-dormant articles."
6448 (let* ((info (gnus-get-info group))
6449 (marked (gnus-info-marks info))
6450 (active (gnus-active group)))
6452 (gnus-list-range-difference
6453 (gnus-list-range-difference
6454 (gnus-sorted-complement
6455 (gnus-uncompress-range active)
6456 (gnus-list-of-unread-articles group))
6457 (cdr (assq 'dormant marked)))
6458 (cdr (assq 'tick marked))))))
6460 ;; This function returns a sequence of article numbers based on the
6461 ;; difference between the ranges of read articles in this group and
6462 ;; the range of active articles.
6463 (defun gnus-sequence-of-unread-articles (group)
6464 (let* ((read (gnus-info-read (gnus-get-info group)))
6465 (active (or (gnus-active group) (gnus-activate-group group)))
6468 ;; If none are read, then all are unread.
6470 (setq first (car active))
6471 ;; If the range of read articles is a single range, then the
6472 ;; first unread article is the article after the last read
6473 ;; article. Sounds logical, doesn't it?
6474 (if (and (not (listp (cdr read)))
6475 (or (< (car read) (car active))
6476 (progn (setq read (list read))
6478 (setq first (max (car active) (1+ (cdr read))))
6479 ;; `read' is a list of ranges.
6480 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6483 (setq first (car active)))
6486 (push (cons first nlast) unread))
6487 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6488 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6489 (setq read (cdr read)))))
6490 ;; And add the last unread articles.
6491 (cond ((< first last)
6492 (push (cons first last) unread))
6494 (push first unread)))
6495 ;; Return the sequence of unread articles.
6496 (delq 0 (nreverse unread))))
6498 ;; Various summary commands
6500 (defun gnus-summary-select-article-buffer ()
6501 "Reconfigure windows to show article buffer."
6503 (if (not (gnus-buffer-live-p gnus-article-buffer))
6504 (error "There is no article buffer for this summary buffer")
6505 (gnus-configure-windows 'article)
6506 (select-window (get-buffer-window gnus-article-buffer))))
6508 (defun gnus-summary-universal-argument (arg)
6509 "Perform any operation on all articles that are process/prefixed."
6511 (let ((articles (gnus-summary-work-articles arg))
6518 (substitute-command-keys
6519 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6521 (gnus-error 1 "Undefined key")
6524 (gnus-summary-goto-subject (setq article (pop articles)))
6525 (let (gnus-newsgroup-processable)
6526 (command-execute func))
6527 (gnus-summary-remove-process-mark article)))))
6528 (gnus-summary-position-point))
6530 (defun gnus-summary-toggle-truncation (&optional arg)
6531 "Toggle truncation of summary lines.
6532 With ARG, turn line truncation on if ARG is positive."
6534 (setq truncate-lines
6535 (if (null arg) (not truncate-lines)
6536 (> (prefix-numeric-value arg) 0)))
6539 (defun gnus-summary-find-for-reselect ()
6540 "Return the number of an article to stay on across a reselect.
6541 The current article is considered, then following articles, then previous
6542 articles. An article is sought which is not cancelled and isn't a temporary
6543 insertion from another group. If there's no such then return a dummy 0."
6545 (dolist (rev '(nil t))
6546 (unless found ; don't demand the reverse list if we don't need it
6547 (let ((data (gnus-data-find-list
6548 (gnus-summary-article-number) (gnus-data-list rev))))
6549 (while (and data (not found))
6550 (if (and (< 0 (gnus-data-number (car data)))
6551 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6552 (setq found (gnus-data-number (car data))))
6553 (setq data (cdr data))))))
6556 (defun gnus-summary-reselect-current-group (&optional all rescan)
6557 "Exit and then reselect the current newsgroup.
6558 The prefix argument ALL means to select all articles."
6560 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6561 (error "Ephemeral groups can't be reselected"))
6562 (let ((current-subject (gnus-summary-find-for-reselect))
6563 (group gnus-newsgroup-name))
6564 (setq gnus-newsgroup-begin nil)
6565 (gnus-summary-exit nil 'leave-hidden)
6566 ;; We have to adjust the point of group mode buffer because
6567 ;; point was moved to the next unread newsgroup by exiting.
6568 (gnus-summary-jump-to-group group)
6571 (gnus-group-get-new-news-this-group 1)))
6572 (gnus-group-read-group all t)
6573 (gnus-summary-goto-subject current-subject nil t)))
6575 (defun gnus-summary-rescan-group (&optional all)
6576 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6578 (gnus-summary-reselect-current-group all t))
6580 (defun gnus-summary-update-info (&optional non-destructive)
6582 (let ((group gnus-newsgroup-name))
6584 (when gnus-newsgroup-kill-headers
6585 (setq gnus-newsgroup-killed
6586 (gnus-compress-sequence
6588 (gnus-list-range-intersection
6589 gnus-newsgroup-unselected gnus-newsgroup-killed)
6590 gnus-newsgroup-unreads)
6592 (unless (listp (cdr gnus-newsgroup-killed))
6593 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6594 (let ((headers gnus-newsgroup-headers))
6595 ;; Set the new ranges of read articles.
6596 (with-current-buffer gnus-group-buffer
6597 (gnus-undo-force-boundary))
6598 (gnus-update-read-articles
6599 group (gnus-sorted-union
6600 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6601 ;; Set the current article marks.
6602 (let ((gnus-newsgroup-scored
6603 (if (and (not gnus-save-score)
6604 (not non-destructive))
6606 gnus-newsgroup-scored)))
6608 (gnus-update-marks)))
6609 ;; Do the cross-ref thing.
6610 (when gnus-use-cross-reference
6611 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6612 ;; Do not switch windows but change the buffer to work.
6613 (set-buffer gnus-group-buffer)
6614 (unless (gnus-ephemeral-group-p group)
6615 (gnus-group-update-group group)))))))
6617 (defun gnus-summary-save-newsrc (&optional force)
6618 "Save the current number of read/marked articles in the dribble buffer.
6619 The dribble buffer will then be saved.
6620 If FORCE (the prefix), also save the .newsrc file(s)."
6622 (gnus-summary-update-info t)
6624 (gnus-save-newsrc-file)
6625 (gnus-dribble-save)))
6627 (defun gnus-summary-exit (&optional temporary leave-hidden)
6628 "Exit reading current newsgroup, and then return to group selection mode.
6629 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6631 (gnus-set-global-variables)
6632 (when (gnus-buffer-live-p gnus-article-buffer)
6634 (set-buffer gnus-article-buffer)
6635 (mm-destroy-parts gnus-article-mime-handles)
6636 ;; Set it to nil for safety reason.
6637 (setq gnus-article-mime-handle-alist nil)
6638 (setq gnus-article-mime-handles nil)))
6639 (gnus-kill-save-kill-buffer)
6640 (gnus-async-halt-prefetch)
6641 (let* ((group gnus-newsgroup-name)
6642 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6643 (gnus-group-is-exiting-p t)
6646 (buf (current-buffer)))
6648 ;; Do adaptive scoring, and possibly save score files.
6649 (when gnus-newsgroup-adaptive
6650 (gnus-score-adaptive))
6651 (when gnus-use-scoring
6653 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6654 ;; If we have several article buffers, we kill them at exit.
6655 (unless gnus-single-article-buffer
6656 (gnus-kill-buffer gnus-original-article-buffer)
6657 (setq gnus-article-current nil))
6658 (when gnus-use-cache
6659 (gnus-cache-possibly-remove-articles)
6660 (gnus-cache-save-buffers))
6661 (gnus-async-prefetch-remove-group group)
6662 (when gnus-suppress-duplicates
6663 (gnus-dup-enter-articles))
6664 (when gnus-use-trees
6665 (gnus-tree-close group))
6666 (when gnus-use-cache
6667 (gnus-cache-write-active))
6668 ;; Remove entries for this group.
6669 (nnmail-purge-split-history (gnus-group-real-name group))
6670 ;; Make all changes in this group permanent.
6672 (gnus-run-hooks 'gnus-exit-group-hook)
6673 (gnus-summary-update-info))
6674 (gnus-close-group group)
6675 ;; Make sure where we were, and go to next newsgroup.
6676 (set-buffer gnus-group-buffer)
6678 (gnus-group-jump-to-group group))
6679 (gnus-run-hooks 'gnus-summary-exit-hook)
6680 (unless (or quit-config
6681 ;; If this group has disappeared from the summary
6682 ;; buffer, don't skip forwards.
6683 (not (string= group (gnus-group-group-name))))
6684 (gnus-group-next-unread-group 1))
6685 (setq group-point (point))
6688 ;; If we have several article buffers, we kill them at exit.
6689 (unless gnus-single-article-buffer
6690 (gnus-kill-buffer gnus-article-buffer)
6691 (gnus-kill-buffer gnus-original-article-buffer)
6692 (setq gnus-article-current nil))
6694 (if (not gnus-kill-summary-on-exit)
6696 (gnus-deaden-summary)
6698 ;; We set all buffer-local variables to nil. It is unclear why
6699 ;; this is needed, but if we don't, buffer-local variables are
6700 ;; not garbage-collected, it seems. This would the lead to en
6701 ;; ever-growing Emacs.
6702 (gnus-summary-clear-local-variables)
6703 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6704 (gnus-summary-clear-local-variables))
6705 (when (get-buffer gnus-article-buffer)
6706 (bury-buffer gnus-article-buffer))
6707 ;; We clear the global counterparts of the buffer-local
6708 ;; variables as well, just to be on the safe side.
6709 (set-buffer gnus-group-buffer)
6710 (gnus-summary-clear-local-variables)
6711 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6712 (gnus-summary-clear-local-variables))
6713 ;; Return to group mode buffer.
6714 (when (eq mode 'gnus-summary-mode)
6715 (gnus-kill-buffer buf)))
6716 (setq gnus-current-select-method gnus-select-method)
6718 (set-buffer gnus-group-buffer)
6719 (pop-to-buffer gnus-group-buffer))
6720 (if (not quit-config)
6722 (goto-char group-point)
6723 (unless leave-hidden
6724 (gnus-configure-windows 'group 'force)))
6725 (gnus-handle-ephemeral-exit quit-config))
6726 ;; Clear the current group name.
6728 (setq gnus-newsgroup-name nil)))))
6730 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6731 (defun gnus-summary-exit-no-update (&optional no-questions)
6732 "Quit reading current newsgroup without updating read article info."
6734 (let* ((group gnus-newsgroup-name)
6735 (gnus-group-is-exiting-p t)
6736 (gnus-group-is-exiting-without-update-p t)
6737 (quit-config (gnus-group-quit-config group)))
6738 (when (or no-questions
6740 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6741 (gnus-async-halt-prefetch)
6742 (run-hooks 'gnus-summary-prepare-exit-hook)
6743 (when (gnus-buffer-live-p gnus-article-buffer)
6745 (set-buffer gnus-article-buffer)
6746 (mm-destroy-parts gnus-article-mime-handles)
6747 ;; Set it to nil for safety reason.
6748 (setq gnus-article-mime-handle-alist nil)
6749 (setq gnus-article-mime-handles nil)))
6750 ;; If we have several article buffers, we kill them at exit.
6751 (unless gnus-single-article-buffer
6752 (gnus-kill-buffer gnus-article-buffer)
6753 (gnus-kill-buffer gnus-original-article-buffer)
6754 (setq gnus-article-current nil))
6755 (if (not gnus-kill-summary-on-exit)
6756 (gnus-deaden-summary)
6757 (gnus-close-group group)
6758 (gnus-summary-clear-local-variables)
6759 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6760 (gnus-summary-clear-local-variables))
6761 (set-buffer gnus-group-buffer)
6762 (gnus-summary-clear-local-variables)
6763 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6764 (gnus-summary-clear-local-variables))
6765 (gnus-kill-buffer gnus-summary-buffer))
6766 (unless gnus-single-article-buffer
6767 (setq gnus-article-current nil))
6768 (when gnus-use-trees
6769 (gnus-tree-close group))
6770 (gnus-async-prefetch-remove-group group)
6771 (when (get-buffer gnus-article-buffer)
6772 (bury-buffer gnus-article-buffer))
6773 ;; Return to the group buffer.
6774 (gnus-configure-windows 'group 'force)
6775 ;; Clear the current group name.
6776 (setq gnus-newsgroup-name nil)
6777 (unless (gnus-ephemeral-group-p group)
6778 (gnus-group-update-group group))
6779 (when (equal (gnus-group-group-name) group)
6780 (gnus-group-next-unread-group 1))
6782 (gnus-handle-ephemeral-exit quit-config)))))
6784 (defun gnus-handle-ephemeral-exit (quit-config)
6785 "Handle movement when leaving an ephemeral group.
6786 The state which existed when entering the ephemeral is reset."
6787 (if (not (buffer-name (car quit-config)))
6788 (gnus-configure-windows 'group 'force)
6789 (set-buffer (car quit-config))
6790 (cond ((eq major-mode 'gnus-summary-mode)
6791 (gnus-set-global-variables))
6792 ((eq major-mode 'gnus-article-mode)
6794 ;; The `gnus-summary-buffer' variable may point
6795 ;; to the old summary buffer when using a single
6797 (unless (gnus-buffer-live-p gnus-summary-buffer)
6798 (set-buffer gnus-group-buffer))
6799 (set-buffer gnus-summary-buffer)
6800 (gnus-set-global-variables))))
6801 (if (or (eq (cdr quit-config) 'article)
6802 (eq (cdr quit-config) 'pick))
6804 ;; The current article may be from the ephemeral group
6805 ;; thus it is best that we reload this article
6807 ;; If we're exiting from a large digest, this can be
6808 ;; extremely slow. So, it's better not to reload it. -- jh.
6809 ;;(gnus-summary-show-article)
6810 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6811 (gnus-configure-windows 'pick 'force)
6812 (gnus-configure-windows (cdr quit-config) 'force)))
6813 (gnus-configure-windows (cdr quit-config) 'force))
6814 (when (eq major-mode 'gnus-summary-mode)
6815 (gnus-summary-next-subject 1 nil t)
6816 (gnus-summary-recenter)
6817 (gnus-summary-position-point))))
6821 (defvar gnus-dead-summary-mode-map nil)
6823 (unless gnus-dead-summary-mode-map
6824 (setq gnus-dead-summary-mode-map (make-keymap))
6825 (suppress-keymap gnus-dead-summary-mode-map)
6826 (substitute-key-definition
6827 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6828 (dolist (key '("\C-d" "\r" "\177" [delete]))
6829 (define-key gnus-dead-summary-mode-map
6830 key 'gnus-summary-wake-up-the-dead))
6831 (dolist (key '("q" "Q"))
6832 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6834 (defvar gnus-dead-summary-mode nil
6835 "Minor mode for Gnus summary buffers.")
6837 (defun gnus-dead-summary-mode (&optional arg)
6838 "Minor mode for Gnus summary buffers."
6840 (when (eq major-mode 'gnus-summary-mode)
6841 (make-local-variable 'gnus-dead-summary-mode)
6842 (setq gnus-dead-summary-mode
6843 (if (null arg) (not gnus-dead-summary-mode)
6844 (> (prefix-numeric-value arg) 0)))
6845 (when gnus-dead-summary-mode
6847 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6849 (defun gnus-deaden-summary ()
6850 "Make the current summary buffer into a dead summary buffer."
6851 ;; Kill any previous dead summary buffer.
6852 (when (and gnus-dead-summary
6853 (buffer-name gnus-dead-summary))
6854 (with-current-buffer gnus-dead-summary
6855 (when gnus-dead-summary-mode
6856 (kill-buffer (current-buffer)))))
6857 ;; Make this the current dead summary.
6858 (setq gnus-dead-summary (current-buffer))
6859 (gnus-dead-summary-mode 1)
6860 (let ((name (buffer-name)))
6861 (when (string-match "Summary" name)
6863 (concat (substring name 0 (match-beginning 0)) "Dead "
6864 (substring name (match-beginning 0)))
6868 (defun gnus-kill-or-deaden-summary (buffer)
6869 "Kill or deaden the summary BUFFER."
6871 (when (and (buffer-name buffer)
6872 (not gnus-single-article-buffer))
6873 (with-current-buffer buffer
6874 (gnus-kill-buffer gnus-article-buffer)
6875 (gnus-kill-buffer gnus-original-article-buffer)))
6878 (gnus-kill-summary-on-exit
6879 (when (and gnus-use-trees
6880 (gnus-buffer-exists-p buffer))
6883 (gnus-tree-close gnus-newsgroup-name)))
6884 (gnus-kill-buffer buffer))
6885 ;; Deaden the buffer.
6886 ((gnus-buffer-exists-p buffer)
6889 (gnus-deaden-summary))))))
6891 (defun gnus-summary-wake-up-the-dead (&rest args)
6892 "Wake up the dead summary buffer."
6894 (gnus-dead-summary-mode -1)
6895 (let ((name (buffer-name)))
6896 (when (string-match "Dead " name)
6898 (concat (substring name 0 (match-beginning 0))
6899 (substring name (match-end 0)))
6901 (gnus-message 3 "This dead summary is now alive again"))
6903 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6904 (defun gnus-summary-fetch-faq (&optional faq-dir)
6905 "Fetch the FAQ for the current group.
6906 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6910 (when current-prefix-arg
6912 "FAQ dir: " (and (listp gnus-group-faq-directory)
6914 gnus-group-faq-directory))))))
6915 (let (gnus-faq-buffer)
6916 (when (setq gnus-faq-buffer
6917 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6918 (gnus-configure-windows 'summary-faq))))
6920 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6921 (defun gnus-summary-describe-group (&optional force)
6922 "Describe the current newsgroup."
6924 (gnus-group-describe-group force gnus-newsgroup-name))
6926 (defun gnus-summary-describe-briefly ()
6927 "Describe summary mode commands briefly."
6929 (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")))
6931 ;; Walking around group mode buffer from summary mode.
6933 (defun gnus-summary-next-group (&optional no-article target-group backward)
6934 "Exit current newsgroup and then select next unread newsgroup.
6935 If prefix argument NO-ARTICLE is non-nil, no article is selected
6936 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6937 previous group instead."
6939 ;; Stop pre-fetching.
6940 (gnus-async-halt-prefetch)
6941 (let ((current-group gnus-newsgroup-name)
6942 (current-buffer (current-buffer))
6944 ;; First we semi-exit this group to update Xrefs and all variables.
6945 ;; We can't do a real exit, because the window conf must remain
6946 ;; the same in case the user is prompted for info, and we don't
6947 ;; want the window conf to change before that...
6948 (gnus-summary-exit t)
6949 (while (not entered)
6950 ;; Then we find what group we are supposed to enter.
6951 (set-buffer gnus-group-buffer)
6952 (gnus-group-jump-to-group current-group)
6955 (if (eq gnus-keep-same-level 'best)
6956 (gnus-summary-best-group gnus-newsgroup-name)
6957 (gnus-summary-search-group backward gnus-keep-same-level))))
6958 (if (not target-group)
6959 ;; There are no further groups, so we return to the group
6962 (gnus-message 5 "Returning to the group buffer")
6964 (when (gnus-buffer-live-p current-buffer)
6965 (set-buffer current-buffer)
6966 (gnus-summary-exit))
6967 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6968 ;; We try to enter the target group.
6969 (gnus-group-jump-to-group target-group)
6970 (let ((unreads (gnus-group-group-unread)))
6971 (if (and (or (eq t unreads)
6972 (and unreads (not (zerop unreads))))
6973 (gnus-summary-read-group
6974 target-group nil no-article
6975 (and (buffer-name current-buffer) current-buffer)
6978 (setq current-group target-group
6979 target-group nil)))))))
6981 (defun gnus-summary-prev-group (&optional no-article)
6982 "Exit current newsgroup and then select previous unread newsgroup.
6983 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6985 (gnus-summary-next-group no-article nil t))
6987 ;; Walking around summary lines.
6989 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6990 "Go to the first subject satisfying any non-nil constraint.
6991 If UNREAD is non-nil, the article should be unread.
6992 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6993 If UNSEEN is non-nil, the article should be unseen.
6994 Returns the article selected or nil if there are no matching articles."
6998 ((null gnus-newsgroup-data)
6999 (gnus-message 3 "No articles in the group")
7001 ;; Pick the first article.
7002 ((not (or unread undownloaded unseen))
7003 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7004 (gnus-data-number (car gnus-newsgroup-data)))
7005 ;; Find the first unread article.
7007 (let ((data gnus-newsgroup-data))
7009 (let ((num (gnus-data-number (car data))))
7010 (or (memq num gnus-newsgroup-unfetched)
7011 (not (or (and unread
7012 (memq num gnus-newsgroup-unreads))
7014 (memq num gnus-newsgroup-undownloaded))
7016 (memq num gnus-newsgroup-unseen)))))))
7017 (setq data (cdr data)))
7021 (goto-char (gnus-data-pos (car data)))
7022 (gnus-data-number (car data)))
7023 (gnus-message 3 "No more%s articles"
7024 (let* ((r (when unread " unread"))
7025 (d (when undownloaded " undownloaded"))
7026 (s (when unseen " unseen"))
7027 (l (delq nil (list r d s))))
7028 (cond ((= 3 (length l))
7029 (concat r "," d ", or" s))
7031 (concat (car l) ", or" (cadr l)))
7038 (gnus-summary-position-point))))))
7040 (defun gnus-summary-next-subject (n &optional unread dont-display)
7041 "Go to next N'th summary line.
7042 If N is negative, go to the previous N'th subject line.
7043 If UNREAD is non-nil, only unread articles are selected.
7044 The difference between N and the actual number of steps taken is
7047 (let ((backward (< n 0))
7051 (gnus-summary-find-prev unread)
7052 (gnus-summary-find-next unread)))
7053 (unless (zerop (setq n (1- n)))
7054 (gnus-summary-show-thread)))
7056 (gnus-message 7 "No more%s articles"
7057 (if unread " unread" "")))
7058 (unless dont-display
7059 (gnus-summary-recenter)
7060 (gnus-summary-position-point))
7063 (defun gnus-summary-next-unread-subject (n)
7064 "Go to next N'th unread summary line."
7066 (gnus-summary-next-subject n t))
7068 (defun gnus-summary-prev-subject (n &optional unread)
7069 "Go to previous N'th summary line.
7070 If optional argument UNREAD is non-nil, only unread article is selected."
7072 (gnus-summary-next-subject (- n) unread))
7074 (defun gnus-summary-prev-unread-subject (n)
7075 "Go to previous N'th unread summary line."
7077 (gnus-summary-next-subject (- n) t))
7079 (defun gnus-summary-goto-subjects (articles)
7080 "Insert the subject header for ARTICLES in the current buffer."
7082 (dolist (article articles)
7083 (gnus-summary-goto-subject article t)))
7084 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7085 (gnus-summary-position-point))
7087 (defun gnus-summary-goto-subject (article &optional force silent)
7088 "Go the subject line of ARTICLE.
7089 If FORCE, also allow jumping to articles not currently shown."
7090 (interactive "nArticle number: ")
7091 (unless (numberp article)
7092 (error "Article %s is not a number" article))
7094 (data (gnus-data-find article)))
7095 ;; We read in the article if we have to.
7098 (gnus-summary-insert-subject
7100 (if (or (numberp force) (vectorp force)) force)
7102 (setq data (gnus-data-find article)))
7107 (gnus-message 3 "Can't find article %d" article))
7109 (let ((pt (gnus-data-pos data)))
7111 (gnus-summary-set-article-display-arrow pt))
7112 (gnus-summary-position-point)
7115 ;; Walking around summary lines with displaying articles.
7117 (defun gnus-summary-expand-window (&optional arg)
7118 "Make the summary buffer take up the entire Emacs frame.
7119 Given a prefix, will force an `article' buffer configuration."
7122 (gnus-configure-windows 'article 'force)
7123 (gnus-configure-windows 'summary 'force)))
7125 (defun gnus-summary-display-article (article &optional all-header)
7126 "Display ARTICLE in article buffer."
7127 (when (gnus-buffer-live-p gnus-article-buffer)
7128 (with-current-buffer gnus-article-buffer
7129 (mm-enable-multibyte)))
7130 (gnus-set-global-variables)
7131 (when (gnus-buffer-live-p gnus-article-buffer)
7132 (with-current-buffer gnus-article-buffer
7133 (setq gnus-article-charset gnus-newsgroup-charset)
7134 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7135 (mm-enable-multibyte)))
7139 (if gnus-summary-display-article-function
7140 (funcall gnus-summary-display-article-function article all-header)
7141 (gnus-article-prepare article all-header))
7142 (gnus-run-hooks 'gnus-select-article-hook)
7143 (when (and gnus-current-article
7144 (not (zerop gnus-current-article)))
7145 (gnus-summary-goto-subject gnus-current-article))
7146 (gnus-summary-recenter)
7147 (when (and gnus-use-trees gnus-show-threads)
7148 (gnus-possibly-generate-tree article)
7149 (gnus-highlight-selected-tree article))
7150 ;; Successfully display article.
7151 (gnus-article-set-window-start
7152 (cdr (assq article gnus-newsgroup-bookmarks))))))
7154 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7155 "Select the current article.
7156 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7157 non-nil, the article will be re-fetched even if it already present in
7158 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7160 ;; Make sure we are in the summary buffer to work around bbdb bug.
7161 (unless (eq major-mode 'gnus-summary-mode)
7162 (set-buffer gnus-summary-buffer))
7163 (let ((article (or article (gnus-summary-article-number)))
7164 (all-headers (not (not all-headers))) ;Must be t or nil.
7165 gnus-summary-display-article-function)
7167 (gnus-summary-article-pseudo-p article)
7168 (error "This is a pseudo-article"))
7170 (set-buffer gnus-summary-buffer)
7171 (if (or (and gnus-single-article-buffer
7172 (or (null gnus-current-article)
7173 (null gnus-article-current)
7174 (null (get-buffer gnus-article-buffer))
7175 (not (eq article (cdr gnus-article-current)))
7176 (not (equal (car gnus-article-current)
7177 gnus-newsgroup-name))))
7178 (and (not gnus-single-article-buffer)
7179 (or (null gnus-current-article)
7180 (not (eq gnus-current-article article))))
7182 ;; The requested article is different from the current article.
7184 (gnus-summary-display-article article all-headers)
7185 (when (gnus-buffer-live-p gnus-article-buffer)
7186 (with-current-buffer gnus-article-buffer
7187 (if (not gnus-article-decoded-p) ;; a local variable
7188 (mm-disable-multibyte))))
7189 (gnus-article-set-window-start
7190 (cdr (assq article gnus-newsgroup-bookmarks)))
7194 (defun gnus-summary-force-verify-and-decrypt ()
7195 "Display buttons for signed/encrypted parts and verify/decrypt them."
7197 (let ((mm-verify-option 'known)
7198 (mm-decrypt-option 'known)
7199 (gnus-article-emulate-mime t)
7200 (gnus-buttonized-mime-types (append (list "multipart/signed"
7201 "multipart/encrypted")
7202 gnus-buttonized-mime-types)))
7203 (gnus-summary-select-article nil 'force)))
7205 (defun gnus-summary-set-current-mark (&optional current-mark)
7206 "Obsolete function."
7209 (defun gnus-summary-next-article (&optional unread subject backward push)
7210 "Select the next article.
7211 If UNREAD, only unread articles are selected.
7212 If SUBJECT, only articles with SUBJECT are selected.
7213 If BACKWARD, the previous article is selected instead of the next."
7216 ;; Is there such an article?
7217 ((and (gnus-summary-search-forward unread subject backward)
7218 (or (gnus-summary-display-article (gnus-summary-article-number))
7219 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7220 (gnus-summary-position-point))
7221 ;; If not, we try the first unread, if that is wanted.
7223 gnus-auto-select-same
7224 (gnus-summary-first-unread-article))
7225 (gnus-summary-position-point)
7226 (gnus-message 6 "Wrapped"))
7227 ;; Try to get next/previous article not displayed in this group.
7228 ((and gnus-auto-extend-newsgroup
7229 (not unread) (not subject))
7230 (gnus-summary-goto-article
7231 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7232 nil (count-lines (point-min) (point))))
7233 ;; Go to next/previous group.
7235 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7236 (gnus-summary-jump-to-group gnus-newsgroup-name))
7237 (let ((cmd last-command-char)
7239 (with-current-buffer gnus-group-buffer
7242 (if (eq gnus-keep-same-level 'best)
7243 (gnus-summary-best-group gnus-newsgroup-name)
7244 (gnus-summary-search-group backward gnus-keep-same-level))))
7245 ;; For some reason, the group window gets selected. We change
7247 (select-window (get-buffer-window (current-buffer)))
7248 ;; Select next unread newsgroup automagically.
7250 ((or (not gnus-auto-select-next)
7252 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7253 ((or (eq gnus-auto-select-next 'quietly)
7254 (and (eq gnus-auto-select-next 'slightly-quietly)
7256 (and (eq gnus-auto-select-next 'almost-quietly)
7257 (gnus-summary-last-article-p)))
7259 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7261 (gnus-message 7 "No more%s articles (%s)..."
7262 (if unread " unread" "")
7263 (if group (concat "selecting " group)
7265 (gnus-summary-next-group nil group backward)))
7267 (when (gnus-key-press-event-p last-input-event)
7268 (gnus-summary-walk-group-buffer
7269 gnus-newsgroup-name cmd unread backward point))))))))
7271 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7272 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7273 (?\C-p (gnus-group-prev-unread-group 1))))
7274 (cursor-in-echo-area t)
7275 keve key group ended prompt)
7277 (set-buffer gnus-group-buffer)
7280 (if (eq gnus-keep-same-level 'best)
7281 (gnus-summary-best-group gnus-newsgroup-name)
7282 (gnus-summary-search-group backward gnus-keep-same-level))))
7286 "No more%s articles%s " (if unread " unread" "")
7288 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7289 (format " (Type %s for %s [%s])"
7290 (single-key-description cmd) group
7291 (gnus-group-unread group))
7292 (format " (Type %s to exit %s)"
7293 (single-key-description cmd)
7294 gnus-newsgroup-name))))
7295 ;; Confirm auto selection.
7296 (setq key (car (setq keve (gnus-read-event-char prompt)))
7299 ((assq key keystrokes)
7300 (let ((obuf (current-buffer)))
7301 (switch-to-buffer gnus-group-buffer)
7303 (gnus-group-jump-to-group group))
7304 (eval (cadr (assq key keystrokes)))
7305 (setq group (gnus-group-group-name))
7306 (switch-to-buffer obuf))
7310 (gnus-ephemeral-group-p gnus-newsgroup-name))
7312 (gnus-summary-next-group nil group backward)))
7314 (push (cdr keve) unread-command-events))))))
7316 (defun gnus-summary-next-unread-article ()
7317 "Select unread article after current one."
7319 (gnus-summary-next-article
7320 (or (not (eq gnus-summary-goto-unread 'never))
7321 (gnus-summary-last-article-p (gnus-summary-article-number)))
7322 (and gnus-auto-select-same
7323 (gnus-summary-article-subject))))
7325 (defun gnus-summary-prev-article (&optional unread subject)
7326 "Select the article after the current one.
7327 If UNREAD is non-nil, only unread articles are selected."
7329 (gnus-summary-next-article unread subject t))
7331 (defun gnus-summary-prev-unread-article ()
7332 "Select unread article before current one."
7334 (gnus-summary-prev-article
7335 (or (not (eq gnus-summary-goto-unread 'never))
7336 (gnus-summary-first-article-p (gnus-summary-article-number)))
7337 (and gnus-auto-select-same
7338 (gnus-summary-article-subject))))
7340 (defun gnus-summary-next-page (&optional lines circular stop)
7341 "Show next page of the selected article.
7342 If at the end of the current article, select the next article.
7343 LINES says how many lines should be scrolled up.
7345 If CIRCULAR is non-nil, go to the start of the article instead of
7346 selecting the next article when reaching the end of the current
7349 If STOP is non-nil, just stop when reaching the end of the message.
7351 Also see the variable `gnus-article-skip-boring'."
7353 (setq gnus-summary-buffer (current-buffer))
7354 (gnus-set-global-variables)
7355 (let ((article (gnus-summary-article-number))
7356 (article-window (get-buffer-window gnus-article-buffer t))
7358 ;; If the buffer is empty, we have no article.
7360 (error "No article to select"))
7361 (gnus-configure-windows 'article)
7362 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7363 (if (and (eq gnus-summary-goto-unread 'never)
7364 (not (gnus-summary-last-article-p article)))
7365 (gnus-summary-next-article)
7366 (gnus-summary-next-unread-article))
7367 (if (or (null gnus-current-article)
7368 (null gnus-article-current)
7369 (/= article (cdr gnus-article-current))
7370 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7371 ;; Selected subject is different from current article's.
7372 (gnus-summary-display-article article)
7373 (when article-window
7374 (gnus-eval-in-buffer-window gnus-article-buffer
7375 (setq endp (or (gnus-article-next-page lines)
7376 (gnus-article-only-boring-p))))
7379 (gnus-message 3 "End of message"))
7381 (gnus-summary-beginning-of-article))
7383 (gnus-message 3 "End of message"))
7385 (if (and (eq gnus-summary-goto-unread 'never)
7386 (not (gnus-summary-last-article-p article)))
7387 (gnus-summary-next-article)
7388 (gnus-summary-next-unread-article))))))))
7389 (gnus-summary-recenter)
7390 (gnus-summary-position-point)))
7392 (defun gnus-summary-prev-page (&optional lines move)
7393 "Show previous page of selected article.
7394 Argument LINES specifies lines to be scrolled down.
7395 If MOVE, move to the previous unread article if point is at
7396 the beginning of the buffer."
7398 (let ((article (gnus-summary-article-number))
7399 (article-window (get-buffer-window gnus-article-buffer t))
7401 (gnus-configure-windows 'article)
7402 (if (or (null gnus-current-article)
7403 (null gnus-article-current)
7404 (/= article (cdr gnus-article-current))
7405 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7406 ;; Selected subject is different from current article's.
7407 (gnus-summary-display-article article)
7408 (gnus-summary-recenter)
7409 (when article-window
7410 (gnus-eval-in-buffer-window gnus-article-buffer
7411 (setq endp (gnus-article-prev-page lines)))
7412 (when (and move endp)
7414 (gnus-message 3 "Beginning of message"))
7416 (if (and (eq gnus-summary-goto-unread 'never)
7417 (not (gnus-summary-first-article-p article)))
7418 (gnus-summary-prev-article)
7419 (gnus-summary-prev-unread-article))))))))
7420 (gnus-summary-position-point))
7422 (defun gnus-summary-prev-page-or-article (&optional lines)
7423 "Show previous page of selected article.
7424 Argument LINES specifies lines to be scrolled down.
7425 If at the beginning of the article, go to the next article."
7427 (gnus-summary-prev-page lines t))
7429 (defun gnus-summary-scroll-up (lines)
7430 "Scroll up (or down) one line current article.
7431 Argument LINES specifies lines to be scrolled up (or down if negative)."
7433 (gnus-configure-windows 'article)
7434 (gnus-summary-show-thread)
7435 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7436 (gnus-eval-in-buffer-window gnus-article-buffer
7438 (when (gnus-article-next-page lines)
7439 (gnus-message 3 "End of message")))
7441 (gnus-article-prev-page (- lines))))))
7442 (gnus-summary-recenter)
7443 (gnus-summary-position-point))
7445 (defun gnus-summary-scroll-down (lines)
7446 "Scroll down (or up) one line current article.
7447 Argument LINES specifies lines to be scrolled down (or up if negative)."
7449 (gnus-summary-scroll-up (- lines)))
7451 (defun gnus-summary-next-same-subject ()
7452 "Select next article which has the same subject as current one."
7454 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7456 (defun gnus-summary-prev-same-subject ()
7457 "Select previous article which has the same subject as current one."
7459 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7461 (defun gnus-summary-next-unread-same-subject ()
7462 "Select next unread article which has the same subject as current one."
7464 (gnus-summary-next-article t (gnus-summary-article-subject)))
7466 (defun gnus-summary-prev-unread-same-subject ()
7467 "Select previous unread article which has the same subject as current one."
7469 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7471 (defun gnus-summary-first-unread-article ()
7472 "Select the first unread article.
7473 Return nil if there are no unread articles."
7476 (when (gnus-summary-first-subject t)
7477 (gnus-summary-show-thread)
7478 (gnus-summary-first-subject t)
7479 (gnus-summary-display-article (gnus-summary-article-number)))
7480 (gnus-summary-position-point)))
7482 (defun gnus-summary-first-unread-subject ()
7483 "Place the point on the subject line of the first unread article.
7484 Return nil if there are no unread articles."
7487 (when (gnus-summary-first-subject t)
7488 (gnus-summary-show-thread)
7489 (gnus-summary-first-subject t))
7490 (gnus-summary-position-point)))
7492 (defun gnus-summary-first-unseen-subject ()
7493 "Place the point on the subject line of the first unseen article.
7494 Return nil if there are no unseen articles."
7497 (when (gnus-summary-first-subject nil nil t)
7498 (gnus-summary-show-thread)
7499 (gnus-summary-first-subject nil nil t))
7500 (gnus-summary-position-point)))
7502 (defun gnus-summary-first-unseen-or-unread-subject ()
7503 "Place the point on the subject line of the first unseen article or,
7504 if all article have been seen, on the subject line of the first unread
7508 (unless (when (gnus-summary-first-subject nil nil t)
7509 (gnus-summary-show-thread)
7510 (gnus-summary-first-subject nil nil t))
7511 (when (gnus-summary-first-subject t)
7512 (gnus-summary-show-thread)
7513 (gnus-summary-first-subject t)))
7514 (gnus-summary-position-point)))
7516 (defun gnus-summary-first-article ()
7517 "Select the first article.
7518 Return nil if there are no articles."
7521 (when (gnus-summary-first-subject)
7522 (gnus-summary-show-thread)
7523 (gnus-summary-first-subject)
7524 (gnus-summary-display-article (gnus-summary-article-number)))
7525 (gnus-summary-position-point)))
7527 (defun gnus-summary-best-unread-article (&optional arg)
7528 "Select the unread article with the highest score.
7529 If given a prefix argument, select the next unread article that has a
7530 score higher than the default score."
7532 (let ((article (if arg
7533 (gnus-summary-better-unread-subject)
7534 (gnus-summary-best-unread-subject))))
7536 (gnus-summary-goto-article article)
7537 (error "No unread articles"))))
7539 (defun gnus-summary-best-unread-subject ()
7540 "Select the unread subject with the highest score."
7542 (let ((best -1000000)
7543 (data gnus-newsgroup-data)
7546 (and (gnus-data-unread-p (car data))
7548 (gnus-summary-article-score (gnus-data-number (car data))))
7551 article (gnus-data-number (car data))))
7552 (setq data (cdr data)))
7554 (gnus-summary-goto-subject article))
7555 (gnus-summary-position-point)
7558 (defun gnus-summary-better-unread-subject ()
7559 "Select the first unread subject that has a score over the default score."
7561 (let ((data gnus-newsgroup-data)
7563 (while (and (setq article (gnus-data-number (car data)))
7564 (or (gnus-data-read-p (car data))
7565 (not (> (gnus-summary-article-score article)
7566 gnus-summary-default-score))))
7567 (setq data (cdr data)))
7569 (gnus-summary-goto-subject article))
7570 (gnus-summary-position-point)
7573 (defun gnus-summary-last-subject ()
7574 "Go to the last displayed subject line in the group."
7575 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7577 (gnus-summary-goto-subject article))))
7579 (defun gnus-summary-goto-article (article &optional all-headers force)
7580 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7581 If ALL-HEADERS is non-nil, no header lines are hidden.
7582 If FORCE, go to the article even if it isn't displayed. If FORCE
7583 is a number, it is the line the article is to be displayed on."
7587 "Article number or Message-ID: "
7588 (mapcar (lambda (number) (list (int-to-string number)))
7589 gnus-newsgroup-limit))
7593 (if (and (stringp article)
7594 (string-match "@\\|%40" article))
7595 (gnus-summary-refer-article article)
7596 (when (stringp article)
7597 (setq article (string-to-number article)))
7598 (if (gnus-summary-goto-subject article force)
7599 (gnus-summary-display-article article all-headers)
7600 (gnus-message 4 "Couldn't go to article %s" article) nil))
7601 (gnus-summary-position-point)))
7603 (defun gnus-summary-goto-last-article ()
7604 "Go to the previously read article."
7607 (when gnus-last-article
7608 (gnus-summary-goto-article gnus-last-article nil t))
7609 (gnus-summary-position-point)))
7611 (defun gnus-summary-pop-article (number)
7612 "Pop one article off the history and go to the previous.
7613 NUMBER articles will be popped off."
7616 (setq gnus-newsgroup-history
7617 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7619 (gnus-summary-goto-article (car to) nil t)
7620 (error "Article history empty")))
7621 (gnus-summary-position-point))
7623 ;; Summary commands and functions for limiting the summary buffer.
7625 (defun gnus-summary-limit-to-articles (n)
7626 "Limit the summary buffer to the next N articles.
7627 If not given a prefix, use the process marked articles instead."
7630 (let ((articles (gnus-summary-work-articles n)))
7631 (setq gnus-newsgroup-processable nil)
7632 (gnus-summary-limit articles))
7633 (gnus-summary-position-point)))
7635 (defun gnus-summary-pop-limit (&optional total)
7636 "Restore the previous limit.
7637 If given a prefix, remove all limits."
7640 (setq gnus-newsgroup-limits
7641 (list (mapcar (lambda (h) (mail-header-number h))
7642 gnus-newsgroup-headers))))
7643 (unless gnus-newsgroup-limits
7644 (error "No limit to pop"))
7646 (gnus-summary-limit nil 'pop)
7647 (gnus-summary-position-point)))
7649 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7650 "Limit the summary buffer to articles that have subjects that match a regexp.
7651 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7653 (list (read-string (if current-prefix-arg
7654 "Exclude subject (regexp): "
7655 "Limit to subject (regexp): "))
7656 nil current-prefix-arg))
7658 (setq header "subject"))
7659 (when (not (equal "" subject))
7661 (let ((articles (gnus-summary-find-matching
7662 (or header "subject") subject 'all nil nil
7665 (error "Found no matches for \"%s\"" subject))
7666 (gnus-summary-limit articles))
7667 (gnus-summary-position-point))))
7669 (defun gnus-summary-limit-to-author (from &optional not-matching)
7670 "Limit the summary buffer to articles that have authors that match a regexp.
7671 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7673 (list (read-string (if current-prefix-arg
7674 "Exclude author (regexp): "
7675 "Limit to author (regexp): "))
7676 current-prefix-arg))
7677 (gnus-summary-limit-to-subject from "from" not-matching))
7679 (defun gnus-summary-limit-to-age (age &optional younger-p)
7680 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7681 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7682 articles that are younger than AGE days."
7684 (let ((younger current-prefix-arg)
7687 (while (not days-got)
7688 (setq days (if younger
7689 (read-string "Limit to articles younger than (in days, older when negative): ")
7691 "Limit to articles older than (in days, younger when negative): ")))
7692 (when (> (length days) 0)
7693 (setq days (read days)))
7698 (setq younger (not younger))
7699 (setq days (* days -1))))
7700 (message "Please enter a number.")
7702 (list days younger)))
7704 (let ((data gnus-newsgroup-data)
7705 (cutoff (days-to-time age))
7706 articles d date is-younger)
7707 (while (setq d (pop data))
7708 (when (and (vectorp (gnus-data-header d))
7709 (setq date (mail-header-date (gnus-data-header d))))
7710 (setq is-younger (time-less-p
7711 (time-since (condition-case ()
7718 (push (gnus-data-number d) articles))))
7719 (gnus-summary-limit (nreverse articles)))
7720 (gnus-summary-position-point)))
7722 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7723 "Limit the summary buffer to articles that match an 'extra' header."
7727 (gnus-completing-read-with-default
7728 (symbol-name (car gnus-extra-headers))
7729 (if current-prefix-arg
7730 "Exclude extra header:"
7731 "Limit extra header:")
7733 (cons (symbol-name x) x))
7738 (read-string (format "%s header %s (regexp): "
7739 (if current-prefix-arg "Exclude" "Limit to")
7741 current-prefix-arg)))
7742 (when (not (equal "" regexp))
7744 (let ((articles (gnus-summary-find-matching
7745 (cons 'extra header) regexp 'all nil nil
7748 (error "Found no matches for \"%s\"" regexp))
7749 (gnus-summary-limit articles))
7750 (gnus-summary-position-point))))
7752 (defun gnus-summary-limit-to-display-predicate ()
7753 "Limit the summary buffer to the predicated in the `display' group parameter."
7755 (unless gnus-newsgroup-display
7756 (error "There is no `display' group parameter"))
7758 (dolist (number gnus-newsgroup-articles)
7759 (when (funcall gnus-newsgroup-display)
7760 (push number articles)))
7761 (gnus-summary-limit articles))
7762 (gnus-summary-position-point))
7764 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7766 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7768 (defun gnus-summary-limit-to-unread (&optional all)
7769 "Limit the summary buffer to articles that are not marked as read.
7770 If ALL is non-nil, limit strictly to unread articles."
7773 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7774 (gnus-summary-limit-to-marks
7775 ;; Concat all the marks that say that an article is read and have
7777 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7778 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7779 gnus-low-score-mark gnus-expirable-mark
7780 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7781 gnus-duplicate-mark gnus-souped-mark)
7784 (defun gnus-summary-limit-to-replied (&optional unreplied)
7785 "Limit the summary buffer to replied articles.
7786 If UNREPLIED (the prefix), limit to unreplied articles."
7790 (gnus-set-difference gnus-newsgroup-articles
7791 gnus-newsgroup-replied))
7792 (gnus-summary-limit gnus-newsgroup-replied))
7793 (gnus-summary-position-point))
7795 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7796 (make-obsolete 'gnus-summary-delete-marked-with
7797 'gnus-summary-limit-exclude-marks)
7799 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7800 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7801 If REVERSE, limit the summary buffer to articles that are marked
7802 with MARKS. MARKS can either be a string of marks or a list of marks.
7803 Returns how many articles were removed."
7804 (interactive "sMarks: ")
7805 (gnus-summary-limit-to-marks marks t))
7807 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7808 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7809 If REVERSE (the prefix), limit the summary buffer to articles that are
7810 not marked with MARKS. MARKS can either be a string of marks or a
7812 Returns how many articles were removed."
7813 (interactive "sMarks: \nP")
7815 (let ((data gnus-newsgroup-data)
7816 (marks (if (listp marks) marks
7817 (append marks nil))) ; Transform to list.
7820 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7821 (memq (gnus-data-mark (car data)) marks))
7822 (push (gnus-data-number (car data)) articles))
7823 (setq data (cdr data)))
7824 (gnus-summary-limit articles))
7825 (gnus-summary-position-point)))
7827 (defun gnus-summary-limit-to-score (score)
7828 "Limit to articles with score at or above SCORE."
7829 (interactive "NLimit to articles with score of at least: ")
7830 (let ((data gnus-newsgroup-data)
7833 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7835 (push (gnus-data-number (car data)) articles))
7836 (setq data (cdr data)))
7838 (gnus-summary-limit articles)
7839 (gnus-summary-position-point))))
7841 (defun gnus-summary-limit-to-unseen ()
7842 "Limit to unseen articles."
7845 (gnus-summary-limit gnus-newsgroup-unseen)
7846 (gnus-summary-position-point)))
7848 (defun gnus-summary-limit-include-thread (id)
7849 "Display all the hidden articles that is in the thread with ID in it.
7850 When called interactively, ID is the Message-ID of the current
7852 (interactive (list (mail-header-id (gnus-summary-article-header))))
7853 (let ((articles (gnus-articles-in-thread
7854 (gnus-id-to-thread (gnus-root-id id)))))
7856 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7857 (gnus-summary-limit-include-matching-articles
7859 (regexp-quote (gnus-simplify-subject-re
7860 (mail-header-subject (gnus-id-to-header id)))))
7861 (gnus-summary-position-point))))
7863 (defun gnus-summary-limit-include-matching-articles (header regexp)
7864 "Display all the hidden articles that have HEADERs that match REGEXP."
7865 (interactive (list (read-string "Match on header: ")
7866 (read-string "Regexp: ")))
7867 (let ((articles (gnus-find-matching-articles header regexp)))
7869 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7870 (gnus-summary-position-point))))
7872 (defun gnus-summary-insert-dormant-articles ()
7873 "Insert all the dormant articles for this group into the current buffer."
7875 (let ((gnus-verbose (max 6 gnus-verbose)))
7876 (if (not gnus-newsgroup-dormant)
7877 (gnus-message 3 "No cached articles for this group")
7878 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7880 (defun gnus-summary-limit-include-dormant ()
7881 "Display all the hidden articles that are marked as dormant.
7882 Note that this command only works on a subset of the articles currently
7883 fetched for this group."
7885 (unless gnus-newsgroup-dormant
7886 (error "There are no dormant articles in this group"))
7888 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7889 (gnus-summary-position-point)))
7891 (defun gnus-summary-limit-exclude-dormant ()
7892 "Hide all dormant articles."
7895 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7896 (gnus-summary-position-point)))
7898 (defun gnus-summary-limit-exclude-childless-dormant ()
7899 "Hide all dormant articles that have no children."
7901 (let ((data (gnus-data-list t))
7902 articles d children)
7903 ;; Find all articles that are either not dormant or have
7905 (while (setq d (pop data))
7906 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7908 (gnus-article-children (gnus-data-number d)))
7911 (when (memq (car children) articles)
7916 (push (gnus-data-number d) articles)))
7919 (gnus-summary-limit articles)
7920 (gnus-summary-position-point))))
7922 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7923 "Mark all unread excluded articles as read.
7924 If ALL, mark even excluded ticked and dormants as read."
7926 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7927 (let ((articles (gnus-sorted-ndifference
7929 (mapcar (lambda (h) (mail-header-number h))
7930 gnus-newsgroup-headers)
7932 gnus-newsgroup-limit))
7934 (setq gnus-newsgroup-unreads
7935 (gnus-sorted-intersection gnus-newsgroup-unreads
7936 gnus-newsgroup-limit))
7938 (setq gnus-newsgroup-dormant nil
7939 gnus-newsgroup-marked nil
7940 gnus-newsgroup-reads
7942 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7943 gnus-newsgroup-reads))
7944 (while (setq article (pop articles))
7945 (unless (or (memq article gnus-newsgroup-dormant)
7946 (memq article gnus-newsgroup-marked))
7947 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7949 (defun gnus-summary-limit (articles &optional pop)
7951 ;; We pop the previous limit off the stack and use that.
7952 (setq articles (car gnus-newsgroup-limits)
7953 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7954 ;; We use the new limit, so we push the old limit on the stack.
7955 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7957 (setq gnus-newsgroup-limit articles)
7958 (let ((total (length gnus-newsgroup-data))
7959 (data (gnus-data-find-list (gnus-summary-article-number)))
7960 (gnus-summary-mark-below nil) ; Inhibit this.
7962 ;; This will do all the work of generating the new summary buffer
7963 ;; according to the new limit.
7964 (gnus-summary-prepare)
7965 ;; Hide any threads, possibly.
7966 (gnus-summary-maybe-hide-threads)
7967 ;; Try to return to the article you were at, or one in the
7970 ;; We try to find some article after the current one.
7972 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7975 (setq data (cdr data))))
7977 ;; If there is no data, that means that we were after the last
7978 ;; article. The same goes when we can't find any articles
7979 ;; after the current one.
7980 (goto-char (point-max))
7981 (gnus-summary-find-prev))
7982 (gnus-set-mode-line 'summary)
7983 ;; We return how many articles were removed from the summary
7984 ;; buffer as a result of the new limit.
7985 (- total (length gnus-newsgroup-data))))
7987 (defsubst gnus-invisible-cut-children (threads)
7990 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7995 (defsubst gnus-cut-thread (thread)
7996 "Go forwards in the thread until we find an article that we want to display."
7997 (when (or (eq gnus-fetch-old-headers 'some)
7998 (eq gnus-fetch-old-headers 'invisible)
7999 (numberp gnus-fetch-old-headers)
8000 (eq gnus-build-sparse-threads 'some)
8001 (eq gnus-build-sparse-threads 'more))
8002 ;; Deal with old-fetched headers and sparse threads.
8006 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8007 (gnus-summary-article-ancient-p
8008 (mail-header-number (car thread))))
8009 (if (or (<= (length (cdr thread)) 1)
8010 (eq gnus-fetch-old-headers 'invisible))
8011 (setq gnus-newsgroup-limit
8012 (delq (mail-header-number (car thread))
8013 gnus-newsgroup-limit)
8014 thread (cadr thread))
8015 (when (gnus-invisible-cut-children (cdr thread))
8016 (let ((th (cdr thread)))
8018 (if (memq (mail-header-number (caar th))
8019 gnus-newsgroup-limit)
8020 (setq thread (car th)
8022 (setq th (cdr th))))))))))
8025 (defun gnus-cut-threads (threads)
8026 "Cut off all uninteresting articles from the beginning of THREADS."
8027 (when (or (eq gnus-fetch-old-headers 'some)
8028 (eq gnus-fetch-old-headers 'invisible)
8029 (numberp gnus-fetch-old-headers)
8030 (eq gnus-build-sparse-threads 'some)
8031 (eq gnus-build-sparse-threads 'more))
8034 (setcar th (gnus-cut-thread (car th)))
8035 (setq th (cdr th)))))
8036 ;; Remove nixed out threads.
8039 (defun gnus-summary-initial-limit (&optional show-if-empty)
8040 "Figure out what the initial limit is supposed to be on group entry.
8041 This entails weeding out unwanted dormants, low-scored articles,
8042 fetch-old-headers verbiage, and so on."
8043 ;; Most groups have nothing to remove.
8044 (if (or gnus-inhibit-limiting
8045 (and (null gnus-newsgroup-dormant)
8046 (eq gnus-newsgroup-display 'gnus-not-ignore)
8047 (not (eq gnus-fetch-old-headers 'some))
8048 (not (numberp gnus-fetch-old-headers))
8049 (not (eq gnus-fetch-old-headers 'invisible))
8050 (null gnus-summary-expunge-below)
8051 (not (eq gnus-build-sparse-threads 'some))
8052 (not (eq gnus-build-sparse-threads 'more))
8053 (null gnus-thread-expunge-below)
8054 (not gnus-use-nocem)))
8056 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8057 (setq gnus-newsgroup-limit nil)
8060 (unless (car (symbol-value node))
8061 ;; These threads have no parents -- they are roots.
8062 (let ((nodes (cdr (symbol-value node)))
8065 (if (and gnus-thread-expunge-below
8066 (< (gnus-thread-total-score (car nodes))
8067 gnus-thread-expunge-below))
8068 (gnus-expunge-thread (pop nodes))
8069 (setq thread (pop nodes))
8070 (gnus-summary-limit-children thread))))))
8071 gnus-newsgroup-dependencies)
8072 ;; If this limitation resulted in an empty group, we might
8073 ;; pop the previous limit and use it instead.
8074 (when (and (not gnus-newsgroup-limit)
8076 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8077 gnus-newsgroup-limit))
8079 (defun gnus-summary-limit-children (thread)
8080 "Return 1 if this subthread is visible and 0 if it is not."
8081 ;; First we get the number of visible children to this thread. This
8082 ;; is done by recursing down the thread using this function, so this
8083 ;; will really go down to a leaf article first, before slowly
8084 ;; working its way up towards the root.
8086 (let* ((max-lisp-eval-depth 5000)
8089 (apply '+ (mapcar 'gnus-summary-limit-children
8092 (number (mail-header-number (car thread)))
8095 (not (memq number gnus-newsgroup-marked))
8097 ;; If this article is dormant and has absolutely no visible
8098 ;; children, then this article isn't visible.
8099 (and (memq number gnus-newsgroup-dormant)
8101 ;; If this is "fetch-old-headered" and there is no
8102 ;; visible children, then we don't want this article.
8103 (and (or (eq gnus-fetch-old-headers 'some)
8104 (numberp gnus-fetch-old-headers))
8105 (gnus-summary-article-ancient-p number)
8107 ;; If this is "fetch-old-headered" and `invisible', then
8108 ;; we don't want this article.
8109 (and (eq gnus-fetch-old-headers 'invisible)
8110 (gnus-summary-article-ancient-p number))
8111 ;; If this is a sparsely inserted article with no children,
8112 ;; we don't want it.
8113 (and (eq gnus-build-sparse-threads 'some)
8114 (gnus-summary-article-sparse-p number)
8116 ;; If we use expunging, and this article is really
8117 ;; low-scored, then we don't want this article.
8118 (when (and gnus-summary-expunge-below
8120 (or (cdr (assq number gnus-newsgroup-scored))
8121 gnus-summary-default-score))
8122 gnus-summary-expunge-below))
8123 ;; We increase the expunge-tally here, but that has
8124 ;; nothing to do with the limits, really.
8125 (incf gnus-newsgroup-expunged-tally)
8126 ;; We also mark as read here, if that's wanted.
8127 (when (and gnus-summary-mark-below
8128 (< score gnus-summary-mark-below))
8129 (setq gnus-newsgroup-unreads
8130 (delq number gnus-newsgroup-unreads))
8131 (if gnus-newsgroup-auto-expire
8132 (push number gnus-newsgroup-expirable)
8133 (push (cons number gnus-low-score-mark)
8134 gnus-newsgroup-reads)))
8136 ;; Do the `display' group parameter.
8137 (and gnus-newsgroup-display
8138 (not (funcall gnus-newsgroup-display)))
8139 ;; Check NoCeM things.
8140 (when (and gnus-use-nocem
8141 (gnus-nocem-unwanted-article-p
8142 (mail-header-id (car thread))))
8143 (setq gnus-newsgroup-unreads
8144 (delq number gnus-newsgroup-unreads))
8146 ;; Nope, invisible article.
8148 ;; Ok, this article is to be visible, so we add it to the limit
8150 (push number gnus-newsgroup-limit)
8153 (defun gnus-expunge-thread (thread)
8154 "Mark all articles in THREAD as read."
8155 (let* ((number (mail-header-number (car thread))))
8156 (incf gnus-newsgroup-expunged-tally)
8157 ;; We also mark as read here, if that's wanted.
8158 (setq gnus-newsgroup-unreads
8159 (delq number gnus-newsgroup-unreads))
8160 (if gnus-newsgroup-auto-expire
8161 (push number gnus-newsgroup-expirable)
8162 (push (cons number gnus-low-score-mark)
8163 gnus-newsgroup-reads)))
8164 ;; Go recursively through all subthreads.
8165 (mapcar 'gnus-expunge-thread (cdr thread)))
8167 ;; Summary article oriented commands
8169 (defun gnus-summary-refer-parent-article (n)
8170 "Refer parent article N times.
8171 If N is negative, go to ancestor -N instead.
8172 The difference between N and the number of articles fetched is returned."
8176 (when (not (natnump n))
8181 (setq header (gnus-summary-article-header))
8182 (if (and (eq (mail-header-number header)
8183 (cdr gnus-article-current))
8184 (equal gnus-newsgroup-name
8185 (car gnus-article-current)))
8186 ;; If we try to find the parent of the currently
8187 ;; displayed article, then we take a look at the actual
8188 ;; References header, since this is slightly more
8189 ;; reliable than the References field we got from the
8192 (set-buffer gnus-original-article-buffer)
8193 (nnheader-narrow-to-headers)
8194 (unless (setq ref (message-fetch-field "references"))
8195 (when (setq ref (message-fetch-field "in-reply-to"))
8196 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8199 ;; It's not the current article, so we take a bet on
8200 ;; the value we got from the server.
8201 (mail-header-references header)))
8203 (not (equal ref "")))
8204 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8205 (gnus-message 1 "Couldn't find parent"))
8206 (gnus-message 1 "No references in article %d"
8207 (gnus-summary-article-number))
8210 (gnus-summary-position-point)
8213 (defun gnus-summary-refer-references ()
8214 "Fetch all articles mentioned in the References header.
8215 Return the number of articles fetched."
8217 (let ((ref (mail-header-references (gnus-summary-article-header)))
8218 (current (gnus-summary-article-number))
8222 (error "No References in the current article")
8223 ;; For each Message-ID in the References header...
8224 (while (string-match "<[^>]*>" ref)
8226 ;; ... fetch that article.
8227 (gnus-summary-refer-article
8228 (prog1 (match-string 0 ref)
8229 (setq ref (substring ref (match-end 0))))))
8230 (gnus-summary-goto-subject current)
8231 (gnus-summary-position-point)
8234 (defun gnus-summary-refer-thread (&optional limit)
8235 "Fetch all articles in the current thread.
8236 If LIMIT (the numerical prefix), fetch that many old headers instead
8237 of what's specified by the `gnus-refer-thread-limit' variable."
8239 (let ((id (mail-header-id (gnus-summary-article-header)))
8240 (limit (if limit (prefix-numeric-value limit)
8241 gnus-refer-thread-limit)))
8242 (unless (eq gnus-fetch-old-headers 'invisible)
8243 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8244 ;; Retrieve the headers and read them in.
8245 (if (eq (if (numberp limit)
8246 (gnus-retrieve-headers
8248 (+ (mail-header-number
8249 (gnus-summary-article-header))
8251 gnus-newsgroup-end))
8252 gnus-newsgroup-name (* limit 2))
8253 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8255 (gnus-retrieve-headers (list gnus-newsgroup-end)
8256 gnus-newsgroup-name limit))
8258 (gnus-build-all-threads)
8259 (error "Can't fetch thread from back ends that don't support NOV"))
8260 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8261 (gnus-summary-limit-include-thread id)))
8263 (defun gnus-summary-refer-article (message-id)
8264 "Fetch an article specified by MESSAGE-ID."
8265 (interactive "sMessage-ID: ")
8266 (when (and (stringp message-id)
8267 (not (zerop (length message-id))))
8268 (setq message-id (gnus-replace-in-string message-id " " ""))
8269 ;; Construct the correct Message-ID if necessary.
8270 ;; Suggested by tale@pawl.rpi.edu.
8271 (unless (string-match "^<" message-id)
8272 (setq message-id (concat "<" message-id)))
8273 (unless (string-match ">$" message-id)
8274 (setq message-id (concat message-id ">")))
8275 ;; People often post MIDs from URLs, so unhex it:
8276 (unless (string-match "@" message-id)
8277 (setq message-id (gnus-url-unhex-string message-id)))
8278 (let* ((header (gnus-id-to-header message-id))
8280 (gnus-summary-article-sparse-p
8281 (mail-header-number header))
8282 (memq (mail-header-number header)
8283 gnus-newsgroup-limit)))
8286 ;; If the article is present in the buffer we just go to it.
8288 (or (not (gnus-summary-article-sparse-p
8289 (mail-header-number header)))
8292 (gnus-summary-goto-article
8293 (mail-header-number header) nil t)
8295 (gnus-summary-update-article (mail-header-number header)))))
8297 ;; We fetch the article.
8299 (dolist (gnus-override-method (gnus-refer-article-methods))
8300 (when (and (gnus-check-server gnus-override-method)
8301 ;; Fetch the header,
8302 (setq number (gnus-summary-insert-subject message-id)))
8303 ;; and display the article.
8304 (gnus-summary-select-article nil nil nil number)
8306 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8308 (defun gnus-refer-article-methods ()
8309 "Return a list of referable methods."
8311 ;; No method, so we default to current and native.
8312 ((null gnus-refer-article-method)
8313 (list gnus-current-select-method gnus-select-method))
8315 ((eq 'current gnus-refer-article-method)
8316 (list gnus-current-select-method))
8317 ;; List of select methods.
8318 ((not (and (symbolp (car gnus-refer-article-method))
8319 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8321 (dolist (method gnus-refer-article-method)
8322 (push (if (eq 'current method)
8323 gnus-current-select-method
8327 ;; One single select method.
8329 (list gnus-refer-article-method))))
8331 (defun gnus-summary-edit-parameters ()
8332 "Edit the group parameters of the current group."
8334 (gnus-group-edit-group gnus-newsgroup-name 'params))
8336 (defun gnus-summary-customize-parameters ()
8337 "Customize the group parameters of the current group."
8339 (gnus-group-customize gnus-newsgroup-name))
8341 (defun gnus-summary-enter-digest-group (&optional force)
8342 "Enter an nndoc group based on the current article.
8343 If FORCE, force a digest interpretation. If not, try
8344 to guess what the document format is."
8346 (let ((conf gnus-current-window-configuration))
8347 (save-window-excursion
8349 (let (gnus-article-prepare-hook
8350 gnus-display-mime-function
8352 (gnus-summary-select-article))))
8353 (setq gnus-current-window-configuration conf)
8354 (let* ((name (format "%s-%d"
8355 (gnus-group-prefixed-name
8356 gnus-newsgroup-name (list 'nndoc ""))
8357 (with-current-buffer gnus-summary-buffer
8358 gnus-current-article)))
8359 (ogroup gnus-newsgroup-name)
8360 (params (append (gnus-info-params (gnus-get-info ogroup))
8361 (list (cons 'to-group ogroup))
8362 (list (cons 'parent-group ogroup))
8363 (list (cons 'save-article-group ogroup))))
8364 (case-fold-search t)
8365 (buf (current-buffer))
8368 (set-buffer gnus-original-article-buffer)
8369 ;; Have the digest group inherit the main mail address of
8370 ;; the parent article.
8371 (when (setq to-address (or (gnus-fetch-field "reply-to")
8372 (gnus-fetch-field "from")))
8373 (setq params (append
8374 (list (cons 'to-address
8375 (funcall gnus-decode-encoded-word-function
8377 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8378 (insert-buffer-substring gnus-original-article-buffer)
8379 ;; Remove lines that may lead nndoc to misinterpret the
8382 (goto-char (point-min))
8383 (or (search-forward "\n\n" nil t) (point)))
8384 (goto-char (point-min))
8385 (delete-matching-lines "^Path:\\|^From ")
8388 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8389 (gnus-newsgroup-ephemeral-ignored-charsets
8390 gnus-newsgroup-ignored-charsets))
8391 (gnus-group-read-ephemeral-group
8392 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8394 ,(if force 'mbox 'guess)))
8396 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8398 ;; Make all postings to this group go to the parent group.
8399 (nconc (gnus-info-params (gnus-get-info name))
8401 ;; Couldn't select this doc group.
8402 (switch-to-buffer buf)
8403 (gnus-set-global-variables)
8404 (gnus-configure-windows 'summary)
8405 (gnus-message 3 "Article couldn't be entered?"))
8406 (kill-buffer dig)))))
8408 (defun gnus-summary-read-document (n)
8409 "Open a new group based on the current article(s).
8410 This will allow you to read digests and other similar
8411 documents as newsgroups.
8412 Obeys the standard process/prefix convention."
8414 (let* ((ogroup gnus-newsgroup-name)
8415 (params (append (gnus-info-params (gnus-get-info ogroup))
8416 (list (cons 'to-group ogroup))))
8417 group egroup groups vgroup)
8418 (dolist (article (gnus-summary-work-articles n))
8419 (setq group (format "%s-%d" gnus-newsgroup-name article))
8420 (gnus-summary-remove-process-mark article)
8421 (when (gnus-summary-display-article article)
8424 (insert-buffer-substring gnus-original-article-buffer)
8425 ;; Remove some headers that may lead nndoc to make
8427 (message-narrow-to-head)
8428 (goto-char (point-min))
8429 (delete-matching-lines "^Path:\\|^From ")
8432 (gnus-group-read-ephemeral-group
8433 group `(nndoc ,group (nndoc-address ,(current-buffer))
8434 (nndoc-article-type guess))
8437 ;; Make all postings to this group go to the parent group.
8438 (nconc (gnus-info-params (gnus-get-info egroup))
8440 (push egroup groups))
8441 ;; Couldn't select this doc group.
8442 (gnus-error 3 "Article couldn't be entered"))))))
8443 ;; Now we have selected all the documents.
8446 (error "None of the articles could be interpreted as documents"))
8447 ((gnus-group-read-ephemeral-group
8448 (setq vgroup (format
8449 "nnvirtual:%s-%s" gnus-newsgroup-name
8450 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8451 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8453 (cons (current-buffer) 'summary)))
8455 (error "Couldn't select virtual nndoc group")))))
8457 (defun gnus-summary-isearch-article (&optional regexp-p)
8458 "Do incremental search forward on the current article.
8459 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8461 (gnus-summary-select-article)
8462 (gnus-configure-windows 'article)
8463 (gnus-eval-in-buffer-window gnus-article-buffer
8466 (isearch-forward regexp-p))))
8468 (defun gnus-summary-search-article-forward (regexp &optional backward)
8469 "Search for an article containing REGEXP forward.
8470 If BACKWARD, search backward instead."
8473 (format "Search article %s (regexp%s): "
8474 (if current-prefix-arg "backward" "forward")
8475 (if gnus-last-search-regexp
8476 (concat ", default " gnus-last-search-regexp)
8478 current-prefix-arg))
8479 (if (string-equal regexp "")
8480 (setq regexp (or gnus-last-search-regexp ""))
8481 (setq gnus-last-search-regexp regexp)
8482 (setq gnus-article-before-search gnus-current-article))
8483 ;; Intentionally set gnus-last-article.
8484 (setq gnus-last-article gnus-article-before-search)
8485 (let ((gnus-last-article gnus-last-article))
8486 (if (gnus-summary-search-article regexp backward)
8487 (gnus-summary-show-thread)
8488 (signal 'search-failed (list regexp)))))
8490 (defun gnus-summary-search-article-backward (regexp)
8491 "Search for an article containing REGEXP backward."
8494 (format "Search article backward (regexp%s): "
8495 (if gnus-last-search-regexp
8496 (concat ", default " gnus-last-search-regexp)
8498 (gnus-summary-search-article-forward regexp 'backward))
8500 (defun gnus-summary-search-article (regexp &optional backward)
8501 "Search for an article containing REGEXP.
8502 Optional argument BACKWARD means do search for backward.
8503 `gnus-select-article-hook' is not called during the search."
8504 ;; We have to require this here to make sure that the following
8505 ;; dynamic binding isn't shadowed by autoloading.
8506 (require 'gnus-async)
8508 (let ((gnus-select-article-hook nil) ;Disable hook.
8509 (gnus-article-prepare-hook nil)
8510 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8511 (gnus-use-article-prefetch nil)
8512 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8513 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8515 (gnus-keep-backlog nil)
8516 (gnus-break-pages nil)
8517 (gnus-summary-display-arrow nil)
8518 (gnus-updated-mode-lines nil)
8519 (gnus-auto-center-summary nil)
8520 (sum (current-buffer))
8521 (gnus-display-mime-function nil)
8524 (gnus-save-hidden-threads
8525 (gnus-summary-select-article)
8526 (set-buffer gnus-article-buffer)
8527 (goto-char (window-point (get-buffer-window (current-buffer))))
8531 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8533 (re-search-backward regexp nil t)
8534 (re-search-forward regexp nil t))
8535 ;; We found the regexp.
8540 (get-buffer-window (current-buffer))
8544 (get-buffer-window (current-buffer))
8547 (setq point (point)))
8548 ;; We didn't find it, so we go to the next article.
8551 (while (eq found 'not)
8552 (if (not (if backward (gnus-summary-find-prev)
8553 (gnus-summary-find-next)))
8554 ;; No more articles.
8556 ;; Select the next article and adjust point.
8557 (unless (gnus-summary-article-sparse-p
8558 (gnus-summary-article-number))
8560 (gnus-summary-select-article)
8561 (set-buffer gnus-article-buffer)
8563 (goto-char (if backward (point-max) (point-min))))))))
8564 (gnus-message 7 ""))
8565 ;; Return whether we found the regexp.
8566 (when (eq found 'found)
8568 (gnus-summary-show-thread)
8569 (gnus-summary-goto-subject gnus-current-article)
8570 (gnus-summary-position-point)
8573 (defun gnus-find-matching-articles (header regexp)
8574 "Return a list of all articles that match REGEXP on HEADER.
8575 This search includes all articles in the current group that Gnus has
8576 fetched headers for, whether they are displayed or not."
8577 (let ((articles nil)
8578 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8579 (case-fold-search t))
8580 (dolist (header gnus-newsgroup-headers)
8581 (when (string-match regexp (funcall func header))
8582 (push (mail-header-number header) articles)))
8583 (nreverse articles)))
8585 (defun gnus-summary-find-matching (header regexp &optional backward unread
8586 not-case-fold not-matching)
8587 "Return a list of all articles that match REGEXP on HEADER.
8588 The search stars on the current article and goes forwards unless
8589 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8590 If UNREAD is non-nil, only unread articles will
8591 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8592 in the comparisons. If NOT-MATCHING, return a list of all articles that
8593 not match REGEXP on HEADER."
8594 (let ((case-fold-search (not not-case-fold))
8597 (if (eq (car header) 'extra)
8600 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8602 (error "%s is an invalid header" header))
8603 (unless (fboundp (intern (concat "mail-header-" header)))
8604 (error "%s is not a valid header" header))
8605 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8606 (dolist (d (if (eq backward 'all)
8608 (gnus-data-find-list
8609 (gnus-summary-article-number)
8610 (gnus-data-list backward))))
8611 (when (and (or (not unread) ; We want all articles...
8612 (gnus-data-unread-p d)) ; Or just unreads.
8613 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8617 (funcall func (gnus-data-header d))))
8618 (string-match regexp
8619 (funcall func (gnus-data-header d)))))
8620 (push (gnus-data-number d) articles))) ; Success!
8621 (nreverse articles)))
8623 (defun gnus-summary-execute-command (header regexp command &optional backward)
8624 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8625 If HEADER is an empty string (or nil), the match is done on the entire
8626 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8628 (list (let ((completion-ignore-case t))
8631 (mapcar (lambda (header) (list (format "%s" header)))
8633 '("Number" "Subject" "From" "Lines" "Date"
8634 "Message-ID" "Xref" "References" "Body")
8635 gnus-extra-headers))
8636 nil 'require-match))
8637 (read-string "Regexp: ")
8638 (read-key-sequence "Command: ")
8639 current-prefix-arg))
8640 (when (equal header "Body")
8642 ;; Hidden thread subtrees must be searched as well.
8643 (gnus-summary-show-all-threads)
8644 ;; We don't want to change current point nor window configuration.
8646 (save-window-excursion
8648 gnus-treat-strip-trailing-blank-lines
8649 gnus-treat-strip-leading-blank-lines
8650 gnus-treat-strip-multiple-blank-lines
8651 gnus-treat-hide-boring-headers
8652 gnus-treat-fold-newsgroups
8653 gnus-article-prepare-hook)
8654 (gnus-message 6 "Executing %s..." (key-description command))
8655 ;; We'd like to execute COMMAND interactively so as to give arguments.
8656 (gnus-execute header regexp
8657 `(call-interactively ',(key-binding command))
8659 (gnus-message 6 "Executing %s...done" (key-description command))))))
8661 (defun gnus-summary-beginning-of-article ()
8662 "Scroll the article back to the beginning."
8664 (gnus-summary-select-article)
8665 (gnus-configure-windows 'article)
8666 (gnus-eval-in-buffer-window gnus-article-buffer
8668 (goto-char (point-min))
8669 (when gnus-break-pages
8670 (gnus-narrow-to-page))))
8672 (defun gnus-summary-end-of-article ()
8673 "Scroll to the end of the article."
8675 (gnus-summary-select-article)
8676 (gnus-configure-windows 'article)
8677 (gnus-eval-in-buffer-window gnus-article-buffer
8679 (goto-char (point-max))
8681 (when gnus-break-pages
8682 (when (re-search-backward page-delimiter nil t)
8683 (narrow-to-region (match-end 0) (point-max)))
8684 (gnus-narrow-to-page))))
8686 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8687 "Truncate to LEN and quote all \"(\"'s in STRING."
8688 (gnus-replace-in-string (if (and len (> (length string) len))
8689 (substring string 0 len)
8693 (defun gnus-summary-print-article (&optional filename n)
8694 "Generate and print a PostScript image of the process-marked (mail) articles.
8696 If used interactively, print the current article if none are
8697 process-marked. With prefix arg, prompt the user for the name of the
8700 When used from Lisp, accept two optional args FILENAME and N. N means
8701 to print the next N articles. If N is negative, print the N previous
8702 articles. If N is nil and articles have been marked with the process
8703 mark, print these instead.
8705 If the optional first argument FILENAME is nil, send the image to the
8706 printer. If FILENAME is a string, save the PostScript image in a file with
8707 that name. If FILENAME is a number, prompt the user for the name of the file
8709 (interactive (list (ps-print-preprint current-prefix-arg)))
8710 (dolist (article (gnus-summary-work-articles n))
8711 (gnus-summary-select-article nil nil 'pseudo article)
8712 (gnus-eval-in-buffer-window gnus-article-buffer
8713 (gnus-print-buffer))
8714 (gnus-summary-remove-process-mark article))
8715 (ps-despool filename))
8717 (defun gnus-print-buffer ()
8718 (let ((buffer (generate-new-buffer " *print*")))
8721 (copy-to-buffer buffer (point-min) (point-max))
8723 (gnus-remove-text-with-property 'gnus-decoration)
8724 (when (gnus-visual-p 'article-highlight 'highlight)
8725 ;; Copy-to-buffer doesn't copy overlay. So redo
8727 (let ((gnus-article-buffer buffer))
8728 (gnus-article-highlight-citation t)
8729 (gnus-article-highlight-signature)
8730 (gnus-article-emphasize)
8731 (gnus-article-delete-invisible-text)))
8732 (let ((ps-left-header
8735 (gnus-summary-print-truncate-and-quote
8736 (mail-header-subject gnus-current-headers)
8739 (gnus-summary-print-truncate-and-quote
8740 (mail-header-from gnus-current-headers)
8744 "/pagenumberstring load"
8746 (mail-header-date gnus-current-headers) ")"))))
8747 (gnus-run-hooks 'gnus-ps-print-hook)
8750 (ps-spool-buffer-with-faces)
8751 (ps-spool-buffer)))))
8752 (kill-buffer buffer))))
8754 (defun gnus-summary-show-article (&optional arg)
8755 "Force redisplaying of the current article.
8756 If ARG (the prefix) is a number, show the article with the charset
8757 defined in `gnus-summary-show-article-charset-alist', or the charset
8759 If ARG (the prefix) is non-nil and not a number, show the raw article
8760 without any article massaging functions being run. Normally, the key
8761 strokes are `C-u g'."
8765 (gnus-summary-show-article t)
8766 (let ((gnus-newsgroup-charset
8767 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8768 (mm-read-coding-system
8769 "View as charset: " ;; actually it is coding system.
8770 (with-current-buffer gnus-article-buffer
8771 (mm-detect-coding-region (point) (point-max))))))
8772 (gnus-newsgroup-ignored-charsets 'gnus-all))
8773 (gnus-summary-select-article nil 'force)
8774 (let ((deps gnus-newsgroup-dependencies)
8777 (set-buffer gnus-original-article-buffer)
8779 (message-narrow-to-head)
8780 (setq head (buffer-string))
8781 (goto-char (point-min))
8782 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8783 (goto-char (point-max))
8785 (setq lines (1- (count-lines (point) (point-max))))))
8787 (insert (format "211 %d Article retrieved.\n"
8788 (cdr gnus-article-current)))
8790 (if lines (insert (format "Lines: %d\n" lines)))
8792 (let ((nntp-server-buffer (current-buffer)))
8793 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8794 (gnus-data-set-header
8795 (gnus-data-find (cdr gnus-article-current))
8797 (gnus-summary-update-article-line
8798 (cdr gnus-article-current) header)
8799 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8800 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8802 ;; Select the article the normal way.
8803 (gnus-summary-select-article nil 'force))
8805 ;; We have to require this here to make sure that the following
8806 ;; dynamic binding isn't shadowed by autoloading.
8807 (require 'gnus-async)
8809 ;; Bind the article treatment functions to nil.
8810 (let ((gnus-have-all-headers t)
8811 gnus-article-prepare-hook
8812 gnus-article-decode-hook
8813 gnus-display-mime-function
8815 ;; Destroy any MIME parts.
8816 (when (gnus-buffer-live-p gnus-article-buffer)
8818 (set-buffer gnus-article-buffer)
8819 (mm-destroy-parts gnus-article-mime-handles)
8820 ;; Set it to nil for safety reason.
8821 (setq gnus-article-mime-handle-alist nil)
8822 (setq gnus-article-mime-handles nil)))
8823 (gnus-summary-select-article nil 'force))))
8824 (gnus-summary-goto-subject gnus-current-article)
8825 (gnus-summary-position-point))
8827 (defun gnus-summary-show-raw-article ()
8828 "Show the raw article without any article massaging functions being run."
8830 (gnus-summary-show-article t))
8832 (defun gnus-summary-verbose-headers (&optional arg)
8833 "Toggle permanent full header display.
8834 If ARG is a positive number, turn header display on.
8835 If ARG is a negative number, turn header display off."
8837 (setq gnus-show-all-headers
8838 (cond ((or (not (numberp arg))
8840 (not gnus-show-all-headers))
8843 (gnus-summary-show-article))
8845 (defun gnus-summary-toggle-header (&optional arg)
8846 "Show the headers if they are hidden, or hide them if they are shown.
8847 If ARG is a positive number, show the entire header.
8848 If ARG is a negative number, hide the unwanted header lines."
8850 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8851 (get-buffer-window gnus-article-buffer t))))
8852 (with-current-buffer gnus-article-buffer
8854 (article-narrow-to-head)
8855 (let* ((buffer-read-only nil)
8856 (inhibit-point-motion-hooks t)
8857 (hidden (if (numberp arg)
8859 (or (not (looking-at "[^ \t\n]+:"))
8860 (gnus-article-hidden-text-p 'headers))))
8862 (delete-region (point-min) (point-max))
8863 (with-current-buffer gnus-original-article-buffer
8864 (goto-char (setq s (point-min)))
8865 (setq e (if (search-forward "\n\n" nil t)
8868 (insert-buffer-substring gnus-original-article-buffer s e)
8869 (run-hooks 'gnus-article-decode-hook)
8871 (let ((gnus-treat-hide-headers nil)
8872 (gnus-treat-hide-boring-headers nil))
8873 (gnus-delete-wash-type 'headers)
8874 (gnus-treat-article 'head))
8875 (gnus-treat-article 'head))
8878 (set-window-start window (goto-char (point-min))))
8879 (if gnus-break-pages
8880 (gnus-narrow-to-page)
8881 (when (gnus-visual-p 'page-marker)
8882 (let ((buffer-read-only nil))
8883 (gnus-remove-text-with-property 'gnus-prev)
8884 (gnus-remove-text-with-property 'gnus-next))))
8885 (gnus-set-mode-line 'article)))))
8887 (defun gnus-summary-show-all-headers ()
8888 "Make all header lines visible."
8890 (gnus-summary-toggle-header 1))
8892 (defun gnus-summary-caesar-message (&optional arg)
8893 "Caesar rotate the current article by 13.
8894 The numerical prefix specifies how many places to rotate each letter
8897 (gnus-summary-select-article)
8898 (let ((mail-header-separator ""))
8899 (gnus-eval-in-buffer-window gnus-article-buffer
8902 (let ((start (window-start))
8904 (message-caesar-buffer-body arg)
8905 (set-window-start (get-buffer-window (current-buffer)) start))))))
8907 (autoload 'unmorse-region "morse"
8908 "Convert morse coded text in region to ordinary ASCII text."
8911 (defun gnus-summary-morse-message (&optional arg)
8912 "Morse decode the current article."
8914 (gnus-summary-select-article)
8915 (let ((mail-header-separator ""))
8916 (gnus-eval-in-buffer-window gnus-article-buffer
8920 (let ((pos (window-start))
8922 (goto-char (point-min))
8923 (when (message-goto-body)
8924 (gnus-narrow-to-body))
8925 (goto-char (point-min))
8926 (while (search-forward "·" (point-max) t)
8927 (replace-match "."))
8928 (unmorse-region (point-min) (point-max))
8930 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8932 (defun gnus-summary-stop-page-breaking ()
8933 "Stop page breaking in the current article."
8935 (gnus-summary-select-article)
8936 (gnus-eval-in-buffer-window gnus-article-buffer
8938 (when (gnus-visual-p 'page-marker)
8939 (let ((buffer-read-only nil))
8940 (gnus-remove-text-with-property 'gnus-prev)
8941 (gnus-remove-text-with-property 'gnus-next))
8942 (setq gnus-page-broken nil))))
8944 (defun gnus-summary-move-article (&optional n to-newsgroup
8945 select-method action)
8946 "Move the current article to a different newsgroup.
8947 If N is a positive number, move the N next articles.
8948 If N is a negative number, move the N previous articles.
8949 If N is nil and any articles have been marked with the process mark,
8950 move those articles instead.
8951 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8952 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8953 re-spool using this method.
8955 When called interactively with TO-NEWSGROUP being nil, the value of
8956 the variable `gnus-move-split-methods' is used for finding a default
8957 for the target newsgroup.
8959 For this function to work, both the current newsgroup and the
8960 newsgroup that you want to move to have to support the `request-move'
8961 and `request-accept' functions.
8963 ACTION can be either `move' (the default), `crosspost' or `copy'."
8966 (setq action 'move))
8967 ;; Check whether the source group supports the required functions.
8968 (cond ((and (eq action 'move)
8969 (not (gnus-check-backend-function
8970 'request-move-article gnus-newsgroup-name)))
8971 (error "The current group does not support article moving"))
8972 ((and (eq action 'crosspost)
8973 (not (gnus-check-backend-function
8974 'request-replace-article gnus-newsgroup-name)))
8975 (error "The current group does not support article editing")))
8976 (let ((articles (gnus-summary-work-articles n))
8977 (prefix (if (gnus-check-backend-function
8978 'request-move-article gnus-newsgroup-name)
8979 (funcall gnus-move-group-prefix-function
8980 gnus-newsgroup-name)
8982 (names '((move "Move" "Moving")
8983 (copy "Copy" "Copying")
8984 (crosspost "Crosspost" "Crossposting")))
8985 (copy-buf (save-excursion
8986 (nnheader-set-temp-buffer " *copy article*")))
8987 art-group to-method new-xref article to-groups)
8988 (unless (assq action names)
8989 (error "Unknown action %s" action))
8990 ;; Read the newsgroup name.
8991 (when (and (not to-newsgroup)
8992 (not select-method))
8993 (if (and gnus-move-split-methods
8995 (and (memq gnus-current-article articles)
8996 (gnus-buffer-live-p gnus-original-article-buffer))))
8997 ;; When `gnus-move-split-methods' is non-nil, we have to
8998 ;; select an article to give `gnus-read-move-group-name' an
8999 ;; opportunity to suggest an appropriate default. However,
9000 ;; we needn't render or mark the article.
9001 (let ((gnus-display-mime-function nil)
9002 (gnus-article-prepare-hook nil)
9003 (gnus-mark-article-hook nil))
9004 (gnus-summary-select-article nil nil nil (car articles))))
9006 (gnus-read-move-group-name
9007 (cadr (assq action names))
9008 (symbol-value (intern (format "gnus-current-%s-group" action)))
9010 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9011 (setq to-method (or select-method
9012 (gnus-server-to-method
9013 (gnus-group-method to-newsgroup))))
9014 ;; Check the method we are to move this article to...
9015 (unless (gnus-check-backend-function
9016 'request-accept-article (car to-method))
9017 (error "%s does not support article copying" (car to-method)))
9018 (unless (gnus-check-server to-method)
9019 (error "Can't open server %s" (car to-method)))
9020 (gnus-message 6 "%s to %s: %s..."
9021 (caddr (assq action names))
9022 (or (car select-method) to-newsgroup) articles)
9024 (setq article (pop articles))
9028 ;; Move the article.
9030 ;; Remove this article from future suppression.
9031 (gnus-dup-unsuppress-article article)
9032 (gnus-request-move-article
9033 article ; Article to move
9034 gnus-newsgroup-name ; From newsgroup
9035 (nth 1 (gnus-find-method-for-group
9036 gnus-newsgroup-name)) ; Server
9037 (list 'gnus-request-accept-article
9038 to-newsgroup (list 'quote select-method)
9039 (not articles) t) ; Accept form
9040 (not articles))) ; Only save nov last time
9041 ;; Copy the article.
9044 (set-buffer copy-buf)
9045 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9047 (nnheader-narrow-to-headers)
9048 (dolist (hdr gnus-copy-article-ignored-headers)
9049 (message-remove-header hdr t)))
9050 (gnus-request-accept-article
9051 to-newsgroup select-method (not articles) t))))
9052 ;; Crosspost the article.
9053 ((eq action 'crosspost)
9054 (let ((xref (message-tokenize-header
9055 (mail-header-xref (gnus-summary-article-header article))
9057 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9058 ":" (number-to-string article)))
9060 (setq xref (list (system-name))))
9063 (mapconcat 'identity
9064 (delete "Xref:" (delete new-xref xref))
9068 (set-buffer copy-buf)
9069 ;; First put the article in the destination group.
9070 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9071 (when (consp (setq art-group
9072 (gnus-request-accept-article
9073 to-newsgroup select-method (not articles))))
9074 (setq new-xref (concat new-xref " " (car art-group)
9076 (number-to-string (cdr art-group))))
9077 ;; Now we have the new Xrefs header, so we insert
9078 ;; it and replace the new article.
9079 (nnheader-replace-header "Xref" new-xref)
9080 (gnus-request-replace-article
9081 (cdr art-group) to-newsgroup (current-buffer))
9085 (gnus-message 1 "Couldn't %s article %s: %s"
9086 (cadr (assq action names)) article
9087 (nnheader-get-report (car to-method))))
9088 ((eq art-group 'junk)
9089 (when (eq action 'move)
9090 (gnus-summary-mark-article article gnus-canceled-mark)
9091 (gnus-message 4 "Deleted article %s" article)
9092 ;; run the delete hook
9093 (run-hook-with-args 'gnus-summary-article-delete-hook
9096 (assoc article (gnus-data-list nil)))
9097 gnus-newsgroup-name nil
9100 (let* ((pto-group (gnus-group-prefixed-name
9101 (car art-group) to-method))
9102 (info (gnus-get-info pto-group))
9103 (to-group (gnus-info-group info))
9105 ;; Update the group that has been moved to.
9107 (memq action '(move copy)))
9108 (unless (member to-group to-groups)
9109 (push to-group to-groups))
9111 (unless (memq article gnus-newsgroup-unreads)
9112 (push 'read to-marks)
9114 info (gnus-add-to-range (gnus-info-read info)
9115 (list (cdr art-group)))))
9117 ;; See whether the article is to be put in the cache.
9118 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9119 gnus-article-mark-lists
9120 (delete '(expirable . expire)
9121 (copy-sequence gnus-article-mark-lists))))
9122 (to-article (cdr art-group)))
9124 ;; Enter the article into the cache in the new group,
9125 ;; if that is required.
9126 (when gnus-use-cache
9127 (gnus-cache-possibly-enter-article
9129 (memq article gnus-newsgroup-marked)
9130 (memq article gnus-newsgroup-dormant)
9131 (memq article gnus-newsgroup-unreads)))
9133 (when gnus-preserve-marks
9134 ;; Copy any marks over to the new group.
9135 (when (and (equal to-group gnus-newsgroup-name)
9136 (not (memq article gnus-newsgroup-unreads)))
9137 ;; Mark this article as read in this group.
9138 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9139 (setcdr (gnus-active to-group) to-article)
9140 (setcdr gnus-newsgroup-active to-article))
9143 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9144 (when (memq article (symbol-value
9145 (intern (format "gnus-newsgroup-%s"
9147 (push (cdar marks) to-marks)
9148 ;; If the other group is the same as this group,
9149 ;; then we have to add the mark to the list.
9150 (when (equal to-group gnus-newsgroup-name)
9151 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9154 (intern (format "gnus-newsgroup-%s"
9156 ;; Copy the marks to other group.
9157 (gnus-add-marked-articles
9158 to-group (cdar marks) (list to-article) info)))
9159 (setq marks (cdr marks)))
9161 (gnus-request-set-mark
9162 to-group (list (list (list to-article) 'add to-marks))))
9165 (concat "(gnus-group-set-info '"
9166 (gnus-prin1-to-string (gnus-get-info to-group))
9169 ;; Update the Xref header in this article to point to
9170 ;; the new crossposted article we have just created.
9171 (when (eq action 'crosspost)
9173 (set-buffer copy-buf)
9174 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9175 (nnheader-replace-header "Xref" new-xref)
9176 (gnus-request-replace-article
9177 article gnus-newsgroup-name (current-buffer))))
9179 ;; run the move/copy/crosspost/respool hook
9180 (run-hook-with-args 'gnus-summary-article-move-hook
9183 (assoc article (gnus-data-list nil)))
9188 ;;;!!!Why is this necessary?
9189 (set-buffer gnus-summary-buffer)
9191 (gnus-summary-goto-subject article)
9192 (when (eq action 'move)
9193 (gnus-summary-mark-article article gnus-canceled-mark))))
9194 (gnus-summary-remove-process-mark article))
9195 ;; Re-activate all groups that have been moved to.
9197 (set-buffer gnus-group-buffer)
9198 (let ((gnus-group-marked to-groups))
9199 (gnus-group-get-new-news-this-group nil t)))
9201 (gnus-kill-buffer copy-buf)
9202 (gnus-summary-position-point)
9203 (gnus-set-mode-line 'summary)))
9205 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9206 "Copy the current article to some other group.
9207 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9208 When called interactively, if TO-NEWSGROUP is nil, use the value of
9209 the variable `gnus-move-split-methods' for finding a default target
9211 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9212 re-spool using this method."
9214 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9216 (defun gnus-summary-crosspost-article (&optional n)
9217 "Crosspost the current article to some other group."
9219 (gnus-summary-move-article n nil nil 'crosspost))
9221 (defcustom gnus-summary-respool-default-method nil
9222 "Default method type for respooling an article.
9223 If nil, use to the current newsgroup method."
9225 :group 'gnus-summary-mail)
9227 (defcustom gnus-summary-display-while-building nil
9228 "If non-nil, show and update the summary buffer as it's being built.
9229 If the value is t, update the buffer after every line is inserted. If
9230 the value is an integer (N), update the display every N lines."
9233 :type '(choice (const :tag "off" nil)
9235 (const :tag "frequently" t)))
9237 (defun gnus-summary-respool-article (&optional n method)
9238 "Respool the current article.
9239 The article will be squeezed through the mail spooling process again,
9240 which means that it will be put in some mail newsgroup or other
9241 depending on `nnmail-split-methods'.
9242 If N is a positive number, respool the N next articles.
9243 If N is a negative number, respool the N previous articles.
9244 If N is nil and any articles have been marked with the process mark,
9245 respool those articles instead.
9247 Respooling can be done both from mail groups and \"real\" newsgroups.
9248 In the former case, the articles in question will be moved from the
9249 current group into whatever groups they are destined to. In the
9250 latter case, they will be copied into the relevant groups."
9252 (list current-prefix-arg
9253 (let* ((methods (gnus-methods-using 'respool))
9255 (symbol-name (or gnus-summary-respool-default-method
9256 (car (gnus-find-method-for-group
9257 gnus-newsgroup-name)))))
9259 (gnus-completing-read-with-default
9260 methname "What backend do you want to use when respooling?"
9261 methods nil t nil 'gnus-mail-method-history))
9264 ((zerop (length (setq ms (gnus-servers-using-backend
9266 (list (intern method) ""))
9270 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9271 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9274 (error "No method given for respooling"))
9275 (if (assoc (symbol-name
9276 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9277 (gnus-methods-using 'respool))
9278 (gnus-summary-move-article n nil method)
9279 (gnus-summary-copy-article n nil method)))
9281 (defun gnus-summary-import-article (file &optional edit)
9282 "Import an arbitrary file into a mail newsgroup."
9283 (interactive "fImport file: \nP")
9284 (let ((group gnus-newsgroup-name)
9285 (now (current-time))
9286 atts lines group-art)
9287 (unless (gnus-check-backend-function 'request-accept-article group)
9288 (error "%s does not support article importing" group))
9289 (or (file-readable-p file)
9290 (not (file-regular-p file))
9291 (error "Can't read %s" file))
9293 (set-buffer (gnus-get-buffer-create " *import file*"))
9295 (nnheader-insert-file-contents file)
9296 (goto-char (point-min))
9297 (if (nnheader-article-p)
9299 (goto-char (point-min))
9300 (search-forward "\n\n" nil t)
9301 (narrow-to-region (point-min) (1- (point)))
9302 (goto-char (point-min))
9303 (unless (re-search-forward "^date:" nil t)
9304 (goto-char (point-max))
9305 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9306 ;; This doesn't look like an article, so we fudge some headers.
9307 (setq atts (file-attributes file)
9308 lines (count-lines (point-min) (point-max)))
9309 (insert "From: " (read-string "From: ") "\n"
9310 "Subject: " (read-string "Subject: ") "\n"
9311 "Date: " (message-make-date (nth 5 atts)) "\n"
9312 "Message-ID: " (message-make-message-id) "\n"
9313 "Lines: " (int-to-string lines) "\n"
9314 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9315 (setq group-art (gnus-request-accept-article group nil t))
9316 (kill-buffer (current-buffer)))
9317 (setq gnus-newsgroup-active (gnus-activate-group group))
9319 (gnus-summary-goto-article (cdr group-art) nil t)
9321 (gnus-summary-edit-article))))
9323 (defun gnus-summary-create-article ()
9324 "Create an article in a mail newsgroup."
9326 (let ((group gnus-newsgroup-name)
9327 (now (current-time))
9329 (unless (gnus-check-backend-function 'request-accept-article group)
9330 (error "%s does not support article importing" group))
9332 (set-buffer (gnus-get-buffer-create " *import file*"))
9334 (goto-char (point-min))
9335 ;; This doesn't look like an article, so we fudge some headers.
9336 (insert "From: " (read-string "From: ") "\n"
9337 "Subject: " (read-string "Subject: ") "\n"
9338 "Date: " (message-make-date now) "\n"
9339 "Message-ID: " (message-make-message-id) "\n")
9340 (setq group-art (gnus-request-accept-article group nil t))
9341 (kill-buffer (current-buffer)))
9342 (setq gnus-newsgroup-active (gnus-activate-group group))
9344 (gnus-summary-goto-article (cdr group-art) nil t)
9345 (gnus-summary-edit-article)))
9347 (defun gnus-summary-article-posted-p ()
9348 "Say whether the current (mail) article is available from news as well.
9349 This will be the case if the article has both been mailed and posted."
9351 (let ((id (mail-header-references (gnus-summary-article-header)))
9352 (gnus-override-method (car (gnus-refer-article-methods))))
9353 (if (gnus-request-head id "")
9354 (gnus-message 2 "The current message was found on %s"
9355 gnus-override-method)
9356 (gnus-message 2 "The current message couldn't be found on %s"
9357 gnus-override-method)
9360 (defun gnus-summary-expire-articles (&optional now)
9361 "Expire all articles that are marked as expirable in the current group."
9363 (when (and (not gnus-group-is-exiting-without-update-p)
9364 (gnus-check-backend-function
9365 'request-expire-articles gnus-newsgroup-name))
9366 ;; This backend supports expiry.
9367 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9368 (expirable (if total
9370 ;; We need to update the info for
9371 ;; this group for `gnus-list-of-read-articles'
9372 ;; to give us the right answer.
9373 (gnus-run-hooks 'gnus-exit-group-hook)
9374 (gnus-summary-update-info)
9375 (gnus-list-of-read-articles gnus-newsgroup-name))
9376 (setq gnus-newsgroup-expirable
9377 (sort gnus-newsgroup-expirable '<))))
9378 (expiry-wait (if now 'immediate
9379 (gnus-group-find-parameter
9380 gnus-newsgroup-name 'expiry-wait)))
9381 (nnmail-expiry-target
9382 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9383 nnmail-expiry-target))
9386 ;; There are expirable articles in this group, so we run them
9387 ;; through the expiry process.
9388 (gnus-message 6 "Expiring articles...")
9389 (unless (gnus-check-group gnus-newsgroup-name)
9390 (error "Can't open server for %s" gnus-newsgroup-name))
9391 ;; The list of articles that weren't expired is returned.
9394 (let ((nnmail-expiry-wait-function nil)
9395 (nnmail-expiry-wait expiry-wait))
9396 (setq es (gnus-request-expire-articles
9397 expirable gnus-newsgroup-name)))
9398 (setq es (gnus-request-expire-articles
9399 expirable gnus-newsgroup-name)))
9401 (setq gnus-newsgroup-expirable es))
9402 ;; We go through the old list of expirable, and mark all
9403 ;; really expired articles as nonexistent.
9404 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9405 (let ((gnus-use-cache nil))
9406 (dolist (article expirable)
9407 (when (and (not (memq article es))
9408 (gnus-data-find article))
9409 (gnus-summary-mark-article article gnus-canceled-mark)
9410 (run-hook-with-args 'gnus-summary-article-expire-hook
9413 (assoc article (gnus-data-list nil)))
9417 (gnus-message 6 "Expiring articles...done")))))
9419 (defun gnus-summary-expire-articles-now ()
9420 "Expunge all expirable articles in the current group.
9421 This means that *all* articles that are marked as expirable will be
9422 deleted forever, right now."
9424 (or gnus-expert-user
9426 "Are you really, really, really sure you want to delete all these messages? ")
9428 (gnus-summary-expire-articles t))
9430 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9431 (defun gnus-summary-delete-article (&optional n)
9432 "Delete the N next (mail) articles.
9433 This command actually deletes articles. This is not a marking
9434 command. The article will disappear forever from your life, never to
9437 If N is negative, delete backwards.
9438 If N is nil and articles have been marked with the process mark,
9439 delete these instead.
9441 If `gnus-novice-user' is non-nil you will be asked for
9442 confirmation before the articles are deleted."
9444 (unless (gnus-check-backend-function 'request-expire-articles
9445 gnus-newsgroup-name)
9446 (error "The current newsgroup does not support article deletion"))
9447 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9448 (error "Couldn't open server"))
9449 ;; Compute the list of articles to delete.
9450 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9451 (nnmail-expiry-target 'delete)
9453 (if (and gnus-novice-user
9454 (not (gnus-yes-or-no-p
9455 (format "Do you really want to delete %s forever? "
9456 (if (> (length articles) 1)
9457 (format "these %s articles" (length articles))
9460 ;; Delete the articles.
9461 (setq not-deleted (gnus-request-expire-articles
9462 articles gnus-newsgroup-name 'force))
9464 (gnus-summary-remove-process-mark (car articles))
9465 ;; The backend might not have been able to delete the article
9467 (unless (memq (car articles) not-deleted)
9468 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9469 (let* ((article (car articles))
9470 (ghead (gnus-data-header
9471 (assoc article (gnus-data-list nil)))))
9472 (run-hook-with-args 'gnus-summary-article-delete-hook
9473 'delete ghead gnus-newsgroup-name nil
9475 (setq articles (cdr articles)))
9477 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9478 (gnus-summary-position-point)
9479 (gnus-set-mode-line 'summary)
9482 (defun gnus-summary-edit-article (&optional arg)
9483 "Edit the current article.
9484 This will have permanent effect only in mail groups.
9485 If ARG is nil, edit the decoded articles.
9486 If ARG is 1, edit the raw articles.
9487 If ARG is 2, edit the raw articles even in read-only groups.
9488 If ARG is 3, edit the articles with the current handles.
9489 Otherwise, allow editing of articles even in read-only
9492 (let (force raw current-handles)
9501 (setq current-handles
9502 (and (gnus-buffer-live-p gnus-article-buffer)
9503 (with-current-buffer gnus-article-buffer
9505 gnus-article-mime-handles
9506 (setq gnus-article-mime-handles nil))))))
9509 (when (and raw (not force)
9510 (member gnus-newsgroup-name '("nndraft:delayed"
9513 (error "Can't edit the raw article in group %s"
9514 gnus-newsgroup-name))
9516 (set-buffer gnus-summary-buffer)
9517 (let ((mail-parse-charset gnus-newsgroup-charset)
9518 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9519 (gnus-set-global-variables)
9520 (when (and (not force)
9521 (gnus-group-read-only-p))
9522 (error "The current newsgroup does not support article editing"))
9523 (gnus-summary-show-article t)
9524 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9525 (with-current-buffer gnus-article-buffer
9526 (mm-enable-multibyte)))
9527 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9529 (gnus-article-edit-article
9532 (let ((mbl mml-buffer-list))
9533 (setq mml-buffer-list nil)
9534 (mime-to-mml ,'current-handles)
9535 (let ((mbl1 mml-buffer-list))
9536 (setq mml-buffer-list mbl)
9537 (set (make-local-variable 'mml-buffer-list) mbl1))
9538 (gnus-make-local-hook 'kill-buffer-hook)
9539 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9540 `(lambda (no-highlight)
9541 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9542 (message-options message-options)
9543 (message-options-set-recipient)
9544 (mail-parse-ignored-charsets
9545 ',gnus-newsgroup-ignored-charsets))
9546 ,(if (not raw) '(progn
9548 (mml-destroy-buffers)
9549 (remove-hook 'kill-buffer-hook
9550 'mml-destroy-buffers t)
9551 (kill-local-variable 'mml-buffer-list)))
9552 (gnus-summary-edit-article-done
9553 ,(or (mail-header-references gnus-current-headers) "")
9554 ,(gnus-group-read-only-p)
9555 ,gnus-summary-buffer no-highlight))))))))
9557 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9559 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9561 "Make edits to the current article permanent."
9564 ;; The buffer restriction contains the entire article if it exists.
9565 (when (article-goto-body)
9566 (let ((lines (count-lines (point) (point-max)))
9567 (length (- (point-max) (point)))
9568 (case-fold-search t)
9569 (body (copy-marker (point))))
9570 (goto-char (point-min))
9571 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9572 (delete-region (match-beginning 1) (match-end 1))
9573 (insert (number-to-string length)))
9574 (goto-char (point-min))
9575 (when (re-search-forward
9576 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9577 (delete-region (match-beginning 1) (match-end 1))
9578 (insert (number-to-string length)))
9579 (goto-char (point-min))
9580 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9581 (delete-region (match-beginning 1) (match-end 1))
9582 (insert (number-to-string lines))))))
9583 ;; Replace the article.
9584 (let ((buf (current-buffer)))
9586 (insert-buffer-substring buf)
9588 (if (and (not read-only)
9589 (not (gnus-request-replace-article
9590 (cdr gnus-article-current) (car gnus-article-current)
9591 (current-buffer) t)))
9592 (error "Couldn't replace article")
9593 ;; Update the summary buffer.
9595 (equal (message-tokenize-header references " ")
9596 (message-tokenize-header
9597 (or (message-fetch-field "references") "") " ")))
9598 ;; We only have to update this line.
9601 (message-narrow-to-head)
9602 (let ((head (buffer-string))
9605 (insert (format "211 %d Article retrieved.\n"
9606 (cdr gnus-article-current)))
9609 (let ((nntp-server-buffer (current-buffer)))
9610 (setq header (car (gnus-get-newsgroup-headers
9613 (set-buffer gnus-summary-buffer)
9614 (gnus-data-set-header
9615 (gnus-data-find (cdr gnus-article-current))
9617 (gnus-summary-update-article-line
9618 (cdr gnus-article-current) header)
9619 (if (gnus-summary-goto-subject
9620 (cdr gnus-article-current) nil t)
9621 (gnus-summary-update-secondary-mark
9622 (cdr gnus-article-current))))))))
9624 (set-buffer (or buffer gnus-summary-buffer))
9625 (gnus-summary-update-article (cdr gnus-article-current))
9626 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9627 (gnus-summary-update-secondary-mark
9628 (cdr gnus-article-current))))
9629 ;; Prettify the article buffer again.
9630 (unless no-highlight
9632 (set-buffer gnus-article-buffer)
9633 ;;;!!! Fix this -- article should be rehighlighted.
9634 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9635 (set-buffer gnus-original-article-buffer)
9636 (gnus-request-article
9637 (cdr gnus-article-current)
9638 (car gnus-article-current) (current-buffer))))
9639 ;; Prettify the summary buffer line.
9640 (when (gnus-visual-p 'summary-highlight 'highlight)
9641 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9643 (defun gnus-summary-edit-wash (key)
9644 "Perform editing command KEY in the article buffer."
9648 (message "%s" (concat (this-command-keys) "- "))
9651 (gnus-summary-edit-article)
9652 (execute-kbd-macro (concat (this-command-keys) key))
9653 (gnus-article-edit-done))
9657 (defun gnus-summary-respool-query (&optional silent trace)
9658 "Query where the respool algorithm would put this article."
9660 (let (gnus-mark-article-hook)
9661 (gnus-summary-select-article)
9663 (set-buffer gnus-original-article-buffer)
9664 (let ((groups (nnmail-article-group 'identity trace)))
9667 (message "This message would go to %s"
9668 (mapconcat 'car groups ", "))
9669 (message "This message would go to no groups"))
9672 (defun gnus-summary-respool-trace ()
9673 "Trace where the respool algorithm would put this article.
9674 Display a buffer showing all fancy splitting patterns which matched."
9676 (gnus-summary-respool-query nil t))
9678 ;; Summary marking commands.
9680 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9681 "Mark articles which has the same subject as read, and then select the next.
9682 If UNMARK is positive, remove any kind of mark.
9683 If UNMARK is negative, tick articles."
9686 (setq unmark (prefix-numeric-value unmark)))
9688 (gnus-summary-mark-same-subject
9689 (gnus-summary-article-subject) unmark)))
9690 ;; Select next unread article. If auto-select-same mode, should
9691 ;; select the first unread article.
9692 (gnus-summary-next-article t (and gnus-auto-select-same
9693 (gnus-summary-article-subject)))
9694 (gnus-message 7 "%d article%s marked as %s"
9695 count (if (= count 1) " is" "s are")
9696 (if unmark "unread" "read"))))
9698 (defun gnus-summary-kill-same-subject (&optional unmark)
9699 "Mark articles which has the same subject as read.
9700 If UNMARK is positive, remove any kind of mark.
9701 If UNMARK is negative, tick articles."
9704 (setq unmark (prefix-numeric-value unmark)))
9706 (gnus-summary-mark-same-subject
9707 (gnus-summary-article-subject) unmark)))
9708 ;; If marked as read, go to next unread subject.
9710 ;; Go to next unread subject.
9711 (gnus-summary-next-subject 1 t))
9712 (gnus-message 7 "%d articles are marked as %s"
9713 count (if unmark "unread" "read"))))
9715 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9716 "Mark articles with same SUBJECT as read, and return marked number.
9717 If optional argument UNMARK is positive, remove any kinds of marks.
9718 If optional argument UNMARK is negative, mark articles as unread instead."
9722 ((null unmark) ; Mark as read.
9725 (gnus-summary-mark-article-as-read gnus-killed-mark)
9726 (gnus-summary-show-thread) t)
9727 (gnus-summary-find-subject subject))
9728 (setq count (1+ count))))
9729 ((> unmark 0) ; Tick.
9732 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9733 (gnus-summary-show-thread) t)
9734 (gnus-summary-find-subject subject))
9735 (setq count (1+ count))))
9736 (t ; Mark as unread.
9739 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9740 (gnus-summary-show-thread) t)
9741 (gnus-summary-find-subject subject))
9742 (setq count (1+ count)))))
9743 (gnus-set-mode-line 'summary)
9744 ;; Return the number of marked articles.
9747 (defun gnus-summary-mark-as-processable (n &optional unmark)
9748 "Set the process mark on the next N articles.
9749 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9750 the process mark instead. The difference between N and the actual
9751 number of articles marked is returned."
9753 (if (and (null n) (gnus-region-active-p))
9754 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9755 (setq n (prefix-numeric-value n))
9756 (let ((backward (< n 0))
9761 (gnus-summary-remove-process-mark
9762 (gnus-summary-article-number))
9763 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9764 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9767 (gnus-message 7 "No more articles"))
9768 (gnus-summary-recenter)
9769 (gnus-summary-position-point)
9772 (defun gnus-summary-unmark-as-processable (n)
9773 "Remove the process mark from the next N articles.
9774 If N is negative, unmark backward instead. The difference between N and
9775 the actual number of articles unmarked is returned."
9777 (gnus-summary-mark-as-processable n t))
9779 (defun gnus-summary-unmark-all-processable ()
9780 "Remove the process mark from all articles."
9783 (while gnus-newsgroup-processable
9784 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9785 (gnus-summary-position-point))
9787 (defun gnus-summary-add-mark (article type)
9788 "Mark ARTICLE with a mark of TYPE."
9789 (let ((vtype (car (assq type gnus-article-mark-lists)))
9792 (error "No such mark type: %s" type)
9793 (setq var (intern (format "gnus-newsgroup-%s" type)))
9794 (set var (cons article (symbol-value var)))
9795 (if (memq type '(processable cached replied forwarded recent saved))
9796 (gnus-summary-update-secondary-mark article)
9797 ;;; !!! This is bogus. We should find out what primary
9798 ;;; !!! mark we want to set.
9799 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9801 (defun gnus-summary-mark-as-expirable (n)
9802 "Mark N articles forward as expirable.
9803 If N is negative, mark backward instead. The difference between N and
9804 the actual number of articles marked is returned."
9806 (gnus-summary-mark-forward n gnus-expirable-mark))
9808 (defun gnus-summary-mark-as-spam (n)
9809 "Mark N articles forward as spam.
9810 If N is negative, mark backward instead. The difference between N and
9811 the actual number of articles marked is returned."
9813 (gnus-summary-mark-forward n gnus-spam-mark))
9815 (defun gnus-summary-mark-article-as-replied (article)
9816 "Mark ARTICLE as replied to and update the summary line.
9817 ARTICLE can also be a list of articles."
9818 (interactive (list (gnus-summary-article-number)))
9819 (let ((articles (if (listp article) article (list article))))
9820 (dolist (article articles)
9821 (unless (numberp article)
9822 (error "%s is not a number" article))
9823 (push article gnus-newsgroup-replied)
9824 (let ((buffer-read-only nil))
9825 (when (gnus-summary-goto-subject article nil t)
9826 (gnus-summary-update-secondary-mark article))))))
9828 (defun gnus-summary-mark-article-as-forwarded (article)
9829 "Mark ARTICLE as forwarded and update the summary line.
9830 ARTICLE can also be a list of articles."
9831 (let ((articles (if (listp article) article (list article))))
9832 (dolist (article articles)
9833 (push article gnus-newsgroup-forwarded)
9834 (let ((buffer-read-only nil))
9835 (when (gnus-summary-goto-subject article nil t)
9836 (gnus-summary-update-secondary-mark article))))))
9838 (defun gnus-summary-set-bookmark (article)
9839 "Set a bookmark in current article."
9840 (interactive (list (gnus-summary-article-number)))
9841 (when (or (not (get-buffer gnus-article-buffer))
9842 (not gnus-current-article)
9843 (not gnus-article-current)
9844 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9845 (error "No current article selected"))
9846 ;; Remove old bookmark, if one exists.
9847 (gnus-pull article gnus-newsgroup-bookmarks)
9848 ;; Set the new bookmark, which is on the form
9849 ;; (article-number . line-number-in-body).
9852 (with-current-buffer gnus-article-buffer
9859 gnus-newsgroup-bookmarks)
9860 (gnus-message 6 "A bookmark has been added to the current article."))
9862 (defun gnus-summary-remove-bookmark (article)
9863 "Remove the bookmark from the current article."
9864 (interactive (list (gnus-summary-article-number)))
9865 ;; Remove old bookmark, if one exists.
9866 (if (not (assq article gnus-newsgroup-bookmarks))
9867 (gnus-message 6 "No bookmark in current article.")
9868 (gnus-pull article gnus-newsgroup-bookmarks)
9869 (gnus-message 6 "Removed bookmark.")))
9871 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9872 (defun gnus-summary-mark-as-dormant (n)
9873 "Mark N articles forward as dormant.
9874 If N is negative, mark backward instead. The difference between N and
9875 the actual number of articles marked is returned."
9877 (gnus-summary-mark-forward n gnus-dormant-mark))
9879 (defun gnus-summary-set-process-mark (article)
9880 "Set the process mark on ARTICLE and update the summary line."
9881 (setq gnus-newsgroup-processable
9883 (delq article gnus-newsgroup-processable)))
9884 (when (gnus-summary-goto-subject article)
9885 (gnus-summary-show-thread)
9886 (gnus-summary-goto-subject article)
9887 (gnus-summary-update-secondary-mark article)))
9889 (defun gnus-summary-remove-process-mark (article)
9890 "Remove the process mark from ARTICLE and update the summary line."
9891 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9892 (when (gnus-summary-goto-subject article)
9893 (gnus-summary-show-thread)
9894 (gnus-summary-goto-subject article)
9895 (gnus-summary-update-secondary-mark article)))
9897 (defun gnus-summary-set-saved-mark (article)
9898 "Set the process mark on ARTICLE and update the summary line."
9899 (push article gnus-newsgroup-saved)
9900 (when (gnus-summary-goto-subject article)
9901 (gnus-summary-update-secondary-mark article)))
9903 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9904 "Mark N articles as read forwards.
9905 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9906 The difference between N and the actual number of articles marked is
9908 If NO-EXPIRE, auto-expiry will be inhibited."
9910 (gnus-summary-show-thread)
9911 (let ((backward (< n 0))
9912 (gnus-summary-goto-unread
9913 (and gnus-summary-goto-unread
9914 (not (eq gnus-summary-goto-unread 'never))
9915 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9916 gnus-ticked-mark gnus-dormant-mark)))))
9918 (mark (or mark gnus-del-mark)))
9920 (gnus-summary-mark-article nil mark no-expire)
9921 (zerop (gnus-summary-next-subject
9923 (and gnus-summary-goto-unread
9924 (not (eq gnus-summary-goto-unread 'never)))
9928 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9929 (gnus-summary-recenter)
9930 (gnus-summary-position-point)
9931 (gnus-set-mode-line 'summary)
9934 (defun gnus-summary-mark-article-as-read (mark)
9935 "Mark the current article quickly as read with MARK."
9936 (let ((article (gnus-summary-article-number)))
9937 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9938 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9939 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9940 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9941 (push (cons article mark) gnus-newsgroup-reads)
9942 ;; Possibly remove from cache, if that is used.
9943 (when gnus-use-cache
9944 (gnus-cache-enter-remove-article article))
9945 ;; Allow the backend to change the mark.
9946 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9947 ;; Check for auto-expiry.
9948 (when (and gnus-newsgroup-auto-expire
9949 (memq mark gnus-auto-expirable-marks))
9950 (setq mark gnus-expirable-mark)
9951 ;; Let the backend know about the mark change.
9952 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9953 (push article gnus-newsgroup-expirable))
9954 ;; Set the mark in the buffer.
9955 (gnus-summary-update-mark mark 'unread)
9958 (defun gnus-summary-mark-article-as-unread (mark)
9959 "Mark the current article quickly as unread with MARK."
9960 (let* ((article (gnus-summary-article-number))
9961 (old-mark (gnus-summary-article-mark article)))
9962 ;; Allow the backend to change the mark.
9963 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9964 (if (eq mark old-mark)
9968 (gnus-error 1 "Can't mark negative article numbers")
9970 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9971 (setq gnus-newsgroup-spam-marked
9972 (delq article gnus-newsgroup-spam-marked))
9973 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9974 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9975 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9976 (cond ((= mark gnus-ticked-mark)
9977 (setq gnus-newsgroup-marked
9978 (gnus-add-to-sorted-list gnus-newsgroup-marked
9980 ((= mark gnus-spam-mark)
9981 (setq gnus-newsgroup-spam-marked
9982 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9984 ((= mark gnus-dormant-mark)
9985 (setq gnus-newsgroup-dormant
9986 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9989 (setq gnus-newsgroup-unreads
9990 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9992 (gnus-pull article gnus-newsgroup-reads)
9994 ;; See whether the article is to be put in the cache.
9996 (vectorp (gnus-summary-article-header article))
9998 (gnus-cache-possibly-enter-article
9999 gnus-newsgroup-name article
10000 (= mark gnus-ticked-mark)
10001 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10004 (gnus-summary-update-mark mark 'unread)
10007 (defun gnus-summary-mark-article (&optional article mark no-expire)
10008 "Mark ARTICLE with MARK. MARK can be any character.
10009 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10010 `??' (dormant) and `?E' (expirable).
10011 If MARK is nil, then the default character `?r' is used.
10012 If ARTICLE is nil, then the article on the current line will be
10014 If NO-EXPIRE, auto-expiry will be inhibited."
10015 ;; The mark might be a string.
10016 (when (stringp mark)
10017 (setq mark (aref mark 0)))
10018 ;; If no mark is given, then we check auto-expiring.
10020 (setq mark gnus-del-mark))
10021 (when (and (not no-expire)
10022 gnus-newsgroup-auto-expire
10023 (memq mark gnus-auto-expirable-marks))
10024 (setq mark gnus-expirable-mark))
10025 (let ((article (or article (gnus-summary-article-number)))
10026 (old-mark (gnus-summary-article-mark article)))
10027 ;; Allow the backend to change the mark.
10028 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10029 (if (eq mark old-mark)
10032 (error "No article on current line"))
10033 (if (not (if (or (= mark gnus-unread-mark)
10034 (= mark gnus-ticked-mark)
10035 (= mark gnus-spam-mark)
10036 (= mark gnus-dormant-mark))
10037 (gnus-mark-article-as-unread article mark)
10038 (gnus-mark-article-as-read article mark)))
10040 ;; See whether the article is to be put in the cache.
10041 (and gnus-use-cache
10042 (not (= mark gnus-canceled-mark))
10043 (vectorp (gnus-summary-article-header article))
10045 (gnus-cache-possibly-enter-article
10046 gnus-newsgroup-name article
10047 (= mark gnus-ticked-mark)
10048 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10050 (when (gnus-summary-goto-subject article nil t)
10051 (let ((buffer-read-only nil))
10052 (gnus-summary-show-thread)
10054 (gnus-summary-update-mark mark 'unread)
10057 (defun gnus-summary-update-secondary-mark (article)
10058 "Update the secondary (read, process, cache) mark."
10059 (gnus-summary-update-mark
10060 (cond ((memq article gnus-newsgroup-processable)
10062 ((memq article gnus-newsgroup-cached)
10064 ((memq article gnus-newsgroup-replied)
10066 ((memq article gnus-newsgroup-forwarded)
10067 gnus-forwarded-mark)
10068 ((memq article gnus-newsgroup-saved)
10070 ((memq article gnus-newsgroup-recent)
10072 ((memq article gnus-newsgroup-unseen)
10076 (when (gnus-visual-p 'summary-highlight 'highlight)
10077 (gnus-run-hooks 'gnus-summary-update-hook))
10080 (defun gnus-summary-update-download-mark (article)
10081 "Update the download mark."
10082 (gnus-summary-update-mark
10083 (cond ((memq article gnus-newsgroup-undownloaded)
10084 gnus-undownloaded-mark)
10085 (gnus-newsgroup-agentized
10086 gnus-downloaded-mark)
10090 (gnus-summary-update-line t)
10093 (defun gnus-summary-update-mark (mark type)
10094 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10095 (buffer-read-only nil))
10096 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10098 (when (looking-at "\r")
10100 (when (<= (+ forward (point)) (point-max))
10101 ;; Go to the right position on the line.
10102 (goto-char (+ forward (point)))
10103 ;; Replace the old mark with the new mark.
10104 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10105 ;; Optionally update the marks by some user rule.
10106 (when (eq type 'unread)
10107 (gnus-data-set-mark
10108 (gnus-data-find (gnus-summary-article-number)) mark)
10109 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10111 (defun gnus-mark-article-as-read (article &optional mark)
10112 "Enter ARTICLE in the pertinent lists and remove it from others."
10113 ;; Make the article expirable.
10114 (let ((mark (or mark gnus-del-mark)))
10115 (setq gnus-newsgroup-expirable
10116 (if (= mark gnus-expirable-mark)
10117 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10118 (delq article gnus-newsgroup-expirable)))
10119 ;; Remove from unread and marked lists.
10120 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10121 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10122 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10123 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10124 (push (cons article mark) gnus-newsgroup-reads)
10125 ;; Possibly remove from cache, if that is used.
10126 (when gnus-use-cache
10127 (gnus-cache-enter-remove-article article))
10130 (defun gnus-mark-article-as-unread (article &optional mark)
10131 "Enter ARTICLE in the pertinent lists and remove it from others."
10132 (let ((mark (or mark gnus-ticked-mark)))
10135 (gnus-error 1 "Can't mark negative article numbers")
10137 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10138 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10139 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10140 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10141 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10143 ;; Unsuppress duplicates?
10144 (when gnus-suppress-duplicates
10145 (gnus-dup-unsuppress-article article))
10147 (cond ((= mark gnus-ticked-mark)
10148 (setq gnus-newsgroup-marked
10149 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10150 ((= mark gnus-spam-mark)
10151 (setq gnus-newsgroup-spam-marked
10152 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10154 ((= mark gnus-dormant-mark)
10155 (setq gnus-newsgroup-dormant
10156 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10158 (setq gnus-newsgroup-unreads
10159 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10160 (gnus-pull article gnus-newsgroup-reads)
10163 (defalias 'gnus-summary-mark-as-unread-forward
10164 'gnus-summary-tick-article-forward)
10165 (make-obsolete 'gnus-summary-mark-as-unread-forward
10166 'gnus-summary-tick-article-forward)
10167 (defun gnus-summary-tick-article-forward (n)
10168 "Tick N articles forwards.
10169 If N is negative, tick backwards instead.
10170 The difference between N and the number of articles ticked is returned."
10172 (gnus-summary-mark-forward n gnus-ticked-mark))
10174 (defalias 'gnus-summary-mark-as-unread-backward
10175 'gnus-summary-tick-article-backward)
10176 (make-obsolete 'gnus-summary-mark-as-unread-backward
10177 'gnus-summary-tick-article-backward)
10178 (defun gnus-summary-tick-article-backward (n)
10179 "Tick N articles backwards.
10180 The difference between N and the number of articles ticked is returned."
10182 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10184 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10185 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10186 (defun gnus-summary-tick-article (&optional article clear-mark)
10187 "Mark current article as unread.
10188 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10189 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10191 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10192 gnus-ticked-mark)))
10194 (defun gnus-summary-mark-as-read-forward (n)
10195 "Mark N articles as read forwards.
10196 If N is negative, mark backwards instead.
10197 The difference between N and the actual number of articles marked is
10200 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10202 (defun gnus-summary-mark-as-read-backward (n)
10203 "Mark the N articles as read backwards.
10204 The difference between N and the actual number of articles marked is
10207 (gnus-summary-mark-forward
10208 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10210 (defun gnus-summary-mark-as-read (&optional article mark)
10211 "Mark current article as read.
10212 ARTICLE specifies the article to be marked as read.
10213 MARK specifies a string to be inserted at the beginning of the line."
10214 (gnus-summary-mark-article article mark))
10216 (defun gnus-summary-clear-mark-forward (n)
10217 "Clear marks from N articles forward.
10218 If N is negative, clear backward instead.
10219 The difference between N and the number of marks cleared is returned."
10221 (gnus-summary-mark-forward n gnus-unread-mark))
10223 (defun gnus-summary-clear-mark-backward (n)
10224 "Clear marks from N articles backward.
10225 The difference between N and the number of marks cleared is returned."
10227 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10229 (defun gnus-summary-mark-unread-as-read ()
10230 "Intended to be used by `gnus-summary-mark-article-hook'."
10231 (when (memq gnus-current-article gnus-newsgroup-unreads)
10232 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10234 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10235 "Intended to be used by `gnus-summary-mark-article-hook'."
10236 (let ((mark (gnus-summary-article-mark)))
10237 (when (or (gnus-unread-mark-p mark)
10238 (gnus-read-mark-p mark))
10239 (gnus-summary-mark-article gnus-current-article
10240 (or new-mark gnus-read-mark)))))
10242 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10243 "Intended to be used by `gnus-summary-mark-article-hook'."
10244 (let ((mark (gnus-summary-article-mark)))
10245 (when (or (gnus-unread-mark-p mark)
10246 (gnus-read-mark-p mark))
10247 (gnus-summary-mark-article (gnus-summary-article-number)
10248 (or new-mark gnus-read-mark)))))
10250 (defun gnus-summary-mark-unread-as-ticked ()
10251 "Intended to be used by `gnus-summary-mark-article-hook'."
10252 (when (memq gnus-current-article gnus-newsgroup-unreads)
10253 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10255 (defun gnus-summary-mark-region-as-read (point mark all)
10256 "Mark all unread articles between point and mark as read.
10257 If given a prefix, mark all articles between point and mark as read,
10258 even ticked and dormant ones."
10259 (interactive "r\nP")
10263 (beginning-of-line)
10268 (memq (setq article (gnus-summary-article-number))
10269 gnus-newsgroup-unreads))
10270 (gnus-summary-mark-article article gnus-del-mark))
10272 (gnus-summary-find-next))))))
10274 (defun gnus-summary-mark-below (score mark)
10275 "Mark articles with score less than SCORE with MARK."
10276 (interactive "P\ncMark: ")
10277 (setq score (if score
10278 (prefix-numeric-value score)
10279 (or gnus-summary-default-score 0)))
10281 (set-buffer gnus-summary-buffer)
10282 (goto-char (point-min))
10285 (and (< (gnus-summary-article-score) score)
10286 (gnus-summary-mark-article nil mark))
10287 (gnus-summary-find-next)))))
10289 (defun gnus-summary-kill-below (&optional score)
10290 "Mark articles with score below SCORE as read."
10292 (gnus-summary-mark-below score gnus-killed-mark))
10294 (defun gnus-summary-clear-above (&optional score)
10295 "Clear all marks from articles with score above SCORE."
10297 (gnus-summary-mark-above score gnus-unread-mark))
10299 (defun gnus-summary-tick-above (&optional score)
10300 "Tick all articles with score above SCORE."
10302 (gnus-summary-mark-above score gnus-ticked-mark))
10304 (defun gnus-summary-mark-above (score mark)
10305 "Mark articles with score over SCORE with MARK."
10306 (interactive "P\ncMark: ")
10307 (setq score (if score
10308 (prefix-numeric-value score)
10309 (or gnus-summary-default-score 0)))
10311 (set-buffer gnus-summary-buffer)
10312 (goto-char (point-min))
10314 (when (> (gnus-summary-article-score) score)
10315 (gnus-summary-mark-article nil mark))
10317 (gnus-summary-find-next)))))
10319 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10320 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10321 (defun gnus-summary-limit-include-expunged (&optional no-error)
10322 "Display all the hidden articles that were expunged for low scores."
10324 (let ((buffer-read-only nil))
10325 (let ((scored gnus-newsgroup-scored)
10328 (unless (gnus-summary-article-header (caar scored))
10329 (and (setq h (gnus-number-to-header (caar scored)))
10330 (< (cdar scored) gnus-summary-expunge-below)
10332 (setq scored (cdr scored)))
10334 (when (not no-error)
10335 (error "No expunged articles hidden"))
10336 (goto-char (point-min))
10337 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10338 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10339 (mapcar (lambda (x) (push (mail-header-number x)
10340 gnus-newsgroup-limit))
10342 (gnus-summary-prepare-unthreaded (nreverse headers))
10343 (goto-char (point-min))
10344 (gnus-summary-position-point)
10347 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10348 "Mark all unread articles in this newsgroup as read.
10349 If prefix argument ALL is non-nil, ticked and dormant articles will
10350 also be marked as read.
10351 If QUIETLY is non-nil, no questions will be asked.
10353 If TO-HERE is non-nil, it should be a point in the buffer. All
10354 articles before (after, if REVERSE is set) this point will be marked
10357 Note that this function will only catch up the unread article
10358 in the current summary buffer limitation.
10360 The number of articles marked as read is returned."
10365 (not gnus-interactive-catchup) ;Without confirmation?
10369 "Mark absolutely all articles as read? "
10370 "Mark all unread articles as read? ")))
10372 (not gnus-newsgroup-adaptive)
10373 (not gnus-newsgroup-auto-expire)
10374 (not gnus-suppress-duplicates)
10375 (or (not gnus-use-cache)
10376 (eq gnus-use-cache 'passive)))
10379 (setq gnus-newsgroup-marked nil
10380 gnus-newsgroup-spam-marked nil
10381 gnus-newsgroup-dormant nil))
10382 (setq gnus-newsgroup-unreads
10383 (gnus-sorted-nunion
10384 (gnus-intersection gnus-newsgroup-unreads
10385 gnus-newsgroup-downloadable)
10386 gnus-newsgroup-unfetched)))
10387 ;; We actually mark all articles as canceled, which we
10388 ;; have to do when using auto-expiry or adaptive scoring.
10389 (gnus-summary-show-all-threads)
10390 (if (and to-here reverse)
10392 (goto-char to-here)
10393 (gnus-summary-mark-current-read-and-unread-as-read
10395 (while (gnus-summary-find-next (not all))
10396 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10397 (when (gnus-summary-first-subject (not all))
10399 (if to-here (< (point) to-here) t)
10400 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10401 (gnus-summary-find-next (not all))))))
10402 (gnus-set-mode-line 'summary))
10404 (gnus-summary-position-point)))
10406 (defun gnus-summary-catchup-to-here (&optional all)
10407 "Mark all unticked articles before the current one as read.
10408 If ALL is non-nil, also mark ticked and dormant articles as read."
10411 (gnus-save-hidden-threads
10412 (let ((beg (point)))
10413 ;; We check that there are unread articles.
10414 (when (or all (gnus-summary-find-prev))
10415 (gnus-summary-catchup all t beg)))))
10416 (gnus-summary-position-point))
10418 (defun gnus-summary-catchup-from-here (&optional all)
10419 "Mark all unticked articles after (and including) the current one as read.
10420 If ALL is non-nil, also mark ticked and dormant articles as read."
10423 (gnus-save-hidden-threads
10424 (let ((beg (point)))
10425 ;; We check that there are unread articles.
10426 (when (or all (gnus-summary-find-next))
10427 (gnus-summary-catchup all t beg nil t)))))
10428 (gnus-summary-position-point))
10430 (defun gnus-summary-catchup-all (&optional quietly)
10431 "Mark all articles in this newsgroup as read.
10432 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10433 instead, which marks only unread articles as read."
10435 (gnus-summary-catchup t quietly))
10437 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10438 "Mark all unread articles in this group as read, then exit.
10439 If prefix argument ALL is non-nil, all articles are marked as read.
10440 If QUIETLY is non-nil, no questions will be asked."
10442 (when (gnus-summary-catchup all quietly nil 'fast)
10443 ;; Select next newsgroup or exit.
10444 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10445 (eq gnus-auto-select-next 'quietly))
10446 (gnus-summary-next-group nil)
10447 (gnus-summary-exit))))
10449 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10450 "Mark all articles in this newsgroup as read, and then exit.
10451 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10452 instead, which marks only unread articles as read."
10454 (gnus-summary-catchup-and-exit t quietly))
10456 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10457 "Mark all articles in this group as read and select the next group.
10458 If given a prefix, mark all articles, unread as well as ticked, as
10462 (gnus-summary-catchup all))
10463 (gnus-summary-next-group))
10469 (defmacro gnus-with-article (article &rest forms)
10470 "Select ARTICLE and perform FORMS in the original article buffer.
10471 Then replace the article with the result."
10473 ;; We don't want the article to be marked as read.
10474 (let (gnus-mark-article-hook)
10475 (gnus-summary-select-article t t nil ,article))
10476 (set-buffer gnus-original-article-buffer)
10478 (if (not (gnus-check-backend-function
10479 'request-replace-article (car gnus-article-current)))
10480 (gnus-message 5 "Read-only group; not replacing")
10481 (unless (gnus-request-replace-article
10482 ,article (car gnus-article-current)
10483 (current-buffer) t)
10484 (error "Couldn't replace article")))
10485 ;; The cache and backlog have to be flushed somewhat.
10486 (when gnus-keep-backlog
10487 (gnus-backlog-remove-article
10488 (car gnus-article-current) (cdr gnus-article-current)))
10489 (when gnus-use-cache
10490 (gnus-cache-update-article
10491 (car gnus-article-current) (cdr gnus-article-current)))))
10493 (put 'gnus-with-article 'lisp-indent-function 1)
10494 (put 'gnus-with-article 'edebug-form-spec '(form body))
10496 ;; Thread-based commands.
10498 (defun gnus-summary-articles-in-thread (&optional article)
10499 "Return a list of all articles in the current thread.
10500 If ARTICLE is non-nil, return all articles in the thread that starts
10501 with that article."
10502 (let* ((article (or article (gnus-summary-article-number)))
10503 (data (gnus-data-find-list article))
10504 (top-level (gnus-data-level (car data)))
10506 (cond ((null gnus-thread-operation-ignore-subject)
10507 (gnus-simplify-subject-re
10508 (mail-header-subject (gnus-data-header (car data)))))
10509 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10510 (gnus-simplify-subject-fuzzy
10511 (mail-header-subject (gnus-data-header (car data)))))
10513 (end-point (save-excursion
10514 (if (gnus-summary-go-to-next-thread)
10515 (point) (point-max))))
10518 (< (gnus-data-pos (car data)) end-point))
10519 (when (or (not top-subject)
10520 (string= top-subject
10521 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10522 (gnus-simplify-subject-fuzzy
10523 (mail-header-subject
10524 (gnus-data-header (car data))))
10525 (gnus-simplify-subject-re
10526 (mail-header-subject
10527 (gnus-data-header (car data)))))))
10528 (push (gnus-data-number (car data)) articles))
10529 (unless (and (setq data (cdr data))
10530 (> (gnus-data-level (car data)) top-level))
10532 ;; Return the list of articles.
10533 (nreverse articles)))
10535 (defun gnus-summary-rethread-current ()
10536 "Rethread the thread the current article is part of."
10538 (let* ((gnus-show-threads t)
10539 (article (gnus-summary-article-number))
10540 (id (mail-header-id (gnus-summary-article-header)))
10541 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10543 (error "No article on the current line"))
10544 (gnus-rebuild-thread id)
10545 (gnus-summary-goto-subject article)))
10547 (defun gnus-summary-reparent-thread ()
10548 "Make the current article child of the marked (or previous) article.
10550 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10551 is non-nil or the Subject: of both articles are the same."
10553 (unless (not (gnus-group-read-only-p))
10554 (error "The current newsgroup does not support article editing"))
10555 (unless (<= (length gnus-newsgroup-processable) 1)
10556 (error "No more than one article may be marked"))
10557 (save-window-excursion
10558 (let ((gnus-article-buffer " *reparent*")
10559 (current-article (gnus-summary-article-number))
10560 ;; First grab the marked article, otherwise one line up.
10561 (parent-article (if (not (null gnus-newsgroup-processable))
10562 (car gnus-newsgroup-processable)
10564 (if (eq (forward-line -1) 0)
10565 (gnus-summary-article-number)
10566 (error "Beginning of summary buffer"))))))
10567 (unless (not (eq current-article parent-article))
10568 (error "An article may not be self-referential"))
10569 (let ((message-id (mail-header-id
10570 (gnus-summary-article-header parent-article))))
10571 (unless (and message-id (not (equal message-id "")))
10572 (error "No message-id in desired parent"))
10573 (gnus-with-article current-article
10575 (goto-char (point-min))
10576 (message-narrow-to-head)
10577 (if (re-search-forward "^References: " nil t)
10579 (re-search-forward "^[^ \t]" nil t)
10582 (insert " " message-id))
10583 (insert "References: " message-id "\n"))))
10584 (set-buffer gnus-summary-buffer)
10585 (gnus-summary-unmark-all-processable)
10586 (gnus-summary-update-article current-article)
10587 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10588 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10589 (gnus-summary-rethread-current)
10590 (gnus-message 3 "Article %d is now the child of article %d"
10591 current-article parent-article)))))
10593 (defun gnus-summary-toggle-threads (&optional arg)
10594 "Toggle showing conversation threads.
10595 If ARG is positive number, turn showing conversation threads on."
10597 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10598 (setq gnus-show-threads
10599 (if (null arg) (not gnus-show-threads)
10600 (> (prefix-numeric-value arg) 0)))
10601 (gnus-summary-prepare)
10602 (gnus-summary-goto-subject current)
10603 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10604 (gnus-summary-position-point)))
10606 (defun gnus-summary-show-all-threads ()
10607 "Show all threads."
10610 (let ((buffer-read-only nil))
10611 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10612 (gnus-summary-position-point))
10614 (defun gnus-summary-show-thread ()
10615 "Show thread subtrees.
10616 Returns nil if no thread was there to be shown."
10618 (let ((buffer-read-only nil)
10620 (end (point-at-eol))
10621 ;; Leave point at bol
10622 (beg (progn (beginning-of-line) (point))))
10624 ;; Any hidden lines here?
10625 (search-forward "\r" end t)
10626 (subst-char-in-region beg end ?\^M ?\n t)
10628 (gnus-summary-position-point))))
10630 (defun gnus-summary-maybe-hide-threads ()
10631 "If requested, hide the threads that should be hidden."
10632 (when (and gnus-show-threads
10633 gnus-thread-hide-subtree)
10634 (gnus-summary-hide-all-threads
10635 (if (or (consp gnus-thread-hide-subtree)
10636 (functionp gnus-thread-hide-subtree))
10637 (gnus-make-predicate gnus-thread-hide-subtree)
10640 ;;; Hiding predicates.
10642 (defun gnus-article-unread-p (header)
10643 (memq (mail-header-number header) gnus-newsgroup-unreads))
10645 (defun gnus-article-unseen-p (header)
10646 (memq (mail-header-number header) gnus-newsgroup-unseen))
10648 (defun gnus-map-articles (predicate articles)
10649 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10650 (apply 'gnus-or (mapcar predicate
10651 (mapcar 'gnus-summary-article-header articles))))
10653 (defun gnus-summary-hide-all-threads (&optional predicate)
10654 "Hide all thread subtrees.
10655 If PREDICATE is supplied, threads that satisfy this predicate
10656 will not be hidden."
10659 (goto-char (point-min))
10662 (when (or (not predicate)
10664 predicate (gnus-summary-article-children)))
10665 (gnus-summary-hide-thread))
10666 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10667 (gnus-summary-position-point))
10669 (defun gnus-summary-hide-thread ()
10670 "Hide thread subtrees.
10671 If PREDICATE is supplied, threads that satisfy this predicate
10672 will not be hidden.
10673 Returns nil if no threads were there to be hidden."
10675 (let ((buffer-read-only nil)
10677 (article (gnus-summary-article-number)))
10679 ;; Go forward until either the buffer ends or the subthread
10681 (when (and (not (eobp))
10682 (or (zerop (gnus-summary-next-thread 1 t))
10683 (goto-char (point-max))))
10685 (if (and (> (point) start)
10686 (search-backward "\n" start t))
10688 (subst-char-in-region start (point) ?\n ?\^M)
10689 (gnus-summary-goto-subject article))
10693 (defun gnus-summary-go-to-next-thread (&optional previous)
10694 "Go to the same level (or less) next thread.
10695 If PREVIOUS is non-nil, go to previous thread instead.
10696 Return the article number moved to, or nil if moving was impossible."
10697 (let ((level (gnus-summary-thread-level))
10698 (way (if previous -1 1))
10701 (while (and (not (eobp))
10702 (< level (gnus-summary-thread-level)))
10703 (forward-line way))
10710 (gnus-summary-article-number)
10711 (goto-char beg)))))
10713 (defun gnus-summary-next-thread (n &optional silent)
10714 "Go to the same level next N'th thread.
10715 If N is negative, search backward instead.
10716 Returns the difference between N and the number of skips actually
10719 If SILENT, don't output messages."
10721 (let ((backward (< n 0))
10723 (while (and (> n 0)
10724 (gnus-summary-go-to-next-thread backward))
10727 (gnus-summary-position-point))
10728 (when (and (not silent) (/= 0 n))
10729 (gnus-message 7 "No more threads"))
10732 (defun gnus-summary-prev-thread (n)
10733 "Go to the same level previous N'th thread.
10734 Returns the difference between N and the number of skips actually
10737 (gnus-summary-next-thread (- n)))
10739 (defun gnus-summary-go-down-thread ()
10740 "Go down one level in the current thread."
10741 (let ((children (gnus-summary-article-children)))
10743 (gnus-summary-goto-subject (car children)))))
10745 (defun gnus-summary-go-up-thread ()
10746 "Go up one level in the current thread."
10747 (let ((parent (gnus-summary-article-parent)))
10749 (gnus-summary-goto-subject parent))))
10751 (defun gnus-summary-down-thread (n)
10752 "Go down thread N steps.
10753 If N is negative, go up instead.
10754 Returns the difference between N and how many steps down that were
10759 (while (and (> n 0)
10760 (if up (gnus-summary-go-up-thread)
10761 (gnus-summary-go-down-thread)))
10763 (gnus-summary-position-point)
10765 (gnus-message 7 "Can't go further"))
10768 (defun gnus-summary-up-thread (n)
10769 "Go up thread N steps.
10770 If N is negative, go down instead.
10771 Returns the difference between N and how many steps down that were
10774 (gnus-summary-down-thread (- n)))
10776 (defun gnus-summary-top-thread ()
10777 "Go to the top of the thread."
10779 (while (gnus-summary-go-up-thread))
10780 (gnus-summary-article-number))
10782 (defun gnus-summary-kill-thread (&optional unmark)
10783 "Mark articles under current thread as read.
10784 If the prefix argument is positive, remove any kinds of marks.
10785 If the prefix argument is negative, tick articles instead."
10788 (setq unmark (prefix-numeric-value unmark)))
10789 (let ((articles (gnus-summary-articles-in-thread)))
10791 ;; Expand the thread.
10792 (gnus-summary-show-thread)
10793 ;; Mark all the articles.
10795 (gnus-summary-goto-subject (car articles))
10796 (cond ((null unmark)
10797 (gnus-summary-mark-article-as-read gnus-killed-mark))
10799 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10801 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10802 (setq articles (cdr articles))))
10803 ;; Hide killed subtrees.
10805 gnus-thread-hide-killed
10806 (gnus-summary-hide-thread))
10807 ;; If marked as read, go to next unread subject.
10808 (when (null unmark)
10809 ;; Go to next unread subject.
10810 (gnus-summary-next-subject 1 t)))
10811 (gnus-set-mode-line 'summary))
10813 ;; Summary sorting commands
10815 (defun gnus-summary-sort-by-number (&optional reverse)
10816 "Sort the summary buffer by article number.
10817 Argument REVERSE means reverse order."
10819 (gnus-summary-sort 'number reverse))
10821 (defun gnus-summary-sort-by-random (&optional reverse)
10822 "Randomize the order in the summary buffer.
10823 Argument REVERSE means to randomize in reverse order."
10825 (gnus-summary-sort 'random reverse))
10827 (defun gnus-summary-sort-by-author (&optional reverse)
10828 "Sort the summary buffer by author name alphabetically.
10829 If `case-fold-search' is non-nil, case of letters is ignored.
10830 Argument REVERSE means reverse order."
10832 (gnus-summary-sort 'author reverse))
10834 (defun gnus-summary-sort-by-subject (&optional reverse)
10835 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10836 If `case-fold-search' is non-nil, case of letters is ignored.
10837 Argument REVERSE means reverse order."
10839 (gnus-summary-sort 'subject reverse))
10841 (defun gnus-summary-sort-by-date (&optional reverse)
10842 "Sort the summary buffer by date.
10843 Argument REVERSE means reverse order."
10845 (gnus-summary-sort 'date reverse))
10847 (defun gnus-summary-sort-by-score (&optional reverse)
10848 "Sort the summary buffer by score.
10849 Argument REVERSE means reverse order."
10851 (gnus-summary-sort 'score reverse))
10853 (defun gnus-summary-sort-by-lines (&optional reverse)
10854 "Sort the summary buffer by the number of lines.
10855 Argument REVERSE means reverse order."
10857 (gnus-summary-sort 'lines reverse))
10859 (defun gnus-summary-sort-by-chars (&optional reverse)
10860 "Sort the summary buffer by article length.
10861 Argument REVERSE means reverse order."
10863 (gnus-summary-sort 'chars reverse))
10865 (defun gnus-summary-sort-by-original (&optional reverse)
10866 "Sort the summary buffer using the default sorting method.
10867 Argument REVERSE means reverse order."
10869 (let* ((buffer-read-only)
10870 (gnus-summary-prepare-hook nil))
10871 ;; We do the sorting by regenerating the threads.
10872 (gnus-summary-prepare)
10873 ;; Hide subthreads if needed.
10874 (gnus-summary-maybe-hide-threads)))
10876 (defun gnus-summary-sort (predicate reverse)
10877 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10878 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10879 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10880 (gnus-thread-sort-functions
10885 (gnus-sort-gathered-threads-function
10886 gnus-thread-sort-functions)
10887 (gnus-article-sort-functions
10891 (,article t2 t1))))
10893 (gnus-summary-prepare-hook nil))
10894 ;; We do the sorting by regenerating the threads.
10895 (gnus-summary-prepare)
10896 ;; Hide subthreads if needed.
10897 (gnus-summary-maybe-hide-threads)))
10899 ;; Summary saving commands.
10901 (defun gnus-summary-save-article (&optional n not-saved)
10902 "Save the current article using the default saver function.
10903 If N is a positive number, save the N next articles.
10904 If N is a negative number, save the N previous articles.
10905 If N is nil and any articles have been marked with the process mark,
10906 save those articles instead.
10907 The variable `gnus-default-article-saver' specifies the saver function."
10909 (let* ((articles (gnus-summary-work-articles n))
10910 (save-buffer (save-excursion
10911 (nnheader-set-temp-buffer " *Gnus Save*")))
10912 (num (length articles))
10914 (dolist (article articles)
10915 (setq header (gnus-summary-article-header article))
10916 (if (not (vectorp header))
10917 ;; This is a pseudo-article.
10918 (if (assq 'name header)
10919 (gnus-copy-file (cdr (assq 'name header)))
10920 (gnus-message 1 "Article %d is unsaveable" article))
10921 ;; This is a real article.
10922 (save-window-excursion
10923 (let ((gnus-display-mime-function nil)
10924 (gnus-article-prepare-hook nil))
10925 (gnus-summary-select-article t nil nil article)))
10927 (set-buffer save-buffer)
10929 (insert-buffer-substring gnus-original-article-buffer))
10930 (setq file (gnus-article-save save-buffer file num))
10931 (gnus-summary-remove-process-mark article)
10933 (gnus-summary-set-saved-mark article))))
10934 (gnus-kill-buffer save-buffer)
10935 (gnus-summary-position-point)
10936 (gnus-set-mode-line 'summary)
10939 (defun gnus-summary-pipe-output (&optional arg headers)
10940 "Pipe the current article to a subprocess.
10941 If N is a positive number, pipe the N next articles.
10942 If N is a negative number, pipe the N previous articles.
10943 If N is nil and any articles have been marked with the process mark,
10944 pipe those articles instead.
10945 If HEADERS (the symbolic prefix), include the headers, too."
10946 (interactive (gnus-interactive "P\ny"))
10947 (require 'gnus-art)
10948 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10949 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10950 (gnus-summary-save-article arg t))
10951 (let ((buffer (get-buffer "*Shell Command Output*")))
10953 (not (zerop (buffer-size buffer))))
10954 (gnus-configure-windows 'pipe))))
10956 (defun gnus-summary-save-article-mail (&optional arg)
10957 "Append the current article to an mail file.
10958 If N is a positive number, save the N next articles.
10959 If N is a negative number, save the N previous articles.
10960 If N is nil and any articles have been marked with the process mark,
10961 save those articles instead."
10963 (require 'gnus-art)
10964 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10965 (gnus-summary-save-article arg)))
10967 (defun gnus-summary-save-article-rmail (&optional arg)
10968 "Append the current article to an rmail file.
10969 If N is a positive number, save the N next articles.
10970 If N is a negative number, save the N previous articles.
10971 If N is nil and any articles have been marked with the process mark,
10972 save those articles instead."
10974 (require 'gnus-art)
10975 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10976 (gnus-summary-save-article arg)))
10978 (defun gnus-summary-save-article-file (&optional arg)
10979 "Append the current article to a file.
10980 If N is a positive number, save the N next articles.
10981 If N is a negative number, save the N previous articles.
10982 If N is nil and any articles have been marked with the process mark,
10983 save those articles instead."
10985 (require 'gnus-art)
10986 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10987 (gnus-summary-save-article arg)))
10989 (defun gnus-summary-write-article-file (&optional arg)
10990 "Write the current article to a file, deleting the previous file.
10991 If N is a positive number, save the N next articles.
10992 If N is a negative number, save the N previous articles.
10993 If N is nil and any articles have been marked with the process mark,
10994 save those articles instead."
10996 (require 'gnus-art)
10997 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10998 (gnus-summary-save-article arg)))
11000 (defun gnus-summary-save-article-body-file (&optional arg)
11001 "Append the current article body to a file.
11002 If N is a positive number, save the N next articles.
11003 If N is a negative number, save the N previous articles.
11004 If N is nil and any articles have been marked with the process mark,
11005 save those articles instead."
11007 (require 'gnus-art)
11008 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11009 (gnus-summary-save-article arg)))
11011 (defun gnus-summary-muttprint (&optional arg)
11012 "Print the current article using Muttprint.
11013 If N is a positive number, save the N next articles.
11014 If N is a negative number, save the N previous articles.
11015 If N is nil and any articles have been marked with the process mark,
11016 save those articles instead."
11018 (require 'gnus-art)
11019 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11020 (gnus-summary-save-article arg t)))
11022 (defun gnus-summary-pipe-message (program)
11023 "Pipe the current article through PROGRAM."
11024 (interactive "sProgram: ")
11025 (gnus-summary-select-article)
11026 (let ((mail-header-separator ""))
11027 (gnus-eval-in-buffer-window gnus-article-buffer
11030 (let ((start (window-start))
11032 (message-pipe-buffer-body program)
11033 (set-window-start (get-buffer-window (current-buffer)) start))))))
11035 (defun gnus-get-split-value (methods)
11036 "Return a value based on the split METHODS."
11037 (let (split-name method result match)
11040 (set-buffer gnus-original-article-buffer)
11042 (nnheader-narrow-to-headers)
11043 (while (and methods (not split-name))
11044 (goto-char (point-min))
11045 (setq method (pop methods))
11046 (setq match (car method))
11049 ;; Regular expression.
11051 (re-search-forward match nil t)))
11056 (setq result (funcall match gnus-newsgroup-name))))
11061 (setq result (eval match)))))
11062 (setq split-name (cdr method))
11063 (cond ((stringp result)
11064 (push (expand-file-name
11065 result gnus-article-save-directory)
11068 (setq split-name (append result split-name)))))))))
11069 (nreverse split-name)))
11071 (defun gnus-valid-move-group-p (group)
11072 (and (boundp group)
11073 (symbol-name group)
11074 (symbol-value group)
11075 (gnus-get-function (gnus-find-method-for-group
11076 (symbol-name group)) 'request-accept-article t)))
11078 (defun gnus-read-move-group-name (prompt default articles prefix)
11079 "Read a group name."
11080 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11081 (minibuffer-confirm-incomplete nil) ; XEmacs
11083 (format "%s %s to:"
11085 (if (> (length articles) 1)
11086 (format "these %d articles" (length articles))
11091 (gnus-completing-read-with-default
11094 'gnus-valid-move-group-p
11096 'gnus-group-history))
11097 ((= 1 (length split-name))
11098 (gnus-completing-read-with-default
11099 (car split-name) prom
11101 'gnus-valid-move-group-p
11103 'gnus-group-history))
11105 (gnus-completing-read-with-default
11107 (mapcar 'list (nreverse split-name))
11109 'gnus-group-history))))
11110 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11112 (if (or (string= to-newsgroup "")
11113 (string= to-newsgroup prefix))
11114 (setq to-newsgroup default))
11115 (unless to-newsgroup
11116 (error "No group name entered"))
11117 (or (gnus-active to-newsgroup)
11118 (gnus-activate-group to-newsgroup nil nil to-method)
11119 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11121 (or (and (gnus-request-create-group to-newsgroup to-method)
11122 (gnus-activate-group
11123 to-newsgroup nil nil to-method)
11124 (gnus-subscribe-group to-newsgroup))
11125 (error "Couldn't create group %s" to-newsgroup)))
11126 (error "No such group: %s" to-newsgroup)))
11129 (defun gnus-summary-save-parts (type dir n &optional reverse)
11130 "Save parts matching TYPE to DIR.
11131 If REVERSE, save parts that do not match TYPE."
11133 (list (read-string "Save parts of type: "
11134 (or (car gnus-summary-save-parts-type-history)
11135 gnus-summary-save-parts-default-mime)
11136 'gnus-summary-save-parts-type-history)
11137 (setq gnus-summary-save-parts-last-directory
11138 (read-file-name "Save to directory: "
11139 gnus-summary-save-parts-last-directory
11141 current-prefix-arg))
11142 (gnus-summary-iterate n
11143 (let ((gnus-display-mime-function nil)
11144 (gnus-inhibit-treatment t))
11145 (gnus-summary-select-article))
11147 (set-buffer gnus-article-buffer)
11148 (let ((handles (or gnus-article-mime-handles
11149 (mm-dissect-buffer nil gnus-article-loose-mime)
11150 (and gnus-article-emulate-mime
11151 (mm-uu-dissect)))))
11153 (gnus-summary-save-parts-1 type dir handles reverse)
11154 (unless gnus-article-mime-handles ;; Don't destroy this case.
11155 (mm-destroy-parts handles)))))))
11157 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11158 (if (stringp (car handle))
11159 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11162 (not (string-match type (mm-handle-media-type handle)))
11163 (string-match type (mm-handle-media-type handle)))
11164 (let ((file (expand-file-name
11166 mm-file-name-rewrite-functions
11167 (file-name-nondirectory
11169 (mail-content-type-get
11170 (mm-handle-disposition handle) 'filename)
11171 (mail-content-type-get
11172 (mm-handle-type handle) 'name)
11173 (concat gnus-newsgroup-name
11174 "." (number-to-string
11175 (cdr gnus-article-current))))))
11177 (unless (file-exists-p file)
11178 (mm-save-part-to-file handle file))))))
11180 ;; Summary extract commands
11182 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11183 (let ((buffer-read-only nil)
11184 (article (gnus-summary-article-number))
11186 (unless (gnus-summary-goto-subject article)
11187 (error "No such article: %d" article))
11188 (gnus-summary-position-point)
11189 ;; If all commands are to be bunched up on one line, we collect
11191 (unless gnus-view-pseudos-separately
11192 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11195 (setq action (cdr (assq 'action (car ps))))
11196 (setq files (list (cdr (assq 'name (car ps)))))
11197 (while (and ps (cdr ps)
11198 (string= (or action "1")
11199 (or (cdr (assq 'action (cadr ps))) "2")))
11200 (push (cdr (assq 'name (cadr ps))) files)
11201 (setcdr ps (cddr ps)))
11203 (when (not (string-match "%s" action))
11206 (when (assq 'execute (car ps))
11207 (setcdr (assq 'execute (car ps))
11208 (funcall (if (string-match "%s" action)
11215 (shell-quote-argument f)))
11217 (setq ps (cdr ps)))))
11218 (if (and gnus-view-pseudos (not not-view))
11220 (when (assq 'execute (car pslist))
11221 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11222 (eq gnus-view-pseudos 'not-confirm)))
11223 (setq pslist (cdr pslist)))
11226 (setq after-article (or (cdr (assq 'article (car pslist)))
11227 (gnus-summary-article-number)))
11228 (gnus-summary-goto-subject after-article)
11231 (insert " " (file-name-nondirectory
11232 (cdr (assq 'name (car pslist))))
11233 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11235 (forward-line -1) ; back to `b'
11236 (gnus-add-text-properties
11237 b (1- e) (list 'gnus-number gnus-reffed-article-number
11238 gnus-mouse-face-prop gnus-mouse-face))
11240 after-article gnus-reffed-article-number
11241 gnus-unread-mark b (car pslist) 0 (- e b))
11242 (setq gnus-newsgroup-unreads
11243 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11244 gnus-reffed-article-number))
11245 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11246 (setq pslist (cdr pslist)))))))
11248 (defun gnus-pseudos< (p1 p2)
11249 (let ((c1 (cdr (assq 'action p1)))
11250 (c2 (cdr (assq 'action p2))))
11251 (and c1 c2 (string< c1 c2))))
11253 (defun gnus-request-pseudo-article (props)
11254 (cond ((assq 'execute props)
11255 (gnus-execute-command (cdr (assq 'execute props)))))
11256 (let ((gnus-current-article (gnus-summary-article-number)))
11257 (gnus-run-hooks 'gnus-mark-article-hook)))
11259 (defun gnus-execute-command (command &optional automatic)
11261 (gnus-article-setup-buffer)
11262 (set-buffer gnus-article-buffer)
11263 (setq buffer-read-only nil)
11264 (let ((command (if automatic command
11265 (read-string "Command: " (cons command 0)))))
11267 (insert "$ " command "\n\n")
11268 (if gnus-view-pseudo-asynchronously
11269 (start-process "gnus-execute" (current-buffer) shell-file-name
11270 shell-command-switch command)
11271 (call-process shell-file-name nil t nil
11272 shell-command-switch command)))))
11274 ;; Summary kill commands.
11276 (defun gnus-summary-edit-global-kill (article)
11277 "Edit the \"global\" kill file."
11278 (interactive (list (gnus-summary-article-number)))
11279 (gnus-group-edit-global-kill article))
11281 (defun gnus-summary-edit-local-kill ()
11282 "Edit a local kill file applied to the current newsgroup."
11284 (setq gnus-current-headers (gnus-summary-article-header))
11285 (gnus-group-edit-local-kill
11286 (gnus-summary-article-number) gnus-newsgroup-name))
11288 ;;; Header reading.
11290 (defun gnus-read-header (id &optional header)
11291 "Read the headers of article ID and enter them into the Gnus system."
11292 (let ((group gnus-newsgroup-name)
11293 (gnus-override-method
11295 gnus-override-method
11296 (and (gnus-news-group-p gnus-newsgroup-name)
11297 (car (gnus-refer-article-methods)))))
11299 ;; First we check to see whether the header in question is already
11302 ;; This is a Message-ID.
11303 (setq header (or header (gnus-id-to-header id)))
11304 ;; This is an article number.
11305 (setq header (or header (gnus-summary-article-header id))))
11307 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11308 ;; We have found the header.
11310 ;; We have to really fetch the header to this article.
11312 (set-buffer nntp-server-buffer)
11313 (when (setq where (gnus-request-head id group))
11314 (nnheader-fold-continuation-lines)
11315 (goto-char (point-max))
11317 (goto-char (point-min))
11321 ((cdr where) (cdr where))
11322 (header (mail-header-number header))
11323 (t gnus-reffed-article-number))
11325 (insert " Article retrieved.\n"))
11326 (if (or (not where)
11327 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11328 () ; Malformed head.
11329 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11330 (when (and (stringp id)
11331 (not (string= (gnus-group-real-name group)
11333 ;; If we fetched by Message-ID and the article came
11334 ;; from a different group, we fudge some bogus article
11335 ;; numbers for this article.
11336 (mail-header-set-number header gnus-reffed-article-number))
11338 (set-buffer gnus-summary-buffer)
11339 (decf gnus-reffed-article-number)
11340 (gnus-remove-header (mail-header-number header))
11341 (push header gnus-newsgroup-headers)
11342 (setq gnus-current-headers header)
11343 (push (mail-header-number header) gnus-newsgroup-limit)))
11346 (defun gnus-remove-header (number)
11347 "Remove header NUMBER from `gnus-newsgroup-headers'."
11348 (if (and gnus-newsgroup-headers
11349 (= number (mail-header-number (car gnus-newsgroup-headers))))
11350 (pop gnus-newsgroup-headers)
11351 (let ((headers gnus-newsgroup-headers))
11352 (while (and (cdr headers)
11353 (not (= number (mail-header-number (cadr headers)))))
11355 (when (cdr headers)
11356 (setcdr headers (cddr headers))))))
11359 ;;; summary highlights
11362 (defun gnus-highlight-selected-summary ()
11363 "Highlight selected article in summary buffer."
11364 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11365 (when gnus-summary-selected-face
11367 (let* ((beg (point-at-bol))
11368 (end (point-at-eol))
11369 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11370 (from (if (get-text-property beg gnus-mouse-face-prop)
11372 (or (next-single-property-change
11373 beg gnus-mouse-face-prop nil end)
11378 (or (next-single-property-change
11379 from gnus-mouse-face-prop nil end)
11381 ;; If no mouse-face prop on line we will have to = from = end,
11382 ;; so we highlight the entire line instead.
11383 (when (= (+ to 2) from)
11386 (if gnus-newsgroup-selected-overlay
11387 ;; Move old overlay.
11389 gnus-newsgroup-selected-overlay from to (current-buffer))
11390 ;; Create new overlay.
11392 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11393 'face gnus-summary-selected-face))))))
11395 (defvar gnus-summary-highlight-line-cached nil)
11396 (defvar gnus-summary-highlight-line-trigger nil)
11398 (defun gnus-summary-highlight-line-0 ()
11399 (if (and (eq gnus-summary-highlight-line-trigger
11400 gnus-summary-highlight)
11401 gnus-summary-highlight-line-cached)
11402 gnus-summary-highlight-line-cached
11403 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11404 gnus-summary-highlight-line-cached
11405 (let* ((cond (list 'cond))
11407 (list gnus-summary-highlight))
11409 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11413 (gnus-byte-compile (list 'lambda nil cond))))))
11415 (defun gnus-summary-highlight-line ()
11416 "Highlight current line according to `gnus-summary-highlight'."
11417 (let* ((beg (point-at-bol))
11418 (article (or (gnus-summary-article-number) gnus-current-article))
11419 (score (or (cdr (assq article
11420 gnus-newsgroup-scored))
11421 gnus-summary-default-score 0))
11422 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11423 (inhibit-read-only t)
11424 (default gnus-summary-default-score)
11425 (default-high gnus-summary-default-high-score)
11426 (default-low gnus-summary-default-low-score)
11427 (uncached (and gnus-summary-use-undownloaded-faces
11428 (memq article gnus-newsgroup-undownloaded)
11429 (not (memq article gnus-newsgroup-cached)))))
11430 (let ((face (funcall (gnus-summary-highlight-line-0))))
11431 (unless (eq face (get-text-property beg 'face))
11432 (gnus-put-text-property-excluding-characters-with-faces
11433 beg (point-at-eol) 'face
11434 (setq face (if (boundp face) (symbol-value face) face)))
11435 (when gnus-summary-highlight-line-function
11436 (funcall gnus-summary-highlight-line-function article face))))))
11438 (defun gnus-update-read-articles (group unread &optional compute)
11439 "Update the list of read articles in GROUP.
11440 UNREAD is a sorted list."
11441 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11442 (info (gnus-get-info group))
11445 (if (or (not info) (not active))
11446 ;; There is no info on this group if it was, in fact,
11447 ;; killed. Gnus stores no information on killed groups, so
11448 ;; there's nothing to be done.
11449 ;; One could store the information somewhere temporarily,
11450 ;; perhaps... Hmmm...
11452 ;; Remove any negative articles numbers.
11453 (while (and unread (< (car unread) 0))
11454 (setq unread (cdr unread)))
11455 ;; Remove any expired article numbers
11456 (while (and unread (< (car unread) (car active)))
11457 (setq unread (cdr unread)))
11458 ;; Compute the ranges of read articles by looking at the list of
11459 ;; unread articles.
11461 (when (/= (car unread) prev)
11462 (push (if (= prev (1- (car unread))) prev
11463 (cons prev (1- (car unread))))
11465 (setq prev (1+ (car unread)))
11466 (setq unread (cdr unread)))
11467 (when (<= prev (cdr active))
11468 (push (cons prev (cdr active)) read))
11469 (setq read (if (> (length read) 1) (nreverse read) read))
11474 ;; Propagate the read marks to the backend.
11475 (when (gnus-check-backend-function 'request-set-mark group)
11476 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11477 (add (gnus-remove-from-range read (gnus-info-read info))))
11479 (unless (gnus-check-group group)
11480 (error "Can't open server for %s" group))
11481 (gnus-request-set-mark
11482 group (delq nil (list (if add (list add 'add '(read)))
11483 (if del (list del 'del '(read))))))
11485 `(gnus-request-set-mark
11488 (if del (list del 'add '(read)))
11489 (if add (list add 'del '(read))))))))))
11490 (set-buffer gnus-group-buffer)
11491 (gnus-undo-register
11493 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11494 (gnus-info-set-read ',info ',(gnus-info-read info))
11495 (gnus-get-unread-articles-in-group ',info
11496 (gnus-active ,group))
11497 (gnus-group-update-group ,group t)
11499 ;; Enter this list into the group info.
11500 (gnus-info-set-read info read)
11501 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11502 (gnus-get-unread-articles-in-group info (gnus-active group))
11505 (defun gnus-offer-save-summaries ()
11506 "Offer to save all active summary buffers."
11508 ;; Go through all buffers and find all summaries.
11509 (dolist (buffer (buffer-list))
11510 (when (and (setq buffer (buffer-name buffer))
11511 (string-match "Summary" buffer)
11512 (with-current-buffer buffer
11513 ;; We check that this is, indeed, a summary buffer.
11514 (and (eq major-mode 'gnus-summary-mode)
11515 ;; Also make sure this isn't bogus.
11516 gnus-newsgroup-prepared
11517 ;; Also make sure that this isn't a
11518 ;; dead summary buffer.
11519 (not gnus-dead-summary-mode))))
11520 (push buffer buffers)))
11521 ;; Go through all these summary buffers and offer to save them.
11525 "Update summary buffer %s? "
11527 (switch-to-buffer buf)
11528 (gnus-summary-exit))
11531 (defun gnus-summary-setup-default-charset ()
11532 "Setup newsgroup default charset."
11533 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11534 (setq gnus-newsgroup-charset nil)
11535 (let* ((ignored-charsets
11536 (or gnus-newsgroup-ephemeral-ignored-charsets
11538 (and gnus-newsgroup-name
11539 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11540 gnus-newsgroup-ignored-charsets))))
11541 (setq gnus-newsgroup-charset
11542 (or gnus-newsgroup-ephemeral-charset
11543 (and gnus-newsgroup-name
11544 (gnus-parameter-charset gnus-newsgroup-name))
11545 gnus-default-charset))
11546 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11547 ignored-charsets))))
11553 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11554 "Display the current article buffer fully MIME-buttonized.
11555 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11556 treated as multipart/mixed."
11558 (require 'gnus-art)
11559 (let ((gnus-unbuttonized-mime-types nil)
11560 (gnus-mime-display-multipart-as-mixed show-all-parts))
11561 (gnus-summary-show-article)))
11563 (defun gnus-summary-repair-multipart (article)
11564 "Add a Content-Type header to a multipart article without one."
11565 (interactive (list (gnus-summary-article-number)))
11566 (gnus-with-article article
11567 (message-narrow-to-head)
11568 (message-remove-header "Mime-Version")
11569 (goto-char (point-max))
11570 (insert "Mime-Version: 1.0\n")
11572 (when (search-forward "\n--" nil t)
11573 (let ((separator (buffer-substring (point) (point-at-eol))))
11574 (message-narrow-to-head)
11575 (message-remove-header "Content-Type")
11576 (goto-char (point-max))
11577 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11580 (let (gnus-mark-article-hook)
11581 (gnus-summary-select-article t t nil article)))
11583 (defun gnus-summary-toggle-display-buttonized ()
11584 "Toggle the buttonizing of the article buffer."
11586 (require 'gnus-art)
11587 (if (setq gnus-inhibit-mime-unbuttonizing
11588 (not gnus-inhibit-mime-unbuttonizing))
11589 (let ((gnus-unbuttonized-mime-types nil))
11590 (gnus-summary-show-article))
11591 (gnus-summary-show-article)))
11594 ;;; Generic summary marking commands
11597 (defvar gnus-summary-marking-alist
11598 '((read gnus-del-mark "d")
11599 (unread gnus-unread-mark "u")
11600 (ticked gnus-ticked-mark "!")
11601 (dormant gnus-dormant-mark "?")
11602 (expirable gnus-expirable-mark "e"))
11603 "An alist of names/marks/keystrokes.")
11605 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11606 (defvar gnus-summary-mark-map)
11608 (defun gnus-summary-make-all-marking-commands ()
11609 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11610 (dolist (elem gnus-summary-marking-alist)
11611 (apply 'gnus-summary-make-marking-command elem)))
11613 (defun gnus-summary-make-marking-command (name mark keystroke)
11614 (let ((map (make-sparse-keymap)))
11615 (define-key gnus-summary-generic-mark-map keystroke map)
11616 (dolist (lway `((next "next" next nil "n")
11617 (next-unread "next unread" next t "N")
11618 (prev "previous" prev nil "p")
11619 (prev-unread "previous unread" prev t "P")
11620 (nomove "" nil nil ,keystroke)))
11621 (let ((func (gnus-summary-make-marking-command-1
11622 mark (car lway) lway name)))
11623 (setq func (eval func))
11624 (define-key map (nth 4 lway) func)))))
11626 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11628 (format "gnus-summary-put-mark-as-%s%s"
11629 name (if (eq way 'nomove)
11631 (concat "-" (symbol-name way)))))
11634 "Mark the current article as %s%s.
11635 If N, the prefix, then repeat N times.
11636 If N is negative, move in reverse order.
11637 The difference between N and the actual number of articles marked is
11641 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11643 (defun gnus-summary-generic-mark (n mark move unread)
11644 "Mark N articles with MARK."
11645 (unless (eq major-mode 'gnus-summary-mode)
11646 (error "This command can only be used in the summary buffer"))
11647 (gnus-summary-show-thread)
11650 ((eq move 'next) 1)
11651 ((eq move 'prev) -1)
11653 (if (zerop nummove)
11657 nummove (* -1 nummove))))
11658 (while (and (> n 0)
11659 (gnus-summary-mark-article nil mark)
11660 (zerop (gnus-summary-next-subject nummove unread t)))
11663 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11664 (gnus-summary-recenter)
11665 (gnus-summary-position-point)
11666 (gnus-set-mode-line 'summary)
11669 (defun gnus-summary-insert-articles (articles)
11670 (when (setq articles
11671 (gnus-sorted-difference articles
11672 (mapcar (lambda (h)
11673 (mail-header-number h))
11674 gnus-newsgroup-headers)))
11675 (setq gnus-newsgroup-headers
11677 gnus-newsgroup-headers
11678 (gnus-fetch-headers articles)
11679 'gnus-article-sort-by-number))
11680 ;; Suppress duplicates?
11681 (when gnus-suppress-duplicates
11682 (gnus-dup-suppress-articles))
11684 ;; We might want to build some more threads first.
11685 (when (and gnus-fetch-old-headers
11686 (eq gnus-headers-retrieved-by 'nov))
11687 (if (eq gnus-fetch-old-headers 'invisible)
11688 (gnus-build-all-threads)
11689 (gnus-build-old-threads)))
11690 ;; Let the Gnus agent mark articles as read.
11692 (gnus-agent-get-undownloaded-list))
11693 ;; Remove list identifiers from subject
11694 (when gnus-list-identifiers
11695 (gnus-summary-remove-list-identifiers))
11696 ;; First and last article in this newsgroup.
11697 (when gnus-newsgroup-headers
11698 (setq gnus-newsgroup-begin
11699 (mail-header-number (car gnus-newsgroup-headers))
11701 (mail-header-number
11702 (gnus-last-element gnus-newsgroup-headers))))
11703 (when gnus-use-scoring
11704 (gnus-possibly-score-headers))))
11706 (defun gnus-summary-insert-old-articles (&optional all)
11707 "Insert all old articles in this group.
11708 If ALL is non-nil, already read articles become readable.
11709 If ALL is a number, fetch this number of articles."
11712 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11715 ;; Some nntp servers lie about their active range. When
11716 ;; this happens, the active range can be in the millions.
11717 ;; Use a compressed range to avoid creating a huge list.
11718 (gnus-range-difference (list gnus-newsgroup-active) old))
11719 (setq len (gnus-range-length older))
11724 (let ((older-range (nreverse older)))
11728 (let* ((r (pop older-range))
11729 (min (if (numberp r) r (car r)))
11730 (max (if (numberp r) r (cdr r))))
11731 (while (and (<= min max)
11736 (setq older (gnus-uncompress-range older))))
11738 (setq older (gnus-uncompress-range older)))
11740 (when (and (numberp gnus-large-newsgroup)
11741 (> len gnus-large-newsgroup))
11742 (let* ((cursor-in-echo-area nil)
11743 (initial (gnus-parameter-large-newsgroup-initial
11744 gnus-newsgroup-name))
11748 "How many articles from %s (%s %d): "
11750 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11751 (if initial "max" "default")
11754 (cons (number-to-string initial)
11756 (unless (string-match "^[ \t]*$" input)
11757 (setq all (string-to-number input))
11759 (let ((older-range (nreverse older)))
11763 (let* ((r (pop older-range))
11764 (min (if (numberp r) r (car r)))
11765 (max (if (numberp r) r (cdr r))))
11766 (while (and (<= min max)
11770 max (1- max))))))))))
11771 (setq older (gnus-uncompress-range older))))
11773 (message "No old news.")
11774 (gnus-summary-insert-articles older)
11775 (gnus-summary-limit (gnus-sorted-nunion old older))))
11776 (gnus-summary-position-point)))
11778 (defun gnus-summary-insert-new-articles ()
11779 "Insert all new articles in this group."
11782 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11783 (old-active gnus-newsgroup-active)
11784 (nnmail-fetched-sources (list t))
11786 (setq gnus-newsgroup-active
11787 (gnus-activate-group gnus-newsgroup-name 'scan))
11788 (setq i (cdr gnus-newsgroup-active))
11789 (while (> i (cdr old-active))
11793 (message "No gnus is bad news")
11794 (gnus-summary-insert-articles new)
11795 (setq gnus-newsgroup-unreads
11796 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11797 (gnus-summary-limit (gnus-sorted-nunion old new))))
11798 (gnus-summary-position-point)))
11800 (gnus-summary-make-all-marking-commands)
11802 (gnus-ems-redefine)
11804 (provide 'gnus-sum)
11806 (run-hooks 'gnus-sum-load-hook)
11808 ;; Local Variables:
11809 ;; coding: iso-8859-1
11812 ;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11813 ;;; gnus-sum.el ends here