1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-map))
44 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
45 (autoload 'gnus-cache-write-active "gnus-cache")
46 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
47 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
48 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
49 (autoload 'mm-uu-dissect "mm-uu")
50 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
51 "Deuglify broken Outlook (Express) articles and redisplay."
53 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
54 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
55 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
57 (defcustom gnus-kill-summary-on-exit t
58 "*If non-nil, kill the summary buffer when you exit from it.
59 If nil, the summary will become a \"*Dead Summary*\" buffer, and
60 it will be killed sometime later."
61 :group 'gnus-summary-exit
64 (defcustom gnus-fetch-old-headers nil
65 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
66 If an unread article in the group refers to an older, already read (or
67 just marked as read) article, the old article will not normally be
68 displayed in the Summary buffer. If this variable is t, Gnus
69 will attempt to grab the headers to the old articles, and thereby
70 build complete threads. If it has the value `some', only enough
71 headers to connect otherwise loose threads will be displayed. This
72 variable can also be a number. In that case, no more than that number
73 of old headers will be fetched. If it has the value `invisible', all
74 old headers will be fetched, but none will be displayed.
76 The server has to support NOV for any of this to work."
78 :type '(choice (const :tag "off" nil)
83 (sexp :menu-tag "other" t)))
85 (defcustom gnus-refer-thread-limit 200
86 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
87 If t, fetch all the available old headers."
90 (sexp :menu-tag "other" t)))
92 (defcustom gnus-summary-make-false-root 'adopt
93 "*nil means that Gnus won't gather loose threads.
94 If the root of a thread has expired or been read in a previous
95 session, the information necessary to build a complete thread has been
96 lost. Instead of having many small sub-threads from this original thread
97 scattered all over the summary buffer, Gnus can gather them.
99 If non-nil, Gnus will try to gather all loose sub-threads from an
100 original thread into one large thread.
102 If this variable is non-nil, it should be one of `none', `adopt',
105 If this variable is `none', Gnus will not make a false root, but just
106 present the sub-threads after another.
107 If this variable is `dummy', Gnus will create a dummy root that will
108 have all the sub-threads as children.
109 If this variable is `adopt', Gnus will make one of the \"children\"
110 the parent and mark all the step-children as such.
111 If this variable is `empty', the \"children\" are printed with empty
112 subject fields. (Or rather, they will be printed with a string
113 given by the `gnus-summary-same-subject' variable.)"
115 :type '(choice (const :tag "off" nil)
121 (defcustom gnus-summary-make-false-root-always nil
122 "Always make a false dummy root."
127 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
128 "*A regexp to match subjects to be excluded from loose thread gathering.
129 As loose thread gathering is done on subjects only, that means that
130 there can be many false gatherings performed. By rooting out certain
131 common subjects, gathering might become saner."
135 (defcustom gnus-summary-gather-subject-limit nil
136 "*Maximum length of subject comparisons when gathering loose threads.
137 Use nil to compare full subjects. Setting this variable to a low
138 number will help gather threads that have been corrupted by
139 newsreaders chopping off subject lines, but it might also mean that
140 unrelated articles that have subject that happen to begin with the
141 same few characters will be incorrectly gathered.
143 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
146 :type '(choice (const :tag "off" nil)
148 (sexp :menu-tag "on" t)))
150 (defcustom gnus-simplify-subject-functions nil
151 "List of functions taking a string argument that simplify subjects.
152 The functions are applied recursively.
154 Useful functions to put in this list include:
155 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
156 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
158 :type '(repeat function))
160 (defcustom gnus-simplify-ignored-prefixes nil
161 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
163 :type '(choice (const :tag "off" nil)
166 (defcustom gnus-build-sparse-threads nil
167 "*If non-nil, fill in the gaps in threads.
168 If `some', only fill in the gaps that are needed to tie loose threads
169 together. If `more', fill in all leaf nodes that Gnus can find. If
170 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
172 :type '(choice (const :tag "off" nil)
175 (sexp :menu-tag "all" t)))
177 (defcustom gnus-summary-thread-gathering-function
178 'gnus-gather-threads-by-subject
179 "*Function used for gathering loose threads.
180 There are two pre-defined functions: `gnus-gather-threads-by-subject',
181 which only takes Subjects into consideration; and
182 `gnus-gather-threads-by-references', which compared the References
183 headers of the articles to find matches."
185 :type '(radio (function-item gnus-gather-threads-by-subject)
186 (function-item gnus-gather-threads-by-references)
187 (function :tag "other")))
189 (defcustom gnus-summary-same-subject ""
190 "*String indicating that the current article has the same subject as the previous.
191 This variable will only be used if the value of
192 `gnus-summary-make-false-root' is `empty'."
193 :group 'gnus-summary-format
196 (defcustom gnus-summary-goto-unread t
197 "*If t, many commands will go to the next unread article.
198 This applies to marking commands as well as other commands that
199 \"naturally\" select the next article, like, for instance, `SPC' at
200 the end of an article.
202 If nil, the marking commands do NOT go to the next unread article
203 \(they go to the next article instead). If `never', commands that
204 usually go to the next unread article, will go to the next article,
205 whether it is read or not."
206 :group 'gnus-summary-marks
207 :link '(custom-manual "(gnus)Setting Marks")
208 :type '(choice (const :tag "off" nil)
210 (sexp :menu-tag "on" t)))
212 (defcustom gnus-summary-default-score 0
213 "*Default article score level.
214 All scores generated by the score files will be added to this score.
215 If this variable is nil, scoring will be disabled."
216 :group 'gnus-score-default
217 :type '(choice (const :tag "disable")
220 (defcustom gnus-summary-default-high-score 0
221 "*Default threshold for a high scored article.
222 An article will be highlighted as high scored if its score is greater
225 :group 'gnus-score-default
228 (defcustom gnus-summary-default-low-score 0
229 "*Default threshold for a low scored article.
230 An article will be highlighted as low scored if its score is smaller
233 :group 'gnus-score-default
236 (defcustom gnus-summary-zcore-fuzz 0
237 "*Fuzziness factor for the zcore in the summary buffer.
238 Articles with scores closer than this to `gnus-summary-default-score'
240 :group 'gnus-summary-format
243 (defcustom gnus-simplify-subject-fuzzy-regexp nil
244 "*Strings to be removed when doing fuzzy matches.
245 This can either be a regular expression or list of regular expressions
246 that will be removed from subject strings if fuzzy subject
247 simplification is selected."
249 :type '(repeat regexp))
251 (defcustom gnus-show-threads t
252 "*If non-nil, display threads in summary mode."
256 (defcustom gnus-thread-hide-subtree nil
257 "*If non-nil, hide all threads initially.
258 This can be a predicate specifier which says which threads to hide.
259 If threads are hidden, you have to run the command
260 `gnus-summary-show-thread' by hand or select an article."
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")))
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 t
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 ;; FIXME: Although the custom type is `character' for the following variables,
433 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
435 (defcustom gnus-unread-mark ? ;Whitespace
436 "*Mark used for unread articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-ticked-mark ?!
441 "*Mark used for ticked articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-dormant-mark ??
446 "*Mark used for dormant articles."
447 :group 'gnus-summary-marks
450 (defcustom gnus-del-mark ?r
451 "*Mark used for del'd articles."
452 :group 'gnus-summary-marks
455 (defcustom gnus-read-mark ?R
456 "*Mark used for read articles."
457 :group 'gnus-summary-marks
460 (defcustom gnus-expirable-mark ?E
461 "*Mark used for expirable articles."
462 :group 'gnus-summary-marks
465 (defcustom gnus-killed-mark ?K
466 "*Mark used for killed articles."
467 :group 'gnus-summary-marks
470 (defcustom gnus-spam-mark ?$
471 "*Mark used for spam articles."
473 :group 'gnus-summary-marks
476 (defcustom gnus-souped-mark ?F
477 "*Mark used for souped articles."
478 :group 'gnus-summary-marks
481 (defcustom gnus-kill-file-mark ?X
482 "*Mark used for articles killed by kill files."
483 :group 'gnus-summary-marks
486 (defcustom gnus-low-score-mark ?Y
487 "*Mark used for articles with a low score."
488 :group 'gnus-summary-marks
491 (defcustom gnus-catchup-mark ?C
492 "*Mark used for articles that are caught up."
493 :group 'gnus-summary-marks
496 (defcustom gnus-replied-mark ?A
497 "*Mark used for articles that have been replied to."
498 :group 'gnus-summary-marks
501 (defcustom gnus-forwarded-mark ?F
502 "*Mark used for articles that have been forwarded."
504 :group 'gnus-summary-marks
507 (defcustom gnus-recent-mark ?N
508 "*Mark used for articles that are recent."
510 :group 'gnus-summary-marks
513 (defcustom gnus-cached-mark ?*
514 "*Mark used for articles that are in the cache."
515 :group 'gnus-summary-marks
518 (defcustom gnus-saved-mark ?S
519 "*Mark used for articles that have been saved."
520 :group 'gnus-summary-marks
523 (defcustom gnus-unseen-mark ?.
524 "*Mark used for articles that haven't been seen."
526 :group 'gnus-summary-marks
529 (defcustom gnus-no-mark ? ;Whitespace
530 "*Mark used for articles that have no other secondary mark."
532 :group 'gnus-summary-marks
535 (defcustom gnus-ancient-mark ?O
536 "*Mark used for ancient articles."
537 :group 'gnus-summary-marks
540 (defcustom gnus-sparse-mark ?Q
541 "*Mark used for sparsely reffed articles."
542 :group 'gnus-summary-marks
545 (defcustom gnus-canceled-mark ?G
546 "*Mark used for canceled articles."
547 :group 'gnus-summary-marks
550 (defcustom gnus-duplicate-mark ?M
551 "*Mark used for duplicate articles."
552 :group 'gnus-summary-marks
555 (defcustom gnus-undownloaded-mark ?-
556 "*Mark used for articles that weren't downloaded."
558 :group 'gnus-summary-marks
561 (defcustom gnus-downloaded-mark ?+
562 "*Mark used for articles that were downloaded."
563 :group 'gnus-summary-marks
566 (defcustom gnus-downloadable-mark ?%
567 "*Mark used for articles that are to be downloaded."
568 :group 'gnus-summary-marks
571 (defcustom gnus-unsendable-mark ?=
572 "*Mark used for articles that won't be sent."
573 :group 'gnus-summary-marks
576 (defcustom gnus-score-over-mark ?+
577 "*Score mark used for articles with high scores."
578 :group 'gnus-summary-marks
581 (defcustom gnus-score-below-mark ?-
582 "*Score mark used for articles with low scores."
583 :group 'gnus-summary-marks
586 (defcustom gnus-empty-thread-mark ? ;Whitespace
587 "*There is no thread under the article."
588 :group 'gnus-summary-marks
591 (defcustom gnus-not-empty-thread-mark ?=
592 "*There is a thread under the article."
593 :group 'gnus-summary-marks
596 (defcustom gnus-view-pseudo-asynchronously nil
597 "*If non-nil, Gnus will view pseudo-articles asynchronously."
598 :group 'gnus-extract-view
601 (defcustom gnus-auto-expirable-marks
602 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
603 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
604 gnus-souped-mark gnus-duplicate-mark)
605 "*The list of marks converted into expiration if a group is auto-expirable."
608 :type '(repeat character))
610 (defcustom gnus-inhibit-user-auto-expire t
611 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
616 (defcustom gnus-view-pseudos nil
617 "*If `automatic', pseudo-articles will be viewed automatically.
618 If `not-confirm', pseudos will be viewed automatically, and the user
619 will not be asked to confirm the command."
620 :group 'gnus-extract-view
621 :type '(choice (const :tag "off" nil)
623 (const not-confirm)))
625 (defcustom gnus-view-pseudos-separately t
626 "*If non-nil, one pseudo-article will be created for each file to be viewed.
627 If nil, all files that use the same viewing command will be given as a
628 list of parameters to that command."
629 :group 'gnus-extract-view
632 (defcustom gnus-insert-pseudo-articles t
633 "*If non-nil, insert pseudo-articles when decoding articles."
634 :group 'gnus-extract-view
637 (defcustom gnus-summary-dummy-line-format
639 "*The format specification for the dummy roots in the summary buffer.
640 It works along the same lines as a normal formatting string,
641 with some simple extensions.
645 General format specifiers can also be used.
646 See `(gnus)Formatting Variables'."
647 :link '(custom-manual "(gnus)Formatting Variables")
648 :group 'gnus-threading
651 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
652 "*The format specification for the summary mode line.
653 It works along the same lines as a normal formatting string,
654 with some simple extensions:
657 %p Unprefixed group name
658 %A Current article number
659 %z Current article score
661 %U Number of unread articles in the group
662 %e Number of unselected articles in the group
663 %Z A string with unread/unselected article counts
664 %g Shortish group name
665 %S Subject of the current article
667 %s Current score file name
668 %d Number of dormant articles
669 %r Number of articles that have been marked as read in this session
670 %E Number of articles expunged by the score files"
671 :group 'gnus-summary-format
674 (defcustom gnus-list-identifiers nil
675 "Regexp that matches list identifiers to be removed from subject.
676 This can also be a list of regexps."
678 :group 'gnus-summary-format
679 :group 'gnus-article-hiding
680 :type '(choice (const :tag "none" nil)
682 (repeat :value (".*") regexp)))
684 (defcustom gnus-summary-mark-below 0
685 "*Mark all articles with a score below this variable as read.
686 This variable is local to each summary buffer and usually set by the
688 :group 'gnus-score-default
691 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
692 "*List of functions used for sorting articles in the summary buffer.
694 Each function takes two articles and returns non-nil if the first
695 article should be sorted before the other. If you use more than one
696 function, the primary sort function should be the last. You should
697 probably always include `gnus-article-sort-by-number' in the list of
698 sorting functions -- preferably first. Also note that sorting by date
699 is often much slower than sorting by number, and the sorting order is
700 very similar. (Sorting by date means sorting by the time the message
701 was sent, sorting by number means sorting by arrival time.)
703 Ready-made functions include `gnus-article-sort-by-number',
704 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
705 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
706 and `gnus-article-sort-by-score'.
708 When threading is turned on, the variable `gnus-thread-sort-functions'
709 controls how articles are sorted."
710 :group 'gnus-summary-sort
711 :type '(repeat (choice (function-item gnus-article-sort-by-number)
712 (function-item gnus-article-sort-by-author)
713 (function-item gnus-article-sort-by-subject)
714 (function-item gnus-article-sort-by-date)
715 (function-item gnus-article-sort-by-score)
716 (function-item gnus-article-sort-by-random)
717 (function :tag "other"))))
719 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
720 "*List of functions used for sorting threads in the summary buffer.
721 By default, threads are sorted by article number.
723 Each function takes two threads and returns non-nil if the first
724 thread should be sorted before the other. If you use more than one
725 function, the primary sort function should be the last. You should
726 probably always include `gnus-thread-sort-by-number' in the list of
727 sorting functions -- preferably first. Also note that sorting by date
728 is often much slower than sorting by number, and the sorting order is
729 very similar. (Sorting by date means sorting by the time the message
730 was sent, sorting by number means sorting by arrival time.)
732 Ready-made functions include `gnus-thread-sort-by-number',
733 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
734 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
735 `gnus-thread-sort-by-most-recent-number',
736 `gnus-thread-sort-by-most-recent-date',
737 `gnus-thread-sort-by-random', and
738 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
740 When threading is turned off, the variable
741 `gnus-article-sort-functions' controls how articles are sorted."
742 :group 'gnus-summary-sort
743 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
744 (function-item gnus-thread-sort-by-author)
745 (function-item gnus-thread-sort-by-subject)
746 (function-item gnus-thread-sort-by-date)
747 (function-item gnus-thread-sort-by-score)
748 (function-item gnus-thread-sort-by-total-score)
749 (function-item gnus-thread-sort-by-random)
750 (function :tag "other"))))
752 (defcustom gnus-thread-score-function '+
753 "*Function used for calculating the total score of a thread.
755 The function is called with the scores of the article and each
756 subthread and should then return the score of the thread.
758 Some functions you can use are `+', `max', or `min'."
759 :group 'gnus-summary-sort
762 (defcustom gnus-summary-expunge-below nil
763 "All articles that have a score less than this variable will be expunged.
764 This variable is local to the summary buffers."
765 :group 'gnus-score-default
766 :type '(choice (const :tag "off" nil)
769 (defcustom gnus-thread-expunge-below nil
770 "All threads that have a total score less than this variable will be expunged.
771 See `gnus-thread-score-function' for en explanation of what a
774 This variable is local to the summary buffers."
775 :group 'gnus-threading
776 :group 'gnus-score-default
777 :type '(choice (const :tag "off" nil)
780 (defcustom gnus-summary-mode-hook nil
781 "*A hook for Gnus summary mode.
782 This hook is run before any variables are set in the summary buffer."
783 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
784 :group 'gnus-summary-various
787 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
788 (when (featurep 'xemacs)
789 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
790 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
791 (add-hook 'gnus-summary-mode-hook
792 'gnus-xmas-switch-horizontal-scrollbar-off))
794 (defcustom gnus-summary-menu-hook nil
795 "*Hook run after the creation of the summary mode menu."
796 :group 'gnus-summary-visual
799 (defcustom gnus-summary-exit-hook nil
800 "*A hook called on exit from the summary buffer.
801 It will be called with point in the group buffer."
802 :group 'gnus-summary-exit
805 (defcustom gnus-summary-prepare-hook nil
806 "*A hook called after the summary buffer has been generated.
807 If you want to modify the summary buffer, you can use this hook."
808 :group 'gnus-summary-various
811 (defcustom gnus-summary-prepared-hook nil
812 "*A hook called as the last thing after the summary buffer has been generated."
813 :group 'gnus-summary-various
816 (defcustom gnus-summary-generate-hook nil
817 "*A hook run just before generating the summary buffer.
818 This hook is commonly used to customize threading variables and the
820 :group 'gnus-summary-various
823 (defcustom gnus-select-group-hook nil
824 "*A hook called when a newsgroup is selected.
826 If you'd like to simplify subjects like the
827 `gnus-summary-next-same-subject' command does, you can use the
830 (add-hook gnus-select-group-hook
832 (mapcar (lambda (header)
833 (mail-header-set-subject
835 (gnus-simplify-subject
836 (mail-header-subject header) 're-only)))
837 gnus-newsgroup-headers)))"
838 :group 'gnus-group-select
841 (defcustom gnus-select-article-hook nil
842 "*A hook called when an article is selected."
843 :group 'gnus-summary-choose
844 :options '(gnus-agent-fetch-selected-article)
847 (defcustom gnus-visual-mark-article-hook
848 (list 'gnus-highlight-selected-summary)
849 "*Hook run after selecting an article in the summary buffer.
850 It is meant to be used for highlighting the article in some way. It
851 is not run if `gnus-visual' is nil."
852 :group 'gnus-summary-visual
855 (defcustom gnus-parse-headers-hook nil
856 "*A hook called before parsing the headers."
860 (defcustom gnus-exit-group-hook nil
861 "*A hook called when exiting summary mode.
862 This hook is not called from the non-updating exit commands like `Q'."
866 (defcustom gnus-summary-update-hook
867 (list 'gnus-summary-highlight-line)
868 "*A hook called when a summary line is changed.
869 The hook will not be called if `gnus-visual' is nil.
871 The default function `gnus-summary-highlight-line' will
872 highlight the line according to the `gnus-summary-highlight'
874 :group 'gnus-summary-visual
877 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
878 "*A hook called when an article is selected for the first time.
879 The hook is intended to mark an article as read (or unread)
880 automatically when it is selected."
881 :group 'gnus-summary-choose
884 (defcustom gnus-group-no-more-groups-hook nil
885 "*A hook run when returning to group mode having no more (unread) groups."
886 :group 'gnus-group-select
889 (defcustom gnus-ps-print-hook nil
890 "*A hook run before ps-printing something from Gnus."
894 (defcustom gnus-summary-article-move-hook nil
895 "*A hook called after an article is moved, copied, respooled, or crossposted."
900 (defcustom gnus-summary-article-delete-hook nil
901 "*A hook called after an article is deleted."
906 (defcustom gnus-summary-article-expire-hook nil
907 "*A hook called after an article is expired."
912 (defcustom gnus-summary-display-arrow
913 (and (fboundp 'display-graphic-p)
915 "*If non-nil, display an arrow highlighting the current article."
920 (defcustom gnus-summary-selected-face 'gnus-summary-selected
921 "Face used for highlighting the current article in the summary buffer."
922 :group 'gnus-summary-visual
925 (defvar gnus-tmp-downloaded nil)
927 (defcustom gnus-summary-highlight
928 '(((eq mark gnus-canceled-mark)
929 . gnus-summary-cancelled)
930 ((and uncached (> score default-high))
931 . gnus-summary-high-undownloaded)
932 ((and uncached (< score default-low))
933 . gnus-summary-low-undownloaded)
935 . gnus-summary-normal-undownloaded)
936 ((and (> score default-high)
937 (or (eq mark gnus-dormant-mark)
938 (eq mark gnus-ticked-mark)))
939 . gnus-summary-high-ticked)
940 ((and (< score default-low)
941 (or (eq mark gnus-dormant-mark)
942 (eq mark gnus-ticked-mark)))
943 . gnus-summary-low-ticked)
944 ((or (eq mark gnus-dormant-mark)
945 (eq mark gnus-ticked-mark))
946 . gnus-summary-normal-ticked)
947 ((and (> score default-high) (eq mark gnus-ancient-mark))
948 . gnus-summary-high-ancient)
949 ((and (< score default-low) (eq mark gnus-ancient-mark))
950 . gnus-summary-low-ancient)
951 ((eq mark gnus-ancient-mark)
952 . gnus-summary-normal-ancient)
953 ((and (> score default-high) (eq mark gnus-unread-mark))
954 . gnus-summary-high-unread)
955 ((and (< score default-low) (eq mark gnus-unread-mark))
956 . gnus-summary-low-unread)
957 ((eq mark gnus-unread-mark)
958 . gnus-summary-normal-unread)
959 ((> score default-high)
960 . gnus-summary-high-read)
961 ((< score default-low)
962 . gnus-summary-low-read)
964 . gnus-summary-normal-read))
965 "*Controls the highlighting of summary buffer lines.
967 A list of (FORM . FACE) pairs. When deciding how a a particular
968 summary line should be displayed, each form is evaluated. The content
969 of the face field after the first true form is used. You can change
970 how those summary lines are displayed, by editing the face field.
972 You can use the following variables in the FORM field.
974 score: The article's score
975 default: The default article score.
976 default-high: The default score for high scored articles.
977 default-low: The default score for low scored articles.
978 below: The score below which articles are automatically marked as read.
979 mark: The article's mark.
980 uncached: Non-nil if the article is uncached."
981 :group 'gnus-summary-visual
982 :type '(repeat (cons (sexp :tag "Form" nil)
985 (defcustom gnus-alter-header-function nil
986 "Function called to allow alteration of article header structures.
987 The function is called with one parameter, the article header vector,
988 which it may alter in any way."
989 :type '(choice (const :tag "None" nil)
991 :group 'gnus-summary)
993 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
994 "Variable that says which function should be used to decode a string with encoded words.")
996 (defcustom gnus-extra-headers '(To Newsgroups)
997 "*Extra headers to parse."
1000 :type '(repeat symbol))
1002 (defcustom gnus-ignored-from-addresses
1003 (and user-mail-address
1004 (not (string= user-mail-address ""))
1005 (regexp-quote user-mail-address))
1006 "*Regexp of From headers that may be suppressed in favor of To headers."
1008 :group 'gnus-summary
1011 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1012 "List of charsets that should be ignored.
1013 When these charsets are used in the \"charset\" parameter, the
1014 default charset will be used instead."
1016 :type '(repeat symbol)
1017 :group 'gnus-charset)
1019 (gnus-define-group-parameter
1023 "Return the ignored charsets of GROUP."
1024 :variable gnus-group-ignored-charsets-alist
1026 '(("alt\\.chinese\\.text" iso-8859-1))
1028 "Alist of regexps (to match group names) and charsets that should be ignored.
1029 When these charsets are used in the \"charset\" parameter, the
1030 default charset will be used instead."
1031 :variable-group gnus-charset
1032 :variable-type '(repeat (cons (regexp :tag "Group")
1034 :parameter-type '(choice :tag "Ignored charsets"
1037 :parameter-document "\
1038 List of charsets that should be ignored.
1040 When these charsets are used in the \"charset\" parameter, the
1041 default charset will be used instead.")
1043 (defcustom gnus-group-highlight-words-alist nil
1044 "Alist of group regexps and highlight regexps.
1045 This variable uses the same syntax as `gnus-emphasis-alist'."
1047 :type '(repeat (cons (regexp :tag "Group")
1048 (repeat (list (regexp :tag "Highlight regexp")
1049 (number :tag "Group for entire word" 0)
1050 (number :tag "Group for displayed part" 0)
1052 gnus-emphasis-highlight-words)))))
1053 :group 'gnus-summary-visual)
1055 (defcustom gnus-summary-show-article-charset-alist
1057 "Alist of number and charset.
1058 The article will be shown with the charset corresponding to the
1060 For example: ((1 . cn-gb-2312) (2 . big5))."
1062 :type '(repeat (cons (number :tag "Argument" 1)
1063 (symbol :tag "Charset")))
1064 :group 'gnus-charset)
1066 (defcustom gnus-preserve-marks t
1067 "Whether marks are preserved when moving, copying and respooling messages."
1070 :group 'gnus-summary-marks)
1072 (defcustom gnus-alter-articles-to-read-function nil
1073 "Function to be called to alter the list of articles to be selected."
1074 :type '(choice (const nil) function)
1075 :group 'gnus-summary)
1077 (defcustom gnus-orphan-score nil
1078 "*All orphans get this score added. Set in the score file."
1079 :group 'gnus-score-default
1080 :type '(choice (const nil)
1083 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1084 "*A regexp to match MIME parts when saving multiple parts of a
1085 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1086 This regexp will be used by default when prompting the user for which
1087 type of files to save."
1088 :group 'gnus-summary
1091 (defcustom gnus-read-all-available-headers nil
1092 "Whether Gnus should parse all headers made available to it.
1093 This is mostly relevant for slow back ends where the user may
1094 wish to widen the summary buffer to include all headers
1095 that were fetched. Say, for nnultimate groups."
1097 :group 'gnus-summary
1098 :type '(choice boolean regexp))
1100 (defcustom gnus-summary-muttprint-program "muttprint"
1101 "Command (and optional arguments) used to run Muttprint."
1103 :group 'gnus-summary
1106 (defcustom gnus-article-loose-mime nil
1107 "If non-nil, don't require MIME-Version header.
1108 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1109 supply the MIME-Version header or deliberately strip it from the mail.
1110 Set it to non-nil, Gnus will treat some articles as MIME even if
1111 the MIME-Version header is missed."
1114 :group 'gnus-article-mime)
1116 (defcustom gnus-article-emulate-mime t
1117 "If non-nil, use MIME emulation for uuencode and the like.
1118 This means that Gnus will search message bodies for text that look
1119 like uuencoded bits, yEncoded bits, and so on, and present that using
1120 the normal Gnus MIME machinery."
1123 :group 'gnus-article-mime)
1125 ;;; Internal variables
1127 (defvar gnus-summary-display-cache nil)
1128 (defvar gnus-article-mime-handles nil)
1129 (defvar gnus-article-decoded-p nil)
1130 (defvar gnus-article-charset nil)
1131 (defvar gnus-article-ignored-charsets nil)
1132 (defvar gnus-scores-exclude-files nil)
1133 (defvar gnus-page-broken nil)
1135 (defvar gnus-original-article nil)
1136 (defvar gnus-article-internal-prepare-hook nil)
1137 (defvar gnus-newsgroup-process-stack nil)
1139 (defvar gnus-thread-indent-array nil)
1140 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1141 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1142 "Function called to sort the articles within a thread after it has been gathered together.")
1144 (defvar gnus-summary-save-parts-type-history nil)
1145 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1147 ;; Avoid highlighting in kill files.
1148 (defvar gnus-summary-inhibit-highlight nil)
1149 (defvar gnus-newsgroup-selected-overlay nil)
1150 (defvar gnus-inhibit-limiting nil)
1151 (defvar gnus-newsgroup-adaptive-score-file nil)
1152 (defvar gnus-current-score-file nil)
1153 (defvar gnus-current-move-group nil)
1154 (defvar gnus-current-copy-group nil)
1155 (defvar gnus-current-crosspost-group nil)
1156 (defvar gnus-newsgroup-display nil)
1158 (defvar gnus-newsgroup-dependencies nil)
1159 (defvar gnus-newsgroup-adaptive nil)
1160 (defvar gnus-summary-display-article-function nil)
1161 (defvar gnus-summary-highlight-line-function nil
1162 "Function called after highlighting a summary line.")
1164 (defvar gnus-summary-line-format-alist
1165 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1166 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1167 (?s gnus-tmp-subject-or-nil ?s)
1168 (?n gnus-tmp-name ?s)
1169 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1171 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1173 (?F gnus-tmp-from ?s)
1174 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1175 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1176 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1177 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1178 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1179 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1180 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1181 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1182 (?L gnus-tmp-lines ?s)
1183 (?O gnus-tmp-downloaded ?c)
1184 (?I gnus-tmp-indentation ?s)
1185 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1186 (?R gnus-tmp-replied ?c)
1187 (?\[ gnus-tmp-opening-bracket ?c)
1188 (?\] gnus-tmp-closing-bracket ?c)
1189 (?\> (make-string gnus-tmp-level ? ) ?s)
1190 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1191 (?i gnus-tmp-score ?d)
1192 (?z gnus-tmp-score-char ?c)
1193 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1194 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1195 (?U gnus-tmp-unread ?c)
1196 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1198 (?t (gnus-summary-number-of-articles-in-thread
1199 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1201 (?e (gnus-summary-number-of-articles-in-thread
1202 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1204 (?u gnus-tmp-user-defined ?s)
1205 (?P (gnus-pick-line-number) ?d)
1206 (?B gnus-tmp-thread-tree-header-string ?s)
1207 (user-date (gnus-user-date
1208 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1209 "An alist of format specifications that can appear in summary lines.
1210 These are paired with what variables they correspond with, along with
1211 the type of the variable (string, integer, character, etc).")
1213 (defvar gnus-summary-dummy-line-format-alist
1214 `((?S gnus-tmp-subject ?s)
1215 (?N gnus-tmp-number ?d)
1216 (?u gnus-tmp-user-defined ?s)))
1218 (defvar gnus-summary-mode-line-format-alist
1219 `((?G gnus-tmp-group-name ?s)
1220 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1221 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1222 (?A gnus-tmp-article-number ?d)
1223 (?Z gnus-tmp-unread-and-unselected ?s)
1224 (?V gnus-version ?s)
1225 (?U gnus-tmp-unread-and-unticked ?d)
1226 (?S gnus-tmp-subject ?s)
1227 (?e gnus-tmp-unselected ?d)
1228 (?u gnus-tmp-user-defined ?s)
1229 (?d (length gnus-newsgroup-dormant) ?d)
1230 (?t (length gnus-newsgroup-marked) ?d)
1231 (?h (length gnus-newsgroup-spam-marked) ?d)
1232 (?r (length gnus-newsgroup-reads) ?d)
1233 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1234 (?E gnus-newsgroup-expunged-tally ?d)
1235 (?s (gnus-current-score-file-nondirectory) ?s)))
1237 (defvar gnus-last-search-regexp nil
1238 "Default regexp for article search command.")
1240 (defvar gnus-last-shell-command nil
1241 "Default shell command on article.")
1243 (defvar gnus-newsgroup-agentized nil
1244 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1245 (defvar gnus-newsgroup-begin nil)
1246 (defvar gnus-newsgroup-end nil)
1247 (defvar gnus-newsgroup-last-rmail nil)
1248 (defvar gnus-newsgroup-last-mail nil)
1249 (defvar gnus-newsgroup-last-folder nil)
1250 (defvar gnus-newsgroup-last-file nil)
1251 (defvar gnus-newsgroup-auto-expire nil)
1252 (defvar gnus-newsgroup-active nil)
1254 (defvar gnus-newsgroup-data nil)
1255 (defvar gnus-newsgroup-data-reverse nil)
1256 (defvar gnus-newsgroup-limit nil)
1257 (defvar gnus-newsgroup-limits nil)
1258 (defvar gnus-summary-use-undownloaded-faces nil)
1260 (defvar gnus-newsgroup-unreads nil
1261 "Sorted list of unread articles in the current newsgroup.")
1263 (defvar gnus-newsgroup-unselected nil
1264 "Sorted list of unselected unread articles in the current newsgroup.")
1266 (defvar gnus-newsgroup-reads nil
1267 "Alist of read articles and article marks in the current newsgroup.")
1269 (defvar gnus-newsgroup-expunged-tally nil)
1271 (defvar gnus-newsgroup-marked nil
1272 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1274 (defvar gnus-newsgroup-spam-marked nil
1275 "List of ranges of articles that have been marked as spam.")
1277 (defvar gnus-newsgroup-killed nil
1278 "List of ranges of articles that have been through the scoring process.")
1280 (defvar gnus-newsgroup-cached nil
1281 "Sorted list of articles that come from the article cache.")
1283 (defvar gnus-newsgroup-saved nil
1284 "List of articles that have been saved.")
1286 (defvar gnus-newsgroup-kill-headers nil)
1288 (defvar gnus-newsgroup-replied nil
1289 "List of articles that have been replied to in the current newsgroup.")
1291 (defvar gnus-newsgroup-forwarded nil
1292 "List of articles that have been forwarded in the current newsgroup.")
1294 (defvar gnus-newsgroup-recent nil
1295 "List of articles that have are recent in the current newsgroup.")
1297 (defvar gnus-newsgroup-expirable nil
1298 "Sorted list of articles in the current newsgroup that can be expired.")
1300 (defvar gnus-newsgroup-processable nil
1301 "List of articles in the current newsgroup that can be processed.")
1303 (defvar gnus-newsgroup-downloadable nil
1304 "Sorted list of articles in the current newsgroup that can be processed.")
1306 (defvar gnus-newsgroup-unfetched nil
1307 "Sorted list of articles in the current newsgroup whose headers have
1308 not been fetched into the agent.
1310 This list will always be a subset of gnus-newsgroup-undownloaded.")
1312 (defvar gnus-newsgroup-undownloaded nil
1313 "List of articles in the current newsgroup that haven't been downloaded.")
1315 (defvar gnus-newsgroup-unsendable nil
1316 "List of articles in the current newsgroup that won't be sent.")
1318 (defvar gnus-newsgroup-bookmarks nil
1319 "List of articles in the current newsgroup that have bookmarks.")
1321 (defvar gnus-newsgroup-dormant nil
1322 "Sorted list of dormant articles in the current newsgroup.")
1324 (defvar gnus-newsgroup-unseen nil
1325 "List of unseen articles in the current newsgroup.")
1327 (defvar gnus-newsgroup-seen nil
1328 "Range of seen articles in the current newsgroup.")
1330 (defvar gnus-newsgroup-articles nil
1331 "List of articles in the current newsgroup.")
1333 (defvar gnus-newsgroup-scored nil
1334 "List of scored articles in the current newsgroup.")
1336 (defvar gnus-newsgroup-headers nil
1337 "List of article headers in the current newsgroup.")
1339 (defvar gnus-newsgroup-threads nil)
1341 (defvar gnus-newsgroup-prepared nil
1342 "Whether the current group has been prepared properly.")
1344 (defvar gnus-newsgroup-ancient nil
1345 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1347 (defvar gnus-newsgroup-sparse nil)
1349 (defvar gnus-current-article nil)
1350 (defvar gnus-article-current nil)
1351 (defvar gnus-current-headers nil)
1352 (defvar gnus-have-all-headers nil)
1353 (defvar gnus-last-article nil)
1354 (defvar gnus-newsgroup-history nil)
1355 (defvar gnus-newsgroup-charset nil)
1356 (defvar gnus-newsgroup-ephemeral-charset nil)
1357 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1359 (defvar gnus-article-before-search nil)
1361 (defvar gnus-summary-local-variables
1362 '(gnus-newsgroup-name
1363 gnus-newsgroup-begin gnus-newsgroup-end
1364 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1365 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1366 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1367 gnus-newsgroup-unselected gnus-newsgroup-marked
1368 gnus-newsgroup-spam-marked
1369 gnus-newsgroup-reads gnus-newsgroup-saved
1370 gnus-newsgroup-replied gnus-newsgroup-forwarded
1371 gnus-newsgroup-recent
1372 gnus-newsgroup-expirable
1373 gnus-newsgroup-processable gnus-newsgroup-killed
1374 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1375 gnus-newsgroup-unfetched
1376 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1377 gnus-newsgroup-seen gnus-newsgroup-articles
1378 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1379 gnus-newsgroup-headers gnus-newsgroup-threads
1380 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1381 gnus-current-article gnus-current-headers gnus-have-all-headers
1382 gnus-last-article gnus-article-internal-prepare-hook
1383 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1384 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1385 gnus-thread-expunge-below
1386 gnus-score-alist gnus-current-score-file
1387 (gnus-summary-expunge-below . global)
1388 (gnus-summary-mark-below . global)
1389 (gnus-orphan-score . global)
1390 gnus-newsgroup-active gnus-scores-exclude-files
1391 gnus-newsgroup-history gnus-newsgroup-ancient
1392 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1393 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1394 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1395 (gnus-newsgroup-expunged-tally . 0)
1396 gnus-cache-removable-articles gnus-newsgroup-cached
1397 gnus-newsgroup-data gnus-newsgroup-data-reverse
1398 gnus-newsgroup-limit gnus-newsgroup-limits
1399 gnus-newsgroup-charset gnus-newsgroup-display
1400 gnus-summary-use-undownloaded-faces)
1401 "Variables that are buffer-local to the summary buffers.")
1403 (defvar gnus-newsgroup-variables nil
1404 "A list of variables that have separate values in different newsgroups.
1405 A list of newsgroup (summary buffer) local variables, or cons of
1406 variables and their default expressions to be evalled (when the default
1407 values are not nil), that should be made global while the summary buffer
1410 Note: The default expressions will be evaluated (using function `eval')
1411 before assignment to the local variable rather than just assigned to it.
1412 If the default expression is the symbol `global', that symbol will not
1413 be evaluated but the global value of the local variable will be used
1416 These variables can be used to set variables in the group parameters
1417 while still allowing them to affect operations done in other buffers.
1420 \(setq gnus-newsgroup-variables
1421 '(message-use-followup-to
1422 (gnus-visible-headers .
1423 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1426 ;; Byte-compiler warning.
1428 ;; Bind features so that require will believe that gnus-sum has
1429 ;; already been loaded (avoids infinite recursion)
1430 (let ((features (cons 'gnus-sum features)))
1431 ;; Several of the declarations in gnus-sum are needed to load the
1432 ;; following files. Right now, these definitions have been
1433 ;; compiled but not defined (evaluated). We could either do a
1434 ;; eval-and-compile about all of the declarations or evaluate the
1436 (if (boundp 'gnus-newsgroup-variables)
1438 (load "gnus-sum.el" t t t))
1440 (require 'gnus-agent)
1441 (require 'gnus-art)))
1445 (defvar gnus-decode-encoded-word-methods
1446 '(mail-decode-encoded-word-string)
1447 "List of methods used to decode encoded words.
1449 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1450 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1451 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1452 whose names match REGEXP.
1455 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1456 mail-decode-encoded-word-string
1457 (\"chinese\" . rfc1843-decode-string))")
1459 (defvar gnus-decode-encoded-word-methods-cache nil)
1461 (defun gnus-multi-decode-encoded-word-string (string)
1462 "Apply the functions from `gnus-encoded-word-methods' that match."
1463 (unless (and gnus-decode-encoded-word-methods-cache
1464 (eq gnus-newsgroup-name
1465 (car gnus-decode-encoded-word-methods-cache)))
1466 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1469 (nconc gnus-decode-encoded-word-methods-cache (list x))
1470 (if (and gnus-newsgroup-name
1471 (string-match (car x) gnus-newsgroup-name))
1472 (nconc gnus-decode-encoded-word-methods-cache
1474 gnus-decode-encoded-word-methods))
1475 (let ((xlist gnus-decode-encoded-word-methods-cache))
1478 (setq string (funcall (pop xlist) string))))
1481 ;; Subject simplification.
1483 (defun gnus-simplify-whitespace (str)
1484 "Remove excessive whitespace from STR."
1486 (while (string-match "[ \t][ \t]+" str)
1487 (setq str (concat (substring str 0 (match-beginning 0))
1489 (substring str (match-end 0)))))
1491 (when (string-match "^[ \t]+" str)
1492 (setq str (substring str (match-end 0))))
1494 (when (string-match "[ \t]+$" str)
1495 (setq str (substring str 0 (match-beginning 0))))
1498 (defun gnus-simplify-all-whitespace (str)
1499 "Remove all whitespace from STR."
1500 (while (string-match "[ \t\n]+" str)
1501 (setq str (replace-match "" nil nil str)))
1504 (defsubst gnus-simplify-subject-re (subject)
1505 "Remove \"Re:\" from subject lines."
1506 (if (string-match message-subject-re-regexp subject)
1507 (substring subject (match-end 0))
1510 (defun gnus-simplify-subject (subject &optional re-only)
1511 "Remove `Re:' and words in parentheses.
1512 If RE-ONLY is non-nil, strip leading `Re:'s only."
1513 (let ((case-fold-search t)) ;Ignore case.
1514 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1515 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1516 (setq subject (substring subject (match-end 0))))
1517 ;; Remove uninteresting prefixes.
1518 (when (and (not re-only)
1519 gnus-simplify-ignored-prefixes
1520 (string-match gnus-simplify-ignored-prefixes subject))
1521 (setq subject (substring subject (match-end 0))))
1522 ;; Remove words in parentheses from end.
1524 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1525 (setq subject (substring subject 0 (match-beginning 0)))))
1526 ;; Return subject string.
1529 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1531 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1532 (goto-char (point-min))
1533 (while (re-search-forward regexp nil t)
1534 (replace-match (or newtext ""))))
1536 (defun gnus-simplify-buffer-fuzzy ()
1537 "Simplify string in the buffer fuzzily.
1538 The string in the accessible portion of the current buffer is simplified.
1539 It is assumed to be a single-line subject.
1540 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1541 matter is removed. Additional things can be deleted by setting
1542 `gnus-simplify-subject-fuzzy-regexp'."
1543 (let ((case-fold-search t)
1545 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1547 (while (not (eq modified-tick (buffer-modified-tick)))
1548 (setq modified-tick (buffer-modified-tick))
1550 ((listp gnus-simplify-subject-fuzzy-regexp)
1551 (mapcar 'gnus-simplify-buffer-fuzzy-step
1552 gnus-simplify-subject-fuzzy-regexp))
1553 (gnus-simplify-subject-fuzzy-regexp
1554 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1555 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1556 (gnus-simplify-buffer-fuzzy-step
1557 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1558 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1560 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1561 (gnus-simplify-buffer-fuzzy-step " +" " ")
1562 (gnus-simplify-buffer-fuzzy-step " $")
1563 (gnus-simplify-buffer-fuzzy-step "^ +")))
1565 (defun gnus-simplify-subject-fuzzy (subject)
1566 "Simplify a subject string fuzzily.
1567 See `gnus-simplify-buffer-fuzzy' for details."
1569 (gnus-set-work-buffer)
1570 (let ((case-fold-search t))
1571 ;; Remove uninteresting prefixes.
1572 (when (and gnus-simplify-ignored-prefixes
1573 (string-match gnus-simplify-ignored-prefixes subject))
1574 (setq subject (substring subject (match-end 0))))
1576 (inline (gnus-simplify-buffer-fuzzy))
1579 (defsubst gnus-simplify-subject-fully (subject)
1580 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1582 (gnus-simplify-subject-functions
1583 (gnus-map-function gnus-simplify-subject-functions subject))
1584 ((null gnus-summary-gather-subject-limit)
1585 (gnus-simplify-subject-re subject))
1586 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1587 (gnus-simplify-subject-fuzzy subject))
1588 ((numberp gnus-summary-gather-subject-limit)
1589 (gnus-limit-string (gnus-simplify-subject-re subject)
1590 gnus-summary-gather-subject-limit))
1594 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1595 "Check whether two subjects are equal.
1596 If optional argument SIMPLE-FIRST is t, first argument is already
1599 ((null simple-first)
1600 (equal (gnus-simplify-subject-fully s1)
1601 (gnus-simplify-subject-fully s2)))
1604 (gnus-simplify-subject-fully s2)))))
1606 (defun gnus-summary-bubble-group ()
1607 "Increase the score of the current group.
1608 This is a handy function to add to `gnus-summary-exit-hook' to
1609 increase the score of each group you read."
1610 (gnus-group-add-score gnus-newsgroup-name))
1614 ;;; Gnus summary mode
1617 (put 'gnus-summary-mode 'mode-class 'special)
1619 (defvar gnus-article-commands-menu)
1621 ;; Non-orthogonal keys
1623 (gnus-define-keys gnus-summary-mode-map
1624 " " gnus-summary-next-page
1625 "\177" gnus-summary-prev-page
1626 [delete] gnus-summary-prev-page
1627 [backspace] gnus-summary-prev-page
1628 "\r" gnus-summary-scroll-up
1629 "\M-\r" gnus-summary-scroll-down
1630 "n" gnus-summary-next-unread-article
1631 "p" gnus-summary-prev-unread-article
1632 "N" gnus-summary-next-article
1633 "P" gnus-summary-prev-article
1634 "\M-\C-n" gnus-summary-next-same-subject
1635 "\M-\C-p" gnus-summary-prev-same-subject
1636 "\M-n" gnus-summary-next-unread-subject
1637 "\M-p" gnus-summary-prev-unread-subject
1638 "." gnus-summary-first-unread-article
1639 "," gnus-summary-best-unread-article
1640 "\M-s" gnus-summary-search-article-forward
1641 "\M-r" gnus-summary-search-article-backward
1642 "<" gnus-summary-beginning-of-article
1643 ">" gnus-summary-end-of-article
1644 "j" gnus-summary-goto-article
1645 "^" gnus-summary-refer-parent-article
1646 "\M-^" gnus-summary-refer-article
1647 "u" gnus-summary-tick-article-forward
1648 "!" gnus-summary-tick-article-forward
1649 "U" gnus-summary-tick-article-backward
1650 "d" gnus-summary-mark-as-read-forward
1651 "D" gnus-summary-mark-as-read-backward
1652 "E" gnus-summary-mark-as-expirable
1653 "\M-u" gnus-summary-clear-mark-forward
1654 "\M-U" gnus-summary-clear-mark-backward
1655 "k" gnus-summary-kill-same-subject-and-select
1656 "\C-k" gnus-summary-kill-same-subject
1657 "\M-\C-k" gnus-summary-kill-thread
1658 "\M-\C-l" gnus-summary-lower-thread
1659 "e" gnus-summary-edit-article
1660 "#" gnus-summary-mark-as-processable
1661 "\M-#" gnus-summary-unmark-as-processable
1662 "\M-\C-t" gnus-summary-toggle-threads
1663 "\M-\C-s" gnus-summary-show-thread
1664 "\M-\C-h" gnus-summary-hide-thread
1665 "\M-\C-f" gnus-summary-next-thread
1666 "\M-\C-b" gnus-summary-prev-thread
1667 [(meta down)] gnus-summary-next-thread
1668 [(meta up)] gnus-summary-prev-thread
1669 "\M-\C-u" gnus-summary-up-thread
1670 "\M-\C-d" gnus-summary-down-thread
1671 "&" gnus-summary-execute-command
1672 "c" gnus-summary-catchup-and-exit
1673 "\C-w" gnus-summary-mark-region-as-read
1674 "\C-t" gnus-summary-toggle-truncation
1675 "?" gnus-summary-mark-as-dormant
1676 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1677 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1678 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1679 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1680 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1681 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1682 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1683 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1684 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1685 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1686 "=" gnus-summary-expand-window
1687 "\C-x\C-s" gnus-summary-reselect-current-group
1688 "\M-g" gnus-summary-rescan-group
1689 "w" gnus-summary-stop-page-breaking
1690 "\C-c\C-r" gnus-summary-caesar-message
1691 "f" gnus-summary-followup
1692 "F" gnus-summary-followup-with-original
1693 "C" gnus-summary-cancel-article
1694 "r" gnus-summary-reply
1695 "R" gnus-summary-reply-with-original
1696 "\C-c\C-f" gnus-summary-mail-forward
1697 "o" gnus-summary-save-article
1698 "\C-o" gnus-summary-save-article-mail
1699 "|" gnus-summary-pipe-output
1700 "\M-k" gnus-summary-edit-local-kill
1701 "\M-K" gnus-summary-edit-global-kill
1703 "\C-c\C-d" gnus-summary-describe-group
1704 "q" gnus-summary-exit
1705 "Q" gnus-summary-exit-no-update
1706 "\C-c\C-i" gnus-info-find-node
1707 gnus-mouse-2 gnus-mouse-pick-article
1708 [follow-link] mouse-face
1709 "m" gnus-summary-mail-other-window
1710 "a" gnus-summary-post-news
1711 "i" gnus-summary-news-other-window
1712 "x" gnus-summary-limit-to-unread
1713 "s" gnus-summary-isearch-article
1714 "t" gnus-summary-toggle-header
1715 "g" gnus-summary-show-article
1716 "l" gnus-summary-goto-last-article
1717 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1718 "\C-d" gnus-summary-enter-digest-group
1719 "\M-\C-d" gnus-summary-read-document
1720 "\M-\C-e" gnus-summary-edit-parameters
1721 "\M-\C-a" gnus-summary-customize-parameters
1723 "*" gnus-cache-enter-article
1724 "\M-*" gnus-cache-remove-article
1725 "\M-&" gnus-summary-universal-argument
1726 "\C-l" gnus-recenter
1727 "I" gnus-summary-increase-score
1728 "L" gnus-summary-lower-score
1729 "\M-i" gnus-symbolic-argument
1730 "h" gnus-summary-select-article-buffer
1732 "b" gnus-article-view-part
1733 "\M-t" gnus-summary-toggle-display-buttonized
1735 "V" gnus-summary-score-map
1736 "X" gnus-uu-extract-map
1737 "S" gnus-summary-send-map)
1739 ;; Sort of orthogonal keymap
1740 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1741 "t" gnus-summary-tick-article-forward
1742 "!" gnus-summary-tick-article-forward
1743 "d" gnus-summary-mark-as-read-forward
1744 "r" gnus-summary-mark-as-read-forward
1745 "c" gnus-summary-clear-mark-forward
1746 " " gnus-summary-clear-mark-forward
1747 "e" gnus-summary-mark-as-expirable
1748 "x" gnus-summary-mark-as-expirable
1749 "?" gnus-summary-mark-as-dormant
1750 "b" gnus-summary-set-bookmark
1751 "B" gnus-summary-remove-bookmark
1752 "#" gnus-summary-mark-as-processable
1753 "\M-#" gnus-summary-unmark-as-processable
1754 "S" gnus-summary-limit-include-expunged
1755 "C" gnus-summary-catchup
1756 "H" gnus-summary-catchup-to-here
1757 "h" gnus-summary-catchup-from-here
1758 "\C-c" gnus-summary-catchup-all
1759 "k" gnus-summary-kill-same-subject-and-select
1760 "K" gnus-summary-kill-same-subject
1761 "P" gnus-uu-mark-map)
1763 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1764 "c" gnus-summary-clear-above
1765 "u" gnus-summary-tick-above
1766 "m" gnus-summary-mark-above
1767 "k" gnus-summary-kill-below)
1769 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1770 "/" gnus-summary-limit-to-subject
1771 "n" gnus-summary-limit-to-articles
1772 "w" gnus-summary-pop-limit
1773 "s" gnus-summary-limit-to-subject
1774 "a" gnus-summary-limit-to-author
1775 "u" gnus-summary-limit-to-unread
1776 "m" gnus-summary-limit-to-marks
1777 "M" gnus-summary-limit-exclude-marks
1778 "v" gnus-summary-limit-to-score
1779 "*" gnus-summary-limit-include-cached
1780 "D" gnus-summary-limit-include-dormant
1781 "T" gnus-summary-limit-include-thread
1782 "d" gnus-summary-limit-exclude-dormant
1783 "t" gnus-summary-limit-to-age
1784 "." gnus-summary-limit-to-unseen
1785 "x" gnus-summary-limit-to-extra
1786 "p" gnus-summary-limit-to-display-predicate
1787 "E" gnus-summary-limit-include-expunged
1788 "c" gnus-summary-limit-exclude-childless-dormant
1789 "C" gnus-summary-limit-mark-excluded-as-read
1790 "o" gnus-summary-insert-old-articles
1791 "N" gnus-summary-insert-new-articles)
1793 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1794 "n" gnus-summary-next-unread-article
1795 "p" gnus-summary-prev-unread-article
1796 "N" gnus-summary-next-article
1797 "P" gnus-summary-prev-article
1798 "\C-n" gnus-summary-next-same-subject
1799 "\C-p" gnus-summary-prev-same-subject
1800 "\M-n" gnus-summary-next-unread-subject
1801 "\M-p" gnus-summary-prev-unread-subject
1802 "f" gnus-summary-first-unread-article
1803 "b" gnus-summary-best-unread-article
1804 "j" gnus-summary-goto-article
1805 "g" gnus-summary-goto-subject
1806 "l" gnus-summary-goto-last-article
1807 "o" gnus-summary-pop-article)
1809 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1810 "k" gnus-summary-kill-thread
1811 "l" gnus-summary-lower-thread
1812 "i" gnus-summary-raise-thread
1813 "T" gnus-summary-toggle-threads
1814 "t" gnus-summary-rethread-current
1815 "^" gnus-summary-reparent-thread
1816 "s" gnus-summary-show-thread
1817 "S" gnus-summary-show-all-threads
1818 "h" gnus-summary-hide-thread
1819 "H" gnus-summary-hide-all-threads
1820 "n" gnus-summary-next-thread
1821 "p" gnus-summary-prev-thread
1822 "u" gnus-summary-up-thread
1823 "o" gnus-summary-top-thread
1824 "d" gnus-summary-down-thread
1825 "#" gnus-uu-mark-thread
1826 "\M-#" gnus-uu-unmark-thread)
1828 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1829 "g" gnus-summary-prepare
1830 "c" gnus-summary-insert-cached-articles
1831 "d" gnus-summary-insert-dormant-articles)
1833 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1834 "c" gnus-summary-catchup-and-exit
1835 "C" gnus-summary-catchup-all-and-exit
1836 "E" gnus-summary-exit-no-update
1837 "Q" gnus-summary-exit
1838 "Z" gnus-summary-exit
1839 "n" gnus-summary-catchup-and-goto-next-group
1840 "R" gnus-summary-reselect-current-group
1841 "G" gnus-summary-rescan-group
1842 "N" gnus-summary-next-group
1843 "s" gnus-summary-save-newsrc
1844 "P" gnus-summary-prev-group)
1846 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1847 " " gnus-summary-next-page
1848 "n" gnus-summary-next-page
1849 "\177" gnus-summary-prev-page
1850 [delete] gnus-summary-prev-page
1851 "p" gnus-summary-prev-page
1852 "\r" gnus-summary-scroll-up
1853 "\M-\r" gnus-summary-scroll-down
1854 "<" gnus-summary-beginning-of-article
1855 ">" gnus-summary-end-of-article
1856 "b" gnus-summary-beginning-of-article
1857 "e" gnus-summary-end-of-article
1858 "^" gnus-summary-refer-parent-article
1859 "r" gnus-summary-refer-parent-article
1860 "D" gnus-summary-enter-digest-group
1861 "R" gnus-summary-refer-references
1862 "T" gnus-summary-refer-thread
1863 "g" gnus-summary-show-article
1864 "s" gnus-summary-isearch-article
1865 "P" gnus-summary-print-article
1866 "M" gnus-mailing-list-insinuate
1867 "t" gnus-article-babel)
1869 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1870 "b" gnus-article-add-buttons
1871 "B" gnus-article-add-buttons-to-head
1872 "o" gnus-article-treat-overstrike
1873 "e" gnus-article-emphasize
1874 "w" gnus-article-fill-cited-article
1875 "Q" gnus-article-fill-long-lines
1876 "C" gnus-article-capitalize-sentences
1877 "c" gnus-article-remove-cr
1878 "q" gnus-article-de-quoted-unreadable
1879 "6" gnus-article-de-base64-unreadable
1880 "Z" gnus-article-decode-HZ
1881 "h" gnus-article-wash-html
1882 "u" gnus-article-unsplit-urls
1883 "s" gnus-summary-force-verify-and-decrypt
1884 "f" gnus-article-display-x-face
1885 "l" gnus-summary-stop-page-breaking
1886 "r" gnus-summary-caesar-message
1887 "m" gnus-summary-morse-message
1888 "t" gnus-summary-toggle-header
1889 "g" gnus-treat-smiley
1890 "v" gnus-summary-verbose-headers
1891 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1892 "p" gnus-article-verify-x-pgp-sig
1893 "d" gnus-article-treat-dumbquotes)
1895 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1896 ;; mnemonic: deuglif*Y*
1897 "u" gnus-article-outlook-unwrap-lines
1898 "a" gnus-article-outlook-repair-attribution
1899 "c" gnus-article-outlook-rearrange-citation
1900 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1902 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1903 "a" gnus-article-hide
1904 "h" gnus-article-hide-headers
1905 "b" gnus-article-hide-boring-headers
1906 "s" gnus-article-hide-signature
1907 "c" gnus-article-hide-citation
1908 "C" gnus-article-hide-citation-in-followups
1909 "l" gnus-article-hide-list-identifiers
1910 "B" gnus-article-strip-banner
1911 "P" gnus-article-hide-pem
1912 "\C-c" gnus-article-hide-citation-maybe)
1914 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1915 "a" gnus-article-highlight
1916 "h" gnus-article-highlight-headers
1917 "c" gnus-article-highlight-citation
1918 "s" gnus-article-highlight-signature)
1920 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1921 "f" gnus-article-treat-fold-headers
1922 "u" gnus-article-treat-unfold-headers
1923 "n" gnus-article-treat-fold-newsgroups)
1925 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1926 "x" gnus-article-display-x-face
1927 "d" gnus-article-display-face
1928 "s" gnus-treat-smiley
1929 "D" gnus-article-remove-images
1930 "f" gnus-treat-from-picon
1931 "m" gnus-treat-mail-picon
1932 "n" gnus-treat-newsgroups-picon)
1934 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1935 "w" gnus-article-decode-mime-words
1936 "c" gnus-article-decode-charset
1937 "v" gnus-mime-view-all-parts
1938 "b" gnus-article-view-part)
1940 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1941 "z" gnus-article-date-ut
1942 "u" gnus-article-date-ut
1943 "l" gnus-article-date-local
1944 "p" gnus-article-date-english
1945 "e" gnus-article-date-lapsed
1946 "o" gnus-article-date-original
1947 "i" gnus-article-date-iso8601
1948 "s" gnus-article-date-user)
1950 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1951 "t" gnus-article-remove-trailing-blank-lines
1952 "l" gnus-article-strip-leading-blank-lines
1953 "m" gnus-article-strip-multiple-blank-lines
1954 "a" gnus-article-strip-blank-lines
1955 "A" gnus-article-strip-all-blank-lines
1956 "s" gnus-article-strip-leading-space
1957 "e" gnus-article-strip-trailing-space
1958 "w" gnus-article-remove-leading-whitespace)
1960 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1962 "f" gnus-summary-fetch-faq
1963 "d" gnus-summary-describe-group
1964 "h" gnus-summary-describe-briefly
1965 "i" gnus-info-find-node
1966 "c" gnus-group-fetch-charter
1967 "C" gnus-group-fetch-control)
1969 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1970 "e" gnus-summary-expire-articles
1971 "\M-\C-e" gnus-summary-expire-articles-now
1972 "\177" gnus-summary-delete-article
1973 [delete] gnus-summary-delete-article
1974 [backspace] gnus-summary-delete-article
1975 "m" gnus-summary-move-article
1976 "r" gnus-summary-respool-article
1977 "w" gnus-summary-edit-article
1978 "c" gnus-summary-copy-article
1979 "B" gnus-summary-crosspost-article
1980 "q" gnus-summary-respool-query
1981 "t" gnus-summary-respool-trace
1982 "i" gnus-summary-import-article
1983 "I" gnus-summary-create-article
1984 "p" gnus-summary-article-posted-p)
1986 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1987 "o" gnus-summary-save-article
1988 "m" gnus-summary-save-article-mail
1989 "F" gnus-summary-write-article-file
1990 "r" gnus-summary-save-article-rmail
1991 "f" gnus-summary-save-article-file
1992 "b" gnus-summary-save-article-body-file
1993 "h" gnus-summary-save-article-folder
1994 "v" gnus-summary-save-article-vm
1995 "p" gnus-summary-pipe-output
1996 "P" gnus-summary-muttprint
1997 "s" gnus-soup-add-article)
1999 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2000 "b" gnus-summary-display-buttonized
2001 "m" gnus-summary-repair-multipart
2002 "v" gnus-article-view-part
2003 "o" gnus-article-save-part
2004 "c" gnus-article-copy-part
2005 "C" gnus-article-view-part-as-charset
2006 "e" gnus-article-view-part-externally
2007 "E" gnus-article-encrypt-body
2008 "i" gnus-article-inline-part
2009 "|" gnus-article-pipe-part)
2011 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2012 "p" gnus-summary-mark-as-processable
2013 "u" gnus-summary-unmark-as-processable
2014 "U" gnus-summary-unmark-all-processable
2015 "v" gnus-uu-mark-over
2016 "s" gnus-uu-mark-series
2017 "r" gnus-uu-mark-region
2018 "g" gnus-uu-unmark-region
2019 "R" gnus-uu-mark-by-regexp
2020 "G" gnus-uu-unmark-by-regexp
2021 "t" gnus-uu-mark-thread
2022 "T" gnus-uu-unmark-thread
2023 "a" gnus-uu-mark-all
2024 "b" gnus-uu-mark-buffer
2025 "S" gnus-uu-mark-sparse
2026 "k" gnus-summary-kill-process-mark
2027 "y" gnus-summary-yank-process-mark
2028 "w" gnus-summary-save-process-mark
2029 "i" gnus-uu-invert-processable)
2031 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2032 ;;"x" gnus-uu-extract-any
2033 "m" gnus-summary-save-parts
2034 "u" gnus-uu-decode-uu
2035 "U" gnus-uu-decode-uu-and-save
2036 "s" gnus-uu-decode-unshar
2037 "S" gnus-uu-decode-unshar-and-save
2038 "o" gnus-uu-decode-save
2039 "O" gnus-uu-decode-save
2040 "b" gnus-uu-decode-binhex
2041 "B" gnus-uu-decode-binhex
2042 "p" gnus-uu-decode-postscript
2043 "P" gnus-uu-decode-postscript-and-save)
2046 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2047 "u" gnus-uu-decode-uu-view
2048 "U" gnus-uu-decode-uu-and-save-view
2049 "s" gnus-uu-decode-unshar-view
2050 "S" gnus-uu-decode-unshar-and-save-view
2051 "o" gnus-uu-decode-save-view
2052 "O" gnus-uu-decode-save-view
2053 "b" gnus-uu-decode-binhex-view
2054 "B" gnus-uu-decode-binhex-view
2055 "p" gnus-uu-decode-postscript-view
2056 "P" gnus-uu-decode-postscript-and-save-view)
2058 (defvar gnus-article-post-menu nil)
2060 (defconst gnus-summary-menu-maxlen 20)
2062 (defun gnus-summary-menu-split (menu)
2063 ;; If we have lots of elements, divide them into groups of 20
2064 ;; and make a pane (or submenu) for each one.
2065 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2066 (let ((menu menu) sublists next
2069 ;; Pull off the next gnus-summary-menu-maxlen elements
2070 ;; and make them the next element of sublist.
2071 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2073 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2075 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2076 (aref (car (last menu)) 0)) menu)
2080 (nreverse sublists))
2081 ;; Few elements--put them all in one pane.
2084 (defun gnus-summary-make-menu-bar ()
2085 (gnus-turn-off-edit-menu 'summary)
2087 (unless (boundp 'gnus-summary-misc-menu)
2090 gnus-summary-kill-menu gnus-summary-mode-map ""
2095 ["Customize" gnus-score-customize t])
2096 (gnus-make-score-map 'increase)
2097 (gnus-make-score-map 'lower)
2099 ["Kill below" gnus-summary-kill-below t]
2100 ["Mark above" gnus-summary-mark-above t]
2101 ["Tick above" gnus-summary-tick-above t]
2102 ["Clear above" gnus-summary-clear-above t])
2103 ["Current score" gnus-summary-current-score t]
2104 ["Set score" gnus-summary-set-score t]
2105 ["Switch current score file..." gnus-score-change-score-file t]
2106 ["Set mark below..." gnus-score-set-mark-below t]
2107 ["Set expunge below..." gnus-score-set-expunge-below t]
2108 ["Edit current score file" gnus-score-edit-current-scores t]
2109 ["Edit score file" gnus-score-edit-file t]
2110 ["Trace score" gnus-score-find-trace t]
2111 ["Find words" gnus-score-find-favourite-words t]
2112 ["Rescore buffer" gnus-summary-rescore t]
2113 ["Increase score..." gnus-summary-increase-score t]
2114 ["Lower score..." gnus-summary-lower-score t]))))
2116 ;; Define both the Article menu in the summary buffer and the
2117 ;; equivalent Commands menu in the article buffer here for
2121 ["All" gnus-article-hide t]
2122 ["Headers" gnus-article-hide-headers t]
2123 ["Signature" gnus-article-hide-signature t]
2124 ["Citation" gnus-article-hide-citation t]
2125 ["List identifiers" gnus-article-hide-list-identifiers t]
2126 ["Banner" gnus-article-strip-banner t]
2127 ["Boring headers" gnus-article-hide-boring-headers t])
2129 ["All" gnus-article-highlight t]
2130 ["Headers" gnus-article-highlight-headers t]
2131 ["Signature" gnus-article-highlight-signature t]
2132 ["Citation" gnus-article-highlight-citation t])
2134 ["Words" gnus-article-decode-mime-words t]
2135 ["Charset" gnus-article-decode-charset t]
2136 ["QP" gnus-article-de-quoted-unreadable t]
2137 ["Base64" gnus-article-de-base64-unreadable t]
2138 ["View MIME buttons" gnus-summary-display-buttonized t]
2139 ["View all" gnus-mime-view-all-parts t]
2140 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2141 ["Encrypt body" gnus-article-encrypt-body
2142 :active (not (gnus-group-read-only-p))
2143 ,@(if (featurep 'xemacs) nil
2144 '(:help "Encrypt the message body on disk"))]
2145 ["Extract all parts..." gnus-summary-save-parts t]
2147 ["Repair multipart" gnus-summary-repair-multipart t]
2148 ["Pipe part..." gnus-article-pipe-part t]
2149 ["Inline part" gnus-article-inline-part t]
2150 ["Encrypt body" gnus-article-encrypt-body
2151 :active (not (gnus-group-read-only-p))
2152 ,@(if (featurep 'xemacs) nil
2153 '(:help "Encrypt the message body on disk"))]
2154 ["View part externally" gnus-article-view-part-externally t]
2155 ["View part with charset..." gnus-article-view-part-as-charset t]
2156 ["Copy part" gnus-article-copy-part t]
2157 ["Save part..." gnus-article-save-part t]
2158 ["View part" gnus-article-view-part t]))
2160 ["Local" gnus-article-date-local t]
2161 ["ISO8601" gnus-article-date-iso8601 t]
2162 ["UT" gnus-article-date-ut t]
2163 ["Original" gnus-article-date-original t]
2164 ["Lapsed" gnus-article-date-lapsed t]
2165 ["User-defined" gnus-article-date-user t])
2167 ["Remove images" gnus-article-remove-images t]
2168 ["Toggle smiley" gnus-treat-smiley t]
2169 ["Show X-Face" gnus-article-display-x-face t]
2170 ["Show picons in From" gnus-treat-from-picon t]
2171 ["Show picons in mail headers" gnus-treat-mail-picon t]
2172 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2173 ("View as different encoding"
2174 ,@(gnus-summary-menu-split
2177 ;; Since easymenu under Emacs doesn't allow
2178 ;; lambda forms for menu commands, we should
2179 ;; provide intern'ed function symbols.
2180 (let ((command (intern (format "\
2181 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2185 (let ((gnus-summary-show-article-charset-alist
2187 (gnus-summary-show-article 1))))
2188 `[,(symbol-name cs) ,command t]))
2189 (sort (if (fboundp 'coding-system-list)
2190 (coding-system-list)
2191 (mapcar 'car mm-mime-mule-charset-alist))
2195 ["Leading" gnus-article-strip-leading-blank-lines t]
2196 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2197 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2198 ["All of the above" gnus-article-strip-blank-lines t]
2199 ["All" gnus-article-strip-all-blank-lines t]
2200 ["Leading space" gnus-article-strip-leading-space t]
2201 ["Trailing space" gnus-article-strip-trailing-space t]
2202 ["Leading space in headers"
2203 gnus-article-remove-leading-whitespace t])
2204 ["Overstrike" gnus-article-treat-overstrike t]
2205 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2206 ["Emphasis" gnus-article-emphasize t]
2207 ["Word wrap" gnus-article-fill-cited-article t]
2208 ["Fill long lines" gnus-article-fill-long-lines t]
2209 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2210 ["Remove CR" gnus-article-remove-cr t]
2211 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2212 ["Base64" gnus-article-de-base64-unreadable t]
2213 ["Rot 13" gnus-summary-caesar-message
2214 ,@(if (featurep 'xemacs) '(t)
2215 '(:help "\"Caesar rotate\" article by 13"))]
2216 ["Morse decode" gnus-summary-morse-message t]
2217 ["Unix pipe..." gnus-summary-pipe-message t]
2218 ["Add buttons" gnus-article-add-buttons t]
2219 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2220 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2221 ["Verbose header" gnus-summary-verbose-headers t]
2222 ["Toggle header" gnus-summary-toggle-header t]
2223 ["Unfold headers" gnus-article-treat-unfold-headers t]
2224 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2225 ["Html" gnus-article-wash-html t]
2226 ["Unsplit URLs" gnus-article-unsplit-urls t]
2227 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2228 ["Decode HZ" gnus-article-decode-HZ t]
2229 ("(Outlook) Deuglify"
2230 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2231 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2232 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2233 ["Full (Outlook) deuglify"
2234 gnus-article-outlook-deuglify-article t])
2237 ["Save in default format..." gnus-summary-save-article
2238 ,@(if (featurep 'xemacs) '(t)
2239 '(:help "Save article using default method"))]
2240 ["Save in file..." gnus-summary-save-article-file
2241 ,@(if (featurep 'xemacs) '(t)
2242 '(:help "Save article in file"))]
2243 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2244 ["Save in MH folder..." gnus-summary-save-article-folder t]
2245 ["Save in VM folder..." gnus-summary-save-article-vm t]
2246 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2247 ["Save body in file..." gnus-summary-save-article-body-file t]
2248 ["Pipe through a filter..." gnus-summary-pipe-output t]
2249 ["Add to SOUP packet" gnus-soup-add-article t]
2250 ["Print with Muttprint..." gnus-summary-muttprint t]
2251 ["Print" gnus-summary-print-article
2252 ,@(if (featurep 'xemacs) '(t)
2253 '(:help "Generate and print a PostScript image"))])
2254 ("Copy, move,... (Backend)"
2255 ,@(if (featurep 'xemacs) nil
2256 '(:help "Copying, moving, expiring articles..."))
2257 ["Respool article..." gnus-summary-respool-article t]
2258 ["Move article..." gnus-summary-move-article
2259 (gnus-check-backend-function
2260 'request-move-article gnus-newsgroup-name)]
2261 ["Copy article..." gnus-summary-copy-article t]
2262 ["Crosspost article..." gnus-summary-crosspost-article
2263 (gnus-check-backend-function
2264 'request-replace-article gnus-newsgroup-name)]
2265 ["Import file..." gnus-summary-import-article
2266 (gnus-check-backend-function
2267 'request-accept-article gnus-newsgroup-name)]
2268 ["Create article..." gnus-summary-create-article
2269 (gnus-check-backend-function
2270 'request-accept-article gnus-newsgroup-name)]
2271 ["Check if posted" gnus-summary-article-posted-p t]
2272 ["Edit article" gnus-summary-edit-article
2273 (not (gnus-group-read-only-p))]
2274 ["Delete article" gnus-summary-delete-article
2275 (gnus-check-backend-function
2276 'request-expire-articles gnus-newsgroup-name)]
2277 ["Query respool" gnus-summary-respool-query t]
2278 ["Trace respool" gnus-summary-respool-trace t]
2279 ["Delete expirable articles" gnus-summary-expire-articles-now
2280 (gnus-check-backend-function
2281 'request-expire-articles gnus-newsgroup-name)])
2283 ["Uudecode" gnus-uu-decode-uu
2284 ,@(if (featurep 'xemacs) '(t)
2285 '(:help "Decode uuencoded article(s)"))]
2286 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2287 ["Unshar" gnus-uu-decode-unshar t]
2288 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2289 ["Save" gnus-uu-decode-save t]
2290 ["Binhex" gnus-uu-decode-binhex t]
2291 ["Postscript" gnus-uu-decode-postscript t]
2292 ["All MIME parts" gnus-summary-save-parts t])
2294 ["Enter article" gnus-cache-enter-article t]
2295 ["Remove article" gnus-cache-remove-article t])
2296 ["Translate" gnus-article-babel t]
2297 ["Select article buffer" gnus-summary-select-article-buffer t]
2298 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2299 ["Isearch article..." gnus-summary-isearch-article t]
2300 ["Beginning of the article" gnus-summary-beginning-of-article t]
2301 ["End of the article" gnus-summary-end-of-article t]
2302 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2303 ["Fetch referenced articles" gnus-summary-refer-references t]
2304 ["Fetch current thread" gnus-summary-refer-thread t]
2305 ["Fetch article with id..." gnus-summary-refer-article t]
2306 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2307 ["Redisplay" gnus-summary-show-article t]
2308 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2310 gnus-summary-article-menu gnus-summary-mode-map ""
2311 (cons "Article" innards))
2313 (if (not (keymapp gnus-summary-article-menu))
2315 gnus-article-commands-menu gnus-article-mode-map ""
2316 (cons "Commands" innards))
2317 ;; in Emacs, don't share menu.
2318 (setq gnus-article-commands-menu
2319 (copy-keymap gnus-summary-article-menu))
2320 (define-key gnus-article-mode-map [menu-bar commands]
2321 (cons "Commands" gnus-article-commands-menu))))
2324 gnus-summary-thread-menu gnus-summary-mode-map ""
2326 ["Find all messages in thread" gnus-summary-refer-thread t]
2327 ["Toggle threading" gnus-summary-toggle-threads t]
2328 ["Hide threads" gnus-summary-hide-all-threads t]
2329 ["Show threads" gnus-summary-show-all-threads t]
2330 ["Hide thread" gnus-summary-hide-thread t]
2331 ["Show thread" gnus-summary-show-thread t]
2332 ["Go to next thread" gnus-summary-next-thread t]
2333 ["Go to previous thread" gnus-summary-prev-thread t]
2334 ["Go down thread" gnus-summary-down-thread t]
2335 ["Go up thread" gnus-summary-up-thread t]
2336 ["Top of thread" gnus-summary-top-thread t]
2337 ["Mark thread as read" gnus-summary-kill-thread t]
2338 ["Lower thread score" gnus-summary-lower-thread t]
2339 ["Raise thread score" gnus-summary-raise-thread t]
2340 ["Rethread current" gnus-summary-rethread-current t]))
2343 gnus-summary-post-menu gnus-summary-mode-map ""
2345 ["Send a message (mail or news)" gnus-summary-post-news
2346 ,@(if (featurep 'xemacs) '(t)
2347 '(:help "Compose a new message (mail or news)"))]
2348 ["Followup" gnus-summary-followup
2349 ,@(if (featurep 'xemacs) '(t)
2350 '(:help "Post followup to this article"))]
2351 ["Followup and yank" gnus-summary-followup-with-original
2352 ,@(if (featurep 'xemacs) '(t)
2353 '(:help "Post followup to this article, quoting its contents"))]
2354 ["Supersede article" gnus-summary-supersede-article t]
2355 ["Cancel article" gnus-summary-cancel-article
2356 ,@(if (featurep 'xemacs) '(t)
2357 '(:help "Cancel an article you posted"))]
2358 ["Reply" gnus-summary-reply t]
2359 ["Reply and yank" gnus-summary-reply-with-original t]
2360 ["Wide reply" gnus-summary-wide-reply t]
2361 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2362 ,@(if (featurep 'xemacs) '(t)
2363 '(:help "Mail a reply, quoting this article"))]
2364 ["Very wide reply" gnus-summary-very-wide-reply t]
2365 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2366 ,@(if (featurep 'xemacs) '(t)
2367 '(:help "Mail a very wide reply, quoting this article"))]
2368 ["Mail forward" gnus-summary-mail-forward t]
2369 ["Post forward" gnus-summary-post-forward t]
2370 ["Digest and mail" gnus-uu-digest-mail-forward t]
2371 ["Digest and post" gnus-uu-digest-post-forward t]
2372 ["Resend message" gnus-summary-resend-message t]
2373 ["Resend message edit" gnus-summary-resend-message-edit t]
2374 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2375 ["Send a mail" gnus-summary-mail-other-window t]
2376 ["Create a local message" gnus-summary-news-other-window t]
2377 ["Uuencode and post" gnus-uu-post-news
2378 ,@(if (featurep 'xemacs) '(t)
2379 '(:help "Post a uuencoded article"))]
2380 ["Followup via news" gnus-summary-followup-to-mail t]
2381 ["Followup via news and yank"
2382 gnus-summary-followup-to-mail-with-original t]
2384 ;;["Send" gnus-summary-send-draft t]
2385 ;;["Send bounced" gnus-resend-bounced-mail t])
2389 ((not (keymapp gnus-summary-post-menu))
2390 (setq gnus-article-post-menu gnus-summary-post-menu))
2391 ((not gnus-article-post-menu)
2392 ;; Don't share post menu.
2393 (setq gnus-article-post-menu
2394 (copy-keymap gnus-summary-post-menu))))
2395 (define-key gnus-article-mode-map [menu-bar post]
2396 (cons "Post" gnus-article-post-menu))
2399 gnus-summary-misc-menu gnus-summary-mode-map ""
2402 ["Mark as read" gnus-summary-mark-as-read-forward t]
2403 ["Mark same subject and select"
2404 gnus-summary-kill-same-subject-and-select t]
2405 ["Mark same subject" gnus-summary-kill-same-subject t]
2406 ["Catchup" gnus-summary-catchup
2407 ,@(if (featurep 'xemacs) '(t)
2408 '(:help "Mark unread articles in this group as read"))]
2409 ["Catchup all" gnus-summary-catchup-all t]
2410 ["Catchup to here" gnus-summary-catchup-to-here t]
2411 ["Catchup from here" gnus-summary-catchup-from-here t]
2412 ["Catchup region" gnus-summary-mark-region-as-read
2413 (gnus-mark-active-p)]
2414 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2416 ["Tick" gnus-summary-tick-article-forward t]
2417 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2418 ["Remove marks" gnus-summary-clear-mark-forward t]
2419 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2420 ["Set bookmark" gnus-summary-set-bookmark t]
2421 ["Remove bookmark" gnus-summary-remove-bookmark t])
2423 ["Marks..." gnus-summary-limit-to-marks t]
2424 ["Subject..." gnus-summary-limit-to-subject t]
2425 ["Author..." gnus-summary-limit-to-author t]
2426 ["Age..." gnus-summary-limit-to-age t]
2427 ["Extra..." gnus-summary-limit-to-extra t]
2428 ["Score..." gnus-summary-limit-to-score t]
2429 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2430 ["Unread" gnus-summary-limit-to-unread t]
2431 ["Unseen" gnus-summary-limit-to-unseen t]
2432 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2433 ["Next articles" gnus-summary-limit-to-articles t]
2434 ["Pop limit" gnus-summary-pop-limit t]
2435 ["Show dormant" gnus-summary-limit-include-dormant t]
2436 ["Hide childless dormant"
2437 gnus-summary-limit-exclude-childless-dormant t]
2438 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2439 ["Hide marked" gnus-summary-limit-exclude-marks t]
2440 ["Show expunged" gnus-summary-limit-include-expunged t])
2442 ["Set mark" gnus-summary-mark-as-processable t]
2443 ["Remove mark" gnus-summary-unmark-as-processable t]
2444 ["Remove all marks" gnus-summary-unmark-all-processable t]
2445 ["Mark above" gnus-uu-mark-over t]
2446 ["Mark series" gnus-uu-mark-series t]
2447 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2448 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2449 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2450 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2451 ["Mark all" gnus-uu-mark-all t]
2452 ["Mark buffer" gnus-uu-mark-buffer t]
2453 ["Mark sparse" gnus-uu-mark-sparse t]
2454 ["Mark thread" gnus-uu-mark-thread t]
2455 ["Unmark thread" gnus-uu-unmark-thread t]
2456 ("Process Mark Sets"
2457 ["Kill" gnus-summary-kill-process-mark t]
2458 ["Yank" gnus-summary-yank-process-mark
2459 gnus-newsgroup-process-stack]
2460 ["Save" gnus-summary-save-process-mark t]
2461 ["Run command on marked..." gnus-summary-universal-argument t]))
2463 ["Page forward" gnus-summary-next-page
2464 ,@(if (featurep 'xemacs) '(t)
2465 '(:help "Show next page of article"))]
2466 ["Page backward" gnus-summary-prev-page
2467 ,@(if (featurep 'xemacs) '(t)
2468 '(:help "Show previous page of article"))]
2469 ["Line forward" gnus-summary-scroll-up t])
2471 ["Next unread article" gnus-summary-next-unread-article t]
2472 ["Previous unread article" gnus-summary-prev-unread-article t]
2473 ["Next article" gnus-summary-next-article t]
2474 ["Previous article" gnus-summary-prev-article t]
2475 ["Next unread subject" gnus-summary-next-unread-subject t]
2476 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2477 ["Next article same subject" gnus-summary-next-same-subject t]
2478 ["Previous article same subject" gnus-summary-prev-same-subject t]
2479 ["First unread article" gnus-summary-first-unread-article t]
2480 ["Best unread article" gnus-summary-best-unread-article t]
2481 ["Go to subject number..." gnus-summary-goto-subject t]
2482 ["Go to article number..." gnus-summary-goto-article t]
2483 ["Go to the last article" gnus-summary-goto-last-article t]
2484 ["Pop article off history" gnus-summary-pop-article t])
2486 ["Sort by number" gnus-summary-sort-by-number t]
2487 ["Sort by author" gnus-summary-sort-by-author t]
2488 ["Sort by subject" gnus-summary-sort-by-subject t]
2489 ["Sort by date" gnus-summary-sort-by-date t]
2490 ["Sort by score" gnus-summary-sort-by-score t]
2491 ["Sort by lines" gnus-summary-sort-by-lines t]
2492 ["Sort by characters" gnus-summary-sort-by-chars t]
2493 ["Randomize" gnus-summary-sort-by-random t]
2494 ["Original sort" gnus-summary-sort-by-original t])
2496 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2497 ["Describe group" gnus-summary-describe-group t]
2498 ["Fetch charter" gnus-group-fetch-charter
2499 ,@(if (featurep 'xemacs) nil
2500 '(:help "Display the charter of the current group"))]
2501 ["Fetch control message" gnus-group-fetch-control
2502 ,@(if (featurep 'xemacs) nil
2503 '(:help "Display the archived control message for the current group"))]
2504 ["Read manual" gnus-info-find-node t])
2506 ["Pick and read" gnus-pick-mode t]
2507 ["Binary" gnus-binary-mode t])
2509 ["Regenerate" gnus-summary-prepare t]
2510 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2511 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2512 ["Toggle threading" gnus-summary-toggle-threads t])
2513 ["See old articles" gnus-summary-insert-old-articles t]
2514 ["See new articles" gnus-summary-insert-new-articles t]
2515 ["Filter articles..." gnus-summary-execute-command t]
2516 ["Run command on articles..." gnus-summary-universal-argument t]
2517 ["Search articles forward..." gnus-summary-search-article-forward t]
2518 ["Search articles backward..." gnus-summary-search-article-backward t]
2519 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2520 ["Expand window" gnus-summary-expand-window t]
2521 ["Expire expirable articles" gnus-summary-expire-articles
2522 (gnus-check-backend-function
2523 'request-expire-articles gnus-newsgroup-name)]
2524 ["Edit local kill file" gnus-summary-edit-local-kill t]
2525 ["Edit main kill file" gnus-summary-edit-global-kill t]
2526 ["Edit group parameters" gnus-summary-edit-parameters t]
2527 ["Customize group parameters" gnus-summary-customize-parameters t]
2528 ["Send a bug report" gnus-bug t]
2530 ["Catchup and exit" gnus-summary-catchup-and-exit
2531 ,@(if (featurep 'xemacs) '(t)
2532 '(:help "Mark unread articles in this group as read, then exit"))]
2533 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2534 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2535 ["Exit group" gnus-summary-exit
2536 ,@(if (featurep 'xemacs) '(t)
2537 '(:help "Exit current group, return to group selection mode"))]
2538 ["Exit group without updating" gnus-summary-exit-no-update t]
2539 ["Exit and goto next group" gnus-summary-next-group t]
2540 ["Exit and goto prev group" gnus-summary-prev-group t]
2541 ["Reselect group" gnus-summary-reselect-current-group t]
2542 ["Rescan group" gnus-summary-rescan-group t]
2543 ["Update dribble" gnus-summary-save-newsrc t])))
2545 (gnus-run-hooks 'gnus-summary-menu-hook)))
2547 (defvar gnus-summary-tool-bar-map nil)
2549 ;; Emacs 21 tool bar. Should be no-op otherwise.
2550 (defun gnus-summary-make-tool-bar ()
2551 (if (and (fboundp 'tool-bar-add-item-from-menu)
2552 (default-value 'tool-bar-mode)
2553 (not gnus-summary-tool-bar-map))
2554 (setq gnus-summary-tool-bar-map
2555 (let ((tool-bar-map (make-sparse-keymap))
2556 (load-path (mm-image-load-path)))
2557 (tool-bar-add-item-from-menu
2558 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2559 (tool-bar-add-item-from-menu
2560 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2561 (tool-bar-add-item-from-menu
2562 'gnus-summary-post-news "post" gnus-summary-mode-map)
2563 (tool-bar-add-item-from-menu
2564 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2565 (tool-bar-add-item-from-menu
2566 'gnus-summary-followup "followup" gnus-summary-mode-map)
2567 (tool-bar-add-item-from-menu
2568 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2569 (tool-bar-add-item-from-menu
2570 'gnus-summary-reply "reply" gnus-summary-mode-map)
2571 (tool-bar-add-item-from-menu
2572 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2573 (tool-bar-add-item-from-menu
2574 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2575 (tool-bar-add-item-from-menu
2576 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2577 (tool-bar-add-item-from-menu
2578 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2579 (tool-bar-add-item-from-menu
2580 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2581 (tool-bar-add-item-from-menu
2582 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2583 (tool-bar-add-item-from-menu
2584 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2585 (tool-bar-add-item-from-menu
2586 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2588 (if gnus-summary-tool-bar-map
2589 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2591 (defun gnus-score-set-default (var value)
2592 "A version of set that updates the GNU Emacs menu-bar."
2594 ;; It is the message that forces the active status to be updated.
2597 (defun gnus-make-score-map (type)
2598 "Make a summary score map of type TYPE."
2601 (let ((headers '(("author" "from" string)
2602 ("subject" "subject" string)
2603 ("article body" "body" string)
2604 ("article head" "head" string)
2605 ("xref" "xref" string)
2606 ("extra header" "extra" string)
2607 ("lines" "lines" number)
2608 ("followups to author" "followup" string)))
2609 (types '((number ("less than" <)
2612 (string ("substring" s)
2616 (perms '(("temporary" (current-time-string))
2624 (if (eq type 'lower)
2629 (setq header (car headers))
2635 (let ((ts (cdr (assoc (nth 2 header) types)))
2651 'gnus-summary-score-entry
2653 (if (or (string= (nth 1 header)
2655 (string= (nth 1 header)
2658 (list 'gnus-summary-header
2660 (list 'quote (nth 1 (car ts)))
2661 (list 'gnus-score-delta-default
2668 (list (nreverse outp))))
2671 (list (nreverse outt))))
2673 (setq headers (cdr headers)))
2674 (list (nreverse outh))))))))
2678 (defun gnus-summary-mode (&optional group)
2679 "Major mode for reading articles.
2681 All normal editing commands are switched off.
2682 \\<gnus-summary-mode-map>
2683 Each line in this buffer represents one article. To read an
2684 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2685 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2688 You can also post articles and send mail from this buffer. To
2689 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2690 of an article, type `\\[gnus-summary-reply]'.
2692 There are approx. one gazillion commands you can execute in this
2693 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2695 The following commands are available:
2697 \\{gnus-summary-mode-map}"
2699 (kill-all-local-variables)
2700 (when (gnus-visual-p 'summary-menu 'menu)
2701 (gnus-summary-make-menu-bar)
2702 (gnus-summary-make-tool-bar))
2703 (gnus-summary-make-local-variables)
2704 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2705 (gnus-summary-make-local-variables))
2706 (gnus-make-thread-indent-array)
2707 (gnus-simplify-mode-line)
2708 (setq major-mode 'gnus-summary-mode)
2709 (setq mode-name "Summary")
2710 (make-local-variable 'minor-mode-alist)
2711 (use-local-map gnus-summary-mode-map)
2712 (buffer-disable-undo)
2713 (setq buffer-read-only t) ;Disable modification
2714 (setq truncate-lines t)
2715 (setq selective-display t)
2716 (setq selective-display-ellipses t) ;Display `...'
2717 (gnus-summary-set-display-table)
2718 (gnus-set-default-directory)
2719 (setq gnus-newsgroup-name group)
2720 (make-local-variable 'gnus-summary-line-format)
2721 (make-local-variable 'gnus-summary-line-format-spec)
2722 (make-local-variable 'gnus-summary-dummy-line-format)
2723 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2724 (make-local-variable 'gnus-summary-mark-positions)
2725 (gnus-make-local-hook 'pre-command-hook)
2726 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2727 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2728 (turn-on-gnus-mailing-list-mode)
2729 (mm-enable-multibyte)
2730 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2731 (gnus-update-summary-mark-positions))
2733 (defun gnus-summary-make-local-variables ()
2734 "Make all the local summary buffer variables."
2736 (dolist (local gnus-summary-local-variables)
2739 (if (eq (cdr local) 'global)
2740 ;; Copy the global value of the variable.
2741 (setq global (symbol-value (car local)))
2742 ;; Use the value from the list.
2743 (setq global (eval (cdr local))))
2744 (set (make-local-variable (car local)) global))
2745 ;; Simple nil-valued local variable.
2746 (set (make-local-variable local) nil)))))
2748 (defun gnus-summary-clear-local-variables ()
2749 (let ((locals gnus-summary-local-variables))
2751 (if (consp (car locals))
2752 (and (vectorp (caar locals))
2753 (set (caar locals) nil))
2754 (and (vectorp (car locals))
2755 (set (car locals) nil)))
2756 (setq locals (cdr locals)))))
2758 ;; Summary data functions.
2760 (defmacro gnus-data-number (data)
2763 (defmacro gnus-data-set-number (data number)
2764 `(setcar ,data ,number))
2766 (defmacro gnus-data-mark (data)
2769 (defmacro gnus-data-set-mark (data mark)
2770 `(setcar (nthcdr 1 ,data) ,mark))
2772 (defmacro gnus-data-pos (data)
2775 (defmacro gnus-data-set-pos (data pos)
2776 `(setcar (nthcdr 2 ,data) ,pos))
2778 (defmacro gnus-data-header (data)
2781 (defmacro gnus-data-set-header (data header)
2782 `(setf (nth 3 ,data) ,header))
2784 (defmacro gnus-data-level (data)
2787 (defmacro gnus-data-unread-p (data)
2788 `(= (nth 1 ,data) gnus-unread-mark))
2790 (defmacro gnus-data-read-p (data)
2791 `(/= (nth 1 ,data) gnus-unread-mark))
2793 (defmacro gnus-data-pseudo-p (data)
2794 `(consp (nth 3 ,data)))
2796 (defmacro gnus-data-find (number)
2797 `(assq ,number gnus-newsgroup-data))
2799 (defmacro gnus-data-find-list (number &optional data)
2800 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2801 (memq (assq ,number bdata)
2804 (defmacro gnus-data-make (number mark pos header level)
2805 `(list ,number ,mark ,pos ,header ,level))
2807 (defun gnus-data-enter (after-article number mark pos header level offset)
2808 (let ((data (gnus-data-find-list after-article)))
2810 (error "No such article: %d" after-article))
2811 (setcdr data (cons (gnus-data-make number mark pos header level)
2813 (setq gnus-newsgroup-data-reverse nil)
2814 (gnus-data-update-list (cddr data) offset)))
2816 (defun gnus-data-enter-list (after-article list &optional offset)
2818 (let ((data (and after-article (gnus-data-find-list after-article)))
2822 (let ((odata gnus-newsgroup-data))
2823 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2825 (gnus-data-update-list odata offset)))
2826 ;; Find the last element in the list to be spliced into the main
2829 (setq list (cdr list)))
2832 (setcdr list gnus-newsgroup-data)
2833 (setq gnus-newsgroup-data ilist)
2835 (gnus-data-update-list (cdr list) offset)))
2836 (setcdr list (cdr data))
2839 (gnus-data-update-list (cdr list) offset))))
2840 (setq gnus-newsgroup-data-reverse nil))))
2842 (defun gnus-data-remove (article &optional offset)
2843 (let ((data gnus-newsgroup-data))
2844 (if (= (gnus-data-number (car data)) article)
2846 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2847 gnus-newsgroup-data-reverse nil)
2849 (gnus-data-update-list gnus-newsgroup-data offset)))
2851 (when (= (gnus-data-number (cadr data)) article)
2852 (setcdr data (cddr data))
2854 (gnus-data-update-list (cdr data) offset))
2856 gnus-newsgroup-data-reverse nil))
2857 (setq data (cdr data))))))
2859 (defmacro gnus-data-list (backward)
2861 (or gnus-newsgroup-data-reverse
2862 (setq gnus-newsgroup-data-reverse
2863 (reverse gnus-newsgroup-data)))
2864 gnus-newsgroup-data))
2866 (defun gnus-data-update-list (data offset)
2867 "Add OFFSET to the POS of all data entries in DATA."
2868 (setq gnus-newsgroup-data-reverse nil)
2870 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2871 (setq data (cdr data))))
2873 (defun gnus-summary-article-pseudo-p (article)
2874 "Say whether this article is a pseudo article or not."
2875 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2877 (defmacro gnus-summary-article-sparse-p (article)
2878 "Say whether this article is a sparse article or not."
2879 `(memq ,article gnus-newsgroup-sparse))
2881 (defmacro gnus-summary-article-ancient-p (article)
2882 "Say whether this article is a sparse article or not."
2883 `(memq ,article gnus-newsgroup-ancient))
2885 (defun gnus-article-parent-p (number)
2886 "Say whether this article is a parent or not."
2887 (let ((data (gnus-data-find-list number)))
2888 (and (cdr data) ; There has to be an article after...
2889 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2890 (gnus-data-level (nth 1 data))))))
2892 (defun gnus-article-children (number)
2893 "Return a list of all children to NUMBER."
2894 (let* ((data (gnus-data-find-list number))
2895 (level (gnus-data-level (car data)))
2897 (setq data (cdr data))
2899 (= (gnus-data-level (car data)) (1+ level)))
2900 (push (gnus-data-number (car data)) children)
2901 (setq data (cdr data)))
2904 (defmacro gnus-summary-skip-intangible ()
2905 "If the current article is intangible, then jump to a different article."
2906 '(let ((to (get-text-property (point) 'gnus-intangible)))
2907 (and to (gnus-summary-goto-subject to))))
2909 (defmacro gnus-summary-article-intangible-p ()
2910 "Say whether this article is intangible or not."
2911 '(get-text-property (point) 'gnus-intangible))
2913 (defun gnus-article-read-p (article)
2914 "Say whether ARTICLE is read or not."
2915 (not (or (memq article gnus-newsgroup-marked)
2916 (memq article gnus-newsgroup-spam-marked)
2917 (memq article gnus-newsgroup-unreads)
2918 (memq article gnus-newsgroup-unselected)
2919 (memq article gnus-newsgroup-dormant))))
2921 ;; Some summary mode macros.
2923 (defmacro gnus-summary-article-number ()
2924 "The article number of the article on the current line.
2925 If there isn't an article number here, then we return the current
2928 (gnus-summary-skip-intangible)
2929 (or (get-text-property (point) 'gnus-number)
2930 (gnus-summary-last-subject))))
2932 (defmacro gnus-summary-article-header (&optional number)
2933 "Return the header of article NUMBER."
2934 `(gnus-data-header (gnus-data-find
2935 ,(or number '(gnus-summary-article-number)))))
2937 (defmacro gnus-summary-thread-level (&optional number)
2938 "Return the level of thread that starts with article NUMBER."
2939 `(if (and (eq gnus-summary-make-false-root 'dummy)
2940 (get-text-property (point) 'gnus-intangible))
2942 (gnus-data-level (gnus-data-find
2943 ,(or number '(gnus-summary-article-number))))))
2945 (defmacro gnus-summary-article-mark (&optional number)
2946 "Return the mark of article NUMBER."
2947 `(gnus-data-mark (gnus-data-find
2948 ,(or number '(gnus-summary-article-number)))))
2950 (defmacro gnus-summary-article-pos (&optional number)
2951 "Return the position of the line of article NUMBER."
2952 `(gnus-data-pos (gnus-data-find
2953 ,(or number '(gnus-summary-article-number)))))
2955 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2956 (defmacro gnus-summary-article-subject (&optional number)
2957 "Return current subject string or nil if nothing."
2960 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2961 '(gnus-data-header (assq (gnus-summary-article-number)
2962 gnus-newsgroup-data)))))
2965 (mail-header-subject headers))))
2967 (defmacro gnus-summary-article-score (&optional number)
2968 "Return current article score."
2969 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2970 gnus-newsgroup-scored))
2971 gnus-summary-default-score 0))
2973 (defun gnus-summary-article-children (&optional number)
2974 "Return a list of article numbers that are children of article NUMBER."
2975 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2976 (level (gnus-data-level (car data)))
2978 (while (and (setq data (cdr data))
2979 (> (setq l (gnus-data-level (car data))) level))
2980 (and (= (1+ level) l)
2981 (push (gnus-data-number (car data))
2983 (nreverse children)))
2985 (defun gnus-summary-article-parent (&optional number)
2986 "Return the article number of the parent of article NUMBER."
2987 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2988 (gnus-data-list t)))
2989 (level (gnus-data-level (car data))))
2991 () ; This is a root.
2992 ;; We search until we find an article with a level less than
2993 ;; this one. That function has to be the parent.
2994 (while (and (setq data (cdr data))
2995 (not (< (gnus-data-level (car data)) level))))
2996 (and data (gnus-data-number (car data))))))
2998 (defun gnus-unread-mark-p (mark)
2999 "Say whether MARK is the unread mark."
3000 (= mark gnus-unread-mark))
3002 (defun gnus-read-mark-p (mark)
3003 "Say whether MARK is one of the marks that mark as read.
3004 This is all marks except unread, ticked, dormant, and expirable."
3005 (not (or (= mark gnus-unread-mark)
3006 (= mark gnus-ticked-mark)
3007 (= mark gnus-spam-mark)
3008 (= mark gnus-dormant-mark)
3009 (= mark gnus-expirable-mark))))
3011 (defmacro gnus-article-mark (number)
3012 "Return the MARK of article NUMBER.
3013 This macro should only be used when computing the mark the \"first\"
3014 time; i.e., when generating the summary lines. After that,
3015 `gnus-summary-article-mark' should be used to examine the
3018 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3019 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3020 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3021 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3022 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3023 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3024 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3025 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3026 gnus-ancient-mark))))
3028 ;; Saving hidden threads.
3030 (defmacro gnus-save-hidden-threads (&rest forms)
3031 "Save hidden threads, eval FORMS, and restore the hidden threads."
3032 (let ((config (make-symbol "config")))
3033 `(let ((,config (gnus-hidden-threads-configuration)))
3037 (gnus-restore-hidden-threads-configuration ,config)))))
3038 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3039 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3041 (defun gnus-data-compute-positions ()
3042 "Compute the positions of all articles."
3043 (setq gnus-newsgroup-data-reverse nil)
3044 (let ((data gnus-newsgroup-data))
3046 (gnus-save-hidden-threads
3047 (gnus-summary-show-all-threads)
3048 (goto-char (point-min))
3050 (while (get-text-property (point) 'gnus-intangible)
3052 (gnus-data-set-pos (car data) (+ (point) 3))
3053 (setq data (cdr data))
3054 (forward-line 1))))))
3056 (defun gnus-hidden-threads-configuration ()
3057 "Return the current hidden threads configuration."
3060 (goto-char (point-min))
3061 (while (search-forward "\r" nil t)
3062 (push (1- (point)) config))
3065 (defun gnus-restore-hidden-threads-configuration (config)
3066 "Restore hidden threads configuration from CONFIG."
3068 (let (point buffer-read-only)
3069 (while (setq point (pop config))
3070 (when (and (< point (point-max))
3072 (eq (char-after) ?\n))
3073 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3075 ;; Various summary mode internalish functions.
3077 (defun gnus-mouse-pick-article (e)
3080 (gnus-summary-next-page nil t))
3082 (defun gnus-summary-set-display-table ()
3083 "Change the display table.
3084 Odd characters have a tendency to mess
3085 up nicely formatted displays - we make all possible glyphs
3086 display only a single character."
3088 ;; We start from the standard display table, if any.
3089 (let ((table (or (copy-sequence standard-display-table)
3090 (make-display-table)))
3092 ;; Nix out all the control chars...
3093 (while (>= (setq i (1- i)) 0)
3094 (aset table i [??]))
3095 ;; ... but not newline and cr, of course. (cr is necessary for the
3096 ;; selective display).
3097 (aset table ?\n nil)
3098 (aset table ?\r nil)
3099 ;; We keep TAB as well.
3100 (aset table ?\t nil)
3101 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3102 ;; Emacs 23 (unicode), that are not set already.
3103 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3106 (while (>= (setq i (1- i)) 127)
3107 ;; Only modify if the entry is nil.
3108 (unless (aref table i)
3109 (aset table i [??]))))
3110 (setq buffer-display-table table)))
3112 (defun gnus-summary-set-article-display-arrow (pos)
3113 "Update the overlay arrow to point to line at position POS."
3114 (when (and gnus-summary-display-arrow
3115 (boundp 'overlay-arrow-position)
3116 (boundp 'overlay-arrow-string))
3120 (unless overlay-arrow-position
3121 (setq overlay-arrow-position (make-marker)))
3122 (setq overlay-arrow-string "=>"
3123 overlay-arrow-position (set-marker overlay-arrow-position
3125 (current-buffer))))))
3127 (defun gnus-summary-setup-buffer (group)
3128 "Initialize summary buffer."
3129 (let ((buffer (gnus-summary-buffer-name group))
3130 (dead-name (concat "*Dead Summary "
3131 (gnus-group-decoded-name group) "*")))
3132 ;; If a dead summary buffer exists, we kill it.
3133 (when (gnus-buffer-live-p dead-name)
3134 (gnus-kill-buffer dead-name))
3135 (if (get-buffer buffer)
3138 (setq gnus-summary-buffer (current-buffer))
3139 (not gnus-newsgroup-prepared))
3140 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3141 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3142 (gnus-summary-mode group)
3144 (gnus-carpal-setup-buffer 'summary))
3145 (unless gnus-single-article-buffer
3146 (make-local-variable 'gnus-article-buffer)
3147 (make-local-variable 'gnus-article-current)
3148 (make-local-variable 'gnus-original-article-buffer))
3149 (setq gnus-newsgroup-name group)
3150 ;; Set any local variables in the group parameters.
3151 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3154 (defun gnus-set-global-variables ()
3155 "Set the global equivalents of the buffer-local variables.
3156 They are set to the latest values they had. These reflect the summary
3157 buffer that was in action when the last article was fetched."
3158 (when (eq major-mode 'gnus-summary-mode)
3159 (setq gnus-summary-buffer (current-buffer))
3160 (let ((name gnus-newsgroup-name)
3161 (marked gnus-newsgroup-marked)
3162 (spam gnus-newsgroup-spam-marked)
3163 (unread gnus-newsgroup-unreads)
3164 (headers gnus-current-headers)
3165 (data gnus-newsgroup-data)
3166 (summary gnus-summary-buffer)
3167 (article-buffer gnus-article-buffer)
3168 (original gnus-original-article-buffer)
3169 (gac gnus-article-current)
3170 (reffed gnus-reffed-article-number)
3171 (score-file gnus-current-score-file)
3172 (default-charset gnus-newsgroup-charset)
3174 (let ((locals gnus-newsgroup-variables))
3176 (if (consp (car locals))
3177 (push (eval (caar locals)) vlist)
3178 (push (eval (car locals)) vlist))
3179 (setq locals (cdr locals)))
3180 (setq vlist (nreverse vlist)))
3182 (set-buffer gnus-group-buffer)
3183 (setq gnus-newsgroup-name name
3184 gnus-newsgroup-marked marked
3185 gnus-newsgroup-spam-marked spam
3186 gnus-newsgroup-unreads unread
3187 gnus-current-headers headers
3188 gnus-newsgroup-data data
3189 gnus-article-current gac
3190 gnus-summary-buffer summary
3191 gnus-article-buffer article-buffer
3192 gnus-original-article-buffer original
3193 gnus-reffed-article-number reffed
3194 gnus-current-score-file score-file
3195 gnus-newsgroup-charset default-charset)
3196 (let ((locals gnus-newsgroup-variables))
3198 (if (consp (car locals))
3199 (set (caar locals) (pop vlist))
3200 (set (car locals) (pop vlist)))
3201 (setq locals (cdr locals))))
3202 ;; The article buffer also has local variables.
3203 (when (gnus-buffer-live-p gnus-article-buffer)
3204 (set-buffer gnus-article-buffer)
3205 (setq gnus-summary-buffer summary))))))
3207 (defun gnus-summary-article-unread-p (article)
3208 "Say whether ARTICLE is unread or not."
3209 (memq article gnus-newsgroup-unreads))
3211 (defun gnus-summary-first-article-p (&optional article)
3212 "Return whether ARTICLE is the first article in the buffer."
3213 (if (not (setq article (or article (gnus-summary-article-number))))
3215 (eq article (caar gnus-newsgroup-data))))
3217 (defun gnus-summary-last-article-p (&optional article)
3218 "Return whether ARTICLE is the last article in the buffer."
3219 (if (not (setq article (or article (gnus-summary-article-number))))
3220 ;; All non-existent numbers are the last article. :-)
3222 (not (cdr (gnus-data-find-list article)))))
3224 (defun gnus-make-thread-indent-array ()
3226 (unless (and gnus-thread-indent-array
3227 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3228 (setq gnus-thread-indent-array (make-vector 201 "")
3229 gnus-thread-indent-array-level gnus-thread-indent-level)
3231 (aset gnus-thread-indent-array n
3232 (make-string (* n gnus-thread-indent-level) ? ))
3235 (defun gnus-update-summary-mark-positions ()
3236 "Compute where the summary marks are to go."
3238 (when (gnus-buffer-exists-p gnus-summary-buffer)
3239 (set-buffer gnus-summary-buffer))
3240 (let ((spec gnus-summary-line-format-spec)
3243 (gnus-set-work-buffer)
3244 (let ((gnus-tmp-unread ?Z)
3245 (gnus-replied-mark ?Z)
3246 (gnus-score-below-mark ?Z)
3247 (gnus-score-over-mark ?Z)
3248 (gnus-undownloaded-mark ?Z)
3249 (gnus-summary-line-format-spec spec)
3250 (gnus-newsgroup-downloadable '(0))
3251 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3252 case-fold-search ignores)
3253 ;; Here, all marks are bound to Z.
3254 (gnus-summary-insert-line header
3255 0 nil t gnus-tmp-unread t nil "" nil 1)
3256 (goto-char (point-min))
3257 ;; Memorize the positions of the same characters as dummy marks.
3258 (while (re-search-forward "[A-D]" nil t)
3259 (push (point) ignores))
3261 ;; We use A-D as dummy marks in order to know column positions
3262 ;; where marks should be inserted.
3263 (setq gnus-tmp-unread ?A
3264 gnus-replied-mark ?B
3265 gnus-score-below-mark ?C
3266 gnus-score-over-mark ?C
3267 gnus-undownloaded-mark ?D)
3268 (gnus-summary-insert-line header
3269 0 nil t gnus-tmp-unread t nil "" nil 1)
3270 ;; Ignore characters which aren't dummy marks.
3272 (delete-region (goto-char (1- p)) p)
3274 (goto-char (point-min))
3275 (setq pos (list (cons 'unread
3276 (and (search-forward "A" nil t)
3277 (- (point) (point-min) 1)))))
3278 (goto-char (point-min))
3279 (push (cons 'replied (and (search-forward "B" nil t)
3280 (- (point) (point-min) 1)))
3282 (goto-char (point-min))
3283 (push (cons 'score (and (search-forward "C" nil t)
3284 (- (point) (point-min) 1)))
3286 (goto-char (point-min))
3287 (push (cons 'download (and (search-forward "D" nil t)
3288 (- (point) (point-min) 1)))
3290 (setq gnus-summary-mark-positions pos))))
3292 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3293 "Insert a dummy root in the summary buffer."
3295 (gnus-add-text-properties
3296 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3297 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3299 (defun gnus-summary-extract-address-component (from)
3300 (or (car (funcall gnus-extract-address-components from))
3303 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3304 (let ((mail-parse-charset gnus-newsgroup-charset)
3305 ; Is it really necessary to do this next part for each summary line?
3306 ; Luckily, doesn't seem to slow things down much.
3307 (mail-parse-ignored-charsets
3308 (save-excursion (set-buffer gnus-summary-buffer)
3309 gnus-newsgroup-ignored-charsets)))
3311 (and gnus-ignored-from-addresses
3312 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3313 (let ((extra-headers (mail-header-extra header))
3317 ((setq to (cdr (assq 'To extra-headers)))
3320 (gnus-summary-extract-address-component
3321 (funcall gnus-decode-encoded-word-function to)))))
3322 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3323 (concat "=> " newsgroups)))))
3324 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3326 (defun gnus-summary-insert-line (gnus-tmp-header
3327 gnus-tmp-level gnus-tmp-current
3328 undownloaded gnus-tmp-unread gnus-tmp-replied
3329 gnus-tmp-expirable gnus-tmp-subject-or-nil
3330 &optional gnus-tmp-dummy gnus-tmp-score
3332 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3333 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3334 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3335 (gnus-tmp-score-char
3336 (if (or (null gnus-summary-default-score)
3337 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3338 gnus-summary-zcore-fuzz))
3340 (if (< gnus-tmp-score gnus-summary-default-score)
3341 gnus-score-below-mark gnus-score-over-mark)))
3342 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3344 (cond (gnus-tmp-process gnus-process-mark)
3345 ((memq gnus-tmp-current gnus-newsgroup-cached)
3347 (gnus-tmp-replied gnus-replied-mark)
3348 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3349 gnus-forwarded-mark)
3350 ((memq gnus-tmp-current gnus-newsgroup-saved)
3352 ((memq gnus-tmp-number gnus-newsgroup-recent)
3354 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3357 (gnus-tmp-downloaded
3359 gnus-undownloaded-mark)
3360 (gnus-newsgroup-agentized
3361 gnus-downloaded-mark)
3364 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3367 ((string-match "<[^>]+> *$" gnus-tmp-from)
3368 (let ((beg (match-beginning 0)))
3369 (or (and (string-match "^\".+\"" gnus-tmp-from)
3370 (substring gnus-tmp-from 1 (1- (match-end 0))))
3371 (substring gnus-tmp-from 0 beg))))
3372 ((string-match "(.+)" gnus-tmp-from)
3373 (substring gnus-tmp-from
3374 (1+ (match-beginning 0)) (1- (match-end 0))))
3376 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3377 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3378 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3379 (buffer-read-only nil))
3380 (when (string= gnus-tmp-name "")
3381 (setq gnus-tmp-name gnus-tmp-from))
3382 (unless (numberp gnus-tmp-lines)
3383 (setq gnus-tmp-lines -1))
3384 (if (= gnus-tmp-lines -1)
3385 (setq gnus-tmp-lines "?")
3386 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3387 (gnus-put-text-property
3389 (progn (eval gnus-summary-line-format-spec) (point))
3390 'gnus-number gnus-tmp-number)
3391 (when (gnus-visual-p 'summary-highlight 'highlight)
3393 (gnus-run-hooks 'gnus-summary-update-hook)
3396 (defun gnus-summary-update-line (&optional dont-update)
3397 "Update summary line after change."
3398 (when (and gnus-summary-default-score
3399 (not gnus-summary-inhibit-highlight))
3400 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3401 (article (gnus-summary-article-number))
3402 (score (gnus-summary-article-score article)))
3404 (if (and gnus-summary-mark-below
3405 (< (gnus-summary-article-score)
3406 gnus-summary-mark-below))
3407 ;; This article has a low score, so we mark it as read.
3408 (when (memq article gnus-newsgroup-unreads)
3409 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3410 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3411 ;; This article was previously marked as read on account
3412 ;; of a low score, but now it has risen, so we mark it as
3414 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3415 (gnus-summary-update-mark
3416 (if (or (null gnus-summary-default-score)
3417 (<= (abs (- score gnus-summary-default-score))
3418 gnus-summary-zcore-fuzz))
3420 (if (< score gnus-summary-default-score)
3421 gnus-score-below-mark gnus-score-over-mark))
3423 ;; Do visual highlighting.
3424 (when (gnus-visual-p 'summary-highlight 'highlight)
3425 (gnus-run-hooks 'gnus-summary-update-hook)))))
3427 (defvar gnus-tmp-new-adopts nil)
3429 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3430 "Return the number of articles in THREAD.
3431 This may be 0 in some cases -- if none of the articles in
3432 the thread are to be displayed."
3434 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3436 ((not (listp thread))
3438 ((and (consp thread) (cdr thread))
3441 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3444 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3447 (when (and level (zerop level) gnus-tmp-new-adopts)
3450 'gnus-summary-number-of-articles-in-thread
3451 gnus-tmp-new-adopts))))
3453 (if (> number 1) gnus-not-empty-thread-mark
3454 gnus-empty-thread-mark)
3457 (defsubst gnus-summary-line-message-size (head)
3458 "Return pretty-printed version of message size.
3459 This function is intended to be used in
3460 `gnus-summary-line-format-alist'."
3461 (let ((c (or (mail-header-chars head) -1)))
3462 (cond ((< c 0) "n/a") ; chars not available
3463 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3464 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3465 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3466 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3469 (defun gnus-summary-set-local-parameters (group)
3470 "Go through the local params of GROUP and set all variable specs in that list."
3471 (let ((params (gnus-group-find-parameter group))
3472 (vars '(quit-config)) ; Ignore quit-config.
3475 (setq elem (car params)
3476 params (cdr params))
3477 (and (consp elem) ; Has to be a cons.
3478 (consp (cdr elem)) ; The cdr has to be a list.
3479 (symbolp (car elem)) ; Has to be a symbol in there.
3480 (not (memq (car elem) vars))
3481 (ignore-errors ; So we set it.
3482 (push (car elem) vars)
3483 (make-local-variable (car elem))
3484 (set (car elem) (eval (nth 1 elem))))))))
3486 (defun gnus-summary-read-group (group &optional show-all no-article
3487 kill-buffer no-display backward
3489 "Start reading news in newsgroup GROUP.
3490 If SHOW-ALL is non-nil, already read articles are also listed.
3491 If NO-ARTICLE is non-nil, no article is selected initially.
3492 If NO-DISPLAY, don't generate a summary buffer."
3496 (let ((gnus-auto-select-next nil))
3497 (or (gnus-summary-read-group-1
3498 group show-all no-article
3499 kill-buffer no-display
3502 select-articles nil)))))
3503 (eq gnus-auto-select-next 'quietly))
3504 (set-buffer gnus-group-buffer)
3505 ;; The entry function called above goes to the next
3506 ;; group automatically, so we go two groups back
3507 ;; if we are searching for the previous group.
3509 (gnus-group-prev-unread-group 2))
3510 (if (not (equal group (gnus-group-group-name)))
3511 (setq group (gnus-group-group-name))
3515 (defun gnus-summary-read-group-1 (group show-all no-article
3516 kill-buffer no-display
3517 &optional select-articles)
3518 ;; Killed foreign groups can't be entered.
3519 ;; (when (and (not (gnus-group-native-p group))
3520 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3521 ;; (error "Dead non-native groups can't be entered"))
3522 (gnus-message 5 "Retrieving newsgroup: %s..."
3523 (gnus-group-decoded-name group))
3524 (let* ((new-group (gnus-summary-setup-buffer group))
3525 (quit-config (gnus-group-quit-config group))
3526 (did-select (and new-group (gnus-select-newsgroup
3527 group show-all select-articles))))
3529 ;; This summary buffer exists already, so we just select it.
3531 (gnus-set-global-variables)
3533 (gnus-kill-or-deaden-summary kill-buffer))
3534 (gnus-configure-windows 'summary 'force)
3535 (gnus-set-mode-line 'summary)
3536 (gnus-summary-position-point)
3539 ;; We couldn't select this group.
3541 (when (and (eq major-mode 'gnus-summary-mode)
3542 (not (equal (current-buffer) kill-buffer)))
3543 (kill-buffer (current-buffer))
3544 (if (not quit-config)
3546 ;; Update the info -- marks might need to be removed,
3548 (gnus-summary-update-info)
3549 (set-buffer gnus-group-buffer)
3550 (gnus-group-jump-to-group group)
3551 (gnus-group-next-unread-group 1))
3552 (gnus-handle-ephemeral-exit quit-config)))
3553 (let ((grpinfo (gnus-get-info group)))
3554 (if (null (gnus-info-read grpinfo))
3555 (gnus-message 3 "Group %s contains no messages"
3556 (gnus-group-decoded-name group))
3557 (gnus-message 3 "Can't select group")))
3559 ;; The user did a `C-g' while prompting for number of articles,
3560 ;; so we exit this group.
3561 ((eq did-select 'quit)
3562 (and (eq major-mode 'gnus-summary-mode)
3563 (not (equal (current-buffer) kill-buffer))
3564 (kill-buffer (current-buffer)))
3566 (gnus-kill-or-deaden-summary kill-buffer))
3567 (if (not quit-config)
3569 (set-buffer gnus-group-buffer)
3570 (gnus-group-jump-to-group group)
3571 (gnus-group-next-unread-group 1)
3572 (gnus-configure-windows 'group 'force))
3573 (gnus-handle-ephemeral-exit quit-config))
3574 ;; Finally signal the quit.
3576 ;; The group was successfully selected.
3578 (gnus-set-global-variables)
3579 ;; Save the active value in effect when the group was entered.
3580 (setq gnus-newsgroup-active
3582 (gnus-active gnus-newsgroup-name)))
3583 ;; You can change the summary buffer in some way with this hook.
3584 (gnus-run-hooks 'gnus-select-group-hook)
3585 (when (memq 'summary (gnus-update-format-specifications
3586 nil 'summary 'summary-mode 'summary-dummy))
3587 ;; The format specification for the summary line was updated,
3588 ;; so we need to update the mark positions as well.
3589 (gnus-update-summary-mark-positions))
3590 ;; Do score processing.
3591 (when gnus-use-scoring
3592 (gnus-possibly-score-headers))
3593 ;; Check whether to fill in the gaps in the threads.
3594 (when gnus-build-sparse-threads
3595 (gnus-build-sparse-threads))
3596 ;; Find the initial limit.
3597 (if gnus-show-threads
3599 (let ((gnus-newsgroup-dormant nil))
3600 (gnus-summary-initial-limit show-all))
3601 (gnus-summary-initial-limit show-all))
3602 ;; When unthreaded, all articles are always shown.
3603 (setq gnus-newsgroup-limit
3605 (lambda (header) (mail-header-number header))
3606 gnus-newsgroup-headers)))
3607 ;; Generate the summary buffer.
3609 (gnus-summary-prepare))
3610 (when gnus-use-trees
3611 (gnus-tree-open group)
3612 (setq gnus-summary-highlight-line-function
3613 'gnus-tree-highlight-article))
3614 ;; If the summary buffer is empty, but there are some low-scored
3615 ;; articles or some excluded dormants, we include these in the
3617 (when (and (zerop (buffer-size))
3619 (cond (gnus-newsgroup-dormant
3620 (gnus-summary-limit-include-dormant))
3621 ((and gnus-newsgroup-scored show-all)
3622 (gnus-summary-limit-include-expunged t))))
3623 ;; Function `gnus-apply-kill-file' must be called in this hook.
3624 (gnus-run-hooks 'gnus-apply-kill-hook)
3625 (if (and (zerop (buffer-size))
3628 ;; This newsgroup is empty.
3629 (gnus-summary-catchup-and-exit nil t)
3630 (gnus-message 6 "No unread news")
3632 (gnus-kill-or-deaden-summary kill-buffer))
3633 ;; Return nil from this function.
3635 ;; Hide conversation thread subtrees. We cannot do this in
3636 ;; gnus-summary-prepare-hook since kill processing may not
3637 ;; work with hidden articles.
3638 (gnus-summary-maybe-hide-threads)
3640 (gnus-kill-or-deaden-summary kill-buffer))
3641 (gnus-summary-auto-select-subject)
3642 ;; Show first unread article if requested.
3643 (if (and (not no-article)
3645 gnus-newsgroup-unreads
3646 gnus-auto-select-first)
3648 (gnus-configure-windows 'summary)
3649 (let ((art (gnus-summary-article-number)))
3650 (unless (and (not gnus-plugged)
3651 (or (memq art gnus-newsgroup-undownloaded)
3652 (memq art gnus-newsgroup-downloadable)))
3653 (gnus-summary-goto-article art))))
3654 ;; Don't select any articles.
3655 (gnus-summary-position-point)
3656 (gnus-configure-windows 'summary 'force)
3657 (gnus-set-mode-line 'summary))
3658 (when (and gnus-auto-center-group
3659 (get-buffer-window gnus-group-buffer t))
3660 ;; Gotta use windows, because recenter does weird stuff if
3661 ;; the current buffer ain't the displayed window.
3662 (let ((owin (selected-window)))
3663 (select-window (get-buffer-window gnus-group-buffer t))
3664 (when (gnus-group-goto-group group)
3666 (select-window owin)))
3667 ;; Mark this buffer as "prepared".
3668 (setq gnus-newsgroup-prepared t)
3669 (gnus-run-hooks 'gnus-summary-prepared-hook)
3670 (unless (gnus-ephemeral-group-p group)
3671 (gnus-group-update-group group))
3674 (defun gnus-summary-auto-select-subject ()
3675 "Select the subject line on initial group entry."
3676 (goto-char (point-min))
3678 ((eq gnus-auto-select-subject 'best)
3679 (gnus-summary-best-unread-subject))
3680 ((eq gnus-auto-select-subject 'unread)
3681 (gnus-summary-first-unread-subject))
3682 ((eq gnus-auto-select-subject 'unseen)
3683 (gnus-summary-first-unseen-subject))
3684 ((eq gnus-auto-select-subject 'unseen-or-unread)
3685 (gnus-summary-first-unseen-or-unread-subject))
3686 ((eq gnus-auto-select-subject 'first)
3689 ((functionp gnus-auto-select-subject)
3690 (funcall gnus-auto-select-subject))))
3692 (defun gnus-summary-prepare ()
3693 "Generate the summary buffer."
3695 (let ((buffer-read-only nil))
3697 (setq gnus-newsgroup-data nil
3698 gnus-newsgroup-data-reverse nil)
3699 (gnus-run-hooks 'gnus-summary-generate-hook)
3700 ;; Generate the buffer, either with threads or without.
3701 (when gnus-newsgroup-headers
3702 (gnus-summary-prepare-threads
3703 (if gnus-show-threads
3704 (gnus-sort-gathered-threads
3705 (funcall gnus-summary-thread-gathering-function
3707 (gnus-cut-threads (gnus-make-threads)))))
3708 ;; Unthreaded display.
3709 (gnus-sort-articles gnus-newsgroup-headers))))
3710 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3711 ;; Call hooks for modifying summary buffer.
3712 (goto-char (point-min))
3713 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3715 (defsubst gnus-general-simplify-subject (subject)
3716 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3719 ;; Truncate the subject.
3720 (gnus-simplify-subject-functions
3721 (gnus-map-function gnus-simplify-subject-functions subject))
3722 ((numberp gnus-summary-gather-subject-limit)
3723 (setq subject (gnus-simplify-subject-re subject))
3724 (if (> (length subject) gnus-summary-gather-subject-limit)
3725 (substring subject 0 gnus-summary-gather-subject-limit)
3727 ;; Fuzzily simplify it.
3728 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3729 (gnus-simplify-subject-fuzzy subject))
3730 ;; Just remove the leading "Re:".
3732 (gnus-simplify-subject-re subject))))
3734 (if (and gnus-summary-gather-exclude-subject
3735 (string-match gnus-summary-gather-exclude-subject subject))
3736 nil ; This article shouldn't be gathered
3739 (defun gnus-summary-simplify-subject-query ()
3740 "Query where the respool algorithm would put this article."
3742 (gnus-summary-select-article)
3743 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3745 (defun gnus-gather-threads-by-subject (threads)
3746 "Gather threads by looking at Subject headers."
3747 (if (not gnus-summary-make-false-root)
3749 (let ((hashtb (gnus-make-hashtable 1024))
3752 subject hthread whole-subject)
3754 (setq subject (gnus-general-simplify-subject
3755 (setq whole-subject (mail-header-subject
3758 (if (setq hthread (gnus-gethash subject hashtb))
3760 ;; We enter a dummy root into the thread, if we
3761 ;; haven't done that already.
3762 (unless (stringp (caar hthread))
3763 (setcar hthread (list whole-subject (car hthread))))
3764 ;; We add this new gathered thread to this gathered
3766 (setcdr (car hthread)
3767 (nconc (cdar hthread) (list (car threads))))
3768 ;; Remove it from the list of threads.
3769 (setcdr prev (cdr threads))
3770 (setq threads prev))
3771 ;; Enter this thread into the hash table.
3772 (gnus-sethash subject
3773 (if gnus-summary-make-false-root-always
3775 ;; If you want a dummy root above all
3777 (setcar threads (list whole-subject
3783 (setq threads (cdr threads)))
3786 (defun gnus-gather-threads-by-references (threads)
3787 "Gather threads by looking at References headers."
3788 (let ((idhashtb (gnus-make-hashtable 1024))
3789 (thhashtb (gnus-make-hashtable 1024))
3792 ids references id gthread gid entered ref)
3794 (when (setq references (mail-header-references (caar threads)))
3795 (setq id (mail-header-id (caar threads))
3796 ids (inline (gnus-split-references references))
3798 (while (setq ref (pop ids))
3799 (setq ids (delete ref ids))
3800 (if (not (setq gid (gnus-gethash ref idhashtb)))
3802 (gnus-sethash ref id idhashtb)
3803 (gnus-sethash id threads thhashtb))
3804 (setq gthread (gnus-gethash gid thhashtb))
3806 ;; We enter a dummy root into the thread, if we
3807 ;; haven't done that already.
3808 (unless (stringp (caar gthread))
3809 (setcar gthread (list (mail-header-subject (caar gthread))
3811 ;; We add this new gathered thread to this gathered
3813 (setcdr (car gthread)
3814 (nconc (cdar gthread) (list (car threads)))))
3815 ;; Add it into the thread hash table.
3816 (gnus-sethash id gthread thhashtb)
3818 ;; Remove it from the list of threads.
3819 (setcdr prev (cdr threads))
3820 (setq threads prev))))
3822 (setq threads (cdr threads)))
3825 (defun gnus-sort-gathered-threads (threads)
3826 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3827 (let ((result threads))
3829 (when (stringp (caar threads))
3830 (setcdr (car threads)
3831 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3832 (setq threads (cdr threads)))
3835 (defun gnus-thread-loop-p (root thread)
3836 "Say whether ROOT is in THREAD."
3837 (let ((stack (list thread))
3840 (while (setq thread (pop stack))
3841 (setq th (cdr thread))
3843 (not (eq (caar th) root)))
3846 ;; We have found a loop.
3848 (setcdr thread (delq (car th) (cdr thread)))
3849 (if (boundp (setq ref-dep (intern "none"
3850 gnus-newsgroup-dependencies)))
3851 (setcdr (symbol-value ref-dep)
3852 (nconc (cdr (symbol-value ref-dep))
3854 (set ref-dep (list nil (car th))))
3857 ;; Push all the subthreads onto the stack.
3858 (push (cdr thread) stack)))
3861 (defun gnus-make-threads ()
3862 "Go through the dependency hashtb and find the roots. Return all threads."
3864 (while (catch 'infloop
3867 ;; Deal with self-referencing References loops.
3868 (when (and (car (symbol-value refs))
3875 (car (symbol-value refs)) thread))
3876 (cdr (symbol-value refs)))))))
3879 (unless (car (symbol-value refs))
3880 ;; These threads do not refer back to any other
3881 ;; articles, so they're roots.
3882 (setq threads (append (cdr (symbol-value refs)) threads))))
3883 gnus-newsgroup-dependencies)))
3886 ;; Build the thread tree.
3887 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3888 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3890 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3891 if it was already present.
3893 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3894 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3895 Message-IDs will be renamed to a unique Message-ID before being
3898 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3899 (let* ((id (mail-header-id header))
3900 (id-dep (and id (intern id dependencies)))
3901 parent-id ref ref-dep ref-header replaced)
3902 ;; Enter this `header' in the `dependencies' table.
3906 ;; The first two cases do the normal part: enter a new `header'
3907 ;; in the `dependencies' table.
3908 ((not (boundp id-dep))
3909 (set id-dep (list header)))
3910 ((null (car (symbol-value id-dep)))
3911 (setcar (symbol-value id-dep) header))
3913 ;; From here the `header' was already present in the
3914 ;; `dependencies' table.
3916 ;; Overrides an existing entry;
3917 ;; just set the header part of the entry.
3918 (setcar (symbol-value id-dep) header)
3921 ;; Renames the existing `header' to a unique Message-ID.
3922 ((not gnus-summary-ignore-duplicates)
3923 ;; An article with this Message-ID has already been seen.
3924 ;; We rename the Message-ID.
3925 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3927 (mail-header-set-id header id))
3929 ;; The last case ignores an existing entry, except it adds any
3930 ;; additional Xrefs (in case the two articles came from different
3932 ;; Also sets `header' to `nil' meaning that the `dependencies'
3933 ;; table was *not* modified.
3935 (mail-header-set-xref
3936 (car (symbol-value id-dep))
3937 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3939 (or (mail-header-xref header) "")))
3942 (when (and header (not replaced))
3943 ;; First check that we are not creating a References loop.
3944 (setq parent-id (gnus-parent-id (mail-header-references header)))
3945 (setq ref parent-id)
3947 (setq ref-dep (intern-soft ref dependencies))
3949 (setq ref-header (car (symbol-value ref-dep))))
3950 (if (string= id ref)
3951 ;; Yuk! This is a reference loop. Make the article be a
3954 (mail-header-set-references (car (symbol-value id-dep)) "none")
3956 (setq parent-id nil))
3957 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3958 (setq ref-dep (intern (or parent-id "none") dependencies))
3959 (if (boundp ref-dep)
3960 (setcdr (symbol-value ref-dep)
3961 (nconc (cdr (symbol-value ref-dep))
3962 (list (symbol-value id-dep))))
3963 (set ref-dep (list nil (symbol-value id-dep)))))
3966 (defun gnus-extract-message-id-from-in-reply-to (string)
3967 (if (string-match "<[^>]+>" string)
3968 (substring string (match-beginning 0) (match-end 0))
3971 (defun gnus-build-sparse-threads ()
3972 (let ((headers gnus-newsgroup-headers)
3973 (mail-parse-charset gnus-newsgroup-charset)
3974 (gnus-summary-ignore-duplicates t)
3975 header references generation relations
3976 subject child end new-child date)
3977 ;; First we create an alist of generations/relations, where
3978 ;; generations is how much we trust the relation, and the relation
3980 (gnus-message 7 "Making sparse threads...")
3982 (nnheader-set-temp-buffer " *gnus sparse threads*")
3983 (while (setq header (pop headers))
3984 (when (and (setq references (mail-header-references header))
3985 (not (string= references "")))
3987 (setq child (mail-header-id header)
3988 subject (mail-header-subject header)
3989 date (mail-header-date header)
3991 (while (search-backward ">" nil t)
3992 (setq end (1+ (point)))
3993 (when (search-backward "<" nil t)
3994 (setq new-child (buffer-substring (point) end))
3995 (push (list (incf generation)
3996 child (setq child new-child)
4000 (push (list (1+ generation) child nil subject) relations))
4002 (kill-buffer (current-buffer)))
4003 ;; Sort over trustworthiness.
4006 (when (gnus-dependencies-add-header
4007 (make-full-mail-header
4008 gnus-reffed-article-number
4009 (nth 3 relation) "" (or (nth 4 relation) "")
4011 (or (nth 2 relation) "") 0 0 "")
4012 gnus-newsgroup-dependencies nil)
4013 (push gnus-reffed-article-number gnus-newsgroup-limit)
4014 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4015 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4016 gnus-newsgroup-reads)
4017 (decf gnus-reffed-article-number)))
4018 (sort relations 'car-less-than-car))
4019 (gnus-message 7 "Making sparse threads...done")))
4021 (defun gnus-build-old-threads ()
4022 ;; Look at all the articles that refer back to old articles, and
4023 ;; fetch the headers for the articles that aren't there. This will
4024 ;; build complete threads - if the roots haven't been expired by the
4026 (let ((mail-parse-charset gnus-newsgroup-charset)
4030 (when (not (car (symbol-value refs)))
4031 (setq heads (cdr (symbol-value refs)))
4033 (if (memq (mail-header-number (caar heads))
4034 gnus-newsgroup-dormant)
4035 (setq heads (cdr heads))
4036 (setq id (symbol-name refs))
4037 (while (and (setq id (gnus-build-get-header id))
4038 (not (car (gnus-id-to-thread id)))))
4039 (setq heads nil)))))
4040 gnus-newsgroup-dependencies)))
4042 (defsubst gnus-remove-odd-characters (string)
4043 "Translate STRING into something that doesn't contain weird characters."
4044 (mm-subst-char-in-string
4046 (mm-subst-char-in-string
4049 ;; This function has to be called with point after the article number
4050 ;; on the beginning of the line.
4051 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4052 (let ((eol (gnus-point-at-eol))
4053 (buffer (current-buffer))
4054 header references in-reply-to)
4056 ;; overview: [num subject from date id refs chars lines misc]
4059 (narrow-to-region (point) eol)
4064 (make-full-mail-header
4066 (condition-case () ; subject
4067 (gnus-remove-odd-characters
4068 (funcall gnus-decode-encoded-word-function
4069 (setq x (nnheader-nov-field))))
4071 (condition-case () ; from
4072 (gnus-remove-odd-characters
4073 (funcall gnus-decode-encoded-word-function
4074 (setq x (nnheader-nov-field))))
4076 (nnheader-nov-field) ; date
4077 (nnheader-nov-read-message-id) ; id
4078 (setq references (nnheader-nov-field)) ; refs
4079 (nnheader-nov-read-integer) ; chars
4080 (nnheader-nov-read-integer) ; lines
4082 (if (looking-at "Xref: ")
4083 (goto-char (match-end 0)))
4084 (nnheader-nov-field)) ; Xref
4085 (nnheader-nov-parse-extra)))) ; extra
4089 (when (and (string= references "")
4090 (setq in-reply-to (mail-header-extra header))
4091 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4092 (mail-header-set-references
4093 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4095 (when gnus-alter-header-function
4096 (funcall gnus-alter-header-function header))
4097 (gnus-dependencies-add-header header dependencies force-new)))
4099 (defun gnus-build-get-header (id)
4100 "Look through the buffer of NOV lines and find the header to ID.
4101 Enter this line into the dependencies hash table, and return
4102 the id of the parent article (if any)."
4103 (let ((deps gnus-newsgroup-dependencies)
4107 (set-buffer nntp-server-buffer)
4108 (let ((case-fold-search nil))
4109 (goto-char (point-min))
4110 (while (and (not found)
4111 (search-forward id nil t))
4113 (setq found (looking-at
4114 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4115 (regexp-quote id))))
4116 (or found (beginning-of-line 2)))
4120 (setq header (gnus-nov-parse-line
4121 (read (current-buffer)) deps))
4122 (gnus-parent-id (mail-header-references header))))))
4124 (let ((number (mail-header-number header)))
4125 (push number gnus-newsgroup-limit)
4126 (push header gnus-newsgroup-headers)
4127 (if (memq number gnus-newsgroup-unselected)
4129 (setq gnus-newsgroup-unreads
4130 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4132 (setq gnus-newsgroup-unselected
4133 (delq number gnus-newsgroup-unselected)))
4134 (push number gnus-newsgroup-ancient)))))))
4136 (defun gnus-build-all-threads ()
4137 "Read all the headers."
4138 (let ((gnus-summary-ignore-duplicates t)
4139 (mail-parse-charset gnus-newsgroup-charset)
4140 (dependencies gnus-newsgroup-dependencies)
4143 (set-buffer nntp-server-buffer)
4144 (let ((case-fold-search nil))
4145 (goto-char (point-min))
4148 (setq article (read (current-buffer))
4149 header (gnus-nov-parse-line article dependencies)))
4152 (set-buffer gnus-summary-buffer)
4153 (push header gnus-newsgroup-headers)
4154 (if (memq (setq article (mail-header-number header))
4155 gnus-newsgroup-unselected)
4157 (setq gnus-newsgroup-unreads
4158 (gnus-add-to-sorted-list
4159 gnus-newsgroup-unreads article))
4160 (setq gnus-newsgroup-unselected
4161 (delq article gnus-newsgroup-unselected)))
4162 (push article gnus-newsgroup-ancient)))
4163 (forward-line 1)))))))
4165 (defun gnus-summary-update-article-line (article header)
4166 "Update the line for ARTICLE using HEADER."
4167 (let* ((id (mail-header-id header))
4168 (thread (gnus-id-to-thread id)))
4170 (error "Article in no thread"))
4171 ;; Update the thread.
4172 (setcar thread header)
4173 (gnus-summary-goto-subject article)
4174 (let* ((datal (gnus-data-find-list article))
4176 (buffer-read-only nil)
4177 (level (gnus-summary-thread-level)))
4179 (let ((inserted (- (point)
4181 (gnus-summary-insert-line
4183 (memq article gnus-newsgroup-undownloaded)
4184 (gnus-article-mark article)
4185 (memq article gnus-newsgroup-replied)
4186 (memq article gnus-newsgroup-expirable)
4187 ;; Only insert the Subject string when it's different
4188 ;; from the previous Subject string.
4193 (mail-header-subject
4196 (gnus-data-find-list
4198 (gnus-data-list t)))))
4199 ;; Error on the side of excessive subjects.
4201 (mail-header-subject header)))
4203 (mail-header-subject header))
4204 nil (cdr (assq article gnus-newsgroup-scored))
4205 (memq article gnus-newsgroup-processable))
4208 (gnus-data-update-list
4210 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4212 (defun gnus-summary-update-article (article &optional iheader)
4213 "Update ARTICLE in the summary buffer."
4214 (set-buffer gnus-summary-buffer)
4215 (let* ((header (gnus-summary-article-header article))
4216 (id (mail-header-id header))
4217 (data (gnus-data-find article))
4218 (thread (gnus-id-to-thread id))
4219 (references (mail-header-references header))
4223 (when (and references
4224 (not (equal "" references)))
4227 (buffer-read-only nil)
4233 (delq thread parent)))
4234 (if (gnus-summary-insert-subject id header)
4235 ;; Set the (possibly) new article number in the data structure.
4236 (gnus-data-set-number data (gnus-id-to-article id))
4240 (defun gnus-rebuild-thread (id &optional line)
4241 "Rebuild the thread containing ID.
4242 If LINE, insert the rebuilt thread starting on line LINE."
4243 (let ((buffer-read-only nil)
4244 old-pos current thread data)
4245 (if (not gnus-show-threads)
4246 (setq thread (list (car (gnus-id-to-thread id))))
4247 ;; Get the thread this article is part of.
4248 (setq thread (gnus-remove-thread id)))
4249 (setq old-pos (gnus-point-at-bol))
4250 (setq current (save-excursion
4251 (and (re-search-backward "[\r\n]" nil t)
4252 (gnus-summary-article-number))))
4253 ;; If this is a gathered thread, we have to go some re-gathering.
4254 (when (stringp (car thread))
4255 (let ((subject (car thread))
4257 (setq thread (cdr thread))
4259 (unless (memq (setq thr (gnus-id-to-thread
4261 (mail-header-id (caar thread)))))
4264 (setq thread (cdr thread)))
4265 ;; We now have all (unique) roots.
4266 (if (= (length roots) 1)
4267 ;; All the loose roots are now one solid root.
4268 (setq thread (car roots))
4269 (setq thread (cons subject (gnus-sort-threads roots))))))
4271 ;; We then insert this thread into the summary buffer.
4273 (goto-char (point-min))
4274 (forward-line (1- line)))
4275 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4276 (if gnus-show-threads
4277 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4278 (gnus-summary-prepare-unthreaded thread))
4279 (setq data (nreverse gnus-newsgroup-data))
4280 (setq threads gnus-newsgroup-threads))
4281 ;; We splice the new data into the data structure.
4282 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4283 ;;!!! then we want to insert at the beginning of the buffer.
4284 ;;!!! That happens to be true with Gnus now, but that may
4285 ;;!!! change in the future. Perhaps.
4286 (gnus-data-enter-list
4287 (if line nil current) data (- (point) old-pos))
4288 (setq gnus-newsgroup-threads
4289 (nconc threads gnus-newsgroup-threads))
4290 (gnus-data-compute-positions))))
4292 (defun gnus-number-to-header (number)
4293 "Return the header for article NUMBER."
4294 (let ((headers gnus-newsgroup-headers))
4296 (not (= number (mail-header-number (car headers)))))
4301 (defun gnus-parent-headers (in-headers &optional generation)
4302 "Return the headers of the GENERATIONeth parent of HEADERS."
4304 (setq generation 1))
4306 (headers in-headers)
4309 (not (zerop generation))
4310 (setq references (mail-header-references headers)))
4311 (setq headers (if (and references
4312 (setq parent (gnus-parent-id references)))
4313 (car (gnus-id-to-thread parent))
4316 (and (not (eq headers in-headers))
4319 (defun gnus-id-to-thread (id)
4320 "Return the (sub-)thread where ID appears."
4321 (gnus-gethash id gnus-newsgroup-dependencies))
4323 (defun gnus-id-to-article (id)
4324 "Return the article number of ID."
4325 (let ((thread (gnus-id-to-thread id)))
4328 (mail-header-number (car thread)))))
4330 (defun gnus-id-to-header (id)
4331 "Return the article headers of ID."
4332 (car (gnus-id-to-thread id)))
4334 (defun gnus-article-displayed-root-p (article)
4335 "Say whether ARTICLE is a root(ish) article."
4336 (let ((level (gnus-summary-thread-level article))
4337 (refs (mail-header-references (gnus-summary-article-header article)))
4343 ((null (gnus-parent-id refs)) t)
4345 (null (setq particle (gnus-id-to-article
4346 (gnus-parent-id refs))))
4347 (null (gnus-summary-thread-level particle)))))))
4349 (defun gnus-root-id (id)
4350 "Return the id of the root of the thread where ID appears."
4352 (while (and id (setq prev (car (gnus-id-to-thread id))))
4354 id (gnus-parent-id (mail-header-references prev))))
4357 (defun gnus-articles-in-thread (thread)
4358 "Return the list of articles in THREAD."
4359 (cons (mail-header-number (car thread))
4360 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4362 (defun gnus-remove-thread (id &optional dont-remove)
4363 "Remove the thread that has ID in it."
4364 (let (headers thread last-id)
4365 ;; First go up in this thread until we find the root.
4366 (setq last-id (gnus-root-id id)
4367 headers (message-flatten-list (gnus-id-to-thread last-id)))
4368 ;; We have now found the real root of this thread. It might have
4369 ;; been gathered into some loose thread, so we have to search
4370 ;; through the threads to find the thread we wanted.
4371 (let ((threads gnus-newsgroup-threads)
4374 (setq sub (car threads))
4375 (if (stringp (car sub))
4376 ;; This is a gathered thread, so we look at the roots
4377 ;; below it to find whether this article is in this
4380 (setq sub (cdr sub))
4382 (when (member (caar sub) headers)
4383 (setq thread (car threads)
4386 (setq sub (cdr sub))))
4387 ;; It's an ordinary thread, so we check it.
4388 (when (eq (car sub) (car headers))
4391 (setq threads (cdr threads)))
4392 ;; If this article is in no thread, then it's a root.
4395 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4396 (setq thread (gnus-id-to-thread last-id)))
4399 thread ; We return this thread.
4401 (if (stringp (car thread))
4403 ;; If we use dummy roots, then we have to remove the
4404 ;; dummy root as well.
4405 (when (eq gnus-summary-make-false-root 'dummy)
4406 ;; We go to the dummy root by going to
4407 ;; the first sub-"thread", and then one line up.
4408 (gnus-summary-goto-article
4409 (mail-header-number (caadr thread)))
4412 (gnus-data-compute-positions))
4413 (setq thread (cdr thread))
4415 (gnus-remove-thread-1 (car thread))
4416 (setq thread (cdr thread))))
4417 (gnus-remove-thread-1 thread))))))))
4419 (defun gnus-remove-thread-1 (thread)
4420 "Remove the thread THREAD recursively."
4421 (let ((number (mail-header-number (pop thread)))
4423 (setq thread (reverse thread))
4425 (gnus-remove-thread-1 (pop thread)))
4426 (when (setq d (gnus-data-find number))
4427 (goto-char (gnus-data-pos d))
4428 (gnus-summary-show-thread)
4431 (- (gnus-point-at-bol)
4433 (1+ (gnus-point-at-eol))
4434 (gnus-delete-line)))))))
4436 (defun gnus-sort-threads-1 (threads func)
4437 (sort (mapcar (lambda (thread)
4440 (gnus-sort-threads-1 (cdr thread) func))))
4443 (defun gnus-sort-threads (threads)
4445 (if (not gnus-thread-sort-functions)
4447 (gnus-message 8 "Sorting threads...")
4448 (let ((max-lisp-eval-depth 5000))
4449 (prog1 (gnus-sort-threads-1
4451 (gnus-make-sort-function gnus-thread-sort-functions))
4452 (gnus-message 8 "Sorting threads...done")))))
4454 (defun gnus-sort-articles (articles)
4456 (when gnus-article-sort-functions
4457 (gnus-message 7 "Sorting articles...")
4459 (setq gnus-newsgroup-headers
4460 (sort articles (gnus-make-sort-function
4461 gnus-article-sort-functions)))
4462 (gnus-message 7 "Sorting articles...done"))))
4464 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4465 (defmacro gnus-thread-header (thread)
4466 "Return header of first article in THREAD.
4467 Note that THREAD must never, ever be anything else than a variable -
4468 using some other form will lead to serious barfage."
4469 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4470 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4471 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4474 (defsubst gnus-article-sort-by-number (h1 h2)
4475 "Sort articles by article number."
4476 (< (mail-header-number h1)
4477 (mail-header-number h2)))
4479 (defun gnus-thread-sort-by-number (h1 h2)
4480 "Sort threads by root article number."
4481 (gnus-article-sort-by-number
4482 (gnus-thread-header h1) (gnus-thread-header h2)))
4484 (defsubst gnus-article-sort-by-random (h1 h2)
4485 "Sort articles by article number."
4488 (defun gnus-thread-sort-by-random (h1 h2)
4489 "Sort threads by root article number."
4490 (gnus-article-sort-by-random
4491 (gnus-thread-header h1) (gnus-thread-header h2)))
4493 (defsubst gnus-article-sort-by-lines (h1 h2)
4494 "Sort articles by article Lines header."
4495 (< (mail-header-lines h1)
4496 (mail-header-lines h2)))
4498 (defun gnus-thread-sort-by-lines (h1 h2)
4499 "Sort threads by root article Lines header."
4500 (gnus-article-sort-by-lines
4501 (gnus-thread-header h1) (gnus-thread-header h2)))
4503 (defsubst gnus-article-sort-by-chars (h1 h2)
4504 "Sort articles by octet length."
4505 (< (mail-header-chars h1)
4506 (mail-header-chars h2)))
4508 (defun gnus-thread-sort-by-chars (h1 h2)
4509 "Sort threads by root article octet length."
4510 (gnus-article-sort-by-chars
4511 (gnus-thread-header h1) (gnus-thread-header h2)))
4513 (defsubst gnus-article-sort-by-author (h1 h2)
4514 "Sort articles by root author."
4516 (let ((extract (funcall
4517 gnus-extract-address-components
4518 (mail-header-from h1))))
4519 (or (car extract) (cadr extract) ""))
4520 (let ((extract (funcall
4521 gnus-extract-address-components
4522 (mail-header-from h2))))
4523 (or (car extract) (cadr extract) ""))))
4525 (defun gnus-thread-sort-by-author (h1 h2)
4526 "Sort threads by root author."
4527 (gnus-article-sort-by-author
4528 (gnus-thread-header h1) (gnus-thread-header h2)))
4530 (defsubst gnus-article-sort-by-subject (h1 h2)
4531 "Sort articles by root subject."
4533 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4534 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4536 (defun gnus-thread-sort-by-subject (h1 h2)
4537 "Sort threads by root subject."
4538 (gnus-article-sort-by-subject
4539 (gnus-thread-header h1) (gnus-thread-header h2)))
4541 (defsubst gnus-article-sort-by-date (h1 h2)
4542 "Sort articles by root article date."
4544 (gnus-date-get-time (mail-header-date h1))
4545 (gnus-date-get-time (mail-header-date h2))))
4547 (defun gnus-thread-sort-by-date (h1 h2)
4548 "Sort threads by root article date."
4549 (gnus-article-sort-by-date
4550 (gnus-thread-header h1) (gnus-thread-header h2)))
4552 (defsubst gnus-article-sort-by-score (h1 h2)
4553 "Sort articles by root article score.
4554 Unscored articles will be counted as having a score of zero."
4555 (> (or (cdr (assq (mail-header-number h1)
4556 gnus-newsgroup-scored))
4557 gnus-summary-default-score 0)
4558 (or (cdr (assq (mail-header-number h2)
4559 gnus-newsgroup-scored))
4560 gnus-summary-default-score 0)))
4562 (defun gnus-thread-sort-by-score (h1 h2)
4563 "Sort threads by root article score."
4564 (gnus-article-sort-by-score
4565 (gnus-thread-header h1) (gnus-thread-header h2)))
4567 (defun gnus-thread-sort-by-total-score (h1 h2)
4568 "Sort threads by the sum of all scores in the thread.
4569 Unscored articles will be counted as having a score of zero."
4570 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4572 (defun gnus-thread-total-score (thread)
4573 ;; This function find the total score of THREAD.
4578 (if (stringp (car thread))
4579 (apply gnus-thread-score-function 0
4580 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4581 (gnus-thread-total-score-1 thread)))
4583 (gnus-thread-total-score-1 (list thread)))))
4585 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4586 "Sort threads such that the thread with the most recently arrived article comes first."
4587 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4589 (defun gnus-thread-highest-number (thread)
4590 "Return the highest article number in THREAD."
4591 (apply 'max (mapcar (lambda (header)
4592 (mail-header-number header))
4593 (message-flatten-list thread))))
4595 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4596 "Sort threads such that the thread with the most recently dated article comes first."
4597 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4599 (defun gnus-thread-latest-date (thread)
4600 "Return the highest article date in THREAD."
4601 (let ((previous-time 0))
4607 (time-to-seconds (mail-header-parse-date
4608 (mail-header-date header)))
4609 (error previous-time))))
4611 (message-flatten-list thread)
4613 (< (mail-header-number h1)
4614 (mail-header-number h2))))))))
4616 (defun gnus-thread-total-score-1 (root)
4617 ;; This function find the total score of the thread below ROOT.
4618 (setq root (car root))
4619 (apply gnus-thread-score-function
4621 (mapcar 'gnus-thread-total-score
4622 (cdr (gnus-id-to-thread (mail-header-id root))))
4623 (when (> (mail-header-number root) 0)
4624 (list (or (cdr (assq (mail-header-number root)
4625 gnus-newsgroup-scored))
4626 gnus-summary-default-score 0))))
4627 (list gnus-summary-default-score)
4630 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4631 (defvar gnus-tmp-prev-subject nil)
4632 (defvar gnus-tmp-false-parent nil)
4633 (defvar gnus-tmp-root-expunged nil)
4634 (defvar gnus-tmp-dummy-line nil)
4636 (eval-when-compile (defvar gnus-tmp-header))
4637 (defun gnus-extra-header (type &optional header)
4638 "Return the extra header of TYPE."
4639 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4642 (defvar gnus-tmp-thread-tree-header-string "")
4644 (defcustom gnus-sum-thread-tree-root "> "
4645 "With %B spec, used for the root of a thread.
4646 If nil, use subject instead."
4648 :type '(radio (const :format "%v " nil) string)
4649 :group 'gnus-thread)
4650 (defcustom gnus-sum-thread-tree-false-root "> "
4651 "With %B spec, used for a false root of a thread.
4652 If nil, use subject instead."
4654 :type '(radio (const :format "%v " nil) string)
4655 :group 'gnus-thread)
4656 (defcustom gnus-sum-thread-tree-single-indent ""
4657 "With %B spec, used for a thread with just one message.
4658 If nil, use subject instead."
4660 :type '(radio (const :format "%v " nil) string)
4661 :group 'gnus-thread)
4662 (defcustom gnus-sum-thread-tree-vertical "| "
4663 "With %B spec, used for drawing a vertical line."
4666 :group 'gnus-thread)
4667 (defcustom gnus-sum-thread-tree-indent " "
4668 "With %B spec, used for indenting."
4671 :group 'gnus-thread)
4672 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4673 "With %B spec, used for a leaf with brothers."
4676 :group 'gnus-thread)
4677 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4678 "With %B spec, used for a leaf without brothers."
4681 :group 'gnus-thread)
4683 (defun gnus-summary-prepare-threads (threads)
4684 "Prepare summary buffer from THREADS and indentation LEVEL.
4685 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4686 or a straight list of headers."
4687 (gnus-message 7 "Generating summary...")
4689 (setq gnus-newsgroup-threads threads)
4692 (let ((gnus-tmp-level 0)
4693 (default-score (or gnus-summary-default-score 0))
4694 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4695 (building-line-count gnus-summary-display-while-building)
4696 (building-count (integerp gnus-summary-display-while-building))
4697 thread number subject stack state gnus-tmp-gathered beg-match
4698 new-roots gnus-tmp-new-adopts thread-end simp-subject
4699 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4700 gnus-tmp-replied gnus-tmp-subject-or-nil
4701 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4702 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4703 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4706 (setq gnus-tmp-prev-subject nil
4707 gnus-tmp-thread-tree-header-string "")
4709 (if (vectorp (car threads))
4710 ;; If this is a straight (sic) list of headers, then a
4711 ;; threaded summary display isn't required, so we just create
4712 ;; an unthreaded one.
4713 (gnus-summary-prepare-unthreaded threads)
4715 ;; Do the threaded display.
4717 (if gnus-summary-display-while-building
4718 (switch-to-buffer (buffer-name)))
4719 (while (or threads stack gnus-tmp-new-adopts new-roots)
4721 (if (and (= gnus-tmp-level 0)
4724 (not gnus-tmp-false-parent)
4725 (or gnus-tmp-new-adopts new-roots))
4726 (if gnus-tmp-new-adopts
4727 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4728 thread (list (car gnus-tmp-new-adopts))
4729 gnus-tmp-header (caar thread)
4730 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4732 (setq thread (list (car new-roots))
4733 gnus-tmp-header (caar thread)
4734 new-roots (cdr new-roots))))
4737 ;; If there are some threads, we do them before the
4738 ;; threads on the stack.
4739 (setq thread threads
4740 gnus-tmp-header (caar thread))
4741 ;; There were no current threads, so we pop something off
4743 (setq state (car stack)
4744 gnus-tmp-level (car state)
4745 tree-stack (cadr state)
4746 thread (caddr state)
4748 gnus-tmp-header (caar thread))))
4750 (setq gnus-tmp-false-parent nil)
4751 (setq gnus-tmp-root-expunged nil)
4752 (setq thread-end nil)
4754 (if (stringp gnus-tmp-header)
4755 ;; The header is a dummy root.
4757 ((eq gnus-summary-make-false-root 'adopt)
4758 ;; We let the first article adopt the rest.
4759 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4761 (setq gnus-tmp-gathered
4763 (lambda (h) (mail-header-number (car h)))
4766 (setq thread (cons (list (caar thread)
4769 (setq gnus-tmp-level -1
4770 gnus-tmp-false-parent t))
4771 ((eq gnus-summary-make-false-root 'empty)
4772 ;; We print adopted articles with empty subject fields.
4773 (setq gnus-tmp-gathered
4775 (lambda (h) (mail-header-number (car h)))
4778 (setq gnus-tmp-level -1))
4779 ((eq gnus-summary-make-false-root 'dummy)
4780 ;; We remember that we probably want to output a dummy
4782 (setq gnus-tmp-dummy-line gnus-tmp-header)
4783 (setq gnus-tmp-prev-subject gnus-tmp-header))
4785 ;; We do not make a root for the gathered
4786 ;; sub-threads at all.
4787 (setq gnus-tmp-level -1)))
4789 (setq number (mail-header-number gnus-tmp-header)
4790 subject (mail-header-subject gnus-tmp-header)
4791 simp-subject (gnus-simplify-subject-fully subject))
4794 ;; If the thread has changed subject, we might want to make
4795 ;; this subthread into a root.
4796 ((and (null gnus-thread-ignore-subject)
4797 (not (zerop gnus-tmp-level))
4798 gnus-tmp-prev-subject
4799 (not (string= gnus-tmp-prev-subject simp-subject)))
4800 (setq new-roots (nconc new-roots (list (car thread)))
4802 gnus-tmp-header nil))
4803 ;; If the article lies outside the current limit,
4804 ;; then we do not display it.
4805 ((not (memq number gnus-newsgroup-limit))
4806 (setq gnus-tmp-gathered
4808 (lambda (h) (mail-header-number (car h)))
4811 (setq gnus-tmp-new-adopts (if (cdar thread)
4812 (append gnus-tmp-new-adopts
4814 gnus-tmp-new-adopts)
4816 gnus-tmp-header nil)
4817 (when (zerop gnus-tmp-level)
4818 (setq gnus-tmp-root-expunged t)))
4819 ;; Perhaps this article is to be marked as read?
4820 ((and gnus-summary-mark-below
4821 (< (or (cdr (assq number gnus-newsgroup-scored))
4823 gnus-summary-mark-below)
4824 ;; Don't touch sparse articles.
4825 (not (gnus-summary-article-sparse-p number))
4826 (not (gnus-summary-article-ancient-p number)))
4827 (setq gnus-newsgroup-unreads
4828 (delq number gnus-newsgroup-unreads))
4829 (if gnus-newsgroup-auto-expire
4830 (setq gnus-newsgroup-expirable
4831 (gnus-add-to-sorted-list
4832 gnus-newsgroup-expirable number))
4833 (push (cons number gnus-low-score-mark)
4834 gnus-newsgroup-reads))))
4836 (when gnus-tmp-header
4837 ;; We may have an old dummy line to output before this
4839 (when (and gnus-tmp-dummy-line
4842 (mail-header-subject gnus-tmp-header)))
4843 (gnus-summary-insert-dummy-line
4844 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4845 (setq gnus-tmp-dummy-line nil))
4847 ;; Compute the mark.
4848 (setq gnus-tmp-unread (gnus-article-mark number))
4850 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4851 gnus-tmp-header gnus-tmp-level)
4852 gnus-newsgroup-data)
4854 ;; Actually insert the line.
4856 gnus-tmp-subject-or-nil
4858 ((and gnus-thread-ignore-subject
4859 gnus-tmp-prev-subject
4860 (not (string= gnus-tmp-prev-subject simp-subject)))
4862 ((zerop gnus-tmp-level)
4863 (if (and (eq gnus-summary-make-false-root 'empty)
4864 (memq number gnus-tmp-gathered)
4865 gnus-tmp-prev-subject
4866 (string= gnus-tmp-prev-subject simp-subject))
4867 gnus-summary-same-subject
4869 (t gnus-summary-same-subject)))
4870 (if (and (eq gnus-summary-make-false-root 'adopt)
4871 (= gnus-tmp-level 1)
4872 (memq number gnus-tmp-gathered))
4873 (setq gnus-tmp-opening-bracket ?\<
4874 gnus-tmp-closing-bracket ?\>)
4875 (setq gnus-tmp-opening-bracket ?\[
4876 gnus-tmp-closing-bracket ?\]))
4878 gnus-tmp-indentation
4879 (aref gnus-thread-indent-array gnus-tmp-level)
4880 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4881 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4882 gnus-summary-default-score 0)
4884 (if (or (null gnus-summary-default-score)
4885 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4886 gnus-summary-zcore-fuzz))
4888 (if (< gnus-tmp-score gnus-summary-default-score)
4889 gnus-score-below-mark gnus-score-over-mark))
4891 (cond ((memq number gnus-newsgroup-processable)
4893 ((memq number gnus-newsgroup-cached)
4895 ((memq number gnus-newsgroup-replied)
4897 ((memq number gnus-newsgroup-forwarded)
4898 gnus-forwarded-mark)
4899 ((memq number gnus-newsgroup-saved)
4901 ((memq number gnus-newsgroup-recent)
4903 ((memq number gnus-newsgroup-unseen)
4907 (cond ((memq number gnus-newsgroup-undownloaded)
4908 gnus-undownloaded-mark)
4909 (gnus-newsgroup-agentized
4910 gnus-downloaded-mark)
4913 gnus-tmp-from (mail-header-from gnus-tmp-header)
4916 ((string-match "<[^>]+> *$" gnus-tmp-from)
4917 (setq beg-match (match-beginning 0))
4918 (or (and (string-match "^\".+\"" gnus-tmp-from)
4919 (substring gnus-tmp-from 1 (1- (match-end 0))))
4920 (substring gnus-tmp-from 0 beg-match)))
4921 ((string-match "(.+)" gnus-tmp-from)
4922 (substring gnus-tmp-from
4923 (1+ (match-beginning 0)) (1- (match-end 0))))
4927 gnus-tmp-thread-tree-header-string
4929 ((not gnus-show-threads) "")
4930 ((zerop gnus-tmp-level)
4931 (cond ((cdar thread)
4932 (or gnus-sum-thread-tree-root subject))
4933 (gnus-tmp-new-adopts
4934 (or gnus-sum-thread-tree-false-root subject))
4936 (or gnus-sum-thread-tree-single-indent subject))))
4938 (concat (apply 'concat
4939 (mapcar (lambda (item)
4941 gnus-sum-thread-tree-vertical
4942 gnus-sum-thread-tree-indent))
4943 (cdr (reverse tree-stack))))
4945 gnus-sum-thread-tree-leaf-with-other
4946 gnus-sum-thread-tree-single-leaf)))))
4947 (when (string= gnus-tmp-name "")
4948 (setq gnus-tmp-name gnus-tmp-from))
4949 (unless (numberp gnus-tmp-lines)
4950 (setq gnus-tmp-lines -1))
4951 (if (= gnus-tmp-lines -1)
4952 (setq gnus-tmp-lines "?")
4953 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4954 (gnus-put-text-property
4956 (progn (eval gnus-summary-line-format-spec) (point))
4957 'gnus-number number)
4960 (gnus-run-hooks 'gnus-summary-update-hook)
4963 (setq gnus-tmp-prev-subject simp-subject)))
4965 (when (nth 1 thread)
4966 (push (list (max 0 gnus-tmp-level)
4967 (copy-sequence tree-stack)
4970 (push (if (nth 1 thread) 1 0) tree-stack)
4971 (incf gnus-tmp-level)
4972 (setq threads (if thread-end nil (cdar thread)))
4973 (if gnus-summary-display-while-building
4976 ;; use a set frequency
4977 (setq building-line-count (1- building-line-count))
4978 (when (= building-line-count 0)
4980 (setq building-line-count
4981 gnus-summary-display-while-building)))
4985 (setq gnus-tmp-level 0)))))
4986 (gnus-message 7 "Generating summary...done"))
4988 (defun gnus-summary-prepare-unthreaded (headers)
4989 "Generate an unthreaded summary buffer based on HEADERS."
4990 (let (header number mark)
4995 ;; We may have to root out some bad articles...
4996 (when (memq (setq number (mail-header-number
4997 (setq header (pop headers))))
4998 gnus-newsgroup-limit)
4999 ;; Mark article as read when it has a low score.
5000 (when (and gnus-summary-mark-below
5001 (< (or (cdr (assq number gnus-newsgroup-scored))
5002 gnus-summary-default-score 0)
5003 gnus-summary-mark-below)
5004 (not (gnus-summary-article-ancient-p number)))
5005 (setq gnus-newsgroup-unreads
5006 (delq number gnus-newsgroup-unreads))
5007 (if gnus-newsgroup-auto-expire
5008 (push number gnus-newsgroup-expirable)
5009 (push (cons number gnus-low-score-mark)
5010 gnus-newsgroup-reads)))
5012 (setq mark (gnus-article-mark number))
5013 (push (gnus-data-make number mark (1+ (point)) header 0)
5014 gnus-newsgroup-data)
5015 (gnus-summary-insert-line
5017 (memq number gnus-newsgroup-undownloaded)
5018 mark (memq number gnus-newsgroup-replied)
5019 (memq number gnus-newsgroup-expirable)
5020 (mail-header-subject header) nil
5021 (cdr (assq number gnus-newsgroup-scored))
5022 (memq number gnus-newsgroup-processable))))))
5024 (defun gnus-summary-remove-list-identifiers ()
5025 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5026 (let ((regexp (if (consp gnus-list-identifiers)
5027 (mapconcat 'identity gnus-list-identifiers " *\\|")
5028 gnus-list-identifiers))
5031 (dolist (header gnus-newsgroup-headers)
5032 (setq subject (mail-header-subject header)
5034 (while (string-match
5035 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
5038 (concat (substring subject 0 (match-beginning 2))
5039 (substring subject (match-end 0)))
5043 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
5045 (concat (substring subject 0 (match-beginning 1))
5046 (substring subject (match-end 1)))))
5048 (mail-header-set-subject header subject))))))
5050 (defun gnus-fetch-headers (articles)
5051 "Fetch headers of ARTICLES."
5052 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5053 (gnus-message 5 "Fetching headers for %s..." name)
5056 (setq gnus-headers-retrieved-by
5057 (gnus-retrieve-headers
5058 articles gnus-newsgroup-name
5059 ;; We might want to fetch old headers, but
5060 ;; not if there is only 1 article.
5062 (not (eq gnus-fetch-old-headers 'some))
5063 (not (numberp gnus-fetch-old-headers)))
5064 (> (length articles) 1))
5065 gnus-fetch-old-headers))))
5066 (gnus-get-newsgroup-headers-xover
5067 articles nil nil gnus-newsgroup-name t)
5068 (gnus-get-newsgroup-headers))
5069 (gnus-message 5 "Fetching headers for %s...done" name))))
5071 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5072 "Select newsgroup GROUP.
5073 If READ-ALL is non-nil, all articles in the group are selected.
5074 If SELECT-ARTICLES, only select those articles from GROUP."
5075 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5076 ;;!!! Dirty hack; should be removed.
5077 (gnus-summary-ignore-duplicates
5078 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5080 gnus-summary-ignore-duplicates))
5081 (info (nth 2 entry))
5082 articles fetched-articles cached)
5084 (unless (gnus-check-server
5085 (set (make-local-variable 'gnus-current-select-method)
5086 (gnus-find-method-for-group group)))
5087 (error "Couldn't open server"))
5089 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5090 (gnus-activate-group group) ; Or we can activate it...
5091 (progn ; Or we bug out.
5092 (when (equal major-mode 'gnus-summary-mode)
5093 (gnus-kill-buffer (current-buffer)))
5094 (error "Couldn't activate group %s: %s"
5095 group (gnus-status-message group))))
5097 (unless (gnus-request-group group t)
5098 (when (equal major-mode 'gnus-summary-mode)
5099 (gnus-kill-buffer (current-buffer)))
5100 (error "Couldn't request group %s: %s"
5101 group (gnus-status-message group)))
5104 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5106 (setq gnus-summary-use-undownloaded-faces
5107 (gnus-agent-find-parameter
5109 'agent-enable-undownloaded-faces)))
5111 (setq gnus-newsgroup-name group
5112 gnus-newsgroup-unselected nil
5113 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5115 (let ((display (gnus-group-find-parameter group 'display)))
5116 (setq gnus-newsgroup-display
5118 ((not (zerop (or (car-safe read-all) 0)))
5119 ;; The user entered the group with C-u SPC/RET, let's show
5125 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5127 ;; The following is probably the "correct" solution, but
5128 ;; it makes Gnus fetch all headers and then limit the
5129 ;; articles (which is slow), so instead we hack the
5130 ;; select-articles parameter instead. -- Simon Josefsson
5133 ;; (gnus-byte-compile
5134 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5136 (setq select-articles
5137 (gnus-uncompress-range
5138 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5142 (cdr (gnus-active group)))))
5147 (gnus-summary-setup-default-charset)
5149 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5150 (when (gnus-virtual-group-p group)
5151 (setq cached gnus-newsgroup-cached))
5153 (setq gnus-newsgroup-unreads
5154 (gnus-sorted-ndifference
5155 (gnus-sorted-ndifference gnus-newsgroup-unreads
5156 gnus-newsgroup-marked)
5157 gnus-newsgroup-dormant))
5159 (setq gnus-newsgroup-processable nil)
5161 (gnus-update-read-articles group gnus-newsgroup-unreads)
5163 ;; Adjust and set lists of article marks.
5165 (gnus-adjust-marked-articles info))
5166 (if (setq articles select-articles)
5167 (setq gnus-newsgroup-unselected
5168 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5169 (setq articles (gnus-articles-to-read group read-all)))
5173 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5175 ((eq articles 0) nil)
5177 ;; Init the dependencies hash table.
5178 (setq gnus-newsgroup-dependencies
5179 (gnus-make-hashtable (length articles)))
5180 (gnus-set-global-variables)
5181 ;; Retrieve the headers and read them in.
5183 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5185 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5187 (setq gnus-newsgroup-cached cached))
5189 ;; Suppress duplicates?
5190 (when gnus-suppress-duplicates
5191 (gnus-dup-suppress-articles))
5193 ;; Set the initial limit.
5194 (setq gnus-newsgroup-limit (copy-sequence articles))
5195 ;; Remove canceled articles from the list of unread articles.
5196 (setq fetched-articles
5197 (mapcar (lambda (headers) (mail-header-number headers))
5198 gnus-newsgroup-headers))
5199 (setq gnus-newsgroup-articles fetched-articles)
5200 (setq gnus-newsgroup-unreads
5201 (gnus-sorted-nintersection
5202 gnus-newsgroup-unreads fetched-articles))
5203 (gnus-compute-unseen-list)
5205 ;; Removed marked articles that do not exist.
5206 (gnus-update-missing-marks
5207 (gnus-sorted-difference articles fetched-articles))
5208 ;; We might want to build some more threads first.
5209 (when (and gnus-fetch-old-headers
5210 (eq gnus-headers-retrieved-by 'nov))
5211 (if (eq gnus-fetch-old-headers 'invisible)
5212 (gnus-build-all-threads)
5213 (gnus-build-old-threads)))
5214 ;; Let the Gnus agent mark articles as read.
5216 (gnus-agent-get-undownloaded-list))
5217 ;; Remove list identifiers from subject
5218 (when gnus-list-identifiers
5219 (gnus-summary-remove-list-identifiers))
5220 ;; Check whether auto-expire is to be done in this group.
5221 (setq gnus-newsgroup-auto-expire
5222 (gnus-group-auto-expirable-p group))
5223 ;; Set up the article buffer now, if necessary.
5224 (unless gnus-single-article-buffer
5225 (gnus-article-setup-buffer))
5226 ;; First and last article in this newsgroup.
5227 (when gnus-newsgroup-headers
5228 (setq gnus-newsgroup-begin
5229 (mail-header-number (car gnus-newsgroup-headers))
5232 (gnus-last-element gnus-newsgroup-headers))))
5233 ;; GROUP is successfully selected.
5234 (or gnus-newsgroup-headers t)))))
5236 (defun gnus-compute-unseen-list ()
5237 ;; The `seen' marks are treated specially.
5238 (if (not gnus-newsgroup-seen)
5239 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5240 (setq gnus-newsgroup-unseen
5241 (gnus-inverse-list-range-intersection
5242 gnus-newsgroup-articles gnus-newsgroup-seen))))
5244 (defun gnus-summary-display-make-predicate (display)
5245 (require 'gnus-agent)
5246 (when (= (length display) 1)
5247 (setq display (car display)))
5248 (unless gnus-summary-display-cache
5249 (dolist (elem (append '((unread . unread)
5252 gnus-article-mark-lists))
5253 (push (cons (cdr elem)
5255 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5256 gnus-summary-display-cache)))
5257 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5258 (gnus-category-predicate-cache gnus-summary-display-cache))
5259 (gnus-get-predicate display)))
5261 ;; Uses the dynamically bound `number' variable.
5264 (defun gnus-article-marked-p (type &optional article)
5265 (let ((article (or article number)))
5268 (memq article gnus-newsgroup-marked))
5270 (memq article gnus-newsgroup-spam-marked))
5272 (memq article gnus-newsgroup-unsendable))
5273 ((eq type 'undownload)
5274 (memq article gnus-newsgroup-undownloaded))
5275 ((eq type 'download)
5276 (memq article gnus-newsgroup-downloadable))
5278 (memq article gnus-newsgroup-unreads))
5280 (memq article gnus-newsgroup-reads))
5282 (memq article gnus-newsgroup-dormant) )
5284 (memq article gnus-newsgroup-expirable))
5286 (memq article gnus-newsgroup-replied))
5288 (memq article gnus-newsgroup-killed))
5289 ((eq type 'bookmark)
5290 (assq article gnus-newsgroup-bookmarks))
5292 (assq article gnus-newsgroup-scored))
5294 (memq article gnus-newsgroup-saved))
5296 (memq article gnus-newsgroup-cached))
5298 (memq article gnus-newsgroup-forwarded))
5300 (not (memq article gnus-newsgroup-unseen)))
5302 (memq article gnus-newsgroup-recent))
5305 (defun gnus-articles-to-read (group &optional read-all)
5306 "Find out what articles the user wants to read."
5307 (let* ((display (gnus-group-find-parameter group 'display))
5309 ;; Select all articles if `read-all' is non-nil, or if there
5310 ;; are no unread articles.
5312 (and (zerop (length gnus-newsgroup-marked))
5313 (zerop (length gnus-newsgroup-unreads)))
5314 ;; Fetch all if the predicate is non-nil.
5315 gnus-newsgroup-display)
5316 ;; We want to select the headers for all the articles in
5317 ;; the group, so we select either all the active
5318 ;; articles in the group, or (if that's nil), the
5319 ;; articles in the cache.
5321 (gnus-uncompress-range (gnus-active group))
5322 (gnus-cache-articles-in-group group))
5323 ;; Select only the "normal" subset of articles.
5325 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5326 gnus-newsgroup-unreads)))
5327 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5328 (scored (length scored-list))
5329 (number (length articles))
5330 (marked (+ (length gnus-newsgroup-marked)
5331 (length gnus-newsgroup-dormant)))
5336 ((numberp gnus-newsgroup-display)
5337 gnus-newsgroup-display)
5341 ((and (or (<= scored marked) (= scored number))
5342 (numberp gnus-large-newsgroup)
5343 (> number gnus-large-newsgroup))
5344 (let* ((cursor-in-echo-area nil)
5345 (initial (gnus-parameter-large-newsgroup-initial
5346 gnus-newsgroup-name))
5350 "How many articles from %s (%s %d): "
5352 (gnus-group-decoded-name gnus-newsgroup-name)
5354 (if initial "max" "default")
5357 (cons (number-to-string initial)
5359 (if (string-match "^[ \t]*$" input) number input)))
5360 ((and (> scored marked) (< scored number)
5361 (> (- scored number) 20))
5364 (format "%s %s (%d scored, %d total): "
5365 "How many articles from"
5366 (gnus-group-decoded-name group)
5368 (if (string-match "^[ \t]*$" input)
5372 (message "Quit getting the articles to read")
5374 (setq select (if (stringp select) (string-to-number select) select))
5375 (if (or (null select) (zerop select))
5377 (if (and (not (zerop scored)) (<= (abs select) scored))
5379 (setq articles (sort scored-list '<))
5380 (setq number (length articles)))
5381 (setq articles (copy-sequence articles)))
5383 (when (< (abs select) number)
5385 ;; Select the N oldest articles.
5386 (setcdr (nthcdr (1- (abs select)) articles) nil)
5387 ;; Select the N most recent articles.
5388 (setq articles (nthcdr (- number select) articles))))
5389 (setq gnus-newsgroup-unselected
5390 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5391 (when gnus-alter-articles-to-read-function
5394 (funcall gnus-alter-articles-to-read-function
5395 gnus-newsgroup-name articles)
5399 (defun gnus-killed-articles (killed articles)
5402 (when (inline (gnus-member-of-range (car articles) killed))
5403 (push (car articles) out))
5404 (setq articles (cdr articles)))
5407 (defun gnus-uncompress-marks (marks)
5408 "Uncompress the mark ranges in MARKS."
5409 (let ((uncompressed '(score bookmark))
5412 (if (memq (caar marks) uncompressed)
5413 (push (car marks) out)
5414 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5415 (setq marks (cdr marks)))
5418 (defun gnus-article-mark-to-type (mark)
5419 "Return the type of MARK."
5420 (or (cadr (assq mark gnus-article-special-mark-lists))
5423 (defun gnus-article-unpropagatable-p (mark)
5424 "Return whether MARK should be propagated to back end."
5425 (memq mark gnus-article-unpropagated-mark-lists))
5427 (defun gnus-adjust-marked-articles (info)
5428 "Set all article lists and remove all marks that are no longer valid."
5429 (let* ((marked-lists (gnus-info-marks info))
5430 (active (gnus-active (gnus-info-group info)))
5433 (types gnus-article-mark-lists)
5434 marks var articles article mark mark-type
5437 (dolist (marks marked-lists)
5438 (setq mark (car marks)
5439 mark-type (gnus-article-mark-to-type mark)
5440 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5442 ;; We set the variable according to the type of the marks list,
5443 ;; and then adjust the marks to a subset of the active articles.
5445 ;; Adjust "simple" lists - compressed yet unsorted
5446 ((eq mark-type 'list)
5447 ;; Simultaneously uncompress and clip to active range
5448 ;; See gnus-uncompress-range for a description of possible marks
5450 (if (not (cadr marks))
5452 (setq articles (if (numberp (cddr marks))
5458 (while (setq article (pop articles))
5459 (cond ((consp article)
5460 (setq bgn (max (car article) min)
5461 end (min (cdr article) max))
5463 (setq l (setcdr l (cons bgn nil))
5465 ((and (<= min article)
5467 (setq l (setcdr l (cons article nil))))))
5468 (set var (cdr lh)))))
5470 ((eq mark-type 'tuple)
5471 (set var (setq articles (cdr marks)))
5472 (when (not (listp (cdr (symbol-value var))))
5473 (set var (list (symbol-value var))))
5474 (when (not (listp (cdr articles)))
5475 (setq articles (list articles)))
5477 (when (or (not (consp (setq article (pop articles))))
5478 (< (car article) min)
5479 (> (car article) max))
5480 (set var (delq article (symbol-value var))))))
5481 ;; Adjust ranges (sloppily).
5482 ((eq mark-type 'range)
5485 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5486 ;; It should be (seen (NUM1 . NUM2)).
5487 (when (numberp (cddr marks))
5488 (setcdr marks (list (cdr marks))))
5489 (setq articles (cdr marks))
5490 (while (and articles
5491 (or (and (consp (car articles))
5492 (> min (cdar articles)))
5493 (and (numberp (car articles))
5494 (> min (car articles)))))
5496 (set var articles))))))))
5498 (defun gnus-update-missing-marks (missing)
5499 "Go through the list of MISSING articles and remove them from the mark lists."
5502 ;; Go through all types.
5503 (dolist (elem gnus-article-mark-lists)
5504 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5505 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5506 (when (symbol-value var)
5507 ;; This list has articles. So we delete all missing
5508 ;; articles from it.
5511 (set var (delq (pop m) (symbol-value var))))))))))
5513 (defun gnus-update-marks ()
5514 "Enter the various lists of marked articles into the newsgroup info list."
5515 (let ((types gnus-article-mark-lists)
5516 (info (gnus-get-info gnus-newsgroup-name))
5517 type list newmarked symbol delta-marks)
5519 ;; Add all marks lists to the list of marks lists.
5520 (while (setq type (pop types))
5521 (setq list (symbol-value
5523 (intern (format "gnus-newsgroup-%s" (car type))))))
5526 ;; Get rid of the entries of the articles that have the
5528 (when (and (eq (cdr type) 'score)
5532 (prev (cons nil list))
5535 (if (or (not (consp (car arts)))
5536 (= (cdar arts) gnus-summary-default-score))
5537 (setcdr prev (cdr arts))
5539 (setq arts (cdr arts)))
5540 (setq list (cdr all)))))
5542 (when (eq (cdr type) 'seen)
5543 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5545 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5546 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5548 (when (and (gnus-check-backend-function
5549 'request-set-mark gnus-newsgroup-name)
5550 (not (gnus-article-unpropagatable-p (cdr type))))
5551 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5552 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5553 (add (gnus-remove-from-range
5554 (gnus-copy-sequence list) old)))
5556 (push (list add 'add (list (cdr type))) delta-marks))
5558 (push (list del 'del (list (cdr type))) delta-marks))))
5561 (push (cons (cdr type) list) newmarked)))
5564 (unless (gnus-check-group gnus-newsgroup-name)
5565 (error "Can't open server for %s" gnus-newsgroup-name))
5566 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5568 ;; Enter these new marks into the info of the group.
5570 (setcar (nthcdr 3 info) newmarked)
5571 ;; Add the marks lists to the end of the info.
5573 (setcdr (nthcdr 2 info) (list newmarked))))
5575 ;; Cut off the end of the info if there's nothing else there.
5579 (when (nthcdr (decf i) info)
5580 (setcdr (nthcdr i info) nil)))))))
5582 (defun gnus-set-mode-line (where)
5583 "Set the mode line of the article or summary buffers.
5584 If WHERE is `summary', the summary mode line format will be used."
5585 ;; Is this mode line one we keep updated?
5586 (when (and (memq where gnus-updated-mode-lines)
5588 (intern (format "gnus-%s-mode-line-format-spec" where))))
5591 ;; We evaluate this in the summary buffer since these
5592 ;; variables are buffer-local to that buffer.
5593 (set-buffer gnus-summary-buffer)
5594 ;; We bind all these variables that are used in the `eval' form
5596 (let* ((mformat (symbol-value
5598 (format "gnus-%s-mode-line-format-spec" where))))
5599 (gnus-tmp-group-name (gnus-group-decoded-name
5600 gnus-newsgroup-name))
5601 (gnus-tmp-article-number (or gnus-current-article 0))
5602 (gnus-tmp-unread gnus-newsgroup-unreads)
5603 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5604 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5605 (gnus-tmp-unread-and-unselected
5606 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5607 (zerop gnus-tmp-unselected))
5609 ((zerop gnus-tmp-unselected)
5610 (format "{%d more}" gnus-tmp-unread-and-unticked))
5611 (t (format "{%d(+%d) more}"
5612 gnus-tmp-unread-and-unticked
5613 gnus-tmp-unselected))))
5615 (if (and gnus-current-headers
5616 (vectorp gnus-current-headers))
5617 (gnus-mode-string-quote
5618 (mail-header-subject gnus-current-headers))
5620 bufname-length max-len
5621 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5622 (setq mode-string (eval mformat))
5623 (setq bufname-length (if (string-match "%b" mode-string)
5626 (if (eq where 'summary)
5628 (get-buffer gnus-article-buffer))))
5631 (setq max-len (max 4 (if gnus-mode-non-string-length
5633 gnus-mode-non-string-length
5635 (length mode-string))))
5636 ;; We might have to chop a bit of the string off...
5637 (when (> (length mode-string) max-len)
5639 (concat (truncate-string-to-width mode-string (- max-len 3))
5641 ;; Pad the mode string a bit.
5642 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5643 ;; Update the mode line.
5644 (setq mode-line-buffer-identification
5645 (gnus-mode-line-buffer-identification (list mode-string)))
5646 (set-buffer-modified-p t))))
5648 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5649 "Go through the HEADERS list and add all Xrefs to a hash table.
5650 The resulting hash table is returned, or nil if no Xrefs were found."
5651 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5652 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5653 (xref-hashtb (gnus-make-hashtable))
5654 start group entry number xrefs header)
5656 (setq header (pop headers))
5657 (when (and (setq xrefs (mail-header-xref header))
5658 (not (memq (setq number (mail-header-number header))
5661 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5662 (setq start (match-end 0))
5663 (setq group (if prefix
5664 (concat prefix (substring xrefs (match-beginning 1)
5666 (substring xrefs (match-beginning 1) (match-end 1))))
5668 (string-to-number (substring xrefs (match-beginning 2)
5670 (if (setq entry (gnus-gethash group xref-hashtb))
5671 (setcdr entry (cons number (cdr entry)))
5672 (gnus-sethash group (cons number nil) xref-hashtb)))))
5673 (and start xref-hashtb)))
5675 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5676 "Look through all the headers and mark the Xrefs as read."
5677 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5678 name entry info xref-hashtb idlist method nth4)
5680 (set-buffer gnus-group-buffer)
5681 (when (setq xref-hashtb
5682 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5685 (unless (string= from-newsgroup (setq name (symbol-name group)))
5686 (setq idlist (symbol-value group))
5687 ;; Dead groups are not updated.
5689 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5691 (when (stringp (setq nth4 (gnus-info-method info)))
5692 (setq nth4 (gnus-server-to-method nth4))))
5693 ;; Only do the xrefs if the group has the same
5694 ;; select method as the group we have just read.
5695 (or (gnus-methods-equal-p
5696 nth4 (gnus-find-method-for-group from-newsgroup))
5698 (equal nth4 (setq method (gnus-find-method-for-group
5700 (and (equal (car nth4) (car method))
5701 (equal (nth 1 nth4) (nth 1 method))))
5702 gnus-use-cross-reference
5703 (or (not (eq gnus-use-cross-reference t))
5705 ;; Only do cross-references on subscribed
5706 ;; groups, if that is what is wanted.
5707 (<= (gnus-info-level info) gnus-level-subscribed))
5708 (gnus-group-make-articles-read name idlist))))
5711 (defun gnus-compute-read-articles (group articles)
5712 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5713 (info (nth 2 entry))
5714 (active (gnus-active group))
5717 ;; First peel off all invalid article numbers.
5719 (let ((ids articles)
5721 (while (setq id (pop ids))
5722 (when (and first (> id (cdr active)))
5723 ;; We'll end up in this situation in one particular
5724 ;; obscure situation. If you re-scan a group and get
5725 ;; a new article that is cross-posted to a different
5726 ;; group that has not been re-scanned, you might get
5727 ;; crossposted article that has a higher number than
5728 ;; Gnus believes possible. So we re-activate this
5729 ;; group as well. This might mean doing the
5730 ;; crossposting thingy will *increase* the number
5731 ;; of articles in some groups. Tsk, tsk.
5732 (setq active (or (gnus-activate-group group) active)))
5733 (when (or (> id (cdr active))
5734 (< id (car active)))
5735 (setq articles (delq id articles))))))
5736 ;; If the read list is nil, we init it.
5738 (null (gnus-info-read info))
5740 (setq ninfo (cons 1 (1- (car active))))
5741 (setq ninfo (gnus-info-read info)))
5742 ;; Then we add the read articles to the range.
5744 ninfo (setq articles (sort articles '<))))))
5746 (defun gnus-group-make-articles-read (group articles)
5747 "Update the info of GROUP to say that ARTICLES are read."
5749 (entry (gnus-gethash group gnus-newsrc-hashtb))
5750 (info (nth 2 entry))
5751 (active (gnus-active group))
5754 (setq range (gnus-compute-read-articles group articles))
5756 (set-buffer gnus-group-buffer)
5759 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5760 (gnus-info-set-read ',info ',(gnus-info-read info))
5761 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5762 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5763 (gnus-group-update-group ,group t))))
5764 ;; Add the read articles to the range.
5765 (gnus-info-set-read info range)
5766 (gnus-request-set-mark group (list (list range 'add '(read))))
5767 ;; Then we have to re-compute how many unread
5768 ;; articles there are in this group.
5772 (setq num (- (1+ (cdr active)) (car active))))
5773 ((not (listp (cdr range)))
5774 (setq num (- (cdr active) (- (1+ (cdr range))
5778 (if (numberp (car range))
5780 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5781 (setq range (cdr range)))
5782 (setq num (- (cdr active) num))))
5783 ;; Update the number of unread articles.
5785 ;; Update the group buffer.
5786 (unless (gnus-ephemeral-group-p group)
5787 (gnus-group-update-group group t))))))
5789 (defvar gnus-newsgroup-none-id 0)
5791 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5792 (let ((cur nntp-server-buffer)
5795 (save-excursion (set-buffer gnus-summary-buffer)
5796 gnus-newsgroup-dependencies)))
5798 (mail-parse-charset gnus-newsgroup-charset)
5799 (mail-parse-ignored-charsets
5800 (save-excursion (condition-case nil
5801 (set-buffer gnus-summary-buffer)
5803 gnus-newsgroup-ignored-charsets)))
5805 (set-buffer nntp-server-buffer)
5806 ;; Translate all TAB characters into SPACE characters.
5807 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5808 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5809 (ietf-drums-unfold-fws)
5810 (gnus-run-hooks 'gnus-parse-headers-hook)
5811 (let ((case-fold-search t)
5812 in-reply-to header p lines chars)
5813 (goto-char (point-min))
5814 ;; Search to the beginning of the next header. Error messages
5815 ;; do not begin with 2 or 3.
5816 (while (re-search-forward "^[23][0-9]+ " nil t)
5819 ;; This implementation of this function, with nine
5820 ;; search-forwards instead of the one re-search-forward and
5821 ;; a case (which basically was the old function) is actually
5822 ;; about twice as fast, even though it looks messier. You
5823 ;; can't have everything, I guess. Speed and elegance
5824 ;; doesn't always go hand in hand.
5833 (narrow-to-region (point)
5834 (or (and (search-forward "\n.\n" nil t)
5840 (if (search-forward "\nsubject:" nil t)
5841 (funcall gnus-decode-encoded-word-function
5842 (nnheader-header-value))
5847 (if (search-forward "\nfrom:" nil t)
5848 (funcall gnus-decode-encoded-word-function
5849 (nnheader-header-value))
5854 (if (search-forward "\ndate:" nil t)
5855 (nnheader-header-value) ""))
5859 (setq id (if (re-search-forward
5860 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5861 ;; We do it this way to make sure the Message-ID
5862 ;; is (somewhat) syntactically valid.
5863 (buffer-substring (match-beginning 1)
5865 ;; If there was no message-id, we just fake one
5866 ;; to make subsequent routines simpler.
5867 (nnheader-generate-fake-message-id))))
5871 (if (search-forward "\nreferences:" nil t)
5875 (nnheader-header-value)
5880 (search-backward ">" end t)
5883 (search-backward "<" end t)
5885 ;; Get the references from the in-reply-to header if there
5886 ;; were no references and the in-reply-to header looks
5888 (if (and (search-forward "\nin-reply-to:" nil t)
5889 (setq in-reply-to (nnheader-header-value))
5890 (string-match "<[^>]+>" in-reply-to))
5892 (setq ref (substring in-reply-to (match-beginning 0)
5894 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5895 (setq ref2 (substring in-reply-to (match-beginning 0)
5897 (when (> (length ref2) (length ref))
5904 (if (search-forward "\nchars: " nil t)
5905 (if (numberp (setq chars (ignore-errors (read cur))))
5911 (if (search-forward "\nlines: " nil t)
5912 (if (numberp (setq lines (ignore-errors (read cur))))
5918 (and (search-forward "\nxref:" nil t)
5919 (nnheader-header-value)))
5921 (when gnus-extra-headers
5922 (let ((extra gnus-extra-headers)
5926 (when (search-forward
5927 (concat "\n" (symbol-name (car extra)) ":") nil t)
5928 (push (cons (car extra) (nnheader-header-value))
5932 (when (equal id ref)
5935 (when gnus-alter-header-function
5936 (funcall gnus-alter-header-function header)
5937 (setq id (mail-header-id header)
5938 ref (gnus-parent-id (mail-header-references header))))
5941 (gnus-dependencies-add-header
5942 header dependencies force-new))
5943 (push header headers))
5944 (goto-char (point-max))
5946 (nreverse headers)))))
5948 ;; Goes through the xover lines and returns a list of vectors
5949 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5950 force-new dependencies
5951 group also-fetch-heads)
5952 "Parse the news overview data in the server buffer.
5953 Return a list of headers that match SEQUENCE (see
5954 `nntp-retrieve-headers')."
5955 ;; Get the Xref when the users reads the articles since most/some
5956 ;; NNTP servers do not include Xrefs when using XOVER.
5957 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5958 (let ((mail-parse-charset gnus-newsgroup-charset)
5959 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5960 (cur nntp-server-buffer)
5961 (dependencies (or dependencies gnus-newsgroup-dependencies))
5963 ((eq gnus-read-all-available-headers t)
5965 ((stringp gnus-read-all-available-headers)
5966 (string-match gnus-read-all-available-headers group))
5969 number headers header)
5971 (set-buffer nntp-server-buffer)
5972 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5973 ;; Allow the user to mangle the headers before parsing them.
5974 (gnus-run-hooks 'gnus-parse-headers-hook)
5975 (goto-char (point-min))
5976 (gnus-parse-without-error
5977 (while (and (or sequence allp)
5979 (setq number (read cur))
5981 (while (and sequence
5982 (< (car sequence) number))
5983 (setq sequence (cdr sequence))))
5986 (eq number (car sequence))))
5988 (setq sequence (cdr sequence))
5989 (setq header (inline
5990 (gnus-nov-parse-line
5991 number dependencies force-new)))))
5992 (push header headers))
5994 ;; A common bug in inn is that if you have posted an article and
5995 ;; then retrieves the active file, it will answer correctly --
5996 ;; the new article is included. However, a NOV entry for the
5997 ;; article may not have been generated yet, so this may fail.
5998 ;; We work around this problem by retrieving the last few
5999 ;; headers using HEAD.
6000 (if (or (not also-fetch-heads)
6002 ;; We (probably) got all the headers.
6004 (let ((gnus-nov-is-evil t))
6007 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6008 (gnus-get-newsgroup-headers))))))))
6010 (defun gnus-article-get-xrefs ()
6011 "Fill in the Xref value in `gnus-current-headers', if necessary.
6012 This is meant to be called in `gnus-article-internal-prepare-hook'."
6013 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
6014 gnus-current-headers)))
6015 (or (not gnus-use-cross-reference)
6017 (and (mail-header-xref headers)
6018 (not (string= (mail-header-xref headers) "")))
6019 (let ((case-fold-search t)
6022 (nnheader-narrow-to-headers)
6023 (goto-char (point-min))
6024 (when (or (and (not (eobp))
6025 (eq (downcase (char-after)) ?x)
6026 (looking-at "Xref:"))
6027 (search-forward "\nXref:" nil t))
6028 (goto-char (1+ (match-end 0)))
6029 (setq xref (buffer-substring (point) (gnus-point-at-eol)))
6030 (mail-header-set-xref headers xref)))))))
6032 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6033 "Find article ID and insert the summary line for that article.
6034 OLD-HEADER can either be a header or a line number to insert
6035 the subject line on."
6036 (let* ((line (and (numberp old-header) old-header))
6037 (old-header (and (vectorp old-header) old-header))
6038 (header (cond ((and old-header use-old-header)
6041 (gnus-number-to-header id))
6042 (gnus-number-to-header id))
6044 (gnus-read-header id))))
6045 (number (and (numberp id) id))
6048 ;; Rebuild the thread that this article is part of and go to the
6049 ;; article we have fetched.
6050 (when (and (not gnus-show-threads)
6053 (setq d (gnus-data-find (mail-header-number old-header))))
6054 (goto-char (gnus-data-pos d))
6057 (- (gnus-point-at-bol)
6059 (1+ (gnus-point-at-eol))
6060 (gnus-delete-line))))))
6061 ;; Remove list identifiers from subject.
6062 (when gnus-list-identifiers
6063 (let ((gnus-newsgroup-headers (list header)))
6064 (gnus-summary-remove-list-identifiers)))
6066 (mail-header-set-number header (mail-header-number old-header)))
6067 (setq gnus-newsgroup-sparse
6068 (delq (setq number (mail-header-number header))
6069 gnus-newsgroup-sparse))
6070 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6071 (push number gnus-newsgroup-limit)
6072 (gnus-rebuild-thread (mail-header-id header) line)
6073 (gnus-summary-goto-subject number nil t))
6074 (when (and (numberp number)
6076 ;; We have to update the boundaries even if we can't fetch the
6077 ;; article if ID is a number -- so that the next `P' or `N'
6078 ;; command will fetch the previous (or next) article even
6079 ;; if the one we tried to fetch this time has been canceled.
6080 (when (> number gnus-newsgroup-end)
6081 (setq gnus-newsgroup-end number))
6082 (when (< number gnus-newsgroup-begin)
6083 (setq gnus-newsgroup-begin number))
6084 (setq gnus-newsgroup-unselected
6085 (delq number gnus-newsgroup-unselected)))
6086 ;; Report back a success?
6087 (and header (mail-header-number header))))
6089 ;;; Process/prefix in the summary buffer
6091 (defun gnus-summary-work-articles (n)
6092 "Return a list of articles to be worked upon.
6093 The prefix argument, the list of process marked articles, and the
6094 current article will be taken into consideration."
6096 (set-buffer gnus-summary-buffer)
6099 ;; A numerical prefix has been given.
6100 (setq n (prefix-numeric-value n))
6101 (let ((backward (< n 0))
6102 (n (abs (prefix-numeric-value n)))
6107 (push (setq article (gnus-summary-article-number))
6110 (gnus-summary-find-prev nil article)
6111 (gnus-summary-find-next nil article)))
6113 (nreverse articles)))
6114 ((and (gnus-region-active-p) (mark))
6115 (message "region active")
6116 ;; Work on the region between point and mark.
6117 (let ((max (max (point) (mark)))
6120 (goto-char (min (point) (mark)))
6123 (push (setq article (gnus-summary-article-number)) articles)
6124 (gnus-summary-find-next nil article)
6126 (nreverse articles))))
6127 (gnus-newsgroup-processable
6128 ;; There are process-marked articles present.
6129 ;; Save current state.
6130 (gnus-summary-save-process-mark)
6132 (reverse gnus-newsgroup-processable))
6134 ;; Just return the current article.
6135 (list (gnus-summary-article-number))))))
6137 (defmacro gnus-summary-iterate (arg &rest forms)
6138 "Iterate over the process/prefixed articles and do FORMS.
6139 ARG is the interactive prefix given to the command. FORMS will be
6140 executed with point over the summary line of the articles."
6141 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6142 `(let ((,articles (gnus-summary-work-articles ,arg)))
6144 (gnus-summary-goto-subject (car ,articles))
6148 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6149 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6151 (defun gnus-summary-save-process-mark ()
6152 "Push the current set of process marked articles on the stack."
6154 (push (copy-sequence gnus-newsgroup-processable)
6155 gnus-newsgroup-process-stack))
6157 (defun gnus-summary-kill-process-mark ()
6158 "Push the current set of process marked articles on the stack and unmark."
6160 (gnus-summary-save-process-mark)
6161 (gnus-summary-unmark-all-processable))
6163 (defun gnus-summary-yank-process-mark ()
6164 "Pop the last process mark state off the stack and restore it."
6166 (unless gnus-newsgroup-process-stack
6167 (error "Empty mark stack"))
6168 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6170 (defun gnus-summary-process-mark-set (set)
6171 "Make SET into the current process marked articles."
6172 (gnus-summary-unmark-all-processable)
6174 (gnus-summary-set-process-mark (pop set))))
6176 ;;; Searching and stuff
6178 (defun gnus-summary-search-group (&optional backward use-level)
6179 "Search for next unread newsgroup.
6180 If optional argument BACKWARD is non-nil, search backward instead."
6182 (set-buffer gnus-group-buffer)
6183 (when (gnus-group-search-forward
6184 backward nil (if use-level (gnus-group-group-level) nil))
6185 (gnus-group-group-name))))
6187 (defun gnus-summary-best-group (&optional exclude-group)
6188 "Find the name of the best unread group.
6189 If EXCLUDE-GROUP, do not go to this group."
6191 (set-buffer gnus-group-buffer)
6193 (gnus-group-best-unread-group exclude-group))))
6195 (defun gnus-summary-find-next (&optional unread article backward)
6197 (gnus-summary-find-prev unread article)
6198 (let* ((dummy (gnus-summary-article-intangible-p))
6199 (article (or article (gnus-summary-article-number)))
6200 (data (gnus-data-find-list article))
6202 (when (and (not dummy)
6203 (or (not gnus-summary-check-current)
6205 (not (gnus-data-unread-p (car data)))))
6206 (setq data (cdr data)))
6211 (unless (memq (gnus-data-number (car data))
6213 ((eq gnus-auto-goto-ignores
6214 'always-undownloaded)
6215 gnus-newsgroup-undownloaded)
6218 ((eq gnus-auto-goto-ignores
6220 gnus-newsgroup-unfetched)
6221 ((eq gnus-auto-goto-ignores
6223 gnus-newsgroup-undownloaded)))
6224 (when (gnus-data-unread-p (car data))
6225 (setq result (car data)
6227 (setq data (cdr data)))
6230 (goto-char (gnus-data-pos result))
6231 (gnus-data-number result)))))
6233 (defun gnus-summary-find-prev (&optional unread article)
6234 (let* ((eobp (eobp))
6235 (article (or article (gnus-summary-article-number)))
6236 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6238 (when (and (not eobp)
6239 (or (not gnus-summary-check-current)
6241 (not (gnus-data-unread-p (car data)))))
6242 (setq data (cdr data)))
6247 (unless (memq (gnus-data-number (car data))
6249 ((eq gnus-auto-goto-ignores
6250 'always-undownloaded)
6251 gnus-newsgroup-undownloaded)
6254 ((eq gnus-auto-goto-ignores
6256 gnus-newsgroup-unfetched)
6257 ((eq gnus-auto-goto-ignores
6259 gnus-newsgroup-undownloaded)))
6260 (when (gnus-data-unread-p (car data))
6261 (setq result (car data)
6263 (setq data (cdr data)))
6266 (goto-char (gnus-data-pos result))
6267 (gnus-data-number result))))
6269 (defun gnus-summary-find-subject (subject &optional unread backward article)
6270 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6271 (article (or article (gnus-summary-article-number)))
6272 (articles (gnus-data-list backward))
6273 (arts (gnus-data-find-list article articles))
6275 (when (or (not gnus-summary-check-current)
6277 (not (gnus-data-unread-p (car arts))))
6278 (setq arts (cdr arts)))
6280 (and (or (not unread)
6281 (gnus-data-unread-p (car arts)))
6282 (vectorp (gnus-data-header (car arts)))
6284 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6285 (setq result (car arts)
6287 (setq arts (cdr arts)))
6289 (goto-char (gnus-data-pos result))
6290 (gnus-data-number result))))
6292 (defun gnus-summary-search-forward (&optional unread subject backward)
6293 "Search forward for an article.
6294 If UNREAD, look for unread articles. If SUBJECT, look for
6295 articles with that subject. If BACKWARD, search backward instead."
6296 (cond (subject (gnus-summary-find-subject subject unread backward))
6297 (backward (gnus-summary-find-prev unread))
6298 (t (gnus-summary-find-next unread))))
6300 (defun gnus-recenter (&optional n)
6301 "Center point in window and redisplay frame.
6302 Also do horizontal recentering."
6304 (when (and gnus-auto-center-summary
6305 (not (eq gnus-auto-center-summary 'vertical)))
6306 (gnus-horizontal-recenter))
6309 (defun gnus-summary-recenter ()
6310 "Center point in the summary window.
6311 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6312 displayed, no centering will be performed."
6313 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6314 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6316 ;; The user has to want it.
6317 (when gnus-auto-center-summary
6318 (let* ((top (cond ((< (window-height) 4) 0)
6319 ((< (window-height) 7) 1)
6320 (t (if (numberp gnus-auto-center-summary)
6321 gnus-auto-center-summary
6323 (height (1- (window-height)))
6324 (bottom (save-excursion (goto-char (point-max))
6325 (forward-line (- height))
6327 (window (get-buffer-window (current-buffer))))
6328 (when (get-buffer-window gnus-article-buffer)
6329 ;; Only do recentering when the article buffer is displayed,
6330 ;; Set the window start to either `bottom', which is the biggest
6331 ;; possible valid number, or the second line from the top,
6332 ;; whichever is the least.
6333 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6334 (if (> bottom top-pos)
6335 ;; Keep the second line from the top visible
6336 (set-window-start window top-pos t)
6337 ;; Try to keep the bottom line visible; if it's partially
6338 ;; obscured, either scroll one more line to make it fully
6339 ;; visible, or revert to using TOP-POS.
6341 (goto-char (point-max))
6343 (let ((last-line-start (point)))
6345 (set-window-start window (point) t)
6346 (when (not (pos-visible-in-window-p last-line-start window))
6348 (set-window-start window (min (point) top-pos) t)))))))
6349 ;; Do horizontal recentering while we're at it.
6350 (when (and (get-buffer-window (current-buffer) t)
6351 (not (eq gnus-auto-center-summary 'vertical)))
6352 (let ((selected (selected-window)))
6353 (select-window (get-buffer-window (current-buffer) t))
6354 (gnus-summary-position-point)
6355 (gnus-horizontal-recenter)
6356 (select-window selected))))))
6358 (defun gnus-summary-jump-to-group (newsgroup)
6359 "Move point to NEWSGROUP in group mode buffer."
6360 ;; Keep update point of group mode buffer if visible.
6361 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6362 (save-window-excursion
6363 ;; Take care of tree window mode.
6364 (when (get-buffer-window gnus-group-buffer)
6365 (pop-to-buffer gnus-group-buffer))
6366 (gnus-group-jump-to-group newsgroup))
6368 ;; Take care of tree window mode.
6369 (if (get-buffer-window gnus-group-buffer)
6370 (pop-to-buffer gnus-group-buffer)
6371 (set-buffer gnus-group-buffer))
6372 (gnus-group-jump-to-group newsgroup))))
6374 ;; This function returns a list of article numbers based on the
6375 ;; difference between the ranges of read articles in this group and
6376 ;; the range of active articles.
6377 (defun gnus-list-of-unread-articles (group)
6378 (let* ((read (gnus-info-read (gnus-get-info group)))
6379 (active (or (gnus-active group) (gnus-activate-group group)))
6382 ;; If none are read, then all are unread.
6384 (setq first (car active))
6385 ;; If the range of read articles is a single range, then the
6386 ;; first unread article is the article after the last read
6387 ;; article. Sounds logical, doesn't it?
6388 (if (and (not (listp (cdr read)))
6389 (or (< (car read) (car active))
6390 (progn (setq read (list read))
6392 (setq first (max (car active) (1+ (cdr read))))
6393 ;; `read' is a list of ranges.
6394 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6397 (setq first (car active)))
6400 (while (< first nlast)
6401 (setq unread (cons first unread)
6403 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6404 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6405 (setq read (cdr read)))))
6406 ;; And add the last unread articles.
6407 (while (<= first last)
6408 (setq unread (cons first unread)
6410 ;; Return the list of unread articles.
6411 (delq 0 (nreverse unread))))
6413 (defun gnus-list-of-read-articles (group)
6414 "Return a list of unread, unticked and non-dormant articles."
6415 (let* ((info (gnus-get-info group))
6416 (marked (gnus-info-marks info))
6417 (active (gnus-active group)))
6419 (gnus-list-range-difference
6420 (gnus-list-range-difference
6421 (gnus-sorted-complement
6422 (gnus-uncompress-range active)
6423 (gnus-list-of-unread-articles group))
6424 (cdr (assq 'dormant marked)))
6425 (cdr (assq 'tick marked))))))
6427 ;; This function returns a sequence of article numbers based on the
6428 ;; difference between the ranges of read articles in this group and
6429 ;; the range of active articles.
6430 (defun gnus-sequence-of-unread-articles (group)
6431 (let* ((read (gnus-info-read (gnus-get-info group)))
6432 (active (or (gnus-active group) (gnus-activate-group group)))
6435 ;; If none are read, then all are unread.
6437 (setq first (car active))
6438 ;; If the range of read articles is a single range, then the
6439 ;; first unread article is the article after the last read
6440 ;; article. Sounds logical, doesn't it?
6441 (if (and (not (listp (cdr read)))
6442 (or (< (car read) (car active))
6443 (progn (setq read (list read))
6445 (setq first (max (car active) (1+ (cdr read))))
6446 ;; `read' is a list of ranges.
6447 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6450 (setq first (car active)))
6453 (push (cons first nlast) unread))
6454 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6455 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6456 (setq read (cdr read)))))
6457 ;; And add the last unread articles.
6458 (cond ((not (and first last))
6461 (push (cons first last) unread))
6463 (push first unread)))
6464 ;; Return the sequence of unread articles.
6465 (delq 0 (nreverse unread))))
6467 ;; Various summary commands
6469 (defun gnus-summary-select-article-buffer ()
6470 "Reconfigure windows to show article buffer."
6472 (if (not (gnus-buffer-live-p gnus-article-buffer))
6473 (error "There is no article buffer for this summary buffer")
6474 (gnus-configure-windows 'article)
6475 (select-window (get-buffer-window gnus-article-buffer))))
6477 (defun gnus-summary-universal-argument (arg)
6478 "Perform any operation on all articles that are process/prefixed."
6480 (let ((articles (gnus-summary-work-articles arg))
6487 (substitute-command-keys
6488 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6490 (gnus-error 1 "Undefined key")
6493 (gnus-summary-goto-subject (setq article (pop articles)))
6494 (let (gnus-newsgroup-processable)
6495 (command-execute func))
6496 (gnus-summary-remove-process-mark article)))))
6497 (gnus-summary-position-point))
6499 (defun gnus-summary-toggle-truncation (&optional arg)
6500 "Toggle truncation of summary lines.
6501 With ARG, turn line truncation on if ARG is positive."
6503 (setq truncate-lines
6504 (if (null arg) (not truncate-lines)
6505 (> (prefix-numeric-value arg) 0)))
6508 (defun gnus-summary-find-for-reselect ()
6509 "Return the number of an article to stay on across a reselect.
6510 The current article is considered, then following articles, then previous
6511 articles. An article is sought which is not cancelled and isn't a temporary
6512 insertion from another group. If there's no such then return a dummy 0."
6514 (dolist (rev '(nil t))
6515 (unless found ; don't demand the reverse list if we don't need it
6516 (let ((data (gnus-data-find-list
6517 (gnus-summary-article-number) (gnus-data-list rev))))
6518 (while (and data (not found))
6519 (if (and (< 0 (gnus-data-number (car data)))
6520 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6521 (setq found (gnus-data-number (car data))))
6522 (setq data (cdr data))))))
6525 (defun gnus-summary-reselect-current-group (&optional all rescan)
6526 "Exit and then reselect the current newsgroup.
6527 The prefix argument ALL means to select all articles."
6529 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6530 (error "Ephemeral groups can't be reselected"))
6531 (let ((current-subject (gnus-summary-find-for-reselect))
6532 (group gnus-newsgroup-name))
6533 (setq gnus-newsgroup-begin nil)
6534 (gnus-summary-exit nil 'leave-hidden)
6535 ;; We have to adjust the point of group mode buffer because
6536 ;; point was moved to the next unread newsgroup by exiting.
6537 (gnus-summary-jump-to-group group)
6540 (gnus-group-get-new-news-this-group 1)))
6541 (gnus-group-read-group all t)
6542 (gnus-summary-goto-subject current-subject nil t)))
6544 (defun gnus-summary-rescan-group (&optional all)
6545 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6547 (gnus-summary-reselect-current-group all t))
6549 (defun gnus-summary-update-info (&optional non-destructive)
6551 (let ((group gnus-newsgroup-name))
6553 (when gnus-newsgroup-kill-headers
6554 (setq gnus-newsgroup-killed
6555 (gnus-compress-sequence
6557 (gnus-list-range-intersection
6558 gnus-newsgroup-unselected gnus-newsgroup-killed)
6559 gnus-newsgroup-unreads)
6561 (unless (listp (cdr gnus-newsgroup-killed))
6562 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6563 (let ((headers gnus-newsgroup-headers))
6564 ;; Set the new ranges of read articles.
6566 (set-buffer gnus-group-buffer)
6567 (gnus-undo-force-boundary))
6568 (gnus-update-read-articles
6569 group (gnus-sorted-union
6570 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6571 ;; Set the current article marks.
6572 (let ((gnus-newsgroup-scored
6573 (if (and (not gnus-save-score)
6574 (not non-destructive))
6576 gnus-newsgroup-scored)))
6578 (gnus-update-marks)))
6579 ;; Do the cross-ref thing.
6580 (when gnus-use-cross-reference
6581 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6582 ;; Do not switch windows but change the buffer to work.
6583 (set-buffer gnus-group-buffer)
6584 (unless (gnus-ephemeral-group-p group)
6585 (gnus-group-update-group group)))))))
6587 (defun gnus-summary-save-newsrc (&optional force)
6588 "Save the current number of read/marked articles in the dribble buffer.
6589 The dribble buffer will then be saved.
6590 If FORCE (the prefix), also save the .newsrc file(s)."
6592 (gnus-summary-update-info t)
6594 (gnus-save-newsrc-file)
6595 (gnus-dribble-save)))
6597 (defun gnus-summary-exit (&optional temporary leave-hidden)
6598 "Exit reading current newsgroup, and then return to group selection mode.
6599 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6601 (gnus-set-global-variables)
6602 (when (gnus-buffer-live-p gnus-article-buffer)
6604 (set-buffer gnus-article-buffer)
6605 (mm-destroy-parts gnus-article-mime-handles)
6606 ;; Set it to nil for safety reason.
6607 (setq gnus-article-mime-handle-alist nil)
6608 (setq gnus-article-mime-handles nil)))
6609 (gnus-kill-save-kill-buffer)
6610 (gnus-async-halt-prefetch)
6611 (let* ((group gnus-newsgroup-name)
6612 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6613 (gnus-group-is-exiting-p t)
6616 (buf (current-buffer)))
6618 ;; Do adaptive scoring, and possibly save score files.
6619 (when gnus-newsgroup-adaptive
6620 (gnus-score-adaptive))
6621 (when gnus-use-scoring
6623 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6624 ;; If we have several article buffers, we kill them at exit.
6625 (unless gnus-single-article-buffer
6626 (gnus-kill-buffer gnus-original-article-buffer)
6627 (setq gnus-article-current nil))
6628 (when gnus-use-cache
6629 (gnus-cache-possibly-remove-articles)
6630 (gnus-cache-save-buffers))
6631 (gnus-async-prefetch-remove-group group)
6632 (when gnus-suppress-duplicates
6633 (gnus-dup-enter-articles))
6634 (when gnus-use-trees
6635 (gnus-tree-close group))
6636 (when gnus-use-cache
6637 (gnus-cache-write-active))
6638 ;; Remove entries for this group.
6639 (nnmail-purge-split-history (gnus-group-real-name group))
6640 ;; Make all changes in this group permanent.
6642 (gnus-run-hooks 'gnus-exit-group-hook)
6643 (gnus-summary-update-info))
6644 (gnus-close-group group)
6645 ;; Make sure where we were, and go to next newsgroup.
6646 (set-buffer gnus-group-buffer)
6648 (gnus-group-jump-to-group group))
6649 (gnus-run-hooks 'gnus-summary-exit-hook)
6650 (unless (or quit-config
6651 ;; If this group has disappeared from the summary
6652 ;; buffer, don't skip forwards.
6653 (not (string= group (gnus-group-group-name))))
6654 (gnus-group-next-unread-group 1))
6655 (setq group-point (point))
6658 ;; If we have several article buffers, we kill them at exit.
6659 (unless gnus-single-article-buffer
6660 (gnus-kill-buffer gnus-article-buffer)
6661 (gnus-kill-buffer gnus-original-article-buffer)
6662 (setq gnus-article-current nil))
6664 (if (not gnus-kill-summary-on-exit)
6666 (gnus-deaden-summary)
6668 ;; We set all buffer-local variables to nil. It is unclear why
6669 ;; this is needed, but if we don't, buffer-local variables are
6670 ;; not garbage-collected, it seems. This would the lead to en
6671 ;; ever-growing Emacs.
6672 (gnus-summary-clear-local-variables)
6673 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6674 (gnus-summary-clear-local-variables))
6675 (when (get-buffer gnus-article-buffer)
6676 (bury-buffer gnus-article-buffer))
6677 ;; We clear the global counterparts of the buffer-local
6678 ;; variables as well, just to be on the safe side.
6679 (set-buffer gnus-group-buffer)
6680 (gnus-summary-clear-local-variables)
6681 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6682 (gnus-summary-clear-local-variables))
6683 ;; Return to group mode buffer.
6684 (when (eq mode 'gnus-summary-mode)
6685 (gnus-kill-buffer buf)))
6686 (setq gnus-current-select-method gnus-select-method)
6687 (set-buffer gnus-group-buffer)
6689 (gnus-handle-ephemeral-exit quit-config)
6690 (goto-char group-point)
6691 ;; If gnus-group-buffer is already displayed, make sure we also move
6692 ;; the cursor in the window that displays it.
6693 (let ((win (get-buffer-window (current-buffer) 0)))
6694 (if win (set-window-point win (point))))
6695 (unless leave-hidden
6696 (gnus-configure-windows 'group 'force)))
6697 ;; Clear the current group name.
6699 (setq gnus-newsgroup-name nil)))))
6701 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6702 (defun gnus-summary-exit-no-update (&optional no-questions)
6703 "Quit reading current newsgroup without updating read article info."
6705 (let* ((group gnus-newsgroup-name)
6706 (gnus-group-is-exiting-p t)
6707 (gnus-group-is-exiting-without-update-p t)
6708 (quit-config (gnus-group-quit-config group)))
6709 (when (or no-questions
6711 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6712 (gnus-async-halt-prefetch)
6713 (run-hooks 'gnus-summary-prepare-exit-hook)
6714 (when (gnus-buffer-live-p gnus-article-buffer)
6716 (set-buffer gnus-article-buffer)
6717 (mm-destroy-parts gnus-article-mime-handles)
6718 ;; Set it to nil for safety reason.
6719 (setq gnus-article-mime-handle-alist nil)
6720 (setq gnus-article-mime-handles nil)))
6721 ;; If we have several article buffers, we kill them at exit.
6722 (unless gnus-single-article-buffer
6723 (gnus-kill-buffer gnus-article-buffer)
6724 (gnus-kill-buffer gnus-original-article-buffer)
6725 (setq gnus-article-current nil))
6726 (if (not gnus-kill-summary-on-exit)
6727 (gnus-deaden-summary)
6728 (gnus-close-group group)
6729 (gnus-summary-clear-local-variables)
6730 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6731 (gnus-summary-clear-local-variables))
6732 (set-buffer gnus-group-buffer)
6733 (gnus-summary-clear-local-variables)
6734 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6735 (gnus-summary-clear-local-variables))
6736 (gnus-kill-buffer gnus-summary-buffer))
6737 (unless gnus-single-article-buffer
6738 (setq gnus-article-current nil))
6739 (when gnus-use-trees
6740 (gnus-tree-close group))
6741 (gnus-async-prefetch-remove-group group)
6742 (when (get-buffer gnus-article-buffer)
6743 (bury-buffer gnus-article-buffer))
6744 ;; Return to the group buffer.
6745 (gnus-configure-windows 'group 'force)
6746 ;; Clear the current group name.
6747 (setq gnus-newsgroup-name nil)
6748 (unless (gnus-ephemeral-group-p group)
6749 (gnus-group-update-group group))
6750 (when (equal (gnus-group-group-name) group)
6751 (gnus-group-next-unread-group 1))
6753 (gnus-handle-ephemeral-exit quit-config)))))
6755 (defun gnus-handle-ephemeral-exit (quit-config)
6756 "Handle movement when leaving an ephemeral group.
6757 The state which existed when entering the ephemeral is reset."
6758 (if (not (buffer-name (car quit-config)))
6759 (gnus-configure-windows 'group 'force)
6760 (set-buffer (car quit-config))
6761 (cond ((eq major-mode 'gnus-summary-mode)
6762 (gnus-set-global-variables))
6763 ((eq major-mode 'gnus-article-mode)
6765 ;; The `gnus-summary-buffer' variable may point
6766 ;; to the old summary buffer when using a single
6768 (unless (gnus-buffer-live-p gnus-summary-buffer)
6769 (set-buffer gnus-group-buffer))
6770 (set-buffer gnus-summary-buffer)
6771 (gnus-set-global-variables))))
6772 (if (or (eq (cdr quit-config) 'article)
6773 (eq (cdr quit-config) 'pick))
6775 ;; The current article may be from the ephemeral group
6776 ;; thus it is best that we reload this article
6778 ;; If we're exiting from a large digest, this can be
6779 ;; extremely slow. So, it's better not to reload it. -- jh.
6780 ;;(gnus-summary-show-article)
6781 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6782 (gnus-configure-windows 'pick 'force)
6783 (gnus-configure-windows (cdr quit-config) 'force)))
6784 (gnus-configure-windows (cdr quit-config) 'force))
6785 (when (eq major-mode 'gnus-summary-mode)
6786 (gnus-summary-next-subject 1 nil t)
6787 (gnus-summary-recenter)
6788 (gnus-summary-position-point))))
6792 (defvar gnus-dead-summary-mode-map nil)
6794 (unless gnus-dead-summary-mode-map
6795 (setq gnus-dead-summary-mode-map (make-keymap))
6796 (suppress-keymap gnus-dead-summary-mode-map)
6797 (substitute-key-definition
6798 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6799 (dolist (key '("\C-d" "\r" "\177" [delete]))
6800 (define-key gnus-dead-summary-mode-map
6801 key 'gnus-summary-wake-up-the-dead))
6802 (dolist (key '("q" "Q"))
6803 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6805 (defvar gnus-dead-summary-mode nil
6806 "Minor mode for Gnus summary buffers.")
6808 (defun gnus-dead-summary-mode (&optional arg)
6809 "Minor mode for Gnus summary buffers."
6811 (when (eq major-mode 'gnus-summary-mode)
6812 (make-local-variable 'gnus-dead-summary-mode)
6813 (setq gnus-dead-summary-mode
6814 (if (null arg) (not gnus-dead-summary-mode)
6815 (> (prefix-numeric-value arg) 0)))
6816 (when gnus-dead-summary-mode
6817 (gnus-add-minor-mode
6818 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6820 (defun gnus-deaden-summary ()
6821 "Make the current summary buffer into a dead summary buffer."
6822 ;; Kill any previous dead summary buffer.
6823 (when (and gnus-dead-summary
6824 (buffer-name gnus-dead-summary))
6826 (set-buffer gnus-dead-summary)
6827 (when gnus-dead-summary-mode
6828 (kill-buffer (current-buffer)))))
6829 ;; Make this the current dead summary.
6830 (setq gnus-dead-summary (current-buffer))
6831 (gnus-dead-summary-mode 1)
6832 (let ((name (buffer-name)))
6833 (when (string-match "Summary" name)
6835 (concat (substring name 0 (match-beginning 0)) "Dead "
6836 (substring name (match-beginning 0)))
6840 (defun gnus-kill-or-deaden-summary (buffer)
6841 "Kill or deaden the summary BUFFER."
6843 (when (and (buffer-name buffer)
6844 (not gnus-single-article-buffer))
6847 (gnus-kill-buffer gnus-article-buffer)
6848 (gnus-kill-buffer gnus-original-article-buffer)))
6851 (gnus-kill-summary-on-exit
6852 (when (and gnus-use-trees
6853 (gnus-buffer-exists-p buffer))
6856 (gnus-tree-close gnus-newsgroup-name)))
6857 (gnus-kill-buffer buffer))
6858 ;; Deaden the buffer.
6859 ((gnus-buffer-exists-p buffer)
6862 (gnus-deaden-summary))))))
6864 (defun gnus-summary-wake-up-the-dead (&rest args)
6865 "Wake up the dead summary buffer."
6867 (gnus-dead-summary-mode -1)
6868 (let ((name (buffer-name)))
6869 (when (string-match "Dead " name)
6871 (concat (substring name 0 (match-beginning 0))
6872 (substring name (match-end 0)))
6874 (gnus-message 3 "This dead summary is now alive again"))
6876 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6877 (defun gnus-summary-fetch-faq (&optional faq-dir)
6878 "Fetch the FAQ for the current group.
6879 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6883 (when current-prefix-arg
6885 "FAQ dir: " (and (listp gnus-group-faq-directory)
6886 (mapcar (lambda (file) (list file))
6887 gnus-group-faq-directory))))))
6888 (let (gnus-faq-buffer)
6889 (when (setq gnus-faq-buffer
6890 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6891 (gnus-configure-windows 'summary-faq))))
6893 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6894 (defun gnus-summary-describe-group (&optional force)
6895 "Describe the current newsgroup."
6897 (gnus-group-describe-group force gnus-newsgroup-name))
6899 (defun gnus-summary-describe-briefly ()
6900 "Describe summary mode commands briefly."
6902 (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")))
6904 ;; Walking around group mode buffer from summary mode.
6906 (defun gnus-summary-next-group (&optional no-article target-group backward)
6907 "Exit current newsgroup and then select next unread newsgroup.
6908 If prefix argument NO-ARTICLE is non-nil, no article is selected
6909 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6910 previous group instead."
6912 ;; Stop pre-fetching.
6913 (gnus-async-halt-prefetch)
6914 (let ((current-group gnus-newsgroup-name)
6915 (current-buffer (current-buffer))
6917 ;; First we semi-exit this group to update Xrefs and all variables.
6918 ;; We can't do a real exit, because the window conf must remain
6919 ;; the same in case the user is prompted for info, and we don't
6920 ;; want the window conf to change before that...
6921 (gnus-summary-exit t)
6922 (while (not entered)
6923 ;; Then we find what group we are supposed to enter.
6924 (set-buffer gnus-group-buffer)
6925 (gnus-group-jump-to-group current-group)
6928 (if (eq gnus-keep-same-level 'best)
6929 (gnus-summary-best-group gnus-newsgroup-name)
6930 (gnus-summary-search-group backward gnus-keep-same-level))))
6931 (if (not target-group)
6932 ;; There are no further groups, so we return to the group
6935 (gnus-message 5 "Returning to the group buffer")
6937 (when (gnus-buffer-live-p current-buffer)
6938 (set-buffer current-buffer)
6939 (gnus-summary-exit))
6940 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6941 ;; We try to enter the target group.
6942 (gnus-group-jump-to-group target-group)
6943 (let ((unreads (gnus-group-group-unread)))
6944 (if (and (or (eq t unreads)
6945 (and unreads (not (zerop unreads))))
6946 (gnus-summary-read-group
6947 target-group nil no-article
6948 (and (buffer-name current-buffer) current-buffer)
6951 (setq current-group target-group
6952 target-group nil)))))))
6954 (defun gnus-summary-prev-group (&optional no-article)
6955 "Exit current newsgroup and then select previous unread newsgroup.
6956 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6958 (gnus-summary-next-group no-article nil t))
6960 ;; Walking around summary lines.
6962 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6963 "Go to the first subject satisfying any non-nil constraint.
6964 If UNREAD is non-nil, the article should be unread.
6965 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6966 If UNSEEN is non-nil, the article should be unseen.
6967 Returns the article selected or nil if there are no matching articles."
6971 ((null gnus-newsgroup-data)
6972 (gnus-message 3 "No articles in the group")
6974 ;; Pick the first article.
6975 ((not (or unread undownloaded unseen))
6976 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6977 (gnus-data-number (car gnus-newsgroup-data)))
6978 ;; Find the first unread article.
6980 (let ((data gnus-newsgroup-data))
6982 (let ((num (gnus-data-number (car data))))
6983 (or (memq num gnus-newsgroup-unfetched)
6984 (not (or (and unread
6985 (memq num gnus-newsgroup-unreads))
6987 (memq num gnus-newsgroup-undownloaded))
6989 (memq num gnus-newsgroup-unseen)))))))
6990 (setq data (cdr data)))
6994 (goto-char (gnus-data-pos (car data)))
6995 (gnus-data-number (car data)))
6996 (gnus-message 3 "No more%s articles"
6997 (let* ((r (when unread " unread"))
6998 (d (when undownloaded " undownloaded"))
6999 (s (when unseen " unseen"))
7000 (l (delq nil (list r d s))))
7001 (cond ((= 3 (length l))
7002 (concat r "," d ", or" s))
7004 (concat (car l) ", or" (cadr l)))
7011 (gnus-summary-position-point))))))
7013 (defun gnus-summary-next-subject (n &optional unread dont-display)
7014 "Go to next N'th summary line.
7015 If N is negative, go to the previous N'th subject line.
7016 If UNREAD is non-nil, only unread articles are selected.
7017 The difference between N and the actual number of steps taken is
7020 (let ((backward (< n 0))
7024 (gnus-summary-find-prev unread)
7025 (gnus-summary-find-next unread)))
7026 (unless (zerop (setq n (1- n)))
7027 (gnus-summary-show-thread)))
7029 (gnus-message 7 "No more%s articles"
7030 (if unread " unread" "")))
7031 (unless dont-display
7032 (gnus-summary-recenter)
7033 (gnus-summary-position-point))
7036 (defun gnus-summary-next-unread-subject (n)
7037 "Go to next N'th unread summary line."
7039 (gnus-summary-next-subject n t))
7041 (defun gnus-summary-prev-subject (n &optional unread)
7042 "Go to previous N'th summary line.
7043 If optional argument UNREAD is non-nil, only unread article is selected."
7045 (gnus-summary-next-subject (- n) unread))
7047 (defun gnus-summary-prev-unread-subject (n)
7048 "Go to previous N'th unread summary line."
7050 (gnus-summary-next-subject (- n) t))
7052 (defun gnus-summary-goto-subjects (articles)
7053 "Insert the subject header for ARTICLES in the current buffer."
7055 (dolist (article articles)
7056 (gnus-summary-goto-subject article t)))
7057 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7058 (gnus-summary-position-point))
7060 (defun gnus-summary-goto-subject (article &optional force silent)
7061 "Go the subject line of ARTICLE.
7062 If FORCE, also allow jumping to articles not currently shown."
7063 (interactive "nArticle number: ")
7064 (unless (numberp article)
7065 (error "Article %s is not a number" article))
7067 (data (gnus-data-find article)))
7068 ;; We read in the article if we have to.
7071 (gnus-summary-insert-subject
7073 (if (or (numberp force) (vectorp force)) force)
7075 (setq data (gnus-data-find article)))
7080 (gnus-message 3 "Can't find article %d" article))
7082 (let ((pt (gnus-data-pos data)))
7084 (gnus-summary-set-article-display-arrow pt))
7085 (gnus-summary-position-point)
7088 ;; Walking around summary lines with displaying articles.
7090 (defun gnus-summary-expand-window (&optional arg)
7091 "Make the summary buffer take up the entire Emacs frame.
7092 Given a prefix, will force an `article' buffer configuration."
7095 (gnus-configure-windows 'article 'force)
7096 (gnus-configure-windows 'summary 'force)))
7098 (defun gnus-summary-display-article (article &optional all-header)
7099 "Display ARTICLE in article buffer."
7100 (when (gnus-buffer-live-p gnus-article-buffer)
7101 (with-current-buffer gnus-article-buffer
7102 (mm-enable-multibyte)))
7103 (gnus-set-global-variables)
7104 (when (gnus-buffer-live-p gnus-article-buffer)
7105 (with-current-buffer gnus-article-buffer
7106 (setq gnus-article-charset gnus-newsgroup-charset)
7107 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7108 (mm-enable-multibyte)))
7112 (if gnus-summary-display-article-function
7113 (funcall gnus-summary-display-article-function article all-header)
7114 (gnus-article-prepare article all-header))
7115 (gnus-run-hooks 'gnus-select-article-hook)
7116 (when (and gnus-current-article
7117 (not (zerop gnus-current-article)))
7118 (gnus-summary-goto-subject gnus-current-article))
7119 (gnus-summary-recenter)
7120 (when (and gnus-use-trees gnus-show-threads)
7121 (gnus-possibly-generate-tree article)
7122 (gnus-highlight-selected-tree article))
7123 ;; Successfully display article.
7124 (gnus-article-set-window-start
7125 (cdr (assq article gnus-newsgroup-bookmarks))))))
7127 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7128 "Select the current article.
7129 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7130 non-nil, the article will be re-fetched even if it already present in
7131 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7133 ;; Make sure we are in the summary buffer to work around bbdb bug.
7134 (unless (eq major-mode 'gnus-summary-mode)
7135 (set-buffer gnus-summary-buffer))
7136 (let ((article (or article (gnus-summary-article-number)))
7137 (all-headers (not (not all-headers))) ;Must be t or nil.
7138 gnus-summary-display-article-function)
7140 (gnus-summary-article-pseudo-p article)
7141 (error "This is a pseudo-article"))
7143 (set-buffer gnus-summary-buffer)
7144 (if (or (and gnus-single-article-buffer
7145 (or (null gnus-current-article)
7146 (null gnus-article-current)
7147 (null (get-buffer gnus-article-buffer))
7148 (not (eq article (cdr gnus-article-current)))
7149 (not (equal (car gnus-article-current)
7150 gnus-newsgroup-name))))
7151 (and (not gnus-single-article-buffer)
7152 (or (null gnus-current-article)
7153 (not (eq gnus-current-article article))))
7155 ;; The requested article is different from the current article.
7157 (gnus-summary-display-article article all-headers)
7158 (when (gnus-buffer-live-p gnus-article-buffer)
7159 (with-current-buffer gnus-article-buffer
7160 (if (not gnus-article-decoded-p) ;; a local variable
7161 (mm-disable-multibyte))))
7162 (gnus-article-set-window-start
7163 (cdr (assq article gnus-newsgroup-bookmarks)))
7167 (defun gnus-summary-force-verify-and-decrypt ()
7168 "Display buttons for signed/encrypted parts and verify/decrypt them."
7170 (let ((mm-verify-option 'known)
7171 (mm-decrypt-option 'known)
7172 (gnus-article-emulate-mime t)
7173 (gnus-buttonized-mime-types (append (list "multipart/signed"
7174 "multipart/encrypted")
7175 gnus-buttonized-mime-types)))
7176 (gnus-summary-select-article nil 'force)))
7178 (defun gnus-summary-set-current-mark (&optional current-mark)
7179 "Obsolete function."
7182 (defun gnus-summary-next-article (&optional unread subject backward push)
7183 "Select the next article.
7184 If UNREAD, only unread articles are selected.
7185 If SUBJECT, only articles with SUBJECT are selected.
7186 If BACKWARD, the previous article is selected instead of the next."
7189 ;; Is there such an article?
7190 ((and (gnus-summary-search-forward unread subject backward)
7191 (or (gnus-summary-display-article (gnus-summary-article-number))
7192 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7193 (gnus-summary-position-point))
7194 ;; If not, we try the first unread, if that is wanted.
7196 gnus-auto-select-same
7197 (gnus-summary-first-unread-article))
7198 (gnus-summary-position-point)
7199 (gnus-message 6 "Wrapped"))
7200 ;; Try to get next/previous article not displayed in this group.
7201 ((and gnus-auto-extend-newsgroup
7202 (not unread) (not subject))
7203 (gnus-summary-goto-article
7204 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7205 nil (count-lines (point-min) (point))))
7206 ;; Go to next/previous group.
7208 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7209 (gnus-summary-jump-to-group gnus-newsgroup-name))
7210 (let ((cmd last-command-char)
7213 (set-buffer gnus-group-buffer)
7216 (if (eq gnus-keep-same-level 'best)
7217 (gnus-summary-best-group gnus-newsgroup-name)
7218 (gnus-summary-search-group backward gnus-keep-same-level))))
7219 ;; For some reason, the group window gets selected. We change
7221 (select-window (get-buffer-window (current-buffer)))
7222 ;; Select next unread newsgroup automagically.
7224 ((or (not gnus-auto-select-next)
7226 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7227 ((or (eq gnus-auto-select-next 'quietly)
7228 (and (eq gnus-auto-select-next 'slightly-quietly)
7230 (and (eq gnus-auto-select-next 'almost-quietly)
7231 (gnus-summary-last-article-p)))
7233 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7235 (gnus-message 7 "No more%s articles (%s)..."
7236 (if unread " unread" "")
7237 (if group (concat "selecting " group)
7239 (gnus-summary-next-group nil group backward)))
7241 (when (gnus-key-press-event-p last-input-event)
7242 (gnus-summary-walk-group-buffer
7243 gnus-newsgroup-name cmd unread backward point))))))))
7245 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7246 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7247 (?\C-p (gnus-group-prev-unread-group 1))))
7248 (cursor-in-echo-area t)
7249 keve key group ended prompt)
7251 (set-buffer gnus-group-buffer)
7254 (if (eq gnus-keep-same-level 'best)
7255 (gnus-summary-best-group gnus-newsgroup-name)
7256 (gnus-summary-search-group backward gnus-keep-same-level))))
7260 "No more%s articles%s " (if unread " unread" "")
7262 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7263 (format " (Type %s for %s [%s])"
7264 (single-key-description cmd)
7265 (gnus-group-decoded-name group)
7266 (car (gnus-gethash group gnus-newsrc-hashtb)))
7267 (format " (Type %s to exit %s)"
7268 (single-key-description cmd)
7269 (gnus-group-decoded-name gnus-newsgroup-name)))))
7270 ;; Confirm auto selection.
7271 (setq key (car (setq keve (gnus-read-event-char prompt)))
7274 ((assq key keystrokes)
7275 (let ((obuf (current-buffer)))
7276 (switch-to-buffer gnus-group-buffer)
7278 (gnus-group-jump-to-group group))
7279 (eval (cadr (assq key keystrokes)))
7280 (setq group (gnus-group-group-name))
7281 (switch-to-buffer obuf))
7285 (gnus-ephemeral-group-p gnus-newsgroup-name))
7287 (gnus-summary-next-group nil group backward)))
7289 (push (cdr keve) unread-command-events))))))
7291 (defun gnus-summary-next-unread-article ()
7292 "Select unread article after current one."
7294 (gnus-summary-next-article
7295 (or (not (eq gnus-summary-goto-unread 'never))
7296 (gnus-summary-last-article-p (gnus-summary-article-number)))
7297 (and gnus-auto-select-same
7298 (gnus-summary-article-subject))))
7300 (defun gnus-summary-prev-article (&optional unread subject)
7301 "Select the article after the current one.
7302 If UNREAD is non-nil, only unread articles are selected."
7304 (gnus-summary-next-article unread subject t))
7306 (defun gnus-summary-prev-unread-article ()
7307 "Select unread article before current one."
7309 (gnus-summary-prev-article
7310 (or (not (eq gnus-summary-goto-unread 'never))
7311 (gnus-summary-first-article-p (gnus-summary-article-number)))
7312 (and gnus-auto-select-same
7313 (gnus-summary-article-subject))))
7315 (defun gnus-summary-next-page (&optional lines circular stop)
7316 "Show next page of the selected article.
7317 If at the end of the current article, select the next article.
7318 LINES says how many lines should be scrolled up.
7320 If CIRCULAR is non-nil, go to the start of the article instead of
7321 selecting the next article when reaching the end of the current
7324 If STOP is non-nil, just stop when reaching the end of the message.
7326 Also see the variable `gnus-article-skip-boring'."
7328 (setq gnus-summary-buffer (current-buffer))
7329 (gnus-set-global-variables)
7330 (let ((article (gnus-summary-article-number))
7331 (article-window (get-buffer-window gnus-article-buffer t))
7333 ;; If the buffer is empty, we have no article.
7335 (error "No article to select"))
7336 (gnus-configure-windows 'article)
7337 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7338 (if (and (eq gnus-summary-goto-unread 'never)
7339 (not (gnus-summary-last-article-p article)))
7340 (gnus-summary-next-article)
7341 (gnus-summary-next-unread-article))
7342 (if (or (null gnus-current-article)
7343 (null gnus-article-current)
7344 (/= article (cdr gnus-article-current))
7345 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7346 ;; Selected subject is different from current article's.
7347 (gnus-summary-display-article article)
7348 (when article-window
7349 (gnus-eval-in-buffer-window gnus-article-buffer
7350 (setq endp (or (gnus-article-next-page lines)
7351 (gnus-article-only-boring-p))))
7354 (gnus-message 3 "End of message"))
7356 (gnus-summary-beginning-of-article))
7358 (gnus-message 3 "End of message"))
7360 (if (and (eq gnus-summary-goto-unread 'never)
7361 (not (gnus-summary-last-article-p article)))
7362 (gnus-summary-next-article)
7363 (gnus-summary-next-unread-article))))))))
7364 (gnus-summary-recenter)
7365 (gnus-summary-position-point)))
7367 (defun gnus-summary-prev-page (&optional lines move)
7368 "Show previous page of selected article.
7369 Argument LINES specifies lines to be scrolled down.
7370 If MOVE, move to the previous unread article if point is at
7371 the beginning of the buffer."
7373 (let ((article (gnus-summary-article-number))
7374 (article-window (get-buffer-window gnus-article-buffer t))
7376 (gnus-configure-windows 'article)
7377 (if (or (null gnus-current-article)
7378 (null gnus-article-current)
7379 (/= article (cdr gnus-article-current))
7380 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7381 ;; Selected subject is different from current article's.
7382 (gnus-summary-display-article article)
7383 (gnus-summary-recenter)
7384 (when article-window
7385 (gnus-eval-in-buffer-window gnus-article-buffer
7386 (setq endp (gnus-article-prev-page lines)))
7387 (when (and move endp)
7389 (gnus-message 3 "Beginning of message"))
7391 (if (and (eq gnus-summary-goto-unread 'never)
7392 (not (gnus-summary-first-article-p article)))
7393 (gnus-summary-prev-article)
7394 (gnus-summary-prev-unread-article))))))))
7395 (gnus-summary-position-point))
7397 (defun gnus-summary-prev-page-or-article (&optional lines)
7398 "Show previous page of selected article.
7399 Argument LINES specifies lines to be scrolled down.
7400 If at the beginning of the article, go to the next article."
7402 (gnus-summary-prev-page lines t))
7404 (defun gnus-summary-scroll-up (lines)
7405 "Scroll up (or down) one line current article.
7406 Argument LINES specifies lines to be scrolled up (or down if negative)."
7408 (gnus-configure-windows 'article)
7409 (gnus-summary-show-thread)
7410 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7411 (gnus-eval-in-buffer-window gnus-article-buffer
7413 (when (gnus-article-next-page lines)
7414 (gnus-message 3 "End of message")))
7416 (gnus-article-prev-page (- lines))))))
7417 (gnus-summary-recenter)
7418 (gnus-summary-position-point))
7420 (defun gnus-summary-scroll-down (lines)
7421 "Scroll down (or up) one line current article.
7422 Argument LINES specifies lines to be scrolled down (or up if negative)."
7424 (gnus-summary-scroll-up (- lines)))
7426 (defun gnus-summary-next-same-subject ()
7427 "Select next article which has the same subject as current one."
7429 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7431 (defun gnus-summary-prev-same-subject ()
7432 "Select previous article which has the same subject as current one."
7434 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7436 (defun gnus-summary-next-unread-same-subject ()
7437 "Select next unread article which has the same subject as current one."
7439 (gnus-summary-next-article t (gnus-summary-article-subject)))
7441 (defun gnus-summary-prev-unread-same-subject ()
7442 "Select previous unread article which has the same subject as current one."
7444 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7446 (defun gnus-summary-first-unread-article ()
7447 "Select the first unread article.
7448 Return nil if there are no unread articles."
7451 (when (gnus-summary-first-subject t)
7452 (gnus-summary-show-thread)
7453 (gnus-summary-first-subject t)
7454 (gnus-summary-display-article (gnus-summary-article-number)))
7455 (gnus-summary-position-point)))
7457 (defun gnus-summary-first-unread-subject ()
7458 "Place the point on the subject line of the first unread article.
7459 Return nil if there are no unread articles."
7462 (when (gnus-summary-first-subject t)
7463 (gnus-summary-show-thread)
7464 (gnus-summary-first-subject t))
7465 (gnus-summary-position-point)))
7467 (defun gnus-summary-first-unseen-subject ()
7468 "Place the point on the subject line of the first unseen article.
7469 Return nil if there are no unseen articles."
7472 (when (gnus-summary-first-subject nil nil t)
7473 (gnus-summary-show-thread)
7474 (gnus-summary-first-subject nil nil t))
7475 (gnus-summary-position-point)))
7477 (defun gnus-summary-first-unseen-or-unread-subject ()
7478 "Place the point on the subject line of the first unseen article or,
7479 if all article have been seen, on the subject line of the first unread
7483 (unless (when (gnus-summary-first-subject nil nil t)
7484 (gnus-summary-show-thread)
7485 (gnus-summary-first-subject nil nil t))
7486 (when (gnus-summary-first-subject t)
7487 (gnus-summary-show-thread)
7488 (gnus-summary-first-subject t)))
7489 (gnus-summary-position-point)))
7491 (defun gnus-summary-first-article ()
7492 "Select the first article.
7493 Return nil if there are no articles."
7496 (when (gnus-summary-first-subject)
7497 (gnus-summary-show-thread)
7498 (gnus-summary-first-subject)
7499 (gnus-summary-display-article (gnus-summary-article-number)))
7500 (gnus-summary-position-point)))
7502 (defun gnus-summary-best-unread-article (&optional arg)
7503 "Select the unread article with the highest score.
7504 If given a prefix argument, select the next unread article that has a
7505 score higher than the default score."
7507 (let ((article (if arg
7508 (gnus-summary-better-unread-subject)
7509 (gnus-summary-best-unread-subject))))
7511 (gnus-summary-goto-article article)
7512 (error "No unread articles"))))
7514 (defun gnus-summary-best-unread-subject ()
7515 "Select the unread subject with the highest score."
7517 (let ((best -1000000)
7518 (data gnus-newsgroup-data)
7521 (and (gnus-data-unread-p (car data))
7523 (gnus-summary-article-score (gnus-data-number (car data))))
7526 article (gnus-data-number (car data))))
7527 (setq data (cdr data)))
7529 (gnus-summary-goto-subject article))
7530 (gnus-summary-position-point)
7533 (defun gnus-summary-better-unread-subject ()
7534 "Select the first unread subject that has a score over the default score."
7536 (let ((data gnus-newsgroup-data)
7538 (while (and (setq article (gnus-data-number (car data)))
7539 (or (gnus-data-read-p (car data))
7540 (not (> (gnus-summary-article-score article)
7541 gnus-summary-default-score))))
7542 (setq data (cdr data)))
7544 (gnus-summary-goto-subject article))
7545 (gnus-summary-position-point)
7548 (defun gnus-summary-last-subject ()
7549 "Go to the last displayed subject line in the group."
7550 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7552 (gnus-summary-goto-subject article))))
7554 (defun gnus-summary-goto-article (article &optional all-headers force)
7555 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7556 If ALL-HEADERS is non-nil, no header lines are hidden.
7557 If FORCE, go to the article even if it isn't displayed. If FORCE
7558 is a number, it is the line the article is to be displayed on."
7562 "Article number or Message-ID: "
7563 (mapcar (lambda (number) (list (int-to-string number)))
7564 gnus-newsgroup-limit))
7568 (if (and (stringp article)
7569 (string-match "@\\|%40" article))
7570 (gnus-summary-refer-article article)
7571 (when (stringp article)
7572 (setq article (string-to-number article)))
7573 (if (gnus-summary-goto-subject article force)
7574 (gnus-summary-display-article article all-headers)
7575 (gnus-message 4 "Couldn't go to article %s" article) nil))
7576 (gnus-summary-position-point)))
7578 (defun gnus-summary-goto-last-article ()
7579 "Go to the previously read article."
7582 (when gnus-last-article
7583 (gnus-summary-goto-article gnus-last-article nil t))
7584 (gnus-summary-position-point)))
7586 (defun gnus-summary-pop-article (number)
7587 "Pop one article off the history and go to the previous.
7588 NUMBER articles will be popped off."
7591 (setq gnus-newsgroup-history
7592 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7594 (gnus-summary-goto-article (car to) nil t)
7595 (error "Article history empty")))
7596 (gnus-summary-position-point))
7598 ;; Summary commands and functions for limiting the summary buffer.
7600 (defun gnus-summary-limit-to-articles (n)
7601 "Limit the summary buffer to the next N articles.
7602 If not given a prefix, use the process marked articles instead."
7605 (let ((articles (gnus-summary-work-articles n)))
7606 (setq gnus-newsgroup-processable nil)
7607 (gnus-summary-limit articles))
7608 (gnus-summary-position-point)))
7610 (defun gnus-summary-pop-limit (&optional total)
7611 "Restore the previous limit.
7612 If given a prefix, remove all limits."
7615 (setq gnus-newsgroup-limits
7616 (list (mapcar (lambda (h) (mail-header-number h))
7617 gnus-newsgroup-headers))))
7618 (unless gnus-newsgroup-limits
7619 (error "No limit to pop"))
7621 (gnus-summary-limit nil 'pop)
7622 (gnus-summary-position-point)))
7624 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7625 "Limit the summary buffer to articles that have subjects that match a regexp.
7626 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7628 (list (read-string (if current-prefix-arg
7629 "Exclude subject (regexp): "
7630 "Limit to subject (regexp): "))
7631 nil current-prefix-arg))
7633 (setq header "subject"))
7634 (when (not (equal "" subject))
7636 (let ((articles (gnus-summary-find-matching
7637 (or header "subject") subject 'all nil nil
7640 (error "Found no matches for \"%s\"" subject))
7641 (gnus-summary-limit articles))
7642 (gnus-summary-position-point))))
7644 (defun gnus-summary-limit-to-author (from &optional not-matching)
7645 "Limit the summary buffer to articles that have authors that match a regexp.
7646 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7648 (list (read-string (if current-prefix-arg
7649 "Exclude author (regexp): "
7650 "Limit to author (regexp): "))
7651 current-prefix-arg))
7652 (gnus-summary-limit-to-subject from "from" not-matching))
7654 (defun gnus-summary-limit-to-age (age &optional younger-p)
7655 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7656 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7657 articles that are younger than AGE days."
7659 (let ((younger current-prefix-arg)
7662 (while (not days-got)
7663 (setq days (if younger
7664 (read-string "Limit to articles younger than (in days, older when negative): ")
7666 "Limit to articles older than (in days, younger when negative): ")))
7667 (when (> (length days) 0)
7668 (setq days (read days)))
7674 (setq younger (not younger))
7675 (setq days (* days -1)))))
7676 (message "Please enter a number.")
7678 (list days younger)))
7680 (let ((data gnus-newsgroup-data)
7681 (cutoff (days-to-time age))
7682 articles d date is-younger)
7683 (while (setq d (pop data))
7684 (when (and (vectorp (gnus-data-header d))
7685 (setq date (mail-header-date (gnus-data-header d))))
7686 (setq is-younger (time-less-p
7687 (time-since (condition-case ()
7694 (push (gnus-data-number d) articles))))
7695 (gnus-summary-limit (nreverse articles)))
7696 (gnus-summary-position-point)))
7698 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7699 "Limit the summary buffer to articles that match an 'extra' header."
7703 (gnus-completing-read-with-default
7704 (symbol-name (car gnus-extra-headers))
7705 (if current-prefix-arg
7706 "Exclude extra header"
7707 "Limit extra header")
7709 (cons (symbol-name x) x))
7714 (read-string (format "%s header %s (regexp): "
7715 (if current-prefix-arg "Exclude" "Limit to")
7717 current-prefix-arg)))
7718 (when (not (equal "" regexp))
7720 (let ((articles (gnus-summary-find-matching
7721 (cons 'extra header) regexp 'all nil nil
7724 (error "Found no matches for \"%s\"" regexp))
7725 (gnus-summary-limit articles))
7726 (gnus-summary-position-point))))
7728 (defun gnus-summary-limit-to-display-predicate ()
7729 "Limit the summary buffer to the predicated in the `display' group parameter."
7731 (unless gnus-newsgroup-display
7732 (error "There is no `display' group parameter"))
7734 (dolist (number gnus-newsgroup-articles)
7735 (when (funcall gnus-newsgroup-display)
7736 (push number articles)))
7737 (gnus-summary-limit articles))
7738 (gnus-summary-position-point))
7740 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7742 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7744 (defun gnus-summary-limit-to-unread (&optional all)
7745 "Limit the summary buffer to articles that are not marked as read.
7746 If ALL is non-nil, limit strictly to unread articles."
7749 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7750 (gnus-summary-limit-to-marks
7751 ;; Concat all the marks that say that an article is read and have
7753 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7754 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7755 gnus-low-score-mark gnus-expirable-mark
7756 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7757 gnus-duplicate-mark gnus-souped-mark)
7760 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7761 (make-obsolete 'gnus-summary-delete-marked-with
7762 'gnus-summary-limit-exclude-marks)
7764 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7765 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7766 If REVERSE, limit the summary buffer to articles that are marked
7767 with MARKS. MARKS can either be a string of marks or a list of marks.
7768 Returns how many articles were removed."
7769 (interactive "sMarks: ")
7770 (gnus-summary-limit-to-marks marks t))
7772 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7773 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7774 If REVERSE (the prefix), limit the summary buffer to articles that are
7775 not marked with MARKS. MARKS can either be a string of marks or a
7777 Returns how many articles were removed."
7778 (interactive "sMarks: \nP")
7780 (let ((data gnus-newsgroup-data)
7781 (marks (if (listp marks) marks
7782 (append marks nil))) ; Transform to list.
7785 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7786 (memq (gnus-data-mark (car data)) marks))
7787 (push (gnus-data-number (car data)) articles))
7788 (setq data (cdr data)))
7789 (gnus-summary-limit articles))
7790 (gnus-summary-position-point)))
7792 (defun gnus-summary-limit-to-score (score)
7793 "Limit to articles with score at or above SCORE."
7794 (interactive "NLimit to articles with score of at least: ")
7795 (let ((data gnus-newsgroup-data)
7798 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7800 (push (gnus-data-number (car data)) articles))
7801 (setq data (cdr data)))
7803 (gnus-summary-limit articles)
7804 (gnus-summary-position-point))))
7806 (defun gnus-summary-limit-to-unseen ()
7807 "Limit to unseen articles."
7810 (gnus-summary-limit gnus-newsgroup-unseen)
7811 (gnus-summary-position-point)))
7813 (defun gnus-summary-limit-include-thread (id)
7814 "Display all the hidden articles that is in the thread with ID in it.
7815 When called interactively, ID is the Message-ID of the current
7817 (interactive (list (mail-header-id (gnus-summary-article-header))))
7818 (let ((articles (gnus-articles-in-thread
7819 (gnus-id-to-thread (gnus-root-id id)))))
7821 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7822 (gnus-summary-limit-include-matching-articles
7824 (regexp-quote (gnus-simplify-subject-re
7825 (mail-header-subject (gnus-id-to-header id)))))
7826 (gnus-summary-position-point))))
7828 (defun gnus-summary-limit-include-matching-articles (header regexp)
7829 "Display all the hidden articles that have HEADERs that match REGEXP."
7830 (interactive (list (read-string "Match on header: ")
7831 (read-string "Regexp: ")))
7832 (let ((articles (gnus-find-matching-articles header regexp)))
7834 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7835 (gnus-summary-position-point))))
7837 (defun gnus-summary-insert-dormant-articles ()
7838 "Insert all the dormant articles for this group into the current buffer."
7840 (let ((gnus-verbose (max 6 gnus-verbose)))
7841 (if (not gnus-newsgroup-dormant)
7842 (gnus-message 3 "No cached articles for this group")
7843 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7845 (defun gnus-summary-limit-include-dormant ()
7846 "Display all the hidden articles that are marked as dormant.
7847 Note that this command only works on a subset of the articles currently
7848 fetched for this group."
7850 (unless gnus-newsgroup-dormant
7851 (error "There are no dormant articles in this group"))
7853 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7854 (gnus-summary-position-point)))
7856 (defun gnus-summary-limit-exclude-dormant ()
7857 "Hide all dormant articles."
7860 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7861 (gnus-summary-position-point)))
7863 (defun gnus-summary-limit-exclude-childless-dormant ()
7864 "Hide all dormant articles that have no children."
7866 (let ((data (gnus-data-list t))
7867 articles d children)
7868 ;; Find all articles that are either not dormant or have
7870 (while (setq d (pop data))
7871 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7873 (gnus-article-children (gnus-data-number d)))
7876 (when (memq (car children) articles)
7881 (push (gnus-data-number d) articles)))
7884 (gnus-summary-limit articles)
7885 (gnus-summary-position-point))))
7887 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7888 "Mark all unread excluded articles as read.
7889 If ALL, mark even excluded ticked and dormants as read."
7891 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7892 (let ((articles (gnus-sorted-ndifference
7894 (mapcar (lambda (h) (mail-header-number h))
7895 gnus-newsgroup-headers)
7897 gnus-newsgroup-limit))
7899 (setq gnus-newsgroup-unreads
7900 (gnus-sorted-intersection gnus-newsgroup-unreads
7901 gnus-newsgroup-limit))
7903 (setq gnus-newsgroup-dormant nil
7904 gnus-newsgroup-marked nil
7905 gnus-newsgroup-reads
7907 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7908 gnus-newsgroup-reads))
7909 (while (setq article (pop articles))
7910 (unless (or (memq article gnus-newsgroup-dormant)
7911 (memq article gnus-newsgroup-marked))
7912 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7914 (defun gnus-summary-limit (articles &optional pop)
7916 ;; We pop the previous limit off the stack and use that.
7917 (setq articles (car gnus-newsgroup-limits)
7918 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7919 ;; We use the new limit, so we push the old limit on the stack.
7920 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7922 (setq gnus-newsgroup-limit articles)
7923 (let ((total (length gnus-newsgroup-data))
7924 (data (gnus-data-find-list (gnus-summary-article-number)))
7925 (gnus-summary-mark-below nil) ; Inhibit this.
7927 ;; This will do all the work of generating the new summary buffer
7928 ;; according to the new limit.
7929 (gnus-summary-prepare)
7930 ;; Hide any threads, possibly.
7931 (gnus-summary-maybe-hide-threads)
7932 ;; Try to return to the article you were at, or one in the
7935 ;; We try to find some article after the current one.
7937 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7940 (setq data (cdr data))))
7942 ;; If there is no data, that means that we were after the last
7943 ;; article. The same goes when we can't find any articles
7944 ;; after the current one.
7945 (goto-char (point-max))
7946 (gnus-summary-find-prev))
7947 (gnus-set-mode-line 'summary)
7948 ;; We return how many articles were removed from the summary
7949 ;; buffer as a result of the new limit.
7950 (- total (length gnus-newsgroup-data))))
7952 (defsubst gnus-invisible-cut-children (threads)
7955 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7960 (defsubst gnus-cut-thread (thread)
7961 "Go forwards in the thread until we find an article that we want to display."
7962 (when (or (eq gnus-fetch-old-headers 'some)
7963 (eq gnus-fetch-old-headers 'invisible)
7964 (numberp gnus-fetch-old-headers)
7965 (eq gnus-build-sparse-threads 'some)
7966 (eq gnus-build-sparse-threads 'more))
7967 ;; Deal with old-fetched headers and sparse threads.
7971 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7972 (gnus-summary-article-ancient-p
7973 (mail-header-number (car thread))))
7974 (if (or (<= (length (cdr thread)) 1)
7975 (eq gnus-fetch-old-headers 'invisible))
7976 (setq gnus-newsgroup-limit
7977 (delq (mail-header-number (car thread))
7978 gnus-newsgroup-limit)
7979 thread (cadr thread))
7980 (when (gnus-invisible-cut-children (cdr thread))
7981 (let ((th (cdr thread)))
7983 (if (memq (mail-header-number (caar th))
7984 gnus-newsgroup-limit)
7985 (setq thread (car th)
7987 (setq th (cdr th))))))))))
7990 (defun gnus-cut-threads (threads)
7991 "Cut off all uninteresting articles from the beginning of THREADS."
7992 (when (or (eq gnus-fetch-old-headers 'some)
7993 (eq gnus-fetch-old-headers 'invisible)
7994 (numberp gnus-fetch-old-headers)
7995 (eq gnus-build-sparse-threads 'some)
7996 (eq gnus-build-sparse-threads 'more))
7999 (setcar th (gnus-cut-thread (car th)))
8000 (setq th (cdr th)))))
8001 ;; Remove nixed out threads.
8004 (defun gnus-summary-initial-limit (&optional show-if-empty)
8005 "Figure out what the initial limit is supposed to be on group entry.
8006 This entails weeding out unwanted dormants, low-scored articles,
8007 fetch-old-headers verbiage, and so on."
8008 ;; Most groups have nothing to remove.
8009 (if (or gnus-inhibit-limiting
8010 (and (null gnus-newsgroup-dormant)
8011 (eq gnus-newsgroup-display 'gnus-not-ignore)
8012 (not (eq gnus-fetch-old-headers 'some))
8013 (not (numberp gnus-fetch-old-headers))
8014 (not (eq gnus-fetch-old-headers 'invisible))
8015 (null gnus-summary-expunge-below)
8016 (not (eq gnus-build-sparse-threads 'some))
8017 (not (eq gnus-build-sparse-threads 'more))
8018 (null gnus-thread-expunge-below)
8019 (not gnus-use-nocem)))
8021 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8022 (setq gnus-newsgroup-limit nil)
8025 (unless (car (symbol-value node))
8026 ;; These threads have no parents -- they are roots.
8027 (let ((nodes (cdr (symbol-value node)))
8030 (if (and gnus-thread-expunge-below
8031 (< (gnus-thread-total-score (car nodes))
8032 gnus-thread-expunge-below))
8033 (gnus-expunge-thread (pop nodes))
8034 (setq thread (pop nodes))
8035 (gnus-summary-limit-children thread))))))
8036 gnus-newsgroup-dependencies)
8037 ;; If this limitation resulted in an empty group, we might
8038 ;; pop the previous limit and use it instead.
8039 (when (and (not gnus-newsgroup-limit)
8041 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8042 gnus-newsgroup-limit))
8044 (defun gnus-summary-limit-children (thread)
8045 "Return 1 if this subthread is visible and 0 if it is not."
8046 ;; First we get the number of visible children to this thread. This
8047 ;; is done by recursing down the thread using this function, so this
8048 ;; will really go down to a leaf article first, before slowly
8049 ;; working its way up towards the root.
8051 (let* ((max-lisp-eval-depth 5000)
8054 (apply '+ (mapcar 'gnus-summary-limit-children
8057 (number (mail-header-number (car thread)))
8060 (not (memq number gnus-newsgroup-marked))
8062 ;; If this article is dormant and has absolutely no visible
8063 ;; children, then this article isn't visible.
8064 (and (memq number gnus-newsgroup-dormant)
8066 ;; If this is "fetch-old-headered" and there is no
8067 ;; visible children, then we don't want this article.
8068 (and (or (eq gnus-fetch-old-headers 'some)
8069 (numberp gnus-fetch-old-headers))
8070 (gnus-summary-article-ancient-p number)
8072 ;; If this is "fetch-old-headered" and `invisible', then
8073 ;; we don't want this article.
8074 (and (eq gnus-fetch-old-headers 'invisible)
8075 (gnus-summary-article-ancient-p number))
8076 ;; If this is a sparsely inserted article with no children,
8077 ;; we don't want it.
8078 (and (eq gnus-build-sparse-threads 'some)
8079 (gnus-summary-article-sparse-p number)
8081 ;; If we use expunging, and this article is really
8082 ;; low-scored, then we don't want this article.
8083 (when (and gnus-summary-expunge-below
8085 (or (cdr (assq number gnus-newsgroup-scored))
8086 gnus-summary-default-score))
8087 gnus-summary-expunge-below))
8088 ;; We increase the expunge-tally here, but that has
8089 ;; nothing to do with the limits, really.
8090 (incf gnus-newsgroup-expunged-tally)
8091 ;; We also mark as read here, if that's wanted.
8092 (when (and gnus-summary-mark-below
8093 (< score gnus-summary-mark-below))
8094 (setq gnus-newsgroup-unreads
8095 (delq number gnus-newsgroup-unreads))
8096 (if gnus-newsgroup-auto-expire
8097 (push number gnus-newsgroup-expirable)
8098 (push (cons number gnus-low-score-mark)
8099 gnus-newsgroup-reads)))
8101 ;; Do the `display' group parameter.
8102 (and gnus-newsgroup-display
8103 (not (funcall gnus-newsgroup-display)))
8104 ;; Check NoCeM things.
8105 (if (and gnus-use-nocem
8106 (gnus-nocem-unwanted-article-p
8107 (mail-header-id (car thread))))
8109 (setq gnus-newsgroup-unreads
8110 (delq number gnus-newsgroup-unreads))
8112 ;; Nope, invisible article.
8114 ;; Ok, this article is to be visible, so we add it to the limit
8116 (push number gnus-newsgroup-limit)
8119 (defun gnus-expunge-thread (thread)
8120 "Mark all articles in THREAD as read."
8121 (let* ((number (mail-header-number (car thread))))
8122 (incf gnus-newsgroup-expunged-tally)
8123 ;; We also mark as read here, if that's wanted.
8124 (setq gnus-newsgroup-unreads
8125 (delq number gnus-newsgroup-unreads))
8126 (if gnus-newsgroup-auto-expire
8127 (push number gnus-newsgroup-expirable)
8128 (push (cons number gnus-low-score-mark)
8129 gnus-newsgroup-reads)))
8130 ;; Go recursively through all subthreads.
8131 (mapcar 'gnus-expunge-thread (cdr thread)))
8133 ;; Summary article oriented commands
8135 (defun gnus-summary-refer-parent-article (n)
8136 "Refer parent article N times.
8137 If N is negative, go to ancestor -N instead.
8138 The difference between N and the number of articles fetched is returned."
8142 (when (not (natnump n))
8147 (setq header (gnus-summary-article-header))
8148 (if (and (eq (mail-header-number header)
8149 (cdr gnus-article-current))
8150 (equal gnus-newsgroup-name
8151 (car gnus-article-current)))
8152 ;; If we try to find the parent of the currently
8153 ;; displayed article, then we take a look at the actual
8154 ;; References header, since this is slightly more
8155 ;; reliable than the References field we got from the
8158 (set-buffer gnus-original-article-buffer)
8159 (nnheader-narrow-to-headers)
8160 (unless (setq ref (message-fetch-field "references"))
8161 (when (setq ref (message-fetch-field "in-reply-to"))
8162 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8165 ;; It's not the current article, so we take a bet on
8166 ;; the value we got from the server.
8167 (mail-header-references header)))
8169 (not (equal ref "")))
8170 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8171 (gnus-message 1 "Couldn't find parent"))
8172 (gnus-message 1 "No references in article %d"
8173 (gnus-summary-article-number))
8176 (gnus-summary-position-point)
8179 (defun gnus-summary-refer-references ()
8180 "Fetch all articles mentioned in the References header.
8181 Return the number of articles fetched."
8183 (let ((ref (mail-header-references (gnus-summary-article-header)))
8184 (current (gnus-summary-article-number))
8188 (error "No References in the current article")
8189 ;; For each Message-ID in the References header...
8190 (while (string-match "<[^>]*>" ref)
8192 ;; ... fetch that article.
8193 (gnus-summary-refer-article
8194 (prog1 (match-string 0 ref)
8195 (setq ref (substring ref (match-end 0))))))
8196 (gnus-summary-goto-subject current)
8197 (gnus-summary-position-point)
8200 (defun gnus-summary-refer-thread (&optional limit)
8201 "Fetch all articles in the current thread.
8202 If LIMIT (the numerical prefix), fetch that many old headers instead
8203 of what's specified by the `gnus-refer-thread-limit' variable."
8205 (let ((id (mail-header-id (gnus-summary-article-header)))
8206 (limit (if limit (prefix-numeric-value limit)
8207 gnus-refer-thread-limit)))
8208 (unless (eq gnus-fetch-old-headers 'invisible)
8209 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8210 ;; Retrieve the headers and read them in.
8211 (if (eq (if (numberp limit)
8212 (gnus-retrieve-headers
8214 (+ (mail-header-number
8215 (gnus-summary-article-header))
8217 gnus-newsgroup-end))
8218 gnus-newsgroup-name (* limit 2))
8219 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8221 (gnus-retrieve-headers (list gnus-newsgroup-end)
8222 gnus-newsgroup-name limit))
8224 (gnus-build-all-threads)
8225 (error "Can't fetch thread from back ends that don't support NOV"))
8226 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8227 (gnus-summary-limit-include-thread id)))
8229 (defun gnus-summary-refer-article (message-id)
8230 "Fetch an article specified by MESSAGE-ID."
8231 (interactive "sMessage-ID: ")
8232 (when (and (stringp message-id)
8233 (not (zerop (length message-id))))
8234 (setq message-id (gnus-replace-in-string message-id " " ""))
8235 ;; Construct the correct Message-ID if necessary.
8236 ;; Suggested by tale@pawl.rpi.edu.
8237 (unless (string-match "^<" message-id)
8238 (setq message-id (concat "<" message-id)))
8239 (unless (string-match ">$" message-id)
8240 (setq message-id (concat message-id ">")))
8241 ;; People often post MIDs from URLs, so unhex it:
8242 (unless (string-match "@" message-id)
8243 (setq message-id (gnus-url-unhex-string message-id)))
8244 (let* ((header (gnus-id-to-header message-id))
8246 (gnus-summary-article-sparse-p
8247 (mail-header-number header))
8248 (memq (mail-header-number header)
8249 gnus-newsgroup-limit)))
8252 ;; If the article is present in the buffer we just go to it.
8254 (or (not (gnus-summary-article-sparse-p
8255 (mail-header-number header)))
8258 (gnus-summary-goto-article
8259 (mail-header-number header) nil t)
8261 (gnus-summary-update-article (mail-header-number header)))))
8263 ;; We fetch the article.
8265 (dolist (gnus-override-method (gnus-refer-article-methods))
8266 (when (and (gnus-check-server gnus-override-method)
8267 ;; Fetch the header,
8268 (setq number (gnus-summary-insert-subject message-id)))
8269 ;; and display the article.
8270 (gnus-summary-select-article nil nil nil number)
8272 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8274 (defun gnus-refer-article-methods ()
8275 "Return a list of referable methods."
8277 ;; No method, so we default to current and native.
8278 ((null gnus-refer-article-method)
8279 (list gnus-current-select-method gnus-select-method))
8281 ((eq 'current gnus-refer-article-method)
8282 (list gnus-current-select-method))
8283 ;; List of select methods.
8284 ((not (and (symbolp (car gnus-refer-article-method))
8285 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8287 (dolist (method gnus-refer-article-method)
8288 (push (if (eq 'current method)
8289 gnus-current-select-method
8293 ;; One single select method.
8295 (list gnus-refer-article-method))))
8297 (defun gnus-summary-edit-parameters ()
8298 "Edit the group parameters of the current group."
8300 (gnus-group-edit-group gnus-newsgroup-name 'params))
8302 (defun gnus-summary-customize-parameters ()
8303 "Customize the group parameters of the current group."
8305 (gnus-group-customize gnus-newsgroup-name))
8307 (defun gnus-summary-enter-digest-group (&optional force)
8308 "Enter an nndoc group based on the current article.
8309 If FORCE, force a digest interpretation. If not, try
8310 to guess what the document format is."
8312 (let ((conf gnus-current-window-configuration))
8313 (save-window-excursion
8315 (let (gnus-article-prepare-hook
8316 gnus-display-mime-function
8318 (gnus-summary-select-article))))
8319 (setq gnus-current-window-configuration conf)
8320 (let* ((name (format "%s-%d"
8321 (gnus-group-prefixed-name
8322 gnus-newsgroup-name (list 'nndoc ""))
8324 (set-buffer gnus-summary-buffer)
8325 gnus-current-article)))
8326 (ogroup gnus-newsgroup-name)
8327 (params (append (gnus-info-params (gnus-get-info ogroup))
8328 (list (cons 'to-group ogroup))
8329 (list (cons 'parent-group ogroup))
8330 (list (cons 'save-article-group ogroup))))
8331 (case-fold-search t)
8332 (buf (current-buffer))
8335 (set-buffer gnus-original-article-buffer)
8336 ;; Have the digest group inherit the main mail address of
8337 ;; the parent article.
8338 (when (setq to-address (or (gnus-fetch-field "reply-to")
8339 (gnus-fetch-field "from")))
8340 (setq params (append
8341 (list (cons 'to-address
8342 (funcall gnus-decode-encoded-word-function
8344 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8345 (insert-buffer-substring gnus-original-article-buffer)
8346 ;; Remove lines that may lead nndoc to misinterpret the
8349 (goto-char (point-min))
8350 (or (search-forward "\n\n" nil t) (point)))
8351 (goto-char (point-min))
8352 (delete-matching-lines "^Path:\\|^From ")
8355 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8356 (gnus-newsgroup-ephemeral-ignored-charsets
8357 gnus-newsgroup-ignored-charsets))
8358 (gnus-group-read-ephemeral-group
8359 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8361 ,(if force 'mbox 'guess)))
8363 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8365 ;; Make all postings to this group go to the parent group.
8366 (nconc (gnus-info-params (gnus-get-info name))
8368 ;; Couldn't select this doc group.
8369 (switch-to-buffer buf)
8370 (gnus-set-global-variables)
8371 (gnus-configure-windows 'summary)
8372 (gnus-message 3 "Article couldn't be entered?"))
8373 (kill-buffer dig)))))
8375 (defun gnus-summary-read-document (n)
8376 "Open a new group based on the current article(s).
8377 This will allow you to read digests and other similar
8378 documents as newsgroups.
8379 Obeys the standard process/prefix convention."
8381 (let* ((articles (gnus-summary-work-articles n))
8382 (ogroup gnus-newsgroup-name)
8383 (params (append (gnus-info-params (gnus-get-info ogroup))
8384 (list (cons 'to-group ogroup))))
8385 article group egroup groups vgroup)
8386 (while (setq article (pop articles))
8387 (setq group (format "%s-%d" gnus-newsgroup-name article))
8388 (gnus-summary-remove-process-mark article)
8389 (when (gnus-summary-display-article article)
8392 (insert-buffer-substring gnus-original-article-buffer)
8393 ;; Remove some headers that may lead nndoc to make
8395 (message-narrow-to-head)
8396 (goto-char (point-min))
8397 (delete-matching-lines "^\\(Path\\):\\|^From ")
8400 (gnus-group-read-ephemeral-group
8401 group `(nndoc ,group (nndoc-address ,(current-buffer))
8402 (nndoc-article-type guess))
8405 ;; Make all postings to this group go to the parent group.
8406 (nconc (gnus-info-params (gnus-get-info egroup))
8408 (push egroup groups))
8409 ;; Couldn't select this doc group.
8410 (gnus-error 3 "Article couldn't be entered"))))))
8411 ;; Now we have selected all the documents.
8414 (error "None of the articles could be interpreted as documents"))
8415 ((gnus-group-read-ephemeral-group
8416 (setq vgroup (format
8417 "nnvirtual:%s-%s" gnus-newsgroup-name
8418 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8419 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8421 (cons (current-buffer) 'summary)))
8423 (error "Couldn't select virtual nndoc group")))))
8425 (defun gnus-summary-isearch-article (&optional regexp-p)
8426 "Do incremental search forward on the current article.
8427 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8429 (gnus-summary-select-article)
8430 (gnus-configure-windows 'article)
8431 (gnus-eval-in-buffer-window gnus-article-buffer
8434 (isearch-forward regexp-p))))
8436 (defun gnus-summary-search-article-forward (regexp &optional backward)
8437 "Search for an article containing REGEXP forward.
8438 If BACKWARD, search backward instead."
8441 (format "Search article %s (regexp%s): "
8442 (if current-prefix-arg "backward" "forward")
8443 (if gnus-last-search-regexp
8444 (concat ", default " gnus-last-search-regexp)
8446 current-prefix-arg))
8447 (if (string-equal regexp "")
8448 (setq regexp (or gnus-last-search-regexp ""))
8449 (setq gnus-last-search-regexp regexp)
8450 (setq gnus-article-before-search gnus-current-article))
8451 ;; Intentionally set gnus-last-article.
8452 (setq gnus-last-article gnus-article-before-search)
8453 (let ((gnus-last-article gnus-last-article))
8454 (if (gnus-summary-search-article regexp backward)
8455 (gnus-summary-show-thread)
8456 (signal 'search-failed (list regexp)))))
8458 (defun gnus-summary-search-article-backward (regexp)
8459 "Search for an article containing REGEXP backward."
8462 (format "Search article backward (regexp%s): "
8463 (if gnus-last-search-regexp
8464 (concat ", default " gnus-last-search-regexp)
8466 (gnus-summary-search-article-forward regexp 'backward))
8468 (defun gnus-summary-search-article (regexp &optional backward)
8469 "Search for an article containing REGEXP.
8470 Optional argument BACKWARD means do search for backward.
8471 `gnus-select-article-hook' is not called during the search."
8472 ;; We have to require this here to make sure that the following
8473 ;; dynamic binding isn't shadowed by autoloading.
8474 (require 'gnus-async)
8476 (let ((gnus-select-article-hook nil) ;Disable hook.
8477 (gnus-article-prepare-hook nil)
8478 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8479 (gnus-use-article-prefetch nil)
8480 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8481 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8483 (gnus-keep-backlog nil)
8484 (gnus-break-pages nil)
8485 (gnus-summary-display-arrow nil)
8486 (gnus-updated-mode-lines nil)
8487 (gnus-auto-center-summary nil)
8488 (sum (current-buffer))
8489 (gnus-display-mime-function nil)
8492 (gnus-save-hidden-threads
8493 (gnus-summary-select-article)
8494 (set-buffer gnus-article-buffer)
8495 (goto-char (window-point (get-buffer-window (current-buffer))))
8499 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8501 (re-search-backward regexp nil t)
8502 (re-search-forward regexp nil t))
8503 ;; We found the regexp.
8508 (get-buffer-window (current-buffer))
8512 (get-buffer-window (current-buffer))
8515 (setq point (point)))
8516 ;; We didn't find it, so we go to the next article.
8519 (while (eq found 'not)
8520 (if (not (if backward (gnus-summary-find-prev)
8521 (gnus-summary-find-next)))
8522 ;; No more articles.
8524 ;; Select the next article and adjust point.
8525 (unless (gnus-summary-article-sparse-p
8526 (gnus-summary-article-number))
8528 (gnus-summary-select-article)
8529 (set-buffer gnus-article-buffer)
8531 (goto-char (if backward (point-max) (point-min))))))))
8532 (gnus-message 7 ""))
8533 ;; Return whether we found the regexp.
8534 (when (eq found 'found)
8536 (gnus-summary-show-thread)
8537 (gnus-summary-goto-subject gnus-current-article)
8538 (gnus-summary-position-point)
8541 (defun gnus-find-matching-articles (header regexp)
8542 "Return a list of all articles that match REGEXP on HEADER.
8543 This search includes all articles in the current group that Gnus has
8544 fetched headers for, whether they are displayed or not."
8545 (let ((articles nil)
8546 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8547 (case-fold-search t))
8548 (dolist (header gnus-newsgroup-headers)
8549 (when (string-match regexp (funcall func header))
8550 (push (mail-header-number header) articles)))
8551 (nreverse articles)))
8553 (defun gnus-summary-find-matching (header regexp &optional backward unread
8554 not-case-fold not-matching)
8555 "Return a list of all articles that match REGEXP on HEADER.
8556 The search stars on the current article and goes forwards unless
8557 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8558 If UNREAD is non-nil, only unread articles will
8559 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8560 in the comparisons. If NOT-MATCHING, return a list of all articles that
8561 not match REGEXP on HEADER."
8562 (let ((case-fold-search (not not-case-fold))
8565 (if (eq (car header) 'extra)
8568 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8570 (error "%s is an invalid header" header))
8571 (unless (fboundp (intern (concat "mail-header-" header)))
8572 (error "%s is not a valid header" header))
8573 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8574 (dolist (d (if (eq backward 'all)
8576 (gnus-data-find-list
8577 (gnus-summary-article-number)
8578 (gnus-data-list backward))))
8579 (when (and (or (not unread) ; We want all articles...
8580 (gnus-data-unread-p d)) ; Or just unreads.
8581 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8585 (funcall func (gnus-data-header d))))
8586 (string-match regexp
8587 (funcall func (gnus-data-header d)))))
8588 (push (gnus-data-number d) articles))) ; Success!
8589 (nreverse articles)))
8591 (defun gnus-summary-execute-command (header regexp command &optional backward)
8592 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8593 If HEADER is an empty string (or nil), the match is done on the entire
8594 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8596 (list (let ((completion-ignore-case t))
8599 (mapcar (lambda (header) (list (format "%s" header)))
8601 '("Number" "Subject" "From" "Lines" "Date"
8602 "Message-ID" "Xref" "References" "Body")
8603 gnus-extra-headers))
8604 nil 'require-match))
8605 (read-string "Regexp: ")
8606 (read-key-sequence "Command: ")
8607 current-prefix-arg))
8608 (when (equal header "Body")
8610 ;; Hidden thread subtrees must be searched as well.
8611 (gnus-summary-show-all-threads)
8612 ;; We don't want to change current point nor window configuration.
8614 (save-window-excursion
8616 gnus-treat-strip-trailing-blank-lines
8617 gnus-treat-strip-leading-blank-lines
8618 gnus-treat-strip-multiple-blank-lines
8619 gnus-treat-hide-boring-headers
8620 gnus-treat-fold-newsgroups
8621 gnus-article-prepare-hook)
8622 (gnus-message 6 "Executing %s..." (key-description command))
8623 ;; We'd like to execute COMMAND interactively so as to give arguments.
8624 (gnus-execute header regexp
8625 `(call-interactively ',(key-binding command))
8627 (gnus-message 6 "Executing %s...done" (key-description command))))))
8629 (defun gnus-summary-beginning-of-article ()
8630 "Scroll the article back to the beginning."
8632 (gnus-summary-select-article)
8633 (gnus-configure-windows 'article)
8634 (gnus-eval-in-buffer-window gnus-article-buffer
8636 (goto-char (point-min))
8637 (when gnus-break-pages
8638 (gnus-narrow-to-page))))
8640 (defun gnus-summary-end-of-article ()
8641 "Scroll to the end of the article."
8643 (gnus-summary-select-article)
8644 (gnus-configure-windows 'article)
8645 (gnus-eval-in-buffer-window gnus-article-buffer
8647 (goto-char (point-max))
8649 (when gnus-break-pages
8650 (when (re-search-backward page-delimiter nil t)
8651 (narrow-to-region (match-end 0) (point-max)))
8652 (gnus-narrow-to-page))))
8654 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8655 "Truncate to LEN and quote all \"(\"'s in STRING."
8656 (gnus-replace-in-string (if (and len (> (length string) len))
8657 (substring string 0 len)
8661 (defun gnus-summary-print-article (&optional filename n)
8662 "Generate and print a PostScript image of the process-marked (mail) articles.
8664 If used interactively, print the current article if none are
8665 process-marked. With prefix arg, prompt the user for the name of the
8668 When used from Lisp, accept two optional args FILENAME and N. N means
8669 to print the next N articles. If N is negative, print the N previous
8670 articles. If N is nil and articles have been marked with the process
8671 mark, print these instead.
8673 If the optional first argument FILENAME is nil, send the image to the
8674 printer. If FILENAME is a string, save the PostScript image in a file with
8675 that name. If FILENAME is a number, prompt the user for the name of the file
8677 (interactive (list (ps-print-preprint current-prefix-arg)))
8678 (dolist (article (gnus-summary-work-articles n))
8679 (gnus-summary-select-article nil nil 'pseudo article)
8680 (gnus-eval-in-buffer-window gnus-article-buffer
8681 (gnus-print-buffer))
8682 (gnus-summary-remove-process-mark article))
8683 (ps-despool filename))
8685 (defun gnus-print-buffer ()
8686 (let ((buffer (generate-new-buffer " *print*")))
8689 (copy-to-buffer buffer (point-min) (point-max))
8691 (gnus-remove-text-with-property 'gnus-decoration)
8692 (when (gnus-visual-p 'article-highlight 'highlight)
8693 ;; Copy-to-buffer doesn't copy overlay. So redo
8695 (let ((gnus-article-buffer buffer))
8696 (gnus-article-highlight-citation t)
8697 (gnus-article-highlight-signature)
8698 (gnus-article-emphasize)
8699 (gnus-article-delete-invisible-text)))
8700 (let ((ps-left-header
8703 (gnus-summary-print-truncate-and-quote
8704 (mail-header-subject gnus-current-headers)
8707 (gnus-summary-print-truncate-and-quote
8708 (mail-header-from gnus-current-headers)
8712 "/pagenumberstring load"
8714 (mail-header-date gnus-current-headers) ")"))))
8715 (gnus-run-hooks 'gnus-ps-print-hook)
8718 (ps-spool-buffer-with-faces)
8719 (ps-spool-buffer)))))
8720 (kill-buffer buffer))))
8722 (defun gnus-summary-show-article (&optional arg)
8723 "Force redisplaying of the current article.
8724 If ARG (the prefix) is a number, show the article with the charset
8725 defined in `gnus-summary-show-article-charset-alist', or the charset
8727 If ARG (the prefix) is non-nil and not a number, show the raw article
8728 without any article massaging functions being run. Normally, the key
8729 strokes are `C-u g'."
8733 (gnus-summary-show-article t)
8734 (let ((gnus-newsgroup-charset
8735 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8736 (mm-read-coding-system
8737 "View as charset: " ;; actually it is coding system.
8739 (set-buffer gnus-article-buffer)
8740 (mm-detect-coding-region (point) (point-max))))))
8741 (gnus-newsgroup-ignored-charsets 'gnus-all))
8742 (gnus-summary-select-article nil 'force)
8743 (let ((deps gnus-newsgroup-dependencies)
8746 (set-buffer gnus-original-article-buffer)
8748 (message-narrow-to-head)
8749 (setq head (buffer-string))
8750 (goto-char (point-min))
8751 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8752 (goto-char (point-max))
8754 (setq lines (1- (count-lines (point) (point-max))))))
8756 (insert (format "211 %d Article retrieved.\n"
8757 (cdr gnus-article-current)))
8759 (if lines (insert (format "Lines: %d\n" lines)))
8761 (let ((nntp-server-buffer (current-buffer)))
8762 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8763 (gnus-data-set-header
8764 (gnus-data-find (cdr gnus-article-current))
8766 (gnus-summary-update-article-line
8767 (cdr gnus-article-current) header)
8768 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8769 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8771 ;; Select the article the normal way.
8772 (gnus-summary-select-article nil 'force))
8774 ;; We have to require this here to make sure that the following
8775 ;; dynamic binding isn't shadowed by autoloading.
8776 (require 'gnus-async)
8778 ;; Bind the article treatment functions to nil.
8779 (let ((gnus-have-all-headers t)
8780 gnus-article-prepare-hook
8781 gnus-article-decode-hook
8782 gnus-display-mime-function
8784 ;; Destroy any MIME parts.
8785 (when (gnus-buffer-live-p gnus-article-buffer)
8787 (set-buffer gnus-article-buffer)
8788 (mm-destroy-parts gnus-article-mime-handles)
8789 ;; Set it to nil for safety reason.
8790 (setq gnus-article-mime-handle-alist nil)
8791 (setq gnus-article-mime-handles nil)))
8792 (gnus-summary-select-article nil 'force))))
8793 (gnus-summary-goto-subject gnus-current-article)
8794 (gnus-summary-position-point))
8796 (defun gnus-summary-show-raw-article ()
8797 "Show the raw article without any article massaging functions being run."
8799 (gnus-summary-show-article t))
8801 (defun gnus-summary-verbose-headers (&optional arg)
8802 "Toggle permanent full header display.
8803 If ARG is a positive number, turn header display on.
8804 If ARG is a negative number, turn header display off."
8806 (setq gnus-show-all-headers
8807 (cond ((or (not (numberp arg))
8809 (not gnus-show-all-headers))
8812 (gnus-summary-show-article))
8814 (defun gnus-summary-toggle-header (&optional arg)
8815 "Show the headers if they are hidden, or hide them if they are shown.
8816 If ARG is a positive number, show the entire header.
8817 If ARG is a negative number, hide the unwanted header lines."
8819 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8820 (get-buffer-window gnus-article-buffer t))))
8821 (with-current-buffer gnus-article-buffer
8823 (article-narrow-to-head)
8824 (let* ((buffer-read-only nil)
8825 (inhibit-point-motion-hooks t)
8826 (hidden (if (numberp arg)
8828 (or (not (looking-at "[^ \t\n]+:"))
8829 (gnus-article-hidden-text-p 'headers))))
8831 (delete-region (point-min) (point-max))
8832 (with-current-buffer gnus-original-article-buffer
8833 (goto-char (setq s (point-min)))
8834 (setq e (if (search-forward "\n\n" nil t)
8837 (insert-buffer-substring gnus-original-article-buffer s e)
8838 (run-hooks 'gnus-article-decode-hook)
8840 (let ((gnus-treat-hide-headers nil)
8841 (gnus-treat-hide-boring-headers nil))
8842 (gnus-delete-wash-type 'headers)
8843 (gnus-treat-article 'head))
8844 (gnus-treat-article 'head))
8847 (set-window-start window (goto-char (point-min))))
8848 (if gnus-break-pages
8849 (gnus-narrow-to-page)
8850 (when (gnus-visual-p 'page-marker)
8851 (let ((buffer-read-only nil))
8852 (gnus-remove-text-with-property 'gnus-prev)
8853 (gnus-remove-text-with-property 'gnus-next))))
8854 (gnus-set-mode-line 'article)))))
8856 (defun gnus-summary-show-all-headers ()
8857 "Make all header lines visible."
8859 (gnus-summary-toggle-header 1))
8861 (defun gnus-summary-caesar-message (&optional arg)
8862 "Caesar rotate the current article by 13.
8863 The numerical prefix specifies how many places to rotate each letter
8866 (gnus-summary-select-article)
8867 (let ((mail-header-separator ""))
8868 (gnus-eval-in-buffer-window gnus-article-buffer
8871 (let ((start (window-start))
8873 (message-caesar-buffer-body arg)
8874 (set-window-start (get-buffer-window (current-buffer)) start)))))
8875 ;; Create buttons and stuff...
8876 (gnus-treat-article nil))
8878 (autoload 'unmorse-region "morse"
8879 "Convert morse coded text in region to ordinary ASCII text."
8882 (defun gnus-summary-morse-message (&optional arg)
8883 "Morse decode the current article."
8885 (gnus-summary-select-article)
8886 (let ((mail-header-separator ""))
8887 (gnus-eval-in-buffer-window gnus-article-buffer
8891 (let ((pos (window-start))
8893 (goto-char (point-min))
8894 (when (message-goto-body)
8895 (gnus-narrow-to-body))
8896 (goto-char (point-min))
8897 (while (re-search-forward "·" (point-max) t)
8898 (replace-match "."))
8899 (unmorse-region (point-min) (point-max))
8901 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8903 (defun gnus-summary-stop-page-breaking ()
8904 "Stop page breaking in the current article."
8906 (gnus-summary-select-article)
8907 (gnus-eval-in-buffer-window gnus-article-buffer
8909 (when (gnus-visual-p 'page-marker)
8910 (let ((buffer-read-only nil))
8911 (gnus-remove-text-with-property 'gnus-prev)
8912 (gnus-remove-text-with-property 'gnus-next))
8913 (setq gnus-page-broken nil))))
8915 (defun gnus-summary-move-article (&optional n to-newsgroup
8916 select-method action)
8917 "Move the current article to a different newsgroup.
8918 If N is a positive number, move the N next articles.
8919 If N is a negative number, move the N previous articles.
8920 If N is nil and any articles have been marked with the process mark,
8921 move those articles instead.
8922 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8923 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8924 re-spool using this method.
8926 When called interactively with TO-NEWSGROUP being nil, the value of
8927 the variable `gnus-move-split-methods' is used for finding a default
8928 for the target newsgroup.
8930 For this function to work, both the current newsgroup and the
8931 newsgroup that you want to move to have to support the `request-move'
8932 and `request-accept' functions.
8934 ACTION can be either `move' (the default), `crosspost' or `copy'."
8937 (setq action 'move))
8938 ;; Check whether the source group supports the required functions.
8939 (cond ((and (eq action 'move)
8940 (not (gnus-check-backend-function
8941 'request-move-article gnus-newsgroup-name)))
8942 (error "The current group does not support article moving"))
8943 ((and (eq action 'crosspost)
8944 (not (gnus-check-backend-function
8945 'request-replace-article gnus-newsgroup-name)))
8946 (error "The current group does not support article editing")))
8947 (let ((articles (gnus-summary-work-articles n))
8948 (prefix (if (gnus-check-backend-function
8949 'request-move-article gnus-newsgroup-name)
8950 (gnus-group-real-prefix gnus-newsgroup-name)
8952 (names '((move "Move" "Moving")
8953 (copy "Copy" "Copying")
8954 (crosspost "Crosspost" "Crossposting")))
8955 (copy-buf (save-excursion
8956 (nnheader-set-temp-buffer " *copy article*")))
8957 art-group to-method new-xref article to-groups)
8958 (unless (assq action names)
8959 (error "Unknown action %s" action))
8960 ;; Read the newsgroup name.
8961 (when (and (not to-newsgroup)
8962 (not select-method))
8963 (if (and gnus-move-split-methods
8965 (and (memq gnus-current-article articles)
8966 (gnus-buffer-live-p gnus-original-article-buffer))))
8967 ;; When `gnus-move-split-methods' is non-nil, we have to
8968 ;; select an article to give `gnus-read-move-group-name' an
8969 ;; opportunity to suggest an appropriate default. However,
8970 ;; we needn't render or mark the article.
8971 (let ((gnus-display-mime-function nil)
8972 (gnus-article-prepare-hook nil)
8973 (gnus-mark-article-hook nil))
8974 (gnus-summary-select-article nil nil nil (car articles))))
8976 (gnus-read-move-group-name
8977 (cadr (assq action names))
8978 (symbol-value (intern (format "gnus-current-%s-group" action)))
8980 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8981 (setq to-method (or select-method
8982 (gnus-server-to-method
8983 (gnus-group-method to-newsgroup))))
8984 ;; Check the method we are to move this article to...
8985 (unless (gnus-check-backend-function
8986 'request-accept-article (car to-method))
8987 (error "%s does not support article copying" (car to-method)))
8988 (unless (gnus-check-server to-method)
8989 (error "Can't open server %s" (car to-method)))
8990 (gnus-message 6 "%s to %s: %s..."
8991 (caddr (assq action names))
8992 (or (car select-method) to-newsgroup) articles)
8994 (setq article (pop articles))
8998 ;; Move the article.
9000 ;; Remove this article from future suppression.
9001 (gnus-dup-unsuppress-article article)
9002 (gnus-request-move-article
9003 article ; Article to move
9004 gnus-newsgroup-name ; From newsgroup
9005 (nth 1 (gnus-find-method-for-group
9006 gnus-newsgroup-name)) ; Server
9007 (list 'gnus-request-accept-article
9008 to-newsgroup (list 'quote select-method)
9009 (not articles) t) ; Accept form
9010 (not articles))) ; Only save nov last time
9011 ;; Copy the article.
9014 (set-buffer copy-buf)
9015 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9016 (gnus-request-accept-article
9017 to-newsgroup select-method (not articles) t))))
9018 ;; Crosspost the article.
9019 ((eq action 'crosspost)
9020 (let ((xref (message-tokenize-header
9021 (mail-header-xref (gnus-summary-article-header article))
9023 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9024 ":" (number-to-string article)))
9026 (setq xref (list (system-name))))
9029 (mapconcat 'identity
9030 (delete "Xref:" (delete new-xref xref))
9034 (set-buffer copy-buf)
9035 ;; First put the article in the destination group.
9036 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9037 (when (consp (setq art-group
9038 (gnus-request-accept-article
9039 to-newsgroup select-method (not articles))))
9040 (setq new-xref (concat new-xref " " (car art-group)
9042 (number-to-string (cdr art-group))))
9043 ;; Now we have the new Xrefs header, so we insert
9044 ;; it and replace the new article.
9045 (nnheader-replace-header "Xref" new-xref)
9046 (gnus-request-replace-article
9047 (cdr art-group) to-newsgroup (current-buffer))
9051 (gnus-message 1 "Couldn't %s article %s: %s"
9052 (cadr (assq action names)) article
9053 (nnheader-get-report (car to-method))))
9054 ((eq art-group 'junk)
9055 (when (eq action 'move)
9056 (gnus-summary-mark-article article gnus-canceled-mark)
9057 (gnus-message 4 "Deleted article %s" article)
9058 ;; run the delete hook
9059 (run-hook-with-args 'gnus-summary-article-delete-hook
9062 (assoc article (gnus-data-list nil)))
9063 gnus-newsgroup-name nil
9066 (let* ((pto-group (gnus-group-prefixed-name
9067 (car art-group) to-method))
9069 (gnus-gethash pto-group gnus-newsrc-hashtb))
9070 (info (nth 2 entry))
9071 (to-group (gnus-info-group info))
9073 ;; Update the group that has been moved to.
9075 (memq action '(move copy)))
9076 (unless (member to-group to-groups)
9077 (push to-group to-groups))
9079 (unless (memq article gnus-newsgroup-unreads)
9080 (push 'read to-marks)
9082 info (gnus-add-to-range (gnus-info-read info)
9083 (list (cdr art-group)))))
9085 ;; See whether the article is to be put in the cache.
9086 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9087 gnus-article-mark-lists
9088 (delete '(expirable . expire)
9089 (copy-sequence gnus-article-mark-lists))))
9090 (to-article (cdr art-group)))
9092 ;; Enter the article into the cache in the new group,
9093 ;; if that is required.
9094 (when gnus-use-cache
9095 (gnus-cache-possibly-enter-article
9097 (memq article gnus-newsgroup-marked)
9098 (memq article gnus-newsgroup-dormant)
9099 (memq article gnus-newsgroup-unreads)))
9101 (when gnus-preserve-marks
9102 ;; Copy any marks over to the new group.
9103 (when (and (equal to-group gnus-newsgroup-name)
9104 (not (memq article gnus-newsgroup-unreads)))
9105 ;; Mark this article as read in this group.
9106 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9107 (setcdr (gnus-active to-group) to-article)
9108 (setcdr gnus-newsgroup-active to-article))
9111 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9112 (when (memq article (symbol-value
9113 (intern (format "gnus-newsgroup-%s"
9115 (push (cdar marks) to-marks)
9116 ;; If the other group is the same as this group,
9117 ;; then we have to add the mark to the list.
9118 (when (equal to-group gnus-newsgroup-name)
9119 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9122 (intern (format "gnus-newsgroup-%s"
9124 ;; Copy the marks to other group.
9125 (gnus-add-marked-articles
9126 to-group (cdar marks) (list to-article) info)))
9127 (setq marks (cdr marks)))
9129 (gnus-request-set-mark
9130 to-group (list (list (list to-article) 'add to-marks))))
9133 (concat "(gnus-group-set-info '"
9134 (gnus-prin1-to-string (gnus-get-info to-group))
9137 ;; Update the Xref header in this article to point to
9138 ;; the new crossposted article we have just created.
9139 (when (eq action 'crosspost)
9141 (set-buffer copy-buf)
9142 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9143 (nnheader-replace-header "Xref" new-xref)
9144 (gnus-request-replace-article
9145 article gnus-newsgroup-name (current-buffer))))
9147 ;; run the move/copy/crosspost/respool hook
9148 (run-hook-with-args 'gnus-summary-article-move-hook
9151 (assoc article (gnus-data-list nil)))
9156 ;;;!!!Why is this necessary?
9157 (set-buffer gnus-summary-buffer)
9159 (gnus-summary-goto-subject article)
9160 (when (eq action 'move)
9161 (gnus-summary-mark-article article gnus-canceled-mark))))
9162 (gnus-summary-remove-process-mark article))
9163 ;; Re-activate all groups that have been moved to.
9165 (set-buffer gnus-group-buffer)
9166 (let ((gnus-group-marked to-groups))
9167 (gnus-group-get-new-news-this-group nil t)))
9169 (gnus-kill-buffer copy-buf)
9170 (gnus-summary-position-point)
9171 (gnus-set-mode-line 'summary)))
9173 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9174 "Copy the current article to some other group.
9175 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9176 When called interactively, if TO-NEWSGROUP is nil, use the value of
9177 the variable `gnus-move-split-methods' for finding a default target
9179 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9180 re-spool using this method."
9182 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9184 (defun gnus-summary-crosspost-article (&optional n)
9185 "Crosspost the current article to some other group."
9187 (gnus-summary-move-article n nil nil 'crosspost))
9189 (defcustom gnus-summary-respool-default-method nil
9190 "Default method type for respooling an article.
9191 If nil, use to the current newsgroup method."
9193 :group 'gnus-summary-mail)
9195 (defcustom gnus-summary-display-while-building nil
9196 "If non-nil, show and update the summary buffer as it's being built.
9197 If the value is t, update the buffer after every line is inserted. If
9198 the value is an integer (N), update the display every N lines."
9201 :type '(choice (const :tag "off" nil)
9203 (const :tag "frequently" t)))
9205 (defun gnus-summary-respool-article (&optional n method)
9206 "Respool the current article.
9207 The article will be squeezed through the mail spooling process again,
9208 which means that it will be put in some mail newsgroup or other
9209 depending on `nnmail-split-methods'.
9210 If N is a positive number, respool the N next articles.
9211 If N is a negative number, respool the N previous articles.
9212 If N is nil and any articles have been marked with the process mark,
9213 respool those articles instead.
9215 Respooling can be done both from mail groups and \"real\" newsgroups.
9216 In the former case, the articles in question will be moved from the
9217 current group into whatever groups they are destined to. In the
9218 latter case, they will be copied into the relevant groups."
9220 (list current-prefix-arg
9221 (let* ((methods (gnus-methods-using 'respool))
9223 (symbol-name (or gnus-summary-respool-default-method
9224 (car (gnus-find-method-for-group
9225 gnus-newsgroup-name)))))
9227 (gnus-completing-read-with-default
9228 methname "Backend to use when respooling"
9229 methods nil t nil 'gnus-mail-method-history))
9232 ((zerop (length (setq ms (gnus-servers-using-backend
9234 (list (intern method) ""))
9238 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9239 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9242 (error "No method given for respooling"))
9243 (if (assoc (symbol-name
9244 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9245 (gnus-methods-using 'respool))
9246 (gnus-summary-move-article n nil method)
9247 (gnus-summary-copy-article n nil method)))
9249 (defun gnus-summary-import-article (file &optional edit)
9250 "Import an arbitrary file into a mail newsgroup."
9251 (interactive "fImport file: \nP")
9252 (let ((group gnus-newsgroup-name)
9253 (now (current-time))
9254 atts lines group-art)
9255 (unless (gnus-check-backend-function 'request-accept-article group)
9256 (error "%s does not support article importing" group))
9257 (or (file-readable-p file)
9258 (not (file-regular-p file))
9259 (error "Can't read %s" file))
9261 (set-buffer (gnus-get-buffer-create " *import file*"))
9263 (nnheader-insert-file-contents file)
9264 (goto-char (point-min))
9265 (if (nnheader-article-p)
9267 (goto-char (point-min))
9268 (search-forward "\n\n" nil t)
9269 (narrow-to-region (point-min) (1- (point)))
9270 (goto-char (point-min))
9271 (unless (re-search-forward "^date:" nil t)
9272 (goto-char (point-max))
9273 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9274 ;; This doesn't look like an article, so we fudge some headers.
9275 (setq atts (file-attributes file)
9276 lines (count-lines (point-min) (point-max)))
9277 (insert "From: " (read-string "From: ") "\n"
9278 "Subject: " (read-string "Subject: ") "\n"
9279 "Date: " (message-make-date (nth 5 atts)) "\n"
9280 "Message-ID: " (message-make-message-id) "\n"
9281 "Lines: " (int-to-string lines) "\n"
9282 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9283 (setq group-art (gnus-request-accept-article group nil t))
9284 (kill-buffer (current-buffer)))
9285 (setq gnus-newsgroup-active (gnus-activate-group group))
9287 (gnus-summary-goto-article (cdr group-art) nil t)
9289 (gnus-summary-edit-article))))
9291 (defun gnus-summary-create-article ()
9292 "Create an article in a mail newsgroup."
9294 (let ((group gnus-newsgroup-name)
9295 (now (current-time))
9297 (unless (gnus-check-backend-function 'request-accept-article group)
9298 (error "%s does not support article importing" group))
9300 (set-buffer (gnus-get-buffer-create " *import file*"))
9302 (goto-char (point-min))
9303 ;; This doesn't look like an article, so we fudge some headers.
9304 (insert "From: " (read-string "From: ") "\n"
9305 "Subject: " (read-string "Subject: ") "\n"
9306 "Date: " (message-make-date now) "\n"
9307 "Message-ID: " (message-make-message-id) "\n")
9308 (setq group-art (gnus-request-accept-article group nil t))
9309 (kill-buffer (current-buffer)))
9310 (setq gnus-newsgroup-active (gnus-activate-group group))
9312 (gnus-summary-goto-article (cdr group-art) nil t)
9313 (gnus-summary-edit-article)))
9315 (defun gnus-summary-article-posted-p ()
9316 "Say whether the current (mail) article is available from news as well.
9317 This will be the case if the article has both been mailed and posted."
9319 (let ((id (mail-header-references (gnus-summary-article-header)))
9320 (gnus-override-method (car (gnus-refer-article-methods))))
9321 (if (gnus-request-head id "")
9322 (gnus-message 2 "The current message was found on %s"
9323 gnus-override-method)
9324 (gnus-message 2 "The current message couldn't be found on %s"
9325 gnus-override-method)
9328 (defun gnus-summary-expire-articles (&optional now)
9329 "Expire all articles that are marked as expirable in the current group."
9331 (when (and (not gnus-group-is-exiting-without-update-p)
9332 (gnus-check-backend-function
9333 'request-expire-articles gnus-newsgroup-name))
9334 ;; This backend supports expiry.
9335 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9336 (expirable (if total
9338 ;; We need to update the info for
9339 ;; this group for `gnus-list-of-read-articles'
9340 ;; to give us the right answer.
9341 (gnus-run-hooks 'gnus-exit-group-hook)
9342 (gnus-summary-update-info)
9343 (gnus-list-of-read-articles gnus-newsgroup-name))
9344 (setq gnus-newsgroup-expirable
9345 (sort gnus-newsgroup-expirable '<))))
9346 (expiry-wait (if now 'immediate
9347 (gnus-group-find-parameter
9348 gnus-newsgroup-name 'expiry-wait)))
9349 (nnmail-expiry-target
9350 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9351 nnmail-expiry-target))
9354 ;; There are expirable articles in this group, so we run them
9355 ;; through the expiry process.
9356 (gnus-message 6 "Expiring articles...")
9357 (unless (gnus-check-group gnus-newsgroup-name)
9358 (error "Can't open server for %s" gnus-newsgroup-name))
9359 ;; The list of articles that weren't expired is returned.
9362 (let ((nnmail-expiry-wait-function nil)
9363 (nnmail-expiry-wait expiry-wait))
9364 (setq es (gnus-request-expire-articles
9365 expirable gnus-newsgroup-name)))
9366 (setq es (gnus-request-expire-articles
9367 expirable gnus-newsgroup-name)))
9369 (setq gnus-newsgroup-expirable es))
9370 ;; We go through the old list of expirable, and mark all
9371 ;; really expired articles as nonexistent.
9372 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9373 (let ((gnus-use-cache nil))
9374 (dolist (article expirable)
9375 (when (and (not (memq article es))
9376 (gnus-data-find article))
9377 (gnus-summary-mark-article article gnus-canceled-mark)
9378 (run-hook-with-args 'gnus-summary-article-expire-hook
9381 (assoc article (gnus-data-list nil)))
9385 (gnus-message 6 "Expiring articles...done")))))
9387 (defun gnus-summary-expire-articles-now ()
9388 "Expunge all expirable articles in the current group.
9389 This means that *all* articles that are marked as expirable will be
9390 deleted forever, right now."
9392 (or gnus-expert-user
9394 "Are you really, really, really sure you want to delete all these messages? ")
9396 (gnus-summary-expire-articles t))
9398 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9399 (defun gnus-summary-delete-article (&optional n)
9400 "Delete the N next (mail) articles.
9401 This command actually deletes articles. This is not a marking
9402 command. The article will disappear forever from your life, never to
9405 If N is negative, delete backwards.
9406 If N is nil and articles have been marked with the process mark,
9407 delete these instead.
9409 If `gnus-novice-user' is non-nil you will be asked for
9410 confirmation before the articles are deleted."
9412 (unless (gnus-check-backend-function 'request-expire-articles
9413 gnus-newsgroup-name)
9414 (error "The current newsgroup does not support article deletion"))
9415 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9416 (error "Couldn't open server"))
9417 ;; Compute the list of articles to delete.
9418 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9419 (nnmail-expiry-target 'delete)
9421 (if (and gnus-novice-user
9422 (not (gnus-yes-or-no-p
9423 (format "Do you really want to delete %s forever? "
9424 (if (> (length articles) 1)
9425 (format "these %s articles" (length articles))
9428 ;; Delete the articles.
9429 (setq not-deleted (gnus-request-expire-articles
9430 articles gnus-newsgroup-name 'force))
9432 (gnus-summary-remove-process-mark (car articles))
9433 ;; The backend might not have been able to delete the article
9435 (unless (memq (car articles) not-deleted)
9436 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9437 (let* ((article (car articles))
9438 (id (mail-header-id (gnus-data-header
9439 (assoc article (gnus-data-list nil))))))
9440 (run-hook-with-args 'gnus-summary-article-delete-hook
9441 'delete id gnus-newsgroup-name nil
9443 (setq articles (cdr articles)))
9445 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9446 (gnus-summary-position-point)
9447 (gnus-set-mode-line 'summary)
9450 (defun gnus-summary-edit-article (&optional arg)
9451 "Edit the current article.
9452 This will have permanent effect only in mail groups.
9453 If ARG is nil, edit the decoded articles.
9454 If ARG is 1, edit the raw articles.
9455 If ARG is 2, edit the raw articles even in read-only groups.
9456 If ARG is 3, edit the articles with the current handles.
9457 Otherwise, allow editing of articles even in read-only
9460 (let (force raw current-handles)
9469 (setq current-handles
9470 (and (gnus-buffer-live-p gnus-article-buffer)
9471 (with-current-buffer gnus-article-buffer
9473 gnus-article-mime-handles
9474 (setq gnus-article-mime-handles nil))))))
9477 (when (and raw (not force)
9478 (member gnus-newsgroup-name '("nndraft:delayed"
9481 (error "Can't edit the raw article in group %s"
9482 gnus-newsgroup-name))
9484 (set-buffer gnus-summary-buffer)
9485 (let ((mail-parse-charset gnus-newsgroup-charset)
9486 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9487 (gnus-set-global-variables)
9488 (when (and (not force)
9489 (gnus-group-read-only-p))
9490 (error "The current newsgroup does not support article editing"))
9491 (gnus-summary-show-article t)
9492 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9493 (with-current-buffer gnus-article-buffer
9494 (mm-enable-multibyte)))
9495 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9497 (gnus-article-edit-article
9500 (let ((mbl mml-buffer-list))
9501 (setq mml-buffer-list nil)
9502 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
9503 (mime-to-mml ,'current-handles))
9504 (let ((mbl1 mml-buffer-list))
9505 (setq mml-buffer-list mbl)
9506 (set (make-local-variable 'mml-buffer-list) mbl1))
9507 (gnus-make-local-hook 'kill-buffer-hook)
9508 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9509 `(lambda (no-highlight)
9510 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9511 (message-options message-options)
9512 (message-options-set-recipient)
9513 (mail-parse-ignored-charsets
9514 ',gnus-newsgroup-ignored-charsets))
9515 ,(if (not raw) '(progn
9517 (mml-destroy-buffers)
9518 (remove-hook 'kill-buffer-hook
9519 'mml-destroy-buffers t)
9520 (kill-local-variable 'mml-buffer-list)))
9521 (gnus-summary-edit-article-done
9522 ,(or (mail-header-references gnus-current-headers) "")
9523 ,(gnus-group-read-only-p)
9524 ,gnus-summary-buffer no-highlight))))))))
9526 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9528 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9530 "Make edits to the current article permanent."
9533 ;; The buffer restriction contains the entire article if it exists.
9534 (when (article-goto-body)
9535 (let ((lines (count-lines (point) (point-max)))
9536 (length (- (point-max) (point)))
9537 (case-fold-search t)
9538 (body (copy-marker (point))))
9539 (goto-char (point-min))
9540 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9541 (delete-region (match-beginning 1) (match-end 1))
9542 (insert (number-to-string length)))
9543 (goto-char (point-min))
9544 (when (re-search-forward
9545 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9546 (delete-region (match-beginning 1) (match-end 1))
9547 (insert (number-to-string length)))
9548 (goto-char (point-min))
9549 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9550 (delete-region (match-beginning 1) (match-end 1))
9551 (insert (number-to-string lines))))))
9552 ;; Replace the article.
9553 (let ((buf (current-buffer)))
9555 (insert-buffer-substring buf)
9557 (if (and (not read-only)
9558 (not (gnus-request-replace-article
9559 (cdr gnus-article-current) (car gnus-article-current)
9560 (current-buffer) t)))
9561 (error "Couldn't replace article")
9562 ;; Update the summary buffer.
9564 (equal (message-tokenize-header references " ")
9565 (message-tokenize-header
9566 (or (message-fetch-field "references") "") " ")))
9567 ;; We only have to update this line.
9570 (message-narrow-to-head)
9571 (let ((head (buffer-substring-no-properties
9572 (point-min) (point-max)))
9575 (insert (format "211 %d Article retrieved.\n"
9576 (cdr gnus-article-current)))
9579 (let ((nntp-server-buffer (current-buffer)))
9580 (setq header (car (gnus-get-newsgroup-headers
9583 (set-buffer gnus-summary-buffer)
9584 (gnus-data-set-header
9585 (gnus-data-find (cdr gnus-article-current))
9587 (gnus-summary-update-article-line
9588 (cdr gnus-article-current) header)
9589 (if (gnus-summary-goto-subject
9590 (cdr gnus-article-current) nil t)
9591 (gnus-summary-update-secondary-mark
9592 (cdr gnus-article-current))))))))
9594 (set-buffer (or buffer gnus-summary-buffer))
9595 (gnus-summary-update-article (cdr gnus-article-current))
9596 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9597 (gnus-summary-update-secondary-mark
9598 (cdr gnus-article-current))))
9599 ;; Prettify the article buffer again.
9600 (unless no-highlight
9602 (set-buffer gnus-article-buffer)
9603 ;;;!!! Fix this -- article should be rehighlighted.
9604 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9605 (set-buffer gnus-original-article-buffer)
9606 (gnus-request-article
9607 (cdr gnus-article-current)
9608 (car gnus-article-current) (current-buffer))))
9609 ;; Prettify the summary buffer line.
9610 (when (gnus-visual-p 'summary-highlight 'highlight)
9611 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9613 (defun gnus-summary-edit-wash (key)
9614 "Perform editing command KEY in the article buffer."
9618 (message "%s" (concat (this-command-keys) "- "))
9621 (gnus-summary-edit-article)
9622 (execute-kbd-macro (concat (this-command-keys) key))
9623 (gnus-article-edit-done))
9627 (defun gnus-summary-respool-query (&optional silent trace)
9628 "Query where the respool algorithm would put this article."
9630 (let (gnus-mark-article-hook)
9631 (gnus-summary-select-article)
9633 (set-buffer gnus-original-article-buffer)
9634 (let ((groups (nnmail-article-group 'identity trace)))
9637 (message "This message would go to %s"
9638 (mapconcat 'car groups ", "))
9639 (message "This message would go to no groups"))
9642 (defun gnus-summary-respool-trace ()
9643 "Trace where the respool algorithm would put this article.
9644 Display a buffer showing all fancy splitting patterns which matched."
9646 (gnus-summary-respool-query nil t))
9648 ;; Summary marking commands.
9650 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9651 "Mark articles which has the same subject as read, and then select the next.
9652 If UNMARK is positive, remove any kind of mark.
9653 If UNMARK is negative, tick articles."
9656 (setq unmark (prefix-numeric-value unmark)))
9658 (gnus-summary-mark-same-subject
9659 (gnus-summary-article-subject) unmark)))
9660 ;; Select next unread article. If auto-select-same mode, should
9661 ;; select the first unread article.
9662 (gnus-summary-next-article t (and gnus-auto-select-same
9663 (gnus-summary-article-subject)))
9664 (gnus-message 7 "%d article%s marked as %s"
9665 count (if (= count 1) " is" "s are")
9666 (if unmark "unread" "read"))))
9668 (defun gnus-summary-kill-same-subject (&optional unmark)
9669 "Mark articles which has the same subject as read.
9670 If UNMARK is positive, remove any kind of mark.
9671 If UNMARK is negative, tick articles."
9674 (setq unmark (prefix-numeric-value unmark)))
9676 (gnus-summary-mark-same-subject
9677 (gnus-summary-article-subject) unmark)))
9678 ;; If marked as read, go to next unread subject.
9680 ;; Go to next unread subject.
9681 (gnus-summary-next-subject 1 t))
9682 (gnus-message 7 "%d articles are marked as %s"
9683 count (if unmark "unread" "read"))))
9685 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9686 "Mark articles with same SUBJECT as read, and return marked number.
9687 If optional argument UNMARK is positive, remove any kinds of marks.
9688 If optional argument UNMARK is negative, mark articles as unread instead."
9692 ((null unmark) ; Mark as read.
9695 (gnus-summary-mark-article-as-read gnus-killed-mark)
9696 (gnus-summary-show-thread) t)
9697 (gnus-summary-find-subject subject))
9698 (setq count (1+ count))))
9699 ((> unmark 0) ; Tick.
9702 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9703 (gnus-summary-show-thread) t)
9704 (gnus-summary-find-subject subject))
9705 (setq count (1+ count))))
9706 (t ; Mark as unread.
9709 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9710 (gnus-summary-show-thread) t)
9711 (gnus-summary-find-subject subject))
9712 (setq count (1+ count)))))
9713 (gnus-set-mode-line 'summary)
9714 ;; Return the number of marked articles.
9717 (defun gnus-summary-mark-as-processable (n &optional unmark)
9718 "Set the process mark on the next N articles.
9719 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9720 the process mark instead. The difference between N and the actual
9721 number of articles marked is returned."
9723 (if (and (null n) (gnus-region-active-p))
9724 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9725 (setq n (prefix-numeric-value n))
9726 (let ((backward (< n 0))
9731 (gnus-summary-remove-process-mark
9732 (gnus-summary-article-number))
9733 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9734 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9737 (gnus-message 7 "No more articles"))
9738 (gnus-summary-recenter)
9739 (gnus-summary-position-point)
9742 (defun gnus-summary-unmark-as-processable (n)
9743 "Remove the process mark from the next N articles.
9744 If N is negative, unmark backward instead. The difference between N and
9745 the actual number of articles unmarked is returned."
9747 (gnus-summary-mark-as-processable n t))
9749 (defun gnus-summary-unmark-all-processable ()
9750 "Remove the process mark from all articles."
9753 (while gnus-newsgroup-processable
9754 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9755 (gnus-summary-position-point))
9757 (defun gnus-summary-add-mark (article type)
9758 "Mark ARTICLE with a mark of TYPE."
9759 (let ((vtype (car (assq type gnus-article-mark-lists)))
9762 (error "No such mark type: %s" type)
9763 (setq var (intern (format "gnus-newsgroup-%s" type)))
9764 (set var (cons article (symbol-value var)))
9765 (if (memq type '(processable cached replied forwarded recent saved))
9766 (gnus-summary-update-secondary-mark article)
9767 ;;; !!! This is bogus. We should find out what primary
9768 ;;; !!! mark we want to set.
9769 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9771 (defun gnus-summary-mark-as-expirable (n)
9772 "Mark N articles forward as expirable.
9773 If N is negative, mark backward instead. The difference between N and
9774 the actual number of articles marked is returned."
9776 (gnus-summary-mark-forward n gnus-expirable-mark))
9778 (defun gnus-summary-mark-as-spam (n)
9779 "Mark N articles forward as spam.
9780 If N is negative, mark backward instead. The difference between N and
9781 the actual number of articles marked is returned."
9783 (gnus-summary-mark-forward n gnus-spam-mark))
9785 (defun gnus-summary-mark-article-as-replied (article)
9786 "Mark ARTICLE as replied to and update the summary line.
9787 ARTICLE can also be a list of articles."
9788 (interactive (list (gnus-summary-article-number)))
9789 (let ((articles (if (listp article) article (list article))))
9790 (dolist (article articles)
9791 (unless (numberp article)
9792 (error "%s is not a number" article))
9793 (push article gnus-newsgroup-replied)
9794 (let ((buffer-read-only nil))
9795 (when (gnus-summary-goto-subject article nil t)
9796 (gnus-summary-update-secondary-mark article))))))
9798 (defun gnus-summary-mark-article-as-forwarded (article)
9799 "Mark ARTICLE as forwarded and update the summary line.
9800 ARTICLE can also be a list of articles."
9801 (let ((articles (if (listp article) article (list article))))
9802 (dolist (article articles)
9803 (push article gnus-newsgroup-forwarded)
9804 (let ((buffer-read-only nil))
9805 (when (gnus-summary-goto-subject article nil t)
9806 (gnus-summary-update-secondary-mark article))))))
9808 (defun gnus-summary-set-bookmark (article)
9809 "Set a bookmark in current article."
9810 (interactive (list (gnus-summary-article-number)))
9811 (when (or (not (get-buffer gnus-article-buffer))
9812 (not gnus-current-article)
9813 (not gnus-article-current)
9814 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9815 (error "No current article selected"))
9816 ;; Remove old bookmark, if one exists.
9817 (gnus-pull article gnus-newsgroup-bookmarks)
9818 ;; Set the new bookmark, which is on the form
9819 ;; (article-number . line-number-in-body).
9823 (set-buffer gnus-article-buffer)
9830 gnus-newsgroup-bookmarks)
9831 (gnus-message 6 "A bookmark has been added to the current article."))
9833 (defun gnus-summary-remove-bookmark (article)
9834 "Remove the bookmark from the current article."
9835 (interactive (list (gnus-summary-article-number)))
9836 ;; Remove old bookmark, if one exists.
9837 (if (not (assq article gnus-newsgroup-bookmarks))
9838 (gnus-message 6 "No bookmark in current article.")
9839 (gnus-pull article gnus-newsgroup-bookmarks)
9840 (gnus-message 6 "Removed bookmark.")))
9842 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9843 (defun gnus-summary-mark-as-dormant (n)
9844 "Mark N articles forward as dormant.
9845 If N is negative, mark backward instead. The difference between N and
9846 the actual number of articles marked is returned."
9848 (gnus-summary-mark-forward n gnus-dormant-mark))
9850 (defun gnus-summary-set-process-mark (article)
9851 "Set the process mark on ARTICLE and update the summary line."
9852 (setq gnus-newsgroup-processable
9854 (delq article gnus-newsgroup-processable)))
9855 (when (gnus-summary-goto-subject article)
9856 (gnus-summary-show-thread)
9857 (gnus-summary-goto-subject article)
9858 (gnus-summary-update-secondary-mark article)))
9860 (defun gnus-summary-remove-process-mark (article)
9861 "Remove the process mark from ARTICLE and update the summary line."
9862 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9863 (when (gnus-summary-goto-subject article)
9864 (gnus-summary-show-thread)
9865 (gnus-summary-goto-subject article)
9866 (gnus-summary-update-secondary-mark article)))
9868 (defun gnus-summary-set-saved-mark (article)
9869 "Set the process mark on ARTICLE and update the summary line."
9870 (push article gnus-newsgroup-saved)
9871 (when (gnus-summary-goto-subject article)
9872 (gnus-summary-update-secondary-mark article)))
9874 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9875 "Mark N articles as read forwards.
9876 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9877 The difference between N and the actual number of articles marked is
9879 If NO-EXPIRE, auto-expiry will be inhibited."
9881 (gnus-summary-show-thread)
9882 (let ((backward (< n 0))
9883 (gnus-summary-goto-unread
9884 (and gnus-summary-goto-unread
9885 (not (eq gnus-summary-goto-unread 'never))
9886 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9887 gnus-ticked-mark gnus-dormant-mark)))))
9889 (mark (or mark gnus-del-mark)))
9891 (gnus-summary-mark-article nil mark no-expire)
9892 (zerop (gnus-summary-next-subject
9894 (and gnus-summary-goto-unread
9895 (not (eq gnus-summary-goto-unread 'never)))
9899 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9900 (gnus-summary-recenter)
9901 (gnus-summary-position-point)
9902 (gnus-set-mode-line 'summary)
9905 (defun gnus-summary-mark-article-as-read (mark)
9906 "Mark the current article quickly as read with MARK."
9907 (let ((article (gnus-summary-article-number)))
9908 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9909 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9910 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9911 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9912 (push (cons article mark) gnus-newsgroup-reads)
9913 ;; Possibly remove from cache, if that is used.
9914 (when gnus-use-cache
9915 (gnus-cache-enter-remove-article article))
9916 ;; Allow the backend to change the mark.
9917 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9918 ;; Check for auto-expiry.
9919 (when (and gnus-newsgroup-auto-expire
9920 (memq mark gnus-auto-expirable-marks))
9921 (setq mark gnus-expirable-mark)
9922 ;; Let the backend know about the mark change.
9923 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9924 (push article gnus-newsgroup-expirable))
9925 ;; Set the mark in the buffer.
9926 (gnus-summary-update-mark mark 'unread)
9929 (defun gnus-summary-mark-article-as-unread (mark)
9930 "Mark the current article quickly as unread with MARK."
9931 (let* ((article (gnus-summary-article-number))
9932 (old-mark (gnus-summary-article-mark article)))
9933 ;; Allow the backend to change the mark.
9934 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9935 (if (eq mark old-mark)
9939 (gnus-error 1 "Can't mark negative article numbers")
9941 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9942 (setq gnus-newsgroup-spam-marked
9943 (delq article gnus-newsgroup-spam-marked))
9944 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9945 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9946 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9947 (cond ((= mark gnus-ticked-mark)
9948 (setq gnus-newsgroup-marked
9949 (gnus-add-to-sorted-list gnus-newsgroup-marked
9951 ((= mark gnus-spam-mark)
9952 (setq gnus-newsgroup-spam-marked
9953 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9955 ((= mark gnus-dormant-mark)
9956 (setq gnus-newsgroup-dormant
9957 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9960 (setq gnus-newsgroup-unreads
9961 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9963 (gnus-pull article gnus-newsgroup-reads)
9965 ;; See whether the article is to be put in the cache.
9967 (vectorp (gnus-summary-article-header article))
9969 (gnus-cache-possibly-enter-article
9970 gnus-newsgroup-name article
9971 (= mark gnus-ticked-mark)
9972 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9975 (gnus-summary-update-mark mark 'unread)
9978 (defun gnus-summary-mark-article (&optional article mark no-expire)
9979 "Mark ARTICLE with MARK. MARK can be any character.
9980 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9981 `??' (dormant) and `?E' (expirable).
9982 If MARK is nil, then the default character `?r' is used.
9983 If ARTICLE is nil, then the article on the current line will be
9985 If NO-EXPIRE, auto-expiry will be inhibited."
9986 ;; The mark might be a string.
9987 (when (stringp mark)
9988 (setq mark (aref mark 0)))
9989 ;; If no mark is given, then we check auto-expiring.
9991 (setq mark gnus-del-mark))
9992 (when (and (not no-expire)
9993 gnus-newsgroup-auto-expire
9994 (memq mark gnus-auto-expirable-marks))
9995 (setq mark gnus-expirable-mark))
9996 (let ((article (or article (gnus-summary-article-number)))
9997 (old-mark (gnus-summary-article-mark article)))
9998 ;; Allow the backend to change the mark.
9999 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10000 (if (eq mark old-mark)
10003 (error "No article on current line"))
10004 (if (not (if (or (= mark gnus-unread-mark)
10005 (= mark gnus-ticked-mark)
10006 (= mark gnus-spam-mark)
10007 (= mark gnus-dormant-mark))
10008 (gnus-mark-article-as-unread article mark)
10009 (gnus-mark-article-as-read article mark)))
10011 ;; See whether the article is to be put in the cache.
10012 (and gnus-use-cache
10013 (not (= mark gnus-canceled-mark))
10014 (vectorp (gnus-summary-article-header article))
10016 (gnus-cache-possibly-enter-article
10017 gnus-newsgroup-name article
10018 (= mark gnus-ticked-mark)
10019 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10021 (when (gnus-summary-goto-subject article nil t)
10022 (let ((buffer-read-only nil))
10023 (gnus-summary-show-thread)
10025 (gnus-summary-update-mark mark 'unread)
10028 (defun gnus-summary-update-secondary-mark (article)
10029 "Update the secondary (read, process, cache) mark."
10030 (gnus-summary-update-mark
10031 (cond ((memq article gnus-newsgroup-processable)
10033 ((memq article gnus-newsgroup-cached)
10035 ((memq article gnus-newsgroup-replied)
10037 ((memq article gnus-newsgroup-forwarded)
10038 gnus-forwarded-mark)
10039 ((memq article gnus-newsgroup-saved)
10041 ((memq article gnus-newsgroup-recent)
10043 ((memq article gnus-newsgroup-unseen)
10047 (when (gnus-visual-p 'summary-highlight 'highlight)
10048 (gnus-run-hooks 'gnus-summary-update-hook))
10051 (defun gnus-summary-update-download-mark (article)
10052 "Update the download mark."
10053 (gnus-summary-update-mark
10054 (cond ((memq article gnus-newsgroup-undownloaded)
10055 gnus-undownloaded-mark)
10056 (gnus-newsgroup-agentized
10057 gnus-downloaded-mark)
10061 (gnus-summary-update-line t)
10064 (defun gnus-summary-update-mark (mark type)
10065 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10066 (buffer-read-only nil))
10067 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
10069 (when (looking-at "\r")
10071 (when (<= (+ forward (point)) (point-max))
10072 ;; Go to the right position on the line.
10073 (goto-char (+ forward (point)))
10074 ;; Replace the old mark with the new mark.
10075 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10076 ;; Optionally update the marks by some user rule.
10077 (when (eq type 'unread)
10078 (gnus-data-set-mark
10079 (gnus-data-find (gnus-summary-article-number)) mark)
10080 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10082 (defun gnus-mark-article-as-read (article &optional mark)
10083 "Enter ARTICLE in the pertinent lists and remove it from others."
10084 ;; Make the article expirable.
10085 (let ((mark (or mark gnus-del-mark)))
10086 (setq gnus-newsgroup-expirable
10087 (if (= mark gnus-expirable-mark)
10088 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10089 (delq article gnus-newsgroup-expirable)))
10090 ;; Remove from unread and marked lists.
10091 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10092 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10093 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10094 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10095 (push (cons article mark) gnus-newsgroup-reads)
10096 ;; Possibly remove from cache, if that is used.
10097 (when gnus-use-cache
10098 (gnus-cache-enter-remove-article article))
10101 (defun gnus-mark-article-as-unread (article &optional mark)
10102 "Enter ARTICLE in the pertinent lists and remove it from others."
10103 (let ((mark (or mark gnus-ticked-mark)))
10106 (gnus-error 1 "Can't mark negative article numbers")
10108 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10109 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10110 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10111 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10112 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10114 ;; Unsuppress duplicates?
10115 (when gnus-suppress-duplicates
10116 (gnus-dup-unsuppress-article article))
10118 (cond ((= mark gnus-ticked-mark)
10119 (setq gnus-newsgroup-marked
10120 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10121 ((= mark gnus-spam-mark)
10122 (setq gnus-newsgroup-spam-marked
10123 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10125 ((= mark gnus-dormant-mark)
10126 (setq gnus-newsgroup-dormant
10127 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10129 (setq gnus-newsgroup-unreads
10130 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10131 (gnus-pull article gnus-newsgroup-reads)
10134 (defalias 'gnus-summary-mark-as-unread-forward
10135 'gnus-summary-tick-article-forward)
10136 (make-obsolete 'gnus-summary-mark-as-unread-forward
10137 'gnus-summary-tick-article-forward)
10138 (defun gnus-summary-tick-article-forward (n)
10139 "Tick N articles forwards.
10140 If N is negative, tick backwards instead.
10141 The difference between N and the number of articles ticked is returned."
10143 (gnus-summary-mark-forward n gnus-ticked-mark))
10145 (defalias 'gnus-summary-mark-as-unread-backward
10146 'gnus-summary-tick-article-backward)
10147 (make-obsolete 'gnus-summary-mark-as-unread-backward
10148 'gnus-summary-tick-article-backward)
10149 (defun gnus-summary-tick-article-backward (n)
10150 "Tick N articles backwards.
10151 The difference between N and the number of articles ticked is returned."
10153 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10155 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10156 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10157 (defun gnus-summary-tick-article (&optional article clear-mark)
10158 "Mark current article as unread.
10159 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10160 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10162 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10163 gnus-ticked-mark)))
10165 (defun gnus-summary-mark-as-read-forward (n)
10166 "Mark N articles as read forwards.
10167 If N is negative, mark backwards instead.
10168 The difference between N and the actual number of articles marked is
10171 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10173 (defun gnus-summary-mark-as-read-backward (n)
10174 "Mark the N articles as read backwards.
10175 The difference between N and the actual number of articles marked is
10178 (gnus-summary-mark-forward
10179 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10181 (defun gnus-summary-mark-as-read (&optional article mark)
10182 "Mark current article as read.
10183 ARTICLE specifies the article to be marked as read.
10184 MARK specifies a string to be inserted at the beginning of the line."
10185 (gnus-summary-mark-article article mark))
10187 (defun gnus-summary-clear-mark-forward (n)
10188 "Clear marks from N articles forward.
10189 If N is negative, clear backward instead.
10190 The difference between N and the number of marks cleared is returned."
10192 (gnus-summary-mark-forward n gnus-unread-mark))
10194 (defun gnus-summary-clear-mark-backward (n)
10195 "Clear marks from N articles backward.
10196 The difference between N and the number of marks cleared is returned."
10198 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10200 (defun gnus-summary-mark-unread-as-read ()
10201 "Intended to be used by `gnus-summary-mark-article-hook'."
10202 (when (memq gnus-current-article gnus-newsgroup-unreads)
10203 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10205 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10206 "Intended to be used by `gnus-summary-mark-article-hook'."
10207 (let ((mark (gnus-summary-article-mark)))
10208 (when (or (gnus-unread-mark-p mark)
10209 (gnus-read-mark-p mark))
10210 (gnus-summary-mark-article gnus-current-article
10211 (or new-mark gnus-read-mark)))))
10213 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10214 "Intended to be used by `gnus-summary-mark-article-hook'."
10215 (let ((mark (gnus-summary-article-mark)))
10216 (when (or (gnus-unread-mark-p mark)
10217 (gnus-read-mark-p mark))
10218 (gnus-summary-mark-article (gnus-summary-article-number)
10219 (or new-mark gnus-read-mark)))))
10221 (defun gnus-summary-mark-unread-as-ticked ()
10222 "Intended to be used by `gnus-summary-mark-article-hook'."
10223 (when (memq gnus-current-article gnus-newsgroup-unreads)
10224 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10226 (defun gnus-summary-mark-region-as-read (point mark all)
10227 "Mark all unread articles between point and mark as read.
10228 If given a prefix, mark all articles between point and mark as read,
10229 even ticked and dormant ones."
10230 (interactive "r\nP")
10234 (beginning-of-line)
10239 (memq (setq article (gnus-summary-article-number))
10240 gnus-newsgroup-unreads))
10241 (gnus-summary-mark-article article gnus-del-mark))
10243 (gnus-summary-find-next))))))
10245 (defun gnus-summary-mark-below (score mark)
10246 "Mark articles with score less than SCORE with MARK."
10247 (interactive "P\ncMark: ")
10248 (setq score (if score
10249 (prefix-numeric-value score)
10250 (or gnus-summary-default-score 0)))
10252 (set-buffer gnus-summary-buffer)
10253 (goto-char (point-min))
10256 (and (< (gnus-summary-article-score) score)
10257 (gnus-summary-mark-article nil mark))
10258 (gnus-summary-find-next)))))
10260 (defun gnus-summary-kill-below (&optional score)
10261 "Mark articles with score below SCORE as read."
10263 (gnus-summary-mark-below score gnus-killed-mark))
10265 (defun gnus-summary-clear-above (&optional score)
10266 "Clear all marks from articles with score above SCORE."
10268 (gnus-summary-mark-above score gnus-unread-mark))
10270 (defun gnus-summary-tick-above (&optional score)
10271 "Tick all articles with score above SCORE."
10273 (gnus-summary-mark-above score gnus-ticked-mark))
10275 (defun gnus-summary-mark-above (score mark)
10276 "Mark articles with score over SCORE with MARK."
10277 (interactive "P\ncMark: ")
10278 (setq score (if score
10279 (prefix-numeric-value score)
10280 (or gnus-summary-default-score 0)))
10282 (set-buffer gnus-summary-buffer)
10283 (goto-char (point-min))
10285 (when (> (gnus-summary-article-score) score)
10286 (gnus-summary-mark-article nil mark))
10288 (gnus-summary-find-next)))))
10290 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10291 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10292 (defun gnus-summary-limit-include-expunged (&optional no-error)
10293 "Display all the hidden articles that were expunged for low scores."
10295 (let ((buffer-read-only nil))
10296 (let ((scored gnus-newsgroup-scored)
10299 (unless (gnus-summary-article-header (caar scored))
10300 (and (setq h (gnus-number-to-header (caar scored)))
10301 (< (cdar scored) gnus-summary-expunge-below)
10303 (setq scored (cdr scored)))
10305 (when (not no-error)
10306 (error "No expunged articles hidden"))
10307 (goto-char (point-min))
10308 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10309 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10310 (mapcar (lambda (x) (push (mail-header-number x)
10311 gnus-newsgroup-limit))
10313 (gnus-summary-prepare-unthreaded (nreverse headers))
10314 (goto-char (point-min))
10315 (gnus-summary-position-point)
10318 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10319 "Mark all unread articles in this newsgroup as read.
10320 If prefix argument ALL is non-nil, ticked and dormant articles will
10321 also be marked as read.
10322 If QUIETLY is non-nil, no questions will be asked.
10324 If TO-HERE is non-nil, it should be a point in the buffer. All
10325 articles before (after, if REVERSE is set) this point will be marked
10328 Note that this function will only catch up the unread article
10329 in the current summary buffer limitation.
10331 The number of articles marked as read is returned."
10336 (not gnus-interactive-catchup) ;Without confirmation?
10340 "Mark absolutely all articles as read? "
10341 "Mark all unread articles as read? ")))
10343 (not gnus-newsgroup-adaptive)
10344 (not gnus-newsgroup-auto-expire)
10345 (not gnus-suppress-duplicates)
10346 (or (not gnus-use-cache)
10347 (eq gnus-use-cache 'passive)))
10350 (setq gnus-newsgroup-marked nil
10351 gnus-newsgroup-spam-marked nil
10352 gnus-newsgroup-dormant nil))
10353 (setq gnus-newsgroup-unreads
10354 (gnus-sorted-nunion
10355 (gnus-intersection gnus-newsgroup-unreads
10356 gnus-newsgroup-downloadable)
10357 gnus-newsgroup-unfetched)))
10358 ;; We actually mark all articles as canceled, which we
10359 ;; have to do when using auto-expiry or adaptive scoring.
10360 (gnus-summary-show-all-threads)
10361 (if (and to-here reverse)
10363 (goto-char to-here)
10364 (gnus-summary-mark-current-read-and-unread-as-read
10366 (while (gnus-summary-find-next (not all))
10367 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10368 (when (gnus-summary-first-subject (not all))
10370 (if to-here (< (point) to-here) t)
10371 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10372 (gnus-summary-find-next (not all))))))
10373 (gnus-set-mode-line 'summary))
10375 (gnus-summary-position-point)))
10377 (defun gnus-summary-catchup-to-here (&optional all)
10378 "Mark all unticked articles before the current one as read.
10379 If ALL is non-nil, also mark ticked and dormant articles as read."
10382 (gnus-save-hidden-threads
10383 (let ((beg (point)))
10384 ;; We check that there are unread articles.
10385 (when (or all (gnus-summary-find-prev))
10386 (gnus-summary-catchup all t beg)))))
10387 (gnus-summary-position-point))
10389 (defun gnus-summary-catchup-from-here (&optional all)
10390 "Mark all unticked articles after (and including) the current one as read.
10391 If ALL is non-nil, also mark ticked and dormant articles as read."
10394 (gnus-save-hidden-threads
10395 (let ((beg (point)))
10396 ;; We check that there are unread articles.
10397 (when (or all (gnus-summary-find-next))
10398 (gnus-summary-catchup all t beg nil t)))))
10399 (gnus-summary-position-point))
10401 (defun gnus-summary-catchup-all (&optional quietly)
10402 "Mark all articles in this newsgroup as read.
10403 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10404 instead, which marks only unread articles as read."
10406 (gnus-summary-catchup t quietly))
10408 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10409 "Mark all unread articles in this group as read, then exit.
10410 If prefix argument ALL is non-nil, all articles are marked as read.
10411 If QUIETLY is non-nil, no questions will be asked."
10413 (when (gnus-summary-catchup all quietly nil 'fast)
10414 ;; Select next newsgroup or exit.
10415 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10416 (eq gnus-auto-select-next 'quietly))
10417 (gnus-summary-next-group nil)
10418 (gnus-summary-exit))))
10420 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10421 "Mark all articles in this newsgroup as read, and then exit.
10422 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10423 instead, which marks only unread articles as read."
10425 (gnus-summary-catchup-and-exit t quietly))
10427 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10428 "Mark all articles in this group as read and select the next group.
10429 If given a prefix, mark all articles, unread as well as ticked, as
10433 (gnus-summary-catchup all))
10434 (gnus-summary-next-group))
10440 (defmacro gnus-with-article (article &rest forms)
10441 "Select ARTICLE and perform FORMS in the original article buffer.
10442 Then replace the article with the result."
10444 ;; We don't want the article to be marked as read.
10445 (let (gnus-mark-article-hook)
10446 (gnus-summary-select-article t t nil ,article))
10447 (set-buffer gnus-original-article-buffer)
10449 (if (not (gnus-check-backend-function
10450 'request-replace-article (car gnus-article-current)))
10451 (gnus-message 5 "Read-only group; not replacing")
10452 (unless (gnus-request-replace-article
10453 ,article (car gnus-article-current)
10454 (current-buffer) t)
10455 (error "Couldn't replace article")))
10456 ;; The cache and backlog have to be flushed somewhat.
10457 (when gnus-keep-backlog
10458 (gnus-backlog-remove-article
10459 (car gnus-article-current) (cdr gnus-article-current)))
10460 (when gnus-use-cache
10461 (gnus-cache-update-article
10462 (car gnus-article-current) (cdr gnus-article-current)))))
10464 (put 'gnus-with-article 'lisp-indent-function 1)
10465 (put 'gnus-with-article 'edebug-form-spec '(form body))
10467 ;; Thread-based commands.
10469 (defun gnus-summary-articles-in-thread (&optional article)
10470 "Return a list of all articles in the current thread.
10471 If ARTICLE is non-nil, return all articles in the thread that starts
10472 with that article."
10473 (let* ((article (or article (gnus-summary-article-number)))
10474 (data (gnus-data-find-list article))
10475 (top-level (gnus-data-level (car data)))
10477 (cond ((null gnus-thread-operation-ignore-subject)
10478 (gnus-simplify-subject-re
10479 (mail-header-subject (gnus-data-header (car data)))))
10480 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10481 (gnus-simplify-subject-fuzzy
10482 (mail-header-subject (gnus-data-header (car data)))))
10484 (end-point (save-excursion
10485 (if (gnus-summary-go-to-next-thread)
10486 (point) (point-max))))
10489 (< (gnus-data-pos (car data)) end-point))
10490 (when (or (not top-subject)
10491 (string= top-subject
10492 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10493 (gnus-simplify-subject-fuzzy
10494 (mail-header-subject
10495 (gnus-data-header (car data))))
10496 (gnus-simplify-subject-re
10497 (mail-header-subject
10498 (gnus-data-header (car data)))))))
10499 (push (gnus-data-number (car data)) articles))
10500 (unless (and (setq data (cdr data))
10501 (> (gnus-data-level (car data)) top-level))
10503 ;; Return the list of articles.
10504 (nreverse articles)))
10506 (defun gnus-summary-rethread-current ()
10507 "Rethread the thread the current article is part of."
10509 (let* ((gnus-show-threads t)
10510 (article (gnus-summary-article-number))
10511 (id (mail-header-id (gnus-summary-article-header)))
10512 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10514 (error "No article on the current line"))
10515 (gnus-rebuild-thread id)
10516 (gnus-summary-goto-subject article)))
10518 (defun gnus-summary-reparent-thread ()
10519 "Make the current article child of the marked (or previous) article.
10521 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10522 is non-nil or the Subject: of both articles are the same."
10524 (unless (not (gnus-group-read-only-p))
10525 (error "The current newsgroup does not support article editing"))
10526 (unless (<= (length gnus-newsgroup-processable) 1)
10527 (error "No more than one article may be marked"))
10528 (save-window-excursion
10529 (let ((gnus-article-buffer " *reparent*")
10530 (current-article (gnus-summary-article-number))
10531 ;; First grab the marked article, otherwise one line up.
10532 (parent-article (if (not (null gnus-newsgroup-processable))
10533 (car gnus-newsgroup-processable)
10535 (if (eq (forward-line -1) 0)
10536 (gnus-summary-article-number)
10537 (error "Beginning of summary buffer"))))))
10538 (unless (not (eq current-article parent-article))
10539 (error "An article may not be self-referential"))
10540 (let ((message-id (mail-header-id
10541 (gnus-summary-article-header parent-article))))
10542 (unless (and message-id (not (equal message-id "")))
10543 (error "No message-id in desired parent"))
10544 (gnus-with-article current-article
10546 (goto-char (point-min))
10547 (message-narrow-to-head)
10548 (if (re-search-forward "^References: " nil t)
10550 (re-search-forward "^[^ \t]" nil t)
10553 (insert " " message-id))
10554 (insert "References: " message-id "\n"))))
10555 (set-buffer gnus-summary-buffer)
10556 (gnus-summary-unmark-all-processable)
10557 (gnus-summary-update-article current-article)
10558 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10559 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10560 (gnus-summary-rethread-current)
10561 (gnus-message 3 "Article %d is now the child of article %d"
10562 current-article parent-article)))))
10564 (defun gnus-summary-toggle-threads (&optional arg)
10565 "Toggle showing conversation threads.
10566 If ARG is positive number, turn showing conversation threads on."
10568 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10569 (setq gnus-show-threads
10570 (if (null arg) (not gnus-show-threads)
10571 (> (prefix-numeric-value arg) 0)))
10572 (gnus-summary-prepare)
10573 (gnus-summary-goto-subject current)
10574 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10575 (gnus-summary-position-point)))
10577 (defun gnus-summary-show-all-threads ()
10578 "Show all threads."
10581 (let ((buffer-read-only nil))
10582 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10583 (gnus-summary-position-point))
10585 (defun gnus-summary-show-thread ()
10586 "Show thread subtrees.
10587 Returns nil if no thread was there to be shown."
10589 (let ((buffer-read-only nil)
10591 (end (gnus-point-at-eol))
10592 ;; Leave point at bol
10593 (beg (progn (beginning-of-line) (point))))
10595 ;; Any hidden lines here?
10596 (search-forward "\r" end t)
10597 (subst-char-in-region beg end ?\^M ?\n t)
10599 (gnus-summary-position-point))))
10601 (defun gnus-summary-maybe-hide-threads ()
10602 "If requested, hide the threads that should be hidden."
10603 (when (and gnus-show-threads
10604 gnus-thread-hide-subtree)
10605 (gnus-summary-hide-all-threads
10606 (if (or (consp gnus-thread-hide-subtree)
10607 (functionp gnus-thread-hide-subtree))
10608 (gnus-make-predicate gnus-thread-hide-subtree)
10611 ;;; Hiding predicates.
10613 (defun gnus-article-unread-p (header)
10614 (memq (mail-header-number header) gnus-newsgroup-unreads))
10616 (defun gnus-article-unseen-p (header)
10617 (memq (mail-header-number header) gnus-newsgroup-unseen))
10619 (defun gnus-map-articles (predicate articles)
10620 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10621 (apply 'gnus-or (mapcar predicate
10622 (mapcar 'gnus-summary-article-header articles))))
10624 (defun gnus-summary-hide-all-threads (&optional predicate)
10625 "Hide all thread subtrees.
10626 If PREDICATE is supplied, threads that satisfy this predicate
10627 will not be hidden."
10630 (goto-char (point-min))
10633 (when (or (not predicate)
10635 predicate (gnus-summary-article-children)))
10636 (gnus-summary-hide-thread))
10637 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10638 (gnus-summary-position-point))
10640 (defun gnus-summary-hide-thread ()
10641 "Hide thread subtrees.
10642 If PREDICATE is supplied, threads that satisfy this predicate
10643 will not be hidden.
10644 Returns nil if no threads were there to be hidden."
10646 (let ((buffer-read-only nil)
10648 (article (gnus-summary-article-number)))
10650 ;; Go forward until either the buffer ends or the subthread
10652 (when (and (not (eobp))
10653 (or (zerop (gnus-summary-next-thread 1 t))
10654 (goto-char (point-max))))
10656 (if (and (> (point) start)
10657 (search-backward "\n" start t))
10659 (subst-char-in-region start (point) ?\n ?\^M)
10660 (gnus-summary-goto-subject article))
10664 (defun gnus-summary-go-to-next-thread (&optional previous)
10665 "Go to the same level (or less) next thread.
10666 If PREVIOUS is non-nil, go to previous thread instead.
10667 Return the article number moved to, or nil if moving was impossible."
10668 (let ((level (gnus-summary-thread-level))
10669 (way (if previous -1 1))
10672 (while (and (not (eobp))
10673 (< level (gnus-summary-thread-level)))
10674 (forward-line way))
10681 (gnus-summary-article-number)
10682 (goto-char beg)))))
10684 (defun gnus-summary-next-thread (n &optional silent)
10685 "Go to the same level next N'th thread.
10686 If N is negative, search backward instead.
10687 Returns the difference between N and the number of skips actually
10690 If SILENT, don't output messages."
10692 (let ((backward (< n 0))
10694 (while (and (> n 0)
10695 (gnus-summary-go-to-next-thread backward))
10698 (gnus-summary-position-point))
10699 (when (and (not silent) (/= 0 n))
10700 (gnus-message 7 "No more threads"))
10703 (defun gnus-summary-prev-thread (n)
10704 "Go to the same level previous N'th thread.
10705 Returns the difference between N and the number of skips actually
10708 (gnus-summary-next-thread (- n)))
10710 (defun gnus-summary-go-down-thread ()
10711 "Go down one level in the current thread."
10712 (let ((children (gnus-summary-article-children)))
10714 (gnus-summary-goto-subject (car children)))))
10716 (defun gnus-summary-go-up-thread ()
10717 "Go up one level in the current thread."
10718 (let ((parent (gnus-summary-article-parent)))
10720 (gnus-summary-goto-subject parent))))
10722 (defun gnus-summary-down-thread (n)
10723 "Go down thread N steps.
10724 If N is negative, go up instead.
10725 Returns the difference between N and how many steps down that were
10730 (while (and (> n 0)
10731 (if up (gnus-summary-go-up-thread)
10732 (gnus-summary-go-down-thread)))
10734 (gnus-summary-position-point)
10736 (gnus-message 7 "Can't go further"))
10739 (defun gnus-summary-up-thread (n)
10740 "Go up thread N steps.
10741 If N is negative, go down instead.
10742 Returns the difference between N and how many steps down that were
10745 (gnus-summary-down-thread (- n)))
10747 (defun gnus-summary-top-thread ()
10748 "Go to the top of the thread."
10750 (while (gnus-summary-go-up-thread))
10751 (gnus-summary-article-number))
10753 (defun gnus-summary-kill-thread (&optional unmark)
10754 "Mark articles under current thread as read.
10755 If the prefix argument is positive, remove any kinds of marks.
10756 If the prefix argument is negative, tick articles instead."
10759 (setq unmark (prefix-numeric-value unmark)))
10760 (let ((articles (gnus-summary-articles-in-thread)))
10762 ;; Expand the thread.
10763 (gnus-summary-show-thread)
10764 ;; Mark all the articles.
10766 (gnus-summary-goto-subject (car articles))
10767 (cond ((null unmark)
10768 (gnus-summary-mark-article-as-read gnus-killed-mark))
10770 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10772 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10773 (setq articles (cdr articles))))
10774 ;; Hide killed subtrees.
10776 gnus-thread-hide-killed
10777 (gnus-summary-hide-thread))
10778 ;; If marked as read, go to next unread subject.
10779 (when (null unmark)
10780 ;; Go to next unread subject.
10781 (gnus-summary-next-subject 1 t)))
10782 (gnus-set-mode-line 'summary))
10784 ;; Summary sorting commands
10786 (defun gnus-summary-sort-by-number (&optional reverse)
10787 "Sort the summary buffer by article number.
10788 Argument REVERSE means reverse order."
10790 (gnus-summary-sort 'number reverse))
10792 (defun gnus-summary-sort-by-random (&optional reverse)
10793 "Randomize the order in the summary buffer.
10794 Argument REVERSE means to randomize in reverse order."
10796 (gnus-summary-sort 'random reverse))
10798 (defun gnus-summary-sort-by-author (&optional reverse)
10799 "Sort the summary buffer by author name alphabetically.
10800 If `case-fold-search' is non-nil, case of letters is ignored.
10801 Argument REVERSE means reverse order."
10803 (gnus-summary-sort 'author reverse))
10805 (defun gnus-summary-sort-by-subject (&optional reverse)
10806 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10807 If `case-fold-search' is non-nil, case of letters is ignored.
10808 Argument REVERSE means reverse order."
10810 (gnus-summary-sort 'subject reverse))
10812 (defun gnus-summary-sort-by-date (&optional reverse)
10813 "Sort the summary buffer by date.
10814 Argument REVERSE means reverse order."
10816 (gnus-summary-sort 'date reverse))
10818 (defun gnus-summary-sort-by-score (&optional reverse)
10819 "Sort the summary buffer by score.
10820 Argument REVERSE means reverse order."
10822 (gnus-summary-sort 'score reverse))
10824 (defun gnus-summary-sort-by-lines (&optional reverse)
10825 "Sort the summary buffer by the number of lines.
10826 Argument REVERSE means reverse order."
10828 (gnus-summary-sort 'lines reverse))
10830 (defun gnus-summary-sort-by-chars (&optional reverse)
10831 "Sort the summary buffer by article length.
10832 Argument REVERSE means reverse order."
10834 (gnus-summary-sort 'chars reverse))
10836 (defun gnus-summary-sort-by-original (&optional reverse)
10837 "Sort the summary buffer using the default sorting method.
10838 Argument REVERSE means reverse order."
10840 (let* ((buffer-read-only)
10841 (gnus-summary-prepare-hook nil))
10842 ;; We do the sorting by regenerating the threads.
10843 (gnus-summary-prepare)
10844 ;; Hide subthreads if needed.
10845 (gnus-summary-maybe-hide-threads)))
10847 (defun gnus-summary-sort (predicate reverse)
10848 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10849 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10850 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10851 (gnus-thread-sort-functions
10856 (gnus-sort-gathered-threads-function
10857 gnus-thread-sort-functions)
10858 (gnus-article-sort-functions
10862 (,article t2 t1))))
10864 (gnus-summary-prepare-hook nil))
10865 ;; We do the sorting by regenerating the threads.
10866 (gnus-summary-prepare)
10867 ;; Hide subthreads if needed.
10868 (gnus-summary-maybe-hide-threads)))
10870 ;; Summary saving commands.
10872 (defun gnus-summary-save-article (&optional n not-saved)
10873 "Save the current article using the default saver function.
10874 If N is a positive number, save the N next articles.
10875 If N is a negative number, save the N previous articles.
10876 If N is nil and any articles have been marked with the process mark,
10877 save those articles instead.
10878 The variable `gnus-default-article-saver' specifies the saver function."
10880 (let* ((articles (gnus-summary-work-articles n))
10881 (save-buffer (save-excursion
10882 (nnheader-set-temp-buffer " *Gnus Save*")))
10883 (num (length articles))
10885 (dolist (article articles)
10886 (setq header (gnus-summary-article-header article))
10887 (if (not (vectorp header))
10888 ;; This is a pseudo-article.
10889 (if (assq 'name header)
10890 (gnus-copy-file (cdr (assq 'name header)))
10891 (gnus-message 1 "Article %d is unsaveable" article))
10892 ;; This is a real article.
10893 (save-window-excursion
10894 (let ((gnus-display-mime-function nil)
10895 (gnus-article-prepare-hook nil))
10896 (gnus-summary-select-article t nil nil article)))
10898 (set-buffer save-buffer)
10900 (insert-buffer-substring gnus-original-article-buffer))
10901 (setq file (gnus-article-save save-buffer file num))
10902 (gnus-summary-remove-process-mark article)
10904 (gnus-summary-set-saved-mark article))))
10905 (gnus-kill-buffer save-buffer)
10906 (gnus-summary-position-point)
10907 (gnus-set-mode-line 'summary)
10910 (defun gnus-summary-pipe-output (&optional arg headers)
10911 "Pipe the current article to a subprocess.
10912 If N is a positive number, pipe the N next articles.
10913 If N is a negative number, pipe the N previous articles.
10914 If N is nil and any articles have been marked with the process mark,
10915 pipe those articles instead.
10916 If HEADERS (the symbolic prefix), include the headers, too."
10917 (interactive (gnus-interactive "P\ny"))
10918 (require 'gnus-art)
10919 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10920 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10921 (gnus-summary-save-article arg t))
10922 (let ((buffer (get-buffer "*Shell Command Output*")))
10924 (not (zerop (buffer-size buffer))))
10925 (gnus-configure-windows 'pipe))))
10927 (defun gnus-summary-save-article-mail (&optional arg)
10928 "Append the current article to an mail file.
10929 If N is a positive number, save the N next articles.
10930 If N is a negative number, save the N previous articles.
10931 If N is nil and any articles have been marked with the process mark,
10932 save those articles instead."
10934 (require 'gnus-art)
10935 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10936 (gnus-summary-save-article arg)))
10938 (defun gnus-summary-save-article-rmail (&optional arg)
10939 "Append the current article to an rmail file.
10940 If N is a positive number, save the N next articles.
10941 If N is a negative number, save the N previous articles.
10942 If N is nil and any articles have been marked with the process mark,
10943 save those articles instead."
10945 (require 'gnus-art)
10946 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10947 (gnus-summary-save-article arg)))
10949 (defun gnus-summary-save-article-file (&optional arg)
10950 "Append the current article to a file.
10951 If N is a positive number, save the N next articles.
10952 If N is a negative number, save the N previous articles.
10953 If N is nil and any articles have been marked with the process mark,
10954 save those articles instead."
10956 (require 'gnus-art)
10957 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10958 (gnus-summary-save-article arg)))
10960 (defun gnus-summary-write-article-file (&optional arg)
10961 "Write the current article to a file, deleting the previous file.
10962 If N is a positive number, save the N next articles.
10963 If N is a negative number, save the N previous articles.
10964 If N is nil and any articles have been marked with the process mark,
10965 save those articles instead."
10967 (require 'gnus-art)
10968 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10969 (gnus-summary-save-article arg)))
10971 (defun gnus-summary-save-article-body-file (&optional arg)
10972 "Append the current article body to a file.
10973 If N is a positive number, save the N next articles.
10974 If N is a negative number, save the N previous articles.
10975 If N is nil and any articles have been marked with the process mark,
10976 save those articles instead."
10978 (require 'gnus-art)
10979 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10980 (gnus-summary-save-article arg)))
10982 (defun gnus-summary-muttprint (&optional arg)
10983 "Print the current article using Muttprint.
10984 If N is a positive number, save the N next articles.
10985 If N is a negative number, save the N previous articles.
10986 If N is nil and any articles have been marked with the process mark,
10987 save those articles instead."
10989 (require 'gnus-art)
10990 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10991 (gnus-summary-save-article arg t)))
10993 (defun gnus-summary-pipe-message (program)
10994 "Pipe the current article through PROGRAM."
10995 (interactive "sProgram: ")
10996 (gnus-summary-select-article)
10997 (let ((mail-header-separator ""))
10998 (gnus-eval-in-buffer-window gnus-article-buffer
11001 (let ((start (window-start))
11003 (message-pipe-buffer-body program)
11004 (set-window-start (get-buffer-window (current-buffer)) start))))))
11006 (defun gnus-get-split-value (methods)
11007 "Return a value based on the split METHODS."
11008 (let (split-name method result match)
11011 (set-buffer gnus-original-article-buffer)
11013 (nnheader-narrow-to-headers)
11014 (while (and methods (not split-name))
11015 (goto-char (point-min))
11016 (setq method (pop methods))
11017 (setq match (car method))
11020 ;; Regular expression.
11022 (re-search-forward match nil t)))
11027 (setq result (funcall match gnus-newsgroup-name))))
11032 (setq result (eval match)))))
11033 (setq split-name (cdr method))
11034 (cond ((stringp result)
11035 (push (expand-file-name
11036 result gnus-article-save-directory)
11039 (setq split-name (append result split-name)))))))))
11040 (nreverse split-name)))
11042 (defun gnus-valid-move-group-p (group)
11043 (and (boundp group)
11044 (symbol-name group)
11045 (symbol-value group)
11046 (gnus-get-function (gnus-find-method-for-group
11047 (symbol-name group)) 'request-accept-article t)))
11049 (defun gnus-read-move-group-name (prompt default articles prefix)
11050 "Read a group name."
11051 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11052 (minibuffer-confirm-incomplete nil) ; XEmacs
11056 (if (> (length articles) 1)
11057 (format "these %d articles" (length articles))
11062 (gnus-completing-read-with-default
11065 'gnus-valid-move-group-p
11067 'gnus-group-history))
11068 ((= 1 (length split-name))
11069 (gnus-completing-read-with-default
11070 (car split-name) prom
11072 'gnus-valid-move-group-p
11074 'gnus-group-history))
11076 (gnus-completing-read-with-default
11078 (mapcar (lambda (el) (list el))
11079 (nreverse split-name))
11081 'gnus-group-history))))
11082 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11084 (if (or (string= to-newsgroup "")
11085 (string= to-newsgroup prefix))
11086 (setq to-newsgroup default))
11087 (unless to-newsgroup
11088 (error "No group name entered"))
11089 (or (gnus-active to-newsgroup)
11090 (gnus-activate-group to-newsgroup nil nil to-method)
11091 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11093 (or (and (gnus-request-create-group to-newsgroup to-method)
11094 (gnus-activate-group
11095 to-newsgroup nil nil to-method)
11096 (gnus-subscribe-group to-newsgroup))
11097 (error "Couldn't create group %s" to-newsgroup)))
11098 (error "No such group: %s" to-newsgroup)))
11101 (defun gnus-summary-save-parts (type dir n &optional reverse)
11102 "Save parts matching TYPE to DIR.
11103 If REVERSE, save parts that do not match TYPE."
11105 (list (read-string "Save parts of type: "
11106 (or (car gnus-summary-save-parts-type-history)
11107 gnus-summary-save-parts-default-mime)
11108 'gnus-summary-save-parts-type-history)
11109 (setq gnus-summary-save-parts-last-directory
11110 (read-file-name "Save to directory: "
11111 gnus-summary-save-parts-last-directory
11113 current-prefix-arg))
11114 (gnus-summary-iterate n
11115 (let ((gnus-display-mime-function nil)
11116 (gnus-inhibit-treatment t))
11117 (gnus-summary-select-article))
11119 (set-buffer gnus-article-buffer)
11120 (let ((handles (or gnus-article-mime-handles
11121 (mm-dissect-buffer nil gnus-article-loose-mime)
11122 (and gnus-article-emulate-mime
11123 (mm-uu-dissect)))))
11125 (gnus-summary-save-parts-1 type dir handles reverse)
11126 (unless gnus-article-mime-handles ;; Don't destroy this case.
11127 (mm-destroy-parts handles)))))))
11129 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11130 (if (stringp (car handle))
11131 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11134 (not (string-match type (mm-handle-media-type handle)))
11135 (string-match type (mm-handle-media-type handle)))
11136 (let ((file (expand-file-name
11138 mm-file-name-rewrite-functions
11139 (file-name-nondirectory
11141 (mail-content-type-get
11142 (mm-handle-disposition handle) 'filename)
11143 (mail-content-type-get
11144 (mm-handle-type handle) 'name)
11145 (concat gnus-newsgroup-name
11146 "." (number-to-string
11147 (cdr gnus-article-current))))))
11149 (unless (file-exists-p file)
11150 (mm-save-part-to-file handle file))))))
11152 ;; Summary extract commands
11154 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11155 (let ((buffer-read-only nil)
11156 (article (gnus-summary-article-number))
11158 (unless (gnus-summary-goto-subject article)
11159 (error "No such article: %d" article))
11160 (gnus-summary-position-point)
11161 ;; If all commands are to be bunched up on one line, we collect
11163 (unless gnus-view-pseudos-separately
11164 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11167 (setq action (cdr (assq 'action (car ps))))
11168 (setq files (list (cdr (assq 'name (car ps)))))
11169 (while (and ps (cdr ps)
11170 (string= (or action "1")
11171 (or (cdr (assq 'action (cadr ps))) "2")))
11172 (push (cdr (assq 'name (cadr ps))) files)
11173 (setcdr ps (cddr ps)))
11175 (when (not (string-match "%s" action))
11178 (when (assq 'execute (car ps))
11179 (setcdr (assq 'execute (car ps))
11180 (funcall (if (string-match "%s" action)
11189 (setq ps (cdr ps)))))
11190 (if (and gnus-view-pseudos (not not-view))
11192 (when (assq 'execute (car pslist))
11193 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11194 (eq gnus-view-pseudos 'not-confirm)))
11195 (setq pslist (cdr pslist)))
11198 (setq after-article (or (cdr (assq 'article (car pslist)))
11199 (gnus-summary-article-number)))
11200 (gnus-summary-goto-subject after-article)
11203 (insert " " (file-name-nondirectory
11204 (cdr (assq 'name (car pslist))))
11205 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11207 (forward-line -1) ; back to `b'
11208 (gnus-add-text-properties
11209 b (1- e) (list 'gnus-number gnus-reffed-article-number
11210 gnus-mouse-face-prop gnus-mouse-face))
11212 after-article gnus-reffed-article-number
11213 gnus-unread-mark b (car pslist) 0 (- e b))
11214 (setq gnus-newsgroup-unreads
11215 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11216 gnus-reffed-article-number))
11217 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11218 (setq pslist (cdr pslist)))))))
11220 (defun gnus-pseudos< (p1 p2)
11221 (let ((c1 (cdr (assq 'action p1)))
11222 (c2 (cdr (assq 'action p2))))
11223 (and c1 c2 (string< c1 c2))))
11225 (defun gnus-request-pseudo-article (props)
11226 (cond ((assq 'execute props)
11227 (gnus-execute-command (cdr (assq 'execute props)))))
11228 (let ((gnus-current-article (gnus-summary-article-number)))
11229 (gnus-run-hooks 'gnus-mark-article-hook)))
11231 (defun gnus-execute-command (command &optional automatic)
11233 (gnus-article-setup-buffer)
11234 (set-buffer gnus-article-buffer)
11235 (setq buffer-read-only nil)
11236 (let ((command (if automatic command
11237 (read-string "Command: " (cons command 0)))))
11239 (insert "$ " command "\n\n")
11240 (if gnus-view-pseudo-asynchronously
11241 (start-process "gnus-execute" (current-buffer) shell-file-name
11242 shell-command-switch command)
11243 (call-process shell-file-name nil t nil
11244 shell-command-switch command)))))
11246 ;; Summary kill commands.
11248 (defun gnus-summary-edit-global-kill (article)
11249 "Edit the \"global\" kill file."
11250 (interactive (list (gnus-summary-article-number)))
11251 (gnus-group-edit-global-kill article))
11253 (defun gnus-summary-edit-local-kill ()
11254 "Edit a local kill file applied to the current newsgroup."
11256 (setq gnus-current-headers (gnus-summary-article-header))
11257 (gnus-group-edit-local-kill
11258 (gnus-summary-article-number) gnus-newsgroup-name))
11260 ;;; Header reading.
11262 (defun gnus-read-header (id &optional header)
11263 "Read the headers of article ID and enter them into the Gnus system."
11264 (let ((group gnus-newsgroup-name)
11265 (gnus-override-method
11267 gnus-override-method
11268 (and (gnus-news-group-p gnus-newsgroup-name)
11269 (car (gnus-refer-article-methods)))))
11271 ;; First we check to see whether the header in question is already
11274 ;; This is a Message-ID.
11275 (setq header (or header (gnus-id-to-header id)))
11276 ;; This is an article number.
11277 (setq header (or header (gnus-summary-article-header id))))
11279 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11280 ;; We have found the header.
11282 ;; We have to really fetch the header to this article.
11284 (set-buffer nntp-server-buffer)
11285 (when (setq where (gnus-request-head id group))
11286 (nnheader-fold-continuation-lines)
11287 (goto-char (point-max))
11289 (goto-char (point-min))
11293 ((cdr where) (cdr where))
11294 (header (mail-header-number header))
11295 (t gnus-reffed-article-number))
11297 (insert " Article retrieved.\n"))
11298 (if (or (not where)
11299 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11300 () ; Malformed head.
11301 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11302 (when (and (stringp id)
11303 (not (string= (gnus-group-real-name group)
11305 ;; If we fetched by Message-ID and the article came
11306 ;; from a different group, we fudge some bogus article
11307 ;; numbers for this article.
11308 (mail-header-set-number header gnus-reffed-article-number))
11310 (set-buffer gnus-summary-buffer)
11311 (decf gnus-reffed-article-number)
11312 (gnus-remove-header (mail-header-number header))
11313 (push header gnus-newsgroup-headers)
11314 (setq gnus-current-headers header)
11315 (push (mail-header-number header) gnus-newsgroup-limit)))
11318 (defun gnus-remove-header (number)
11319 "Remove header NUMBER from `gnus-newsgroup-headers'."
11320 (if (and gnus-newsgroup-headers
11321 (= number (mail-header-number (car gnus-newsgroup-headers))))
11322 (pop gnus-newsgroup-headers)
11323 (let ((headers gnus-newsgroup-headers))
11324 (while (and (cdr headers)
11325 (not (= number (mail-header-number (cadr headers)))))
11327 (when (cdr headers)
11328 (setcdr headers (cddr headers))))))
11331 ;;; summary highlights
11334 (defun gnus-highlight-selected-summary ()
11335 "Highlight selected article in summary buffer."
11336 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11337 (when gnus-summary-selected-face
11339 (let* ((beg (gnus-point-at-bol))
11340 (end (gnus-point-at-eol))
11341 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11342 (from (if (get-text-property beg gnus-mouse-face-prop)
11344 (or (next-single-property-change
11345 beg gnus-mouse-face-prop nil end)
11350 (or (next-single-property-change
11351 from gnus-mouse-face-prop nil end)
11353 ;; If no mouse-face prop on line we will have to = from = end,
11354 ;; so we highlight the entire line instead.
11355 (when (= (+ to 2) from)
11358 (if gnus-newsgroup-selected-overlay
11359 ;; Move old overlay.
11361 gnus-newsgroup-selected-overlay from to (current-buffer))
11362 ;; Create new overlay.
11364 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11365 'face gnus-summary-selected-face))))))
11367 (defvar gnus-summary-highlight-line-cached nil)
11368 (defvar gnus-summary-highlight-line-trigger nil)
11370 (defun gnus-summary-highlight-line-0 ()
11371 (if (and (eq gnus-summary-highlight-line-trigger
11372 gnus-summary-highlight)
11373 gnus-summary-highlight-line-cached)
11374 gnus-summary-highlight-line-cached
11375 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11376 gnus-summary-highlight-line-cached
11377 (let* ((cond (list 'cond))
11379 (list gnus-summary-highlight))
11381 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11385 (gnus-byte-compile (list 'lambda nil cond))))))
11387 (defun gnus-summary-highlight-line ()
11388 "Highlight current line according to `gnus-summary-highlight'."
11389 (let* ((beg (gnus-point-at-bol))
11390 (article (or (gnus-summary-article-number) gnus-current-article))
11391 (score (or (cdr (assq article
11392 gnus-newsgroup-scored))
11393 gnus-summary-default-score 0))
11394 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11395 (inhibit-read-only t)
11396 (default gnus-summary-default-score)
11397 (default-high gnus-summary-default-high-score)
11398 (default-low gnus-summary-default-low-score)
11399 (uncached (and gnus-summary-use-undownloaded-faces
11400 (memq article gnus-newsgroup-undownloaded)
11401 (not (memq article gnus-newsgroup-cached)))))
11402 (let ((face (funcall (gnus-summary-highlight-line-0))))
11403 (unless (eq face (get-text-property beg 'face))
11404 (gnus-put-text-property-excluding-characters-with-faces
11405 beg (gnus-point-at-eol) 'face
11406 (setq face (if (boundp face) (symbol-value face) face)))
11407 (when gnus-summary-highlight-line-function
11408 (funcall gnus-summary-highlight-line-function article face))))))
11410 (defun gnus-update-read-articles (group unread &optional compute)
11411 "Update the list of read articles in GROUP.
11412 UNREAD is a sorted list."
11413 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
11414 (entry (gnus-gethash group gnus-newsrc-hashtb))
11415 (info (nth 2 entry))
11418 (if (or (not info) (not active))
11419 ;; There is no info on this group if it was, in fact,
11420 ;; killed. Gnus stores no information on killed groups, so
11421 ;; there's nothing to be done.
11422 ;; One could store the information somewhere temporarily,
11423 ;; perhaps... Hmmm...
11425 ;; Remove any negative articles numbers.
11426 (while (and unread (< (car unread) 0))
11427 (setq unread (cdr unread)))
11428 ;; Remove any expired article numbers
11429 (while (and unread (< (car unread) (car active)))
11430 (setq unread (cdr unread)))
11431 ;; Compute the ranges of read articles by looking at the list of
11432 ;; unread articles.
11434 (when (/= (car unread) prev)
11435 (push (if (= prev (1- (car unread))) prev
11436 (cons prev (1- (car unread))))
11438 (setq prev (1+ (car unread)))
11439 (setq unread (cdr unread)))
11440 (when (<= prev (cdr active))
11441 (push (cons prev (cdr active)) read))
11442 (setq read (if (> (length read) 1) (nreverse read) read))
11447 ;; Propagate the read marks to the backend.
11448 (when (gnus-check-backend-function 'request-set-mark group)
11449 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11450 (add (gnus-remove-from-range read (gnus-info-read info))))
11452 (unless (gnus-check-group group)
11453 (error "Can't open server for %s" group))
11454 (gnus-request-set-mark
11455 group (delq nil (list (if add (list add 'add '(read)))
11456 (if del (list del 'del '(read))))))
11458 `(gnus-request-set-mark
11461 (if del (list del 'add '(read)))
11462 (if add (list add 'del '(read))))))))))
11463 (set-buffer gnus-group-buffer)
11464 (gnus-undo-register
11466 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11467 (gnus-info-set-read ',info ',(gnus-info-read info))
11468 (gnus-get-unread-articles-in-group ',info
11469 (gnus-active ,group))
11470 (gnus-group-update-group ,group t)
11472 ;; Enter this list into the group info.
11473 (gnus-info-set-read info read)
11474 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11475 (gnus-get-unread-articles-in-group info (gnus-active group))
11478 (defun gnus-offer-save-summaries ()
11479 "Offer to save all active summary buffers."
11481 ;; Go through all buffers and find all summaries.
11482 (dolist (buffer (buffer-list))
11483 (when (and (setq buffer (buffer-name buffer))
11484 (string-match "Summary" buffer)
11486 (set-buffer buffer)
11487 ;; We check that this is, indeed, a summary buffer.
11488 (and (eq major-mode 'gnus-summary-mode)
11489 ;; Also make sure this isn't bogus.
11490 gnus-newsgroup-prepared
11491 ;; Also make sure that this isn't a
11492 ;; dead summary buffer.
11493 (not gnus-dead-summary-mode))))
11494 (push buffer buffers)))
11495 ;; Go through all these summary buffers and offer to save them.
11499 "Update summary buffer %s? "
11501 (switch-to-buffer buf)
11502 (gnus-summary-exit))
11505 (defun gnus-summary-setup-default-charset ()
11506 "Setup newsgroup default charset."
11507 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11508 (setq gnus-newsgroup-charset nil)
11509 (let* ((ignored-charsets
11510 (or gnus-newsgroup-ephemeral-ignored-charsets
11512 (and gnus-newsgroup-name
11513 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11514 gnus-newsgroup-ignored-charsets))))
11515 (setq gnus-newsgroup-charset
11516 (or gnus-newsgroup-ephemeral-charset
11517 (and gnus-newsgroup-name
11518 (gnus-parameter-charset gnus-newsgroup-name))
11519 gnus-default-charset))
11520 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11521 ignored-charsets))))
11527 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11528 "Display the current article buffer fully MIME-buttonized.
11529 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11530 treated as multipart/mixed."
11532 (require 'gnus-art)
11533 (let ((gnus-unbuttonized-mime-types nil)
11534 (gnus-mime-display-multipart-as-mixed show-all-parts))
11535 (gnus-summary-show-article)))
11537 (defun gnus-summary-repair-multipart (article)
11538 "Add a Content-Type header to a multipart article without one."
11539 (interactive (list (gnus-summary-article-number)))
11540 (gnus-with-article article
11541 (message-narrow-to-head)
11542 (message-remove-header "Mime-Version")
11543 (goto-char (point-max))
11544 (insert "Mime-Version: 1.0\n")
11546 (when (search-forward "\n--" nil t)
11547 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11548 (message-narrow-to-head)
11549 (message-remove-header "Content-Type")
11550 (goto-char (point-max))
11551 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11554 (let (gnus-mark-article-hook)
11555 (gnus-summary-select-article t t nil article)))
11557 (defun gnus-summary-toggle-display-buttonized ()
11558 "Toggle the buttonizing of the article buffer."
11560 (require 'gnus-art)
11561 (if (setq gnus-inhibit-mime-unbuttonizing
11562 (not gnus-inhibit-mime-unbuttonizing))
11563 (let ((gnus-unbuttonized-mime-types nil))
11564 (gnus-summary-show-article))
11565 (gnus-summary-show-article)))
11568 ;;; Generic summary marking commands
11571 (defvar gnus-summary-marking-alist
11572 '((read gnus-del-mark "d")
11573 (unread gnus-unread-mark "u")
11574 (ticked gnus-ticked-mark "!")
11575 (dormant gnus-dormant-mark "?")
11576 (expirable gnus-expirable-mark "e"))
11577 "An alist of names/marks/keystrokes.")
11579 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11580 (defvar gnus-summary-mark-map)
11582 (defun gnus-summary-make-all-marking-commands ()
11583 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11584 (dolist (elem gnus-summary-marking-alist)
11585 (apply 'gnus-summary-make-marking-command elem)))
11587 (defun gnus-summary-make-marking-command (name mark keystroke)
11588 (let ((map (make-sparse-keymap)))
11589 (define-key gnus-summary-generic-mark-map keystroke map)
11590 (dolist (lway `((next "next" next nil "n")
11591 (next-unread "next unread" next t "N")
11592 (prev "previous" prev nil "p")
11593 (prev-unread "previous unread" prev t "P")
11594 (nomove "" nil nil ,keystroke)))
11595 (let ((func (gnus-summary-make-marking-command-1
11596 mark (car lway) lway name)))
11597 (setq func (eval func))
11598 (define-key map (nth 4 lway) func)))))
11600 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11602 (format "gnus-summary-put-mark-as-%s%s"
11603 name (if (eq way 'nomove)
11605 (concat "-" (symbol-name way)))))
11608 "Mark the current article as %s%s.
11609 If N, the prefix, then repeat N times.
11610 If N is negative, move in reverse order.
11611 The difference between N and the actual number of articles marked is
11615 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11617 (defun gnus-summary-generic-mark (n mark move unread)
11618 "Mark N articles with MARK."
11619 (unless (eq major-mode 'gnus-summary-mode)
11620 (error "This command can only be used in the summary buffer"))
11621 (gnus-summary-show-thread)
11624 ((eq move 'next) 1)
11625 ((eq move 'prev) -1)
11627 (if (zerop nummove)
11631 nummove (* -1 nummove))))
11632 (while (and (> n 0)
11633 (gnus-summary-mark-article nil mark)
11634 (zerop (gnus-summary-next-subject nummove unread t)))
11637 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11638 (gnus-summary-recenter)
11639 (gnus-summary-position-point)
11640 (gnus-set-mode-line 'summary)
11643 (defun gnus-summary-insert-articles (articles)
11644 (when (setq articles
11645 (gnus-sorted-difference articles
11646 (mapcar (lambda (h)
11647 (mail-header-number h))
11648 gnus-newsgroup-headers)))
11649 (setq gnus-newsgroup-headers
11651 gnus-newsgroup-headers
11652 (gnus-fetch-headers articles)
11653 'gnus-article-sort-by-number))
11654 ;; Suppress duplicates?
11655 (when gnus-suppress-duplicates
11656 (gnus-dup-suppress-articles))
11658 ;; We might want to build some more threads first.
11659 (when (and gnus-fetch-old-headers
11660 (eq gnus-headers-retrieved-by 'nov))
11661 (if (eq gnus-fetch-old-headers 'invisible)
11662 (gnus-build-all-threads)
11663 (gnus-build-old-threads)))
11664 ;; Let the Gnus agent mark articles as read.
11666 (gnus-agent-get-undownloaded-list))
11667 ;; Remove list identifiers from subject
11668 (when gnus-list-identifiers
11669 (gnus-summary-remove-list-identifiers))
11670 ;; First and last article in this newsgroup.
11671 (when gnus-newsgroup-headers
11672 (setq gnus-newsgroup-begin
11673 (mail-header-number (car gnus-newsgroup-headers))
11675 (mail-header-number
11676 (gnus-last-element gnus-newsgroup-headers))))
11677 (when gnus-use-scoring
11678 (gnus-possibly-score-headers))))
11680 (defun gnus-summary-insert-old-articles (&optional all)
11681 "Insert all old articles in this group.
11682 If ALL is non-nil, already read articles become readable.
11683 If ALL is a number, fetch this number of articles."
11686 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11689 ;; Some nntp servers lie about their active range. When
11690 ;; this happens, the active range can be in the millions.
11691 ;; Use a compressed range to avoid creating a huge list.
11692 (gnus-range-difference (list gnus-newsgroup-active) old))
11693 (setq len (gnus-range-length older))
11698 (let ((older-range (nreverse older)))
11702 (let* ((r (pop older-range))
11703 (min (if (numberp r) r (car r)))
11704 (max (if (numberp r) r (cdr r))))
11705 (while (and (<= min max)
11710 (setq older (gnus-uncompress-range older))))
11712 (setq older (gnus-uncompress-range older)))
11714 (when (and (numberp gnus-large-newsgroup)
11715 (> len gnus-large-newsgroup))
11716 (let* ((cursor-in-echo-area nil)
11717 (initial (gnus-parameter-large-newsgroup-initial
11718 gnus-newsgroup-name))
11722 "How many articles from %s (%s %d): "
11724 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11725 (if initial "max" "default")
11728 (cons (number-to-string initial)
11730 (unless (string-match "^[ \t]*$" input)
11731 (setq all (string-to-number input))
11733 (let ((older-range (nreverse older)))
11737 (let* ((r (pop older-range))
11738 (min (if (numberp r) r (car r)))
11739 (max (if (numberp r) r (cdr r))))
11740 (while (and (<= min max)
11744 max (1- max))))))))))
11745 (setq older (gnus-uncompress-range older))))
11747 (message "No old news.")
11748 (gnus-summary-insert-articles older)
11749 (gnus-summary-limit (gnus-sorted-nunion old older))))
11750 (gnus-summary-position-point)))
11752 (defun gnus-summary-insert-new-articles ()
11753 "Insert all new articles in this group."
11756 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11757 (old-active gnus-newsgroup-active)
11758 (nnmail-fetched-sources (list t))
11760 (setq gnus-newsgroup-active
11761 (gnus-activate-group gnus-newsgroup-name 'scan))
11762 (setq i (cdr gnus-newsgroup-active))
11763 (while (> i (cdr old-active))
11767 (message "No gnus is bad news.")
11768 (gnus-summary-insert-articles new)
11769 (setq gnus-newsgroup-unreads
11770 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11771 (gnus-summary-limit (gnus-sorted-nunion old new))))
11772 (gnus-summary-position-point)))
11774 (gnus-summary-make-all-marking-commands)
11776 (gnus-ems-redefine)
11778 (provide 'gnus-sum)
11780 (run-hooks 'gnus-sum-load-hook)
11782 ;; Local Variables:
11783 ;; coding: iso-8859-1
11786 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11787 ;;; gnus-sum.el ends here