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 x-unknown)
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
1528 "s" gnus-smiley-display)
1530 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1531 "a" gnus-article-hide
1532 "h" gnus-article-toggle-headers
1533 "b" gnus-article-hide-boring-headers
1534 "s" gnus-article-hide-signature
1535 "c" gnus-article-hide-citation
1536 "C" gnus-article-hide-citation-in-followups
1537 "l" gnus-article-hide-list-identifiers
1538 "p" gnus-article-hide-pgp
1539 "B" gnus-article-strip-banner
1540 "P" gnus-article-hide-pem
1541 "\C-c" gnus-article-hide-citation-maybe)
1543 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1544 "a" gnus-article-highlight
1545 "h" gnus-article-highlight-headers
1546 "c" gnus-article-highlight-citation
1547 "s" gnus-article-highlight-signature)
1549 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1550 "z" gnus-article-date-ut
1551 "u" gnus-article-date-ut
1552 "l" gnus-article-date-local
1553 "e" gnus-article-date-lapsed
1554 "o" gnus-article-date-original
1555 "i" gnus-article-date-iso8601
1556 "s" gnus-article-date-user)
1558 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1559 "t" gnus-article-remove-trailing-blank-lines
1560 "l" gnus-article-strip-leading-blank-lines
1561 "m" gnus-article-strip-multiple-blank-lines
1562 "a" gnus-article-strip-blank-lines
1563 "A" gnus-article-strip-all-blank-lines
1564 "s" gnus-article-strip-leading-space
1565 "e" gnus-article-strip-trailing-space)
1567 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1569 "f" gnus-summary-fetch-faq
1570 "d" gnus-summary-describe-group
1571 "h" gnus-summary-describe-briefly
1572 "i" gnus-info-find-node)
1574 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1575 "e" gnus-summary-expire-articles
1576 "\M-\C-e" gnus-summary-expire-articles-now
1577 "\177" gnus-summary-delete-article
1578 [delete] gnus-summary-delete-article
1579 [backspace] gnus-summary-delete-article
1580 "m" gnus-summary-move-article
1581 "r" gnus-summary-respool-article
1582 "w" gnus-summary-edit-article
1583 "c" gnus-summary-copy-article
1584 "B" gnus-summary-crosspost-article
1585 "q" gnus-summary-respool-query
1586 "t" gnus-summary-respool-trace
1587 "i" gnus-summary-import-article
1588 "p" gnus-summary-article-posted-p)
1590 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1591 "o" gnus-summary-save-article
1592 "m" gnus-summary-save-article-mail
1593 "F" gnus-summary-write-article-file
1594 "r" gnus-summary-save-article-rmail
1595 "f" gnus-summary-save-article-file
1596 "b" gnus-summary-save-article-body-file
1597 "h" gnus-summary-save-article-folder
1598 "v" gnus-summary-save-article-vm
1599 "p" gnus-summary-pipe-output
1600 "s" gnus-soup-add-article)
1602 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1603 "b" gnus-summary-display-buttonized
1604 "m" gnus-summary-repair-multipart
1605 "v" gnus-article-view-part
1606 "o" gnus-article-save-part
1607 "c" gnus-article-copy-part
1608 "e" gnus-article-externalize-part
1609 "i" gnus-article-inline-part
1610 "|" gnus-article-pipe-part)
1613 (defun gnus-summary-make-menu-bar ()
1614 (gnus-turn-off-edit-menu 'summary)
1616 (unless (boundp 'gnus-summary-misc-menu)
1619 gnus-summary-kill-menu gnus-summary-mode-map ""
1624 ["Enter score..." gnus-summary-score-entry t]
1625 ["Customize" gnus-score-customize t])
1626 (gnus-make-score-map 'increase)
1627 (gnus-make-score-map 'lower)
1629 ["Kill below" gnus-summary-kill-below t]
1630 ["Mark above" gnus-summary-mark-above t]
1631 ["Tick above" gnus-summary-tick-above t]
1632 ["Clear above" gnus-summary-clear-above t])
1633 ["Current score" gnus-summary-current-score t]
1634 ["Set score" gnus-summary-set-score t]
1635 ["Switch current score file..." gnus-score-change-score-file t]
1636 ["Set mark below..." gnus-score-set-mark-below t]
1637 ["Set expunge below..." gnus-score-set-expunge-below t]
1638 ["Edit current score file" gnus-score-edit-current-scores t]
1639 ["Edit score file" gnus-score-edit-file t]
1640 ["Trace score" gnus-score-find-trace t]
1641 ["Find words" gnus-score-find-favourite-words t]
1642 ["Rescore buffer" gnus-summary-rescore t]
1643 ["Increase score..." gnus-summary-increase-score t]
1644 ["Lower score..." gnus-summary-lower-score t]))))
1646 ;; Define both the Article menu in the summary buffer and the equivalent
1647 ;; Commands menu in the article buffer here for consistency.
1650 ["All" gnus-article-hide t]
1651 ["Headers" gnus-article-toggle-headers t]
1652 ["Signature" gnus-article-hide-signature t]
1653 ["Citation" gnus-article-hide-citation t]
1654 ["List identifiers" gnus-article-hide-list-identifiers t]
1655 ["PGP" gnus-article-hide-pgp t]
1656 ["Banner" gnus-article-strip-banner t]
1657 ["Boring headers" gnus-article-hide-boring-headers t])
1659 ["All" gnus-article-highlight t]
1660 ["Headers" gnus-article-highlight-headers t]
1661 ["Signature" gnus-article-highlight-signature t]
1662 ["Citation" gnus-article-highlight-citation t])
1664 ["Local" gnus-article-date-local t]
1665 ["ISO8601" gnus-article-date-iso8601 t]
1666 ["UT" gnus-article-date-ut t]
1667 ["Original" gnus-article-date-original t]
1668 ["Lapsed" gnus-article-date-lapsed t]
1669 ["User-defined" gnus-article-date-user t])
1672 ["Leading" gnus-article-strip-leading-blank-lines t]
1673 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1674 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1675 ["All of the above" gnus-article-strip-blank-lines t]
1676 ["All" gnus-article-strip-all-blank-lines t]
1677 ["Leading space" gnus-article-strip-leading-space t]
1678 ["Trailing space" gnus-article-strip-trailing-space t])
1679 ["Overstrike" gnus-article-treat-overstrike t]
1680 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1681 ["Emphasis" gnus-article-emphasize t]
1682 ["Word wrap" gnus-article-fill-cited-article t]
1683 ["Fill long lines" gnus-article-fill-long-lines t]
1684 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1685 ["CR" gnus-article-remove-cr t]
1686 ["Show X-Face" gnus-article-display-x-face t]
1687 ["Rot 13" gnus-summary-caesar-message t]
1688 ["Unix pipe" gnus-summary-pipe-message t]
1689 ["Add buttons" gnus-article-add-buttons t]
1690 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1691 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1692 ["Toggle MIME" gnus-summary-toggle-mime t]
1693 ["Verbose header" gnus-summary-verbose-headers t]
1694 ["Toggle header" gnus-summary-toggle-header t]
1695 ["Toggle smileys" gnus-smiley-display t])
1697 ["Save in default format" gnus-summary-save-article t]
1698 ["Save in file" gnus-summary-save-article-file t]
1699 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1700 ["Save in MH folder" gnus-summary-save-article-folder t]
1701 ["Save in VM folder" gnus-summary-save-article-vm t]
1702 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1703 ["Save body in file" gnus-summary-save-article-body-file t]
1704 ["Pipe through a filter" gnus-summary-pipe-output t]
1705 ["Add to SOUP packet" gnus-soup-add-article t]
1706 ["Print" gnus-summary-print-article t])
1708 ["Respool article..." gnus-summary-respool-article t]
1709 ["Move article..." gnus-summary-move-article
1710 (gnus-check-backend-function
1711 'request-move-article gnus-newsgroup-name)]
1712 ["Copy article..." gnus-summary-copy-article t]
1713 ["Crosspost article..." gnus-summary-crosspost-article
1714 (gnus-check-backend-function
1715 'request-replace-article gnus-newsgroup-name)]
1716 ["Import file..." gnus-summary-import-article t]
1717 ["Check if posted" gnus-summary-article-posted-p t]
1718 ["Edit article" gnus-summary-edit-article
1719 (not (gnus-group-read-only-p))]
1720 ["Delete article" gnus-summary-delete-article
1721 (gnus-check-backend-function
1722 'request-expire-articles gnus-newsgroup-name)]
1723 ["Query respool" gnus-summary-respool-query t]
1724 ["Trace respool" gnus-summary-respool-trace t]
1725 ["Delete expirable articles" gnus-summary-expire-articles-now
1726 (gnus-check-backend-function
1727 'request-expire-articles gnus-newsgroup-name)])
1729 ["Uudecode" gnus-uu-decode-uu t]
1730 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1731 ["Unshar" gnus-uu-decode-unshar t]
1732 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1733 ["Save" gnus-uu-decode-save t]
1734 ["Binhex" gnus-uu-decode-binhex t]
1735 ["Postscript" gnus-uu-decode-postscript t])
1737 ["Enter article" gnus-cache-enter-article t]
1738 ["Remove article" gnus-cache-remove-article t])
1739 ["Translate" gnus-article-babel t]
1740 ["Select article buffer" gnus-summary-select-article-buffer t]
1741 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1742 ["Isearch article..." gnus-summary-isearch-article t]
1743 ["Beginning of the article" gnus-summary-beginning-of-article t]
1744 ["End of the article" gnus-summary-end-of-article t]
1745 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1746 ["Fetch referenced articles" gnus-summary-refer-references t]
1747 ["Fetch current thread" gnus-summary-refer-thread t]
1748 ["Fetch article with id..." gnus-summary-refer-article t]
1749 ["Redisplay" gnus-summary-show-article t])))
1751 gnus-summary-article-menu gnus-summary-mode-map ""
1752 (cons "Article" innards))
1755 gnus-article-commands-menu gnus-article-mode-map ""
1756 (cons "Commands" innards)))
1759 gnus-summary-thread-menu gnus-summary-mode-map ""
1761 ["Toggle threading" gnus-summary-toggle-threads t]
1762 ["Hide threads" gnus-summary-hide-all-threads t]
1763 ["Show threads" gnus-summary-show-all-threads t]
1764 ["Hide thread" gnus-summary-hide-thread t]
1765 ["Show thread" gnus-summary-show-thread t]
1766 ["Go to next thread" gnus-summary-next-thread t]
1767 ["Go to previous thread" gnus-summary-prev-thread t]
1768 ["Go down thread" gnus-summary-down-thread t]
1769 ["Go up thread" gnus-summary-up-thread t]
1770 ["Top of thread" gnus-summary-top-thread t]
1771 ["Mark thread as read" gnus-summary-kill-thread t]
1772 ["Lower thread score" gnus-summary-lower-thread t]
1773 ["Raise thread score" gnus-summary-raise-thread t]
1774 ["Rethread current" gnus-summary-rethread-current t]
1778 gnus-summary-post-menu gnus-summary-mode-map ""
1780 ["Post an article" gnus-summary-post-news t]
1781 ["Followup" gnus-summary-followup t]
1782 ["Followup and yank" gnus-summary-followup-with-original t]
1783 ["Supersede article" gnus-summary-supersede-article t]
1784 ["Cancel article" gnus-summary-cancel-article t]
1785 ["Reply" gnus-summary-reply t]
1786 ["Reply and yank" gnus-summary-reply-with-original t]
1787 ["Wide reply" gnus-summary-wide-reply t]
1788 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1789 ["Mail forward" gnus-summary-mail-forward t]
1790 ["Post forward" gnus-summary-post-forward t]
1791 ["Digest and mail" gnus-summary-mail-digest t]
1792 ["Digest and post" gnus-summary-post-digest t]
1793 ["Resend message" gnus-summary-resend-message t]
1794 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1795 ["Send a mail" gnus-summary-mail-other-window t]
1796 ["Uuencode and post" gnus-uu-post-news t]
1797 ["Followup via news" gnus-summary-followup-to-mail t]
1798 ["Followup via news and yank"
1799 gnus-summary-followup-to-mail-with-original t]
1801 ;;["Send" gnus-summary-send-draft t]
1802 ;;["Send bounced" gnus-resend-bounced-mail t])
1806 gnus-summary-misc-menu gnus-summary-mode-map ""
1809 ["Mark as read" gnus-summary-mark-as-read-forward t]
1810 ["Mark same subject and select"
1811 gnus-summary-kill-same-subject-and-select t]
1812 ["Mark same subject" gnus-summary-kill-same-subject t]
1813 ["Catchup" gnus-summary-catchup t]
1814 ["Catchup all" gnus-summary-catchup-all t]
1815 ["Catchup to here" gnus-summary-catchup-to-here t]
1816 ["Catchup region" gnus-summary-mark-region-as-read t]
1817 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1819 ["Tick" gnus-summary-tick-article-forward t]
1820 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1821 ["Remove marks" gnus-summary-clear-mark-forward t]
1822 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1823 ["Set bookmark" gnus-summary-set-bookmark t]
1824 ["Remove bookmark" gnus-summary-remove-bookmark t])
1826 ["Marks..." gnus-summary-limit-to-marks t]
1827 ["Subject..." gnus-summary-limit-to-subject t]
1828 ["Author..." gnus-summary-limit-to-author t]
1829 ["Age..." gnus-summary-limit-to-age t]
1830 ["Extra..." gnus-summary-limit-to-extra t]
1831 ["Score" gnus-summary-limit-to-score t]
1832 ["Unread" gnus-summary-limit-to-unread t]
1833 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1834 ["Articles" gnus-summary-limit-to-articles t]
1835 ["Pop limit" gnus-summary-pop-limit t]
1836 ["Show dormant" gnus-summary-limit-include-dormant t]
1837 ["Hide childless dormant"
1838 gnus-summary-limit-exclude-childless-dormant t]
1839 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1840 ["Hide marked" gnus-summary-limit-exclude-marks t]
1841 ["Show expunged" gnus-summary-show-all-expunged t])
1843 ["Set mark" gnus-summary-mark-as-processable t]
1844 ["Remove mark" gnus-summary-unmark-as-processable t]
1845 ["Remove all marks" gnus-summary-unmark-all-processable t]
1846 ["Mark above" gnus-uu-mark-over t]
1847 ["Mark series" gnus-uu-mark-series t]
1848 ["Mark region" gnus-uu-mark-region t]
1849 ["Unmark region" gnus-uu-unmark-region t]
1850 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1851 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1852 ["Mark all" gnus-uu-mark-all t]
1853 ["Mark buffer" gnus-uu-mark-buffer t]
1854 ["Mark sparse" gnus-uu-mark-sparse t]
1855 ["Mark thread" gnus-uu-mark-thread t]
1856 ["Unmark thread" gnus-uu-unmark-thread t]
1857 ("Process Mark Sets"
1858 ["Kill" gnus-summary-kill-process-mark t]
1859 ["Yank" gnus-summary-yank-process-mark
1860 gnus-newsgroup-process-stack]
1861 ["Save" gnus-summary-save-process-mark t]))
1863 ["Page forward" gnus-summary-next-page t]
1864 ["Page backward" gnus-summary-prev-page t]
1865 ["Line forward" gnus-summary-scroll-up t])
1867 ["Next unread article" gnus-summary-next-unread-article t]
1868 ["Previous unread article" gnus-summary-prev-unread-article t]
1869 ["Next article" gnus-summary-next-article t]
1870 ["Previous article" gnus-summary-prev-article t]
1871 ["Next unread subject" gnus-summary-next-unread-subject t]
1872 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1873 ["Next article same subject" gnus-summary-next-same-subject t]
1874 ["Previous article same subject" gnus-summary-prev-same-subject t]
1875 ["First unread article" gnus-summary-first-unread-article t]
1876 ["Best unread article" gnus-summary-best-unread-article t]
1877 ["Go to subject number..." gnus-summary-goto-subject t]
1878 ["Go to article number..." gnus-summary-goto-article t]
1879 ["Go to the last article" gnus-summary-goto-last-article t]
1880 ["Pop article off history" gnus-summary-pop-article t])
1882 ["Sort by number" gnus-summary-sort-by-number t]
1883 ["Sort by author" gnus-summary-sort-by-author t]
1884 ["Sort by subject" gnus-summary-sort-by-subject t]
1885 ["Sort by date" gnus-summary-sort-by-date t]
1886 ["Sort by score" gnus-summary-sort-by-score t]
1887 ["Sort by lines" gnus-summary-sort-by-lines t]
1888 ["Sort by characters" gnus-summary-sort-by-chars t])
1890 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1891 ["Describe group" gnus-summary-describe-group t]
1892 ["Read manual" gnus-info-find-node t])
1894 ["Pick and read" gnus-pick-mode t]
1895 ["Binary" gnus-binary-mode t])
1897 ["Regenerate" gnus-summary-prepare t]
1898 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1899 ["Toggle threading" gnus-summary-toggle-threads t])
1900 ["Filter articles..." gnus-summary-execute-command t]
1901 ["Run command on subjects..." gnus-summary-universal-argument t]
1902 ["Search articles forward..." gnus-summary-search-article-forward t]
1903 ["Search articles backward..." gnus-summary-search-article-backward t]
1904 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1905 ["Expand window" gnus-summary-expand-window t]
1906 ["Expire expirable articles" gnus-summary-expire-articles
1907 (gnus-check-backend-function
1908 'request-expire-articles gnus-newsgroup-name)]
1909 ["Edit local kill file" gnus-summary-edit-local-kill t]
1910 ["Edit main kill file" gnus-summary-edit-global-kill t]
1911 ["Edit group parameters" gnus-summary-edit-parameters t]
1912 ["Customize group parameters" gnus-summary-customize-parameters t]
1913 ["Send a bug report" gnus-bug t]
1915 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1916 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1917 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1918 ["Exit group" gnus-summary-exit t]
1919 ["Exit group without updating" gnus-summary-exit-no-update t]
1920 ["Exit and goto next group" gnus-summary-next-group t]
1921 ["Exit and goto prev group" gnus-summary-prev-group t]
1922 ["Reselect group" gnus-summary-reselect-current-group t]
1923 ["Rescan group" gnus-summary-rescan-group t]
1924 ["Update dribble" gnus-summary-save-newsrc t])))
1926 (gnus-run-hooks 'gnus-summary-menu-hook)))
1928 (defun gnus-score-set-default (var value)
1929 "A version of set that updates the GNU Emacs menu-bar."
1931 ;; It is the message that forces the active status to be updated.
1934 (defun gnus-make-score-map (type)
1935 "Make a summary score map of type TYPE."
1938 (let ((headers '(("author" "from" string)
1939 ("subject" "subject" string)
1940 ("article body" "body" string)
1941 ("article head" "head" string)
1942 ("xref" "xref" string)
1943 ("extra header" "extra" string)
1944 ("lines" "lines" number)
1945 ("followups to author" "followup" string)))
1946 (types '((number ("less than" <)
1949 (string ("substring" s)
1953 (perms '(("temporary" (current-time-string))
1961 (if (eq type 'lower)
1966 (setq header (car headers))
1972 (let ((ts (cdr (assoc (nth 2 header) types)))
1988 'gnus-summary-score-entry
1990 (if (or (string= (nth 1 header)
1992 (string= (nth 1 header)
1995 (list 'gnus-summary-header
1997 (list 'quote (nth 1 (car ts)))
1998 (list 'gnus-score-default nil)
2004 (list (nreverse outp))))
2007 (list (nreverse outt))))
2009 (setq headers (cdr headers)))
2010 (list (nreverse outh))))))))
2014 (defun gnus-summary-mode (&optional group)
2015 "Major mode for reading articles.
2017 All normal editing commands are switched off.
2018 \\<gnus-summary-mode-map>
2019 Each line in this buffer represents one article. To read an
2020 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2021 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2024 You can also post articles and send mail from this buffer. To
2025 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2026 of an article, type `\\[gnus-summary-reply]'.
2028 There are approx. one gazillion commands you can execute in this
2029 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2031 The following commands are available:
2033 \\{gnus-summary-mode-map}"
2035 (when (gnus-visual-p 'summary-menu 'menu)
2036 (gnus-summary-make-menu-bar))
2037 (kill-all-local-variables)
2038 (gnus-summary-make-local-variables)
2039 (gnus-make-thread-indent-array)
2040 (gnus-simplify-mode-line)
2041 (setq major-mode 'gnus-summary-mode)
2042 (setq mode-name "Summary")
2043 (make-local-variable 'minor-mode-alist)
2044 (use-local-map gnus-summary-mode-map)
2045 (buffer-disable-undo)
2046 (setq buffer-read-only t) ;Disable modification
2047 (setq truncate-lines t)
2048 (setq selective-display t)
2049 (setq selective-display-ellipses t) ;Display `...'
2050 (gnus-summary-set-display-table)
2051 (gnus-set-default-directory)
2052 (setq gnus-newsgroup-name group)
2053 (unless (gnus-news-group-p group)
2054 (setq gnus-newsgroup-incorporated
2055 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2056 (make-local-variable 'gnus-summary-line-format)
2057 (make-local-variable 'gnus-summary-line-format-spec)
2058 (make-local-variable 'gnus-summary-dummy-line-format)
2059 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2060 (make-local-variable 'gnus-summary-mark-positions)
2061 (make-local-hook 'pre-command-hook)
2062 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2063 (gnus-run-hooks 'gnus-summary-mode-hook)
2064 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2065 (gnus-update-summary-mark-positions))
2067 (defun gnus-summary-make-local-variables ()
2068 "Make all the local summary buffer variables."
2070 (dolist (local gnus-summary-local-variables)
2073 (if (eq (cdr local) 'global)
2074 ;; Copy the global value of the variable.
2075 (setq global (symbol-value (car local)))
2076 ;; Use the value from the list.
2077 (setq global (eval (cdr local))))
2078 (set (make-local-variable (car local)) global))
2079 ;; Simple nil-valued local variable.
2080 (set (make-local-variable local) nil)))))
2082 (defun gnus-summary-clear-local-variables ()
2083 (let ((locals gnus-summary-local-variables))
2085 (if (consp (car locals))
2086 (and (vectorp (caar locals))
2087 (set (caar locals) nil))
2088 (and (vectorp (car locals))
2089 (set (car locals) nil)))
2090 (setq locals (cdr locals)))))
2092 ;; Summary data functions.
2094 (defmacro gnus-data-number (data)
2097 (defmacro gnus-data-set-number (data number)
2098 `(setcar ,data ,number))
2100 (defmacro gnus-data-mark (data)
2103 (defmacro gnus-data-set-mark (data mark)
2104 `(setcar (nthcdr 1 ,data) ,mark))
2106 (defmacro gnus-data-pos (data)
2109 (defmacro gnus-data-set-pos (data pos)
2110 `(setcar (nthcdr 2 ,data) ,pos))
2112 (defmacro gnus-data-header (data)
2115 (defmacro gnus-data-set-header (data header)
2116 `(setf (nth 3 ,data) ,header))
2118 (defmacro gnus-data-level (data)
2121 (defmacro gnus-data-unread-p (data)
2122 `(= (nth 1 ,data) gnus-unread-mark))
2124 (defmacro gnus-data-read-p (data)
2125 `(/= (nth 1 ,data) gnus-unread-mark))
2127 (defmacro gnus-data-pseudo-p (data)
2128 `(consp (nth 3 ,data)))
2130 (defmacro gnus-data-find (number)
2131 `(assq ,number gnus-newsgroup-data))
2133 (defmacro gnus-data-find-list (number &optional data)
2134 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2135 (memq (assq ,number bdata)
2138 (defmacro gnus-data-make (number mark pos header level)
2139 `(list ,number ,mark ,pos ,header ,level))
2141 (defun gnus-data-enter (after-article number mark pos header level offset)
2142 (let ((data (gnus-data-find-list after-article)))
2144 (error "No such article: %d" after-article))
2145 (setcdr data (cons (gnus-data-make number mark pos header level)
2147 (setq gnus-newsgroup-data-reverse nil)
2148 (gnus-data-update-list (cddr data) offset)))
2150 (defun gnus-data-enter-list (after-article list &optional offset)
2152 (let ((data (and after-article (gnus-data-find-list after-article)))
2156 (let ((odata gnus-newsgroup-data))
2157 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2159 (gnus-data-update-list odata offset)))
2160 ;; Find the last element in the list to be spliced into the main
2163 (setq list (cdr list)))
2166 (setcdr list gnus-newsgroup-data)
2167 (setq gnus-newsgroup-data ilist)
2169 (gnus-data-update-list (cdr list) offset)))
2170 (setcdr list (cdr data))
2173 (gnus-data-update-list (cdr list) offset))))
2174 (setq gnus-newsgroup-data-reverse nil))))
2176 (defun gnus-data-remove (article &optional offset)
2177 (let ((data gnus-newsgroup-data))
2178 (if (= (gnus-data-number (car data)) article)
2180 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2181 gnus-newsgroup-data-reverse nil)
2183 (gnus-data-update-list gnus-newsgroup-data offset)))
2185 (when (= (gnus-data-number (cadr data)) article)
2186 (setcdr data (cddr data))
2188 (gnus-data-update-list (cdr data) offset))
2190 gnus-newsgroup-data-reverse nil))
2191 (setq data (cdr data))))))
2193 (defmacro gnus-data-list (backward)
2195 (or gnus-newsgroup-data-reverse
2196 (setq gnus-newsgroup-data-reverse
2197 (reverse gnus-newsgroup-data)))
2198 gnus-newsgroup-data))
2200 (defun gnus-data-update-list (data offset)
2201 "Add OFFSET to the POS of all data entries in DATA."
2202 (setq gnus-newsgroup-data-reverse nil)
2204 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2205 (setq data (cdr data))))
2207 (defun gnus-summary-article-pseudo-p (article)
2208 "Say whether this article is a pseudo article or not."
2209 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2211 (defmacro gnus-summary-article-sparse-p (article)
2212 "Say whether this article is a sparse article or not."
2213 `(memq ,article gnus-newsgroup-sparse))
2215 (defmacro gnus-summary-article-ancient-p (article)
2216 "Say whether this article is a sparse article or not."
2217 `(memq ,article gnus-newsgroup-ancient))
2219 (defun gnus-article-parent-p (number)
2220 "Say whether this article is a parent or not."
2221 (let ((data (gnus-data-find-list number)))
2222 (and (cdr data) ; There has to be an article after...
2223 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2224 (gnus-data-level (nth 1 data))))))
2226 (defun gnus-article-children (number)
2227 "Return a list of all children to NUMBER."
2228 (let* ((data (gnus-data-find-list number))
2229 (level (gnus-data-level (car data)))
2231 (setq data (cdr data))
2233 (= (gnus-data-level (car data)) (1+ level)))
2234 (push (gnus-data-number (car data)) children)
2235 (setq data (cdr data)))
2238 (defmacro gnus-summary-skip-intangible ()
2239 "If the current article is intangible, then jump to a different article."
2240 '(let ((to (get-text-property (point) 'gnus-intangible)))
2241 (and to (gnus-summary-goto-subject to))))
2243 (defmacro gnus-summary-article-intangible-p ()
2244 "Say whether this article is intangible or not."
2245 '(get-text-property (point) 'gnus-intangible))
2247 (defun gnus-article-read-p (article)
2248 "Say whether ARTICLE is read or not."
2249 (not (or (memq article gnus-newsgroup-marked)
2250 (memq article gnus-newsgroup-unreads)
2251 (memq article gnus-newsgroup-unselected)
2252 (memq article gnus-newsgroup-dormant))))
2254 ;; Some summary mode macros.
2256 (defmacro gnus-summary-article-number ()
2257 "The article number of the article on the current line.
2258 If there isn's an article number here, then we return the current
2261 (gnus-summary-skip-intangible)
2262 (or (get-text-property (point) 'gnus-number)
2263 (gnus-summary-last-subject))))
2265 (defmacro gnus-summary-article-header (&optional number)
2266 "Return the header of article NUMBER."
2267 `(gnus-data-header (gnus-data-find
2268 ,(or number '(gnus-summary-article-number)))))
2270 (defmacro gnus-summary-thread-level (&optional number)
2271 "Return the level of thread that starts with article NUMBER."
2272 `(if (and (eq gnus-summary-make-false-root 'dummy)
2273 (get-text-property (point) 'gnus-intangible))
2275 (gnus-data-level (gnus-data-find
2276 ,(or number '(gnus-summary-article-number))))))
2278 (defmacro gnus-summary-article-mark (&optional number)
2279 "Return the mark of article NUMBER."
2280 `(gnus-data-mark (gnus-data-find
2281 ,(or number '(gnus-summary-article-number)))))
2283 (defmacro gnus-summary-article-pos (&optional number)
2284 "Return the position of the line of article NUMBER."
2285 `(gnus-data-pos (gnus-data-find
2286 ,(or number '(gnus-summary-article-number)))))
2288 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2289 (defmacro gnus-summary-article-subject (&optional number)
2290 "Return current subject string or nil if nothing."
2293 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2294 '(gnus-data-header (assq (gnus-summary-article-number)
2295 gnus-newsgroup-data)))))
2298 (mail-header-subject headers))))
2300 (defmacro gnus-summary-article-score (&optional number)
2301 "Return current article score."
2302 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2303 gnus-newsgroup-scored))
2304 gnus-summary-default-score 0))
2306 (defun gnus-summary-article-children (&optional number)
2307 "Return a list of article numbers that are children of article NUMBER."
2308 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2309 (level (gnus-data-level (car data)))
2311 (while (and (setq data (cdr data))
2312 (> (setq l (gnus-data-level (car data))) level))
2313 (and (= (1+ level) l)
2314 (push (gnus-data-number (car data))
2316 (nreverse children)))
2318 (defun gnus-summary-article-parent (&optional number)
2319 "Return the article number of the parent of article NUMBER."
2320 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2321 (gnus-data-list t)))
2322 (level (gnus-data-level (car data))))
2324 () ; This is a root.
2325 ;; We search until we find an article with a level less than
2326 ;; this one. That function has to be the parent.
2327 (while (and (setq data (cdr data))
2328 (not (< (gnus-data-level (car data)) level))))
2329 (and data (gnus-data-number (car data))))))
2331 (defun gnus-unread-mark-p (mark)
2332 "Say whether MARK is the unread mark."
2333 (= mark gnus-unread-mark))
2335 (defun gnus-read-mark-p (mark)
2336 "Say whether MARK is one of the marks that mark as read.
2337 This is all marks except unread, ticked, dormant, and expirable."
2338 (not (or (= mark gnus-unread-mark)
2339 (= mark gnus-ticked-mark)
2340 (= mark gnus-dormant-mark)
2341 (= mark gnus-expirable-mark))))
2343 (defmacro gnus-article-mark (number)
2344 "Return the MARK of article NUMBER.
2345 This macro should only be used when computing the mark the \"first\"
2346 time; i.e., when generating the summary lines. After that,
2347 `gnus-summary-article-mark' should be used to examine the
2350 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2351 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2352 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2353 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2354 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2355 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2356 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2357 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2358 gnus-ancient-mark))))
2360 ;; Saving hidden threads.
2362 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2363 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2365 (defmacro gnus-save-hidden-threads (&rest forms)
2366 "Save hidden threads, eval FORMS, and restore the hidden threads."
2367 (let ((config (make-symbol "config")))
2368 `(let ((,config (gnus-hidden-threads-configuration)))
2372 (gnus-restore-hidden-threads-configuration ,config)))))
2374 (defun gnus-data-compute-positions ()
2375 "Compute the positions of all articles."
2376 (setq gnus-newsgroup-data-reverse nil)
2377 (let ((data gnus-newsgroup-data))
2379 (gnus-save-hidden-threads
2380 (gnus-summary-show-all-threads)
2381 (goto-char (point-min))
2383 (while (get-text-property (point) 'gnus-intangible)
2385 (gnus-data-set-pos (car data) (+ (point) 3))
2386 (setq data (cdr data))
2387 (forward-line 1))))))
2389 (defun gnus-hidden-threads-configuration ()
2390 "Return the current hidden threads configuration."
2393 (goto-char (point-min))
2394 (while (search-forward "\r" nil t)
2395 (push (1- (point)) config))
2398 (defun gnus-restore-hidden-threads-configuration (config)
2399 "Restore hidden threads configuration from CONFIG."
2400 (let (point buffer-read-only)
2401 (while (setq point (pop config))
2402 (when (and (< point (point-max))
2404 (eq (char-after) ?\n))
2405 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2407 ;; Various summary mode internalish functions.
2409 (defun gnus-mouse-pick-article (e)
2412 (gnus-summary-next-page nil t))
2414 (defun gnus-summary-set-display-table ()
2415 ;; Change the display table. Odd characters have a tendency to mess
2416 ;; up nicely formatted displays - we make all possible glyphs
2417 ;; display only a single character.
2419 ;; We start from the standard display table, if any.
2420 (let ((table (or (copy-sequence standard-display-table)
2421 (make-display-table)))
2423 ;; Nix out all the control chars...
2424 (while (>= (setq i (1- i)) 0)
2425 (aset table i [??]))
2426 ;; ... but not newline and cr, of course. (cr is necessary for the
2427 ;; selective display).
2428 (aset table ?\n nil)
2429 (aset table ?\r nil)
2430 ;; We keep TAB as well.
2431 (aset table ?\t nil)
2432 ;; We nix out any glyphs over 126 that are not set already.
2434 (while (>= (setq i (1- i)) 127)
2435 ;; Only modify if the entry is nil.
2436 (unless (aref table i)
2437 (aset table i [??]))))
2438 (setq buffer-display-table table)))
2440 (defun gnus-summary-setup-buffer (group)
2441 "Initialize summary buffer."
2442 (let ((buffer (concat "*Summary " group "*")))
2443 (if (get-buffer buffer)
2446 (setq gnus-summary-buffer (current-buffer))
2447 (not gnus-newsgroup-prepared))
2448 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2449 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2450 (gnus-summary-mode group)
2452 (gnus-carpal-setup-buffer 'summary))
2453 (unless gnus-single-article-buffer
2454 (make-local-variable 'gnus-article-buffer)
2455 (make-local-variable 'gnus-article-current)
2456 (make-local-variable 'gnus-original-article-buffer))
2457 (setq gnus-newsgroup-name group)
2460 (defun gnus-set-global-variables ()
2461 ;; Set the global equivalents of the summary buffer-local variables
2462 ;; to the latest values they had. These reflect the summary buffer
2463 ;; that was in action when the last article was fetched.
2464 (when (eq major-mode 'gnus-summary-mode)
2465 (setq gnus-summary-buffer (current-buffer))
2466 (let ((name gnus-newsgroup-name)
2467 (marked gnus-newsgroup-marked)
2468 (unread gnus-newsgroup-unreads)
2469 (headers gnus-current-headers)
2470 (data gnus-newsgroup-data)
2471 (summary gnus-summary-buffer)
2472 (article-buffer gnus-article-buffer)
2473 (original gnus-original-article-buffer)
2474 (gac gnus-article-current)
2475 (reffed gnus-reffed-article-number)
2476 (score-file gnus-current-score-file)
2477 (default-charset gnus-newsgroup-charset))
2479 (set-buffer gnus-group-buffer)
2480 (setq gnus-newsgroup-name name
2481 gnus-newsgroup-marked marked
2482 gnus-newsgroup-unreads unread
2483 gnus-current-headers headers
2484 gnus-newsgroup-data data
2485 gnus-article-current gac
2486 gnus-summary-buffer summary
2487 gnus-article-buffer article-buffer
2488 gnus-original-article-buffer original
2489 gnus-reffed-article-number reffed
2490 gnus-current-score-file score-file
2491 gnus-newsgroup-charset default-charset)
2492 ;; The article buffer also has local variables.
2493 (when (gnus-buffer-live-p gnus-article-buffer)
2494 (set-buffer gnus-article-buffer)
2495 (setq gnus-summary-buffer summary))))))
2497 (defun gnus-summary-article-unread-p (article)
2498 "Say whether ARTICLE is unread or not."
2499 (memq article gnus-newsgroup-unreads))
2501 (defun gnus-summary-first-article-p (&optional article)
2502 "Return whether ARTICLE is the first article in the buffer."
2503 (if (not (setq article (or article (gnus-summary-article-number))))
2505 (eq article (caar gnus-newsgroup-data))))
2507 (defun gnus-summary-last-article-p (&optional article)
2508 "Return whether ARTICLE is the last article in the buffer."
2509 (if (not (setq article (or article (gnus-summary-article-number))))
2510 ;; All non-existent numbers are the last article. :-)
2512 (not (cdr (gnus-data-find-list article)))))
2514 (defun gnus-make-thread-indent-array ()
2516 (unless (and gnus-thread-indent-array
2517 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2518 (setq gnus-thread-indent-array (make-vector 201 "")
2519 gnus-thread-indent-array-level gnus-thread-indent-level)
2521 (aset gnus-thread-indent-array n
2522 (make-string (* n gnus-thread-indent-level) ? ))
2525 (defun gnus-update-summary-mark-positions ()
2526 "Compute where the summary marks are to go."
2528 (when (gnus-buffer-exists-p gnus-summary-buffer)
2529 (set-buffer gnus-summary-buffer))
2530 (let ((gnus-replied-mark 129)
2531 (gnus-score-below-mark 130)
2532 (gnus-score-over-mark 130)
2533 (gnus-download-mark 131)
2534 (spec gnus-summary-line-format-spec)
2537 (gnus-set-work-buffer)
2538 (let ((gnus-summary-line-format-spec spec)
2539 (gnus-newsgroup-downloadable '((0 . t))))
2540 (gnus-summary-insert-line
2541 (make-full-mail-header 0 "" "" "" "" "" 0 0 "" nil)
2542 0 nil 128 t nil "" nil 1)
2543 (goto-char (point-min))
2544 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2546 (goto-char (point-min))
2547 (push (cons 'replied (and (search-forward "\201" nil t)
2550 (goto-char (point-min))
2551 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2553 (goto-char (point-min))
2554 (push (cons 'download
2555 (and (search-forward "\203" nil t) (- (point) 2)))
2557 (setq gnus-summary-mark-positions pos))))
2559 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2560 "Insert a dummy root in the summary buffer."
2562 (gnus-add-text-properties
2563 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2564 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2566 (defun gnus-summary-from-or-to-or-newsgroups (header)
2567 (let ((to (cdr (assq 'To (mail-header-extra header))))
2568 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2569 (default-mime-charset (with-current-buffer gnus-summary-buffer
2570 default-mime-charset)))
2573 gnus-ignored-from-addresses
2574 (string-match gnus-ignored-from-addresses
2575 (mail-header-from header)))
2577 (or (car (funcall gnus-extract-address-components
2579 gnus-decode-encoded-word-function to)))
2580 (funcall gnus-decode-encoded-word-function to))))
2582 gnus-ignored-from-addresses
2583 (string-match gnus-ignored-from-addresses
2584 (mail-header-from header)))
2585 (concat "=> " newsgroups))
2587 (or (car (funcall gnus-extract-address-components
2588 (mail-header-from header)))
2589 (mail-header-from header))))))
2591 (defun gnus-summary-insert-line (gnus-tmp-header
2592 gnus-tmp-level gnus-tmp-current
2593 gnus-tmp-unread gnus-tmp-replied
2594 gnus-tmp-expirable gnus-tmp-subject-or-nil
2595 &optional gnus-tmp-dummy gnus-tmp-score
2597 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2598 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2599 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2600 (gnus-tmp-score-char
2601 (if (or (null gnus-summary-default-score)
2602 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2603 gnus-summary-zcore-fuzz))
2605 (if (< gnus-tmp-score gnus-summary-default-score)
2606 gnus-score-below-mark gnus-score-over-mark)))
2608 (cond (gnus-tmp-process gnus-process-mark)
2609 ((memq gnus-tmp-current gnus-newsgroup-cached)
2611 (gnus-tmp-replied gnus-replied-mark)
2612 ((memq gnus-tmp-current gnus-newsgroup-saved)
2614 (t gnus-unread-mark)))
2615 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2618 ((string-match "<[^>]+> *$" gnus-tmp-from)
2619 (let ((beg (match-beginning 0)))
2620 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2621 (substring gnus-tmp-from (1+ (match-beginning 0))
2622 (1- (match-end 0))))
2623 (substring gnus-tmp-from 0 beg))))
2624 ((string-match "(.+)" gnus-tmp-from)
2625 (substring gnus-tmp-from
2626 (1+ (match-beginning 0)) (1- (match-end 0))))
2628 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2629 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2630 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2631 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2632 (buffer-read-only nil))
2633 (when (string= gnus-tmp-name "")
2634 (setq gnus-tmp-name gnus-tmp-from))
2635 (unless (numberp gnus-tmp-lines)
2636 (setq gnus-tmp-lines 0))
2637 (gnus-put-text-property-excluding-characters-with-faces
2639 (progn (eval gnus-summary-line-format-spec) (point))
2640 'gnus-number gnus-tmp-number)
2641 (when (gnus-visual-p 'summary-highlight 'highlight)
2643 (gnus-run-hooks 'gnus-summary-update-hook)
2646 (defun gnus-summary-update-line (&optional dont-update)
2647 ;; Update summary line after change.
2648 (when (and gnus-summary-default-score
2649 (not gnus-summary-inhibit-highlight))
2650 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2651 (article (gnus-summary-article-number))
2652 (score (gnus-summary-article-score article)))
2654 (if (and gnus-summary-mark-below
2655 (< (gnus-summary-article-score)
2656 gnus-summary-mark-below))
2657 ;; This article has a low score, so we mark it as read.
2658 (when (memq article gnus-newsgroup-unreads)
2659 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2660 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2661 ;; This article was previously marked as read on account
2662 ;; of a low score, but now it has risen, so we mark it as
2664 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2665 (gnus-summary-update-mark
2666 (if (or (null gnus-summary-default-score)
2667 (<= (abs (- score gnus-summary-default-score))
2668 gnus-summary-zcore-fuzz))
2670 (if (< score gnus-summary-default-score)
2671 gnus-score-below-mark gnus-score-over-mark))
2673 ;; Do visual highlighting.
2674 (when (gnus-visual-p 'summary-highlight 'highlight)
2675 (gnus-run-hooks 'gnus-summary-update-hook)))))
2677 (defvar gnus-tmp-new-adopts nil)
2679 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2680 "Return the number of articles in THREAD.
2681 This may be 0 in some cases -- if none of the articles in
2682 the thread are to be displayed."
2684 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2686 ((not (listp thread))
2688 ((and (consp thread) (cdr thread))
2691 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2694 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2697 (when (and level (zerop level) gnus-tmp-new-adopts)
2700 'gnus-summary-number-of-articles-in-thread
2701 gnus-tmp-new-adopts))))
2703 (if (> number 1) gnus-not-empty-thread-mark
2704 gnus-empty-thread-mark)
2707 (defun gnus-summary-set-local-parameters (group)
2708 "Go through the local params of GROUP and set all variable specs in that list."
2709 (let ((params (gnus-group-find-parameter group))
2712 (setq elem (car params)
2713 params (cdr params))
2714 (and (consp elem) ; Has to be a cons.
2715 (consp (cdr elem)) ; The cdr has to be a list.
2716 (symbolp (car elem)) ; Has to be a symbol in there.
2717 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2718 (ignore-errors ; So we set it.
2719 (make-local-variable (car elem))
2720 (set (car elem) (eval (nth 1 elem))))))))
2722 (defun gnus-summary-read-group (group &optional show-all no-article
2723 kill-buffer no-display backward
2725 "Start reading news in newsgroup GROUP.
2726 If SHOW-ALL is non-nil, already read articles are also listed.
2727 If NO-ARTICLE is non-nil, no article is selected initially.
2728 If NO-DISPLAY, don't generate a summary buffer."
2732 (let ((gnus-auto-select-next nil))
2733 (or (gnus-summary-read-group-1
2734 group show-all no-article
2735 kill-buffer no-display
2738 select-articles nil)))))
2739 (eq gnus-auto-select-next 'quietly))
2740 (set-buffer gnus-group-buffer)
2741 ;; The entry function called above goes to the next
2742 ;; group automatically, so we go two groups back
2743 ;; if we are searching for the previous group.
2745 (gnus-group-prev-unread-group 2))
2746 (if (not (equal group (gnus-group-group-name)))
2747 (setq group (gnus-group-group-name))
2751 (defun gnus-summary-jump-to-other-group (group &optional show-all)
2752 "Directly jump to the other GROUP from summary buffer.
2753 If SHOW-ALL is non-nil, already read articles are also listed."
2755 (if (eq gnus-summary-buffer (current-buffer))
2756 (list (completing-read
2757 "Group: " gnus-active-hashtb nil t
2758 (when (and gnus-newsgroup-name
2759 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
2760 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
2761 'gnus-group-history)
2763 (error "%s must be invoked from a gnus summary buffer." this-command)))
2764 (unless (or (zerop (length group))
2765 (and gnus-newsgroup-name
2766 (string-equal gnus-newsgroup-name group)))
2768 (gnus-summary-read-group group show-all
2769 gnus-dont-select-after-jump-to-other-group)))
2771 (defun gnus-summary-read-group-1 (group show-all no-article
2772 kill-buffer no-display
2773 &optional select-articles)
2774 ;; Killed foreign groups can't be entered.
2775 (when (and (not (gnus-group-native-p group))
2776 (not (gnus-gethash group gnus-newsrc-hashtb)))
2777 (error "Dead non-native groups can't be entered"))
2778 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2779 (let* ((new-group (gnus-summary-setup-buffer group))
2780 (quit-config (gnus-group-quit-config group))
2781 (did-select (and new-group (gnus-select-newsgroup
2782 group show-all select-articles))))
2784 ;; This summary buffer exists already, so we just select it.
2786 (gnus-set-global-variables)
2788 (gnus-kill-or-deaden-summary kill-buffer))
2789 (gnus-configure-windows 'summary 'force)
2790 (gnus-set-mode-line 'summary)
2791 (gnus-summary-position-point)
2794 ;; We couldn't select this group.
2796 (when (and (eq major-mode 'gnus-summary-mode)
2797 (not (equal (current-buffer) kill-buffer)))
2798 (kill-buffer (current-buffer))
2799 (if (not quit-config)
2801 ;; Update the info -- marks might need to be removed,
2803 (gnus-summary-update-info)
2804 (set-buffer gnus-group-buffer)
2805 (gnus-group-jump-to-group group)
2806 (gnus-group-next-unread-group 1))
2807 (gnus-handle-ephemeral-exit quit-config)))
2808 (gnus-message 3 "Can't select group")
2810 ;; The user did a `C-g' while prompting for number of articles,
2811 ;; so we exit this group.
2812 ((eq did-select 'quit)
2813 (and (eq major-mode 'gnus-summary-mode)
2814 (not (equal (current-buffer) kill-buffer))
2815 (kill-buffer (current-buffer)))
2817 (gnus-kill-or-deaden-summary kill-buffer))
2818 (if (not quit-config)
2820 (set-buffer gnus-group-buffer)
2821 (gnus-group-jump-to-group group)
2822 (gnus-group-next-unread-group 1)
2823 (gnus-configure-windows 'group 'force))
2824 (gnus-handle-ephemeral-exit quit-config))
2825 ;; Finally signal the quit.
2827 ;; The group was successfully selected.
2829 (gnus-set-global-variables)
2830 ;; Save the active value in effect when the group was entered.
2831 (setq gnus-newsgroup-active
2833 (gnus-active gnus-newsgroup-name)))
2834 ;; You can change the summary buffer in some way with this hook.
2835 (gnus-run-hooks 'gnus-select-group-hook)
2836 ;; Set any local variables in the group parameters.
2837 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2838 (gnus-update-format-specifications
2839 nil 'summary 'summary-mode 'summary-dummy)
2840 (gnus-update-summary-mark-positions)
2841 ;; Do score processing.
2842 (when gnus-use-scoring
2843 (gnus-possibly-score-headers))
2844 ;; Check whether to fill in the gaps in the threads.
2845 (when gnus-build-sparse-threads
2846 (gnus-build-sparse-threads))
2847 ;; Find the initial limit.
2848 (if gnus-show-threads
2850 (let ((gnus-newsgroup-dormant nil))
2851 (gnus-summary-initial-limit show-all))
2852 (gnus-summary-initial-limit show-all))
2853 (setq gnus-newsgroup-limit
2855 (lambda (header) (mail-header-number header))
2856 gnus-newsgroup-headers)))
2857 ;; Generate the summary buffer.
2859 (gnus-summary-prepare))
2860 (when gnus-use-trees
2861 (gnus-tree-open group)
2862 (setq gnus-summary-highlight-line-function
2863 'gnus-tree-highlight-article))
2864 ;; If the summary buffer is empty, but there are some low-scored
2865 ;; articles or some excluded dormants, we include these in the
2867 (when (and (zerop (buffer-size))
2869 (cond (gnus-newsgroup-dormant
2870 (gnus-summary-limit-include-dormant))
2871 ((and gnus-newsgroup-scored show-all)
2872 (gnus-summary-limit-include-expunged t))))
2873 ;; Function `gnus-apply-kill-file' must be called in this hook.
2874 (gnus-run-hooks 'gnus-apply-kill-hook)
2875 (if (and (zerop (buffer-size))
2878 ;; This newsgroup is empty.
2879 (gnus-summary-catchup-and-exit nil t)
2880 (gnus-message 6 "No unread news")
2882 (gnus-kill-or-deaden-summary kill-buffer))
2883 ;; Return nil from this function.
2885 ;; Hide conversation thread subtrees. We cannot do this in
2886 ;; gnus-summary-prepare-hook since kill processing may not
2887 ;; work with hidden articles.
2888 (and gnus-show-threads
2889 gnus-thread-hide-subtree
2890 (gnus-summary-hide-all-threads))
2892 (gnus-kill-or-deaden-summary kill-buffer))
2893 ;; Show first unread article if requested.
2894 (if (and (not no-article)
2896 gnus-newsgroup-unreads
2897 gnus-auto-select-first)
2899 (gnus-configure-windows 'summary)
2901 ((eq gnus-auto-select-first 'best)
2902 (gnus-summary-best-unread-article))
2903 ((eq gnus-auto-select-first t)
2904 (gnus-summary-first-unread-article))
2905 ((gnus-functionp gnus-auto-select-first)
2906 (funcall gnus-auto-select-first))))
2907 ;; Don't select any articles, just move point to the first
2908 ;; article in the group.
2909 (goto-char (point-min))
2910 (gnus-summary-position-point)
2911 (gnus-configure-windows 'summary 'force)
2912 (gnus-set-mode-line 'summary))
2913 (when (get-buffer-window gnus-group-buffer t)
2914 ;; Gotta use windows, because recenter does weird stuff if
2915 ;; the current buffer ain't the displayed window.
2916 (let ((owin (selected-window)))
2917 (select-window (get-buffer-window gnus-group-buffer t))
2918 (when (gnus-group-goto-group group)
2920 (select-window owin)))
2921 ;; Mark this buffer as "prepared".
2922 (setq gnus-newsgroup-prepared t)
2923 (gnus-run-hooks 'gnus-summary-prepared-hook)
2926 (defun gnus-summary-prepare ()
2927 "Generate the summary buffer."
2929 (let ((buffer-read-only nil))
2931 (setq gnus-newsgroup-data nil
2932 gnus-newsgroup-data-reverse nil)
2933 (gnus-run-hooks 'gnus-summary-generate-hook)
2934 ;; Generate the buffer, either with threads or without.
2935 (when gnus-newsgroup-headers
2936 (gnus-summary-prepare-threads
2937 (if gnus-show-threads
2938 (gnus-sort-gathered-threads
2939 (funcall gnus-summary-thread-gathering-function
2941 (gnus-cut-threads (gnus-make-threads)))))
2942 ;; Unthreaded display.
2943 (gnus-sort-articles gnus-newsgroup-headers))))
2944 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2945 ;; Call hooks for modifying summary buffer.
2946 (goto-char (point-min))
2947 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2949 (defsubst gnus-general-simplify-subject (subject)
2950 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2953 ;; Truncate the subject.
2954 (gnus-simplify-subject-functions
2955 (gnus-map-function gnus-simplify-subject-functions subject))
2956 ((numberp gnus-summary-gather-subject-limit)
2957 (setq subject (gnus-simplify-subject-re subject))
2958 (if (> (length subject) gnus-summary-gather-subject-limit)
2959 (substring subject 0 gnus-summary-gather-subject-limit)
2961 ;; Fuzzily simplify it.
2962 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2963 (gnus-simplify-subject-fuzzy subject))
2964 ;; Just remove the leading "Re:".
2966 (gnus-simplify-subject-re subject))))
2968 (if (and gnus-summary-gather-exclude-subject
2969 (string-match gnus-summary-gather-exclude-subject subject))
2970 nil ; This article shouldn't be gathered
2973 (defun gnus-summary-simplify-subject-query ()
2974 "Query where the respool algorithm would put this article."
2976 (gnus-summary-select-article)
2977 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2979 (defun gnus-gather-threads-by-subject (threads)
2980 "Gather threads by looking at Subject headers."
2981 (if (not gnus-summary-make-false-root)
2983 (let ((hashtb (gnus-make-hashtable 1024))
2986 subject hthread whole-subject)
2988 (setq subject (gnus-general-simplify-subject
2989 (setq whole-subject (mail-header-subject
2992 (if (setq hthread (gnus-gethash subject hashtb))
2994 ;; We enter a dummy root into the thread, if we
2995 ;; haven't done that already.
2996 (unless (stringp (caar hthread))
2997 (setcar hthread (list whole-subject (car hthread))))
2998 ;; We add this new gathered thread to this gathered
3000 (setcdr (car hthread)
3001 (nconc (cdar hthread) (list (car threads))))
3002 ;; Remove it from the list of threads.
3003 (setcdr prev (cdr threads))
3004 (setq threads prev))
3005 ;; Enter this thread into the hash table.
3006 (gnus-sethash subject threads hashtb)))
3008 (setq threads (cdr threads)))
3011 (defun gnus-gather-threads-by-references (threads)
3012 "Gather threads by looking at References headers."
3013 (let ((idhashtb (gnus-make-hashtable 1024))
3014 (thhashtb (gnus-make-hashtable 1024))
3017 ids references id gthread gid entered ref)
3019 (when (setq references (mail-header-references (caar threads)))
3020 (setq id (mail-header-id (caar threads))
3021 ids (gnus-split-references references)
3023 (while (setq ref (pop ids))
3024 (setq ids (delete ref ids))
3025 (if (not (setq gid (gnus-gethash ref idhashtb)))
3027 (gnus-sethash ref id idhashtb)
3028 (gnus-sethash id threads thhashtb))
3029 (setq gthread (gnus-gethash gid thhashtb))
3031 ;; We enter a dummy root into the thread, if we
3032 ;; haven't done that already.
3033 (unless (stringp (caar gthread))
3034 (setcar gthread (list (mail-header-subject (caar gthread))
3036 ;; We add this new gathered thread to this gathered
3038 (setcdr (car gthread)
3039 (nconc (cdar gthread) (list (car threads)))))
3040 ;; Add it into the thread hash table.
3041 (gnus-sethash id gthread thhashtb)
3043 ;; Remove it from the list of threads.
3044 (setcdr prev (cdr threads))
3045 (setq threads prev))))
3047 (setq threads (cdr threads)))
3050 (defun gnus-sort-gathered-threads (threads)
3051 "Sort subtreads inside each gathered thread by article number."
3052 (let ((result threads))
3054 (when (stringp (caar threads))
3055 (setcdr (car threads)
3056 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3057 (setq threads (cdr threads)))
3060 (defun gnus-thread-loop-p (root thread)
3061 "Say whether ROOT is in THREAD."
3062 (let ((stack (list thread))
3065 (while (setq thread (pop stack))
3066 (setq th (cdr thread))
3068 (not (eq (caar th) root)))
3071 ;; We have found a loop.
3073 (setcdr thread (delq (car th) (cdr thread)))
3074 (if (boundp (setq ref-dep (intern "none"
3075 gnus-newsgroup-dependencies)))
3076 (setcdr (symbol-value ref-dep)
3077 (nconc (cdr (symbol-value ref-dep))
3079 (set ref-dep (list nil (car th))))
3082 ;; Push all the subthreads onto the stack.
3083 (push (cdr thread) stack)))
3086 (defun gnus-make-threads ()
3087 "Go through the dependency hashtb and find the roots. Return all threads."
3089 (while (catch 'infloop
3092 ;; Deal with self-referencing References loops.
3093 (when (and (car (symbol-value refs))
3100 (car (symbol-value refs)) thread))
3101 (cdr (symbol-value refs)))))))
3104 (unless (car (symbol-value refs))
3105 ;; These threads do not refer back to any other articles,
3106 ;; so they're roots.
3107 (setq threads (append (cdr (symbol-value refs)) threads))))
3108 gnus-newsgroup-dependencies)))
3111 ;; Build the thread tree.
3112 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3113 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3115 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3116 if it was already present.
3118 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3119 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3120 Message-IDs will be renamed be renamed to a unique Message-ID before
3123 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3124 (let* ((id (mail-header-id header))
3125 (id-dep (and id (intern id dependencies)))
3126 ref ref-dep ref-header)
3127 ;; Enter this `header' in the `dependencies' table.
3131 ;; The first two cases do the normal part: enter a new `header'
3132 ;; in the `dependencies' table.
3133 ((not (boundp id-dep))
3134 (set id-dep (list header)))
3135 ((null (car (symbol-value id-dep)))
3136 (setcar (symbol-value id-dep) header))
3138 ;; From here the `header' was already present in the
3139 ;; `dependencies' table.
3141 ;; Overrides an existing entry;
3142 ;; just set the header part of the entry.
3143 (setcar (symbol-value id-dep) header))
3145 ;; Renames the existing `header' to a unique Message-ID.
3146 ((not gnus-summary-ignore-duplicates)
3147 ;; An article with this Message-ID has already been seen.
3148 ;; We rename the Message-ID.
3149 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3151 (mail-header-set-id header id))
3153 ;; The last case ignores an existing entry, except it adds any
3154 ;; additional Xrefs (in case the two articles came from different
3156 ;; Also sets `header' to `nil' meaning that the `dependencies'
3157 ;; table was *not* modified.
3159 (mail-header-set-xref
3160 (car (symbol-value id-dep))
3161 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3163 (or (mail-header-xref header) "")))
3167 ;; First check if that we are not creating a References loop.
3168 (setq ref (gnus-parent-id (mail-header-references header)))
3170 (setq ref-dep (intern-soft ref dependencies))
3172 (setq ref-header (car (symbol-value ref-dep))))
3173 (if (string= id ref)
3174 ;; Yuk! This is a reference loop. Make the article be a
3177 (mail-header-set-references (car (symbol-value id-dep)) "none")
3179 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3180 (setq ref (gnus-parent-id (mail-header-references header)))
3181 (setq ref-dep (intern (or ref "none") dependencies))
3182 (if (boundp ref-dep)
3183 (setcdr (symbol-value ref-dep)
3184 (nconc (cdr (symbol-value ref-dep))
3185 (list (symbol-value id-dep))))
3186 (set ref-dep (list nil (symbol-value id-dep)))))
3189 (defun gnus-build-sparse-threads ()
3190 (let ((headers gnus-newsgroup-headers)
3191 (gnus-summary-ignore-duplicates t)
3192 header references generation relations
3193 subject child end new-child date)
3194 ;; First we create an alist of generations/relations, where
3195 ;; generations is how much we trust the relation, and the relation
3197 (gnus-message 7 "Making sparse threads...")
3199 (nnheader-set-temp-buffer " *gnus sparse threads*")
3200 (while (setq header (pop headers))
3201 (when (and (setq references (mail-header-references header))
3202 (not (string= references "")))
3204 (setq child (mail-header-id header)
3205 subject (mail-header-subject header)
3206 date (mail-header-date header)
3208 (while (search-backward ">" nil t)
3209 (setq end (1+ (point)))
3210 (when (search-backward "<" nil t)
3211 (setq new-child (buffer-substring (point) end))
3212 (push (list (incf generation)
3213 child (setq child new-child)
3217 (push (list (1+ generation) child nil subject) relations))
3219 (kill-buffer (current-buffer)))
3220 ;; Sort over trustworthiness.
3223 (when (gnus-dependencies-add-header
3224 (make-full-mail-header
3225 gnus-reffed-article-number
3226 (nth 3 relation) "" (or (nth 4 relation) "")
3228 (or (nth 2 relation) "") 0 0 "")
3229 gnus-newsgroup-dependencies nil)
3230 (push gnus-reffed-article-number gnus-newsgroup-limit)
3231 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3232 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3233 gnus-newsgroup-reads)
3234 (decf gnus-reffed-article-number)))
3235 (sort relations 'car-less-than-car))
3236 (gnus-message 7 "Making sparse threads...done")))
3238 (defun gnus-build-old-threads ()
3239 ;; Look at all the articles that refer back to old articles, and
3240 ;; fetch the headers for the articles that aren't there. This will
3241 ;; build complete threads - if the roots haven't been expired by the
3246 (when (not (car (symbol-value refs)))
3247 (setq heads (cdr (symbol-value refs)))
3249 (if (memq (mail-header-number (caar heads))
3250 gnus-newsgroup-dormant)
3251 (setq heads (cdr heads))
3252 (setq id (symbol-name refs))
3253 (while (and (setq id (gnus-build-get-header id))
3254 (not (car (gnus-id-to-thread id)))))
3255 (setq heads nil)))))
3256 gnus-newsgroup-dependencies)))
3258 ;; This function has to be called with point after the article number
3259 ;; on the beginning of the line.
3260 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3261 (let ((eol (gnus-point-at-eol))
3262 (buffer (current-buffer))
3265 ;; overview: [num subject from date id refs chars lines misc]
3270 (make-full-mail-header
3272 (nnheader-nov-field) ; subject
3273 (nnheader-nov-field) ; from
3274 (nnheader-nov-field) ; date
3275 (nnheader-nov-read-message-id) ; id
3276 (nnheader-nov-field) ; refs
3277 (nnheader-nov-read-integer) ; chars
3278 (nnheader-nov-read-integer) ; lines
3280 (nnheader-nov-field)) ; misc
3281 (nnheader-nov-parse-extra))) ; extra
3283 (when gnus-alter-header-function
3284 (funcall gnus-alter-header-function header))
3285 (gnus-dependencies-add-header header dependencies force-new)))
3287 (defun gnus-build-get-header (id)
3288 ;; Look through the buffer of NOV lines and find the header to
3289 ;; ID. Enter this line into the dependencies hash table, and return
3290 ;; the id of the parent article (if any).
3291 (let ((deps gnus-newsgroup-dependencies)
3295 (set-buffer nntp-server-buffer)
3296 (let ((case-fold-search nil))
3297 (goto-char (point-min))
3298 (while (and (not found)
3299 (search-forward id nil t))
3301 (setq found (looking-at
3302 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3303 (regexp-quote id))))
3304 (or found (beginning-of-line 2)))
3308 (setq header (gnus-nov-parse-line
3309 (read (current-buffer)) deps))
3310 (gnus-parent-id (mail-header-references header))))))
3312 (let ((number (mail-header-number header)))
3313 (push number gnus-newsgroup-limit)
3314 (push header gnus-newsgroup-headers)
3315 (if (memq number gnus-newsgroup-unselected)
3317 (push number gnus-newsgroup-unreads)
3318 (setq gnus-newsgroup-unselected
3319 (delq number gnus-newsgroup-unselected)))
3320 (push number gnus-newsgroup-ancient)))))))
3322 (defun gnus-build-all-threads ()
3323 "Read all the headers."
3324 (let ((gnus-summary-ignore-duplicates t)
3325 (dependencies gnus-newsgroup-dependencies)
3328 (set-buffer nntp-server-buffer)
3329 (let ((case-fold-search nil))
3330 (goto-char (point-min))
3333 (setq article (read (current-buffer))
3334 header (gnus-nov-parse-line
3335 article dependencies)))
3338 (set-buffer gnus-summary-buffer)
3339 (push header gnus-newsgroup-headers)
3340 (if (memq (setq article (mail-header-number header))
3341 gnus-newsgroup-unselected)
3343 (push article gnus-newsgroup-unreads)
3344 (setq gnus-newsgroup-unselected
3345 (delq article gnus-newsgroup-unselected)))
3346 (push article gnus-newsgroup-ancient)))
3347 (forward-line 1)))))))
3349 (defun gnus-summary-update-article-line (article header)
3350 "Update the line for ARTICLE using HEADERS."
3351 (let* ((id (mail-header-id header))
3352 (thread (gnus-id-to-thread id)))
3354 (error "Article in no thread"))
3355 ;; Update the thread.
3356 (setcar thread header)
3357 (gnus-summary-goto-subject article)
3358 (let* ((datal (gnus-data-find-list article))
3360 (length (when (cdr datal)
3361 (- (gnus-data-pos data)
3362 (gnus-data-pos (cadr datal)))))
3363 (buffer-read-only nil)
3364 (level (gnus-summary-thread-level)))
3366 (gnus-summary-insert-line
3367 header level nil (gnus-article-mark article)
3368 (memq article gnus-newsgroup-replied)
3369 (memq article gnus-newsgroup-expirable)
3370 ;; Only insert the Subject string when it's different
3371 ;; from the previous Subject string.
3372 (if (gnus-subject-equal
3374 (mail-header-subject
3377 (gnus-data-find-list
3379 (gnus-data-list t)))))
3380 ;; Error on the side of excessive subjects.
3382 (mail-header-subject header))
3384 (mail-header-subject header))
3385 nil (cdr (assq article gnus-newsgroup-scored))
3386 (memq article gnus-newsgroup-processable))
3388 (gnus-data-update-list
3389 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3391 (defun gnus-summary-update-article (article &optional iheader)
3392 "Update ARTICLE in the summary buffer."
3393 (set-buffer gnus-summary-buffer)
3394 (let* ((header (gnus-summary-article-header article))
3395 (id (mail-header-id header))
3396 (data (gnus-data-find article))
3397 (thread (gnus-id-to-thread id))
3398 (references (mail-header-references header))
3402 (when (and references
3403 (not (equal "" references)))
3406 (buffer-read-only nil)
3412 (delq thread parent)))
3413 (if (gnus-summary-insert-subject id header)
3414 ;; Set the (possibly) new article number in the data structure.
3415 (gnus-data-set-number data (gnus-id-to-article id))
3419 (defun gnus-rebuild-thread (id &optional line)
3420 "Rebuild the thread containing ID.
3421 If LINE, insert the rebuilt thread starting on line LINE."
3422 (let ((buffer-read-only nil)
3423 old-pos current thread data)
3424 (if (not gnus-show-threads)
3425 (setq thread (list (car (gnus-id-to-thread id))))
3426 ;; Get the thread this article is part of.
3427 (setq thread (gnus-remove-thread id)))
3428 (setq old-pos (gnus-point-at-bol))
3429 (setq current (save-excursion
3430 (and (zerop (forward-line -1))
3431 (gnus-summary-article-number))))
3432 ;; If this is a gathered thread, we have to go some re-gathering.
3433 (when (stringp (car thread))
3434 (let ((subject (car thread))
3436 (setq thread (cdr thread))
3438 (unless (memq (setq thr (gnus-id-to-thread
3440 (mail-header-id (caar thread)))))
3443 (setq thread (cdr thread)))
3444 ;; We now have all (unique) roots.
3445 (if (= (length roots) 1)
3446 ;; All the loose roots are now one solid root.
3447 (setq thread (car roots))
3448 (setq thread (cons subject (gnus-sort-threads roots))))))
3450 ;; We then insert this thread into the summary buffer.
3452 (goto-char (point-min))
3453 (forward-line (1- line)))
3454 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3455 (if gnus-show-threads
3456 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3457 (gnus-summary-prepare-unthreaded thread))
3458 (setq data (nreverse gnus-newsgroup-data))
3459 (setq threads gnus-newsgroup-threads))
3460 ;; We splice the new data into the data structure.
3461 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3462 ;;!!! then we want to insert at the beginning of the buffer.
3463 ;;!!! That happens to be true with Gnus now, but that may
3464 ;;!!! change in the future. Perhaps.
3465 (gnus-data-enter-list
3466 (if line nil current) data (- (point) old-pos))
3467 (setq gnus-newsgroup-threads
3468 (nconc threads gnus-newsgroup-threads))
3469 (gnus-data-compute-positions))))
3471 (defun gnus-number-to-header (number)
3472 "Return the header for article NUMBER."
3473 (let ((headers gnus-newsgroup-headers))
3475 (not (= number (mail-header-number (car headers)))))
3480 (defun gnus-parent-headers (in-headers &optional generation)
3481 "Return the headers of the GENERATIONeth parent of HEADERS."
3483 (setq generation 1))
3485 (headers in-headers)
3488 (not (zerop generation))
3489 (setq references (mail-header-references headers)))
3490 (setq headers (if (and references
3491 (setq parent (gnus-parent-id references)))
3492 (car (gnus-id-to-thread parent))
3495 (and (not (eq headers in-headers))
3498 (defun gnus-id-to-thread (id)
3499 "Return the (sub-)thread where ID appears."
3500 (gnus-gethash id gnus-newsgroup-dependencies))
3502 (defun gnus-id-to-article (id)
3503 "Return the article number of ID."
3504 (let ((thread (gnus-id-to-thread id)))
3507 (mail-header-number (car thread)))))
3509 (defun gnus-id-to-header (id)
3510 "Return the article headers of ID."
3511 (car (gnus-id-to-thread id)))
3513 (defun gnus-article-displayed-root-p (article)
3514 "Say whether ARTICLE is a root(ish) article."
3515 (let ((level (gnus-summary-thread-level article))
3516 (refs (mail-header-references (gnus-summary-article-header article)))
3522 ((null (gnus-parent-id refs)) t)
3524 (null (setq particle (gnus-id-to-article
3525 (gnus-parent-id refs))))
3526 (null (gnus-summary-thread-level particle)))))))
3528 (defun gnus-root-id (id)
3529 "Return the id of the root of the thread where ID appears."
3531 (while (and id (setq prev (car (gnus-id-to-thread id))))
3533 id (gnus-parent-id (mail-header-references prev))))
3536 (defun gnus-articles-in-thread (thread)
3537 "Return the list of articles in THREAD."
3538 (cons (mail-header-number (car thread))
3539 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3541 (defun gnus-remove-thread (id &optional dont-remove)
3542 "Remove the thread that has ID in it."
3543 (let (headers thread last-id)
3544 ;; First go up in this thread until we find the root.
3545 (setq last-id (gnus-root-id id)
3546 headers (message-flatten-list (gnus-id-to-thread last-id)))
3547 ;; We have now found the real root of this thread. It might have
3548 ;; been gathered into some loose thread, so we have to search
3549 ;; through the threads to find the thread we wanted.
3550 (let ((threads gnus-newsgroup-threads)
3553 (setq sub (car threads))
3554 (if (stringp (car sub))
3555 ;; This is a gathered thread, so we look at the roots
3556 ;; below it to find whether this article is in this
3559 (setq sub (cdr sub))
3561 (when (member (caar sub) headers)
3562 (setq thread (car threads)
3565 (setq sub (cdr sub))))
3566 ;; It's an ordinary thread, so we check it.
3567 (when (eq (car sub) (car headers))
3570 (setq threads (cdr threads)))
3571 ;; If this article is in no thread, then it's a root.
3574 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3575 (setq thread (gnus-id-to-thread last-id)))
3578 thread ; We return this thread.
3580 (if (stringp (car thread))
3582 ;; If we use dummy roots, then we have to remove the
3583 ;; dummy root as well.
3584 (when (eq gnus-summary-make-false-root 'dummy)
3585 ;; We go to the dummy root by going to
3586 ;; the first sub-"thread", and then one line up.
3587 (gnus-summary-goto-article
3588 (mail-header-number (caadr thread)))
3591 (gnus-data-compute-positions))
3592 (setq thread (cdr thread))
3594 (gnus-remove-thread-1 (car thread))
3595 (setq thread (cdr thread))))
3596 (gnus-summary-show-all-threads)
3597 (gnus-remove-thread-1 thread))))))))
3599 (defun gnus-remove-thread-1 (thread)
3600 "Remove the thread THREAD recursively."
3601 (let ((number (mail-header-number (pop thread)))
3603 (setq thread (reverse thread))
3605 (gnus-remove-thread-1 (pop thread)))
3606 (when (setq d (gnus-data-find number))
3607 (goto-char (gnus-data-pos d))
3610 (- (gnus-point-at-bol)
3612 (1+ (gnus-point-at-eol))
3613 (gnus-delete-line)))))))
3615 (defun gnus-sort-threads (threads)
3617 (if (not gnus-thread-sort-functions)
3619 (gnus-message 8 "Sorting threads...")
3621 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3622 (gnus-message 8 "Sorting threads...done"))))
3624 (defun gnus-sort-articles (articles)
3626 (when gnus-article-sort-functions
3627 (gnus-message 7 "Sorting articles...")
3629 (setq gnus-newsgroup-headers
3630 (sort articles (gnus-make-sort-function
3631 gnus-article-sort-functions)))
3632 (gnus-message 7 "Sorting articles...done"))))
3634 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3635 (defmacro gnus-thread-header (thread)
3636 ;; Return header of first article in THREAD.
3637 ;; Note that THREAD must never, ever be anything else than a variable -
3638 ;; using some other form will lead to serious barfage.
3639 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3640 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3641 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3644 (defsubst gnus-article-sort-by-number (h1 h2)
3645 "Sort articles by article number."
3646 (< (mail-header-number h1)
3647 (mail-header-number h2)))
3649 (defun gnus-thread-sort-by-number (h1 h2)
3650 "Sort threads by root article number."
3651 (gnus-article-sort-by-number
3652 (gnus-thread-header h1) (gnus-thread-header h2)))
3654 (defsubst gnus-article-sort-by-lines (h1 h2)
3655 "Sort articles by article Lines header."
3656 (< (mail-header-lines h1)
3657 (mail-header-lines h2)))
3659 (defun gnus-thread-sort-by-lines (h1 h2)
3660 "Sort threads by root article Lines header."
3661 (gnus-article-sort-by-lines
3662 (gnus-thread-header h1) (gnus-thread-header h2)))
3664 (defsubst gnus-article-sort-by-chars (h1 h2)
3665 "Sort articles by octet length."
3666 (< (mail-header-chars h1)
3667 (mail-header-chars h2)))
3669 (defun gnus-thread-sort-by-chars (h1 h2)
3670 "Sort threads by root article octet length."
3671 (gnus-article-sort-by-chars
3672 (gnus-thread-header h1) (gnus-thread-header h2)))
3674 (defsubst gnus-article-sort-by-author (h1 h2)
3675 "Sort articles by root author."
3677 (let ((addr (car (mime-read-field 'From h1))))
3678 (or (std11-full-name-string addr)
3679 (std11-address-string addr)
3681 (let ((addr (car (mime-read-field 'From h2))))
3682 (or (std11-full-name-string addr)
3683 (std11-address-string addr)
3687 (defun gnus-thread-sort-by-author (h1 h2)
3688 "Sort threads by root author."
3689 (gnus-article-sort-by-author
3690 (gnus-thread-header h1) (gnus-thread-header h2)))
3692 (defsubst gnus-article-sort-by-subject (h1 h2)
3693 "Sort articles by root subject."
3695 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3696 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3698 (defun gnus-thread-sort-by-subject (h1 h2)
3699 "Sort threads by root subject."
3700 (gnus-article-sort-by-subject
3701 (gnus-thread-header h1) (gnus-thread-header h2)))
3703 (defsubst gnus-article-sort-by-date (h1 h2)
3704 "Sort articles by root article date."
3706 (gnus-date-get-time (mail-header-date h1))
3707 (gnus-date-get-time (mail-header-date h2))))
3709 (defun gnus-thread-sort-by-date (h1 h2)
3710 "Sort threads by root article date."
3711 (gnus-article-sort-by-date
3712 (gnus-thread-header h1) (gnus-thread-header h2)))
3714 (defsubst gnus-article-sort-by-score (h1 h2)
3715 "Sort articles by root article score.
3716 Unscored articles will be counted as having a score of zero."
3717 (> (or (cdr (assq (mail-header-number h1)
3718 gnus-newsgroup-scored))
3719 gnus-summary-default-score 0)
3720 (or (cdr (assq (mail-header-number h2)
3721 gnus-newsgroup-scored))
3722 gnus-summary-default-score 0)))
3724 (defun gnus-thread-sort-by-score (h1 h2)
3725 "Sort threads by root article score."
3726 (gnus-article-sort-by-score
3727 (gnus-thread-header h1) (gnus-thread-header h2)))
3729 (defun gnus-thread-sort-by-total-score (h1 h2)
3730 "Sort threads by the sum of all scores in the thread.
3731 Unscored articles will be counted as having a score of zero."
3732 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3734 (defun gnus-thread-total-score (thread)
3735 ;; This function find the total score of THREAD.
3736 (cond ((null thread)
3739 (if (stringp (car thread))
3740 (apply gnus-thread-score-function 0
3741 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3742 (gnus-thread-total-score-1 thread)))
3744 (gnus-thread-total-score-1 (list thread)))))
3746 (defun gnus-thread-total-score-1 (root)
3747 ;; This function find the total score of the thread below ROOT.
3748 (setq root (car root))
3749 (apply gnus-thread-score-function
3751 (mapcar 'gnus-thread-total-score
3752 (cdr (gnus-id-to-thread (mail-header-id root))))
3753 (when (> (mail-header-number root) 0)
3754 (list (or (cdr (assq (mail-header-number root)
3755 gnus-newsgroup-scored))
3756 gnus-summary-default-score 0))))
3757 (list gnus-summary-default-score)
3760 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3761 (defvar gnus-tmp-prev-subject nil)
3762 (defvar gnus-tmp-false-parent nil)
3763 (defvar gnus-tmp-root-expunged nil)
3764 (defvar gnus-tmp-dummy-line nil)
3766 (defvar gnus-tmp-header)
3767 (defun gnus-extra-header (type &optional header)
3768 "Return the extra header of TYPE."
3769 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3772 (defun gnus-summary-prepare-threads (threads)
3773 "Prepare summary buffer from THREADS and indentation LEVEL.
3774 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3775 or a straight list of headers."
3776 (gnus-message 7 "Generating summary...")
3778 (setq gnus-newsgroup-threads threads)
3781 (let ((gnus-tmp-level 0)
3782 (default-score (or gnus-summary-default-score 0))
3783 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3784 thread number subject stack state gnus-tmp-gathered beg-match
3785 new-roots gnus-tmp-new-adopts thread-end
3786 gnus-tmp-header gnus-tmp-unread
3787 gnus-tmp-replied gnus-tmp-subject-or-nil
3788 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3789 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3790 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3792 (setq gnus-tmp-prev-subject nil)
3794 (if (vectorp (car threads))
3795 ;; If this is a straight (sic) list of headers, then a
3796 ;; threaded summary display isn't required, so we just create
3797 ;; an unthreaded one.
3798 (gnus-summary-prepare-unthreaded threads)
3800 ;; Do the threaded display.
3802 (while (or threads stack gnus-tmp-new-adopts new-roots)
3804 (if (and (= gnus-tmp-level 0)
3807 (not gnus-tmp-false-parent)
3808 (or gnus-tmp-new-adopts new-roots))
3809 (if gnus-tmp-new-adopts
3810 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3811 thread (list (car gnus-tmp-new-adopts))
3812 gnus-tmp-header (caar thread)
3813 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3815 (setq thread (list (car new-roots))
3816 gnus-tmp-header (caar thread)
3817 new-roots (cdr new-roots))))
3820 ;; If there are some threads, we do them before the
3821 ;; threads on the stack.
3822 (setq thread threads
3823 gnus-tmp-header (caar thread))
3824 ;; There were no current threads, so we pop something off
3826 (setq state (car stack)
3827 gnus-tmp-level (car state)
3830 gnus-tmp-header (caar thread))))
3832 (setq gnus-tmp-false-parent nil)
3833 (setq gnus-tmp-root-expunged nil)
3834 (setq thread-end nil)
3836 (if (stringp gnus-tmp-header)
3837 ;; The header is a dummy root.
3839 ((eq gnus-summary-make-false-root 'adopt)
3840 ;; We let the first article adopt the rest.
3841 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3843 (setq gnus-tmp-gathered
3845 (lambda (h) (mail-header-number (car h)))
3848 (setq thread (cons (list (caar thread)
3851 (setq gnus-tmp-level -1
3852 gnus-tmp-false-parent t))
3853 ((eq gnus-summary-make-false-root 'empty)
3854 ;; We print adopted articles with empty subject fields.
3855 (setq gnus-tmp-gathered
3857 (lambda (h) (mail-header-number (car h)))
3860 (setq gnus-tmp-level -1))
3861 ((eq gnus-summary-make-false-root 'dummy)
3862 ;; We remember that we probably want to output a dummy
3864 (setq gnus-tmp-dummy-line gnus-tmp-header)
3865 (setq gnus-tmp-prev-subject gnus-tmp-header))
3867 ;; We do not make a root for the gathered
3868 ;; sub-threads at all.
3869 (setq gnus-tmp-level -1)))
3871 (setq number (mail-header-number gnus-tmp-header)
3872 subject (mail-header-subject gnus-tmp-header))
3875 ;; If the thread has changed subject, we might want to make
3876 ;; this subthread into a root.
3877 ((and (null gnus-thread-ignore-subject)
3878 (not (zerop gnus-tmp-level))
3879 gnus-tmp-prev-subject
3881 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3882 (setq new-roots (nconc new-roots (list (car thread)))
3884 gnus-tmp-header nil))
3885 ;; If the article lies outside the current limit,
3886 ;; then we do not display it.
3887 ((not (memq number gnus-newsgroup-limit))
3888 (setq gnus-tmp-gathered
3890 (lambda (h) (mail-header-number (car h)))
3893 (setq gnus-tmp-new-adopts (if (cdar thread)
3894 (append gnus-tmp-new-adopts
3896 gnus-tmp-new-adopts)
3898 gnus-tmp-header nil)
3899 (when (zerop gnus-tmp-level)
3900 (setq gnus-tmp-root-expunged t)))
3901 ;; Perhaps this article is to be marked as read?
3902 ((and gnus-summary-mark-below
3903 (< (or (cdr (assq number gnus-newsgroup-scored))
3905 gnus-summary-mark-below)
3906 ;; Don't touch sparse articles.
3907 (not (gnus-summary-article-sparse-p number))
3908 (not (gnus-summary-article-ancient-p number)))
3909 (setq gnus-newsgroup-unreads
3910 (delq number gnus-newsgroup-unreads))
3911 (if gnus-newsgroup-auto-expire
3912 (push number gnus-newsgroup-expirable)
3913 (push (cons number gnus-low-score-mark)
3914 gnus-newsgroup-reads))))
3916 (when gnus-tmp-header
3917 ;; We may have an old dummy line to output before this
3919 (when (and gnus-tmp-dummy-line
3922 (mail-header-subject gnus-tmp-header)))
3923 (gnus-summary-insert-dummy-line
3924 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3925 (setq gnus-tmp-dummy-line nil))
3927 ;; Compute the mark.
3928 (setq gnus-tmp-unread (gnus-article-mark number))
3930 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3931 gnus-tmp-header gnus-tmp-level)
3932 gnus-newsgroup-data)
3934 ;; Actually insert the line.
3936 gnus-tmp-subject-or-nil
3938 ((and gnus-thread-ignore-subject
3939 gnus-tmp-prev-subject
3940 (not (inline (gnus-subject-equal
3941 gnus-tmp-prev-subject subject))))
3943 ((zerop gnus-tmp-level)
3944 (if (and (eq gnus-summary-make-false-root 'empty)
3945 (memq number gnus-tmp-gathered)
3946 gnus-tmp-prev-subject
3947 (inline (gnus-subject-equal
3948 gnus-tmp-prev-subject subject)))
3949 gnus-summary-same-subject
3951 (t gnus-summary-same-subject)))
3952 (if (and (eq gnus-summary-make-false-root 'adopt)
3953 (= gnus-tmp-level 1)
3954 (memq number gnus-tmp-gathered))
3955 (setq gnus-tmp-opening-bracket ?\<
3956 gnus-tmp-closing-bracket ?\>)
3957 (setq gnus-tmp-opening-bracket ?\[
3958 gnus-tmp-closing-bracket ?\]))
3960 gnus-tmp-indentation
3961 (aref gnus-thread-indent-array gnus-tmp-level)
3962 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3963 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3964 gnus-summary-default-score 0)
3966 (if (or (null gnus-summary-default-score)
3967 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3968 gnus-summary-zcore-fuzz))
3970 (if (< gnus-tmp-score gnus-summary-default-score)
3971 gnus-score-below-mark gnus-score-over-mark))
3973 (cond ((memq number gnus-newsgroup-processable)
3975 ((memq number gnus-newsgroup-cached)
3977 ((memq number gnus-newsgroup-replied)
3979 ((memq number gnus-newsgroup-saved)
3981 (t gnus-unread-mark))
3982 gnus-tmp-from (mail-header-from gnus-tmp-header)
3985 ((string-match "<[^>]+> *$" gnus-tmp-from)
3986 (setq beg-match (match-beginning 0))
3987 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3988 (substring gnus-tmp-from (1+ (match-beginning 0))
3989 (1- (match-end 0))))
3990 (substring gnus-tmp-from 0 beg-match)))
3991 ((string-match "(.+)" gnus-tmp-from)
3992 (substring gnus-tmp-from
3993 (1+ (match-beginning 0)) (1- (match-end 0))))
3995 (when (string= gnus-tmp-name "")
3996 (setq gnus-tmp-name gnus-tmp-from))
3997 (unless (numberp gnus-tmp-lines)
3998 (setq gnus-tmp-lines 0))
3999 (gnus-put-text-property
4001 (progn (eval gnus-summary-line-format-spec) (point))
4002 'gnus-number number)
4005 (gnus-run-hooks 'gnus-summary-update-hook)
4008 (setq gnus-tmp-prev-subject subject)))
4010 (when (nth 1 thread)
4011 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4012 (incf gnus-tmp-level)
4013 (setq threads (if thread-end nil (cdar thread)))
4015 (setq gnus-tmp-level 0)))))
4016 (gnus-message 7 "Generating summary...done"))
4018 (defun gnus-summary-prepare-unthreaded (headers)
4019 "Generate an unthreaded summary buffer based on HEADERS."
4020 (let (header number mark)
4025 ;; We may have to root out some bad articles...
4026 (when (memq (setq number (mail-header-number
4027 (setq header (pop headers))))
4028 gnus-newsgroup-limit)
4029 ;; Mark article as read when it has a low score.
4030 (when (and gnus-summary-mark-below
4031 (< (or (cdr (assq number gnus-newsgroup-scored))
4032 gnus-summary-default-score 0)
4033 gnus-summary-mark-below)
4034 (not (gnus-summary-article-ancient-p number)))
4035 (setq gnus-newsgroup-unreads
4036 (delq number gnus-newsgroup-unreads))
4037 (if gnus-newsgroup-auto-expire
4038 (push number gnus-newsgroup-expirable)
4039 (push (cons number gnus-low-score-mark)
4040 gnus-newsgroup-reads)))
4042 (setq mark (gnus-article-mark number))
4043 (push (gnus-data-make number mark (1+ (point)) header 0)
4044 gnus-newsgroup-data)
4045 (gnus-summary-insert-line
4047 mark (memq number gnus-newsgroup-replied)
4048 (memq number gnus-newsgroup-expirable)
4049 (mail-header-subject header) nil
4050 (cdr (assq number gnus-newsgroup-scored))
4051 (memq number gnus-newsgroup-processable))))))
4053 (defun gnus-summary-remove-list-identifiers ()
4054 "Remove list identifiers in `gnus-list-identifiers' from articles in
4056 (let ((regexp (if (stringp gnus-list-identifiers)
4057 gnus-list-identifiers
4058 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4060 (dolist (header gnus-newsgroup-headers)
4061 (when (string-match (concat "\\(Re: +\\)?\\(" regexp " *\\)")
4062 (mail-header-subject header))
4063 (mail-header-set-subject
4064 header (concat (substring (mail-header-subject header)
4065 0 (match-beginning 2))
4066 (substring (mail-header-subject header)
4067 (match-end 2)))))))))
4069 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4070 "Select newsgroup GROUP.
4071 If READ-ALL is non-nil, all articles in the group are selected.
4072 If SELECT-ARTICLES, only select those articles from GROUP."
4073 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4074 ;;!!! Dirty hack; should be removed.
4075 (gnus-summary-ignore-duplicates
4076 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4078 gnus-summary-ignore-duplicates))
4079 (info (nth 2 entry))
4080 articles fetched-articles cached)
4082 (unless (gnus-check-server
4083 (setq gnus-current-select-method
4084 (gnus-find-method-for-group group)))
4085 (error "Couldn't open server"))
4087 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4088 (gnus-activate-group group) ; Or we can activate it...
4089 (progn ; Or we bug out.
4090 (when (equal major-mode 'gnus-summary-mode)
4091 (kill-buffer (current-buffer)))
4092 (error "Couldn't request group %s: %s"
4093 group (gnus-status-message group))))
4095 (unless (gnus-request-group group t)
4096 (when (equal major-mode 'gnus-summary-mode)
4097 (kill-buffer (current-buffer)))
4098 (error "Couldn't request group %s: %s"
4099 group (gnus-status-message group)))
4101 (setq gnus-newsgroup-name group)
4102 (setq gnus-newsgroup-unselected nil)
4103 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4104 (gnus-summary-setup-default-charset)
4106 ;; Adjust and set lists of article marks.
4108 (gnus-adjust-marked-articles info))
4110 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4112 (if (gnus-virtual-group-p group)
4113 gnus-newsgroup-cached
4114 (gnus-cache-articles-in-group group)))
4116 (setq gnus-newsgroup-unreads
4117 (gnus-set-difference
4118 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4119 gnus-newsgroup-dormant))
4121 (setq gnus-newsgroup-processable nil)
4123 (gnus-update-read-articles group gnus-newsgroup-unreads)
4125 (if (setq articles select-articles)
4126 (setq gnus-newsgroup-unselected
4127 (gnus-sorted-intersection
4128 gnus-newsgroup-unreads
4129 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4130 (setq articles (gnus-articles-to-read group read-all)))
4134 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4136 ((eq articles 0) nil)
4138 ;; Init the dependencies hash table.
4139 (setq gnus-newsgroup-dependencies
4140 (gnus-make-hashtable (length articles)))
4141 (gnus-set-global-variables)
4142 ;; Retrieve the headers and read them in.
4143 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4144 (setq gnus-newsgroup-headers
4145 (gnus-retrieve-parsed-headers
4146 articles gnus-newsgroup-name
4147 ;; We might want to fetch old headers, but
4148 ;; not if there is only 1 article.
4149 (and (or (and (not (eq gnus-fetch-old-headers 'some))
4150 (not (numberp gnus-fetch-old-headers)))
4151 (> (length articles) 1))
4152 gnus-fetch-old-headers)))
4153 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4155 ;; Suppress duplicates?
4156 (when gnus-suppress-duplicates
4157 (gnus-dup-suppress-articles))
4159 ;; Set the initial limit.
4160 (setq gnus-newsgroup-limit (copy-sequence articles))
4161 ;; Remove canceled articles from the list of unread articles.
4162 (setq gnus-newsgroup-unreads
4163 (gnus-set-sorted-intersection
4164 gnus-newsgroup-unreads
4165 (setq fetched-articles
4166 (mapcar (lambda (headers) (mail-header-number headers))
4167 gnus-newsgroup-headers))))
4168 ;; Removed marked articles that do not exist.
4169 (gnus-update-missing-marks
4170 (gnus-sorted-complement fetched-articles articles))
4172 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4174 (setq gnus-newsgroup-cached cached))
4176 ;; We might want to build some more threads first.
4177 (when (and gnus-fetch-old-headers
4178 (eq gnus-headers-retrieved-by 'nov))
4179 (if (eq gnus-fetch-old-headers 'invisible)
4180 (gnus-build-all-threads)
4181 (gnus-build-old-threads)))
4182 ;; Let the Gnus agent mark articles as read.
4184 (gnus-agent-get-undownloaded-list))
4185 ;; Remove list identifiers from subject
4186 (when gnus-list-identifiers
4187 (gnus-summary-remove-list-identifiers))
4188 ;; Check whether auto-expire is to be done in this group.
4189 (setq gnus-newsgroup-auto-expire
4190 (gnus-group-auto-expirable-p group))
4191 ;; Set up the article buffer now, if necessary.
4192 (unless gnus-single-article-buffer
4193 (gnus-article-setup-buffer))
4194 ;; First and last article in this newsgroup.
4195 (when gnus-newsgroup-headers
4196 (setq gnus-newsgroup-begin
4197 (mail-header-number (car gnus-newsgroup-headers))
4200 (gnus-last-element gnus-newsgroup-headers))))
4201 ;; GROUP is successfully selected.
4202 (or gnus-newsgroup-headers t)))))
4204 (defun gnus-articles-to-read (group &optional read-all)
4205 ;; Find out what articles the user wants to read.
4207 ;; Select all articles if `read-all' is non-nil, or if there
4208 ;; are no unread articles.
4210 (and (zerop (length gnus-newsgroup-marked))
4211 (zerop (length gnus-newsgroup-unreads)))
4212 (eq (gnus-group-find-parameter group 'display)
4215 (gnus-uncompress-range (gnus-active group))
4216 (gnus-cache-articles-in-group group))
4217 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4218 (copy-sequence gnus-newsgroup-unreads))
4220 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4221 (scored (length scored-list))
4222 (number (length articles))
4223 (marked (+ (length gnus-newsgroup-marked)
4224 (length gnus-newsgroup-dormant)))
4232 ((and (or (<= scored marked) (= scored number))
4233 (natnump gnus-large-newsgroup)
4234 (> number gnus-large-newsgroup))
4235 (let ((input (read-from-minibuffer
4237 "How many articles from %s (max %d): "
4238 (gnus-limit-string gnus-newsgroup-name 35)
4240 (static-if (< emacs-major-version 20)
4241 (number-to-string gnus-large-newsgroup)
4243 (number-to-string gnus-large-newsgroup)
4245 (if (string-match "^[ \t]*$" input)
4248 ((and (> scored marked) (< scored number)
4249 (> (- scored number) 20))
4252 (format "%s %s (%d scored, %d total): "
4253 "How many articles from"
4254 group scored number))))
4255 (if (string-match "^[ \t]*$" input)
4259 (setq select (if (stringp select) (string-to-number select) select))
4260 (if (or (null select) (zerop select))
4262 (if (and (not (zerop scored)) (<= (abs select) scored))
4264 (setq articles (sort scored-list '<))
4265 (setq number (length articles)))
4266 (setq articles (copy-sequence articles)))
4268 (when (< (abs select) number)
4270 ;; Select the N oldest articles.
4271 (setcdr (nthcdr (1- (abs select)) articles) nil)
4272 ;; Select the N most recent articles.
4273 (setq articles (nthcdr (- number select) articles))))
4274 (setq gnus-newsgroup-unselected
4275 (gnus-sorted-intersection
4276 gnus-newsgroup-unreads
4277 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4280 (defun gnus-killed-articles (killed articles)
4283 (when (inline (gnus-member-of-range (car articles) killed))
4284 (push (car articles) out))
4285 (setq articles (cdr articles)))
4288 (defun gnus-uncompress-marks (marks)
4289 "Uncompress the mark ranges in MARKS."
4290 (let ((uncompressed '(score bookmark))
4293 (if (memq (caar marks) uncompressed)
4294 (push (car marks) out)
4295 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4296 (setq marks (cdr marks)))
4299 (defun gnus-adjust-marked-articles (info)
4300 "Set all article lists and remove all marks that are no longer valid."
4301 (let* ((marked-lists (gnus-info-marks info))
4302 (active (gnus-active (gnus-info-group info)))
4305 (types gnus-article-mark-lists)
4306 (uncompressed '(score bookmark killed))
4307 marks var articles article mark)
4310 (setq marks (pop marked-lists))
4311 (set (setq var (intern (format "gnus-newsgroup-%s"
4312 (car (rassq (setq mark (car marks))
4314 (if (memq (car marks) uncompressed) (cdr marks)
4315 (gnus-uncompress-range (cdr marks))))
4317 (setq articles (symbol-value var))
4319 ;; All articles have to be subsets of the active articles.
4321 ;; Adjust "simple" lists.
4322 ((memq mark '(tick dormant expire reply save))
4324 (when (or (< (setq article (pop articles)) min) (> article max))
4325 (set var (delq article (symbol-value var))))))
4327 ((memq mark uncompressed)
4328 (when (not (listp (cdr (symbol-value var))))
4329 (set var (list (symbol-value var))))
4330 (when (not (listp (cdr articles)))
4331 (setq articles (list articles)))
4333 (when (or (not (consp (setq article (pop articles))))
4334 (< (car article) min)
4335 (> (car article) max))
4336 (set var (delq article (symbol-value var))))))))))
4338 (defun gnus-update-missing-marks (missing)
4339 "Go through the list of MISSING articles and remove them from the mark lists."
4341 (let ((types gnus-article-mark-lists)
4343 ;; Go through all types.
4345 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4346 (when (symbol-value var)
4347 ;; This list has articles. So we delete all missing articles
4351 (set var (delq (pop m) (symbol-value var)))))))))
4353 (defun gnus-update-marks ()
4354 "Enter the various lists of marked articles into the newsgroup info list."
4355 (let ((types gnus-article-mark-lists)
4356 (info (gnus-get-info gnus-newsgroup-name))
4357 (uncompressed '(score bookmark killed))
4358 type list newmarked symbol delta-marks)
4360 ;; Add all marks lists to the list of marks lists.
4361 (while (setq type (pop types))
4362 (setq list (symbol-value
4364 (intern (format "gnus-newsgroup-%s"
4368 ;; Get rid of the entries of the articles that have the
4370 (when (and (eq (cdr type) 'score)
4374 (prev (cons nil list))
4377 (if (or (not (consp (car arts)))
4378 (= (cdar arts) gnus-summary-default-score))
4379 (setcdr prev (cdr arts))
4381 (setq arts (cdr arts)))
4382 (setq list (cdr all)))))
4384 (or (memq (cdr type) uncompressed)
4385 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4387 (when (gnus-check-backend-function 'request-set-mark
4388 gnus-newsgroup-name)
4389 ;; uncompressed:s are not proper flags (they are cons cells)
4390 ;; cache is a internal gnus flag
4391 (unless (memq (cdr type) (cons 'cache uncompressed))
4392 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4393 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4394 (add (gnus-remove-from-range (gnus-copy-sequence list) old)))
4396 (push (list add 'add (list (cdr type))) delta-marks))
4398 (push (list del 'del (list (cdr type))) delta-marks)))))
4401 (push (cons (cdr type) list) newmarked)))
4404 (unless (gnus-check-group gnus-newsgroup-name)
4405 (error "Can't open server for %s" gnus-newsgroup-name))
4406 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4408 ;; Enter these new marks into the info of the group.
4410 (setcar (nthcdr 3 info) newmarked)
4411 ;; Add the marks lists to the end of the info.
4413 (setcdr (nthcdr 2 info) (list newmarked))))
4415 ;; Cut off the end of the info if there's nothing else there.
4419 (when (nthcdr (decf i) info)
4420 (setcdr (nthcdr i info) nil)))))))
4422 (defun gnus-set-mode-line (where)
4423 "This function sets the mode line of the article or summary buffers.
4424 If WHERE is `summary', the summary mode line format will be used."
4425 ;; Is this mode line one we keep updated?
4426 (when (and (memq where gnus-updated-mode-lines)
4428 (intern (format "gnus-%s-mode-line-format-spec" where))))
4431 ;; We evaluate this in the summary buffer since these
4432 ;; variables are buffer-local to that buffer.
4433 (set-buffer gnus-summary-buffer)
4434 ;; We bind all these variables that are used in the `eval' form
4436 (let* ((mformat (symbol-value
4438 (format "gnus-%s-mode-line-format-spec" where))))
4439 (gnus-tmp-group-name gnus-newsgroup-name)
4440 (gnus-tmp-article-number (or gnus-current-article 0))
4441 (gnus-tmp-unread gnus-newsgroup-unreads)
4442 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4443 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4444 (gnus-tmp-unread-and-unselected
4445 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4446 (zerop gnus-tmp-unselected))
4448 ((zerop gnus-tmp-unselected)
4449 (format "{%d more}" gnus-tmp-unread-and-unticked))
4450 (t (format "{%d(+%d) more}"
4451 gnus-tmp-unread-and-unticked
4452 gnus-tmp-unselected))))
4454 (if (and gnus-current-headers
4455 (vectorp gnus-current-headers))
4456 (gnus-mode-string-quote
4457 (mail-header-subject gnus-current-headers))
4459 bufname-length max-len
4460 gnus-tmp-header);; passed as argument to any user-format-funcs
4461 (setq mode-string (eval mformat))
4462 (setq bufname-length (if (string-match "%b" mode-string)
4465 (if (eq where 'summary)
4467 (get-buffer gnus-article-buffer))))
4470 (setq max-len (max 4 (if gnus-mode-non-string-length
4472 gnus-mode-non-string-length
4474 (length mode-string))))
4475 ;; We might have to chop a bit of the string off...
4476 (when (> (length mode-string) max-len)
4478 (concat (gnus-truncate-string mode-string (- max-len 3))
4480 ;; Pad the mode string a bit.
4481 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4482 ;; Update the mode line.
4483 (setq mode-line-buffer-identification
4484 (gnus-mode-line-buffer-identification (list mode-string)))
4485 (set-buffer-modified-p t))))
4487 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4488 "Go through the HEADERS list and add all Xrefs to a hash table.
4489 The resulting hash table is returned, or nil if no Xrefs were found."
4490 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4491 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4492 (xref-hashtb (gnus-make-hashtable))
4493 start group entry number xrefs header)
4495 (setq header (pop headers))
4496 (when (and (setq xrefs (mail-header-xref header))
4497 (not (memq (setq number (mail-header-number header))
4500 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4501 (setq start (match-end 0))
4502 (setq group (if prefix
4503 (concat prefix (substring xrefs (match-beginning 1)
4505 (substring xrefs (match-beginning 1) (match-end 1))))
4507 (string-to-int (substring xrefs (match-beginning 2)
4509 (if (setq entry (gnus-gethash group xref-hashtb))
4510 (setcdr entry (cons number (cdr entry)))
4511 (gnus-sethash group (cons number nil) xref-hashtb)))))
4512 (and start xref-hashtb)))
4514 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4515 "Look through all the headers and mark the Xrefs as read."
4516 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4517 name entry info xref-hashtb idlist method nth4)
4519 (set-buffer gnus-group-buffer)
4520 (when (setq xref-hashtb
4521 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4524 (unless (string= from-newsgroup (setq name (symbol-name group)))
4525 (setq idlist (symbol-value group))
4526 ;; Dead groups are not updated.
4528 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4530 (when (stringp (setq nth4 (gnus-info-method info)))
4531 (setq nth4 (gnus-server-to-method nth4))))
4532 ;; Only do the xrefs if the group has the same
4533 ;; select method as the group we have just read.
4534 (or (gnus-methods-equal-p
4535 nth4 (gnus-find-method-for-group from-newsgroup))
4537 (equal nth4 (setq method (gnus-find-method-for-group
4539 (and (equal (car nth4) (car method))
4540 (equal (nth 1 nth4) (nth 1 method))))
4541 gnus-use-cross-reference
4542 (or (not (eq gnus-use-cross-reference t))
4544 ;; Only do cross-references on subscribed
4545 ;; groups, if that is what is wanted.
4546 (<= (gnus-info-level info) gnus-level-subscribed))
4547 (gnus-group-make-articles-read name idlist))))
4550 (defun gnus-compute-read-articles (group articles)
4551 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4552 (info (nth 2 entry))
4553 (active (gnus-active group))
4556 ;; First peel off all invalid article numbers.
4558 (let ((ids articles)
4560 (while (setq id (pop ids))
4561 (when (and first (> id (cdr active)))
4562 ;; We'll end up in this situation in one particular
4563 ;; obscure situation. If you re-scan a group and get
4564 ;; a new article that is cross-posted to a different
4565 ;; group that has not been re-scanned, you might get
4566 ;; crossposted article that has a higher number than
4567 ;; Gnus believes possible. So we re-activate this
4568 ;; group as well. This might mean doing the
4569 ;; crossposting thingy will *increase* the number
4570 ;; of articles in some groups. Tsk, tsk.
4571 (setq active (or (gnus-activate-group group) active)))
4572 (when (or (> id (cdr active))
4573 (< id (car active)))
4574 (setq articles (delq id articles))))))
4575 ;; If the read list is nil, we init it.
4577 (null (gnus-info-read info))
4579 (setq ninfo (cons 1 (1- (car active))))
4580 (setq ninfo (gnus-info-read info)))
4581 ;; Then we add the read articles to the range.
4583 ninfo (setq articles (sort articles '<))))))
4585 (defun gnus-group-make-articles-read (group articles)
4586 "Update the info of GROUP to say that ARTICLES are read."
4588 (entry (gnus-gethash group gnus-newsrc-hashtb))
4589 (info (nth 2 entry))
4590 (active (gnus-active group))
4593 (setq range (gnus-compute-read-articles group articles))
4595 (set-buffer gnus-group-buffer)
4598 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4599 (gnus-info-set-read ',info ',(gnus-info-read info))
4600 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4601 (gnus-group-update-group ,group t))))
4602 ;; Add the read articles to the range.
4603 (gnus-info-set-read info range)
4604 ;; Then we have to re-compute how many unread
4605 ;; articles there are in this group.
4609 (setq num (- (1+ (cdr active)) (car active))))
4610 ((not (listp (cdr range)))
4611 (setq num (- (cdr active) (- (1+ (cdr range))
4615 (if (numberp (car range))
4617 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4618 (setq range (cdr range)))
4619 (setq num (- (cdr active) num))))
4620 ;; Update the number of unread articles.
4622 ;; Update the group buffer.
4623 (gnus-group-update-group group t)))))
4625 (defvar gnus-newsgroup-none-id 0)
4627 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4628 (let ((cur nntp-server-buffer)
4631 (save-excursion (set-buffer gnus-summary-buffer)
4632 gnus-newsgroup-dependencies)))
4634 (mail-parse-charset gnus-newsgroup-charset)
4635 (mail-parse-ignored-charsets
4636 (save-excursion (condition-case nil
4637 (set-buffer gnus-summary-buffer)
4639 gnus-newsgroup-ignored-charsets)))
4641 (set-buffer nntp-server-buffer)
4642 ;; Translate all TAB characters into SPACE characters.
4643 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4644 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4645 (gnus-run-hooks 'gnus-parse-headers-hook)
4646 (let ((case-fold-search t)
4647 in-reply-to header p lines chars ctype)
4648 (goto-char (point-min))
4649 ;; Search to the beginning of the next header. Error messages
4650 ;; do not begin with 2 or 3.
4651 (while (re-search-forward "^[23][0-9]+ " nil t)
4654 ;; This implementation of this function, with nine
4655 ;; search-forwards instead of the one re-search-forward and
4656 ;; a case (which basically was the old function) is actually
4657 ;; about twice as fast, even though it looks messier. You
4658 ;; can't have everything, I guess. Speed and elegance
4659 ;; doesn't always go hand in hand.
4662 (make-full-mail-header
4668 (narrow-to-region (point)
4669 (or (and (search-forward "\n.\n" nil t)
4675 (if (search-forward "\nsubject: " nil t)
4676 (buffer-substring (match-end 0) (std11-field-end))
4681 (if (search-forward "\nfrom: " nil t)
4682 (buffer-substring (match-end 0) (std11-field-end))
4687 (if (search-forward "\ndate: " nil t)
4688 (buffer-substring (match-end 0) (std11-field-end))
4693 (setq id (if (re-search-forward
4694 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4695 ;; We do it this way to make sure the Message-ID
4696 ;; is (somewhat) syntactically valid.
4697 (buffer-substring (match-beginning 1)
4699 ;; If there was no message-id, we just fake one
4700 ;; to make subsequent routines simpler.
4701 (nnheader-generate-fake-message-id))))
4705 (if (search-forward "\nreferences: " nil t)
4709 (buffer-substring (match-end 0) (std11-field-end))
4714 (search-backward ">" end t)
4717 (search-backward "<" end t)
4719 ;; Get the references from the in-reply-to header if there
4720 ;; were no references and the in-reply-to header looks
4722 (if (and (search-forward "\nin-reply-to: " nil t)
4724 (buffer-substring (match-end 0)
4726 (string-match "<[^>]+>" in-reply-to))
4728 (setq ref (substring in-reply-to (match-beginning 0)
4730 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4731 (setq ref2 (substring in-reply-to (match-beginning 0)
4733 (when (> (length ref2) (length ref))
4740 (if (search-forward "\nchars: " nil t)
4741 (if (numberp (setq chars (ignore-errors (read cur))))
4747 (if (search-forward "\nlines: " nil t)
4748 (if (numberp (setq lines (ignore-errors (read cur))))
4754 (and (search-forward "\nxref: " nil t)
4755 (buffer-substring (match-end 0) (std11-field-end))))
4757 (when gnus-extra-headers
4758 (let ((extra gnus-extra-headers)
4762 (when (search-forward
4763 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4764 (push (cons (car extra)
4765 (buffer-substring (match-end 0)
4771 (if (and (search-forward "\ncontent-type: " nil t)
4773 (buffer-substring (match-end 0) (std11-field-end))))
4774 (mime-entity-set-content-type-internal
4775 header (mime-parse-Content-Type ctype)))
4776 (when (equal id ref)
4779 (when gnus-alter-header-function
4780 (funcall gnus-alter-header-function header)
4781 (setq id (mail-header-id header)
4782 ref (gnus-parent-id (mail-header-references header))))
4785 (gnus-dependencies-add-header
4786 header dependencies force-new))
4787 (push header headers))
4788 (goto-char (point-max))
4790 (nreverse headers)))))
4792 ;; Goes through the xover lines and returns a list of vectors
4793 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4794 force-new dependencies
4795 group also-fetch-heads)
4796 "Parse the news overview data in the server buffer, and return a
4797 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4798 ;; Get the Xref when the users reads the articles since most/some
4799 ;; NNTP servers do not include Xrefs when using XOVER.
4800 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4801 (let ((mail-parse-charset gnus-newsgroup-charset)
4802 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4803 (cur nntp-server-buffer)
4804 (dependencies (or dependencies gnus-newsgroup-dependencies))
4805 number headers header)
4807 (set-buffer nntp-server-buffer)
4808 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4809 ;; Allow the user to mangle the headers before parsing them.
4810 (gnus-run-hooks 'gnus-parse-headers-hook)
4811 (goto-char (point-min))
4814 (while (and sequence (not (eobp)))
4815 (setq number (read cur))
4816 (while (and sequence
4817 (< (car sequence) number))
4818 (setq sequence (cdr sequence)))
4820 (eq number (car sequence))
4822 (setq sequence (cdr sequence))
4823 (setq header (inline
4824 (gnus-nov-parse-line
4825 number dependencies force-new))))
4826 (push header headers))
4829 (gnus-error 4 "Strange nov line (%d)"
4830 (count-lines (point-min) (point)))))
4832 ;; A common bug in inn is that if you have posted an article and
4833 ;; then retrieves the active file, it will answer correctly --
4834 ;; the new article is included. However, a NOV entry for the
4835 ;; article may not have been generated yet, so this may fail.
4836 ;; We work around this problem by retrieving the last few
4837 ;; headers using HEAD.
4838 (if (or (not also-fetch-heads)
4840 ;; We (probably) got all the headers.
4842 (let ((gnus-nov-is-evil t))
4845 (gnus-retrieve-parsed-headers sequence group)
4848 (defun gnus-article-get-xrefs ()
4849 "Fill in the Xref value in `gnus-current-headers', if necessary.
4850 This is meant to be called in `gnus-article-internal-prepare-hook'."
4851 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4852 gnus-current-headers)))
4853 (or (not gnus-use-cross-reference)
4855 (and (mail-header-xref headers)
4856 (not (string= (mail-header-xref headers) "")))
4857 (let ((case-fold-search t)
4860 (nnheader-narrow-to-headers)
4861 (goto-char (point-min))
4862 (when (or (and (not (eobp))
4863 (eq (downcase (char-after)) ?x)
4864 (looking-at "Xref:"))
4865 (search-forward "\nXref:" nil t))
4866 (goto-char (1+ (match-end 0)))
4867 (setq xref (buffer-substring (point)
4868 (progn (end-of-line) (point))))
4869 (mail-header-set-xref headers xref)))))))
4871 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4872 "Find article ID and insert the summary line for that article.
4873 OLD-HEADER can either be a header or a line number to insert
4874 the subject line on."
4875 (let* ((line (and (numberp old-header) old-header))
4876 (old-header (and (vectorp old-header) old-header))
4877 (header (cond ((and old-header use-old-header)
4880 (gnus-number-to-header id))
4881 (gnus-number-to-header id))
4883 (gnus-read-header id))))
4884 (number (and (numberp id) id))
4887 ;; Rebuild the thread that this article is part of and go to the
4888 ;; article we have fetched.
4889 (when (and (not gnus-show-threads)
4892 (setq d (gnus-data-find (mail-header-number old-header))))
4893 (goto-char (gnus-data-pos d))
4896 (- (gnus-point-at-bol)
4898 (1+ (gnus-point-at-eol))
4899 (gnus-delete-line))))))
4901 (mail-header-set-number header (mail-header-number old-header)))
4902 (setq gnus-newsgroup-sparse
4903 (delq (setq number (mail-header-number header))
4904 gnus-newsgroup-sparse))
4905 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4906 (push number gnus-newsgroup-limit)
4907 (gnus-rebuild-thread (mail-header-id header) line)
4908 (gnus-summary-goto-subject number nil t))
4909 (when (and (numberp number)
4911 ;; We have to update the boundaries even if we can't fetch the
4912 ;; article if ID is a number -- so that the next `P' or `N'
4913 ;; command will fetch the previous (or next) article even
4914 ;; if the one we tried to fetch this time has been canceled.
4915 (when (> number gnus-newsgroup-end)
4916 (setq gnus-newsgroup-end number))
4917 (when (< number gnus-newsgroup-begin)
4918 (setq gnus-newsgroup-begin number))
4919 (setq gnus-newsgroup-unselected
4920 (delq number gnus-newsgroup-unselected)))
4921 ;; Report back a success?
4922 (and header (mail-header-number header))))
4924 ;;; Process/prefix in the summary buffer
4926 (defun gnus-summary-work-articles (n)
4927 "Return a list of articles to be worked upon.
4928 The prefix argument, the list of process marked articles, and the
4929 current article will be taken into consideration."
4931 (set-buffer gnus-summary-buffer)
4934 ;; A numerical prefix has been given.
4935 (setq n (prefix-numeric-value n))
4936 (let ((backward (< n 0))
4937 (n (abs (prefix-numeric-value n)))
4942 (push (setq article (gnus-summary-article-number))
4945 (gnus-summary-find-prev nil article)
4946 (gnus-summary-find-next nil article)))
4948 (nreverse articles)))
4949 ((and (gnus-region-active-p) (mark))
4950 (message "region active")
4951 ;; Work on the region between point and mark.
4952 (let ((max (max (point) (mark)))
4955 (goto-char (min (point) (mark)))
4958 (push (setq article (gnus-summary-article-number)) articles)
4959 (gnus-summary-find-next nil article)
4961 (nreverse articles))))
4962 (gnus-newsgroup-processable
4963 ;; There are process-marked articles present.
4964 ;; Save current state.
4965 (gnus-summary-save-process-mark)
4967 (reverse gnus-newsgroup-processable))
4969 ;; Just return the current article.
4970 (list (gnus-summary-article-number))))))
4972 (defmacro gnus-summary-iterate (arg &rest forms)
4973 "Iterate over the process/prefixed articles and do FORMS.
4974 ARG is the interactive prefix given to the command. FORMS will be
4975 executed with point over the summary line of the articles."
4976 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4977 `(let ((,articles (gnus-summary-work-articles ,arg)))
4979 (gnus-summary-goto-subject (car ,articles))
4983 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4984 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4986 (defun gnus-summary-save-process-mark ()
4987 "Push the current set of process marked articles on the stack."
4989 (push (copy-sequence gnus-newsgroup-processable)
4990 gnus-newsgroup-process-stack))
4992 (defun gnus-summary-kill-process-mark ()
4993 "Push the current set of process marked articles on the stack and unmark."
4995 (gnus-summary-save-process-mark)
4996 (gnus-summary-unmark-all-processable))
4998 (defun gnus-summary-yank-process-mark ()
4999 "Pop the last process mark state off the stack and restore it."
5001 (unless gnus-newsgroup-process-stack
5002 (error "Empty mark stack"))
5003 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5005 (defun gnus-summary-process-mark-set (set)
5006 "Make SET into the current process marked articles."
5007 (gnus-summary-unmark-all-processable)
5009 (gnus-summary-set-process-mark (pop set))))
5011 ;;; Searching and stuff
5013 (defun gnus-summary-search-group (&optional backward use-level)
5014 "Search for next unread newsgroup.
5015 If optional argument BACKWARD is non-nil, search backward instead."
5017 (set-buffer gnus-group-buffer)
5018 (when (gnus-group-search-forward
5019 backward nil (if use-level (gnus-group-group-level) nil))
5020 (gnus-group-group-name))))
5022 (defun gnus-summary-best-group (&optional exclude-group)
5023 "Find the name of the best unread group.
5024 If EXCLUDE-GROUP, do not go to this group."
5026 (set-buffer gnus-group-buffer)
5028 (gnus-group-best-unread-group exclude-group))))
5030 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5031 (if backward (gnus-summary-find-prev)
5032 (let* ((dummy (gnus-summary-article-intangible-p))
5033 (article (or article (gnus-summary-article-number)))
5034 (arts (gnus-data-find-list article))
5036 (when (and (not dummy)
5037 (or (not gnus-summary-check-current)
5039 (not (gnus-data-unread-p (car arts)))))
5040 (setq arts (cdr arts)))
5045 (when (or (and undownloaded
5046 (eq gnus-undownloaded-mark
5047 (gnus-data-mark (car arts))))
5048 (gnus-data-unread-p (car arts)))
5049 (setq result (car arts)
5051 (setq arts (cdr arts)))
5054 (goto-char (gnus-data-pos result))
5055 (gnus-data-number result)))))
5057 (defun gnus-summary-find-prev (&optional unread article)
5058 (let* ((eobp (eobp))
5059 (article (or article (gnus-summary-article-number)))
5060 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5062 (when (and (not eobp)
5063 (or (not gnus-summary-check-current)
5065 (not (gnus-data-unread-p (car arts)))))
5066 (setq arts (cdr arts)))
5071 (when (gnus-data-unread-p (car arts))
5072 (setq result (car arts)
5074 (setq arts (cdr arts)))
5077 (goto-char (gnus-data-pos result))
5078 (gnus-data-number result))))
5080 (defun gnus-summary-find-subject (subject &optional unread backward article)
5081 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5082 (article (or article (gnus-summary-article-number)))
5083 (articles (gnus-data-list backward))
5084 (arts (gnus-data-find-list article articles))
5086 (when (or (not gnus-summary-check-current)
5088 (not (gnus-data-unread-p (car arts))))
5089 (setq arts (cdr arts)))
5091 (and (or (not unread)
5092 (gnus-data-unread-p (car arts)))
5093 (vectorp (gnus-data-header (car arts)))
5095 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5096 (setq result (car arts)
5098 (setq arts (cdr arts)))
5100 (goto-char (gnus-data-pos result))
5101 (gnus-data-number result))))
5103 (defun gnus-summary-search-forward (&optional unread subject backward)
5104 "Search forward for an article.
5105 If UNREAD, look for unread articles. If SUBJECT, look for
5106 articles with that subject. If BACKWARD, search backward instead."
5107 (cond (subject (gnus-summary-find-subject subject unread backward))
5108 (backward (gnus-summary-find-prev unread))
5109 (t (gnus-summary-find-next unread))))
5111 (defun gnus-recenter (&optional n)
5112 "Center point in window and redisplay frame.
5113 Also do horizontal recentering."
5115 (when (and gnus-auto-center-summary
5116 (not (eq gnus-auto-center-summary 'vertical)))
5117 (gnus-horizontal-recenter))
5120 (defun gnus-summary-recenter ()
5121 "Center point in the summary window.
5122 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5123 displayed, no centering will be performed."
5124 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5125 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5126 (let* ((top (cond ((< (window-height) 4) 0)
5127 ((< (window-height) 7) 1)
5128 (t (if (numberp gnus-auto-center-summary)
5129 gnus-auto-center-summary
5131 (height (1- (window-height)))
5132 (bottom (save-excursion (goto-char (point-max))
5133 (forward-line (- height))
5135 (window (get-buffer-window (current-buffer))))
5136 ;; The user has to want it.
5137 (when gnus-auto-center-summary
5138 (when (get-buffer-window gnus-article-buffer)
5139 ;; Only do recentering when the article buffer is displayed,
5140 ;; Set the window start to either `bottom', which is the biggest
5141 ;; possible valid number, or the second line from the top,
5142 ;; whichever is the least.
5144 window (min bottom (save-excursion
5145 (forward-line (- top)) (point)))))
5146 ;; Do horizontal recentering while we're at it.
5147 (when (and (get-buffer-window (current-buffer) t)
5148 (not (eq gnus-auto-center-summary 'vertical)))
5149 (let ((selected (selected-window)))
5150 (select-window (get-buffer-window (current-buffer) t))
5151 (gnus-summary-position-point)
5152 (gnus-horizontal-recenter)
5153 (select-window selected))))))
5155 (defun gnus-summary-jump-to-group (newsgroup)
5156 "Move point to NEWSGROUP in group mode buffer."
5157 ;; Keep update point of group mode buffer if visible.
5158 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5159 (save-window-excursion
5160 ;; Take care of tree window mode.
5161 (when (get-buffer-window gnus-group-buffer)
5162 (pop-to-buffer gnus-group-buffer))
5163 (gnus-group-jump-to-group newsgroup))
5165 ;; Take care of tree window mode.
5166 (if (get-buffer-window gnus-group-buffer)
5167 (pop-to-buffer gnus-group-buffer)
5168 (set-buffer gnus-group-buffer))
5169 (gnus-group-jump-to-group newsgroup))))
5171 ;; This function returns a list of article numbers based on the
5172 ;; difference between the ranges of read articles in this group and
5173 ;; the range of active articles.
5174 (defun gnus-list-of-unread-articles (group)
5175 (let* ((read (gnus-info-read (gnus-get-info group)))
5176 (active (or (gnus-active group) (gnus-activate-group group)))
5179 ;; If none are read, then all are unread.
5181 (setq first (car active))
5182 ;; If the range of read articles is a single range, then the
5183 ;; first unread article is the article after the last read
5184 ;; article. Sounds logical, doesn't it?
5185 (if (not (listp (cdr read)))
5186 (setq first (max (car active) (1+ (cdr read))))
5187 ;; `read' is a list of ranges.
5188 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5191 (setq first (car active)))
5194 (while (< first nlast)
5196 (setq first (1+ first))))
5197 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5198 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5199 (setq read (cdr read)))))
5200 ;; And add the last unread articles.
5201 (while (<= first last)
5203 (setq first (1+ first)))
5204 ;; Return the list of unread articles.
5205 (delq 0 (nreverse unread))))
5207 (defun gnus-list-of-read-articles (group)
5208 "Return a list of unread, unticked and non-dormant articles."
5209 (let* ((info (gnus-get-info group))
5210 (marked (gnus-info-marks info))
5211 (active (gnus-active group)))
5213 (gnus-set-difference
5214 (gnus-sorted-complement
5215 (gnus-uncompress-range active)
5216 (gnus-list-of-unread-articles group))
5218 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5219 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5221 ;; Various summary commands
5223 (defun gnus-summary-select-article-buffer ()
5224 "Reconfigure windows to show article buffer."
5226 (if (not (gnus-buffer-live-p gnus-article-buffer))
5227 (error "There is no article buffer for this summary buffer")
5228 (gnus-configure-windows 'article)
5229 (select-window (get-buffer-window gnus-article-buffer))))
5231 (defun gnus-summary-universal-argument (arg)
5232 "Perform any operation on all articles that are process/prefixed."
5234 (let ((articles (gnus-summary-work-articles arg))
5241 (substitute-command-keys
5242 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5245 (gnus-error 1 "Undefined key")
5248 (gnus-summary-goto-subject (setq article (pop articles)))
5249 (let (gnus-newsgroup-processable)
5250 (command-execute func))
5251 (gnus-summary-remove-process-mark article)))))
5252 (gnus-summary-position-point))
5254 (defun gnus-summary-toggle-truncation (&optional arg)
5255 "Toggle truncation of summary lines.
5256 With arg, turn line truncation on iff arg is positive."
5258 (setq truncate-lines
5259 (if (null arg) (not truncate-lines)
5260 (> (prefix-numeric-value arg) 0)))
5263 (defun gnus-summary-reselect-current-group (&optional all rescan)
5264 "Rescan the current newsgroup, exit and then reselect it.
5265 The prefix argument ALL means to select all articles."
5267 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5268 (error "Ephemeral groups can't be reselected"))
5269 (let ((current-subject (gnus-summary-article-number))
5270 (group gnus-newsgroup-name))
5272 (set-buffer gnus-group-buffer)
5273 ;; We have to adjust the point of group mode buffer because
5274 ;; point was moved to the next unread newsgroup by exiting.
5275 (gnus-summary-jump-to-group group)
5278 (gnus-group-get-new-news-this-group 1))))
5279 (setq gnus-newsgroup-begin nil)
5281 (gnus-group-read-group all t group)
5282 (gnus-summary-goto-subject current-subject nil t)))
5284 (defun gnus-summary-rescan-group (&optional all)
5285 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5287 (gnus-summary-reselect-current-group all t))
5289 (defun gnus-summary-update-info (&optional non-destructive)
5291 (let ((group gnus-newsgroup-name))
5293 (when gnus-newsgroup-kill-headers
5294 (setq gnus-newsgroup-killed
5295 (gnus-compress-sequence
5297 (gnus-set-sorted-intersection
5298 (gnus-uncompress-range gnus-newsgroup-killed)
5299 (setq gnus-newsgroup-unselected
5300 (sort gnus-newsgroup-unselected '<)))
5301 (setq gnus-newsgroup-unreads
5302 (sort gnus-newsgroup-unreads '<)))
5304 (unless (listp (cdr gnus-newsgroup-killed))
5305 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5306 (let ((headers gnus-newsgroup-headers))
5307 ;; Set the new ranges of read articles.
5309 (set-buffer gnus-group-buffer)
5310 (gnus-undo-force-boundary))
5311 (gnus-update-read-articles
5312 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5313 ;; Set the current article marks.
5314 (let ((gnus-newsgroup-scored
5315 (if (and (not gnus-save-score)
5316 (not non-destructive))
5318 gnus-newsgroup-scored)))
5320 (gnus-update-marks)))
5321 ;; Do the cross-ref thing.
5322 (when gnus-use-cross-reference
5323 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5324 ;; Do not switch windows but change the buffer to work.
5325 (set-buffer gnus-group-buffer)
5326 (unless (gnus-ephemeral-group-p group)
5327 (gnus-group-update-group group)))))))
5329 (defun gnus-summary-save-newsrc (&optional force)
5330 "Save the current number of read/marked articles in the dribble buffer.
5331 The dribble buffer will then be saved.
5332 If FORCE (the prefix), also save the .newsrc file(s)."
5334 (gnus-summary-update-info t)
5336 (gnus-save-newsrc-file)
5337 (gnus-dribble-save)))
5339 (defun gnus-summary-exit (&optional temporary)
5340 "Exit reading current newsgroup, and then return to group selection mode.
5341 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5343 (gnus-set-global-variables)
5344 (gnus-kill-save-kill-buffer)
5345 (gnus-async-halt-prefetch)
5346 (let* ((group gnus-newsgroup-name)
5347 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5350 (buf (current-buffer)))
5352 ;; Do adaptive scoring, and possibly save score files.
5353 (when gnus-newsgroup-adaptive
5354 (gnus-score-adaptive))
5355 (when gnus-use-scoring
5357 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5358 ;; If we have several article buffers, we kill them at exit.
5359 (unless gnus-single-article-buffer
5360 (gnus-kill-buffer gnus-original-article-buffer)
5361 (setq gnus-article-current nil))
5362 (when gnus-use-cache
5363 (gnus-cache-possibly-remove-articles)
5364 (gnus-cache-save-buffers))
5365 (gnus-async-prefetch-remove-group group)
5366 (when gnus-suppress-duplicates
5367 (gnus-dup-enter-articles))
5368 (when gnus-use-trees
5369 (gnus-tree-close group))
5370 ;; Remove entries for this group.
5371 (nnmail-purge-split-history (gnus-group-real-name group))
5372 ;; Make all changes in this group permanent.
5374 (gnus-run-hooks 'gnus-exit-group-hook)
5375 (gnus-summary-update-info))
5376 (gnus-close-group group)
5377 ;; Make sure where we were, and go to next newsgroup.
5378 (set-buffer gnus-group-buffer)
5380 (gnus-group-jump-to-group group))
5381 (gnus-run-hooks 'gnus-summary-exit-hook)
5382 (unless (or quit-config
5383 ;; If this group has disappeared from the summary
5384 ;; buffer, don't skip forwards.
5385 (not (string= group (gnus-group-group-name))))
5386 (gnus-group-next-unread-group 1))
5387 (setq group-point (point))
5390 ;; If we have several article buffers, we kill them at exit.
5391 (unless gnus-single-article-buffer
5392 (gnus-kill-buffer gnus-article-buffer)
5393 (gnus-kill-buffer gnus-original-article-buffer)
5394 (setq gnus-article-current nil))
5396 (if (not gnus-kill-summary-on-exit)
5397 (gnus-deaden-summary)
5398 ;; We set all buffer-local variables to nil. It is unclear why
5399 ;; this is needed, but if we don't, buffer-local variables are
5400 ;; not garbage-collected, it seems. This would the lead to en
5401 ;; ever-growing Emacs.
5402 (gnus-summary-clear-local-variables)
5403 (when (get-buffer gnus-article-buffer)
5404 (bury-buffer gnus-article-buffer))
5405 ;; We clear the global counterparts of the buffer-local
5406 ;; variables as well, just to be on the safe side.
5407 (set-buffer gnus-group-buffer)
5408 (gnus-summary-clear-local-variables)
5409 ;; Return to group mode buffer.
5410 (when (eq mode 'gnus-summary-mode)
5411 (gnus-kill-buffer buf)))
5412 (setq gnus-current-select-method gnus-select-method)
5413 (pop-to-buffer gnus-group-buffer)
5414 (if (not quit-config)
5416 (goto-char group-point)
5417 (gnus-configure-windows 'group 'force))
5418 (gnus-handle-ephemeral-exit quit-config))
5419 ;; Clear the current group name.
5421 (setq gnus-newsgroup-name nil)))))
5423 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5424 (defun gnus-summary-exit-no-update (&optional no-questions)
5425 "Quit reading current newsgroup without updating read article info."
5427 (let* ((group gnus-newsgroup-name)
5428 (quit-config (gnus-group-quit-config group)))
5429 (when (or no-questions
5431 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5432 (gnus-async-halt-prefetch)
5434 (delq 'gnus-summary-expire-articles
5435 (copy-list gnus-summary-prepare-exit-hook)))
5436 ;; If we have several article buffers, we kill them at exit.
5437 (unless gnus-single-article-buffer
5438 (gnus-kill-buffer gnus-article-buffer)
5439 (gnus-kill-buffer gnus-original-article-buffer)
5440 (setq gnus-article-current nil))
5441 (if (not gnus-kill-summary-on-exit)
5442 (gnus-deaden-summary)
5443 (gnus-close-group group)
5444 (gnus-summary-clear-local-variables)
5445 (set-buffer gnus-group-buffer)
5446 (gnus-summary-clear-local-variables)
5447 (when (get-buffer gnus-summary-buffer)
5448 (kill-buffer gnus-summary-buffer)))
5449 (unless gnus-single-article-buffer
5450 (setq gnus-article-current nil))
5451 (when gnus-use-trees
5452 (gnus-tree-close group))
5453 (gnus-async-prefetch-remove-group group)
5454 (when (get-buffer gnus-article-buffer)
5455 (bury-buffer gnus-article-buffer))
5456 ;; Return to the group buffer.
5457 (gnus-configure-windows 'group 'force)
5458 ;; Clear the current group name.
5459 (setq gnus-newsgroup-name nil)
5460 (when (equal (gnus-group-group-name) group)
5461 (gnus-group-next-unread-group 1))
5463 (gnus-handle-ephemeral-exit quit-config)))))
5465 (defun gnus-handle-ephemeral-exit (quit-config)
5466 "Handle movement when leaving an ephemeral group.
5467 The state which existed when entering the ephemeral is reset."
5468 (if (not (buffer-name (car quit-config)))
5469 (gnus-configure-windows 'group 'force)
5470 (set-buffer (car quit-config))
5471 (cond ((eq major-mode 'gnus-summary-mode)
5472 (gnus-set-global-variables))
5473 ((eq major-mode 'gnus-article-mode)
5475 ;; The `gnus-summary-buffer' variable may point
5476 ;; to the old summary buffer when using a single
5478 (unless (gnus-buffer-live-p gnus-summary-buffer)
5479 (set-buffer gnus-group-buffer))
5480 (set-buffer gnus-summary-buffer)
5481 (gnus-set-global-variables))))
5482 (if (or (eq (cdr quit-config) 'article)
5483 (eq (cdr quit-config) 'pick))
5485 ;; The current article may be from the ephemeral group
5486 ;; thus it is best that we reload this article
5487 (gnus-summary-show-article)
5488 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5489 (gnus-configure-windows 'pick 'force)
5490 (gnus-configure-windows (cdr quit-config) 'force)))
5491 (gnus-configure-windows (cdr quit-config) 'force))
5492 (when (eq major-mode 'gnus-summary-mode)
5493 (gnus-summary-next-subject 1 nil t)
5494 (gnus-summary-recenter)
5495 (gnus-summary-position-point))))
5497 (defun gnus-summary-preview-mime-message ()
5498 "MIME decode and play this message."
5500 (let ((gnus-break-pages nil)
5502 (gnus-summary-select-article gnus-show-all-headers t))
5503 (select-window (get-buffer-window gnus-article-buffer)))
5507 (defvar gnus-dead-summary-mode-map nil)
5509 (unless gnus-dead-summary-mode-map
5510 (setq gnus-dead-summary-mode-map (make-keymap))
5511 (suppress-keymap gnus-dead-summary-mode-map)
5512 (substitute-key-definition
5513 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5514 (let ((keys '("\C-d" "\r" "\177" [delete])))
5516 (define-key gnus-dead-summary-mode-map
5517 (pop keys) 'gnus-summary-wake-up-the-dead))))
5519 (defvar gnus-dead-summary-mode nil
5520 "Minor mode for Gnus summary buffers.")
5522 (defun gnus-dead-summary-mode (&optional arg)
5523 "Minor mode for Gnus summary buffers."
5525 (when (eq major-mode 'gnus-summary-mode)
5526 (make-local-variable 'gnus-dead-summary-mode)
5527 (setq gnus-dead-summary-mode
5528 (if (null arg) (not gnus-dead-summary-mode)
5529 (> (prefix-numeric-value arg) 0)))
5530 (when gnus-dead-summary-mode
5531 (gnus-add-minor-mode
5532 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5534 (defun gnus-deaden-summary ()
5535 "Make the current summary buffer into a dead summary buffer."
5536 ;; Kill any previous dead summary buffer.
5537 (when (and gnus-dead-summary
5538 (buffer-name gnus-dead-summary))
5540 (set-buffer gnus-dead-summary)
5541 (when gnus-dead-summary-mode
5542 (kill-buffer (current-buffer)))))
5543 ;; Make this the current dead summary.
5544 (setq gnus-dead-summary (current-buffer))
5545 (gnus-dead-summary-mode 1)
5546 (let ((name (buffer-name)))
5547 (when (string-match "Summary" name)
5549 (concat (substring name 0 (match-beginning 0)) "Dead "
5550 (substring name (match-beginning 0)))
5553 (defun gnus-kill-or-deaden-summary (buffer)
5554 "Kill or deaden the summary BUFFER."
5556 (when (and (buffer-name buffer)
5557 (not gnus-single-article-buffer))
5560 (gnus-kill-buffer gnus-article-buffer)
5561 (gnus-kill-buffer gnus-original-article-buffer)))
5562 (cond (gnus-kill-summary-on-exit
5563 (when (and gnus-use-trees
5564 (gnus-buffer-exists-p buffer))
5567 (gnus-tree-close gnus-newsgroup-name)))
5568 (gnus-kill-buffer buffer))
5569 ((gnus-buffer-exists-p buffer)
5572 (gnus-deaden-summary))))))
5574 (defun gnus-summary-wake-up-the-dead (&rest args)
5575 "Wake up the dead summary buffer."
5577 (gnus-dead-summary-mode -1)
5578 (let ((name (buffer-name)))
5579 (when (string-match "Dead " name)
5581 (concat (substring name 0 (match-beginning 0))
5582 (substring name (match-end 0)))
5584 (gnus-message 3 "This dead summary is now alive again"))
5586 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5587 (defun gnus-summary-fetch-faq (&optional faq-dir)
5588 "Fetch the FAQ for the current group.
5589 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5593 (when current-prefix-arg
5595 "Faq dir: " (and (listp gnus-group-faq-directory)
5596 (mapcar (lambda (file) (list file))
5597 gnus-group-faq-directory))))))
5598 (let (gnus-faq-buffer)
5599 (when (setq gnus-faq-buffer
5600 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5601 (gnus-configure-windows 'summary-faq))))
5603 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5604 (defun gnus-summary-describe-group (&optional force)
5605 "Describe the current newsgroup."
5607 (gnus-group-describe-group force gnus-newsgroup-name))
5609 (defun gnus-summary-describe-briefly ()
5610 "Describe summary mode commands briefly."
5612 (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")))
5614 ;; Walking around group mode buffer from summary mode.
5616 (defun gnus-summary-next-group (&optional no-article target-group backward)
5617 "Exit current newsgroup and then select next unread newsgroup.
5618 If prefix argument NO-ARTICLE is non-nil, no article is selected
5619 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5620 previous group instead."
5622 ;; Stop pre-fetching.
5623 (gnus-async-halt-prefetch)
5624 (let ((current-group gnus-newsgroup-name)
5625 (current-buffer (current-buffer))
5627 ;; First we semi-exit this group to update Xrefs and all variables.
5628 ;; We can't do a real exit, because the window conf must remain
5629 ;; the same in case the user is prompted for info, and we don't
5630 ;; want the window conf to change before that...
5631 (gnus-summary-exit t)
5632 (while (not entered)
5633 ;; Then we find what group we are supposed to enter.
5634 (set-buffer gnus-group-buffer)
5635 (gnus-group-jump-to-group current-group)
5638 (if (eq gnus-keep-same-level 'best)
5639 (gnus-summary-best-group gnus-newsgroup-name)
5640 (gnus-summary-search-group backward gnus-keep-same-level))))
5641 (if (not target-group)
5642 ;; There are no further groups, so we return to the group
5645 (gnus-message 5 "Returning to the group buffer")
5647 (when (gnus-buffer-live-p current-buffer)
5648 (set-buffer current-buffer)
5649 (gnus-summary-exit))
5650 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5651 ;; We try to enter the target group.
5652 (gnus-group-jump-to-group target-group)
5653 (let ((unreads (gnus-group-group-unread)))
5654 (if (and (or (eq t unreads)
5655 (and unreads (not (zerop unreads))))
5656 (gnus-summary-read-group
5657 target-group nil no-article
5658 (and (buffer-name current-buffer) current-buffer)
5661 (setq current-group target-group
5662 target-group nil)))))))
5664 (defun gnus-summary-prev-group (&optional no-article)
5665 "Exit current newsgroup and then select previous unread newsgroup.
5666 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5668 (gnus-summary-next-group no-article nil t))
5670 ;; Walking around summary lines.
5672 (defun gnus-summary-first-subject (&optional unread undownloaded)
5673 "Go to the first unread subject.
5674 If UNREAD is non-nil, go to the first unread article.
5675 Returns the article selected or nil if there are no unread articles."
5680 ((null gnus-newsgroup-data)
5681 (gnus-message 3 "No articles in the group")
5683 ;; Pick the first article.
5685 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5686 (gnus-data-number (car gnus-newsgroup-data)))
5687 ;; No unread articles.
5688 ((null gnus-newsgroup-unreads)
5689 (gnus-message 3 "No more unread articles")
5691 ;; Find the first unread article.
5693 (let ((data gnus-newsgroup-data))
5695 (and (not (and undownloaded
5696 (eq gnus-undownloaded-mark
5697 (gnus-data-mark (car data)))))
5698 (not (gnus-data-unread-p (car data)))))
5699 (setq data (cdr data)))
5701 (goto-char (gnus-data-pos (car data)))
5702 (gnus-data-number (car data))))))
5703 (gnus-summary-position-point)))
5705 (defun gnus-summary-next-subject (n &optional unread dont-display)
5706 "Go to next N'th summary line.
5707 If N is negative, go to the previous N'th subject line.
5708 If UNREAD is non-nil, only unread articles are selected.
5709 The difference between N and the actual number of steps taken is
5712 (let ((backward (< n 0))
5716 (gnus-summary-find-prev unread)
5717 (gnus-summary-find-next unread)))
5718 (gnus-summary-show-thread)
5721 (gnus-message 7 "No more%s articles"
5722 (if unread " unread" "")))
5723 (unless dont-display
5724 (gnus-summary-recenter)
5725 (gnus-summary-position-point))
5728 (defun gnus-summary-next-unread-subject (n)
5729 "Go to next N'th unread summary line."
5731 (gnus-summary-next-subject n t))
5733 (defun gnus-summary-prev-subject (n &optional unread)
5734 "Go to previous N'th summary line.
5735 If optional argument UNREAD is non-nil, only unread article is selected."
5737 (gnus-summary-next-subject (- n) unread))
5739 (defun gnus-summary-prev-unread-subject (n)
5740 "Go to previous N'th unread summary line."
5742 (gnus-summary-next-subject (- n) t))
5744 (defun gnus-summary-goto-subject (article &optional force silent)
5745 "Go the subject line of ARTICLE.
5746 If FORCE, also allow jumping to articles not currently shown."
5747 (interactive "nArticle number: ")
5749 (data (gnus-data-find article)))
5750 ;; We read in the article if we have to.
5753 (gnus-summary-insert-subject
5755 (if (or (numberp force) (vectorp force)) force)
5757 (setq data (gnus-data-find article)))
5762 (gnus-message 3 "Can't find article %d" article))
5764 (goto-char (gnus-data-pos data))
5765 (gnus-summary-position-point)
5768 ;; Walking around summary lines with displaying articles.
5770 (defun gnus-summary-expand-window (&optional arg)
5771 "Make the summary buffer take up the entire Emacs frame.
5772 Given a prefix, will force an `article' buffer configuration."
5775 (gnus-configure-windows 'article 'force)
5776 (gnus-configure-windows 'summary 'force)))
5778 (defun gnus-summary-display-article (article &optional all-header)
5779 "Display ARTICLE in article buffer."
5780 (gnus-set-global-variables)
5784 (if gnus-summary-display-article-function
5785 (funcall gnus-summary-display-article-function article all-header)
5786 (gnus-article-prepare article all-header))
5787 (with-current-buffer gnus-article-buffer
5788 (set (make-local-variable 'gnus-summary-search-article-matched-data)
5790 (gnus-run-hooks 'gnus-select-article-hook)
5791 (when (and gnus-current-article
5792 (not (zerop gnus-current-article)))
5793 (gnus-summary-goto-subject gnus-current-article))
5794 (gnus-summary-recenter)
5795 (when (and gnus-use-trees gnus-show-threads)
5796 (gnus-possibly-generate-tree article)
5797 (gnus-highlight-selected-tree article))
5798 ;; Successfully display article.
5799 (gnus-article-set-window-start
5800 (cdr (assq article gnus-newsgroup-bookmarks))))))
5802 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5803 "Select the current article.
5804 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5805 non-nil, the article will be re-fetched even if it already present in
5806 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5808 ;; Make sure we are in the summary buffer to work around bbdb bug.
5809 (unless (eq major-mode 'gnus-summary-mode)
5810 (set-buffer gnus-summary-buffer))
5811 (let ((article (or article (gnus-summary-article-number)))
5812 (all-headers (not (not all-headers))) ;Must be T or NIL.
5813 gnus-summary-display-article-function
5816 (gnus-summary-article-pseudo-p article)
5817 (error "This is a pseudo-article"))
5820 (set-buffer gnus-summary-buffer)
5821 (if (or (and gnus-single-article-buffer
5822 (or (null gnus-current-article)
5823 (null gnus-article-current)
5824 (null (get-buffer gnus-article-buffer))
5825 (not (eq article (cdr gnus-article-current)))
5826 (not (equal (car gnus-article-current)
5827 gnus-newsgroup-name))))
5828 (and (not gnus-single-article-buffer)
5829 (or (null gnus-current-article)
5830 (not (eq gnus-current-article article))))
5832 ;; The requested article is different from the current article.
5834 (gnus-summary-display-article article all-headers)
5836 (when (or all-headers gnus-show-all-headers)
5837 (if (eq 'gnus-summary-toggle-mime this-command)
5838 (gnus-article-show-all)
5839 (gnus-article-show-all-headers))))
5840 (when (or all-headers gnus-show-all-headers)
5841 (gnus-article-show-all-headers))
5844 (gnus-article-set-window-start
5845 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5847 (defun gnus-summary-set-current-mark (&optional current-mark)
5848 "Obsolete function."
5851 (defun gnus-summary-next-article (&optional unread subject backward push)
5852 "Select the next article.
5853 If UNREAD, only unread articles are selected.
5854 If SUBJECT, only articles with SUBJECT are selected.
5855 If BACKWARD, the previous article is selected instead of the next."
5858 ;; Is there such an article?
5859 ((and (gnus-summary-search-forward unread subject backward)
5860 (or (gnus-summary-display-article (gnus-summary-article-number))
5861 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5862 (gnus-summary-position-point))
5863 ;; If not, we try the first unread, if that is wanted.
5865 gnus-auto-select-same
5866 (gnus-summary-first-unread-article))
5867 (gnus-summary-position-point)
5868 (gnus-message 6 "Wrapped"))
5869 ;; Try to get next/previous article not displayed in this group.
5870 ((and gnus-auto-extend-newsgroup
5871 (not unread) (not subject))
5872 (gnus-summary-goto-article
5873 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5874 nil (count-lines (point-min) (point))))
5875 ;; Go to next/previous group.
5877 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5878 (gnus-summary-jump-to-group gnus-newsgroup-name))
5879 (let ((cmd last-command-char)
5882 (set-buffer gnus-group-buffer)
5885 (if (eq gnus-keep-same-level 'best)
5886 (gnus-summary-best-group gnus-newsgroup-name)
5887 (gnus-summary-search-group backward gnus-keep-same-level))))
5888 ;; For some reason, the group window gets selected. We change
5890 (select-window (get-buffer-window (current-buffer)))
5891 ;; Select next unread newsgroup automagically.
5893 ((or (not gnus-auto-select-next)
5895 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5896 ((or (eq gnus-auto-select-next 'quietly)
5897 (and (eq gnus-auto-select-next 'slightly-quietly)
5899 (and (eq gnus-auto-select-next 'almost-quietly)
5900 (gnus-summary-last-article-p)))
5902 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5904 (gnus-message 7 "No more%s articles (%s)..."
5905 (if unread " unread" "")
5906 (if group (concat "selecting " group)
5908 (gnus-summary-next-group nil group backward)))
5910 (when (gnus-key-press-event-p last-input-event)
5911 (gnus-summary-walk-group-buffer
5912 gnus-newsgroup-name cmd unread backward point))))))))
5914 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5915 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5916 (?\C-p (gnus-group-prev-unread-group 1))))
5917 (cursor-in-echo-area t)
5918 keve key group ended)
5920 (set-buffer gnus-group-buffer)
5923 (if (eq gnus-keep-same-level 'best)
5924 (gnus-summary-best-group gnus-newsgroup-name)
5925 (gnus-summary-search-group backward gnus-keep-same-level))))
5928 5 "No more%s articles%s" (if unread " unread" "")
5930 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5931 (format " (Type %s for %s [%s])"
5932 (single-key-description cmd) group
5933 (car (gnus-gethash group gnus-newsrc-hashtb)))
5934 (format " (Type %s to exit %s)"
5935 (single-key-description cmd)
5936 gnus-newsgroup-name)))
5937 ;; Confirm auto selection.
5938 (setq key (car (setq keve (gnus-read-event-char))))
5941 ((assq key keystrokes)
5942 (let ((obuf (current-buffer)))
5943 (switch-to-buffer gnus-group-buffer)
5945 (gnus-group-jump-to-group group))
5946 (eval (cadr (assq key keystrokes)))
5947 (setq group (gnus-group-group-name))
5948 (switch-to-buffer obuf))
5952 (gnus-ephemeral-group-p gnus-newsgroup-name))
5954 (gnus-summary-next-group nil group backward)))
5956 (push (cdr keve) unread-command-events))))))
5958 (defun gnus-summary-next-unread-article ()
5959 "Select unread article after current one."
5961 (gnus-summary-next-article
5962 (or (not (eq gnus-summary-goto-unread 'never))
5963 (gnus-summary-last-article-p (gnus-summary-article-number)))
5964 (and gnus-auto-select-same
5965 (gnus-summary-article-subject))))
5967 (defun gnus-summary-prev-article (&optional unread subject)
5968 "Select the article after the current one.
5969 If UNREAD is non-nil, only unread articles are selected."
5971 (gnus-summary-next-article unread subject t))
5973 (defun gnus-summary-prev-unread-article ()
5974 "Select unread article before current one."
5976 (gnus-summary-prev-article
5977 (or (not (eq gnus-summary-goto-unread 'never))
5978 (gnus-summary-first-article-p (gnus-summary-article-number)))
5979 (and gnus-auto-select-same
5980 (gnus-summary-article-subject))))
5982 (defun gnus-summary-next-page (&optional lines circular)
5983 "Show next page of the selected article.
5984 If at the end of the current article, select the next article.
5985 LINES says how many lines should be scrolled up.
5987 If CIRCULAR is non-nil, go to the start of the article instead of
5988 selecting the next article when reaching the end of the current
5991 (setq gnus-summary-buffer (current-buffer))
5992 (gnus-set-global-variables)
5993 (let ((article (gnus-summary-article-number))
5994 (article-window (get-buffer-window gnus-article-buffer t))
5996 ;; If the buffer is empty, we have no article.
5998 (error "No article to select"))
5999 (gnus-configure-windows 'article)
6000 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6001 (if (and (eq gnus-summary-goto-unread 'never)
6002 (not (gnus-summary-last-article-p article)))
6003 (gnus-summary-next-article)
6004 (gnus-summary-next-unread-article))
6005 (if (or (null gnus-current-article)
6006 (null gnus-article-current)
6007 (/= article (cdr gnus-article-current))
6008 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6009 ;; Selected subject is different from current article's.
6010 (gnus-summary-display-article article)
6011 (when article-window
6012 (gnus-eval-in-buffer-window gnus-article-buffer
6013 (setq endp (gnus-article-next-page lines)))
6016 (gnus-summary-beginning-of-article))
6018 (gnus-message 3 "End of message"))
6020 (if (and (eq gnus-summary-goto-unread 'never)
6021 (not (gnus-summary-last-article-p article)))
6022 (gnus-summary-next-article)
6023 (gnus-summary-next-unread-article))))))))
6024 (gnus-summary-recenter)
6025 (gnus-summary-position-point)))
6027 (defun gnus-summary-prev-page (&optional lines move)
6028 "Show previous page of selected article.
6029 Argument LINES specifies lines to be scrolled down.
6030 If MOVE, move to the previous unread article if point is at
6031 the beginning of the buffer."
6033 (let ((article (gnus-summary-article-number))
6034 (article-window (get-buffer-window gnus-article-buffer t))
6036 (gnus-configure-windows 'article)
6037 (if (or (null gnus-current-article)
6038 (null gnus-article-current)
6039 (/= article (cdr gnus-article-current))
6040 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6041 ;; Selected subject is different from current article's.
6042 (gnus-summary-display-article article)
6043 (gnus-summary-recenter)
6044 (when article-window
6045 (gnus-eval-in-buffer-window gnus-article-buffer
6046 (setq endp (gnus-article-prev-page lines)))
6047 (when (and move endp)
6049 (gnus-message 3 "Beginning of message"))
6051 (if (and (eq gnus-summary-goto-unread 'never)
6052 (not (gnus-summary-first-article-p article)))
6053 (gnus-summary-prev-article)
6054 (gnus-summary-prev-unread-article))))))))
6055 (gnus-summary-position-point))
6057 (defun gnus-summary-prev-page-or-article (&optional lines)
6058 "Show previous page of selected article.
6059 Argument LINES specifies lines to be scrolled down.
6060 If at the beginning of the article, go to the next article."
6062 (gnus-summary-prev-page lines t))
6064 (defun gnus-summary-scroll-up (lines)
6065 "Scroll up (or down) one line current article.
6066 Argument LINES specifies lines to be scrolled up (or down if negative)."
6068 (gnus-configure-windows 'article)
6069 (gnus-summary-show-thread)
6070 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6071 (gnus-eval-in-buffer-window gnus-article-buffer
6073 (when (gnus-article-next-page lines)
6074 (gnus-message 3 "End of message")))
6076 (gnus-article-prev-page (- lines))))))
6077 (gnus-summary-recenter)
6078 (gnus-summary-position-point))
6080 (defun gnus-summary-scroll-down (lines)
6081 "Scroll down (or up) one line current article.
6082 Argument LINES specifies lines to be scrolled down (or up if negative)."
6084 (gnus-summary-scroll-up (- lines)))
6086 (defun gnus-summary-next-same-subject ()
6087 "Select next article which has the same subject as current one."
6089 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6091 (defun gnus-summary-prev-same-subject ()
6092 "Select previous article which has the same subject as current one."
6094 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6096 (defun gnus-summary-next-unread-same-subject ()
6097 "Select next unread article which has the same subject as current one."
6099 (gnus-summary-next-article t (gnus-summary-article-subject)))
6101 (defun gnus-summary-prev-unread-same-subject ()
6102 "Select previous unread article which has the same subject as current one."
6104 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6106 (defun gnus-summary-first-unread-article ()
6107 "Select the first unread article.
6108 Return nil if there are no unread articles."
6111 (when (gnus-summary-first-subject t)
6112 (gnus-summary-show-thread)
6113 (gnus-summary-first-subject t)
6114 (gnus-summary-display-article (gnus-summary-article-number)))
6115 (gnus-summary-position-point)))
6117 (defun gnus-summary-first-unread-subject ()
6118 "Place the point on the subject line of the first unread article.
6119 Return nil if there are no unread articles."
6122 (when (gnus-summary-first-subject t)
6123 (gnus-summary-show-thread)
6124 (gnus-summary-first-subject t))
6125 (gnus-summary-position-point)))
6127 (defun gnus-summary-first-article ()
6128 "Select the first article.
6129 Return nil if there are no articles."
6132 (when (gnus-summary-first-subject)
6133 (gnus-summary-show-thread)
6134 (gnus-summary-first-subject)
6135 (gnus-summary-display-article (gnus-summary-article-number)))
6136 (gnus-summary-position-point)))
6138 (defun gnus-summary-best-unread-article ()
6139 "Select the unread article with the highest score."
6141 (let ((best -1000000)
6142 (data gnus-newsgroup-data)
6145 (and (gnus-data-unread-p (car data))
6147 (gnus-summary-article-score (gnus-data-number (car data))))
6150 article (gnus-data-number (car data))))
6151 (setq data (cdr data)))
6154 (gnus-summary-goto-article article)
6155 (error "No unread articles"))
6156 (gnus-summary-position-point))))
6158 (defun gnus-summary-last-subject ()
6159 "Go to the last displayed subject line in the group."
6160 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6162 (gnus-summary-goto-subject article))))
6164 (defun gnus-summary-goto-article (article &optional all-headers force)
6165 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6166 If ALL-HEADERS is non-nil, no header lines are hidden.
6167 If FORCE, go to the article even if it isn't displayed. If FORCE
6168 is a number, it is the line the article is to be displayed on."
6172 "Article number or Message-ID: "
6173 (mapcar (lambda (number) (list (int-to-string number)))
6174 gnus-newsgroup-limit))
6178 (if (and (stringp article)
6179 (string-match "@" article))
6180 (gnus-summary-refer-article article)
6181 (when (stringp article)
6182 (setq article (string-to-number article)))
6183 (if (gnus-summary-goto-subject article force)
6184 (gnus-summary-display-article article all-headers)
6185 (gnus-message 4 "Couldn't go to article %s" article) nil))
6186 (gnus-summary-position-point)))
6188 (defun gnus-summary-goto-last-article ()
6189 "Go to the previously read article."
6192 (when gnus-last-article
6193 (gnus-summary-goto-article gnus-last-article nil t))
6194 (gnus-summary-position-point)))
6196 (defun gnus-summary-pop-article (number)
6197 "Pop one article off the history and go to the previous.
6198 NUMBER articles will be popped off."
6201 (setq gnus-newsgroup-history
6202 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6204 (gnus-summary-goto-article (car to) nil t)
6205 (error "Article history empty")))
6206 (gnus-summary-position-point))
6208 ;; Summary commands and functions for limiting the summary buffer.
6210 (defun gnus-summary-limit-to-articles (n)
6211 "Limit the summary buffer to the next N articles.
6212 If not given a prefix, use the process marked articles instead."
6215 (let ((articles (gnus-summary-work-articles n)))
6216 (setq gnus-newsgroup-processable nil)
6217 (gnus-summary-limit articles))
6218 (gnus-summary-position-point)))
6220 (defun gnus-summary-pop-limit (&optional total)
6221 "Restore the previous limit.
6222 If given a prefix, remove all limits."
6225 (setq gnus-newsgroup-limits
6226 (list (mapcar (lambda (h) (mail-header-number h))
6227 gnus-newsgroup-headers))))
6228 (unless gnus-newsgroup-limits
6229 (error "No limit to pop"))
6231 (gnus-summary-limit nil 'pop)
6232 (gnus-summary-position-point)))
6234 (defun gnus-summary-limit-to-subject (subject &optional header)
6235 "Limit the summary buffer to articles that have subjects that match a regexp."
6236 (interactive "sLimit to subject (regexp): ")
6238 (setq header "subject"))
6239 (when (not (equal "" subject))
6241 (let ((articles (gnus-summary-find-matching
6242 (or header "subject") subject 'all)))
6244 (error "Found no matches for \"%s\"" subject))
6245 (gnus-summary-limit articles))
6246 (gnus-summary-position-point))))
6248 (defun gnus-summary-limit-to-author (from)
6249 "Limit the summary buffer to articles that have authors that match a regexp."
6250 (interactive "sLimit to author (regexp): ")
6251 (gnus-summary-limit-to-subject from "from"))
6253 (defun gnus-summary-limit-to-age (age &optional younger-p)
6254 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6255 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6256 articles that are younger than AGE days."
6258 (let ((younger current-prefix-arg)
6261 (while (not days-got)
6262 (setq days (if younger
6263 (read-string "Limit to articles within (in days): ")
6264 (read-string "Limit to articles old than (in days): ")))
6265 (when (> (length days) 0)
6266 (setq days (read days)))
6269 (message "Please enter a number.")
6271 (list days younger)))
6273 (let ((data gnus-newsgroup-data)
6274 (cutoff (days-to-time age))
6275 articles d date is-younger)
6276 (while (setq d (pop data))
6277 (when (and (vectorp (gnus-data-header d))
6278 (setq date (mail-header-date (gnus-data-header d))))
6279 (setq is-younger (time-less-p
6280 (time-since (date-to-time date))
6285 (push (gnus-data-number d) articles))))
6286 (gnus-summary-limit (nreverse articles)))
6287 (gnus-summary-position-point)))
6289 (defun gnus-summary-limit-to-extra (header regexp)
6290 "Limit the summary buffer to articles that match an 'extra' header."
6294 (gnus-completing-read
6295 (symbol-name (car gnus-extra-headers))
6296 "Limit extra header:"
6298 (cons (symbol-name x) x))
6303 (read-string (format "Limit to header %s (regexp): " header)))))
6304 (when (not (equal "" regexp))
6306 (let ((articles (gnus-summary-find-matching
6307 (cons 'extra header) regexp 'all)))
6309 (error "Found no matches for \"%s\"" regexp))
6310 (gnus-summary-limit articles))
6311 (gnus-summary-position-point))))
6313 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6315 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6317 (defun gnus-summary-limit-to-unread (&optional all)
6318 "Limit the summary buffer to articles that are not marked as read.
6319 If ALL is non-nil, limit strictly to unread articles."
6322 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6323 (gnus-summary-limit-to-marks
6324 ;; Concat all the marks that say that an article is read and have
6326 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6327 gnus-killed-mark gnus-kill-file-mark
6328 gnus-low-score-mark gnus-expirable-mark
6329 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6330 gnus-duplicate-mark gnus-souped-mark)
6333 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6334 (make-obsolete 'gnus-summary-delete-marked-with
6335 'gnus-summary-limit-exlude-marks)
6337 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6338 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6339 If REVERSE, limit the summary buffer to articles that are marked
6340 with MARKS. MARKS can either be a string of marks or a list of marks.
6341 Returns how many articles were removed."
6342 (interactive "sMarks: ")
6343 (gnus-summary-limit-to-marks marks t))
6345 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6346 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6347 If REVERSE (the prefix), limit the summary buffer to articles that are
6348 not marked with MARKS. MARKS can either be a string of marks or a
6350 Returns how many articles were removed."
6351 (interactive "sMarks: \nP")
6353 (let ((data gnus-newsgroup-data)
6354 (marks (if (listp marks) marks
6355 (append marks nil))) ; Transform to list.
6358 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6359 (memq (gnus-data-mark (car data)) marks))
6360 (push (gnus-data-number (car data)) articles))
6361 (setq data (cdr data)))
6362 (gnus-summary-limit articles))
6363 (gnus-summary-position-point)))
6365 (defun gnus-summary-limit-to-score (&optional score)
6366 "Limit to articles with score at or above SCORE."
6368 (setq score (if score
6369 (prefix-numeric-value score)
6370 (or gnus-summary-default-score 0)))
6371 (let ((data gnus-newsgroup-data)
6374 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6376 (push (gnus-data-number (car data)) articles))
6377 (setq data (cdr data)))
6379 (gnus-summary-limit articles)
6380 (gnus-summary-position-point))))
6382 (defun gnus-summary-limit-include-thread (id)
6383 "Display all the hidden articles that in the current thread."
6384 (interactive (list (mail-header-id (gnus-summary-article-header))))
6385 (let ((articles (gnus-articles-in-thread
6386 (gnus-id-to-thread (gnus-root-id id)))))
6388 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6389 (gnus-summary-position-point))))
6391 (defun gnus-summary-limit-include-dormant ()
6392 "Display all the hidden articles that are marked as dormant.
6393 Note that this command only works on a subset of the articles currently
6394 fetched for this group."
6396 (unless gnus-newsgroup-dormant
6397 (error "There are no dormant articles in this group"))
6399 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6400 (gnus-summary-position-point)))
6402 (defun gnus-summary-limit-exclude-dormant ()
6403 "Hide all dormant articles."
6406 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6407 (gnus-summary-position-point)))
6409 (defun gnus-summary-limit-exclude-childless-dormant ()
6410 "Hide all dormant articles that have no children."
6412 (let ((data (gnus-data-list t))
6413 articles d children)
6414 ;; Find all articles that are either not dormant or have
6416 (while (setq d (pop data))
6417 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6419 (gnus-article-children (gnus-data-number d)))
6422 (when (memq (car children) articles)
6427 (push (gnus-data-number d) articles)))
6430 (gnus-summary-limit articles)
6431 (gnus-summary-position-point))))
6433 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6434 "Mark all unread excluded articles as read.
6435 If ALL, mark even excluded ticked and dormants as read."
6437 (let ((articles (gnus-sorted-complement
6439 (mapcar (lambda (h) (mail-header-number h))
6440 gnus-newsgroup-headers)
6442 (sort gnus-newsgroup-limit '<)))
6444 (setq gnus-newsgroup-unreads
6445 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6447 (setq gnus-newsgroup-dormant nil
6448 gnus-newsgroup-marked nil
6449 gnus-newsgroup-reads
6451 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6452 gnus-newsgroup-reads))
6453 (while (setq article (pop articles))
6454 (unless (or (memq article gnus-newsgroup-dormant)
6455 (memq article gnus-newsgroup-marked))
6456 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6458 (defun gnus-summary-limit (articles &optional pop)
6460 ;; We pop the previous limit off the stack and use that.
6461 (setq articles (car gnus-newsgroup-limits)
6462 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6463 ;; We use the new limit, so we push the old limit on the stack.
6464 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6466 (setq gnus-newsgroup-limit articles)
6467 (let ((total (length gnus-newsgroup-data))
6468 (data (gnus-data-find-list (gnus-summary-article-number)))
6469 (gnus-summary-mark-below nil) ; Inhibit this.
6471 ;; This will do all the work of generating the new summary buffer
6472 ;; according to the new limit.
6473 (gnus-summary-prepare)
6474 ;; Hide any threads, possibly.
6475 (and gnus-show-threads
6476 gnus-thread-hide-subtree
6477 (gnus-summary-hide-all-threads))
6478 ;; Try to return to the article you were at, or one in the
6481 ;; We try to find some article after the current one.
6483 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6486 (setq data (cdr data))))
6488 ;; If there is no data, that means that we were after the last
6489 ;; article. The same goes when we can't find any articles
6490 ;; after the current one.
6491 (goto-char (point-max))
6492 (gnus-summary-find-prev))
6493 (gnus-set-mode-line 'summary)
6494 ;; We return how many articles were removed from the summary
6495 ;; buffer as a result of the new limit.
6496 (- total (length gnus-newsgroup-data))))
6498 (defsubst gnus-invisible-cut-children (threads)
6501 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6506 (defsubst gnus-cut-thread (thread)
6507 "Go forwards in the thread until we find an article that we want to display."
6508 (when (or (eq gnus-fetch-old-headers 'some)
6509 (eq gnus-fetch-old-headers 'invisible)
6510 (eq gnus-build-sparse-threads 'some)
6511 (eq gnus-build-sparse-threads 'more))
6512 ;; Deal with old-fetched headers and sparse threads.
6516 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6517 (gnus-summary-article-ancient-p
6518 (mail-header-number (car thread))))
6519 (if (or (<= (length (cdr thread)) 1)
6520 (eq gnus-fetch-old-headers 'invisible))
6521 (setq gnus-newsgroup-limit
6522 (delq (mail-header-number (car thread))
6523 gnus-newsgroup-limit)
6524 thread (cadr thread))
6525 (when (gnus-invisible-cut-children (cdr thread))
6526 (let ((th (cdr thread)))
6528 (if (memq (mail-header-number (caar th))
6529 gnus-newsgroup-limit)
6530 (setq thread (car th)
6532 (setq th (cdr th))))))))))
6535 (defun gnus-cut-threads (threads)
6536 "Cut off all uninteresting articles from the beginning of threads."
6537 (when (or (eq gnus-fetch-old-headers 'some)
6538 (eq gnus-fetch-old-headers 'invisible)
6539 (eq gnus-build-sparse-threads 'some)
6540 (eq gnus-build-sparse-threads 'more))
6543 (setcar th (gnus-cut-thread (car th)))
6544 (setq th (cdr th)))))
6545 ;; Remove nixed out threads.
6548 (defun gnus-summary-initial-limit (&optional show-if-empty)
6549 "Figure out what the initial limit is supposed to be on group entry.
6550 This entails weeding out unwanted dormants, low-scored articles,
6551 fetch-old-headers verbiage, and so on."
6552 ;; Most groups have nothing to remove.
6553 (if (or gnus-inhibit-limiting
6554 (and (null gnus-newsgroup-dormant)
6555 (not (eq gnus-fetch-old-headers 'some))
6556 (not (eq gnus-fetch-old-headers 'invisible))
6557 (null gnus-summary-expunge-below)
6558 (not (eq gnus-build-sparse-threads 'some))
6559 (not (eq gnus-build-sparse-threads 'more))
6560 (null gnus-thread-expunge-below)
6561 (not gnus-use-nocem)))
6563 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6564 (setq gnus-newsgroup-limit nil)
6567 (unless (car (symbol-value node))
6568 ;; These threads have no parents -- they are roots.
6569 (let ((nodes (cdr (symbol-value node)))
6572 (if (and gnus-thread-expunge-below
6573 (< (gnus-thread-total-score (car nodes))
6574 gnus-thread-expunge-below))
6575 (gnus-expunge-thread (pop nodes))
6576 (setq thread (pop nodes))
6577 (gnus-summary-limit-children thread))))))
6578 gnus-newsgroup-dependencies)
6579 ;; If this limitation resulted in an empty group, we might
6580 ;; pop the previous limit and use it instead.
6581 (when (and (not gnus-newsgroup-limit)
6583 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6584 gnus-newsgroup-limit))
6586 (defun gnus-summary-limit-children (thread)
6587 "Return 1 if this subthread is visible and 0 if it is not."
6588 ;; First we get the number of visible children to this thread. This
6589 ;; is done by recursing down the thread using this function, so this
6590 ;; will really go down to a leaf article first, before slowly
6591 ;; working its way up towards the root.
6595 (apply '+ (mapcar 'gnus-summary-limit-children
6598 (number (mail-header-number (car thread)))
6601 (not (memq number gnus-newsgroup-marked))
6603 ;; If this article is dormant and has absolutely no visible
6604 ;; children, then this article isn't visible.
6605 (and (memq number gnus-newsgroup-dormant)
6607 ;; If this is "fetch-old-headered" and there is no
6608 ;; visible children, then we don't want this article.
6609 (and (eq gnus-fetch-old-headers 'some)
6610 (gnus-summary-article-ancient-p number)
6612 ;; If this is "fetch-old-headered" and `invisible', then
6613 ;; we don't want this article.
6614 (and (eq gnus-fetch-old-headers 'invisible)
6615 (gnus-summary-article-ancient-p number))
6616 ;; If this is a sparsely inserted article with no children,
6617 ;; we don't want it.
6618 (and (eq gnus-build-sparse-threads 'some)
6619 (gnus-summary-article-sparse-p number)
6621 ;; If we use expunging, and this article is really
6622 ;; low-scored, then we don't want this article.
6623 (when (and gnus-summary-expunge-below
6625 (or (cdr (assq number gnus-newsgroup-scored))
6626 gnus-summary-default-score))
6627 gnus-summary-expunge-below))
6628 ;; We increase the expunge-tally here, but that has
6629 ;; nothing to do with the limits, really.
6630 (incf gnus-newsgroup-expunged-tally)
6631 ;; We also mark as read here, if that's wanted.
6632 (when (and gnus-summary-mark-below
6633 (< score gnus-summary-mark-below))
6634 (setq gnus-newsgroup-unreads
6635 (delq number gnus-newsgroup-unreads))
6636 (if gnus-newsgroup-auto-expire
6637 (push number gnus-newsgroup-expirable)
6638 (push (cons number gnus-low-score-mark)
6639 gnus-newsgroup-reads)))
6641 ;; Check NoCeM things.
6642 (if (and gnus-use-nocem
6643 (gnus-nocem-unwanted-article-p
6644 (mail-header-id (car thread))))
6646 (setq gnus-newsgroup-unreads
6647 (delq number gnus-newsgroup-unreads))
6649 ;; Nope, invisible article.
6651 ;; Ok, this article is to be visible, so we add it to the limit
6653 (push number gnus-newsgroup-limit)
6656 (defun gnus-expunge-thread (thread)
6657 "Mark all articles in THREAD as read."
6658 (let* ((number (mail-header-number (car thread))))
6659 (incf gnus-newsgroup-expunged-tally)
6660 ;; We also mark as read here, if that's wanted.
6661 (setq gnus-newsgroup-unreads
6662 (delq number gnus-newsgroup-unreads))
6663 (if gnus-newsgroup-auto-expire
6664 (push number gnus-newsgroup-expirable)
6665 (push (cons number gnus-low-score-mark)
6666 gnus-newsgroup-reads)))
6667 ;; Go recursively through all subthreads.
6668 (mapcar 'gnus-expunge-thread (cdr thread)))
6670 ;; Summary article oriented commands
6672 (defun gnus-summary-refer-parent-article (n)
6673 "Refer parent article N times.
6674 If N is negative, go to ancestor -N instead.
6675 The difference between N and the number of articles fetched is returned."
6679 (when (not (natnump n))
6684 (setq header (gnus-summary-article-header))
6685 (if (and (eq (mail-header-number header)
6686 (cdr gnus-article-current))
6687 (equal gnus-newsgroup-name
6688 (car gnus-article-current)))
6689 ;; If we try to find the parent of the currently
6690 ;; displayed article, then we take a look at the actual
6691 ;; References header, since this is slightly more
6692 ;; reliable than the References field we got from the
6695 (set-buffer gnus-original-article-buffer)
6696 (nnheader-narrow-to-headers)
6697 (unless (setq ref (message-fetch-field "references"))
6698 (setq ref (message-fetch-field "in-reply-to")))
6701 ;; It's not the current article, so we take a bet on
6702 ;; the value we got from the server.
6703 (mail-header-references header)))
6705 (not (equal ref "")))
6706 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6707 (gnus-message 1 "Couldn't find parent"))
6708 (gnus-message 1 "No references in article %d"
6709 (gnus-summary-article-number))
6712 (gnus-summary-position-point)
6715 (defun gnus-summary-refer-references ()
6716 "Fetch all articles mentioned in the References header.
6717 Return the number of articles fetched."
6719 (let ((ref (mail-header-references (gnus-summary-article-header)))
6720 (current (gnus-summary-article-number))
6724 (error "No References in the current article")
6725 ;; For each Message-ID in the References header...
6726 (while (string-match "<[^>]*>" ref)
6728 ;; ... fetch that article.
6729 (gnus-summary-refer-article
6730 (prog1 (match-string 0 ref)
6731 (setq ref (substring ref (match-end 0))))))
6732 (gnus-summary-goto-subject current)
6733 (gnus-summary-position-point)
6736 (defun gnus-summary-refer-thread (&optional limit)
6737 "Fetch all articles in the current thread.
6738 If LIMIT (the numerical prefix), fetch that many old headers instead
6739 of what's specified by the `gnus-refer-thread-limit' variable."
6741 (let ((id (mail-header-id (gnus-summary-article-header)))
6742 (limit (if limit (prefix-numeric-value limit)
6743 gnus-refer-thread-limit)))
6744 ;; We want to fetch LIMIT *old* headers, but we also have to
6745 ;; re-fetch all the headers in the current buffer, because many of
6746 ;; them may be undisplayed. So we adjust LIMIT.
6747 (when (numberp limit)
6748 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6749 (unless (eq gnus-fetch-old-headers 'invisible)
6750 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6751 ;; Retrieve the headers and read them in.
6752 (if (eq (gnus-retrieve-headers
6753 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6755 (gnus-build-all-threads)
6756 (error "Can't fetch thread from backends that don't support NOV"))
6757 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6758 (gnus-summary-limit-include-thread id)))
6760 (defun gnus-summary-refer-article (message-id &optional arg)
6761 "Fetch an article specified by MESSAGE-ID.
6762 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6763 or `gnus-select-method', no matter what backend the article comes from."
6764 (interactive "sMessage-ID: \nP")
6765 (when (and (stringp message-id)
6766 (not (zerop (length message-id))))
6767 ;; Construct the correct Message-ID if necessary.
6768 ;; Suggested by tale@pawl.rpi.edu.
6769 (unless (string-match "^<" message-id)
6770 (setq message-id (concat "<" message-id)))
6771 (unless (string-match ">$" message-id)
6772 (setq message-id (concat message-id ">")))
6773 (let* ((header (gnus-id-to-header message-id))
6775 (gnus-summary-article-sparse-p
6776 (mail-header-number header))
6777 (memq (mail-header-number header)
6778 gnus-newsgroup-limit))))
6780 ;; If the article is present in the buffer we just go to it.
6782 (or (not (gnus-summary-article-sparse-p
6783 (mail-header-number header)))
6786 (gnus-summary-goto-article
6787 (mail-header-number header) nil t)
6789 (gnus-summary-update-article (mail-header-number header)))))
6791 ;; We fetch the article
6792 (let ((gnus-override-method
6793 (cond ((gnus-news-group-p gnus-newsgroup-name)
6794 gnus-refer-article-method)
6796 (or gnus-refer-article-method gnus-select-method))
6799 ;; Start the special refer-article method, if necessary.
6800 (when (and gnus-refer-article-method
6801 (gnus-news-group-p gnus-newsgroup-name))
6802 (gnus-check-server gnus-refer-article-method))
6803 ;; Fetch the header, and display the article.
6804 (if (setq number (gnus-summary-insert-subject message-id))
6805 (gnus-summary-select-article nil nil nil number)
6806 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6808 (defun gnus-summary-edit-parameters ()
6809 "Edit the group parameters of the current group."
6811 (gnus-group-edit-group gnus-newsgroup-name 'params))
6813 (defun gnus-summary-customize-parameters ()
6814 "Customize the group parameters of the current group."
6816 (gnus-group-customize gnus-newsgroup-name))
6818 (defun gnus-summary-enter-digest-group (&optional force)
6819 "Enter an nndoc group based on the current article.
6820 If FORCE, force a digest interpretation. If not, try
6821 to guess what the document format is."
6823 (let ((conf gnus-current-window-configuration))
6825 (gnus-summary-select-article))
6826 (setq gnus-current-window-configuration conf)
6827 (let* ((name (format "%s-%d"
6828 (gnus-group-prefixed-name
6829 gnus-newsgroup-name (list 'nndoc ""))
6831 (set-buffer gnus-summary-buffer)
6832 gnus-current-article)))
6833 (ogroup gnus-newsgroup-name)
6834 (params (append (gnus-info-params (gnus-get-info ogroup))
6835 (list (cons 'to-group ogroup))
6836 (list (cons 'save-article-group ogroup))))
6837 (case-fold-search t)
6838 (buf (current-buffer))
6841 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6842 (insert-buffer-substring gnus-original-article-buffer)
6843 ;; Remove lines that may lead nndoc to misinterpret the
6846 (goto-char (point-min))
6847 (or (search-forward "\n\n" nil t) (point)))
6848 (goto-char (point-min))
6849 (delete-matching-lines "^Path:\\|^From ")
6852 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
6853 (gnus-newsgroup-ephemeral-ignored-charsets
6854 gnus-newsgroup-ignored-charsets))
6855 (gnus-group-read-ephemeral-group
6856 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6858 ,(if force 'mbox 'guess))) t))
6859 ;; Make all postings to this group go to the parent group.
6860 (nconc (gnus-info-params (gnus-get-info name))
6862 ;; Couldn't select this doc group.
6863 (switch-to-buffer buf)
6864 (gnus-set-global-variables)
6865 (gnus-configure-windows 'summary)
6866 (gnus-message 3 "Article couldn't be entered?"))
6867 (kill-buffer dig)))))
6869 (defun gnus-summary-read-document (n)
6870 "Open a new group based on the current article(s).
6871 This will allow you to read digests and other similar
6872 documents as newsgroups.
6873 Obeys the standard process/prefix convention."
6875 (let* ((articles (gnus-summary-work-articles n))
6876 (ogroup gnus-newsgroup-name)
6877 (params (append (gnus-info-params (gnus-get-info ogroup))
6878 (list (cons 'to-group ogroup))))
6879 article group egroup groups vgroup)
6880 (while (setq article (pop articles))
6881 (setq group (format "%s-%d" gnus-newsgroup-name article))
6882 (gnus-summary-remove-process-mark article)
6883 (when (gnus-summary-display-article article)
6886 (insert-buffer-substring gnus-original-article-buffer)
6887 ;; Remove some headers that may lead nndoc to make
6889 (message-narrow-to-head)
6890 (goto-char (point-min))
6891 (delete-matching-lines "^\\(Path\\):\\|^From ")
6894 (gnus-group-read-ephemeral-group
6895 group `(nndoc ,group (nndoc-address ,(current-buffer))
6896 (nndoc-article-type guess))
6899 ;; Make all postings to this group go to the parent group.
6900 (nconc (gnus-info-params (gnus-get-info egroup))
6902 (push egroup groups))
6903 ;; Couldn't select this doc group.
6904 (gnus-error 3 "Article couldn't be entered"))))))
6905 ;; Now we have selected all the documents.
6908 (error "None of the articles could be interpreted as documents"))
6909 ((gnus-group-read-ephemeral-group
6910 (setq vgroup (format
6911 "nnvirtual:%s-%s" gnus-newsgroup-name
6912 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6913 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6915 (cons (current-buffer) 'summary)))
6917 (error "Couldn't select virtual nndoc group")))))
6919 (defun gnus-summary-isearch-article (&optional regexp-p)
6920 "Do incremental search forward on the current article.
6921 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6923 (let* ((gnus-inhibit-treatment t)
6924 (old (gnus-summary-select-article)))
6925 (gnus-configure-windows 'article)
6926 (gnus-eval-in-buffer-window gnus-article-buffer
6930 (gnus-article-show-all-headers))
6931 (goto-char (point-min))
6932 (isearch-forward regexp-p)))))
6934 (defun gnus-summary-search-article-forward (regexp &optional backward)
6935 "Search for an article containing REGEXP forward.
6936 If BACKWARD, search backward instead."
6939 (format "Search article %s (regexp%s): "
6940 (if current-prefix-arg "backward" "forward")
6941 (if gnus-last-search-regexp
6942 (concat ", default " gnus-last-search-regexp)
6944 current-prefix-arg))
6945 (if (string-equal regexp "")
6946 (setq regexp (or gnus-last-search-regexp ""))
6947 (setq gnus-last-search-regexp regexp))
6948 (if (gnus-summary-search-article regexp backward)
6949 (gnus-summary-show-thread)
6950 (error "Search failed: \"%s\"" regexp)))
6952 (defun gnus-summary-search-article-backward (regexp)
6953 "Search for an article containing REGEXP backward."
6956 (format "Search article backward (regexp%s): "
6957 (if gnus-last-search-regexp
6958 (concat ", default " gnus-last-search-regexp)
6960 (gnus-summary-search-article-forward regexp 'backward))
6963 (defmacro gnus-summary-search-article-position-point (regexp backward)
6964 "Dehighlight the last matched text and goto the beginning position."
6965 (` (if (and gnus-summary-search-article-matched-data
6966 (let ((text (caddr gnus-summary-search-article-matched-data))
6967 (inhibit-read-only t)
6970 (goto-char (car gnus-summary-search-article-matched-data))
6971 (cadr gnus-summary-search-article-matched-data))
6973 (string-match (, regexp) text)))
6974 (if (, backward) (beginning-of-line) (end-of-line))
6975 (goto-char (if (, backward) (point-max) (point-min))))))
6977 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
6978 "Place point where X-Face image is displayed."
6979 (if (featurep 'xemacs)
6980 (` (let ((end (if (search-forward "\n\n" nil t)
6981 (goto-char (1- (point)))
6984 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
6985 (unless (and (re-search-forward "^From:" end t)
6986 (setq extent (extent-at (point)))
6987 (extent-begin-glyph extent))
6988 (goto-char (, opoint)))))
6989 (` (let ((end (if (search-forward "\n\n" nil t)
6990 (goto-char (1- (point)))
6993 (or (text-property-any (or (search-backward "\n\n" nil t)
6995 end 'x-face-mule-bitmap-image t)
6998 (defmacro gnus-summary-search-article-highlight-matched-text
6999 (backward treated x-face)
7000 "Highlight matched text in the function `gnus-summary-search-article'."
7001 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
7002 (end (set-marker (make-marker) (match-end 0)))
7003 (inhibit-read-only t)
7007 (let ((items (mapcar 'car gnus-treatment-function-alist)))
7009 (lambda (item) (setq items (delq item items)))
7010 '(gnus-treat-buttonize
7011 gnus-treat-fill-article
7012 gnus-treat-fill-long-lines
7013 gnus-treat-emphasize
7014 gnus-treat-highlight-headers
7015 gnus-treat-highlight-citation
7016 gnus-treat-highlight-signature
7017 gnus-treat-overstrike
7018 gnus-treat-display-xface
7019 gnus-treat-buttonize-head
7020 gnus-treat-decode-article-as-default-mime-charset))
7021 (static-if (featurep 'xemacs)
7023 (cons '(x-face-mule-delete-x-face-field
7026 (gnus-treat-display-xface
7027 (when (, x-face) gnus-treat-display-xface)))
7028 (gnus-article-prepare-mime-display)))
7029 (goto-char (if (, backward) start end))
7031 (gnus-summary-search-article-highlight-goto-x-face (point)))
7032 (setq gnus-summary-search-article-matched-data
7033 (list start end (buffer-substring start end)))
7034 (unless (eq start end);; matched text has been deleted. :-<
7035 (put-text-property start end 'face
7036 (or (find-face 'isearch)
7037 'secondary-selection))))))
7040 (defun gnus-summary-search-article (regexp &optional backward)
7041 "Search for an article containing REGEXP.
7042 Optional argument BACKWARD means do search for backward.
7043 `gnus-select-article-hook' is not called during the search."
7044 ;; We have to require this here to make sure that the following
7045 ;; dynamic binding isn't shadowed by autoloading.
7046 (require 'gnus-async)
7048 (let ((gnus-select-article-hook nil) ;Disable hook.
7049 (gnus-article-display-hook nil)
7050 (gnus-article-prepare-hook nil)
7051 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7052 (gnus-use-article-prefetch nil)
7053 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7054 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7055 (sum (current-buffer))
7058 (gnus-save-hidden-threads
7059 (static-if (featurep 'xemacs)
7060 (let ((gnus-inhibit-treatment t))
7061 (setq treated (eq 'old (gnus-summary-select-article)))
7063 (not (and (gnus-buffer-live-p gnus-article-buffer)
7064 (window-live-p (get-buffer-window
7065 gnus-article-buffer t)))))
7066 (gnus-summary-select-article nil t)
7067 (setq treated nil)))
7068 (let ((gnus-inhibit-treatment t)
7069 (x-face-mule-delete-x-face-field 'never))
7070 (setq treated (eq 'old (gnus-summary-select-article)))
7073 (and (gnus-buffer-live-p gnus-article-buffer)
7074 (window-live-p (get-buffer-window
7075 gnus-article-buffer t))
7076 (or (not (string-match "^\\^X-Face:" regexp))
7077 (with-current-buffer gnus-article-buffer
7078 gnus-summary-search-article-matched-data)))))
7079 (gnus-summary-select-article nil t)
7080 (setq treated nil))))
7081 (set-buffer gnus-article-buffer)
7085 (gnus-article-show-all-headers)
7086 (gnus-summary-search-article-position-point regexp backward))
7087 (goto-char (if backward (point-max) (point-min))))
7089 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7091 (re-search-backward regexp nil t)
7092 (re-search-forward regexp nil t))
7093 ;; We found the regexp.
7095 (gnus-summary-search-article-highlight-matched-text
7096 backward treated (string-match "^\\^X-Face:" regexp))
7099 (/ (- 2 (window-height
7100 (get-buffer-window gnus-article-buffer t)))
7103 (get-buffer-window (current-buffer))
7106 (setq point (point)))
7107 ;; We didn't find it, so we go to the next article.
7110 (while (eq found 'not)
7111 (if (not (if backward (gnus-summary-find-prev)
7112 (gnus-summary-find-next)))
7113 ;; No more articles.
7115 ;; Select the next article and adjust point.
7116 (unless (gnus-summary-article-sparse-p
7117 (gnus-summary-article-number))
7119 (let ((gnus-inhibit-treatment t))
7120 (gnus-summary-select-article))
7122 (set-buffer gnus-article-buffer)
7124 (goto-char (if backward (point-max) (point-min))))))))
7125 (gnus-message 7 ""))
7126 ;; Return whether we found the regexp.
7127 (when (eq found 'found)
7129 (gnus-summary-show-thread)
7130 (gnus-summary-goto-subject gnus-current-article)
7131 (gnus-summary-position-point)
7134 (defun gnus-summary-find-matching (header regexp &optional backward unread
7136 "Return a list of all articles that match REGEXP on HEADER.
7137 The search stars on the current article and goes forwards unless
7138 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7139 If UNREAD is non-nil, only unread articles will
7140 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7141 in the comparisons."
7142 (let ((data (if (eq backward 'all) gnus-newsgroup-data
7143 (gnus-data-find-list
7144 (gnus-summary-article-number) (gnus-data-list backward))))
7145 (case-fold-search (not not-case-fold))
7148 (if (eq (car header) 'extra)
7151 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
7153 (error "%s is an invalid header" header))
7154 (unless (fboundp (intern (concat "mail-header-" header)))
7155 (error "%s is not a valid header" header))
7156 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
7159 (and (or (not unread) ; We want all articles...
7160 (gnus-data-unread-p d)) ; Or just unreads.
7161 (vectorp (gnus-data-header d)) ; It's not a pseudo.
7162 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
7163 (push (gnus-data-number d) articles)) ; Success!
7164 (setq data (cdr data)))
7165 (nreverse articles)))
7167 (defun gnus-summary-execute-command (header regexp command &optional backward)
7168 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7169 If HEADER is an empty string (or nil), the match is done on the entire
7170 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7172 (list (let ((completion-ignore-case t))
7175 (mapcar (lambda (string) (list string))
7176 '("Number" "Subject" "From" "Lines" "Date"
7177 "Message-ID" "Xref" "References" "Body"))
7178 nil 'require-match))
7179 (read-string "Regexp: ")
7180 (read-key-sequence "Command: ")
7181 current-prefix-arg))
7182 (when (equal header "Body")
7184 ;; Hidden thread subtrees must be searched as well.
7185 (gnus-summary-show-all-threads)
7186 ;; We don't want to change current point nor window configuration.
7188 (save-window-excursion
7189 (gnus-message 6 "Executing %s..." (key-description command))
7190 ;; We'd like to execute COMMAND interactively so as to give arguments.
7191 (gnus-execute header regexp
7192 `(call-interactively ',(key-binding command))
7194 (gnus-message 6 "Executing %s...done" (key-description command)))))
7196 (defun gnus-summary-beginning-of-article ()
7197 "Scroll the article back to the beginning."
7199 (gnus-summary-select-article)
7200 (gnus-configure-windows 'article)
7201 (gnus-eval-in-buffer-window gnus-article-buffer
7203 (goto-char (point-min))
7204 (when gnus-page-broken
7205 (gnus-narrow-to-page))))
7207 (defun gnus-summary-end-of-article ()
7208 "Scroll to the end of the article."
7210 (gnus-summary-select-article)
7211 (gnus-configure-windows 'article)
7212 (gnus-eval-in-buffer-window gnus-article-buffer
7214 (goto-char (point-max))
7216 (when gnus-page-broken
7217 (gnus-narrow-to-page))))
7219 (defun gnus-summary-print-article (&optional filename n)
7220 "Generate and print a PostScript image of the N next (mail) articles.
7222 If N is negative, print the N previous articles. If N is nil and articles
7223 have been marked with the process mark, print these instead.
7225 If the optional first argument FILENAME is nil, send the image to the
7226 printer. If FILENAME is a string, save the PostScript image in a file with
7227 that name. If FILENAME is a number, prompt the user for the name of the file
7229 (interactive (list (ps-print-preprint current-prefix-arg)
7230 current-prefix-arg))
7231 (dolist (article (gnus-summary-work-articles n))
7232 (gnus-summary-select-article nil nil 'pseudo article)
7233 (gnus-eval-in-buffer-window gnus-article-buffer
7234 (let ((buffer (generate-new-buffer " *print*")))
7237 (copy-to-buffer buffer (point-min) (point-max))
7239 (gnus-article-delete-invisible-text)
7240 (let ((ps-left-header
7243 (mail-header-subject gnus-current-headers) ")")
7245 (mail-header-from gnus-current-headers) ")")))
7248 "/pagenumberstring load"
7250 (mail-header-date gnus-current-headers) ")"))))
7251 (gnus-run-hooks 'gnus-ps-print-hook)
7253 (ps-print-buffer-with-faces filename))))
7254 (kill-buffer buffer))))))
7256 (defun gnus-summary-show-article (&optional arg)
7257 "Force re-fetching of the current article.
7258 If ARG (the prefix) is non-nil, show the raw article without any
7259 article massaging functions being run."
7262 ;; Select the article the normal way.
7263 (gnus-summary-select-article nil 'force)
7264 ;; We have to require this here to make sure that the following
7265 ;; dynamic binding isn't shadowed by autoloading.
7266 (require 'gnus-async)
7268 ;; Bind the article treatment functions to nil.
7269 (let ((gnus-have-all-headers t)
7270 gnus-article-display-hook
7271 gnus-article-prepare-hook
7272 gnus-article-decode-hook
7276 (gnus-summary-select-article nil 'force)))
7277 (gnus-summary-goto-subject gnus-current-article)
7278 (gnus-summary-position-point))
7280 (defun gnus-summary-verbose-headers (&optional arg)
7281 "Toggle permanent full header display.
7282 If ARG is a positive number, turn header display on.
7283 If ARG is a negative number, turn header display off."
7285 (setq gnus-show-all-headers
7286 (cond ((or (not (numberp arg))
7288 (not gnus-show-all-headers))
7291 (gnus-summary-show-article))
7293 (defun gnus-summary-toggle-header (&optional arg)
7294 "Show the headers if they are hidden, or hide them if they are shown.
7295 If ARG is a positive number, show the entire header.
7296 If ARG is a negative number, hide the unwanted header lines."
7299 (set-buffer gnus-article-buffer)
7301 (let* ((buffer-read-only nil)
7302 (inhibit-point-motion-hooks t)
7308 (article-narrow-to-head)
7309 (gnus-article-hidden-text-p 'headers))))
7310 (goto-char (point-min))
7311 (when (search-forward "\n\n" nil t)
7312 (delete-region (point-min) (1- (point))))
7313 (goto-char (point-min))
7315 (set-buffer gnus-original-article-buffer)
7316 (goto-char (point-min))
7317 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7318 (insert-buffer-substring gnus-original-article-buffer 1 e)
7320 (narrow-to-region (point-min) (point))
7321 (article-decode-encoded-words)
7323 (let ((gnus-treat-hide-headers nil)
7324 (gnus-treat-hide-boring-headers nil))
7325 (gnus-treat-article 'head))
7326 (gnus-treat-article 'head)))))))
7328 (defun gnus-summary-show-all-headers ()
7329 "Make all header lines visible."
7331 (gnus-article-show-all-headers))
7333 (defun gnus-summary-toggle-mime (&optional arg)
7334 "Toggle MIME processing.
7335 If ARG is a positive number, turn MIME processing on."
7337 (setq gnus-show-mime
7339 (not gnus-show-mime)
7340 (> (prefix-numeric-value arg) 0)))
7341 (gnus-summary-select-article t 'force))
7343 (defun gnus-summary-caesar-message (&optional arg)
7344 "Caesar rotate the current article by 13.
7345 The numerical prefix specifies how many places to rotate each letter
7348 (gnus-summary-select-article)
7349 (let ((mail-header-separator ""))
7350 (gnus-eval-in-buffer-window gnus-article-buffer
7353 (let ((start (window-start))
7355 (message-caesar-buffer-body arg)
7356 (set-window-start (get-buffer-window (current-buffer)) start))))))
7358 (defun gnus-summary-stop-page-breaking ()
7359 "Stop page breaking in the current article."
7361 (gnus-summary-select-article)
7362 (gnus-eval-in-buffer-window gnus-article-buffer
7364 (when (gnus-visual-p 'page-marker)
7365 (let ((buffer-read-only nil))
7366 (gnus-remove-text-with-property 'gnus-prev)
7367 (gnus-remove-text-with-property 'gnus-next))
7368 (setq gnus-page-broken nil))))
7370 (defun gnus-summary-move-article (&optional n to-newsgroup
7371 select-method action)
7372 "Move the current article to a different newsgroup.
7373 If N is a positive number, move the N next articles.
7374 If N is a negative number, move the N previous articles.
7375 If N is nil and any articles have been marked with the process mark,
7376 move those articles instead.
7377 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7378 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7379 re-spool using this method.
7381 For this function to work, both the current newsgroup and the
7382 newsgroup that you want to move to have to support the `request-move'
7383 and `request-accept' functions."
7386 (setq action 'move))
7387 ;; Disable marking as read.
7388 (let (gnus-mark-article-hook)
7389 (save-window-excursion
7390 (gnus-summary-select-article)))
7391 ;; Check whether the source group supports the required functions.
7392 (cond ((and (eq action 'move)
7393 (not (gnus-check-backend-function
7394 'request-move-article gnus-newsgroup-name)))
7395 (error "The current group does not support article moving"))
7396 ((and (eq action 'crosspost)
7397 (not (gnus-check-backend-function
7398 'request-replace-article gnus-newsgroup-name)))
7399 (error "The current group does not support article editing")))
7400 (let ((articles (gnus-summary-work-articles n))
7401 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7402 (names '((move "Move" "Moving")
7403 (copy "Copy" "Copying")
7404 (crosspost "Crosspost" "Crossposting")))
7405 (copy-buf (save-excursion
7406 (nnheader-set-temp-buffer " *copy article*")))
7407 (default-marks gnus-article-mark-lists)
7408 (no-expire-marks (delete '(expirable . expire)
7409 (copy-sequence gnus-article-mark-lists)))
7410 art-group to-method new-xref article to-groups)
7411 (unless (assq action names)
7412 (error "Unknown action %s" action))
7413 ;; Read the newsgroup name.
7414 (when (and (not to-newsgroup)
7415 (not select-method))
7417 (gnus-read-move-group-name
7418 (cadr (assq action names))
7419 (symbol-value (intern (format "gnus-current-%s-group" action)))
7421 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7422 (setq to-method (or select-method
7423 (gnus-group-name-to-method to-newsgroup)))
7424 ;; Check the method we are to move this article to...
7425 (unless (gnus-check-backend-function
7426 'request-accept-article (car to-method))
7427 (error "%s does not support article copying" (car to-method)))
7428 (unless (gnus-check-server to-method)
7429 (error "Can't open server %s" (car to-method)))
7430 (gnus-message 6 "%s to %s: %s..."
7431 (caddr (assq action names))
7432 (or (car select-method) to-newsgroup) articles)
7434 (setq article (pop articles))
7438 ;; Move the article.
7440 ;; Remove this article from future suppression.
7441 (gnus-dup-unsuppress-article article)
7442 (gnus-request-move-article
7443 article ; Article to move
7444 gnus-newsgroup-name ; From newsgroup
7445 (nth 1 (gnus-find-method-for-group
7446 gnus-newsgroup-name)) ; Server
7447 (list 'gnus-request-accept-article
7448 to-newsgroup (list 'quote select-method)
7449 (not articles) t) ; Accept form
7450 (not articles))) ; Only save nov last time
7451 ;; Copy the article.
7454 (set-buffer copy-buf)
7455 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7456 (gnus-request-accept-article
7457 to-newsgroup select-method (not articles) t))))
7458 ;; Crosspost the article.
7459 ((eq action 'crosspost)
7460 (let ((xref (message-tokenize-header
7461 (mail-header-xref (gnus-summary-article-header article))
7463 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7466 (setq xref (list (system-name))))
7469 (mapconcat 'identity
7470 (delete "Xref:" (delete new-xref xref))
7474 (set-buffer copy-buf)
7475 ;; First put the article in the destination group.
7476 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7477 (when (consp (setq art-group
7478 (gnus-request-accept-article
7479 to-newsgroup select-method (not articles))))
7480 (setq new-xref (concat new-xref " " (car art-group)
7481 ":" (cdr art-group)))
7482 ;; Now we have the new Xrefs header, so we insert
7483 ;; it and replace the new article.
7484 (nnheader-replace-header "Xref" new-xref)
7485 (gnus-request-replace-article
7486 (cdr art-group) to-newsgroup (current-buffer))
7490 (gnus-message 1 "Couldn't %s article %s: %s"
7491 (cadr (assq action names)) article
7492 (nnheader-get-report (car to-method))))
7493 ((and (eq art-group 'junk)
7495 (gnus-summary-mark-article article gnus-canceled-mark)
7496 (gnus-message 4 "Deleted article %s" article))
7498 (let* ((pto-group (gnus-group-prefixed-name
7499 (car art-group) to-method))
7501 (gnus-gethash pto-group gnus-newsrc-hashtb))
7502 (info (nth 2 entry))
7503 (to-group (gnus-info-group info))
7505 ;; Update the group that has been moved to.
7507 (memq action '(move copy)))
7508 (unless (member to-group to-groups)
7509 (push to-group to-groups))
7511 (unless (memq article gnus-newsgroup-unreads)
7512 (push 'read to-marks)
7514 info (gnus-add-to-range (gnus-info-read info)
7515 (list (cdr art-group)))))
7517 ;; Copy any marks over to the new group.
7518 (let ((marks (if (gnus-group-auto-expirable-p to-group)
7521 (to-article (cdr art-group)))
7523 ;; See whether the article is to be put in the cache.
7524 (when gnus-use-cache
7525 (gnus-cache-possibly-enter-article
7527 (let ((header (copy-sequence
7528 (gnus-summary-article-header article))))
7529 (mail-header-set-number header to-article)
7531 (memq article gnus-newsgroup-marked)
7532 (memq article gnus-newsgroup-dormant)
7533 (memq article gnus-newsgroup-unreads)))
7535 (when (and (equal to-group gnus-newsgroup-name)
7536 (not (memq article gnus-newsgroup-unreads)))
7537 ;; Mark this article as read in this group.
7538 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7539 (setcdr (gnus-active to-group) to-article)
7540 (setcdr gnus-newsgroup-active to-article))
7543 (when (memq article (symbol-value
7544 (intern (format "gnus-newsgroup-%s"
7546 (push (cdar marks) to-marks)
7547 ;; If the other group is the same as this group,
7548 ;; then we have to add the mark to the list.
7549 (when (equal to-group gnus-newsgroup-name)
7550 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7553 (intern (format "gnus-newsgroup-%s"
7555 ;; Copy the marks to other group.
7556 (gnus-add-marked-articles
7557 to-group (cdar marks) (list to-article) info))
7558 (setq marks (cdr marks)))
7560 (gnus-request-set-mark to-group (list (list (list to-article)
7565 (concat "(gnus-group-set-info '"
7566 (gnus-prin1-to-string (gnus-get-info to-group))
7569 ;; Update the Xref header in this article to point to
7570 ;; the new crossposted article we have just created.
7571 (when (eq action 'crosspost)
7573 (set-buffer copy-buf)
7574 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7575 (nnheader-replace-header "Xref" new-xref)
7576 (gnus-request-replace-article
7577 article gnus-newsgroup-name (current-buffer)))))
7579 ;;;!!!Why is this necessary?
7580 (set-buffer gnus-summary-buffer)
7582 (gnus-summary-goto-subject article)
7583 (when (eq action 'move)
7584 (gnus-summary-mark-article article gnus-canceled-mark))))
7585 (gnus-summary-remove-process-mark article))
7586 ;; Re-activate all groups that have been moved to.
7589 (set-buffer gnus-group-buffer)
7590 (when (gnus-group-goto-group (car to-groups) t)
7591 (gnus-group-get-new-news-this-group 1 t))
7594 (gnus-kill-buffer copy-buf)
7595 (gnus-summary-position-point)
7596 (gnus-set-mode-line 'summary)))
7598 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7599 "Move the current article to a different newsgroup.
7600 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7601 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7602 re-spool using this method."
7604 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7606 (defun gnus-summary-crosspost-article (&optional n)
7607 "Crosspost the current article to some other group."
7609 (gnus-summary-move-article n nil nil 'crosspost))
7611 (defcustom gnus-summary-respool-default-method nil
7612 "Default method for respooling an article.
7613 If nil, use to the current newsgroup method."
7614 :type '(choice (gnus-select-method :value (nnml ""))
7616 :group 'gnus-summary-mail)
7618 (defun gnus-summary-respool-article (&optional n method)
7619 "Respool the current article.
7620 The article will be squeezed through the mail spooling process again,
7621 which means that it will be put in some mail newsgroup or other
7622 depending on `nnmail-split-methods'.
7623 If N is a positive number, respool the N next articles.
7624 If N is a negative number, respool the N previous articles.
7625 If N is nil and any articles have been marked with the process mark,
7626 respool those articles instead.
7628 Respooling can be done both from mail groups and \"real\" newsgroups.
7629 In the former case, the articles in question will be moved from the
7630 current group into whatever groups they are destined to. In the
7631 latter case, they will be copied into the relevant groups."
7633 (list current-prefix-arg
7634 (let* ((methods (gnus-methods-using 'respool))
7636 (symbol-name (or gnus-summary-respool-default-method
7637 (car (gnus-find-method-for-group
7638 gnus-newsgroup-name)))))
7640 (gnus-completing-read
7641 methname "What backend do you want to use when respooling?"
7642 methods nil t nil 'gnus-mail-method-history))
7645 ((zerop (length (setq ms (gnus-servers-using-backend
7647 (list (intern method) ""))
7651 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7652 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7655 (error "No method given for respooling"))
7656 (if (assoc (symbol-name
7657 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7658 (gnus-methods-using 'respool))
7659 (gnus-summary-move-article n nil method)
7660 (gnus-summary-copy-article n nil method)))
7662 (defun gnus-summary-import-article (file)
7663 "Import an arbitrary file into a mail newsgroup."
7664 (interactive "fImport file: ")
7665 (let ((group gnus-newsgroup-name)
7666 (now (current-time))
7668 (unless (gnus-check-backend-function 'request-accept-article group)
7669 (error "%s does not support article importing" group))
7670 (or (file-readable-p file)
7671 (not (file-regular-p file))
7672 (error "Can't read %s" file))
7674 (set-buffer (gnus-get-buffer-create " *import file*"))
7676 (nnheader-insert-file-contents file)
7677 (goto-char (point-min))
7678 (unless (nnheader-article-p)
7679 ;; This doesn't look like an article, so we fudge some headers.
7680 (setq atts (file-attributes file)
7681 lines (count-lines (point-min) (point-max)))
7682 (insert "From: " (read-string "From: ") "\n"
7683 "Subject: " (read-string "Subject: ") "\n"
7684 "Date: " (message-make-date (nth 5 atts))
7686 "Message-ID: " (message-make-message-id) "\n"
7687 "Lines: " (int-to-string lines) "\n"
7688 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7689 (gnus-request-accept-article group nil t)
7690 (kill-buffer (current-buffer)))))
7692 (defun gnus-summary-article-posted-p ()
7693 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7694 This will be the case if the article has both been mailed and posted."
7696 (let ((id (mail-header-references (gnus-summary-article-header)))
7697 (gnus-override-method
7698 (or gnus-refer-article-method gnus-select-method)))
7699 (if (gnus-request-head id "")
7700 (gnus-message 2 "The current message was found on %s"
7701 gnus-override-method)
7702 (gnus-message 2 "The current message couldn't be found on %s"
7703 gnus-override-method)
7706 (defun gnus-summary-expire-articles (&optional now)
7707 "Expire all articles that are marked as expirable in the current group."
7709 (when (gnus-check-backend-function
7710 'request-expire-articles gnus-newsgroup-name)
7711 ;; This backend supports expiry.
7712 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7713 (expirable (if total
7715 ;; We need to update the info for
7716 ;; this group for `gnus-list-of-read-articles'
7717 ;; to give us the right answer.
7718 (gnus-run-hooks 'gnus-exit-group-hook)
7719 (gnus-summary-update-info)
7720 (gnus-list-of-read-articles gnus-newsgroup-name))
7721 (setq gnus-newsgroup-expirable
7722 (sort gnus-newsgroup-expirable '<))))
7723 (expiry-wait (if now 'immediate
7724 (gnus-group-find-parameter
7725 gnus-newsgroup-name 'expiry-wait)))
7728 ;; There are expirable articles in this group, so we run them
7729 ;; through the expiry process.
7730 (gnus-message 6 "Expiring articles...")
7731 (unless (gnus-check-group gnus-newsgroup-name)
7732 (error "Can't open server for %s" gnus-newsgroup-name))
7733 ;; The list of articles that weren't expired is returned.
7736 (let ((nnmail-expiry-wait-function nil)
7737 (nnmail-expiry-wait expiry-wait))
7738 (setq es (gnus-request-expire-articles
7739 expirable gnus-newsgroup-name)))
7740 (setq es (gnus-request-expire-articles
7741 expirable gnus-newsgroup-name))))
7743 (setq gnus-newsgroup-expirable es))
7744 ;; We go through the old list of expirable, and mark all
7745 ;; really expired articles as nonexistent.
7746 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7747 (let ((gnus-use-cache nil))
7749 (unless (memq (car expirable) es)
7750 (when (gnus-data-find (car expirable))
7751 (gnus-summary-mark-article
7752 (car expirable) gnus-canceled-mark)))
7753 (setq expirable (cdr expirable)))))
7754 (gnus-message 6 "Expiring articles...done")))))
7756 (defun gnus-summary-expire-articles-now ()
7757 "Expunge all expirable articles in the current group.
7758 This means that *all* articles that are marked as expirable will be
7759 deleted forever, right now."
7761 (or gnus-expert-user
7763 "Are you really, really, really sure you want to delete all these messages? ")
7765 (gnus-summary-expire-articles t))
7767 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7768 (defun gnus-summary-delete-article (&optional n)
7769 "Delete the N next (mail) articles.
7770 This command actually deletes articles. This is not a marking
7771 command. The article will disappear forever from your life, never to
7773 If N is negative, delete backwards.
7774 If N is nil and articles have been marked with the process mark,
7775 delete these instead."
7777 (unless (gnus-check-backend-function 'request-expire-articles
7778 gnus-newsgroup-name)
7779 (error "The current newsgroup does not support article deletion"))
7780 ;; Compute the list of articles to delete.
7781 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7783 (if (and gnus-novice-user
7784 (not (gnus-yes-or-no-p
7785 (format "Do you really want to delete %s forever? "
7786 (if (> (length articles) 1)
7787 (format "these %s articles" (length articles))
7790 ;; Delete the articles.
7791 (setq not-deleted (gnus-request-expire-articles
7792 articles gnus-newsgroup-name 'force))
7794 (gnus-summary-remove-process-mark (car articles))
7795 ;; The backend might not have been able to delete the article
7797 (unless (memq (car articles) not-deleted)
7798 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7799 (setq articles (cdr articles)))
7801 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7802 (gnus-summary-position-point)
7803 (gnus-set-mode-line 'summary)
7806 (defun gnus-summary-edit-article (&optional force)
7807 "Edit the current article.
7808 This will have permanent effect only in mail groups.
7809 If FORCE is non-nil, allow editing of articles even in read-only
7813 (set-buffer gnus-summary-buffer)
7814 (let ((mail-parse-charset gnus-newsgroup-charset)
7815 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
7816 (gnus-set-global-variables)
7817 (when (and (not force)
7818 (gnus-group-read-only-p))
7819 (error "The current newsgroup does not support article editing"))
7820 (gnus-summary-show-article t)
7821 (gnus-article-edit-article
7823 `(lambda (no-highlight)
7824 (let ((mail-parse-charset ',gnus-newsgroup-charset)
7825 (mail-parse-ignored-charsets
7826 ',gnus-newsgroup-ignored-charsets))
7827 (gnus-summary-edit-article-done
7828 ,(or (mail-header-references gnus-current-headers) "")
7829 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7831 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7833 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7835 "Make edits to the current article permanent."
7837 ;; Replace the article.
7838 (let ((buf (current-buffer)))
7840 (insert-buffer-substring buf)
7841 (if (and (not read-only)
7842 (not (gnus-request-replace-article
7843 (cdr gnus-article-current) (car gnus-article-current)
7844 (current-buffer) t)))
7845 (error "Couldn't replace article")
7846 ;; Update the summary buffer.
7848 (equal (message-tokenize-header references " ")
7849 (message-tokenize-header
7850 (or (message-fetch-field "references") "") " ")))
7851 ;; We only have to update this line.
7854 (message-narrow-to-head)
7855 (let ((head (buffer-string))
7858 (insert (format "211 %d Article retrieved.\n"
7859 (cdr gnus-article-current)))
7862 (let ((nntp-server-buffer (current-buffer)))
7863 (setq header (car (gnus-get-newsgroup-headers
7865 (set-buffer gnus-summary-buffer)
7866 gnus-newsgroup-dependencies)
7869 (set-buffer gnus-summary-buffer)
7870 (gnus-data-set-header
7871 (gnus-data-find (cdr gnus-article-current))
7873 (gnus-summary-update-article-line
7874 (cdr gnus-article-current) header))))))
7876 (set-buffer (or buffer gnus-summary-buffer))
7877 (gnus-summary-update-article (cdr gnus-article-current)))
7878 ;; Prettify the article buffer again.
7879 (unless no-highlight
7881 (set-buffer gnus-article-buffer)
7882 ;;;!!! Fix this -- article should be rehighlighted.
7883 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7884 (set-buffer gnus-original-article-buffer)
7885 (gnus-request-article
7886 (cdr gnus-article-current)
7887 (car gnus-article-current) (current-buffer))))
7888 ;; Prettify the summary buffer line.
7889 (when (gnus-visual-p 'summary-highlight 'highlight)
7890 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7892 (defun gnus-summary-edit-wash (key)
7893 "Perform editing command KEY in the article buffer."
7897 (message "%s" (concat (this-command-keys) "- "))
7900 (gnus-summary-edit-article)
7901 (execute-kbd-macro (concat (this-command-keys) key))
7902 (gnus-article-edit-done))
7906 (defun gnus-summary-respool-query (&optional silent trace)
7907 "Query where the respool algorithm would put this article."
7909 (let (gnus-mark-article-hook)
7910 (gnus-summary-select-article)
7912 (set-buffer gnus-original-article-buffer)
7914 (message-narrow-to-head)
7915 (let ((groups (nnmail-article-group 'identity trace)))
7918 (message "This message would go to %s"
7919 (mapconcat 'car groups ", "))
7920 (message "This message would go to no groups"))
7923 (defun gnus-summary-respool-trace ()
7924 "Trace where the respool algorithm would put this article.
7925 Display a buffer showing all fancy splitting patterns which matched."
7927 (gnus-summary-respool-query nil t))
7929 ;; Summary marking commands.
7931 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7932 "Mark articles which has the same subject as read, and then select the next.
7933 If UNMARK is positive, remove any kind of mark.
7934 If UNMARK is negative, tick articles."
7937 (setq unmark (prefix-numeric-value unmark)))
7939 (gnus-summary-mark-same-subject
7940 (gnus-summary-article-subject) unmark)))
7941 ;; Select next unread article. If auto-select-same mode, should
7942 ;; select the first unread article.
7943 (gnus-summary-next-article t (and gnus-auto-select-same
7944 (gnus-summary-article-subject)))
7945 (gnus-message 7 "%d article%s marked as %s"
7946 count (if (= count 1) " is" "s are")
7947 (if unmark "unread" "read"))))
7949 (defun gnus-summary-kill-same-subject (&optional unmark)
7950 "Mark articles which has the same subject as read.
7951 If UNMARK is positive, remove any kind of mark.
7952 If UNMARK is negative, tick articles."
7955 (setq unmark (prefix-numeric-value unmark)))
7957 (gnus-summary-mark-same-subject
7958 (gnus-summary-article-subject) unmark)))
7959 ;; If marked as read, go to next unread subject.
7961 ;; Go to next unread subject.
7962 (gnus-summary-next-subject 1 t))
7963 (gnus-message 7 "%d articles are marked as %s"
7964 count (if unmark "unread" "read"))))
7966 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7967 "Mark articles with same SUBJECT as read, and return marked number.
7968 If optional argument UNMARK is positive, remove any kinds of marks.
7969 If optional argument UNMARK is negative, mark articles as unread instead."
7973 ((null unmark) ; Mark as read.
7976 (gnus-summary-mark-article-as-read gnus-killed-mark)
7977 (gnus-summary-show-thread) t)
7978 (gnus-summary-find-subject subject))
7979 (setq count (1+ count))))
7980 ((> unmark 0) ; Tick.
7983 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7984 (gnus-summary-show-thread) t)
7985 (gnus-summary-find-subject subject))
7986 (setq count (1+ count))))
7987 (t ; Mark as unread.
7990 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7991 (gnus-summary-show-thread) t)
7992 (gnus-summary-find-subject subject))
7993 (setq count (1+ count)))))
7994 (gnus-set-mode-line 'summary)
7995 ;; Return the number of marked articles.
7998 (defun gnus-summary-mark-as-processable (n &optional unmark)
7999 "Set the process mark on the next N articles.
8000 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8001 the process mark instead. The difference between N and the actual
8002 number of articles marked is returned."
8004 (let ((backward (< n 0))
8009 (gnus-summary-remove-process-mark
8010 (gnus-summary-article-number))
8011 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8012 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
8015 (gnus-message 7 "No more articles"))
8016 (gnus-summary-recenter)
8017 (gnus-summary-position-point)
8020 (defun gnus-summary-unmark-as-processable (n)
8021 "Remove the process mark from the next N articles.
8022 If N is negative, unmark backward instead. The difference between N and
8023 the actual number of articles unmarked is returned."
8025 (gnus-summary-mark-as-processable n t))
8027 (defun gnus-summary-unmark-all-processable ()
8028 "Remove the process mark from all articles."
8031 (while gnus-newsgroup-processable
8032 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
8033 (gnus-summary-position-point))
8035 (defun gnus-summary-mark-as-expirable (n)
8036 "Mark N articles forward as expirable.
8037 If N is negative, mark backward instead. The difference between N and
8038 the actual number of articles marked is returned."
8040 (gnus-summary-mark-forward n gnus-expirable-mark))
8042 (defun gnus-summary-mark-article-as-replied (article)
8043 "Mark ARTICLE replied and update the summary line."
8044 (push article gnus-newsgroup-replied)
8045 (let ((buffer-read-only nil))
8046 (when (gnus-summary-goto-subject article nil t)
8047 (gnus-summary-update-secondary-mark article))))
8049 (defun gnus-summary-set-bookmark (article)
8050 "Set a bookmark in current article."
8051 (interactive (list (gnus-summary-article-number)))
8052 (when (or (not (get-buffer gnus-article-buffer))
8053 (not gnus-current-article)
8054 (not gnus-article-current)
8055 (not (equal gnus-newsgroup-name (car gnus-article-current))))
8056 (error "No current article selected"))
8057 ;; Remove old bookmark, if one exists.
8058 (let ((old (assq article gnus-newsgroup-bookmarks)))
8060 (setq gnus-newsgroup-bookmarks
8061 (delq old gnus-newsgroup-bookmarks))))
8062 ;; Set the new bookmark, which is on the form
8063 ;; (article-number . line-number-in-body).
8067 (set-buffer gnus-article-buffer)
8071 (goto-char (point-min))
8072 (search-forward "\n\n" nil t)
8075 gnus-newsgroup-bookmarks)
8076 (gnus-message 6 "A bookmark has been added to the current article."))
8078 (defun gnus-summary-remove-bookmark (article)
8079 "Remove the bookmark from the current article."
8080 (interactive (list (gnus-summary-article-number)))
8081 ;; Remove old bookmark, if one exists.
8082 (let ((old (assq article gnus-newsgroup-bookmarks)))
8085 (setq gnus-newsgroup-bookmarks
8086 (delq old gnus-newsgroup-bookmarks))
8087 (gnus-message 6 "Removed bookmark."))
8088 (gnus-message 6 "No bookmark in current article."))))
8090 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8091 (defun gnus-summary-mark-as-dormant (n)
8092 "Mark N articles forward as dormant.
8093 If N is negative, mark backward instead. The difference between N and
8094 the actual number of articles marked is returned."
8096 (gnus-summary-mark-forward n gnus-dormant-mark))
8098 (defun gnus-summary-set-process-mark (article)
8099 "Set the process mark on ARTICLE and update the summary line."
8100 (setq gnus-newsgroup-processable
8102 (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-remove-process-mark (article)
8109 "Remove the process mark from ARTICLE and update the summary line."
8110 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
8111 (when (gnus-summary-goto-subject article)
8112 (gnus-summary-show-thread)
8113 (gnus-summary-goto-subject article)
8114 (gnus-summary-update-secondary-mark article)))
8116 (defun gnus-summary-set-saved-mark (article)
8117 "Set the process mark on ARTICLE and update the summary line."
8118 (push article gnus-newsgroup-saved)
8119 (when (gnus-summary-goto-subject article)
8120 (gnus-summary-update-secondary-mark article)))
8122 (defun gnus-summary-mark-forward (n &optional mark no-expire)
8123 "Mark N articles as read forwards.
8124 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8125 The difference between N and the actual number of articles marked is
8128 (gnus-summary-show-thread)
8129 (let ((backward (< n 0))
8130 (gnus-summary-goto-unread
8131 (and gnus-summary-goto-unread
8132 (not (eq gnus-summary-goto-unread 'never))
8133 (not (memq mark (list gnus-unread-mark
8134 gnus-ticked-mark gnus-dormant-mark)))))
8136 (mark (or mark gnus-del-mark)))
8138 (gnus-summary-mark-article nil mark no-expire)
8139 (zerop (gnus-summary-next-subject
8141 (and gnus-summary-goto-unread
8142 (not (eq gnus-summary-goto-unread 'never)))
8146 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
8147 (gnus-summary-recenter)
8148 (gnus-summary-position-point)
8149 (gnus-set-mode-line 'summary)
8152 (defun gnus-summary-mark-article-as-read (mark)
8153 "Mark the current article quickly as read with MARK."
8154 (let ((article (gnus-summary-article-number)))
8155 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8156 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8157 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8158 (push (cons article mark) gnus-newsgroup-reads)
8159 ;; Possibly remove from cache, if that is used.
8160 (when gnus-use-cache
8161 (gnus-cache-enter-remove-article article))
8162 ;; Allow the backend to change the mark.
8163 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8164 ;; Check for auto-expiry.
8165 (when (and gnus-newsgroup-auto-expire
8166 (memq mark gnus-auto-expirable-marks))
8167 (setq mark gnus-expirable-mark)
8168 ;; Let the backend know about the mark change.
8169 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8170 (push article gnus-newsgroup-expirable))
8171 ;; Set the mark in the buffer.
8172 (gnus-summary-update-mark mark 'unread)
8175 (defun gnus-summary-mark-article-as-unread (mark)
8176 "Mark the current article quickly as unread with MARK."
8177 (let* ((article (gnus-summary-article-number))
8178 (old-mark (gnus-summary-article-mark article)))
8179 ;; Allow the backend to change the mark.
8180 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8181 (if (eq mark old-mark)
8185 (gnus-error 1 "Can't mark negative article numbers")
8187 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8188 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8189 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
8190 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
8191 (cond ((= mark gnus-ticked-mark)
8192 (push article gnus-newsgroup-marked))
8193 ((= mark gnus-dormant-mark)
8194 (push article gnus-newsgroup-dormant))
8196 (push article gnus-newsgroup-unreads)))
8197 (gnus-pull article gnus-newsgroup-reads)
8199 ;; See whether the article is to be put in the cache.
8201 (vectorp (gnus-summary-article-header article))
8203 (gnus-cache-possibly-enter-article
8204 gnus-newsgroup-name article
8205 (gnus-summary-article-header article)
8206 (= mark gnus-ticked-mark)
8207 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8210 (gnus-summary-update-mark mark 'unread)
8213 (defun gnus-summary-mark-article (&optional article mark no-expire)
8214 "Mark ARTICLE with MARK. MARK can be any character.
8215 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8216 `??' (dormant) and `?E' (expirable).
8217 If MARK is nil, then the default character `?r' is used.
8218 If ARTICLE is nil, then the article on the current line will be
8220 ;; The mark might be a string.
8221 (when (stringp mark)
8222 (setq mark (aref mark 0)))
8223 ;; If no mark is given, then we check auto-expiring.
8225 (setq mark gnus-del-mark))
8226 (when (and (not no-expire)
8227 gnus-newsgroup-auto-expire
8228 (memq mark gnus-auto-expirable-marks))
8229 (setq mark gnus-expirable-mark))
8230 (let ((article (or article (gnus-summary-article-number)))
8231 (old-mark (gnus-summary-article-mark article)))
8232 ;; Allow the backend to change the mark.
8233 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8234 (if (eq mark old-mark)
8237 (error "No article on current line"))
8238 (if (not (if (or (= mark gnus-unread-mark)
8239 (= mark gnus-ticked-mark)
8240 (= mark gnus-dormant-mark))
8241 (gnus-mark-article-as-unread article mark)
8242 (gnus-mark-article-as-read article mark)))
8244 ;; See whether the article is to be put in the cache.
8246 (not (= mark gnus-canceled-mark))
8247 (vectorp (gnus-summary-article-header article))
8249 (gnus-cache-possibly-enter-article
8250 gnus-newsgroup-name article
8251 (gnus-summary-article-header article)
8252 (= mark gnus-ticked-mark)
8253 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8255 (when (gnus-summary-goto-subject article nil t)
8256 (let ((buffer-read-only nil))
8257 (gnus-summary-show-thread)
8259 (gnus-summary-update-mark mark 'unread)
8262 (defun gnus-summary-update-secondary-mark (article)
8263 "Update the secondary (read, process, cache) mark."
8264 (gnus-summary-update-mark
8265 (cond ((memq article gnus-newsgroup-processable)
8267 ((memq article gnus-newsgroup-cached)
8269 ((memq article gnus-newsgroup-replied)
8271 ((memq article gnus-newsgroup-saved)
8273 (t gnus-unread-mark))
8275 (when (gnus-visual-p 'summary-highlight 'highlight)
8276 (gnus-run-hooks 'gnus-summary-update-hook))
8279 (defun gnus-summary-update-mark (mark type)
8280 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
8281 (buffer-read-only nil))
8282 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
8284 (when (looking-at "\r")
8286 (when (<= (+ forward (point)) (point-max))
8287 ;; Go to the right position on the line.
8288 (goto-char (+ forward (point)))
8289 ;; Replace the old mark with the new mark.
8290 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
8291 ;; Optionally update the marks by some user rule.
8292 (when (eq type 'unread)
8294 (gnus-data-find (gnus-summary-article-number)) mark)
8295 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
8297 (defun gnus-mark-article-as-read (article &optional mark)
8298 "Enter ARTICLE in the pertinent lists and remove it from others."
8299 ;; Make the article expirable.
8300 (let ((mark (or mark gnus-del-mark)))
8301 (if (= mark gnus-expirable-mark)
8302 (push article gnus-newsgroup-expirable)
8303 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8304 ;; Remove from unread and marked lists.
8305 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8306 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8307 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8308 (push (cons article mark) gnus-newsgroup-reads)
8309 ;; Possibly remove from cache, if that is used.
8310 (when gnus-use-cache
8311 (gnus-cache-enter-remove-article article))
8314 (defun gnus-mark-article-as-unread (article &optional mark)
8315 "Enter ARTICLE in the pertinent lists and remove it from others."
8316 (let ((mark (or mark gnus-ticked-mark)))
8319 (gnus-error 1 "Can't mark negative article numbers")
8321 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8322 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8323 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8324 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8326 ;; Unsuppress duplicates?
8327 (when gnus-suppress-duplicates
8328 (gnus-dup-unsuppress-article article))
8330 (cond ((= mark gnus-ticked-mark)
8331 (push article gnus-newsgroup-marked))
8332 ((= mark gnus-dormant-mark)
8333 (push article gnus-newsgroup-dormant))
8335 (push article gnus-newsgroup-unreads)))
8336 (gnus-pull article gnus-newsgroup-reads)
8339 (defalias 'gnus-summary-mark-as-unread-forward
8340 'gnus-summary-tick-article-forward)
8341 (make-obsolete 'gnus-summary-mark-as-unread-forward
8342 'gnus-summary-tick-article-forward)
8343 (defun gnus-summary-tick-article-forward (n)
8344 "Tick N articles forwards.
8345 If N is negative, tick backwards instead.
8346 The difference between N and the number of articles ticked is returned."
8348 (gnus-summary-mark-forward n gnus-ticked-mark))
8350 (defalias 'gnus-summary-mark-as-unread-backward
8351 'gnus-summary-tick-article-backward)
8352 (make-obsolete 'gnus-summary-mark-as-unread-backward
8353 'gnus-summary-tick-article-backward)
8354 (defun gnus-summary-tick-article-backward (n)
8355 "Tick N articles backwards.
8356 The difference between N and the number of articles ticked is returned."
8358 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8360 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8361 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8362 (defun gnus-summary-tick-article (&optional article clear-mark)
8363 "Mark current article as unread.
8364 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8365 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8367 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8370 (defun gnus-summary-mark-as-read-forward (n)
8371 "Mark N articles as read forwards.
8372 If N is negative, mark backwards instead.
8373 The difference between N and the actual number of articles marked is
8376 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8378 (defun gnus-summary-mark-as-read-backward (n)
8379 "Mark the N articles as read backwards.
8380 The difference between N and the actual number of articles marked is
8383 (gnus-summary-mark-forward
8384 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8386 (defun gnus-summary-mark-as-read (&optional article mark)
8387 "Mark current article as read.
8388 ARTICLE specifies the article to be marked as read.
8389 MARK specifies a string to be inserted at the beginning of the line."
8390 (gnus-summary-mark-article article mark))
8392 (defun gnus-summary-clear-mark-forward (n)
8393 "Clear marks from N articles forward.
8394 If N is negative, clear backward instead.
8395 The difference between N and the number of marks cleared is returned."
8397 (gnus-summary-mark-forward n gnus-unread-mark))
8399 (defun gnus-summary-clear-mark-backward (n)
8400 "Clear marks from N articles backward.
8401 The difference between N and the number of marks cleared is returned."
8403 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8405 (defun gnus-summary-mark-unread-as-read ()
8406 "Intended to be used by `gnus-summary-mark-article-hook'."
8407 (when (memq gnus-current-article gnus-newsgroup-unreads)
8408 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8410 (defun gnus-summary-mark-read-and-unread-as-read ()
8411 "Intended to be used by `gnus-summary-mark-article-hook'."
8412 (let ((mark (gnus-summary-article-mark)))
8413 (when (or (gnus-unread-mark-p mark)
8414 (gnus-read-mark-p mark))
8415 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8417 (defun gnus-summary-mark-region-as-read (point mark all)
8418 "Mark all unread articles between point and mark as read.
8419 If given a prefix, mark all articles between point and mark as read,
8420 even ticked and dormant ones."
8421 (interactive "r\nP")
8430 (memq (setq article (gnus-summary-article-number))
8431 gnus-newsgroup-unreads))
8432 (gnus-summary-mark-article article gnus-del-mark))
8434 (gnus-summary-find-next))))))
8436 (defun gnus-summary-mark-below (score mark)
8437 "Mark articles with score less than SCORE with MARK."
8438 (interactive "P\ncMark: ")
8439 (setq score (if score
8440 (prefix-numeric-value score)
8441 (or gnus-summary-default-score 0)))
8443 (set-buffer gnus-summary-buffer)
8444 (goto-char (point-min))
8447 (and (< (gnus-summary-article-score) score)
8448 (gnus-summary-mark-article nil mark))
8449 (gnus-summary-find-next)))))
8451 (defun gnus-summary-kill-below (&optional score)
8452 "Mark articles with score below SCORE as read."
8454 (gnus-summary-mark-below score gnus-killed-mark))
8456 (defun gnus-summary-clear-above (&optional score)
8457 "Clear all marks from articles with score above SCORE."
8459 (gnus-summary-mark-above score gnus-unread-mark))
8461 (defun gnus-summary-tick-above (&optional score)
8462 "Tick all articles with score above SCORE."
8464 (gnus-summary-mark-above score gnus-ticked-mark))
8466 (defun gnus-summary-mark-above (score mark)
8467 "Mark articles with score over SCORE with MARK."
8468 (interactive "P\ncMark: ")
8469 (setq score (if score
8470 (prefix-numeric-value score)
8471 (or gnus-summary-default-score 0)))
8473 (set-buffer gnus-summary-buffer)
8474 (goto-char (point-min))
8476 (when (> (gnus-summary-article-score) score)
8477 (gnus-summary-mark-article nil mark))
8479 (gnus-summary-find-next)))))
8481 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8482 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8483 (defun gnus-summary-limit-include-expunged (&optional no-error)
8484 "Display all the hidden articles that were expunged for low scores."
8486 (let ((buffer-read-only nil))
8487 (let ((scored gnus-newsgroup-scored)
8490 (unless (gnus-summary-goto-subject (caar scored))
8491 (and (setq h (gnus-summary-article-header (caar scored)))
8492 (< (cdar scored) gnus-summary-expunge-below)
8494 (setq scored (cdr scored)))
8496 (when (not no-error)
8497 (error "No expunged articles hidden"))
8498 (goto-char (point-min))
8499 (gnus-summary-prepare-unthreaded (nreverse headers))
8500 (goto-char (point-min))
8501 (gnus-summary-position-point)
8504 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8505 "Mark all unread articles in this newsgroup as read.
8506 If prefix argument ALL is non-nil, ticked and dormant articles will
8507 also be marked as read.
8508 If QUIETLY is non-nil, no questions will be asked.
8509 If TO-HERE is non-nil, it should be a point in the buffer. All
8510 articles before this point will be marked as read.
8511 Note that this function will only catch up the unread article
8512 in the current summary buffer limitation.
8513 The number of articles marked as read is returned."
8518 (not gnus-interactive-catchup) ;Without confirmation?
8522 "Mark absolutely all articles as read? "
8523 "Mark all unread articles as read? ")))
8525 (not gnus-newsgroup-adaptive)
8526 (not gnus-newsgroup-auto-expire)
8527 (not gnus-suppress-duplicates)
8528 (or (not gnus-use-cache)
8529 (eq gnus-use-cache 'passive)))
8532 (setq gnus-newsgroup-marked nil
8533 gnus-newsgroup-dormant nil))
8534 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8535 ;; We actually mark all articles as canceled, which we
8536 ;; have to do when using auto-expiry or adaptive scoring.
8537 (gnus-summary-show-all-threads)
8538 (when (gnus-summary-first-subject (not all) t)
8540 (if to-here (< (point) to-here) t)
8541 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8542 (gnus-summary-find-next (not all) nil nil t))))
8543 (gnus-set-mode-line 'summary))
8545 (gnus-summary-position-point)))
8547 (defun gnus-summary-catchup-to-here (&optional all)
8548 "Mark all unticked articles before the current one as read.
8549 If ALL is non-nil, also mark ticked and dormant articles as read."
8552 (gnus-save-hidden-threads
8553 (let ((beg (point)))
8554 ;; We check that there are unread articles.
8555 (when (or all (gnus-summary-find-prev))
8556 (gnus-summary-catchup all t beg)))))
8557 (gnus-summary-position-point))
8559 (defun gnus-summary-catchup-all (&optional quietly)
8560 "Mark all articles in this newsgroup as read."
8562 (gnus-summary-catchup t quietly))
8564 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8565 "Mark all unread articles in this group as read, then exit.
8566 If prefix argument ALL is non-nil, all articles are marked as read."
8568 (when (gnus-summary-catchup all quietly nil 'fast)
8569 ;; Select next newsgroup or exit.
8570 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8571 (eq gnus-auto-select-next 'quietly))
8572 (gnus-summary-next-group nil)
8573 (gnus-summary-exit))))
8575 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8576 "Mark all articles in this newsgroup as read, and then exit."
8578 (gnus-summary-catchup-and-exit t quietly))
8580 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8581 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8582 "Mark all articles in this group as read and select the next group.
8583 If given a prefix, mark all articles, unread as well as ticked, as
8587 (gnus-summary-catchup all))
8588 (gnus-summary-next-group t nil nil))
8590 ;; Thread-based commands.
8592 (defun gnus-summary-articles-in-thread (&optional article)
8593 "Return a list of all articles in the current thread.
8594 If ARTICLE is non-nil, return all articles in the thread that starts
8596 (let* ((article (or article (gnus-summary-article-number)))
8597 (data (gnus-data-find-list article))
8598 (top-level (gnus-data-level (car data)))
8600 (cond ((null gnus-thread-operation-ignore-subject)
8601 (gnus-simplify-subject-re
8602 (mail-header-subject (gnus-data-header (car data)))))
8603 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8604 (gnus-simplify-subject-fuzzy
8605 (mail-header-subject (gnus-data-header (car data)))))
8607 (end-point (save-excursion
8608 (if (gnus-summary-go-to-next-thread)
8609 (point) (point-max))))
8612 (< (gnus-data-pos (car data)) end-point))
8613 (when (or (not top-subject)
8614 (string= top-subject
8615 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8616 (gnus-simplify-subject-fuzzy
8617 (mail-header-subject
8618 (gnus-data-header (car data))))
8619 (gnus-simplify-subject-re
8620 (mail-header-subject
8621 (gnus-data-header (car data)))))))
8622 (push (gnus-data-number (car data)) articles))
8623 (unless (and (setq data (cdr data))
8624 (> (gnus-data-level (car data)) top-level))
8626 ;; Return the list of articles.
8627 (nreverse articles)))
8629 (defun gnus-summary-rethread-current ()
8630 "Rethread the thread the current article is part of."
8632 (let* ((gnus-show-threads t)
8633 (article (gnus-summary-article-number))
8634 (id (mail-header-id (gnus-summary-article-header)))
8635 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8637 (error "No article on the current line"))
8638 (gnus-rebuild-thread id)
8639 (gnus-summary-goto-subject article)))
8641 (defun gnus-summary-reparent-thread ()
8642 "Make the current article child of the marked (or previous) article.
8644 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8645 is non-nil or the Subject: of both articles are the same."
8647 (unless (not (gnus-group-read-only-p))
8648 (error "The current newsgroup does not support article editing"))
8649 (unless (<= (length gnus-newsgroup-processable) 1)
8650 (error "No more than one article may be marked"))
8651 (save-window-excursion
8652 (let ((gnus-article-buffer " *reparent*")
8653 (current-article (gnus-summary-article-number))
8654 ;; First grab the marked article, otherwise one line up.
8655 (parent-article (if (not (null gnus-newsgroup-processable))
8656 (car gnus-newsgroup-processable)
8658 (if (eq (forward-line -1) 0)
8659 (gnus-summary-article-number)
8660 (error "Beginning of summary buffer"))))))
8661 (unless (not (eq current-article parent-article))
8662 (error "An article may not be self-referential"))
8663 (let ((message-id (mail-header-id
8664 (gnus-summary-article-header parent-article))))
8665 (unless (and message-id (not (equal message-id "")))
8666 (error "No message-id in desired parent"))
8667 (gnus-with-article current-article
8668 (goto-char (point-min))
8669 (if (re-search-forward "^References: " nil t)
8671 (re-search-forward "^[^ \t]" nil t)
8674 (insert " " message-id))
8675 (insert "References: " message-id "\n")))
8676 (set-buffer gnus-summary-buffer)
8677 (gnus-summary-unmark-all-processable)
8678 (gnus-summary-update-article current-article)
8679 (gnus-summary-rethread-current)
8680 (gnus-message 3 "Article %d is now the child of article %d"
8681 current-article parent-article)))))
8683 (defun gnus-summary-toggle-threads (&optional arg)
8684 "Toggle showing conversation threads.
8685 If ARG is positive number, turn showing conversation threads on."
8687 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8688 (setq gnus-show-threads
8689 (if (null arg) (not gnus-show-threads)
8690 (> (prefix-numeric-value arg) 0)))
8691 (gnus-summary-prepare)
8692 (gnus-summary-goto-subject current)
8693 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8694 (gnus-summary-position-point)))
8696 (defun gnus-summary-show-all-threads ()
8700 (let ((buffer-read-only nil))
8701 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8702 (gnus-summary-position-point))
8704 (defun gnus-summary-show-thread ()
8705 "Show thread subtrees.
8706 Returns nil if no thread was there to be shown."
8708 (let ((buffer-read-only nil)
8710 ;; first goto end then to beg, to have point at beg after let
8711 (end (progn (end-of-line) (point)))
8712 (beg (progn (beginning-of-line) (point))))
8714 ;; Any hidden lines here?
8715 (search-forward "\r" end t)
8716 (subst-char-in-region beg end ?\^M ?\n t)
8718 (gnus-summary-position-point))))
8720 (defun gnus-summary-hide-all-threads ()
8721 "Hide all thread subtrees."
8724 (goto-char (point-min))
8725 (gnus-summary-hide-thread)
8726 (while (zerop (gnus-summary-next-thread 1 t))
8727 (gnus-summary-hide-thread)))
8728 (gnus-summary-position-point))
8730 (defun gnus-summary-hide-thread ()
8731 "Hide thread subtrees.
8732 Returns nil if no threads were there to be hidden."
8734 (let ((buffer-read-only nil)
8736 (article (gnus-summary-article-number)))
8738 ;; Go forward until either the buffer ends or the subthread
8740 (when (and (not (eobp))
8741 (or (zerop (gnus-summary-next-thread 1 t))
8742 (goto-char (point-max))))
8744 (if (and (> (point) start)
8745 (search-backward "\n" start t))
8747 (subst-char-in-region start (point) ?\n ?\^M)
8748 (gnus-summary-goto-subject article))
8751 ;;(gnus-summary-position-point)
8754 (defun gnus-summary-go-to-next-thread (&optional previous)
8755 "Go to the same level (or less) next thread.
8756 If PREVIOUS is non-nil, go to previous thread instead.
8757 Return the article number moved to, or nil if moving was impossible."
8758 (let ((level (gnus-summary-thread-level))
8759 (way (if previous -1 1))
8762 (while (and (not (eobp))
8763 (< level (gnus-summary-thread-level)))
8771 (gnus-summary-article-number)
8774 (defun gnus-summary-next-thread (n &optional silent)
8775 "Go to the same level next N'th thread.
8776 If N is negative, search backward instead.
8777 Returns the difference between N and the number of skips actually
8780 If SILENT, don't output messages."
8782 (let ((backward (< n 0))
8785 (gnus-summary-go-to-next-thread backward))
8788 (gnus-summary-position-point))
8789 (when (and (not silent) (/= 0 n))
8790 (gnus-message 7 "No more threads"))
8793 (defun gnus-summary-prev-thread (n)
8794 "Go to the same level previous N'th thread.
8795 Returns the difference between N and the number of skips actually
8798 (gnus-summary-next-thread (- n)))
8800 (defun gnus-summary-go-down-thread ()
8801 "Go down one level in the current thread."
8802 (let ((children (gnus-summary-article-children)))
8804 (gnus-summary-goto-subject (car children)))))
8806 (defun gnus-summary-go-up-thread ()
8807 "Go up one level in the current thread."
8808 (let ((parent (gnus-summary-article-parent)))
8810 (gnus-summary-goto-subject parent))))
8812 (defun gnus-summary-down-thread (n)
8813 "Go down thread N steps.
8814 If N is negative, go up instead.
8815 Returns the difference between N and how many steps down that were
8821 (if up (gnus-summary-go-up-thread)
8822 (gnus-summary-go-down-thread)))
8824 (gnus-summary-position-point)
8826 (gnus-message 7 "Can't go further"))
8829 (defun gnus-summary-up-thread (n)
8830 "Go up thread N steps.
8831 If N is negative, go up instead.
8832 Returns the difference between N and how many steps down that were
8835 (gnus-summary-down-thread (- n)))
8837 (defun gnus-summary-top-thread ()
8838 "Go to the top of the thread."
8840 (while (gnus-summary-go-up-thread))
8841 (gnus-summary-article-number))
8843 (defun gnus-summary-kill-thread (&optional unmark)
8844 "Mark articles under current thread as read.
8845 If the prefix argument is positive, remove any kinds of marks.
8846 If the prefix argument is negative, tick articles instead."
8849 (setq unmark (prefix-numeric-value unmark)))
8850 (let ((articles (gnus-summary-articles-in-thread)))
8852 ;; Expand the thread.
8853 (gnus-summary-show-thread)
8854 ;; Mark all the articles.
8856 (gnus-summary-goto-subject (car articles))
8857 (cond ((null unmark)
8858 (gnus-summary-mark-article-as-read gnus-killed-mark))
8860 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8862 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8863 (setq articles (cdr articles))))
8864 ;; Hide killed subtrees.
8866 gnus-thread-hide-killed
8867 (gnus-summary-hide-thread))
8868 ;; If marked as read, go to next unread subject.
8870 ;; Go to next unread subject.
8871 (gnus-summary-next-subject 1 t)))
8872 (gnus-set-mode-line 'summary))
8874 ;; Summary sorting commands
8876 (defun gnus-summary-sort-by-number (&optional reverse)
8877 "Sort the summary buffer by article number.
8878 Argument REVERSE means reverse order."
8880 (gnus-summary-sort 'number reverse))
8882 (defun gnus-summary-sort-by-author (&optional reverse)
8883 "Sort the summary buffer by author name alphabetically.
8884 If case-fold-search is non-nil, case of letters is ignored.
8885 Argument REVERSE means reverse order."
8887 (gnus-summary-sort 'author reverse))
8889 (defun gnus-summary-sort-by-subject (&optional reverse)
8890 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8891 If case-fold-search is non-nil, case of letters is ignored.
8892 Argument REVERSE means reverse order."
8894 (gnus-summary-sort 'subject reverse))
8896 (defun gnus-summary-sort-by-date (&optional reverse)
8897 "Sort the summary buffer by date.
8898 Argument REVERSE means reverse order."
8900 (gnus-summary-sort 'date reverse))
8902 (defun gnus-summary-sort-by-score (&optional reverse)
8903 "Sort the summary buffer by score.
8904 Argument REVERSE means reverse order."
8906 (gnus-summary-sort 'score reverse))
8908 (defun gnus-summary-sort-by-lines (&optional reverse)
8909 "Sort the summary buffer by the number of lines.
8910 Argument REVERSE means reverse order."
8912 (gnus-summary-sort 'lines reverse))
8914 (defun gnus-summary-sort-by-chars (&optional reverse)
8915 "Sort the summary buffer by article length.
8916 Argument REVERSE means reverse order."
8918 (gnus-summary-sort 'chars reverse))
8920 (defun gnus-summary-sort (predicate reverse)
8921 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8922 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8923 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8924 (gnus-thread-sort-functions
8929 (gnus-article-sort-functions
8935 (gnus-summary-prepare-hook nil))
8936 ;; We do the sorting by regenerating the threads.
8937 (gnus-summary-prepare)
8938 ;; Hide subthreads if needed.
8939 (when (and gnus-show-threads gnus-thread-hide-subtree)
8940 (gnus-summary-hide-all-threads))))
8942 ;; Summary saving commands.
8944 (defun gnus-summary-save-article (&optional n not-saved)
8945 "Save the current article using the default saver function.
8946 If N is a positive number, save the N next articles.
8947 If N is a negative number, save the N previous articles.
8948 If N is nil and any articles have been marked with the process mark,
8949 save those articles instead.
8950 The variable `gnus-default-article-saver' specifies the saver function."
8952 (let* ((articles (gnus-summary-work-articles n))
8953 (save-buffer (save-excursion
8954 (nnheader-set-temp-buffer " *Gnus Save*")))
8955 (num (length articles))
8957 (dolist (article articles)
8958 (setq header (gnus-summary-article-header article))
8959 (if (not (vectorp header))
8960 ;; This is a pseudo-article.
8961 (if (assq 'name header)
8962 (gnus-copy-file (cdr (assq 'name header)))
8963 (gnus-message 1 "Article %d is unsaveable" article))
8964 ;; This is a real article.
8965 (save-window-excursion
8966 (gnus-summary-select-article t nil nil article))
8968 (set-buffer save-buffer)
8970 (insert-buffer-substring gnus-original-article-buffer))
8971 (setq file (gnus-article-save save-buffer file num))
8972 (gnus-summary-remove-process-mark article)
8974 (gnus-summary-set-saved-mark article))))
8975 (gnus-kill-buffer save-buffer)
8976 (gnus-summary-position-point)
8977 (gnus-set-mode-line 'summary)
8980 (defun gnus-summary-pipe-output (&optional arg)
8981 "Pipe the current article to a subprocess.
8982 If N is a positive number, pipe the N next articles.
8983 If N is a negative number, pipe the N previous articles.
8984 If N is nil and any articles have been marked with the process mark,
8985 pipe those articles instead."
8987 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8988 (gnus-summary-save-article arg t))
8989 (gnus-configure-windows 'pipe))
8991 (defun gnus-summary-save-article-mail (&optional arg)
8992 "Append the current article to an mail file.
8993 If N is a positive number, save the N next articles.
8994 If N is a negative number, save the N previous articles.
8995 If N is nil and any articles have been marked with the process mark,
8996 save those articles instead."
8998 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8999 (gnus-summary-save-article arg)))
9001 (defun gnus-summary-save-article-rmail (&optional arg)
9002 "Append the current article to an rmail file.
9003 If N is a positive number, save the N next articles.
9004 If N is a negative number, save the N previous articles.
9005 If N is nil and any articles have been marked with the process mark,
9006 save those articles instead."
9008 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
9009 (gnus-summary-save-article arg)))
9011 (defun gnus-summary-save-article-file (&optional arg)
9012 "Append the current article to a file.
9013 If N is a positive number, save the N next articles.
9014 If N is a negative number, save the N previous articles.
9015 If N is nil and any articles have been marked with the process mark,
9016 save those articles instead."
9018 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
9019 (gnus-summary-save-article arg)))
9021 (defun gnus-summary-write-article-file (&optional arg)
9022 "Write the current article to a file, deleting the previous file.
9023 If N is a positive number, save the N next articles.
9024 If N is a negative number, save the N previous articles.
9025 If N is nil and any articles have been marked with the process mark,
9026 save those articles instead."
9028 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
9029 (gnus-summary-save-article arg)))
9031 (defun gnus-summary-save-article-body-file (&optional arg)
9032 "Append the current article body to a file.
9033 If N is a positive number, save the N next articles.
9034 If N is a negative number, save the N previous articles.
9035 If N is nil and any articles have been marked with the process mark,
9036 save those articles instead."
9038 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
9039 (gnus-summary-save-article arg)))
9041 (defun gnus-summary-pipe-message (program)
9042 "Pipe the current article through PROGRAM."
9043 (interactive "sProgram: ")
9044 (gnus-summary-select-article)
9045 (let ((mail-header-separator ""))
9046 (gnus-eval-in-buffer-window gnus-article-buffer
9049 (let ((start (window-start))
9051 (message-pipe-buffer-body program)
9052 (set-window-start (get-buffer-window (current-buffer)) start))))))
9054 (defun gnus-get-split-value (methods)
9055 "Return a value based on the split METHODS."
9056 (let (split-name method result match)
9059 (set-buffer gnus-original-article-buffer)
9061 (nnheader-narrow-to-headers)
9063 (goto-char (point-min))
9064 (setq method (pop methods))
9065 (setq match (car method))
9068 ;; Regular expression.
9070 (re-search-forward match nil t)))
9071 ((gnus-functionp match)
9075 (setq result (funcall match gnus-newsgroup-name))))
9080 (setq result (eval match)))))
9081 (setq split-name (append (cdr method) split-name))
9082 (cond ((stringp result)
9083 (push (expand-file-name
9084 result gnus-article-save-directory)
9087 (setq split-name (append result split-name)))))))))
9088 (nreverse split-name)))
9090 (defun gnus-valid-move-group-p (group)
9093 (symbol-value group)
9094 (gnus-get-function (gnus-find-method-for-group
9095 (symbol-name group)) 'request-accept-article t)))
9097 (defun gnus-read-move-group-name (prompt default articles prefix)
9098 "Read a group name."
9099 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
9100 (minibuffer-confirm-incomplete nil) ; XEmacs
9104 (if (> (length articles) 1)
9105 (format "these %d articles" (length articles))
9110 (gnus-completing-read default prom
9112 'gnus-valid-move-group-p
9114 'gnus-group-history))
9115 ((= 1 (length split-name))
9116 (gnus-completing-read (car split-name) prom
9118 'gnus-valid-move-group-p
9120 'gnus-group-history))
9122 (gnus-completing-read nil prom
9123 (mapcar (lambda (el) (list el))
9124 (nreverse split-name))
9126 'gnus-group-history)))))
9128 (if (or (string= to-newsgroup "")
9129 (string= to-newsgroup prefix))
9130 (setq to-newsgroup default))
9131 (unless to-newsgroup
9132 (error "No group name entered"))
9133 (or (gnus-active to-newsgroup)
9134 (gnus-activate-group to-newsgroup)
9135 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9137 (or (and (gnus-request-create-group
9138 to-newsgroup (gnus-group-name-to-method to-newsgroup))
9139 (gnus-activate-group to-newsgroup nil nil
9140 (gnus-group-name-to-method
9142 (error "Couldn't create group %s" to-newsgroup)))
9143 (error "No such group: %s" to-newsgroup)))
9146 (defun gnus-summary-save-parts (type dir n reverse)
9147 "Save parts matching TYPE to DIR.
9148 If REVERSE, save parts that do not match TYPE."
9150 (list (read-string "Save parts of type: " "image/.*")
9151 (read-file-name "Save to directory: " t nil t)
9152 current-prefix-arg))
9153 (gnus-summary-iterate n
9154 (let ((gnus-display-mime-function nil)
9155 (gnus-inhibit-treatment t))
9156 (gnus-summary-select-article))
9158 (set-buffer gnus-article-buffer)
9159 (let ((handles (or (mm-dissect-buffer) (mm-uu-dissect))))
9161 (gnus-summary-save-parts-1 type dir handles reverse)
9162 (mm-destroy-parts handles))))))
9164 (defun gnus-summary-save-parts-1 (type dir handle reverse)
9165 (if (stringp (car handle))
9166 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
9169 (not (string-match type (mm-handle-media-type handle)))
9170 (string-match type (mm-handle-media-type handle)))
9171 (let ((file (expand-file-name
9172 (file-name-nondirectory
9174 (mail-content-type-get
9175 (mm-handle-disposition handle) 'filename)
9176 (concat gnus-newsgroup-name "." gnus-current-article)))
9178 (unless (file-exists-p file)
9179 (mm-save-part-to-file handle file))))))
9181 ;; Summary extract commands
9183 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
9184 (let ((buffer-read-only nil)
9185 (article (gnus-summary-article-number))
9187 (unless (gnus-summary-goto-subject article)
9188 (error "No such article: %d" article))
9189 (gnus-summary-position-point)
9190 ;; If all commands are to be bunched up on one line, we collect
9192 (unless gnus-view-pseudos-separately
9193 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
9196 (setq action (cdr (assq 'action (car ps))))
9197 (setq files (list (cdr (assq 'name (car ps)))))
9198 (while (and ps (cdr ps)
9199 (string= (or action "1")
9200 (or (cdr (assq 'action (cadr ps))) "2")))
9201 (push (cdr (assq 'name (cadr ps))) files)
9202 (setcdr ps (cddr ps)))
9204 (when (not (string-match "%s" action))
9207 (when (assq 'execute (car ps))
9208 (setcdr (assq 'execute (car ps))
9209 (funcall (if (string-match "%s" action)
9216 (gnus-quote-arg-for-sh-or-csh f)))
9218 (setq ps (cdr ps)))))
9219 (if (and gnus-view-pseudos (not not-view))
9221 (when (assq 'execute (car pslist))
9222 (gnus-execute-command (cdr (assq 'execute (car pslist)))
9223 (eq gnus-view-pseudos 'not-confirm)))
9224 (setq pslist (cdr pslist)))
9227 (setq after-article (or (cdr (assq 'article (car pslist)))
9228 (gnus-summary-article-number)))
9229 (gnus-summary-goto-subject after-article)
9232 (insert " " (file-name-nondirectory
9233 (cdr (assq 'name (car pslist))))
9234 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
9236 (forward-line -1) ; back to `b'
9237 (gnus-add-text-properties
9238 b (1- e) (list 'gnus-number gnus-reffed-article-number
9239 gnus-mouse-face-prop gnus-mouse-face))
9241 after-article gnus-reffed-article-number
9242 gnus-unread-mark b (car pslist) 0 (- e b))
9243 (push gnus-reffed-article-number gnus-newsgroup-unreads)
9244 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
9245 (setq pslist (cdr pslist)))))))
9247 (defun gnus-pseudos< (p1 p2)
9248 (let ((c1 (cdr (assq 'action p1)))
9249 (c2 (cdr (assq 'action p2))))
9250 (and c1 c2 (string< c1 c2))))
9252 (defun gnus-request-pseudo-article (props)
9253 (cond ((assq 'execute props)
9254 (gnus-execute-command (cdr (assq 'execute props)))))
9255 (let ((gnus-current-article (gnus-summary-article-number)))
9256 (gnus-run-hooks 'gnus-mark-article-hook)))
9258 (defun gnus-execute-command (command &optional automatic)
9260 (gnus-article-setup-buffer)
9261 (set-buffer gnus-article-buffer)
9262 (setq buffer-read-only nil)
9263 (let ((command (if automatic command
9264 (read-string "Command: " (cons command 0)))))
9266 (insert "$ " command "\n\n")
9267 (if gnus-view-pseudo-asynchronously
9268 (start-process "gnus-execute" (current-buffer) shell-file-name
9269 shell-command-switch command)
9270 (call-process shell-file-name nil t nil
9271 shell-command-switch command)))))
9273 ;; Summary kill commands.
9275 (defun gnus-summary-edit-global-kill (article)
9276 "Edit the \"global\" kill file."
9277 (interactive (list (gnus-summary-article-number)))
9278 (gnus-group-edit-global-kill article))
9280 (defun gnus-summary-edit-local-kill ()
9281 "Edit a local kill file applied to the current newsgroup."
9283 (setq gnus-current-headers (gnus-summary-article-header))
9284 (gnus-group-edit-local-kill
9285 (gnus-summary-article-number) gnus-newsgroup-name))
9289 (defun gnus-read-header (id &optional header)
9290 "Read the headers of article ID and enter them into the Gnus system."
9291 (let ((group gnus-newsgroup-name)
9292 (gnus-override-method
9293 (and (gnus-news-group-p gnus-newsgroup-name)
9294 gnus-refer-article-method))
9296 ;; First we check to see whether the header in question is already
9299 ;; This is a Message-ID.
9300 (setq header (or header (gnus-id-to-header id)))
9301 ;; This is an article number.
9302 (setq header (or header (gnus-summary-article-header id))))
9304 (not (gnus-summary-article-sparse-p (mail-header-number header))))
9305 ;; We have found the header.
9307 ;; If this is a sparse article, we have to nix out its
9308 ;; previous entry in the thread hashtb.
9310 (gnus-summary-article-sparse-p (mail-header-number header)))
9311 (let* ((parent (gnus-parent-id (mail-header-references header)))
9312 (thread (and parent (gnus-id-to-thread parent))))
9314 (delq (assq header thread) thread))))
9315 ;; We have to really fetch the header to this article.
9317 (set-buffer nntp-server-buffer)
9318 (when (setq where (gnus-request-head id group))
9319 (nnheader-fold-continuation-lines)
9320 (goto-char (point-max))
9322 (goto-char (point-min))
9326 ((cdr where) (cdr where))
9327 (header (mail-header-number header))
9328 (t gnus-reffed-article-number))
9330 (insert " Article retrieved.\n"))
9332 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
9333 () ; Malformed head.
9334 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9335 (when (and (stringp id)
9336 (not (string= (gnus-group-real-name group)
9338 ;; If we fetched by Message-ID and the article came
9339 ;; from a different group, we fudge some bogus article
9340 ;; numbers for this article.
9341 (mail-header-set-number header gnus-reffed-article-number))
9343 (set-buffer gnus-summary-buffer)
9344 (decf gnus-reffed-article-number)
9345 (gnus-remove-header (mail-header-number header))
9346 (push header gnus-newsgroup-headers)
9347 (setq gnus-current-headers header)
9348 (push (mail-header-number header) gnus-newsgroup-limit)))
9351 (defun gnus-remove-header (number)
9352 "Remove header NUMBER from `gnus-newsgroup-headers'."
9353 (if (and gnus-newsgroup-headers
9354 (= number (mail-header-number (car gnus-newsgroup-headers))))
9355 (pop gnus-newsgroup-headers)
9356 (let ((headers gnus-newsgroup-headers))
9357 (while (and (cdr headers)
9358 (not (= number (mail-header-number (cadr headers)))))
9361 (setcdr headers (cddr headers))))))
9364 ;;; summary highlights
9367 (defun gnus-highlight-selected-summary ()
9368 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9369 ;; Highlight selected article in summary buffer
9370 (when gnus-summary-selected-face
9372 (let* ((beg (progn (beginning-of-line) (point)))
9373 (end (progn (end-of-line) (point)))
9374 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9375 (from (if (get-text-property beg gnus-mouse-face-prop)
9377 (or (next-single-property-change
9378 beg gnus-mouse-face-prop nil end)
9383 (or (next-single-property-change
9384 from gnus-mouse-face-prop nil end)
9386 ;; If no mouse-face prop on line we will have to = from = end,
9387 ;; so we highlight the entire line instead.
9388 (when (= (+ to 2) from)
9391 (if gnus-newsgroup-selected-overlay
9392 ;; Move old overlay.
9394 gnus-newsgroup-selected-overlay from to (current-buffer))
9395 ;; Create new overlay.
9397 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9398 'face gnus-summary-selected-face))))))
9400 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9401 (defun gnus-summary-highlight-line ()
9402 "Highlight current line according to `gnus-summary-highlight'."
9403 (let* ((list gnus-summary-highlight)
9405 (end (progn (end-of-line) (point)))
9406 ;; now find out where the line starts and leave point there.
9407 (beg (progn (beginning-of-line) (point)))
9408 (article (gnus-summary-article-number))
9409 (score (or (cdr (assq (or article gnus-current-article)
9410 gnus-newsgroup-scored))
9411 gnus-summary-default-score 0))
9412 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9413 (inhibit-read-only t))
9414 ;; Eval the cars of the lists until we find a match.
9415 (let ((default gnus-summary-default-score))
9417 (not (eval (caar list))))
9418 (setq list (cdr list))))
9419 (let ((face (cdar list)))
9420 (unless (eq face (get-text-property beg 'face))
9421 (gnus-put-text-property-excluding-characters-with-faces
9423 (setq face (if (boundp face) (symbol-value face) face)))
9424 (when gnus-summary-highlight-line-function
9425 (funcall gnus-summary-highlight-line-function article face))))
9428 (defun gnus-update-read-articles (group unread &optional compute)
9429 "Update the list of read articles in GROUP."
9430 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9431 (entry (gnus-gethash group gnus-newsrc-hashtb))
9432 (info (nth 2 entry))
9434 (unread (sort (copy-sequence unread) '<))
9436 (if (or (not info) (not active))
9437 ;; There is no info on this group if it was, in fact,
9438 ;; killed. Gnus stores no information on killed groups, so
9439 ;; there's nothing to be done.
9440 ;; One could store the information somewhere temporarily,
9441 ;; perhaps... Hmmm...
9443 ;; Remove any negative articles numbers.
9444 (while (and unread (< (car unread) 0))
9445 (setq unread (cdr unread)))
9446 ;; Remove any expired article numbers
9447 (while (and unread (< (car unread) (car active)))
9448 (setq unread (cdr unread)))
9449 ;; Compute the ranges of read articles by looking at the list of
9452 (when (/= (car unread) prev)
9453 (push (if (= prev (1- (car unread))) prev
9454 (cons prev (1- (car unread))))
9456 (setq prev (1+ (car unread)))
9457 (setq unread (cdr unread)))
9458 (when (<= prev (cdr active))
9459 (push (cons prev (cdr active)) read))
9460 (setq read (if (> (length read) 1) (nreverse read) read))
9464 (set-buffer gnus-group-buffer)
9467 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9468 (gnus-info-set-read ',info ',(gnus-info-read info))
9469 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9470 (gnus-group-update-group ,group t))))
9471 ;; Propagate the read marks to the backend.
9472 (if (gnus-check-backend-function 'request-set-mark group)
9473 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9474 (add (gnus-remove-from-range read (gnus-info-read info))))
9476 (unless (gnus-check-group group)
9477 (error "Can't open server for %s" group))
9478 (gnus-request-set-mark
9479 group (delq nil (list (if add (list add 'add '(read)))
9480 (if del (list del 'del '(read)))))))))
9481 ;; Enter this list into the group info.
9482 (gnus-info-set-read info read)
9483 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9484 (gnus-get-unread-articles-in-group info (gnus-active group))
9487 (defun gnus-offer-save-summaries ()
9488 "Offer to save all active summary buffers."
9490 (let ((buflist (buffer-list))
9492 ;; Go through all buffers and find all summaries.
9494 (and (setq bufname (buffer-name (car buflist)))
9495 (string-match "Summary" bufname)
9497 (set-buffer bufname)
9498 ;; We check that this is, indeed, a summary buffer.
9499 (and (eq major-mode 'gnus-summary-mode)
9500 ;; Also make sure this isn't bogus.
9501 gnus-newsgroup-prepared
9502 ;; Also make sure that this isn't a dead summary buffer.
9503 (not gnus-dead-summary-mode)))
9504 (push bufname buffers))
9505 (setq buflist (cdr buflist)))
9506 ;; Go through all these summary buffers and offer to save them.
9509 "Update summary buffer %s? "
9511 (switch-to-buffer buf)
9512 (gnus-summary-exit))
9516 ;;; @ for mime-partial
9519 (defun gnus-request-partial-message ()
9521 (let ((number (gnus-summary-article-number))
9522 (group gnus-newsgroup-name)
9523 (mother gnus-article-buffer))
9524 (set-buffer (get-buffer-create " *Partial Article*"))
9526 (setq mime-preview-buffer mother)
9527 (gnus-request-article-this-buffer number group)
9531 (autoload 'mime-combine-message/partial-pieces-automatically
9533 "Internal method to combine message/partial messages automatically.")
9536 'action '((type . message)(subtype . partial)
9537 (major-mode . gnus-original-article-mode)
9538 (method . mime-combine-message/partial-pieces-automatically)
9539 (summary-buffer-exp . gnus-summary-buffer)
9540 (request-partial-message-method . gnus-request-partial-message)
9544 ;;; @ for message/rfc822
9547 (defun gnus-mime-extract-message/rfc822 (entity situation)
9548 (let (group article num cwin swin cur)
9549 (with-current-buffer (mime-entity-buffer entity)
9551 (narrow-to-region (mime-entity-body-start entity)
9552 (mime-entity-body-end entity))
9553 (setq group (or (cdr (assq 'group situation))
9554 (completing-read "Group: "
9557 (gnus-read-active-file-p)
9558 gnus-newsgroup-name))
9559 article (gnus-request-accept-article group)
9562 (when (and (consp article)
9563 (numberp (setq article (cdr article))))
9564 (setq num (1+ (or (cdr (assq 'number situation)) 0))
9565 cwin (get-buffer-window (current-buffer) t)
9567 (save-window-excursion
9568 (if (setq swin (get-buffer-window gnus-summary-buffer t))
9569 (select-window swin)
9570 (set-buffer gnus-summary-buffer)
9572 (setq cur gnus-current-article)
9574 (let (gnus-show-threads)
9575 (gnus-summary-goto-subject article t)
9577 (gnus-summary-clear-mark-forward 1)
9578 (gnus-summary-goto-subject cur)
9580 (when (and cwin (window-frame cwin))
9581 (select-frame (window-frame cwin))
9583 (when (boundp 'mime-acting-situation-to-override)
9584 (set-alist 'mime-acting-situation-to-override
9587 (set-alist 'mime-acting-situation-to-override
9590 (save-current-buffer
9591 (set-buffer gnus-group-buffer)
9592 (gnus-activate-group ,group)
9594 (gnus-summary-goto-article ,cur
9595 gnus-show-all-headers)
9597 (set-alist 'mime-acting-situation-to-override
9603 'action '((type . message)(subtype . rfc822)
9604 (major-mode . gnus-original-article-mode)
9605 (method . gnus-mime-extract-message/rfc822)
9610 'action '((type . message)(subtype . news)
9611 (major-mode . gnus-original-article-mode)
9612 (method . gnus-mime-extract-message/rfc822)
9616 (defun gnus-mime-extract-multipart (entity situation)
9617 (let ((children (mime-entity-children entity))
9618 mime-acting-situation-to-override
9621 (mime-play-entity (car children)
9622 (cons (assq 'mode situation)
9623 mime-acting-situation-to-override))
9624 (setq children (cdr children)))
9625 (if (setq f (cdr (assq 'after-method
9626 mime-acting-situation-to-override)))
9631 'action '((type . multipart)
9632 (method . gnus-mime-extract-multipart)
9641 (defun gnus-summary-setup-default-charset ()
9642 "Setup newsgroup default charset."
9643 (if (equal gnus-newsgroup-name "nndraft:drafts")
9644 (setq gnus-newsgroup-charset nil)
9645 (let* ((name (and gnus-newsgroup-name
9646 (gnus-group-real-name gnus-newsgroup-name)))
9648 (or gnus-newsgroup-ephemeral-ignored-charsets
9650 (and gnus-newsgroup-name
9651 (or (gnus-group-find-parameter gnus-newsgroup-name
9652 'ignored-charsets t)
9653 (let ((alist gnus-group-ignored-charsets-alist)
9654 elem (charsets nil))
9655 (while (setq elem (pop alist))
9657 (string-match (car elem) name))
9659 charsets (cdr elem))))
9661 gnus-newsgroup-ignored-charsets)))
9662 (setq gnus-newsgroup-charset
9663 (or gnus-newsgroup-ephemeral-charset
9664 (and gnus-newsgroup-name
9665 (or (gnus-group-find-parameter gnus-newsgroup-name
9667 (let ((alist gnus-group-charset-alist)
9669 (while (setq elem (pop alist))
9671 (string-match (car elem) name))
9673 charset (cadr elem))))
9675 gnus-default-charset))
9676 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
9677 ignored-charsets))))
9683 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9684 "Display the current article buffer fully MIME-buttonized.
9685 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9686 treated as multipart/mixed."
9689 (let ((gnus-unbuttonized-mime-types nil)
9690 (gnus-mime-display-multipart-as-mixed show-all-parts))
9691 (gnus-summary-show-article)))
9693 (defun gnus-summary-repair-multipart (article)
9694 "Add a Content-Type header to a multipart article without one."
9695 (interactive (list (gnus-summary-article-number)))
9696 (gnus-with-article article
9697 (message-narrow-to-head)
9698 (goto-char (point-max))
9700 (when (search-forward "\n--" nil t)
9701 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9702 (message-narrow-to-head)
9703 (message-remove-header "Mime-Version")
9704 (message-remove-header "Content-Type")
9705 (goto-char (point-max))
9706 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9708 (insert "Mime-Version: 1.0\n")
9710 (let (gnus-mark-article-hook)
9711 (gnus-summary-select-article t t nil article)))
9713 (defun gnus-summary-toggle-display-buttonized ()
9714 "Toggle the buttonizing of the article buffer."
9717 (if (setq gnus-inhibit-mime-unbuttonizing
9718 (not gnus-inhibit-mime-unbuttonizing))
9719 (let ((gnus-unbuttonized-mime-types nil))
9720 (gnus-summary-show-article))
9721 (gnus-summary-show-article)))
9724 ;;; Intelli-mouse commmands
9727 (defun gnus-wheel-summary-scroll (event)
9729 (let ((amount (if (memq 'shift (event-modifiers event))
9730 (car gnus-wheel-scroll-amount)
9731 (cdr gnus-wheel-scroll-amount)))
9732 (direction (- (* (static-if (featurep 'xemacs)
9733 (event-button event)
9734 (cond ((eq 'mouse-4 (event-basic-type event))
9736 ((eq 'mouse-5 (event-basic-type event))
9740 (gnus-summary-scroll-up (* amount direction))
9741 (when (gnus-eval-in-buffer-window gnus-article-buffer
9744 (and (if (< 0 direction)
9745 (gnus-article-next-page 0)
9746 (gnus-article-prev-page 0)
9748 (if (setq edge (get-text-property
9749 (point-min) 'gnus-wheel-edge))
9750 (setq edge (* edge direction))
9753 (let ((buffer-read-only nil)
9754 (inhibit-read-only t))
9755 (put-text-property (point-min) (point-max)
9756 'gnus-wheel-edge direction)
9758 (or (> edge gnus-wheel-edge-resistance)
9759 (let ((buffer-read-only nil)
9760 (inhibit-read-only t))
9761 (put-text-property (point-min) (point-max)
9763 (* (1+ edge) direction))
9765 (eq last-command 'gnus-wheel-summary-scroll))
9767 (gnus-summary-next-article nil nil (minusp direction)))
9770 (defun gnus-wheel-install ()
9771 "Enable mouse wheel support on summary window."
9772 (when gnus-use-wheel
9774 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
9776 (define-key gnus-summary-mode-map key
9777 'gnus-wheel-summary-scroll)))))
9779 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
9785 (defmacro gnus-with-article (article &rest forms)
9786 "Select ARTICLE and perform FORMS in the original article buffer.
9787 Then replace the article with the result."
9789 ;; We don't want the article to be marked as read.
9790 (let (gnus-mark-article-hook)
9791 (gnus-summary-select-article t t nil ,article))
9792 (set-buffer gnus-original-article-buffer)
9794 (if (not (gnus-check-backend-function
9795 'request-replace-article (car gnus-article-current)))
9796 (gnus-message 5 "Read-only group; not replacing")
9797 (unless (gnus-request-replace-article
9798 ,article (car gnus-article-current)
9800 (error "Couldn't replace article")))
9801 ;; The cache and backlog have to be flushed somewhat.
9802 (when gnus-keep-backlog
9803 (gnus-backlog-remove-article
9804 (car gnus-article-current) (cdr gnus-article-current)))
9805 (when gnus-use-cache
9806 (gnus-cache-update-article
9807 (car gnus-article-current) (cdr gnus-article-current)))))
9809 (put 'gnus-with-article 'lisp-indent-function 1)
9810 (put 'gnus-with-article 'edebug-form-spec '(form body))
9813 ;;; Generic summary marking commands
9816 (defvar gnus-summary-marking-alist
9817 '((read gnus-del-mark "d")
9818 (unread gnus-unread-mark "u")
9819 (ticked gnus-ticked-mark "!")
9820 (dormant gnus-dormant-mark "?")
9821 (expirable gnus-expirable-mark "e"))
9822 "An alist of names/marks/keystrokes.")
9824 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
9825 (defvar gnus-summary-mark-map)
9827 (defun gnus-summary-make-all-marking-commands ()
9828 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
9829 (dolist (elem gnus-summary-marking-alist)
9830 (apply 'gnus-summary-make-marking-command elem)))
9832 (defun gnus-summary-make-marking-command (name mark keystroke)
9833 (let ((map (make-sparse-keymap)))
9834 (define-key gnus-summary-generic-mark-map keystroke map)
9835 (dolist (lway `((next "next" next nil "n")
9836 (next-unread "next unread" next t "N")
9837 (prev "previous" prev nil "p")
9838 (prev-unread "previous unread" prev t "P")
9839 (nomove "" nil nil ,keystroke)))
9840 (let ((func (gnus-summary-make-marking-command-1
9841 mark (car lway) lway name)))
9842 (setq func (eval func))
9843 (define-key map (nth 4 lway) func)))))
9845 (defun gnus-summary-make-marking-command-1 (mark way lway name)
9847 (format "gnus-summary-put-mark-as-%s%s"
9848 name (if (eq way 'nomove)
9850 (concat "-" (symbol-name way)))))
9853 "Mark the current article as %s%s.
9854 If N, the prefix, then repeat N times.
9855 If N is negative, move in reverse order.
9856 The difference between N and the actual number of articles marked is
9860 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
9862 (defun gnus-summary-generic-mark (n mark move unread)
9863 "Mark N articles with MARK."
9864 (unless (eq major-mode 'gnus-summary-mode)
9865 (error "This command can only be used in the summary buffer"))
9866 (gnus-summary-show-thread)
9870 ((eq move 'prev) -1)
9876 nummove (* -1 nummove))))
9878 (gnus-summary-mark-article nil mark)
9879 (zerop (gnus-summary-next-subject nummove unread t)))
9882 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9883 (gnus-summary-recenter)
9884 (gnus-summary-position-point)
9885 (gnus-set-mode-line 'summary)
9888 (gnus-summary-make-all-marking-commands)
9894 (run-hooks 'gnus-sum-load-hook)
9896 ;;; gnus-sum.el ends here