1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
35 (defcustom gnus-kill-summary-on-exit t
36 "*If non-nil, kill the summary buffer when you exit from it.
37 If nil, the summary will become a \"*Dead Summary*\" buffer, and
38 it will be killed sometime later."
39 :group 'gnus-summary-exit
42 (defcustom gnus-fetch-old-headers nil
43 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
44 If an unread article in the group refers to an older, already read (or
45 just marked as read) article, the old article will not normally be
46 displayed in the Summary buffer. If this variable is non-nil, Gnus
47 will attempt to grab the headers to the old articles, and thereby
48 build complete threads. If it has the value `some', only enough
49 headers to connect otherwise loose threads will be displayed.
50 This variable can also be a number. In that case, no more than that
51 number of old headers will be fetched.
53 The server has to support NOV for any of this to work."
55 :type '(choice (const :tag "off" nil)
58 (sexp :menu-tag "other" t)))
60 (defcustom gnus-summary-make-false-root 'adopt
61 "*nil means that Gnus won't gather loose threads.
62 If the root of a thread has expired or been read in a previous
63 session, the information necessary to build a complete thread has been
64 lost. Instead of having many small sub-threads from this original thread
65 scattered all over the summary buffer, Gnus can gather them.
67 If non-nil, Gnus will try to gather all loose sub-threads from an
68 original thread into one large thread.
70 If this variable is non-nil, it should be one of `none', `adopt',
73 If this variable is `none', Gnus will not make a false root, but just
74 present the sub-threads after another.
75 If this variable is `dummy', Gnus will create a dummy root that will
76 have all the sub-threads as children.
77 If this variable is `adopt', Gnus will make one of the \"children\"
78 the parent and mark all the step-children as such.
79 If this variable is `empty', the \"children\" are printed with empty
80 subject fields. (Or rather, they will be printed with a string
81 given by the `gnus-summary-same-subject' variable.)"
83 :type '(choice (const :tag "off" nil)
89 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
90 "*A regexp to match subjects to be excluded from loose thread gathering.
91 As loose thread gathering is done on subjects only, that means that
92 there can be many false gatherings performed. By rooting out certain
93 common subjects, gathering might become saner."
97 (defcustom gnus-summary-gather-subject-limit nil
98 "*Maximum length of subject comparisons when gathering loose threads.
99 Use nil to compare full subjects. Setting this variable to a low
100 number will help gather threads that have been corrupted by
101 newsreaders chopping off subject lines, but it might also mean that
102 unrelated articles that have subject that happen to begin with the
103 same few characters will be incorrectly gathered.
105 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
108 :type '(choice (const :tag "off" nil)
110 (sexp :menu-tag "on" t)))
112 (defcustom gnus-simplify-ignored-prefixes nil
113 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
115 :type '(choice (const :tag "off" nil)
118 (defcustom gnus-build-sparse-threads nil
119 "*If non-nil, fill in the gaps in threads.
120 If `some', only fill in the gaps that are needed to tie loose threads
121 together. If `more', fill in all leaf nodes that Gnus can find. If
122 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
124 :type '(choice (const :tag "off" nil)
127 (sexp :menu-tag "all" t)))
129 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
130 "Function used for gathering loose threads.
131 There are two pre-defined functions: `gnus-gather-threads-by-subject',
132 which only takes Subjects into consideration; and
133 `gnus-gather-threads-by-references', which compared the References
134 headers of the articles to find matches."
136 :type '(set (function-item gnus-gather-threads-by-subject)
137 (function-item gnus-gather-threads-by-references)
138 (function :tag "other")))
140 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
141 (defcustom gnus-summary-same-subject ""
142 "*String indicating that the current article has the same subject as the previous.
143 This variable will only be used if the value of
144 `gnus-summary-make-false-root' is `empty'."
145 :group 'gnus-summary-format
148 (defcustom gnus-summary-goto-unread t
149 "*If t, marking commands will go to the next unread article.
150 If `never', commands that usually go to the next unread article, will
151 go to the next article, whether it is read or not.
152 If nil, only the marking commands will go to the next (un)read article."
153 :group 'gnus-summary-marks
154 :link '(custom-manual "(gnus)Setting Marks")
155 :type '(choice (const :tag "off" nil)
157 (sexp :menu-tag "on" t)))
159 (defcustom gnus-summary-default-score 0
160 "*Default article score level.
161 If this variable is nil, scoring will be disabled."
162 :group 'gnus-score-default
163 :type '(choice (const :tag "disable")
166 (defcustom gnus-summary-zcore-fuzz 0
167 "*Fuzziness factor for the zcore in the summary buffer.
168 Articles with scores closer than this to `gnus-summary-default-score'
170 :group 'gnus-summary-format
173 (defcustom gnus-simplify-subject-fuzzy-regexp nil
174 "*Strings to be removed when doing fuzzy matches.
175 This can either be a regular expression or list of regular expressions
176 that will be removed from subject strings if fuzzy subject
177 simplification is selected."
179 :type '(repeat regexp))
181 (defcustom gnus-show-threads t
182 "*If non-nil, display threads in summary mode."
186 (defcustom gnus-thread-hide-subtree nil
187 "*If non-nil, hide all threads initially.
188 If threads are hidden, you have to run the command
189 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
190 to expose hidden threads."
194 (defcustom gnus-thread-hide-killed t
195 "*If non-nil, hide killed threads automatically."
199 (defcustom gnus-thread-ignore-subject nil
200 "*If non-nil, ignore subjects and do all threading based on the Reference header.
201 If nil, which is the default, articles that have different subjects
202 from their parents will start separate threads."
206 (defcustom gnus-thread-operation-ignore-subject t
207 "*If non-nil, subjects will be ignored when doing thread commands.
208 This affects commands like `gnus-summary-kill-thread' and
209 `gnus-summary-lower-thread'.
211 If this variable is nil, articles in the same thread with different
212 subjects will not be included in the operation in question. If this
213 variable is `fuzzy', only articles that have subjects that are fuzzily
214 equal will be included."
216 :type '(choice (const :tag "off" nil)
220 (defcustom gnus-thread-indent-level 4
221 "*Number that says how much each sub-thread should be indented."
225 (defcustom gnus-auto-extend-newsgroup t
226 "*If non-nil, extend newsgroup forward and backward when requested."
227 :group 'gnus-summary-choose
230 (defcustom gnus-auto-select-first t
231 "*If nil, don't select the first unread article when entering a group.
232 If this variable is `best', select the highest-scored unread article
233 in the group. If neither nil nor `best', select the first unread
236 If you want to prevent automatic selection of the first unread article
237 in some newsgroups, set the variable to nil in
238 `gnus-select-group-hook'."
239 :group 'gnus-group-select
240 :type '(choice (const :tag "none" nil)
242 (sexp :menu-tag "first" t)))
244 (defcustom gnus-auto-select-next t
245 "*If non-nil, offer to go to the next group from the end of the previous.
246 If the value is t and the next newsgroup is empty, Gnus will exit
247 summary mode and go back to group mode. If the value is neither nil
248 nor t, Gnus will select the following unread newsgroup. In
249 particular, if the value is the symbol `quietly', the next unread
250 newsgroup will be selected without any confirmation, and if it is
251 `almost-quietly', the next group will be selected without any
252 confirmation if you are located on the last article in the group.
253 Finally, if this variable is `slightly-quietly', the `Z n' command
254 will go to the next group without confirmation."
255 :group 'gnus-summary-maneuvering
256 :type '(choice (const :tag "off" nil)
258 (const almost-quietly)
259 (const slightly-quietly)
260 (sexp :menu-tag "on" t)))
262 (defcustom gnus-auto-select-same nil
263 "*If non-nil, select the next article with the same subject."
264 :group 'gnus-summary-maneuvering
267 (defcustom gnus-summary-check-current nil
268 "*If non-nil, consider the current article when moving.
269 The \"unread\" movement commands will stay on the same line if the
270 current article is unread."
271 :group 'gnus-summary-maneuvering
274 (defcustom gnus-auto-center-summary t
275 "*If non-nil, always center the current summary buffer.
276 In particular, if `vertical' do only vertical recentering. If non-nil
277 and non-`vertical', do both horizontal and vertical recentering."
278 :group 'gnus-summary-maneuvering
279 :type '(choice (const :tag "none" nil)
281 (sexp :menu-tag "both" t)))
283 (defcustom gnus-show-all-headers nil
284 "*If non-nil, don't hide any headers."
285 :group 'gnus-article-hiding
286 :group 'gnus-article-headers
289 (defcustom gnus-single-article-buffer t
290 "*If non-nil, display all articles in the same buffer.
291 If nil, each group will get its own article buffer."
292 :group 'gnus-article-various
295 (defcustom gnus-break-pages t
296 "*If non-nil, do page breaking on articles.
297 The page delimiter is specified by the `gnus-page-delimiter'
299 :group 'gnus-article-various
302 (defcustom gnus-show-mime nil
303 "*If non-nil, do mime processing of articles.
304 The articles will simply be fed to the function given by
305 `gnus-show-mime-method'."
306 :group 'gnus-article-mime
309 (defcustom gnus-move-split-methods nil
310 "*Variable used to suggest where articles are to be moved to.
311 It uses the same syntax as the `gnus-split-methods' variable."
312 :group 'gnus-summary-mail
313 :type '(repeat (choice (list function)
314 (cons regexp (repeat string))
317 ;; Mark variables suggested by Thomas Michanek
318 ;; <Thomas.Michanek@telelogic.se>.
320 (defcustom gnus-unread-mark ?
321 "*Mark used for unread articles."
322 :group 'gnus-summary-marks
325 (defcustom gnus-ticked-mark ?!
326 "*Mark used for ticked articles."
327 :group 'gnus-summary-marks
330 (defcustom gnus-dormant-mark ??
331 "*Mark used for dormant articles."
332 :group 'gnus-summary-marks
335 (defcustom gnus-del-mark ?r
336 "*Mark used for del'd articles."
337 :group 'gnus-summary-marks
340 (defcustom gnus-read-mark ?R
341 "*Mark used for read articles."
342 :group 'gnus-summary-marks
345 (defcustom gnus-expirable-mark ?E
346 "*Mark used for expirable articles."
347 :group 'gnus-summary-marks
350 (defcustom gnus-killed-mark ?K
351 "*Mark used for killed articles."
352 :group 'gnus-summary-marks
355 (defcustom gnus-souped-mark ?F
356 "*Mark used for killed articles."
357 :group 'gnus-summary-marks
360 (defcustom gnus-kill-file-mark ?X
361 "*Mark used for articles killed by kill files."
362 :group 'gnus-summary-marks
365 (defcustom gnus-low-score-mark ?Y
366 "*Mark used for articles with a low score."
367 :group 'gnus-summary-marks
370 (defcustom gnus-catchup-mark ?C
371 "*Mark used for articles that are caught up."
372 :group 'gnus-summary-marks
375 (defcustom gnus-replied-mark ?A
376 "*Mark used for articles that have been replied to."
377 :group 'gnus-summary-marks
380 (defcustom gnus-cached-mark ?*
381 "*Mark used for articles that are in the cache."
382 :group 'gnus-summary-marks
385 (defcustom gnus-saved-mark ?S
386 "*Mark used for articles that have been saved to."
387 :group 'gnus-summary-marks
390 (defcustom gnus-ancient-mark ?O
391 "*Mark used for ancient articles."
392 :group 'gnus-summary-marks
395 (defcustom gnus-sparse-mark ?Q
396 "*Mark used for sparsely reffed articles."
397 :group 'gnus-summary-marks
400 (defcustom gnus-canceled-mark ?G
401 "*Mark used for canceled articles."
402 :group 'gnus-summary-marks
405 (defcustom gnus-duplicate-mark ?M
406 "*Mark used for duplicate articles."
407 :group 'gnus-summary-marks
410 (defcustom gnus-score-over-mark ?+
411 "*Score mark used for articles with high scores."
412 :group 'gnus-summary-marks
415 (defcustom gnus-score-below-mark ?-
416 "*Score mark used for articles with low scores."
417 :group 'gnus-summary-marks
420 (defcustom gnus-empty-thread-mark ?
421 "*There is no thread under the article."
422 :group 'gnus-summary-marks
425 (defcustom gnus-not-empty-thread-mark ?=
426 "*There is a thread under the article."
427 :group 'gnus-summary-marks
430 (defcustom gnus-view-pseudo-asynchronously nil
431 "*If non-nil, Gnus will view pseudo-articles asynchronously."
432 :group 'gnus-extract-view
435 (defcustom gnus-view-pseudos nil
436 "*If `automatic', pseudo-articles will be viewed automatically.
437 If `not-confirm', pseudos will be viewed automatically, and the user
438 will not be asked to confirm the command."
439 :group 'gnus-extract-view
440 :type '(choice (const :tag "off" nil)
442 (const not-confirm)))
444 (defcustom gnus-view-pseudos-separately t
445 "*If non-nil, one pseudo-article will be created for each file to be viewed.
446 If nil, all files that use the same viewing command will be given as a
447 list of parameters to that command."
448 :group 'gnus-extract-view
451 (defcustom gnus-insert-pseudo-articles t
452 "*If non-nil, insert pseudo-articles when decoding articles."
453 :group 'gnus-extract-view
456 (defcustom gnus-summary-dummy-line-format
458 "*The format specification for the dummy roots in the summary buffer.
459 It works along the same lines as a normal formatting string,
460 with some simple extensions.
463 :group 'gnus-threading
466 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
467 "*The format specification for the summary mode line.
468 It works along the same lines as a normal formatting string,
469 with some simple extensions:
472 %p Unprefixed group name
473 %A Current article number
475 %U Number of unread articles in the group
476 %e Number of unselected articles in the group
477 %Z A string with unread/unselected article counts
478 %g Shortish group name
479 %S Subject of the current article
481 %s Current score file name
482 %d Number of dormant articles
483 %r Number of articles that have been marked as read in this session
484 %E Number of articles expunged by the score files"
485 :group 'gnus-summary-format
488 (defcustom gnus-summary-mark-below 0
489 "*Mark all articles with a score below this variable as read.
490 This variable is local to each summary buffer and usually set by the
492 :group 'gnus-score-default
495 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
496 "*List of functions used for sorting articles in the summary buffer.
497 This variable is only used when not using a threaded display."
498 :group 'gnus-summary-sort
499 :type '(repeat (choice (function-item gnus-article-sort-by-number)
500 (function-item gnus-article-sort-by-author)
501 (function-item gnus-article-sort-by-subject)
502 (function-item gnus-article-sort-by-date)
503 (function-item gnus-article-sort-by-score)
504 (function :tag "other"))))
506 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
507 "*List of functions used for sorting threads in the summary buffer.
508 By default, threads are sorted by article number.
510 Each function takes two threads and return non-nil if the first thread
511 should be sorted before the other. If you use more than one function,
512 the primary sort function should be the last. You should probably
513 always include `gnus-thread-sort-by-number' in the list of sorting
514 functions -- preferably first.
516 Ready-made functions include `gnus-thread-sort-by-number',
517 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
518 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
519 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
520 :group 'gnus-summary-sort
521 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
522 (function-item gnus-thread-sort-by-author)
523 (function-item gnus-thread-sort-by-subject)
524 (function-item gnus-thread-sort-by-date)
525 (function-item gnus-thread-sort-by-score)
526 (function-item gnus-thread-sort-by-total-score)
527 (function :tag "other"))))
529 (defcustom gnus-thread-score-function '+
530 "*Function used for calculating the total score of a thread.
532 The function is called with the scores of the article and each
533 subthread and should then return the score of the thread.
535 Some functions you can use are `+', `max', or `min'."
536 :group 'gnus-summary-sort
539 (defcustom gnus-summary-expunge-below nil
540 "All articles that have a score less than this variable will be expunged."
541 :group 'gnus-score-default
542 :type '(choice (const :tag "off" nil)
545 (defcustom gnus-thread-expunge-below nil
546 "All threads that have a total score less than this variable will be expunged.
547 See `gnus-thread-score-function' for en explanation of what a
548 \"thread score\" is."
549 :group 'gnus-treading
550 :group 'gnus-score-default
551 :type '(choice (const :tag "off" nil)
554 (defcustom gnus-summary-mode-hook nil
555 "*A hook for Gnus summary mode.
556 This hook is run before any variables are set in the summary buffer."
557 :group 'gnus-summary-various
560 (defcustom gnus-summary-menu-hook nil
561 "*Hook run after the creation of the summary mode menu."
562 :group 'gnus-summary-visual
565 (defcustom gnus-summary-exit-hook nil
566 "*A hook called on exit from the summary buffer.
567 It will be called with point in the group buffer."
568 :group 'gnus-summary-exit
571 (defcustom gnus-summary-prepare-hook nil
572 "*A hook called after the summary buffer has been generated.
573 If you want to modify the summary buffer, you can use this hook."
574 :group 'gnus-summary-various
577 (defcustom gnus-summary-generate-hook nil
578 "*A hook run just before generating the summary buffer.
579 This hook is commonly used to customize threading variables and the
581 :group 'gnus-summary-various
584 (defcustom gnus-select-group-hook nil
585 "*A hook called when a newsgroup is selected.
587 If you'd like to simplify subjects like the
588 `gnus-summary-next-same-subject' command does, you can use the
591 (setq gnus-select-group-hook
594 (mapcar (lambda (header)
595 (mail-header-set-subject
597 (gnus-simplify-subject
598 (mail-header-subject header) 're-only)))
599 gnus-newsgroup-headers))))"
600 :group 'gnus-group-select
603 (defcustom gnus-select-article-hook nil
604 "*A hook called when an article is selected."
605 :group 'gnus-summary-choose
608 (defcustom gnus-visual-mark-article-hook
609 (list 'gnus-highlight-selected-summary)
610 "*Hook run after selecting an article in the summary buffer.
611 It is meant to be used for highlighting the article in some way. It
612 is not run if `gnus-visual' is nil."
613 :group 'gnus-summary-visual
616 (defcustom gnus-parse-headers-hook
617 (list 'gnus-decode-rfc1522)
618 "*A hook called before parsing the headers."
622 (defcustom gnus-exit-group-hook nil
623 "*A hook called when exiting (not quitting) summary mode."
627 (defcustom gnus-summary-update-hook
628 (list 'gnus-summary-highlight-line)
629 "*A hook called when a summary line is changed.
630 The hook will not be called if `gnus-visual' is nil.
632 The default function `gnus-summary-highlight-line' will
633 highlight the line according to the `gnus-summary-highlight'
635 :group 'gnus-summary-visual
638 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
639 "*A hook called when an article is selected for the first time.
640 The hook is intended to mark an article as read (or unread)
641 automatically when it is selected."
642 :group 'gnus-summary-choose
645 (defcustom gnus-group-no-more-groups-hook nil
646 "*A hook run when returning to group mode having no more (unread) groups."
647 :group 'gnus-group-select
650 (defcustom gnus-ps-print-hook nil
651 "*A hook run before ps-printing something from Gnus."
655 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
656 "Face used for highlighting the current article in the summary buffer."
657 :group 'gnus-summary-visual
660 (defcustom gnus-summary-highlight
661 '(((= mark gnus-canceled-mark)
662 . gnus-summary-cancelled-face)
663 ((and (> score default)
664 (or (= mark gnus-dormant-mark)
665 (= mark gnus-ticked-mark)))
666 . gnus-summary-high-ticked-face)
667 ((and (< score default)
668 (or (= mark gnus-dormant-mark)
669 (= mark gnus-ticked-mark)))
670 . gnus-summary-low-ticked-face)
671 ((or (= mark gnus-dormant-mark)
672 (= mark gnus-ticked-mark))
673 . gnus-summary-normal-ticked-face)
674 ((and (> score default) (= mark gnus-ancient-mark))
675 . gnus-summary-high-ancient-face)
676 ((and (< score default) (= mark gnus-ancient-mark))
677 . gnus-summary-low-ancient-face)
678 ((= mark gnus-ancient-mark)
679 . gnus-summary-normal-ancient-face)
680 ((and (> score default) (= mark gnus-unread-mark))
681 . gnus-summary-high-unread-face)
682 ((and (< score default) (= mark gnus-unread-mark))
683 . gnus-summary-low-unread-face)
684 ((and (= mark gnus-unread-mark))
685 . gnus-summary-normal-unread-face)
687 . gnus-summary-high-read-face)
689 . gnus-summary-low-read-face)
691 . gnus-summary-normal-read-face))
692 "Controls the highlighting of summary buffer lines.
694 A list of (FORM . FACE) pairs. When deciding how a a particular
695 summary line should be displayed, each form is evaluated. The content
696 of the face field after the first true form is used. You can change
697 how those summary lines are displayed, by editing the face field.
699 You can use the following variables in the FORM field.
701 score: The articles score
702 default: The default article score.
703 below: The score below which articles are automatically marked as read.
704 mark: The articles mark."
705 :group 'gnus-summary-visual
706 :type '(repeat (cons (sexp :tag "Form" nil)
710 ;;; Internal variables
712 (defvar gnus-scores-exclude-files nil)
714 (defvar gnus-summary-display-table
715 ;; Change the display table. Odd characters have a tendency to mess
716 ;; up nicely formatted displays - we make all possible glyphs
717 ;; display only a single character.
719 ;; We start from the standard display table, if any.
720 (let ((table (or (copy-sequence standard-display-table)
721 (make-display-table)))
722 ;; Nix out all the control chars...
724 (while (>= (setq i (1- i)) 0)
726 ;; ... but not newline and cr, of course. (cr is necessary for the
727 ;; selective display).
730 ;; We nix out any glyphs over 126 that are not set already.
732 (while (>= (setq i (1- i)) 127)
733 ;; Only modify if the entry is nil.
735 (aset table i [??]))))
737 "Display table used in summary mode buffers.")
739 (defvar gnus-original-article nil)
740 (defvar gnus-article-internal-prepare-hook nil)
741 (defvar gnus-newsgroup-process-stack nil)
743 (defvar gnus-thread-indent-array nil)
744 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
746 ;; Avoid highlighting in kill files.
747 (defvar gnus-summary-inhibit-highlight nil)
748 (defvar gnus-newsgroup-selected-overlay nil)
749 (defvar gnus-inhibit-limiting nil)
750 (defvar gnus-newsgroup-adaptive-score-file nil)
751 (defvar gnus-current-score-file nil)
752 (defvar gnus-current-move-group nil)
753 (defvar gnus-current-copy-group nil)
754 (defvar gnus-current-crosspost-group nil)
756 (defvar gnus-newsgroup-dependencies nil)
757 (defvar gnus-newsgroup-adaptive nil)
758 (defvar gnus-summary-display-article-function nil)
759 (defvar gnus-summary-highlight-line-function nil
760 "Function called after highlighting a summary line.")
762 (defvar gnus-summary-line-format-alist
763 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
764 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
765 (?s gnus-tmp-subject-or-nil ?s)
766 (?n gnus-tmp-name ?s)
767 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
769 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
771 (?F gnus-tmp-from ?s)
772 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
773 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
774 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
775 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
776 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
777 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
778 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
779 (?L gnus-tmp-lines ?d)
780 (?I gnus-tmp-indentation ?s)
781 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
782 (?R gnus-tmp-replied ?c)
783 (?\[ gnus-tmp-opening-bracket ?c)
784 (?\] gnus-tmp-closing-bracket ?c)
785 (?\> (make-string gnus-tmp-level ? ) ?s)
786 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
787 (?i gnus-tmp-score ?d)
788 (?z gnus-tmp-score-char ?c)
789 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
790 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
791 (?U gnus-tmp-unread ?c)
792 (?t (gnus-summary-number-of-articles-in-thread
793 (and (boundp 'thread) (car thread)) gnus-tmp-level)
795 (?e (gnus-summary-number-of-articles-in-thread
796 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
798 (?u gnus-tmp-user-defined ?s)
799 (?P (gnus-pick-line-number) ?d))
800 "An alist of format specifications that can appear in summary lines,
801 and what variables they correspond with, along with the type of the
802 variable (string, integer, character, etc).")
804 (defvar gnus-summary-dummy-line-format-alist
805 `((?S gnus-tmp-subject ?s)
806 (?N gnus-tmp-number ?d)
807 (?u gnus-tmp-user-defined ?s)))
809 (defvar gnus-summary-mode-line-format-alist
810 `((?G gnus-tmp-group-name ?s)
811 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
812 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
813 (?A gnus-tmp-article-number ?d)
814 (?Z gnus-tmp-unread-and-unselected ?s)
816 (?U gnus-tmp-unread-and-unticked ?d)
817 (?S gnus-tmp-subject ?s)
818 (?e gnus-tmp-unselected ?d)
819 (?u gnus-tmp-user-defined ?s)
820 (?d (length gnus-newsgroup-dormant) ?d)
821 (?t (length gnus-newsgroup-marked) ?d)
822 (?r (length gnus-newsgroup-reads) ?d)
823 (?E gnus-newsgroup-expunged-tally ?d)
824 (?s (gnus-current-score-file-nondirectory) ?s)))
826 (defvar gnus-last-search-regexp nil
827 "Default regexp for article search command.")
829 (defvar gnus-last-shell-command nil
830 "Default shell command on article.")
832 (defvar gnus-newsgroup-begin nil)
833 (defvar gnus-newsgroup-end nil)
834 (defvar gnus-newsgroup-last-rmail nil)
835 (defvar gnus-newsgroup-last-mail nil)
836 (defvar gnus-newsgroup-last-folder nil)
837 (defvar gnus-newsgroup-last-file nil)
838 (defvar gnus-newsgroup-auto-expire nil)
839 (defvar gnus-newsgroup-active nil)
841 (defvar gnus-newsgroup-data nil)
842 (defvar gnus-newsgroup-data-reverse nil)
843 (defvar gnus-newsgroup-limit nil)
844 (defvar gnus-newsgroup-limits nil)
846 (defvar gnus-newsgroup-unreads nil
847 "List of unread articles in the current newsgroup.")
849 (defvar gnus-newsgroup-unselected nil
850 "List of unselected unread articles in the current newsgroup.")
852 (defvar gnus-newsgroup-reads nil
853 "Alist of read articles and article marks in the current newsgroup.")
855 (defvar gnus-newsgroup-expunged-tally nil)
857 (defvar gnus-newsgroup-marked nil
858 "List of ticked articles in the current newsgroup (a subset of unread art).")
860 (defvar gnus-newsgroup-killed nil
861 "List of ranges of articles that have been through the scoring process.")
863 (defvar gnus-newsgroup-cached nil
864 "List of articles that come from the article cache.")
866 (defvar gnus-newsgroup-saved nil
867 "List of articles that have been saved.")
869 (defvar gnus-newsgroup-kill-headers nil)
871 (defvar gnus-newsgroup-replied nil
872 "List of articles that have been replied to in the current newsgroup.")
874 (defvar gnus-newsgroup-expirable nil
875 "List of articles in the current newsgroup that can be expired.")
877 (defvar gnus-newsgroup-processable nil
878 "List of articles in the current newsgroup that can be processed.")
880 (defvar gnus-newsgroup-bookmarks nil
881 "List of articles in the current newsgroup that have bookmarks.")
883 (defvar gnus-newsgroup-dormant nil
884 "List of dormant articles in the current newsgroup.")
886 (defvar gnus-newsgroup-scored nil
887 "List of scored articles in the current newsgroup.")
889 (defvar gnus-newsgroup-headers nil
890 "List of article headers in the current newsgroup.")
892 (defvar gnus-newsgroup-threads nil)
894 (defvar gnus-newsgroup-prepared nil
895 "Whether the current group has been prepared properly.")
897 (defvar gnus-newsgroup-ancient nil
898 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
900 (defvar gnus-newsgroup-sparse nil)
902 (defvar gnus-current-article nil)
903 (defvar gnus-article-current nil)
904 (defvar gnus-current-headers nil)
905 (defvar gnus-have-all-headers nil)
906 (defvar gnus-last-article nil)
907 (defvar gnus-newsgroup-history nil)
909 (defconst gnus-summary-local-variables
910 '(gnus-newsgroup-name
911 gnus-newsgroup-begin gnus-newsgroup-end
912 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
913 gnus-newsgroup-last-folder gnus-newsgroup-last-file
914 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
915 gnus-newsgroup-unselected gnus-newsgroup-marked
916 gnus-newsgroup-reads gnus-newsgroup-saved
917 gnus-newsgroup-replied gnus-newsgroup-expirable
918 gnus-newsgroup-processable gnus-newsgroup-killed
919 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
920 gnus-newsgroup-headers gnus-newsgroup-threads
921 gnus-newsgroup-prepared gnus-summary-highlight-line-function
922 gnus-current-article gnus-current-headers gnus-have-all-headers
923 gnus-last-article gnus-article-internal-prepare-hook
924 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
925 gnus-newsgroup-scored gnus-newsgroup-kill-headers
926 gnus-thread-expunge-below
927 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
928 (gnus-summary-mark-below . global)
929 gnus-newsgroup-active gnus-scores-exclude-files
930 gnus-newsgroup-history gnus-newsgroup-ancient
931 gnus-newsgroup-sparse gnus-newsgroup-process-stack
932 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
933 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
934 (gnus-newsgroup-expunged-tally . 0)
935 gnus-cache-removable-articles gnus-newsgroup-cached
936 gnus-newsgroup-data gnus-newsgroup-data-reverse
937 gnus-newsgroup-limit gnus-newsgroup-limits)
938 "Variables that are buffer-local to the summary buffers.")
940 ;; Byte-compiler warning.
941 (defvar gnus-article-mode-map)
943 ;; Subject simplification.
945 (defsubst gnus-simplify-subject-re (subject)
946 "Remove \"Re:\" from subject lines."
947 (if (string-match "^[Rr][Ee]: *" subject)
948 (substring subject (match-end 0))
951 (defun gnus-simplify-subject (subject &optional re-only)
952 "Remove `Re:' and words in parentheses.
953 If RE-ONLY is non-nil, strip leading `Re:'s only."
954 (let ((case-fold-search t)) ;Ignore case.
955 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
956 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
957 (setq subject (substring subject (match-end 0))))
958 ;; Remove uninteresting prefixes.
959 (when (and (not re-only)
960 gnus-simplify-ignored-prefixes
961 (string-match gnus-simplify-ignored-prefixes subject))
962 (setq subject (substring subject (match-end 0))))
963 ;; Remove words in parentheses from end.
965 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
966 (setq subject (substring subject 0 (match-beginning 0)))))
967 ;; Return subject string.
970 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
972 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
973 (goto-char (point-min))
974 (while (re-search-forward regexp nil t)
975 (replace-match (or newtext ""))))
977 (defun gnus-simplify-buffer-fuzzy ()
978 "Simplify string in the buffer fuzzily.
979 The string in the accessible portion of the current buffer is simplified.
980 It is assumed to be a single-line subject.
981 Whitespace is generally cleaned up, and miscellaneous leading/trailing
982 matter is removed. Additional things can be deleted by setting
983 gnus-simplify-subject-fuzzy-regexp."
984 (let ((case-fold-search t)
986 (gnus-simplify-buffer-fuzzy-step "\t" " ")
988 (while (not (eq modified-tick (buffer-modified-tick)))
989 (setq modified-tick (buffer-modified-tick))
991 ((listp gnus-simplify-subject-fuzzy-regexp)
992 (mapcar 'gnus-simplify-buffer-fuzzy-step
993 gnus-simplify-subject-fuzzy-regexp))
994 (gnus-simplify-subject-fuzzy-regexp
995 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
996 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
997 (gnus-simplify-buffer-fuzzy-step
998 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
999 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1001 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1002 (gnus-simplify-buffer-fuzzy-step " +" " ")
1003 (gnus-simplify-buffer-fuzzy-step " $")
1004 (gnus-simplify-buffer-fuzzy-step "^ +")))
1006 (defun gnus-simplify-subject-fuzzy (subject)
1007 "Simplify a subject string fuzzily.
1008 See gnus-simplify-buffer-fuzzy for details."
1010 (gnus-set-work-buffer)
1011 (let ((case-fold-search t))
1013 (inline (gnus-simplify-buffer-fuzzy))
1016 (defsubst gnus-simplify-subject-fully (subject)
1017 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1019 ((null gnus-summary-gather-subject-limit)
1020 (gnus-simplify-subject-re subject))
1021 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1022 (gnus-simplify-subject-fuzzy subject))
1023 ((numberp gnus-summary-gather-subject-limit)
1024 (gnus-limit-string (gnus-simplify-subject-re subject)
1025 gnus-summary-gather-subject-limit))
1029 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1030 "Check whether two subjects are equal. If optional argument
1031 simple-first is t, first argument is already simplified."
1033 ((null simple-first)
1034 (equal (gnus-simplify-subject-fully s1)
1035 (gnus-simplify-subject-fully s2)))
1038 (gnus-simplify-subject-fully s2)))))
1040 (defun gnus-summary-bubble-group ()
1041 "Increase the score of the current group.
1042 This is a handy function to add to `gnus-summary-exit-hook' to
1043 increase the score of each group you read."
1044 (gnus-group-add-score gnus-newsgroup-name))
1048 ;;; Gnus summary mode
1051 (put 'gnus-summary-mode 'mode-class 'special)
1054 ;; Non-orthogonal keys
1056 (gnus-define-keys gnus-summary-mode-map
1057 " " gnus-summary-next-page
1058 "\177" gnus-summary-prev-page
1059 [delete] gnus-summary-prev-page
1060 "\r" gnus-summary-scroll-up
1061 "n" gnus-summary-next-unread-article
1062 "p" gnus-summary-prev-unread-article
1063 "N" gnus-summary-next-article
1064 "P" gnus-summary-prev-article
1065 "\M-\C-n" gnus-summary-next-same-subject
1066 "\M-\C-p" gnus-summary-prev-same-subject
1067 "\M-n" gnus-summary-next-unread-subject
1068 "\M-p" gnus-summary-prev-unread-subject
1069 "." gnus-summary-first-unread-article
1070 "," gnus-summary-best-unread-article
1071 "\M-s" gnus-summary-search-article-forward
1072 "\M-r" gnus-summary-search-article-backward
1073 "<" gnus-summary-beginning-of-article
1074 ">" gnus-summary-end-of-article
1075 "j" gnus-summary-goto-article
1076 "^" gnus-summary-refer-parent-article
1077 "\M-^" gnus-summary-refer-article
1078 "u" gnus-summary-tick-article-forward
1079 "!" gnus-summary-tick-article-forward
1080 "U" gnus-summary-tick-article-backward
1081 "d" gnus-summary-mark-as-read-forward
1082 "D" gnus-summary-mark-as-read-backward
1083 "E" gnus-summary-mark-as-expirable
1084 "\M-u" gnus-summary-clear-mark-forward
1085 "\M-U" gnus-summary-clear-mark-backward
1086 "k" gnus-summary-kill-same-subject-and-select
1087 "\C-k" gnus-summary-kill-same-subject
1088 "\M-\C-k" gnus-summary-kill-thread
1089 "\M-\C-l" gnus-summary-lower-thread
1090 "e" gnus-summary-edit-article
1091 "#" gnus-summary-mark-as-processable
1092 "\M-#" gnus-summary-unmark-as-processable
1093 "\M-\C-t" gnus-summary-toggle-threads
1094 "\M-\C-s" gnus-summary-show-thread
1095 "\M-\C-h" gnus-summary-hide-thread
1096 "\M-\C-f" gnus-summary-next-thread
1097 "\M-\C-b" gnus-summary-prev-thread
1098 "\M-\C-u" gnus-summary-up-thread
1099 "\M-\C-d" gnus-summary-down-thread
1100 "&" gnus-summary-execute-command
1101 "c" gnus-summary-catchup-and-exit
1102 "\C-w" gnus-summary-mark-region-as-read
1103 "\C-t" gnus-summary-toggle-truncation
1104 "?" gnus-summary-mark-as-dormant
1105 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1106 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1107 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1108 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1109 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1110 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1111 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1112 "=" gnus-summary-expand-window
1113 "\C-x\C-s" gnus-summary-reselect-current-group
1114 "\M-g" gnus-summary-rescan-group
1115 "w" gnus-summary-stop-page-breaking
1116 "\C-c\C-r" gnus-summary-caesar-message
1117 "\M-t" gnus-summary-toggle-mime
1118 "f" gnus-summary-followup
1119 "F" gnus-summary-followup-with-original
1120 "C" gnus-summary-cancel-article
1121 "r" gnus-summary-reply
1122 "R" gnus-summary-reply-with-original
1123 "\C-c\C-f" gnus-summary-mail-forward
1124 "o" gnus-summary-save-article
1125 "\C-o" gnus-summary-save-article-mail
1126 "|" gnus-summary-pipe-output
1127 "\M-k" gnus-summary-edit-local-kill
1128 "\M-K" gnus-summary-edit-global-kill
1130 "\C-c\C-d" gnus-summary-describe-group
1131 "q" gnus-summary-exit
1132 "Q" gnus-summary-exit-no-update
1133 "\C-c\C-i" gnus-info-find-node
1134 gnus-mouse-2 gnus-mouse-pick-article
1135 "m" gnus-summary-mail-other-window
1136 "a" gnus-summary-post-news
1137 "x" gnus-summary-limit-to-unread
1138 "s" gnus-summary-isearch-article
1139 "t" gnus-article-hide-headers
1140 "g" gnus-summary-show-article
1141 "l" gnus-summary-goto-last-article
1142 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1143 "\C-d" gnus-summary-enter-digest-group
1144 "\M-\C-d" gnus-summary-read-document
1146 "*" gnus-cache-enter-article
1147 "\M-*" gnus-cache-remove-article
1148 "\M-&" gnus-summary-universal-argument
1149 "\C-l" gnus-recenter
1150 "I" gnus-summary-increase-score
1151 "L" gnus-summary-lower-score
1153 "V" gnus-summary-score-map
1154 "X" gnus-uu-extract-map
1155 "S" gnus-summary-send-map)
1157 ;; Sort of orthogonal keymap
1158 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1159 "t" gnus-summary-tick-article-forward
1160 "!" gnus-summary-tick-article-forward
1161 "d" gnus-summary-mark-as-read-forward
1162 "r" gnus-summary-mark-as-read-forward
1163 "c" gnus-summary-clear-mark-forward
1164 " " gnus-summary-clear-mark-forward
1165 "e" gnus-summary-mark-as-expirable
1166 "x" gnus-summary-mark-as-expirable
1167 "?" gnus-summary-mark-as-dormant
1168 "b" gnus-summary-set-bookmark
1169 "B" gnus-summary-remove-bookmark
1170 "#" gnus-summary-mark-as-processable
1171 "\M-#" gnus-summary-unmark-as-processable
1172 "S" gnus-summary-limit-include-expunged
1173 "C" gnus-summary-catchup
1174 "H" gnus-summary-catchup-to-here
1175 "\C-c" gnus-summary-catchup-all
1176 "k" gnus-summary-kill-same-subject-and-select
1177 "K" gnus-summary-kill-same-subject
1178 "P" gnus-uu-mark-map)
1180 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1181 "c" gnus-summary-clear-above
1182 "u" gnus-summary-tick-above
1183 "m" gnus-summary-mark-above
1184 "k" gnus-summary-kill-below)
1186 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1187 "/" gnus-summary-limit-to-subject
1188 "n" gnus-summary-limit-to-articles
1189 "w" gnus-summary-pop-limit
1190 "s" gnus-summary-limit-to-subject
1191 "a" gnus-summary-limit-to-author
1192 "u" gnus-summary-limit-to-unread
1193 "m" gnus-summary-limit-to-marks
1194 "v" gnus-summary-limit-to-score
1195 "D" gnus-summary-limit-include-dormant
1196 "d" gnus-summary-limit-exclude-dormant
1197 "t" gnus-summary-limit-to-age
1198 "E" gnus-summary-limit-include-expunged
1199 "c" gnus-summary-limit-exclude-childless-dormant
1200 "C" gnus-summary-limit-mark-excluded-as-read)
1202 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1203 "n" gnus-summary-next-unread-article
1204 "p" gnus-summary-prev-unread-article
1205 "N" gnus-summary-next-article
1206 "P" gnus-summary-prev-article
1207 "\C-n" gnus-summary-next-same-subject
1208 "\C-p" gnus-summary-prev-same-subject
1209 "\M-n" gnus-summary-next-unread-subject
1210 "\M-p" gnus-summary-prev-unread-subject
1211 "f" gnus-summary-first-unread-article
1212 "b" gnus-summary-best-unread-article
1213 "j" gnus-summary-goto-article
1214 "g" gnus-summary-goto-subject
1215 "l" gnus-summary-goto-last-article
1216 "p" gnus-summary-pop-article)
1218 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1219 "k" gnus-summary-kill-thread
1220 "l" gnus-summary-lower-thread
1221 "i" gnus-summary-raise-thread
1222 "T" gnus-summary-toggle-threads
1223 "t" gnus-summary-rethread-current
1224 "^" gnus-summary-reparent-thread
1225 "s" gnus-summary-show-thread
1226 "S" gnus-summary-show-all-threads
1227 "h" gnus-summary-hide-thread
1228 "H" gnus-summary-hide-all-threads
1229 "n" gnus-summary-next-thread
1230 "p" gnus-summary-prev-thread
1231 "u" gnus-summary-up-thread
1232 "o" gnus-summary-top-thread
1233 "d" gnus-summary-down-thread
1234 "#" gnus-uu-mark-thread
1235 "\M-#" gnus-uu-unmark-thread)
1237 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1238 "g" gnus-summary-prepare
1239 "c" gnus-summary-insert-cached-articles)
1241 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1242 "c" gnus-summary-catchup-and-exit
1243 "C" gnus-summary-catchup-all-and-exit
1244 "E" gnus-summary-exit-no-update
1245 "Q" gnus-summary-exit
1246 "Z" gnus-summary-exit
1247 "n" gnus-summary-catchup-and-goto-next-group
1248 "R" gnus-summary-reselect-current-group
1249 "G" gnus-summary-rescan-group
1250 "N" gnus-summary-next-group
1251 "s" gnus-summary-save-newsrc
1252 "P" gnus-summary-prev-group)
1254 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1255 " " gnus-summary-next-page
1256 "n" gnus-summary-next-page
1257 "\177" gnus-summary-prev-page
1258 [delete] gnus-summary-prev-page
1259 "p" gnus-summary-prev-page
1260 "\r" gnus-summary-scroll-up
1261 "<" gnus-summary-beginning-of-article
1262 ">" gnus-summary-end-of-article
1263 "b" gnus-summary-beginning-of-article
1264 "e" gnus-summary-end-of-article
1265 "^" gnus-summary-refer-parent-article
1266 "r" gnus-summary-refer-parent-article
1267 "R" gnus-summary-refer-references
1268 "g" gnus-summary-show-article
1269 "s" gnus-summary-isearch-article
1270 "P" gnus-summary-print-article)
1272 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1273 "b" gnus-article-add-buttons
1274 "B" gnus-article-add-buttons-to-head
1275 "o" gnus-article-treat-overstrike
1276 "e" gnus-article-emphasize
1277 "w" gnus-article-fill-cited-article
1278 "c" gnus-article-remove-cr
1279 "q" gnus-article-de-quoted-unreadable
1280 "f" gnus-article-display-x-face
1281 "l" gnus-summary-stop-page-breaking
1282 "r" gnus-summary-caesar-message
1283 "t" gnus-article-hide-headers
1284 "v" gnus-summary-verbose-headers
1285 "m" gnus-summary-toggle-mime)
1287 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1288 "a" gnus-article-hide
1289 "h" gnus-article-hide-headers
1290 "b" gnus-article-hide-boring-headers
1291 "s" gnus-article-hide-signature
1292 "c" gnus-article-hide-citation
1293 "p" gnus-article-hide-pgp
1294 "P" gnus-article-hide-pem
1295 "\C-c" gnus-article-hide-citation-maybe)
1297 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1298 "a" gnus-article-highlight
1299 "h" gnus-article-highlight-headers
1300 "c" gnus-article-highlight-citation
1301 "s" gnus-article-highlight-signature)
1303 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1304 "z" gnus-article-date-ut
1305 "u" gnus-article-date-ut
1306 "l" gnus-article-date-local
1307 "e" gnus-article-date-lapsed
1308 "o" gnus-article-date-original
1309 "s" gnus-article-date-user)
1311 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1312 "t" gnus-article-remove-trailing-blank-lines
1313 "l" gnus-article-strip-leading-blank-lines
1314 "m" gnus-article-strip-multiple-blank-lines
1315 "a" gnus-article-strip-blank-lines)
1317 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1319 "f" gnus-summary-fetch-faq
1320 "d" gnus-summary-describe-group
1321 "h" gnus-summary-describe-briefly
1322 "i" gnus-info-find-node)
1324 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1325 "e" gnus-summary-expire-articles
1326 "\M-\C-e" gnus-summary-expire-articles-now
1327 "\177" gnus-summary-delete-article
1328 [delete] gnus-summary-delete-article
1329 "m" gnus-summary-move-article
1330 "r" gnus-summary-respool-article
1331 "w" gnus-summary-edit-article
1332 "c" gnus-summary-copy-article
1333 "B" gnus-summary-crosspost-article
1334 "q" gnus-summary-respool-query
1335 "i" gnus-summary-import-article
1336 "p" gnus-summary-article-posted-p)
1338 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1339 "o" gnus-summary-save-article
1340 "m" gnus-summary-save-article-mail
1341 "F" gnus-summary-write-article-file
1342 "r" gnus-summary-save-article-rmail
1343 "f" gnus-summary-save-article-file
1344 "b" gnus-summary-save-article-body-file
1345 "h" gnus-summary-save-article-folder
1346 "v" gnus-summary-save-article-vm
1347 "p" gnus-summary-pipe-output
1348 "s" gnus-soup-add-article))
1350 (defun gnus-summary-make-menu-bar ()
1351 (gnus-turn-off-edit-menu 'summary)
1353 (unless (boundp 'gnus-summary-misc-menu)
1356 gnus-summary-kill-menu gnus-summary-mode-map ""
1361 ["Enter score..." gnus-summary-score-entry t]
1362 ["Customize" gnus-score-customize t])
1363 (gnus-make-score-map 'increase)
1364 (gnus-make-score-map 'lower)
1366 ["Kill below" gnus-summary-kill-below t]
1367 ["Mark above" gnus-summary-mark-above t]
1368 ["Tick above" gnus-summary-tick-above t]
1369 ["Clear above" gnus-summary-clear-above t])
1370 ["Current score" gnus-summary-current-score t]
1371 ["Set score" gnus-summary-set-score t]
1372 ["Switch current score file..." gnus-score-change-score-file t]
1373 ["Set mark below..." gnus-score-set-mark-below t]
1374 ["Set expunge below..." gnus-score-set-expunge-below t]
1375 ["Edit current score file" gnus-score-edit-current-scores t]
1376 ["Edit score file" gnus-score-edit-file t]
1377 ["Trace score" gnus-score-find-trace t]
1378 ["Find words" gnus-score-find-favourite-words t]
1379 ["Rescore buffer" gnus-summary-rescore t]
1380 ["Increase score..." gnus-summary-increase-score t]
1381 ["Lower score..." gnus-summary-lower-score t]))))
1384 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1386 :selected (null gnus-score-default-header)]
1387 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1389 :selected (eq gnus-score-default-header 'a)]
1390 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1392 :selected (eq gnus-score-default-header 's)]
1394 (gnus-score-set-default 'gnus-score-default-header 'b)
1396 :selected (eq gnus-score-default-header 'b )]
1398 (gnus-score-set-default 'gnus-score-default-header 'h)
1400 :selected (eq gnus-score-default-header 'h )]
1401 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1403 :selected (eq gnus-score-default-header 'i )]
1404 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1406 :selected (eq gnus-score-default-header 't )]
1408 (gnus-score-set-default 'gnus-score-default-header 'x)
1410 :selected (eq gnus-score-default-header 'x )]
1411 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1413 :selected (eq gnus-score-default-header 'l )]
1414 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1416 :selected (eq gnus-score-default-header 'd )]
1417 ["Followups to author"
1418 (gnus-score-set-default 'gnus-score-default-header 'f)
1420 :selected (eq gnus-score-default-header 'f )])
1422 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1424 :selected (null gnus-score-default-type)]
1425 ;; The `:active' key is commented out in the following,
1426 ;; because the GNU Emacs hack to support radio buttons use
1427 ;; active to indicate which button is selected.
1428 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1430 ;; :active (not (memq gnus-score-default-header '(l d)))
1431 :selected (eq gnus-score-default-type 's)]
1432 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1434 ;; :active (not (memq gnus-score-default-header '(l d)))
1435 :selected (eq gnus-score-default-type 'r)]
1436 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1438 ;; :active (not (memq gnus-score-default-header '(l d)))
1439 :selected (eq gnus-score-default-type 'e)]
1440 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1442 ;; :active (not (memq gnus-score-default-header '(l d)))
1443 :selected (eq gnus-score-default-type 'f)]
1444 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1446 ;; :active (eq (gnus-score-default-header 'd))
1447 :selected (eq gnus-score-default-type 'b)]
1448 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1450 ;; :active (eq (gnus-score-default-header 'd))
1451 :selected (eq gnus-score-default-type 'n)]
1452 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1454 ;; :active (eq (gnus-score-default-header 'd))
1455 :selected (eq gnus-score-default-type 'a)]
1457 (gnus-score-set-default 'gnus-score-default-type '<)
1459 ;; :active (eq (gnus-score-default-header 'l))
1460 :selected (eq gnus-score-default-type '<)]
1462 (gnus-score-set-default 'gnus-score-default-type '=)
1464 ;; :active (eq (gnus-score-default-header 'l))
1465 :selected (eq gnus-score-default-type '=)]
1466 ["Greater than number"
1467 (gnus-score-set-default 'gnus-score-default-type '>)
1469 ;; :active (eq (gnus-score-default-header 'l))
1470 :selected (eq gnus-score-default-type '>)])
1471 ["Default fold" gnus-score-default-fold-toggle
1473 :selected gnus-score-default-fold]
1475 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1477 :selected (null gnus-score-default-duration)]
1479 (gnus-score-set-default 'gnus-score-default-duration 'p)
1481 :selected (eq gnus-score-default-duration 'p)]
1483 (gnus-score-set-default 'gnus-score-default-duration 't)
1485 :selected (eq gnus-score-default-duration 't)]
1487 (gnus-score-set-default 'gnus-score-default-duration 'i)
1489 :selected (eq gnus-score-default-duration 'i)]))
1492 gnus-summary-article-menu gnus-summary-mode-map ""
1495 ["All" gnus-article-hide t]
1496 ["Headers" gnus-article-hide-headers t]
1497 ["Signature" gnus-article-hide-signature t]
1498 ["Citation" gnus-article-hide-citation t]
1499 ["PGP" gnus-article-hide-pgp t]
1500 ["Boring headers" gnus-article-hide-boring-headers t])
1502 ["All" gnus-article-highlight t]
1503 ["Headers" gnus-article-highlight-headers t]
1504 ["Signature" gnus-article-highlight-signature t]
1505 ["Citation" gnus-article-highlight-citation t])
1507 ["Local" gnus-article-date-local t]
1508 ["UT" gnus-article-date-ut t]
1509 ["Original" gnus-article-date-original t]
1510 ["Lapsed" gnus-article-date-lapsed t]
1511 ["User-defined" gnus-article-date-user t])
1514 ["Leading" gnus-article-strip-leading-blank-lines t]
1515 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1516 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1517 ["All of the above" gnus-article-strip-blank-lines t])
1518 ["Overstrike" gnus-article-treat-overstrike t]
1519 ["Emphasis" gnus-article-emphasize t]
1520 ["Word wrap" gnus-article-fill-cited-article t]
1521 ["CR" gnus-article-remove-cr t]
1522 ["Show X-Face" gnus-article-display-x-face t]
1523 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1524 ["Rot 13" gnus-summary-caesar-message t]
1525 ["Unix pipe" gnus-summary-pipe-message t]
1526 ["Add buttons" gnus-article-add-buttons t]
1527 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1528 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1529 ["Toggle MIME" gnus-summary-toggle-mime t]
1530 ["Verbose header" gnus-summary-verbose-headers t]
1531 ["Toggle header" gnus-summary-toggle-header t])
1533 ["Save in default format" gnus-summary-save-article t]
1534 ["Save in file" gnus-summary-save-article-file t]
1535 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1536 ["Write to file" gnus-summary-write-article-mail t]
1537 ["Save in MH folder" gnus-summary-save-article-folder t]
1538 ["Save in VM folder" gnus-summary-save-article-vm t]
1539 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1540 ["Save body in file" gnus-summary-save-article-body-file t]
1541 ["Pipe through a filter" gnus-summary-pipe-output t]
1542 ["Add to SOUP packet" gnus-soup-add-article t]
1543 ["Print" gnus-summary-print-article t])
1545 ["Respool article..." gnus-summary-respool-article t]
1546 ["Move article..." gnus-summary-move-article
1547 (gnus-check-backend-function
1548 'request-move-article gnus-newsgroup-name)]
1549 ["Copy article..." gnus-summary-copy-article t]
1550 ["Crosspost article..." gnus-summary-crosspost-article
1551 (gnus-check-backend-function
1552 'request-replace-article gnus-newsgroup-name)]
1553 ["Import file..." gnus-summary-import-article t]
1554 ["Check if posted" gnus-summary-article-posted-p t]
1555 ["Edit article" gnus-summary-edit-article
1556 (not (gnus-group-read-only-p))]
1557 ["Delete article" gnus-summary-delete-article
1558 (gnus-check-backend-function
1559 'request-expire-articles gnus-newsgroup-name)]
1560 ["Query respool" gnus-summary-respool-query t]
1561 ["Delete expirable articles" gnus-summary-expire-articles-now
1562 (gnus-check-backend-function
1563 'request-expire-articles gnus-newsgroup-name)])
1565 ["Uudecode" gnus-uu-decode-uu t]
1566 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1567 ["Unshar" gnus-uu-decode-unshar t]
1568 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1569 ["Save" gnus-uu-decode-save t]
1570 ["Binhex" gnus-uu-decode-binhex t]
1571 ["Postscript" gnus-uu-decode-postscript t])
1573 ["Enter article" gnus-cache-enter-article t]
1574 ["Remove article" gnus-cache-remove-article t])
1575 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1576 ["Isearch article..." gnus-summary-isearch-article t]
1577 ["Beginning of the article" gnus-summary-beginning-of-article t]
1578 ["End of the article" gnus-summary-end-of-article t]
1579 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1580 ["Fetch referenced articles" gnus-summary-refer-references t]
1581 ["Fetch article with id..." gnus-summary-refer-article t]
1582 ["Redisplay" gnus-summary-show-article t]))
1585 gnus-summary-thread-menu gnus-summary-mode-map ""
1587 ["Toggle threading" gnus-summary-toggle-threads t]
1588 ["Hide threads" gnus-summary-hide-all-threads t]
1589 ["Show threads" gnus-summary-show-all-threads t]
1590 ["Hide thread" gnus-summary-hide-thread t]
1591 ["Show thread" gnus-summary-show-thread t]
1592 ["Go to next thread" gnus-summary-next-thread t]
1593 ["Go to previous thread" gnus-summary-prev-thread t]
1594 ["Go down thread" gnus-summary-down-thread t]
1595 ["Go up thread" gnus-summary-up-thread t]
1596 ["Top of thread" gnus-summary-top-thread t]
1597 ["Mark thread as read" gnus-summary-kill-thread t]
1598 ["Lower thread score" gnus-summary-lower-thread t]
1599 ["Raise thread score" gnus-summary-raise-thread t]
1600 ["Rethread current" gnus-summary-rethread-current t]
1604 gnus-summary-post-menu gnus-summary-mode-map ""
1606 ["Post an article" gnus-summary-post-news t]
1607 ["Followup" gnus-summary-followup t]
1608 ["Followup and yank" gnus-summary-followup-with-original t]
1609 ["Supersede article" gnus-summary-supersede-article t]
1610 ["Cancel article" gnus-summary-cancel-article t]
1611 ["Reply" gnus-summary-reply t]
1612 ["Reply and yank" gnus-summary-reply-with-original t]
1613 ["Wide reply" gnus-summary-wide-reply t]
1614 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1615 ["Mail forward" gnus-summary-mail-forward t]
1616 ["Post forward" gnus-summary-post-forward t]
1617 ["Digest and mail" gnus-uu-digest-mail-forward t]
1618 ["Digest and post" gnus-uu-digest-post-forward t]
1619 ["Resend message" gnus-summary-resend-message t]
1620 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1621 ["Send a mail" gnus-summary-mail-other-window t]
1622 ["Uuencode and post" gnus-uu-post-news t]
1623 ["Followup via news" gnus-summary-followup-to-mail t]
1624 ["Followup via news and yank"
1625 gnus-summary-followup-to-mail-with-original t]
1627 ;;["Send" gnus-summary-send-draft t]
1628 ;;["Send bounced" gnus-resend-bounced-mail t])
1632 gnus-summary-misc-menu gnus-summary-mode-map ""
1635 ["Mark as read" gnus-summary-mark-as-read-forward t]
1636 ["Mark same subject and select"
1637 gnus-summary-kill-same-subject-and-select t]
1638 ["Mark same subject" gnus-summary-kill-same-subject t]
1639 ["Catchup" gnus-summary-catchup t]
1640 ["Catchup all" gnus-summary-catchup-all t]
1641 ["Catchup to here" gnus-summary-catchup-to-here t]
1642 ["Catchup region" gnus-summary-mark-region-as-read t]
1643 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1645 ["Tick" gnus-summary-tick-article-forward t]
1646 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1647 ["Remove marks" gnus-summary-clear-mark-forward t]
1648 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1649 ["Set bookmark" gnus-summary-set-bookmark t]
1650 ["Remove bookmark" gnus-summary-remove-bookmark t])
1652 ["Marks..." gnus-summary-limit-to-marks t]
1653 ["Subject..." gnus-summary-limit-to-subject t]
1654 ["Author..." gnus-summary-limit-to-author t]
1655 ["Age..." gnus-summary-limit-to-age t]
1656 ["Score" gnus-summary-limit-to-score t]
1657 ["Unread" gnus-summary-limit-to-unread t]
1658 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1659 ["Articles" gnus-summary-limit-to-articles t]
1660 ["Pop limit" gnus-summary-pop-limit t]
1661 ["Show dormant" gnus-summary-limit-include-dormant t]
1662 ["Hide childless dormant"
1663 gnus-summary-limit-exclude-childless-dormant t]
1664 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1665 ["Show expunged" gnus-summary-show-all-expunged t])
1667 ["Set mark" gnus-summary-mark-as-processable t]
1668 ["Remove mark" gnus-summary-unmark-as-processable t]
1669 ["Remove all marks" gnus-summary-unmark-all-processable t]
1670 ["Mark above" gnus-uu-mark-over t]
1671 ["Mark series" gnus-uu-mark-series t]
1672 ["Mark region" gnus-uu-mark-region t]
1673 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1674 ["Mark all" gnus-uu-mark-all t]
1675 ["Mark buffer" gnus-uu-mark-buffer t]
1676 ["Mark sparse" gnus-uu-mark-sparse t]
1677 ["Mark thread" gnus-uu-mark-thread t]
1678 ["Unmark thread" gnus-uu-unmark-thread t]
1679 ("Process Mark Sets"
1680 ["Kill" gnus-summary-kill-process-mark t]
1681 ["Yank" gnus-summary-yank-process-mark
1682 gnus-newsgroup-process-stack]
1683 ["Save" gnus-summary-save-process-mark t]))
1685 ["Page forward" gnus-summary-next-page t]
1686 ["Page backward" gnus-summary-prev-page t]
1687 ["Line forward" gnus-summary-scroll-up t])
1689 ["Next unread article" gnus-summary-next-unread-article t]
1690 ["Previous unread article" gnus-summary-prev-unread-article t]
1691 ["Next article" gnus-summary-next-article t]
1692 ["Previous article" gnus-summary-prev-article t]
1693 ["Next unread subject" gnus-summary-next-unread-subject t]
1694 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1695 ["Next article same subject" gnus-summary-next-same-subject t]
1696 ["Previous article same subject" gnus-summary-prev-same-subject t]
1697 ["First unread article" gnus-summary-first-unread-article t]
1698 ["Best unread article" gnus-summary-best-unread-article t]
1699 ["Go to subject number..." gnus-summary-goto-subject t]
1700 ["Go to article number..." gnus-summary-goto-article t]
1701 ["Go to the last article" gnus-summary-goto-last-article t]
1702 ["Pop article off history" gnus-summary-pop-article t])
1704 ["Sort by number" gnus-summary-sort-by-number t]
1705 ["Sort by author" gnus-summary-sort-by-author t]
1706 ["Sort by subject" gnus-summary-sort-by-subject t]
1707 ["Sort by date" gnus-summary-sort-by-date t]
1708 ["Sort by score" gnus-summary-sort-by-score t]
1709 ["Sort by lines" gnus-summary-sort-by-lines t])
1711 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1712 ["Describe group" gnus-summary-describe-group t]
1713 ["Read manual" gnus-info-find-node t])
1715 ["Pick and read" gnus-pick-mode t]
1716 ["Binary" gnus-binary-mode t])
1718 ["Regenerate" gnus-summary-prepare t]
1719 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1720 ["Toggle threading" gnus-summary-toggle-threads t])
1721 ["Filter articles..." gnus-summary-execute-command t]
1722 ["Run command on subjects..." gnus-summary-universal-argument t]
1723 ["Search articles forward..." gnus-summary-search-article-forward t]
1724 ["Search articles backward..." gnus-summary-search-article-backward t]
1725 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1726 ["Expand window" gnus-summary-expand-window t]
1727 ["Expire expirable articles" gnus-summary-expire-articles
1728 (gnus-check-backend-function
1729 'request-expire-articles gnus-newsgroup-name)]
1730 ["Edit local kill file" gnus-summary-edit-local-kill t]
1731 ["Edit main kill file" gnus-summary-edit-global-kill t]
1733 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1734 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1735 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1736 ["Exit group" gnus-summary-exit t]
1737 ["Exit group without updating" gnus-summary-exit-no-update t]
1738 ["Exit and goto next group" gnus-summary-next-group t]
1739 ["Exit and goto prev group" gnus-summary-prev-group t]
1740 ["Reselect group" gnus-summary-reselect-current-group t]
1741 ["Rescan group" gnus-summary-rescan-group t]
1742 ["Update dribble" gnus-summary-save-newsrc t])))
1744 (run-hooks 'gnus-summary-menu-hook)))
1746 (defun gnus-score-set-default (var value)
1747 "A version of set that updates the GNU Emacs menu-bar."
1749 ;; It is the message that forces the active status to be updated.
1752 (defun gnus-make-score-map (type)
1753 "Make a summary score map of type TYPE."
1756 (let ((headers '(("author" "from" string)
1757 ("subject" "subject" string)
1758 ("article body" "body" string)
1759 ("article head" "head" string)
1760 ("xref" "xref" string)
1761 ("lines" "lines" number)
1762 ("followups to author" "followup" string)))
1763 (types '((number ("less than" <)
1766 (string ("substring" s)
1770 (perms '(("temporary" (current-time-string))
1778 (if (eq type 'lower)
1783 (setq header (car headers))
1789 (let ((ts (cdr (assoc (nth 2 header) types)))
1805 'gnus-summary-score-entry
1807 (if (or (string= (nth 1 header)
1809 (string= (nth 1 header)
1812 (list 'gnus-summary-header
1814 (list 'quote (nth 1 (car ts)))
1815 (list 'gnus-score-default nil)
1821 (list (nreverse outp))))
1824 (list (nreverse outt))))
1826 (setq headers (cdr headers)))
1827 (list (nreverse outh))))))))
1831 (defun gnus-summary-mode (&optional group)
1832 "Major mode for reading articles.
1834 All normal editing commands are switched off.
1835 \\<gnus-summary-mode-map>
1836 Each line in this buffer represents one article. To read an
1837 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1838 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1841 You can also post articles and send mail from this buffer. To
1842 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1843 of an article, type `\\[gnus-summary-reply]'.
1845 There are approx. one gazillion commands you can execute in this
1846 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1848 The following commands are available:
1850 \\{gnus-summary-mode-map}"
1852 (when (gnus-visual-p 'summary-menu 'menu)
1853 (gnus-summary-make-menu-bar))
1854 (kill-all-local-variables)
1855 (gnus-summary-make-local-variables)
1856 (gnus-make-thread-indent-array)
1857 (gnus-simplify-mode-line)
1858 (setq major-mode 'gnus-summary-mode)
1859 (setq mode-name "Summary")
1860 (make-local-variable 'minor-mode-alist)
1861 (use-local-map gnus-summary-mode-map)
1862 (buffer-disable-undo (current-buffer))
1863 (setq buffer-read-only t) ;Disable modification
1864 (setq truncate-lines t)
1865 (setq selective-display t)
1866 (setq selective-display-ellipses t) ;Display `...'
1867 (setq buffer-display-table gnus-summary-display-table)
1868 (gnus-set-default-directory)
1869 (setq gnus-newsgroup-name group)
1870 (make-local-variable 'gnus-summary-line-format)
1871 (make-local-variable 'gnus-summary-line-format-spec)
1872 (make-local-variable 'gnus-summary-mark-positions)
1873 (make-local-hook 'post-command-hook)
1874 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1875 (run-hooks 'gnus-summary-mode-hook)
1876 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1877 (gnus-update-summary-mark-positions))
1879 (defun gnus-summary-make-local-variables ()
1880 "Make all the local summary buffer variables."
1881 (let ((locals gnus-summary-local-variables)
1883 (while (setq local (pop locals))
1886 (if (eq (cdr local) 'global)
1887 ;; Copy the global value of the variable.
1888 (setq global (symbol-value (car local)))
1889 ;; Use the value from the list.
1890 (setq global (eval (cdr local))))
1891 (make-local-variable (car local))
1892 (set (car local) global))
1893 ;; Simple nil-valued local variable.
1894 (make-local-variable local)
1897 (defun gnus-summary-clear-local-variables ()
1898 (let ((locals gnus-summary-local-variables))
1900 (if (consp (car locals))
1901 (and (vectorp (caar locals))
1902 (set (caar locals) nil))
1903 (and (vectorp (car locals))
1904 (set (car locals) nil)))
1905 (setq locals (cdr locals)))))
1907 ;; Summary data functions.
1909 (defmacro gnus-data-number (data)
1912 (defmacro gnus-data-set-number (data number)
1913 `(setcar ,data ,number))
1915 (defmacro gnus-data-mark (data)
1918 (defmacro gnus-data-set-mark (data mark)
1919 `(setcar (nthcdr 1 ,data) ,mark))
1921 (defmacro gnus-data-pos (data)
1924 (defmacro gnus-data-set-pos (data pos)
1925 `(setcar (nthcdr 2 ,data) ,pos))
1927 (defmacro gnus-data-header (data)
1930 (defmacro gnus-data-set-header (data header)
1931 `(setf (nth 3 ,data) ,header))
1933 (defmacro gnus-data-level (data)
1936 (defmacro gnus-data-unread-p (data)
1937 `(= (nth 1 ,data) gnus-unread-mark))
1939 (defmacro gnus-data-read-p (data)
1940 `(/= (nth 1 ,data) gnus-unread-mark))
1942 (defmacro gnus-data-pseudo-p (data)
1943 `(consp (nth 3 ,data)))
1945 (defmacro gnus-data-find (number)
1946 `(assq ,number gnus-newsgroup-data))
1948 (defmacro gnus-data-find-list (number &optional data)
1949 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1950 (memq (assq ,number bdata)
1953 (defmacro gnus-data-make (number mark pos header level)
1954 `(list ,number ,mark ,pos ,header ,level))
1956 (defun gnus-data-enter (after-article number mark pos header level offset)
1957 (let ((data (gnus-data-find-list after-article)))
1959 (error "No such article: %d" after-article))
1960 (setcdr data (cons (gnus-data-make number mark pos header level)
1962 (setq gnus-newsgroup-data-reverse nil)
1963 (gnus-data-update-list (cddr data) offset)))
1965 (defun gnus-data-enter-list (after-article list &optional offset)
1967 (let ((data (and after-article (gnus-data-find-list after-article)))
1969 (or data (not after-article) (error "No such article: %d" after-article))
1970 ;; Find the last element in the list to be spliced into the main
1973 (setq list (cdr list)))
1976 (setcdr list gnus-newsgroup-data)
1977 (setq gnus-newsgroup-data ilist)
1979 (gnus-data-update-list (cdr list) offset)))
1980 (setcdr list (cdr data))
1983 (gnus-data-update-list (cdr list) offset)))
1984 (setq gnus-newsgroup-data-reverse nil))))
1986 (defun gnus-data-remove (article &optional offset)
1987 (let ((data gnus-newsgroup-data))
1988 (if (= (gnus-data-number (car data)) article)
1990 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
1991 gnus-newsgroup-data-reverse nil)
1993 (gnus-data-update-list gnus-newsgroup-data offset)))
1995 (when (= (gnus-data-number (cadr data)) article)
1996 (setcdr data (cddr data))
1998 (gnus-data-update-list (cdr data) offset))
2000 gnus-newsgroup-data-reverse nil))
2001 (setq data (cdr data))))))
2003 (defmacro gnus-data-list (backward)
2005 (or gnus-newsgroup-data-reverse
2006 (setq gnus-newsgroup-data-reverse
2007 (reverse gnus-newsgroup-data)))
2008 gnus-newsgroup-data))
2010 (defun gnus-data-update-list (data offset)
2011 "Add OFFSET to the POS of all data entries in DATA."
2013 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2014 (setq data (cdr data))))
2016 (defun gnus-data-compute-positions ()
2017 "Compute the positions of all articles."
2018 (let ((data gnus-newsgroup-data)
2021 (when (setq pos (text-property-any
2022 (point-min) (point-max)
2023 'gnus-number (gnus-data-number (car data))))
2024 (gnus-data-set-pos (car data) (+ pos 3)))
2025 (setq data (cdr data)))))
2027 (defun gnus-summary-article-pseudo-p (article)
2028 "Say whether this article is a pseudo article or not."
2029 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2031 (defmacro gnus-summary-article-sparse-p (article)
2032 "Say whether this article is a sparse article or not."
2033 ` (memq ,article gnus-newsgroup-sparse))
2035 (defmacro gnus-summary-article-ancient-p (article)
2036 "Say whether this article is a sparse article or not."
2037 `(memq ,article gnus-newsgroup-ancient))
2039 (defun gnus-article-parent-p (number)
2040 "Say whether this article is a parent or not."
2041 (let ((data (gnus-data-find-list number)))
2042 (and (cdr data) ; There has to be an article after...
2043 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2044 (gnus-data-level (nth 1 data))))))
2046 (defun gnus-article-children (number)
2047 "Return a list of all children to NUMBER."
2048 (let* ((data (gnus-data-find-list number))
2049 (level (gnus-data-level (car data)))
2051 (setq data (cdr data))
2053 (= (gnus-data-level (car data)) (1+ level)))
2054 (push (gnus-data-number (car data)) children)
2055 (setq data (cdr data)))
2058 (defmacro gnus-summary-skip-intangible ()
2059 "If the current article is intangible, then jump to a different article."
2060 '(let ((to (get-text-property (point) 'gnus-intangible)))
2061 (and to (gnus-summary-goto-subject to))))
2063 (defmacro gnus-summary-article-intangible-p ()
2064 "Say whether this article is intangible or not."
2065 '(get-text-property (point) 'gnus-intangible))
2067 (defun gnus-article-read-p (article)
2068 "Say whether ARTICLE is read or not."
2069 (not (or (memq article gnus-newsgroup-marked)
2070 (memq article gnus-newsgroup-unreads)
2071 (memq article gnus-newsgroup-unselected)
2072 (memq article gnus-newsgroup-dormant))))
2074 ;; Some summary mode macros.
2076 (defmacro gnus-summary-article-number ()
2077 "The article number of the article on the current line.
2078 If there isn's an article number here, then we return the current
2081 (gnus-summary-skip-intangible)
2082 (or (get-text-property (point) 'gnus-number)
2083 (gnus-summary-last-subject))))
2085 (defmacro gnus-summary-article-header (&optional number)
2086 `(gnus-data-header (gnus-data-find
2087 ,(or number '(gnus-summary-article-number)))))
2089 (defmacro gnus-summary-thread-level (&optional number)
2090 `(if (and (eq gnus-summary-make-false-root 'dummy)
2091 (get-text-property (point) 'gnus-intangible))
2093 (gnus-data-level (gnus-data-find
2094 ,(or number '(gnus-summary-article-number))))))
2096 (defmacro gnus-summary-article-mark (&optional number)
2097 `(gnus-data-mark (gnus-data-find
2098 ,(or number '(gnus-summary-article-number)))))
2100 (defmacro gnus-summary-article-pos (&optional number)
2101 `(gnus-data-pos (gnus-data-find
2102 ,(or number '(gnus-summary-article-number)))))
2104 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2105 (defmacro gnus-summary-article-subject (&optional number)
2106 "Return current subject string or nil if nothing."
2109 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2110 '(gnus-data-header (assq (gnus-summary-article-number)
2111 gnus-newsgroup-data)))))
2114 (mail-header-subject headers))))
2116 (defmacro gnus-summary-article-score (&optional number)
2117 "Return current article score."
2118 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2119 gnus-newsgroup-scored))
2120 gnus-summary-default-score 0))
2122 (defun gnus-summary-article-children (&optional number)
2123 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2124 (level (gnus-data-level (car data)))
2126 (while (and (setq data (cdr data))
2127 (> (setq l (gnus-data-level (car data))) level))
2128 (and (= (1+ level) l)
2129 (push (gnus-data-number (car data))
2131 (nreverse children)))
2133 (defun gnus-summary-article-parent (&optional number)
2134 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2135 (gnus-data-list t)))
2136 (level (gnus-data-level (car data))))
2138 () ; This is a root.
2139 ;; We search until we find an article with a level less than
2140 ;; this one. That function has to be the parent.
2141 (while (and (setq data (cdr data))
2142 (not (< (gnus-data-level (car data)) level))))
2143 (and data (gnus-data-number (car data))))))
2145 (defun gnus-unread-mark-p (mark)
2146 "Say whether MARK is the unread mark."
2147 (= mark gnus-unread-mark))
2149 (defun gnus-read-mark-p (mark)
2150 "Say whether MARK is one of the marks that mark as read.
2151 This is all marks except unread, ticked, dormant, and expirable."
2152 (not (or (= mark gnus-unread-mark)
2153 (= mark gnus-ticked-mark)
2154 (= mark gnus-dormant-mark)
2155 (= mark gnus-expirable-mark))))
2157 (defmacro gnus-article-mark (number)
2159 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2160 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2161 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2162 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2163 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2164 gnus-ancient-mark))))
2166 ;; Saving hidden threads.
2168 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2169 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2171 (defmacro gnus-save-hidden-threads (&rest forms)
2172 "Save hidden threads, eval FORMS, and restore the hidden threads."
2173 (let ((config (make-symbol "config")))
2174 `(let ((,config (gnus-hidden-threads-configuration)))
2178 (gnus-restore-hidden-threads-configuration ,config)))))
2180 (defun gnus-hidden-threads-configuration ()
2181 "Return the current hidden threads configuration."
2184 (goto-char (point-min))
2185 (while (search-forward "\r" nil t)
2186 (push (1- (point)) config))
2189 (defun gnus-restore-hidden-threads-configuration (config)
2190 "Restore hidden threads configuration from CONFIG."
2191 (let (point buffer-read-only)
2192 (while (setq point (pop config))
2193 (when (and (< point (point-max))
2195 (= (following-char) ?\n))
2196 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2198 ;; Various summary mode internalish functions.
2200 (defun gnus-mouse-pick-article (e)
2203 (gnus-summary-next-page nil t))
2205 (defun gnus-summary-setup-buffer (group)
2206 "Initialize summary buffer."
2207 (let ((buffer (concat "*Summary " group "*")))
2208 (if (get-buffer buffer)
2211 (setq gnus-summary-buffer (current-buffer))
2212 (not gnus-newsgroup-prepared))
2213 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2214 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2215 (gnus-add-current-to-buffer-list)
2216 (gnus-summary-mode group)
2218 (gnus-carpal-setup-buffer 'summary))
2219 (unless gnus-single-article-buffer
2220 (make-local-variable 'gnus-article-buffer)
2221 (make-local-variable 'gnus-article-current)
2222 (make-local-variable 'gnus-original-article-buffer))
2223 (setq gnus-newsgroup-name group)
2226 (defun gnus-set-global-variables ()
2227 ;; Set the global equivalents of the summary buffer-local variables
2228 ;; to the latest values they had. These reflect the summary buffer
2229 ;; that was in action when the last article was fetched.
2230 (when (eq major-mode 'gnus-summary-mode)
2231 (setq gnus-summary-buffer (current-buffer))
2232 (let ((name gnus-newsgroup-name)
2233 (marked gnus-newsgroup-marked)
2234 (unread gnus-newsgroup-unreads)
2235 (headers gnus-current-headers)
2236 (data gnus-newsgroup-data)
2237 (summary gnus-summary-buffer)
2238 (article-buffer gnus-article-buffer)
2239 (original gnus-original-article-buffer)
2240 (gac gnus-article-current)
2241 (reffed gnus-reffed-article-number)
2242 (score-file gnus-current-score-file))
2244 (set-buffer gnus-group-buffer)
2245 (setq gnus-newsgroup-name name)
2246 (setq gnus-newsgroup-marked marked)
2247 (setq gnus-newsgroup-unreads unread)
2248 (setq gnus-current-headers headers)
2249 (setq gnus-newsgroup-data data)
2250 (setq gnus-article-current gac)
2251 (setq gnus-summary-buffer summary)
2252 (setq gnus-article-buffer article-buffer)
2253 (setq gnus-original-article-buffer original)
2254 (setq gnus-reffed-article-number reffed)
2255 (setq gnus-current-score-file score-file)
2256 ;; The article buffer also has local variables.
2257 (when (gnus-buffer-live-p gnus-article-buffer)
2258 (set-buffer gnus-article-buffer)
2259 (setq gnus-summary-buffer summary))))))
2261 (defun gnus-summary-article-unread-p (article)
2262 "Say whether ARTICLE is unread or not."
2263 (memq article gnus-newsgroup-unreads))
2265 (defun gnus-summary-first-article-p (&optional article)
2266 "Return whether ARTICLE is the first article in the buffer."
2267 (if (not (setq article (or article (gnus-summary-article-number))))
2269 (eq article (caar gnus-newsgroup-data))))
2271 (defun gnus-summary-last-article-p (&optional article)
2272 "Return whether ARTICLE is the last article in the buffer."
2273 (if (not (setq article (or article (gnus-summary-article-number))))
2274 t ; All non-existent numbers are the last article. :-)
2275 (not (cdr (gnus-data-find-list article)))))
2277 (defun gnus-make-thread-indent-array ()
2279 (unless (and gnus-thread-indent-array
2280 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2281 (setq gnus-thread-indent-array (make-vector 201 "")
2282 gnus-thread-indent-array-level gnus-thread-indent-level)
2284 (aset gnus-thread-indent-array n
2285 (make-string (* n gnus-thread-indent-level) ? ))
2288 (defun gnus-update-summary-mark-positions ()
2289 "Compute where the summary marks are to go."
2291 (when (and gnus-summary-buffer
2292 (get-buffer gnus-summary-buffer)
2293 (buffer-name (get-buffer gnus-summary-buffer)))
2294 (set-buffer gnus-summary-buffer))
2295 (let ((gnus-replied-mark 129)
2296 (gnus-score-below-mark 130)
2297 (gnus-score-over-mark 130)
2298 (spec gnus-summary-line-format-spec)
2299 thread gnus-visual pos)
2301 (gnus-set-work-buffer)
2302 (let ((gnus-summary-line-format-spec spec))
2303 (gnus-summary-insert-line
2304 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2305 (goto-char (point-min))
2306 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2308 (goto-char (point-min))
2309 (push (cons 'replied (and (search-forward "\201" nil t)
2312 (goto-char (point-min))
2313 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2315 (setq gnus-summary-mark-positions pos))))
2317 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2318 "Insert a dummy root in the summary buffer."
2320 (gnus-add-text-properties
2321 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2322 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2324 (defun gnus-summary-insert-line (gnus-tmp-header
2325 gnus-tmp-level gnus-tmp-current
2326 gnus-tmp-unread gnus-tmp-replied
2327 gnus-tmp-expirable gnus-tmp-subject-or-nil
2328 &optional gnus-tmp-dummy gnus-tmp-score
2330 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2331 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2332 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2333 (gnus-tmp-score-char
2334 (if (or (null gnus-summary-default-score)
2335 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2336 gnus-summary-zcore-fuzz))
2338 (if (< gnus-tmp-score gnus-summary-default-score)
2339 gnus-score-below-mark gnus-score-over-mark)))
2341 (cond (gnus-tmp-process gnus-process-mark)
2342 ((memq gnus-tmp-current gnus-newsgroup-cached)
2344 (gnus-tmp-replied gnus-replied-mark)
2345 ((memq gnus-tmp-current gnus-newsgroup-saved)
2347 (t gnus-unread-mark)))
2348 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2351 ((string-match "<[^>]+> *$" gnus-tmp-from)
2352 (let ((beg (match-beginning 0)))
2353 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2354 (substring gnus-tmp-from (1+ (match-beginning 0))
2355 (1- (match-end 0))))
2356 (substring gnus-tmp-from 0 beg))))
2357 ((string-match "(.+)" gnus-tmp-from)
2358 (substring gnus-tmp-from
2359 (1+ (match-beginning 0)) (1- (match-end 0))))
2361 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2362 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2363 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2364 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2365 (buffer-read-only nil))
2366 (when (string= gnus-tmp-name "")
2367 (setq gnus-tmp-name gnus-tmp-from))
2368 (unless (numberp gnus-tmp-lines)
2369 (setq gnus-tmp-lines 0))
2370 (gnus-put-text-property
2372 (progn (eval gnus-summary-line-format-spec) (point))
2373 'gnus-number gnus-tmp-number)
2374 (when (gnus-visual-p 'summary-highlight 'highlight)
2376 (run-hooks 'gnus-summary-update-hook)
2379 (defun gnus-summary-update-line (&optional dont-update)
2380 ;; Update summary line after change.
2381 (when (and gnus-summary-default-score
2382 (not gnus-summary-inhibit-highlight))
2383 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2384 (article (gnus-summary-article-number))
2385 (score (gnus-summary-article-score article)))
2387 (if (and gnus-summary-mark-below
2388 (< (gnus-summary-article-score)
2389 gnus-summary-mark-below))
2390 ;; This article has a low score, so we mark it as read.
2391 (when (memq article gnus-newsgroup-unreads)
2392 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2393 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2394 ;; This article was previously marked as read on account
2395 ;; of a low score, but now it has risen, so we mark it as
2397 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2398 (gnus-summary-update-mark
2399 (if (or (null gnus-summary-default-score)
2400 (<= (abs (- score gnus-summary-default-score))
2401 gnus-summary-zcore-fuzz))
2403 (if (< score gnus-summary-default-score)
2404 gnus-score-below-mark gnus-score-over-mark))
2406 ;; Do visual highlighting.
2407 (when (gnus-visual-p 'summary-highlight 'highlight)
2408 (run-hooks 'gnus-summary-update-hook)))))
2410 (defvar gnus-tmp-new-adopts nil)
2412 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2413 "Return the number of articles in THREAD.
2414 This may be 0 in some cases -- if none of the articles in
2415 the thread are to be displayed."
2417 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2419 ((not (listp thread))
2421 ((and (consp thread) (cdr thread))
2424 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2427 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2430 (when (and level (zerop level) gnus-tmp-new-adopts)
2433 'gnus-summary-number-of-articles-in-thread
2434 gnus-tmp-new-adopts))))
2436 (if (> number 1) gnus-not-empty-thread-mark
2437 gnus-empty-thread-mark)
2440 (defun gnus-summary-set-local-parameters (group)
2441 "Go through the local params of GROUP and set all variable specs in that list."
2442 (let ((params (gnus-group-find-parameter group))
2445 (setq elem (car params)
2446 params (cdr params))
2447 (and (consp elem) ; Has to be a cons.
2448 (consp (cdr elem)) ; The cdr has to be a list.
2449 (symbolp (car elem)) ; Has to be a symbol in there.
2450 (not (memq (car elem)
2451 '(quit-config to-address to-list to-group)))
2452 (progn ; So we set it.
2453 (make-local-variable (car elem))
2454 (set (car elem) (eval (nth 1 elem))))))))
2456 (defun gnus-summary-read-group (group &optional show-all no-article
2457 kill-buffer no-display)
2458 "Start reading news in newsgroup GROUP.
2459 If SHOW-ALL is non-nil, already read articles are also listed.
2460 If NO-ARTICLE is non-nil, no article is selected initially.
2461 If NO-DISPLAY, don't generate a summary buffer."
2462 ;; Killed foreign groups can't be entered.
2463 (when (and (not (gnus-group-native-p group))
2464 (not (gnus-gethash group gnus-newsrc-hashtb)))
2465 (error "Dead non-native groups can't be entered"))
2466 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2467 (let* ((new-group (gnus-summary-setup-buffer group))
2468 (quit-config (gnus-group-quit-config group))
2469 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2471 ;; This summary buffer exists already, so we just select it.
2473 (gnus-set-global-variables)
2475 (gnus-kill-or-deaden-summary kill-buffer))
2476 (gnus-configure-windows 'summary 'force)
2477 (gnus-set-mode-line 'summary)
2478 (gnus-summary-position-point)
2481 ;; We couldn't select this group.
2483 (when (and (eq major-mode 'gnus-summary-mode)
2484 (not (equal (current-buffer) kill-buffer)))
2485 (kill-buffer (current-buffer))
2486 (if (not quit-config)
2488 (set-buffer gnus-group-buffer)
2489 (gnus-group-jump-to-group group)
2490 (gnus-group-next-unread-group 1))
2491 (gnus-handle-ephemeral-exit quit-config)))
2492 (gnus-message 3 "Can't select group")
2494 ;; The user did a `C-g' while prompting for number of articles,
2495 ;; so we exit this group.
2496 ((eq did-select 'quit)
2497 (and (eq major-mode 'gnus-summary-mode)
2498 (not (equal (current-buffer) kill-buffer))
2499 (kill-buffer (current-buffer)))
2501 (gnus-kill-or-deaden-summary kill-buffer))
2502 (if (not quit-config)
2504 (set-buffer gnus-group-buffer)
2505 (gnus-group-jump-to-group group)
2506 (gnus-group-next-unread-group 1)
2507 (gnus-configure-windows 'group 'force))
2508 (gnus-handle-ephemeral-exit quit-config))
2509 ;; Finally signal the quit.
2511 ;; The group was successfully selected.
2513 (gnus-set-global-variables)
2514 ;; Save the active value in effect when the group was entered.
2515 (setq gnus-newsgroup-active
2517 (gnus-active gnus-newsgroup-name)))
2518 ;; You can change the summary buffer in some way with this hook.
2519 (run-hooks 'gnus-select-group-hook)
2520 ;; Set any local variables in the group parameters.
2521 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2522 (gnus-update-format-specifications
2523 nil 'summary 'summary-mode 'summary-dummy)
2524 ;; Do score processing.
2525 (when gnus-use-scoring
2526 (gnus-possibly-score-headers))
2527 ;; Check whether to fill in the gaps in the threads.
2528 (when gnus-build-sparse-threads
2529 (gnus-build-sparse-threads))
2530 ;; Find the initial limit.
2531 (if gnus-show-threads
2533 (let ((gnus-newsgroup-dormant nil))
2534 (gnus-summary-initial-limit show-all))
2535 (gnus-summary-initial-limit show-all))
2536 (setq gnus-newsgroup-limit
2538 (lambda (header) (mail-header-number header))
2539 gnus-newsgroup-headers)))
2540 ;; Generate the summary buffer.
2542 (gnus-summary-prepare))
2543 (when gnus-use-trees
2544 (gnus-tree-open group)
2545 (setq gnus-summary-highlight-line-function
2546 'gnus-tree-highlight-article))
2547 ;; If the summary buffer is empty, but there are some low-scored
2548 ;; articles or some excluded dormants, we include these in the
2550 (when (and (zerop (buffer-size))
2552 (cond (gnus-newsgroup-dormant
2553 (gnus-summary-limit-include-dormant))
2554 ((and gnus-newsgroup-scored show-all)
2555 (gnus-summary-limit-include-expunged t))))
2556 ;; Function `gnus-apply-kill-file' must be called in this hook.
2557 (run-hooks 'gnus-apply-kill-hook)
2558 (if (and (zerop (buffer-size))
2561 ;; This newsgroup is empty.
2562 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2563 (gnus-message 6 "No unread news")
2565 (gnus-kill-or-deaden-summary kill-buffer))
2566 ;; Return nil from this function.
2568 ;; Hide conversation thread subtrees. We cannot do this in
2569 ;; gnus-summary-prepare-hook since kill processing may not
2570 ;; work with hidden articles.
2571 (and gnus-show-threads
2572 gnus-thread-hide-subtree
2573 (gnus-summary-hide-all-threads))
2574 ;; Show first unread article if requested.
2575 (if (and (not no-article)
2577 gnus-newsgroup-unreads
2578 gnus-auto-select-first)
2579 (unless (if (eq gnus-auto-select-first 'best)
2580 (gnus-summary-best-unread-article)
2581 (gnus-summary-first-unread-article))
2582 (gnus-configure-windows 'summary))
2583 ;; Don't select any articles, just move point to the first
2584 ;; article in the group.
2585 (goto-char (point-min))
2586 (gnus-summary-position-point)
2587 (gnus-set-mode-line 'summary)
2588 (gnus-configure-windows 'summary 'force))
2590 (gnus-kill-or-deaden-summary kill-buffer))
2591 (when (get-buffer-window gnus-group-buffer t)
2592 ;; Gotta use windows, because recenter does weird stuff if
2593 ;; the current buffer ain't the displayed window.
2594 (let ((owin (selected-window)))
2595 (select-window (get-buffer-window gnus-group-buffer t))
2596 (when (gnus-group-goto-group group)
2598 (select-window owin))))
2599 ;; Mark this buffer as "prepared".
2600 (setq gnus-newsgroup-prepared t)
2603 (defun gnus-summary-prepare ()
2604 "Generate the summary buffer."
2606 (let ((buffer-read-only nil))
2608 (setq gnus-newsgroup-data nil
2609 gnus-newsgroup-data-reverse nil)
2610 (run-hooks 'gnus-summary-generate-hook)
2611 ;; Generate the buffer, either with threads or without.
2612 (when gnus-newsgroup-headers
2613 (gnus-summary-prepare-threads
2614 (if gnus-show-threads
2615 (gnus-sort-gathered-threads
2616 (funcall gnus-summary-thread-gathering-function
2618 (gnus-cut-threads (gnus-make-threads)))))
2619 ;; Unthreaded display.
2620 (gnus-sort-articles gnus-newsgroup-headers))))
2621 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2622 ;; Call hooks for modifying summary buffer.
2623 (goto-char (point-min))
2624 (run-hooks 'gnus-summary-prepare-hook)))
2626 (defsubst gnus-general-simplify-subject (subject)
2627 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2630 ;; Truncate the subject.
2631 ((numberp gnus-summary-gather-subject-limit)
2632 (setq subject (gnus-simplify-subject-re subject))
2633 (if (> (length subject) gnus-summary-gather-subject-limit)
2634 (substring subject 0 gnus-summary-gather-subject-limit)
2636 ;; Fuzzily simplify it.
2637 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2638 (gnus-simplify-subject-fuzzy subject))
2639 ;; Just remove the leading "Re:".
2641 (gnus-simplify-subject-re subject))))
2643 (if (and gnus-summary-gather-exclude-subject
2644 (string-match gnus-summary-gather-exclude-subject subject))
2645 nil ; This article shouldn't be gathered
2648 (defun gnus-summary-simplify-subject-query ()
2649 "Query where the respool algorithm would put this article."
2651 (gnus-set-global-variables)
2652 (gnus-summary-select-article)
2653 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2655 (defun gnus-gather-threads-by-subject (threads)
2656 "Gather threads by looking at Subject headers."
2657 (if (not gnus-summary-make-false-root)
2659 (let ((hashtb (gnus-make-hashtable 1024))
2662 subject hthread whole-subject)
2664 (setq subject (gnus-general-simplify-subject
2665 (setq whole-subject (mail-header-subject
2668 (if (setq hthread (gnus-gethash subject hashtb))
2670 ;; We enter a dummy root into the thread, if we
2671 ;; haven't done that already.
2672 (unless (stringp (caar hthread))
2673 (setcar hthread (list whole-subject (car hthread))))
2674 ;; We add this new gathered thread to this gathered
2676 (setcdr (car hthread)
2677 (nconc (cdar hthread) (list (car threads))))
2678 ;; Remove it from the list of threads.
2679 (setcdr prev (cdr threads))
2680 (setq threads prev))
2681 ;; Enter this thread into the hash table.
2682 (gnus-sethash subject threads hashtb)))
2684 (setq threads (cdr threads)))
2687 (defun gnus-gather-threads-by-references (threads)
2688 "Gather threads by looking at References headers."
2689 (let ((idhashtb (gnus-make-hashtable 1024))
2690 (thhashtb (gnus-make-hashtable 1024))
2693 ids references id gthread gid entered ref)
2695 (when (setq references (mail-header-references (caar threads)))
2696 (setq id (mail-header-id (caar threads))
2697 ids (gnus-split-references references)
2699 (while (setq ref (pop ids))
2700 (setq ids (delete ref ids))
2701 (if (not (setq gid (gnus-gethash ref idhashtb)))
2703 (gnus-sethash ref id idhashtb)
2704 (gnus-sethash id threads thhashtb))
2705 (setq gthread (gnus-gethash gid thhashtb))
2707 ;; We enter a dummy root into the thread, if we
2708 ;; haven't done that already.
2709 (unless (stringp (caar gthread))
2710 (setcar gthread (list (mail-header-subject (caar gthread))
2712 ;; We add this new gathered thread to this gathered
2714 (setcdr (car gthread)
2715 (nconc (cdar gthread) (list (car threads)))))
2716 ;; Add it into the thread hash table.
2717 (gnus-sethash id gthread thhashtb)
2719 ;; Remove it from the list of threads.
2720 (setcdr prev (cdr threads))
2721 (setq threads prev))))
2723 (setq threads (cdr threads)))
2726 (defun gnus-sort-gathered-threads (threads)
2727 "Sort subtreads inside each gathered thread by article number."
2728 (let ((result threads))
2730 (when (stringp (caar threads))
2731 (setcdr (car threads)
2732 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2733 (setq threads (cdr threads)))
2736 (defun gnus-thread-loop-p (root thread)
2737 "Say whether ROOT is in THREAD."
2738 (let ((th (cdr thread)))
2740 (not (eq (caar th) root)))
2743 ;; We have found a loop.
2745 (setcdr thread (delq (car th) (cdr thread)))
2746 (if (boundp (setq ref-dep (intern "none"
2747 gnus-newsgroup-dependencies)))
2748 (setcdr (symbol-value ref-dep)
2749 (nconc (cdr (symbol-value ref-dep))
2751 (set ref-dep (list nil (car th))))
2753 ;; Recurse down into the sub-threads and look for loops.
2756 (lambda (thread) (gnus-thread-loop-p root thread))
2759 (defun gnus-make-threads ()
2760 "Go through the dependency hashtb and find the roots. Return all threads."
2762 (while (catch 'infloop
2765 ;; Deal with self-referencing References loops.
2766 (when (and (car (symbol-value refs))
2773 (car (symbol-value refs)) thread))
2774 (cdr (symbol-value refs)))))))
2777 (unless (car (symbol-value refs))
2778 ;; These threads do not refer back to any other articles,
2779 ;; so they're roots.
2780 (setq threads (append (cdr (symbol-value refs)) threads))))
2781 gnus-newsgroup-dependencies)))
2784 (defun gnus-build-sparse-threads ()
2785 (let ((headers gnus-newsgroup-headers)
2786 (deps gnus-newsgroup-dependencies)
2787 header references generation relations
2788 cthread subject child end pthread relation)
2789 ;; First we create an alist of generations/relations, where
2790 ;; generations is how much we trust the relation, and the relation
2792 (gnus-message 7 "Making sparse threads...")
2794 (nnheader-set-temp-buffer " *gnus sparse threads*")
2795 (while (setq header (pop headers))
2796 (when (and (setq references (mail-header-references header))
2797 (not (string= references "")))
2799 (setq child (mail-header-id header)
2800 subject (mail-header-subject header))
2802 (while (search-backward ">" nil t)
2803 (setq end (1+ (point)))
2804 (when (search-backward "<" nil t)
2805 (push (list (incf generation)
2806 child (setq child (buffer-substring (point) end))
2809 (push (list (1+ generation) child nil subject) relations)
2811 (kill-buffer (current-buffer)))
2812 ;; Sort over trustworthiness.
2813 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2814 (while (setq relation (pop relations))
2815 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2816 (unless (car (symbol-value cthread))
2817 ;; Make this article the parent of these threads.
2818 (setcar (symbol-value cthread)
2819 (vector gnus-reffed-article-number
2823 (or (caddr relation) "") 0 0 "")))
2824 (set cthread (list (vector gnus-reffed-article-number
2826 "" "" (cadr relation)
2827 (or (caddr relation) "") 0 0 ""))))
2828 (push gnus-reffed-article-number gnus-newsgroup-limit)
2829 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2830 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2831 gnus-newsgroup-reads)
2832 (decf gnus-reffed-article-number)
2833 ;; Make this new thread the child of its parent.
2834 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2835 (setcdr (symbol-value pthread)
2836 (nconc (cdr (symbol-value pthread))
2837 (list (symbol-value cthread))))
2838 (set pthread (list nil (symbol-value cthread))))))
2839 (gnus-message 7 "Making sparse threads...done")))
2841 (defun gnus-build-old-threads ()
2842 ;; Look at all the articles that refer back to old articles, and
2843 ;; fetch the headers for the articles that aren't there. This will
2844 ;; build complete threads - if the roots haven't been expired by the
2849 (when (not (car (symbol-value refs)))
2850 (setq heads (cdr (symbol-value refs)))
2852 (if (memq (mail-header-number (caar heads))
2853 gnus-newsgroup-dormant)
2854 (setq heads (cdr heads))
2855 (setq id (symbol-name refs))
2856 (while (and (setq id (gnus-build-get-header id))
2857 (not (car (gnus-gethash
2858 id gnus-newsgroup-dependencies)))))
2859 (setq heads nil)))))
2860 gnus-newsgroup-dependencies)))
2862 (defun gnus-build-get-header (id)
2863 ;; Look through the buffer of NOV lines and find the header to
2864 ;; ID. Enter this line into the dependencies hash table, and return
2865 ;; the id of the parent article (if any).
2866 (let ((deps gnus-newsgroup-dependencies)
2870 (set-buffer nntp-server-buffer)
2871 (goto-char (point-min))
2872 (while (and (not found) (search-forward id nil t))
2874 (setq found (looking-at
2875 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2876 (regexp-quote id))))
2877 (or found (beginning-of-line 2)))
2881 (setq header (gnus-nov-parse-line
2882 (read (current-buffer)) deps))
2883 (gnus-parent-id (mail-header-references header)))))
2885 (let ((number (mail-header-number header)))
2886 (push number gnus-newsgroup-limit)
2887 (push header gnus-newsgroup-headers)
2888 (if (memq number gnus-newsgroup-unselected)
2890 (push number gnus-newsgroup-unreads)
2891 (setq gnus-newsgroup-unselected
2892 (delq number gnus-newsgroup-unselected)))
2893 (push number gnus-newsgroup-ancient)))))))
2895 (defun gnus-summary-update-article-line (article header)
2896 "Update the line for ARTICLE using HEADERS."
2897 (let* ((id (mail-header-id header))
2898 (thread (gnus-id-to-thread id)))
2900 (error "Article in no thread"))
2901 ;; Update the thread.
2902 (setcar thread header)
2903 (gnus-summary-goto-subject article)
2904 (let* ((datal (gnus-data-find-list article))
2906 (length (when (cdr datal)
2907 (- (gnus-data-pos data)
2908 (gnus-data-pos (cadr datal)))))
2909 (buffer-read-only nil)
2910 (level (gnus-summary-thread-level)))
2912 (gnus-summary-insert-line
2913 header level nil (gnus-article-mark article)
2914 (memq article gnus-newsgroup-replied)
2915 (memq article gnus-newsgroup-expirable)
2916 (mail-header-subject header)
2917 nil (cdr (assq article gnus-newsgroup-scored))
2918 (memq article gnus-newsgroup-processable))
2920 (gnus-data-update-list
2921 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
2923 (defun gnus-summary-update-article (article &optional iheader)
2924 "Update ARTICLE in the summary buffer."
2925 (set-buffer gnus-summary-buffer)
2926 (let* ((header (or iheader (gnus-summary-article-header article)))
2927 (id (mail-header-id header))
2928 (data (gnus-data-find article))
2929 (thread (gnus-id-to-thread id))
2930 (references (mail-header-references header))
2934 (when (and references
2935 (not (equal "" references)))
2938 (buffer-read-only nil)
2940 (number (mail-header-number header))
2943 ;; !!! Should this be in or not?
2945 (setcar thread nil))
2947 (delq thread parent))
2948 (if (gnus-summary-insert-subject id header iheader)
2949 ;; Set the (possibly) new article number in the data structure.
2950 (gnus-data-set-number data (gnus-id-to-article id))
2954 (defun gnus-rebuild-thread (id)
2955 "Rebuild the thread containing ID."
2956 (let ((buffer-read-only nil)
2957 old-pos current thread data)
2958 (if (not gnus-show-threads)
2959 (setq thread (list (car (gnus-id-to-thread id))))
2960 ;; Get the thread this article is part of.
2961 (setq thread (gnus-remove-thread id)))
2962 (setq old-pos (gnus-point-at-bol))
2963 (setq current (save-excursion
2964 (and (zerop (forward-line -1))
2965 (gnus-summary-article-number))))
2966 ;; If this is a gathered thread, we have to go some re-gathering.
2967 (when (stringp (car thread))
2968 (let ((subject (car thread))
2970 (setq thread (cdr thread))
2972 (unless (memq (setq thr (gnus-id-to-thread
2974 (mail-header-id (caar thread)))))
2977 (setq thread (cdr thread)))
2978 ;; We now have all (unique) roots.
2979 (if (= (length roots) 1)
2980 ;; All the loose roots are now one solid root.
2981 (setq thread (car roots))
2982 (setq thread (cons subject (gnus-sort-threads roots))))))
2984 ;; We then insert this thread into the summary buffer.
2985 (let (gnus-newsgroup-data gnus-newsgroup-threads)
2986 (if gnus-show-threads
2987 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
2988 (gnus-summary-prepare-unthreaded thread))
2989 (setq data (nreverse gnus-newsgroup-data))
2990 (setq threads gnus-newsgroup-threads))
2991 ;; We splice the new data into the data structure.
2992 (gnus-data-enter-list current data (- (point) old-pos))
2993 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
2995 (defun gnus-number-to-header (number)
2996 "Return the header for article NUMBER."
2997 (let ((headers gnus-newsgroup-headers))
2999 (not (= number (mail-header-number (car headers)))))
3004 (defun gnus-parent-headers (headers &optional generation)
3005 "Return the headers of the GENERATIONeth parent of HEADERS."
3007 (setq generation 1))
3008 (let (references parent)
3009 (while (and headers (not (zerop generation)))
3010 (setq references (mail-header-references headers))
3011 (when (and references
3012 (setq parent (gnus-parent-id references))
3013 (setq headers (car (gnus-id-to-thread parent))))
3017 (defun gnus-id-to-thread (id)
3018 "Return the (sub-)thread where ID appears."
3019 (gnus-gethash id gnus-newsgroup-dependencies))
3021 (defun gnus-id-to-article (id)
3022 "Return the article number of ID."
3023 (let ((thread (gnus-id-to-thread id)))
3026 (mail-header-number (car thread)))))
3028 (defun gnus-id-to-header (id)
3029 "Return the article headers of ID."
3030 (car (gnus-id-to-thread id)))
3032 (defun gnus-article-displayed-root-p (article)
3033 "Say whether ARTICLE is a root(ish) article."
3034 (let ((level (gnus-summary-thread-level article))
3035 (refs (mail-header-references (gnus-summary-article-header article)))
3041 ((null (gnus-parent-id refs)) t)
3043 (null (setq particle (gnus-id-to-article
3044 (gnus-parent-id refs))))
3045 (null (gnus-summary-thread-level particle)))))))
3047 (defun gnus-root-id (id)
3048 "Return the id of the root of the thread where ID appears."
3050 (while (and id (setq prev (car (gnus-gethash
3051 id gnus-newsgroup-dependencies))))
3053 id (gnus-parent-id (mail-header-references prev))))
3056 (defun gnus-remove-thread (id &optional dont-remove)
3057 "Remove the thread that has ID in it."
3058 (let ((dep gnus-newsgroup-dependencies)
3059 headers thread last-id)
3060 ;; First go up in this thread until we find the root.
3061 (setq last-id (gnus-root-id id))
3062 (setq headers (list (car (gnus-id-to-thread last-id))
3063 (caadr (gnus-id-to-thread last-id))))
3064 ;; We have now found the real root of this thread. It might have
3065 ;; been gathered into some loose thread, so we have to search
3066 ;; through the threads to find the thread we wanted.
3067 (let ((threads gnus-newsgroup-threads)
3070 (setq sub (car threads))
3071 (if (stringp (car sub))
3072 ;; This is a gathered thread, so we look at the roots
3073 ;; below it to find whether this article is in this
3076 (setq sub (cdr sub))
3078 (when (member (caar sub) headers)
3079 (setq thread (car threads)
3082 (setq sub (cdr sub))))
3083 ;; It's an ordinary thread, so we check it.
3084 (when (eq (car sub) (car headers))
3087 (setq threads (cdr threads)))
3088 ;; If this article is in no thread, then it's a root.
3091 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3092 (setq thread (gnus-gethash last-id dep)))
3095 thread ; We return this thread.
3097 (if (stringp (car thread))
3099 ;; If we use dummy roots, then we have to remove the
3100 ;; dummy root as well.
3101 (when (eq gnus-summary-make-false-root 'dummy)
3103 (gnus-data-compute-positions))
3104 (setq thread (cdr thread))
3106 (gnus-remove-thread-1 (car thread))
3107 (setq thread (cdr thread))))
3108 (gnus-remove-thread-1 thread))))))))
3110 (defun gnus-remove-thread-1 (thread)
3111 "Remove the thread THREAD recursively."
3112 (let ((number (mail-header-number (pop thread)))
3114 (setq thread (reverse thread))
3116 (gnus-remove-thread-1 (pop thread)))
3117 (when (setq d (gnus-data-find number))
3118 (goto-char (gnus-data-pos d))
3121 (- (gnus-point-at-bol)
3123 (1+ (gnus-point-at-eol))
3124 (gnus-delete-line)))))))
3126 (defun gnus-sort-threads (threads)
3128 (if (not gnus-thread-sort-functions)
3130 (gnus-message 7 "Sorting threads...")
3132 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3133 (gnus-message 7 "Sorting threads...done"))))
3135 (defun gnus-sort-articles (articles)
3137 (when gnus-article-sort-functions
3138 (gnus-message 7 "Sorting articles...")
3140 (setq gnus-newsgroup-headers
3141 (sort articles (gnus-make-sort-function
3142 gnus-article-sort-functions)))
3143 (gnus-message 7 "Sorting articles...done"))))
3145 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3146 (defmacro gnus-thread-header (thread)
3147 ;; Return header of first article in THREAD.
3148 ;; Note that THREAD must never, ever be anything else than a variable -
3149 ;; using some other form will lead to serious barfage.
3150 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3151 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3152 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3155 (defsubst gnus-article-sort-by-number (h1 h2)
3156 "Sort articles by article number."
3157 (< (mail-header-number h1)
3158 (mail-header-number h2)))
3160 (defun gnus-thread-sort-by-number (h1 h2)
3161 "Sort threads by root article number."
3162 (gnus-article-sort-by-number
3163 (gnus-thread-header h1) (gnus-thread-header h2)))
3165 (defsubst gnus-article-sort-by-lines (h1 h2)
3166 "Sort articles by article Lines header."
3167 (< (mail-header-lines h1)
3168 (mail-header-lines h2)))
3170 (defun gnus-thread-sort-by-lines (h1 h2)
3171 "Sort threads by root article Lines header."
3172 (gnus-article-sort-by-lines
3173 (gnus-thread-header h1) (gnus-thread-header h2)))
3175 (defsubst gnus-article-sort-by-author (h1 h2)
3176 "Sort articles by root author."
3178 (let ((extract (funcall
3179 gnus-extract-address-components
3180 (mail-header-from h1))))
3181 (or (car extract) (cdr extract)))
3182 (let ((extract (funcall
3183 gnus-extract-address-components
3184 (mail-header-from h2))))
3185 (or (car extract) (cdr extract)))))
3187 (defun gnus-thread-sort-by-author (h1 h2)
3188 "Sort threads by root author."
3189 (gnus-article-sort-by-author
3190 (gnus-thread-header h1) (gnus-thread-header h2)))
3192 (defsubst gnus-article-sort-by-subject (h1 h2)
3193 "Sort articles by root subject."
3195 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3196 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3198 (defun gnus-thread-sort-by-subject (h1 h2)
3199 "Sort threads by root subject."
3200 (gnus-article-sort-by-subject
3201 (gnus-thread-header h1) (gnus-thread-header h2)))
3203 (defsubst gnus-article-sort-by-date (h1 h2)
3204 "Sort articles by root article date."
3206 (gnus-date-get-time (mail-header-date h1))
3207 (gnus-date-get-time (mail-header-date h2))))
3209 (defun gnus-thread-sort-by-date (h1 h2)
3210 "Sort threads by root article date."
3211 (gnus-article-sort-by-date
3212 (gnus-thread-header h1) (gnus-thread-header h2)))
3214 (defsubst gnus-article-sort-by-score (h1 h2)
3215 "Sort articles by root article score.
3216 Unscored articles will be counted as having a score of zero."
3217 (> (or (cdr (assq (mail-header-number h1)
3218 gnus-newsgroup-scored))
3219 gnus-summary-default-score 0)
3220 (or (cdr (assq (mail-header-number h2)
3221 gnus-newsgroup-scored))
3222 gnus-summary-default-score 0)))
3224 (defun gnus-thread-sort-by-score (h1 h2)
3225 "Sort threads by root article score."
3226 (gnus-article-sort-by-score
3227 (gnus-thread-header h1) (gnus-thread-header h2)))
3229 (defun gnus-thread-sort-by-total-score (h1 h2)
3230 "Sort threads by the sum of all scores in the thread.
3231 Unscored articles will be counted as having a score of zero."
3232 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3234 (defun gnus-thread-total-score (thread)
3235 ;; This function find the total score of THREAD.
3236 (cond ((null thread)
3239 (if (stringp (car thread))
3240 (apply gnus-thread-score-function 0
3241 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3242 (gnus-thread-total-score-1 thread)))
3244 (gnus-thread-total-score-1 (list thread)))))
3246 (defun gnus-thread-total-score-1 (root)
3247 ;; This function find the total score of the thread below ROOT.
3248 (setq root (car root))
3249 (apply gnus-thread-score-function
3251 (mapcar 'gnus-thread-total-score
3252 (cdr (gnus-gethash (mail-header-id root)
3253 gnus-newsgroup-dependencies)))
3254 (when (> (mail-header-number root) 0)
3255 (list (or (cdr (assq (mail-header-number root)
3256 gnus-newsgroup-scored))
3257 gnus-summary-default-score 0))))
3258 (list gnus-summary-default-score)
3261 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3262 (defvar gnus-tmp-prev-subject nil)
3263 (defvar gnus-tmp-false-parent nil)
3264 (defvar gnus-tmp-root-expunged nil)
3265 (defvar gnus-tmp-dummy-line nil)
3267 (defun gnus-summary-prepare-threads (threads)
3268 "Prepare summary buffer from THREADS and indentation LEVEL.
3269 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3270 or a straight list of headers."
3271 (gnus-message 7 "Generating summary...")
3273 (setq gnus-newsgroup-threads threads)
3276 (let ((gnus-tmp-level 0)
3277 (default-score (or gnus-summary-default-score 0))
3278 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3279 thread number subject stack state gnus-tmp-gathered beg-match
3280 new-roots gnus-tmp-new-adopts thread-end
3281 gnus-tmp-header gnus-tmp-unread
3282 gnus-tmp-replied gnus-tmp-subject-or-nil
3283 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3284 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3285 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3287 (setq gnus-tmp-prev-subject nil)
3289 (if (vectorp (car threads))
3290 ;; If this is a straight (sic) list of headers, then a
3291 ;; threaded summary display isn't required, so we just create
3292 ;; an unthreaded one.
3293 (gnus-summary-prepare-unthreaded threads)
3295 ;; Do the threaded display.
3297 (while (or threads stack gnus-tmp-new-adopts new-roots)
3299 (if (and (= gnus-tmp-level 0)
3300 (not (setq gnus-tmp-dummy-line nil))
3303 (not gnus-tmp-false-parent)
3304 (or gnus-tmp-new-adopts new-roots))
3305 (if gnus-tmp-new-adopts
3306 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3307 thread (list (car gnus-tmp-new-adopts))
3308 gnus-tmp-header (caar thread)
3309 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3311 (setq thread (list (car new-roots))
3312 gnus-tmp-header (caar thread)
3313 new-roots (cdr new-roots))))
3316 ;; If there are some threads, we do them before the
3317 ;; threads on the stack.
3318 (setq thread threads
3319 gnus-tmp-header (caar thread))
3320 ;; There were no current threads, so we pop something off
3322 (setq state (car stack)
3323 gnus-tmp-level (car state)
3326 gnus-tmp-header (caar thread))))
3328 (setq gnus-tmp-false-parent nil)
3329 (setq gnus-tmp-root-expunged nil)
3330 (setq thread-end nil)
3332 (if (stringp gnus-tmp-header)
3333 ;; The header is a dummy root.
3335 ((eq gnus-summary-make-false-root 'adopt)
3336 ;; We let the first article adopt the rest.
3337 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3339 (setq gnus-tmp-gathered
3341 (lambda (h) (mail-header-number (car h)))
3344 (setq thread (cons (list (caar thread)
3347 (setq gnus-tmp-level -1
3348 gnus-tmp-false-parent t))
3349 ((eq gnus-summary-make-false-root 'empty)
3350 ;; We print adopted articles with empty subject fields.
3351 (setq gnus-tmp-gathered
3353 (lambda (h) (mail-header-number (car h)))
3356 (setq gnus-tmp-level -1))
3357 ((eq gnus-summary-make-false-root 'dummy)
3358 ;; We remember that we probably want to output a dummy
3360 (setq gnus-tmp-dummy-line gnus-tmp-header)
3361 (setq gnus-tmp-prev-subject gnus-tmp-header))
3363 ;; We do not make a root for the gathered
3364 ;; sub-threads at all.
3365 (setq gnus-tmp-level -1)))
3367 (setq number (mail-header-number gnus-tmp-header)
3368 subject (mail-header-subject gnus-tmp-header))
3371 ;; If the thread has changed subject, we might want to make
3372 ;; this subthread into a root.
3373 ((and (null gnus-thread-ignore-subject)
3374 (not (zerop gnus-tmp-level))
3375 gnus-tmp-prev-subject
3377 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3378 (setq new-roots (nconc new-roots (list (car thread)))
3380 gnus-tmp-header nil))
3381 ;; If the article lies outside the current limit,
3382 ;; then we do not display it.
3383 ((not (memq number gnus-newsgroup-limit))
3384 (setq gnus-tmp-gathered
3386 (lambda (h) (mail-header-number (car h)))
3389 (setq gnus-tmp-new-adopts (if (cdar thread)
3390 (append gnus-tmp-new-adopts
3392 gnus-tmp-new-adopts)
3394 gnus-tmp-header nil)
3395 (when (zerop gnus-tmp-level)
3396 (setq gnus-tmp-root-expunged t)))
3397 ;; Perhaps this article is to be marked as read?
3398 ((and gnus-summary-mark-below
3399 (< (or (cdr (assq number gnus-newsgroup-scored))
3401 gnus-summary-mark-below)
3402 ;; Don't touch sparse articles.
3403 (not (gnus-summary-article-sparse-p number))
3404 (not (gnus-summary-article-ancient-p number)))
3405 (setq gnus-newsgroup-unreads
3406 (delq number gnus-newsgroup-unreads))
3407 (if gnus-newsgroup-auto-expire
3408 (push number gnus-newsgroup-expirable)
3409 (push (cons number gnus-low-score-mark)
3410 gnus-newsgroup-reads))))
3412 (when gnus-tmp-header
3413 ;; We may have an old dummy line to output before this
3415 (when gnus-tmp-dummy-line
3416 (gnus-summary-insert-dummy-line
3417 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3418 (setq gnus-tmp-dummy-line nil))
3420 ;; Compute the mark.
3421 (setq gnus-tmp-unread (gnus-article-mark number))
3423 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3424 gnus-tmp-header gnus-tmp-level)
3425 gnus-newsgroup-data)
3427 ;; Actually insert the line.
3429 gnus-tmp-subject-or-nil
3431 ((and gnus-thread-ignore-subject
3432 gnus-tmp-prev-subject
3433 (not (inline (gnus-subject-equal
3434 gnus-tmp-prev-subject subject))))
3436 ((zerop gnus-tmp-level)
3437 (if (and (eq gnus-summary-make-false-root 'empty)
3438 (memq number gnus-tmp-gathered)
3439 gnus-tmp-prev-subject
3440 (inline (gnus-subject-equal
3441 gnus-tmp-prev-subject subject)))
3442 gnus-summary-same-subject
3444 (t gnus-summary-same-subject)))
3445 (if (and (eq gnus-summary-make-false-root 'adopt)
3446 (= gnus-tmp-level 1)
3447 (memq number gnus-tmp-gathered))
3448 (setq gnus-tmp-opening-bracket ?\<
3449 gnus-tmp-closing-bracket ?\>)
3450 (setq gnus-tmp-opening-bracket ?\[
3451 gnus-tmp-closing-bracket ?\]))
3453 gnus-tmp-indentation
3454 (aref gnus-thread-indent-array gnus-tmp-level)
3455 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3456 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3457 gnus-summary-default-score 0)
3459 (if (or (null gnus-summary-default-score)
3460 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3461 gnus-summary-zcore-fuzz))
3463 (if (< gnus-tmp-score gnus-summary-default-score)
3464 gnus-score-below-mark gnus-score-over-mark))
3466 (cond ((memq number gnus-newsgroup-processable)
3468 ((memq number gnus-newsgroup-cached)
3470 ((memq number gnus-newsgroup-replied)
3472 ((memq number gnus-newsgroup-saved)
3474 (t gnus-unread-mark))
3475 gnus-tmp-from (mail-header-from gnus-tmp-header)
3478 ((string-match "<[^>]+> *$" gnus-tmp-from)
3479 (setq beg-match (match-beginning 0))
3480 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3481 (substring gnus-tmp-from (1+ (match-beginning 0))
3482 (1- (match-end 0))))
3483 (substring gnus-tmp-from 0 beg-match)))
3484 ((string-match "(.+)" gnus-tmp-from)
3485 (substring gnus-tmp-from
3486 (1+ (match-beginning 0)) (1- (match-end 0))))
3488 (when (string= gnus-tmp-name "")
3489 (setq gnus-tmp-name gnus-tmp-from))
3490 (unless (numberp gnus-tmp-lines)
3491 (setq gnus-tmp-lines 0))
3492 (gnus-put-text-property
3494 (progn (eval gnus-summary-line-format-spec) (point))
3495 'gnus-number number)
3498 (run-hooks 'gnus-summary-update-hook)
3501 (setq gnus-tmp-prev-subject subject)))
3503 (when (nth 1 thread)
3504 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3505 (incf gnus-tmp-level)
3506 (setq threads (if thread-end nil (cdar thread)))
3508 (setq gnus-tmp-level 0)))))
3509 (gnus-message 7 "Generating summary...done"))
3511 (defun gnus-summary-prepare-unthreaded (headers)
3512 "Generate an unthreaded summary buffer based on HEADERS."
3513 (let (header number mark)
3518 ;; We may have to root out some bad articles...
3519 (when (memq (setq number (mail-header-number
3520 (setq header (pop headers))))
3521 gnus-newsgroup-limit)
3522 ;; Mark article as read when it has a low score.
3523 (when (and gnus-summary-mark-below
3524 (< (or (cdr (assq number gnus-newsgroup-scored))
3525 gnus-summary-default-score 0)
3526 gnus-summary-mark-below)
3527 (not (gnus-summary-article-ancient-p number)))
3528 (setq gnus-newsgroup-unreads
3529 (delq number gnus-newsgroup-unreads))
3530 (if gnus-newsgroup-auto-expire
3531 (push number gnus-newsgroup-expirable)
3532 (push (cons number gnus-low-score-mark)
3533 gnus-newsgroup-reads)))
3535 (setq mark (gnus-article-mark number))
3536 (push (gnus-data-make number mark (1+ (point)) header 0)
3537 gnus-newsgroup-data)
3538 (gnus-summary-insert-line
3540 mark (memq number gnus-newsgroup-replied)
3541 (memq number gnus-newsgroup-expirable)
3542 (mail-header-subject header) nil
3543 (cdr (assq number gnus-newsgroup-scored))
3544 (memq number gnus-newsgroup-processable))))))
3546 (defun gnus-select-newsgroup (group &optional read-all)
3547 "Select newsgroup GROUP.
3548 If READ-ALL is non-nil, all articles in the group are selected."
3549 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3550 (info (nth 2 entry))
3551 articles fetched-articles cached)
3553 (unless (gnus-check-server
3554 (setq gnus-current-select-method
3555 (gnus-find-method-for-group group)))
3556 (error "Couldn't open server"))
3558 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3559 (gnus-activate-group group) ; Or we can activate it...
3560 (progn ; Or we bug out.
3561 (when (equal major-mode 'gnus-summary-mode)
3562 (kill-buffer (current-buffer)))
3563 (error "Couldn't request group %s: %s"
3564 group (gnus-status-message group))))
3566 (unless (gnus-request-group group t)
3567 (when (equal major-mode 'gnus-summary-mode)
3568 (kill-buffer (current-buffer)))
3569 (error "Couldn't request group %s: %s"
3570 group (gnus-status-message group)))
3572 (setq gnus-newsgroup-name group)
3573 (setq gnus-newsgroup-unselected nil)
3574 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3576 ;; Adjust and set lists of article marks.
3578 (gnus-adjust-marked-articles info))
3580 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3581 (when (gnus-virtual-group-p group)
3582 (setq cached gnus-newsgroup-cached))
3584 (setq gnus-newsgroup-unreads
3585 (gnus-set-difference
3586 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3587 gnus-newsgroup-dormant))
3589 (setq gnus-newsgroup-processable nil)
3591 (gnus-update-read-articles group gnus-newsgroup-unreads)
3592 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3593 (gnus-group-update-group group))
3595 (setq articles (gnus-articles-to-read group read-all))
3599 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3601 ((eq articles 0) nil)
3603 ;; Init the dependencies hash table.
3604 (setq gnus-newsgroup-dependencies
3605 (gnus-make-hashtable (length articles)))
3606 ;; Retrieve the headers and read them in.
3607 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3608 (setq gnus-newsgroup-headers
3610 (setq gnus-headers-retrieved-by
3611 (gnus-retrieve-headers
3612 articles gnus-newsgroup-name
3613 ;; We might want to fetch old headers, but
3614 ;; not if there is only 1 article.
3615 (and gnus-fetch-old-headers
3617 (not (eq gnus-fetch-old-headers 'some))
3618 (not (numberp gnus-fetch-old-headers)))
3619 (> (length articles) 1))))))
3620 (gnus-get-newsgroup-headers-xover
3621 articles nil nil gnus-newsgroup-name t)
3622 (gnus-get-newsgroup-headers)))
3623 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3625 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3627 (setq gnus-newsgroup-cached cached))
3629 ;; Suppress duplicates?
3630 (when gnus-suppress-duplicates
3631 (gnus-dup-suppress-articles))
3633 ;; Set the initial limit.
3634 (setq gnus-newsgroup-limit (copy-sequence articles))
3635 ;; Remove canceled articles from the list of unread articles.
3636 (setq gnus-newsgroup-unreads
3637 (gnus-set-sorted-intersection
3638 gnus-newsgroup-unreads
3639 (setq fetched-articles
3640 (mapcar (lambda (headers) (mail-header-number headers))
3641 gnus-newsgroup-headers))))
3642 ;; Removed marked articles that do not exist.
3643 (gnus-update-missing-marks
3644 (gnus-sorted-complement fetched-articles articles))
3645 ;; We might want to build some more threads first.
3646 (and gnus-fetch-old-headers
3647 (eq gnus-headers-retrieved-by 'nov)
3648 (gnus-build-old-threads))
3649 ;; Check whether auto-expire is to be done in this group.
3650 (setq gnus-newsgroup-auto-expire
3651 (gnus-group-auto-expirable-p group))
3652 ;; Set up the article buffer now, if necessary.
3653 (unless gnus-single-article-buffer
3654 (gnus-article-setup-buffer))
3655 ;; First and last article in this newsgroup.
3656 (when gnus-newsgroup-headers
3657 (setq gnus-newsgroup-begin
3658 (mail-header-number (car gnus-newsgroup-headers))
3661 (gnus-last-element gnus-newsgroup-headers))))
3662 ;; GROUP is successfully selected.
3663 (or gnus-newsgroup-headers t)))))
3665 (defun gnus-articles-to-read (group &optional read-all)
3666 ;; Find out what articles the user wants to read.
3668 ;; Select all articles if `read-all' is non-nil, or if there
3669 ;; are no unread articles.
3671 (and (zerop (length gnus-newsgroup-marked))
3672 (zerop (length gnus-newsgroup-unreads)))
3673 (eq (gnus-group-find-parameter group 'display)
3675 (gnus-uncompress-range (gnus-active group))
3676 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3677 (copy-sequence gnus-newsgroup-unreads))
3679 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3680 (scored (length scored-list))
3681 (number (length articles))
3682 (marked (+ (length gnus-newsgroup-marked)
3683 (length gnus-newsgroup-dormant)))
3691 ((and (or (<= scored marked) (= scored number))
3692 (numberp gnus-large-newsgroup)
3693 (> number gnus-large-newsgroup))
3697 "How many articles from %s (default %d): "
3698 (gnus-limit-string gnus-newsgroup-name 35)
3700 (if (string-match "^[ \t]*$" input) number input)))
3701 ((and (> scored marked) (< scored number)
3702 (> (- scored number) 20))
3705 (format "%s %s (%d scored, %d total): "
3706 "How many articles from"
3707 group scored number))))
3708 (if (string-match "^[ \t]*$" input)
3712 (setq select (if (stringp select) (string-to-number select) select))
3713 (if (or (null select) (zerop select))
3715 (if (and (not (zerop scored)) (<= (abs select) scored))
3717 (setq articles (sort scored-list '<))
3718 (setq number (length articles)))
3719 (setq articles (copy-sequence articles)))
3721 (when (< (abs select) number)
3723 ;; Select the N oldest articles.
3724 (setcdr (nthcdr (1- (abs select)) articles) nil)
3725 ;; Select the N most recent articles.
3726 (setq articles (nthcdr (- number select) articles))))
3727 (setq gnus-newsgroup-unselected
3728 (gnus-sorted-intersection
3729 gnus-newsgroup-unreads
3730 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3733 (defun gnus-killed-articles (killed articles)
3736 (when (inline (gnus-member-of-range (car articles) killed))
3737 (push (car articles) out))
3738 (setq articles (cdr articles)))
3741 (defun gnus-uncompress-marks (marks)
3742 "Uncompress the mark ranges in MARKS."
3743 (let ((uncompressed '(score bookmark))
3746 (if (memq (caar marks) uncompressed)
3747 (push (car marks) out)
3748 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3749 (setq marks (cdr marks)))
3752 (defun gnus-adjust-marked-articles (info)
3753 "Set all article lists and remove all marks that are no longer legal."
3754 (let* ((marked-lists (gnus-info-marks info))
3755 (active (gnus-active (gnus-info-group info)))
3758 (types gnus-article-mark-lists)
3759 (uncompressed '(score bookmark killed))
3760 marks var articles article mark)
3763 (setq marks (pop marked-lists))
3764 (set (setq var (intern (format "gnus-newsgroup-%s"
3765 (car (rassq (setq mark (car marks))
3767 (if (memq (car marks) uncompressed) (cdr marks)
3768 (gnus-uncompress-range (cdr marks))))
3770 (setq articles (symbol-value var))
3772 ;; All articles have to be subsets of the active articles.
3774 ;; Adjust "simple" lists.
3775 ((memq mark '(tick dormant expirable reply save))
3777 (when (or (< (setq article (pop articles)) min) (> article max))
3778 (set var (delq article (symbol-value var))))))
3780 ((memq mark uncompressed)
3782 (when (or (not (consp (setq article (pop articles))))
3783 (< (car article) min)
3784 (> (car article) max))
3785 (set var (delq article (symbol-value var))))))))))
3787 (defun gnus-update-missing-marks (missing)
3788 "Go through the list of MISSING articles and remove them mark lists."
3790 (let ((types gnus-article-mark-lists)
3792 ;; Go through all types.
3794 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3795 (when (symbol-value var)
3796 ;; This list has articles. So we delete all missing articles
3800 (set var (delq (pop m) (symbol-value var)))))))))
3802 (defun gnus-update-marks ()
3803 "Enter the various lists of marked articles into the newsgroup info list."
3804 (let ((types gnus-article-mark-lists)
3805 (info (gnus-get-info gnus-newsgroup-name))
3806 (uncompressed '(score bookmark killed))
3807 type list newmarked symbol)
3809 ;; Add all marks lists that are non-nil to the list of marks lists.
3811 (setq type (pop types))
3812 (when (setq list (symbol-value
3814 (intern (format "gnus-newsgroup-%s"
3816 (push (cons (cdr type)
3817 (if (memq (cdr type) uncompressed) list
3818 (gnus-compress-sequence
3819 (set symbol (sort list '<)) t)))
3822 ;; Enter these new marks into the info of the group.
3824 (setcar (nthcdr 3 info) newmarked)
3825 ;; Add the marks lists to the end of the info.
3827 (setcdr (nthcdr 2 info) (list newmarked))))
3829 ;; Cut off the end of the info if there's nothing else there.
3833 (when (nthcdr (decf i) info)
3834 (setcdr (nthcdr i info) nil)))))))
3836 (defun gnus-set-mode-line (where)
3837 "This function sets the mode line of the article or summary buffers.
3838 If WHERE is `summary', the summary mode line format will be used."
3839 ;; Is this mode line one we keep updated?
3840 (when (memq where gnus-updated-mode-lines)
3843 ;; We evaluate this in the summary buffer since these
3844 ;; variables are buffer-local to that buffer.
3845 (set-buffer gnus-summary-buffer)
3846 ;; We bind all these variables that are used in the `eval' form
3848 (let* ((mformat (symbol-value
3850 (format "gnus-%s-mode-line-format-spec" where))))
3851 (gnus-tmp-group-name gnus-newsgroup-name)
3852 (gnus-tmp-article-number (or gnus-current-article 0))
3853 (gnus-tmp-unread gnus-newsgroup-unreads)
3854 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3855 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3856 (gnus-tmp-unread-and-unselected
3857 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3858 (zerop gnus-tmp-unselected))
3860 ((zerop gnus-tmp-unselected)
3861 (format "{%d more}" gnus-tmp-unread-and-unticked))
3862 (t (format "{%d(+%d) more}"
3863 gnus-tmp-unread-and-unticked
3864 gnus-tmp-unselected))))
3866 (if (and gnus-current-headers
3867 (vectorp gnus-current-headers))
3868 (gnus-mode-string-quote
3869 (mail-header-subject gnus-current-headers))
3872 gnus-tmp-header);; passed as argument to any user-format-funcs
3873 (setq mode-string (eval mformat))
3874 (setq max-len (max 4 (if gnus-mode-non-string-length
3876 gnus-mode-non-string-length)
3877 (length mode-string))))
3878 ;; We might have to chop a bit of the string off...
3879 (when (> (length mode-string) max-len)
3881 (concat (gnus-truncate-string mode-string (- max-len 3))
3883 ;; Pad the mode string a bit.
3884 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3885 ;; Update the mode line.
3886 (setq mode-line-buffer-identification
3887 (gnus-mode-line-buffer-identification (list mode-string)))
3888 (set-buffer-modified-p t))))
3890 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3891 "Go through the HEADERS list and add all Xrefs to a hash table.
3892 The resulting hash table is returned, or nil if no Xrefs were found."
3893 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3894 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3895 (xref-hashtb (gnus-make-hashtable))
3896 start group entry number xrefs header)
3898 (setq header (pop headers))
3899 (when (and (setq xrefs (mail-header-xref header))
3900 (not (memq (setq number (mail-header-number header))
3903 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
3904 (setq start (match-end 0))
3905 (setq group (if prefix
3906 (concat prefix (substring xrefs (match-beginning 1)
3908 (substring xrefs (match-beginning 1) (match-end 1))))
3910 (string-to-int (substring xrefs (match-beginning 2)
3912 (if (setq entry (gnus-gethash group xref-hashtb))
3913 (setcdr entry (cons number (cdr entry)))
3914 (gnus-sethash group (cons number nil) xref-hashtb)))))
3915 (and start xref-hashtb)))
3917 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
3918 "Look through all the headers and mark the Xrefs as read."
3919 (let ((virtual (gnus-virtual-group-p from-newsgroup))
3920 name entry info xref-hashtb idlist method nth4)
3922 (set-buffer gnus-group-buffer)
3923 (when (setq xref-hashtb
3924 (gnus-create-xref-hashtb from-newsgroup headers unreads))
3927 (unless (string= from-newsgroup (setq name (symbol-name group)))
3928 (setq idlist (symbol-value group))
3929 ;; Dead groups are not updated.
3931 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
3933 (when (stringp (setq nth4 (gnus-info-method info)))
3934 (setq nth4 (gnus-server-to-method nth4))))
3935 ;; Only do the xrefs if the group has the same
3936 ;; select method as the group we have just read.
3937 (or (gnus-methods-equal-p
3938 nth4 (gnus-find-method-for-group from-newsgroup))
3940 (equal nth4 (setq method (gnus-find-method-for-group
3942 (and (equal (car nth4) (car method))
3943 (equal (nth 1 nth4) (nth 1 method))))
3944 gnus-use-cross-reference
3945 (or (not (eq gnus-use-cross-reference t))
3947 ;; Only do cross-references on subscribed
3948 ;; groups, if that is what is wanted.
3949 (<= (gnus-info-level info) gnus-level-subscribed))
3950 (gnus-group-make-articles-read name idlist))))
3953 (defun gnus-group-make-articles-read (group articles)
3954 "Update the info of GROUP to say that only ARTICLES are unread."
3956 (entry (gnus-gethash group gnus-newsrc-hashtb))
3957 (info (nth 2 entry))
3958 (active (gnus-active group))
3960 ;; First peel off all illegal article numbers.
3962 (let ((ids articles)
3964 (while (setq id (pop ids))
3965 (when (and first (> id (cdr active)))
3966 ;; We'll end up in this situation in one particular
3967 ;; obscure situation. If you re-scan a group and get
3968 ;; a new article that is cross-posted to a different
3969 ;; group that has not been re-scanned, you might get
3970 ;; crossposted article that has a higher number than
3971 ;; Gnus believes possible. So we re-activate this
3972 ;; group as well. This might mean doing the
3973 ;; crossposting thingy will *increase* the number
3974 ;; of articles in some groups. Tsk, tsk.
3975 (setq active (or (gnus-activate-group group) active)))
3976 (when (or (> id (cdr active))
3977 (< id (car active)))
3978 (setq articles (delq id articles))))))
3980 (set-buffer gnus-group-buffer)
3983 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
3984 (gnus-info-set-read ',info ',(gnus-info-read info))
3985 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
3986 (gnus-group-update-group ,group t))))
3987 ;; If the read list is nil, we init it.
3989 (null (gnus-info-read info))
3991 (gnus-info-set-read info (cons 1 (1- (car active)))))
3992 ;; Then we add the read articles to the range.
3997 (gnus-info-read info) (setq articles (sort articles '<)))))
3998 ;; Then we have to re-compute how many unread
3999 ;; articles there are in this group.
4003 (setq num (- (1+ (cdr active)) (car active))))
4004 ((not (listp (cdr range)))
4005 (setq num (- (cdr active) (- (1+ (cdr range))
4009 (if (numberp (car range))
4011 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4012 (setq range (cdr range)))
4013 (setq num (- (cdr active) num))))
4014 ;; Update the number of unread articles.
4016 ;; Update the group buffer.
4017 (gnus-group-update-group group t))))
4019 (defun gnus-methods-equal-p (m1 m2)
4020 (let ((m1 (or m1 gnus-select-method))
4021 (m2 (or m2 gnus-select-method)))
4023 (and (eq (car m1) (car m2))
4024 (or (not (memq 'address (assoc (symbol-name (car m1))
4025 gnus-valid-select-methods)))
4026 (equal (nth 1 m1) (nth 1 m2)))))))
4028 (defvar gnus-newsgroup-none-id 0)
4030 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4031 (let ((cur nntp-server-buffer)
4034 (save-excursion (set-buffer gnus-summary-buffer)
4035 gnus-newsgroup-dependencies)))
4036 headers id id-dep ref-dep end ref)
4038 (set-buffer nntp-server-buffer)
4039 ;; Translate all TAB characters into SPACE characters.
4040 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4041 (run-hooks 'gnus-parse-headers-hook)
4042 (let ((case-fold-search t)
4043 in-reply-to header p lines)
4044 (goto-char (point-min))
4045 ;; Search to the beginning of the next header. Error messages
4046 ;; do not begin with 2 or 3.
4047 (while (re-search-forward "^[23][0-9]+ " nil t)
4050 ;; This implementation of this function, with nine
4051 ;; search-forwards instead of the one re-search-forward and
4052 ;; a case (which basically was the old function) is actually
4053 ;; about twice as fast, even though it looks messier. You
4054 ;; can't have everything, I guess. Speed and elegance
4055 ;; doesn't always go hand in hand.
4064 (narrow-to-region (point)
4065 (or (and (search-forward "\n.\n" nil t)
4071 (if (search-forward "\nsubject: " nil t)
4072 (nnheader-header-value) "(none)"))
4076 (if (search-forward "\nfrom: " nil t)
4077 (nnheader-header-value) "(nobody)"))
4081 (if (search-forward "\ndate: " nil t)
4082 (nnheader-header-value) ""))
4086 (setq id (if (search-forward "\nmessage-id: " nil t)
4087 (nnheader-header-value)
4088 ;; If there was no message-id, we just fake one
4089 ;; to make subsequent routines simpler.
4090 (nnheader-generate-fake-message-id))))
4094 (if (search-forward "\nreferences: " nil t)
4098 (nnheader-header-value)
4103 (search-backward ">" end t)
4106 (search-backward "<" end t)
4108 ;; Get the references from the in-reply-to header if there
4109 ;; were no references and the in-reply-to header looks
4111 (if (and (search-forward "\nin-reply-to: " nil t)
4112 (setq in-reply-to (nnheader-header-value))
4113 (string-match "<[^>]+>" in-reply-to))
4114 (setq ref (substring in-reply-to (match-beginning 0)
4122 (if (search-forward "\nlines: " nil t)
4123 (if (numberp (setq lines (read cur)))
4129 (and (search-forward "\nxref: " nil t)
4130 (nnheader-header-value)))))
4131 (when (equal id ref)
4133 ;; We do the threading while we read the headers. The
4134 ;; message-id and the last reference are both entered into
4135 ;; the same hash table. Some tippy-toeing around has to be
4136 ;; done in case an article has arrived before the article
4137 ;; which it refers to.
4138 (if (boundp (setq id-dep (intern id dependencies)))
4139 (if (and (car (symbol-value id-dep))
4141 ;; An article with this Message-ID has already
4142 ;; been seen, so we ignore this one, except we add
4143 ;; any additional Xrefs (in case the two articles
4144 ;; came from different servers).
4146 (mail-header-set-xref
4147 (car (symbol-value id-dep))
4148 (concat (or (mail-header-xref
4149 (car (symbol-value id-dep)))
4151 (or (mail-header-xref header) "")))
4153 (setcar (symbol-value id-dep) header))
4154 (set id-dep (list header)))
4156 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4157 (setcdr (symbol-value ref-dep)
4158 (nconc (cdr (symbol-value ref-dep))
4159 (list (symbol-value id-dep))))
4160 (set ref-dep (list nil (symbol-value id-dep))))
4161 (push header headers))
4162 (goto-char (point-max))
4164 (nreverse headers)))))
4166 ;; The following macros and functions were written by Felix Lee
4167 ;; <flee@cse.psu.edu>.
4169 (defmacro gnus-nov-read-integer ()
4171 (if (= (following-char) ?\t)
4173 (let ((num (ignore-errors (read buffer))))
4174 (if (numberp num) num 0)))
4178 (defmacro gnus-nov-skip-field ()
4179 '(search-forward "\t" eol 'move))
4181 (defmacro gnus-nov-field ()
4182 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4184 ;; (defvar gnus-nov-none-counter 0)
4186 ;; This function has to be called with point after the article number
4187 ;; on the beginning of the line.
4188 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4189 (let ((eol (gnus-point-at-eol))
4190 (buffer (current-buffer))
4191 header ref id id-dep ref-dep)
4193 ;; overview: [num subject from date id refs chars lines misc]
4196 (narrow-to-region (point) eol)
4203 (gnus-nov-field) ; subject
4204 (gnus-nov-field) ; from
4205 (gnus-nov-field) ; date
4206 (setq id (or (gnus-nov-field)
4207 (nnheader-generate-fake-message-id))) ; id
4209 (let ((beg (point)))
4210 (search-forward "\t" eol)
4211 (if (search-backward ">" beg t)
4215 (search-backward "<" beg t)))
4218 (gnus-nov-field)) ; refs
4219 (gnus-nov-read-integer) ; chars
4220 (gnus-nov-read-integer) ; lines
4221 (if (= (following-char) ?\n)
4223 (gnus-nov-field)) ; misc
4228 ;; We build the thread tree.
4229 (when (equal id ref)
4230 ;; This article refers back to itself. Naughty, naughty.
4232 (if (boundp (setq id-dep (intern id dependencies)))
4233 (if (and (car (symbol-value id-dep))
4235 ;; An article with this Message-ID has already been seen,
4236 ;; so we ignore this one, except we add any additional
4237 ;; Xrefs (in case the two articles came from different
4240 (mail-header-set-xref
4241 (car (symbol-value id-dep))
4242 (concat (or (mail-header-xref
4243 (car (symbol-value id-dep)))
4245 (or (mail-header-xref header) "")))
4247 (setcar (symbol-value id-dep) header))
4248 (set id-dep (list header)))
4250 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4251 (setcdr (symbol-value ref-dep)
4252 (nconc (cdr (symbol-value ref-dep))
4253 (list (symbol-value id-dep))))
4254 (set ref-dep (list nil (symbol-value id-dep)))))
4257 ;; Goes through the xover lines and returns a list of vectors
4258 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4259 force-new dependencies
4260 group also-fetch-heads)
4261 "Parse the news overview data in the server buffer, and return a
4262 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4263 ;; Get the Xref when the users reads the articles since most/some
4264 ;; NNTP servers do not include Xrefs when using XOVER.
4265 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4266 (let ((cur nntp-server-buffer)
4267 (dependencies (or dependencies gnus-newsgroup-dependencies))
4268 number headers header)
4270 (set-buffer nntp-server-buffer)
4271 ;; Allow the user to mangle the headers before parsing them.
4272 (run-hooks 'gnus-parse-headers-hook)
4273 (goto-char (point-min))
4276 (while (and sequence (not (eobp)))
4277 (setq number (read cur))
4278 (while (and sequence
4279 (< (car sequence) number))
4280 (setq sequence (cdr sequence)))
4282 (eq number (car sequence))
4284 (setq sequence (cdr sequence))
4285 (setq header (inline
4286 (gnus-nov-parse-line
4287 number dependencies force-new))))
4288 (push header headers))
4291 (gnus-error 4 "Strange nov line (%d)"
4292 (count-lines (point-min) (point)))))
4294 ;; A common bug in inn is that if you have posted an article and
4295 ;; then retrieves the active file, it will answer correctly --
4296 ;; the new article is included. However, a NOV entry for the
4297 ;; article may not have been generated yet, so this may fail.
4298 ;; We work around this problem by retrieving the last few
4299 ;; headers using HEAD.
4300 (if (or (not also-fetch-heads)
4303 (let ((gnus-nov-is-evil t)
4304 (nntp-nov-is-evil t))
4307 (when (gnus-retrieve-headers sequence group)
4308 (gnus-get-newsgroup-headers))))))))
4310 (defun gnus-article-get-xrefs ()
4311 "Fill in the Xref value in `gnus-current-headers', if necessary.
4312 This is meant to be called in `gnus-article-internal-prepare-hook'."
4313 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4314 gnus-current-headers)))
4315 (or (not gnus-use-cross-reference)
4317 (and (mail-header-xref headers)
4318 (not (string= (mail-header-xref headers) "")))
4319 (let ((case-fold-search t)
4322 (nnheader-narrow-to-headers)
4323 (goto-char (point-min))
4324 (when (or (and (eq (downcase (following-char)) ?x)
4325 (looking-at "Xref:"))
4326 (search-forward "\nXref:" nil t))
4327 (goto-char (1+ (match-end 0)))
4328 (setq xref (buffer-substring (point)
4329 (progn (end-of-line) (point))))
4330 (mail-header-set-xref headers xref)))))))
4332 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4333 "Find article ID and insert the summary line for that article."
4334 (let ((header (if (and old-header use-old-header)
4335 old-header (gnus-read-header id)))
4336 (number (and (numberp id) id))
4339 ;; Rebuild the thread that this article is part of and go to the
4340 ;; article we have fetched.
4341 (when (and (not gnus-show-threads)
4343 (when (setq d (gnus-data-find (mail-header-number old-header)))
4344 (goto-char (gnus-data-pos d))
4347 (- (gnus-point-at-bol)
4349 (1+ (gnus-point-at-eol))
4350 (gnus-delete-line))))))
4352 (mail-header-set-number header (mail-header-number old-header)))
4353 (setq gnus-newsgroup-sparse
4354 (delq (setq number (mail-header-number header))
4355 gnus-newsgroup-sparse))
4356 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4357 (gnus-rebuild-thread (mail-header-id header))
4358 (gnus-summary-goto-subject number nil t))
4359 (when (and (numberp number)
4361 ;; We have to update the boundaries even if we can't fetch the
4362 ;; article if ID is a number -- so that the next `P' or `N'
4363 ;; command will fetch the previous (or next) article even
4364 ;; if the one we tried to fetch this time has been canceled.
4365 (when (> number gnus-newsgroup-end)
4366 (setq gnus-newsgroup-end number))
4367 (when (< number gnus-newsgroup-begin)
4368 (setq gnus-newsgroup-begin number))
4369 (setq gnus-newsgroup-unselected
4370 (delq number gnus-newsgroup-unselected)))
4371 ;; Report back a success?
4372 (and header (mail-header-number header))))
4374 ;;; Process/prefix in the summary buffer
4376 (defun gnus-summary-work-articles (n)
4377 "Return a list of articles to be worked upon. The prefix argument,
4378 the list of process marked articles, and the current article will be
4379 taken into consideration."
4382 ;; A numerical prefix has been given.
4383 (setq n (prefix-numeric-value n))
4384 (let ((backward (< n 0))
4385 (n (abs (prefix-numeric-value n)))
4390 (push (setq article (gnus-summary-article-number))
4393 (gnus-summary-find-prev nil article)
4394 (gnus-summary-find-next nil article)))
4396 (nreverse articles)))
4397 ((gnus-region-active-p)
4398 ;; Work on the region between point and mark.
4399 (let ((max (max (point) (mark)))
4402 (goto-char (min (point) (mark)))
4405 (push (setq article (gnus-summary-article-number)) articles)
4406 (gnus-summary-find-next nil article)
4408 (nreverse articles))))
4409 (gnus-newsgroup-processable
4410 ;; There are process-marked articles present.
4411 ;; Save current state.
4412 (gnus-summary-save-process-mark)
4414 (reverse gnus-newsgroup-processable))
4416 ;; Just return the current article.
4417 (list (gnus-summary-article-number)))))
4419 (defun gnus-summary-save-process-mark ()
4420 "Push the current set of process marked articles on the stack."
4422 (push (copy-sequence gnus-newsgroup-processable)
4423 gnus-newsgroup-process-stack))
4425 (defun gnus-summary-kill-process-mark ()
4426 "Push the current set of process marked articles on the stack and unmark."
4428 (gnus-summary-save-process-mark)
4429 (gnus-summary-unmark-all-processable))
4431 (defun gnus-summary-yank-process-mark ()
4432 "Pop the last process mark state off the stack and restore it."
4434 (unless gnus-newsgroup-process-stack
4435 (error "Empty mark stack"))
4436 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4438 (defun gnus-summary-process-mark-set (set)
4439 "Make SET into the current process marked articles."
4440 (gnus-summary-unmark-all-processable)
4442 (gnus-summary-set-process-mark (pop set))))
4444 ;;; Searching and stuff
4446 (defun gnus-summary-search-group (&optional backward use-level)
4447 "Search for next unread newsgroup.
4448 If optional argument BACKWARD is non-nil, search backward instead."
4450 (set-buffer gnus-group-buffer)
4451 (when (gnus-group-search-forward
4452 backward nil (if use-level (gnus-group-group-level) nil))
4453 (gnus-group-group-name))))
4455 (defun gnus-summary-best-group (&optional exclude-group)
4456 "Find the name of the best unread group.
4457 If EXCLUDE-GROUP, do not go to this group."
4459 (set-buffer gnus-group-buffer)
4461 (gnus-group-best-unread-group exclude-group))))
4463 (defun gnus-summary-find-next (&optional unread article backward)
4464 (if backward (gnus-summary-find-prev)
4465 (let* ((dummy (gnus-summary-article-intangible-p))
4466 (article (or article (gnus-summary-article-number)))
4467 (arts (gnus-data-find-list article))
4469 (when (and (not dummy)
4470 (or (not gnus-summary-check-current)
4472 (not (gnus-data-unread-p (car arts)))))
4473 (setq arts (cdr arts)))
4478 (when (gnus-data-unread-p (car arts))
4479 (setq result (car arts)
4481 (setq arts (cdr arts)))
4484 (goto-char (gnus-data-pos result))
4485 (gnus-data-number result)))))
4487 (defun gnus-summary-find-prev (&optional unread article)
4488 (let* ((eobp (eobp))
4489 (article (or article (gnus-summary-article-number)))
4490 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4492 (when (and (not eobp)
4493 (or (not gnus-summary-check-current)
4495 (not (gnus-data-unread-p (car arts)))))
4496 (setq arts (cdr arts)))
4501 (when (gnus-data-unread-p (car arts))
4502 (setq result (car arts)
4504 (setq arts (cdr arts)))
4507 (goto-char (gnus-data-pos result))
4508 (gnus-data-number result))))
4510 (defun gnus-summary-find-subject (subject &optional unread backward article)
4511 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4512 (article (or article (gnus-summary-article-number)))
4513 (articles (gnus-data-list backward))
4514 (arts (gnus-data-find-list article articles))
4516 (when (or (not gnus-summary-check-current)
4518 (not (gnus-data-unread-p (car arts))))
4519 (setq arts (cdr arts)))
4521 (and (or (not unread)
4522 (gnus-data-unread-p (car arts)))
4523 (vectorp (gnus-data-header (car arts)))
4525 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4526 (setq result (car arts)
4528 (setq arts (cdr arts)))
4530 (goto-char (gnus-data-pos result))
4531 (gnus-data-number result))))
4533 (defun gnus-summary-search-forward (&optional unread subject backward)
4534 "Search forward for an article.
4535 If UNREAD, look for unread articles. If SUBJECT, look for
4536 articles with that subject. If BACKWARD, search backward instead."
4537 (cond (subject (gnus-summary-find-subject subject unread backward))
4538 (backward (gnus-summary-find-prev unread))
4539 (t (gnus-summary-find-next unread))))
4541 (defun gnus-recenter (&optional n)
4542 "Center point in window and redisplay frame.
4543 Also do horizontal recentering."
4545 (when (and gnus-auto-center-summary
4546 (not (eq gnus-auto-center-summary 'vertical)))
4547 (gnus-horizontal-recenter))
4550 (defun gnus-summary-recenter ()
4551 "Center point in the summary window.
4552 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4553 displayed, no centering will be performed."
4554 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4555 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4556 (let* ((top (cond ((< (window-height) 4) 0)
4557 ((< (window-height) 7) 1)
4559 (height (1- (window-height)))
4560 (bottom (save-excursion (goto-char (point-max))
4561 (forward-line (- height))
4563 (window (get-buffer-window (current-buffer))))
4564 ;; The user has to want it.
4565 (when gnus-auto-center-summary
4566 (when (get-buffer-window gnus-article-buffer)
4567 ;; Only do recentering when the article buffer is displayed,
4568 ;; Set the window start to either `bottom', which is the biggest
4569 ;; possible valid number, or the second line from the top,
4570 ;; whichever is the least.
4572 window (min bottom (save-excursion
4573 (forward-line (- top)) (point)))))
4574 ;; Do horizontal recentering while we're at it.
4575 (when (and (get-buffer-window (current-buffer) t)
4576 (not (eq gnus-auto-center-summary 'vertical)))
4577 (let ((selected (selected-window)))
4578 (select-window (get-buffer-window (current-buffer) t))
4579 (gnus-summary-position-point)
4580 (gnus-horizontal-recenter)
4581 (select-window selected))))))
4583 (defun gnus-summary-jump-to-group (newsgroup)
4584 "Move point to NEWSGROUP in group mode buffer."
4585 ;; Keep update point of group mode buffer if visible.
4586 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4587 (save-window-excursion
4588 ;; Take care of tree window mode.
4589 (when (get-buffer-window gnus-group-buffer)
4590 (pop-to-buffer gnus-group-buffer))
4591 (gnus-group-jump-to-group newsgroup))
4593 ;; Take care of tree window mode.
4594 (if (get-buffer-window gnus-group-buffer)
4595 (pop-to-buffer gnus-group-buffer)
4596 (set-buffer gnus-group-buffer))
4597 (gnus-group-jump-to-group newsgroup))))
4599 ;; This function returns a list of article numbers based on the
4600 ;; difference between the ranges of read articles in this group and
4601 ;; the range of active articles.
4602 (defun gnus-list-of-unread-articles (group)
4603 (let* ((read (gnus-info-read (gnus-get-info group)))
4604 (active (or (gnus-active group) (gnus-activate-group group)))
4607 ;; If none are read, then all are unread.
4609 (setq first (car active))
4610 ;; If the range of read articles is a single range, then the
4611 ;; first unread article is the article after the last read
4612 ;; article. Sounds logical, doesn't it?
4613 (if (not (listp (cdr read)))
4614 (setq first (1+ (cdr read)))
4615 ;; `read' is a list of ranges.
4616 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4622 (while (< first nlast)
4624 (setq first (1+ first))))
4625 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4626 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4627 (setq read (cdr read)))))
4628 ;; And add the last unread articles.
4629 (while (<= first last)
4631 (setq first (1+ first)))
4632 ;; Return the list of unread articles.
4635 (defun gnus-list-of-read-articles (group)
4636 "Return a list of unread, unticked and non-dormant articles."
4637 (let* ((info (gnus-get-info group))
4638 (marked (gnus-info-marks info))
4639 (active (gnus-active group)))
4641 (gnus-set-difference
4642 (gnus-sorted-complement
4643 (gnus-uncompress-range active)
4644 (gnus-list-of-unread-articles group))
4646 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4647 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4649 ;; Various summary commands
4651 (defun gnus-summary-universal-argument (arg)
4652 "Perform any operation on all articles that are process/prefixed."
4654 (gnus-set-global-variables)
4655 (let ((articles (gnus-summary-work-articles arg))
4662 (substitute-command-keys
4663 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4666 (gnus-error 1 "Undefined key")
4669 (gnus-summary-goto-subject (setq article (pop articles)))
4670 (let (gnus-newsgroup-processable)
4671 (command-execute func))
4672 (gnus-summary-remove-process-mark article)))))
4673 (gnus-summary-position-point))
4675 (defun gnus-summary-toggle-truncation (&optional arg)
4676 "Toggle truncation of summary lines.
4677 With arg, turn line truncation on iff arg is positive."
4679 (setq truncate-lines
4680 (if (null arg) (not truncate-lines)
4681 (> (prefix-numeric-value arg) 0)))
4684 (defun gnus-summary-reselect-current-group (&optional all rescan)
4685 "Exit and then reselect the current newsgroup.
4686 The prefix argument ALL means to select all articles."
4688 (gnus-set-global-variables)
4689 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4690 (error "Ephemeral groups can't be reselected"))
4691 (let ((current-subject (gnus-summary-article-number))
4692 (group gnus-newsgroup-name))
4693 (setq gnus-newsgroup-begin nil)
4695 ;; We have to adjust the point of group mode buffer because
4696 ;; point was moved to the next unread newsgroup by exiting.
4697 (gnus-summary-jump-to-group group)
4700 (gnus-group-get-new-news-this-group 1)))
4701 (gnus-group-read-group all t)
4702 (gnus-summary-goto-subject current-subject nil t)))
4704 (defun gnus-summary-rescan-group (&optional all)
4705 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4707 (gnus-summary-reselect-current-group all t))
4709 (defun gnus-summary-update-info (&optional non-destructive)
4711 (let ((group gnus-newsgroup-name))
4712 (when gnus-newsgroup-kill-headers
4713 (setq gnus-newsgroup-killed
4714 (gnus-compress-sequence
4716 (gnus-set-sorted-intersection
4717 (gnus-uncompress-range gnus-newsgroup-killed)
4718 (setq gnus-newsgroup-unselected
4719 (sort gnus-newsgroup-unselected '<)))
4720 (setq gnus-newsgroup-unreads
4721 (sort gnus-newsgroup-unreads '<)))
4723 (unless (listp (cdr gnus-newsgroup-killed))
4724 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4725 (let ((headers gnus-newsgroup-headers))
4726 (when (and (not gnus-save-score)
4727 (not non-destructive))
4728 (setq gnus-newsgroup-scored nil))
4729 ;; Set the new ranges of read articles.
4730 (gnus-update-read-articles
4731 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4732 ;; Set the current article marks.
4734 ;; Do the cross-ref thing.
4735 (when gnus-use-cross-reference
4736 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4737 ;; Do adaptive scoring, and possibly save score files.
4738 (when gnus-newsgroup-adaptive
4739 (gnus-score-adaptive))
4740 (when gnus-use-scoring
4742 ;; Do not switch windows but change the buffer to work.
4743 (set-buffer gnus-group-buffer)
4744 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4745 (gnus-group-update-group group))))))
4747 (defun gnus-summary-save-newsrc (&optional force)
4748 "Save the current number of read/marked articles in the dribble buffer.
4749 The dribble buffer will then be saved.
4750 If FORCE (the prefix), also save the .newsrc file(s)."
4752 (gnus-summary-update-info t)
4754 (gnus-save-newsrc-file)
4755 (gnus-dribble-save)))
4757 (defun gnus-summary-exit (&optional temporary)
4758 "Exit reading current newsgroup, and then return to group selection mode.
4759 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4761 (gnus-set-global-variables)
4762 (gnus-kill-save-kill-buffer)
4763 (let* ((group gnus-newsgroup-name)
4764 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4766 (buf (current-buffer)))
4767 (run-hooks 'gnus-summary-prepare-exit-hook)
4768 ;; If we have several article buffers, we kill them at exit.
4769 (unless gnus-single-article-buffer
4770 (gnus-kill-buffer gnus-original-article-buffer)
4771 (setq gnus-article-current nil))
4772 (when gnus-use-cache
4773 (gnus-cache-possibly-remove-articles)
4774 (gnus-cache-save-buffers))
4775 (gnus-async-prefetch-remove-group group)
4776 (when gnus-suppress-duplicates
4777 (gnus-dup-enter-articles))
4778 (when gnus-use-trees
4779 (gnus-tree-close group))
4780 ;; Make all changes in this group permanent.
4782 (run-hooks 'gnus-exit-group-hook)
4783 (gnus-summary-update-info))
4784 (gnus-close-group group)
4785 ;; Make sure where I was, and go to next newsgroup.
4786 (set-buffer gnus-group-buffer)
4788 (gnus-group-jump-to-group group))
4789 (run-hooks 'gnus-summary-exit-hook)
4791 (gnus-group-next-unread-group 1))
4794 ;; If we have several article buffers, we kill them at exit.
4795 (unless gnus-single-article-buffer
4796 (gnus-kill-buffer gnus-article-buffer)
4797 (gnus-kill-buffer gnus-original-article-buffer)
4798 (setq gnus-article-current nil))
4800 (if (not gnus-kill-summary-on-exit)
4801 (gnus-deaden-summary)
4802 ;; We set all buffer-local variables to nil. It is unclear why
4803 ;; this is needed, but if we don't, buffer-local variables are
4804 ;; not garbage-collected, it seems. This would the lead to en
4805 ;; ever-growing Emacs.
4806 (gnus-summary-clear-local-variables)
4807 (when (get-buffer gnus-article-buffer)
4808 (bury-buffer gnus-article-buffer))
4809 ;; We clear the global counterparts of the buffer-local
4810 ;; variables as well, just to be on the safe side.
4811 (set-buffer gnus-group-buffer)
4812 (gnus-summary-clear-local-variables)
4813 ;; Return to group mode buffer.
4814 (when (eq mode 'gnus-summary-mode)
4815 (gnus-kill-buffer buf)))
4816 (setq gnus-current-select-method gnus-select-method)
4817 (pop-to-buffer gnus-group-buffer)
4818 ;; Clear the current group name.
4819 (if (not quit-config)
4821 (gnus-group-jump-to-group group)
4822 (gnus-group-next-unread-group 1)
4823 (gnus-configure-windows 'group 'force))
4824 (gnus-handle-ephemeral-exit quit-config))
4826 (setq gnus-newsgroup-name nil)))))
4828 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4829 (defun gnus-summary-exit-no-update (&optional no-questions)
4830 "Quit reading current newsgroup without updating read article info."
4832 (gnus-set-global-variables)
4833 (let* ((group gnus-newsgroup-name)
4834 (quit-config (gnus-group-quit-config group)))
4835 (when (or no-questions
4837 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4838 ;; If we have several article buffers, we kill them at exit.
4839 (unless gnus-single-article-buffer
4840 (gnus-kill-buffer gnus-article-buffer)
4841 (gnus-kill-buffer gnus-original-article-buffer)
4842 (setq gnus-article-current nil))
4843 (if (not gnus-kill-summary-on-exit)
4844 (gnus-deaden-summary)
4845 (gnus-close-group group)
4846 (gnus-summary-clear-local-variables)
4847 (set-buffer gnus-group-buffer)
4848 (gnus-summary-clear-local-variables)
4849 (when (get-buffer gnus-summary-buffer)
4850 (kill-buffer gnus-summary-buffer)))
4851 (unless gnus-single-article-buffer
4852 (setq gnus-article-current nil))
4853 (when gnus-use-trees
4854 (gnus-tree-close group))
4855 (gnus-async-prefetch-remove-group group)
4856 (when (get-buffer gnus-article-buffer)
4857 (bury-buffer gnus-article-buffer))
4858 ;; Return to the group buffer.
4859 (gnus-configure-windows 'group 'force)
4860 ;; Clear the current group name.
4861 (setq gnus-newsgroup-name nil)
4862 (when (equal (gnus-group-group-name) group)
4863 (gnus-group-next-unread-group 1))
4865 (gnus-handle-ephemeral-exit quit-config)))))
4867 (defun gnus-handle-ephemeral-exit (quit-config)
4868 "Handle movement when leaving an ephemeral group. The state
4869 which existed when entering the ephemeral is reset."
4870 (if (not (buffer-name (car quit-config)))
4871 (gnus-configure-windows 'group 'force)
4872 (set-buffer (car quit-config))
4873 (cond ((eq major-mode 'gnus-summary-mode)
4874 (gnus-set-global-variables))
4875 ((eq major-mode 'gnus-article-mode)
4877 ;; The `gnus-summary-buffer' variable may point
4878 ;; to the old summary buffer when using a single
4880 (unless (gnus-buffer-live-p gnus-summary-buffer)
4881 (set-buffer gnus-group-buffer))
4882 (set-buffer gnus-summary-buffer)
4883 (gnus-set-global-variables))))
4884 (if (or (eq (cdr quit-config) 'article)
4885 (eq (cdr quit-config) 'pick))
4887 ;; The current article may be from the ephemeral group
4888 ;; thus it is best that we reload this article
4889 (gnus-summary-show-article)
4890 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4891 (gnus-configure-windows 'pick 'force)
4892 (gnus-configure-windows (cdr quit-config) 'force)))
4893 (gnus-configure-windows (cdr quit-config) 'force))
4894 (when (eq major-mode 'gnus-summary-mode)
4895 (gnus-summary-next-subject 1 nil t)
4896 (gnus-summary-recenter)
4897 (gnus-summary-position-point))))
4901 (defvar gnus-dead-summary-mode-map nil)
4903 (unless gnus-dead-summary-mode-map
4904 (setq gnus-dead-summary-mode-map (make-keymap))
4905 (suppress-keymap gnus-dead-summary-mode-map)
4906 (substitute-key-definition
4907 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
4908 (let ((keys '("\C-d" "\r" "\177")))
4910 (define-key gnus-dead-summary-mode-map
4911 (pop keys) 'gnus-summary-wake-up-the-dead))))
4913 (defvar gnus-dead-summary-mode nil
4914 "Minor mode for Gnus summary buffers.")
4916 (defun gnus-dead-summary-mode (&optional arg)
4917 "Minor mode for Gnus summary buffers."
4919 (when (eq major-mode 'gnus-summary-mode)
4920 (make-local-variable 'gnus-dead-summary-mode)
4921 (setq gnus-dead-summary-mode
4922 (if (null arg) (not gnus-dead-summary-mode)
4923 (> (prefix-numeric-value arg) 0)))
4924 (when gnus-dead-summary-mode
4925 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
4926 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
4927 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
4928 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
4929 minor-mode-map-alist)))))
4931 (defun gnus-deaden-summary ()
4932 "Make the current summary buffer into a dead summary buffer."
4933 ;; Kill any previous dead summary buffer.
4934 (when (and gnus-dead-summary
4935 (buffer-name gnus-dead-summary))
4937 (set-buffer gnus-dead-summary)
4938 (when gnus-dead-summary-mode
4939 (kill-buffer (current-buffer)))))
4940 ;; Make this the current dead summary.
4941 (setq gnus-dead-summary (current-buffer))
4942 (gnus-dead-summary-mode 1)
4943 (let ((name (buffer-name)))
4944 (when (string-match "Summary" name)
4946 (concat (substring name 0 (match-beginning 0)) "Dead "
4947 (substring name (match-beginning 0)))
4950 (defun gnus-kill-or-deaden-summary (buffer)
4951 "Kill or deaden the summary BUFFER."
4952 (when (and (buffer-name buffer)
4953 (not gnus-single-article-buffer))
4956 (gnus-kill-buffer gnus-article-buffer)
4957 (gnus-kill-buffer gnus-original-article-buffer)))
4958 (cond (gnus-kill-summary-on-exit
4959 (when (and gnus-use-trees
4960 (and (get-buffer buffer)
4961 (buffer-name (get-buffer buffer))))
4963 (set-buffer (get-buffer buffer))
4964 (gnus-tree-close gnus-newsgroup-name)))
4965 (gnus-kill-buffer buffer))
4966 ((and (get-buffer buffer)
4967 (buffer-name (get-buffer buffer)))
4970 (gnus-deaden-summary)))))
4972 (defun gnus-summary-wake-up-the-dead (&rest args)
4973 "Wake up the dead summary buffer."
4975 (gnus-dead-summary-mode -1)
4976 (let ((name (buffer-name)))
4977 (when (string-match "Dead " name)
4979 (concat (substring name 0 (match-beginning 0))
4980 (substring name (match-end 0)))
4982 (gnus-message 3 "This dead summary is now alive again"))
4984 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
4985 (defun gnus-summary-fetch-faq (&optional faq-dir)
4986 "Fetch the FAQ for the current group.
4987 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
4991 (when current-prefix-arg
4993 "Faq dir: " (and (listp gnus-group-faq-directory)
4994 gnus-group-faq-directory)))))
4995 (let (gnus-faq-buffer)
4996 (when (setq gnus-faq-buffer
4997 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
4998 (gnus-configure-windows 'summary-faq))))
5000 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5001 (defun gnus-summary-describe-group (&optional force)
5002 "Describe the current newsgroup."
5004 (gnus-group-describe-group force gnus-newsgroup-name))
5006 (defun gnus-summary-describe-briefly ()
5007 "Describe summary mode commands briefly."
5010 (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")))
5012 ;; Walking around group mode buffer from summary mode.
5014 (defun gnus-summary-next-group (&optional no-article target-group backward)
5015 "Exit current newsgroup and then select next unread newsgroup.
5016 If prefix argument NO-ARTICLE is non-nil, no article is selected
5017 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5018 previous group instead."
5020 (gnus-set-global-variables)
5021 ;; Stop pre-fetching.
5022 (gnus-async-halt-prefetch)
5023 (let ((current-group gnus-newsgroup-name)
5024 (current-buffer (current-buffer))
5026 ;; First we semi-exit this group to update Xrefs and all variables.
5027 ;; We can't do a real exit, because the window conf must remain
5028 ;; the same in case the user is prompted for info, and we don't
5029 ;; want the window conf to change before that...
5030 (gnus-summary-exit t)
5031 (while (not entered)
5032 ;; Then we find what group we are supposed to enter.
5033 (set-buffer gnus-group-buffer)
5034 (gnus-group-jump-to-group current-group)
5037 (if (eq gnus-keep-same-level 'best)
5038 (gnus-summary-best-group gnus-newsgroup-name)
5039 (gnus-summary-search-group backward gnus-keep-same-level))))
5040 (if (not target-group)
5041 ;; There are no further groups, so we return to the group
5044 (gnus-message 5 "Returning to the group buffer")
5046 (set-buffer current-buffer)
5048 (run-hooks 'gnus-group-no-more-groups-hook))
5049 ;; We try to enter the target group.
5050 (gnus-group-jump-to-group target-group)
5051 (let ((unreads (gnus-group-group-unread)))
5052 (if (and (or (eq t unreads)
5053 (and unreads (not (zerop unreads))))
5054 (gnus-summary-read-group
5055 target-group nil no-article current-buffer))
5057 (setq current-group target-group
5058 target-group nil)))))))
5060 (defun gnus-summary-prev-group (&optional no-article)
5061 "Exit current newsgroup and then select previous unread newsgroup.
5062 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5064 (gnus-summary-next-group no-article nil t))
5066 ;; Walking around summary lines.
5068 (defun gnus-summary-first-subject (&optional unread)
5069 "Go to the first unread subject.
5070 If UNREAD is non-nil, go to the first unread article.
5071 Returns the article selected or nil if there are no unread articles."
5076 ((null gnus-newsgroup-data)
5077 (gnus-message 3 "No articles in the group")
5079 ;; Pick the first article.
5081 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5082 (gnus-data-number (car gnus-newsgroup-data)))
5083 ;; No unread articles.
5084 ((null gnus-newsgroup-unreads)
5085 (gnus-message 3 "No more unread articles")
5087 ;; Find the first unread article.
5089 (let ((data gnus-newsgroup-data))
5091 (not (gnus-data-unread-p (car data))))
5092 (setq data (cdr data)))
5094 (goto-char (gnus-data-pos (car data)))
5095 (gnus-data-number (car data))))))
5096 (gnus-summary-position-point)))
5098 (defun gnus-summary-next-subject (n &optional unread dont-display)
5099 "Go to next N'th summary line.
5100 If N is negative, go to the previous N'th subject line.
5101 If UNREAD is non-nil, only unread articles are selected.
5102 The difference between N and the actual number of steps taken is
5105 (let ((backward (< n 0))
5109 (gnus-summary-find-prev unread)
5110 (gnus-summary-find-next unread)))
5113 (gnus-message 7 "No more%s articles"
5114 (if unread " unread" "")))
5115 (unless dont-display
5116 (gnus-summary-recenter)
5117 (gnus-summary-position-point))
5120 (defun gnus-summary-next-unread-subject (n)
5121 "Go to next N'th unread summary line."
5123 (gnus-summary-next-subject n t))
5125 (defun gnus-summary-prev-subject (n &optional unread)
5126 "Go to previous N'th summary line.
5127 If optional argument UNREAD is non-nil, only unread article is selected."
5129 (gnus-summary-next-subject (- n) unread))
5131 (defun gnus-summary-prev-unread-subject (n)
5132 "Go to previous N'th unread summary line."
5134 (gnus-summary-next-subject (- n) t))
5136 (defun gnus-summary-goto-subject (article &optional force silent)
5137 "Go the subject line of ARTICLE.
5138 If FORCE, also allow jumping to articles not currently shown."
5139 (interactive "nArticle number: ")
5141 (data (gnus-data-find article)))
5142 ;; We read in the article if we have to.
5145 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5146 (setq data (gnus-data-find article)))
5151 (gnus-message 3 "Can't find article %d" article))
5153 (goto-char (gnus-data-pos data))
5156 ;; Walking around summary lines with displaying articles.
5158 (defun gnus-summary-expand-window (&optional arg)
5159 "Make the summary buffer take up the entire Emacs frame.
5160 Given a prefix, will force an `article' buffer configuration."
5162 (gnus-set-global-variables)
5164 (gnus-configure-windows 'article 'force)
5165 (gnus-configure-windows 'summary 'force)))
5167 (defun gnus-summary-display-article (article &optional all-header)
5168 "Display ARTICLE in article buffer."
5169 (gnus-set-global-variables)
5173 (if gnus-summary-display-article-function
5174 (funcall gnus-summary-display-article-function article all-header)
5175 (gnus-article-prepare article all-header))
5176 (run-hooks 'gnus-select-article-hook)
5177 (when (and gnus-current-article
5178 (not (zerop gnus-current-article)))
5179 (gnus-summary-goto-subject gnus-current-article))
5180 (gnus-summary-recenter)
5181 (when (and gnus-use-trees gnus-show-threads)
5182 (gnus-possibly-generate-tree article)
5183 (gnus-highlight-selected-tree article))
5184 ;; Successfully display article.
5185 (gnus-article-set-window-start
5186 (cdr (assq article gnus-newsgroup-bookmarks))))))
5188 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5189 "Select the current article.
5190 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5191 non-nil, the article will be re-fetched even if it already present in
5192 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5194 ;; Make sure we are in the summary buffer to work around bbdb bug.
5195 (unless (eq major-mode 'gnus-summary-mode)
5196 (set-buffer gnus-summary-buffer))
5197 (let ((article (or article (gnus-summary-article-number)))
5198 (all-headers (not (not all-headers))) ;Must be T or NIL.
5199 gnus-summary-display-article-function
5202 (gnus-summary-article-pseudo-p article)
5203 (error "This is a pseudo-article."))
5206 (set-buffer gnus-summary-buffer)
5207 (if (or (and gnus-single-article-buffer
5208 (or (null gnus-current-article)
5209 (null gnus-article-current)
5210 (null (get-buffer gnus-article-buffer))
5211 (not (eq article (cdr gnus-article-current)))
5212 (not (equal (car gnus-article-current)
5213 gnus-newsgroup-name))))
5214 (and (not gnus-single-article-buffer)
5215 (or (null gnus-current-article)
5216 (not (eq gnus-current-article article))))
5218 ;; The requested article is different from the current article.
5220 (gnus-summary-display-article article all-headers)
5222 (when (or all-headers gnus-show-all-headers)
5223 (gnus-article-show-all-headers))
5226 (gnus-article-set-window-start
5227 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5229 (defun gnus-summary-set-current-mark (&optional current-mark)
5230 "Obsolete function."
5233 (defun gnus-summary-next-article (&optional unread subject backward push)
5234 "Select the next article.
5235 If UNREAD, only unread articles are selected.
5236 If SUBJECT, only articles with SUBJECT are selected.
5237 If BACKWARD, the previous article is selected instead of the next."
5239 (gnus-set-global-variables)
5241 ;; Is there such an article?
5242 ((and (gnus-summary-search-forward unread subject backward)
5243 (or (gnus-summary-display-article (gnus-summary-article-number))
5244 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5245 (gnus-summary-position-point))
5246 ;; If not, we try the first unread, if that is wanted.
5248 gnus-auto-select-same
5249 (gnus-summary-first-unread-article))
5250 (gnus-summary-position-point)
5251 (gnus-message 6 "Wrapped"))
5252 ;; Try to get next/previous article not displayed in this group.
5253 ((and gnus-auto-extend-newsgroup
5254 (not unread) (not subject))
5255 (gnus-summary-goto-article
5256 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5258 ;; Go to next/previous group.
5260 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5261 (gnus-summary-jump-to-group gnus-newsgroup-name))
5262 (let ((cmd last-command-char)
5264 (if (eq gnus-keep-same-level 'best)
5265 (gnus-summary-best-group gnus-newsgroup-name)
5266 (gnus-summary-search-group backward gnus-keep-same-level))))
5267 ;; For some reason, the group window gets selected. We change
5269 (select-window (get-buffer-window (current-buffer)))
5270 ;; Select next unread newsgroup automagically.
5272 ((or (not gnus-auto-select-next)
5274 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5275 ((or (eq gnus-auto-select-next 'quietly)
5276 (and (eq gnus-auto-select-next 'slightly-quietly)
5278 (and (eq gnus-auto-select-next 'almost-quietly)
5279 (gnus-summary-last-article-p)))
5281 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5283 (gnus-message 7 "No more%s articles (%s)..."
5284 (if unread " unread" "")
5285 (if group (concat "selecting " group)
5287 (gnus-summary-next-group nil group backward)))
5289 (when (gnus-key-press-event-p last-input-event)
5290 (gnus-summary-walk-group-buffer
5291 gnus-newsgroup-name cmd unread backward))))))))
5293 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward)
5294 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5295 (?\C-p (gnus-group-prev-unread-group 1))))
5296 (cursor-in-echo-area t)
5297 keve key group ended)
5299 (set-buffer gnus-group-buffer)
5300 (gnus-summary-jump-to-group from-group)
5302 (if (eq gnus-keep-same-level 'best)
5303 (gnus-summary-best-group gnus-newsgroup-name)
5304 (gnus-summary-search-group backward gnus-keep-same-level))))
5307 5 "No more%s articles%s" (if unread " unread" "")
5309 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5310 (format " (Type %s for %s [%s])"
5311 (single-key-description cmd) group
5312 (car (gnus-gethash group gnus-newsrc-hashtb)))
5313 (format " (Type %s to exit %s)"
5314 (single-key-description cmd)
5315 gnus-newsgroup-name)))
5316 ;; Confirm auto selection.
5317 (setq key (car (setq keve (gnus-read-event-char))))
5320 ((assq key keystrokes)
5321 (let ((obuf (current-buffer)))
5322 (switch-to-buffer gnus-group-buffer)
5324 (gnus-group-jump-to-group group))
5325 (eval (cadr (assq key keystrokes)))
5326 (setq group (gnus-group-group-name))
5327 (switch-to-buffer obuf))
5331 (gnus-ephemeral-group-p gnus-newsgroup-name))
5333 (gnus-summary-next-group nil group backward)))
5335 (push (cdr keve) unread-command-events))))))
5337 (defun gnus-summary-next-unread-article ()
5338 "Select unread article after current one."
5340 (gnus-summary-next-article
5341 (or (not (eq gnus-summary-goto-unread 'never))
5342 (gnus-summary-last-article-p (gnus-summary-article-number)))
5343 (and gnus-auto-select-same
5344 (gnus-summary-article-subject))))
5346 (defun gnus-summary-prev-article (&optional unread subject)
5347 "Select the article after the current one.
5348 If UNREAD is non-nil, only unread articles are selected."
5350 (gnus-summary-next-article unread subject t))
5352 (defun gnus-summary-prev-unread-article ()
5353 "Select unread article before current one."
5355 (gnus-summary-prev-article
5356 (or (not (eq gnus-summary-goto-unread 'never))
5357 (gnus-summary-first-article-p (gnus-summary-article-number)))
5358 (and gnus-auto-select-same
5359 (gnus-summary-article-subject))))
5361 (defun gnus-summary-next-page (&optional lines circular)
5362 "Show next page of the selected article.
5363 If at the end of the current article, select the next article.
5364 LINES says how many lines should be scrolled up.
5366 If CIRCULAR is non-nil, go to the start of the article instead of
5367 selecting the next article when reaching the end of the current
5370 (setq gnus-summary-buffer (current-buffer))
5371 (gnus-set-global-variables)
5372 (let ((article (gnus-summary-article-number))
5373 (article-window (get-buffer-window gnus-article-buffer t))
5375 (gnus-configure-windows 'article)
5376 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5377 (if (and (eq gnus-summary-goto-unread 'never)
5378 (not (gnus-summary-last-article-p article)))
5379 (gnus-summary-next-article)
5380 (gnus-summary-next-unread-article))
5381 (if (or (null gnus-current-article)
5382 (null gnus-article-current)
5383 (/= article (cdr gnus-article-current))
5384 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5385 ;; Selected subject is different from current article's.
5386 (gnus-summary-display-article article)
5387 (when article-window
5388 (gnus-eval-in-buffer-window gnus-article-buffer
5389 (setq endp (gnus-article-next-page lines)))
5392 (gnus-summary-beginning-of-article))
5394 (gnus-message 3 "End of message"))
5396 (if (and (eq gnus-summary-goto-unread 'never)
5397 (not (gnus-summary-last-article-p article)))
5398 (gnus-summary-next-article)
5399 (gnus-summary-next-unread-article))))))))
5400 (gnus-summary-recenter)
5401 (gnus-summary-position-point)))
5403 (defun gnus-summary-prev-page (&optional lines)
5404 "Show previous page of selected article.
5405 Argument LINES specifies lines to be scrolled down."
5407 (gnus-set-global-variables)
5408 (let ((article (gnus-summary-article-number))
5409 (article-window (get-buffer-window gnus-article-buffer t)))
5410 (gnus-configure-windows 'article)
5411 (if (or (null gnus-current-article)
5412 (null gnus-article-current)
5413 (/= article (cdr gnus-article-current))
5414 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5415 ;; Selected subject is different from current article's.
5416 (gnus-summary-display-article article)
5417 (gnus-summary-recenter)
5418 (when article-window
5419 (gnus-eval-in-buffer-window gnus-article-buffer
5420 (gnus-article-prev-page lines)))))
5421 (gnus-summary-position-point))
5423 (defun gnus-summary-scroll-up (lines)
5424 "Scroll up (or down) one line current article.
5425 Argument LINES specifies lines to be scrolled up (or down if negative)."
5427 (gnus-set-global-variables)
5428 (gnus-configure-windows 'article)
5429 (gnus-summary-show-thread)
5430 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5431 (gnus-eval-in-buffer-window gnus-article-buffer
5433 (when (gnus-article-next-page lines)
5434 (gnus-message 3 "End of message")))
5436 (gnus-article-prev-page (- lines))))))
5437 (gnus-summary-recenter)
5438 (gnus-summary-position-point))
5440 (defun gnus-summary-next-same-subject ()
5441 "Select next article which has the same subject as current one."
5443 (gnus-set-global-variables)
5444 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5446 (defun gnus-summary-prev-same-subject ()
5447 "Select previous article which has the same subject as current one."
5449 (gnus-set-global-variables)
5450 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5452 (defun gnus-summary-next-unread-same-subject ()
5453 "Select next unread article which has the same subject as current one."
5455 (gnus-set-global-variables)
5456 (gnus-summary-next-article t (gnus-summary-article-subject)))
5458 (defun gnus-summary-prev-unread-same-subject ()
5459 "Select previous unread article which has the same subject as current one."
5461 (gnus-set-global-variables)
5462 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5464 (defun gnus-summary-first-unread-article ()
5465 "Select the first unread article.
5466 Return nil if there are no unread articles."
5468 (gnus-set-global-variables)
5470 (when (gnus-summary-first-subject t)
5471 (gnus-summary-show-thread)
5472 (gnus-summary-first-subject t)
5473 (gnus-summary-display-article (gnus-summary-article-number)))
5474 (gnus-summary-position-point)))
5476 (defun gnus-summary-first-article ()
5477 "Select the first article.
5478 Return nil if there are no articles."
5480 (gnus-set-global-variables)
5482 (when (gnus-summary-first-subject)
5483 (gnus-summary-show-thread)
5484 (gnus-summary-first-subject)
5485 (gnus-summary-display-article (gnus-summary-article-number)))
5486 (gnus-summary-position-point)))
5488 (defun gnus-summary-best-unread-article ()
5489 "Select the unread article with the highest score."
5491 (gnus-set-global-variables)
5492 (let ((best -1000000)
5493 (data gnus-newsgroup-data)
5496 (and (gnus-data-unread-p (car data))
5498 (gnus-summary-article-score (gnus-data-number (car data))))
5501 article (gnus-data-number (car data))))
5502 (setq data (cdr data)))
5505 (gnus-summary-goto-article article)
5506 (error "No unread articles"))
5507 (gnus-summary-position-point))))
5509 (defun gnus-summary-last-subject ()
5510 "Go to the last displayed subject line in the group."
5511 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5513 (gnus-summary-goto-subject article))))
5515 (defun gnus-summary-goto-article (article &optional all-headers force)
5516 "Fetch ARTICLE and display it if it exists.
5517 If ALL-HEADERS is non-nil, no header lines are hidden."
5523 (mapcar (lambda (number) (list (int-to-string number)))
5524 gnus-newsgroup-limit)))
5528 (if (gnus-summary-goto-subject article force)
5529 (gnus-summary-display-article article all-headers)
5530 (gnus-message 4 "Couldn't go to article %s" article) nil)
5531 (gnus-summary-position-point)))
5533 (defun gnus-summary-goto-last-article ()
5534 "Go to the previously read article."
5537 (when gnus-last-article
5538 (gnus-summary-goto-article gnus-last-article))
5539 (gnus-summary-position-point)))
5541 (defun gnus-summary-pop-article (number)
5542 "Pop one article off the history and go to the previous.
5543 NUMBER articles will be popped off."
5546 (setq gnus-newsgroup-history
5547 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5549 (gnus-summary-goto-article (car to))
5550 (error "Article history empty")))
5551 (gnus-summary-position-point))
5553 ;; Summary commands and functions for limiting the summary buffer.
5555 (defun gnus-summary-limit-to-articles (n)
5556 "Limit the summary buffer to the next N articles.
5557 If not given a prefix, use the process marked articles instead."
5559 (gnus-set-global-variables)
5561 (let ((articles (gnus-summary-work-articles n)))
5562 (setq gnus-newsgroup-processable nil)
5563 (gnus-summary-limit articles))
5564 (gnus-summary-position-point)))
5566 (defun gnus-summary-pop-limit (&optional total)
5567 "Restore the previous limit.
5568 If given a prefix, remove all limits."
5570 (gnus-set-global-variables)
5572 (setq gnus-newsgroup-limits
5573 (list (mapcar (lambda (h) (mail-header-number h))
5574 gnus-newsgroup-headers))))
5575 (unless gnus-newsgroup-limits
5576 (error "No limit to pop"))
5578 (gnus-summary-limit nil 'pop)
5579 (gnus-summary-position-point)))
5581 (defun gnus-summary-limit-to-subject (subject &optional header)
5582 "Limit the summary buffer to articles that have subjects that match a regexp."
5583 (interactive "sLimit to subject (regexp): ")
5585 (setq header "subject"))
5586 (when (not (equal "" subject))
5588 (let ((articles (gnus-summary-find-matching
5589 (or header "subject") subject 'all)))
5591 (error "Found no matches for \"%s\"" subject))
5592 (gnus-summary-limit articles))
5593 (gnus-summary-position-point))))
5595 (defun gnus-summary-limit-to-author (from)
5596 "Limit the summary buffer to articles that have authors that match a regexp."
5597 (interactive "sLimit to author (regexp): ")
5598 (gnus-summary-limit-to-subject from "from"))
5600 (defun gnus-summary-limit-to-age (age &optional younger-p)
5601 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5602 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5603 articles that are younger than AGE days."
5604 (interactive "nTime in days: \nP")
5606 (let ((data gnus-newsgroup-data)
5607 (cutoff (nnmail-days-to-time age))
5608 articles d date is-younger)
5609 (while (setq d (pop data))
5610 (when (and (vectorp (gnus-data-header d))
5611 (setq date (mail-header-date (gnus-data-header d))))
5612 (setq is-younger (nnmail-time-less
5613 (nnmail-time-since (nnmail-date-to-time date))
5615 (when (if younger-p is-younger (not is-younger))
5616 (push (gnus-data-number d) articles))))
5617 (gnus-summary-limit (nreverse articles)))
5618 (gnus-summary-position-point)))
5620 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5622 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5624 (defun gnus-summary-limit-to-unread (&optional all)
5625 "Limit the summary buffer to articles that are not marked as read.
5626 If ALL is non-nil, limit strictly to unread articles."
5629 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5630 (gnus-summary-limit-to-marks
5631 ;; Concat all the marks that say that an article is read and have
5633 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5634 gnus-killed-mark gnus-kill-file-mark
5635 gnus-low-score-mark gnus-expirable-mark
5636 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5637 gnus-duplicate-mark)
5640 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5641 (make-obsolete 'gnus-summary-delete-marked-with
5642 'gnus-summary-limit-exlude-marks)
5644 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5645 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5646 If REVERSE, limit the summary buffer to articles that are marked
5647 with MARKS. MARKS can either be a string of marks or a list of marks.
5648 Returns how many articles were removed."
5649 (interactive "sMarks: ")
5650 (gnus-summary-limit-to-marks marks t))
5652 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5653 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5654 If REVERSE (the prefix), limit the summary buffer to articles that are
5655 not marked with MARKS. MARKS can either be a string of marks or a
5657 Returns how many articles were removed."
5658 (interactive (list (read-string "Marks: ") current-prefix-arg))
5659 (gnus-set-global-variables)
5661 (let ((data gnus-newsgroup-data)
5662 (marks (if (listp marks) marks
5663 (append marks nil))) ; Transform to list.
5666 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5667 (memq (gnus-data-mark (car data)) marks))
5668 (push (gnus-data-number (car data)) articles))
5669 (setq data (cdr data)))
5670 (gnus-summary-limit articles))
5671 (gnus-summary-position-point)))
5673 (defun gnus-summary-limit-to-score (&optional score)
5674 "Limit to articles with score at or above SCORE."
5676 (gnus-set-global-variables)
5677 (setq score (if score
5678 (prefix-numeric-value score)
5679 (or gnus-summary-default-score 0)))
5680 (let ((data gnus-newsgroup-data)
5683 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5685 (push (gnus-data-number (car data)) articles))
5686 (setq data (cdr data)))
5688 (gnus-summary-limit articles)
5689 (gnus-summary-position-point))))
5691 (defun gnus-summary-limit-include-dormant ()
5692 "Display all the hidden articles that are marked as dormant."
5694 (gnus-set-global-variables)
5695 (unless gnus-newsgroup-dormant
5696 (error "There are no dormant articles in this group"))
5698 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5699 (gnus-summary-position-point)))
5701 (defun gnus-summary-limit-exclude-dormant ()
5702 "Hide all dormant articles."
5704 (gnus-set-global-variables)
5706 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5707 (gnus-summary-position-point)))
5709 (defun gnus-summary-limit-exclude-childless-dormant ()
5710 "Hide all dormant articles that have no children."
5712 (gnus-set-global-variables)
5713 (let ((data (gnus-data-list t))
5714 articles d children)
5715 ;; Find all articles that are either not dormant or have
5717 (while (setq d (pop data))
5718 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5720 (gnus-article-children (gnus-data-number d)))
5723 (when (memq (car children) articles)
5728 (push (gnus-data-number d) articles)))
5731 (gnus-summary-limit articles)
5732 (gnus-summary-position-point))))
5734 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5735 "Mark all unread excluded articles as read.
5736 If ALL, mark even excluded ticked and dormants as read."
5738 (let ((articles (gnus-sorted-complement
5740 (mapcar (lambda (h) (mail-header-number h))
5741 gnus-newsgroup-headers)
5743 (sort gnus-newsgroup-limit '<)))
5745 (setq gnus-newsgroup-unreads nil)
5747 (setq gnus-newsgroup-dormant nil
5748 gnus-newsgroup-marked nil
5749 gnus-newsgroup-reads
5751 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5752 gnus-newsgroup-reads))
5753 (while (setq article (pop articles))
5754 (unless (or (memq article gnus-newsgroup-dormant)
5755 (memq article gnus-newsgroup-marked))
5756 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5758 (defun gnus-summary-limit (articles &optional pop)
5760 ;; We pop the previous limit off the stack and use that.
5761 (setq articles (car gnus-newsgroup-limits)
5762 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5763 ;; We use the new limit, so we push the old limit on the stack.
5764 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5766 (setq gnus-newsgroup-limit articles)
5767 (let ((total (length gnus-newsgroup-data))
5768 (data (gnus-data-find-list (gnus-summary-article-number)))
5769 (gnus-summary-mark-below nil) ; Inhibit this.
5771 ;; This will do all the work of generating the new summary buffer
5772 ;; according to the new limit.
5773 (gnus-summary-prepare)
5774 ;; Hide any threads, possibly.
5775 (and gnus-show-threads
5776 gnus-thread-hide-subtree
5777 (gnus-summary-hide-all-threads))
5778 ;; Try to return to the article you were at, or one in the
5781 ;; We try to find some article after the current one.
5783 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5786 (setq data (cdr data))))
5788 ;; If there is no data, that means that we were after the last
5789 ;; article. The same goes when we can't find any articles
5790 ;; after the current one.
5791 (goto-char (point-max))
5792 (gnus-summary-find-prev))
5793 ;; We return how many articles were removed from the summary
5794 ;; buffer as a result of the new limit.
5795 (- total (length gnus-newsgroup-data))))
5797 (defsubst gnus-invisible-cut-children (threads)
5800 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5805 (defsubst gnus-cut-thread (thread)
5806 "Go forwards in the thread until we find an article that we want to display."
5807 (when (or (eq gnus-fetch-old-headers 'some)
5808 (eq gnus-build-sparse-threads 'some)
5809 (eq gnus-build-sparse-threads 'more))
5810 ;; Deal with old-fetched headers and sparse threads.
5814 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5815 (gnus-summary-article-ancient-p
5816 (mail-header-number (car thread))))
5818 (if (<= (length (cdr thread)) 1)
5819 (setq thread (cadr thread))
5820 (when (gnus-invisible-cut-children (cdr thread))
5821 (let ((th (cdr thread)))
5823 (if (memq (mail-header-number (caar th))
5824 gnus-newsgroup-limit)
5825 (setq thread (car th)
5827 (setq th (cdr th)))))))))
5831 (defun gnus-cut-threads (threads)
5832 "Cut off all uninteresting articles from the beginning of threads."
5833 (when (or (eq gnus-fetch-old-headers 'some)
5834 (eq gnus-build-sparse-threads 'some)
5835 (eq gnus-build-sparse-threads 'more))
5838 (setcar th (gnus-cut-thread (car th)))
5839 (setq th (cdr th)))))
5840 ;; Remove nixed out threads.
5843 (defun gnus-summary-initial-limit (&optional show-if-empty)
5844 "Figure out what the initial limit is supposed to be on group entry.
5845 This entails weeding out unwanted dormants, low-scored articles,
5846 fetch-old-headers verbiage, and so on."
5847 ;; Most groups have nothing to remove.
5848 (if (or gnus-inhibit-limiting
5849 (and (null gnus-newsgroup-dormant)
5850 (not (eq gnus-fetch-old-headers 'some))
5851 (null gnus-summary-expunge-below)
5852 (not (eq gnus-build-sparse-threads 'some))
5853 (not (eq gnus-build-sparse-threads 'more))
5854 (null gnus-thread-expunge-below)
5855 (not gnus-use-nocem)))
5857 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5858 (setq gnus-newsgroup-limit nil)
5861 (unless (car (symbol-value node))
5862 ;; These threads have no parents -- they are roots.
5863 (let ((nodes (cdr (symbol-value node)))
5866 (if (and gnus-thread-expunge-below
5867 (< (gnus-thread-total-score (car nodes))
5868 gnus-thread-expunge-below))
5869 (gnus-expunge-thread (pop nodes))
5870 (setq thread (pop nodes))
5871 (gnus-summary-limit-children thread))))))
5872 gnus-newsgroup-dependencies)
5873 ;; If this limitation resulted in an empty group, we might
5874 ;; pop the previous limit and use it instead.
5875 (when (and (not gnus-newsgroup-limit)
5877 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5878 gnus-newsgroup-limit))
5880 (defun gnus-summary-limit-children (thread)
5881 "Return 1 if this subthread is visible and 0 if it is not."
5882 ;; First we get the number of visible children to this thread. This
5883 ;; is done by recursing down the thread using this function, so this
5884 ;; will really go down to a leaf article first, before slowly
5885 ;; working its way up towards the root.
5889 (apply '+ (mapcar 'gnus-summary-limit-children
5892 (number (mail-header-number (car thread)))
5895 (not (memq number gnus-newsgroup-marked))
5897 ;; If this article is dormant and has absolutely no visible
5898 ;; children, then this article isn't visible.
5899 (and (memq number gnus-newsgroup-dormant)
5901 ;; If this is "fetch-old-headered" and there is no
5902 ;; visible children, then we don't want this article.
5903 (and (eq gnus-fetch-old-headers 'some)
5904 (gnus-summary-article-ancient-p number)
5906 ;; If this is a sparsely inserted article with no children,
5907 ;; we don't want it.
5908 (and (eq gnus-build-sparse-threads 'some)
5909 (gnus-summary-article-sparse-p number)
5911 ;; If we use expunging, and this article is really
5912 ;; low-scored, then we don't want this article.
5913 (when (and gnus-summary-expunge-below
5915 (or (cdr (assq number gnus-newsgroup-scored))
5916 gnus-summary-default-score))
5917 gnus-summary-expunge-below))
5918 ;; We increase the expunge-tally here, but that has
5919 ;; nothing to do with the limits, really.
5920 (incf gnus-newsgroup-expunged-tally)
5921 ;; We also mark as read here, if that's wanted.
5922 (when (and gnus-summary-mark-below
5923 (< score gnus-summary-mark-below))
5924 (setq gnus-newsgroup-unreads
5925 (delq number gnus-newsgroup-unreads))
5926 (if gnus-newsgroup-auto-expire
5927 (push number gnus-newsgroup-expirable)
5928 (push (cons number gnus-low-score-mark)
5929 gnus-newsgroup-reads)))
5931 ;; Check NoCeM things.
5932 (if (and gnus-use-nocem
5933 (gnus-nocem-unwanted-article-p
5934 (mail-header-id (car thread))))
5936 (setq gnus-newsgroup-reads
5937 (delq number gnus-newsgroup-unreads))
5939 ;; Nope, invisible article.
5941 ;; Ok, this article is to be visible, so we add it to the limit
5943 (push number gnus-newsgroup-limit)
5946 (defun gnus-expunge-thread (thread)
5947 "Mark all articles in THREAD as read."
5948 (let* ((number (mail-header-number (car thread))))
5949 (incf gnus-newsgroup-expunged-tally)
5950 ;; We also mark as read here, if that's wanted.
5951 (setq gnus-newsgroup-unreads
5952 (delq number gnus-newsgroup-unreads))
5953 (if gnus-newsgroup-auto-expire
5954 (push number gnus-newsgroup-expirable)
5955 (push (cons number gnus-low-score-mark)
5956 gnus-newsgroup-reads)))
5957 ;; Go recursively through all subthreads.
5958 (mapcar 'gnus-expunge-thread (cdr thread)))
5960 ;; Summary article oriented commands
5962 (defun gnus-summary-refer-parent-article (n)
5963 "Refer parent article N times.
5964 If N is negative, go to ancestor -N instead.
5965 The difference between N and the number of articles fetched is returned."
5967 (gnus-set-global-variables)
5970 (when (not (natnump n))
5975 (setq header (gnus-summary-article-header))
5976 (if (and (eq (mail-header-number header)
5977 (cdr gnus-article-current))
5978 (equal gnus-newsgroup-name
5979 (car gnus-article-current)))
5980 ;; If we try to find the parent of the currently
5981 ;; displayed article, then we take a look at the actual
5982 ;; References header, since this is slightly more
5983 ;; reliable than the References field we got from the
5986 (set-buffer gnus-original-article-buffer)
5987 (nnheader-narrow-to-headers)
5988 (unless (setq ref (message-fetch-field "references"))
5989 (setq ref (message-fetch-field "in-reply-to")))
5992 ;; It's not the current article, so we take a bet on
5993 ;; the value we got from the server.
5994 (mail-header-references header)))
5996 (not (equal ref "")))
5997 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
5998 (gnus-message 1 "Couldn't find parent"))
5999 (gnus-message 1 "No references in article %d"
6000 (gnus-summary-article-number))
6003 (gnus-summary-position-point)
6006 (defun gnus-summary-refer-references ()
6007 "Fetch all articles mentioned in the References header.
6008 Return how many articles were fetched."
6010 (gnus-set-global-variables)
6011 (let ((ref (mail-header-references (gnus-summary-article-header)))
6012 (current (gnus-summary-article-number))
6016 (error "No References in the current article")
6017 ;; For each Message-ID in the References header...
6018 (while (string-match "<[^>]*>" ref)
6020 ;; ... fetch that article.
6021 (gnus-summary-refer-article
6022 (prog1 (match-string 0 ref)
6023 (setq ref (substring ref (match-end 0))))))
6024 (gnus-summary-goto-subject current)
6025 (gnus-summary-position-point)
6028 (defun gnus-summary-refer-article (message-id)
6029 "Fetch an article specified by MESSAGE-ID."
6030 (interactive "sMessage-ID: ")
6031 (when (and (stringp message-id)
6032 (not (zerop (length message-id))))
6033 ;; Construct the correct Message-ID if necessary.
6034 ;; Suggested by tale@pawl.rpi.edu.
6035 (unless (string-match "^<" message-id)
6036 (setq message-id (concat "<" message-id)))
6037 (unless (string-match ">$" message-id)
6038 (setq message-id (concat message-id ">")))
6039 (let* ((header (gnus-id-to-header message-id))
6041 (gnus-summary-article-sparse-p
6042 (mail-header-number header)))))
6045 ;; The article is present in the buffer, to we just go to it.
6046 (gnus-summary-goto-article
6047 (mail-header-number header) nil header)
6049 (gnus-summary-update-article (mail-header-number header))))
6050 ;; We fetch the article
6051 (let ((gnus-override-method
6052 (and (gnus-news-group-p gnus-newsgroup-name)
6053 gnus-refer-article-method))
6055 ;; Start the special refer-article method, if necessary.
6056 (when (and gnus-refer-article-method
6057 (gnus-news-group-p gnus-newsgroup-name))
6058 (gnus-check-server gnus-refer-article-method))
6059 ;; Fetch the header, and display the article.
6060 (if (setq number (gnus-summary-insert-subject message-id))
6061 (gnus-summary-select-article nil nil nil number)
6062 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6064 (defun gnus-summary-enter-digest-group (&optional force)
6065 "Enter an nndoc group based on the current article.
6066 If FORCE, force a digest interpretation. If not, try
6067 to guess what the document format is."
6069 (gnus-set-global-variables)
6070 (let ((conf gnus-current-window-configuration))
6072 (gnus-summary-select-article))
6073 (setq gnus-current-window-configuration conf)
6074 (let* ((name (format "%s-%d"
6075 (gnus-group-prefixed-name
6076 gnus-newsgroup-name (list 'nndoc ""))
6078 (set-buffer gnus-summary-buffer)
6079 gnus-current-article)))
6080 (ogroup gnus-newsgroup-name)
6081 (params (append (gnus-info-params (gnus-get-info ogroup))
6082 (list (cons 'to-group ogroup))))
6083 (case-fold-search t)
6084 (buf (current-buffer))
6087 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6088 (insert-buffer-substring gnus-original-article-buffer)
6089 ;; Remove lines that may lead nndoc to misinterpret the
6092 (goto-char (point-min))
6093 (or (search-forward "\n\n" nil t) (point)))
6094 (goto-char (point-min))
6095 (delete-matching-lines "^\\(Path\\):\\|^From ")
6098 (if (gnus-group-read-ephemeral-group
6099 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6101 ,(if force 'digest 'guess))) t)
6102 ;; Make all postings to this group go to the parent group.
6103 (nconc (gnus-info-params (gnus-get-info name))
6105 ;; Couldn't select this doc group.
6106 (switch-to-buffer buf)
6107 (gnus-set-global-variables)
6108 (gnus-configure-windows 'summary)
6109 (gnus-message 3 "Article couldn't be entered?"))
6110 (kill-buffer dig)))))
6112 (defun gnus-summary-read-document (n)
6113 "Open a new group based on the current article(s).
6114 This will allow you to read digests and other similar
6115 documents as newsgroups.
6116 Obeys the standard process/prefix convention."
6118 (let* ((articles (gnus-summary-work-articles n))
6119 (ogroup gnus-newsgroup-name)
6120 (params (append (gnus-info-params (gnus-get-info ogroup))
6121 (list (cons 'to-group ogroup))))
6122 article group egroup groups vgroup)
6123 (while (setq article (pop articles))
6124 (setq group (format "%s-%d" gnus-newsgroup-name article))
6125 (gnus-summary-remove-process-mark article)
6126 (when (gnus-summary-display-article article)
6128 (nnheader-temp-write nil
6129 (insert-buffer-substring gnus-original-article-buffer)
6130 ;; Remove some headers that may lead nndoc to make
6132 (message-narrow-to-head)
6133 (goto-char (point-min))
6134 (delete-matching-lines "^\\(Path\\):\\|^From ")
6137 (gnus-group-read-ephemeral-group
6138 group `(nndoc ,group (nndoc-address ,(current-buffer))
6139 (nndoc-article-type guess))
6142 ;; Make all postings to this group go to the parent group.
6143 (nconc (gnus-info-params (gnus-get-info egroup))
6145 (push egroup groups))
6146 ;; Couldn't select this doc group.
6147 (gnus-error 3 "Article couldn't be entered"))))))
6148 ;; Now we have selected all the documents.
6151 (error "None of the articles could be interpreted as documents"))
6152 ((gnus-group-read-ephemeral-group
6153 (setq vgroup (format
6154 "nnvirtual:%s-%s" gnus-newsgroup-name
6155 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6156 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6158 (cons (current-buffer) 'summary)))
6160 (error "Couldn't select virtual nndoc group")))))
6162 (defun gnus-summary-isearch-article (&optional regexp-p)
6163 "Do incremental search forward on the current article.
6164 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6166 (gnus-set-global-variables)
6167 (gnus-summary-select-article)
6168 (gnus-configure-windows 'article)
6169 (gnus-eval-in-buffer-window gnus-article-buffer
6170 ;;(goto-char (point-min))
6171 (isearch-forward regexp-p)))
6173 (defun gnus-summary-search-article-forward (regexp &optional backward)
6174 "Search for an article containing REGEXP forward.
6175 If BACKWARD, search backward instead."
6178 (format "Search article %s (regexp%s): "
6179 (if current-prefix-arg "backward" "forward")
6180 (if gnus-last-search-regexp
6181 (concat ", default " gnus-last-search-regexp)
6183 current-prefix-arg))
6184 (gnus-set-global-variables)
6185 (if (string-equal regexp "")
6186 (setq regexp (or gnus-last-search-regexp ""))
6187 (setq gnus-last-search-regexp regexp))
6188 (if (gnus-summary-search-article regexp backward)
6189 (gnus-summary-show-thread)
6190 (error "Search failed: \"%s\"" regexp)))
6192 (defun gnus-summary-search-article-backward (regexp)
6193 "Search for an article containing REGEXP backward."
6196 (format "Search article backward (regexp%s): "
6197 (if gnus-last-search-regexp
6198 (concat ", default " gnus-last-search-regexp)
6200 (gnus-summary-search-article-forward regexp 'backward))
6202 (defun gnus-summary-search-article (regexp &optional backward)
6203 "Search for an article containing REGEXP.
6204 Optional argument BACKWARD means do search for backward.
6205 `gnus-select-article-hook' is not called during the search."
6206 (let ((gnus-select-article-hook nil) ;Disable hook.
6207 (gnus-article-display-hook nil)
6208 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6209 (gnus-use-article-prefetch nil)
6210 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6211 (sum (current-buffer))
6214 (gnus-save-hidden-threads
6215 (gnus-summary-select-article)
6216 (set-buffer gnus-article-buffer)
6220 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6222 (re-search-backward regexp nil t)
6223 (re-search-forward regexp nil t))
6224 ;; We found the regexp.
6229 (get-buffer-window (current-buffer))
6233 (setq point (point)))
6234 ;; We didn't find it, so we go to the next article.
6237 (while (eq found 'not)
6238 (if (not (if backward (gnus-summary-find-prev)
6239 (gnus-summary-find-next)))
6240 ;; No more articles.
6242 ;; Select the next article and adjust point.
6243 (unless (gnus-summary-article-sparse-p
6244 (gnus-summary-article-number))
6246 (gnus-summary-select-article)
6247 (set-buffer gnus-article-buffer)
6249 (goto-char (if backward (point-max) (point-min))))))))
6250 (gnus-message 7 ""))
6251 ;; Return whether we found the regexp.
6252 (when (eq found 'found)
6254 (gnus-summary-show-thread)
6255 (gnus-summary-goto-subject gnus-current-article)
6256 (gnus-summary-position-point)
6259 (defun gnus-summary-find-matching (header regexp &optional backward unread
6261 "Return a list of all articles that match REGEXP on HEADER.
6262 The search stars on the current article and goes forwards unless
6263 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6264 If UNREAD is non-nil, only unread articles will
6265 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6266 in the comparisons."
6267 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6268 (gnus-data-find-list
6269 (gnus-summary-article-number) (gnus-data-list backward))))
6270 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6271 (case-fold-search (not not-case-fold))
6273 (unless (fboundp (intern (concat "mail-header-" header)))
6274 (error "%s is not a valid header" header))
6277 (and (or (not unread) ; We want all articles...
6278 (gnus-data-unread-p d)) ; Or just unreads.
6279 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6280 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6281 (push (gnus-data-number d) articles)) ; Success!
6282 (setq data (cdr data)))
6283 (nreverse articles)))
6285 (defun gnus-summary-execute-command (header regexp command &optional backward)
6286 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6287 If HEADER is an empty string (or nil), the match is done on the entire
6288 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6290 (list (let ((completion-ignore-case t))
6293 (mapcar (lambda (string) (list string))
6294 '("Number" "Subject" "From" "Lines" "Date"
6295 "Message-ID" "Xref" "References" "Body"))
6296 nil 'require-match))
6297 (read-string "Regexp: ")
6298 (read-key-sequence "Command: ")
6299 current-prefix-arg))
6300 (when (equal header "Body")
6302 (gnus-set-global-variables)
6303 ;; Hidden thread subtrees must be searched as well.
6304 (gnus-summary-show-all-threads)
6305 ;; We don't want to change current point nor window configuration.
6307 (save-window-excursion
6308 (gnus-message 6 "Executing %s..." (key-description command))
6309 ;; We'd like to execute COMMAND interactively so as to give arguments.
6310 (gnus-execute header regexp
6311 `(call-interactively ',(key-binding command))
6313 (gnus-message 6 "Executing %s...done" (key-description command)))))
6315 (defun gnus-summary-beginning-of-article ()
6316 "Scroll the article back to the beginning."
6318 (gnus-set-global-variables)
6319 (gnus-summary-select-article)
6320 (gnus-configure-windows 'article)
6321 (gnus-eval-in-buffer-window gnus-article-buffer
6323 (goto-char (point-min))
6324 (when gnus-break-pages
6325 (gnus-narrow-to-page))))
6327 (defun gnus-summary-end-of-article ()
6328 "Scroll to the end of the article."
6330 (gnus-set-global-variables)
6331 (gnus-summary-select-article)
6332 (gnus-configure-windows 'article)
6333 (gnus-eval-in-buffer-window gnus-article-buffer
6335 (goto-char (point-max))
6337 (when gnus-break-pages
6338 (gnus-narrow-to-page))))
6340 (defun gnus-summary-print-article (&optional filename)
6341 "Generate and print a PostScript image of the article buffer.
6343 If the optional argument FILENAME is nil, send the image to the printer.
6344 If FILENAME is a string, save the PostScript image in a file with that
6345 name. If FILENAME is a number, prompt the user for the name of the file
6347 (interactive (list (ps-print-preprint current-prefix-arg)))
6348 (gnus-summary-select-article)
6349 (gnus-eval-in-buffer-window gnus-article-buffer
6350 (let ((buffer (generate-new-buffer " *print*")))
6353 (copy-to-buffer buffer (point-min) (point-max))
6355 (gnus-article-delete-invisible-text)
6356 (run-hooks 'gnus-ps-print-hook)
6357 (ps-print-buffer-with-faces filename))
6358 (kill-buffer buffer)))))
6360 (defun gnus-summary-show-article (&optional arg)
6361 "Force re-fetching of the current article.
6362 If ARG (the prefix) is non-nil, show the raw article without any
6363 article massaging functions being run."
6365 (gnus-set-global-variables)
6367 ;; Select the article the normal way.
6368 (gnus-summary-select-article nil 'force)
6369 ;; Bind the article treatment functions to nil.
6370 (let ((gnus-have-all-headers t)
6371 gnus-article-display-hook
6372 gnus-article-prepare-hook
6375 (gnus-summary-select-article nil 'force)))
6376 (gnus-summary-goto-subject gnus-current-article)
6377 ; (gnus-configure-windows 'article)
6378 (gnus-summary-position-point))
6380 (defun gnus-summary-verbose-headers (&optional arg)
6381 "Toggle permanent full header display.
6382 If ARG is a positive number, turn header display on.
6383 If ARG is a negative number, turn header display off."
6385 (gnus-set-global-variables)
6386 (setq gnus-show-all-headers
6387 (cond ((or (not (numberp arg))
6389 (not gnus-show-all-headers))
6392 (gnus-summary-show-article))
6394 (defun gnus-summary-toggle-header (&optional arg)
6395 "Show the headers if they are hidden, or hide them if they are shown.
6396 If ARG is a positive number, show the entire header.
6397 If ARG is a negative number, hide the unwanted header lines."
6399 (gnus-set-global-variables)
6401 (set-buffer gnus-article-buffer)
6402 (let* ((buffer-read-only nil)
6403 (inhibit-point-motion-hooks t)
6404 (hidden (text-property-any
6405 (goto-char (point-min)) (search-forward "\n\n")
6408 (goto-char (point-min))
6409 (when (search-forward "\n\n" nil t)
6410 (delete-region (point-min) (1- (point))))
6411 (goto-char (point-min))
6413 (set-buffer gnus-original-article-buffer)
6414 (goto-char (point-min))
6415 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6416 (insert-buffer-substring gnus-original-article-buffer 1 e)
6417 (let ((article-inhibit-hiding t))
6418 (run-hooks 'gnus-article-display-hook))
6419 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6420 (gnus-article-hide-headers)))))
6422 (defun gnus-summary-show-all-headers ()
6423 "Make all header lines visible."
6425 (gnus-set-global-variables)
6426 (gnus-article-show-all-headers))
6428 (defun gnus-summary-toggle-mime (&optional arg)
6429 "Toggle MIME processing.
6430 If ARG is a positive number, turn MIME processing on."
6432 (gnus-set-global-variables)
6433 (setq gnus-show-mime
6434 (if (null arg) (not gnus-show-mime)
6435 (> (prefix-numeric-value arg) 0)))
6436 (gnus-summary-select-article t 'force))
6438 (defun gnus-summary-caesar-message (&optional arg)
6439 "Caesar rotate the current article by 13.
6440 The numerical prefix specifies how many places to rotate each letter
6443 (gnus-set-global-variables)
6444 (gnus-summary-select-article)
6445 (let ((mail-header-separator ""))
6446 (gnus-eval-in-buffer-window gnus-article-buffer
6449 (let ((start (window-start))
6451 (message-caesar-buffer-body arg)
6452 (set-window-start (get-buffer-window (current-buffer)) start))))))
6454 (defun gnus-summary-stop-page-breaking ()
6455 "Stop page breaking in the current article."
6457 (gnus-set-global-variables)
6458 (gnus-summary-select-article)
6459 (gnus-eval-in-buffer-window gnus-article-buffer
6461 (when (gnus-visual-p 'page-marker)
6462 (let ((buffer-read-only nil))
6463 (gnus-remove-text-with-property 'gnus-prev)
6464 (gnus-remove-text-with-property 'gnus-next)))))
6466 (defun gnus-summary-move-article (&optional n to-newsgroup
6467 select-method action)
6468 "Move the current article to a different newsgroup.
6469 If N is a positive number, move the N next articles.
6470 If N is a negative number, move the N previous articles.
6471 If N is nil and any articles have been marked with the process mark,
6472 move those articles instead.
6473 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6474 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6475 re-spool using this method.
6477 For this function to work, both the current newsgroup and the
6478 newsgroup that you want to move to have to support the `request-move'
6479 and `request-accept' functions."
6482 (setq action 'move))
6483 (gnus-set-global-variables)
6484 ;; Disable marking as read.
6485 (let (gnus-mark-article-hook)
6486 (save-window-excursion
6487 (gnus-summary-select-article)))
6488 ;; Check whether the source group supports the required functions.
6489 (cond ((and (eq action 'move)
6490 (not (gnus-check-backend-function
6491 'request-move-article gnus-newsgroup-name)))
6492 (error "The current group does not support article moving"))
6493 ((and (eq action 'crosspost)
6494 (not (gnus-check-backend-function
6495 'request-replace-article gnus-newsgroup-name)))
6496 (error "The current group does not support article editing")))
6497 (let ((articles (gnus-summary-work-articles n))
6498 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6499 (names '((move "Move" "Moving")
6500 (copy "Copy" "Copying")
6501 (crosspost "Crosspost" "Crossposting")))
6502 (copy-buf (save-excursion
6503 (nnheader-set-temp-buffer " *copy article*")))
6504 art-group to-method new-xref article to-groups)
6505 (unless (assq action names)
6506 (error "Unknown action %s" action))
6507 ;; Read the newsgroup name.
6508 (when (and (not to-newsgroup)
6509 (not select-method))
6511 (gnus-read-move-group-name
6512 (cadr (assq action names))
6513 (symbol-value (intern (format "gnus-current-%s-group" action)))
6515 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6516 (setq to-method (or select-method
6517 (gnus-group-name-to-method to-newsgroup)))
6518 ;; Check the method we are to move this article to...
6519 (unless (gnus-check-backend-function
6520 'request-accept-article (car to-method))
6521 (error "%s does not support article copying" (car to-method)))
6522 (unless (gnus-check-server to-method)
6523 (error "Can't open server %s" (car to-method)))
6524 (gnus-message 6 "%s to %s: %s..."
6525 (caddr (assq action names))
6526 (or (car select-method) to-newsgroup) articles)
6528 (setq article (pop articles))
6532 ;; Move the article.
6534 (gnus-request-move-article
6535 article ; Article to move
6536 gnus-newsgroup-name ; From newsgroup
6537 (nth 1 (gnus-find-method-for-group
6538 gnus-newsgroup-name)) ; Server
6539 (list 'gnus-request-accept-article
6540 to-newsgroup (list 'quote select-method)
6541 (not articles)) ; Accept form
6542 (not articles))) ; Only save nov last time
6543 ;; Copy the article.
6546 (set-buffer copy-buf)
6547 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6548 (gnus-request-accept-article
6549 to-newsgroup select-method (not articles))))
6550 ;; Crosspost the article.
6551 ((eq action 'crosspost)
6552 (let ((xref (message-tokenize-header
6553 (mail-header-xref (gnus-summary-article-header article))
6555 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6558 (setq xref (list (system-name))))
6561 (mapconcat 'identity
6562 (delete "Xref:" (delete new-xref xref))
6566 (set-buffer copy-buf)
6567 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6568 (nnheader-replace-header "xref" new-xref)
6569 (gnus-request-accept-article
6570 to-newsgroup select-method (not articles)))))))
6572 (gnus-message 1 "Couldn't %s article %s"
6573 (cadr (assq action names)) article)
6576 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6578 (gnus-group-prefixed-name
6581 (gnus-find-method-for-group to-newsgroup)))
6582 gnus-newsrc-hashtb)))
6583 (info (nth 2 entry))
6584 (to-group (gnus-info-group info)))
6585 ;; Update the group that has been moved to.
6587 (memq action '(move copy)))
6588 (unless (member to-group to-groups)
6589 (push to-group to-groups))
6591 (unless (memq article gnus-newsgroup-unreads)
6593 info (gnus-add-to-range (gnus-info-read info)
6594 (list (cdr art-group)))))
6596 ;; Copy any marks over to the new group.
6597 (let ((marks gnus-article-mark-lists)
6598 (to-article (cdr art-group)))
6600 ;; See whether the article is to be put in the cache.
6601 (when gnus-use-cache
6602 (gnus-cache-possibly-enter-article
6604 (let ((header (copy-sequence
6605 (gnus-summary-article-header article))))
6606 (mail-header-set-number header to-article)
6608 (memq article gnus-newsgroup-marked)
6609 (memq article gnus-newsgroup-dormant)
6610 (memq article gnus-newsgroup-unreads)))
6612 (when (and (equal to-group gnus-newsgroup-name)
6613 (not (memq article gnus-newsgroup-unreads)))
6614 ;; Mark this article as read in this group.
6615 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6616 (setcdr (gnus-active to-group) to-article)
6617 (setcdr gnus-newsgroup-active to-article))
6620 (when (memq article (symbol-value
6621 (intern (format "gnus-newsgroup-%s"
6623 ;; If the other group is the same as this group,
6624 ;; then we have to add the mark to the list.
6625 (when (equal to-group gnus-newsgroup-name)
6626 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6629 (intern (format "gnus-newsgroup-%s"
6631 ;; Copy the marks to other group.
6632 (gnus-add-marked-articles
6633 to-group (cdar marks) (list to-article) info))
6634 (setq marks (cdr marks)))))
6636 ;; Update the Xref header in this article to point to
6637 ;; the new crossposted article we have just created.
6638 (when (eq action 'crosspost)
6640 (set-buffer copy-buf)
6641 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6642 (nnheader-replace-header
6643 "xref" (concat new-xref " " (car art-group)
6644 ":" (cdr art-group)))
6645 (gnus-request-replace-article
6646 article gnus-newsgroup-name (current-buffer)))))
6648 (gnus-summary-goto-subject article)
6649 (when (eq action 'move)
6650 (gnus-summary-mark-article article gnus-canceled-mark)))
6651 (gnus-summary-remove-process-mark article))
6652 ;; Re-activate all groups that have been moved to.
6654 (gnus-activate-group (pop to-groups)))
6656 (gnus-kill-buffer copy-buf)
6657 (gnus-summary-position-point)
6658 (gnus-set-mode-line 'summary)))
6660 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6661 "Move the current article to a different newsgroup.
6662 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6663 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6664 re-spool using this method."
6666 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6668 (defun gnus-summary-crosspost-article (&optional n)
6669 "Crosspost the current article to some other group."
6671 (gnus-summary-move-article n nil nil 'crosspost))
6673 (defcustom gnus-summary-respool-default-method nil
6674 "Default method for respooling an article.
6675 If nil, use to the current newsgroup method."
6676 :type 'gnus-select-method-name
6677 :group 'gnus-summary-mail)
6679 (defun gnus-summary-respool-article (&optional n method)
6680 "Respool the current article.
6681 The article will be squeezed through the mail spooling process again,
6682 which means that it will be put in some mail newsgroup or other
6683 depending on `nnmail-split-methods'.
6684 If N is a positive number, respool the N next articles.
6685 If N is a negative number, respool the N previous articles.
6686 If N is nil and any articles have been marked with the process mark,
6687 respool those articles instead.
6689 Respooling can be done both from mail groups and \"real\" newsgroups.
6690 In the former case, the articles in question will be moved from the
6691 current group into whatever groups they are destined to. In the
6692 latter case, they will be copied into the relevant groups."
6694 (list current-prefix-arg
6695 (let* ((methods (gnus-methods-using 'respool))
6697 (symbol-name (or gnus-summary-respool-default-method
6698 (car (gnus-find-method-for-group
6699 gnus-newsgroup-name)))))
6701 (gnus-completing-read
6702 methname "What backend do you want to use when respooling?"
6703 methods nil t nil 'gnus-mail-method-history))
6706 ((zerop (length (setq ms (gnus-servers-using-backend
6708 (list (intern method) ""))
6712 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6713 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6715 (gnus-set-global-variables)
6717 (error "No method given for respooling"))
6718 (if (assoc (symbol-name
6719 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6720 (gnus-methods-using 'respool))
6721 (gnus-summary-move-article n nil method)
6722 (gnus-summary-copy-article n nil method)))
6724 (defun gnus-summary-import-article (file)
6725 "Import a random file into a mail newsgroup."
6726 (interactive "fImport file: ")
6727 (gnus-set-global-variables)
6728 (let ((group gnus-newsgroup-name)
6729 (now (current-time))
6731 (unless (gnus-check-backend-function 'request-accept-article group)
6732 (error "%s does not support article importing" group))
6733 (or (file-readable-p file)
6734 (not (file-regular-p file))
6735 (error "Can't read %s" file))
6737 (set-buffer (get-buffer-create " *import file*"))
6738 (buffer-disable-undo (current-buffer))
6740 (insert-file-contents file)
6741 (goto-char (point-min))
6742 (unless (nnheader-article-p)
6743 ;; This doesn't look like an article, so we fudge some headers.
6744 (setq atts (file-attributes file)
6745 lines (count-lines (point-min) (point-max)))
6746 (insert "From: " (read-string "From: ") "\n"
6747 "Subject: " (read-string "Subject: ") "\n"
6748 "Date: " (timezone-make-date-arpa-standard
6749 (current-time-string (nth 5 atts))
6750 (current-time-zone now)
6751 (current-time-zone now))
6753 "Message-ID: " (message-make-message-id) "\n"
6754 "Lines: " (int-to-string lines) "\n"
6755 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6756 (gnus-request-accept-article group nil t)
6757 (kill-buffer (current-buffer)))))
6759 (defun gnus-summary-article-posted-p ()
6760 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6761 This will be the case if the article has both been mailed and posted."
6763 (let ((id (mail-header-references (gnus-summary-article-header)))
6764 (gnus-override-method
6765 (or gnus-refer-article-method gnus-select-method)))
6766 (if (gnus-request-head id "")
6767 (gnus-message 2 "The current message was found on %s"
6768 gnus-override-method)
6769 (gnus-message 2 "The current message couldn't be found on %s"
6770 gnus-override-method)
6773 (defun gnus-summary-expire-articles (&optional now)
6774 "Expire all articles that are marked as expirable in the current group."
6776 (gnus-set-global-variables)
6777 (when (gnus-check-backend-function
6778 'request-expire-articles gnus-newsgroup-name)
6779 ;; This backend supports expiry.
6780 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6781 (expirable (if total
6783 ;; We need to update the info for
6784 ;; this group for `gnus-list-of-read-articles'
6785 ;; to give us the right answer.
6786 (run-hooks 'gnus-exit-group-hook)
6787 (gnus-summary-update-info)
6788 (gnus-list-of-read-articles gnus-newsgroup-name))
6789 (setq gnus-newsgroup-expirable
6790 (sort gnus-newsgroup-expirable '<))))
6791 (expiry-wait (if now 'immediate
6792 (gnus-group-find-parameter
6793 gnus-newsgroup-name 'expiry-wait)))
6796 ;; There are expirable articles in this group, so we run them
6797 ;; through the expiry process.
6798 (gnus-message 6 "Expiring articles...")
6799 ;; The list of articles that weren't expired is returned.
6801 (let ((nnmail-expiry-wait-function nil)
6802 (nnmail-expiry-wait expiry-wait))
6803 (setq es (gnus-request-expire-articles
6804 expirable gnus-newsgroup-name)))
6805 (setq es (gnus-request-expire-articles
6806 expirable gnus-newsgroup-name)))
6808 (setq gnus-newsgroup-expirable es))
6809 ;; We go through the old list of expirable, and mark all
6810 ;; really expired articles as nonexistent.
6811 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6812 (let ((gnus-use-cache nil))
6814 (unless (memq (car expirable) es)
6815 (when (gnus-data-find (car expirable))
6816 (gnus-summary-mark-article
6817 (car expirable) gnus-canceled-mark)))
6818 (setq expirable (cdr expirable)))))
6819 (gnus-message 6 "Expiring articles...done")))))
6821 (defun gnus-summary-expire-articles-now ()
6822 "Expunge all expirable articles in the current group.
6823 This means that *all* articles that are marked as expirable will be
6824 deleted forever, right now."
6826 (gnus-set-global-variables)
6827 (or gnus-expert-user
6829 "Are you really, really, really sure you want to delete all these messages? ")
6831 (gnus-summary-expire-articles t))
6833 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6834 (defun gnus-summary-delete-article (&optional n)
6835 "Delete the N next (mail) articles.
6836 This command actually deletes articles. This is not a marking
6837 command. The article will disappear forever from your life, never to
6839 If N is negative, delete backwards.
6840 If N is nil and articles have been marked with the process mark,
6841 delete these instead."
6843 (gnus-set-global-variables)
6844 (unless (gnus-check-backend-function 'request-expire-articles
6845 gnus-newsgroup-name)
6846 (error "The current newsgroup does not support article deletion."))
6847 ;; Compute the list of articles to delete.
6848 (let ((articles (gnus-summary-work-articles n))
6850 (if (and gnus-novice-user
6851 (not (gnus-yes-or-no-p
6852 (format "Do you really want to delete %s forever? "
6853 (if (> (length articles) 1)
6854 (format "these %s articles" (length articles))
6857 ;; Delete the articles.
6858 (setq not-deleted (gnus-request-expire-articles
6859 articles gnus-newsgroup-name 'force))
6861 (gnus-summary-remove-process-mark (car articles))
6862 ;; The backend might not have been able to delete the article
6864 (unless (memq (car articles) not-deleted)
6865 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6866 (setq articles (cdr articles))))
6867 (gnus-summary-position-point)
6868 (gnus-set-mode-line 'summary)
6871 (defun gnus-summary-edit-article (&optional force)
6872 "Edit the current article.
6873 This will have permanent effect only in mail groups.
6874 If FORCE is non-nil, allow editing of articles even in read-only
6878 (set-buffer gnus-summary-buffer)
6879 (gnus-set-global-variables)
6880 (when (and (not force)
6881 (gnus-group-read-only-p))
6882 (error "The current newsgroup does not support article editing."))
6883 ;; Select article if needed.
6884 (unless (eq (gnus-summary-article-number)
6885 gnus-current-article)
6886 (gnus-summary-select-article t))
6887 (gnus-article-edit-article
6889 (gnus-summary-edit-article-done
6890 ,(or (mail-header-references gnus-current-headers) "")
6891 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6893 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6895 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6896 "Make edits to the current article permanent."
6898 ;; Replace the article.
6899 (if (and (not read-only)
6900 (not (gnus-request-replace-article
6901 (cdr gnus-article-current) (car gnus-article-current)
6903 (error "Couldn't replace article.")
6904 ;; Update the summary buffer.
6906 (equal (message-tokenize-header references " ")
6907 (message-tokenize-header
6908 (or (message-fetch-field "references") "") " ")))
6909 ;; We only have to update this line.
6912 (message-narrow-to-head)
6913 (let ((head (buffer-string))
6915 (nnheader-temp-write nil
6916 (insert (format "211 %d Article retrieved.\n"
6917 (cdr gnus-article-current)))
6920 (let ((nntp-server-buffer (current-buffer)))
6921 (setq header (car (gnus-get-newsgroup-headers
6923 (set-buffer gnus-summary-buffer)
6924 gnus-newsgroup-dependencies)
6927 (set-buffer gnus-summary-buffer)
6928 (gnus-data-set-header
6929 (gnus-data-find (cdr gnus-article-current))
6931 (gnus-summary-update-article-line
6932 (cdr gnus-article-current) header))))))
6934 (set-buffer (or buffer gnus-summary-buffer))
6935 (gnus-summary-update-article (cdr gnus-article-current)))
6936 ;; Prettify the article buffer again.
6938 (set-buffer gnus-article-buffer)
6939 (run-hooks 'gnus-article-display-hook)
6940 (set-buffer gnus-original-article-buffer)
6941 (gnus-request-article
6942 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
6943 ;; Prettify the summary buffer line.
6944 (when (gnus-visual-p 'summary-highlight 'highlight)
6945 (run-hooks 'gnus-visual-mark-article-hook))))
6947 (defun gnus-summary-edit-wash (key)
6948 "Perform editing command in the article buffer."
6952 (message "%s" (concat (this-command-keys) "- "))
6955 (gnus-summary-edit-article)
6956 (execute-kbd-macro (concat (this-command-keys) key))
6957 (gnus-article-edit-done))
6961 (defun gnus-summary-respool-query ()
6962 "Query where the respool algorithm would put this article."
6964 (gnus-set-global-variables)
6965 (let (gnus-mark-article-hook)
6966 (gnus-summary-select-article)
6968 (set-buffer gnus-article-buffer)
6970 (goto-char (point-min))
6971 (search-forward "\n\n")
6972 (narrow-to-region (point-min) (point))
6973 (message "This message would go to %s"
6974 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
6976 ;; Summary marking commands.
6978 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
6979 "Mark articles which has the same subject as read, and then select the next.
6980 If UNMARK is positive, remove any kind of mark.
6981 If UNMARK is negative, tick articles."
6983 (gnus-set-global-variables)
6985 (setq unmark (prefix-numeric-value unmark)))
6987 (gnus-summary-mark-same-subject
6988 (gnus-summary-article-subject) unmark)))
6989 ;; Select next unread article. If auto-select-same mode, should
6990 ;; select the first unread article.
6991 (gnus-summary-next-article t (and gnus-auto-select-same
6992 (gnus-summary-article-subject)))
6993 (gnus-message 7 "%d article%s marked as %s"
6994 count (if (= count 1) " is" "s are")
6995 (if unmark "unread" "read"))))
6997 (defun gnus-summary-kill-same-subject (&optional unmark)
6998 "Mark articles which has the same subject as read.
6999 If UNMARK is positive, remove any kind of mark.
7000 If UNMARK is negative, tick articles."
7002 (gnus-set-global-variables)
7004 (setq unmark (prefix-numeric-value unmark)))
7006 (gnus-summary-mark-same-subject
7007 (gnus-summary-article-subject) unmark)))
7008 ;; If marked as read, go to next unread subject.
7010 ;; Go to next unread subject.
7011 (gnus-summary-next-subject 1 t))
7012 (gnus-message 7 "%d articles are marked as %s"
7013 count (if unmark "unread" "read"))))
7015 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7016 "Mark articles with same SUBJECT as read, and return marked number.
7017 If optional argument UNMARK is positive, remove any kinds of marks.
7018 If optional argument UNMARK is negative, mark articles as unread instead."
7022 ((null unmark) ; Mark as read.
7025 (gnus-summary-mark-article-as-read gnus-killed-mark)
7026 (gnus-summary-show-thread) t)
7027 (gnus-summary-find-subject subject))
7028 (setq count (1+ count))))
7029 ((> unmark 0) ; Tick.
7032 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7033 (gnus-summary-show-thread) t)
7034 (gnus-summary-find-subject subject))
7035 (setq count (1+ count))))
7036 (t ; Mark as unread.
7039 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7040 (gnus-summary-show-thread) t)
7041 (gnus-summary-find-subject subject))
7042 (setq count (1+ count)))))
7043 (gnus-set-mode-line 'summary)
7044 ;; Return the number of marked articles.
7047 (defun gnus-summary-mark-as-processable (n &optional unmark)
7048 "Set the process mark on the next N articles.
7049 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7050 the process mark instead. The difference between N and the actual
7051 number of articles marked is returned."
7053 (gnus-set-global-variables)
7054 (let ((backward (< n 0))
7059 (gnus-summary-remove-process-mark
7060 (gnus-summary-article-number))
7061 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7062 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7065 (gnus-message 7 "No more articles"))
7066 (gnus-summary-recenter)
7067 (gnus-summary-position-point)
7070 (defun gnus-summary-unmark-as-processable (n)
7071 "Remove the process mark from the next N articles.
7072 If N is negative, mark backward instead. The difference between N and
7073 the actual number of articles marked is returned."
7075 (gnus-set-global-variables)
7076 (gnus-summary-mark-as-processable n t))
7078 (defun gnus-summary-unmark-all-processable ()
7079 "Remove the process mark from all articles."
7081 (gnus-set-global-variables)
7083 (while gnus-newsgroup-processable
7084 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7085 (gnus-summary-position-point))
7087 (defun gnus-summary-mark-as-expirable (n)
7088 "Mark N articles forward as expirable.
7089 If N is negative, mark backward instead. The difference between N and
7090 the actual number of articles marked is returned."
7092 (gnus-set-global-variables)
7093 (gnus-summary-mark-forward n gnus-expirable-mark))
7095 (defun gnus-summary-mark-article-as-replied (article)
7096 "Mark ARTICLE replied and update the summary line."
7097 (push article gnus-newsgroup-replied)
7098 (let ((buffer-read-only nil))
7099 (when (gnus-summary-goto-subject article)
7100 (gnus-summary-update-secondary-mark article))))
7102 (defun gnus-summary-set-bookmark (article)
7103 "Set a bookmark in current article."
7104 (interactive (list (gnus-summary-article-number)))
7105 (gnus-set-global-variables)
7106 (when (or (not (get-buffer gnus-article-buffer))
7107 (not gnus-current-article)
7108 (not gnus-article-current)
7109 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7110 (error "No current article selected"))
7111 ;; Remove old bookmark, if one exists.
7112 (let ((old (assq article gnus-newsgroup-bookmarks)))
7114 (setq gnus-newsgroup-bookmarks
7115 (delq old gnus-newsgroup-bookmarks))))
7116 ;; Set the new bookmark, which is on the form
7117 ;; (article-number . line-number-in-body).
7121 (set-buffer gnus-article-buffer)
7125 (goto-char (point-min))
7126 (search-forward "\n\n" nil t)
7129 gnus-newsgroup-bookmarks)
7130 (gnus-message 6 "A bookmark has been added to the current article."))
7132 (defun gnus-summary-remove-bookmark (article)
7133 "Remove the bookmark from the current article."
7134 (interactive (list (gnus-summary-article-number)))
7135 (gnus-set-global-variables)
7136 ;; Remove old bookmark, if one exists.
7137 (let ((old (assq article gnus-newsgroup-bookmarks)))
7140 (setq gnus-newsgroup-bookmarks
7141 (delq old gnus-newsgroup-bookmarks))
7142 (gnus-message 6 "Removed bookmark."))
7143 (gnus-message 6 "No bookmark in current article."))))
7145 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7146 (defun gnus-summary-mark-as-dormant (n)
7147 "Mark N articles forward as dormant.
7148 If N is negative, mark backward instead. The difference between N and
7149 the actual number of articles marked is returned."
7151 (gnus-set-global-variables)
7152 (gnus-summary-mark-forward n gnus-dormant-mark))
7154 (defun gnus-summary-set-process-mark (article)
7155 "Set the process mark on ARTICLE and update the summary line."
7156 (setq gnus-newsgroup-processable
7158 (delq article gnus-newsgroup-processable)))
7159 (when (gnus-summary-goto-subject article)
7160 (gnus-summary-show-thread)
7161 (gnus-summary-update-secondary-mark article)))
7163 (defun gnus-summary-remove-process-mark (article)
7164 "Remove the process mark from ARTICLE and update the summary line."
7165 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7166 (when (gnus-summary-goto-subject article)
7167 (gnus-summary-show-thread)
7168 (gnus-summary-update-secondary-mark article)))
7170 (defun gnus-summary-set-saved-mark (article)
7171 "Set the process mark on ARTICLE and update the summary line."
7172 (push article gnus-newsgroup-saved)
7173 (when (gnus-summary-goto-subject article)
7174 (gnus-summary-update-secondary-mark article)))
7176 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7177 "Mark N articles as read forwards.
7178 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7179 The difference between N and the actual number of articles marked is
7182 (gnus-set-global-variables)
7183 (let ((backward (< n 0))
7184 (gnus-summary-goto-unread
7185 (and gnus-summary-goto-unread
7186 (not (eq gnus-summary-goto-unread 'never))
7187 (not (memq mark (list gnus-unread-mark
7188 gnus-ticked-mark gnus-dormant-mark)))))
7190 (mark (or mark gnus-del-mark)))
7192 (gnus-summary-mark-article nil mark no-expire)
7193 (zerop (gnus-summary-next-subject
7195 (and gnus-summary-goto-unread
7196 (not (eq gnus-summary-goto-unread 'never)))
7200 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7201 (gnus-summary-recenter)
7202 (gnus-summary-position-point)
7203 (gnus-set-mode-line 'summary)
7206 (defun gnus-summary-mark-article-as-read (mark)
7207 "Mark the current article quickly as read with MARK."
7208 (let ((article (gnus-summary-article-number)))
7209 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7210 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7211 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7212 (push (cons article mark) gnus-newsgroup-reads)
7213 ;; Possibly remove from cache, if that is used.
7214 (when gnus-use-cache
7215 (gnus-cache-enter-remove-article article))
7216 ;; Allow the backend to change the mark.
7217 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7218 ;; Check for auto-expiry.
7219 (when (and gnus-newsgroup-auto-expire
7220 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7221 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7222 (= mark gnus-ancient-mark)
7223 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7224 (= mark gnus-duplicate-mark)))
7225 (setq mark gnus-expirable-mark)
7226 (push article gnus-newsgroup-expirable))
7227 ;; Set the mark in the buffer.
7228 (gnus-summary-update-mark mark 'unread)
7231 (defun gnus-summary-mark-article-as-unread (mark)
7232 "Mark the current article quickly as unread with MARK."
7233 (let ((article (gnus-summary-article-number)))
7235 (gnus-error 1 "Unmarkable article")
7236 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7237 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7238 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7239 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7240 (cond ((= mark gnus-ticked-mark)
7241 (push article gnus-newsgroup-marked))
7242 ((= mark gnus-dormant-mark)
7243 (push article gnus-newsgroup-dormant))
7245 (push article gnus-newsgroup-unreads)))
7246 (setq gnus-newsgroup-reads
7247 (delq (assq article gnus-newsgroup-reads)
7248 gnus-newsgroup-reads))
7250 ;; See whether the article is to be put in the cache.
7252 (vectorp (gnus-summary-article-header article))
7254 (gnus-cache-possibly-enter-article
7255 gnus-newsgroup-name article
7256 (gnus-summary-article-header article)
7257 (= mark gnus-ticked-mark)
7258 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7261 (gnus-summary-update-mark mark 'unread))
7264 (defun gnus-summary-mark-article (&optional article mark no-expire)
7265 "Mark ARTICLE with MARK. MARK can be any character.
7266 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7267 `??' (dormant) and `?E' (expirable).
7268 If MARK is nil, then the default character `?D' is used.
7269 If ARTICLE is nil, then the article on the current line will be
7271 ;; The mark might be a string.
7272 (when (stringp mark)
7273 (setq mark (aref mark 0)))
7274 ;; If no mark is given, then we check auto-expiring.
7275 (and (not no-expire)
7276 gnus-newsgroup-auto-expire
7278 (and (gnus-characterp mark)
7279 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7280 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7281 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7282 (= mark gnus-duplicate-mark))))
7283 (setq mark gnus-expirable-mark))
7284 (let* ((mark (or mark gnus-del-mark))
7285 (article (or article (gnus-summary-article-number))))
7287 (error "No article on current line"))
7288 (if (or (= mark gnus-unread-mark)
7289 (= mark gnus-ticked-mark)
7290 (= mark gnus-dormant-mark))
7291 (gnus-mark-article-as-unread article mark)
7292 (gnus-mark-article-as-read article mark))
7294 ;; See whether the article is to be put in the cache.
7296 (not (= mark gnus-canceled-mark))
7297 (vectorp (gnus-summary-article-header article))
7299 (gnus-cache-possibly-enter-article
7300 gnus-newsgroup-name article
7301 (gnus-summary-article-header article)
7302 (= mark gnus-ticked-mark)
7303 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7305 (when (gnus-summary-goto-subject article nil t)
7306 (let ((buffer-read-only nil))
7307 (gnus-summary-show-thread)
7309 (gnus-summary-update-mark mark 'unread)
7312 (defun gnus-summary-update-secondary-mark (article)
7313 "Update the secondary (read, process, cache) mark."
7314 (gnus-summary-update-mark
7315 (cond ((memq article gnus-newsgroup-processable)
7317 ((memq article gnus-newsgroup-cached)
7319 ((memq article gnus-newsgroup-replied)
7321 ((memq article gnus-newsgroup-saved)
7323 (t gnus-unread-mark))
7325 (when (gnus-visual-p 'summary-highlight 'highlight)
7326 (run-hooks 'gnus-summary-update-hook))
7329 (defun gnus-summary-update-mark (mark type)
7330 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7331 (buffer-read-only nil))
7332 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7333 (when (looking-at "\r")
7336 (<= (+ forward (point)) (point-max)))
7337 ;; Go to the right position on the line.
7338 (goto-char (+ forward (point)))
7339 ;; Replace the old mark with the new mark.
7340 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7341 ;; Optionally update the marks by some user rule.
7342 (when (eq type 'unread)
7344 (gnus-data-find (gnus-summary-article-number)) mark)
7345 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7347 (defun gnus-mark-article-as-read (article &optional mark)
7348 "Enter ARTICLE in the pertinent lists and remove it from others."
7349 ;; Make the article expirable.
7350 (let ((mark (or mark gnus-del-mark)))
7351 (if (= mark gnus-expirable-mark)
7352 (push article gnus-newsgroup-expirable)
7353 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7354 ;; Remove from unread and marked lists.
7355 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7356 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7357 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7358 (push (cons article mark) gnus-newsgroup-reads)
7359 ;; Possibly remove from cache, if that is used.
7360 (when gnus-use-cache
7361 (gnus-cache-enter-remove-article article))))
7363 (defun gnus-mark-article-as-unread (article &optional mark)
7364 "Enter ARTICLE in the pertinent lists and remove it from others."
7365 (let ((mark (or mark gnus-ticked-mark)))
7366 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7367 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7368 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7369 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7371 ;; Unsuppress duplicates?
7372 (when gnus-suppress-duplicates
7373 (gnus-dup-unsuppress-article article))
7375 (cond ((= mark gnus-ticked-mark)
7376 (push article gnus-newsgroup-marked))
7377 ((= mark gnus-dormant-mark)
7378 (push article gnus-newsgroup-dormant))
7380 (push article gnus-newsgroup-unreads)))
7381 (setq gnus-newsgroup-reads
7382 (delq (assq article gnus-newsgroup-reads)
7383 gnus-newsgroup-reads))))
7385 (defalias 'gnus-summary-mark-as-unread-forward
7386 'gnus-summary-tick-article-forward)
7387 (make-obsolete 'gnus-summary-mark-as-unread-forward
7388 'gnus-summary-tick-article-forward)
7389 (defun gnus-summary-tick-article-forward (n)
7390 "Tick N articles forwards.
7391 If N is negative, tick backwards instead.
7392 The difference between N and the number of articles ticked is returned."
7394 (gnus-summary-mark-forward n gnus-ticked-mark))
7396 (defalias 'gnus-summary-mark-as-unread-backward
7397 'gnus-summary-tick-article-backward)
7398 (make-obsolete 'gnus-summary-mark-as-unread-backward
7399 'gnus-summary-tick-article-backward)
7400 (defun gnus-summary-tick-article-backward (n)
7401 "Tick N articles backwards.
7402 The difference between N and the number of articles ticked is returned."
7404 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7406 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7407 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7408 (defun gnus-summary-tick-article (&optional article clear-mark)
7409 "Mark current article as unread.
7410 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7411 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7413 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7416 (defun gnus-summary-mark-as-read-forward (n)
7417 "Mark N articles as read forwards.
7418 If N is negative, mark backwards instead.
7419 The difference between N and the actual number of articles marked is
7422 (gnus-summary-mark-forward n gnus-del-mark t))
7424 (defun gnus-summary-mark-as-read-backward (n)
7425 "Mark the N articles as read backwards.
7426 The difference between N and the actual number of articles marked is
7429 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7431 (defun gnus-summary-mark-as-read (&optional article mark)
7432 "Mark current article as read.
7433 ARTICLE specifies the article to be marked as read.
7434 MARK specifies a string to be inserted at the beginning of the line."
7435 (gnus-summary-mark-article article mark))
7437 (defun gnus-summary-clear-mark-forward (n)
7438 "Clear marks from N articles forward.
7439 If N is negative, clear backward instead.
7440 The difference between N and the number of marks cleared is returned."
7442 (gnus-summary-mark-forward n gnus-unread-mark))
7444 (defun gnus-summary-clear-mark-backward (n)
7445 "Clear marks from N articles backward.
7446 The difference between N and the number of marks cleared is returned."
7448 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7450 (defun gnus-summary-mark-unread-as-read ()
7451 "Intended to be used by `gnus-summary-mark-article-hook'."
7452 (when (memq gnus-current-article gnus-newsgroup-unreads)
7453 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7455 (defun gnus-summary-mark-read-and-unread-as-read ()
7456 "Intended to be used by `gnus-summary-mark-article-hook'."
7457 (let ((mark (gnus-summary-article-mark)))
7458 (when (or (gnus-unread-mark-p mark)
7459 (gnus-read-mark-p mark))
7460 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7462 (defun gnus-summary-mark-region-as-read (point mark all)
7463 "Mark all unread articles between point and mark as read.
7464 If given a prefix, mark all articles between point and mark as read,
7465 even ticked and dormant ones."
7466 (interactive "r\nP")
7475 (memq (setq article (gnus-summary-article-number))
7476 gnus-newsgroup-unreads))
7477 (gnus-summary-mark-article article gnus-del-mark))
7479 (gnus-summary-find-next))))))
7481 (defun gnus-summary-mark-below (score mark)
7482 "Mark articles with score less than SCORE with MARK."
7483 (interactive "P\ncMark: ")
7484 (gnus-set-global-variables)
7485 (setq score (if score
7486 (prefix-numeric-value score)
7487 (or gnus-summary-default-score 0)))
7489 (set-buffer gnus-summary-buffer)
7490 (goto-char (point-min))
7493 (and (< (gnus-summary-article-score) score)
7494 (gnus-summary-mark-article nil mark))
7495 (gnus-summary-find-next)))))
7497 (defun gnus-summary-kill-below (&optional score)
7498 "Mark articles with score below SCORE as read."
7500 (gnus-set-global-variables)
7501 (gnus-summary-mark-below score gnus-killed-mark))
7503 (defun gnus-summary-clear-above (&optional score)
7504 "Clear all marks from articles with score above SCORE."
7506 (gnus-set-global-variables)
7507 (gnus-summary-mark-above score gnus-unread-mark))
7509 (defun gnus-summary-tick-above (&optional score)
7510 "Tick all articles with score above SCORE."
7512 (gnus-set-global-variables)
7513 (gnus-summary-mark-above score gnus-ticked-mark))
7515 (defun gnus-summary-mark-above (score mark)
7516 "Mark articles with score over SCORE with MARK."
7517 (interactive "P\ncMark: ")
7518 (gnus-set-global-variables)
7519 (setq score (if score
7520 (prefix-numeric-value score)
7521 (or gnus-summary-default-score 0)))
7523 (set-buffer gnus-summary-buffer)
7524 (goto-char (point-min))
7526 (when (> (gnus-summary-article-score) score)
7527 (gnus-summary-mark-article nil mark))
7529 (gnus-summary-find-next)))))
7531 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7532 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7533 (defun gnus-summary-limit-include-expunged (&optional no-error)
7534 "Display all the hidden articles that were expunged for low scores."
7536 (gnus-set-global-variables)
7537 (let ((buffer-read-only nil))
7538 (let ((scored gnus-newsgroup-scored)
7541 (unless (gnus-summary-goto-subject (caar scored))
7542 (and (setq h (gnus-summary-article-header (caar scored)))
7543 (< (cdar scored) gnus-summary-expunge-below)
7545 (setq scored (cdr scored)))
7547 (when (not no-error)
7548 (error "No expunged articles hidden."))
7549 (goto-char (point-min))
7550 (gnus-summary-prepare-unthreaded (nreverse headers))
7551 (goto-char (point-min))
7552 (gnus-summary-position-point)
7555 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7556 "Mark all unread articles in this newsgroup as read.
7557 If prefix argument ALL is non-nil, ticked and dormant articles will
7558 also be marked as read.
7559 If QUIETLY is non-nil, no questions will be asked.
7560 If TO-HERE is non-nil, it should be a point in the buffer. All
7561 articles before this point will be marked as read.
7562 Note that this function will only catch up the unread article
7563 in the current summary buffer limitation.
7564 The number of articles marked as read is returned."
7566 (gnus-set-global-variables)
7570 (not gnus-interactive-catchup) ;Without confirmation?
7574 "Mark absolutely all articles as read? "
7575 "Mark all unread articles as read? ")))
7577 (not gnus-newsgroup-adaptive)
7578 (not gnus-newsgroup-auto-expire)
7579 (not gnus-suppress-duplicates))
7582 (setq gnus-newsgroup-marked nil
7583 gnus-newsgroup-dormant nil))
7584 (setq gnus-newsgroup-unreads nil))
7585 ;; We actually mark all articles as canceled, which we
7586 ;; have to do when using auto-expiry or adaptive scoring.
7587 (gnus-summary-show-all-threads)
7588 (when (gnus-summary-first-subject (not all))
7590 (if to-here (< (point) to-here) t)
7591 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7592 (gnus-summary-find-next (not all)))))
7593 (gnus-set-mode-line 'summary))
7595 (gnus-summary-position-point)))
7597 (defun gnus-summary-catchup-to-here (&optional all)
7598 "Mark all unticked articles before the current one as read.
7599 If ALL is non-nil, also mark ticked and dormant articles as read."
7601 (gnus-set-global-variables)
7603 (gnus-save-hidden-threads
7604 (let ((beg (point)))
7605 ;; We check that there are unread articles.
7606 (when (or all (gnus-summary-find-prev))
7607 (gnus-summary-catchup all t beg)))))
7608 (gnus-summary-position-point))
7610 (defun gnus-summary-catchup-all (&optional quietly)
7611 "Mark all articles in this newsgroup as read."
7613 (gnus-set-global-variables)
7614 (gnus-summary-catchup t quietly))
7616 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7617 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7618 If prefix argument ALL is non-nil, all articles are marked as read."
7620 (gnus-set-global-variables)
7621 (when (gnus-summary-catchup all quietly nil 'fast)
7622 ;; Select next newsgroup or exit.
7623 (if (eq gnus-auto-select-next 'quietly)
7624 (gnus-summary-next-group nil)
7625 (gnus-summary-exit))))
7627 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7628 "Mark all articles in this newsgroup as read, and then exit."
7630 (gnus-set-global-variables)
7631 (gnus-summary-catchup-and-exit t quietly))
7633 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7634 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7635 "Mark all articles in this group as read and select the next group.
7636 If given a prefix, mark all articles, unread as well as ticked, as
7639 (gnus-set-global-variables)
7641 (gnus-summary-catchup all))
7642 (gnus-summary-next-article t nil nil t))
7644 ;; Thread-based commands.
7646 (defun gnus-summary-articles-in-thread (&optional article)
7647 "Return a list of all articles in the current thread.
7648 If ARTICLE is non-nil, return all articles in the thread that starts
7650 (let* ((article (or article (gnus-summary-article-number)))
7651 (data (gnus-data-find-list article))
7652 (top-level (gnus-data-level (car data)))
7654 (cond ((null gnus-thread-operation-ignore-subject)
7655 (gnus-simplify-subject-re
7656 (mail-header-subject (gnus-data-header (car data)))))
7657 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7658 (gnus-simplify-subject-fuzzy
7659 (mail-header-subject (gnus-data-header (car data)))))
7661 (end-point (save-excursion
7662 (if (gnus-summary-go-to-next-thread)
7663 (point) (point-max))))
7666 (< (gnus-data-pos (car data)) end-point))
7667 (when (or (not top-subject)
7668 (string= top-subject
7669 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7670 (gnus-simplify-subject-fuzzy
7671 (mail-header-subject
7672 (gnus-data-header (car data))))
7673 (gnus-simplify-subject-re
7674 (mail-header-subject
7675 (gnus-data-header (car data)))))))
7676 (push (gnus-data-number (car data)) articles))
7677 (unless (and (setq data (cdr data))
7678 (> (gnus-data-level (car data)) top-level))
7680 ;; Return the list of articles.
7681 (nreverse articles)))
7683 (defun gnus-summary-rethread-current ()
7684 "Rethread the thread the current article is part of."
7686 (gnus-set-global-variables)
7687 (let* ((gnus-show-threads t)
7688 (article (gnus-summary-article-number))
7689 (id (mail-header-id (gnus-summary-article-header)))
7690 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7692 (error "No article on the current line"))
7693 (gnus-rebuild-thread id)
7694 (gnus-summary-goto-subject article)))
7696 (defun gnus-summary-reparent-thread ()
7697 "Make current article child of the marked (or previous) article.
7699 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7700 is non-nil or the Subject: of both articles are the same."
7702 (unless (not (gnus-group-read-only-p))
7703 (error "The current newsgroup does not support article editing."))
7704 (unless (<= (length gnus-newsgroup-processable) 1)
7705 (error "No more than one article may be marked."))
7706 (save-window-excursion
7707 (let ((gnus-article-buffer " *reparent*")
7708 (current-article (gnus-summary-article-number))
7709 ; first grab the marked article, otherwise one line up.
7710 (parent-article (if (not (null gnus-newsgroup-processable))
7711 (car gnus-newsgroup-processable)
7713 (if (eq (forward-line -1) 0)
7714 (gnus-summary-article-number)
7715 (error "Beginning of summary buffer."))))))
7716 (unless (not (eq current-article parent-article))
7717 (error "An article may not be self-referential."))
7718 (let ((message-id (mail-header-id
7719 (gnus-summary-article-header parent-article))))
7720 (unless (and message-id (not (equal message-id "")))
7721 (error "No message-id in desired parent."))
7722 (gnus-summary-select-article t t nil current-article)
7723 (set-buffer gnus-article-buffer)
7724 (setq buffer-read-only nil)
7725 (let ((buf (format "%s" (buffer-string))))
7728 (goto-char (point-min))
7729 (if (search-forward-regexp "^References: " nil t)
7730 (insert message-id " " )
7731 (insert "References: " message-id "\n"))
7732 (unless (gnus-request-replace-article current-article
7733 (car gnus-article-current)
7734 gnus-article-buffer)
7735 (error "Couldn't replace article."))
7736 (set-buffer gnus-summary-buffer)
7737 (gnus-summary-unmark-all-processable)
7738 (gnus-summary-rethread-current)
7739 (gnus-message 3 "Article %d is now the child of article %d."
7740 current-article parent-article)))))
7742 (defun gnus-summary-toggle-threads (&optional arg)
7743 "Toggle showing conversation threads.
7744 If ARG is positive number, turn showing conversation threads on."
7746 (gnus-set-global-variables)
7747 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7748 (setq gnus-show-threads
7749 (if (null arg) (not gnus-show-threads)
7750 (> (prefix-numeric-value arg) 0)))
7751 (gnus-summary-prepare)
7752 (gnus-summary-goto-subject current)
7753 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7754 (gnus-summary-position-point)))
7756 (defun gnus-summary-show-all-threads ()
7759 (gnus-set-global-variables)
7761 (let ((buffer-read-only nil))
7762 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7763 (gnus-summary-position-point))
7765 (defun gnus-summary-show-thread ()
7766 "Show thread subtrees.
7767 Returns nil if no thread was there to be shown."
7769 (gnus-set-global-variables)
7770 (let ((buffer-read-only nil)
7772 ;; first goto end then to beg, to have point at beg after let
7773 (end (progn (end-of-line) (point)))
7774 (beg (progn (beginning-of-line) (point))))
7776 ;; Any hidden lines here?
7777 (search-forward "\r" end t)
7778 (subst-char-in-region beg end ?\^M ?\n t)
7780 (gnus-summary-position-point))))
7782 (defun gnus-summary-hide-all-threads ()
7783 "Hide all thread subtrees."
7785 (gnus-set-global-variables)
7787 (goto-char (point-min))
7788 (gnus-summary-hide-thread)
7789 (while (zerop (gnus-summary-next-thread 1 t))
7790 (gnus-summary-hide-thread)))
7791 (gnus-summary-position-point))
7793 (defun gnus-summary-hide-thread ()
7794 "Hide thread subtrees.
7795 Returns nil if no threads were there to be hidden."
7797 (gnus-set-global-variables)
7798 (let ((buffer-read-only nil)
7800 (article (gnus-summary-article-number)))
7802 ;; Go forward until either the buffer ends or the subthread
7804 (when (and (not (eobp))
7805 (or (zerop (gnus-summary-next-thread 1 t))
7806 (goto-char (point-max))))
7808 (if (and (> (point) start)
7809 (search-backward "\n" start t))
7811 (subst-char-in-region start (point) ?\n ?\^M)
7812 (gnus-summary-goto-subject article))
7815 ;;(gnus-summary-position-point)
7818 (defun gnus-summary-go-to-next-thread (&optional previous)
7819 "Go to the same level (or less) next thread.
7820 If PREVIOUS is non-nil, go to previous thread instead.
7821 Return the article number moved to, or nil if moving was impossible."
7822 (let ((level (gnus-summary-thread-level))
7823 (way (if previous -1 1))
7826 (while (and (not (eobp))
7827 (< level (gnus-summary-thread-level)))
7835 (gnus-summary-article-number)
7838 (defun gnus-summary-next-thread (n &optional silent)
7839 "Go to the same level next N'th thread.
7840 If N is negative, search backward instead.
7841 Returns the difference between N and the number of skips actually
7844 If SILENT, don't output messages."
7846 (gnus-set-global-variables)
7847 (let ((backward (< n 0))
7850 (gnus-summary-go-to-next-thread backward))
7853 (gnus-summary-position-point))
7854 (when (and (not silent) (/= 0 n))
7855 (gnus-message 7 "No more threads"))
7858 (defun gnus-summary-prev-thread (n)
7859 "Go to the same level previous N'th thread.
7860 Returns the difference between N and the number of skips actually
7863 (gnus-set-global-variables)
7864 (gnus-summary-next-thread (- n)))
7866 (defun gnus-summary-go-down-thread ()
7867 "Go down one level in the current thread."
7868 (let ((children (gnus-summary-article-children)))
7870 (gnus-summary-goto-subject (car children)))))
7872 (defun gnus-summary-go-up-thread ()
7873 "Go up one level in the current thread."
7874 (let ((parent (gnus-summary-article-parent)))
7876 (gnus-summary-goto-subject parent))))
7878 (defun gnus-summary-down-thread (n)
7879 "Go down thread N steps.
7880 If N is negative, go up instead.
7881 Returns the difference between N and how many steps down that were
7884 (gnus-set-global-variables)
7888 (if up (gnus-summary-go-up-thread)
7889 (gnus-summary-go-down-thread)))
7891 (gnus-summary-position-point)
7893 (gnus-message 7 "Can't go further"))
7896 (defun gnus-summary-up-thread (n)
7897 "Go up thread N steps.
7898 If N is negative, go up instead.
7899 Returns the difference between N and how many steps down that were
7902 (gnus-set-global-variables)
7903 (gnus-summary-down-thread (- n)))
7905 (defun gnus-summary-top-thread ()
7906 "Go to the top of the thread."
7908 (gnus-set-global-variables)
7909 (while (gnus-summary-go-up-thread))
7910 (gnus-summary-article-number))
7912 (defun gnus-summary-kill-thread (&optional unmark)
7913 "Mark articles under current thread as read.
7914 If the prefix argument is positive, remove any kinds of marks.
7915 If the prefix argument is negative, tick articles instead."
7917 (gnus-set-global-variables)
7919 (setq unmark (prefix-numeric-value unmark)))
7920 (let ((articles (gnus-summary-articles-in-thread)))
7922 ;; Expand the thread.
7923 (gnus-summary-show-thread)
7924 ;; Mark all the articles.
7926 (gnus-summary-goto-subject (car articles))
7927 (cond ((null unmark)
7928 (gnus-summary-mark-article-as-read gnus-killed-mark))
7930 (gnus-summary-mark-article-as-unread gnus-unread-mark))
7932 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
7933 (setq articles (cdr articles))))
7934 ;; Hide killed subtrees.
7936 gnus-thread-hide-killed
7937 (gnus-summary-hide-thread))
7938 ;; If marked as read, go to next unread subject.
7940 ;; Go to next unread subject.
7941 (gnus-summary-next-subject 1 t)))
7942 (gnus-set-mode-line 'summary))
7944 ;; Summary sorting commands
7946 (defun gnus-summary-sort-by-number (&optional reverse)
7947 "Sort the summary buffer by article number.
7948 Argument REVERSE means reverse order."
7950 (gnus-summary-sort 'number reverse))
7952 (defun gnus-summary-sort-by-author (&optional reverse)
7953 "Sort the summary buffer by author name alphabetically.
7954 If case-fold-search is non-nil, case of letters is ignored.
7955 Argument REVERSE means reverse order."
7957 (gnus-summary-sort 'author reverse))
7959 (defun gnus-summary-sort-by-subject (&optional reverse)
7960 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
7961 If case-fold-search is non-nil, case of letters is ignored.
7962 Argument REVERSE means reverse order."
7964 (gnus-summary-sort 'subject reverse))
7966 (defun gnus-summary-sort-by-date (&optional reverse)
7967 "Sort the summary buffer by date.
7968 Argument REVERSE means reverse order."
7970 (gnus-summary-sort 'date reverse))
7972 (defun gnus-summary-sort-by-score (&optional reverse)
7973 "Sort the summary buffer by score.
7974 Argument REVERSE means reverse order."
7976 (gnus-summary-sort 'score reverse))
7978 (defun gnus-summary-sort-by-lines (&optional reverse)
7979 "Sort the summary buffer by article length.
7980 Argument REVERSE means reverse order."
7982 (gnus-summary-sort 'lines reverse))
7984 (defun gnus-summary-sort (predicate reverse)
7985 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
7986 (gnus-set-global-variables)
7987 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
7988 (article (intern (format "gnus-article-sort-by-%s" predicate)))
7989 (gnus-thread-sort-functions
7995 (gnus-article-sort-functions
8000 (,article t2 t1)))))
8002 (gnus-summary-prepare-hook nil))
8003 ;; We do the sorting by regenerating the threads.
8004 (gnus-summary-prepare)
8005 ;; Hide subthreads if needed.
8006 (when (and gnus-show-threads gnus-thread-hide-subtree)
8007 (gnus-summary-hide-all-threads))))
8009 ;; Summary saving commands.
8011 (defun gnus-summary-save-article (&optional n not-saved)
8012 "Save the current article using the default saver function.
8013 If N is a positive number, save the N next articles.
8014 If N is a negative number, save the N previous articles.
8015 If N is nil and any articles have been marked with the process mark,
8016 save those articles instead.
8017 The variable `gnus-default-article-saver' specifies the saver function."
8019 (gnus-set-global-variables)
8020 (let* ((articles (gnus-summary-work-articles n))
8021 (save-buffer (save-excursion
8022 (nnheader-set-temp-buffer " *Gnus Save*")))
8023 (num (length articles))
8024 header article file)
8026 (setq header (gnus-summary-article-header
8027 (setq article (pop articles))))
8028 (if (not (vectorp header))
8029 ;; This is a pseudo-article.
8030 (if (assq 'name header)
8031 (gnus-copy-file (cdr (assq 'name header)))
8032 (gnus-message 1 "Article %d is unsaveable" article))
8033 ;; This is a real article.
8034 (save-window-excursion
8035 (gnus-summary-select-article t nil nil article))
8037 (set-buffer save-buffer)
8039 (insert-buffer-substring gnus-original-article-buffer))
8040 (setq file (gnus-article-save save-buffer file num))
8041 (gnus-summary-remove-process-mark article)
8043 (gnus-summary-set-saved-mark article))))
8044 (gnus-kill-buffer save-buffer)
8045 (gnus-summary-position-point)
8046 (gnus-set-mode-line 'summary)
8049 (defun gnus-summary-pipe-output (&optional arg)
8050 "Pipe the current article to a subprocess.
8051 If N is a positive number, pipe the N next articles.
8052 If N is a negative number, pipe the N previous articles.
8053 If N is nil and any articles have been marked with the process mark,
8054 pipe those articles instead."
8056 (gnus-set-global-variables)
8057 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8058 (gnus-summary-save-article arg t))
8059 (gnus-configure-windows 'pipe))
8061 (defun gnus-summary-save-article-mail (&optional arg)
8062 "Append the current article to an mail file.
8063 If N is a positive number, save the N next articles.
8064 If N is a negative number, save the N previous articles.
8065 If N is nil and any articles have been marked with the process mark,
8066 save those articles instead."
8068 (gnus-set-global-variables)
8069 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8070 (gnus-summary-save-article arg)))
8072 (defun gnus-summary-save-article-rmail (&optional arg)
8073 "Append the current article to an rmail file.
8074 If N is a positive number, save the N next articles.
8075 If N is a negative number, save the N previous articles.
8076 If N is nil and any articles have been marked with the process mark,
8077 save those articles instead."
8079 (gnus-set-global-variables)
8080 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8081 (gnus-summary-save-article arg)))
8083 (defun gnus-summary-save-article-file (&optional arg)
8084 "Append the current article to a file.
8085 If N is a positive number, save the N next articles.
8086 If N is a negative number, save the N previous articles.
8087 If N is nil and any articles have been marked with the process mark,
8088 save those articles instead."
8090 (gnus-set-global-variables)
8091 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8092 (gnus-summary-save-article arg)))
8094 (defun gnus-summary-write-article-file (&optional arg)
8095 "Write the current article to a file, deleting the previous file.
8096 If N is a positive number, save the N next articles.
8097 If N is a negative number, save the N previous articles.
8098 If N is nil and any articles have been marked with the process mark,
8099 save those articles instead."
8101 (gnus-set-global-variables)
8102 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8103 (gnus-summary-save-article arg)))
8105 (defun gnus-summary-save-article-body-file (&optional arg)
8106 "Append the current article body to a file.
8107 If N is a positive number, save the N next articles.
8108 If N is a negative number, save the N previous articles.
8109 If N is nil and any articles have been marked with the process mark,
8110 save those articles instead."
8112 (gnus-set-global-variables)
8113 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8114 (gnus-summary-save-article arg)))
8116 (defun gnus-summary-pipe-message (program)
8117 "Pipe the current article through PROGRAM."
8118 (interactive "sProgram: ")
8119 (gnus-set-global-variables)
8120 (gnus-summary-select-article)
8121 (let ((mail-header-separator "")
8122 (art-buf (get-buffer gnus-article-buffer)))
8123 (gnus-eval-in-buffer-window gnus-article-buffer
8126 (let ((start (window-start))
8128 (message-pipe-buffer-body program)
8129 (set-window-start (get-buffer-window (current-buffer)) start))))))
8131 (defun gnus-get-split-value (methods)
8132 "Return a value based on the split METHODS."
8133 (let (split-name method result match)
8136 (set-buffer gnus-original-article-buffer)
8138 (nnheader-narrow-to-headers)
8140 (goto-char (point-min))
8141 (setq method (pop methods))
8142 (setq match (car method))
8145 ;; Regular expression.
8147 (re-search-forward match nil t)))
8148 ((gnus-functionp match)
8152 (setq result (funcall match gnus-newsgroup-name))))
8157 (setq result (eval match)))))
8158 (setq split-name (append (cdr method) split-name))
8159 (cond ((stringp result)
8160 (push (expand-file-name
8161 result gnus-article-save-directory)
8164 (setq split-name (append result split-name)))))))))
8167 (defun gnus-valid-move-group-p (group)
8172 (car (gnus-find-method-for-group
8173 (symbol-name group))))
8174 gnus-valid-select-methods))))
8176 (defun gnus-read-move-group-name (prompt default articles prefix)
8177 "Read a group name."
8178 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8179 (minibuffer-confirm-incomplete nil) ; XEmacs
8183 (if (> (length articles) 1)
8184 (format "these %d articles" (length articles))
8189 (gnus-completing-read default prom
8191 'gnus-valid-move-group-p
8193 'gnus-group-history))
8194 ((= 1 (length split-name))
8195 (gnus-completing-read (car split-name) prom
8197 'gnus-valid-move-group-p
8199 'gnus-group-history))
8201 (gnus-completing-read nil prom
8202 (mapcar (lambda (el) (list el))
8203 (nreverse split-name))
8205 'gnus-group-history)))))
8207 (if (or (string= to-newsgroup "")
8208 (string= to-newsgroup prefix))
8209 (setq to-newsgroup (or default "")))
8210 (or (gnus-active to-newsgroup)
8211 (gnus-activate-group to-newsgroup)
8212 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8214 (or (and (gnus-request-create-group
8215 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8216 (gnus-activate-group to-newsgroup nil nil
8217 (gnus-group-name-to-method
8219 (error "Couldn't create group %s" to-newsgroup)))
8220 (error "No such group: %s" to-newsgroup)))
8223 ;; Summary extract commands
8225 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8226 (let ((buffer-read-only nil)
8227 (article (gnus-summary-article-number))
8229 (unless (gnus-summary-goto-subject article)
8230 (error "No such article: %d" article))
8231 (gnus-summary-position-point)
8232 ;; If all commands are to be bunched up on one line, we collect
8234 (unless gnus-view-pseudos-separately
8235 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8238 (setq action (cdr (assq 'action (car ps))))
8239 (setq files (list (cdr (assq 'name (car ps)))))
8240 (while (and ps (cdr ps)
8241 (string= (or action "1")
8242 (or (cdr (assq 'action (cadr ps))) "2")))
8243 (push (cdr (assq 'name (cadr ps))) files)
8244 (setcdr ps (cddr ps)))
8246 (when (not (string-match "%s" action))
8249 (when (assq 'execute (car ps))
8250 (setcdr (assq 'execute (car ps))
8251 (funcall (if (string-match "%s" action)
8258 (gnus-quote-arg-for-sh-or-csh f)))
8260 (setq ps (cdr ps)))))
8261 (if (and gnus-view-pseudos (not not-view))
8263 (when (assq 'execute (car pslist))
8264 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8265 (eq gnus-view-pseudos 'not-confirm)))
8266 (setq pslist (cdr pslist)))
8269 (setq after-article (or (cdr (assq 'article (car pslist)))
8270 (gnus-summary-article-number)))
8271 (gnus-summary-goto-subject after-article)
8274 (insert " " (file-name-nondirectory
8275 (cdr (assq 'name (car pslist))))
8276 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8278 (forward-line -1) ; back to `b'
8279 (gnus-add-text-properties
8280 b (1- e) (list 'gnus-number gnus-reffed-article-number
8281 gnus-mouse-face-prop gnus-mouse-face))
8283 after-article gnus-reffed-article-number
8284 gnus-unread-mark b (car pslist) 0 (- e b))
8285 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8286 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8287 (setq pslist (cdr pslist)))))))
8289 (defun gnus-pseudos< (p1 p2)
8290 (let ((c1 (cdr (assq 'action p1)))
8291 (c2 (cdr (assq 'action p2))))
8292 (and c1 c2 (string< c1 c2))))
8294 (defun gnus-request-pseudo-article (props)
8295 (cond ((assq 'execute props)
8296 (gnus-execute-command (cdr (assq 'execute props)))))
8297 (let ((gnus-current-article (gnus-summary-article-number)))
8298 (run-hooks 'gnus-mark-article-hook)))
8300 (defun gnus-execute-command (command &optional automatic)
8302 (gnus-article-setup-buffer)
8303 (set-buffer gnus-article-buffer)
8304 (setq buffer-read-only nil)
8305 (let ((command (if automatic command (read-string "Command: " command)))
8306 ;; Just binding this here doesn't help, because there might
8307 ;; be output from the process after exiting the scope of
8309 ;; (buffer-read-only nil)
8312 (insert "$ " command "\n\n")
8313 (if gnus-view-pseudo-asynchronously
8314 (start-process "gnus-execute" nil shell-file-name
8315 shell-command-switch command)
8316 (call-process shell-file-name nil t nil
8317 shell-command-switch command)))))
8319 ;; Summary kill commands.
8321 (defun gnus-summary-edit-global-kill (article)
8322 "Edit the \"global\" kill file."
8323 (interactive (list (gnus-summary-article-number)))
8324 (gnus-set-global-variables)
8325 (gnus-group-edit-global-kill article))
8327 (defun gnus-summary-edit-local-kill ()
8328 "Edit a local kill file applied to the current newsgroup."
8330 (gnus-set-global-variables)
8331 (setq gnus-current-headers (gnus-summary-article-header))
8332 (gnus-set-global-variables)
8333 (gnus-group-edit-local-kill
8334 (gnus-summary-article-number) gnus-newsgroup-name))
8338 (defun gnus-read-header (id &optional header)
8339 "Read the headers of article ID and enter them into the Gnus system."
8340 (let ((group gnus-newsgroup-name)
8341 (gnus-override-method
8342 (and (gnus-news-group-p gnus-newsgroup-name)
8343 gnus-refer-article-method))
8345 ;; First we check to see whether the header in question is already
8348 ;; This is a Message-ID.
8349 (setq header (or header (gnus-id-to-header id)))
8350 ;; This is an article number.
8351 (setq header (or header (gnus-summary-article-header id))))
8353 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8354 ;; We have found the header.
8356 ;; We have to really fetch the header to this article.
8358 (set-buffer nntp-server-buffer)
8359 (when (setq where (gnus-request-head id group))
8360 (nnheader-fold-continuation-lines)
8361 (goto-char (point-max))
8363 (goto-char (point-min))
8367 ((cdr where) (cdr where))
8368 (header (mail-header-number header))
8369 (t gnus-reffed-article-number))
8371 (insert " Article retrieved.\n"))
8373 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8374 () ; Malformed head.
8375 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8376 (when (and (stringp id)
8377 (not (string= (gnus-group-real-name group)
8379 ;; If we fetched by Message-ID and the article came
8380 ;; from a different group, we fudge some bogus article
8381 ;; numbers for this article.
8382 (mail-header-set-number header gnus-reffed-article-number))
8384 (set-buffer gnus-summary-buffer)
8385 (decf gnus-reffed-article-number)
8386 (gnus-remove-header (mail-header-number header))
8387 (push header gnus-newsgroup-headers)
8388 (setq gnus-current-headers header)
8389 (push (mail-header-number header) gnus-newsgroup-limit)))
8392 (defun gnus-remove-header (number)
8393 "Remove header NUMBER from `gnus-newsgroup-headers'."
8394 (if (and gnus-newsgroup-headers
8395 (= number (mail-header-number (car gnus-newsgroup-headers))))
8396 (pop gnus-newsgroup-headers)
8397 (let ((headers gnus-newsgroup-headers))
8398 (while (and (cdr headers)
8399 (not (= number (mail-header-number (cadr headers)))))
8402 (setcdr headers (cddr headers))))))
8405 ;;; summary highlights
8408 (defun gnus-highlight-selected-summary ()
8409 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8410 ;; Highlight selected article in summary buffer
8411 (when gnus-summary-selected-face
8413 (let* ((beg (progn (beginning-of-line) (point)))
8414 (end (progn (end-of-line) (point)))
8415 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8416 (from (if (get-text-property beg gnus-mouse-face-prop)
8418 (or (next-single-property-change
8419 beg gnus-mouse-face-prop nil end)
8424 (or (next-single-property-change
8425 from gnus-mouse-face-prop nil end)
8427 ;; If no mouse-face prop on line we will have to = from = end,
8428 ;; so we highlight the entire line instead.
8429 (when (= (+ to 2) from)
8432 (if gnus-newsgroup-selected-overlay
8433 ;; Move old overlay.
8435 gnus-newsgroup-selected-overlay from to (current-buffer))
8436 ;; Create new overlay.
8438 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8439 'face gnus-summary-selected-face))))))
8441 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8442 (defun gnus-summary-highlight-line ()
8443 "Highlight current line according to `gnus-summary-highlight'."
8444 (let* ((list gnus-summary-highlight)
8446 (end (progn (end-of-line) (point)))
8447 ;; now find out where the line starts and leave point there.
8448 (beg (progn (beginning-of-line) (point)))
8449 (article (gnus-summary-article-number))
8450 (score (or (cdr (assq (or article gnus-current-article)
8451 gnus-newsgroup-scored))
8452 gnus-summary-default-score 0))
8453 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8454 (inhibit-read-only t))
8455 ;; Eval the cars of the lists until we find a match.
8456 (let ((default gnus-summary-default-score))
8458 (not (eval (caar list))))
8459 (setq list (cdr list))))
8460 (let ((face (cdar list)))
8461 (unless (eq face (get-text-property beg 'face))
8462 (gnus-put-text-property
8464 (setq face (if (boundp face) (symbol-value face) face)))
8465 (when gnus-summary-highlight-line-function
8466 (funcall gnus-summary-highlight-line-function article face))))
8469 (defun gnus-update-read-articles (group unread)
8470 "Update the list of read articles in GROUP."
8471 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8472 (entry (gnus-gethash group gnus-newsrc-hashtb))
8473 (info (nth 2 entry))
8475 (unread (sort (copy-sequence unread) '<))
8477 (if (or (not info) (not active))
8478 ;; There is no info on this group if it was, in fact,
8479 ;; killed. Gnus stores no information on killed groups, so
8480 ;; there's nothing to be done.
8481 ;; One could store the information somewhere temporarily,
8482 ;; perhaps... Hmmm...
8484 ;; Remove any negative articles numbers.
8485 (while (and unread (< (car unread) 0))
8486 (setq unread (cdr unread)))
8487 ;; Remove any expired article numbers
8488 (while (and unread (< (car unread) (car active)))
8489 (setq unread (cdr unread)))
8490 ;; Compute the ranges of read articles by looking at the list of
8493 (when (/= (car unread) prev)
8494 (push (if (= prev (1- (car unread))) prev
8495 (cons prev (1- (car unread))))
8497 (setq prev (1+ (car unread)))
8498 (setq unread (cdr unread)))
8499 (when (<= prev (cdr active))
8500 (push (cons prev (cdr active)) read))
8502 (set-buffer gnus-group-buffer)
8505 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8506 (gnus-info-set-read ',info ',(gnus-info-read info))
8507 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8508 (gnus-group-update-group ,group t))))
8509 ;; Enter this list into the group info.
8511 info (if (> (length read) 1) (nreverse read) read))
8512 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8513 (gnus-get-unread-articles-in-group info (gnus-active group))
8516 (defun gnus-offer-save-summaries ()
8517 "Offer to save all active summary buffers."
8519 (let ((buflist (buffer-list))
8521 ;; Go through all buffers and find all summaries.
8523 (and (setq bufname (buffer-name (car buflist)))
8524 (string-match "Summary" bufname)
8526 (set-buffer bufname)
8527 ;; We check that this is, indeed, a summary buffer.
8528 (and (eq major-mode 'gnus-summary-mode)
8529 ;; Also make sure this isn't bogus.
8530 gnus-newsgroup-prepared
8531 ;; Also make sure that this isn't a dead summary buffer.
8532 (not gnus-dead-summary-mode)))
8533 (push bufname buffers))
8534 (setq buflist (cdr buflist)))
8535 ;; Go through all these summary buffers and offer to save them.
8538 "Update summary buffer %s? "
8539 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8544 (run-hooks 'gnus-sum-load-hook)
8546 ;;; gnus-sum.el ends here