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))
45 (autoload 'gnus-cache-articles-in-group "gnus-cache"))
47 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
48 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
50 (defcustom gnus-kill-summary-on-exit t
51 "*If non-nil, kill the summary buffer when you exit from it.
52 If nil, the summary will become a \"*Dead Summary*\" buffer, and
53 it will be killed sometime later."
54 :group 'gnus-summary-exit
57 (defcustom gnus-fetch-old-headers nil
58 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
59 If an unread article in the group refers to an older, already read (or
60 just marked as read) article, the old article will not normally be
61 displayed in the Summary buffer. If this variable is non-nil, Gnus
62 will attempt to grab the headers to the old articles, and thereby
63 build complete threads. If it has the value `some', only enough
64 headers to connect otherwise loose threads will be displayed. This
65 variable can also be a number. In that case, no more than that number
66 of old headers will be fetched. If it has the value `invisible', all
67 old headers will be fetched, but none will be displayed.
69 The server has to support NOV for any of this to work."
71 :type '(choice (const :tag "off" nil)
74 (sexp :menu-tag "other" t)))
76 (defcustom gnus-refer-thread-limit 200
77 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
78 If t, fetch all the available old headers."
81 (sexp :menu-tag "other" t)))
83 (defcustom gnus-summary-make-false-root 'adopt
84 "*nil means that Gnus won't gather loose threads.
85 If the root of a thread has expired or been read in a previous
86 session, the information necessary to build a complete thread has been
87 lost. Instead of having many small sub-threads from this original thread
88 scattered all over the summary buffer, Gnus can gather them.
90 If non-nil, Gnus will try to gather all loose sub-threads from an
91 original thread into one large thread.
93 If this variable is non-nil, it should be one of `none', `adopt',
96 If this variable is `none', Gnus will not make a false root, but just
97 present the sub-threads after another.
98 If this variable is `dummy', Gnus will create a dummy root that will
99 have all the sub-threads as children.
100 If this variable is `adopt', Gnus will make one of the \"children\"
101 the parent and mark all the step-children as such.
102 If this variable is `empty', the \"children\" are printed with empty
103 subject fields. (Or rather, they will be printed with a string
104 given by the `gnus-summary-same-subject' variable.)"
106 :type '(choice (const :tag "off" nil)
112 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
113 "*A regexp to match subjects to be excluded from loose thread gathering.
114 As loose thread gathering is done on subjects only, that means that
115 there can be many false gatherings performed. By rooting out certain
116 common subjects, gathering might become saner."
120 (defcustom gnus-summary-gather-subject-limit nil
121 "*Maximum length of subject comparisons when gathering loose threads.
122 Use nil to compare full subjects. Setting this variable to a low
123 number will help gather threads that have been corrupted by
124 newsreaders chopping off subject lines, but it might also mean that
125 unrelated articles that have subject that happen to begin with the
126 same few characters will be incorrectly gathered.
128 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
131 :type '(choice (const :tag "off" nil)
133 (sexp :menu-tag "on" t)))
135 (defcustom gnus-simplify-subject-functions nil
136 "List of functions taking a string argument that simplify subjects.
137 The functions are applied recursively.
139 Useful functions to put in this list include: `gnus-simplify-subject-re',
140 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
142 :type '(repeat function))
144 (defcustom gnus-simplify-ignored-prefixes nil
145 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
147 :type '(choice (const :tag "off" nil)
150 (defcustom gnus-build-sparse-threads nil
151 "*If non-nil, fill in the gaps in threads.
152 If `some', only fill in the gaps that are needed to tie loose threads
153 together. If `more', fill in all leaf nodes that Gnus can find. If
154 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
156 :type '(choice (const :tag "off" nil)
159 (sexp :menu-tag "all" t)))
161 (defcustom gnus-summary-thread-gathering-function
162 'gnus-gather-threads-by-subject
163 "*Function used for gathering loose threads.
164 There are two pre-defined functions: `gnus-gather-threads-by-subject',
165 which only takes Subjects into consideration; and
166 `gnus-gather-threads-by-references', which compared the References
167 headers of the articles to find matches."
169 :type '(radio (function-item gnus-gather-threads-by-subject)
170 (function-item gnus-gather-threads-by-references)
171 (function :tag "other")))
173 (defcustom gnus-summary-same-subject ""
174 "*String indicating that the current article has the same subject as the previous.
175 This variable will only be used if the value of
176 `gnus-summary-make-false-root' is `empty'."
177 :group 'gnus-summary-format
180 (defcustom gnus-summary-goto-unread t
181 "*If t, marking commands will go to the next unread article.
182 If `never', commands that usually go to the next unread article, will
183 go to the next article, whether it is read or not.
184 If nil, only the marking commands will go to the next (un)read article."
185 :group 'gnus-summary-marks
186 :link '(custom-manual "(gnus)Setting Marks")
187 :type '(choice (const :tag "off" nil)
189 (sexp :menu-tag "on" t)))
191 (defcustom gnus-summary-default-score 0
192 "*Default article score level.
193 All scores generated by the score files will be added to this score.
194 If this variable is nil, scoring will be disabled."
195 :group 'gnus-score-default
196 :type '(choice (const :tag "disable")
199 (defcustom gnus-summary-zcore-fuzz 0
200 "*Fuzziness factor for the zcore in the summary buffer.
201 Articles with scores closer than this to `gnus-summary-default-score'
203 :group 'gnus-summary-format
206 (defcustom gnus-simplify-subject-fuzzy-regexp nil
207 "*Strings to be removed when doing fuzzy matches.
208 This can either be a regular expression or list of regular expressions
209 that will be removed from subject strings if fuzzy subject
210 simplification is selected."
212 :type '(repeat regexp))
214 (defcustom gnus-show-threads t
215 "*If non-nil, display threads in summary mode."
219 (defcustom gnus-thread-hide-subtree nil
220 "*If non-nil, hide all threads initially.
221 If threads are hidden, you have to run the command
222 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
223 to expose hidden threads."
227 (defcustom gnus-thread-hide-killed t
228 "*If non-nil, hide killed threads automatically."
232 (defcustom gnus-thread-ignore-subject t
233 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
234 If nil, articles that have different subjects from their parents will
235 start separate threads."
239 (defcustom gnus-thread-operation-ignore-subject t
240 "*If non-nil, subjects will be ignored when doing thread commands.
241 This affects commands like `gnus-summary-kill-thread' and
242 `gnus-summary-lower-thread'.
244 If this variable is nil, articles in the same thread with different
245 subjects will not be included in the operation in question. If this
246 variable is `fuzzy', only articles that have subjects that are fuzzily
247 equal will be included."
249 :type '(choice (const :tag "off" nil)
253 (defcustom gnus-thread-indent-level 4
254 "*Number that says how much each sub-thread should be indented."
258 (defcustom gnus-auto-extend-newsgroup t
259 "*If non-nil, extend newsgroup forward and backward when requested."
260 :group 'gnus-summary-choose
263 (defcustom gnus-auto-select-first t
264 "*If nil, don't select the first unread article when entering a group.
265 If this variable is `best', select the highest-scored unread article
266 in the group. If t, select the first unread article.
268 This variable can also be a function to place point on a likely
269 subject line. Useful values include `gnus-summary-first-unread-subject',
270 `gnus-summary-first-unread-article' and
271 `gnus-summary-best-unread-article'.
273 If you want to prevent automatic selection of the first unread article
274 in some newsgroups, set the variable to nil in
275 `gnus-select-group-hook'."
276 :group 'gnus-group-select
277 :type '(choice (const :tag "none" nil)
279 (sexp :menu-tag "first" t)
280 (function-item gnus-summary-first-unread-subject)
281 (function-item gnus-summary-first-unread-article)
282 (function-item gnus-summary-best-unread-article)))
284 (defcustom gnus-dont-select-after-jump-to-other-group nil
285 "If non-nil, don't select the first unread article after entering the
286 other group by the command `gnus-summary-jump-to-other-group'. If nil,
287 it is depend on the value of `gnus-auto-select-first' whether to select
289 :group 'gnus-group-select
292 (defcustom gnus-auto-select-next t
293 "*If non-nil, offer to go to the next group from the end of the previous.
294 If the value is t and the next newsgroup is empty, Gnus will exit
295 summary mode and go back to group mode. If the value is neither nil
296 nor t, Gnus will select the following unread newsgroup. In
297 particular, if the value is the symbol `quietly', the next unread
298 newsgroup will be selected without any confirmation, and if it is
299 `almost-quietly', the next group will be selected without any
300 confirmation if you are located on the last article in the group.
301 Finally, if this variable is `slightly-quietly', the `Z n' command
302 will go to the next group without confirmation."
303 :group 'gnus-summary-maneuvering
304 :type '(choice (const :tag "off" nil)
306 (const almost-quietly)
307 (const slightly-quietly)
308 (sexp :menu-tag "on" t)))
310 (defcustom gnus-auto-select-same nil
311 "*If non-nil, select the next article with the same subject.
312 If there are no more articles with the same subject, go to
313 the first unread article."
314 :group 'gnus-summary-maneuvering
317 (defcustom gnus-summary-check-current nil
318 "*If non-nil, consider the current article when moving.
319 The \"unread\" movement commands will stay on the same line if the
320 current article is unread."
321 :group 'gnus-summary-maneuvering
324 (defcustom gnus-auto-center-summary t
325 "*If non-nil, always center the current summary buffer.
326 In particular, if `vertical' do only vertical recentering. If non-nil
327 and non-`vertical', do both horizontal and vertical recentering."
328 :group 'gnus-summary-maneuvering
329 :type '(choice (const :tag "none" nil)
331 (integer :tag "height")
332 (sexp :menu-tag "both" t)))
334 (defcustom gnus-show-all-headers nil
335 "*If non-nil, don't hide any headers."
336 :group 'gnus-article-hiding
337 :group 'gnus-article-headers
340 (defcustom gnus-summary-ignore-duplicates nil
341 "*If non-nil, ignore articles with identical Message-ID headers."
345 (defcustom gnus-single-article-buffer t
346 "*If non-nil, display all articles in the same buffer.
347 If nil, each group will get its own article buffer."
348 :group 'gnus-article-various
351 (defcustom gnus-break-pages t
352 "*If non-nil, do page breaking on articles.
353 The page delimiter is specified by the `gnus-page-delimiter'
355 :group 'gnus-article-various
358 (defcustom gnus-show-mime t
359 "*If non-nil, do mime processing of articles.
360 The articles will simply be fed to the function given by
361 `gnus-article-display-method-for-mime'."
362 :group 'gnus-article-mime
365 (defcustom gnus-move-split-methods nil
366 "*Variable used to suggest where articles are to be moved to.
367 It uses the same syntax as the `gnus-split-methods' variable."
368 :group 'gnus-summary-mail
369 :type '(repeat (choice (list :value (fun) function)
370 (cons :value ("" "") regexp (repeat string))
373 (defcustom gnus-unread-mark ? ;Whitespace
374 "*Mark used for unread articles."
375 :group 'gnus-summary-marks
378 (defcustom gnus-ticked-mark ?!
379 "*Mark used for ticked articles."
380 :group 'gnus-summary-marks
383 (defcustom gnus-dormant-mark ??
384 "*Mark used for dormant articles."
385 :group 'gnus-summary-marks
388 (defcustom gnus-del-mark ?r
389 "*Mark used for del'd articles."
390 :group 'gnus-summary-marks
393 (defcustom gnus-read-mark ?R
394 "*Mark used for read articles."
395 :group 'gnus-summary-marks
398 (defcustom gnus-expirable-mark ?E
399 "*Mark used for expirable articles."
400 :group 'gnus-summary-marks
403 (defcustom gnus-killed-mark ?K
404 "*Mark used for killed articles."
405 :group 'gnus-summary-marks
408 (defcustom gnus-souped-mark ?F
409 "*Mark used for killed articles."
410 :group 'gnus-summary-marks
413 (defcustom gnus-kill-file-mark ?X
414 "*Mark used for articles killed by kill files."
415 :group 'gnus-summary-marks
418 (defcustom gnus-low-score-mark ?Y
419 "*Mark used for articles with a low score."
420 :group 'gnus-summary-marks
423 (defcustom gnus-catchup-mark ?C
424 "*Mark used for articles that are caught up."
425 :group 'gnus-summary-marks
428 (defcustom gnus-replied-mark ?A
429 "*Mark used for articles that have been replied to."
430 :group 'gnus-summary-marks
433 (defcustom gnus-cached-mark ?*
434 "*Mark used for articles that are in the cache."
435 :group 'gnus-summary-marks
438 (defcustom gnus-saved-mark ?S
439 "*Mark used for articles that have been saved to."
440 :group 'gnus-summary-marks
443 (defcustom gnus-ancient-mark ?O
444 "*Mark used for ancient articles."
445 :group 'gnus-summary-marks
448 (defcustom gnus-sparse-mark ?Q
449 "*Mark used for sparsely reffed articles."
450 :group 'gnus-summary-marks
453 (defcustom gnus-canceled-mark ?G
454 "*Mark used for canceled articles."
455 :group 'gnus-summary-marks
458 (defcustom gnus-duplicate-mark ?M
459 "*Mark used for duplicate articles."
460 :group 'gnus-summary-marks
463 (defcustom gnus-undownloaded-mark ?@
464 "*Mark used for articles that weren't downloaded."
465 :group 'gnus-summary-marks
468 (defcustom gnus-downloadable-mark ?%
469 "*Mark used for articles that are to be downloaded."
470 :group 'gnus-summary-marks
473 (defcustom gnus-unsendable-mark ?=
474 "*Mark used for articles that won't be sent."
475 :group 'gnus-summary-marks
478 (defcustom gnus-score-over-mark ?+
479 "*Score mark used for articles with high scores."
480 :group 'gnus-summary-marks
483 (defcustom gnus-score-below-mark ?-
484 "*Score mark used for articles with low scores."
485 :group 'gnus-summary-marks
488 (defcustom gnus-empty-thread-mark ? ;Whitespace
489 "*There is no thread under the article."
490 :group 'gnus-summary-marks
493 (defcustom gnus-not-empty-thread-mark ?=
494 "*There is a thread under the article."
495 :group 'gnus-summary-marks
498 (defcustom gnus-view-pseudo-asynchronously nil
499 "*If non-nil, Gnus will view pseudo-articles asynchronously."
500 :group 'gnus-extract-view
503 (defcustom gnus-auto-expirable-marks
504 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
505 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
506 gnus-souped-mark gnus-duplicate-mark)
507 "*The list of marks converted into expiration if a group is auto-expirable."
509 :type '(repeat character))
511 (defcustom gnus-inhibit-user-auto-expire t
512 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
516 (defcustom gnus-view-pseudos nil
517 "*If `automatic', pseudo-articles will be viewed automatically.
518 If `not-confirm', pseudos will be viewed automatically, and the user
519 will not be asked to confirm the command."
520 :group 'gnus-extract-view
521 :type '(choice (const :tag "off" nil)
523 (const not-confirm)))
525 (defcustom gnus-view-pseudos-separately t
526 "*If non-nil, one pseudo-article will be created for each file to be viewed.
527 If nil, all files that use the same viewing command will be given as a
528 list of parameters to that command."
529 :group 'gnus-extract-view
532 (defcustom gnus-insert-pseudo-articles t
533 "*If non-nil, insert pseudo-articles when decoding articles."
534 :group 'gnus-extract-view
537 (defcustom gnus-summary-dummy-line-format
539 "*The format specification for the dummy roots in the summary buffer.
540 It works along the same lines as a normal formatting string,
541 with some simple extensions.
544 :group 'gnus-threading
547 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
548 "*The format specification for the summary mode line.
549 It works along the same lines as a normal formatting string,
550 with some simple extensions:
553 %p Unprefixed group name
554 %A Current article number
555 %z Current article score
557 %U Number of unread articles in the group
558 %e Number of unselected articles in the group
559 %Z A string with unread/unselected article counts
560 %g Shortish group name
561 %S Subject of the current article
563 %s Current score file name
564 %d Number of dormant articles
565 %r Number of articles that have been marked as read in this session
566 %E Number of articles expunged by the score files"
567 :group 'gnus-summary-format
570 (defcustom gnus-list-identifiers nil
571 "Regexp that matches list identifiers to be removed from subject.
572 This can also be a list of regexps."
573 :group 'gnus-summary-format
574 :group 'gnus-article-hiding
575 :type '(choice (const :tag "none" nil)
577 (repeat :value (".*") regexp)))
579 (defcustom gnus-summary-mark-below 0
580 "*Mark all articles with a score below this variable as read.
581 This variable is local to each summary buffer and usually set by the
583 :group 'gnus-score-default
586 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
587 "*List of functions used for sorting articles in the summary buffer.
588 This variable is only used when not using a threaded display."
589 :group 'gnus-summary-sort
590 :type '(repeat (choice (function-item gnus-article-sort-by-number)
591 (function-item gnus-article-sort-by-author)
592 (function-item gnus-article-sort-by-subject)
593 (function-item gnus-article-sort-by-date)
594 (function-item gnus-article-sort-by-score)
595 (function :tag "other"))))
597 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
598 "*List of functions used for sorting threads in the summary buffer.
599 By default, threads are sorted by article number.
601 Each function takes two threads and return non-nil if the first thread
602 should be sorted before the other. If you use more than one function,
603 the primary sort function should be the last. You should probably
604 always include `gnus-thread-sort-by-number' in the list of sorting
605 functions -- preferably first.
607 Ready-made functions include `gnus-thread-sort-by-number',
608 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
609 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
610 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
611 :group 'gnus-summary-sort
612 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
613 (function-item gnus-thread-sort-by-author)
614 (function-item gnus-thread-sort-by-subject)
615 (function-item gnus-thread-sort-by-date)
616 (function-item gnus-thread-sort-by-score)
617 (function-item gnus-thread-sort-by-total-score)
618 (function :tag "other"))))
620 (defcustom gnus-thread-score-function '+
621 "*Function used for calculating the total score of a thread.
623 The function is called with the scores of the article and each
624 subthread and should then return the score of the thread.
626 Some functions you can use are `+', `max', or `min'."
627 :group 'gnus-summary-sort
630 (defcustom gnus-summary-expunge-below nil
631 "All articles that have a score less than this variable will be expunged.
632 This variable is local to the summary buffers."
633 :group 'gnus-score-default
634 :type '(choice (const :tag "off" nil)
637 (defcustom gnus-thread-expunge-below nil
638 "All threads that have a total score less than this variable will be expunged.
639 See `gnus-thread-score-function' for en explanation of what a
642 This variable is local to the summary buffers."
643 :group 'gnus-threading
644 :group 'gnus-score-default
645 :type '(choice (const :tag "off" nil)
648 (defcustom gnus-summary-mode-hook nil
649 "*A hook for Gnus summary mode.
650 This hook is run before any variables are set in the summary buffer."
651 :group 'gnus-summary-various
654 (defcustom gnus-summary-menu-hook nil
655 "*Hook run after the creation of the summary mode menu."
656 :group 'gnus-summary-visual
659 (defcustom gnus-summary-exit-hook nil
660 "*A hook called on exit from the summary buffer.
661 It will be called with point in the group buffer."
662 :group 'gnus-summary-exit
665 (defcustom gnus-summary-prepare-hook nil
666 "*A hook called after the summary buffer has been generated.
667 If you want to modify the summary buffer, you can use this hook."
668 :group 'gnus-summary-various
671 (defcustom gnus-summary-prepared-hook nil
672 "*A hook called as the last thing after the summary buffer has been generated."
673 :group 'gnus-summary-various
676 (defcustom gnus-summary-generate-hook nil
677 "*A hook run just before generating the summary buffer.
678 This hook is commonly used to customize threading variables and the
680 :group 'gnus-summary-various
683 (defcustom gnus-select-group-hook nil
684 "*A hook called when a newsgroup is selected.
686 If you'd like to simplify subjects like the
687 `gnus-summary-next-same-subject' command does, you can use the
690 (setq gnus-select-group-hook
693 (mapcar (lambda (header)
694 (mail-header-set-subject
696 (gnus-simplify-subject
697 (mail-header-subject header) 're-only)))
698 gnus-newsgroup-headers))))"
699 :group 'gnus-group-select
702 (defcustom gnus-select-article-hook nil
703 "*A hook called when an article is selected."
704 :group 'gnus-summary-choose
707 (defcustom gnus-visual-mark-article-hook
708 (list 'gnus-highlight-selected-summary)
709 "*Hook run after selecting an article in the summary buffer.
710 It is meant to be used for highlighting the article in some way. It
711 is not run if `gnus-visual' is nil."
712 :group 'gnus-summary-visual
715 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
716 "*A hook called before parsing the headers."
720 (defcustom gnus-exit-group-hook nil
721 "*A hook called when exiting (not quitting) summary mode."
725 (defcustom gnus-summary-update-hook
726 (list 'gnus-summary-highlight-line)
727 "*A hook called when a summary line is changed.
728 The hook will not be called if `gnus-visual' is nil.
730 The default function `gnus-summary-highlight-line' will
731 highlight the line according to the `gnus-summary-highlight'
733 :group 'gnus-summary-visual
736 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
737 "*A hook called when an article is selected for the first time.
738 The hook is intended to mark an article as read (or unread)
739 automatically when it is selected."
740 :group 'gnus-summary-choose
743 (defcustom gnus-group-no-more-groups-hook nil
744 "*A hook run when returning to group mode having no more (unread) groups."
745 :group 'gnus-group-select
748 (defcustom gnus-ps-print-hook nil
749 "*A hook run before ps-printing something from Gnus."
753 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
754 "Face used for highlighting the current article in the summary buffer."
755 :group 'gnus-summary-visual
758 (defcustom gnus-summary-highlight
759 '(((= mark gnus-canceled-mark)
760 . gnus-summary-cancelled-face)
761 ((and (> score default)
762 (or (= mark gnus-dormant-mark)
763 (= mark gnus-ticked-mark)))
764 . gnus-summary-high-ticked-face)
765 ((and (< score default)
766 (or (= mark gnus-dormant-mark)
767 (= mark gnus-ticked-mark)))
768 . gnus-summary-low-ticked-face)
769 ((or (= mark gnus-dormant-mark)
770 (= mark gnus-ticked-mark))
771 . gnus-summary-normal-ticked-face)
772 ((and (> score default) (= mark gnus-ancient-mark))
773 . gnus-summary-high-ancient-face)
774 ((and (< score default) (= mark gnus-ancient-mark))
775 . gnus-summary-low-ancient-face)
776 ((= mark gnus-ancient-mark)
777 . gnus-summary-normal-ancient-face)
778 ((and (> score default) (= mark gnus-unread-mark))
779 . gnus-summary-high-unread-face)
780 ((and (< score default) (= mark gnus-unread-mark))
781 . gnus-summary-low-unread-face)
782 ((and (memq article gnus-newsgroup-incorporated)
783 (= mark gnus-unread-mark))
784 . gnus-summary-incorporated-face)
785 ((= mark gnus-unread-mark)
786 . gnus-summary-normal-unread-face)
787 ((and (> score default) (memq mark (list gnus-downloadable-mark
788 gnus-undownloaded-mark)))
789 . gnus-summary-high-unread-face)
790 ((and (< score default) (memq mark (list gnus-downloadable-mark
791 gnus-undownloaded-mark)))
792 . gnus-summary-low-unread-face)
793 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
794 . gnus-summary-normal-unread-face)
796 . gnus-summary-high-read-face)
798 . gnus-summary-low-read-face)
800 . gnus-summary-normal-read-face))
801 "*Controls the highlighting of summary buffer lines.
803 A list of (FORM . FACE) pairs. When deciding how a a particular
804 summary line should be displayed, each form is evaluated. The content
805 of the face field after the first true form is used. You can change
806 how those summary lines are displayed, by editing the face field.
808 You can use the following variables in the FORM field.
810 score: The articles score
811 default: The default article score.
812 below: The score below which articles are automatically marked as read.
813 mark: The articles mark."
814 :group 'gnus-summary-visual
815 :type '(repeat (cons (sexp :tag "Form" nil)
818 (defcustom gnus-alter-header-function nil
819 "Function called to allow alteration of article header structures.
820 The function is called with one parameter, the article header vector,
821 which it may alter in any way.")
823 (defvar gnus-decode-encoded-word-function
824 (mime-find-field-decoder 'From 'nov)
825 "Variable that says which function should be used to decode a string with encoded words.")
827 (defcustom gnus-extra-headers nil
828 "*Extra headers to parse."
830 :type '(repeat symbol))
832 (defcustom gnus-ignored-from-addresses
833 (and user-mail-address (regexp-quote user-mail-address))
834 "*Regexp of From headers that may be suppressed in favor of To headers."
838 (defcustom gnus-group-charset-alist
839 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
840 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
841 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
842 ("^relcom\\>" koi8-r)
844 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
845 ("^israel\\>" iso-8859-1)
847 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
849 "Alist of regexps (to match group names) and default charsets to be used when reading."
850 :type '(repeat (list (regexp :tag "Group")
851 (symbol :tag "Charset")))
852 :group 'gnus-charset)
854 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
855 "List of charsets that should be ignored.
856 When these charsets are used in the \"charset\" parameter, the
857 default charset will be used instead."
858 :type '(repeat symbol)
859 :group 'gnus-charset)
861 (defcustom gnus-group-ignored-charsets-alist
862 '(("alt\\.chinese\\.text" iso-8859-1))
863 "Alist of regexps (to match group names) and charsets that should be ignored.
864 When these charsets are used in the \"charset\" parameter, the
865 default charset will be used instead."
866 :type '(repeat (cons (regexp :tag "Group")
868 :group 'gnus-charset)
870 (defcustom gnus-group-highlight-words-alist nil
871 "Alist of group regexps and highlight regexps.
872 This variable uses the same syntax as `gnus-emphasis-alist'."
873 :type '(repeat (cons (regexp :tag "Group")
874 (repeat (list (regexp :tag "Highlight regexp")
875 (number :tag "Group for entire word" 0)
876 (number :tag "Group for displayed part" 0)
878 gnus-emphasis-highlight-words)))))
879 :group 'gnus-summary-visual)
881 (defcustom gnus-use-wheel nil
882 "Use Intelli-mouse on summary movement"
884 :group 'gnus-summary-maneuvering)
886 (defcustom gnus-wheel-scroll-amount '(5 . 1)
887 "Amount to scroll messages by spinning the mouse wheel.
888 This is actually a cons cell, where the first item is the amount to scroll
889 on a normal wheel event, and the second is the amount to scroll when the
890 wheel is moved with the shift key depressed."
891 :type '(cons (integer :tag "Shift") integer)
892 :group 'gnus-summary-maneuvering)
894 (defcustom gnus-wheel-edge-resistance 2
895 "How hard it should be to change the current article
896 by moving the mouse over the edge of the article window."
898 :group 'gnus-summary-maneuvering)
900 ;;; Internal variables
902 (defvar gnus-scores-exclude-files nil)
903 (defvar gnus-page-broken nil)
904 (defvar gnus-inhibit-mime-unbuttonizing nil)
906 (defvar gnus-original-article nil)
907 (defvar gnus-article-internal-prepare-hook nil)
908 (defvar gnus-newsgroup-process-stack nil)
910 (defvar gnus-thread-indent-array nil)
911 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
912 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
913 "Function called to sort the articles within a thread after it has
914 been gathered together.")
916 ;; Avoid highlighting in kill files.
917 (defvar gnus-summary-inhibit-highlight nil)
918 (defvar gnus-newsgroup-selected-overlay nil)
919 (defvar gnus-inhibit-limiting nil)
920 (defvar gnus-newsgroup-adaptive-score-file nil)
921 (defvar gnus-current-score-file nil)
922 (defvar gnus-current-move-group nil)
923 (defvar gnus-current-copy-group nil)
924 (defvar gnus-current-crosspost-group nil)
926 (defvar gnus-newsgroup-dependencies nil)
927 (defvar gnus-newsgroup-adaptive nil)
928 (defvar gnus-summary-display-article-function nil)
929 (defvar gnus-summary-highlight-line-function nil
930 "Function called after highlighting a summary line.")
932 (defvar gnus-summary-line-format-alist
933 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
934 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
935 (?s gnus-tmp-subject-or-nil ?s)
936 (?n gnus-tmp-name ?s)
937 (?A (std11-address-string
938 (car (mime-read-field 'From gnus-tmp-header))) ?s)
939 (?a (or (std11-full-name-string
940 (car (mime-read-field 'From gnus-tmp-header)))
942 (?F gnus-tmp-from ?s)
943 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
944 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
945 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
946 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
947 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
948 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
949 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
950 (?L gnus-tmp-lines ?d)
951 (?I gnus-tmp-indentation ?s)
952 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
953 (?R gnus-tmp-replied ?c)
954 (?\[ gnus-tmp-opening-bracket ?c)
955 (?\] gnus-tmp-closing-bracket ?c)
956 (?\> (make-string gnus-tmp-level ? ) ?s)
957 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
958 (?i gnus-tmp-score ?d)
959 (?z gnus-tmp-score-char ?c)
960 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
961 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
962 (?U gnus-tmp-unread ?c)
963 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
964 (?t (gnus-summary-number-of-articles-in-thread
965 (and (boundp 'thread) (car thread)) gnus-tmp-level)
967 (?e (gnus-summary-number-of-articles-in-thread
968 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
970 (?u gnus-tmp-user-defined ?s)
971 (?P (gnus-pick-line-number) ?d))
972 "An alist of format specifications that can appear in summary lines,
973 and what variables they correspond with, along with the type of the
974 variable (string, integer, character, etc).")
976 (defvar gnus-summary-dummy-line-format-alist
977 `((?S gnus-tmp-subject ?s)
978 (?N gnus-tmp-number ?d)
979 (?u gnus-tmp-user-defined ?s)))
981 (defvar gnus-summary-mode-line-format-alist
982 `((?G gnus-tmp-group-name ?s)
983 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
984 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
985 (?A gnus-tmp-article-number ?d)
986 (?Z gnus-tmp-unread-and-unselected ?s)
988 (?U gnus-tmp-unread-and-unticked ?d)
989 (?S gnus-tmp-subject ?s)
990 (?e gnus-tmp-unselected ?d)
991 (?u gnus-tmp-user-defined ?s)
992 (?d (length gnus-newsgroup-dormant) ?d)
993 (?t (length gnus-newsgroup-marked) ?d)
994 (?r (length gnus-newsgroup-reads) ?d)
995 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
996 (?E gnus-newsgroup-expunged-tally ?d)
997 (?s (gnus-current-score-file-nondirectory) ?s)))
999 (defvar gnus-last-search-regexp nil
1000 "Default regexp for article search command.")
1002 (defvar gnus-summary-search-article-matched-data nil
1003 "Last matched data of article search command. It is the local variable
1004 in `gnus-article-buffer' which consists of the list of start position,
1005 end position and text.")
1007 (defvar gnus-last-shell-command nil
1008 "Default shell command on article.")
1010 (defvar gnus-newsgroup-begin nil)
1011 (defvar gnus-newsgroup-end nil)
1012 (defvar gnus-newsgroup-last-rmail nil)
1013 (defvar gnus-newsgroup-last-mail nil)
1014 (defvar gnus-newsgroup-last-folder nil)
1015 (defvar gnus-newsgroup-last-file nil)
1016 (defvar gnus-newsgroup-auto-expire nil)
1017 (defvar gnus-newsgroup-active nil)
1019 (defvar gnus-newsgroup-data nil)
1020 (defvar gnus-newsgroup-data-reverse nil)
1021 (defvar gnus-newsgroup-limit nil)
1022 (defvar gnus-newsgroup-limits nil)
1024 (defvar gnus-newsgroup-unreads nil
1025 "List of unread articles in the current newsgroup.")
1027 (defvar gnus-newsgroup-unselected nil
1028 "List of unselected unread articles in the current newsgroup.")
1030 (defvar gnus-newsgroup-reads nil
1031 "Alist of read articles and article marks in the current newsgroup.")
1033 (defvar gnus-newsgroup-expunged-tally nil)
1035 (defvar gnus-newsgroup-marked nil
1036 "List of ticked articles in the current newsgroup (a subset of unread art).")
1038 (defvar gnus-newsgroup-killed nil
1039 "List of ranges of articles that have been through the scoring process.")
1041 (defvar gnus-newsgroup-cached nil
1042 "List of articles that come from the article cache.")
1044 (defvar gnus-newsgroup-saved nil
1045 "List of articles that have been saved.")
1047 (defvar gnus-newsgroup-kill-headers nil)
1049 (defvar gnus-newsgroup-replied nil
1050 "List of articles that have been replied to in the current newsgroup.")
1052 (defvar gnus-newsgroup-expirable nil
1053 "List of articles in the current newsgroup that can be expired.")
1055 (defvar gnus-newsgroup-processable nil
1056 "List of articles in the current newsgroup that can be processed.")
1058 (defvar gnus-newsgroup-downloadable nil
1059 "List of articles in the current newsgroup that can be processed.")
1061 (defvar gnus-newsgroup-undownloaded nil
1062 "List of articles in the current newsgroup that haven't been downloaded..")
1064 (defvar gnus-newsgroup-unsendable nil
1065 "List of articles in the current newsgroup that won't be sent.")
1067 (defvar gnus-newsgroup-bookmarks nil
1068 "List of articles in the current newsgroup that have bookmarks.")
1070 (defvar gnus-newsgroup-dormant nil
1071 "List of dormant articles in the current newsgroup.")
1073 (defvar gnus-newsgroup-scored nil
1074 "List of scored articles in the current newsgroup.")
1076 (defvar gnus-newsgroup-incorporated nil
1077 "List of incorporated articles in the current newsgroup.")
1079 (defvar gnus-newsgroup-headers nil
1080 "List of article headers in the current newsgroup.")
1082 (defvar gnus-newsgroup-threads nil)
1084 (defvar gnus-newsgroup-prepared nil
1085 "Whether the current group has been prepared properly.")
1087 (defvar gnus-newsgroup-ancient nil
1088 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1090 (defvar gnus-newsgroup-sparse nil)
1092 (defvar gnus-current-article nil)
1093 (defvar gnus-article-current nil)
1094 (defvar gnus-current-headers nil)
1095 (defvar gnus-have-all-headers nil)
1096 (defvar gnus-last-article nil)
1097 (defvar gnus-newsgroup-history nil)
1098 (defvar gnus-newsgroup-charset nil)
1099 (defvar gnus-newsgroup-ephemeral-charset nil)
1100 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1102 (defconst gnus-summary-local-variables
1103 '(gnus-newsgroup-name
1104 gnus-newsgroup-begin gnus-newsgroup-end
1105 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1106 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1107 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1108 gnus-newsgroup-unselected gnus-newsgroup-marked
1109 gnus-newsgroup-reads gnus-newsgroup-saved
1110 gnus-newsgroup-replied gnus-newsgroup-expirable
1111 gnus-newsgroup-processable gnus-newsgroup-killed
1112 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1113 gnus-newsgroup-unsendable
1114 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1115 gnus-newsgroup-headers gnus-newsgroup-threads
1116 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1117 gnus-current-article gnus-current-headers gnus-have-all-headers
1118 gnus-last-article gnus-article-internal-prepare-hook
1119 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1120 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1121 gnus-thread-expunge-below
1122 gnus-score-alist gnus-current-score-file
1123 (gnus-summary-expunge-below . global)
1124 (gnus-summary-mark-below . global)
1125 gnus-newsgroup-active gnus-scores-exclude-files
1126 gnus-newsgroup-history gnus-newsgroup-ancient
1127 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1128 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1129 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1130 (gnus-newsgroup-expunged-tally . 0)
1131 gnus-cache-removable-articles gnus-newsgroup-cached
1132 gnus-newsgroup-data gnus-newsgroup-data-reverse
1133 gnus-newsgroup-limit gnus-newsgroup-limits
1134 gnus-newsgroup-charset
1135 gnus-newsgroup-incorporated)
1136 "Variables that are buffer-local to the summary buffers.")
1138 ;; Byte-compiler warning.
1139 (defvar gnus-article-mode-map)
1141 ;; Subject simplification.
1143 (defun gnus-simplify-whitespace (str)
1144 "Remove excessive whitespace."
1147 (while (string-match "[ \t][ \t]+" mystr)
1148 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1150 (substring mystr (match-end 0)))))
1152 (when (string-match "^[ \t]+" mystr)
1153 (setq mystr (substring mystr (match-end 0))))
1155 (when (string-match "[ \t]+$" mystr)
1156 (setq mystr (substring mystr 0 (match-beginning 0))))
1159 (defsubst gnus-simplify-subject-re (subject)
1160 "Remove \"Re:\" from subject lines."
1161 (if (string-match "^[Rr][Ee]: *" subject)
1162 (substring subject (match-end 0))
1165 (defun gnus-simplify-subject (subject &optional re-only)
1166 "Remove `Re:' and words in parentheses.
1167 If RE-ONLY is non-nil, strip leading `Re:'s only."
1168 (let ((case-fold-search t)) ;Ignore case.
1169 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1170 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1171 (setq subject (substring subject (match-end 0))))
1172 ;; Remove uninteresting prefixes.
1173 (when (and (not re-only)
1174 gnus-simplify-ignored-prefixes
1175 (string-match gnus-simplify-ignored-prefixes subject))
1176 (setq subject (substring subject (match-end 0))))
1177 ;; Remove words in parentheses from end.
1179 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1180 (setq subject (substring subject 0 (match-beginning 0)))))
1181 ;; Return subject string.
1184 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1186 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1187 (goto-char (point-min))
1188 (while (re-search-forward regexp nil t)
1189 (replace-match (or newtext ""))))
1191 (defun gnus-simplify-buffer-fuzzy ()
1192 "Simplify string in the buffer fuzzily.
1193 The string in the accessible portion of the current buffer is simplified.
1194 It is assumed to be a single-line subject.
1195 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1196 matter is removed. Additional things can be deleted by setting
1197 gnus-simplify-subject-fuzzy-regexp."
1198 (let ((case-fold-search t)
1200 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1202 (while (not (eq modified-tick (buffer-modified-tick)))
1203 (setq modified-tick (buffer-modified-tick))
1205 ((listp gnus-simplify-subject-fuzzy-regexp)
1206 (mapcar 'gnus-simplify-buffer-fuzzy-step
1207 gnus-simplify-subject-fuzzy-regexp))
1208 (gnus-simplify-subject-fuzzy-regexp
1209 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1210 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1211 (gnus-simplify-buffer-fuzzy-step
1212 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1213 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1215 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1216 (gnus-simplify-buffer-fuzzy-step " +" " ")
1217 (gnus-simplify-buffer-fuzzy-step " $")
1218 (gnus-simplify-buffer-fuzzy-step "^ +")))
1220 (defun gnus-simplify-subject-fuzzy (subject)
1221 "Simplify a subject string fuzzily.
1222 See `gnus-simplify-buffer-fuzzy' for details."
1224 (gnus-set-work-buffer)
1225 (let ((case-fold-search t))
1226 ;; Remove uninteresting prefixes.
1227 (when (and gnus-simplify-ignored-prefixes
1228 (string-match gnus-simplify-ignored-prefixes subject))
1229 (setq subject (substring subject (match-end 0))))
1231 (inline (gnus-simplify-buffer-fuzzy))
1234 (defsubst gnus-simplify-subject-fully (subject)
1235 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1237 (gnus-simplify-subject-functions
1238 (gnus-map-function gnus-simplify-subject-functions subject))
1239 ((null gnus-summary-gather-subject-limit)
1240 (gnus-simplify-subject-re subject))
1241 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1242 (gnus-simplify-subject-fuzzy subject))
1243 ((numberp gnus-summary-gather-subject-limit)
1244 (gnus-limit-string (gnus-simplify-subject-re subject)
1245 gnus-summary-gather-subject-limit))
1249 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1250 "Check whether two subjects are equal.
1251 If optional argument simple-first is t, first argument is already
1254 ((null simple-first)
1255 (equal (gnus-simplify-subject-fully s1)
1256 (gnus-simplify-subject-fully s2)))
1259 (gnus-simplify-subject-fully s2)))))
1261 (defun gnus-summary-bubble-group ()
1262 "Increase the score of the current group.
1263 This is a handy function to add to `gnus-summary-exit-hook' to
1264 increase the score of each group you read."
1265 (gnus-group-add-score gnus-newsgroup-name))
1269 ;;; Gnus summary mode
1272 (put 'gnus-summary-mode 'mode-class 'special)
1275 ;; Non-orthogonal keys
1277 (gnus-define-keys gnus-summary-mode-map
1278 " " gnus-summary-next-page
1279 "\177" gnus-summary-prev-page
1280 [delete] gnus-summary-prev-page
1281 [backspace] gnus-summary-prev-page
1282 "\r" gnus-summary-scroll-up
1283 "\M-\r" gnus-summary-scroll-down
1284 "n" gnus-summary-next-unread-article
1285 "p" gnus-summary-prev-unread-article
1286 "N" gnus-summary-next-article
1287 "P" gnus-summary-prev-article
1288 "\M-\C-n" gnus-summary-next-same-subject
1289 "\M-\C-p" gnus-summary-prev-same-subject
1290 "\M-n" gnus-summary-next-unread-subject
1291 "\M-p" gnus-summary-prev-unread-subject
1292 "." gnus-summary-first-unread-article
1293 "," gnus-summary-best-unread-article
1294 "\M-s" gnus-summary-search-article-forward
1295 "\M-r" gnus-summary-search-article-backward
1296 "<" gnus-summary-beginning-of-article
1297 ">" gnus-summary-end-of-article
1298 "j" gnus-summary-goto-article
1299 "^" gnus-summary-refer-parent-article
1300 "\M-^" gnus-summary-refer-article
1301 "u" gnus-summary-tick-article-forward
1302 "!" gnus-summary-tick-article-forward
1303 "U" gnus-summary-tick-article-backward
1304 "d" gnus-summary-mark-as-read-forward
1305 "D" gnus-summary-mark-as-read-backward
1306 "E" gnus-summary-mark-as-expirable
1307 "\M-u" gnus-summary-clear-mark-forward
1308 "\M-U" gnus-summary-clear-mark-backward
1309 "k" gnus-summary-kill-same-subject-and-select
1310 "\C-k" gnus-summary-kill-same-subject
1311 "\M-\C-k" gnus-summary-kill-thread
1312 "\M-\C-l" gnus-summary-lower-thread
1313 "e" gnus-summary-edit-article
1314 "#" gnus-summary-mark-as-processable
1315 "\M-#" gnus-summary-unmark-as-processable
1316 "\M-\C-t" gnus-summary-toggle-threads
1317 "\M-\C-s" gnus-summary-show-thread
1318 "\M-\C-h" gnus-summary-hide-thread
1319 "\M-\C-f" gnus-summary-next-thread
1320 "\M-\C-b" gnus-summary-prev-thread
1321 "\M-\C-u" gnus-summary-up-thread
1322 "\M-\C-d" gnus-summary-down-thread
1323 "&" gnus-summary-execute-command
1324 "c" gnus-summary-catchup-and-exit
1325 "\C-w" gnus-summary-mark-region-as-read
1326 "\C-t" gnus-summary-toggle-truncation
1327 "?" gnus-summary-mark-as-dormant
1328 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1329 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1330 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1331 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1332 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1333 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1334 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1335 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1336 "=" gnus-summary-expand-window
1337 "\C-x\C-s" gnus-summary-reselect-current-group
1338 "\M-g" gnus-summary-rescan-group
1339 "w" gnus-summary-stop-page-breaking
1340 "\C-c\C-r" gnus-summary-caesar-message
1341 "\M-t" gnus-summary-toggle-mime
1342 "f" gnus-summary-followup
1343 "F" gnus-summary-followup-with-original
1344 "C" gnus-summary-cancel-article
1345 "r" gnus-summary-reply
1346 "R" gnus-summary-reply-with-original
1347 "\C-c\C-f" gnus-summary-mail-forward
1348 "o" gnus-summary-save-article
1349 "\C-o" gnus-summary-save-article-mail
1350 "|" gnus-summary-pipe-output
1351 "\M-k" gnus-summary-edit-local-kill
1352 "\M-K" gnus-summary-edit-global-kill
1354 "\C-c\C-d" gnus-summary-describe-group
1355 "q" gnus-summary-exit
1356 "Q" gnus-summary-exit-no-update
1357 "\C-c\C-i" gnus-info-find-node
1358 gnus-mouse-2 gnus-mouse-pick-article
1359 "m" gnus-summary-mail-other-window
1360 "a" gnus-summary-post-news
1361 "x" gnus-summary-limit-to-unread
1362 "s" gnus-summary-isearch-article
1363 "t" gnus-article-toggle-headers
1364 "g" gnus-summary-show-article
1365 "l" gnus-summary-goto-last-article
1366 "v" gnus-summary-preview-mime-message
1367 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1368 "\C-d" gnus-summary-enter-digest-group
1369 "\M-\C-d" gnus-summary-read-document
1370 "\M-\C-e" gnus-summary-edit-parameters
1371 "\M-\C-g" gnus-summary-customize-parameters
1373 "*" gnus-cache-enter-article
1374 "\M-*" gnus-cache-remove-article
1375 "\M-&" gnus-summary-universal-argument
1376 "\C-l" gnus-recenter
1377 "I" gnus-summary-increase-score
1378 "L" gnus-summary-lower-score
1379 "\M-i" gnus-symbolic-argument
1380 "h" gnus-summary-select-article-buffer
1382 "V" gnus-summary-score-map
1383 "X" gnus-uu-extract-map
1384 "S" gnus-summary-send-map)
1386 ;; Sort of orthogonal keymap
1387 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1388 "t" gnus-summary-tick-article-forward
1389 "!" gnus-summary-tick-article-forward
1390 "d" gnus-summary-mark-as-read-forward
1391 "r" gnus-summary-mark-as-read-forward
1392 "c" gnus-summary-clear-mark-forward
1393 " " gnus-summary-clear-mark-forward
1394 "e" gnus-summary-mark-as-expirable
1395 "x" gnus-summary-mark-as-expirable
1396 "?" gnus-summary-mark-as-dormant
1397 "b" gnus-summary-set-bookmark
1398 "B" gnus-summary-remove-bookmark
1399 "#" gnus-summary-mark-as-processable
1400 "\M-#" gnus-summary-unmark-as-processable
1401 "S" gnus-summary-limit-include-expunged
1402 "C" gnus-summary-catchup
1403 "H" gnus-summary-catchup-to-here
1404 "\C-c" gnus-summary-catchup-all
1405 "k" gnus-summary-kill-same-subject-and-select
1406 "K" gnus-summary-kill-same-subject
1407 "P" gnus-uu-mark-map)
1409 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1410 "c" gnus-summary-clear-above
1411 "u" gnus-summary-tick-above
1412 "m" gnus-summary-mark-above
1413 "k" gnus-summary-kill-below)
1415 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1416 "/" gnus-summary-limit-to-subject
1417 "n" gnus-summary-limit-to-articles
1418 "w" gnus-summary-pop-limit
1419 "s" gnus-summary-limit-to-subject
1420 "a" gnus-summary-limit-to-author
1421 "u" gnus-summary-limit-to-unread
1422 "m" gnus-summary-limit-to-marks
1423 "M" gnus-summary-limit-exclude-marks
1424 "v" gnus-summary-limit-to-score
1425 "*" gnus-summary-limit-include-cached
1426 "D" gnus-summary-limit-include-dormant
1427 "T" gnus-summary-limit-include-thread
1428 "d" gnus-summary-limit-exclude-dormant
1429 "t" gnus-summary-limit-to-age
1430 "x" gnus-summary-limit-to-extra
1431 "E" gnus-summary-limit-include-expunged
1432 "c" gnus-summary-limit-exclude-childless-dormant
1433 "C" gnus-summary-limit-mark-excluded-as-read)
1435 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1436 "n" gnus-summary-next-unread-article
1437 "p" gnus-summary-prev-unread-article
1438 "N" gnus-summary-next-article
1439 "P" gnus-summary-prev-article
1440 "\C-n" gnus-summary-next-same-subject
1441 "\C-p" gnus-summary-prev-same-subject
1442 "\M-n" gnus-summary-next-unread-subject
1443 "\M-p" gnus-summary-prev-unread-subject
1444 "f" gnus-summary-first-unread-article
1445 "b" gnus-summary-best-unread-article
1446 "j" gnus-summary-goto-article
1447 "g" gnus-summary-goto-subject
1448 "l" gnus-summary-goto-last-article
1449 "o" gnus-summary-pop-article)
1451 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1452 "k" gnus-summary-kill-thread
1453 "l" gnus-summary-lower-thread
1454 "i" gnus-summary-raise-thread
1455 "T" gnus-summary-toggle-threads
1456 "t" gnus-summary-rethread-current
1457 "^" gnus-summary-reparent-thread
1458 "s" gnus-summary-show-thread
1459 "S" gnus-summary-show-all-threads
1460 "h" gnus-summary-hide-thread
1461 "H" gnus-summary-hide-all-threads
1462 "n" gnus-summary-next-thread
1463 "p" gnus-summary-prev-thread
1464 "u" gnus-summary-up-thread
1465 "o" gnus-summary-top-thread
1466 "d" gnus-summary-down-thread
1467 "#" gnus-uu-mark-thread
1468 "\M-#" gnus-uu-unmark-thread)
1470 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1471 "g" gnus-summary-prepare
1472 "c" gnus-summary-insert-cached-articles)
1474 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1475 "c" gnus-summary-catchup-and-exit
1476 "C" gnus-summary-catchup-all-and-exit
1477 "E" gnus-summary-exit-no-update
1478 "J" gnus-summary-jump-to-other-group
1479 "Q" gnus-summary-exit
1480 "Z" gnus-summary-exit
1481 "n" gnus-summary-catchup-and-goto-next-group
1482 "R" gnus-summary-reselect-current-group
1483 "G" gnus-summary-rescan-group
1484 "N" gnus-summary-next-group
1485 "s" gnus-summary-save-newsrc
1486 "P" gnus-summary-prev-group)
1488 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1489 " " gnus-summary-next-page
1490 "n" gnus-summary-next-page
1491 "\177" gnus-summary-prev-page
1492 [delete] gnus-summary-prev-page
1493 "p" gnus-summary-prev-page
1494 "\r" gnus-summary-scroll-up
1495 "\M-\r" gnus-summary-scroll-down
1496 "<" gnus-summary-beginning-of-article
1497 ">" gnus-summary-end-of-article
1498 "b" gnus-summary-beginning-of-article
1499 "e" gnus-summary-end-of-article
1500 "^" gnus-summary-refer-parent-article
1501 "r" gnus-summary-refer-parent-article
1502 "D" gnus-summary-enter-digest-group
1503 "R" gnus-summary-refer-references
1504 "T" gnus-summary-refer-thread
1505 "g" gnus-summary-show-article
1506 "s" gnus-summary-isearch-article
1507 "P" gnus-summary-print-article
1508 "t" gnus-article-babel)
1510 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1511 "b" gnus-article-add-buttons
1512 "B" gnus-article-add-buttons-to-head
1513 "o" gnus-article-treat-overstrike
1514 "e" gnus-article-emphasize
1515 "w" gnus-article-fill-cited-article
1516 "Q" gnus-article-fill-long-lines
1517 "C" gnus-article-capitalize-sentences
1518 "c" gnus-article-remove-cr
1519 "f" gnus-article-display-x-face
1520 "l" gnus-summary-stop-page-breaking
1521 "r" gnus-summary-caesar-message
1522 "t" gnus-article-toggle-headers
1523 "v" gnus-summary-verbose-headers
1524 "m" gnus-summary-toggle-mime
1525 "H" gnus-article-strip-headers-in-body
1526 "d" gnus-article-treat-dumbquotes
1527 "s" gnus-smiley-display)
1529 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1530 "a" gnus-article-hide
1531 "h" gnus-article-toggle-headers
1532 "b" gnus-article-hide-boring-headers
1533 "s" gnus-article-hide-signature
1534 "c" gnus-article-hide-citation
1535 "C" gnus-article-hide-citation-in-followups
1536 "l" gnus-article-hide-list-identifiers
1537 "p" gnus-article-hide-pgp
1538 "B" gnus-article-strip-banner
1539 "P" gnus-article-hide-pem
1540 "\C-c" gnus-article-hide-citation-maybe)
1542 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1543 "a" gnus-article-highlight
1544 "h" gnus-article-highlight-headers
1545 "c" gnus-article-highlight-citation
1546 "s" gnus-article-highlight-signature)
1548 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1549 "z" gnus-article-date-ut
1550 "u" gnus-article-date-ut
1551 "l" gnus-article-date-local
1552 "e" gnus-article-date-lapsed
1553 "o" gnus-article-date-original
1554 "i" gnus-article-date-iso8601
1555 "s" gnus-article-date-user)
1557 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1558 "t" gnus-article-remove-trailing-blank-lines
1559 "l" gnus-article-strip-leading-blank-lines
1560 "m" gnus-article-strip-multiple-blank-lines
1561 "a" gnus-article-strip-blank-lines
1562 "A" gnus-article-strip-all-blank-lines
1563 "s" gnus-article-strip-leading-space
1564 "e" gnus-article-strip-trailing-space)
1566 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1568 "f" gnus-summary-fetch-faq
1569 "d" gnus-summary-describe-group
1570 "h" gnus-summary-describe-briefly
1571 "i" gnus-info-find-node)
1573 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1574 "e" gnus-summary-expire-articles
1575 "\M-\C-e" gnus-summary-expire-articles-now
1576 "\177" gnus-summary-delete-article
1577 [delete] gnus-summary-delete-article
1578 [backspace] gnus-summary-delete-article
1579 "m" gnus-summary-move-article
1580 "r" gnus-summary-respool-article
1581 "w" gnus-summary-edit-article
1582 "c" gnus-summary-copy-article
1583 "B" gnus-summary-crosspost-article
1584 "q" gnus-summary-respool-query
1585 "t" gnus-summary-respool-trace
1586 "i" gnus-summary-import-article
1587 "p" gnus-summary-article-posted-p)
1589 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1590 "o" gnus-summary-save-article
1591 "m" gnus-summary-save-article-mail
1592 "F" gnus-summary-write-article-file
1593 "r" gnus-summary-save-article-rmail
1594 "f" gnus-summary-save-article-file
1595 "b" gnus-summary-save-article-body-file
1596 "h" gnus-summary-save-article-folder
1597 "v" gnus-summary-save-article-vm
1598 "p" gnus-summary-pipe-output
1599 "s" gnus-soup-add-article)
1601 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1602 "b" gnus-summary-display-buttonized
1603 "m" gnus-summary-repair-multipart
1604 "v" gnus-article-view-part
1605 "o" gnus-article-save-part
1606 "c" gnus-article-copy-part
1607 "e" gnus-article-externalize-part
1608 "i" gnus-article-inline-part
1609 "|" gnus-article-pipe-part)
1612 (defun gnus-summary-make-menu-bar ()
1613 (gnus-turn-off-edit-menu 'summary)
1615 (unless (boundp 'gnus-summary-misc-menu)
1618 gnus-summary-kill-menu gnus-summary-mode-map ""
1623 ["Enter score..." gnus-summary-score-entry t]
1624 ["Customize" gnus-score-customize t])
1625 (gnus-make-score-map 'increase)
1626 (gnus-make-score-map 'lower)
1628 ["Kill below" gnus-summary-kill-below t]
1629 ["Mark above" gnus-summary-mark-above t]
1630 ["Tick above" gnus-summary-tick-above t]
1631 ["Clear above" gnus-summary-clear-above t])
1632 ["Current score" gnus-summary-current-score t]
1633 ["Set score" gnus-summary-set-score t]
1634 ["Switch current score file..." gnus-score-change-score-file t]
1635 ["Set mark below..." gnus-score-set-mark-below t]
1636 ["Set expunge below..." gnus-score-set-expunge-below t]
1637 ["Edit current score file" gnus-score-edit-current-scores t]
1638 ["Edit score file" gnus-score-edit-file t]
1639 ["Trace score" gnus-score-find-trace t]
1640 ["Find words" gnus-score-find-favourite-words t]
1641 ["Rescore buffer" gnus-summary-rescore t]
1642 ["Increase score..." gnus-summary-increase-score t]
1643 ["Lower score..." gnus-summary-lower-score t]))))
1645 ;; Define both the Article menu in the summary buffer and the equivalent
1646 ;; Commands menu in the article buffer here for consistency.
1649 ["All" gnus-article-hide t]
1650 ["Headers" gnus-article-toggle-headers t]
1651 ["Signature" gnus-article-hide-signature t]
1652 ["Citation" gnus-article-hide-citation t]
1653 ["List identifiers" gnus-article-hide-list-identifiers t]
1654 ["PGP" gnus-article-hide-pgp t]
1655 ["Banner" gnus-article-strip-banner t]
1656 ["Boring headers" gnus-article-hide-boring-headers t])
1658 ["All" gnus-article-highlight t]
1659 ["Headers" gnus-article-highlight-headers t]
1660 ["Signature" gnus-article-highlight-signature t]
1661 ["Citation" gnus-article-highlight-citation t])
1663 ["Local" gnus-article-date-local t]
1664 ["ISO8601" gnus-article-date-iso8601 t]
1665 ["UT" gnus-article-date-ut t]
1666 ["Original" gnus-article-date-original t]
1667 ["Lapsed" gnus-article-date-lapsed t]
1668 ["User-defined" gnus-article-date-user t])
1671 ["Leading" gnus-article-strip-leading-blank-lines t]
1672 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1673 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1674 ["All of the above" gnus-article-strip-blank-lines t]
1675 ["All" gnus-article-strip-all-blank-lines t]
1676 ["Leading space" gnus-article-strip-leading-space t]
1677 ["Trailing space" gnus-article-strip-trailing-space t])
1678 ["Overstrike" gnus-article-treat-overstrike t]
1679 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1680 ["Emphasis" gnus-article-emphasize t]
1681 ["Word wrap" gnus-article-fill-cited-article t]
1682 ["Fill long lines" gnus-article-fill-long-lines t]
1683 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1684 ["CR" gnus-article-remove-cr t]
1685 ["Show X-Face" gnus-article-display-x-face t]
1686 ["Rot 13" gnus-summary-caesar-message t]
1687 ["Unix pipe" gnus-summary-pipe-message t]
1688 ["Add buttons" gnus-article-add-buttons t]
1689 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1690 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1691 ["Toggle MIME" gnus-summary-toggle-mime t]
1692 ["Verbose header" gnus-summary-verbose-headers t]
1693 ["Toggle header" gnus-summary-toggle-header t]
1694 ["Toggle smileys" gnus-smiley-display t])
1696 ["Save in default format" gnus-summary-save-article t]
1697 ["Save in file" gnus-summary-save-article-file t]
1698 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1699 ["Save in MH folder" gnus-summary-save-article-folder t]
1700 ["Save in VM folder" gnus-summary-save-article-vm t]
1701 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1702 ["Save body in file" gnus-summary-save-article-body-file t]
1703 ["Pipe through a filter" gnus-summary-pipe-output t]
1704 ["Add to SOUP packet" gnus-soup-add-article t]
1705 ["Print" gnus-summary-print-article t])
1707 ["Respool article..." gnus-summary-respool-article t]
1708 ["Move article..." gnus-summary-move-article
1709 (gnus-check-backend-function
1710 'request-move-article gnus-newsgroup-name)]
1711 ["Copy article..." gnus-summary-copy-article t]
1712 ["Crosspost article..." gnus-summary-crosspost-article
1713 (gnus-check-backend-function
1714 'request-replace-article gnus-newsgroup-name)]
1715 ["Import file..." gnus-summary-import-article t]
1716 ["Check if posted" gnus-summary-article-posted-p t]
1717 ["Edit article" gnus-summary-edit-article
1718 (not (gnus-group-read-only-p))]
1719 ["Delete article" gnus-summary-delete-article
1720 (gnus-check-backend-function
1721 'request-expire-articles gnus-newsgroup-name)]
1722 ["Query respool" gnus-summary-respool-query t]
1723 ["Trace respool" gnus-summary-respool-trace t]
1724 ["Delete expirable articles" gnus-summary-expire-articles-now
1725 (gnus-check-backend-function
1726 'request-expire-articles gnus-newsgroup-name)])
1728 ["Uudecode" gnus-uu-decode-uu t]
1729 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1730 ["Unshar" gnus-uu-decode-unshar t]
1731 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1732 ["Save" gnus-uu-decode-save t]
1733 ["Binhex" gnus-uu-decode-binhex t]
1734 ["Postscript" gnus-uu-decode-postscript t])
1736 ["Enter article" gnus-cache-enter-article t]
1737 ["Remove article" gnus-cache-remove-article t])
1738 ["Translate" gnus-article-babel t]
1739 ["Select article buffer" gnus-summary-select-article-buffer t]
1740 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1741 ["Isearch article..." gnus-summary-isearch-article t]
1742 ["Beginning of the article" gnus-summary-beginning-of-article t]
1743 ["End of the article" gnus-summary-end-of-article t]
1744 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1745 ["Fetch referenced articles" gnus-summary-refer-references t]
1746 ["Fetch current thread" gnus-summary-refer-thread t]
1747 ["Fetch article with id..." gnus-summary-refer-article t]
1748 ["Redisplay" gnus-summary-show-article t])))
1750 gnus-summary-article-menu gnus-summary-mode-map ""
1751 (cons "Article" innards))
1754 gnus-article-commands-menu gnus-article-mode-map ""
1755 (cons "Commands" innards)))
1758 gnus-summary-thread-menu gnus-summary-mode-map ""
1760 ["Toggle threading" gnus-summary-toggle-threads t]
1761 ["Hide threads" gnus-summary-hide-all-threads t]
1762 ["Show threads" gnus-summary-show-all-threads t]
1763 ["Hide thread" gnus-summary-hide-thread t]
1764 ["Show thread" gnus-summary-show-thread t]
1765 ["Go to next thread" gnus-summary-next-thread t]
1766 ["Go to previous thread" gnus-summary-prev-thread t]
1767 ["Go down thread" gnus-summary-down-thread t]
1768 ["Go up thread" gnus-summary-up-thread t]
1769 ["Top of thread" gnus-summary-top-thread t]
1770 ["Mark thread as read" gnus-summary-kill-thread t]
1771 ["Lower thread score" gnus-summary-lower-thread t]
1772 ["Raise thread score" gnus-summary-raise-thread t]
1773 ["Rethread current" gnus-summary-rethread-current t]
1777 gnus-summary-post-menu gnus-summary-mode-map ""
1779 ["Post an article" gnus-summary-post-news t]
1780 ["Followup" gnus-summary-followup t]
1781 ["Followup and yank" gnus-summary-followup-with-original t]
1782 ["Supersede article" gnus-summary-supersede-article t]
1783 ["Cancel article" gnus-summary-cancel-article t]
1784 ["Reply" gnus-summary-reply t]
1785 ["Reply and yank" gnus-summary-reply-with-original t]
1786 ["Wide reply" gnus-summary-wide-reply t]
1787 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1788 ["Mail forward" gnus-summary-mail-forward t]
1789 ["Post forward" gnus-summary-post-forward t]
1790 ["Digest and mail" gnus-summary-mail-digest t]
1791 ["Digest and post" gnus-summary-post-digest t]
1792 ["Resend message" gnus-summary-resend-message t]
1793 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1794 ["Send a mail" gnus-summary-mail-other-window t]
1795 ["Uuencode and post" gnus-uu-post-news t]
1796 ["Followup via news" gnus-summary-followup-to-mail t]
1797 ["Followup via news and yank"
1798 gnus-summary-followup-to-mail-with-original t]
1800 ;;["Send" gnus-summary-send-draft t]
1801 ;;["Send bounced" gnus-resend-bounced-mail t])
1805 gnus-summary-misc-menu gnus-summary-mode-map ""
1808 ["Mark as read" gnus-summary-mark-as-read-forward t]
1809 ["Mark same subject and select"
1810 gnus-summary-kill-same-subject-and-select t]
1811 ["Mark same subject" gnus-summary-kill-same-subject t]
1812 ["Catchup" gnus-summary-catchup t]
1813 ["Catchup all" gnus-summary-catchup-all t]
1814 ["Catchup to here" gnus-summary-catchup-to-here t]
1815 ["Catchup region" gnus-summary-mark-region-as-read t]
1816 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1818 ["Tick" gnus-summary-tick-article-forward t]
1819 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1820 ["Remove marks" gnus-summary-clear-mark-forward t]
1821 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1822 ["Set bookmark" gnus-summary-set-bookmark t]
1823 ["Remove bookmark" gnus-summary-remove-bookmark t])
1825 ["Marks..." gnus-summary-limit-to-marks t]
1826 ["Subject..." gnus-summary-limit-to-subject t]
1827 ["Author..." gnus-summary-limit-to-author t]
1828 ["Age..." gnus-summary-limit-to-age t]
1829 ["Extra..." gnus-summary-limit-to-extra t]
1830 ["Score" gnus-summary-limit-to-score t]
1831 ["Unread" gnus-summary-limit-to-unread t]
1832 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1833 ["Articles" gnus-summary-limit-to-articles t]
1834 ["Pop limit" gnus-summary-pop-limit t]
1835 ["Show dormant" gnus-summary-limit-include-dormant t]
1836 ["Hide childless dormant"
1837 gnus-summary-limit-exclude-childless-dormant t]
1838 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1839 ["Hide marked" gnus-summary-limit-exclude-marks t]
1840 ["Show expunged" gnus-summary-show-all-expunged t])
1842 ["Set mark" gnus-summary-mark-as-processable t]
1843 ["Remove mark" gnus-summary-unmark-as-processable t]
1844 ["Remove all marks" gnus-summary-unmark-all-processable t]
1845 ["Mark above" gnus-uu-mark-over t]
1846 ["Mark series" gnus-uu-mark-series t]
1847 ["Mark region" gnus-uu-mark-region t]
1848 ["Unmark region" gnus-uu-unmark-region t]
1849 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1850 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1851 ["Mark all" gnus-uu-mark-all t]
1852 ["Mark buffer" gnus-uu-mark-buffer t]
1853 ["Mark sparse" gnus-uu-mark-sparse t]
1854 ["Mark thread" gnus-uu-mark-thread t]
1855 ["Unmark thread" gnus-uu-unmark-thread t]
1856 ("Process Mark Sets"
1857 ["Kill" gnus-summary-kill-process-mark t]
1858 ["Yank" gnus-summary-yank-process-mark
1859 gnus-newsgroup-process-stack]
1860 ["Save" gnus-summary-save-process-mark t]))
1862 ["Page forward" gnus-summary-next-page t]
1863 ["Page backward" gnus-summary-prev-page t]
1864 ["Line forward" gnus-summary-scroll-up t])
1866 ["Next unread article" gnus-summary-next-unread-article t]
1867 ["Previous unread article" gnus-summary-prev-unread-article t]
1868 ["Next article" gnus-summary-next-article t]
1869 ["Previous article" gnus-summary-prev-article t]
1870 ["Next unread subject" gnus-summary-next-unread-subject t]
1871 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1872 ["Next article same subject" gnus-summary-next-same-subject t]
1873 ["Previous article same subject" gnus-summary-prev-same-subject t]
1874 ["First unread article" gnus-summary-first-unread-article t]
1875 ["Best unread article" gnus-summary-best-unread-article t]
1876 ["Go to subject number..." gnus-summary-goto-subject t]
1877 ["Go to article number..." gnus-summary-goto-article t]
1878 ["Go to the last article" gnus-summary-goto-last-article t]
1879 ["Pop article off history" gnus-summary-pop-article t])
1881 ["Sort by number" gnus-summary-sort-by-number t]
1882 ["Sort by author" gnus-summary-sort-by-author t]
1883 ["Sort by subject" gnus-summary-sort-by-subject t]
1884 ["Sort by date" gnus-summary-sort-by-date t]
1885 ["Sort by score" gnus-summary-sort-by-score t]
1886 ["Sort by lines" gnus-summary-sort-by-lines t]
1887 ["Sort by characters" gnus-summary-sort-by-chars t])
1889 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1890 ["Describe group" gnus-summary-describe-group t]
1891 ["Read manual" gnus-info-find-node t])
1893 ["Pick and read" gnus-pick-mode t]
1894 ["Binary" gnus-binary-mode t])
1896 ["Regenerate" gnus-summary-prepare t]
1897 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1898 ["Toggle threading" gnus-summary-toggle-threads t])
1899 ["Filter articles..." gnus-summary-execute-command t]
1900 ["Run command on subjects..." gnus-summary-universal-argument t]
1901 ["Search articles forward..." gnus-summary-search-article-forward t]
1902 ["Search articles backward..." gnus-summary-search-article-backward t]
1903 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1904 ["Expand window" gnus-summary-expand-window t]
1905 ["Expire expirable articles" gnus-summary-expire-articles
1906 (gnus-check-backend-function
1907 'request-expire-articles gnus-newsgroup-name)]
1908 ["Edit local kill file" gnus-summary-edit-local-kill t]
1909 ["Edit main kill file" gnus-summary-edit-global-kill t]
1910 ["Edit group parameters" gnus-summary-edit-parameters t]
1911 ["Customize group parameters" gnus-summary-customize-parameters t]
1912 ["Send a bug report" gnus-bug t]
1914 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1915 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1916 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1917 ["Exit group" gnus-summary-exit t]
1918 ["Exit group without updating" gnus-summary-exit-no-update t]
1919 ["Exit and goto next group" gnus-summary-next-group t]
1920 ["Exit and goto prev group" gnus-summary-prev-group t]
1921 ["Reselect group" gnus-summary-reselect-current-group t]
1922 ["Rescan group" gnus-summary-rescan-group t]
1923 ["Update dribble" gnus-summary-save-newsrc t])))
1925 (gnus-run-hooks 'gnus-summary-menu-hook)))
1927 (defun gnus-score-set-default (var value)
1928 "A version of set that updates the GNU Emacs menu-bar."
1930 ;; It is the message that forces the active status to be updated.
1933 (defun gnus-make-score-map (type)
1934 "Make a summary score map of type TYPE."
1937 (let ((headers '(("author" "from" string)
1938 ("subject" "subject" string)
1939 ("article body" "body" string)
1940 ("article head" "head" string)
1941 ("xref" "xref" string)
1942 ("extra header" "extra" string)
1943 ("lines" "lines" number)
1944 ("followups to author" "followup" string)))
1945 (types '((number ("less than" <)
1948 (string ("substring" s)
1952 (perms '(("temporary" (current-time-string))
1960 (if (eq type 'lower)
1965 (setq header (car headers))
1971 (let ((ts (cdr (assoc (nth 2 header) types)))
1987 'gnus-summary-score-entry
1989 (if (or (string= (nth 1 header)
1991 (string= (nth 1 header)
1994 (list 'gnus-summary-header
1996 (list 'quote (nth 1 (car ts)))
1997 (list 'gnus-score-default nil)
2003 (list (nreverse outp))))
2006 (list (nreverse outt))))
2008 (setq headers (cdr headers)))
2009 (list (nreverse outh))))))))
2013 (defun gnus-summary-mode (&optional group)
2014 "Major mode for reading articles.
2016 All normal editing commands are switched off.
2017 \\<gnus-summary-mode-map>
2018 Each line in this buffer represents one article. To read an
2019 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2020 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2023 You can also post articles and send mail from this buffer. To
2024 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2025 of an article, type `\\[gnus-summary-reply]'.
2027 There are approx. one gazillion commands you can execute in this
2028 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2030 The following commands are available:
2032 \\{gnus-summary-mode-map}"
2034 (when (gnus-visual-p 'summary-menu 'menu)
2035 (gnus-summary-make-menu-bar))
2036 (kill-all-local-variables)
2037 (gnus-summary-make-local-variables)
2038 (gnus-make-thread-indent-array)
2039 (gnus-simplify-mode-line)
2040 (setq major-mode 'gnus-summary-mode)
2041 (setq mode-name "Summary")
2042 (make-local-variable 'minor-mode-alist)
2043 (use-local-map gnus-summary-mode-map)
2044 (buffer-disable-undo)
2045 (setq buffer-read-only t) ;Disable modification
2046 (setq truncate-lines t)
2047 (setq selective-display t)
2048 (setq selective-display-ellipses t) ;Display `...'
2049 (gnus-summary-set-display-table)
2050 (gnus-set-default-directory)
2051 (setq gnus-newsgroup-name group)
2052 (unless (gnus-news-group-p group)
2053 (setq gnus-newsgroup-incorporated
2054 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2055 (make-local-variable 'gnus-summary-line-format)
2056 (make-local-variable 'gnus-summary-line-format-spec)
2057 (make-local-variable 'gnus-summary-dummy-line-format)
2058 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2059 (make-local-variable 'gnus-summary-mark-positions)
2060 (make-local-hook 'pre-command-hook)
2061 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2062 (gnus-run-hooks 'gnus-summary-mode-hook)
2063 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2064 (gnus-update-summary-mark-positions))
2066 (defun gnus-summary-make-local-variables ()
2067 "Make all the local summary buffer variables."
2069 (dolist (local gnus-summary-local-variables)
2072 (if (eq (cdr local) 'global)
2073 ;; Copy the global value of the variable.
2074 (setq global (symbol-value (car local)))
2075 ;; Use the value from the list.
2076 (setq global (eval (cdr local))))
2077 (set (make-local-variable (car local)) global))
2078 ;; Simple nil-valued local variable.
2079 (set (make-local-variable local) nil)))))
2081 (defun gnus-summary-clear-local-variables ()
2082 (let ((locals gnus-summary-local-variables))
2084 (if (consp (car locals))
2085 (and (vectorp (caar locals))
2086 (set (caar locals) nil))
2087 (and (vectorp (car locals))
2088 (set (car locals) nil)))
2089 (setq locals (cdr locals)))))
2091 ;; Summary data functions.
2093 (defmacro gnus-data-number (data)
2096 (defmacro gnus-data-set-number (data number)
2097 `(setcar ,data ,number))
2099 (defmacro gnus-data-mark (data)
2102 (defmacro gnus-data-set-mark (data mark)
2103 `(setcar (nthcdr 1 ,data) ,mark))
2105 (defmacro gnus-data-pos (data)
2108 (defmacro gnus-data-set-pos (data pos)
2109 `(setcar (nthcdr 2 ,data) ,pos))
2111 (defmacro gnus-data-header (data)
2114 (defmacro gnus-data-set-header (data header)
2115 `(setcar (nthcdr 3 ,data) ,header))
2117 (defmacro gnus-data-level (data)
2120 (defmacro gnus-data-unread-p (data)
2121 `(= (nth 1 ,data) gnus-unread-mark))
2123 (defmacro gnus-data-read-p (data)
2124 `(/= (nth 1 ,data) gnus-unread-mark))
2126 (defmacro gnus-data-pseudo-p (data)
2127 `(consp (nth 3 ,data)))
2129 (defmacro gnus-data-find (number)
2130 `(assq ,number gnus-newsgroup-data))
2132 (defmacro gnus-data-find-list (number &optional data)
2133 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2134 (memq (assq ,number bdata)
2137 (defmacro gnus-data-make (number mark pos header level)
2138 `(list ,number ,mark ,pos ,header ,level))
2140 (defun gnus-data-enter (after-article number mark pos header level offset)
2141 (let ((data (gnus-data-find-list after-article)))
2143 (error "No such article: %d" after-article))
2144 (setcdr data (cons (gnus-data-make number mark pos header level)
2146 (setq gnus-newsgroup-data-reverse nil)
2147 (gnus-data-update-list (cddr data) offset)))
2149 (defun gnus-data-enter-list (after-article list &optional offset)
2151 (let ((data (and after-article (gnus-data-find-list after-article)))
2155 (let ((odata gnus-newsgroup-data))
2156 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2158 (gnus-data-update-list odata offset)))
2159 ;; Find the last element in the list to be spliced into the main
2162 (setq list (cdr list)))
2165 (setcdr list gnus-newsgroup-data)
2166 (setq gnus-newsgroup-data ilist)
2168 (gnus-data-update-list (cdr list) offset)))
2169 (setcdr list (cdr data))
2172 (gnus-data-update-list (cdr list) offset))))
2173 (setq gnus-newsgroup-data-reverse nil))))
2175 (defun gnus-data-remove (article &optional offset)
2176 (let ((data gnus-newsgroup-data))
2177 (if (= (gnus-data-number (car data)) article)
2179 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2180 gnus-newsgroup-data-reverse nil)
2182 (gnus-data-update-list gnus-newsgroup-data offset)))
2184 (when (= (gnus-data-number (cadr data)) article)
2185 (setcdr data (cddr data))
2187 (gnus-data-update-list (cdr data) offset))
2189 gnus-newsgroup-data-reverse nil))
2190 (setq data (cdr data))))))
2192 (defmacro gnus-data-list (backward)
2194 (or gnus-newsgroup-data-reverse
2195 (setq gnus-newsgroup-data-reverse
2196 (reverse gnus-newsgroup-data)))
2197 gnus-newsgroup-data))
2199 (defun gnus-data-update-list (data offset)
2200 "Add OFFSET to the POS of all data entries in DATA."
2201 (setq gnus-newsgroup-data-reverse nil)
2203 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2204 (setq data (cdr data))))
2206 (defun gnus-summary-article-pseudo-p (article)
2207 "Say whether this article is a pseudo article or not."
2208 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2210 (defmacro gnus-summary-article-sparse-p (article)
2211 "Say whether this article is a sparse article or not."
2212 `(memq ,article gnus-newsgroup-sparse))
2214 (defmacro gnus-summary-article-ancient-p (article)
2215 "Say whether this article is a sparse article or not."
2216 `(memq ,article gnus-newsgroup-ancient))
2218 (defun gnus-article-parent-p (number)
2219 "Say whether this article is a parent or not."
2220 (let ((data (gnus-data-find-list number)))
2221 (and (cdr data) ; There has to be an article after...
2222 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2223 (gnus-data-level (nth 1 data))))))
2225 (defun gnus-article-children (number)
2226 "Return a list of all children to NUMBER."
2227 (let* ((data (gnus-data-find-list number))
2228 (level (gnus-data-level (car data)))
2230 (setq data (cdr data))
2232 (= (gnus-data-level (car data)) (1+ level)))
2233 (push (gnus-data-number (car data)) children)
2234 (setq data (cdr data)))
2237 (defmacro gnus-summary-skip-intangible ()
2238 "If the current article is intangible, then jump to a different article."
2239 '(let ((to (get-text-property (point) 'gnus-intangible)))
2240 (and to (gnus-summary-goto-subject to))))
2242 (defmacro gnus-summary-article-intangible-p ()
2243 "Say whether this article is intangible or not."
2244 '(get-text-property (point) 'gnus-intangible))
2246 (defun gnus-article-read-p (article)
2247 "Say whether ARTICLE is read or not."
2248 (not (or (memq article gnus-newsgroup-marked)
2249 (memq article gnus-newsgroup-unreads)
2250 (memq article gnus-newsgroup-unselected)
2251 (memq article gnus-newsgroup-dormant))))
2253 ;; Some summary mode macros.
2255 (defmacro gnus-summary-article-number ()
2256 "The article number of the article on the current line.
2257 If there isn's an article number here, then we return the current
2260 (gnus-summary-skip-intangible)
2261 (or (get-text-property (point) 'gnus-number)
2262 (gnus-summary-last-subject))))
2264 (defmacro gnus-summary-article-header (&optional number)
2265 "Return the header of article NUMBER."
2266 `(gnus-data-header (gnus-data-find
2267 ,(or number '(gnus-summary-article-number)))))
2269 (defmacro gnus-summary-thread-level (&optional number)
2270 "Return the level of thread that starts with article NUMBER."
2271 `(if (and (eq gnus-summary-make-false-root 'dummy)
2272 (get-text-property (point) 'gnus-intangible))
2274 (gnus-data-level (gnus-data-find
2275 ,(or number '(gnus-summary-article-number))))))
2277 (defmacro gnus-summary-article-mark (&optional number)
2278 "Return the mark of article NUMBER."
2279 `(gnus-data-mark (gnus-data-find
2280 ,(or number '(gnus-summary-article-number)))))
2282 (defmacro gnus-summary-article-pos (&optional number)
2283 "Return the position of the line of article NUMBER."
2284 `(gnus-data-pos (gnus-data-find
2285 ,(or number '(gnus-summary-article-number)))))
2287 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2288 (defmacro gnus-summary-article-subject (&optional number)
2289 "Return current subject string or nil if nothing."
2292 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2293 '(gnus-data-header (assq (gnus-summary-article-number)
2294 gnus-newsgroup-data)))))
2297 (mail-header-subject headers))))
2299 (defmacro gnus-summary-article-score (&optional number)
2300 "Return current article score."
2301 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2302 gnus-newsgroup-scored))
2303 gnus-summary-default-score 0))
2305 (defun gnus-summary-article-children (&optional number)
2306 "Return a list of article numbers that are children of article NUMBER."
2307 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2308 (level (gnus-data-level (car data)))
2310 (while (and (setq data (cdr data))
2311 (> (setq l (gnus-data-level (car data))) level))
2312 (and (= (1+ level) l)
2313 (push (gnus-data-number (car data))
2315 (nreverse children)))
2317 (defun gnus-summary-article-parent (&optional number)
2318 "Return the article number of the parent of article NUMBER."
2319 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2320 (gnus-data-list t)))
2321 (level (gnus-data-level (car data))))
2323 () ; This is a root.
2324 ;; We search until we find an article with a level less than
2325 ;; this one. That function has to be the parent.
2326 (while (and (setq data (cdr data))
2327 (not (< (gnus-data-level (car data)) level))))
2328 (and data (gnus-data-number (car data))))))
2330 (defun gnus-unread-mark-p (mark)
2331 "Say whether MARK is the unread mark."
2332 (= mark gnus-unread-mark))
2334 (defun gnus-read-mark-p (mark)
2335 "Say whether MARK is one of the marks that mark as read.
2336 This is all marks except unread, ticked, dormant, and expirable."
2337 (not (or (= mark gnus-unread-mark)
2338 (= mark gnus-ticked-mark)
2339 (= mark gnus-dormant-mark)
2340 (= mark gnus-expirable-mark))))
2342 (defmacro gnus-article-mark (number)
2343 "Return the MARK of article NUMBER.
2344 This macro should only be used when computing the mark the \"first\"
2345 time; i.e., when generating the summary lines. After that,
2346 `gnus-summary-article-mark' should be used to examine the
2349 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2350 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2351 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2352 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2353 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2354 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2355 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2356 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2357 gnus-ancient-mark))))
2359 ;; Saving hidden threads.
2361 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2362 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2364 (defmacro gnus-save-hidden-threads (&rest forms)
2365 "Save hidden threads, eval FORMS, and restore the hidden threads."
2366 (let ((config (make-symbol "config")))
2367 `(let ((,config (gnus-hidden-threads-configuration)))
2371 (gnus-restore-hidden-threads-configuration ,config)))))
2373 (defun gnus-data-compute-positions ()
2374 "Compute the positions of all articles."
2375 (setq gnus-newsgroup-data-reverse nil)
2376 (let ((data gnus-newsgroup-data))
2378 (gnus-save-hidden-threads
2379 (gnus-summary-show-all-threads)
2380 (goto-char (point-min))
2382 (while (get-text-property (point) 'gnus-intangible)
2384 (gnus-data-set-pos (car data) (+ (point) 3))
2385 (setq data (cdr data))
2386 (forward-line 1))))))
2388 (defun gnus-hidden-threads-configuration ()
2389 "Return the current hidden threads configuration."
2392 (goto-char (point-min))
2393 (while (search-forward "\r" nil t)
2394 (push (1- (point)) config))
2397 (defun gnus-restore-hidden-threads-configuration (config)
2398 "Restore hidden threads configuration from CONFIG."
2399 (let (point buffer-read-only)
2400 (while (setq point (pop config))
2401 (when (and (< point (point-max))
2403 (eq (char-after) ?\n))
2404 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2406 ;; Various summary mode internalish functions.
2408 (defun gnus-mouse-pick-article (e)
2411 (gnus-summary-next-page nil t))
2413 (defun gnus-summary-set-display-table ()
2414 ;; Change the display table. Odd characters have a tendency to mess
2415 ;; up nicely formatted displays - we make all possible glyphs
2416 ;; display only a single character.
2418 ;; We start from the standard display table, if any.
2419 (let ((table (or (copy-sequence standard-display-table)
2420 (make-display-table)))
2422 ;; Nix out all the control chars...
2423 (while (>= (setq i (1- i)) 0)
2424 (aset table i [??]))
2425 ;; ... but not newline and cr, of course. (cr is necessary for the
2426 ;; selective display).
2427 (aset table ?\n nil)
2428 (aset table ?\r nil)
2429 ;; We keep TAB as well.
2430 (aset table ?\t nil)
2431 ;; We nix out any glyphs over 126 that are not set already.
2433 (while (>= (setq i (1- i)) 127)
2434 ;; Only modify if the entry is nil.
2435 (unless (aref table i)
2436 (aset table i [??]))))
2437 (setq buffer-display-table table)))
2439 (defun gnus-summary-setup-buffer (group)
2440 "Initialize summary buffer."
2441 (let ((buffer (concat "*Summary " group "*")))
2442 (if (get-buffer buffer)
2445 (setq gnus-summary-buffer (current-buffer))
2446 (not gnus-newsgroup-prepared))
2447 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2448 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2449 (gnus-summary-mode group)
2451 (gnus-carpal-setup-buffer 'summary))
2452 (unless gnus-single-article-buffer
2453 (make-local-variable 'gnus-article-buffer)
2454 (make-local-variable 'gnus-article-current)
2455 (make-local-variable 'gnus-original-article-buffer))
2456 (setq gnus-newsgroup-name group)
2459 (defun gnus-set-global-variables ()
2460 ;; Set the global equivalents of the summary buffer-local variables
2461 ;; to the latest values they had. These reflect the summary buffer
2462 ;; that was in action when the last article was fetched.
2463 (when (eq major-mode 'gnus-summary-mode)
2464 (setq gnus-summary-buffer (current-buffer))
2465 (let ((name gnus-newsgroup-name)
2466 (marked gnus-newsgroup-marked)
2467 (unread gnus-newsgroup-unreads)
2468 (headers gnus-current-headers)
2469 (data gnus-newsgroup-data)
2470 (summary gnus-summary-buffer)
2471 (article-buffer gnus-article-buffer)
2472 (original gnus-original-article-buffer)
2473 (gac gnus-article-current)
2474 (reffed gnus-reffed-article-number)
2475 (score-file gnus-current-score-file)
2476 (default-charset gnus-newsgroup-charset))
2478 (set-buffer gnus-group-buffer)
2479 (setq gnus-newsgroup-name name
2480 gnus-newsgroup-marked marked
2481 gnus-newsgroup-unreads unread
2482 gnus-current-headers headers
2483 gnus-newsgroup-data data
2484 gnus-article-current gac
2485 gnus-summary-buffer summary
2486 gnus-article-buffer article-buffer
2487 gnus-original-article-buffer original
2488 gnus-reffed-article-number reffed
2489 gnus-current-score-file score-file
2490 gnus-newsgroup-charset default-charset)
2491 ;; The article buffer also has local variables.
2492 (when (gnus-buffer-live-p gnus-article-buffer)
2493 (set-buffer gnus-article-buffer)
2494 (setq gnus-summary-buffer summary))))))
2496 (defun gnus-summary-article-unread-p (article)
2497 "Say whether ARTICLE is unread or not."
2498 (memq article gnus-newsgroup-unreads))
2500 (defun gnus-summary-first-article-p (&optional article)
2501 "Return whether ARTICLE is the first article in the buffer."
2502 (if (not (setq article (or article (gnus-summary-article-number))))
2504 (eq article (caar gnus-newsgroup-data))))
2506 (defun gnus-summary-last-article-p (&optional article)
2507 "Return whether ARTICLE is the last article in the buffer."
2508 (if (not (setq article (or article (gnus-summary-article-number))))
2509 ;; All non-existent numbers are the last article. :-)
2511 (not (cdr (gnus-data-find-list article)))))
2513 (defun gnus-make-thread-indent-array ()
2515 (unless (and gnus-thread-indent-array
2516 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2517 (setq gnus-thread-indent-array (make-vector 201 "")
2518 gnus-thread-indent-array-level gnus-thread-indent-level)
2520 (aset gnus-thread-indent-array n
2521 (make-string (* n gnus-thread-indent-level) ? ))
2524 (defun gnus-update-summary-mark-positions ()
2525 "Compute where the summary marks are to go."
2527 (when (gnus-buffer-exists-p gnus-summary-buffer)
2528 (set-buffer gnus-summary-buffer))
2529 (let ((gnus-replied-mark 129)
2530 (gnus-score-below-mark 130)
2531 (gnus-score-over-mark 130)
2532 (gnus-download-mark 131)
2533 (spec gnus-summary-line-format-spec)
2536 (gnus-set-work-buffer)
2537 (let ((gnus-summary-line-format-spec spec)
2538 (gnus-newsgroup-downloadable '((0 . t))))
2539 (gnus-summary-insert-line
2540 (make-full-mail-header 0 "" "nobody" "" "" "" 0 0 "" nil)
2541 0 nil 128 t nil "" nil 1)
2542 (goto-char (point-min))
2543 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2545 (goto-char (point-min))
2546 (push (cons 'replied (and (search-forward "\201" nil t)
2549 (goto-char (point-min))
2550 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2552 (goto-char (point-min))
2553 (push (cons 'download
2554 (and (search-forward "\203" nil t) (- (point) 2)))
2556 (setq gnus-summary-mark-positions pos))))
2558 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2559 "Insert a dummy root in the summary buffer."
2561 (gnus-add-text-properties
2562 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2563 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2565 (defun gnus-summary-from-or-to-or-newsgroups (header)
2566 (let ((to (cdr (assq 'To (mail-header-extra header))))
2567 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2568 (default-mime-charset (with-current-buffer gnus-summary-buffer
2569 default-mime-charset)))
2572 gnus-ignored-from-addresses
2573 (string-match gnus-ignored-from-addresses
2574 (mail-header-from header)))
2576 (or (car (funcall gnus-extract-address-components
2578 gnus-decode-encoded-word-function to)))
2579 (funcall gnus-decode-encoded-word-function to))))
2581 gnus-ignored-from-addresses
2582 (string-match gnus-ignored-from-addresses
2583 (mail-header-from header)))
2584 (concat "=> " newsgroups))
2586 (or (car (funcall gnus-extract-address-components
2587 (mail-header-from header)))
2588 (mail-header-from header))))))
2590 (defun gnus-summary-insert-line (gnus-tmp-header
2591 gnus-tmp-level gnus-tmp-current
2592 gnus-tmp-unread gnus-tmp-replied
2593 gnus-tmp-expirable gnus-tmp-subject-or-nil
2594 &optional gnus-tmp-dummy gnus-tmp-score
2596 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2597 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2598 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2599 (gnus-tmp-score-char
2600 (if (or (null gnus-summary-default-score)
2601 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2602 gnus-summary-zcore-fuzz))
2604 (if (< gnus-tmp-score gnus-summary-default-score)
2605 gnus-score-below-mark gnus-score-over-mark)))
2607 (cond (gnus-tmp-process gnus-process-mark)
2608 ((memq gnus-tmp-current gnus-newsgroup-cached)
2610 (gnus-tmp-replied gnus-replied-mark)
2611 ((memq gnus-tmp-current gnus-newsgroup-saved)
2613 (t gnus-unread-mark)))
2614 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2617 ((string-match "<[^>]+> *$" gnus-tmp-from)
2618 (let ((beg (match-beginning 0)))
2619 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2620 (substring gnus-tmp-from (1+ (match-beginning 0))
2621 (1- (match-end 0))))
2622 (substring gnus-tmp-from 0 beg))))
2623 ((string-match "(.+)" gnus-tmp-from)
2624 (substring gnus-tmp-from
2625 (1+ (match-beginning 0)) (1- (match-end 0))))
2627 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2628 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2629 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2630 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2631 (buffer-read-only nil))
2632 (when (string= gnus-tmp-name "")
2633 (setq gnus-tmp-name gnus-tmp-from))
2634 (unless (numberp gnus-tmp-lines)
2635 (setq gnus-tmp-lines 0))
2636 (gnus-put-text-property-excluding-characters-with-faces
2638 (progn (eval gnus-summary-line-format-spec) (point))
2639 'gnus-number gnus-tmp-number)
2640 (when (gnus-visual-p 'summary-highlight 'highlight)
2642 (gnus-run-hooks 'gnus-summary-update-hook)
2645 (defun gnus-summary-update-line (&optional dont-update)
2646 ;; Update summary line after change.
2647 (when (and gnus-summary-default-score
2648 (not gnus-summary-inhibit-highlight))
2649 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2650 (article (gnus-summary-article-number))
2651 (score (gnus-summary-article-score article)))
2653 (if (and gnus-summary-mark-below
2654 (< (gnus-summary-article-score)
2655 gnus-summary-mark-below))
2656 ;; This article has a low score, so we mark it as read.
2657 (when (memq article gnus-newsgroup-unreads)
2658 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2659 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2660 ;; This article was previously marked as read on account
2661 ;; of a low score, but now it has risen, so we mark it as
2663 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2664 (gnus-summary-update-mark
2665 (if (or (null gnus-summary-default-score)
2666 (<= (abs (- score gnus-summary-default-score))
2667 gnus-summary-zcore-fuzz))
2669 (if (< score gnus-summary-default-score)
2670 gnus-score-below-mark gnus-score-over-mark))
2672 ;; Do visual highlighting.
2673 (when (gnus-visual-p 'summary-highlight 'highlight)
2674 (gnus-run-hooks 'gnus-summary-update-hook)))))
2676 (defvar gnus-tmp-new-adopts nil)
2678 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2679 "Return the number of articles in THREAD.
2680 This may be 0 in some cases -- if none of the articles in
2681 the thread are to be displayed."
2683 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2685 ((not (listp thread))
2687 ((and (consp thread) (cdr thread))
2690 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2693 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2696 (when (and level (zerop level) gnus-tmp-new-adopts)
2699 'gnus-summary-number-of-articles-in-thread
2700 gnus-tmp-new-adopts))))
2702 (if (> number 1) gnus-not-empty-thread-mark
2703 gnus-empty-thread-mark)
2706 (defun gnus-summary-set-local-parameters (group)
2707 "Go through the local params of GROUP and set all variable specs in that list."
2708 (let ((params (gnus-group-find-parameter group))
2711 (setq elem (car params)
2712 params (cdr params))
2713 (and (consp elem) ; Has to be a cons.
2714 (consp (cdr elem)) ; The cdr has to be a list.
2715 (symbolp (car elem)) ; Has to be a symbol in there.
2716 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2717 (ignore-errors ; So we set it.
2718 (make-local-variable (car elem))
2719 (set (car elem) (eval (nth 1 elem))))))))
2721 (defun gnus-summary-read-group (group &optional show-all no-article
2722 kill-buffer no-display backward
2724 "Start reading news in newsgroup GROUP.
2725 If SHOW-ALL is non-nil, already read articles are also listed.
2726 If NO-ARTICLE is non-nil, no article is selected initially.
2727 If NO-DISPLAY, don't generate a summary buffer."
2731 (let ((gnus-auto-select-next nil))
2732 (or (gnus-summary-read-group-1
2733 group show-all no-article
2734 kill-buffer no-display
2737 select-articles nil)))))
2738 (eq gnus-auto-select-next 'quietly))
2739 (set-buffer gnus-group-buffer)
2740 ;; The entry function called above goes to the next
2741 ;; group automatically, so we go two groups back
2742 ;; if we are searching for the previous group.
2744 (gnus-group-prev-unread-group 2))
2745 (if (not (equal group (gnus-group-group-name)))
2746 (setq group (gnus-group-group-name))
2750 (defun gnus-summary-jump-to-other-group (group &optional show-all)
2751 "Directly jump to the other GROUP from summary buffer.
2752 If SHOW-ALL is non-nil, already read articles are also listed."
2754 (if (eq gnus-summary-buffer (current-buffer))
2755 (list (completing-read
2756 "Group: " gnus-active-hashtb nil t
2757 (when (and gnus-newsgroup-name
2758 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
2759 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
2760 'gnus-group-history)
2762 (error "%s must be invoked from a gnus summary buffer." this-command)))
2763 (unless (or (zerop (length group))
2764 (and gnus-newsgroup-name
2765 (string-equal gnus-newsgroup-name group)))
2767 (gnus-summary-read-group group show-all
2768 gnus-dont-select-after-jump-to-other-group)))
2770 (defun gnus-summary-read-group-1 (group show-all no-article
2771 kill-buffer no-display
2772 &optional select-articles)
2773 ;; Killed foreign groups can't be entered.
2774 (when (and (not (gnus-group-native-p group))
2775 (not (gnus-gethash group gnus-newsrc-hashtb)))
2776 (error "Dead non-native groups can't be entered"))
2777 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2778 (let* ((new-group (gnus-summary-setup-buffer group))
2779 (quit-config (gnus-group-quit-config group))
2780 (did-select (and new-group (gnus-select-newsgroup
2781 group show-all select-articles))))
2783 ;; This summary buffer exists already, so we just select it.
2785 (gnus-set-global-variables)
2787 (gnus-kill-or-deaden-summary kill-buffer))
2788 (gnus-configure-windows 'summary 'force)
2789 (gnus-set-mode-line 'summary)
2790 (gnus-summary-position-point)
2793 ;; We couldn't select this group.
2795 (when (and (eq major-mode 'gnus-summary-mode)
2796 (not (equal (current-buffer) kill-buffer)))
2797 (kill-buffer (current-buffer))
2798 (if (not quit-config)
2800 ;; Update the info -- marks might need to be removed,
2802 (gnus-summary-update-info)
2803 (set-buffer gnus-group-buffer)
2804 (gnus-group-jump-to-group group)
2805 (gnus-group-next-unread-group 1))
2806 (gnus-handle-ephemeral-exit quit-config)))
2807 (gnus-message 3 "Can't select group")
2809 ;; The user did a `C-g' while prompting for number of articles,
2810 ;; so we exit this group.
2811 ((eq did-select 'quit)
2812 (and (eq major-mode 'gnus-summary-mode)
2813 (not (equal (current-buffer) kill-buffer))
2814 (kill-buffer (current-buffer)))
2816 (gnus-kill-or-deaden-summary kill-buffer))
2817 (if (not quit-config)
2819 (set-buffer gnus-group-buffer)
2820 (gnus-group-jump-to-group group)
2821 (gnus-group-next-unread-group 1)
2822 (gnus-configure-windows 'group 'force))
2823 (gnus-handle-ephemeral-exit quit-config))
2824 ;; Finally signal the quit.
2826 ;; The group was successfully selected.
2828 (gnus-set-global-variables)
2829 ;; Save the active value in effect when the group was entered.
2830 (setq gnus-newsgroup-active
2832 (gnus-active gnus-newsgroup-name)))
2833 ;; You can change the summary buffer in some way with this hook.
2834 (gnus-run-hooks 'gnus-select-group-hook)
2835 ;; Set any local variables in the group parameters.
2836 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2837 (gnus-update-format-specifications
2838 nil 'summary 'summary-mode 'summary-dummy)
2839 (gnus-update-summary-mark-positions)
2840 ;; Do score processing.
2841 (when gnus-use-scoring
2842 (gnus-possibly-score-headers))
2843 ;; Check whether to fill in the gaps in the threads.
2844 (when gnus-build-sparse-threads
2845 (gnus-build-sparse-threads))
2846 ;; Find the initial limit.
2847 (if gnus-show-threads
2849 (let ((gnus-newsgroup-dormant nil))
2850 (gnus-summary-initial-limit show-all))
2851 (gnus-summary-initial-limit show-all))
2852 ;; When untreaded, all articles are always shown.
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 (mail-parse-charset gnus-newsgroup-charset)
3192 (gnus-summary-ignore-duplicates t)
3193 header references generation relations
3194 subject child end new-child date)
3195 ;; First we create an alist of generations/relations, where
3196 ;; generations is how much we trust the relation, and the relation
3198 (gnus-message 7 "Making sparse threads...")
3200 (nnheader-set-temp-buffer " *gnus sparse threads*")
3201 (while (setq header (pop headers))
3202 (when (and (setq references (mail-header-references header))
3203 (not (string= references "")))
3205 (setq child (mail-header-id header)
3206 subject (mail-header-subject header)
3207 date (mail-header-date header)
3209 (while (search-backward ">" nil t)
3210 (setq end (1+ (point)))
3211 (when (search-backward "<" nil t)
3212 (setq new-child (buffer-substring (point) end))
3213 (push (list (incf generation)
3214 child (setq child new-child)
3218 (push (list (1+ generation) child nil subject) relations))
3220 (kill-buffer (current-buffer)))
3221 ;; Sort over trustworthiness.
3224 (when (gnus-dependencies-add-header
3225 (make-full-mail-header
3226 gnus-reffed-article-number
3227 (nth 3 relation) "" (or (nth 4 relation) "")
3229 (or (nth 2 relation) "") 0 0 "")
3230 gnus-newsgroup-dependencies nil)
3231 (push gnus-reffed-article-number gnus-newsgroup-limit)
3232 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3233 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3234 gnus-newsgroup-reads)
3235 (decf gnus-reffed-article-number)))
3236 (sort relations 'car-less-than-car))
3237 (gnus-message 7 "Making sparse threads...done")))
3239 (defun gnus-build-old-threads ()
3240 ;; Look at all the articles that refer back to old articles, and
3241 ;; fetch the headers for the articles that aren't there. This will
3242 ;; build complete threads - if the roots haven't been expired by the
3244 (let ((mail-parse-charset gnus-newsgroup-charset)
3248 (when (not (car (symbol-value refs)))
3249 (setq heads (cdr (symbol-value refs)))
3251 (if (memq (mail-header-number (caar heads))
3252 gnus-newsgroup-dormant)
3253 (setq heads (cdr heads))
3254 (setq id (symbol-name refs))
3255 (while (and (setq id (gnus-build-get-header id))
3256 (not (car (gnus-id-to-thread id)))))
3257 (setq heads nil)))))
3258 gnus-newsgroup-dependencies)))
3260 ;; This function has to be called with point after the article number
3261 ;; on the beginning of the line.
3262 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3263 (let ((eol (gnus-point-at-eol))
3264 (buffer (current-buffer))
3267 ;; overview: [num subject from date id refs chars lines misc]
3272 (make-full-mail-header
3274 (nnheader-nov-field) ; subject
3275 (nnheader-nov-field) ; from
3276 (nnheader-nov-field) ; date
3277 (nnheader-nov-read-message-id) ; id
3278 (nnheader-nov-field) ; refs
3279 (nnheader-nov-read-integer) ; chars
3280 (nnheader-nov-read-integer) ; lines
3282 (nnheader-nov-field)) ; misc
3283 (nnheader-nov-parse-extra))) ; extra
3285 (when gnus-alter-header-function
3286 (funcall gnus-alter-header-function header))
3287 (gnus-dependencies-add-header header dependencies force-new)))
3289 (defun gnus-build-get-header (id)
3290 ;; Look through the buffer of NOV lines and find the header to
3291 ;; ID. Enter this line into the dependencies hash table, and return
3292 ;; the id of the parent article (if any).
3293 (let ((deps gnus-newsgroup-dependencies)
3297 (set-buffer nntp-server-buffer)
3298 (let ((case-fold-search nil))
3299 (goto-char (point-min))
3300 (while (and (not found)
3301 (search-forward id nil t))
3303 (setq found (looking-at
3304 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3305 (regexp-quote id))))
3306 (or found (beginning-of-line 2)))
3310 (setq header (gnus-nov-parse-line
3311 (read (current-buffer)) deps))
3312 (gnus-parent-id (mail-header-references header))))))
3314 (let ((number (mail-header-number header)))
3315 (push number gnus-newsgroup-limit)
3316 (push header gnus-newsgroup-headers)
3317 (if (memq number gnus-newsgroup-unselected)
3319 (push number gnus-newsgroup-unreads)
3320 (setq gnus-newsgroup-unselected
3321 (delq number gnus-newsgroup-unselected)))
3322 (push number gnus-newsgroup-ancient)))))))
3324 (defun gnus-build-all-threads ()
3325 "Read all the headers."
3326 (let ((gnus-summary-ignore-duplicates t)
3327 (mail-parse-charset gnus-newsgroup-charset)
3328 (dependencies gnus-newsgroup-dependencies)
3331 (set-buffer nntp-server-buffer)
3332 (let ((case-fold-search nil))
3333 (goto-char (point-min))
3336 (setq article (read (current-buffer))
3337 header (gnus-nov-parse-line article dependencies)))
3340 (set-buffer gnus-summary-buffer)
3341 (push header gnus-newsgroup-headers)
3342 (if (memq (setq article (mail-header-number header))
3343 gnus-newsgroup-unselected)
3345 (push article gnus-newsgroup-unreads)
3346 (setq gnus-newsgroup-unselected
3347 (delq article gnus-newsgroup-unselected)))
3348 (push article gnus-newsgroup-ancient)))
3349 (forward-line 1)))))))
3351 (defun gnus-summary-update-article-line (article header)
3352 "Update the line for ARTICLE using HEADERS."
3353 (let* ((id (mail-header-id header))
3354 (thread (gnus-id-to-thread id)))
3356 (error "Article in no thread"))
3357 ;; Update the thread.
3358 (setcar thread header)
3359 (gnus-summary-goto-subject article)
3360 (let* ((datal (gnus-data-find-list article))
3362 (length (when (cdr datal)
3363 (- (gnus-data-pos data)
3364 (gnus-data-pos (cadr datal)))))
3365 (buffer-read-only nil)
3366 (level (gnus-summary-thread-level)))
3368 (gnus-summary-insert-line
3369 header level nil (gnus-article-mark article)
3370 (memq article gnus-newsgroup-replied)
3371 (memq article gnus-newsgroup-expirable)
3372 ;; Only insert the Subject string when it's different
3373 ;; from the previous Subject string.
3374 (if (gnus-subject-equal
3376 (mail-header-subject
3379 (gnus-data-find-list
3381 (gnus-data-list t)))))
3382 ;; Error on the side of excessive subjects.
3384 (mail-header-subject header))
3386 (mail-header-subject header))
3387 nil (cdr (assq article gnus-newsgroup-scored))
3388 (memq article gnus-newsgroup-processable))
3390 (gnus-data-update-list
3391 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3393 (defun gnus-summary-update-article (article &optional iheader)
3394 "Update ARTICLE in the summary buffer."
3395 (set-buffer gnus-summary-buffer)
3396 (let* ((header (gnus-summary-article-header article))
3397 (id (mail-header-id header))
3398 (data (gnus-data-find article))
3399 (thread (gnus-id-to-thread id))
3400 (references (mail-header-references header))
3404 (when (and references
3405 (not (equal "" references)))
3408 (buffer-read-only nil)
3414 (delq thread parent)))
3415 (if (gnus-summary-insert-subject id header)
3416 ;; Set the (possibly) new article number in the data structure.
3417 (gnus-data-set-number data (gnus-id-to-article id))
3421 (defun gnus-rebuild-thread (id &optional line)
3422 "Rebuild the thread containing ID.
3423 If LINE, insert the rebuilt thread starting on line LINE."
3424 (let ((buffer-read-only nil)
3425 old-pos current thread data)
3426 (if (not gnus-show-threads)
3427 (setq thread (list (car (gnus-id-to-thread id))))
3428 ;; Get the thread this article is part of.
3429 (setq thread (gnus-remove-thread id)))
3430 (setq old-pos (gnus-point-at-bol))
3431 (setq current (save-excursion
3432 (and (zerop (forward-line -1))
3433 (gnus-summary-article-number))))
3434 ;; If this is a gathered thread, we have to go some re-gathering.
3435 (when (stringp (car thread))
3436 (let ((subject (car thread))
3438 (setq thread (cdr thread))
3440 (unless (memq (setq thr (gnus-id-to-thread
3442 (mail-header-id (caar thread)))))
3445 (setq thread (cdr thread)))
3446 ;; We now have all (unique) roots.
3447 (if (= (length roots) 1)
3448 ;; All the loose roots are now one solid root.
3449 (setq thread (car roots))
3450 (setq thread (cons subject (gnus-sort-threads roots))))))
3452 ;; We then insert this thread into the summary buffer.
3454 (goto-char (point-min))
3455 (forward-line (1- line)))
3456 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3457 (if gnus-show-threads
3458 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3459 (gnus-summary-prepare-unthreaded thread))
3460 (setq data (nreverse gnus-newsgroup-data))
3461 (setq threads gnus-newsgroup-threads))
3462 ;; We splice the new data into the data structure.
3463 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3464 ;;!!! then we want to insert at the beginning of the buffer.
3465 ;;!!! That happens to be true with Gnus now, but that may
3466 ;;!!! change in the future. Perhaps.
3467 (gnus-data-enter-list
3468 (if line nil current) data (- (point) old-pos))
3469 (setq gnus-newsgroup-threads
3470 (nconc threads gnus-newsgroup-threads))
3471 (gnus-data-compute-positions))))
3473 (defun gnus-number-to-header (number)
3474 "Return the header for article NUMBER."
3475 (let ((headers gnus-newsgroup-headers))
3477 (not (= number (mail-header-number (car headers)))))
3482 (defun gnus-parent-headers (in-headers &optional generation)
3483 "Return the headers of the GENERATIONeth parent of HEADERS."
3485 (setq generation 1))
3487 (headers in-headers)
3490 (not (zerop generation))
3491 (setq references (mail-header-references headers)))
3492 (setq headers (if (and references
3493 (setq parent (gnus-parent-id references)))
3494 (car (gnus-id-to-thread parent))
3497 (and (not (eq headers in-headers))
3500 (defun gnus-id-to-thread (id)
3501 "Return the (sub-)thread where ID appears."
3502 (gnus-gethash id gnus-newsgroup-dependencies))
3504 (defun gnus-id-to-article (id)
3505 "Return the article number of ID."
3506 (let ((thread (gnus-id-to-thread id)))
3509 (mail-header-number (car thread)))))
3511 (defun gnus-id-to-header (id)
3512 "Return the article headers of ID."
3513 (car (gnus-id-to-thread id)))
3515 (defun gnus-article-displayed-root-p (article)
3516 "Say whether ARTICLE is a root(ish) article."
3517 (let ((level (gnus-summary-thread-level article))
3518 (refs (mail-header-references (gnus-summary-article-header article)))
3524 ((null (gnus-parent-id refs)) t)
3526 (null (setq particle (gnus-id-to-article
3527 (gnus-parent-id refs))))
3528 (null (gnus-summary-thread-level particle)))))))
3530 (defun gnus-root-id (id)
3531 "Return the id of the root of the thread where ID appears."
3533 (while (and id (setq prev (car (gnus-id-to-thread id))))
3535 id (gnus-parent-id (mail-header-references prev))))
3538 (defun gnus-articles-in-thread (thread)
3539 "Return the list of articles in THREAD."
3540 (cons (mail-header-number (car thread))
3541 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3543 (defun gnus-remove-thread (id &optional dont-remove)
3544 "Remove the thread that has ID in it."
3545 (let (headers thread last-id)
3546 ;; First go up in this thread until we find the root.
3547 (setq last-id (gnus-root-id id)
3548 headers (message-flatten-list (gnus-id-to-thread last-id)))
3549 ;; We have now found the real root of this thread. It might have
3550 ;; been gathered into some loose thread, so we have to search
3551 ;; through the threads to find the thread we wanted.
3552 (let ((threads gnus-newsgroup-threads)
3555 (setq sub (car threads))
3556 (if (stringp (car sub))
3557 ;; This is a gathered thread, so we look at the roots
3558 ;; below it to find whether this article is in this
3561 (setq sub (cdr sub))
3563 (when (member (caar sub) headers)
3564 (setq thread (car threads)
3567 (setq sub (cdr sub))))
3568 ;; It's an ordinary thread, so we check it.
3569 (when (eq (car sub) (car headers))
3572 (setq threads (cdr threads)))
3573 ;; If this article is in no thread, then it's a root.
3576 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3577 (setq thread (gnus-id-to-thread last-id)))
3580 thread ; We return this thread.
3582 (if (stringp (car thread))
3584 ;; If we use dummy roots, then we have to remove the
3585 ;; dummy root as well.
3586 (when (eq gnus-summary-make-false-root 'dummy)
3587 ;; We go to the dummy root by going to
3588 ;; the first sub-"thread", and then one line up.
3589 (gnus-summary-goto-article
3590 (mail-header-number (caadr thread)))
3593 (gnus-data-compute-positions))
3594 (setq thread (cdr thread))
3596 (gnus-remove-thread-1 (car thread))
3597 (setq thread (cdr thread))))
3598 (gnus-summary-show-all-threads)
3599 (gnus-remove-thread-1 thread))))))))
3601 (defun gnus-remove-thread-1 (thread)
3602 "Remove the thread THREAD recursively."
3603 (let ((number (mail-header-number (pop thread)))
3605 (setq thread (reverse thread))
3607 (gnus-remove-thread-1 (pop thread)))
3608 (when (setq d (gnus-data-find number))
3609 (goto-char (gnus-data-pos d))
3612 (- (gnus-point-at-bol)
3614 (1+ (gnus-point-at-eol))
3615 (gnus-delete-line)))))))
3617 (defun gnus-sort-threads (threads)
3619 (if (not gnus-thread-sort-functions)
3621 (gnus-message 8 "Sorting threads...")
3623 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3624 (gnus-message 8 "Sorting threads...done"))))
3626 (defun gnus-sort-articles (articles)
3628 (when gnus-article-sort-functions
3629 (gnus-message 7 "Sorting articles...")
3631 (setq gnus-newsgroup-headers
3632 (sort articles (gnus-make-sort-function
3633 gnus-article-sort-functions)))
3634 (gnus-message 7 "Sorting articles...done"))))
3636 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3637 (defmacro gnus-thread-header (thread)
3638 ;; Return header of first article in THREAD.
3639 ;; Note that THREAD must never, ever be anything else than a variable -
3640 ;; using some other form will lead to serious barfage.
3641 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3642 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3643 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3646 (defsubst gnus-article-sort-by-number (h1 h2)
3647 "Sort articles by article number."
3648 (< (mail-header-number h1)
3649 (mail-header-number h2)))
3651 (defun gnus-thread-sort-by-number (h1 h2)
3652 "Sort threads by root article number."
3653 (gnus-article-sort-by-number
3654 (gnus-thread-header h1) (gnus-thread-header h2)))
3656 (defsubst gnus-article-sort-by-lines (h1 h2)
3657 "Sort articles by article Lines header."
3658 (< (mail-header-lines h1)
3659 (mail-header-lines h2)))
3661 (defun gnus-thread-sort-by-lines (h1 h2)
3662 "Sort threads by root article Lines header."
3663 (gnus-article-sort-by-lines
3664 (gnus-thread-header h1) (gnus-thread-header h2)))
3666 (defsubst gnus-article-sort-by-chars (h1 h2)
3667 "Sort articles by octet length."
3668 (< (mail-header-chars h1)
3669 (mail-header-chars h2)))
3671 (defun gnus-thread-sort-by-chars (h1 h2)
3672 "Sort threads by root article octet length."
3673 (gnus-article-sort-by-chars
3674 (gnus-thread-header h1) (gnus-thread-header h2)))
3676 (defsubst gnus-article-sort-by-author (h1 h2)
3677 "Sort articles by root author."
3679 (let ((addr (car (mime-read-field 'From h1))))
3680 (or (std11-full-name-string addr)
3681 (std11-address-string addr)
3683 (let ((addr (car (mime-read-field 'From h2))))
3684 (or (std11-full-name-string addr)
3685 (std11-address-string addr)
3689 (defun gnus-thread-sort-by-author (h1 h2)
3690 "Sort threads by root author."
3691 (gnus-article-sort-by-author
3692 (gnus-thread-header h1) (gnus-thread-header h2)))
3694 (defsubst gnus-article-sort-by-subject (h1 h2)
3695 "Sort articles by root subject."
3697 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3698 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3700 (defun gnus-thread-sort-by-subject (h1 h2)
3701 "Sort threads by root subject."
3702 (gnus-article-sort-by-subject
3703 (gnus-thread-header h1) (gnus-thread-header h2)))
3705 (defsubst gnus-article-sort-by-date (h1 h2)
3706 "Sort articles by root article date."
3708 (gnus-date-get-time (mail-header-date h1))
3709 (gnus-date-get-time (mail-header-date h2))))
3711 (defun gnus-thread-sort-by-date (h1 h2)
3712 "Sort threads by root article date."
3713 (gnus-article-sort-by-date
3714 (gnus-thread-header h1) (gnus-thread-header h2)))
3716 (defsubst gnus-article-sort-by-score (h1 h2)
3717 "Sort articles by root article score.
3718 Unscored articles will be counted as having a score of zero."
3719 (> (or (cdr (assq (mail-header-number h1)
3720 gnus-newsgroup-scored))
3721 gnus-summary-default-score 0)
3722 (or (cdr (assq (mail-header-number h2)
3723 gnus-newsgroup-scored))
3724 gnus-summary-default-score 0)))
3726 (defun gnus-thread-sort-by-score (h1 h2)
3727 "Sort threads by root article score."
3728 (gnus-article-sort-by-score
3729 (gnus-thread-header h1) (gnus-thread-header h2)))
3731 (defun gnus-thread-sort-by-total-score (h1 h2)
3732 "Sort threads by the sum of all scores in the thread.
3733 Unscored articles will be counted as having a score of zero."
3734 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3736 (defun gnus-thread-total-score (thread)
3737 ;; This function find the total score of THREAD.
3738 (cond ((null thread)
3741 (if (stringp (car thread))
3742 (apply gnus-thread-score-function 0
3743 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3744 (gnus-thread-total-score-1 thread)))
3746 (gnus-thread-total-score-1 (list thread)))))
3748 (defun gnus-thread-total-score-1 (root)
3749 ;; This function find the total score of the thread below ROOT.
3750 (setq root (car root))
3751 (apply gnus-thread-score-function
3753 (mapcar 'gnus-thread-total-score
3754 (cdr (gnus-id-to-thread (mail-header-id root))))
3755 (when (> (mail-header-number root) 0)
3756 (list (or (cdr (assq (mail-header-number root)
3757 gnus-newsgroup-scored))
3758 gnus-summary-default-score 0))))
3759 (list gnus-summary-default-score)
3762 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3763 (defvar gnus-tmp-prev-subject nil)
3764 (defvar gnus-tmp-false-parent nil)
3765 (defvar gnus-tmp-root-expunged nil)
3766 (defvar gnus-tmp-dummy-line nil)
3768 (defvar gnus-tmp-header)
3769 (defun gnus-extra-header (type &optional header)
3770 "Return the extra header of TYPE."
3771 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3774 (defun gnus-summary-prepare-threads (threads)
3775 "Prepare summary buffer from THREADS and indentation LEVEL.
3776 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3777 or a straight list of headers."
3778 (gnus-message 7 "Generating summary...")
3780 (setq gnus-newsgroup-threads threads)
3783 (let ((gnus-tmp-level 0)
3784 (default-score (or gnus-summary-default-score 0))
3785 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3786 thread number subject stack state gnus-tmp-gathered beg-match
3787 new-roots gnus-tmp-new-adopts thread-end
3788 gnus-tmp-header gnus-tmp-unread
3789 gnus-tmp-replied gnus-tmp-subject-or-nil
3790 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3791 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3792 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3794 (setq gnus-tmp-prev-subject nil)
3796 (if (vectorp (car threads))
3797 ;; If this is a straight (sic) list of headers, then a
3798 ;; threaded summary display isn't required, so we just create
3799 ;; an unthreaded one.
3800 (gnus-summary-prepare-unthreaded threads)
3802 ;; Do the threaded display.
3804 (while (or threads stack gnus-tmp-new-adopts new-roots)
3806 (if (and (= gnus-tmp-level 0)
3809 (not gnus-tmp-false-parent)
3810 (or gnus-tmp-new-adopts new-roots))
3811 (if gnus-tmp-new-adopts
3812 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3813 thread (list (car gnus-tmp-new-adopts))
3814 gnus-tmp-header (caar thread)
3815 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3817 (setq thread (list (car new-roots))
3818 gnus-tmp-header (caar thread)
3819 new-roots (cdr new-roots))))
3822 ;; If there are some threads, we do them before the
3823 ;; threads on the stack.
3824 (setq thread threads
3825 gnus-tmp-header (caar thread))
3826 ;; There were no current threads, so we pop something off
3828 (setq state (car stack)
3829 gnus-tmp-level (car state)
3832 gnus-tmp-header (caar thread))))
3834 (setq gnus-tmp-false-parent nil)
3835 (setq gnus-tmp-root-expunged nil)
3836 (setq thread-end nil)
3838 (if (stringp gnus-tmp-header)
3839 ;; The header is a dummy root.
3841 ((eq gnus-summary-make-false-root 'adopt)
3842 ;; We let the first article adopt the rest.
3843 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3845 (setq gnus-tmp-gathered
3847 (lambda (h) (mail-header-number (car h)))
3850 (setq thread (cons (list (caar thread)
3853 (setq gnus-tmp-level -1
3854 gnus-tmp-false-parent t))
3855 ((eq gnus-summary-make-false-root 'empty)
3856 ;; We print adopted articles with empty subject fields.
3857 (setq gnus-tmp-gathered
3859 (lambda (h) (mail-header-number (car h)))
3862 (setq gnus-tmp-level -1))
3863 ((eq gnus-summary-make-false-root 'dummy)
3864 ;; We remember that we probably want to output a dummy
3866 (setq gnus-tmp-dummy-line gnus-tmp-header)
3867 (setq gnus-tmp-prev-subject gnus-tmp-header))
3869 ;; We do not make a root for the gathered
3870 ;; sub-threads at all.
3871 (setq gnus-tmp-level -1)))
3873 (setq number (mail-header-number gnus-tmp-header)
3874 subject (mail-header-subject gnus-tmp-header))
3877 ;; If the thread has changed subject, we might want to make
3878 ;; this subthread into a root.
3879 ((and (null gnus-thread-ignore-subject)
3880 (not (zerop gnus-tmp-level))
3881 gnus-tmp-prev-subject
3883 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3884 (setq new-roots (nconc new-roots (list (car thread)))
3886 gnus-tmp-header nil))
3887 ;; If the article lies outside the current limit,
3888 ;; then we do not display it.
3889 ((not (memq number gnus-newsgroup-limit))
3890 (setq gnus-tmp-gathered
3892 (lambda (h) (mail-header-number (car h)))
3895 (setq gnus-tmp-new-adopts (if (cdar thread)
3896 (append gnus-tmp-new-adopts
3898 gnus-tmp-new-adopts)
3900 gnus-tmp-header nil)
3901 (when (zerop gnus-tmp-level)
3902 (setq gnus-tmp-root-expunged t)))
3903 ;; Perhaps this article is to be marked as read?
3904 ((and gnus-summary-mark-below
3905 (< (or (cdr (assq number gnus-newsgroup-scored))
3907 gnus-summary-mark-below)
3908 ;; Don't touch sparse articles.
3909 (not (gnus-summary-article-sparse-p number))
3910 (not (gnus-summary-article-ancient-p number)))
3911 (setq gnus-newsgroup-unreads
3912 (delq number gnus-newsgroup-unreads))
3913 (if gnus-newsgroup-auto-expire
3914 (push number gnus-newsgroup-expirable)
3915 (push (cons number gnus-low-score-mark)
3916 gnus-newsgroup-reads))))
3918 (when gnus-tmp-header
3919 ;; We may have an old dummy line to output before this
3921 (when (and gnus-tmp-dummy-line
3924 (mail-header-subject gnus-tmp-header)))
3925 (gnus-summary-insert-dummy-line
3926 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3927 (setq gnus-tmp-dummy-line nil))
3929 ;; Compute the mark.
3930 (setq gnus-tmp-unread (gnus-article-mark number))
3932 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3933 gnus-tmp-header gnus-tmp-level)
3934 gnus-newsgroup-data)
3936 ;; Actually insert the line.
3938 gnus-tmp-subject-or-nil
3940 ((and gnus-thread-ignore-subject
3941 gnus-tmp-prev-subject
3942 (not (inline (gnus-subject-equal
3943 gnus-tmp-prev-subject subject))))
3945 ((zerop gnus-tmp-level)
3946 (if (and (eq gnus-summary-make-false-root 'empty)
3947 (memq number gnus-tmp-gathered)
3948 gnus-tmp-prev-subject
3949 (inline (gnus-subject-equal
3950 gnus-tmp-prev-subject subject)))
3951 gnus-summary-same-subject
3953 (t gnus-summary-same-subject)))
3954 (if (and (eq gnus-summary-make-false-root 'adopt)
3955 (= gnus-tmp-level 1)
3956 (memq number gnus-tmp-gathered))
3957 (setq gnus-tmp-opening-bracket ?\<
3958 gnus-tmp-closing-bracket ?\>)
3959 (setq gnus-tmp-opening-bracket ?\[
3960 gnus-tmp-closing-bracket ?\]))
3962 gnus-tmp-indentation
3963 (aref gnus-thread-indent-array gnus-tmp-level)
3964 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3965 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3966 gnus-summary-default-score 0)
3968 (if (or (null gnus-summary-default-score)
3969 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3970 gnus-summary-zcore-fuzz))
3972 (if (< gnus-tmp-score gnus-summary-default-score)
3973 gnus-score-below-mark gnus-score-over-mark))
3975 (cond ((memq number gnus-newsgroup-processable)
3977 ((memq number gnus-newsgroup-cached)
3979 ((memq number gnus-newsgroup-replied)
3981 ((memq number gnus-newsgroup-saved)
3983 (t gnus-unread-mark))
3984 gnus-tmp-from (mail-header-from gnus-tmp-header)
3987 ((string-match "<[^>]+> *$" gnus-tmp-from)
3988 (setq beg-match (match-beginning 0))
3989 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3990 (substring gnus-tmp-from (1+ (match-beginning 0))
3991 (1- (match-end 0))))
3992 (substring gnus-tmp-from 0 beg-match)))
3993 ((string-match "(.+)" gnus-tmp-from)
3994 (substring gnus-tmp-from
3995 (1+ (match-beginning 0)) (1- (match-end 0))))
3997 (when (string= gnus-tmp-name "")
3998 (setq gnus-tmp-name gnus-tmp-from))
3999 (unless (numberp gnus-tmp-lines)
4000 (setq gnus-tmp-lines 0))
4001 (gnus-put-text-property
4003 (progn (eval gnus-summary-line-format-spec) (point))
4004 'gnus-number number)
4007 (gnus-run-hooks 'gnus-summary-update-hook)
4010 (setq gnus-tmp-prev-subject subject)))
4012 (when (nth 1 thread)
4013 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4014 (incf gnus-tmp-level)
4015 (setq threads (if thread-end nil (cdar thread)))
4017 (setq gnus-tmp-level 0)))))
4018 (gnus-message 7 "Generating summary...done"))
4020 (defun gnus-summary-prepare-unthreaded (headers)
4021 "Generate an unthreaded summary buffer based on HEADERS."
4022 (let (header number mark)
4027 ;; We may have to root out some bad articles...
4028 (when (memq (setq number (mail-header-number
4029 (setq header (pop headers))))
4030 gnus-newsgroup-limit)
4031 ;; Mark article as read when it has a low score.
4032 (when (and gnus-summary-mark-below
4033 (< (or (cdr (assq number gnus-newsgroup-scored))
4034 gnus-summary-default-score 0)
4035 gnus-summary-mark-below)
4036 (not (gnus-summary-article-ancient-p number)))
4037 (setq gnus-newsgroup-unreads
4038 (delq number gnus-newsgroup-unreads))
4039 (if gnus-newsgroup-auto-expire
4040 (push number gnus-newsgroup-expirable)
4041 (push (cons number gnus-low-score-mark)
4042 gnus-newsgroup-reads)))
4044 (setq mark (gnus-article-mark number))
4045 (push (gnus-data-make number mark (1+ (point)) header 0)
4046 gnus-newsgroup-data)
4047 (gnus-summary-insert-line
4049 mark (memq number gnus-newsgroup-replied)
4050 (memq number gnus-newsgroup-expirable)
4051 (mail-header-subject header) nil
4052 (cdr (assq number gnus-newsgroup-scored))
4053 (memq number gnus-newsgroup-processable))))))
4055 (defun gnus-summary-remove-list-identifiers ()
4056 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4057 (let ((regexp (if (stringp gnus-list-identifiers)
4058 gnus-list-identifiers
4059 (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)))
5147 ;; Do horizontal recentering while we're at it.
5148 (when (and (get-buffer-window (current-buffer) t)
5149 (not (eq gnus-auto-center-summary 'vertical)))
5150 (let ((selected (selected-window)))
5151 (select-window (get-buffer-window (current-buffer) t))
5152 (gnus-summary-position-point)
5153 (gnus-horizontal-recenter)
5154 (select-window selected))))))
5156 (defun gnus-summary-jump-to-group (newsgroup)
5157 "Move point to NEWSGROUP in group mode buffer."
5158 ;; Keep update point of group mode buffer if visible.
5159 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5160 (save-window-excursion
5161 ;; Take care of tree window mode.
5162 (when (get-buffer-window gnus-group-buffer)
5163 (pop-to-buffer gnus-group-buffer))
5164 (gnus-group-jump-to-group newsgroup))
5166 ;; Take care of tree window mode.
5167 (if (get-buffer-window gnus-group-buffer)
5168 (pop-to-buffer gnus-group-buffer)
5169 (set-buffer gnus-group-buffer))
5170 (gnus-group-jump-to-group newsgroup))))
5172 ;; This function returns a list of article numbers based on the
5173 ;; difference between the ranges of read articles in this group and
5174 ;; the range of active articles.
5175 (defun gnus-list-of-unread-articles (group)
5176 (let* ((read (gnus-info-read (gnus-get-info group)))
5177 (active (or (gnus-active group) (gnus-activate-group group)))
5180 ;; If none are read, then all are unread.
5182 (setq first (car active))
5183 ;; If the range of read articles is a single range, then the
5184 ;; first unread article is the article after the last read
5185 ;; article. Sounds logical, doesn't it?
5186 (if (not (listp (cdr read)))
5187 (setq first (max (car active) (1+ (cdr read))))
5188 ;; `read' is a list of ranges.
5189 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5192 (setq first (car active)))
5195 (while (< first nlast)
5197 (setq first (1+ first))))
5198 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5199 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5200 (setq read (cdr read)))))
5201 ;; And add the last unread articles.
5202 (while (<= first last)
5204 (setq first (1+ first)))
5205 ;; Return the list of unread articles.
5206 (delq 0 (nreverse unread))))
5208 (defun gnus-list-of-read-articles (group)
5209 "Return a list of unread, unticked and non-dormant articles."
5210 (let* ((info (gnus-get-info group))
5211 (marked (gnus-info-marks info))
5212 (active (gnus-active group)))
5214 (gnus-set-difference
5215 (gnus-sorted-complement
5216 (gnus-uncompress-range active)
5217 (gnus-list-of-unread-articles group))
5219 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5220 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5222 ;; Various summary commands
5224 (defun gnus-summary-select-article-buffer ()
5225 "Reconfigure windows to show article buffer."
5227 (if (not (gnus-buffer-live-p gnus-article-buffer))
5228 (error "There is no article buffer for this summary buffer")
5229 (gnus-configure-windows 'article)
5230 (select-window (get-buffer-window gnus-article-buffer))))
5232 (defun gnus-summary-universal-argument (arg)
5233 "Perform any operation on all articles that are process/prefixed."
5235 (let ((articles (gnus-summary-work-articles arg))
5242 (substitute-command-keys
5243 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5246 (gnus-error 1 "Undefined key")
5249 (gnus-summary-goto-subject (setq article (pop articles)))
5250 (let (gnus-newsgroup-processable)
5251 (command-execute func))
5252 (gnus-summary-remove-process-mark article)))))
5253 (gnus-summary-position-point))
5255 (defun gnus-summary-toggle-truncation (&optional arg)
5256 "Toggle truncation of summary lines.
5257 With arg, turn line truncation on iff arg is positive."
5259 (setq truncate-lines
5260 (if (null arg) (not truncate-lines)
5261 (> (prefix-numeric-value arg) 0)))
5264 (defun gnus-summary-reselect-current-group (&optional all rescan)
5265 "Rescan the current newsgroup, exit and then reselect it.
5266 The prefix argument ALL means to select all articles."
5268 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5269 (error "Ephemeral groups can't be reselected"))
5270 (let ((current-subject (gnus-summary-article-number))
5271 (group gnus-newsgroup-name))
5273 (set-buffer gnus-group-buffer)
5274 ;; We have to adjust the point of group mode buffer because
5275 ;; point was moved to the next unread newsgroup by exiting.
5276 (gnus-summary-jump-to-group group)
5279 (gnus-group-get-new-news-this-group 1))))
5280 (setq gnus-newsgroup-begin nil)
5282 (gnus-group-read-group all t group)
5283 (gnus-summary-goto-subject current-subject nil t)))
5285 (defun gnus-summary-rescan-group (&optional all)
5286 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5288 (gnus-summary-reselect-current-group all t))
5290 (defun gnus-summary-update-info (&optional non-destructive)
5292 (let ((group gnus-newsgroup-name))
5294 (when gnus-newsgroup-kill-headers
5295 (setq gnus-newsgroup-killed
5296 (gnus-compress-sequence
5298 (gnus-set-sorted-intersection
5299 (gnus-uncompress-range gnus-newsgroup-killed)
5300 (setq gnus-newsgroup-unselected
5301 (sort gnus-newsgroup-unselected '<)))
5302 (setq gnus-newsgroup-unreads
5303 (sort gnus-newsgroup-unreads '<)))
5305 (unless (listp (cdr gnus-newsgroup-killed))
5306 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5307 (let ((headers gnus-newsgroup-headers))
5308 ;; Set the new ranges of read articles.
5310 (set-buffer gnus-group-buffer)
5311 (gnus-undo-force-boundary))
5312 (gnus-update-read-articles
5313 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5314 ;; Set the current article marks.
5315 (let ((gnus-newsgroup-scored
5316 (if (and (not gnus-save-score)
5317 (not non-destructive))
5319 gnus-newsgroup-scored)))
5321 (gnus-update-marks)))
5322 ;; Do the cross-ref thing.
5323 (when gnus-use-cross-reference
5324 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5325 ;; Do not switch windows but change the buffer to work.
5326 (set-buffer gnus-group-buffer)
5327 (unless (gnus-ephemeral-group-p group)
5328 (gnus-group-update-group group)))))))
5330 (defun gnus-summary-save-newsrc (&optional force)
5331 "Save the current number of read/marked articles in the dribble buffer.
5332 The dribble buffer will then be saved.
5333 If FORCE (the prefix), also save the .newsrc file(s)."
5335 (gnus-summary-update-info t)
5337 (gnus-save-newsrc-file)
5338 (gnus-dribble-save)))
5340 (defun gnus-summary-exit (&optional temporary)
5341 "Exit reading current newsgroup, and then return to group selection mode.
5342 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5344 (gnus-set-global-variables)
5345 (gnus-kill-save-kill-buffer)
5346 (gnus-async-halt-prefetch)
5347 (let* ((group gnus-newsgroup-name)
5348 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5351 (buf (current-buffer)))
5353 ;; Do adaptive scoring, and possibly save score files.
5354 (when gnus-newsgroup-adaptive
5355 (gnus-score-adaptive))
5356 (when gnus-use-scoring
5358 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5359 ;; If we have several article buffers, we kill them at exit.
5360 (unless gnus-single-article-buffer
5361 (gnus-kill-buffer gnus-original-article-buffer)
5362 (setq gnus-article-current nil))
5363 (when gnus-use-cache
5364 (gnus-cache-possibly-remove-articles)
5365 (gnus-cache-save-buffers))
5366 (gnus-async-prefetch-remove-group group)
5367 (when gnus-suppress-duplicates
5368 (gnus-dup-enter-articles))
5369 (when gnus-use-trees
5370 (gnus-tree-close group))
5371 ;; Remove entries for this group.
5372 (nnmail-purge-split-history (gnus-group-real-name group))
5373 ;; Make all changes in this group permanent.
5375 (gnus-run-hooks 'gnus-exit-group-hook)
5376 (gnus-summary-update-info))
5377 (gnus-close-group group)
5378 ;; Make sure where we were, and go to next newsgroup.
5379 (set-buffer gnus-group-buffer)
5381 (gnus-group-jump-to-group group))
5382 (gnus-run-hooks 'gnus-summary-exit-hook)
5383 (unless (or quit-config
5384 ;; If this group has disappeared from the summary
5385 ;; buffer, don't skip forwards.
5386 (not (string= group (gnus-group-group-name))))
5387 (gnus-group-next-unread-group 1))
5388 (setq group-point (point))
5391 ;; If we have several article buffers, we kill them at exit.
5392 (unless gnus-single-article-buffer
5393 (gnus-kill-buffer gnus-article-buffer)
5394 (gnus-kill-buffer gnus-original-article-buffer)
5395 (setq gnus-article-current nil))
5397 (if (not gnus-kill-summary-on-exit)
5398 (gnus-deaden-summary)
5399 ;; We set all buffer-local variables to nil. It is unclear why
5400 ;; this is needed, but if we don't, buffer-local variables are
5401 ;; not garbage-collected, it seems. This would the lead to en
5402 ;; ever-growing Emacs.
5403 (gnus-summary-clear-local-variables)
5404 (when (get-buffer gnus-article-buffer)
5405 (bury-buffer gnus-article-buffer))
5406 ;; We clear the global counterparts of the buffer-local
5407 ;; variables as well, just to be on the safe side.
5408 (set-buffer gnus-group-buffer)
5409 (gnus-summary-clear-local-variables)
5410 ;; Return to group mode buffer.
5411 (when (eq mode 'gnus-summary-mode)
5412 (gnus-kill-buffer buf)))
5413 (setq gnus-current-select-method gnus-select-method)
5414 (pop-to-buffer gnus-group-buffer)
5415 (if (not quit-config)
5417 (goto-char group-point)
5418 (gnus-configure-windows 'group 'force))
5419 (gnus-handle-ephemeral-exit quit-config))
5420 ;; Clear the current group name.
5422 (setq gnus-newsgroup-name nil)))))
5424 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5425 (defun gnus-summary-exit-no-update (&optional no-questions)
5426 "Quit reading current newsgroup without updating read article info."
5428 (let* ((group gnus-newsgroup-name)
5429 (quit-config (gnus-group-quit-config group)))
5430 (when (or no-questions
5432 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5433 (gnus-async-halt-prefetch)
5435 (delq 'gnus-summary-expire-articles
5436 (copy-sequence gnus-summary-prepare-exit-hook)))
5437 ;; If we have several article buffers, we kill them at exit.
5438 (unless gnus-single-article-buffer
5439 (gnus-kill-buffer gnus-article-buffer)
5440 (gnus-kill-buffer gnus-original-article-buffer)
5441 (setq gnus-article-current nil))
5442 (if (not gnus-kill-summary-on-exit)
5443 (gnus-deaden-summary)
5444 (gnus-close-group group)
5445 (gnus-summary-clear-local-variables)
5446 (set-buffer gnus-group-buffer)
5447 (gnus-summary-clear-local-variables)
5448 (when (get-buffer gnus-summary-buffer)
5449 (kill-buffer gnus-summary-buffer)))
5450 (unless gnus-single-article-buffer
5451 (setq gnus-article-current nil))
5452 (when gnus-use-trees
5453 (gnus-tree-close group))
5454 (gnus-async-prefetch-remove-group group)
5455 (when (get-buffer gnus-article-buffer)
5456 (bury-buffer gnus-article-buffer))
5457 ;; Return to the group buffer.
5458 (gnus-configure-windows 'group 'force)
5459 ;; Clear the current group name.
5460 (setq gnus-newsgroup-name nil)
5461 (when (equal (gnus-group-group-name) group)
5462 (gnus-group-next-unread-group 1))
5464 (gnus-handle-ephemeral-exit quit-config)))))
5466 (defun gnus-handle-ephemeral-exit (quit-config)
5467 "Handle movement when leaving an ephemeral group.
5468 The state which existed when entering the ephemeral is reset."
5469 (if (not (buffer-name (car quit-config)))
5470 (gnus-configure-windows 'group 'force)
5471 (set-buffer (car quit-config))
5472 (cond ((eq major-mode 'gnus-summary-mode)
5473 (gnus-set-global-variables))
5474 ((eq major-mode 'gnus-article-mode)
5476 ;; The `gnus-summary-buffer' variable may point
5477 ;; to the old summary buffer when using a single
5479 (unless (gnus-buffer-live-p gnus-summary-buffer)
5480 (set-buffer gnus-group-buffer))
5481 (set-buffer gnus-summary-buffer)
5482 (gnus-set-global-variables))))
5483 (if (or (eq (cdr quit-config) 'article)
5484 (eq (cdr quit-config) 'pick))
5486 ;; The current article may be from the ephemeral group
5487 ;; thus it is best that we reload this article
5488 (gnus-summary-show-article)
5489 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5490 (gnus-configure-windows 'pick 'force)
5491 (gnus-configure-windows (cdr quit-config) 'force)))
5492 (gnus-configure-windows (cdr quit-config) 'force))
5493 (when (eq major-mode 'gnus-summary-mode)
5494 (gnus-summary-next-subject 1 nil t)
5495 (gnus-summary-recenter)
5496 (gnus-summary-position-point))))
5498 (defun gnus-summary-preview-mime-message ()
5499 "MIME decode and play this message."
5501 (let ((gnus-break-pages nil)
5503 (gnus-summary-select-article gnus-show-all-headers t))
5504 (select-window (get-buffer-window gnus-article-buffer)))
5508 (defvar gnus-dead-summary-mode-map nil)
5510 (unless gnus-dead-summary-mode-map
5511 (setq gnus-dead-summary-mode-map (make-keymap))
5512 (suppress-keymap gnus-dead-summary-mode-map)
5513 (substitute-key-definition
5514 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5515 (let ((keys '("\C-d" "\r" "\177" [delete])))
5517 (define-key gnus-dead-summary-mode-map
5518 (pop keys) 'gnus-summary-wake-up-the-dead))))
5520 (defvar gnus-dead-summary-mode nil
5521 "Minor mode for Gnus summary buffers.")
5523 (defun gnus-dead-summary-mode (&optional arg)
5524 "Minor mode for Gnus summary buffers."
5526 (when (eq major-mode 'gnus-summary-mode)
5527 (make-local-variable 'gnus-dead-summary-mode)
5528 (setq gnus-dead-summary-mode
5529 (if (null arg) (not gnus-dead-summary-mode)
5530 (> (prefix-numeric-value arg) 0)))
5531 (when gnus-dead-summary-mode
5532 (gnus-add-minor-mode
5533 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5535 (defun gnus-deaden-summary ()
5536 "Make the current summary buffer into a dead summary buffer."
5537 ;; Kill any previous dead summary buffer.
5538 (when (and gnus-dead-summary
5539 (buffer-name gnus-dead-summary))
5541 (set-buffer gnus-dead-summary)
5542 (when gnus-dead-summary-mode
5543 (kill-buffer (current-buffer)))))
5544 ;; Make this the current dead summary.
5545 (setq gnus-dead-summary (current-buffer))
5546 (gnus-dead-summary-mode 1)
5547 (let ((name (buffer-name)))
5548 (when (string-match "Summary" name)
5550 (concat (substring name 0 (match-beginning 0)) "Dead "
5551 (substring name (match-beginning 0)))
5554 (defun gnus-kill-or-deaden-summary (buffer)
5555 "Kill or deaden the summary BUFFER."
5557 (when (and (buffer-name buffer)
5558 (not gnus-single-article-buffer))
5561 (gnus-kill-buffer gnus-article-buffer)
5562 (gnus-kill-buffer gnus-original-article-buffer)))
5563 (cond (gnus-kill-summary-on-exit
5564 (when (and gnus-use-trees
5565 (gnus-buffer-exists-p buffer))
5568 (gnus-tree-close gnus-newsgroup-name)))
5569 (gnus-kill-buffer buffer))
5570 ((gnus-buffer-exists-p buffer)
5573 (gnus-deaden-summary))))))
5575 (defun gnus-summary-wake-up-the-dead (&rest args)
5576 "Wake up the dead summary buffer."
5578 (gnus-dead-summary-mode -1)
5579 (let ((name (buffer-name)))
5580 (when (string-match "Dead " name)
5582 (concat (substring name 0 (match-beginning 0))
5583 (substring name (match-end 0)))
5585 (gnus-message 3 "This dead summary is now alive again"))
5587 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5588 (defun gnus-summary-fetch-faq (&optional faq-dir)
5589 "Fetch the FAQ for the current group.
5590 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5594 (when current-prefix-arg
5596 "Faq dir: " (and (listp gnus-group-faq-directory)
5597 (mapcar (lambda (file) (list file))
5598 gnus-group-faq-directory))))))
5599 (let (gnus-faq-buffer)
5600 (when (setq gnus-faq-buffer
5601 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5602 (gnus-configure-windows 'summary-faq))))
5604 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5605 (defun gnus-summary-describe-group (&optional force)
5606 "Describe the current newsgroup."
5608 (gnus-group-describe-group force gnus-newsgroup-name))
5610 (defun gnus-summary-describe-briefly ()
5611 "Describe summary mode commands briefly."
5613 (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")))
5615 ;; Walking around group mode buffer from summary mode.
5617 (defun gnus-summary-next-group (&optional no-article target-group backward)
5618 "Exit current newsgroup and then select next unread newsgroup.
5619 If prefix argument NO-ARTICLE is non-nil, no article is selected
5620 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5621 previous group instead."
5623 ;; Stop pre-fetching.
5624 (gnus-async-halt-prefetch)
5625 (let ((current-group gnus-newsgroup-name)
5626 (current-buffer (current-buffer))
5628 ;; First we semi-exit this group to update Xrefs and all variables.
5629 ;; We can't do a real exit, because the window conf must remain
5630 ;; the same in case the user is prompted for info, and we don't
5631 ;; want the window conf to change before that...
5632 (gnus-summary-exit t)
5633 (while (not entered)
5634 ;; Then we find what group we are supposed to enter.
5635 (set-buffer gnus-group-buffer)
5636 (gnus-group-jump-to-group current-group)
5639 (if (eq gnus-keep-same-level 'best)
5640 (gnus-summary-best-group gnus-newsgroup-name)
5641 (gnus-summary-search-group backward gnus-keep-same-level))))
5642 (if (not target-group)
5643 ;; There are no further groups, so we return to the group
5646 (gnus-message 5 "Returning to the group buffer")
5648 (when (gnus-buffer-live-p current-buffer)
5649 (set-buffer current-buffer)
5650 (gnus-summary-exit))
5651 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5652 ;; We try to enter the target group.
5653 (gnus-group-jump-to-group target-group)
5654 (let ((unreads (gnus-group-group-unread)))
5655 (if (and (or (eq t unreads)
5656 (and unreads (not (zerop unreads))))
5657 (gnus-summary-read-group
5658 target-group nil no-article
5659 (and (buffer-name current-buffer) current-buffer)
5662 (setq current-group target-group
5663 target-group nil)))))))
5665 (defun gnus-summary-prev-group (&optional no-article)
5666 "Exit current newsgroup and then select previous unread newsgroup.
5667 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5669 (gnus-summary-next-group no-article nil t))
5671 ;; Walking around summary lines.
5673 (defun gnus-summary-first-subject (&optional unread undownloaded)
5674 "Go to the first unread subject.
5675 If UNREAD is non-nil, go to the first unread article.
5676 Returns the article selected or nil if there are no unread articles."
5681 ((null gnus-newsgroup-data)
5682 (gnus-message 3 "No articles in the group")
5684 ;; Pick the first article.
5686 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5687 (gnus-data-number (car gnus-newsgroup-data)))
5688 ;; No unread articles.
5689 ((null gnus-newsgroup-unreads)
5690 (gnus-message 3 "No more unread articles")
5692 ;; Find the first unread article.
5694 (let ((data gnus-newsgroup-data))
5696 (and (not (and undownloaded
5697 (eq gnus-undownloaded-mark
5698 (gnus-data-mark (car data)))))
5699 (not (gnus-data-unread-p (car data)))))
5700 (setq data (cdr data)))
5702 (goto-char (gnus-data-pos (car data)))
5703 (gnus-data-number (car data))))))
5704 (gnus-summary-position-point)))
5706 (defun gnus-summary-next-subject (n &optional unread dont-display)
5707 "Go to next N'th summary line.
5708 If N is negative, go to the previous N'th subject line.
5709 If UNREAD is non-nil, only unread articles are selected.
5710 The difference between N and the actual number of steps taken is
5713 (let ((backward (< n 0))
5717 (gnus-summary-find-prev unread)
5718 (gnus-summary-find-next unread)))
5719 (gnus-summary-show-thread)
5722 (gnus-message 7 "No more%s articles"
5723 (if unread " unread" "")))
5724 (unless dont-display
5725 (gnus-summary-recenter)
5726 (gnus-summary-position-point))
5729 (defun gnus-summary-next-unread-subject (n)
5730 "Go to next N'th unread summary line."
5732 (gnus-summary-next-subject n t))
5734 (defun gnus-summary-prev-subject (n &optional unread)
5735 "Go to previous N'th summary line.
5736 If optional argument UNREAD is non-nil, only unread article is selected."
5738 (gnus-summary-next-subject (- n) unread))
5740 (defun gnus-summary-prev-unread-subject (n)
5741 "Go to previous N'th unread summary line."
5743 (gnus-summary-next-subject (- n) t))
5745 (defun gnus-summary-goto-subject (article &optional force silent)
5746 "Go the subject line of ARTICLE.
5747 If FORCE, also allow jumping to articles not currently shown."
5748 (interactive "nArticle number: ")
5750 (data (gnus-data-find article)))
5751 ;; We read in the article if we have to.
5754 (gnus-summary-insert-subject
5756 (if (or (numberp force) (vectorp force)) force)
5758 (setq data (gnus-data-find article)))
5763 (gnus-message 3 "Can't find article %d" article))
5765 (goto-char (gnus-data-pos data))
5766 (gnus-summary-position-point)
5769 ;; Walking around summary lines with displaying articles.
5771 (defun gnus-summary-expand-window (&optional arg)
5772 "Make the summary buffer take up the entire Emacs frame.
5773 Given a prefix, will force an `article' buffer configuration."
5776 (gnus-configure-windows 'article 'force)
5777 (gnus-configure-windows 'summary 'force)))
5779 (defun gnus-summary-display-article (article &optional all-header)
5780 "Display ARTICLE in article buffer."
5781 (gnus-set-global-variables)
5785 (if gnus-summary-display-article-function
5786 (funcall gnus-summary-display-article-function article all-header)
5787 (gnus-article-prepare article all-header))
5788 (with-current-buffer gnus-article-buffer
5789 (set (make-local-variable 'gnus-summary-search-article-matched-data)
5791 (gnus-run-hooks 'gnus-select-article-hook)
5792 (when (and gnus-current-article
5793 (not (zerop gnus-current-article)))
5794 (gnus-summary-goto-subject gnus-current-article))
5795 (gnus-summary-recenter)
5796 (when (and gnus-use-trees gnus-show-threads)
5797 (gnus-possibly-generate-tree article)
5798 (gnus-highlight-selected-tree article))
5799 ;; Successfully display article.
5800 (gnus-article-set-window-start
5801 (cdr (assq article gnus-newsgroup-bookmarks))))))
5803 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5804 "Select the current article.
5805 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5806 non-nil, the article will be re-fetched even if it already present in
5807 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5809 ;; Make sure we are in the summary buffer to work around bbdb bug.
5810 (unless (eq major-mode 'gnus-summary-mode)
5811 (set-buffer gnus-summary-buffer))
5812 (let ((article (or article (gnus-summary-article-number)))
5813 (all-headers (not (not all-headers))) ;Must be T or NIL.
5814 gnus-summary-display-article-function
5817 (gnus-summary-article-pseudo-p article)
5818 (error "This is a pseudo-article"))
5821 (set-buffer gnus-summary-buffer)
5822 (if (or (and gnus-single-article-buffer
5823 (or (null gnus-current-article)
5824 (null gnus-article-current)
5825 (null (get-buffer gnus-article-buffer))
5826 (not (eq article (cdr gnus-article-current)))
5827 (not (equal (car gnus-article-current)
5828 gnus-newsgroup-name))))
5829 (and (not gnus-single-article-buffer)
5830 (or (null gnus-current-article)
5831 (not (eq gnus-current-article article))))
5833 ;; The requested article is different from the current article.
5835 (gnus-summary-display-article article all-headers)
5837 (when (or all-headers gnus-show-all-headers)
5838 (if (eq 'gnus-summary-toggle-mime this-command)
5839 (gnus-article-show-all)
5840 (gnus-article-show-all-headers))))
5841 (when (or all-headers gnus-show-all-headers)
5842 (gnus-article-show-all-headers))
5845 (gnus-article-set-window-start
5846 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5848 (defun gnus-summary-set-current-mark (&optional current-mark)
5849 "Obsolete function."
5852 (defun gnus-summary-next-article (&optional unread subject backward push)
5853 "Select the next article.
5854 If UNREAD, only unread articles are selected.
5855 If SUBJECT, only articles with SUBJECT are selected.
5856 If BACKWARD, the previous article is selected instead of the next."
5859 ;; Is there such an article?
5860 ((and (gnus-summary-search-forward unread subject backward)
5861 (or (gnus-summary-display-article (gnus-summary-article-number))
5862 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5863 (gnus-summary-position-point))
5864 ;; If not, we try the first unread, if that is wanted.
5866 gnus-auto-select-same
5867 (gnus-summary-first-unread-article))
5868 (gnus-summary-position-point)
5869 (gnus-message 6 "Wrapped"))
5870 ;; Try to get next/previous article not displayed in this group.
5871 ((and gnus-auto-extend-newsgroup
5872 (not unread) (not subject))
5873 (gnus-summary-goto-article
5874 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5875 nil (count-lines (point-min) (point))))
5876 ;; Go to next/previous group.
5878 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5879 (gnus-summary-jump-to-group gnus-newsgroup-name))
5880 (let ((cmd last-command-char)
5883 (set-buffer gnus-group-buffer)
5886 (if (eq gnus-keep-same-level 'best)
5887 (gnus-summary-best-group gnus-newsgroup-name)
5888 (gnus-summary-search-group backward gnus-keep-same-level))))
5889 ;; For some reason, the group window gets selected. We change
5891 (select-window (get-buffer-window (current-buffer)))
5892 ;; Select next unread newsgroup automagically.
5894 ((or (not gnus-auto-select-next)
5896 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5897 ((or (eq gnus-auto-select-next 'quietly)
5898 (and (eq gnus-auto-select-next 'slightly-quietly)
5900 (and (eq gnus-auto-select-next 'almost-quietly)
5901 (gnus-summary-last-article-p)))
5903 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5905 (gnus-message 7 "No more%s articles (%s)..."
5906 (if unread " unread" "")
5907 (if group (concat "selecting " group)
5909 (gnus-summary-next-group nil group backward)))
5911 (when (gnus-key-press-event-p last-input-event)
5912 (gnus-summary-walk-group-buffer
5913 gnus-newsgroup-name cmd unread backward point))))))))
5915 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5916 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5917 (?\C-p (gnus-group-prev-unread-group 1))))
5918 (cursor-in-echo-area t)
5919 keve key group ended)
5921 (set-buffer gnus-group-buffer)
5924 (if (eq gnus-keep-same-level 'best)
5925 (gnus-summary-best-group gnus-newsgroup-name)
5926 (gnus-summary-search-group backward gnus-keep-same-level))))
5929 5 "No more%s articles%s" (if unread " unread" "")
5931 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5932 (format " (Type %s for %s [%s])"
5933 (single-key-description cmd) group
5934 (car (gnus-gethash group gnus-newsrc-hashtb)))
5935 (format " (Type %s to exit %s)"
5936 (single-key-description cmd)
5937 gnus-newsgroup-name)))
5938 ;; Confirm auto selection.
5939 (setq key (car (setq keve (gnus-read-event-char))))
5942 ((assq key keystrokes)
5943 (let ((obuf (current-buffer)))
5944 (switch-to-buffer gnus-group-buffer)
5946 (gnus-group-jump-to-group group))
5947 (eval (cadr (assq key keystrokes)))
5948 (setq group (gnus-group-group-name))
5949 (switch-to-buffer obuf))
5953 (gnus-ephemeral-group-p gnus-newsgroup-name))
5955 (gnus-summary-next-group nil group backward)))
5957 (push (cdr keve) unread-command-events))))))
5959 (defun gnus-summary-next-unread-article ()
5960 "Select unread article after current one."
5962 (gnus-summary-next-article
5963 (or (not (eq gnus-summary-goto-unread 'never))
5964 (gnus-summary-last-article-p (gnus-summary-article-number)))
5965 (and gnus-auto-select-same
5966 (gnus-summary-article-subject))))
5968 (defun gnus-summary-prev-article (&optional unread subject)
5969 "Select the article after the current one.
5970 If UNREAD is non-nil, only unread articles are selected."
5972 (gnus-summary-next-article unread subject t))
5974 (defun gnus-summary-prev-unread-article ()
5975 "Select unread article before current one."
5977 (gnus-summary-prev-article
5978 (or (not (eq gnus-summary-goto-unread 'never))
5979 (gnus-summary-first-article-p (gnus-summary-article-number)))
5980 (and gnus-auto-select-same
5981 (gnus-summary-article-subject))))
5983 (defun gnus-summary-next-page (&optional lines circular)
5984 "Show next page of the selected article.
5985 If at the end of the current article, select the next article.
5986 LINES says how many lines should be scrolled up.
5988 If CIRCULAR is non-nil, go to the start of the article instead of
5989 selecting the next article when reaching the end of the current
5992 (setq gnus-summary-buffer (current-buffer))
5993 (gnus-set-global-variables)
5994 (let ((article (gnus-summary-article-number))
5995 (article-window (get-buffer-window gnus-article-buffer t))
5997 ;; If the buffer is empty, we have no article.
5999 (error "No article to select"))
6000 (gnus-configure-windows 'article)
6001 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6002 (if (and (eq gnus-summary-goto-unread 'never)
6003 (not (gnus-summary-last-article-p article)))
6004 (gnus-summary-next-article)
6005 (gnus-summary-next-unread-article))
6006 (if (or (null gnus-current-article)
6007 (null gnus-article-current)
6008 (/= article (cdr gnus-article-current))
6009 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6010 ;; Selected subject is different from current article's.
6011 (gnus-summary-display-article article)
6012 (when article-window
6013 (gnus-eval-in-buffer-window gnus-article-buffer
6014 (setq endp (gnus-article-next-page lines)))
6017 (gnus-summary-beginning-of-article))
6019 (gnus-message 3 "End of message"))
6021 (if (and (eq gnus-summary-goto-unread 'never)
6022 (not (gnus-summary-last-article-p article)))
6023 (gnus-summary-next-article)
6024 (gnus-summary-next-unread-article))))))))
6025 (gnus-summary-recenter)
6026 (gnus-summary-position-point)))
6028 (defun gnus-summary-prev-page (&optional lines move)
6029 "Show previous page of selected article.
6030 Argument LINES specifies lines to be scrolled down.
6031 If MOVE, move to the previous unread article if point is at
6032 the beginning of the buffer."
6034 (let ((article (gnus-summary-article-number))
6035 (article-window (get-buffer-window gnus-article-buffer t))
6037 (gnus-configure-windows 'article)
6038 (if (or (null gnus-current-article)
6039 (null gnus-article-current)
6040 (/= article (cdr gnus-article-current))
6041 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6042 ;; Selected subject is different from current article's.
6043 (gnus-summary-display-article article)
6044 (gnus-summary-recenter)
6045 (when article-window
6046 (gnus-eval-in-buffer-window gnus-article-buffer
6047 (setq endp (gnus-article-prev-page lines)))
6048 (when (and move endp)
6050 (gnus-message 3 "Beginning of message"))
6052 (if (and (eq gnus-summary-goto-unread 'never)
6053 (not (gnus-summary-first-article-p article)))
6054 (gnus-summary-prev-article)
6055 (gnus-summary-prev-unread-article))))))))
6056 (gnus-summary-position-point))
6058 (defun gnus-summary-prev-page-or-article (&optional lines)
6059 "Show previous page of selected article.
6060 Argument LINES specifies lines to be scrolled down.
6061 If at the beginning of the article, go to the next article."
6063 (gnus-summary-prev-page lines t))
6065 (defun gnus-summary-scroll-up (lines)
6066 "Scroll up (or down) one line current article.
6067 Argument LINES specifies lines to be scrolled up (or down if negative)."
6069 (gnus-configure-windows 'article)
6070 (gnus-summary-show-thread)
6071 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6072 (gnus-eval-in-buffer-window gnus-article-buffer
6074 (when (gnus-article-next-page lines)
6075 (gnus-message 3 "End of message")))
6077 (gnus-article-prev-page (- lines))))))
6078 (gnus-summary-recenter)
6079 (gnus-summary-position-point))
6081 (defun gnus-summary-scroll-down (lines)
6082 "Scroll down (or up) one line current article.
6083 Argument LINES specifies lines to be scrolled down (or up if negative)."
6085 (gnus-summary-scroll-up (- lines)))
6087 (defun gnus-summary-next-same-subject ()
6088 "Select next article which has the same subject as current one."
6090 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6092 (defun gnus-summary-prev-same-subject ()
6093 "Select previous article which has the same subject as current one."
6095 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6097 (defun gnus-summary-next-unread-same-subject ()
6098 "Select next unread article which has the same subject as current one."
6100 (gnus-summary-next-article t (gnus-summary-article-subject)))
6102 (defun gnus-summary-prev-unread-same-subject ()
6103 "Select previous unread article which has the same subject as current one."
6105 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6107 (defun gnus-summary-first-unread-article ()
6108 "Select the first unread article.
6109 Return nil if there are no unread articles."
6112 (when (gnus-summary-first-subject t)
6113 (gnus-summary-show-thread)
6114 (gnus-summary-first-subject t)
6115 (gnus-summary-display-article (gnus-summary-article-number)))
6116 (gnus-summary-position-point)))
6118 (defun gnus-summary-first-unread-subject ()
6119 "Place the point on the subject line of the first unread article.
6120 Return nil if there are no unread articles."
6123 (when (gnus-summary-first-subject t)
6124 (gnus-summary-show-thread)
6125 (gnus-summary-first-subject t))
6126 (gnus-summary-position-point)))
6128 (defun gnus-summary-first-article ()
6129 "Select the first article.
6130 Return nil if there are no articles."
6133 (when (gnus-summary-first-subject)
6134 (gnus-summary-show-thread)
6135 (gnus-summary-first-subject)
6136 (gnus-summary-display-article (gnus-summary-article-number)))
6137 (gnus-summary-position-point)))
6139 (defun gnus-summary-best-unread-article ()
6140 "Select the unread article with the highest score."
6142 (let ((best -1000000)
6143 (data gnus-newsgroup-data)
6146 (and (gnus-data-unread-p (car data))
6148 (gnus-summary-article-score (gnus-data-number (car data))))
6151 article (gnus-data-number (car data))))
6152 (setq data (cdr data)))
6155 (gnus-summary-goto-article article)
6156 (error "No unread articles"))
6157 (gnus-summary-position-point))))
6159 (defun gnus-summary-last-subject ()
6160 "Go to the last displayed subject line in the group."
6161 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6163 (gnus-summary-goto-subject article))))
6165 (defun gnus-summary-goto-article (article &optional all-headers force)
6166 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6167 If ALL-HEADERS is non-nil, no header lines are hidden.
6168 If FORCE, go to the article even if it isn't displayed. If FORCE
6169 is a number, it is the line the article is to be displayed on."
6173 "Article number or Message-ID: "
6174 (mapcar (lambda (number) (list (int-to-string number)))
6175 gnus-newsgroup-limit))
6179 (if (and (stringp article)
6180 (string-match "@" article))
6181 (gnus-summary-refer-article article)
6182 (when (stringp article)
6183 (setq article (string-to-number article)))
6184 (if (gnus-summary-goto-subject article force)
6185 (gnus-summary-display-article article all-headers)
6186 (gnus-message 4 "Couldn't go to article %s" article) nil))
6187 (gnus-summary-position-point)))
6189 (defun gnus-summary-goto-last-article ()
6190 "Go to the previously read article."
6193 (when gnus-last-article
6194 (gnus-summary-goto-article gnus-last-article nil t))
6195 (gnus-summary-position-point)))
6197 (defun gnus-summary-pop-article (number)
6198 "Pop one article off the history and go to the previous.
6199 NUMBER articles will be popped off."
6202 (setq gnus-newsgroup-history
6203 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6205 (gnus-summary-goto-article (car to) nil t)
6206 (error "Article history empty")))
6207 (gnus-summary-position-point))
6209 ;; Summary commands and functions for limiting the summary buffer.
6211 (defun gnus-summary-limit-to-articles (n)
6212 "Limit the summary buffer to the next N articles.
6213 If not given a prefix, use the process marked articles instead."
6216 (let ((articles (gnus-summary-work-articles n)))
6217 (setq gnus-newsgroup-processable nil)
6218 (gnus-summary-limit articles))
6219 (gnus-summary-position-point)))
6221 (defun gnus-summary-pop-limit (&optional total)
6222 "Restore the previous limit.
6223 If given a prefix, remove all limits."
6226 (setq gnus-newsgroup-limits
6227 (list (mapcar (lambda (h) (mail-header-number h))
6228 gnus-newsgroup-headers))))
6229 (unless gnus-newsgroup-limits
6230 (error "No limit to pop"))
6232 (gnus-summary-limit nil 'pop)
6233 (gnus-summary-position-point)))
6235 (defun gnus-summary-limit-to-subject (subject &optional header)
6236 "Limit the summary buffer to articles that have subjects that match a regexp."
6237 (interactive "sLimit to subject (regexp): ")
6239 (setq header "subject"))
6240 (when (not (equal "" subject))
6242 (let ((articles (gnus-summary-find-matching
6243 (or header "subject") subject 'all)))
6245 (error "Found no matches for \"%s\"" subject))
6246 (gnus-summary-limit articles))
6247 (gnus-summary-position-point))))
6249 (defun gnus-summary-limit-to-author (from)
6250 "Limit the summary buffer to articles that have authors that match a regexp."
6251 (interactive "sLimit to author (regexp): ")
6252 (gnus-summary-limit-to-subject from "from"))
6254 (defun gnus-summary-limit-to-age (age &optional younger-p)
6255 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6256 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6257 articles that are younger than AGE days."
6259 (let ((younger current-prefix-arg)
6262 (while (not days-got)
6263 (setq days (if younger
6264 (read-string "Limit to articles within (in days): ")
6265 (read-string "Limit to articles old than (in days): ")))
6266 (when (> (length days) 0)
6267 (setq days (read days)))
6270 (message "Please enter a number.")
6272 (list days younger)))
6274 (let ((data gnus-newsgroup-data)
6275 (cutoff (days-to-time age))
6276 articles d date is-younger)
6277 (while (setq d (pop data))
6278 (when (and (vectorp (gnus-data-header d))
6279 (setq date (mail-header-date (gnus-data-header d))))
6280 (setq is-younger (time-less-p
6281 (time-since (condition-case ()
6288 (push (gnus-data-number d) articles))))
6289 (gnus-summary-limit (nreverse articles)))
6290 (gnus-summary-position-point)))
6292 (defun gnus-summary-limit-to-extra (header regexp)
6293 "Limit the summary buffer to articles that match an 'extra' header."
6297 (gnus-completing-read
6298 (symbol-name (car gnus-extra-headers))
6299 "Limit extra header:"
6301 (cons (symbol-name x) x))
6306 (read-string (format "Limit to header %s (regexp): " header)))))
6307 (when (not (equal "" regexp))
6309 (let ((articles (gnus-summary-find-matching
6310 (cons 'extra header) regexp 'all)))
6312 (error "Found no matches for \"%s\"" regexp))
6313 (gnus-summary-limit articles))
6314 (gnus-summary-position-point))))
6316 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6318 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6320 (defun gnus-summary-limit-to-unread (&optional all)
6321 "Limit the summary buffer to articles that are not marked as read.
6322 If ALL is non-nil, limit strictly to unread articles."
6325 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6326 (gnus-summary-limit-to-marks
6327 ;; Concat all the marks that say that an article is read and have
6329 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6330 gnus-killed-mark gnus-kill-file-mark
6331 gnus-low-score-mark gnus-expirable-mark
6332 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6333 gnus-duplicate-mark gnus-souped-mark)
6336 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6337 (make-obsolete 'gnus-summary-delete-marked-with
6338 'gnus-summary-limit-exlude-marks)
6340 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6341 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6342 If REVERSE, limit the summary buffer to articles that are marked
6343 with MARKS. MARKS can either be a string of marks or a list of marks.
6344 Returns how many articles were removed."
6345 (interactive "sMarks: ")
6346 (gnus-summary-limit-to-marks marks t))
6348 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6349 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6350 If REVERSE (the prefix), limit the summary buffer to articles that are
6351 not marked with MARKS. MARKS can either be a string of marks or a
6353 Returns how many articles were removed."
6354 (interactive "sMarks: \nP")
6356 (let ((data gnus-newsgroup-data)
6357 (marks (if (listp marks) marks
6358 (append marks nil))) ; Transform to list.
6361 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6362 (memq (gnus-data-mark (car data)) marks))
6363 (push (gnus-data-number (car data)) articles))
6364 (setq data (cdr data)))
6365 (gnus-summary-limit articles))
6366 (gnus-summary-position-point)))
6368 (defun gnus-summary-limit-to-score (&optional score)
6369 "Limit to articles with score at or above SCORE."
6371 (setq score (if score
6372 (prefix-numeric-value score)
6373 (or gnus-summary-default-score 0)))
6374 (let ((data gnus-newsgroup-data)
6377 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6379 (push (gnus-data-number (car data)) articles))
6380 (setq data (cdr data)))
6382 (gnus-summary-limit articles)
6383 (gnus-summary-position-point))))
6385 (defun gnus-summary-limit-include-thread (id)
6386 "Display all the hidden articles that in the current thread."
6387 (interactive (list (mail-header-id (gnus-summary-article-header))))
6388 (let ((articles (gnus-articles-in-thread
6389 (gnus-id-to-thread (gnus-root-id id)))))
6391 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6392 (gnus-summary-position-point))))
6394 (defun gnus-summary-limit-include-dormant ()
6395 "Display all the hidden articles that are marked as dormant.
6396 Note that this command only works on a subset of the articles currently
6397 fetched for this group."
6399 (unless gnus-newsgroup-dormant
6400 (error "There are no dormant articles in this group"))
6402 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6403 (gnus-summary-position-point)))
6405 (defun gnus-summary-limit-exclude-dormant ()
6406 "Hide all dormant articles."
6409 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6410 (gnus-summary-position-point)))
6412 (defun gnus-summary-limit-exclude-childless-dormant ()
6413 "Hide all dormant articles that have no children."
6415 (let ((data (gnus-data-list t))
6416 articles d children)
6417 ;; Find all articles that are either not dormant or have
6419 (while (setq d (pop data))
6420 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6422 (gnus-article-children (gnus-data-number d)))
6425 (when (memq (car children) articles)
6430 (push (gnus-data-number d) articles)))
6433 (gnus-summary-limit articles)
6434 (gnus-summary-position-point))))
6436 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6437 "Mark all unread excluded articles as read.
6438 If ALL, mark even excluded ticked and dormants as read."
6440 (let ((articles (gnus-sorted-complement
6442 (mapcar (lambda (h) (mail-header-number h))
6443 gnus-newsgroup-headers)
6445 (sort gnus-newsgroup-limit '<)))
6447 (setq gnus-newsgroup-unreads
6448 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6450 (setq gnus-newsgroup-dormant nil
6451 gnus-newsgroup-marked nil
6452 gnus-newsgroup-reads
6454 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6455 gnus-newsgroup-reads))
6456 (while (setq article (pop articles))
6457 (unless (or (memq article gnus-newsgroup-dormant)
6458 (memq article gnus-newsgroup-marked))
6459 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6461 (defun gnus-summary-limit (articles &optional pop)
6463 ;; We pop the previous limit off the stack and use that.
6464 (setq articles (car gnus-newsgroup-limits)
6465 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6466 ;; We use the new limit, so we push the old limit on the stack.
6467 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6469 (setq gnus-newsgroup-limit articles)
6470 (let ((total (length gnus-newsgroup-data))
6471 (data (gnus-data-find-list (gnus-summary-article-number)))
6472 (gnus-summary-mark-below nil) ; Inhibit this.
6474 ;; This will do all the work of generating the new summary buffer
6475 ;; according to the new limit.
6476 (gnus-summary-prepare)
6477 ;; Hide any threads, possibly.
6478 (and gnus-show-threads
6479 gnus-thread-hide-subtree
6480 (gnus-summary-hide-all-threads))
6481 ;; Try to return to the article you were at, or one in the
6484 ;; We try to find some article after the current one.
6486 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6489 (setq data (cdr data))))
6491 ;; If there is no data, that means that we were after the last
6492 ;; article. The same goes when we can't find any articles
6493 ;; after the current one.
6494 (goto-char (point-max))
6495 (gnus-summary-find-prev))
6496 (gnus-set-mode-line 'summary)
6497 ;; We return how many articles were removed from the summary
6498 ;; buffer as a result of the new limit.
6499 (- total (length gnus-newsgroup-data))))
6501 (defsubst gnus-invisible-cut-children (threads)
6504 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6509 (defsubst gnus-cut-thread (thread)
6510 "Go forwards in the thread until we find an article that we want to display."
6511 (when (or (eq gnus-fetch-old-headers 'some)
6512 (eq gnus-fetch-old-headers 'invisible)
6513 (numberp gnus-fetch-old-headers)
6514 (eq gnus-build-sparse-threads 'some)
6515 (eq gnus-build-sparse-threads 'more))
6516 ;; Deal with old-fetched headers and sparse threads.
6520 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6521 (gnus-summary-article-ancient-p
6522 (mail-header-number (car thread))))
6523 (if (or (<= (length (cdr thread)) 1)
6524 (eq gnus-fetch-old-headers 'invisible))
6525 (setq gnus-newsgroup-limit
6526 (delq (mail-header-number (car thread))
6527 gnus-newsgroup-limit)
6528 thread (cadr thread))
6529 (when (gnus-invisible-cut-children (cdr thread))
6530 (let ((th (cdr thread)))
6532 (if (memq (mail-header-number (caar th))
6533 gnus-newsgroup-limit)
6534 (setq thread (car th)
6536 (setq th (cdr th))))))))))
6539 (defun gnus-cut-threads (threads)
6540 "Cut off all uninteresting articles from the beginning of threads."
6541 (when (or (eq gnus-fetch-old-headers 'some)
6542 (eq gnus-fetch-old-headers 'invisible)
6543 (numberp gnus-fetch-old-headers)
6544 (eq gnus-build-sparse-threads 'some)
6545 (eq gnus-build-sparse-threads 'more))
6548 (setcar th (gnus-cut-thread (car th)))
6549 (setq th (cdr th)))))
6550 ;; Remove nixed out threads.
6553 (defun gnus-summary-initial-limit (&optional show-if-empty)
6554 "Figure out what the initial limit is supposed to be on group entry.
6555 This entails weeding out unwanted dormants, low-scored articles,
6556 fetch-old-headers verbiage, and so on."
6557 ;; Most groups have nothing to remove.
6558 (if (or gnus-inhibit-limiting
6559 (and (null gnus-newsgroup-dormant)
6560 (not (eq gnus-fetch-old-headers 'some))
6561 (not (numberp gnus-fetch-old-headers))
6562 (not (eq gnus-fetch-old-headers 'invisible))
6563 (null gnus-summary-expunge-below)
6564 (not (eq gnus-build-sparse-threads 'some))
6565 (not (eq gnus-build-sparse-threads 'more))
6566 (null gnus-thread-expunge-below)
6567 (not gnus-use-nocem)))
6569 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6570 (setq gnus-newsgroup-limit nil)
6573 (unless (car (symbol-value node))
6574 ;; These threads have no parents -- they are roots.
6575 (let ((nodes (cdr (symbol-value node)))
6578 (if (and gnus-thread-expunge-below
6579 (< (gnus-thread-total-score (car nodes))
6580 gnus-thread-expunge-below))
6581 (gnus-expunge-thread (pop nodes))
6582 (setq thread (pop nodes))
6583 (gnus-summary-limit-children thread))))))
6584 gnus-newsgroup-dependencies)
6585 ;; If this limitation resulted in an empty group, we might
6586 ;; pop the previous limit and use it instead.
6587 (when (and (not gnus-newsgroup-limit)
6589 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6590 gnus-newsgroup-limit))
6592 (defun gnus-summary-limit-children (thread)
6593 "Return 1 if this subthread is visible and 0 if it is not."
6594 ;; First we get the number of visible children to this thread. This
6595 ;; is done by recursing down the thread using this function, so this
6596 ;; will really go down to a leaf article first, before slowly
6597 ;; working its way up towards the root.
6601 (apply '+ (mapcar 'gnus-summary-limit-children
6604 (number (mail-header-number (car thread)))
6607 (not (memq number gnus-newsgroup-marked))
6609 ;; If this article is dormant and has absolutely no visible
6610 ;; children, then this article isn't visible.
6611 (and (memq number gnus-newsgroup-dormant)
6613 ;; If this is "fetch-old-headered" and there is no
6614 ;; visible children, then we don't want this article.
6615 (and (or (eq gnus-fetch-old-headers 'some)
6616 (numberp gnus-fetch-old-headers))
6617 (gnus-summary-article-ancient-p number)
6619 ;; If this is "fetch-old-headered" and `invisible', then
6620 ;; we don't want this article.
6621 (and (eq gnus-fetch-old-headers 'invisible)
6622 (gnus-summary-article-ancient-p number))
6623 ;; If this is a sparsely inserted article with no children,
6624 ;; we don't want it.
6625 (and (eq gnus-build-sparse-threads 'some)
6626 (gnus-summary-article-sparse-p number)
6628 ;; If we use expunging, and this article is really
6629 ;; low-scored, then we don't want this article.
6630 (when (and gnus-summary-expunge-below
6632 (or (cdr (assq number gnus-newsgroup-scored))
6633 gnus-summary-default-score))
6634 gnus-summary-expunge-below))
6635 ;; We increase the expunge-tally here, but that has
6636 ;; nothing to do with the limits, really.
6637 (incf gnus-newsgroup-expunged-tally)
6638 ;; We also mark as read here, if that's wanted.
6639 (when (and gnus-summary-mark-below
6640 (< score gnus-summary-mark-below))
6641 (setq gnus-newsgroup-unreads
6642 (delq number gnus-newsgroup-unreads))
6643 (if gnus-newsgroup-auto-expire
6644 (push number gnus-newsgroup-expirable)
6645 (push (cons number gnus-low-score-mark)
6646 gnus-newsgroup-reads)))
6648 ;; Check NoCeM things.
6649 (if (and gnus-use-nocem
6650 (gnus-nocem-unwanted-article-p
6651 (mail-header-id (car thread))))
6653 (setq gnus-newsgroup-unreads
6654 (delq number gnus-newsgroup-unreads))
6656 ;; Nope, invisible article.
6658 ;; Ok, this article is to be visible, so we add it to the limit
6660 (push number gnus-newsgroup-limit)
6663 (defun gnus-expunge-thread (thread)
6664 "Mark all articles in THREAD as read."
6665 (let* ((number (mail-header-number (car thread))))
6666 (incf gnus-newsgroup-expunged-tally)
6667 ;; We also mark as read here, if that's wanted.
6668 (setq gnus-newsgroup-unreads
6669 (delq number gnus-newsgroup-unreads))
6670 (if gnus-newsgroup-auto-expire
6671 (push number gnus-newsgroup-expirable)
6672 (push (cons number gnus-low-score-mark)
6673 gnus-newsgroup-reads)))
6674 ;; Go recursively through all subthreads.
6675 (mapcar 'gnus-expunge-thread (cdr thread)))
6677 ;; Summary article oriented commands
6679 (defun gnus-summary-refer-parent-article (n)
6680 "Refer parent article N times.
6681 If N is negative, go to ancestor -N instead.
6682 The difference between N and the number of articles fetched is returned."
6686 (when (not (natnump n))
6691 (setq header (gnus-summary-article-header))
6692 (if (and (eq (mail-header-number header)
6693 (cdr gnus-article-current))
6694 (equal gnus-newsgroup-name
6695 (car gnus-article-current)))
6696 ;; If we try to find the parent of the currently
6697 ;; displayed article, then we take a look at the actual
6698 ;; References header, since this is slightly more
6699 ;; reliable than the References field we got from the
6702 (set-buffer gnus-original-article-buffer)
6703 (nnheader-narrow-to-headers)
6704 (unless (setq ref (message-fetch-field "references"))
6705 (setq ref (message-fetch-field "in-reply-to")))
6708 ;; It's not the current article, so we take a bet on
6709 ;; the value we got from the server.
6710 (mail-header-references header)))
6712 (not (equal ref "")))
6713 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6714 (gnus-message 1 "Couldn't find parent"))
6715 (gnus-message 1 "No references in article %d"
6716 (gnus-summary-article-number))
6719 (gnus-summary-position-point)
6722 (defun gnus-summary-refer-references ()
6723 "Fetch all articles mentioned in the References header.
6724 Return the number of articles fetched."
6726 (let ((ref (mail-header-references (gnus-summary-article-header)))
6727 (current (gnus-summary-article-number))
6731 (error "No References in the current article")
6732 ;; For each Message-ID in the References header...
6733 (while (string-match "<[^>]*>" ref)
6735 ;; ... fetch that article.
6736 (gnus-summary-refer-article
6737 (prog1 (match-string 0 ref)
6738 (setq ref (substring ref (match-end 0))))))
6739 (gnus-summary-goto-subject current)
6740 (gnus-summary-position-point)
6743 (defun gnus-summary-refer-thread (&optional limit)
6744 "Fetch all articles in the current thread.
6745 If LIMIT (the numerical prefix), fetch that many old headers instead
6746 of what's specified by the `gnus-refer-thread-limit' variable."
6748 (let ((id (mail-header-id (gnus-summary-article-header)))
6749 (limit (if limit (prefix-numeric-value limit)
6750 gnus-refer-thread-limit)))
6751 ;; We want to fetch LIMIT *old* headers, but we also have to
6752 ;; re-fetch all the headers in the current buffer, because many of
6753 ;; them may be undisplayed. So we adjust LIMIT.
6754 (when (numberp limit)
6755 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6756 (unless (eq gnus-fetch-old-headers 'invisible)
6757 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6758 ;; Retrieve the headers and read them in.
6759 (if (eq (gnus-retrieve-headers
6760 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6762 (gnus-build-all-threads)
6763 (error "Can't fetch thread from backends that don't support NOV"))
6764 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6765 (gnus-summary-limit-include-thread id)))
6767 (defun gnus-summary-refer-article (message-id)
6768 "Fetch an article specified by MESSAGE-ID."
6769 (interactive "sMessage-ID: ")
6770 (when (and (stringp message-id)
6771 (not (zerop (length message-id))))
6772 ;; Construct the correct Message-ID if necessary.
6773 ;; Suggested by tale@pawl.rpi.edu.
6774 (unless (string-match "^<" message-id)
6775 (setq message-id (concat "<" message-id)))
6776 (unless (string-match ">$" message-id)
6777 (setq message-id (concat message-id ">")))
6778 (let* ((header (gnus-id-to-header message-id))
6780 (gnus-summary-article-sparse-p
6781 (mail-header-number header))
6782 (memq (mail-header-number header)
6783 gnus-newsgroup-limit)))
6786 ;; If the article is present in the buffer we just go to it.
6788 (or (not (gnus-summary-article-sparse-p
6789 (mail-header-number header)))
6792 (gnus-summary-goto-article
6793 (mail-header-number header) nil t)
6795 (gnus-summary-update-article (mail-header-number header)))))
6797 ;; We fetch the article.
6799 (dolist (gnus-override-method
6800 (cond ((null gnus-refer-article-method)
6801 (list 'current gnus-select-method))
6802 ((consp (car gnus-refer-article-method))
6803 gnus-refer-article-method)
6805 (list gnus-refer-article-method))))
6806 (when (eq 'current gnus-override-method)
6807 (setq gnus-override-method gnus-current-select-method))
6808 (gnus-check-server gnus-override-method)
6809 ;; Fetch the header, and display the article.
6810 (when (setq number (gnus-summary-insert-subject message-id))
6811 (gnus-summary-select-article nil nil nil number)
6813 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6815 (defun gnus-summary-edit-parameters ()
6816 "Edit the group parameters of the current group."
6818 (gnus-group-edit-group gnus-newsgroup-name 'params))
6820 (defun gnus-summary-customize-parameters ()
6821 "Customize the group parameters of the current group."
6823 (gnus-group-customize gnus-newsgroup-name))
6825 (defun gnus-summary-enter-digest-group (&optional force)
6826 "Enter an nndoc group based on the current article.
6827 If FORCE, force a digest interpretation. If not, try
6828 to guess what the document format is."
6830 (let ((conf gnus-current-window-configuration))
6832 (gnus-summary-select-article))
6833 (setq gnus-current-window-configuration conf)
6834 (let* ((name (format "%s-%d"
6835 (gnus-group-prefixed-name
6836 gnus-newsgroup-name (list 'nndoc ""))
6838 (set-buffer gnus-summary-buffer)
6839 gnus-current-article)))
6840 (ogroup gnus-newsgroup-name)
6841 (params (append (gnus-info-params (gnus-get-info ogroup))
6842 (list (cons 'to-group ogroup))
6843 (list (cons 'save-article-group ogroup))))
6844 (case-fold-search t)
6845 (buf (current-buffer))
6848 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6849 (insert-buffer-substring gnus-original-article-buffer)
6850 ;; Remove lines that may lead nndoc to misinterpret the
6853 (goto-char (point-min))
6854 (or (search-forward "\n\n" nil t) (point)))
6855 (goto-char (point-min))
6856 (delete-matching-lines "^Path:\\|^From ")
6859 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
6860 (gnus-newsgroup-ephemeral-ignored-charsets
6861 gnus-newsgroup-ignored-charsets))
6862 (gnus-group-read-ephemeral-group
6863 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6865 ,(if force 'mbox 'guess))) t))
6866 ;; Make all postings to this group go to the parent group.
6867 (nconc (gnus-info-params (gnus-get-info name))
6869 ;; Couldn't select this doc group.
6870 (switch-to-buffer buf)
6871 (gnus-set-global-variables)
6872 (gnus-configure-windows 'summary)
6873 (gnus-message 3 "Article couldn't be entered?"))
6874 (kill-buffer dig)))))
6876 (defun gnus-summary-read-document (n)
6877 "Open a new group based on the current article(s).
6878 This will allow you to read digests and other similar
6879 documents as newsgroups.
6880 Obeys the standard process/prefix convention."
6882 (let* ((articles (gnus-summary-work-articles n))
6883 (ogroup gnus-newsgroup-name)
6884 (params (append (gnus-info-params (gnus-get-info ogroup))
6885 (list (cons 'to-group ogroup))))
6886 article group egroup groups vgroup)
6887 (while (setq article (pop articles))
6888 (setq group (format "%s-%d" gnus-newsgroup-name article))
6889 (gnus-summary-remove-process-mark article)
6890 (when (gnus-summary-display-article article)
6893 (insert-buffer-substring gnus-original-article-buffer)
6894 ;; Remove some headers that may lead nndoc to make
6896 (message-narrow-to-head)
6897 (goto-char (point-min))
6898 (delete-matching-lines "^\\(Path\\):\\|^From ")
6901 (gnus-group-read-ephemeral-group
6902 group `(nndoc ,group (nndoc-address ,(current-buffer))
6903 (nndoc-article-type guess))
6906 ;; Make all postings to this group go to the parent group.
6907 (nconc (gnus-info-params (gnus-get-info egroup))
6909 (push egroup groups))
6910 ;; Couldn't select this doc group.
6911 (gnus-error 3 "Article couldn't be entered"))))))
6912 ;; Now we have selected all the documents.
6915 (error "None of the articles could be interpreted as documents"))
6916 ((gnus-group-read-ephemeral-group
6917 (setq vgroup (format
6918 "nnvirtual:%s-%s" gnus-newsgroup-name
6919 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6920 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6922 (cons (current-buffer) 'summary)))
6924 (error "Couldn't select virtual nndoc group")))))
6926 (defun gnus-summary-isearch-article (&optional regexp-p)
6927 "Do incremental search forward on the current article.
6928 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6930 (let* ((gnus-inhibit-treatment t)
6931 (old (gnus-summary-select-article)))
6932 (gnus-configure-windows 'article)
6933 (gnus-eval-in-buffer-window gnus-article-buffer
6937 (gnus-article-show-all-headers))
6938 (goto-char (point-min))
6939 (isearch-forward regexp-p)))))
6941 (defun gnus-summary-search-article-forward (regexp &optional backward)
6942 "Search for an article containing REGEXP forward.
6943 If BACKWARD, search backward instead."
6946 (format "Search article %s (regexp%s): "
6947 (if current-prefix-arg "backward" "forward")
6948 (if gnus-last-search-regexp
6949 (concat ", default " gnus-last-search-regexp)
6951 current-prefix-arg))
6952 (if (string-equal regexp "")
6953 (setq regexp (or gnus-last-search-regexp ""))
6954 (setq gnus-last-search-regexp regexp))
6955 (if (gnus-summary-search-article regexp backward)
6956 (gnus-summary-show-thread)
6957 (error "Search failed: \"%s\"" regexp)))
6959 (defun gnus-summary-search-article-backward (regexp)
6960 "Search for an article containing REGEXP backward."
6963 (format "Search article backward (regexp%s): "
6964 (if gnus-last-search-regexp
6965 (concat ", default " gnus-last-search-regexp)
6967 (gnus-summary-search-article-forward regexp 'backward))
6970 (defmacro gnus-summary-search-article-position-point (regexp backward)
6971 "Dehighlight the last matched text and goto the beginning position."
6972 (` (if (and gnus-summary-search-article-matched-data
6973 (let ((text (caddr gnus-summary-search-article-matched-data))
6974 (inhibit-read-only t)
6977 (goto-char (car gnus-summary-search-article-matched-data))
6978 (cadr gnus-summary-search-article-matched-data))
6980 (string-match (, regexp) text)))
6981 (if (, backward) (beginning-of-line) (end-of-line))
6982 (goto-char (if (, backward) (point-max) (point-min))))))
6984 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
6985 "Place point where X-Face image is displayed."
6986 (if (featurep 'xemacs)
6987 (` (let ((end (if (search-forward "\n\n" nil t)
6988 (goto-char (1- (point)))
6991 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
6992 (unless (and (re-search-forward "^From:" end t)
6993 (setq extent (extent-at (point)))
6994 (extent-begin-glyph extent))
6995 (goto-char (, opoint)))))
6996 (` (let ((end (if (search-forward "\n\n" nil t)
6997 (goto-char (1- (point)))
7000 (or (text-property-any (or (search-backward "\n\n" nil t)
7002 end 'x-face-mule-bitmap-image t)
7005 (defmacro gnus-summary-search-article-highlight-matched-text
7006 (backward treated x-face)
7007 "Highlight matched text in the function `gnus-summary-search-article'."
7008 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
7009 (end (set-marker (make-marker) (match-end 0)))
7010 (inhibit-read-only t)
7014 (let ((items (mapcar 'car gnus-treatment-function-alist)))
7016 (lambda (item) (setq items (delq item items)))
7017 '(gnus-treat-buttonize
7018 gnus-treat-fill-article
7019 gnus-treat-fill-long-lines
7020 gnus-treat-emphasize
7021 gnus-treat-highlight-headers
7022 gnus-treat-highlight-citation
7023 gnus-treat-highlight-signature
7024 gnus-treat-overstrike
7025 gnus-treat-display-xface
7026 gnus-treat-buttonize-head
7027 gnus-treat-decode-article-as-default-mime-charset))
7028 (static-if (featurep 'xemacs)
7030 (cons '(x-face-mule-delete-x-face-field
7033 (gnus-treat-display-xface
7034 (when (, x-face) gnus-treat-display-xface)))
7035 (gnus-article-prepare-mime-display)))
7036 (goto-char (if (, backward) start end))
7038 (gnus-summary-search-article-highlight-goto-x-face (point)))
7039 (setq gnus-summary-search-article-matched-data
7040 (list start end (buffer-substring start end)))
7041 (unless (eq start end);; matched text has been deleted. :-<
7042 (put-text-property start end 'face
7043 (or (find-face 'isearch)
7044 'secondary-selection))))))
7047 (defun gnus-summary-search-article (regexp &optional backward)
7048 "Search for an article containing REGEXP.
7049 Optional argument BACKWARD means do search for backward.
7050 `gnus-select-article-hook' is not called during the search."
7051 ;; We have to require this here to make sure that the following
7052 ;; dynamic binding isn't shadowed by autoloading.
7053 (require 'gnus-async)
7055 (let ((gnus-select-article-hook nil) ;Disable hook.
7056 (gnus-article-display-hook nil)
7057 (gnus-article-prepare-hook nil)
7058 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7059 (gnus-use-article-prefetch nil)
7060 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7061 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7062 (sum (current-buffer))
7065 (gnus-save-hidden-threads
7066 (static-if (featurep 'xemacs)
7067 (let ((gnus-inhibit-treatment t))
7068 (setq treated (eq 'old (gnus-summary-select-article)))
7070 (not (and (gnus-buffer-live-p gnus-article-buffer)
7071 (window-live-p (get-buffer-window
7072 gnus-article-buffer t)))))
7073 (gnus-summary-select-article nil t)
7074 (setq treated nil)))
7075 (let ((gnus-inhibit-treatment t)
7076 (x-face-mule-delete-x-face-field 'never))
7077 (setq treated (eq 'old (gnus-summary-select-article)))
7080 (and (gnus-buffer-live-p gnus-article-buffer)
7081 (window-live-p (get-buffer-window
7082 gnus-article-buffer t))
7083 (or (not (string-match "^\\^X-Face:" regexp))
7084 (with-current-buffer gnus-article-buffer
7085 gnus-summary-search-article-matched-data)))))
7086 (gnus-summary-select-article nil t)
7087 (setq treated nil))))
7088 (set-buffer gnus-article-buffer)
7092 (gnus-article-show-all-headers)
7093 (gnus-summary-search-article-position-point regexp backward))
7094 (goto-char (if backward (point-max) (point-min))))
7096 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7098 (re-search-backward regexp nil t)
7099 (re-search-forward regexp nil t))
7100 ;; We found the regexp.
7102 (gnus-summary-search-article-highlight-matched-text
7103 backward treated (string-match "^\\^X-Face:" regexp))
7106 (/ (- 2 (window-height
7107 (get-buffer-window gnus-article-buffer t)))
7110 (get-buffer-window (current-buffer))
7113 (setq point (point)))
7114 ;; We didn't find it, so we go to the next article.
7117 (while (eq found 'not)
7118 (if (not (if backward (gnus-summary-find-prev)
7119 (gnus-summary-find-next)))
7120 ;; No more articles.
7122 ;; Select the next article and adjust point.
7123 (unless (gnus-summary-article-sparse-p
7124 (gnus-summary-article-number))
7126 (let ((gnus-inhibit-treatment t))
7127 (gnus-summary-select-article))
7129 (set-buffer gnus-article-buffer)
7131 (goto-char (if backward (point-max) (point-min))))))))
7132 (gnus-message 7 ""))
7133 ;; Return whether we found the regexp.
7134 (when (eq found 'found)
7136 (gnus-summary-show-thread)
7137 (gnus-summary-goto-subject gnus-current-article)
7138 (gnus-summary-position-point)
7141 (defun gnus-summary-find-matching (header regexp &optional backward unread
7143 "Return a list of all articles that match REGEXP on HEADER.
7144 The search stars on the current article and goes forwards unless
7145 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7146 If UNREAD is non-nil, only unread articles will
7147 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7148 in the comparisons."
7149 (let ((data (if (eq backward 'all) gnus-newsgroup-data
7150 (gnus-data-find-list
7151 (gnus-summary-article-number) (gnus-data-list backward))))
7152 (case-fold-search (not not-case-fold))
7155 (if (eq (car header) 'extra)
7158 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
7160 (error "%s is an invalid header" header))
7161 (unless (fboundp (intern (concat "mail-header-" header)))
7162 (error "%s is not a valid header" header))
7163 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
7166 (and (or (not unread) ; We want all articles...
7167 (gnus-data-unread-p d)) ; Or just unreads.
7168 (vectorp (gnus-data-header d)) ; It's not a pseudo.
7169 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
7170 (push (gnus-data-number d) articles)) ; Success!
7171 (setq data (cdr data)))
7172 (nreverse articles)))
7174 (defun gnus-summary-execute-command (header regexp command &optional backward)
7175 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7176 If HEADER is an empty string (or nil), the match is done on the entire
7177 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7179 (list (let ((completion-ignore-case t))
7182 (mapcar (lambda (string) (list string))
7183 '("Number" "Subject" "From" "Lines" "Date"
7184 "Message-ID" "Xref" "References" "Body"))
7185 nil 'require-match))
7186 (read-string "Regexp: ")
7187 (read-key-sequence "Command: ")
7188 current-prefix-arg))
7189 (when (equal header "Body")
7191 ;; Hidden thread subtrees must be searched as well.
7192 (gnus-summary-show-all-threads)
7193 ;; We don't want to change current point nor window configuration.
7195 (save-window-excursion
7196 (gnus-message 6 "Executing %s..." (key-description command))
7197 ;; We'd like to execute COMMAND interactively so as to give arguments.
7198 (gnus-execute header regexp
7199 `(call-interactively ',(key-binding command))
7201 (gnus-message 6 "Executing %s...done" (key-description command)))))
7203 (defun gnus-summary-beginning-of-article ()
7204 "Scroll the article back to the beginning."
7206 (gnus-summary-select-article)
7207 (gnus-configure-windows 'article)
7208 (gnus-eval-in-buffer-window gnus-article-buffer
7210 (goto-char (point-min))
7211 (when gnus-page-broken
7212 (gnus-narrow-to-page))))
7214 (defun gnus-summary-end-of-article ()
7215 "Scroll to the end of the article."
7217 (gnus-summary-select-article)
7218 (gnus-configure-windows 'article)
7219 (gnus-eval-in-buffer-window gnus-article-buffer
7221 (goto-char (point-max))
7223 (when gnus-page-broken
7224 (gnus-narrow-to-page))))
7226 (defun gnus-summary-print-article (&optional filename n)
7227 "Generate and print a PostScript image of the N next (mail) articles.
7229 If N is negative, print the N previous articles. If N is nil and articles
7230 have been marked with the process mark, print these instead.
7232 If the optional first argument FILENAME is nil, send the image to the
7233 printer. If FILENAME is a string, save the PostScript image in a file with
7234 that name. If FILENAME is a number, prompt the user for the name of the file
7236 (interactive (list (ps-print-preprint current-prefix-arg)
7237 current-prefix-arg))
7238 (dolist (article (gnus-summary-work-articles n))
7239 (gnus-summary-select-article nil nil 'pseudo article)
7240 (gnus-eval-in-buffer-window gnus-article-buffer
7241 (let ((buffer (generate-new-buffer " *print*")))
7244 (copy-to-buffer buffer (point-min) (point-max))
7246 (gnus-article-delete-invisible-text)
7247 (let ((ps-left-header
7250 (mail-header-subject gnus-current-headers) ")")
7252 (mail-header-from gnus-current-headers) ")")))
7255 "/pagenumberstring load"
7257 (mail-header-date gnus-current-headers) ")"))))
7258 (gnus-run-hooks 'gnus-ps-print-hook)
7260 (ps-print-buffer-with-faces filename))))
7261 (kill-buffer buffer))))))
7263 (defun gnus-summary-show-article (&optional arg)
7264 "Force re-fetching of the current article.
7265 If ARG (the prefix) is non-nil, show the raw article without any
7266 article massaging functions being run."
7269 ;; Select the article the normal way.
7270 (gnus-summary-select-article nil 'force)
7271 ;; We have to require this here to make sure that the following
7272 ;; dynamic binding isn't shadowed by autoloading.
7273 (require 'gnus-async)
7275 ;; Bind the article treatment functions to nil.
7276 (let ((gnus-have-all-headers t)
7277 gnus-article-display-hook
7278 gnus-article-prepare-hook
7279 gnus-article-decode-hook
7283 (gnus-summary-select-article nil 'force)))
7284 (gnus-summary-goto-subject gnus-current-article)
7285 (gnus-summary-position-point))
7287 (defun gnus-summary-verbose-headers (&optional arg)
7288 "Toggle permanent full header display.
7289 If ARG is a positive number, turn header display on.
7290 If ARG is a negative number, turn header display off."
7292 (setq gnus-show-all-headers
7293 (cond ((or (not (numberp arg))
7295 (not gnus-show-all-headers))
7298 (gnus-summary-show-article))
7300 (defun gnus-summary-toggle-header (&optional arg)
7301 "Show the headers if they are hidden, or hide them if they are shown.
7302 If ARG is a positive number, show the entire header.
7303 If ARG is a negative number, hide the unwanted header lines."
7306 (set-buffer gnus-article-buffer)
7308 (let* ((buffer-read-only nil)
7309 (inhibit-point-motion-hooks t)
7315 (article-narrow-to-head)
7316 (gnus-article-hidden-text-p 'headers))))
7317 (goto-char (point-min))
7318 (when (search-forward "\n\n" nil t)
7319 (delete-region (point-min) (1- (point))))
7320 (goto-char (point-min))
7322 (set-buffer gnus-original-article-buffer)
7323 (goto-char (point-min))
7324 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7325 (insert-buffer-substring gnus-original-article-buffer 1 e)
7327 (narrow-to-region (point-min) (point))
7328 (article-decode-encoded-words)
7330 (let ((gnus-treat-hide-headers nil)
7331 (gnus-treat-hide-boring-headers nil))
7332 (gnus-treat-article 'head))
7333 (gnus-treat-article 'head)))))))
7335 (defun gnus-summary-show-all-headers ()
7336 "Make all header lines visible."
7338 (gnus-article-show-all-headers))
7340 (defun gnus-summary-toggle-mime (&optional arg)
7341 "Toggle MIME processing.
7342 If ARG is a positive number, turn MIME processing on."
7344 (setq gnus-show-mime
7346 (not gnus-show-mime)
7347 (> (prefix-numeric-value arg) 0)))
7348 (gnus-summary-select-article t 'force))
7350 (defun gnus-summary-caesar-message (&optional arg)
7351 "Caesar rotate the current article by 13.
7352 The numerical prefix specifies how many places to rotate each letter
7355 (gnus-summary-select-article)
7356 (let ((mail-header-separator ""))
7357 (gnus-eval-in-buffer-window gnus-article-buffer
7360 (let ((start (window-start))
7362 (message-caesar-buffer-body arg)
7363 (set-window-start (get-buffer-window (current-buffer)) start))))))
7365 (defun gnus-summary-stop-page-breaking ()
7366 "Stop page breaking in the current article."
7368 (gnus-summary-select-article)
7369 (gnus-eval-in-buffer-window gnus-article-buffer
7371 (when (gnus-visual-p 'page-marker)
7372 (let ((buffer-read-only nil))
7373 (gnus-remove-text-with-property 'gnus-prev)
7374 (gnus-remove-text-with-property 'gnus-next))
7375 (setq gnus-page-broken nil))))
7377 (defun gnus-summary-move-article (&optional n to-newsgroup
7378 select-method action)
7379 "Move the current article to a different newsgroup.
7380 If N is a positive number, move the N next articles.
7381 If N is a negative number, move the N previous articles.
7382 If N is nil and any articles have been marked with the process mark,
7383 move those articles instead.
7384 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7385 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7386 re-spool using this method.
7388 For this function to work, both the current newsgroup and the
7389 newsgroup that you want to move to have to support the `request-move'
7390 and `request-accept' functions."
7393 (setq action 'move))
7394 ;; Disable marking as read.
7395 (let (gnus-mark-article-hook)
7396 (save-window-excursion
7397 (gnus-summary-select-article)))
7398 ;; Check whether the source group supports the required functions.
7399 (cond ((and (eq action 'move)
7400 (not (gnus-check-backend-function
7401 'request-move-article gnus-newsgroup-name)))
7402 (error "The current group does not support article moving"))
7403 ((and (eq action 'crosspost)
7404 (not (gnus-check-backend-function
7405 'request-replace-article gnus-newsgroup-name)))
7406 (error "The current group does not support article editing")))
7407 (let ((articles (gnus-summary-work-articles n))
7408 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7409 (names '((move "Move" "Moving")
7410 (copy "Copy" "Copying")
7411 (crosspost "Crosspost" "Crossposting")))
7412 (copy-buf (save-excursion
7413 (nnheader-set-temp-buffer " *copy article*")))
7414 (default-marks gnus-article-mark-lists)
7415 (no-expire-marks (delete '(expirable . expire)
7416 (copy-sequence gnus-article-mark-lists)))
7417 art-group to-method new-xref article to-groups)
7418 (unless (assq action names)
7419 (error "Unknown action %s" action))
7420 ;; Read the newsgroup name.
7421 (when (and (not to-newsgroup)
7422 (not select-method))
7424 (gnus-read-move-group-name
7425 (cadr (assq action names))
7426 (symbol-value (intern (format "gnus-current-%s-group" action)))
7428 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7429 (setq to-method (or select-method
7430 (gnus-group-name-to-method to-newsgroup)))
7431 ;; Check the method we are to move this article to...
7432 (unless (gnus-check-backend-function
7433 'request-accept-article (car to-method))
7434 (error "%s does not support article copying" (car to-method)))
7435 (unless (gnus-check-server to-method)
7436 (error "Can't open server %s" (car to-method)))
7437 (gnus-message 6 "%s to %s: %s..."
7438 (caddr (assq action names))
7439 (or (car select-method) to-newsgroup) articles)
7441 (setq article (pop articles))
7445 ;; Move the article.
7447 ;; Remove this article from future suppression.
7448 (gnus-dup-unsuppress-article article)
7449 (gnus-request-move-article
7450 article ; Article to move
7451 gnus-newsgroup-name ; From newsgroup
7452 (nth 1 (gnus-find-method-for-group
7453 gnus-newsgroup-name)) ; Server
7454 (list 'gnus-request-accept-article
7455 to-newsgroup (list 'quote select-method)
7456 (not articles) t) ; Accept form
7457 (not articles))) ; Only save nov last time
7458 ;; Copy the article.
7461 (set-buffer copy-buf)
7462 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7463 (gnus-request-accept-article
7464 to-newsgroup select-method (not articles) t))))
7465 ;; Crosspost the article.
7466 ((eq action 'crosspost)
7467 (let ((xref (message-tokenize-header
7468 (mail-header-xref (gnus-summary-article-header article))
7470 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7473 (setq xref (list (system-name))))
7476 (mapconcat 'identity
7477 (delete "Xref:" (delete new-xref xref))
7481 (set-buffer copy-buf)
7482 ;; First put the article in the destination group.
7483 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7484 (when (consp (setq art-group
7485 (gnus-request-accept-article
7486 to-newsgroup select-method (not articles))))
7487 (setq new-xref (concat new-xref " " (car art-group)
7488 ":" (cdr art-group)))
7489 ;; Now we have the new Xrefs header, so we insert
7490 ;; it and replace the new article.
7491 (nnheader-replace-header "Xref" new-xref)
7492 (gnus-request-replace-article
7493 (cdr art-group) to-newsgroup (current-buffer))
7497 (gnus-message 1 "Couldn't %s article %s: %s"
7498 (cadr (assq action names)) article
7499 (nnheader-get-report (car to-method))))
7500 ((and (eq art-group 'junk)
7502 (gnus-summary-mark-article article gnus-canceled-mark)
7503 (gnus-message 4 "Deleted article %s" article))
7505 (let* ((pto-group (gnus-group-prefixed-name
7506 (car art-group) to-method))
7508 (gnus-gethash pto-group gnus-newsrc-hashtb))
7509 (info (nth 2 entry))
7510 (to-group (gnus-info-group info))
7512 ;; Update the group that has been moved to.
7514 (memq action '(move copy)))
7515 (unless (member to-group to-groups)
7516 (push to-group to-groups))
7518 (unless (memq article gnus-newsgroup-unreads)
7519 (push 'read to-marks)
7521 info (gnus-add-to-range (gnus-info-read info)
7522 (list (cdr art-group)))))
7524 ;; Copy any marks over to the new group.
7525 (let ((marks (if (gnus-group-auto-expirable-p to-group)
7528 (to-article (cdr art-group)))
7530 ;; See whether the article is to be put in the cache.
7531 (when gnus-use-cache
7532 (gnus-cache-possibly-enter-article
7534 (let ((header (copy-sequence
7535 (gnus-summary-article-header article))))
7536 (mail-header-set-number header to-article)
7538 (memq article gnus-newsgroup-marked)
7539 (memq article gnus-newsgroup-dormant)
7540 (memq article gnus-newsgroup-unreads)))
7542 (when (and (equal to-group gnus-newsgroup-name)
7543 (not (memq article gnus-newsgroup-unreads)))
7544 ;; Mark this article as read in this group.
7545 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7546 (setcdr (gnus-active to-group) to-article)
7547 (setcdr gnus-newsgroup-active to-article))
7550 (when (memq article (symbol-value
7551 (intern (format "gnus-newsgroup-%s"
7553 (push (cdar marks) to-marks)
7554 ;; If the other group is the same as this group,
7555 ;; then we have to add the mark to the list.
7556 (when (equal to-group gnus-newsgroup-name)
7557 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7560 (intern (format "gnus-newsgroup-%s"
7562 ;; Copy the marks to other group.
7563 (gnus-add-marked-articles
7564 to-group (cdar marks) (list to-article) info))
7565 (setq marks (cdr marks)))
7567 (gnus-request-set-mark to-group (list (list (list to-article)
7572 (concat "(gnus-group-set-info '"
7573 (gnus-prin1-to-string (gnus-get-info to-group))
7576 ;; Update the Xref header in this article to point to
7577 ;; the new crossposted article we have just created.
7578 (when (eq action 'crosspost)
7580 (set-buffer copy-buf)
7581 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7582 (nnheader-replace-header "Xref" new-xref)
7583 (gnus-request-replace-article
7584 article gnus-newsgroup-name (current-buffer)))))
7586 ;;;!!!Why is this necessary?
7587 (set-buffer gnus-summary-buffer)
7589 (gnus-summary-goto-subject article)
7590 (when (eq action 'move)
7591 (gnus-summary-mark-article article gnus-canceled-mark))))
7592 (gnus-summary-remove-process-mark article))
7593 ;; Re-activate all groups that have been moved to.
7596 (set-buffer gnus-group-buffer)
7597 (when (gnus-group-goto-group (car to-groups) t)
7598 (gnus-group-get-new-news-this-group 1 t))
7601 (gnus-kill-buffer copy-buf)
7602 (gnus-summary-position-point)
7603 (gnus-set-mode-line 'summary)))
7605 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7606 "Move the current article to a different newsgroup.
7607 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7608 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7609 re-spool using this method."
7611 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7613 (defun gnus-summary-crosspost-article (&optional n)
7614 "Crosspost the current article to some other group."
7616 (gnus-summary-move-article n nil nil 'crosspost))
7618 (defcustom gnus-summary-respool-default-method nil
7619 "Default method for respooling an article.
7620 If nil, use to the current newsgroup method."
7621 :type '(choice (gnus-select-method :value (nnml ""))
7623 :group 'gnus-summary-mail)
7625 (defun gnus-summary-respool-article (&optional n method)
7626 "Respool the current article.
7627 The article will be squeezed through the mail spooling process again,
7628 which means that it will be put in some mail newsgroup or other
7629 depending on `nnmail-split-methods'.
7630 If N is a positive number, respool the N next articles.
7631 If N is a negative number, respool the N previous articles.
7632 If N is nil and any articles have been marked with the process mark,
7633 respool those articles instead.
7635 Respooling can be done both from mail groups and \"real\" newsgroups.
7636 In the former case, the articles in question will be moved from the
7637 current group into whatever groups they are destined to. In the
7638 latter case, they will be copied into the relevant groups."
7640 (list current-prefix-arg
7641 (let* ((methods (gnus-methods-using 'respool))
7643 (symbol-name (or gnus-summary-respool-default-method
7644 (car (gnus-find-method-for-group
7645 gnus-newsgroup-name)))))
7647 (gnus-completing-read
7648 methname "What backend do you want to use when respooling?"
7649 methods nil t nil 'gnus-mail-method-history))
7652 ((zerop (length (setq ms (gnus-servers-using-backend
7654 (list (intern method) ""))
7658 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7659 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7662 (error "No method given for respooling"))
7663 (if (assoc (symbol-name
7664 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7665 (gnus-methods-using 'respool))
7666 (gnus-summary-move-article n nil method)
7667 (gnus-summary-copy-article n nil method)))
7669 (defun gnus-summary-import-article (file)
7670 "Import an arbitrary file into a mail newsgroup."
7671 (interactive "fImport file: ")
7672 (let ((group gnus-newsgroup-name)
7673 (now (current-time))
7675 (unless (gnus-check-backend-function 'request-accept-article group)
7676 (error "%s does not support article importing" group))
7677 (or (file-readable-p file)
7678 (not (file-regular-p file))
7679 (error "Can't read %s" file))
7681 (set-buffer (gnus-get-buffer-create " *import file*"))
7683 (nnheader-insert-file-contents file)
7684 (goto-char (point-min))
7685 (unless (nnheader-article-p)
7686 ;; This doesn't look like an article, so we fudge some headers.
7687 (setq atts (file-attributes file)
7688 lines (count-lines (point-min) (point-max)))
7689 (insert "From: " (read-string "From: ") "\n"
7690 "Subject: " (read-string "Subject: ") "\n"
7691 "Date: " (message-make-date (nth 5 atts))
7693 "Message-ID: " (message-make-message-id) "\n"
7694 "Lines: " (int-to-string lines) "\n"
7695 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7696 (gnus-request-accept-article group nil t)
7697 (kill-buffer (current-buffer)))))
7699 (defun gnus-summary-article-posted-p ()
7700 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7701 This will be the case if the article has both been mailed and posted."
7703 (let ((id (mail-header-references (gnus-summary-article-header)))
7704 (gnus-override-method
7705 (or gnus-refer-article-method gnus-select-method)))
7706 (if (gnus-request-head id "")
7707 (gnus-message 2 "The current message was found on %s"
7708 gnus-override-method)
7709 (gnus-message 2 "The current message couldn't be found on %s"
7710 gnus-override-method)
7713 (defun gnus-summary-expire-articles (&optional now)
7714 "Expire all articles that are marked as expirable in the current group."
7716 (when (gnus-check-backend-function
7717 'request-expire-articles gnus-newsgroup-name)
7718 ;; This backend supports expiry.
7719 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7720 (expirable (if total
7722 ;; We need to update the info for
7723 ;; this group for `gnus-list-of-read-articles'
7724 ;; to give us the right answer.
7725 (gnus-run-hooks 'gnus-exit-group-hook)
7726 (gnus-summary-update-info)
7727 (gnus-list-of-read-articles gnus-newsgroup-name))
7728 (setq gnus-newsgroup-expirable
7729 (sort gnus-newsgroup-expirable '<))))
7730 (expiry-wait (if now 'immediate
7731 (gnus-group-find-parameter
7732 gnus-newsgroup-name 'expiry-wait)))
7735 ;; There are expirable articles in this group, so we run them
7736 ;; through the expiry process.
7737 (gnus-message 6 "Expiring articles...")
7738 (unless (gnus-check-group gnus-newsgroup-name)
7739 (error "Can't open server for %s" gnus-newsgroup-name))
7740 ;; The list of articles that weren't expired is returned.
7743 (let ((nnmail-expiry-wait-function nil)
7744 (nnmail-expiry-wait expiry-wait))
7745 (setq es (gnus-request-expire-articles
7746 expirable gnus-newsgroup-name)))
7747 (setq es (gnus-request-expire-articles
7748 expirable gnus-newsgroup-name))))
7750 (setq gnus-newsgroup-expirable es))
7751 ;; We go through the old list of expirable, and mark all
7752 ;; really expired articles as nonexistent.
7753 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7754 (let ((gnus-use-cache nil))
7756 (unless (memq (car expirable) es)
7757 (when (gnus-data-find (car expirable))
7758 (gnus-summary-mark-article
7759 (car expirable) gnus-canceled-mark)))
7760 (setq expirable (cdr expirable)))))
7761 (gnus-message 6 "Expiring articles...done")))))
7763 (defun gnus-summary-expire-articles-now ()
7764 "Expunge all expirable articles in the current group.
7765 This means that *all* articles that are marked as expirable will be
7766 deleted forever, right now."
7768 (or gnus-expert-user
7770 "Are you really, really, really sure you want to delete all these messages? ")
7772 (gnus-summary-expire-articles t))
7774 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7775 (defun gnus-summary-delete-article (&optional n)
7776 "Delete the N next (mail) articles.
7777 This command actually deletes articles. This is not a marking
7778 command. The article will disappear forever from your life, never to
7780 If N is negative, delete backwards.
7781 If N is nil and articles have been marked with the process mark,
7782 delete these instead."
7784 (unless (gnus-check-backend-function 'request-expire-articles
7785 gnus-newsgroup-name)
7786 (error "The current newsgroup does not support article deletion"))
7787 ;; Compute the list of articles to delete.
7788 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7790 (if (and gnus-novice-user
7791 (not (gnus-yes-or-no-p
7792 (format "Do you really want to delete %s forever? "
7793 (if (> (length articles) 1)
7794 (format "these %s articles" (length articles))
7797 ;; Delete the articles.
7798 (setq not-deleted (gnus-request-expire-articles
7799 articles gnus-newsgroup-name 'force))
7801 (gnus-summary-remove-process-mark (car articles))
7802 ;; The backend might not have been able to delete the article
7804 (unless (memq (car articles) not-deleted)
7805 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7806 (setq articles (cdr articles)))
7808 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7809 (gnus-summary-position-point)
7810 (gnus-set-mode-line 'summary)
7813 (defun gnus-summary-edit-article (&optional force)
7814 "Edit the current article.
7815 This will have permanent effect only in mail groups.
7816 If FORCE is non-nil, allow editing of articles even in read-only
7820 (set-buffer gnus-summary-buffer)
7821 (let ((mail-parse-charset gnus-newsgroup-charset)
7822 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
7823 (gnus-set-global-variables)
7824 (when (and (not force)
7825 (gnus-group-read-only-p))
7826 (error "The current newsgroup does not support article editing"))
7827 (gnus-summary-show-article t)
7828 (gnus-article-edit-article
7830 `(lambda (no-highlight)
7831 (let ((mail-parse-charset ',gnus-newsgroup-charset)
7832 (mail-parse-ignored-charsets
7833 ',gnus-newsgroup-ignored-charsets))
7834 (gnus-summary-edit-article-done
7835 ,(or (mail-header-references gnus-current-headers) "")
7836 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7838 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7840 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7842 "Make edits to the current article permanent."
7844 ;; Replace the article.
7845 (let ((buf (current-buffer)))
7847 (insert-buffer-substring buf)
7848 (if (and (not read-only)
7849 (not (gnus-request-replace-article
7850 (cdr gnus-article-current) (car gnus-article-current)
7851 (current-buffer) t)))
7852 (error "Couldn't replace article")
7853 ;; Update the summary buffer.
7855 (equal (message-tokenize-header references " ")
7856 (message-tokenize-header
7857 (or (message-fetch-field "references") "") " ")))
7858 ;; We only have to update this line.
7861 (message-narrow-to-head)
7862 (let ((head (buffer-string))
7865 (insert (format "211 %d Article retrieved.\n"
7866 (cdr gnus-article-current)))
7869 (let ((nntp-server-buffer (current-buffer)))
7870 (setq header (car (gnus-get-newsgroup-headers
7872 (set-buffer gnus-summary-buffer)
7873 gnus-newsgroup-dependencies)
7876 (set-buffer gnus-summary-buffer)
7877 (gnus-data-set-header
7878 (gnus-data-find (cdr gnus-article-current))
7880 (gnus-summary-update-article-line
7881 (cdr gnus-article-current) header))))))
7883 (set-buffer (or buffer gnus-summary-buffer))
7884 (gnus-summary-update-article (cdr gnus-article-current)))
7885 ;; Prettify the article buffer again.
7886 (unless no-highlight
7888 (set-buffer gnus-article-buffer)
7889 ;;;!!! Fix this -- article should be rehighlighted.
7890 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7891 (set-buffer gnus-original-article-buffer)
7892 (gnus-request-article
7893 (cdr gnus-article-current)
7894 (car gnus-article-current) (current-buffer))))
7895 ;; Prettify the summary buffer line.
7896 (when (gnus-visual-p 'summary-highlight 'highlight)
7897 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7899 (defun gnus-summary-edit-wash (key)
7900 "Perform editing command KEY in the article buffer."
7904 (message "%s" (concat (this-command-keys) "- "))
7907 (gnus-summary-edit-article)
7908 (execute-kbd-macro (concat (this-command-keys) key))
7909 (gnus-article-edit-done))
7913 (defun gnus-summary-respool-query (&optional silent trace)
7914 "Query where the respool algorithm would put this article."
7916 (let (gnus-mark-article-hook)
7917 (gnus-summary-select-article)
7919 (set-buffer gnus-original-article-buffer)
7921 (message-narrow-to-head)
7922 (let ((groups (nnmail-article-group 'identity trace)))
7925 (message "This message would go to %s"
7926 (mapconcat 'car groups ", "))
7927 (message "This message would go to no groups"))
7930 (defun gnus-summary-respool-trace ()
7931 "Trace where the respool algorithm would put this article.
7932 Display a buffer showing all fancy splitting patterns which matched."
7934 (gnus-summary-respool-query nil t))
7936 ;; Summary marking commands.
7938 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7939 "Mark articles which has the same subject as read, and then select the next.
7940 If UNMARK is positive, remove any kind of mark.
7941 If UNMARK is negative, tick articles."
7944 (setq unmark (prefix-numeric-value unmark)))
7946 (gnus-summary-mark-same-subject
7947 (gnus-summary-article-subject) unmark)))
7948 ;; Select next unread article. If auto-select-same mode, should
7949 ;; select the first unread article.
7950 (gnus-summary-next-article t (and gnus-auto-select-same
7951 (gnus-summary-article-subject)))
7952 (gnus-message 7 "%d article%s marked as %s"
7953 count (if (= count 1) " is" "s are")
7954 (if unmark "unread" "read"))))
7956 (defun gnus-summary-kill-same-subject (&optional unmark)
7957 "Mark articles which has the same subject as read.
7958 If UNMARK is positive, remove any kind of mark.
7959 If UNMARK is negative, tick articles."
7962 (setq unmark (prefix-numeric-value unmark)))
7964 (gnus-summary-mark-same-subject
7965 (gnus-summary-article-subject) unmark)))
7966 ;; If marked as read, go to next unread subject.
7968 ;; Go to next unread subject.
7969 (gnus-summary-next-subject 1 t))
7970 (gnus-message 7 "%d articles are marked as %s"
7971 count (if unmark "unread" "read"))))
7973 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7974 "Mark articles with same SUBJECT as read, and return marked number.
7975 If optional argument UNMARK is positive, remove any kinds of marks.
7976 If optional argument UNMARK is negative, mark articles as unread instead."
7980 ((null unmark) ; Mark as read.
7983 (gnus-summary-mark-article-as-read gnus-killed-mark)
7984 (gnus-summary-show-thread) t)
7985 (gnus-summary-find-subject subject))
7986 (setq count (1+ count))))
7987 ((> unmark 0) ; Tick.
7990 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7991 (gnus-summary-show-thread) t)
7992 (gnus-summary-find-subject subject))
7993 (setq count (1+ count))))
7994 (t ; Mark as unread.
7997 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7998 (gnus-summary-show-thread) t)
7999 (gnus-summary-find-subject subject))
8000 (setq count (1+ count)))))
8001 (gnus-set-mode-line 'summary)
8002 ;; Return the number of marked articles.
8005 (defun gnus-summary-mark-as-processable (n &optional unmark)
8006 "Set the process mark on the next N articles.
8007 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8008 the process mark instead. The difference between N and the actual
8009 number of articles marked is returned."
8011 (let ((backward (< n 0))
8016 (gnus-summary-remove-process-mark
8017 (gnus-summary-article-number))
8018 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8019 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
8022 (gnus-message 7 "No more articles"))
8023 (gnus-summary-recenter)
8024 (gnus-summary-position-point)
8027 (defun gnus-summary-unmark-as-processable (n)
8028 "Remove the process mark from the next N articles.
8029 If N is negative, unmark backward instead. The difference between N and
8030 the actual number of articles unmarked is returned."
8032 (gnus-summary-mark-as-processable n t))
8034 (defun gnus-summary-unmark-all-processable ()
8035 "Remove the process mark from all articles."
8038 (while gnus-newsgroup-processable
8039 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
8040 (gnus-summary-position-point))
8042 (defun gnus-summary-mark-as-expirable (n)
8043 "Mark N articles forward as expirable.
8044 If N is negative, mark backward instead. The difference between N and
8045 the actual number of articles marked is returned."
8047 (gnus-summary-mark-forward n gnus-expirable-mark))
8049 (defun gnus-summary-mark-article-as-replied (article)
8050 "Mark ARTICLE replied and update the summary line."
8051 (push article gnus-newsgroup-replied)
8052 (let ((buffer-read-only nil))
8053 (when (gnus-summary-goto-subject article nil t)
8054 (gnus-summary-update-secondary-mark article))))
8056 (defun gnus-summary-set-bookmark (article)
8057 "Set a bookmark in current article."
8058 (interactive (list (gnus-summary-article-number)))
8059 (when (or (not (get-buffer gnus-article-buffer))
8060 (not gnus-current-article)
8061 (not gnus-article-current)
8062 (not (equal gnus-newsgroup-name (car gnus-article-current))))
8063 (error "No current article selected"))
8064 ;; Remove old bookmark, if one exists.
8065 (let ((old (assq article gnus-newsgroup-bookmarks)))
8067 (setq gnus-newsgroup-bookmarks
8068 (delq old gnus-newsgroup-bookmarks))))
8069 ;; Set the new bookmark, which is on the form
8070 ;; (article-number . line-number-in-body).
8074 (set-buffer gnus-article-buffer)
8078 (goto-char (point-min))
8079 (search-forward "\n\n" nil t)
8082 gnus-newsgroup-bookmarks)
8083 (gnus-message 6 "A bookmark has been added to the current article."))
8085 (defun gnus-summary-remove-bookmark (article)
8086 "Remove the bookmark from the current article."
8087 (interactive (list (gnus-summary-article-number)))
8088 ;; Remove old bookmark, if one exists.
8089 (let ((old (assq article gnus-newsgroup-bookmarks)))
8092 (setq gnus-newsgroup-bookmarks
8093 (delq old gnus-newsgroup-bookmarks))
8094 (gnus-message 6 "Removed bookmark."))
8095 (gnus-message 6 "No bookmark in current article."))))
8097 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8098 (defun gnus-summary-mark-as-dormant (n)
8099 "Mark N articles forward as dormant.
8100 If N is negative, mark backward instead. The difference between N and
8101 the actual number of articles marked is returned."
8103 (gnus-summary-mark-forward n gnus-dormant-mark))
8105 (defun gnus-summary-set-process-mark (article)
8106 "Set the process mark on ARTICLE and update the summary line."
8107 (setq gnus-newsgroup-processable
8109 (delq article gnus-newsgroup-processable)))
8110 (when (gnus-summary-goto-subject article)
8111 (gnus-summary-show-thread)
8112 (gnus-summary-goto-subject article)
8113 (gnus-summary-update-secondary-mark article)))
8115 (defun gnus-summary-remove-process-mark (article)
8116 "Remove the process mark from ARTICLE and update the summary line."
8117 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
8118 (when (gnus-summary-goto-subject article)
8119 (gnus-summary-show-thread)
8120 (gnus-summary-goto-subject article)
8121 (gnus-summary-update-secondary-mark article)))
8123 (defun gnus-summary-set-saved-mark (article)
8124 "Set the process mark on ARTICLE and update the summary line."
8125 (push article gnus-newsgroup-saved)
8126 (when (gnus-summary-goto-subject article)
8127 (gnus-summary-update-secondary-mark article)))
8129 (defun gnus-summary-mark-forward (n &optional mark no-expire)
8130 "Mark N articles as read forwards.
8131 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8132 The difference between N and the actual number of articles marked is
8135 (gnus-summary-show-thread)
8136 (let ((backward (< n 0))
8137 (gnus-summary-goto-unread
8138 (and gnus-summary-goto-unread
8139 (not (eq gnus-summary-goto-unread 'never))
8140 (not (memq mark (list gnus-unread-mark
8141 gnus-ticked-mark gnus-dormant-mark)))))
8143 (mark (or mark gnus-del-mark)))
8145 (gnus-summary-mark-article nil mark no-expire)
8146 (zerop (gnus-summary-next-subject
8148 (and gnus-summary-goto-unread
8149 (not (eq gnus-summary-goto-unread 'never)))
8153 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
8154 (gnus-summary-recenter)
8155 (gnus-summary-position-point)
8156 (gnus-set-mode-line 'summary)
8159 (defun gnus-summary-mark-article-as-read (mark)
8160 "Mark the current article quickly as read with MARK."
8161 (let ((article (gnus-summary-article-number)))
8162 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8163 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8164 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8165 (push (cons article mark) gnus-newsgroup-reads)
8166 ;; Possibly remove from cache, if that is used.
8167 (when gnus-use-cache
8168 (gnus-cache-enter-remove-article article))
8169 ;; Allow the backend to change the mark.
8170 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8171 ;; Check for auto-expiry.
8172 (when (and gnus-newsgroup-auto-expire
8173 (memq mark gnus-auto-expirable-marks))
8174 (setq mark gnus-expirable-mark)
8175 ;; Let the backend know about the mark change.
8176 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8177 (push article gnus-newsgroup-expirable))
8178 ;; Set the mark in the buffer.
8179 (gnus-summary-update-mark mark 'unread)
8182 (defun gnus-summary-mark-article-as-unread (mark)
8183 "Mark the current article quickly as unread with MARK."
8184 (let* ((article (gnus-summary-article-number))
8185 (old-mark (gnus-summary-article-mark article)))
8186 ;; Allow the backend to change the mark.
8187 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8188 (if (eq mark old-mark)
8192 (gnus-error 1 "Can't mark negative article numbers")
8194 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8195 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8196 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
8197 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
8198 (cond ((= mark gnus-ticked-mark)
8199 (push article gnus-newsgroup-marked))
8200 ((= mark gnus-dormant-mark)
8201 (push article gnus-newsgroup-dormant))
8203 (push article gnus-newsgroup-unreads)))
8204 (gnus-pull article gnus-newsgroup-reads)
8206 ;; See whether the article is to be put in the cache.
8208 (vectorp (gnus-summary-article-header article))
8210 (gnus-cache-possibly-enter-article
8211 gnus-newsgroup-name article
8212 (gnus-summary-article-header article)
8213 (= mark gnus-ticked-mark)
8214 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8217 (gnus-summary-update-mark mark 'unread)
8220 (defun gnus-summary-mark-article (&optional article mark no-expire)
8221 "Mark ARTICLE with MARK. MARK can be any character.
8222 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8223 `??' (dormant) and `?E' (expirable).
8224 If MARK is nil, then the default character `?r' is used.
8225 If ARTICLE is nil, then the article on the current line will be
8227 ;; The mark might be a string.
8228 (when (stringp mark)
8229 (setq mark (aref mark 0)))
8230 ;; If no mark is given, then we check auto-expiring.
8232 (setq mark gnus-del-mark))
8233 (when (and (not no-expire)
8234 gnus-newsgroup-auto-expire
8235 (memq mark gnus-auto-expirable-marks))
8236 (setq mark gnus-expirable-mark))
8237 (let ((article (or article (gnus-summary-article-number)))
8238 (old-mark (gnus-summary-article-mark article)))
8239 ;; Allow the backend to change the mark.
8240 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8241 (if (eq mark old-mark)
8244 (error "No article on current line"))
8245 (if (not (if (or (= mark gnus-unread-mark)
8246 (= mark gnus-ticked-mark)
8247 (= mark gnus-dormant-mark))
8248 (gnus-mark-article-as-unread article mark)
8249 (gnus-mark-article-as-read article mark)))
8251 ;; See whether the article is to be put in the cache.
8253 (not (= mark gnus-canceled-mark))
8254 (vectorp (gnus-summary-article-header article))
8256 (gnus-cache-possibly-enter-article
8257 gnus-newsgroup-name article
8258 (gnus-summary-article-header article)
8259 (= mark gnus-ticked-mark)
8260 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8262 (when (gnus-summary-goto-subject article nil t)
8263 (let ((buffer-read-only nil))
8264 (gnus-summary-show-thread)
8266 (gnus-summary-update-mark mark 'unread)
8269 (defun gnus-summary-update-secondary-mark (article)
8270 "Update the secondary (read, process, cache) mark."
8271 (gnus-summary-update-mark
8272 (cond ((memq article gnus-newsgroup-processable)
8274 ((memq article gnus-newsgroup-cached)
8276 ((memq article gnus-newsgroup-replied)
8278 ((memq article gnus-newsgroup-saved)
8280 (t gnus-unread-mark))
8282 (when (gnus-visual-p 'summary-highlight 'highlight)
8283 (gnus-run-hooks 'gnus-summary-update-hook))
8286 (defun gnus-summary-update-mark (mark type)
8287 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
8288 (buffer-read-only nil))
8289 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
8291 (when (looking-at "\r")
8293 (when (<= (+ forward (point)) (point-max))
8294 ;; Go to the right position on the line.
8295 (goto-char (+ forward (point)))
8296 ;; Replace the old mark with the new mark.
8297 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
8298 ;; Optionally update the marks by some user rule.
8299 (when (eq type 'unread)
8301 (gnus-data-find (gnus-summary-article-number)) mark)
8302 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
8304 (defun gnus-mark-article-as-read (article &optional mark)
8305 "Enter ARTICLE in the pertinent lists and remove it from others."
8306 ;; Make the article expirable.
8307 (let ((mark (or mark gnus-del-mark)))
8308 (if (= mark gnus-expirable-mark)
8309 (push article gnus-newsgroup-expirable)
8310 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8311 ;; Remove from unread and marked lists.
8312 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8313 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8314 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8315 (push (cons article mark) gnus-newsgroup-reads)
8316 ;; Possibly remove from cache, if that is used.
8317 (when gnus-use-cache
8318 (gnus-cache-enter-remove-article article))
8321 (defun gnus-mark-article-as-unread (article &optional mark)
8322 "Enter ARTICLE in the pertinent lists and remove it from others."
8323 (let ((mark (or mark gnus-ticked-mark)))
8326 (gnus-error 1 "Can't mark negative article numbers")
8328 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8329 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8330 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8331 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8333 ;; Unsuppress duplicates?
8334 (when gnus-suppress-duplicates
8335 (gnus-dup-unsuppress-article article))
8337 (cond ((= mark gnus-ticked-mark)
8338 (push article gnus-newsgroup-marked))
8339 ((= mark gnus-dormant-mark)
8340 (push article gnus-newsgroup-dormant))
8342 (push article gnus-newsgroup-unreads)))
8343 (gnus-pull article gnus-newsgroup-reads)
8346 (defalias 'gnus-summary-mark-as-unread-forward
8347 'gnus-summary-tick-article-forward)
8348 (make-obsolete 'gnus-summary-mark-as-unread-forward
8349 'gnus-summary-tick-article-forward)
8350 (defun gnus-summary-tick-article-forward (n)
8351 "Tick N articles forwards.
8352 If N is negative, tick backwards instead.
8353 The difference between N and the number of articles ticked is returned."
8355 (gnus-summary-mark-forward n gnus-ticked-mark))
8357 (defalias 'gnus-summary-mark-as-unread-backward
8358 'gnus-summary-tick-article-backward)
8359 (make-obsolete 'gnus-summary-mark-as-unread-backward
8360 'gnus-summary-tick-article-backward)
8361 (defun gnus-summary-tick-article-backward (n)
8362 "Tick N articles backwards.
8363 The difference between N and the number of articles ticked is returned."
8365 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8367 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8368 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8369 (defun gnus-summary-tick-article (&optional article clear-mark)
8370 "Mark current article as unread.
8371 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8372 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8374 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8377 (defun gnus-summary-mark-as-read-forward (n)
8378 "Mark N articles as read forwards.
8379 If N is negative, mark backwards instead.
8380 The difference between N and the actual number of articles marked is
8383 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8385 (defun gnus-summary-mark-as-read-backward (n)
8386 "Mark the N articles as read backwards.
8387 The difference between N and the actual number of articles marked is
8390 (gnus-summary-mark-forward
8391 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8393 (defun gnus-summary-mark-as-read (&optional article mark)
8394 "Mark current article as read.
8395 ARTICLE specifies the article to be marked as read.
8396 MARK specifies a string to be inserted at the beginning of the line."
8397 (gnus-summary-mark-article article mark))
8399 (defun gnus-summary-clear-mark-forward (n)
8400 "Clear marks from N articles forward.
8401 If N is negative, clear backward instead.
8402 The difference between N and the number of marks cleared is returned."
8404 (gnus-summary-mark-forward n gnus-unread-mark))
8406 (defun gnus-summary-clear-mark-backward (n)
8407 "Clear marks from N articles backward.
8408 The difference between N and the number of marks cleared is returned."
8410 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8412 (defun gnus-summary-mark-unread-as-read ()
8413 "Intended to be used by `gnus-summary-mark-article-hook'."
8414 (when (memq gnus-current-article gnus-newsgroup-unreads)
8415 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8417 (defun gnus-summary-mark-read-and-unread-as-read ()
8418 "Intended to be used by `gnus-summary-mark-article-hook'."
8419 (let ((mark (gnus-summary-article-mark)))
8420 (when (or (gnus-unread-mark-p mark)
8421 (gnus-read-mark-p mark))
8422 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8424 (defun gnus-summary-mark-region-as-read (point mark all)
8425 "Mark all unread articles between point and mark as read.
8426 If given a prefix, mark all articles between point and mark as read,
8427 even ticked and dormant ones."
8428 (interactive "r\nP")
8437 (memq (setq article (gnus-summary-article-number))
8438 gnus-newsgroup-unreads))
8439 (gnus-summary-mark-article article gnus-del-mark))
8441 (gnus-summary-find-next))))))
8443 (defun gnus-summary-mark-below (score mark)
8444 "Mark articles with score less than SCORE with MARK."
8445 (interactive "P\ncMark: ")
8446 (setq score (if score
8447 (prefix-numeric-value score)
8448 (or gnus-summary-default-score 0)))
8450 (set-buffer gnus-summary-buffer)
8451 (goto-char (point-min))
8454 (and (< (gnus-summary-article-score) score)
8455 (gnus-summary-mark-article nil mark))
8456 (gnus-summary-find-next)))))
8458 (defun gnus-summary-kill-below (&optional score)
8459 "Mark articles with score below SCORE as read."
8461 (gnus-summary-mark-below score gnus-killed-mark))
8463 (defun gnus-summary-clear-above (&optional score)
8464 "Clear all marks from articles with score above SCORE."
8466 (gnus-summary-mark-above score gnus-unread-mark))
8468 (defun gnus-summary-tick-above (&optional score)
8469 "Tick all articles with score above SCORE."
8471 (gnus-summary-mark-above score gnus-ticked-mark))
8473 (defun gnus-summary-mark-above (score mark)
8474 "Mark articles with score over SCORE with MARK."
8475 (interactive "P\ncMark: ")
8476 (setq score (if score
8477 (prefix-numeric-value score)
8478 (or gnus-summary-default-score 0)))
8480 (set-buffer gnus-summary-buffer)
8481 (goto-char (point-min))
8483 (when (> (gnus-summary-article-score) score)
8484 (gnus-summary-mark-article nil mark))
8486 (gnus-summary-find-next)))))
8488 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8489 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8490 (defun gnus-summary-limit-include-expunged (&optional no-error)
8491 "Display all the hidden articles that were expunged for low scores."
8493 (let ((buffer-read-only nil))
8494 (let ((scored gnus-newsgroup-scored)
8497 (unless (gnus-summary-goto-subject (caar scored))
8498 (and (setq h (gnus-summary-article-header (caar scored)))
8499 (< (cdar scored) gnus-summary-expunge-below)
8501 (setq scored (cdr scored)))
8503 (when (not no-error)
8504 (error "No expunged articles hidden"))
8505 (goto-char (point-min))
8506 (gnus-summary-prepare-unthreaded (nreverse headers))
8507 (goto-char (point-min))
8508 (gnus-summary-position-point)
8511 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8512 "Mark all unread articles in this newsgroup as read.
8513 If prefix argument ALL is non-nil, ticked and dormant articles will
8514 also be marked as read.
8515 If QUIETLY is non-nil, no questions will be asked.
8516 If TO-HERE is non-nil, it should be a point in the buffer. All
8517 articles before this point will be marked as read.
8518 Note that this function will only catch up the unread article
8519 in the current summary buffer limitation.
8520 The number of articles marked as read is returned."
8525 (not gnus-interactive-catchup) ;Without confirmation?
8529 "Mark absolutely all articles as read? "
8530 "Mark all unread articles as read? ")))
8532 (not gnus-newsgroup-adaptive)
8533 (not gnus-newsgroup-auto-expire)
8534 (not gnus-suppress-duplicates)
8535 (or (not gnus-use-cache)
8536 (eq gnus-use-cache 'passive)))
8539 (setq gnus-newsgroup-marked nil
8540 gnus-newsgroup-dormant nil))
8541 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8542 ;; We actually mark all articles as canceled, which we
8543 ;; have to do when using auto-expiry or adaptive scoring.
8544 (gnus-summary-show-all-threads)
8545 (when (gnus-summary-first-subject (not all) t)
8547 (if to-here (< (point) to-here) t)
8548 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8549 (gnus-summary-find-next (not all) nil nil t))))
8550 (gnus-set-mode-line 'summary))
8552 (gnus-summary-position-point)))
8554 (defun gnus-summary-catchup-to-here (&optional all)
8555 "Mark all unticked articles before the current one as read.
8556 If ALL is non-nil, also mark ticked and dormant articles as read."
8559 (gnus-save-hidden-threads
8560 (let ((beg (point)))
8561 ;; We check that there are unread articles.
8562 (when (or all (gnus-summary-find-prev))
8563 (gnus-summary-catchup all t beg)))))
8564 (gnus-summary-position-point))
8566 (defun gnus-summary-catchup-all (&optional quietly)
8567 "Mark all articles in this newsgroup as read."
8569 (gnus-summary-catchup t quietly))
8571 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8572 "Mark all unread articles in this group as read, then exit.
8573 If prefix argument ALL is non-nil, all articles are marked as read."
8575 (when (gnus-summary-catchup all quietly nil 'fast)
8576 ;; Select next newsgroup or exit.
8577 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8578 (eq gnus-auto-select-next 'quietly))
8579 (gnus-summary-next-group nil)
8580 (gnus-summary-exit))))
8582 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8583 "Mark all articles in this newsgroup as read, and then exit."
8585 (gnus-summary-catchup-and-exit t quietly))
8587 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8588 "Mark all articles in this group as read and select the next group.
8589 If given a prefix, mark all articles, unread as well as ticked, as
8593 (gnus-summary-catchup all))
8594 (gnus-summary-next-group))
8596 ;; Thread-based commands.
8598 (defun gnus-summary-articles-in-thread (&optional article)
8599 "Return a list of all articles in the current thread.
8600 If ARTICLE is non-nil, return all articles in the thread that starts
8602 (let* ((article (or article (gnus-summary-article-number)))
8603 (data (gnus-data-find-list article))
8604 (top-level (gnus-data-level (car data)))
8606 (cond ((null gnus-thread-operation-ignore-subject)
8607 (gnus-simplify-subject-re
8608 (mail-header-subject (gnus-data-header (car data)))))
8609 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8610 (gnus-simplify-subject-fuzzy
8611 (mail-header-subject (gnus-data-header (car data)))))
8613 (end-point (save-excursion
8614 (if (gnus-summary-go-to-next-thread)
8615 (point) (point-max))))
8618 (< (gnus-data-pos (car data)) end-point))
8619 (when (or (not top-subject)
8620 (string= top-subject
8621 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8622 (gnus-simplify-subject-fuzzy
8623 (mail-header-subject
8624 (gnus-data-header (car data))))
8625 (gnus-simplify-subject-re
8626 (mail-header-subject
8627 (gnus-data-header (car data)))))))
8628 (push (gnus-data-number (car data)) articles))
8629 (unless (and (setq data (cdr data))
8630 (> (gnus-data-level (car data)) top-level))
8632 ;; Return the list of articles.
8633 (nreverse articles)))
8635 (defun gnus-summary-rethread-current ()
8636 "Rethread the thread the current article is part of."
8638 (let* ((gnus-show-threads t)
8639 (article (gnus-summary-article-number))
8640 (id (mail-header-id (gnus-summary-article-header)))
8641 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8643 (error "No article on the current line"))
8644 (gnus-rebuild-thread id)
8645 (gnus-summary-goto-subject article)))
8647 (defun gnus-summary-reparent-thread ()
8648 "Make the current article child of the marked (or previous) article.
8650 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8651 is non-nil or the Subject: of both articles are the same."
8653 (unless (not (gnus-group-read-only-p))
8654 (error "The current newsgroup does not support article editing"))
8655 (unless (<= (length gnus-newsgroup-processable) 1)
8656 (error "No more than one article may be marked"))
8657 (save-window-excursion
8658 (let ((gnus-article-buffer " *reparent*")
8659 (current-article (gnus-summary-article-number))
8660 ;; First grab the marked article, otherwise one line up.
8661 (parent-article (if (not (null gnus-newsgroup-processable))
8662 (car gnus-newsgroup-processable)
8664 (if (eq (forward-line -1) 0)
8665 (gnus-summary-article-number)
8666 (error "Beginning of summary buffer"))))))
8667 (unless (not (eq current-article parent-article))
8668 (error "An article may not be self-referential"))
8669 (let ((message-id (mail-header-id
8670 (gnus-summary-article-header parent-article))))
8671 (unless (and message-id (not (equal message-id "")))
8672 (error "No message-id in desired parent"))
8673 (gnus-with-article current-article
8674 (goto-char (point-min))
8675 (if (re-search-forward "^References: " nil t)
8677 (re-search-forward "^[^ \t]" nil t)
8680 (insert " " message-id))
8681 (insert "References: " message-id "\n")))
8682 (set-buffer gnus-summary-buffer)
8683 (gnus-summary-unmark-all-processable)
8684 (gnus-summary-update-article current-article)
8685 (gnus-summary-rethread-current)
8686 (gnus-message 3 "Article %d is now the child of article %d"
8687 current-article parent-article)))))
8689 (defun gnus-summary-toggle-threads (&optional arg)
8690 "Toggle showing conversation threads.
8691 If ARG is positive number, turn showing conversation threads on."
8693 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8694 (setq gnus-show-threads
8695 (if (null arg) (not gnus-show-threads)
8696 (> (prefix-numeric-value arg) 0)))
8697 (gnus-summary-prepare)
8698 (gnus-summary-goto-subject current)
8699 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8700 (gnus-summary-position-point)))
8702 (defun gnus-summary-show-all-threads ()
8706 (let ((buffer-read-only nil))
8707 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8708 (gnus-summary-position-point))
8710 (defun gnus-summary-show-thread ()
8711 "Show thread subtrees.
8712 Returns nil if no thread was there to be shown."
8714 (let ((buffer-read-only nil)
8716 ;; first goto end then to beg, to have point at beg after let
8717 (end (progn (end-of-line) (point)))
8718 (beg (progn (beginning-of-line) (point))))
8720 ;; Any hidden lines here?
8721 (search-forward "\r" end t)
8722 (subst-char-in-region beg end ?\^M ?\n t)
8724 (gnus-summary-position-point))))
8726 (defun gnus-summary-hide-all-threads ()
8727 "Hide all thread subtrees."
8730 (goto-char (point-min))
8731 (gnus-summary-hide-thread)
8732 (while (zerop (gnus-summary-next-thread 1 t))
8733 (gnus-summary-hide-thread)))
8734 (gnus-summary-position-point))
8736 (defun gnus-summary-hide-thread ()
8737 "Hide thread subtrees.
8738 Returns nil if no threads were there to be hidden."
8740 (let ((buffer-read-only nil)
8742 (article (gnus-summary-article-number)))
8744 ;; Go forward until either the buffer ends or the subthread
8746 (when (and (not (eobp))
8747 (or (zerop (gnus-summary-next-thread 1 t))
8748 (goto-char (point-max))))
8750 (if (and (> (point) start)
8751 (search-backward "\n" start t))
8753 (subst-char-in-region start (point) ?\n ?\^M)
8754 (gnus-summary-goto-subject article))
8757 ;;(gnus-summary-position-point)
8760 (defun gnus-summary-go-to-next-thread (&optional previous)
8761 "Go to the same level (or less) next thread.
8762 If PREVIOUS is non-nil, go to previous thread instead.
8763 Return the article number moved to, or nil if moving was impossible."
8764 (let ((level (gnus-summary-thread-level))
8765 (way (if previous -1 1))
8768 (while (and (not (eobp))
8769 (< level (gnus-summary-thread-level)))
8777 (gnus-summary-article-number)
8780 (defun gnus-summary-next-thread (n &optional silent)
8781 "Go to the same level next N'th thread.
8782 If N is negative, search backward instead.
8783 Returns the difference between N and the number of skips actually
8786 If SILENT, don't output messages."
8788 (let ((backward (< n 0))
8791 (gnus-summary-go-to-next-thread backward))
8794 (gnus-summary-position-point))
8795 (when (and (not silent) (/= 0 n))
8796 (gnus-message 7 "No more threads"))
8799 (defun gnus-summary-prev-thread (n)
8800 "Go to the same level previous N'th thread.
8801 Returns the difference between N and the number of skips actually
8804 (gnus-summary-next-thread (- n)))
8806 (defun gnus-summary-go-down-thread ()
8807 "Go down one level in the current thread."
8808 (let ((children (gnus-summary-article-children)))
8810 (gnus-summary-goto-subject (car children)))))
8812 (defun gnus-summary-go-up-thread ()
8813 "Go up one level in the current thread."
8814 (let ((parent (gnus-summary-article-parent)))
8816 (gnus-summary-goto-subject parent))))
8818 (defun gnus-summary-down-thread (n)
8819 "Go down thread N steps.
8820 If N is negative, go up instead.
8821 Returns the difference between N and how many steps down that were
8827 (if up (gnus-summary-go-up-thread)
8828 (gnus-summary-go-down-thread)))
8830 (gnus-summary-position-point)
8832 (gnus-message 7 "Can't go further"))
8835 (defun gnus-summary-up-thread (n)
8836 "Go up thread N steps.
8837 If N is negative, go up instead.
8838 Returns the difference between N and how many steps down that were
8841 (gnus-summary-down-thread (- n)))
8843 (defun gnus-summary-top-thread ()
8844 "Go to the top of the thread."
8846 (while (gnus-summary-go-up-thread))
8847 (gnus-summary-article-number))
8849 (defun gnus-summary-kill-thread (&optional unmark)
8850 "Mark articles under current thread as read.
8851 If the prefix argument is positive, remove any kinds of marks.
8852 If the prefix argument is negative, tick articles instead."
8855 (setq unmark (prefix-numeric-value unmark)))
8856 (let ((articles (gnus-summary-articles-in-thread)))
8858 ;; Expand the thread.
8859 (gnus-summary-show-thread)
8860 ;; Mark all the articles.
8862 (gnus-summary-goto-subject (car articles))
8863 (cond ((null unmark)
8864 (gnus-summary-mark-article-as-read gnus-killed-mark))
8866 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8868 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8869 (setq articles (cdr articles))))
8870 ;; Hide killed subtrees.
8872 gnus-thread-hide-killed
8873 (gnus-summary-hide-thread))
8874 ;; If marked as read, go to next unread subject.
8876 ;; Go to next unread subject.
8877 (gnus-summary-next-subject 1 t)))
8878 (gnus-set-mode-line 'summary))
8880 ;; Summary sorting commands
8882 (defun gnus-summary-sort-by-number (&optional reverse)
8883 "Sort the summary buffer by article number.
8884 Argument REVERSE means reverse order."
8886 (gnus-summary-sort 'number reverse))
8888 (defun gnus-summary-sort-by-author (&optional reverse)
8889 "Sort the summary buffer by author name alphabetically.
8890 If case-fold-search is non-nil, case of letters is ignored.
8891 Argument REVERSE means reverse order."
8893 (gnus-summary-sort 'author reverse))
8895 (defun gnus-summary-sort-by-subject (&optional reverse)
8896 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8897 If case-fold-search is non-nil, case of letters is ignored.
8898 Argument REVERSE means reverse order."
8900 (gnus-summary-sort 'subject reverse))
8902 (defun gnus-summary-sort-by-date (&optional reverse)
8903 "Sort the summary buffer by date.
8904 Argument REVERSE means reverse order."
8906 (gnus-summary-sort 'date reverse))
8908 (defun gnus-summary-sort-by-score (&optional reverse)
8909 "Sort the summary buffer by score.
8910 Argument REVERSE means reverse order."
8912 (gnus-summary-sort 'score reverse))
8914 (defun gnus-summary-sort-by-lines (&optional reverse)
8915 "Sort the summary buffer by the number of lines.
8916 Argument REVERSE means reverse order."
8918 (gnus-summary-sort 'lines reverse))
8920 (defun gnus-summary-sort-by-chars (&optional reverse)
8921 "Sort the summary buffer by article length.
8922 Argument REVERSE means reverse order."
8924 (gnus-summary-sort 'chars reverse))
8926 (defun gnus-summary-sort (predicate reverse)
8927 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8928 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8929 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8930 (gnus-thread-sort-functions
8935 (gnus-article-sort-functions
8941 (gnus-summary-prepare-hook nil))
8942 ;; We do the sorting by regenerating the threads.
8943 (gnus-summary-prepare)
8944 ;; Hide subthreads if needed.
8945 (when (and gnus-show-threads gnus-thread-hide-subtree)
8946 (gnus-summary-hide-all-threads))))
8948 ;; Summary saving commands.
8950 (defun gnus-summary-save-article (&optional n not-saved)
8951 "Save the current article using the default saver function.
8952 If N is a positive number, save the N next articles.
8953 If N is a negative number, save the N previous articles.
8954 If N is nil and any articles have been marked with the process mark,
8955 save those articles instead.
8956 The variable `gnus-default-article-saver' specifies the saver function."
8958 (let* ((articles (gnus-summary-work-articles n))
8959 (save-buffer (save-excursion
8960 (nnheader-set-temp-buffer " *Gnus Save*")))
8961 (num (length articles))
8963 (dolist (article articles)
8964 (setq header (gnus-summary-article-header article))
8965 (if (not (vectorp header))
8966 ;; This is a pseudo-article.
8967 (if (assq 'name header)
8968 (gnus-copy-file (cdr (assq 'name header)))
8969 (gnus-message 1 "Article %d is unsaveable" article))
8970 ;; This is a real article.
8971 (save-window-excursion
8972 (gnus-summary-select-article t nil nil article))
8974 (set-buffer save-buffer)
8976 (insert-buffer-substring gnus-original-article-buffer))
8977 (setq file (gnus-article-save save-buffer file num))
8978 (gnus-summary-remove-process-mark article)
8980 (gnus-summary-set-saved-mark article))))
8981 (gnus-kill-buffer save-buffer)
8982 (gnus-summary-position-point)
8983 (gnus-set-mode-line 'summary)
8986 (defun gnus-summary-pipe-output (&optional arg)
8987 "Pipe the current article to a subprocess.
8988 If N is a positive number, pipe the N next articles.
8989 If N is a negative number, pipe the N previous articles.
8990 If N is nil and any articles have been marked with the process mark,
8991 pipe those articles instead."
8993 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8994 (gnus-summary-save-article arg t))
8995 (gnus-configure-windows 'pipe))
8997 (defun gnus-summary-save-article-mail (&optional arg)
8998 "Append the current article to an mail file.
8999 If N is a positive number, save the N next articles.
9000 If N is a negative number, save the N previous articles.
9001 If N is nil and any articles have been marked with the process mark,
9002 save those articles instead."
9004 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
9005 (gnus-summary-save-article arg)))
9007 (defun gnus-summary-save-article-rmail (&optional arg)
9008 "Append the current article to an rmail file.
9009 If N is a positive number, save the N next articles.
9010 If N is a negative number, save the N previous articles.
9011 If N is nil and any articles have been marked with the process mark,
9012 save those articles instead."
9014 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
9015 (gnus-summary-save-article arg)))
9017 (defun gnus-summary-save-article-file (&optional arg)
9018 "Append the current article to a file.
9019 If N is a positive number, save the N next articles.
9020 If N is a negative number, save the N previous articles.
9021 If N is nil and any articles have been marked with the process mark,
9022 save those articles instead."
9024 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
9025 (gnus-summary-save-article arg)))
9027 (defun gnus-summary-write-article-file (&optional arg)
9028 "Write the current article to a file, deleting the previous file.
9029 If N is a positive number, save the N next articles.
9030 If N is a negative number, save the N previous articles.
9031 If N is nil and any articles have been marked with the process mark,
9032 save those articles instead."
9034 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
9035 (gnus-summary-save-article arg)))
9037 (defun gnus-summary-save-article-body-file (&optional arg)
9038 "Append the current article body to a file.
9039 If N is a positive number, save the N next articles.
9040 If N is a negative number, save the N previous articles.
9041 If N is nil and any articles have been marked with the process mark,
9042 save those articles instead."
9044 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
9045 (gnus-summary-save-article arg)))
9047 (defun gnus-summary-pipe-message (program)
9048 "Pipe the current article through PROGRAM."
9049 (interactive "sProgram: ")
9050 (gnus-summary-select-article)
9051 (let ((mail-header-separator ""))
9052 (gnus-eval-in-buffer-window gnus-article-buffer
9055 (let ((start (window-start))
9057 (message-pipe-buffer-body program)
9058 (set-window-start (get-buffer-window (current-buffer)) start))))))
9060 (defun gnus-get-split-value (methods)
9061 "Return a value based on the split METHODS."
9062 (let (split-name method result match)
9065 (set-buffer gnus-original-article-buffer)
9067 (nnheader-narrow-to-headers)
9069 (goto-char (point-min))
9070 (setq method (pop methods))
9071 (setq match (car method))
9074 ;; Regular expression.
9076 (re-search-forward match nil t)))
9077 ((gnus-functionp match)
9081 (setq result (funcall match gnus-newsgroup-name))))
9086 (setq result (eval match)))))
9087 (setq split-name (append (cdr method) split-name))
9088 (cond ((stringp result)
9089 (push (expand-file-name
9090 result gnus-article-save-directory)
9093 (setq split-name (append result split-name)))))))))
9094 (nreverse split-name)))
9096 (defun gnus-valid-move-group-p (group)
9099 (symbol-value group)
9100 (gnus-get-function (gnus-find-method-for-group
9101 (symbol-name group)) 'request-accept-article t)))
9103 (defun gnus-read-move-group-name (prompt default articles prefix)
9104 "Read a group name."
9105 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
9106 (minibuffer-confirm-incomplete nil) ; XEmacs
9110 (if (> (length articles) 1)
9111 (format "these %d articles" (length articles))
9116 (gnus-completing-read default prom
9118 'gnus-valid-move-group-p
9120 'gnus-group-history))
9121 ((= 1 (length split-name))
9122 (gnus-completing-read (car split-name) prom
9124 'gnus-valid-move-group-p
9126 'gnus-group-history))
9128 (gnus-completing-read nil prom
9129 (mapcar (lambda (el) (list el))
9130 (nreverse split-name))
9132 'gnus-group-history)))))
9134 (if (or (string= to-newsgroup "")
9135 (string= to-newsgroup prefix))
9136 (setq to-newsgroup default))
9137 (unless to-newsgroup
9138 (error "No group name entered"))
9139 (or (gnus-active to-newsgroup)
9140 (gnus-activate-group to-newsgroup)
9141 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9143 (or (and (gnus-request-create-group
9144 to-newsgroup (gnus-group-name-to-method to-newsgroup))
9145 (gnus-activate-group
9146 to-newsgroup nil nil
9147 (gnus-group-name-to-method to-newsgroup))
9148 (gnus-subscribe-group to-newsgroup))
9149 (error "Couldn't create group %s" to-newsgroup)))
9150 (error "No such group: %s" to-newsgroup)))
9153 (defun gnus-summary-save-parts (type dir n reverse)
9154 "Save parts matching TYPE to DIR.
9155 If REVERSE, save parts that do not match TYPE."
9157 (list (read-string "Save parts of type: " "image/.*")
9158 (read-file-name "Save to directory: " t nil t)
9159 current-prefix-arg))
9160 (gnus-summary-iterate n
9161 (let ((gnus-display-mime-function nil)
9162 (gnus-inhibit-treatment t))
9163 (gnus-summary-select-article))
9165 (set-buffer gnus-article-buffer)
9166 (let ((handles (or (mm-dissect-buffer) (mm-uu-dissect))))
9168 (gnus-summary-save-parts-1 type dir handles reverse)
9169 (mm-destroy-parts handles))))))
9171 (defun gnus-summary-save-parts-1 (type dir handle reverse)
9172 (if (stringp (car handle))
9173 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
9176 (not (string-match type (mm-handle-media-type handle)))
9177 (string-match type (mm-handle-media-type handle)))
9178 (let ((file (expand-file-name
9179 (file-name-nondirectory
9181 (mail-content-type-get
9182 (mm-handle-disposition handle) 'filename)
9183 (concat gnus-newsgroup-name "." gnus-current-article)))
9185 (unless (file-exists-p file)
9186 (mm-save-part-to-file handle file))))))
9188 ;; Summary extract commands
9190 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
9191 (let ((buffer-read-only nil)
9192 (article (gnus-summary-article-number))
9194 (unless (gnus-summary-goto-subject article)
9195 (error "No such article: %d" article))
9196 (gnus-summary-position-point)
9197 ;; If all commands are to be bunched up on one line, we collect
9199 (unless gnus-view-pseudos-separately
9200 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
9203 (setq action (cdr (assq 'action (car ps))))
9204 (setq files (list (cdr (assq 'name (car ps)))))
9205 (while (and ps (cdr ps)
9206 (string= (or action "1")
9207 (or (cdr (assq 'action (cadr ps))) "2")))
9208 (push (cdr (assq 'name (cadr ps))) files)
9209 (setcdr ps (cddr ps)))
9211 (when (not (string-match "%s" action))
9214 (when (assq 'execute (car ps))
9215 (setcdr (assq 'execute (car ps))
9216 (funcall (if (string-match "%s" action)
9223 (gnus-quote-arg-for-sh-or-csh f)))
9225 (setq ps (cdr ps)))))
9226 (if (and gnus-view-pseudos (not not-view))
9228 (when (assq 'execute (car pslist))
9229 (gnus-execute-command (cdr (assq 'execute (car pslist)))
9230 (eq gnus-view-pseudos 'not-confirm)))
9231 (setq pslist (cdr pslist)))
9234 (setq after-article (or (cdr (assq 'article (car pslist)))
9235 (gnus-summary-article-number)))
9236 (gnus-summary-goto-subject after-article)
9239 (insert " " (file-name-nondirectory
9240 (cdr (assq 'name (car pslist))))
9241 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
9243 (forward-line -1) ; back to `b'
9244 (gnus-add-text-properties
9245 b (1- e) (list 'gnus-number gnus-reffed-article-number
9246 gnus-mouse-face-prop gnus-mouse-face))
9248 after-article gnus-reffed-article-number
9249 gnus-unread-mark b (car pslist) 0 (- e b))
9250 (push gnus-reffed-article-number gnus-newsgroup-unreads)
9251 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
9252 (setq pslist (cdr pslist)))))))
9254 (defun gnus-pseudos< (p1 p2)
9255 (let ((c1 (cdr (assq 'action p1)))
9256 (c2 (cdr (assq 'action p2))))
9257 (and c1 c2 (string< c1 c2))))
9259 (defun gnus-request-pseudo-article (props)
9260 (cond ((assq 'execute props)
9261 (gnus-execute-command (cdr (assq 'execute props)))))
9262 (let ((gnus-current-article (gnus-summary-article-number)))
9263 (gnus-run-hooks 'gnus-mark-article-hook)))
9265 (defun gnus-execute-command (command &optional automatic)
9267 (gnus-article-setup-buffer)
9268 (set-buffer gnus-article-buffer)
9269 (setq buffer-read-only nil)
9270 (let ((command (if automatic command
9271 (read-string "Command: " (cons command 0)))))
9273 (insert "$ " command "\n\n")
9274 (if gnus-view-pseudo-asynchronously
9275 (start-process "gnus-execute" (current-buffer) shell-file-name
9276 shell-command-switch command)
9277 (call-process shell-file-name nil t nil
9278 shell-command-switch command)))))
9280 ;; Summary kill commands.
9282 (defun gnus-summary-edit-global-kill (article)
9283 "Edit the \"global\" kill file."
9284 (interactive (list (gnus-summary-article-number)))
9285 (gnus-group-edit-global-kill article))
9287 (defun gnus-summary-edit-local-kill ()
9288 "Edit a local kill file applied to the current newsgroup."
9290 (setq gnus-current-headers (gnus-summary-article-header))
9291 (gnus-group-edit-local-kill
9292 (gnus-summary-article-number) gnus-newsgroup-name))
9296 (defun gnus-read-header (id &optional header)
9297 "Read the headers of article ID and enter them into the Gnus system."
9298 (let ((group gnus-newsgroup-name)
9299 (gnus-override-method
9300 (and (gnus-news-group-p gnus-newsgroup-name)
9301 gnus-refer-article-method))
9303 ;; First we check to see whether the header in question is already
9306 ;; This is a Message-ID.
9307 (setq header (or header (gnus-id-to-header id)))
9308 ;; This is an article number.
9309 (setq header (or header (gnus-summary-article-header id))))
9311 (not (gnus-summary-article-sparse-p (mail-header-number header))))
9312 ;; We have found the header.
9314 ;; If this is a sparse article, we have to nix out its
9315 ;; previous entry in the thread hashtb.
9317 (gnus-summary-article-sparse-p (mail-header-number header)))
9318 (let* ((parent (gnus-parent-id (mail-header-references header)))
9319 (thread (and parent (gnus-id-to-thread parent))))
9321 (delq (assq header thread) thread))))
9322 ;; We have to really fetch the header to this article.
9324 (set-buffer nntp-server-buffer)
9325 (when (setq where (gnus-request-head id group))
9326 (nnheader-fold-continuation-lines)
9327 (goto-char (point-max))
9329 (goto-char (point-min))
9333 ((cdr where) (cdr where))
9334 (header (mail-header-number header))
9335 (t gnus-reffed-article-number))
9337 (insert " Article retrieved.\n"))
9339 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
9340 () ; Malformed head.
9341 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9342 (when (and (stringp id)
9343 (not (string= (gnus-group-real-name group)
9345 ;; If we fetched by Message-ID and the article came
9346 ;; from a different group, we fudge some bogus article
9347 ;; numbers for this article.
9348 (mail-header-set-number header gnus-reffed-article-number))
9350 (set-buffer gnus-summary-buffer)
9351 (decf gnus-reffed-article-number)
9352 (gnus-remove-header (mail-header-number header))
9353 (push header gnus-newsgroup-headers)
9354 (setq gnus-current-headers header)
9355 (push (mail-header-number header) gnus-newsgroup-limit)))
9358 (defun gnus-remove-header (number)
9359 "Remove header NUMBER from `gnus-newsgroup-headers'."
9360 (if (and gnus-newsgroup-headers
9361 (= number (mail-header-number (car gnus-newsgroup-headers))))
9362 (pop gnus-newsgroup-headers)
9363 (let ((headers gnus-newsgroup-headers))
9364 (while (and (cdr headers)
9365 (not (= number (mail-header-number (cadr headers)))))
9368 (setcdr headers (cddr headers))))))
9371 ;;; summary highlights
9374 (defun gnus-highlight-selected-summary ()
9375 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9376 ;; Highlight selected article in summary buffer
9377 (when gnus-summary-selected-face
9379 (let* ((beg (progn (beginning-of-line) (point)))
9380 (end (progn (end-of-line) (point)))
9381 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9382 (from (if (get-text-property beg gnus-mouse-face-prop)
9384 (or (next-single-property-change
9385 beg gnus-mouse-face-prop nil end)
9390 (or (next-single-property-change
9391 from gnus-mouse-face-prop nil end)
9393 ;; If no mouse-face prop on line we will have to = from = end,
9394 ;; so we highlight the entire line instead.
9395 (when (= (+ to 2) from)
9398 (if gnus-newsgroup-selected-overlay
9399 ;; Move old overlay.
9401 gnus-newsgroup-selected-overlay from to (current-buffer))
9402 ;; Create new overlay.
9404 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9405 'face gnus-summary-selected-face))))))
9407 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9408 (defun gnus-summary-highlight-line ()
9409 "Highlight current line according to `gnus-summary-highlight'."
9410 (let* ((list gnus-summary-highlight)
9412 (end (progn (end-of-line) (point)))
9413 ;; now find out where the line starts and leave point there.
9414 (beg (progn (beginning-of-line) (point)))
9415 (article (gnus-summary-article-number))
9416 (score (or (cdr (assq (or article gnus-current-article)
9417 gnus-newsgroup-scored))
9418 gnus-summary-default-score 0))
9419 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9420 (inhibit-read-only t))
9421 ;; Eval the cars of the lists until we find a match.
9422 (let ((default gnus-summary-default-score))
9424 (not (eval (caar list))))
9425 (setq list (cdr list))))
9426 (let ((face (cdar list)))
9427 (unless (eq face (get-text-property beg 'face))
9428 (gnus-put-text-property-excluding-characters-with-faces
9430 (setq face (if (boundp face) (symbol-value face) face)))
9431 (when gnus-summary-highlight-line-function
9432 (funcall gnus-summary-highlight-line-function article face))))
9435 (defun gnus-update-read-articles (group unread &optional compute)
9436 "Update the list of read articles in GROUP."
9437 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9438 (entry (gnus-gethash group gnus-newsrc-hashtb))
9439 (info (nth 2 entry))
9441 (unread (sort (copy-sequence unread) '<))
9443 (if (or (not info) (not active))
9444 ;; There is no info on this group if it was, in fact,
9445 ;; killed. Gnus stores no information on killed groups, so
9446 ;; there's nothing to be done.
9447 ;; One could store the information somewhere temporarily,
9448 ;; perhaps... Hmmm...
9450 ;; Remove any negative articles numbers.
9451 (while (and unread (< (car unread) 0))
9452 (setq unread (cdr unread)))
9453 ;; Remove any expired article numbers
9454 (while (and unread (< (car unread) (car active)))
9455 (setq unread (cdr unread)))
9456 ;; Compute the ranges of read articles by looking at the list of
9459 (when (/= (car unread) prev)
9460 (push (if (= prev (1- (car unread))) prev
9461 (cons prev (1- (car unread))))
9463 (setq prev (1+ (car unread)))
9464 (setq unread (cdr unread)))
9465 (when (<= prev (cdr active))
9466 (push (cons prev (cdr active)) read))
9467 (setq read (if (> (length read) 1) (nreverse read) read))
9471 (set-buffer gnus-group-buffer)
9474 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9475 (gnus-info-set-read ',info ',(gnus-info-read info))
9476 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9477 (gnus-group-update-group ,group t))))
9478 ;; Propagate the read marks to the backend.
9479 (if (gnus-check-backend-function 'request-set-mark group)
9480 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9481 (add (gnus-remove-from-range read (gnus-info-read info))))
9483 (unless (gnus-check-group group)
9484 (error "Can't open server for %s" group))
9485 (gnus-request-set-mark
9486 group (delq nil (list (if add (list add 'add '(read)))
9487 (if del (list del 'del '(read)))))))))
9488 ;; Enter this list into the group info.
9489 (gnus-info-set-read info read)
9490 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9491 (gnus-get-unread-articles-in-group info (gnus-active group))
9494 (defun gnus-offer-save-summaries ()
9495 "Offer to save all active summary buffers."
9497 (let ((buflist (buffer-list))
9499 ;; Go through all buffers and find all summaries.
9501 (and (setq bufname (buffer-name (car buflist)))
9502 (string-match "Summary" bufname)
9504 (set-buffer bufname)
9505 ;; We check that this is, indeed, a summary buffer.
9506 (and (eq major-mode 'gnus-summary-mode)
9507 ;; Also make sure this isn't bogus.
9508 gnus-newsgroup-prepared
9509 ;; Also make sure that this isn't a dead summary buffer.
9510 (not gnus-dead-summary-mode)))
9511 (push bufname buffers))
9512 (setq buflist (cdr buflist)))
9513 ;; Go through all these summary buffers and offer to save them.
9516 "Update summary buffer %s? "
9518 (switch-to-buffer buf)
9519 (gnus-summary-exit))
9523 ;;; @ for mime-partial
9526 (defun gnus-request-partial-message ()
9528 (let ((number (gnus-summary-article-number))
9529 (group gnus-newsgroup-name)
9530 (mother gnus-article-buffer))
9531 (set-buffer (get-buffer-create " *Partial Article*"))
9533 (setq mime-preview-buffer mother)
9534 (gnus-request-article-this-buffer number group)
9538 (autoload 'mime-combine-message/partial-pieces-automatically
9540 "Internal method to combine message/partial messages automatically.")
9543 'action '((type . message)(subtype . partial)
9544 (major-mode . gnus-original-article-mode)
9545 (method . mime-combine-message/partial-pieces-automatically)
9546 (summary-buffer-exp . gnus-summary-buffer)
9547 (request-partial-message-method . gnus-request-partial-message)
9551 ;;; @ for message/rfc822
9554 (defun gnus-mime-extract-message/rfc822 (entity situation)
9555 (let (group article num cwin swin cur)
9556 (with-current-buffer (mime-entity-buffer entity)
9558 (narrow-to-region (mime-entity-body-start entity)
9559 (mime-entity-body-end entity))
9560 (setq group (or (cdr (assq 'group situation))
9561 (completing-read "Group: "
9564 (gnus-read-active-file-p)
9565 gnus-newsgroup-name))
9566 article (gnus-request-accept-article group)
9569 (when (and (consp article)
9570 (numberp (setq article (cdr article))))
9571 (setq num (1+ (or (cdr (assq 'number situation)) 0))
9572 cwin (get-buffer-window (current-buffer) t)
9574 (save-window-excursion
9575 (if (setq swin (get-buffer-window gnus-summary-buffer t))
9576 (select-window swin)
9577 (set-buffer gnus-summary-buffer)
9579 (setq cur gnus-current-article)
9581 (let (gnus-show-threads)
9582 (gnus-summary-goto-subject article t)
9584 (gnus-summary-clear-mark-forward 1)
9585 (gnus-summary-goto-subject cur)
9587 (when (and cwin (window-frame cwin))
9588 (select-frame (window-frame cwin))
9590 (when (boundp 'mime-acting-situation-to-override)
9591 (set-alist 'mime-acting-situation-to-override
9594 (set-alist 'mime-acting-situation-to-override
9597 (save-current-buffer
9598 (set-buffer gnus-group-buffer)
9599 (gnus-activate-group ,group)
9601 (gnus-summary-goto-article ,cur
9602 gnus-show-all-headers)
9604 (set-alist 'mime-acting-situation-to-override
9610 'action '((type . message)(subtype . rfc822)
9611 (major-mode . gnus-original-article-mode)
9612 (method . gnus-mime-extract-message/rfc822)
9617 'action '((type . message)(subtype . news)
9618 (major-mode . gnus-original-article-mode)
9619 (method . gnus-mime-extract-message/rfc822)
9623 (defun gnus-mime-extract-multipart (entity situation)
9624 (let ((children (mime-entity-children entity))
9625 mime-acting-situation-to-override
9628 (mime-play-entity (car children)
9629 (cons (assq 'mode situation)
9630 mime-acting-situation-to-override))
9631 (setq children (cdr children)))
9632 (if (setq f (cdr (assq 'after-method
9633 mime-acting-situation-to-override)))
9638 'action '((type . multipart)
9639 (method . gnus-mime-extract-multipart)
9648 (defun gnus-summary-setup-default-charset ()
9649 "Setup newsgroup default charset."
9650 (if (equal gnus-newsgroup-name "nndraft:drafts")
9651 (setq gnus-newsgroup-charset nil)
9652 (let* ((name (and gnus-newsgroup-name
9653 (gnus-group-real-name gnus-newsgroup-name)))
9655 (or gnus-newsgroup-ephemeral-ignored-charsets
9657 (and gnus-newsgroup-name
9658 (or (gnus-group-find-parameter gnus-newsgroup-name
9659 'ignored-charsets t)
9660 (let ((alist gnus-group-ignored-charsets-alist)
9661 elem (charsets nil))
9662 (while (setq elem (pop alist))
9664 (string-match (car elem) name))
9666 charsets (cdr elem))))
9668 gnus-newsgroup-ignored-charsets)))
9669 (setq gnus-newsgroup-charset
9670 (or gnus-newsgroup-ephemeral-charset
9671 (and gnus-newsgroup-name
9672 (or (gnus-group-find-parameter gnus-newsgroup-name
9674 (let ((alist gnus-group-charset-alist)
9676 (while (setq elem (pop alist))
9678 (string-match (car elem) name))
9680 charset (cadr elem))))
9682 gnus-default-charset))
9683 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
9684 ignored-charsets))))
9690 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9691 "Display the current article buffer fully MIME-buttonized.
9692 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9693 treated as multipart/mixed."
9696 (let ((gnus-unbuttonized-mime-types nil)
9697 (gnus-mime-display-multipart-as-mixed show-all-parts))
9698 (gnus-summary-show-article)))
9700 (defun gnus-summary-repair-multipart (article)
9701 "Add a Content-Type header to a multipart article without one."
9702 (interactive (list (gnus-summary-article-number)))
9703 (gnus-with-article article
9704 (message-narrow-to-head)
9705 (goto-char (point-max))
9707 (when (search-forward "\n--" nil t)
9708 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9709 (message-narrow-to-head)
9710 (message-remove-header "Mime-Version")
9711 (message-remove-header "Content-Type")
9712 (goto-char (point-max))
9713 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9715 (insert "Mime-Version: 1.0\n")
9717 (let (gnus-mark-article-hook)
9718 (gnus-summary-select-article t t nil article)))
9720 (defun gnus-summary-toggle-display-buttonized ()
9721 "Toggle the buttonizing of the article buffer."
9724 (if (setq gnus-inhibit-mime-unbuttonizing
9725 (not gnus-inhibit-mime-unbuttonizing))
9726 (let ((gnus-unbuttonized-mime-types nil))
9727 (gnus-summary-show-article))
9728 (gnus-summary-show-article)))
9731 ;;; Intelli-mouse commmands
9734 (defun gnus-wheel-summary-scroll (event)
9736 (let ((amount (if (memq 'shift (event-modifiers event))
9737 (car gnus-wheel-scroll-amount)
9738 (cdr gnus-wheel-scroll-amount)))
9739 (direction (- (* (static-if (featurep 'xemacs)
9740 (event-button event)
9741 (cond ((eq 'mouse-4 (event-basic-type event))
9743 ((eq 'mouse-5 (event-basic-type event))
9747 (gnus-summary-scroll-up (* amount direction))
9748 (when (gnus-eval-in-buffer-window gnus-article-buffer
9751 (and (if (< 0 direction)
9752 (gnus-article-next-page 0)
9753 (gnus-article-prev-page 0)
9755 (if (setq edge (get-text-property
9756 (point-min) 'gnus-wheel-edge))
9757 (setq edge (* edge direction))
9760 (let ((buffer-read-only nil)
9761 (inhibit-read-only t))
9762 (put-text-property (point-min) (point-max)
9763 'gnus-wheel-edge direction)
9765 (or (> edge gnus-wheel-edge-resistance)
9766 (let ((buffer-read-only nil)
9767 (inhibit-read-only t))
9768 (put-text-property (point-min) (point-max)
9770 (* (1+ edge) direction))
9772 (eq last-command 'gnus-wheel-summary-scroll))
9774 (gnus-summary-next-article nil nil (minusp direction)))
9777 (defun gnus-wheel-install ()
9778 "Enable mouse wheel support on summary window."
9779 (when gnus-use-wheel
9781 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
9783 (define-key gnus-summary-mode-map key
9784 'gnus-wheel-summary-scroll)))))
9786 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
9792 (defmacro gnus-with-article (article &rest forms)
9793 "Select ARTICLE and perform FORMS in the original article buffer.
9794 Then replace the article with the result."
9796 ;; We don't want the article to be marked as read.
9797 (let (gnus-mark-article-hook)
9798 (gnus-summary-select-article t t nil ,article))
9799 (set-buffer gnus-original-article-buffer)
9801 (if (not (gnus-check-backend-function
9802 'request-replace-article (car gnus-article-current)))
9803 (gnus-message 5 "Read-only group; not replacing")
9804 (unless (gnus-request-replace-article
9805 ,article (car gnus-article-current)
9807 (error "Couldn't replace article")))
9808 ;; The cache and backlog have to be flushed somewhat.
9809 (when gnus-keep-backlog
9810 (gnus-backlog-remove-article
9811 (car gnus-article-current) (cdr gnus-article-current)))
9812 (when gnus-use-cache
9813 (gnus-cache-update-article
9814 (car gnus-article-current) (cdr gnus-article-current)))))
9816 (put 'gnus-with-article 'lisp-indent-function 1)
9817 (put 'gnus-with-article 'edebug-form-spec '(form body))
9820 ;;; Generic summary marking commands
9823 (defvar gnus-summary-marking-alist
9824 '((read gnus-del-mark "d")
9825 (unread gnus-unread-mark "u")
9826 (ticked gnus-ticked-mark "!")
9827 (dormant gnus-dormant-mark "?")
9828 (expirable gnus-expirable-mark "e"))
9829 "An alist of names/marks/keystrokes.")
9831 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
9832 (defvar gnus-summary-mark-map)
9834 (defun gnus-summary-make-all-marking-commands ()
9835 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
9836 (dolist (elem gnus-summary-marking-alist)
9837 (apply 'gnus-summary-make-marking-command elem)))
9839 (defun gnus-summary-make-marking-command (name mark keystroke)
9840 (let ((map (make-sparse-keymap)))
9841 (define-key gnus-summary-generic-mark-map keystroke map)
9842 (dolist (lway `((next "next" next nil "n")
9843 (next-unread "next unread" next t "N")
9844 (prev "previous" prev nil "p")
9845 (prev-unread "previous unread" prev t "P")
9846 (nomove "" nil nil ,keystroke)))
9847 (let ((func (gnus-summary-make-marking-command-1
9848 mark (car lway) lway name)))
9849 (setq func (eval func))
9850 (define-key map (nth 4 lway) func)))))
9852 (defun gnus-summary-make-marking-command-1 (mark way lway name)
9854 (format "gnus-summary-put-mark-as-%s%s"
9855 name (if (eq way 'nomove)
9857 (concat "-" (symbol-name way)))))
9860 "Mark the current article as %s%s.
9861 If N, the prefix, then repeat N times.
9862 If N is negative, move in reverse order.
9863 The difference between N and the actual number of articles marked is
9865 name (car (cdr lway)))
9867 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
9869 (defun gnus-summary-generic-mark (n mark move unread)
9870 "Mark N articles with MARK."
9871 (unless (eq major-mode 'gnus-summary-mode)
9872 (error "This command can only be used in the summary buffer"))
9873 (gnus-summary-show-thread)
9877 ((eq move 'prev) -1)
9883 nummove (* -1 nummove))))
9885 (gnus-summary-mark-article nil mark)
9886 (zerop (gnus-summary-next-subject nummove unread t)))
9889 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9890 (gnus-summary-recenter)
9891 (gnus-summary-position-point)
9892 (gnus-set-mode-line 'summary)
9895 (gnus-summary-make-all-marking-commands)
9901 (run-hooks 'gnus-sum-load-hook)
9903 ;;; gnus-sum.el ends here