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 (unless (string= (setq new-child (buffer-substring (point) end))
2887 (push (list (incf generation)
2888 child (setq child new-child)
2891 (push (list (1+ generation) child nil subject) relations)
2893 (kill-buffer (current-buffer)))
2894 ;; Sort over trustworthiness.
2895 (setq relations (sort relations 'car-less-than-car))
2896 (while (setq relation (pop relations))
2897 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2898 (unless (car (symbol-value cthread))
2899 ;; Make this article the parent of these threads.
2900 (setcar (symbol-value cthread)
2901 (vector gnus-reffed-article-number
2905 (or (caddr relation) "") 0 0 "")))
2906 (set cthread (list (vector gnus-reffed-article-number
2908 "" "" (cadr relation)
2909 (or (caddr relation) "") 0 0 ""))))
2910 (push gnus-reffed-article-number gnus-newsgroup-limit)
2911 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2912 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2913 gnus-newsgroup-reads)
2914 (decf gnus-reffed-article-number)
2915 ;; Make this new thread the child of its parent.
2916 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2917 (setcdr (symbol-value pthread)
2918 (nconc (cdr (symbol-value pthread))
2919 (list (symbol-value cthread))))
2920 (set pthread (list nil (symbol-value cthread))))))
2921 (gnus-message 7 "Making sparse threads...done")))
2923 (defun gnus-build-old-threads ()
2924 ;; Look at all the articles that refer back to old articles, and
2925 ;; fetch the headers for the articles that aren't there. This will
2926 ;; build complete threads - if the roots haven't been expired by the
2931 (when (not (car (symbol-value refs)))
2932 (setq heads (cdr (symbol-value refs)))
2934 (if (memq (mail-header-number (caar heads))
2935 gnus-newsgroup-dormant)
2936 (setq heads (cdr heads))
2937 (setq id (symbol-name refs))
2938 (while (and (setq id (gnus-build-get-header id))
2939 (not (car (gnus-gethash
2940 id gnus-newsgroup-dependencies)))))
2941 (setq heads nil)))))
2942 gnus-newsgroup-dependencies)))
2944 (defun gnus-build-get-header (id)
2945 ;; Look through the buffer of NOV lines and find the header to
2946 ;; ID. Enter this line into the dependencies hash table, and return
2947 ;; the id of the parent article (if any).
2948 (let ((deps gnus-newsgroup-dependencies)
2952 (set-buffer nntp-server-buffer)
2953 (let ((case-fold-search nil))
2954 (goto-char (point-min))
2955 (while (and (not found)
2956 (search-forward id nil t))
2958 (setq found (looking-at
2959 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2960 (regexp-quote id))))
2961 (or found (beginning-of-line 2)))
2965 (setq header (gnus-nov-parse-line
2966 (read (current-buffer)) deps))
2967 (gnus-parent-id (mail-header-references header))))))
2969 (let ((number (mail-header-number header)))
2970 (push number gnus-newsgroup-limit)
2971 (push header gnus-newsgroup-headers)
2972 (if (memq number gnus-newsgroup-unselected)
2974 (push number gnus-newsgroup-unreads)
2975 (setq gnus-newsgroup-unselected
2976 (delq number gnus-newsgroup-unselected)))
2977 (push number gnus-newsgroup-ancient)))))))
2979 (defun gnus-summary-update-article-line (article header)
2980 "Update the line for ARTICLE using HEADERS."
2981 (let* ((id (mail-header-id header))
2982 (thread (gnus-id-to-thread id)))
2984 (error "Article in no thread"))
2985 ;; Update the thread.
2986 (setcar thread header)
2987 (gnus-summary-goto-subject article)
2988 (let* ((datal (gnus-data-find-list article))
2990 (length (when (cdr datal)
2991 (- (gnus-data-pos data)
2992 (gnus-data-pos (cadr datal)))))
2993 (buffer-read-only nil)
2994 (level (gnus-summary-thread-level)))
2996 (gnus-summary-insert-line
2997 header level nil (gnus-article-mark article)
2998 (memq article gnus-newsgroup-replied)
2999 (memq article gnus-newsgroup-expirable)
3000 ;; Only insert the Subject string when it's different
3001 ;; from the previous Subject string.
3002 (if (gnus-subject-equal
3004 (mail-header-subject
3007 (gnus-data-find-list
3009 (gnus-data-list t)))))
3010 ;; Error on the side of excessive subjects.
3012 (mail-header-subject header))
3014 (mail-header-subject header))
3015 nil (cdr (assq article gnus-newsgroup-scored))
3016 (memq article gnus-newsgroup-processable))
3018 (gnus-data-update-list
3019 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3021 (defun gnus-summary-update-article (article &optional iheader)
3022 "Update ARTICLE in the summary buffer."
3023 (set-buffer gnus-summary-buffer)
3024 (let* ((header (or iheader (gnus-summary-article-header article)))
3025 (id (mail-header-id header))
3026 (data (gnus-data-find article))
3027 (thread (gnus-id-to-thread id))
3028 (references (mail-header-references header))
3032 (when (and references
3033 (not (equal "" references)))
3036 (buffer-read-only nil)
3038 (number (mail-header-number header))
3041 ;; !!! Should this be in or not?
3043 (setcar thread nil))
3045 (delq thread parent))
3046 (if (gnus-summary-insert-subject id header iheader)
3047 ;; Set the (possibly) new article number in the data structure.
3048 (gnus-data-set-number data (gnus-id-to-article id))
3052 (defun gnus-rebuild-thread (id)
3053 "Rebuild the thread containing ID."
3054 (let ((buffer-read-only nil)
3055 old-pos current thread data)
3056 (if (not gnus-show-threads)
3057 (setq thread (list (car (gnus-id-to-thread id))))
3058 ;; Get the thread this article is part of.
3059 (setq thread (gnus-remove-thread id)))
3060 (setq old-pos (gnus-point-at-bol))
3061 (setq current (save-excursion
3062 (and (zerop (forward-line -1))
3063 (gnus-summary-article-number))))
3064 ;; If this is a gathered thread, we have to go some re-gathering.
3065 (when (stringp (car thread))
3066 (let ((subject (car thread))
3068 (setq thread (cdr thread))
3070 (unless (memq (setq thr (gnus-id-to-thread
3072 (mail-header-id (caar thread)))))
3075 (setq thread (cdr thread)))
3076 ;; We now have all (unique) roots.
3077 (if (= (length roots) 1)
3078 ;; All the loose roots are now one solid root.
3079 (setq thread (car roots))
3080 (setq thread (cons subject (gnus-sort-threads roots))))))
3082 ;; We then insert this thread into the summary buffer.
3083 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3084 (if gnus-show-threads
3085 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3086 (gnus-summary-prepare-unthreaded thread))
3087 (setq data (nreverse gnus-newsgroup-data))
3088 (setq threads gnus-newsgroup-threads))
3089 ;; We splice the new data into the data structure.
3090 (gnus-data-enter-list current data (- (point) old-pos))
3091 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3093 (defun gnus-number-to-header (number)
3094 "Return the header for article NUMBER."
3095 (let ((headers gnus-newsgroup-headers))
3097 (not (= number (mail-header-number (car headers)))))
3102 (defun gnus-parent-headers (headers &optional generation)
3103 "Return the headers of the GENERATIONeth parent of HEADERS."
3105 (setq generation 1))
3108 (while (and parent headers (not (zerop generation)))
3109 (setq references (mail-header-references headers))
3110 (when (and references
3111 (setq parent (gnus-parent-id references))
3112 (setq headers (car (gnus-id-to-thread parent))))
3116 (defun gnus-id-to-thread (id)
3117 "Return the (sub-)thread where ID appears."
3118 (gnus-gethash id gnus-newsgroup-dependencies))
3120 (defun gnus-id-to-article (id)
3121 "Return the article number of ID."
3122 (let ((thread (gnus-id-to-thread id)))
3125 (mail-header-number (car thread)))))
3127 (defun gnus-id-to-header (id)
3128 "Return the article headers of ID."
3129 (car (gnus-id-to-thread id)))
3131 (defun gnus-article-displayed-root-p (article)
3132 "Say whether ARTICLE is a root(ish) article."
3133 (let ((level (gnus-summary-thread-level article))
3134 (refs (mail-header-references (gnus-summary-article-header article)))
3140 ((null (gnus-parent-id refs)) t)
3142 (null (setq particle (gnus-id-to-article
3143 (gnus-parent-id refs))))
3144 (null (gnus-summary-thread-level particle)))))))
3146 (defun gnus-root-id (id)
3147 "Return the id of the root of the thread where ID appears."
3149 (while (and id (setq prev (car (gnus-gethash
3150 id gnus-newsgroup-dependencies))))
3152 id (gnus-parent-id (mail-header-references prev))))
3155 (defun gnus-remove-thread (id &optional dont-remove)
3156 "Remove the thread that has ID in it."
3157 (let ((dep gnus-newsgroup-dependencies)
3158 headers thread last-id)
3159 ;; First go up in this thread until we find the root.
3160 (setq last-id (gnus-root-id id))
3161 (setq headers (list (car (gnus-id-to-thread last-id))
3162 (caadr (gnus-id-to-thread last-id))))
3163 ;; We have now found the real root of this thread. It might have
3164 ;; been gathered into some loose thread, so we have to search
3165 ;; through the threads to find the thread we wanted.
3166 (let ((threads gnus-newsgroup-threads)
3169 (setq sub (car threads))
3170 (if (stringp (car sub))
3171 ;; This is a gathered thread, so we look at the roots
3172 ;; below it to find whether this article is in this
3175 (setq sub (cdr sub))
3177 (when (member (caar sub) headers)
3178 (setq thread (car threads)
3181 (setq sub (cdr sub))))
3182 ;; It's an ordinary thread, so we check it.
3183 (when (eq (car sub) (car headers))
3186 (setq threads (cdr threads)))
3187 ;; If this article is in no thread, then it's a root.
3190 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3191 (setq thread (gnus-gethash last-id dep)))
3194 thread ; We return this thread.
3196 (if (stringp (car thread))
3198 ;; If we use dummy roots, then we have to remove the
3199 ;; dummy root as well.
3200 (when (eq gnus-summary-make-false-root 'dummy)
3202 (gnus-data-compute-positions))
3203 (setq thread (cdr thread))
3205 (gnus-remove-thread-1 (car thread))
3206 (setq thread (cdr thread))))
3207 (gnus-remove-thread-1 thread))))))))
3209 (defun gnus-remove-thread-1 (thread)
3210 "Remove the thread THREAD recursively."
3211 (let ((number (mail-header-number (pop thread)))
3213 (setq thread (reverse thread))
3215 (gnus-remove-thread-1 (pop thread)))
3216 (when (setq d (gnus-data-find number))
3217 (goto-char (gnus-data-pos d))
3220 (- (gnus-point-at-bol)
3222 (1+ (gnus-point-at-eol))
3223 (gnus-delete-line)))))))
3225 (defun gnus-sort-threads (threads)
3227 (if (not gnus-thread-sort-functions)
3229 (gnus-message 7 "Sorting threads...")
3231 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3232 (gnus-message 7 "Sorting threads...done"))))
3234 (defun gnus-sort-articles (articles)
3236 (when gnus-article-sort-functions
3237 (gnus-message 7 "Sorting articles...")
3239 (setq gnus-newsgroup-headers
3240 (sort articles (gnus-make-sort-function
3241 gnus-article-sort-functions)))
3242 (gnus-message 7 "Sorting articles...done"))))
3244 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3245 (defmacro gnus-thread-header (thread)
3246 ;; Return header of first article in THREAD.
3247 ;; Note that THREAD must never, ever be anything else than a variable -
3248 ;; using some other form will lead to serious barfage.
3249 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3250 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3251 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3254 (defsubst gnus-article-sort-by-number (h1 h2)
3255 "Sort articles by article number."
3256 (< (mail-header-number h1)
3257 (mail-header-number h2)))
3259 (defun gnus-thread-sort-by-number (h1 h2)
3260 "Sort threads by root article number."
3261 (gnus-article-sort-by-number
3262 (gnus-thread-header h1) (gnus-thread-header h2)))
3264 (defsubst gnus-article-sort-by-lines (h1 h2)
3265 "Sort articles by article Lines header."
3266 (< (mail-header-lines h1)
3267 (mail-header-lines h2)))
3269 (defun gnus-thread-sort-by-lines (h1 h2)
3270 "Sort threads by root article Lines header."
3271 (gnus-article-sort-by-lines
3272 (gnus-thread-header h1) (gnus-thread-header h2)))
3274 (defsubst gnus-article-sort-by-author (h1 h2)
3275 "Sort articles by root author."
3277 (let ((extract (funcall
3278 gnus-extract-address-components
3279 (mail-header-from h1))))
3280 (or (car extract) (cadr extract) ""))
3281 (let ((extract (funcall
3282 gnus-extract-address-components
3283 (mail-header-from h2))))
3284 (or (car extract) (cadr extract) ""))))
3286 (defun gnus-thread-sort-by-author (h1 h2)
3287 "Sort threads by root author."
3288 (gnus-article-sort-by-author
3289 (gnus-thread-header h1) (gnus-thread-header h2)))
3291 (defsubst gnus-article-sort-by-subject (h1 h2)
3292 "Sort articles by root subject."
3294 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3295 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3297 (defun gnus-thread-sort-by-subject (h1 h2)
3298 "Sort threads by root subject."
3299 (gnus-article-sort-by-subject
3300 (gnus-thread-header h1) (gnus-thread-header h2)))
3302 (defsubst gnus-article-sort-by-date (h1 h2)
3303 "Sort articles by root article date."
3305 (gnus-date-get-time (mail-header-date h1))
3306 (gnus-date-get-time (mail-header-date h2))))
3308 (defun gnus-thread-sort-by-date (h1 h2)
3309 "Sort threads by root article date."
3310 (gnus-article-sort-by-date
3311 (gnus-thread-header h1) (gnus-thread-header h2)))
3313 (defsubst gnus-article-sort-by-score (h1 h2)
3314 "Sort articles by root article score.
3315 Unscored articles will be counted as having a score of zero."
3316 (> (or (cdr (assq (mail-header-number h1)
3317 gnus-newsgroup-scored))
3318 gnus-summary-default-score 0)
3319 (or (cdr (assq (mail-header-number h2)
3320 gnus-newsgroup-scored))
3321 gnus-summary-default-score 0)))
3323 (defun gnus-thread-sort-by-score (h1 h2)
3324 "Sort threads by root article score."
3325 (gnus-article-sort-by-score
3326 (gnus-thread-header h1) (gnus-thread-header h2)))
3328 (defun gnus-thread-sort-by-total-score (h1 h2)
3329 "Sort threads by the sum of all scores in the thread.
3330 Unscored articles will be counted as having a score of zero."
3331 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3333 (defun gnus-thread-total-score (thread)
3334 ;; This function find the total score of THREAD.
3335 (cond ((null thread)
3338 (if (stringp (car thread))
3339 (apply gnus-thread-score-function 0
3340 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3341 (gnus-thread-total-score-1 thread)))
3343 (gnus-thread-total-score-1 (list thread)))))
3345 (defun gnus-thread-total-score-1 (root)
3346 ;; This function find the total score of the thread below ROOT.
3347 (setq root (car root))
3348 (apply gnus-thread-score-function
3350 (mapcar 'gnus-thread-total-score
3351 (cdr (gnus-gethash (mail-header-id root)
3352 gnus-newsgroup-dependencies)))
3353 (when (> (mail-header-number root) 0)
3354 (list (or (cdr (assq (mail-header-number root)
3355 gnus-newsgroup-scored))
3356 gnus-summary-default-score 0))))
3357 (list gnus-summary-default-score)
3360 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3361 (defvar gnus-tmp-prev-subject nil)
3362 (defvar gnus-tmp-false-parent nil)
3363 (defvar gnus-tmp-root-expunged nil)
3364 (defvar gnus-tmp-dummy-line nil)
3366 (defun gnus-summary-prepare-threads (threads)
3367 "Prepare summary buffer from THREADS and indentation LEVEL.
3368 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3369 or a straight list of headers."
3370 (gnus-message 7 "Generating summary...")
3372 (setq gnus-newsgroup-threads threads)
3375 (let ((gnus-tmp-level 0)
3376 (default-score (or gnus-summary-default-score 0))
3377 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3378 thread number subject stack state gnus-tmp-gathered beg-match
3379 new-roots gnus-tmp-new-adopts thread-end
3380 gnus-tmp-header gnus-tmp-unread
3381 gnus-tmp-replied gnus-tmp-subject-or-nil
3382 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3383 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3384 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3386 (setq gnus-tmp-prev-subject nil)
3388 (if (vectorp (car threads))
3389 ;; If this is a straight (sic) list of headers, then a
3390 ;; threaded summary display isn't required, so we just create
3391 ;; an unthreaded one.
3392 (gnus-summary-prepare-unthreaded threads)
3394 ;; Do the threaded display.
3396 (while (or threads stack gnus-tmp-new-adopts new-roots)
3398 (if (and (= gnus-tmp-level 0)
3399 (not (setq gnus-tmp-dummy-line nil))
3402 (not gnus-tmp-false-parent)
3403 (or gnus-tmp-new-adopts new-roots))
3404 (if gnus-tmp-new-adopts
3405 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3406 thread (list (car gnus-tmp-new-adopts))
3407 gnus-tmp-header (caar thread)
3408 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3410 (setq thread (list (car new-roots))
3411 gnus-tmp-header (caar thread)
3412 new-roots (cdr new-roots))))
3415 ;; If there are some threads, we do them before the
3416 ;; threads on the stack.
3417 (setq thread threads
3418 gnus-tmp-header (caar thread))
3419 ;; There were no current threads, so we pop something off
3421 (setq state (car stack)
3422 gnus-tmp-level (car state)
3425 gnus-tmp-header (caar thread))))
3427 (setq gnus-tmp-false-parent nil)
3428 (setq gnus-tmp-root-expunged nil)
3429 (setq thread-end nil)
3431 (if (stringp gnus-tmp-header)
3432 ;; The header is a dummy root.
3434 ((eq gnus-summary-make-false-root 'adopt)
3435 ;; We let the first article adopt the rest.
3436 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3438 (setq gnus-tmp-gathered
3440 (lambda (h) (mail-header-number (car h)))
3443 (setq thread (cons (list (caar thread)
3446 (setq gnus-tmp-level -1
3447 gnus-tmp-false-parent t))
3448 ((eq gnus-summary-make-false-root 'empty)
3449 ;; We print adopted articles with empty subject fields.
3450 (setq gnus-tmp-gathered
3452 (lambda (h) (mail-header-number (car h)))
3455 (setq gnus-tmp-level -1))
3456 ((eq gnus-summary-make-false-root 'dummy)
3457 ;; We remember that we probably want to output a dummy
3459 (setq gnus-tmp-dummy-line gnus-tmp-header)
3460 (setq gnus-tmp-prev-subject gnus-tmp-header))
3462 ;; We do not make a root for the gathered
3463 ;; sub-threads at all.
3464 (setq gnus-tmp-level -1)))
3466 (setq number (mail-header-number gnus-tmp-header)
3467 subject (mail-header-subject gnus-tmp-header))
3470 ;; If the thread has changed subject, we might want to make
3471 ;; this subthread into a root.
3472 ((and (null gnus-thread-ignore-subject)
3473 (not (zerop gnus-tmp-level))
3474 gnus-tmp-prev-subject
3476 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3477 (setq new-roots (nconc new-roots (list (car thread)))
3479 gnus-tmp-header nil))
3480 ;; If the article lies outside the current limit,
3481 ;; then we do not display it.
3482 ((not (memq number gnus-newsgroup-limit))
3483 (setq gnus-tmp-gathered
3485 (lambda (h) (mail-header-number (car h)))
3488 (setq gnus-tmp-new-adopts (if (cdar thread)
3489 (append gnus-tmp-new-adopts
3491 gnus-tmp-new-adopts)
3493 gnus-tmp-header nil)
3494 (when (zerop gnus-tmp-level)
3495 (setq gnus-tmp-root-expunged t)))
3496 ;; Perhaps this article is to be marked as read?
3497 ((and gnus-summary-mark-below
3498 (< (or (cdr (assq number gnus-newsgroup-scored))
3500 gnus-summary-mark-below)
3501 ;; Don't touch sparse articles.
3502 (not (gnus-summary-article-sparse-p number))
3503 (not (gnus-summary-article-ancient-p number)))
3504 (setq gnus-newsgroup-unreads
3505 (delq number gnus-newsgroup-unreads))
3506 (if gnus-newsgroup-auto-expire
3507 (push number gnus-newsgroup-expirable)
3508 (push (cons number gnus-low-score-mark)
3509 gnus-newsgroup-reads))))
3511 (when gnus-tmp-header
3512 ;; We may have an old dummy line to output before this
3514 (when gnus-tmp-dummy-line
3515 (gnus-summary-insert-dummy-line
3516 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3517 (setq gnus-tmp-dummy-line nil))
3519 ;; Compute the mark.
3520 (setq gnus-tmp-unread (gnus-article-mark number))
3522 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3523 gnus-tmp-header gnus-tmp-level)
3524 gnus-newsgroup-data)
3526 ;; Actually insert the line.
3528 gnus-tmp-subject-or-nil
3530 ((and gnus-thread-ignore-subject
3531 gnus-tmp-prev-subject
3532 (not (inline (gnus-subject-equal
3533 gnus-tmp-prev-subject subject))))
3535 ((zerop gnus-tmp-level)
3536 (if (and (eq gnus-summary-make-false-root 'empty)
3537 (memq number gnus-tmp-gathered)
3538 gnus-tmp-prev-subject
3539 (inline (gnus-subject-equal
3540 gnus-tmp-prev-subject subject)))
3541 gnus-summary-same-subject
3543 (t gnus-summary-same-subject)))
3544 (if (and (eq gnus-summary-make-false-root 'adopt)
3545 (= gnus-tmp-level 1)
3546 (memq number gnus-tmp-gathered))
3547 (setq gnus-tmp-opening-bracket ?\<
3548 gnus-tmp-closing-bracket ?\>)
3549 (setq gnus-tmp-opening-bracket ?\[
3550 gnus-tmp-closing-bracket ?\]))
3552 gnus-tmp-indentation
3553 (aref gnus-thread-indent-array gnus-tmp-level)
3554 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3555 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3556 gnus-summary-default-score 0)
3558 (if (or (null gnus-summary-default-score)
3559 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3560 gnus-summary-zcore-fuzz))
3562 (if (< gnus-tmp-score gnus-summary-default-score)
3563 gnus-score-below-mark gnus-score-over-mark))
3565 (cond ((memq number gnus-newsgroup-processable)
3567 ((memq number gnus-newsgroup-cached)
3569 ((memq number gnus-newsgroup-replied)
3571 ((memq number gnus-newsgroup-saved)
3573 (t gnus-unread-mark))
3574 gnus-tmp-from (mail-header-from gnus-tmp-header)
3577 ((string-match "<[^>]+> *$" gnus-tmp-from)
3578 (setq beg-match (match-beginning 0))
3579 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3580 (substring gnus-tmp-from (1+ (match-beginning 0))
3581 (1- (match-end 0))))
3582 (substring gnus-tmp-from 0 beg-match)))
3583 ((string-match "(.+)" gnus-tmp-from)
3584 (substring gnus-tmp-from
3585 (1+ (match-beginning 0)) (1- (match-end 0))))
3587 (when (string= gnus-tmp-name "")
3588 (setq gnus-tmp-name gnus-tmp-from))
3589 (unless (numberp gnus-tmp-lines)
3590 (setq gnus-tmp-lines 0))
3591 (gnus-put-text-property
3593 (progn (eval gnus-summary-line-format-spec) (point))
3594 'gnus-number number)
3597 (run-hooks 'gnus-summary-update-hook)
3600 (setq gnus-tmp-prev-subject subject)))
3602 (when (nth 1 thread)
3603 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3604 (incf gnus-tmp-level)
3605 (setq threads (if thread-end nil (cdar thread)))
3607 (setq gnus-tmp-level 0)))))
3608 (gnus-message 7 "Generating summary...done"))
3610 (defun gnus-summary-prepare-unthreaded (headers)
3611 "Generate an unthreaded summary buffer based on HEADERS."
3612 (let (header number mark)
3617 ;; We may have to root out some bad articles...
3618 (when (memq (setq number (mail-header-number
3619 (setq header (pop headers))))
3620 gnus-newsgroup-limit)
3621 ;; Mark article as read when it has a low score.
3622 (when (and gnus-summary-mark-below
3623 (< (or (cdr (assq number gnus-newsgroup-scored))
3624 gnus-summary-default-score 0)
3625 gnus-summary-mark-below)
3626 (not (gnus-summary-article-ancient-p number)))
3627 (setq gnus-newsgroup-unreads
3628 (delq number gnus-newsgroup-unreads))
3629 (if gnus-newsgroup-auto-expire
3630 (push number gnus-newsgroup-expirable)
3631 (push (cons number gnus-low-score-mark)
3632 gnus-newsgroup-reads)))
3634 (setq mark (gnus-article-mark number))
3635 (push (gnus-data-make number mark (1+ (point)) header 0)
3636 gnus-newsgroup-data)
3637 (gnus-summary-insert-line
3639 mark (memq number gnus-newsgroup-replied)
3640 (memq number gnus-newsgroup-expirable)
3641 (mail-header-subject header) nil
3642 (cdr (assq number gnus-newsgroup-scored))
3643 (memq number gnus-newsgroup-processable))))))
3645 (defun gnus-select-newsgroup (group &optional read-all)
3646 "Select newsgroup GROUP.
3647 If READ-ALL is non-nil, all articles in the group are selected."
3648 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3649 ;;!!! Dirty hack; should be removed.
3650 (gnus-summary-ignore-duplicates
3651 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3653 gnus-summary-ignore-duplicates))
3654 (info (nth 2 entry))
3655 articles fetched-articles cached)
3657 (unless (gnus-check-server
3658 (setq gnus-current-select-method
3659 (gnus-find-method-for-group group)))
3660 (error "Couldn't open server"))
3662 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3663 (gnus-activate-group group) ; Or we can activate it...
3664 (progn ; Or we bug out.
3665 (when (equal major-mode 'gnus-summary-mode)
3666 (kill-buffer (current-buffer)))
3667 (error "Couldn't request group %s: %s"
3668 group (gnus-status-message group))))
3670 (unless (gnus-request-group group t)
3671 (when (equal major-mode 'gnus-summary-mode)
3672 (kill-buffer (current-buffer)))
3673 (error "Couldn't request group %s: %s"
3674 group (gnus-status-message group)))
3676 (setq gnus-newsgroup-name group)
3677 (setq gnus-newsgroup-unselected nil)
3678 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3680 ;; Adjust and set lists of article marks.
3682 (gnus-adjust-marked-articles info))
3684 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3685 (when (gnus-virtual-group-p group)
3686 (setq cached gnus-newsgroup-cached))
3688 (setq gnus-newsgroup-unreads
3689 (gnus-set-difference
3690 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3691 gnus-newsgroup-dormant))
3693 (setq gnus-newsgroup-processable nil)
3695 (gnus-update-read-articles group gnus-newsgroup-unreads)
3696 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3697 (gnus-group-update-group group))
3699 (setq articles (gnus-articles-to-read group read-all))
3703 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3705 ((eq articles 0) nil)
3707 ;; Init the dependencies hash table.
3708 (setq gnus-newsgroup-dependencies
3709 (gnus-make-hashtable (length articles)))
3710 ;; Retrieve the headers and read them in.
3711 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3712 (setq gnus-newsgroup-headers
3714 (setq gnus-headers-retrieved-by
3715 (gnus-retrieve-headers
3716 articles gnus-newsgroup-name
3717 ;; We might want to fetch old headers, but
3718 ;; not if there is only 1 article.
3719 (and gnus-fetch-old-headers
3721 (not (eq gnus-fetch-old-headers 'some))
3722 (not (numberp gnus-fetch-old-headers)))
3723 (> (length articles) 1))))))
3724 (gnus-get-newsgroup-headers-xover
3725 articles nil nil gnus-newsgroup-name t)
3726 (gnus-get-newsgroup-headers)))
3727 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3729 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3731 (setq gnus-newsgroup-cached cached))
3733 ;; Suppress duplicates?
3734 (when gnus-suppress-duplicates
3735 (gnus-dup-suppress-articles))
3737 ;; Set the initial limit.
3738 (setq gnus-newsgroup-limit (copy-sequence articles))
3739 ;; Remove canceled articles from the list of unread articles.
3740 (setq gnus-newsgroup-unreads
3741 (gnus-set-sorted-intersection
3742 gnus-newsgroup-unreads
3743 (setq fetched-articles
3744 (mapcar (lambda (headers) (mail-header-number headers))
3745 gnus-newsgroup-headers))))
3746 ;; Removed marked articles that do not exist.
3747 (gnus-update-missing-marks
3748 (gnus-sorted-complement fetched-articles articles))
3749 ;; Let the Gnus agent mark articles as read.
3751 (gnus-agent-get-undownloaded-list))
3752 ;; We might want to build some more threads first.
3753 (and gnus-fetch-old-headers
3754 (eq gnus-headers-retrieved-by 'nov)
3755 (gnus-build-old-threads))
3756 ;; Check whether auto-expire is to be done in this group.
3757 (setq gnus-newsgroup-auto-expire
3758 (gnus-group-auto-expirable-p group))
3759 ;; Set up the article buffer now, if necessary.
3760 (unless gnus-single-article-buffer
3761 (gnus-article-setup-buffer))
3762 ;; First and last article in this newsgroup.
3763 (when gnus-newsgroup-headers
3764 (setq gnus-newsgroup-begin
3765 (mail-header-number (car gnus-newsgroup-headers))
3768 (gnus-last-element gnus-newsgroup-headers))))
3769 ;; GROUP is successfully selected.
3770 (or gnus-newsgroup-headers t)))))
3772 (defun gnus-articles-to-read (group &optional read-all)
3773 ;; Find out what articles the user wants to read.
3775 ;; Select all articles if `read-all' is non-nil, or if there
3776 ;; are no unread articles.
3778 (and (zerop (length gnus-newsgroup-marked))
3779 (zerop (length gnus-newsgroup-unreads)))
3780 (eq (gnus-group-find-parameter group 'display)
3782 (gnus-uncompress-range (gnus-active group))
3783 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3784 (copy-sequence gnus-newsgroup-unreads))
3786 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3787 (scored (length scored-list))
3788 (number (length articles))
3789 (marked (+ (length gnus-newsgroup-marked)
3790 (length gnus-newsgroup-dormant)))
3798 ((and (or (<= scored marked) (= scored number))
3799 (numberp gnus-large-newsgroup)
3800 (> number gnus-large-newsgroup))
3804 "How many articles from %s (default %d): "
3805 (gnus-limit-string gnus-newsgroup-name 35)
3807 (if (string-match "^[ \t]*$" input) number input)))
3808 ((and (> scored marked) (< scored number)
3809 (> (- scored number) 20))
3812 (format "%s %s (%d scored, %d total): "
3813 "How many articles from"
3814 group scored number))))
3815 (if (string-match "^[ \t]*$" input)
3819 (setq select (if (stringp select) (string-to-number select) select))
3820 (if (or (null select) (zerop select))
3822 (if (and (not (zerop scored)) (<= (abs select) scored))
3824 (setq articles (sort scored-list '<))
3825 (setq number (length articles)))
3826 (setq articles (copy-sequence articles)))
3828 (when (< (abs select) number)
3830 ;; Select the N oldest articles.
3831 (setcdr (nthcdr (1- (abs select)) articles) nil)
3832 ;; Select the N most recent articles.
3833 (setq articles (nthcdr (- number select) articles))))
3834 (setq gnus-newsgroup-unselected
3835 (gnus-sorted-intersection
3836 gnus-newsgroup-unreads
3837 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3840 (defun gnus-killed-articles (killed articles)
3843 (when (inline (gnus-member-of-range (car articles) killed))
3844 (push (car articles) out))
3845 (setq articles (cdr articles)))
3848 (defun gnus-uncompress-marks (marks)
3849 "Uncompress the mark ranges in MARKS."
3850 (let ((uncompressed '(score bookmark))
3853 (if (memq (caar marks) uncompressed)
3854 (push (car marks) out)
3855 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3856 (setq marks (cdr marks)))
3859 (defun gnus-adjust-marked-articles (info)
3860 "Set all article lists and remove all marks that are no longer legal."
3861 (let* ((marked-lists (gnus-info-marks info))
3862 (active (gnus-active (gnus-info-group info)))
3865 (types gnus-article-mark-lists)
3866 (uncompressed '(score bookmark killed))
3867 marks var articles article mark)
3870 (setq marks (pop marked-lists))
3871 (set (setq var (intern (format "gnus-newsgroup-%s"
3872 (car (rassq (setq mark (car marks))
3874 (if (memq (car marks) uncompressed) (cdr marks)
3875 (gnus-uncompress-range (cdr marks))))
3877 (setq articles (symbol-value var))
3879 ;; All articles have to be subsets of the active articles.
3881 ;; Adjust "simple" lists.
3882 ((memq mark '(tick dormant expire reply save))
3884 (when (or (< (setq article (pop articles)) min) (> article max))
3885 (set var (delq article (symbol-value var))))))
3887 ((memq mark uncompressed)
3888 (when (not (listp (cdr (symbol-value var))))
3889 (set var (list (symbol-value var))))
3890 (when (not (listp (cdr articles)))
3891 (setq articles (list articles)))
3893 (when (or (not (consp (setq article (pop articles))))
3894 (< (car article) min)
3895 (> (car article) max))
3896 (set var (delq article (symbol-value var))))))))))
3898 (defun gnus-update-missing-marks (missing)
3899 "Go through the list of MISSING articles and remove them mark lists."
3901 (let ((types gnus-article-mark-lists)
3903 ;; Go through all types.
3905 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3906 (when (symbol-value var)
3907 ;; This list has articles. So we delete all missing articles
3911 (set var (delq (pop m) (symbol-value var)))))))))
3913 (defun gnus-update-marks ()
3914 "Enter the various lists of marked articles into the newsgroup info list."
3915 (let ((types gnus-article-mark-lists)
3916 (info (gnus-get-info gnus-newsgroup-name))
3917 (uncompressed '(score bookmark killed))
3918 type list newmarked symbol)
3920 ;; Add all marks lists that are non-nil to the list of marks lists.
3921 (while (setq type (pop types))
3922 (when (setq list (symbol-value
3924 (intern (format "gnus-newsgroup-%s"
3927 ;; Get rid of the entries of the articles that have the
3929 (when (and (eq (cdr type) 'score)
3933 (prev (cons nil list))
3936 (if (or (not (consp (car arts)))
3937 (= (cdar arts) gnus-summary-default-score))
3938 (setcdr prev (cdr arts))
3940 (setq arts (cdr arts)))
3941 (setq list (cdr all))))
3943 (push (cons (cdr type)
3944 (if (memq (cdr type) uncompressed) list
3945 (gnus-compress-sequence
3946 (set symbol (sort list '<)) t)))
3949 ;; Enter these new marks into the info of the group.
3951 (setcar (nthcdr 3 info) newmarked)
3952 ;; Add the marks lists to the end of the info.
3954 (setcdr (nthcdr 2 info) (list newmarked))))
3956 ;; Cut off the end of the info if there's nothing else there.
3960 (when (nthcdr (decf i) info)
3961 (setcdr (nthcdr i info) nil)))))))
3963 (defun gnus-set-mode-line (where)
3964 "This function sets the mode line of the article or summary buffers.
3965 If WHERE is `summary', the summary mode line format will be used."
3966 ;; Is this mode line one we keep updated?
3967 (when (memq where gnus-updated-mode-lines)
3970 ;; We evaluate this in the summary buffer since these
3971 ;; variables are buffer-local to that buffer.
3972 (set-buffer gnus-summary-buffer)
3973 ;; We bind all these variables that are used in the `eval' form
3975 (let* ((mformat (symbol-value
3977 (format "gnus-%s-mode-line-format-spec" where))))
3978 (gnus-tmp-group-name gnus-newsgroup-name)
3979 (gnus-tmp-article-number (or gnus-current-article 0))
3980 (gnus-tmp-unread gnus-newsgroup-unreads)
3981 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3982 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3983 (gnus-tmp-unread-and-unselected
3984 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3985 (zerop gnus-tmp-unselected))
3987 ((zerop gnus-tmp-unselected)
3988 (format "{%d more}" gnus-tmp-unread-and-unticked))
3989 (t (format "{%d(+%d) more}"
3990 gnus-tmp-unread-and-unticked
3991 gnus-tmp-unselected))))
3993 (if (and gnus-current-headers
3994 (vectorp gnus-current-headers))
3995 (gnus-mode-string-quote
3996 (mail-header-subject gnus-current-headers))
3998 bufname-length max-len
3999 gnus-tmp-header);; passed as argument to any user-format-funcs
4000 (setq mode-string (eval mformat))
4001 (setq bufname-length (if (string-match "%b" mode-string)
4004 (if (eq where 'summary)
4006 (get-buffer gnus-article-buffer))))
4009 (setq max-len (max 4 (if gnus-mode-non-string-length
4011 gnus-mode-non-string-length
4013 (length mode-string))))
4014 ;; We might have to chop a bit of the string off...
4015 (when (> (length mode-string) max-len)
4017 (concat (gnus-truncate-string mode-string (- max-len 3))
4019 ;; Pad the mode string a bit.
4020 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4021 ;; Update the mode line.
4022 (setq mode-line-buffer-identification
4023 (gnus-mode-line-buffer-identification (list mode-string)))
4024 (set-buffer-modified-p t))))
4026 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4027 "Go through the HEADERS list and add all Xrefs to a hash table.
4028 The resulting hash table is returned, or nil if no Xrefs were found."
4029 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4030 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4031 (xref-hashtb (gnus-make-hashtable))
4032 start group entry number xrefs header)
4034 (setq header (pop headers))
4035 (when (and (setq xrefs (mail-header-xref header))
4036 (not (memq (setq number (mail-header-number header))
4039 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4040 (setq start (match-end 0))
4041 (setq group (if prefix
4042 (concat prefix (substring xrefs (match-beginning 1)
4044 (substring xrefs (match-beginning 1) (match-end 1))))
4046 (string-to-int (substring xrefs (match-beginning 2)
4048 (if (setq entry (gnus-gethash group xref-hashtb))
4049 (setcdr entry (cons number (cdr entry)))
4050 (gnus-sethash group (cons number nil) xref-hashtb)))))
4051 (and start xref-hashtb)))
4053 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4054 "Look through all the headers and mark the Xrefs as read."
4055 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4056 name entry info xref-hashtb idlist method nth4)
4058 (set-buffer gnus-group-buffer)
4059 (when (setq xref-hashtb
4060 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4063 (unless (string= from-newsgroup (setq name (symbol-name group)))
4064 (setq idlist (symbol-value group))
4065 ;; Dead groups are not updated.
4067 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4069 (when (stringp (setq nth4 (gnus-info-method info)))
4070 (setq nth4 (gnus-server-to-method nth4))))
4071 ;; Only do the xrefs if the group has the same
4072 ;; select method as the group we have just read.
4073 (or (gnus-methods-equal-p
4074 nth4 (gnus-find-method-for-group from-newsgroup))
4076 (equal nth4 (setq method (gnus-find-method-for-group
4078 (and (equal (car nth4) (car method))
4079 (equal (nth 1 nth4) (nth 1 method))))
4080 gnus-use-cross-reference
4081 (or (not (eq gnus-use-cross-reference t))
4083 ;; Only do cross-references on subscribed
4084 ;; groups, if that is what is wanted.
4085 (<= (gnus-info-level info) gnus-level-subscribed))
4086 (gnus-group-make-articles-read name idlist))))
4089 (defun gnus-compute-read-articles (group articles)
4090 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4091 (info (nth 2 entry))
4092 (active (gnus-active group)))
4094 ;; First peel off all illegal article numbers.
4096 (let ((ids articles)
4098 (while (setq id (pop ids))
4099 (when (and first (> id (cdr active)))
4100 ;; We'll end up in this situation in one particular
4101 ;; obscure situation. If you re-scan a group and get
4102 ;; a new article that is cross-posted to a different
4103 ;; group that has not been re-scanned, you might get
4104 ;; crossposted article that has a higher number than
4105 ;; Gnus believes possible. So we re-activate this
4106 ;; group as well. This might mean doing the
4107 ;; crossposting thingy will *increase* the number
4108 ;; of articles in some groups. Tsk, tsk.
4109 (setq active (or (gnus-activate-group group) active)))
4110 (when (or (> id (cdr active))
4111 (< id (car active)))
4112 (setq articles (delq id articles))))))
4113 ;; If the read list is nil, we init it.
4115 (null (gnus-info-read info))
4117 (setq ninfo (cons 1 (1- (car active))))
4118 (setq ninfo (gnus-info-read info)))
4119 ;; Then we add the read articles to the range.
4121 ninfo (setq articles (sort articles '<))))))
4123 (defun gnus-group-make-articles-read (group articles)
4124 "Update the info of GROUP to say that ARTICLES are read."
4126 (entry (gnus-gethash group gnus-newsrc-hashtb))
4127 (info (nth 2 entry))
4128 (active (gnus-active group))
4131 (setq range (gnus-compute-read-articles group articles))
4133 (set-buffer gnus-group-buffer)
4136 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4137 (gnus-info-set-read ',info ',(gnus-info-read info))
4138 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4139 (gnus-group-update-group ,group t))))
4140 ;; Add the read articles to the range.
4141 (gnus-info-set-read info range)
4142 ;; Then we have to re-compute how many unread
4143 ;; articles there are in this group.
4147 (setq num (- (1+ (cdr active)) (car active))))
4148 ((not (listp (cdr range)))
4149 (setq num (- (cdr active) (- (1+ (cdr range))
4153 (if (numberp (car range))
4155 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4156 (setq range (cdr range)))
4157 (setq num (- (cdr active) num))))
4158 ;; Update the number of unread articles.
4160 ;; Update the group buffer.
4161 (gnus-group-update-group group t)))))
4163 (defun gnus-methods-equal-p (m1 m2)
4164 (let ((m1 (or m1 gnus-select-method))
4165 (m2 (or m2 gnus-select-method)))
4167 (and (eq (car m1) (car m2))
4168 (or (not (memq 'address (assoc (symbol-name (car m1))
4169 gnus-valid-select-methods)))
4170 (equal (nth 1 m1) (nth 1 m2)))))))
4172 (defvar gnus-newsgroup-none-id 0)
4174 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4175 (let ((cur nntp-server-buffer)
4178 (save-excursion (set-buffer gnus-summary-buffer)
4179 gnus-newsgroup-dependencies)))
4180 headers id id-dep ref-dep end ref)
4182 (set-buffer nntp-server-buffer)
4183 ;; Translate all TAB characters into SPACE characters.
4184 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4185 (run-hooks 'gnus-parse-headers-hook)
4186 (let ((case-fold-search t)
4187 in-reply-to header p lines)
4188 (goto-char (point-min))
4189 ;; Search to the beginning of the next header. Error messages
4190 ;; do not begin with 2 or 3.
4191 (while (re-search-forward "^[23][0-9]+ " nil t)
4194 ;; This implementation of this function, with nine
4195 ;; search-forwards instead of the one re-search-forward and
4196 ;; a case (which basically was the old function) is actually
4197 ;; about twice as fast, even though it looks messier. You
4198 ;; can't have everything, I guess. Speed and elegance
4199 ;; doesn't always go hand in hand.
4208 (narrow-to-region (point)
4209 (or (and (search-forward "\n.\n" nil t)
4215 (if (search-forward "\nsubject: " nil t)
4216 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4218 gnus-unstructured-field-decoder (nnheader-header-value))
4223 (if (search-forward "\nfrom: " nil t)
4224 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4226 gnus-structured-field-decoder (nnheader-header-value))
4231 (if (search-forward "\ndate: " nil t)
4232 (nnheader-header-value) ""))
4236 (setq id (if (search-forward "\nmessage-id:" nil t)
4238 (1- (or (search-forward "<" nil t) (point)))
4239 (or (search-forward ">" nil t) (point)))
4240 ;; If there was no message-id, we just fake one
4241 ;; to make subsequent routines simpler.
4242 (nnheader-generate-fake-message-id))))
4246 (if (search-forward "\nreferences: " nil t)
4250 (nnheader-header-value)
4255 (search-backward ">" end t)
4258 (search-backward "<" end t)
4260 ;; Get the references from the in-reply-to header if there
4261 ;; were no references and the in-reply-to header looks
4263 (if (and (search-forward "\nin-reply-to: " nil t)
4264 (setq in-reply-to (nnheader-header-value))
4265 (string-match "<[^>]+>" in-reply-to))
4266 (setq ref (substring in-reply-to (match-beginning 0)
4274 (if (search-forward "\nlines: " nil t)
4275 (if (numberp (setq lines (ignore-errors (read cur))))
4281 (and (search-forward "\nxref: " nil t)
4282 (nnheader-header-value)))))
4283 (when (equal id ref)
4286 (when gnus-alter-header-function
4287 (funcall gnus-alter-header-function header)
4288 (setq id (mail-header-id header)
4289 ref (gnus-parent-id (mail-header-references header))))
4291 ;; We do the threading while we read the headers. The
4292 ;; message-id and the last reference are both entered into
4293 ;; the same hash table. Some tippy-toeing around has to be
4294 ;; done in case an article has arrived before the article
4295 ;; which it refers to.
4296 (if (boundp (setq id-dep (intern id dependencies)))
4297 (if (and (car (symbol-value id-dep))
4299 ;; An article with this Message-ID has already been seen.
4300 (if gnus-summary-ignore-duplicates
4301 ;; We ignore this one, except we add
4302 ;; any additional Xrefs (in case the two articles
4303 ;; came from different servers).
4305 (mail-header-set-xref
4306 (car (symbol-value id-dep))
4307 (concat (or (mail-header-xref
4308 (car (symbol-value id-dep)))
4310 (or (mail-header-xref header) "")))
4312 ;; We rename the Message-ID.
4314 (setq id-dep (intern (setq id (nnmail-message-id))
4317 (mail-header-set-id header id))
4318 (setcar (symbol-value id-dep) header))
4319 (set id-dep (list header)))
4321 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4322 (setcdr (symbol-value ref-dep)
4323 (nconc (cdr (symbol-value ref-dep))
4324 (list (symbol-value id-dep))))
4325 (set ref-dep (list nil (symbol-value id-dep))))
4326 (push header headers))
4327 (goto-char (point-max))
4329 (nreverse headers)))))
4331 ;; The following macros and functions were written by Felix Lee
4332 ;; <flee@cse.psu.edu>.
4334 (defmacro gnus-nov-read-integer ()
4336 (if (= (following-char) ?\t)
4338 (let ((num (ignore-errors (read buffer))))
4339 (if (numberp num) num 0)))
4343 (defmacro gnus-nov-skip-field ()
4344 '(search-forward "\t" eol 'move))
4346 (defmacro gnus-nov-field ()
4347 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4349 ;; (defvar gnus-nov-none-counter 0)
4351 ;; This function has to be called with point after the article number
4352 ;; on the beginning of the line.
4353 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4354 (let ((eol (gnus-point-at-eol))
4355 (buffer (current-buffer))
4356 header ref id id-dep ref-dep)
4358 ;; overview: [num subject from date id refs chars lines misc]
4361 (narrow-to-region (point) eol)
4369 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4371 gnus-structured-field-decoder (gnus-nov-field)) ; from
4372 (gnus-nov-field) ; date
4373 (setq id (or (gnus-nov-field)
4374 (nnheader-generate-fake-message-id))) ; id
4376 (let ((beg (point)))
4377 (search-forward "\t" eol)
4378 (if (search-backward ">" beg t)
4382 (search-backward "<" beg t)))
4385 (gnus-nov-field)) ; refs
4386 (gnus-nov-read-integer) ; chars
4387 (gnus-nov-read-integer) ; lines
4388 (if (= (following-char) ?\n)
4390 (gnus-nov-field))))) ; misc
4394 (when gnus-alter-header-function
4395 (funcall gnus-alter-header-function header)
4396 (setq id (mail-header-id header)
4397 ref (gnus-parent-id (mail-header-references header))))
4399 ;; We build the thread tree.
4400 (when (equal id ref)
4401 ;; This article refers back to itself. Naughty, naughty.
4403 (if (boundp (setq id-dep (intern id dependencies)))
4404 (if (and (car (symbol-value id-dep))
4406 ;; An article with this Message-ID has already been seen.
4407 (if gnus-summary-ignore-duplicates
4408 ;; We ignore this one, except we add any additional
4409 ;; Xrefs (in case the two articles came from different
4412 (mail-header-set-xref
4413 (car (symbol-value id-dep))
4414 (concat (or (mail-header-xref
4415 (car (symbol-value id-dep)))
4417 (or (mail-header-xref header) "")))
4419 ;; We rename the Message-ID.
4421 (setq id-dep (intern (setq id (nnmail-message-id))
4424 (mail-header-set-id header id))
4425 (setcar (symbol-value id-dep) header))
4426 (set id-dep (list header)))
4428 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4429 (setcdr (symbol-value ref-dep)
4430 (nconc (cdr (symbol-value ref-dep))
4431 (list (symbol-value id-dep))))
4432 (set ref-dep (list nil (symbol-value id-dep)))))
4435 ;; Goes through the xover lines and returns a list of vectors
4436 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4437 force-new dependencies
4438 group also-fetch-heads)
4439 "Parse the news overview data in the server buffer, and return a
4440 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4441 ;; Get the Xref when the users reads the articles since most/some
4442 ;; NNTP servers do not include Xrefs when using XOVER.
4443 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4444 (let ((cur nntp-server-buffer)
4445 (dependencies (or dependencies gnus-newsgroup-dependencies))
4446 number headers header)
4448 (set-buffer nntp-server-buffer)
4449 ;; Allow the user to mangle the headers before parsing them.
4450 (run-hooks 'gnus-parse-headers-hook)
4451 (goto-char (point-min))
4454 (while (and sequence (not (eobp)))
4455 (setq number (read cur))
4456 (while (and sequence
4457 (< (car sequence) number))
4458 (setq sequence (cdr sequence)))
4460 (eq number (car sequence))
4462 (setq sequence (cdr sequence))
4463 (setq header (inline
4464 (gnus-nov-parse-line
4465 number dependencies force-new))))
4466 (push header headers))
4469 (gnus-error 4 "Strange nov line (%d)"
4470 (count-lines (point-min) (point)))))
4472 ;; A common bug in inn is that if you have posted an article and
4473 ;; then retrieves the active file, it will answer correctly --
4474 ;; the new article is included. However, a NOV entry for the
4475 ;; article may not have been generated yet, so this may fail.
4476 ;; We work around this problem by retrieving the last few
4477 ;; headers using HEAD.
4478 (if (or (not also-fetch-heads)
4480 ;; We (probably) got all the headers.
4482 (let ((gnus-nov-is-evil t))
4485 (when (gnus-retrieve-headers sequence group)
4486 (gnus-get-newsgroup-headers))))))))
4488 (defun gnus-article-get-xrefs ()
4489 "Fill in the Xref value in `gnus-current-headers', if necessary.
4490 This is meant to be called in `gnus-article-internal-prepare-hook'."
4491 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4492 gnus-current-headers)))
4493 (or (not gnus-use-cross-reference)
4495 (and (mail-header-xref headers)
4496 (not (string= (mail-header-xref headers) "")))
4497 (let ((case-fold-search t)
4500 (nnheader-narrow-to-headers)
4501 (goto-char (point-min))
4502 (when (or (and (eq (downcase (following-char)) ?x)
4503 (looking-at "Xref:"))
4504 (search-forward "\nXref:" nil t))
4505 (goto-char (1+ (match-end 0)))
4506 (setq xref (buffer-substring (point)
4507 (progn (end-of-line) (point))))
4508 (mail-header-set-xref headers xref)))))))
4510 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4511 "Find article ID and insert the summary line for that article."
4512 (let ((header (if (and old-header use-old-header)
4513 old-header (gnus-read-header id)))
4514 (number (and (numberp id) id))
4517 ;; Rebuild the thread that this article is part of and go to the
4518 ;; article we have fetched.
4519 (when (and (not gnus-show-threads)
4521 (when (setq d (gnus-data-find (mail-header-number old-header)))
4522 (goto-char (gnus-data-pos d))
4525 (- (gnus-point-at-bol)
4527 (1+ (gnus-point-at-eol))
4528 (gnus-delete-line))))))
4530 (mail-header-set-number header (mail-header-number old-header)))
4531 (setq gnus-newsgroup-sparse
4532 (delq (setq number (mail-header-number header))
4533 gnus-newsgroup-sparse))
4534 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4535 (gnus-rebuild-thread (mail-header-id header))
4536 (gnus-summary-goto-subject number nil t))
4537 (when (and (numberp number)
4539 ;; We have to update the boundaries even if we can't fetch the
4540 ;; article if ID is a number -- so that the next `P' or `N'
4541 ;; command will fetch the previous (or next) article even
4542 ;; if the one we tried to fetch this time has been canceled.
4543 (when (> number gnus-newsgroup-end)
4544 (setq gnus-newsgroup-end number))
4545 (when (< number gnus-newsgroup-begin)
4546 (setq gnus-newsgroup-begin number))
4547 (setq gnus-newsgroup-unselected
4548 (delq number gnus-newsgroup-unselected)))
4549 ;; Report back a success?
4550 (and header (mail-header-number header))))
4552 ;;; Process/prefix in the summary buffer
4554 (defun gnus-summary-work-articles (n)
4555 "Return a list of articles to be worked upon. The prefix argument,
4556 the list of process marked articles, and the current article will be
4557 taken into consideration."
4560 ;; A numerical prefix has been given.
4561 (setq n (prefix-numeric-value n))
4562 (let ((backward (< n 0))
4563 (n (abs (prefix-numeric-value n)))
4568 (push (setq article (gnus-summary-article-number))
4571 (gnus-summary-find-prev nil article)
4572 (gnus-summary-find-next nil article)))
4574 (nreverse articles)))
4575 ((gnus-region-active-p)
4576 ;; Work on the region between point and mark.
4577 (let ((max (max (point) (mark)))
4580 (goto-char (min (point) (mark)))
4583 (push (setq article (gnus-summary-article-number)) articles)
4584 (gnus-summary-find-next nil article)
4586 (nreverse articles))))
4587 (gnus-newsgroup-processable
4588 ;; There are process-marked articles present.
4589 ;; Save current state.
4590 (gnus-summary-save-process-mark)
4592 (reverse gnus-newsgroup-processable))
4594 ;; Just return the current article.
4595 (list (gnus-summary-article-number)))))
4597 (defun gnus-summary-save-process-mark ()
4598 "Push the current set of process marked articles on the stack."
4600 (push (copy-sequence gnus-newsgroup-processable)
4601 gnus-newsgroup-process-stack))
4603 (defun gnus-summary-kill-process-mark ()
4604 "Push the current set of process marked articles on the stack and unmark."
4606 (gnus-summary-save-process-mark)
4607 (gnus-summary-unmark-all-processable))
4609 (defun gnus-summary-yank-process-mark ()
4610 "Pop the last process mark state off the stack and restore it."
4612 (unless gnus-newsgroup-process-stack
4613 (error "Empty mark stack"))
4614 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4616 (defun gnus-summary-process-mark-set (set)
4617 "Make SET into the current process marked articles."
4618 (gnus-summary-unmark-all-processable)
4620 (gnus-summary-set-process-mark (pop set))))
4622 ;;; Searching and stuff
4624 (defun gnus-summary-search-group (&optional backward use-level)
4625 "Search for next unread newsgroup.
4626 If optional argument BACKWARD is non-nil, search backward instead."
4628 (set-buffer gnus-group-buffer)
4629 (when (gnus-group-search-forward
4630 backward nil (if use-level (gnus-group-group-level) nil))
4631 (gnus-group-group-name))))
4633 (defun gnus-summary-best-group (&optional exclude-group)
4634 "Find the name of the best unread group.
4635 If EXCLUDE-GROUP, do not go to this group."
4637 (set-buffer gnus-group-buffer)
4639 (gnus-group-best-unread-group exclude-group))))
4641 (defun gnus-summary-find-next (&optional unread article backward)
4642 (if backward (gnus-summary-find-prev)
4643 (let* ((dummy (gnus-summary-article-intangible-p))
4644 (article (or article (gnus-summary-article-number)))
4645 (arts (gnus-data-find-list article))
4647 (when (and (not dummy)
4648 (or (not gnus-summary-check-current)
4650 (not (gnus-data-unread-p (car arts)))))
4651 (setq arts (cdr arts)))
4656 (when (gnus-data-unread-p (car arts))
4657 (setq result (car arts)
4659 (setq arts (cdr arts)))
4662 (goto-char (gnus-data-pos result))
4663 (gnus-data-number result)))))
4665 (defun gnus-summary-find-prev (&optional unread article)
4666 (let* ((eobp (eobp))
4667 (article (or article (gnus-summary-article-number)))
4668 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4670 (when (and (not eobp)
4671 (or (not gnus-summary-check-current)
4673 (not (gnus-data-unread-p (car arts)))))
4674 (setq arts (cdr arts)))
4679 (when (gnus-data-unread-p (car arts))
4680 (setq result (car arts)
4682 (setq arts (cdr arts)))
4685 (goto-char (gnus-data-pos result))
4686 (gnus-data-number result))))
4688 (defun gnus-summary-find-subject (subject &optional unread backward article)
4689 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4690 (article (or article (gnus-summary-article-number)))
4691 (articles (gnus-data-list backward))
4692 (arts (gnus-data-find-list article articles))
4694 (when (or (not gnus-summary-check-current)
4696 (not (gnus-data-unread-p (car arts))))
4697 (setq arts (cdr arts)))
4699 (and (or (not unread)
4700 (gnus-data-unread-p (car arts)))
4701 (vectorp (gnus-data-header (car arts)))
4703 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4704 (setq result (car arts)
4706 (setq arts (cdr arts)))
4708 (goto-char (gnus-data-pos result))
4709 (gnus-data-number result))))
4711 (defun gnus-summary-search-forward (&optional unread subject backward)
4712 "Search forward for an article.
4713 If UNREAD, look for unread articles. If SUBJECT, look for
4714 articles with that subject. If BACKWARD, search backward instead."
4715 (cond (subject (gnus-summary-find-subject subject unread backward))
4716 (backward (gnus-summary-find-prev unread))
4717 (t (gnus-summary-find-next unread))))
4719 (defun gnus-recenter (&optional n)
4720 "Center point in window and redisplay frame.
4721 Also do horizontal recentering."
4723 (when (and gnus-auto-center-summary
4724 (not (eq gnus-auto-center-summary 'vertical)))
4725 (gnus-horizontal-recenter))
4728 (defun gnus-summary-recenter ()
4729 "Center point in the summary window.
4730 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4731 displayed, no centering will be performed."
4732 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4733 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4734 (let* ((top (cond ((< (window-height) 4) 0)
4735 ((< (window-height) 7) 1)
4737 (height (1- (window-height)))
4738 (bottom (save-excursion (goto-char (point-max))
4739 (forward-line (- height))
4741 (window (get-buffer-window (current-buffer))))
4742 ;; The user has to want it.
4743 (when gnus-auto-center-summary
4744 (when (get-buffer-window gnus-article-buffer)
4745 ;; Only do recentering when the article buffer is displayed,
4746 ;; Set the window start to either `bottom', which is the biggest
4747 ;; possible valid number, or the second line from the top,
4748 ;; whichever is the least.
4750 window (min bottom (save-excursion
4751 (forward-line (- top)) (point)))))
4752 ;; Do horizontal recentering while we're at it.
4753 (when (and (get-buffer-window (current-buffer) t)
4754 (not (eq gnus-auto-center-summary 'vertical)))
4755 (let ((selected (selected-window)))
4756 (select-window (get-buffer-window (current-buffer) t))
4757 (gnus-summary-position-point)
4758 (gnus-horizontal-recenter)
4759 (select-window selected))))))
4761 (defun gnus-summary-jump-to-group (newsgroup)
4762 "Move point to NEWSGROUP in group mode buffer."
4763 ;; Keep update point of group mode buffer if visible.
4764 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4765 (save-window-excursion
4766 ;; Take care of tree window mode.
4767 (when (get-buffer-window gnus-group-buffer)
4768 (pop-to-buffer gnus-group-buffer))
4769 (gnus-group-jump-to-group newsgroup))
4771 ;; Take care of tree window mode.
4772 (if (get-buffer-window gnus-group-buffer)
4773 (pop-to-buffer gnus-group-buffer)
4774 (set-buffer gnus-group-buffer))
4775 (gnus-group-jump-to-group newsgroup))))
4777 ;; This function returns a list of article numbers based on the
4778 ;; difference between the ranges of read articles in this group and
4779 ;; the range of active articles.
4780 (defun gnus-list-of-unread-articles (group)
4781 (let* ((read (gnus-info-read (gnus-get-info group)))
4782 (active (or (gnus-active group) (gnus-activate-group group)))
4785 ;; If none are read, then all are unread.
4787 (setq first (car active))
4788 ;; If the range of read articles is a single range, then the
4789 ;; first unread article is the article after the last read
4790 ;; article. Sounds logical, doesn't it?
4791 (if (not (listp (cdr read)))
4792 (setq first (1+ (cdr read)))
4793 ;; `read' is a list of ranges.
4794 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4800 (while (< first nlast)
4802 (setq first (1+ first))))
4803 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4804 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4805 (setq read (cdr read)))))
4806 ;; And add the last unread articles.
4807 (while (<= first last)
4809 (setq first (1+ first)))
4810 ;; Return the list of unread articles.
4811 (delq 0 (nreverse unread))))
4813 (defun gnus-list-of-read-articles (group)
4814 "Return a list of unread, unticked and non-dormant articles."
4815 (let* ((info (gnus-get-info group))
4816 (marked (gnus-info-marks info))
4817 (active (gnus-active group)))
4819 (gnus-set-difference
4820 (gnus-sorted-complement
4821 (gnus-uncompress-range active)
4822 (gnus-list-of-unread-articles group))
4824 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4825 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4827 ;; Various summary commands
4829 (defun gnus-summary-universal-argument (arg)
4830 "Perform any operation on all articles that are process/prefixed."
4832 (gnus-set-global-variables)
4833 (let ((articles (gnus-summary-work-articles arg))
4840 (substitute-command-keys
4841 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4844 (gnus-error 1 "Undefined key")
4847 (gnus-summary-goto-subject (setq article (pop articles)))
4848 (let (gnus-newsgroup-processable)
4849 (command-execute func))
4850 (gnus-summary-remove-process-mark article)))))
4851 (gnus-summary-position-point))
4853 (defun gnus-summary-toggle-truncation (&optional arg)
4854 "Toggle truncation of summary lines.
4855 With arg, turn line truncation on iff arg is positive."
4857 (setq truncate-lines
4858 (if (null arg) (not truncate-lines)
4859 (> (prefix-numeric-value arg) 0)))
4862 (defun gnus-summary-reselect-current-group (&optional all rescan)
4863 "Exit and then reselect the current newsgroup.
4864 The prefix argument ALL means to select all articles."
4866 (gnus-set-global-variables)
4867 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4868 (error "Ephemeral groups can't be reselected"))
4869 (let ((current-subject (gnus-summary-article-number))
4870 (group gnus-newsgroup-name))
4871 (setq gnus-newsgroup-begin nil)
4873 ;; We have to adjust the point of group mode buffer because
4874 ;; point was moved to the next unread newsgroup by exiting.
4875 (gnus-summary-jump-to-group group)
4878 (gnus-group-get-new-news-this-group 1)))
4879 (gnus-group-read-group all t)
4880 (gnus-summary-goto-subject current-subject nil t)))
4882 (defun gnus-summary-rescan-group (&optional all)
4883 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4885 (gnus-summary-reselect-current-group all t))
4887 (defun gnus-summary-update-info (&optional non-destructive)
4889 (let ((group gnus-newsgroup-name))
4890 (when gnus-newsgroup-kill-headers
4891 (setq gnus-newsgroup-killed
4892 (gnus-compress-sequence
4894 (gnus-set-sorted-intersection
4895 (gnus-uncompress-range gnus-newsgroup-killed)
4896 (setq gnus-newsgroup-unselected
4897 (sort gnus-newsgroup-unselected '<)))
4898 (setq gnus-newsgroup-unreads
4899 (sort gnus-newsgroup-unreads '<)))
4901 (unless (listp (cdr gnus-newsgroup-killed))
4902 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4903 (let ((headers gnus-newsgroup-headers))
4904 (when (and (not gnus-save-score)
4905 (not non-destructive))
4906 (setq gnus-newsgroup-scored nil))
4907 ;; Set the new ranges of read articles.
4909 (set-buffer gnus-group-buffer)
4910 (gnus-undo-force-boundary))
4911 (gnus-update-read-articles
4912 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4913 ;; Set the current article marks.
4915 ;; Do the cross-ref thing.
4916 (when gnus-use-cross-reference
4917 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4918 ;; Do adaptive scoring, and possibly save score files.
4919 (when gnus-newsgroup-adaptive
4920 (gnus-score-adaptive))
4921 (when gnus-use-scoring
4923 ;; Do not switch windows but change the buffer to work.
4924 (set-buffer gnus-group-buffer)
4925 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4926 (gnus-group-update-group group))))))
4928 (defun gnus-summary-save-newsrc (&optional force)
4929 "Save the current number of read/marked articles in the dribble buffer.
4930 The dribble buffer will then be saved.
4931 If FORCE (the prefix), also save the .newsrc file(s)."
4933 (gnus-summary-update-info t)
4935 (gnus-save-newsrc-file)
4936 (gnus-dribble-save)))
4938 (defun gnus-summary-exit (&optional temporary)
4939 "Exit reading current newsgroup, and then return to group selection mode.
4940 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4942 (gnus-set-global-variables)
4943 (gnus-kill-save-kill-buffer)
4944 (let* ((group gnus-newsgroup-name)
4945 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4948 (buf (current-buffer)))
4949 (run-hooks 'gnus-summary-prepare-exit-hook)
4950 ;; If we have several article buffers, we kill them at exit.
4951 (unless gnus-single-article-buffer
4952 (gnus-kill-buffer gnus-original-article-buffer)
4953 (setq gnus-article-current nil))
4954 (when gnus-use-cache
4955 (gnus-cache-possibly-remove-articles)
4956 (gnus-cache-save-buffers))
4957 (gnus-async-prefetch-remove-group group)
4958 (when gnus-suppress-duplicates
4959 (gnus-dup-enter-articles))
4960 (when gnus-use-trees
4961 (gnus-tree-close group))
4962 ;; Make all changes in this group permanent.
4964 (run-hooks 'gnus-exit-group-hook)
4965 (gnus-summary-update-info))
4966 (gnus-close-group group)
4967 ;; Make sure where we were, and go to next newsgroup.
4968 (set-buffer gnus-group-buffer)
4970 (gnus-group-jump-to-group group))
4971 (run-hooks 'gnus-summary-exit-hook)
4973 (gnus-group-next-unread-group 1))
4974 (setq group-point (point))
4977 ;; If we have several article buffers, we kill them at exit.
4978 (unless gnus-single-article-buffer
4979 (gnus-kill-buffer gnus-article-buffer)
4980 (gnus-kill-buffer gnus-original-article-buffer)
4981 (setq gnus-article-current nil))
4983 (if (not gnus-kill-summary-on-exit)
4984 (gnus-deaden-summary)
4985 ;; We set all buffer-local variables to nil. It is unclear why
4986 ;; this is needed, but if we don't, buffer-local variables are
4987 ;; not garbage-collected, it seems. This would the lead to en
4988 ;; ever-growing Emacs.
4989 (gnus-summary-clear-local-variables)
4990 (when (get-buffer gnus-article-buffer)
4991 (bury-buffer gnus-article-buffer))
4992 ;; We clear the global counterparts of the buffer-local
4993 ;; variables as well, just to be on the safe side.
4994 (set-buffer gnus-group-buffer)
4995 (gnus-summary-clear-local-variables)
4996 ;; Return to group mode buffer.
4997 (when (eq mode 'gnus-summary-mode)
4998 (gnus-kill-buffer buf)))
4999 (setq gnus-current-select-method gnus-select-method)
5000 (pop-to-buffer gnus-group-buffer)
5001 ;; Clear the current group name.
5002 (if (not quit-config)
5004 (goto-char group-point)
5005 (gnus-configure-windows 'group 'force))
5006 (gnus-handle-ephemeral-exit quit-config))
5008 (setq gnus-newsgroup-name nil)))))
5010 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5011 (defun gnus-summary-exit-no-update (&optional no-questions)
5012 "Quit reading current newsgroup without updating read article info."
5014 (gnus-set-global-variables)
5015 (let* ((group gnus-newsgroup-name)
5016 (quit-config (gnus-group-quit-config group)))
5017 (when (or no-questions
5019 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5020 ;; If we have several article buffers, we kill them at exit.
5021 (unless gnus-single-article-buffer
5022 (gnus-kill-buffer gnus-article-buffer)
5023 (gnus-kill-buffer gnus-original-article-buffer)
5024 (setq gnus-article-current nil))
5025 (if (not gnus-kill-summary-on-exit)
5026 (gnus-deaden-summary)
5027 (gnus-close-group group)
5028 (gnus-summary-clear-local-variables)
5029 (set-buffer gnus-group-buffer)
5030 (gnus-summary-clear-local-variables)
5031 (when (get-buffer gnus-summary-buffer)
5032 (kill-buffer gnus-summary-buffer)))
5033 (unless gnus-single-article-buffer
5034 (setq gnus-article-current nil))
5035 (when gnus-use-trees
5036 (gnus-tree-close group))
5037 (gnus-async-prefetch-remove-group group)
5038 (when (get-buffer gnus-article-buffer)
5039 (bury-buffer gnus-article-buffer))
5040 ;; Return to the group buffer.
5041 (gnus-configure-windows 'group 'force)
5042 ;; Clear the current group name.
5043 (setq gnus-newsgroup-name nil)
5044 (when (equal (gnus-group-group-name) group)
5045 (gnus-group-next-unread-group 1))
5047 (gnus-handle-ephemeral-exit quit-config)))))
5049 (defun gnus-handle-ephemeral-exit (quit-config)
5050 "Handle movement when leaving an ephemeral group. The state
5051 which existed when entering the ephemeral is reset."
5052 (if (not (buffer-name (car quit-config)))
5053 (gnus-configure-windows 'group 'force)
5054 (set-buffer (car quit-config))
5055 (cond ((eq major-mode 'gnus-summary-mode)
5056 (gnus-set-global-variables))
5057 ((eq major-mode 'gnus-article-mode)
5059 ;; The `gnus-summary-buffer' variable may point
5060 ;; to the old summary buffer when using a single
5062 (unless (gnus-buffer-live-p gnus-summary-buffer)
5063 (set-buffer gnus-group-buffer))
5064 (set-buffer gnus-summary-buffer)
5065 (gnus-set-global-variables))))
5066 (if (or (eq (cdr quit-config) 'article)
5067 (eq (cdr quit-config) 'pick))
5069 ;; The current article may be from the ephemeral group
5070 ;; thus it is best that we reload this article
5071 (gnus-summary-show-article)
5072 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5073 (gnus-configure-windows 'pick 'force)
5074 (gnus-configure-windows (cdr quit-config) 'force)))
5075 (gnus-configure-windows (cdr quit-config) 'force))
5076 (when (eq major-mode 'gnus-summary-mode)
5077 (gnus-summary-next-subject 1 nil t)
5078 (gnus-summary-recenter)
5079 (gnus-summary-position-point))))
5083 (defvar gnus-dead-summary-mode-map nil)
5085 (unless gnus-dead-summary-mode-map
5086 (setq gnus-dead-summary-mode-map (make-keymap))
5087 (suppress-keymap gnus-dead-summary-mode-map)
5088 (substitute-key-definition
5089 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5090 (let ((keys '("\C-d" "\r" "\177" [delete])))
5092 (define-key gnus-dead-summary-mode-map
5093 (pop keys) 'gnus-summary-wake-up-the-dead))))
5095 (defvar gnus-dead-summary-mode nil
5096 "Minor mode for Gnus summary buffers.")
5098 (defun gnus-dead-summary-mode (&optional arg)
5099 "Minor mode for Gnus summary buffers."
5101 (when (eq major-mode 'gnus-summary-mode)
5102 (make-local-variable 'gnus-dead-summary-mode)
5103 (setq gnus-dead-summary-mode
5104 (if (null arg) (not gnus-dead-summary-mode)
5105 (> (prefix-numeric-value arg) 0)))
5106 (when gnus-dead-summary-mode
5107 (gnus-add-minor-mode
5108 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5110 (defun gnus-deaden-summary ()
5111 "Make the current summary buffer into a dead summary buffer."
5112 ;; Kill any previous dead summary buffer.
5113 (when (and gnus-dead-summary
5114 (buffer-name gnus-dead-summary))
5116 (set-buffer gnus-dead-summary)
5117 (when gnus-dead-summary-mode
5118 (kill-buffer (current-buffer)))))
5119 ;; Make this the current dead summary.
5120 (setq gnus-dead-summary (current-buffer))
5121 (gnus-dead-summary-mode 1)
5122 (let ((name (buffer-name)))
5123 (when (string-match "Summary" name)
5125 (concat (substring name 0 (match-beginning 0)) "Dead "
5126 (substring name (match-beginning 0)))
5129 (defun gnus-kill-or-deaden-summary (buffer)
5130 "Kill or deaden the summary BUFFER."
5131 (when (and (buffer-name buffer)
5132 (not gnus-single-article-buffer))
5135 (gnus-kill-buffer gnus-article-buffer)
5136 (gnus-kill-buffer gnus-original-article-buffer)))
5137 (cond (gnus-kill-summary-on-exit
5138 (when (and gnus-use-trees
5139 (and (get-buffer buffer)
5140 (buffer-name (get-buffer buffer))))
5142 (set-buffer (get-buffer buffer))
5143 (gnus-tree-close gnus-newsgroup-name)))
5144 (gnus-kill-buffer buffer))
5145 ((and (get-buffer buffer)
5146 (buffer-name (get-buffer buffer)))
5149 (gnus-deaden-summary)))))
5151 (defun gnus-summary-wake-up-the-dead (&rest args)
5152 "Wake up the dead summary buffer."
5154 (gnus-dead-summary-mode -1)
5155 (let ((name (buffer-name)))
5156 (when (string-match "Dead " name)
5158 (concat (substring name 0 (match-beginning 0))
5159 (substring name (match-end 0)))
5161 (gnus-message 3 "This dead summary is now alive again"))
5163 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5164 (defun gnus-summary-fetch-faq (&optional faq-dir)
5165 "Fetch the FAQ for the current group.
5166 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5170 (when current-prefix-arg
5172 "Faq dir: " (and (listp gnus-group-faq-directory)
5173 (mapcar (lambda (file) (list file))
5174 gnus-group-faq-directory))))))
5175 (let (gnus-faq-buffer)
5176 (when (setq gnus-faq-buffer
5177 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5178 (gnus-configure-windows 'summary-faq))))
5180 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5181 (defun gnus-summary-describe-group (&optional force)
5182 "Describe the current newsgroup."
5184 (gnus-group-describe-group force gnus-newsgroup-name))
5186 (defun gnus-summary-describe-briefly ()
5187 "Describe summary mode commands briefly."
5190 (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")))
5192 ;; Walking around group mode buffer from summary mode.
5194 (defun gnus-summary-next-group (&optional no-article target-group backward)
5195 "Exit current newsgroup and then select next unread newsgroup.
5196 If prefix argument NO-ARTICLE is non-nil, no article is selected
5197 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5198 previous group instead."
5200 (gnus-set-global-variables)
5201 ;; Stop pre-fetching.
5202 (gnus-async-halt-prefetch)
5203 (let ((current-group gnus-newsgroup-name)
5204 (current-buffer (current-buffer))
5206 ;; First we semi-exit this group to update Xrefs and all variables.
5207 ;; We can't do a real exit, because the window conf must remain
5208 ;; the same in case the user is prompted for info, and we don't
5209 ;; want the window conf to change before that...
5210 (gnus-summary-exit t)
5211 (while (not entered)
5212 ;; Then we find what group we are supposed to enter.
5213 (set-buffer gnus-group-buffer)
5214 (gnus-group-jump-to-group current-group)
5217 (if (eq gnus-keep-same-level 'best)
5218 (gnus-summary-best-group gnus-newsgroup-name)
5219 (gnus-summary-search-group backward gnus-keep-same-level))))
5220 (if (not target-group)
5221 ;; There are no further groups, so we return to the group
5224 (gnus-message 5 "Returning to the group buffer")
5226 (when (gnus-buffer-live-p current-buffer)
5227 (set-buffer current-buffer)
5228 (gnus-summary-exit))
5229 (run-hooks 'gnus-group-no-more-groups-hook))
5230 ;; We try to enter the target group.
5231 (gnus-group-jump-to-group target-group)
5232 (let ((unreads (gnus-group-group-unread)))
5233 (if (and (or (eq t unreads)
5234 (and unreads (not (zerop unreads))))
5235 (gnus-summary-read-group
5236 target-group nil no-article
5237 (and (buffer-name current-buffer) current-buffer)))
5239 (setq current-group target-group
5240 target-group nil)))))))
5242 (defun gnus-summary-prev-group (&optional no-article)
5243 "Exit current newsgroup and then select previous unread newsgroup.
5244 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5246 (gnus-summary-next-group no-article nil t))
5248 ;; Walking around summary lines.
5250 (defun gnus-summary-first-subject (&optional unread)
5251 "Go to the first unread subject.
5252 If UNREAD is non-nil, go to the first unread article.
5253 Returns the article selected or nil if there are no unread articles."
5258 ((null gnus-newsgroup-data)
5259 (gnus-message 3 "No articles in the group")
5261 ;; Pick the first article.
5263 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5264 (gnus-data-number (car gnus-newsgroup-data)))
5265 ;; No unread articles.
5266 ((null gnus-newsgroup-unreads)
5267 (gnus-message 3 "No more unread articles")
5269 ;; Find the first unread article.
5271 (let ((data gnus-newsgroup-data))
5273 (not (gnus-data-unread-p (car data))))
5274 (setq data (cdr data)))
5276 (goto-char (gnus-data-pos (car data)))
5277 (gnus-data-number (car data))))))
5278 (gnus-summary-position-point)))
5280 (defun gnus-summary-next-subject (n &optional unread dont-display)
5281 "Go to next N'th summary line.
5282 If N is negative, go to the previous N'th subject line.
5283 If UNREAD is non-nil, only unread articles are selected.
5284 The difference between N and the actual number of steps taken is
5287 (let ((backward (< n 0))
5291 (gnus-summary-find-prev unread)
5292 (gnus-summary-find-next unread)))
5295 (gnus-message 7 "No more%s articles"
5296 (if unread " unread" "")))
5297 (unless dont-display
5298 (gnus-summary-recenter)
5299 (gnus-summary-position-point))
5302 (defun gnus-summary-next-unread-subject (n)
5303 "Go to next N'th unread summary line."
5305 (gnus-summary-next-subject n t))
5307 (defun gnus-summary-prev-subject (n &optional unread)
5308 "Go to previous N'th summary line.
5309 If optional argument UNREAD is non-nil, only unread article is selected."
5311 (gnus-summary-next-subject (- n) unread))
5313 (defun gnus-summary-prev-unread-subject (n)
5314 "Go to previous N'th unread summary line."
5316 (gnus-summary-next-subject (- n) t))
5318 (defun gnus-summary-goto-subject (article &optional force silent)
5319 "Go the subject line of ARTICLE.
5320 If FORCE, also allow jumping to articles not currently shown."
5321 (interactive "nArticle number: ")
5323 (data (gnus-data-find article)))
5324 ;; We read in the article if we have to.
5327 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5328 (setq data (gnus-data-find article)))
5333 (gnus-message 3 "Can't find article %d" article))
5335 (goto-char (gnus-data-pos data))
5338 ;; Walking around summary lines with displaying articles.
5340 (defun gnus-summary-expand-window (&optional arg)
5341 "Make the summary buffer take up the entire Emacs frame.
5342 Given a prefix, will force an `article' buffer configuration."
5344 (gnus-set-global-variables)
5346 (gnus-configure-windows 'article 'force)
5347 (gnus-configure-windows 'summary 'force)))
5349 (defun gnus-summary-display-article (article &optional all-header)
5350 "Display ARTICLE in article buffer."
5351 (gnus-set-global-variables)
5355 (if gnus-summary-display-article-function
5356 (funcall gnus-summary-display-article-function article all-header)
5357 (gnus-article-prepare article all-header))
5358 (run-hooks 'gnus-select-article-hook)
5359 (when (and gnus-current-article
5360 (not (zerop gnus-current-article)))
5361 (gnus-summary-goto-subject gnus-current-article))
5362 (gnus-summary-recenter)
5363 (when (and gnus-use-trees gnus-show-threads)
5364 (gnus-possibly-generate-tree article)
5365 (gnus-highlight-selected-tree article))
5366 ;; Successfully display article.
5367 (gnus-article-set-window-start
5368 (cdr (assq article gnus-newsgroup-bookmarks))))))
5370 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5371 "Select the current article.
5372 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5373 non-nil, the article will be re-fetched even if it already present in
5374 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5376 ;; Make sure we are in the summary buffer to work around bbdb bug.
5377 (unless (eq major-mode 'gnus-summary-mode)
5378 (set-buffer gnus-summary-buffer))
5379 (let ((article (or article (gnus-summary-article-number)))
5380 (all-headers (not (not all-headers))) ;Must be T or NIL.
5381 gnus-summary-display-article-function
5384 (gnus-summary-article-pseudo-p article)
5385 (error "This is a pseudo-article"))
5388 (set-buffer gnus-summary-buffer)
5389 (if (or (and gnus-single-article-buffer
5390 (or (null gnus-current-article)
5391 (null gnus-article-current)
5392 (null (get-buffer gnus-article-buffer))
5393 (not (eq article (cdr gnus-article-current)))
5394 (not (equal (car gnus-article-current)
5395 gnus-newsgroup-name))))
5396 (and (not gnus-single-article-buffer)
5397 (or (null gnus-current-article)
5398 (not (eq gnus-current-article article))))
5400 ;; The requested article is different from the current article.
5402 (gnus-summary-display-article article all-headers)
5404 (when (or all-headers gnus-show-all-headers)
5405 (gnus-article-show-all-headers))
5408 (gnus-article-set-window-start
5409 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5411 (defun gnus-summary-set-current-mark (&optional current-mark)
5412 "Obsolete function."
5415 (defun gnus-summary-next-article (&optional unread subject backward push)
5416 "Select the next article.
5417 If UNREAD, only unread articles are selected.
5418 If SUBJECT, only articles with SUBJECT are selected.
5419 If BACKWARD, the previous article is selected instead of the next."
5421 (gnus-set-global-variables)
5423 ;; Is there such an article?
5424 ((and (gnus-summary-search-forward unread subject backward)
5425 (or (gnus-summary-display-article (gnus-summary-article-number))
5426 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5427 (gnus-summary-position-point))
5428 ;; If not, we try the first unread, if that is wanted.
5430 gnus-auto-select-same
5431 (gnus-summary-first-unread-article))
5432 (gnus-summary-position-point)
5433 (gnus-message 6 "Wrapped"))
5434 ;; Try to get next/previous article not displayed in this group.
5435 ((and gnus-auto-extend-newsgroup
5436 (not unread) (not subject))
5437 (gnus-summary-goto-article
5438 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5440 ;; Go to next/previous group.
5442 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5443 (gnus-summary-jump-to-group gnus-newsgroup-name))
5444 (let ((cmd last-command-char)
5447 (set-buffer gnus-group-buffer)
5450 (if (eq gnus-keep-same-level 'best)
5451 (gnus-summary-best-group gnus-newsgroup-name)
5452 (gnus-summary-search-group backward gnus-keep-same-level))))
5453 ;; For some reason, the group window gets selected. We change
5455 (select-window (get-buffer-window (current-buffer)))
5456 ;; Select next unread newsgroup automagically.
5458 ((or (not gnus-auto-select-next)
5460 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5461 ((or (eq gnus-auto-select-next 'quietly)
5462 (and (eq gnus-auto-select-next 'slightly-quietly)
5464 (and (eq gnus-auto-select-next 'almost-quietly)
5465 (gnus-summary-last-article-p)))
5467 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5469 (gnus-message 7 "No more%s articles (%s)..."
5470 (if unread " unread" "")
5471 (if group (concat "selecting " group)
5473 (gnus-summary-next-group nil group backward)))
5475 (when (gnus-key-press-event-p last-input-event)
5476 (gnus-summary-walk-group-buffer
5477 gnus-newsgroup-name cmd unread backward point))))))))
5479 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5480 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5481 (?\C-p (gnus-group-prev-unread-group 1))))
5482 (cursor-in-echo-area t)
5483 keve key group ended)
5485 (set-buffer gnus-group-buffer)
5488 (if (eq gnus-keep-same-level 'best)
5489 (gnus-summary-best-group gnus-newsgroup-name)
5490 (gnus-summary-search-group backward gnus-keep-same-level))))
5493 5 "No more%s articles%s" (if unread " unread" "")
5495 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5496 (format " (Type %s for %s [%s])"
5497 (single-key-description cmd) group
5498 (car (gnus-gethash group gnus-newsrc-hashtb)))
5499 (format " (Type %s to exit %s)"
5500 (single-key-description cmd)
5501 gnus-newsgroup-name)))
5502 ;; Confirm auto selection.
5503 (setq key (car (setq keve (gnus-read-event-char))))
5506 ((assq key keystrokes)
5507 (let ((obuf (current-buffer)))
5508 (switch-to-buffer gnus-group-buffer)
5510 (gnus-group-jump-to-group group))
5511 (eval (cadr (assq key keystrokes)))
5512 (setq group (gnus-group-group-name))
5513 (switch-to-buffer obuf))
5517 (gnus-ephemeral-group-p gnus-newsgroup-name))
5519 (gnus-summary-next-group nil group backward)))
5521 (push (cdr keve) unread-command-events))))))
5523 (defun gnus-summary-next-unread-article ()
5524 "Select unread article after current one."
5526 (gnus-summary-next-article
5527 (or (not (eq gnus-summary-goto-unread 'never))
5528 (gnus-summary-last-article-p (gnus-summary-article-number)))
5529 (and gnus-auto-select-same
5530 (gnus-summary-article-subject))))
5532 (defun gnus-summary-prev-article (&optional unread subject)
5533 "Select the article after the current one.
5534 If UNREAD is non-nil, only unread articles are selected."
5536 (gnus-summary-next-article unread subject t))
5538 (defun gnus-summary-prev-unread-article ()
5539 "Select unread article before current one."
5541 (gnus-summary-prev-article
5542 (or (not (eq gnus-summary-goto-unread 'never))
5543 (gnus-summary-first-article-p (gnus-summary-article-number)))
5544 (and gnus-auto-select-same
5545 (gnus-summary-article-subject))))
5547 (defun gnus-summary-next-page (&optional lines circular)
5548 "Show next page of the selected article.
5549 If at the end of the current article, select the next article.
5550 LINES says how many lines should be scrolled up.
5552 If CIRCULAR is non-nil, go to the start of the article instead of
5553 selecting the next article when reaching the end of the current
5556 (setq gnus-summary-buffer (current-buffer))
5557 (gnus-set-global-variables)
5558 (let ((article (gnus-summary-article-number))
5559 (article-window (get-buffer-window gnus-article-buffer t))
5561 (gnus-configure-windows 'article)
5562 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5563 (if (and (eq gnus-summary-goto-unread 'never)
5564 (not (gnus-summary-last-article-p article)))
5565 (gnus-summary-next-article)
5566 (gnus-summary-next-unread-article))
5567 (if (or (null gnus-current-article)
5568 (null gnus-article-current)
5569 (/= article (cdr gnus-article-current))
5570 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5571 ;; Selected subject is different from current article's.
5572 (gnus-summary-display-article article)
5573 (when article-window
5574 (gnus-eval-in-buffer-window gnus-article-buffer
5575 (setq endp (gnus-article-next-page lines)))
5578 (gnus-summary-beginning-of-article))
5580 (gnus-message 3 "End of message"))
5582 (if (and (eq gnus-summary-goto-unread 'never)
5583 (not (gnus-summary-last-article-p article)))
5584 (gnus-summary-next-article)
5585 (gnus-summary-next-unread-article))))))))
5586 (gnus-summary-recenter)
5587 (gnus-summary-position-point)))
5589 (defun gnus-summary-prev-page (&optional lines move)
5590 "Show previous page of selected article.
5591 Argument LINES specifies lines to be scrolled down.
5592 If MOVE, move to the previous unread article if point is at
5593 the beginning of the buffer."
5595 (gnus-set-global-variables)
5596 (let ((article (gnus-summary-article-number))
5597 (article-window (get-buffer-window gnus-article-buffer t))
5599 (gnus-configure-windows 'article)
5600 (if (or (null gnus-current-article)
5601 (null gnus-article-current)
5602 (/= article (cdr gnus-article-current))
5603 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5604 ;; Selected subject is different from current article's.
5605 (gnus-summary-display-article article)
5606 (gnus-summary-recenter)
5607 (when article-window
5608 (gnus-eval-in-buffer-window gnus-article-buffer
5609 (setq endp (gnus-article-prev-page lines)))
5610 (when (and move endp)
5612 (gnus-message 3 "Beginning of message"))
5614 (if (and (eq gnus-summary-goto-unread 'never)
5615 (not (gnus-summary-first-article-p article)))
5616 (gnus-summary-prev-article)
5617 (gnus-summary-prev-unread-article))))))))
5618 (gnus-summary-position-point))
5620 (defun gnus-summary-prev-page-or-article (&optional lines)
5621 "Show previous page of selected article.
5622 Argument LINES specifies lines to be scrolled down.
5623 If at the beginning of the article, go to the next article."
5625 (gnus-summary-prev-page lines t))
5627 (defun gnus-summary-scroll-up (lines)
5628 "Scroll up (or down) one line current article.
5629 Argument LINES specifies lines to be scrolled up (or down if negative)."
5631 (gnus-set-global-variables)
5632 (gnus-configure-windows 'article)
5633 (gnus-summary-show-thread)
5634 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5635 (gnus-eval-in-buffer-window gnus-article-buffer
5637 (when (gnus-article-next-page lines)
5638 (gnus-message 3 "End of message")))
5640 (gnus-article-prev-page (- lines))))))
5641 (gnus-summary-recenter)
5642 (gnus-summary-position-point))
5644 (defun gnus-summary-next-same-subject ()
5645 "Select next article which has the same subject as current one."
5647 (gnus-set-global-variables)
5648 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5650 (defun gnus-summary-prev-same-subject ()
5651 "Select previous article which has the same subject as current one."
5653 (gnus-set-global-variables)
5654 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5656 (defun gnus-summary-next-unread-same-subject ()
5657 "Select next unread article which has the same subject as current one."
5659 (gnus-set-global-variables)
5660 (gnus-summary-next-article t (gnus-summary-article-subject)))
5662 (defun gnus-summary-prev-unread-same-subject ()
5663 "Select previous unread article which has the same subject as current one."
5665 (gnus-set-global-variables)
5666 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5668 (defun gnus-summary-first-unread-article ()
5669 "Select the first unread article.
5670 Return nil if there are no unread articles."
5672 (gnus-set-global-variables)
5674 (when (gnus-summary-first-subject t)
5675 (gnus-summary-show-thread)
5676 (gnus-summary-first-subject t)
5677 (gnus-summary-display-article (gnus-summary-article-number)))
5678 (gnus-summary-position-point)))
5680 (defun gnus-summary-first-article ()
5681 "Select the first article.
5682 Return nil if there are no articles."
5684 (gnus-set-global-variables)
5686 (when (gnus-summary-first-subject)
5687 (gnus-summary-show-thread)
5688 (gnus-summary-first-subject)
5689 (gnus-summary-display-article (gnus-summary-article-number)))
5690 (gnus-summary-position-point)))
5692 (defun gnus-summary-best-unread-article ()
5693 "Select the unread article with the highest score."
5695 (gnus-set-global-variables)
5696 (let ((best -1000000)
5697 (data gnus-newsgroup-data)
5700 (and (gnus-data-unread-p (car data))
5702 (gnus-summary-article-score (gnus-data-number (car data))))
5705 article (gnus-data-number (car data))))
5706 (setq data (cdr data)))
5709 (gnus-summary-goto-article article)
5710 (error "No unread articles"))
5711 (gnus-summary-position-point))))
5713 (defun gnus-summary-last-subject ()
5714 "Go to the last displayed subject line in the group."
5715 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5717 (gnus-summary-goto-subject article))))
5719 (defun gnus-summary-goto-article (article &optional all-headers force)
5720 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5721 If ALL-HEADERS is non-nil, no header lines are hidden."
5725 "Article number or Message-ID: "
5726 (mapcar (lambda (number) (list (int-to-string number)))
5727 gnus-newsgroup-limit))
5731 (if (and (stringp article)
5732 (string-match "@" article))
5733 (gnus-summary-refer-article article)
5734 (when (stringp article)
5735 (setq article (string-to-number article)))
5736 (if (gnus-summary-goto-subject article force)
5737 (gnus-summary-display-article article all-headers)
5738 (gnus-message 4 "Couldn't go to article %s" article) nil))
5739 (gnus-summary-position-point)))
5741 (defun gnus-summary-goto-last-article ()
5742 "Go to the previously read article."
5745 (when gnus-last-article
5746 (gnus-summary-goto-article gnus-last-article))
5747 (gnus-summary-position-point)))
5749 (defun gnus-summary-pop-article (number)
5750 "Pop one article off the history and go to the previous.
5751 NUMBER articles will be popped off."
5754 (setq gnus-newsgroup-history
5755 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5757 (gnus-summary-goto-article (car to))
5758 (error "Article history empty")))
5759 (gnus-summary-position-point))
5761 ;; Summary commands and functions for limiting the summary buffer.
5763 (defun gnus-summary-limit-to-articles (n)
5764 "Limit the summary buffer to the next N articles.
5765 If not given a prefix, use the process marked articles instead."
5767 (gnus-set-global-variables)
5769 (let ((articles (gnus-summary-work-articles n)))
5770 (setq gnus-newsgroup-processable nil)
5771 (gnus-summary-limit articles))
5772 (gnus-summary-position-point)))
5774 (defun gnus-summary-pop-limit (&optional total)
5775 "Restore the previous limit.
5776 If given a prefix, remove all limits."
5778 (gnus-set-global-variables)
5780 (setq gnus-newsgroup-limits
5781 (list (mapcar (lambda (h) (mail-header-number h))
5782 gnus-newsgroup-headers))))
5783 (unless gnus-newsgroup-limits
5784 (error "No limit to pop"))
5786 (gnus-summary-limit nil 'pop)
5787 (gnus-summary-position-point)))
5789 (defun gnus-summary-limit-to-subject (subject &optional header)
5790 "Limit the summary buffer to articles that have subjects that match a regexp."
5791 (interactive "sLimit to subject (regexp): ")
5793 (setq header "subject"))
5794 (when (not (equal "" subject))
5796 (let ((articles (gnus-summary-find-matching
5797 (or header "subject") subject 'all)))
5799 (error "Found no matches for \"%s\"" subject))
5800 (gnus-summary-limit articles))
5801 (gnus-summary-position-point))))
5803 (defun gnus-summary-limit-to-author (from)
5804 "Limit the summary buffer to articles that have authors that match a regexp."
5805 (interactive "sLimit to author (regexp): ")
5806 (gnus-summary-limit-to-subject from "from"))
5808 (defun gnus-summary-limit-to-age (age &optional younger-p)
5809 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5810 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5811 articles that are younger than AGE days."
5812 (interactive "nTime in days: \nP")
5814 (let ((data gnus-newsgroup-data)
5815 (cutoff (nnmail-days-to-time age))
5816 articles d date is-younger)
5817 (while (setq d (pop data))
5818 (when (and (vectorp (gnus-data-header d))
5819 (setq date (mail-header-date (gnus-data-header d))))
5820 (setq is-younger (nnmail-time-less
5821 (nnmail-time-since (nnmail-date-to-time date))
5823 (when (if younger-p is-younger (not is-younger))
5824 (push (gnus-data-number d) articles))))
5825 (gnus-summary-limit (nreverse articles)))
5826 (gnus-summary-position-point)))
5828 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5830 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5832 (defun gnus-summary-limit-to-unread (&optional all)
5833 "Limit the summary buffer to articles that are not marked as read.
5834 If ALL is non-nil, limit strictly to unread articles."
5837 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5838 (gnus-summary-limit-to-marks
5839 ;; Concat all the marks that say that an article is read and have
5841 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5842 gnus-killed-mark gnus-kill-file-mark
5843 gnus-low-score-mark gnus-expirable-mark
5844 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5845 gnus-duplicate-mark gnus-souped-mark)
5848 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5849 (make-obsolete 'gnus-summary-delete-marked-with
5850 'gnus-summary-limit-exlude-marks)
5852 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5853 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5854 If REVERSE, limit the summary buffer to articles that are marked
5855 with MARKS. MARKS can either be a string of marks or a list of marks.
5856 Returns how many articles were removed."
5857 (interactive "sMarks: ")
5858 (gnus-summary-limit-to-marks marks t))
5860 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5861 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5862 If REVERSE (the prefix), limit the summary buffer to articles that are
5863 not marked with MARKS. MARKS can either be a string of marks or a
5865 Returns how many articles were removed."
5866 (interactive (list (read-string "Marks: ") current-prefix-arg))
5867 (gnus-set-global-variables)
5869 (let ((data gnus-newsgroup-data)
5870 (marks (if (listp marks) marks
5871 (append marks nil))) ; Transform to list.
5874 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5875 (memq (gnus-data-mark (car data)) marks))
5876 (push (gnus-data-number (car data)) articles))
5877 (setq data (cdr data)))
5878 (gnus-summary-limit articles))
5879 (gnus-summary-position-point)))
5881 (defun gnus-summary-limit-to-score (&optional score)
5882 "Limit to articles with score at or above SCORE."
5884 (gnus-set-global-variables)
5885 (setq score (if score
5886 (prefix-numeric-value score)
5887 (or gnus-summary-default-score 0)))
5888 (let ((data gnus-newsgroup-data)
5891 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5893 (push (gnus-data-number (car data)) articles))
5894 (setq data (cdr data)))
5896 (gnus-summary-limit articles)
5897 (gnus-summary-position-point))))
5899 (defun gnus-summary-limit-include-dormant ()
5900 "Display all the hidden articles that are marked as dormant."
5902 (gnus-set-global-variables)
5903 (unless gnus-newsgroup-dormant
5904 (error "There are no dormant articles in this group"))
5906 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5907 (gnus-summary-position-point)))
5909 (defun gnus-summary-limit-exclude-dormant ()
5910 "Hide all dormant articles."
5912 (gnus-set-global-variables)
5914 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5915 (gnus-summary-position-point)))
5917 (defun gnus-summary-limit-exclude-childless-dormant ()
5918 "Hide all dormant articles that have no children."
5920 (gnus-set-global-variables)
5921 (let ((data (gnus-data-list t))
5922 articles d children)
5923 ;; Find all articles that are either not dormant or have
5925 (while (setq d (pop data))
5926 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5928 (gnus-article-children (gnus-data-number d)))
5931 (when (memq (car children) articles)
5936 (push (gnus-data-number d) articles)))
5939 (gnus-summary-limit articles)
5940 (gnus-summary-position-point))))
5942 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5943 "Mark all unread excluded articles as read.
5944 If ALL, mark even excluded ticked and dormants as read."
5946 (let ((articles (gnus-sorted-complement
5948 (mapcar (lambda (h) (mail-header-number h))
5949 gnus-newsgroup-headers)
5951 (sort gnus-newsgroup-limit '<)))
5953 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
5955 (setq gnus-newsgroup-dormant nil
5956 gnus-newsgroup-marked nil
5957 gnus-newsgroup-reads
5959 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5960 gnus-newsgroup-reads))
5961 (while (setq article (pop articles))
5962 (unless (or (memq article gnus-newsgroup-dormant)
5963 (memq article gnus-newsgroup-marked))
5964 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5966 (defun gnus-summary-limit (articles &optional pop)
5968 ;; We pop the previous limit off the stack and use that.
5969 (setq articles (car gnus-newsgroup-limits)
5970 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5971 ;; We use the new limit, so we push the old limit on the stack.
5972 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5974 (setq gnus-newsgroup-limit articles)
5975 (let ((total (length gnus-newsgroup-data))
5976 (data (gnus-data-find-list (gnus-summary-article-number)))
5977 (gnus-summary-mark-below nil) ; Inhibit this.
5979 ;; This will do all the work of generating the new summary buffer
5980 ;; according to the new limit.
5981 (gnus-summary-prepare)
5982 ;; Hide any threads, possibly.
5983 (and gnus-show-threads
5984 gnus-thread-hide-subtree
5985 (gnus-summary-hide-all-threads))
5986 ;; Try to return to the article you were at, or one in the
5989 ;; We try to find some article after the current one.
5991 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5994 (setq data (cdr data))))
5996 ;; If there is no data, that means that we were after the last
5997 ;; article. The same goes when we can't find any articles
5998 ;; after the current one.
5999 (goto-char (point-max))
6000 (gnus-summary-find-prev))
6001 ;; We return how many articles were removed from the summary
6002 ;; buffer as a result of the new limit.
6003 (- total (length gnus-newsgroup-data))))
6005 (defsubst gnus-invisible-cut-children (threads)
6008 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6013 (defsubst gnus-cut-thread (thread)
6014 "Go forwards in the thread until we find an article that we want to display."
6015 (when (or (eq gnus-fetch-old-headers 'some)
6016 (eq gnus-build-sparse-threads 'some)
6017 (eq gnus-build-sparse-threads 'more))
6018 ;; Deal with old-fetched headers and sparse threads.
6022 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6023 (gnus-summary-article-ancient-p
6024 (mail-header-number (car thread))))
6026 (if (<= (length (cdr thread)) 1)
6027 (setq gnus-newsgroup-limit
6028 (delq (mail-header-number (car thread))
6029 gnus-newsgroup-limit)
6030 thread (cadr thread))
6031 (when (gnus-invisible-cut-children (cdr thread))
6032 (let ((th (cdr thread)))
6034 (if (memq (mail-header-number (caar th))
6035 gnus-newsgroup-limit)
6036 (setq thread (car th)
6038 (setq th (cdr th)))))))))))
6041 (defun gnus-cut-threads (threads)
6042 "Cut off all uninteresting articles from the beginning of threads."
6043 (when (or (eq gnus-fetch-old-headers 'some)
6044 (eq gnus-build-sparse-threads 'some)
6045 (eq gnus-build-sparse-threads 'more))
6048 (setcar th (gnus-cut-thread (car th)))
6049 (setq th (cdr th)))))
6050 ;; Remove nixed out threads.
6053 (defun gnus-summary-initial-limit (&optional show-if-empty)
6054 "Figure out what the initial limit is supposed to be on group entry.
6055 This entails weeding out unwanted dormants, low-scored articles,
6056 fetch-old-headers verbiage, and so on."
6057 ;; Most groups have nothing to remove.
6058 (if (or gnus-inhibit-limiting
6059 (and (null gnus-newsgroup-dormant)
6060 (not (eq gnus-fetch-old-headers 'some))
6061 (null gnus-summary-expunge-below)
6062 (not (eq gnus-build-sparse-threads 'some))
6063 (not (eq gnus-build-sparse-threads 'more))
6064 (null gnus-thread-expunge-below)
6065 (not gnus-use-nocem)))
6067 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6068 (setq gnus-newsgroup-limit nil)
6071 (unless (car (symbol-value node))
6072 ;; These threads have no parents -- they are roots.
6073 (let ((nodes (cdr (symbol-value node)))
6076 (if (and gnus-thread-expunge-below
6077 (< (gnus-thread-total-score (car nodes))
6078 gnus-thread-expunge-below))
6079 (gnus-expunge-thread (pop nodes))
6080 (setq thread (pop nodes))
6081 (gnus-summary-limit-children thread))))))
6082 gnus-newsgroup-dependencies)
6083 ;; If this limitation resulted in an empty group, we might
6084 ;; pop the previous limit and use it instead.
6085 (when (and (not gnus-newsgroup-limit)
6087 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6088 gnus-newsgroup-limit))
6090 (defun gnus-summary-limit-children (thread)
6091 "Return 1 if this subthread is visible and 0 if it is not."
6092 ;; First we get the number of visible children to this thread. This
6093 ;; is done by recursing down the thread using this function, so this
6094 ;; will really go down to a leaf article first, before slowly
6095 ;; working its way up towards the root.
6099 (apply '+ (mapcar 'gnus-summary-limit-children
6102 (number (mail-header-number (car thread)))
6105 (not (memq number gnus-newsgroup-marked))
6107 ;; If this article is dormant and has absolutely no visible
6108 ;; children, then this article isn't visible.
6109 (and (memq number gnus-newsgroup-dormant)
6111 ;; If this is "fetch-old-headered" and there is no
6112 ;; visible children, then we don't want this article.
6113 (and (eq gnus-fetch-old-headers 'some)
6114 (gnus-summary-article-ancient-p number)
6116 ;; If this is a sparsely inserted article with no children,
6117 ;; we don't want it.
6118 (and (eq gnus-build-sparse-threads 'some)
6119 (gnus-summary-article-sparse-p number)
6121 ;; If we use expunging, and this article is really
6122 ;; low-scored, then we don't want this article.
6123 (when (and gnus-summary-expunge-below
6125 (or (cdr (assq number gnus-newsgroup-scored))
6126 gnus-summary-default-score))
6127 gnus-summary-expunge-below))
6128 ;; We increase the expunge-tally here, but that has
6129 ;; nothing to do with the limits, really.
6130 (incf gnus-newsgroup-expunged-tally)
6131 ;; We also mark as read here, if that's wanted.
6132 (when (and gnus-summary-mark-below
6133 (< score gnus-summary-mark-below))
6134 (setq gnus-newsgroup-unreads
6135 (delq number gnus-newsgroup-unreads))
6136 (if gnus-newsgroup-auto-expire
6137 (push number gnus-newsgroup-expirable)
6138 (push (cons number gnus-low-score-mark)
6139 gnus-newsgroup-reads)))
6141 ;; Check NoCeM things.
6142 (if (and gnus-use-nocem
6143 (gnus-nocem-unwanted-article-p
6144 (mail-header-id (car thread))))
6146 (setq gnus-newsgroup-unreads
6147 (delq number gnus-newsgroup-unreads))
6149 ;; Nope, invisible article.
6151 ;; Ok, this article is to be visible, so we add it to the limit
6153 (push number gnus-newsgroup-limit)
6156 (defun gnus-expunge-thread (thread)
6157 "Mark all articles in THREAD as read."
6158 (let* ((number (mail-header-number (car thread))))
6159 (incf gnus-newsgroup-expunged-tally)
6160 ;; We also mark as read here, if that's wanted.
6161 (setq gnus-newsgroup-unreads
6162 (delq number gnus-newsgroup-unreads))
6163 (if gnus-newsgroup-auto-expire
6164 (push number gnus-newsgroup-expirable)
6165 (push (cons number gnus-low-score-mark)
6166 gnus-newsgroup-reads)))
6167 ;; Go recursively through all subthreads.
6168 (mapcar 'gnus-expunge-thread (cdr thread)))
6170 ;; Summary article oriented commands
6172 (defun gnus-summary-refer-parent-article (n)
6173 "Refer parent article N times.
6174 If N is negative, go to ancestor -N instead.
6175 The difference between N and the number of articles fetched is returned."
6177 (gnus-set-global-variables)
6180 (when (not (natnump n))
6185 (setq header (gnus-summary-article-header))
6186 (if (and (eq (mail-header-number header)
6187 (cdr gnus-article-current))
6188 (equal gnus-newsgroup-name
6189 (car gnus-article-current)))
6190 ;; If we try to find the parent of the currently
6191 ;; displayed article, then we take a look at the actual
6192 ;; References header, since this is slightly more
6193 ;; reliable than the References field we got from the
6196 (set-buffer gnus-original-article-buffer)
6197 (nnheader-narrow-to-headers)
6198 (unless (setq ref (message-fetch-field "references"))
6199 (setq ref (message-fetch-field "in-reply-to")))
6202 ;; It's not the current article, so we take a bet on
6203 ;; the value we got from the server.
6204 (mail-header-references header)))
6206 (not (equal ref "")))
6207 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6208 (gnus-message 1 "Couldn't find parent"))
6209 (gnus-message 1 "No references in article %d"
6210 (gnus-summary-article-number))
6213 (gnus-summary-position-point)
6216 (defun gnus-summary-refer-references ()
6217 "Fetch all articles mentioned in the References header.
6218 Return how many articles were fetched."
6220 (gnus-set-global-variables)
6221 (let ((ref (mail-header-references (gnus-summary-article-header)))
6222 (current (gnus-summary-article-number))
6226 (error "No References in the current article")
6227 ;; For each Message-ID in the References header...
6228 (while (string-match "<[^>]*>" ref)
6230 ;; ... fetch that article.
6231 (gnus-summary-refer-article
6232 (prog1 (match-string 0 ref)
6233 (setq ref (substring ref (match-end 0))))))
6234 (gnus-summary-goto-subject current)
6235 (gnus-summary-position-point)
6238 (defun gnus-summary-refer-article (message-id &optional arg)
6239 "Fetch an article specified by MESSAGE-ID.
6240 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6241 or `gnus-select-method', no matter what backend the article comes from."
6242 (interactive "sMessage-ID: \nP")
6243 (when (and (stringp message-id)
6244 (not (zerop (length message-id))))
6245 ;; Construct the correct Message-ID if necessary.
6246 ;; Suggested by tale@pawl.rpi.edu.
6247 (unless (string-match "^<" message-id)
6248 (setq message-id (concat "<" message-id)))
6249 (unless (string-match ">$" message-id)
6250 (setq message-id (concat message-id ">")))
6251 (let* ((header (gnus-id-to-header message-id))
6253 (gnus-summary-article-sparse-p
6254 (mail-header-number header))
6255 (memq (mail-header-number header)
6256 gnus-newsgroup-limit))))
6258 (or (not (gnus-summary-article-sparse-p
6259 (mail-header-number header)))
6262 ;; The article is present in the buffer, so we just go to it.
6263 (gnus-summary-goto-article
6264 (mail-header-number header) nil t)
6266 (gnus-summary-update-article (mail-header-number header))))
6267 ;; We fetch the article
6268 (let ((gnus-override-method
6269 (cond ((gnus-news-group-p gnus-newsgroup-name)
6270 gnus-refer-article-method)
6272 (or gnus-refer-article-method gnus-select-method))
6275 ;; Start the special refer-article method, if necessary.
6276 (when (and gnus-refer-article-method
6277 (gnus-news-group-p gnus-newsgroup-name))
6278 (gnus-check-server gnus-refer-article-method))
6279 ;; Fetch the header, and display the article.
6280 (if (setq number (gnus-summary-insert-subject message-id))
6281 (gnus-summary-select-article nil nil nil number)
6282 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6284 (defun gnus-summary-enter-digest-group (&optional force)
6285 "Enter an nndoc group based on the current article.
6286 If FORCE, force a digest interpretation. If not, try
6287 to guess what the document format is."
6289 (gnus-set-global-variables)
6290 (let ((conf gnus-current-window-configuration))
6292 (gnus-summary-select-article))
6293 (setq gnus-current-window-configuration conf)
6294 (let* ((name (format "%s-%d"
6295 (gnus-group-prefixed-name
6296 gnus-newsgroup-name (list 'nndoc ""))
6298 (set-buffer gnus-summary-buffer)
6299 gnus-current-article)))
6300 (ogroup gnus-newsgroup-name)
6301 (params (append (gnus-info-params (gnus-get-info ogroup))
6302 (list (cons 'to-group ogroup))
6303 (list (cons 'save-article-group ogroup))))
6304 (case-fold-search t)
6305 (buf (current-buffer))
6308 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6309 (insert-buffer-substring gnus-original-article-buffer)
6310 ;; Remove lines that may lead nndoc to misinterpret the
6313 (goto-char (point-min))
6314 (or (search-forward "\n\n" nil t) (point)))
6315 (goto-char (point-min))
6316 (delete-matching-lines "^\\(Path\\):\\|^From ")
6319 (if (gnus-group-read-ephemeral-group
6320 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6322 ,(if force 'digest 'guess))) t)
6323 ;; Make all postings to this group go to the parent group.
6324 (nconc (gnus-info-params (gnus-get-info name))
6326 ;; Couldn't select this doc group.
6327 (switch-to-buffer buf)
6328 (gnus-set-global-variables)
6329 (gnus-configure-windows 'summary)
6330 (gnus-message 3 "Article couldn't be entered?"))
6331 (kill-buffer dig)))))
6333 (defun gnus-summary-read-document (n)
6334 "Open a new group based on the current article(s).
6335 This will allow you to read digests and other similar
6336 documents as newsgroups.
6337 Obeys the standard process/prefix convention."
6339 (let* ((articles (gnus-summary-work-articles n))
6340 (ogroup gnus-newsgroup-name)
6341 (params (append (gnus-info-params (gnus-get-info ogroup))
6342 (list (cons 'to-group ogroup))))
6343 article group egroup groups vgroup)
6344 (while (setq article (pop articles))
6345 (setq group (format "%s-%d" gnus-newsgroup-name article))
6346 (gnus-summary-remove-process-mark article)
6347 (when (gnus-summary-display-article article)
6349 (nnheader-temp-write nil
6350 (insert-buffer-substring gnus-original-article-buffer)
6351 ;; Remove some headers that may lead nndoc to make
6353 (message-narrow-to-head)
6354 (goto-char (point-min))
6355 (delete-matching-lines "^\\(Path\\):\\|^From ")
6358 (gnus-group-read-ephemeral-group
6359 group `(nndoc ,group (nndoc-address ,(current-buffer))
6360 (nndoc-article-type guess))
6363 ;; Make all postings to this group go to the parent group.
6364 (nconc (gnus-info-params (gnus-get-info egroup))
6366 (push egroup groups))
6367 ;; Couldn't select this doc group.
6368 (gnus-error 3 "Article couldn't be entered"))))))
6369 ;; Now we have selected all the documents.
6372 (error "None of the articles could be interpreted as documents"))
6373 ((gnus-group-read-ephemeral-group
6374 (setq vgroup (format
6375 "nnvirtual:%s-%s" gnus-newsgroup-name
6376 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6377 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6379 (cons (current-buffer) 'summary)))
6381 (error "Couldn't select virtual nndoc group")))))
6383 (defun gnus-summary-isearch-article (&optional regexp-p)
6384 "Do incremental search forward on the current article.
6385 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6387 (gnus-set-global-variables)
6388 (gnus-summary-select-article)
6389 (gnus-configure-windows 'article)
6390 (gnus-eval-in-buffer-window gnus-article-buffer
6391 ;;(goto-char (point-min))
6392 (isearch-forward regexp-p)))
6394 (defun gnus-summary-search-article-forward (regexp &optional backward)
6395 "Search for an article containing REGEXP forward.
6396 If BACKWARD, search backward instead."
6399 (format "Search article %s (regexp%s): "
6400 (if current-prefix-arg "backward" "forward")
6401 (if gnus-last-search-regexp
6402 (concat ", default " gnus-last-search-regexp)
6404 current-prefix-arg))
6405 (gnus-set-global-variables)
6406 (if (string-equal regexp "")
6407 (setq regexp (or gnus-last-search-regexp ""))
6408 (setq gnus-last-search-regexp regexp))
6409 (if (gnus-summary-search-article regexp backward)
6410 (gnus-summary-show-thread)
6411 (error "Search failed: \"%s\"" regexp)))
6413 (defun gnus-summary-search-article-backward (regexp)
6414 "Search for an article containing REGEXP backward."
6417 (format "Search article backward (regexp%s): "
6418 (if gnus-last-search-regexp
6419 (concat ", default " gnus-last-search-regexp)
6421 (gnus-summary-search-article-forward regexp 'backward))
6423 (defun gnus-summary-search-article (regexp &optional backward)
6424 "Search for an article containing REGEXP.
6425 Optional argument BACKWARD means do search for backward.
6426 `gnus-select-article-hook' is not called during the search."
6427 ;; We have to require this here to make sure that the following
6428 ;; dynamic binding isn't shadowed by autoloading.
6429 (require 'gnus-async)
6430 (let ((gnus-select-article-hook nil) ;Disable hook.
6431 (gnus-article-display-hook nil)
6432 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6433 (gnus-use-article-prefetch nil)
6434 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6435 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6436 (sum (current-buffer))
6439 (gnus-save-hidden-threads
6440 (gnus-summary-select-article)
6441 (set-buffer gnus-article-buffer)
6445 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6447 (re-search-backward regexp nil t)
6448 (re-search-forward regexp nil t))
6449 ;; We found the regexp.
6454 (get-buffer-window (current-buffer))
6458 (setq point (point)))
6459 ;; We didn't find it, so we go to the next article.
6462 (while (eq found 'not)
6463 (if (not (if backward (gnus-summary-find-prev)
6464 (gnus-summary-find-next)))
6465 ;; No more articles.
6467 ;; Select the next article and adjust point.
6468 (unless (gnus-summary-article-sparse-p
6469 (gnus-summary-article-number))
6471 (gnus-summary-select-article)
6472 (set-buffer gnus-article-buffer)
6474 (goto-char (if backward (point-max) (point-min))))))))
6475 (gnus-message 7 ""))
6476 ;; Return whether we found the regexp.
6477 (when (eq found 'found)
6479 (gnus-summary-show-thread)
6480 (gnus-summary-goto-subject gnus-current-article)
6481 (gnus-summary-position-point)
6484 (defun gnus-summary-find-matching (header regexp &optional backward unread
6486 "Return a list of all articles that match REGEXP on HEADER.
6487 The search stars on the current article and goes forwards unless
6488 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6489 If UNREAD is non-nil, only unread articles will
6490 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6491 in the comparisons."
6492 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6493 (gnus-data-find-list
6494 (gnus-summary-article-number) (gnus-data-list backward))))
6495 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6496 (case-fold-search (not not-case-fold))
6498 (unless (fboundp (intern (concat "mail-header-" header)))
6499 (error "%s is not a valid header" header))
6502 (and (or (not unread) ; We want all articles...
6503 (gnus-data-unread-p d)) ; Or just unreads.
6504 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6505 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6506 (push (gnus-data-number d) articles)) ; Success!
6507 (setq data (cdr data)))
6508 (nreverse articles)))
6510 (defun gnus-summary-execute-command (header regexp command &optional backward)
6511 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6512 If HEADER is an empty string (or nil), the match is done on the entire
6513 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6515 (list (let ((completion-ignore-case t))
6518 (mapcar (lambda (string) (list string))
6519 '("Number" "Subject" "From" "Lines" "Date"
6520 "Message-ID" "Xref" "References" "Body"))
6521 nil 'require-match))
6522 (read-string "Regexp: ")
6523 (read-key-sequence "Command: ")
6524 current-prefix-arg))
6525 (when (equal header "Body")
6527 (gnus-set-global-variables)
6528 ;; Hidden thread subtrees must be searched as well.
6529 (gnus-summary-show-all-threads)
6530 ;; We don't want to change current point nor window configuration.
6532 (save-window-excursion
6533 (gnus-message 6 "Executing %s..." (key-description command))
6534 ;; We'd like to execute COMMAND interactively so as to give arguments.
6535 (gnus-execute header regexp
6536 `(call-interactively ',(key-binding command))
6538 (gnus-message 6 "Executing %s...done" (key-description command)))))
6540 (defun gnus-summary-beginning-of-article ()
6541 "Scroll the article back to the beginning."
6543 (gnus-set-global-variables)
6544 (gnus-summary-select-article)
6545 (gnus-configure-windows 'article)
6546 (gnus-eval-in-buffer-window gnus-article-buffer
6548 (goto-char (point-min))
6549 (when gnus-page-broken
6550 (gnus-narrow-to-page))))
6552 (defun gnus-summary-end-of-article ()
6553 "Scroll to the end of the article."
6555 (gnus-set-global-variables)
6556 (gnus-summary-select-article)
6557 (gnus-configure-windows 'article)
6558 (gnus-eval-in-buffer-window gnus-article-buffer
6560 (goto-char (point-max))
6562 (when gnus-page-broken
6563 (gnus-narrow-to-page))))
6565 (defun gnus-summary-print-article (&optional filename)
6566 "Generate and print a PostScript image of the article buffer.
6568 If the optional argument FILENAME is nil, send the image to the printer.
6569 If FILENAME is a string, save the PostScript image in a file with that
6570 name. If FILENAME is a number, prompt the user for the name of the file
6572 (interactive (list (ps-print-preprint current-prefix-arg)))
6573 (gnus-summary-select-article)
6574 (gnus-eval-in-buffer-window gnus-article-buffer
6575 (let ((buffer (generate-new-buffer " *print*")))
6578 (copy-to-buffer buffer (point-min) (point-max))
6580 (gnus-article-delete-invisible-text)
6581 (run-hooks 'gnus-ps-print-hook)
6582 (ps-print-buffer-with-faces filename))
6583 (kill-buffer buffer)))))
6585 (defun gnus-summary-show-article (&optional arg)
6586 "Force re-fetching of the current article.
6587 If ARG (the prefix) is non-nil, show the raw article without any
6588 article massaging functions being run."
6590 (gnus-set-global-variables)
6592 ;; Select the article the normal way.
6593 (gnus-summary-select-article nil 'force)
6594 ;; Bind the article treatment functions to nil.
6595 (let ((gnus-have-all-headers t)
6596 gnus-article-display-hook
6597 gnus-article-prepare-hook
6601 (gnus-summary-select-article nil 'force)))
6602 (gnus-summary-goto-subject gnus-current-article)
6603 (gnus-summary-position-point))
6605 (defun gnus-summary-verbose-headers (&optional arg)
6606 "Toggle permanent full header display.
6607 If ARG is a positive number, turn header display on.
6608 If ARG is a negative number, turn header display off."
6610 (gnus-set-global-variables)
6611 (setq gnus-show-all-headers
6612 (cond ((or (not (numberp arg))
6614 (not gnus-show-all-headers))
6617 (gnus-summary-show-article))
6619 (defun gnus-summary-toggle-header (&optional arg)
6620 "Show the headers if they are hidden, or hide them if they are shown.
6621 If ARG is a positive number, show the entire header.
6622 If ARG is a negative number, hide the unwanted header lines."
6624 (gnus-set-global-variables)
6626 (set-buffer gnus-article-buffer)
6627 (let* ((buffer-read-only nil)
6628 (inhibit-point-motion-hooks t)
6629 (hidden (text-property-any
6630 (goto-char (point-min)) (search-forward "\n\n")
6633 (goto-char (point-min))
6634 (when (search-forward "\n\n" nil t)
6635 (delete-region (point-min) (1- (point))))
6636 (goto-char (point-min))
6638 (set-buffer gnus-original-article-buffer)
6639 (goto-char (point-min))
6640 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6641 (insert-buffer-substring gnus-original-article-buffer 1 e)
6642 (let ((article-inhibit-hiding t))
6643 (run-hooks 'gnus-article-display-hook))
6644 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6645 (gnus-article-hide-headers)))))
6647 (defun gnus-summary-show-all-headers ()
6648 "Make all header lines visible."
6650 (gnus-set-global-variables)
6651 (gnus-article-show-all-headers))
6653 (defun gnus-summary-toggle-mime (&optional arg)
6654 "Toggle MIME processing.
6655 If ARG is a positive number, turn MIME processing on."
6657 (gnus-set-global-variables)
6658 (setq gnus-show-mime
6659 (if (null arg) (not gnus-show-mime)
6660 (> (prefix-numeric-value arg) 0)))
6661 (gnus-summary-select-article t 'force))
6663 (defun gnus-summary-caesar-message (&optional arg)
6664 "Caesar rotate the current article by 13.
6665 The numerical prefix specifies how many places to rotate each letter
6668 (gnus-set-global-variables)
6669 (gnus-summary-select-article)
6670 (let ((mail-header-separator ""))
6671 (gnus-eval-in-buffer-window gnus-article-buffer
6674 (let ((start (window-start))
6676 (message-caesar-buffer-body arg)
6677 (set-window-start (get-buffer-window (current-buffer)) start))))))
6679 (defun gnus-summary-stop-page-breaking ()
6680 "Stop page breaking in the current article."
6682 (gnus-set-global-variables)
6683 (gnus-summary-select-article)
6684 (gnus-eval-in-buffer-window gnus-article-buffer
6686 (when (gnus-visual-p 'page-marker)
6687 (let ((buffer-read-only nil))
6688 (gnus-remove-text-with-property 'gnus-prev)
6689 (gnus-remove-text-with-property 'gnus-next)))))
6691 (defun gnus-summary-move-article (&optional n to-newsgroup
6692 select-method action)
6693 "Move the current article to a different newsgroup.
6694 If N is a positive number, move the N next articles.
6695 If N is a negative number, move the N previous articles.
6696 If N is nil and any articles have been marked with the process mark,
6697 move those articles instead.
6698 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6699 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6700 re-spool using this method.
6702 For this function to work, both the current newsgroup and the
6703 newsgroup that you want to move to have to support the `request-move'
6704 and `request-accept' functions."
6707 (setq action 'move))
6708 (gnus-set-global-variables)
6709 ;; Disable marking as read.
6710 (let (gnus-mark-article-hook)
6711 (save-window-excursion
6712 (gnus-summary-select-article)))
6713 ;; Check whether the source group supports the required functions.
6714 (cond ((and (eq action 'move)
6715 (not (gnus-check-backend-function
6716 'request-move-article gnus-newsgroup-name)))
6717 (error "The current group does not support article moving"))
6718 ((and (eq action 'crosspost)
6719 (not (gnus-check-backend-function
6720 'request-replace-article gnus-newsgroup-name)))
6721 (error "The current group does not support article editing")))
6722 (let ((articles (gnus-summary-work-articles n))
6723 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6724 (names '((move "Move" "Moving")
6725 (copy "Copy" "Copying")
6726 (crosspost "Crosspost" "Crossposting")))
6727 (copy-buf (save-excursion
6728 (nnheader-set-temp-buffer " *copy article*")))
6729 art-group to-method new-xref article to-groups)
6730 (unless (assq action names)
6731 (error "Unknown action %s" action))
6732 ;; Read the newsgroup name.
6733 (when (and (not to-newsgroup)
6734 (not select-method))
6736 (gnus-read-move-group-name
6737 (cadr (assq action names))
6738 (symbol-value (intern (format "gnus-current-%s-group" action)))
6740 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6741 (setq to-method (or select-method
6742 (gnus-group-name-to-method to-newsgroup)))
6743 ;; Check the method we are to move this article to...
6744 (unless (gnus-check-backend-function
6745 'request-accept-article (car to-method))
6746 (error "%s does not support article copying" (car to-method)))
6747 (unless (gnus-check-server to-method)
6748 (error "Can't open server %s" (car to-method)))
6749 (gnus-message 6 "%s to %s: %s..."
6750 (caddr (assq action names))
6751 (or (car select-method) to-newsgroup) articles)
6753 (setq article (pop articles))
6757 ;; Move the article.
6759 ;; Remove this article from future suppression.
6760 (gnus-dup-unsuppress-article article)
6761 (gnus-request-move-article
6762 article ; Article to move
6763 gnus-newsgroup-name ; From newsgroup
6764 (nth 1 (gnus-find-method-for-group
6765 gnus-newsgroup-name)) ; Server
6766 (list 'gnus-request-accept-article
6767 to-newsgroup (list 'quote select-method)
6768 (not articles)) ; Accept form
6769 (not articles))) ; Only save nov last time
6770 ;; Copy the article.
6773 (set-buffer copy-buf)
6774 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6775 (gnus-request-accept-article
6776 to-newsgroup select-method (not articles))))
6777 ;; Crosspost the article.
6778 ((eq action 'crosspost)
6779 (let ((xref (message-tokenize-header
6780 (mail-header-xref (gnus-summary-article-header article))
6782 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6785 (setq xref (list (system-name))))
6788 (mapconcat 'identity
6789 (delete "Xref:" (delete new-xref xref))
6793 (set-buffer copy-buf)
6794 ;; First put the article in the destination group.
6795 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6796 (when (consp (setq art-group
6797 (gnus-request-accept-article
6798 to-newsgroup select-method (not articles))))
6799 (setq new-xref (concat new-xref " " (car art-group)
6800 ":" (cdr art-group)))
6801 ;; Now we have the new Xrefs header, so we insert
6802 ;; it and replace the new article.
6803 (nnheader-replace-header "Xref" new-xref)
6804 (gnus-request-replace-article
6805 (cdr art-group) to-newsgroup (current-buffer))
6809 (gnus-message 1 "Couldn't %s article %s"
6810 (cadr (assq action names)) article))
6811 ((and (eq art-group 'junk)
6813 (gnus-summary-mark-article article gnus-canceled-mark)
6814 (gnus-message 4 "Deleted article %s" article))
6818 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6820 (gnus-group-prefixed-name
6823 (gnus-find-method-for-group to-newsgroup)))
6824 gnus-newsrc-hashtb)))
6825 (info (nth 2 entry))
6826 (to-group (gnus-info-group info)))
6827 ;; Update the group that has been moved to.
6829 (memq action '(move copy)))
6830 (unless (member to-group to-groups)
6831 (push to-group to-groups))
6833 (unless (memq article gnus-newsgroup-unreads)
6835 info (gnus-add-to-range (gnus-info-read info)
6836 (list (cdr art-group)))))
6838 ;; Copy any marks over to the new group.
6839 (let ((marks gnus-article-mark-lists)
6840 (to-article (cdr art-group)))
6842 ;; See whether the article is to be put in the cache.
6843 (when gnus-use-cache
6844 (gnus-cache-possibly-enter-article
6846 (let ((header (copy-sequence
6847 (gnus-summary-article-header article))))
6848 (mail-header-set-number header to-article)
6850 (memq article gnus-newsgroup-marked)
6851 (memq article gnus-newsgroup-dormant)
6852 (memq article gnus-newsgroup-unreads)))
6854 (when (and (equal to-group gnus-newsgroup-name)
6855 (not (memq article gnus-newsgroup-unreads)))
6856 ;; Mark this article as read in this group.
6857 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6858 (setcdr (gnus-active to-group) to-article)
6859 (setcdr gnus-newsgroup-active to-article))
6862 (when (memq article (symbol-value
6863 (intern (format "gnus-newsgroup-%s"
6865 ;; If the other group is the same as this group,
6866 ;; then we have to add the mark to the list.
6867 (when (equal to-group gnus-newsgroup-name)
6868 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6871 (intern (format "gnus-newsgroup-%s"
6873 ;; Copy the marks to other group.
6874 (gnus-add-marked-articles
6875 to-group (cdar marks) (list to-article) info))
6876 (setq marks (cdr marks)))
6879 (concat "(gnus-group-set-info '"
6880 (gnus-prin1-to-string (gnus-get-info to-group))
6883 ;; Update the Xref header in this article to point to
6884 ;; the new crossposted article we have just created.
6885 (when (eq action 'crosspost)
6887 (set-buffer copy-buf)
6888 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6889 (nnheader-replace-header "Xref" new-xref)
6890 (gnus-request-replace-article
6891 article gnus-newsgroup-name (current-buffer)))))
6893 (gnus-summary-goto-subject article)
6894 (when (eq action 'move)
6895 (gnus-summary-mark-article article gnus-canceled-mark))))
6896 (gnus-summary-remove-process-mark article))
6897 ;; Re-activate all groups that have been moved to.
6900 (set-buffer gnus-group-buffer)
6901 (when (gnus-group-goto-group (car to-groups) t)
6902 (gnus-group-get-new-news-this-group 1 t))
6905 (gnus-kill-buffer copy-buf)
6906 (gnus-summary-position-point)
6907 (gnus-set-mode-line 'summary)))
6909 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6910 "Move the current article to a different newsgroup.
6911 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6912 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6913 re-spool using this method."
6915 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6917 (defun gnus-summary-crosspost-article (&optional n)
6918 "Crosspost the current article to some other group."
6920 (gnus-summary-move-article n nil nil 'crosspost))
6922 (defcustom gnus-summary-respool-default-method nil
6923 "Default method for respooling an article.
6924 If nil, use to the current newsgroup method."
6925 :type 'gnus-select-method-name
6926 :group 'gnus-summary-mail)
6928 (defun gnus-summary-respool-article (&optional n method)
6929 "Respool the current article.
6930 The article will be squeezed through the mail spooling process again,
6931 which means that it will be put in some mail newsgroup or other
6932 depending on `nnmail-split-methods'.
6933 If N is a positive number, respool the N next articles.
6934 If N is a negative number, respool the N previous articles.
6935 If N is nil and any articles have been marked with the process mark,
6936 respool those articles instead.
6938 Respooling can be done both from mail groups and \"real\" newsgroups.
6939 In the former case, the articles in question will be moved from the
6940 current group into whatever groups they are destined to. In the
6941 latter case, they will be copied into the relevant groups."
6943 (list current-prefix-arg
6944 (let* ((methods (gnus-methods-using 'respool))
6946 (symbol-name (or gnus-summary-respool-default-method
6947 (car (gnus-find-method-for-group
6948 gnus-newsgroup-name)))))
6950 (gnus-completing-read
6951 methname "What backend do you want to use when respooling?"
6952 methods nil t nil 'gnus-mail-method-history))
6955 ((zerop (length (setq ms (gnus-servers-using-backend
6957 (list (intern method) ""))
6961 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6962 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6964 (gnus-set-global-variables)
6966 (error "No method given for respooling"))
6967 (if (assoc (symbol-name
6968 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6969 (gnus-methods-using 'respool))
6970 (gnus-summary-move-article n nil method)
6971 (gnus-summary-copy-article n nil method)))
6973 (defun gnus-summary-import-article (file)
6974 "Import a random file into a mail newsgroup."
6975 (interactive "fImport file: ")
6976 (gnus-set-global-variables)
6977 (let ((group gnus-newsgroup-name)
6978 (now (current-time))
6980 (unless (gnus-check-backend-function 'request-accept-article group)
6981 (error "%s does not support article importing" group))
6982 (or (file-readable-p file)
6983 (not (file-regular-p file))
6984 (error "Can't read %s" file))
6986 (set-buffer (get-buffer-create " *import file*"))
6987 (buffer-disable-undo (current-buffer))
6989 (insert-file-contents file)
6990 (goto-char (point-min))
6991 (unless (nnheader-article-p)
6992 ;; This doesn't look like an article, so we fudge some headers.
6993 (setq atts (file-attributes file)
6994 lines (count-lines (point-min) (point-max)))
6995 (insert "From: " (read-string "From: ") "\n"
6996 "Subject: " (read-string "Subject: ") "\n"
6997 "Date: " (timezone-make-date-arpa-standard
6998 (current-time-string (nth 5 atts))
6999 (current-time-zone now)
7000 (current-time-zone now))
7002 "Message-ID: " (message-make-message-id) "\n"
7003 "Lines: " (int-to-string lines) "\n"
7004 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7005 (gnus-request-accept-article group nil t)
7006 (kill-buffer (current-buffer)))))
7008 (defun gnus-summary-article-posted-p ()
7009 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7010 This will be the case if the article has both been mailed and posted."
7012 (let ((id (mail-header-references (gnus-summary-article-header)))
7013 (gnus-override-method
7014 (or gnus-refer-article-method gnus-select-method)))
7015 (if (gnus-request-head id "")
7016 (gnus-message 2 "The current message was found on %s"
7017 gnus-override-method)
7018 (gnus-message 2 "The current message couldn't be found on %s"
7019 gnus-override-method)
7022 (defun gnus-summary-expire-articles (&optional now)
7023 "Expire all articles that are marked as expirable in the current group."
7025 (gnus-set-global-variables)
7026 (when (gnus-check-backend-function
7027 'request-expire-articles gnus-newsgroup-name)
7028 ;; This backend supports expiry.
7029 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7030 (expirable (if total
7032 ;; We need to update the info for
7033 ;; this group for `gnus-list-of-read-articles'
7034 ;; to give us the right answer.
7035 (run-hooks 'gnus-exit-group-hook)
7036 (gnus-summary-update-info)
7037 (gnus-list-of-read-articles gnus-newsgroup-name))
7038 (setq gnus-newsgroup-expirable
7039 (sort gnus-newsgroup-expirable '<))))
7040 (expiry-wait (if now 'immediate
7041 (gnus-group-find-parameter
7042 gnus-newsgroup-name 'expiry-wait)))
7045 ;; There are expirable articles in this group, so we run them
7046 ;; through the expiry process.
7047 (gnus-message 6 "Expiring articles...")
7048 ;; The list of articles that weren't expired is returned.
7050 (let ((nnmail-expiry-wait-function nil)
7051 (nnmail-expiry-wait expiry-wait))
7052 (setq es (gnus-request-expire-articles
7053 expirable gnus-newsgroup-name)))
7054 (setq es (gnus-request-expire-articles
7055 expirable gnus-newsgroup-name)))
7057 (setq gnus-newsgroup-expirable es))
7058 ;; We go through the old list of expirable, and mark all
7059 ;; really expired articles as nonexistent.
7060 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7061 (let ((gnus-use-cache nil))
7063 (unless (memq (car expirable) es)
7064 (when (gnus-data-find (car expirable))
7065 (gnus-summary-mark-article
7066 (car expirable) gnus-canceled-mark)))
7067 (setq expirable (cdr expirable)))))
7068 (gnus-message 6 "Expiring articles...done")))))
7070 (defun gnus-summary-expire-articles-now ()
7071 "Expunge all expirable articles in the current group.
7072 This means that *all* articles that are marked as expirable will be
7073 deleted forever, right now."
7075 (gnus-set-global-variables)
7076 (or gnus-expert-user
7078 "Are you really, really, really sure you want to delete all these messages? ")
7080 (gnus-summary-expire-articles t))
7082 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7083 (defun gnus-summary-delete-article (&optional n)
7084 "Delete the N next (mail) articles.
7085 This command actually deletes articles. This is not a marking
7086 command. The article will disappear forever from your life, never to
7088 If N is negative, delete backwards.
7089 If N is nil and articles have been marked with the process mark,
7090 delete these instead."
7092 (gnus-set-global-variables)
7093 (unless (gnus-check-backend-function 'request-expire-articles
7094 gnus-newsgroup-name)
7095 (error "The current newsgroup does not support article deletion"))
7096 ;; Compute the list of articles to delete.
7097 (let ((articles (gnus-summary-work-articles n))
7099 (if (and gnus-novice-user
7100 (not (gnus-yes-or-no-p
7101 (format "Do you really want to delete %s forever? "
7102 (if (> (length articles) 1)
7103 (format "these %s articles" (length articles))
7106 ;; Delete the articles.
7107 (setq not-deleted (gnus-request-expire-articles
7108 articles gnus-newsgroup-name 'force))
7110 (gnus-summary-remove-process-mark (car articles))
7111 ;; The backend might not have been able to delete the article
7113 (unless (memq (car articles) not-deleted)
7114 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7115 (setq articles (cdr articles)))
7117 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7118 (gnus-summary-position-point)
7119 (gnus-set-mode-line 'summary)
7122 (defun gnus-summary-edit-article (&optional force)
7123 "Edit the current article.
7124 This will have permanent effect only in mail groups.
7125 If FORCE is non-nil, allow editing of articles even in read-only
7129 (set-buffer gnus-summary-buffer)
7130 (gnus-set-global-variables)
7131 (when (and (not force)
7132 (gnus-group-read-only-p))
7133 (error "The current newsgroup does not support article editing"))
7134 ;; Select article if needed.
7135 (unless (eq (gnus-summary-article-number)
7136 gnus-current-article)
7137 (gnus-summary-select-article t))
7138 (gnus-article-date-original)
7139 (gnus-article-edit-article
7141 (gnus-summary-edit-article-done
7142 ,(or (mail-header-references gnus-current-headers) "")
7143 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
7145 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7147 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
7148 "Make edits to the current article permanent."
7150 ;; Replace the article.
7151 (if (and (not read-only)
7152 (not (gnus-request-replace-article
7153 (cdr gnus-article-current) (car gnus-article-current)
7155 (error "Couldn't replace article")
7156 ;; Update the summary buffer.
7158 (equal (message-tokenize-header references " ")
7159 (message-tokenize-header
7160 (or (message-fetch-field "references") "") " ")))
7161 ;; We only have to update this line.
7164 (message-narrow-to-head)
7165 (let ((head (buffer-string))
7167 (nnheader-temp-write nil
7168 (insert (format "211 %d Article retrieved.\n"
7169 (cdr gnus-article-current)))
7172 (let ((nntp-server-buffer (current-buffer)))
7173 (setq header (car (gnus-get-newsgroup-headers
7175 (set-buffer gnus-summary-buffer)
7176 gnus-newsgroup-dependencies)
7179 (set-buffer gnus-summary-buffer)
7180 (gnus-data-set-header
7181 (gnus-data-find (cdr gnus-article-current))
7183 (gnus-summary-update-article-line
7184 (cdr gnus-article-current) header))))))
7186 (set-buffer (or buffer gnus-summary-buffer))
7187 (gnus-summary-update-article (cdr gnus-article-current)))
7188 ;; Prettify the article buffer again.
7190 (set-buffer gnus-article-buffer)
7191 (run-hooks 'gnus-article-display-hook)
7192 (set-buffer gnus-original-article-buffer)
7193 (gnus-request-article
7194 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
7195 ;; Prettify the summary buffer line.
7196 (when (gnus-visual-p 'summary-highlight 'highlight)
7197 (run-hooks 'gnus-visual-mark-article-hook))))
7199 (defun gnus-summary-edit-wash (key)
7200 "Perform editing command in the article buffer."
7204 (message "%s" (concat (this-command-keys) "- "))
7207 (gnus-summary-edit-article)
7208 (execute-kbd-macro (concat (this-command-keys) key))
7209 (gnus-article-edit-done))
7213 (defun gnus-summary-respool-query (&optional silent)
7214 "Query where the respool algorithm would put this article."
7216 (gnus-set-global-variables)
7217 (let (gnus-mark-article-hook)
7218 (gnus-summary-select-article)
7220 (set-buffer gnus-original-article-buffer)
7222 (message-narrow-to-head)
7223 (let ((groups (nnmail-article-group 'identity)))
7226 (message "This message would go to %s"
7227 (mapconcat 'car groups ", "))
7228 (message "This message would go to no groups"))
7231 ;; Summary marking commands.
7233 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7234 "Mark articles which has the same subject as read, and then select the next.
7235 If UNMARK is positive, remove any kind of mark.
7236 If UNMARK is negative, tick articles."
7238 (gnus-set-global-variables)
7240 (setq unmark (prefix-numeric-value unmark)))
7242 (gnus-summary-mark-same-subject
7243 (gnus-summary-article-subject) unmark)))
7244 ;; Select next unread article. If auto-select-same mode, should
7245 ;; select the first unread article.
7246 (gnus-summary-next-article t (and gnus-auto-select-same
7247 (gnus-summary-article-subject)))
7248 (gnus-message 7 "%d article%s marked as %s"
7249 count (if (= count 1) " is" "s are")
7250 (if unmark "unread" "read"))))
7252 (defun gnus-summary-kill-same-subject (&optional unmark)
7253 "Mark articles which has the same subject as read.
7254 If UNMARK is positive, remove any kind of mark.
7255 If UNMARK is negative, tick articles."
7257 (gnus-set-global-variables)
7259 (setq unmark (prefix-numeric-value unmark)))
7261 (gnus-summary-mark-same-subject
7262 (gnus-summary-article-subject) unmark)))
7263 ;; If marked as read, go to next unread subject.
7265 ;; Go to next unread subject.
7266 (gnus-summary-next-subject 1 t))
7267 (gnus-message 7 "%d articles are marked as %s"
7268 count (if unmark "unread" "read"))))
7270 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7271 "Mark articles with same SUBJECT as read, and return marked number.
7272 If optional argument UNMARK is positive, remove any kinds of marks.
7273 If optional argument UNMARK is negative, mark articles as unread instead."
7277 ((null unmark) ; Mark as read.
7280 (gnus-summary-mark-article-as-read gnus-killed-mark)
7281 (gnus-summary-show-thread) t)
7282 (gnus-summary-find-subject subject))
7283 (setq count (1+ count))))
7284 ((> unmark 0) ; Tick.
7287 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7288 (gnus-summary-show-thread) t)
7289 (gnus-summary-find-subject subject))
7290 (setq count (1+ count))))
7291 (t ; Mark as unread.
7294 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7295 (gnus-summary-show-thread) t)
7296 (gnus-summary-find-subject subject))
7297 (setq count (1+ count)))))
7298 (gnus-set-mode-line 'summary)
7299 ;; Return the number of marked articles.
7302 (defun gnus-summary-mark-as-processable (n &optional unmark)
7303 "Set the process mark on the next N articles.
7304 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7305 the process mark instead. The difference between N and the actual
7306 number of articles marked is returned."
7308 (gnus-set-global-variables)
7309 (let ((backward (< n 0))
7314 (gnus-summary-remove-process-mark
7315 (gnus-summary-article-number))
7316 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7317 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7320 (gnus-message 7 "No more articles"))
7321 (gnus-summary-recenter)
7322 (gnus-summary-position-point)
7325 (defun gnus-summary-unmark-as-processable (n)
7326 "Remove the process mark from the next N articles.
7327 If N is negative, unmark backward instead. The difference between N and
7328 the actual number of articles unmarked is returned."
7330 (gnus-set-global-variables)
7331 (gnus-summary-mark-as-processable n t))
7333 (defun gnus-summary-unmark-all-processable ()
7334 "Remove the process mark from all articles."
7336 (gnus-set-global-variables)
7338 (while gnus-newsgroup-processable
7339 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7340 (gnus-summary-position-point))
7342 (defun gnus-summary-mark-as-expirable (n)
7343 "Mark N articles forward as expirable.
7344 If N is negative, mark backward instead. The difference between N and
7345 the actual number of articles marked is returned."
7347 (gnus-set-global-variables)
7348 (gnus-summary-mark-forward n gnus-expirable-mark))
7350 (defun gnus-summary-mark-article-as-replied (article)
7351 "Mark ARTICLE replied and update the summary line."
7352 (push article gnus-newsgroup-replied)
7353 (let ((buffer-read-only nil))
7354 (when (gnus-summary-goto-subject article)
7355 (gnus-summary-update-secondary-mark article))))
7357 (defun gnus-summary-set-bookmark (article)
7358 "Set a bookmark in current article."
7359 (interactive (list (gnus-summary-article-number)))
7360 (gnus-set-global-variables)
7361 (when (or (not (get-buffer gnus-article-buffer))
7362 (not gnus-current-article)
7363 (not gnus-article-current)
7364 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7365 (error "No current article selected"))
7366 ;; Remove old bookmark, if one exists.
7367 (let ((old (assq article gnus-newsgroup-bookmarks)))
7369 (setq gnus-newsgroup-bookmarks
7370 (delq old gnus-newsgroup-bookmarks))))
7371 ;; Set the new bookmark, which is on the form
7372 ;; (article-number . line-number-in-body).
7376 (set-buffer gnus-article-buffer)
7380 (goto-char (point-min))
7381 (search-forward "\n\n" nil t)
7384 gnus-newsgroup-bookmarks)
7385 (gnus-message 6 "A bookmark has been added to the current article."))
7387 (defun gnus-summary-remove-bookmark (article)
7388 "Remove the bookmark from the current article."
7389 (interactive (list (gnus-summary-article-number)))
7390 (gnus-set-global-variables)
7391 ;; Remove old bookmark, if one exists.
7392 (let ((old (assq article gnus-newsgroup-bookmarks)))
7395 (setq gnus-newsgroup-bookmarks
7396 (delq old gnus-newsgroup-bookmarks))
7397 (gnus-message 6 "Removed bookmark."))
7398 (gnus-message 6 "No bookmark in current article."))))
7400 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7401 (defun gnus-summary-mark-as-dormant (n)
7402 "Mark N articles forward as dormant.
7403 If N is negative, mark backward instead. The difference between N and
7404 the actual number of articles marked is returned."
7406 (gnus-set-global-variables)
7407 (gnus-summary-mark-forward n gnus-dormant-mark))
7409 (defun gnus-summary-set-process-mark (article)
7410 "Set the process mark on ARTICLE and update the summary line."
7411 (setq gnus-newsgroup-processable
7413 (delq article gnus-newsgroup-processable)))
7414 (when (gnus-summary-goto-subject article)
7415 (gnus-summary-show-thread)
7416 (gnus-summary-update-secondary-mark article)))
7418 (defun gnus-summary-remove-process-mark (article)
7419 "Remove the process mark from ARTICLE and update the summary line."
7420 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7421 (when (gnus-summary-goto-subject article)
7422 (gnus-summary-show-thread)
7423 (gnus-summary-update-secondary-mark article)))
7425 (defun gnus-summary-set-saved-mark (article)
7426 "Set the process mark on ARTICLE and update the summary line."
7427 (push article gnus-newsgroup-saved)
7428 (when (gnus-summary-goto-subject article)
7429 (gnus-summary-update-secondary-mark article)))
7431 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7432 "Mark N articles as read forwards.
7433 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7434 The difference between N and the actual number of articles marked is
7437 (gnus-set-global-variables)
7438 (let ((backward (< n 0))
7439 (gnus-summary-goto-unread
7440 (and gnus-summary-goto-unread
7441 (not (eq gnus-summary-goto-unread 'never))
7442 (not (memq mark (list gnus-unread-mark
7443 gnus-ticked-mark gnus-dormant-mark)))))
7445 (mark (or mark gnus-del-mark)))
7447 (gnus-summary-mark-article nil mark no-expire)
7448 (zerop (gnus-summary-next-subject
7450 (and gnus-summary-goto-unread
7451 (not (eq gnus-summary-goto-unread 'never)))
7455 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7456 (gnus-summary-recenter)
7457 (gnus-summary-position-point)
7458 (gnus-set-mode-line 'summary)
7461 (defun gnus-summary-mark-article-as-read (mark)
7462 "Mark the current article quickly as read with MARK."
7463 (let ((article (gnus-summary-article-number)))
7464 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7465 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7466 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7467 (push (cons article mark) gnus-newsgroup-reads)
7468 ;; Possibly remove from cache, if that is used.
7469 (when gnus-use-cache
7470 (gnus-cache-enter-remove-article article))
7471 ;; Allow the backend to change the mark.
7472 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7473 ;; Check for auto-expiry.
7474 (when (and gnus-newsgroup-auto-expire
7475 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7476 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7477 (= mark gnus-ancient-mark)
7478 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7479 (= mark gnus-duplicate-mark)))
7480 (setq mark gnus-expirable-mark)
7481 (push article gnus-newsgroup-expirable))
7482 ;; Set the mark in the buffer.
7483 (gnus-summary-update-mark mark 'unread)
7486 (defun gnus-summary-mark-article-as-unread (mark)
7487 "Mark the current article quickly as unread with MARK."
7488 (let ((article (gnus-summary-article-number)))
7490 (gnus-error 1 "Unmarkable article")
7491 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7492 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7493 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7494 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7495 (cond ((= mark gnus-ticked-mark)
7496 (push article gnus-newsgroup-marked))
7497 ((= mark gnus-dormant-mark)
7498 (push article gnus-newsgroup-dormant))
7500 (push article gnus-newsgroup-unreads)))
7501 (setq gnus-newsgroup-reads
7502 (delq (assq article gnus-newsgroup-reads)
7503 gnus-newsgroup-reads))
7505 ;; See whether the article is to be put in the cache.
7507 (vectorp (gnus-summary-article-header article))
7509 (gnus-cache-possibly-enter-article
7510 gnus-newsgroup-name article
7511 (gnus-summary-article-header article)
7512 (= mark gnus-ticked-mark)
7513 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7516 (gnus-summary-update-mark mark 'unread))
7519 (defun gnus-summary-mark-article (&optional article mark no-expire)
7520 "Mark ARTICLE with MARK. MARK can be any character.
7521 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7522 `??' (dormant) and `?E' (expirable).
7523 If MARK is nil, then the default character `?D' is used.
7524 If ARTICLE is nil, then the article on the current line will be
7526 ;; The mark might be a string.
7527 (when (stringp mark)
7528 (setq mark (aref mark 0)))
7529 ;; If no mark is given, then we check auto-expiring.
7530 (and (not no-expire)
7531 gnus-newsgroup-auto-expire
7533 (and (gnus-characterp mark)
7534 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7535 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7536 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7537 (= mark gnus-duplicate-mark))))
7538 (setq mark gnus-expirable-mark))
7539 (let* ((mark (or mark gnus-del-mark))
7540 (article (or article (gnus-summary-article-number))))
7542 (error "No article on current line"))
7543 (if (or (= mark gnus-unread-mark)
7544 (= mark gnus-ticked-mark)
7545 (= mark gnus-dormant-mark))
7546 (gnus-mark-article-as-unread article mark)
7547 (gnus-mark-article-as-read article mark))
7549 ;; See whether the article is to be put in the cache.
7551 (not (= mark gnus-canceled-mark))
7552 (vectorp (gnus-summary-article-header article))
7554 (gnus-cache-possibly-enter-article
7555 gnus-newsgroup-name article
7556 (gnus-summary-article-header article)
7557 (= mark gnus-ticked-mark)
7558 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7560 (when (gnus-summary-goto-subject article nil t)
7561 (let ((buffer-read-only nil))
7562 (gnus-summary-show-thread)
7564 (gnus-summary-update-mark mark 'unread)
7567 (defun gnus-summary-update-secondary-mark (article)
7568 "Update the secondary (read, process, cache) mark."
7569 (gnus-summary-update-mark
7570 (cond ((memq article gnus-newsgroup-processable)
7572 ((memq article gnus-newsgroup-cached)
7574 ((memq article gnus-newsgroup-replied)
7576 ((memq article gnus-newsgroup-saved)
7578 (t gnus-unread-mark))
7580 (when (gnus-visual-p 'summary-highlight 'highlight)
7581 (run-hooks 'gnus-summary-update-hook))
7584 (defun gnus-summary-update-mark (mark type)
7585 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7586 (buffer-read-only nil))
7587 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7588 (when (looking-at "\r")
7591 (<= (+ forward (point)) (point-max)))
7592 ;; Go to the right position on the line.
7593 (goto-char (+ forward (point)))
7594 ;; Replace the old mark with the new mark.
7595 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7596 ;; Optionally update the marks by some user rule.
7597 (when (eq type 'unread)
7599 (gnus-data-find (gnus-summary-article-number)) mark)
7600 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7602 (defun gnus-mark-article-as-read (article &optional mark)
7603 "Enter ARTICLE in the pertinent lists and remove it from others."
7604 ;; Make the article expirable.
7605 (let ((mark (or mark gnus-del-mark)))
7606 (if (= mark gnus-expirable-mark)
7607 (push article gnus-newsgroup-expirable)
7608 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7609 ;; Remove from unread and marked lists.
7610 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7611 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7612 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7613 (push (cons article mark) gnus-newsgroup-reads)
7614 ;; Possibly remove from cache, if that is used.
7615 (when gnus-use-cache
7616 (gnus-cache-enter-remove-article article))))
7618 (defun gnus-mark-article-as-unread (article &optional mark)
7619 "Enter ARTICLE in the pertinent lists and remove it from others."
7620 (let ((mark (or mark gnus-ticked-mark)))
7621 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7622 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7623 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7624 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7626 ;; Unsuppress duplicates?
7627 (when gnus-suppress-duplicates
7628 (gnus-dup-unsuppress-article article))
7630 (cond ((= mark gnus-ticked-mark)
7631 (push article gnus-newsgroup-marked))
7632 ((= mark gnus-dormant-mark)
7633 (push article gnus-newsgroup-dormant))
7635 (push article gnus-newsgroup-unreads)))
7636 (setq gnus-newsgroup-reads
7637 (delq (assq article gnus-newsgroup-reads)
7638 gnus-newsgroup-reads))))
7640 (defalias 'gnus-summary-mark-as-unread-forward
7641 'gnus-summary-tick-article-forward)
7642 (make-obsolete 'gnus-summary-mark-as-unread-forward
7643 'gnus-summary-tick-article-forward)
7644 (defun gnus-summary-tick-article-forward (n)
7645 "Tick N articles forwards.
7646 If N is negative, tick backwards instead.
7647 The difference between N and the number of articles ticked is returned."
7649 (gnus-summary-mark-forward n gnus-ticked-mark))
7651 (defalias 'gnus-summary-mark-as-unread-backward
7652 'gnus-summary-tick-article-backward)
7653 (make-obsolete 'gnus-summary-mark-as-unread-backward
7654 'gnus-summary-tick-article-backward)
7655 (defun gnus-summary-tick-article-backward (n)
7656 "Tick N articles backwards.
7657 The difference between N and the number of articles ticked is returned."
7659 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7661 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7662 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7663 (defun gnus-summary-tick-article (&optional article clear-mark)
7664 "Mark current article as unread.
7665 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7666 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7668 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7671 (defun gnus-summary-mark-as-read-forward (n)
7672 "Mark N articles as read forwards.
7673 If N is negative, mark backwards instead.
7674 The difference between N and the actual number of articles marked is
7677 (gnus-summary-mark-forward n gnus-del-mark t))
7679 (defun gnus-summary-mark-as-read-backward (n)
7680 "Mark the N articles as read backwards.
7681 The difference between N and the actual number of articles marked is
7684 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7686 (defun gnus-summary-mark-as-read (&optional article mark)
7687 "Mark current article as read.
7688 ARTICLE specifies the article to be marked as read.
7689 MARK specifies a string to be inserted at the beginning of the line."
7690 (gnus-summary-mark-article article mark))
7692 (defun gnus-summary-clear-mark-forward (n)
7693 "Clear marks from N articles forward.
7694 If N is negative, clear backward instead.
7695 The difference between N and the number of marks cleared is returned."
7697 (gnus-summary-mark-forward n gnus-unread-mark))
7699 (defun gnus-summary-clear-mark-backward (n)
7700 "Clear marks from N articles backward.
7701 The difference between N and the number of marks cleared is returned."
7703 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7705 (defun gnus-summary-mark-unread-as-read ()
7706 "Intended to be used by `gnus-summary-mark-article-hook'."
7707 (when (memq gnus-current-article gnus-newsgroup-unreads)
7708 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7710 (defun gnus-summary-mark-read-and-unread-as-read ()
7711 "Intended to be used by `gnus-summary-mark-article-hook'."
7712 (let ((mark (gnus-summary-article-mark)))
7713 (when (or (gnus-unread-mark-p mark)
7714 (gnus-read-mark-p mark))
7715 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7717 (defun gnus-summary-mark-region-as-read (point mark all)
7718 "Mark all unread articles between point and mark as read.
7719 If given a prefix, mark all articles between point and mark as read,
7720 even ticked and dormant ones."
7721 (interactive "r\nP")
7730 (memq (setq article (gnus-summary-article-number))
7731 gnus-newsgroup-unreads))
7732 (gnus-summary-mark-article article gnus-del-mark))
7734 (gnus-summary-find-next))))))
7736 (defun gnus-summary-mark-below (score mark)
7737 "Mark articles with score less than SCORE with MARK."
7738 (interactive "P\ncMark: ")
7739 (gnus-set-global-variables)
7740 (setq score (if score
7741 (prefix-numeric-value score)
7742 (or gnus-summary-default-score 0)))
7744 (set-buffer gnus-summary-buffer)
7745 (goto-char (point-min))
7748 (and (< (gnus-summary-article-score) score)
7749 (gnus-summary-mark-article nil mark))
7750 (gnus-summary-find-next)))))
7752 (defun gnus-summary-kill-below (&optional score)
7753 "Mark articles with score below SCORE as read."
7755 (gnus-set-global-variables)
7756 (gnus-summary-mark-below score gnus-killed-mark))
7758 (defun gnus-summary-clear-above (&optional score)
7759 "Clear all marks from articles with score above SCORE."
7761 (gnus-set-global-variables)
7762 (gnus-summary-mark-above score gnus-unread-mark))
7764 (defun gnus-summary-tick-above (&optional score)
7765 "Tick all articles with score above SCORE."
7767 (gnus-set-global-variables)
7768 (gnus-summary-mark-above score gnus-ticked-mark))
7770 (defun gnus-summary-mark-above (score mark)
7771 "Mark articles with score over SCORE with MARK."
7772 (interactive "P\ncMark: ")
7773 (gnus-set-global-variables)
7774 (setq score (if score
7775 (prefix-numeric-value score)
7776 (or gnus-summary-default-score 0)))
7778 (set-buffer gnus-summary-buffer)
7779 (goto-char (point-min))
7781 (when (> (gnus-summary-article-score) score)
7782 (gnus-summary-mark-article nil mark))
7784 (gnus-summary-find-next)))))
7786 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7787 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7788 (defun gnus-summary-limit-include-expunged (&optional no-error)
7789 "Display all the hidden articles that were expunged for low scores."
7791 (gnus-set-global-variables)
7792 (let ((buffer-read-only nil))
7793 (let ((scored gnus-newsgroup-scored)
7796 (unless (gnus-summary-goto-subject (caar scored))
7797 (and (setq h (gnus-summary-article-header (caar scored)))
7798 (< (cdar scored) gnus-summary-expunge-below)
7800 (setq scored (cdr scored)))
7802 (when (not no-error)
7803 (error "No expunged articles hidden"))
7804 (goto-char (point-min))
7805 (gnus-summary-prepare-unthreaded (nreverse headers))
7806 (goto-char (point-min))
7807 (gnus-summary-position-point)
7810 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7811 "Mark all unread articles in this newsgroup as read.
7812 If prefix argument ALL is non-nil, ticked and dormant articles will
7813 also be marked as read.
7814 If QUIETLY is non-nil, no questions will be asked.
7815 If TO-HERE is non-nil, it should be a point in the buffer. All
7816 articles before this point will be marked as read.
7817 Note that this function will only catch up the unread article
7818 in the current summary buffer limitation.
7819 The number of articles marked as read is returned."
7821 (gnus-set-global-variables)
7825 (not gnus-interactive-catchup) ;Without confirmation?
7829 "Mark absolutely all articles as read? "
7830 "Mark all unread articles as read? ")))
7832 (not gnus-newsgroup-adaptive)
7833 (not gnus-newsgroup-auto-expire)
7834 (not gnus-suppress-duplicates)
7835 (or (not gnus-use-cache)
7836 (eq gnus-use-cache 'passive)))
7839 (setq gnus-newsgroup-marked nil
7840 gnus-newsgroup-dormant nil))
7841 (setq gnus-newsgroup-unreads nil))
7842 ;; We actually mark all articles as canceled, which we
7843 ;; have to do when using auto-expiry or adaptive scoring.
7844 (gnus-summary-show-all-threads)
7845 (when (gnus-summary-first-subject (not all))
7847 (if to-here (< (point) to-here) t)
7848 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7849 (gnus-summary-find-next (not all)))))
7850 (gnus-set-mode-line 'summary))
7852 (gnus-summary-position-point)))
7854 (defun gnus-summary-catchup-to-here (&optional all)
7855 "Mark all unticked articles before the current one as read.
7856 If ALL is non-nil, also mark ticked and dormant articles as read."
7858 (gnus-set-global-variables)
7860 (gnus-save-hidden-threads
7861 (let ((beg (point)))
7862 ;; We check that there are unread articles.
7863 (when (or all (gnus-summary-find-prev))
7864 (gnus-summary-catchup all t beg)))))
7865 (gnus-summary-position-point))
7867 (defun gnus-summary-catchup-all (&optional quietly)
7868 "Mark all articles in this newsgroup as read."
7870 (gnus-set-global-variables)
7871 (gnus-summary-catchup t quietly))
7873 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7874 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7875 If prefix argument ALL is non-nil, all articles are marked as read."
7877 (gnus-set-global-variables)
7878 (when (gnus-summary-catchup all quietly nil 'fast)
7879 ;; Select next newsgroup or exit.
7880 (if (eq gnus-auto-select-next 'quietly)
7881 (gnus-summary-next-group nil)
7882 (gnus-summary-exit))))
7884 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7885 "Mark all articles in this newsgroup as read, and then exit."
7887 (gnus-set-global-variables)
7888 (gnus-summary-catchup-and-exit t quietly))
7890 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7891 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7892 "Mark all articles in this group as read and select the next group.
7893 If given a prefix, mark all articles, unread as well as ticked, as
7896 (gnus-set-global-variables)
7898 (gnus-summary-catchup all))
7899 (gnus-summary-next-article t nil nil t))
7901 ;; Thread-based commands.
7903 (defun gnus-summary-articles-in-thread (&optional article)
7904 "Return a list of all articles in the current thread.
7905 If ARTICLE is non-nil, return all articles in the thread that starts
7907 (let* ((article (or article (gnus-summary-article-number)))
7908 (data (gnus-data-find-list article))
7909 (top-level (gnus-data-level (car data)))
7911 (cond ((null gnus-thread-operation-ignore-subject)
7912 (gnus-simplify-subject-re
7913 (mail-header-subject (gnus-data-header (car data)))))
7914 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7915 (gnus-simplify-subject-fuzzy
7916 (mail-header-subject (gnus-data-header (car data)))))
7918 (end-point (save-excursion
7919 (if (gnus-summary-go-to-next-thread)
7920 (point) (point-max))))
7923 (< (gnus-data-pos (car data)) end-point))
7924 (when (or (not top-subject)
7925 (string= top-subject
7926 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7927 (gnus-simplify-subject-fuzzy
7928 (mail-header-subject
7929 (gnus-data-header (car data))))
7930 (gnus-simplify-subject-re
7931 (mail-header-subject
7932 (gnus-data-header (car data)))))))
7933 (push (gnus-data-number (car data)) articles))
7934 (unless (and (setq data (cdr data))
7935 (> (gnus-data-level (car data)) top-level))
7937 ;; Return the list of articles.
7938 (nreverse articles)))
7940 (defun gnus-summary-rethread-current ()
7941 "Rethread the thread the current article is part of."
7943 (gnus-set-global-variables)
7944 (let* ((gnus-show-threads t)
7945 (article (gnus-summary-article-number))
7946 (id (mail-header-id (gnus-summary-article-header)))
7947 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7949 (error "No article on the current line"))
7950 (gnus-rebuild-thread id)
7951 (gnus-summary-goto-subject article)))
7953 (defun gnus-summary-reparent-thread ()
7954 "Make the current article child of the marked (or previous) article.
7956 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7957 is non-nil or the Subject: of both articles are the same."
7959 (unless (not (gnus-group-read-only-p))
7960 (error "The current newsgroup does not support article editing"))
7961 (unless (<= (length gnus-newsgroup-processable) 1)
7962 (error "No more than one article may be marked"))
7963 (save-window-excursion
7964 (let ((gnus-article-buffer " *reparent*")
7965 (current-article (gnus-summary-article-number))
7966 ;; First grab the marked article, otherwise one line up.
7967 (parent-article (if (not (null gnus-newsgroup-processable))
7968 (car gnus-newsgroup-processable)
7970 (if (eq (forward-line -1) 0)
7971 (gnus-summary-article-number)
7972 (error "Beginning of summary buffer"))))))
7973 (unless (not (eq current-article parent-article))
7974 (error "An article may not be self-referential"))
7975 (let ((message-id (mail-header-id
7976 (gnus-summary-article-header parent-article))))
7977 (unless (and message-id (not (equal message-id "")))
7978 (error "No message-id in desired parent"))
7979 (gnus-summary-select-article t t nil current-article)
7980 (set-buffer gnus-original-article-buffer)
7981 (let ((buf (format "%s" (buffer-string))))
7982 (nnheader-temp-write nil
7984 (goto-char (point-min))
7985 (if (search-forward-regexp "^References: " nil t)
7986 (insert message-id " " )
7987 (insert "References: " message-id "\n"))
7988 (unless (gnus-request-replace-article
7989 current-article (car gnus-article-current)
7991 (error "Couldn't replace article"))))
7992 (set-buffer gnus-summary-buffer)
7993 (gnus-summary-unmark-all-processable)
7994 (gnus-summary-rethread-current)
7995 (gnus-message 3 "Article %d is now the child of article %d"
7996 current-article parent-article)))))
7998 (defun gnus-summary-toggle-threads (&optional arg)
7999 "Toggle showing conversation threads.
8000 If ARG is positive number, turn showing conversation threads on."
8002 (gnus-set-global-variables)
8003 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8004 (setq gnus-show-threads
8005 (if (null arg) (not gnus-show-threads)
8006 (> (prefix-numeric-value arg) 0)))
8007 (gnus-summary-prepare)
8008 (gnus-summary-goto-subject current)
8009 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8010 (gnus-summary-position-point)))
8012 (defun gnus-summary-show-all-threads ()
8015 (gnus-set-global-variables)
8017 (let ((buffer-read-only nil))
8018 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8019 (gnus-summary-position-point))
8021 (defun gnus-summary-show-thread ()
8022 "Show thread subtrees.
8023 Returns nil if no thread was there to be shown."
8025 (gnus-set-global-variables)
8026 (let ((buffer-read-only nil)
8028 ;; first goto end then to beg, to have point at beg after let
8029 (end (progn (end-of-line) (point)))
8030 (beg (progn (beginning-of-line) (point))))
8032 ;; Any hidden lines here?
8033 (search-forward "\r" end t)
8034 (subst-char-in-region beg end ?\^M ?\n t)
8036 (gnus-summary-position-point))))
8038 (defun gnus-summary-hide-all-threads ()
8039 "Hide all thread subtrees."
8041 (gnus-set-global-variables)
8043 (goto-char (point-min))
8044 (gnus-summary-hide-thread)
8045 (while (zerop (gnus-summary-next-thread 1 t))
8046 (gnus-summary-hide-thread)))
8047 (gnus-summary-position-point))
8049 (defun gnus-summary-hide-thread ()
8050 "Hide thread subtrees.
8051 Returns nil if no threads were there to be hidden."
8053 (gnus-set-global-variables)
8054 (let ((buffer-read-only nil)
8056 (article (gnus-summary-article-number)))
8058 ;; Go forward until either the buffer ends or the subthread
8060 (when (and (not (eobp))
8061 (or (zerop (gnus-summary-next-thread 1 t))
8062 (goto-char (point-max))))
8064 (if (and (> (point) start)
8065 (search-backward "\n" start t))
8067 (subst-char-in-region start (point) ?\n ?\^M)
8068 (gnus-summary-goto-subject article))
8071 ;;(gnus-summary-position-point)
8074 (defun gnus-summary-go-to-next-thread (&optional previous)
8075 "Go to the same level (or less) next thread.
8076 If PREVIOUS is non-nil, go to previous thread instead.
8077 Return the article number moved to, or nil if moving was impossible."
8078 (let ((level (gnus-summary-thread-level))
8079 (way (if previous -1 1))
8082 (while (and (not (eobp))
8083 (< level (gnus-summary-thread-level)))
8091 (gnus-summary-article-number)
8094 (defun gnus-summary-next-thread (n &optional silent)
8095 "Go to the same level next N'th thread.
8096 If N is negative, search backward instead.
8097 Returns the difference between N and the number of skips actually
8100 If SILENT, don't output messages."
8102 (gnus-set-global-variables)
8103 (let ((backward (< n 0))
8106 (gnus-summary-go-to-next-thread backward))
8109 (gnus-summary-position-point))
8110 (when (and (not silent) (/= 0 n))
8111 (gnus-message 7 "No more threads"))
8114 (defun gnus-summary-prev-thread (n)
8115 "Go to the same level previous N'th thread.
8116 Returns the difference between N and the number of skips actually
8119 (gnus-set-global-variables)
8120 (gnus-summary-next-thread (- n)))
8122 (defun gnus-summary-go-down-thread ()
8123 "Go down one level in the current thread."
8124 (let ((children (gnus-summary-article-children)))
8126 (gnus-summary-goto-subject (car children)))))
8128 (defun gnus-summary-go-up-thread ()
8129 "Go up one level in the current thread."
8130 (let ((parent (gnus-summary-article-parent)))
8132 (gnus-summary-goto-subject parent))))
8134 (defun gnus-summary-down-thread (n)
8135 "Go down thread N steps.
8136 If N is negative, go up instead.
8137 Returns the difference between N and how many steps down that were
8140 (gnus-set-global-variables)
8144 (if up (gnus-summary-go-up-thread)
8145 (gnus-summary-go-down-thread)))
8147 (gnus-summary-position-point)
8149 (gnus-message 7 "Can't go further"))
8152 (defun gnus-summary-up-thread (n)
8153 "Go up thread N steps.
8154 If N is negative, go up instead.
8155 Returns the difference between N and how many steps down that were
8158 (gnus-set-global-variables)
8159 (gnus-summary-down-thread (- n)))
8161 (defun gnus-summary-top-thread ()
8162 "Go to the top of the thread."
8164 (gnus-set-global-variables)
8165 (while (gnus-summary-go-up-thread))
8166 (gnus-summary-article-number))
8168 (defun gnus-summary-kill-thread (&optional unmark)
8169 "Mark articles under current thread as read.
8170 If the prefix argument is positive, remove any kinds of marks.
8171 If the prefix argument is negative, tick articles instead."
8173 (gnus-set-global-variables)
8175 (setq unmark (prefix-numeric-value unmark)))
8176 (let ((articles (gnus-summary-articles-in-thread)))
8178 ;; Expand the thread.
8179 (gnus-summary-show-thread)
8180 ;; Mark all the articles.
8182 (gnus-summary-goto-subject (car articles))
8183 (cond ((null unmark)
8184 (gnus-summary-mark-article-as-read gnus-killed-mark))
8186 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8188 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8189 (setq articles (cdr articles))))
8190 ;; Hide killed subtrees.
8192 gnus-thread-hide-killed
8193 (gnus-summary-hide-thread))
8194 ;; If marked as read, go to next unread subject.
8196 ;; Go to next unread subject.
8197 (gnus-summary-next-subject 1 t)))
8198 (gnus-set-mode-line 'summary))
8200 ;; Summary sorting commands
8202 (defun gnus-summary-sort-by-number (&optional reverse)
8203 "Sort the summary buffer by article number.
8204 Argument REVERSE means reverse order."
8206 (gnus-summary-sort 'number reverse))
8208 (defun gnus-summary-sort-by-author (&optional reverse)
8209 "Sort the summary buffer by author name alphabetically.
8210 If case-fold-search is non-nil, case of letters is ignored.
8211 Argument REVERSE means reverse order."
8213 (gnus-summary-sort 'author reverse))
8215 (defun gnus-summary-sort-by-subject (&optional reverse)
8216 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8217 If case-fold-search is non-nil, case of letters is ignored.
8218 Argument REVERSE means reverse order."
8220 (gnus-summary-sort 'subject reverse))
8222 (defun gnus-summary-sort-by-date (&optional reverse)
8223 "Sort the summary buffer by date.
8224 Argument REVERSE means reverse order."
8226 (gnus-summary-sort 'date reverse))
8228 (defun gnus-summary-sort-by-score (&optional reverse)
8229 "Sort the summary buffer by score.
8230 Argument REVERSE means reverse order."
8232 (gnus-summary-sort 'score reverse))
8234 (defun gnus-summary-sort-by-lines (&optional reverse)
8235 "Sort the summary buffer by article length.
8236 Argument REVERSE means reverse order."
8238 (gnus-summary-sort 'lines reverse))
8240 (defun gnus-summary-sort (predicate reverse)
8241 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8242 (gnus-set-global-variables)
8243 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8244 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8245 (gnus-thread-sort-functions
8251 (gnus-article-sort-functions
8256 (,article t2 t1)))))
8258 (gnus-summary-prepare-hook nil))
8259 ;; We do the sorting by regenerating the threads.
8260 (gnus-summary-prepare)
8261 ;; Hide subthreads if needed.
8262 (when (and gnus-show-threads gnus-thread-hide-subtree)
8263 (gnus-summary-hide-all-threads))))
8265 ;; Summary saving commands.
8267 (defun gnus-summary-save-article (&optional n not-saved)
8268 "Save the current article using the default saver function.
8269 If N is a positive number, save the N next articles.
8270 If N is a negative number, save the N previous articles.
8271 If N is nil and any articles have been marked with the process mark,
8272 save those articles instead.
8273 The variable `gnus-default-article-saver' specifies the saver function."
8275 (gnus-set-global-variables)
8276 (let* ((articles (gnus-summary-work-articles n))
8277 (save-buffer (save-excursion
8278 (nnheader-set-temp-buffer " *Gnus Save*")))
8279 (num (length articles))
8280 header article file)
8282 (setq header (gnus-summary-article-header
8283 (setq article (pop articles))))
8284 (if (not (vectorp header))
8285 ;; This is a pseudo-article.
8286 (if (assq 'name header)
8287 (gnus-copy-file (cdr (assq 'name header)))
8288 (gnus-message 1 "Article %d is unsaveable" article))
8289 ;; This is a real article.
8290 (save-window-excursion
8291 (gnus-summary-select-article t nil nil article))
8293 (set-buffer save-buffer)
8295 (insert-buffer-substring gnus-original-article-buffer))
8296 (setq file (gnus-article-save save-buffer file num))
8297 (gnus-summary-remove-process-mark article)
8299 (gnus-summary-set-saved-mark article))))
8300 (gnus-kill-buffer save-buffer)
8301 (gnus-summary-position-point)
8302 (gnus-set-mode-line 'summary)
8305 (defun gnus-summary-pipe-output (&optional arg)
8306 "Pipe the current article to a subprocess.
8307 If N is a positive number, pipe the N next articles.
8308 If N is a negative number, pipe the N previous articles.
8309 If N is nil and any articles have been marked with the process mark,
8310 pipe those articles instead."
8312 (gnus-set-global-variables)
8313 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8314 (gnus-summary-save-article arg t))
8315 (gnus-configure-windows 'pipe))
8317 (defun gnus-summary-save-article-mail (&optional arg)
8318 "Append the current article to an mail file.
8319 If N is a positive number, save the N next articles.
8320 If N is a negative number, save the N previous articles.
8321 If N is nil and any articles have been marked with the process mark,
8322 save those articles instead."
8324 (gnus-set-global-variables)
8325 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8326 (gnus-summary-save-article arg)))
8328 (defun gnus-summary-save-article-rmail (&optional arg)
8329 "Append the current article to an rmail file.
8330 If N is a positive number, save the N next articles.
8331 If N is a negative number, save the N previous articles.
8332 If N is nil and any articles have been marked with the process mark,
8333 save those articles instead."
8335 (gnus-set-global-variables)
8336 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8337 (gnus-summary-save-article arg)))
8339 (defun gnus-summary-save-article-file (&optional arg)
8340 "Append the current article to a file.
8341 If N is a positive number, save the N next articles.
8342 If N is a negative number, save the N previous articles.
8343 If N is nil and any articles have been marked with the process mark,
8344 save those articles instead."
8346 (gnus-set-global-variables)
8347 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8348 (gnus-summary-save-article arg)))
8350 (defun gnus-summary-write-article-file (&optional arg)
8351 "Write the current article to a file, deleting the previous file.
8352 If N is a positive number, save the N next articles.
8353 If N is a negative number, save the N previous articles.
8354 If N is nil and any articles have been marked with the process mark,
8355 save those articles instead."
8357 (gnus-set-global-variables)
8358 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8359 (gnus-summary-save-article arg)))
8361 (defun gnus-summary-save-article-body-file (&optional arg)
8362 "Append the current article body to a file.
8363 If N is a positive number, save the N next articles.
8364 If N is a negative number, save the N previous articles.
8365 If N is nil and any articles have been marked with the process mark,
8366 save those articles instead."
8368 (gnus-set-global-variables)
8369 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8370 (gnus-summary-save-article arg)))
8372 (defun gnus-summary-pipe-message (program)
8373 "Pipe the current article through PROGRAM."
8374 (interactive "sProgram: ")
8375 (gnus-set-global-variables)
8376 (gnus-summary-select-article)
8377 (let ((mail-header-separator "")
8378 (art-buf (get-buffer gnus-article-buffer)))
8379 (gnus-eval-in-buffer-window gnus-article-buffer
8382 (let ((start (window-start))
8384 (message-pipe-buffer-body program)
8385 (set-window-start (get-buffer-window (current-buffer)) start))))))
8387 (defun gnus-get-split-value (methods)
8388 "Return a value based on the split METHODS."
8389 (let (split-name method result match)
8392 (set-buffer gnus-original-article-buffer)
8394 (nnheader-narrow-to-headers)
8396 (goto-char (point-min))
8397 (setq method (pop methods))
8398 (setq match (car method))
8401 ;; Regular expression.
8403 (re-search-forward match nil t)))
8404 ((gnus-functionp match)
8408 (setq result (funcall match gnus-newsgroup-name))))
8413 (setq result (eval match)))))
8414 (setq split-name (append (cdr method) split-name))
8415 (cond ((stringp result)
8416 (push (expand-file-name
8417 result gnus-article-save-directory)
8420 (setq split-name (append result split-name)))))))))
8423 (defun gnus-valid-move-group-p (group)
8428 (car (gnus-find-method-for-group
8429 (symbol-name group))))
8430 gnus-valid-select-methods))))
8432 (defun gnus-read-move-group-name (prompt default articles prefix)
8433 "Read a group name."
8434 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8435 (minibuffer-confirm-incomplete nil) ; XEmacs
8439 (if (> (length articles) 1)
8440 (format "these %d articles" (length articles))
8445 (gnus-completing-read default prom
8447 'gnus-valid-move-group-p
8449 'gnus-group-history))
8450 ((= 1 (length split-name))
8451 (gnus-completing-read (car split-name) prom
8453 'gnus-valid-move-group-p
8455 'gnus-group-history))
8457 (gnus-completing-read nil prom
8458 (mapcar (lambda (el) (list el))
8459 (nreverse split-name))
8461 'gnus-group-history)))))
8463 (if (or (string= to-newsgroup "")
8464 (string= to-newsgroup prefix))
8465 (setq to-newsgroup default))
8466 (unless to-newsgroup
8467 (error "No group name entered"))
8468 (or (gnus-active to-newsgroup)
8469 (gnus-activate-group to-newsgroup)
8470 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8472 (or (and (gnus-request-create-group
8473 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8474 (gnus-activate-group to-newsgroup nil nil
8475 (gnus-group-name-to-method
8477 (error "Couldn't create group %s" to-newsgroup)))
8478 (error "No such group: %s" to-newsgroup)))
8481 ;; Summary extract commands
8483 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8484 (let ((buffer-read-only nil)
8485 (article (gnus-summary-article-number))
8487 (unless (gnus-summary-goto-subject article)
8488 (error "No such article: %d" article))
8489 (gnus-summary-position-point)
8490 ;; If all commands are to be bunched up on one line, we collect
8492 (unless gnus-view-pseudos-separately
8493 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8496 (setq action (cdr (assq 'action (car ps))))
8497 (setq files (list (cdr (assq 'name (car ps)))))
8498 (while (and ps (cdr ps)
8499 (string= (or action "1")
8500 (or (cdr (assq 'action (cadr ps))) "2")))
8501 (push (cdr (assq 'name (cadr ps))) files)
8502 (setcdr ps (cddr ps)))
8504 (when (not (string-match "%s" action))
8507 (when (assq 'execute (car ps))
8508 (setcdr (assq 'execute (car ps))
8509 (funcall (if (string-match "%s" action)
8516 (gnus-quote-arg-for-sh-or-csh f)))
8518 (setq ps (cdr ps)))))
8519 (if (and gnus-view-pseudos (not not-view))
8521 (when (assq 'execute (car pslist))
8522 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8523 (eq gnus-view-pseudos 'not-confirm)))
8524 (setq pslist (cdr pslist)))
8527 (setq after-article (or (cdr (assq 'article (car pslist)))
8528 (gnus-summary-article-number)))
8529 (gnus-summary-goto-subject after-article)
8532 (insert " " (file-name-nondirectory
8533 (cdr (assq 'name (car pslist))))
8534 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8536 (forward-line -1) ; back to `b'
8537 (gnus-add-text-properties
8538 b (1- e) (list 'gnus-number gnus-reffed-article-number
8539 gnus-mouse-face-prop gnus-mouse-face))
8541 after-article gnus-reffed-article-number
8542 gnus-unread-mark b (car pslist) 0 (- e b))
8543 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8544 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8545 (setq pslist (cdr pslist)))))))
8547 (defun gnus-pseudos< (p1 p2)
8548 (let ((c1 (cdr (assq 'action p1)))
8549 (c2 (cdr (assq 'action p2))))
8550 (and c1 c2 (string< c1 c2))))
8552 (defun gnus-request-pseudo-article (props)
8553 (cond ((assq 'execute props)
8554 (gnus-execute-command (cdr (assq 'execute props)))))
8555 (let ((gnus-current-article (gnus-summary-article-number)))
8556 (run-hooks 'gnus-mark-article-hook)))
8558 (defun gnus-execute-command (command &optional automatic)
8560 (gnus-article-setup-buffer)
8561 (set-buffer gnus-article-buffer)
8562 (setq buffer-read-only nil)
8563 (let ((command (if automatic command
8564 (read-string "Command: " (cons command 0)))))
8566 (insert "$ " command "\n\n")
8567 (if gnus-view-pseudo-asynchronously
8568 (start-process "gnus-execute" (current-buffer) shell-file-name
8569 shell-command-switch command)
8570 (call-process shell-file-name nil t nil
8571 shell-command-switch command)))))
8573 ;; Summary kill commands.
8575 (defun gnus-summary-edit-global-kill (article)
8576 "Edit the \"global\" kill file."
8577 (interactive (list (gnus-summary-article-number)))
8578 (gnus-set-global-variables)
8579 (gnus-group-edit-global-kill article))
8581 (defun gnus-summary-edit-local-kill ()
8582 "Edit a local kill file applied to the current newsgroup."
8584 (gnus-set-global-variables)
8585 (setq gnus-current-headers (gnus-summary-article-header))
8586 (gnus-set-global-variables)
8587 (gnus-group-edit-local-kill
8588 (gnus-summary-article-number) gnus-newsgroup-name))
8592 (defun gnus-read-header (id &optional header)
8593 "Read the headers of article ID and enter them into the Gnus system."
8594 (let ((group gnus-newsgroup-name)
8595 (gnus-override-method
8596 (and (gnus-news-group-p gnus-newsgroup-name)
8597 gnus-refer-article-method))
8599 ;; First we check to see whether the header in question is already
8602 ;; This is a Message-ID.
8603 (setq header (or header (gnus-id-to-header id)))
8604 ;; This is an article number.
8605 (setq header (or header (gnus-summary-article-header id))))
8607 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8608 ;; We have found the header.
8610 ;; We have to really fetch the header to this article.
8612 (set-buffer nntp-server-buffer)
8613 (when (setq where (gnus-request-head id group))
8614 (nnheader-fold-continuation-lines)
8615 (goto-char (point-max))
8617 (goto-char (point-min))
8621 ((cdr where) (cdr where))
8622 (header (mail-header-number header))
8623 (t gnus-reffed-article-number))
8625 (insert " Article retrieved.\n"))
8627 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8628 () ; Malformed head.
8629 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8630 (when (and (stringp id)
8631 (not (string= (gnus-group-real-name group)
8633 ;; If we fetched by Message-ID and the article came
8634 ;; from a different group, we fudge some bogus article
8635 ;; numbers for this article.
8636 (mail-header-set-number header gnus-reffed-article-number))
8638 (set-buffer gnus-summary-buffer)
8639 (decf gnus-reffed-article-number)
8640 (gnus-remove-header (mail-header-number header))
8641 (push header gnus-newsgroup-headers)
8642 (setq gnus-current-headers header)
8643 (push (mail-header-number header) gnus-newsgroup-limit)))
8646 (defun gnus-remove-header (number)
8647 "Remove header NUMBER from `gnus-newsgroup-headers'."
8648 (if (and gnus-newsgroup-headers
8649 (= number (mail-header-number (car gnus-newsgroup-headers))))
8650 (pop gnus-newsgroup-headers)
8651 (let ((headers gnus-newsgroup-headers))
8652 (while (and (cdr headers)
8653 (not (= number (mail-header-number (cadr headers)))))
8656 (setcdr headers (cddr headers))))))
8659 ;;; summary highlights
8662 (defun gnus-highlight-selected-summary ()
8663 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8664 ;; Highlight selected article in summary buffer
8665 (when gnus-summary-selected-face
8667 (let* ((beg (progn (beginning-of-line) (point)))
8668 (end (progn (end-of-line) (point)))
8669 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8670 (from (if (get-text-property beg gnus-mouse-face-prop)
8672 (or (next-single-property-change
8673 beg gnus-mouse-face-prop nil end)
8678 (or (next-single-property-change
8679 from gnus-mouse-face-prop nil end)
8681 ;; If no mouse-face prop on line we will have to = from = end,
8682 ;; so we highlight the entire line instead.
8683 (when (= (+ to 2) from)
8686 (if gnus-newsgroup-selected-overlay
8687 ;; Move old overlay.
8689 gnus-newsgroup-selected-overlay from to (current-buffer))
8690 ;; Create new overlay.
8692 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8693 'face gnus-summary-selected-face))))))
8695 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8696 (defun gnus-summary-highlight-line ()
8697 "Highlight current line according to `gnus-summary-highlight'."
8698 (let* ((list gnus-summary-highlight)
8700 (end (progn (end-of-line) (point)))
8701 ;; now find out where the line starts and leave point there.
8702 (beg (progn (beginning-of-line) (point)))
8703 (article (gnus-summary-article-number))
8704 (score (or (cdr (assq (or article gnus-current-article)
8705 gnus-newsgroup-scored))
8706 gnus-summary-default-score 0))
8707 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8708 (inhibit-read-only t))
8709 ;; Eval the cars of the lists until we find a match.
8710 (let ((default gnus-summary-default-score))
8712 (not (eval (caar list))))
8713 (setq list (cdr list))))
8714 (let ((face (cdar list)))
8715 (unless (eq face (get-text-property beg 'face))
8716 (gnus-put-text-property
8718 (setq face (if (boundp face) (symbol-value face) face)))
8719 (when gnus-summary-highlight-line-function
8720 (funcall gnus-summary-highlight-line-function article face))))
8723 (defun gnus-update-read-articles (group unread &optional compute)
8724 "Update the list of read articles in GROUP."
8725 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8726 (entry (gnus-gethash group gnus-newsrc-hashtb))
8727 (info (nth 2 entry))
8729 (unread (sort (copy-sequence unread) '<))
8731 (if (or (not info) (not active))
8732 ;; There is no info on this group if it was, in fact,
8733 ;; killed. Gnus stores no information on killed groups, so
8734 ;; there's nothing to be done.
8735 ;; One could store the information somewhere temporarily,
8736 ;; perhaps... Hmmm...
8738 ;; Remove any negative articles numbers.
8739 (while (and unread (< (car unread) 0))
8740 (setq unread (cdr unread)))
8741 ;; Remove any expired article numbers
8742 (while (and unread (< (car unread) (car active)))
8743 (setq unread (cdr unread)))
8744 ;; Compute the ranges of read articles by looking at the list of
8747 (when (/= (car unread) prev)
8748 (push (if (= prev (1- (car unread))) prev
8749 (cons prev (1- (car unread))))
8751 (setq prev (1+ (car unread)))
8752 (setq unread (cdr unread)))
8753 (when (<= prev (cdr active))
8754 (push (cons prev (cdr active)) read))
8756 (if (> (length read) 1) (nreverse read) read)
8758 (set-buffer gnus-group-buffer)
8761 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8762 (gnus-info-set-read ',info ',(gnus-info-read info))
8763 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8764 (gnus-group-update-group ,group t))))
8765 ;; Enter this list into the group info.
8767 info (if (> (length read) 1) (nreverse read) read))
8768 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8769 (gnus-get-unread-articles-in-group info (gnus-active group))
8772 (defun gnus-offer-save-summaries ()
8773 "Offer to save all active summary buffers."
8775 (let ((buflist (buffer-list))
8777 ;; Go through all buffers and find all summaries.
8779 (and (setq bufname (buffer-name (car buflist)))
8780 (string-match "Summary" bufname)
8782 (set-buffer bufname)
8783 ;; We check that this is, indeed, a summary buffer.
8784 (and (eq major-mode 'gnus-summary-mode)
8785 ;; Also make sure this isn't bogus.
8786 gnus-newsgroup-prepared
8787 ;; Also make sure that this isn't a dead summary buffer.
8788 (not gnus-dead-summary-mode)))
8789 (push bufname buffers))
8790 (setq buflist (cdr buflist)))
8791 ;; Go through all these summary buffers and offer to save them.
8794 "Update summary buffer %s? "
8795 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8802 (run-hooks 'gnus-sum-load-hook)
8804 ;;; gnus-sum.el ends here