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.
28 (eval-when-compile (require 'cl))
37 (defcustom gnus-kill-summary-on-exit t
38 "*If non-nil, kill the summary buffer when you exit from it.
39 If nil, the summary will become a \"*Dead Summary*\" buffer, and
40 it will be killed sometime later."
41 :group 'gnus-summary-exit
44 (defcustom gnus-fetch-old-headers nil
45 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
46 If an unread article in the group refers to an older, already read (or
47 just marked as read) article, the old article will not normally be
48 displayed in the Summary buffer. If this variable is non-nil, Gnus
49 will attempt to grab the headers to the old articles, and thereby
50 build complete threads. If it has the value `some', only enough
51 headers to connect otherwise loose threads will be displayed.
52 This variable can also be a number. In that case, no more than that
53 number of old headers will be fetched.
55 The server has to support NOV for any of this to work."
57 :type '(choice (const :tag "off" nil)
60 (sexp :menu-tag "other" t)))
62 (defcustom gnus-summary-make-false-root 'adopt
63 "*nil means that Gnus won't gather loose threads.
64 If the root of a thread has expired or been read in a previous
65 session, the information necessary to build a complete thread has been
66 lost. Instead of having many small sub-threads from this original thread
67 scattered all over the summary buffer, Gnus can gather them.
69 If non-nil, Gnus will try to gather all loose sub-threads from an
70 original thread into one large thread.
72 If this variable is non-nil, it should be one of `none', `adopt',
75 If this variable is `none', Gnus will not make a false root, but just
76 present the sub-threads after another.
77 If this variable is `dummy', Gnus will create a dummy root that will
78 have all the sub-threads as children.
79 If this variable is `adopt', Gnus will make one of the \"children\"
80 the parent and mark all the step-children as such.
81 If this variable is `empty', the \"children\" are printed with empty
82 subject fields. (Or rather, they will be printed with a string
83 given by the `gnus-summary-same-subject' variable.)"
85 :type '(choice (const :tag "off" nil)
91 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
92 "*A regexp to match subjects to be excluded from loose thread gathering.
93 As loose thread gathering is done on subjects only, that means that
94 there can be many false gatherings performed. By rooting out certain
95 common subjects, gathering might become saner."
99 (defcustom gnus-summary-gather-subject-limit nil
100 "*Maximum length of subject comparisons when gathering loose threads.
101 Use nil to compare full subjects. Setting this variable to a low
102 number will help gather threads that have been corrupted by
103 newsreaders chopping off subject lines, but it might also mean that
104 unrelated articles that have subject that happen to begin with the
105 same few characters will be incorrectly gathered.
107 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
110 :type '(choice (const :tag "off" nil)
112 (sexp :menu-tag "on" t)))
114 (defcustom gnus-simplify-ignored-prefixes nil
115 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
117 :type '(choice (const :tag "off" nil)
120 (defcustom gnus-build-sparse-threads nil
121 "*If non-nil, fill in the gaps in threads.
122 If `some', only fill in the gaps that are needed to tie loose threads
123 together. If `more', fill in all leaf nodes that Gnus can find. If
124 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
126 :type '(choice (const :tag "off" nil)
129 (sexp :menu-tag "all" t)))
131 (defcustom gnus-summary-thread-gathering-function
132 'gnus-gather-threads-by-subject
133 "Function used for gathering loose threads.
134 There are two pre-defined functions: `gnus-gather-threads-by-subject',
135 which only takes Subjects into consideration; and
136 `gnus-gather-threads-by-references', which compared the References
137 headers of the articles to find matches."
139 :type '(radio (function-item gnus-gather-threads-by-subject)
140 (function-item gnus-gather-threads-by-references)
141 (function :tag "other")))
143 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
144 (defcustom gnus-summary-same-subject ""
145 "*String indicating that the current article has the same subject as the previous.
146 This variable will only be used if the value of
147 `gnus-summary-make-false-root' is `empty'."
148 :group 'gnus-summary-format
151 (defcustom gnus-summary-goto-unread t
152 "*If t, marking commands will go to the next unread article.
153 If `never', commands that usually go to the next unread article, will
154 go to the next article, whether it is read or not.
155 If nil, only the marking commands will go to the next (un)read article."
156 :group 'gnus-summary-marks
157 :link '(custom-manual "(gnus)Setting Marks")
158 :type '(choice (const :tag "off" nil)
160 (sexp :menu-tag "on" t)))
162 (defcustom gnus-summary-default-score 0
163 "*Default article score level.
164 All scores generated by the score files will be added to this score.
165 If this variable is nil, scoring will be disabled."
166 :group 'gnus-score-default
167 :type '(choice (const :tag "disable")
170 (defcustom gnus-summary-zcore-fuzz 0
171 "*Fuzziness factor for the zcore in the summary buffer.
172 Articles with scores closer than this to `gnus-summary-default-score'
174 :group 'gnus-summary-format
177 (defcustom gnus-simplify-subject-fuzzy-regexp nil
178 "*Strings to be removed when doing fuzzy matches.
179 This can either be a regular expression or list of regular expressions
180 that will be removed from subject strings if fuzzy subject
181 simplification is selected."
183 :type '(repeat regexp))
185 (defcustom gnus-show-threads t
186 "*If non-nil, display threads in summary mode."
190 (defcustom gnus-thread-hide-subtree nil
191 "*If non-nil, hide all threads initially.
192 If threads are hidden, you have to run the command
193 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
194 to expose hidden threads."
198 (defcustom gnus-thread-hide-killed t
199 "*If non-nil, hide killed threads automatically."
203 (defcustom gnus-thread-ignore-subject nil
204 "*If non-nil, ignore subjects and do all threading based on the Reference header.
205 If nil, which is the default, articles that have different subjects
206 from their parents will start separate threads."
210 (defcustom gnus-thread-operation-ignore-subject t
211 "*If non-nil, subjects will be ignored when doing thread commands.
212 This affects commands like `gnus-summary-kill-thread' and
213 `gnus-summary-lower-thread'.
215 If this variable is nil, articles in the same thread with different
216 subjects will not be included in the operation in question. If this
217 variable is `fuzzy', only articles that have subjects that are fuzzily
218 equal will be included."
220 :type '(choice (const :tag "off" nil)
224 (defcustom gnus-thread-indent-level 4
225 "*Number that says how much each sub-thread should be indented."
229 (defcustom gnus-auto-extend-newsgroup t
230 "*If non-nil, extend newsgroup forward and backward when requested."
231 :group 'gnus-summary-choose
234 (defcustom gnus-auto-select-first t
235 "*If nil, don't select the first unread article when entering a group.
236 If this variable is `best', select the highest-scored unread article
237 in the group. If neither nil nor `best', select the first unread
240 If you want to prevent automatic selection of the first unread article
241 in some newsgroups, set the variable to nil in
242 `gnus-select-group-hook'."
243 :group 'gnus-group-select
244 :type '(choice (const :tag "none" nil)
246 (sexp :menu-tag "first" t)))
248 (defcustom gnus-auto-select-next t
249 "*If non-nil, offer to go to the next group from the end of the previous.
250 If the value is t and the next newsgroup is empty, Gnus will exit
251 summary mode and go back to group mode. If the value is neither nil
252 nor t, Gnus will select the following unread newsgroup. In
253 particular, if the value is the symbol `quietly', the next unread
254 newsgroup will be selected without any confirmation, and if it is
255 `almost-quietly', the next group will be selected without any
256 confirmation if you are located on the last article in the group.
257 Finally, if this variable is `slightly-quietly', the `Z n' command
258 will go to the next group without confirmation."
259 :group 'gnus-summary-maneuvering
260 :type '(choice (const :tag "off" nil)
262 (const almost-quietly)
263 (const slightly-quietly)
264 (sexp :menu-tag "on" t)))
266 (defcustom gnus-auto-select-same nil
267 "*If non-nil, select the next article with the same subject."
268 :group 'gnus-summary-maneuvering
271 (defcustom gnus-summary-check-current nil
272 "*If non-nil, consider the current article when moving.
273 The \"unread\" movement commands will stay on the same line if the
274 current article is unread."
275 :group 'gnus-summary-maneuvering
278 (defcustom gnus-auto-center-summary t
279 "*If non-nil, always center the current summary buffer.
280 In particular, if `vertical' do only vertical recentering. If non-nil
281 and non-`vertical', do both horizontal and vertical recentering."
282 :group 'gnus-summary-maneuvering
283 :type '(choice (const :tag "none" nil)
285 (sexp :menu-tag "both" t)))
287 (defcustom gnus-show-all-headers nil
288 "*If non-nil, don't hide any headers."
289 :group 'gnus-article-hiding
290 :group 'gnus-article-headers
293 (defcustom gnus-summary-ignore-duplicates nil
294 "*If non-nil, ignore articles with identical Message-ID headers."
298 (defcustom gnus-single-article-buffer t
299 "*If non-nil, display all articles in the same buffer.
300 If nil, each group will get its own article buffer."
301 :group 'gnus-article-various
304 (defcustom gnus-break-pages t
305 "*If non-nil, do page breaking on articles.
306 The page delimiter is specified by the `gnus-page-delimiter'
308 :group 'gnus-article-various
311 (defcustom gnus-show-mime nil
312 "*If non-nil, do mime processing of articles.
313 The articles will simply be fed to the function given by
314 `gnus-show-mime-method'."
315 :group 'gnus-article-mime
318 (defcustom gnus-move-split-methods nil
319 "*Variable used to suggest where articles are to be moved to.
320 It uses the same syntax as the `gnus-split-methods' variable."
321 :group 'gnus-summary-mail
322 :type '(repeat (choice (list function)
323 (cons regexp (repeat string))
326 (defcustom gnus-unread-mark ?
327 "*Mark used for unread articles."
328 :group 'gnus-summary-marks
331 (defcustom gnus-ticked-mark ?!
332 "*Mark used for ticked articles."
333 :group 'gnus-summary-marks
336 (defcustom gnus-dormant-mark ??
337 "*Mark used for dormant articles."
338 :group 'gnus-summary-marks
341 (defcustom gnus-del-mark ?r
342 "*Mark used for del'd articles."
343 :group 'gnus-summary-marks
346 (defcustom gnus-read-mark ?R
347 "*Mark used for read articles."
348 :group 'gnus-summary-marks
351 (defcustom gnus-expirable-mark ?E
352 "*Mark used for expirable articles."
353 :group 'gnus-summary-marks
356 (defcustom gnus-killed-mark ?K
357 "*Mark used for killed articles."
358 :group 'gnus-summary-marks
361 (defcustom gnus-souped-mark ?F
362 "*Mark used for killed articles."
363 :group 'gnus-summary-marks
366 (defcustom gnus-kill-file-mark ?X
367 "*Mark used for articles killed by kill files."
368 :group 'gnus-summary-marks
371 (defcustom gnus-low-score-mark ?Y
372 "*Mark used for articles with a low score."
373 :group 'gnus-summary-marks
376 (defcustom gnus-catchup-mark ?C
377 "*Mark used for articles that are caught up."
378 :group 'gnus-summary-marks
381 (defcustom gnus-replied-mark ?A
382 "*Mark used for articles that have been replied to."
383 :group 'gnus-summary-marks
386 (defcustom gnus-cached-mark ?*
387 "*Mark used for articles that are in the cache."
388 :group 'gnus-summary-marks
391 (defcustom gnus-saved-mark ?S
392 "*Mark used for articles that have been saved to."
393 :group 'gnus-summary-marks
396 (defcustom gnus-ancient-mark ?O
397 "*Mark used for ancient articles."
398 :group 'gnus-summary-marks
401 (defcustom gnus-sparse-mark ?Q
402 "*Mark used for sparsely reffed articles."
403 :group 'gnus-summary-marks
406 (defcustom gnus-canceled-mark ?G
407 "*Mark used for canceled articles."
408 :group 'gnus-summary-marks
411 (defcustom gnus-duplicate-mark ?M
412 "*Mark used for duplicate articles."
413 :group 'gnus-summary-marks
416 (defcustom gnus-undownloaded-mark ?@
417 "*Mark used for articles that weren't downloaded."
418 :group 'gnus-summary-marks
421 (defcustom gnus-downloadable-mark ?%
422 "*Mark used for articles that are to be downloaded."
423 :group 'gnus-summary-marks
426 (defcustom gnus-unsendable-mark ?=
427 "*Mark used for articles that won't be sent."
428 :group 'gnus-summary-marks
431 (defcustom gnus-score-over-mark ?+
432 "*Score mark used for articles with high scores."
433 :group 'gnus-summary-marks
436 (defcustom gnus-score-below-mark ?-
437 "*Score mark used for articles with low scores."
438 :group 'gnus-summary-marks
441 (defcustom gnus-empty-thread-mark ?
442 "*There is no thread under the article."
443 :group 'gnus-summary-marks
446 (defcustom gnus-not-empty-thread-mark ?=
447 "*There is a thread under the article."
448 :group 'gnus-summary-marks
451 (defcustom gnus-view-pseudo-asynchronously nil
452 "*If non-nil, Gnus will view pseudo-articles asynchronously."
453 :group 'gnus-extract-view
456 (defcustom gnus-view-pseudos nil
457 "*If `automatic', pseudo-articles will be viewed automatically.
458 If `not-confirm', pseudos will be viewed automatically, and the user
459 will not be asked to confirm the command."
460 :group 'gnus-extract-view
461 :type '(choice (const :tag "off" nil)
463 (const not-confirm)))
465 (defcustom gnus-view-pseudos-separately t
466 "*If non-nil, one pseudo-article will be created for each file to be viewed.
467 If nil, all files that use the same viewing command will be given as a
468 list of parameters to that command."
469 :group 'gnus-extract-view
472 (defcustom gnus-insert-pseudo-articles t
473 "*If non-nil, insert pseudo-articles when decoding articles."
474 :group 'gnus-extract-view
477 (defcustom gnus-summary-dummy-line-format
479 "*The format specification for the dummy roots in the summary buffer.
480 It works along the same lines as a normal formatting string,
481 with some simple extensions.
484 :group 'gnus-threading
487 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
488 "*The format specification for the summary mode line.
489 It works along the same lines as a normal formatting string,
490 with some simple extensions:
493 %p Unprefixed group name
494 %A Current article number
496 %U Number of unread articles in the group
497 %e Number of unselected articles in the group
498 %Z A string with unread/unselected article counts
499 %g Shortish group name
500 %S Subject of the current article
502 %s Current score file name
503 %d Number of dormant articles
504 %r Number of articles that have been marked as read in this session
505 %E Number of articles expunged by the score files"
506 :group 'gnus-summary-format
509 (defcustom gnus-summary-mark-below 0
510 "*Mark all articles with a score below this variable as read.
511 This variable is local to each summary buffer and usually set by the
513 :group 'gnus-score-default
516 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
517 "*List of functions used for sorting articles in the summary buffer.
518 This variable is only used when not using a threaded display."
519 :group 'gnus-summary-sort
520 :type '(repeat (choice (function-item gnus-article-sort-by-number)
521 (function-item gnus-article-sort-by-author)
522 (function-item gnus-article-sort-by-subject)
523 (function-item gnus-article-sort-by-date)
524 (function-item gnus-article-sort-by-score)
525 (function :tag "other"))))
527 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
528 "*List of functions used for sorting threads in the summary buffer.
529 By default, threads are sorted by article number.
531 Each function takes two threads and return non-nil if the first thread
532 should be sorted before the other. If you use more than one function,
533 the primary sort function should be the last. You should probably
534 always include `gnus-thread-sort-by-number' in the list of sorting
535 functions -- preferably first.
537 Ready-made functions include `gnus-thread-sort-by-number',
538 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
539 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
540 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
541 :group 'gnus-summary-sort
542 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
543 (function-item gnus-thread-sort-by-author)
544 (function-item gnus-thread-sort-by-subject)
545 (function-item gnus-thread-sort-by-date)
546 (function-item gnus-thread-sort-by-score)
547 (function-item gnus-thread-sort-by-total-score)
548 (function :tag "other"))))
550 (defcustom gnus-thread-score-function '+
551 "*Function used for calculating the total score of a thread.
553 The function is called with the scores of the article and each
554 subthread and should then return the score of the thread.
556 Some functions you can use are `+', `max', or `min'."
557 :group 'gnus-summary-sort
560 (defcustom gnus-summary-expunge-below nil
561 "All articles that have a score less than this variable will be expunged."
562 :group 'gnus-score-default
563 :type '(choice (const :tag "off" nil)
566 (defcustom gnus-thread-expunge-below nil
567 "All threads that have a total score less than this variable will be expunged.
568 See `gnus-thread-score-function' for en explanation of what a
569 \"thread score\" is."
570 :group 'gnus-treading
571 :group 'gnus-score-default
572 :type '(choice (const :tag "off" nil)
575 (defcustom gnus-summary-mode-hook nil
576 "*A hook for Gnus summary mode.
577 This hook is run before any variables are set in the summary buffer."
578 :group 'gnus-summary-various
581 (defcustom gnus-summary-menu-hook nil
582 "*Hook run after the creation of the summary mode menu."
583 :group 'gnus-summary-visual
586 (defcustom gnus-summary-exit-hook nil
587 "*A hook called on exit from the summary buffer.
588 It will be called with point in the group buffer."
589 :group 'gnus-summary-exit
592 (defcustom gnus-summary-prepare-hook nil
593 "*A hook called after the summary buffer has been generated.
594 If you want to modify the summary buffer, you can use this hook."
595 :group 'gnus-summary-various
598 (defcustom gnus-summary-generate-hook nil
599 "*A hook run just before generating the summary buffer.
600 This hook is commonly used to customize threading variables and the
602 :group 'gnus-summary-various
605 (defcustom gnus-select-group-hook nil
606 "*A hook called when a newsgroup is selected.
608 If you'd like to simplify subjects like the
609 `gnus-summary-next-same-subject' command does, you can use the
612 (setq gnus-select-group-hook
615 (mapcar (lambda (header)
616 (mail-header-set-subject
618 (gnus-simplify-subject
619 (mail-header-subject header) 're-only)))
620 gnus-newsgroup-headers))))"
621 :group 'gnus-group-select
624 (defcustom gnus-select-article-hook nil
625 "*A hook called when an article is selected."
626 :group 'gnus-summary-choose
629 (defcustom gnus-visual-mark-article-hook
630 (list 'gnus-highlight-selected-summary)
631 "*Hook run after selecting an article in the summary buffer.
632 It is meant to be used for highlighting the article in some way. It
633 is not run if `gnus-visual' is nil."
634 :group 'gnus-summary-visual
637 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
638 (defcustom gnus-structured-field-decoder 'identity
639 "Function to decode non-ASCII characters in structured field for summary."
643 (defcustom gnus-unstructured-field-decoder 'identity
644 "Function to decode non-ASCII characters in unstructured field for summary."
648 (defcustom gnus-parse-headers-hook
649 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522)
650 "*A hook called before parsing the headers."
654 (defcustom gnus-exit-group-hook nil
655 "*A hook called when exiting (not quitting) summary mode."
659 (defcustom gnus-summary-update-hook
660 (list 'gnus-summary-highlight-line)
661 "*A hook called when a summary line is changed.
662 The hook will not be called if `gnus-visual' is nil.
664 The default function `gnus-summary-highlight-line' will
665 highlight the line according to the `gnus-summary-highlight'
667 :group 'gnus-summary-visual
670 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
671 "*A hook called when an article is selected for the first time.
672 The hook is intended to mark an article as read (or unread)
673 automatically when it is selected."
674 :group 'gnus-summary-choose
677 (defcustom gnus-group-no-more-groups-hook nil
678 "*A hook run when returning to group mode having no more (unread) groups."
679 :group 'gnus-group-select
682 (defcustom gnus-ps-print-hook nil
683 "*A hook run before ps-printing something from Gnus."
687 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
688 "Face used for highlighting the current article in the summary buffer."
689 :group 'gnus-summary-visual
692 (defcustom gnus-summary-highlight
693 '(((= mark gnus-canceled-mark)
694 . gnus-summary-cancelled-face)
695 ((and (> score default)
696 (or (= mark gnus-dormant-mark)
697 (= mark gnus-ticked-mark)))
698 . gnus-summary-high-ticked-face)
699 ((and (< score default)
700 (or (= mark gnus-dormant-mark)
701 (= mark gnus-ticked-mark)))
702 . gnus-summary-low-ticked-face)
703 ((or (= mark gnus-dormant-mark)
704 (= mark gnus-ticked-mark))
705 . gnus-summary-normal-ticked-face)
706 ((and (> score default) (= mark gnus-ancient-mark))
707 . gnus-summary-high-ancient-face)
708 ((and (< score default) (= mark gnus-ancient-mark))
709 . gnus-summary-low-ancient-face)
710 ((= mark gnus-ancient-mark)
711 . gnus-summary-normal-ancient-face)
712 ((and (> score default) (= mark gnus-unread-mark))
713 . gnus-summary-high-unread-face)
714 ((and (< score default) (= mark gnus-unread-mark))
715 . gnus-summary-low-unread-face)
716 ((and (= mark gnus-unread-mark))
717 . gnus-summary-normal-unread-face)
719 . gnus-summary-high-read-face)
721 . gnus-summary-low-read-face)
723 . gnus-summary-normal-read-face))
724 "Controls the highlighting of summary buffer lines.
726 A list of (FORM . FACE) pairs. When deciding how a a particular
727 summary line should be displayed, each form is evaluated. The content
728 of the face field after the first true form is used. You can change
729 how those summary lines are displayed, by editing the face field.
731 You can use the following variables in the FORM field.
733 score: The articles score
734 default: The default article score.
735 below: The score below which articles are automatically marked as read.
736 mark: The articles mark."
737 :group 'gnus-summary-visual
738 :type '(repeat (cons (sexp :tag "Form" nil)
741 (defcustom gnus-alter-header-function nil
742 "Function called to allow alteration of article header structures.
743 The function is called with one parameter, the article header vector,
744 which it may alter in any way.")
746 ;;; Internal variables
748 (defvar gnus-scores-exclude-files nil)
749 (defvar gnus-page-broken nil)
751 (defvar gnus-original-article nil)
752 (defvar gnus-article-internal-prepare-hook nil)
753 (defvar gnus-newsgroup-process-stack nil)
755 (defvar gnus-thread-indent-array nil)
756 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
758 ;; Avoid highlighting in kill files.
759 (defvar gnus-summary-inhibit-highlight nil)
760 (defvar gnus-newsgroup-selected-overlay nil)
761 (defvar gnus-inhibit-limiting nil)
762 (defvar gnus-newsgroup-adaptive-score-file nil)
763 (defvar gnus-current-score-file nil)
764 (defvar gnus-current-move-group nil)
765 (defvar gnus-current-copy-group nil)
766 (defvar gnus-current-crosspost-group nil)
768 (defvar gnus-newsgroup-dependencies nil)
769 (defvar gnus-newsgroup-adaptive nil)
770 (defvar gnus-summary-display-article-function nil)
771 (defvar gnus-summary-highlight-line-function nil
772 "Function called after highlighting a summary line.")
774 (defvar gnus-summary-line-format-alist
775 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
776 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
777 (?s gnus-tmp-subject-or-nil ?s)
778 (?n gnus-tmp-name ?s)
779 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
781 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
783 (?F gnus-tmp-from ?s)
784 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
785 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
786 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
787 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
788 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
789 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
790 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
791 (?L gnus-tmp-lines ?d)
792 (?I gnus-tmp-indentation ?s)
793 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
794 (?R gnus-tmp-replied ?c)
795 (?\[ gnus-tmp-opening-bracket ?c)
796 (?\] gnus-tmp-closing-bracket ?c)
797 (?\> (make-string gnus-tmp-level ? ) ?s)
798 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
799 (?i gnus-tmp-score ?d)
800 (?z gnus-tmp-score-char ?c)
801 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
802 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
803 (?U gnus-tmp-unread ?c)
804 (?t (gnus-summary-number-of-articles-in-thread
805 (and (boundp 'thread) (car thread)) gnus-tmp-level)
807 (?e (gnus-summary-number-of-articles-in-thread
808 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
810 (?u gnus-tmp-user-defined ?s)
811 (?P (gnus-pick-line-number) ?d))
812 "An alist of format specifications that can appear in summary lines,
813 and what variables they correspond with, along with the type of the
814 variable (string, integer, character, etc).")
816 (defvar gnus-summary-dummy-line-format-alist
817 `((?S gnus-tmp-subject ?s)
818 (?N gnus-tmp-number ?d)
819 (?u gnus-tmp-user-defined ?s)))
821 (defvar gnus-summary-mode-line-format-alist
822 `((?G gnus-tmp-group-name ?s)
823 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
824 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
825 (?A gnus-tmp-article-number ?d)
826 (?Z gnus-tmp-unread-and-unselected ?s)
828 (?U gnus-tmp-unread-and-unticked ?d)
829 (?S gnus-tmp-subject ?s)
830 (?e gnus-tmp-unselected ?d)
831 (?u gnus-tmp-user-defined ?s)
832 (?d (length gnus-newsgroup-dormant) ?d)
833 (?t (length gnus-newsgroup-marked) ?d)
834 (?r (length gnus-newsgroup-reads) ?d)
835 (?E gnus-newsgroup-expunged-tally ?d)
836 (?s (gnus-current-score-file-nondirectory) ?s)))
838 (defvar gnus-last-search-regexp nil
839 "Default regexp for article search command.")
841 (defvar gnus-last-shell-command nil
842 "Default shell command on article.")
844 (defvar gnus-newsgroup-begin nil)
845 (defvar gnus-newsgroup-end nil)
846 (defvar gnus-newsgroup-last-rmail nil)
847 (defvar gnus-newsgroup-last-mail nil)
848 (defvar gnus-newsgroup-last-folder nil)
849 (defvar gnus-newsgroup-last-file nil)
850 (defvar gnus-newsgroup-auto-expire nil)
851 (defvar gnus-newsgroup-active nil)
853 (defvar gnus-newsgroup-data nil)
854 (defvar gnus-newsgroup-data-reverse nil)
855 (defvar gnus-newsgroup-limit nil)
856 (defvar gnus-newsgroup-limits nil)
858 (defvar gnus-newsgroup-unreads nil
859 "List of unread articles in the current newsgroup.")
861 (defvar gnus-newsgroup-unselected nil
862 "List of unselected unread articles in the current newsgroup.")
864 (defvar gnus-newsgroup-reads nil
865 "Alist of read articles and article marks in the current newsgroup.")
867 (defvar gnus-newsgroup-expunged-tally nil)
869 (defvar gnus-newsgroup-marked nil
870 "List of ticked articles in the current newsgroup (a subset of unread art).")
872 (defvar gnus-newsgroup-killed nil
873 "List of ranges of articles that have been through the scoring process.")
875 (defvar gnus-newsgroup-cached nil
876 "List of articles that come from the article cache.")
878 (defvar gnus-newsgroup-saved nil
879 "List of articles that have been saved.")
881 (defvar gnus-newsgroup-kill-headers nil)
883 (defvar gnus-newsgroup-replied nil
884 "List of articles that have been replied to in the current newsgroup.")
886 (defvar gnus-newsgroup-expirable nil
887 "List of articles in the current newsgroup that can be expired.")
889 (defvar gnus-newsgroup-processable nil
890 "List of articles in the current newsgroup that can be processed.")
892 (defvar gnus-newsgroup-downloadable nil
893 "List of articles in the current newsgroup that can be processed.")
895 (defvar gnus-newsgroup-undownloaded nil
896 "List of articles in the current newsgroup that haven't been downloaded..")
898 (defvar gnus-newsgroup-unsendable nil
899 "List of articles in the current newsgroup that won't be sent.")
901 (defvar gnus-newsgroup-bookmarks nil
902 "List of articles in the current newsgroup that have bookmarks.")
904 (defvar gnus-newsgroup-dormant nil
905 "List of dormant articles in the current newsgroup.")
907 (defvar gnus-newsgroup-scored nil
908 "List of scored articles in the current newsgroup.")
910 (defvar gnus-newsgroup-headers nil
911 "List of article headers in the current newsgroup.")
913 (defvar gnus-newsgroup-threads nil)
915 (defvar gnus-newsgroup-prepared nil
916 "Whether the current group has been prepared properly.")
918 (defvar gnus-newsgroup-ancient nil
919 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
921 (defvar gnus-newsgroup-sparse nil)
923 (defvar gnus-current-article nil)
924 (defvar gnus-article-current nil)
925 (defvar gnus-current-headers nil)
926 (defvar gnus-have-all-headers nil)
927 (defvar gnus-last-article nil)
928 (defvar gnus-newsgroup-history nil)
930 (defconst gnus-summary-local-variables
931 '(gnus-newsgroup-name
932 gnus-newsgroup-begin gnus-newsgroup-end
933 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
934 gnus-newsgroup-last-folder gnus-newsgroup-last-file
935 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
936 gnus-newsgroup-unselected gnus-newsgroup-marked
937 gnus-newsgroup-reads gnus-newsgroup-saved
938 gnus-newsgroup-replied gnus-newsgroup-expirable
939 gnus-newsgroup-processable gnus-newsgroup-killed
940 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
941 gnus-newsgroup-unsendable
942 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
943 gnus-newsgroup-headers gnus-newsgroup-threads
944 gnus-newsgroup-prepared gnus-summary-highlight-line-function
945 gnus-current-article gnus-current-headers gnus-have-all-headers
946 gnus-last-article gnus-article-internal-prepare-hook
947 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
948 gnus-newsgroup-scored gnus-newsgroup-kill-headers
949 gnus-thread-expunge-below
950 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
951 (gnus-summary-mark-below . global)
952 gnus-newsgroup-active gnus-scores-exclude-files
953 gnus-newsgroup-history gnus-newsgroup-ancient
954 gnus-newsgroup-sparse gnus-newsgroup-process-stack
955 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
956 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
957 (gnus-newsgroup-expunged-tally . 0)
958 gnus-cache-removable-articles gnus-newsgroup-cached
959 gnus-newsgroup-data gnus-newsgroup-data-reverse
960 gnus-newsgroup-limit gnus-newsgroup-limits)
961 "Variables that are buffer-local to the summary buffers.")
963 ;; Byte-compiler warning.
964 (defvar gnus-article-mode-map)
966 ;; Subject simplification.
968 (defsubst gnus-simplify-subject-re (subject)
969 "Remove \"Re:\" from subject lines."
970 (if (string-match "^[Rr][Ee]: *" subject)
971 (substring subject (match-end 0))
974 (defun gnus-simplify-subject (subject &optional re-only)
975 "Remove `Re:' and words in parentheses.
976 If RE-ONLY is non-nil, strip leading `Re:'s only."
977 (let ((case-fold-search t)) ;Ignore case.
978 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
979 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
980 (setq subject (substring subject (match-end 0))))
981 ;; Remove uninteresting prefixes.
982 (when (and (not re-only)
983 gnus-simplify-ignored-prefixes
984 (string-match gnus-simplify-ignored-prefixes subject))
985 (setq subject (substring subject (match-end 0))))
986 ;; Remove words in parentheses from end.
988 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
989 (setq subject (substring subject 0 (match-beginning 0)))))
990 ;; Return subject string.
993 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
995 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
996 (goto-char (point-min))
997 (while (re-search-forward regexp nil t)
998 (replace-match (or newtext ""))))
1000 (defun gnus-simplify-buffer-fuzzy ()
1001 "Simplify string in the buffer fuzzily.
1002 The string in the accessible portion of the current buffer is simplified.
1003 It is assumed to be a single-line subject.
1004 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1005 matter is removed. Additional things can be deleted by setting
1006 gnus-simplify-subject-fuzzy-regexp."
1007 (let ((case-fold-search t)
1009 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1011 (while (not (eq modified-tick (buffer-modified-tick)))
1012 (setq modified-tick (buffer-modified-tick))
1014 ((listp gnus-simplify-subject-fuzzy-regexp)
1015 (mapcar 'gnus-simplify-buffer-fuzzy-step
1016 gnus-simplify-subject-fuzzy-regexp))
1017 (gnus-simplify-subject-fuzzy-regexp
1018 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1019 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1020 (gnus-simplify-buffer-fuzzy-step
1021 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1022 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1024 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1025 (gnus-simplify-buffer-fuzzy-step " +" " ")
1026 (gnus-simplify-buffer-fuzzy-step " $")
1027 (gnus-simplify-buffer-fuzzy-step "^ +")))
1029 (defun gnus-simplify-subject-fuzzy (subject)
1030 "Simplify a subject string fuzzily.
1031 See gnus-simplify-buffer-fuzzy for details."
1033 (gnus-set-work-buffer)
1034 (let ((case-fold-search t))
1036 (inline (gnus-simplify-buffer-fuzzy))
1039 (defsubst gnus-simplify-subject-fully (subject)
1040 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1042 ((null gnus-summary-gather-subject-limit)
1043 (gnus-simplify-subject-re subject))
1044 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1045 (gnus-simplify-subject-fuzzy subject))
1046 ((numberp gnus-summary-gather-subject-limit)
1047 (gnus-limit-string (gnus-simplify-subject-re subject)
1048 gnus-summary-gather-subject-limit))
1052 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1053 "Check whether two subjects are equal. If optional argument
1054 simple-first is t, first argument is already simplified."
1056 ((null simple-first)
1057 (equal (gnus-simplify-subject-fully s1)
1058 (gnus-simplify-subject-fully s2)))
1061 (gnus-simplify-subject-fully s2)))))
1063 (defun gnus-summary-bubble-group ()
1064 "Increase the score of the current group.
1065 This is a handy function to add to `gnus-summary-exit-hook' to
1066 increase the score of each group you read."
1067 (gnus-group-add-score gnus-newsgroup-name))
1071 ;;; Gnus summary mode
1074 (put 'gnus-summary-mode 'mode-class 'special)
1077 ;; Non-orthogonal keys
1079 (gnus-define-keys gnus-summary-mode-map
1080 " " gnus-summary-next-page
1081 "\177" gnus-summary-prev-page
1082 [delete] gnus-summary-prev-page
1083 "\r" gnus-summary-scroll-up
1084 "n" gnus-summary-next-unread-article
1085 "p" gnus-summary-prev-unread-article
1086 "N" gnus-summary-next-article
1087 "P" gnus-summary-prev-article
1088 "\M-\C-n" gnus-summary-next-same-subject
1089 "\M-\C-p" gnus-summary-prev-same-subject
1090 "\M-n" gnus-summary-next-unread-subject
1091 "\M-p" gnus-summary-prev-unread-subject
1092 "." gnus-summary-first-unread-article
1093 "," gnus-summary-best-unread-article
1094 "\M-s" gnus-summary-search-article-forward
1095 "\M-r" gnus-summary-search-article-backward
1096 "<" gnus-summary-beginning-of-article
1097 ">" gnus-summary-end-of-article
1098 "j" gnus-summary-goto-article
1099 "^" gnus-summary-refer-parent-article
1100 "\M-^" gnus-summary-refer-article
1101 "u" gnus-summary-tick-article-forward
1102 "!" gnus-summary-tick-article-forward
1103 "U" gnus-summary-tick-article-backward
1104 "d" gnus-summary-mark-as-read-forward
1105 "D" gnus-summary-mark-as-read-backward
1106 "E" gnus-summary-mark-as-expirable
1107 "\M-u" gnus-summary-clear-mark-forward
1108 "\M-U" gnus-summary-clear-mark-backward
1109 "k" gnus-summary-kill-same-subject-and-select
1110 "\C-k" gnus-summary-kill-same-subject
1111 "\M-\C-k" gnus-summary-kill-thread
1112 "\M-\C-l" gnus-summary-lower-thread
1113 "e" gnus-summary-edit-article
1114 "#" gnus-summary-mark-as-processable
1115 "\M-#" gnus-summary-unmark-as-processable
1116 "\M-\C-t" gnus-summary-toggle-threads
1117 "\M-\C-s" gnus-summary-show-thread
1118 "\M-\C-h" gnus-summary-hide-thread
1119 "\M-\C-f" gnus-summary-next-thread
1120 "\M-\C-b" gnus-summary-prev-thread
1121 "\M-\C-u" gnus-summary-up-thread
1122 "\M-\C-d" gnus-summary-down-thread
1123 "&" gnus-summary-execute-command
1124 "c" gnus-summary-catchup-and-exit
1125 "\C-w" gnus-summary-mark-region-as-read
1126 "\C-t" gnus-summary-toggle-truncation
1127 "?" gnus-summary-mark-as-dormant
1128 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1129 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1130 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1131 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1132 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1133 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1134 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1135 "=" gnus-summary-expand-window
1136 "\C-x\C-s" gnus-summary-reselect-current-group
1137 "\M-g" gnus-summary-rescan-group
1138 "w" gnus-summary-stop-page-breaking
1139 "\C-c\C-r" gnus-summary-caesar-message
1140 "\M-t" gnus-summary-toggle-mime
1141 "f" gnus-summary-followup
1142 "F" gnus-summary-followup-with-original
1143 "C" gnus-summary-cancel-article
1144 "r" gnus-summary-reply
1145 "R" gnus-summary-reply-with-original
1146 "\C-c\C-f" gnus-summary-mail-forward
1147 "o" gnus-summary-save-article
1148 "\C-o" gnus-summary-save-article-mail
1149 "|" gnus-summary-pipe-output
1150 "\M-k" gnus-summary-edit-local-kill
1151 "\M-K" gnus-summary-edit-global-kill
1153 "\C-c\C-d" gnus-summary-describe-group
1154 "q" gnus-summary-exit
1155 "Q" gnus-summary-exit-no-update
1156 "\C-c\C-i" gnus-info-find-node
1157 gnus-mouse-2 gnus-mouse-pick-article
1158 "m" gnus-summary-mail-other-window
1159 "a" gnus-summary-post-news
1160 "x" gnus-summary-limit-to-unread
1161 "s" gnus-summary-isearch-article
1162 "t" gnus-article-hide-headers
1163 "g" gnus-summary-show-article
1164 "l" gnus-summary-goto-last-article
1165 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1166 "\C-d" gnus-summary-enter-digest-group
1167 "\M-\C-d" gnus-summary-read-document
1169 "*" gnus-cache-enter-article
1170 "\M-*" gnus-cache-remove-article
1171 "\M-&" gnus-summary-universal-argument
1172 "\C-l" gnus-recenter
1173 "I" gnus-summary-increase-score
1174 "L" gnus-summary-lower-score
1176 "V" gnus-summary-score-map
1177 "X" gnus-uu-extract-map
1178 "S" gnus-summary-send-map)
1180 ;; Sort of orthogonal keymap
1181 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1182 "t" gnus-summary-tick-article-forward
1183 "!" gnus-summary-tick-article-forward
1184 "d" gnus-summary-mark-as-read-forward
1185 "r" gnus-summary-mark-as-read-forward
1186 "c" gnus-summary-clear-mark-forward
1187 " " gnus-summary-clear-mark-forward
1188 "e" gnus-summary-mark-as-expirable
1189 "x" gnus-summary-mark-as-expirable
1190 "?" gnus-summary-mark-as-dormant
1191 "b" gnus-summary-set-bookmark
1192 "B" gnus-summary-remove-bookmark
1193 "#" gnus-summary-mark-as-processable
1194 "\M-#" gnus-summary-unmark-as-processable
1195 "S" gnus-summary-limit-include-expunged
1196 "C" gnus-summary-catchup
1197 "H" gnus-summary-catchup-to-here
1198 "\C-c" gnus-summary-catchup-all
1199 "k" gnus-summary-kill-same-subject-and-select
1200 "K" gnus-summary-kill-same-subject
1201 "P" gnus-uu-mark-map)
1203 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1204 "c" gnus-summary-clear-above
1205 "u" gnus-summary-tick-above
1206 "m" gnus-summary-mark-above
1207 "k" gnus-summary-kill-below)
1209 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1210 "/" gnus-summary-limit-to-subject
1211 "n" gnus-summary-limit-to-articles
1212 "w" gnus-summary-pop-limit
1213 "s" gnus-summary-limit-to-subject
1214 "a" gnus-summary-limit-to-author
1215 "u" gnus-summary-limit-to-unread
1216 "m" gnus-summary-limit-to-marks
1217 "v" gnus-summary-limit-to-score
1218 "D" gnus-summary-limit-include-dormant
1219 "d" gnus-summary-limit-exclude-dormant
1220 "t" gnus-summary-limit-to-age
1221 "E" gnus-summary-limit-include-expunged
1222 "c" gnus-summary-limit-exclude-childless-dormant
1223 "C" gnus-summary-limit-mark-excluded-as-read)
1225 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1226 "n" gnus-summary-next-unread-article
1227 "p" gnus-summary-prev-unread-article
1228 "N" gnus-summary-next-article
1229 "P" gnus-summary-prev-article
1230 "\C-n" gnus-summary-next-same-subject
1231 "\C-p" gnus-summary-prev-same-subject
1232 "\M-n" gnus-summary-next-unread-subject
1233 "\M-p" gnus-summary-prev-unread-subject
1234 "f" gnus-summary-first-unread-article
1235 "b" gnus-summary-best-unread-article
1236 "j" gnus-summary-goto-article
1237 "g" gnus-summary-goto-subject
1238 "l" gnus-summary-goto-last-article
1239 "o" gnus-summary-pop-article)
1241 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1242 "k" gnus-summary-kill-thread
1243 "l" gnus-summary-lower-thread
1244 "i" gnus-summary-raise-thread
1245 "T" gnus-summary-toggle-threads
1246 "t" gnus-summary-rethread-current
1247 "^" gnus-summary-reparent-thread
1248 "s" gnus-summary-show-thread
1249 "S" gnus-summary-show-all-threads
1250 "h" gnus-summary-hide-thread
1251 "H" gnus-summary-hide-all-threads
1252 "n" gnus-summary-next-thread
1253 "p" gnus-summary-prev-thread
1254 "u" gnus-summary-up-thread
1255 "o" gnus-summary-top-thread
1256 "d" gnus-summary-down-thread
1257 "#" gnus-uu-mark-thread
1258 "\M-#" gnus-uu-unmark-thread)
1260 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1261 "g" gnus-summary-prepare
1262 "c" gnus-summary-insert-cached-articles)
1264 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1265 "c" gnus-summary-catchup-and-exit
1266 "C" gnus-summary-catchup-all-and-exit
1267 "E" gnus-summary-exit-no-update
1268 "Q" gnus-summary-exit
1269 "Z" gnus-summary-exit
1270 "n" gnus-summary-catchup-and-goto-next-group
1271 "R" gnus-summary-reselect-current-group
1272 "G" gnus-summary-rescan-group
1273 "N" gnus-summary-next-group
1274 "s" gnus-summary-save-newsrc
1275 "P" gnus-summary-prev-group)
1277 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1278 " " gnus-summary-next-page
1279 "n" gnus-summary-next-page
1280 "\177" gnus-summary-prev-page
1281 [delete] gnus-summary-prev-page
1282 "p" gnus-summary-prev-page
1283 "\r" gnus-summary-scroll-up
1284 "<" gnus-summary-beginning-of-article
1285 ">" gnus-summary-end-of-article
1286 "b" gnus-summary-beginning-of-article
1287 "e" gnus-summary-end-of-article
1288 "^" gnus-summary-refer-parent-article
1289 "r" gnus-summary-refer-parent-article
1290 "R" gnus-summary-refer-references
1291 "g" gnus-summary-show-article
1292 "s" gnus-summary-isearch-article
1293 "P" gnus-summary-print-article)
1295 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1296 "b" gnus-article-add-buttons
1297 "B" gnus-article-add-buttons-to-head
1298 "o" gnus-article-treat-overstrike
1299 "e" gnus-article-emphasize
1300 "w" gnus-article-fill-cited-article
1301 "c" gnus-article-remove-cr
1302 "q" gnus-article-de-quoted-unreadable
1303 "f" gnus-article-display-x-face
1304 "l" gnus-summary-stop-page-breaking
1305 "r" gnus-summary-caesar-message
1306 "t" gnus-article-hide-headers
1307 "v" gnus-summary-verbose-headers
1308 "m" gnus-summary-toggle-mime
1309 "h" gnus-article-treat-html)
1311 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1312 "a" gnus-article-hide
1313 "h" gnus-article-hide-headers
1314 "b" gnus-article-hide-boring-headers
1315 "s" gnus-article-hide-signature
1316 "c" gnus-article-hide-citation
1317 "p" gnus-article-hide-pgp
1318 "P" gnus-article-hide-pem
1319 "\C-c" gnus-article-hide-citation-maybe)
1321 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1322 "a" gnus-article-highlight
1323 "h" gnus-article-highlight-headers
1324 "c" gnus-article-highlight-citation
1325 "s" gnus-article-highlight-signature)
1327 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1328 "z" gnus-article-date-ut
1329 "u" gnus-article-date-ut
1330 "l" gnus-article-date-local
1331 "e" gnus-article-date-lapsed
1332 "o" gnus-article-date-original
1333 "s" gnus-article-date-user)
1335 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1336 "t" gnus-article-remove-trailing-blank-lines
1337 "l" gnus-article-strip-leading-blank-lines
1338 "m" gnus-article-strip-multiple-blank-lines
1339 "a" gnus-article-strip-blank-lines
1340 "s" gnus-article-strip-leading-space)
1342 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1344 "f" gnus-summary-fetch-faq
1345 "d" gnus-summary-describe-group
1346 "h" gnus-summary-describe-briefly
1347 "i" gnus-info-find-node)
1349 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1350 "e" gnus-summary-expire-articles
1351 "\M-\C-e" gnus-summary-expire-articles-now
1352 "\177" gnus-summary-delete-article
1353 [delete] gnus-summary-delete-article
1354 "m" gnus-summary-move-article
1355 "r" gnus-summary-respool-article
1356 "w" gnus-summary-edit-article
1357 "c" gnus-summary-copy-article
1358 "B" gnus-summary-crosspost-article
1359 "q" gnus-summary-respool-query
1360 "i" gnus-summary-import-article
1361 "p" gnus-summary-article-posted-p)
1363 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1364 "o" gnus-summary-save-article
1365 "m" gnus-summary-save-article-mail
1366 "F" gnus-summary-write-article-file
1367 "r" gnus-summary-save-article-rmail
1368 "f" gnus-summary-save-article-file
1369 "b" gnus-summary-save-article-body-file
1370 "h" gnus-summary-save-article-folder
1371 "v" gnus-summary-save-article-vm
1372 "p" gnus-summary-pipe-output
1373 "s" gnus-soup-add-article))
1375 (defun gnus-summary-make-menu-bar ()
1376 (gnus-turn-off-edit-menu 'summary)
1378 (unless (boundp 'gnus-summary-misc-menu)
1381 gnus-summary-kill-menu gnus-summary-mode-map ""
1386 ["Enter score..." gnus-summary-score-entry t]
1387 ["Customize" gnus-score-customize t])
1388 (gnus-make-score-map 'increase)
1389 (gnus-make-score-map 'lower)
1391 ["Kill below" gnus-summary-kill-below t]
1392 ["Mark above" gnus-summary-mark-above t]
1393 ["Tick above" gnus-summary-tick-above t]
1394 ["Clear above" gnus-summary-clear-above t])
1395 ["Current score" gnus-summary-current-score t]
1396 ["Set score" gnus-summary-set-score t]
1397 ["Switch current score file..." gnus-score-change-score-file t]
1398 ["Set mark below..." gnus-score-set-mark-below t]
1399 ["Set expunge below..." gnus-score-set-expunge-below t]
1400 ["Edit current score file" gnus-score-edit-current-scores t]
1401 ["Edit score file" gnus-score-edit-file t]
1402 ["Trace score" gnus-score-find-trace t]
1403 ["Find words" gnus-score-find-favourite-words t]
1404 ["Rescore buffer" gnus-summary-rescore t]
1405 ["Increase score..." gnus-summary-increase-score t]
1406 ["Lower score..." gnus-summary-lower-score t]))))
1409 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1411 :selected (null gnus-score-default-header)]
1412 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1414 :selected (eq gnus-score-default-header 'a)]
1415 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1417 :selected (eq gnus-score-default-header 's)]
1419 (gnus-score-set-default 'gnus-score-default-header 'b)
1421 :selected (eq gnus-score-default-header 'b )]
1423 (gnus-score-set-default 'gnus-score-default-header 'h)
1425 :selected (eq gnus-score-default-header 'h )]
1426 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1428 :selected (eq gnus-score-default-header 'i )]
1429 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1431 :selected (eq gnus-score-default-header 't )]
1433 (gnus-score-set-default 'gnus-score-default-header 'x)
1435 :selected (eq gnus-score-default-header 'x )]
1436 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1438 :selected (eq gnus-score-default-header 'l )]
1439 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1441 :selected (eq gnus-score-default-header 'd )]
1442 ["Followups to author"
1443 (gnus-score-set-default 'gnus-score-default-header 'f)
1445 :selected (eq gnus-score-default-header 'f )])
1447 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1449 :selected (null gnus-score-default-type)]
1450 ;; The `:active' key is commented out in the following,
1451 ;; because the GNU Emacs hack to support radio buttons use
1452 ;; active to indicate which button is selected.
1453 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1455 ;; :active (not (memq gnus-score-default-header '(l d)))
1456 :selected (eq gnus-score-default-type 's)]
1457 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1459 ;; :active (not (memq gnus-score-default-header '(l d)))
1460 :selected (eq gnus-score-default-type 'r)]
1461 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1463 ;; :active (not (memq gnus-score-default-header '(l d)))
1464 :selected (eq gnus-score-default-type 'e)]
1465 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1467 ;; :active (not (memq gnus-score-default-header '(l d)))
1468 :selected (eq gnus-score-default-type 'f)]
1469 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1471 ;; :active (eq (gnus-score-default-header 'd))
1472 :selected (eq gnus-score-default-type 'b)]
1473 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1475 ;; :active (eq (gnus-score-default-header 'd))
1476 :selected (eq gnus-score-default-type 'n)]
1477 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1479 ;; :active (eq (gnus-score-default-header 'd))
1480 :selected (eq gnus-score-default-type 'a)]
1482 (gnus-score-set-default 'gnus-score-default-type '<)
1484 ;; :active (eq (gnus-score-default-header 'l))
1485 :selected (eq gnus-score-default-type '<)]
1487 (gnus-score-set-default 'gnus-score-default-type '=)
1489 ;; :active (eq (gnus-score-default-header 'l))
1490 :selected (eq gnus-score-default-type '=)]
1491 ["Greater than number"
1492 (gnus-score-set-default 'gnus-score-default-type '>)
1494 ;; :active (eq (gnus-score-default-header 'l))
1495 :selected (eq gnus-score-default-type '>)])
1496 ["Default fold" gnus-score-default-fold-toggle
1498 :selected gnus-score-default-fold]
1500 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1502 :selected (null gnus-score-default-duration)]
1504 (gnus-score-set-default 'gnus-score-default-duration 'p)
1506 :selected (eq gnus-score-default-duration 'p)]
1508 (gnus-score-set-default 'gnus-score-default-duration 't)
1510 :selected (eq gnus-score-default-duration 't)]
1512 (gnus-score-set-default 'gnus-score-default-duration 'i)
1514 :selected (eq gnus-score-default-duration 'i)]))
1517 gnus-summary-article-menu gnus-summary-mode-map ""
1520 ["All" gnus-article-hide t]
1521 ["Headers" gnus-article-hide-headers t]
1522 ["Signature" gnus-article-hide-signature t]
1523 ["Citation" gnus-article-hide-citation t]
1524 ["PGP" gnus-article-hide-pgp t]
1525 ["Boring headers" gnus-article-hide-boring-headers t])
1527 ["All" gnus-article-highlight t]
1528 ["Headers" gnus-article-highlight-headers t]
1529 ["Signature" gnus-article-highlight-signature t]
1530 ["Citation" gnus-article-highlight-citation t])
1532 ["Local" gnus-article-date-local t]
1533 ["UT" gnus-article-date-ut t]
1534 ["Original" gnus-article-date-original t]
1535 ["Lapsed" gnus-article-date-lapsed t]
1536 ["User-defined" gnus-article-date-user t])
1539 ["Leading" gnus-article-strip-leading-blank-lines t]
1540 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1541 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1542 ["All of the above" gnus-article-strip-blank-lines t]
1543 ["Leading space" gnus-article-strip-leading-space t])
1544 ["Overstrike" gnus-article-treat-overstrike t]
1545 ["Emphasis" gnus-article-emphasize t]
1546 ["Word wrap" gnus-article-fill-cited-article t]
1547 ["CR" gnus-article-remove-cr t]
1548 ["Show X-Face" gnus-article-display-x-face t]
1549 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1550 ["UnHTMLize" gnus-article-treat-html t]
1551 ["Rot 13" gnus-summary-caesar-message t]
1552 ["Unix pipe" gnus-summary-pipe-message t]
1553 ["Add buttons" gnus-article-add-buttons t]
1554 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1555 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1556 ["Toggle MIME" gnus-summary-toggle-mime t]
1557 ["Verbose header" gnus-summary-verbose-headers t]
1558 ["Toggle header" gnus-summary-toggle-header t])
1560 ["Save in default format" gnus-summary-save-article t]
1561 ["Save in file" gnus-summary-save-article-file t]
1562 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1563 ["Write to file" gnus-summary-write-article-mail t]
1564 ["Save in MH folder" gnus-summary-save-article-folder t]
1565 ["Save in VM folder" gnus-summary-save-article-vm t]
1566 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1567 ["Save body in file" gnus-summary-save-article-body-file t]
1568 ["Pipe through a filter" gnus-summary-pipe-output t]
1569 ["Add to SOUP packet" gnus-soup-add-article t]
1570 ["Print" gnus-summary-print-article t])
1572 ["Respool article..." gnus-summary-respool-article t]
1573 ["Move article..." gnus-summary-move-article
1574 (gnus-check-backend-function
1575 'request-move-article gnus-newsgroup-name)]
1576 ["Copy article..." gnus-summary-copy-article t]
1577 ["Crosspost article..." gnus-summary-crosspost-article
1578 (gnus-check-backend-function
1579 'request-replace-article gnus-newsgroup-name)]
1580 ["Import file..." gnus-summary-import-article t]
1581 ["Check if posted" gnus-summary-article-posted-p t]
1582 ["Edit article" gnus-summary-edit-article
1583 (not (gnus-group-read-only-p))]
1584 ["Delete article" gnus-summary-delete-article
1585 (gnus-check-backend-function
1586 'request-expire-articles gnus-newsgroup-name)]
1587 ["Query respool" gnus-summary-respool-query t]
1588 ["Delete expirable articles" gnus-summary-expire-articles-now
1589 (gnus-check-backend-function
1590 'request-expire-articles gnus-newsgroup-name)])
1592 ["Uudecode" gnus-uu-decode-uu t]
1593 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1594 ["Unshar" gnus-uu-decode-unshar t]
1595 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1596 ["Save" gnus-uu-decode-save t]
1597 ["Binhex" gnus-uu-decode-binhex t]
1598 ["Postscript" gnus-uu-decode-postscript t])
1600 ["Enter article" gnus-cache-enter-article t]
1601 ["Remove article" gnus-cache-remove-article t])
1602 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1603 ["Isearch article..." gnus-summary-isearch-article t]
1604 ["Beginning of the article" gnus-summary-beginning-of-article t]
1605 ["End of the article" gnus-summary-end-of-article t]
1606 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1607 ["Fetch referenced articles" gnus-summary-refer-references t]
1608 ["Fetch article with id..." gnus-summary-refer-article t]
1609 ["Redisplay" gnus-summary-show-article t]))
1612 gnus-summary-thread-menu gnus-summary-mode-map ""
1614 ["Toggle threading" gnus-summary-toggle-threads t]
1615 ["Hide threads" gnus-summary-hide-all-threads t]
1616 ["Show threads" gnus-summary-show-all-threads t]
1617 ["Hide thread" gnus-summary-hide-thread t]
1618 ["Show thread" gnus-summary-show-thread t]
1619 ["Go to next thread" gnus-summary-next-thread t]
1620 ["Go to previous thread" gnus-summary-prev-thread t]
1621 ["Go down thread" gnus-summary-down-thread t]
1622 ["Go up thread" gnus-summary-up-thread t]
1623 ["Top of thread" gnus-summary-top-thread t]
1624 ["Mark thread as read" gnus-summary-kill-thread t]
1625 ["Lower thread score" gnus-summary-lower-thread t]
1626 ["Raise thread score" gnus-summary-raise-thread t]
1627 ["Rethread current" gnus-summary-rethread-current t]
1631 gnus-summary-post-menu gnus-summary-mode-map ""
1633 ["Post an article" gnus-summary-post-news t]
1634 ["Followup" gnus-summary-followup t]
1635 ["Followup and yank" gnus-summary-followup-with-original t]
1636 ["Supersede article" gnus-summary-supersede-article t]
1637 ["Cancel article" gnus-summary-cancel-article t]
1638 ["Reply" gnus-summary-reply t]
1639 ["Reply and yank" gnus-summary-reply-with-original t]
1640 ["Wide reply" gnus-summary-wide-reply t]
1641 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1642 ["Mail forward" gnus-summary-mail-forward t]
1643 ["Post forward" gnus-summary-post-forward t]
1644 ["Digest and mail" gnus-uu-digest-mail-forward t]
1645 ["Digest and post" gnus-uu-digest-post-forward t]
1646 ["Resend message" gnus-summary-resend-message t]
1647 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1648 ["Send a mail" gnus-summary-mail-other-window t]
1649 ["Uuencode and post" gnus-uu-post-news t]
1650 ["Followup via news" gnus-summary-followup-to-mail t]
1651 ["Followup via news and yank"
1652 gnus-summary-followup-to-mail-with-original t]
1654 ;;["Send" gnus-summary-send-draft t]
1655 ;;["Send bounced" gnus-resend-bounced-mail t])
1659 gnus-summary-misc-menu gnus-summary-mode-map ""
1662 ["Mark as read" gnus-summary-mark-as-read-forward t]
1663 ["Mark same subject and select"
1664 gnus-summary-kill-same-subject-and-select t]
1665 ["Mark same subject" gnus-summary-kill-same-subject t]
1666 ["Catchup" gnus-summary-catchup t]
1667 ["Catchup all" gnus-summary-catchup-all t]
1668 ["Catchup to here" gnus-summary-catchup-to-here t]
1669 ["Catchup region" gnus-summary-mark-region-as-read t]
1670 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1672 ["Tick" gnus-summary-tick-article-forward t]
1673 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1674 ["Remove marks" gnus-summary-clear-mark-forward t]
1675 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1676 ["Set bookmark" gnus-summary-set-bookmark t]
1677 ["Remove bookmark" gnus-summary-remove-bookmark t])
1679 ["Marks..." gnus-summary-limit-to-marks t]
1680 ["Subject..." gnus-summary-limit-to-subject t]
1681 ["Author..." gnus-summary-limit-to-author t]
1682 ["Age..." gnus-summary-limit-to-age t]
1683 ["Score" gnus-summary-limit-to-score t]
1684 ["Unread" gnus-summary-limit-to-unread t]
1685 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1686 ["Articles" gnus-summary-limit-to-articles t]
1687 ["Pop limit" gnus-summary-pop-limit t]
1688 ["Show dormant" gnus-summary-limit-include-dormant t]
1689 ["Hide childless dormant"
1690 gnus-summary-limit-exclude-childless-dormant t]
1691 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1692 ["Show expunged" gnus-summary-show-all-expunged t])
1694 ["Set mark" gnus-summary-mark-as-processable t]
1695 ["Remove mark" gnus-summary-unmark-as-processable t]
1696 ["Remove all marks" gnus-summary-unmark-all-processable t]
1697 ["Mark above" gnus-uu-mark-over t]
1698 ["Mark series" gnus-uu-mark-series t]
1699 ["Mark region" gnus-uu-mark-region t]
1700 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1701 ["Mark all" gnus-uu-mark-all t]
1702 ["Mark buffer" gnus-uu-mark-buffer t]
1703 ["Mark sparse" gnus-uu-mark-sparse t]
1704 ["Mark thread" gnus-uu-mark-thread t]
1705 ["Unmark thread" gnus-uu-unmark-thread t]
1706 ("Process Mark Sets"
1707 ["Kill" gnus-summary-kill-process-mark t]
1708 ["Yank" gnus-summary-yank-process-mark
1709 gnus-newsgroup-process-stack]
1710 ["Save" gnus-summary-save-process-mark t]))
1712 ["Page forward" gnus-summary-next-page t]
1713 ["Page backward" gnus-summary-prev-page t]
1714 ["Line forward" gnus-summary-scroll-up t])
1716 ["Next unread article" gnus-summary-next-unread-article t]
1717 ["Previous unread article" gnus-summary-prev-unread-article t]
1718 ["Next article" gnus-summary-next-article t]
1719 ["Previous article" gnus-summary-prev-article t]
1720 ["Next unread subject" gnus-summary-next-unread-subject t]
1721 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1722 ["Next article same subject" gnus-summary-next-same-subject t]
1723 ["Previous article same subject" gnus-summary-prev-same-subject t]
1724 ["First unread article" gnus-summary-first-unread-article t]
1725 ["Best unread article" gnus-summary-best-unread-article t]
1726 ["Go to subject number..." gnus-summary-goto-subject t]
1727 ["Go to article number..." gnus-summary-goto-article t]
1728 ["Go to the last article" gnus-summary-goto-last-article t]
1729 ["Pop article off history" gnus-summary-pop-article t])
1731 ["Sort by number" gnus-summary-sort-by-number t]
1732 ["Sort by author" gnus-summary-sort-by-author t]
1733 ["Sort by subject" gnus-summary-sort-by-subject t]
1734 ["Sort by date" gnus-summary-sort-by-date t]
1735 ["Sort by score" gnus-summary-sort-by-score t]
1736 ["Sort by lines" gnus-summary-sort-by-lines t])
1738 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1739 ["Describe group" gnus-summary-describe-group t]
1740 ["Read manual" gnus-info-find-node t])
1742 ["Pick and read" gnus-pick-mode t]
1743 ["Binary" gnus-binary-mode t])
1745 ["Regenerate" gnus-summary-prepare t]
1746 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1747 ["Toggle threading" gnus-summary-toggle-threads t])
1748 ["Filter articles..." gnus-summary-execute-command t]
1749 ["Run command on subjects..." gnus-summary-universal-argument t]
1750 ["Search articles forward..." gnus-summary-search-article-forward t]
1751 ["Search articles backward..." gnus-summary-search-article-backward t]
1752 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1753 ["Expand window" gnus-summary-expand-window t]
1754 ["Expire expirable articles" gnus-summary-expire-articles
1755 (gnus-check-backend-function
1756 'request-expire-articles gnus-newsgroup-name)]
1757 ["Edit local kill file" gnus-summary-edit-local-kill t]
1758 ["Edit main kill file" gnus-summary-edit-global-kill t]
1760 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1761 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1762 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1763 ["Exit group" gnus-summary-exit t]
1764 ["Exit group without updating" gnus-summary-exit-no-update t]
1765 ["Exit and goto next group" gnus-summary-next-group t]
1766 ["Exit and goto prev group" gnus-summary-prev-group t]
1767 ["Reselect group" gnus-summary-reselect-current-group t]
1768 ["Rescan group" gnus-summary-rescan-group t]
1769 ["Update dribble" gnus-summary-save-newsrc t])))
1771 (run-hooks 'gnus-summary-menu-hook)))
1773 (defun gnus-score-set-default (var value)
1774 "A version of set that updates the GNU Emacs menu-bar."
1776 ;; It is the message that forces the active status to be updated.
1779 (defun gnus-make-score-map (type)
1780 "Make a summary score map of type TYPE."
1783 (let ((headers '(("author" "from" string)
1784 ("subject" "subject" string)
1785 ("article body" "body" string)
1786 ("article head" "head" string)
1787 ("xref" "xref" string)
1788 ("lines" "lines" number)
1789 ("followups to author" "followup" string)))
1790 (types '((number ("less than" <)
1793 (string ("substring" s)
1797 (perms '(("temporary" (current-time-string))
1805 (if (eq type 'lower)
1810 (setq header (car headers))
1816 (let ((ts (cdr (assoc (nth 2 header) types)))
1832 'gnus-summary-score-entry
1834 (if (or (string= (nth 1 header)
1836 (string= (nth 1 header)
1839 (list 'gnus-summary-header
1841 (list 'quote (nth 1 (car ts)))
1842 (list 'gnus-score-default nil)
1848 (list (nreverse outp))))
1851 (list (nreverse outt))))
1853 (setq headers (cdr headers)))
1854 (list (nreverse outh))))))))
1858 (defun gnus-summary-mode (&optional group)
1859 "Major mode for reading articles.
1861 All normal editing commands are switched off.
1862 \\<gnus-summary-mode-map>
1863 Each line in this buffer represents one article. To read an
1864 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1865 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1868 You can also post articles and send mail from this buffer. To
1869 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1870 of an article, type `\\[gnus-summary-reply]'.
1872 There are approx. one gazillion commands you can execute in this
1873 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1875 The following commands are available:
1877 \\{gnus-summary-mode-map}"
1879 (when (gnus-visual-p 'summary-menu 'menu)
1880 (gnus-summary-make-menu-bar))
1881 (kill-all-local-variables)
1882 (gnus-summary-make-local-variables)
1883 (gnus-make-thread-indent-array)
1884 (gnus-simplify-mode-line)
1885 (setq major-mode 'gnus-summary-mode)
1886 (setq mode-name "Summary")
1887 (make-local-variable 'minor-mode-alist)
1888 (use-local-map gnus-summary-mode-map)
1889 (buffer-disable-undo (current-buffer))
1890 (setq buffer-read-only t) ;Disable modification
1891 (setq truncate-lines t)
1892 (setq selective-display t)
1893 (setq selective-display-ellipses t) ;Display `...'
1894 (gnus-summary-set-display-table)
1895 (gnus-set-default-directory)
1896 (setq gnus-newsgroup-name group)
1897 (make-local-variable 'gnus-summary-line-format)
1898 (make-local-variable 'gnus-summary-line-format-spec)
1899 (make-local-variable 'gnus-summary-mark-positions)
1900 (make-local-hook 'post-command-hook)
1901 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1902 (run-hooks 'gnus-summary-mode-hook)
1903 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1904 (gnus-update-summary-mark-positions))
1906 (defun gnus-summary-make-local-variables ()
1907 "Make all the local summary buffer variables."
1908 (let ((locals gnus-summary-local-variables)
1910 (while (setq local (pop locals))
1913 (if (eq (cdr local) 'global)
1914 ;; Copy the global value of the variable.
1915 (setq global (symbol-value (car local)))
1916 ;; Use the value from the list.
1917 (setq global (eval (cdr local))))
1918 (make-local-variable (car local))
1919 (set (car local) global))
1920 ;; Simple nil-valued local variable.
1921 (make-local-variable local)
1924 (defun gnus-summary-clear-local-variables ()
1925 (let ((locals gnus-summary-local-variables))
1927 (if (consp (car locals))
1928 (and (vectorp (caar locals))
1929 (set (caar locals) nil))
1930 (and (vectorp (car locals))
1931 (set (car locals) nil)))
1932 (setq locals (cdr locals)))))
1934 ;; Summary data functions.
1936 (defmacro gnus-data-number (data)
1939 (defmacro gnus-data-set-number (data number)
1940 `(setcar ,data ,number))
1942 (defmacro gnus-data-mark (data)
1945 (defmacro gnus-data-set-mark (data mark)
1946 `(setcar (nthcdr 1 ,data) ,mark))
1948 (defmacro gnus-data-pos (data)
1951 (defmacro gnus-data-set-pos (data pos)
1952 `(setcar (nthcdr 2 ,data) ,pos))
1954 (defmacro gnus-data-header (data)
1957 (defmacro gnus-data-set-header (data header)
1958 `(setf (nth 3 ,data) ,header))
1960 (defmacro gnus-data-level (data)
1963 (defmacro gnus-data-unread-p (data)
1964 `(= (nth 1 ,data) gnus-unread-mark))
1966 (defmacro gnus-data-read-p (data)
1967 `(/= (nth 1 ,data) gnus-unread-mark))
1969 (defmacro gnus-data-pseudo-p (data)
1970 `(consp (nth 3 ,data)))
1972 (defmacro gnus-data-find (number)
1973 `(assq ,number gnus-newsgroup-data))
1975 (defmacro gnus-data-find-list (number &optional data)
1976 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1977 (memq (assq ,number bdata)
1980 (defmacro gnus-data-make (number mark pos header level)
1981 `(list ,number ,mark ,pos ,header ,level))
1983 (defun gnus-data-enter (after-article number mark pos header level offset)
1984 (let ((data (gnus-data-find-list after-article)))
1986 (error "No such article: %d" after-article))
1987 (setcdr data (cons (gnus-data-make number mark pos header level)
1989 (setq gnus-newsgroup-data-reverse nil)
1990 (gnus-data-update-list (cddr data) offset)))
1992 (defun gnus-data-enter-list (after-article list &optional offset)
1994 (let ((data (and after-article (gnus-data-find-list after-article)))
1996 (or data (not after-article) (error "No such article: %d" after-article))
1997 ;; Find the last element in the list to be spliced into the main
2000 (setq list (cdr list)))
2003 (setcdr list gnus-newsgroup-data)
2004 (setq gnus-newsgroup-data ilist)
2006 (gnus-data-update-list (cdr list) offset)))
2007 (setcdr list (cdr data))
2010 (gnus-data-update-list (cdr list) offset)))
2011 (setq gnus-newsgroup-data-reverse nil))))
2013 (defun gnus-data-remove (article &optional offset)
2014 (let ((data gnus-newsgroup-data))
2015 (if (= (gnus-data-number (car data)) article)
2017 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2018 gnus-newsgroup-data-reverse nil)
2020 (gnus-data-update-list gnus-newsgroup-data offset)))
2022 (when (= (gnus-data-number (cadr data)) article)
2023 (setcdr data (cddr data))
2025 (gnus-data-update-list (cdr data) offset))
2027 gnus-newsgroup-data-reverse nil))
2028 (setq data (cdr data))))))
2030 (defmacro gnus-data-list (backward)
2032 (or gnus-newsgroup-data-reverse
2033 (setq gnus-newsgroup-data-reverse
2034 (reverse gnus-newsgroup-data)))
2035 gnus-newsgroup-data))
2037 (defun gnus-data-update-list (data offset)
2038 "Add OFFSET to the POS of all data entries in DATA."
2040 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2041 (setq data (cdr data))))
2043 (defun gnus-data-compute-positions ()
2044 "Compute the positions of all articles."
2045 (let ((data gnus-newsgroup-data)
2048 (when (setq pos (text-property-any
2049 (point-min) (point-max)
2050 'gnus-number (gnus-data-number (car data))))
2051 (gnus-data-set-pos (car data) (+ pos 3)))
2052 (setq data (cdr data)))))
2054 (defun gnus-summary-article-pseudo-p (article)
2055 "Say whether this article is a pseudo article or not."
2056 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2058 (defmacro gnus-summary-article-sparse-p (article)
2059 "Say whether this article is a sparse article or not."
2060 `(memq ,article gnus-newsgroup-sparse))
2062 (defmacro gnus-summary-article-ancient-p (article)
2063 "Say whether this article is a sparse article or not."
2064 `(memq ,article gnus-newsgroup-ancient))
2066 (defun gnus-article-parent-p (number)
2067 "Say whether this article is a parent or not."
2068 (let ((data (gnus-data-find-list number)))
2069 (and (cdr data) ; There has to be an article after...
2070 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2071 (gnus-data-level (nth 1 data))))))
2073 (defun gnus-article-children (number)
2074 "Return a list of all children to NUMBER."
2075 (let* ((data (gnus-data-find-list number))
2076 (level (gnus-data-level (car data)))
2078 (setq data (cdr data))
2080 (= (gnus-data-level (car data)) (1+ level)))
2081 (push (gnus-data-number (car data)) children)
2082 (setq data (cdr data)))
2085 (defmacro gnus-summary-skip-intangible ()
2086 "If the current article is intangible, then jump to a different article."
2087 '(let ((to (get-text-property (point) 'gnus-intangible)))
2088 (and to (gnus-summary-goto-subject to))))
2090 (defmacro gnus-summary-article-intangible-p ()
2091 "Say whether this article is intangible or not."
2092 '(get-text-property (point) 'gnus-intangible))
2094 (defun gnus-article-read-p (article)
2095 "Say whether ARTICLE is read or not."
2096 (not (or (memq article gnus-newsgroup-marked)
2097 (memq article gnus-newsgroup-unreads)
2098 (memq article gnus-newsgroup-unselected)
2099 (memq article gnus-newsgroup-dormant))))
2101 ;; Some summary mode macros.
2103 (defmacro gnus-summary-article-number ()
2104 "The article number of the article on the current line.
2105 If there isn's an article number here, then we return the current
2108 (gnus-summary-skip-intangible)
2109 (or (get-text-property (point) 'gnus-number)
2110 (gnus-summary-last-subject))))
2112 (defmacro gnus-summary-article-header (&optional number)
2113 `(gnus-data-header (gnus-data-find
2114 ,(or number '(gnus-summary-article-number)))))
2116 (defmacro gnus-summary-thread-level (&optional number)
2117 `(if (and (eq gnus-summary-make-false-root 'dummy)
2118 (get-text-property (point) 'gnus-intangible))
2120 (gnus-data-level (gnus-data-find
2121 ,(or number '(gnus-summary-article-number))))))
2123 (defmacro gnus-summary-article-mark (&optional number)
2124 `(gnus-data-mark (gnus-data-find
2125 ,(or number '(gnus-summary-article-number)))))
2127 (defmacro gnus-summary-article-pos (&optional number)
2128 `(gnus-data-pos (gnus-data-find
2129 ,(or number '(gnus-summary-article-number)))))
2131 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2132 (defmacro gnus-summary-article-subject (&optional number)
2133 "Return current subject string or nil if nothing."
2136 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2137 '(gnus-data-header (assq (gnus-summary-article-number)
2138 gnus-newsgroup-data)))))
2141 (mail-header-subject headers))))
2143 (defmacro gnus-summary-article-score (&optional number)
2144 "Return current article score."
2145 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2146 gnus-newsgroup-scored))
2147 gnus-summary-default-score 0))
2149 (defun gnus-summary-article-children (&optional number)
2150 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2151 (level (gnus-data-level (car data)))
2153 (while (and (setq data (cdr data))
2154 (> (setq l (gnus-data-level (car data))) level))
2155 (and (= (1+ level) l)
2156 (push (gnus-data-number (car data))
2158 (nreverse children)))
2160 (defun gnus-summary-article-parent (&optional number)
2161 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2162 (gnus-data-list t)))
2163 (level (gnus-data-level (car data))))
2165 () ; This is a root.
2166 ;; We search until we find an article with a level less than
2167 ;; this one. That function has to be the parent.
2168 (while (and (setq data (cdr data))
2169 (not (< (gnus-data-level (car data)) level))))
2170 (and data (gnus-data-number (car data))))))
2172 (defun gnus-unread-mark-p (mark)
2173 "Say whether MARK is the unread mark."
2174 (= mark gnus-unread-mark))
2176 (defun gnus-read-mark-p (mark)
2177 "Say whether MARK is one of the marks that mark as read.
2178 This is all marks except unread, ticked, dormant, and expirable."
2179 (not (or (= mark gnus-unread-mark)
2180 (= mark gnus-ticked-mark)
2181 (= mark gnus-dormant-mark)
2182 (= mark gnus-expirable-mark))))
2184 (defmacro gnus-article-mark (number)
2186 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2187 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2188 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2189 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2190 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2191 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2192 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2193 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2194 gnus-ancient-mark))))
2196 ;; Saving hidden threads.
2198 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2199 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2201 (defmacro gnus-save-hidden-threads (&rest forms)
2202 "Save hidden threads, eval FORMS, and restore the hidden threads."
2203 (let ((config (make-symbol "config")))
2204 `(let ((,config (gnus-hidden-threads-configuration)))
2208 (gnus-restore-hidden-threads-configuration ,config)))))
2210 (defun gnus-hidden-threads-configuration ()
2211 "Return the current hidden threads configuration."
2214 (goto-char (point-min))
2215 (while (search-forward "\r" nil t)
2216 (push (1- (point)) config))
2219 (defun gnus-restore-hidden-threads-configuration (config)
2220 "Restore hidden threads configuration from CONFIG."
2221 (let (point buffer-read-only)
2222 (while (setq point (pop config))
2223 (when (and (< point (point-max))
2225 (= (following-char) ?\n))
2226 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2228 ;; Various summary mode internalish functions.
2230 (defun gnus-mouse-pick-article (e)
2233 (gnus-summary-next-page nil t))
2235 (defun gnus-summary-set-display-table ()
2236 ;; Change the display table. Odd characters have a tendency to mess
2237 ;; up nicely formatted displays - we make all possible glyphs
2238 ;; display only a single character.
2240 ;; We start from the standard display table, if any.
2241 (let ((table (or (copy-sequence standard-display-table)
2242 (make-display-table)))
2244 ;; Nix out all the control chars...
2245 (while (>= (setq i (1- i)) 0)
2246 (aset table i [??]))
2247 ;; ... but not newline and cr, of course. (cr is necessary for the
2248 ;; selective display).
2249 (aset table ?\n nil)
2250 (aset table ?\r nil)
2251 ;; We nix out any glyphs over 126 that are not set already.
2253 (while (>= (setq i (1- i)) 127)
2254 ;; Only modify if the entry is nil.
2255 (unless (aref table i)
2256 (aset table i [??]))))
2257 (setq buffer-display-table table)))
2259 (defun gnus-summary-setup-buffer (group)
2260 "Initialize summary buffer."
2261 (let ((buffer (concat "*Summary " group "*")))
2262 (if (get-buffer buffer)
2265 (setq gnus-summary-buffer (current-buffer))
2266 (not gnus-newsgroup-prepared))
2267 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2268 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2269 (gnus-add-current-to-buffer-list)
2270 (gnus-summary-mode group)
2272 (gnus-carpal-setup-buffer 'summary))
2273 (unless gnus-single-article-buffer
2274 (make-local-variable 'gnus-article-buffer)
2275 (make-local-variable 'gnus-article-current)
2276 (make-local-variable 'gnus-original-article-buffer))
2277 (setq gnus-newsgroup-name group)
2280 (defun gnus-set-global-variables ()
2281 ;; Set the global equivalents of the summary buffer-local variables
2282 ;; to the latest values they had. These reflect the summary buffer
2283 ;; that was in action when the last article was fetched.
2284 (when (eq major-mode 'gnus-summary-mode)
2285 (setq gnus-summary-buffer (current-buffer))
2286 (let ((name gnus-newsgroup-name)
2287 (marked gnus-newsgroup-marked)
2288 (unread gnus-newsgroup-unreads)
2289 (headers gnus-current-headers)
2290 (data gnus-newsgroup-data)
2291 (summary gnus-summary-buffer)
2292 (article-buffer gnus-article-buffer)
2293 (original gnus-original-article-buffer)
2294 (gac gnus-article-current)
2295 (reffed gnus-reffed-article-number)
2296 (score-file gnus-current-score-file))
2298 (set-buffer gnus-group-buffer)
2299 (setq gnus-newsgroup-name name)
2300 (setq gnus-newsgroup-marked marked)
2301 (setq gnus-newsgroup-unreads unread)
2302 (setq gnus-current-headers headers)
2303 (setq gnus-newsgroup-data data)
2304 (setq gnus-article-current gac)
2305 (setq gnus-summary-buffer summary)
2306 (setq gnus-article-buffer article-buffer)
2307 (setq gnus-original-article-buffer original)
2308 (setq gnus-reffed-article-number reffed)
2309 (setq gnus-current-score-file score-file)
2310 ;; The article buffer also has local variables.
2311 (when (gnus-buffer-live-p gnus-article-buffer)
2312 (set-buffer gnus-article-buffer)
2313 (setq gnus-summary-buffer summary))))))
2315 (defun gnus-summary-article-unread-p (article)
2316 "Say whether ARTICLE is unread or not."
2317 (memq article gnus-newsgroup-unreads))
2319 (defun gnus-summary-first-article-p (&optional article)
2320 "Return whether ARTICLE is the first article in the buffer."
2321 (if (not (setq article (or article (gnus-summary-article-number))))
2323 (eq article (caar gnus-newsgroup-data))))
2325 (defun gnus-summary-last-article-p (&optional article)
2326 "Return whether ARTICLE is the last article in the buffer."
2327 (if (not (setq article (or article (gnus-summary-article-number))))
2328 t ; All non-existent numbers are the last article. :-)
2329 (not (cdr (gnus-data-find-list article)))))
2331 (defun gnus-make-thread-indent-array ()
2333 (unless (and gnus-thread-indent-array
2334 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2335 (setq gnus-thread-indent-array (make-vector 201 "")
2336 gnus-thread-indent-array-level gnus-thread-indent-level)
2338 (aset gnus-thread-indent-array n
2339 (make-string (* n gnus-thread-indent-level) ? ))
2342 (defun gnus-update-summary-mark-positions ()
2343 "Compute where the summary marks are to go."
2345 (when (and gnus-summary-buffer
2346 (get-buffer gnus-summary-buffer)
2347 (buffer-name (get-buffer gnus-summary-buffer)))
2348 (set-buffer gnus-summary-buffer))
2349 (let ((gnus-replied-mark 129)
2350 (gnus-score-below-mark 130)
2351 (gnus-score-over-mark 130)
2352 (gnus-download-mark 131)
2353 (spec gnus-summary-line-format-spec)
2354 thread gnus-visual pos)
2356 (gnus-set-work-buffer)
2357 (let ((gnus-summary-line-format-spec spec)
2358 (gnus-newsgroup-downloadable '((0 . t))))
2359 (gnus-summary-insert-line
2360 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2361 (goto-char (point-min))
2362 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2364 (goto-char (point-min))
2365 (push (cons 'replied (and (search-forward "\201" nil t)
2368 (goto-char (point-min))
2369 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2371 (goto-char (point-min))
2372 (push (cons 'download
2373 (and (search-forward "\203" nil t) (- (point) 2)))
2375 (setq gnus-summary-mark-positions pos))))
2377 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2378 "Insert a dummy root in the summary buffer."
2380 (gnus-add-text-properties
2381 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2382 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2384 (defun gnus-summary-insert-line (gnus-tmp-header
2385 gnus-tmp-level gnus-tmp-current
2386 gnus-tmp-unread gnus-tmp-replied
2387 gnus-tmp-expirable gnus-tmp-subject-or-nil
2388 &optional gnus-tmp-dummy gnus-tmp-score
2390 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2391 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2392 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2393 (gnus-tmp-score-char
2394 (if (or (null gnus-summary-default-score)
2395 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2396 gnus-summary-zcore-fuzz))
2398 (if (< gnus-tmp-score gnus-summary-default-score)
2399 gnus-score-below-mark gnus-score-over-mark)))
2401 (cond (gnus-tmp-process gnus-process-mark)
2402 ((memq gnus-tmp-current gnus-newsgroup-cached)
2404 (gnus-tmp-replied gnus-replied-mark)
2405 ((memq gnus-tmp-current gnus-newsgroup-saved)
2407 (t gnus-unread-mark)))
2408 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2411 ((string-match "<[^>]+> *$" gnus-tmp-from)
2412 (let ((beg (match-beginning 0)))
2413 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2414 (substring gnus-tmp-from (1+ (match-beginning 0))
2415 (1- (match-end 0))))
2416 (substring gnus-tmp-from 0 beg))))
2417 ((string-match "(.+)" gnus-tmp-from)
2418 (substring gnus-tmp-from
2419 (1+ (match-beginning 0)) (1- (match-end 0))))
2421 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2422 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2423 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2424 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2425 (buffer-read-only nil))
2426 (when (string= gnus-tmp-name "")
2427 (setq gnus-tmp-name gnus-tmp-from))
2428 (unless (numberp gnus-tmp-lines)
2429 (setq gnus-tmp-lines 0))
2430 (gnus-put-text-property
2432 (progn (eval gnus-summary-line-format-spec) (point))
2433 'gnus-number gnus-tmp-number)
2434 (when (gnus-visual-p 'summary-highlight 'highlight)
2436 (run-hooks 'gnus-summary-update-hook)
2439 (defun gnus-summary-update-line (&optional dont-update)
2440 ;; Update summary line after change.
2441 (when (and gnus-summary-default-score
2442 (not gnus-summary-inhibit-highlight))
2443 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2444 (article (gnus-summary-article-number))
2445 (score (gnus-summary-article-score article)))
2447 (if (and gnus-summary-mark-below
2448 (< (gnus-summary-article-score)
2449 gnus-summary-mark-below))
2450 ;; This article has a low score, so we mark it as read.
2451 (when (memq article gnus-newsgroup-unreads)
2452 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2453 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2454 ;; This article was previously marked as read on account
2455 ;; of a low score, but now it has risen, so we mark it as
2457 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2458 (gnus-summary-update-mark
2459 (if (or (null gnus-summary-default-score)
2460 (<= (abs (- score gnus-summary-default-score))
2461 gnus-summary-zcore-fuzz))
2463 (if (< score gnus-summary-default-score)
2464 gnus-score-below-mark gnus-score-over-mark))
2466 ;; Do visual highlighting.
2467 (when (gnus-visual-p 'summary-highlight 'highlight)
2468 (run-hooks 'gnus-summary-update-hook)))))
2470 (defvar gnus-tmp-new-adopts nil)
2472 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2473 "Return the number of articles in THREAD.
2474 This may be 0 in some cases -- if none of the articles in
2475 the thread are to be displayed."
2477 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2479 ((not (listp thread))
2481 ((and (consp thread) (cdr thread))
2484 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2487 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2490 (when (and level (zerop level) gnus-tmp-new-adopts)
2493 'gnus-summary-number-of-articles-in-thread
2494 gnus-tmp-new-adopts))))
2496 (if (> number 1) gnus-not-empty-thread-mark
2497 gnus-empty-thread-mark)
2500 (defun gnus-summary-set-local-parameters (group)
2501 "Go through the local params of GROUP and set all variable specs in that list."
2502 (let ((params (gnus-group-find-parameter group))
2505 (setq elem (car params)
2506 params (cdr params))
2507 (and (consp elem) ; Has to be a cons.
2508 (consp (cdr elem)) ; The cdr has to be a list.
2509 (symbolp (car elem)) ; Has to be a symbol in there.
2510 (not (memq (car elem)
2511 '(quit-config to-address to-list to-group)))
2512 (ignore-errors ; So we set it.
2513 (make-local-variable (car elem))
2514 (set (car elem) (eval (nth 1 elem))))))))
2516 (defun gnus-summary-read-group (group &optional show-all no-article
2517 kill-buffer no-display)
2518 "Start reading news in newsgroup GROUP.
2519 If SHOW-ALL is non-nil, already read articles are also listed.
2520 If NO-ARTICLE is non-nil, no article is selected initially.
2521 If NO-DISPLAY, don't generate a summary buffer."
2525 (let ((gnus-auto-select-next nil))
2526 (or (gnus-summary-read-group-1
2527 group show-all no-article
2528 kill-buffer no-display)
2529 (setq show-all nil)))))
2530 (eq gnus-auto-select-next 'quietly))
2531 (set-buffer gnus-group-buffer)
2532 (if (not (equal group (gnus-group-group-name)))
2533 (setq group (gnus-group-group-name))
2537 (defun gnus-summary-read-group-1 (group show-all no-article
2538 kill-buffer no-display)
2539 ;; Killed foreign groups can't be entered.
2540 (when (and (not (gnus-group-native-p group))
2541 (not (gnus-gethash group gnus-newsrc-hashtb)))
2542 (error "Dead non-native groups can't be entered"))
2543 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2544 (let* ((new-group (gnus-summary-setup-buffer group))
2545 (quit-config (gnus-group-quit-config group))
2546 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2548 ;; This summary buffer exists already, so we just select it.
2550 (gnus-set-global-variables)
2552 (gnus-kill-or-deaden-summary kill-buffer))
2553 (gnus-configure-windows 'summary 'force)
2554 (gnus-set-mode-line 'summary)
2555 (gnus-summary-position-point)
2558 ;; We couldn't select this group.
2560 (when (and (eq major-mode 'gnus-summary-mode)
2561 (not (equal (current-buffer) kill-buffer)))
2562 (kill-buffer (current-buffer))
2563 (if (not quit-config)
2565 (set-buffer gnus-group-buffer)
2566 (gnus-group-jump-to-group group)
2567 (gnus-group-next-unread-group 1))
2568 (gnus-handle-ephemeral-exit quit-config)))
2569 (gnus-message 3 "Can't select group")
2571 ;; The user did a `C-g' while prompting for number of articles,
2572 ;; so we exit this group.
2573 ((eq did-select 'quit)
2574 (and (eq major-mode 'gnus-summary-mode)
2575 (not (equal (current-buffer) kill-buffer))
2576 (kill-buffer (current-buffer)))
2578 (gnus-kill-or-deaden-summary kill-buffer))
2579 (if (not quit-config)
2581 (set-buffer gnus-group-buffer)
2582 (gnus-group-jump-to-group group)
2583 (gnus-group-next-unread-group 1)
2584 (gnus-configure-windows 'group 'force))
2585 (gnus-handle-ephemeral-exit quit-config))
2586 ;; Finally signal the quit.
2588 ;; The group was successfully selected.
2590 (gnus-set-global-variables)
2591 ;; Save the active value in effect when the group was entered.
2592 (setq gnus-newsgroup-active
2594 (gnus-active gnus-newsgroup-name)))
2595 ;; You can change the summary buffer in some way with this hook.
2596 (run-hooks 'gnus-select-group-hook)
2597 ;; Set any local variables in the group parameters.
2598 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2599 (gnus-update-format-specifications
2600 nil 'summary 'summary-mode 'summary-dummy)
2601 ;; Do score processing.
2602 (when gnus-use-scoring
2603 (gnus-possibly-score-headers))
2604 ;; Check whether to fill in the gaps in the threads.
2605 (when gnus-build-sparse-threads
2606 (gnus-build-sparse-threads))
2607 ;; Find the initial limit.
2608 (if gnus-show-threads
2610 (let ((gnus-newsgroup-dormant nil))
2611 (gnus-summary-initial-limit show-all))
2612 (gnus-summary-initial-limit show-all))
2613 (setq gnus-newsgroup-limit
2615 (lambda (header) (mail-header-number header))
2616 gnus-newsgroup-headers)))
2617 ;; Generate the summary buffer.
2619 (gnus-summary-prepare))
2620 (when gnus-use-trees
2621 (gnus-tree-open group)
2622 (setq gnus-summary-highlight-line-function
2623 'gnus-tree-highlight-article))
2624 ;; If the summary buffer is empty, but there are some low-scored
2625 ;; articles or some excluded dormants, we include these in the
2627 (when (and (zerop (buffer-size))
2629 (cond (gnus-newsgroup-dormant
2630 (gnus-summary-limit-include-dormant))
2631 ((and gnus-newsgroup-scored show-all)
2632 (gnus-summary-limit-include-expunged t))))
2633 ;; Function `gnus-apply-kill-file' must be called in this hook.
2634 (run-hooks 'gnus-apply-kill-hook)
2635 (if (and (zerop (buffer-size))
2638 ;; This newsgroup is empty.
2639 (gnus-summary-catchup-and-exit nil t)
2640 (gnus-message 6 "No unread news")
2642 (gnus-kill-or-deaden-summary kill-buffer))
2643 ;; Return nil from this function.
2645 ;; Hide conversation thread subtrees. We cannot do this in
2646 ;; gnus-summary-prepare-hook since kill processing may not
2647 ;; work with hidden articles.
2648 (and gnus-show-threads
2649 gnus-thread-hide-subtree
2650 (gnus-summary-hide-all-threads))
2651 ;; Show first unread article if requested.
2652 (if (and (not no-article)
2654 gnus-newsgroup-unreads
2655 gnus-auto-select-first)
2656 (unless (if (eq gnus-auto-select-first 'best)
2657 (gnus-summary-best-unread-article)
2658 (gnus-summary-first-unread-article))
2659 (gnus-configure-windows 'summary))
2660 ;; Don't select any articles, just move point to the first
2661 ;; article in the group.
2662 (goto-char (point-min))
2663 (gnus-summary-position-point)
2664 (gnus-set-mode-line 'summary)
2665 (gnus-configure-windows 'summary 'force))
2667 (gnus-kill-or-deaden-summary kill-buffer))
2668 (when (get-buffer-window gnus-group-buffer t)
2669 ;; Gotta use windows, because recenter does weird stuff if
2670 ;; the current buffer ain't the displayed window.
2671 (let ((owin (selected-window)))
2672 (select-window (get-buffer-window gnus-group-buffer t))
2673 (when (gnus-group-goto-group group)
2675 (select-window owin)))
2676 ;; Mark this buffer as "prepared".
2677 (setq gnus-newsgroup-prepared t)
2680 (defun gnus-summary-prepare ()
2681 "Generate the summary buffer."
2683 (let ((buffer-read-only nil))
2685 (setq gnus-newsgroup-data nil
2686 gnus-newsgroup-data-reverse nil)
2687 (run-hooks 'gnus-summary-generate-hook)
2688 ;; Generate the buffer, either with threads or without.
2689 (when gnus-newsgroup-headers
2690 (gnus-summary-prepare-threads
2691 (if gnus-show-threads
2692 (gnus-sort-gathered-threads
2693 (funcall gnus-summary-thread-gathering-function
2695 (gnus-cut-threads (gnus-make-threads)))))
2696 ;; Unthreaded display.
2697 (gnus-sort-articles gnus-newsgroup-headers))))
2698 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2699 ;; Call hooks for modifying summary buffer.
2700 (goto-char (point-min))
2701 (run-hooks 'gnus-summary-prepare-hook)))
2703 (defsubst gnus-general-simplify-subject (subject)
2704 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2707 ;; Truncate the subject.
2708 ((numberp gnus-summary-gather-subject-limit)
2709 (setq subject (gnus-simplify-subject-re subject))
2710 (if (> (length subject) gnus-summary-gather-subject-limit)
2711 (substring subject 0 gnus-summary-gather-subject-limit)
2713 ;; Fuzzily simplify it.
2714 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2715 (gnus-simplify-subject-fuzzy subject))
2716 ;; Just remove the leading "Re:".
2718 (gnus-simplify-subject-re subject))))
2720 (if (and gnus-summary-gather-exclude-subject
2721 (string-match gnus-summary-gather-exclude-subject subject))
2722 nil ; This article shouldn't be gathered
2725 (defun gnus-summary-simplify-subject-query ()
2726 "Query where the respool algorithm would put this article."
2728 (gnus-set-global-variables)
2729 (gnus-summary-select-article)
2730 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2732 (defun gnus-gather-threads-by-subject (threads)
2733 "Gather threads by looking at Subject headers."
2734 (if (not gnus-summary-make-false-root)
2736 (let ((hashtb (gnus-make-hashtable 1024))
2739 subject hthread whole-subject)
2741 (setq subject (gnus-general-simplify-subject
2742 (setq whole-subject (mail-header-subject
2745 (if (setq hthread (gnus-gethash subject hashtb))
2747 ;; We enter a dummy root into the thread, if we
2748 ;; haven't done that already.
2749 (unless (stringp (caar hthread))
2750 (setcar hthread (list whole-subject (car hthread))))
2751 ;; We add this new gathered thread to this gathered
2753 (setcdr (car hthread)
2754 (nconc (cdar hthread) (list (car threads))))
2755 ;; Remove it from the list of threads.
2756 (setcdr prev (cdr threads))
2757 (setq threads prev))
2758 ;; Enter this thread into the hash table.
2759 (gnus-sethash subject threads hashtb)))
2761 (setq threads (cdr threads)))
2764 (defun gnus-gather-threads-by-references (threads)
2765 "Gather threads by looking at References headers."
2766 (let ((idhashtb (gnus-make-hashtable 1024))
2767 (thhashtb (gnus-make-hashtable 1024))
2770 ids references id gthread gid entered ref)
2772 (when (setq references (mail-header-references (caar threads)))
2773 (setq id (mail-header-id (caar threads))
2774 ids (gnus-split-references references)
2776 (while (setq ref (pop ids))
2777 (setq ids (delete ref ids))
2778 (if (not (setq gid (gnus-gethash ref idhashtb)))
2780 (gnus-sethash ref id idhashtb)
2781 (gnus-sethash id threads thhashtb))
2782 (setq gthread (gnus-gethash gid thhashtb))
2784 ;; We enter a dummy root into the thread, if we
2785 ;; haven't done that already.
2786 (unless (stringp (caar gthread))
2787 (setcar gthread (list (mail-header-subject (caar gthread))
2789 ;; We add this new gathered thread to this gathered
2791 (setcdr (car gthread)
2792 (nconc (cdar gthread) (list (car threads)))))
2793 ;; Add it into the thread hash table.
2794 (gnus-sethash id gthread thhashtb)
2796 ;; Remove it from the list of threads.
2797 (setcdr prev (cdr threads))
2798 (setq threads prev))))
2800 (setq threads (cdr threads)))
2803 (defun gnus-sort-gathered-threads (threads)
2804 "Sort subtreads inside each gathered thread by article number."
2805 (let ((result threads))
2807 (when (stringp (caar threads))
2808 (setcdr (car threads)
2809 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2810 (setq threads (cdr threads)))
2813 (defun gnus-thread-loop-p (root thread)
2814 "Say whether ROOT is in THREAD."
2815 (let ((stack (list thread))
2818 (while (setq thread (pop stack))
2819 (setq th (cdr thread))
2821 (not (eq (caar th) root)))
2824 ;; We have found a loop.
2826 (setcdr thread (delq (car th) (cdr thread)))
2827 (if (boundp (setq ref-dep (intern "none"
2828 gnus-newsgroup-dependencies)))
2829 (setcdr (symbol-value ref-dep)
2830 (nconc (cdr (symbol-value ref-dep))
2832 (set ref-dep (list nil (car th))))
2835 ;; Push all the subthreads onto the stack.
2836 (push (cdr thread) stack)))
2839 (defun gnus-make-threads ()
2840 "Go through the dependency hashtb and find the roots. Return all threads."
2842 (while (catch 'infloop
2845 ;; Deal with self-referencing References loops.
2846 (when (and (car (symbol-value refs))
2853 (car (symbol-value refs)) thread))
2854 (cdr (symbol-value refs)))))))
2857 (unless (car (symbol-value refs))
2858 ;; These threads do not refer back to any other articles,
2859 ;; so they're roots.
2860 (setq threads (append (cdr (symbol-value refs)) threads))))
2861 gnus-newsgroup-dependencies)))
2864 (defun gnus-build-sparse-threads ()
2865 (let ((headers gnus-newsgroup-headers)
2866 (deps gnus-newsgroup-dependencies)
2867 header references generation relations
2868 cthread subject child end pthread relation)
2869 ;; First we create an alist of generations/relations, where
2870 ;; generations is how much we trust the relation, and the relation
2872 (gnus-message 7 "Making sparse threads...")
2874 (nnheader-set-temp-buffer " *gnus sparse threads*")
2875 (while (setq header (pop headers))
2876 (when (and (setq references (mail-header-references header))
2877 (not (string= references "")))
2879 (setq child (mail-header-id header)
2880 subject (mail-header-subject header))
2882 (while (search-backward ">" nil t)
2883 (setq end (1+ (point)))
2884 (when (search-backward "<" nil t)
2885 (push (list (incf generation)
2886 child (setq child (buffer-substring (point) end))
2889 (push (list (1+ generation) child nil subject) relations)
2891 (kill-buffer (current-buffer)))
2892 ;; Sort over trustworthiness.
2893 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2894 (while (setq relation (pop relations))
2895 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2896 (unless (car (symbol-value cthread))
2897 ;; Make this article the parent of these threads.
2898 (setcar (symbol-value cthread)
2899 (vector gnus-reffed-article-number
2903 (or (caddr relation) "") 0 0 "")))
2904 (set cthread (list (vector gnus-reffed-article-number
2906 "" "" (cadr relation)
2907 (or (caddr relation) "") 0 0 ""))))
2908 (push gnus-reffed-article-number gnus-newsgroup-limit)
2909 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2910 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2911 gnus-newsgroup-reads)
2912 (decf gnus-reffed-article-number)
2913 ;; Make this new thread the child of its parent.
2914 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2915 (setcdr (symbol-value pthread)
2916 (nconc (cdr (symbol-value pthread))
2917 (list (symbol-value cthread))))
2918 (set pthread (list nil (symbol-value cthread))))))
2919 (gnus-message 7 "Making sparse threads...done")))
2921 (defun gnus-build-old-threads ()
2922 ;; Look at all the articles that refer back to old articles, and
2923 ;; fetch the headers for the articles that aren't there. This will
2924 ;; build complete threads - if the roots haven't been expired by the
2929 (when (not (car (symbol-value refs)))
2930 (setq heads (cdr (symbol-value refs)))
2932 (if (memq (mail-header-number (caar heads))
2933 gnus-newsgroup-dormant)
2934 (setq heads (cdr heads))
2935 (setq id (symbol-name refs))
2936 (while (and (setq id (gnus-build-get-header id))
2937 (not (car (gnus-gethash
2938 id gnus-newsgroup-dependencies)))))
2939 (setq heads nil)))))
2940 gnus-newsgroup-dependencies)))
2942 (defun gnus-build-get-header (id)
2943 ;; Look through the buffer of NOV lines and find the header to
2944 ;; ID. Enter this line into the dependencies hash table, and return
2945 ;; the id of the parent article (if any).
2946 (let ((deps gnus-newsgroup-dependencies)
2950 (set-buffer nntp-server-buffer)
2951 (let ((case-fold-search nil))
2952 (goto-char (point-min))
2953 (while (and (not found)
2954 (search-forward id nil t))
2956 (setq found (looking-at
2957 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2958 (regexp-quote id))))
2959 (or found (beginning-of-line 2)))
2963 (setq header (gnus-nov-parse-line
2964 (read (current-buffer)) deps))
2965 (gnus-parent-id (mail-header-references header))))))
2967 (let ((number (mail-header-number header)))
2968 (push number gnus-newsgroup-limit)
2969 (push header gnus-newsgroup-headers)
2970 (if (memq number gnus-newsgroup-unselected)
2972 (push number gnus-newsgroup-unreads)
2973 (setq gnus-newsgroup-unselected
2974 (delq number gnus-newsgroup-unselected)))
2975 (push number gnus-newsgroup-ancient)))))))
2977 (defun gnus-summary-update-article-line (article header)
2978 "Update the line for ARTICLE using HEADERS."
2979 (let* ((id (mail-header-id header))
2980 (thread (gnus-id-to-thread id)))
2982 (error "Article in no thread"))
2983 ;; Update the thread.
2984 (setcar thread header)
2985 (gnus-summary-goto-subject article)
2986 (let* ((datal (gnus-data-find-list article))
2988 (length (when (cdr datal)
2989 (- (gnus-data-pos data)
2990 (gnus-data-pos (cadr datal)))))
2991 (buffer-read-only nil)
2992 (level (gnus-summary-thread-level)))
2994 (gnus-summary-insert-line
2995 header level nil (gnus-article-mark article)
2996 (memq article gnus-newsgroup-replied)
2997 (memq article gnus-newsgroup-expirable)
2998 ;; Only insert the Subject string when it's different
2999 ;; from the previous Subject string.
3000 (if (gnus-subject-equal
3002 (mail-header-subject
3005 (gnus-data-find-list
3007 (gnus-data-list t)))))
3008 ;; Error on the side of excessive subjects.
3010 (mail-header-subject header))
3012 (mail-header-subject header))
3013 nil (cdr (assq article gnus-newsgroup-scored))
3014 (memq article gnus-newsgroup-processable))
3016 (gnus-data-update-list
3017 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3019 (defun gnus-summary-update-article (article &optional iheader)
3020 "Update ARTICLE in the summary buffer."
3021 (set-buffer gnus-summary-buffer)
3022 (let* ((header (or iheader (gnus-summary-article-header article)))
3023 (id (mail-header-id header))
3024 (data (gnus-data-find article))
3025 (thread (gnus-id-to-thread id))
3026 (references (mail-header-references header))
3030 (when (and references
3031 (not (equal "" references)))
3034 (buffer-read-only nil)
3036 (number (mail-header-number header))
3039 ;; !!! Should this be in or not?
3041 (setcar thread nil))
3043 (delq thread parent))
3044 (if (gnus-summary-insert-subject id header iheader)
3045 ;; Set the (possibly) new article number in the data structure.
3046 (gnus-data-set-number data (gnus-id-to-article id))
3050 (defun gnus-rebuild-thread (id)
3051 "Rebuild the thread containing ID."
3052 (let ((buffer-read-only nil)
3053 old-pos current thread data)
3054 (if (not gnus-show-threads)
3055 (setq thread (list (car (gnus-id-to-thread id))))
3056 ;; Get the thread this article is part of.
3057 (setq thread (gnus-remove-thread id)))
3058 (setq old-pos (gnus-point-at-bol))
3059 (setq current (save-excursion
3060 (and (zerop (forward-line -1))
3061 (gnus-summary-article-number))))
3062 ;; If this is a gathered thread, we have to go some re-gathering.
3063 (when (stringp (car thread))
3064 (let ((subject (car thread))
3066 (setq thread (cdr thread))
3068 (unless (memq (setq thr (gnus-id-to-thread
3070 (mail-header-id (caar thread)))))
3073 (setq thread (cdr thread)))
3074 ;; We now have all (unique) roots.
3075 (if (= (length roots) 1)
3076 ;; All the loose roots are now one solid root.
3077 (setq thread (car roots))
3078 (setq thread (cons subject (gnus-sort-threads roots))))))
3080 ;; We then insert this thread into the summary buffer.
3081 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3082 (if gnus-show-threads
3083 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3084 (gnus-summary-prepare-unthreaded thread))
3085 (setq data (nreverse gnus-newsgroup-data))
3086 (setq threads gnus-newsgroup-threads))
3087 ;; We splice the new data into the data structure.
3088 (gnus-data-enter-list current data (- (point) old-pos))
3089 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3091 (defun gnus-number-to-header (number)
3092 "Return the header for article NUMBER."
3093 (let ((headers gnus-newsgroup-headers))
3095 (not (= number (mail-header-number (car headers)))))
3100 (defun gnus-parent-headers (headers &optional generation)
3101 "Return the headers of the GENERATIONeth parent of HEADERS."
3103 (setq generation 1))
3106 (while (and parent headers (not (zerop generation)))
3107 (setq references (mail-header-references headers))
3108 (when (and references
3109 (setq parent (gnus-parent-id references))
3110 (setq headers (car (gnus-id-to-thread parent))))
3114 (defun gnus-id-to-thread (id)
3115 "Return the (sub-)thread where ID appears."
3116 (gnus-gethash id gnus-newsgroup-dependencies))
3118 (defun gnus-id-to-article (id)
3119 "Return the article number of ID."
3120 (let ((thread (gnus-id-to-thread id)))
3123 (mail-header-number (car thread)))))
3125 (defun gnus-id-to-header (id)
3126 "Return the article headers of ID."
3127 (car (gnus-id-to-thread id)))
3129 (defun gnus-article-displayed-root-p (article)
3130 "Say whether ARTICLE is a root(ish) article."
3131 (let ((level (gnus-summary-thread-level article))
3132 (refs (mail-header-references (gnus-summary-article-header article)))
3138 ((null (gnus-parent-id refs)) t)
3140 (null (setq particle (gnus-id-to-article
3141 (gnus-parent-id refs))))
3142 (null (gnus-summary-thread-level particle)))))))
3144 (defun gnus-root-id (id)
3145 "Return the id of the root of the thread where ID appears."
3147 (while (and id (setq prev (car (gnus-gethash
3148 id gnus-newsgroup-dependencies))))
3150 id (gnus-parent-id (mail-header-references prev))))
3153 (defun gnus-remove-thread (id &optional dont-remove)
3154 "Remove the thread that has ID in it."
3155 (let ((dep gnus-newsgroup-dependencies)
3156 headers thread last-id)
3157 ;; First go up in this thread until we find the root.
3158 (setq last-id (gnus-root-id id))
3159 (setq headers (list (car (gnus-id-to-thread last-id))
3160 (caadr (gnus-id-to-thread last-id))))
3161 ;; We have now found the real root of this thread. It might have
3162 ;; been gathered into some loose thread, so we have to search
3163 ;; through the threads to find the thread we wanted.
3164 (let ((threads gnus-newsgroup-threads)
3167 (setq sub (car threads))
3168 (if (stringp (car sub))
3169 ;; This is a gathered thread, so we look at the roots
3170 ;; below it to find whether this article is in this
3173 (setq sub (cdr sub))
3175 (when (member (caar sub) headers)
3176 (setq thread (car threads)
3179 (setq sub (cdr sub))))
3180 ;; It's an ordinary thread, so we check it.
3181 (when (eq (car sub) (car headers))
3184 (setq threads (cdr threads)))
3185 ;; If this article is in no thread, then it's a root.
3188 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3189 (setq thread (gnus-gethash last-id dep)))
3192 thread ; We return this thread.
3194 (if (stringp (car thread))
3196 ;; If we use dummy roots, then we have to remove the
3197 ;; dummy root as well.
3198 (when (eq gnus-summary-make-false-root 'dummy)
3200 (gnus-data-compute-positions))
3201 (setq thread (cdr thread))
3203 (gnus-remove-thread-1 (car thread))
3204 (setq thread (cdr thread))))
3205 (gnus-remove-thread-1 thread))))))))
3207 (defun gnus-remove-thread-1 (thread)
3208 "Remove the thread THREAD recursively."
3209 (let ((number (mail-header-number (pop thread)))
3211 (setq thread (reverse thread))
3213 (gnus-remove-thread-1 (pop thread)))
3214 (when (setq d (gnus-data-find number))
3215 (goto-char (gnus-data-pos d))
3218 (- (gnus-point-at-bol)
3220 (1+ (gnus-point-at-eol))
3221 (gnus-delete-line)))))))
3223 (defun gnus-sort-threads (threads)
3225 (if (not gnus-thread-sort-functions)
3227 (gnus-message 7 "Sorting threads...")
3229 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3230 (gnus-message 7 "Sorting threads...done"))))
3232 (defun gnus-sort-articles (articles)
3234 (when gnus-article-sort-functions
3235 (gnus-message 7 "Sorting articles...")
3237 (setq gnus-newsgroup-headers
3238 (sort articles (gnus-make-sort-function
3239 gnus-article-sort-functions)))
3240 (gnus-message 7 "Sorting articles...done"))))
3242 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3243 (defmacro gnus-thread-header (thread)
3244 ;; Return header of first article in THREAD.
3245 ;; Note that THREAD must never, ever be anything else than a variable -
3246 ;; using some other form will lead to serious barfage.
3247 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3248 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3249 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3252 (defsubst gnus-article-sort-by-number (h1 h2)
3253 "Sort articles by article number."
3254 (< (mail-header-number h1)
3255 (mail-header-number h2)))
3257 (defun gnus-thread-sort-by-number (h1 h2)
3258 "Sort threads by root article number."
3259 (gnus-article-sort-by-number
3260 (gnus-thread-header h1) (gnus-thread-header h2)))
3262 (defsubst gnus-article-sort-by-lines (h1 h2)
3263 "Sort articles by article Lines header."
3264 (< (mail-header-lines h1)
3265 (mail-header-lines h2)))
3267 (defun gnus-thread-sort-by-lines (h1 h2)
3268 "Sort threads by root article Lines header."
3269 (gnus-article-sort-by-lines
3270 (gnus-thread-header h1) (gnus-thread-header h2)))
3272 (defsubst gnus-article-sort-by-author (h1 h2)
3273 "Sort articles by root author."
3275 (let ((extract (funcall
3276 gnus-extract-address-components
3277 (mail-header-from h1))))
3278 (or (car extract) (cadr extract) ""))
3279 (let ((extract (funcall
3280 gnus-extract-address-components
3281 (mail-header-from h2))))
3282 (or (car extract) (cadr extract) ""))))
3284 (defun gnus-thread-sort-by-author (h1 h2)
3285 "Sort threads by root author."
3286 (gnus-article-sort-by-author
3287 (gnus-thread-header h1) (gnus-thread-header h2)))
3289 (defsubst gnus-article-sort-by-subject (h1 h2)
3290 "Sort articles by root subject."
3292 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3293 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3295 (defun gnus-thread-sort-by-subject (h1 h2)
3296 "Sort threads by root subject."
3297 (gnus-article-sort-by-subject
3298 (gnus-thread-header h1) (gnus-thread-header h2)))
3300 (defsubst gnus-article-sort-by-date (h1 h2)
3301 "Sort articles by root article date."
3303 (gnus-date-get-time (mail-header-date h1))
3304 (gnus-date-get-time (mail-header-date h2))))
3306 (defun gnus-thread-sort-by-date (h1 h2)
3307 "Sort threads by root article date."
3308 (gnus-article-sort-by-date
3309 (gnus-thread-header h1) (gnus-thread-header h2)))
3311 (defsubst gnus-article-sort-by-score (h1 h2)
3312 "Sort articles by root article score.
3313 Unscored articles will be counted as having a score of zero."
3314 (> (or (cdr (assq (mail-header-number h1)
3315 gnus-newsgroup-scored))
3316 gnus-summary-default-score 0)
3317 (or (cdr (assq (mail-header-number h2)
3318 gnus-newsgroup-scored))
3319 gnus-summary-default-score 0)))
3321 (defun gnus-thread-sort-by-score (h1 h2)
3322 "Sort threads by root article score."
3323 (gnus-article-sort-by-score
3324 (gnus-thread-header h1) (gnus-thread-header h2)))
3326 (defun gnus-thread-sort-by-total-score (h1 h2)
3327 "Sort threads by the sum of all scores in the thread.
3328 Unscored articles will be counted as having a score of zero."
3329 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3331 (defun gnus-thread-total-score (thread)
3332 ;; This function find the total score of THREAD.
3333 (cond ((null thread)
3336 (if (stringp (car thread))
3337 (apply gnus-thread-score-function 0
3338 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3339 (gnus-thread-total-score-1 thread)))
3341 (gnus-thread-total-score-1 (list thread)))))
3343 (defun gnus-thread-total-score-1 (root)
3344 ;; This function find the total score of the thread below ROOT.
3345 (setq root (car root))
3346 (apply gnus-thread-score-function
3348 (mapcar 'gnus-thread-total-score
3349 (cdr (gnus-gethash (mail-header-id root)
3350 gnus-newsgroup-dependencies)))
3351 (when (> (mail-header-number root) 0)
3352 (list (or (cdr (assq (mail-header-number root)
3353 gnus-newsgroup-scored))
3354 gnus-summary-default-score 0))))
3355 (list gnus-summary-default-score)
3358 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3359 (defvar gnus-tmp-prev-subject nil)
3360 (defvar gnus-tmp-false-parent nil)
3361 (defvar gnus-tmp-root-expunged nil)
3362 (defvar gnus-tmp-dummy-line nil)
3364 (defun gnus-summary-prepare-threads (threads)
3365 "Prepare summary buffer from THREADS and indentation LEVEL.
3366 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3367 or a straight list of headers."
3368 (gnus-message 7 "Generating summary...")
3370 (setq gnus-newsgroup-threads threads)
3373 (let ((gnus-tmp-level 0)
3374 (default-score (or gnus-summary-default-score 0))
3375 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3376 thread number subject stack state gnus-tmp-gathered beg-match
3377 new-roots gnus-tmp-new-adopts thread-end
3378 gnus-tmp-header gnus-tmp-unread
3379 gnus-tmp-replied gnus-tmp-subject-or-nil
3380 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3381 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3382 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3384 (setq gnus-tmp-prev-subject nil)
3386 (if (vectorp (car threads))
3387 ;; If this is a straight (sic) list of headers, then a
3388 ;; threaded summary display isn't required, so we just create
3389 ;; an unthreaded one.
3390 (gnus-summary-prepare-unthreaded threads)
3392 ;; Do the threaded display.
3394 (while (or threads stack gnus-tmp-new-adopts new-roots)
3396 (if (and (= gnus-tmp-level 0)
3397 (not (setq gnus-tmp-dummy-line nil))
3400 (not gnus-tmp-false-parent)
3401 (or gnus-tmp-new-adopts new-roots))
3402 (if gnus-tmp-new-adopts
3403 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3404 thread (list (car gnus-tmp-new-adopts))
3405 gnus-tmp-header (caar thread)
3406 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3408 (setq thread (list (car new-roots))
3409 gnus-tmp-header (caar thread)
3410 new-roots (cdr new-roots))))
3413 ;; If there are some threads, we do them before the
3414 ;; threads on the stack.
3415 (setq thread threads
3416 gnus-tmp-header (caar thread))
3417 ;; There were no current threads, so we pop something off
3419 (setq state (car stack)
3420 gnus-tmp-level (car state)
3423 gnus-tmp-header (caar thread))))
3425 (setq gnus-tmp-false-parent nil)
3426 (setq gnus-tmp-root-expunged nil)
3427 (setq thread-end nil)
3429 (if (stringp gnus-tmp-header)
3430 ;; The header is a dummy root.
3432 ((eq gnus-summary-make-false-root 'adopt)
3433 ;; We let the first article adopt the rest.
3434 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3436 (setq gnus-tmp-gathered
3438 (lambda (h) (mail-header-number (car h)))
3441 (setq thread (cons (list (caar thread)
3444 (setq gnus-tmp-level -1
3445 gnus-tmp-false-parent t))
3446 ((eq gnus-summary-make-false-root 'empty)
3447 ;; We print adopted articles with empty subject fields.
3448 (setq gnus-tmp-gathered
3450 (lambda (h) (mail-header-number (car h)))
3453 (setq gnus-tmp-level -1))
3454 ((eq gnus-summary-make-false-root 'dummy)
3455 ;; We remember that we probably want to output a dummy
3457 (setq gnus-tmp-dummy-line gnus-tmp-header)
3458 (setq gnus-tmp-prev-subject gnus-tmp-header))
3460 ;; We do not make a root for the gathered
3461 ;; sub-threads at all.
3462 (setq gnus-tmp-level -1)))
3464 (setq number (mail-header-number gnus-tmp-header)
3465 subject (mail-header-subject gnus-tmp-header))
3468 ;; If the thread has changed subject, we might want to make
3469 ;; this subthread into a root.
3470 ((and (null gnus-thread-ignore-subject)
3471 (not (zerop gnus-tmp-level))
3472 gnus-tmp-prev-subject
3474 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3475 (setq new-roots (nconc new-roots (list (car thread)))
3477 gnus-tmp-header nil))
3478 ;; If the article lies outside the current limit,
3479 ;; then we do not display it.
3480 ((not (memq number gnus-newsgroup-limit))
3481 (setq gnus-tmp-gathered
3483 (lambda (h) (mail-header-number (car h)))
3486 (setq gnus-tmp-new-adopts (if (cdar thread)
3487 (append gnus-tmp-new-adopts
3489 gnus-tmp-new-adopts)
3491 gnus-tmp-header nil)
3492 (when (zerop gnus-tmp-level)
3493 (setq gnus-tmp-root-expunged t)))
3494 ;; Perhaps this article is to be marked as read?
3495 ((and gnus-summary-mark-below
3496 (< (or (cdr (assq number gnus-newsgroup-scored))
3498 gnus-summary-mark-below)
3499 ;; Don't touch sparse articles.
3500 (not (gnus-summary-article-sparse-p number))
3501 (not (gnus-summary-article-ancient-p number)))
3502 (setq gnus-newsgroup-unreads
3503 (delq number gnus-newsgroup-unreads))
3504 (if gnus-newsgroup-auto-expire
3505 (push number gnus-newsgroup-expirable)
3506 (push (cons number gnus-low-score-mark)
3507 gnus-newsgroup-reads))))
3509 (when gnus-tmp-header
3510 ;; We may have an old dummy line to output before this
3512 (when gnus-tmp-dummy-line
3513 (gnus-summary-insert-dummy-line
3514 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3515 (setq gnus-tmp-dummy-line nil))
3517 ;; Compute the mark.
3518 (setq gnus-tmp-unread (gnus-article-mark number))
3520 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3521 gnus-tmp-header gnus-tmp-level)
3522 gnus-newsgroup-data)
3524 ;; Actually insert the line.
3526 gnus-tmp-subject-or-nil
3528 ((and gnus-thread-ignore-subject
3529 gnus-tmp-prev-subject
3530 (not (inline (gnus-subject-equal
3531 gnus-tmp-prev-subject subject))))
3533 ((zerop gnus-tmp-level)
3534 (if (and (eq gnus-summary-make-false-root 'empty)
3535 (memq number gnus-tmp-gathered)
3536 gnus-tmp-prev-subject
3537 (inline (gnus-subject-equal
3538 gnus-tmp-prev-subject subject)))
3539 gnus-summary-same-subject
3541 (t gnus-summary-same-subject)))
3542 (if (and (eq gnus-summary-make-false-root 'adopt)
3543 (= gnus-tmp-level 1)
3544 (memq number gnus-tmp-gathered))
3545 (setq gnus-tmp-opening-bracket ?\<
3546 gnus-tmp-closing-bracket ?\>)
3547 (setq gnus-tmp-opening-bracket ?\[
3548 gnus-tmp-closing-bracket ?\]))
3550 gnus-tmp-indentation
3551 (aref gnus-thread-indent-array gnus-tmp-level)
3552 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3553 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3554 gnus-summary-default-score 0)
3556 (if (or (null gnus-summary-default-score)
3557 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3558 gnus-summary-zcore-fuzz))
3560 (if (< gnus-tmp-score gnus-summary-default-score)
3561 gnus-score-below-mark gnus-score-over-mark))
3563 (cond ((memq number gnus-newsgroup-processable)
3565 ((memq number gnus-newsgroup-cached)
3567 ((memq number gnus-newsgroup-replied)
3569 ((memq number gnus-newsgroup-saved)
3571 (t gnus-unread-mark))
3572 gnus-tmp-from (mail-header-from gnus-tmp-header)
3575 ((string-match "<[^>]+> *$" gnus-tmp-from)
3576 (setq beg-match (match-beginning 0))
3577 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3578 (substring gnus-tmp-from (1+ (match-beginning 0))
3579 (1- (match-end 0))))
3580 (substring gnus-tmp-from 0 beg-match)))
3581 ((string-match "(.+)" gnus-tmp-from)
3582 (substring gnus-tmp-from
3583 (1+ (match-beginning 0)) (1- (match-end 0))))
3585 (when (string= gnus-tmp-name "")
3586 (setq gnus-tmp-name gnus-tmp-from))
3587 (unless (numberp gnus-tmp-lines)
3588 (setq gnus-tmp-lines 0))
3589 (gnus-put-text-property
3591 (progn (eval gnus-summary-line-format-spec) (point))
3592 'gnus-number number)
3595 (run-hooks 'gnus-summary-update-hook)
3598 (setq gnus-tmp-prev-subject subject)))
3600 (when (nth 1 thread)
3601 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3602 (incf gnus-tmp-level)
3603 (setq threads (if thread-end nil (cdar thread)))
3605 (setq gnus-tmp-level 0)))))
3606 (gnus-message 7 "Generating summary...done"))
3608 (defun gnus-summary-prepare-unthreaded (headers)
3609 "Generate an unthreaded summary buffer based on HEADERS."
3610 (let (header number mark)
3615 ;; We may have to root out some bad articles...
3616 (when (memq (setq number (mail-header-number
3617 (setq header (pop headers))))
3618 gnus-newsgroup-limit)
3619 ;; Mark article as read when it has a low score.
3620 (when (and gnus-summary-mark-below
3621 (< (or (cdr (assq number gnus-newsgroup-scored))
3622 gnus-summary-default-score 0)
3623 gnus-summary-mark-below)
3624 (not (gnus-summary-article-ancient-p number)))
3625 (setq gnus-newsgroup-unreads
3626 (delq number gnus-newsgroup-unreads))
3627 (if gnus-newsgroup-auto-expire
3628 (push number gnus-newsgroup-expirable)
3629 (push (cons number gnus-low-score-mark)
3630 gnus-newsgroup-reads)))
3632 (setq mark (gnus-article-mark number))
3633 (push (gnus-data-make number mark (1+ (point)) header 0)
3634 gnus-newsgroup-data)
3635 (gnus-summary-insert-line
3637 mark (memq number gnus-newsgroup-replied)
3638 (memq number gnus-newsgroup-expirable)
3639 (mail-header-subject header) nil
3640 (cdr (assq number gnus-newsgroup-scored))
3641 (memq number gnus-newsgroup-processable))))))
3643 (defun gnus-select-newsgroup (group &optional read-all)
3644 "Select newsgroup GROUP.
3645 If READ-ALL is non-nil, all articles in the group are selected."
3646 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3647 ;;!!! Dirty hack; should be removed.
3648 (gnus-summary-ignore-duplicates
3649 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3651 gnus-summary-ignore-duplicates))
3652 (info (nth 2 entry))
3653 articles fetched-articles cached)
3655 (unless (gnus-check-server
3656 (setq gnus-current-select-method
3657 (gnus-find-method-for-group group)))
3658 (error "Couldn't open server"))
3660 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3661 (gnus-activate-group group) ; Or we can activate it...
3662 (progn ; Or we bug out.
3663 (when (equal major-mode 'gnus-summary-mode)
3664 (kill-buffer (current-buffer)))
3665 (error "Couldn't request group %s: %s"
3666 group (gnus-status-message group))))
3668 (unless (gnus-request-group group t)
3669 (when (equal major-mode 'gnus-summary-mode)
3670 (kill-buffer (current-buffer)))
3671 (error "Couldn't request group %s: %s"
3672 group (gnus-status-message group)))
3674 (setq gnus-newsgroup-name group)
3675 (setq gnus-newsgroup-unselected nil)
3676 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3678 ;; Adjust and set lists of article marks.
3680 (gnus-adjust-marked-articles info))
3682 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3683 (when (gnus-virtual-group-p group)
3684 (setq cached gnus-newsgroup-cached))
3686 (setq gnus-newsgroup-unreads
3687 (gnus-set-difference
3688 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3689 gnus-newsgroup-dormant))
3691 (setq gnus-newsgroup-processable nil)
3693 (gnus-update-read-articles group gnus-newsgroup-unreads)
3694 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3695 (gnus-group-update-group group))
3697 (setq articles (gnus-articles-to-read group read-all))
3701 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3703 ((eq articles 0) nil)
3705 ;; Init the dependencies hash table.
3706 (setq gnus-newsgroup-dependencies
3707 (gnus-make-hashtable (length articles)))
3708 ;; Retrieve the headers and read them in.
3709 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3710 (setq gnus-newsgroup-headers
3712 (setq gnus-headers-retrieved-by
3713 (gnus-retrieve-headers
3714 articles gnus-newsgroup-name
3715 ;; We might want to fetch old headers, but
3716 ;; not if there is only 1 article.
3717 (and gnus-fetch-old-headers
3719 (not (eq gnus-fetch-old-headers 'some))
3720 (not (numberp gnus-fetch-old-headers)))
3721 (> (length articles) 1))))))
3722 (gnus-get-newsgroup-headers-xover
3723 articles nil nil gnus-newsgroup-name t)
3724 (gnus-get-newsgroup-headers)))
3725 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3727 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3729 (setq gnus-newsgroup-cached cached))
3731 ;; Suppress duplicates?
3732 (when gnus-suppress-duplicates
3733 (gnus-dup-suppress-articles))
3735 ;; Set the initial limit.
3736 (setq gnus-newsgroup-limit (copy-sequence articles))
3737 ;; Remove canceled articles from the list of unread articles.
3738 (setq gnus-newsgroup-unreads
3739 (gnus-set-sorted-intersection
3740 gnus-newsgroup-unreads
3741 (setq fetched-articles
3742 (mapcar (lambda (headers) (mail-header-number headers))
3743 gnus-newsgroup-headers))))
3744 ;; Removed marked articles that do not exist.
3745 (gnus-update-missing-marks
3746 (gnus-sorted-complement fetched-articles articles))
3747 ;; Let the Gnus agent mark articles as read.
3749 (gnus-agent-get-undownloaded-list))
3750 ;; We might want to build some more threads first.
3751 (and gnus-fetch-old-headers
3752 (eq gnus-headers-retrieved-by 'nov)
3753 (gnus-build-old-threads))
3754 ;; Check whether auto-expire is to be done in this group.
3755 (setq gnus-newsgroup-auto-expire
3756 (gnus-group-auto-expirable-p group))
3757 ;; Set up the article buffer now, if necessary.
3758 (unless gnus-single-article-buffer
3759 (gnus-article-setup-buffer))
3760 ;; First and last article in this newsgroup.
3761 (when gnus-newsgroup-headers
3762 (setq gnus-newsgroup-begin
3763 (mail-header-number (car gnus-newsgroup-headers))
3766 (gnus-last-element gnus-newsgroup-headers))))
3767 ;; GROUP is successfully selected.
3768 (or gnus-newsgroup-headers t)))))
3770 (defun gnus-articles-to-read (group &optional read-all)
3771 ;; Find out what articles the user wants to read.
3773 ;; Select all articles if `read-all' is non-nil, or if there
3774 ;; are no unread articles.
3776 (and (zerop (length gnus-newsgroup-marked))
3777 (zerop (length gnus-newsgroup-unreads)))
3778 (eq (gnus-group-find-parameter group 'display)
3780 (gnus-uncompress-range (gnus-active group))
3781 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3782 (copy-sequence gnus-newsgroup-unreads))
3784 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3785 (scored (length scored-list))
3786 (number (length articles))
3787 (marked (+ (length gnus-newsgroup-marked)
3788 (length gnus-newsgroup-dormant)))
3796 ((and (or (<= scored marked) (= scored number))
3797 (numberp gnus-large-newsgroup)
3798 (> number gnus-large-newsgroup))
3802 "How many articles from %s (default %d): "
3803 (gnus-limit-string gnus-newsgroup-name 35)
3805 (if (string-match "^[ \t]*$" input) number input)))
3806 ((and (> scored marked) (< scored number)
3807 (> (- scored number) 20))
3810 (format "%s %s (%d scored, %d total): "
3811 "How many articles from"
3812 group scored number))))
3813 (if (string-match "^[ \t]*$" input)
3817 (setq select (if (stringp select) (string-to-number select) select))
3818 (if (or (null select) (zerop select))
3820 (if (and (not (zerop scored)) (<= (abs select) scored))
3822 (setq articles (sort scored-list '<))
3823 (setq number (length articles)))
3824 (setq articles (copy-sequence articles)))
3826 (when (< (abs select) number)
3828 ;; Select the N oldest articles.
3829 (setcdr (nthcdr (1- (abs select)) articles) nil)
3830 ;; Select the N most recent articles.
3831 (setq articles (nthcdr (- number select) articles))))
3832 (setq gnus-newsgroup-unselected
3833 (gnus-sorted-intersection
3834 gnus-newsgroup-unreads
3835 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3838 (defun gnus-killed-articles (killed articles)
3841 (when (inline (gnus-member-of-range (car articles) killed))
3842 (push (car articles) out))
3843 (setq articles (cdr articles)))
3846 (defun gnus-uncompress-marks (marks)
3847 "Uncompress the mark ranges in MARKS."
3848 (let ((uncompressed '(score bookmark))
3851 (if (memq (caar marks) uncompressed)
3852 (push (car marks) out)
3853 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3854 (setq marks (cdr marks)))
3857 (defun gnus-adjust-marked-articles (info)
3858 "Set all article lists and remove all marks that are no longer legal."
3859 (let* ((marked-lists (gnus-info-marks info))
3860 (active (gnus-active (gnus-info-group info)))
3863 (types gnus-article-mark-lists)
3864 (uncompressed '(score bookmark killed))
3865 marks var articles article mark)
3868 (setq marks (pop marked-lists))
3869 (set (setq var (intern (format "gnus-newsgroup-%s"
3870 (car (rassq (setq mark (car marks))
3872 (if (memq (car marks) uncompressed) (cdr marks)
3873 (gnus-uncompress-range (cdr marks))))
3875 (setq articles (symbol-value var))
3877 ;; All articles have to be subsets of the active articles.
3879 ;; Adjust "simple" lists.
3880 ((memq mark '(tick dormant expire reply save))
3882 (when (or (< (setq article (pop articles)) min) (> article max))
3883 (set var (delq article (symbol-value var))))))
3885 ((memq mark uncompressed)
3886 (when (not (listp (cdr (symbol-value var))))
3887 (set var (list (symbol-value var))))
3888 (when (not (listp (cdr articles)))
3889 (setq articles (list articles)))
3891 (when (or (not (consp (setq article (pop articles))))
3892 (< (car article) min)
3893 (> (car article) max))
3894 (set var (delq article (symbol-value var))))))))))
3896 (defun gnus-update-missing-marks (missing)
3897 "Go through the list of MISSING articles and remove them mark lists."
3899 (let ((types gnus-article-mark-lists)
3901 ;; Go through all types.
3903 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3904 (when (symbol-value var)
3905 ;; This list has articles. So we delete all missing articles
3909 (set var (delq (pop m) (symbol-value var)))))))))
3911 (defun gnus-update-marks ()
3912 "Enter the various lists of marked articles into the newsgroup info list."
3913 (let ((types gnus-article-mark-lists)
3914 (info (gnus-get-info gnus-newsgroup-name))
3915 (uncompressed '(score bookmark killed))
3916 type list newmarked symbol)
3918 ;; Add all marks lists that are non-nil to the list of marks lists.
3919 (while (setq type (pop types))
3920 (when (setq list (symbol-value
3922 (intern (format "gnus-newsgroup-%s"
3925 ;; Get rid of the entries of the articles that have the
3927 (when (and (eq (cdr type) 'score)
3931 (prev (cons nil list))
3934 (if (or (not (consp (car arts)))
3935 (= (cdar arts) gnus-summary-default-score))
3936 (setcdr prev (cdr arts))
3938 (setq arts (cdr arts)))
3939 (setq list (cdr all))))
3941 (push (cons (cdr type)
3942 (if (memq (cdr type) uncompressed) list
3943 (gnus-compress-sequence
3944 (set symbol (sort list '<)) t)))
3947 ;; Enter these new marks into the info of the group.
3949 (setcar (nthcdr 3 info) newmarked)
3950 ;; Add the marks lists to the end of the info.
3952 (setcdr (nthcdr 2 info) (list newmarked))))
3954 ;; Cut off the end of the info if there's nothing else there.
3958 (when (nthcdr (decf i) info)
3959 (setcdr (nthcdr i info) nil)))))))
3961 (defun gnus-set-mode-line (where)
3962 "This function sets the mode line of the article or summary buffers.
3963 If WHERE is `summary', the summary mode line format will be used."
3964 ;; Is this mode line one we keep updated?
3965 (when (memq where gnus-updated-mode-lines)
3968 ;; We evaluate this in the summary buffer since these
3969 ;; variables are buffer-local to that buffer.
3970 (set-buffer gnus-summary-buffer)
3971 ;; We bind all these variables that are used in the `eval' form
3973 (let* ((mformat (symbol-value
3975 (format "gnus-%s-mode-line-format-spec" where))))
3976 (gnus-tmp-group-name gnus-newsgroup-name)
3977 (gnus-tmp-article-number (or gnus-current-article 0))
3978 (gnus-tmp-unread gnus-newsgroup-unreads)
3979 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3980 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3981 (gnus-tmp-unread-and-unselected
3982 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3983 (zerop gnus-tmp-unselected))
3985 ((zerop gnus-tmp-unselected)
3986 (format "{%d more}" gnus-tmp-unread-and-unticked))
3987 (t (format "{%d(+%d) more}"
3988 gnus-tmp-unread-and-unticked
3989 gnus-tmp-unselected))))
3991 (if (and gnus-current-headers
3992 (vectorp gnus-current-headers))
3993 (gnus-mode-string-quote
3994 (mail-header-subject gnus-current-headers))
3996 bufname-length max-len
3997 gnus-tmp-header);; passed as argument to any user-format-funcs
3998 (setq mode-string (eval mformat))
3999 (setq bufname-length (if (string-match "%b" mode-string)
4002 (if (eq where 'summary)
4004 (get-buffer gnus-article-buffer))))
4007 (setq max-len (max 4 (if gnus-mode-non-string-length
4009 gnus-mode-non-string-length
4011 (length mode-string))))
4012 ;; We might have to chop a bit of the string off...
4013 (when (> (length mode-string) max-len)
4015 (concat (gnus-truncate-string mode-string (- max-len 3))
4017 ;; Pad the mode string a bit.
4018 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4019 ;; Update the mode line.
4020 (setq mode-line-buffer-identification
4021 (gnus-mode-line-buffer-identification (list mode-string)))
4022 (set-buffer-modified-p t))))
4024 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4025 "Go through the HEADERS list and add all Xrefs to a hash table.
4026 The resulting hash table is returned, or nil if no Xrefs were found."
4027 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4028 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4029 (xref-hashtb (gnus-make-hashtable))
4030 start group entry number xrefs header)
4032 (setq header (pop headers))
4033 (when (and (setq xrefs (mail-header-xref header))
4034 (not (memq (setq number (mail-header-number header))
4037 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4038 (setq start (match-end 0))
4039 (setq group (if prefix
4040 (concat prefix (substring xrefs (match-beginning 1)
4042 (substring xrefs (match-beginning 1) (match-end 1))))
4044 (string-to-int (substring xrefs (match-beginning 2)
4046 (if (setq entry (gnus-gethash group xref-hashtb))
4047 (setcdr entry (cons number (cdr entry)))
4048 (gnus-sethash group (cons number nil) xref-hashtb)))))
4049 (and start xref-hashtb)))
4051 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4052 "Look through all the headers and mark the Xrefs as read."
4053 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4054 name entry info xref-hashtb idlist method nth4)
4056 (set-buffer gnus-group-buffer)
4057 (when (setq xref-hashtb
4058 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4061 (unless (string= from-newsgroup (setq name (symbol-name group)))
4062 (setq idlist (symbol-value group))
4063 ;; Dead groups are not updated.
4065 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4067 (when (stringp (setq nth4 (gnus-info-method info)))
4068 (setq nth4 (gnus-server-to-method nth4))))
4069 ;; Only do the xrefs if the group has the same
4070 ;; select method as the group we have just read.
4071 (or (gnus-methods-equal-p
4072 nth4 (gnus-find-method-for-group from-newsgroup))
4074 (equal nth4 (setq method (gnus-find-method-for-group
4076 (and (equal (car nth4) (car method))
4077 (equal (nth 1 nth4) (nth 1 method))))
4078 gnus-use-cross-reference
4079 (or (not (eq gnus-use-cross-reference t))
4081 ;; Only do cross-references on subscribed
4082 ;; groups, if that is what is wanted.
4083 (<= (gnus-info-level info) gnus-level-subscribed))
4084 (gnus-group-make-articles-read name idlist))))
4087 (defun gnus-compute-read-articles (group articles)
4088 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4089 (info (nth 2 entry))
4090 (active (gnus-active group)))
4092 ;; First peel off all illegal article numbers.
4094 (let ((ids articles)
4096 (while (setq id (pop ids))
4097 (when (and first (> id (cdr active)))
4098 ;; We'll end up in this situation in one particular
4099 ;; obscure situation. If you re-scan a group and get
4100 ;; a new article that is cross-posted to a different
4101 ;; group that has not been re-scanned, you might get
4102 ;; crossposted article that has a higher number than
4103 ;; Gnus believes possible. So we re-activate this
4104 ;; group as well. This might mean doing the
4105 ;; crossposting thingy will *increase* the number
4106 ;; of articles in some groups. Tsk, tsk.
4107 (setq active (or (gnus-activate-group group) active)))
4108 (when (or (> id (cdr active))
4109 (< id (car active)))
4110 (setq articles (delq id articles))))))
4111 ;; If the read list is nil, we init it.
4113 (null (gnus-info-read info))
4115 (setq ninfo (cons 1 (1- (car active))))
4116 (setq ninfo (gnus-info-read info)))
4117 ;; Then we add the read articles to the range.
4119 ninfo (setq articles (sort articles '<))))))
4121 (defun gnus-group-make-articles-read (group articles)
4122 "Update the info of GROUP to say that ARTICLES are read."
4124 (entry (gnus-gethash group gnus-newsrc-hashtb))
4125 (info (nth 2 entry))
4126 (active (gnus-active group))
4129 (setq range (gnus-compute-read-articles group articles))
4131 (set-buffer gnus-group-buffer)
4134 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4135 (gnus-info-set-read ',info ',(gnus-info-read info))
4136 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4137 (gnus-group-update-group ,group t))))
4138 ;; Add the read articles to the range.
4139 (gnus-info-set-read info range)
4140 ;; Then we have to re-compute how many unread
4141 ;; articles there are in this group.
4145 (setq num (- (1+ (cdr active)) (car active))))
4146 ((not (listp (cdr range)))
4147 (setq num (- (cdr active) (- (1+ (cdr range))
4151 (if (numberp (car range))
4153 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4154 (setq range (cdr range)))
4155 (setq num (- (cdr active) num))))
4156 ;; Update the number of unread articles.
4158 ;; Update the group buffer.
4159 (gnus-group-update-group group t)))))
4161 (defun gnus-methods-equal-p (m1 m2)
4162 (let ((m1 (or m1 gnus-select-method))
4163 (m2 (or m2 gnus-select-method)))
4165 (and (eq (car m1) (car m2))
4166 (or (not (memq 'address (assoc (symbol-name (car m1))
4167 gnus-valid-select-methods)))
4168 (equal (nth 1 m1) (nth 1 m2)))))))
4170 (defvar gnus-newsgroup-none-id 0)
4172 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4173 (let ((cur nntp-server-buffer)
4176 (save-excursion (set-buffer gnus-summary-buffer)
4177 gnus-newsgroup-dependencies)))
4178 headers id id-dep ref-dep end ref)
4180 (set-buffer nntp-server-buffer)
4181 ;; Translate all TAB characters into SPACE characters.
4182 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4183 (run-hooks 'gnus-parse-headers-hook)
4184 (let ((case-fold-search t)
4185 in-reply-to header p lines)
4186 (goto-char (point-min))
4187 ;; Search to the beginning of the next header. Error messages
4188 ;; do not begin with 2 or 3.
4189 (while (re-search-forward "^[23][0-9]+ " nil t)
4192 ;; This implementation of this function, with nine
4193 ;; search-forwards instead of the one re-search-forward and
4194 ;; a case (which basically was the old function) is actually
4195 ;; about twice as fast, even though it looks messier. You
4196 ;; can't have everything, I guess. Speed and elegance
4197 ;; doesn't always go hand in hand.
4206 (narrow-to-region (point)
4207 (or (and (search-forward "\n.\n" nil t)
4213 (if (search-forward "\nsubject: " nil t)
4214 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4216 gnus-unstructured-field-decoder (nnheader-header-value))
4221 (if (search-forward "\nfrom: " nil t)
4222 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4224 gnus-structured-field-decoder (nnheader-header-value))
4229 (if (search-forward "\ndate: " nil t)
4230 (nnheader-header-value) ""))
4234 (setq id (if (search-forward "\nmessage-id:" nil t)
4236 (1- (or (search-forward "<" nil t) (point)))
4237 (or (search-forward ">" nil t) (point)))
4238 ;; If there was no message-id, we just fake one
4239 ;; to make subsequent routines simpler.
4240 (nnheader-generate-fake-message-id))))
4244 (if (search-forward "\nreferences: " nil t)
4248 (nnheader-header-value)
4253 (search-backward ">" end t)
4256 (search-backward "<" end t)
4258 ;; Get the references from the in-reply-to header if there
4259 ;; were no references and the in-reply-to header looks
4261 (if (and (search-forward "\nin-reply-to: " nil t)
4262 (setq in-reply-to (nnheader-header-value))
4263 (string-match "<[^>]+>" in-reply-to))
4264 (setq ref (substring in-reply-to (match-beginning 0)
4272 (if (search-forward "\nlines: " nil t)
4273 (if (numberp (setq lines (ignore-errors (read cur))))
4279 (and (search-forward "\nxref: " nil t)
4280 (nnheader-header-value)))))
4281 (when (equal id ref)
4284 (when gnus-alter-header-function
4285 (funcall gnus-alter-header-function header)
4286 (setq id (mail-header-id header)
4287 ref (gnus-parent-id (mail-header-references header))))
4289 ;; We do the threading while we read the headers. The
4290 ;; message-id and the last reference are both entered into
4291 ;; the same hash table. Some tippy-toeing around has to be
4292 ;; done in case an article has arrived before the article
4293 ;; which it refers to.
4294 (if (boundp (setq id-dep (intern id dependencies)))
4295 (if (and (car (symbol-value id-dep))
4297 ;; An article with this Message-ID has already been seen.
4298 (if gnus-summary-ignore-duplicates
4299 ;; We ignore this one, except we add
4300 ;; any additional Xrefs (in case the two articles
4301 ;; came from different servers).
4303 (mail-header-set-xref
4304 (car (symbol-value id-dep))
4305 (concat (or (mail-header-xref
4306 (car (symbol-value id-dep)))
4308 (or (mail-header-xref header) "")))
4310 ;; We rename the Message-ID.
4312 (setq id-dep (intern (setq id (nnmail-message-id))
4315 (mail-header-set-id header id))
4316 (setcar (symbol-value id-dep) header))
4317 (set id-dep (list header)))
4319 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4320 (setcdr (symbol-value ref-dep)
4321 (nconc (cdr (symbol-value ref-dep))
4322 (list (symbol-value id-dep))))
4323 (set ref-dep (list nil (symbol-value id-dep))))
4324 (push header headers))
4325 (goto-char (point-max))
4327 (nreverse headers)))))
4329 ;; The following macros and functions were written by Felix Lee
4330 ;; <flee@cse.psu.edu>.
4332 (defmacro gnus-nov-read-integer ()
4334 (if (= (following-char) ?\t)
4336 (let ((num (ignore-errors (read buffer))))
4337 (if (numberp num) num 0)))
4341 (defmacro gnus-nov-skip-field ()
4342 '(search-forward "\t" eol 'move))
4344 (defmacro gnus-nov-field ()
4345 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4347 ;; (defvar gnus-nov-none-counter 0)
4349 ;; This function has to be called with point after the article number
4350 ;; on the beginning of the line.
4351 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4352 (let ((eol (gnus-point-at-eol))
4353 (buffer (current-buffer))
4354 header ref id id-dep ref-dep)
4356 ;; overview: [num subject from date id refs chars lines misc]
4359 (narrow-to-region (point) eol)
4367 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4369 gnus-structured-field-decoder (gnus-nov-field)) ; from
4370 (gnus-nov-field) ; date
4371 (setq id (or (gnus-nov-field)
4372 (nnheader-generate-fake-message-id))) ; id
4374 (let ((beg (point)))
4375 (search-forward "\t" eol)
4376 (if (search-backward ">" beg t)
4380 (search-backward "<" beg t)))
4383 (gnus-nov-field)) ; refs
4384 (gnus-nov-read-integer) ; chars
4385 (gnus-nov-read-integer) ; lines
4386 (if (= (following-char) ?\n)
4388 (gnus-nov-field))))) ; misc
4392 (when gnus-alter-header-function
4393 (funcall gnus-alter-header-function header)
4394 (setq id (mail-header-id header)
4395 ref (gnus-parent-id (mail-header-references header))))
4397 ;; We build the thread tree.
4398 (when (equal id ref)
4399 ;; This article refers back to itself. Naughty, naughty.
4401 (if (boundp (setq id-dep (intern id dependencies)))
4402 (if (and (car (symbol-value id-dep))
4404 ;; An article with this Message-ID has already been seen.
4405 (if gnus-summary-ignore-duplicates
4406 ;; We ignore this one, except we add any additional
4407 ;; Xrefs (in case the two articles came from different
4410 (mail-header-set-xref
4411 (car (symbol-value id-dep))
4412 (concat (or (mail-header-xref
4413 (car (symbol-value id-dep)))
4415 (or (mail-header-xref header) "")))
4417 ;; We rename the Message-ID.
4419 (setq id-dep (intern (setq id (nnmail-message-id))
4422 (mail-header-set-id header id))
4423 (setcar (symbol-value id-dep) header))
4424 (set id-dep (list header)))
4426 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4427 (setcdr (symbol-value ref-dep)
4428 (nconc (cdr (symbol-value ref-dep))
4429 (list (symbol-value id-dep))))
4430 (set ref-dep (list nil (symbol-value id-dep)))))
4433 ;; Goes through the xover lines and returns a list of vectors
4434 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4435 force-new dependencies
4436 group also-fetch-heads)
4437 "Parse the news overview data in the server buffer, and return a
4438 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4439 ;; Get the Xref when the users reads the articles since most/some
4440 ;; NNTP servers do not include Xrefs when using XOVER.
4441 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4442 (let ((cur nntp-server-buffer)
4443 (dependencies (or dependencies gnus-newsgroup-dependencies))
4444 number headers header)
4446 (set-buffer nntp-server-buffer)
4447 ;; Allow the user to mangle the headers before parsing them.
4448 (run-hooks 'gnus-parse-headers-hook)
4449 (goto-char (point-min))
4452 (while (and sequence (not (eobp)))
4453 (setq number (read cur))
4454 (while (and sequence
4455 (< (car sequence) number))
4456 (setq sequence (cdr sequence)))
4458 (eq number (car sequence))
4460 (setq sequence (cdr sequence))
4461 (setq header (inline
4462 (gnus-nov-parse-line
4463 number dependencies force-new))))
4464 (push header headers))
4467 (gnus-error 4 "Strange nov line (%d)"
4468 (count-lines (point-min) (point)))))
4470 ;; A common bug in inn is that if you have posted an article and
4471 ;; then retrieves the active file, it will answer correctly --
4472 ;; the new article is included. However, a NOV entry for the
4473 ;; article may not have been generated yet, so this may fail.
4474 ;; We work around this problem by retrieving the last few
4475 ;; headers using HEAD.
4476 (if (or (not also-fetch-heads)
4478 ;; We (probably) got all the headers.
4480 (let ((gnus-nov-is-evil t))
4483 (when (gnus-retrieve-headers sequence group)
4484 (gnus-get-newsgroup-headers))))))))
4486 (defun gnus-article-get-xrefs ()
4487 "Fill in the Xref value in `gnus-current-headers', if necessary.
4488 This is meant to be called in `gnus-article-internal-prepare-hook'."
4489 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4490 gnus-current-headers)))
4491 (or (not gnus-use-cross-reference)
4493 (and (mail-header-xref headers)
4494 (not (string= (mail-header-xref headers) "")))
4495 (let ((case-fold-search t)
4498 (nnheader-narrow-to-headers)
4499 (goto-char (point-min))
4500 (when (or (and (eq (downcase (following-char)) ?x)
4501 (looking-at "Xref:"))
4502 (search-forward "\nXref:" nil t))
4503 (goto-char (1+ (match-end 0)))
4504 (setq xref (buffer-substring (point)
4505 (progn (end-of-line) (point))))
4506 (mail-header-set-xref headers xref)))))))
4508 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4509 "Find article ID and insert the summary line for that article."
4510 (let ((header (if (and old-header use-old-header)
4511 old-header (gnus-read-header id)))
4512 (number (and (numberp id) id))
4515 ;; Rebuild the thread that this article is part of and go to the
4516 ;; article we have fetched.
4517 (when (and (not gnus-show-threads)
4519 (when (setq d (gnus-data-find (mail-header-number old-header)))
4520 (goto-char (gnus-data-pos d))
4523 (- (gnus-point-at-bol)
4525 (1+ (gnus-point-at-eol))
4526 (gnus-delete-line))))))
4528 (mail-header-set-number header (mail-header-number old-header)))
4529 (setq gnus-newsgroup-sparse
4530 (delq (setq number (mail-header-number header))
4531 gnus-newsgroup-sparse))
4532 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4533 (gnus-rebuild-thread (mail-header-id header))
4534 (gnus-summary-goto-subject number nil t))
4535 (when (and (numberp number)
4537 ;; We have to update the boundaries even if we can't fetch the
4538 ;; article if ID is a number -- so that the next `P' or `N'
4539 ;; command will fetch the previous (or next) article even
4540 ;; if the one we tried to fetch this time has been canceled.
4541 (when (> number gnus-newsgroup-end)
4542 (setq gnus-newsgroup-end number))
4543 (when (< number gnus-newsgroup-begin)
4544 (setq gnus-newsgroup-begin number))
4545 (setq gnus-newsgroup-unselected
4546 (delq number gnus-newsgroup-unselected)))
4547 ;; Report back a success?
4548 (and header (mail-header-number header))))
4550 ;;; Process/prefix in the summary buffer
4552 (defun gnus-summary-work-articles (n)
4553 "Return a list of articles to be worked upon. The prefix argument,
4554 the list of process marked articles, and the current article will be
4555 taken into consideration."
4558 ;; A numerical prefix has been given.
4559 (setq n (prefix-numeric-value n))
4560 (let ((backward (< n 0))
4561 (n (abs (prefix-numeric-value n)))
4566 (push (setq article (gnus-summary-article-number))
4569 (gnus-summary-find-prev nil article)
4570 (gnus-summary-find-next nil article)))
4572 (nreverse articles)))
4573 ((gnus-region-active-p)
4574 ;; Work on the region between point and mark.
4575 (let ((max (max (point) (mark)))
4578 (goto-char (min (point) (mark)))
4581 (push (setq article (gnus-summary-article-number)) articles)
4582 (gnus-summary-find-next nil article)
4584 (nreverse articles))))
4585 (gnus-newsgroup-processable
4586 ;; There are process-marked articles present.
4587 ;; Save current state.
4588 (gnus-summary-save-process-mark)
4590 (reverse gnus-newsgroup-processable))
4592 ;; Just return the current article.
4593 (list (gnus-summary-article-number)))))
4595 (defun gnus-summary-save-process-mark ()
4596 "Push the current set of process marked articles on the stack."
4598 (push (copy-sequence gnus-newsgroup-processable)
4599 gnus-newsgroup-process-stack))
4601 (defun gnus-summary-kill-process-mark ()
4602 "Push the current set of process marked articles on the stack and unmark."
4604 (gnus-summary-save-process-mark)
4605 (gnus-summary-unmark-all-processable))
4607 (defun gnus-summary-yank-process-mark ()
4608 "Pop the last process mark state off the stack and restore it."
4610 (unless gnus-newsgroup-process-stack
4611 (error "Empty mark stack"))
4612 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4614 (defun gnus-summary-process-mark-set (set)
4615 "Make SET into the current process marked articles."
4616 (gnus-summary-unmark-all-processable)
4618 (gnus-summary-set-process-mark (pop set))))
4620 ;;; Searching and stuff
4622 (defun gnus-summary-search-group (&optional backward use-level)
4623 "Search for next unread newsgroup.
4624 If optional argument BACKWARD is non-nil, search backward instead."
4626 (set-buffer gnus-group-buffer)
4627 (when (gnus-group-search-forward
4628 backward nil (if use-level (gnus-group-group-level) nil))
4629 (gnus-group-group-name))))
4631 (defun gnus-summary-best-group (&optional exclude-group)
4632 "Find the name of the best unread group.
4633 If EXCLUDE-GROUP, do not go to this group."
4635 (set-buffer gnus-group-buffer)
4637 (gnus-group-best-unread-group exclude-group))))
4639 (defun gnus-summary-find-next (&optional unread article backward)
4640 (if backward (gnus-summary-find-prev)
4641 (let* ((dummy (gnus-summary-article-intangible-p))
4642 (article (or article (gnus-summary-article-number)))
4643 (arts (gnus-data-find-list article))
4645 (when (and (not dummy)
4646 (or (not gnus-summary-check-current)
4648 (not (gnus-data-unread-p (car arts)))))
4649 (setq arts (cdr arts)))
4654 (when (gnus-data-unread-p (car arts))
4655 (setq result (car arts)
4657 (setq arts (cdr arts)))
4660 (goto-char (gnus-data-pos result))
4661 (gnus-data-number result)))))
4663 (defun gnus-summary-find-prev (&optional unread article)
4664 (let* ((eobp (eobp))
4665 (article (or article (gnus-summary-article-number)))
4666 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4668 (when (and (not eobp)
4669 (or (not gnus-summary-check-current)
4671 (not (gnus-data-unread-p (car arts)))))
4672 (setq arts (cdr arts)))
4677 (when (gnus-data-unread-p (car arts))
4678 (setq result (car arts)
4680 (setq arts (cdr arts)))
4683 (goto-char (gnus-data-pos result))
4684 (gnus-data-number result))))
4686 (defun gnus-summary-find-subject (subject &optional unread backward article)
4687 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4688 (article (or article (gnus-summary-article-number)))
4689 (articles (gnus-data-list backward))
4690 (arts (gnus-data-find-list article articles))
4692 (when (or (not gnus-summary-check-current)
4694 (not (gnus-data-unread-p (car arts))))
4695 (setq arts (cdr arts)))
4697 (and (or (not unread)
4698 (gnus-data-unread-p (car arts)))
4699 (vectorp (gnus-data-header (car arts)))
4701 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4702 (setq result (car arts)
4704 (setq arts (cdr arts)))
4706 (goto-char (gnus-data-pos result))
4707 (gnus-data-number result))))
4709 (defun gnus-summary-search-forward (&optional unread subject backward)
4710 "Search forward for an article.
4711 If UNREAD, look for unread articles. If SUBJECT, look for
4712 articles with that subject. If BACKWARD, search backward instead."
4713 (cond (subject (gnus-summary-find-subject subject unread backward))
4714 (backward (gnus-summary-find-prev unread))
4715 (t (gnus-summary-find-next unread))))
4717 (defun gnus-recenter (&optional n)
4718 "Center point in window and redisplay frame.
4719 Also do horizontal recentering."
4721 (when (and gnus-auto-center-summary
4722 (not (eq gnus-auto-center-summary 'vertical)))
4723 (gnus-horizontal-recenter))
4726 (defun gnus-summary-recenter ()
4727 "Center point in the summary window.
4728 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4729 displayed, no centering will be performed."
4730 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4731 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4732 (let* ((top (cond ((< (window-height) 4) 0)
4733 ((< (window-height) 7) 1)
4735 (height (1- (window-height)))
4736 (bottom (save-excursion (goto-char (point-max))
4737 (forward-line (- height))
4739 (window (get-buffer-window (current-buffer))))
4740 ;; The user has to want it.
4741 (when gnus-auto-center-summary
4742 (when (get-buffer-window gnus-article-buffer)
4743 ;; Only do recentering when the article buffer is displayed,
4744 ;; Set the window start to either `bottom', which is the biggest
4745 ;; possible valid number, or the second line from the top,
4746 ;; whichever is the least.
4748 window (min bottom (save-excursion
4749 (forward-line (- top)) (point)))))
4750 ;; Do horizontal recentering while we're at it.
4751 (when (and (get-buffer-window (current-buffer) t)
4752 (not (eq gnus-auto-center-summary 'vertical)))
4753 (let ((selected (selected-window)))
4754 (select-window (get-buffer-window (current-buffer) t))
4755 (gnus-summary-position-point)
4756 (gnus-horizontal-recenter)
4757 (select-window selected))))))
4759 (defun gnus-summary-jump-to-group (newsgroup)
4760 "Move point to NEWSGROUP in group mode buffer."
4761 ;; Keep update point of group mode buffer if visible.
4762 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4763 (save-window-excursion
4764 ;; Take care of tree window mode.
4765 (when (get-buffer-window gnus-group-buffer)
4766 (pop-to-buffer gnus-group-buffer))
4767 (gnus-group-jump-to-group newsgroup))
4769 ;; Take care of tree window mode.
4770 (if (get-buffer-window gnus-group-buffer)
4771 (pop-to-buffer gnus-group-buffer)
4772 (set-buffer gnus-group-buffer))
4773 (gnus-group-jump-to-group newsgroup))))
4775 ;; This function returns a list of article numbers based on the
4776 ;; difference between the ranges of read articles in this group and
4777 ;; the range of active articles.
4778 (defun gnus-list-of-unread-articles (group)
4779 (let* ((read (gnus-info-read (gnus-get-info group)))
4780 (active (or (gnus-active group) (gnus-activate-group group)))
4783 ;; If none are read, then all are unread.
4785 (setq first (car active))
4786 ;; If the range of read articles is a single range, then the
4787 ;; first unread article is the article after the last read
4788 ;; article. Sounds logical, doesn't it?
4789 (if (not (listp (cdr read)))
4790 (setq first (1+ (cdr read)))
4791 ;; `read' is a list of ranges.
4792 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4798 (while (< first nlast)
4800 (setq first (1+ first))))
4801 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4802 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4803 (setq read (cdr read)))))
4804 ;; And add the last unread articles.
4805 (while (<= first last)
4807 (setq first (1+ first)))
4808 ;; Return the list of unread articles.
4809 (delq 0 (nreverse unread))))
4811 (defun gnus-list-of-read-articles (group)
4812 "Return a list of unread, unticked and non-dormant articles."
4813 (let* ((info (gnus-get-info group))
4814 (marked (gnus-info-marks info))
4815 (active (gnus-active group)))
4817 (gnus-set-difference
4818 (gnus-sorted-complement
4819 (gnus-uncompress-range active)
4820 (gnus-list-of-unread-articles group))
4822 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4823 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4825 ;; Various summary commands
4827 (defun gnus-summary-universal-argument (arg)
4828 "Perform any operation on all articles that are process/prefixed."
4830 (gnus-set-global-variables)
4831 (let ((articles (gnus-summary-work-articles arg))
4838 (substitute-command-keys
4839 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4842 (gnus-error 1 "Undefined key")
4845 (gnus-summary-goto-subject (setq article (pop articles)))
4846 (let (gnus-newsgroup-processable)
4847 (command-execute func))
4848 (gnus-summary-remove-process-mark article)))))
4849 (gnus-summary-position-point))
4851 (defun gnus-summary-toggle-truncation (&optional arg)
4852 "Toggle truncation of summary lines.
4853 With arg, turn line truncation on iff arg is positive."
4855 (setq truncate-lines
4856 (if (null arg) (not truncate-lines)
4857 (> (prefix-numeric-value arg) 0)))
4860 (defun gnus-summary-reselect-current-group (&optional all rescan)
4861 "Exit and then reselect the current newsgroup.
4862 The prefix argument ALL means to select all articles."
4864 (gnus-set-global-variables)
4865 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4866 (error "Ephemeral groups can't be reselected"))
4867 (let ((current-subject (gnus-summary-article-number))
4868 (group gnus-newsgroup-name))
4869 (setq gnus-newsgroup-begin nil)
4871 ;; We have to adjust the point of group mode buffer because
4872 ;; point was moved to the next unread newsgroup by exiting.
4873 (gnus-summary-jump-to-group group)
4876 (gnus-group-get-new-news-this-group 1)))
4877 (gnus-group-read-group all t)
4878 (gnus-summary-goto-subject current-subject nil t)))
4880 (defun gnus-summary-rescan-group (&optional all)
4881 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4883 (gnus-summary-reselect-current-group all t))
4885 (defun gnus-summary-update-info (&optional non-destructive)
4887 (let ((group gnus-newsgroup-name))
4888 (when gnus-newsgroup-kill-headers
4889 (setq gnus-newsgroup-killed
4890 (gnus-compress-sequence
4892 (gnus-set-sorted-intersection
4893 (gnus-uncompress-range gnus-newsgroup-killed)
4894 (setq gnus-newsgroup-unselected
4895 (sort gnus-newsgroup-unselected '<)))
4896 (setq gnus-newsgroup-unreads
4897 (sort gnus-newsgroup-unreads '<)))
4899 (unless (listp (cdr gnus-newsgroup-killed))
4900 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4901 (let ((headers gnus-newsgroup-headers))
4902 (when (and (not gnus-save-score)
4903 (not non-destructive))
4904 (setq gnus-newsgroup-scored nil))
4905 ;; Set the new ranges of read articles.
4907 (set-buffer gnus-group-buffer)
4908 (gnus-undo-force-boundary))
4909 (gnus-update-read-articles
4910 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4911 ;; Set the current article marks.
4913 ;; Do the cross-ref thing.
4914 (when gnus-use-cross-reference
4915 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4916 ;; Do adaptive scoring, and possibly save score files.
4917 (when gnus-newsgroup-adaptive
4918 (gnus-score-adaptive))
4919 (when gnus-use-scoring
4921 ;; Do not switch windows but change the buffer to work.
4922 (set-buffer gnus-group-buffer)
4923 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4924 (gnus-group-update-group group))))))
4926 (defun gnus-summary-save-newsrc (&optional force)
4927 "Save the current number of read/marked articles in the dribble buffer.
4928 The dribble buffer will then be saved.
4929 If FORCE (the prefix), also save the .newsrc file(s)."
4931 (gnus-summary-update-info t)
4933 (gnus-save-newsrc-file)
4934 (gnus-dribble-save)))
4936 (defun gnus-summary-exit (&optional temporary)
4937 "Exit reading current newsgroup, and then return to group selection mode.
4938 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4940 (gnus-set-global-variables)
4941 (gnus-kill-save-kill-buffer)
4942 (let* ((group gnus-newsgroup-name)
4943 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4946 (buf (current-buffer)))
4947 (run-hooks 'gnus-summary-prepare-exit-hook)
4948 ;; If we have several article buffers, we kill them at exit.
4949 (unless gnus-single-article-buffer
4950 (gnus-kill-buffer gnus-original-article-buffer)
4951 (setq gnus-article-current nil))
4952 (when gnus-use-cache
4953 (gnus-cache-possibly-remove-articles)
4954 (gnus-cache-save-buffers))
4955 (gnus-async-prefetch-remove-group group)
4956 (when gnus-suppress-duplicates
4957 (gnus-dup-enter-articles))
4958 (when gnus-use-trees
4959 (gnus-tree-close group))
4960 ;; Make all changes in this group permanent.
4962 (run-hooks 'gnus-exit-group-hook)
4963 (gnus-summary-update-info))
4964 (gnus-close-group group)
4965 ;; Make sure where we were, and go to next newsgroup.
4966 (set-buffer gnus-group-buffer)
4968 (gnus-group-jump-to-group group))
4969 (run-hooks 'gnus-summary-exit-hook)
4971 (gnus-group-next-unread-group 1))
4972 (setq group-point (point))
4975 ;; If we have several article buffers, we kill them at exit.
4976 (unless gnus-single-article-buffer
4977 (gnus-kill-buffer gnus-article-buffer)
4978 (gnus-kill-buffer gnus-original-article-buffer)
4979 (setq gnus-article-current nil))
4981 (if (not gnus-kill-summary-on-exit)
4982 (gnus-deaden-summary)
4983 ;; We set all buffer-local variables to nil. It is unclear why
4984 ;; this is needed, but if we don't, buffer-local variables are
4985 ;; not garbage-collected, it seems. This would the lead to en
4986 ;; ever-growing Emacs.
4987 (gnus-summary-clear-local-variables)
4988 (when (get-buffer gnus-article-buffer)
4989 (bury-buffer gnus-article-buffer))
4990 ;; We clear the global counterparts of the buffer-local
4991 ;; variables as well, just to be on the safe side.
4992 (set-buffer gnus-group-buffer)
4993 (gnus-summary-clear-local-variables)
4994 ;; Return to group mode buffer.
4995 (when (eq mode 'gnus-summary-mode)
4996 (gnus-kill-buffer buf)))
4997 (setq gnus-current-select-method gnus-select-method)
4998 (pop-to-buffer gnus-group-buffer)
4999 ;; Clear the current group name.
5000 (if (not quit-config)
5002 (goto-char group-point)
5003 (gnus-configure-windows 'group 'force))
5004 (gnus-handle-ephemeral-exit quit-config))
5006 (setq gnus-newsgroup-name nil)))))
5008 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5009 (defun gnus-summary-exit-no-update (&optional no-questions)
5010 "Quit reading current newsgroup without updating read article info."
5012 (gnus-set-global-variables)
5013 (let* ((group gnus-newsgroup-name)
5014 (quit-config (gnus-group-quit-config group)))
5015 (when (or no-questions
5017 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5018 ;; If we have several article buffers, we kill them at exit.
5019 (unless gnus-single-article-buffer
5020 (gnus-kill-buffer gnus-article-buffer)
5021 (gnus-kill-buffer gnus-original-article-buffer)
5022 (setq gnus-article-current nil))
5023 (if (not gnus-kill-summary-on-exit)
5024 (gnus-deaden-summary)
5025 (gnus-close-group group)
5026 (gnus-summary-clear-local-variables)
5027 (set-buffer gnus-group-buffer)
5028 (gnus-summary-clear-local-variables)
5029 (when (get-buffer gnus-summary-buffer)
5030 (kill-buffer gnus-summary-buffer)))
5031 (unless gnus-single-article-buffer
5032 (setq gnus-article-current nil))
5033 (when gnus-use-trees
5034 (gnus-tree-close group))
5035 (gnus-async-prefetch-remove-group group)
5036 (when (get-buffer gnus-article-buffer)
5037 (bury-buffer gnus-article-buffer))
5038 ;; Return to the group buffer.
5039 (gnus-configure-windows 'group 'force)
5040 ;; Clear the current group name.
5041 (setq gnus-newsgroup-name nil)
5042 (when (equal (gnus-group-group-name) group)
5043 (gnus-group-next-unread-group 1))
5045 (gnus-handle-ephemeral-exit quit-config)))))
5047 (defun gnus-handle-ephemeral-exit (quit-config)
5048 "Handle movement when leaving an ephemeral group. The state
5049 which existed when entering the ephemeral is reset."
5050 (if (not (buffer-name (car quit-config)))
5051 (gnus-configure-windows 'group 'force)
5052 (set-buffer (car quit-config))
5053 (cond ((eq major-mode 'gnus-summary-mode)
5054 (gnus-set-global-variables))
5055 ((eq major-mode 'gnus-article-mode)
5057 ;; The `gnus-summary-buffer' variable may point
5058 ;; to the old summary buffer when using a single
5060 (unless (gnus-buffer-live-p gnus-summary-buffer)
5061 (set-buffer gnus-group-buffer))
5062 (set-buffer gnus-summary-buffer)
5063 (gnus-set-global-variables))))
5064 (if (or (eq (cdr quit-config) 'article)
5065 (eq (cdr quit-config) 'pick))
5067 ;; The current article may be from the ephemeral group
5068 ;; thus it is best that we reload this article
5069 (gnus-summary-show-article)
5070 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5071 (gnus-configure-windows 'pick 'force)
5072 (gnus-configure-windows (cdr quit-config) 'force)))
5073 (gnus-configure-windows (cdr quit-config) 'force))
5074 (when (eq major-mode 'gnus-summary-mode)
5075 (gnus-summary-next-subject 1 nil t)
5076 (gnus-summary-recenter)
5077 (gnus-summary-position-point))))
5081 (defvar gnus-dead-summary-mode-map nil)
5083 (unless gnus-dead-summary-mode-map
5084 (setq gnus-dead-summary-mode-map (make-keymap))
5085 (suppress-keymap gnus-dead-summary-mode-map)
5086 (substitute-key-definition
5087 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5088 (let ((keys '("\C-d" "\r" "\177" [delete])))
5090 (define-key gnus-dead-summary-mode-map
5091 (pop keys) 'gnus-summary-wake-up-the-dead))))
5093 (defvar gnus-dead-summary-mode nil
5094 "Minor mode for Gnus summary buffers.")
5096 (defun gnus-dead-summary-mode (&optional arg)
5097 "Minor mode for Gnus summary buffers."
5099 (when (eq major-mode 'gnus-summary-mode)
5100 (make-local-variable 'gnus-dead-summary-mode)
5101 (setq gnus-dead-summary-mode
5102 (if (null arg) (not gnus-dead-summary-mode)
5103 (> (prefix-numeric-value arg) 0)))
5104 (when gnus-dead-summary-mode
5105 (gnus-add-minor-mode
5106 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5108 (defun gnus-deaden-summary ()
5109 "Make the current summary buffer into a dead summary buffer."
5110 ;; Kill any previous dead summary buffer.
5111 (when (and gnus-dead-summary
5112 (buffer-name gnus-dead-summary))
5114 (set-buffer gnus-dead-summary)
5115 (when gnus-dead-summary-mode
5116 (kill-buffer (current-buffer)))))
5117 ;; Make this the current dead summary.
5118 (setq gnus-dead-summary (current-buffer))
5119 (gnus-dead-summary-mode 1)
5120 (let ((name (buffer-name)))
5121 (when (string-match "Summary" name)
5123 (concat (substring name 0 (match-beginning 0)) "Dead "
5124 (substring name (match-beginning 0)))
5127 (defun gnus-kill-or-deaden-summary (buffer)
5128 "Kill or deaden the summary BUFFER."
5129 (when (and (buffer-name buffer)
5130 (not gnus-single-article-buffer))
5133 (gnus-kill-buffer gnus-article-buffer)
5134 (gnus-kill-buffer gnus-original-article-buffer)))
5135 (cond (gnus-kill-summary-on-exit
5136 (when (and gnus-use-trees
5137 (and (get-buffer buffer)
5138 (buffer-name (get-buffer buffer))))
5140 (set-buffer (get-buffer buffer))
5141 (gnus-tree-close gnus-newsgroup-name)))
5142 (gnus-kill-buffer buffer))
5143 ((and (get-buffer buffer)
5144 (buffer-name (get-buffer buffer)))
5147 (gnus-deaden-summary)))))
5149 (defun gnus-summary-wake-up-the-dead (&rest args)
5150 "Wake up the dead summary buffer."
5152 (gnus-dead-summary-mode -1)
5153 (let ((name (buffer-name)))
5154 (when (string-match "Dead " name)
5156 (concat (substring name 0 (match-beginning 0))
5157 (substring name (match-end 0)))
5159 (gnus-message 3 "This dead summary is now alive again"))
5161 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5162 (defun gnus-summary-fetch-faq (&optional faq-dir)
5163 "Fetch the FAQ for the current group.
5164 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5168 (when current-prefix-arg
5170 "Faq dir: " (and (listp gnus-group-faq-directory)
5171 (mapcar (lambda (file) (list file))
5172 gnus-group-faq-directory))))))
5173 (let (gnus-faq-buffer)
5174 (when (setq gnus-faq-buffer
5175 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5176 (gnus-configure-windows 'summary-faq))))
5178 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5179 (defun gnus-summary-describe-group (&optional force)
5180 "Describe the current newsgroup."
5182 (gnus-group-describe-group force gnus-newsgroup-name))
5184 (defun gnus-summary-describe-briefly ()
5185 "Describe summary mode commands briefly."
5188 (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")))
5190 ;; Walking around group mode buffer from summary mode.
5192 (defun gnus-summary-next-group (&optional no-article target-group backward)
5193 "Exit current newsgroup and then select next unread newsgroup.
5194 If prefix argument NO-ARTICLE is non-nil, no article is selected
5195 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5196 previous group instead."
5198 (gnus-set-global-variables)
5199 ;; Stop pre-fetching.
5200 (gnus-async-halt-prefetch)
5201 (let ((current-group gnus-newsgroup-name)
5202 (current-buffer (current-buffer))
5204 ;; First we semi-exit this group to update Xrefs and all variables.
5205 ;; We can't do a real exit, because the window conf must remain
5206 ;; the same in case the user is prompted for info, and we don't
5207 ;; want the window conf to change before that...
5208 (gnus-summary-exit t)
5209 (while (not entered)
5210 ;; Then we find what group we are supposed to enter.
5211 (set-buffer gnus-group-buffer)
5212 (gnus-group-jump-to-group current-group)
5215 (if (eq gnus-keep-same-level 'best)
5216 (gnus-summary-best-group gnus-newsgroup-name)
5217 (gnus-summary-search-group backward gnus-keep-same-level))))
5218 (if (not target-group)
5219 ;; There are no further groups, so we return to the group
5222 (gnus-message 5 "Returning to the group buffer")
5224 (when (gnus-buffer-live-p current-buffer)
5225 (set-buffer current-buffer)
5226 (gnus-summary-exit))
5227 (run-hooks 'gnus-group-no-more-groups-hook))
5228 ;; We try to enter the target group.
5229 (gnus-group-jump-to-group target-group)
5230 (let ((unreads (gnus-group-group-unread)))
5231 (if (and (or (eq t unreads)
5232 (and unreads (not (zerop unreads))))
5233 (gnus-summary-read-group
5234 target-group nil no-article
5235 (and (buffer-name current-buffer) current-buffer)))
5237 (setq current-group target-group
5238 target-group nil)))))))
5240 (defun gnus-summary-prev-group (&optional no-article)
5241 "Exit current newsgroup and then select previous unread newsgroup.
5242 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5244 (gnus-summary-next-group no-article nil t))
5246 ;; Walking around summary lines.
5248 (defun gnus-summary-first-subject (&optional unread)
5249 "Go to the first unread subject.
5250 If UNREAD is non-nil, go to the first unread article.
5251 Returns the article selected or nil if there are no unread articles."
5256 ((null gnus-newsgroup-data)
5257 (gnus-message 3 "No articles in the group")
5259 ;; Pick the first article.
5261 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5262 (gnus-data-number (car gnus-newsgroup-data)))
5263 ;; No unread articles.
5264 ((null gnus-newsgroup-unreads)
5265 (gnus-message 3 "No more unread articles")
5267 ;; Find the first unread article.
5269 (let ((data gnus-newsgroup-data))
5271 (not (gnus-data-unread-p (car data))))
5272 (setq data (cdr data)))
5274 (goto-char (gnus-data-pos (car data)))
5275 (gnus-data-number (car data))))))
5276 (gnus-summary-position-point)))
5278 (defun gnus-summary-next-subject (n &optional unread dont-display)
5279 "Go to next N'th summary line.
5280 If N is negative, go to the previous N'th subject line.
5281 If UNREAD is non-nil, only unread articles are selected.
5282 The difference between N and the actual number of steps taken is
5285 (let ((backward (< n 0))
5289 (gnus-summary-find-prev unread)
5290 (gnus-summary-find-next unread)))
5293 (gnus-message 7 "No more%s articles"
5294 (if unread " unread" "")))
5295 (unless dont-display
5296 (gnus-summary-recenter)
5297 (gnus-summary-position-point))
5300 (defun gnus-summary-next-unread-subject (n)
5301 "Go to next N'th unread summary line."
5303 (gnus-summary-next-subject n t))
5305 (defun gnus-summary-prev-subject (n &optional unread)
5306 "Go to previous N'th summary line.
5307 If optional argument UNREAD is non-nil, only unread article is selected."
5309 (gnus-summary-next-subject (- n) unread))
5311 (defun gnus-summary-prev-unread-subject (n)
5312 "Go to previous N'th unread summary line."
5314 (gnus-summary-next-subject (- n) t))
5316 (defun gnus-summary-goto-subject (article &optional force silent)
5317 "Go the subject line of ARTICLE.
5318 If FORCE, also allow jumping to articles not currently shown."
5319 (interactive "nArticle number: ")
5321 (data (gnus-data-find article)))
5322 ;; We read in the article if we have to.
5325 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5326 (setq data (gnus-data-find article)))
5331 (gnus-message 3 "Can't find article %d" article))
5333 (goto-char (gnus-data-pos data))
5336 ;; Walking around summary lines with displaying articles.
5338 (defun gnus-summary-expand-window (&optional arg)
5339 "Make the summary buffer take up the entire Emacs frame.
5340 Given a prefix, will force an `article' buffer configuration."
5342 (gnus-set-global-variables)
5344 (gnus-configure-windows 'article 'force)
5345 (gnus-configure-windows 'summary 'force)))
5347 (defun gnus-summary-display-article (article &optional all-header)
5348 "Display ARTICLE in article buffer."
5349 (gnus-set-global-variables)
5353 (if gnus-summary-display-article-function
5354 (funcall gnus-summary-display-article-function article all-header)
5355 (gnus-article-prepare article all-header))
5356 (run-hooks 'gnus-select-article-hook)
5357 (when (and gnus-current-article
5358 (not (zerop gnus-current-article)))
5359 (gnus-summary-goto-subject gnus-current-article))
5360 (gnus-summary-recenter)
5361 (when (and gnus-use-trees gnus-show-threads)
5362 (gnus-possibly-generate-tree article)
5363 (gnus-highlight-selected-tree article))
5364 ;; Successfully display article.
5365 (gnus-article-set-window-start
5366 (cdr (assq article gnus-newsgroup-bookmarks))))))
5368 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5369 "Select the current article.
5370 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5371 non-nil, the article will be re-fetched even if it already present in
5372 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5374 ;; Make sure we are in the summary buffer to work around bbdb bug.
5375 (unless (eq major-mode 'gnus-summary-mode)
5376 (set-buffer gnus-summary-buffer))
5377 (let ((article (or article (gnus-summary-article-number)))
5378 (all-headers (not (not all-headers))) ;Must be T or NIL.
5379 gnus-summary-display-article-function
5382 (gnus-summary-article-pseudo-p article)
5383 (error "This is a pseudo-article"))
5386 (set-buffer gnus-summary-buffer)
5387 (if (or (and gnus-single-article-buffer
5388 (or (null gnus-current-article)
5389 (null gnus-article-current)
5390 (null (get-buffer gnus-article-buffer))
5391 (not (eq article (cdr gnus-article-current)))
5392 (not (equal (car gnus-article-current)
5393 gnus-newsgroup-name))))
5394 (and (not gnus-single-article-buffer)
5395 (or (null gnus-current-article)
5396 (not (eq gnus-current-article article))))
5398 ;; The requested article is different from the current article.
5400 (gnus-summary-display-article article all-headers)
5402 (when (or all-headers gnus-show-all-headers)
5403 (gnus-article-show-all-headers))
5406 (gnus-article-set-window-start
5407 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5409 (defun gnus-summary-set-current-mark (&optional current-mark)
5410 "Obsolete function."
5413 (defun gnus-summary-next-article (&optional unread subject backward push)
5414 "Select the next article.
5415 If UNREAD, only unread articles are selected.
5416 If SUBJECT, only articles with SUBJECT are selected.
5417 If BACKWARD, the previous article is selected instead of the next."
5419 (gnus-set-global-variables)
5421 ;; Is there such an article?
5422 ((and (gnus-summary-search-forward unread subject backward)
5423 (or (gnus-summary-display-article (gnus-summary-article-number))
5424 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5425 (gnus-summary-position-point))
5426 ;; If not, we try the first unread, if that is wanted.
5428 gnus-auto-select-same
5429 (gnus-summary-first-unread-article))
5430 (gnus-summary-position-point)
5431 (gnus-message 6 "Wrapped"))
5432 ;; Try to get next/previous article not displayed in this group.
5433 ((and gnus-auto-extend-newsgroup
5434 (not unread) (not subject))
5435 (gnus-summary-goto-article
5436 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5438 ;; Go to next/previous group.
5440 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5441 (gnus-summary-jump-to-group gnus-newsgroup-name))
5442 (let ((cmd last-command-char)
5445 (set-buffer gnus-group-buffer)
5448 (if (eq gnus-keep-same-level 'best)
5449 (gnus-summary-best-group gnus-newsgroup-name)
5450 (gnus-summary-search-group backward gnus-keep-same-level))))
5451 ;; For some reason, the group window gets selected. We change
5453 (select-window (get-buffer-window (current-buffer)))
5454 ;; Select next unread newsgroup automagically.
5456 ((or (not gnus-auto-select-next)
5458 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5459 ((or (eq gnus-auto-select-next 'quietly)
5460 (and (eq gnus-auto-select-next 'slightly-quietly)
5462 (and (eq gnus-auto-select-next 'almost-quietly)
5463 (gnus-summary-last-article-p)))
5465 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5467 (gnus-message 7 "No more%s articles (%s)..."
5468 (if unread " unread" "")
5469 (if group (concat "selecting " group)
5471 (gnus-summary-next-group nil group backward)))
5473 (when (gnus-key-press-event-p last-input-event)
5474 (gnus-summary-walk-group-buffer
5475 gnus-newsgroup-name cmd unread backward point))))))))
5477 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5478 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5479 (?\C-p (gnus-group-prev-unread-group 1))))
5480 (cursor-in-echo-area t)
5481 keve key group ended)
5483 (set-buffer gnus-group-buffer)
5486 (if (eq gnus-keep-same-level 'best)
5487 (gnus-summary-best-group gnus-newsgroup-name)
5488 (gnus-summary-search-group backward gnus-keep-same-level))))
5491 5 "No more%s articles%s" (if unread " unread" "")
5493 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5494 (format " (Type %s for %s [%s])"
5495 (single-key-description cmd) group
5496 (car (gnus-gethash group gnus-newsrc-hashtb)))
5497 (format " (Type %s to exit %s)"
5498 (single-key-description cmd)
5499 gnus-newsgroup-name)))
5500 ;; Confirm auto selection.
5501 (setq key (car (setq keve (gnus-read-event-char))))
5504 ((assq key keystrokes)
5505 (let ((obuf (current-buffer)))
5506 (switch-to-buffer gnus-group-buffer)
5508 (gnus-group-jump-to-group group))
5509 (eval (cadr (assq key keystrokes)))
5510 (setq group (gnus-group-group-name))
5511 (switch-to-buffer obuf))
5515 (gnus-ephemeral-group-p gnus-newsgroup-name))
5517 (gnus-summary-next-group nil group backward)))
5519 (push (cdr keve) unread-command-events))))))
5521 (defun gnus-summary-next-unread-article ()
5522 "Select unread article after current one."
5524 (gnus-summary-next-article
5525 (or (not (eq gnus-summary-goto-unread 'never))
5526 (gnus-summary-last-article-p (gnus-summary-article-number)))
5527 (and gnus-auto-select-same
5528 (gnus-summary-article-subject))))
5530 (defun gnus-summary-prev-article (&optional unread subject)
5531 "Select the article after the current one.
5532 If UNREAD is non-nil, only unread articles are selected."
5534 (gnus-summary-next-article unread subject t))
5536 (defun gnus-summary-prev-unread-article ()
5537 "Select unread article before current one."
5539 (gnus-summary-prev-article
5540 (or (not (eq gnus-summary-goto-unread 'never))
5541 (gnus-summary-first-article-p (gnus-summary-article-number)))
5542 (and gnus-auto-select-same
5543 (gnus-summary-article-subject))))
5545 (defun gnus-summary-next-page (&optional lines circular)
5546 "Show next page of the selected article.
5547 If at the end of the current article, select the next article.
5548 LINES says how many lines should be scrolled up.
5550 If CIRCULAR is non-nil, go to the start of the article instead of
5551 selecting the next article when reaching the end of the current
5554 (setq gnus-summary-buffer (current-buffer))
5555 (gnus-set-global-variables)
5556 (let ((article (gnus-summary-article-number))
5557 (article-window (get-buffer-window gnus-article-buffer t))
5559 (gnus-configure-windows 'article)
5560 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5561 (if (and (eq gnus-summary-goto-unread 'never)
5562 (not (gnus-summary-last-article-p article)))
5563 (gnus-summary-next-article)
5564 (gnus-summary-next-unread-article))
5565 (if (or (null gnus-current-article)
5566 (null gnus-article-current)
5567 (/= article (cdr gnus-article-current))
5568 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5569 ;; Selected subject is different from current article's.
5570 (gnus-summary-display-article article)
5571 (when article-window
5572 (gnus-eval-in-buffer-window gnus-article-buffer
5573 (setq endp (gnus-article-next-page lines)))
5576 (gnus-summary-beginning-of-article))
5578 (gnus-message 3 "End of message"))
5580 (if (and (eq gnus-summary-goto-unread 'never)
5581 (not (gnus-summary-last-article-p article)))
5582 (gnus-summary-next-article)
5583 (gnus-summary-next-unread-article))))))))
5584 (gnus-summary-recenter)
5585 (gnus-summary-position-point)))
5587 (defun gnus-summary-prev-page (&optional lines move)
5588 "Show previous page of selected article.
5589 Argument LINES specifies lines to be scrolled down.
5590 If MOVE, move to the previous unread article if point is at
5591 the beginning of the buffer."
5593 (gnus-set-global-variables)
5594 (let ((article (gnus-summary-article-number))
5595 (article-window (get-buffer-window gnus-article-buffer t))
5597 (gnus-configure-windows 'article)
5598 (if (or (null gnus-current-article)
5599 (null gnus-article-current)
5600 (/= article (cdr gnus-article-current))
5601 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5602 ;; Selected subject is different from current article's.
5603 (gnus-summary-display-article article)
5604 (gnus-summary-recenter)
5605 (when article-window
5606 (gnus-eval-in-buffer-window gnus-article-buffer
5607 (setq endp (gnus-article-prev-page lines)))
5608 (when (and move endp)
5610 (gnus-message 3 "Beginning of message"))
5612 (if (and (eq gnus-summary-goto-unread 'never)
5613 (not (gnus-summary-first-article-p article)))
5614 (gnus-summary-prev-article)
5615 (gnus-summary-prev-unread-article))))))))
5616 (gnus-summary-position-point))
5618 (defun gnus-summary-prev-page-or-article (&optional lines)
5619 "Show previous page of selected article.
5620 Argument LINES specifies lines to be scrolled down.
5621 If at the beginning of the article, go to the next article."
5623 (gnus-summary-prev-page lines t))
5625 (defun gnus-summary-scroll-up (lines)
5626 "Scroll up (or down) one line current article.
5627 Argument LINES specifies lines to be scrolled up (or down if negative)."
5629 (gnus-set-global-variables)
5630 (gnus-configure-windows 'article)
5631 (gnus-summary-show-thread)
5632 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5633 (gnus-eval-in-buffer-window gnus-article-buffer
5635 (when (gnus-article-next-page lines)
5636 (gnus-message 3 "End of message")))
5638 (gnus-article-prev-page (- lines))))))
5639 (gnus-summary-recenter)
5640 (gnus-summary-position-point))
5642 (defun gnus-summary-next-same-subject ()
5643 "Select next article which has the same subject as current one."
5645 (gnus-set-global-variables)
5646 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5648 (defun gnus-summary-prev-same-subject ()
5649 "Select previous article which has the same subject as current one."
5651 (gnus-set-global-variables)
5652 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5654 (defun gnus-summary-next-unread-same-subject ()
5655 "Select next unread article which has the same subject as current one."
5657 (gnus-set-global-variables)
5658 (gnus-summary-next-article t (gnus-summary-article-subject)))
5660 (defun gnus-summary-prev-unread-same-subject ()
5661 "Select previous unread article which has the same subject as current one."
5663 (gnus-set-global-variables)
5664 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5666 (defun gnus-summary-first-unread-article ()
5667 "Select the first unread article.
5668 Return nil if there are no unread articles."
5670 (gnus-set-global-variables)
5672 (when (gnus-summary-first-subject t)
5673 (gnus-summary-show-thread)
5674 (gnus-summary-first-subject t)
5675 (gnus-summary-display-article (gnus-summary-article-number)))
5676 (gnus-summary-position-point)))
5678 (defun gnus-summary-first-article ()
5679 "Select the first article.
5680 Return nil if there are no articles."
5682 (gnus-set-global-variables)
5684 (when (gnus-summary-first-subject)
5685 (gnus-summary-show-thread)
5686 (gnus-summary-first-subject)
5687 (gnus-summary-display-article (gnus-summary-article-number)))
5688 (gnus-summary-position-point)))
5690 (defun gnus-summary-best-unread-article ()
5691 "Select the unread article with the highest score."
5693 (gnus-set-global-variables)
5694 (let ((best -1000000)
5695 (data gnus-newsgroup-data)
5698 (and (gnus-data-unread-p (car data))
5700 (gnus-summary-article-score (gnus-data-number (car data))))
5703 article (gnus-data-number (car data))))
5704 (setq data (cdr data)))
5707 (gnus-summary-goto-article article)
5708 (error "No unread articles"))
5709 (gnus-summary-position-point))))
5711 (defun gnus-summary-last-subject ()
5712 "Go to the last displayed subject line in the group."
5713 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5715 (gnus-summary-goto-subject article))))
5717 (defun gnus-summary-goto-article (article &optional all-headers force)
5718 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5719 If ALL-HEADERS is non-nil, no header lines are hidden."
5723 "Article number or Message-ID: "
5724 (mapcar (lambda (number) (list (int-to-string number)))
5725 gnus-newsgroup-limit))
5729 (if (and (stringp article)
5730 (string-match "@" article))
5731 (gnus-summary-refer-article article)
5732 (when (stringp article)
5733 (setq article (string-to-number article)))
5734 (if (gnus-summary-goto-subject article force)
5735 (gnus-summary-display-article article all-headers)
5736 (gnus-message 4 "Couldn't go to article %s" article) nil))
5737 (gnus-summary-position-point)))
5739 (defun gnus-summary-goto-last-article ()
5740 "Go to the previously read article."
5743 (when gnus-last-article
5744 (gnus-summary-goto-article gnus-last-article))
5745 (gnus-summary-position-point)))
5747 (defun gnus-summary-pop-article (number)
5748 "Pop one article off the history and go to the previous.
5749 NUMBER articles will be popped off."
5752 (setq gnus-newsgroup-history
5753 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5755 (gnus-summary-goto-article (car to))
5756 (error "Article history empty")))
5757 (gnus-summary-position-point))
5759 ;; Summary commands and functions for limiting the summary buffer.
5761 (defun gnus-summary-limit-to-articles (n)
5762 "Limit the summary buffer to the next N articles.
5763 If not given a prefix, use the process marked articles instead."
5765 (gnus-set-global-variables)
5767 (let ((articles (gnus-summary-work-articles n)))
5768 (setq gnus-newsgroup-processable nil)
5769 (gnus-summary-limit articles))
5770 (gnus-summary-position-point)))
5772 (defun gnus-summary-pop-limit (&optional total)
5773 "Restore the previous limit.
5774 If given a prefix, remove all limits."
5776 (gnus-set-global-variables)
5778 (setq gnus-newsgroup-limits
5779 (list (mapcar (lambda (h) (mail-header-number h))
5780 gnus-newsgroup-headers))))
5781 (unless gnus-newsgroup-limits
5782 (error "No limit to pop"))
5784 (gnus-summary-limit nil 'pop)
5785 (gnus-summary-position-point)))
5787 (defun gnus-summary-limit-to-subject (subject &optional header)
5788 "Limit the summary buffer to articles that have subjects that match a regexp."
5789 (interactive "sLimit to subject (regexp): ")
5791 (setq header "subject"))
5792 (when (not (equal "" subject))
5794 (let ((articles (gnus-summary-find-matching
5795 (or header "subject") subject 'all)))
5797 (error "Found no matches for \"%s\"" subject))
5798 (gnus-summary-limit articles))
5799 (gnus-summary-position-point))))
5801 (defun gnus-summary-limit-to-author (from)
5802 "Limit the summary buffer to articles that have authors that match a regexp."
5803 (interactive "sLimit to author (regexp): ")
5804 (gnus-summary-limit-to-subject from "from"))
5806 (defun gnus-summary-limit-to-age (age &optional younger-p)
5807 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5808 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5809 articles that are younger than AGE days."
5810 (interactive "nTime in days: \nP")
5812 (let ((data gnus-newsgroup-data)
5813 (cutoff (nnmail-days-to-time age))
5814 articles d date is-younger)
5815 (while (setq d (pop data))
5816 (when (and (vectorp (gnus-data-header d))
5817 (setq date (mail-header-date (gnus-data-header d))))
5818 (setq is-younger (nnmail-time-less
5819 (nnmail-time-since (nnmail-date-to-time date))
5821 (when (if younger-p is-younger (not is-younger))
5822 (push (gnus-data-number d) articles))))
5823 (gnus-summary-limit (nreverse articles)))
5824 (gnus-summary-position-point)))
5826 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5828 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5830 (defun gnus-summary-limit-to-unread (&optional all)
5831 "Limit the summary buffer to articles that are not marked as read.
5832 If ALL is non-nil, limit strictly to unread articles."
5835 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5836 (gnus-summary-limit-to-marks
5837 ;; Concat all the marks that say that an article is read and have
5839 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5840 gnus-killed-mark gnus-kill-file-mark
5841 gnus-low-score-mark gnus-expirable-mark
5842 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5843 gnus-duplicate-mark gnus-souped-mark)
5846 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5847 (make-obsolete 'gnus-summary-delete-marked-with
5848 'gnus-summary-limit-exlude-marks)
5850 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5851 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5852 If REVERSE, limit the summary buffer to articles that are marked
5853 with MARKS. MARKS can either be a string of marks or a list of marks.
5854 Returns how many articles were removed."
5855 (interactive "sMarks: ")
5856 (gnus-summary-limit-to-marks marks t))
5858 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5859 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5860 If REVERSE (the prefix), limit the summary buffer to articles that are
5861 not marked with MARKS. MARKS can either be a string of marks or a
5863 Returns how many articles were removed."
5864 (interactive (list (read-string "Marks: ") current-prefix-arg))
5865 (gnus-set-global-variables)
5867 (let ((data gnus-newsgroup-data)
5868 (marks (if (listp marks) marks
5869 (append marks nil))) ; Transform to list.
5872 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5873 (memq (gnus-data-mark (car data)) marks))
5874 (push (gnus-data-number (car data)) articles))
5875 (setq data (cdr data)))
5876 (gnus-summary-limit articles))
5877 (gnus-summary-position-point)))
5879 (defun gnus-summary-limit-to-score (&optional score)
5880 "Limit to articles with score at or above SCORE."
5882 (gnus-set-global-variables)
5883 (setq score (if score
5884 (prefix-numeric-value score)
5885 (or gnus-summary-default-score 0)))
5886 (let ((data gnus-newsgroup-data)
5889 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5891 (push (gnus-data-number (car data)) articles))
5892 (setq data (cdr data)))
5894 (gnus-summary-limit articles)
5895 (gnus-summary-position-point))))
5897 (defun gnus-summary-limit-include-dormant ()
5898 "Display all the hidden articles that are marked as dormant."
5900 (gnus-set-global-variables)
5901 (unless gnus-newsgroup-dormant
5902 (error "There are no dormant articles in this group"))
5904 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5905 (gnus-summary-position-point)))
5907 (defun gnus-summary-limit-exclude-dormant ()
5908 "Hide all dormant articles."
5910 (gnus-set-global-variables)
5912 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5913 (gnus-summary-position-point)))
5915 (defun gnus-summary-limit-exclude-childless-dormant ()
5916 "Hide all dormant articles that have no children."
5918 (gnus-set-global-variables)
5919 (let ((data (gnus-data-list t))
5920 articles d children)
5921 ;; Find all articles that are either not dormant or have
5923 (while (setq d (pop data))
5924 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5926 (gnus-article-children (gnus-data-number d)))
5929 (when (memq (car children) articles)
5934 (push (gnus-data-number d) articles)))
5937 (gnus-summary-limit articles)
5938 (gnus-summary-position-point))))
5940 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5941 "Mark all unread excluded articles as read.
5942 If ALL, mark even excluded ticked and dormants as read."
5944 (let ((articles (gnus-sorted-complement
5946 (mapcar (lambda (h) (mail-header-number h))
5947 gnus-newsgroup-headers)
5949 (sort gnus-newsgroup-limit '<)))
5951 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
5953 (setq gnus-newsgroup-dormant nil
5954 gnus-newsgroup-marked nil
5955 gnus-newsgroup-reads
5957 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5958 gnus-newsgroup-reads))
5959 (while (setq article (pop articles))
5960 (unless (or (memq article gnus-newsgroup-dormant)
5961 (memq article gnus-newsgroup-marked))
5962 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5964 (defun gnus-summary-limit (articles &optional pop)
5966 ;; We pop the previous limit off the stack and use that.
5967 (setq articles (car gnus-newsgroup-limits)
5968 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5969 ;; We use the new limit, so we push the old limit on the stack.
5970 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5972 (setq gnus-newsgroup-limit articles)
5973 (let ((total (length gnus-newsgroup-data))
5974 (data (gnus-data-find-list (gnus-summary-article-number)))
5975 (gnus-summary-mark-below nil) ; Inhibit this.
5977 ;; This will do all the work of generating the new summary buffer
5978 ;; according to the new limit.
5979 (gnus-summary-prepare)
5980 ;; Hide any threads, possibly.
5981 (and gnus-show-threads
5982 gnus-thread-hide-subtree
5983 (gnus-summary-hide-all-threads))
5984 ;; Try to return to the article you were at, or one in the
5987 ;; We try to find some article after the current one.
5989 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5992 (setq data (cdr data))))
5994 ;; If there is no data, that means that we were after the last
5995 ;; article. The same goes when we can't find any articles
5996 ;; after the current one.
5997 (goto-char (point-max))
5998 (gnus-summary-find-prev))
5999 ;; We return how many articles were removed from the summary
6000 ;; buffer as a result of the new limit.
6001 (- total (length gnus-newsgroup-data))))
6003 (defsubst gnus-invisible-cut-children (threads)
6006 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6011 (defsubst gnus-cut-thread (thread)
6012 "Go forwards in the thread until we find an article that we want to display."
6013 (when (or (eq gnus-fetch-old-headers 'some)
6014 (eq gnus-build-sparse-threads 'some)
6015 (eq gnus-build-sparse-threads 'more))
6016 ;; Deal with old-fetched headers and sparse threads.
6020 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6021 (gnus-summary-article-ancient-p
6022 (mail-header-number (car thread))))
6024 (if (<= (length (cdr thread)) 1)
6025 (setq gnus-newsgroup-limit
6026 (delq (mail-header-number (car thread))
6027 gnus-newsgroup-limit)
6028 thread (cadr thread))
6029 (when (gnus-invisible-cut-children (cdr thread))
6030 (let ((th (cdr thread)))
6032 (if (memq (mail-header-number (caar th))
6033 gnus-newsgroup-limit)
6034 (setq thread (car th)
6036 (setq th (cdr th)))))))))))
6039 (defun gnus-cut-threads (threads)
6040 "Cut off all uninteresting articles from the beginning of threads."
6041 (when (or (eq gnus-fetch-old-headers 'some)
6042 (eq gnus-build-sparse-threads 'some)
6043 (eq gnus-build-sparse-threads 'more))
6046 (setcar th (gnus-cut-thread (car th)))
6047 (setq th (cdr th)))))
6048 ;; Remove nixed out threads.
6051 (defun gnus-summary-initial-limit (&optional show-if-empty)
6052 "Figure out what the initial limit is supposed to be on group entry.
6053 This entails weeding out unwanted dormants, low-scored articles,
6054 fetch-old-headers verbiage, and so on."
6055 ;; Most groups have nothing to remove.
6056 (if (or gnus-inhibit-limiting
6057 (and (null gnus-newsgroup-dormant)
6058 (not (eq gnus-fetch-old-headers 'some))
6059 (null gnus-summary-expunge-below)
6060 (not (eq gnus-build-sparse-threads 'some))
6061 (not (eq gnus-build-sparse-threads 'more))
6062 (null gnus-thread-expunge-below)
6063 (not gnus-use-nocem)))
6065 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6066 (setq gnus-newsgroup-limit nil)
6069 (unless (car (symbol-value node))
6070 ;; These threads have no parents -- they are roots.
6071 (let ((nodes (cdr (symbol-value node)))
6074 (if (and gnus-thread-expunge-below
6075 (< (gnus-thread-total-score (car nodes))
6076 gnus-thread-expunge-below))
6077 (gnus-expunge-thread (pop nodes))
6078 (setq thread (pop nodes))
6079 (gnus-summary-limit-children thread))))))
6080 gnus-newsgroup-dependencies)
6081 ;; If this limitation resulted in an empty group, we might
6082 ;; pop the previous limit and use it instead.
6083 (when (and (not gnus-newsgroup-limit)
6085 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6086 gnus-newsgroup-limit))
6088 (defun gnus-summary-limit-children (thread)
6089 "Return 1 if this subthread is visible and 0 if it is not."
6090 ;; First we get the number of visible children to this thread. This
6091 ;; is done by recursing down the thread using this function, so this
6092 ;; will really go down to a leaf article first, before slowly
6093 ;; working its way up towards the root.
6097 (apply '+ (mapcar 'gnus-summary-limit-children
6100 (number (mail-header-number (car thread)))
6103 (not (memq number gnus-newsgroup-marked))
6105 ;; If this article is dormant and has absolutely no visible
6106 ;; children, then this article isn't visible.
6107 (and (memq number gnus-newsgroup-dormant)
6109 ;; If this is "fetch-old-headered" and there is no
6110 ;; visible children, then we don't want this article.
6111 (and (eq gnus-fetch-old-headers 'some)
6112 (gnus-summary-article-ancient-p number)
6114 ;; If this is a sparsely inserted article with no children,
6115 ;; we don't want it.
6116 (and (eq gnus-build-sparse-threads 'some)
6117 (gnus-summary-article-sparse-p number)
6119 ;; If we use expunging, and this article is really
6120 ;; low-scored, then we don't want this article.
6121 (when (and gnus-summary-expunge-below
6123 (or (cdr (assq number gnus-newsgroup-scored))
6124 gnus-summary-default-score))
6125 gnus-summary-expunge-below))
6126 ;; We increase the expunge-tally here, but that has
6127 ;; nothing to do with the limits, really.
6128 (incf gnus-newsgroup-expunged-tally)
6129 ;; We also mark as read here, if that's wanted.
6130 (when (and gnus-summary-mark-below
6131 (< score gnus-summary-mark-below))
6132 (setq gnus-newsgroup-unreads
6133 (delq number gnus-newsgroup-unreads))
6134 (if gnus-newsgroup-auto-expire
6135 (push number gnus-newsgroup-expirable)
6136 (push (cons number gnus-low-score-mark)
6137 gnus-newsgroup-reads)))
6139 ;; Check NoCeM things.
6140 (if (and gnus-use-nocem
6141 (gnus-nocem-unwanted-article-p
6142 (mail-header-id (car thread))))
6144 (setq gnus-newsgroup-unreads
6145 (delq number gnus-newsgroup-unreads))
6147 ;; Nope, invisible article.
6149 ;; Ok, this article is to be visible, so we add it to the limit
6151 (push number gnus-newsgroup-limit)
6154 (defun gnus-expunge-thread (thread)
6155 "Mark all articles in THREAD as read."
6156 (let* ((number (mail-header-number (car thread))))
6157 (incf gnus-newsgroup-expunged-tally)
6158 ;; We also mark as read here, if that's wanted.
6159 (setq gnus-newsgroup-unreads
6160 (delq number gnus-newsgroup-unreads))
6161 (if gnus-newsgroup-auto-expire
6162 (push number gnus-newsgroup-expirable)
6163 (push (cons number gnus-low-score-mark)
6164 gnus-newsgroup-reads)))
6165 ;; Go recursively through all subthreads.
6166 (mapcar 'gnus-expunge-thread (cdr thread)))
6168 ;; Summary article oriented commands
6170 (defun gnus-summary-refer-parent-article (n)
6171 "Refer parent article N times.
6172 If N is negative, go to ancestor -N instead.
6173 The difference between N and the number of articles fetched is returned."
6175 (gnus-set-global-variables)
6178 (when (not (natnump n))
6183 (setq header (gnus-summary-article-header))
6184 (if (and (eq (mail-header-number header)
6185 (cdr gnus-article-current))
6186 (equal gnus-newsgroup-name
6187 (car gnus-article-current)))
6188 ;; If we try to find the parent of the currently
6189 ;; displayed article, then we take a look at the actual
6190 ;; References header, since this is slightly more
6191 ;; reliable than the References field we got from the
6194 (set-buffer gnus-original-article-buffer)
6195 (nnheader-narrow-to-headers)
6196 (unless (setq ref (message-fetch-field "references"))
6197 (setq ref (message-fetch-field "in-reply-to")))
6200 ;; It's not the current article, so we take a bet on
6201 ;; the value we got from the server.
6202 (mail-header-references header)))
6204 (not (equal ref "")))
6205 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6206 (gnus-message 1 "Couldn't find parent"))
6207 (gnus-message 1 "No references in article %d"
6208 (gnus-summary-article-number))
6211 (gnus-summary-position-point)
6214 (defun gnus-summary-refer-references ()
6215 "Fetch all articles mentioned in the References header.
6216 Return how many articles were fetched."
6218 (gnus-set-global-variables)
6219 (let ((ref (mail-header-references (gnus-summary-article-header)))
6220 (current (gnus-summary-article-number))
6224 (error "No References in the current article")
6225 ;; For each Message-ID in the References header...
6226 (while (string-match "<[^>]*>" ref)
6228 ;; ... fetch that article.
6229 (gnus-summary-refer-article
6230 (prog1 (match-string 0 ref)
6231 (setq ref (substring ref (match-end 0))))))
6232 (gnus-summary-goto-subject current)
6233 (gnus-summary-position-point)
6236 (defun gnus-summary-refer-article (message-id &optional arg)
6237 "Fetch an article specified by MESSAGE-ID.
6238 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6239 or `gnus-select-method', no matter what backend the article comes from."
6240 (interactive "sMessage-ID: \nP")
6241 (when (and (stringp message-id)
6242 (not (zerop (length message-id))))
6243 ;; Construct the correct Message-ID if necessary.
6244 ;; Suggested by tale@pawl.rpi.edu.
6245 (unless (string-match "^<" message-id)
6246 (setq message-id (concat "<" message-id)))
6247 (unless (string-match ">$" message-id)
6248 (setq message-id (concat message-id ">")))
6249 (let* ((header (gnus-id-to-header message-id))
6251 (gnus-summary-article-sparse-p
6252 (mail-header-number header))
6253 (memq (mail-header-number header)
6254 gnus-newsgroup-limit))))
6256 (or (not (gnus-summary-article-sparse-p
6257 (mail-header-number header)))
6260 ;; The article is present in the buffer, so we just go to it.
6261 (gnus-summary-goto-article
6262 (mail-header-number header) nil t)
6264 (gnus-summary-update-article (mail-header-number header))))
6265 ;; We fetch the article
6266 (let ((gnus-override-method
6267 (cond ((gnus-news-group-p gnus-newsgroup-name)
6268 gnus-refer-article-method)
6270 (or gnus-refer-article-method gnus-select-method))
6273 ;; Start the special refer-article method, if necessary.
6274 (when (and gnus-refer-article-method
6275 (gnus-news-group-p gnus-newsgroup-name))
6276 (gnus-check-server gnus-refer-article-method))
6277 ;; Fetch the header, and display the article.
6278 (if (setq number (gnus-summary-insert-subject message-id))
6279 (gnus-summary-select-article nil nil nil number)
6280 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6282 (defun gnus-summary-enter-digest-group (&optional force)
6283 "Enter an nndoc group based on the current article.
6284 If FORCE, force a digest interpretation. If not, try
6285 to guess what the document format is."
6287 (gnus-set-global-variables)
6288 (let ((conf gnus-current-window-configuration))
6290 (gnus-summary-select-article))
6291 (setq gnus-current-window-configuration conf)
6292 (let* ((name (format "%s-%d"
6293 (gnus-group-prefixed-name
6294 gnus-newsgroup-name (list 'nndoc ""))
6296 (set-buffer gnus-summary-buffer)
6297 gnus-current-article)))
6298 (ogroup gnus-newsgroup-name)
6299 (params (append (gnus-info-params (gnus-get-info ogroup))
6300 (list (cons 'to-group ogroup))
6301 (list (cons 'save-article-group ogroup))))
6302 (case-fold-search t)
6303 (buf (current-buffer))
6306 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6307 (insert-buffer-substring gnus-original-article-buffer)
6308 ;; Remove lines that may lead nndoc to misinterpret the
6311 (goto-char (point-min))
6312 (or (search-forward "\n\n" nil t) (point)))
6313 (goto-char (point-min))
6314 (delete-matching-lines "^\\(Path\\):\\|^From ")
6317 (if (gnus-group-read-ephemeral-group
6318 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6320 ,(if force 'digest 'guess))) t)
6321 ;; Make all postings to this group go to the parent group.
6322 (nconc (gnus-info-params (gnus-get-info name))
6324 ;; Couldn't select this doc group.
6325 (switch-to-buffer buf)
6326 (gnus-set-global-variables)
6327 (gnus-configure-windows 'summary)
6328 (gnus-message 3 "Article couldn't be entered?"))
6329 (kill-buffer dig)))))
6331 (defun gnus-summary-read-document (n)
6332 "Open a new group based on the current article(s).
6333 This will allow you to read digests and other similar
6334 documents as newsgroups.
6335 Obeys the standard process/prefix convention."
6337 (let* ((articles (gnus-summary-work-articles n))
6338 (ogroup gnus-newsgroup-name)
6339 (params (append (gnus-info-params (gnus-get-info ogroup))
6340 (list (cons 'to-group ogroup))))
6341 article group egroup groups vgroup)
6342 (while (setq article (pop articles))
6343 (setq group (format "%s-%d" gnus-newsgroup-name article))
6344 (gnus-summary-remove-process-mark article)
6345 (when (gnus-summary-display-article article)
6347 (nnheader-temp-write nil
6348 (insert-buffer-substring gnus-original-article-buffer)
6349 ;; Remove some headers that may lead nndoc to make
6351 (message-narrow-to-head)
6352 (goto-char (point-min))
6353 (delete-matching-lines "^\\(Path\\):\\|^From ")
6356 (gnus-group-read-ephemeral-group
6357 group `(nndoc ,group (nndoc-address ,(current-buffer))
6358 (nndoc-article-type guess))
6361 ;; Make all postings to this group go to the parent group.
6362 (nconc (gnus-info-params (gnus-get-info egroup))
6364 (push egroup groups))
6365 ;; Couldn't select this doc group.
6366 (gnus-error 3 "Article couldn't be entered"))))))
6367 ;; Now we have selected all the documents.
6370 (error "None of the articles could be interpreted as documents"))
6371 ((gnus-group-read-ephemeral-group
6372 (setq vgroup (format
6373 "nnvirtual:%s-%s" gnus-newsgroup-name
6374 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6375 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6377 (cons (current-buffer) 'summary)))
6379 (error "Couldn't select virtual nndoc group")))))
6381 (defun gnus-summary-isearch-article (&optional regexp-p)
6382 "Do incremental search forward on the current article.
6383 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6385 (gnus-set-global-variables)
6386 (gnus-summary-select-article)
6387 (gnus-configure-windows 'article)
6388 (gnus-eval-in-buffer-window gnus-article-buffer
6389 ;;(goto-char (point-min))
6390 (isearch-forward regexp-p)))
6392 (defun gnus-summary-search-article-forward (regexp &optional backward)
6393 "Search for an article containing REGEXP forward.
6394 If BACKWARD, search backward instead."
6397 (format "Search article %s (regexp%s): "
6398 (if current-prefix-arg "backward" "forward")
6399 (if gnus-last-search-regexp
6400 (concat ", default " gnus-last-search-regexp)
6402 current-prefix-arg))
6403 (gnus-set-global-variables)
6404 (if (string-equal regexp "")
6405 (setq regexp (or gnus-last-search-regexp ""))
6406 (setq gnus-last-search-regexp regexp))
6407 (if (gnus-summary-search-article regexp backward)
6408 (gnus-summary-show-thread)
6409 (error "Search failed: \"%s\"" regexp)))
6411 (defun gnus-summary-search-article-backward (regexp)
6412 "Search for an article containing REGEXP backward."
6415 (format "Search article backward (regexp%s): "
6416 (if gnus-last-search-regexp
6417 (concat ", default " gnus-last-search-regexp)
6419 (gnus-summary-search-article-forward regexp 'backward))
6421 (defun gnus-summary-search-article (regexp &optional backward)
6422 "Search for an article containing REGEXP.
6423 Optional argument BACKWARD means do search for backward.
6424 `gnus-select-article-hook' is not called during the search."
6425 ;; We have to require this here to make sure that the following
6426 ;; dynamic binding isn't shadowed by autoloading.
6427 (require 'gnus-async)
6428 (let ((gnus-select-article-hook nil) ;Disable hook.
6429 (gnus-article-display-hook nil)
6430 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6431 (gnus-use-article-prefetch nil)
6432 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6433 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6434 (sum (current-buffer))
6437 (gnus-save-hidden-threads
6438 (gnus-summary-select-article)
6439 (set-buffer gnus-article-buffer)
6443 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6445 (re-search-backward regexp nil t)
6446 (re-search-forward regexp nil t))
6447 ;; We found the regexp.
6452 (get-buffer-window (current-buffer))
6456 (setq point (point)))
6457 ;; We didn't find it, so we go to the next article.
6460 (while (eq found 'not)
6461 (if (not (if backward (gnus-summary-find-prev)
6462 (gnus-summary-find-next)))
6463 ;; No more articles.
6465 ;; Select the next article and adjust point.
6466 (unless (gnus-summary-article-sparse-p
6467 (gnus-summary-article-number))
6469 (gnus-summary-select-article)
6470 (set-buffer gnus-article-buffer)
6472 (goto-char (if backward (point-max) (point-min))))))))
6473 (gnus-message 7 ""))
6474 ;; Return whether we found the regexp.
6475 (when (eq found 'found)
6477 (gnus-summary-show-thread)
6478 (gnus-summary-goto-subject gnus-current-article)
6479 (gnus-summary-position-point)
6482 (defun gnus-summary-find-matching (header regexp &optional backward unread
6484 "Return a list of all articles that match REGEXP on HEADER.
6485 The search stars on the current article and goes forwards unless
6486 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6487 If UNREAD is non-nil, only unread articles will
6488 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6489 in the comparisons."
6490 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6491 (gnus-data-find-list
6492 (gnus-summary-article-number) (gnus-data-list backward))))
6493 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6494 (case-fold-search (not not-case-fold))
6496 (unless (fboundp (intern (concat "mail-header-" header)))
6497 (error "%s is not a valid header" header))
6500 (and (or (not unread) ; We want all articles...
6501 (gnus-data-unread-p d)) ; Or just unreads.
6502 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6503 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6504 (push (gnus-data-number d) articles)) ; Success!
6505 (setq data (cdr data)))
6506 (nreverse articles)))
6508 (defun gnus-summary-execute-command (header regexp command &optional backward)
6509 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6510 If HEADER is an empty string (or nil), the match is done on the entire
6511 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6513 (list (let ((completion-ignore-case t))
6516 (mapcar (lambda (string) (list string))
6517 '("Number" "Subject" "From" "Lines" "Date"
6518 "Message-ID" "Xref" "References" "Body"))
6519 nil 'require-match))
6520 (read-string "Regexp: ")
6521 (read-key-sequence "Command: ")
6522 current-prefix-arg))
6523 (when (equal header "Body")
6525 (gnus-set-global-variables)
6526 ;; Hidden thread subtrees must be searched as well.
6527 (gnus-summary-show-all-threads)
6528 ;; We don't want to change current point nor window configuration.
6530 (save-window-excursion
6531 (gnus-message 6 "Executing %s..." (key-description command))
6532 ;; We'd like to execute COMMAND interactively so as to give arguments.
6533 (gnus-execute header regexp
6534 `(call-interactively ',(key-binding command))
6536 (gnus-message 6 "Executing %s...done" (key-description command)))))
6538 (defun gnus-summary-beginning-of-article ()
6539 "Scroll the article back to the beginning."
6541 (gnus-set-global-variables)
6542 (gnus-summary-select-article)
6543 (gnus-configure-windows 'article)
6544 (gnus-eval-in-buffer-window gnus-article-buffer
6546 (goto-char (point-min))
6547 (when gnus-page-broken
6548 (gnus-narrow-to-page))))
6550 (defun gnus-summary-end-of-article ()
6551 "Scroll to the end of the article."
6553 (gnus-set-global-variables)
6554 (gnus-summary-select-article)
6555 (gnus-configure-windows 'article)
6556 (gnus-eval-in-buffer-window gnus-article-buffer
6558 (goto-char (point-max))
6560 (when gnus-page-broken
6561 (gnus-narrow-to-page))))
6563 (defun gnus-summary-print-article (&optional filename)
6564 "Generate and print a PostScript image of the article buffer.
6566 If the optional argument FILENAME is nil, send the image to the printer.
6567 If FILENAME is a string, save the PostScript image in a file with that
6568 name. If FILENAME is a number, prompt the user for the name of the file
6570 (interactive (list (ps-print-preprint current-prefix-arg)))
6571 (gnus-summary-select-article)
6572 (gnus-eval-in-buffer-window gnus-article-buffer
6573 (let ((buffer (generate-new-buffer " *print*")))
6576 (copy-to-buffer buffer (point-min) (point-max))
6578 (gnus-article-delete-invisible-text)
6579 (run-hooks 'gnus-ps-print-hook)
6580 (ps-print-buffer-with-faces filename))
6581 (kill-buffer buffer)))))
6583 (defun gnus-summary-show-article (&optional arg)
6584 "Force re-fetching of the current article.
6585 If ARG (the prefix) is non-nil, show the raw article without any
6586 article massaging functions being run."
6588 (gnus-set-global-variables)
6590 ;; Select the article the normal way.
6591 (gnus-summary-select-article nil 'force)
6592 ;; Bind the article treatment functions to nil.
6593 (let ((gnus-have-all-headers t)
6594 gnus-article-display-hook
6595 gnus-article-prepare-hook
6599 (gnus-summary-select-article nil 'force)))
6600 (gnus-summary-goto-subject gnus-current-article)
6601 (gnus-summary-position-point))
6603 (defun gnus-summary-verbose-headers (&optional arg)
6604 "Toggle permanent full header display.
6605 If ARG is a positive number, turn header display on.
6606 If ARG is a negative number, turn header display off."
6608 (gnus-set-global-variables)
6609 (setq gnus-show-all-headers
6610 (cond ((or (not (numberp arg))
6612 (not gnus-show-all-headers))
6615 (gnus-summary-show-article))
6617 (defun gnus-summary-toggle-header (&optional arg)
6618 "Show the headers if they are hidden, or hide them if they are shown.
6619 If ARG is a positive number, show the entire header.
6620 If ARG is a negative number, hide the unwanted header lines."
6622 (gnus-set-global-variables)
6624 (set-buffer gnus-article-buffer)
6625 (let* ((buffer-read-only nil)
6626 (inhibit-point-motion-hooks t)
6627 (hidden (text-property-any
6628 (goto-char (point-min)) (search-forward "\n\n")
6631 (goto-char (point-min))
6632 (when (search-forward "\n\n" nil t)
6633 (delete-region (point-min) (1- (point))))
6634 (goto-char (point-min))
6636 (set-buffer gnus-original-article-buffer)
6637 (goto-char (point-min))
6638 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6639 (insert-buffer-substring gnus-original-article-buffer 1 e)
6640 (let ((article-inhibit-hiding t))
6641 (run-hooks 'gnus-article-display-hook))
6642 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6643 (gnus-article-hide-headers)))))
6645 (defun gnus-summary-show-all-headers ()
6646 "Make all header lines visible."
6648 (gnus-set-global-variables)
6649 (gnus-article-show-all-headers))
6651 (defun gnus-summary-toggle-mime (&optional arg)
6652 "Toggle MIME processing.
6653 If ARG is a positive number, turn MIME processing on."
6655 (gnus-set-global-variables)
6656 (setq gnus-show-mime
6657 (if (null arg) (not gnus-show-mime)
6658 (> (prefix-numeric-value arg) 0)))
6659 (gnus-summary-select-article t 'force))
6661 (defun gnus-summary-caesar-message (&optional arg)
6662 "Caesar rotate the current article by 13.
6663 The numerical prefix specifies how many places to rotate each letter
6666 (gnus-set-global-variables)
6667 (gnus-summary-select-article)
6668 (let ((mail-header-separator ""))
6669 (gnus-eval-in-buffer-window gnus-article-buffer
6672 (let ((start (window-start))
6674 (message-caesar-buffer-body arg)
6675 (set-window-start (get-buffer-window (current-buffer)) start))))))
6677 (defun gnus-summary-stop-page-breaking ()
6678 "Stop page breaking in the current article."
6680 (gnus-set-global-variables)
6681 (gnus-summary-select-article)
6682 (gnus-eval-in-buffer-window gnus-article-buffer
6684 (when (gnus-visual-p 'page-marker)
6685 (let ((buffer-read-only nil))
6686 (gnus-remove-text-with-property 'gnus-prev)
6687 (gnus-remove-text-with-property 'gnus-next)))))
6689 (defun gnus-summary-move-article (&optional n to-newsgroup
6690 select-method action)
6691 "Move the current article to a different newsgroup.
6692 If N is a positive number, move the N next articles.
6693 If N is a negative number, move the N previous articles.
6694 If N is nil and any articles have been marked with the process mark,
6695 move those articles instead.
6696 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6697 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6698 re-spool using this method.
6700 For this function to work, both the current newsgroup and the
6701 newsgroup that you want to move to have to support the `request-move'
6702 and `request-accept' functions."
6705 (setq action 'move))
6706 (gnus-set-global-variables)
6707 ;; Disable marking as read.
6708 (let (gnus-mark-article-hook)
6709 (save-window-excursion
6710 (gnus-summary-select-article)))
6711 ;; Check whether the source group supports the required functions.
6712 (cond ((and (eq action 'move)
6713 (not (gnus-check-backend-function
6714 'request-move-article gnus-newsgroup-name)))
6715 (error "The current group does not support article moving"))
6716 ((and (eq action 'crosspost)
6717 (not (gnus-check-backend-function
6718 'request-replace-article gnus-newsgroup-name)))
6719 (error "The current group does not support article editing")))
6720 (let ((articles (gnus-summary-work-articles n))
6721 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6722 (names '((move "Move" "Moving")
6723 (copy "Copy" "Copying")
6724 (crosspost "Crosspost" "Crossposting")))
6725 (copy-buf (save-excursion
6726 (nnheader-set-temp-buffer " *copy article*")))
6727 art-group to-method new-xref article to-groups)
6728 (unless (assq action names)
6729 (error "Unknown action %s" action))
6730 ;; Read the newsgroup name.
6731 (when (and (not to-newsgroup)
6732 (not select-method))
6734 (gnus-read-move-group-name
6735 (cadr (assq action names))
6736 (symbol-value (intern (format "gnus-current-%s-group" action)))
6738 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6739 (setq to-method (or select-method
6740 (gnus-group-name-to-method to-newsgroup)))
6741 ;; Check the method we are to move this article to...
6742 (unless (gnus-check-backend-function
6743 'request-accept-article (car to-method))
6744 (error "%s does not support article copying" (car to-method)))
6745 (unless (gnus-check-server to-method)
6746 (error "Can't open server %s" (car to-method)))
6747 (gnus-message 6 "%s to %s: %s..."
6748 (caddr (assq action names))
6749 (or (car select-method) to-newsgroup) articles)
6751 (setq article (pop articles))
6755 ;; Move the article.
6757 ;; Remove this article from future suppression.
6758 (gnus-dup-unsuppress-article article)
6759 (gnus-request-move-article
6760 article ; Article to move
6761 gnus-newsgroup-name ; From newsgroup
6762 (nth 1 (gnus-find-method-for-group
6763 gnus-newsgroup-name)) ; Server
6764 (list 'gnus-request-accept-article
6765 to-newsgroup (list 'quote select-method)
6766 (not articles)) ; Accept form
6767 (not articles))) ; Only save nov last time
6768 ;; Copy the article.
6771 (set-buffer copy-buf)
6772 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6773 (gnus-request-accept-article
6774 to-newsgroup select-method (not articles))))
6775 ;; Crosspost the article.
6776 ((eq action 'crosspost)
6777 (let ((xref (message-tokenize-header
6778 (mail-header-xref (gnus-summary-article-header article))
6780 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6783 (setq xref (list (system-name))))
6786 (mapconcat 'identity
6787 (delete "Xref:" (delete new-xref xref))
6791 (set-buffer copy-buf)
6792 ;; First put the article in the destination group.
6793 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6794 (when (consp (setq art-group
6795 (gnus-request-accept-article
6796 to-newsgroup select-method (not articles))))
6797 (setq new-xref (concat new-xref " " (car art-group)
6798 ":" (cdr art-group)))
6799 ;; Now we have the new Xrefs header, so we insert
6800 ;; it and replace the new article.
6801 (nnheader-replace-header "Xref" new-xref)
6802 (gnus-request-replace-article
6803 (cdr art-group) to-newsgroup (current-buffer))
6807 (gnus-message 1 "Couldn't %s article %s"
6808 (cadr (assq action names)) article))
6809 ((and (eq art-group 'junk)
6811 (gnus-summary-mark-article article gnus-canceled-mark)
6812 (gnus-message 4 "Deleted article %s" article))
6816 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6818 (gnus-group-prefixed-name
6821 (gnus-find-method-for-group to-newsgroup)))
6822 gnus-newsrc-hashtb)))
6823 (info (nth 2 entry))
6824 (to-group (gnus-info-group info)))
6825 ;; Update the group that has been moved to.
6827 (memq action '(move copy)))
6828 (unless (member to-group to-groups)
6829 (push to-group to-groups))
6831 (unless (memq article gnus-newsgroup-unreads)
6833 info (gnus-add-to-range (gnus-info-read info)
6834 (list (cdr art-group)))))
6836 ;; Copy any marks over to the new group.
6837 (let ((marks gnus-article-mark-lists)
6838 (to-article (cdr art-group)))
6840 ;; See whether the article is to be put in the cache.
6841 (when gnus-use-cache
6842 (gnus-cache-possibly-enter-article
6844 (let ((header (copy-sequence
6845 (gnus-summary-article-header article))))
6846 (mail-header-set-number header to-article)
6848 (memq article gnus-newsgroup-marked)
6849 (memq article gnus-newsgroup-dormant)
6850 (memq article gnus-newsgroup-unreads)))
6852 (when (and (equal to-group gnus-newsgroup-name)
6853 (not (memq article gnus-newsgroup-unreads)))
6854 ;; Mark this article as read in this group.
6855 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6856 (setcdr (gnus-active to-group) to-article)
6857 (setcdr gnus-newsgroup-active to-article))
6860 (when (memq article (symbol-value
6861 (intern (format "gnus-newsgroup-%s"
6863 ;; If the other group is the same as this group,
6864 ;; then we have to add the mark to the list.
6865 (when (equal to-group gnus-newsgroup-name)
6866 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6869 (intern (format "gnus-newsgroup-%s"
6871 ;; Copy the marks to other group.
6872 (gnus-add-marked-articles
6873 to-group (cdar marks) (list to-article) info))
6874 (setq marks (cdr marks)))
6877 (concat "(gnus-group-set-info '"
6878 (gnus-prin1-to-string (gnus-get-info to-group))
6881 ;; Update the Xref header in this article to point to
6882 ;; the new crossposted article we have just created.
6883 (when (eq action 'crosspost)
6885 (set-buffer copy-buf)
6886 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6887 (nnheader-replace-header "Xref" new-xref)
6888 (gnus-request-replace-article
6889 article gnus-newsgroup-name (current-buffer)))))
6891 (gnus-summary-goto-subject article)
6892 (when (eq action 'move)
6893 (gnus-summary-mark-article article gnus-canceled-mark))))
6894 (gnus-summary-remove-process-mark article))
6895 ;; Re-activate all groups that have been moved to.
6898 (set-buffer gnus-group-buffer)
6899 (when (gnus-group-goto-group (car to-groups) t)
6900 (gnus-group-get-new-news-this-group 1 t))
6903 (gnus-kill-buffer copy-buf)
6904 (gnus-summary-position-point)
6905 (gnus-set-mode-line 'summary)))
6907 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6908 "Move the current article to a different newsgroup.
6909 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6910 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6911 re-spool using this method."
6913 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6915 (defun gnus-summary-crosspost-article (&optional n)
6916 "Crosspost the current article to some other group."
6918 (gnus-summary-move-article n nil nil 'crosspost))
6920 (defcustom gnus-summary-respool-default-method nil
6921 "Default method for respooling an article.
6922 If nil, use to the current newsgroup method."
6923 :type 'gnus-select-method-name
6924 :group 'gnus-summary-mail)
6926 (defun gnus-summary-respool-article (&optional n method)
6927 "Respool the current article.
6928 The article will be squeezed through the mail spooling process again,
6929 which means that it will be put in some mail newsgroup or other
6930 depending on `nnmail-split-methods'.
6931 If N is a positive number, respool the N next articles.
6932 If N is a negative number, respool the N previous articles.
6933 If N is nil and any articles have been marked with the process mark,
6934 respool those articles instead.
6936 Respooling can be done both from mail groups and \"real\" newsgroups.
6937 In the former case, the articles in question will be moved from the
6938 current group into whatever groups they are destined to. In the
6939 latter case, they will be copied into the relevant groups."
6941 (list current-prefix-arg
6942 (let* ((methods (gnus-methods-using 'respool))
6944 (symbol-name (or gnus-summary-respool-default-method
6945 (car (gnus-find-method-for-group
6946 gnus-newsgroup-name)))))
6948 (gnus-completing-read
6949 methname "What backend do you want to use when respooling?"
6950 methods nil t nil 'gnus-mail-method-history))
6953 ((zerop (length (setq ms (gnus-servers-using-backend
6955 (list (intern method) ""))
6959 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6960 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6962 (gnus-set-global-variables)
6964 (error "No method given for respooling"))
6965 (if (assoc (symbol-name
6966 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6967 (gnus-methods-using 'respool))
6968 (gnus-summary-move-article n nil method)
6969 (gnus-summary-copy-article n nil method)))
6971 (defun gnus-summary-import-article (file)
6972 "Import a random file into a mail newsgroup."
6973 (interactive "fImport file: ")
6974 (gnus-set-global-variables)
6975 (let ((group gnus-newsgroup-name)
6976 (now (current-time))
6978 (unless (gnus-check-backend-function 'request-accept-article group)
6979 (error "%s does not support article importing" group))
6980 (or (file-readable-p file)
6981 (not (file-regular-p file))
6982 (error "Can't read %s" file))
6984 (set-buffer (get-buffer-create " *import file*"))
6985 (buffer-disable-undo (current-buffer))
6987 (insert-file-contents file)
6988 (goto-char (point-min))
6989 (unless (nnheader-article-p)
6990 ;; This doesn't look like an article, so we fudge some headers.
6991 (setq atts (file-attributes file)
6992 lines (count-lines (point-min) (point-max)))
6993 (insert "From: " (read-string "From: ") "\n"
6994 "Subject: " (read-string "Subject: ") "\n"
6995 "Date: " (timezone-make-date-arpa-standard
6996 (current-time-string (nth 5 atts))
6997 (current-time-zone now)
6998 (current-time-zone now))
7000 "Message-ID: " (message-make-message-id) "\n"
7001 "Lines: " (int-to-string lines) "\n"
7002 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7003 (gnus-request-accept-article group nil t)
7004 (kill-buffer (current-buffer)))))
7006 (defun gnus-summary-article-posted-p ()
7007 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7008 This will be the case if the article has both been mailed and posted."
7010 (let ((id (mail-header-references (gnus-summary-article-header)))
7011 (gnus-override-method
7012 (or gnus-refer-article-method gnus-select-method)))
7013 (if (gnus-request-head id "")
7014 (gnus-message 2 "The current message was found on %s"
7015 gnus-override-method)
7016 (gnus-message 2 "The current message couldn't be found on %s"
7017 gnus-override-method)
7020 (defun gnus-summary-expire-articles (&optional now)
7021 "Expire all articles that are marked as expirable in the current group."
7023 (gnus-set-global-variables)
7024 (when (gnus-check-backend-function
7025 'request-expire-articles gnus-newsgroup-name)
7026 ;; This backend supports expiry.
7027 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7028 (expirable (if total
7030 ;; We need to update the info for
7031 ;; this group for `gnus-list-of-read-articles'
7032 ;; to give us the right answer.
7033 (run-hooks 'gnus-exit-group-hook)
7034 (gnus-summary-update-info)
7035 (gnus-list-of-read-articles gnus-newsgroup-name))
7036 (setq gnus-newsgroup-expirable
7037 (sort gnus-newsgroup-expirable '<))))
7038 (expiry-wait (if now 'immediate
7039 (gnus-group-find-parameter
7040 gnus-newsgroup-name 'expiry-wait)))
7043 ;; There are expirable articles in this group, so we run them
7044 ;; through the expiry process.
7045 (gnus-message 6 "Expiring articles...")
7046 ;; The list of articles that weren't expired is returned.
7048 (let ((nnmail-expiry-wait-function nil)
7049 (nnmail-expiry-wait expiry-wait))
7050 (setq es (gnus-request-expire-articles
7051 expirable gnus-newsgroup-name)))
7052 (setq es (gnus-request-expire-articles
7053 expirable gnus-newsgroup-name)))
7055 (setq gnus-newsgroup-expirable es))
7056 ;; We go through the old list of expirable, and mark all
7057 ;; really expired articles as nonexistent.
7058 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7059 (let ((gnus-use-cache nil))
7061 (unless (memq (car expirable) es)
7062 (when (gnus-data-find (car expirable))
7063 (gnus-summary-mark-article
7064 (car expirable) gnus-canceled-mark)))
7065 (setq expirable (cdr expirable)))))
7066 (gnus-message 6 "Expiring articles...done")))))
7068 (defun gnus-summary-expire-articles-now ()
7069 "Expunge all expirable articles in the current group.
7070 This means that *all* articles that are marked as expirable will be
7071 deleted forever, right now."
7073 (gnus-set-global-variables)
7074 (or gnus-expert-user
7076 "Are you really, really, really sure you want to delete all these messages? ")
7078 (gnus-summary-expire-articles t))
7080 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7081 (defun gnus-summary-delete-article (&optional n)
7082 "Delete the N next (mail) articles.
7083 This command actually deletes articles. This is not a marking
7084 command. The article will disappear forever from your life, never to
7086 If N is negative, delete backwards.
7087 If N is nil and articles have been marked with the process mark,
7088 delete these instead."
7090 (gnus-set-global-variables)
7091 (unless (gnus-check-backend-function 'request-expire-articles
7092 gnus-newsgroup-name)
7093 (error "The current newsgroup does not support article deletion"))
7094 ;; Compute the list of articles to delete.
7095 (let ((articles (gnus-summary-work-articles n))
7097 (if (and gnus-novice-user
7098 (not (gnus-yes-or-no-p
7099 (format "Do you really want to delete %s forever? "
7100 (if (> (length articles) 1)
7101 (format "these %s articles" (length articles))
7104 ;; Delete the articles.
7105 (setq not-deleted (gnus-request-expire-articles
7106 articles gnus-newsgroup-name 'force))
7108 (gnus-summary-remove-process-mark (car articles))
7109 ;; The backend might not have been able to delete the article
7111 (unless (memq (car articles) not-deleted)
7112 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7113 (setq articles (cdr articles)))
7115 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7116 (gnus-summary-position-point)
7117 (gnus-set-mode-line 'summary)
7120 (defun gnus-summary-edit-article (&optional force)
7121 "Edit the current article.
7122 This will have permanent effect only in mail groups.
7123 If FORCE is non-nil, allow editing of articles even in read-only
7127 (set-buffer gnus-summary-buffer)
7128 (gnus-set-global-variables)
7129 (when (and (not force)
7130 (gnus-group-read-only-p))
7131 (error "The current newsgroup does not support article editing"))
7132 ;; Select article if needed.
7133 (unless (eq (gnus-summary-article-number)
7134 gnus-current-article)
7135 (gnus-summary-select-article t))
7136 (gnus-article-date-original)
7137 (gnus-article-edit-article
7139 (gnus-summary-edit-article-done
7140 ,(or (mail-header-references gnus-current-headers) "")
7141 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
7143 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7145 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
7146 "Make edits to the current article permanent."
7148 ;; Replace the article.
7149 (if (and (not read-only)
7150 (not (gnus-request-replace-article
7151 (cdr gnus-article-current) (car gnus-article-current)
7153 (error "Couldn't replace article")
7154 ;; Update the summary buffer.
7156 (equal (message-tokenize-header references " ")
7157 (message-tokenize-header
7158 (or (message-fetch-field "references") "") " ")))
7159 ;; We only have to update this line.
7162 (message-narrow-to-head)
7163 (let ((head (buffer-string))
7165 (nnheader-temp-write nil
7166 (insert (format "211 %d Article retrieved.\n"
7167 (cdr gnus-article-current)))
7170 (let ((nntp-server-buffer (current-buffer)))
7171 (setq header (car (gnus-get-newsgroup-headers
7173 (set-buffer gnus-summary-buffer)
7174 gnus-newsgroup-dependencies)
7177 (set-buffer gnus-summary-buffer)
7178 (gnus-data-set-header
7179 (gnus-data-find (cdr gnus-article-current))
7181 (gnus-summary-update-article-line
7182 (cdr gnus-article-current) header))))))
7184 (set-buffer (or buffer gnus-summary-buffer))
7185 (gnus-summary-update-article (cdr gnus-article-current)))
7186 ;; Prettify the article buffer again.
7188 (set-buffer gnus-article-buffer)
7189 (run-hooks 'gnus-article-display-hook)
7190 (set-buffer gnus-original-article-buffer)
7191 (gnus-request-article
7192 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
7193 ;; Prettify the summary buffer line.
7194 (when (gnus-visual-p 'summary-highlight 'highlight)
7195 (run-hooks 'gnus-visual-mark-article-hook))))
7197 (defun gnus-summary-edit-wash (key)
7198 "Perform editing command in the article buffer."
7202 (message "%s" (concat (this-command-keys) "- "))
7205 (gnus-summary-edit-article)
7206 (execute-kbd-macro (concat (this-command-keys) key))
7207 (gnus-article-edit-done))
7211 (defun gnus-summary-respool-query (&optional silent)
7212 "Query where the respool algorithm would put this article."
7214 (gnus-set-global-variables)
7215 (let (gnus-mark-article-hook)
7216 (gnus-summary-select-article)
7218 (set-buffer gnus-original-article-buffer)
7220 (message-narrow-to-head)
7221 (let ((groups (nnmail-article-group 'identity)))
7224 (message "This message would go to %s"
7225 (mapconcat 'car groups ", "))
7226 (message "This message would go to no groups"))
7229 ;; Summary marking commands.
7231 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7232 "Mark articles which has the same subject as read, and then select the next.
7233 If UNMARK is positive, remove any kind of mark.
7234 If UNMARK is negative, tick articles."
7236 (gnus-set-global-variables)
7238 (setq unmark (prefix-numeric-value unmark)))
7240 (gnus-summary-mark-same-subject
7241 (gnus-summary-article-subject) unmark)))
7242 ;; Select next unread article. If auto-select-same mode, should
7243 ;; select the first unread article.
7244 (gnus-summary-next-article t (and gnus-auto-select-same
7245 (gnus-summary-article-subject)))
7246 (gnus-message 7 "%d article%s marked as %s"
7247 count (if (= count 1) " is" "s are")
7248 (if unmark "unread" "read"))))
7250 (defun gnus-summary-kill-same-subject (&optional unmark)
7251 "Mark articles which has the same subject as read.
7252 If UNMARK is positive, remove any kind of mark.
7253 If UNMARK is negative, tick articles."
7255 (gnus-set-global-variables)
7257 (setq unmark (prefix-numeric-value unmark)))
7259 (gnus-summary-mark-same-subject
7260 (gnus-summary-article-subject) unmark)))
7261 ;; If marked as read, go to next unread subject.
7263 ;; Go to next unread subject.
7264 (gnus-summary-next-subject 1 t))
7265 (gnus-message 7 "%d articles are marked as %s"
7266 count (if unmark "unread" "read"))))
7268 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7269 "Mark articles with same SUBJECT as read, and return marked number.
7270 If optional argument UNMARK is positive, remove any kinds of marks.
7271 If optional argument UNMARK is negative, mark articles as unread instead."
7275 ((null unmark) ; Mark as read.
7278 (gnus-summary-mark-article-as-read gnus-killed-mark)
7279 (gnus-summary-show-thread) t)
7280 (gnus-summary-find-subject subject))
7281 (setq count (1+ count))))
7282 ((> unmark 0) ; Tick.
7285 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7286 (gnus-summary-show-thread) t)
7287 (gnus-summary-find-subject subject))
7288 (setq count (1+ count))))
7289 (t ; Mark as unread.
7292 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7293 (gnus-summary-show-thread) t)
7294 (gnus-summary-find-subject subject))
7295 (setq count (1+ count)))))
7296 (gnus-set-mode-line 'summary)
7297 ;; Return the number of marked articles.
7300 (defun gnus-summary-mark-as-processable (n &optional unmark)
7301 "Set the process mark on the next N articles.
7302 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7303 the process mark instead. The difference between N and the actual
7304 number of articles marked is returned."
7306 (gnus-set-global-variables)
7307 (let ((backward (< n 0))
7312 (gnus-summary-remove-process-mark
7313 (gnus-summary-article-number))
7314 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7315 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7318 (gnus-message 7 "No more articles"))
7319 (gnus-summary-recenter)
7320 (gnus-summary-position-point)
7323 (defun gnus-summary-unmark-as-processable (n)
7324 "Remove the process mark from the next N articles.
7325 If N is negative, unmark backward instead. The difference between N and
7326 the actual number of articles unmarked is returned."
7328 (gnus-set-global-variables)
7329 (gnus-summary-mark-as-processable n t))
7331 (defun gnus-summary-unmark-all-processable ()
7332 "Remove the process mark from all articles."
7334 (gnus-set-global-variables)
7336 (while gnus-newsgroup-processable
7337 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7338 (gnus-summary-position-point))
7340 (defun gnus-summary-mark-as-expirable (n)
7341 "Mark N articles forward as expirable.
7342 If N is negative, mark backward instead. The difference between N and
7343 the actual number of articles marked is returned."
7345 (gnus-set-global-variables)
7346 (gnus-summary-mark-forward n gnus-expirable-mark))
7348 (defun gnus-summary-mark-article-as-replied (article)
7349 "Mark ARTICLE replied and update the summary line."
7350 (push article gnus-newsgroup-replied)
7351 (let ((buffer-read-only nil))
7352 (when (gnus-summary-goto-subject article)
7353 (gnus-summary-update-secondary-mark article))))
7355 (defun gnus-summary-set-bookmark (article)
7356 "Set a bookmark in current article."
7357 (interactive (list (gnus-summary-article-number)))
7358 (gnus-set-global-variables)
7359 (when (or (not (get-buffer gnus-article-buffer))
7360 (not gnus-current-article)
7361 (not gnus-article-current)
7362 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7363 (error "No current article selected"))
7364 ;; Remove old bookmark, if one exists.
7365 (let ((old (assq article gnus-newsgroup-bookmarks)))
7367 (setq gnus-newsgroup-bookmarks
7368 (delq old gnus-newsgroup-bookmarks))))
7369 ;; Set the new bookmark, which is on the form
7370 ;; (article-number . line-number-in-body).
7374 (set-buffer gnus-article-buffer)
7378 (goto-char (point-min))
7379 (search-forward "\n\n" nil t)
7382 gnus-newsgroup-bookmarks)
7383 (gnus-message 6 "A bookmark has been added to the current article."))
7385 (defun gnus-summary-remove-bookmark (article)
7386 "Remove the bookmark from the current article."
7387 (interactive (list (gnus-summary-article-number)))
7388 (gnus-set-global-variables)
7389 ;; Remove old bookmark, if one exists.
7390 (let ((old (assq article gnus-newsgroup-bookmarks)))
7393 (setq gnus-newsgroup-bookmarks
7394 (delq old gnus-newsgroup-bookmarks))
7395 (gnus-message 6 "Removed bookmark."))
7396 (gnus-message 6 "No bookmark in current article."))))
7398 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7399 (defun gnus-summary-mark-as-dormant (n)
7400 "Mark N articles forward as dormant.
7401 If N is negative, mark backward instead. The difference between N and
7402 the actual number of articles marked is returned."
7404 (gnus-set-global-variables)
7405 (gnus-summary-mark-forward n gnus-dormant-mark))
7407 (defun gnus-summary-set-process-mark (article)
7408 "Set the process mark on ARTICLE and update the summary line."
7409 (setq gnus-newsgroup-processable
7411 (delq article gnus-newsgroup-processable)))
7412 (when (gnus-summary-goto-subject article)
7413 (gnus-summary-show-thread)
7414 (gnus-summary-update-secondary-mark article)))
7416 (defun gnus-summary-remove-process-mark (article)
7417 "Remove the process mark from ARTICLE and update the summary line."
7418 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7419 (when (gnus-summary-goto-subject article)
7420 (gnus-summary-show-thread)
7421 (gnus-summary-update-secondary-mark article)))
7423 (defun gnus-summary-set-saved-mark (article)
7424 "Set the process mark on ARTICLE and update the summary line."
7425 (push article gnus-newsgroup-saved)
7426 (when (gnus-summary-goto-subject article)
7427 (gnus-summary-update-secondary-mark article)))
7429 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7430 "Mark N articles as read forwards.
7431 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7432 The difference between N and the actual number of articles marked is
7435 (gnus-set-global-variables)
7436 (let ((backward (< n 0))
7437 (gnus-summary-goto-unread
7438 (and gnus-summary-goto-unread
7439 (not (eq gnus-summary-goto-unread 'never))
7440 (not (memq mark (list gnus-unread-mark
7441 gnus-ticked-mark gnus-dormant-mark)))))
7443 (mark (or mark gnus-del-mark)))
7445 (gnus-summary-mark-article nil mark no-expire)
7446 (zerop (gnus-summary-next-subject
7448 (and gnus-summary-goto-unread
7449 (not (eq gnus-summary-goto-unread 'never)))
7453 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7454 (gnus-summary-recenter)
7455 (gnus-summary-position-point)
7456 (gnus-set-mode-line 'summary)
7459 (defun gnus-summary-mark-article-as-read (mark)
7460 "Mark the current article quickly as read with MARK."
7461 (let ((article (gnus-summary-article-number)))
7462 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7463 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7464 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7465 (push (cons article mark) gnus-newsgroup-reads)
7466 ;; Possibly remove from cache, if that is used.
7467 (when gnus-use-cache
7468 (gnus-cache-enter-remove-article article))
7469 ;; Allow the backend to change the mark.
7470 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7471 ;; Check for auto-expiry.
7472 (when (and gnus-newsgroup-auto-expire
7473 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7474 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7475 (= mark gnus-ancient-mark)
7476 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7477 (= mark gnus-duplicate-mark)))
7478 (setq mark gnus-expirable-mark)
7479 (push article gnus-newsgroup-expirable))
7480 ;; Set the mark in the buffer.
7481 (gnus-summary-update-mark mark 'unread)
7484 (defun gnus-summary-mark-article-as-unread (mark)
7485 "Mark the current article quickly as unread with MARK."
7486 (let ((article (gnus-summary-article-number)))
7488 (gnus-error 1 "Unmarkable article")
7489 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7490 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7491 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7492 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7493 (cond ((= mark gnus-ticked-mark)
7494 (push article gnus-newsgroup-marked))
7495 ((= mark gnus-dormant-mark)
7496 (push article gnus-newsgroup-dormant))
7498 (push article gnus-newsgroup-unreads)))
7499 (setq gnus-newsgroup-reads
7500 (delq (assq article gnus-newsgroup-reads)
7501 gnus-newsgroup-reads))
7503 ;; See whether the article is to be put in the cache.
7505 (vectorp (gnus-summary-article-header article))
7507 (gnus-cache-possibly-enter-article
7508 gnus-newsgroup-name article
7509 (gnus-summary-article-header article)
7510 (= mark gnus-ticked-mark)
7511 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7514 (gnus-summary-update-mark mark 'unread))
7517 (defun gnus-summary-mark-article (&optional article mark no-expire)
7518 "Mark ARTICLE with MARK. MARK can be any character.
7519 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7520 `??' (dormant) and `?E' (expirable).
7521 If MARK is nil, then the default character `?D' is used.
7522 If ARTICLE is nil, then the article on the current line will be
7524 ;; The mark might be a string.
7525 (when (stringp mark)
7526 (setq mark (aref mark 0)))
7527 ;; If no mark is given, then we check auto-expiring.
7528 (and (not no-expire)
7529 gnus-newsgroup-auto-expire
7531 (and (gnus-characterp mark)
7532 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7533 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7534 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7535 (= mark gnus-duplicate-mark))))
7536 (setq mark gnus-expirable-mark))
7537 (let* ((mark (or mark gnus-del-mark))
7538 (article (or article (gnus-summary-article-number))))
7540 (error "No article on current line"))
7541 (if (or (= mark gnus-unread-mark)
7542 (= mark gnus-ticked-mark)
7543 (= mark gnus-dormant-mark))
7544 (gnus-mark-article-as-unread article mark)
7545 (gnus-mark-article-as-read article mark))
7547 ;; See whether the article is to be put in the cache.
7549 (not (= mark gnus-canceled-mark))
7550 (vectorp (gnus-summary-article-header article))
7552 (gnus-cache-possibly-enter-article
7553 gnus-newsgroup-name article
7554 (gnus-summary-article-header article)
7555 (= mark gnus-ticked-mark)
7556 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7558 (when (gnus-summary-goto-subject article nil t)
7559 (let ((buffer-read-only nil))
7560 (gnus-summary-show-thread)
7562 (gnus-summary-update-mark mark 'unread)
7565 (defun gnus-summary-update-secondary-mark (article)
7566 "Update the secondary (read, process, cache) mark."
7567 (gnus-summary-update-mark
7568 (cond ((memq article gnus-newsgroup-processable)
7570 ((memq article gnus-newsgroup-cached)
7572 ((memq article gnus-newsgroup-replied)
7574 ((memq article gnus-newsgroup-saved)
7576 (t gnus-unread-mark))
7578 (when (gnus-visual-p 'summary-highlight 'highlight)
7579 (run-hooks 'gnus-summary-update-hook))
7582 (defun gnus-summary-update-mark (mark type)
7583 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7584 (buffer-read-only nil))
7585 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7586 (when (looking-at "\r")
7589 (<= (+ forward (point)) (point-max)))
7590 ;; Go to the right position on the line.
7591 (goto-char (+ forward (point)))
7592 ;; Replace the old mark with the new mark.
7593 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7594 ;; Optionally update the marks by some user rule.
7595 (when (eq type 'unread)
7597 (gnus-data-find (gnus-summary-article-number)) mark)
7598 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7600 (defun gnus-mark-article-as-read (article &optional mark)
7601 "Enter ARTICLE in the pertinent lists and remove it from others."
7602 ;; Make the article expirable.
7603 (let ((mark (or mark gnus-del-mark)))
7604 (if (= mark gnus-expirable-mark)
7605 (push article gnus-newsgroup-expirable)
7606 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7607 ;; Remove from unread and marked lists.
7608 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7609 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7610 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7611 (push (cons article mark) gnus-newsgroup-reads)
7612 ;; Possibly remove from cache, if that is used.
7613 (when gnus-use-cache
7614 (gnus-cache-enter-remove-article article))))
7616 (defun gnus-mark-article-as-unread (article &optional mark)
7617 "Enter ARTICLE in the pertinent lists and remove it from others."
7618 (let ((mark (or mark gnus-ticked-mark)))
7619 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7620 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7621 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7622 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7624 ;; Unsuppress duplicates?
7625 (when gnus-suppress-duplicates
7626 (gnus-dup-unsuppress-article article))
7628 (cond ((= mark gnus-ticked-mark)
7629 (push article gnus-newsgroup-marked))
7630 ((= mark gnus-dormant-mark)
7631 (push article gnus-newsgroup-dormant))
7633 (push article gnus-newsgroup-unreads)))
7634 (setq gnus-newsgroup-reads
7635 (delq (assq article gnus-newsgroup-reads)
7636 gnus-newsgroup-reads))))
7638 (defalias 'gnus-summary-mark-as-unread-forward
7639 'gnus-summary-tick-article-forward)
7640 (make-obsolete 'gnus-summary-mark-as-unread-forward
7641 'gnus-summary-tick-article-forward)
7642 (defun gnus-summary-tick-article-forward (n)
7643 "Tick N articles forwards.
7644 If N is negative, tick backwards instead.
7645 The difference between N and the number of articles ticked is returned."
7647 (gnus-summary-mark-forward n gnus-ticked-mark))
7649 (defalias 'gnus-summary-mark-as-unread-backward
7650 'gnus-summary-tick-article-backward)
7651 (make-obsolete 'gnus-summary-mark-as-unread-backward
7652 'gnus-summary-tick-article-backward)
7653 (defun gnus-summary-tick-article-backward (n)
7654 "Tick N articles backwards.
7655 The difference between N and the number of articles ticked is returned."
7657 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7659 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7660 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7661 (defun gnus-summary-tick-article (&optional article clear-mark)
7662 "Mark current article as unread.
7663 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7664 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7666 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7669 (defun gnus-summary-mark-as-read-forward (n)
7670 "Mark N articles as read forwards.
7671 If N is negative, mark backwards instead.
7672 The difference between N and the actual number of articles marked is
7675 (gnus-summary-mark-forward n gnus-del-mark t))
7677 (defun gnus-summary-mark-as-read-backward (n)
7678 "Mark the N articles as read backwards.
7679 The difference between N and the actual number of articles marked is
7682 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7684 (defun gnus-summary-mark-as-read (&optional article mark)
7685 "Mark current article as read.
7686 ARTICLE specifies the article to be marked as read.
7687 MARK specifies a string to be inserted at the beginning of the line."
7688 (gnus-summary-mark-article article mark))
7690 (defun gnus-summary-clear-mark-forward (n)
7691 "Clear marks from N articles forward.
7692 If N is negative, clear backward instead.
7693 The difference between N and the number of marks cleared is returned."
7695 (gnus-summary-mark-forward n gnus-unread-mark))
7697 (defun gnus-summary-clear-mark-backward (n)
7698 "Clear marks from N articles backward.
7699 The difference between N and the number of marks cleared is returned."
7701 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7703 (defun gnus-summary-mark-unread-as-read ()
7704 "Intended to be used by `gnus-summary-mark-article-hook'."
7705 (when (memq gnus-current-article gnus-newsgroup-unreads)
7706 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7708 (defun gnus-summary-mark-read-and-unread-as-read ()
7709 "Intended to be used by `gnus-summary-mark-article-hook'."
7710 (let ((mark (gnus-summary-article-mark)))
7711 (when (or (gnus-unread-mark-p mark)
7712 (gnus-read-mark-p mark))
7713 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7715 (defun gnus-summary-mark-region-as-read (point mark all)
7716 "Mark all unread articles between point and mark as read.
7717 If given a prefix, mark all articles between point and mark as read,
7718 even ticked and dormant ones."
7719 (interactive "r\nP")
7728 (memq (setq article (gnus-summary-article-number))
7729 gnus-newsgroup-unreads))
7730 (gnus-summary-mark-article article gnus-del-mark))
7732 (gnus-summary-find-next))))))
7734 (defun gnus-summary-mark-below (score mark)
7735 "Mark articles with score less than SCORE with MARK."
7736 (interactive "P\ncMark: ")
7737 (gnus-set-global-variables)
7738 (setq score (if score
7739 (prefix-numeric-value score)
7740 (or gnus-summary-default-score 0)))
7742 (set-buffer gnus-summary-buffer)
7743 (goto-char (point-min))
7746 (and (< (gnus-summary-article-score) score)
7747 (gnus-summary-mark-article nil mark))
7748 (gnus-summary-find-next)))))
7750 (defun gnus-summary-kill-below (&optional score)
7751 "Mark articles with score below SCORE as read."
7753 (gnus-set-global-variables)
7754 (gnus-summary-mark-below score gnus-killed-mark))
7756 (defun gnus-summary-clear-above (&optional score)
7757 "Clear all marks from articles with score above SCORE."
7759 (gnus-set-global-variables)
7760 (gnus-summary-mark-above score gnus-unread-mark))
7762 (defun gnus-summary-tick-above (&optional score)
7763 "Tick all articles with score above SCORE."
7765 (gnus-set-global-variables)
7766 (gnus-summary-mark-above score gnus-ticked-mark))
7768 (defun gnus-summary-mark-above (score mark)
7769 "Mark articles with score over SCORE with MARK."
7770 (interactive "P\ncMark: ")
7771 (gnus-set-global-variables)
7772 (setq score (if score
7773 (prefix-numeric-value score)
7774 (or gnus-summary-default-score 0)))
7776 (set-buffer gnus-summary-buffer)
7777 (goto-char (point-min))
7779 (when (> (gnus-summary-article-score) score)
7780 (gnus-summary-mark-article nil mark))
7782 (gnus-summary-find-next)))))
7784 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7785 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7786 (defun gnus-summary-limit-include-expunged (&optional no-error)
7787 "Display all the hidden articles that were expunged for low scores."
7789 (gnus-set-global-variables)
7790 (let ((buffer-read-only nil))
7791 (let ((scored gnus-newsgroup-scored)
7794 (unless (gnus-summary-goto-subject (caar scored))
7795 (and (setq h (gnus-summary-article-header (caar scored)))
7796 (< (cdar scored) gnus-summary-expunge-below)
7798 (setq scored (cdr scored)))
7800 (when (not no-error)
7801 (error "No expunged articles hidden"))
7802 (goto-char (point-min))
7803 (gnus-summary-prepare-unthreaded (nreverse headers))
7804 (goto-char (point-min))
7805 (gnus-summary-position-point)
7808 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7809 "Mark all unread articles in this newsgroup as read.
7810 If prefix argument ALL is non-nil, ticked and dormant articles will
7811 also be marked as read.
7812 If QUIETLY is non-nil, no questions will be asked.
7813 If TO-HERE is non-nil, it should be a point in the buffer. All
7814 articles before this point will be marked as read.
7815 Note that this function will only catch up the unread article
7816 in the current summary buffer limitation.
7817 The number of articles marked as read is returned."
7819 (gnus-set-global-variables)
7823 (not gnus-interactive-catchup) ;Without confirmation?
7827 "Mark absolutely all articles as read? "
7828 "Mark all unread articles as read? ")))
7830 (not gnus-newsgroup-adaptive)
7831 (not gnus-newsgroup-auto-expire)
7832 (not gnus-suppress-duplicates)
7833 (or (not gnus-use-cache)
7834 (eq gnus-use-cache 'passive)))
7837 (setq gnus-newsgroup-marked nil
7838 gnus-newsgroup-dormant nil))
7839 (setq gnus-newsgroup-unreads nil))
7840 ;; We actually mark all articles as canceled, which we
7841 ;; have to do when using auto-expiry or adaptive scoring.
7842 (gnus-summary-show-all-threads)
7843 (when (gnus-summary-first-subject (not all))
7845 (if to-here (< (point) to-here) t)
7846 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7847 (gnus-summary-find-next (not all)))))
7848 (gnus-set-mode-line 'summary))
7850 (gnus-summary-position-point)))
7852 (defun gnus-summary-catchup-to-here (&optional all)
7853 "Mark all unticked articles before the current one as read.
7854 If ALL is non-nil, also mark ticked and dormant articles as read."
7856 (gnus-set-global-variables)
7858 (gnus-save-hidden-threads
7859 (let ((beg (point)))
7860 ;; We check that there are unread articles.
7861 (when (or all (gnus-summary-find-prev))
7862 (gnus-summary-catchup all t beg)))))
7863 (gnus-summary-position-point))
7865 (defun gnus-summary-catchup-all (&optional quietly)
7866 "Mark all articles in this newsgroup as read."
7868 (gnus-set-global-variables)
7869 (gnus-summary-catchup t quietly))
7871 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7872 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7873 If prefix argument ALL is non-nil, all articles are marked as read."
7875 (gnus-set-global-variables)
7876 (when (gnus-summary-catchup all quietly nil 'fast)
7877 ;; Select next newsgroup or exit.
7878 (if (eq gnus-auto-select-next 'quietly)
7879 (gnus-summary-next-group nil)
7880 (gnus-summary-exit))))
7882 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7883 "Mark all articles in this newsgroup as read, and then exit."
7885 (gnus-set-global-variables)
7886 (gnus-summary-catchup-and-exit t quietly))
7888 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7889 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7890 "Mark all articles in this group as read and select the next group.
7891 If given a prefix, mark all articles, unread as well as ticked, as
7894 (gnus-set-global-variables)
7896 (gnus-summary-catchup all))
7897 (gnus-summary-next-article t nil nil t))
7899 ;; Thread-based commands.
7901 (defun gnus-summary-articles-in-thread (&optional article)
7902 "Return a list of all articles in the current thread.
7903 If ARTICLE is non-nil, return all articles in the thread that starts
7905 (let* ((article (or article (gnus-summary-article-number)))
7906 (data (gnus-data-find-list article))
7907 (top-level (gnus-data-level (car data)))
7909 (cond ((null gnus-thread-operation-ignore-subject)
7910 (gnus-simplify-subject-re
7911 (mail-header-subject (gnus-data-header (car data)))))
7912 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7913 (gnus-simplify-subject-fuzzy
7914 (mail-header-subject (gnus-data-header (car data)))))
7916 (end-point (save-excursion
7917 (if (gnus-summary-go-to-next-thread)
7918 (point) (point-max))))
7921 (< (gnus-data-pos (car data)) end-point))
7922 (when (or (not top-subject)
7923 (string= top-subject
7924 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7925 (gnus-simplify-subject-fuzzy
7926 (mail-header-subject
7927 (gnus-data-header (car data))))
7928 (gnus-simplify-subject-re
7929 (mail-header-subject
7930 (gnus-data-header (car data)))))))
7931 (push (gnus-data-number (car data)) articles))
7932 (unless (and (setq data (cdr data))
7933 (> (gnus-data-level (car data)) top-level))
7935 ;; Return the list of articles.
7936 (nreverse articles)))
7938 (defun gnus-summary-rethread-current ()
7939 "Rethread the thread the current article is part of."
7941 (gnus-set-global-variables)
7942 (let* ((gnus-show-threads t)
7943 (article (gnus-summary-article-number))
7944 (id (mail-header-id (gnus-summary-article-header)))
7945 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7947 (error "No article on the current line"))
7948 (gnus-rebuild-thread id)
7949 (gnus-summary-goto-subject article)))
7951 (defun gnus-summary-reparent-thread ()
7952 "Make the current article child of the marked (or previous) article.
7954 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7955 is non-nil or the Subject: of both articles are the same."
7957 (unless (not (gnus-group-read-only-p))
7958 (error "The current newsgroup does not support article editing"))
7959 (unless (<= (length gnus-newsgroup-processable) 1)
7960 (error "No more than one article may be marked"))
7961 (save-window-excursion
7962 (let ((gnus-article-buffer " *reparent*")
7963 (current-article (gnus-summary-article-number))
7964 ;; First grab the marked article, otherwise one line up.
7965 (parent-article (if (not (null gnus-newsgroup-processable))
7966 (car gnus-newsgroup-processable)
7968 (if (eq (forward-line -1) 0)
7969 (gnus-summary-article-number)
7970 (error "Beginning of summary buffer"))))))
7971 (unless (not (eq current-article parent-article))
7972 (error "An article may not be self-referential"))
7973 (let ((message-id (mail-header-id
7974 (gnus-summary-article-header parent-article))))
7975 (unless (and message-id (not (equal message-id "")))
7976 (error "No message-id in desired parent"))
7977 (gnus-summary-select-article t t nil current-article)
7978 (set-buffer gnus-original-article-buffer)
7979 (let ((buf (format "%s" (buffer-string))))
7980 (nnheader-temp-write nil
7982 (goto-char (point-min))
7983 (if (search-forward-regexp "^References: " nil t)
7984 (insert message-id " " )
7985 (insert "References: " message-id "\n"))
7986 (unless (gnus-request-replace-article
7987 current-article (car gnus-article-current)
7989 (error "Couldn't replace article"))))
7990 (set-buffer gnus-summary-buffer)
7991 (gnus-summary-unmark-all-processable)
7992 (gnus-summary-rethread-current)
7993 (gnus-message 3 "Article %d is now the child of article %d"
7994 current-article parent-article)))))
7996 (defun gnus-summary-toggle-threads (&optional arg)
7997 "Toggle showing conversation threads.
7998 If ARG is positive number, turn showing conversation threads on."
8000 (gnus-set-global-variables)
8001 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8002 (setq gnus-show-threads
8003 (if (null arg) (not gnus-show-threads)
8004 (> (prefix-numeric-value arg) 0)))
8005 (gnus-summary-prepare)
8006 (gnus-summary-goto-subject current)
8007 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8008 (gnus-summary-position-point)))
8010 (defun gnus-summary-show-all-threads ()
8013 (gnus-set-global-variables)
8015 (let ((buffer-read-only nil))
8016 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8017 (gnus-summary-position-point))
8019 (defun gnus-summary-show-thread ()
8020 "Show thread subtrees.
8021 Returns nil if no thread was there to be shown."
8023 (gnus-set-global-variables)
8024 (let ((buffer-read-only nil)
8026 ;; first goto end then to beg, to have point at beg after let
8027 (end (progn (end-of-line) (point)))
8028 (beg (progn (beginning-of-line) (point))))
8030 ;; Any hidden lines here?
8031 (search-forward "\r" end t)
8032 (subst-char-in-region beg end ?\^M ?\n t)
8034 (gnus-summary-position-point))))
8036 (defun gnus-summary-hide-all-threads ()
8037 "Hide all thread subtrees."
8039 (gnus-set-global-variables)
8041 (goto-char (point-min))
8042 (gnus-summary-hide-thread)
8043 (while (zerop (gnus-summary-next-thread 1 t))
8044 (gnus-summary-hide-thread)))
8045 (gnus-summary-position-point))
8047 (defun gnus-summary-hide-thread ()
8048 "Hide thread subtrees.
8049 Returns nil if no threads were there to be hidden."
8051 (gnus-set-global-variables)
8052 (let ((buffer-read-only nil)
8054 (article (gnus-summary-article-number)))
8056 ;; Go forward until either the buffer ends or the subthread
8058 (when (and (not (eobp))
8059 (or (zerop (gnus-summary-next-thread 1 t))
8060 (goto-char (point-max))))
8062 (if (and (> (point) start)
8063 (search-backward "\n" start t))
8065 (subst-char-in-region start (point) ?\n ?\^M)
8066 (gnus-summary-goto-subject article))
8069 ;;(gnus-summary-position-point)
8072 (defun gnus-summary-go-to-next-thread (&optional previous)
8073 "Go to the same level (or less) next thread.
8074 If PREVIOUS is non-nil, go to previous thread instead.
8075 Return the article number moved to, or nil if moving was impossible."
8076 (let ((level (gnus-summary-thread-level))
8077 (way (if previous -1 1))
8080 (while (and (not (eobp))
8081 (< level (gnus-summary-thread-level)))
8089 (gnus-summary-article-number)
8092 (defun gnus-summary-next-thread (n &optional silent)
8093 "Go to the same level next N'th thread.
8094 If N is negative, search backward instead.
8095 Returns the difference between N and the number of skips actually
8098 If SILENT, don't output messages."
8100 (gnus-set-global-variables)
8101 (let ((backward (< n 0))
8104 (gnus-summary-go-to-next-thread backward))
8107 (gnus-summary-position-point))
8108 (when (and (not silent) (/= 0 n))
8109 (gnus-message 7 "No more threads"))
8112 (defun gnus-summary-prev-thread (n)
8113 "Go to the same level previous N'th thread.
8114 Returns the difference between N and the number of skips actually
8117 (gnus-set-global-variables)
8118 (gnus-summary-next-thread (- n)))
8120 (defun gnus-summary-go-down-thread ()
8121 "Go down one level in the current thread."
8122 (let ((children (gnus-summary-article-children)))
8124 (gnus-summary-goto-subject (car children)))))
8126 (defun gnus-summary-go-up-thread ()
8127 "Go up one level in the current thread."
8128 (let ((parent (gnus-summary-article-parent)))
8130 (gnus-summary-goto-subject parent))))
8132 (defun gnus-summary-down-thread (n)
8133 "Go down thread N steps.
8134 If N is negative, go up instead.
8135 Returns the difference between N and how many steps down that were
8138 (gnus-set-global-variables)
8142 (if up (gnus-summary-go-up-thread)
8143 (gnus-summary-go-down-thread)))
8145 (gnus-summary-position-point)
8147 (gnus-message 7 "Can't go further"))
8150 (defun gnus-summary-up-thread (n)
8151 "Go up thread N steps.
8152 If N is negative, go up instead.
8153 Returns the difference between N and how many steps down that were
8156 (gnus-set-global-variables)
8157 (gnus-summary-down-thread (- n)))
8159 (defun gnus-summary-top-thread ()
8160 "Go to the top of the thread."
8162 (gnus-set-global-variables)
8163 (while (gnus-summary-go-up-thread))
8164 (gnus-summary-article-number))
8166 (defun gnus-summary-kill-thread (&optional unmark)
8167 "Mark articles under current thread as read.
8168 If the prefix argument is positive, remove any kinds of marks.
8169 If the prefix argument is negative, tick articles instead."
8171 (gnus-set-global-variables)
8173 (setq unmark (prefix-numeric-value unmark)))
8174 (let ((articles (gnus-summary-articles-in-thread)))
8176 ;; Expand the thread.
8177 (gnus-summary-show-thread)
8178 ;; Mark all the articles.
8180 (gnus-summary-goto-subject (car articles))
8181 (cond ((null unmark)
8182 (gnus-summary-mark-article-as-read gnus-killed-mark))
8184 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8186 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8187 (setq articles (cdr articles))))
8188 ;; Hide killed subtrees.
8190 gnus-thread-hide-killed
8191 (gnus-summary-hide-thread))
8192 ;; If marked as read, go to next unread subject.
8194 ;; Go to next unread subject.
8195 (gnus-summary-next-subject 1 t)))
8196 (gnus-set-mode-line 'summary))
8198 ;; Summary sorting commands
8200 (defun gnus-summary-sort-by-number (&optional reverse)
8201 "Sort the summary buffer by article number.
8202 Argument REVERSE means reverse order."
8204 (gnus-summary-sort 'number reverse))
8206 (defun gnus-summary-sort-by-author (&optional reverse)
8207 "Sort the summary buffer by author name alphabetically.
8208 If case-fold-search is non-nil, case of letters is ignored.
8209 Argument REVERSE means reverse order."
8211 (gnus-summary-sort 'author reverse))
8213 (defun gnus-summary-sort-by-subject (&optional reverse)
8214 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8215 If case-fold-search is non-nil, case of letters is ignored.
8216 Argument REVERSE means reverse order."
8218 (gnus-summary-sort 'subject reverse))
8220 (defun gnus-summary-sort-by-date (&optional reverse)
8221 "Sort the summary buffer by date.
8222 Argument REVERSE means reverse order."
8224 (gnus-summary-sort 'date reverse))
8226 (defun gnus-summary-sort-by-score (&optional reverse)
8227 "Sort the summary buffer by score.
8228 Argument REVERSE means reverse order."
8230 (gnus-summary-sort 'score reverse))
8232 (defun gnus-summary-sort-by-lines (&optional reverse)
8233 "Sort the summary buffer by article length.
8234 Argument REVERSE means reverse order."
8236 (gnus-summary-sort 'lines reverse))
8238 (defun gnus-summary-sort (predicate reverse)
8239 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8240 (gnus-set-global-variables)
8241 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8242 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8243 (gnus-thread-sort-functions
8249 (gnus-article-sort-functions
8254 (,article t2 t1)))))
8256 (gnus-summary-prepare-hook nil))
8257 ;; We do the sorting by regenerating the threads.
8258 (gnus-summary-prepare)
8259 ;; Hide subthreads if needed.
8260 (when (and gnus-show-threads gnus-thread-hide-subtree)
8261 (gnus-summary-hide-all-threads))))
8263 ;; Summary saving commands.
8265 (defun gnus-summary-save-article (&optional n not-saved)
8266 "Save the current article using the default saver function.
8267 If N is a positive number, save the N next articles.
8268 If N is a negative number, save the N previous articles.
8269 If N is nil and any articles have been marked with the process mark,
8270 save those articles instead.
8271 The variable `gnus-default-article-saver' specifies the saver function."
8273 (gnus-set-global-variables)
8274 (let* ((articles (gnus-summary-work-articles n))
8275 (save-buffer (save-excursion
8276 (nnheader-set-temp-buffer " *Gnus Save*")))
8277 (num (length articles))
8278 header article file)
8280 (setq header (gnus-summary-article-header
8281 (setq article (pop articles))))
8282 (if (not (vectorp header))
8283 ;; This is a pseudo-article.
8284 (if (assq 'name header)
8285 (gnus-copy-file (cdr (assq 'name header)))
8286 (gnus-message 1 "Article %d is unsaveable" article))
8287 ;; This is a real article.
8288 (save-window-excursion
8289 (gnus-summary-select-article t nil nil article))
8291 (set-buffer save-buffer)
8293 (insert-buffer-substring gnus-original-article-buffer))
8294 (setq file (gnus-article-save save-buffer file num))
8295 (gnus-summary-remove-process-mark article)
8297 (gnus-summary-set-saved-mark article))))
8298 (gnus-kill-buffer save-buffer)
8299 (gnus-summary-position-point)
8300 (gnus-set-mode-line 'summary)
8303 (defun gnus-summary-pipe-output (&optional arg)
8304 "Pipe the current article to a subprocess.
8305 If N is a positive number, pipe the N next articles.
8306 If N is a negative number, pipe the N previous articles.
8307 If N is nil and any articles have been marked with the process mark,
8308 pipe those articles instead."
8310 (gnus-set-global-variables)
8311 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8312 (gnus-summary-save-article arg t))
8313 (gnus-configure-windows 'pipe))
8315 (defun gnus-summary-save-article-mail (&optional arg)
8316 "Append the current article to an mail file.
8317 If N is a positive number, save the N next articles.
8318 If N is a negative number, save the N previous articles.
8319 If N is nil and any articles have been marked with the process mark,
8320 save those articles instead."
8322 (gnus-set-global-variables)
8323 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8324 (gnus-summary-save-article arg)))
8326 (defun gnus-summary-save-article-rmail (&optional arg)
8327 "Append the current article to an rmail file.
8328 If N is a positive number, save the N next articles.
8329 If N is a negative number, save the N previous articles.
8330 If N is nil and any articles have been marked with the process mark,
8331 save those articles instead."
8333 (gnus-set-global-variables)
8334 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8335 (gnus-summary-save-article arg)))
8337 (defun gnus-summary-save-article-file (&optional arg)
8338 "Append the current article to a file.
8339 If N is a positive number, save the N next articles.
8340 If N is a negative number, save the N previous articles.
8341 If N is nil and any articles have been marked with the process mark,
8342 save those articles instead."
8344 (gnus-set-global-variables)
8345 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8346 (gnus-summary-save-article arg)))
8348 (defun gnus-summary-write-article-file (&optional arg)
8349 "Write the current article to a file, deleting the previous file.
8350 If N is a positive number, save the N next articles.
8351 If N is a negative number, save the N previous articles.
8352 If N is nil and any articles have been marked with the process mark,
8353 save those articles instead."
8355 (gnus-set-global-variables)
8356 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8357 (gnus-summary-save-article arg)))
8359 (defun gnus-summary-save-article-body-file (&optional arg)
8360 "Append the current article body to a file.
8361 If N is a positive number, save the N next articles.
8362 If N is a negative number, save the N previous articles.
8363 If N is nil and any articles have been marked with the process mark,
8364 save those articles instead."
8366 (gnus-set-global-variables)
8367 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8368 (gnus-summary-save-article arg)))
8370 (defun gnus-summary-pipe-message (program)
8371 "Pipe the current article through PROGRAM."
8372 (interactive "sProgram: ")
8373 (gnus-set-global-variables)
8374 (gnus-summary-select-article)
8375 (let ((mail-header-separator "")
8376 (art-buf (get-buffer gnus-article-buffer)))
8377 (gnus-eval-in-buffer-window gnus-article-buffer
8380 (let ((start (window-start))
8382 (message-pipe-buffer-body program)
8383 (set-window-start (get-buffer-window (current-buffer)) start))))))
8385 (defun gnus-get-split-value (methods)
8386 "Return a value based on the split METHODS."
8387 (let (split-name method result match)
8390 (set-buffer gnus-original-article-buffer)
8392 (nnheader-narrow-to-headers)
8394 (goto-char (point-min))
8395 (setq method (pop methods))
8396 (setq match (car method))
8399 ;; Regular expression.
8401 (re-search-forward match nil t)))
8402 ((gnus-functionp match)
8406 (setq result (funcall match gnus-newsgroup-name))))
8411 (setq result (eval match)))))
8412 (setq split-name (append (cdr method) split-name))
8413 (cond ((stringp result)
8414 (push (expand-file-name
8415 result gnus-article-save-directory)
8418 (setq split-name (append result split-name)))))))))
8421 (defun gnus-valid-move-group-p (group)
8426 (car (gnus-find-method-for-group
8427 (symbol-name group))))
8428 gnus-valid-select-methods))))
8430 (defun gnus-read-move-group-name (prompt default articles prefix)
8431 "Read a group name."
8432 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8433 (minibuffer-confirm-incomplete nil) ; XEmacs
8437 (if (> (length articles) 1)
8438 (format "these %d articles" (length articles))
8443 (gnus-completing-read default prom
8445 'gnus-valid-move-group-p
8447 'gnus-group-history))
8448 ((= 1 (length split-name))
8449 (gnus-completing-read (car split-name) prom
8451 'gnus-valid-move-group-p
8453 'gnus-group-history))
8455 (gnus-completing-read nil prom
8456 (mapcar (lambda (el) (list el))
8457 (nreverse split-name))
8459 'gnus-group-history)))))
8461 (if (or (string= to-newsgroup "")
8462 (string= to-newsgroup prefix))
8463 (setq to-newsgroup default))
8464 (unless to-newsgroup
8465 (error "No group name entered"))
8466 (or (gnus-active to-newsgroup)
8467 (gnus-activate-group to-newsgroup)
8468 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8470 (or (and (gnus-request-create-group
8471 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8472 (gnus-activate-group to-newsgroup nil nil
8473 (gnus-group-name-to-method
8475 (error "Couldn't create group %s" to-newsgroup)))
8476 (error "No such group: %s" to-newsgroup)))
8479 ;; Summary extract commands
8481 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8482 (let ((buffer-read-only nil)
8483 (article (gnus-summary-article-number))
8485 (unless (gnus-summary-goto-subject article)
8486 (error "No such article: %d" article))
8487 (gnus-summary-position-point)
8488 ;; If all commands are to be bunched up on one line, we collect
8490 (unless gnus-view-pseudos-separately
8491 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8494 (setq action (cdr (assq 'action (car ps))))
8495 (setq files (list (cdr (assq 'name (car ps)))))
8496 (while (and ps (cdr ps)
8497 (string= (or action "1")
8498 (or (cdr (assq 'action (cadr ps))) "2")))
8499 (push (cdr (assq 'name (cadr ps))) files)
8500 (setcdr ps (cddr ps)))
8502 (when (not (string-match "%s" action))
8505 (when (assq 'execute (car ps))
8506 (setcdr (assq 'execute (car ps))
8507 (funcall (if (string-match "%s" action)
8514 (gnus-quote-arg-for-sh-or-csh f)))
8516 (setq ps (cdr ps)))))
8517 (if (and gnus-view-pseudos (not not-view))
8519 (when (assq 'execute (car pslist))
8520 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8521 (eq gnus-view-pseudos 'not-confirm)))
8522 (setq pslist (cdr pslist)))
8525 (setq after-article (or (cdr (assq 'article (car pslist)))
8526 (gnus-summary-article-number)))
8527 (gnus-summary-goto-subject after-article)
8530 (insert " " (file-name-nondirectory
8531 (cdr (assq 'name (car pslist))))
8532 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8534 (forward-line -1) ; back to `b'
8535 (gnus-add-text-properties
8536 b (1- e) (list 'gnus-number gnus-reffed-article-number
8537 gnus-mouse-face-prop gnus-mouse-face))
8539 after-article gnus-reffed-article-number
8540 gnus-unread-mark b (car pslist) 0 (- e b))
8541 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8542 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8543 (setq pslist (cdr pslist)))))))
8545 (defun gnus-pseudos< (p1 p2)
8546 (let ((c1 (cdr (assq 'action p1)))
8547 (c2 (cdr (assq 'action p2))))
8548 (and c1 c2 (string< c1 c2))))
8550 (defun gnus-request-pseudo-article (props)
8551 (cond ((assq 'execute props)
8552 (gnus-execute-command (cdr (assq 'execute props)))))
8553 (let ((gnus-current-article (gnus-summary-article-number)))
8554 (run-hooks 'gnus-mark-article-hook)))
8556 (defun gnus-execute-command (command &optional automatic)
8558 (gnus-article-setup-buffer)
8559 (set-buffer gnus-article-buffer)
8560 (setq buffer-read-only nil)
8561 (let ((command (if automatic command
8562 (read-string "Command: " (cons command 0)))))
8564 (insert "$ " command "\n\n")
8565 (if gnus-view-pseudo-asynchronously
8566 (start-process "gnus-execute" (current-buffer) shell-file-name
8567 shell-command-switch command)
8568 (call-process shell-file-name nil t nil
8569 shell-command-switch command)))))
8571 ;; Summary kill commands.
8573 (defun gnus-summary-edit-global-kill (article)
8574 "Edit the \"global\" kill file."
8575 (interactive (list (gnus-summary-article-number)))
8576 (gnus-set-global-variables)
8577 (gnus-group-edit-global-kill article))
8579 (defun gnus-summary-edit-local-kill ()
8580 "Edit a local kill file applied to the current newsgroup."
8582 (gnus-set-global-variables)
8583 (setq gnus-current-headers (gnus-summary-article-header))
8584 (gnus-set-global-variables)
8585 (gnus-group-edit-local-kill
8586 (gnus-summary-article-number) gnus-newsgroup-name))
8590 (defun gnus-read-header (id &optional header)
8591 "Read the headers of article ID and enter them into the Gnus system."
8592 (let ((group gnus-newsgroup-name)
8593 (gnus-override-method
8594 (and (gnus-news-group-p gnus-newsgroup-name)
8595 gnus-refer-article-method))
8597 ;; First we check to see whether the header in question is already
8600 ;; This is a Message-ID.
8601 (setq header (or header (gnus-id-to-header id)))
8602 ;; This is an article number.
8603 (setq header (or header (gnus-summary-article-header id))))
8605 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8606 ;; We have found the header.
8608 ;; We have to really fetch the header to this article.
8610 (set-buffer nntp-server-buffer)
8611 (when (setq where (gnus-request-head id group))
8612 (nnheader-fold-continuation-lines)
8613 (goto-char (point-max))
8615 (goto-char (point-min))
8619 ((cdr where) (cdr where))
8620 (header (mail-header-number header))
8621 (t gnus-reffed-article-number))
8623 (insert " Article retrieved.\n"))
8625 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8626 () ; Malformed head.
8627 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8628 (when (and (stringp id)
8629 (not (string= (gnus-group-real-name group)
8631 ;; If we fetched by Message-ID and the article came
8632 ;; from a different group, we fudge some bogus article
8633 ;; numbers for this article.
8634 (mail-header-set-number header gnus-reffed-article-number))
8636 (set-buffer gnus-summary-buffer)
8637 (decf gnus-reffed-article-number)
8638 (gnus-remove-header (mail-header-number header))
8639 (push header gnus-newsgroup-headers)
8640 (setq gnus-current-headers header)
8641 (push (mail-header-number header) gnus-newsgroup-limit)))
8644 (defun gnus-remove-header (number)
8645 "Remove header NUMBER from `gnus-newsgroup-headers'."
8646 (if (and gnus-newsgroup-headers
8647 (= number (mail-header-number (car gnus-newsgroup-headers))))
8648 (pop gnus-newsgroup-headers)
8649 (let ((headers gnus-newsgroup-headers))
8650 (while (and (cdr headers)
8651 (not (= number (mail-header-number (cadr headers)))))
8654 (setcdr headers (cddr headers))))))
8657 ;;; summary highlights
8660 (defun gnus-highlight-selected-summary ()
8661 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8662 ;; Highlight selected article in summary buffer
8663 (when gnus-summary-selected-face
8665 (let* ((beg (progn (beginning-of-line) (point)))
8666 (end (progn (end-of-line) (point)))
8667 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8668 (from (if (get-text-property beg gnus-mouse-face-prop)
8670 (or (next-single-property-change
8671 beg gnus-mouse-face-prop nil end)
8676 (or (next-single-property-change
8677 from gnus-mouse-face-prop nil end)
8679 ;; If no mouse-face prop on line we will have to = from = end,
8680 ;; so we highlight the entire line instead.
8681 (when (= (+ to 2) from)
8684 (if gnus-newsgroup-selected-overlay
8685 ;; Move old overlay.
8687 gnus-newsgroup-selected-overlay from to (current-buffer))
8688 ;; Create new overlay.
8690 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8691 'face gnus-summary-selected-face))))))
8693 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8694 (defun gnus-summary-highlight-line ()
8695 "Highlight current line according to `gnus-summary-highlight'."
8696 (let* ((list gnus-summary-highlight)
8698 (end (progn (end-of-line) (point)))
8699 ;; now find out where the line starts and leave point there.
8700 (beg (progn (beginning-of-line) (point)))
8701 (article (gnus-summary-article-number))
8702 (score (or (cdr (assq (or article gnus-current-article)
8703 gnus-newsgroup-scored))
8704 gnus-summary-default-score 0))
8705 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8706 (inhibit-read-only t))
8707 ;; Eval the cars of the lists until we find a match.
8708 (let ((default gnus-summary-default-score))
8710 (not (eval (caar list))))
8711 (setq list (cdr list))))
8712 (let ((face (cdar list)))
8713 (unless (eq face (get-text-property beg 'face))
8714 (gnus-put-text-property
8716 (setq face (if (boundp face) (symbol-value face) face)))
8717 (when gnus-summary-highlight-line-function
8718 (funcall gnus-summary-highlight-line-function article face))))
8721 (defun gnus-update-read-articles (group unread &optional compute)
8722 "Update the list of read articles in GROUP."
8723 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8724 (entry (gnus-gethash group gnus-newsrc-hashtb))
8725 (info (nth 2 entry))
8727 (unread (sort (copy-sequence unread) '<))
8729 (if (or (not info) (not active))
8730 ;; There is no info on this group if it was, in fact,
8731 ;; killed. Gnus stores no information on killed groups, so
8732 ;; there's nothing to be done.
8733 ;; One could store the information somewhere temporarily,
8734 ;; perhaps... Hmmm...
8736 ;; Remove any negative articles numbers.
8737 (while (and unread (< (car unread) 0))
8738 (setq unread (cdr unread)))
8739 ;; Remove any expired article numbers
8740 (while (and unread (< (car unread) (car active)))
8741 (setq unread (cdr unread)))
8742 ;; Compute the ranges of read articles by looking at the list of
8745 (when (/= (car unread) prev)
8746 (push (if (= prev (1- (car unread))) prev
8747 (cons prev (1- (car unread))))
8749 (setq prev (1+ (car unread)))
8750 (setq unread (cdr unread)))
8751 (when (<= prev (cdr active))
8752 (push (cons prev (cdr active)) read))
8754 (if (> (length read) 1) (nreverse read) read)
8756 (set-buffer gnus-group-buffer)
8759 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8760 (gnus-info-set-read ',info ',(gnus-info-read info))
8761 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8762 (gnus-group-update-group ,group t))))
8763 ;; Enter this list into the group info.
8765 info (if (> (length read) 1) (nreverse read) read))
8766 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8767 (gnus-get-unread-articles-in-group info (gnus-active group))
8770 (defun gnus-offer-save-summaries ()
8771 "Offer to save all active summary buffers."
8773 (let ((buflist (buffer-list))
8775 ;; Go through all buffers and find all summaries.
8777 (and (setq bufname (buffer-name (car buflist)))
8778 (string-match "Summary" bufname)
8780 (set-buffer bufname)
8781 ;; We check that this is, indeed, a summary buffer.
8782 (and (eq major-mode 'gnus-summary-mode)
8783 ;; Also make sure this isn't bogus.
8784 gnus-newsgroup-prepared
8785 ;; Also make sure that this isn't a dead summary buffer.
8786 (not gnus-dead-summary-mode)))
8787 (push bufname buffers))
8788 (setq buflist (cdr buflist)))
8789 ;; Go through all these summary buffers and offer to save them.
8792 "Update summary buffer %s? "
8793 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8800 (run-hooks 'gnus-sum-load-hook)
8802 ;;; gnus-sum.el ends here