1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
35 ;; 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")
54 (defgroup gnus-summary nil
56 :link '(custom-manual "(gnus)The Summary Buffer")
59 (defgroup gnus-summary-exit nil
60 "Leaving summary buffers."
61 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
64 (defgroup gnus-summary-marks nil
65 "Marks used in summary buffers."
66 :link '(custom-manual "(gnus)Marking Articles")
69 (defgroup gnus-thread nil
70 "Ordering articles according to replies."
71 :link '(custom-manual "(gnus)Threading")
74 (defgroup gnus-summary-format nil
75 "Formatting of the summary buffer."
76 :link '(custom-manual "(gnus)Summary Buffer Format")
79 (defgroup gnus-summary-choose nil
81 :link '(custom-manual "(gnus)Choosing Articles")
84 (defgroup gnus-summary-maneuvering nil
85 "Summary movement commands."
86 :link '(custom-manual "(gnus)Summary Maneuvering")
89 (defgroup gnus-summary-mail nil
90 "Mail group commands."
91 :link '(custom-manual "(gnus)Mail Group Commands")
94 (defgroup gnus-summary-sort nil
95 "Sorting the summary buffer."
96 :link '(custom-manual "(gnus)Sorting")
99 (defgroup gnus-summary-visual nil
100 "Highlighting and menus in the summary buffer."
101 :link '(custom-manual "(gnus)Summary Highlighting")
103 :group 'gnus-summary)
105 (defgroup gnus-summary-various nil
106 "Various summary buffer options."
107 :link '(custom-manual "(gnus)Various Summary Stuff")
108 :group 'gnus-summary)
110 (defcustom gnus-kill-summary-on-exit t
111 "*If non-nil, kill the summary buffer when you exit from it.
112 If nil, the summary will become a \"*Dead Summary*\" buffer, and
113 it will be killed sometime later."
114 :group 'gnus-summary-exit
117 (defcustom gnus-fetch-old-headers nil
118 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
119 If an unread article in the group refers to an older, already read (or
120 just marked as read) article, the old article will not normally be
121 displayed in the Summary buffer. If this variable is non-nil, Gnus
122 will attempt to grab the headers to the old articles, and thereby
123 build complete threads. If it has the value `some', only enough
124 headers to connect otherwise loose threads will be displayed.
125 This variable can also be a number. In that case, no more than that
126 number of old headers will be fetched.
128 The server has to support NOV for any of this to work."
130 :type '(choice (const :tag "off" nil)
133 (sexp :menu-tag "other" t)))
135 (defcustom gnus-summary-make-false-root 'adopt
136 "*nil means that Gnus won't gather loose threads.
137 If the root of a thread has expired or been read in a previous
138 session, the information necessary to build a complete thread has been
139 lost. Instead of having many small sub-threads from this original thread
140 scattered all over the summary buffer, Gnus can gather them.
142 If non-nil, Gnus will try to gather all loose sub-threads from an
143 original thread into one large thread.
145 If this variable is non-nil, it should be one of `none', `adopt',
148 If this variable is `none', Gnus will not make a false root, but just
149 present the sub-threads after another.
150 If this variable is `dummy', Gnus will create a dummy root that will
151 have all the sub-threads as children.
152 If this variable is `adopt', Gnus will make one of the \"children\"
153 the parent and mark all the step-children as such.
154 If this variable is `empty', the \"children\" are printed with empty
155 subject fields. (Or rather, they will be printed with a string
156 given by the `gnus-summary-same-subject' variable.)"
158 :type '(choice (const :tag "off" nil)
164 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
165 "*A regexp to match subjects to be excluded from loose thread gathering.
166 As loose thread gathering is done on subjects only, that means that
167 there can be many false gatherings performed. By rooting out certain
168 common subjects, gathering might become saner."
172 (defcustom gnus-summary-gather-subject-limit nil
173 "*Maximum length of subject comparisons when gathering loose threads.
174 Use nil to compare full subjects. Setting this variable to a low
175 number will help gather threads that have been corrupted by
176 newsreaders chopping off subject lines, but it might also mean that
177 unrelated articles that have subject that happen to begin with the
178 same few characters will be incorrectly gathered.
180 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
183 :type '(choice (const :tag "off" nil)
185 (sexp :menu-tag "on" t)))
187 (defcustom gnus-simplify-ignored-prefixes nil
188 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
190 :type '(choice (const :tag "off" nil)
193 (defcustom gnus-build-sparse-threads nil
194 "*If non-nil, fill in the gaps in threads.
195 If `some', only fill in the gaps that are needed to tie loose threads
196 together. If `more', fill in all leaf nodes that Gnus can find. If
197 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
199 :type '(choice (const :tag "off" nil)
202 (sexp :menu-tag "all" t)))
204 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
205 "Function used for gathering loose threads.
206 There are two pre-defined functions: `gnus-gather-threads-by-subject',
207 which only takes Subjects into consideration; and
208 `gnus-gather-threads-by-references', which compared the References
209 headers of the articles to find matches."
211 :type '(set (function-item gnus-gather-threads-by-subject)
212 (function-item gnus-gather-threads-by-references)
213 (function :tag "other")))
215 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
216 (defcustom gnus-summary-same-subject ""
217 "*String indicating that the current article has the same subject as the previous.
218 This variable will only be used if the value of
219 `gnus-summary-make-false-root' is `empty'."
220 :group 'gnus-summary-format
223 (defcustom gnus-summary-goto-unread t
224 "*If t, marking commands will go to the next unread article.
225 If `never', commands that usually go to the next unread article, will
226 go to the next article, whether it is read or not.
227 If nil, only the marking commands will go to the next (un)read article."
228 :group 'gnus-summary-marks
229 :link '(custom-manual "(gnus)Setting Marks")
230 :type '(choice (const :tag "off" nil)
232 (sexp :menu-tag "on" t)))
234 (defcustom gnus-summary-default-score 0
235 "*Default article score level.
236 If this variable is nil, scoring will be disabled."
238 :type '(choice (const :tag "disable")
241 (defcustom gnus-summary-zcore-fuzz 0
242 "*Fuzziness factor for the zcore in the summary buffer.
243 Articles with scores closer than this to `gnus-summary-default-score'
245 :group 'gnus-summary-format
248 (defcustom gnus-simplify-subject-fuzzy-regexp nil
249 "*Strings to be removed when doing fuzzy matches.
250 This can either be a regular expression or list of regular expressions
251 that will be removed from subject strings if fuzzy subject
252 simplification is selected."
254 :type '(repeat regexp))
256 (defcustom gnus-show-threads t
257 "*If non-nil, display threads in summary mode."
261 (defcustom gnus-thread-hide-subtree nil
262 "*If non-nil, hide all threads initially.
263 If threads are hidden, you have to run the command
264 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
265 to expose hidden threads."
269 (defcustom gnus-thread-hide-killed t
270 "*If non-nil, hide killed threads automatically."
274 (defcustom gnus-thread-ignore-subject nil
275 "*If non-nil, ignore subjects and do all threading based on the Reference header.
276 If nil, which is the default, articles that have different subjects
277 from their parents will start separate threads."
281 (defcustom gnus-thread-operation-ignore-subject t
282 "*If non-nil, subjects will be ignored when doing thread commands.
283 This affects commands like `gnus-summary-kill-thread' and
284 `gnus-summary-lower-thread'.
286 If this variable is nil, articles in the same thread with different
287 subjects will not be included in the operation in question. If this
288 variable is `fuzzy', only articles that have subjects that are fuzzily
289 equal will be included."
291 :type '(choice (const :tag "off" nil)
295 (defcustom gnus-thread-indent-level 4
296 "*Number that says how much each sub-thread should be indented."
300 (defcustom gnus-auto-extend-newsgroup t
301 "*If non-nil, extend newsgroup forward and backward when requested."
302 :group 'gnus-summary-choose
305 (defcustom gnus-auto-select-first t
306 "*If nil, don't select the first unread article when entering a group.
307 If this variable is `best', select the highest-scored unread article
308 in the group. If neither nil nor `best', select the first unread
311 If you want to prevent automatic selection of the first unread article
312 in some newsgroups, set the variable to nil in
313 `gnus-select-group-hook'."
314 :group 'gnus-group-select
315 :type '(choice (const :tag "none" nil)
317 (sexp :menu-tag "first" t)))
319 (defcustom gnus-auto-select-next t
320 "*If non-nil, offer to go to the next group from the end of the previous.
321 If the value is t and the next newsgroup is empty, Gnus will exit
322 summary mode and go back to group mode. If the value is neither nil
323 nor t, Gnus will select the following unread newsgroup. In
324 particular, if the value is the symbol `quietly', the next unread
325 newsgroup will be selected without any confirmation, and if it is
326 `almost-quietly', the next group will be selected without any
327 confirmation if you are located on the last article in the group.
328 Finally, if this variable is `slightly-quietly', the `Z n' command
329 will go to the next group without confirmation."
330 :group 'gnus-summary-maneuvering
331 :type '(choice (const :tag "off" nil)
333 (const almost-quietly)
334 (const slightly-quietly)
335 (sexp :menu-tag "on" t)))
337 (defcustom gnus-auto-select-same nil
338 "*If non-nil, select the next article with the same subject."
339 :group 'gnus-summary-maneuvering
342 (defcustom gnus-summary-check-current nil
343 "*If non-nil, consider the current article when moving.
344 The \"unread\" movement commands will stay on the same line if the
345 current article is unread."
346 :group 'gnus-summary-maneuvering
349 (defcustom gnus-auto-center-summary t
350 "*If non-nil, always center the current summary buffer.
351 In particular, if `vertical' do only vertical recentering. If non-nil
352 and non-`vertical', do both horizontal and vertical recentering."
353 :group 'gnus-summary-maneuvering
354 :type '(choice (const :tag "none" nil)
356 (sexp :menu-tag "both" t)))
358 (defcustom gnus-show-all-headers nil
359 "*If non-nil, don't hide any headers."
360 :group 'gnus-article-hiding
361 :group 'gnus-article-headers
364 (defcustom gnus-single-article-buffer t
365 "*If non-nil, display all articles in the same buffer.
366 If nil, each group will get its own article buffer."
367 :group 'gnus-article-various
370 (defcustom gnus-break-pages t
371 "*If non-nil, do page breaking on articles.
372 The page delimiter is specified by the `gnus-page-delimiter'
374 :group 'gnus-article-various
377 (defcustom gnus-show-mime nil
378 "*If non-nil, do mime processing of articles.
379 The articles will simply be fed to the function given by
380 `gnus-show-mime-method'."
381 :group 'gnus-article-mime
384 (defcustom gnus-move-split-methods nil
385 "*Variable used to suggest where articles are to be moved to.
386 It uses the same syntax as the `gnus-split-methods' variable."
387 :group 'gnus-summary-mail
388 :type '(repeat (choice (list function)
389 (cons regexp (repeat string))
392 ;; Mark variables suggested by Thomas Michanek
393 ;; <Thomas.Michanek@telelogic.se>.
395 (defcustom gnus-unread-mark ?
396 "*Mark used for unread articles."
397 :group 'gnus-summary-marks
400 (defcustom gnus-ticked-mark ?!
401 "*Mark used for ticked articles."
402 :group 'gnus-summary-marks
405 (defcustom gnus-dormant-mark ??
406 "*Mark used for dormant articles."
407 :group 'gnus-summary-marks
410 (defcustom gnus-del-mark ?r
411 "*Mark used for del'd articles."
412 :group 'gnus-summary-marks
415 (defcustom gnus-read-mark ?R
416 "*Mark used for read articles."
417 :group 'gnus-summary-marks
420 (defcustom gnus-expirable-mark ?E
421 "*Mark used for expirable articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-killed-mark ?K
426 "*Mark used for killed articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-souped-mark ?F
431 "*Mark used for killed articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-kill-file-mark ?X
436 "*Mark used for articles killed by kill files."
437 :group 'gnus-summary-marks
440 (defcustom gnus-low-score-mark ?Y
441 "*Mark used for articles with a low score."
442 :group 'gnus-summary-marks
445 (defcustom gnus-catchup-mark ?C
446 "*Mark used for articles that are caught up."
447 :group 'gnus-summary-marks
450 (defcustom gnus-replied-mark ?A
451 "*Mark used for articles that have been replied to."
452 :group 'gnus-summary-marks
455 (defcustom gnus-cached-mark ?*
456 "*Mark used for articles that are in the cache."
457 :group 'gnus-summary-marks
460 (defcustom gnus-saved-mark ?S
461 "*Mark used for articles that have been saved to."
462 :group 'gnus-summary-marks
465 (defcustom gnus-ancient-mark ?O
466 "*Mark used for ancient articles."
467 :group 'gnus-summary-marks
470 (defcustom gnus-sparse-mark ?Q
471 "*Mark used for sparsely reffed articles."
472 :group 'gnus-summary-marks
475 (defcustom gnus-canceled-mark ?G
476 "*Mark used for canceled articles."
477 :group 'gnus-summary-marks
480 (defcustom gnus-duplicate-mark ?M
481 "*Mark used for duplicate articles."
482 :group 'gnus-summary-marks
485 (defcustom gnus-score-over-mark ?+
486 "*Score mark used for articles with high scores."
487 :group 'gnus-summary-marks
490 (defcustom gnus-score-below-mark ?-
491 "*Score mark used for articles with low scores."
492 :group 'gnus-summary-marks
495 (defcustom gnus-empty-thread-mark ?
496 "*There is no thread under the article."
497 :group 'gnus-summary-marks
500 (defcustom gnus-not-empty-thread-mark ?=
501 "*There is a thread under the article."
502 :group 'gnus-summary-marks
505 (defcustom gnus-view-pseudo-asynchronously nil
506 "*If non-nil, Gnus will view pseudo-articles asynchronously."
507 :group 'gnus-extract-view
510 (defcustom gnus-view-pseudos nil
511 "*If `automatic', pseudo-articles will be viewed automatically.
512 If `not-confirm', pseudos will be viewed automatically, and the user
513 will not be asked to confirm the command."
514 :group 'gnus-extract-view
515 :type '(choice (const :tag "off" nil)
517 (const not-confirm)))
519 (defcustom gnus-view-pseudos-separately t
520 "*If non-nil, one pseudo-article will be created for each file to be viewed.
521 If nil, all files that use the same viewing command will be given as a
522 list of parameters to that command."
523 :group 'gnus-extract-view
526 (defcustom gnus-insert-pseudo-articles t
527 "*If non-nil, insert pseudo-articles when decoding articles."
528 :group 'gnus-extract-view
531 (defcustom gnus-summary-dummy-line-format
533 "*The format specification for the dummy roots in the summary buffer.
534 It works along the same lines as a normal formatting string,
535 with some simple extensions.
538 :group 'gnus-threading
541 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
542 "*The format specification for the summary mode line.
543 It works along the same lines as a normal formatting string,
544 with some simple extensions:
547 %p Unprefixed group name
548 %A Current article number
550 %U Number of unread articles in the group
551 %e Number of unselected articles in the group
552 %Z A string with unread/unselected article counts
553 %g Shortish group name
554 %S Subject of the current article
556 %s Current score file name
557 %d Number of dormant articles
558 %r Number of articles that have been marked as read in this session
559 %E Number of articles expunged by the score files"
560 :group 'gnus-summary-format
563 (defcustom gnus-summary-mark-below 0
564 "*Mark all articles with a score below this variable as read.
565 This variable is local to each summary buffer and usually set by the
570 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
571 "*List of functions used for sorting articles in the summary buffer.
572 This variable is only used when not using a threaded display."
573 :group 'gnus-summary-sort
574 :type '(repeat (choice (function-item gnus-article-sort-by-number)
575 (function-item gnus-article-sort-by-author)
576 (function-item gnus-article-sort-by-subject)
577 (function-item gnus-article-sort-by-date)
578 (function-item gnus-article-sort-by-score)
579 (function :tag "other"))))
581 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
582 "*List of functions used for sorting threads in the summary buffer.
583 By default, threads are sorted by article number.
585 Each function takes two threads and return non-nil if the first thread
586 should be sorted before the other. If you use more than one function,
587 the primary sort function should be the last. You should probably
588 always include `gnus-thread-sort-by-number' in the list of sorting
589 functions -- preferably first.
591 Ready-made functions include `gnus-thread-sort-by-number',
592 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
593 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
594 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
595 :group 'gnus-summary-sort
596 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
597 (function-item gnus-thread-sort-by-author)
598 (function-item gnus-thread-sort-by-subject)
599 (function-item gnus-thread-sort-by-date)
600 (function-item gnus-thread-sort-by-score)
601 (function-item gnus-thread-sort-by-total-score)
602 (function :tag "other"))))
604 (defcustom gnus-thread-score-function '+
605 "*Function used for calculating the total score of a thread.
607 The function is called with the scores of the article and each
608 subthread and should then return the score of the thread.
610 Some functions you can use are `+', `max', or `min'."
611 :group 'gnus-summary-sort
614 (defcustom gnus-summary-expunge-below nil
615 "All articles that have a score less than this variable will be expunged."
617 :type '(choice (const :tag "off" nil)
620 (defcustom gnus-thread-expunge-below nil
621 "All threads that have a total score less than this variable will be expunged.
622 See `gnus-thread-score-function' for en explanation of what a
623 \"thread score\" is."
624 :group 'gnus-treading
626 :type '(choice (const :tag "off" nil)
629 (defcustom gnus-summary-mode-hook nil
630 "*A hook for Gnus summary mode.
631 This hook is run before any variables are set in the summary buffer."
632 :group 'gnus-summary-various
635 (defcustom gnus-summary-menu-hook nil
636 "*Hook run after the creation of the summary mode menu."
637 :group 'gnus-summary-visual
640 (defcustom gnus-summary-exit-hook nil
641 "*A hook called on exit from the summary buffer."
642 :group 'gnus-summary-exit
645 (defcustom gnus-summary-prepare-hook nil
646 "*A hook called after the summary buffer has been generated.
647 If you want to modify the summary buffer, you can use this hook."
648 :group 'gnus-summary-various
651 (defcustom gnus-summary-generate-hook nil
652 "*A hook run just before generating the summary buffer.
653 This hook is commonly used to customize threading variables and the
655 :group 'gnus-summary-various
658 (defcustom gnus-select-group-hook nil
659 "*A hook called when a newsgroup is selected.
661 If you'd like to simplify subjects like the
662 `gnus-summary-next-same-subject' command does, you can use the
665 (setq gnus-select-group-hook
668 (mapcar (lambda (header)
669 (mail-header-set-subject
671 (gnus-simplify-subject
672 (mail-header-subject header) 're-only)))
673 gnus-newsgroup-headers))))"
674 :group 'gnus-group-select
677 (defcustom gnus-select-article-hook nil
678 "*A hook called when an article is selected."
679 :group 'gnus-summary-choose
682 (defcustom gnus-visual-mark-article-hook
683 (list 'gnus-highlight-selected-summary)
684 "*Hook run after selecting an article in the summary buffer.
685 It is meant to be used for highlighting the article in some way. It
686 is not run if `gnus-visual' is nil."
687 :group 'gnus-summary-visual
690 (defcustom gnus-parse-headers-hook
691 (list 'gnus-decode-rfc1522)
692 "*A hook called before parsing the headers."
696 (defcustom gnus-exit-group-hook nil
697 "*A hook called when exiting (not quitting) summary mode."
701 (defcustom gnus-summary-update-hook
702 (list 'gnus-summary-highlight-line)
703 "*A hook called when a summary line is changed.
704 The hook will not be called if `gnus-visual' is nil.
706 The default function `gnus-summary-highlight-line' will
707 highlight the line according to the `gnus-summary-highlight'
709 :group 'gnus-summary-visual
712 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
713 "*A hook called when an article is selected for the first time.
714 The hook is intended to mark an article as read (or unread)
715 automatically when it is selected."
716 :group 'gnus-summary-choose
719 (defcustom gnus-group-no-more-groups-hook nil
720 "*A hook run when returning to group mode having no more (unread) groups."
721 :group 'gnus-group-select
724 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
725 "Face used for highlighting the current article in the summary buffer."
726 :group 'gnus-summary-visual
729 (defcustom gnus-summary-highlight
730 '(((= mark gnus-canceled-mark)
731 . gnus-summary-cancelled-face)
732 ((and (> score default)
733 (or (= mark gnus-dormant-mark)
734 (= mark gnus-ticked-mark)))
735 . gnus-summary-high-ticked-face)
736 ((and (< score default)
737 (or (= mark gnus-dormant-mark)
738 (= mark gnus-ticked-mark)))
739 . gnus-summary-low-ticked-face)
740 ((or (= mark gnus-dormant-mark)
741 (= mark gnus-ticked-mark))
742 . gnus-summary-normal-ticked-face)
743 ((and (> score default) (= mark gnus-ancient-mark))
744 . gnus-summary-high-ancient-face)
745 ((and (< score default) (= mark gnus-ancient-mark))
746 . gnus-summary-low-ancient-face)
747 ((= mark gnus-ancient-mark)
748 . gnus-summary-normal-ancient-face)
749 ((and (> score default) (= mark gnus-unread-mark))
750 . gnus-summary-high-unread-face)
751 ((and (< score default) (= mark gnus-unread-mark))
752 . gnus-summary-low-unread-face)
753 ((and (= mark gnus-unread-mark))
754 . gnus-summary-normal-unread-face)
756 . gnus-summary-high-read-face)
758 . gnus-summary-low-read-face)
760 . gnus-summary-normal-read-face))
761 "Controls the highlighting of summary buffer lines.
763 A list of (FORM . FACE) pairs. When deciding how a a particular
764 summary line should be displayed, each form is evaluated. The content
765 of the face field after the first true form is used. You can change
766 how those summary lines are displayed, by editing the face field.
768 You can use the following variables in the FORM field.
770 score: The articles score
771 default: The default article score.
772 below: The score below which articles are automatically marked as read.
773 mark: The articles mark."
774 :group 'gnus-summary-visual
775 :type '(repeat (cons (sexp :tag "Form" nil)
778 ;;; Internal variables
780 (defvar gnus-scores-exclude-files nil)
782 (defvar gnus-summary-display-table
783 ;; Change the display table. Odd characters have a tendency to mess
784 ;; up nicely formatted displays - we make all possible glyphs
785 ;; display only a single character.
787 ;; We start from the standard display table, if any.
788 (let ((table (or (copy-sequence standard-display-table)
789 (make-display-table)))
790 ;; Nix out all the control chars...
792 (while (>= (setq i (1- i)) 0)
794 ;; ... but not newline and cr, of course. (cr is necessary for the
795 ;; selective display).
798 ;; We nix out any glyphs over 126 that are not set already.
800 (while (>= (setq i (1- i)) 127)
801 ;; Only modify if the entry is nil.
803 (aset table i [??]))))
805 "Display table used in summary mode buffers.")
807 (defvar gnus-original-article nil)
808 (defvar gnus-article-internal-prepare-hook nil)
809 (defvar gnus-newsgroup-process-stack nil)
811 (defvar gnus-thread-indent-array nil)
812 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
814 ;; Avoid highlighting in kill files.
815 (defvar gnus-summary-inhibit-highlight nil)
816 (defvar gnus-newsgroup-selected-overlay nil)
817 (defvar gnus-inhibit-limiting nil)
818 (defvar gnus-newsgroup-adaptive-score-file nil)
819 (defvar gnus-current-score-file nil)
820 (defvar gnus-current-move-group nil)
821 (defvar gnus-current-copy-group nil)
822 (defvar gnus-current-crosspost-group nil)
824 (defvar gnus-newsgroup-dependencies nil)
825 (defvar gnus-newsgroup-adaptive nil)
826 (defvar gnus-summary-display-article-function nil)
827 (defvar gnus-summary-highlight-line-function nil
828 "Function called after highlighting a summary line.")
830 (defvar gnus-summary-line-format-alist
831 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
832 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
833 (?s gnus-tmp-subject-or-nil ?s)
834 (?n gnus-tmp-name ?s)
835 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
837 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
839 (?F gnus-tmp-from ?s)
840 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
841 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
842 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
843 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
844 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
845 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
846 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
847 (?L gnus-tmp-lines ?d)
848 (?I gnus-tmp-indentation ?s)
849 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
850 (?R gnus-tmp-replied ?c)
851 (?\[ gnus-tmp-opening-bracket ?c)
852 (?\] gnus-tmp-closing-bracket ?c)
853 (?\> (make-string gnus-tmp-level ? ) ?s)
854 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
855 (?i gnus-tmp-score ?d)
856 (?z gnus-tmp-score-char ?c)
857 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
858 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
859 (?U gnus-tmp-unread ?c)
860 (?t (gnus-summary-number-of-articles-in-thread
861 (and (boundp 'thread) (car thread)) gnus-tmp-level)
863 (?e (gnus-summary-number-of-articles-in-thread
864 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
866 (?u gnus-tmp-user-defined ?s)
867 (?P (gnus-pick-line-number) ?d))
868 "An alist of format specifications that can appear in summary lines,
869 and what variables they correspond with, along with the type of the
870 variable (string, integer, character, etc).")
872 (defvar gnus-summary-dummy-line-format-alist
873 `((?S gnus-tmp-subject ?s)
874 (?N gnus-tmp-number ?d)
875 (?u gnus-tmp-user-defined ?s)))
877 (defvar gnus-summary-mode-line-format-alist
878 `((?G gnus-tmp-group-name ?s)
879 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
880 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
881 (?A gnus-tmp-article-number ?d)
882 (?Z gnus-tmp-unread-and-unselected ?s)
884 (?U gnus-tmp-unread-and-unticked ?d)
885 (?S gnus-tmp-subject ?s)
886 (?e gnus-tmp-unselected ?d)
887 (?u gnus-tmp-user-defined ?s)
888 (?d (length gnus-newsgroup-dormant) ?d)
889 (?t (length gnus-newsgroup-marked) ?d)
890 (?r (length gnus-newsgroup-reads) ?d)
891 (?E gnus-newsgroup-expunged-tally ?d)
892 (?s (gnus-current-score-file-nondirectory) ?s)))
894 (defvar gnus-last-search-regexp nil
895 "Default regexp for article search command.")
897 (defvar gnus-last-shell-command nil
898 "Default shell command on article.")
900 (defvar gnus-newsgroup-begin nil)
901 (defvar gnus-newsgroup-end nil)
902 (defvar gnus-newsgroup-last-rmail nil)
903 (defvar gnus-newsgroup-last-mail nil)
904 (defvar gnus-newsgroup-last-folder nil)
905 (defvar gnus-newsgroup-last-file nil)
906 (defvar gnus-newsgroup-auto-expire nil)
907 (defvar gnus-newsgroup-active nil)
909 (defvar gnus-newsgroup-data nil)
910 (defvar gnus-newsgroup-data-reverse nil)
911 (defvar gnus-newsgroup-limit nil)
912 (defvar gnus-newsgroup-limits nil)
914 (defvar gnus-newsgroup-unreads nil
915 "List of unread articles in the current newsgroup.")
917 (defvar gnus-newsgroup-unselected nil
918 "List of unselected unread articles in the current newsgroup.")
920 (defvar gnus-newsgroup-reads nil
921 "Alist of read articles and article marks in the current newsgroup.")
923 (defvar gnus-newsgroup-expunged-tally nil)
925 (defvar gnus-newsgroup-marked nil
926 "List of ticked articles in the current newsgroup (a subset of unread art).")
928 (defvar gnus-newsgroup-killed nil
929 "List of ranges of articles that have been through the scoring process.")
931 (defvar gnus-newsgroup-cached nil
932 "List of articles that come from the article cache.")
934 (defvar gnus-newsgroup-saved nil
935 "List of articles that have been saved.")
937 (defvar gnus-newsgroup-kill-headers nil)
939 (defvar gnus-newsgroup-replied nil
940 "List of articles that have been replied to in the current newsgroup.")
942 (defvar gnus-newsgroup-expirable nil
943 "List of articles in the current newsgroup that can be expired.")
945 (defvar gnus-newsgroup-processable nil
946 "List of articles in the current newsgroup that can be processed.")
948 (defvar gnus-newsgroup-bookmarks nil
949 "List of articles in the current newsgroup that have bookmarks.")
951 (defvar gnus-newsgroup-dormant nil
952 "List of dormant articles in the current newsgroup.")
954 (defvar gnus-newsgroup-scored nil
955 "List of scored articles in the current newsgroup.")
957 (defvar gnus-newsgroup-headers nil
958 "List of article headers in the current newsgroup.")
960 (defvar gnus-newsgroup-threads nil)
962 (defvar gnus-newsgroup-prepared nil
963 "Whether the current group has been prepared properly.")
965 (defvar gnus-newsgroup-ancient nil
966 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
968 (defvar gnus-newsgroup-sparse nil)
970 (defvar gnus-current-article nil)
971 (defvar gnus-article-current nil)
972 (defvar gnus-current-headers nil)
973 (defvar gnus-have-all-headers nil)
974 (defvar gnus-last-article nil)
975 (defvar gnus-newsgroup-history nil)
977 (defconst gnus-summary-local-variables
978 '(gnus-newsgroup-name
979 gnus-newsgroup-begin gnus-newsgroup-end
980 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
981 gnus-newsgroup-last-folder gnus-newsgroup-last-file
982 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
983 gnus-newsgroup-unselected gnus-newsgroup-marked
984 gnus-newsgroup-reads gnus-newsgroup-saved
985 gnus-newsgroup-replied gnus-newsgroup-expirable
986 gnus-newsgroup-processable gnus-newsgroup-killed
987 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
988 gnus-newsgroup-headers gnus-newsgroup-threads
989 gnus-newsgroup-prepared gnus-summary-highlight-line-function
990 gnus-current-article gnus-current-headers gnus-have-all-headers
991 gnus-last-article gnus-article-internal-prepare-hook
992 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
993 gnus-newsgroup-scored gnus-newsgroup-kill-headers
994 gnus-thread-expunge-below
995 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
996 (gnus-summary-mark-below . global)
997 gnus-newsgroup-active gnus-scores-exclude-files
998 gnus-newsgroup-history gnus-newsgroup-ancient
999 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1000 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1001 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1002 (gnus-newsgroup-expunged-tally . 0)
1003 gnus-cache-removable-articles gnus-newsgroup-cached
1004 gnus-newsgroup-data gnus-newsgroup-data-reverse
1005 gnus-newsgroup-limit gnus-newsgroup-limits)
1006 "Variables that are buffer-local to the summary buffers.")
1008 ;; Byte-compiler warning.
1009 (defvar gnus-article-mode-map)
1011 ;; Subject simplification.
1013 (defsubst gnus-simplify-subject-re (subject)
1014 "Remove \"Re:\" from subject lines."
1015 (if (string-match "^[Rr][Ee]: *" subject)
1016 (substring subject (match-end 0))
1019 (defun gnus-simplify-subject (subject &optional re-only)
1020 "Remove `Re:' and words in parentheses.
1021 If RE-ONLY is non-nil, strip leading `Re:'s only."
1022 (let ((case-fold-search t)) ;Ignore case.
1023 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1024 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1025 (setq subject (substring subject (match-end 0))))
1026 ;; Remove uninteresting prefixes.
1027 (when (and (not re-only)
1028 gnus-simplify-ignored-prefixes
1029 (string-match gnus-simplify-ignored-prefixes subject))
1030 (setq subject (substring subject (match-end 0))))
1031 ;; Remove words in parentheses from end.
1033 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1034 (setq subject (substring subject 0 (match-beginning 0)))))
1035 ;; Return subject string.
1038 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1040 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1041 (goto-char (point-min))
1042 (while (re-search-forward regexp nil t)
1043 (replace-match (or newtext ""))))
1045 (defun gnus-simplify-buffer-fuzzy ()
1046 "Simplify string in the buffer fuzzily.
1047 The string in the accessible portion of the current buffer is simplified.
1048 It is assumed to be a single-line subject.
1049 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1050 matter is removed. Additional things can be deleted by setting
1051 gnus-simplify-subject-fuzzy-regexp."
1052 (let ((case-fold-search t)
1054 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1056 (while (not (eq modified-tick (buffer-modified-tick)))
1057 (setq modified-tick (buffer-modified-tick))
1059 ((listp gnus-simplify-subject-fuzzy-regexp)
1060 (mapcar 'gnus-simplify-buffer-fuzzy-step
1061 gnus-simplify-subject-fuzzy-regexp))
1062 (gnus-simplify-subject-fuzzy-regexp
1063 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1064 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1065 (gnus-simplify-buffer-fuzzy-step
1066 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1067 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1069 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1070 (gnus-simplify-buffer-fuzzy-step " +" " ")
1071 (gnus-simplify-buffer-fuzzy-step " $")
1072 (gnus-simplify-buffer-fuzzy-step "^ +")))
1074 (defun gnus-simplify-subject-fuzzy (subject)
1075 "Simplify a subject string fuzzily.
1076 See gnus-simplify-buffer-fuzzy for details."
1078 (gnus-set-work-buffer)
1079 (let ((case-fold-search t))
1081 (inline (gnus-simplify-buffer-fuzzy))
1084 (defsubst gnus-simplify-subject-fully (subject)
1085 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1087 ((null gnus-summary-gather-subject-limit)
1088 (gnus-simplify-subject-re subject))
1089 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1090 (gnus-simplify-subject-fuzzy subject))
1091 ((numberp gnus-summary-gather-subject-limit)
1092 (gnus-limit-string (gnus-simplify-subject-re subject)
1093 gnus-summary-gather-subject-limit))
1097 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1098 "Check whether two subjects are equal. If optional argument
1099 simple-first is t, first argument is already simplified."
1101 ((null simple-first)
1102 (equal (gnus-simplify-subject-fully s1)
1103 (gnus-simplify-subject-fully s2)))
1106 (gnus-simplify-subject-fully s2)))))
1108 (defun gnus-offer-save-summaries ()
1109 "Offer to save all active summary buffers."
1111 (let ((buflist (buffer-list))
1113 ;; Go through all buffers and find all summaries.
1115 (and (setq bufname (buffer-name (car buflist)))
1116 (string-match "Summary" bufname)
1118 (set-buffer bufname)
1119 ;; We check that this is, indeed, a summary buffer.
1120 (and (eq major-mode 'gnus-summary-mode)
1121 ;; Also make sure this isn't bogus.
1122 gnus-newsgroup-prepared))
1123 (push bufname buffers))
1124 (setq buflist (cdr buflist)))
1125 ;; Go through all these summary buffers and offer to save them.
1128 "Update summary buffer %s? "
1129 (lambda (buf) (set-buffer buf) (gnus-summary-exit))
1132 (defun gnus-summary-bubble-group ()
1133 "Increase the score of the current group.
1134 This is a handy function to add to `gnus-summary-exit-hook' to
1135 increase the score of each group you read."
1136 (gnus-group-add-score gnus-newsgroup-name))
1140 ;;; Gnus summary mode
1143 (put 'gnus-summary-mode 'mode-class 'special)
1146 ;; Non-orthogonal keys
1148 (gnus-define-keys gnus-summary-mode-map
1149 " " gnus-summary-next-page
1150 "\177" gnus-summary-prev-page
1151 [delete] gnus-summary-prev-page
1152 "\r" gnus-summary-scroll-up
1153 "n" gnus-summary-next-unread-article
1154 "p" gnus-summary-prev-unread-article
1155 "N" gnus-summary-next-article
1156 "P" gnus-summary-prev-article
1157 "\M-\C-n" gnus-summary-next-same-subject
1158 "\M-\C-p" gnus-summary-prev-same-subject
1159 "\M-n" gnus-summary-next-unread-subject
1160 "\M-p" gnus-summary-prev-unread-subject
1161 "." gnus-summary-first-unread-article
1162 "," gnus-summary-best-unread-article
1163 "\M-s" gnus-summary-search-article-forward
1164 "\M-r" gnus-summary-search-article-backward
1165 "<" gnus-summary-beginning-of-article
1166 ">" gnus-summary-end-of-article
1167 "j" gnus-summary-goto-article
1168 "^" gnus-summary-refer-parent-article
1169 "\M-^" gnus-summary-refer-article
1170 "u" gnus-summary-tick-article-forward
1171 "!" gnus-summary-tick-article-forward
1172 "U" gnus-summary-tick-article-backward
1173 "d" gnus-summary-mark-as-read-forward
1174 "D" gnus-summary-mark-as-read-backward
1175 "E" gnus-summary-mark-as-expirable
1176 "\M-u" gnus-summary-clear-mark-forward
1177 "\M-U" gnus-summary-clear-mark-backward
1178 "k" gnus-summary-kill-same-subject-and-select
1179 "\C-k" gnus-summary-kill-same-subject
1180 "\M-\C-k" gnus-summary-kill-thread
1181 "\M-\C-l" gnus-summary-lower-thread
1182 "e" gnus-summary-edit-article
1183 "#" gnus-summary-mark-as-processable
1184 "\M-#" gnus-summary-unmark-as-processable
1185 "\M-\C-t" gnus-summary-toggle-threads
1186 "\M-\C-s" gnus-summary-show-thread
1187 "\M-\C-h" gnus-summary-hide-thread
1188 "\M-\C-f" gnus-summary-next-thread
1189 "\M-\C-b" gnus-summary-prev-thread
1190 "\M-\C-u" gnus-summary-up-thread
1191 "\M-\C-d" gnus-summary-down-thread
1192 "&" gnus-summary-execute-command
1193 "c" gnus-summary-catchup-and-exit
1194 "\C-w" gnus-summary-mark-region-as-read
1195 "\C-t" gnus-summary-toggle-truncation
1196 "?" gnus-summary-mark-as-dormant
1197 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1198 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1199 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1200 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1201 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1202 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1203 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1204 "=" gnus-summary-expand-window
1205 "\C-x\C-s" gnus-summary-reselect-current-group
1206 "\M-g" gnus-summary-rescan-group
1207 "w" gnus-summary-stop-page-breaking
1208 "\C-c\C-r" gnus-summary-caesar-message
1209 "\M-t" gnus-summary-toggle-mime
1210 "f" gnus-summary-followup
1211 "F" gnus-summary-followup-with-original
1212 "C" gnus-summary-cancel-article
1213 "r" gnus-summary-reply
1214 "R" gnus-summary-reply-with-original
1215 "\C-c\C-f" gnus-summary-mail-forward
1216 "o" gnus-summary-save-article
1217 "\C-o" gnus-summary-save-article-mail
1218 "|" gnus-summary-pipe-output
1219 "\M-k" gnus-summary-edit-local-kill
1220 "\M-K" gnus-summary-edit-global-kill
1222 "\C-c\C-d" gnus-summary-describe-group
1223 "q" gnus-summary-exit
1224 "Q" gnus-summary-exit-no-update
1225 "\C-c\C-i" gnus-info-find-node
1226 gnus-mouse-2 gnus-mouse-pick-article
1227 "m" gnus-summary-mail-other-window
1228 "a" gnus-summary-post-news
1229 "x" gnus-summary-limit-to-unread
1230 "s" gnus-summary-isearch-article
1231 "t" gnus-article-hide-headers
1232 "g" gnus-summary-show-article
1233 "l" gnus-summary-goto-last-article
1234 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1235 "\C-d" gnus-summary-enter-digest-group
1236 "\M-\C-d" gnus-summary-read-document
1238 "*" gnus-cache-enter-article
1239 "\M-*" gnus-cache-remove-article
1240 "\M-&" gnus-summary-universal-argument
1241 "\C-l" gnus-recenter
1242 "I" gnus-summary-increase-score
1243 "L" gnus-summary-lower-score
1245 "V" gnus-summary-score-map
1246 "X" gnus-uu-extract-map
1247 "S" gnus-summary-send-map)
1249 ;; Sort of orthogonal keymap
1250 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1251 "t" gnus-summary-tick-article-forward
1252 "!" gnus-summary-tick-article-forward
1253 "d" gnus-summary-mark-as-read-forward
1254 "r" gnus-summary-mark-as-read-forward
1255 "c" gnus-summary-clear-mark-forward
1256 " " gnus-summary-clear-mark-forward
1257 "e" gnus-summary-mark-as-expirable
1258 "x" gnus-summary-mark-as-expirable
1259 "?" gnus-summary-mark-as-dormant
1260 "b" gnus-summary-set-bookmark
1261 "B" gnus-summary-remove-bookmark
1262 "#" gnus-summary-mark-as-processable
1263 "\M-#" gnus-summary-unmark-as-processable
1264 "S" gnus-summary-limit-include-expunged
1265 "C" gnus-summary-catchup
1266 "H" gnus-summary-catchup-to-here
1267 "\C-c" gnus-summary-catchup-all
1268 "k" gnus-summary-kill-same-subject-and-select
1269 "K" gnus-summary-kill-same-subject
1270 "P" gnus-uu-mark-map)
1272 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1273 "c" gnus-summary-clear-above
1274 "u" gnus-summary-tick-above
1275 "m" gnus-summary-mark-above
1276 "k" gnus-summary-kill-below)
1278 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1279 "/" gnus-summary-limit-to-subject
1280 "n" gnus-summary-limit-to-articles
1281 "w" gnus-summary-pop-limit
1282 "s" gnus-summary-limit-to-subject
1283 "a" gnus-summary-limit-to-author
1284 "u" gnus-summary-limit-to-unread
1285 "m" gnus-summary-limit-to-marks
1286 "v" gnus-summary-limit-to-score
1287 "D" gnus-summary-limit-include-dormant
1288 "d" gnus-summary-limit-exclude-dormant
1289 "t" gnus-summary-limit-to-age
1290 "E" gnus-summary-limit-include-expunged
1291 "c" gnus-summary-limit-exclude-childless-dormant
1292 "C" gnus-summary-limit-mark-excluded-as-read)
1294 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1295 "n" gnus-summary-next-unread-article
1296 "p" gnus-summary-prev-unread-article
1297 "N" gnus-summary-next-article
1298 "P" gnus-summary-prev-article
1299 "\C-n" gnus-summary-next-same-subject
1300 "\C-p" gnus-summary-prev-same-subject
1301 "\M-n" gnus-summary-next-unread-subject
1302 "\M-p" gnus-summary-prev-unread-subject
1303 "f" gnus-summary-first-unread-article
1304 "b" gnus-summary-best-unread-article
1305 "j" gnus-summary-goto-article
1306 "g" gnus-summary-goto-subject
1307 "l" gnus-summary-goto-last-article
1308 "p" gnus-summary-pop-article)
1310 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1311 "k" gnus-summary-kill-thread
1312 "l" gnus-summary-lower-thread
1313 "i" gnus-summary-raise-thread
1314 "T" gnus-summary-toggle-threads
1315 "t" gnus-summary-rethread-current
1316 "^" gnus-summary-reparent-thread
1317 "s" gnus-summary-show-thread
1318 "S" gnus-summary-show-all-threads
1319 "h" gnus-summary-hide-thread
1320 "H" gnus-summary-hide-all-threads
1321 "n" gnus-summary-next-thread
1322 "p" gnus-summary-prev-thread
1323 "u" gnus-summary-up-thread
1324 "o" gnus-summary-top-thread
1325 "d" gnus-summary-down-thread
1326 "#" gnus-uu-mark-thread
1327 "\M-#" gnus-uu-unmark-thread)
1329 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1330 "g" gnus-summary-prepare
1331 "c" gnus-summary-insert-cached-articles)
1333 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1334 "c" gnus-summary-catchup-and-exit
1335 "C" gnus-summary-catchup-all-and-exit
1336 "E" gnus-summary-exit-no-update
1337 "Q" gnus-summary-exit
1338 "Z" gnus-summary-exit
1339 "n" gnus-summary-catchup-and-goto-next-group
1340 "R" gnus-summary-reselect-current-group
1341 "G" gnus-summary-rescan-group
1342 "N" gnus-summary-next-group
1343 "s" gnus-summary-save-newsrc
1344 "P" gnus-summary-prev-group)
1346 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1347 " " gnus-summary-next-page
1348 "n" gnus-summary-next-page
1349 "\177" gnus-summary-prev-page
1350 [delete] gnus-summary-prev-page
1351 "p" gnus-summary-prev-page
1352 "\r" gnus-summary-scroll-up
1353 "<" gnus-summary-beginning-of-article
1354 ">" gnus-summary-end-of-article
1355 "b" gnus-summary-beginning-of-article
1356 "e" gnus-summary-end-of-article
1357 "^" gnus-summary-refer-parent-article
1358 "r" gnus-summary-refer-parent-article
1359 "R" gnus-summary-refer-references
1360 "g" gnus-summary-show-article
1361 "s" gnus-summary-isearch-article
1362 "P" gnus-summary-print-article)
1364 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1365 "b" gnus-article-add-buttons
1366 "B" gnus-article-add-buttons-to-head
1367 "o" gnus-article-treat-overstrike
1368 "e" gnus-article-emphasize
1369 "w" gnus-article-fill-cited-article
1370 "c" gnus-article-remove-cr
1371 "q" gnus-article-de-quoted-unreadable
1372 "f" gnus-article-display-x-face
1373 "l" gnus-summary-stop-page-breaking
1374 "r" gnus-summary-caesar-message
1375 "t" gnus-article-hide-headers
1376 "v" gnus-summary-verbose-headers
1377 "m" gnus-summary-toggle-mime)
1379 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1380 "a" gnus-article-hide
1381 "h" gnus-article-hide-headers
1382 "b" gnus-article-hide-boring-headers
1383 "s" gnus-article-hide-signature
1384 "c" gnus-article-hide-citation
1385 "p" gnus-article-hide-pgp
1386 "P" gnus-article-hide-pem
1387 "\C-c" gnus-article-hide-citation-maybe)
1389 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1390 "a" gnus-article-highlight
1391 "h" gnus-article-highlight-headers
1392 "c" gnus-article-highlight-citation
1393 "s" gnus-article-highlight-signature)
1395 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1396 "z" gnus-article-date-ut
1397 "u" gnus-article-date-ut
1398 "l" gnus-article-date-local
1399 "e" gnus-article-date-lapsed
1400 "o" gnus-article-date-original
1401 "s" gnus-article-date-user)
1403 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1404 "t" gnus-article-remove-trailing-blank-lines
1405 "l" gnus-article-strip-leading-blank-lines
1406 "m" gnus-article-strip-multiple-blank-lines
1407 "a" gnus-article-strip-blank-lines)
1409 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1411 "f" gnus-summary-fetch-faq
1412 "d" gnus-summary-describe-group
1413 "h" gnus-summary-describe-briefly
1414 "i" gnus-info-find-node)
1416 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1417 "e" gnus-summary-expire-articles
1418 "\M-\C-e" gnus-summary-expire-articles-now
1419 "\177" gnus-summary-delete-article
1420 [delete] gnus-summary-delete-article
1421 "m" gnus-summary-move-article
1422 "r" gnus-summary-respool-article
1423 "w" gnus-summary-edit-article
1424 "c" gnus-summary-copy-article
1425 "B" gnus-summary-crosspost-article
1426 "q" gnus-summary-respool-query
1427 "i" gnus-summary-import-article
1428 "p" gnus-summary-article-posted-p)
1430 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1431 "o" gnus-summary-save-article
1432 "m" gnus-summary-save-article-mail
1433 "F" gnus-summary-write-article-file
1434 "r" gnus-summary-save-article-rmail
1435 "f" gnus-summary-save-article-file
1436 "b" gnus-summary-save-article-body-file
1437 "h" gnus-summary-save-article-folder
1438 "v" gnus-summary-save-article-vm
1439 "p" gnus-summary-pipe-output
1440 "s" gnus-soup-add-article))
1442 (defun gnus-summary-make-menu-bar ()
1443 (gnus-turn-off-edit-menu 'summary)
1445 (unless (boundp 'gnus-summary-misc-menu)
1448 gnus-summary-kill-menu gnus-summary-mode-map ""
1453 ["Enter score..." gnus-summary-score-entry t]
1454 ["Customize" gnus-score-customize t])
1455 (gnus-make-score-map 'increase)
1456 (gnus-make-score-map 'lower)
1458 ["Kill below" gnus-summary-kill-below t]
1459 ["Mark above" gnus-summary-mark-above t]
1460 ["Tick above" gnus-summary-tick-above t]
1461 ["Clear above" gnus-summary-clear-above t])
1462 ["Current score" gnus-summary-current-score t]
1463 ["Set score" gnus-summary-set-score t]
1464 ["Switch current score file..." gnus-score-change-score-file t]
1465 ["Set mark below..." gnus-score-set-mark-below t]
1466 ["Set expunge below..." gnus-score-set-expunge-below t]
1467 ["Edit current score file" gnus-score-edit-current-scores t]
1468 ["Edit score file" gnus-score-edit-file t]
1469 ["Trace score" gnus-score-find-trace t]
1470 ["Find words" gnus-score-find-favourite-words t]
1471 ["Rescore buffer" gnus-summary-rescore t]
1472 ["Increase score..." gnus-summary-increase-score t]
1473 ["Lower score..." gnus-summary-lower-score t]))))
1476 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1478 :selected (null gnus-score-default-header)]
1479 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1481 :selected (eq gnus-score-default-header 'a)]
1482 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1484 :selected (eq gnus-score-default-header 's)]
1486 (gnus-score-set-default 'gnus-score-default-header 'b)
1488 :selected (eq gnus-score-default-header 'b )]
1490 (gnus-score-set-default 'gnus-score-default-header 'h)
1492 :selected (eq gnus-score-default-header 'h )]
1493 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1495 :selected (eq gnus-score-default-header 'i )]
1496 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1498 :selected (eq gnus-score-default-header 't )]
1500 (gnus-score-set-default 'gnus-score-default-header 'x)
1502 :selected (eq gnus-score-default-header 'x )]
1503 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1505 :selected (eq gnus-score-default-header 'l )]
1506 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1508 :selected (eq gnus-score-default-header 'd )]
1509 ["Followups to author"
1510 (gnus-score-set-default 'gnus-score-default-header 'f)
1512 :selected (eq gnus-score-default-header 'f )])
1514 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1516 :selected (null gnus-score-default-type)]
1517 ;; The `:active' key is commented out in the following,
1518 ;; because the GNU Emacs hack to support radio buttons use
1519 ;; active to indicate which button is selected.
1520 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1522 ;; :active (not (memq gnus-score-default-header '(l d)))
1523 :selected (eq gnus-score-default-type 's)]
1524 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1526 ;; :active (not (memq gnus-score-default-header '(l d)))
1527 :selected (eq gnus-score-default-type 'r)]
1528 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1530 ;; :active (not (memq gnus-score-default-header '(l d)))
1531 :selected (eq gnus-score-default-type 'e)]
1532 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1534 ;; :active (not (memq gnus-score-default-header '(l d)))
1535 :selected (eq gnus-score-default-type 'f)]
1536 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1538 ;; :active (eq (gnus-score-default-header 'd))
1539 :selected (eq gnus-score-default-type 'b)]
1540 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1542 ;; :active (eq (gnus-score-default-header 'd))
1543 :selected (eq gnus-score-default-type 'n)]
1544 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1546 ;; :active (eq (gnus-score-default-header 'd))
1547 :selected (eq gnus-score-default-type 'a)]
1549 (gnus-score-set-default 'gnus-score-default-type '<)
1551 ;; :active (eq (gnus-score-default-header 'l))
1552 :selected (eq gnus-score-default-type '<)]
1554 (gnus-score-set-default 'gnus-score-default-type '=)
1556 ;; :active (eq (gnus-score-default-header 'l))
1557 :selected (eq gnus-score-default-type '=)]
1558 ["Greater than number"
1559 (gnus-score-set-default 'gnus-score-default-type '>)
1561 ;; :active (eq (gnus-score-default-header 'l))
1562 :selected (eq gnus-score-default-type '>)])
1563 ["Default fold" gnus-score-default-fold-toggle
1565 :selected gnus-score-default-fold]
1567 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1569 :selected (null gnus-score-default-duration)]
1571 (gnus-score-set-default 'gnus-score-default-duration 'p)
1573 :selected (eq gnus-score-default-duration 'p)]
1575 (gnus-score-set-default 'gnus-score-default-duration 't)
1577 :selected (eq gnus-score-default-duration 't)]
1579 (gnus-score-set-default 'gnus-score-default-duration 'i)
1581 :selected (eq gnus-score-default-duration 'i)]))
1584 gnus-summary-article-menu gnus-summary-mode-map ""
1587 ["All" gnus-article-hide t]
1588 ["Headers" gnus-article-hide-headers t]
1589 ["Signature" gnus-article-hide-signature t]
1590 ["Citation" gnus-article-hide-citation t]
1591 ["PGP" gnus-article-hide-pgp t]
1592 ["Boring headers" gnus-article-hide-boring-headers t])
1594 ["All" gnus-article-highlight t]
1595 ["Headers" gnus-article-highlight-headers t]
1596 ["Signature" gnus-article-highlight-signature t]
1597 ["Citation" gnus-article-highlight-citation t])
1599 ["Local" gnus-article-date-local t]
1600 ["UT" gnus-article-date-ut t]
1601 ["Original" gnus-article-date-original t]
1602 ["Lapsed" gnus-article-date-lapsed t]
1603 ["User-defined" gnus-article-date-user t])
1606 ["Leading" gnus-article-strip-leading-blank-lines t]
1607 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1608 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1609 ["All of the above" gnus-article-strip-blank-lines t])
1610 ["Overstrike" gnus-article-treat-overstrike t]
1611 ["Emphasis" gnus-article-emphasize t]
1612 ["Word wrap" gnus-article-fill-cited-article t]
1613 ["CR" gnus-article-remove-cr t]
1614 ["Show X-Face" gnus-article-display-x-face t]
1615 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1616 ["Rot 13" gnus-summary-caesar-message t]
1617 ["Unix pipe" gnus-summary-pipe-message t]
1618 ["Add buttons" gnus-article-add-buttons t]
1619 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1620 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1621 ["Toggle MIME" gnus-summary-toggle-mime t]
1622 ["Verbose header" gnus-summary-verbose-headers t]
1623 ["Toggle header" gnus-summary-toggle-header t])
1625 ["Save in default format" gnus-summary-save-article t]
1626 ["Save in file" gnus-summary-save-article-file t]
1627 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1628 ["Write to file" gnus-summary-write-article-mail t]
1629 ["Save in MH folder" gnus-summary-save-article-folder t]
1630 ["Save in VM folder" gnus-summary-save-article-vm t]
1631 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1632 ["Save body in file" gnus-summary-save-article-body-file t]
1633 ["Pipe through a filter" gnus-summary-pipe-output t]
1634 ["Add to SOUP packet" gnus-soup-add-article t]
1635 ["Print" gnus-summary-print-article t])
1637 ["Respool article..." gnus-summary-respool-article t]
1638 ["Move article..." gnus-summary-move-article
1639 (gnus-check-backend-function
1640 'request-move-article gnus-newsgroup-name)]
1641 ["Copy article..." gnus-summary-copy-article t]
1642 ["Crosspost article..." gnus-summary-crosspost-article
1643 (gnus-check-backend-function
1644 'request-replace-article gnus-newsgroup-name)]
1645 ["Import file..." gnus-summary-import-article t]
1646 ["Check if posted" gnus-summary-article-posted-p t]
1647 ["Edit article" gnus-summary-edit-article
1648 (not (gnus-group-read-only-p))]
1649 ["Delete article" gnus-summary-delete-article
1650 (gnus-check-backend-function
1651 'request-expire-articles gnus-newsgroup-name)]
1652 ["Query respool" gnus-summary-respool-query t]
1653 ["Delete expirable articles" gnus-summary-expire-articles-now
1654 (gnus-check-backend-function
1655 'request-expire-articles gnus-newsgroup-name)])
1657 ["Uudecode" gnus-uu-decode-uu t]
1658 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1659 ["Unshar" gnus-uu-decode-unshar t]
1660 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1661 ["Save" gnus-uu-decode-save t]
1662 ["Binhex" gnus-uu-decode-binhex t]
1663 ["Postscript" gnus-uu-decode-postscript t])
1665 ["Enter article" gnus-cache-enter-article t]
1666 ["Remove article" gnus-cache-remove-article t])
1667 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1668 ["Isearch article..." gnus-summary-isearch-article t]
1669 ["Search articles forward..." gnus-summary-search-article-forward t]
1670 ["Search articles backward..." gnus-summary-search-article-backward t]
1671 ["Beginning of the article" gnus-summary-beginning-of-article t]
1672 ["End of the article" gnus-summary-end-of-article t]
1673 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1674 ["Fetch referenced articles" gnus-summary-refer-references t]
1675 ["Fetch article with id..." gnus-summary-refer-article t]
1676 ["Redisplay" gnus-summary-show-article t]))
1679 gnus-summary-thread-menu gnus-summary-mode-map ""
1681 ["Toggle threading" gnus-summary-toggle-threads t]
1682 ["Hide threads" gnus-summary-hide-all-threads t]
1683 ["Show threads" gnus-summary-show-all-threads t]
1684 ["Hide thread" gnus-summary-hide-thread t]
1685 ["Show thread" gnus-summary-show-thread t]
1686 ["Go to next thread" gnus-summary-next-thread t]
1687 ["Go to previous thread" gnus-summary-prev-thread t]
1688 ["Go down thread" gnus-summary-down-thread t]
1689 ["Go up thread" gnus-summary-up-thread t]
1690 ["Top of thread" gnus-summary-top-thread t]
1691 ["Mark thread as read" gnus-summary-kill-thread t]
1692 ["Lower thread score" gnus-summary-lower-thread t]
1693 ["Raise thread score" gnus-summary-raise-thread t]
1694 ["Rethread current" gnus-summary-rethread-current t]
1698 gnus-summary-post-menu gnus-summary-mode-map ""
1700 ["Post an article" gnus-summary-post-news t]
1701 ["Followup" gnus-summary-followup t]
1702 ["Followup and yank" gnus-summary-followup-with-original t]
1703 ["Supersede article" gnus-summary-supersede-article t]
1704 ["Cancel article" gnus-summary-cancel-article t]
1705 ["Reply" gnus-summary-reply t]
1706 ["Reply and yank" gnus-summary-reply-with-original t]
1707 ["Wide reply" gnus-summary-wide-reply t]
1708 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1709 ["Mail forward" gnus-summary-mail-forward t]
1710 ["Post forward" gnus-summary-post-forward t]
1711 ["Digest and mail" gnus-uu-digest-mail-forward t]
1712 ["Digest and post" gnus-uu-digest-post-forward t]
1713 ["Resend message" gnus-summary-resend-message t]
1714 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1715 ["Send a mail" gnus-summary-mail-other-window t]
1716 ["Uuencode and post" gnus-uu-post-news t]
1717 ["Followup via news" gnus-summary-followup-to-mail t]
1718 ["Followup via news and yank"
1719 gnus-summary-followup-to-mail-with-original t]
1721 ;;["Send" gnus-summary-send-draft t]
1722 ;;["Send bounced" gnus-resend-bounced-mail t])
1726 gnus-summary-misc-menu gnus-summary-mode-map ""
1729 ["Mark as read" gnus-summary-mark-as-read-forward t]
1730 ["Mark same subject and select"
1731 gnus-summary-kill-same-subject-and-select t]
1732 ["Mark same subject" gnus-summary-kill-same-subject t]
1733 ["Catchup" gnus-summary-catchup t]
1734 ["Catchup all" gnus-summary-catchup-all t]
1735 ["Catchup to here" gnus-summary-catchup-to-here t]
1736 ["Catchup region" gnus-summary-mark-region-as-read t]
1737 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1739 ["Tick" gnus-summary-tick-article-forward t]
1740 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1741 ["Remove marks" gnus-summary-clear-mark-forward t]
1742 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1743 ["Set bookmark" gnus-summary-set-bookmark t]
1744 ["Remove bookmark" gnus-summary-remove-bookmark t])
1746 ["Marks..." gnus-summary-limit-to-marks t]
1747 ["Subject..." gnus-summary-limit-to-subject t]
1748 ["Author..." gnus-summary-limit-to-author t]
1749 ["Age..." gnus-summary-limit-to-age t]
1750 ["Score" gnus-summary-limit-to-score t]
1751 ["Unread" gnus-summary-limit-to-unread t]
1752 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1753 ["Articles" gnus-summary-limit-to-articles t]
1754 ["Pop limit" gnus-summary-pop-limit t]
1755 ["Show dormant" gnus-summary-limit-include-dormant t]
1756 ["Hide childless dormant"
1757 gnus-summary-limit-exclude-childless-dormant t]
1758 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1759 ["Show expunged" gnus-summary-show-all-expunged t])
1761 ["Set mark" gnus-summary-mark-as-processable t]
1762 ["Remove mark" gnus-summary-unmark-as-processable t]
1763 ["Remove all marks" gnus-summary-unmark-all-processable t]
1764 ["Mark above" gnus-uu-mark-over t]
1765 ["Mark series" gnus-uu-mark-series t]
1766 ["Mark region" gnus-uu-mark-region t]
1767 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1768 ["Mark all" gnus-uu-mark-all t]
1769 ["Mark buffer" gnus-uu-mark-buffer t]
1770 ["Mark sparse" gnus-uu-mark-sparse t]
1771 ["Mark thread" gnus-uu-mark-thread t]
1772 ["Unmark thread" gnus-uu-unmark-thread t]
1773 ("Process Mark Sets"
1774 ["Kill" gnus-summary-kill-process-mark t]
1775 ["Yank" gnus-summary-yank-process-mark
1776 gnus-newsgroup-process-stack]
1777 ["Save" gnus-summary-save-process-mark t]))
1779 ["Page forward" gnus-summary-next-page t]
1780 ["Page backward" gnus-summary-prev-page t]
1781 ["Line forward" gnus-summary-scroll-up t])
1783 ["Next unread article" gnus-summary-next-unread-article t]
1784 ["Previous unread article" gnus-summary-prev-unread-article t]
1785 ["Next article" gnus-summary-next-article t]
1786 ["Previous article" gnus-summary-prev-article t]
1787 ["Next unread subject" gnus-summary-next-unread-subject t]
1788 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1789 ["Next article same subject" gnus-summary-next-same-subject t]
1790 ["Previous article same subject" gnus-summary-prev-same-subject t]
1791 ["First unread article" gnus-summary-first-unread-article t]
1792 ["Best unread article" gnus-summary-best-unread-article t]
1793 ["Go to subject number..." gnus-summary-goto-subject t]
1794 ["Go to article number..." gnus-summary-goto-article t]
1795 ["Go to the last article" gnus-summary-goto-last-article t]
1796 ["Pop article off history" gnus-summary-pop-article t])
1798 ["Sort by number" gnus-summary-sort-by-number t]
1799 ["Sort by author" gnus-summary-sort-by-author t]
1800 ["Sort by subject" gnus-summary-sort-by-subject t]
1801 ["Sort by date" gnus-summary-sort-by-date t]
1802 ["Sort by score" gnus-summary-sort-by-score t]
1803 ["Sort by lines" gnus-summary-sort-by-lines t])
1805 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1806 ["Describe group" gnus-summary-describe-group t]
1807 ["Read manual" gnus-info-find-node t])
1809 ["Pick and read" gnus-pick-mode t]
1810 ["Binary" gnus-binary-mode t])
1812 ["Regenerate" gnus-summary-prepare t]
1813 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1814 ["Toggle threading" gnus-summary-toggle-threads t])
1815 ["Filter articles..." gnus-summary-execute-command t]
1816 ["Run command on subjects..." gnus-summary-universal-argument t]
1817 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1818 ["Expand window" gnus-summary-expand-window t]
1819 ["Expire expirable articles" gnus-summary-expire-articles
1820 (gnus-check-backend-function
1821 'request-expire-articles gnus-newsgroup-name)]
1822 ["Edit local kill file" gnus-summary-edit-local-kill t]
1823 ["Edit main kill file" gnus-summary-edit-global-kill t]
1825 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1826 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1827 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1828 ["Exit group" gnus-summary-exit t]
1829 ["Exit group without updating" gnus-summary-exit-no-update t]
1830 ["Exit and goto next group" gnus-summary-next-group t]
1831 ["Exit and goto prev group" gnus-summary-prev-group t]
1832 ["Reselect group" gnus-summary-reselect-current-group t]
1833 ["Rescan group" gnus-summary-rescan-group t]
1834 ["Update dribble" gnus-summary-save-newsrc t])))
1836 (run-hooks 'gnus-summary-menu-hook)))
1838 (defun gnus-score-set-default (var value)
1839 "A version of set that updates the GNU Emacs menu-bar."
1841 ;; It is the message that forces the active status to be updated.
1844 (defun gnus-make-score-map (type)
1845 "Make a summary score map of type TYPE."
1848 (let ((headers '(("author" "from" string)
1849 ("subject" "subject" string)
1850 ("article body" "body" string)
1851 ("article head" "head" string)
1852 ("xref" "xref" string)
1853 ("lines" "lines" number)
1854 ("followups to author" "followup" string)))
1855 (types '((number ("less than" <)
1858 (string ("substring" s)
1862 (perms '(("temporary" (current-time-string))
1870 (if (eq type 'lower)
1875 (setq header (car headers))
1881 (let ((ts (cdr (assoc (nth 2 header) types)))
1897 'gnus-summary-score-entry
1899 (if (or (string= (nth 1 header)
1901 (string= (nth 1 header)
1904 (list 'gnus-summary-header
1906 (list 'quote (nth 1 (car ts)))
1907 (list 'gnus-score-default nil)
1913 (list (nreverse outp))))
1916 (list (nreverse outt))))
1918 (setq headers (cdr headers)))
1919 (list (nreverse outh))))))))
1923 (defun gnus-summary-mode (&optional group)
1924 "Major mode for reading articles.
1926 All normal editing commands are switched off.
1927 \\<gnus-summary-mode-map>
1928 Each line in this buffer represents one article. To read an
1929 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1930 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1933 You can also post articles and send mail from this buffer. To
1934 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1935 of an article, type `\\[gnus-summary-reply]'.
1937 There are approx. one gazillion commands you can execute in this
1938 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1940 The following commands are available:
1942 \\{gnus-summary-mode-map}"
1944 (when (gnus-visual-p 'summary-menu 'menu)
1945 (gnus-summary-make-menu-bar))
1946 (kill-all-local-variables)
1947 (gnus-summary-make-local-variables)
1948 (gnus-make-thread-indent-array)
1949 (gnus-simplify-mode-line)
1950 (setq major-mode 'gnus-summary-mode)
1951 (setq mode-name "Summary")
1952 (make-local-variable 'minor-mode-alist)
1953 (use-local-map gnus-summary-mode-map)
1954 (buffer-disable-undo (current-buffer))
1955 (setq buffer-read-only t) ;Disable modification
1956 (setq truncate-lines t)
1957 (setq selective-display t)
1958 (setq selective-display-ellipses t) ;Display `...'
1959 (setq buffer-display-table gnus-summary-display-table)
1960 (gnus-set-default-directory)
1961 (setq gnus-newsgroup-name group)
1962 (make-local-variable 'gnus-summary-line-format)
1963 (make-local-variable 'gnus-summary-line-format-spec)
1964 (make-local-variable 'gnus-summary-mark-positions)
1965 (gnus-make-local-hook 'post-command-hook)
1966 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1967 (run-hooks 'gnus-summary-mode-hook)
1968 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1969 (gnus-update-summary-mark-positions))
1971 (defun gnus-summary-make-local-variables ()
1972 "Make all the local summary buffer variables."
1973 (let ((locals gnus-summary-local-variables)
1975 (while (setq local (pop locals))
1978 (if (eq (cdr local) 'global)
1979 ;; Copy the global value of the variable.
1980 (setq global (symbol-value (car local)))
1981 ;; Use the value from the list.
1982 (setq global (eval (cdr local))))
1983 (make-local-variable (car local))
1984 (set (car local) global))
1985 ;; Simple nil-valued local variable.
1986 (make-local-variable local)
1989 (defun gnus-summary-clear-local-variables ()
1990 (let ((locals gnus-summary-local-variables))
1992 (if (consp (car locals))
1993 (and (vectorp (caar locals))
1994 (set (caar locals) nil))
1995 (and (vectorp (car locals))
1996 (set (car locals) nil)))
1997 (setq locals (cdr locals)))))
1999 ;; Summary data functions.
2001 (defmacro gnus-data-number (data)
2004 (defmacro gnus-data-set-number (data number)
2005 `(setcar ,data ,number))
2007 (defmacro gnus-data-mark (data)
2010 (defmacro gnus-data-set-mark (data mark)
2011 `(setcar (nthcdr 1 ,data) ,mark))
2013 (defmacro gnus-data-pos (data)
2016 (defmacro gnus-data-set-pos (data pos)
2017 `(setcar (nthcdr 2 ,data) ,pos))
2019 (defmacro gnus-data-header (data)
2022 (defmacro gnus-data-level (data)
2025 (defmacro gnus-data-unread-p (data)
2026 `(= (nth 1 ,data) gnus-unread-mark))
2028 (defmacro gnus-data-read-p (data)
2029 `(/= (nth 1 ,data) gnus-unread-mark))
2031 (defmacro gnus-data-pseudo-p (data)
2032 `(consp (nth 3 ,data)))
2034 (defmacro gnus-data-find (number)
2035 `(assq ,number gnus-newsgroup-data))
2037 (defmacro gnus-data-find-list (number &optional data)
2038 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2039 (memq (assq ,number bdata)
2042 (defmacro gnus-data-make (number mark pos header level)
2043 `(list ,number ,mark ,pos ,header ,level))
2045 (defun gnus-data-enter (after-article number mark pos header level offset)
2046 (let ((data (gnus-data-find-list after-article)))
2048 (error "No such article: %d" after-article))
2049 (setcdr data (cons (gnus-data-make number mark pos header level)
2051 (setq gnus-newsgroup-data-reverse nil)
2052 (gnus-data-update-list (cddr data) offset)))
2054 (defun gnus-data-enter-list (after-article list &optional offset)
2056 (let ((data (and after-article (gnus-data-find-list after-article)))
2058 (or data (not after-article) (error "No such article: %d" after-article))
2059 ;; Find the last element in the list to be spliced into the main
2062 (setq list (cdr list)))
2065 (setcdr list gnus-newsgroup-data)
2066 (setq gnus-newsgroup-data ilist)
2068 (gnus-data-update-list (cdr list) offset)))
2069 (setcdr list (cdr data))
2072 (gnus-data-update-list (cdr list) offset)))
2073 (setq gnus-newsgroup-data-reverse nil))))
2075 (defun gnus-data-remove (article &optional offset)
2076 (let ((data gnus-newsgroup-data))
2077 (if (= (gnus-data-number (car data)) article)
2079 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2080 gnus-newsgroup-data-reverse nil)
2082 (gnus-data-update-list gnus-newsgroup-data offset)))
2084 (when (= (gnus-data-number (cadr data)) article)
2085 (setcdr data (cddr data))
2087 (gnus-data-update-list (cdr data) offset))
2089 gnus-newsgroup-data-reverse nil))
2090 (setq data (cdr data))))))
2092 (defmacro gnus-data-list (backward)
2094 (or gnus-newsgroup-data-reverse
2095 (setq gnus-newsgroup-data-reverse
2096 (reverse gnus-newsgroup-data)))
2097 gnus-newsgroup-data))
2099 (defun gnus-data-update-list (data offset)
2100 "Add OFFSET to the POS of all data entries in DATA."
2102 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2103 (setq data (cdr data))))
2105 (defun gnus-data-compute-positions ()
2106 "Compute the positions of all articles."
2107 (let ((data gnus-newsgroup-data)
2110 (when (setq pos (text-property-any
2111 (point-min) (point-max)
2112 'gnus-number (gnus-data-number (car data))))
2113 (gnus-data-set-pos (car data) (+ pos 3)))
2114 (setq data (cdr data)))))
2116 (defun gnus-summary-article-pseudo-p (article)
2117 "Say whether this article is a pseudo article or not."
2118 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2120 (defmacro gnus-summary-article-sparse-p (article)
2121 "Say whether this article is a sparse article or not."
2122 ` (memq ,article gnus-newsgroup-sparse))
2124 (defmacro gnus-summary-article-ancient-p (article)
2125 "Say whether this article is a sparse article or not."
2126 `(memq ,article gnus-newsgroup-ancient))
2128 (defun gnus-article-parent-p (number)
2129 "Say whether this article is a parent or not."
2130 (let ((data (gnus-data-find-list number)))
2131 (and (cdr data) ; There has to be an article after...
2132 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2133 (gnus-data-level (nth 1 data))))))
2135 (defun gnus-article-children (number)
2136 "Return a list of all children to NUMBER."
2137 (let* ((data (gnus-data-find-list number))
2138 (level (gnus-data-level (car data)))
2140 (setq data (cdr data))
2142 (= (gnus-data-level (car data)) (1+ level)))
2143 (push (gnus-data-number (car data)) children)
2144 (setq data (cdr data)))
2147 (defmacro gnus-summary-skip-intangible ()
2148 "If the current article is intangible, then jump to a different article."
2149 '(let ((to (get-text-property (point) 'gnus-intangible)))
2150 (and to (gnus-summary-goto-subject to))))
2152 (defmacro gnus-summary-article-intangible-p ()
2153 "Say whether this article is intangible or not."
2154 '(get-text-property (point) 'gnus-intangible))
2156 (defun gnus-article-read-p (article)
2157 "Say whether ARTICLE is read or not."
2158 (not (or (memq article gnus-newsgroup-marked)
2159 (memq article gnus-newsgroup-unreads)
2160 (memq article gnus-newsgroup-unselected)
2161 (memq article gnus-newsgroup-dormant))))
2163 ;; Some summary mode macros.
2165 (defmacro gnus-summary-article-number ()
2166 "The article number of the article on the current line.
2167 If there isn's an article number here, then we return the current
2170 (gnus-summary-skip-intangible)
2171 (or (get-text-property (point) 'gnus-number)
2172 (gnus-summary-last-subject))))
2174 (defmacro gnus-summary-article-header (&optional number)
2175 `(gnus-data-header (gnus-data-find
2176 ,(or number '(gnus-summary-article-number)))))
2178 (defmacro gnus-summary-thread-level (&optional number)
2179 `(if (and (eq gnus-summary-make-false-root 'dummy)
2180 (get-text-property (point) 'gnus-intangible))
2182 (gnus-data-level (gnus-data-find
2183 ,(or number '(gnus-summary-article-number))))))
2185 (defmacro gnus-summary-article-mark (&optional number)
2186 `(gnus-data-mark (gnus-data-find
2187 ,(or number '(gnus-summary-article-number)))))
2189 (defmacro gnus-summary-article-pos (&optional number)
2190 `(gnus-data-pos (gnus-data-find
2191 ,(or number '(gnus-summary-article-number)))))
2193 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2194 (defmacro gnus-summary-article-subject (&optional number)
2195 "Return current subject string or nil if nothing."
2198 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2199 '(gnus-data-header (assq (gnus-summary-article-number)
2200 gnus-newsgroup-data)))))
2203 (mail-header-subject headers))))
2205 (defmacro gnus-summary-article-score (&optional number)
2206 "Return current article score."
2207 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2208 gnus-newsgroup-scored))
2209 gnus-summary-default-score 0))
2211 (defun gnus-summary-article-children (&optional number)
2212 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2213 (level (gnus-data-level (car data)))
2215 (while (and (setq data (cdr data))
2216 (> (setq l (gnus-data-level (car data))) level))
2217 (and (= (1+ level) l)
2218 (push (gnus-data-number (car data))
2220 (nreverse children)))
2222 (defun gnus-summary-article-parent (&optional number)
2223 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2224 (gnus-data-list t)))
2225 (level (gnus-data-level (car data))))
2227 () ; This is a root.
2228 ;; We search until we find an article with a level less than
2229 ;; this one. That function has to be the parent.
2230 (while (and (setq data (cdr data))
2231 (not (< (gnus-data-level (car data)) level))))
2232 (and data (gnus-data-number (car data))))))
2234 (defun gnus-unread-mark-p (mark)
2235 "Say whether MARK is the unread mark."
2236 (= mark gnus-unread-mark))
2238 (defun gnus-read-mark-p (mark)
2239 "Say whether MARK is one of the marks that mark as read.
2240 This is all marks except unread, ticked, dormant, and expirable."
2241 (not (or (= mark gnus-unread-mark)
2242 (= mark gnus-ticked-mark)
2243 (= mark gnus-dormant-mark)
2244 (= mark gnus-expirable-mark))))
2246 (defmacro gnus-article-mark (number)
2248 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2249 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2250 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2251 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2252 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2253 gnus-ancient-mark))))
2255 ;; Saving hidden threads.
2257 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2258 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2260 (defmacro gnus-save-hidden-threads (&rest forms)
2261 "Save hidden threads, eval FORMS, and restore the hidden threads."
2262 (let ((config (make-symbol "config")))
2263 `(let ((,config (gnus-hidden-threads-configuration)))
2267 (gnus-restore-hidden-threads-configuration ,config)))))
2269 (defun gnus-hidden-threads-configuration ()
2270 "Return the current hidden threads configuration."
2273 (goto-char (point-min))
2274 (while (search-forward "\r" nil t)
2275 (push (1- (point)) config))
2278 (defun gnus-restore-hidden-threads-configuration (config)
2279 "Restore hidden threads configuration from CONFIG."
2280 (let (point buffer-read-only)
2281 (while (setq point (pop config))
2282 (when (and (< point (point-max))
2284 (= (following-char) ?\n))
2285 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2287 ;; Various summary mode internalish functions.
2289 (defun gnus-mouse-pick-article (e)
2292 (gnus-summary-next-page nil t))
2294 (defun gnus-summary-setup-buffer (group)
2295 "Initialize summary buffer."
2296 (let ((buffer (concat "*Summary " group "*")))
2297 (if (get-buffer buffer)
2300 (setq gnus-summary-buffer (current-buffer))
2301 (not gnus-newsgroup-prepared))
2302 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2303 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2304 (gnus-add-current-to-buffer-list)
2305 (gnus-summary-mode group)
2307 (gnus-carpal-setup-buffer 'summary))
2308 (unless gnus-single-article-buffer
2309 (make-local-variable 'gnus-article-buffer)
2310 (make-local-variable 'gnus-article-current)
2311 (make-local-variable 'gnus-original-article-buffer))
2312 (setq gnus-newsgroup-name group)
2315 (defun gnus-set-global-variables ()
2316 ;; Set the global equivalents of the summary buffer-local variables
2317 ;; to the latest values they had. These reflect the summary buffer
2318 ;; that was in action when the last article was fetched.
2319 (when (eq major-mode 'gnus-summary-mode)
2320 (setq gnus-summary-buffer (current-buffer))
2321 (let ((name gnus-newsgroup-name)
2322 (marked gnus-newsgroup-marked)
2323 (unread gnus-newsgroup-unreads)
2324 (headers gnus-current-headers)
2325 (data gnus-newsgroup-data)
2326 (summary gnus-summary-buffer)
2327 (article-buffer gnus-article-buffer)
2328 (original gnus-original-article-buffer)
2329 (gac gnus-article-current)
2330 (reffed gnus-reffed-article-number)
2331 (score-file gnus-current-score-file))
2333 (set-buffer gnus-group-buffer)
2334 (setq gnus-newsgroup-name name)
2335 (setq gnus-newsgroup-marked marked)
2336 (setq gnus-newsgroup-unreads unread)
2337 (setq gnus-current-headers headers)
2338 (setq gnus-newsgroup-data data)
2339 (setq gnus-article-current gac)
2340 (setq gnus-summary-buffer summary)
2341 (setq gnus-article-buffer article-buffer)
2342 (setq gnus-original-article-buffer original)
2343 (setq gnus-reffed-article-number reffed)
2344 (setq gnus-current-score-file score-file)
2345 ;; The article buffer also has local variables.
2346 (when (gnus-buffer-live-p gnus-article-buffer)
2347 (set-buffer gnus-article-buffer)
2348 (setq gnus-summary-buffer summary))))))
2350 (defun gnus-summary-article-unread-p (article)
2351 "Say whether ARTICLE is unread or not."
2352 (memq article gnus-newsgroup-unreads))
2354 (defun gnus-summary-first-article-p (&optional article)
2355 "Return whether ARTICLE is the first article in the buffer."
2356 (if (not (setq article (or article (gnus-summary-article-number))))
2358 (eq article (caar gnus-newsgroup-data))))
2360 (defun gnus-summary-last-article-p (&optional article)
2361 "Return whether ARTICLE is the last article in the buffer."
2362 (if (not (setq article (or article (gnus-summary-article-number))))
2363 t ; All non-existent numbers are the last article. :-)
2364 (not (cdr (gnus-data-find-list article)))))
2366 (defun gnus-make-thread-indent-array ()
2368 (unless (and gnus-thread-indent-array
2369 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2370 (setq gnus-thread-indent-array (make-vector 201 "")
2371 gnus-thread-indent-array-level gnus-thread-indent-level)
2373 (aset gnus-thread-indent-array n
2374 (make-string (* n gnus-thread-indent-level) ? ))
2377 (defun gnus-update-summary-mark-positions ()
2378 "Compute where the summary marks are to go."
2380 (when (and gnus-summary-buffer
2381 (get-buffer gnus-summary-buffer)
2382 (buffer-name (get-buffer gnus-summary-buffer)))
2383 (set-buffer gnus-summary-buffer))
2384 (let ((gnus-replied-mark 129)
2385 (gnus-score-below-mark 130)
2386 (gnus-score-over-mark 130)
2387 (spec gnus-summary-line-format-spec)
2388 thread gnus-visual pos)
2390 (gnus-set-work-buffer)
2391 (let ((gnus-summary-line-format-spec spec))
2392 (gnus-summary-insert-line
2393 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2394 (goto-char (point-min))
2395 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2397 (goto-char (point-min))
2398 (push (cons 'replied (and (search-forward "\201" nil t)
2401 (goto-char (point-min))
2402 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2404 (setq gnus-summary-mark-positions pos))))
2406 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2407 "Insert a dummy root in the summary buffer."
2409 (gnus-add-text-properties
2410 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2411 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2413 (defun gnus-summary-insert-line (gnus-tmp-header
2414 gnus-tmp-level gnus-tmp-current
2415 gnus-tmp-unread gnus-tmp-replied
2416 gnus-tmp-expirable gnus-tmp-subject-or-nil
2417 &optional gnus-tmp-dummy gnus-tmp-score
2419 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2420 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2421 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2422 (gnus-tmp-score-char
2423 (if (or (null gnus-summary-default-score)
2424 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2425 gnus-summary-zcore-fuzz))
2427 (if (< gnus-tmp-score gnus-summary-default-score)
2428 gnus-score-below-mark gnus-score-over-mark)))
2430 (cond (gnus-tmp-process gnus-process-mark)
2431 ((memq gnus-tmp-current gnus-newsgroup-cached)
2433 (gnus-tmp-replied gnus-replied-mark)
2434 ((memq gnus-tmp-current gnus-newsgroup-saved)
2436 (t gnus-unread-mark)))
2437 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2440 ((string-match "<[^>]+> *$" gnus-tmp-from)
2441 (let ((beg (match-beginning 0)))
2442 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2443 (substring gnus-tmp-from (1+ (match-beginning 0))
2444 (1- (match-end 0))))
2445 (substring gnus-tmp-from 0 beg))))
2446 ((string-match "(.+)" gnus-tmp-from)
2447 (substring gnus-tmp-from
2448 (1+ (match-beginning 0)) (1- (match-end 0))))
2450 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2451 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2452 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2453 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2454 (buffer-read-only nil))
2455 (when (string= gnus-tmp-name "")
2456 (setq gnus-tmp-name gnus-tmp-from))
2457 (unless (numberp gnus-tmp-lines)
2458 (setq gnus-tmp-lines 0))
2459 (gnus-put-text-property
2461 (progn (eval gnus-summary-line-format-spec) (point))
2462 'gnus-number gnus-tmp-number)
2463 (when (gnus-visual-p 'summary-highlight 'highlight)
2465 (run-hooks 'gnus-summary-update-hook)
2468 (defun gnus-summary-update-line (&optional dont-update)
2469 ;; Update summary line after change.
2470 (when (and gnus-summary-default-score
2471 (not gnus-summary-inhibit-highlight))
2472 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2473 (article (gnus-summary-article-number))
2474 (score (gnus-summary-article-score article)))
2476 (if (and gnus-summary-mark-below
2477 (< (gnus-summary-article-score)
2478 gnus-summary-mark-below))
2479 ;; This article has a low score, so we mark it as read.
2480 (when (memq article gnus-newsgroup-unreads)
2481 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2482 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2483 ;; This article was previously marked as read on account
2484 ;; of a low score, but now it has risen, so we mark it as
2486 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2487 (gnus-summary-update-mark
2488 (if (or (null gnus-summary-default-score)
2489 (<= (abs (- score gnus-summary-default-score))
2490 gnus-summary-zcore-fuzz))
2492 (if (< score gnus-summary-default-score)
2493 gnus-score-below-mark gnus-score-over-mark))
2495 ;; Do visual highlighting.
2496 (when (gnus-visual-p 'summary-highlight 'highlight)
2497 (run-hooks 'gnus-summary-update-hook)))))
2499 (defvar gnus-tmp-new-adopts nil)
2501 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2502 "Return the number of articles in THREAD.
2503 This may be 0 in some cases -- if none of the articles in
2504 the thread are to be displayed."
2506 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2508 ((not (listp thread))
2510 ((and (consp thread) (cdr thread))
2513 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2516 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2519 (when (and level (zerop level) gnus-tmp-new-adopts)
2522 'gnus-summary-number-of-articles-in-thread
2523 gnus-tmp-new-adopts))))
2525 (if (> number 1) gnus-not-empty-thread-mark
2526 gnus-empty-thread-mark)
2529 (defun gnus-summary-set-local-parameters (group)
2530 "Go through the local params of GROUP and set all variable specs in that list."
2531 (let ((params (gnus-group-find-parameter group))
2534 (setq elem (car params)
2535 params (cdr params))
2536 (and (consp elem) ; Has to be a cons.
2537 (consp (cdr elem)) ; The cdr has to be a list.
2538 (symbolp (car elem)) ; Has to be a symbol in there.
2539 (not (memq (car elem)
2540 '(quit-config to-address to-list to-group)))
2541 (progn ; So we set it.
2542 (make-local-variable (car elem))
2543 (set (car elem) (eval (nth 1 elem))))))))
2545 (defun gnus-summary-read-group (group &optional show-all no-article
2546 kill-buffer no-display)
2547 "Start reading news in newsgroup GROUP.
2548 If SHOW-ALL is non-nil, already read articles are also listed.
2549 If NO-ARTICLE is non-nil, no article is selected initially.
2550 If NO-DISPLAY, don't generate a summary buffer."
2551 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2552 (let* ((new-group (gnus-summary-setup-buffer group))
2553 (quit-config (gnus-group-quit-config group))
2554 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2556 ;; This summary buffer exists already, so we just select it.
2558 (gnus-set-global-variables)
2560 (gnus-kill-or-deaden-summary kill-buffer))
2561 (gnus-configure-windows 'summary 'force)
2562 (gnus-set-mode-line 'summary)
2563 (gnus-summary-position-point)
2566 ;; We couldn't select this group.
2568 (when (and (eq major-mode 'gnus-summary-mode)
2569 (not (equal (current-buffer) kill-buffer)))
2570 (kill-buffer (current-buffer))
2571 (if (not quit-config)
2573 (set-buffer gnus-group-buffer)
2574 (gnus-group-jump-to-group group)
2575 (gnus-group-next-unread-group 1))
2576 (gnus-handle-ephemeral-exit quit-config)))
2577 (gnus-message 3 "Can't select group")
2579 ;; The user did a `C-g' while prompting for number of articles,
2580 ;; so we exit this group.
2581 ((eq did-select 'quit)
2582 (and (eq major-mode 'gnus-summary-mode)
2583 (not (equal (current-buffer) kill-buffer))
2584 (kill-buffer (current-buffer)))
2586 (gnus-kill-or-deaden-summary kill-buffer))
2587 (if (not quit-config)
2589 (set-buffer gnus-group-buffer)
2590 (gnus-group-jump-to-group group)
2591 (gnus-group-next-unread-group 1)
2592 (gnus-configure-windows 'group 'force))
2593 (gnus-handle-ephemeral-exit quit-config))
2594 ;; Finally signal the quit.
2596 ;; The group was successfully selected.
2598 (gnus-set-global-variables)
2599 ;; Save the active value in effect when the group was entered.
2600 (setq gnus-newsgroup-active
2602 (gnus-active gnus-newsgroup-name)))
2603 ;; You can change the summary buffer in some way with this hook.
2604 (run-hooks 'gnus-select-group-hook)
2605 ;; Set any local variables in the group parameters.
2606 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2607 (gnus-update-format-specifications
2608 nil 'summary 'summary-mode 'summary-dummy)
2609 ;; Do score processing.
2610 (when gnus-use-scoring
2611 (gnus-possibly-score-headers))
2612 ;; Check whether to fill in the gaps in the threads.
2613 (when gnus-build-sparse-threads
2614 (gnus-build-sparse-threads))
2615 ;; Find the initial limit.
2616 (if gnus-show-threads
2618 (let ((gnus-newsgroup-dormant nil))
2619 (gnus-summary-initial-limit show-all))
2620 (gnus-summary-initial-limit show-all))
2621 (setq gnus-newsgroup-limit
2623 (lambda (header) (mail-header-number header))
2624 gnus-newsgroup-headers)))
2625 ;; Generate the summary buffer.
2627 (gnus-summary-prepare))
2628 (when gnus-use-trees
2629 (gnus-tree-open group)
2630 (setq gnus-summary-highlight-line-function
2631 'gnus-tree-highlight-article))
2632 ;; If the summary buffer is empty, but there are some low-scored
2633 ;; articles or some excluded dormants, we include these in the
2635 (when (and (zerop (buffer-size))
2637 (cond (gnus-newsgroup-dormant
2638 (gnus-summary-limit-include-dormant))
2639 ((and gnus-newsgroup-scored show-all)
2640 (gnus-summary-limit-include-expunged t))))
2641 ;; Function `gnus-apply-kill-file' must be called in this hook.
2642 (run-hooks 'gnus-apply-kill-hook)
2643 (if (and (zerop (buffer-size))
2646 ;; This newsgroup is empty.
2647 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2648 (gnus-message 6 "No unread news")
2650 (gnus-kill-or-deaden-summary kill-buffer))
2651 ;; Return nil from this function.
2653 ;; Hide conversation thread subtrees. We cannot do this in
2654 ;; gnus-summary-prepare-hook since kill processing may not
2655 ;; work with hidden articles.
2656 (and gnus-show-threads
2657 gnus-thread-hide-subtree
2658 (gnus-summary-hide-all-threads))
2659 ;; Show first unread article if requested.
2660 (if (and (not no-article)
2662 gnus-newsgroup-unreads
2663 gnus-auto-select-first)
2664 (unless (if (eq gnus-auto-select-first 'best)
2665 (gnus-summary-best-unread-article)
2666 (gnus-summary-first-unread-article))
2667 (gnus-configure-windows 'summary))
2668 ;; Don't select any articles, just move point to the first
2669 ;; article in the group.
2670 (goto-char (point-min))
2671 (gnus-summary-position-point)
2672 (gnus-set-mode-line 'summary)
2673 (gnus-configure-windows 'summary 'force))
2675 (gnus-kill-or-deaden-summary kill-buffer))
2676 (when (get-buffer-window gnus-group-buffer t)
2677 ;; Gotta use windows, because recenter does weird stuff if
2678 ;; the current buffer ain't the displayed window.
2679 (let ((owin (selected-window)))
2680 (select-window (get-buffer-window gnus-group-buffer t))
2681 (when (gnus-group-goto-group group)
2683 (select-window owin))))
2684 ;; Mark this buffer as "prepared".
2685 (setq gnus-newsgroup-prepared t)
2688 (defun gnus-summary-prepare ()
2689 "Generate the summary buffer."
2691 (let ((buffer-read-only nil))
2693 (setq gnus-newsgroup-data nil
2694 gnus-newsgroup-data-reverse nil)
2695 (run-hooks 'gnus-summary-generate-hook)
2696 ;; Generate the buffer, either with threads or without.
2697 (when gnus-newsgroup-headers
2698 (gnus-summary-prepare-threads
2699 (if gnus-show-threads
2700 (gnus-sort-gathered-threads
2701 (funcall gnus-summary-thread-gathering-function
2703 (gnus-cut-threads (gnus-make-threads)))))
2704 ;; Unthreaded display.
2705 (gnus-sort-articles gnus-newsgroup-headers))))
2706 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2707 ;; Call hooks for modifying summary buffer.
2708 (goto-char (point-min))
2709 (run-hooks 'gnus-summary-prepare-hook)))
2711 (defsubst gnus-general-simplify-subject (subject)
2712 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2715 ;; Truncate the subject.
2716 ((numberp gnus-summary-gather-subject-limit)
2717 (setq subject (gnus-simplify-subject-re subject))
2718 (if (> (length subject) gnus-summary-gather-subject-limit)
2719 (substring subject 0 gnus-summary-gather-subject-limit)
2721 ;; Fuzzily simplify it.
2722 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2723 (gnus-simplify-subject-fuzzy subject))
2724 ;; Just remove the leading "Re:".
2726 (gnus-simplify-subject-re subject))))
2728 (if (and gnus-summary-gather-exclude-subject
2729 (string-match gnus-summary-gather-exclude-subject subject))
2730 nil ; This article shouldn't be gathered
2733 (defun gnus-summary-simplify-subject-query ()
2734 "Query where the respool algorithm would put this article."
2736 (gnus-set-global-variables)
2737 (gnus-summary-select-article)
2738 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2740 (defun gnus-gather-threads-by-subject (threads)
2741 "Gather threads by looking at Subject headers."
2742 (if (not gnus-summary-make-false-root)
2744 (let ((hashtb (gnus-make-hashtable 1024))
2747 subject hthread whole-subject)
2749 (setq subject (gnus-general-simplify-subject
2750 (setq whole-subject (mail-header-subject
2753 (if (setq hthread (gnus-gethash subject hashtb))
2755 ;; We enter a dummy root into the thread, if we
2756 ;; haven't done that already.
2757 (unless (stringp (caar hthread))
2758 (setcar hthread (list whole-subject (car hthread))))
2759 ;; We add this new gathered thread to this gathered
2761 (setcdr (car hthread)
2762 (nconc (cdar hthread) (list (car threads))))
2763 ;; Remove it from the list of threads.
2764 (setcdr prev (cdr threads))
2765 (setq threads prev))
2766 ;; Enter this thread into the hash table.
2767 (gnus-sethash subject threads hashtb)))
2769 (setq threads (cdr threads)))
2772 (defun gnus-gather-threads-by-references (threads)
2773 "Gather threads by looking at References headers."
2774 (let ((idhashtb (gnus-make-hashtable 1024))
2775 (thhashtb (gnus-make-hashtable 1024))
2778 ids references id gthread gid entered ref)
2780 (when (setq references (mail-header-references (caar threads)))
2781 (setq id (mail-header-id (caar threads))
2782 ids (gnus-split-references references)
2784 (while (setq ref (pop ids))
2785 (setq ids (delete ref ids))
2786 (if (not (setq gid (gnus-gethash ref idhashtb)))
2788 (gnus-sethash ref id idhashtb)
2789 (gnus-sethash id threads thhashtb))
2790 (setq gthread (gnus-gethash gid thhashtb))
2792 ;; We enter a dummy root into the thread, if we
2793 ;; haven't done that already.
2794 (unless (stringp (caar gthread))
2795 (setcar gthread (list (mail-header-subject (caar gthread))
2797 ;; We add this new gathered thread to this gathered
2799 (setcdr (car gthread)
2800 (nconc (cdar gthread) (list (car threads)))))
2801 ;; Add it into the thread hash table.
2802 (gnus-sethash id gthread thhashtb)
2804 ;; Remove it from the list of threads.
2805 (setcdr prev (cdr threads))
2806 (setq threads prev))))
2808 (setq threads (cdr threads)))
2811 (defun gnus-sort-gathered-threads (threads)
2812 "Sort subtreads inside each gathered thread by article number."
2813 (let ((result threads))
2815 (when (stringp (caar threads))
2816 (setcdr (car threads)
2817 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2818 (setq threads (cdr threads)))
2821 (defun gnus-thread-loop-p (root thread)
2822 "Say whether ROOT is in THREAD."
2823 (let ((th (cdr thread)))
2825 (not (eq (caar th) root)))
2828 ;; We have found a loop.
2830 (setcdr thread (delq (car th) (cdr thread)))
2831 (if (boundp (setq ref-dep (intern "none"
2832 gnus-newsgroup-dependencies)))
2833 (setcdr (symbol-value ref-dep)
2834 (nconc (cdr (symbol-value ref-dep))
2836 (set ref-dep (list nil (car th))))
2838 ;; Recurse down into the sub-threads and look for loops.
2841 (lambda (thread) (gnus-thread-loop-p root thread))
2844 (defun gnus-make-threads ()
2845 "Go through the dependency hashtb and find the roots. Return all threads."
2847 (while (catch 'infloop
2850 ;; Deal with self-referencing References loops.
2851 (when (and (car (symbol-value refs))
2858 (car (symbol-value refs)) thread))
2859 (cdr (symbol-value refs)))))))
2862 (unless (car (symbol-value refs))
2863 ;; These threads do not refer back to any other articles,
2864 ;; so they're roots.
2865 (setq threads (append (cdr (symbol-value refs)) threads))))
2866 gnus-newsgroup-dependencies)))
2869 (defun gnus-build-sparse-threads ()
2870 (let ((headers gnus-newsgroup-headers)
2871 (deps gnus-newsgroup-dependencies)
2872 header references generation relations
2873 cthread subject child end pthread relation)
2874 ;; First we create an alist of generations/relations, where
2875 ;; generations is how much we trust the relation, and the relation
2877 (gnus-message 7 "Making sparse threads...")
2879 (nnheader-set-temp-buffer " *gnus sparse threads*")
2880 (while (setq header (pop headers))
2881 (when (and (setq references (mail-header-references header))
2882 (not (string= references "")))
2884 (setq child (mail-header-id header)
2885 subject (mail-header-subject header))
2887 (while (search-backward ">" nil t)
2888 (setq end (1+ (point)))
2889 (when (search-backward "<" nil t)
2890 (push (list (incf generation)
2891 child (setq child (buffer-substring (point) end))
2894 (push (list (1+ generation) child nil subject) relations)
2896 (kill-buffer (current-buffer)))
2897 ;; Sort over trustworthiness.
2898 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2899 (while (setq relation (pop relations))
2900 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2901 (unless (car (symbol-value cthread))
2902 ;; Make this article the parent of these threads.
2903 (setcar (symbol-value cthread)
2904 (vector gnus-reffed-article-number
2908 (or (caddr relation) "") 0 0 "")))
2909 (set cthread (list (vector gnus-reffed-article-number
2911 "" "" (cadr relation)
2912 (or (caddr relation) "") 0 0 ""))))
2913 (push gnus-reffed-article-number gnus-newsgroup-limit)
2914 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2915 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2916 gnus-newsgroup-reads)
2917 (decf gnus-reffed-article-number)
2918 ;; Make this new thread the child of its parent.
2919 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2920 (setcdr (symbol-value pthread)
2921 (nconc (cdr (symbol-value pthread))
2922 (list (symbol-value cthread))))
2923 (set pthread (list nil (symbol-value cthread))))))
2924 (gnus-message 7 "Making sparse threads...done")))
2926 (defun gnus-build-old-threads ()
2927 ;; Look at all the articles that refer back to old articles, and
2928 ;; fetch the headers for the articles that aren't there. This will
2929 ;; build complete threads - if the roots haven't been expired by the
2934 (when (not (car (symbol-value refs)))
2935 (setq heads (cdr (symbol-value refs)))
2937 (if (memq (mail-header-number (caar heads))
2938 gnus-newsgroup-dormant)
2939 (setq heads (cdr heads))
2940 (setq id (symbol-name refs))
2941 (while (and (setq id (gnus-build-get-header id))
2942 (not (car (gnus-gethash
2943 id gnus-newsgroup-dependencies)))))
2944 (setq heads nil)))))
2945 gnus-newsgroup-dependencies)))
2947 (defun gnus-build-get-header (id)
2948 ;; Look through the buffer of NOV lines and find the header to
2949 ;; ID. Enter this line into the dependencies hash table, and return
2950 ;; the id of the parent article (if any).
2951 (let ((deps gnus-newsgroup-dependencies)
2955 (set-buffer nntp-server-buffer)
2956 (goto-char (point-min))
2957 (while (and (not found) (search-forward id nil t))
2959 (setq found (looking-at
2960 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2961 (regexp-quote id))))
2962 (or found (beginning-of-line 2)))
2966 (setq header (gnus-nov-parse-line
2967 (read (current-buffer)) deps))
2968 (gnus-parent-id (mail-header-references header)))))
2970 (let ((number (mail-header-number header)))
2971 (push number gnus-newsgroup-limit)
2972 (push header gnus-newsgroup-headers)
2973 (if (memq number gnus-newsgroup-unselected)
2975 (push number gnus-newsgroup-unreads)
2976 (setq gnus-newsgroup-unselected
2977 (delq number gnus-newsgroup-unselected)))
2978 (push number gnus-newsgroup-ancient)))))))
2980 (defun gnus-summary-update-article-line (article header)
2981 "Update the line for ARTICLE using HEADERS."
2982 (let* ((id (mail-header-id header))
2983 (thread (gnus-id-to-thread id)))
2985 (error "Article in no thread"))
2986 ;; Update the thread.
2987 (setcar thread header)
2988 (gnus-summary-goto-subject article)
2989 (let* ((datal (gnus-data-find-list article))
2991 (length (when (cdr datal)
2992 (- (gnus-data-pos data)
2993 (gnus-data-pos (cadr datal)))))
2994 (buffer-read-only nil)
2995 (level (gnus-summary-thread-level)))
2997 (gnus-summary-insert-line
2998 header level nil (gnus-article-mark article)
2999 (memq article gnus-newsgroup-replied)
3000 (memq article gnus-newsgroup-expirable)
3001 (mail-header-subject header)
3002 nil (cdr (assq article gnus-newsgroup-scored))
3003 (memq article gnus-newsgroup-processable))
3005 (gnus-data-update-list
3006 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3008 (defun gnus-summary-update-article (article &optional iheader)
3009 "Update ARTICLE in the summary buffer."
3010 (set-buffer gnus-summary-buffer)
3011 (let* ((header (or iheader (gnus-summary-article-header article)))
3012 (id (mail-header-id header))
3013 (data (gnus-data-find article))
3014 (thread (gnus-id-to-thread id))
3015 (references (mail-header-references header))
3019 (when (and references
3020 (not (equal "" references)))
3023 (buffer-read-only nil)
3025 (number (mail-header-number header))
3028 ;; !!! Should this be in or not?
3030 (setcar thread nil))
3032 (delq thread parent))
3033 (if (gnus-summary-insert-subject id header iheader)
3034 ;; Set the (possibly) new article number in the data structure.
3035 (gnus-data-set-number data (gnus-id-to-article id))
3039 (defun gnus-rebuild-thread (id)
3040 "Rebuild the thread containing ID."
3041 (let ((buffer-read-only nil)
3042 old-pos current thread data)
3043 (if (not gnus-show-threads)
3044 (setq thread (list (car (gnus-id-to-thread id))))
3045 ;; Get the thread this article is part of.
3046 (setq thread (gnus-remove-thread id)))
3047 (setq old-pos (gnus-point-at-bol))
3048 (setq current (save-excursion
3049 (and (zerop (forward-line -1))
3050 (gnus-summary-article-number))))
3051 ;; If this is a gathered thread, we have to go some re-gathering.
3052 (when (stringp (car thread))
3053 (let ((subject (car thread))
3055 (setq thread (cdr thread))
3057 (unless (memq (setq thr (gnus-id-to-thread
3059 (mail-header-id (caar thread)))))
3062 (setq thread (cdr thread)))
3063 ;; We now have all (unique) roots.
3064 (if (= (length roots) 1)
3065 ;; All the loose roots are now one solid root.
3066 (setq thread (car roots))
3067 (setq thread (cons subject (gnus-sort-threads roots))))))
3069 ;; We then insert this thread into the summary buffer.
3070 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3071 (if gnus-show-threads
3072 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3073 (gnus-summary-prepare-unthreaded thread))
3074 (setq data (nreverse gnus-newsgroup-data))
3075 (setq threads gnus-newsgroup-threads))
3076 ;; We splice the new data into the data structure.
3077 (gnus-data-enter-list current data (- (point) old-pos))
3078 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3080 (defun gnus-number-to-header (number)
3081 "Return the header for article NUMBER."
3082 (let ((headers gnus-newsgroup-headers))
3084 (not (= number (mail-header-number (car headers)))))
3089 (defun gnus-parent-headers (headers &optional generation)
3090 "Return the headers of the GENERATIONeth parent of HEADERS."
3092 (setq generation 1))
3093 (let (references parent)
3094 (while (and headers (not (zerop generation)))
3095 (setq references (mail-header-references headers))
3096 (when (and references
3097 (setq parent (gnus-parent-id references))
3098 (setq headers (car (gnus-id-to-thread parent))))
3102 (defun gnus-id-to-thread (id)
3103 "Return the (sub-)thread where ID appears."
3104 (gnus-gethash id gnus-newsgroup-dependencies))
3106 (defun gnus-id-to-article (id)
3107 "Return the article number of ID."
3108 (let ((thread (gnus-id-to-thread id)))
3111 (mail-header-number (car thread)))))
3113 (defun gnus-id-to-header (id)
3114 "Return the article headers of ID."
3115 (car (gnus-id-to-thread id)))
3117 (defun gnus-article-displayed-root-p (article)
3118 "Say whether ARTICLE is a root(ish) article."
3119 (let ((level (gnus-summary-thread-level article))
3120 (refs (mail-header-references (gnus-summary-article-header article)))
3126 ((null (gnus-parent-id refs)) t)
3128 (null (setq particle (gnus-id-to-article
3129 (gnus-parent-id refs))))
3130 (null (gnus-summary-thread-level particle)))))))
3132 (defun gnus-root-id (id)
3133 "Return the id of the root of the thread where ID appears."
3135 (while (and id (setq prev (car (gnus-gethash
3136 id gnus-newsgroup-dependencies))))
3138 id (gnus-parent-id (mail-header-references prev))))
3141 (defun gnus-remove-thread (id &optional dont-remove)
3142 "Remove the thread that has ID in it."
3143 (let ((dep gnus-newsgroup-dependencies)
3144 headers thread last-id)
3145 ;; First go up in this thread until we find the root.
3146 (setq last-id (gnus-root-id id))
3147 (setq headers (list (car (gnus-id-to-thread last-id))
3148 (caadr (gnus-id-to-thread last-id))))
3149 ;; We have now found the real root of this thread. It might have
3150 ;; been gathered into some loose thread, so we have to search
3151 ;; through the threads to find the thread we wanted.
3152 (let ((threads gnus-newsgroup-threads)
3155 (setq sub (car threads))
3156 (if (stringp (car sub))
3157 ;; This is a gathered thread, so we look at the roots
3158 ;; below it to find whether this article is in this
3161 (setq sub (cdr sub))
3163 (when (member (caar sub) headers)
3164 (setq thread (car threads)
3167 (setq sub (cdr sub))))
3168 ;; It's an ordinary thread, so we check it.
3169 (when (eq (car sub) (car headers))
3172 (setq threads (cdr threads)))
3173 ;; If this article is in no thread, then it's a root.
3176 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3177 (setq thread (gnus-gethash last-id dep)))
3180 thread ; We return this thread.
3182 (if (stringp (car thread))
3184 ;; If we use dummy roots, then we have to remove the
3185 ;; dummy root as well.
3186 (when (eq gnus-summary-make-false-root 'dummy)
3188 (gnus-data-compute-positions))
3189 (setq thread (cdr thread))
3191 (gnus-remove-thread-1 (car thread))
3192 (setq thread (cdr thread))))
3193 (gnus-remove-thread-1 thread))))))))
3195 (defun gnus-remove-thread-1 (thread)
3196 "Remove the thread THREAD recursively."
3197 (let ((number (mail-header-number (pop thread)))
3199 (setq thread (reverse thread))
3201 (gnus-remove-thread-1 (pop thread)))
3202 (when (setq d (gnus-data-find number))
3203 (goto-char (gnus-data-pos d))
3206 (- (gnus-point-at-bol)
3208 (1+ (gnus-point-at-eol))
3209 (gnus-delete-line)))))))
3211 (defun gnus-sort-threads (threads)
3213 (if (not gnus-thread-sort-functions)
3215 (gnus-message 7 "Sorting threads...")
3217 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3218 (gnus-message 7 "Sorting threads...done"))))
3220 (defun gnus-sort-articles (articles)
3222 (when gnus-article-sort-functions
3223 (gnus-message 7 "Sorting articles...")
3225 (setq gnus-newsgroup-headers
3226 (sort articles (gnus-make-sort-function
3227 gnus-article-sort-functions)))
3228 (gnus-message 7 "Sorting articles...done"))))
3230 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3231 (defmacro gnus-thread-header (thread)
3232 ;; Return header of first article in THREAD.
3233 ;; Note that THREAD must never, ever be anything else than a variable -
3234 ;; using some other form will lead to serious barfage.
3235 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3236 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3237 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3240 (defsubst gnus-article-sort-by-number (h1 h2)
3241 "Sort articles by article number."
3242 (< (mail-header-number h1)
3243 (mail-header-number h2)))
3245 (defun gnus-thread-sort-by-number (h1 h2)
3246 "Sort threads by root article number."
3247 (gnus-article-sort-by-number
3248 (gnus-thread-header h1) (gnus-thread-header h2)))
3250 (defsubst gnus-article-sort-by-lines (h1 h2)
3251 "Sort articles by article Lines header."
3252 (< (mail-header-lines h1)
3253 (mail-header-lines h2)))
3255 (defun gnus-thread-sort-by-lines (h1 h2)
3256 "Sort threads by root article Lines header."
3257 (gnus-article-sort-by-lines
3258 (gnus-thread-header h1) (gnus-thread-header h2)))
3260 (defsubst gnus-article-sort-by-author (h1 h2)
3261 "Sort articles by root author."
3263 (let ((extract (funcall
3264 gnus-extract-address-components
3265 (mail-header-from h1))))
3266 (or (car extract) (cdr extract)))
3267 (let ((extract (funcall
3268 gnus-extract-address-components
3269 (mail-header-from h2))))
3270 (or (car extract) (cdr extract)))))
3272 (defun gnus-thread-sort-by-author (h1 h2)
3273 "Sort threads by root author."
3274 (gnus-article-sort-by-author
3275 (gnus-thread-header h1) (gnus-thread-header h2)))
3277 (defsubst gnus-article-sort-by-subject (h1 h2)
3278 "Sort articles by root subject."
3280 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3281 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3283 (defun gnus-thread-sort-by-subject (h1 h2)
3284 "Sort threads by root subject."
3285 (gnus-article-sort-by-subject
3286 (gnus-thread-header h1) (gnus-thread-header h2)))
3288 (defsubst gnus-article-sort-by-date (h1 h2)
3289 "Sort articles by root article date."
3291 (gnus-date-get-time (mail-header-date h1))
3292 (gnus-date-get-time (mail-header-date h2))))
3294 (defun gnus-thread-sort-by-date (h1 h2)
3295 "Sort threads by root article date."
3296 (gnus-article-sort-by-date
3297 (gnus-thread-header h1) (gnus-thread-header h2)))
3299 (defsubst gnus-article-sort-by-score (h1 h2)
3300 "Sort articles by root article score.
3301 Unscored articles will be counted as having a score of zero."
3302 (> (or (cdr (assq (mail-header-number h1)
3303 gnus-newsgroup-scored))
3304 gnus-summary-default-score 0)
3305 (or (cdr (assq (mail-header-number h2)
3306 gnus-newsgroup-scored))
3307 gnus-summary-default-score 0)))
3309 (defun gnus-thread-sort-by-score (h1 h2)
3310 "Sort threads by root article score."
3311 (gnus-article-sort-by-score
3312 (gnus-thread-header h1) (gnus-thread-header h2)))
3314 (defun gnus-thread-sort-by-total-score (h1 h2)
3315 "Sort threads by the sum of all scores in the thread.
3316 Unscored articles will be counted as having a score of zero."
3317 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3319 (defun gnus-thread-total-score (thread)
3320 ;; This function find the total score of THREAD.
3321 (cond ((null thread)
3324 (if (stringp (car thread))
3325 (apply gnus-thread-score-function 0
3326 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3327 (gnus-thread-total-score-1 thread)))
3329 (gnus-thread-total-score-1 (list thread)))))
3331 (defun gnus-thread-total-score-1 (root)
3332 ;; This function find the total score of the thread below ROOT.
3333 (setq root (car root))
3334 (apply gnus-thread-score-function
3336 (mapcar 'gnus-thread-total-score
3337 (cdr (gnus-gethash (mail-header-id root)
3338 gnus-newsgroup-dependencies)))
3339 (when (> (mail-header-number root) 0)
3340 (list (or (cdr (assq (mail-header-number root)
3341 gnus-newsgroup-scored))
3342 gnus-summary-default-score 0))))
3343 (list gnus-summary-default-score)
3346 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3347 (defvar gnus-tmp-prev-subject nil)
3348 (defvar gnus-tmp-false-parent nil)
3349 (defvar gnus-tmp-root-expunged nil)
3350 (defvar gnus-tmp-dummy-line nil)
3352 (defun gnus-summary-prepare-threads (threads)
3353 "Prepare summary buffer from THREADS and indentation LEVEL.
3354 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3355 or a straight list of headers."
3356 (gnus-message 7 "Generating summary...")
3358 (setq gnus-newsgroup-threads threads)
3361 (let ((gnus-tmp-level 0)
3362 (default-score (or gnus-summary-default-score 0))
3363 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3364 thread number subject stack state gnus-tmp-gathered beg-match
3365 new-roots gnus-tmp-new-adopts thread-end
3366 gnus-tmp-header gnus-tmp-unread
3367 gnus-tmp-replied gnus-tmp-subject-or-nil
3368 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3369 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3370 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3372 (setq gnus-tmp-prev-subject nil)
3374 (if (vectorp (car threads))
3375 ;; If this is a straight (sic) list of headers, then a
3376 ;; threaded summary display isn't required, so we just create
3377 ;; an unthreaded one.
3378 (gnus-summary-prepare-unthreaded threads)
3380 ;; Do the threaded display.
3382 (while (or threads stack gnus-tmp-new-adopts new-roots)
3384 (if (and (= gnus-tmp-level 0)
3385 (not (setq gnus-tmp-dummy-line nil))
3388 (not gnus-tmp-false-parent)
3389 (or gnus-tmp-new-adopts new-roots))
3390 (if gnus-tmp-new-adopts
3391 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3392 thread (list (car gnus-tmp-new-adopts))
3393 gnus-tmp-header (caar thread)
3394 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3396 (setq thread (list (car new-roots))
3397 gnus-tmp-header (caar thread)
3398 new-roots (cdr new-roots))))
3401 ;; If there are some threads, we do them before the
3402 ;; threads on the stack.
3403 (setq thread threads
3404 gnus-tmp-header (caar thread))
3405 ;; There were no current threads, so we pop something off
3407 (setq state (car stack)
3408 gnus-tmp-level (car state)
3411 gnus-tmp-header (caar thread))))
3413 (setq gnus-tmp-false-parent nil)
3414 (setq gnus-tmp-root-expunged nil)
3415 (setq thread-end nil)
3417 (if (stringp gnus-tmp-header)
3418 ;; The header is a dummy root.
3420 ((eq gnus-summary-make-false-root 'adopt)
3421 ;; We let the first article adopt the rest.
3422 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3424 (setq gnus-tmp-gathered
3426 (lambda (h) (mail-header-number (car h)))
3429 (setq thread (cons (list (caar thread)
3432 (setq gnus-tmp-level -1
3433 gnus-tmp-false-parent t))
3434 ((eq gnus-summary-make-false-root 'empty)
3435 ;; We print adopted articles with empty subject fields.
3436 (setq gnus-tmp-gathered
3438 (lambda (h) (mail-header-number (car h)))
3441 (setq gnus-tmp-level -1))
3442 ((eq gnus-summary-make-false-root 'dummy)
3443 ;; We remember that we probably want to output a dummy
3445 (setq gnus-tmp-dummy-line gnus-tmp-header)
3446 (setq gnus-tmp-prev-subject gnus-tmp-header))
3448 ;; We do not make a root for the gathered
3449 ;; sub-threads at all.
3450 (setq gnus-tmp-level -1)))
3452 (setq number (mail-header-number gnus-tmp-header)
3453 subject (mail-header-subject gnus-tmp-header))
3456 ;; If the thread has changed subject, we might want to make
3457 ;; this subthread into a root.
3458 ((and (null gnus-thread-ignore-subject)
3459 (not (zerop gnus-tmp-level))
3460 gnus-tmp-prev-subject
3462 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3463 (setq new-roots (nconc new-roots (list (car thread)))
3465 gnus-tmp-header nil))
3466 ;; If the article lies outside the current limit,
3467 ;; then we do not display it.
3468 ((not (memq number gnus-newsgroup-limit))
3469 (setq gnus-tmp-gathered
3471 (lambda (h) (mail-header-number (car h)))
3474 (setq gnus-tmp-new-adopts (if (cdar thread)
3475 (append gnus-tmp-new-adopts
3477 gnus-tmp-new-adopts)
3479 gnus-tmp-header nil)
3480 (when (zerop gnus-tmp-level)
3481 (setq gnus-tmp-root-expunged t)))
3482 ;; Perhaps this article is to be marked as read?
3483 ((and gnus-summary-mark-below
3484 (< (or (cdr (assq number gnus-newsgroup-scored))
3486 gnus-summary-mark-below)
3487 ;; Don't touch sparse articles.
3488 (not (gnus-summary-article-sparse-p number))
3489 (not (gnus-summary-article-ancient-p number)))
3490 (setq gnus-newsgroup-unreads
3491 (delq number gnus-newsgroup-unreads))
3492 (if gnus-newsgroup-auto-expire
3493 (push number gnus-newsgroup-expirable)
3494 (push (cons number gnus-low-score-mark)
3495 gnus-newsgroup-reads))))
3497 (when gnus-tmp-header
3498 ;; We may have an old dummy line to output before this
3500 (when gnus-tmp-dummy-line
3501 (gnus-summary-insert-dummy-line
3502 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3503 (setq gnus-tmp-dummy-line nil))
3505 ;; Compute the mark.
3506 (setq gnus-tmp-unread (gnus-article-mark number))
3508 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3509 gnus-tmp-header gnus-tmp-level)
3510 gnus-newsgroup-data)
3512 ;; Actually insert the line.
3514 gnus-tmp-subject-or-nil
3516 ((and gnus-thread-ignore-subject
3517 gnus-tmp-prev-subject
3518 (not (inline (gnus-subject-equal
3519 gnus-tmp-prev-subject subject))))
3521 ((zerop gnus-tmp-level)
3522 (if (and (eq gnus-summary-make-false-root 'empty)
3523 (memq number gnus-tmp-gathered)
3524 gnus-tmp-prev-subject
3525 (inline (gnus-subject-equal
3526 gnus-tmp-prev-subject subject)))
3527 gnus-summary-same-subject
3529 (t gnus-summary-same-subject)))
3530 (if (and (eq gnus-summary-make-false-root 'adopt)
3531 (= gnus-tmp-level 1)
3532 (memq number gnus-tmp-gathered))
3533 (setq gnus-tmp-opening-bracket ?\<
3534 gnus-tmp-closing-bracket ?\>)
3535 (setq gnus-tmp-opening-bracket ?\[
3536 gnus-tmp-closing-bracket ?\]))
3538 gnus-tmp-indentation
3539 (aref gnus-thread-indent-array gnus-tmp-level)
3540 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3541 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3542 gnus-summary-default-score 0)
3544 (if (or (null gnus-summary-default-score)
3545 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3546 gnus-summary-zcore-fuzz))
3548 (if (< gnus-tmp-score gnus-summary-default-score)
3549 gnus-score-below-mark gnus-score-over-mark))
3551 (cond ((memq number gnus-newsgroup-processable)
3553 ((memq number gnus-newsgroup-cached)
3555 ((memq number gnus-newsgroup-replied)
3557 ((memq number gnus-newsgroup-saved)
3559 (t gnus-unread-mark))
3560 gnus-tmp-from (mail-header-from gnus-tmp-header)
3563 ((string-match "<[^>]+> *$" gnus-tmp-from)
3564 (setq beg-match (match-beginning 0))
3565 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3566 (substring gnus-tmp-from (1+ (match-beginning 0))
3567 (1- (match-end 0))))
3568 (substring gnus-tmp-from 0 beg-match)))
3569 ((string-match "(.+)" gnus-tmp-from)
3570 (substring gnus-tmp-from
3571 (1+ (match-beginning 0)) (1- (match-end 0))))
3573 (when (string= gnus-tmp-name "")
3574 (setq gnus-tmp-name gnus-tmp-from))
3575 (unless (numberp gnus-tmp-lines)
3576 (setq gnus-tmp-lines 0))
3577 (gnus-put-text-property
3579 (progn (eval gnus-summary-line-format-spec) (point))
3580 'gnus-number number)
3583 (run-hooks 'gnus-summary-update-hook)
3586 (setq gnus-tmp-prev-subject subject)))
3588 (when (nth 1 thread)
3589 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3590 (incf gnus-tmp-level)
3591 (setq threads (if thread-end nil (cdar thread)))
3593 (setq gnus-tmp-level 0)))))
3594 (gnus-message 7 "Generating summary...done"))
3596 (defun gnus-summary-prepare-unthreaded (headers)
3597 "Generate an unthreaded summary buffer based on HEADERS."
3598 (let (header number mark)
3601 ;; We may have to root out some bad articles...
3602 (when (memq (setq number (mail-header-number
3603 (setq header (pop headers))))
3604 gnus-newsgroup-limit)
3605 ;; Mark article as read when it has a low score.
3606 (when (and gnus-summary-mark-below
3607 (< (or (cdr (assq number gnus-newsgroup-scored))
3608 gnus-summary-default-score 0)
3609 gnus-summary-mark-below)
3610 (not (gnus-summary-article-ancient-p number)))
3611 (setq gnus-newsgroup-unreads
3612 (delq number gnus-newsgroup-unreads))
3613 (if gnus-newsgroup-auto-expire
3614 (push number gnus-newsgroup-expirable)
3615 (push (cons number gnus-low-score-mark)
3616 gnus-newsgroup-reads)))
3618 (setq mark (gnus-article-mark number))
3619 (push (gnus-data-make number mark (1+ (point)) header 0)
3620 gnus-newsgroup-data)
3621 (gnus-summary-insert-line
3623 mark (memq number gnus-newsgroup-replied)
3624 (memq number gnus-newsgroup-expirable)
3625 (mail-header-subject header) nil
3626 (cdr (assq number gnus-newsgroup-scored))
3627 (memq number gnus-newsgroup-processable))))))
3629 (defun gnus-select-newsgroup (group &optional read-all)
3630 "Select newsgroup GROUP.
3631 If READ-ALL is non-nil, all articles in the group are selected."
3632 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3633 (info (nth 2 entry))
3634 articles fetched-articles cached)
3636 (unless (gnus-check-server
3637 (setq gnus-current-select-method
3638 (gnus-find-method-for-group group)))
3639 (error "Couldn't open server"))
3641 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3642 (gnus-activate-group group) ; Or we can activate it...
3643 (progn ; Or we bug out.
3644 (when (equal major-mode 'gnus-summary-mode)
3645 (kill-buffer (current-buffer)))
3646 (error "Couldn't request group %s: %s"
3647 group (gnus-status-message group))))
3649 (unless (gnus-request-group group t)
3650 (when (equal major-mode 'gnus-summary-mode)
3651 (kill-buffer (current-buffer)))
3652 (error "Couldn't request group %s: %s"
3653 group (gnus-status-message group)))
3655 (setq gnus-newsgroup-name group)
3656 (setq gnus-newsgroup-unselected nil)
3657 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3659 ;; Adjust and set lists of article marks.
3661 (gnus-adjust-marked-articles info))
3663 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3664 (when (gnus-virtual-group-p group)
3665 (setq cached gnus-newsgroup-cached))
3667 (setq gnus-newsgroup-unreads
3668 (gnus-set-difference
3669 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3670 gnus-newsgroup-dormant))
3672 (setq gnus-newsgroup-processable nil)
3674 (setq articles (gnus-articles-to-read group read-all))
3678 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3680 ((eq articles 0) nil)
3682 ;; Init the dependencies hash table.
3683 (setq gnus-newsgroup-dependencies
3684 (gnus-make-hashtable (length articles)))
3685 ;; Retrieve the headers and read them in.
3686 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3687 (setq gnus-newsgroup-headers
3689 (setq gnus-headers-retrieved-by
3690 (gnus-retrieve-headers
3691 articles gnus-newsgroup-name
3692 ;; We might want to fetch old headers, but
3693 ;; not if there is only 1 article.
3694 (and gnus-fetch-old-headers
3696 (not (eq gnus-fetch-old-headers 'some))
3697 (not (numberp gnus-fetch-old-headers)))
3698 (> (length articles) 1))))))
3699 (gnus-get-newsgroup-headers-xover
3700 articles nil nil gnus-newsgroup-name t)
3701 (gnus-get-newsgroup-headers)))
3702 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3704 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3706 (setq gnus-newsgroup-cached cached))
3708 ;; Suppress duplicates?
3709 (when gnus-suppress-duplicates
3710 (gnus-dup-suppress-articles))
3712 ;; Set the initial limit.
3713 (setq gnus-newsgroup-limit (copy-sequence articles))
3714 ;; Remove canceled articles from the list of unread articles.
3715 (setq gnus-newsgroup-unreads
3716 (gnus-set-sorted-intersection
3717 gnus-newsgroup-unreads
3718 (setq fetched-articles
3719 (mapcar (lambda (headers) (mail-header-number headers))
3720 gnus-newsgroup-headers))))
3721 ;; Removed marked articles that do not exist.
3722 (gnus-update-missing-marks
3723 (gnus-sorted-complement fetched-articles articles))
3724 ;; We might want to build some more threads first.
3725 (and gnus-fetch-old-headers
3726 (eq gnus-headers-retrieved-by 'nov)
3727 (gnus-build-old-threads))
3728 ;; Check whether auto-expire is to be done in this group.
3729 (setq gnus-newsgroup-auto-expire
3730 (gnus-group-auto-expirable-p group))
3731 ;; Set up the article buffer now, if necessary.
3732 (unless gnus-single-article-buffer
3733 (gnus-article-setup-buffer))
3734 ;; First and last article in this newsgroup.
3735 (when gnus-newsgroup-headers
3736 (setq gnus-newsgroup-begin
3737 (mail-header-number (car gnus-newsgroup-headers))
3740 (gnus-last-element gnus-newsgroup-headers))))
3741 ;; GROUP is successfully selected.
3742 (or gnus-newsgroup-headers t)))))
3744 (defun gnus-articles-to-read (group &optional read-all)
3745 ;; Find out what articles the user wants to read.
3747 ;; Select all articles if `read-all' is non-nil, or if there
3748 ;; are no unread articles.
3750 (and (zerop (length gnus-newsgroup-marked))
3751 (zerop (length gnus-newsgroup-unreads)))
3752 (eq (gnus-group-find-parameter group 'display)
3754 (gnus-uncompress-range (gnus-active group))
3755 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3756 (copy-sequence gnus-newsgroup-unreads))
3758 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3759 (scored (length scored-list))
3760 (number (length articles))
3761 (marked (+ (length gnus-newsgroup-marked)
3762 (length gnus-newsgroup-dormant)))
3770 ((and (or (<= scored marked) (= scored number))
3771 (numberp gnus-large-newsgroup)
3772 (> number gnus-large-newsgroup))
3776 "How many articles from %s (default %d): "
3777 (gnus-limit-string gnus-newsgroup-name 35)
3779 (if (string-match "^[ \t]*$" input) number input)))
3780 ((and (> scored marked) (< scored number)
3781 (> (- scored number) 20))
3784 (format "%s %s (%d scored, %d total): "
3785 "How many articles from"
3786 group scored number))))
3787 (if (string-match "^[ \t]*$" input)
3791 (setq select (if (stringp select) (string-to-number select) select))
3792 (if (or (null select) (zerop select))
3794 (if (and (not (zerop scored)) (<= (abs select) scored))
3796 (setq articles (sort scored-list '<))
3797 (setq number (length articles)))
3798 (setq articles (copy-sequence articles)))
3800 (when (< (abs select) number)
3802 ;; Select the N oldest articles.
3803 (setcdr (nthcdr (1- (abs select)) articles) nil)
3804 ;; Select the N most recent articles.
3805 (setq articles (nthcdr (- number select) articles))))
3806 (setq gnus-newsgroup-unselected
3807 (gnus-sorted-intersection
3808 gnus-newsgroup-unreads
3809 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3812 (defun gnus-killed-articles (killed articles)
3815 (when (inline (gnus-member-of-range (car articles) killed))
3816 (push (car articles) out))
3817 (setq articles (cdr articles)))
3820 (defun gnus-uncompress-marks (marks)
3821 "Uncompress the mark ranges in MARKS."
3822 (let ((uncompressed '(score bookmark))
3825 (if (memq (caar marks) uncompressed)
3826 (push (car marks) out)
3827 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3828 (setq marks (cdr marks)))
3831 (defun gnus-adjust-marked-articles (info)
3832 "Set all article lists and remove all marks that are no longer legal."
3833 (let* ((marked-lists (gnus-info-marks info))
3834 (active (gnus-active (gnus-info-group info)))
3837 (types gnus-article-mark-lists)
3838 (uncompressed '(score bookmark killed))
3839 marks var articles article mark)
3842 (setq marks (pop marked-lists))
3843 (set (setq var (intern (format "gnus-newsgroup-%s"
3844 (car (rassq (setq mark (car marks))
3846 (if (memq (car marks) uncompressed) (cdr marks)
3847 (gnus-uncompress-range (cdr marks))))
3849 (setq articles (symbol-value var))
3851 ;; All articles have to be subsets of the active articles.
3853 ;; Adjust "simple" lists.
3854 ((memq mark '(tick dormant expirable reply save))
3856 (when (or (< (setq article (pop articles)) min) (> article max))
3857 (set var (delq article (symbol-value var))))))
3859 ((memq mark uncompressed)
3861 (when (or (not (consp (setq article (pop articles))))
3862 (< (car article) min)
3863 (> (car article) max))
3864 (set var (delq article (symbol-value var))))))))))
3866 (defun gnus-update-missing-marks (missing)
3867 "Go through the list of MISSING articles and remove them mark lists."
3869 (let ((types gnus-article-mark-lists)
3871 ;; Go through all types.
3873 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3874 (when (symbol-value var)
3875 ;; This list has articles. So we delete all missing articles
3879 (set var (delq (pop m) (symbol-value var)))))))))
3881 (defun gnus-update-marks ()
3882 "Enter the various lists of marked articles into the newsgroup info list."
3883 (let ((types gnus-article-mark-lists)
3884 (info (gnus-get-info gnus-newsgroup-name))
3885 (uncompressed '(score bookmark killed))
3886 type list newmarked symbol)
3888 ;; Add all marks lists that are non-nil to the list of marks lists.
3890 (setq type (pop types))
3891 (when (setq list (symbol-value
3893 (intern (format "gnus-newsgroup-%s"
3895 (push (cons (cdr type)
3896 (if (memq (cdr type) uncompressed) list
3897 (gnus-compress-sequence
3898 (set symbol (sort list '<)) t)))
3901 ;; Enter these new marks into the info of the group.
3903 (setcar (nthcdr 3 info) newmarked)
3904 ;; Add the marks lists to the end of the info.
3906 (setcdr (nthcdr 2 info) (list newmarked))))
3908 ;; Cut off the end of the info if there's nothing else there.
3912 (when (nthcdr (decf i) info)
3913 (setcdr (nthcdr i info) nil)))))))
3915 (defun gnus-set-mode-line (where)
3916 "This function sets the mode line of the article or summary buffers.
3917 If WHERE is `summary', the summary mode line format will be used."
3918 ;; Is this mode line one we keep updated?
3919 (when (memq where gnus-updated-mode-lines)
3922 ;; We evaluate this in the summary buffer since these
3923 ;; variables are buffer-local to that buffer.
3924 (set-buffer gnus-summary-buffer)
3925 ;; We bind all these variables that are used in the `eval' form
3927 (let* ((mformat (symbol-value
3929 (format "gnus-%s-mode-line-format-spec" where))))
3930 (gnus-tmp-group-name gnus-newsgroup-name)
3931 (gnus-tmp-article-number (or gnus-current-article 0))
3932 (gnus-tmp-unread gnus-newsgroup-unreads)
3933 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3934 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3935 (gnus-tmp-unread-and-unselected
3936 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3937 (zerop gnus-tmp-unselected))
3939 ((zerop gnus-tmp-unselected)
3940 (format "{%d more}" gnus-tmp-unread-and-unticked))
3941 (t (format "{%d(+%d) more}"
3942 gnus-tmp-unread-and-unticked
3943 gnus-tmp-unselected))))
3945 (if (and gnus-current-headers
3946 (vectorp gnus-current-headers))
3947 (gnus-mode-string-quote
3948 (mail-header-subject gnus-current-headers))
3951 gnus-tmp-header);; passed as argument to any user-format-funcs
3952 (setq mode-string (eval mformat))
3953 (setq max-len (max 4 (if gnus-mode-non-string-length
3955 gnus-mode-non-string-length)
3956 (length mode-string))))
3957 ;; We might have to chop a bit of the string off...
3958 (when (> (length mode-string) max-len)
3960 (concat (gnus-truncate-string mode-string (- max-len 3))
3962 ;; Pad the mode string a bit.
3963 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3964 ;; Update the mode line.
3965 (setq mode-line-buffer-identification
3966 (gnus-mode-line-buffer-identification
3967 (list mode-string)))
3968 (set-buffer-modified-p t))))
3970 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3971 "Go through the HEADERS list and add all Xrefs to a hash table.
3972 The resulting hash table is returned, or nil if no Xrefs were found."
3973 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3974 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3975 (xref-hashtb (gnus-make-hashtable))
3976 start group entry number xrefs header)
3978 (setq header (pop headers))
3979 (when (and (setq xrefs (mail-header-xref header))
3980 (not (memq (setq number (mail-header-number header))
3983 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
3984 (setq start (match-end 0))
3985 (setq group (if prefix
3986 (concat prefix (substring xrefs (match-beginning 1)
3988 (substring xrefs (match-beginning 1) (match-end 1))))
3990 (string-to-int (substring xrefs (match-beginning 2)
3992 (if (setq entry (gnus-gethash group xref-hashtb))
3993 (setcdr entry (cons number (cdr entry)))
3994 (gnus-sethash group (cons number nil) xref-hashtb)))))
3995 (and start xref-hashtb)))
3997 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
3998 "Look through all the headers and mark the Xrefs as read."
3999 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4000 name entry info xref-hashtb idlist method nth4)
4002 (set-buffer gnus-group-buffer)
4003 (when (setq xref-hashtb
4004 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4007 (unless (string= from-newsgroup (setq name (symbol-name group)))
4008 (setq idlist (symbol-value group))
4009 ;; Dead groups are not updated.
4011 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4013 (when (stringp (setq nth4 (gnus-info-method info)))
4014 (setq nth4 (gnus-server-to-method nth4))))
4015 ;; Only do the xrefs if the group has the same
4016 ;; select method as the group we have just read.
4017 (or (gnus-methods-equal-p
4018 nth4 (gnus-find-method-for-group from-newsgroup))
4020 (equal nth4 (setq method (gnus-find-method-for-group
4022 (and (equal (car nth4) (car method))
4023 (equal (nth 1 nth4) (nth 1 method))))
4024 gnus-use-cross-reference
4025 (or (not (eq gnus-use-cross-reference t))
4027 ;; Only do cross-references on subscribed
4028 ;; groups, if that is what is wanted.
4029 (<= (gnus-info-level info) gnus-level-subscribed))
4030 (gnus-group-make-articles-read name idlist))))
4033 (defun gnus-group-make-articles-read (group articles)
4034 "Update the info of GROUP to say that only ARTICLES are unread."
4036 (entry (gnus-gethash group gnus-newsrc-hashtb))
4037 (info (nth 2 entry))
4038 (active (gnus-active group))
4040 ;; First peel off all illegal article numbers.
4042 (let ((ids articles)
4044 (while (setq id (pop ids))
4045 (when (and first (> id (cdr active)))
4046 ;; We'll end up in this situation in one particular
4047 ;; obscure situation. If you re-scan a group and get
4048 ;; a new article that is cross-posted to a different
4049 ;; group that has not been re-scanned, you might get
4050 ;; crossposted article that has a higher number than
4051 ;; Gnus believes possible. So we re-activate this
4052 ;; group as well. This might mean doing the
4053 ;; crossposting thingy will *increase* the number
4054 ;; of articles in some groups. Tsk, tsk.
4055 (setq active (or (gnus-activate-group group) active)))
4056 (when (or (> id (cdr active))
4057 (< id (car active)))
4058 (setq articles (delq id articles))))))
4060 (set-buffer gnus-group-buffer)
4063 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4064 (gnus-info-set-read ',info ',(gnus-info-read info))
4065 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4066 (gnus-group-update-group ,group t))))
4067 ;; If the read list is nil, we init it.
4069 (null (gnus-info-read info))
4071 (gnus-info-set-read info (cons 1 (1- (car active)))))
4072 ;; Then we add the read articles to the range.
4077 (gnus-info-read info) (setq articles (sort articles '<)))))
4078 ;; Then we have to re-compute how many unread
4079 ;; articles there are in this group.
4083 (setq num (- (1+ (cdr active)) (car active))))
4084 ((not (listp (cdr range)))
4085 (setq num (- (cdr active) (- (1+ (cdr range))
4089 (if (numberp (car range))
4091 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4092 (setq range (cdr range)))
4093 (setq num (- (cdr active) num))))
4094 ;; Update the number of unread articles.
4096 ;; Update the group buffer.
4097 (gnus-group-update-group group t))))
4099 (defun gnus-methods-equal-p (m1 m2)
4100 (let ((m1 (or m1 gnus-select-method))
4101 (m2 (or m2 gnus-select-method)))
4103 (and (eq (car m1) (car m2))
4104 (or (not (memq 'address (assoc (symbol-name (car m1))
4105 gnus-valid-select-methods)))
4106 (equal (nth 1 m1) (nth 1 m2)))))))
4108 (defvar gnus-newsgroup-none-id 0)
4110 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4111 (let ((cur nntp-server-buffer)
4114 (save-excursion (set-buffer gnus-summary-buffer)
4115 gnus-newsgroup-dependencies)))
4116 headers id id-dep ref-dep end ref)
4118 (set-buffer nntp-server-buffer)
4119 ;; Translate all TAB characters into SPACE characters.
4120 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4121 (run-hooks 'gnus-parse-headers-hook)
4122 (let ((case-fold-search t)
4123 in-reply-to header p lines)
4124 (goto-char (point-min))
4125 ;; Search to the beginning of the next header. Error messages
4126 ;; do not begin with 2 or 3.
4127 (while (re-search-forward "^[23][0-9]+ " nil t)
4130 ;; This implementation of this function, with nine
4131 ;; search-forwards instead of the one re-search-forward and
4132 ;; a case (which basically was the old function) is actually
4133 ;; about twice as fast, even though it looks messier. You
4134 ;; can't have everything, I guess. Speed and elegance
4135 ;; doesn't always go hand in hand.
4144 (narrow-to-region (point)
4145 (or (and (search-forward "\n.\n" nil t)
4151 (if (search-forward "\nsubject: " nil t)
4152 (nnheader-header-value) "(none)"))
4156 (if (search-forward "\nfrom: " nil t)
4157 (nnheader-header-value) "(nobody)"))
4161 (if (search-forward "\ndate: " nil t)
4162 (nnheader-header-value) ""))
4166 (setq id (if (search-forward "\nmessage-id: " nil t)
4167 (nnheader-header-value)
4168 ;; If there was no message-id, we just fake one
4169 ;; to make subsequent routines simpler.
4170 (nnheader-generate-fake-message-id))))
4174 (if (search-forward "\nreferences: " nil t)
4178 (nnheader-header-value)
4183 (search-backward ">" end t)
4186 (search-backward "<" end t)
4188 ;; Get the references from the in-reply-to header if there
4189 ;; were no references and the in-reply-to header looks
4191 (if (and (search-forward "\nin-reply-to: " nil t)
4192 (setq in-reply-to (nnheader-header-value))
4193 (string-match "<[^>]+>" in-reply-to))
4194 (setq ref (substring in-reply-to (match-beginning 0)
4202 (if (search-forward "\nlines: " nil t)
4203 (if (numberp (setq lines (read cur)))
4209 (and (search-forward "\nxref: " nil t)
4210 (nnheader-header-value)))))
4211 (when (equal id ref)
4213 ;; We do the threading while we read the headers. The
4214 ;; message-id and the last reference are both entered into
4215 ;; the same hash table. Some tippy-toeing around has to be
4216 ;; done in case an article has arrived before the article
4217 ;; which it refers to.
4218 (if (boundp (setq id-dep (intern id dependencies)))
4219 (if (and (car (symbol-value id-dep))
4221 ;; An article with this Message-ID has already
4222 ;; been seen, so we ignore this one, except we add
4223 ;; any additional Xrefs (in case the two articles
4224 ;; came from different servers).
4226 (mail-header-set-xref
4227 (car (symbol-value id-dep))
4228 (concat (or (mail-header-xref
4229 (car (symbol-value id-dep)))
4231 (or (mail-header-xref header) "")))
4233 (setcar (symbol-value id-dep) header))
4234 (set id-dep (list header)))
4236 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4237 (setcdr (symbol-value ref-dep)
4238 (nconc (cdr (symbol-value ref-dep))
4239 (list (symbol-value id-dep))))
4240 (set ref-dep (list nil (symbol-value id-dep))))
4241 (push header headers))
4242 (goto-char (point-max))
4244 (nreverse headers)))))
4246 ;; The following macros and functions were written by Felix Lee
4247 ;; <flee@cse.psu.edu>.
4249 (defmacro gnus-nov-read-integer ()
4251 (if (= (following-char) ?\t)
4253 (let ((num (ignore-errors (read buffer))))
4254 (if (numberp num) num 0)))
4258 (defmacro gnus-nov-skip-field ()
4259 '(search-forward "\t" eol 'move))
4261 (defmacro gnus-nov-field ()
4262 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4264 ;; (defvar gnus-nov-none-counter 0)
4266 ;; This function has to be called with point after the article number
4267 ;; on the beginning of the line.
4268 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4269 (let ((eol (gnus-point-at-eol))
4270 (buffer (current-buffer))
4271 header ref id id-dep ref-dep)
4273 ;; overview: [num subject from date id refs chars lines misc]
4276 (narrow-to-region (point) eol)
4283 (gnus-nov-field) ; subject
4284 (gnus-nov-field) ; from
4285 (gnus-nov-field) ; date
4286 (setq id (or (gnus-nov-field)
4287 (nnheader-generate-fake-message-id))) ; id
4289 (let ((beg (point)))
4290 (search-forward "\t" eol)
4291 (if (search-backward ">" beg t)
4295 (search-backward "<" beg t)))
4298 (gnus-nov-field)) ; refs
4299 (gnus-nov-read-integer) ; chars
4300 (gnus-nov-read-integer) ; lines
4301 (if (= (following-char) ?\n)
4303 (gnus-nov-field)) ; misc
4308 ;; We build the thread tree.
4309 (when (equal id ref)
4310 ;; This article refers back to itself. Naughty, naughty.
4312 (if (boundp (setq id-dep (intern id dependencies)))
4313 (if (and (car (symbol-value id-dep))
4315 ;; An article with this Message-ID has already been seen,
4316 ;; so we ignore this one, except we add any additional
4317 ;; Xrefs (in case the two articles came from different
4320 (mail-header-set-xref
4321 (car (symbol-value id-dep))
4322 (concat (or (mail-header-xref
4323 (car (symbol-value id-dep)))
4325 (or (mail-header-xref header) "")))
4327 (setcar (symbol-value id-dep) header))
4328 (set id-dep (list header)))
4330 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4331 (setcdr (symbol-value ref-dep)
4332 (nconc (cdr (symbol-value ref-dep))
4333 (list (symbol-value id-dep))))
4334 (set ref-dep (list nil (symbol-value id-dep)))))
4337 ;; Goes through the xover lines and returns a list of vectors
4338 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4339 force-new dependencies
4340 group also-fetch-heads)
4341 "Parse the news overview data in the server buffer, and return a
4342 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4343 ;; Get the Xref when the users reads the articles since most/some
4344 ;; NNTP servers do not include Xrefs when using XOVER.
4345 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4346 (let ((cur nntp-server-buffer)
4347 (dependencies (or dependencies gnus-newsgroup-dependencies))
4348 number headers header)
4350 (set-buffer nntp-server-buffer)
4351 ;; Allow the user to mangle the headers before parsing them.
4352 (run-hooks 'gnus-parse-headers-hook)
4353 (goto-char (point-min))
4356 (while (and sequence (not (eobp)))
4357 (setq number (read cur))
4358 (while (and sequence
4359 (< (car sequence) number))
4360 (setq sequence (cdr sequence)))
4362 (eq number (car sequence))
4364 (setq sequence (cdr sequence))
4365 (setq header (inline
4366 (gnus-nov-parse-line
4367 number dependencies force-new))))
4368 (push header headers))
4371 (gnus-error 4 "Strange nov line (%d)"
4372 (count-lines (point-min) (point)))))
4374 ;; A common bug in inn is that if you have posted an article and
4375 ;; then retrieves the active file, it will answer correctly --
4376 ;; the new article is included. However, a NOV entry for the
4377 ;; article may not have been generated yet, so this may fail.
4378 ;; We work around this problem by retrieving the last few
4379 ;; headers using HEAD.
4380 (if (or (not also-fetch-heads)
4383 (let ((gnus-nov-is-evil t)
4384 (nntp-nov-is-evil t))
4387 (when (gnus-retrieve-headers sequence group)
4388 (gnus-get-newsgroup-headers))))))))
4390 (defun gnus-article-get-xrefs ()
4391 "Fill in the Xref value in `gnus-current-headers', if necessary.
4392 This is meant to be called in `gnus-article-internal-prepare-hook'."
4393 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4394 gnus-current-headers)))
4395 (or (not gnus-use-cross-reference)
4397 (and (mail-header-xref headers)
4398 (not (string= (mail-header-xref headers) "")))
4399 (let ((case-fold-search t)
4402 (nnheader-narrow-to-headers)
4403 (goto-char (point-min))
4404 (when (or (and (eq (downcase (following-char)) ?x)
4405 (looking-at "Xref:"))
4406 (search-forward "\nXref:" nil t))
4407 (goto-char (1+ (match-end 0)))
4408 (setq xref (buffer-substring (point)
4409 (progn (end-of-line) (point))))
4410 (mail-header-set-xref headers xref)))))))
4412 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4413 "Find article ID and insert the summary line for that article."
4414 (let ((header (if (and old-header use-old-header)
4415 old-header (gnus-read-header id)))
4416 (number (and (numberp id) id))
4419 ;; Rebuild the thread that this article is part of and go to the
4420 ;; article we have fetched.
4421 (when (and (not gnus-show-threads)
4423 (when (setq d (gnus-data-find (mail-header-number old-header)))
4424 (goto-char (gnus-data-pos d))
4427 (- (gnus-point-at-bol)
4429 (1+ (gnus-point-at-eol))
4430 (gnus-delete-line))))))
4432 (mail-header-set-number header (mail-header-number old-header)))
4433 (setq gnus-newsgroup-sparse
4434 (delq (setq number (mail-header-number header))
4435 gnus-newsgroup-sparse))
4436 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4437 (gnus-rebuild-thread (mail-header-id header))
4438 (gnus-summary-goto-subject number nil t))
4439 (when (and (numberp number)
4441 ;; We have to update the boundaries even if we can't fetch the
4442 ;; article if ID is a number -- so that the next `P' or `N'
4443 ;; command will fetch the previous (or next) article even
4444 ;; if the one we tried to fetch this time has been canceled.
4445 (when (> number gnus-newsgroup-end)
4446 (setq gnus-newsgroup-end number))
4447 (when (< number gnus-newsgroup-begin)
4448 (setq gnus-newsgroup-begin number))
4449 (setq gnus-newsgroup-unselected
4450 (delq number gnus-newsgroup-unselected)))
4451 ;; Report back a success?
4452 (and header (mail-header-number header))))
4454 ;;; Process/prefix in the summary buffer
4456 (defun gnus-summary-work-articles (n)
4457 "Return a list of articles to be worked upon. The prefix argument,
4458 the list of process marked articles, and the current article will be
4459 taken into consideration."
4462 ;; A numerical prefix has been given.
4463 (setq n (prefix-numeric-value n))
4464 (let ((backward (< n 0))
4465 (n (abs (prefix-numeric-value n)))
4470 (push (setq article (gnus-summary-article-number))
4473 (gnus-summary-find-prev nil article)
4474 (gnus-summary-find-next nil article)))
4476 (nreverse articles)))
4477 ((and (boundp 'transient-mark-mode)
4479 (boundp 'mark-active)
4481 ;; Work on the region between point and mark.
4482 (let ((max (max (point) (mark)))
4485 (goto-char (min (point) (mark)))
4488 (push (setq article (gnus-summary-article-number)) articles)
4489 (gnus-summary-find-next nil article)
4491 (nreverse articles))))
4492 (gnus-newsgroup-processable
4493 ;; There are process-marked articles present.
4494 ;; Save current state.
4495 (gnus-summary-save-process-mark)
4497 (reverse gnus-newsgroup-processable))
4499 ;; Just return the current article.
4500 (list (gnus-summary-article-number)))))
4502 (defun gnus-summary-save-process-mark ()
4503 "Push the current set of process marked articles on the stack."
4505 (push (copy-sequence gnus-newsgroup-processable)
4506 gnus-newsgroup-process-stack))
4508 (defun gnus-summary-kill-process-mark ()
4509 "Push the current set of process marked articles on the stack and unmark."
4511 (gnus-summary-save-process-mark)
4512 (gnus-summary-unmark-all-processable))
4514 (defun gnus-summary-yank-process-mark ()
4515 "Pop the last process mark state off the stack and restore it."
4517 (unless gnus-newsgroup-process-stack
4518 (error "Empty mark stack"))
4519 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4521 (defun gnus-summary-process-mark-set (set)
4522 "Make SET into the current process marked articles."
4523 (gnus-summary-unmark-all-processable)
4525 (gnus-summary-set-process-mark (pop set))))
4527 ;;; Searching and stuff
4529 (defun gnus-summary-search-group (&optional backward use-level)
4530 "Search for next unread newsgroup.
4531 If optional argument BACKWARD is non-nil, search backward instead."
4533 (set-buffer gnus-group-buffer)
4534 (when (gnus-group-search-forward
4535 backward nil (if use-level (gnus-group-group-level) nil))
4536 (gnus-group-group-name))))
4538 (defun gnus-summary-best-group (&optional exclude-group)
4539 "Find the name of the best unread group.
4540 If EXCLUDE-GROUP, do not go to this group."
4542 (set-buffer gnus-group-buffer)
4544 (gnus-group-best-unread-group exclude-group))))
4546 (defun gnus-summary-find-next (&optional unread article backward)
4547 (if backward (gnus-summary-find-prev)
4548 (let* ((dummy (gnus-summary-article-intangible-p))
4549 (article (or article (gnus-summary-article-number)))
4550 (arts (gnus-data-find-list article))
4552 (when (and (not dummy)
4553 (or (not gnus-summary-check-current)
4555 (not (gnus-data-unread-p (car arts)))))
4556 (setq arts (cdr arts)))
4561 (when (gnus-data-unread-p (car arts))
4562 (setq result (car arts)
4564 (setq arts (cdr arts)))
4567 (goto-char (gnus-data-pos result))
4568 (gnus-data-number result)))))
4570 (defun gnus-summary-find-prev (&optional unread article)
4571 (let* ((eobp (eobp))
4572 (article (or article (gnus-summary-article-number)))
4573 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4575 (when (and (not eobp)
4576 (or (not gnus-summary-check-current)
4578 (not (gnus-data-unread-p (car arts)))))
4579 (setq arts (cdr arts)))
4584 (when (gnus-data-unread-p (car arts))
4585 (setq result (car arts)
4587 (setq arts (cdr arts)))
4590 (goto-char (gnus-data-pos result))
4591 (gnus-data-number result))))
4593 (defun gnus-summary-find-subject (subject &optional unread backward article)
4594 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4595 (article (or article (gnus-summary-article-number)))
4596 (articles (gnus-data-list backward))
4597 (arts (gnus-data-find-list article articles))
4599 (when (or (not gnus-summary-check-current)
4601 (not (gnus-data-unread-p (car arts))))
4602 (setq arts (cdr arts)))
4604 (and (or (not unread)
4605 (gnus-data-unread-p (car arts)))
4606 (vectorp (gnus-data-header (car arts)))
4608 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4609 (setq result (car arts)
4611 (setq arts (cdr arts)))
4613 (goto-char (gnus-data-pos result))
4614 (gnus-data-number result))))
4616 (defun gnus-summary-search-forward (&optional unread subject backward)
4617 "Search forward for an article.
4618 If UNREAD, look for unread articles. If SUBJECT, look for
4619 articles with that subject. If BACKWARD, search backward instead."
4620 (cond (subject (gnus-summary-find-subject subject unread backward))
4621 (backward (gnus-summary-find-prev unread))
4622 (t (gnus-summary-find-next unread))))
4624 (defun gnus-recenter (&optional n)
4625 "Center point in window and redisplay frame.
4626 Also do horizontal recentering."
4628 (when (and gnus-auto-center-summary
4629 (not (eq gnus-auto-center-summary 'vertical)))
4630 (gnus-horizontal-recenter))
4633 (defun gnus-summary-recenter ()
4634 "Center point in the summary window.
4635 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4636 displayed, no centering will be performed."
4637 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4638 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4639 (let* ((top (cond ((< (window-height) 4) 0)
4640 ((< (window-height) 7) 1)
4642 (height (1- (window-height)))
4643 (bottom (save-excursion (goto-char (point-max))
4644 (forward-line (- height))
4646 (window (get-buffer-window (current-buffer))))
4647 ;; The user has to want it.
4648 (when gnus-auto-center-summary
4649 (when (get-buffer-window gnus-article-buffer)
4650 ;; Only do recentering when the article buffer is displayed,
4651 ;; Set the window start to either `bottom', which is the biggest
4652 ;; possible valid number, or the second line from the top,
4653 ;; whichever is the least.
4655 window (min bottom (save-excursion
4656 (forward-line (- top)) (point)))))
4657 ;; Do horizontal recentering while we're at it.
4658 (when (and (get-buffer-window (current-buffer) t)
4659 (not (eq gnus-auto-center-summary 'vertical)))
4660 (let ((selected (selected-window)))
4661 (select-window (get-buffer-window (current-buffer) t))
4662 (gnus-summary-position-point)
4663 (gnus-horizontal-recenter)
4664 (select-window selected))))))
4666 (defun gnus-summary-jump-to-group (newsgroup)
4667 "Move point to NEWSGROUP in group mode buffer."
4668 ;; Keep update point of group mode buffer if visible.
4669 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4670 (save-window-excursion
4671 ;; Take care of tree window mode.
4672 (when (get-buffer-window gnus-group-buffer)
4673 (pop-to-buffer gnus-group-buffer))
4674 (gnus-group-jump-to-group newsgroup))
4676 ;; Take care of tree window mode.
4677 (if (get-buffer-window gnus-group-buffer)
4678 (pop-to-buffer gnus-group-buffer)
4679 (set-buffer gnus-group-buffer))
4680 (gnus-group-jump-to-group newsgroup))))
4682 ;; This function returns a list of article numbers based on the
4683 ;; difference between the ranges of read articles in this group and
4684 ;; the range of active articles.
4685 (defun gnus-list-of-unread-articles (group)
4686 (let* ((read (gnus-info-read (gnus-get-info group)))
4687 (active (or (gnus-active group) (gnus-activate-group group)))
4690 ;; If none are read, then all are unread.
4692 (setq first (car active))
4693 ;; If the range of read articles is a single range, then the
4694 ;; first unread article is the article after the last read
4695 ;; article. Sounds logical, doesn't it?
4696 (if (not (listp (cdr read)))
4697 (setq first (1+ (cdr read)))
4698 ;; `read' is a list of ranges.
4699 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4705 (while (< first nlast)
4707 (setq first (1+ first))))
4708 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4709 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4710 (setq read (cdr read)))))
4711 ;; And add the last unread articles.
4712 (while (<= first last)
4714 (setq first (1+ first)))
4715 ;; Return the list of unread articles.
4718 (defun gnus-list-of-read-articles (group)
4719 "Return a list of unread, unticked and non-dormant articles."
4720 (let* ((info (gnus-get-info group))
4721 (marked (gnus-info-marks info))
4722 (active (gnus-active group)))
4724 (gnus-set-difference
4725 (gnus-sorted-complement
4726 (gnus-uncompress-range active)
4727 (gnus-list-of-unread-articles group))
4729 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4730 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4732 ;; Various summary commands
4734 (defun gnus-summary-universal-argument (arg)
4735 "Perform any operation on all articles that are process/prefixed."
4737 (gnus-set-global-variables)
4738 (let ((articles (gnus-summary-work-articles arg))
4745 (substitute-command-keys
4746 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4749 (gnus-error 1 "Undefined key")
4752 (gnus-summary-goto-subject (setq article (pop articles)))
4753 (let (gnus-newsgroup-processable)
4754 (command-execute func))
4755 (gnus-summary-remove-process-mark article)))))
4756 (gnus-summary-position-point))
4758 (defun gnus-summary-toggle-truncation (&optional arg)
4759 "Toggle truncation of summary lines.
4760 With arg, turn line truncation on iff arg is positive."
4762 (setq truncate-lines
4763 (if (null arg) (not truncate-lines)
4764 (> (prefix-numeric-value arg) 0)))
4767 (defun gnus-summary-reselect-current-group (&optional all rescan)
4768 "Exit and then reselect the current newsgroup.
4769 The prefix argument ALL means to select all articles."
4771 (gnus-set-global-variables)
4772 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4773 (error "Ephemeral groups can't be reselected"))
4774 (let ((current-subject (gnus-summary-article-number))
4775 (group gnus-newsgroup-name))
4776 (setq gnus-newsgroup-begin nil)
4778 ;; We have to adjust the point of group mode buffer because the
4779 ;; current point was moved to the next unread newsgroup by
4781 (gnus-summary-jump-to-group group)
4784 (gnus-group-get-new-news-this-group 1)))
4785 (gnus-group-read-group all t)
4786 (gnus-summary-goto-subject current-subject nil t)))
4788 (defun gnus-summary-rescan-group (&optional all)
4789 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4791 (gnus-summary-reselect-current-group all t))
4793 (defun gnus-summary-update-info (&optional non-destructive)
4795 (let ((group gnus-newsgroup-name))
4796 (when gnus-newsgroup-kill-headers
4797 (setq gnus-newsgroup-killed
4798 (gnus-compress-sequence
4800 (gnus-set-sorted-intersection
4801 (gnus-uncompress-range gnus-newsgroup-killed)
4802 (setq gnus-newsgroup-unselected
4803 (sort gnus-newsgroup-unselected '<)))
4804 (setq gnus-newsgroup-unreads
4805 (sort gnus-newsgroup-unreads '<)))
4807 (unless (listp (cdr gnus-newsgroup-killed))
4808 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4809 (let ((headers gnus-newsgroup-headers))
4810 (when (and (not gnus-save-score)
4811 (not non-destructive))
4812 (setq gnus-newsgroup-scored nil))
4813 ;; Set the new ranges of read articles.
4814 (gnus-update-read-articles
4815 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4816 ;; Set the current article marks.
4818 ;; Do the cross-ref thing.
4819 (when gnus-use-cross-reference
4820 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4821 ;; Do adaptive scoring, and possibly save score files.
4822 (when gnus-newsgroup-adaptive
4823 (gnus-score-adaptive))
4824 (when gnus-use-scoring
4826 ;; Do not switch windows but change the buffer to work.
4827 (set-buffer gnus-group-buffer)
4828 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4829 (gnus-group-update-group group))))))
4831 (defun gnus-summary-save-newsrc (&optional force)
4832 "Save the current number of read/marked articles in the dribble buffer.
4833 The dribble buffer will then be saved.
4834 If FORCE (the prefix), also save the .newsrc file(s)."
4836 (gnus-summary-update-info t)
4838 (gnus-save-newsrc-file)
4839 (gnus-dribble-save)))
4841 (defun gnus-summary-exit (&optional temporary)
4842 "Exit reading current newsgroup, and then return to group selection mode.
4843 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4845 (gnus-set-global-variables)
4846 (gnus-kill-save-kill-buffer)
4847 (let* ((group gnus-newsgroup-name)
4848 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4850 (buf (current-buffer)))
4851 (run-hooks 'gnus-summary-prepare-exit-hook)
4852 ;; If we have several article buffers, we kill them at exit.
4853 (unless gnus-single-article-buffer
4854 (gnus-kill-buffer gnus-original-article-buffer)
4855 (setq gnus-article-current nil))
4856 (when gnus-use-cache
4857 (gnus-cache-possibly-remove-articles)
4858 (gnus-cache-save-buffers))
4859 (gnus-async-prefetch-remove-group group)
4860 (when gnus-suppress-duplicates
4861 (gnus-dup-enter-articles))
4862 (when gnus-use-trees
4863 (gnus-tree-close group))
4864 ;; Make all changes in this group permanent.
4866 (run-hooks 'gnus-exit-group-hook)
4867 (gnus-summary-update-info))
4868 (gnus-close-group group)
4869 ;; Make sure where I was, and go to next newsgroup.
4870 (set-buffer gnus-group-buffer)
4872 (gnus-group-jump-to-group group))
4873 (run-hooks 'gnus-summary-exit-hook)
4875 (gnus-group-next-unread-group 1))
4878 ;; If we have several article buffers, we kill them at exit.
4879 (unless gnus-single-article-buffer
4880 (gnus-kill-buffer gnus-article-buffer)
4881 (gnus-kill-buffer gnus-original-article-buffer)
4882 (setq gnus-article-current nil))
4884 (if (not gnus-kill-summary-on-exit)
4885 (gnus-deaden-summary)
4886 ;; We set all buffer-local variables to nil. It is unclear why
4887 ;; this is needed, but if we don't, buffer-local variables are
4888 ;; not garbage-collected, it seems. This would the lead to en
4889 ;; ever-growing Emacs.
4890 (gnus-summary-clear-local-variables)
4891 (when (get-buffer gnus-article-buffer)
4892 (bury-buffer gnus-article-buffer))
4893 ;; We clear the global counterparts of the buffer-local
4894 ;; variables as well, just to be on the safe side.
4895 (set-buffer gnus-group-buffer)
4896 (gnus-summary-clear-local-variables)
4897 ;; Return to group mode buffer.
4898 (when (eq mode 'gnus-summary-mode)
4899 (gnus-kill-buffer buf)))
4900 (setq gnus-current-select-method gnus-select-method)
4901 (pop-to-buffer gnus-group-buffer)
4902 ;; Clear the current group name.
4903 (if (not quit-config)
4905 (gnus-group-jump-to-group group)
4906 (gnus-group-next-unread-group 1)
4907 (gnus-configure-windows 'group 'force))
4908 (gnus-handle-ephemeral-exit quit-config))
4910 (setq gnus-newsgroup-name nil)))))
4912 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4913 (defun gnus-summary-exit-no-update (&optional no-questions)
4914 "Quit reading current newsgroup without updating read article info."
4916 (gnus-set-global-variables)
4917 (let* ((group gnus-newsgroup-name)
4918 (quit-config (gnus-group-quit-config group)))
4919 (when (or no-questions
4921 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4922 ;; If we have several article buffers, we kill them at exit.
4923 (unless gnus-single-article-buffer
4924 (gnus-kill-buffer gnus-article-buffer)
4925 (gnus-kill-buffer gnus-original-article-buffer)
4926 (setq gnus-article-current nil))
4927 (if (not gnus-kill-summary-on-exit)
4928 (gnus-deaden-summary)
4929 (gnus-close-group group)
4930 (gnus-summary-clear-local-variables)
4931 (set-buffer gnus-group-buffer)
4932 (gnus-summary-clear-local-variables)
4933 (when (get-buffer gnus-summary-buffer)
4934 (kill-buffer gnus-summary-buffer)))
4935 (unless gnus-single-article-buffer
4936 (setq gnus-article-current nil))
4937 (when gnus-use-trees
4938 (gnus-tree-close group))
4939 (gnus-async-prefetch-remove-group group)
4940 (when (get-buffer gnus-article-buffer)
4941 (bury-buffer gnus-article-buffer))
4942 ;; Return to the group buffer.
4943 (gnus-configure-windows 'group 'force)
4944 ;; Clear the current group name.
4945 (setq gnus-newsgroup-name nil)
4946 (when (equal (gnus-group-group-name) group)
4947 (gnus-group-next-unread-group 1))
4949 (gnus-handle-ephemeral-exit quit-config)))))
4951 (defun gnus-handle-ephemeral-exit (quit-config)
4952 "Handle movement when leaving an ephemeral group. The state
4953 which existed when entering the ephemeral is reset."
4954 (if (not (buffer-name (car quit-config)))
4955 (gnus-configure-windows 'group 'force)
4956 (set-buffer (car quit-config))
4957 (cond ((eq major-mode 'gnus-summary-mode)
4958 (gnus-set-global-variables))
4959 ((eq major-mode 'gnus-article-mode)
4961 ;; The `gnus-summary-buffer' variable may point
4962 ;; to the old summary buffer when using a single
4964 (unless (gnus-buffer-live-p gnus-summary-buffer)
4965 (set-buffer gnus-group-buffer))
4966 (set-buffer gnus-summary-buffer)
4967 (gnus-set-global-variables))))
4968 (if (or (eq (cdr quit-config) 'article)
4969 (eq (cdr quit-config) 'pick))
4971 ;; The current article may be from the ephemeral group
4972 ;; thus it is best that we reload this article
4973 (gnus-summary-show-article)
4974 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4975 (gnus-configure-windows 'pick 'force)
4976 (gnus-configure-windows (cdr quit-config) 'force)))
4977 (gnus-configure-windows (cdr quit-config) 'force))
4978 (when (eq major-mode 'gnus-summary-mode)
4979 (gnus-summary-next-subject 1 nil t)
4980 (gnus-summary-recenter)
4981 (gnus-summary-position-point))))
4985 (defvar gnus-dead-summary-mode-map nil)
4987 (unless gnus-dead-summary-mode-map
4988 (setq gnus-dead-summary-mode-map (make-keymap))
4989 (suppress-keymap gnus-dead-summary-mode-map)
4990 (substitute-key-definition
4991 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
4992 (let ((keys '("\C-d" "\r" "\177")))
4994 (define-key gnus-dead-summary-mode-map
4995 (pop keys) 'gnus-summary-wake-up-the-dead))))
4997 (defvar gnus-dead-summary-mode nil
4998 "Minor mode for Gnus summary buffers.")
5000 (defun gnus-dead-summary-mode (&optional arg)
5001 "Minor mode for Gnus summary buffers."
5003 (when (eq major-mode 'gnus-summary-mode)
5004 (make-local-variable 'gnus-dead-summary-mode)
5005 (setq gnus-dead-summary-mode
5006 (if (null arg) (not gnus-dead-summary-mode)
5007 (> (prefix-numeric-value arg) 0)))
5008 (when gnus-dead-summary-mode
5009 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
5010 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
5011 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
5012 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
5013 minor-mode-map-alist)))))
5015 (defun gnus-deaden-summary ()
5016 "Make the current summary buffer into a dead summary buffer."
5017 ;; Kill any previous dead summary buffer.
5018 (when (and gnus-dead-summary
5019 (buffer-name gnus-dead-summary))
5021 (set-buffer gnus-dead-summary)
5022 (when gnus-dead-summary-mode
5023 (kill-buffer (current-buffer)))))
5024 ;; Make this the current dead summary.
5025 (setq gnus-dead-summary (current-buffer))
5026 (gnus-dead-summary-mode 1)
5027 (let ((name (buffer-name)))
5028 (when (string-match "Summary" name)
5030 (concat (substring name 0 (match-beginning 0)) "Dead "
5031 (substring name (match-beginning 0)))
5034 (defun gnus-kill-or-deaden-summary (buffer)
5035 "Kill or deaden the summary BUFFER."
5036 (when (and (buffer-name buffer)
5037 (not gnus-single-article-buffer))
5040 (gnus-kill-buffer gnus-article-buffer)
5041 (gnus-kill-buffer gnus-original-article-buffer)))
5042 (cond (gnus-kill-summary-on-exit
5043 (when (and gnus-use-trees
5044 (and (get-buffer buffer)
5045 (buffer-name (get-buffer buffer))))
5047 (set-buffer (get-buffer buffer))
5048 (gnus-tree-close gnus-newsgroup-name)))
5049 (gnus-kill-buffer buffer))
5050 ((and (get-buffer buffer)
5051 (buffer-name (get-buffer buffer)))
5054 (gnus-deaden-summary)))))
5056 (defun gnus-summary-wake-up-the-dead (&rest args)
5057 "Wake up the dead summary buffer."
5059 (gnus-dead-summary-mode -1)
5060 (let ((name (buffer-name)))
5061 (when (string-match "Dead " name)
5063 (concat (substring name 0 (match-beginning 0))
5064 (substring name (match-end 0)))
5066 (gnus-message 3 "This dead summary is now alive again"))
5068 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5069 (defun gnus-summary-fetch-faq (&optional faq-dir)
5070 "Fetch the FAQ for the current group.
5071 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5075 (when current-prefix-arg
5077 "Faq dir: " (and (listp gnus-group-faq-directory)
5078 gnus-group-faq-directory)))))
5079 (let (gnus-faq-buffer)
5080 (when (setq gnus-faq-buffer
5081 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5082 (gnus-configure-windows 'summary-faq))))
5084 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5085 (defun gnus-summary-describe-group (&optional force)
5086 "Describe the current newsgroup."
5088 (gnus-group-describe-group force gnus-newsgroup-name))
5090 (defun gnus-summary-describe-briefly ()
5091 "Describe summary mode commands briefly."
5094 (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")))
5096 ;; Walking around group mode buffer from summary mode.
5098 (defun gnus-summary-next-group (&optional no-article target-group backward)
5099 "Exit current newsgroup and then select next unread newsgroup.
5100 If prefix argument NO-ARTICLE is non-nil, no article is selected
5101 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5102 previous group instead."
5104 (gnus-set-global-variables)
5105 ;; Stop pre-fetching.
5106 (gnus-async-halt-prefetch)
5107 (let ((current-group gnus-newsgroup-name)
5108 (current-buffer (current-buffer))
5110 ;; First we semi-exit this group to update Xrefs and all variables.
5111 ;; We can't do a real exit, because the window conf must remain
5112 ;; the same in case the user is prompted for info, and we don't
5113 ;; want the window conf to change before that...
5114 (gnus-summary-exit t)
5115 (while (not entered)
5116 ;; Then we find what group we are supposed to enter.
5117 (set-buffer gnus-group-buffer)
5118 (gnus-group-jump-to-group current-group)
5121 (if (eq gnus-keep-same-level 'best)
5122 (gnus-summary-best-group gnus-newsgroup-name)
5123 (gnus-summary-search-group backward gnus-keep-same-level))))
5124 (if (not target-group)
5125 ;; There are no further groups, so we return to the group
5128 (gnus-message 5 "Returning to the group buffer")
5130 (set-buffer current-buffer)
5132 (run-hooks 'gnus-group-no-more-groups-hook))
5133 ;; We try to enter the target group.
5134 (gnus-group-jump-to-group target-group)
5135 (let ((unreads (gnus-group-group-unread)))
5136 (if (and (or (eq t unreads)
5137 (and unreads (not (zerop unreads))))
5138 (gnus-summary-read-group
5139 target-group nil no-article current-buffer))
5141 (setq current-group target-group
5142 target-group nil)))))))
5144 (defun gnus-summary-prev-group (&optional no-article)
5145 "Exit current newsgroup and then select previous unread newsgroup.
5146 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5148 (gnus-summary-next-group no-article nil t))
5150 ;; Walking around summary lines.
5152 (defun gnus-summary-first-subject (&optional unread)
5153 "Go to the first unread subject.
5154 If UNREAD is non-nil, go to the first unread article.
5155 Returns the article selected or nil if there are no unread articles."
5160 ((null gnus-newsgroup-data)
5161 (gnus-message 3 "No articles in the group")
5163 ;; Pick the first article.
5165 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5166 (gnus-data-number (car gnus-newsgroup-data)))
5167 ;; No unread articles.
5168 ((null gnus-newsgroup-unreads)
5169 (gnus-message 3 "No more unread articles")
5171 ;; Find the first unread article.
5173 (let ((data gnus-newsgroup-data))
5175 (not (gnus-data-unread-p (car data))))
5176 (setq data (cdr data)))
5178 (goto-char (gnus-data-pos (car data)))
5179 (gnus-data-number (car data))))))
5180 (gnus-summary-position-point)))
5182 (defun gnus-summary-next-subject (n &optional unread dont-display)
5183 "Go to next N'th summary line.
5184 If N is negative, go to the previous N'th subject line.
5185 If UNREAD is non-nil, only unread articles are selected.
5186 The difference between N and the actual number of steps taken is
5189 (let ((backward (< n 0))
5193 (gnus-summary-find-prev unread)
5194 (gnus-summary-find-next unread)))
5197 (gnus-message 7 "No more%s articles"
5198 (if unread " unread" "")))
5199 (unless dont-display
5200 (gnus-summary-recenter)
5201 (gnus-summary-position-point))
5204 (defun gnus-summary-next-unread-subject (n)
5205 "Go to next N'th unread summary line."
5207 (gnus-summary-next-subject n t))
5209 (defun gnus-summary-prev-subject (n &optional unread)
5210 "Go to previous N'th summary line.
5211 If optional argument UNREAD is non-nil, only unread article is selected."
5213 (gnus-summary-next-subject (- n) unread))
5215 (defun gnus-summary-prev-unread-subject (n)
5216 "Go to previous N'th unread summary line."
5218 (gnus-summary-next-subject (- n) t))
5220 (defun gnus-summary-goto-subject (article &optional force silent)
5221 "Go the subject line of ARTICLE.
5222 If FORCE, also allow jumping to articles not currently shown."
5223 (interactive "nArticle number: ")
5225 (data (gnus-data-find article)))
5226 ;; We read in the article if we have to.
5229 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5230 (setq data (gnus-data-find article)))
5235 (gnus-message 3 "Can't find article %d" article))
5237 (goto-char (gnus-data-pos data))
5240 ;; Walking around summary lines with displaying articles.
5242 (defun gnus-summary-expand-window (&optional arg)
5243 "Make the summary buffer take up the entire Emacs frame.
5244 Given a prefix, will force an `article' buffer configuration."
5246 (gnus-set-global-variables)
5248 (gnus-configure-windows 'article 'force)
5249 (gnus-configure-windows 'summary 'force)))
5251 (defun gnus-summary-display-article (article &optional all-header)
5252 "Display ARTICLE in article buffer."
5253 (gnus-set-global-variables)
5257 (if gnus-summary-display-article-function
5258 (funcall gnus-summary-display-article-function article all-header)
5259 (gnus-article-prepare article all-header))
5260 (run-hooks 'gnus-select-article-hook)
5261 (when (and gnus-current-article
5262 (not (zerop gnus-current-article)))
5263 (gnus-summary-goto-subject gnus-current-article))
5264 (gnus-summary-recenter)
5265 (when (and gnus-use-trees gnus-show-threads)
5266 (gnus-possibly-generate-tree article)
5267 (gnus-highlight-selected-tree article))
5268 ;; Successfully display article.
5269 (gnus-article-set-window-start
5270 (cdr (assq article gnus-newsgroup-bookmarks))))))
5272 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5273 "Select the current article.
5274 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5275 non-nil, the article will be re-fetched even if it already present in
5276 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5278 ;; Make sure we are in the summary buffer to work around bbdb bug.
5279 (unless (eq major-mode 'gnus-summary-mode)
5280 (set-buffer gnus-summary-buffer))
5281 (let ((article (or article (gnus-summary-article-number)))
5282 (all-headers (not (not all-headers))) ;Must be T or NIL.
5283 gnus-summary-display-article-function
5286 (gnus-summary-article-pseudo-p article)
5287 (error "This is a pseudo-article."))
5290 (set-buffer gnus-summary-buffer)
5291 (if (or (and gnus-single-article-buffer
5292 (or (null gnus-current-article)
5293 (null gnus-article-current)
5294 (null (get-buffer gnus-article-buffer))
5295 (not (eq article (cdr gnus-article-current)))
5296 (not (equal (car gnus-article-current)
5297 gnus-newsgroup-name))))
5298 (and (not gnus-single-article-buffer)
5299 (or (null gnus-current-article)
5300 (not (eq gnus-current-article article))))
5302 ;; The requested article is different from the current article.
5304 (gnus-summary-display-article article all-headers)
5306 (when (or all-headers gnus-show-all-headers)
5307 (gnus-article-show-all-headers))
5310 (gnus-article-set-window-start
5311 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5313 (defun gnus-summary-set-current-mark (&optional current-mark)
5314 "Obsolete function."
5317 (defun gnus-summary-next-article (&optional unread subject backward push)
5318 "Select the next article.
5319 If UNREAD, only unread articles are selected.
5320 If SUBJECT, only articles with SUBJECT are selected.
5321 If BACKWARD, the previous article is selected instead of the next."
5323 (gnus-set-global-variables)
5325 ;; Is there such an article?
5326 ((and (gnus-summary-search-forward unread subject backward)
5327 (or (gnus-summary-display-article (gnus-summary-article-number))
5328 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5329 (gnus-summary-position-point))
5330 ;; If not, we try the first unread, if that is wanted.
5332 gnus-auto-select-same
5333 (gnus-summary-first-unread-article))
5334 (gnus-summary-position-point)
5335 (gnus-message 6 "Wrapped"))
5336 ;; Try to get next/previous article not displayed in this group.
5337 ((and gnus-auto-extend-newsgroup
5338 (not unread) (not subject))
5339 (gnus-summary-goto-article
5340 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5342 ;; Go to next/previous group.
5344 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5345 (gnus-summary-jump-to-group gnus-newsgroup-name))
5346 (let ((cmd last-command-char)
5348 (if (eq gnus-keep-same-level 'best)
5349 (gnus-summary-best-group gnus-newsgroup-name)
5350 (gnus-summary-search-group backward gnus-keep-same-level))))
5351 ;; For some reason, the group window gets selected. We change
5353 (select-window (get-buffer-window (current-buffer)))
5354 ;; Select next unread newsgroup automagically.
5356 ((or (not gnus-auto-select-next)
5358 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5359 ((or (eq gnus-auto-select-next 'quietly)
5360 (and (eq gnus-auto-select-next 'slightly-quietly)
5362 (and (eq gnus-auto-select-next 'almost-quietly)
5363 (gnus-summary-last-article-p)))
5365 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5367 (gnus-message 7 "No more%s articles (%s)..."
5368 (if unread " unread" "")
5369 (if group (concat "selecting " group)
5371 (gnus-summary-next-group nil group backward)))
5373 (when (gnus-key-press-event-p last-input-event)
5374 (gnus-summary-walk-group-buffer
5375 gnus-newsgroup-name cmd unread backward))))))))
5377 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward)
5378 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5379 (?\C-p (gnus-group-prev-unread-group 1))))
5380 (cursor-in-echo-area t)
5381 keve key group ended)
5383 (set-buffer gnus-group-buffer)
5384 (gnus-summary-jump-to-group from-group)
5386 (if (eq gnus-keep-same-level 'best)
5387 (gnus-summary-best-group gnus-newsgroup-name)
5388 (gnus-summary-search-group backward gnus-keep-same-level))))
5391 5 "No more%s articles%s" (if unread " unread" "")
5393 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5394 (format " (Type %s for %s [%s])"
5395 (single-key-description cmd) group
5396 (car (gnus-gethash group gnus-newsrc-hashtb)))
5397 (format " (Type %s to exit %s)"
5398 (single-key-description cmd)
5399 gnus-newsgroup-name)))
5400 ;; Confirm auto selection.
5401 (setq key (car (setq keve (gnus-read-event-char))))
5404 ((assq key keystrokes)
5405 (let ((obuf (current-buffer)))
5406 (switch-to-buffer gnus-group-buffer)
5408 (gnus-group-jump-to-group group))
5409 (eval (cadr (assq key keystrokes)))
5410 (setq group (gnus-group-group-name))
5411 (switch-to-buffer obuf))
5415 (gnus-ephemeral-group-p gnus-newsgroup-name))
5417 (gnus-summary-next-group nil group backward)))
5419 (push (cdr keve) unread-command-events))))))
5421 (defun gnus-summary-next-unread-article ()
5422 "Select unread article after current one."
5424 (gnus-summary-next-article
5425 (or (not (eq gnus-summary-goto-unread 'never))
5426 (gnus-summary-last-article-p (gnus-summary-article-number)))
5427 (and gnus-auto-select-same
5428 (gnus-summary-article-subject))))
5430 (defun gnus-summary-prev-article (&optional unread subject)
5431 "Select the article after the current one.
5432 If UNREAD is non-nil, only unread articles are selected."
5434 (gnus-summary-next-article unread subject t))
5436 (defun gnus-summary-prev-unread-article ()
5437 "Select unread article before current one."
5439 (gnus-summary-prev-article
5440 (or (not (eq gnus-summary-goto-unread 'never))
5441 (gnus-summary-first-article-p (gnus-summary-article-number)))
5442 (and gnus-auto-select-same
5443 (gnus-summary-article-subject))))
5445 (defun gnus-summary-next-page (&optional lines circular)
5446 "Show next page of the selected article.
5447 If at the end of the current article, select the next article.
5448 LINES says how many lines should be scrolled up.
5450 If CIRCULAR is non-nil, go to the start of the article instead of
5451 selecting the next article when reaching the end of the current
5454 (setq gnus-summary-buffer (current-buffer))
5455 (gnus-set-global-variables)
5456 (let ((article (gnus-summary-article-number))
5457 (article-window (get-buffer-window gnus-article-buffer))
5459 (gnus-configure-windows 'article)
5460 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5461 (if (and (eq gnus-summary-goto-unread 'never)
5462 (not (gnus-summary-last-article-p article)))
5463 (gnus-summary-next-article)
5464 (gnus-summary-next-unread-article))
5465 (if (or (null gnus-current-article)
5466 (null gnus-article-current)
5467 (/= article (cdr gnus-article-current))
5468 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5469 ;; Selected subject is different from current article's.
5470 (gnus-summary-display-article article)
5471 (when article-window
5472 (gnus-eval-in-buffer-window gnus-article-buffer
5473 (setq endp (gnus-article-next-page lines)))
5476 (gnus-summary-beginning-of-article))
5478 (gnus-message 3 "End of message"))
5480 (if (and (eq gnus-summary-goto-unread 'never)
5481 (not (gnus-summary-last-article-p article)))
5482 (gnus-summary-next-article)
5483 (gnus-summary-next-unread-article))))))))
5484 (gnus-summary-recenter)
5485 (gnus-summary-position-point)))
5487 (defun gnus-summary-prev-page (&optional lines)
5488 "Show previous page of selected article.
5489 Argument LINES specifies lines to be scrolled down."
5491 (gnus-set-global-variables)
5492 (let ((article (gnus-summary-article-number)))
5493 (gnus-configure-windows 'article)
5494 (if (or (null gnus-current-article)
5495 (null gnus-article-current)
5496 (/= article (cdr gnus-article-current))
5497 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5498 ;; Selected subject is different from current article's.
5499 (gnus-summary-display-article article)
5500 (gnus-summary-recenter)
5501 (gnus-eval-in-buffer-window gnus-article-buffer
5502 (gnus-article-prev-page lines))))
5503 (gnus-summary-position-point))
5505 (defun gnus-summary-scroll-up (lines)
5506 "Scroll up (or down) one line current article.
5507 Argument LINES specifies lines to be scrolled up (or down if negative)."
5509 (gnus-set-global-variables)
5510 (gnus-configure-windows 'article)
5511 (gnus-summary-show-thread)
5512 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5513 (gnus-eval-in-buffer-window gnus-article-buffer
5515 (when (gnus-article-next-page lines)
5516 (gnus-message 3 "End of message")))
5518 (gnus-article-prev-page (- lines))))))
5519 (gnus-summary-recenter)
5520 (gnus-summary-position-point))
5522 (defun gnus-summary-next-same-subject ()
5523 "Select next article which has the same subject as current one."
5525 (gnus-set-global-variables)
5526 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5528 (defun gnus-summary-prev-same-subject ()
5529 "Select previous article which has the same subject as current one."
5531 (gnus-set-global-variables)
5532 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5534 (defun gnus-summary-next-unread-same-subject ()
5535 "Select next unread article which has the same subject as current one."
5537 (gnus-set-global-variables)
5538 (gnus-summary-next-article t (gnus-summary-article-subject)))
5540 (defun gnus-summary-prev-unread-same-subject ()
5541 "Select previous unread article which has the same subject as current one."
5543 (gnus-set-global-variables)
5544 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5546 (defun gnus-summary-first-unread-article ()
5547 "Select the first unread article.
5548 Return nil if there are no unread articles."
5550 (gnus-set-global-variables)
5552 (when (gnus-summary-first-subject t)
5553 (gnus-summary-show-thread)
5554 (gnus-summary-first-subject t)
5555 (gnus-summary-display-article (gnus-summary-article-number)))
5556 (gnus-summary-position-point)))
5558 (defun gnus-summary-first-article ()
5559 "Select the first article.
5560 Return nil if there are no articles."
5562 (gnus-set-global-variables)
5564 (when (gnus-summary-first-subject)
5565 (gnus-summary-show-thread)
5566 (gnus-summary-first-subject)
5567 (gnus-summary-display-article (gnus-summary-article-number)))
5568 (gnus-summary-position-point)))
5570 (defun gnus-summary-best-unread-article ()
5571 "Select the unread article with the highest score."
5573 (gnus-set-global-variables)
5574 (let ((best -1000000)
5575 (data gnus-newsgroup-data)
5578 (and (gnus-data-unread-p (car data))
5580 (gnus-summary-article-score (gnus-data-number (car data))))
5583 article (gnus-data-number (car data))))
5584 (setq data (cdr data)))
5587 (gnus-summary-goto-article article)
5588 (error "No unread articles"))
5589 (gnus-summary-position-point))))
5591 (defun gnus-summary-last-subject ()
5592 "Go to the last displayed subject line in the group."
5593 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5595 (gnus-summary-goto-subject article))))
5597 (defun gnus-summary-goto-article (article &optional all-headers force)
5598 "Fetch ARTICLE and display it if it exists.
5599 If ALL-HEADERS is non-nil, no header lines are hidden."
5605 (mapcar (lambda (number) (list (int-to-string number)))
5606 gnus-newsgroup-limit)))
5610 (if (gnus-summary-goto-subject article force)
5611 (gnus-summary-display-article article all-headers)
5612 (gnus-message 4 "Couldn't go to article %s" article) nil)
5613 (gnus-summary-position-point)))
5615 (defun gnus-summary-goto-last-article ()
5616 "Go to the previously read article."
5619 (when gnus-last-article
5620 (gnus-summary-goto-article gnus-last-article))
5621 (gnus-summary-position-point)))
5623 (defun gnus-summary-pop-article (number)
5624 "Pop one article off the history and go to the previous.
5625 NUMBER articles will be popped off."
5628 (setq gnus-newsgroup-history
5629 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5631 (gnus-summary-goto-article (car to))
5632 (error "Article history empty")))
5633 (gnus-summary-position-point))
5635 ;; Summary commands and functions for limiting the summary buffer.
5637 (defun gnus-summary-limit-to-articles (n)
5638 "Limit the summary buffer to the next N articles.
5639 If not given a prefix, use the process marked articles instead."
5641 (gnus-set-global-variables)
5643 (let ((articles (gnus-summary-work-articles n)))
5644 (setq gnus-newsgroup-processable nil)
5645 (gnus-summary-limit articles))
5646 (gnus-summary-position-point)))
5648 (defun gnus-summary-pop-limit (&optional total)
5649 "Restore the previous limit.
5650 If given a prefix, remove all limits."
5652 (gnus-set-global-variables)
5654 (setq gnus-newsgroup-limits
5655 (list (mapcar (lambda (h) (mail-header-number h))
5656 gnus-newsgroup-headers))))
5657 (unless gnus-newsgroup-limits
5658 (error "No limit to pop"))
5660 (gnus-summary-limit nil 'pop)
5661 (gnus-summary-position-point)))
5663 (defun gnus-summary-limit-to-subject (subject &optional header)
5664 "Limit the summary buffer to articles that have subjects that match a regexp."
5665 (interactive "sLimit to subject (regexp): ")
5667 (setq header "subject"))
5668 (when (not (equal "" subject))
5670 (let ((articles (gnus-summary-find-matching
5671 (or header "subject") subject 'all)))
5673 (error "Found no matches for \"%s\"" subject))
5674 (gnus-summary-limit articles))
5675 (gnus-summary-position-point))))
5677 (defun gnus-summary-limit-to-author (from)
5678 "Limit the summary buffer to articles that have authors that match a regexp."
5679 (interactive "sLimit to author (regexp): ")
5680 (gnus-summary-limit-to-subject from "from"))
5682 (defun gnus-summary-limit-to-age (age &optional younger-p)
5683 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5684 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5685 articles that are younger than AGE days."
5686 (interactive "nTime in days: \nP")
5688 (let ((data gnus-newsgroup-data)
5689 (cutoff (nnmail-days-to-time age))
5690 articles d date is-younger)
5691 (while (setq d (pop data))
5692 (when (and (vectorp (gnus-data-header d))
5693 (setq date (mail-header-date (gnus-data-header d))))
5694 (setq is-younger (nnmail-time-less
5695 (nnmail-time-since (nnmail-date-to-time date))
5697 (when (if younger-p is-younger (not is-younger))
5698 (push (gnus-data-number d) articles))))
5699 (gnus-summary-limit (nreverse articles)))
5700 (gnus-summary-position-point)))
5702 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5704 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5706 (defun gnus-summary-limit-to-unread (&optional all)
5707 "Limit the summary buffer to articles that are not marked as read.
5708 If ALL is non-nil, limit strictly to unread articles."
5711 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5712 (gnus-summary-limit-to-marks
5713 ;; Concat all the marks that say that an article is read and have
5715 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5716 gnus-killed-mark gnus-kill-file-mark
5717 gnus-low-score-mark gnus-expirable-mark
5718 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5719 gnus-duplicate-mark)
5722 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5723 (make-obsolete 'gnus-summary-delete-marked-with
5724 'gnus-summary-limit-exlude-marks)
5726 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5727 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5728 If REVERSE, limit the summary buffer to articles that are marked
5729 with MARKS. MARKS can either be a string of marks or a list of marks.
5730 Returns how many articles were removed."
5731 (interactive "sMarks: ")
5732 (gnus-summary-limit-to-marks marks t))
5734 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5735 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5736 If REVERSE (the prefix), limit the summary buffer to articles that are
5737 not marked with MARKS. MARKS can either be a string of marks or a
5739 Returns how many articles were removed."
5740 (interactive (list (read-string "Marks: ") current-prefix-arg))
5741 (gnus-set-global-variables)
5743 (let ((data gnus-newsgroup-data)
5744 (marks (if (listp marks) marks
5745 (append marks nil))) ; Transform to list.
5748 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5749 (memq (gnus-data-mark (car data)) marks))
5750 (push (gnus-data-number (car data)) articles))
5751 (setq data (cdr data)))
5752 (gnus-summary-limit articles))
5753 (gnus-summary-position-point)))
5755 (defun gnus-summary-limit-to-score (&optional score)
5756 "Limit to articles with score at or above SCORE."
5758 (gnus-set-global-variables)
5759 (setq score (if score
5760 (prefix-numeric-value score)
5761 (or gnus-summary-default-score 0)))
5762 (let ((data gnus-newsgroup-data)
5765 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5767 (push (gnus-data-number (car data)) articles))
5768 (setq data (cdr data)))
5770 (gnus-summary-limit articles)
5771 (gnus-summary-position-point))))
5773 (defun gnus-summary-limit-include-dormant ()
5774 "Display all the hidden articles that are marked as dormant."
5776 (gnus-set-global-variables)
5777 (unless gnus-newsgroup-dormant
5778 (error "There are no dormant articles in this group"))
5780 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5781 (gnus-summary-position-point)))
5783 (defun gnus-summary-limit-exclude-dormant ()
5784 "Hide all dormant articles."
5786 (gnus-set-global-variables)
5788 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5789 (gnus-summary-position-point)))
5791 (defun gnus-summary-limit-exclude-childless-dormant ()
5792 "Hide all dormant articles that have no children."
5794 (gnus-set-global-variables)
5795 (let ((data (gnus-data-list t))
5796 articles d children)
5797 ;; Find all articles that are either not dormant or have
5799 (while (setq d (pop data))
5800 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5802 (gnus-article-children (gnus-data-number d)))
5805 (when (memq (car children) articles)
5810 (push (gnus-data-number d) articles)))
5813 (gnus-summary-limit articles)
5814 (gnus-summary-position-point))))
5816 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5817 "Mark all unread excluded articles as read.
5818 If ALL, mark even excluded ticked and dormants as read."
5820 (let ((articles (gnus-sorted-complement
5822 (mapcar (lambda (h) (mail-header-number h))
5823 gnus-newsgroup-headers)
5825 (sort gnus-newsgroup-limit '<)))
5827 (setq gnus-newsgroup-unreads nil)
5829 (setq gnus-newsgroup-dormant nil
5830 gnus-newsgroup-marked nil
5831 gnus-newsgroup-reads
5833 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5834 gnus-newsgroup-reads))
5835 (while (setq article (pop articles))
5836 (unless (or (memq article gnus-newsgroup-dormant)
5837 (memq article gnus-newsgroup-marked))
5838 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5840 (defun gnus-summary-limit (articles &optional pop)
5842 ;; We pop the previous limit off the stack and use that.
5843 (setq articles (car gnus-newsgroup-limits)
5844 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5845 ;; We use the new limit, so we push the old limit on the stack.
5846 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5848 (setq gnus-newsgroup-limit articles)
5849 (let ((total (length gnus-newsgroup-data))
5850 (data (gnus-data-find-list (gnus-summary-article-number)))
5851 (gnus-summary-mark-below nil) ; Inhibit this.
5853 ;; This will do all the work of generating the new summary buffer
5854 ;; according to the new limit.
5855 (gnus-summary-prepare)
5856 ;; Hide any threads, possibly.
5857 (and gnus-show-threads
5858 gnus-thread-hide-subtree
5859 (gnus-summary-hide-all-threads))
5860 ;; Try to return to the article you were at, or one in the
5863 ;; We try to find some article after the current one.
5865 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5868 (setq data (cdr data))))
5870 ;; If there is no data, that means that we were after the last
5871 ;; article. The same goes when we can't find any articles
5872 ;; after the current one.
5873 (goto-char (point-max))
5874 (gnus-summary-find-prev))
5875 ;; We return how many articles were removed from the summary
5876 ;; buffer as a result of the new limit.
5877 (- total (length gnus-newsgroup-data))))
5879 (defsubst gnus-invisible-cut-children (threads)
5882 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5887 (defsubst gnus-cut-thread (thread)
5888 "Go forwards in the thread until we find an article that we want to display."
5889 (when (or (eq gnus-fetch-old-headers 'some)
5890 (eq gnus-build-sparse-threads 'some)
5891 (eq gnus-build-sparse-threads 'more))
5892 ;; Deal with old-fetched headers and sparse threads.
5896 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5897 (gnus-summary-article-ancient-p
5898 (mail-header-number (car thread))))
5900 (if (<= (length (cdr thread)) 1)
5901 (setq thread (cadr thread))
5902 (when (gnus-invisible-cut-children (cdr thread))
5903 (let ((th (cdr thread)))
5905 (if (memq (mail-header-number (caar th))
5906 gnus-newsgroup-limit)
5907 (setq thread (car th)
5909 (setq th (cdr th)))))))))
5913 (defun gnus-cut-threads (threads)
5914 "Cut off all uninteresting articles from the beginning of threads."
5915 (when (or (eq gnus-fetch-old-headers 'some)
5916 (eq gnus-build-sparse-threads 'some)
5917 (eq gnus-build-sparse-threads 'more))
5920 (setcar th (gnus-cut-thread (car th)))
5921 (setq th (cdr th)))))
5922 ;; Remove nixed out threads.
5925 (defun gnus-summary-initial-limit (&optional show-if-empty)
5926 "Figure out what the initial limit is supposed to be on group entry.
5927 This entails weeding out unwanted dormants, low-scored articles,
5928 fetch-old-headers verbiage, and so on."
5929 ;; Most groups have nothing to remove.
5930 (if (or gnus-inhibit-limiting
5931 (and (null gnus-newsgroup-dormant)
5932 (not (eq gnus-fetch-old-headers 'some))
5933 (null gnus-summary-expunge-below)
5934 (not (eq gnus-build-sparse-threads 'some))
5935 (not (eq gnus-build-sparse-threads 'more))
5936 (null gnus-thread-expunge-below)
5937 (not gnus-use-nocem)))
5939 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5940 (setq gnus-newsgroup-limit nil)
5943 (unless (car (symbol-value node))
5944 ;; These threads have no parents -- they are roots.
5945 (let ((nodes (cdr (symbol-value node)))
5948 (if (and gnus-thread-expunge-below
5949 (< (gnus-thread-total-score (car nodes))
5950 gnus-thread-expunge-below))
5951 (gnus-expunge-thread (pop nodes))
5952 (setq thread (pop nodes))
5953 (gnus-summary-limit-children thread))))))
5954 gnus-newsgroup-dependencies)
5955 ;; If this limitation resulted in an empty group, we might
5956 ;; pop the previous limit and use it instead.
5957 (when (and (not gnus-newsgroup-limit)
5959 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5960 gnus-newsgroup-limit))
5962 (defun gnus-summary-limit-children (thread)
5963 "Return 1 if this subthread is visible and 0 if it is not."
5964 ;; First we get the number of visible children to this thread. This
5965 ;; is done by recursing down the thread using this function, so this
5966 ;; will really go down to a leaf article first, before slowly
5967 ;; working its way up towards the root.
5971 (apply '+ (mapcar 'gnus-summary-limit-children
5974 (number (mail-header-number (car thread)))
5977 (not (memq number gnus-newsgroup-marked))
5979 ;; If this article is dormant and has absolutely no visible
5980 ;; children, then this article isn't visible.
5981 (and (memq number gnus-newsgroup-dormant)
5983 ;; If this is "fetch-old-headered" and there is no
5984 ;; visible children, then we don't want this article.
5985 (and (eq gnus-fetch-old-headers 'some)
5986 (gnus-summary-article-ancient-p number)
5988 ;; If this is a sparsely inserted article with no children,
5989 ;; we don't want it.
5990 (and (eq gnus-build-sparse-threads 'some)
5991 (gnus-summary-article-sparse-p number)
5993 ;; If we use expunging, and this article is really
5994 ;; low-scored, then we don't want this article.
5995 (when (and gnus-summary-expunge-below
5997 (or (cdr (assq number gnus-newsgroup-scored))
5998 gnus-summary-default-score))
5999 gnus-summary-expunge-below))
6000 ;; We increase the expunge-tally here, but that has
6001 ;; nothing to do with the limits, really.
6002 (incf gnus-newsgroup-expunged-tally)
6003 ;; We also mark as read here, if that's wanted.
6004 (when (and gnus-summary-mark-below
6005 (< score gnus-summary-mark-below))
6006 (setq gnus-newsgroup-unreads
6007 (delq number gnus-newsgroup-unreads))
6008 (if gnus-newsgroup-auto-expire
6009 (push number gnus-newsgroup-expirable)
6010 (push (cons number gnus-low-score-mark)
6011 gnus-newsgroup-reads)))
6013 ;; Check NoCeM things.
6014 (if (and gnus-use-nocem
6015 (gnus-nocem-unwanted-article-p
6016 (mail-header-id (car thread))))
6018 (setq gnus-newsgroup-reads
6019 (delq number gnus-newsgroup-unreads))
6021 ;; Nope, invisible article.
6023 ;; Ok, this article is to be visible, so we add it to the limit
6025 (push number gnus-newsgroup-limit)
6028 (defun gnus-expunge-thread (thread)
6029 "Mark all articles in THREAD as read."
6030 (let* ((number (mail-header-number (car thread))))
6031 (incf gnus-newsgroup-expunged-tally)
6032 ;; We also mark as read here, if that's wanted.
6033 (setq gnus-newsgroup-unreads
6034 (delq number gnus-newsgroup-unreads))
6035 (if gnus-newsgroup-auto-expire
6036 (push number gnus-newsgroup-expirable)
6037 (push (cons number gnus-low-score-mark)
6038 gnus-newsgroup-reads)))
6039 ;; Go recursively through all subthreads.
6040 (mapcar 'gnus-expunge-thread (cdr thread)))
6042 ;; Summary article oriented commands
6044 (defun gnus-summary-refer-parent-article (n)
6045 "Refer parent article N times.
6046 If N is negative, go to ancestor -N instead.
6047 The difference between N and the number of articles fetched is returned."
6049 (gnus-set-global-variables)
6052 (when (not (natnump n))
6057 (setq header (gnus-summary-article-header))
6058 (if (and (eq (mail-header-number header)
6059 (cdr gnus-article-current))
6060 (equal gnus-newsgroup-name
6061 (car gnus-article-current)))
6062 ;; If we try to find the parent of the currently
6063 ;; displayed article, then we take a look at the actual
6064 ;; References header, since this is slightly more
6065 ;; reliable than the References field we got from the
6068 (set-buffer gnus-original-article-buffer)
6069 (nnheader-narrow-to-headers)
6070 (unless (setq ref (message-fetch-field "references"))
6071 (setq ref (message-fetch-field "in-reply-to")))
6074 ;; It's not the current article, so we take a bet on
6075 ;; the value we got from the server.
6076 (mail-header-references header)))
6078 (not (equal ref "")))
6079 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6080 (gnus-message 1 "Couldn't find parent"))
6081 (gnus-message 1 "No references in article %d"
6082 (gnus-summary-article-number))
6085 (gnus-summary-position-point)
6088 (defun gnus-summary-refer-references ()
6089 "Fetch all articles mentioned in the References header.
6090 Return how many articles were fetched."
6092 (gnus-set-global-variables)
6093 (let ((ref (mail-header-references (gnus-summary-article-header)))
6094 (current (gnus-summary-article-number))
6098 (error "No References in the current article")
6099 ;; For each Message-ID in the References header...
6100 (while (string-match "<[^>]*>" ref)
6102 ;; ... fetch that article.
6103 (gnus-summary-refer-article
6104 (prog1 (match-string 0 ref)
6105 (setq ref (substring ref (match-end 0))))))
6106 (gnus-summary-goto-subject current)
6107 (gnus-summary-position-point)
6110 (defun gnus-summary-refer-article (message-id)
6111 "Fetch an article specified by MESSAGE-ID."
6112 (interactive "sMessage-ID: ")
6113 (when (and (stringp message-id)
6114 (not (zerop (length message-id))))
6115 ;; Construct the correct Message-ID if necessary.
6116 ;; Suggested by tale@pawl.rpi.edu.
6117 (unless (string-match "^<" message-id)
6118 (setq message-id (concat "<" message-id)))
6119 (unless (string-match ">$" message-id)
6120 (setq message-id (concat message-id ">")))
6121 (let* ((header (gnus-id-to-header message-id))
6123 (gnus-summary-article-sparse-p
6124 (mail-header-number header)))))
6127 ;; The article is present in the buffer, to we just go to it.
6128 (gnus-summary-goto-article
6129 (mail-header-number header) nil header)
6131 (gnus-summary-update-article (mail-header-number header))))
6132 ;; We fetch the article
6133 (let ((gnus-override-method
6134 (and (gnus-news-group-p gnus-newsgroup-name)
6135 gnus-refer-article-method))
6137 ;; Start the special refer-article method, if necessary.
6138 (when (and gnus-refer-article-method
6139 (gnus-news-group-p gnus-newsgroup-name))
6140 (gnus-check-server gnus-refer-article-method))
6141 ;; Fetch the header, and display the article.
6142 (if (setq number (gnus-summary-insert-subject message-id))
6143 (gnus-summary-select-article nil nil nil number)
6144 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6146 (defun gnus-summary-enter-digest-group (&optional force)
6147 "Enter an nndoc group based on the current article.
6148 If FORCE, force a digest interpretation. If not, try
6149 to guess what the document format is."
6151 (gnus-set-global-variables)
6152 (let ((conf gnus-current-window-configuration))
6154 (gnus-summary-select-article))
6155 (setq gnus-current-window-configuration conf)
6156 (let* ((name (format "%s-%d"
6157 (gnus-group-prefixed-name
6158 gnus-newsgroup-name (list 'nndoc ""))
6160 (set-buffer gnus-summary-buffer)
6161 gnus-current-article)))
6162 (ogroup gnus-newsgroup-name)
6163 (params (append (gnus-info-params (gnus-get-info ogroup))
6164 (list (cons 'to-group ogroup))))
6165 (case-fold-search t)
6166 (buf (current-buffer))
6169 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6170 (insert-buffer-substring gnus-original-article-buffer)
6171 ;; Remove lines that may lead nndoc to misinterpret the
6174 (goto-char (point-min))
6175 (or (search-forward "\n\n" nil t) (point)))
6176 (goto-char (point-min))
6177 (delete-matching-lines "^\\(Path\\):\\|^From ")
6180 (if (gnus-group-read-ephemeral-group
6181 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6183 ,(if force 'digest 'guess))) t)
6184 ;; Make all postings to this group go to the parent group.
6185 (nconc (gnus-info-params (gnus-get-info name))
6187 ;; Couldn't select this doc group.
6188 (switch-to-buffer buf)
6189 (gnus-set-global-variables)
6190 (gnus-configure-windows 'summary)
6191 (gnus-message 3 "Article couldn't be entered?"))
6192 (kill-buffer dig)))))
6194 (defun gnus-summary-read-document (n)
6195 "Open a new group based on the current article(s).
6196 This will allow you to read digests and other similar
6197 documents as newsgroups.
6198 Obeys the standard process/prefix convention."
6200 (let* ((articles (gnus-summary-work-articles n))
6201 (ogroup gnus-newsgroup-name)
6202 (params (append (gnus-info-params (gnus-get-info ogroup))
6203 (list (cons 'to-group ogroup))))
6204 article group egroup groups vgroup)
6205 (while (setq article (pop articles))
6206 (setq group (format "%s-%d" gnus-newsgroup-name article))
6207 (gnus-summary-remove-process-mark article)
6208 (when (gnus-summary-display-article article)
6210 (nnheader-temp-write nil
6211 (insert-buffer-substring gnus-original-article-buffer)
6212 ;; Remove some headers that may lead nndoc to make
6214 (message-narrow-to-head)
6215 (goto-char (point-min))
6216 (delete-matching-lines "^\\(Path\\):\\|^From ")
6219 (gnus-group-read-ephemeral-group
6220 group `(nndoc ,group (nndoc-address ,(current-buffer))
6221 (nndoc-article-type guess))
6224 ;; Make all postings to this group go to the parent group.
6225 (nconc (gnus-info-params (gnus-get-info egroup))
6227 (push egroup groups))
6228 ;; Couldn't select this doc group.
6229 (gnus-error 3 "Article couldn't be entered"))))))
6230 ;; Now we have selected all the documents.
6233 (error "None of the articles could be interpreted as documents"))
6234 ((gnus-group-read-ephemeral-group
6235 (setq vgroup (format
6236 "nnvirtual:%s-%s" gnus-newsgroup-name
6237 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6238 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6240 (cons (current-buffer) 'summary)))
6242 (error "Couldn't select virtual nndoc group")))))
6244 (defun gnus-summary-isearch-article (&optional regexp-p)
6245 "Do incremental search forward on the current article.
6246 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6248 (gnus-set-global-variables)
6249 (gnus-summary-select-article)
6250 (gnus-configure-windows 'article)
6251 (gnus-eval-in-buffer-window gnus-article-buffer
6252 ;;(goto-char (point-min))
6253 (isearch-forward regexp-p)))
6255 (defun gnus-summary-search-article-forward (regexp &optional backward)
6256 "Search for an article containing REGEXP forward.
6257 If BACKWARD, search backward instead."
6260 (format "Search article %s (regexp%s): "
6261 (if current-prefix-arg "backward" "forward")
6262 (if gnus-last-search-regexp
6263 (concat ", default " gnus-last-search-regexp)
6265 current-prefix-arg))
6266 (gnus-set-global-variables)
6267 (if (string-equal regexp "")
6268 (setq regexp (or gnus-last-search-regexp ""))
6269 (setq gnus-last-search-regexp regexp))
6270 (if (gnus-summary-search-article regexp backward)
6271 (gnus-summary-show-thread)
6272 (error "Search failed: \"%s\"" regexp)))
6274 (defun gnus-summary-search-article-backward (regexp)
6275 "Search for an article containing REGEXP backward."
6278 (format "Search article backward (regexp%s): "
6279 (if gnus-last-search-regexp
6280 (concat ", default " gnus-last-search-regexp)
6282 (gnus-summary-search-article-forward regexp 'backward))
6284 (defun gnus-summary-search-article (regexp &optional backward)
6285 "Search for an article containing REGEXP.
6286 Optional argument BACKWARD means do search for backward.
6287 `gnus-select-article-hook' is not called during the search."
6288 (let ((gnus-select-article-hook nil) ;Disable hook.
6289 (gnus-article-display-hook nil)
6290 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6291 (gnus-use-article-prefetch nil)
6292 (sum (current-buffer))
6295 (gnus-save-hidden-threads
6296 (gnus-summary-select-article)
6297 (set-buffer gnus-article-buffer)
6301 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6303 (re-search-backward regexp nil t)
6304 (re-search-forward regexp nil t))
6305 ;; We found the regexp.
6310 (get-buffer-window (current-buffer))
6314 (setq point (point)))
6315 ;; We didn't find it, so we go to the next article.
6318 (while (eq found 'not)
6319 (if (not (if backward (gnus-summary-find-prev)
6320 (gnus-summary-find-next)))
6321 ;; No more articles.
6323 ;; Select the next article and adjust point.
6324 (unless (gnus-summary-article-sparse-p
6325 (gnus-summary-article-number))
6327 (gnus-summary-select-article)
6328 (set-buffer gnus-article-buffer)
6330 (goto-char (if backward (point-max) (point-min))))))))
6331 (gnus-message 7 ""))
6332 ;; Return whether we found the regexp.
6333 (when (eq found 'found)
6335 (gnus-summary-show-thread)
6336 (gnus-summary-goto-subject gnus-current-article)
6337 (gnus-summary-position-point)
6340 (defun gnus-summary-find-matching (header regexp &optional backward unread
6342 "Return a list of all articles that match REGEXP on HEADER.
6343 The search stars on the current article and goes forwards unless
6344 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6345 If UNREAD is non-nil, only unread articles will
6346 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6347 in the comparisons."
6348 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6349 (gnus-data-find-list
6350 (gnus-summary-article-number) (gnus-data-list backward))))
6351 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6352 (case-fold-search (not not-case-fold))
6354 (unless (fboundp (intern (concat "mail-header-" header)))
6355 (error "%s is not a valid header" header))
6358 (and (or (not unread) ; We want all articles...
6359 (gnus-data-unread-p d)) ; Or just unreads.
6360 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6361 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6362 (push (gnus-data-number d) articles)) ; Success!
6363 (setq data (cdr data)))
6364 (nreverse articles)))
6366 (defun gnus-summary-execute-command (header regexp command &optional backward)
6367 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6368 If HEADER is an empty string (or nil), the match is done on the entire
6369 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6371 (list (let ((completion-ignore-case t))
6374 (mapcar (lambda (string) (list string))
6375 '("Number" "Subject" "From" "Lines" "Date"
6376 "Message-ID" "Xref" "References" "Body"))
6377 nil 'require-match))
6378 (read-string "Regexp: ")
6379 (read-key-sequence "Command: ")
6380 current-prefix-arg))
6381 (when (equal header "Body")
6383 (gnus-set-global-variables)
6384 ;; Hidden thread subtrees must be searched as well.
6385 (gnus-summary-show-all-threads)
6386 ;; We don't want to change current point nor window configuration.
6388 (save-window-excursion
6389 (gnus-message 6 "Executing %s..." (key-description command))
6390 ;; We'd like to execute COMMAND interactively so as to give arguments.
6391 (gnus-execute header regexp
6392 `(call-interactively ',(key-binding command))
6394 (gnus-message 6 "Executing %s...done" (key-description command)))))
6396 (defun gnus-summary-beginning-of-article ()
6397 "Scroll the article back to the beginning."
6399 (gnus-set-global-variables)
6400 (gnus-summary-select-article)
6401 (gnus-configure-windows 'article)
6402 (gnus-eval-in-buffer-window gnus-article-buffer
6404 (goto-char (point-min))
6405 (when gnus-break-pages
6406 (gnus-narrow-to-page))))
6408 (defun gnus-summary-end-of-article ()
6409 "Scroll to the end of the article."
6411 (gnus-set-global-variables)
6412 (gnus-summary-select-article)
6413 (gnus-configure-windows 'article)
6414 (gnus-eval-in-buffer-window gnus-article-buffer
6416 (goto-char (point-max))
6418 (when gnus-break-pages
6419 (gnus-narrow-to-page))))
6421 (defun gnus-summary-print-article (&optional filename)
6422 "Generate and print a PostScript image of the article buffer.
6424 If the optional argument FILENAME is nil, send the image to the printer.
6425 If FILENAME is a string, save the PostScript image in a file with that
6426 name. If FILENAME is a number, prompt the user for the name of the file
6428 (interactive (list (ps-print-preprint current-prefix-arg)))
6429 (gnus-summary-select-article)
6430 (gnus-eval-in-buffer-window gnus-article-buffer
6431 (let ((buffer (generate-new-buffer " *print*")))
6434 (copy-to-buffer buffer (point-min) (point-max))
6436 (gnus-article-delete-invisible-text)
6437 (ps-print-buffer-with-faces filename))
6438 (kill-buffer buffer)))))
6440 (defun gnus-summary-show-article (&optional arg)
6441 "Force re-fetching of the current article.
6442 If ARG (the prefix) is non-nil, show the raw article without any
6443 article massaging functions being run."
6445 (gnus-set-global-variables)
6447 ;; Select the article the normal way.
6448 (gnus-summary-select-article nil 'force)
6449 ;; Bind the article treatment functions to nil.
6450 (let ((gnus-have-all-headers t)
6451 gnus-article-display-hook
6452 gnus-article-prepare-hook
6455 (gnus-summary-select-article nil 'force)))
6456 (gnus-summary-goto-subject gnus-current-article)
6457 ; (gnus-configure-windows 'article)
6458 (gnus-summary-position-point))
6460 (defun gnus-summary-verbose-headers (&optional arg)
6461 "Toggle permanent full header display.
6462 If ARG is a positive number, turn header display on.
6463 If ARG is a negative number, turn header display off."
6465 (gnus-set-global-variables)
6466 (setq gnus-show-all-headers
6467 (cond ((or (not (numberp arg))
6469 (not gnus-show-all-headers))
6472 (gnus-summary-show-article))
6474 (defun gnus-summary-toggle-header (&optional arg)
6475 "Show the headers if they are hidden, or hide them if they are shown.
6476 If ARG is a positive number, show the entire header.
6477 If ARG is a negative number, hide the unwanted header lines."
6479 (gnus-set-global-variables)
6481 (set-buffer gnus-article-buffer)
6482 (let* ((buffer-read-only nil)
6483 (inhibit-point-motion-hooks t)
6484 (hidden (text-property-any
6485 (goto-char (point-min)) (search-forward "\n\n")
6488 (goto-char (point-min))
6489 (when (search-forward "\n\n" nil t)
6490 (delete-region (point-min) (1- (point))))
6491 (goto-char (point-min))
6493 (set-buffer gnus-original-article-buffer)
6494 (goto-char (point-min))
6495 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6496 (insert-buffer-substring gnus-original-article-buffer 1 e)
6497 (let ((article-inhibit-hiding t))
6498 (run-hooks 'gnus-article-display-hook))
6499 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6500 (gnus-article-hide-headers)))))
6502 (defun gnus-summary-show-all-headers ()
6503 "Make all header lines visible."
6505 (gnus-set-global-variables)
6506 (gnus-article-show-all-headers))
6508 (defun gnus-summary-toggle-mime (&optional arg)
6509 "Toggle MIME processing.
6510 If ARG is a positive number, turn MIME processing on."
6512 (gnus-set-global-variables)
6513 (setq gnus-show-mime
6514 (if (null arg) (not gnus-show-mime)
6515 (> (prefix-numeric-value arg) 0)))
6516 (gnus-summary-select-article t 'force))
6518 (defun gnus-summary-caesar-message (&optional arg)
6519 "Caesar rotate the current article by 13.
6520 The numerical prefix specifies how many places to rotate each letter
6523 (gnus-set-global-variables)
6524 (gnus-summary-select-article)
6525 (let ((mail-header-separator ""))
6526 (gnus-eval-in-buffer-window gnus-article-buffer
6529 (let ((start (window-start))
6531 (message-caesar-buffer-body arg)
6532 (set-window-start (get-buffer-window (current-buffer)) start))))))
6534 (defun gnus-summary-stop-page-breaking ()
6535 "Stop page breaking in the current article."
6537 (gnus-set-global-variables)
6538 (gnus-summary-select-article)
6539 (gnus-eval-in-buffer-window gnus-article-buffer
6541 (when (gnus-visual-p 'page-marker)
6542 (let ((buffer-read-only nil))
6543 (gnus-remove-text-with-property 'gnus-prev)
6544 (gnus-remove-text-with-property 'gnus-next)))))
6546 (defun gnus-summary-move-article (&optional n to-newsgroup
6547 select-method action)
6548 "Move the current article to a different newsgroup.
6549 If N is a positive number, move the N next articles.
6550 If N is a negative number, move the N previous articles.
6551 If N is nil and any articles have been marked with the process mark,
6552 move those articles instead.
6553 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6554 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6555 re-spool using this method.
6557 For this function to work, both the current newsgroup and the
6558 newsgroup that you want to move to have to support the `request-move'
6559 and `request-accept' functions."
6562 (setq action 'move))
6563 (gnus-set-global-variables)
6564 ;; Disable marking as read.
6565 (let (gnus-mark-article-hook)
6566 (save-window-excursion
6567 (gnus-summary-select-article)))
6568 ;; Check whether the source group supports the required functions.
6569 (cond ((and (eq action 'move)
6570 (not (gnus-check-backend-function
6571 'request-move-article gnus-newsgroup-name)))
6572 (error "The current group does not support article moving"))
6573 ((and (eq action 'crosspost)
6574 (not (gnus-check-backend-function
6575 'request-replace-article gnus-newsgroup-name)))
6576 (error "The current group does not support article editing")))
6577 (let ((articles (gnus-summary-work-articles n))
6578 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6579 (names '((move "Move" "Moving")
6580 (copy "Copy" "Copying")
6581 (crosspost "Crosspost" "Crossposting")))
6582 (copy-buf (save-excursion
6583 (nnheader-set-temp-buffer " *copy article*")))
6584 art-group to-method new-xref article to-groups)
6585 (unless (assq action names)
6586 (error "Unknown action %s" action))
6587 ;; Read the newsgroup name.
6588 (when (and (not to-newsgroup)
6589 (not select-method))
6591 (gnus-read-move-group-name
6592 (cadr (assq action names))
6593 (symbol-value (intern (format "gnus-current-%s-group" action)))
6595 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6596 (setq to-method (or select-method
6597 (gnus-group-name-to-method to-newsgroup)))
6598 ;; Check the method we are to move this article to...
6599 (unless (gnus-check-backend-function
6600 'request-accept-article (car to-method))
6601 (error "%s does not support article copying" (car to-method)))
6602 (unless (gnus-check-server to-method)
6603 (error "Can't open server %s" (car to-method)))
6604 (gnus-message 6 "%s to %s: %s..."
6605 (caddr (assq action names))
6606 (or (car select-method) to-newsgroup) articles)
6608 (setq article (pop articles))
6612 ;; Move the article.
6614 (gnus-request-move-article
6615 article ; Article to move
6616 gnus-newsgroup-name ; From newsgroup
6617 (nth 1 (gnus-find-method-for-group
6618 gnus-newsgroup-name)) ; Server
6619 (list 'gnus-request-accept-article
6620 to-newsgroup (list 'quote select-method)
6621 (not articles)) ; Accept form
6622 (not articles))) ; Only save nov last time
6623 ;; Copy the article.
6626 (set-buffer copy-buf)
6627 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6628 (gnus-request-accept-article
6629 to-newsgroup select-method (not articles))))
6630 ;; Crosspost the article.
6631 ((eq action 'crosspost)
6632 (let ((xref (message-tokenize-header
6633 (mail-header-xref (gnus-summary-article-header article))
6635 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6638 (setq xref (list (system-name))))
6641 (mapconcat 'identity
6642 (delete "Xref:" (delete new-xref xref))
6646 (set-buffer copy-buf)
6647 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6648 (nnheader-replace-header "xref" new-xref)
6649 (gnus-request-accept-article
6650 to-newsgroup select-method (not articles)))))))
6652 (gnus-message 1 "Couldn't %s article %s"
6653 (cadr (assq action names)) article)
6656 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6658 (gnus-group-prefixed-name
6661 (gnus-find-method-for-group to-newsgroup)))
6662 gnus-newsrc-hashtb)))
6663 (info (nth 2 entry))
6664 (to-group (gnus-info-group info)))
6665 ;; Update the group that has been moved to.
6667 (memq action '(move copy)))
6668 (unless (member to-group to-groups)
6669 (push to-group to-groups))
6671 (unless (memq article gnus-newsgroup-unreads)
6673 info (gnus-add-to-range (gnus-info-read info)
6674 (list (cdr art-group)))))
6676 ;; Copy any marks over to the new group.
6677 (let ((marks gnus-article-mark-lists)
6678 (to-article (cdr art-group)))
6680 ;; See whether the article is to be put in the cache.
6681 (when gnus-use-cache
6682 (gnus-cache-possibly-enter-article
6684 (let ((header (copy-sequence
6685 (gnus-summary-article-header article))))
6686 (mail-header-set-number header to-article)
6688 (memq article gnus-newsgroup-marked)
6689 (memq article gnus-newsgroup-dormant)
6690 (memq article gnus-newsgroup-unreads)))
6693 (when (memq article (symbol-value
6694 (intern (format "gnus-newsgroup-%s"
6696 ;; If the other group is the same as this group,
6697 ;; then we have to add the mark to the list.
6698 (when (equal to-group gnus-newsgroup-name)
6699 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6702 (intern (format "gnus-newsgroup-%s"
6704 ;; Copy mark to other group.
6705 (gnus-add-marked-articles
6706 to-group (cdar marks) (list to-article) info))
6707 (setq marks (cdr marks)))))
6709 ;; Update the Xref header in this article to point to
6710 ;; the new crossposted article we have just created.
6711 (when (eq action 'crosspost)
6713 (set-buffer copy-buf)
6714 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6715 (nnheader-replace-header
6716 "xref" (concat new-xref " " (car art-group)
6717 ":" (cdr art-group)))
6718 (gnus-request-replace-article
6719 article gnus-newsgroup-name (current-buffer)))))
6721 (gnus-summary-goto-subject article)
6722 (when (eq action 'move)
6723 (gnus-summary-mark-article article gnus-canceled-mark)))
6724 (gnus-summary-remove-process-mark article))
6725 ;; Re-activate all groups that have been moved to.
6727 (gnus-activate-group (pop to-groups)))
6729 (gnus-kill-buffer copy-buf)
6730 (gnus-summary-position-point)
6731 (gnus-set-mode-line 'summary)))
6733 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6734 "Move the current article to a different newsgroup.
6735 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6736 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6737 re-spool using this method."
6739 (gnus-summary-move-article n nil select-method 'copy))
6741 (defun gnus-summary-crosspost-article (&optional n)
6742 "Crosspost the current article to some other group."
6744 (gnus-summary-move-article n nil nil 'crosspost))
6746 (defcustom gnus-summary-respool-default-method nil
6747 "Default method for respooling an article.
6748 If nil, use to the current newsgroup method."
6749 :type 'gnus-select-method-name
6750 :group 'gnus-summary-mail)
6752 (defun gnus-summary-respool-article (&optional n method)
6753 "Respool the current article.
6754 The article will be squeezed through the mail spooling process again,
6755 which means that it will be put in some mail newsgroup or other
6756 depending on `nnmail-split-methods'.
6757 If N is a positive number, respool the N next articles.
6758 If N is a negative number, respool the N previous articles.
6759 If N is nil and any articles have been marked with the process mark,
6760 respool those articles instead.
6762 Respooling can be done both from mail groups and \"real\" newsgroups.
6763 In the former case, the articles in question will be moved from the
6764 current group into whatever groups they are destined to. In the
6765 latter case, they will be copied into the relevant groups."
6767 (list current-prefix-arg
6768 (let* ((methods (gnus-methods-using 'respool))
6770 (symbol-name (or gnus-summary-respool-default-method
6771 (car (gnus-find-method-for-group
6772 gnus-newsgroup-name)))))
6774 (gnus-completing-read
6775 methname "What backend do you want to use when respooling?"
6776 methods nil t nil 'gnus-mail-method-history))
6779 ((zerop (length (setq ms (gnus-servers-using-backend
6781 (list (intern method) ""))
6785 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6786 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6788 (gnus-set-global-variables)
6790 (error "No method given for respooling"))
6791 (if (assoc (symbol-name
6792 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6793 (gnus-methods-using 'respool))
6794 (gnus-summary-move-article n nil method)
6795 (gnus-summary-copy-article n nil method)))
6797 (defun gnus-summary-import-article (file)
6798 "Import a random file into a mail newsgroup."
6799 (interactive "fImport file: ")
6800 (gnus-set-global-variables)
6801 (let ((group gnus-newsgroup-name)
6802 (now (current-time))
6804 (unless (gnus-check-backend-function 'request-accept-article group)
6805 (error "%s does not support article importing" group))
6806 (or (file-readable-p file)
6807 (not (file-regular-p file))
6808 (error "Can't read %s" file))
6810 (set-buffer (get-buffer-create " *import file*"))
6811 (buffer-disable-undo (current-buffer))
6813 (insert-file-contents file)
6814 (goto-char (point-min))
6815 (unless (nnheader-article-p)
6816 ;; This doesn't look like an article, so we fudge some headers.
6817 (setq atts (file-attributes file)
6818 lines (count-lines (point-min) (point-max)))
6819 (insert "From: " (read-string "From: ") "\n"
6820 "Subject: " (read-string "Subject: ") "\n"
6821 "Date: " (timezone-make-date-arpa-standard
6822 (current-time-string (nth 5 atts))
6823 (current-time-zone now)
6824 (current-time-zone now))
6826 "Message-ID: " (message-make-message-id) "\n"
6827 "Lines: " (int-to-string lines) "\n"
6828 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6829 (gnus-request-accept-article group nil t)
6830 (kill-buffer (current-buffer)))))
6832 (defun gnus-summary-article-posted-p ()
6833 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6834 This will be the case if the article has both been mailed and posted."
6836 (let ((id (mail-header-references (gnus-summary-article-header)))
6837 (gnus-override-method
6838 (or gnus-refer-article-method gnus-select-method)))
6839 (if (gnus-request-head id "")
6840 (gnus-message 2 "The current message was found on %s"
6841 gnus-override-method)
6842 (gnus-message 2 "The current message couldn't be found on %s"
6843 gnus-override-method)
6846 (defun gnus-summary-expire-articles (&optional now)
6847 "Expire all articles that are marked as expirable in the current group."
6849 (gnus-set-global-variables)
6850 (when (gnus-check-backend-function
6851 'request-expire-articles gnus-newsgroup-name)
6852 ;; This backend supports expiry.
6853 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6854 (expirable (if total
6856 ;; We need to update the info for
6857 ;; this group for `gnus-list-of-read-articles'
6858 ;; to give us the right answer.
6859 (run-hooks 'gnus-exit-group-hook)
6860 (gnus-summary-update-info)
6861 (gnus-list-of-read-articles gnus-newsgroup-name))
6862 (setq gnus-newsgroup-expirable
6863 (sort gnus-newsgroup-expirable '<))))
6864 (expiry-wait (if now 'immediate
6865 (gnus-group-find-parameter
6866 gnus-newsgroup-name 'expiry-wait)))
6869 ;; There are expirable articles in this group, so we run them
6870 ;; through the expiry process.
6871 (gnus-message 6 "Expiring articles...")
6872 ;; The list of articles that weren't expired is returned.
6874 (let ((nnmail-expiry-wait-function nil)
6875 (nnmail-expiry-wait expiry-wait))
6876 (setq es (gnus-request-expire-articles
6877 expirable gnus-newsgroup-name)))
6878 (setq es (gnus-request-expire-articles
6879 expirable gnus-newsgroup-name)))
6881 (setq gnus-newsgroup-expirable es))
6882 ;; We go through the old list of expirable, and mark all
6883 ;; really expired articles as nonexistent.
6884 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6885 (let ((gnus-use-cache nil))
6887 (unless (memq (car expirable) es)
6888 (when (gnus-data-find (car expirable))
6889 (gnus-summary-mark-article
6890 (car expirable) gnus-canceled-mark)))
6891 (setq expirable (cdr expirable)))))
6892 (gnus-message 6 "Expiring articles...done")))))
6894 (defun gnus-summary-expire-articles-now ()
6895 "Expunge all expirable articles in the current group.
6896 This means that *all* articles that are marked as expirable will be
6897 deleted forever, right now."
6899 (gnus-set-global-variables)
6900 (or gnus-expert-user
6902 "Are you really, really, really sure you want to delete all these messages? ")
6904 (gnus-summary-expire-articles t))
6906 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6907 (defun gnus-summary-delete-article (&optional n)
6908 "Delete the N next (mail) articles.
6909 This command actually deletes articles. This is not a marking
6910 command. The article will disappear forever from your life, never to
6912 If N is negative, delete backwards.
6913 If N is nil and articles have been marked with the process mark,
6914 delete these instead."
6916 (gnus-set-global-variables)
6917 (unless (gnus-check-backend-function 'request-expire-articles
6918 gnus-newsgroup-name)
6919 (error "The current newsgroup does not support article deletion."))
6920 ;; Compute the list of articles to delete.
6921 (let ((articles (gnus-summary-work-articles n))
6923 (if (and gnus-novice-user
6924 (not (gnus-yes-or-no-p
6925 (format "Do you really want to delete %s forever? "
6926 (if (> (length articles) 1)
6927 (format "these %s articles" (length articles))
6930 ;; Delete the articles.
6931 (setq not-deleted (gnus-request-expire-articles
6932 articles gnus-newsgroup-name 'force))
6934 (gnus-summary-remove-process-mark (car articles))
6935 ;; The backend might not have been able to delete the article
6937 (unless (memq (car articles) not-deleted)
6938 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6939 (setq articles (cdr articles))))
6940 (gnus-summary-position-point)
6941 (gnus-set-mode-line 'summary)
6944 (defun gnus-summary-edit-article (&optional force)
6945 "Edit the current article.
6946 This will have permanent effect only in mail groups.
6947 If FORCE is non-nil, allow editing of articles even in read-only
6951 (set-buffer gnus-summary-buffer)
6952 (gnus-set-global-variables)
6953 (when (and (not force)
6954 (gnus-group-read-only-p))
6955 (error "The current newsgroup does not support article editing."))
6956 ;; Select article if needed.
6957 (unless (eq (gnus-summary-article-number)
6958 gnus-current-article)
6959 (gnus-summary-select-article t))
6960 (gnus-article-edit-article
6962 (gnus-summary-edit-article-done
6963 ,(or (mail-header-references gnus-current-headers) "")
6964 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6966 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6968 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6969 "Make edits to the current article permanent."
6971 ;; Replace the article.
6972 (if (and (not read-only)
6973 (not (gnus-request-replace-article
6974 (cdr gnus-article-current) (car gnus-article-current)
6976 (error "Couldn't replace article.")
6977 ;; Update the summary buffer.
6979 (equal (message-tokenize-header references " ")
6980 (message-tokenize-header
6981 (or (message-fetch-field "references") "") " ")))
6982 ;; We only have to update this line.
6985 (message-narrow-to-head)
6986 (let ((header (nnheader-parse-head t)))
6988 (mail-header-set-number header (cdr gnus-article-current))
6989 (gnus-summary-update-article-line
6990 (cdr gnus-article-current) header))))
6992 (set-buffer (or buffer gnus-summary-buffer))
6993 (gnus-summary-update-article (cdr gnus-article-current)))
6994 ;; Prettify the article buffer again.
6996 (set-buffer gnus-article-buffer)
6997 (run-hooks 'gnus-article-display-hook))
6998 ;; Prettify the summary buffer line.
6999 (when (gnus-visual-p 'summary-highlight 'highlight)
7000 (run-hooks 'gnus-visual-mark-article-hook))))
7002 (defun gnus-summary-edit-wash (key)
7003 "Perform editing command in the article buffer."
7007 (message "%s" (concat (this-command-keys) "- "))
7010 (gnus-summary-edit-article)
7011 (execute-kbd-macro (concat (this-command-keys) key))
7012 (gnus-article-edit-done))
7016 (defun gnus-summary-respool-query ()
7017 "Query where the respool algorithm would put this article."
7019 (gnus-set-global-variables)
7020 (let (gnus-mark-article-hook)
7021 (gnus-summary-select-article)
7023 (set-buffer gnus-article-buffer)
7025 (goto-char (point-min))
7026 (search-forward "\n\n")
7027 (narrow-to-region (point-min) (point))
7028 (message "This message would go to %s"
7029 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
7031 ;; Summary marking commands.
7033 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7034 "Mark articles which has the same subject as read, and then select the next.
7035 If UNMARK is positive, remove any kind of mark.
7036 If UNMARK is negative, tick articles."
7038 (gnus-set-global-variables)
7040 (setq unmark (prefix-numeric-value unmark)))
7042 (gnus-summary-mark-same-subject
7043 (gnus-summary-article-subject) unmark)))
7044 ;; Select next unread article. If auto-select-same mode, should
7045 ;; select the first unread article.
7046 (gnus-summary-next-article t (and gnus-auto-select-same
7047 (gnus-summary-article-subject)))
7048 (gnus-message 7 "%d article%s marked as %s"
7049 count (if (= count 1) " is" "s are")
7050 (if unmark "unread" "read"))))
7052 (defun gnus-summary-kill-same-subject (&optional unmark)
7053 "Mark articles which has the same subject as read.
7054 If UNMARK is positive, remove any kind of mark.
7055 If UNMARK is negative, tick articles."
7057 (gnus-set-global-variables)
7059 (setq unmark (prefix-numeric-value unmark)))
7061 (gnus-summary-mark-same-subject
7062 (gnus-summary-article-subject) unmark)))
7063 ;; If marked as read, go to next unread subject.
7065 ;; Go to next unread subject.
7066 (gnus-summary-next-subject 1 t))
7067 (gnus-message 7 "%d articles are marked as %s"
7068 count (if unmark "unread" "read"))))
7070 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7071 "Mark articles with same SUBJECT as read, and return marked number.
7072 If optional argument UNMARK is positive, remove any kinds of marks.
7073 If optional argument UNMARK is negative, mark articles as unread instead."
7077 ((null unmark) ; Mark as read.
7080 (gnus-summary-mark-article-as-read gnus-killed-mark)
7081 (gnus-summary-show-thread) t)
7082 (gnus-summary-find-subject subject))
7083 (setq count (1+ count))))
7084 ((> unmark 0) ; Tick.
7087 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7088 (gnus-summary-show-thread) t)
7089 (gnus-summary-find-subject subject))
7090 (setq count (1+ count))))
7091 (t ; Mark as unread.
7094 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7095 (gnus-summary-show-thread) t)
7096 (gnus-summary-find-subject subject))
7097 (setq count (1+ count)))))
7098 (gnus-set-mode-line 'summary)
7099 ;; Return the number of marked articles.
7102 (defun gnus-summary-mark-as-processable (n &optional unmark)
7103 "Set the process mark on the next N articles.
7104 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7105 the process mark instead. The difference between N and the actual
7106 number of articles marked is returned."
7108 (gnus-set-global-variables)
7109 (let ((backward (< n 0))
7114 (gnus-summary-remove-process-mark
7115 (gnus-summary-article-number))
7116 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7117 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7120 (gnus-message 7 "No more articles"))
7121 (gnus-summary-recenter)
7122 (gnus-summary-position-point)
7125 (defun gnus-summary-unmark-as-processable (n)
7126 "Remove the process mark from the next N articles.
7127 If N is negative, mark backward instead. The difference between N and
7128 the actual number of articles marked is returned."
7130 (gnus-set-global-variables)
7131 (gnus-summary-mark-as-processable n t))
7133 (defun gnus-summary-unmark-all-processable ()
7134 "Remove the process mark from all articles."
7136 (gnus-set-global-variables)
7138 (while gnus-newsgroup-processable
7139 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7140 (gnus-summary-position-point))
7142 (defun gnus-summary-mark-as-expirable (n)
7143 "Mark N articles forward as expirable.
7144 If N is negative, mark backward instead. The difference between N and
7145 the actual number of articles marked is returned."
7147 (gnus-set-global-variables)
7148 (gnus-summary-mark-forward n gnus-expirable-mark))
7150 (defun gnus-summary-mark-article-as-replied (article)
7151 "Mark ARTICLE replied and update the summary line."
7152 (push article gnus-newsgroup-replied)
7153 (let ((buffer-read-only nil))
7154 (when (gnus-summary-goto-subject article)
7155 (gnus-summary-update-secondary-mark article))))
7157 (defun gnus-summary-set-bookmark (article)
7158 "Set a bookmark in current article."
7159 (interactive (list (gnus-summary-article-number)))
7160 (gnus-set-global-variables)
7161 (when (or (not (get-buffer gnus-article-buffer))
7162 (not gnus-current-article)
7163 (not gnus-article-current)
7164 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7165 (error "No current article selected"))
7166 ;; Remove old bookmark, if one exists.
7167 (let ((old (assq article gnus-newsgroup-bookmarks)))
7169 (setq gnus-newsgroup-bookmarks
7170 (delq old gnus-newsgroup-bookmarks))))
7171 ;; Set the new bookmark, which is on the form
7172 ;; (article-number . line-number-in-body).
7176 (set-buffer gnus-article-buffer)
7180 (goto-char (point-min))
7181 (search-forward "\n\n" nil t)
7184 gnus-newsgroup-bookmarks)
7185 (gnus-message 6 "A bookmark has been added to the current article."))
7187 (defun gnus-summary-remove-bookmark (article)
7188 "Remove the bookmark from the current article."
7189 (interactive (list (gnus-summary-article-number)))
7190 (gnus-set-global-variables)
7191 ;; Remove old bookmark, if one exists.
7192 (let ((old (assq article gnus-newsgroup-bookmarks)))
7195 (setq gnus-newsgroup-bookmarks
7196 (delq old gnus-newsgroup-bookmarks))
7197 (gnus-message 6 "Removed bookmark."))
7198 (gnus-message 6 "No bookmark in current article."))))
7200 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7201 (defun gnus-summary-mark-as-dormant (n)
7202 "Mark N articles forward as dormant.
7203 If N is negative, mark backward instead. The difference between N and
7204 the actual number of articles marked is returned."
7206 (gnus-set-global-variables)
7207 (gnus-summary-mark-forward n gnus-dormant-mark))
7209 (defun gnus-summary-set-process-mark (article)
7210 "Set the process mark on ARTICLE and update the summary line."
7211 (setq gnus-newsgroup-processable
7213 (delq article gnus-newsgroup-processable)))
7214 (when (gnus-summary-goto-subject article)
7215 (gnus-summary-show-thread)
7216 (gnus-summary-update-secondary-mark article)))
7218 (defun gnus-summary-remove-process-mark (article)
7219 "Remove the process mark from ARTICLE and update the summary line."
7220 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7221 (when (gnus-summary-goto-subject article)
7222 (gnus-summary-show-thread)
7223 (gnus-summary-update-secondary-mark article)))
7225 (defun gnus-summary-set-saved-mark (article)
7226 "Set the process mark on ARTICLE and update the summary line."
7227 (push article gnus-newsgroup-saved)
7228 (when (gnus-summary-goto-subject article)
7229 (gnus-summary-update-secondary-mark article)))
7231 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7232 "Mark N articles as read forwards.
7233 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7234 The difference between N and the actual number of articles marked is
7237 (gnus-set-global-variables)
7238 (let ((backward (< n 0))
7239 (gnus-summary-goto-unread
7240 (and gnus-summary-goto-unread
7241 (not (eq gnus-summary-goto-unread 'never))
7242 (not (memq mark (list gnus-unread-mark
7243 gnus-ticked-mark gnus-dormant-mark)))))
7245 (mark (or mark gnus-del-mark)))
7247 (gnus-summary-mark-article nil mark no-expire)
7248 (zerop (gnus-summary-next-subject
7250 (and gnus-summary-goto-unread
7251 (not (eq gnus-summary-goto-unread 'never)))
7255 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7256 (gnus-summary-recenter)
7257 (gnus-summary-position-point)
7258 (gnus-set-mode-line 'summary)
7261 (defun gnus-summary-mark-article-as-read (mark)
7262 "Mark the current article quickly as read with MARK."
7263 (let ((article (gnus-summary-article-number)))
7264 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7265 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7266 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7267 (push (cons article mark) gnus-newsgroup-reads)
7268 ;; Possibly remove from cache, if that is used.
7269 (when gnus-use-cache
7270 (gnus-cache-enter-remove-article article))
7271 ;; Allow the backend to change the mark.
7272 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7273 ;; Check for auto-expiry.
7274 (when (and gnus-newsgroup-auto-expire
7275 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7276 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7277 (= mark gnus-ancient-mark)
7278 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7279 (= mark gnus-duplicate-mark)))
7280 (setq mark gnus-expirable-mark)
7281 (push article gnus-newsgroup-expirable))
7282 ;; Set the mark in the buffer.
7283 (gnus-summary-update-mark mark 'unread)
7286 (defun gnus-summary-mark-article-as-unread (mark)
7287 "Mark the current article quickly as unread with MARK."
7288 (let ((article (gnus-summary-article-number)))
7290 (gnus-error 1 "Unmarkable article")
7291 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7292 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7293 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7294 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7295 (cond ((= mark gnus-ticked-mark)
7296 (push article gnus-newsgroup-marked))
7297 ((= mark gnus-dormant-mark)
7298 (push article gnus-newsgroup-dormant))
7300 (push article gnus-newsgroup-unreads)))
7301 (setq gnus-newsgroup-reads
7302 (delq (assq article gnus-newsgroup-reads)
7303 gnus-newsgroup-reads))
7305 ;; See whether the article is to be put in the cache.
7307 (vectorp (gnus-summary-article-header article))
7309 (gnus-cache-possibly-enter-article
7310 gnus-newsgroup-name article
7311 (gnus-summary-article-header article)
7312 (= mark gnus-ticked-mark)
7313 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7316 (gnus-summary-update-mark mark 'unread))
7319 (defun gnus-summary-mark-article (&optional article mark no-expire)
7320 "Mark ARTICLE with MARK. MARK can be any character.
7321 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7322 `??' (dormant) and `?E' (expirable).
7323 If MARK is nil, then the default character `?D' is used.
7324 If ARTICLE is nil, then the article on the current line will be
7326 ;; The mark might be a string.
7327 (when (stringp mark)
7328 (setq mark (aref mark 0)))
7329 ;; If no mark is given, then we check auto-expiring.
7330 (and (not no-expire)
7331 gnus-newsgroup-auto-expire
7333 (and (gnus-characterp mark)
7334 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7335 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7336 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7337 (= mark gnus-duplicate-mark))))
7338 (setq mark gnus-expirable-mark))
7339 (let* ((mark (or mark gnus-del-mark))
7340 (article (or article (gnus-summary-article-number))))
7342 (error "No article on current line"))
7343 (if (or (= mark gnus-unread-mark)
7344 (= mark gnus-ticked-mark)
7345 (= mark gnus-dormant-mark))
7346 (gnus-mark-article-as-unread article mark)
7347 (gnus-mark-article-as-read article mark))
7349 ;; See whether the article is to be put in the cache.
7351 (not (= mark gnus-canceled-mark))
7352 (vectorp (gnus-summary-article-header article))
7354 (gnus-cache-possibly-enter-article
7355 gnus-newsgroup-name article
7356 (gnus-summary-article-header article)
7357 (= mark gnus-ticked-mark)
7358 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7360 (when (gnus-summary-goto-subject article nil t)
7361 (let ((buffer-read-only nil))
7362 (gnus-summary-show-thread)
7364 (gnus-summary-update-mark mark 'unread)
7367 (defun gnus-summary-update-secondary-mark (article)
7368 "Update the secondary (read, process, cache) mark."
7369 (gnus-summary-update-mark
7370 (cond ((memq article gnus-newsgroup-processable)
7372 ((memq article gnus-newsgroup-cached)
7374 ((memq article gnus-newsgroup-replied)
7376 ((memq article gnus-newsgroup-saved)
7378 (t gnus-unread-mark))
7380 (when (gnus-visual-p 'summary-highlight 'highlight)
7381 (run-hooks 'gnus-summary-update-hook))
7384 (defun gnus-summary-update-mark (mark type)
7385 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7386 (buffer-read-only nil))
7387 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7388 (when (looking-at "\r")
7391 (<= (+ forward (point)) (point-max)))
7392 ;; Go to the right position on the line.
7393 (goto-char (+ forward (point)))
7394 ;; Replace the old mark with the new mark.
7395 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7396 ;; Optionally update the marks by some user rule.
7397 (when (eq type 'unread)
7399 (gnus-data-find (gnus-summary-article-number)) mark)
7400 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7402 (defun gnus-mark-article-as-read (article &optional mark)
7403 "Enter ARTICLE in the pertinent lists and remove it from others."
7404 ;; Make the article expirable.
7405 (let ((mark (or mark gnus-del-mark)))
7406 (if (= mark gnus-expirable-mark)
7407 (push article gnus-newsgroup-expirable)
7408 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7409 ;; Remove from unread and marked lists.
7410 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7411 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7412 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7413 (push (cons article mark) gnus-newsgroup-reads)
7414 ;; Possibly remove from cache, if that is used.
7415 (when gnus-use-cache
7416 (gnus-cache-enter-remove-article article))))
7418 (defun gnus-mark-article-as-unread (article &optional mark)
7419 "Enter ARTICLE in the pertinent lists and remove it from others."
7420 (let ((mark (or mark gnus-ticked-mark)))
7421 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7422 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7423 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7424 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7426 ;; Unsuppress duplicates?
7427 (when gnus-suppress-duplicates
7428 (gnus-dup-unsuppress-article article))
7430 (cond ((= mark gnus-ticked-mark)
7431 (push article gnus-newsgroup-marked))
7432 ((= mark gnus-dormant-mark)
7433 (push article gnus-newsgroup-dormant))
7435 (push article gnus-newsgroup-unreads)))
7436 (setq gnus-newsgroup-reads
7437 (delq (assq article gnus-newsgroup-reads)
7438 gnus-newsgroup-reads))))
7440 (defalias 'gnus-summary-mark-as-unread-forward
7441 'gnus-summary-tick-article-forward)
7442 (make-obsolete 'gnus-summary-mark-as-unread-forward
7443 'gnus-summary-tick-article-forward)
7444 (defun gnus-summary-tick-article-forward (n)
7445 "Tick N articles forwards.
7446 If N is negative, tick backwards instead.
7447 The difference between N and the number of articles ticked is returned."
7449 (gnus-summary-mark-forward n gnus-ticked-mark))
7451 (defalias 'gnus-summary-mark-as-unread-backward
7452 'gnus-summary-tick-article-backward)
7453 (make-obsolete 'gnus-summary-mark-as-unread-backward
7454 'gnus-summary-tick-article-backward)
7455 (defun gnus-summary-tick-article-backward (n)
7456 "Tick N articles backwards.
7457 The difference between N and the number of articles ticked is returned."
7459 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7461 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7462 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7463 (defun gnus-summary-tick-article (&optional article clear-mark)
7464 "Mark current article as unread.
7465 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7466 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7468 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7471 (defun gnus-summary-mark-as-read-forward (n)
7472 "Mark N articles as read forwards.
7473 If N is negative, mark backwards instead.
7474 The difference between N and the actual number of articles marked is
7477 (gnus-summary-mark-forward n gnus-del-mark t))
7479 (defun gnus-summary-mark-as-read-backward (n)
7480 "Mark the N articles as read backwards.
7481 The difference between N and the actual number of articles marked is
7484 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7486 (defun gnus-summary-mark-as-read (&optional article mark)
7487 "Mark current article as read.
7488 ARTICLE specifies the article to be marked as read.
7489 MARK specifies a string to be inserted at the beginning of the line."
7490 (gnus-summary-mark-article article mark))
7492 (defun gnus-summary-clear-mark-forward (n)
7493 "Clear marks from N articles forward.
7494 If N is negative, clear backward instead.
7495 The difference between N and the number of marks cleared is returned."
7497 (gnus-summary-mark-forward n gnus-unread-mark))
7499 (defun gnus-summary-clear-mark-backward (n)
7500 "Clear marks from N articles backward.
7501 The difference between N and the number of marks cleared is returned."
7503 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7505 (defun gnus-summary-mark-unread-as-read ()
7506 "Intended to be used by `gnus-summary-mark-article-hook'."
7507 (when (memq gnus-current-article gnus-newsgroup-unreads)
7508 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7510 (defun gnus-summary-mark-read-and-unread-as-read ()
7511 "Intended to be used by `gnus-summary-mark-article-hook'."
7512 (let ((mark (gnus-summary-article-mark)))
7513 (when (or (gnus-unread-mark-p mark)
7514 (gnus-read-mark-p mark))
7515 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7517 (defun gnus-summary-mark-region-as-read (point mark all)
7518 "Mark all unread articles between point and mark as read.
7519 If given a prefix, mark all articles between point and mark as read,
7520 even ticked and dormant ones."
7521 (interactive "r\nP")
7530 (memq (setq article (gnus-summary-article-number))
7531 gnus-newsgroup-unreads))
7532 (gnus-summary-mark-article article gnus-del-mark))
7534 (gnus-summary-find-next))))))
7536 (defun gnus-summary-mark-below (score mark)
7537 "Mark articles with score less than SCORE with MARK."
7538 (interactive "P\ncMark: ")
7539 (gnus-set-global-variables)
7540 (setq score (if score
7541 (prefix-numeric-value score)
7542 (or gnus-summary-default-score 0)))
7544 (set-buffer gnus-summary-buffer)
7545 (goto-char (point-min))
7548 (and (< (gnus-summary-article-score) score)
7549 (gnus-summary-mark-article nil mark))
7550 (gnus-summary-find-next)))))
7552 (defun gnus-summary-kill-below (&optional score)
7553 "Mark articles with score below SCORE as read."
7555 (gnus-set-global-variables)
7556 (gnus-summary-mark-below score gnus-killed-mark))
7558 (defun gnus-summary-clear-above (&optional score)
7559 "Clear all marks from articles with score above SCORE."
7561 (gnus-set-global-variables)
7562 (gnus-summary-mark-above score gnus-unread-mark))
7564 (defun gnus-summary-tick-above (&optional score)
7565 "Tick all articles with score above SCORE."
7567 (gnus-set-global-variables)
7568 (gnus-summary-mark-above score gnus-ticked-mark))
7570 (defun gnus-summary-mark-above (score mark)
7571 "Mark articles with score over SCORE with MARK."
7572 (interactive "P\ncMark: ")
7573 (gnus-set-global-variables)
7574 (setq score (if score
7575 (prefix-numeric-value score)
7576 (or gnus-summary-default-score 0)))
7578 (set-buffer gnus-summary-buffer)
7579 (goto-char (point-min))
7581 (when (> (gnus-summary-article-score) score)
7582 (gnus-summary-mark-article nil mark))
7584 (gnus-summary-find-next)))))
7586 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7587 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7588 (defun gnus-summary-limit-include-expunged (&optional no-error)
7589 "Display all the hidden articles that were expunged for low scores."
7591 (gnus-set-global-variables)
7592 (let ((buffer-read-only nil))
7593 (let ((scored gnus-newsgroup-scored)
7596 (unless (gnus-summary-goto-subject (caar scored))
7597 (and (setq h (gnus-summary-article-header (caar scored)))
7598 (< (cdar scored) gnus-summary-expunge-below)
7600 (setq scored (cdr scored)))
7602 (when (not no-error)
7603 (error "No expunged articles hidden."))
7604 (goto-char (point-min))
7605 (gnus-summary-prepare-unthreaded (nreverse headers))
7606 (goto-char (point-min))
7607 (gnus-summary-position-point)
7610 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7611 "Mark all unread articles in this newsgroup as read.
7612 If prefix argument ALL is non-nil, ticked and dormant articles will
7613 also be marked as read.
7614 If QUIETLY is non-nil, no questions will be asked.
7615 If TO-HERE is non-nil, it should be a point in the buffer. All
7616 articles before this point will be marked as read.
7617 Note that this function will only catch up the unread article
7618 in the current summary buffer limitation.
7619 The number of articles marked as read is returned."
7621 (gnus-set-global-variables)
7625 (not gnus-interactive-catchup) ;Without confirmation?
7629 "Mark absolutely all articles as read? "
7630 "Mark all unread articles as read? ")))
7632 (not gnus-newsgroup-adaptive)
7633 (not gnus-newsgroup-auto-expire)
7634 (not gnus-suppress-duplicates))
7637 (setq gnus-newsgroup-marked nil
7638 gnus-newsgroup-dormant nil))
7639 (setq gnus-newsgroup-unreads nil))
7640 ;; We actually mark all articles as canceled, which we
7641 ;; have to do when using auto-expiry or adaptive scoring.
7642 (gnus-summary-show-all-threads)
7643 (when (gnus-summary-first-subject (not all))
7645 (if to-here (< (point) to-here) t)
7646 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7647 (gnus-summary-find-next (not all)))))
7648 (gnus-set-mode-line 'summary))
7650 (gnus-summary-position-point)))
7652 (defun gnus-summary-catchup-to-here (&optional all)
7653 "Mark all unticked articles before the current one as read.
7654 If ALL is non-nil, also mark ticked and dormant articles as read."
7656 (gnus-set-global-variables)
7658 (gnus-save-hidden-threads
7659 (let ((beg (point)))
7660 ;; We check that there are unread articles.
7661 (when (or all (gnus-summary-find-prev))
7662 (gnus-summary-catchup all t beg)))))
7663 (gnus-summary-position-point))
7665 (defun gnus-summary-catchup-all (&optional quietly)
7666 "Mark all articles in this newsgroup as read."
7668 (gnus-set-global-variables)
7669 (gnus-summary-catchup t quietly))
7671 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7672 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7673 If prefix argument ALL is non-nil, all articles are marked as read."
7675 (gnus-set-global-variables)
7676 (when (gnus-summary-catchup all quietly nil 'fast)
7677 ;; Select next newsgroup or exit.
7678 (if (eq gnus-auto-select-next 'quietly)
7679 (gnus-summary-next-group nil)
7680 (gnus-summary-exit))))
7682 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7683 "Mark all articles in this newsgroup as read, and then exit."
7685 (gnus-set-global-variables)
7686 (gnus-summary-catchup-and-exit t quietly))
7688 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7689 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7690 "Mark all articles in this group as read and select the next group.
7691 If given a prefix, mark all articles, unread as well as ticked, as
7694 (gnus-set-global-variables)
7696 (gnus-summary-catchup all))
7697 (gnus-summary-next-article t nil nil t))
7699 ;; Thread-based commands.
7701 (defun gnus-summary-articles-in-thread (&optional article)
7702 "Return a list of all articles in the current thread.
7703 If ARTICLE is non-nil, return all articles in the thread that starts
7705 (let* ((article (or article (gnus-summary-article-number)))
7706 (data (gnus-data-find-list article))
7707 (top-level (gnus-data-level (car data)))
7709 (cond ((null gnus-thread-operation-ignore-subject)
7710 (gnus-simplify-subject-re
7711 (mail-header-subject (gnus-data-header (car data)))))
7712 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7713 (gnus-simplify-subject-fuzzy
7714 (mail-header-subject (gnus-data-header (car data)))))
7716 (end-point (save-excursion
7717 (if (gnus-summary-go-to-next-thread)
7718 (point) (point-max))))
7721 (< (gnus-data-pos (car data)) end-point))
7722 (when (or (not top-subject)
7723 (string= top-subject
7724 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7725 (gnus-simplify-subject-fuzzy
7726 (mail-header-subject
7727 (gnus-data-header (car data))))
7728 (gnus-simplify-subject-re
7729 (mail-header-subject
7730 (gnus-data-header (car data)))))))
7731 (push (gnus-data-number (car data)) articles))
7732 (unless (and (setq data (cdr data))
7733 (> (gnus-data-level (car data)) top-level))
7735 ;; Return the list of articles.
7736 (nreverse articles)))
7738 (defun gnus-summary-rethread-current ()
7739 "Rethread the thread the current article is part of."
7741 (gnus-set-global-variables)
7742 (let* ((gnus-show-threads t)
7743 (article (gnus-summary-article-number))
7744 (id (mail-header-id (gnus-summary-article-header)))
7745 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7747 (error "No article on the current line"))
7748 (gnus-rebuild-thread id)
7749 (gnus-summary-goto-subject article)))
7751 (defun gnus-summary-reparent-thread ()
7752 "Make current article child of the marked (or previous) article.
7754 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7755 is non-nil or the Subject: of both articles are the same."
7757 (unless (not (gnus-group-read-only-p))
7758 (error "The current newsgroup does not support article editing."))
7759 (unless (<= (length gnus-newsgroup-processable) 1)
7760 (error "No more than one article may be marked."))
7761 (save-window-excursion
7762 (let ((gnus-article-buffer " *reparent*")
7763 (current-article (gnus-summary-article-number))
7764 ; first grab the marked article, otherwise one line up.
7765 (parent-article (if (not (null gnus-newsgroup-processable))
7766 (car gnus-newsgroup-processable)
7768 (if (eq (forward-line -1) 0)
7769 (gnus-summary-article-number)
7770 (error "Beginning of summary buffer."))))))
7771 (unless (not (eq current-article parent-article))
7772 (error "An article may not be self-referential."))
7773 (let ((message-id (mail-header-id
7774 (gnus-summary-article-header parent-article))))
7775 (unless (and message-id (not (equal message-id "")))
7776 (error "No message-id in desired parent."))
7777 (gnus-summary-select-article t t nil current-article)
7778 (set-buffer gnus-article-buffer)
7779 (setq buffer-read-only nil)
7780 (let ((buf (format "%s" (buffer-string))))
7783 (goto-char (point-min))
7784 (if (search-forward-regexp "^References: " nil t)
7785 (insert message-id " " )
7786 (insert "References: " message-id "\n"))
7787 (unless (gnus-request-replace-article current-article
7788 (car gnus-article-current)
7789 gnus-article-buffer)
7790 (error "Couldn't replace article."))
7791 (set-buffer gnus-summary-buffer)
7792 (gnus-summary-unmark-all-processable)
7793 (gnus-summary-rethread-current)
7794 (gnus-message 3 "Article %d is now the child of article %d."
7795 current-article parent-article)))))
7797 (defun gnus-summary-toggle-threads (&optional arg)
7798 "Toggle showing conversation threads.
7799 If ARG is positive number, turn showing conversation threads on."
7801 (gnus-set-global-variables)
7802 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7803 (setq gnus-show-threads
7804 (if (null arg) (not gnus-show-threads)
7805 (> (prefix-numeric-value arg) 0)))
7806 (gnus-summary-prepare)
7807 (gnus-summary-goto-subject current)
7808 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7809 (gnus-summary-position-point)))
7811 (defun gnus-summary-show-all-threads ()
7814 (gnus-set-global-variables)
7816 (let ((buffer-read-only nil))
7817 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7818 (gnus-summary-position-point))
7820 (defun gnus-summary-show-thread ()
7821 "Show thread subtrees.
7822 Returns nil if no thread was there to be shown."
7824 (gnus-set-global-variables)
7825 (let ((buffer-read-only nil)
7827 ;; first goto end then to beg, to have point at beg after let
7828 (end (progn (end-of-line) (point)))
7829 (beg (progn (beginning-of-line) (point))))
7831 ;; Any hidden lines here?
7832 (search-forward "\r" end t)
7833 (subst-char-in-region beg end ?\^M ?\n t)
7835 (gnus-summary-position-point))))
7837 (defun gnus-summary-hide-all-threads ()
7838 "Hide all thread subtrees."
7840 (gnus-set-global-variables)
7842 (goto-char (point-min))
7843 (gnus-summary-hide-thread)
7844 (while (zerop (gnus-summary-next-thread 1 t))
7845 (gnus-summary-hide-thread)))
7846 (gnus-summary-position-point))
7848 (defun gnus-summary-hide-thread ()
7849 "Hide thread subtrees.
7850 Returns nil if no threads were there to be hidden."
7852 (gnus-set-global-variables)
7853 (let ((buffer-read-only nil)
7855 (article (gnus-summary-article-number)))
7857 ;; Go forward until either the buffer ends or the subthread
7859 (when (and (not (eobp))
7860 (or (zerop (gnus-summary-next-thread 1 t))
7861 (goto-char (point-max))))
7863 (if (and (> (point) start)
7864 (search-backward "\n" start t))
7866 (subst-char-in-region start (point) ?\n ?\^M)
7867 (gnus-summary-goto-subject article))
7870 ;;(gnus-summary-position-point)
7873 (defun gnus-summary-go-to-next-thread (&optional previous)
7874 "Go to the same level (or less) next thread.
7875 If PREVIOUS is non-nil, go to previous thread instead.
7876 Return the article number moved to, or nil if moving was impossible."
7877 (let ((level (gnus-summary-thread-level))
7878 (way (if previous -1 1))
7881 (while (and (not (eobp))
7882 (< level (gnus-summary-thread-level)))
7890 (gnus-summary-article-number)
7893 (defun gnus-summary-next-thread (n &optional silent)
7894 "Go to the same level next N'th thread.
7895 If N is negative, search backward instead.
7896 Returns the difference between N and the number of skips actually
7899 If SILENT, don't output messages."
7901 (gnus-set-global-variables)
7902 (let ((backward (< n 0))
7905 (gnus-summary-go-to-next-thread backward))
7908 (gnus-summary-position-point))
7909 (when (and (not silent) (/= 0 n))
7910 (gnus-message 7 "No more threads"))
7913 (defun gnus-summary-prev-thread (n)
7914 "Go to the same level previous N'th thread.
7915 Returns the difference between N and the number of skips actually
7918 (gnus-set-global-variables)
7919 (gnus-summary-next-thread (- n)))
7921 (defun gnus-summary-go-down-thread ()
7922 "Go down one level in the current thread."
7923 (let ((children (gnus-summary-article-children)))
7925 (gnus-summary-goto-subject (car children)))))
7927 (defun gnus-summary-go-up-thread ()
7928 "Go up one level in the current thread."
7929 (let ((parent (gnus-summary-article-parent)))
7931 (gnus-summary-goto-subject parent))))
7933 (defun gnus-summary-down-thread (n)
7934 "Go down thread N steps.
7935 If N is negative, go up instead.
7936 Returns the difference between N and how many steps down that were
7939 (gnus-set-global-variables)
7943 (if up (gnus-summary-go-up-thread)
7944 (gnus-summary-go-down-thread)))
7946 (gnus-summary-position-point)
7948 (gnus-message 7 "Can't go further"))
7951 (defun gnus-summary-up-thread (n)
7952 "Go up thread N steps.
7953 If N is negative, go up instead.
7954 Returns the difference between N and how many steps down that were
7957 (gnus-set-global-variables)
7958 (gnus-summary-down-thread (- n)))
7960 (defun gnus-summary-top-thread ()
7961 "Go to the top of the thread."
7963 (gnus-set-global-variables)
7964 (while (gnus-summary-go-up-thread))
7965 (gnus-summary-article-number))
7967 (defun gnus-summary-kill-thread (&optional unmark)
7968 "Mark articles under current thread as read.
7969 If the prefix argument is positive, remove any kinds of marks.
7970 If the prefix argument is negative, tick articles instead."
7972 (gnus-set-global-variables)
7974 (setq unmark (prefix-numeric-value unmark)))
7975 (let ((articles (gnus-summary-articles-in-thread)))
7977 ;; Expand the thread.
7978 (gnus-summary-show-thread)
7979 ;; Mark all the articles.
7981 (gnus-summary-goto-subject (car articles))
7982 (cond ((null unmark)
7983 (gnus-summary-mark-article-as-read gnus-killed-mark))
7985 (gnus-summary-mark-article-as-unread gnus-unread-mark))
7987 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
7988 (setq articles (cdr articles))))
7989 ;; Hide killed subtrees.
7991 gnus-thread-hide-killed
7992 (gnus-summary-hide-thread))
7993 ;; If marked as read, go to next unread subject.
7995 ;; Go to next unread subject.
7996 (gnus-summary-next-subject 1 t)))
7997 (gnus-set-mode-line 'summary))
7999 ;; Summary sorting commands
8001 (defun gnus-summary-sort-by-number (&optional reverse)
8002 "Sort the summary buffer by article number.
8003 Argument REVERSE means reverse order."
8005 (gnus-summary-sort 'number reverse))
8007 (defun gnus-summary-sort-by-author (&optional reverse)
8008 "Sort the summary buffer by author name alphabetically.
8009 If case-fold-search is non-nil, case of letters is ignored.
8010 Argument REVERSE means reverse order."
8012 (gnus-summary-sort 'author reverse))
8014 (defun gnus-summary-sort-by-subject (&optional reverse)
8015 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8016 If case-fold-search is non-nil, case of letters is ignored.
8017 Argument REVERSE means reverse order."
8019 (gnus-summary-sort 'subject reverse))
8021 (defun gnus-summary-sort-by-date (&optional reverse)
8022 "Sort the summary buffer by date.
8023 Argument REVERSE means reverse order."
8025 (gnus-summary-sort 'date reverse))
8027 (defun gnus-summary-sort-by-score (&optional reverse)
8028 "Sort the summary buffer by score.
8029 Argument REVERSE means reverse order."
8031 (gnus-summary-sort 'score reverse))
8033 (defun gnus-summary-sort-by-lines (&optional reverse)
8034 "Sort the summary buffer by article length.
8035 Argument REVERSE means reverse order."
8037 (gnus-summary-sort 'lines reverse))
8039 (defun gnus-summary-sort (predicate reverse)
8040 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8041 (gnus-set-global-variables)
8042 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8043 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8044 (gnus-thread-sort-functions
8050 (gnus-article-sort-functions
8055 (,article t2 t1)))))
8057 (gnus-summary-prepare-hook nil))
8058 ;; We do the sorting by regenerating the threads.
8059 (gnus-summary-prepare)
8060 ;; Hide subthreads if needed.
8061 (when (and gnus-show-threads gnus-thread-hide-subtree)
8062 (gnus-summary-hide-all-threads))))
8064 ;; Summary saving commands.
8066 (defun gnus-summary-save-article (&optional n not-saved)
8067 "Save the current article using the default saver function.
8068 If N is a positive number, save the N next articles.
8069 If N is a negative number, save the N previous articles.
8070 If N is nil and any articles have been marked with the process mark,
8071 save those articles instead.
8072 The variable `gnus-default-article-saver' specifies the saver function."
8074 (gnus-set-global-variables)
8075 (let* ((articles (gnus-summary-work-articles n))
8076 (save-buffer (save-excursion
8077 (nnheader-set-temp-buffer " *Gnus Save*")))
8078 (num (length articles))
8079 header article file)
8081 (setq header (gnus-summary-article-header
8082 (setq article (pop articles))))
8083 (if (not (vectorp header))
8084 ;; This is a pseudo-article.
8085 (if (assq 'name header)
8086 (gnus-copy-file (cdr (assq 'name header)))
8087 (gnus-message 1 "Article %d is unsaveable" article))
8088 ;; This is a real article.
8089 (save-window-excursion
8090 (gnus-summary-select-article t nil nil article))
8092 (set-buffer save-buffer)
8094 (insert-buffer-substring gnus-original-article-buffer))
8095 (setq file (gnus-article-save save-buffer file num))
8096 (gnus-summary-remove-process-mark article)
8098 (gnus-summary-set-saved-mark article))))
8099 (gnus-kill-buffer save-buffer)
8100 (gnus-summary-position-point)
8101 (gnus-set-mode-line 'summary)
8104 (defun gnus-summary-pipe-output (&optional arg)
8105 "Pipe the current article to a subprocess.
8106 If N is a positive number, pipe the N next articles.
8107 If N is a negative number, pipe the N previous articles.
8108 If N is nil and any articles have been marked with the process mark,
8109 pipe those articles instead."
8111 (gnus-set-global-variables)
8112 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8113 (gnus-summary-save-article arg t))
8114 (gnus-configure-windows 'pipe))
8116 (defun gnus-summary-save-article-mail (&optional arg)
8117 "Append the current article to an mail file.
8118 If N is a positive number, save the N next articles.
8119 If N is a negative number, save the N previous articles.
8120 If N is nil and any articles have been marked with the process mark,
8121 save those articles instead."
8123 (gnus-set-global-variables)
8124 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8125 (gnus-summary-save-article arg)))
8127 (defun gnus-summary-save-article-rmail (&optional arg)
8128 "Append the current article to an rmail file.
8129 If N is a positive number, save the N next articles.
8130 If N is a negative number, save the N previous articles.
8131 If N is nil and any articles have been marked with the process mark,
8132 save those articles instead."
8134 (gnus-set-global-variables)
8135 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8136 (gnus-summary-save-article arg)))
8138 (defun gnus-summary-save-article-file (&optional arg)
8139 "Append the current article to a file.
8140 If N is a positive number, save the N next articles.
8141 If N is a negative number, save the N previous articles.
8142 If N is nil and any articles have been marked with the process mark,
8143 save those articles instead."
8145 (gnus-set-global-variables)
8146 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8147 (gnus-summary-save-article arg)))
8149 (defun gnus-summary-write-article-file (&optional arg)
8150 "Write the current article to a file, deleting the previous file.
8151 If N is a positive number, save the N next articles.
8152 If N is a negative number, save the N previous articles.
8153 If N is nil and any articles have been marked with the process mark,
8154 save those articles instead."
8156 (gnus-set-global-variables)
8157 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8158 (gnus-summary-save-article arg)))
8160 (defun gnus-summary-save-article-body-file (&optional arg)
8161 "Append the current article body to a file.
8162 If N is a positive number, save the N next articles.
8163 If N is a negative number, save the N previous articles.
8164 If N is nil and any articles have been marked with the process mark,
8165 save those articles instead."
8167 (gnus-set-global-variables)
8168 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8169 (gnus-summary-save-article arg)))
8171 (defun gnus-summary-pipe-message (program)
8172 "Pipe the current article through PROGRAM."
8173 (interactive "sProgram: ")
8174 (gnus-set-global-variables)
8175 (gnus-summary-select-article)
8176 (let ((mail-header-separator "")
8177 (art-buf (get-buffer gnus-article-buffer)))
8178 (gnus-eval-in-buffer-window gnus-article-buffer
8181 (let ((start (window-start))
8183 (message-pipe-buffer-body program)
8184 (set-window-start (get-buffer-window (current-buffer)) start))))))
8186 (defun gnus-get-split-value (methods)
8187 "Return a value based on the split METHODS."
8188 (let (split-name method result match)
8191 (set-buffer gnus-original-article-buffer)
8193 (nnheader-narrow-to-headers)
8195 (goto-char (point-min))
8196 (setq method (pop methods))
8197 (setq match (car method))
8200 ;; Regular expression.
8202 (re-search-forward match nil t)))
8203 ((gnus-functionp match)
8207 (setq result (funcall match gnus-newsgroup-name))))
8212 (setq result (eval match)))))
8213 (setq split-name (append (cdr method) split-name))
8214 (cond ((stringp result)
8215 (push (expand-file-name
8216 result gnus-article-save-directory)
8219 (setq split-name (append result split-name)))))))))
8222 (defun gnus-valid-move-group-p (group)
8227 (car (gnus-find-method-for-group
8228 (symbol-name group))))
8229 gnus-valid-select-methods))))
8231 (defun gnus-read-move-group-name (prompt default articles prefix)
8232 "Read a group name."
8233 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8234 (minibuffer-confirm-incomplete nil) ; XEmacs
8238 (if (> (length articles) 1)
8239 (format "these %d articles" (length articles))
8244 (gnus-completing-read default prom
8246 'gnus-valid-move-group-p
8248 'gnus-group-history))
8249 ((= 1 (length split-name))
8250 (gnus-completing-read (car split-name) prom
8252 'gnus-valid-move-group-p
8254 'gnus-group-history))
8256 (gnus-completing-read nil prom
8257 (mapcar (lambda (el) (list el))
8258 (nreverse split-name))
8260 'gnus-group-history)))))
8262 (if (or (string= to-newsgroup "")
8263 (string= to-newsgroup prefix))
8264 (setq to-newsgroup (or default "")))
8265 (or (gnus-active to-newsgroup)
8266 (gnus-activate-group to-newsgroup)
8267 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8269 (or (and (gnus-request-create-group
8270 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8271 (gnus-activate-group to-newsgroup nil nil
8272 (gnus-group-name-to-method
8274 (error "Couldn't create group %s" to-newsgroup)))
8275 (error "No such group: %s" to-newsgroup)))
8278 ;; Summary extract commands
8280 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8281 (let ((buffer-read-only nil)
8282 (article (gnus-summary-article-number))
8284 (unless (gnus-summary-goto-subject article)
8285 (error "No such article: %d" article))
8286 (gnus-summary-position-point)
8287 ;; If all commands are to be bunched up on one line, we collect
8289 (unless gnus-view-pseudos-separately
8290 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8293 (setq action (cdr (assq 'action (car ps))))
8294 (setq files (list (cdr (assq 'name (car ps)))))
8295 (while (and ps (cdr ps)
8296 (string= (or action "1")
8297 (or (cdr (assq 'action (cadr ps))) "2")))
8298 (push (cdr (assq 'name (cadr ps))) files)
8299 (setcdr ps (cddr ps)))
8301 (when (not (string-match "%s" action))
8304 (when (assq 'execute (car ps))
8305 (setcdr (assq 'execute (car ps))
8306 (funcall (if (string-match "%s" action)
8309 (mapconcat (lambda (f) f) files " ")))))
8310 (setq ps (cdr ps)))))
8311 (if (and gnus-view-pseudos (not not-view))
8313 (when (assq 'execute (car pslist))
8314 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8315 (eq gnus-view-pseudos 'not-confirm)))
8316 (setq pslist (cdr pslist)))
8319 (setq after-article (or (cdr (assq 'article (car pslist)))
8320 (gnus-summary-article-number)))
8321 (gnus-summary-goto-subject after-article)
8324 (insert " " (file-name-nondirectory
8325 (cdr (assq 'name (car pslist))))
8326 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8328 (forward-line -1) ; back to `b'
8329 (gnus-add-text-properties
8330 b (1- e) (list 'gnus-number gnus-reffed-article-number
8331 gnus-mouse-face-prop gnus-mouse-face))
8333 after-article gnus-reffed-article-number
8334 gnus-unread-mark b (car pslist) 0 (- e b))
8335 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8336 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8337 (setq pslist (cdr pslist)))))))
8339 (defun gnus-pseudos< (p1 p2)
8340 (let ((c1 (cdr (assq 'action p1)))
8341 (c2 (cdr (assq 'action p2))))
8342 (and c1 c2 (string< c1 c2))))
8344 (defun gnus-request-pseudo-article (props)
8345 (cond ((assq 'execute props)
8346 (gnus-execute-command (cdr (assq 'execute props)))))
8347 (let ((gnus-current-article (gnus-summary-article-number)))
8348 (run-hooks 'gnus-mark-article-hook)))
8350 (defun gnus-execute-command (command &optional automatic)
8352 (gnus-article-setup-buffer)
8353 (set-buffer gnus-article-buffer)
8354 (setq buffer-read-only nil)
8355 (let ((command (if automatic command (read-string "Command: " command)))
8356 ;; Just binding this here doesn't help, because there might
8357 ;; be output from the process after exiting the scope of
8359 ;; (buffer-read-only nil)
8362 (insert "$ " command "\n\n")
8363 (if gnus-view-pseudo-asynchronously
8364 (start-process "gnus-execute" nil shell-file-name
8365 shell-command-switch command)
8366 (call-process shell-file-name nil t nil
8367 shell-command-switch command)))))
8369 ;; Summary kill commands.
8371 (defun gnus-summary-edit-global-kill (article)
8372 "Edit the \"global\" kill file."
8373 (interactive (list (gnus-summary-article-number)))
8374 (gnus-set-global-variables)
8375 (gnus-group-edit-global-kill article))
8377 (defun gnus-summary-edit-local-kill ()
8378 "Edit a local kill file applied to the current newsgroup."
8380 (gnus-set-global-variables)
8381 (setq gnus-current-headers (gnus-summary-article-header))
8382 (gnus-set-global-variables)
8383 (gnus-group-edit-local-kill
8384 (gnus-summary-article-number) gnus-newsgroup-name))
8388 (defun gnus-read-header (id &optional header)
8389 "Read the headers of article ID and enter them into the Gnus system."
8390 (let ((group gnus-newsgroup-name)
8391 (gnus-override-method
8392 (and (gnus-news-group-p gnus-newsgroup-name)
8393 gnus-refer-article-method))
8395 ;; First we check to see whether the header in question is already
8398 ;; This is a Message-ID.
8399 (setq header (or header (gnus-id-to-header id)))
8400 ;; This is an article number.
8401 (setq header (or header (gnus-summary-article-header id))))
8403 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8404 ;; We have found the header.
8406 ;; We have to really fetch the header to this article.
8408 (set-buffer nntp-server-buffer)
8409 (when (setq where (gnus-request-head id group))
8410 (nnheader-fold-continuation-lines)
8411 (goto-char (point-max))
8413 (goto-char (point-min))
8417 ((cdr where) (cdr where))
8418 (header (mail-header-number header))
8419 (t gnus-reffed-article-number))
8421 (insert " Article retrieved.\n"))
8422 (if (not (setq header (car (gnus-get-newsgroup-headers nil t))))
8423 () ; Malformed head.
8424 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8425 (when (and (stringp id)
8426 (not (string= (gnus-group-real-name group)
8428 ;; If we fetched by Message-ID and the article came
8429 ;; from a different group, we fudge some bogus article
8430 ;; numbers for this article.
8431 (mail-header-set-number header gnus-reffed-article-number))
8433 (set-buffer gnus-summary-buffer)
8434 (decf gnus-reffed-article-number)
8435 (gnus-remove-header (mail-header-number header))
8436 (push header gnus-newsgroup-headers)
8437 (setq gnus-current-headers header)
8438 (push (mail-header-number header) gnus-newsgroup-limit)))
8441 (defun gnus-remove-header (number)
8442 "Remove header NUMBER from `gnus-newsgroup-headers'."
8443 (if (and gnus-newsgroup-headers
8444 (= number (mail-header-number (car gnus-newsgroup-headers))))
8445 (pop gnus-newsgroup-headers)
8446 (let ((headers gnus-newsgroup-headers))
8447 (while (and (cdr headers)
8448 (not (= number (mail-header-number (cadr headers)))))
8451 (setcdr headers (cddr headers))))))
8454 ;;; summary highlights
8457 (defun gnus-highlight-selected-summary ()
8458 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8459 ;; Highlight selected article in summary buffer
8460 (when gnus-summary-selected-face
8462 (let* ((beg (progn (beginning-of-line) (point)))
8463 (end (progn (end-of-line) (point)))
8464 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8465 (from (if (get-text-property beg gnus-mouse-face-prop)
8467 (or (next-single-property-change
8468 beg gnus-mouse-face-prop nil end)
8473 (or (next-single-property-change
8474 from gnus-mouse-face-prop nil end)
8476 ;; If no mouse-face prop on line we will have to = from = end,
8477 ;; so we highlight the entire line instead.
8478 (when (= (+ to 2) from)
8481 (if gnus-newsgroup-selected-overlay
8482 ;; Move old overlay.
8484 gnus-newsgroup-selected-overlay from to (current-buffer))
8485 ;; Create new overlay.
8487 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8488 'face gnus-summary-selected-face))))))
8490 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8491 (defun gnus-summary-highlight-line ()
8492 "Highlight current line according to `gnus-summary-highlight'."
8493 (let* ((list gnus-summary-highlight)
8495 (end (progn (end-of-line) (point)))
8496 ;; now find out where the line starts and leave point there.
8497 (beg (progn (beginning-of-line) (point)))
8498 (article (gnus-summary-article-number))
8499 (score (or (cdr (assq (or article gnus-current-article)
8500 gnus-newsgroup-scored))
8501 gnus-summary-default-score 0))
8502 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8503 (inhibit-read-only t))
8504 ;; Eval the cars of the lists until we find a match.
8505 (let ((default gnus-summary-default-score))
8507 (not (eval (caar list))))
8508 (setq list (cdr list))))
8509 (let ((face (cdar list)))
8510 (unless (eq face (get-text-property beg 'face))
8511 (gnus-put-text-property
8513 (setq face (if (boundp face) (symbol-value face) face)))
8514 (when gnus-summary-highlight-line-function
8515 (funcall gnus-summary-highlight-line-function article face))))
8518 (defun gnus-update-read-articles (group unread)
8519 "Update the list of read articles in GROUP."
8520 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8521 (entry (gnus-gethash group gnus-newsrc-hashtb))
8522 (info (nth 2 entry))
8524 (unread (sort (copy-sequence unread) '<))
8526 (if (or (not info) (not active))
8527 ;; There is no info on this group if it was, in fact,
8528 ;; killed. Gnus stores no information on killed groups, so
8529 ;; there's nothing to be done.
8530 ;; One could store the information somewhere temporarily,
8531 ;; perhaps... Hmmm...
8533 ;; Remove any negative articles numbers.
8534 (while (and unread (< (car unread) 0))
8535 (setq unread (cdr unread)))
8536 ;; Remove any expired article numbers
8537 (while (and unread (< (car unread) (car active)))
8538 (setq unread (cdr unread)))
8539 ;; Compute the ranges of read articles by looking at the list of
8542 (when (/= (car unread) prev)
8543 (push (if (= prev (1- (car unread))) prev
8544 (cons prev (1- (car unread))))
8546 (setq prev (1+ (car unread)))
8547 (setq unread (cdr unread)))
8548 (when (<= prev (cdr active))
8549 (push (cons prev (cdr active)) read))
8551 (set-buffer gnus-group-buffer)
8554 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8555 (gnus-info-set-read ',info ',(gnus-info-read info))
8556 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8557 (gnus-group-update-group ,group t))))
8558 ;; Enter this list into the group info.
8560 info (if (> (length read) 1) (nreverse read) read))
8561 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8562 (gnus-get-unread-articles-in-group info (gnus-active group))
8567 (run-hooks 'gnus-sum-load-hook)
8569 ;;; gnus-sum.el ends here