1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Katsumi Yamaoka <yamaoka@jpl.org>
7 ;; Keywords: mail, news, MIME
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., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
30 (eval-when-compile (require 'cl))
46 (autoload 'gnus-cache-articles-in-group "gnus-cache"))
48 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
49 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
51 (defcustom gnus-kill-summary-on-exit t
52 "*If non-nil, kill the summary buffer when you exit from it.
53 If nil, the summary will become a \"*Dead Summary*\" buffer, and
54 it will be killed sometime later."
55 :group 'gnus-summary-exit
58 (defcustom gnus-fetch-old-headers nil
59 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
60 If an unread article in the group refers to an older, already read (or
61 just marked as read) article, the old article will not normally be
62 displayed in the Summary buffer. If this variable is non-nil, Gnus
63 will attempt to grab the headers to the old articles, and thereby
64 build complete threads. If it has the value `some', only enough
65 headers to connect otherwise loose threads will be displayed. This
66 variable can also be a number. In that case, no more than that number
67 of old headers will be fetched. If it has the value `invisible', all
68 old headers will be fetched, but none will be displayed.
70 The server has to support NOV for any of this to work."
72 :type '(choice (const :tag "off" nil)
75 (sexp :menu-tag "other" t)))
77 (defcustom gnus-refer-thread-limit 200
78 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
79 If t, fetch all the available old headers."
82 (sexp :menu-tag "other" t)))
84 (defcustom gnus-summary-make-false-root 'adopt
85 "*nil means that Gnus won't gather loose threads.
86 If the root of a thread has expired or been read in a previous
87 session, the information necessary to build a complete thread has been
88 lost. Instead of having many small sub-threads from this original thread
89 scattered all over the summary buffer, Gnus can gather them.
91 If non-nil, Gnus will try to gather all loose sub-threads from an
92 original thread into one large thread.
94 If this variable is non-nil, it should be one of `none', `adopt',
97 If this variable is `none', Gnus will not make a false root, but just
98 present the sub-threads after another.
99 If this variable is `dummy', Gnus will create a dummy root that will
100 have all the sub-threads as children.
101 If this variable is `adopt', Gnus will make one of the \"children\"
102 the parent and mark all the step-children as such.
103 If this variable is `empty', the \"children\" are printed with empty
104 subject fields. (Or rather, they will be printed with a string
105 given by the `gnus-summary-same-subject' variable.)"
107 :type '(choice (const :tag "off" nil)
113 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
114 "*A regexp to match subjects to be excluded from loose thread gathering.
115 As loose thread gathering is done on subjects only, that means that
116 there can be many false gatherings performed. By rooting out certain
117 common subjects, gathering might become saner."
121 (defcustom gnus-summary-gather-subject-limit nil
122 "*Maximum length of subject comparisons when gathering loose threads.
123 Use nil to compare full subjects. Setting this variable to a low
124 number will help gather threads that have been corrupted by
125 newsreaders chopping off subject lines, but it might also mean that
126 unrelated articles that have subject that happen to begin with the
127 same few characters will be incorrectly gathered.
129 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
132 :type '(choice (const :tag "off" nil)
134 (sexp :menu-tag "on" t)))
136 (defcustom gnus-simplify-subject-functions nil
137 "List of functions taking a string argument that simplify subjects.
138 The functions are applied recursively.
140 Useful functions to put in this list include: `gnus-simplify-subject-re',
141 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
143 :type '(repeat function))
145 (defcustom gnus-simplify-ignored-prefixes nil
146 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
148 :type '(choice (const :tag "off" nil)
151 (defcustom gnus-build-sparse-threads nil
152 "*If non-nil, fill in the gaps in threads.
153 If `some', only fill in the gaps that are needed to tie loose threads
154 together. If `more', fill in all leaf nodes that Gnus can find. If
155 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
157 :type '(choice (const :tag "off" nil)
160 (sexp :menu-tag "all" t)))
162 (defcustom gnus-summary-thread-gathering-function
163 'gnus-gather-threads-by-subject
164 "*Function used for gathering loose threads.
165 There are two pre-defined functions: `gnus-gather-threads-by-subject',
166 which only takes Subjects into consideration; and
167 `gnus-gather-threads-by-references', which compared the References
168 headers of the articles to find matches."
170 :type '(radio (function-item gnus-gather-threads-by-subject)
171 (function-item gnus-gather-threads-by-references)
172 (function :tag "other")))
174 (defcustom gnus-summary-same-subject ""
175 "*String indicating that the current article has the same subject as the previous.
176 This variable will only be used if the value of
177 `gnus-summary-make-false-root' is `empty'."
178 :group 'gnus-summary-format
181 (defcustom gnus-summary-goto-unread t
182 "*If t, marking commands will go to the next unread article.
183 If `never', commands that usually go to the next unread article, will
184 go to the next article, whether it is read or not.
185 If nil, only the marking commands will go to the next (un)read article."
186 :group 'gnus-summary-marks
187 :link '(custom-manual "(gnus)Setting Marks")
188 :type '(choice (const :tag "off" nil)
190 (sexp :menu-tag "on" t)))
192 (defcustom gnus-summary-default-score 0
193 "*Default article score level.
194 All scores generated by the score files will be added to this score.
195 If this variable is nil, scoring will be disabled."
196 :group 'gnus-score-default
197 :type '(choice (const :tag "disable")
200 (defcustom gnus-summary-zcore-fuzz 0
201 "*Fuzziness factor for the zcore in the summary buffer.
202 Articles with scores closer than this to `gnus-summary-default-score'
204 :group 'gnus-summary-format
207 (defcustom gnus-simplify-subject-fuzzy-regexp nil
208 "*Strings to be removed when doing fuzzy matches.
209 This can either be a regular expression or list of regular expressions
210 that will be removed from subject strings if fuzzy subject
211 simplification is selected."
213 :type '(repeat regexp))
215 (defcustom gnus-show-threads t
216 "*If non-nil, display threads in summary mode."
220 (defcustom gnus-thread-hide-subtree nil
221 "*If non-nil, hide all threads initially.
222 If threads are hidden, you have to run the command
223 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
224 to expose hidden threads."
228 (defcustom gnus-thread-hide-killed t
229 "*If non-nil, hide killed threads automatically."
233 (defcustom gnus-thread-ignore-subject t
234 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
235 If nil, articles that have different subjects from their parents will
236 start separate threads."
240 (defcustom gnus-thread-operation-ignore-subject t
241 "*If non-nil, subjects will be ignored when doing thread commands.
242 This affects commands like `gnus-summary-kill-thread' and
243 `gnus-summary-lower-thread'.
245 If this variable is nil, articles in the same thread with different
246 subjects will not be included in the operation in question. If this
247 variable is `fuzzy', only articles that have subjects that are fuzzily
248 equal will be included."
250 :type '(choice (const :tag "off" nil)
254 (defcustom gnus-thread-indent-level 4
255 "*Number that says how much each sub-thread should be indented."
259 (defcustom gnus-auto-extend-newsgroup t
260 "*If non-nil, extend newsgroup forward and backward when requested."
261 :group 'gnus-summary-choose
264 (defcustom gnus-auto-select-first t
265 "*If nil, don't select the first unread article when entering a group.
266 If this variable is `best', select the highest-scored unread article
267 in the group. If t, select the first unread article.
269 This variable can also be a function to place point on a likely
270 subject line. Useful values include `gnus-summary-first-unread-subject',
271 `gnus-summary-first-unread-article' and
272 `gnus-summary-best-unread-article'.
274 If you want to prevent automatic selection of the first unread article
275 in some newsgroups, set the variable to nil in
276 `gnus-select-group-hook'."
277 :group 'gnus-group-select
278 :type '(choice (const :tag "none" nil)
280 (sexp :menu-tag "first" t)
281 (function-item gnus-summary-first-unread-subject)
282 (function-item gnus-summary-first-unread-article)
283 (function-item gnus-summary-best-unread-article)))
285 (defcustom gnus-dont-select-after-jump-to-other-group nil
286 "If non-nil, don't select the first unread article after entering the
287 other group by the command `gnus-summary-jump-to-other-group'. If nil,
288 it is depend on the value of `gnus-auto-select-first' whether to select
290 :group 'gnus-group-select
293 (defcustom gnus-auto-select-next t
294 "*If non-nil, offer to go to the next group from the end of the previous.
295 If the value is t and the next newsgroup is empty, Gnus will exit
296 summary mode and go back to group mode. If the value is neither nil
297 nor t, Gnus will select the following unread newsgroup. In
298 particular, if the value is the symbol `quietly', the next unread
299 newsgroup will be selected without any confirmation, and if it is
300 `almost-quietly', the next group will be selected without any
301 confirmation if you are located on the last article in the group.
302 Finally, if this variable is `slightly-quietly', the `Z n' command
303 will go to the next group without confirmation."
304 :group 'gnus-summary-maneuvering
305 :type '(choice (const :tag "off" nil)
307 (const almost-quietly)
308 (const slightly-quietly)
309 (sexp :menu-tag "on" t)))
311 (defcustom gnus-auto-select-same nil
312 "*If non-nil, select the next article with the same subject.
313 If there are no more articles with the same subject, go to
314 the first unread article."
315 :group 'gnus-summary-maneuvering
318 (defcustom gnus-summary-check-current nil
319 "*If non-nil, consider the current article when moving.
320 The \"unread\" movement commands will stay on the same line if the
321 current article is unread."
322 :group 'gnus-summary-maneuvering
325 (defcustom gnus-auto-center-summary t
326 "*If non-nil, always center the current summary buffer.
327 In particular, if `vertical' do only vertical recentering. If non-nil
328 and non-`vertical', do both horizontal and vertical recentering."
329 :group 'gnus-summary-maneuvering
330 :type '(choice (const :tag "none" nil)
332 (integer :tag "height")
333 (sexp :menu-tag "both" t)))
335 (defcustom gnus-show-all-headers nil
336 "*If non-nil, don't hide any headers."
337 :group 'gnus-article-hiding
338 :group 'gnus-article-headers
341 (defcustom gnus-summary-ignore-duplicates nil
342 "*If non-nil, ignore articles with identical Message-ID headers."
346 (defcustom gnus-single-article-buffer t
347 "*If non-nil, display all articles in the same buffer.
348 If nil, each group will get its own article buffer."
349 :group 'gnus-article-various
352 (defcustom gnus-break-pages t
353 "*If non-nil, do page breaking on articles.
354 The page delimiter is specified by the `gnus-page-delimiter'
356 :group 'gnus-article-various
359 (defcustom gnus-show-mime t
360 "*If non-nil, do mime processing of articles.
361 The articles will simply be fed to the function given by
362 `gnus-article-display-method-for-mime'."
363 :group 'gnus-article-mime
366 (defcustom gnus-move-split-methods nil
367 "*Variable used to suggest where articles are to be moved to.
368 It uses the same syntax as the `gnus-split-methods' variable."
369 :group 'gnus-summary-mail
370 :type '(repeat (choice (list :value (fun) function)
371 (cons :value ("" "") regexp (repeat string))
374 (defcustom gnus-unread-mark ? ;Whitespace
375 "*Mark used for unread articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-ticked-mark ?!
380 "*Mark used for ticked articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-dormant-mark ??
385 "*Mark used for dormant articles."
386 :group 'gnus-summary-marks
389 (defcustom gnus-del-mark ?r
390 "*Mark used for del'd articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-read-mark ?R
395 "*Mark used for read articles."
396 :group 'gnus-summary-marks
399 (defcustom gnus-expirable-mark ?E
400 "*Mark used for expirable articles."
401 :group 'gnus-summary-marks
404 (defcustom gnus-killed-mark ?K
405 "*Mark used for killed articles."
406 :group 'gnus-summary-marks
409 (defcustom gnus-souped-mark ?F
410 "*Mark used for killed articles."
411 :group 'gnus-summary-marks
414 (defcustom gnus-kill-file-mark ?X
415 "*Mark used for articles killed by kill files."
416 :group 'gnus-summary-marks
419 (defcustom gnus-low-score-mark ?Y
420 "*Mark used for articles with a low score."
421 :group 'gnus-summary-marks
424 (defcustom gnus-catchup-mark ?C
425 "*Mark used for articles that are caught up."
426 :group 'gnus-summary-marks
429 (defcustom gnus-replied-mark ?A
430 "*Mark used for articles that have been replied to."
431 :group 'gnus-summary-marks
434 (defcustom gnus-cached-mark ?*
435 "*Mark used for articles that are in the cache."
436 :group 'gnus-summary-marks
439 (defcustom gnus-saved-mark ?S
440 "*Mark used for articles that have been saved to."
441 :group 'gnus-summary-marks
444 (defcustom gnus-ancient-mark ?O
445 "*Mark used for ancient articles."
446 :group 'gnus-summary-marks
449 (defcustom gnus-sparse-mark ?Q
450 "*Mark used for sparsely reffed articles."
451 :group 'gnus-summary-marks
454 (defcustom gnus-canceled-mark ?G
455 "*Mark used for canceled articles."
456 :group 'gnus-summary-marks
459 (defcustom gnus-duplicate-mark ?M
460 "*Mark used for duplicate articles."
461 :group 'gnus-summary-marks
464 (defcustom gnus-undownloaded-mark ?@
465 "*Mark used for articles that weren't downloaded."
466 :group 'gnus-summary-marks
469 (defcustom gnus-downloadable-mark ?%
470 "*Mark used for articles that are to be downloaded."
471 :group 'gnus-summary-marks
474 (defcustom gnus-unsendable-mark ?=
475 "*Mark used for articles that won't be sent."
476 :group 'gnus-summary-marks
479 (defcustom gnus-score-over-mark ?+
480 "*Score mark used for articles with high scores."
481 :group 'gnus-summary-marks
484 (defcustom gnus-score-below-mark ?-
485 "*Score mark used for articles with low scores."
486 :group 'gnus-summary-marks
489 (defcustom gnus-empty-thread-mark ? ;Whitespace
490 "*There is no thread under the article."
491 :group 'gnus-summary-marks
494 (defcustom gnus-not-empty-thread-mark ?=
495 "*There is a thread under the article."
496 :group 'gnus-summary-marks
499 (defcustom gnus-view-pseudo-asynchronously nil
500 "*If non-nil, Gnus will view pseudo-articles asynchronously."
501 :group 'gnus-extract-view
504 (defcustom gnus-auto-expirable-marks
505 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
506 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
507 gnus-souped-mark gnus-duplicate-mark)
508 "*The list of marks converted into expiration if a group is auto-expirable."
510 :type '(repeat character))
512 (defcustom gnus-inhibit-user-auto-expire t
513 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
517 (defcustom gnus-view-pseudos nil
518 "*If `automatic', pseudo-articles will be viewed automatically.
519 If `not-confirm', pseudos will be viewed automatically, and the user
520 will not be asked to confirm the command."
521 :group 'gnus-extract-view
522 :type '(choice (const :tag "off" nil)
524 (const not-confirm)))
526 (defcustom gnus-view-pseudos-separately t
527 "*If non-nil, one pseudo-article will be created for each file to be viewed.
528 If nil, all files that use the same viewing command will be given as a
529 list of parameters to that command."
530 :group 'gnus-extract-view
533 (defcustom gnus-insert-pseudo-articles t
534 "*If non-nil, insert pseudo-articles when decoding articles."
535 :group 'gnus-extract-view
538 (defcustom gnus-summary-dummy-line-format
540 "*The format specification for the dummy roots in the summary buffer.
541 It works along the same lines as a normal formatting string,
542 with some simple extensions.
545 :group 'gnus-threading
548 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
549 "*The format specification for the summary mode line.
550 It works along the same lines as a normal formatting string,
551 with some simple extensions:
554 %p Unprefixed group name
555 %A Current article number
556 %z Current article score
558 %U Number of unread articles in the group
559 %e Number of unselected articles in the group
560 %Z A string with unread/unselected article counts
561 %g Shortish group name
562 %S Subject of the current article
564 %s Current score file name
565 %d Number of dormant articles
566 %r Number of articles that have been marked as read in this session
567 %E Number of articles expunged by the score files"
568 :group 'gnus-summary-format
571 (defcustom gnus-list-identifiers nil
572 "Regexp that matches list identifiers to be removed from subject.
573 This can also be a list of regexps."
574 :group 'gnus-summary-format
575 :group 'gnus-article-hiding
576 :type '(choice (const :tag "none" nil)
578 (repeat :value (".*") regexp)))
580 (defcustom gnus-summary-mark-below 0
581 "*Mark all articles with a score below this variable as read.
582 This variable is local to each summary buffer and usually set by the
584 :group 'gnus-score-default
587 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
588 "*List of functions used for sorting articles in the summary buffer.
589 This variable is only used when not using a threaded display."
590 :group 'gnus-summary-sort
591 :type '(repeat (choice (function-item gnus-article-sort-by-number)
592 (function-item gnus-article-sort-by-author)
593 (function-item gnus-article-sort-by-subject)
594 (function-item gnus-article-sort-by-date)
595 (function-item gnus-article-sort-by-score)
596 (function :tag "other"))))
598 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
599 "*List of functions used for sorting threads in the summary buffer.
600 By default, threads are sorted by article number.
602 Each function takes two threads and return non-nil if the first thread
603 should be sorted before the other. If you use more than one function,
604 the primary sort function should be the last. You should probably
605 always include `gnus-thread-sort-by-number' in the list of sorting
606 functions -- preferably first.
608 Ready-made functions include `gnus-thread-sort-by-number',
609 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
610 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
611 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
612 :group 'gnus-summary-sort
613 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
614 (function-item gnus-thread-sort-by-author)
615 (function-item gnus-thread-sort-by-subject)
616 (function-item gnus-thread-sort-by-date)
617 (function-item gnus-thread-sort-by-score)
618 (function-item gnus-thread-sort-by-total-score)
619 (function :tag "other"))))
621 (defcustom gnus-thread-score-function '+
622 "*Function used for calculating the total score of a thread.
624 The function is called with the scores of the article and each
625 subthread and should then return the score of the thread.
627 Some functions you can use are `+', `max', or `min'."
628 :group 'gnus-summary-sort
631 (defcustom gnus-summary-expunge-below nil
632 "All articles that have a score less than this variable will be expunged.
633 This variable is local to the summary buffers."
634 :group 'gnus-score-default
635 :type '(choice (const :tag "off" nil)
638 (defcustom gnus-thread-expunge-below nil
639 "All threads that have a total score less than this variable will be expunged.
640 See `gnus-thread-score-function' for en explanation of what a
643 This variable is local to the summary buffers."
644 :group 'gnus-threading
645 :group 'gnus-score-default
646 :type '(choice (const :tag "off" nil)
649 (defcustom gnus-summary-mode-hook nil
650 "*A hook for Gnus summary mode.
651 This hook is run before any variables are set in the summary buffer."
652 :group 'gnus-summary-various
655 (defcustom gnus-summary-menu-hook nil
656 "*Hook run after the creation of the summary mode menu."
657 :group 'gnus-summary-visual
660 (defcustom gnus-summary-exit-hook nil
661 "*A hook called on exit from the summary buffer.
662 It will be called with point in the group buffer."
663 :group 'gnus-summary-exit
666 (defcustom gnus-summary-prepare-hook nil
667 "*A hook called after the summary buffer has been generated.
668 If you want to modify the summary buffer, you can use this hook."
669 :group 'gnus-summary-various
672 (defcustom gnus-summary-prepared-hook nil
673 "*A hook called as the last thing after the summary buffer has been generated."
674 :group 'gnus-summary-various
677 (defcustom gnus-summary-generate-hook nil
678 "*A hook run just before generating the summary buffer.
679 This hook is commonly used to customize threading variables and the
681 :group 'gnus-summary-various
684 (defcustom gnus-select-group-hook nil
685 "*A hook called when a newsgroup is selected.
687 If you'd like to simplify subjects like the
688 `gnus-summary-next-same-subject' command does, you can use the
691 (setq gnus-select-group-hook
694 (mapcar (lambda (header)
695 (mail-header-set-subject
697 (gnus-simplify-subject
698 (mail-header-subject header) 're-only)))
699 gnus-newsgroup-headers))))"
700 :group 'gnus-group-select
703 (defcustom gnus-select-article-hook nil
704 "*A hook called when an article is selected."
705 :group 'gnus-summary-choose
708 (defcustom gnus-visual-mark-article-hook
709 (list 'gnus-highlight-selected-summary)
710 "*Hook run after selecting an article in the summary buffer.
711 It is meant to be used for highlighting the article in some way. It
712 is not run if `gnus-visual' is nil."
713 :group 'gnus-summary-visual
716 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
717 "*A hook called before parsing the headers."
721 (defcustom gnus-exit-group-hook nil
722 "*A hook called when exiting (not quitting) summary mode."
726 (defcustom gnus-summary-update-hook
727 (list 'gnus-summary-highlight-line)
728 "*A hook called when a summary line is changed.
729 The hook will not be called if `gnus-visual' is nil.
731 The default function `gnus-summary-highlight-line' will
732 highlight the line according to the `gnus-summary-highlight'
734 :group 'gnus-summary-visual
737 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
738 "*A hook called when an article is selected for the first time.
739 The hook is intended to mark an article as read (or unread)
740 automatically when it is selected."
741 :group 'gnus-summary-choose
744 (defcustom gnus-group-no-more-groups-hook nil
745 "*A hook run when returning to group mode having no more (unread) groups."
746 :group 'gnus-group-select
749 (defcustom gnus-ps-print-hook nil
750 "*A hook run before ps-printing something from Gnus."
754 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
755 "Face used for highlighting the current article in the summary buffer."
756 :group 'gnus-summary-visual
759 (defcustom gnus-summary-highlight
760 '(((= mark gnus-canceled-mark)
761 . gnus-summary-cancelled-face)
762 ((and (> score default)
763 (or (= mark gnus-dormant-mark)
764 (= mark gnus-ticked-mark)))
765 . gnus-summary-high-ticked-face)
766 ((and (< score default)
767 (or (= mark gnus-dormant-mark)
768 (= mark gnus-ticked-mark)))
769 . gnus-summary-low-ticked-face)
770 ((or (= mark gnus-dormant-mark)
771 (= mark gnus-ticked-mark))
772 . gnus-summary-normal-ticked-face)
773 ((and (> score default) (= mark gnus-ancient-mark))
774 . gnus-summary-high-ancient-face)
775 ((and (< score default) (= mark gnus-ancient-mark))
776 . gnus-summary-low-ancient-face)
777 ((= mark gnus-ancient-mark)
778 . gnus-summary-normal-ancient-face)
779 ((and (> score default) (= mark gnus-unread-mark))
780 . gnus-summary-high-unread-face)
781 ((and (< score default) (= mark gnus-unread-mark))
782 . gnus-summary-low-unread-face)
783 ((and (memq article gnus-newsgroup-incorporated)
784 (= mark gnus-unread-mark))
785 . gnus-summary-incorporated-face)
786 ((= mark gnus-unread-mark)
787 . gnus-summary-normal-unread-face)
788 ((and (> score default) (memq mark (list gnus-downloadable-mark
789 gnus-undownloaded-mark)))
790 . gnus-summary-high-unread-face)
791 ((and (< score default) (memq mark (list gnus-downloadable-mark
792 gnus-undownloaded-mark)))
793 . gnus-summary-low-unread-face)
794 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
795 . gnus-summary-normal-unread-face)
797 . gnus-summary-high-read-face)
799 . gnus-summary-low-read-face)
801 . gnus-summary-normal-read-face))
802 "*Controls the highlighting of summary buffer lines.
804 A list of (FORM . FACE) pairs. When deciding how a a particular
805 summary line should be displayed, each form is evaluated. The content
806 of the face field after the first true form is used. You can change
807 how those summary lines are displayed, by editing the face field.
809 You can use the following variables in the FORM field.
811 score: The articles score
812 default: The default article score.
813 below: The score below which articles are automatically marked as read.
814 mark: The articles mark."
815 :group 'gnus-summary-visual
816 :type '(repeat (cons (sexp :tag "Form" nil)
819 (defcustom gnus-alter-header-function nil
820 "Function called to allow alteration of article header structures.
821 The function is called with one parameter, the article header vector,
822 which it may alter in any way.")
824 (defvar gnus-decode-encoded-word-function
825 (mime-find-field-decoder 'From 'nov)
826 "Variable that says which function should be used to decode a string with encoded words.")
828 (defcustom gnus-extra-headers nil
829 "*Extra headers to parse."
831 :type '(repeat symbol))
833 (defcustom gnus-ignored-from-addresses
834 (and user-mail-address (regexp-quote user-mail-address))
835 "*Regexp of From headers that may be suppressed in favor of To headers."
839 (defcustom gnus-group-charset-alist
840 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
841 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
842 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
843 ("^relcom\\>" koi8-r)
845 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
846 ("^israel\\>" iso-8859-1)
848 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
850 "Alist of regexps (to match group names) and default charsets to be used when reading."
851 :type '(repeat (list (regexp :tag "Group")
852 (symbol :tag "Charset")))
853 :group 'gnus-charset)
855 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit)
856 "List of charsets that should be ignored.
857 When these charsets are used in the \"charset\" parameter, the
858 default charset will be used instead."
859 :type '(repeat symbol)
860 :group 'gnus-charset)
862 (defcustom gnus-group-ignored-charsets-alist
863 '(("alt\\.chinese\\.text" iso-8859-1))
864 "Alist of regexps (to match group names) and charsets that should be ignored.
865 When these charsets are used in the \"charset\" parameter, the
866 default charset will be used instead."
867 :type '(repeat (cons (regexp :tag "Group")
869 :group 'gnus-charset)
871 (defcustom gnus-group-highlight-words-alist nil
872 "Alist of group regexps and highlight regexps.
873 This variable uses the same syntax as `gnus-emphasis-alist'."
874 :type '(repeat (cons (regexp :tag "Group")
875 (repeat (list (regexp :tag "Highlight regexp")
876 (number :tag "Group for entire word" 0)
877 (number :tag "Group for displayed part" 0)
879 gnus-emphasis-highlight-words)))))
880 :group 'gnus-summary-visual)
882 (defcustom gnus-use-wheel nil
883 "Use Intelli-mouse on summary movement"
885 :group 'gnus-summary-maneuvering)
887 (defcustom gnus-wheel-scroll-amount '(5 . 1)
888 "Amount to scroll messages by spinning the mouse wheel.
889 This is actually a cons cell, where the first item is the amount to scroll
890 on a normal wheel event, and the second is the amount to scroll when the
891 wheel is moved with the shift key depressed."
892 :type '(cons (integer :tag "Shift") integer)
893 :group 'gnus-summary-maneuvering)
895 (defcustom gnus-wheel-edge-resistance 2
896 "How hard it should be to change the current article
897 by moving the mouse over the edge of the article window."
899 :group 'gnus-summary-maneuvering)
901 ;;; Internal variables
903 (defvar gnus-scores-exclude-files nil)
904 (defvar gnus-page-broken nil)
905 (defvar gnus-inhibit-mime-unbuttonizing nil)
907 (defvar gnus-original-article nil)
908 (defvar gnus-article-internal-prepare-hook nil)
909 (defvar gnus-newsgroup-process-stack nil)
911 (defvar gnus-thread-indent-array nil)
912 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
913 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
914 "Function called to sort the articles within a thread after it has
915 been gathered together.")
917 ;; Avoid highlighting in kill files.
918 (defvar gnus-summary-inhibit-highlight nil)
919 (defvar gnus-newsgroup-selected-overlay nil)
920 (defvar gnus-inhibit-limiting nil)
921 (defvar gnus-newsgroup-adaptive-score-file nil)
922 (defvar gnus-current-score-file nil)
923 (defvar gnus-current-move-group nil)
924 (defvar gnus-current-copy-group nil)
925 (defvar gnus-current-crosspost-group nil)
927 (defvar gnus-newsgroup-dependencies nil)
928 (defvar gnus-newsgroup-adaptive nil)
929 (defvar gnus-summary-display-article-function nil)
930 (defvar gnus-summary-highlight-line-function nil
931 "Function called after highlighting a summary line.")
933 (defvar gnus-summary-line-format-alist
934 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
935 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
936 (?s gnus-tmp-subject-or-nil ?s)
937 (?n gnus-tmp-name ?s)
938 (?A (std11-address-string
939 (car (mime-read-field 'From gnus-tmp-header))) ?s)
940 (?a (or (std11-full-name-string
941 (car (mime-read-field 'From gnus-tmp-header)))
943 (?F gnus-tmp-from ?s)
944 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
945 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
946 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
947 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
948 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
949 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
950 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
951 (?L gnus-tmp-lines ?d)
952 (?I gnus-tmp-indentation ?s)
953 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
954 (?R gnus-tmp-replied ?c)
955 (?\[ gnus-tmp-opening-bracket ?c)
956 (?\] gnus-tmp-closing-bracket ?c)
957 (?\> (make-string gnus-tmp-level ? ) ?s)
958 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
959 (?i gnus-tmp-score ?d)
960 (?z gnus-tmp-score-char ?c)
961 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
962 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
963 (?U gnus-tmp-unread ?c)
964 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
965 (?t (gnus-summary-number-of-articles-in-thread
966 (and (boundp 'thread) (car thread)) gnus-tmp-level)
968 (?e (gnus-summary-number-of-articles-in-thread
969 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
971 (?u gnus-tmp-user-defined ?s)
972 (?P (gnus-pick-line-number) ?d))
973 "An alist of format specifications that can appear in summary lines,
974 and what variables they correspond with, along with the type of the
975 variable (string, integer, character, etc).")
977 (defvar gnus-summary-dummy-line-format-alist
978 `((?S gnus-tmp-subject ?s)
979 (?N gnus-tmp-number ?d)
980 (?u gnus-tmp-user-defined ?s)))
982 (defvar gnus-summary-mode-line-format-alist
983 `((?G gnus-tmp-group-name ?s)
984 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
985 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
986 (?A gnus-tmp-article-number ?d)
987 (?Z gnus-tmp-unread-and-unselected ?s)
989 (?U gnus-tmp-unread-and-unticked ?d)
990 (?S gnus-tmp-subject ?s)
991 (?e gnus-tmp-unselected ?d)
992 (?u gnus-tmp-user-defined ?s)
993 (?d (length gnus-newsgroup-dormant) ?d)
994 (?t (length gnus-newsgroup-marked) ?d)
995 (?r (length gnus-newsgroup-reads) ?d)
996 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
997 (?E gnus-newsgroup-expunged-tally ?d)
998 (?s (gnus-current-score-file-nondirectory) ?s)))
1000 (defvar gnus-last-search-regexp nil
1001 "Default regexp for article search command.")
1003 (defvar gnus-summary-search-article-matched-data nil
1004 "Last matched data of article search command. It is the local variable
1005 in `gnus-article-buffer' which consists of the list of start position,
1006 end position and text.")
1008 (defvar gnus-last-shell-command nil
1009 "Default shell command on article.")
1011 (defvar gnus-newsgroup-begin nil)
1012 (defvar gnus-newsgroup-end nil)
1013 (defvar gnus-newsgroup-last-rmail nil)
1014 (defvar gnus-newsgroup-last-mail nil)
1015 (defvar gnus-newsgroup-last-folder nil)
1016 (defvar gnus-newsgroup-last-file nil)
1017 (defvar gnus-newsgroup-auto-expire nil)
1018 (defvar gnus-newsgroup-active nil)
1020 (defvar gnus-newsgroup-data nil)
1021 (defvar gnus-newsgroup-data-reverse nil)
1022 (defvar gnus-newsgroup-limit nil)
1023 (defvar gnus-newsgroup-limits nil)
1025 (defvar gnus-newsgroup-unreads nil
1026 "List of unread articles in the current newsgroup.")
1028 (defvar gnus-newsgroup-unselected nil
1029 "List of unselected unread articles in the current newsgroup.")
1031 (defvar gnus-newsgroup-reads nil
1032 "Alist of read articles and article marks in the current newsgroup.")
1034 (defvar gnus-newsgroup-expunged-tally nil)
1036 (defvar gnus-newsgroup-marked nil
1037 "List of ticked articles in the current newsgroup (a subset of unread art).")
1039 (defvar gnus-newsgroup-killed nil
1040 "List of ranges of articles that have been through the scoring process.")
1042 (defvar gnus-newsgroup-cached nil
1043 "List of articles that come from the article cache.")
1045 (defvar gnus-newsgroup-saved nil
1046 "List of articles that have been saved.")
1048 (defvar gnus-newsgroup-kill-headers nil)
1050 (defvar gnus-newsgroup-replied nil
1051 "List of articles that have been replied to in the current newsgroup.")
1053 (defvar gnus-newsgroup-expirable nil
1054 "List of articles in the current newsgroup that can be expired.")
1056 (defvar gnus-newsgroup-processable nil
1057 "List of articles in the current newsgroup that can be processed.")
1059 (defvar gnus-newsgroup-downloadable nil
1060 "List of articles in the current newsgroup that can be processed.")
1062 (defvar gnus-newsgroup-undownloaded nil
1063 "List of articles in the current newsgroup that haven't been downloaded..")
1065 (defvar gnus-newsgroup-unsendable nil
1066 "List of articles in the current newsgroup that won't be sent.")
1068 (defvar gnus-newsgroup-bookmarks nil
1069 "List of articles in the current newsgroup that have bookmarks.")
1071 (defvar gnus-newsgroup-dormant nil
1072 "List of dormant articles in the current newsgroup.")
1074 (defvar gnus-newsgroup-scored nil
1075 "List of scored articles in the current newsgroup.")
1077 (defvar gnus-newsgroup-incorporated nil
1078 "List of incorporated articles in the current newsgroup.")
1080 (defvar gnus-newsgroup-headers nil
1081 "List of article headers in the current newsgroup.")
1083 (defvar gnus-newsgroup-threads nil)
1085 (defvar gnus-newsgroup-prepared nil
1086 "Whether the current group has been prepared properly.")
1088 (defvar gnus-newsgroup-ancient nil
1089 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1091 (defvar gnus-newsgroup-sparse nil)
1093 (defvar gnus-current-article nil)
1094 (defvar gnus-article-current nil)
1095 (defvar gnus-current-headers nil)
1096 (defvar gnus-have-all-headers nil)
1097 (defvar gnus-last-article nil)
1098 (defvar gnus-newsgroup-history nil)
1099 (defvar gnus-newsgroup-charset nil)
1100 (defvar gnus-newsgroup-ephemeral-charset nil)
1101 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1103 (defconst gnus-summary-local-variables
1104 '(gnus-newsgroup-name
1105 gnus-newsgroup-begin gnus-newsgroup-end
1106 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1107 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1108 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1109 gnus-newsgroup-unselected gnus-newsgroup-marked
1110 gnus-newsgroup-reads gnus-newsgroup-saved
1111 gnus-newsgroup-replied gnus-newsgroup-expirable
1112 gnus-newsgroup-processable gnus-newsgroup-killed
1113 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1114 gnus-newsgroup-unsendable
1115 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1116 gnus-newsgroup-headers gnus-newsgroup-threads
1117 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1118 gnus-current-article gnus-current-headers gnus-have-all-headers
1119 gnus-last-article gnus-article-internal-prepare-hook
1120 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1121 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1122 gnus-thread-expunge-below
1123 gnus-score-alist gnus-current-score-file
1124 (gnus-summary-expunge-below . global)
1125 (gnus-summary-mark-below . global)
1126 gnus-newsgroup-active gnus-scores-exclude-files
1127 gnus-newsgroup-history gnus-newsgroup-ancient
1128 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1129 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1130 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1131 (gnus-newsgroup-expunged-tally . 0)
1132 gnus-cache-removable-articles gnus-newsgroup-cached
1133 gnus-newsgroup-data gnus-newsgroup-data-reverse
1134 gnus-newsgroup-limit gnus-newsgroup-limits
1135 gnus-newsgroup-charset
1136 gnus-newsgroup-incorporated)
1137 "Variables that are buffer-local to the summary buffers.")
1139 ;; Byte-compiler warning.
1140 (defvar gnus-article-mode-map)
1142 ;; Subject simplification.
1144 (defun gnus-simplify-whitespace (str)
1145 "Remove excessive whitespace."
1148 (while (string-match "[ \t][ \t]+" mystr)
1149 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1151 (substring mystr (match-end 0)))))
1153 (when (string-match "^[ \t]+" mystr)
1154 (setq mystr (substring mystr (match-end 0))))
1156 (when (string-match "[ \t]+$" mystr)
1157 (setq mystr (substring mystr 0 (match-beginning 0))))
1160 (defsubst gnus-simplify-subject-re (subject)
1161 "Remove \"Re:\" from subject lines."
1162 (if (string-match "^[Rr][Ee]: *" subject)
1163 (substring subject (match-end 0))
1166 (defun gnus-simplify-subject (subject &optional re-only)
1167 "Remove `Re:' and words in parentheses.
1168 If RE-ONLY is non-nil, strip leading `Re:'s only."
1169 (let ((case-fold-search t)) ;Ignore case.
1170 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1171 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1172 (setq subject (substring subject (match-end 0))))
1173 ;; Remove uninteresting prefixes.
1174 (when (and (not re-only)
1175 gnus-simplify-ignored-prefixes
1176 (string-match gnus-simplify-ignored-prefixes subject))
1177 (setq subject (substring subject (match-end 0))))
1178 ;; Remove words in parentheses from end.
1180 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1181 (setq subject (substring subject 0 (match-beginning 0)))))
1182 ;; Return subject string.
1185 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1187 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1188 (goto-char (point-min))
1189 (while (re-search-forward regexp nil t)
1190 (replace-match (or newtext ""))))
1192 (defun gnus-simplify-buffer-fuzzy ()
1193 "Simplify string in the buffer fuzzily.
1194 The string in the accessible portion of the current buffer is simplified.
1195 It is assumed to be a single-line subject.
1196 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1197 matter is removed. Additional things can be deleted by setting
1198 gnus-simplify-subject-fuzzy-regexp."
1199 (let ((case-fold-search t)
1201 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1203 (while (not (eq modified-tick (buffer-modified-tick)))
1204 (setq modified-tick (buffer-modified-tick))
1206 ((listp gnus-simplify-subject-fuzzy-regexp)
1207 (mapcar 'gnus-simplify-buffer-fuzzy-step
1208 gnus-simplify-subject-fuzzy-regexp))
1209 (gnus-simplify-subject-fuzzy-regexp
1210 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1211 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1212 (gnus-simplify-buffer-fuzzy-step
1213 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1214 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1216 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1217 (gnus-simplify-buffer-fuzzy-step " +" " ")
1218 (gnus-simplify-buffer-fuzzy-step " $")
1219 (gnus-simplify-buffer-fuzzy-step "^ +")))
1221 (defun gnus-simplify-subject-fuzzy (subject)
1222 "Simplify a subject string fuzzily.
1223 See `gnus-simplify-buffer-fuzzy' for details."
1225 (gnus-set-work-buffer)
1226 (let ((case-fold-search t))
1227 ;; Remove uninteresting prefixes.
1228 (when (and gnus-simplify-ignored-prefixes
1229 (string-match gnus-simplify-ignored-prefixes subject))
1230 (setq subject (substring subject (match-end 0))))
1232 (inline (gnus-simplify-buffer-fuzzy))
1235 (defsubst gnus-simplify-subject-fully (subject)
1236 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1238 (gnus-simplify-subject-functions
1239 (gnus-map-function gnus-simplify-subject-functions subject))
1240 ((null gnus-summary-gather-subject-limit)
1241 (gnus-simplify-subject-re subject))
1242 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1243 (gnus-simplify-subject-fuzzy subject))
1244 ((numberp gnus-summary-gather-subject-limit)
1245 (gnus-limit-string (gnus-simplify-subject-re subject)
1246 gnus-summary-gather-subject-limit))
1250 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1251 "Check whether two subjects are equal.
1252 If optional argument simple-first is t, first argument is already
1255 ((null simple-first)
1256 (equal (gnus-simplify-subject-fully s1)
1257 (gnus-simplify-subject-fully s2)))
1260 (gnus-simplify-subject-fully s2)))))
1262 (defun gnus-summary-bubble-group ()
1263 "Increase the score of the current group.
1264 This is a handy function to add to `gnus-summary-exit-hook' to
1265 increase the score of each group you read."
1266 (gnus-group-add-score gnus-newsgroup-name))
1270 ;;; Gnus summary mode
1273 (put 'gnus-summary-mode 'mode-class 'special)
1276 ;; Non-orthogonal keys
1278 (gnus-define-keys gnus-summary-mode-map
1279 " " gnus-summary-next-page
1280 "\177" gnus-summary-prev-page
1281 [delete] gnus-summary-prev-page
1282 [backspace] gnus-summary-prev-page
1283 "\r" gnus-summary-scroll-up
1284 "\M-\r" gnus-summary-scroll-down
1285 "n" gnus-summary-next-unread-article
1286 "p" gnus-summary-prev-unread-article
1287 "N" gnus-summary-next-article
1288 "P" gnus-summary-prev-article
1289 "\M-\C-n" gnus-summary-next-same-subject
1290 "\M-\C-p" gnus-summary-prev-same-subject
1291 "\M-n" gnus-summary-next-unread-subject
1292 "\M-p" gnus-summary-prev-unread-subject
1293 "." gnus-summary-first-unread-article
1294 "," gnus-summary-best-unread-article
1295 "\M-s" gnus-summary-search-article-forward
1296 "\M-r" gnus-summary-search-article-backward
1297 "<" gnus-summary-beginning-of-article
1298 ">" gnus-summary-end-of-article
1299 "j" gnus-summary-goto-article
1300 "^" gnus-summary-refer-parent-article
1301 "\M-^" gnus-summary-refer-article
1302 "u" gnus-summary-tick-article-forward
1303 "!" gnus-summary-tick-article-forward
1304 "U" gnus-summary-tick-article-backward
1305 "d" gnus-summary-mark-as-read-forward
1306 "D" gnus-summary-mark-as-read-backward
1307 "E" gnus-summary-mark-as-expirable
1308 "\M-u" gnus-summary-clear-mark-forward
1309 "\M-U" gnus-summary-clear-mark-backward
1310 "k" gnus-summary-kill-same-subject-and-select
1311 "\C-k" gnus-summary-kill-same-subject
1312 "\M-\C-k" gnus-summary-kill-thread
1313 "\M-\C-l" gnus-summary-lower-thread
1314 "e" gnus-summary-edit-article
1315 "#" gnus-summary-mark-as-processable
1316 "\M-#" gnus-summary-unmark-as-processable
1317 "\M-\C-t" gnus-summary-toggle-threads
1318 "\M-\C-s" gnus-summary-show-thread
1319 "\M-\C-h" gnus-summary-hide-thread
1320 "\M-\C-f" gnus-summary-next-thread
1321 "\M-\C-b" gnus-summary-prev-thread
1322 "\M-\C-u" gnus-summary-up-thread
1323 "\M-\C-d" gnus-summary-down-thread
1324 "&" gnus-summary-execute-command
1325 "c" gnus-summary-catchup-and-exit
1326 "\C-w" gnus-summary-mark-region-as-read
1327 "\C-t" gnus-summary-toggle-truncation
1328 "?" gnus-summary-mark-as-dormant
1329 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1330 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1331 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1332 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1333 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1334 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1335 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1336 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1337 "=" gnus-summary-expand-window
1338 "\C-x\C-s" gnus-summary-reselect-current-group
1339 "\M-g" gnus-summary-rescan-group
1340 "w" gnus-summary-stop-page-breaking
1341 "\C-c\C-r" gnus-summary-caesar-message
1342 "\M-t" gnus-summary-toggle-mime
1343 "f" gnus-summary-followup
1344 "F" gnus-summary-followup-with-original
1345 "C" gnus-summary-cancel-article
1346 "r" gnus-summary-reply
1347 "R" gnus-summary-reply-with-original
1348 "\C-c\C-f" gnus-summary-mail-forward
1349 "o" gnus-summary-save-article
1350 "\C-o" gnus-summary-save-article-mail
1351 "|" gnus-summary-pipe-output
1352 "\M-k" gnus-summary-edit-local-kill
1353 "\M-K" gnus-summary-edit-global-kill
1355 "\C-c\C-d" gnus-summary-describe-group
1356 "q" gnus-summary-exit
1357 "Q" gnus-summary-exit-no-update
1358 "\C-c\C-i" gnus-info-find-node
1359 gnus-mouse-2 gnus-mouse-pick-article
1360 "m" gnus-summary-mail-other-window
1361 "a" gnus-summary-post-news
1362 "x" gnus-summary-limit-to-unread
1363 "s" gnus-summary-isearch-article
1364 "t" gnus-article-toggle-headers
1365 "g" gnus-summary-show-article
1366 "l" gnus-summary-goto-last-article
1367 "v" gnus-summary-preview-mime-message
1368 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1369 "\C-d" gnus-summary-enter-digest-group
1370 "\M-\C-d" gnus-summary-read-document
1371 "\M-\C-e" gnus-summary-edit-parameters
1372 "\M-\C-g" gnus-summary-customize-parameters
1374 "*" gnus-cache-enter-article
1375 "\M-*" gnus-cache-remove-article
1376 "\M-&" gnus-summary-universal-argument
1377 "\C-l" gnus-recenter
1378 "I" gnus-summary-increase-score
1379 "L" gnus-summary-lower-score
1380 "\M-i" gnus-symbolic-argument
1381 "h" gnus-summary-select-article-buffer
1383 "V" gnus-summary-score-map
1384 "X" gnus-uu-extract-map
1385 "S" gnus-summary-send-map)
1387 ;; Sort of orthogonal keymap
1388 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1389 "t" gnus-summary-tick-article-forward
1390 "!" gnus-summary-tick-article-forward
1391 "d" gnus-summary-mark-as-read-forward
1392 "r" gnus-summary-mark-as-read-forward
1393 "c" gnus-summary-clear-mark-forward
1394 " " gnus-summary-clear-mark-forward
1395 "e" gnus-summary-mark-as-expirable
1396 "x" gnus-summary-mark-as-expirable
1397 "?" gnus-summary-mark-as-dormant
1398 "b" gnus-summary-set-bookmark
1399 "B" gnus-summary-remove-bookmark
1400 "#" gnus-summary-mark-as-processable
1401 "\M-#" gnus-summary-unmark-as-processable
1402 "S" gnus-summary-limit-include-expunged
1403 "C" gnus-summary-catchup
1404 "H" gnus-summary-catchup-to-here
1405 "\C-c" gnus-summary-catchup-all
1406 "k" gnus-summary-kill-same-subject-and-select
1407 "K" gnus-summary-kill-same-subject
1408 "P" gnus-uu-mark-map)
1410 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1411 "c" gnus-summary-clear-above
1412 "u" gnus-summary-tick-above
1413 "m" gnus-summary-mark-above
1414 "k" gnus-summary-kill-below)
1416 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1417 "/" gnus-summary-limit-to-subject
1418 "n" gnus-summary-limit-to-articles
1419 "w" gnus-summary-pop-limit
1420 "s" gnus-summary-limit-to-subject
1421 "a" gnus-summary-limit-to-author
1422 "u" gnus-summary-limit-to-unread
1423 "m" gnus-summary-limit-to-marks
1424 "M" gnus-summary-limit-exclude-marks
1425 "v" gnus-summary-limit-to-score
1426 "*" gnus-summary-limit-include-cached
1427 "D" gnus-summary-limit-include-dormant
1428 "T" gnus-summary-limit-include-thread
1429 "d" gnus-summary-limit-exclude-dormant
1430 "t" gnus-summary-limit-to-age
1431 "x" gnus-summary-limit-to-extra
1432 "E" gnus-summary-limit-include-expunged
1433 "c" gnus-summary-limit-exclude-childless-dormant
1434 "C" gnus-summary-limit-mark-excluded-as-read)
1436 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1437 "n" gnus-summary-next-unread-article
1438 "p" gnus-summary-prev-unread-article
1439 "N" gnus-summary-next-article
1440 "P" gnus-summary-prev-article
1441 "\C-n" gnus-summary-next-same-subject
1442 "\C-p" gnus-summary-prev-same-subject
1443 "\M-n" gnus-summary-next-unread-subject
1444 "\M-p" gnus-summary-prev-unread-subject
1445 "f" gnus-summary-first-unread-article
1446 "b" gnus-summary-best-unread-article
1447 "j" gnus-summary-goto-article
1448 "g" gnus-summary-goto-subject
1449 "l" gnus-summary-goto-last-article
1450 "o" gnus-summary-pop-article)
1452 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1453 "k" gnus-summary-kill-thread
1454 "l" gnus-summary-lower-thread
1455 "i" gnus-summary-raise-thread
1456 "T" gnus-summary-toggle-threads
1457 "t" gnus-summary-rethread-current
1458 "^" gnus-summary-reparent-thread
1459 "s" gnus-summary-show-thread
1460 "S" gnus-summary-show-all-threads
1461 "h" gnus-summary-hide-thread
1462 "H" gnus-summary-hide-all-threads
1463 "n" gnus-summary-next-thread
1464 "p" gnus-summary-prev-thread
1465 "u" gnus-summary-up-thread
1466 "o" gnus-summary-top-thread
1467 "d" gnus-summary-down-thread
1468 "#" gnus-uu-mark-thread
1469 "\M-#" gnus-uu-unmark-thread)
1471 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1472 "g" gnus-summary-prepare
1473 "c" gnus-summary-insert-cached-articles)
1475 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1476 "c" gnus-summary-catchup-and-exit
1477 "C" gnus-summary-catchup-all-and-exit
1478 "E" gnus-summary-exit-no-update
1479 "J" gnus-summary-jump-to-other-group
1480 "Q" gnus-summary-exit
1481 "Z" gnus-summary-exit
1482 "n" gnus-summary-catchup-and-goto-next-group
1483 "R" gnus-summary-reselect-current-group
1484 "G" gnus-summary-rescan-group
1485 "N" gnus-summary-next-group
1486 "s" gnus-summary-save-newsrc
1487 "P" gnus-summary-prev-group)
1489 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1490 " " gnus-summary-next-page
1491 "n" gnus-summary-next-page
1492 "\177" gnus-summary-prev-page
1493 [delete] gnus-summary-prev-page
1494 "p" gnus-summary-prev-page
1495 "\r" gnus-summary-scroll-up
1496 "\M-\r" gnus-summary-scroll-down
1497 "<" gnus-summary-beginning-of-article
1498 ">" gnus-summary-end-of-article
1499 "b" gnus-summary-beginning-of-article
1500 "e" gnus-summary-end-of-article
1501 "^" gnus-summary-refer-parent-article
1502 "r" gnus-summary-refer-parent-article
1503 "D" gnus-summary-enter-digest-group
1504 "R" gnus-summary-refer-references
1505 "T" gnus-summary-refer-thread
1506 "g" gnus-summary-show-article
1507 "s" gnus-summary-isearch-article
1508 "P" gnus-summary-print-article
1509 "t" gnus-article-babel)
1511 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1512 "b" gnus-article-add-buttons
1513 "B" gnus-article-add-buttons-to-head
1514 "o" gnus-article-treat-overstrike
1515 "e" gnus-article-emphasize
1516 "w" gnus-article-fill-cited-article
1517 "Q" gnus-article-fill-long-lines
1518 "C" gnus-article-capitalize-sentences
1519 "c" gnus-article-remove-cr
1520 "f" gnus-article-display-x-face
1521 "l" gnus-summary-stop-page-breaking
1522 "r" gnus-summary-caesar-message
1523 "t" gnus-article-toggle-headers
1524 "v" gnus-summary-verbose-headers
1525 "m" gnus-summary-toggle-mime
1526 "H" gnus-article-strip-headers-in-body
1527 "d" gnus-article-treat-dumbquotes)
1529 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1530 "a" gnus-article-hide
1531 "h" gnus-article-toggle-headers
1532 "b" gnus-article-hide-boring-headers
1533 "s" gnus-article-hide-signature
1534 "c" gnus-article-hide-citation
1535 "C" gnus-article-hide-citation-in-followups
1536 "l" gnus-article-hide-list-identifiers
1537 "p" gnus-article-hide-pgp
1538 "B" gnus-article-strip-banner
1539 "P" gnus-article-hide-pem
1540 "\C-c" gnus-article-hide-citation-maybe)
1542 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1543 "a" gnus-article-highlight
1544 "h" gnus-article-highlight-headers
1545 "c" gnus-article-highlight-citation
1546 "s" gnus-article-highlight-signature)
1548 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1549 "z" gnus-article-date-ut
1550 "u" gnus-article-date-ut
1551 "l" gnus-article-date-local
1552 "e" gnus-article-date-lapsed
1553 "o" gnus-article-date-original
1554 "i" gnus-article-date-iso8601
1555 "s" gnus-article-date-user)
1557 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1558 "t" gnus-article-remove-trailing-blank-lines
1559 "l" gnus-article-strip-leading-blank-lines
1560 "m" gnus-article-strip-multiple-blank-lines
1561 "a" gnus-article-strip-blank-lines
1562 "A" gnus-article-strip-all-blank-lines
1563 "s" gnus-article-strip-leading-space
1564 "e" gnus-article-strip-trailing-space)
1566 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1568 "f" gnus-summary-fetch-faq
1569 "d" gnus-summary-describe-group
1570 "h" gnus-summary-describe-briefly
1571 "i" gnus-info-find-node)
1573 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1574 "e" gnus-summary-expire-articles
1575 "\M-\C-e" gnus-summary-expire-articles-now
1576 "\177" gnus-summary-delete-article
1577 [delete] gnus-summary-delete-article
1578 [backspace] gnus-summary-delete-article
1579 "m" gnus-summary-move-article
1580 "r" gnus-summary-respool-article
1581 "w" gnus-summary-edit-article
1582 "c" gnus-summary-copy-article
1583 "B" gnus-summary-crosspost-article
1584 "q" gnus-summary-respool-query
1585 "t" gnus-summary-respool-trace
1586 "i" gnus-summary-import-article
1587 "p" gnus-summary-article-posted-p)
1589 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1590 "o" gnus-summary-save-article
1591 "m" gnus-summary-save-article-mail
1592 "F" gnus-summary-write-article-file
1593 "r" gnus-summary-save-article-rmail
1594 "f" gnus-summary-save-article-file
1595 "b" gnus-summary-save-article-body-file
1596 "h" gnus-summary-save-article-folder
1597 "v" gnus-summary-save-article-vm
1598 "p" gnus-summary-pipe-output
1599 "s" gnus-soup-add-article)
1601 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1602 "b" gnus-summary-display-buttonized
1603 "m" gnus-summary-repair-multipart
1604 "v" gnus-article-view-part
1605 "o" gnus-article-save-part
1606 "c" gnus-article-copy-part
1607 "e" gnus-article-externalize-part
1608 "i" gnus-article-inline-part
1609 "|" gnus-article-pipe-part)
1612 (defun gnus-summary-make-menu-bar ()
1613 (gnus-turn-off-edit-menu 'summary)
1615 (unless (boundp 'gnus-summary-misc-menu)
1618 gnus-summary-kill-menu gnus-summary-mode-map ""
1623 ["Enter score..." gnus-summary-score-entry t]
1624 ["Customize" gnus-score-customize t])
1625 (gnus-make-score-map 'increase)
1626 (gnus-make-score-map 'lower)
1628 ["Kill below" gnus-summary-kill-below t]
1629 ["Mark above" gnus-summary-mark-above t]
1630 ["Tick above" gnus-summary-tick-above t]
1631 ["Clear above" gnus-summary-clear-above t])
1632 ["Current score" gnus-summary-current-score t]
1633 ["Set score" gnus-summary-set-score t]
1634 ["Switch current score file..." gnus-score-change-score-file t]
1635 ["Set mark below..." gnus-score-set-mark-below t]
1636 ["Set expunge below..." gnus-score-set-expunge-below t]
1637 ["Edit current score file" gnus-score-edit-current-scores t]
1638 ["Edit score file" gnus-score-edit-file t]
1639 ["Trace score" gnus-score-find-trace t]
1640 ["Find words" gnus-score-find-favourite-words t]
1641 ["Rescore buffer" gnus-summary-rescore t]
1642 ["Increase score..." gnus-summary-increase-score t]
1643 ["Lower score..." gnus-summary-lower-score t]))))
1645 ;; Define both the Article menu in the summary buffer and the equivalent
1646 ;; Commands menu in the article buffer here for consistency.
1649 ["All" gnus-article-hide t]
1650 ["Headers" gnus-article-toggle-headers t]
1651 ["Signature" gnus-article-hide-signature t]
1652 ["Citation" gnus-article-hide-citation t]
1653 ["List identifiers" gnus-article-hide-list-identifiers t]
1654 ["PGP" gnus-article-hide-pgp t]
1655 ["Banner" gnus-article-strip-banner t]
1656 ["Boring headers" gnus-article-hide-boring-headers t])
1658 ["All" gnus-article-highlight t]
1659 ["Headers" gnus-article-highlight-headers t]
1660 ["Signature" gnus-article-highlight-signature t]
1661 ["Citation" gnus-article-highlight-citation t])
1663 ["Local" gnus-article-date-local t]
1664 ["ISO8601" gnus-article-date-iso8601 t]
1665 ["UT" gnus-article-date-ut t]
1666 ["Original" gnus-article-date-original t]
1667 ["Lapsed" gnus-article-date-lapsed t]
1668 ["User-defined" gnus-article-date-user t])
1671 ["Leading" gnus-article-strip-leading-blank-lines t]
1672 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1673 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1674 ["All of the above" gnus-article-strip-blank-lines t]
1675 ["All" gnus-article-strip-all-blank-lines t]
1676 ["Leading space" gnus-article-strip-leading-space t]
1677 ["Trailing space" gnus-article-strip-trailing-space t])
1678 ["Overstrike" gnus-article-treat-overstrike t]
1679 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1680 ["Emphasis" gnus-article-emphasize t]
1681 ["Word wrap" gnus-article-fill-cited-article t]
1682 ["Fill long lines" gnus-article-fill-long-lines t]
1683 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1684 ["CR" gnus-article-remove-cr t]
1685 ["Show X-Face" gnus-article-display-x-face t]
1686 ["Rot 13" gnus-summary-caesar-message t]
1687 ["Unix pipe" gnus-summary-pipe-message t]
1688 ["Add buttons" gnus-article-add-buttons t]
1689 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1690 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1691 ["Toggle MIME" gnus-summary-toggle-mime t]
1692 ["Verbose header" gnus-summary-verbose-headers t]
1693 ["Toggle header" gnus-summary-toggle-header t])
1695 ["Save in default format" gnus-summary-save-article t]
1696 ["Save in file" gnus-summary-save-article-file t]
1697 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1698 ["Save in MH folder" gnus-summary-save-article-folder t]
1699 ["Save in VM folder" gnus-summary-save-article-vm t]
1700 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1701 ["Save body in file" gnus-summary-save-article-body-file t]
1702 ["Pipe through a filter" gnus-summary-pipe-output t]
1703 ["Add to SOUP packet" gnus-soup-add-article t]
1704 ["Print" gnus-summary-print-article t])
1706 ["Respool article..." gnus-summary-respool-article t]
1707 ["Move article..." gnus-summary-move-article
1708 (gnus-check-backend-function
1709 'request-move-article gnus-newsgroup-name)]
1710 ["Copy article..." gnus-summary-copy-article t]
1711 ["Crosspost article..." gnus-summary-crosspost-article
1712 (gnus-check-backend-function
1713 'request-replace-article gnus-newsgroup-name)]
1714 ["Import file..." gnus-summary-import-article t]
1715 ["Check if posted" gnus-summary-article-posted-p t]
1716 ["Edit article" gnus-summary-edit-article
1717 (not (gnus-group-read-only-p))]
1718 ["Delete article" gnus-summary-delete-article
1719 (gnus-check-backend-function
1720 'request-expire-articles gnus-newsgroup-name)]
1721 ["Query respool" gnus-summary-respool-query t]
1722 ["Trace respool" gnus-summary-respool-trace t]
1723 ["Delete expirable articles" gnus-summary-expire-articles-now
1724 (gnus-check-backend-function
1725 'request-expire-articles gnus-newsgroup-name)])
1727 ["Uudecode" gnus-uu-decode-uu t]
1728 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1729 ["Unshar" gnus-uu-decode-unshar t]
1730 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1731 ["Save" gnus-uu-decode-save t]
1732 ["Binhex" gnus-uu-decode-binhex t]
1733 ["Postscript" gnus-uu-decode-postscript t])
1735 ["Enter article" gnus-cache-enter-article t]
1736 ["Remove article" gnus-cache-remove-article t])
1737 ["Translate" gnus-article-babel t]
1738 ["Select article buffer" gnus-summary-select-article-buffer t]
1739 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1740 ["Isearch article..." gnus-summary-isearch-article t]
1741 ["Beginning of the article" gnus-summary-beginning-of-article t]
1742 ["End of the article" gnus-summary-end-of-article t]
1743 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1744 ["Fetch referenced articles" gnus-summary-refer-references t]
1745 ["Fetch current thread" gnus-summary-refer-thread t]
1746 ["Fetch article with id..." gnus-summary-refer-article t]
1747 ["Redisplay" gnus-summary-show-article t])))
1749 gnus-summary-article-menu gnus-summary-mode-map ""
1750 (cons "Article" innards))
1753 gnus-article-commands-menu gnus-article-mode-map ""
1754 (cons "Commands" innards)))
1757 gnus-summary-thread-menu gnus-summary-mode-map ""
1759 ["Toggle threading" gnus-summary-toggle-threads t]
1760 ["Hide threads" gnus-summary-hide-all-threads t]
1761 ["Show threads" gnus-summary-show-all-threads t]
1762 ["Hide thread" gnus-summary-hide-thread t]
1763 ["Show thread" gnus-summary-show-thread t]
1764 ["Go to next thread" gnus-summary-next-thread t]
1765 ["Go to previous thread" gnus-summary-prev-thread t]
1766 ["Go down thread" gnus-summary-down-thread t]
1767 ["Go up thread" gnus-summary-up-thread t]
1768 ["Top of thread" gnus-summary-top-thread t]
1769 ["Mark thread as read" gnus-summary-kill-thread t]
1770 ["Lower thread score" gnus-summary-lower-thread t]
1771 ["Raise thread score" gnus-summary-raise-thread t]
1772 ["Rethread current" gnus-summary-rethread-current t]
1776 gnus-summary-post-menu gnus-summary-mode-map ""
1778 ["Post an article" gnus-summary-post-news t]
1779 ["Followup" gnus-summary-followup t]
1780 ["Followup and yank" gnus-summary-followup-with-original t]
1781 ["Supersede article" gnus-summary-supersede-article t]
1782 ["Cancel article" gnus-summary-cancel-article t]
1783 ["Reply" gnus-summary-reply t]
1784 ["Reply and yank" gnus-summary-reply-with-original t]
1785 ["Wide reply" gnus-summary-wide-reply t]
1786 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1787 ["Mail forward" gnus-summary-mail-forward t]
1788 ["Post forward" gnus-summary-post-forward t]
1789 ["Digest and mail" gnus-summary-mail-digest t]
1790 ["Digest and post" gnus-summary-post-digest t]
1791 ["Resend message" gnus-summary-resend-message t]
1792 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1793 ["Send a mail" gnus-summary-mail-other-window t]
1794 ["Uuencode and post" gnus-uu-post-news t]
1795 ["Followup via news" gnus-summary-followup-to-mail t]
1796 ["Followup via news and yank"
1797 gnus-summary-followup-to-mail-with-original t]
1799 ;;["Send" gnus-summary-send-draft t]
1800 ;;["Send bounced" gnus-resend-bounced-mail t])
1804 gnus-summary-misc-menu gnus-summary-mode-map ""
1807 ["Mark as read" gnus-summary-mark-as-read-forward t]
1808 ["Mark same subject and select"
1809 gnus-summary-kill-same-subject-and-select t]
1810 ["Mark same subject" gnus-summary-kill-same-subject t]
1811 ["Catchup" gnus-summary-catchup t]
1812 ["Catchup all" gnus-summary-catchup-all t]
1813 ["Catchup to here" gnus-summary-catchup-to-here t]
1814 ["Catchup region" gnus-summary-mark-region-as-read t]
1815 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1817 ["Tick" gnus-summary-tick-article-forward t]
1818 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1819 ["Remove marks" gnus-summary-clear-mark-forward t]
1820 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1821 ["Set bookmark" gnus-summary-set-bookmark t]
1822 ["Remove bookmark" gnus-summary-remove-bookmark t])
1824 ["Marks..." gnus-summary-limit-to-marks t]
1825 ["Subject..." gnus-summary-limit-to-subject t]
1826 ["Author..." gnus-summary-limit-to-author t]
1827 ["Age..." gnus-summary-limit-to-age t]
1828 ["Extra..." gnus-summary-limit-to-extra t]
1829 ["Score" gnus-summary-limit-to-score t]
1830 ["Unread" gnus-summary-limit-to-unread t]
1831 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1832 ["Articles" gnus-summary-limit-to-articles t]
1833 ["Pop limit" gnus-summary-pop-limit t]
1834 ["Show dormant" gnus-summary-limit-include-dormant t]
1835 ["Hide childless dormant"
1836 gnus-summary-limit-exclude-childless-dormant t]
1837 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1838 ["Hide marked" gnus-summary-limit-exclude-marks t]
1839 ["Show expunged" gnus-summary-show-all-expunged t])
1841 ["Set mark" gnus-summary-mark-as-processable t]
1842 ["Remove mark" gnus-summary-unmark-as-processable t]
1843 ["Remove all marks" gnus-summary-unmark-all-processable t]
1844 ["Mark above" gnus-uu-mark-over t]
1845 ["Mark series" gnus-uu-mark-series t]
1846 ["Mark region" gnus-uu-mark-region t]
1847 ["Unmark region" gnus-uu-unmark-region t]
1848 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1849 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1850 ["Mark all" gnus-uu-mark-all t]
1851 ["Mark buffer" gnus-uu-mark-buffer t]
1852 ["Mark sparse" gnus-uu-mark-sparse t]
1853 ["Mark thread" gnus-uu-mark-thread t]
1854 ["Unmark thread" gnus-uu-unmark-thread t]
1855 ("Process Mark Sets"
1856 ["Kill" gnus-summary-kill-process-mark t]
1857 ["Yank" gnus-summary-yank-process-mark
1858 gnus-newsgroup-process-stack]
1859 ["Save" gnus-summary-save-process-mark t]))
1861 ["Page forward" gnus-summary-next-page t]
1862 ["Page backward" gnus-summary-prev-page t]
1863 ["Line forward" gnus-summary-scroll-up t])
1865 ["Next unread article" gnus-summary-next-unread-article t]
1866 ["Previous unread article" gnus-summary-prev-unread-article t]
1867 ["Next article" gnus-summary-next-article t]
1868 ["Previous article" gnus-summary-prev-article t]
1869 ["Next unread subject" gnus-summary-next-unread-subject t]
1870 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1871 ["Next article same subject" gnus-summary-next-same-subject t]
1872 ["Previous article same subject" gnus-summary-prev-same-subject t]
1873 ["First unread article" gnus-summary-first-unread-article t]
1874 ["Best unread article" gnus-summary-best-unread-article t]
1875 ["Go to subject number..." gnus-summary-goto-subject t]
1876 ["Go to article number..." gnus-summary-goto-article t]
1877 ["Go to the last article" gnus-summary-goto-last-article t]
1878 ["Pop article off history" gnus-summary-pop-article t])
1880 ["Sort by number" gnus-summary-sort-by-number t]
1881 ["Sort by author" gnus-summary-sort-by-author t]
1882 ["Sort by subject" gnus-summary-sort-by-subject t]
1883 ["Sort by date" gnus-summary-sort-by-date t]
1884 ["Sort by score" gnus-summary-sort-by-score t]
1885 ["Sort by lines" gnus-summary-sort-by-lines t]
1886 ["Sort by characters" gnus-summary-sort-by-chars t])
1888 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1889 ["Describe group" gnus-summary-describe-group t]
1890 ["Read manual" gnus-info-find-node t])
1892 ["Pick and read" gnus-pick-mode t]
1893 ["Binary" gnus-binary-mode t])
1895 ["Regenerate" gnus-summary-prepare t]
1896 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1897 ["Toggle threading" gnus-summary-toggle-threads t])
1898 ["Filter articles..." gnus-summary-execute-command t]
1899 ["Run command on subjects..." gnus-summary-universal-argument t]
1900 ["Search articles forward..." gnus-summary-search-article-forward t]
1901 ["Search articles backward..." gnus-summary-search-article-backward t]
1902 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1903 ["Expand window" gnus-summary-expand-window t]
1904 ["Expire expirable articles" gnus-summary-expire-articles
1905 (gnus-check-backend-function
1906 'request-expire-articles gnus-newsgroup-name)]
1907 ["Edit local kill file" gnus-summary-edit-local-kill t]
1908 ["Edit main kill file" gnus-summary-edit-global-kill t]
1909 ["Edit group parameters" gnus-summary-edit-parameters t]
1910 ["Customize group parameters" gnus-summary-customize-parameters t]
1911 ["Send a bug report" gnus-bug t]
1913 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1914 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1915 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1916 ["Exit group" gnus-summary-exit t]
1917 ["Exit group without updating" gnus-summary-exit-no-update t]
1918 ["Exit and goto next group" gnus-summary-next-group t]
1919 ["Exit and goto prev group" gnus-summary-prev-group t]
1920 ["Reselect group" gnus-summary-reselect-current-group t]
1921 ["Rescan group" gnus-summary-rescan-group t]
1922 ["Update dribble" gnus-summary-save-newsrc t])))
1924 (gnus-run-hooks 'gnus-summary-menu-hook)))
1926 (defun gnus-score-set-default (var value)
1927 "A version of set that updates the GNU Emacs menu-bar."
1929 ;; It is the message that forces the active status to be updated.
1932 (defun gnus-make-score-map (type)
1933 "Make a summary score map of type TYPE."
1936 (let ((headers '(("author" "from" string)
1937 ("subject" "subject" string)
1938 ("article body" "body" string)
1939 ("article head" "head" string)
1940 ("xref" "xref" string)
1941 ("extra header" "extra" string)
1942 ("lines" "lines" number)
1943 ("followups to author" "followup" string)))
1944 (types '((number ("less than" <)
1947 (string ("substring" s)
1951 (perms '(("temporary" (current-time-string))
1959 (if (eq type 'lower)
1964 (setq header (car headers))
1970 (let ((ts (cdr (assoc (nth 2 header) types)))
1986 'gnus-summary-score-entry
1988 (if (or (string= (nth 1 header)
1990 (string= (nth 1 header)
1993 (list 'gnus-summary-header
1995 (list 'quote (nth 1 (car ts)))
1996 (list 'gnus-score-default nil)
2002 (list (nreverse outp))))
2005 (list (nreverse outt))))
2007 (setq headers (cdr headers)))
2008 (list (nreverse outh))))))))
2012 (defun gnus-summary-mode (&optional group)
2013 "Major mode for reading articles.
2015 All normal editing commands are switched off.
2016 \\<gnus-summary-mode-map>
2017 Each line in this buffer represents one article. To read an
2018 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2019 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2022 You can also post articles and send mail from this buffer. To
2023 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2024 of an article, type `\\[gnus-summary-reply]'.
2026 There are approx. one gazillion commands you can execute in this
2027 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2029 The following commands are available:
2031 \\{gnus-summary-mode-map}"
2033 (when (gnus-visual-p 'summary-menu 'menu)
2034 (gnus-summary-make-menu-bar))
2035 (kill-all-local-variables)
2036 (gnus-summary-make-local-variables)
2037 (gnus-make-thread-indent-array)
2038 (gnus-simplify-mode-line)
2039 (setq major-mode 'gnus-summary-mode)
2040 (setq mode-name "Summary")
2041 (make-local-variable 'minor-mode-alist)
2042 (use-local-map gnus-summary-mode-map)
2043 (buffer-disable-undo)
2044 (setq buffer-read-only t) ;Disable modification
2045 (setq truncate-lines t)
2046 (setq selective-display t)
2047 (setq selective-display-ellipses t) ;Display `...'
2048 (gnus-summary-set-display-table)
2049 (gnus-set-default-directory)
2050 (setq gnus-newsgroup-name group)
2051 (unless (gnus-news-group-p group)
2052 (setq gnus-newsgroup-incorporated
2053 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2054 (make-local-variable 'gnus-summary-line-format)
2055 (make-local-variable 'gnus-summary-line-format-spec)
2056 (make-local-variable 'gnus-summary-dummy-line-format)
2057 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2058 (make-local-variable 'gnus-summary-mark-positions)
2059 (make-local-hook 'pre-command-hook)
2060 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2061 (gnus-run-hooks 'gnus-summary-mode-hook)
2062 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2063 (gnus-update-summary-mark-positions))
2065 (defun gnus-summary-make-local-variables ()
2066 "Make all the local summary buffer variables."
2068 (dolist (local gnus-summary-local-variables)
2071 (if (eq (cdr local) 'global)
2072 ;; Copy the global value of the variable.
2073 (setq global (symbol-value (car local)))
2074 ;; Use the value from the list.
2075 (setq global (eval (cdr local))))
2076 (set (make-local-variable (car local)) global))
2077 ;; Simple nil-valued local variable.
2078 (set (make-local-variable local) nil)))))
2080 (defun gnus-summary-clear-local-variables ()
2081 (let ((locals gnus-summary-local-variables))
2083 (if (consp (car locals))
2084 (and (vectorp (caar locals))
2085 (set (caar locals) nil))
2086 (and (vectorp (car locals))
2087 (set (car locals) nil)))
2088 (setq locals (cdr locals)))))
2090 ;; Summary data functions.
2092 (defmacro gnus-data-number (data)
2095 (defmacro gnus-data-set-number (data number)
2096 `(setcar ,data ,number))
2098 (defmacro gnus-data-mark (data)
2101 (defmacro gnus-data-set-mark (data mark)
2102 `(setcar (nthcdr 1 ,data) ,mark))
2104 (defmacro gnus-data-pos (data)
2107 (defmacro gnus-data-set-pos (data pos)
2108 `(setcar (nthcdr 2 ,data) ,pos))
2110 (defmacro gnus-data-header (data)
2113 (defmacro gnus-data-set-header (data header)
2114 `(setf (nth 3 ,data) ,header))
2116 (defmacro gnus-data-level (data)
2119 (defmacro gnus-data-unread-p (data)
2120 `(= (nth 1 ,data) gnus-unread-mark))
2122 (defmacro gnus-data-read-p (data)
2123 `(/= (nth 1 ,data) gnus-unread-mark))
2125 (defmacro gnus-data-pseudo-p (data)
2126 `(consp (nth 3 ,data)))
2128 (defmacro gnus-data-find (number)
2129 `(assq ,number gnus-newsgroup-data))
2131 (defmacro gnus-data-find-list (number &optional data)
2132 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2133 (memq (assq ,number bdata)
2136 (defmacro gnus-data-make (number mark pos header level)
2137 `(list ,number ,mark ,pos ,header ,level))
2139 (defun gnus-data-enter (after-article number mark pos header level offset)
2140 (let ((data (gnus-data-find-list after-article)))
2142 (error "No such article: %d" after-article))
2143 (setcdr data (cons (gnus-data-make number mark pos header level)
2145 (setq gnus-newsgroup-data-reverse nil)
2146 (gnus-data-update-list (cddr data) offset)))
2148 (defun gnus-data-enter-list (after-article list &optional offset)
2150 (let ((data (and after-article (gnus-data-find-list after-article)))
2154 (let ((odata gnus-newsgroup-data))
2155 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2157 (gnus-data-update-list odata offset)))
2158 ;; Find the last element in the list to be spliced into the main
2161 (setq list (cdr list)))
2164 (setcdr list gnus-newsgroup-data)
2165 (setq gnus-newsgroup-data ilist)
2167 (gnus-data-update-list (cdr list) offset)))
2168 (setcdr list (cdr data))
2171 (gnus-data-update-list (cdr list) offset))))
2172 (setq gnus-newsgroup-data-reverse nil))))
2174 (defun gnus-data-remove (article &optional offset)
2175 (let ((data gnus-newsgroup-data))
2176 (if (= (gnus-data-number (car data)) article)
2178 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2179 gnus-newsgroup-data-reverse nil)
2181 (gnus-data-update-list gnus-newsgroup-data offset)))
2183 (when (= (gnus-data-number (cadr data)) article)
2184 (setcdr data (cddr data))
2186 (gnus-data-update-list (cdr data) offset))
2188 gnus-newsgroup-data-reverse nil))
2189 (setq data (cdr data))))))
2191 (defmacro gnus-data-list (backward)
2193 (or gnus-newsgroup-data-reverse
2194 (setq gnus-newsgroup-data-reverse
2195 (reverse gnus-newsgroup-data)))
2196 gnus-newsgroup-data))
2198 (defun gnus-data-update-list (data offset)
2199 "Add OFFSET to the POS of all data entries in DATA."
2200 (setq gnus-newsgroup-data-reverse nil)
2202 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2203 (setq data (cdr data))))
2205 (defun gnus-summary-article-pseudo-p (article)
2206 "Say whether this article is a pseudo article or not."
2207 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2209 (defmacro gnus-summary-article-sparse-p (article)
2210 "Say whether this article is a sparse article or not."
2211 `(memq ,article gnus-newsgroup-sparse))
2213 (defmacro gnus-summary-article-ancient-p (article)
2214 "Say whether this article is a sparse article or not."
2215 `(memq ,article gnus-newsgroup-ancient))
2217 (defun gnus-article-parent-p (number)
2218 "Say whether this article is a parent or not."
2219 (let ((data (gnus-data-find-list number)))
2220 (and (cdr data) ; There has to be an article after...
2221 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2222 (gnus-data-level (nth 1 data))))))
2224 (defun gnus-article-children (number)
2225 "Return a list of all children to NUMBER."
2226 (let* ((data (gnus-data-find-list number))
2227 (level (gnus-data-level (car data)))
2229 (setq data (cdr data))
2231 (= (gnus-data-level (car data)) (1+ level)))
2232 (push (gnus-data-number (car data)) children)
2233 (setq data (cdr data)))
2236 (defmacro gnus-summary-skip-intangible ()
2237 "If the current article is intangible, then jump to a different article."
2238 '(let ((to (get-text-property (point) 'gnus-intangible)))
2239 (and to (gnus-summary-goto-subject to))))
2241 (defmacro gnus-summary-article-intangible-p ()
2242 "Say whether this article is intangible or not."
2243 '(get-text-property (point) 'gnus-intangible))
2245 (defun gnus-article-read-p (article)
2246 "Say whether ARTICLE is read or not."
2247 (not (or (memq article gnus-newsgroup-marked)
2248 (memq article gnus-newsgroup-unreads)
2249 (memq article gnus-newsgroup-unselected)
2250 (memq article gnus-newsgroup-dormant))))
2252 ;; Some summary mode macros.
2254 (defmacro gnus-summary-article-number ()
2255 "The article number of the article on the current line.
2256 If there isn's an article number here, then we return the current
2259 (gnus-summary-skip-intangible)
2260 (or (get-text-property (point) 'gnus-number)
2261 (gnus-summary-last-subject))))
2263 (defmacro gnus-summary-article-header (&optional number)
2264 "Return the header of article NUMBER."
2265 `(gnus-data-header (gnus-data-find
2266 ,(or number '(gnus-summary-article-number)))))
2268 (defmacro gnus-summary-thread-level (&optional number)
2269 "Return the level of thread that starts with article NUMBER."
2270 `(if (and (eq gnus-summary-make-false-root 'dummy)
2271 (get-text-property (point) 'gnus-intangible))
2273 (gnus-data-level (gnus-data-find
2274 ,(or number '(gnus-summary-article-number))))))
2276 (defmacro gnus-summary-article-mark (&optional number)
2277 "Return the mark of article NUMBER."
2278 `(gnus-data-mark (gnus-data-find
2279 ,(or number '(gnus-summary-article-number)))))
2281 (defmacro gnus-summary-article-pos (&optional number)
2282 "Return the position of the line of article NUMBER."
2283 `(gnus-data-pos (gnus-data-find
2284 ,(or number '(gnus-summary-article-number)))))
2286 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2287 (defmacro gnus-summary-article-subject (&optional number)
2288 "Return current subject string or nil if nothing."
2291 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2292 '(gnus-data-header (assq (gnus-summary-article-number)
2293 gnus-newsgroup-data)))))
2296 (mail-header-subject headers))))
2298 (defmacro gnus-summary-article-score (&optional number)
2299 "Return current article score."
2300 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2301 gnus-newsgroup-scored))
2302 gnus-summary-default-score 0))
2304 (defun gnus-summary-article-children (&optional number)
2305 "Return a list of article numbers that are children of article NUMBER."
2306 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2307 (level (gnus-data-level (car data)))
2309 (while (and (setq data (cdr data))
2310 (> (setq l (gnus-data-level (car data))) level))
2311 (and (= (1+ level) l)
2312 (push (gnus-data-number (car data))
2314 (nreverse children)))
2316 (defun gnus-summary-article-parent (&optional number)
2317 "Return the article number of the parent of article NUMBER."
2318 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2319 (gnus-data-list t)))
2320 (level (gnus-data-level (car data))))
2322 () ; This is a root.
2323 ;; We search until we find an article with a level less than
2324 ;; this one. That function has to be the parent.
2325 (while (and (setq data (cdr data))
2326 (not (< (gnus-data-level (car data)) level))))
2327 (and data (gnus-data-number (car data))))))
2329 (defun gnus-unread-mark-p (mark)
2330 "Say whether MARK is the unread mark."
2331 (= mark gnus-unread-mark))
2333 (defun gnus-read-mark-p (mark)
2334 "Say whether MARK is one of the marks that mark as read.
2335 This is all marks except unread, ticked, dormant, and expirable."
2336 (not (or (= mark gnus-unread-mark)
2337 (= mark gnus-ticked-mark)
2338 (= mark gnus-dormant-mark)
2339 (= mark gnus-expirable-mark))))
2341 (defmacro gnus-article-mark (number)
2342 "Return the MARK of article NUMBER.
2343 This macro should only be used when computing the mark the \"first\"
2344 time; i.e., when generating the summary lines. After that,
2345 `gnus-summary-article-mark' should be used to examine the
2348 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2349 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2350 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2351 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2352 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2353 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2354 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2355 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2356 gnus-ancient-mark))))
2358 ;; Saving hidden threads.
2360 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2361 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2363 (defmacro gnus-save-hidden-threads (&rest forms)
2364 "Save hidden threads, eval FORMS, and restore the hidden threads."
2365 (let ((config (make-symbol "config")))
2366 `(let ((,config (gnus-hidden-threads-configuration)))
2370 (gnus-restore-hidden-threads-configuration ,config)))))
2372 (defun gnus-data-compute-positions ()
2373 "Compute the positions of all articles."
2374 (setq gnus-newsgroup-data-reverse nil)
2375 (let ((data gnus-newsgroup-data))
2377 (gnus-save-hidden-threads
2378 (gnus-summary-show-all-threads)
2379 (goto-char (point-min))
2381 (while (get-text-property (point) 'gnus-intangible)
2383 (gnus-data-set-pos (car data) (+ (point) 3))
2384 (setq data (cdr data))
2385 (forward-line 1))))))
2387 (defun gnus-hidden-threads-configuration ()
2388 "Return the current hidden threads configuration."
2391 (goto-char (point-min))
2392 (while (search-forward "\r" nil t)
2393 (push (1- (point)) config))
2396 (defun gnus-restore-hidden-threads-configuration (config)
2397 "Restore hidden threads configuration from CONFIG."
2398 (let (point buffer-read-only)
2399 (while (setq point (pop config))
2400 (when (and (< point (point-max))
2402 (eq (char-after) ?\n))
2403 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2405 ;; Various summary mode internalish functions.
2407 (defun gnus-mouse-pick-article (e)
2410 (gnus-summary-next-page nil t))
2412 (defun gnus-summary-set-display-table ()
2413 ;; Change the display table. Odd characters have a tendency to mess
2414 ;; up nicely formatted displays - we make all possible glyphs
2415 ;; display only a single character.
2417 ;; We start from the standard display table, if any.
2418 (let ((table (or (copy-sequence standard-display-table)
2419 (make-display-table)))
2421 ;; Nix out all the control chars...
2422 (while (>= (setq i (1- i)) 0)
2423 (aset table i [??]))
2424 ;; ... but not newline and cr, of course. (cr is necessary for the
2425 ;; selective display).
2426 (aset table ?\n nil)
2427 (aset table ?\r nil)
2428 ;; We keep TAB as well.
2429 (aset table ?\t nil)
2430 ;; We nix out any glyphs over 126 that are not set already.
2432 (while (>= (setq i (1- i)) 127)
2433 ;; Only modify if the entry is nil.
2434 (unless (aref table i)
2435 (aset table i [??]))))
2436 (setq buffer-display-table table)))
2438 (defun gnus-summary-setup-buffer (group)
2439 "Initialize summary buffer."
2440 (let ((buffer (concat "*Summary " group "*")))
2441 (if (get-buffer buffer)
2444 (setq gnus-summary-buffer (current-buffer))
2445 (not gnus-newsgroup-prepared))
2446 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2447 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2448 (gnus-summary-mode group)
2450 (gnus-carpal-setup-buffer 'summary))
2451 (unless gnus-single-article-buffer
2452 (make-local-variable 'gnus-article-buffer)
2453 (make-local-variable 'gnus-article-current)
2454 (make-local-variable 'gnus-original-article-buffer))
2455 (setq gnus-newsgroup-name group)
2458 (defun gnus-set-global-variables ()
2459 ;; Set the global equivalents of the summary buffer-local variables
2460 ;; to the latest values they had. These reflect the summary buffer
2461 ;; that was in action when the last article was fetched.
2462 (when (eq major-mode 'gnus-summary-mode)
2463 (setq gnus-summary-buffer (current-buffer))
2464 (let ((name gnus-newsgroup-name)
2465 (marked gnus-newsgroup-marked)
2466 (unread gnus-newsgroup-unreads)
2467 (headers gnus-current-headers)
2468 (data gnus-newsgroup-data)
2469 (summary gnus-summary-buffer)
2470 (article-buffer gnus-article-buffer)
2471 (original gnus-original-article-buffer)
2472 (gac gnus-article-current)
2473 (reffed gnus-reffed-article-number)
2474 (score-file gnus-current-score-file)
2475 (default-charset gnus-newsgroup-charset))
2477 (set-buffer gnus-group-buffer)
2478 (setq gnus-newsgroup-name name
2479 gnus-newsgroup-marked marked
2480 gnus-newsgroup-unreads unread
2481 gnus-current-headers headers
2482 gnus-newsgroup-data data
2483 gnus-article-current gac
2484 gnus-summary-buffer summary
2485 gnus-article-buffer article-buffer
2486 gnus-original-article-buffer original
2487 gnus-reffed-article-number reffed
2488 gnus-current-score-file score-file
2489 gnus-newsgroup-charset default-charset)
2490 ;; The article buffer also has local variables.
2491 (when (gnus-buffer-live-p gnus-article-buffer)
2492 (set-buffer gnus-article-buffer)
2493 (setq gnus-summary-buffer summary))))))
2495 (defun gnus-summary-article-unread-p (article)
2496 "Say whether ARTICLE is unread or not."
2497 (memq article gnus-newsgroup-unreads))
2499 (defun gnus-summary-first-article-p (&optional article)
2500 "Return whether ARTICLE is the first article in the buffer."
2501 (if (not (setq article (or article (gnus-summary-article-number))))
2503 (eq article (caar gnus-newsgroup-data))))
2505 (defun gnus-summary-last-article-p (&optional article)
2506 "Return whether ARTICLE is the last article in the buffer."
2507 (if (not (setq article (or article (gnus-summary-article-number))))
2508 ;; All non-existent numbers are the last article. :-)
2510 (not (cdr (gnus-data-find-list article)))))
2512 (defun gnus-make-thread-indent-array ()
2514 (unless (and gnus-thread-indent-array
2515 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2516 (setq gnus-thread-indent-array (make-vector 201 "")
2517 gnus-thread-indent-array-level gnus-thread-indent-level)
2519 (aset gnus-thread-indent-array n
2520 (make-string (* n gnus-thread-indent-level) ? ))
2523 (defun gnus-update-summary-mark-positions ()
2524 "Compute where the summary marks are to go."
2526 (when (gnus-buffer-exists-p gnus-summary-buffer)
2527 (set-buffer gnus-summary-buffer))
2528 (let ((gnus-replied-mark 129)
2529 (gnus-score-below-mark 130)
2530 (gnus-score-over-mark 130)
2531 (gnus-download-mark 131)
2532 (spec gnus-summary-line-format-spec)
2535 (gnus-set-work-buffer)
2536 (let ((gnus-summary-line-format-spec spec)
2537 (gnus-newsgroup-downloadable '((0 . t))))
2538 (gnus-summary-insert-line
2539 (make-full-mail-header 0 "" "" "" "" "" 0 0 "" nil)
2540 0 nil 128 t nil "" nil 1)
2541 (goto-char (point-min))
2542 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2544 (goto-char (point-min))
2545 (push (cons 'replied (and (search-forward "\201" nil t)
2548 (goto-char (point-min))
2549 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2551 (goto-char (point-min))
2552 (push (cons 'download
2553 (and (search-forward "\203" nil t) (- (point) 2)))
2555 (setq gnus-summary-mark-positions pos))))
2557 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2558 "Insert a dummy root in the summary buffer."
2560 (gnus-add-text-properties
2561 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2562 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2564 (defun gnus-summary-from-or-to-or-newsgroups (header)
2565 (let ((to (cdr (assq 'To (mail-header-extra header))))
2566 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2567 (default-mime-charset (with-current-buffer gnus-summary-buffer
2568 default-mime-charset)))
2571 gnus-ignored-from-addresses
2572 (string-match gnus-ignored-from-addresses
2573 (mail-header-from header)))
2575 (or (car (funcall gnus-extract-address-components
2577 gnus-decode-encoded-word-function to)))
2578 (funcall gnus-decode-encoded-word-function to))))
2580 gnus-ignored-from-addresses
2581 (string-match gnus-ignored-from-addresses
2582 (mail-header-from header)))
2583 (concat "=> " newsgroups))
2585 (or (car (funcall gnus-extract-address-components
2586 (mail-header-from header)))
2587 (mail-header-from header))))))
2589 (defun gnus-summary-insert-line (gnus-tmp-header
2590 gnus-tmp-level gnus-tmp-current
2591 gnus-tmp-unread gnus-tmp-replied
2592 gnus-tmp-expirable gnus-tmp-subject-or-nil
2593 &optional gnus-tmp-dummy gnus-tmp-score
2595 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2596 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2597 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2598 (gnus-tmp-score-char
2599 (if (or (null gnus-summary-default-score)
2600 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2601 gnus-summary-zcore-fuzz))
2603 (if (< gnus-tmp-score gnus-summary-default-score)
2604 gnus-score-below-mark gnus-score-over-mark)))
2606 (cond (gnus-tmp-process gnus-process-mark)
2607 ((memq gnus-tmp-current gnus-newsgroup-cached)
2609 (gnus-tmp-replied gnus-replied-mark)
2610 ((memq gnus-tmp-current gnus-newsgroup-saved)
2612 (t gnus-unread-mark)))
2613 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2616 ((string-match "<[^>]+> *$" gnus-tmp-from)
2617 (let ((beg (match-beginning 0)))
2618 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2619 (substring gnus-tmp-from (1+ (match-beginning 0))
2620 (1- (match-end 0))))
2621 (substring gnus-tmp-from 0 beg))))
2622 ((string-match "(.+)" gnus-tmp-from)
2623 (substring gnus-tmp-from
2624 (1+ (match-beginning 0)) (1- (match-end 0))))
2626 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2627 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2628 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2629 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2630 (buffer-read-only nil))
2631 (when (string= gnus-tmp-name "")
2632 (setq gnus-tmp-name gnus-tmp-from))
2633 (unless (numberp gnus-tmp-lines)
2634 (setq gnus-tmp-lines 0))
2635 (gnus-put-text-property-excluding-characters-with-faces
2637 (progn (eval gnus-summary-line-format-spec) (point))
2638 'gnus-number gnus-tmp-number)
2639 (when (gnus-visual-p 'summary-highlight 'highlight)
2641 (gnus-run-hooks 'gnus-summary-update-hook)
2644 (defun gnus-summary-update-line (&optional dont-update)
2645 ;; Update summary line after change.
2646 (when (and gnus-summary-default-score
2647 (not gnus-summary-inhibit-highlight))
2648 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2649 (article (gnus-summary-article-number))
2650 (score (gnus-summary-article-score article)))
2652 (if (and gnus-summary-mark-below
2653 (< (gnus-summary-article-score)
2654 gnus-summary-mark-below))
2655 ;; This article has a low score, so we mark it as read.
2656 (when (memq article gnus-newsgroup-unreads)
2657 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2658 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2659 ;; This article was previously marked as read on account
2660 ;; of a low score, but now it has risen, so we mark it as
2662 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2663 (gnus-summary-update-mark
2664 (if (or (null gnus-summary-default-score)
2665 (<= (abs (- score gnus-summary-default-score))
2666 gnus-summary-zcore-fuzz))
2668 (if (< score gnus-summary-default-score)
2669 gnus-score-below-mark gnus-score-over-mark))
2671 ;; Do visual highlighting.
2672 (when (gnus-visual-p 'summary-highlight 'highlight)
2673 (gnus-run-hooks 'gnus-summary-update-hook)))))
2675 (defvar gnus-tmp-new-adopts nil)
2677 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2678 "Return the number of articles in THREAD.
2679 This may be 0 in some cases -- if none of the articles in
2680 the thread are to be displayed."
2682 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2684 ((not (listp thread))
2686 ((and (consp thread) (cdr thread))
2689 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2692 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2695 (when (and level (zerop level) gnus-tmp-new-adopts)
2698 'gnus-summary-number-of-articles-in-thread
2699 gnus-tmp-new-adopts))))
2701 (if (> number 1) gnus-not-empty-thread-mark
2702 gnus-empty-thread-mark)
2705 (defun gnus-summary-set-local-parameters (group)
2706 "Go through the local params of GROUP and set all variable specs in that list."
2707 (let ((params (gnus-group-find-parameter group))
2710 (setq elem (car params)
2711 params (cdr params))
2712 (and (consp elem) ; Has to be a cons.
2713 (consp (cdr elem)) ; The cdr has to be a list.
2714 (symbolp (car elem)) ; Has to be a symbol in there.
2715 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2716 (ignore-errors ; So we set it.
2717 (make-local-variable (car elem))
2718 (set (car elem) (eval (nth 1 elem))))))))
2720 (defun gnus-summary-read-group (group &optional show-all no-article
2721 kill-buffer no-display backward
2723 "Start reading news in newsgroup GROUP.
2724 If SHOW-ALL is non-nil, already read articles are also listed.
2725 If NO-ARTICLE is non-nil, no article is selected initially.
2726 If NO-DISPLAY, don't generate a summary buffer."
2730 (let ((gnus-auto-select-next nil))
2731 (or (gnus-summary-read-group-1
2732 group show-all no-article
2733 kill-buffer no-display
2736 select-articles nil)))))
2737 (eq gnus-auto-select-next 'quietly))
2738 (set-buffer gnus-group-buffer)
2739 ;; The entry function called above goes to the next
2740 ;; group automatically, so we go two groups back
2741 ;; if we are searching for the previous group.
2743 (gnus-group-prev-unread-group 2))
2744 (if (not (equal group (gnus-group-group-name)))
2745 (setq group (gnus-group-group-name))
2749 (defun gnus-summary-jump-to-other-group (group &optional show-all)
2750 "Directly jump to the other GROUP from summary buffer.
2751 If SHOW-ALL is non-nil, already read articles are also listed."
2753 (if (eq gnus-summary-buffer (current-buffer))
2754 (list (completing-read
2755 "Group: " gnus-active-hashtb nil t
2756 (when (and gnus-newsgroup-name
2757 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
2758 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
2759 'gnus-group-history)
2761 (error "%s must be invoked from a gnus summary buffer." this-command)))
2762 (unless (or (zerop (length group))
2763 (and gnus-newsgroup-name
2764 (string-equal gnus-newsgroup-name group)))
2766 (gnus-summary-read-group group show-all
2767 gnus-dont-select-after-jump-to-other-group)))
2769 (defun gnus-summary-read-group-1 (group show-all no-article
2770 kill-buffer no-display
2771 &optional select-articles)
2772 ;; Killed foreign groups can't be entered.
2773 (when (and (not (gnus-group-native-p group))
2774 (not (gnus-gethash group gnus-newsrc-hashtb)))
2775 (error "Dead non-native groups can't be entered"))
2776 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2777 (let* ((new-group (gnus-summary-setup-buffer group))
2778 (quit-config (gnus-group-quit-config group))
2779 (did-select (and new-group (gnus-select-newsgroup
2780 group show-all select-articles))))
2782 ;; This summary buffer exists already, so we just select it.
2784 (gnus-set-global-variables)
2786 (gnus-kill-or-deaden-summary kill-buffer))
2787 (gnus-configure-windows 'summary 'force)
2788 (gnus-set-mode-line 'summary)
2789 (gnus-summary-position-point)
2792 ;; We couldn't select this group.
2794 (when (and (eq major-mode 'gnus-summary-mode)
2795 (not (equal (current-buffer) kill-buffer)))
2796 (kill-buffer (current-buffer))
2797 (if (not quit-config)
2799 ;; Update the info -- marks might need to be removed,
2801 (gnus-summary-update-info)
2802 (set-buffer gnus-group-buffer)
2803 (gnus-group-jump-to-group group)
2804 (gnus-group-next-unread-group 1))
2805 (gnus-handle-ephemeral-exit quit-config)))
2806 (gnus-message 3 "Can't select group")
2808 ;; The user did a `C-g' while prompting for number of articles,
2809 ;; so we exit this group.
2810 ((eq did-select 'quit)
2811 (and (eq major-mode 'gnus-summary-mode)
2812 (not (equal (current-buffer) kill-buffer))
2813 (kill-buffer (current-buffer)))
2815 (gnus-kill-or-deaden-summary kill-buffer))
2816 (if (not quit-config)
2818 (set-buffer gnus-group-buffer)
2819 (gnus-group-jump-to-group group)
2820 (gnus-group-next-unread-group 1)
2821 (gnus-configure-windows 'group 'force))
2822 (gnus-handle-ephemeral-exit quit-config))
2823 ;; Finally signal the quit.
2825 ;; The group was successfully selected.
2827 (gnus-set-global-variables)
2828 ;; Save the active value in effect when the group was entered.
2829 (setq gnus-newsgroup-active
2831 (gnus-active gnus-newsgroup-name)))
2832 ;; You can change the summary buffer in some way with this hook.
2833 (gnus-run-hooks 'gnus-select-group-hook)
2834 ;; Set any local variables in the group parameters.
2835 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2836 (gnus-update-format-specifications
2837 nil 'summary 'summary-mode 'summary-dummy)
2838 (gnus-update-summary-mark-positions)
2839 ;; Do score processing.
2840 (when gnus-use-scoring
2841 (gnus-possibly-score-headers))
2842 ;; Check whether to fill in the gaps in the threads.
2843 (when gnus-build-sparse-threads
2844 (gnus-build-sparse-threads))
2845 ;; Find the initial limit.
2846 (if gnus-show-threads
2848 (let ((gnus-newsgroup-dormant nil))
2849 (gnus-summary-initial-limit show-all))
2850 (gnus-summary-initial-limit show-all))
2851 (setq gnus-newsgroup-limit
2853 (lambda (header) (mail-header-number header))
2854 gnus-newsgroup-headers)))
2855 ;; Generate the summary buffer.
2857 (gnus-summary-prepare))
2858 (when gnus-use-trees
2859 (gnus-tree-open group)
2860 (setq gnus-summary-highlight-line-function
2861 'gnus-tree-highlight-article))
2862 ;; If the summary buffer is empty, but there are some low-scored
2863 ;; articles or some excluded dormants, we include these in the
2865 (when (and (zerop (buffer-size))
2867 (cond (gnus-newsgroup-dormant
2868 (gnus-summary-limit-include-dormant))
2869 ((and gnus-newsgroup-scored show-all)
2870 (gnus-summary-limit-include-expunged t))))
2871 ;; Function `gnus-apply-kill-file' must be called in this hook.
2872 (gnus-run-hooks 'gnus-apply-kill-hook)
2873 (if (and (zerop (buffer-size))
2876 ;; This newsgroup is empty.
2877 (gnus-summary-catchup-and-exit nil t)
2878 (gnus-message 6 "No unread news")
2880 (gnus-kill-or-deaden-summary kill-buffer))
2881 ;; Return nil from this function.
2883 ;; Hide conversation thread subtrees. We cannot do this in
2884 ;; gnus-summary-prepare-hook since kill processing may not
2885 ;; work with hidden articles.
2886 (and gnus-show-threads
2887 gnus-thread-hide-subtree
2888 (gnus-summary-hide-all-threads))
2890 (gnus-kill-or-deaden-summary kill-buffer))
2891 ;; Show first unread article if requested.
2892 (if (and (not no-article)
2894 gnus-newsgroup-unreads
2895 gnus-auto-select-first)
2897 (gnus-configure-windows 'summary)
2899 ((eq gnus-auto-select-first 'best)
2900 (gnus-summary-best-unread-article))
2901 ((eq gnus-auto-select-first t)
2902 (gnus-summary-first-unread-article))
2903 ((gnus-functionp gnus-auto-select-first)
2904 (funcall gnus-auto-select-first))))
2905 ;; Don't select any articles, just move point to the first
2906 ;; article in the group.
2907 (goto-char (point-min))
2908 (gnus-summary-position-point)
2909 (gnus-configure-windows 'summary 'force)
2910 (gnus-set-mode-line 'summary))
2911 (when (get-buffer-window gnus-group-buffer t)
2912 ;; Gotta use windows, because recenter does weird stuff if
2913 ;; the current buffer ain't the displayed window.
2914 (let ((owin (selected-window)))
2915 (select-window (get-buffer-window gnus-group-buffer t))
2916 (when (gnus-group-goto-group group)
2918 (select-window owin)))
2919 ;; Mark this buffer as "prepared".
2920 (setq gnus-newsgroup-prepared t)
2921 (gnus-run-hooks 'gnus-summary-prepared-hook)
2924 (defun gnus-summary-prepare ()
2925 "Generate the summary buffer."
2927 (let ((buffer-read-only nil))
2929 (setq gnus-newsgroup-data nil
2930 gnus-newsgroup-data-reverse nil)
2931 (gnus-run-hooks 'gnus-summary-generate-hook)
2932 ;; Generate the buffer, either with threads or without.
2933 (when gnus-newsgroup-headers
2934 (gnus-summary-prepare-threads
2935 (if gnus-show-threads
2936 (gnus-sort-gathered-threads
2937 (funcall gnus-summary-thread-gathering-function
2939 (gnus-cut-threads (gnus-make-threads)))))
2940 ;; Unthreaded display.
2941 (gnus-sort-articles gnus-newsgroup-headers))))
2942 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2943 ;; Call hooks for modifying summary buffer.
2944 (goto-char (point-min))
2945 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2947 (defsubst gnus-general-simplify-subject (subject)
2948 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2951 ;; Truncate the subject.
2952 (gnus-simplify-subject-functions
2953 (gnus-map-function gnus-simplify-subject-functions subject))
2954 ((numberp gnus-summary-gather-subject-limit)
2955 (setq subject (gnus-simplify-subject-re subject))
2956 (if (> (length subject) gnus-summary-gather-subject-limit)
2957 (substring subject 0 gnus-summary-gather-subject-limit)
2959 ;; Fuzzily simplify it.
2960 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2961 (gnus-simplify-subject-fuzzy subject))
2962 ;; Just remove the leading "Re:".
2964 (gnus-simplify-subject-re subject))))
2966 (if (and gnus-summary-gather-exclude-subject
2967 (string-match gnus-summary-gather-exclude-subject subject))
2968 nil ; This article shouldn't be gathered
2971 (defun gnus-summary-simplify-subject-query ()
2972 "Query where the respool algorithm would put this article."
2974 (gnus-summary-select-article)
2975 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2977 (defun gnus-gather-threads-by-subject (threads)
2978 "Gather threads by looking at Subject headers."
2979 (if (not gnus-summary-make-false-root)
2981 (let ((hashtb (gnus-make-hashtable 1024))
2984 subject hthread whole-subject)
2986 (setq subject (gnus-general-simplify-subject
2987 (setq whole-subject (mail-header-subject
2990 (if (setq hthread (gnus-gethash subject hashtb))
2992 ;; We enter a dummy root into the thread, if we
2993 ;; haven't done that already.
2994 (unless (stringp (caar hthread))
2995 (setcar hthread (list whole-subject (car hthread))))
2996 ;; We add this new gathered thread to this gathered
2998 (setcdr (car hthread)
2999 (nconc (cdar hthread) (list (car threads))))
3000 ;; Remove it from the list of threads.
3001 (setcdr prev (cdr threads))
3002 (setq threads prev))
3003 ;; Enter this thread into the hash table.
3004 (gnus-sethash subject threads hashtb)))
3006 (setq threads (cdr threads)))
3009 (defun gnus-gather-threads-by-references (threads)
3010 "Gather threads by looking at References headers."
3011 (let ((idhashtb (gnus-make-hashtable 1024))
3012 (thhashtb (gnus-make-hashtable 1024))
3015 ids references id gthread gid entered ref)
3017 (when (setq references (mail-header-references (caar threads)))
3018 (setq id (mail-header-id (caar threads))
3019 ids (gnus-split-references references)
3021 (while (setq ref (pop ids))
3022 (setq ids (delete ref ids))
3023 (if (not (setq gid (gnus-gethash ref idhashtb)))
3025 (gnus-sethash ref id idhashtb)
3026 (gnus-sethash id threads thhashtb))
3027 (setq gthread (gnus-gethash gid thhashtb))
3029 ;; We enter a dummy root into the thread, if we
3030 ;; haven't done that already.
3031 (unless (stringp (caar gthread))
3032 (setcar gthread (list (mail-header-subject (caar gthread))
3034 ;; We add this new gathered thread to this gathered
3036 (setcdr (car gthread)
3037 (nconc (cdar gthread) (list (car threads)))))
3038 ;; Add it into the thread hash table.
3039 (gnus-sethash id gthread thhashtb)
3041 ;; Remove it from the list of threads.
3042 (setcdr prev (cdr threads))
3043 (setq threads prev))))
3045 (setq threads (cdr threads)))
3048 (defun gnus-sort-gathered-threads (threads)
3049 "Sort subtreads inside each gathered thread by article number."
3050 (let ((result threads))
3052 (when (stringp (caar threads))
3053 (setcdr (car threads)
3054 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3055 (setq threads (cdr threads)))
3058 (defun gnus-thread-loop-p (root thread)
3059 "Say whether ROOT is in THREAD."
3060 (let ((stack (list thread))
3063 (while (setq thread (pop stack))
3064 (setq th (cdr thread))
3066 (not (eq (caar th) root)))
3069 ;; We have found a loop.
3071 (setcdr thread (delq (car th) (cdr thread)))
3072 (if (boundp (setq ref-dep (intern "none"
3073 gnus-newsgroup-dependencies)))
3074 (setcdr (symbol-value ref-dep)
3075 (nconc (cdr (symbol-value ref-dep))
3077 (set ref-dep (list nil (car th))))
3080 ;; Push all the subthreads onto the stack.
3081 (push (cdr thread) stack)))
3084 (defun gnus-make-threads ()
3085 "Go through the dependency hashtb and find the roots. Return all threads."
3087 (while (catch 'infloop
3090 ;; Deal with self-referencing References loops.
3091 (when (and (car (symbol-value refs))
3098 (car (symbol-value refs)) thread))
3099 (cdr (symbol-value refs)))))))
3102 (unless (car (symbol-value refs))
3103 ;; These threads do not refer back to any other articles,
3104 ;; so they're roots.
3105 (setq threads (append (cdr (symbol-value refs)) threads))))
3106 gnus-newsgroup-dependencies)))
3109 ;; Build the thread tree.
3110 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3111 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3113 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3114 if it was already present.
3116 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3117 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3118 Message-IDs will be renamed be renamed to a unique Message-ID before
3121 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3122 (let* ((id (mail-header-id header))
3123 (id-dep (and id (intern id dependencies)))
3124 ref ref-dep ref-header)
3125 ;; Enter this `header' in the `dependencies' table.
3129 ;; The first two cases do the normal part: enter a new `header'
3130 ;; in the `dependencies' table.
3131 ((not (boundp id-dep))
3132 (set id-dep (list header)))
3133 ((null (car (symbol-value id-dep)))
3134 (setcar (symbol-value id-dep) header))
3136 ;; From here the `header' was already present in the
3137 ;; `dependencies' table.
3139 ;; Overrides an existing entry;
3140 ;; just set the header part of the entry.
3141 (setcar (symbol-value id-dep) header))
3143 ;; Renames the existing `header' to a unique Message-ID.
3144 ((not gnus-summary-ignore-duplicates)
3145 ;; An article with this Message-ID has already been seen.
3146 ;; We rename the Message-ID.
3147 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3149 (mail-header-set-id header id))
3151 ;; The last case ignores an existing entry, except it adds any
3152 ;; additional Xrefs (in case the two articles came from different
3154 ;; Also sets `header' to `nil' meaning that the `dependencies'
3155 ;; table was *not* modified.
3157 (mail-header-set-xref
3158 (car (symbol-value id-dep))
3159 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3161 (or (mail-header-xref header) "")))
3165 ;; First check if that we are not creating a References loop.
3166 (setq ref (gnus-parent-id (mail-header-references header)))
3168 (setq ref-dep (intern-soft ref dependencies))
3170 (setq ref-header (car (symbol-value ref-dep))))
3171 (if (string= id ref)
3172 ;; Yuk! This is a reference loop. Make the article be a
3175 (mail-header-set-references (car (symbol-value id-dep)) "none")
3177 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3178 (setq ref (gnus-parent-id (mail-header-references header)))
3179 (setq ref-dep (intern (or ref "none") dependencies))
3180 (if (boundp ref-dep)
3181 (setcdr (symbol-value ref-dep)
3182 (nconc (cdr (symbol-value ref-dep))
3183 (list (symbol-value id-dep))))
3184 (set ref-dep (list nil (symbol-value id-dep)))))
3187 (defun gnus-build-sparse-threads ()
3188 (let ((headers gnus-newsgroup-headers)
3189 (gnus-summary-ignore-duplicates t)
3190 header references generation relations
3191 subject child end new-child date)
3192 ;; First we create an alist of generations/relations, where
3193 ;; generations is how much we trust the relation, and the relation
3195 (gnus-message 7 "Making sparse threads...")
3197 (nnheader-set-temp-buffer " *gnus sparse threads*")
3198 (while (setq header (pop headers))
3199 (when (and (setq references (mail-header-references header))
3200 (not (string= references "")))
3202 (setq child (mail-header-id header)
3203 subject (mail-header-subject header)
3204 date (mail-header-date header)
3206 (while (search-backward ">" nil t)
3207 (setq end (1+ (point)))
3208 (when (search-backward "<" nil t)
3209 (setq new-child (buffer-substring (point) end))
3210 (push (list (incf generation)
3211 child (setq child new-child)
3215 (push (list (1+ generation) child nil subject) relations))
3217 (kill-buffer (current-buffer)))
3218 ;; Sort over trustworthiness.
3221 (when (gnus-dependencies-add-header
3222 (make-full-mail-header
3223 gnus-reffed-article-number
3224 (nth 3 relation) "" (or (nth 4 relation) "")
3226 (or (nth 2 relation) "") 0 0 "")
3227 gnus-newsgroup-dependencies nil)
3228 (push gnus-reffed-article-number gnus-newsgroup-limit)
3229 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3230 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3231 gnus-newsgroup-reads)
3232 (decf gnus-reffed-article-number)))
3233 (sort relations 'car-less-than-car))
3234 (gnus-message 7 "Making sparse threads...done")))
3236 (defun gnus-build-old-threads ()
3237 ;; Look at all the articles that refer back to old articles, and
3238 ;; fetch the headers for the articles that aren't there. This will
3239 ;; build complete threads - if the roots haven't been expired by the
3244 (when (not (car (symbol-value refs)))
3245 (setq heads (cdr (symbol-value refs)))
3247 (if (memq (mail-header-number (caar heads))
3248 gnus-newsgroup-dormant)
3249 (setq heads (cdr heads))
3250 (setq id (symbol-name refs))
3251 (while (and (setq id (gnus-build-get-header id))
3252 (not (car (gnus-id-to-thread id)))))
3253 (setq heads nil)))))
3254 gnus-newsgroup-dependencies)))
3256 ;; This function has to be called with point after the article number
3257 ;; on the beginning of the line.
3258 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3259 (let ((eol (gnus-point-at-eol))
3260 (buffer (current-buffer))
3263 ;; overview: [num subject from date id refs chars lines misc]
3268 (make-full-mail-header
3270 (nnheader-nov-field) ; subject
3271 (nnheader-nov-field) ; from
3272 (nnheader-nov-field) ; date
3273 (nnheader-nov-read-message-id) ; id
3274 (nnheader-nov-field) ; refs
3275 (nnheader-nov-read-integer) ; chars
3276 (nnheader-nov-read-integer) ; lines
3278 (nnheader-nov-field)) ; misc
3279 (nnheader-nov-parse-extra))) ; extra
3281 (when gnus-alter-header-function
3282 (funcall gnus-alter-header-function header))
3283 (gnus-dependencies-add-header header dependencies force-new)))
3285 (defun gnus-build-get-header (id)
3286 ;; Look through the buffer of NOV lines and find the header to
3287 ;; ID. Enter this line into the dependencies hash table, and return
3288 ;; the id of the parent article (if any).
3289 (let ((deps gnus-newsgroup-dependencies)
3293 (set-buffer nntp-server-buffer)
3294 (let ((case-fold-search nil))
3295 (goto-char (point-min))
3296 (while (and (not found)
3297 (search-forward id nil t))
3299 (setq found (looking-at
3300 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3301 (regexp-quote id))))
3302 (or found (beginning-of-line 2)))
3306 (setq header (gnus-nov-parse-line
3307 (read (current-buffer)) deps))
3308 (gnus-parent-id (mail-header-references header))))))
3310 (let ((number (mail-header-number header)))
3311 (push number gnus-newsgroup-limit)
3312 (push header gnus-newsgroup-headers)
3313 (if (memq number gnus-newsgroup-unselected)
3315 (push number gnus-newsgroup-unreads)
3316 (setq gnus-newsgroup-unselected
3317 (delq number gnus-newsgroup-unselected)))
3318 (push number gnus-newsgroup-ancient)))))))
3320 (defun gnus-build-all-threads ()
3321 "Read all the headers."
3322 (let ((gnus-summary-ignore-duplicates t)
3323 (dependencies gnus-newsgroup-dependencies)
3326 (set-buffer nntp-server-buffer)
3327 (let ((case-fold-search nil))
3328 (goto-char (point-min))
3331 (setq article (read (current-buffer))
3332 header (gnus-nov-parse-line
3333 article dependencies)))
3336 (set-buffer gnus-summary-buffer)
3337 (push header gnus-newsgroup-headers)
3338 (if (memq (setq article (mail-header-number header))
3339 gnus-newsgroup-unselected)
3341 (push article gnus-newsgroup-unreads)
3342 (setq gnus-newsgroup-unselected
3343 (delq article gnus-newsgroup-unselected)))
3344 (push article gnus-newsgroup-ancient)))
3345 (forward-line 1)))))))
3347 (defun gnus-summary-update-article-line (article header)
3348 "Update the line for ARTICLE using HEADERS."
3349 (let* ((id (mail-header-id header))
3350 (thread (gnus-id-to-thread id)))
3352 (error "Article in no thread"))
3353 ;; Update the thread.
3354 (setcar thread header)
3355 (gnus-summary-goto-subject article)
3356 (let* ((datal (gnus-data-find-list article))
3358 (length (when (cdr datal)
3359 (- (gnus-data-pos data)
3360 (gnus-data-pos (cadr datal)))))
3361 (buffer-read-only nil)
3362 (level (gnus-summary-thread-level)))
3364 (gnus-summary-insert-line
3365 header level nil (gnus-article-mark article)
3366 (memq article gnus-newsgroup-replied)
3367 (memq article gnus-newsgroup-expirable)
3368 ;; Only insert the Subject string when it's different
3369 ;; from the previous Subject string.
3370 (if (gnus-subject-equal
3372 (mail-header-subject
3375 (gnus-data-find-list
3377 (gnus-data-list t)))))
3378 ;; Error on the side of excessive subjects.
3380 (mail-header-subject header))
3382 (mail-header-subject header))
3383 nil (cdr (assq article gnus-newsgroup-scored))
3384 (memq article gnus-newsgroup-processable))
3386 (gnus-data-update-list
3387 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3389 (defun gnus-summary-update-article (article &optional iheader)
3390 "Update ARTICLE in the summary buffer."
3391 (set-buffer gnus-summary-buffer)
3392 (let* ((header (gnus-summary-article-header article))
3393 (id (mail-header-id header))
3394 (data (gnus-data-find article))
3395 (thread (gnus-id-to-thread id))
3396 (references (mail-header-references header))
3400 (when (and references
3401 (not (equal "" references)))
3404 (buffer-read-only nil)
3410 (delq thread parent)))
3411 (if (gnus-summary-insert-subject id header)
3412 ;; Set the (possibly) new article number in the data structure.
3413 (gnus-data-set-number data (gnus-id-to-article id))
3417 (defun gnus-rebuild-thread (id &optional line)
3418 "Rebuild the thread containing ID.
3419 If LINE, insert the rebuilt thread starting on line LINE."
3420 (let ((buffer-read-only nil)
3421 old-pos current thread data)
3422 (if (not gnus-show-threads)
3423 (setq thread (list (car (gnus-id-to-thread id))))
3424 ;; Get the thread this article is part of.
3425 (setq thread (gnus-remove-thread id)))
3426 (setq old-pos (gnus-point-at-bol))
3427 (setq current (save-excursion
3428 (and (zerop (forward-line -1))
3429 (gnus-summary-article-number))))
3430 ;; If this is a gathered thread, we have to go some re-gathering.
3431 (when (stringp (car thread))
3432 (let ((subject (car thread))
3434 (setq thread (cdr thread))
3436 (unless (memq (setq thr (gnus-id-to-thread
3438 (mail-header-id (caar thread)))))
3441 (setq thread (cdr thread)))
3442 ;; We now have all (unique) roots.
3443 (if (= (length roots) 1)
3444 ;; All the loose roots are now one solid root.
3445 (setq thread (car roots))
3446 (setq thread (cons subject (gnus-sort-threads roots))))))
3448 ;; We then insert this thread into the summary buffer.
3450 (goto-char (point-min))
3451 (forward-line (1- line)))
3452 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3453 (if gnus-show-threads
3454 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3455 (gnus-summary-prepare-unthreaded thread))
3456 (setq data (nreverse gnus-newsgroup-data))
3457 (setq threads gnus-newsgroup-threads))
3458 ;; We splice the new data into the data structure.
3459 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3460 ;;!!! then we want to insert at the beginning of the buffer.
3461 ;;!!! That happens to be true with Gnus now, but that may
3462 ;;!!! change in the future. Perhaps.
3463 (gnus-data-enter-list
3464 (if line nil current) data (- (point) old-pos))
3465 (setq gnus-newsgroup-threads
3466 (nconc threads gnus-newsgroup-threads))
3467 (gnus-data-compute-positions))))
3469 (defun gnus-number-to-header (number)
3470 "Return the header for article NUMBER."
3471 (let ((headers gnus-newsgroup-headers))
3473 (not (= number (mail-header-number (car headers)))))
3478 (defun gnus-parent-headers (in-headers &optional generation)
3479 "Return the headers of the GENERATIONeth parent of HEADERS."
3481 (setq generation 1))
3483 (headers in-headers)
3486 (not (zerop generation))
3487 (setq references (mail-header-references headers)))
3488 (setq headers (if (and references
3489 (setq parent (gnus-parent-id references)))
3490 (car (gnus-id-to-thread parent))
3493 (and (not (eq headers in-headers))
3496 (defun gnus-id-to-thread (id)
3497 "Return the (sub-)thread where ID appears."
3498 (gnus-gethash id gnus-newsgroup-dependencies))
3500 (defun gnus-id-to-article (id)
3501 "Return the article number of ID."
3502 (let ((thread (gnus-id-to-thread id)))
3505 (mail-header-number (car thread)))))
3507 (defun gnus-id-to-header (id)
3508 "Return the article headers of ID."
3509 (car (gnus-id-to-thread id)))
3511 (defun gnus-article-displayed-root-p (article)
3512 "Say whether ARTICLE is a root(ish) article."
3513 (let ((level (gnus-summary-thread-level article))
3514 (refs (mail-header-references (gnus-summary-article-header article)))
3520 ((null (gnus-parent-id refs)) t)
3522 (null (setq particle (gnus-id-to-article
3523 (gnus-parent-id refs))))
3524 (null (gnus-summary-thread-level particle)))))))
3526 (defun gnus-root-id (id)
3527 "Return the id of the root of the thread where ID appears."
3529 (while (and id (setq prev (car (gnus-id-to-thread id))))
3531 id (gnus-parent-id (mail-header-references prev))))
3534 (defun gnus-articles-in-thread (thread)
3535 "Return the list of articles in THREAD."
3536 (cons (mail-header-number (car thread))
3537 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3539 (defun gnus-remove-thread (id &optional dont-remove)
3540 "Remove the thread that has ID in it."
3541 (let (headers thread last-id)
3542 ;; First go up in this thread until we find the root.
3543 (setq last-id (gnus-root-id id)
3544 headers (message-flatten-list (gnus-id-to-thread last-id)))
3545 ;; We have now found the real root of this thread. It might have
3546 ;; been gathered into some loose thread, so we have to search
3547 ;; through the threads to find the thread we wanted.
3548 (let ((threads gnus-newsgroup-threads)
3551 (setq sub (car threads))
3552 (if (stringp (car sub))
3553 ;; This is a gathered thread, so we look at the roots
3554 ;; below it to find whether this article is in this
3557 (setq sub (cdr sub))
3559 (when (member (caar sub) headers)
3560 (setq thread (car threads)
3563 (setq sub (cdr sub))))
3564 ;; It's an ordinary thread, so we check it.
3565 (when (eq (car sub) (car headers))
3568 (setq threads (cdr threads)))
3569 ;; If this article is in no thread, then it's a root.
3572 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3573 (setq thread (gnus-id-to-thread last-id)))
3576 thread ; We return this thread.
3578 (if (stringp (car thread))
3580 ;; If we use dummy roots, then we have to remove the
3581 ;; dummy root as well.
3582 (when (eq gnus-summary-make-false-root 'dummy)
3583 ;; We go to the dummy root by going to
3584 ;; the first sub-"thread", and then one line up.
3585 (gnus-summary-goto-article
3586 (mail-header-number (caadr thread)))
3589 (gnus-data-compute-positions))
3590 (setq thread (cdr thread))
3592 (gnus-remove-thread-1 (car thread))
3593 (setq thread (cdr thread))))
3594 (gnus-summary-show-all-threads)
3595 (gnus-remove-thread-1 thread))))))))
3597 (defun gnus-remove-thread-1 (thread)
3598 "Remove the thread THREAD recursively."
3599 (let ((number (mail-header-number (pop thread)))
3601 (setq thread (reverse thread))
3603 (gnus-remove-thread-1 (pop thread)))
3604 (when (setq d (gnus-data-find number))
3605 (goto-char (gnus-data-pos d))
3608 (- (gnus-point-at-bol)
3610 (1+ (gnus-point-at-eol))
3611 (gnus-delete-line)))))))
3613 (defun gnus-sort-threads (threads)
3615 (if (not gnus-thread-sort-functions)
3617 (gnus-message 8 "Sorting threads...")
3619 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3620 (gnus-message 8 "Sorting threads...done"))))
3622 (defun gnus-sort-articles (articles)
3624 (when gnus-article-sort-functions
3625 (gnus-message 7 "Sorting articles...")
3627 (setq gnus-newsgroup-headers
3628 (sort articles (gnus-make-sort-function
3629 gnus-article-sort-functions)))
3630 (gnus-message 7 "Sorting articles...done"))))
3632 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3633 (defmacro gnus-thread-header (thread)
3634 ;; Return header of first article in THREAD.
3635 ;; Note that THREAD must never, ever be anything else than a variable -
3636 ;; using some other form will lead to serious barfage.
3637 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3638 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3639 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3642 (defsubst gnus-article-sort-by-number (h1 h2)
3643 "Sort articles by article number."
3644 (< (mail-header-number h1)
3645 (mail-header-number h2)))
3647 (defun gnus-thread-sort-by-number (h1 h2)
3648 "Sort threads by root article number."
3649 (gnus-article-sort-by-number
3650 (gnus-thread-header h1) (gnus-thread-header h2)))
3652 (defsubst gnus-article-sort-by-lines (h1 h2)
3653 "Sort articles by article Lines header."
3654 (< (mail-header-lines h1)
3655 (mail-header-lines h2)))
3657 (defun gnus-thread-sort-by-lines (h1 h2)
3658 "Sort threads by root article Lines header."
3659 (gnus-article-sort-by-lines
3660 (gnus-thread-header h1) (gnus-thread-header h2)))
3662 (defsubst gnus-article-sort-by-chars (h1 h2)
3663 "Sort articles by octet length."
3664 (< (mail-header-chars h1)
3665 (mail-header-chars h2)))
3667 (defun gnus-thread-sort-by-chars (h1 h2)
3668 "Sort threads by root article octet length."
3669 (gnus-article-sort-by-chars
3670 (gnus-thread-header h1) (gnus-thread-header h2)))
3672 (defsubst gnus-article-sort-by-author (h1 h2)
3673 "Sort articles by root author."
3675 (let ((addr (car (mime-read-field 'From h1))))
3676 (or (std11-full-name-string addr)
3677 (std11-address-string addr)
3679 (let ((addr (car (mime-read-field 'From h2))))
3680 (or (std11-full-name-string addr)
3681 (std11-address-string addr)
3685 (defun gnus-thread-sort-by-author (h1 h2)
3686 "Sort threads by root author."
3687 (gnus-article-sort-by-author
3688 (gnus-thread-header h1) (gnus-thread-header h2)))
3690 (defsubst gnus-article-sort-by-subject (h1 h2)
3691 "Sort articles by root subject."
3693 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3694 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3696 (defun gnus-thread-sort-by-subject (h1 h2)
3697 "Sort threads by root subject."
3698 (gnus-article-sort-by-subject
3699 (gnus-thread-header h1) (gnus-thread-header h2)))
3701 (defsubst gnus-article-sort-by-date (h1 h2)
3702 "Sort articles by root article date."
3704 (gnus-date-get-time (mail-header-date h1))
3705 (gnus-date-get-time (mail-header-date h2))))
3707 (defun gnus-thread-sort-by-date (h1 h2)
3708 "Sort threads by root article date."
3709 (gnus-article-sort-by-date
3710 (gnus-thread-header h1) (gnus-thread-header h2)))
3712 (defsubst gnus-article-sort-by-score (h1 h2)
3713 "Sort articles by root article score.
3714 Unscored articles will be counted as having a score of zero."
3715 (> (or (cdr (assq (mail-header-number h1)
3716 gnus-newsgroup-scored))
3717 gnus-summary-default-score 0)
3718 (or (cdr (assq (mail-header-number h2)
3719 gnus-newsgroup-scored))
3720 gnus-summary-default-score 0)))
3722 (defun gnus-thread-sort-by-score (h1 h2)
3723 "Sort threads by root article score."
3724 (gnus-article-sort-by-score
3725 (gnus-thread-header h1) (gnus-thread-header h2)))
3727 (defun gnus-thread-sort-by-total-score (h1 h2)
3728 "Sort threads by the sum of all scores in the thread.
3729 Unscored articles will be counted as having a score of zero."
3730 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3732 (defun gnus-thread-total-score (thread)
3733 ;; This function find the total score of THREAD.
3734 (cond ((null thread)
3737 (if (stringp (car thread))
3738 (apply gnus-thread-score-function 0
3739 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3740 (gnus-thread-total-score-1 thread)))
3742 (gnus-thread-total-score-1 (list thread)))))
3744 (defun gnus-thread-total-score-1 (root)
3745 ;; This function find the total score of the thread below ROOT.
3746 (setq root (car root))
3747 (apply gnus-thread-score-function
3749 (mapcar 'gnus-thread-total-score
3750 (cdr (gnus-id-to-thread (mail-header-id root))))
3751 (when (> (mail-header-number root) 0)
3752 (list (or (cdr (assq (mail-header-number root)
3753 gnus-newsgroup-scored))
3754 gnus-summary-default-score 0))))
3755 (list gnus-summary-default-score)
3758 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3759 (defvar gnus-tmp-prev-subject nil)
3760 (defvar gnus-tmp-false-parent nil)
3761 (defvar gnus-tmp-root-expunged nil)
3762 (defvar gnus-tmp-dummy-line nil)
3764 (defvar gnus-tmp-header)
3765 (defun gnus-extra-header (type &optional header)
3766 "Return the extra header of TYPE."
3767 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3770 (defun gnus-summary-prepare-threads (threads)
3771 "Prepare summary buffer from THREADS and indentation LEVEL.
3772 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3773 or a straight list of headers."
3774 (gnus-message 7 "Generating summary...")
3776 (setq gnus-newsgroup-threads threads)
3779 (let ((gnus-tmp-level 0)
3780 (default-score (or gnus-summary-default-score 0))
3781 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3782 thread number subject stack state gnus-tmp-gathered beg-match
3783 new-roots gnus-tmp-new-adopts thread-end
3784 gnus-tmp-header gnus-tmp-unread
3785 gnus-tmp-replied gnus-tmp-subject-or-nil
3786 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3787 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3788 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3790 (setq gnus-tmp-prev-subject nil)
3792 (if (vectorp (car threads))
3793 ;; If this is a straight (sic) list of headers, then a
3794 ;; threaded summary display isn't required, so we just create
3795 ;; an unthreaded one.
3796 (gnus-summary-prepare-unthreaded threads)
3798 ;; Do the threaded display.
3800 (while (or threads stack gnus-tmp-new-adopts new-roots)
3802 (if (and (= gnus-tmp-level 0)
3805 (not gnus-tmp-false-parent)
3806 (or gnus-tmp-new-adopts new-roots))
3807 (if gnus-tmp-new-adopts
3808 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3809 thread (list (car gnus-tmp-new-adopts))
3810 gnus-tmp-header (caar thread)
3811 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3813 (setq thread (list (car new-roots))
3814 gnus-tmp-header (caar thread)
3815 new-roots (cdr new-roots))))
3818 ;; If there are some threads, we do them before the
3819 ;; threads on the stack.
3820 (setq thread threads
3821 gnus-tmp-header (caar thread))
3822 ;; There were no current threads, so we pop something off
3824 (setq state (car stack)
3825 gnus-tmp-level (car state)
3828 gnus-tmp-header (caar thread))))
3830 (setq gnus-tmp-false-parent nil)
3831 (setq gnus-tmp-root-expunged nil)
3832 (setq thread-end nil)
3834 (if (stringp gnus-tmp-header)
3835 ;; The header is a dummy root.
3837 ((eq gnus-summary-make-false-root 'adopt)
3838 ;; We let the first article adopt the rest.
3839 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3841 (setq gnus-tmp-gathered
3843 (lambda (h) (mail-header-number (car h)))
3846 (setq thread (cons (list (caar thread)
3849 (setq gnus-tmp-level -1
3850 gnus-tmp-false-parent t))
3851 ((eq gnus-summary-make-false-root 'empty)
3852 ;; We print adopted articles with empty subject fields.
3853 (setq gnus-tmp-gathered
3855 (lambda (h) (mail-header-number (car h)))
3858 (setq gnus-tmp-level -1))
3859 ((eq gnus-summary-make-false-root 'dummy)
3860 ;; We remember that we probably want to output a dummy
3862 (setq gnus-tmp-dummy-line gnus-tmp-header)
3863 (setq gnus-tmp-prev-subject gnus-tmp-header))
3865 ;; We do not make a root for the gathered
3866 ;; sub-threads at all.
3867 (setq gnus-tmp-level -1)))
3869 (setq number (mail-header-number gnus-tmp-header)
3870 subject (mail-header-subject gnus-tmp-header))
3873 ;; If the thread has changed subject, we might want to make
3874 ;; this subthread into a root.
3875 ((and (null gnus-thread-ignore-subject)
3876 (not (zerop gnus-tmp-level))
3877 gnus-tmp-prev-subject
3879 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3880 (setq new-roots (nconc new-roots (list (car thread)))
3882 gnus-tmp-header nil))
3883 ;; If the article lies outside the current limit,
3884 ;; then we do not display it.
3885 ((not (memq number gnus-newsgroup-limit))
3886 (setq gnus-tmp-gathered
3888 (lambda (h) (mail-header-number (car h)))
3891 (setq gnus-tmp-new-adopts (if (cdar thread)
3892 (append gnus-tmp-new-adopts
3894 gnus-tmp-new-adopts)
3896 gnus-tmp-header nil)
3897 (when (zerop gnus-tmp-level)
3898 (setq gnus-tmp-root-expunged t)))
3899 ;; Perhaps this article is to be marked as read?
3900 ((and gnus-summary-mark-below
3901 (< (or (cdr (assq number gnus-newsgroup-scored))
3903 gnus-summary-mark-below)
3904 ;; Don't touch sparse articles.
3905 (not (gnus-summary-article-sparse-p number))
3906 (not (gnus-summary-article-ancient-p number)))
3907 (setq gnus-newsgroup-unreads
3908 (delq number gnus-newsgroup-unreads))
3909 (if gnus-newsgroup-auto-expire
3910 (push number gnus-newsgroup-expirable)
3911 (push (cons number gnus-low-score-mark)
3912 gnus-newsgroup-reads))))
3914 (when gnus-tmp-header
3915 ;; We may have an old dummy line to output before this
3917 (when (and gnus-tmp-dummy-line
3920 (mail-header-subject gnus-tmp-header)))
3921 (gnus-summary-insert-dummy-line
3922 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3923 (setq gnus-tmp-dummy-line nil))
3925 ;; Compute the mark.
3926 (setq gnus-tmp-unread (gnus-article-mark number))
3928 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3929 gnus-tmp-header gnus-tmp-level)
3930 gnus-newsgroup-data)
3932 ;; Actually insert the line.
3934 gnus-tmp-subject-or-nil
3936 ((and gnus-thread-ignore-subject
3937 gnus-tmp-prev-subject
3938 (not (inline (gnus-subject-equal
3939 gnus-tmp-prev-subject subject))))
3941 ((zerop gnus-tmp-level)
3942 (if (and (eq gnus-summary-make-false-root 'empty)
3943 (memq number gnus-tmp-gathered)
3944 gnus-tmp-prev-subject
3945 (inline (gnus-subject-equal
3946 gnus-tmp-prev-subject subject)))
3947 gnus-summary-same-subject
3949 (t gnus-summary-same-subject)))
3950 (if (and (eq gnus-summary-make-false-root 'adopt)
3951 (= gnus-tmp-level 1)
3952 (memq number gnus-tmp-gathered))
3953 (setq gnus-tmp-opening-bracket ?\<
3954 gnus-tmp-closing-bracket ?\>)
3955 (setq gnus-tmp-opening-bracket ?\[
3956 gnus-tmp-closing-bracket ?\]))
3958 gnus-tmp-indentation
3959 (aref gnus-thread-indent-array gnus-tmp-level)
3960 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3961 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3962 gnus-summary-default-score 0)
3964 (if (or (null gnus-summary-default-score)
3965 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3966 gnus-summary-zcore-fuzz))
3968 (if (< gnus-tmp-score gnus-summary-default-score)
3969 gnus-score-below-mark gnus-score-over-mark))
3971 (cond ((memq number gnus-newsgroup-processable)
3973 ((memq number gnus-newsgroup-cached)
3975 ((memq number gnus-newsgroup-replied)
3977 ((memq number gnus-newsgroup-saved)
3979 (t gnus-unread-mark))
3980 gnus-tmp-from (mail-header-from gnus-tmp-header)
3983 ((string-match "<[^>]+> *$" gnus-tmp-from)
3984 (setq beg-match (match-beginning 0))
3985 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3986 (substring gnus-tmp-from (1+ (match-beginning 0))
3987 (1- (match-end 0))))
3988 (substring gnus-tmp-from 0 beg-match)))
3989 ((string-match "(.+)" gnus-tmp-from)
3990 (substring gnus-tmp-from
3991 (1+ (match-beginning 0)) (1- (match-end 0))))
3993 (when (string= gnus-tmp-name "")
3994 (setq gnus-tmp-name gnus-tmp-from))
3995 (unless (numberp gnus-tmp-lines)
3996 (setq gnus-tmp-lines 0))
3997 (gnus-put-text-property
3999 (progn (eval gnus-summary-line-format-spec) (point))
4000 'gnus-number number)
4003 (gnus-run-hooks 'gnus-summary-update-hook)
4006 (setq gnus-tmp-prev-subject subject)))
4008 (when (nth 1 thread)
4009 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4010 (incf gnus-tmp-level)
4011 (setq threads (if thread-end nil (cdar thread)))
4013 (setq gnus-tmp-level 0)))))
4014 (gnus-message 7 "Generating summary...done"))
4016 (defun gnus-summary-prepare-unthreaded (headers)
4017 "Generate an unthreaded summary buffer based on HEADERS."
4018 (let (header number mark)
4023 ;; We may have to root out some bad articles...
4024 (when (memq (setq number (mail-header-number
4025 (setq header (pop headers))))
4026 gnus-newsgroup-limit)
4027 ;; Mark article as read when it has a low score.
4028 (when (and gnus-summary-mark-below
4029 (< (or (cdr (assq number gnus-newsgroup-scored))
4030 gnus-summary-default-score 0)
4031 gnus-summary-mark-below)
4032 (not (gnus-summary-article-ancient-p number)))
4033 (setq gnus-newsgroup-unreads
4034 (delq number gnus-newsgroup-unreads))
4035 (if gnus-newsgroup-auto-expire
4036 (push number gnus-newsgroup-expirable)
4037 (push (cons number gnus-low-score-mark)
4038 gnus-newsgroup-reads)))
4040 (setq mark (gnus-article-mark number))
4041 (push (gnus-data-make number mark (1+ (point)) header 0)
4042 gnus-newsgroup-data)
4043 (gnus-summary-insert-line
4045 mark (memq number gnus-newsgroup-replied)
4046 (memq number gnus-newsgroup-expirable)
4047 (mail-header-subject header) nil
4048 (cdr (assq number gnus-newsgroup-scored))
4049 (memq number gnus-newsgroup-processable))))))
4051 (defun gnus-summary-remove-list-identifiers ()
4052 "Remove list identifiers in `gnus-list-identifiers' from articles in
4054 (let ((regexp (if (stringp gnus-list-identifiers)
4055 gnus-list-identifiers
4056 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4058 (dolist (header gnus-newsgroup-headers)
4059 (when (string-match (concat "\\(Re: +\\)?\\(" regexp " *\\)")
4060 (mail-header-subject header))
4061 (mail-header-set-subject
4062 header (concat (substring (mail-header-subject header)
4063 0 (match-beginning 2))
4064 (substring (mail-header-subject header)
4065 (match-end 2)))))))))
4067 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4068 "Select newsgroup GROUP.
4069 If READ-ALL is non-nil, all articles in the group are selected.
4070 If SELECT-ARTICLES, only select those articles from GROUP."
4071 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4072 ;;!!! Dirty hack; should be removed.
4073 (gnus-summary-ignore-duplicates
4074 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4076 gnus-summary-ignore-duplicates))
4077 (info (nth 2 entry))
4078 articles fetched-articles cached)
4080 (unless (gnus-check-server
4081 (setq gnus-current-select-method
4082 (gnus-find-method-for-group group)))
4083 (error "Couldn't open server"))
4085 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4086 (gnus-activate-group group) ; Or we can activate it...
4087 (progn ; Or we bug out.
4088 (when (equal major-mode 'gnus-summary-mode)
4089 (kill-buffer (current-buffer)))
4090 (error "Couldn't request group %s: %s"
4091 group (gnus-status-message group))))
4093 (unless (gnus-request-group group t)
4094 (when (equal major-mode 'gnus-summary-mode)
4095 (kill-buffer (current-buffer)))
4096 (error "Couldn't request group %s: %s"
4097 group (gnus-status-message group)))
4099 (setq gnus-newsgroup-name group)
4100 (setq gnus-newsgroup-unselected nil)
4101 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4102 (gnus-summary-setup-default-charset)
4104 ;; Adjust and set lists of article marks.
4106 (gnus-adjust-marked-articles info))
4108 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4110 (if (gnus-virtual-group-p group)
4111 gnus-newsgroup-cached
4112 (gnus-cache-articles-in-group group)))
4114 (setq gnus-newsgroup-unreads
4115 (gnus-set-difference
4116 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4117 gnus-newsgroup-dormant))
4119 (setq gnus-newsgroup-processable nil)
4121 (gnus-update-read-articles group gnus-newsgroup-unreads)
4123 (if (setq articles select-articles)
4124 (setq gnus-newsgroup-unselected
4125 (gnus-sorted-intersection
4126 gnus-newsgroup-unreads
4127 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4128 (setq articles (gnus-articles-to-read group read-all)))
4132 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4134 ((eq articles 0) nil)
4136 ;; Init the dependencies hash table.
4137 (setq gnus-newsgroup-dependencies
4138 (gnus-make-hashtable (length articles)))
4139 (gnus-set-global-variables)
4140 ;; Retrieve the headers and read them in.
4141 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4142 (setq gnus-newsgroup-headers
4143 (gnus-retrieve-parsed-headers
4144 articles gnus-newsgroup-name
4145 ;; We might want to fetch old headers, but
4146 ;; not if there is only 1 article.
4147 (and (or (and (not (eq gnus-fetch-old-headers 'some))
4148 (not (numberp gnus-fetch-old-headers)))
4149 (> (length articles) 1))
4150 gnus-fetch-old-headers)))
4151 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4153 ;; Suppress duplicates?
4154 (when gnus-suppress-duplicates
4155 (gnus-dup-suppress-articles))
4157 ;; Set the initial limit.
4158 (setq gnus-newsgroup-limit (copy-sequence articles))
4159 ;; Remove canceled articles from the list of unread articles.
4160 (setq gnus-newsgroup-unreads
4161 (gnus-set-sorted-intersection
4162 gnus-newsgroup-unreads
4163 (setq fetched-articles
4164 (mapcar (lambda (headers) (mail-header-number headers))
4165 gnus-newsgroup-headers))))
4166 ;; Removed marked articles that do not exist.
4167 (gnus-update-missing-marks
4168 (gnus-sorted-complement fetched-articles articles))
4170 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4172 (setq gnus-newsgroup-cached cached))
4174 ;; We might want to build some more threads first.
4175 (when (and gnus-fetch-old-headers
4176 (eq gnus-headers-retrieved-by 'nov))
4177 (if (eq gnus-fetch-old-headers 'invisible)
4178 (gnus-build-all-threads)
4179 (gnus-build-old-threads)))
4180 ;; Let the Gnus agent mark articles as read.
4182 (gnus-agent-get-undownloaded-list))
4183 ;; Remove list identifiers from subject
4184 (when gnus-list-identifiers
4185 (gnus-summary-remove-list-identifiers))
4186 ;; Check whether auto-expire is to be done in this group.
4187 (setq gnus-newsgroup-auto-expire
4188 (gnus-group-auto-expirable-p group))
4189 ;; Set up the article buffer now, if necessary.
4190 (unless gnus-single-article-buffer
4191 (gnus-article-setup-buffer))
4192 ;; First and last article in this newsgroup.
4193 (when gnus-newsgroup-headers
4194 (setq gnus-newsgroup-begin
4195 (mail-header-number (car gnus-newsgroup-headers))
4198 (gnus-last-element gnus-newsgroup-headers))))
4199 ;; GROUP is successfully selected.
4200 (or gnus-newsgroup-headers t)))))
4202 (defun gnus-articles-to-read (group &optional read-all)
4203 ;; Find out what articles the user wants to read.
4205 ;; Select all articles if `read-all' is non-nil, or if there
4206 ;; are no unread articles.
4208 (and (zerop (length gnus-newsgroup-marked))
4209 (zerop (length gnus-newsgroup-unreads)))
4210 (eq (gnus-group-find-parameter group 'display)
4213 (gnus-uncompress-range (gnus-active group))
4214 (gnus-cache-articles-in-group group))
4215 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4216 (copy-sequence gnus-newsgroup-unreads))
4218 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4219 (scored (length scored-list))
4220 (number (length articles))
4221 (marked (+ (length gnus-newsgroup-marked)
4222 (length gnus-newsgroup-dormant)))
4230 ((and (or (<= scored marked) (= scored number))
4231 (natnump gnus-large-newsgroup)
4232 (> number gnus-large-newsgroup))
4233 (let ((input (read-from-minibuffer
4235 "How many articles from %s (max %d): "
4236 (gnus-limit-string gnus-newsgroup-name 35)
4238 (static-if (< emacs-major-version 20)
4239 (number-to-string gnus-large-newsgroup)
4241 (number-to-string gnus-large-newsgroup)
4243 (if (string-match "^[ \t]*$" input)
4246 ((and (> scored marked) (< scored number)
4247 (> (- scored number) 20))
4250 (format "%s %s (%d scored, %d total): "
4251 "How many articles from"
4252 group scored number))))
4253 (if (string-match "^[ \t]*$" input)
4257 (setq select (if (stringp select) (string-to-number select) select))
4258 (if (or (null select) (zerop select))
4260 (if (and (not (zerop scored)) (<= (abs select) scored))
4262 (setq articles (sort scored-list '<))
4263 (setq number (length articles)))
4264 (setq articles (copy-sequence articles)))
4266 (when (< (abs select) number)
4268 ;; Select the N oldest articles.
4269 (setcdr (nthcdr (1- (abs select)) articles) nil)
4270 ;; Select the N most recent articles.
4271 (setq articles (nthcdr (- number select) articles))))
4272 (setq gnus-newsgroup-unselected
4273 (gnus-sorted-intersection
4274 gnus-newsgroup-unreads
4275 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4278 (defun gnus-killed-articles (killed articles)
4281 (when (inline (gnus-member-of-range (car articles) killed))
4282 (push (car articles) out))
4283 (setq articles (cdr articles)))
4286 (defun gnus-uncompress-marks (marks)
4287 "Uncompress the mark ranges in MARKS."
4288 (let ((uncompressed '(score bookmark))
4291 (if (memq (caar marks) uncompressed)
4292 (push (car marks) out)
4293 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4294 (setq marks (cdr marks)))
4297 (defun gnus-adjust-marked-articles (info)
4298 "Set all article lists and remove all marks that are no longer valid."
4299 (let* ((marked-lists (gnus-info-marks info))
4300 (active (gnus-active (gnus-info-group info)))
4303 (types gnus-article-mark-lists)
4304 (uncompressed '(score bookmark killed))
4305 marks var articles article mark)
4308 (setq marks (pop marked-lists))
4309 (set (setq var (intern (format "gnus-newsgroup-%s"
4310 (car (rassq (setq mark (car marks))
4312 (if (memq (car marks) uncompressed) (cdr marks)
4313 (gnus-uncompress-range (cdr marks))))
4315 (setq articles (symbol-value var))
4317 ;; All articles have to be subsets of the active articles.
4319 ;; Adjust "simple" lists.
4320 ((memq mark '(tick dormant expire reply save))
4322 (when (or (< (setq article (pop articles)) min) (> article max))
4323 (set var (delq article (symbol-value var))))))
4325 ((memq mark uncompressed)
4326 (when (not (listp (cdr (symbol-value var))))
4327 (set var (list (symbol-value var))))
4328 (when (not (listp (cdr articles)))
4329 (setq articles (list articles)))
4331 (when (or (not (consp (setq article (pop articles))))
4332 (< (car article) min)
4333 (> (car article) max))
4334 (set var (delq article (symbol-value var))))))))))
4336 (defun gnus-update-missing-marks (missing)
4337 "Go through the list of MISSING articles and remove them from the mark lists."
4339 (let ((types gnus-article-mark-lists)
4341 ;; Go through all types.
4343 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4344 (when (symbol-value var)
4345 ;; This list has articles. So we delete all missing articles
4349 (set var (delq (pop m) (symbol-value var)))))))))
4351 (defun gnus-update-marks ()
4352 "Enter the various lists of marked articles into the newsgroup info list."
4353 (let ((types gnus-article-mark-lists)
4354 (info (gnus-get-info gnus-newsgroup-name))
4355 (uncompressed '(score bookmark killed))
4356 type list newmarked symbol delta-marks)
4358 ;; Add all marks lists to the list of marks lists.
4359 (while (setq type (pop types))
4360 (setq list (symbol-value
4362 (intern (format "gnus-newsgroup-%s"
4366 ;; Get rid of the entries of the articles that have the
4368 (when (and (eq (cdr type) 'score)
4372 (prev (cons nil list))
4375 (if (or (not (consp (car arts)))
4376 (= (cdar arts) gnus-summary-default-score))
4377 (setcdr prev (cdr arts))
4379 (setq arts (cdr arts)))
4380 (setq list (cdr all)))))
4382 (or (memq (cdr type) uncompressed)
4383 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4385 (when (gnus-check-backend-function 'request-set-mark
4386 gnus-newsgroup-name)
4387 ;; uncompressed:s are not proper flags (they are cons cells)
4388 ;; cache is a internal gnus flag
4389 (unless (memq (cdr type) (cons 'cache uncompressed))
4390 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4391 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4392 (add (gnus-remove-from-range (gnus-copy-sequence list) old)))
4394 (push (list add 'add (list (cdr type))) delta-marks))
4396 (push (list del 'del (list (cdr type))) delta-marks)))))
4399 (push (cons (cdr type) list) newmarked)))
4402 (unless (gnus-check-group gnus-newsgroup-name)
4403 (error "Can't open server for %s" gnus-newsgroup-name))
4404 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4406 ;; Enter these new marks into the info of the group.
4408 (setcar (nthcdr 3 info) newmarked)
4409 ;; Add the marks lists to the end of the info.
4411 (setcdr (nthcdr 2 info) (list newmarked))))
4413 ;; Cut off the end of the info if there's nothing else there.
4417 (when (nthcdr (decf i) info)
4418 (setcdr (nthcdr i info) nil)))))))
4420 (defun gnus-set-mode-line (where)
4421 "This function sets the mode line of the article or summary buffers.
4422 If WHERE is `summary', the summary mode line format will be used."
4423 ;; Is this mode line one we keep updated?
4424 (when (and (memq where gnus-updated-mode-lines)
4426 (intern (format "gnus-%s-mode-line-format-spec" where))))
4429 ;; We evaluate this in the summary buffer since these
4430 ;; variables are buffer-local to that buffer.
4431 (set-buffer gnus-summary-buffer)
4432 ;; We bind all these variables that are used in the `eval' form
4434 (let* ((mformat (symbol-value
4436 (format "gnus-%s-mode-line-format-spec" where))))
4437 (gnus-tmp-group-name gnus-newsgroup-name)
4438 (gnus-tmp-article-number (or gnus-current-article 0))
4439 (gnus-tmp-unread gnus-newsgroup-unreads)
4440 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4441 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4442 (gnus-tmp-unread-and-unselected
4443 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4444 (zerop gnus-tmp-unselected))
4446 ((zerop gnus-tmp-unselected)
4447 (format "{%d more}" gnus-tmp-unread-and-unticked))
4448 (t (format "{%d(+%d) more}"
4449 gnus-tmp-unread-and-unticked
4450 gnus-tmp-unselected))))
4452 (if (and gnus-current-headers
4453 (vectorp gnus-current-headers))
4454 (gnus-mode-string-quote
4455 (mail-header-subject gnus-current-headers))
4457 bufname-length max-len
4458 gnus-tmp-header);; passed as argument to any user-format-funcs
4459 (setq mode-string (eval mformat))
4460 (setq bufname-length (if (string-match "%b" mode-string)
4463 (if (eq where 'summary)
4465 (get-buffer gnus-article-buffer))))
4468 (setq max-len (max 4 (if gnus-mode-non-string-length
4470 gnus-mode-non-string-length
4472 (length mode-string))))
4473 ;; We might have to chop a bit of the string off...
4474 (when (> (length mode-string) max-len)
4476 (concat (gnus-truncate-string mode-string (- max-len 3))
4478 ;; Pad the mode string a bit.
4479 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4480 ;; Update the mode line.
4481 (setq mode-line-buffer-identification
4482 (gnus-mode-line-buffer-identification (list mode-string)))
4483 (set-buffer-modified-p t))))
4485 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4486 "Go through the HEADERS list and add all Xrefs to a hash table.
4487 The resulting hash table is returned, or nil if no Xrefs were found."
4488 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4489 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4490 (xref-hashtb (gnus-make-hashtable))
4491 start group entry number xrefs header)
4493 (setq header (pop headers))
4494 (when (and (setq xrefs (mail-header-xref header))
4495 (not (memq (setq number (mail-header-number header))
4498 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4499 (setq start (match-end 0))
4500 (setq group (if prefix
4501 (concat prefix (substring xrefs (match-beginning 1)
4503 (substring xrefs (match-beginning 1) (match-end 1))))
4505 (string-to-int (substring xrefs (match-beginning 2)
4507 (if (setq entry (gnus-gethash group xref-hashtb))
4508 (setcdr entry (cons number (cdr entry)))
4509 (gnus-sethash group (cons number nil) xref-hashtb)))))
4510 (and start xref-hashtb)))
4512 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4513 "Look through all the headers and mark the Xrefs as read."
4514 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4515 name entry info xref-hashtb idlist method nth4)
4517 (set-buffer gnus-group-buffer)
4518 (when (setq xref-hashtb
4519 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4522 (unless (string= from-newsgroup (setq name (symbol-name group)))
4523 (setq idlist (symbol-value group))
4524 ;; Dead groups are not updated.
4526 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4528 (when (stringp (setq nth4 (gnus-info-method info)))
4529 (setq nth4 (gnus-server-to-method nth4))))
4530 ;; Only do the xrefs if the group has the same
4531 ;; select method as the group we have just read.
4532 (or (gnus-methods-equal-p
4533 nth4 (gnus-find-method-for-group from-newsgroup))
4535 (equal nth4 (setq method (gnus-find-method-for-group
4537 (and (equal (car nth4) (car method))
4538 (equal (nth 1 nth4) (nth 1 method))))
4539 gnus-use-cross-reference
4540 (or (not (eq gnus-use-cross-reference t))
4542 ;; Only do cross-references on subscribed
4543 ;; groups, if that is what is wanted.
4544 (<= (gnus-info-level info) gnus-level-subscribed))
4545 (gnus-group-make-articles-read name idlist))))
4548 (defun gnus-compute-read-articles (group articles)
4549 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4550 (info (nth 2 entry))
4551 (active (gnus-active group))
4554 ;; First peel off all invalid article numbers.
4556 (let ((ids articles)
4558 (while (setq id (pop ids))
4559 (when (and first (> id (cdr active)))
4560 ;; We'll end up in this situation in one particular
4561 ;; obscure situation. If you re-scan a group and get
4562 ;; a new article that is cross-posted to a different
4563 ;; group that has not been re-scanned, you might get
4564 ;; crossposted article that has a higher number than
4565 ;; Gnus believes possible. So we re-activate this
4566 ;; group as well. This might mean doing the
4567 ;; crossposting thingy will *increase* the number
4568 ;; of articles in some groups. Tsk, tsk.
4569 (setq active (or (gnus-activate-group group) active)))
4570 (when (or (> id (cdr active))
4571 (< id (car active)))
4572 (setq articles (delq id articles))))))
4573 ;; If the read list is nil, we init it.
4575 (null (gnus-info-read info))
4577 (setq ninfo (cons 1 (1- (car active))))
4578 (setq ninfo (gnus-info-read info)))
4579 ;; Then we add the read articles to the range.
4581 ninfo (setq articles (sort articles '<))))))
4583 (defun gnus-group-make-articles-read (group articles)
4584 "Update the info of GROUP to say that ARTICLES are read."
4586 (entry (gnus-gethash group gnus-newsrc-hashtb))
4587 (info (nth 2 entry))
4588 (active (gnus-active group))
4591 (setq range (gnus-compute-read-articles group articles))
4593 (set-buffer gnus-group-buffer)
4596 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4597 (gnus-info-set-read ',info ',(gnus-info-read info))
4598 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4599 (gnus-group-update-group ,group t))))
4600 ;; Add the read articles to the range.
4601 (gnus-info-set-read info range)
4602 ;; Then we have to re-compute how many unread
4603 ;; articles there are in this group.
4607 (setq num (- (1+ (cdr active)) (car active))))
4608 ((not (listp (cdr range)))
4609 (setq num (- (cdr active) (- (1+ (cdr range))
4613 (if (numberp (car range))
4615 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4616 (setq range (cdr range)))
4617 (setq num (- (cdr active) num))))
4618 ;; Update the number of unread articles.
4620 ;; Update the group buffer.
4621 (gnus-group-update-group group t)))))
4623 (defvar gnus-newsgroup-none-id 0)
4625 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4626 (let ((cur nntp-server-buffer)
4629 (save-excursion (set-buffer gnus-summary-buffer)
4630 gnus-newsgroup-dependencies)))
4632 (mail-parse-charset gnus-newsgroup-charset)
4633 (mail-parse-ignored-charsets
4634 (save-excursion (condition-case nil
4635 (set-buffer gnus-summary-buffer)
4637 gnus-newsgroup-ignored-charsets)))
4639 (set-buffer nntp-server-buffer)
4640 ;; Translate all TAB characters into SPACE characters.
4641 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4642 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4643 (gnus-run-hooks 'gnus-parse-headers-hook)
4644 (let ((case-fold-search t)
4645 in-reply-to header p lines chars ctype)
4646 (goto-char (point-min))
4647 ;; Search to the beginning of the next header. Error messages
4648 ;; do not begin with 2 or 3.
4649 (while (re-search-forward "^[23][0-9]+ " nil t)
4652 ;; This implementation of this function, with nine
4653 ;; search-forwards instead of the one re-search-forward and
4654 ;; a case (which basically was the old function) is actually
4655 ;; about twice as fast, even though it looks messier. You
4656 ;; can't have everything, I guess. Speed and elegance
4657 ;; doesn't always go hand in hand.
4660 (make-full-mail-header
4666 (narrow-to-region (point)
4667 (or (and (search-forward "\n.\n" nil t)
4673 (if (search-forward "\nsubject: " nil t)
4674 (buffer-substring (match-end 0) (std11-field-end))
4679 (if (search-forward "\nfrom: " nil t)
4680 (buffer-substring (match-end 0) (std11-field-end))
4685 (if (search-forward "\ndate: " nil t)
4686 (buffer-substring (match-end 0) (std11-field-end))
4691 (setq id (if (re-search-forward
4692 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4693 ;; We do it this way to make sure the Message-ID
4694 ;; is (somewhat) syntactically valid.
4695 (buffer-substring (match-beginning 1)
4697 ;; If there was no message-id, we just fake one
4698 ;; to make subsequent routines simpler.
4699 (nnheader-generate-fake-message-id))))
4703 (if (search-forward "\nreferences: " nil t)
4707 (buffer-substring (match-end 0) (std11-field-end))
4712 (search-backward ">" end t)
4715 (search-backward "<" end t)
4717 ;; Get the references from the in-reply-to header if there
4718 ;; were no references and the in-reply-to header looks
4720 (if (and (search-forward "\nin-reply-to: " nil t)
4722 (buffer-substring (match-end 0)
4724 (string-match "<[^>]+>" in-reply-to))
4726 (setq ref (substring in-reply-to (match-beginning 0)
4728 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4729 (setq ref2 (substring in-reply-to (match-beginning 0)
4731 (when (> (length ref2) (length ref))
4738 (if (search-forward "\nchars: " nil t)
4739 (if (numberp (setq chars (ignore-errors (read cur))))
4745 (if (search-forward "\nlines: " nil t)
4746 (if (numberp (setq lines (ignore-errors (read cur))))
4752 (and (search-forward "\nxref: " nil t)
4753 (buffer-substring (match-end 0) (std11-field-end))))
4755 (when gnus-extra-headers
4756 (let ((extra gnus-extra-headers)
4760 (when (search-forward
4761 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4762 (push (cons (car extra)
4763 (buffer-substring (match-end 0)
4769 (if (and (search-forward "\ncontent-type: " nil t)
4771 (buffer-substring (match-end 0) (std11-field-end))))
4772 (mime-entity-set-content-type-internal
4773 header (mime-parse-Content-Type ctype)))
4774 (when (equal id ref)
4777 (when gnus-alter-header-function
4778 (funcall gnus-alter-header-function header)
4779 (setq id (mail-header-id header)
4780 ref (gnus-parent-id (mail-header-references header))))
4783 (gnus-dependencies-add-header
4784 header dependencies force-new))
4785 (push header headers))
4786 (goto-char (point-max))
4788 (nreverse headers)))))
4790 ;; Goes through the xover lines and returns a list of vectors
4791 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4792 force-new dependencies
4793 group also-fetch-heads)
4794 "Parse the news overview data in the server buffer, and return a
4795 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4796 ;; Get the Xref when the users reads the articles since most/some
4797 ;; NNTP servers do not include Xrefs when using XOVER.
4798 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4799 (let ((mail-parse-charset gnus-newsgroup-charset)
4800 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4801 (cur nntp-server-buffer)
4802 (dependencies (or dependencies gnus-newsgroup-dependencies))
4803 number headers header)
4805 (set-buffer nntp-server-buffer)
4806 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4807 ;; Allow the user to mangle the headers before parsing them.
4808 (gnus-run-hooks 'gnus-parse-headers-hook)
4809 (goto-char (point-min))
4812 (while (and sequence (not (eobp)))
4813 (setq number (read cur))
4814 (while (and sequence
4815 (< (car sequence) number))
4816 (setq sequence (cdr sequence)))
4818 (eq number (car sequence))
4820 (setq sequence (cdr sequence))
4821 (setq header (inline
4822 (gnus-nov-parse-line
4823 number dependencies force-new))))
4824 (push header headers))
4827 (gnus-error 4 "Strange nov line (%d)"
4828 (count-lines (point-min) (point)))))
4830 ;; A common bug in inn is that if you have posted an article and
4831 ;; then retrieves the active file, it will answer correctly --
4832 ;; the new article is included. However, a NOV entry for the
4833 ;; article may not have been generated yet, so this may fail.
4834 ;; We work around this problem by retrieving the last few
4835 ;; headers using HEAD.
4836 (if (or (not also-fetch-heads)
4838 ;; We (probably) got all the headers.
4840 (let ((gnus-nov-is-evil t))
4843 (gnus-retrieve-parsed-headers sequence group)
4846 (defun gnus-article-get-xrefs ()
4847 "Fill in the Xref value in `gnus-current-headers', if necessary.
4848 This is meant to be called in `gnus-article-internal-prepare-hook'."
4849 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4850 gnus-current-headers)))
4851 (or (not gnus-use-cross-reference)
4853 (and (mail-header-xref headers)
4854 (not (string= (mail-header-xref headers) "")))
4855 (let ((case-fold-search t)
4858 (nnheader-narrow-to-headers)
4859 (goto-char (point-min))
4860 (when (or (and (eq (downcase (char-after)) ?x)
4861 (looking-at "Xref:"))
4862 (search-forward "\nXref:" nil t))
4863 (goto-char (1+ (match-end 0)))
4864 (setq xref (buffer-substring (point)
4865 (progn (end-of-line) (point))))
4866 (mail-header-set-xref headers xref)))))))
4868 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4869 "Find article ID and insert the summary line for that article.
4870 OLD-HEADER can either be a header or a line number to insert
4871 the subject line on."
4872 (let* ((line (and (numberp old-header) old-header))
4873 (old-header (and (vectorp old-header) old-header))
4874 (header (cond ((and old-header use-old-header)
4877 (gnus-number-to-header id))
4878 (gnus-number-to-header id))
4880 (gnus-read-header id))))
4881 (number (and (numberp id) id))
4884 ;; Rebuild the thread that this article is part of and go to the
4885 ;; article we have fetched.
4886 (when (and (not gnus-show-threads)
4889 (setq d (gnus-data-find (mail-header-number old-header))))
4890 (goto-char (gnus-data-pos d))
4893 (- (gnus-point-at-bol)
4895 (1+ (gnus-point-at-eol))
4896 (gnus-delete-line))))))
4898 (mail-header-set-number header (mail-header-number old-header)))
4899 (setq gnus-newsgroup-sparse
4900 (delq (setq number (mail-header-number header))
4901 gnus-newsgroup-sparse))
4902 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4903 (push number gnus-newsgroup-limit)
4904 (gnus-rebuild-thread (mail-header-id header) line)
4905 (gnus-summary-goto-subject number nil t))
4906 (when (and (numberp number)
4908 ;; We have to update the boundaries even if we can't fetch the
4909 ;; article if ID is a number -- so that the next `P' or `N'
4910 ;; command will fetch the previous (or next) article even
4911 ;; if the one we tried to fetch this time has been canceled.
4912 (when (> number gnus-newsgroup-end)
4913 (setq gnus-newsgroup-end number))
4914 (when (< number gnus-newsgroup-begin)
4915 (setq gnus-newsgroup-begin number))
4916 (setq gnus-newsgroup-unselected
4917 (delq number gnus-newsgroup-unselected)))
4918 ;; Report back a success?
4919 (and header (mail-header-number header))))
4921 ;;; Process/prefix in the summary buffer
4923 (defun gnus-summary-work-articles (n)
4924 "Return a list of articles to be worked upon.
4925 The prefix argument, the list of process marked articles, and the
4926 current article will be taken into consideration."
4928 (set-buffer gnus-summary-buffer)
4931 ;; A numerical prefix has been given.
4932 (setq n (prefix-numeric-value n))
4933 (let ((backward (< n 0))
4934 (n (abs (prefix-numeric-value n)))
4939 (push (setq article (gnus-summary-article-number))
4942 (gnus-summary-find-prev nil article)
4943 (gnus-summary-find-next nil article)))
4945 (nreverse articles)))
4946 ((and (gnus-region-active-p) (mark))
4947 (message "region active")
4948 ;; Work on the region between point and mark.
4949 (let ((max (max (point) (mark)))
4952 (goto-char (min (point) (mark)))
4955 (push (setq article (gnus-summary-article-number)) articles)
4956 (gnus-summary-find-next nil article)
4958 (nreverse articles))))
4959 (gnus-newsgroup-processable
4960 ;; There are process-marked articles present.
4961 ;; Save current state.
4962 (gnus-summary-save-process-mark)
4964 (reverse gnus-newsgroup-processable))
4966 ;; Just return the current article.
4967 (list (gnus-summary-article-number))))))
4969 (defmacro gnus-summary-iterate (arg &rest forms)
4970 "Iterate over the process/prefixed articles and do FORMS.
4971 ARG is the interactive prefix given to the command. FORMS will be
4972 executed with point over the summary line of the articles."
4973 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4974 `(let ((,articles (gnus-summary-work-articles ,arg)))
4976 (gnus-summary-goto-subject (car ,articles))
4980 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4981 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4983 (defun gnus-summary-save-process-mark ()
4984 "Push the current set of process marked articles on the stack."
4986 (push (copy-sequence gnus-newsgroup-processable)
4987 gnus-newsgroup-process-stack))
4989 (defun gnus-summary-kill-process-mark ()
4990 "Push the current set of process marked articles on the stack and unmark."
4992 (gnus-summary-save-process-mark)
4993 (gnus-summary-unmark-all-processable))
4995 (defun gnus-summary-yank-process-mark ()
4996 "Pop the last process mark state off the stack and restore it."
4998 (unless gnus-newsgroup-process-stack
4999 (error "Empty mark stack"))
5000 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5002 (defun gnus-summary-process-mark-set (set)
5003 "Make SET into the current process marked articles."
5004 (gnus-summary-unmark-all-processable)
5006 (gnus-summary-set-process-mark (pop set))))
5008 ;;; Searching and stuff
5010 (defun gnus-summary-search-group (&optional backward use-level)
5011 "Search for next unread newsgroup.
5012 If optional argument BACKWARD is non-nil, search backward instead."
5014 (set-buffer gnus-group-buffer)
5015 (when (gnus-group-search-forward
5016 backward nil (if use-level (gnus-group-group-level) nil))
5017 (gnus-group-group-name))))
5019 (defun gnus-summary-best-group (&optional exclude-group)
5020 "Find the name of the best unread group.
5021 If EXCLUDE-GROUP, do not go to this group."
5023 (set-buffer gnus-group-buffer)
5025 (gnus-group-best-unread-group exclude-group))))
5027 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5028 (if backward (gnus-summary-find-prev)
5029 (let* ((dummy (gnus-summary-article-intangible-p))
5030 (article (or article (gnus-summary-article-number)))
5031 (arts (gnus-data-find-list article))
5033 (when (and (not dummy)
5034 (or (not gnus-summary-check-current)
5036 (not (gnus-data-unread-p (car arts)))))
5037 (setq arts (cdr arts)))
5042 (when (or (and undownloaded
5043 (eq gnus-undownloaded-mark
5044 (gnus-data-mark (car arts))))
5045 (gnus-data-unread-p (car arts)))
5046 (setq result (car arts)
5048 (setq arts (cdr arts)))
5051 (goto-char (gnus-data-pos result))
5052 (gnus-data-number result)))))
5054 (defun gnus-summary-find-prev (&optional unread article)
5055 (let* ((eobp (eobp))
5056 (article (or article (gnus-summary-article-number)))
5057 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5059 (when (and (not eobp)
5060 (or (not gnus-summary-check-current)
5062 (not (gnus-data-unread-p (car arts)))))
5063 (setq arts (cdr arts)))
5068 (when (gnus-data-unread-p (car arts))
5069 (setq result (car arts)
5071 (setq arts (cdr arts)))
5074 (goto-char (gnus-data-pos result))
5075 (gnus-data-number result))))
5077 (defun gnus-summary-find-subject (subject &optional unread backward article)
5078 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5079 (article (or article (gnus-summary-article-number)))
5080 (articles (gnus-data-list backward))
5081 (arts (gnus-data-find-list article articles))
5083 (when (or (not gnus-summary-check-current)
5085 (not (gnus-data-unread-p (car arts))))
5086 (setq arts (cdr arts)))
5088 (and (or (not unread)
5089 (gnus-data-unread-p (car arts)))
5090 (vectorp (gnus-data-header (car arts)))
5092 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5093 (setq result (car arts)
5095 (setq arts (cdr arts)))
5097 (goto-char (gnus-data-pos result))
5098 (gnus-data-number result))))
5100 (defun gnus-summary-search-forward (&optional unread subject backward)
5101 "Search forward for an article.
5102 If UNREAD, look for unread articles. If SUBJECT, look for
5103 articles with that subject. If BACKWARD, search backward instead."
5104 (cond (subject (gnus-summary-find-subject subject unread backward))
5105 (backward (gnus-summary-find-prev unread))
5106 (t (gnus-summary-find-next unread))))
5108 (defun gnus-recenter (&optional n)
5109 "Center point in window and redisplay frame.
5110 Also do horizontal recentering."
5112 (when (and gnus-auto-center-summary
5113 (not (eq gnus-auto-center-summary 'vertical)))
5114 (gnus-horizontal-recenter))
5117 (defun gnus-summary-recenter ()
5118 "Center point in the summary window.
5119 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5120 displayed, no centering will be performed."
5121 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5122 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5123 (let* ((top (cond ((< (window-height) 4) 0)
5124 ((< (window-height) 7) 1)
5125 (t (if (numberp gnus-auto-center-summary)
5126 gnus-auto-center-summary
5128 (height (1- (window-height)))
5129 (bottom (save-excursion (goto-char (point-max))
5130 (forward-line (- height))
5132 (window (get-buffer-window (current-buffer))))
5133 ;; The user has to want it.
5134 (when gnus-auto-center-summary
5135 (when (get-buffer-window gnus-article-buffer)
5136 ;; Only do recentering when the article buffer is displayed,
5137 ;; Set the window start to either `bottom', which is the biggest
5138 ;; possible valid number, or the second line from the top,
5139 ;; whichever is the least.
5141 window (min bottom (save-excursion
5142 (forward-line (- top)) (point)))))
5143 ;; Do horizontal recentering while we're at it.
5144 (when (and (get-buffer-window (current-buffer) t)
5145 (not (eq gnus-auto-center-summary 'vertical)))
5146 (let ((selected (selected-window)))
5147 (select-window (get-buffer-window (current-buffer) t))
5148 (gnus-summary-position-point)
5149 (gnus-horizontal-recenter)
5150 (select-window selected))))))
5152 (defun gnus-summary-jump-to-group (newsgroup)
5153 "Move point to NEWSGROUP in group mode buffer."
5154 ;; Keep update point of group mode buffer if visible.
5155 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5156 (save-window-excursion
5157 ;; Take care of tree window mode.
5158 (when (get-buffer-window gnus-group-buffer)
5159 (pop-to-buffer gnus-group-buffer))
5160 (gnus-group-jump-to-group newsgroup))
5162 ;; Take care of tree window mode.
5163 (if (get-buffer-window gnus-group-buffer)
5164 (pop-to-buffer gnus-group-buffer)
5165 (set-buffer gnus-group-buffer))
5166 (gnus-group-jump-to-group newsgroup))))
5168 ;; This function returns a list of article numbers based on the
5169 ;; difference between the ranges of read articles in this group and
5170 ;; the range of active articles.
5171 (defun gnus-list-of-unread-articles (group)
5172 (let* ((read (gnus-info-read (gnus-get-info group)))
5173 (active (or (gnus-active group) (gnus-activate-group group)))
5176 ;; If none are read, then all are unread.
5178 (setq first (car active))
5179 ;; If the range of read articles is a single range, then the
5180 ;; first unread article is the article after the last read
5181 ;; article. Sounds logical, doesn't it?
5182 (if (not (listp (cdr read)))
5183 (setq first (max (car active) (1+ (cdr read))))
5184 ;; `read' is a list of ranges.
5185 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5188 (setq first (car active)))
5191 (while (< first nlast)
5193 (setq first (1+ first))))
5194 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5195 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5196 (setq read (cdr read)))))
5197 ;; And add the last unread articles.
5198 (while (<= first last)
5200 (setq first (1+ first)))
5201 ;; Return the list of unread articles.
5202 (delq 0 (nreverse unread))))
5204 (defun gnus-list-of-read-articles (group)
5205 "Return a list of unread, unticked and non-dormant articles."
5206 (let* ((info (gnus-get-info group))
5207 (marked (gnus-info-marks info))
5208 (active (gnus-active group)))
5210 (gnus-set-difference
5211 (gnus-sorted-complement
5212 (gnus-uncompress-range active)
5213 (gnus-list-of-unread-articles group))
5215 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5216 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5218 ;; Various summary commands
5220 (defun gnus-summary-select-article-buffer ()
5221 "Reconfigure windows to show article buffer."
5223 (if (not (gnus-buffer-live-p gnus-article-buffer))
5224 (error "There is no article buffer for this summary buffer")
5225 (gnus-configure-windows 'article)
5226 (select-window (get-buffer-window gnus-article-buffer))))
5228 (defun gnus-summary-universal-argument (arg)
5229 "Perform any operation on all articles that are process/prefixed."
5231 (let ((articles (gnus-summary-work-articles arg))
5238 (substitute-command-keys
5239 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5242 (gnus-error 1 "Undefined key")
5245 (gnus-summary-goto-subject (setq article (pop articles)))
5246 (let (gnus-newsgroup-processable)
5247 (command-execute func))
5248 (gnus-summary-remove-process-mark article)))))
5249 (gnus-summary-position-point))
5251 (defun gnus-summary-toggle-truncation (&optional arg)
5252 "Toggle truncation of summary lines.
5253 With arg, turn line truncation on iff arg is positive."
5255 (setq truncate-lines
5256 (if (null arg) (not truncate-lines)
5257 (> (prefix-numeric-value arg) 0)))
5260 (defun gnus-summary-reselect-current-group (&optional all rescan)
5261 "Rescan the current newsgroup, exit and then reselect it.
5262 The prefix argument ALL means to select all articles."
5264 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5265 (error "Ephemeral groups can't be reselected"))
5266 (let ((current-subject (gnus-summary-article-number))
5267 (group gnus-newsgroup-name))
5269 (set-buffer gnus-group-buffer)
5270 ;; We have to adjust the point of group mode buffer because
5271 ;; point was moved to the next unread newsgroup by exiting.
5272 (gnus-summary-jump-to-group group)
5275 (gnus-group-get-new-news-this-group 1))))
5276 (setq gnus-newsgroup-begin nil)
5278 (gnus-group-read-group all t group)
5279 (gnus-summary-goto-subject current-subject nil t)))
5281 (defun gnus-summary-rescan-group (&optional all)
5282 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5284 (gnus-summary-reselect-current-group all t))
5286 (defun gnus-summary-update-info (&optional non-destructive)
5288 (let ((group gnus-newsgroup-name))
5290 (when gnus-newsgroup-kill-headers
5291 (setq gnus-newsgroup-killed
5292 (gnus-compress-sequence
5294 (gnus-set-sorted-intersection
5295 (gnus-uncompress-range gnus-newsgroup-killed)
5296 (setq gnus-newsgroup-unselected
5297 (sort gnus-newsgroup-unselected '<)))
5298 (setq gnus-newsgroup-unreads
5299 (sort gnus-newsgroup-unreads '<)))
5301 (unless (listp (cdr gnus-newsgroup-killed))
5302 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5303 (let ((headers gnus-newsgroup-headers))
5304 ;; Set the new ranges of read articles.
5306 (set-buffer gnus-group-buffer)
5307 (gnus-undo-force-boundary))
5308 (gnus-update-read-articles
5309 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5310 ;; Set the current article marks.
5311 (let ((gnus-newsgroup-scored
5312 (if (and (not gnus-save-score)
5313 (not non-destructive))
5315 gnus-newsgroup-scored)))
5317 (gnus-update-marks)))
5318 ;; Do the cross-ref thing.
5319 (when gnus-use-cross-reference
5320 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5321 ;; Do not switch windows but change the buffer to work.
5322 (set-buffer gnus-group-buffer)
5323 (unless (gnus-ephemeral-group-p group)
5324 (gnus-group-update-group group)))))))
5326 (defun gnus-summary-save-newsrc (&optional force)
5327 "Save the current number of read/marked articles in the dribble buffer.
5328 The dribble buffer will then be saved.
5329 If FORCE (the prefix), also save the .newsrc file(s)."
5331 (gnus-summary-update-info t)
5333 (gnus-save-newsrc-file)
5334 (gnus-dribble-save)))
5336 (defun gnus-summary-exit (&optional temporary)
5337 "Exit reading current newsgroup, and then return to group selection mode.
5338 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5340 (gnus-set-global-variables)
5341 (gnus-kill-save-kill-buffer)
5342 (gnus-async-halt-prefetch)
5343 (let* ((group gnus-newsgroup-name)
5344 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5347 (buf (current-buffer)))
5349 ;; Do adaptive scoring, and possibly save score files.
5350 (when gnus-newsgroup-adaptive
5351 (gnus-score-adaptive))
5352 (when gnus-use-scoring
5354 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5355 ;; If we have several article buffers, we kill them at exit.
5356 (unless gnus-single-article-buffer
5357 (gnus-kill-buffer gnus-original-article-buffer)
5358 (setq gnus-article-current nil))
5359 (when gnus-use-cache
5360 (gnus-cache-possibly-remove-articles)
5361 (gnus-cache-save-buffers))
5362 (gnus-async-prefetch-remove-group group)
5363 (when gnus-suppress-duplicates
5364 (gnus-dup-enter-articles))
5365 (when gnus-use-trees
5366 (gnus-tree-close group))
5367 ;; Remove entries for this group.
5368 (nnmail-purge-split-history (gnus-group-real-name group))
5369 ;; Make all changes in this group permanent.
5371 (gnus-run-hooks 'gnus-exit-group-hook)
5372 (gnus-summary-update-info))
5373 (gnus-close-group group)
5374 ;; Make sure where we were, and go to next newsgroup.
5375 (set-buffer gnus-group-buffer)
5377 (gnus-group-jump-to-group group))
5378 (gnus-run-hooks 'gnus-summary-exit-hook)
5379 (unless (or quit-config
5380 ;; If this group has disappeared from the summary
5381 ;; buffer, don't skip forwards.
5382 (not (string= group (gnus-group-group-name))))
5383 (gnus-group-next-unread-group 1))
5384 (setq group-point (point))
5387 ;; If we have several article buffers, we kill them at exit.
5388 (unless gnus-single-article-buffer
5389 (gnus-kill-buffer gnus-article-buffer)
5390 (gnus-kill-buffer gnus-original-article-buffer)
5391 (setq gnus-article-current nil))
5393 (if (not gnus-kill-summary-on-exit)
5394 (gnus-deaden-summary)
5395 ;; We set all buffer-local variables to nil. It is unclear why
5396 ;; this is needed, but if we don't, buffer-local variables are
5397 ;; not garbage-collected, it seems. This would the lead to en
5398 ;; ever-growing Emacs.
5399 (gnus-summary-clear-local-variables)
5400 (when (get-buffer gnus-article-buffer)
5401 (bury-buffer gnus-article-buffer))
5402 ;; We clear the global counterparts of the buffer-local
5403 ;; variables as well, just to be on the safe side.
5404 (set-buffer gnus-group-buffer)
5405 (gnus-summary-clear-local-variables)
5406 ;; Return to group mode buffer.
5407 (when (eq mode 'gnus-summary-mode)
5408 (gnus-kill-buffer buf)))
5409 (setq gnus-current-select-method gnus-select-method)
5410 (pop-to-buffer gnus-group-buffer)
5411 (if (not quit-config)
5413 (goto-char group-point)
5414 (gnus-configure-windows 'group 'force))
5415 (gnus-handle-ephemeral-exit quit-config))
5416 ;; Clear the current group name.
5418 (setq gnus-newsgroup-name nil)))))
5420 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5421 (defun gnus-summary-exit-no-update (&optional no-questions)
5422 "Quit reading current newsgroup without updating read article info."
5424 (let* ((group gnus-newsgroup-name)
5425 (quit-config (gnus-group-quit-config group)))
5426 (when (or no-questions
5428 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5429 (gnus-async-halt-prefetch)
5431 (delq 'gnus-summary-expire-articles
5432 (copy-list gnus-summary-prepare-exit-hook)))
5433 ;; If we have several article buffers, we kill them at exit.
5434 (unless gnus-single-article-buffer
5435 (gnus-kill-buffer gnus-article-buffer)
5436 (gnus-kill-buffer gnus-original-article-buffer)
5437 (setq gnus-article-current nil))
5438 (if (not gnus-kill-summary-on-exit)
5439 (gnus-deaden-summary)
5440 (gnus-close-group group)
5441 (gnus-summary-clear-local-variables)
5442 (set-buffer gnus-group-buffer)
5443 (gnus-summary-clear-local-variables)
5444 (when (get-buffer gnus-summary-buffer)
5445 (kill-buffer gnus-summary-buffer)))
5446 (unless gnus-single-article-buffer
5447 (setq gnus-article-current nil))
5448 (when gnus-use-trees
5449 (gnus-tree-close group))
5450 (gnus-async-prefetch-remove-group group)
5451 (when (get-buffer gnus-article-buffer)
5452 (bury-buffer gnus-article-buffer))
5453 ;; Return to the group buffer.
5454 (gnus-configure-windows 'group 'force)
5455 ;; Clear the current group name.
5456 (setq gnus-newsgroup-name nil)
5457 (when (equal (gnus-group-group-name) group)
5458 (gnus-group-next-unread-group 1))
5460 (gnus-handle-ephemeral-exit quit-config)))))
5462 (defun gnus-handle-ephemeral-exit (quit-config)
5463 "Handle movement when leaving an ephemeral group.
5464 The state which existed when entering the ephemeral is reset."
5465 (if (not (buffer-name (car quit-config)))
5466 (gnus-configure-windows 'group 'force)
5467 (set-buffer (car quit-config))
5468 (cond ((eq major-mode 'gnus-summary-mode)
5469 (gnus-set-global-variables))
5470 ((eq major-mode 'gnus-article-mode)
5472 ;; The `gnus-summary-buffer' variable may point
5473 ;; to the old summary buffer when using a single
5475 (unless (gnus-buffer-live-p gnus-summary-buffer)
5476 (set-buffer gnus-group-buffer))
5477 (set-buffer gnus-summary-buffer)
5478 (gnus-set-global-variables))))
5479 (if (or (eq (cdr quit-config) 'article)
5480 (eq (cdr quit-config) 'pick))
5482 ;; The current article may be from the ephemeral group
5483 ;; thus it is best that we reload this article
5484 (gnus-summary-show-article)
5485 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5486 (gnus-configure-windows 'pick 'force)
5487 (gnus-configure-windows (cdr quit-config) 'force)))
5488 (gnus-configure-windows (cdr quit-config) 'force))
5489 (when (eq major-mode 'gnus-summary-mode)
5490 (gnus-summary-next-subject 1 nil t)
5491 (gnus-summary-recenter)
5492 (gnus-summary-position-point))))
5494 (defun gnus-summary-preview-mime-message ()
5495 "MIME decode and play this message."
5497 (let ((gnus-break-pages nil)
5499 (gnus-summary-select-article gnus-show-all-headers t))
5500 (select-window (get-buffer-window gnus-article-buffer)))
5504 (defvar gnus-dead-summary-mode-map nil)
5506 (unless gnus-dead-summary-mode-map
5507 (setq gnus-dead-summary-mode-map (make-keymap))
5508 (suppress-keymap gnus-dead-summary-mode-map)
5509 (substitute-key-definition
5510 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5511 (let ((keys '("\C-d" "\r" "\177" [delete])))
5513 (define-key gnus-dead-summary-mode-map
5514 (pop keys) 'gnus-summary-wake-up-the-dead))))
5516 (defvar gnus-dead-summary-mode nil
5517 "Minor mode for Gnus summary buffers.")
5519 (defun gnus-dead-summary-mode (&optional arg)
5520 "Minor mode for Gnus summary buffers."
5522 (when (eq major-mode 'gnus-summary-mode)
5523 (make-local-variable 'gnus-dead-summary-mode)
5524 (setq gnus-dead-summary-mode
5525 (if (null arg) (not gnus-dead-summary-mode)
5526 (> (prefix-numeric-value arg) 0)))
5527 (when gnus-dead-summary-mode
5528 (gnus-add-minor-mode
5529 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5531 (defun gnus-deaden-summary ()
5532 "Make the current summary buffer into a dead summary buffer."
5533 ;; Kill any previous dead summary buffer.
5534 (when (and gnus-dead-summary
5535 (buffer-name gnus-dead-summary))
5537 (set-buffer gnus-dead-summary)
5538 (when gnus-dead-summary-mode
5539 (kill-buffer (current-buffer)))))
5540 ;; Make this the current dead summary.
5541 (setq gnus-dead-summary (current-buffer))
5542 (gnus-dead-summary-mode 1)
5543 (let ((name (buffer-name)))
5544 (when (string-match "Summary" name)
5546 (concat (substring name 0 (match-beginning 0)) "Dead "
5547 (substring name (match-beginning 0)))
5550 (defun gnus-kill-or-deaden-summary (buffer)
5551 "Kill or deaden the summary BUFFER."
5553 (when (and (buffer-name buffer)
5554 (not gnus-single-article-buffer))
5557 (gnus-kill-buffer gnus-article-buffer)
5558 (gnus-kill-buffer gnus-original-article-buffer)))
5559 (cond (gnus-kill-summary-on-exit
5560 (when (and gnus-use-trees
5561 (gnus-buffer-exists-p buffer))
5564 (gnus-tree-close gnus-newsgroup-name)))
5565 (gnus-kill-buffer buffer))
5566 ((gnus-buffer-exists-p buffer)
5569 (gnus-deaden-summary))))))
5571 (defun gnus-summary-wake-up-the-dead (&rest args)
5572 "Wake up the dead summary buffer."
5574 (gnus-dead-summary-mode -1)
5575 (let ((name (buffer-name)))
5576 (when (string-match "Dead " name)
5578 (concat (substring name 0 (match-beginning 0))
5579 (substring name (match-end 0)))
5581 (gnus-message 3 "This dead summary is now alive again"))
5583 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5584 (defun gnus-summary-fetch-faq (&optional faq-dir)
5585 "Fetch the FAQ for the current group.
5586 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5590 (when current-prefix-arg
5592 "Faq dir: " (and (listp gnus-group-faq-directory)
5593 (mapcar (lambda (file) (list file))
5594 gnus-group-faq-directory))))))
5595 (let (gnus-faq-buffer)
5596 (when (setq gnus-faq-buffer
5597 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5598 (gnus-configure-windows 'summary-faq))))
5600 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5601 (defun gnus-summary-describe-group (&optional force)
5602 "Describe the current newsgroup."
5604 (gnus-group-describe-group force gnus-newsgroup-name))
5606 (defun gnus-summary-describe-briefly ()
5607 "Describe summary mode commands briefly."
5609 (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")))
5611 ;; Walking around group mode buffer from summary mode.
5613 (defun gnus-summary-next-group (&optional no-article target-group backward)
5614 "Exit current newsgroup and then select next unread newsgroup.
5615 If prefix argument NO-ARTICLE is non-nil, no article is selected
5616 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5617 previous group instead."
5619 ;; Stop pre-fetching.
5620 (gnus-async-halt-prefetch)
5621 (let ((current-group gnus-newsgroup-name)
5622 (current-buffer (current-buffer))
5624 ;; First we semi-exit this group to update Xrefs and all variables.
5625 ;; We can't do a real exit, because the window conf must remain
5626 ;; the same in case the user is prompted for info, and we don't
5627 ;; want the window conf to change before that...
5628 (gnus-summary-exit t)
5629 (while (not entered)
5630 ;; Then we find what group we are supposed to enter.
5631 (set-buffer gnus-group-buffer)
5632 (gnus-group-jump-to-group current-group)
5635 (if (eq gnus-keep-same-level 'best)
5636 (gnus-summary-best-group gnus-newsgroup-name)
5637 (gnus-summary-search-group backward gnus-keep-same-level))))
5638 (if (not target-group)
5639 ;; There are no further groups, so we return to the group
5642 (gnus-message 5 "Returning to the group buffer")
5644 (when (gnus-buffer-live-p current-buffer)
5645 (set-buffer current-buffer)
5646 (gnus-summary-exit))
5647 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5648 ;; We try to enter the target group.
5649 (gnus-group-jump-to-group target-group)
5650 (let ((unreads (gnus-group-group-unread)))
5651 (if (and (or (eq t unreads)
5652 (and unreads (not (zerop unreads))))
5653 (gnus-summary-read-group
5654 target-group nil no-article
5655 (and (buffer-name current-buffer) current-buffer)
5658 (setq current-group target-group
5659 target-group nil)))))))
5661 (defun gnus-summary-prev-group (&optional no-article)
5662 "Exit current newsgroup and then select previous unread newsgroup.
5663 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5665 (gnus-summary-next-group no-article nil t))
5667 ;; Walking around summary lines.
5669 (defun gnus-summary-first-subject (&optional unread undownloaded)
5670 "Go to the first unread subject.
5671 If UNREAD is non-nil, go to the first unread article.
5672 Returns the article selected or nil if there are no unread articles."
5677 ((null gnus-newsgroup-data)
5678 (gnus-message 3 "No articles in the group")
5680 ;; Pick the first article.
5682 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5683 (gnus-data-number (car gnus-newsgroup-data)))
5684 ;; No unread articles.
5685 ((null gnus-newsgroup-unreads)
5686 (gnus-message 3 "No more unread articles")
5688 ;; Find the first unread article.
5690 (let ((data gnus-newsgroup-data))
5692 (and (not (and undownloaded
5693 (eq gnus-undownloaded-mark
5694 (gnus-data-mark (car data)))))
5695 (not (gnus-data-unread-p (car data)))))
5696 (setq data (cdr data)))
5698 (goto-char (gnus-data-pos (car data)))
5699 (gnus-data-number (car data))))))
5700 (gnus-summary-position-point)))
5702 (defun gnus-summary-next-subject (n &optional unread dont-display)
5703 "Go to next N'th summary line.
5704 If N is negative, go to the previous N'th subject line.
5705 If UNREAD is non-nil, only unread articles are selected.
5706 The difference between N and the actual number of steps taken is
5709 (let ((backward (< n 0))
5713 (gnus-summary-find-prev unread)
5714 (gnus-summary-find-next unread)))
5715 (gnus-summary-show-thread)
5718 (gnus-message 7 "No more%s articles"
5719 (if unread " unread" "")))
5720 (unless dont-display
5721 (gnus-summary-recenter)
5722 (gnus-summary-position-point))
5725 (defun gnus-summary-next-unread-subject (n)
5726 "Go to next N'th unread summary line."
5728 (gnus-summary-next-subject n t))
5730 (defun gnus-summary-prev-subject (n &optional unread)
5731 "Go to previous N'th summary line.
5732 If optional argument UNREAD is non-nil, only unread article is selected."
5734 (gnus-summary-next-subject (- n) unread))
5736 (defun gnus-summary-prev-unread-subject (n)
5737 "Go to previous N'th unread summary line."
5739 (gnus-summary-next-subject (- n) t))
5741 (defun gnus-summary-goto-subject (article &optional force silent)
5742 "Go the subject line of ARTICLE.
5743 If FORCE, also allow jumping to articles not currently shown."
5744 (interactive "nArticle number: ")
5746 (data (gnus-data-find article)))
5747 ;; We read in the article if we have to.
5750 (gnus-summary-insert-subject
5752 (if (or (numberp force) (vectorp force)) force)
5754 (setq data (gnus-data-find article)))
5759 (gnus-message 3 "Can't find article %d" article))
5761 (goto-char (gnus-data-pos data))
5762 (gnus-summary-position-point)
5765 ;; Walking around summary lines with displaying articles.
5767 (defun gnus-summary-expand-window (&optional arg)
5768 "Make the summary buffer take up the entire Emacs frame.
5769 Given a prefix, will force an `article' buffer configuration."
5772 (gnus-configure-windows 'article 'force)
5773 (gnus-configure-windows 'summary 'force)))
5775 (defun gnus-summary-display-article (article &optional all-header)
5776 "Display ARTICLE in article buffer."
5777 (gnus-set-global-variables)
5781 (if gnus-summary-display-article-function
5782 (funcall gnus-summary-display-article-function article all-header)
5783 (gnus-article-prepare article all-header))
5784 (with-current-buffer gnus-article-buffer
5785 (set (make-local-variable 'gnus-summary-search-article-matched-data)
5787 (gnus-run-hooks 'gnus-select-article-hook)
5788 (when (and gnus-current-article
5789 (not (zerop gnus-current-article)))
5790 (gnus-summary-goto-subject gnus-current-article))
5791 (gnus-summary-recenter)
5792 (when (and gnus-use-trees gnus-show-threads)
5793 (gnus-possibly-generate-tree article)
5794 (gnus-highlight-selected-tree article))
5795 ;; Successfully display article.
5796 (gnus-article-set-window-start
5797 (cdr (assq article gnus-newsgroup-bookmarks))))))
5799 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5800 "Select the current article.
5801 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5802 non-nil, the article will be re-fetched even if it already present in
5803 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5805 ;; Make sure we are in the summary buffer to work around bbdb bug.
5806 (unless (eq major-mode 'gnus-summary-mode)
5807 (set-buffer gnus-summary-buffer))
5808 (let ((article (or article (gnus-summary-article-number)))
5809 (all-headers (not (not all-headers))) ;Must be T or NIL.
5810 gnus-summary-display-article-function
5813 (gnus-summary-article-pseudo-p article)
5814 (error "This is a pseudo-article"))
5817 (set-buffer gnus-summary-buffer)
5818 (if (or (and gnus-single-article-buffer
5819 (or (null gnus-current-article)
5820 (null gnus-article-current)
5821 (null (get-buffer gnus-article-buffer))
5822 (not (eq article (cdr gnus-article-current)))
5823 (not (equal (car gnus-article-current)
5824 gnus-newsgroup-name))))
5825 (and (not gnus-single-article-buffer)
5826 (or (null gnus-current-article)
5827 (not (eq gnus-current-article article))))
5829 ;; The requested article is different from the current article.
5831 (gnus-summary-display-article article all-headers)
5833 (when (or all-headers gnus-show-all-headers)
5834 (gnus-article-show-all-headers)))
5835 (when (or all-headers gnus-show-all-headers)
5836 (gnus-article-show-all-headers))
5839 (gnus-article-set-window-start
5840 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5842 (defun gnus-summary-set-current-mark (&optional current-mark)
5843 "Obsolete function."
5846 (defun gnus-summary-next-article (&optional unread subject backward push)
5847 "Select the next article.
5848 If UNREAD, only unread articles are selected.
5849 If SUBJECT, only articles with SUBJECT are selected.
5850 If BACKWARD, the previous article is selected instead of the next."
5853 ;; Is there such an article?
5854 ((and (gnus-summary-search-forward unread subject backward)
5855 (or (gnus-summary-display-article (gnus-summary-article-number))
5856 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5857 (gnus-summary-position-point))
5858 ;; If not, we try the first unread, if that is wanted.
5860 gnus-auto-select-same
5861 (gnus-summary-first-unread-article))
5862 (gnus-summary-position-point)
5863 (gnus-message 6 "Wrapped"))
5864 ;; Try to get next/previous article not displayed in this group.
5865 ((and gnus-auto-extend-newsgroup
5866 (not unread) (not subject))
5867 (gnus-summary-goto-article
5868 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5869 nil (count-lines (point-min) (point))))
5870 ;; Go to next/previous group.
5872 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5873 (gnus-summary-jump-to-group gnus-newsgroup-name))
5874 (let ((cmd last-command-char)
5877 (set-buffer gnus-group-buffer)
5880 (if (eq gnus-keep-same-level 'best)
5881 (gnus-summary-best-group gnus-newsgroup-name)
5882 (gnus-summary-search-group backward gnus-keep-same-level))))
5883 ;; For some reason, the group window gets selected. We change
5885 (select-window (get-buffer-window (current-buffer)))
5886 ;; Select next unread newsgroup automagically.
5888 ((or (not gnus-auto-select-next)
5890 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5891 ((or (eq gnus-auto-select-next 'quietly)
5892 (and (eq gnus-auto-select-next 'slightly-quietly)
5894 (and (eq gnus-auto-select-next 'almost-quietly)
5895 (gnus-summary-last-article-p)))
5897 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5899 (gnus-message 7 "No more%s articles (%s)..."
5900 (if unread " unread" "")
5901 (if group (concat "selecting " group)
5903 (gnus-summary-next-group nil group backward)))
5905 (when (gnus-key-press-event-p last-input-event)
5906 (gnus-summary-walk-group-buffer
5907 gnus-newsgroup-name cmd unread backward point))))))))
5909 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5910 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5911 (?\C-p (gnus-group-prev-unread-group 1))))
5912 (cursor-in-echo-area t)
5913 keve key group ended)
5915 (set-buffer gnus-group-buffer)
5918 (if (eq gnus-keep-same-level 'best)
5919 (gnus-summary-best-group gnus-newsgroup-name)
5920 (gnus-summary-search-group backward gnus-keep-same-level))))
5923 5 "No more%s articles%s" (if unread " unread" "")
5925 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5926 (format " (Type %s for %s [%s])"
5927 (single-key-description cmd) group
5928 (car (gnus-gethash group gnus-newsrc-hashtb)))
5929 (format " (Type %s to exit %s)"
5930 (single-key-description cmd)
5931 gnus-newsgroup-name)))
5932 ;; Confirm auto selection.
5933 (setq key (car (setq keve (gnus-read-event-char))))
5936 ((assq key keystrokes)
5937 (let ((obuf (current-buffer)))
5938 (switch-to-buffer gnus-group-buffer)
5940 (gnus-group-jump-to-group group))
5941 (eval (cadr (assq key keystrokes)))
5942 (setq group (gnus-group-group-name))
5943 (switch-to-buffer obuf))
5947 (gnus-ephemeral-group-p gnus-newsgroup-name))
5949 (gnus-summary-next-group nil group backward)))
5951 (push (cdr keve) unread-command-events))))))
5953 (defun gnus-summary-next-unread-article ()
5954 "Select unread article after current one."
5956 (gnus-summary-next-article
5957 (or (not (eq gnus-summary-goto-unread 'never))
5958 (gnus-summary-last-article-p (gnus-summary-article-number)))
5959 (and gnus-auto-select-same
5960 (gnus-summary-article-subject))))
5962 (defun gnus-summary-prev-article (&optional unread subject)
5963 "Select the article after the current one.
5964 If UNREAD is non-nil, only unread articles are selected."
5966 (gnus-summary-next-article unread subject t))
5968 (defun gnus-summary-prev-unread-article ()
5969 "Select unread article before current one."
5971 (gnus-summary-prev-article
5972 (or (not (eq gnus-summary-goto-unread 'never))
5973 (gnus-summary-first-article-p (gnus-summary-article-number)))
5974 (and gnus-auto-select-same
5975 (gnus-summary-article-subject))))
5977 (defun gnus-summary-next-page (&optional lines circular)
5978 "Show next page of the selected article.
5979 If at the end of the current article, select the next article.
5980 LINES says how many lines should be scrolled up.
5982 If CIRCULAR is non-nil, go to the start of the article instead of
5983 selecting the next article when reaching the end of the current
5986 (setq gnus-summary-buffer (current-buffer))
5987 (gnus-set-global-variables)
5988 (let ((article (gnus-summary-article-number))
5989 (article-window (get-buffer-window gnus-article-buffer t))
5991 ;; If the buffer is empty, we have no article.
5993 (error "No article to select"))
5994 (gnus-configure-windows 'article)
5995 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5996 (if (and (eq gnus-summary-goto-unread 'never)
5997 (not (gnus-summary-last-article-p article)))
5998 (gnus-summary-next-article)
5999 (gnus-summary-next-unread-article))
6000 (if (or (null gnus-current-article)
6001 (null gnus-article-current)
6002 (/= article (cdr gnus-article-current))
6003 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6004 ;; Selected subject is different from current article's.
6005 (gnus-summary-display-article article)
6006 (when article-window
6007 (gnus-eval-in-buffer-window gnus-article-buffer
6008 (setq endp (gnus-article-next-page lines)))
6011 (gnus-summary-beginning-of-article))
6013 (gnus-message 3 "End of message"))
6015 (if (and (eq gnus-summary-goto-unread 'never)
6016 (not (gnus-summary-last-article-p article)))
6017 (gnus-summary-next-article)
6018 (gnus-summary-next-unread-article))))))))
6019 (gnus-summary-recenter)
6020 (gnus-summary-position-point)))
6022 (defun gnus-summary-prev-page (&optional lines move)
6023 "Show previous page of selected article.
6024 Argument LINES specifies lines to be scrolled down.
6025 If MOVE, move to the previous unread article if point is at
6026 the beginning of the buffer."
6028 (let ((article (gnus-summary-article-number))
6029 (article-window (get-buffer-window gnus-article-buffer t))
6031 (gnus-configure-windows 'article)
6032 (if (or (null gnus-current-article)
6033 (null gnus-article-current)
6034 (/= article (cdr gnus-article-current))
6035 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6036 ;; Selected subject is different from current article's.
6037 (gnus-summary-display-article article)
6038 (gnus-summary-recenter)
6039 (when article-window
6040 (gnus-eval-in-buffer-window gnus-article-buffer
6041 (setq endp (gnus-article-prev-page lines)))
6042 (when (and move endp)
6044 (gnus-message 3 "Beginning of message"))
6046 (if (and (eq gnus-summary-goto-unread 'never)
6047 (not (gnus-summary-first-article-p article)))
6048 (gnus-summary-prev-article)
6049 (gnus-summary-prev-unread-article))))))))
6050 (gnus-summary-position-point))
6052 (defun gnus-summary-prev-page-or-article (&optional lines)
6053 "Show previous page of selected article.
6054 Argument LINES specifies lines to be scrolled down.
6055 If at the beginning of the article, go to the next article."
6057 (gnus-summary-prev-page lines t))
6059 (defun gnus-summary-scroll-up (lines)
6060 "Scroll up (or down) one line current article.
6061 Argument LINES specifies lines to be scrolled up (or down if negative)."
6063 (gnus-configure-windows 'article)
6064 (gnus-summary-show-thread)
6065 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6066 (gnus-eval-in-buffer-window gnus-article-buffer
6068 (when (gnus-article-next-page lines)
6069 (gnus-message 3 "End of message")))
6071 (gnus-article-prev-page (- lines))))))
6072 (gnus-summary-recenter)
6073 (gnus-summary-position-point))
6075 (defun gnus-summary-scroll-down (lines)
6076 "Scroll down (or up) one line current article.
6077 Argument LINES specifies lines to be scrolled down (or up if negative)."
6079 (gnus-summary-scroll-up (- lines)))
6081 (defun gnus-summary-next-same-subject ()
6082 "Select next article which has the same subject as current one."
6084 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6086 (defun gnus-summary-prev-same-subject ()
6087 "Select previous article which has the same subject as current one."
6089 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6091 (defun gnus-summary-next-unread-same-subject ()
6092 "Select next unread article which has the same subject as current one."
6094 (gnus-summary-next-article t (gnus-summary-article-subject)))
6096 (defun gnus-summary-prev-unread-same-subject ()
6097 "Select previous unread article which has the same subject as current one."
6099 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6101 (defun gnus-summary-first-unread-article ()
6102 "Select the first unread article.
6103 Return nil if there are no unread articles."
6106 (when (gnus-summary-first-subject t)
6107 (gnus-summary-show-thread)
6108 (gnus-summary-first-subject t)
6109 (gnus-summary-display-article (gnus-summary-article-number)))
6110 (gnus-summary-position-point)))
6112 (defun gnus-summary-first-unread-subject ()
6113 "Place the point on the subject line of the first unread article.
6114 Return nil if there are no unread articles."
6117 (when (gnus-summary-first-subject t)
6118 (gnus-summary-show-thread)
6119 (gnus-summary-first-subject t))
6120 (gnus-summary-position-point)))
6122 (defun gnus-summary-first-article ()
6123 "Select the first article.
6124 Return nil if there are no articles."
6127 (when (gnus-summary-first-subject)
6128 (gnus-summary-show-thread)
6129 (gnus-summary-first-subject)
6130 (gnus-summary-display-article (gnus-summary-article-number)))
6131 (gnus-summary-position-point)))
6133 (defun gnus-summary-best-unread-article ()
6134 "Select the unread article with the highest score."
6136 (let ((best -1000000)
6137 (data gnus-newsgroup-data)
6140 (and (gnus-data-unread-p (car data))
6142 (gnus-summary-article-score (gnus-data-number (car data))))
6145 article (gnus-data-number (car data))))
6146 (setq data (cdr data)))
6149 (gnus-summary-goto-article article)
6150 (error "No unread articles"))
6151 (gnus-summary-position-point))))
6153 (defun gnus-summary-last-subject ()
6154 "Go to the last displayed subject line in the group."
6155 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6157 (gnus-summary-goto-subject article))))
6159 (defun gnus-summary-goto-article (article &optional all-headers force)
6160 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6161 If ALL-HEADERS is non-nil, no header lines are hidden.
6162 If FORCE, go to the article even if it isn't displayed. If FORCE
6163 is a number, it is the line the article is to be displayed on."
6167 "Article number or Message-ID: "
6168 (mapcar (lambda (number) (list (int-to-string number)))
6169 gnus-newsgroup-limit))
6173 (if (and (stringp article)
6174 (string-match "@" article))
6175 (gnus-summary-refer-article article)
6176 (when (stringp article)
6177 (setq article (string-to-number article)))
6178 (if (gnus-summary-goto-subject article force)
6179 (gnus-summary-display-article article all-headers)
6180 (gnus-message 4 "Couldn't go to article %s" article) nil))
6181 (gnus-summary-position-point)))
6183 (defun gnus-summary-goto-last-article ()
6184 "Go to the previously read article."
6187 (when gnus-last-article
6188 (gnus-summary-goto-article gnus-last-article nil t))
6189 (gnus-summary-position-point)))
6191 (defun gnus-summary-pop-article (number)
6192 "Pop one article off the history and go to the previous.
6193 NUMBER articles will be popped off."
6196 (setq gnus-newsgroup-history
6197 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6199 (gnus-summary-goto-article (car to) nil t)
6200 (error "Article history empty")))
6201 (gnus-summary-position-point))
6203 ;; Summary commands and functions for limiting the summary buffer.
6205 (defun gnus-summary-limit-to-articles (n)
6206 "Limit the summary buffer to the next N articles.
6207 If not given a prefix, use the process marked articles instead."
6210 (let ((articles (gnus-summary-work-articles n)))
6211 (setq gnus-newsgroup-processable nil)
6212 (gnus-summary-limit articles))
6213 (gnus-summary-position-point)))
6215 (defun gnus-summary-pop-limit (&optional total)
6216 "Restore the previous limit.
6217 If given a prefix, remove all limits."
6220 (setq gnus-newsgroup-limits
6221 (list (mapcar (lambda (h) (mail-header-number h))
6222 gnus-newsgroup-headers))))
6223 (unless gnus-newsgroup-limits
6224 (error "No limit to pop"))
6226 (gnus-summary-limit nil 'pop)
6227 (gnus-summary-position-point)))
6229 (defun gnus-summary-limit-to-subject (subject &optional header)
6230 "Limit the summary buffer to articles that have subjects that match a regexp."
6231 (interactive "sLimit to subject (regexp): ")
6233 (setq header "subject"))
6234 (when (not (equal "" subject))
6236 (let ((articles (gnus-summary-find-matching
6237 (or header "subject") subject 'all)))
6239 (error "Found no matches for \"%s\"" subject))
6240 (gnus-summary-limit articles))
6241 (gnus-summary-position-point))))
6243 (defun gnus-summary-limit-to-author (from)
6244 "Limit the summary buffer to articles that have authors that match a regexp."
6245 (interactive "sLimit to author (regexp): ")
6246 (gnus-summary-limit-to-subject from "from"))
6248 (defun gnus-summary-limit-to-age (age &optional younger-p)
6249 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6250 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6251 articles that are younger than AGE days."
6253 (let ((younger current-prefix-arg)
6256 (while (not days-got)
6257 (setq days (if younger
6258 (read-string "Limit to articles within (in days): ")
6259 (read-string "Limit to articles old than (in days): ")))
6260 (when (> (length days) 0)
6261 (setq days (read days)))
6264 (message "Please enter a number.")
6266 (list days younger)))
6268 (let ((data gnus-newsgroup-data)
6269 (cutoff (days-to-time age))
6270 articles d date is-younger)
6271 (while (setq d (pop data))
6272 (when (and (vectorp (gnus-data-header d))
6273 (setq date (mail-header-date (gnus-data-header d))))
6274 (setq is-younger (time-less-p
6275 (time-since (date-to-time date))
6280 (push (gnus-data-number d) articles))))
6281 (gnus-summary-limit (nreverse articles)))
6282 (gnus-summary-position-point)))
6284 (defun gnus-summary-limit-to-extra (header regexp)
6285 "Limit the summary buffer to articles that match an 'extra' header."
6289 (gnus-completing-read
6290 (symbol-name (car gnus-extra-headers))
6291 "Limit extra header:"
6293 (cons (symbol-name x) x))
6298 (read-string (format "Limit to header %s (regexp): " header)))))
6299 (when (not (equal "" regexp))
6301 (let ((articles (gnus-summary-find-matching
6302 (cons 'extra header) regexp 'all)))
6304 (error "Found no matches for \"%s\"" regexp))
6305 (gnus-summary-limit articles))
6306 (gnus-summary-position-point))))
6308 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6310 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6312 (defun gnus-summary-limit-to-unread (&optional all)
6313 "Limit the summary buffer to articles that are not marked as read.
6314 If ALL is non-nil, limit strictly to unread articles."
6317 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6318 (gnus-summary-limit-to-marks
6319 ;; Concat all the marks that say that an article is read and have
6321 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6322 gnus-killed-mark gnus-kill-file-mark
6323 gnus-low-score-mark gnus-expirable-mark
6324 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6325 gnus-duplicate-mark gnus-souped-mark)
6328 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6329 (make-obsolete 'gnus-summary-delete-marked-with
6330 'gnus-summary-limit-exlude-marks)
6332 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6333 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6334 If REVERSE, limit the summary buffer to articles that are marked
6335 with MARKS. MARKS can either be a string of marks or a list of marks.
6336 Returns how many articles were removed."
6337 (interactive "sMarks: ")
6338 (gnus-summary-limit-to-marks marks t))
6340 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6341 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6342 If REVERSE (the prefix), limit the summary buffer to articles that are
6343 not marked with MARKS. MARKS can either be a string of marks or a
6345 Returns how many articles were removed."
6346 (interactive "sMarks: \nP")
6348 (let ((data gnus-newsgroup-data)
6349 (marks (if (listp marks) marks
6350 (append marks nil))) ; Transform to list.
6353 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6354 (memq (gnus-data-mark (car data)) marks))
6355 (push (gnus-data-number (car data)) articles))
6356 (setq data (cdr data)))
6357 (gnus-summary-limit articles))
6358 (gnus-summary-position-point)))
6360 (defun gnus-summary-limit-to-score (&optional score)
6361 "Limit to articles with score at or above SCORE."
6363 (setq score (if score
6364 (prefix-numeric-value score)
6365 (or gnus-summary-default-score 0)))
6366 (let ((data gnus-newsgroup-data)
6369 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6371 (push (gnus-data-number (car data)) articles))
6372 (setq data (cdr data)))
6374 (gnus-summary-limit articles)
6375 (gnus-summary-position-point))))
6377 (defun gnus-summary-limit-include-thread (id)
6378 "Display all the hidden articles that in the current thread."
6379 (interactive (list (mail-header-id (gnus-summary-article-header))))
6380 (let ((articles (gnus-articles-in-thread
6381 (gnus-id-to-thread (gnus-root-id id)))))
6383 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6384 (gnus-summary-position-point))))
6386 (defun gnus-summary-limit-include-dormant ()
6387 "Display all the hidden articles that are marked as dormant.
6388 Note that this command only works on a subset of the articles currently
6389 fetched for this group."
6391 (unless gnus-newsgroup-dormant
6392 (error "There are no dormant articles in this group"))
6394 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6395 (gnus-summary-position-point)))
6397 (defun gnus-summary-limit-exclude-dormant ()
6398 "Hide all dormant articles."
6401 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6402 (gnus-summary-position-point)))
6404 (defun gnus-summary-limit-exclude-childless-dormant ()
6405 "Hide all dormant articles that have no children."
6407 (let ((data (gnus-data-list t))
6408 articles d children)
6409 ;; Find all articles that are either not dormant or have
6411 (while (setq d (pop data))
6412 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6414 (gnus-article-children (gnus-data-number d)))
6417 (when (memq (car children) articles)
6422 (push (gnus-data-number d) articles)))
6425 (gnus-summary-limit articles)
6426 (gnus-summary-position-point))))
6428 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6429 "Mark all unread excluded articles as read.
6430 If ALL, mark even excluded ticked and dormants as read."
6432 (let ((articles (gnus-sorted-complement
6434 (mapcar (lambda (h) (mail-header-number h))
6435 gnus-newsgroup-headers)
6437 (sort gnus-newsgroup-limit '<)))
6439 (setq gnus-newsgroup-unreads
6440 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6442 (setq gnus-newsgroup-dormant nil
6443 gnus-newsgroup-marked nil
6444 gnus-newsgroup-reads
6446 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6447 gnus-newsgroup-reads))
6448 (while (setq article (pop articles))
6449 (unless (or (memq article gnus-newsgroup-dormant)
6450 (memq article gnus-newsgroup-marked))
6451 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6453 (defun gnus-summary-limit (articles &optional pop)
6455 ;; We pop the previous limit off the stack and use that.
6456 (setq articles (car gnus-newsgroup-limits)
6457 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6458 ;; We use the new limit, so we push the old limit on the stack.
6459 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6461 (setq gnus-newsgroup-limit articles)
6462 (let ((total (length gnus-newsgroup-data))
6463 (data (gnus-data-find-list (gnus-summary-article-number)))
6464 (gnus-summary-mark-below nil) ; Inhibit this.
6466 ;; This will do all the work of generating the new summary buffer
6467 ;; according to the new limit.
6468 (gnus-summary-prepare)
6469 ;; Hide any threads, possibly.
6470 (and gnus-show-threads
6471 gnus-thread-hide-subtree
6472 (gnus-summary-hide-all-threads))
6473 ;; Try to return to the article you were at, or one in the
6476 ;; We try to find some article after the current one.
6478 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6481 (setq data (cdr data))))
6483 ;; If there is no data, that means that we were after the last
6484 ;; article. The same goes when we can't find any articles
6485 ;; after the current one.
6486 (goto-char (point-max))
6487 (gnus-summary-find-prev))
6488 (gnus-set-mode-line 'summary)
6489 ;; We return how many articles were removed from the summary
6490 ;; buffer as a result of the new limit.
6491 (- total (length gnus-newsgroup-data))))
6493 (defsubst gnus-invisible-cut-children (threads)
6496 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6501 (defsubst gnus-cut-thread (thread)
6502 "Go forwards in the thread until we find an article that we want to display."
6503 (when (or (eq gnus-fetch-old-headers 'some)
6504 (eq gnus-fetch-old-headers 'invisible)
6505 (eq gnus-build-sparse-threads 'some)
6506 (eq gnus-build-sparse-threads 'more))
6507 ;; Deal with old-fetched headers and sparse threads.
6511 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6512 (gnus-summary-article-ancient-p
6513 (mail-header-number (car thread))))
6514 (if (or (<= (length (cdr thread)) 1)
6515 (eq gnus-fetch-old-headers 'invisible))
6516 (setq gnus-newsgroup-limit
6517 (delq (mail-header-number (car thread))
6518 gnus-newsgroup-limit)
6519 thread (cadr thread))
6520 (when (gnus-invisible-cut-children (cdr thread))
6521 (let ((th (cdr thread)))
6523 (if (memq (mail-header-number (caar th))
6524 gnus-newsgroup-limit)
6525 (setq thread (car th)
6527 (setq th (cdr th))))))))))
6530 (defun gnus-cut-threads (threads)
6531 "Cut off all uninteresting articles from the beginning of threads."
6532 (when (or (eq gnus-fetch-old-headers 'some)
6533 (eq gnus-fetch-old-headers 'invisible)
6534 (eq gnus-build-sparse-threads 'some)
6535 (eq gnus-build-sparse-threads 'more))
6538 (setcar th (gnus-cut-thread (car th)))
6539 (setq th (cdr th)))))
6540 ;; Remove nixed out threads.
6543 (defun gnus-summary-initial-limit (&optional show-if-empty)
6544 "Figure out what the initial limit is supposed to be on group entry.
6545 This entails weeding out unwanted dormants, low-scored articles,
6546 fetch-old-headers verbiage, and so on."
6547 ;; Most groups have nothing to remove.
6548 (if (or gnus-inhibit-limiting
6549 (and (null gnus-newsgroup-dormant)
6550 (not (eq gnus-fetch-old-headers 'some))
6551 (not (eq gnus-fetch-old-headers 'invisible))
6552 (null gnus-summary-expunge-below)
6553 (not (eq gnus-build-sparse-threads 'some))
6554 (not (eq gnus-build-sparse-threads 'more))
6555 (null gnus-thread-expunge-below)
6556 (not gnus-use-nocem)))
6558 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6559 (setq gnus-newsgroup-limit nil)
6562 (unless (car (symbol-value node))
6563 ;; These threads have no parents -- they are roots.
6564 (let ((nodes (cdr (symbol-value node)))
6567 (if (and gnus-thread-expunge-below
6568 (< (gnus-thread-total-score (car nodes))
6569 gnus-thread-expunge-below))
6570 (gnus-expunge-thread (pop nodes))
6571 (setq thread (pop nodes))
6572 (gnus-summary-limit-children thread))))))
6573 gnus-newsgroup-dependencies)
6574 ;; If this limitation resulted in an empty group, we might
6575 ;; pop the previous limit and use it instead.
6576 (when (and (not gnus-newsgroup-limit)
6578 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6579 gnus-newsgroup-limit))
6581 (defun gnus-summary-limit-children (thread)
6582 "Return 1 if this subthread is visible and 0 if it is not."
6583 ;; First we get the number of visible children to this thread. This
6584 ;; is done by recursing down the thread using this function, so this
6585 ;; will really go down to a leaf article first, before slowly
6586 ;; working its way up towards the root.
6590 (apply '+ (mapcar 'gnus-summary-limit-children
6593 (number (mail-header-number (car thread)))
6596 (not (memq number gnus-newsgroup-marked))
6598 ;; If this article is dormant and has absolutely no visible
6599 ;; children, then this article isn't visible.
6600 (and (memq number gnus-newsgroup-dormant)
6602 ;; If this is "fetch-old-headered" and there is no
6603 ;; visible children, then we don't want this article.
6604 (and (eq gnus-fetch-old-headers 'some)
6605 (gnus-summary-article-ancient-p number)
6607 ;; If this is "fetch-old-headered" and `invisible', then
6608 ;; we don't want this article.
6609 (and (eq gnus-fetch-old-headers 'invisible)
6610 (gnus-summary-article-ancient-p number))
6611 ;; If this is a sparsely inserted article with no children,
6612 ;; we don't want it.
6613 (and (eq gnus-build-sparse-threads 'some)
6614 (gnus-summary-article-sparse-p number)
6616 ;; If we use expunging, and this article is really
6617 ;; low-scored, then we don't want this article.
6618 (when (and gnus-summary-expunge-below
6620 (or (cdr (assq number gnus-newsgroup-scored))
6621 gnus-summary-default-score))
6622 gnus-summary-expunge-below))
6623 ;; We increase the expunge-tally here, but that has
6624 ;; nothing to do with the limits, really.
6625 (incf gnus-newsgroup-expunged-tally)
6626 ;; We also mark as read here, if that's wanted.
6627 (when (and gnus-summary-mark-below
6628 (< score gnus-summary-mark-below))
6629 (setq gnus-newsgroup-unreads
6630 (delq number gnus-newsgroup-unreads))
6631 (if gnus-newsgroup-auto-expire
6632 (push number gnus-newsgroup-expirable)
6633 (push (cons number gnus-low-score-mark)
6634 gnus-newsgroup-reads)))
6636 ;; Check NoCeM things.
6637 (if (and gnus-use-nocem
6638 (gnus-nocem-unwanted-article-p
6639 (mail-header-id (car thread))))
6641 (setq gnus-newsgroup-unreads
6642 (delq number gnus-newsgroup-unreads))
6644 ;; Nope, invisible article.
6646 ;; Ok, this article is to be visible, so we add it to the limit
6648 (push number gnus-newsgroup-limit)
6651 (defun gnus-expunge-thread (thread)
6652 "Mark all articles in THREAD as read."
6653 (let* ((number (mail-header-number (car thread))))
6654 (incf gnus-newsgroup-expunged-tally)
6655 ;; We also mark as read here, if that's wanted.
6656 (setq gnus-newsgroup-unreads
6657 (delq number gnus-newsgroup-unreads))
6658 (if gnus-newsgroup-auto-expire
6659 (push number gnus-newsgroup-expirable)
6660 (push (cons number gnus-low-score-mark)
6661 gnus-newsgroup-reads)))
6662 ;; Go recursively through all subthreads.
6663 (mapcar 'gnus-expunge-thread (cdr thread)))
6665 ;; Summary article oriented commands
6667 (defun gnus-summary-refer-parent-article (n)
6668 "Refer parent article N times.
6669 If N is negative, go to ancestor -N instead.
6670 The difference between N and the number of articles fetched is returned."
6674 (when (not (natnump n))
6679 (setq header (gnus-summary-article-header))
6680 (if (and (eq (mail-header-number header)
6681 (cdr gnus-article-current))
6682 (equal gnus-newsgroup-name
6683 (car gnus-article-current)))
6684 ;; If we try to find the parent of the currently
6685 ;; displayed article, then we take a look at the actual
6686 ;; References header, since this is slightly more
6687 ;; reliable than the References field we got from the
6690 (set-buffer gnus-original-article-buffer)
6691 (nnheader-narrow-to-headers)
6692 (unless (setq ref (message-fetch-field "references"))
6693 (setq ref (message-fetch-field "in-reply-to")))
6696 ;; It's not the current article, so we take a bet on
6697 ;; the value we got from the server.
6698 (mail-header-references header)))
6700 (not (equal ref "")))
6701 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6702 (gnus-message 1 "Couldn't find parent"))
6703 (gnus-message 1 "No references in article %d"
6704 (gnus-summary-article-number))
6707 (gnus-summary-position-point)
6710 (defun gnus-summary-refer-references ()
6711 "Fetch all articles mentioned in the References header.
6712 Return the number of articles fetched."
6714 (let ((ref (mail-header-references (gnus-summary-article-header)))
6715 (current (gnus-summary-article-number))
6719 (error "No References in the current article")
6720 ;; For each Message-ID in the References header...
6721 (while (string-match "<[^>]*>" ref)
6723 ;; ... fetch that article.
6724 (gnus-summary-refer-article
6725 (prog1 (match-string 0 ref)
6726 (setq ref (substring ref (match-end 0))))))
6727 (gnus-summary-goto-subject current)
6728 (gnus-summary-position-point)
6731 (defun gnus-summary-refer-thread (&optional limit)
6732 "Fetch all articles in the current thread.
6733 If LIMIT (the numerical prefix), fetch that many old headers instead
6734 of what's specified by the `gnus-refer-thread-limit' variable."
6736 (let ((id (mail-header-id (gnus-summary-article-header)))
6737 (limit (if limit (prefix-numeric-value limit)
6738 gnus-refer-thread-limit)))
6739 ;; We want to fetch LIMIT *old* headers, but we also have to
6740 ;; re-fetch all the headers in the current buffer, because many of
6741 ;; them may be undisplayed. So we adjust LIMIT.
6742 (when (numberp limit)
6743 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6744 (unless (eq gnus-fetch-old-headers 'invisible)
6745 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6746 ;; Retrieve the headers and read them in.
6747 (if (eq (gnus-retrieve-headers
6748 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6750 (gnus-build-all-threads)
6751 (error "Can't fetch thread from backends that don't support NOV"))
6752 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6753 (gnus-summary-limit-include-thread id)))
6755 (defun gnus-summary-refer-article (message-id &optional arg)
6756 "Fetch an article specified by MESSAGE-ID.
6757 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6758 or `gnus-select-method', no matter what backend the article comes from."
6759 (interactive "sMessage-ID: \nP")
6760 (when (and (stringp message-id)
6761 (not (zerop (length message-id))))
6762 ;; Construct the correct Message-ID if necessary.
6763 ;; Suggested by tale@pawl.rpi.edu.
6764 (unless (string-match "^<" message-id)
6765 (setq message-id (concat "<" message-id)))
6766 (unless (string-match ">$" message-id)
6767 (setq message-id (concat message-id ">")))
6768 (let* ((header (gnus-id-to-header message-id))
6770 (gnus-summary-article-sparse-p
6771 (mail-header-number header))
6772 (memq (mail-header-number header)
6773 gnus-newsgroup-limit))))
6775 ;; If the article is present in the buffer we just go to it.
6777 (or (not (gnus-summary-article-sparse-p
6778 (mail-header-number header)))
6781 (gnus-summary-goto-article
6782 (mail-header-number header) nil t)
6784 (gnus-summary-update-article (mail-header-number header)))))
6786 ;; We fetch the article
6787 (let ((gnus-override-method
6788 (cond ((gnus-news-group-p gnus-newsgroup-name)
6789 gnus-refer-article-method)
6791 (or gnus-refer-article-method gnus-select-method))
6794 ;; Start the special refer-article method, if necessary.
6795 (when (and gnus-refer-article-method
6796 (gnus-news-group-p gnus-newsgroup-name))
6797 (gnus-check-server gnus-refer-article-method))
6798 ;; Fetch the header, and display the article.
6799 (if (setq number (gnus-summary-insert-subject message-id))
6800 (gnus-summary-select-article nil nil nil number)
6801 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6803 (defun gnus-summary-edit-parameters ()
6804 "Edit the group parameters of the current group."
6806 (gnus-group-edit-group gnus-newsgroup-name 'params))
6808 (defun gnus-summary-customize-parameters ()
6809 "Customize the group parameters of the current group."
6811 (gnus-group-customize gnus-newsgroup-name))
6813 (defun gnus-summary-enter-digest-group (&optional force)
6814 "Enter an nndoc group based on the current article.
6815 If FORCE, force a digest interpretation. If not, try
6816 to guess what the document format is."
6818 (let ((conf gnus-current-window-configuration))
6820 (gnus-summary-select-article))
6821 (setq gnus-current-window-configuration conf)
6822 (let* ((name (format "%s-%d"
6823 (gnus-group-prefixed-name
6824 gnus-newsgroup-name (list 'nndoc ""))
6826 (set-buffer gnus-summary-buffer)
6827 gnus-current-article)))
6828 (ogroup gnus-newsgroup-name)
6829 (params (append (gnus-info-params (gnus-get-info ogroup))
6830 (list (cons 'to-group ogroup))
6831 (list (cons 'save-article-group ogroup))))
6832 (case-fold-search t)
6833 (buf (current-buffer))
6836 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6837 (insert-buffer-substring gnus-original-article-buffer)
6838 ;; Remove lines that may lead nndoc to misinterpret the
6841 (goto-char (point-min))
6842 (or (search-forward "\n\n" nil t) (point)))
6843 (goto-char (point-min))
6844 (delete-matching-lines "^Path:\\|^From ")
6847 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
6848 (gnus-newsgroup-ephemeral-ignored-charsets
6849 gnus-newsgroup-ignored-charsets))
6850 (gnus-group-read-ephemeral-group
6851 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6853 ,(if force 'mbox 'guess))) t))
6854 ;; Make all postings to this group go to the parent group.
6855 (nconc (gnus-info-params (gnus-get-info name))
6857 ;; Couldn't select this doc group.
6858 (switch-to-buffer buf)
6859 (gnus-set-global-variables)
6860 (gnus-configure-windows 'summary)
6861 (gnus-message 3 "Article couldn't be entered?"))
6862 (kill-buffer dig)))))
6864 (defun gnus-summary-read-document (n)
6865 "Open a new group based on the current article(s).
6866 This will allow you to read digests and other similar
6867 documents as newsgroups.
6868 Obeys the standard process/prefix convention."
6870 (let* ((articles (gnus-summary-work-articles n))
6871 (ogroup gnus-newsgroup-name)
6872 (params (append (gnus-info-params (gnus-get-info ogroup))
6873 (list (cons 'to-group ogroup))))
6874 article group egroup groups vgroup)
6875 (while (setq article (pop articles))
6876 (setq group (format "%s-%d" gnus-newsgroup-name article))
6877 (gnus-summary-remove-process-mark article)
6878 (when (gnus-summary-display-article article)
6881 (insert-buffer-substring gnus-original-article-buffer)
6882 ;; Remove some headers that may lead nndoc to make
6884 (message-narrow-to-head)
6885 (goto-char (point-min))
6886 (delete-matching-lines "^\\(Path\\):\\|^From ")
6889 (gnus-group-read-ephemeral-group
6890 group `(nndoc ,group (nndoc-address ,(current-buffer))
6891 (nndoc-article-type guess))
6894 ;; Make all postings to this group go to the parent group.
6895 (nconc (gnus-info-params (gnus-get-info egroup))
6897 (push egroup groups))
6898 ;; Couldn't select this doc group.
6899 (gnus-error 3 "Article couldn't be entered"))))))
6900 ;; Now we have selected all the documents.
6903 (error "None of the articles could be interpreted as documents"))
6904 ((gnus-group-read-ephemeral-group
6905 (setq vgroup (format
6906 "nnvirtual:%s-%s" gnus-newsgroup-name
6907 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6908 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6910 (cons (current-buffer) 'summary)))
6912 (error "Couldn't select virtual nndoc group")))))
6914 (defun gnus-summary-isearch-article (&optional regexp-p)
6915 "Do incremental search forward on the current article.
6916 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6918 (let* ((gnus-inhibit-treatment t)
6919 (old (gnus-summary-select-article)))
6920 (gnus-configure-windows 'article)
6921 (gnus-eval-in-buffer-window gnus-article-buffer
6925 (gnus-article-show-all-headers))
6926 (goto-char (point-min))
6927 (isearch-forward regexp-p)))))
6929 (defun gnus-summary-search-article-forward (regexp &optional backward)
6930 "Search for an article containing REGEXP forward.
6931 If BACKWARD, search backward instead."
6934 (format "Search article %s (regexp%s): "
6935 (if current-prefix-arg "backward" "forward")
6936 (if gnus-last-search-regexp
6937 (concat ", default " gnus-last-search-regexp)
6939 current-prefix-arg))
6940 (if (string-equal regexp "")
6941 (setq regexp (or gnus-last-search-regexp ""))
6942 (setq gnus-last-search-regexp regexp))
6943 (if (gnus-summary-search-article regexp backward)
6944 (gnus-summary-show-thread)
6945 (error "Search failed: \"%s\"" regexp)))
6947 (defun gnus-summary-search-article-backward (regexp)
6948 "Search for an article containing REGEXP backward."
6951 (format "Search article backward (regexp%s): "
6952 (if gnus-last-search-regexp
6953 (concat ", default " gnus-last-search-regexp)
6955 (gnus-summary-search-article-forward regexp 'backward))
6958 (defmacro gnus-summary-search-article-position-point (regexp backward)
6959 "Dehighlight the last matched text and goto the beginning position."
6960 (` (if (and gnus-summary-search-article-matched-data
6961 (let ((text (caddr gnus-summary-search-article-matched-data))
6962 (inhibit-read-only t)
6965 (goto-char (car gnus-summary-search-article-matched-data))
6966 (cadr gnus-summary-search-article-matched-data))
6968 (string-match (, regexp) text)))
6969 (if (, backward) (beginning-of-line) (end-of-line))
6970 (goto-char (if (, backward) (point-max) (point-min))))))
6972 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
6973 "Place point where X-Face image is displayed."
6974 (if (featurep 'xemacs)
6975 (` (let ((end (if (search-forward "\n\n" nil t)
6976 (goto-char (1- (point)))
6979 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
6980 (unless (and (re-search-forward "^From:" end t)
6981 (setq extent (extent-at (point)))
6982 (extent-begin-glyph extent))
6983 (goto-char (, opoint)))))
6984 (` (let ((end (if (search-forward "\n\n" nil t)
6985 (goto-char (1- (point)))
6988 (or (text-property-any (or (search-backward "\n\n" nil t)
6990 end 'x-face-mule-bitmap-image t)
6993 (defmacro gnus-summary-search-article-highlight-matched-text
6994 (backward treated x-face)
6995 "Highlight matched text in the function `gnus-summary-search-article'."
6996 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
6997 (end (set-marker (make-marker) (match-end 0)))
6998 (inhibit-read-only t)
7002 (let ((items (mapcar 'car gnus-treatment-function-alist)))
7004 (lambda (item) (setq items (delq item items)))
7005 '(gnus-treat-buttonize
7006 gnus-treat-fill-article
7007 gnus-treat-fill-long-lines
7008 gnus-treat-emphasize
7009 gnus-treat-highlight-headers
7010 gnus-treat-highlight-citation
7011 gnus-treat-highlight-signature
7012 gnus-treat-overstrike
7013 gnus-treat-display-xface
7014 gnus-treat-buttonize-head
7015 gnus-treat-decode-article-as-default-mime-charset))
7016 (static-if (featurep 'xemacs)
7018 (cons '(x-face-mule-delete-x-face-field
7021 (gnus-treat-display-xface
7022 (when (, x-face) gnus-treat-display-xface)))
7023 (gnus-article-prepare-mime-display)))
7024 (goto-char (if (, backward) start end))
7026 (gnus-summary-search-article-highlight-goto-x-face (point)))
7027 (setq gnus-summary-search-article-matched-data
7028 (list start end (buffer-substring start end)))
7029 (unless (eq start end);; matched text has been deleted. :-<
7030 (put-text-property start end 'face
7031 (or (find-face 'isearch)
7032 'secondary-selection))))))
7035 (defun gnus-summary-search-article (regexp &optional backward)
7036 "Search for an article containing REGEXP.
7037 Optional argument BACKWARD means do search for backward.
7038 `gnus-select-article-hook' is not called during the search."
7039 ;; We have to require this here to make sure that the following
7040 ;; dynamic binding isn't shadowed by autoloading.
7041 (require 'gnus-async)
7043 (let ((gnus-select-article-hook nil) ;Disable hook.
7044 (gnus-article-display-hook nil)
7045 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7046 (gnus-use-article-prefetch nil)
7047 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7048 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7049 (sum (current-buffer))
7052 (gnus-save-hidden-threads
7053 (static-if (featurep 'xemacs)
7054 (let ((gnus-inhibit-treatment t))
7055 (setq treated (eq 'old (gnus-summary-select-article)))
7057 (not (and (gnus-buffer-live-p gnus-article-buffer)
7058 (window-live-p (get-buffer-window
7059 gnus-article-buffer t)))))
7060 (gnus-summary-select-article nil t)
7061 (setq treated nil)))
7062 (let ((gnus-inhibit-treatment t)
7063 (x-face-mule-delete-x-face-field 'never))
7064 (setq treated (eq 'old (gnus-summary-select-article)))
7067 (and (gnus-buffer-live-p gnus-article-buffer)
7068 (window-live-p (get-buffer-window
7069 gnus-article-buffer t))
7070 (or (not (string-match "^\\^X-Face:" regexp))
7071 (with-current-buffer gnus-article-buffer
7072 gnus-summary-search-article-matched-data)))))
7073 (gnus-summary-select-article nil t)
7074 (setq treated nil))))
7075 (set-buffer gnus-article-buffer)
7079 (gnus-article-show-all-headers)
7080 (gnus-summary-search-article-position-point regexp backward))
7081 (goto-char (if backward (point-max) (point-min))))
7083 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7085 (re-search-backward regexp nil t)
7086 (re-search-forward regexp nil t))
7087 ;; We found the regexp.
7089 (gnus-summary-search-article-highlight-matched-text
7090 backward treated (string-match "^\\^X-Face:" regexp))
7093 (/ (- 2 (window-height
7094 (get-buffer-window gnus-article-buffer t)))
7097 (get-buffer-window (current-buffer))
7100 (setq point (point)))
7101 ;; We didn't find it, so we go to the next article.
7104 (while (eq found 'not)
7105 (if (not (if backward (gnus-summary-find-prev)
7106 (gnus-summary-find-next)))
7107 ;; No more articles.
7109 ;; Select the next article and adjust point.
7110 (unless (gnus-summary-article-sparse-p
7111 (gnus-summary-article-number))
7113 (let ((gnus-inhibit-treatment t))
7114 (gnus-summary-select-article))
7116 (set-buffer gnus-article-buffer)
7118 (goto-char (if backward (point-max) (point-min))))))))
7119 (gnus-message 7 ""))
7120 ;; Return whether we found the regexp.
7121 (when (eq found 'found)
7123 (gnus-summary-show-thread)
7124 (gnus-summary-goto-subject gnus-current-article)
7125 (gnus-summary-position-point)
7128 (defun gnus-summary-find-matching (header regexp &optional backward unread
7130 "Return a list of all articles that match REGEXP on HEADER.
7131 The search stars on the current article and goes forwards unless
7132 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7133 If UNREAD is non-nil, only unread articles will
7134 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7135 in the comparisons."
7136 (let ((data (if (eq backward 'all) gnus-newsgroup-data
7137 (gnus-data-find-list
7138 (gnus-summary-article-number) (gnus-data-list backward))))
7139 (case-fold-search (not not-case-fold))
7142 (if (eq (car header) 'extra)
7145 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
7147 (error "%s is an invalid header" header))
7148 (unless (fboundp (intern (concat "mail-header-" header)))
7149 (error "%s is not a valid header" header))
7150 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
7153 (and (or (not unread) ; We want all articles...
7154 (gnus-data-unread-p d)) ; Or just unreads.
7155 (vectorp (gnus-data-header d)) ; It's not a pseudo.
7156 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
7157 (push (gnus-data-number d) articles)) ; Success!
7158 (setq data (cdr data)))
7159 (nreverse articles)))
7161 (defun gnus-summary-execute-command (header regexp command &optional backward)
7162 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7163 If HEADER is an empty string (or nil), the match is done on the entire
7164 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7166 (list (let ((completion-ignore-case t))
7169 (mapcar (lambda (string) (list string))
7170 '("Number" "Subject" "From" "Lines" "Date"
7171 "Message-ID" "Xref" "References" "Body"))
7172 nil 'require-match))
7173 (read-string "Regexp: ")
7174 (read-key-sequence "Command: ")
7175 current-prefix-arg))
7176 (when (equal header "Body")
7178 ;; Hidden thread subtrees must be searched as well.
7179 (gnus-summary-show-all-threads)
7180 ;; We don't want to change current point nor window configuration.
7182 (save-window-excursion
7183 (gnus-message 6 "Executing %s..." (key-description command))
7184 ;; We'd like to execute COMMAND interactively so as to give arguments.
7185 (gnus-execute header regexp
7186 `(call-interactively ',(key-binding command))
7188 (gnus-message 6 "Executing %s...done" (key-description command)))))
7190 (defun gnus-summary-beginning-of-article ()
7191 "Scroll the article back to the beginning."
7193 (gnus-summary-select-article)
7194 (gnus-configure-windows 'article)
7195 (gnus-eval-in-buffer-window gnus-article-buffer
7197 (goto-char (point-min))
7198 (when gnus-page-broken
7199 (gnus-narrow-to-page))))
7201 (defun gnus-summary-end-of-article ()
7202 "Scroll to the end of the article."
7204 (gnus-summary-select-article)
7205 (gnus-configure-windows 'article)
7206 (gnus-eval-in-buffer-window gnus-article-buffer
7208 (goto-char (point-max))
7210 (when gnus-page-broken
7211 (gnus-narrow-to-page))))
7213 (defun gnus-summary-print-article (&optional filename n)
7214 "Generate and print a PostScript image of the N next (mail) articles.
7216 If N is negative, print the N previous articles. If N is nil and articles
7217 have been marked with the process mark, print these instead.
7219 If the optional first argument FILENAME is nil, send the image to the
7220 printer. If FILENAME is a string, save the PostScript image in a file with
7221 that name. If FILENAME is a number, prompt the user for the name of the file
7223 (interactive (list (ps-print-preprint current-prefix-arg)
7224 current-prefix-arg))
7225 (dolist (article (gnus-summary-work-articles n))
7226 (gnus-summary-select-article nil nil 'pseudo article)
7227 (gnus-eval-in-buffer-window gnus-article-buffer
7228 (let ((buffer (generate-new-buffer " *print*")))
7231 (copy-to-buffer buffer (point-min) (point-max))
7233 (gnus-article-delete-invisible-text)
7234 (let ((ps-left-header
7237 (mail-header-subject gnus-current-headers) ")")
7239 (mail-header-from gnus-current-headers) ")")))
7242 "/pagenumberstring load"
7244 (mail-header-date gnus-current-headers) ")"))))
7245 (gnus-run-hooks 'gnus-ps-print-hook)
7247 (ps-print-buffer-with-faces filename))))
7248 (kill-buffer buffer))))))
7250 (defun gnus-summary-show-article (&optional arg)
7251 "Force re-fetching of the current article.
7252 If ARG (the prefix) is non-nil, show the raw article without any
7253 article massaging functions being run."
7256 ;; Select the article the normal way.
7257 (gnus-summary-select-article nil 'force)
7258 ;; We have to require this here to make sure that the following
7259 ;; dynamic binding isn't shadowed by autoloading.
7260 (require 'gnus-async)
7262 ;; Bind the article treatment functions to nil.
7263 (let ((gnus-have-all-headers t)
7264 gnus-article-display-hook
7265 gnus-article-prepare-hook
7266 gnus-article-decode-hook
7270 (gnus-summary-select-article nil 'force)))
7271 (gnus-summary-goto-subject gnus-current-article)
7272 (gnus-summary-position-point))
7274 (defun gnus-summary-verbose-headers (&optional arg)
7275 "Toggle permanent full header display.
7276 If ARG is a positive number, turn header display on.
7277 If ARG is a negative number, turn header display off."
7279 (setq gnus-show-all-headers
7280 (cond ((or (not (numberp arg))
7282 (not gnus-show-all-headers))
7285 (gnus-summary-show-article))
7287 (defun gnus-summary-toggle-header (&optional arg)
7288 "Show the headers if they are hidden, or hide them if they are shown.
7289 If ARG is a positive number, show the entire header.
7290 If ARG is a negative number, hide the unwanted header lines."
7293 (set-buffer gnus-article-buffer)
7295 (let* ((buffer-read-only nil)
7296 (inhibit-point-motion-hooks t)
7299 (article-narrow-to-head)
7300 (setq hidden (gnus-article-hidden-text-p 'headers)))
7301 (goto-char (point-min))
7302 (when (search-forward "\n\n" nil t)
7303 (delete-region (point-min) (1- (point))))
7304 (goto-char (point-min))
7306 (set-buffer gnus-original-article-buffer)
7307 (goto-char (point-min))
7308 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7309 (insert-buffer-substring gnus-original-article-buffer 1 e)
7311 (narrow-to-region (point-min) (point))
7312 (article-decode-encoded-words)
7314 (and (numberp arg) (< arg 0)))
7315 (let ((gnus-treat-hide-headers nil)
7316 (gnus-treat-hide-boring-headers nil))
7317 (gnus-treat-article 'head))
7318 (gnus-treat-article 'head)))))))
7320 (defun gnus-summary-show-all-headers ()
7321 "Make all header lines visible."
7323 (gnus-article-show-all-headers))
7325 (defun gnus-summary-toggle-mime (&optional arg)
7326 "Toggle MIME processing.
7327 If ARG is a positive number, turn MIME processing on."
7329 (setq gnus-show-mime
7331 (not gnus-show-mime)
7332 (> (prefix-numeric-value arg) 0)))
7333 (gnus-summary-select-article t 'force))
7335 (defun gnus-summary-caesar-message (&optional arg)
7336 "Caesar rotate the current article by 13.
7337 The numerical prefix specifies how many places to rotate each letter
7340 (gnus-summary-select-article)
7341 (let ((mail-header-separator ""))
7342 (gnus-eval-in-buffer-window gnus-article-buffer
7345 (let ((start (window-start))
7347 (message-caesar-buffer-body arg)
7348 (set-window-start (get-buffer-window (current-buffer)) start))))))
7350 (defun gnus-summary-stop-page-breaking ()
7351 "Stop page breaking in the current article."
7353 (gnus-summary-select-article)
7354 (gnus-eval-in-buffer-window gnus-article-buffer
7356 (when (gnus-visual-p 'page-marker)
7357 (let ((buffer-read-only nil))
7358 (gnus-remove-text-with-property 'gnus-prev)
7359 (gnus-remove-text-with-property 'gnus-next))
7360 (setq gnus-page-broken nil))))
7362 (defun gnus-summary-move-article (&optional n to-newsgroup
7363 select-method action)
7364 "Move the current article to a different newsgroup.
7365 If N is a positive number, move the N next articles.
7366 If N is a negative number, move the N previous articles.
7367 If N is nil and any articles have been marked with the process mark,
7368 move those articles instead.
7369 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7370 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7371 re-spool using this method.
7373 For this function to work, both the current newsgroup and the
7374 newsgroup that you want to move to have to support the `request-move'
7375 and `request-accept' functions."
7378 (setq action 'move))
7379 ;; Disable marking as read.
7380 (let (gnus-mark-article-hook)
7381 (save-window-excursion
7382 (gnus-summary-select-article)))
7383 ;; Check whether the source group supports the required functions.
7384 (cond ((and (eq action 'move)
7385 (not (gnus-check-backend-function
7386 'request-move-article gnus-newsgroup-name)))
7387 (error "The current group does not support article moving"))
7388 ((and (eq action 'crosspost)
7389 (not (gnus-check-backend-function
7390 'request-replace-article gnus-newsgroup-name)))
7391 (error "The current group does not support article editing")))
7392 (let ((articles (gnus-summary-work-articles n))
7393 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7394 (names '((move "Move" "Moving")
7395 (copy "Copy" "Copying")
7396 (crosspost "Crosspost" "Crossposting")))
7397 (copy-buf (save-excursion
7398 (nnheader-set-temp-buffer " *copy article*")))
7399 (default-marks gnus-article-mark-lists)
7400 (no-expire-marks (delete '(expirable . expire)
7401 (copy-sequence gnus-article-mark-lists)))
7402 art-group to-method new-xref article to-groups)
7403 (unless (assq action names)
7404 (error "Unknown action %s" action))
7405 ;; Read the newsgroup name.
7406 (when (and (not to-newsgroup)
7407 (not select-method))
7409 (gnus-read-move-group-name
7410 (cadr (assq action names))
7411 (symbol-value (intern (format "gnus-current-%s-group" action)))
7413 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7414 (setq to-method (or select-method
7415 (gnus-group-name-to-method to-newsgroup)))
7416 ;; Check the method we are to move this article to...
7417 (unless (gnus-check-backend-function
7418 'request-accept-article (car to-method))
7419 (error "%s does not support article copying" (car to-method)))
7420 (unless (gnus-check-server to-method)
7421 (error "Can't open server %s" (car to-method)))
7422 (gnus-message 6 "%s to %s: %s..."
7423 (caddr (assq action names))
7424 (or (car select-method) to-newsgroup) articles)
7426 (setq article (pop articles))
7430 ;; Move the article.
7432 ;; Remove this article from future suppression.
7433 (gnus-dup-unsuppress-article article)
7434 (gnus-request-move-article
7435 article ; Article to move
7436 gnus-newsgroup-name ; From newsgroup
7437 (nth 1 (gnus-find-method-for-group
7438 gnus-newsgroup-name)) ; Server
7439 (list 'gnus-request-accept-article
7440 to-newsgroup (list 'quote select-method)
7441 (not articles) t) ; Accept form
7442 (not articles))) ; Only save nov last time
7443 ;; Copy the article.
7446 (set-buffer copy-buf)
7447 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7448 (gnus-request-accept-article
7449 to-newsgroup select-method (not articles) t))))
7450 ;; Crosspost the article.
7451 ((eq action 'crosspost)
7452 (let ((xref (message-tokenize-header
7453 (mail-header-xref (gnus-summary-article-header article))
7455 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7458 (setq xref (list (system-name))))
7461 (mapconcat 'identity
7462 (delete "Xref:" (delete new-xref xref))
7466 (set-buffer copy-buf)
7467 ;; First put the article in the destination group.
7468 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7469 (when (consp (setq art-group
7470 (gnus-request-accept-article
7471 to-newsgroup select-method (not articles))))
7472 (setq new-xref (concat new-xref " " (car art-group)
7473 ":" (cdr art-group)))
7474 ;; Now we have the new Xrefs header, so we insert
7475 ;; it and replace the new article.
7476 (nnheader-replace-header "Xref" new-xref)
7477 (gnus-request-replace-article
7478 (cdr art-group) to-newsgroup (current-buffer))
7482 (gnus-message 1 "Couldn't %s article %s: %s"
7483 (cadr (assq action names)) article
7484 (nnheader-get-report (car to-method))))
7485 ((and (eq art-group 'junk)
7487 (gnus-summary-mark-article article gnus-canceled-mark)
7488 (gnus-message 4 "Deleted article %s" article))
7490 (let* ((pto-group (gnus-group-prefixed-name
7491 (car art-group) to-method))
7493 (gnus-gethash pto-group gnus-newsrc-hashtb))
7494 (info (nth 2 entry))
7495 (to-group (gnus-info-group info))
7497 ;; Update the group that has been moved to.
7499 (memq action '(move copy)))
7500 (unless (member to-group to-groups)
7501 (push to-group to-groups))
7503 (unless (memq article gnus-newsgroup-unreads)
7504 (push 'read to-marks)
7506 info (gnus-add-to-range (gnus-info-read info)
7507 (list (cdr art-group)))))
7509 ;; Copy any marks over to the new group.
7510 (let ((marks (if (gnus-group-auto-expirable-p to-group)
7513 (to-article (cdr art-group)))
7515 ;; See whether the article is to be put in the cache.
7516 (when gnus-use-cache
7517 (gnus-cache-possibly-enter-article
7519 (let ((header (copy-sequence
7520 (gnus-summary-article-header article))))
7521 (mail-header-set-number header to-article)
7523 (memq article gnus-newsgroup-marked)
7524 (memq article gnus-newsgroup-dormant)
7525 (memq article gnus-newsgroup-unreads)))
7527 (when (and (equal to-group gnus-newsgroup-name)
7528 (not (memq article gnus-newsgroup-unreads)))
7529 ;; Mark this article as read in this group.
7530 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7531 (setcdr (gnus-active to-group) to-article)
7532 (setcdr gnus-newsgroup-active to-article))
7535 (when (memq article (symbol-value
7536 (intern (format "gnus-newsgroup-%s"
7538 (push (cdar marks) to-marks)
7539 ;; If the other group is the same as this group,
7540 ;; then we have to add the mark to the list.
7541 (when (equal to-group gnus-newsgroup-name)
7542 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7545 (intern (format "gnus-newsgroup-%s"
7547 ;; Copy the marks to other group.
7548 (gnus-add-marked-articles
7549 to-group (cdar marks) (list to-article) info))
7550 (setq marks (cdr marks)))
7552 (gnus-request-set-mark to-group (list (list (list to-article)
7557 (concat "(gnus-group-set-info '"
7558 (gnus-prin1-to-string (gnus-get-info to-group))
7561 ;; Update the Xref header in this article to point to
7562 ;; the new crossposted article we have just created.
7563 (when (eq action 'crosspost)
7565 (set-buffer copy-buf)
7566 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7567 (nnheader-replace-header "Xref" new-xref)
7568 (gnus-request-replace-article
7569 article gnus-newsgroup-name (current-buffer)))))
7571 ;;;!!!Why is this necessary?
7572 (set-buffer gnus-summary-buffer)
7574 (gnus-summary-goto-subject article)
7575 (when (eq action 'move)
7576 (gnus-summary-mark-article article gnus-canceled-mark))))
7577 (gnus-summary-remove-process-mark article))
7578 ;; Re-activate all groups that have been moved to.
7581 (set-buffer gnus-group-buffer)
7582 (when (gnus-group-goto-group (car to-groups) t)
7583 (gnus-group-get-new-news-this-group 1 t))
7586 (gnus-kill-buffer copy-buf)
7587 (gnus-summary-position-point)
7588 (gnus-set-mode-line 'summary)))
7590 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7591 "Move the current article to a different newsgroup.
7592 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7593 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7594 re-spool using this method."
7596 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7598 (defun gnus-summary-crosspost-article (&optional n)
7599 "Crosspost the current article to some other group."
7601 (gnus-summary-move-article n nil nil 'crosspost))
7603 (defcustom gnus-summary-respool-default-method nil
7604 "Default method for respooling an article.
7605 If nil, use to the current newsgroup method."
7606 :type '(choice (gnus-select-method :value (nnml ""))
7608 :group 'gnus-summary-mail)
7610 (defun gnus-summary-respool-article (&optional n method)
7611 "Respool the current article.
7612 The article will be squeezed through the mail spooling process again,
7613 which means that it will be put in some mail newsgroup or other
7614 depending on `nnmail-split-methods'.
7615 If N is a positive number, respool the N next articles.
7616 If N is a negative number, respool the N previous articles.
7617 If N is nil and any articles have been marked with the process mark,
7618 respool those articles instead.
7620 Respooling can be done both from mail groups and \"real\" newsgroups.
7621 In the former case, the articles in question will be moved from the
7622 current group into whatever groups they are destined to. In the
7623 latter case, they will be copied into the relevant groups."
7625 (list current-prefix-arg
7626 (let* ((methods (gnus-methods-using 'respool))
7628 (symbol-name (or gnus-summary-respool-default-method
7629 (car (gnus-find-method-for-group
7630 gnus-newsgroup-name)))))
7632 (gnus-completing-read
7633 methname "What backend do you want to use when respooling?"
7634 methods nil t nil 'gnus-mail-method-history))
7637 ((zerop (length (setq ms (gnus-servers-using-backend
7639 (list (intern method) ""))
7643 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7644 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7647 (error "No method given for respooling"))
7648 (if (assoc (symbol-name
7649 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7650 (gnus-methods-using 'respool))
7651 (gnus-summary-move-article n nil method)
7652 (gnus-summary-copy-article n nil method)))
7654 (defun gnus-summary-import-article (file)
7655 "Import an arbitrary file into a mail newsgroup."
7656 (interactive "fImport file: ")
7657 (let ((group gnus-newsgroup-name)
7658 (now (current-time))
7660 (unless (gnus-check-backend-function 'request-accept-article group)
7661 (error "%s does not support article importing" group))
7662 (or (file-readable-p file)
7663 (not (file-regular-p file))
7664 (error "Can't read %s" file))
7666 (set-buffer (gnus-get-buffer-create " *import file*"))
7668 (nnheader-insert-file-contents file)
7669 (goto-char (point-min))
7670 (unless (nnheader-article-p)
7671 ;; This doesn't look like an article, so we fudge some headers.
7672 (setq atts (file-attributes file)
7673 lines (count-lines (point-min) (point-max)))
7674 (insert "From: " (read-string "From: ") "\n"
7675 "Subject: " (read-string "Subject: ") "\n"
7676 "Date: " (message-make-date (nth 5 atts))
7678 "Message-ID: " (message-make-message-id) "\n"
7679 "Lines: " (int-to-string lines) "\n"
7680 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7681 (gnus-request-accept-article group nil t)
7682 (kill-buffer (current-buffer)))))
7684 (defun gnus-summary-article-posted-p ()
7685 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7686 This will be the case if the article has both been mailed and posted."
7688 (let ((id (mail-header-references (gnus-summary-article-header)))
7689 (gnus-override-method
7690 (or gnus-refer-article-method gnus-select-method)))
7691 (if (gnus-request-head id "")
7692 (gnus-message 2 "The current message was found on %s"
7693 gnus-override-method)
7694 (gnus-message 2 "The current message couldn't be found on %s"
7695 gnus-override-method)
7698 (defun gnus-summary-expire-articles (&optional now)
7699 "Expire all articles that are marked as expirable in the current group."
7701 (when (gnus-check-backend-function
7702 'request-expire-articles gnus-newsgroup-name)
7703 ;; This backend supports expiry.
7704 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7705 (expirable (if total
7707 ;; We need to update the info for
7708 ;; this group for `gnus-list-of-read-articles'
7709 ;; to give us the right answer.
7710 (gnus-run-hooks 'gnus-exit-group-hook)
7711 (gnus-summary-update-info)
7712 (gnus-list-of-read-articles gnus-newsgroup-name))
7713 (setq gnus-newsgroup-expirable
7714 (sort gnus-newsgroup-expirable '<))))
7715 (expiry-wait (if now 'immediate
7716 (gnus-group-find-parameter
7717 gnus-newsgroup-name 'expiry-wait)))
7720 ;; There are expirable articles in this group, so we run them
7721 ;; through the expiry process.
7722 (gnus-message 6 "Expiring articles...")
7723 (unless (gnus-check-group gnus-newsgroup-name)
7724 (error "Can't open server for %s" gnus-newsgroup-name))
7725 ;; The list of articles that weren't expired is returned.
7728 (let ((nnmail-expiry-wait-function nil)
7729 (nnmail-expiry-wait expiry-wait))
7730 (setq es (gnus-request-expire-articles
7731 expirable gnus-newsgroup-name)))
7732 (setq es (gnus-request-expire-articles
7733 expirable gnus-newsgroup-name))))
7735 (setq gnus-newsgroup-expirable es))
7736 ;; We go through the old list of expirable, and mark all
7737 ;; really expired articles as nonexistent.
7738 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7739 (let ((gnus-use-cache nil))
7741 (unless (memq (car expirable) es)
7742 (when (gnus-data-find (car expirable))
7743 (gnus-summary-mark-article
7744 (car expirable) gnus-canceled-mark)))
7745 (setq expirable (cdr expirable)))))
7746 (gnus-message 6 "Expiring articles...done")))))
7748 (defun gnus-summary-expire-articles-now ()
7749 "Expunge all expirable articles in the current group.
7750 This means that *all* articles that are marked as expirable will be
7751 deleted forever, right now."
7753 (or gnus-expert-user
7755 "Are you really, really, really sure you want to delete all these messages? ")
7757 (gnus-summary-expire-articles t))
7759 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7760 (defun gnus-summary-delete-article (&optional n)
7761 "Delete the N next (mail) articles.
7762 This command actually deletes articles. This is not a marking
7763 command. The article will disappear forever from your life, never to
7765 If N is negative, delete backwards.
7766 If N is nil and articles have been marked with the process mark,
7767 delete these instead."
7769 (unless (gnus-check-backend-function 'request-expire-articles
7770 gnus-newsgroup-name)
7771 (error "The current newsgroup does not support article deletion"))
7772 ;; Compute the list of articles to delete.
7773 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7775 (if (and gnus-novice-user
7776 (not (gnus-yes-or-no-p
7777 (format "Do you really want to delete %s forever? "
7778 (if (> (length articles) 1)
7779 (format "these %s articles" (length articles))
7782 ;; Delete the articles.
7783 (setq not-deleted (gnus-request-expire-articles
7784 articles gnus-newsgroup-name 'force))
7786 (gnus-summary-remove-process-mark (car articles))
7787 ;; The backend might not have been able to delete the article
7789 (unless (memq (car articles) not-deleted)
7790 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7791 (setq articles (cdr articles)))
7793 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7794 (gnus-summary-position-point)
7795 (gnus-set-mode-line 'summary)
7798 (defun gnus-summary-edit-article (&optional force)
7799 "Edit the current article.
7800 This will have permanent effect only in mail groups.
7801 If FORCE is non-nil, allow editing of articles even in read-only
7805 (set-buffer gnus-summary-buffer)
7806 (let ((mail-parse-charset gnus-newsgroup-charset)
7807 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
7808 (gnus-set-global-variables)
7809 (when (and (not force)
7810 (gnus-group-read-only-p))
7811 (error "The current newsgroup does not support article editing"))
7812 (gnus-summary-show-article t)
7813 (gnus-article-edit-article
7815 `(lambda (no-highlight)
7816 (let ((mail-parse-charset ',gnus-newsgroup-charset)
7817 (mail-parse-ignored-charsets
7818 ',gnus-newsgroup-ignored-charsets))
7819 (gnus-summary-edit-article-done
7820 ,(or (mail-header-references gnus-current-headers) "")
7821 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7823 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7825 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7827 "Make edits to the current article permanent."
7829 ;; Replace the article.
7830 (let ((buf (current-buffer)))
7832 (insert-buffer-substring buf)
7833 (if (and (not read-only)
7834 (not (gnus-request-replace-article
7835 (cdr gnus-article-current) (car gnus-article-current)
7836 (current-buffer) t)))
7837 (error "Couldn't replace article")
7838 ;; Update the summary buffer.
7840 (equal (message-tokenize-header references " ")
7841 (message-tokenize-header
7842 (or (message-fetch-field "references") "") " ")))
7843 ;; We only have to update this line.
7846 (message-narrow-to-head)
7847 (let ((head (buffer-string))
7850 (insert (format "211 %d Article retrieved.\n"
7851 (cdr gnus-article-current)))
7854 (let ((nntp-server-buffer (current-buffer)))
7855 (setq header (car (gnus-get-newsgroup-headers
7857 (set-buffer gnus-summary-buffer)
7858 gnus-newsgroup-dependencies)
7861 (set-buffer gnus-summary-buffer)
7862 (gnus-data-set-header
7863 (gnus-data-find (cdr gnus-article-current))
7865 (gnus-summary-update-article-line
7866 (cdr gnus-article-current) header))))))
7868 (set-buffer (or buffer gnus-summary-buffer))
7869 (gnus-summary-update-article (cdr gnus-article-current)))
7870 ;; Prettify the article buffer again.
7871 (unless no-highlight
7873 (set-buffer gnus-article-buffer)
7874 ;;;!!! Fix this -- article should be rehighlighted.
7875 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7876 (set-buffer gnus-original-article-buffer)
7877 (gnus-request-article
7878 (cdr gnus-article-current)
7879 (car gnus-article-current) (current-buffer))))
7880 ;; Prettify the summary buffer line.
7881 (when (gnus-visual-p 'summary-highlight 'highlight)
7882 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7884 (defun gnus-summary-edit-wash (key)
7885 "Perform editing command KEY in the article buffer."
7889 (message "%s" (concat (this-command-keys) "- "))
7892 (gnus-summary-edit-article)
7893 (execute-kbd-macro (concat (this-command-keys) key))
7894 (gnus-article-edit-done))
7898 (defun gnus-summary-respool-query (&optional silent trace)
7899 "Query where the respool algorithm would put this article."
7901 (let (gnus-mark-article-hook)
7902 (gnus-summary-select-article)
7904 (set-buffer gnus-original-article-buffer)
7906 (message-narrow-to-head)
7907 (let ((groups (nnmail-article-group 'identity trace)))
7910 (message "This message would go to %s"
7911 (mapconcat 'car groups ", "))
7912 (message "This message would go to no groups"))
7915 (defun gnus-summary-respool-trace ()
7916 "Trace where the respool algorithm would put this article.
7917 Display a buffer showing all fancy splitting patterns which matched."
7919 (gnus-summary-respool-query nil t))
7921 ;; Summary marking commands.
7923 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7924 "Mark articles which has the same subject as read, and then select the next.
7925 If UNMARK is positive, remove any kind of mark.
7926 If UNMARK is negative, tick articles."
7929 (setq unmark (prefix-numeric-value unmark)))
7931 (gnus-summary-mark-same-subject
7932 (gnus-summary-article-subject) unmark)))
7933 ;; Select next unread article. If auto-select-same mode, should
7934 ;; select the first unread article.
7935 (gnus-summary-next-article t (and gnus-auto-select-same
7936 (gnus-summary-article-subject)))
7937 (gnus-message 7 "%d article%s marked as %s"
7938 count (if (= count 1) " is" "s are")
7939 (if unmark "unread" "read"))))
7941 (defun gnus-summary-kill-same-subject (&optional unmark)
7942 "Mark articles which has the same subject as read.
7943 If UNMARK is positive, remove any kind of mark.
7944 If UNMARK is negative, tick articles."
7947 (setq unmark (prefix-numeric-value unmark)))
7949 (gnus-summary-mark-same-subject
7950 (gnus-summary-article-subject) unmark)))
7951 ;; If marked as read, go to next unread subject.
7953 ;; Go to next unread subject.
7954 (gnus-summary-next-subject 1 t))
7955 (gnus-message 7 "%d articles are marked as %s"
7956 count (if unmark "unread" "read"))))
7958 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7959 "Mark articles with same SUBJECT as read, and return marked number.
7960 If optional argument UNMARK is positive, remove any kinds of marks.
7961 If optional argument UNMARK is negative, mark articles as unread instead."
7965 ((null unmark) ; Mark as read.
7968 (gnus-summary-mark-article-as-read gnus-killed-mark)
7969 (gnus-summary-show-thread) t)
7970 (gnus-summary-find-subject subject))
7971 (setq count (1+ count))))
7972 ((> unmark 0) ; Tick.
7975 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7976 (gnus-summary-show-thread) t)
7977 (gnus-summary-find-subject subject))
7978 (setq count (1+ count))))
7979 (t ; Mark as unread.
7982 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7983 (gnus-summary-show-thread) t)
7984 (gnus-summary-find-subject subject))
7985 (setq count (1+ count)))))
7986 (gnus-set-mode-line 'summary)
7987 ;; Return the number of marked articles.
7990 (defun gnus-summary-mark-as-processable (n &optional unmark)
7991 "Set the process mark on the next N articles.
7992 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7993 the process mark instead. The difference between N and the actual
7994 number of articles marked is returned."
7996 (let ((backward (< n 0))
8001 (gnus-summary-remove-process-mark
8002 (gnus-summary-article-number))
8003 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8004 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
8007 (gnus-message 7 "No more articles"))
8008 (gnus-summary-recenter)
8009 (gnus-summary-position-point)
8012 (defun gnus-summary-unmark-as-processable (n)
8013 "Remove the process mark from the next N articles.
8014 If N is negative, unmark backward instead. The difference between N and
8015 the actual number of articles unmarked is returned."
8017 (gnus-summary-mark-as-processable n t))
8019 (defun gnus-summary-unmark-all-processable ()
8020 "Remove the process mark from all articles."
8023 (while gnus-newsgroup-processable
8024 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
8025 (gnus-summary-position-point))
8027 (defun gnus-summary-mark-as-expirable (n)
8028 "Mark N articles forward as expirable.
8029 If N is negative, mark backward instead. The difference between N and
8030 the actual number of articles marked is returned."
8032 (gnus-summary-mark-forward n gnus-expirable-mark))
8034 (defun gnus-summary-mark-article-as-replied (article)
8035 "Mark ARTICLE replied and update the summary line."
8036 (push article gnus-newsgroup-replied)
8037 (let ((buffer-read-only nil))
8038 (when (gnus-summary-goto-subject article nil t)
8039 (gnus-summary-update-secondary-mark article))))
8041 (defun gnus-summary-set-bookmark (article)
8042 "Set a bookmark in current article."
8043 (interactive (list (gnus-summary-article-number)))
8044 (when (or (not (get-buffer gnus-article-buffer))
8045 (not gnus-current-article)
8046 (not gnus-article-current)
8047 (not (equal gnus-newsgroup-name (car gnus-article-current))))
8048 (error "No current article selected"))
8049 ;; Remove old bookmark, if one exists.
8050 (let ((old (assq article gnus-newsgroup-bookmarks)))
8052 (setq gnus-newsgroup-bookmarks
8053 (delq old gnus-newsgroup-bookmarks))))
8054 ;; Set the new bookmark, which is on the form
8055 ;; (article-number . line-number-in-body).
8059 (set-buffer gnus-article-buffer)
8063 (goto-char (point-min))
8064 (search-forward "\n\n" nil t)
8067 gnus-newsgroup-bookmarks)
8068 (gnus-message 6 "A bookmark has been added to the current article."))
8070 (defun gnus-summary-remove-bookmark (article)
8071 "Remove the bookmark from the current article."
8072 (interactive (list (gnus-summary-article-number)))
8073 ;; Remove old bookmark, if one exists.
8074 (let ((old (assq article gnus-newsgroup-bookmarks)))
8077 (setq gnus-newsgroup-bookmarks
8078 (delq old gnus-newsgroup-bookmarks))
8079 (gnus-message 6 "Removed bookmark."))
8080 (gnus-message 6 "No bookmark in current article."))))
8082 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8083 (defun gnus-summary-mark-as-dormant (n)
8084 "Mark N articles forward as dormant.
8085 If N is negative, mark backward instead. The difference between N and
8086 the actual number of articles marked is returned."
8088 (gnus-summary-mark-forward n gnus-dormant-mark))
8090 (defun gnus-summary-set-process-mark (article)
8091 "Set the process mark on ARTICLE and update the summary line."
8092 (setq gnus-newsgroup-processable
8094 (delq article gnus-newsgroup-processable)))
8095 (when (gnus-summary-goto-subject article)
8096 (gnus-summary-show-thread)
8097 (gnus-summary-goto-subject article)
8098 (gnus-summary-update-secondary-mark article)))
8100 (defun gnus-summary-remove-process-mark (article)
8101 "Remove the process mark from ARTICLE and update the summary line."
8102 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
8103 (when (gnus-summary-goto-subject article)
8104 (gnus-summary-show-thread)
8105 (gnus-summary-goto-subject article)
8106 (gnus-summary-update-secondary-mark article)))
8108 (defun gnus-summary-set-saved-mark (article)
8109 "Set the process mark on ARTICLE and update the summary line."
8110 (push article gnus-newsgroup-saved)
8111 (when (gnus-summary-goto-subject article)
8112 (gnus-summary-update-secondary-mark article)))
8114 (defun gnus-summary-mark-forward (n &optional mark no-expire)
8115 "Mark N articles as read forwards.
8116 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8117 The difference between N and the actual number of articles marked is
8120 (gnus-summary-show-thread)
8121 (let ((backward (< n 0))
8122 (gnus-summary-goto-unread
8123 (and gnus-summary-goto-unread
8124 (not (eq gnus-summary-goto-unread 'never))
8125 (not (memq mark (list gnus-unread-mark
8126 gnus-ticked-mark gnus-dormant-mark)))))
8128 (mark (or mark gnus-del-mark)))
8130 (gnus-summary-mark-article nil mark no-expire)
8131 (zerop (gnus-summary-next-subject
8133 (and gnus-summary-goto-unread
8134 (not (eq gnus-summary-goto-unread 'never)))
8138 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
8139 (gnus-summary-recenter)
8140 (gnus-summary-position-point)
8141 (gnus-set-mode-line 'summary)
8144 (defun gnus-summary-mark-article-as-read (mark)
8145 "Mark the current article quickly as read with MARK."
8146 (let ((article (gnus-summary-article-number)))
8147 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8148 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8149 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8150 (push (cons article mark) gnus-newsgroup-reads)
8151 ;; Possibly remove from cache, if that is used.
8152 (when gnus-use-cache
8153 (gnus-cache-enter-remove-article article))
8154 ;; Allow the backend to change the mark.
8155 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8156 ;; Check for auto-expiry.
8157 (when (and gnus-newsgroup-auto-expire
8158 (memq mark gnus-auto-expirable-marks))
8159 (setq mark gnus-expirable-mark)
8160 ;; Let the backend know about the mark change.
8161 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8162 (push article gnus-newsgroup-expirable))
8163 ;; Set the mark in the buffer.
8164 (gnus-summary-update-mark mark 'unread)
8167 (defun gnus-summary-mark-article-as-unread (mark)
8168 "Mark the current article quickly as unread with MARK."
8169 (let* ((article (gnus-summary-article-number))
8170 (old-mark (gnus-summary-article-mark article)))
8171 ;; Allow the backend to change the mark.
8172 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8173 (if (eq mark old-mark)
8177 (gnus-error 1 "Can't mark negative article numbers")
8179 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8180 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8181 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
8182 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
8183 (cond ((= mark gnus-ticked-mark)
8184 (push article gnus-newsgroup-marked))
8185 ((= mark gnus-dormant-mark)
8186 (push article gnus-newsgroup-dormant))
8188 (push article gnus-newsgroup-unreads)))
8189 (gnus-pull article gnus-newsgroup-reads)
8191 ;; See whether the article is to be put in the cache.
8193 (vectorp (gnus-summary-article-header article))
8195 (gnus-cache-possibly-enter-article
8196 gnus-newsgroup-name article
8197 (gnus-summary-article-header article)
8198 (= mark gnus-ticked-mark)
8199 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8202 (gnus-summary-update-mark mark 'unread)
8205 (defun gnus-summary-mark-article (&optional article mark no-expire)
8206 "Mark ARTICLE with MARK. MARK can be any character.
8207 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8208 `??' (dormant) and `?E' (expirable).
8209 If MARK is nil, then the default character `?r' is used.
8210 If ARTICLE is nil, then the article on the current line will be
8212 ;; The mark might be a string.
8213 (when (stringp mark)
8214 (setq mark (aref mark 0)))
8215 ;; If no mark is given, then we check auto-expiring.
8217 (setq mark gnus-del-mark))
8218 (when (and (not no-expire)
8219 gnus-newsgroup-auto-expire
8220 (memq mark gnus-auto-expirable-marks))
8221 (setq mark gnus-expirable-mark))
8222 (let ((article (or article (gnus-summary-article-number)))
8223 (old-mark (gnus-summary-article-mark article)))
8224 ;; Allow the backend to change the mark.
8225 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8226 (if (eq mark old-mark)
8229 (error "No article on current line"))
8230 (if (not (if (or (= mark gnus-unread-mark)
8231 (= mark gnus-ticked-mark)
8232 (= mark gnus-dormant-mark))
8233 (gnus-mark-article-as-unread article mark)
8234 (gnus-mark-article-as-read article mark)))
8236 ;; See whether the article is to be put in the cache.
8238 (not (= mark gnus-canceled-mark))
8239 (vectorp (gnus-summary-article-header article))
8241 (gnus-cache-possibly-enter-article
8242 gnus-newsgroup-name article
8243 (gnus-summary-article-header article)
8244 (= mark gnus-ticked-mark)
8245 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8247 (when (gnus-summary-goto-subject article nil t)
8248 (let ((buffer-read-only nil))
8249 (gnus-summary-show-thread)
8251 (gnus-summary-update-mark mark 'unread)
8254 (defun gnus-summary-update-secondary-mark (article)
8255 "Update the secondary (read, process, cache) mark."
8256 (gnus-summary-update-mark
8257 (cond ((memq article gnus-newsgroup-processable)
8259 ((memq article gnus-newsgroup-cached)
8261 ((memq article gnus-newsgroup-replied)
8263 ((memq article gnus-newsgroup-saved)
8265 (t gnus-unread-mark))
8267 (when (gnus-visual-p 'summary-highlight 'highlight)
8268 (gnus-run-hooks 'gnus-summary-update-hook))
8271 (defun gnus-summary-update-mark (mark type)
8272 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
8273 (buffer-read-only nil))
8274 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
8276 (when (looking-at "\r")
8278 (when (<= (+ forward (point)) (point-max))
8279 ;; Go to the right position on the line.
8280 (goto-char (+ forward (point)))
8281 ;; Replace the old mark with the new mark.
8282 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
8283 ;; Optionally update the marks by some user rule.
8284 (when (eq type 'unread)
8286 (gnus-data-find (gnus-summary-article-number)) mark)
8287 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
8289 (defun gnus-mark-article-as-read (article &optional mark)
8290 "Enter ARTICLE in the pertinent lists and remove it from others."
8291 ;; Make the article expirable.
8292 (let ((mark (or mark gnus-del-mark)))
8293 (if (= mark gnus-expirable-mark)
8294 (push article gnus-newsgroup-expirable)
8295 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8296 ;; Remove from unread and marked lists.
8297 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8298 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8299 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8300 (push (cons article mark) gnus-newsgroup-reads)
8301 ;; Possibly remove from cache, if that is used.
8302 (when gnus-use-cache
8303 (gnus-cache-enter-remove-article article))
8306 (defun gnus-mark-article-as-unread (article &optional mark)
8307 "Enter ARTICLE in the pertinent lists and remove it from others."
8308 (let ((mark (or mark gnus-ticked-mark)))
8311 (gnus-error 1 "Can't mark negative article numbers")
8313 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8314 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8315 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8316 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8318 ;; Unsuppress duplicates?
8319 (when gnus-suppress-duplicates
8320 (gnus-dup-unsuppress-article article))
8322 (cond ((= mark gnus-ticked-mark)
8323 (push article gnus-newsgroup-marked))
8324 ((= mark gnus-dormant-mark)
8325 (push article gnus-newsgroup-dormant))
8327 (push article gnus-newsgroup-unreads)))
8328 (gnus-pull article gnus-newsgroup-reads)
8331 (defalias 'gnus-summary-mark-as-unread-forward
8332 'gnus-summary-tick-article-forward)
8333 (make-obsolete 'gnus-summary-mark-as-unread-forward
8334 'gnus-summary-tick-article-forward)
8335 (defun gnus-summary-tick-article-forward (n)
8336 "Tick N articles forwards.
8337 If N is negative, tick backwards instead.
8338 The difference between N and the number of articles ticked is returned."
8340 (gnus-summary-mark-forward n gnus-ticked-mark))
8342 (defalias 'gnus-summary-mark-as-unread-backward
8343 'gnus-summary-tick-article-backward)
8344 (make-obsolete 'gnus-summary-mark-as-unread-backward
8345 'gnus-summary-tick-article-backward)
8346 (defun gnus-summary-tick-article-backward (n)
8347 "Tick N articles backwards.
8348 The difference between N and the number of articles ticked is returned."
8350 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8352 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8353 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8354 (defun gnus-summary-tick-article (&optional article clear-mark)
8355 "Mark current article as unread.
8356 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8357 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8359 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8362 (defun gnus-summary-mark-as-read-forward (n)
8363 "Mark N articles as read forwards.
8364 If N is negative, mark backwards instead.
8365 The difference between N and the actual number of articles marked is
8368 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8370 (defun gnus-summary-mark-as-read-backward (n)
8371 "Mark the N articles as read backwards.
8372 The difference between N and the actual number of articles marked is
8375 (gnus-summary-mark-forward
8376 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8378 (defun gnus-summary-mark-as-read (&optional article mark)
8379 "Mark current article as read.
8380 ARTICLE specifies the article to be marked as read.
8381 MARK specifies a string to be inserted at the beginning of the line."
8382 (gnus-summary-mark-article article mark))
8384 (defun gnus-summary-clear-mark-forward (n)
8385 "Clear marks from N articles forward.
8386 If N is negative, clear backward instead.
8387 The difference between N and the number of marks cleared is returned."
8389 (gnus-summary-mark-forward n gnus-unread-mark))
8391 (defun gnus-summary-clear-mark-backward (n)
8392 "Clear marks from N articles backward.
8393 The difference between N and the number of marks cleared is returned."
8395 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8397 (defun gnus-summary-mark-unread-as-read ()
8398 "Intended to be used by `gnus-summary-mark-article-hook'."
8399 (when (memq gnus-current-article gnus-newsgroup-unreads)
8400 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8402 (defun gnus-summary-mark-read-and-unread-as-read ()
8403 "Intended to be used by `gnus-summary-mark-article-hook'."
8404 (let ((mark (gnus-summary-article-mark)))
8405 (when (or (gnus-unread-mark-p mark)
8406 (gnus-read-mark-p mark))
8407 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8409 (defun gnus-summary-mark-region-as-read (point mark all)
8410 "Mark all unread articles between point and mark as read.
8411 If given a prefix, mark all articles between point and mark as read,
8412 even ticked and dormant ones."
8413 (interactive "r\nP")
8422 (memq (setq article (gnus-summary-article-number))
8423 gnus-newsgroup-unreads))
8424 (gnus-summary-mark-article article gnus-del-mark))
8426 (gnus-summary-find-next))))))
8428 (defun gnus-summary-mark-below (score mark)
8429 "Mark articles with score less than SCORE with MARK."
8430 (interactive "P\ncMark: ")
8431 (setq score (if score
8432 (prefix-numeric-value score)
8433 (or gnus-summary-default-score 0)))
8435 (set-buffer gnus-summary-buffer)
8436 (goto-char (point-min))
8439 (and (< (gnus-summary-article-score) score)
8440 (gnus-summary-mark-article nil mark))
8441 (gnus-summary-find-next)))))
8443 (defun gnus-summary-kill-below (&optional score)
8444 "Mark articles with score below SCORE as read."
8446 (gnus-summary-mark-below score gnus-killed-mark))
8448 (defun gnus-summary-clear-above (&optional score)
8449 "Clear all marks from articles with score above SCORE."
8451 (gnus-summary-mark-above score gnus-unread-mark))
8453 (defun gnus-summary-tick-above (&optional score)
8454 "Tick all articles with score above SCORE."
8456 (gnus-summary-mark-above score gnus-ticked-mark))
8458 (defun gnus-summary-mark-above (score mark)
8459 "Mark articles with score over SCORE with MARK."
8460 (interactive "P\ncMark: ")
8461 (setq score (if score
8462 (prefix-numeric-value score)
8463 (or gnus-summary-default-score 0)))
8465 (set-buffer gnus-summary-buffer)
8466 (goto-char (point-min))
8468 (when (> (gnus-summary-article-score) score)
8469 (gnus-summary-mark-article nil mark))
8471 (gnus-summary-find-next)))))
8473 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8474 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8475 (defun gnus-summary-limit-include-expunged (&optional no-error)
8476 "Display all the hidden articles that were expunged for low scores."
8478 (let ((buffer-read-only nil))
8479 (let ((scored gnus-newsgroup-scored)
8482 (unless (gnus-summary-goto-subject (caar scored))
8483 (and (setq h (gnus-summary-article-header (caar scored)))
8484 (< (cdar scored) gnus-summary-expunge-below)
8486 (setq scored (cdr scored)))
8488 (when (not no-error)
8489 (error "No expunged articles hidden"))
8490 (goto-char (point-min))
8491 (gnus-summary-prepare-unthreaded (nreverse headers))
8492 (goto-char (point-min))
8493 (gnus-summary-position-point)
8496 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8497 "Mark all unread articles in this newsgroup as read.
8498 If prefix argument ALL is non-nil, ticked and dormant articles will
8499 also be marked as read.
8500 If QUIETLY is non-nil, no questions will be asked.
8501 If TO-HERE is non-nil, it should be a point in the buffer. All
8502 articles before this point will be marked as read.
8503 Note that this function will only catch up the unread article
8504 in the current summary buffer limitation.
8505 The number of articles marked as read is returned."
8510 (not gnus-interactive-catchup) ;Without confirmation?
8514 "Mark absolutely all articles as read? "
8515 "Mark all unread articles as read? ")))
8517 (not gnus-newsgroup-adaptive)
8518 (not gnus-newsgroup-auto-expire)
8519 (not gnus-suppress-duplicates)
8520 (or (not gnus-use-cache)
8521 (eq gnus-use-cache 'passive)))
8524 (setq gnus-newsgroup-marked nil
8525 gnus-newsgroup-dormant nil))
8526 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8527 ;; We actually mark all articles as canceled, which we
8528 ;; have to do when using auto-expiry or adaptive scoring.
8529 (gnus-summary-show-all-threads)
8530 (when (gnus-summary-first-subject (not all) t)
8532 (if to-here (< (point) to-here) t)
8533 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8534 (gnus-summary-find-next (not all) nil nil t))))
8535 (gnus-set-mode-line 'summary))
8537 (gnus-summary-position-point)))
8539 (defun gnus-summary-catchup-to-here (&optional all)
8540 "Mark all unticked articles before the current one as read.
8541 If ALL is non-nil, also mark ticked and dormant articles as read."
8544 (gnus-save-hidden-threads
8545 (let ((beg (point)))
8546 ;; We check that there are unread articles.
8547 (when (or all (gnus-summary-find-prev))
8548 (gnus-summary-catchup all t beg)))))
8549 (gnus-summary-position-point))
8551 (defun gnus-summary-catchup-all (&optional quietly)
8552 "Mark all articles in this newsgroup as read."
8554 (gnus-summary-catchup t quietly))
8556 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8557 "Mark all unread articles in this group as read, then exit.
8558 If prefix argument ALL is non-nil, all articles are marked as read."
8560 (when (gnus-summary-catchup all quietly nil 'fast)
8561 ;; Select next newsgroup or exit.
8562 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8563 (eq gnus-auto-select-next 'quietly))
8564 (gnus-summary-next-group nil)
8565 (gnus-summary-exit))))
8567 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8568 "Mark all articles in this newsgroup as read, and then exit."
8570 (gnus-summary-catchup-and-exit t quietly))
8572 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8573 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8574 "Mark all articles in this group as read and select the next group.
8575 If given a prefix, mark all articles, unread as well as ticked, as
8579 (gnus-summary-catchup all))
8580 (gnus-summary-next-group t nil nil))
8582 ;; Thread-based commands.
8584 (defun gnus-summary-articles-in-thread (&optional article)
8585 "Return a list of all articles in the current thread.
8586 If ARTICLE is non-nil, return all articles in the thread that starts
8588 (let* ((article (or article (gnus-summary-article-number)))
8589 (data (gnus-data-find-list article))
8590 (top-level (gnus-data-level (car data)))
8592 (cond ((null gnus-thread-operation-ignore-subject)
8593 (gnus-simplify-subject-re
8594 (mail-header-subject (gnus-data-header (car data)))))
8595 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8596 (gnus-simplify-subject-fuzzy
8597 (mail-header-subject (gnus-data-header (car data)))))
8599 (end-point (save-excursion
8600 (if (gnus-summary-go-to-next-thread)
8601 (point) (point-max))))
8604 (< (gnus-data-pos (car data)) end-point))
8605 (when (or (not top-subject)
8606 (string= top-subject
8607 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8608 (gnus-simplify-subject-fuzzy
8609 (mail-header-subject
8610 (gnus-data-header (car data))))
8611 (gnus-simplify-subject-re
8612 (mail-header-subject
8613 (gnus-data-header (car data)))))))
8614 (push (gnus-data-number (car data)) articles))
8615 (unless (and (setq data (cdr data))
8616 (> (gnus-data-level (car data)) top-level))
8618 ;; Return the list of articles.
8619 (nreverse articles)))
8621 (defun gnus-summary-rethread-current ()
8622 "Rethread the thread the current article is part of."
8624 (let* ((gnus-show-threads t)
8625 (article (gnus-summary-article-number))
8626 (id (mail-header-id (gnus-summary-article-header)))
8627 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8629 (error "No article on the current line"))
8630 (gnus-rebuild-thread id)
8631 (gnus-summary-goto-subject article)))
8633 (defun gnus-summary-reparent-thread ()
8634 "Make the current article child of the marked (or previous) article.
8636 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8637 is non-nil or the Subject: of both articles are the same."
8639 (unless (not (gnus-group-read-only-p))
8640 (error "The current newsgroup does not support article editing"))
8641 (unless (<= (length gnus-newsgroup-processable) 1)
8642 (error "No more than one article may be marked"))
8643 (save-window-excursion
8644 (let ((gnus-article-buffer " *reparent*")
8645 (current-article (gnus-summary-article-number))
8646 ;; First grab the marked article, otherwise one line up.
8647 (parent-article (if (not (null gnus-newsgroup-processable))
8648 (car gnus-newsgroup-processable)
8650 (if (eq (forward-line -1) 0)
8651 (gnus-summary-article-number)
8652 (error "Beginning of summary buffer"))))))
8653 (unless (not (eq current-article parent-article))
8654 (error "An article may not be self-referential"))
8655 (let ((message-id (mail-header-id
8656 (gnus-summary-article-header parent-article))))
8657 (unless (and message-id (not (equal message-id "")))
8658 (error "No message-id in desired parent"))
8659 (gnus-with-article current-article
8660 (goto-char (point-min))
8661 (if (re-search-forward "^References: " nil t)
8663 (re-search-forward "^[^ \t]" nil t)
8666 (insert " " message-id))
8667 (insert "References: " message-id "\n")))
8668 (set-buffer gnus-summary-buffer)
8669 (gnus-summary-unmark-all-processable)
8670 (gnus-summary-update-article current-article)
8671 (gnus-summary-rethread-current)
8672 (gnus-message 3 "Article %d is now the child of article %d"
8673 current-article parent-article)))))
8675 (defun gnus-summary-toggle-threads (&optional arg)
8676 "Toggle showing conversation threads.
8677 If ARG is positive number, turn showing conversation threads on."
8679 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8680 (setq gnus-show-threads
8681 (if (null arg) (not gnus-show-threads)
8682 (> (prefix-numeric-value arg) 0)))
8683 (gnus-summary-prepare)
8684 (gnus-summary-goto-subject current)
8685 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8686 (gnus-summary-position-point)))
8688 (defun gnus-summary-show-all-threads ()
8692 (let ((buffer-read-only nil))
8693 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8694 (gnus-summary-position-point))
8696 (defun gnus-summary-show-thread ()
8697 "Show thread subtrees.
8698 Returns nil if no thread was there to be shown."
8700 (let ((buffer-read-only nil)
8702 ;; first goto end then to beg, to have point at beg after let
8703 (end (progn (end-of-line) (point)))
8704 (beg (progn (beginning-of-line) (point))))
8706 ;; Any hidden lines here?
8707 (search-forward "\r" end t)
8708 (subst-char-in-region beg end ?\^M ?\n t)
8710 (gnus-summary-position-point))))
8712 (defun gnus-summary-hide-all-threads ()
8713 "Hide all thread subtrees."
8716 (goto-char (point-min))
8717 (gnus-summary-hide-thread)
8718 (while (zerop (gnus-summary-next-thread 1 t))
8719 (gnus-summary-hide-thread)))
8720 (gnus-summary-position-point))
8722 (defun gnus-summary-hide-thread ()
8723 "Hide thread subtrees.
8724 Returns nil if no threads were there to be hidden."
8726 (let ((buffer-read-only nil)
8728 (article (gnus-summary-article-number)))
8730 ;; Go forward until either the buffer ends or the subthread
8732 (when (and (not (eobp))
8733 (or (zerop (gnus-summary-next-thread 1 t))
8734 (goto-char (point-max))))
8736 (if (and (> (point) start)
8737 (search-backward "\n" start t))
8739 (subst-char-in-region start (point) ?\n ?\^M)
8740 (gnus-summary-goto-subject article))
8743 ;;(gnus-summary-position-point)
8746 (defun gnus-summary-go-to-next-thread (&optional previous)
8747 "Go to the same level (or less) next thread.
8748 If PREVIOUS is non-nil, go to previous thread instead.
8749 Return the article number moved to, or nil if moving was impossible."
8750 (let ((level (gnus-summary-thread-level))
8751 (way (if previous -1 1))
8754 (while (and (not (eobp))
8755 (< level (gnus-summary-thread-level)))
8763 (gnus-summary-article-number)
8766 (defun gnus-summary-next-thread (n &optional silent)
8767 "Go to the same level next N'th thread.
8768 If N is negative, search backward instead.
8769 Returns the difference between N and the number of skips actually
8772 If SILENT, don't output messages."
8774 (let ((backward (< n 0))
8777 (gnus-summary-go-to-next-thread backward))
8780 (gnus-summary-position-point))
8781 (when (and (not silent) (/= 0 n))
8782 (gnus-message 7 "No more threads"))
8785 (defun gnus-summary-prev-thread (n)
8786 "Go to the same level previous N'th thread.
8787 Returns the difference between N and the number of skips actually
8790 (gnus-summary-next-thread (- n)))
8792 (defun gnus-summary-go-down-thread ()
8793 "Go down one level in the current thread."
8794 (let ((children (gnus-summary-article-children)))
8796 (gnus-summary-goto-subject (car children)))))
8798 (defun gnus-summary-go-up-thread ()
8799 "Go up one level in the current thread."
8800 (let ((parent (gnus-summary-article-parent)))
8802 (gnus-summary-goto-subject parent))))
8804 (defun gnus-summary-down-thread (n)
8805 "Go down thread N steps.
8806 If N is negative, go up instead.
8807 Returns the difference between N and how many steps down that were
8813 (if up (gnus-summary-go-up-thread)
8814 (gnus-summary-go-down-thread)))
8816 (gnus-summary-position-point)
8818 (gnus-message 7 "Can't go further"))
8821 (defun gnus-summary-up-thread (n)
8822 "Go up thread N steps.
8823 If N is negative, go up instead.
8824 Returns the difference between N and how many steps down that were
8827 (gnus-summary-down-thread (- n)))
8829 (defun gnus-summary-top-thread ()
8830 "Go to the top of the thread."
8832 (while (gnus-summary-go-up-thread))
8833 (gnus-summary-article-number))
8835 (defun gnus-summary-kill-thread (&optional unmark)
8836 "Mark articles under current thread as read.
8837 If the prefix argument is positive, remove any kinds of marks.
8838 If the prefix argument is negative, tick articles instead."
8841 (setq unmark (prefix-numeric-value unmark)))
8842 (let ((articles (gnus-summary-articles-in-thread)))
8844 ;; Expand the thread.
8845 (gnus-summary-show-thread)
8846 ;; Mark all the articles.
8848 (gnus-summary-goto-subject (car articles))
8849 (cond ((null unmark)
8850 (gnus-summary-mark-article-as-read gnus-killed-mark))
8852 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8854 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8855 (setq articles (cdr articles))))
8856 ;; Hide killed subtrees.
8858 gnus-thread-hide-killed
8859 (gnus-summary-hide-thread))
8860 ;; If marked as read, go to next unread subject.
8862 ;; Go to next unread subject.
8863 (gnus-summary-next-subject 1 t)))
8864 (gnus-set-mode-line 'summary))
8866 ;; Summary sorting commands
8868 (defun gnus-summary-sort-by-number (&optional reverse)
8869 "Sort the summary buffer by article number.
8870 Argument REVERSE means reverse order."
8872 (gnus-summary-sort 'number reverse))
8874 (defun gnus-summary-sort-by-author (&optional reverse)
8875 "Sort the summary buffer by author name alphabetically.
8876 If case-fold-search is non-nil, case of letters is ignored.
8877 Argument REVERSE means reverse order."
8879 (gnus-summary-sort 'author reverse))
8881 (defun gnus-summary-sort-by-subject (&optional reverse)
8882 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8883 If case-fold-search is non-nil, case of letters is ignored.
8884 Argument REVERSE means reverse order."
8886 (gnus-summary-sort 'subject reverse))
8888 (defun gnus-summary-sort-by-date (&optional reverse)
8889 "Sort the summary buffer by date.
8890 Argument REVERSE means reverse order."
8892 (gnus-summary-sort 'date reverse))
8894 (defun gnus-summary-sort-by-score (&optional reverse)
8895 "Sort the summary buffer by score.
8896 Argument REVERSE means reverse order."
8898 (gnus-summary-sort 'score reverse))
8900 (defun gnus-summary-sort-by-lines (&optional reverse)
8901 "Sort the summary buffer by the number of lines.
8902 Argument REVERSE means reverse order."
8904 (gnus-summary-sort 'lines reverse))
8906 (defun gnus-summary-sort-by-chars (&optional reverse)
8907 "Sort the summary buffer by article length.
8908 Argument REVERSE means reverse order."
8910 (gnus-summary-sort 'chars reverse))
8912 (defun gnus-summary-sort (predicate reverse)
8913 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8914 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8915 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8916 (gnus-thread-sort-functions
8921 (gnus-article-sort-functions
8927 (gnus-summary-prepare-hook nil))
8928 ;; We do the sorting by regenerating the threads.
8929 (gnus-summary-prepare)
8930 ;; Hide subthreads if needed.
8931 (when (and gnus-show-threads gnus-thread-hide-subtree)
8932 (gnus-summary-hide-all-threads))))
8934 ;; Summary saving commands.
8936 (defun gnus-summary-save-article (&optional n not-saved)
8937 "Save the current article using the default saver function.
8938 If N is a positive number, save the N next articles.
8939 If N is a negative number, save the N previous articles.
8940 If N is nil and any articles have been marked with the process mark,
8941 save those articles instead.
8942 The variable `gnus-default-article-saver' specifies the saver function."
8944 (let* ((articles (gnus-summary-work-articles n))
8945 (save-buffer (save-excursion
8946 (nnheader-set-temp-buffer " *Gnus Save*")))
8947 (num (length articles))
8949 (dolist (article articles)
8950 (setq header (gnus-summary-article-header article))
8951 (if (not (vectorp header))
8952 ;; This is a pseudo-article.
8953 (if (assq 'name header)
8954 (gnus-copy-file (cdr (assq 'name header)))
8955 (gnus-message 1 "Article %d is unsaveable" article))
8956 ;; This is a real article.
8957 (save-window-excursion
8958 (gnus-summary-select-article t nil nil article))
8960 (set-buffer save-buffer)
8962 (insert-buffer-substring gnus-original-article-buffer))
8963 (setq file (gnus-article-save save-buffer file num))
8964 (gnus-summary-remove-process-mark article)
8966 (gnus-summary-set-saved-mark article))))
8967 (gnus-kill-buffer save-buffer)
8968 (gnus-summary-position-point)
8969 (gnus-set-mode-line 'summary)
8972 (defun gnus-summary-pipe-output (&optional arg)
8973 "Pipe the current article to a subprocess.
8974 If N is a positive number, pipe the N next articles.
8975 If N is a negative number, pipe the N previous articles.
8976 If N is nil and any articles have been marked with the process mark,
8977 pipe those articles instead."
8979 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8980 (gnus-summary-save-article arg t))
8981 (gnus-configure-windows 'pipe))
8983 (defun gnus-summary-save-article-mail (&optional arg)
8984 "Append the current article to an mail file.
8985 If N is a positive number, save the N next articles.
8986 If N is a negative number, save the N previous articles.
8987 If N is nil and any articles have been marked with the process mark,
8988 save those articles instead."
8990 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8991 (gnus-summary-save-article arg)))
8993 (defun gnus-summary-save-article-rmail (&optional arg)
8994 "Append the current article to an rmail file.
8995 If N is a positive number, save the N next articles.
8996 If N is a negative number, save the N previous articles.
8997 If N is nil and any articles have been marked with the process mark,
8998 save those articles instead."
9000 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
9001 (gnus-summary-save-article arg)))
9003 (defun gnus-summary-save-article-file (&optional arg)
9004 "Append the current article to a file.
9005 If N is a positive number, save the N next articles.
9006 If N is a negative number, save the N previous articles.
9007 If N is nil and any articles have been marked with the process mark,
9008 save those articles instead."
9010 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
9011 (gnus-summary-save-article arg)))
9013 (defun gnus-summary-write-article-file (&optional arg)
9014 "Write the current article to a file, deleting the previous file.
9015 If N is a positive number, save the N next articles.
9016 If N is a negative number, save the N previous articles.
9017 If N is nil and any articles have been marked with the process mark,
9018 save those articles instead."
9020 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
9021 (gnus-summary-save-article arg)))
9023 (defun gnus-summary-save-article-body-file (&optional arg)
9024 "Append the current article body to a file.
9025 If N is a positive number, save the N next articles.
9026 If N is a negative number, save the N previous articles.
9027 If N is nil and any articles have been marked with the process mark,
9028 save those articles instead."
9030 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
9031 (gnus-summary-save-article arg)))
9033 (defun gnus-summary-pipe-message (program)
9034 "Pipe the current article through PROGRAM."
9035 (interactive "sProgram: ")
9036 (gnus-summary-select-article)
9037 (let ((mail-header-separator ""))
9038 (gnus-eval-in-buffer-window gnus-article-buffer
9041 (let ((start (window-start))
9043 (message-pipe-buffer-body program)
9044 (set-window-start (get-buffer-window (current-buffer)) start))))))
9046 (defun gnus-get-split-value (methods)
9047 "Return a value based on the split METHODS."
9048 (let (split-name method result match)
9051 (set-buffer gnus-original-article-buffer)
9053 (nnheader-narrow-to-headers)
9055 (goto-char (point-min))
9056 (setq method (pop methods))
9057 (setq match (car method))
9060 ;; Regular expression.
9062 (re-search-forward match nil t)))
9063 ((gnus-functionp match)
9067 (setq result (funcall match gnus-newsgroup-name))))
9072 (setq result (eval match)))))
9073 (setq split-name (append (cdr method) split-name))
9074 (cond ((stringp result)
9075 (push (expand-file-name
9076 result gnus-article-save-directory)
9079 (setq split-name (append result split-name)))))))))
9080 (nreverse split-name)))
9082 (defun gnus-valid-move-group-p (group)
9085 (symbol-value group)
9086 (gnus-get-function (gnus-find-method-for-group
9087 (symbol-name group)) 'request-accept-article t)))
9089 (defun gnus-read-move-group-name (prompt default articles prefix)
9090 "Read a group name."
9091 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
9092 (minibuffer-confirm-incomplete nil) ; XEmacs
9096 (if (> (length articles) 1)
9097 (format "these %d articles" (length articles))
9102 (gnus-completing-read default prom
9104 'gnus-valid-move-group-p
9106 'gnus-group-history))
9107 ((= 1 (length split-name))
9108 (gnus-completing-read (car split-name) prom
9110 'gnus-valid-move-group-p
9112 'gnus-group-history))
9114 (gnus-completing-read nil prom
9115 (mapcar (lambda (el) (list el))
9116 (nreverse split-name))
9118 'gnus-group-history)))))
9120 (if (or (string= to-newsgroup "")
9121 (string= to-newsgroup prefix))
9122 (setq to-newsgroup default))
9123 (unless to-newsgroup
9124 (error "No group name entered"))
9125 (or (gnus-active to-newsgroup)
9126 (gnus-activate-group to-newsgroup)
9127 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9129 (or (and (gnus-request-create-group
9130 to-newsgroup (gnus-group-name-to-method to-newsgroup))
9131 (gnus-activate-group to-newsgroup nil nil
9132 (gnus-group-name-to-method
9134 (error "Couldn't create group %s" to-newsgroup)))
9135 (error "No such group: %s" to-newsgroup)))
9138 (defun gnus-summary-save-parts (type dir n reverse)
9139 "Save parts matching TYPE to DIR.
9140 If REVERSE, save parts that do not match TYPE."
9142 (list (read-string "Save parts of type: " "image/.*")
9143 (read-file-name "Save to directory: " t nil t)
9144 current-prefix-arg))
9145 (gnus-summary-iterate n
9146 (let ((gnus-display-mime-function nil)
9147 (gnus-inhibit-treatment t))
9148 (gnus-summary-select-article))
9150 (set-buffer gnus-article-buffer)
9151 (let ((handles (or (mm-dissect-buffer) (mm-uu-dissect))))
9153 (gnus-summary-save-parts-1 type dir handles reverse)
9154 (mm-destroy-parts handles))))))
9156 (defun gnus-summary-save-parts-1 (type dir handle reverse)
9157 (if (stringp (car handle))
9158 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
9161 (not (string-match type (mm-handle-media-type handle)))
9162 (string-match type (mm-handle-media-type handle)))
9163 (let ((file (expand-file-name
9164 (file-name-nondirectory
9166 (mail-content-type-get
9167 (mm-handle-disposition handle) 'filename)
9168 (concat gnus-newsgroup-name "." gnus-current-article)))
9170 (unless (file-exists-p file)
9171 (mm-save-part-to-file handle file))))))
9173 ;; Summary extract commands
9175 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
9176 (let ((buffer-read-only nil)
9177 (article (gnus-summary-article-number))
9179 (unless (gnus-summary-goto-subject article)
9180 (error "No such article: %d" article))
9181 (gnus-summary-position-point)
9182 ;; If all commands are to be bunched up on one line, we collect
9184 (unless gnus-view-pseudos-separately
9185 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
9188 (setq action (cdr (assq 'action (car ps))))
9189 (setq files (list (cdr (assq 'name (car ps)))))
9190 (while (and ps (cdr ps)
9191 (string= (or action "1")
9192 (or (cdr (assq 'action (cadr ps))) "2")))
9193 (push (cdr (assq 'name (cadr ps))) files)
9194 (setcdr ps (cddr ps)))
9196 (when (not (string-match "%s" action))
9199 (when (assq 'execute (car ps))
9200 (setcdr (assq 'execute (car ps))
9201 (funcall (if (string-match "%s" action)
9208 (gnus-quote-arg-for-sh-or-csh f)))
9210 (setq ps (cdr ps)))))
9211 (if (and gnus-view-pseudos (not not-view))
9213 (when (assq 'execute (car pslist))
9214 (gnus-execute-command (cdr (assq 'execute (car pslist)))
9215 (eq gnus-view-pseudos 'not-confirm)))
9216 (setq pslist (cdr pslist)))
9219 (setq after-article (or (cdr (assq 'article (car pslist)))
9220 (gnus-summary-article-number)))
9221 (gnus-summary-goto-subject after-article)
9224 (insert " " (file-name-nondirectory
9225 (cdr (assq 'name (car pslist))))
9226 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
9228 (forward-line -1) ; back to `b'
9229 (gnus-add-text-properties
9230 b (1- e) (list 'gnus-number gnus-reffed-article-number
9231 gnus-mouse-face-prop gnus-mouse-face))
9233 after-article gnus-reffed-article-number
9234 gnus-unread-mark b (car pslist) 0 (- e b))
9235 (push gnus-reffed-article-number gnus-newsgroup-unreads)
9236 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
9237 (setq pslist (cdr pslist)))))))
9239 (defun gnus-pseudos< (p1 p2)
9240 (let ((c1 (cdr (assq 'action p1)))
9241 (c2 (cdr (assq 'action p2))))
9242 (and c1 c2 (string< c1 c2))))
9244 (defun gnus-request-pseudo-article (props)
9245 (cond ((assq 'execute props)
9246 (gnus-execute-command (cdr (assq 'execute props)))))
9247 (let ((gnus-current-article (gnus-summary-article-number)))
9248 (gnus-run-hooks 'gnus-mark-article-hook)))
9250 (defun gnus-execute-command (command &optional automatic)
9252 (gnus-article-setup-buffer)
9253 (set-buffer gnus-article-buffer)
9254 (setq buffer-read-only nil)
9255 (let ((command (if automatic command
9256 (read-string "Command: " (cons command 0)))))
9258 (insert "$ " command "\n\n")
9259 (if gnus-view-pseudo-asynchronously
9260 (start-process "gnus-execute" (current-buffer) shell-file-name
9261 shell-command-switch command)
9262 (call-process shell-file-name nil t nil
9263 shell-command-switch command)))))
9265 ;; Summary kill commands.
9267 (defun gnus-summary-edit-global-kill (article)
9268 "Edit the \"global\" kill file."
9269 (interactive (list (gnus-summary-article-number)))
9270 (gnus-group-edit-global-kill article))
9272 (defun gnus-summary-edit-local-kill ()
9273 "Edit a local kill file applied to the current newsgroup."
9275 (setq gnus-current-headers (gnus-summary-article-header))
9276 (gnus-group-edit-local-kill
9277 (gnus-summary-article-number) gnus-newsgroup-name))
9281 (defun gnus-read-header (id &optional header)
9282 "Read the headers of article ID and enter them into the Gnus system."
9283 (let ((group gnus-newsgroup-name)
9284 (gnus-override-method
9285 (and (gnus-news-group-p gnus-newsgroup-name)
9286 gnus-refer-article-method))
9288 ;; First we check to see whether the header in question is already
9291 ;; This is a Message-ID.
9292 (setq header (or header (gnus-id-to-header id)))
9293 ;; This is an article number.
9294 (setq header (or header (gnus-summary-article-header id))))
9296 (not (gnus-summary-article-sparse-p (mail-header-number header))))
9297 ;; We have found the header.
9299 ;; If this is a sparse article, we have to nix out its
9300 ;; previous entry in the thread hashtb.
9302 (gnus-summary-article-sparse-p (mail-header-number header)))
9303 (let* ((parent (gnus-parent-id (mail-header-references header)))
9304 (thread (and parent (gnus-id-to-thread parent))))
9306 (delq (assq header thread) thread))))
9307 ;; We have to really fetch the header to this article.
9309 (set-buffer nntp-server-buffer)
9310 (when (setq where (gnus-request-head id group))
9311 (nnheader-fold-continuation-lines)
9312 (goto-char (point-max))
9314 (goto-char (point-min))
9318 ((cdr where) (cdr where))
9319 (header (mail-header-number header))
9320 (t gnus-reffed-article-number))
9322 (insert " Article retrieved.\n"))
9324 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
9325 () ; Malformed head.
9326 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9327 (when (and (stringp id)
9328 (not (string= (gnus-group-real-name group)
9330 ;; If we fetched by Message-ID and the article came
9331 ;; from a different group, we fudge some bogus article
9332 ;; numbers for this article.
9333 (mail-header-set-number header gnus-reffed-article-number))
9335 (set-buffer gnus-summary-buffer)
9336 (decf gnus-reffed-article-number)
9337 (gnus-remove-header (mail-header-number header))
9338 (push header gnus-newsgroup-headers)
9339 (setq gnus-current-headers header)
9340 (push (mail-header-number header) gnus-newsgroup-limit)))
9343 (defun gnus-remove-header (number)
9344 "Remove header NUMBER from `gnus-newsgroup-headers'."
9345 (if (and gnus-newsgroup-headers
9346 (= number (mail-header-number (car gnus-newsgroup-headers))))
9347 (pop gnus-newsgroup-headers)
9348 (let ((headers gnus-newsgroup-headers))
9349 (while (and (cdr headers)
9350 (not (= number (mail-header-number (cadr headers)))))
9353 (setcdr headers (cddr headers))))))
9356 ;;; summary highlights
9359 (defun gnus-highlight-selected-summary ()
9360 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9361 ;; Highlight selected article in summary buffer
9362 (when gnus-summary-selected-face
9364 (let* ((beg (progn (beginning-of-line) (point)))
9365 (end (progn (end-of-line) (point)))
9366 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9367 (from (if (get-text-property beg gnus-mouse-face-prop)
9369 (or (next-single-property-change
9370 beg gnus-mouse-face-prop nil end)
9375 (or (next-single-property-change
9376 from gnus-mouse-face-prop nil end)
9378 ;; If no mouse-face prop on line we will have to = from = end,
9379 ;; so we highlight the entire line instead.
9380 (when (= (+ to 2) from)
9383 (if gnus-newsgroup-selected-overlay
9384 ;; Move old overlay.
9386 gnus-newsgroup-selected-overlay from to (current-buffer))
9387 ;; Create new overlay.
9389 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9390 'face gnus-summary-selected-face))))))
9392 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9393 (defun gnus-summary-highlight-line ()
9394 "Highlight current line according to `gnus-summary-highlight'."
9395 (let* ((list gnus-summary-highlight)
9397 (end (progn (end-of-line) (point)))
9398 ;; now find out where the line starts and leave point there.
9399 (beg (progn (beginning-of-line) (point)))
9400 (article (gnus-summary-article-number))
9401 (score (or (cdr (assq (or article gnus-current-article)
9402 gnus-newsgroup-scored))
9403 gnus-summary-default-score 0))
9404 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9405 (inhibit-read-only t))
9406 ;; Eval the cars of the lists until we find a match.
9407 (let ((default gnus-summary-default-score))
9409 (not (eval (caar list))))
9410 (setq list (cdr list))))
9411 (let ((face (cdar list)))
9412 (unless (eq face (get-text-property beg 'face))
9413 (gnus-put-text-property-excluding-characters-with-faces
9415 (setq face (if (boundp face) (symbol-value face) face)))
9416 (when gnus-summary-highlight-line-function
9417 (funcall gnus-summary-highlight-line-function article face))))
9420 (defun gnus-update-read-articles (group unread &optional compute)
9421 "Update the list of read articles in GROUP."
9422 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9423 (entry (gnus-gethash group gnus-newsrc-hashtb))
9424 (info (nth 2 entry))
9426 (unread (sort (copy-sequence unread) '<))
9428 (if (or (not info) (not active))
9429 ;; There is no info on this group if it was, in fact,
9430 ;; killed. Gnus stores no information on killed groups, so
9431 ;; there's nothing to be done.
9432 ;; One could store the information somewhere temporarily,
9433 ;; perhaps... Hmmm...
9435 ;; Remove any negative articles numbers.
9436 (while (and unread (< (car unread) 0))
9437 (setq unread (cdr unread)))
9438 ;; Remove any expired article numbers
9439 (while (and unread (< (car unread) (car active)))
9440 (setq unread (cdr unread)))
9441 ;; Compute the ranges of read articles by looking at the list of
9444 (when (/= (car unread) prev)
9445 (push (if (= prev (1- (car unread))) prev
9446 (cons prev (1- (car unread))))
9448 (setq prev (1+ (car unread)))
9449 (setq unread (cdr unread)))
9450 (when (<= prev (cdr active))
9451 (push (cons prev (cdr active)) read))
9452 (setq read (if (> (length read) 1) (nreverse read) read))
9456 (set-buffer gnus-group-buffer)
9459 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9460 (gnus-info-set-read ',info ',(gnus-info-read info))
9461 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9462 (gnus-group-update-group ,group t))))
9463 ;; Propagate the read marks to the backend.
9464 (if (gnus-check-backend-function 'request-set-mark group)
9465 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9466 (add (gnus-remove-from-range read (gnus-info-read info))))
9468 (unless (gnus-check-group group)
9469 (error "Can't open server for %s" group))
9470 (gnus-request-set-mark
9471 group (delq nil (list (if add (list add 'add '(read)))
9472 (if del (list del 'del '(read)))))))))
9473 ;; Enter this list into the group info.
9474 (gnus-info-set-read info read)
9475 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9476 (gnus-get-unread-articles-in-group info (gnus-active group))
9479 (defun gnus-offer-save-summaries ()
9480 "Offer to save all active summary buffers."
9482 (let ((buflist (buffer-list))
9484 ;; Go through all buffers and find all summaries.
9486 (and (setq bufname (buffer-name (car buflist)))
9487 (string-match "Summary" bufname)
9489 (set-buffer bufname)
9490 ;; We check that this is, indeed, a summary buffer.
9491 (and (eq major-mode 'gnus-summary-mode)
9492 ;; Also make sure this isn't bogus.
9493 gnus-newsgroup-prepared
9494 ;; Also make sure that this isn't a dead summary buffer.
9495 (not gnus-dead-summary-mode)))
9496 (push bufname buffers))
9497 (setq buflist (cdr buflist)))
9498 ;; Go through all these summary buffers and offer to save them.
9501 "Update summary buffer %s? "
9503 (switch-to-buffer buf)
9504 (gnus-summary-exit))
9508 ;;; @ for mime-partial
9511 (defun gnus-request-partial-message ()
9513 (let ((number (gnus-summary-article-number))
9514 (group gnus-newsgroup-name)
9515 (mother gnus-article-buffer))
9516 (set-buffer (get-buffer-create " *Partial Article*"))
9518 (setq mime-preview-buffer mother)
9519 (gnus-request-article-this-buffer number group)
9523 (autoload 'mime-combine-message/partial-pieces-automatically
9525 "Internal method to combine message/partial messages automatically.")
9528 'action '((type . message)(subtype . partial)
9529 (major-mode . gnus-original-article-mode)
9530 (method . mime-combine-message/partial-pieces-automatically)
9531 (summary-buffer-exp . gnus-summary-buffer)
9532 (request-partial-message-method . gnus-request-partial-message)
9536 ;;; @ for message/rfc822
9539 (defun gnus-mime-extract-message/rfc822 (entity situation)
9540 (let (group article num cwin swin cur)
9541 (with-current-buffer (mime-entity-buffer entity)
9543 (narrow-to-region (mime-entity-body-start entity)
9544 (mime-entity-body-end entity))
9545 (setq group (or (cdr (assq 'group situation))
9546 (completing-read "Group: "
9549 (gnus-read-active-file-p)
9550 gnus-newsgroup-name))
9551 article (gnus-request-accept-article group)
9554 (when (and (consp article)
9555 (numberp (setq article (cdr article))))
9556 (setq num (1+ (or (cdr (assq 'number situation)) 0))
9557 cwin (get-buffer-window (current-buffer) t)
9559 (save-window-excursion
9560 (if (setq swin (get-buffer-window gnus-summary-buffer t))
9561 (select-window swin)
9562 (set-buffer gnus-summary-buffer)
9564 (setq cur gnus-current-article)
9566 (let (gnus-show-threads)
9567 (gnus-summary-goto-subject article t)
9569 (gnus-summary-clear-mark-forward 1)
9570 (gnus-summary-goto-subject cur)
9572 (when (and cwin (window-frame cwin))
9573 (select-frame (window-frame cwin))
9575 (when (boundp 'mime-acting-situation-to-override)
9576 (set-alist 'mime-acting-situation-to-override
9579 (set-alist 'mime-acting-situation-to-override
9582 (save-current-buffer
9583 (set-buffer gnus-group-buffer)
9584 (gnus-activate-group ,group)
9586 (gnus-summary-goto-article ,cur
9587 gnus-show-all-headers)
9589 (set-alist 'mime-acting-situation-to-override
9595 'action '((type . message)(subtype . rfc822)
9596 (major-mode . gnus-original-article-mode)
9597 (method . gnus-mime-extract-message/rfc822)
9602 'action '((type . message)(subtype . news)
9603 (major-mode . gnus-original-article-mode)
9604 (method . gnus-mime-extract-message/rfc822)
9608 (defun gnus-mime-extract-multipart (entity situation)
9609 (let ((children (mime-entity-children entity))
9610 mime-acting-situation-to-override
9613 (mime-play-entity (car children)
9614 (cons (assq 'mode situation)
9615 mime-acting-situation-to-override))
9616 (setq children (cdr children)))
9617 (if (setq f (cdr (assq 'after-method
9618 mime-acting-situation-to-override)))
9623 'action '((type . multipart)
9624 (method . gnus-mime-extract-multipart)
9633 (defun gnus-summary-setup-default-charset ()
9634 "Setup newsgroup default charset."
9635 (if (equal gnus-newsgroup-name "nndraft:drafts")
9636 (setq gnus-newsgroup-charset nil)
9637 (let* ((name (and gnus-newsgroup-name
9638 (gnus-group-real-name gnus-newsgroup-name)))
9640 (or gnus-newsgroup-ephemeral-ignored-charsets
9642 (and gnus-newsgroup-name
9643 (or (gnus-group-find-parameter gnus-newsgroup-name
9644 'ignored-charsets t)
9645 (let ((alist gnus-group-ignored-charsets-alist)
9646 elem (charsets nil))
9647 (while (setq elem (pop alist))
9649 (string-match (car elem) name))
9651 charsets (cdr elem))))
9653 gnus-newsgroup-ignored-charsets)))
9654 (setq gnus-newsgroup-charset
9655 (or gnus-newsgroup-ephemeral-charset
9656 (and gnus-newsgroup-name
9657 (or (gnus-group-find-parameter gnus-newsgroup-name
9659 (let ((alist gnus-group-charset-alist)
9661 (while (setq elem (pop alist))
9663 (string-match (car elem) name))
9665 charset (cadr elem))))
9667 gnus-default-charset))
9668 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
9669 ignored-charsets))))
9675 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9676 "Display the current article buffer fully MIME-buttonized.
9677 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9678 treated as multipart/mixed."
9681 (let ((gnus-unbuttonized-mime-types nil)
9682 (gnus-mime-display-multipart-as-mixed show-all-parts))
9683 (gnus-summary-show-article)))
9685 (defun gnus-summary-repair-multipart (article)
9686 "Add a Content-Type header to a multipart article without one."
9687 (interactive (list (gnus-summary-article-number)))
9688 (gnus-with-article article
9689 (message-narrow-to-head)
9690 (goto-char (point-max))
9692 (when (search-forward "\n--" nil t)
9693 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9694 (message-narrow-to-head)
9695 (message-remove-header "Mime-Version")
9696 (message-remove-header "Content-Type")
9697 (goto-char (point-max))
9698 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9700 (insert "Mime-Version: 1.0\n")
9702 (let (gnus-mark-article-hook)
9703 (gnus-summary-select-article t t nil article)))
9705 (defun gnus-summary-toggle-display-buttonized ()
9706 "Toggle the buttonizing of the article buffer."
9709 (if (setq gnus-inhibit-mime-unbuttonizing
9710 (not gnus-inhibit-mime-unbuttonizing))
9711 (let ((gnus-unbuttonized-mime-types nil))
9712 (gnus-summary-show-article))
9713 (gnus-summary-show-article)))
9716 ;;; Intelli-mouse commmands
9719 (defun gnus-wheel-summary-scroll (event)
9721 (let ((amount (if (memq 'shift (event-modifiers event))
9722 (car gnus-wheel-scroll-amount)
9723 (cdr gnus-wheel-scroll-amount)))
9724 (direction (- (* (static-if (featurep 'xemacs)
9725 (event-button event)
9726 (cond ((eq 'mouse-4 (event-basic-type event))
9728 ((eq 'mouse-5 (event-basic-type event))
9732 (gnus-summary-scroll-up (* amount direction))
9733 (when (gnus-eval-in-buffer-window gnus-article-buffer
9736 (and (if (< 0 direction)
9737 (gnus-article-next-page 0)
9738 (gnus-article-prev-page 0)
9740 (if (setq edge (get-text-property
9741 (point-min) 'gnus-wheel-edge))
9742 (setq edge (* edge direction))
9745 (let ((buffer-read-only nil)
9746 (inhibit-read-only t))
9747 (put-text-property (point-min) (point-max)
9748 'gnus-wheel-edge direction)
9750 (or (> edge gnus-wheel-edge-resistance)
9751 (let ((buffer-read-only nil)
9752 (inhibit-read-only t))
9753 (put-text-property (point-min) (point-max)
9755 (* (1+ edge) direction))
9757 (eq last-command 'gnus-wheel-summary-scroll))
9759 (gnus-summary-next-article nil nil (minusp direction)))
9762 (defun gnus-wheel-install ()
9763 "Enable mouse wheel support on summary window."
9764 (when gnus-use-wheel
9766 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
9768 (define-key gnus-summary-mode-map key
9769 'gnus-wheel-summary-scroll)))))
9771 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
9777 (defmacro gnus-with-article (article &rest forms)
9778 "Select ARTICLE and perform FORMS in the original article buffer.
9779 Then replace the article with the result."
9781 ;; We don't want the article to be marked as read.
9782 (let (gnus-mark-article-hook)
9783 (gnus-summary-select-article t t nil ,article))
9784 (set-buffer gnus-original-article-buffer)
9786 (if (not (gnus-check-backend-function
9787 'request-replace-article (car gnus-article-current)))
9788 (gnus-message 5 "Read-only group; not replacing")
9789 (unless (gnus-request-replace-article
9790 ,article (car gnus-article-current)
9792 (error "Couldn't replace article")))
9793 ;; The cache and backlog have to be flushed somewhat.
9794 (when gnus-keep-backlog
9795 (gnus-backlog-remove-article
9796 (car gnus-article-current) (cdr gnus-article-current)))
9797 (when gnus-use-cache
9798 (gnus-cache-update-article
9799 (car gnus-article-current) (cdr gnus-article-current)))))
9801 (put 'gnus-with-article 'lisp-indent-function 1)
9802 (put 'gnus-with-article 'edebug-form-spec '(form body))
9805 ;;; Generic summary marking commands
9808 (defvar gnus-summary-marking-alist
9809 '((read gnus-del-mark "d")
9810 (unread gnus-unread-mark "u")
9811 (ticked gnus-ticked-mark "!")
9812 (dormant gnus-dormant-mark "?")
9813 (expirable gnus-expirable-mark "e"))
9814 "An alist of names/marks/keystrokes.")
9816 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
9817 (defvar gnus-summary-mark-map)
9819 (defun gnus-summary-make-all-marking-commands ()
9820 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
9821 (dolist (elem gnus-summary-marking-alist)
9822 (apply 'gnus-summary-make-marking-command elem)))
9824 (defun gnus-summary-make-marking-command (name mark keystroke)
9825 (let ((map (make-sparse-keymap)))
9826 (define-key gnus-summary-generic-mark-map keystroke map)
9827 (dolist (lway `((next "next" next nil "n")
9828 (next-unread "next unread" next t "N")
9829 (prev "previous" prev nil "p")
9830 (prev-unread "previous unread" prev t "P")
9831 (nomove "" nil nil ,keystroke)))
9832 (let ((func (gnus-summary-make-marking-command-1
9833 mark (car lway) lway name)))
9834 (setq func (eval func))
9835 (define-key map (nth 4 lway) func)))))
9837 (defun gnus-summary-make-marking-command-1 (mark way lway name)
9839 (format "gnus-summary-put-mark-as-%s%s"
9840 name (if (eq way 'nomove)
9842 (concat "-" (symbol-name way)))))
9845 "Mark the current article as %s%s.
9846 If N, the prefix, then repeat N times.
9847 If N is negative, move in reverse order.
9848 The difference between N and the actual number of articles marked is
9852 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
9854 (defun gnus-summary-generic-mark (n mark move unread)
9855 "Mark N articles with MARK."
9856 (unless (eq major-mode 'gnus-summary-mode)
9857 (error "This command can only be used in the summary buffer"))
9858 (gnus-summary-show-thread)
9862 ((eq move 'prev) -1)
9868 nummove (* -1 nummove))))
9870 (gnus-summary-mark-article nil mark)
9871 (zerop (gnus-summary-next-subject nummove unread t)))
9874 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9875 (gnus-summary-recenter)
9876 (gnus-summary-position-point)
9877 (gnus-set-mode-line 'summary)
9880 (gnus-summary-make-all-marking-commands)
9886 (run-hooks 'gnus-sum-load-hook)
9888 ;;; gnus-sum.el ends here