1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996 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 ;; Belongs to to gnus.el
36 (defgroup gnus-various nil
38 :link '(custom-manual "(gnus)Various Various")
41 ;; Belongs to to gnus-group.el
42 (defgroup gnus-group-select nil
44 :link '(custom-manual "(gnus)Selecting a Group")
47 ;; Belongs to to gnus-uu.el
48 (defgroup gnus-extract-view nil
49 "Viewing extracted files."
50 :link '(custom-manual "(gnus)Viewing Files")
53 ;; Belongs to article.el
54 (defgroup article-hiding-headers nil
55 "Hiding headers in the article buffer."
56 :link '(custom-manual "(gnus)Hiding Headers")
59 (defgroup article-various nil
60 "Miscellaneous article options."
61 :link '(custom-manual "(gnus)Misc Article")
64 (defgroup article-mime nil
65 "Encoding articles and including attachments."
66 :link '(custom-manual "(gnus)Using MIME")
70 (defgroup gnus-summary nil
72 :link '(custom-manual "(gnus)The Summary Buffer")
75 (defgroup gnus-summary-exit nil
76 "Leaving summary buffers."
77 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
80 (defgroup gnus-summary-marks nil
81 "Marks used in summary buffers."
82 :link '(custom-manual "(gnus)Marking Articles")
85 (defgroup gnus-thread nil
86 "Ordering articles according to replies."
87 :link '(custom-manual "(gnus)Threading")
90 (defgroup gnus-summary-format nil
91 "Formatting of the summary buffer."
92 :link '(custom-manual "(gnus)Summary Buffer Format")
95 (defgroup gnus-summary-choose nil
97 :link '(custom-manual "(gnus)Choosing Articles")
100 (defgroup gnus-summary-maneuvering nil
101 "Summary movement commands."
102 :link '(custom-manual "(gnus)Summary Maneuvering")
103 :group 'gnus-summary)
105 (defgroup gnus-summary-mail nil
106 "Mail group commands."
107 :link '(custom-manual "(gnus)Mail Group Commands")
108 :group 'gnus-summary)
110 (defgroup gnus-summary-sort nil
111 "Sorting the summary buffer."
112 :link '(custom-manual "(gnus)Sorting")
113 :group 'gnus-summary)
115 (defgroup gnus-summary-visual nil
116 "Highlighting and menus in the summary buffer."
117 :link '(custom-manual "(gnus)Summary Highlighting")
119 :group 'gnus-summary)
121 (defgroup gnus-summary-various nil
122 "Various summary buffer options."
123 :link '(custom-manual "(gnus)Various Summary Stuff")
124 :group 'gnus-summary)
126 (defcustom gnus-kill-summary-on-exit t
127 "*If non-nil, kill the summary buffer when you exit from it.
128 If nil, the summary will become a \"*Dead Summary*\" buffer, and
129 it will be killed sometime later."
130 :group 'gnus-summary-exit
133 (defcustom gnus-fetch-old-headers nil
134 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
135 If an unread article in the group refers to an older, already read (or
136 just marked as read) article, the old article will not normally be
137 displayed in the Summary buffer. If this variable is non-nil, Gnus
138 will attempt to grab the headers to the old articles, and thereby
139 build complete threads. If it has the value `some', only enough
140 headers to connect otherwise loose threads will be displayed.
141 This variable can also be a number. In that case, no more than that
142 number of old headers will be fetched.
144 The server has to support NOV for any of this to work."
146 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "other" t)))
151 (defcustom gnus-summary-make-false-root 'adopt
152 "*nil means that Gnus won't gather loose threads.
153 If the root of a thread has expired or been read in a previous
154 session, the information necessary to build a complete thread has been
155 lost. Instead of having many small sub-threads from this original thread
156 scattered all over the summary buffer, Gnus can gather them.
158 If non-nil, Gnus will try to gather all loose sub-threads from an
159 original thread into one large thread.
161 If this variable is non-nil, it should be one of `none', `adopt',
164 If this variable is `none', Gnus will not make a false root, but just
165 present the sub-threads after another.
166 If this variable is `dummy', Gnus will create a dummy root that will
167 have all the sub-threads as children.
168 If this variable is `adopt', Gnus will make one of the \"children\"
169 the parent and mark all the step-children as such.
170 If this variable is `empty', the \"children\" are printed with empty
171 subject fields. (Or rather, they will be printed with a string
172 given by the `gnus-summary-same-subject' variable.)"
174 :type '(choice (const :tag "off" nil)
180 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
181 "*A regexp to match subjects to be excluded from loose thread gathering.
182 As loose thread gathering is done on subjects only, that means that
183 there can be many false gatherings performed. By rooting out certain
184 common subjects, gathering might become saner."
188 (defcustom gnus-summary-gather-subject-limit nil
189 "*Maximum length of subject comparisons when gathering loose threads.
190 Use nil to compare full subjects. Setting this variable to a low
191 number will help gather threads that have been corrupted by
192 newsreaders chopping off subject lines, but it might also mean that
193 unrelated articles that have subject that happen to begin with the
194 same few characters will be incorrectly gathered.
196 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
199 :type '(choice (const :tag "off" nil)
201 (sexp :menu-tag "on" t)))
203 (defcustom gnus-simplify-ignored-prefixes nil
204 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
206 :type '(choice (const :tag "off" nil)
209 (defcustom gnus-build-sparse-threads nil
210 "*If non-nil, fill in the gaps in threads.
211 If `some', only fill in the gaps that are needed to tie loose threads
212 together. If `more', fill in all leaf nodes that Gnus can find. If
213 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
215 :type '(choice (const :tag "off" nil)
218 (sexp :menu-tag "all" t)))
220 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
221 "Function used for gathering loose threads.
222 There are two pre-defined functions: `gnus-gather-threads-by-subject',
223 which only takes Subjects into consideration; and
224 `gnus-gather-threads-by-references', which compared the References
225 headers of the articles to find matches."
227 :type '(set (function-item gnus-gather-threads-by-subject)
228 (function-item gnus-gather-threads-by-references)
229 (function :tag "other")))
231 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
232 (defcustom gnus-summary-same-subject ""
233 "*String indicating that the current article has the same subject as the previous.
234 This variable will only be used if the value of
235 `gnus-summary-make-false-root' is `empty'."
236 :group 'gnus-summary-format
239 (defcustom gnus-summary-goto-unread t
240 "*If t, marking commands will go to the next unread article.
241 If `never', commands that usually go to the next unread article, will
242 go to the next article, whether it is read or not.
243 If nil, only the marking commands will go to the next (un)read article."
244 :group 'gnus-summary-marks
245 :link '(custom-manual "(gnus)Setting Marks")
246 :type '(choice (const :tag "off" nil)
248 (sexp :menu-tag "on" t)))
250 (defcustom gnus-summary-default-score 0
251 "*Default article score level.
252 If this variable is nil, scoring will be disabled."
254 :type '(choice (const :tag "disable")
257 (defcustom gnus-summary-zcore-fuzz 0
258 "*Fuzziness factor for the zcore in the summary buffer.
259 Articles with scores closer than this to `gnus-summary-default-score'
261 :group 'gnus-summary-format
264 (defcustom gnus-simplify-subject-fuzzy-regexp nil
265 "*Strings to be removed when doing fuzzy matches.
266 This can either be a regular expression or list of regular expressions
267 that will be removed from subject strings if fuzzy subject
268 simplification is selected."
270 :type '(repeat regexp))
272 (defcustom gnus-show-threads t
273 "*If non-nil, display threads in summary mode."
277 (defcustom gnus-thread-hide-subtree nil
278 "*If non-nil, hide all threads initially.
279 If threads are hidden, you have to run the command
280 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
281 to expose hidden threads."
285 (defcustom gnus-thread-hide-killed t
286 "*If non-nil, hide killed threads automatically."
290 (defcustom gnus-thread-ignore-subject nil
291 "*If non-nil, ignore subjects and do all threading based on the Reference header.
292 If nil, which is the default, articles that have different subjects
293 from their parents will start separate threads."
297 (defcustom gnus-thread-operation-ignore-subject t
298 "*If non-nil, subjects will be ignored when doing thread commands.
299 This affects commands like `gnus-summary-kill-thread' and
300 `gnus-summary-lower-thread'.
302 If this variable is nil, articles in the same thread with different
303 subjects will not be included in the operation in question. If this
304 variable is `fuzzy', only articles that have subjects that are fuzzily
305 equal will be included."
307 :type '(choice (const :tag "off" nil)
311 (defcustom gnus-thread-indent-level 4
312 "*Number that says how much each sub-thread should be indented."
316 (defcustom gnus-auto-extend-newsgroup t
317 "*If non-nil, extend newsgroup forward and backward when requested."
318 :group 'gnus-summary-choose
321 (defcustom gnus-auto-select-first t
322 "*If nil, don't select the first unread article when entering a group.
323 If this variable is `best', select the highest-scored unread article
324 in the group. If neither nil nor `best', select the first unread
327 If you want to prevent automatic selection of the first unread article
328 in some newsgroups, set the variable to nil in
329 `gnus-select-group-hook'."
330 :group 'gnus-group-select
331 :type '(choice (const :tag "none" nil)
333 (sexp :menu-tag "first" t)))
335 (defcustom gnus-auto-select-next t
336 "*If non-nil, offer to go to the next group from the end of the previous.
337 If the value is t and the next newsgroup is empty, Gnus will exit
338 summary mode and go back to group mode. If the value is neither nil
339 nor t, Gnus will select the following unread newsgroup. In
340 particular, if the value is the symbol `quietly', the next unread
341 newsgroup will be selected without any confirmation, and if it is
342 `almost-quietly', the next group will be selected without any
343 confirmation if you are located on the last article in the group.
344 Finally, if this variable is `slightly-quietly', the `Z n' command
345 will go to the next group without confirmation."
346 :group 'gnus-summary-maneuvering
347 :type '(choice (const :tag "off" nil)
349 (const almost-quietly)
350 (const slightly-quietly)
351 (sexp :menu-tag "on" t)))
353 (defcustom gnus-auto-select-same nil
354 "*If non-nil, select the next article with the same subject."
355 :group 'gnus-summary-maneuvering
358 (defcustom gnus-summary-check-current nil
359 "*If non-nil, consider the current article when moving.
360 The \"unread\" movement commands will stay on the same line if the
361 current article is unread."
362 :group 'gnus-summary-maneuvering
365 (defcustom gnus-auto-center-summary t
366 "*If non-nil, always center the current summary buffer.
367 In particular, if `vertical' do only vertical recentering. If non-nil
368 and non-`vertical', do both horizontal and vertical recentering."
369 :group 'gnus-summary-maneuvering
370 :type '(choice (const :tag "none" nil)
372 (sexp :menu-tag "both" t)))
374 (defcustom gnus-show-all-headers nil
375 "*If non-nil, don't hide any headers."
376 :group 'article-hiding-headers
379 (defcustom gnus-single-article-buffer t
380 "*If non-nil, display all articles in the same buffer.
381 If nil, each group will get its own article buffer."
382 :group 'article-various
385 (defcustom gnus-break-pages t
386 "*If non-nil, do page breaking on articles.
387 The page delimiter is specified by the `gnus-page-delimiter'
389 :group 'article-various
392 (defcustom gnus-show-mime nil
393 "*If non-nil, do mime processing of articles.
394 The articles will simply be fed to the function given by
395 `gnus-show-mime-method'."
399 (defcustom gnus-move-split-methods nil
400 "*Variable used to suggest where articles are to be moved to.
401 It uses the same syntax as the `gnus-split-methods' variable."
402 :group 'gnus-summary-mail
403 :type '(repeat (choice (list function)
404 (cons regexp (repeat string))
407 ;; Mark variables suggested by Thomas Michanek
408 ;; <Thomas.Michanek@telelogic.se>.
410 (defcustom gnus-unread-mark ?
411 "*Mark used for unread articles."
412 :group 'gnus-summary-marks
415 (defcustom gnus-ticked-mark ?!
416 "*Mark used for ticked articles."
417 :group 'gnus-summary-marks
420 (defcustom gnus-dormant-mark ??
421 "*Mark used for dormant articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-del-mark ?r
426 "*Mark used for del'd articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-read-mark ?R
431 "*Mark used for read articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-expirable-mark ?E
436 "*Mark used for expirable articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-killed-mark ?K
441 "*Mark used for killed articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-souped-mark ?F
446 "*Mark used for killed articles."
447 :group 'gnus-summary-marks
450 (defcustom gnus-kill-file-mark ?X
451 "*Mark used for articles killed by kill files."
452 :group 'gnus-summary-marks
455 (defcustom gnus-low-score-mark ?Y
456 "*Mark used for articles with a low score."
457 :group 'gnus-summary-marks
460 (defcustom gnus-catchup-mark ?C
461 "*Mark used for articles that are caught up."
462 :group 'gnus-summary-marks
465 (defcustom gnus-replied-mark ?A
466 "*Mark used for articles that have been replied to."
467 :group 'gnus-summary-marks
470 (defcustom gnus-cached-mark ?*
471 "*Mark used for articles that are in the cache."
472 :group 'gnus-summary-marks
475 (defcustom gnus-saved-mark ?S
476 "*Mark used for articles that have been saved to."
477 :group 'gnus-summary-marks
480 (defcustom gnus-ancient-mark ?O
481 "*Mark used for ancient articles."
482 :group 'gnus-summary-marks
485 (defcustom gnus-sparse-mark ?Q
486 "*Mark used for sparsely reffed articles."
487 :group 'gnus-summary-marks
490 (defcustom gnus-canceled-mark ?G
491 "*Mark used for canceled articles."
492 :group 'gnus-summary-marks
495 (defcustom gnus-duplicate-mark ?M
496 "*Mark used for duplicate articles."
497 :group 'gnus-summary-marks
500 (defcustom gnus-score-over-mark ?+
501 "*Score mark used for articles with high scores."
502 :group 'gnus-summary-marks
505 (defcustom gnus-score-below-mark ?-
506 "*Score mark used for articles with low scores."
507 :group 'gnus-summary-marks
510 (defcustom gnus-empty-thread-mark ?
511 "*There is no thread under the article."
512 :group 'gnus-summary-marks
515 (defcustom gnus-not-empty-thread-mark ?=
516 "*There is a thread under the article."
517 :group 'gnus-summary-marks
520 (defcustom gnus-view-pseudo-asynchronously nil
521 "*If non-nil, Gnus will view pseudo-articles asynchronously."
522 :group 'gnus-extract-view
525 (defcustom gnus-view-pseudos nil
526 "*If `automatic', pseudo-articles will be viewed automatically.
527 If `not-confirm', pseudos will be viewed automatically, and the user
528 will not be asked to confirm the command."
529 :group 'gnus-extract-view
530 :type '(choice (const :tag "off" nil)
532 (const not-confirm)))
534 (defcustom gnus-view-pseudos-separately t
535 "*If non-nil, one pseudo-article will be created for each file to be viewed.
536 If nil, all files that use the same viewing command will be given as a
537 list of parameters to that command."
538 :group 'gnus-extract-view
541 (defcustom gnus-insert-pseudo-articles t
542 "*If non-nil, insert pseudo-articles when decoding articles."
543 :group 'gnus-extract-view
546 (defcustom gnus-summary-dummy-line-format
548 "*The format specification for the dummy roots in the summary buffer.
549 It works along the same lines as a normal formatting string,
550 with some simple extensions.
553 :group 'gnus-threading
556 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
557 "*The format specification for the summary mode line.
558 It works along the same lines as a normal formatting string,
559 with some simple extensions:
562 %p Unprefixed group name
563 %A Current article number
565 %U Number of unread articles in the group
566 %e Number of unselected articles in the group
567 %Z A string with unread/unselected article counts
568 %g Shortish group name
569 %S Subject of the current article
571 %s Current score file name
572 %d Number of dormant articles
573 %r Number of articles that have been marked as read in this session
574 %E Number of articles expunged by the score files"
575 :group 'gnus-summary-format
578 (defcustom gnus-summary-mark-below 0
579 "*Mark all articles with a score below this variable as read.
580 This variable is local to each summary buffer and usually set by the
585 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
586 "*List of functions used for sorting articles in the summary buffer.
587 This variable is only used when not using a threaded display."
588 :group 'gnus-summary-sort
589 :type '(repeat (choice (function-item gnus-article-sort-by-number)
590 (function-item gnus-article-sort-by-author)
591 (function-item gnus-article-sort-by-subject)
592 (function-item gnus-article-sort-by-date)
593 (function-item gnus-article-sort-by-score)
594 (function :tag "other"))))
596 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
597 "*List of functions used for sorting threads in the summary buffer.
598 By default, threads are sorted by article number.
600 Each function takes two threads and return non-nil if the first thread
601 should be sorted before the other. If you use more than one function,
602 the primary sort function should be the last. You should probably
603 always include `gnus-thread-sort-by-number' in the list of sorting
604 functions -- preferably first.
606 Ready-made functions include `gnus-thread-sort-by-number',
607 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
608 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
609 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
610 :group 'gnus-summary-sort
611 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
612 (function-item gnus-thread-sort-by-author)
613 (function-item gnus-thread-sort-by-subject)
614 (function-item gnus-thread-sort-by-date)
615 (function-item gnus-thread-sort-by-score)
616 (function-item gnus-thread-sort-by-total-score)
617 (function :tag "other"))))
619 (defcustom gnus-thread-score-function '+
620 "*Function used for calculating the total score of a thread.
622 The function is called with the scores of the article and each
623 subthread and should then return the score of the thread.
625 Some functions you can use are `+', `max', or `min'."
626 :group 'gnus-summary-sort
629 (defcustom gnus-summary-expunge-below nil
630 "All articles that have a score less than this variable will be expunged."
632 :type '(choice (const :tag "off" nil)
635 (defcustom gnus-thread-expunge-below nil
636 "All threads that have a total score less than this variable will be expunged.
637 See `gnus-thread-score-function' for en explanation of what a
638 \"thread score\" is."
639 :group 'gnus-treading
641 :type '(choice (const :tag "off" nil)
644 (defcustom gnus-summary-mode-hook nil
645 "*A hook for Gnus summary mode.
646 This hook is run before any variables are set in the summary buffer."
647 :group 'gnus-summary-various
650 (defcustom gnus-summary-menu-hook nil
651 "*Hook run after the creation of the summary mode menu."
652 :group 'gnus-summary-visual
655 (defcustom gnus-summary-exit-hook nil
656 "*A hook called on exit from the summary buffer."
657 :group 'gnus-summary-exit
660 (defcustom gnus-summary-prepare-hook nil
661 "*A hook called after the summary buffer has been generated.
662 If you want to modify the summary buffer, you can use this hook."
663 :group 'gnus-summary-various
666 (defcustom gnus-summary-generate-hook nil
667 "*A hook run just before generating the summary buffer.
668 This hook is commonly used to customize threading variables and the
670 :group 'gnus-summary-various
673 (defcustom gnus-select-group-hook nil
674 "*A hook called when a newsgroup is selected.
676 If you'd like to simplify subjects like the
677 `gnus-summary-next-same-subject' command does, you can use the
680 (setq gnus-select-group-hook
683 (mapcar (lambda (header)
684 (mail-header-set-subject
686 (gnus-simplify-subject
687 (mail-header-subject header) 're-only)))
688 gnus-newsgroup-headers))))"
689 :group 'gnus-group-select
692 (defcustom gnus-select-article-hook nil
693 "*A hook called when an article is selected."
694 :group 'gnus-summary-choose
697 (defcustom gnus-visual-mark-article-hook
698 (list 'gnus-highlight-selected-summary)
699 "*Hook run after selecting an article in the summary buffer.
700 It is meant to be used for highlighting the article in some way. It
701 is not run if `gnus-visual' is nil."
702 :group 'gnus-summary-visual
705 (defcustom gnus-parse-headers-hook
706 (list 'gnus-decode-rfc1522)
707 "*A hook called before parsing the headers."
711 (defcustom gnus-exit-group-hook nil
712 "*A hook called when exiting (not quitting) summary mode."
716 (defcustom gnus-summary-update-hook
717 (list 'gnus-summary-highlight-line)
718 "*A hook called when a summary line is changed.
719 The hook will not be called if `gnus-visual' is nil.
721 The default function `gnus-summary-highlight-line' will
722 highlight the line according to the `gnus-summary-highlight'
724 :group 'gnus-summary-visual
727 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
728 "*A hook called when an article is selected for the first time.
729 The hook is intended to mark an article as read (or unread)
730 automatically when it is selected."
731 :group 'gnus-summary-choose
734 (defcustom gnus-group-no-more-groups-hook nil
735 "*A hook run when returning to group mode having no more (unread) groups."
736 :group 'gnus-group-select
739 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
740 "Face used for highlighting the current article in the summary buffer."
741 :group 'gnus-summary-visual
744 (defcustom gnus-summary-highlight
745 '(((= mark gnus-canceled-mark)
746 . gnus-summary-cancelled-face)
747 ((and (> score default)
748 (or (= mark gnus-dormant-mark)
749 (= mark gnus-ticked-mark)))
750 . gnus-summary-high-ticked-face)
751 ((and (< score default)
752 (or (= mark gnus-dormant-mark)
753 (= mark gnus-ticked-mark)))
754 . gnus-summary-low-ticked-face)
755 ((or (= mark gnus-dormant-mark)
756 (= mark gnus-ticked-mark))
757 . gnus-summary-normal-ticked-face)
758 ((and (> score default) (= mark gnus-ancient-mark))
759 . gnus-summary-high-ancient-face)
760 ((and (< score default) (= mark gnus-ancient-mark))
761 . gnus-summary-low-ancient-face)
762 ((= mark gnus-ancient-mark)
763 . gnus-summary-normal-ancient-face)
764 ((and (> score default) (= mark gnus-unread-mark))
765 . gnus-summary-high-unread-face)
766 ((and (< score default) (= mark gnus-unread-mark))
767 . gnus-summary-low-unread-face)
768 ((and (= mark gnus-unread-mark))
769 . gnus-summary-normal-unread-face)
771 . gnus-summary-high-read-face)
773 . gnus-summary-low-read-face)
775 . gnus-summary-normal-read-face))
776 "Controls the highlighting of summary buffer lines.
778 A list of (FORM . FACE) pairs. When deciding how a a particular
779 summary line should be displayed, each form is evaluated. The content
780 of the face field after the first true form is used. You can change
781 how those summary lines are displayed, by editing the face field.
783 You can use the following variables in the FORM field.
785 score: The articles score
786 default: The default article score.
787 below: The score below which articles are automatically marked as read.
788 mark: The articles mark."
789 :group 'gnus-summary-visual
790 :type '(repeat (cons (sexp :tag "Form" nil)
793 ;;; Internal variables
795 (defvar gnus-scores-exclude-files nil)
797 (defvar gnus-summary-display-table
798 ;; Change the display table. Odd characters have a tendency to mess
799 ;; up nicely formatted displays - we make all possible glyphs
800 ;; display only a single character.
802 ;; We start from the standard display table, if any.
803 (let ((table (or (copy-sequence standard-display-table)
804 (make-display-table)))
805 ;; Nix out all the control chars...
807 (while (>= (setq i (1- i)) 0)
809 ;; ... but not newline and cr, of course. (cr is necessary for the
810 ;; selective display).
813 ;; We nix out any glyphs over 126 that are not set already.
815 (while (>= (setq i (1- i)) 127)
816 ;; Only modify if the entry is nil.
818 (aset table i [??]))))
820 "Display table used in summary mode buffers.")
822 (defvar gnus-original-article nil)
823 (defvar gnus-article-internal-prepare-hook nil)
824 (defvar gnus-newsgroup-process-stack nil)
826 (defvar gnus-thread-indent-array nil)
827 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
829 ;; Avoid highlighting in kill files.
830 (defvar gnus-summary-inhibit-highlight nil)
831 (defvar gnus-newsgroup-selected-overlay nil)
832 (defvar gnus-inhibit-limiting nil)
833 (defvar gnus-newsgroup-adaptive-score-file nil)
834 (defvar gnus-current-score-file nil)
835 (defvar gnus-current-move-group nil)
836 (defvar gnus-current-copy-group nil)
837 (defvar gnus-current-crosspost-group nil)
839 (defvar gnus-newsgroup-dependencies nil)
840 (defvar gnus-newsgroup-adaptive nil)
841 (defvar gnus-summary-display-article-function nil)
842 (defvar gnus-summary-highlight-line-function nil
843 "Function called after highlighting a summary line.")
845 (defvar gnus-summary-line-format-alist
846 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
847 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
848 (?s gnus-tmp-subject-or-nil ?s)
849 (?n gnus-tmp-name ?s)
850 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
852 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
854 (?F gnus-tmp-from ?s)
855 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
856 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
857 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
858 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
859 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
860 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
861 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
862 (?L gnus-tmp-lines ?d)
863 (?I gnus-tmp-indentation ?s)
864 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
865 (?R gnus-tmp-replied ?c)
866 (?\[ gnus-tmp-opening-bracket ?c)
867 (?\] gnus-tmp-closing-bracket ?c)
868 (?\> (make-string gnus-tmp-level ? ) ?s)
869 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
870 (?i gnus-tmp-score ?d)
871 (?z gnus-tmp-score-char ?c)
872 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
873 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
874 (?U gnus-tmp-unread ?c)
875 (?t (gnus-summary-number-of-articles-in-thread
876 (and (boundp 'thread) (car thread)) gnus-tmp-level)
878 (?e (gnus-summary-number-of-articles-in-thread
879 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
881 (?u gnus-tmp-user-defined ?s)
882 (?P (gnus-pick-line-number) ?d))
883 "An alist of format specifications that can appear in summary lines,
884 and what variables they correspond with, along with the type of the
885 variable (string, integer, character, etc).")
887 (defvar gnus-summary-dummy-line-format-alist
888 `((?S gnus-tmp-subject ?s)
889 (?N gnus-tmp-number ?d)
890 (?u gnus-tmp-user-defined ?s)))
892 (defvar gnus-summary-mode-line-format-alist
893 `((?G gnus-tmp-group-name ?s)
894 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
895 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
896 (?A gnus-tmp-article-number ?d)
897 (?Z gnus-tmp-unread-and-unselected ?s)
899 (?U gnus-tmp-unread-and-unticked ?d)
900 (?S gnus-tmp-subject ?s)
901 (?e gnus-tmp-unselected ?d)
902 (?u gnus-tmp-user-defined ?s)
903 (?d (length gnus-newsgroup-dormant) ?d)
904 (?t (length gnus-newsgroup-marked) ?d)
905 (?r (length gnus-newsgroup-reads) ?d)
906 (?E gnus-newsgroup-expunged-tally ?d)
907 (?s (gnus-current-score-file-nondirectory) ?s)))
909 (defvar gnus-last-search-regexp nil
910 "Default regexp for article search command.")
912 (defvar gnus-last-shell-command nil
913 "Default shell command on article.")
915 (defvar gnus-newsgroup-begin nil)
916 (defvar gnus-newsgroup-end nil)
917 (defvar gnus-newsgroup-last-rmail nil)
918 (defvar gnus-newsgroup-last-mail nil)
919 (defvar gnus-newsgroup-last-folder nil)
920 (defvar gnus-newsgroup-last-file nil)
921 (defvar gnus-newsgroup-auto-expire nil)
922 (defvar gnus-newsgroup-active nil)
924 (defvar gnus-newsgroup-data nil)
925 (defvar gnus-newsgroup-data-reverse nil)
926 (defvar gnus-newsgroup-limit nil)
927 (defvar gnus-newsgroup-limits nil)
929 (defvar gnus-newsgroup-unreads nil
930 "List of unread articles in the current newsgroup.")
932 (defvar gnus-newsgroup-unselected nil
933 "List of unselected unread articles in the current newsgroup.")
935 (defvar gnus-newsgroup-reads nil
936 "Alist of read articles and article marks in the current newsgroup.")
938 (defvar gnus-newsgroup-expunged-tally nil)
940 (defvar gnus-newsgroup-marked nil
941 "List of ticked articles in the current newsgroup (a subset of unread art).")
943 (defvar gnus-newsgroup-killed nil
944 "List of ranges of articles that have been through the scoring process.")
946 (defvar gnus-newsgroup-cached nil
947 "List of articles that come from the article cache.")
949 (defvar gnus-newsgroup-saved nil
950 "List of articles that have been saved.")
952 (defvar gnus-newsgroup-kill-headers nil)
954 (defvar gnus-newsgroup-replied nil
955 "List of articles that have been replied to in the current newsgroup.")
957 (defvar gnus-newsgroup-expirable nil
958 "List of articles in the current newsgroup that can be expired.")
960 (defvar gnus-newsgroup-processable nil
961 "List of articles in the current newsgroup that can be processed.")
963 (defvar gnus-newsgroup-bookmarks nil
964 "List of articles in the current newsgroup that have bookmarks.")
966 (defvar gnus-newsgroup-dormant nil
967 "List of dormant articles in the current newsgroup.")
969 (defvar gnus-newsgroup-scored nil
970 "List of scored articles in the current newsgroup.")
972 (defvar gnus-newsgroup-headers nil
973 "List of article headers in the current newsgroup.")
975 (defvar gnus-newsgroup-threads nil)
977 (defvar gnus-newsgroup-prepared nil
978 "Whether the current group has been prepared properly.")
980 (defvar gnus-newsgroup-ancient nil
981 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
983 (defvar gnus-newsgroup-sparse nil)
985 (defvar gnus-current-article nil)
986 (defvar gnus-article-current nil)
987 (defvar gnus-current-headers nil)
988 (defvar gnus-have-all-headers nil)
989 (defvar gnus-last-article nil)
990 (defvar gnus-newsgroup-history nil)
992 (defconst gnus-summary-local-variables
993 '(gnus-newsgroup-name
994 gnus-newsgroup-begin gnus-newsgroup-end
995 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
996 gnus-newsgroup-last-folder gnus-newsgroup-last-file
997 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
998 gnus-newsgroup-unselected gnus-newsgroup-marked
999 gnus-newsgroup-reads gnus-newsgroup-saved
1000 gnus-newsgroup-replied gnus-newsgroup-expirable
1001 gnus-newsgroup-processable gnus-newsgroup-killed
1002 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1003 gnus-newsgroup-headers gnus-newsgroup-threads
1004 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1005 gnus-current-article gnus-current-headers gnus-have-all-headers
1006 gnus-last-article gnus-article-internal-prepare-hook
1007 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1008 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1009 gnus-thread-expunge-below
1010 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1011 (gnus-summary-mark-below . global)
1012 gnus-newsgroup-active gnus-scores-exclude-files
1013 gnus-newsgroup-history gnus-newsgroup-ancient
1014 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1015 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1016 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1017 (gnus-newsgroup-expunged-tally . 0)
1018 gnus-cache-removable-articles gnus-newsgroup-cached
1019 gnus-newsgroup-data gnus-newsgroup-data-reverse
1020 gnus-newsgroup-limit gnus-newsgroup-limits)
1021 "Variables that are buffer-local to the summary buffers.")
1023 ;; Byte-compiler warning.
1024 (defvar gnus-article-mode-map)
1026 ;; Subject simplification.
1028 (defsubst gnus-simplify-subject-re (subject)
1029 "Remove \"Re:\" from subject lines."
1030 (if (string-match "^[Rr][Ee]: *" subject)
1031 (substring subject (match-end 0))
1034 (defun gnus-simplify-subject (subject &optional re-only)
1035 "Remove `Re:' and words in parentheses.
1036 If RE-ONLY is non-nil, strip leading `Re:'s only."
1037 (let ((case-fold-search t)) ;Ignore case.
1038 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1039 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1040 (setq subject (substring subject (match-end 0))))
1041 ;; Remove uninteresting prefixes.
1042 (when (and (not re-only)
1043 gnus-simplify-ignored-prefixes
1044 (string-match gnus-simplify-ignored-prefixes subject))
1045 (setq subject (substring subject (match-end 0))))
1046 ;; Remove words in parentheses from end.
1048 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1049 (setq subject (substring subject 0 (match-beginning 0)))))
1050 ;; Return subject string.
1053 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1055 ;; Written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
1056 (defun gnus-simplify-buffer-fuzzy ()
1057 (let ((case-fold-search t))
1058 (goto-char (point-min))
1059 (while (search-forward "\t" nil t)
1060 (replace-match " " t t))
1061 (goto-char (point-min))
1062 (re-search-forward "^ *\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;] *" nil t)
1063 (goto-char (match-beginning 0))
1066 gnus-simplify-subject-fuzzy-regexp
1067 (looking-at gnus-simplify-subject-fuzzy-regexp))
1068 (looking-at "^ *\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1069 (looking-at "^[[].*: .*[]]$"))
1070 (goto-char (point-min))
1071 (when gnus-simplify-subject-fuzzy-regexp
1072 (while (re-search-forward gnus-simplify-subject-fuzzy-regexp
1074 (replace-match "" t t)))
1075 (goto-char (point-min))
1076 (while (re-search-forward "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *"
1078 (replace-match "" t t))
1079 (goto-char (point-min))
1080 (while (re-search-forward "^[[].*: .*[]]$" nil t)
1081 (goto-char (match-end 0))
1084 (progn (goto-char (match-beginning 0)))
1085 (re-search-forward ":"))))
1086 (goto-char (point-min))
1087 (while (re-search-forward " *[[{(][^()\n]*[]})] *$" nil t)
1088 (replace-match "" t t))
1089 (goto-char (point-min))
1090 (while (re-search-forward " +" nil t)
1091 (replace-match " " t t))
1092 (goto-char (point-min))
1093 (while (re-search-forward " $" nil t)
1094 (replace-match "" t t))
1095 (goto-char (point-min))
1096 (while (re-search-forward "^ +" nil t)
1097 (replace-match "" t t))))
1099 (defun gnus-simplify-subject-fuzzy (subject)
1100 "Simplify a subject string fuzzily."
1102 (gnus-set-work-buffer)
1103 (let ((case-fold-search t))
1105 (inline (gnus-simplify-buffer-fuzzy))
1108 (defsubst gnus-simplify-subject-fully (subject)
1109 "Simplify a subject string according to the user's wishes."
1111 ((null gnus-summary-gather-subject-limit)
1112 (gnus-simplify-subject-re subject))
1113 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1114 (gnus-simplify-subject-fuzzy subject))
1115 ((numberp gnus-summary-gather-subject-limit)
1116 (gnus-limit-string (gnus-simplify-subject-re subject)
1117 gnus-summary-gather-subject-limit))
1121 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1122 "Check whether two subjects are equal. If optional argument
1123 simple-first is t, first argument is already simplified."
1125 ((null simple-first)
1126 (equal (gnus-simplify-subject-fully s1)
1127 (gnus-simplify-subject-fully s2)))
1130 (gnus-simplify-subject-fully s2)))))
1132 (defun gnus-offer-save-summaries ()
1133 "Offer to save all active summary buffers."
1135 (let ((buflist (buffer-list))
1137 ;; Go through all buffers and find all summaries.
1139 (and (setq bufname (buffer-name (car buflist)))
1140 (string-match "Summary" bufname)
1142 (set-buffer bufname)
1143 ;; We check that this is, indeed, a summary buffer.
1144 (and (eq major-mode 'gnus-summary-mode)
1145 ;; Also make sure this isn't bogus.
1146 gnus-newsgroup-prepared))
1147 (push bufname buffers))
1148 (setq buflist (cdr buflist)))
1149 ;; Go through all these summary buffers and offer to save them.
1152 "Update summary buffer %s? "
1153 (lambda (buf) (set-buffer buf) (gnus-summary-exit))
1156 (defun gnus-summary-bubble-group ()
1157 "Increase the score of the current group.
1158 This is a handy function to add to `gnus-summary-exit-hook' to
1159 increase the score of each group you read."
1160 (gnus-group-add-score gnus-newsgroup-name))
1164 ;;; Gnus summary mode
1167 (put 'gnus-summary-mode 'mode-class 'special)
1170 ;; Non-orthogonal keys
1172 (gnus-define-keys gnus-summary-mode-map
1173 " " gnus-summary-next-page
1174 "\177" gnus-summary-prev-page
1175 [delete] gnus-summary-prev-page
1176 "\r" gnus-summary-scroll-up
1177 "n" gnus-summary-next-unread-article
1178 "p" gnus-summary-prev-unread-article
1179 "N" gnus-summary-next-article
1180 "P" gnus-summary-prev-article
1181 "\M-\C-n" gnus-summary-next-same-subject
1182 "\M-\C-p" gnus-summary-prev-same-subject
1183 "\M-n" gnus-summary-next-unread-subject
1184 "\M-p" gnus-summary-prev-unread-subject
1185 "." gnus-summary-first-unread-article
1186 "," gnus-summary-best-unread-article
1187 "\M-s" gnus-summary-search-article-forward
1188 "\M-r" gnus-summary-search-article-backward
1189 "<" gnus-summary-beginning-of-article
1190 ">" gnus-summary-end-of-article
1191 "j" gnus-summary-goto-article
1192 "^" gnus-summary-refer-parent-article
1193 "\M-^" gnus-summary-refer-article
1194 "u" gnus-summary-tick-article-forward
1195 "!" gnus-summary-tick-article-forward
1196 "U" gnus-summary-tick-article-backward
1197 "d" gnus-summary-mark-as-read-forward
1198 "D" gnus-summary-mark-as-read-backward
1199 "E" gnus-summary-mark-as-expirable
1200 "\M-u" gnus-summary-clear-mark-forward
1201 "\M-U" gnus-summary-clear-mark-backward
1202 "k" gnus-summary-kill-same-subject-and-select
1203 "\C-k" gnus-summary-kill-same-subject
1204 "\M-\C-k" gnus-summary-kill-thread
1205 "\M-\C-l" gnus-summary-lower-thread
1206 "e" gnus-summary-edit-article
1207 "#" gnus-summary-mark-as-processable
1208 "\M-#" gnus-summary-unmark-as-processable
1209 "\M-\C-t" gnus-summary-toggle-threads
1210 "\M-\C-s" gnus-summary-show-thread
1211 "\M-\C-h" gnus-summary-hide-thread
1212 "\M-\C-f" gnus-summary-next-thread
1213 "\M-\C-b" gnus-summary-prev-thread
1214 "\M-\C-u" gnus-summary-up-thread
1215 "\M-\C-d" gnus-summary-down-thread
1216 "&" gnus-summary-execute-command
1217 "c" gnus-summary-catchup-and-exit
1218 "\C-w" gnus-summary-mark-region-as-read
1219 "\C-t" gnus-summary-toggle-truncation
1220 "?" gnus-summary-mark-as-dormant
1221 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1222 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1223 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1224 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1225 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1226 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1227 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1228 "=" gnus-summary-expand-window
1229 "\C-x\C-s" gnus-summary-reselect-current-group
1230 "\M-g" gnus-summary-rescan-group
1231 "w" gnus-summary-stop-page-breaking
1232 "\C-c\C-r" gnus-summary-caesar-message
1233 "\M-t" gnus-summary-toggle-mime
1234 "f" gnus-summary-followup
1235 "F" gnus-summary-followup-with-original
1236 "C" gnus-summary-cancel-article
1237 "r" gnus-summary-reply
1238 "R" gnus-summary-reply-with-original
1239 "\C-c\C-f" gnus-summary-mail-forward
1240 "o" gnus-summary-save-article
1241 "\C-o" gnus-summary-save-article-mail
1242 "|" gnus-summary-pipe-output
1243 "\M-k" gnus-summary-edit-local-kill
1244 "\M-K" gnus-summary-edit-global-kill
1246 "\C-c\C-d" gnus-summary-describe-group
1247 "q" gnus-summary-exit
1248 "Q" gnus-summary-exit-no-update
1249 "\C-c\C-i" gnus-info-find-node
1250 gnus-mouse-2 gnus-mouse-pick-article
1251 "m" gnus-summary-mail-other-window
1252 "a" gnus-summary-post-news
1253 "x" gnus-summary-limit-to-unread
1254 "s" gnus-summary-isearch-article
1255 "t" gnus-article-hide-headers
1256 "g" gnus-summary-show-article
1257 "l" gnus-summary-goto-last-article
1258 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1259 "\C-d" gnus-summary-enter-digest-group
1260 "\M-\C-d" gnus-summary-read-document
1262 "*" gnus-cache-enter-article
1263 "\M-*" gnus-cache-remove-article
1264 "\M-&" gnus-summary-universal-argument
1265 "\C-l" gnus-recenter
1266 "I" gnus-summary-increase-score
1267 "L" gnus-summary-lower-score
1269 "V" gnus-summary-score-map
1270 "X" gnus-uu-extract-map
1271 "S" gnus-summary-send-map)
1273 ;; Sort of orthogonal keymap
1274 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1275 "t" gnus-summary-tick-article-forward
1276 "!" gnus-summary-tick-article-forward
1277 "d" gnus-summary-mark-as-read-forward
1278 "r" gnus-summary-mark-as-read-forward
1279 "c" gnus-summary-clear-mark-forward
1280 " " gnus-summary-clear-mark-forward
1281 "e" gnus-summary-mark-as-expirable
1282 "x" gnus-summary-mark-as-expirable
1283 "?" gnus-summary-mark-as-dormant
1284 "b" gnus-summary-set-bookmark
1285 "B" gnus-summary-remove-bookmark
1286 "#" gnus-summary-mark-as-processable
1287 "\M-#" gnus-summary-unmark-as-processable
1288 "S" gnus-summary-limit-include-expunged
1289 "C" gnus-summary-catchup
1290 "H" gnus-summary-catchup-to-here
1291 "\C-c" gnus-summary-catchup-all
1292 "k" gnus-summary-kill-same-subject-and-select
1293 "K" gnus-summary-kill-same-subject
1294 "P" gnus-uu-mark-map)
1296 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1297 "c" gnus-summary-clear-above
1298 "u" gnus-summary-tick-above
1299 "m" gnus-summary-mark-above
1300 "k" gnus-summary-kill-below)
1302 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1303 "/" gnus-summary-limit-to-subject
1304 "n" gnus-summary-limit-to-articles
1305 "w" gnus-summary-pop-limit
1306 "s" gnus-summary-limit-to-subject
1307 "a" gnus-summary-limit-to-author
1308 "u" gnus-summary-limit-to-unread
1309 "m" gnus-summary-limit-to-marks
1310 "v" gnus-summary-limit-to-score
1311 "D" gnus-summary-limit-include-dormant
1312 "d" gnus-summary-limit-exclude-dormant
1313 "t" gnus-summary-limit-to-age
1314 "E" gnus-summary-limit-include-expunged
1315 "c" gnus-summary-limit-exclude-childless-dormant
1316 "C" gnus-summary-limit-mark-excluded-as-read)
1318 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1319 "n" gnus-summary-next-unread-article
1320 "p" gnus-summary-prev-unread-article
1321 "N" gnus-summary-next-article
1322 "P" gnus-summary-prev-article
1323 "\C-n" gnus-summary-next-same-subject
1324 "\C-p" gnus-summary-prev-same-subject
1325 "\M-n" gnus-summary-next-unread-subject
1326 "\M-p" gnus-summary-prev-unread-subject
1327 "f" gnus-summary-first-unread-article
1328 "b" gnus-summary-best-unread-article
1329 "j" gnus-summary-goto-article
1330 "g" gnus-summary-goto-subject
1331 "l" gnus-summary-goto-last-article
1332 "p" gnus-summary-pop-article)
1334 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1335 "k" gnus-summary-kill-thread
1336 "l" gnus-summary-lower-thread
1337 "i" gnus-summary-raise-thread
1338 "T" gnus-summary-toggle-threads
1339 "t" gnus-summary-rethread-current
1340 "^" gnus-summary-reparent-thread
1341 "s" gnus-summary-show-thread
1342 "S" gnus-summary-show-all-threads
1343 "h" gnus-summary-hide-thread
1344 "H" gnus-summary-hide-all-threads
1345 "n" gnus-summary-next-thread
1346 "p" gnus-summary-prev-thread
1347 "u" gnus-summary-up-thread
1348 "o" gnus-summary-top-thread
1349 "d" gnus-summary-down-thread
1350 "#" gnus-uu-mark-thread
1351 "\M-#" gnus-uu-unmark-thread)
1353 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1354 "g" gnus-summary-prepare
1355 "c" gnus-summary-insert-cached-articles)
1357 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1358 "c" gnus-summary-catchup-and-exit
1359 "C" gnus-summary-catchup-all-and-exit
1360 "E" gnus-summary-exit-no-update
1361 "Q" gnus-summary-exit
1362 "Z" gnus-summary-exit
1363 "n" gnus-summary-catchup-and-goto-next-group
1364 "R" gnus-summary-reselect-current-group
1365 "G" gnus-summary-rescan-group
1366 "N" gnus-summary-next-group
1367 "s" gnus-summary-save-newsrc
1368 "P" gnus-summary-prev-group)
1370 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1371 " " gnus-summary-next-page
1372 "n" gnus-summary-next-page
1373 "\177" gnus-summary-prev-page
1374 [delete] gnus-summary-prev-page
1375 "p" gnus-summary-prev-page
1376 "\r" gnus-summary-scroll-up
1377 "<" gnus-summary-beginning-of-article
1378 ">" gnus-summary-end-of-article
1379 "b" gnus-summary-beginning-of-article
1380 "e" gnus-summary-end-of-article
1381 "^" gnus-summary-refer-parent-article
1382 "r" gnus-summary-refer-parent-article
1383 "R" gnus-summary-refer-references
1384 "g" gnus-summary-show-article
1385 "s" gnus-summary-isearch-article
1386 "P" gnus-summary-print-article)
1388 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1389 "b" gnus-article-add-buttons
1390 "B" gnus-article-add-buttons-to-head
1391 "o" gnus-article-treat-overstrike
1392 "e" gnus-article-emphasize
1393 "w" gnus-article-fill-cited-article
1394 "c" gnus-article-remove-cr
1395 "q" gnus-article-de-quoted-unreadable
1396 "f" gnus-article-display-x-face
1397 "l" gnus-summary-stop-page-breaking
1398 "r" gnus-summary-caesar-message
1399 "t" gnus-article-hide-headers
1400 "v" gnus-summary-verbose-headers
1401 "m" gnus-summary-toggle-mime)
1403 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1404 "a" gnus-article-hide
1405 "h" gnus-article-hide-headers
1406 "b" gnus-article-hide-boring-headers
1407 "s" gnus-article-hide-signature
1408 "c" gnus-article-hide-citation
1409 "p" gnus-article-hide-pgp
1410 "P" gnus-article-hide-pem
1411 "\C-c" gnus-article-hide-citation-maybe)
1413 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1414 "a" gnus-article-highlight
1415 "h" gnus-article-highlight-headers
1416 "c" gnus-article-highlight-citation
1417 "s" gnus-article-highlight-signature)
1419 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1420 "z" gnus-article-date-ut
1421 "u" gnus-article-date-ut
1422 "l" gnus-article-date-local
1423 "e" gnus-article-date-lapsed
1424 "o" gnus-article-date-original)
1426 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1427 "t" gnus-article-remove-trailing-blank-lines
1428 "l" gnus-article-strip-leading-blank-lines
1429 "m" gnus-article-strip-multiple-blank-lines
1430 "a" gnus-article-strip-blank-lines)
1432 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1434 "f" gnus-summary-fetch-faq
1435 "d" gnus-summary-describe-group
1436 "h" gnus-summary-describe-briefly
1437 "i" gnus-info-find-node)
1439 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1440 "e" gnus-summary-expire-articles
1441 "\M-\C-e" gnus-summary-expire-articles-now
1442 "\177" gnus-summary-delete-article
1443 [delete] gnus-summary-delete-article
1444 "m" gnus-summary-move-article
1445 "r" gnus-summary-respool-article
1446 "w" gnus-summary-edit-article
1447 "c" gnus-summary-copy-article
1448 "B" gnus-summary-crosspost-article
1449 "q" gnus-summary-respool-query
1450 "i" gnus-summary-import-article
1451 "p" gnus-summary-article-posted-p)
1453 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1454 "o" gnus-summary-save-article
1455 "m" gnus-summary-save-article-mail
1456 "F" gnus-summary-write-article-file
1457 "r" gnus-summary-save-article-rmail
1458 "f" gnus-summary-save-article-file
1459 "b" gnus-summary-save-article-body-file
1460 "h" gnus-summary-save-article-folder
1461 "v" gnus-summary-save-article-vm
1462 "p" gnus-summary-pipe-output
1463 "s" gnus-soup-add-article))
1465 (defun gnus-summary-make-menu-bar ()
1466 (gnus-turn-off-edit-menu 'summary)
1468 (unless (boundp 'gnus-summary-misc-menu)
1471 gnus-summary-kill-menu gnus-summary-mode-map ""
1476 ["Enter score..." gnus-summary-score-entry t]
1477 ["Customize" gnus-score-customize t])
1478 (gnus-make-score-map 'increase)
1479 (gnus-make-score-map 'lower)
1481 ["Kill below" gnus-summary-kill-below t]
1482 ["Mark above" gnus-summary-mark-above t]
1483 ["Tick above" gnus-summary-tick-above t]
1484 ["Clear above" gnus-summary-clear-above t])
1485 ["Current score" gnus-summary-current-score t]
1486 ["Set score" gnus-summary-set-score t]
1487 ["Switch current score file..." gnus-score-change-score-file t]
1488 ["Set mark below..." gnus-score-set-mark-below t]
1489 ["Set expunge below..." gnus-score-set-expunge-below t]
1490 ["Edit current score file" gnus-score-edit-current-scores t]
1491 ["Edit score file" gnus-score-edit-file t]
1492 ["Trace score" gnus-score-find-trace t]
1493 ["Find words" gnus-score-find-favourite-words t]
1494 ["Rescore buffer" gnus-summary-rescore t]
1495 ["Increase score..." gnus-summary-increase-score t]
1496 ["Lower score..." gnus-summary-lower-score t]))))
1499 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1501 :selected (null gnus-score-default-header)]
1502 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1504 :selected (eq gnus-score-default-header 'a)]
1505 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1507 :selected (eq gnus-score-default-header 's)]
1509 (gnus-score-set-default 'gnus-score-default-header 'b)
1511 :selected (eq gnus-score-default-header 'b )]
1513 (gnus-score-set-default 'gnus-score-default-header 'h)
1515 :selected (eq gnus-score-default-header 'h )]
1516 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1518 :selected (eq gnus-score-default-header 'i )]
1519 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1521 :selected (eq gnus-score-default-header 't )]
1523 (gnus-score-set-default 'gnus-score-default-header 'x)
1525 :selected (eq gnus-score-default-header 'x )]
1526 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1528 :selected (eq gnus-score-default-header 'l )]
1529 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1531 :selected (eq gnus-score-default-header 'd )]
1532 ["Followups to author"
1533 (gnus-score-set-default 'gnus-score-default-header 'f)
1535 :selected (eq gnus-score-default-header 'f )])
1537 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1539 :selected (null gnus-score-default-type)]
1540 ;; The `:active' key is commented out in the following,
1541 ;; because the GNU Emacs hack to support radio buttons use
1542 ;; active to indicate which button is selected.
1543 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1545 ;; :active (not (memq gnus-score-default-header '(l d)))
1546 :selected (eq gnus-score-default-type 's)]
1547 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1549 ;; :active (not (memq gnus-score-default-header '(l d)))
1550 :selected (eq gnus-score-default-type 'r)]
1551 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1553 ;; :active (not (memq gnus-score-default-header '(l d)))
1554 :selected (eq gnus-score-default-type 'e)]
1555 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1557 ;; :active (not (memq gnus-score-default-header '(l d)))
1558 :selected (eq gnus-score-default-type 'f)]
1559 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1561 ;; :active (eq (gnus-score-default-header 'd))
1562 :selected (eq gnus-score-default-type 'b)]
1563 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1565 ;; :active (eq (gnus-score-default-header 'd))
1566 :selected (eq gnus-score-default-type 'n)]
1567 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1569 ;; :active (eq (gnus-score-default-header 'd))
1570 :selected (eq gnus-score-default-type 'a)]
1572 (gnus-score-set-default 'gnus-score-default-type '<)
1574 ;; :active (eq (gnus-score-default-header 'l))
1575 :selected (eq gnus-score-default-type '<)]
1577 (gnus-score-set-default 'gnus-score-default-type '=)
1579 ;; :active (eq (gnus-score-default-header 'l))
1580 :selected (eq gnus-score-default-type '=)]
1581 ["Greater than number"
1582 (gnus-score-set-default 'gnus-score-default-type '>)
1584 ;; :active (eq (gnus-score-default-header 'l))
1585 :selected (eq gnus-score-default-type '>)])
1586 ["Default fold" gnus-score-default-fold-toggle
1588 :selected gnus-score-default-fold]
1590 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1592 :selected (null gnus-score-default-duration)]
1594 (gnus-score-set-default 'gnus-score-default-duration 'p)
1596 :selected (eq gnus-score-default-duration 'p)]
1598 (gnus-score-set-default 'gnus-score-default-duration 't)
1600 :selected (eq gnus-score-default-duration 't)]
1602 (gnus-score-set-default 'gnus-score-default-duration 'i)
1604 :selected (eq gnus-score-default-duration 'i)]))
1607 gnus-summary-article-menu gnus-summary-mode-map ""
1610 ["All" gnus-article-hide t]
1611 ["Headers" gnus-article-hide-headers t]
1612 ["Signature" gnus-article-hide-signature t]
1613 ["Citation" gnus-article-hide-citation t]
1614 ["PGP" gnus-article-hide-pgp t]
1615 ["Boring headers" gnus-article-hide-boring-headers t])
1617 ["All" gnus-article-highlight t]
1618 ["Headers" gnus-article-highlight-headers t]
1619 ["Signature" gnus-article-highlight-signature t]
1620 ["Citation" gnus-article-highlight-citation t])
1622 ["Local" gnus-article-date-local t]
1623 ["UT" gnus-article-date-ut t]
1624 ["Original" gnus-article-date-original t]
1625 ["Lapsed" gnus-article-date-lapsed t])
1628 ["Leading" gnus-article-strip-leading-blank-lines t]
1629 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1630 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1631 ["All of the above" gnus-article-strip-blank-lines t])
1632 ["Overstrike" gnus-article-treat-overstrike t]
1633 ["Emphasis" gnus-article-emphasize t]
1634 ["Word wrap" gnus-article-fill-cited-article t]
1635 ["CR" gnus-article-remove-cr t]
1636 ["Show X-Face" gnus-article-display-x-face t]
1637 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1638 ["Rot 13" gnus-summary-caesar-message t]
1639 ["Add buttons" gnus-article-add-buttons t]
1640 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1641 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1642 ["Toggle MIME" gnus-summary-toggle-mime t]
1643 ["Verbose header" gnus-summary-verbose-headers t]
1644 ["Toggle header" gnus-summary-toggle-header t])
1646 ["Save in default format" gnus-summary-save-article t]
1647 ["Save in file" gnus-summary-save-article-file t]
1648 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1649 ["Write to file" gnus-summary-write-article-mail t]
1650 ["Save in MH folder" gnus-summary-save-article-folder t]
1651 ["Save in VM folder" gnus-summary-save-article-vm t]
1652 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1653 ["Save body in file" gnus-summary-save-article-body-file t]
1654 ["Pipe through a filter" gnus-summary-pipe-output t]
1655 ["Add to SOUP packet" gnus-soup-add-article t]
1656 ["Print" gnus-summary-print-article t])
1658 ["Respool article..." gnus-summary-respool-article t]
1659 ["Move article..." gnus-summary-move-article
1660 (gnus-check-backend-function
1661 'request-move-article gnus-newsgroup-name)]
1662 ["Copy article..." gnus-summary-copy-article t]
1663 ["Crosspost article..." gnus-summary-crosspost-article
1664 (gnus-check-backend-function
1665 'request-replace-article gnus-newsgroup-name)]
1666 ["Import file..." gnus-summary-import-article t]
1667 ["Check if posted" gnus-summary-article-posted-p t]
1668 ["Edit article" gnus-summary-edit-article
1669 (not (gnus-group-read-only-p))]
1670 ["Delete article" gnus-summary-delete-article
1671 (gnus-check-backend-function
1672 'request-expire-articles gnus-newsgroup-name)]
1673 ["Query respool" gnus-summary-respool-query t]
1674 ["Delete expirable articles" gnus-summary-expire-articles-now
1675 (gnus-check-backend-function
1676 'request-expire-articles gnus-newsgroup-name)])
1678 ["Uudecode" gnus-uu-decode-uu t]
1679 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1680 ["Unshar" gnus-uu-decode-unshar t]
1681 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1682 ["Save" gnus-uu-decode-save t]
1683 ["Binhex" gnus-uu-decode-binhex t]
1684 ["Postscript" gnus-uu-decode-postscript t])
1685 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1686 ["Isearch article..." gnus-summary-isearch-article t]
1687 ["Search articles forward..." gnus-summary-search-article-forward t]
1688 ["Search articles backward..." gnus-summary-search-article-backward t]
1689 ["Beginning of the article" gnus-summary-beginning-of-article t]
1690 ["End of the article" gnus-summary-end-of-article t]
1691 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1692 ["Fetch referenced articles" gnus-summary-refer-references t]
1693 ["Fetch article with id..." gnus-summary-refer-article t]
1694 ["Redisplay" gnus-summary-show-article t]))
1697 gnus-summary-thread-menu gnus-summary-mode-map ""
1699 ["Toggle threading" gnus-summary-toggle-threads t]
1700 ["Hide threads" gnus-summary-hide-all-threads t]
1701 ["Show threads" gnus-summary-show-all-threads t]
1702 ["Hide thread" gnus-summary-hide-thread t]
1703 ["Show thread" gnus-summary-show-thread t]
1704 ["Go to next thread" gnus-summary-next-thread t]
1705 ["Go to previous thread" gnus-summary-prev-thread t]
1706 ["Go down thread" gnus-summary-down-thread t]
1707 ["Go up thread" gnus-summary-up-thread t]
1708 ["Top of thread" gnus-summary-top-thread t]
1709 ["Mark thread as read" gnus-summary-kill-thread t]
1710 ["Lower thread score" gnus-summary-lower-thread t]
1711 ["Raise thread score" gnus-summary-raise-thread t]
1712 ["Rethread current" gnus-summary-rethread-current t]
1716 gnus-summary-post-menu gnus-summary-mode-map ""
1718 ["Post an article" gnus-summary-post-news t]
1719 ["Followup" gnus-summary-followup t]
1720 ["Followup and yank" gnus-summary-followup-with-original t]
1721 ["Supersede article" gnus-summary-supersede-article t]
1722 ["Cancel article" gnus-summary-cancel-article t]
1723 ["Reply" gnus-summary-reply t]
1724 ["Reply and yank" gnus-summary-reply-with-original t]
1725 ["Mail forward" gnus-summary-mail-forward t]
1726 ["Post forward" gnus-summary-post-forward t]
1727 ["Digest and mail" gnus-uu-digest-mail-forward t]
1728 ["Digest and post" gnus-uu-digest-post-forward t]
1729 ["Resend message" gnus-summary-resend-message t]
1730 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1731 ["Send a mail" gnus-summary-mail-other-window t]
1732 ["Uuencode and post" gnus-uu-post-news t]
1733 ["Followup via news" gnus-summary-followup-to-mail t]
1734 ["Followup via news and yank"
1735 gnus-summary-followup-to-mail-with-original t]
1737 ;;["Send" gnus-summary-send-draft t]
1738 ;;["Send bounced" gnus-resend-bounced-mail t])
1742 gnus-summary-misc-menu gnus-summary-mode-map ""
1745 ["Mark as read" gnus-summary-mark-as-read-forward t]
1746 ["Mark same subject and select"
1747 gnus-summary-kill-same-subject-and-select t]
1748 ["Mark same subject" gnus-summary-kill-same-subject t]
1749 ["Catchup" gnus-summary-catchup t]
1750 ["Catchup all" gnus-summary-catchup-all t]
1751 ["Catchup to here" gnus-summary-catchup-to-here t]
1752 ["Catchup region" gnus-summary-mark-region-as-read t]
1753 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1755 ["Tick" gnus-summary-tick-article-forward t]
1756 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1757 ["Remove marks" gnus-summary-clear-mark-forward t]
1758 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1759 ["Set bookmark" gnus-summary-set-bookmark t]
1760 ["Remove bookmark" gnus-summary-remove-bookmark t])
1762 ["Marks..." gnus-summary-limit-to-marks t]
1763 ["Subject..." gnus-summary-limit-to-subject t]
1764 ["Author..." gnus-summary-limit-to-author t]
1765 ["Age..." gnus-summary-limit-to-age t]
1766 ["Score" gnus-summary-limit-to-score t]
1767 ["Unread" gnus-summary-limit-to-unread t]
1768 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1769 ["Articles" gnus-summary-limit-to-articles t]
1770 ["Pop limit" gnus-summary-pop-limit t]
1771 ["Show dormant" gnus-summary-limit-include-dormant t]
1772 ["Hide childless dormant"
1773 gnus-summary-limit-exclude-childless-dormant t]
1774 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1775 ["Show expunged" gnus-summary-show-all-expunged t])
1777 ["Set mark" gnus-summary-mark-as-processable t]
1778 ["Remove mark" gnus-summary-unmark-as-processable t]
1779 ["Remove all marks" gnus-summary-unmark-all-processable t]
1780 ["Mark above" gnus-uu-mark-over t]
1781 ["Mark series" gnus-uu-mark-series t]
1782 ["Mark region" gnus-uu-mark-region t]
1783 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1784 ["Mark all" gnus-uu-mark-all t]
1785 ["Mark buffer" gnus-uu-mark-buffer t]
1786 ["Mark sparse" gnus-uu-mark-sparse t]
1787 ["Mark thread" gnus-uu-mark-thread t]
1788 ["Unmark thread" gnus-uu-unmark-thread t]
1789 ("Process Mark Sets"
1790 ["Kill" gnus-summary-kill-process-mark t]
1791 ["Yank" gnus-summary-yank-process-mark
1792 gnus-newsgroup-process-stack]
1793 ["Save" gnus-summary-save-process-mark t]))
1795 ["Page forward" gnus-summary-next-page t]
1796 ["Page backward" gnus-summary-prev-page t]
1797 ["Line forward" gnus-summary-scroll-up t])
1799 ["Next unread article" gnus-summary-next-unread-article t]
1800 ["Previous unread article" gnus-summary-prev-unread-article t]
1801 ["Next article" gnus-summary-next-article t]
1802 ["Previous article" gnus-summary-prev-article t]
1803 ["Next unread subject" gnus-summary-next-unread-subject t]
1804 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1805 ["Next article same subject" gnus-summary-next-same-subject t]
1806 ["Previous article same subject" gnus-summary-prev-same-subject t]
1807 ["First unread article" gnus-summary-first-unread-article t]
1808 ["Best unread article" gnus-summary-best-unread-article t]
1809 ["Go to subject number..." gnus-summary-goto-subject t]
1810 ["Go to article number..." gnus-summary-goto-article t]
1811 ["Go to the last article" gnus-summary-goto-last-article t]
1812 ["Pop article off history" gnus-summary-pop-article t])
1814 ["Sort by number" gnus-summary-sort-by-number t]
1815 ["Sort by author" gnus-summary-sort-by-author t]
1816 ["Sort by subject" gnus-summary-sort-by-subject t]
1817 ["Sort by date" gnus-summary-sort-by-date t]
1818 ["Sort by score" gnus-summary-sort-by-score t]
1819 ["Sort by lines" gnus-summary-sort-by-lines t])
1821 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1822 ["Describe group" gnus-summary-describe-group t]
1823 ["Read manual" gnus-info-find-node t])
1825 ["Enter article" gnus-cache-enter-article t]
1826 ["Remove article" gnus-cache-remove-article t])
1828 ["Pick and read" gnus-pick-mode t]
1829 ["Binary" gnus-binary-mode t])
1831 ["Regenerate" gnus-summary-prepare t]
1832 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1833 ["Toggle threading" gnus-summary-toggle-threads t])
1834 ["Filter articles..." gnus-summary-execute-command t]
1835 ["Run command on subjects..." gnus-summary-universal-argument t]
1836 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1837 ["Expand window" gnus-summary-expand-window t]
1838 ["Expire expirable articles" gnus-summary-expire-articles
1839 (gnus-check-backend-function
1840 'request-expire-articles gnus-newsgroup-name)]
1841 ["Regenerate buffer" gnus-summary-prepare t]
1842 ["Edit local kill file" gnus-summary-edit-local-kill t]
1843 ["Edit main kill file" gnus-summary-edit-global-kill t]
1845 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1846 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1847 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1848 ["Exit group" gnus-summary-exit t]
1849 ["Exit group without updating" gnus-summary-exit-no-update t]
1850 ["Exit and goto next group" gnus-summary-next-group t]
1851 ["Exit and goto prev group" gnus-summary-prev-group t]
1852 ["Reselect group" gnus-summary-reselect-current-group t]
1853 ["Rescan group" gnus-summary-rescan-group t]
1854 ["Update dribble" gnus-summary-save-newsrc t])))
1856 (run-hooks 'gnus-summary-menu-hook)))
1858 (defun gnus-score-set-default (var value)
1859 "A version of set that updates the GNU Emacs menu-bar."
1861 ;; It is the message that forces the active status to be updated.
1864 (defun gnus-make-score-map (type)
1865 "Make a summary score map of type TYPE."
1868 (let ((headers '(("author" "from" string)
1869 ("subject" "subject" string)
1870 ("article body" "body" string)
1871 ("article head" "head" string)
1872 ("xref" "xref" string)
1873 ("lines" "lines" number)
1874 ("followups to author" "followup" string)))
1875 (types '((number ("less than" <)
1878 (string ("substring" s)
1882 (perms '(("temporary" (current-time-string))
1890 (if (eq type 'lower)
1895 (setq header (car headers))
1901 (let ((ts (cdr (assoc (nth 2 header) types)))
1917 'gnus-summary-score-entry
1919 (if (or (string= (nth 1 header)
1921 (string= (nth 1 header)
1924 (list 'gnus-summary-header
1926 (list 'quote (nth 1 (car ts)))
1927 (list 'gnus-score-default nil)
1933 (list (nreverse outp))))
1936 (list (nreverse outt))))
1938 (setq headers (cdr headers)))
1939 (list (nreverse outh))))))))
1943 (defun gnus-summary-mode (&optional group)
1944 "Major mode for reading articles.
1946 All normal editing commands are switched off.
1947 \\<gnus-summary-mode-map>
1948 Each line in this buffer represents one article. To read an
1949 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1950 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1953 You can also post articles and send mail from this buffer. To
1954 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1955 of an article, type `\\[gnus-summary-reply]'.
1957 There are approx. one gazillion commands you can execute in this
1958 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1960 The following commands are available:
1962 \\{gnus-summary-mode-map}"
1964 (when (gnus-visual-p 'summary-menu 'menu)
1965 (gnus-summary-make-menu-bar))
1966 (kill-all-local-variables)
1967 (gnus-summary-make-local-variables)
1968 (gnus-make-thread-indent-array)
1969 (gnus-simplify-mode-line)
1970 (setq major-mode 'gnus-summary-mode)
1971 (setq mode-name "Summary")
1972 (make-local-variable 'minor-mode-alist)
1973 (use-local-map gnus-summary-mode-map)
1974 (buffer-disable-undo (current-buffer))
1975 (setq buffer-read-only t) ;Disable modification
1976 (setq truncate-lines t)
1977 (setq selective-display t)
1978 (setq selective-display-ellipses t) ;Display `...'
1979 (setq buffer-display-table gnus-summary-display-table)
1980 (gnus-set-default-directory)
1981 (setq gnus-newsgroup-name group)
1982 (make-local-variable 'gnus-summary-line-format)
1983 (make-local-variable 'gnus-summary-line-format-spec)
1984 (make-local-variable 'gnus-summary-mark-positions)
1985 (gnus-make-local-hook 'post-command-hook)
1986 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1987 (run-hooks 'gnus-summary-mode-hook)
1988 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1989 (gnus-update-summary-mark-positions))
1991 (defun gnus-summary-make-local-variables ()
1992 "Make all the local summary buffer variables."
1993 (let ((locals gnus-summary-local-variables)
1995 (while (setq local (pop locals))
1998 (if (eq (cdr local) 'global)
1999 ;; Copy the global value of the variable.
2000 (setq global (symbol-value (car local)))
2001 ;; Use the value from the list.
2002 (setq global (eval (cdr local))))
2003 (make-local-variable (car local))
2004 (set (car local) global))
2005 ;; Simple nil-valued local variable.
2006 (make-local-variable local)
2009 (defun gnus-summary-clear-local-variables ()
2010 (let ((locals gnus-summary-local-variables))
2012 (if (consp (car locals))
2013 (and (vectorp (caar locals))
2014 (set (caar locals) nil))
2015 (and (vectorp (car locals))
2016 (set (car locals) nil)))
2017 (setq locals (cdr locals)))))
2019 ;; Summary data functions.
2021 (defmacro gnus-data-number (data)
2024 (defmacro gnus-data-set-number (data number)
2025 `(setcar ,data ,number))
2027 (defmacro gnus-data-mark (data)
2030 (defmacro gnus-data-set-mark (data mark)
2031 `(setcar (nthcdr 1 ,data) ,mark))
2033 (defmacro gnus-data-pos (data)
2036 (defmacro gnus-data-set-pos (data pos)
2037 `(setcar (nthcdr 2 ,data) ,pos))
2039 (defmacro gnus-data-header (data)
2042 (defmacro gnus-data-level (data)
2045 (defmacro gnus-data-unread-p (data)
2046 `(= (nth 1 ,data) gnus-unread-mark))
2048 (defmacro gnus-data-read-p (data)
2049 `(/= (nth 1 ,data) gnus-unread-mark))
2051 (defmacro gnus-data-pseudo-p (data)
2052 `(consp (nth 3 ,data)))
2054 (defmacro gnus-data-find (number)
2055 `(assq ,number gnus-newsgroup-data))
2057 (defmacro gnus-data-find-list (number &optional data)
2058 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2059 (memq (assq ,number bdata)
2062 (defmacro gnus-data-make (number mark pos header level)
2063 `(list ,number ,mark ,pos ,header ,level))
2065 (defun gnus-data-enter (after-article number mark pos header level offset)
2066 (let ((data (gnus-data-find-list after-article)))
2068 (error "No such article: %d" after-article))
2069 (setcdr data (cons (gnus-data-make number mark pos header level)
2071 (setq gnus-newsgroup-data-reverse nil)
2072 (gnus-data-update-list (cddr data) offset)))
2074 (defun gnus-data-enter-list (after-article list &optional offset)
2076 (let ((data (and after-article (gnus-data-find-list after-article)))
2078 (or data (not after-article) (error "No such article: %d" after-article))
2079 ;; Find the last element in the list to be spliced into the main
2082 (setq list (cdr list)))
2085 (setcdr list gnus-newsgroup-data)
2086 (setq gnus-newsgroup-data ilist)
2088 (gnus-data-update-list (cdr list) offset)))
2089 (setcdr list (cdr data))
2092 (gnus-data-update-list (cdr list) offset)))
2093 (setq gnus-newsgroup-data-reverse nil))))
2095 (defun gnus-data-remove (article &optional offset)
2096 (let ((data gnus-newsgroup-data))
2097 (if (= (gnus-data-number (car data)) article)
2099 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2100 gnus-newsgroup-data-reverse nil)
2102 (gnus-data-update-list gnus-newsgroup-data offset)))
2104 (when (= (gnus-data-number (cadr data)) article)
2105 (setcdr data (cddr data))
2107 (gnus-data-update-list (cdr data) offset))
2109 gnus-newsgroup-data-reverse nil))
2110 (setq data (cdr data))))))
2112 (defmacro gnus-data-list (backward)
2114 (or gnus-newsgroup-data-reverse
2115 (setq gnus-newsgroup-data-reverse
2116 (reverse gnus-newsgroup-data)))
2117 gnus-newsgroup-data))
2119 (defun gnus-data-update-list (data offset)
2120 "Add OFFSET to the POS of all data entries in DATA."
2122 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2123 (setq data (cdr data))))
2125 (defun gnus-data-compute-positions ()
2126 "Compute the positions of all articles."
2127 (let ((data gnus-newsgroup-data)
2130 (when (setq pos (text-property-any
2131 (point-min) (point-max)
2132 'gnus-number (gnus-data-number (car data))))
2133 (gnus-data-set-pos (car data) (+ pos 3)))
2134 (setq data (cdr data)))))
2136 (defun gnus-summary-article-pseudo-p (article)
2137 "Say whether this article is a pseudo article or not."
2138 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2140 (defmacro gnus-summary-article-sparse-p (article)
2141 "Say whether this article is a sparse article or not."
2142 ` (memq ,article gnus-newsgroup-sparse))
2144 (defmacro gnus-summary-article-ancient-p (article)
2145 "Say whether this article is a sparse article or not."
2146 `(memq ,article gnus-newsgroup-ancient))
2148 (defun gnus-article-parent-p (number)
2149 "Say whether this article is a parent or not."
2150 (let ((data (gnus-data-find-list number)))
2151 (and (cdr data) ; There has to be an article after...
2152 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2153 (gnus-data-level (nth 1 data))))))
2155 (defun gnus-article-children (number)
2156 "Return a list of all children to NUMBER."
2157 (let* ((data (gnus-data-find-list number))
2158 (level (gnus-data-level (car data)))
2160 (setq data (cdr data))
2162 (= (gnus-data-level (car data)) (1+ level)))
2163 (push (gnus-data-number (car data)) children)
2164 (setq data (cdr data)))
2167 (defmacro gnus-summary-skip-intangible ()
2168 "If the current article is intangible, then jump to a different article."
2169 '(let ((to (get-text-property (point) 'gnus-intangible)))
2170 (and to (gnus-summary-goto-subject to))))
2172 (defmacro gnus-summary-article-intangible-p ()
2173 "Say whether this article is intangible or not."
2174 '(get-text-property (point) 'gnus-intangible))
2176 (defun gnus-article-read-p (article)
2177 "Say whether ARTICLE is read or not."
2178 (not (or (memq article gnus-newsgroup-marked)
2179 (memq article gnus-newsgroup-unreads)
2180 (memq article gnus-newsgroup-unselected)
2181 (memq article gnus-newsgroup-dormant))))
2183 ;; Some summary mode macros.
2185 (defmacro gnus-summary-article-number ()
2186 "The article number of the article on the current line.
2187 If there isn's an article number here, then we return the current
2190 (gnus-summary-skip-intangible)
2191 (or (get-text-property (point) 'gnus-number)
2192 (gnus-summary-last-subject))))
2194 (defmacro gnus-summary-article-header (&optional number)
2195 `(gnus-data-header (gnus-data-find
2196 ,(or number '(gnus-summary-article-number)))))
2198 (defmacro gnus-summary-thread-level (&optional number)
2199 `(if (and (eq gnus-summary-make-false-root 'dummy)
2200 (get-text-property (point) 'gnus-intangible))
2202 (gnus-data-level (gnus-data-find
2203 ,(or number '(gnus-summary-article-number))))))
2205 (defmacro gnus-summary-article-mark (&optional number)
2206 `(gnus-data-mark (gnus-data-find
2207 ,(or number '(gnus-summary-article-number)))))
2209 (defmacro gnus-summary-article-pos (&optional number)
2210 `(gnus-data-pos (gnus-data-find
2211 ,(or number '(gnus-summary-article-number)))))
2213 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2214 (defmacro gnus-summary-article-subject (&optional number)
2215 "Return current subject string or nil if nothing."
2218 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2219 '(gnus-data-header (assq (gnus-summary-article-number)
2220 gnus-newsgroup-data)))))
2223 (mail-header-subject headers))))
2225 (defmacro gnus-summary-article-score (&optional number)
2226 "Return current article score."
2227 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2228 gnus-newsgroup-scored))
2229 gnus-summary-default-score 0))
2231 (defun gnus-summary-article-children (&optional number)
2232 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2233 (level (gnus-data-level (car data)))
2235 (while (and (setq data (cdr data))
2236 (> (setq l (gnus-data-level (car data))) level))
2237 (and (= (1+ level) l)
2238 (push (gnus-data-number (car data))
2240 (nreverse children)))
2242 (defun gnus-summary-article-parent (&optional number)
2243 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2244 (gnus-data-list t)))
2245 (level (gnus-data-level (car data))))
2247 () ; This is a root.
2248 ;; We search until we find an article with a level less than
2249 ;; this one. That function has to be the parent.
2250 (while (and (setq data (cdr data))
2251 (not (< (gnus-data-level (car data)) level))))
2252 (and data (gnus-data-number (car data))))))
2254 (defun gnus-unread-mark-p (mark)
2255 "Say whether MARK is the unread mark."
2256 (= mark gnus-unread-mark))
2258 (defun gnus-read-mark-p (mark)
2259 "Say whether MARK is one of the marks that mark as read.
2260 This is all marks except unread, ticked, dormant, and expirable."
2261 (not (or (= mark gnus-unread-mark)
2262 (= mark gnus-ticked-mark)
2263 (= mark gnus-dormant-mark)
2264 (= mark gnus-expirable-mark))))
2266 (defmacro gnus-article-mark (number)
2268 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2269 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2270 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2271 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2272 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2273 gnus-ancient-mark))))
2275 ;; Saving hidden threads.
2277 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2278 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2280 (defmacro gnus-save-hidden-threads (&rest forms)
2281 "Save hidden threads, eval FORMS, and restore the hidden threads."
2282 (let ((config (make-symbol "config")))
2283 `(let ((,config (gnus-hidden-threads-configuration)))
2287 (gnus-restore-hidden-threads-configuration ,config)))))
2289 (defun gnus-hidden-threads-configuration ()
2290 "Return the current hidden threads configuration."
2293 (goto-char (point-min))
2294 (while (search-forward "\r" nil t)
2295 (push (1- (point)) config))
2298 (defun gnus-restore-hidden-threads-configuration (config)
2299 "Restore hidden threads configuration from CONFIG."
2300 (let (point buffer-read-only)
2301 (while (setq point (pop config))
2302 (when (and (< point (point-max))
2304 (= (following-char) ?\n))
2305 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2307 ;; Various summary mode internalish functions.
2309 (defun gnus-mouse-pick-article (e)
2312 (gnus-summary-next-page nil t))
2314 (defun gnus-summary-setup-buffer (group)
2315 "Initialize summary buffer."
2316 (let ((buffer (concat "*Summary " group "*")))
2317 (if (get-buffer buffer)
2320 (setq gnus-summary-buffer (current-buffer))
2321 (not gnus-newsgroup-prepared))
2322 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2323 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2324 (gnus-add-current-to-buffer-list)
2325 (gnus-summary-mode group)
2327 (gnus-carpal-setup-buffer 'summary))
2328 (unless gnus-single-article-buffer
2329 (make-local-variable 'gnus-article-buffer)
2330 (make-local-variable 'gnus-article-current)
2331 (make-local-variable 'gnus-original-article-buffer))
2332 (setq gnus-newsgroup-name group)
2335 (defun gnus-set-global-variables ()
2336 ;; Set the global equivalents of the summary buffer-local variables
2337 ;; to the latest values they had. These reflect the summary buffer
2338 ;; that was in action when the last article was fetched.
2339 (when (eq major-mode 'gnus-summary-mode)
2340 (setq gnus-summary-buffer (current-buffer))
2341 (let ((name gnus-newsgroup-name)
2342 (marked gnus-newsgroup-marked)
2343 (unread gnus-newsgroup-unreads)
2344 (headers gnus-current-headers)
2345 (data gnus-newsgroup-data)
2346 (summary gnus-summary-buffer)
2347 (article-buffer gnus-article-buffer)
2348 (original gnus-original-article-buffer)
2349 (gac gnus-article-current)
2350 (reffed gnus-reffed-article-number)
2351 (score-file gnus-current-score-file))
2353 (set-buffer gnus-group-buffer)
2354 (setq gnus-newsgroup-name name)
2355 (setq gnus-newsgroup-marked marked)
2356 (setq gnus-newsgroup-unreads unread)
2357 (setq gnus-current-headers headers)
2358 (setq gnus-newsgroup-data data)
2359 (setq gnus-article-current gac)
2360 (setq gnus-summary-buffer summary)
2361 (setq gnus-article-buffer article-buffer)
2362 (setq gnus-original-article-buffer original)
2363 (setq gnus-reffed-article-number reffed)
2364 (setq gnus-current-score-file score-file)
2365 ;; The article buffer also has local variables.
2366 (when (gnus-buffer-live-p gnus-article-buffer)
2367 (set-buffer gnus-article-buffer)
2368 (setq gnus-summary-buffer summary))))))
2370 (defun gnus-summary-article-unread-p (article)
2371 "Say whether ARTICLE is unread or not."
2372 (memq article gnus-newsgroup-unreads))
2374 (defun gnus-summary-first-article-p (&optional article)
2375 "Return whether ARTICLE is the first article in the buffer."
2376 (if (not (setq article (or article (gnus-summary-article-number))))
2378 (eq article (caar gnus-newsgroup-data))))
2380 (defun gnus-summary-last-article-p (&optional article)
2381 "Return whether ARTICLE is the last article in the buffer."
2382 (if (not (setq article (or article (gnus-summary-article-number))))
2383 t ; All non-existent numbers are the last article. :-)
2384 (not (cdr (gnus-data-find-list article)))))
2386 (defun gnus-make-thread-indent-array ()
2388 (unless (and gnus-thread-indent-array
2389 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2390 (setq gnus-thread-indent-array (make-vector 201 "")
2391 gnus-thread-indent-array-level gnus-thread-indent-level)
2393 (aset gnus-thread-indent-array n
2394 (make-string (* n gnus-thread-indent-level) ? ))
2397 (defun gnus-update-summary-mark-positions ()
2398 "Compute where the summary marks are to go."
2400 (when (and gnus-summary-buffer
2401 (get-buffer gnus-summary-buffer)
2402 (buffer-name (get-buffer gnus-summary-buffer)))
2403 (set-buffer gnus-summary-buffer))
2404 (let ((gnus-replied-mark 129)
2405 (gnus-score-below-mark 130)
2406 (gnus-score-over-mark 130)
2407 (spec gnus-summary-line-format-spec)
2408 thread gnus-visual pos)
2410 (gnus-set-work-buffer)
2411 (let ((gnus-summary-line-format-spec spec))
2412 (gnus-summary-insert-line
2413 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2414 (goto-char (point-min))
2415 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2417 (goto-char (point-min))
2418 (push (cons 'replied (and (search-forward "\201" nil t)
2421 (goto-char (point-min))
2422 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2424 (setq gnus-summary-mark-positions pos))))
2426 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2427 "Insert a dummy root in the summary buffer."
2429 (gnus-add-text-properties
2430 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2431 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2433 (defun gnus-summary-insert-line (gnus-tmp-header
2434 gnus-tmp-level gnus-tmp-current
2435 gnus-tmp-unread gnus-tmp-replied
2436 gnus-tmp-expirable gnus-tmp-subject-or-nil
2437 &optional gnus-tmp-dummy gnus-tmp-score
2439 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2440 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2441 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2442 (gnus-tmp-score-char
2443 (if (or (null gnus-summary-default-score)
2444 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2445 gnus-summary-zcore-fuzz))
2447 (if (< gnus-tmp-score gnus-summary-default-score)
2448 gnus-score-below-mark gnus-score-over-mark)))
2450 (cond (gnus-tmp-process gnus-process-mark)
2451 ((memq gnus-tmp-current gnus-newsgroup-cached)
2453 (gnus-tmp-replied gnus-replied-mark)
2454 ((memq gnus-tmp-current gnus-newsgroup-saved)
2456 (t gnus-unread-mark)))
2457 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2460 ((string-match "<[^>]+> *$" gnus-tmp-from)
2461 (let ((beg (match-beginning 0)))
2462 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2463 (substring gnus-tmp-from (1+ (match-beginning 0))
2464 (1- (match-end 0))))
2465 (substring gnus-tmp-from 0 beg))))
2466 ((string-match "(.+)" gnus-tmp-from)
2467 (substring gnus-tmp-from
2468 (1+ (match-beginning 0)) (1- (match-end 0))))
2470 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2471 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2472 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2473 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2474 (buffer-read-only nil))
2475 (when (string= gnus-tmp-name "")
2476 (setq gnus-tmp-name gnus-tmp-from))
2477 (unless (numberp gnus-tmp-lines)
2478 (setq gnus-tmp-lines 0))
2479 (gnus-put-text-property
2481 (progn (eval gnus-summary-line-format-spec) (point))
2482 'gnus-number gnus-tmp-number)
2483 (when (gnus-visual-p 'summary-highlight 'highlight)
2485 (run-hooks 'gnus-summary-update-hook)
2488 (defun gnus-summary-update-line (&optional dont-update)
2489 ;; Update summary line after change.
2490 (when (and gnus-summary-default-score
2491 (not gnus-summary-inhibit-highlight))
2492 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2493 (article (gnus-summary-article-number))
2494 (score (gnus-summary-article-score article)))
2496 (if (and gnus-summary-mark-below
2497 (< (gnus-summary-article-score)
2498 gnus-summary-mark-below))
2499 ;; This article has a low score, so we mark it as read.
2500 (when (memq article gnus-newsgroup-unreads)
2501 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2502 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2503 ;; This article was previously marked as read on account
2504 ;; of a low score, but now it has risen, so we mark it as
2506 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2507 (gnus-summary-update-mark
2508 (if (or (null gnus-summary-default-score)
2509 (<= (abs (- score gnus-summary-default-score))
2510 gnus-summary-zcore-fuzz))
2512 (if (< score gnus-summary-default-score)
2513 gnus-score-below-mark gnus-score-over-mark))
2515 ;; Do visual highlighting.
2516 (when (gnus-visual-p 'summary-highlight 'highlight)
2517 (run-hooks 'gnus-summary-update-hook)))))
2519 (defvar gnus-tmp-new-adopts nil)
2521 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2522 "Return the number of articles in THREAD.
2523 This may be 0 in some cases -- if none of the articles in
2524 the thread are to be displayed."
2526 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2528 ((not (listp thread))
2530 ((and (consp thread) (cdr thread))
2533 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2536 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2539 (when (and level (zerop level) gnus-tmp-new-adopts)
2542 'gnus-summary-number-of-articles-in-thread
2543 gnus-tmp-new-adopts))))
2545 (if (> number 1) gnus-not-empty-thread-mark
2546 gnus-empty-thread-mark)
2549 (defun gnus-summary-set-local-parameters (group)
2550 "Go through the local params of GROUP and set all variable specs in that list."
2551 (let ((params (gnus-group-find-parameter group))
2554 (setq elem (car params)
2555 params (cdr params))
2556 (and (consp elem) ; Has to be a cons.
2557 (consp (cdr elem)) ; The cdr has to be a list.
2558 (symbolp (car elem)) ; Has to be a symbol in there.
2559 (not (memq (car elem)
2560 '(quit-config to-address to-list to-group)))
2561 (progn ; So we set it.
2562 (make-local-variable (car elem))
2563 (set (car elem) (eval (nth 1 elem))))))))
2565 (defun gnus-summary-read-group (group &optional show-all no-article
2566 kill-buffer no-display)
2567 "Start reading news in newsgroup GROUP.
2568 If SHOW-ALL is non-nil, already read articles are also listed.
2569 If NO-ARTICLE is non-nil, no article is selected initially.
2570 If NO-DISPLAY, don't generate a summary buffer."
2571 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2572 (let* ((new-group (gnus-summary-setup-buffer group))
2573 (quit-config (gnus-group-quit-config group))
2574 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2576 ;; This summary buffer exists already, so we just select it.
2578 (gnus-set-global-variables)
2580 (gnus-kill-or-deaden-summary kill-buffer))
2581 (gnus-configure-windows 'summary 'force)
2582 (gnus-set-mode-line 'summary)
2583 (gnus-summary-position-point)
2586 ;; We couldn't select this group.
2588 (when (and (eq major-mode 'gnus-summary-mode)
2589 (not (equal (current-buffer) kill-buffer)))
2590 (kill-buffer (current-buffer))
2591 (if (not quit-config)
2593 (set-buffer gnus-group-buffer)
2594 (gnus-group-jump-to-group group)
2595 (gnus-group-next-unread-group 1))
2596 (gnus-handle-ephemeral-exit quit-config)))
2597 (gnus-message 3 "Can't select group")
2599 ;; The user did a `C-g' while prompting for number of articles,
2600 ;; so we exit this group.
2601 ((eq did-select 'quit)
2602 (and (eq major-mode 'gnus-summary-mode)
2603 (not (equal (current-buffer) kill-buffer))
2604 (kill-buffer (current-buffer)))
2606 (gnus-kill-or-deaden-summary kill-buffer))
2607 (if (not quit-config)
2609 (set-buffer gnus-group-buffer)
2610 (gnus-group-jump-to-group group)
2611 (gnus-group-next-unread-group 1)
2612 (gnus-configure-windows 'group 'force))
2613 (gnus-handle-ephemeral-exit quit-config))
2614 ;; Finally signal the quit.
2616 ;; The group was successfully selected.
2618 (gnus-set-global-variables)
2619 ;; Save the active value in effect when the group was entered.
2620 (setq gnus-newsgroup-active
2622 (gnus-active gnus-newsgroup-name)))
2623 ;; You can change the summary buffer in some way with this hook.
2624 (run-hooks 'gnus-select-group-hook)
2625 ;; Set any local variables in the group parameters.
2626 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2627 (gnus-update-format-specifications
2628 nil 'summary 'summary-mode 'summary-dummy)
2629 ;; Do score processing.
2630 (when gnus-use-scoring
2631 (gnus-possibly-score-headers))
2632 ;; Check whether to fill in the gaps in the threads.
2633 (when gnus-build-sparse-threads
2634 (gnus-build-sparse-threads))
2635 ;; Find the initial limit.
2636 (if gnus-show-threads
2638 (let ((gnus-newsgroup-dormant nil))
2639 (gnus-summary-initial-limit show-all))
2640 (gnus-summary-initial-limit show-all))
2641 (setq gnus-newsgroup-limit
2643 (lambda (header) (mail-header-number header))
2644 gnus-newsgroup-headers)))
2645 ;; Generate the summary buffer.
2647 (gnus-summary-prepare))
2648 (when gnus-use-trees
2649 (gnus-tree-open group)
2650 (setq gnus-summary-highlight-line-function
2651 'gnus-tree-highlight-article))
2652 ;; If the summary buffer is empty, but there are some low-scored
2653 ;; articles or some excluded dormants, we include these in the
2655 (when (and (zerop (buffer-size))
2657 (cond (gnus-newsgroup-dormant
2658 (gnus-summary-limit-include-dormant))
2659 ((and gnus-newsgroup-scored show-all)
2660 (gnus-summary-limit-include-expunged t))))
2661 ;; Function `gnus-apply-kill-file' must be called in this hook.
2662 (run-hooks 'gnus-apply-kill-hook)
2663 (if (and (zerop (buffer-size))
2666 ;; This newsgroup is empty.
2667 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2668 (gnus-message 6 "No unread news")
2670 (gnus-kill-or-deaden-summary kill-buffer))
2671 ;; Return nil from this function.
2673 ;; Hide conversation thread subtrees. We cannot do this in
2674 ;; gnus-summary-prepare-hook since kill processing may not
2675 ;; work with hidden articles.
2676 (and gnus-show-threads
2677 gnus-thread-hide-subtree
2678 (gnus-summary-hide-all-threads))
2679 ;; Show first unread article if requested.
2680 (if (and (not no-article)
2682 gnus-newsgroup-unreads
2683 gnus-auto-select-first)
2684 (unless (if (eq gnus-auto-select-first 'best)
2685 (gnus-summary-best-unread-article)
2686 (gnus-summary-first-unread-article))
2687 (gnus-configure-windows 'summary))
2688 ;; Don't select any articles, just move point to the first
2689 ;; article in the group.
2690 (goto-char (point-min))
2691 (gnus-summary-position-point)
2692 (gnus-set-mode-line 'summary)
2693 (gnus-configure-windows 'summary 'force))
2695 (gnus-kill-or-deaden-summary kill-buffer))
2696 (when (get-buffer-window gnus-group-buffer t)
2697 ;; Gotta use windows, because recenter does weird stuff if
2698 ;; the current buffer ain't the displayed window.
2699 (let ((owin (selected-window)))
2700 (select-window (get-buffer-window gnus-group-buffer t))
2701 (when (gnus-group-goto-group group)
2703 (select-window owin))))
2704 ;; Mark this buffer as "prepared".
2705 (setq gnus-newsgroup-prepared t)
2708 (defun gnus-summary-prepare ()
2709 "Generate the summary buffer."
2711 (let ((buffer-read-only nil))
2713 (setq gnus-newsgroup-data nil
2714 gnus-newsgroup-data-reverse nil)
2715 (run-hooks 'gnus-summary-generate-hook)
2716 ;; Generate the buffer, either with threads or without.
2717 (when gnus-newsgroup-headers
2718 (gnus-summary-prepare-threads
2719 (if gnus-show-threads
2720 (gnus-sort-gathered-threads
2721 (funcall gnus-summary-thread-gathering-function
2723 (gnus-cut-threads (gnus-make-threads)))))
2724 ;; Unthreaded display.
2725 (gnus-sort-articles gnus-newsgroup-headers))))
2726 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2727 ;; Call hooks for modifying summary buffer.
2728 (goto-char (point-min))
2729 (run-hooks 'gnus-summary-prepare-hook)))
2731 (defsubst gnus-general-simplify-subject (subject)
2732 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2735 ;; Truncate the subject.
2736 ((numberp gnus-summary-gather-subject-limit)
2737 (setq subject (gnus-simplify-subject-re subject))
2738 (if (> (length subject) gnus-summary-gather-subject-limit)
2739 (substring subject 0 gnus-summary-gather-subject-limit)
2741 ;; Fuzzily simplify it.
2742 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2743 (gnus-simplify-subject-fuzzy subject))
2744 ;; Just remove the leading "Re:".
2746 (gnus-simplify-subject-re subject))))
2748 (if (and gnus-summary-gather-exclude-subject
2749 (string-match gnus-summary-gather-exclude-subject subject))
2750 nil ; This article shouldn't be gathered
2753 (defun gnus-summary-simplify-subject-query ()
2754 "Query where the respool algorithm would put this article."
2756 (gnus-set-global-variables)
2757 (gnus-summary-select-article)
2758 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2760 (defun gnus-gather-threads-by-subject (threads)
2761 "Gather threads by looking at Subject headers."
2762 (if (not gnus-summary-make-false-root)
2764 (let ((hashtb (gnus-make-hashtable 1024))
2767 subject hthread whole-subject)
2769 (setq subject (gnus-general-simplify-subject
2770 (setq whole-subject (mail-header-subject
2773 (if (setq hthread (gnus-gethash subject hashtb))
2775 ;; We enter a dummy root into the thread, if we
2776 ;; haven't done that already.
2777 (unless (stringp (caar hthread))
2778 (setcar hthread (list whole-subject (car hthread))))
2779 ;; We add this new gathered thread to this gathered
2781 (setcdr (car hthread)
2782 (nconc (cdar hthread) (list (car threads))))
2783 ;; Remove it from the list of threads.
2784 (setcdr prev (cdr threads))
2785 (setq threads prev))
2786 ;; Enter this thread into the hash table.
2787 (gnus-sethash subject threads hashtb)))
2789 (setq threads (cdr threads)))
2792 (defun gnus-gather-threads-by-references (threads)
2793 "Gather threads by looking at References headers."
2794 (let ((idhashtb (gnus-make-hashtable 1024))
2795 (thhashtb (gnus-make-hashtable 1024))
2798 ids references id gthread gid entered ref)
2800 (when (setq references (mail-header-references (caar threads)))
2801 (setq id (mail-header-id (caar threads))
2802 ids (gnus-split-references references)
2804 (while (setq ref (pop ids))
2805 (setq ids (delete ref ids))
2806 (if (not (setq gid (gnus-gethash ref idhashtb)))
2808 (gnus-sethash ref id idhashtb)
2809 (gnus-sethash id threads thhashtb))
2810 (setq gthread (gnus-gethash gid thhashtb))
2812 ;; We enter a dummy root into the thread, if we
2813 ;; haven't done that already.
2814 (unless (stringp (caar gthread))
2815 (setcar gthread (list (mail-header-subject (caar gthread))
2817 ;; We add this new gathered thread to this gathered
2819 (setcdr (car gthread)
2820 (nconc (cdar gthread) (list (car threads)))))
2821 ;; Add it into the thread hash table.
2822 (gnus-sethash id gthread thhashtb)
2824 ;; Remove it from the list of threads.
2825 (setcdr prev (cdr threads))
2826 (setq threads prev))))
2828 (setq threads (cdr threads)))
2831 (defun gnus-sort-gathered-threads (threads)
2832 "Sort subtreads inside each gathered thread by article number."
2833 (let ((result threads))
2835 (when (stringp (caar threads))
2836 (setcdr (car threads)
2837 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2838 (setq threads (cdr threads)))
2841 (defun gnus-thread-loop-p (root thread)
2842 "Say whether ROOT is in THREAD."
2843 (let ((th (cdr thread)))
2845 (not (eq (caar th) root)))
2848 ;; We have found a loop.
2850 (setcdr thread (delq (car th) (cdr thread)))
2851 (if (boundp (setq ref-dep (intern "none"
2852 gnus-newsgroup-dependencies)))
2853 (setcdr (symbol-value ref-dep)
2854 (nconc (cdr (symbol-value ref-dep))
2856 (set ref-dep (list nil (car th))))
2858 ;; Recurse down into the sub-threads and look for loops.
2861 (lambda (thread) (gnus-thread-loop-p root thread))
2864 (defun gnus-make-threads ()
2865 "Go through the dependency hashtb and find the roots. Return all threads."
2867 (while (catch 'infloop
2870 ;; Deal with self-referencing References loops.
2871 (when (and (car (symbol-value refs))
2878 (car (symbol-value refs)) thread))
2879 (cdr (symbol-value refs)))))))
2882 (unless (car (symbol-value refs))
2883 ;; These threads do not refer back to any other articles,
2884 ;; so they're roots.
2885 (setq threads (append (cdr (symbol-value refs)) threads))))
2886 gnus-newsgroup-dependencies)))
2889 (defun gnus-build-sparse-threads ()
2890 (let ((headers gnus-newsgroup-headers)
2891 (deps gnus-newsgroup-dependencies)
2892 header references generation relations
2893 cthread subject child end pthread relation)
2894 ;; First we create an alist of generations/relations, where
2895 ;; generations is how much we trust the relation, and the relation
2897 (gnus-message 7 "Making sparse threads...")
2899 (nnheader-set-temp-buffer " *gnus sparse threads*")
2900 (while (setq header (pop headers))
2901 (when (and (setq references (mail-header-references header))
2902 (not (string= references "")))
2904 (setq child (mail-header-id header)
2905 subject (mail-header-subject header))
2907 (while (search-backward ">" nil t)
2908 (setq end (1+ (point)))
2909 (when (search-backward "<" nil t)
2910 (push (list (incf generation)
2911 child (setq child (buffer-substring (point) end))
2914 (push (list (1+ generation) child nil subject) relations)
2916 (kill-buffer (current-buffer)))
2917 ;; Sort over trustworthiness.
2918 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2919 (while (setq relation (pop relations))
2920 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2921 (unless (car (symbol-value cthread))
2922 ;; Make this article the parent of these threads.
2923 (setcar (symbol-value cthread)
2924 (vector gnus-reffed-article-number
2928 (or (caddr relation) "") 0 0 "")))
2929 (set cthread (list (vector gnus-reffed-article-number
2931 "" "" (cadr relation)
2932 (or (caddr relation) "") 0 0 ""))))
2933 (push gnus-reffed-article-number gnus-newsgroup-limit)
2934 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2935 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2936 gnus-newsgroup-reads)
2937 (decf gnus-reffed-article-number)
2938 ;; Make this new thread the child of its parent.
2939 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2940 (setcdr (symbol-value pthread)
2941 (nconc (cdr (symbol-value pthread))
2942 (list (symbol-value cthread))))
2943 (set pthread (list nil (symbol-value cthread))))))
2944 (gnus-message 7 "Making sparse threads...done")))
2946 (defun gnus-build-old-threads ()
2947 ;; Look at all the articles that refer back to old articles, and
2948 ;; fetch the headers for the articles that aren't there. This will
2949 ;; build complete threads - if the roots haven't been expired by the
2954 (when (not (car (symbol-value refs)))
2955 (setq heads (cdr (symbol-value refs)))
2957 (if (memq (mail-header-number (caar heads))
2958 gnus-newsgroup-dormant)
2959 (setq heads (cdr heads))
2960 (setq id (symbol-name refs))
2961 (while (and (setq id (gnus-build-get-header id))
2962 (not (car (gnus-gethash
2963 id gnus-newsgroup-dependencies)))))
2964 (setq heads nil)))))
2965 gnus-newsgroup-dependencies)))
2967 (defun gnus-build-get-header (id)
2968 ;; Look through the buffer of NOV lines and find the header to
2969 ;; ID. Enter this line into the dependencies hash table, and return
2970 ;; the id of the parent article (if any).
2971 (let ((deps gnus-newsgroup-dependencies)
2975 (set-buffer nntp-server-buffer)
2976 (goto-char (point-min))
2977 (while (and (not found) (search-forward id nil t))
2979 (setq found (looking-at
2980 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2981 (regexp-quote id))))
2982 (or found (beginning-of-line 2)))
2986 (setq header (gnus-nov-parse-line
2987 (read (current-buffer)) deps))
2988 (gnus-parent-id (mail-header-references header)))))
2990 (let ((number (mail-header-number header)))
2991 (push number gnus-newsgroup-limit)
2992 (push header gnus-newsgroup-headers)
2993 (if (memq number gnus-newsgroup-unselected)
2995 (push number gnus-newsgroup-unreads)
2996 (setq gnus-newsgroup-unselected
2997 (delq number gnus-newsgroup-unselected)))
2998 (push number gnus-newsgroup-ancient)))))))
3000 (defun gnus-summary-update-article-line (article header)
3001 "Update the line for ARTICLE using HEADERS."
3002 (let* ((id (mail-header-id header))
3003 (thread (gnus-id-to-thread id)))
3005 (error "Article in no thread"))
3006 ;; Update the thread.
3007 (setcar thread header)
3008 (gnus-summary-goto-subject article)
3009 (let* ((datal (gnus-data-find-list article))
3011 (length (when (cdr datal)
3012 (- (gnus-data-pos data)
3013 (gnus-data-pos (cadr datal)))))
3014 (buffer-read-only nil)
3015 (level (gnus-summary-thread-level)))
3017 (gnus-summary-insert-line
3018 header level nil (gnus-article-mark article)
3019 (memq article gnus-newsgroup-replied)
3020 (memq article gnus-newsgroup-expirable)
3021 (mail-header-subject header)
3022 nil (cdr (assq article gnus-newsgroup-scored))
3023 (memq article gnus-newsgroup-processable))
3025 (gnus-data-update-list
3026 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3028 (defun gnus-summary-update-article (article &optional iheader)
3029 "Update ARTICLE in the summary buffer."
3030 (set-buffer gnus-summary-buffer)
3031 (let* ((header (or iheader (gnus-summary-article-header article)))
3032 (id (mail-header-id header))
3033 (data (gnus-data-find article))
3034 (thread (gnus-id-to-thread id))
3035 (references (mail-header-references header))
3039 (when (and references
3040 (not (equal "" references)))
3043 (buffer-read-only nil)
3045 (number (mail-header-number header))
3048 ;; !!! Should this be in or not?
3050 (setcar thread nil))
3052 (delq thread parent))
3053 (if (gnus-summary-insert-subject id header iheader)
3054 ;; Set the (possibly) new article number in the data structure.
3055 (gnus-data-set-number data (gnus-id-to-article id))
3059 (defun gnus-rebuild-thread (id)
3060 "Rebuild the thread containing ID."
3061 (let ((buffer-read-only nil)
3062 old-pos current thread data)
3063 (if (not gnus-show-threads)
3064 (setq thread (list (car (gnus-id-to-thread id))))
3065 ;; Get the thread this article is part of.
3066 (setq thread (gnus-remove-thread id)))
3067 (setq old-pos (gnus-point-at-bol))
3068 (setq current (save-excursion
3069 (and (zerop (forward-line -1))
3070 (gnus-summary-article-number))))
3071 ;; If this is a gathered thread, we have to go some re-gathering.
3072 (when (stringp (car thread))
3073 (let ((subject (car thread))
3075 (setq thread (cdr thread))
3077 (unless (memq (setq thr (gnus-id-to-thread
3079 (mail-header-id (caar thread)))))
3082 (setq thread (cdr thread)))
3083 ;; We now have all (unique) roots.
3084 (if (= (length roots) 1)
3085 ;; All the loose roots are now one solid root.
3086 (setq thread (car roots))
3087 (setq thread (cons subject (gnus-sort-threads roots))))))
3089 ;; We then insert this thread into the summary buffer.
3090 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3091 (if gnus-show-threads
3092 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3093 (gnus-summary-prepare-unthreaded thread))
3094 (setq data (nreverse gnus-newsgroup-data))
3095 (setq threads gnus-newsgroup-threads))
3096 ;; We splice the new data into the data structure.
3097 (gnus-data-enter-list current data (- (point) old-pos))
3098 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3100 (defun gnus-number-to-header (number)
3101 "Return the header for article NUMBER."
3102 (let ((headers gnus-newsgroup-headers))
3104 (not (= number (mail-header-number (car headers)))))
3109 (defun gnus-parent-headers (headers &optional generation)
3110 "Return the headers of the GENERATIONeth parent of HEADERS."
3112 (setq generation 1))
3113 (let (references parent)
3114 (while (and headers (not (zerop generation)))
3115 (setq references (mail-header-references headers))
3116 (when (and references
3117 (setq parent (gnus-parent-id references))
3118 (setq headers (car (gnus-id-to-thread parent))))
3122 (defun gnus-id-to-thread (id)
3123 "Return the (sub-)thread where ID appears."
3124 (gnus-gethash id gnus-newsgroup-dependencies))
3126 (defun gnus-id-to-article (id)
3127 "Return the article number of ID."
3128 (let ((thread (gnus-id-to-thread id)))
3131 (mail-header-number (car thread)))))
3133 (defun gnus-id-to-header (id)
3134 "Return the article headers of ID."
3135 (car (gnus-id-to-thread id)))
3137 (defun gnus-article-displayed-root-p (article)
3138 "Say whether ARTICLE is a root(ish) article."
3139 (let ((level (gnus-summary-thread-level article))
3140 (refs (mail-header-references (gnus-summary-article-header article)))
3146 ((null (gnus-parent-id refs)) t)
3148 (null (setq particle (gnus-id-to-article
3149 (gnus-parent-id refs))))
3150 (null (gnus-summary-thread-level particle)))))))
3152 (defun gnus-root-id (id)
3153 "Return the id of the root of the thread where ID appears."
3155 (while (and id (setq prev (car (gnus-gethash
3156 id gnus-newsgroup-dependencies))))
3158 id (gnus-parent-id (mail-header-references prev))))
3161 (defun gnus-remove-thread (id &optional dont-remove)
3162 "Remove the thread that has ID in it."
3163 (let ((dep gnus-newsgroup-dependencies)
3164 headers thread last-id)
3165 ;; First go up in this thread until we find the root.
3166 (setq last-id (gnus-root-id id))
3167 (setq headers (list (car (gnus-id-to-thread last-id))
3168 (caadr (gnus-id-to-thread last-id))))
3169 ;; We have now found the real root of this thread. It might have
3170 ;; been gathered into some loose thread, so we have to search
3171 ;; through the threads to find the thread we wanted.
3172 (let ((threads gnus-newsgroup-threads)
3175 (setq sub (car threads))
3176 (if (stringp (car sub))
3177 ;; This is a gathered thread, so we look at the roots
3178 ;; below it to find whether this article is in this
3181 (setq sub (cdr sub))
3183 (when (member (caar sub) headers)
3184 (setq thread (car threads)
3187 (setq sub (cdr sub))))
3188 ;; It's an ordinary thread, so we check it.
3189 (when (eq (car sub) (car headers))
3192 (setq threads (cdr threads)))
3193 ;; If this article is in no thread, then it's a root.
3196 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3197 (setq thread (gnus-gethash last-id dep)))
3200 thread ; We return this thread.
3202 (if (stringp (car thread))
3204 ;; If we use dummy roots, then we have to remove the
3205 ;; dummy root as well.
3206 (when (eq gnus-summary-make-false-root 'dummy)
3208 (gnus-data-compute-positions))
3209 (setq thread (cdr thread))
3211 (gnus-remove-thread-1 (car thread))
3212 (setq thread (cdr thread))))
3213 (gnus-remove-thread-1 thread))))))))
3215 (defun gnus-remove-thread-1 (thread)
3216 "Remove the thread THREAD recursively."
3217 (let ((number (mail-header-number (pop thread)))
3219 (setq thread (reverse thread))
3221 (gnus-remove-thread-1 (pop thread)))
3222 (when (setq d (gnus-data-find number))
3223 (goto-char (gnus-data-pos d))
3226 (- (gnus-point-at-bol)
3228 (1+ (gnus-point-at-eol))
3229 (gnus-delete-line)))))))
3231 (defun gnus-sort-threads (threads)
3233 (if (not gnus-thread-sort-functions)
3235 (gnus-message 7 "Sorting threads...")
3237 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3238 (gnus-message 7 "Sorting threads...done"))))
3240 (defun gnus-sort-articles (articles)
3242 (when gnus-article-sort-functions
3243 (gnus-message 7 "Sorting articles...")
3245 (setq gnus-newsgroup-headers
3246 (sort articles (gnus-make-sort-function
3247 gnus-article-sort-functions)))
3248 (gnus-message 7 "Sorting articles...done"))))
3250 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3251 (defmacro gnus-thread-header (thread)
3252 ;; Return header of first article in THREAD.
3253 ;; Note that THREAD must never, ever be anything else than a variable -
3254 ;; using some other form will lead to serious barfage.
3255 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3256 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3257 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3260 (defsubst gnus-article-sort-by-number (h1 h2)
3261 "Sort articles by article number."
3262 (< (mail-header-number h1)
3263 (mail-header-number h2)))
3265 (defun gnus-thread-sort-by-number (h1 h2)
3266 "Sort threads by root article number."
3267 (gnus-article-sort-by-number
3268 (gnus-thread-header h1) (gnus-thread-header h2)))
3270 (defsubst gnus-article-sort-by-lines (h1 h2)
3271 "Sort articles by article Lines header."
3272 (< (mail-header-lines h1)
3273 (mail-header-lines h2)))
3275 (defun gnus-thread-sort-by-lines (h1 h2)
3276 "Sort threads by root article Lines header."
3277 (gnus-article-sort-by-lines
3278 (gnus-thread-header h1) (gnus-thread-header h2)))
3280 (defsubst gnus-article-sort-by-author (h1 h2)
3281 "Sort articles by root author."
3283 (let ((extract (funcall
3284 gnus-extract-address-components
3285 (mail-header-from h1))))
3286 (or (car extract) (cdr extract)))
3287 (let ((extract (funcall
3288 gnus-extract-address-components
3289 (mail-header-from h2))))
3290 (or (car extract) (cdr extract)))))
3292 (defun gnus-thread-sort-by-author (h1 h2)
3293 "Sort threads by root author."
3294 (gnus-article-sort-by-author
3295 (gnus-thread-header h1) (gnus-thread-header h2)))
3297 (defsubst gnus-article-sort-by-subject (h1 h2)
3298 "Sort articles by root subject."
3300 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3301 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3303 (defun gnus-thread-sort-by-subject (h1 h2)
3304 "Sort threads by root subject."
3305 (gnus-article-sort-by-subject
3306 (gnus-thread-header h1) (gnus-thread-header h2)))
3308 (defsubst gnus-article-sort-by-date (h1 h2)
3309 "Sort articles by root article date."
3311 (gnus-date-get-time (mail-header-date h1))
3312 (gnus-date-get-time (mail-header-date h2))))
3314 (defun gnus-thread-sort-by-date (h1 h2)
3315 "Sort threads by root article date."
3316 (gnus-article-sort-by-date
3317 (gnus-thread-header h1) (gnus-thread-header h2)))
3319 (defsubst gnus-article-sort-by-score (h1 h2)
3320 "Sort articles by root article score.
3321 Unscored articles will be counted as having a score of zero."
3322 (> (or (cdr (assq (mail-header-number h1)
3323 gnus-newsgroup-scored))
3324 gnus-summary-default-score 0)
3325 (or (cdr (assq (mail-header-number h2)
3326 gnus-newsgroup-scored))
3327 gnus-summary-default-score 0)))
3329 (defun gnus-thread-sort-by-score (h1 h2)
3330 "Sort threads by root article score."
3331 (gnus-article-sort-by-score
3332 (gnus-thread-header h1) (gnus-thread-header h2)))
3334 (defun gnus-thread-sort-by-total-score (h1 h2)
3335 "Sort threads by the sum of all scores in the thread.
3336 Unscored articles will be counted as having a score of zero."
3337 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3339 (defun gnus-thread-total-score (thread)
3340 ;; This function find the total score of THREAD.
3341 (cond ((null thread)
3344 (if (stringp (car thread))
3345 (apply gnus-thread-score-function 0
3346 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3347 (gnus-thread-total-score-1 thread)))
3349 (gnus-thread-total-score-1 (list thread)))))
3351 (defun gnus-thread-total-score-1 (root)
3352 ;; This function find the total score of the thread below ROOT.
3353 (setq root (car root))
3354 (apply gnus-thread-score-function
3356 (mapcar 'gnus-thread-total-score
3357 (cdr (gnus-gethash (mail-header-id root)
3358 gnus-newsgroup-dependencies)))
3359 (when (> (mail-header-number root) 0)
3360 (list (or (cdr (assq (mail-header-number root)
3361 gnus-newsgroup-scored))
3362 gnus-summary-default-score 0))))
3363 (list gnus-summary-default-score)
3366 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3367 (defvar gnus-tmp-prev-subject nil)
3368 (defvar gnus-tmp-false-parent nil)
3369 (defvar gnus-tmp-root-expunged nil)
3370 (defvar gnus-tmp-dummy-line nil)
3372 (defun gnus-summary-prepare-threads (threads)
3373 "Prepare summary buffer from THREADS and indentation LEVEL.
3374 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3375 or a straight list of headers."
3376 (gnus-message 7 "Generating summary...")
3378 (setq gnus-newsgroup-threads threads)
3381 (let ((gnus-tmp-level 0)
3382 (default-score (or gnus-summary-default-score 0))
3383 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3384 thread number subject stack state gnus-tmp-gathered beg-match
3385 new-roots gnus-tmp-new-adopts thread-end
3386 gnus-tmp-header gnus-tmp-unread
3387 gnus-tmp-replied gnus-tmp-subject-or-nil
3388 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3389 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3390 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3392 (setq gnus-tmp-prev-subject nil)
3394 (if (vectorp (car threads))
3395 ;; If this is a straight (sic) list of headers, then a
3396 ;; threaded summary display isn't required, so we just create
3397 ;; an unthreaded one.
3398 (gnus-summary-prepare-unthreaded threads)
3400 ;; Do the threaded display.
3402 (while (or threads stack gnus-tmp-new-adopts new-roots)
3404 (if (and (= gnus-tmp-level 0)
3405 (not (setq gnus-tmp-dummy-line nil))
3408 (not gnus-tmp-false-parent)
3409 (or gnus-tmp-new-adopts new-roots))
3410 (if gnus-tmp-new-adopts
3411 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3412 thread (list (car gnus-tmp-new-adopts))
3413 gnus-tmp-header (caar thread)
3414 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3416 (setq thread (list (car new-roots))
3417 gnus-tmp-header (caar thread)
3418 new-roots (cdr new-roots))))
3421 ;; If there are some threads, we do them before the
3422 ;; threads on the stack.
3423 (setq thread threads
3424 gnus-tmp-header (caar thread))
3425 ;; There were no current threads, so we pop something off
3427 (setq state (car stack)
3428 gnus-tmp-level (car state)
3431 gnus-tmp-header (caar thread))))
3433 (setq gnus-tmp-false-parent nil)
3434 (setq gnus-tmp-root-expunged nil)
3435 (setq thread-end nil)
3437 (if (stringp gnus-tmp-header)
3438 ;; The header is a dummy root.
3440 ((eq gnus-summary-make-false-root 'adopt)
3441 ;; We let the first article adopt the rest.
3442 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3444 (setq gnus-tmp-gathered
3446 (lambda (h) (mail-header-number (car h)))
3449 (setq thread (cons (list (caar thread)
3452 (setq gnus-tmp-level -1
3453 gnus-tmp-false-parent t))
3454 ((eq gnus-summary-make-false-root 'empty)
3455 ;; We print adopted articles with empty subject fields.
3456 (setq gnus-tmp-gathered
3458 (lambda (h) (mail-header-number (car h)))
3461 (setq gnus-tmp-level -1))
3462 ((eq gnus-summary-make-false-root 'dummy)
3463 ;; We remember that we probably want to output a dummy
3465 (setq gnus-tmp-dummy-line gnus-tmp-header)
3466 (setq gnus-tmp-prev-subject gnus-tmp-header))
3468 ;; We do not make a root for the gathered
3469 ;; sub-threads at all.
3470 (setq gnus-tmp-level -1)))
3472 (setq number (mail-header-number gnus-tmp-header)
3473 subject (mail-header-subject gnus-tmp-header))
3476 ;; If the thread has changed subject, we might want to make
3477 ;; this subthread into a root.
3478 ((and (null gnus-thread-ignore-subject)
3479 (not (zerop gnus-tmp-level))
3480 gnus-tmp-prev-subject
3482 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3483 (setq new-roots (nconc new-roots (list (car thread)))
3485 gnus-tmp-header nil))
3486 ;; If the article lies outside the current limit,
3487 ;; then we do not display it.
3488 ((not (memq number gnus-newsgroup-limit))
3489 (setq gnus-tmp-gathered
3491 (lambda (h) (mail-header-number (car h)))
3494 (setq gnus-tmp-new-adopts (if (cdar thread)
3495 (append gnus-tmp-new-adopts
3497 gnus-tmp-new-adopts)
3499 gnus-tmp-header nil)
3500 (when (zerop gnus-tmp-level)
3501 (setq gnus-tmp-root-expunged t)))
3502 ;; Perhaps this article is to be marked as read?
3503 ((and gnus-summary-mark-below
3504 (< (or (cdr (assq number gnus-newsgroup-scored))
3506 gnus-summary-mark-below)
3507 ;; Don't touch sparse articles.
3508 (not (gnus-summary-article-sparse-p number))
3509 (not (gnus-summary-article-ancient-p number)))
3510 (setq gnus-newsgroup-unreads
3511 (delq number gnus-newsgroup-unreads))
3512 (if gnus-newsgroup-auto-expire
3513 (push number gnus-newsgroup-expirable)
3514 (push (cons number gnus-low-score-mark)
3515 gnus-newsgroup-reads))))
3517 (when gnus-tmp-header
3518 ;; We may have an old dummy line to output before this
3520 (when gnus-tmp-dummy-line
3521 (gnus-summary-insert-dummy-line
3522 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3523 (setq gnus-tmp-dummy-line nil))
3525 ;; Compute the mark.
3526 (setq gnus-tmp-unread (gnus-article-mark number))
3528 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3529 gnus-tmp-header gnus-tmp-level)
3530 gnus-newsgroup-data)
3532 ;; Actually insert the line.
3534 gnus-tmp-subject-or-nil
3536 ((and gnus-thread-ignore-subject
3537 gnus-tmp-prev-subject
3538 (not (inline (gnus-subject-equal
3539 gnus-tmp-prev-subject subject))))
3541 ((zerop gnus-tmp-level)
3542 (if (and (eq gnus-summary-make-false-root 'empty)
3543 (memq number gnus-tmp-gathered)
3544 gnus-tmp-prev-subject
3545 (inline (gnus-subject-equal
3546 gnus-tmp-prev-subject subject)))
3547 gnus-summary-same-subject
3549 (t gnus-summary-same-subject)))
3550 (if (and (eq gnus-summary-make-false-root 'adopt)
3551 (= gnus-tmp-level 1)
3552 (memq number gnus-tmp-gathered))
3553 (setq gnus-tmp-opening-bracket ?\<
3554 gnus-tmp-closing-bracket ?\>)
3555 (setq gnus-tmp-opening-bracket ?\[
3556 gnus-tmp-closing-bracket ?\]))
3558 gnus-tmp-indentation
3559 (aref gnus-thread-indent-array gnus-tmp-level)
3560 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3561 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3562 gnus-summary-default-score 0)
3564 (if (or (null gnus-summary-default-score)
3565 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3566 gnus-summary-zcore-fuzz))
3568 (if (< gnus-tmp-score gnus-summary-default-score)
3569 gnus-score-below-mark gnus-score-over-mark))
3571 (cond ((memq number gnus-newsgroup-processable)
3573 ((memq number gnus-newsgroup-cached)
3575 ((memq number gnus-newsgroup-replied)
3577 ((memq number gnus-newsgroup-saved)
3579 (t gnus-unread-mark))
3580 gnus-tmp-from (mail-header-from gnus-tmp-header)
3583 ((string-match "<[^>]+> *$" gnus-tmp-from)
3584 (setq beg-match (match-beginning 0))
3585 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3586 (substring gnus-tmp-from (1+ (match-beginning 0))
3587 (1- (match-end 0))))
3588 (substring gnus-tmp-from 0 beg-match)))
3589 ((string-match "(.+)" gnus-tmp-from)
3590 (substring gnus-tmp-from
3591 (1+ (match-beginning 0)) (1- (match-end 0))))
3593 (when (string= gnus-tmp-name "")
3594 (setq gnus-tmp-name gnus-tmp-from))
3595 (unless (numberp gnus-tmp-lines)
3596 (setq gnus-tmp-lines 0))
3597 (gnus-put-text-property
3599 (progn (eval gnus-summary-line-format-spec) (point))
3600 'gnus-number number)
3603 (run-hooks 'gnus-summary-update-hook)
3606 (setq gnus-tmp-prev-subject subject)))
3608 (when (nth 1 thread)
3609 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3610 (incf gnus-tmp-level)
3611 (setq threads (if thread-end nil (cdar thread)))
3613 (setq gnus-tmp-level 0)))))
3614 (gnus-message 7 "Generating summary...done"))
3616 (defun gnus-summary-prepare-unthreaded (headers)
3617 "Generate an unthreaded summary buffer based on HEADERS."
3618 (let (header number mark)
3621 ;; We may have to root out some bad articles...
3622 (when (memq (setq number (mail-header-number
3623 (setq header (pop headers))))
3624 gnus-newsgroup-limit)
3625 ;; Mark article as read when it has a low score.
3626 (when (and gnus-summary-mark-below
3627 (< (or (cdr (assq number gnus-newsgroup-scored))
3628 gnus-summary-default-score 0)
3629 gnus-summary-mark-below)
3630 (not (gnus-summary-article-ancient-p number)))
3631 (setq gnus-newsgroup-unreads
3632 (delq number gnus-newsgroup-unreads))
3633 (if gnus-newsgroup-auto-expire
3634 (push number gnus-newsgroup-expirable)
3635 (push (cons number gnus-low-score-mark)
3636 gnus-newsgroup-reads)))
3638 (setq mark (gnus-article-mark number))
3639 (push (gnus-data-make number mark (1+ (point)) header 0)
3640 gnus-newsgroup-data)
3641 (gnus-summary-insert-line
3643 mark (memq number gnus-newsgroup-replied)
3644 (memq number gnus-newsgroup-expirable)
3645 (mail-header-subject header) nil
3646 (cdr (assq number gnus-newsgroup-scored))
3647 (memq number gnus-newsgroup-processable))))))
3649 (defun gnus-select-newsgroup (group &optional read-all)
3650 "Select newsgroup GROUP.
3651 If READ-ALL is non-nil, all articles in the group are selected."
3652 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3653 (info (nth 2 entry))
3654 articles fetched-articles cached)
3656 (unless (gnus-check-server
3657 (setq gnus-current-select-method (gnus-find-method-for-group group)))
3658 (error "Couldn't open server"))
3660 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3661 (gnus-activate-group group) ; Or we can activate it...
3662 (progn ; Or we bug out.
3663 (when (equal major-mode 'gnus-summary-mode)
3664 (kill-buffer (current-buffer)))
3665 (error "Couldn't request group %s: %s"
3666 group (gnus-status-message group))))
3668 (unless (gnus-request-group group t)
3669 (when (equal major-mode 'gnus-summary-mode)
3670 (kill-buffer (current-buffer)))
3671 (error "Couldn't request group %s: %s"
3672 group (gnus-status-message group)))
3674 (setq gnus-newsgroup-name group)
3675 (setq gnus-newsgroup-unselected nil)
3676 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3678 ;; Adjust and set lists of article marks.
3680 (gnus-adjust-marked-articles info))
3682 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3683 (when (gnus-virtual-group-p group)
3684 (setq cached gnus-newsgroup-cached))
3686 (setq gnus-newsgroup-unreads
3687 (gnus-set-difference
3688 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3689 gnus-newsgroup-dormant))
3691 (setq gnus-newsgroup-processable nil)
3693 (setq articles (gnus-articles-to-read group read-all))
3697 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3699 ((eq articles 0) nil)
3701 ;; Init the dependencies hash table.
3702 (setq gnus-newsgroup-dependencies
3703 (gnus-make-hashtable (length articles)))
3704 ;; Retrieve the headers and read them in.
3705 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3706 (setq gnus-newsgroup-headers
3708 (setq gnus-headers-retrieved-by
3709 (gnus-retrieve-headers
3710 articles gnus-newsgroup-name
3711 ;; We might want to fetch old headers, but
3712 ;; not if there is only 1 article.
3713 (and gnus-fetch-old-headers
3715 (not (eq gnus-fetch-old-headers 'some))
3716 (not (numberp gnus-fetch-old-headers)))
3717 (> (length articles) 1))))))
3718 (gnus-get-newsgroup-headers-xover articles)
3719 (gnus-get-newsgroup-headers)))
3720 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3722 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3724 (setq gnus-newsgroup-cached cached))
3726 ;; Suppress duplicates?
3727 (when gnus-suppress-duplicates
3728 (gnus-dup-suppress-articles))
3730 ;; Set the initial limit.
3731 (setq gnus-newsgroup-limit (copy-sequence articles))
3732 ;; Remove canceled articles from the list of unread articles.
3733 (setq gnus-newsgroup-unreads
3734 (gnus-set-sorted-intersection
3735 gnus-newsgroup-unreads
3736 (setq fetched-articles
3737 (mapcar (lambda (headers) (mail-header-number headers))
3738 gnus-newsgroup-headers))))
3739 ;; Removed marked articles that do not exist.
3740 (gnus-update-missing-marks
3741 (gnus-sorted-complement fetched-articles articles))
3742 ;; We might want to build some more threads first.
3743 (and gnus-fetch-old-headers
3744 (eq gnus-headers-retrieved-by 'nov)
3745 (gnus-build-old-threads))
3746 ;; Check whether auto-expire is to be done in this group.
3747 (setq gnus-newsgroup-auto-expire
3748 (gnus-group-auto-expirable-p group))
3749 ;; Set up the article buffer now, if necessary.
3750 (unless gnus-single-article-buffer
3751 (gnus-article-setup-buffer))
3752 ;; First and last article in this newsgroup.
3753 (when gnus-newsgroup-headers
3754 (setq gnus-newsgroup-begin
3755 (mail-header-number (car gnus-newsgroup-headers))
3758 (gnus-last-element gnus-newsgroup-headers))))
3759 ;; GROUP is successfully selected.
3760 (or gnus-newsgroup-headers t)))))
3762 (defun gnus-articles-to-read (group &optional read-all)
3763 ;; Find out what articles the user wants to read.
3765 ;; Select all articles if `read-all' is non-nil, or if there
3766 ;; are no unread articles.
3768 (and (zerop (length gnus-newsgroup-marked))
3769 (zerop (length gnus-newsgroup-unreads)))
3770 (eq (gnus-group-find-parameter group 'display)
3772 (gnus-uncompress-range (gnus-active group))
3773 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3774 (copy-sequence gnus-newsgroup-unreads))
3776 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3777 (scored (length scored-list))
3778 (number (length articles))
3779 (marked (+ (length gnus-newsgroup-marked)
3780 (length gnus-newsgroup-dormant)))
3788 ((and (or (<= scored marked) (= scored number))
3789 (numberp gnus-large-newsgroup)
3790 (> number gnus-large-newsgroup))
3794 "How many articles from %s (default %d): "
3795 gnus-newsgroup-name number))))
3796 (if (string-match "^[ \t]*$" input) number input)))
3797 ((and (> scored marked) (< scored number)
3798 (> (- scored number) 20))
3801 (format "%s %s (%d scored, %d total): "
3802 "How many articles from"
3803 group scored number))))
3804 (if (string-match "^[ \t]*$" input)
3808 (setq select (if (stringp select) (string-to-number select) select))
3809 (if (or (null select) (zerop select))
3811 (if (and (not (zerop scored)) (<= (abs select) scored))
3813 (setq articles (sort scored-list '<))
3814 (setq number (length articles)))
3815 (setq articles (copy-sequence articles)))
3817 (when (< (abs select) number)
3819 ;; Select the N oldest articles.
3820 (setcdr (nthcdr (1- (abs select)) articles) nil)
3821 ;; Select the N most recent articles.
3822 (setq articles (nthcdr (- number select) articles))))
3823 (setq gnus-newsgroup-unselected
3824 (gnus-sorted-intersection
3825 gnus-newsgroup-unreads
3826 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3829 (defun gnus-killed-articles (killed articles)
3832 (when (inline (gnus-member-of-range (car articles) killed))
3833 (push (car articles) out))
3834 (setq articles (cdr articles)))
3837 (defun gnus-uncompress-marks (marks)
3838 "Uncompress the mark ranges in MARKS."
3839 (let ((uncompressed '(score bookmark))
3842 (if (memq (caar marks) uncompressed)
3843 (push (car marks) out)
3844 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3845 (setq marks (cdr marks)))
3848 (defun gnus-adjust-marked-articles (info)
3849 "Set all article lists and remove all marks that are no longer legal."
3850 (let* ((marked-lists (gnus-info-marks info))
3851 (active (gnus-active (gnus-info-group info)))
3854 (types gnus-article-mark-lists)
3855 (uncompressed '(score bookmark killed))
3856 marks var articles article mark)
3859 (setq marks (pop marked-lists))
3860 (set (setq var (intern (format "gnus-newsgroup-%s"
3861 (car (rassq (setq mark (car marks))
3863 (if (memq (car marks) uncompressed) (cdr marks)
3864 (gnus-uncompress-range (cdr marks))))
3866 (setq articles (symbol-value var))
3868 ;; All articles have to be subsets of the active articles.
3870 ;; Adjust "simple" lists.
3871 ((memq mark '(tick dormant expirable reply save))
3873 (when (or (< (setq article (pop articles)) min) (> article max))
3874 (set var (delq article (symbol-value var))))))
3876 ((memq mark uncompressed)
3878 (when (or (not (consp (setq article (pop articles))))
3879 (< (car article) min)
3880 (> (car article) max))
3881 (set var (delq article (symbol-value var))))))))))
3883 (defun gnus-update-missing-marks (missing)
3884 "Go through the list of MISSING articles and remove them mark lists."
3886 (let ((types gnus-article-mark-lists)
3888 ;; Go through all types.
3890 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3891 (when (symbol-value var)
3892 ;; This list has articles. So we delete all missing articles
3896 (set var (delq (pop m) (symbol-value var)))))))))
3898 (defun gnus-update-marks ()
3899 "Enter the various lists of marked articles into the newsgroup info list."
3900 (let ((types gnus-article-mark-lists)
3901 (info (gnus-get-info gnus-newsgroup-name))
3902 (uncompressed '(score bookmark killed))
3903 type list newmarked symbol)
3905 ;; Add all marks lists that are non-nil to the list of marks lists.
3907 (setq type (pop types))
3908 (when (setq list (symbol-value
3910 (intern (format "gnus-newsgroup-%s"
3912 (push (cons (cdr type)
3913 (if (memq (cdr type) uncompressed) list
3914 (gnus-compress-sequence
3915 (set symbol (sort list '<)) t)))
3918 ;; Enter these new marks into the info of the group.
3920 (setcar (nthcdr 3 info) newmarked)
3921 ;; Add the marks lists to the end of the info.
3923 (setcdr (nthcdr 2 info) (list newmarked))))
3925 ;; Cut off the end of the info if there's nothing else there.
3929 (when (nthcdr (decf i) info)
3930 (setcdr (nthcdr i info) nil)))))))
3932 (defun gnus-set-mode-line (where)
3933 "This function sets the mode line of the article or summary buffers.
3934 If WHERE is `summary', the summary mode line format will be used."
3935 ;; Is this mode line one we keep updated?
3936 (when (memq where gnus-updated-mode-lines)
3939 ;; We evaluate this in the summary buffer since these
3940 ;; variables are buffer-local to that buffer.
3941 (set-buffer gnus-summary-buffer)
3942 ;; We bind all these variables that are used in the `eval' form
3944 (let* ((mformat (symbol-value
3946 (format "gnus-%s-mode-line-format-spec" where))))
3947 (gnus-tmp-group-name gnus-newsgroup-name)
3948 (gnus-tmp-article-number (or gnus-current-article 0))
3949 (gnus-tmp-unread gnus-newsgroup-unreads)
3950 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3951 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3952 (gnus-tmp-unread-and-unselected
3953 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3954 (zerop gnus-tmp-unselected))
3956 ((zerop gnus-tmp-unselected)
3957 (format "{%d more}" gnus-tmp-unread-and-unticked))
3958 (t (format "{%d(+%d) more}"
3959 gnus-tmp-unread-and-unticked
3960 gnus-tmp-unselected))))
3962 (if (and gnus-current-headers
3963 (vectorp gnus-current-headers))
3964 (gnus-mode-string-quote
3965 (mail-header-subject gnus-current-headers))
3968 gnus-tmp-header);; passed as argument to any user-format-funcs
3969 (setq mode-string (eval mformat))
3970 (setq max-len (max 4 (if gnus-mode-non-string-length
3972 gnus-mode-non-string-length)
3973 (length mode-string))))
3974 ;; We might have to chop a bit of the string off...
3975 (when (> (length mode-string) max-len)
3977 (concat (gnus-truncate-string mode-string (- max-len 3))
3979 ;; Pad the mode string a bit.
3980 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3981 ;; Update the mode line.
3982 (setq mode-line-buffer-identification
3983 (gnus-mode-line-buffer-identification
3984 (list mode-string)))
3985 (set-buffer-modified-p t))))
3987 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3988 "Go through the HEADERS list and add all Xrefs to a hash table.
3989 The resulting hash table is returned, or nil if no Xrefs were found."
3990 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3991 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3992 (xref-hashtb (gnus-make-hashtable))
3993 start group entry number xrefs header)
3995 (setq header (pop headers))
3996 (when (and (setq xrefs (mail-header-xref header))
3997 (not (memq (setq number (mail-header-number header))
4000 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4001 (setq start (match-end 0))
4002 (setq group (if prefix
4003 (concat prefix (substring xrefs (match-beginning 1)
4005 (substring xrefs (match-beginning 1) (match-end 1))))
4007 (string-to-int (substring xrefs (match-beginning 2)
4009 (if (setq entry (gnus-gethash group xref-hashtb))
4010 (setcdr entry (cons number (cdr entry)))
4011 (gnus-sethash group (cons number nil) xref-hashtb)))))
4012 (and start xref-hashtb)))
4014 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4015 "Look through all the headers and mark the Xrefs as read."
4016 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4017 name entry info xref-hashtb idlist method nth4)
4019 (set-buffer gnus-group-buffer)
4020 (when (setq xref-hashtb
4021 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4024 (unless (string= from-newsgroup (setq name (symbol-name group)))
4025 (setq idlist (symbol-value group))
4026 ;; Dead groups are not updated.
4028 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4030 (when (stringp (setq nth4 (gnus-info-method info)))
4031 (setq nth4 (gnus-server-to-method nth4))))
4032 ;; Only do the xrefs if the group has the same
4033 ;; select method as the group we have just read.
4034 (or (gnus-methods-equal-p
4035 nth4 (gnus-find-method-for-group from-newsgroup))
4037 (equal nth4 (setq method (gnus-find-method-for-group
4039 (and (equal (car nth4) (car method))
4040 (equal (nth 1 nth4) (nth 1 method))))
4041 gnus-use-cross-reference
4042 (or (not (eq gnus-use-cross-reference t))
4044 ;; Only do cross-references on subscribed
4045 ;; groups, if that is what is wanted.
4046 (<= (gnus-info-level info) gnus-level-subscribed))
4047 (gnus-group-make-articles-read name idlist))))
4050 (defun gnus-group-make-articles-read (group articles)
4051 "Update the info of GROUP to say that only ARTICLES are unread."
4053 (entry (gnus-gethash group gnus-newsrc-hashtb))
4054 (info (nth 2 entry))
4055 (active (gnus-active group))
4057 ;; First peel off all illegal article numbers.
4059 (let ((ids articles)
4061 (while (setq id (pop ids))
4062 (when (and first (> id (cdr active)))
4063 ;; We'll end up in this situation in one particular
4064 ;; obscure situation. If you re-scan a group and get
4065 ;; a new article that is cross-posted to a different
4066 ;; group that has not been re-scanned, you might get
4067 ;; crossposted article that has a higher number than
4068 ;; Gnus believes possible. So we re-activate this
4069 ;; group as well. This might mean doing the
4070 ;; crossposting thingy will *increase* the number
4071 ;; of articles in some groups. Tsk, tsk.
4072 (setq active (or (gnus-activate-group group) active)))
4073 (when (or (> id (cdr active))
4074 (< id (car active)))
4075 (setq articles (delq id articles))))))
4077 (set-buffer gnus-group-buffer)
4080 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4081 (gnus-info-set-read ',info ',(gnus-info-read info))
4082 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4083 (gnus-group-update-group ,group t))))
4084 ;; If the read list is nil, we init it.
4086 (null (gnus-info-read info))
4088 (gnus-info-set-read info (cons 1 (1- (car active)))))
4089 ;; Then we add the read articles to the range.
4094 (gnus-info-read info) (setq articles (sort articles '<)))))
4095 ;; Then we have to re-compute how many unread
4096 ;; articles there are in this group.
4100 (setq num (- (1+ (cdr active)) (car active))))
4101 ((not (listp (cdr range)))
4102 (setq num (- (cdr active) (- (1+ (cdr range))
4106 (if (numberp (car range))
4108 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4109 (setq range (cdr range)))
4110 (setq num (- (cdr active) num))))
4111 ;; Update the number of unread articles.
4113 ;; Update the group buffer.
4114 (gnus-group-update-group group t))))
4116 (defun gnus-methods-equal-p (m1 m2)
4117 (let ((m1 (or m1 gnus-select-method))
4118 (m2 (or m2 gnus-select-method)))
4120 (and (eq (car m1) (car m2))
4121 (or (not (memq 'address (assoc (symbol-name (car m1))
4122 gnus-valid-select-methods)))
4123 (equal (nth 1 m1) (nth 1 m2)))))))
4125 (defvar gnus-newsgroup-none-id 0)
4127 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4128 (let ((cur nntp-server-buffer)
4131 (save-excursion (set-buffer gnus-summary-buffer)
4132 gnus-newsgroup-dependencies)))
4133 headers id id-dep ref-dep end ref)
4135 (set-buffer nntp-server-buffer)
4136 ;; Translate all TAB characters into SPACE characters.
4137 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4138 (run-hooks 'gnus-parse-headers-hook)
4139 (let ((case-fold-search t)
4140 in-reply-to header p lines)
4141 (goto-char (point-min))
4142 ;; Search to the beginning of the next header. Error messages
4143 ;; do not begin with 2 or 3.
4144 (while (re-search-forward "^[23][0-9]+ " nil t)
4147 ;; This implementation of this function, with nine
4148 ;; search-forwards instead of the one re-search-forward and
4149 ;; a case (which basically was the old function) is actually
4150 ;; about twice as fast, even though it looks messier. You
4151 ;; can't have everything, I guess. Speed and elegance
4152 ;; doesn't always go hand in hand.
4161 (narrow-to-region (point)
4162 (or (and (search-forward "\n.\n" nil t)
4168 (if (search-forward "\nsubject: " nil t)
4169 (nnheader-header-value) "(none)"))
4173 (if (search-forward "\nfrom: " nil t)
4174 (nnheader-header-value) "(nobody)"))
4178 (if (search-forward "\ndate: " nil t)
4179 (nnheader-header-value) ""))
4183 (setq id (if (search-forward "\nmessage-id: " nil t)
4184 (nnheader-header-value)
4185 ;; If there was no message-id, we just fake one
4186 ;; to make subsequent routines simpler.
4187 (nnheader-generate-fake-message-id))))
4191 (if (search-forward "\nreferences: " nil t)
4195 (nnheader-header-value)
4200 (search-backward ">" end t)
4203 (search-backward "<" end t)
4205 ;; Get the references from the in-reply-to header if there
4206 ;; were no references and the in-reply-to header looks
4208 (if (and (search-forward "\nin-reply-to: " nil t)
4209 (setq in-reply-to (nnheader-header-value))
4210 (string-match "<[^>]+>" in-reply-to))
4211 (setq ref (substring in-reply-to (match-beginning 0)
4219 (if (search-forward "\nlines: " nil t)
4220 (if (numberp (setq lines (read cur)))
4226 (and (search-forward "\nxref: " nil t)
4227 (nnheader-header-value)))))
4228 (when (equal id ref)
4230 ;; We do the threading while we read the headers. The
4231 ;; message-id and the last reference are both entered into
4232 ;; the same hash table. Some tippy-toeing around has to be
4233 ;; done in case an article has arrived before the article
4234 ;; which it refers to.
4235 (if (boundp (setq id-dep (intern id dependencies)))
4236 (if (and (car (symbol-value id-dep))
4238 ;; An article with this Message-ID has already
4239 ;; been seen, so we ignore this one, except we add
4240 ;; any additional Xrefs (in case the two articles
4241 ;; came from different servers).
4243 (mail-header-set-xref
4244 (car (symbol-value id-dep))
4245 (concat (or (mail-header-xref
4246 (car (symbol-value id-dep)))
4248 (or (mail-header-xref header) "")))
4250 (setcar (symbol-value id-dep) header))
4251 (set id-dep (list header)))
4253 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4254 (setcdr (symbol-value ref-dep)
4255 (nconc (cdr (symbol-value ref-dep))
4256 (list (symbol-value id-dep))))
4257 (set ref-dep (list nil (symbol-value id-dep))))
4258 (push header headers))
4259 (goto-char (point-max))
4261 (nreverse headers)))))
4263 ;; The following macros and functions were written by Felix Lee
4264 ;; <flee@cse.psu.edu>.
4266 (defmacro gnus-nov-read-integer ()
4268 (if (= (following-char) ?\t)
4270 (let ((num (ignore-errors (read buffer))))
4271 (if (numberp num) num 0)))
4275 (defmacro gnus-nov-skip-field ()
4276 '(search-forward "\t" eol 'move))
4278 (defmacro gnus-nov-field ()
4279 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4281 ;; (defvar gnus-nov-none-counter 0)
4283 ;; This function has to be called with point after the article number
4284 ;; on the beginning of the line.
4285 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4286 (let ((eol (gnus-point-at-eol))
4287 (buffer (current-buffer))
4288 header ref id id-dep ref-dep)
4290 ;; overview: [num subject from date id refs chars lines misc]
4293 (narrow-to-region (point) eol)
4300 (gnus-nov-field) ; subject
4301 (gnus-nov-field) ; from
4302 (gnus-nov-field) ; date
4303 (setq id (or (gnus-nov-field)
4304 (nnheader-generate-fake-message-id))) ; id
4306 (let ((beg (point)))
4307 (search-forward "\t" eol)
4308 (if (search-backward ">" beg t)
4312 (search-backward "<" beg t)))
4315 (gnus-nov-field)) ; refs
4316 (gnus-nov-read-integer) ; chars
4317 (gnus-nov-read-integer) ; lines
4318 (if (= (following-char) ?\n)
4320 (gnus-nov-field)) ; misc
4325 ;; We build the thread tree.
4326 (when (equal id ref)
4327 ;; This article refers back to itself. Naughty, naughty.
4329 (if (boundp (setq id-dep (intern id dependencies)))
4330 (if (and (car (symbol-value id-dep))
4332 ;; An article with this Message-ID has already been seen,
4333 ;; so we ignore this one, except we add any additional
4334 ;; Xrefs (in case the two articles came from different
4337 (mail-header-set-xref
4338 (car (symbol-value id-dep))
4339 (concat (or (mail-header-xref
4340 (car (symbol-value id-dep)))
4342 (or (mail-header-xref header) "")))
4344 (setcar (symbol-value id-dep) header))
4345 (set id-dep (list header)))
4347 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4348 (setcdr (symbol-value ref-dep)
4349 (nconc (cdr (symbol-value ref-dep))
4350 (list (symbol-value id-dep))))
4351 (set ref-dep (list nil (symbol-value id-dep)))))
4354 ;; Goes through the xover lines and returns a list of vectors
4355 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4356 force-new dependencies)
4357 "Parse the news overview data in the server buffer, and return a
4358 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4359 ;; Get the Xref when the users reads the articles since most/some
4360 ;; NNTP servers do not include Xrefs when using XOVER.
4361 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4362 (let ((cur nntp-server-buffer)
4363 (dependencies (or dependencies gnus-newsgroup-dependencies))
4364 number headers header)
4366 (set-buffer nntp-server-buffer)
4367 ;; Allow the user to mangle the headers before parsing them.
4368 (run-hooks 'gnus-parse-headers-hook)
4369 (goto-char (point-min))
4372 (while (and sequence (not (eobp)))
4373 (setq number (read cur))
4374 (while (and sequence
4375 (< (car sequence) number))
4376 (setq sequence (cdr sequence)))
4378 (eq number (car sequence))
4380 (setq sequence (cdr sequence))
4381 (setq header (inline
4382 (gnus-nov-parse-line
4383 number dependencies force-new))))
4384 (push header headers))
4387 (gnus-error 4 "Strange nov line (%d)"
4388 (count-lines (point-min) (point)))))
4390 ;; A common bug in inn is that if you have posted an article and
4391 ;; then retrieves the active file, it will answer correctly --
4392 ;; the new article is included. However, a NOV entry for the
4393 ;; article may not have been generated yet, so this may fail.
4394 ;; We work around this problem by retrieving the last few
4395 ;; headers using HEAD.
4398 (let ((gnus-nov-is-evil t)
4399 (nntp-nov-is-evil t))
4402 (when (gnus-retrieve-headers sequence gnus-newsgroup-name)
4403 (gnus-get-newsgroup-headers))))))))
4405 (defun gnus-article-get-xrefs ()
4406 "Fill in the Xref value in `gnus-current-headers', if necessary.
4407 This is meant to be called in `gnus-article-internal-prepare-hook'."
4408 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4409 gnus-current-headers)))
4410 (or (not gnus-use-cross-reference)
4412 (and (mail-header-xref headers)
4413 (not (string= (mail-header-xref headers) "")))
4414 (let ((case-fold-search t)
4417 (nnheader-narrow-to-headers)
4418 (goto-char (point-min))
4419 (when (or (and (eq (downcase (following-char)) ?x)
4420 (looking-at "Xref:"))
4421 (search-forward "\nXref:" nil t))
4422 (goto-char (1+ (match-end 0)))
4423 (setq xref (buffer-substring (point)
4424 (progn (end-of-line) (point))))
4425 (mail-header-set-xref headers xref)))))))
4427 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4428 "Find article ID and insert the summary line for that article."
4429 (let ((header (if (and old-header use-old-header)
4430 old-header (gnus-read-header id)))
4431 (number (and (numberp id) id))
4434 ;; Rebuild the thread that this article is part of and go to the
4435 ;; article we have fetched.
4436 (when (and (not gnus-show-threads)
4438 (when (setq d (gnus-data-find (mail-header-number old-header)))
4439 (goto-char (gnus-data-pos d))
4442 (- (gnus-point-at-bol)
4444 (1+ (gnus-point-at-eol))
4445 (gnus-delete-line))))))
4447 (mail-header-set-number header (mail-header-number old-header)))
4448 (setq gnus-newsgroup-sparse
4449 (delq (setq number (mail-header-number header))
4450 gnus-newsgroup-sparse))
4451 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4452 (gnus-rebuild-thread (mail-header-id header))
4453 (gnus-summary-goto-subject number nil t))
4454 (when (and (numberp number)
4456 ;; We have to update the boundaries even if we can't fetch the
4457 ;; article if ID is a number -- so that the next `P' or `N'
4458 ;; command will fetch the previous (or next) article even
4459 ;; if the one we tried to fetch this time has been canceled.
4460 (when (> number gnus-newsgroup-end)
4461 (setq gnus-newsgroup-end number))
4462 (when (< number gnus-newsgroup-begin)
4463 (setq gnus-newsgroup-begin number))
4464 (setq gnus-newsgroup-unselected
4465 (delq number gnus-newsgroup-unselected)))
4466 ;; Report back a success?
4467 (and header (mail-header-number header))))
4469 ;;; Process/prefix in the summary buffer
4471 (defun gnus-summary-work-articles (n)
4472 "Return a list of articles to be worked upon. The prefix argument,
4473 the list of process marked articles, and the current article will be
4474 taken into consideration."
4477 ;; A numerical prefix has been given.
4478 (let ((backward (< n 0))
4479 (n (abs (prefix-numeric-value n)))
4484 (push (setq article (gnus-summary-article-number))
4487 (gnus-summary-find-prev nil article)
4488 (gnus-summary-find-next nil article)))
4490 (nreverse articles)))
4491 ((and (boundp 'transient-mark-mode)
4494 ;; Work on the region between point and mark.
4495 (let ((max (max (point) (mark)))
4498 (goto-char (min (point) (mark)))
4501 (push (setq article (gnus-summary-article-number)) articles)
4502 (gnus-summary-find-next nil article)
4504 (nreverse articles))))
4505 (gnus-newsgroup-processable
4506 ;; There are process-marked articles present.
4507 ;; Save current state.
4508 (gnus-summary-save-process-mark)
4510 (reverse gnus-newsgroup-processable))
4512 ;; Just return the current article.
4513 (list (gnus-summary-article-number)))))
4515 (defun gnus-summary-save-process-mark ()
4516 "Push the current set of process marked articles on the stack."
4518 (push (copy-sequence gnus-newsgroup-processable)
4519 gnus-newsgroup-process-stack))
4521 (defun gnus-summary-kill-process-mark ()
4522 "Push the current set of process marked articles on the stack and unmark."
4524 (gnus-summary-save-process-mark)
4525 (gnus-summary-unmark-all-processable))
4527 (defun gnus-summary-yank-process-mark ()
4528 "Pop the last process mark state off the stack and restore it."
4530 (unless gnus-newsgroup-process-stack
4531 (error "Empty mark stack"))
4532 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4534 (defun gnus-summary-process-mark-set (set)
4535 "Make SET into the current process marked articles."
4536 (gnus-summary-unmark-all-processable)
4538 (gnus-summary-set-process-mark (pop set))))
4540 ;;; Searching and stuff
4542 (defun gnus-summary-search-group (&optional backward use-level)
4543 "Search for next unread newsgroup.
4544 If optional argument BACKWARD is non-nil, search backward instead."
4546 (set-buffer gnus-group-buffer)
4547 (when (gnus-group-search-forward
4548 backward nil (if use-level (gnus-group-group-level) nil))
4549 (gnus-group-group-name))))
4551 (defun gnus-summary-best-group (&optional exclude-group)
4552 "Find the name of the best unread group.
4553 If EXCLUDE-GROUP, do not go to this group."
4555 (set-buffer gnus-group-buffer)
4557 (gnus-group-best-unread-group exclude-group))))
4559 (defun gnus-summary-find-next (&optional unread article backward)
4560 (if backward (gnus-summary-find-prev)
4561 (let* ((dummy (gnus-summary-article-intangible-p))
4562 (article (or article (gnus-summary-article-number)))
4563 (arts (gnus-data-find-list article))
4565 (when (and (not dummy)
4566 (or (not gnus-summary-check-current)
4568 (not (gnus-data-unread-p (car arts)))))
4569 (setq arts (cdr arts)))
4574 (when (gnus-data-unread-p (car arts))
4575 (setq result (car arts)
4577 (setq arts (cdr arts)))
4580 (goto-char (gnus-data-pos result))
4581 (gnus-data-number result)))))
4583 (defun gnus-summary-find-prev (&optional unread article)
4584 (let* ((eobp (eobp))
4585 (article (or article (gnus-summary-article-number)))
4586 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4588 (when (and (not eobp)
4589 (or (not gnus-summary-check-current)
4591 (not (gnus-data-unread-p (car arts)))))
4592 (setq arts (cdr arts)))
4597 (when (gnus-data-unread-p (car arts))
4598 (setq result (car arts)
4600 (setq arts (cdr arts)))
4603 (goto-char (gnus-data-pos result))
4604 (gnus-data-number result))))
4606 (defun gnus-summary-find-subject (subject &optional unread backward article)
4607 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4608 (article (or article (gnus-summary-article-number)))
4609 (articles (gnus-data-list backward))
4610 (arts (gnus-data-find-list article articles))
4612 (when (or (not gnus-summary-check-current)
4614 (not (gnus-data-unread-p (car arts))))
4615 (setq arts (cdr arts)))
4617 (and (or (not unread)
4618 (gnus-data-unread-p (car arts)))
4619 (vectorp (gnus-data-header (car arts)))
4621 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4622 (setq result (car arts)
4624 (setq arts (cdr arts)))
4626 (goto-char (gnus-data-pos result))
4627 (gnus-data-number result))))
4629 (defun gnus-summary-search-forward (&optional unread subject backward)
4630 "Search forward for an article.
4631 If UNREAD, look for unread articles. If SUBJECT, look for
4632 articles with that subject. If BACKWARD, search backward instead."
4633 (cond (subject (gnus-summary-find-subject subject unread backward))
4634 (backward (gnus-summary-find-prev unread))
4635 (t (gnus-summary-find-next unread))))
4637 (defun gnus-recenter (&optional n)
4638 "Center point in window and redisplay frame.
4639 Also do horizontal recentering."
4641 (when (and gnus-auto-center-summary
4642 (not (eq gnus-auto-center-summary 'vertical)))
4643 (gnus-horizontal-recenter))
4646 (defun gnus-summary-recenter ()
4647 "Center point in the summary window.
4648 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4649 displayed, no centering will be performed."
4650 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4651 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4652 (let* ((top (cond ((< (window-height) 4) 0)
4653 ((< (window-height) 7) 1)
4655 (height (1- (window-height)))
4656 (bottom (save-excursion (goto-char (point-max))
4657 (forward-line (- height))
4659 (window (get-buffer-window (current-buffer))))
4660 ;; The user has to want it.
4661 (when gnus-auto-center-summary
4662 (when (get-buffer-window gnus-article-buffer)
4663 ;; Only do recentering when the article buffer is displayed,
4664 ;; Set the window start to either `bottom', which is the biggest
4665 ;; possible valid number, or the second line from the top,
4666 ;; whichever is the least.
4668 window (min bottom (save-excursion
4669 (forward-line (- top)) (point)))))
4670 ;; Do horizontal recentering while we're at it.
4671 (when (and (get-buffer-window (current-buffer) t)
4672 (not (eq gnus-auto-center-summary 'vertical)))
4673 (let ((selected (selected-window)))
4674 (select-window (get-buffer-window (current-buffer) t))
4675 (gnus-summary-position-point)
4676 (gnus-horizontal-recenter)
4677 (select-window selected))))))
4679 (defun gnus-summary-jump-to-group (newsgroup)
4680 "Move point to NEWSGROUP in group mode buffer."
4681 ;; Keep update point of group mode buffer if visible.
4682 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4683 (save-window-excursion
4684 ;; Take care of tree window mode.
4685 (when (get-buffer-window gnus-group-buffer)
4686 (pop-to-buffer gnus-group-buffer))
4687 (gnus-group-jump-to-group newsgroup))
4689 ;; Take care of tree window mode.
4690 (if (get-buffer-window gnus-group-buffer)
4691 (pop-to-buffer gnus-group-buffer)
4692 (set-buffer gnus-group-buffer))
4693 (gnus-group-jump-to-group newsgroup))))
4695 ;; This function returns a list of article numbers based on the
4696 ;; difference between the ranges of read articles in this group and
4697 ;; the range of active articles.
4698 (defun gnus-list-of-unread-articles (group)
4699 (let* ((read (gnus-info-read (gnus-get-info group)))
4700 (active (or (gnus-active group) (gnus-activate-group group)))
4703 ;; If none are read, then all are unread.
4705 (setq first (car active))
4706 ;; If the range of read articles is a single range, then the
4707 ;; first unread article is the article after the last read
4708 ;; article. Sounds logical, doesn't it?
4709 (if (not (listp (cdr read)))
4710 (setq first (1+ (cdr read)))
4711 ;; `read' is a list of ranges.
4712 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4718 (while (< first nlast)
4720 (setq first (1+ first))))
4721 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4722 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4723 (setq read (cdr read)))))
4724 ;; And add the last unread articles.
4725 (while (<= first last)
4727 (setq first (1+ first)))
4728 ;; Return the list of unread articles.
4731 (defun gnus-list-of-read-articles (group)
4732 "Return a list of unread, unticked and non-dormant articles."
4733 (let* ((info (gnus-get-info group))
4734 (marked (gnus-info-marks info))
4735 (active (gnus-active group)))
4737 (gnus-set-difference
4738 (gnus-sorted-complement
4739 (gnus-uncompress-range active)
4740 (gnus-list-of-unread-articles group))
4742 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4743 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4745 ;; Various summary commands
4747 (defun gnus-summary-universal-argument (arg)
4748 "Perform any operation on all articles that are process/prefixed."
4750 (gnus-set-global-variables)
4751 (let ((articles (gnus-summary-work-articles arg))
4758 (substitute-command-keys
4759 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4762 (gnus-error 1 "Undefined key")
4765 (gnus-summary-goto-subject (setq article (pop articles)))
4766 (let (gnus-newsgroup-processable)
4767 (command-execute func))
4768 (gnus-summary-remove-process-mark article)))))
4769 (gnus-summary-position-point))
4771 (defun gnus-summary-toggle-truncation (&optional arg)
4772 "Toggle truncation of summary lines.
4773 With arg, turn line truncation on iff arg is positive."
4775 (setq truncate-lines
4776 (if (null arg) (not truncate-lines)
4777 (> (prefix-numeric-value arg) 0)))
4780 (defun gnus-summary-reselect-current-group (&optional all rescan)
4781 "Exit and then reselect the current newsgroup.
4782 The prefix argument ALL means to select all articles."
4784 (gnus-set-global-variables)
4785 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4786 (error "Ephemeral groups can't be reselected"))
4787 (let ((current-subject (gnus-summary-article-number))
4788 (group gnus-newsgroup-name))
4789 (setq gnus-newsgroup-begin nil)
4791 ;; We have to adjust the point of group mode buffer because the
4792 ;; current point was moved to the next unread newsgroup by
4794 (gnus-summary-jump-to-group group)
4797 (gnus-group-get-new-news-this-group 1)))
4798 (gnus-group-read-group all t)
4799 (gnus-summary-goto-subject current-subject nil t)))
4801 (defun gnus-summary-rescan-group (&optional all)
4802 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4804 (gnus-summary-reselect-current-group all t))
4806 (defun gnus-summary-update-info (&optional non-destructive)
4808 (let ((group gnus-newsgroup-name))
4809 (when gnus-newsgroup-kill-headers
4810 (setq gnus-newsgroup-killed
4811 (gnus-compress-sequence
4813 (gnus-set-sorted-intersection
4814 (gnus-uncompress-range gnus-newsgroup-killed)
4815 (setq gnus-newsgroup-unselected
4816 (sort gnus-newsgroup-unselected '<)))
4817 (setq gnus-newsgroup-unreads
4818 (sort gnus-newsgroup-unreads '<)))
4820 (unless (listp (cdr gnus-newsgroup-killed))
4821 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4822 (let ((headers gnus-newsgroup-headers))
4823 (when (and (not gnus-save-score)
4824 (not non-destructive))
4825 (setq gnus-newsgroup-scored nil))
4826 ;; Set the new ranges of read articles.
4827 (gnus-update-read-articles
4828 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4829 ;; Set the current article marks.
4831 ;; Do the cross-ref thing.
4832 (when gnus-use-cross-reference
4833 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4834 ;; Do adaptive scoring, and possibly save score files.
4835 (when gnus-newsgroup-adaptive
4836 (gnus-score-adaptive))
4837 (when gnus-use-scoring
4839 ;; Do not switch windows but change the buffer to work.
4840 (set-buffer gnus-group-buffer)
4841 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4842 (gnus-group-update-group group))))))
4844 (defun gnus-summary-save-newsrc (&optional force)
4845 "Save the current number of read/marked articles in the dribble buffer.
4846 If FORCE (the prefix), also save the .newsrc file(s)."
4848 (gnus-summary-update-info t)
4850 (gnus-save-newsrc-file)))
4852 (defun gnus-summary-exit (&optional temporary)
4853 "Exit reading current newsgroup, and then return to group selection mode.
4854 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4856 (gnus-set-global-variables)
4857 (gnus-kill-save-kill-buffer)
4858 (let* ((group gnus-newsgroup-name)
4859 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4861 (buf (current-buffer)))
4862 (run-hooks 'gnus-summary-prepare-exit-hook)
4863 ;; If we have several article buffers, we kill them at exit.
4864 (unless gnus-single-article-buffer
4865 (gnus-kill-buffer gnus-original-article-buffer)
4866 (setq gnus-article-current nil))
4867 (when gnus-use-cache
4868 (gnus-cache-possibly-remove-articles)
4869 (gnus-cache-save-buffers))
4870 (gnus-async-prefetch-remove-group group)
4871 (when gnus-suppress-duplicates
4872 (gnus-dup-enter-articles))
4873 (when gnus-use-trees
4874 (gnus-tree-close group))
4875 ;; Make all changes in this group permanent.
4877 (run-hooks 'gnus-exit-group-hook)
4878 (gnus-summary-update-info))
4879 (gnus-close-group group)
4880 ;; Make sure where I was, and go to next newsgroup.
4881 (set-buffer gnus-group-buffer)
4883 (gnus-group-jump-to-group group))
4884 (run-hooks 'gnus-summary-exit-hook)
4886 (gnus-group-next-unread-group 1))
4889 ;; If we have several article buffers, we kill them at exit.
4890 (unless gnus-single-article-buffer
4891 (gnus-kill-buffer gnus-article-buffer)
4892 (gnus-kill-buffer gnus-original-article-buffer)
4893 (setq gnus-article-current nil))
4895 (if (not gnus-kill-summary-on-exit)
4896 (gnus-deaden-summary)
4897 ;; We set all buffer-local variables to nil. It is unclear why
4898 ;; this is needed, but if we don't, buffer-local variables are
4899 ;; not garbage-collected, it seems. This would the lead to en
4900 ;; ever-growing Emacs.
4901 (gnus-summary-clear-local-variables)
4902 (when (get-buffer gnus-article-buffer)
4903 (bury-buffer gnus-article-buffer))
4904 ;; We clear the global counterparts of the buffer-local
4905 ;; variables as well, just to be on the safe side.
4906 (set-buffer gnus-group-buffer)
4907 (gnus-summary-clear-local-variables)
4908 ;; Return to group mode buffer.
4909 (when (eq mode 'gnus-summary-mode)
4910 (gnus-kill-buffer buf)))
4911 (setq gnus-current-select-method gnus-select-method)
4912 (pop-to-buffer gnus-group-buffer)
4913 ;; Clear the current group name.
4914 (if (not quit-config)
4916 (gnus-group-jump-to-group group)
4917 (gnus-group-next-unread-group 1)
4918 (gnus-configure-windows 'group 'force))
4919 (gnus-handle-ephemeral-exit quit-config))
4921 (setq gnus-newsgroup-name nil)))))
4923 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4924 (defun gnus-summary-exit-no-update (&optional no-questions)
4925 "Quit reading current newsgroup without updating read article info."
4927 (gnus-set-global-variables)
4928 (let* ((group gnus-newsgroup-name)
4929 (quit-config (gnus-group-quit-config group)))
4930 (when (or no-questions
4932 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4933 ;; If we have several article buffers, we kill them at exit.
4934 (unless gnus-single-article-buffer
4935 (gnus-kill-buffer gnus-article-buffer)
4936 (gnus-kill-buffer gnus-original-article-buffer)
4937 (setq gnus-article-current nil))
4938 (if (not gnus-kill-summary-on-exit)
4939 (gnus-deaden-summary)
4940 (gnus-close-group group)
4941 (gnus-summary-clear-local-variables)
4942 (set-buffer gnus-group-buffer)
4943 (gnus-summary-clear-local-variables)
4944 (when (get-buffer gnus-summary-buffer)
4945 (kill-buffer gnus-summary-buffer)))
4946 (unless gnus-single-article-buffer
4947 (setq gnus-article-current nil))
4948 (when gnus-use-trees
4949 (gnus-tree-close group))
4950 (gnus-async-prefetch-remove-group group)
4951 (when (get-buffer gnus-article-buffer)
4952 (bury-buffer gnus-article-buffer))
4953 ;; Return to the group buffer.
4954 (gnus-configure-windows 'group 'force)
4955 ;; Clear the current group name.
4956 (setq gnus-newsgroup-name nil)
4957 (when (equal (gnus-group-group-name) group)
4958 (gnus-group-next-unread-group 1))
4960 (gnus-handle-ephemeral-exit quit-config)))))
4962 (defun gnus-handle-ephemeral-exit (quit-config)
4963 "Handle movement when leaving an ephemeral group. The state
4964 which existed when entering the ephemeral is reset."
4965 (if (not (buffer-name (car quit-config)))
4966 (gnus-configure-windows 'group 'force)
4967 (set-buffer (car quit-config))
4968 (cond ((eq major-mode 'gnus-summary-mode)
4969 (gnus-set-global-variables))
4970 ((eq major-mode 'gnus-article-mode)
4972 ;; The `gnus-summary-buffer' variable may point
4973 ;; to the old summary buffer when using a single
4975 (unless (gnus-buffer-live-p gnus-summary-buffer)
4976 (set-buffer gnus-group-buffer))
4977 (set-buffer gnus-summary-buffer)
4978 (gnus-set-global-variables))))
4979 (if (or (eq (cdr quit-config) 'article)
4980 (eq (cdr quit-config) 'pick))
4982 ;; The current article may be from the ephemeral group
4983 ;; thus it is best that we reload this article
4984 (gnus-summary-show-article)
4985 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4986 (gnus-configure-windows 'pick 'force)
4987 (gnus-configure-windows (cdr quit-config) 'force)))
4988 (gnus-configure-windows (cdr quit-config) 'force))
4989 (when (eq major-mode 'gnus-summary-mode)
4990 (gnus-summary-next-subject 1 nil t)
4991 (gnus-summary-recenter)
4992 (gnus-summary-position-point))))
4996 (defvar gnus-dead-summary-mode-map nil)
4998 (unless gnus-dead-summary-mode-map
4999 (setq gnus-dead-summary-mode-map (make-keymap))
5000 (suppress-keymap gnus-dead-summary-mode-map)
5001 (substitute-key-definition
5002 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5003 (let ((keys '("\C-d" "\r" "\177")))
5005 (define-key gnus-dead-summary-mode-map
5006 (pop keys) 'gnus-summary-wake-up-the-dead))))
5008 (defvar gnus-dead-summary-mode nil
5009 "Minor mode for Gnus summary buffers.")
5011 (defun gnus-dead-summary-mode (&optional arg)
5012 "Minor mode for Gnus summary buffers."
5014 (when (eq major-mode 'gnus-summary-mode)
5015 (make-local-variable 'gnus-dead-summary-mode)
5016 (setq gnus-dead-summary-mode
5017 (if (null arg) (not gnus-dead-summary-mode)
5018 (> (prefix-numeric-value arg) 0)))
5019 (when gnus-dead-summary-mode
5020 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
5021 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
5022 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
5023 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
5024 minor-mode-map-alist)))))
5026 (defun gnus-deaden-summary ()
5027 "Make the current summary buffer into a dead summary buffer."
5028 ;; Kill any previous dead summary buffer.
5029 (when (and gnus-dead-summary
5030 (buffer-name gnus-dead-summary))
5032 (set-buffer gnus-dead-summary)
5033 (when gnus-dead-summary-mode
5034 (kill-buffer (current-buffer)))))
5035 ;; Make this the current dead summary.
5036 (setq gnus-dead-summary (current-buffer))
5037 (gnus-dead-summary-mode 1)
5038 (let ((name (buffer-name)))
5039 (when (string-match "Summary" name)
5041 (concat (substring name 0 (match-beginning 0)) "Dead "
5042 (substring name (match-beginning 0)))
5045 (defun gnus-kill-or-deaden-summary (buffer)
5046 "Kill or deaden the summary BUFFER."
5047 (when (and (buffer-name buffer)
5048 (not gnus-single-article-buffer))
5051 (gnus-kill-buffer gnus-article-buffer)
5052 (gnus-kill-buffer gnus-original-article-buffer)))
5053 (cond (gnus-kill-summary-on-exit
5054 (when (and gnus-use-trees
5055 (and (get-buffer buffer)
5056 (buffer-name (get-buffer buffer))))
5058 (set-buffer (get-buffer buffer))
5059 (gnus-tree-close gnus-newsgroup-name)))
5060 (gnus-kill-buffer buffer))
5061 ((and (get-buffer buffer)
5062 (buffer-name (get-buffer buffer)))
5065 (gnus-deaden-summary)))))
5067 (defun gnus-summary-wake-up-the-dead (&rest args)
5068 "Wake up the dead summary buffer."
5070 (gnus-dead-summary-mode -1)
5071 (let ((name (buffer-name)))
5072 (when (string-match "Dead " name)
5074 (concat (substring name 0 (match-beginning 0))
5075 (substring name (match-end 0)))
5077 (gnus-message 3 "This dead summary is now alive again"))
5079 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5080 (defun gnus-summary-fetch-faq (&optional faq-dir)
5081 "Fetch the FAQ for the current group.
5082 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5086 (when current-prefix-arg
5088 "Faq dir: " (and (listp gnus-group-faq-directory)
5089 gnus-group-faq-directory)))))
5090 (let (gnus-faq-buffer)
5091 (when (setq gnus-faq-buffer
5092 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5093 (gnus-configure-windows 'summary-faq))))
5095 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5096 (defun gnus-summary-describe-group (&optional force)
5097 "Describe the current newsgroup."
5099 (gnus-group-describe-group force gnus-newsgroup-name))
5101 (defun gnus-summary-describe-briefly ()
5102 "Describe summary mode commands briefly."
5105 (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")))
5107 ;; Walking around group mode buffer from summary mode.
5109 (defun gnus-summary-next-group (&optional no-article target-group backward)
5110 "Exit current newsgroup and then select next unread newsgroup.
5111 If prefix argument NO-ARTICLE is non-nil, no article is selected
5112 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5113 previous group instead."
5115 (gnus-set-global-variables)
5116 ;; Stop pre-fetching.
5117 (gnus-async-halt-prefetch)
5118 (let ((current-group gnus-newsgroup-name)
5119 (current-buffer (current-buffer))
5121 ;; First we semi-exit this group to update Xrefs and all variables.
5122 ;; We can't do a real exit, because the window conf must remain
5123 ;; the same in case the user is prompted for info, and we don't
5124 ;; want the window conf to change before that...
5125 (gnus-summary-exit t)
5126 (while (not entered)
5127 ;; Then we find what group we are supposed to enter.
5128 (set-buffer gnus-group-buffer)
5129 (gnus-group-jump-to-group current-group)
5132 (if (eq gnus-keep-same-level 'best)
5133 (gnus-summary-best-group gnus-newsgroup-name)
5134 (gnus-summary-search-group backward gnus-keep-same-level))))
5135 (if (not target-group)
5136 ;; There are no further groups, so we return to the group
5139 (gnus-message 5 "Returning to the group buffer")
5141 (set-buffer current-buffer)
5143 (run-hooks 'gnus-group-no-more-groups-hook))
5144 ;; We try to enter the target group.
5145 (gnus-group-jump-to-group target-group)
5146 (let ((unreads (gnus-group-group-unread)))
5147 (if (and (or (eq t unreads)
5148 (and unreads (not (zerop unreads))))
5149 (gnus-summary-read-group
5150 target-group nil no-article current-buffer))
5152 (setq current-group target-group
5153 target-group nil)))))))
5155 (defun gnus-summary-prev-group (&optional no-article)
5156 "Exit current newsgroup and then select previous unread newsgroup.
5157 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5159 (gnus-summary-next-group no-article nil t))
5161 ;; Walking around summary lines.
5163 (defun gnus-summary-first-subject (&optional unread)
5164 "Go to the first unread subject.
5165 If UNREAD is non-nil, go to the first unread article.
5166 Returns the article selected or nil if there are no unread articles."
5171 ((null gnus-newsgroup-data)
5172 (gnus-message 3 "No articles in the group")
5174 ;; Pick the first article.
5176 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5177 (gnus-data-number (car gnus-newsgroup-data)))
5178 ;; No unread articles.
5179 ((null gnus-newsgroup-unreads)
5180 (gnus-message 3 "No more unread articles")
5182 ;; Find the first unread article.
5184 (let ((data gnus-newsgroup-data))
5186 (not (gnus-data-unread-p (car data))))
5187 (setq data (cdr data)))
5189 (goto-char (gnus-data-pos (car data)))
5190 (gnus-data-number (car data))))))
5191 (gnus-summary-position-point)))
5193 (defun gnus-summary-next-subject (n &optional unread dont-display)
5194 "Go to next N'th summary line.
5195 If N is negative, go to the previous N'th subject line.
5196 If UNREAD is non-nil, only unread articles are selected.
5197 The difference between N and the actual number of steps taken is
5200 (let ((backward (< n 0))
5204 (gnus-summary-find-prev unread)
5205 (gnus-summary-find-next unread)))
5208 (gnus-message 7 "No more%s articles"
5209 (if unread " unread" "")))
5210 (unless dont-display
5211 (gnus-summary-recenter)
5212 (gnus-summary-position-point))
5215 (defun gnus-summary-next-unread-subject (n)
5216 "Go to next N'th unread summary line."
5218 (gnus-summary-next-subject n t))
5220 (defun gnus-summary-prev-subject (n &optional unread)
5221 "Go to previous N'th summary line.
5222 If optional argument UNREAD is non-nil, only unread article is selected."
5224 (gnus-summary-next-subject (- n) unread))
5226 (defun gnus-summary-prev-unread-subject (n)
5227 "Go to previous N'th unread summary line."
5229 (gnus-summary-next-subject (- n) t))
5231 (defun gnus-summary-goto-subject (article &optional force silent)
5232 "Go the subject line of ARTICLE.
5233 If FORCE, also allow jumping to articles not currently shown."
5234 (interactive "nArticle number: ")
5236 (data (gnus-data-find article)))
5237 ;; We read in the article if we have to.
5240 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5241 (setq data (gnus-data-find article)))
5246 (gnus-message 3 "Can't find article %d" article))
5248 (goto-char (gnus-data-pos data))
5251 ;; Walking around summary lines with displaying articles.
5253 (defun gnus-summary-expand-window (&optional arg)
5254 "Make the summary buffer take up the entire Emacs frame.
5255 Given a prefix, will force an `article' buffer configuration."
5257 (gnus-set-global-variables)
5259 (gnus-configure-windows 'article 'force)
5260 (gnus-configure-windows 'summary 'force)))
5262 (defun gnus-summary-display-article (article &optional all-header)
5263 "Display ARTICLE in article buffer."
5264 (gnus-set-global-variables)
5268 (if gnus-summary-display-article-function
5269 (funcall gnus-summary-display-article-function article all-header)
5270 (gnus-article-prepare article all-header))
5271 (run-hooks 'gnus-select-article-hook)
5272 (when (and gnus-current-article
5273 (not (zerop gnus-current-article)))
5274 (gnus-summary-goto-subject gnus-current-article))
5275 (gnus-summary-recenter)
5276 (when (and gnus-use-trees gnus-show-threads)
5277 (gnus-possibly-generate-tree article)
5278 (gnus-highlight-selected-tree article))
5279 ;; Successfully display article.
5280 (gnus-article-set-window-start
5281 (cdr (assq article gnus-newsgroup-bookmarks))))))
5283 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5284 "Select the current article.
5285 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5286 non-nil, the article will be re-fetched even if it already present in
5287 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5289 ;; Make sure we are in the summary buffer to work around bbdb bug.
5290 (unless (eq major-mode 'gnus-summary-mode)
5291 (set-buffer gnus-summary-buffer))
5292 (let ((article (or article (gnus-summary-article-number)))
5293 (all-headers (not (not all-headers))) ;Must be T or NIL.
5294 gnus-summary-display-article-function
5297 (gnus-summary-article-pseudo-p article)
5298 (error "This is a pseudo-article."))
5301 (set-buffer gnus-summary-buffer)
5302 (if (or (and gnus-single-article-buffer
5303 (or (null gnus-current-article)
5304 (null gnus-article-current)
5305 (null (get-buffer gnus-article-buffer))
5306 (not (eq article (cdr gnus-article-current)))
5307 (not (equal (car gnus-article-current)
5308 gnus-newsgroup-name))))
5309 (and (not gnus-single-article-buffer)
5310 (or (null gnus-current-article)
5311 (not (eq gnus-current-article article))))
5313 ;; The requested article is different from the current article.
5315 (gnus-summary-display-article article all-headers)
5317 (when (or all-headers gnus-show-all-headers)
5318 (gnus-article-show-all-headers))
5321 (gnus-article-set-window-start
5322 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5324 (defun gnus-summary-set-current-mark (&optional current-mark)
5325 "Obsolete function."
5328 (defun gnus-summary-next-article (&optional unread subject backward push)
5329 "Select the next article.
5330 If UNREAD, only unread articles are selected.
5331 If SUBJECT, only articles with SUBJECT are selected.
5332 If BACKWARD, the previous article is selected instead of the next."
5334 (gnus-set-global-variables)
5336 ;; Is there such an article?
5337 ((and (gnus-summary-search-forward unread subject backward)
5338 (or (gnus-summary-display-article (gnus-summary-article-number))
5339 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5340 (gnus-summary-position-point))
5341 ;; If not, we try the first unread, if that is wanted.
5343 gnus-auto-select-same
5344 ;; Make sure that we don't select the current article.
5345 (not (eq (gnus-summary-article-number)
5347 (gnus-summary-first-subject t)
5348 (gnus-summary-article-number))))
5349 (gnus-summary-first-unread-article))
5350 (gnus-summary-position-point)
5351 (gnus-message 6 "Wrapped"))
5352 ;; Try to get next/previous article not displayed in this group.
5353 ((and gnus-auto-extend-newsgroup
5354 (not unread) (not subject))
5355 (gnus-summary-goto-article
5356 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5358 ;; Go to next/previous group.
5360 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5361 (gnus-summary-jump-to-group gnus-newsgroup-name))
5362 (let ((cmd last-command-char)
5364 (if (eq gnus-keep-same-level 'best)
5365 (gnus-summary-best-group gnus-newsgroup-name)
5366 (gnus-summary-search-group backward gnus-keep-same-level))))
5367 ;; For some reason, the group window gets selected. We change
5369 (select-window (get-buffer-window (current-buffer)))
5370 ;; Select next unread newsgroup automagically.
5372 ((or (not gnus-auto-select-next)
5374 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5375 ((or (eq gnus-auto-select-next 'quietly)
5376 (and (eq gnus-auto-select-next 'slightly-quietly)
5378 (and (eq gnus-auto-select-next 'almost-quietly)
5379 (gnus-summary-last-article-p)))
5381 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5383 (gnus-message 7 "No more%s articles (%s)..."
5384 (if unread " unread" "")
5385 (if group (concat "selecting " group)
5387 (gnus-summary-next-group nil group backward)))
5389 (when (gnus-key-press-event-p last-input-event)
5390 (gnus-summary-walk-group-buffer
5391 gnus-newsgroup-name cmd unread backward))))))))
5393 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward)
5394 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5395 (?\C-p (gnus-group-prev-unread-group 1))))
5396 (cursor-in-echo-area t)
5397 keve key group ended)
5399 (set-buffer gnus-group-buffer)
5400 (gnus-summary-jump-to-group from-group)
5402 (if (eq gnus-keep-same-level 'best)
5403 (gnus-summary-best-group gnus-newsgroup-name)
5404 (gnus-summary-search-group backward gnus-keep-same-level))))
5407 5 "No more%s articles%s" (if unread " unread" "")
5409 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5410 (format " (Type %s for %s [%s])"
5411 (single-key-description cmd) group
5412 (car (gnus-gethash group gnus-newsrc-hashtb)))
5413 (format " (Type %s to exit %s)"
5414 (single-key-description cmd)
5415 gnus-newsgroup-name)))
5416 ;; Confirm auto selection.
5417 (setq key (car (setq keve (gnus-read-event-char))))
5420 ((assq key keystrokes)
5421 (let ((obuf (current-buffer)))
5422 (switch-to-buffer gnus-group-buffer)
5424 (gnus-group-jump-to-group group))
5425 (eval (cadr (assq key keystrokes)))
5426 (setq group (gnus-group-group-name))
5427 (switch-to-buffer obuf))
5431 (gnus-ephemeral-group-p gnus-newsgroup-name))
5433 (gnus-summary-next-group nil group backward)))
5435 (push (cdr keve) unread-command-events))))))
5437 (defun gnus-summary-next-unread-article ()
5438 "Select unread article after current one."
5440 (gnus-summary-next-article
5441 (or (not (eq gnus-summary-goto-unread 'never))
5442 (gnus-summary-last-article-p (gnus-summary-article-number)))
5443 (and gnus-auto-select-same
5444 (gnus-summary-article-subject))))
5446 (defun gnus-summary-prev-article (&optional unread subject)
5447 "Select the article after the current one.
5448 If UNREAD is non-nil, only unread articles are selected."
5450 (gnus-summary-next-article unread subject t))
5452 (defun gnus-summary-prev-unread-article ()
5453 "Select unread article before current one."
5455 (gnus-summary-prev-article
5456 (or (not (eq gnus-summary-goto-unread 'never))
5457 (gnus-summary-first-article-p (gnus-summary-article-number)))
5458 (and gnus-auto-select-same
5459 (gnus-summary-article-subject))))
5461 (defun gnus-summary-next-page (&optional lines circular)
5462 "Show next page of the selected article.
5463 If at the end of the current article, select the next article.
5464 LINES says how many lines should be scrolled up.
5466 If CIRCULAR is non-nil, go to the start of the article instead of
5467 selecting the next article when reaching the end of the current
5470 (setq gnus-summary-buffer (current-buffer))
5471 (gnus-set-global-variables)
5472 (let ((article (gnus-summary-article-number))
5474 (gnus-configure-windows 'article)
5475 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5476 (if (and (eq gnus-summary-goto-unread 'never)
5477 (not (gnus-summary-last-article-p article)))
5478 (gnus-summary-next-article)
5479 (gnus-summary-next-unread-article))
5480 (if (or (null gnus-current-article)
5481 (null gnus-article-current)
5482 (/= article (cdr gnus-article-current))
5483 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5484 ;; Selected subject is different from current article's.
5485 (gnus-summary-display-article article)
5486 (gnus-eval-in-buffer-window gnus-article-buffer
5487 (setq endp (gnus-article-next-page lines)))
5490 (gnus-summary-beginning-of-article))
5492 (gnus-message 3 "End of message"))
5494 (if (and (eq gnus-summary-goto-unread 'never)
5495 (not (gnus-summary-last-article-p article)))
5496 (gnus-summary-next-article)
5497 (gnus-summary-next-unread-article)))))))
5498 (gnus-summary-recenter)
5499 (gnus-summary-position-point)))
5501 (defun gnus-summary-prev-page (&optional lines)
5502 "Show previous page of selected article.
5503 Argument LINES specifies lines to be scrolled down."
5505 (gnus-set-global-variables)
5506 (let ((article (gnus-summary-article-number)))
5507 (gnus-configure-windows 'article)
5508 (if (or (null gnus-current-article)
5509 (null gnus-article-current)
5510 (/= article (cdr gnus-article-current))
5511 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5512 ;; Selected subject is different from current article's.
5513 (gnus-summary-display-article article)
5514 (gnus-summary-recenter)
5515 (gnus-eval-in-buffer-window gnus-article-buffer
5516 (gnus-article-prev-page lines))))
5517 (gnus-summary-position-point))
5519 (defun gnus-summary-scroll-up (lines)
5520 "Scroll up (or down) one line current article.
5521 Argument LINES specifies lines to be scrolled up (or down if negative)."
5523 (gnus-set-global-variables)
5524 (gnus-configure-windows 'article)
5525 (gnus-summary-show-thread)
5526 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5527 (gnus-eval-in-buffer-window gnus-article-buffer
5529 (when (gnus-article-next-page lines)
5530 (gnus-message 3 "End of message")))
5532 (gnus-article-prev-page (- lines))))))
5533 (gnus-summary-recenter)
5534 (gnus-summary-position-point))
5536 (defun gnus-summary-next-same-subject ()
5537 "Select next article which has the same subject as current one."
5539 (gnus-set-global-variables)
5540 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5542 (defun gnus-summary-prev-same-subject ()
5543 "Select previous article which has the same subject as current one."
5545 (gnus-set-global-variables)
5546 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5548 (defun gnus-summary-next-unread-same-subject ()
5549 "Select next unread article which has the same subject as current one."
5551 (gnus-set-global-variables)
5552 (gnus-summary-next-article t (gnus-summary-article-subject)))
5554 (defun gnus-summary-prev-unread-same-subject ()
5555 "Select previous unread article which has the same subject as current one."
5557 (gnus-set-global-variables)
5558 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5560 (defun gnus-summary-first-unread-article ()
5561 "Select the first unread article.
5562 Return nil if there are no unread articles."
5564 (gnus-set-global-variables)
5566 (when (gnus-summary-first-subject t)
5567 (gnus-summary-show-thread)
5568 (gnus-summary-first-subject t)
5569 (gnus-summary-display-article (gnus-summary-article-number)))
5570 (gnus-summary-position-point)))
5572 (defun gnus-summary-first-article ()
5573 "Select the first article.
5574 Return nil if there are no articles."
5576 (gnus-set-global-variables)
5578 (when (gnus-summary-first-subject)
5579 (gnus-summary-show-thread)
5580 (gnus-summary-first-subject)
5581 (gnus-summary-display-article (gnus-summary-article-number)))
5582 (gnus-summary-position-point)))
5584 (defun gnus-summary-best-unread-article ()
5585 "Select the unread article with the highest score."
5587 (gnus-set-global-variables)
5588 (let ((best -1000000)
5589 (data gnus-newsgroup-data)
5592 (and (gnus-data-unread-p (car data))
5594 (gnus-summary-article-score (gnus-data-number (car data))))
5597 article (gnus-data-number (car data))))
5598 (setq data (cdr data)))
5601 (gnus-summary-goto-article article)
5602 (error "No unread articles"))
5603 (gnus-summary-position-point))))
5605 (defun gnus-summary-last-subject ()
5606 "Go to the last displayed subject line in the group."
5607 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5609 (gnus-summary-goto-subject article))))
5611 (defun gnus-summary-goto-article (article &optional all-headers force)
5612 "Fetch ARTICLE and display it if it exists.
5613 If ALL-HEADERS is non-nil, no header lines are hidden."
5619 (mapcar (lambda (number) (list (int-to-string number)))
5620 gnus-newsgroup-limit)))
5624 (if (gnus-summary-goto-subject article force)
5625 (gnus-summary-display-article article all-headers)
5626 (gnus-message 4 "Couldn't go to article %s" article) nil)
5627 (gnus-summary-position-point)))
5629 (defun gnus-summary-goto-last-article ()
5630 "Go to the previously read article."
5633 (when gnus-last-article
5634 (gnus-summary-goto-article gnus-last-article))
5635 (gnus-summary-position-point)))
5637 (defun gnus-summary-pop-article (number)
5638 "Pop one article off the history and go to the previous.
5639 NUMBER articles will be popped off."
5642 (setq gnus-newsgroup-history
5643 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5645 (gnus-summary-goto-article (car to))
5646 (error "Article history empty")))
5647 (gnus-summary-position-point))
5649 ;; Summary commands and functions for limiting the summary buffer.
5651 (defun gnus-summary-limit-to-articles (n)
5652 "Limit the summary buffer to the next N articles.
5653 If not given a prefix, use the process marked articles instead."
5655 (gnus-set-global-variables)
5657 (let ((articles (gnus-summary-work-articles n)))
5658 (setq gnus-newsgroup-processable nil)
5659 (gnus-summary-limit articles))
5660 (gnus-summary-position-point)))
5662 (defun gnus-summary-pop-limit (&optional total)
5663 "Restore the previous limit.
5664 If given a prefix, remove all limits."
5666 (gnus-set-global-variables)
5668 (setq gnus-newsgroup-limits
5669 (list (mapcar (lambda (h) (mail-header-number h))
5670 gnus-newsgroup-headers))))
5671 (unless gnus-newsgroup-limits
5672 (error "No limit to pop"))
5674 (gnus-summary-limit nil 'pop)
5675 (gnus-summary-position-point)))
5677 (defun gnus-summary-limit-to-subject (subject &optional header)
5678 "Limit the summary buffer to articles that have subjects that match a regexp."
5679 (interactive "sLimit to subject (regexp): ")
5681 (setq header "subject"))
5682 (when (not (equal "" subject))
5684 (let ((articles (gnus-summary-find-matching
5685 (or header "subject") subject 'all)))
5687 (error "Found no matches for \"%s\"" subject))
5688 (gnus-summary-limit articles))
5689 (gnus-summary-position-point))))
5691 (defun gnus-summary-limit-to-author (from)
5692 "Limit the summary buffer to articles that have authors that match a regexp."
5693 (interactive "sLimit to author (regexp): ")
5694 (gnus-summary-limit-to-subject from "from"))
5696 (defun gnus-summary-limit-to-age (age &optional younger-p)
5697 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5698 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5699 articles that are younger than AGE days."
5700 (interactive "nTime in days: \nP")
5702 (let ((data gnus-newsgroup-data)
5703 (cutoff (nnmail-days-to-time age))
5704 articles d date is-younger)
5705 (while (setq d (pop data))
5706 (when (and (vectorp (gnus-data-header d))
5707 (setq date (mail-header-date (gnus-data-header d))))
5708 (setq is-younger (nnmail-time-less
5709 (nnmail-time-since (nnmail-date-to-time date))
5711 (when (if younger-p is-younger (not is-younger))
5712 (push (gnus-data-number d) articles))))
5713 (gnus-summary-limit (nreverse articles)))
5714 (gnus-summary-position-point)))
5716 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5718 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5720 (defun gnus-summary-limit-to-unread (&optional all)
5721 "Limit the summary buffer to articles that are not marked as read.
5722 If ALL is non-nil, limit strictly to unread articles."
5725 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5726 (gnus-summary-limit-to-marks
5727 ;; Concat all the marks that say that an article is read and have
5729 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5730 gnus-killed-mark gnus-kill-file-mark
5731 gnus-low-score-mark gnus-expirable-mark
5732 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5733 gnus-duplicate-mark)
5736 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5737 (make-obsolete 'gnus-summary-delete-marked-with
5738 'gnus-summary-limit-exlude-marks)
5740 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5741 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5742 If REVERSE, limit the summary buffer to articles that are marked
5743 with MARKS. MARKS can either be a string of marks or a list of marks.
5744 Returns how many articles were removed."
5745 (interactive "sMarks: ")
5746 (gnus-summary-limit-to-marks marks t))
5748 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5749 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5750 If REVERSE (the prefix), limit the summary buffer to articles that are
5751 not marked with MARKS. MARKS can either be a string of marks or a
5753 Returns how many articles were removed."
5754 (interactive (list (read-string "Marks: ") current-prefix-arg))
5755 (gnus-set-global-variables)
5757 (let ((data gnus-newsgroup-data)
5758 (marks (if (listp marks) marks
5759 (append marks nil))) ; Transform to list.
5762 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5763 (memq (gnus-data-mark (car data)) marks))
5764 (push (gnus-data-number (car data)) articles))
5765 (setq data (cdr data)))
5766 (gnus-summary-limit articles))
5767 (gnus-summary-position-point)))
5769 (defun gnus-summary-limit-to-score (&optional score)
5770 "Limit to articles with score at or above SCORE."
5772 (gnus-set-global-variables)
5773 (setq score (if score
5774 (prefix-numeric-value score)
5775 (or gnus-summary-default-score 0)))
5776 (let ((data gnus-newsgroup-data)
5779 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5781 (push (gnus-data-number (car data)) articles))
5782 (setq data (cdr data)))
5784 (gnus-summary-limit articles)
5785 (gnus-summary-position-point))))
5787 (defun gnus-summary-limit-include-dormant ()
5788 "Display all the hidden articles that are marked as dormant."
5790 (gnus-set-global-variables)
5791 (unless gnus-newsgroup-dormant
5792 (error "There are no dormant articles in this group"))
5794 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5795 (gnus-summary-position-point)))
5797 (defun gnus-summary-limit-exclude-dormant ()
5798 "Hide all dormant articles."
5800 (gnus-set-global-variables)
5802 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5803 (gnus-summary-position-point)))
5805 (defun gnus-summary-limit-exclude-childless-dormant ()
5806 "Hide all dormant articles that have no children."
5808 (gnus-set-global-variables)
5809 (let ((data (gnus-data-list t))
5810 articles d children)
5811 ;; Find all articles that are either not dormant or have
5813 (while (setq d (pop data))
5814 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5816 (gnus-article-children (gnus-data-number d)))
5819 (when (memq (car children) articles)
5824 (push (gnus-data-number d) articles)))
5827 (gnus-summary-limit articles)
5828 (gnus-summary-position-point))))
5830 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5831 "Mark all unread excluded articles as read.
5832 If ALL, mark even excluded ticked and dormants as read."
5834 (let ((articles (gnus-sorted-complement
5836 (mapcar (lambda (h) (mail-header-number h))
5837 gnus-newsgroup-headers)
5839 (sort gnus-newsgroup-limit '<)))
5841 (setq gnus-newsgroup-unreads nil)
5843 (setq gnus-newsgroup-dormant nil
5844 gnus-newsgroup-marked nil
5845 gnus-newsgroup-reads
5847 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5848 gnus-newsgroup-reads))
5849 (while (setq article (pop articles))
5850 (unless (or (memq article gnus-newsgroup-dormant)
5851 (memq article gnus-newsgroup-marked))
5852 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5854 (defun gnus-summary-limit (articles &optional pop)
5856 ;; We pop the previous limit off the stack and use that.
5857 (setq articles (car gnus-newsgroup-limits)
5858 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5859 ;; We use the new limit, so we push the old limit on the stack.
5860 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5862 (setq gnus-newsgroup-limit articles)
5863 (let ((total (length gnus-newsgroup-data))
5864 (data (gnus-data-find-list (gnus-summary-article-number)))
5865 (gnus-summary-mark-below nil) ; Inhibit this.
5867 ;; This will do all the work of generating the new summary buffer
5868 ;; according to the new limit.
5869 (gnus-summary-prepare)
5870 ;; Hide any threads, possibly.
5871 (and gnus-show-threads
5872 gnus-thread-hide-subtree
5873 (gnus-summary-hide-all-threads))
5874 ;; Try to return to the article you were at, or one in the
5877 ;; We try to find some article after the current one.
5879 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5882 (setq data (cdr data))))
5884 ;; If there is no data, that means that we were after the last
5885 ;; article. The same goes when we can't find any articles
5886 ;; after the current one.
5887 (goto-char (point-max))
5888 (gnus-summary-find-prev))
5889 ;; We return how many articles were removed from the summary
5890 ;; buffer as a result of the new limit.
5891 (- total (length gnus-newsgroup-data))))
5893 (defsubst gnus-invisible-cut-children (threads)
5896 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5901 (defsubst gnus-cut-thread (thread)
5902 "Go forwards in the thread until we find an article that we want to display."
5903 (when (or (eq gnus-fetch-old-headers 'some)
5904 (eq gnus-build-sparse-threads 'some)
5905 (eq gnus-build-sparse-threads 'more))
5906 ;; Deal with old-fetched headers and sparse threads.
5910 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5911 (gnus-summary-article-ancient-p
5912 (mail-header-number (car thread))))
5914 (if (<= (length (cdr thread)) 1)
5915 (setq thread (cadr thread))
5916 (when (gnus-invisible-cut-children (cdr thread))
5917 (let ((th (cdr thread)))
5919 (if (memq (mail-header-number (caar th))
5920 gnus-newsgroup-limit)
5921 (setq thread (car th)
5923 (setq th (cdr th)))))))))
5927 (defun gnus-cut-threads (threads)
5928 "Cut off all uninteresting articles from the beginning of threads."
5929 (when (or (eq gnus-fetch-old-headers 'some)
5930 (eq gnus-build-sparse-threads 'some)
5931 (eq gnus-build-sparse-threads 'more))
5934 (setcar th (gnus-cut-thread (car th)))
5935 (setq th (cdr th)))))
5936 ;; Remove nixed out threads.
5939 (defun gnus-summary-initial-limit (&optional show-if-empty)
5940 "Figure out what the initial limit is supposed to be on group entry.
5941 This entails weeding out unwanted dormants, low-scored articles,
5942 fetch-old-headers verbiage, and so on."
5943 ;; Most groups have nothing to remove.
5944 (if (or gnus-inhibit-limiting
5945 (and (null gnus-newsgroup-dormant)
5946 (not (eq gnus-fetch-old-headers 'some))
5947 (null gnus-summary-expunge-below)
5948 (not (eq gnus-build-sparse-threads 'some))
5949 (not (eq gnus-build-sparse-threads 'more))
5950 (null gnus-thread-expunge-below)
5951 (not gnus-use-nocem)))
5953 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5954 (setq gnus-newsgroup-limit nil)
5957 (unless (car (symbol-value node))
5958 ;; These threads have no parents -- they are roots.
5959 (let ((nodes (cdr (symbol-value node)))
5962 (if (and gnus-thread-expunge-below
5963 (< (gnus-thread-total-score (car nodes))
5964 gnus-thread-expunge-below))
5965 (gnus-expunge-thread (pop nodes))
5966 (setq thread (pop nodes))
5967 (gnus-summary-limit-children thread))))))
5968 gnus-newsgroup-dependencies)
5969 ;; If this limitation resulted in an empty group, we might
5970 ;; pop the previous limit and use it instead.
5971 (when (and (not gnus-newsgroup-limit)
5973 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5974 gnus-newsgroup-limit))
5976 (defun gnus-summary-limit-children (thread)
5977 "Return 1 if this subthread is visible and 0 if it is not."
5978 ;; First we get the number of visible children to this thread. This
5979 ;; is done by recursing down the thread using this function, so this
5980 ;; will really go down to a leaf article first, before slowly
5981 ;; working its way up towards the root.
5985 (apply '+ (mapcar 'gnus-summary-limit-children
5988 (number (mail-header-number (car thread)))
5991 (not (memq number gnus-newsgroup-marked))
5993 ;; If this article is dormant and has absolutely no visible
5994 ;; children, then this article isn't visible.
5995 (and (memq number gnus-newsgroup-dormant)
5997 ;; If this is "fetch-old-headered" and there is no
5998 ;; visible children, then we don't want this article.
5999 (and (eq gnus-fetch-old-headers 'some)
6000 (gnus-summary-article-ancient-p number)
6002 ;; If this is a sparsely inserted article with no children,
6003 ;; we don't want it.
6004 (and (eq gnus-build-sparse-threads 'some)
6005 (gnus-summary-article-sparse-p number)
6007 ;; If we use expunging, and this article is really
6008 ;; low-scored, then we don't want this article.
6009 (when (and gnus-summary-expunge-below
6011 (or (cdr (assq number gnus-newsgroup-scored))
6012 gnus-summary-default-score))
6013 gnus-summary-expunge-below))
6014 ;; We increase the expunge-tally here, but that has
6015 ;; nothing to do with the limits, really.
6016 (incf gnus-newsgroup-expunged-tally)
6017 ;; We also mark as read here, if that's wanted.
6018 (when (and gnus-summary-mark-below
6019 (< score gnus-summary-mark-below))
6020 (setq gnus-newsgroup-unreads
6021 (delq number gnus-newsgroup-unreads))
6022 (if gnus-newsgroup-auto-expire
6023 (push number gnus-newsgroup-expirable)
6024 (push (cons number gnus-low-score-mark)
6025 gnus-newsgroup-reads)))
6027 ;; Check NoCeM things.
6028 (if (and gnus-use-nocem
6029 (gnus-nocem-unwanted-article-p
6030 (mail-header-id (car thread))))
6032 (setq gnus-newsgroup-reads
6033 (delq number gnus-newsgroup-unreads))
6035 ;; Nope, invisible article.
6037 ;; Ok, this article is to be visible, so we add it to the limit
6039 (push number gnus-newsgroup-limit)
6042 (defun gnus-expunge-thread (thread)
6043 "Mark all articles in THREAD as read."
6044 (let* ((number (mail-header-number (car thread))))
6045 (incf gnus-newsgroup-expunged-tally)
6046 ;; We also mark as read here, if that's wanted.
6047 (setq gnus-newsgroup-unreads
6048 (delq number gnus-newsgroup-unreads))
6049 (if gnus-newsgroup-auto-expire
6050 (push number gnus-newsgroup-expirable)
6051 (push (cons number gnus-low-score-mark)
6052 gnus-newsgroup-reads)))
6053 ;; Go recursively through all subthreads.
6054 (mapcar 'gnus-expunge-thread (cdr thread)))
6056 ;; Summary article oriented commands
6058 (defun gnus-summary-refer-parent-article (n)
6059 "Refer parent article N times.
6060 If N is negative, go to ancestor -N instead.
6061 The difference between N and the number of articles fetched is returned."
6063 (gnus-set-global-variables)
6066 (when (not (natnump n))
6071 (setq header (gnus-summary-article-header))
6072 (if (and (eq (mail-header-number header)
6073 (cdr gnus-article-current))
6074 (equal gnus-newsgroup-name
6075 (car gnus-article-current)))
6076 ;; If we try to find the parent of the currently
6077 ;; displayed article, then we take a look at the actual
6078 ;; References header, since this is slightly more
6079 ;; reliable than the References field we got from the
6082 (set-buffer gnus-original-article-buffer)
6083 (nnheader-narrow-to-headers)
6084 (unless (setq ref (message-fetch-field "references"))
6085 (setq ref (message-fetch-field "in-reply-to")))
6088 ;; It's not the current article, so we take a bet on
6089 ;; the value we got from the server.
6090 (mail-header-references header)))
6092 (not (equal ref "")))
6093 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6094 (gnus-message 1 "Couldn't find parent"))
6095 (gnus-message 1 "No references in article %d"
6096 (gnus-summary-article-number))
6099 (gnus-summary-position-point)
6102 (defun gnus-summary-refer-references ()
6103 "Fetch all articles mentioned in the References header.
6104 Return how many articles were fetched."
6106 (gnus-set-global-variables)
6107 (let ((ref (mail-header-references (gnus-summary-article-header)))
6108 (current (gnus-summary-article-number))
6112 (error "No References in the current article")
6113 ;; For each Message-ID in the References header...
6114 (while (string-match "<[^>]*>" ref)
6116 ;; ... fetch that article.
6117 (gnus-summary-refer-article
6118 (prog1 (match-string 0 ref)
6119 (setq ref (substring ref (match-end 0))))))
6120 (gnus-summary-goto-subject current)
6121 (gnus-summary-position-point)
6124 (defun gnus-summary-refer-article (message-id)
6125 "Fetch an article specified by MESSAGE-ID."
6126 (interactive "sMessage-ID: ")
6127 (when (and (stringp message-id)
6128 (not (zerop (length message-id))))
6129 ;; Construct the correct Message-ID if necessary.
6130 ;; Suggested by tale@pawl.rpi.edu.
6131 (unless (string-match "^<" message-id)
6132 (setq message-id (concat "<" message-id)))
6133 (unless (string-match ">$" message-id)
6134 (setq message-id (concat message-id ">")))
6135 (let* ((header (gnus-id-to-header message-id))
6137 (gnus-summary-article-sparse-p
6138 (mail-header-number header)))))
6141 ;; The article is present in the buffer, to we just go to it.
6142 (gnus-summary-goto-article
6143 (mail-header-number header) nil header)
6145 (gnus-summary-update-article (mail-header-number header))))
6146 ;; We fetch the article
6147 (let ((gnus-override-method
6148 (and (gnus-news-group-p gnus-newsgroup-name)
6149 gnus-refer-article-method))
6151 ;; Start the special refer-article method, if necessary.
6152 (when (and gnus-refer-article-method
6153 (gnus-news-group-p gnus-newsgroup-name))
6154 (gnus-check-server gnus-refer-article-method))
6155 ;; Fetch the header, and display the article.
6156 (if (setq number (gnus-summary-insert-subject message-id))
6157 (gnus-summary-select-article nil nil nil number)
6158 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6160 (defun gnus-summary-enter-digest-group (&optional force)
6161 "Enter an nndoc group based on the current article.
6162 If FORCE, force a digest interpretation. If not, try
6163 to guess what the document format is."
6165 (gnus-set-global-variables)
6166 (let ((conf gnus-current-window-configuration))
6168 (gnus-summary-select-article))
6169 (setq gnus-current-window-configuration conf)
6170 (let* ((name (format "%s-%d"
6171 (gnus-group-prefixed-name
6172 gnus-newsgroup-name (list 'nndoc ""))
6174 (set-buffer gnus-summary-buffer)
6175 gnus-current-article)))
6176 (ogroup gnus-newsgroup-name)
6177 (params (append (gnus-info-params (gnus-get-info ogroup))
6178 (list (cons 'to-group ogroup))))
6179 (case-fold-search t)
6180 (buf (current-buffer))
6183 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6184 (insert-buffer-substring gnus-original-article-buffer)
6185 ;; Remove lines that may lead nndoc to misinterpret the
6188 (goto-char (point-min))
6189 (or (search-forward "\n\n" nil t) (point)))
6190 (goto-char (point-min))
6191 (delete-matching-lines "^\\(Path\\):\\|^From ")
6194 (if (gnus-group-read-ephemeral-group
6195 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6197 ,(if force 'digest 'guess))) t)
6198 ;; Make all postings to this group go to the parent group.
6199 (nconc (gnus-info-params (gnus-get-info name))
6201 ;; Couldn't select this doc group.
6202 (switch-to-buffer buf)
6203 (gnus-set-global-variables)
6204 (gnus-configure-windows 'summary)
6205 (gnus-message 3 "Article couldn't be entered?"))
6206 (kill-buffer dig)))))
6208 (defun gnus-summary-read-document (n)
6209 "Open a new group based on the current article(s).
6210 This will allow you to read digests and other similar
6211 documents as newsgroups.
6212 Obeys the standard process/prefix convention."
6214 (let* ((articles (gnus-summary-work-articles n))
6215 (ogroup gnus-newsgroup-name)
6216 (params (append (gnus-info-params (gnus-get-info ogroup))
6217 (list (cons 'to-group ogroup))))
6218 article group egroup groups vgroup)
6219 (while (setq article (pop articles))
6220 (setq group (format "%s-%d" gnus-newsgroup-name article))
6221 (gnus-summary-remove-process-mark article)
6222 (when (gnus-summary-display-article article)
6224 (nnheader-temp-write nil
6225 (insert-buffer-substring gnus-original-article-buffer)
6226 ;; Remove some headers that may lead nndoc to make
6228 (message-narrow-to-head)
6229 (goto-char (point-min))
6230 (delete-matching-lines "^\\(Path\\):\\|^From ")
6233 (gnus-group-read-ephemeral-group
6234 group `(nndoc ,group (nndoc-address ,(current-buffer))
6235 (nndoc-article-type guess))
6238 ;; Make all postings to this group go to the parent group.
6239 (nconc (gnus-info-params (gnus-get-info egroup))
6241 (push egroup groups))
6242 ;; Couldn't select this doc group.
6243 (gnus-error 3 "Article couldn't be entered"))))))
6244 ;; Now we have selected all the documents.
6247 (error "None of the articles could be interpreted as documents"))
6248 ((gnus-group-read-ephemeral-group
6249 (setq vgroup (format
6250 "nnvirtual:%s-%s" gnus-newsgroup-name
6251 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6252 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6254 (cons (current-buffer) 'summary)))
6256 (error "Couldn't select virtual nndoc group")))))
6258 (defun gnus-summary-isearch-article (&optional regexp-p)
6259 "Do incremental search forward on the current article.
6260 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6262 (gnus-set-global-variables)
6263 (gnus-summary-select-article)
6264 (gnus-configure-windows 'article)
6265 (gnus-eval-in-buffer-window gnus-article-buffer
6266 ;;(goto-char (point-min))
6267 (isearch-forward regexp-p)))
6269 (defun gnus-summary-search-article-forward (regexp &optional backward)
6270 "Search for an article containing REGEXP forward.
6271 If BACKWARD, search backward instead."
6274 (format "Search article %s (regexp%s): "
6275 (if current-prefix-arg "backward" "forward")
6276 (if gnus-last-search-regexp
6277 (concat ", default " gnus-last-search-regexp)
6279 current-prefix-arg))
6280 (gnus-set-global-variables)
6281 (if (string-equal regexp "")
6282 (setq regexp (or gnus-last-search-regexp ""))
6283 (setq gnus-last-search-regexp regexp))
6284 (if (gnus-summary-search-article regexp backward)
6285 (gnus-summary-show-thread)
6286 (error "Search failed: \"%s\"" regexp)))
6288 (defun gnus-summary-search-article-backward (regexp)
6289 "Search for an article containing REGEXP backward."
6292 (format "Search article backward (regexp%s): "
6293 (if gnus-last-search-regexp
6294 (concat ", default " gnus-last-search-regexp)
6296 (gnus-summary-search-article-forward regexp 'backward))
6298 (defun gnus-summary-search-article (regexp &optional backward)
6299 "Search for an article containing REGEXP.
6300 Optional argument BACKWARD means do search for backward.
6301 `gnus-select-article-hook' is not called during the search."
6302 (let ((gnus-select-article-hook nil) ;Disable hook.
6303 (gnus-article-display-hook nil)
6304 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6305 (gnus-use-article-prefetch nil)
6306 (sum (current-buffer))
6309 (gnus-save-hidden-threads
6310 (gnus-summary-select-article)
6311 (set-buffer gnus-article-buffer)
6315 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6317 (re-search-backward regexp nil t)
6318 (re-search-forward regexp nil t))
6319 ;; We found the regexp.
6324 (get-buffer-window (current-buffer))
6328 (setq point (point)))
6329 ;; We didn't find it, so we go to the next article.
6332 (while (eq found 'not)
6333 (if (not (if backward (gnus-summary-find-prev)
6334 (gnus-summary-find-next)))
6335 ;; No more articles.
6337 ;; Select the next article and adjust point.
6338 (unless (gnus-summary-article-sparse-p
6339 (gnus-summary-article-number))
6341 (gnus-summary-select-article)
6342 (set-buffer gnus-article-buffer)
6344 (goto-char (if backward (point-max) (point-min))))))))
6345 (gnus-message 7 ""))
6346 ;; Return whether we found the regexp.
6347 (when (eq found 'found)
6349 (gnus-summary-show-thread)
6350 (gnus-summary-goto-subject gnus-current-article)
6351 (gnus-summary-position-point)
6354 (defun gnus-summary-find-matching (header regexp &optional backward unread
6356 "Return a list of all articles that match REGEXP on HEADER.
6357 The search stars on the current article and goes forwards unless
6358 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6359 If UNREAD is non-nil, only unread articles will
6360 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6361 in the comparisons."
6362 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6363 (gnus-data-find-list
6364 (gnus-summary-article-number) (gnus-data-list backward))))
6365 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6366 (case-fold-search (not not-case-fold))
6368 (unless (fboundp (intern (concat "mail-header-" header)))
6369 (error "%s is not a valid header" header))
6372 (and (or (not unread) ; We want all articles...
6373 (gnus-data-unread-p d)) ; Or just unreads.
6374 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6375 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6376 (push (gnus-data-number d) articles)) ; Success!
6377 (setq data (cdr data)))
6378 (nreverse articles)))
6380 (defun gnus-summary-execute-command (header regexp command &optional backward)
6381 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6382 If HEADER is an empty string (or nil), the match is done on the entire
6383 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6385 (list (let ((completion-ignore-case t))
6388 (mapcar (lambda (string) (list string))
6389 '("Number" "Subject" "From" "Lines" "Date"
6390 "Message-ID" "Xref" "References" "Body"))
6391 nil 'require-match))
6392 (read-string "Regexp: ")
6393 (read-key-sequence "Command: ")
6394 current-prefix-arg))
6395 (when (equal header "Body")
6397 (gnus-set-global-variables)
6398 ;; Hidden thread subtrees must be searched as well.
6399 (gnus-summary-show-all-threads)
6400 ;; We don't want to change current point nor window configuration.
6402 (save-window-excursion
6403 (gnus-message 6 "Executing %s..." (key-description command))
6404 ;; We'd like to execute COMMAND interactively so as to give arguments.
6405 (gnus-execute header regexp
6406 `(call-interactively ',(key-binding command))
6408 (gnus-message 6 "Executing %s...done" (key-description command)))))
6410 (defun gnus-summary-beginning-of-article ()
6411 "Scroll the article back to the beginning."
6413 (gnus-set-global-variables)
6414 (gnus-summary-select-article)
6415 (gnus-configure-windows 'article)
6416 (gnus-eval-in-buffer-window gnus-article-buffer
6418 (goto-char (point-min))
6419 (when gnus-break-pages
6420 (gnus-narrow-to-page))))
6422 (defun gnus-summary-end-of-article ()
6423 "Scroll to the end of the article."
6425 (gnus-set-global-variables)
6426 (gnus-summary-select-article)
6427 (gnus-configure-windows 'article)
6428 (gnus-eval-in-buffer-window gnus-article-buffer
6430 (goto-char (point-max))
6432 (when gnus-break-pages
6433 (gnus-narrow-to-page))))
6435 (defun gnus-summary-print-article (&optional filename)
6436 "Generate and print a PostScript image of the article buffer.
6438 If the optional argument FILENAME is nil, send the image to the printer.
6439 If FILENAME is a string, save the PostScript image in a file with that
6440 name. If FILENAME is a number, prompt the user for the name of the file
6442 (interactive (list (ps-print-preprint current-prefix-arg)))
6443 (gnus-summary-select-article)
6444 (gnus-eval-in-buffer-window gnus-article-buffer
6445 (let ((buffer (generate-new-buffer " *print*")))
6448 (copy-to-buffer buffer (point-min) (point-max))
6450 (gnus-article-delete-invisible-text)
6451 (ps-print-buffer-with-faces filename))
6452 (kill-buffer buffer)))))
6454 (defun gnus-summary-show-article (&optional arg)
6455 "Force re-fetching of the current article.
6456 If ARG (the prefix) is non-nil, show the raw article without any
6457 article massaging functions being run."
6459 (gnus-set-global-variables)
6461 ;; Select the article the normal way.
6462 (gnus-summary-select-article nil 'force)
6463 ;; Bind the article treatment functions to nil.
6464 (let ((gnus-have-all-headers t)
6465 gnus-article-display-hook
6466 gnus-article-prepare-hook
6469 (gnus-summary-select-article nil 'force)))
6470 (gnus-summary-goto-subject gnus-current-article)
6471 ; (gnus-configure-windows 'article)
6472 (gnus-summary-position-point))
6474 (defun gnus-summary-verbose-headers (&optional arg)
6475 "Toggle permanent full header display.
6476 If ARG is a positive number, turn header display on.
6477 If ARG is a negative number, turn header display off."
6479 (gnus-set-global-variables)
6480 (setq gnus-show-all-headers
6481 (cond ((or (not (numberp arg))
6483 (not gnus-show-all-headers))
6486 (gnus-summary-show-article))
6488 (defun gnus-summary-toggle-header (&optional arg)
6489 "Show the headers if they are hidden, or hide them if they are shown.
6490 If ARG is a positive number, show the entire header.
6491 If ARG is a negative number, hide the unwanted header lines."
6493 (gnus-set-global-variables)
6495 (set-buffer gnus-article-buffer)
6496 (let* ((buffer-read-only nil)
6497 (inhibit-point-motion-hooks t)
6498 (hidden (text-property-any
6499 (goto-char (point-min)) (search-forward "\n\n")
6502 (goto-char (point-min))
6503 (when (search-forward "\n\n" nil t)
6504 (delete-region (point-min) (1- (point))))
6505 (goto-char (point-min))
6507 (set-buffer gnus-original-article-buffer)
6508 (goto-char (point-min))
6509 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6510 (insert-buffer-substring gnus-original-article-buffer 1 e)
6511 (let ((article-inhibit-hiding t))
6512 (run-hooks 'gnus-article-display-hook))
6513 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6514 (gnus-article-hide-headers)))))
6516 (defun gnus-summary-show-all-headers ()
6517 "Make all header lines visible."
6519 (gnus-set-global-variables)
6520 (gnus-article-show-all-headers))
6522 (defun gnus-summary-toggle-mime (&optional arg)
6523 "Toggle MIME processing.
6524 If ARG is a positive number, turn MIME processing on."
6526 (gnus-set-global-variables)
6527 (setq gnus-show-mime
6528 (if (null arg) (not gnus-show-mime)
6529 (> (prefix-numeric-value arg) 0)))
6530 (gnus-summary-select-article t 'force))
6532 (defun gnus-summary-caesar-message (&optional arg)
6533 "Caesar rotate the current article by 13.
6534 The numerical prefix specifies how manu places to rotate each letter
6537 (gnus-set-global-variables)
6538 (gnus-summary-select-article)
6539 (let ((mail-header-separator ""))
6540 (gnus-eval-in-buffer-window gnus-article-buffer
6543 (let ((start (window-start))
6545 (message-caesar-buffer-body arg)
6546 (set-window-start (get-buffer-window (current-buffer)) start))))))
6548 (defun gnus-summary-stop-page-breaking ()
6549 "Stop page breaking in the current article."
6551 (gnus-set-global-variables)
6552 (gnus-summary-select-article)
6553 (gnus-eval-in-buffer-window gnus-article-buffer
6555 (when (gnus-visual-p 'page-marker)
6556 (let ((buffer-read-only nil))
6557 (gnus-remove-text-with-property 'gnus-prev)
6558 (gnus-remove-text-with-property 'gnus-next)))))
6560 (defun gnus-summary-move-article (&optional n to-newsgroup
6561 select-method action)
6562 "Move the current article to a different newsgroup.
6563 If N is a positive number, move the N next articles.
6564 If N is a negative number, move the N previous articles.
6565 If N is nil and any articles have been marked with the process mark,
6566 move those articles instead.
6567 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6568 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6569 re-spool using this method.
6571 For this function to work, both the current newsgroup and the
6572 newsgroup that you want to move to have to support the `request-move'
6573 and `request-accept' functions."
6576 (setq action 'move))
6577 (gnus-set-global-variables)
6578 ;; Disable marking as read.
6579 (let (gnus-mark-article-hook)
6580 (save-window-excursion
6581 (gnus-summary-select-article)))
6582 ;; Check whether the source group supports the required functions.
6583 (cond ((and (eq action 'move)
6584 (not (gnus-check-backend-function
6585 'request-move-article gnus-newsgroup-name)))
6586 (error "The current group does not support article moving"))
6587 ((and (eq action 'crosspost)
6588 (not (gnus-check-backend-function
6589 'request-replace-article gnus-newsgroup-name)))
6590 (error "The current group does not support article editing")))
6591 (let ((articles (gnus-summary-work-articles n))
6592 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6593 (names '((move "Move" "Moving")
6594 (copy "Copy" "Copying")
6595 (crosspost "Crosspost" "Crossposting")))
6596 (copy-buf (save-excursion
6597 (nnheader-set-temp-buffer " *copy article*")))
6598 art-group to-method new-xref article to-groups)
6599 (unless (assq action names)
6600 (error "Unknown action %s" action))
6601 ;; Read the newsgroup name.
6602 (when (and (not to-newsgroup)
6603 (not select-method))
6605 (gnus-read-move-group-name
6606 (cadr (assq action names))
6607 (symbol-value (intern (format "gnus-current-%s-group" action)))
6609 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6610 (setq to-method (or select-method
6611 (gnus-group-name-to-method to-newsgroup)))
6612 ;; Check the method we are to move this article to...
6613 (unless (gnus-check-backend-function
6614 'request-accept-article (car to-method))
6615 (error "%s does not support article copying" (car to-method)))
6616 (unless (gnus-check-server to-method)
6617 (error "Can't open server %s" (car to-method)))
6618 (gnus-message 6 "%s to %s: %s..."
6619 (caddr (assq action names))
6620 (or (car select-method) to-newsgroup) articles)
6622 (setq article (pop articles))
6626 ;; Move the article.
6628 (gnus-request-move-article
6629 article ; Article to move
6630 gnus-newsgroup-name ; From newsgroup
6631 (nth 1 (gnus-find-method-for-group
6632 gnus-newsgroup-name)) ; Server
6633 (list 'gnus-request-accept-article
6634 to-newsgroup (list 'quote select-method)
6635 (not articles)) ; Accept form
6636 (not articles))) ; Only save nov last time
6637 ;; Copy the article.
6640 (set-buffer copy-buf)
6641 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6642 (gnus-request-accept-article
6643 to-newsgroup select-method (not articles))))
6644 ;; Crosspost the article.
6645 ((eq action 'crosspost)
6646 (let ((xref (message-tokenize-header
6647 (mail-header-xref (gnus-summary-article-header article))
6649 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6652 (setq xref (list (system-name))))
6655 (mapconcat 'identity
6656 (delete "Xref:" (delete new-xref xref))
6660 (set-buffer copy-buf)
6661 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6662 (nnheader-replace-header "xref" new-xref)
6663 (gnus-request-accept-article
6664 to-newsgroup select-method (not articles)))))))
6666 (gnus-message 1 "Couldn't %s article %s"
6667 (cadr (assq action names)) article)
6670 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6672 (gnus-group-prefixed-name
6675 (gnus-find-method-for-group to-newsgroup)))
6676 gnus-newsrc-hashtb)))
6677 (info (nth 2 entry))
6678 (to-group (gnus-info-group info)))
6679 ;; Update the group that has been moved to.
6681 (memq action '(move copy)))
6682 (unless (member to-group to-groups)
6683 (push to-group to-groups))
6685 (unless (memq article gnus-newsgroup-unreads)
6687 info (gnus-add-to-range (gnus-info-read info)
6688 (list (cdr art-group)))))
6690 ;; Copy any marks over to the new group.
6691 (let ((marks gnus-article-mark-lists)
6692 (to-article (cdr art-group)))
6694 ;; See whether the article is to be put in the cache.
6695 (when gnus-use-cache
6696 (gnus-cache-possibly-enter-article
6698 (let ((header (copy-sequence
6699 (gnus-summary-article-header article))))
6700 (mail-header-set-number header to-article)
6702 (memq article gnus-newsgroup-marked)
6703 (memq article gnus-newsgroup-dormant)
6704 (memq article gnus-newsgroup-unreads)))
6707 (when (memq article (symbol-value
6708 (intern (format "gnus-newsgroup-%s"
6710 ;; If the other group is the same as this group,
6711 ;; then we have to add the mark to the list.
6712 (when (equal to-group gnus-newsgroup-name)
6713 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6716 (intern (format "gnus-newsgroup-%s"
6718 ;; Copy mark to other group.
6719 (gnus-add-marked-articles
6720 to-group (cdar marks) (list to-article) info))
6721 (setq marks (cdr marks)))))
6723 ;; Update the Xref header in this article to point to
6724 ;; the new crossposted article we have just created.
6725 (when (eq action 'crosspost)
6727 (set-buffer copy-buf)
6728 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6729 (nnheader-replace-header
6730 "xref" (concat new-xref " " (car art-group)
6731 ":" (cdr art-group)))
6732 (gnus-request-replace-article
6733 article gnus-newsgroup-name (current-buffer)))))
6735 (gnus-summary-goto-subject article)
6736 (when (eq action 'move)
6737 (gnus-summary-mark-article article gnus-canceled-mark)))
6738 (gnus-summary-remove-process-mark article))
6739 ;; Re-activate all groups that have been moved to.
6741 (gnus-activate-group (pop to-groups)))
6743 (gnus-kill-buffer copy-buf)
6744 (gnus-summary-position-point)
6745 (gnus-set-mode-line 'summary)))
6747 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6748 "Move the current article to a different newsgroup.
6749 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6750 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6751 re-spool using this method."
6753 (gnus-summary-move-article n nil select-method 'copy))
6755 (defun gnus-summary-crosspost-article (&optional n)
6756 "Crosspost the current article to some other group."
6758 (gnus-summary-move-article n nil nil 'crosspost))
6760 (defcustom gnus-summary-respool-default-method nil
6761 "Default method for respooling an article.
6762 If nil, use to the current newsgroup method."
6763 :type 'gnus-select-method-name
6764 :group 'gnus-summary-mail)
6766 (defun gnus-summary-respool-article (&optional n method)
6767 "Respool the current article.
6768 The article will be squeezed through the mail spooling process again,
6769 which means that it will be put in some mail newsgroup or other
6770 depending on `nnmail-split-methods'.
6771 If N is a positive number, respool the N next articles.
6772 If N is a negative number, respool the N previous articles.
6773 If N is nil and any articles have been marked with the process mark,
6774 respool those articles instead.
6776 Respooling can be done both from mail groups and \"real\" newsgroups.
6777 In the former case, the articles in question will be moved from the
6778 current group into whatever groups they are destined to. In the
6779 latter case, they will be copied into the relevant groups."
6781 (list current-prefix-arg
6782 (let* ((methods (gnus-methods-using 'respool))
6784 (symbol-name (or gnus-summary-respool-default-method
6785 (car (gnus-find-method-for-group
6786 gnus-newsgroup-name)))))
6788 (gnus-completing-read
6789 methname "What backend do you want to use when respooling?"
6790 methods nil t nil 'gnus-mail-method-history))
6793 ((zerop (length (setq ms (gnus-servers-using-backend
6795 (list (intern method) ""))
6799 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6800 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6802 (gnus-set-global-variables)
6804 (error "No method given for respooling"))
6805 (if (assoc (symbol-name
6806 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6807 (gnus-methods-using 'respool))
6808 (gnus-summary-move-article n nil method)
6809 (gnus-summary-copy-article n nil method)))
6811 (defun gnus-summary-import-article (file)
6812 "Import a random file into a mail newsgroup."
6813 (interactive "fImport file: ")
6814 (gnus-set-global-variables)
6815 (let ((group gnus-newsgroup-name)
6816 (now (current-time))
6818 (unless (gnus-check-backend-function 'request-accept-article group)
6819 (error "%s does not support article importing" group))
6820 (or (file-readable-p file)
6821 (not (file-regular-p file))
6822 (error "Can't read %s" file))
6824 (set-buffer (get-buffer-create " *import file*"))
6825 (buffer-disable-undo (current-buffer))
6827 (insert-file-contents file)
6828 (goto-char (point-min))
6829 (unless (nnheader-article-p)
6830 ;; This doesn't look like an article, so we fudge some headers.
6831 (setq atts (file-attributes file)
6832 lines (count-lines (point-min) (point-max)))
6833 (insert "From: " (read-string "From: ") "\n"
6834 "Subject: " (read-string "Subject: ") "\n"
6835 "Date: " (timezone-make-date-arpa-standard
6836 (current-time-string (nth 5 atts))
6837 (current-time-zone now)
6838 (current-time-zone now))
6840 "Message-ID: " (message-make-message-id) "\n"
6841 "Lines: " (int-to-string lines) "\n"
6842 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6843 (gnus-request-accept-article group nil t)
6844 (kill-buffer (current-buffer)))))
6846 (defun gnus-summary-article-posted-p ()
6847 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6848 This will be the case if the article has both been mailed and posted."
6850 (let ((id (mail-header-references (gnus-summary-article-header)))
6851 (gnus-override-method
6852 (or gnus-refer-article-method gnus-select-method)))
6853 (if (gnus-request-head id "")
6854 (gnus-message 2 "The current message was found on %s"
6855 gnus-override-method)
6856 (gnus-message 2 "The current message couldn't be found on %s"
6857 gnus-override-method)
6860 (defun gnus-summary-expire-articles (&optional now)
6861 "Expire all articles that are marked as expirable in the current group."
6863 (gnus-set-global-variables)
6864 (when (gnus-check-backend-function
6865 'request-expire-articles gnus-newsgroup-name)
6866 ;; This backend supports expiry.
6867 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6868 (expirable (if total
6870 ;; We need to update the info for
6871 ;; this group for `gnus-list-of-read-articles'
6872 ;; to give us the right answer.
6873 (run-hooks 'gnus-exit-group-hook)
6874 (gnus-summary-update-info)
6875 (gnus-list-of-read-articles gnus-newsgroup-name))
6876 (setq gnus-newsgroup-expirable
6877 (sort gnus-newsgroup-expirable '<))))
6878 (expiry-wait (if now 'immediate
6879 (gnus-group-find-parameter
6880 gnus-newsgroup-name 'expiry-wait)))
6883 ;; There are expirable articles in this group, so we run them
6884 ;; through the expiry process.
6885 (gnus-message 6 "Expiring articles...")
6886 ;; The list of articles that weren't expired is returned.
6888 (let ((nnmail-expiry-wait-function nil)
6889 (nnmail-expiry-wait expiry-wait))
6890 (setq es (gnus-request-expire-articles
6891 expirable gnus-newsgroup-name)))
6892 (setq es (gnus-request-expire-articles
6893 expirable gnus-newsgroup-name)))
6895 (setq gnus-newsgroup-expirable es))
6896 ;; We go through the old list of expirable, and mark all
6897 ;; really expired articles as nonexistent.
6898 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6899 (let ((gnus-use-cache nil))
6901 (unless (memq (car expirable) es)
6902 (when (gnus-data-find (car expirable))
6903 (gnus-summary-mark-article
6904 (car expirable) gnus-canceled-mark)))
6905 (setq expirable (cdr expirable)))))
6906 (gnus-message 6 "Expiring articles...done")))))
6908 (defun gnus-summary-expire-articles-now ()
6909 "Expunge all expirable articles in the current group.
6910 This means that *all* articles that are marked as expirable will be
6911 deleted forever, right now."
6913 (gnus-set-global-variables)
6914 (or gnus-expert-user
6916 "Are you really, really, really sure you want to delete all these messages? ")
6918 (gnus-summary-expire-articles t))
6920 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6921 (defun gnus-summary-delete-article (&optional n)
6922 "Delete the N next (mail) articles.
6923 This command actually deletes articles. This is not a marking
6924 command. The article will disappear forever from your life, never to
6926 If N is negative, delete backwards.
6927 If N is nil and articles have been marked with the process mark,
6928 delete these instead."
6930 (gnus-set-global-variables)
6931 (unless (gnus-check-backend-function 'request-expire-articles
6932 gnus-newsgroup-name)
6933 (error "The current newsgroup does not support article deletion."))
6934 ;; Compute the list of articles to delete.
6935 (let ((articles (gnus-summary-work-articles n))
6937 (if (and gnus-novice-user
6938 (not (gnus-yes-or-no-p
6939 (format "Do you really want to delete %s forever? "
6940 (if (> (length articles) 1)
6941 (format "these %s articles" (length articles))
6944 ;; Delete the articles.
6945 (setq not-deleted (gnus-request-expire-articles
6946 articles gnus-newsgroup-name 'force))
6948 (gnus-summary-remove-process-mark (car articles))
6949 ;; The backend might not have been able to delete the article
6951 (unless (memq (car articles) not-deleted)
6952 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6953 (setq articles (cdr articles))))
6954 (gnus-summary-position-point)
6955 (gnus-set-mode-line 'summary)
6958 (defun gnus-summary-edit-article (&optional force)
6959 "Edit the current article.
6960 This will have permanent effect only in mail groups.
6961 If FORCE is non-nil, allow editing of articles even in read-only
6965 (set-buffer gnus-summary-buffer)
6966 (gnus-set-global-variables)
6967 (when (and (not force)
6968 (gnus-group-read-only-p))
6969 (error "The current newsgroup does not support article editing."))
6970 ;; Select article if needed.
6971 (unless (eq (gnus-summary-article-number)
6972 gnus-current-article)
6973 (gnus-summary-select-article t))
6974 (gnus-article-edit-article
6976 (gnus-summary-edit-article-done
6977 ,(or (mail-header-references gnus-current-headers) "")
6978 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6980 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6982 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6983 "Make edits to the current article permanent."
6985 ;; Replace the article.
6986 (if (and (not read-only)
6987 (not (gnus-request-replace-article
6988 (cdr gnus-article-current) (car gnus-article-current)
6990 (error "Couldn't replace article.")
6991 ;; Update the summary buffer.
6993 (equal (message-tokenize-header references " ")
6994 (message-tokenize-header
6995 (or (message-fetch-field "references") "") " ")))
6996 ;; We only have to update this line.
6999 (message-narrow-to-head)
7000 (let ((header (nnheader-parse-head t)))
7002 (mail-header-set-number header (cdr gnus-article-current))
7003 (gnus-summary-update-article-line
7004 (cdr gnus-article-current) header))))
7006 (set-buffer (or buffer gnus-summary-buffer))
7007 (gnus-summary-update-article (cdr gnus-article-current)))
7008 ;; Prettify the article buffer again.
7010 (set-buffer gnus-article-buffer)
7011 (run-hooks 'gnus-article-display-hook))
7012 ;; Prettify the summary buffer line.
7013 (when (gnus-visual-p 'summary-highlight 'highlight)
7014 (run-hooks 'gnus-visual-mark-article-hook))))
7016 (defun gnus-summary-edit-wash (key)
7017 "Perform editing command in the article buffer."
7021 (message "%s" (concat (this-command-keys) "- "))
7024 (gnus-summary-edit-article)
7025 (execute-kbd-macro (concat (this-command-keys) key))
7026 (gnus-article-edit-done))
7030 (defun gnus-summary-respool-query ()
7031 "Query where the respool algorithm would put this article."
7033 (gnus-set-global-variables)
7034 (gnus-summary-select-article)
7036 (set-buffer gnus-article-buffer)
7038 (goto-char (point-min))
7039 (search-forward "\n\n")
7040 (narrow-to-region (point-min) (point))
7041 (message "This message would go to %s"
7042 (mapconcat 'car (nnmail-article-group 'identity) ", ")))))
7044 ;; Summary marking commands.
7046 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7047 "Mark articles which has the same subject as read, and then select the next.
7048 If UNMARK is positive, remove any kind of mark.
7049 If UNMARK is negative, tick articles."
7051 (gnus-set-global-variables)
7053 (setq unmark (prefix-numeric-value unmark)))
7055 (gnus-summary-mark-same-subject
7056 (gnus-summary-article-subject) unmark)))
7057 ;; Select next unread article. If auto-select-same mode, should
7058 ;; select the first unread article.
7059 (gnus-summary-next-article t (and gnus-auto-select-same
7060 (gnus-summary-article-subject)))
7061 (gnus-message 7 "%d article%s marked as %s"
7062 count (if (= count 1) " is" "s are")
7063 (if unmark "unread" "read"))))
7065 (defun gnus-summary-kill-same-subject (&optional unmark)
7066 "Mark articles which has the same subject as read.
7067 If UNMARK is positive, remove any kind of mark.
7068 If UNMARK is negative, tick articles."
7070 (gnus-set-global-variables)
7072 (setq unmark (prefix-numeric-value unmark)))
7074 (gnus-summary-mark-same-subject
7075 (gnus-summary-article-subject) unmark)))
7076 ;; If marked as read, go to next unread subject.
7078 ;; Go to next unread subject.
7079 (gnus-summary-next-subject 1 t))
7080 (gnus-message 7 "%d articles are marked as %s"
7081 count (if unmark "unread" "read"))))
7083 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7084 "Mark articles with same SUBJECT as read, and return marked number.
7085 If optional argument UNMARK is positive, remove any kinds of marks.
7086 If optional argument UNMARK is negative, mark articles as unread instead."
7090 ((null unmark) ; Mark as read.
7093 (gnus-summary-mark-article-as-read gnus-killed-mark)
7094 (gnus-summary-show-thread) t)
7095 (gnus-summary-find-subject subject))
7096 (setq count (1+ count))))
7097 ((> unmark 0) ; Tick.
7100 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7101 (gnus-summary-show-thread) t)
7102 (gnus-summary-find-subject subject))
7103 (setq count (1+ count))))
7104 (t ; Mark as unread.
7107 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7108 (gnus-summary-show-thread) t)
7109 (gnus-summary-find-subject subject))
7110 (setq count (1+ count)))))
7111 (gnus-set-mode-line 'summary)
7112 ;; Return the number of marked articles.
7115 (defun gnus-summary-mark-as-processable (n &optional unmark)
7116 "Set the process mark on the next N articles.
7117 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7118 the process mark instead. The difference between N and the actual
7119 number of articles marked is returned."
7121 (gnus-set-global-variables)
7122 (let ((backward (< n 0))
7127 (gnus-summary-remove-process-mark
7128 (gnus-summary-article-number))
7129 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7130 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7133 (gnus-message 7 "No more articles"))
7134 (gnus-summary-recenter)
7135 (gnus-summary-position-point)
7138 (defun gnus-summary-unmark-as-processable (n)
7139 "Remove the process mark from the next N articles.
7140 If N is negative, mark backward instead. The difference between N and
7141 the actual number of articles marked is returned."
7143 (gnus-set-global-variables)
7144 (gnus-summary-mark-as-processable n t))
7146 (defun gnus-summary-unmark-all-processable ()
7147 "Remove the process mark from all articles."
7149 (gnus-set-global-variables)
7151 (while gnus-newsgroup-processable
7152 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7153 (gnus-summary-position-point))
7155 (defun gnus-summary-mark-as-expirable (n)
7156 "Mark N articles forward as expirable.
7157 If N is negative, mark backward instead. The difference between N and
7158 the actual number of articles marked is returned."
7160 (gnus-set-global-variables)
7161 (gnus-summary-mark-forward n gnus-expirable-mark))
7163 (defun gnus-summary-mark-article-as-replied (article)
7164 "Mark ARTICLE replied and update the summary line."
7165 (push article gnus-newsgroup-replied)
7166 (let ((buffer-read-only nil))
7167 (when (gnus-summary-goto-subject article)
7168 (gnus-summary-update-secondary-mark article))))
7170 (defun gnus-summary-set-bookmark (article)
7171 "Set a bookmark in current article."
7172 (interactive (list (gnus-summary-article-number)))
7173 (gnus-set-global-variables)
7174 (when (or (not (get-buffer gnus-article-buffer))
7175 (not gnus-current-article)
7176 (not gnus-article-current)
7177 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7178 (error "No current article selected"))
7179 ;; Remove old bookmark, if one exists.
7180 (let ((old (assq article gnus-newsgroup-bookmarks)))
7182 (setq gnus-newsgroup-bookmarks
7183 (delq old gnus-newsgroup-bookmarks))))
7184 ;; Set the new bookmark, which is on the form
7185 ;; (article-number . line-number-in-body).
7189 (set-buffer gnus-article-buffer)
7193 (goto-char (point-min))
7194 (search-forward "\n\n" nil t)
7197 gnus-newsgroup-bookmarks)
7198 (gnus-message 6 "A bookmark has been added to the current article."))
7200 (defun gnus-summary-remove-bookmark (article)
7201 "Remove the bookmark from the current article."
7202 (interactive (list (gnus-summary-article-number)))
7203 (gnus-set-global-variables)
7204 ;; Remove old bookmark, if one exists.
7205 (let ((old (assq article gnus-newsgroup-bookmarks)))
7208 (setq gnus-newsgroup-bookmarks
7209 (delq old gnus-newsgroup-bookmarks))
7210 (gnus-message 6 "Removed bookmark."))
7211 (gnus-message 6 "No bookmark in current article."))))
7213 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7214 (defun gnus-summary-mark-as-dormant (n)
7215 "Mark N articles forward as dormant.
7216 If N is negative, mark backward instead. The difference between N and
7217 the actual number of articles marked is returned."
7219 (gnus-set-global-variables)
7220 (gnus-summary-mark-forward n gnus-dormant-mark))
7222 (defun gnus-summary-set-process-mark (article)
7223 "Set the process mark on ARTICLE and update the summary line."
7224 (setq gnus-newsgroup-processable
7226 (delq article gnus-newsgroup-processable)))
7227 (when (gnus-summary-goto-subject article)
7228 (gnus-summary-show-thread)
7229 (gnus-summary-update-secondary-mark article)))
7231 (defun gnus-summary-remove-process-mark (article)
7232 "Remove the process mark from ARTICLE and update the summary line."
7233 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7234 (when (gnus-summary-goto-subject article)
7235 (gnus-summary-show-thread)
7236 (gnus-summary-update-secondary-mark article)))
7238 (defun gnus-summary-set-saved-mark (article)
7239 "Set the process mark on ARTICLE and update the summary line."
7240 (push article gnus-newsgroup-saved)
7241 (when (gnus-summary-goto-subject article)
7242 (gnus-summary-update-secondary-mark article)))
7244 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7245 "Mark N articles as read forwards.
7246 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7247 The difference between N and the actual number of articles marked is
7250 (gnus-set-global-variables)
7251 (let ((backward (< n 0))
7252 (gnus-summary-goto-unread
7253 (and gnus-summary-goto-unread
7254 (not (eq gnus-summary-goto-unread 'never))
7255 (not (memq mark (list gnus-unread-mark
7256 gnus-ticked-mark gnus-dormant-mark)))))
7258 (mark (or mark gnus-del-mark)))
7260 (gnus-summary-mark-article nil mark no-expire)
7261 (zerop (gnus-summary-next-subject
7263 (and gnus-summary-goto-unread
7264 (not (eq gnus-summary-goto-unread 'never)))
7268 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7269 (gnus-summary-recenter)
7270 (gnus-summary-position-point)
7271 (gnus-set-mode-line 'summary)
7274 (defun gnus-summary-mark-article-as-read (mark)
7275 "Mark the current article quickly as read with MARK."
7276 (let ((article (gnus-summary-article-number)))
7277 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7278 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7279 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7280 (push (cons article mark) gnus-newsgroup-reads)
7281 ;; Possibly remove from cache, if that is used.
7282 (when gnus-use-cache
7283 (gnus-cache-enter-remove-article article))
7284 ;; Allow the backend to change the mark.
7285 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7286 ;; Check for auto-expiry.
7287 (when (and gnus-newsgroup-auto-expire
7288 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7289 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7290 (= mark gnus-ancient-mark)
7291 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7292 (= mark gnus-duplicate-mark)))
7293 (setq mark gnus-expirable-mark)
7294 (push article gnus-newsgroup-expirable))
7295 ;; Set the mark in the buffer.
7296 (gnus-summary-update-mark mark 'unread)
7299 (defun gnus-summary-mark-article-as-unread (mark)
7300 "Mark the current article quickly as unread with MARK."
7301 (let ((article (gnus-summary-article-number)))
7303 (gnus-error 1 "Unmarkable article")
7304 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7305 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7306 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7307 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7308 (cond ((= mark gnus-ticked-mark)
7309 (push article gnus-newsgroup-marked))
7310 ((= mark gnus-dormant-mark)
7311 (push article gnus-newsgroup-dormant))
7313 (push article gnus-newsgroup-unreads)))
7314 (setq gnus-newsgroup-reads
7315 (delq (assq article gnus-newsgroup-reads)
7316 gnus-newsgroup-reads))
7318 ;; See whether the article is to be put in the cache.
7320 (vectorp (gnus-summary-article-header article))
7322 (gnus-cache-possibly-enter-article
7323 gnus-newsgroup-name article
7324 (gnus-summary-article-header article)
7325 (= mark gnus-ticked-mark)
7326 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7329 (gnus-summary-update-mark mark 'unread))
7332 (defun gnus-summary-mark-article (&optional article mark no-expire)
7333 "Mark ARTICLE with MARK. MARK can be any character.
7334 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7335 `??' (dormant) and `?E' (expirable).
7336 If MARK is nil, then the default character `?D' is used.
7337 If ARTICLE is nil, then the article on the current line will be
7339 ;; The mark might be a string.
7340 (when (stringp mark)
7341 (setq mark (aref mark 0)))
7342 ;; If no mark is given, then we check auto-expiring.
7343 (and (not no-expire)
7344 gnus-newsgroup-auto-expire
7346 (and (gnus-characterp mark)
7347 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7348 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7349 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7350 (= mark gnus-duplicate-mark))))
7351 (setq mark gnus-expirable-mark))
7352 (let* ((mark (or mark gnus-del-mark))
7353 (article (or article (gnus-summary-article-number))))
7355 (error "No article on current line"))
7356 (if (or (= mark gnus-unread-mark)
7357 (= mark gnus-ticked-mark)
7358 (= mark gnus-dormant-mark))
7359 (gnus-mark-article-as-unread article mark)
7360 (gnus-mark-article-as-read article mark))
7362 ;; See whether the article is to be put in the cache.
7364 (not (= mark gnus-canceled-mark))
7365 (vectorp (gnus-summary-article-header article))
7367 (gnus-cache-possibly-enter-article
7368 gnus-newsgroup-name article
7369 (gnus-summary-article-header article)
7370 (= mark gnus-ticked-mark)
7371 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7373 (when (gnus-summary-goto-subject article nil t)
7374 (let ((buffer-read-only nil))
7375 (gnus-summary-show-thread)
7377 (gnus-summary-update-mark mark 'unread)
7380 (defun gnus-summary-update-secondary-mark (article)
7381 "Update the secondary (read, process, cache) mark."
7382 (gnus-summary-update-mark
7383 (cond ((memq article gnus-newsgroup-processable)
7385 ((memq article gnus-newsgroup-cached)
7387 ((memq article gnus-newsgroup-replied)
7389 ((memq article gnus-newsgroup-saved)
7391 (t gnus-unread-mark))
7393 (when (gnus-visual-p 'summary-highlight 'highlight)
7394 (run-hooks 'gnus-summary-update-hook))
7397 (defun gnus-summary-update-mark (mark type)
7398 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7399 (buffer-read-only nil))
7400 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7401 (when (looking-at "\r")
7404 (<= (+ forward (point)) (point-max)))
7405 ;; Go to the right position on the line.
7406 (goto-char (+ forward (point)))
7407 ;; Replace the old mark with the new mark.
7408 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7409 ;; Optionally update the marks by some user rule.
7410 (when (eq type 'unread)
7412 (gnus-data-find (gnus-summary-article-number)) mark)
7413 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7415 (defun gnus-mark-article-as-read (article &optional mark)
7416 "Enter ARTICLE in the pertinent lists and remove it from others."
7417 ;; Make the article expirable.
7418 (let ((mark (or mark gnus-del-mark)))
7419 (if (= mark gnus-expirable-mark)
7420 (push article gnus-newsgroup-expirable)
7421 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7422 ;; Remove from unread and marked lists.
7423 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7424 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7425 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7426 (push (cons article mark) gnus-newsgroup-reads)
7427 ;; Possibly remove from cache, if that is used.
7428 (when gnus-use-cache
7429 (gnus-cache-enter-remove-article article))))
7431 (defun gnus-mark-article-as-unread (article &optional mark)
7432 "Enter ARTICLE in the pertinent lists and remove it from others."
7433 (let ((mark (or mark gnus-ticked-mark)))
7434 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7435 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7436 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7437 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7439 ;; Unsuppress duplicates?
7440 (when gnus-suppress-duplicates
7441 (gnus-dup-unsuppress-article article))
7443 (cond ((= mark gnus-ticked-mark)
7444 (push article gnus-newsgroup-marked))
7445 ((= mark gnus-dormant-mark)
7446 (push article gnus-newsgroup-dormant))
7448 (push article gnus-newsgroup-unreads)))
7449 (setq gnus-newsgroup-reads
7450 (delq (assq article gnus-newsgroup-reads)
7451 gnus-newsgroup-reads))))
7453 (defalias 'gnus-summary-mark-as-unread-forward
7454 'gnus-summary-tick-article-forward)
7455 (make-obsolete 'gnus-summary-mark-as-unread-forward
7456 'gnus-summary-tick-article-forward)
7457 (defun gnus-summary-tick-article-forward (n)
7458 "Tick N articles forwards.
7459 If N is negative, tick backwards instead.
7460 The difference between N and the number of articles ticked is returned."
7462 (gnus-summary-mark-forward n gnus-ticked-mark))
7464 (defalias 'gnus-summary-mark-as-unread-backward
7465 'gnus-summary-tick-article-backward)
7466 (make-obsolete 'gnus-summary-mark-as-unread-backward
7467 'gnus-summary-tick-article-backward)
7468 (defun gnus-summary-tick-article-backward (n)
7469 "Tick N articles backwards.
7470 The difference between N and the number of articles ticked is returned."
7472 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7474 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7475 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7476 (defun gnus-summary-tick-article (&optional article clear-mark)
7477 "Mark current article as unread.
7478 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7479 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7481 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7484 (defun gnus-summary-mark-as-read-forward (n)
7485 "Mark N articles as read forwards.
7486 If N is negative, mark backwards instead.
7487 The difference between N and the actual number of articles marked is
7490 (gnus-summary-mark-forward n gnus-del-mark t))
7492 (defun gnus-summary-mark-as-read-backward (n)
7493 "Mark the N articles as read backwards.
7494 The difference between N and the actual number of articles marked is
7497 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7499 (defun gnus-summary-mark-as-read (&optional article mark)
7500 "Mark current article as read.
7501 ARTICLE specifies the article to be marked as read.
7502 MARK specifies a string to be inserted at the beginning of the line."
7503 (gnus-summary-mark-article article mark))
7505 (defun gnus-summary-clear-mark-forward (n)
7506 "Clear marks from N articles forward.
7507 If N is negative, clear backward instead.
7508 The difference between N and the number of marks cleared is returned."
7510 (gnus-summary-mark-forward n gnus-unread-mark))
7512 (defun gnus-summary-clear-mark-backward (n)
7513 "Clear marks from N articles backward.
7514 The difference between N and the number of marks cleared is returned."
7516 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7518 (defun gnus-summary-mark-unread-as-read ()
7519 "Intended to be used by `gnus-summary-mark-article-hook'."
7520 (when (memq gnus-current-article gnus-newsgroup-unreads)
7521 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7523 (defun gnus-summary-mark-read-and-unread-as-read ()
7524 "Intended to be used by `gnus-summary-mark-article-hook'."
7525 (let ((mark (gnus-summary-article-mark)))
7526 (when (or (gnus-unread-mark-p mark)
7527 (gnus-read-mark-p mark))
7528 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7530 (defun gnus-summary-mark-region-as-read (point mark all)
7531 "Mark all unread articles between point and mark as read.
7532 If given a prefix, mark all articles between point and mark as read,
7533 even ticked and dormant ones."
7534 (interactive "r\nP")
7543 (memq (setq article (gnus-summary-article-number))
7544 gnus-newsgroup-unreads))
7545 (gnus-summary-mark-article article gnus-del-mark))
7547 (gnus-summary-find-next))))))
7549 (defun gnus-summary-mark-below (score mark)
7550 "Mark articles with score less than SCORE with MARK."
7551 (interactive "P\ncMark: ")
7552 (gnus-set-global-variables)
7553 (setq score (if score
7554 (prefix-numeric-value score)
7555 (or gnus-summary-default-score 0)))
7557 (set-buffer gnus-summary-buffer)
7558 (goto-char (point-min))
7561 (and (< (gnus-summary-article-score) score)
7562 (gnus-summary-mark-article nil mark))
7563 (gnus-summary-find-next)))))
7565 (defun gnus-summary-kill-below (&optional score)
7566 "Mark articles with score below SCORE as read."
7568 (gnus-set-global-variables)
7569 (gnus-summary-mark-below score gnus-killed-mark))
7571 (defun gnus-summary-clear-above (&optional score)
7572 "Clear all marks from articles with score above SCORE."
7574 (gnus-set-global-variables)
7575 (gnus-summary-mark-above score gnus-unread-mark))
7577 (defun gnus-summary-tick-above (&optional score)
7578 "Tick all articles with score above SCORE."
7580 (gnus-set-global-variables)
7581 (gnus-summary-mark-above score gnus-ticked-mark))
7583 (defun gnus-summary-mark-above (score mark)
7584 "Mark articles with score over SCORE with MARK."
7585 (interactive "P\ncMark: ")
7586 (gnus-set-global-variables)
7587 (setq score (if score
7588 (prefix-numeric-value score)
7589 (or gnus-summary-default-score 0)))
7591 (set-buffer gnus-summary-buffer)
7592 (goto-char (point-min))
7594 (when (> (gnus-summary-article-score) score)
7595 (gnus-summary-mark-article nil mark))
7597 (gnus-summary-find-next)))))
7599 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7600 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7601 (defun gnus-summary-limit-include-expunged (&optional no-error)
7602 "Display all the hidden articles that were expunged for low scores."
7604 (gnus-set-global-variables)
7605 (let ((buffer-read-only nil))
7606 (let ((scored gnus-newsgroup-scored)
7609 (unless (gnus-summary-goto-subject (caar scored))
7610 (and (setq h (gnus-summary-article-header (caar scored)))
7611 (< (cdar scored) gnus-summary-expunge-below)
7613 (setq scored (cdr scored)))
7615 (when (not no-error)
7616 (error "No expunged articles hidden."))
7617 (goto-char (point-min))
7618 (gnus-summary-prepare-unthreaded (nreverse headers))
7619 (goto-char (point-min))
7620 (gnus-summary-position-point)
7623 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7624 "Mark all unread articles in this newsgroup as read.
7625 If prefix argument ALL is non-nil, ticked and dormant articles will
7626 also be marked as read.
7627 If QUIETLY is non-nil, no questions will be asked.
7628 If TO-HERE is non-nil, it should be a point in the buffer. All
7629 articles before this point will be marked as read.
7630 Note that this function will only catch up the unread article
7631 in the current summary buffer limitation.
7632 The number of articles marked as read is returned."
7634 (gnus-set-global-variables)
7638 (not gnus-interactive-catchup) ;Without confirmation?
7642 "Mark absolutely all articles as read? "
7643 "Mark all unread articles as read? ")))
7645 (not gnus-newsgroup-adaptive)
7646 (not gnus-newsgroup-auto-expire)
7647 (not gnus-suppress-duplicates))
7650 (setq gnus-newsgroup-marked nil
7651 gnus-newsgroup-dormant nil))
7652 (setq gnus-newsgroup-unreads nil))
7653 ;; We actually mark all articles as canceled, which we
7654 ;; have to do when using auto-expiry or adaptive scoring.
7655 (gnus-summary-show-all-threads)
7656 (when (gnus-summary-first-subject (not all))
7658 (if to-here (< (point) to-here) t)
7659 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7660 (gnus-summary-find-next (not all)))))
7661 (gnus-set-mode-line 'summary))
7663 (gnus-summary-position-point)))
7665 (defun gnus-summary-catchup-to-here (&optional all)
7666 "Mark all unticked articles before the current one as read.
7667 If ALL is non-nil, also mark ticked and dormant articles as read."
7669 (gnus-set-global-variables)
7671 (gnus-save-hidden-threads
7672 (let ((beg (point)))
7673 ;; We check that there are unread articles.
7674 (when (or all (gnus-summary-find-prev))
7675 (gnus-summary-catchup all t beg)))))
7676 (gnus-summary-position-point))
7678 (defun gnus-summary-catchup-all (&optional quietly)
7679 "Mark all articles in this newsgroup as read."
7681 (gnus-set-global-variables)
7682 (gnus-summary-catchup t quietly))
7684 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7685 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7686 If prefix argument ALL is non-nil, all articles are marked as read."
7688 (gnus-set-global-variables)
7689 (when (gnus-summary-catchup all quietly nil 'fast)
7690 ;; Select next newsgroup or exit.
7691 (if (eq gnus-auto-select-next 'quietly)
7692 (gnus-summary-next-group nil)
7693 (gnus-summary-exit))))
7695 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7696 "Mark all articles in this newsgroup as read, and then exit."
7698 (gnus-set-global-variables)
7699 (gnus-summary-catchup-and-exit t quietly))
7701 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7702 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7703 "Mark all articles in this group as read and select the next group.
7704 If given a prefix, mark all articles, unread as well as ticked, as
7707 (gnus-set-global-variables)
7709 (gnus-summary-catchup all))
7710 (gnus-summary-next-article t nil nil t))
7712 ;; Thread-based commands.
7714 (defun gnus-summary-articles-in-thread (&optional article)
7715 "Return a list of all articles in the current thread.
7716 If ARTICLE is non-nil, return all articles in the thread that starts
7718 (let* ((article (or article (gnus-summary-article-number)))
7719 (data (gnus-data-find-list article))
7720 (top-level (gnus-data-level (car data)))
7722 (cond ((null gnus-thread-operation-ignore-subject)
7723 (gnus-simplify-subject-re
7724 (mail-header-subject (gnus-data-header (car data)))))
7725 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7726 (gnus-simplify-subject-fuzzy
7727 (mail-header-subject (gnus-data-header (car data)))))
7729 (end-point (save-excursion
7730 (if (gnus-summary-go-to-next-thread)
7731 (point) (point-max))))
7734 (< (gnus-data-pos (car data)) end-point))
7735 (when (or (not top-subject)
7736 (string= top-subject
7737 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7738 (gnus-simplify-subject-fuzzy
7739 (mail-header-subject
7740 (gnus-data-header (car data))))
7741 (gnus-simplify-subject-re
7742 (mail-header-subject
7743 (gnus-data-header (car data)))))))
7744 (push (gnus-data-number (car data)) articles))
7745 (unless (and (setq data (cdr data))
7746 (> (gnus-data-level (car data)) top-level))
7748 ;; Return the list of articles.
7749 (nreverse articles)))
7751 (defun gnus-summary-rethread-current ()
7752 "Rethread the thread the current article is part of."
7754 (gnus-set-global-variables)
7755 (let* ((gnus-show-threads t)
7756 (article (gnus-summary-article-number))
7757 (id (mail-header-id (gnus-summary-article-header)))
7758 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7760 (error "No article on the current line"))
7761 (gnus-rebuild-thread id)
7762 (gnus-summary-goto-subject article)))
7764 (defun gnus-summary-reparent-thread ()
7765 "Make current article child of the marked (or previous) article.
7767 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7768 is non-nil or the Subject: of both articles are the same."
7770 (unless (not (gnus-group-read-only-p))
7771 (error "The current newsgroup does not support article editing."))
7772 (unless (<= (length gnus-newsgroup-processable) 1)
7773 (error "No more than one article may be marked."))
7774 (save-window-excursion
7775 (let ((gnus-article-buffer " *reparent*")
7776 (current-article (gnus-summary-article-number))
7777 ; first grab the marked article, otherwise one line up.
7778 (parent-article (if (not (null gnus-newsgroup-processable))
7779 (car gnus-newsgroup-processable)
7781 (if (eq (forward-line -1) 0)
7782 (gnus-summary-article-number)
7783 (error "Beginning of summary buffer."))))))
7784 (unless (not (eq current-article parent-article))
7785 (error "An article may not be self-referential."))
7786 (let ((message-id (mail-header-id
7787 (gnus-summary-article-header parent-article))))
7788 (unless (and message-id (not (equal message-id "")))
7789 (error "No message-id in desired parent."))
7790 (gnus-summary-select-article t t nil current-article)
7791 (set-buffer gnus-article-buffer)
7792 (setq buffer-read-only nil)
7793 (let ((buf (format "%s" (buffer-string))))
7796 (goto-char (point-min))
7797 (if (search-forward-regexp "^References: " nil t)
7798 (insert message-id " " )
7799 (insert "References: " message-id "\n"))
7800 (unless (gnus-request-replace-article current-article
7801 (car gnus-article-current)
7802 gnus-article-buffer)
7803 (error "Couldn't replace article."))
7804 (set-buffer gnus-summary-buffer)
7805 (gnus-summary-unmark-all-processable)
7806 (gnus-summary-rethread-current)
7807 (gnus-message 3 "Article %d is now the child of article %d."
7808 current-article parent-article)))))
7810 (defun gnus-summary-toggle-threads (&optional arg)
7811 "Toggle showing conversation threads.
7812 If ARG is positive number, turn showing conversation threads on."
7814 (gnus-set-global-variables)
7815 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7816 (setq gnus-show-threads
7817 (if (null arg) (not gnus-show-threads)
7818 (> (prefix-numeric-value arg) 0)))
7819 (gnus-summary-prepare)
7820 (gnus-summary-goto-subject current)
7821 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7822 (gnus-summary-position-point)))
7824 (defun gnus-summary-show-all-threads ()
7827 (gnus-set-global-variables)
7829 (let ((buffer-read-only nil))
7830 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7831 (gnus-summary-position-point))
7833 (defun gnus-summary-show-thread ()
7834 "Show thread subtrees.
7835 Returns nil if no thread was there to be shown."
7837 (gnus-set-global-variables)
7838 (let ((buffer-read-only nil)
7840 ;; first goto end then to beg, to have point at beg after let
7841 (end (progn (end-of-line) (point)))
7842 (beg (progn (beginning-of-line) (point))))
7844 ;; Any hidden lines here?
7845 (search-forward "\r" end t)
7846 (subst-char-in-region beg end ?\^M ?\n t)
7848 (gnus-summary-position-point))))
7850 (defun gnus-summary-hide-all-threads ()
7851 "Hide all thread subtrees."
7853 (gnus-set-global-variables)
7855 (goto-char (point-min))
7856 (gnus-summary-hide-thread)
7857 (while (zerop (gnus-summary-next-thread 1 t))
7858 (gnus-summary-hide-thread)))
7859 (gnus-summary-position-point))
7861 (defun gnus-summary-hide-thread ()
7862 "Hide thread subtrees.
7863 Returns nil if no threads were there to be hidden."
7865 (gnus-set-global-variables)
7866 (let ((buffer-read-only nil)
7868 (article (gnus-summary-article-number)))
7870 ;; Go forward until either the buffer ends or the subthread
7872 (when (and (not (eobp))
7873 (or (zerop (gnus-summary-next-thread 1 t))
7874 (goto-char (point-max))))
7876 (if (and (> (point) start)
7877 (search-backward "\n" start t))
7879 (subst-char-in-region start (point) ?\n ?\^M)
7880 (gnus-summary-goto-subject article))
7883 ;;(gnus-summary-position-point)
7886 (defun gnus-summary-go-to-next-thread (&optional previous)
7887 "Go to the same level (or less) next thread.
7888 If PREVIOUS is non-nil, go to previous thread instead.
7889 Return the article number moved to, or nil if moving was impossible."
7890 (let ((level (gnus-summary-thread-level))
7891 (way (if previous -1 1))
7894 (while (and (not (eobp))
7895 (< level (gnus-summary-thread-level)))
7903 (gnus-summary-article-number)
7906 (defun gnus-summary-next-thread (n &optional silent)
7907 "Go to the same level next N'th thread.
7908 If N is negative, search backward instead.
7909 Returns the difference between N and the number of skips actually
7912 If SILENT, don't output messages."
7914 (gnus-set-global-variables)
7915 (let ((backward (< n 0))
7918 (gnus-summary-go-to-next-thread backward))
7921 (gnus-summary-position-point))
7922 (when (and (not silent) (/= 0 n))
7923 (gnus-message 7 "No more threads"))
7926 (defun gnus-summary-prev-thread (n)
7927 "Go to the same level previous N'th thread.
7928 Returns the difference between N and the number of skips actually
7931 (gnus-set-global-variables)
7932 (gnus-summary-next-thread (- n)))
7934 (defun gnus-summary-go-down-thread ()
7935 "Go down one level in the current thread."
7936 (let ((children (gnus-summary-article-children)))
7938 (gnus-summary-goto-subject (car children)))))
7940 (defun gnus-summary-go-up-thread ()
7941 "Go up one level in the current thread."
7942 (let ((parent (gnus-summary-article-parent)))
7944 (gnus-summary-goto-subject parent))))
7946 (defun gnus-summary-down-thread (n)
7947 "Go down thread N steps.
7948 If N is negative, go up instead.
7949 Returns the difference between N and how many steps down that were
7952 (gnus-set-global-variables)
7956 (if up (gnus-summary-go-up-thread)
7957 (gnus-summary-go-down-thread)))
7959 (gnus-summary-position-point)
7961 (gnus-message 7 "Can't go further"))
7964 (defun gnus-summary-up-thread (n)
7965 "Go up thread N steps.
7966 If N is negative, go up instead.
7967 Returns the difference between N and how many steps down that were
7970 (gnus-set-global-variables)
7971 (gnus-summary-down-thread (- n)))
7973 (defun gnus-summary-top-thread ()
7974 "Go to the top of the thread."
7976 (gnus-set-global-variables)
7977 (while (gnus-summary-go-up-thread))
7978 (gnus-summary-article-number))
7980 (defun gnus-summary-kill-thread (&optional unmark)
7981 "Mark articles under current thread as read.
7982 If the prefix argument is positive, remove any kinds of marks.
7983 If the prefix argument is negative, tick articles instead."
7985 (gnus-set-global-variables)
7987 (setq unmark (prefix-numeric-value unmark)))
7988 (let ((articles (gnus-summary-articles-in-thread)))
7990 ;; Expand the thread.
7991 (gnus-summary-show-thread)
7992 ;; Mark all the articles.
7994 (gnus-summary-goto-subject (car articles))
7995 (cond ((null unmark)
7996 (gnus-summary-mark-article-as-read gnus-killed-mark))
7998 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8000 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8001 (setq articles (cdr articles))))
8002 ;; Hide killed subtrees.
8004 gnus-thread-hide-killed
8005 (gnus-summary-hide-thread))
8006 ;; If marked as read, go to next unread subject.
8008 ;; Go to next unread subject.
8009 (gnus-summary-next-subject 1 t)))
8010 (gnus-set-mode-line 'summary))
8012 ;; Summary sorting commands
8014 (defun gnus-summary-sort-by-number (&optional reverse)
8015 "Sort the summary buffer by article number.
8016 Argument REVERSE means reverse order."
8018 (gnus-summary-sort 'number reverse))
8020 (defun gnus-summary-sort-by-author (&optional reverse)
8021 "Sort the summary buffer by author name alphabetically.
8022 If case-fold-search is non-nil, case of letters is ignored.
8023 Argument REVERSE means reverse order."
8025 (gnus-summary-sort 'author reverse))
8027 (defun gnus-summary-sort-by-subject (&optional reverse)
8028 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8029 If case-fold-search is non-nil, case of letters is ignored.
8030 Argument REVERSE means reverse order."
8032 (gnus-summary-sort 'subject reverse))
8034 (defun gnus-summary-sort-by-date (&optional reverse)
8035 "Sort the summary buffer by date.
8036 Argument REVERSE means reverse order."
8038 (gnus-summary-sort 'date reverse))
8040 (defun gnus-summary-sort-by-score (&optional reverse)
8041 "Sort the summary buffer by score.
8042 Argument REVERSE means reverse order."
8044 (gnus-summary-sort 'score reverse))
8046 (defun gnus-summary-sort-by-lines (&optional reverse)
8047 "Sort the summary buffer by article length.
8048 Argument REVERSE means reverse order."
8050 (gnus-summary-sort 'lines reverse))
8052 (defun gnus-summary-sort (predicate reverse)
8053 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8054 (gnus-set-global-variables)
8055 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8056 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8057 (gnus-thread-sort-functions
8063 (gnus-article-sort-functions
8068 (,article t2 t1)))))
8070 (gnus-summary-prepare-hook nil))
8071 ;; We do the sorting by regenerating the threads.
8072 (gnus-summary-prepare)
8073 ;; Hide subthreads if needed.
8074 (when (and gnus-show-threads gnus-thread-hide-subtree)
8075 (gnus-summary-hide-all-threads))))
8077 ;; Summary saving commands.
8079 (defun gnus-summary-save-article (&optional n not-saved)
8080 "Save the current article using the default saver function.
8081 If N is a positive number, save the N next articles.
8082 If N is a negative number, save the N previous articles.
8083 If N is nil and any articles have been marked with the process mark,
8084 save those articles instead.
8085 The variable `gnus-default-article-saver' specifies the saver function."
8087 (gnus-set-global-variables)
8088 (let* ((articles (gnus-summary-work-articles n))
8089 (save-buffer (save-excursion
8090 (nnheader-set-temp-buffer " *Gnus Save*")))
8091 (num (length articles))
8092 header article file)
8094 (setq header (gnus-summary-article-header
8095 (setq article (pop articles))))
8096 (if (not (vectorp header))
8097 ;; This is a pseudo-article.
8098 (if (assq 'name header)
8099 (gnus-copy-file (cdr (assq 'name header)))
8100 (gnus-message 1 "Article %d is unsaveable" article))
8101 ;; This is a real article.
8102 (save-window-excursion
8103 (gnus-summary-select-article t nil nil article))
8105 (set-buffer save-buffer)
8107 (insert-buffer-substring gnus-original-article-buffer))
8108 (setq file (gnus-article-save save-buffer file num))
8109 (gnus-summary-remove-process-mark article)
8111 (gnus-summary-set-saved-mark article))))
8112 (gnus-kill-buffer save-buffer)
8113 (gnus-summary-position-point)
8114 (gnus-set-mode-line 'summary)
8117 (defun gnus-summary-pipe-output (&optional arg)
8118 "Pipe the current article to a subprocess.
8119 If N is a positive number, pipe the N next articles.
8120 If N is a negative number, pipe the N previous articles.
8121 If N is nil and any articles have been marked with the process mark,
8122 pipe those articles instead."
8124 (gnus-set-global-variables)
8125 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8126 (gnus-summary-save-article arg t))
8127 (gnus-configure-windows 'pipe))
8129 (defun gnus-summary-save-article-mail (&optional arg)
8130 "Append the current article to an mail file.
8131 If N is a positive number, save the N next articles.
8132 If N is a negative number, save the N previous articles.
8133 If N is nil and any articles have been marked with the process mark,
8134 save those articles instead."
8136 (gnus-set-global-variables)
8137 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8138 (gnus-summary-save-article arg)))
8140 (defun gnus-summary-save-article-rmail (&optional arg)
8141 "Append the current article to an rmail file.
8142 If N is a positive number, save the N next articles.
8143 If N is a negative number, save the N previous articles.
8144 If N is nil and any articles have been marked with the process mark,
8145 save those articles instead."
8147 (gnus-set-global-variables)
8148 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8149 (gnus-summary-save-article arg)))
8151 (defun gnus-summary-save-article-file (&optional arg)
8152 "Append the current article to a file.
8153 If N is a positive number, save the N next articles.
8154 If N is a negative number, save the N previous articles.
8155 If N is nil and any articles have been marked with the process mark,
8156 save those articles instead."
8158 (gnus-set-global-variables)
8159 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8160 (gnus-summary-save-article arg)))
8162 (defun gnus-summary-write-article-file (&optional arg)
8163 "Write the current article to a file, deleting the previous file.
8164 If N is a positive number, save the N next articles.
8165 If N is a negative number, save the N previous articles.
8166 If N is nil and any articles have been marked with the process mark,
8167 save those articles instead."
8169 (gnus-set-global-variables)
8170 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8171 (gnus-summary-save-article arg)))
8173 (defun gnus-summary-save-article-body-file (&optional arg)
8174 "Append the current article body to a file.
8175 If N is a positive number, save the N next articles.
8176 If N is a negative number, save the N previous articles.
8177 If N is nil and any articles have been marked with the process mark,
8178 save those articles instead."
8180 (gnus-set-global-variables)
8181 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8182 (gnus-summary-save-article arg)))
8184 (defun gnus-get-split-value (methods)
8185 "Return a value based on the split METHODS."
8186 (let (split-name method result match)
8189 (set-buffer gnus-original-article-buffer)
8191 (nnheader-narrow-to-headers)
8193 (goto-char (point-min))
8194 (setq method (pop methods))
8195 (setq match (car method))
8198 ;; Regular expression.
8200 (re-search-forward match nil t)))
8201 ((gnus-functionp match)
8205 (setq result (funcall match gnus-newsgroup-name))))
8210 (setq result (eval match)))))
8211 (setq split-name (append (cdr method) split-name))
8212 (cond ((stringp result)
8213 (push (expand-file-name
8214 result gnus-article-save-directory)
8217 (setq split-name (append result split-name)))))))))
8220 (defun gnus-valid-move-group-p (group)
8225 (car (gnus-find-method-for-group
8226 (symbol-name group))))
8227 gnus-valid-select-methods))))
8229 (defun gnus-read-move-group-name (prompt default articles prefix)
8230 "Read a group name."
8231 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8232 (minibuffer-confirm-incomplete nil) ; XEmacs
8236 (if (> (length articles) 1)
8237 (format "these %d articles" (length articles))
8242 (gnus-completing-read default prom
8244 'gnus-valid-move-group-p
8246 'gnus-group-history))
8247 ((= 1 (length split-name))
8248 (gnus-completing-read (car split-name) prom
8250 'gnus-valid-move-group-p
8252 'gnus-group-history))
8254 (gnus-completing-read nil prom
8255 (mapcar (lambda (el) (list el))
8256 (nreverse split-name))
8258 'gnus-group-history)))))
8260 (if (or (string= to-newsgroup "")
8261 (string= to-newsgroup prefix))
8262 (setq to-newsgroup (or default "")))
8263 (or (gnus-active to-newsgroup)
8264 (gnus-activate-group to-newsgroup)
8265 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8267 (or (and (gnus-request-create-group
8268 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8269 (gnus-activate-group to-newsgroup nil nil
8270 (gnus-group-name-to-method
8272 (error "Couldn't create group %s" to-newsgroup)))
8273 (error "No such group: %s" to-newsgroup)))
8276 ;; Summary extract commands
8278 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8279 (let ((buffer-read-only nil)
8280 (article (gnus-summary-article-number))
8282 (unless (gnus-summary-goto-subject article)
8283 (error "No such article: %d" article))
8284 (gnus-summary-position-point)
8285 ;; If all commands are to be bunched up on one line, we collect
8287 (unless gnus-view-pseudos-separately
8288 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8291 (setq action (cdr (assq 'action (car ps))))
8292 (setq files (list (cdr (assq 'name (car ps)))))
8293 (while (and ps (cdr ps)
8294 (string= (or action "1")
8295 (or (cdr (assq 'action (cadr ps))) "2")))
8296 (push (cdr (assq 'name (cadr ps))) files)
8297 (setcdr ps (cddr ps)))
8299 (when (not (string-match "%s" action))
8302 (when (assq 'execute (car ps))
8303 (setcdr (assq 'execute (car ps))
8304 (funcall (if (string-match "%s" action)
8307 (mapconcat (lambda (f) f) files " ")))))
8308 (setq ps (cdr ps)))))
8309 (if (and gnus-view-pseudos (not not-view))
8311 (when (assq 'execute (car pslist))
8312 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8313 (eq gnus-view-pseudos 'not-confirm)))
8314 (setq pslist (cdr pslist)))
8317 (setq after-article (or (cdr (assq 'article (car pslist)))
8318 (gnus-summary-article-number)))
8319 (gnus-summary-goto-subject after-article)
8322 (insert " " (file-name-nondirectory
8323 (cdr (assq 'name (car pslist))))
8324 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8326 (forward-line -1) ; back to `b'
8327 (gnus-add-text-properties
8328 b (1- e) (list 'gnus-number gnus-reffed-article-number
8329 gnus-mouse-face-prop gnus-mouse-face))
8331 after-article gnus-reffed-article-number
8332 gnus-unread-mark b (car pslist) 0 (- e b))
8333 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8334 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8335 (setq pslist (cdr pslist)))))))
8337 (defun gnus-pseudos< (p1 p2)
8338 (let ((c1 (cdr (assq 'action p1)))
8339 (c2 (cdr (assq 'action p2))))
8340 (and c1 c2 (string< c1 c2))))
8342 (defun gnus-request-pseudo-article (props)
8343 (cond ((assq 'execute props)
8344 (gnus-execute-command (cdr (assq 'execute props)))))
8345 (let ((gnus-current-article (gnus-summary-article-number)))
8346 (run-hooks 'gnus-mark-article-hook)))
8348 (defun gnus-execute-command (command &optional automatic)
8350 (gnus-article-setup-buffer)
8351 (set-buffer gnus-article-buffer)
8352 (setq buffer-read-only nil)
8353 (let ((command (if automatic command (read-string "Command: " command)))
8354 ;; Just binding this here doesn't help, because there might
8355 ;; be output from the process after exiting the scope of
8357 ;; (buffer-read-only nil)
8360 (insert "$ " command "\n\n")
8361 (if gnus-view-pseudo-asynchronously
8362 (start-process "gnus-execute" nil shell-file-name
8363 shell-command-switch command)
8364 (call-process shell-file-name nil t nil
8365 shell-command-switch command)))))
8367 ;; Summary kill commands.
8369 (defun gnus-summary-edit-global-kill (article)
8370 "Edit the \"global\" kill file."
8371 (interactive (list (gnus-summary-article-number)))
8372 (gnus-set-global-variables)
8373 (gnus-group-edit-global-kill article))
8375 (defun gnus-summary-edit-local-kill ()
8376 "Edit a local kill file applied to the current newsgroup."
8378 (gnus-set-global-variables)
8379 (setq gnus-current-headers (gnus-summary-article-header))
8380 (gnus-set-global-variables)
8381 (gnus-group-edit-local-kill
8382 (gnus-summary-article-number) gnus-newsgroup-name))
8386 (defun gnus-read-header (id &optional header)
8387 "Read the headers of article ID and enter them into the Gnus system."
8388 (let ((group gnus-newsgroup-name)
8389 (gnus-override-method
8390 (and (gnus-news-group-p gnus-newsgroup-name)
8391 gnus-refer-article-method))
8393 ;; First we check to see whether the header in question is already
8396 ;; This is a Message-ID.
8397 (setq header (or header (gnus-id-to-header id)))
8398 ;; This is an article number.
8399 (setq header (or header (gnus-summary-article-header id))))
8401 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8402 ;; We have found the header.
8404 ;; We have to really fetch the header to this article.
8406 (set-buffer nntp-server-buffer)
8407 (when (setq where (gnus-request-head id group))
8408 (nnheader-fold-continuation-lines)
8409 (goto-char (point-max))
8411 (goto-char (point-min))
8415 ((cdr where) (cdr where))
8416 (header (mail-header-number header))
8417 (t gnus-reffed-article-number))
8419 (insert " Article retrieved.\n"))
8420 (if (not (setq header (car (gnus-get-newsgroup-headers nil t))))
8421 () ; Malformed head.
8422 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8423 (when (and (stringp id)
8424 (not (string= (gnus-group-real-name group)
8426 ;; If we fetched by Message-ID and the article came
8427 ;; from a different group, we fudge some bogus article
8428 ;; numbers for this article.
8429 (mail-header-set-number header gnus-reffed-article-number))
8431 (set-buffer gnus-summary-buffer)
8432 (decf gnus-reffed-article-number)
8433 (gnus-remove-header (mail-header-number header))
8434 (push header gnus-newsgroup-headers)
8435 (setq gnus-current-headers header)
8436 (push (mail-header-number header) gnus-newsgroup-limit)))
8439 (defun gnus-remove-header (number)
8440 "Remove header NUMBER from `gnus-newsgroup-headers'."
8441 (if (and gnus-newsgroup-headers
8442 (= number (mail-header-number (car gnus-newsgroup-headers))))
8443 (pop gnus-newsgroup-headers)
8444 (let ((headers gnus-newsgroup-headers))
8445 (while (and (cdr headers)
8446 (not (= number (mail-header-number (cadr headers)))))
8449 (setcdr headers (cddr headers))))))
8452 ;;; summary highlights
8455 (defun gnus-highlight-selected-summary ()
8456 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8457 ;; Highlight selected article in summary buffer
8458 (when gnus-summary-selected-face
8460 (let* ((beg (progn (beginning-of-line) (point)))
8461 (end (progn (end-of-line) (point)))
8462 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8463 (from (if (get-text-property beg gnus-mouse-face-prop)
8465 (or (next-single-property-change
8466 beg gnus-mouse-face-prop nil end)
8471 (or (next-single-property-change
8472 from gnus-mouse-face-prop nil end)
8474 ;; If no mouse-face prop on line we will have to = from = end,
8475 ;; so we highlight the entire line instead.
8476 (when (= (+ to 2) from)
8479 (if gnus-newsgroup-selected-overlay
8480 ;; Move old overlay.
8482 gnus-newsgroup-selected-overlay from to (current-buffer))
8483 ;; Create new overlay.
8485 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8486 'face gnus-summary-selected-face))))))
8488 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8489 (defun gnus-summary-highlight-line ()
8490 "Highlight current line according to `gnus-summary-highlight'."
8491 (let* ((list gnus-summary-highlight)
8493 (end (progn (end-of-line) (point)))
8494 ;; now find out where the line starts and leave point there.
8495 (beg (progn (beginning-of-line) (point)))
8496 (article (gnus-summary-article-number))
8497 (score (or (cdr (assq (or article gnus-current-article)
8498 gnus-newsgroup-scored))
8499 gnus-summary-default-score 0))
8500 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8501 (inhibit-read-only t))
8502 ;; Eval the cars of the lists until we find a match.
8503 (let ((default gnus-summary-default-score))
8505 (not (eval (caar list))))
8506 (setq list (cdr list))))
8507 (let ((face (cdar list)))
8508 (unless (eq face (get-text-property beg 'face))
8509 (gnus-put-text-property
8511 (setq face (if (boundp face) (symbol-value face) face)))
8512 (when gnus-summary-highlight-line-function
8513 (funcall gnus-summary-highlight-line-function article face))))
8516 (defun gnus-update-read-articles (group unread)
8517 "Update the list of read articles in GROUP."
8518 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8519 (entry (gnus-gethash group gnus-newsrc-hashtb))
8520 (info (nth 2 entry))
8522 (unread (sort (copy-sequence unread) '<))
8524 (if (or (not info) (not active))
8525 ;; There is no info on this group if it was, in fact,
8526 ;; killed. Gnus stores no information on killed groups, so
8527 ;; there's nothing to be done.
8528 ;; One could store the information somewhere temporarily,
8529 ;; perhaps... Hmmm...
8531 ;; Remove any negative articles numbers.
8532 (while (and unread (< (car unread) 0))
8533 (setq unread (cdr unread)))
8534 ;; Remove any expired article numbers
8535 (while (and unread (< (car unread) (car active)))
8536 (setq unread (cdr unread)))
8537 ;; Compute the ranges of read articles by looking at the list of
8540 (when (/= (car unread) prev)
8541 (push (if (= prev (1- (car unread))) prev
8542 (cons prev (1- (car unread))))
8544 (setq prev (1+ (car unread)))
8545 (setq unread (cdr unread)))
8546 (when (<= prev (cdr active))
8547 (push (cons prev (cdr active)) read))
8549 (set-buffer gnus-group-buffer)
8552 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8553 (gnus-info-set-read ',info ',(gnus-info-read info))
8554 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8555 (gnus-group-update-group ,group t))))
8556 ;; Enter this list into the group info.
8558 info (if (> (length read) 1) (nreverse read) read))
8559 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8560 (gnus-get-unread-articles-in-group info (gnus-active group))
8565 (run-hooks 'gnus-sum-load-hook)
8567 ;;; gnus-sum.el ends here