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)
742 ;;; Internal variables
744 (defvar gnus-scores-exclude-files nil)
745 (defvar gnus-page-broken nil)
747 (defvar gnus-original-article nil)
748 (defvar gnus-article-internal-prepare-hook nil)
749 (defvar gnus-newsgroup-process-stack nil)
751 (defvar gnus-thread-indent-array nil)
752 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
754 ;; Avoid highlighting in kill files.
755 (defvar gnus-summary-inhibit-highlight nil)
756 (defvar gnus-newsgroup-selected-overlay nil)
757 (defvar gnus-inhibit-limiting nil)
758 (defvar gnus-newsgroup-adaptive-score-file nil)
759 (defvar gnus-current-score-file nil)
760 (defvar gnus-current-move-group nil)
761 (defvar gnus-current-copy-group nil)
762 (defvar gnus-current-crosspost-group nil)
764 (defvar gnus-newsgroup-dependencies nil)
765 (defvar gnus-newsgroup-adaptive nil)
766 (defvar gnus-summary-display-article-function nil)
767 (defvar gnus-summary-highlight-line-function nil
768 "Function called after highlighting a summary line.")
770 (defvar gnus-summary-line-format-alist
771 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
772 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
773 (?s gnus-tmp-subject-or-nil ?s)
774 (?n gnus-tmp-name ?s)
775 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
777 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
779 (?F gnus-tmp-from ?s)
780 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
781 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
782 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
783 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
784 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
785 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
786 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
787 (?L gnus-tmp-lines ?d)
788 (?I gnus-tmp-indentation ?s)
789 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
790 (?R gnus-tmp-replied ?c)
791 (?\[ gnus-tmp-opening-bracket ?c)
792 (?\] gnus-tmp-closing-bracket ?c)
793 (?\> (make-string gnus-tmp-level ? ) ?s)
794 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
795 (?i gnus-tmp-score ?d)
796 (?z gnus-tmp-score-char ?c)
797 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
798 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
799 (?U gnus-tmp-unread ?c)
800 (?t (gnus-summary-number-of-articles-in-thread
801 (and (boundp 'thread) (car thread)) gnus-tmp-level)
803 (?e (gnus-summary-number-of-articles-in-thread
804 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
806 (?u gnus-tmp-user-defined ?s)
807 (?P (gnus-pick-line-number) ?d))
808 "An alist of format specifications that can appear in summary lines,
809 and what variables they correspond with, along with the type of the
810 variable (string, integer, character, etc).")
812 (defvar gnus-summary-dummy-line-format-alist
813 `((?S gnus-tmp-subject ?s)
814 (?N gnus-tmp-number ?d)
815 (?u gnus-tmp-user-defined ?s)))
817 (defvar gnus-summary-mode-line-format-alist
818 `((?G gnus-tmp-group-name ?s)
819 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
820 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
821 (?A gnus-tmp-article-number ?d)
822 (?Z gnus-tmp-unread-and-unselected ?s)
824 (?U gnus-tmp-unread-and-unticked ?d)
825 (?S gnus-tmp-subject ?s)
826 (?e gnus-tmp-unselected ?d)
827 (?u gnus-tmp-user-defined ?s)
828 (?d (length gnus-newsgroup-dormant) ?d)
829 (?t (length gnus-newsgroup-marked) ?d)
830 (?r (length gnus-newsgroup-reads) ?d)
831 (?E gnus-newsgroup-expunged-tally ?d)
832 (?s (gnus-current-score-file-nondirectory) ?s)))
834 (defvar gnus-last-search-regexp nil
835 "Default regexp for article search command.")
837 (defvar gnus-last-shell-command nil
838 "Default shell command on article.")
840 (defvar gnus-newsgroup-begin nil)
841 (defvar gnus-newsgroup-end nil)
842 (defvar gnus-newsgroup-last-rmail nil)
843 (defvar gnus-newsgroup-last-mail nil)
844 (defvar gnus-newsgroup-last-folder nil)
845 (defvar gnus-newsgroup-last-file nil)
846 (defvar gnus-newsgroup-auto-expire nil)
847 (defvar gnus-newsgroup-active nil)
849 (defvar gnus-newsgroup-data nil)
850 (defvar gnus-newsgroup-data-reverse nil)
851 (defvar gnus-newsgroup-limit nil)
852 (defvar gnus-newsgroup-limits nil)
854 (defvar gnus-newsgroup-unreads nil
855 "List of unread articles in the current newsgroup.")
857 (defvar gnus-newsgroup-unselected nil
858 "List of unselected unread articles in the current newsgroup.")
860 (defvar gnus-newsgroup-reads nil
861 "Alist of read articles and article marks in the current newsgroup.")
863 (defvar gnus-newsgroup-expunged-tally nil)
865 (defvar gnus-newsgroup-marked nil
866 "List of ticked articles in the current newsgroup (a subset of unread art).")
868 (defvar gnus-newsgroup-killed nil
869 "List of ranges of articles that have been through the scoring process.")
871 (defvar gnus-newsgroup-cached nil
872 "List of articles that come from the article cache.")
874 (defvar gnus-newsgroup-saved nil
875 "List of articles that have been saved.")
877 (defvar gnus-newsgroup-kill-headers nil)
879 (defvar gnus-newsgroup-replied nil
880 "List of articles that have been replied to in the current newsgroup.")
882 (defvar gnus-newsgroup-expirable nil
883 "List of articles in the current newsgroup that can be expired.")
885 (defvar gnus-newsgroup-processable nil
886 "List of articles in the current newsgroup that can be processed.")
888 (defvar gnus-newsgroup-downloadable nil
889 "List of articles in the current newsgroup that can be processed.")
891 (defvar gnus-newsgroup-undownloaded nil
892 "List of articles in the current newsgroup that haven't been downloaded..")
894 (defvar gnus-newsgroup-unsendable nil
895 "List of articles in the current newsgroup that won't be sent.")
897 (defvar gnus-newsgroup-bookmarks nil
898 "List of articles in the current newsgroup that have bookmarks.")
900 (defvar gnus-newsgroup-dormant nil
901 "List of dormant articles in the current newsgroup.")
903 (defvar gnus-newsgroup-scored nil
904 "List of scored articles in the current newsgroup.")
906 (defvar gnus-newsgroup-headers nil
907 "List of article headers in the current newsgroup.")
909 (defvar gnus-newsgroup-threads nil)
911 (defvar gnus-newsgroup-prepared nil
912 "Whether the current group has been prepared properly.")
914 (defvar gnus-newsgroup-ancient nil
915 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
917 (defvar gnus-newsgroup-sparse nil)
919 (defvar gnus-current-article nil)
920 (defvar gnus-article-current nil)
921 (defvar gnus-current-headers nil)
922 (defvar gnus-have-all-headers nil)
923 (defvar gnus-last-article nil)
924 (defvar gnus-newsgroup-history nil)
926 (defconst gnus-summary-local-variables
927 '(gnus-newsgroup-name
928 gnus-newsgroup-begin gnus-newsgroup-end
929 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
930 gnus-newsgroup-last-folder gnus-newsgroup-last-file
931 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
932 gnus-newsgroup-unselected gnus-newsgroup-marked
933 gnus-newsgroup-reads gnus-newsgroup-saved
934 gnus-newsgroup-replied gnus-newsgroup-expirable
935 gnus-newsgroup-processable gnus-newsgroup-killed
936 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
937 gnus-newsgroup-unsendable
938 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
939 gnus-newsgroup-headers gnus-newsgroup-threads
940 gnus-newsgroup-prepared gnus-summary-highlight-line-function
941 gnus-current-article gnus-current-headers gnus-have-all-headers
942 gnus-last-article gnus-article-internal-prepare-hook
943 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
944 gnus-newsgroup-scored gnus-newsgroup-kill-headers
945 gnus-thread-expunge-below
946 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
947 (gnus-summary-mark-below . global)
948 gnus-newsgroup-active gnus-scores-exclude-files
949 gnus-newsgroup-history gnus-newsgroup-ancient
950 gnus-newsgroup-sparse gnus-newsgroup-process-stack
951 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
952 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
953 (gnus-newsgroup-expunged-tally . 0)
954 gnus-cache-removable-articles gnus-newsgroup-cached
955 gnus-newsgroup-data gnus-newsgroup-data-reverse
956 gnus-newsgroup-limit gnus-newsgroup-limits)
957 "Variables that are buffer-local to the summary buffers.")
959 ;; Byte-compiler warning.
960 (defvar gnus-article-mode-map)
962 ;; Subject simplification.
964 (defsubst gnus-simplify-subject-re (subject)
965 "Remove \"Re:\" from subject lines."
966 (if (string-match "^[Rr][Ee]: *" subject)
967 (substring subject (match-end 0))
970 (defun gnus-simplify-subject (subject &optional re-only)
971 "Remove `Re:' and words in parentheses.
972 If RE-ONLY is non-nil, strip leading `Re:'s only."
973 (let ((case-fold-search t)) ;Ignore case.
974 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
975 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
976 (setq subject (substring subject (match-end 0))))
977 ;; Remove uninteresting prefixes.
978 (when (and (not re-only)
979 gnus-simplify-ignored-prefixes
980 (string-match gnus-simplify-ignored-prefixes subject))
981 (setq subject (substring subject (match-end 0))))
982 ;; Remove words in parentheses from end.
984 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
985 (setq subject (substring subject 0 (match-beginning 0)))))
986 ;; Return subject string.
989 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
991 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
992 (goto-char (point-min))
993 (while (re-search-forward regexp nil t)
994 (replace-match (or newtext ""))))
996 (defun gnus-simplify-buffer-fuzzy ()
997 "Simplify string in the buffer fuzzily.
998 The string in the accessible portion of the current buffer is simplified.
999 It is assumed to be a single-line subject.
1000 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1001 matter is removed. Additional things can be deleted by setting
1002 gnus-simplify-subject-fuzzy-regexp."
1003 (let ((case-fold-search t)
1005 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1007 (while (not (eq modified-tick (buffer-modified-tick)))
1008 (setq modified-tick (buffer-modified-tick))
1010 ((listp gnus-simplify-subject-fuzzy-regexp)
1011 (mapcar 'gnus-simplify-buffer-fuzzy-step
1012 gnus-simplify-subject-fuzzy-regexp))
1013 (gnus-simplify-subject-fuzzy-regexp
1014 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1015 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1016 (gnus-simplify-buffer-fuzzy-step
1017 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1018 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1020 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1021 (gnus-simplify-buffer-fuzzy-step " +" " ")
1022 (gnus-simplify-buffer-fuzzy-step " $")
1023 (gnus-simplify-buffer-fuzzy-step "^ +")))
1025 (defun gnus-simplify-subject-fuzzy (subject)
1026 "Simplify a subject string fuzzily.
1027 See gnus-simplify-buffer-fuzzy for details."
1029 (gnus-set-work-buffer)
1030 (let ((case-fold-search t))
1032 (inline (gnus-simplify-buffer-fuzzy))
1035 (defsubst gnus-simplify-subject-fully (subject)
1036 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1038 ((null gnus-summary-gather-subject-limit)
1039 (gnus-simplify-subject-re subject))
1040 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1041 (gnus-simplify-subject-fuzzy subject))
1042 ((numberp gnus-summary-gather-subject-limit)
1043 (gnus-limit-string (gnus-simplify-subject-re subject)
1044 gnus-summary-gather-subject-limit))
1048 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1049 "Check whether two subjects are equal. If optional argument
1050 simple-first is t, first argument is already simplified."
1052 ((null simple-first)
1053 (equal (gnus-simplify-subject-fully s1)
1054 (gnus-simplify-subject-fully s2)))
1057 (gnus-simplify-subject-fully s2)))))
1059 (defun gnus-summary-bubble-group ()
1060 "Increase the score of the current group.
1061 This is a handy function to add to `gnus-summary-exit-hook' to
1062 increase the score of each group you read."
1063 (gnus-group-add-score gnus-newsgroup-name))
1067 ;;; Gnus summary mode
1070 (put 'gnus-summary-mode 'mode-class 'special)
1073 ;; Non-orthogonal keys
1075 (gnus-define-keys gnus-summary-mode-map
1076 " " gnus-summary-next-page
1077 "\177" gnus-summary-prev-page
1078 [delete] gnus-summary-prev-page
1079 "\r" gnus-summary-scroll-up
1080 "n" gnus-summary-next-unread-article
1081 "p" gnus-summary-prev-unread-article
1082 "N" gnus-summary-next-article
1083 "P" gnus-summary-prev-article
1084 "\M-\C-n" gnus-summary-next-same-subject
1085 "\M-\C-p" gnus-summary-prev-same-subject
1086 "\M-n" gnus-summary-next-unread-subject
1087 "\M-p" gnus-summary-prev-unread-subject
1088 "." gnus-summary-first-unread-article
1089 "," gnus-summary-best-unread-article
1090 "\M-s" gnus-summary-search-article-forward
1091 "\M-r" gnus-summary-search-article-backward
1092 "<" gnus-summary-beginning-of-article
1093 ">" gnus-summary-end-of-article
1094 "j" gnus-summary-goto-article
1095 "^" gnus-summary-refer-parent-article
1096 "\M-^" gnus-summary-refer-article
1097 "u" gnus-summary-tick-article-forward
1098 "!" gnus-summary-tick-article-forward
1099 "U" gnus-summary-tick-article-backward
1100 "d" gnus-summary-mark-as-read-forward
1101 "D" gnus-summary-mark-as-read-backward
1102 "E" gnus-summary-mark-as-expirable
1103 "\M-u" gnus-summary-clear-mark-forward
1104 "\M-U" gnus-summary-clear-mark-backward
1105 "k" gnus-summary-kill-same-subject-and-select
1106 "\C-k" gnus-summary-kill-same-subject
1107 "\M-\C-k" gnus-summary-kill-thread
1108 "\M-\C-l" gnus-summary-lower-thread
1109 "e" gnus-summary-edit-article
1110 "#" gnus-summary-mark-as-processable
1111 "\M-#" gnus-summary-unmark-as-processable
1112 "\M-\C-t" gnus-summary-toggle-threads
1113 "\M-\C-s" gnus-summary-show-thread
1114 "\M-\C-h" gnus-summary-hide-thread
1115 "\M-\C-f" gnus-summary-next-thread
1116 "\M-\C-b" gnus-summary-prev-thread
1117 "\M-\C-u" gnus-summary-up-thread
1118 "\M-\C-d" gnus-summary-down-thread
1119 "&" gnus-summary-execute-command
1120 "c" gnus-summary-catchup-and-exit
1121 "\C-w" gnus-summary-mark-region-as-read
1122 "\C-t" gnus-summary-toggle-truncation
1123 "?" gnus-summary-mark-as-dormant
1124 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1125 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1126 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1127 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1128 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1129 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1130 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1131 "=" gnus-summary-expand-window
1132 "\C-x\C-s" gnus-summary-reselect-current-group
1133 "\M-g" gnus-summary-rescan-group
1134 "w" gnus-summary-stop-page-breaking
1135 "\C-c\C-r" gnus-summary-caesar-message
1136 "\M-t" gnus-summary-toggle-mime
1137 "f" gnus-summary-followup
1138 "F" gnus-summary-followup-with-original
1139 "C" gnus-summary-cancel-article
1140 "r" gnus-summary-reply
1141 "R" gnus-summary-reply-with-original
1142 "\C-c\C-f" gnus-summary-mail-forward
1143 "o" gnus-summary-save-article
1144 "\C-o" gnus-summary-save-article-mail
1145 "|" gnus-summary-pipe-output
1146 "\M-k" gnus-summary-edit-local-kill
1147 "\M-K" gnus-summary-edit-global-kill
1149 "\C-c\C-d" gnus-summary-describe-group
1150 "q" gnus-summary-exit
1151 "Q" gnus-summary-exit-no-update
1152 "\C-c\C-i" gnus-info-find-node
1153 gnus-mouse-2 gnus-mouse-pick-article
1154 "m" gnus-summary-mail-other-window
1155 "a" gnus-summary-post-news
1156 "x" gnus-summary-limit-to-unread
1157 "s" gnus-summary-isearch-article
1158 "t" gnus-article-hide-headers
1159 "g" gnus-summary-show-article
1160 "l" gnus-summary-goto-last-article
1161 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1162 "\C-d" gnus-summary-enter-digest-group
1163 "\M-\C-d" gnus-summary-read-document
1165 "*" gnus-cache-enter-article
1166 "\M-*" gnus-cache-remove-article
1167 "\M-&" gnus-summary-universal-argument
1168 "\C-l" gnus-recenter
1169 "I" gnus-summary-increase-score
1170 "L" gnus-summary-lower-score
1172 "V" gnus-summary-score-map
1173 "X" gnus-uu-extract-map
1174 "S" gnus-summary-send-map)
1176 ;; Sort of orthogonal keymap
1177 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1178 "t" gnus-summary-tick-article-forward
1179 "!" gnus-summary-tick-article-forward
1180 "d" gnus-summary-mark-as-read-forward
1181 "r" gnus-summary-mark-as-read-forward
1182 "c" gnus-summary-clear-mark-forward
1183 " " gnus-summary-clear-mark-forward
1184 "e" gnus-summary-mark-as-expirable
1185 "x" gnus-summary-mark-as-expirable
1186 "?" gnus-summary-mark-as-dormant
1187 "b" gnus-summary-set-bookmark
1188 "B" gnus-summary-remove-bookmark
1189 "#" gnus-summary-mark-as-processable
1190 "\M-#" gnus-summary-unmark-as-processable
1191 "S" gnus-summary-limit-include-expunged
1192 "C" gnus-summary-catchup
1193 "H" gnus-summary-catchup-to-here
1194 "\C-c" gnus-summary-catchup-all
1195 "k" gnus-summary-kill-same-subject-and-select
1196 "K" gnus-summary-kill-same-subject
1197 "P" gnus-uu-mark-map)
1199 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1200 "c" gnus-summary-clear-above
1201 "u" gnus-summary-tick-above
1202 "m" gnus-summary-mark-above
1203 "k" gnus-summary-kill-below)
1205 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1206 "/" gnus-summary-limit-to-subject
1207 "n" gnus-summary-limit-to-articles
1208 "w" gnus-summary-pop-limit
1209 "s" gnus-summary-limit-to-subject
1210 "a" gnus-summary-limit-to-author
1211 "u" gnus-summary-limit-to-unread
1212 "m" gnus-summary-limit-to-marks
1213 "v" gnus-summary-limit-to-score
1214 "D" gnus-summary-limit-include-dormant
1215 "d" gnus-summary-limit-exclude-dormant
1216 "t" gnus-summary-limit-to-age
1217 "E" gnus-summary-limit-include-expunged
1218 "c" gnus-summary-limit-exclude-childless-dormant
1219 "C" gnus-summary-limit-mark-excluded-as-read)
1221 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1222 "n" gnus-summary-next-unread-article
1223 "p" gnus-summary-prev-unread-article
1224 "N" gnus-summary-next-article
1225 "P" gnus-summary-prev-article
1226 "\C-n" gnus-summary-next-same-subject
1227 "\C-p" gnus-summary-prev-same-subject
1228 "\M-n" gnus-summary-next-unread-subject
1229 "\M-p" gnus-summary-prev-unread-subject
1230 "f" gnus-summary-first-unread-article
1231 "b" gnus-summary-best-unread-article
1232 "j" gnus-summary-goto-article
1233 "g" gnus-summary-goto-subject
1234 "l" gnus-summary-goto-last-article
1235 "o" gnus-summary-pop-article)
1237 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1238 "k" gnus-summary-kill-thread
1239 "l" gnus-summary-lower-thread
1240 "i" gnus-summary-raise-thread
1241 "T" gnus-summary-toggle-threads
1242 "t" gnus-summary-rethread-current
1243 "^" gnus-summary-reparent-thread
1244 "s" gnus-summary-show-thread
1245 "S" gnus-summary-show-all-threads
1246 "h" gnus-summary-hide-thread
1247 "H" gnus-summary-hide-all-threads
1248 "n" gnus-summary-next-thread
1249 "p" gnus-summary-prev-thread
1250 "u" gnus-summary-up-thread
1251 "o" gnus-summary-top-thread
1252 "d" gnus-summary-down-thread
1253 "#" gnus-uu-mark-thread
1254 "\M-#" gnus-uu-unmark-thread)
1256 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1257 "g" gnus-summary-prepare
1258 "c" gnus-summary-insert-cached-articles)
1260 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1261 "c" gnus-summary-catchup-and-exit
1262 "C" gnus-summary-catchup-all-and-exit
1263 "E" gnus-summary-exit-no-update
1264 "Q" gnus-summary-exit
1265 "Z" gnus-summary-exit
1266 "n" gnus-summary-catchup-and-goto-next-group
1267 "R" gnus-summary-reselect-current-group
1268 "G" gnus-summary-rescan-group
1269 "N" gnus-summary-next-group
1270 "s" gnus-summary-save-newsrc
1271 "P" gnus-summary-prev-group)
1273 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1274 " " gnus-summary-next-page
1275 "n" gnus-summary-next-page
1276 "\177" gnus-summary-prev-page
1277 [delete] gnus-summary-prev-page
1278 "p" gnus-summary-prev-page
1279 "\r" gnus-summary-scroll-up
1280 "<" gnus-summary-beginning-of-article
1281 ">" gnus-summary-end-of-article
1282 "b" gnus-summary-beginning-of-article
1283 "e" gnus-summary-end-of-article
1284 "^" gnus-summary-refer-parent-article
1285 "r" gnus-summary-refer-parent-article
1286 "R" gnus-summary-refer-references
1287 "g" gnus-summary-show-article
1288 "s" gnus-summary-isearch-article
1289 "P" gnus-summary-print-article)
1291 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1292 "b" gnus-article-add-buttons
1293 "B" gnus-article-add-buttons-to-head
1294 "o" gnus-article-treat-overstrike
1295 "e" gnus-article-emphasize
1296 "w" gnus-article-fill-cited-article
1297 "c" gnus-article-remove-cr
1298 "q" gnus-article-de-quoted-unreadable
1299 "f" gnus-article-display-x-face
1300 "l" gnus-summary-stop-page-breaking
1301 "r" gnus-summary-caesar-message
1302 "t" gnus-article-hide-headers
1303 "v" gnus-summary-verbose-headers
1304 "m" gnus-summary-toggle-mime
1305 "h" gnus-article-treat-html)
1307 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1308 "a" gnus-article-hide
1309 "h" gnus-article-hide-headers
1310 "b" gnus-article-hide-boring-headers
1311 "s" gnus-article-hide-signature
1312 "c" gnus-article-hide-citation
1313 "p" gnus-article-hide-pgp
1314 "P" gnus-article-hide-pem
1315 "\C-c" gnus-article-hide-citation-maybe)
1317 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1318 "a" gnus-article-highlight
1319 "h" gnus-article-highlight-headers
1320 "c" gnus-article-highlight-citation
1321 "s" gnus-article-highlight-signature)
1323 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1324 "z" gnus-article-date-ut
1325 "u" gnus-article-date-ut
1326 "l" gnus-article-date-local
1327 "e" gnus-article-date-lapsed
1328 "o" gnus-article-date-original
1329 "s" gnus-article-date-user)
1331 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1332 "t" gnus-article-remove-trailing-blank-lines
1333 "l" gnus-article-strip-leading-blank-lines
1334 "m" gnus-article-strip-multiple-blank-lines
1335 "a" gnus-article-strip-blank-lines
1336 "s" gnus-article-strip-leading-space)
1338 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1340 "f" gnus-summary-fetch-faq
1341 "d" gnus-summary-describe-group
1342 "h" gnus-summary-describe-briefly
1343 "i" gnus-info-find-node)
1345 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1346 "e" gnus-summary-expire-articles
1347 "\M-\C-e" gnus-summary-expire-articles-now
1348 "\177" gnus-summary-delete-article
1349 [delete] gnus-summary-delete-article
1350 "m" gnus-summary-move-article
1351 "r" gnus-summary-respool-article
1352 "w" gnus-summary-edit-article
1353 "c" gnus-summary-copy-article
1354 "B" gnus-summary-crosspost-article
1355 "q" gnus-summary-respool-query
1356 "i" gnus-summary-import-article
1357 "p" gnus-summary-article-posted-p)
1359 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1360 "o" gnus-summary-save-article
1361 "m" gnus-summary-save-article-mail
1362 "F" gnus-summary-write-article-file
1363 "r" gnus-summary-save-article-rmail
1364 "f" gnus-summary-save-article-file
1365 "b" gnus-summary-save-article-body-file
1366 "h" gnus-summary-save-article-folder
1367 "v" gnus-summary-save-article-vm
1368 "p" gnus-summary-pipe-output
1369 "s" gnus-soup-add-article))
1371 (defun gnus-summary-make-menu-bar ()
1372 (gnus-turn-off-edit-menu 'summary)
1374 (unless (boundp 'gnus-summary-misc-menu)
1377 gnus-summary-kill-menu gnus-summary-mode-map ""
1382 ["Enter score..." gnus-summary-score-entry t]
1383 ["Customize" gnus-score-customize t])
1384 (gnus-make-score-map 'increase)
1385 (gnus-make-score-map 'lower)
1387 ["Kill below" gnus-summary-kill-below t]
1388 ["Mark above" gnus-summary-mark-above t]
1389 ["Tick above" gnus-summary-tick-above t]
1390 ["Clear above" gnus-summary-clear-above t])
1391 ["Current score" gnus-summary-current-score t]
1392 ["Set score" gnus-summary-set-score t]
1393 ["Switch current score file..." gnus-score-change-score-file t]
1394 ["Set mark below..." gnus-score-set-mark-below t]
1395 ["Set expunge below..." gnus-score-set-expunge-below t]
1396 ["Edit current score file" gnus-score-edit-current-scores t]
1397 ["Edit score file" gnus-score-edit-file t]
1398 ["Trace score" gnus-score-find-trace t]
1399 ["Find words" gnus-score-find-favourite-words t]
1400 ["Rescore buffer" gnus-summary-rescore t]
1401 ["Increase score..." gnus-summary-increase-score t]
1402 ["Lower score..." gnus-summary-lower-score t]))))
1405 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1407 :selected (null gnus-score-default-header)]
1408 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1410 :selected (eq gnus-score-default-header 'a)]
1411 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1413 :selected (eq gnus-score-default-header 's)]
1415 (gnus-score-set-default 'gnus-score-default-header 'b)
1417 :selected (eq gnus-score-default-header 'b )]
1419 (gnus-score-set-default 'gnus-score-default-header 'h)
1421 :selected (eq gnus-score-default-header 'h )]
1422 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1424 :selected (eq gnus-score-default-header 'i )]
1425 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1427 :selected (eq gnus-score-default-header 't )]
1429 (gnus-score-set-default 'gnus-score-default-header 'x)
1431 :selected (eq gnus-score-default-header 'x )]
1432 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1434 :selected (eq gnus-score-default-header 'l )]
1435 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1437 :selected (eq gnus-score-default-header 'd )]
1438 ["Followups to author"
1439 (gnus-score-set-default 'gnus-score-default-header 'f)
1441 :selected (eq gnus-score-default-header 'f )])
1443 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1445 :selected (null gnus-score-default-type)]
1446 ;; The `:active' key is commented out in the following,
1447 ;; because the GNU Emacs hack to support radio buttons use
1448 ;; active to indicate which button is selected.
1449 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1451 ;; :active (not (memq gnus-score-default-header '(l d)))
1452 :selected (eq gnus-score-default-type 's)]
1453 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1455 ;; :active (not (memq gnus-score-default-header '(l d)))
1456 :selected (eq gnus-score-default-type 'r)]
1457 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1459 ;; :active (not (memq gnus-score-default-header '(l d)))
1460 :selected (eq gnus-score-default-type 'e)]
1461 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1463 ;; :active (not (memq gnus-score-default-header '(l d)))
1464 :selected (eq gnus-score-default-type 'f)]
1465 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1467 ;; :active (eq (gnus-score-default-header 'd))
1468 :selected (eq gnus-score-default-type 'b)]
1469 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1471 ;; :active (eq (gnus-score-default-header 'd))
1472 :selected (eq gnus-score-default-type 'n)]
1473 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1475 ;; :active (eq (gnus-score-default-header 'd))
1476 :selected (eq gnus-score-default-type 'a)]
1478 (gnus-score-set-default 'gnus-score-default-type '<)
1480 ;; :active (eq (gnus-score-default-header 'l))
1481 :selected (eq gnus-score-default-type '<)]
1483 (gnus-score-set-default 'gnus-score-default-type '=)
1485 ;; :active (eq (gnus-score-default-header 'l))
1486 :selected (eq gnus-score-default-type '=)]
1487 ["Greater than number"
1488 (gnus-score-set-default 'gnus-score-default-type '>)
1490 ;; :active (eq (gnus-score-default-header 'l))
1491 :selected (eq gnus-score-default-type '>)])
1492 ["Default fold" gnus-score-default-fold-toggle
1494 :selected gnus-score-default-fold]
1496 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1498 :selected (null gnus-score-default-duration)]
1500 (gnus-score-set-default 'gnus-score-default-duration 'p)
1502 :selected (eq gnus-score-default-duration 'p)]
1504 (gnus-score-set-default 'gnus-score-default-duration 't)
1506 :selected (eq gnus-score-default-duration 't)]
1508 (gnus-score-set-default 'gnus-score-default-duration 'i)
1510 :selected (eq gnus-score-default-duration 'i)]))
1513 gnus-summary-article-menu gnus-summary-mode-map ""
1516 ["All" gnus-article-hide t]
1517 ["Headers" gnus-article-hide-headers t]
1518 ["Signature" gnus-article-hide-signature t]
1519 ["Citation" gnus-article-hide-citation t]
1520 ["PGP" gnus-article-hide-pgp t]
1521 ["Boring headers" gnus-article-hide-boring-headers t])
1523 ["All" gnus-article-highlight t]
1524 ["Headers" gnus-article-highlight-headers t]
1525 ["Signature" gnus-article-highlight-signature t]
1526 ["Citation" gnus-article-highlight-citation t])
1528 ["Local" gnus-article-date-local t]
1529 ["UT" gnus-article-date-ut t]
1530 ["Original" gnus-article-date-original t]
1531 ["Lapsed" gnus-article-date-lapsed t]
1532 ["User-defined" gnus-article-date-user t])
1535 ["Leading" gnus-article-strip-leading-blank-lines t]
1536 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1537 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1538 ["All of the above" gnus-article-strip-blank-lines t]
1539 ["Leading space" gnus-article-strip-leading-space t])
1540 ["Overstrike" gnus-article-treat-overstrike t]
1541 ["Emphasis" gnus-article-emphasize t]
1542 ["Word wrap" gnus-article-fill-cited-article t]
1543 ["CR" gnus-article-remove-cr t]
1544 ["Show X-Face" gnus-article-display-x-face t]
1545 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1546 ["UnHTMLize" gnus-article-treat-html t]
1547 ["Rot 13" gnus-summary-caesar-message t]
1548 ["Unix pipe" gnus-summary-pipe-message t]
1549 ["Add buttons" gnus-article-add-buttons t]
1550 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1551 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1552 ["Toggle MIME" gnus-summary-toggle-mime t]
1553 ["Verbose header" gnus-summary-verbose-headers t]
1554 ["Toggle header" gnus-summary-toggle-header t])
1556 ["Save in default format" gnus-summary-save-article t]
1557 ["Save in file" gnus-summary-save-article-file t]
1558 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1559 ["Write to file" gnus-summary-write-article-mail t]
1560 ["Save in MH folder" gnus-summary-save-article-folder t]
1561 ["Save in VM folder" gnus-summary-save-article-vm t]
1562 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1563 ["Save body in file" gnus-summary-save-article-body-file t]
1564 ["Pipe through a filter" gnus-summary-pipe-output t]
1565 ["Add to SOUP packet" gnus-soup-add-article t]
1566 ["Print" gnus-summary-print-article t])
1568 ["Respool article..." gnus-summary-respool-article t]
1569 ["Move article..." gnus-summary-move-article
1570 (gnus-check-backend-function
1571 'request-move-article gnus-newsgroup-name)]
1572 ["Copy article..." gnus-summary-copy-article t]
1573 ["Crosspost article..." gnus-summary-crosspost-article
1574 (gnus-check-backend-function
1575 'request-replace-article gnus-newsgroup-name)]
1576 ["Import file..." gnus-summary-import-article t]
1577 ["Check if posted" gnus-summary-article-posted-p t]
1578 ["Edit article" gnus-summary-edit-article
1579 (not (gnus-group-read-only-p))]
1580 ["Delete article" gnus-summary-delete-article
1581 (gnus-check-backend-function
1582 'request-expire-articles gnus-newsgroup-name)]
1583 ["Query respool" gnus-summary-respool-query t]
1584 ["Delete expirable articles" gnus-summary-expire-articles-now
1585 (gnus-check-backend-function
1586 'request-expire-articles gnus-newsgroup-name)])
1588 ["Uudecode" gnus-uu-decode-uu t]
1589 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1590 ["Unshar" gnus-uu-decode-unshar t]
1591 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1592 ["Save" gnus-uu-decode-save t]
1593 ["Binhex" gnus-uu-decode-binhex t]
1594 ["Postscript" gnus-uu-decode-postscript t])
1596 ["Enter article" gnus-cache-enter-article t]
1597 ["Remove article" gnus-cache-remove-article t])
1598 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1599 ["Isearch article..." gnus-summary-isearch-article t]
1600 ["Beginning of the article" gnus-summary-beginning-of-article t]
1601 ["End of the article" gnus-summary-end-of-article t]
1602 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1603 ["Fetch referenced articles" gnus-summary-refer-references t]
1604 ["Fetch article with id..." gnus-summary-refer-article t]
1605 ["Redisplay" gnus-summary-show-article t]))
1608 gnus-summary-thread-menu gnus-summary-mode-map ""
1610 ["Toggle threading" gnus-summary-toggle-threads t]
1611 ["Hide threads" gnus-summary-hide-all-threads t]
1612 ["Show threads" gnus-summary-show-all-threads t]
1613 ["Hide thread" gnus-summary-hide-thread t]
1614 ["Show thread" gnus-summary-show-thread t]
1615 ["Go to next thread" gnus-summary-next-thread t]
1616 ["Go to previous thread" gnus-summary-prev-thread t]
1617 ["Go down thread" gnus-summary-down-thread t]
1618 ["Go up thread" gnus-summary-up-thread t]
1619 ["Top of thread" gnus-summary-top-thread t]
1620 ["Mark thread as read" gnus-summary-kill-thread t]
1621 ["Lower thread score" gnus-summary-lower-thread t]
1622 ["Raise thread score" gnus-summary-raise-thread t]
1623 ["Rethread current" gnus-summary-rethread-current t]
1627 gnus-summary-post-menu gnus-summary-mode-map ""
1629 ["Post an article" gnus-summary-post-news t]
1630 ["Followup" gnus-summary-followup t]
1631 ["Followup and yank" gnus-summary-followup-with-original t]
1632 ["Supersede article" gnus-summary-supersede-article t]
1633 ["Cancel article" gnus-summary-cancel-article t]
1634 ["Reply" gnus-summary-reply t]
1635 ["Reply and yank" gnus-summary-reply-with-original t]
1636 ["Wide reply" gnus-summary-wide-reply t]
1637 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1638 ["Mail forward" gnus-summary-mail-forward t]
1639 ["Post forward" gnus-summary-post-forward t]
1640 ["Digest and mail" gnus-uu-digest-mail-forward t]
1641 ["Digest and post" gnus-uu-digest-post-forward t]
1642 ["Resend message" gnus-summary-resend-message t]
1643 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1644 ["Send a mail" gnus-summary-mail-other-window t]
1645 ["Uuencode and post" gnus-uu-post-news t]
1646 ["Followup via news" gnus-summary-followup-to-mail t]
1647 ["Followup via news and yank"
1648 gnus-summary-followup-to-mail-with-original t]
1650 ;;["Send" gnus-summary-send-draft t]
1651 ;;["Send bounced" gnus-resend-bounced-mail t])
1655 gnus-summary-misc-menu gnus-summary-mode-map ""
1658 ["Mark as read" gnus-summary-mark-as-read-forward t]
1659 ["Mark same subject and select"
1660 gnus-summary-kill-same-subject-and-select t]
1661 ["Mark same subject" gnus-summary-kill-same-subject t]
1662 ["Catchup" gnus-summary-catchup t]
1663 ["Catchup all" gnus-summary-catchup-all t]
1664 ["Catchup to here" gnus-summary-catchup-to-here t]
1665 ["Catchup region" gnus-summary-mark-region-as-read t]
1666 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1668 ["Tick" gnus-summary-tick-article-forward t]
1669 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1670 ["Remove marks" gnus-summary-clear-mark-forward t]
1671 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1672 ["Set bookmark" gnus-summary-set-bookmark t]
1673 ["Remove bookmark" gnus-summary-remove-bookmark t])
1675 ["Marks..." gnus-summary-limit-to-marks t]
1676 ["Subject..." gnus-summary-limit-to-subject t]
1677 ["Author..." gnus-summary-limit-to-author t]
1678 ["Age..." gnus-summary-limit-to-age t]
1679 ["Score" gnus-summary-limit-to-score t]
1680 ["Unread" gnus-summary-limit-to-unread t]
1681 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1682 ["Articles" gnus-summary-limit-to-articles t]
1683 ["Pop limit" gnus-summary-pop-limit t]
1684 ["Show dormant" gnus-summary-limit-include-dormant t]
1685 ["Hide childless dormant"
1686 gnus-summary-limit-exclude-childless-dormant t]
1687 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1688 ["Show expunged" gnus-summary-show-all-expunged t])
1690 ["Set mark" gnus-summary-mark-as-processable t]
1691 ["Remove mark" gnus-summary-unmark-as-processable t]
1692 ["Remove all marks" gnus-summary-unmark-all-processable t]
1693 ["Mark above" gnus-uu-mark-over t]
1694 ["Mark series" gnus-uu-mark-series t]
1695 ["Mark region" gnus-uu-mark-region t]
1696 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1697 ["Mark all" gnus-uu-mark-all t]
1698 ["Mark buffer" gnus-uu-mark-buffer t]
1699 ["Mark sparse" gnus-uu-mark-sparse t]
1700 ["Mark thread" gnus-uu-mark-thread t]
1701 ["Unmark thread" gnus-uu-unmark-thread t]
1702 ("Process Mark Sets"
1703 ["Kill" gnus-summary-kill-process-mark t]
1704 ["Yank" gnus-summary-yank-process-mark
1705 gnus-newsgroup-process-stack]
1706 ["Save" gnus-summary-save-process-mark t]))
1708 ["Page forward" gnus-summary-next-page t]
1709 ["Page backward" gnus-summary-prev-page t]
1710 ["Line forward" gnus-summary-scroll-up t])
1712 ["Next unread article" gnus-summary-next-unread-article t]
1713 ["Previous unread article" gnus-summary-prev-unread-article t]
1714 ["Next article" gnus-summary-next-article t]
1715 ["Previous article" gnus-summary-prev-article t]
1716 ["Next unread subject" gnus-summary-next-unread-subject t]
1717 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1718 ["Next article same subject" gnus-summary-next-same-subject t]
1719 ["Previous article same subject" gnus-summary-prev-same-subject t]
1720 ["First unread article" gnus-summary-first-unread-article t]
1721 ["Best unread article" gnus-summary-best-unread-article t]
1722 ["Go to subject number..." gnus-summary-goto-subject t]
1723 ["Go to article number..." gnus-summary-goto-article t]
1724 ["Go to the last article" gnus-summary-goto-last-article t]
1725 ["Pop article off history" gnus-summary-pop-article t])
1727 ["Sort by number" gnus-summary-sort-by-number t]
1728 ["Sort by author" gnus-summary-sort-by-author t]
1729 ["Sort by subject" gnus-summary-sort-by-subject t]
1730 ["Sort by date" gnus-summary-sort-by-date t]
1731 ["Sort by score" gnus-summary-sort-by-score t]
1732 ["Sort by lines" gnus-summary-sort-by-lines t])
1734 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1735 ["Describe group" gnus-summary-describe-group t]
1736 ["Read manual" gnus-info-find-node t])
1738 ["Pick and read" gnus-pick-mode t]
1739 ["Binary" gnus-binary-mode t])
1741 ["Regenerate" gnus-summary-prepare t]
1742 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1743 ["Toggle threading" gnus-summary-toggle-threads t])
1744 ["Filter articles..." gnus-summary-execute-command t]
1745 ["Run command on subjects..." gnus-summary-universal-argument t]
1746 ["Search articles forward..." gnus-summary-search-article-forward t]
1747 ["Search articles backward..." gnus-summary-search-article-backward t]
1748 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1749 ["Expand window" gnus-summary-expand-window t]
1750 ["Expire expirable articles" gnus-summary-expire-articles
1751 (gnus-check-backend-function
1752 'request-expire-articles gnus-newsgroup-name)]
1753 ["Edit local kill file" gnus-summary-edit-local-kill t]
1754 ["Edit main kill file" gnus-summary-edit-global-kill t]
1756 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1757 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1758 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1759 ["Exit group" gnus-summary-exit t]
1760 ["Exit group without updating" gnus-summary-exit-no-update t]
1761 ["Exit and goto next group" gnus-summary-next-group t]
1762 ["Exit and goto prev group" gnus-summary-prev-group t]
1763 ["Reselect group" gnus-summary-reselect-current-group t]
1764 ["Rescan group" gnus-summary-rescan-group t]
1765 ["Update dribble" gnus-summary-save-newsrc t])))
1767 (run-hooks 'gnus-summary-menu-hook)))
1769 (defun gnus-score-set-default (var value)
1770 "A version of set that updates the GNU Emacs menu-bar."
1772 ;; It is the message that forces the active status to be updated.
1775 (defun gnus-make-score-map (type)
1776 "Make a summary score map of type TYPE."
1779 (let ((headers '(("author" "from" string)
1780 ("subject" "subject" string)
1781 ("article body" "body" string)
1782 ("article head" "head" string)
1783 ("xref" "xref" string)
1784 ("lines" "lines" number)
1785 ("followups to author" "followup" string)))
1786 (types '((number ("less than" <)
1789 (string ("substring" s)
1793 (perms '(("temporary" (current-time-string))
1801 (if (eq type 'lower)
1806 (setq header (car headers))
1812 (let ((ts (cdr (assoc (nth 2 header) types)))
1828 'gnus-summary-score-entry
1830 (if (or (string= (nth 1 header)
1832 (string= (nth 1 header)
1835 (list 'gnus-summary-header
1837 (list 'quote (nth 1 (car ts)))
1838 (list 'gnus-score-default nil)
1844 (list (nreverse outp))))
1847 (list (nreverse outt))))
1849 (setq headers (cdr headers)))
1850 (list (nreverse outh))))))))
1854 (defun gnus-summary-mode (&optional group)
1855 "Major mode for reading articles.
1857 All normal editing commands are switched off.
1858 \\<gnus-summary-mode-map>
1859 Each line in this buffer represents one article. To read an
1860 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1861 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1864 You can also post articles and send mail from this buffer. To
1865 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1866 of an article, type `\\[gnus-summary-reply]'.
1868 There are approx. one gazillion commands you can execute in this
1869 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1871 The following commands are available:
1873 \\{gnus-summary-mode-map}"
1875 (when (gnus-visual-p 'summary-menu 'menu)
1876 (gnus-summary-make-menu-bar))
1877 (kill-all-local-variables)
1878 (gnus-summary-make-local-variables)
1879 (gnus-make-thread-indent-array)
1880 (gnus-simplify-mode-line)
1881 (setq major-mode 'gnus-summary-mode)
1882 (setq mode-name "Summary")
1883 (make-local-variable 'minor-mode-alist)
1884 (use-local-map gnus-summary-mode-map)
1885 (buffer-disable-undo (current-buffer))
1886 (setq buffer-read-only t) ;Disable modification
1887 (setq truncate-lines t)
1888 (setq selective-display t)
1889 (setq selective-display-ellipses t) ;Display `...'
1890 (gnus-summary-set-display-table)
1891 (gnus-set-default-directory)
1892 (setq gnus-newsgroup-name group)
1893 (make-local-variable 'gnus-summary-line-format)
1894 (make-local-variable 'gnus-summary-line-format-spec)
1895 (make-local-variable 'gnus-summary-mark-positions)
1896 (make-local-hook 'post-command-hook)
1897 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1898 (run-hooks 'gnus-summary-mode-hook)
1899 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1900 (gnus-update-summary-mark-positions))
1902 (defun gnus-summary-make-local-variables ()
1903 "Make all the local summary buffer variables."
1904 (let ((locals gnus-summary-local-variables)
1906 (while (setq local (pop locals))
1909 (if (eq (cdr local) 'global)
1910 ;; Copy the global value of the variable.
1911 (setq global (symbol-value (car local)))
1912 ;; Use the value from the list.
1913 (setq global (eval (cdr local))))
1914 (make-local-variable (car local))
1915 (set (car local) global))
1916 ;; Simple nil-valued local variable.
1917 (make-local-variable local)
1920 (defun gnus-summary-clear-local-variables ()
1921 (let ((locals gnus-summary-local-variables))
1923 (if (consp (car locals))
1924 (and (vectorp (caar locals))
1925 (set (caar locals) nil))
1926 (and (vectorp (car locals))
1927 (set (car locals) nil)))
1928 (setq locals (cdr locals)))))
1930 ;; Summary data functions.
1932 (defmacro gnus-data-number (data)
1935 (defmacro gnus-data-set-number (data number)
1936 `(setcar ,data ,number))
1938 (defmacro gnus-data-mark (data)
1941 (defmacro gnus-data-set-mark (data mark)
1942 `(setcar (nthcdr 1 ,data) ,mark))
1944 (defmacro gnus-data-pos (data)
1947 (defmacro gnus-data-set-pos (data pos)
1948 `(setcar (nthcdr 2 ,data) ,pos))
1950 (defmacro gnus-data-header (data)
1953 (defmacro gnus-data-set-header (data header)
1954 `(setf (nth 3 ,data) ,header))
1956 (defmacro gnus-data-level (data)
1959 (defmacro gnus-data-unread-p (data)
1960 `(= (nth 1 ,data) gnus-unread-mark))
1962 (defmacro gnus-data-read-p (data)
1963 `(/= (nth 1 ,data) gnus-unread-mark))
1965 (defmacro gnus-data-pseudo-p (data)
1966 `(consp (nth 3 ,data)))
1968 (defmacro gnus-data-find (number)
1969 `(assq ,number gnus-newsgroup-data))
1971 (defmacro gnus-data-find-list (number &optional data)
1972 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1973 (memq (assq ,number bdata)
1976 (defmacro gnus-data-make (number mark pos header level)
1977 `(list ,number ,mark ,pos ,header ,level))
1979 (defun gnus-data-enter (after-article number mark pos header level offset)
1980 (let ((data (gnus-data-find-list after-article)))
1982 (error "No such article: %d" after-article))
1983 (setcdr data (cons (gnus-data-make number mark pos header level)
1985 (setq gnus-newsgroup-data-reverse nil)
1986 (gnus-data-update-list (cddr data) offset)))
1988 (defun gnus-data-enter-list (after-article list &optional offset)
1990 (let ((data (and after-article (gnus-data-find-list after-article)))
1992 (or data (not after-article) (error "No such article: %d" after-article))
1993 ;; Find the last element in the list to be spliced into the main
1996 (setq list (cdr list)))
1999 (setcdr list gnus-newsgroup-data)
2000 (setq gnus-newsgroup-data ilist)
2002 (gnus-data-update-list (cdr list) offset)))
2003 (setcdr list (cdr data))
2006 (gnus-data-update-list (cdr list) offset)))
2007 (setq gnus-newsgroup-data-reverse nil))))
2009 (defun gnus-data-remove (article &optional offset)
2010 (let ((data gnus-newsgroup-data))
2011 (if (= (gnus-data-number (car data)) article)
2013 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2014 gnus-newsgroup-data-reverse nil)
2016 (gnus-data-update-list gnus-newsgroup-data offset)))
2018 (when (= (gnus-data-number (cadr data)) article)
2019 (setcdr data (cddr data))
2021 (gnus-data-update-list (cdr data) offset))
2023 gnus-newsgroup-data-reverse nil))
2024 (setq data (cdr data))))))
2026 (defmacro gnus-data-list (backward)
2028 (or gnus-newsgroup-data-reverse
2029 (setq gnus-newsgroup-data-reverse
2030 (reverse gnus-newsgroup-data)))
2031 gnus-newsgroup-data))
2033 (defun gnus-data-update-list (data offset)
2034 "Add OFFSET to the POS of all data entries in DATA."
2036 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2037 (setq data (cdr data))))
2039 (defun gnus-data-compute-positions ()
2040 "Compute the positions of all articles."
2041 (let ((data gnus-newsgroup-data)
2044 (when (setq pos (text-property-any
2045 (point-min) (point-max)
2046 'gnus-number (gnus-data-number (car data))))
2047 (gnus-data-set-pos (car data) (+ pos 3)))
2048 (setq data (cdr data)))))
2050 (defun gnus-summary-article-pseudo-p (article)
2051 "Say whether this article is a pseudo article or not."
2052 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2054 (defmacro gnus-summary-article-sparse-p (article)
2055 "Say whether this article is a sparse article or not."
2056 `(memq ,article gnus-newsgroup-sparse))
2058 (defmacro gnus-summary-article-ancient-p (article)
2059 "Say whether this article is a sparse article or not."
2060 `(memq ,article gnus-newsgroup-ancient))
2062 (defun gnus-article-parent-p (number)
2063 "Say whether this article is a parent or not."
2064 (let ((data (gnus-data-find-list number)))
2065 (and (cdr data) ; There has to be an article after...
2066 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2067 (gnus-data-level (nth 1 data))))))
2069 (defun gnus-article-children (number)
2070 "Return a list of all children to NUMBER."
2071 (let* ((data (gnus-data-find-list number))
2072 (level (gnus-data-level (car data)))
2074 (setq data (cdr data))
2076 (= (gnus-data-level (car data)) (1+ level)))
2077 (push (gnus-data-number (car data)) children)
2078 (setq data (cdr data)))
2081 (defmacro gnus-summary-skip-intangible ()
2082 "If the current article is intangible, then jump to a different article."
2083 '(let ((to (get-text-property (point) 'gnus-intangible)))
2084 (and to (gnus-summary-goto-subject to))))
2086 (defmacro gnus-summary-article-intangible-p ()
2087 "Say whether this article is intangible or not."
2088 '(get-text-property (point) 'gnus-intangible))
2090 (defun gnus-article-read-p (article)
2091 "Say whether ARTICLE is read or not."
2092 (not (or (memq article gnus-newsgroup-marked)
2093 (memq article gnus-newsgroup-unreads)
2094 (memq article gnus-newsgroup-unselected)
2095 (memq article gnus-newsgroup-dormant))))
2097 ;; Some summary mode macros.
2099 (defmacro gnus-summary-article-number ()
2100 "The article number of the article on the current line.
2101 If there isn's an article number here, then we return the current
2104 (gnus-summary-skip-intangible)
2105 (or (get-text-property (point) 'gnus-number)
2106 (gnus-summary-last-subject))))
2108 (defmacro gnus-summary-article-header (&optional number)
2109 `(gnus-data-header (gnus-data-find
2110 ,(or number '(gnus-summary-article-number)))))
2112 (defmacro gnus-summary-thread-level (&optional number)
2113 `(if (and (eq gnus-summary-make-false-root 'dummy)
2114 (get-text-property (point) 'gnus-intangible))
2116 (gnus-data-level (gnus-data-find
2117 ,(or number '(gnus-summary-article-number))))))
2119 (defmacro gnus-summary-article-mark (&optional number)
2120 `(gnus-data-mark (gnus-data-find
2121 ,(or number '(gnus-summary-article-number)))))
2123 (defmacro gnus-summary-article-pos (&optional number)
2124 `(gnus-data-pos (gnus-data-find
2125 ,(or number '(gnus-summary-article-number)))))
2127 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2128 (defmacro gnus-summary-article-subject (&optional number)
2129 "Return current subject string or nil if nothing."
2132 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2133 '(gnus-data-header (assq (gnus-summary-article-number)
2134 gnus-newsgroup-data)))))
2137 (mail-header-subject headers))))
2139 (defmacro gnus-summary-article-score (&optional number)
2140 "Return current article score."
2141 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2142 gnus-newsgroup-scored))
2143 gnus-summary-default-score 0))
2145 (defun gnus-summary-article-children (&optional number)
2146 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2147 (level (gnus-data-level (car data)))
2149 (while (and (setq data (cdr data))
2150 (> (setq l (gnus-data-level (car data))) level))
2151 (and (= (1+ level) l)
2152 (push (gnus-data-number (car data))
2154 (nreverse children)))
2156 (defun gnus-summary-article-parent (&optional number)
2157 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2158 (gnus-data-list t)))
2159 (level (gnus-data-level (car data))))
2161 () ; This is a root.
2162 ;; We search until we find an article with a level less than
2163 ;; this one. That function has to be the parent.
2164 (while (and (setq data (cdr data))
2165 (not (< (gnus-data-level (car data)) level))))
2166 (and data (gnus-data-number (car data))))))
2168 (defun gnus-unread-mark-p (mark)
2169 "Say whether MARK is the unread mark."
2170 (= mark gnus-unread-mark))
2172 (defun gnus-read-mark-p (mark)
2173 "Say whether MARK is one of the marks that mark as read.
2174 This is all marks except unread, ticked, dormant, and expirable."
2175 (not (or (= mark gnus-unread-mark)
2176 (= mark gnus-ticked-mark)
2177 (= mark gnus-dormant-mark)
2178 (= mark gnus-expirable-mark))))
2180 (defmacro gnus-article-mark (number)
2182 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2183 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2184 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2185 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2186 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2187 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2188 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2189 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2190 gnus-ancient-mark))))
2192 ;; Saving hidden threads.
2194 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2195 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2197 (defmacro gnus-save-hidden-threads (&rest forms)
2198 "Save hidden threads, eval FORMS, and restore the hidden threads."
2199 (let ((config (make-symbol "config")))
2200 `(let ((,config (gnus-hidden-threads-configuration)))
2204 (gnus-restore-hidden-threads-configuration ,config)))))
2206 (defun gnus-hidden-threads-configuration ()
2207 "Return the current hidden threads configuration."
2210 (goto-char (point-min))
2211 (while (search-forward "\r" nil t)
2212 (push (1- (point)) config))
2215 (defun gnus-restore-hidden-threads-configuration (config)
2216 "Restore hidden threads configuration from CONFIG."
2217 (let (point buffer-read-only)
2218 (while (setq point (pop config))
2219 (when (and (< point (point-max))
2221 (= (following-char) ?\n))
2222 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2224 ;; Various summary mode internalish functions.
2226 (defun gnus-mouse-pick-article (e)
2229 (gnus-summary-next-page nil t))
2231 (defun gnus-summary-set-display-table ()
2232 ;; Change the display table. Odd characters have a tendency to mess
2233 ;; up nicely formatted displays - we make all possible glyphs
2234 ;; display only a single character.
2236 ;; We start from the standard display table, if any.
2237 (let ((table (or (copy-sequence standard-display-table)
2238 (make-display-table)))
2240 ;; Nix out all the control chars...
2241 (while (>= (setq i (1- i)) 0)
2242 (aset table i [??]))
2243 ;; ... but not newline and cr, of course. (cr is necessary for the
2244 ;; selective display).
2245 (aset table ?\n nil)
2246 (aset table ?\r nil)
2247 ;; We nix out any glyphs over 126 that are not set already.
2249 (while (>= (setq i (1- i)) 127)
2250 ;; Only modify if the entry is nil.
2251 (unless (aref table i)
2252 (aset table i [??]))))
2253 (setq buffer-display-table table)))
2255 (defun gnus-summary-setup-buffer (group)
2256 "Initialize summary buffer."
2257 (let ((buffer (concat "*Summary " group "*")))
2258 (if (get-buffer buffer)
2261 (setq gnus-summary-buffer (current-buffer))
2262 (not gnus-newsgroup-prepared))
2263 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2264 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2265 (gnus-add-current-to-buffer-list)
2266 (gnus-summary-mode group)
2268 (gnus-carpal-setup-buffer 'summary))
2269 (unless gnus-single-article-buffer
2270 (make-local-variable 'gnus-article-buffer)
2271 (make-local-variable 'gnus-article-current)
2272 (make-local-variable 'gnus-original-article-buffer))
2273 (setq gnus-newsgroup-name group)
2276 (defun gnus-set-global-variables ()
2277 ;; Set the global equivalents of the summary buffer-local variables
2278 ;; to the latest values they had. These reflect the summary buffer
2279 ;; that was in action when the last article was fetched.
2280 (when (eq major-mode 'gnus-summary-mode)
2281 (setq gnus-summary-buffer (current-buffer))
2282 (let ((name gnus-newsgroup-name)
2283 (marked gnus-newsgroup-marked)
2284 (unread gnus-newsgroup-unreads)
2285 (headers gnus-current-headers)
2286 (data gnus-newsgroup-data)
2287 (summary gnus-summary-buffer)
2288 (article-buffer gnus-article-buffer)
2289 (original gnus-original-article-buffer)
2290 (gac gnus-article-current)
2291 (reffed gnus-reffed-article-number)
2292 (score-file gnus-current-score-file))
2294 (set-buffer gnus-group-buffer)
2295 (setq gnus-newsgroup-name name)
2296 (setq gnus-newsgroup-marked marked)
2297 (setq gnus-newsgroup-unreads unread)
2298 (setq gnus-current-headers headers)
2299 (setq gnus-newsgroup-data data)
2300 (setq gnus-article-current gac)
2301 (setq gnus-summary-buffer summary)
2302 (setq gnus-article-buffer article-buffer)
2303 (setq gnus-original-article-buffer original)
2304 (setq gnus-reffed-article-number reffed)
2305 (setq gnus-current-score-file score-file)
2306 ;; The article buffer also has local variables.
2307 (when (gnus-buffer-live-p gnus-article-buffer)
2308 (set-buffer gnus-article-buffer)
2309 (setq gnus-summary-buffer summary))))))
2311 (defun gnus-summary-article-unread-p (article)
2312 "Say whether ARTICLE is unread or not."
2313 (memq article gnus-newsgroup-unreads))
2315 (defun gnus-summary-first-article-p (&optional article)
2316 "Return whether ARTICLE is the first article in the buffer."
2317 (if (not (setq article (or article (gnus-summary-article-number))))
2319 (eq article (caar gnus-newsgroup-data))))
2321 (defun gnus-summary-last-article-p (&optional article)
2322 "Return whether ARTICLE is the last article in the buffer."
2323 (if (not (setq article (or article (gnus-summary-article-number))))
2324 t ; All non-existent numbers are the last article. :-)
2325 (not (cdr (gnus-data-find-list article)))))
2327 (defun gnus-make-thread-indent-array ()
2329 (unless (and gnus-thread-indent-array
2330 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2331 (setq gnus-thread-indent-array (make-vector 201 "")
2332 gnus-thread-indent-array-level gnus-thread-indent-level)
2334 (aset gnus-thread-indent-array n
2335 (make-string (* n gnus-thread-indent-level) ? ))
2338 (defun gnus-update-summary-mark-positions ()
2339 "Compute where the summary marks are to go."
2341 (when (and gnus-summary-buffer
2342 (get-buffer gnus-summary-buffer)
2343 (buffer-name (get-buffer gnus-summary-buffer)))
2344 (set-buffer gnus-summary-buffer))
2345 (let ((gnus-replied-mark 129)
2346 (gnus-score-below-mark 130)
2347 (gnus-score-over-mark 130)
2348 (gnus-download-mark 131)
2349 (spec gnus-summary-line-format-spec)
2350 thread gnus-visual pos)
2352 (gnus-set-work-buffer)
2353 (let ((gnus-summary-line-format-spec spec)
2354 (gnus-newsgroup-downloadable '((0 . t))))
2355 (gnus-summary-insert-line
2356 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2357 (goto-char (point-min))
2358 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2360 (goto-char (point-min))
2361 (push (cons 'replied (and (search-forward "\201" nil t)
2364 (goto-char (point-min))
2365 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2367 (goto-char (point-min))
2368 (push (cons 'download
2369 (and (search-forward "\203" nil t) (- (point) 2)))
2371 (setq gnus-summary-mark-positions pos))))
2373 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2374 "Insert a dummy root in the summary buffer."
2376 (gnus-add-text-properties
2377 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2378 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2380 (defun gnus-summary-insert-line (gnus-tmp-header
2381 gnus-tmp-level gnus-tmp-current
2382 gnus-tmp-unread gnus-tmp-replied
2383 gnus-tmp-expirable gnus-tmp-subject-or-nil
2384 &optional gnus-tmp-dummy gnus-tmp-score
2386 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2387 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2388 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2389 (gnus-tmp-score-char
2390 (if (or (null gnus-summary-default-score)
2391 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2392 gnus-summary-zcore-fuzz))
2394 (if (< gnus-tmp-score gnus-summary-default-score)
2395 gnus-score-below-mark gnus-score-over-mark)))
2397 (cond (gnus-tmp-process gnus-process-mark)
2398 ((memq gnus-tmp-current gnus-newsgroup-cached)
2400 (gnus-tmp-replied gnus-replied-mark)
2401 ((memq gnus-tmp-current gnus-newsgroup-saved)
2403 (t gnus-unread-mark)))
2404 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2407 ((string-match "<[^>]+> *$" gnus-tmp-from)
2408 (let ((beg (match-beginning 0)))
2409 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2410 (substring gnus-tmp-from (1+ (match-beginning 0))
2411 (1- (match-end 0))))
2412 (substring gnus-tmp-from 0 beg))))
2413 ((string-match "(.+)" gnus-tmp-from)
2414 (substring gnus-tmp-from
2415 (1+ (match-beginning 0)) (1- (match-end 0))))
2417 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2418 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2419 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2420 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2421 (buffer-read-only nil))
2422 (when (string= gnus-tmp-name "")
2423 (setq gnus-tmp-name gnus-tmp-from))
2424 (unless (numberp gnus-tmp-lines)
2425 (setq gnus-tmp-lines 0))
2426 (gnus-put-text-property
2428 (progn (eval gnus-summary-line-format-spec) (point))
2429 'gnus-number gnus-tmp-number)
2430 (when (gnus-visual-p 'summary-highlight 'highlight)
2432 (run-hooks 'gnus-summary-update-hook)
2435 (defun gnus-summary-update-line (&optional dont-update)
2436 ;; Update summary line after change.
2437 (when (and gnus-summary-default-score
2438 (not gnus-summary-inhibit-highlight))
2439 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2440 (article (gnus-summary-article-number))
2441 (score (gnus-summary-article-score article)))
2443 (if (and gnus-summary-mark-below
2444 (< (gnus-summary-article-score)
2445 gnus-summary-mark-below))
2446 ;; This article has a low score, so we mark it as read.
2447 (when (memq article gnus-newsgroup-unreads)
2448 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2449 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2450 ;; This article was previously marked as read on account
2451 ;; of a low score, but now it has risen, so we mark it as
2453 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2454 (gnus-summary-update-mark
2455 (if (or (null gnus-summary-default-score)
2456 (<= (abs (- score gnus-summary-default-score))
2457 gnus-summary-zcore-fuzz))
2459 (if (< score gnus-summary-default-score)
2460 gnus-score-below-mark gnus-score-over-mark))
2462 ;; Do visual highlighting.
2463 (when (gnus-visual-p 'summary-highlight 'highlight)
2464 (run-hooks 'gnus-summary-update-hook)))))
2466 (defvar gnus-tmp-new-adopts nil)
2468 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2469 "Return the number of articles in THREAD.
2470 This may be 0 in some cases -- if none of the articles in
2471 the thread are to be displayed."
2473 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2475 ((not (listp thread))
2477 ((and (consp thread) (cdr thread))
2480 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2483 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2486 (when (and level (zerop level) gnus-tmp-new-adopts)
2489 'gnus-summary-number-of-articles-in-thread
2490 gnus-tmp-new-adopts))))
2492 (if (> number 1) gnus-not-empty-thread-mark
2493 gnus-empty-thread-mark)
2496 (defun gnus-summary-set-local-parameters (group)
2497 "Go through the local params of GROUP and set all variable specs in that list."
2498 (let ((params (gnus-group-find-parameter group))
2501 (setq elem (car params)
2502 params (cdr params))
2503 (and (consp elem) ; Has to be a cons.
2504 (consp (cdr elem)) ; The cdr has to be a list.
2505 (symbolp (car elem)) ; Has to be a symbol in there.
2506 (not (memq (car elem)
2507 '(quit-config to-address to-list to-group)))
2508 (ignore-errors ; So we set it.
2509 (make-local-variable (car elem))
2510 (set (car elem) (eval (nth 1 elem))))))))
2512 (defun gnus-summary-read-group (group &optional show-all no-article
2513 kill-buffer no-display)
2514 "Start reading news in newsgroup GROUP.
2515 If SHOW-ALL is non-nil, already read articles are also listed.
2516 If NO-ARTICLE is non-nil, no article is selected initially.
2517 If NO-DISPLAY, don't generate a summary buffer."
2521 (let ((gnus-auto-select-next nil))
2522 (gnus-summary-read-group-1
2523 group show-all no-article
2524 kill-buffer no-display))))
2525 (eq gnus-auto-select-next 'quietly))
2526 (set-buffer gnus-group-buffer)
2527 (if (not (equal group (gnus-group-group-name)))
2528 (setq group (gnus-group-group-name))
2532 (defun gnus-summary-read-group-1 (group show-all no-article
2533 kill-buffer no-display)
2534 ;; Killed foreign groups can't be entered.
2535 (when (and (not (gnus-group-native-p group))
2536 (not (gnus-gethash group gnus-newsrc-hashtb)))
2537 (error "Dead non-native groups can't be entered"))
2538 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2539 (let* ((new-group (gnus-summary-setup-buffer group))
2540 (quit-config (gnus-group-quit-config group))
2541 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2543 ;; This summary buffer exists already, so we just select it.
2545 (gnus-set-global-variables)
2547 (gnus-kill-or-deaden-summary kill-buffer))
2548 (gnus-configure-windows 'summary 'force)
2549 (gnus-set-mode-line 'summary)
2550 (gnus-summary-position-point)
2553 ;; We couldn't select this group.
2555 (when (and (eq major-mode 'gnus-summary-mode)
2556 (not (equal (current-buffer) kill-buffer)))
2557 (kill-buffer (current-buffer))
2558 (if (not quit-config)
2560 (set-buffer gnus-group-buffer)
2561 (gnus-group-jump-to-group group)
2562 (gnus-group-next-unread-group 1))
2563 (gnus-handle-ephemeral-exit quit-config)))
2564 (gnus-message 3 "Can't select group")
2566 ;; The user did a `C-g' while prompting for number of articles,
2567 ;; so we exit this group.
2568 ((eq did-select 'quit)
2569 (and (eq major-mode 'gnus-summary-mode)
2570 (not (equal (current-buffer) kill-buffer))
2571 (kill-buffer (current-buffer)))
2573 (gnus-kill-or-deaden-summary kill-buffer))
2574 (if (not quit-config)
2576 (set-buffer gnus-group-buffer)
2577 (gnus-group-jump-to-group group)
2578 (gnus-group-next-unread-group 1)
2579 (gnus-configure-windows 'group 'force))
2580 (gnus-handle-ephemeral-exit quit-config))
2581 ;; Finally signal the quit.
2583 ;; The group was successfully selected.
2585 (gnus-set-global-variables)
2586 ;; Save the active value in effect when the group was entered.
2587 (setq gnus-newsgroup-active
2589 (gnus-active gnus-newsgroup-name)))
2590 ;; You can change the summary buffer in some way with this hook.
2591 (run-hooks 'gnus-select-group-hook)
2592 ;; Set any local variables in the group parameters.
2593 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2594 (gnus-update-format-specifications
2595 nil 'summary 'summary-mode 'summary-dummy)
2596 ;; Do score processing.
2597 (when gnus-use-scoring
2598 (gnus-possibly-score-headers))
2599 ;; Check whether to fill in the gaps in the threads.
2600 (when gnus-build-sparse-threads
2601 (gnus-build-sparse-threads))
2602 ;; Find the initial limit.
2603 (if gnus-show-threads
2605 (let ((gnus-newsgroup-dormant nil))
2606 (gnus-summary-initial-limit show-all))
2607 (gnus-summary-initial-limit show-all))
2608 (setq gnus-newsgroup-limit
2610 (lambda (header) (mail-header-number header))
2611 gnus-newsgroup-headers)))
2612 ;; Generate the summary buffer.
2614 (gnus-summary-prepare))
2615 (when gnus-use-trees
2616 (gnus-tree-open group)
2617 (setq gnus-summary-highlight-line-function
2618 'gnus-tree-highlight-article))
2619 ;; If the summary buffer is empty, but there are some low-scored
2620 ;; articles or some excluded dormants, we include these in the
2622 (when (and (zerop (buffer-size))
2624 (cond (gnus-newsgroup-dormant
2625 (gnus-summary-limit-include-dormant))
2626 ((and gnus-newsgroup-scored show-all)
2627 (gnus-summary-limit-include-expunged t))))
2628 ;; Function `gnus-apply-kill-file' must be called in this hook.
2629 (run-hooks 'gnus-apply-kill-hook)
2630 (if (and (zerop (buffer-size))
2633 ;; This newsgroup is empty.
2634 (gnus-summary-catchup-and-exit nil t)
2635 (gnus-message 6 "No unread news")
2637 (gnus-kill-or-deaden-summary kill-buffer))
2638 ;; Return nil from this function.
2640 ;; Hide conversation thread subtrees. We cannot do this in
2641 ;; gnus-summary-prepare-hook since kill processing may not
2642 ;; work with hidden articles.
2643 (and gnus-show-threads
2644 gnus-thread-hide-subtree
2645 (gnus-summary-hide-all-threads))
2646 ;; Show first unread article if requested.
2647 (if (and (not no-article)
2649 gnus-newsgroup-unreads
2650 gnus-auto-select-first)
2651 (unless (if (eq gnus-auto-select-first 'best)
2652 (gnus-summary-best-unread-article)
2653 (gnus-summary-first-unread-article))
2654 (gnus-configure-windows 'summary))
2655 ;; Don't select any articles, just move point to the first
2656 ;; article in the group.
2657 (goto-char (point-min))
2658 (gnus-summary-position-point)
2659 (gnus-set-mode-line 'summary)
2660 (gnus-configure-windows 'summary 'force))
2662 (gnus-kill-or-deaden-summary kill-buffer))
2663 (when (get-buffer-window gnus-group-buffer t)
2664 ;; Gotta use windows, because recenter does weird stuff if
2665 ;; the current buffer ain't the displayed window.
2666 (let ((owin (selected-window)))
2667 (select-window (get-buffer-window gnus-group-buffer t))
2668 (when (gnus-group-goto-group group)
2670 (select-window owin)))
2671 ;; Mark this buffer as "prepared".
2672 (setq gnus-newsgroup-prepared t)
2675 (defun gnus-summary-prepare ()
2676 "Generate the summary buffer."
2678 (let ((buffer-read-only nil))
2680 (setq gnus-newsgroup-data nil
2681 gnus-newsgroup-data-reverse nil)
2682 (run-hooks 'gnus-summary-generate-hook)
2683 ;; Generate the buffer, either with threads or without.
2684 (when gnus-newsgroup-headers
2685 (gnus-summary-prepare-threads
2686 (if gnus-show-threads
2687 (gnus-sort-gathered-threads
2688 (funcall gnus-summary-thread-gathering-function
2690 (gnus-cut-threads (gnus-make-threads)))))
2691 ;; Unthreaded display.
2692 (gnus-sort-articles gnus-newsgroup-headers))))
2693 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2694 ;; Call hooks for modifying summary buffer.
2695 (goto-char (point-min))
2696 (run-hooks 'gnus-summary-prepare-hook)))
2698 (defsubst gnus-general-simplify-subject (subject)
2699 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2702 ;; Truncate the subject.
2703 ((numberp gnus-summary-gather-subject-limit)
2704 (setq subject (gnus-simplify-subject-re subject))
2705 (if (> (length subject) gnus-summary-gather-subject-limit)
2706 (substring subject 0 gnus-summary-gather-subject-limit)
2708 ;; Fuzzily simplify it.
2709 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2710 (gnus-simplify-subject-fuzzy subject))
2711 ;; Just remove the leading "Re:".
2713 (gnus-simplify-subject-re subject))))
2715 (if (and gnus-summary-gather-exclude-subject
2716 (string-match gnus-summary-gather-exclude-subject subject))
2717 nil ; This article shouldn't be gathered
2720 (defun gnus-summary-simplify-subject-query ()
2721 "Query where the respool algorithm would put this article."
2723 (gnus-set-global-variables)
2724 (gnus-summary-select-article)
2725 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2727 (defun gnus-gather-threads-by-subject (threads)
2728 "Gather threads by looking at Subject headers."
2729 (if (not gnus-summary-make-false-root)
2731 (let ((hashtb (gnus-make-hashtable 1024))
2734 subject hthread whole-subject)
2736 (setq subject (gnus-general-simplify-subject
2737 (setq whole-subject (mail-header-subject
2740 (if (setq hthread (gnus-gethash subject hashtb))
2742 ;; We enter a dummy root into the thread, if we
2743 ;; haven't done that already.
2744 (unless (stringp (caar hthread))
2745 (setcar hthread (list whole-subject (car hthread))))
2746 ;; We add this new gathered thread to this gathered
2748 (setcdr (car hthread)
2749 (nconc (cdar hthread) (list (car threads))))
2750 ;; Remove it from the list of threads.
2751 (setcdr prev (cdr threads))
2752 (setq threads prev))
2753 ;; Enter this thread into the hash table.
2754 (gnus-sethash subject threads hashtb)))
2756 (setq threads (cdr threads)))
2759 (defun gnus-gather-threads-by-references (threads)
2760 "Gather threads by looking at References headers."
2761 (let ((idhashtb (gnus-make-hashtable 1024))
2762 (thhashtb (gnus-make-hashtable 1024))
2765 ids references id gthread gid entered ref)
2767 (when (setq references (mail-header-references (caar threads)))
2768 (setq id (mail-header-id (caar threads))
2769 ids (gnus-split-references references)
2771 (while (setq ref (pop ids))
2772 (setq ids (delete ref ids))
2773 (if (not (setq gid (gnus-gethash ref idhashtb)))
2775 (gnus-sethash ref id idhashtb)
2776 (gnus-sethash id threads thhashtb))
2777 (setq gthread (gnus-gethash gid thhashtb))
2779 ;; We enter a dummy root into the thread, if we
2780 ;; haven't done that already.
2781 (unless (stringp (caar gthread))
2782 (setcar gthread (list (mail-header-subject (caar gthread))
2784 ;; We add this new gathered thread to this gathered
2786 (setcdr (car gthread)
2787 (nconc (cdar gthread) (list (car threads)))))
2788 ;; Add it into the thread hash table.
2789 (gnus-sethash id gthread thhashtb)
2791 ;; Remove it from the list of threads.
2792 (setcdr prev (cdr threads))
2793 (setq threads prev))))
2795 (setq threads (cdr threads)))
2798 (defun gnus-sort-gathered-threads (threads)
2799 "Sort subtreads inside each gathered thread by article number."
2800 (let ((result threads))
2802 (when (stringp (caar threads))
2803 (setcdr (car threads)
2804 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2805 (setq threads (cdr threads)))
2808 (defun gnus-thread-loop-p (root thread)
2809 "Say whether ROOT is in THREAD."
2810 (let ((stack (list thread))
2813 (while (setq thread (pop stack))
2814 (setq th (cdr thread))
2816 (not (eq (caar th) root)))
2819 ;; We have found a loop.
2821 (setcdr thread (delq (car th) (cdr thread)))
2822 (if (boundp (setq ref-dep (intern "none"
2823 gnus-newsgroup-dependencies)))
2824 (setcdr (symbol-value ref-dep)
2825 (nconc (cdr (symbol-value ref-dep))
2827 (set ref-dep (list nil (car th))))
2830 ;; Push all the subthreads onto the stack.
2831 (push (cdr thread) stack)))
2834 (defun gnus-make-threads ()
2835 "Go through the dependency hashtb and find the roots. Return all threads."
2837 (while (catch 'infloop
2840 ;; Deal with self-referencing References loops.
2841 (when (and (car (symbol-value refs))
2848 (car (symbol-value refs)) thread))
2849 (cdr (symbol-value refs)))))))
2852 (unless (car (symbol-value refs))
2853 ;; These threads do not refer back to any other articles,
2854 ;; so they're roots.
2855 (setq threads (append (cdr (symbol-value refs)) threads))))
2856 gnus-newsgroup-dependencies)))
2859 (defun gnus-build-sparse-threads ()
2860 (let ((headers gnus-newsgroup-headers)
2861 (deps gnus-newsgroup-dependencies)
2862 header references generation relations
2863 cthread subject child end pthread relation)
2864 ;; First we create an alist of generations/relations, where
2865 ;; generations is how much we trust the relation, and the relation
2867 (gnus-message 7 "Making sparse threads...")
2869 (nnheader-set-temp-buffer " *gnus sparse threads*")
2870 (while (setq header (pop headers))
2871 (when (and (setq references (mail-header-references header))
2872 (not (string= references "")))
2874 (setq child (mail-header-id header)
2875 subject (mail-header-subject header))
2877 (while (search-backward ">" nil t)
2878 (setq end (1+ (point)))
2879 (when (search-backward "<" nil t)
2880 (push (list (incf generation)
2881 child (setq child (buffer-substring (point) end))
2884 (push (list (1+ generation) child nil subject) relations)
2886 (kill-buffer (current-buffer)))
2887 ;; Sort over trustworthiness.
2888 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2889 (while (setq relation (pop relations))
2890 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2891 (unless (car (symbol-value cthread))
2892 ;; Make this article the parent of these threads.
2893 (setcar (symbol-value cthread)
2894 (vector gnus-reffed-article-number
2898 (or (caddr relation) "") 0 0 "")))
2899 (set cthread (list (vector gnus-reffed-article-number
2901 "" "" (cadr relation)
2902 (or (caddr relation) "") 0 0 ""))))
2903 (push gnus-reffed-article-number gnus-newsgroup-limit)
2904 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2905 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2906 gnus-newsgroup-reads)
2907 (decf gnus-reffed-article-number)
2908 ;; Make this new thread the child of its parent.
2909 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2910 (setcdr (symbol-value pthread)
2911 (nconc (cdr (symbol-value pthread))
2912 (list (symbol-value cthread))))
2913 (set pthread (list nil (symbol-value cthread))))))
2914 (gnus-message 7 "Making sparse threads...done")))
2916 (defun gnus-build-old-threads ()
2917 ;; Look at all the articles that refer back to old articles, and
2918 ;; fetch the headers for the articles that aren't there. This will
2919 ;; build complete threads - if the roots haven't been expired by the
2924 (when (not (car (symbol-value refs)))
2925 (setq heads (cdr (symbol-value refs)))
2927 (if (memq (mail-header-number (caar heads))
2928 gnus-newsgroup-dormant)
2929 (setq heads (cdr heads))
2930 (setq id (symbol-name refs))
2931 (while (and (setq id (gnus-build-get-header id))
2932 (not (car (gnus-gethash
2933 id gnus-newsgroup-dependencies)))))
2934 (setq heads nil)))))
2935 gnus-newsgroup-dependencies)))
2937 (defun gnus-build-get-header (id)
2938 ;; Look through the buffer of NOV lines and find the header to
2939 ;; ID. Enter this line into the dependencies hash table, and return
2940 ;; the id of the parent article (if any).
2941 (let ((deps gnus-newsgroup-dependencies)
2945 (set-buffer nntp-server-buffer)
2946 (let ((case-fold-search nil))
2947 (goto-char (point-min))
2948 (while (and (not found)
2949 (search-forward id nil t))
2951 (setq found (looking-at
2952 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2953 (regexp-quote id))))
2954 (or found (beginning-of-line 2)))
2958 (setq header (gnus-nov-parse-line
2959 (read (current-buffer)) deps))
2960 (gnus-parent-id (mail-header-references header))))))
2962 (let ((number (mail-header-number header)))
2963 (push number gnus-newsgroup-limit)
2964 (push header gnus-newsgroup-headers)
2965 (if (memq number gnus-newsgroup-unselected)
2967 (push number gnus-newsgroup-unreads)
2968 (setq gnus-newsgroup-unselected
2969 (delq number gnus-newsgroup-unselected)))
2970 (push number gnus-newsgroup-ancient)))))))
2972 (defun gnus-summary-update-article-line (article header)
2973 "Update the line for ARTICLE using HEADERS."
2974 (let* ((id (mail-header-id header))
2975 (thread (gnus-id-to-thread id)))
2977 (error "Article in no thread"))
2978 ;; Update the thread.
2979 (setcar thread header)
2980 (gnus-summary-goto-subject article)
2981 (let* ((datal (gnus-data-find-list article))
2983 (length (when (cdr datal)
2984 (- (gnus-data-pos data)
2985 (gnus-data-pos (cadr datal)))))
2986 (buffer-read-only nil)
2987 (level (gnus-summary-thread-level)))
2989 (gnus-summary-insert-line
2990 header level nil (gnus-article-mark article)
2991 (memq article gnus-newsgroup-replied)
2992 (memq article gnus-newsgroup-expirable)
2993 ;; Only insert the Subject string when it's different
2994 ;; from the previous Subject string.
2995 (if (gnus-subject-equal
2997 (mail-header-subject
3000 (gnus-data-find-list
3002 (gnus-data-list t)))))
3003 ;; Error on the side of excessive subjects.
3005 (mail-header-subject header))
3007 (mail-header-subject header))
3008 nil (cdr (assq article gnus-newsgroup-scored))
3009 (memq article gnus-newsgroup-processable))
3011 (gnus-data-update-list
3012 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3014 (defun gnus-summary-update-article (article &optional iheader)
3015 "Update ARTICLE in the summary buffer."
3016 (set-buffer gnus-summary-buffer)
3017 (let* ((header (or iheader (gnus-summary-article-header article)))
3018 (id (mail-header-id header))
3019 (data (gnus-data-find article))
3020 (thread (gnus-id-to-thread id))
3021 (references (mail-header-references header))
3025 (when (and references
3026 (not (equal "" references)))
3029 (buffer-read-only nil)
3031 (number (mail-header-number header))
3034 ;; !!! Should this be in or not?
3036 (setcar thread nil))
3038 (delq thread parent))
3039 (if (gnus-summary-insert-subject id header iheader)
3040 ;; Set the (possibly) new article number in the data structure.
3041 (gnus-data-set-number data (gnus-id-to-article id))
3045 (defun gnus-rebuild-thread (id)
3046 "Rebuild the thread containing ID."
3047 (let ((buffer-read-only nil)
3048 old-pos current thread data)
3049 (if (not gnus-show-threads)
3050 (setq thread (list (car (gnus-id-to-thread id))))
3051 ;; Get the thread this article is part of.
3052 (setq thread (gnus-remove-thread id)))
3053 (setq old-pos (gnus-point-at-bol))
3054 (setq current (save-excursion
3055 (and (zerop (forward-line -1))
3056 (gnus-summary-article-number))))
3057 ;; If this is a gathered thread, we have to go some re-gathering.
3058 (when (stringp (car thread))
3059 (let ((subject (car thread))
3061 (setq thread (cdr thread))
3063 (unless (memq (setq thr (gnus-id-to-thread
3065 (mail-header-id (caar thread)))))
3068 (setq thread (cdr thread)))
3069 ;; We now have all (unique) roots.
3070 (if (= (length roots) 1)
3071 ;; All the loose roots are now one solid root.
3072 (setq thread (car roots))
3073 (setq thread (cons subject (gnus-sort-threads roots))))))
3075 ;; We then insert this thread into the summary buffer.
3076 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3077 (if gnus-show-threads
3078 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3079 (gnus-summary-prepare-unthreaded thread))
3080 (setq data (nreverse gnus-newsgroup-data))
3081 (setq threads gnus-newsgroup-threads))
3082 ;; We splice the new data into the data structure.
3083 (gnus-data-enter-list current data (- (point) old-pos))
3084 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3086 (defun gnus-number-to-header (number)
3087 "Return the header for article NUMBER."
3088 (let ((headers gnus-newsgroup-headers))
3090 (not (= number (mail-header-number (car headers)))))
3095 (defun gnus-parent-headers (headers &optional generation)
3096 "Return the headers of the GENERATIONeth parent of HEADERS."
3098 (setq generation 1))
3101 (while (and parent headers (not (zerop generation)))
3102 (setq references (mail-header-references headers))
3103 (when (and references
3104 (setq parent (gnus-parent-id references))
3105 (setq headers (car (gnus-id-to-thread parent))))
3109 (defun gnus-id-to-thread (id)
3110 "Return the (sub-)thread where ID appears."
3111 (gnus-gethash id gnus-newsgroup-dependencies))
3113 (defun gnus-id-to-article (id)
3114 "Return the article number of ID."
3115 (let ((thread (gnus-id-to-thread id)))
3118 (mail-header-number (car thread)))))
3120 (defun gnus-id-to-header (id)
3121 "Return the article headers of ID."
3122 (car (gnus-id-to-thread id)))
3124 (defun gnus-article-displayed-root-p (article)
3125 "Say whether ARTICLE is a root(ish) article."
3126 (let ((level (gnus-summary-thread-level article))
3127 (refs (mail-header-references (gnus-summary-article-header article)))
3133 ((null (gnus-parent-id refs)) t)
3135 (null (setq particle (gnus-id-to-article
3136 (gnus-parent-id refs))))
3137 (null (gnus-summary-thread-level particle)))))))
3139 (defun gnus-root-id (id)
3140 "Return the id of the root of the thread where ID appears."
3142 (while (and id (setq prev (car (gnus-gethash
3143 id gnus-newsgroup-dependencies))))
3145 id (gnus-parent-id (mail-header-references prev))))
3148 (defun gnus-remove-thread (id &optional dont-remove)
3149 "Remove the thread that has ID in it."
3150 (let ((dep gnus-newsgroup-dependencies)
3151 headers thread last-id)
3152 ;; First go up in this thread until we find the root.
3153 (setq last-id (gnus-root-id id))
3154 (setq headers (list (car (gnus-id-to-thread last-id))
3155 (caadr (gnus-id-to-thread last-id))))
3156 ;; We have now found the real root of this thread. It might have
3157 ;; been gathered into some loose thread, so we have to search
3158 ;; through the threads to find the thread we wanted.
3159 (let ((threads gnus-newsgroup-threads)
3162 (setq sub (car threads))
3163 (if (stringp (car sub))
3164 ;; This is a gathered thread, so we look at the roots
3165 ;; below it to find whether this article is in this
3168 (setq sub (cdr sub))
3170 (when (member (caar sub) headers)
3171 (setq thread (car threads)
3174 (setq sub (cdr sub))))
3175 ;; It's an ordinary thread, so we check it.
3176 (when (eq (car sub) (car headers))
3179 (setq threads (cdr threads)))
3180 ;; If this article is in no thread, then it's a root.
3183 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3184 (setq thread (gnus-gethash last-id dep)))
3187 thread ; We return this thread.
3189 (if (stringp (car thread))
3191 ;; If we use dummy roots, then we have to remove the
3192 ;; dummy root as well.
3193 (when (eq gnus-summary-make-false-root 'dummy)
3195 (gnus-data-compute-positions))
3196 (setq thread (cdr thread))
3198 (gnus-remove-thread-1 (car thread))
3199 (setq thread (cdr thread))))
3200 (gnus-remove-thread-1 thread))))))))
3202 (defun gnus-remove-thread-1 (thread)
3203 "Remove the thread THREAD recursively."
3204 (let ((number (mail-header-number (pop thread)))
3206 (setq thread (reverse thread))
3208 (gnus-remove-thread-1 (pop thread)))
3209 (when (setq d (gnus-data-find number))
3210 (goto-char (gnus-data-pos d))
3213 (- (gnus-point-at-bol)
3215 (1+ (gnus-point-at-eol))
3216 (gnus-delete-line)))))))
3218 (defun gnus-sort-threads (threads)
3220 (if (not gnus-thread-sort-functions)
3222 (gnus-message 7 "Sorting threads...")
3224 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3225 (gnus-message 7 "Sorting threads...done"))))
3227 (defun gnus-sort-articles (articles)
3229 (when gnus-article-sort-functions
3230 (gnus-message 7 "Sorting articles...")
3232 (setq gnus-newsgroup-headers
3233 (sort articles (gnus-make-sort-function
3234 gnus-article-sort-functions)))
3235 (gnus-message 7 "Sorting articles...done"))))
3237 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3238 (defmacro gnus-thread-header (thread)
3239 ;; Return header of first article in THREAD.
3240 ;; Note that THREAD must never, ever be anything else than a variable -
3241 ;; using some other form will lead to serious barfage.
3242 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3243 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3244 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3247 (defsubst gnus-article-sort-by-number (h1 h2)
3248 "Sort articles by article number."
3249 (< (mail-header-number h1)
3250 (mail-header-number h2)))
3252 (defun gnus-thread-sort-by-number (h1 h2)
3253 "Sort threads by root article number."
3254 (gnus-article-sort-by-number
3255 (gnus-thread-header h1) (gnus-thread-header h2)))
3257 (defsubst gnus-article-sort-by-lines (h1 h2)
3258 "Sort articles by article Lines header."
3259 (< (mail-header-lines h1)
3260 (mail-header-lines h2)))
3262 (defun gnus-thread-sort-by-lines (h1 h2)
3263 "Sort threads by root article Lines header."
3264 (gnus-article-sort-by-lines
3265 (gnus-thread-header h1) (gnus-thread-header h2)))
3267 (defsubst gnus-article-sort-by-author (h1 h2)
3268 "Sort articles by root author."
3270 (let ((extract (funcall
3271 gnus-extract-address-components
3272 (mail-header-from h1))))
3273 (or (car extract) (cadr extract) ""))
3274 (let ((extract (funcall
3275 gnus-extract-address-components
3276 (mail-header-from h2))))
3277 (or (car extract) (cadr extract) ""))))
3279 (defun gnus-thread-sort-by-author (h1 h2)
3280 "Sort threads by root author."
3281 (gnus-article-sort-by-author
3282 (gnus-thread-header h1) (gnus-thread-header h2)))
3284 (defsubst gnus-article-sort-by-subject (h1 h2)
3285 "Sort articles by root subject."
3287 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3288 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3290 (defun gnus-thread-sort-by-subject (h1 h2)
3291 "Sort threads by root subject."
3292 (gnus-article-sort-by-subject
3293 (gnus-thread-header h1) (gnus-thread-header h2)))
3295 (defsubst gnus-article-sort-by-date (h1 h2)
3296 "Sort articles by root article date."
3298 (gnus-date-get-time (mail-header-date h1))
3299 (gnus-date-get-time (mail-header-date h2))))
3301 (defun gnus-thread-sort-by-date (h1 h2)
3302 "Sort threads by root article date."
3303 (gnus-article-sort-by-date
3304 (gnus-thread-header h1) (gnus-thread-header h2)))
3306 (defsubst gnus-article-sort-by-score (h1 h2)
3307 "Sort articles by root article score.
3308 Unscored articles will be counted as having a score of zero."
3309 (> (or (cdr (assq (mail-header-number h1)
3310 gnus-newsgroup-scored))
3311 gnus-summary-default-score 0)
3312 (or (cdr (assq (mail-header-number h2)
3313 gnus-newsgroup-scored))
3314 gnus-summary-default-score 0)))
3316 (defun gnus-thread-sort-by-score (h1 h2)
3317 "Sort threads by root article score."
3318 (gnus-article-sort-by-score
3319 (gnus-thread-header h1) (gnus-thread-header h2)))
3321 (defun gnus-thread-sort-by-total-score (h1 h2)
3322 "Sort threads by the sum of all scores in the thread.
3323 Unscored articles will be counted as having a score of zero."
3324 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3326 (defun gnus-thread-total-score (thread)
3327 ;; This function find the total score of THREAD.
3328 (cond ((null thread)
3331 (if (stringp (car thread))
3332 (apply gnus-thread-score-function 0
3333 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3334 (gnus-thread-total-score-1 thread)))
3336 (gnus-thread-total-score-1 (list thread)))))
3338 (defun gnus-thread-total-score-1 (root)
3339 ;; This function find the total score of the thread below ROOT.
3340 (setq root (car root))
3341 (apply gnus-thread-score-function
3343 (mapcar 'gnus-thread-total-score
3344 (cdr (gnus-gethash (mail-header-id root)
3345 gnus-newsgroup-dependencies)))
3346 (when (> (mail-header-number root) 0)
3347 (list (or (cdr (assq (mail-header-number root)
3348 gnus-newsgroup-scored))
3349 gnus-summary-default-score 0))))
3350 (list gnus-summary-default-score)
3353 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3354 (defvar gnus-tmp-prev-subject nil)
3355 (defvar gnus-tmp-false-parent nil)
3356 (defvar gnus-tmp-root-expunged nil)
3357 (defvar gnus-tmp-dummy-line nil)
3359 (defun gnus-summary-prepare-threads (threads)
3360 "Prepare summary buffer from THREADS and indentation LEVEL.
3361 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3362 or a straight list of headers."
3363 (gnus-message 7 "Generating summary...")
3365 (setq gnus-newsgroup-threads threads)
3368 (let ((gnus-tmp-level 0)
3369 (default-score (or gnus-summary-default-score 0))
3370 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3371 thread number subject stack state gnus-tmp-gathered beg-match
3372 new-roots gnus-tmp-new-adopts thread-end
3373 gnus-tmp-header gnus-tmp-unread
3374 gnus-tmp-replied gnus-tmp-subject-or-nil
3375 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3376 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3377 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3379 (setq gnus-tmp-prev-subject nil)
3381 (if (vectorp (car threads))
3382 ;; If this is a straight (sic) list of headers, then a
3383 ;; threaded summary display isn't required, so we just create
3384 ;; an unthreaded one.
3385 (gnus-summary-prepare-unthreaded threads)
3387 ;; Do the threaded display.
3389 (while (or threads stack gnus-tmp-new-adopts new-roots)
3391 (if (and (= gnus-tmp-level 0)
3392 (not (setq gnus-tmp-dummy-line nil))
3395 (not gnus-tmp-false-parent)
3396 (or gnus-tmp-new-adopts new-roots))
3397 (if gnus-tmp-new-adopts
3398 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3399 thread (list (car gnus-tmp-new-adopts))
3400 gnus-tmp-header (caar thread)
3401 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3403 (setq thread (list (car new-roots))
3404 gnus-tmp-header (caar thread)
3405 new-roots (cdr new-roots))))
3408 ;; If there are some threads, we do them before the
3409 ;; threads on the stack.
3410 (setq thread threads
3411 gnus-tmp-header (caar thread))
3412 ;; There were no current threads, so we pop something off
3414 (setq state (car stack)
3415 gnus-tmp-level (car state)
3418 gnus-tmp-header (caar thread))))
3420 (setq gnus-tmp-false-parent nil)
3421 (setq gnus-tmp-root-expunged nil)
3422 (setq thread-end nil)
3424 (if (stringp gnus-tmp-header)
3425 ;; The header is a dummy root.
3427 ((eq gnus-summary-make-false-root 'adopt)
3428 ;; We let the first article adopt the rest.
3429 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3431 (setq gnus-tmp-gathered
3433 (lambda (h) (mail-header-number (car h)))
3436 (setq thread (cons (list (caar thread)
3439 (setq gnus-tmp-level -1
3440 gnus-tmp-false-parent t))
3441 ((eq gnus-summary-make-false-root 'empty)
3442 ;; We print adopted articles with empty subject fields.
3443 (setq gnus-tmp-gathered
3445 (lambda (h) (mail-header-number (car h)))
3448 (setq gnus-tmp-level -1))
3449 ((eq gnus-summary-make-false-root 'dummy)
3450 ;; We remember that we probably want to output a dummy
3452 (setq gnus-tmp-dummy-line gnus-tmp-header)
3453 (setq gnus-tmp-prev-subject gnus-tmp-header))
3455 ;; We do not make a root for the gathered
3456 ;; sub-threads at all.
3457 (setq gnus-tmp-level -1)))
3459 (setq number (mail-header-number gnus-tmp-header)
3460 subject (mail-header-subject gnus-tmp-header))
3463 ;; If the thread has changed subject, we might want to make
3464 ;; this subthread into a root.
3465 ((and (null gnus-thread-ignore-subject)
3466 (not (zerop gnus-tmp-level))
3467 gnus-tmp-prev-subject
3469 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3470 (setq new-roots (nconc new-roots (list (car thread)))
3472 gnus-tmp-header nil))
3473 ;; If the article lies outside the current limit,
3474 ;; then we do not display it.
3475 ((not (memq number gnus-newsgroup-limit))
3476 (setq gnus-tmp-gathered
3478 (lambda (h) (mail-header-number (car h)))
3481 (setq gnus-tmp-new-adopts (if (cdar thread)
3482 (append gnus-tmp-new-adopts
3484 gnus-tmp-new-adopts)
3486 gnus-tmp-header nil)
3487 (when (zerop gnus-tmp-level)
3488 (setq gnus-tmp-root-expunged t)))
3489 ;; Perhaps this article is to be marked as read?
3490 ((and gnus-summary-mark-below
3491 (< (or (cdr (assq number gnus-newsgroup-scored))
3493 gnus-summary-mark-below)
3494 ;; Don't touch sparse articles.
3495 (not (gnus-summary-article-sparse-p number))
3496 (not (gnus-summary-article-ancient-p number)))
3497 (setq gnus-newsgroup-unreads
3498 (delq number gnus-newsgroup-unreads))
3499 (if gnus-newsgroup-auto-expire
3500 (push number gnus-newsgroup-expirable)
3501 (push (cons number gnus-low-score-mark)
3502 gnus-newsgroup-reads))))
3504 (when gnus-tmp-header
3505 ;; We may have an old dummy line to output before this
3507 (when gnus-tmp-dummy-line
3508 (gnus-summary-insert-dummy-line
3509 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3510 (setq gnus-tmp-dummy-line nil))
3512 ;; Compute the mark.
3513 (setq gnus-tmp-unread (gnus-article-mark number))
3515 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3516 gnus-tmp-header gnus-tmp-level)
3517 gnus-newsgroup-data)
3519 ;; Actually insert the line.
3521 gnus-tmp-subject-or-nil
3523 ((and gnus-thread-ignore-subject
3524 gnus-tmp-prev-subject
3525 (not (inline (gnus-subject-equal
3526 gnus-tmp-prev-subject subject))))
3528 ((zerop gnus-tmp-level)
3529 (if (and (eq gnus-summary-make-false-root 'empty)
3530 (memq number gnus-tmp-gathered)
3531 gnus-tmp-prev-subject
3532 (inline (gnus-subject-equal
3533 gnus-tmp-prev-subject subject)))
3534 gnus-summary-same-subject
3536 (t gnus-summary-same-subject)))
3537 (if (and (eq gnus-summary-make-false-root 'adopt)
3538 (= gnus-tmp-level 1)
3539 (memq number gnus-tmp-gathered))
3540 (setq gnus-tmp-opening-bracket ?\<
3541 gnus-tmp-closing-bracket ?\>)
3542 (setq gnus-tmp-opening-bracket ?\[
3543 gnus-tmp-closing-bracket ?\]))
3545 gnus-tmp-indentation
3546 (aref gnus-thread-indent-array gnus-tmp-level)
3547 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3548 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3549 gnus-summary-default-score 0)
3551 (if (or (null gnus-summary-default-score)
3552 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3553 gnus-summary-zcore-fuzz))
3555 (if (< gnus-tmp-score gnus-summary-default-score)
3556 gnus-score-below-mark gnus-score-over-mark))
3558 (cond ((memq number gnus-newsgroup-processable)
3560 ((memq number gnus-newsgroup-cached)
3562 ((memq number gnus-newsgroup-replied)
3564 ((memq number gnus-newsgroup-saved)
3566 (t gnus-unread-mark))
3567 gnus-tmp-from (mail-header-from gnus-tmp-header)
3570 ((string-match "<[^>]+> *$" gnus-tmp-from)
3571 (setq beg-match (match-beginning 0))
3572 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3573 (substring gnus-tmp-from (1+ (match-beginning 0))
3574 (1- (match-end 0))))
3575 (substring gnus-tmp-from 0 beg-match)))
3576 ((string-match "(.+)" gnus-tmp-from)
3577 (substring gnus-tmp-from
3578 (1+ (match-beginning 0)) (1- (match-end 0))))
3580 (when (string= gnus-tmp-name "")
3581 (setq gnus-tmp-name gnus-tmp-from))
3582 (unless (numberp gnus-tmp-lines)
3583 (setq gnus-tmp-lines 0))
3584 (gnus-put-text-property
3586 (progn (eval gnus-summary-line-format-spec) (point))
3587 'gnus-number number)
3590 (run-hooks 'gnus-summary-update-hook)
3593 (setq gnus-tmp-prev-subject subject)))
3595 (when (nth 1 thread)
3596 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3597 (incf gnus-tmp-level)
3598 (setq threads (if thread-end nil (cdar thread)))
3600 (setq gnus-tmp-level 0)))))
3601 (gnus-message 7 "Generating summary...done"))
3603 (defun gnus-summary-prepare-unthreaded (headers)
3604 "Generate an unthreaded summary buffer based on HEADERS."
3605 (let (header number mark)
3610 ;; We may have to root out some bad articles...
3611 (when (memq (setq number (mail-header-number
3612 (setq header (pop headers))))
3613 gnus-newsgroup-limit)
3614 ;; Mark article as read when it has a low score.
3615 (when (and gnus-summary-mark-below
3616 (< (or (cdr (assq number gnus-newsgroup-scored))
3617 gnus-summary-default-score 0)
3618 gnus-summary-mark-below)
3619 (not (gnus-summary-article-ancient-p number)))
3620 (setq gnus-newsgroup-unreads
3621 (delq number gnus-newsgroup-unreads))
3622 (if gnus-newsgroup-auto-expire
3623 (push number gnus-newsgroup-expirable)
3624 (push (cons number gnus-low-score-mark)
3625 gnus-newsgroup-reads)))
3627 (setq mark (gnus-article-mark number))
3628 (push (gnus-data-make number mark (1+ (point)) header 0)
3629 gnus-newsgroup-data)
3630 (gnus-summary-insert-line
3632 mark (memq number gnus-newsgroup-replied)
3633 (memq number gnus-newsgroup-expirable)
3634 (mail-header-subject header) nil
3635 (cdr (assq number gnus-newsgroup-scored))
3636 (memq number gnus-newsgroup-processable))))))
3638 (defun gnus-select-newsgroup (group &optional read-all)
3639 "Select newsgroup GROUP.
3640 If READ-ALL is non-nil, all articles in the group are selected."
3641 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3642 ;;!!! Dirty hack; should be removed.
3643 (gnus-summary-ignore-duplicates
3644 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3646 gnus-summary-ignore-duplicates))
3647 (info (nth 2 entry))
3648 articles fetched-articles cached)
3650 (unless (gnus-check-server
3651 (setq gnus-current-select-method
3652 (gnus-find-method-for-group group)))
3653 (error "Couldn't open server"))
3655 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3656 (gnus-activate-group group) ; Or we can activate it...
3657 (progn ; Or we bug out.
3658 (when (equal major-mode 'gnus-summary-mode)
3659 (kill-buffer (current-buffer)))
3660 (error "Couldn't request group %s: %s"
3661 group (gnus-status-message group))))
3663 (unless (gnus-request-group group t)
3664 (when (equal major-mode 'gnus-summary-mode)
3665 (kill-buffer (current-buffer)))
3666 (error "Couldn't request group %s: %s"
3667 group (gnus-status-message group)))
3669 (setq gnus-newsgroup-name group)
3670 (setq gnus-newsgroup-unselected nil)
3671 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3673 ;; Adjust and set lists of article marks.
3675 (gnus-adjust-marked-articles info))
3677 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3678 (when (gnus-virtual-group-p group)
3679 (setq cached gnus-newsgroup-cached))
3681 (setq gnus-newsgroup-unreads
3682 (gnus-set-difference
3683 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3684 gnus-newsgroup-dormant))
3686 (setq gnus-newsgroup-processable nil)
3688 (gnus-update-read-articles group gnus-newsgroup-unreads)
3689 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3690 (gnus-group-update-group group))
3692 (setq articles (gnus-articles-to-read group read-all))
3696 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3698 ((eq articles 0) nil)
3700 ;; Init the dependencies hash table.
3701 (setq gnus-newsgroup-dependencies
3702 (gnus-make-hashtable (length articles)))
3703 ;; Retrieve the headers and read them in.
3704 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3705 (setq gnus-newsgroup-headers
3707 (setq gnus-headers-retrieved-by
3708 (gnus-retrieve-headers
3709 articles gnus-newsgroup-name
3710 ;; We might want to fetch old headers, but
3711 ;; not if there is only 1 article.
3712 (and gnus-fetch-old-headers
3714 (not (eq gnus-fetch-old-headers 'some))
3715 (not (numberp gnus-fetch-old-headers)))
3716 (> (length articles) 1))))))
3717 (gnus-get-newsgroup-headers-xover
3718 articles nil nil gnus-newsgroup-name t)
3719 (gnus-get-newsgroup-headers)))
3720 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3722 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3724 (setq gnus-newsgroup-cached cached))
3726 ;; Suppress duplicates?
3727 (when gnus-suppress-duplicates
3728 (gnus-dup-suppress-articles))
3730 ;; Set the initial limit.
3731 (setq gnus-newsgroup-limit (copy-sequence articles))
3732 ;; Remove canceled articles from the list of unread articles.
3733 (setq gnus-newsgroup-unreads
3734 (gnus-set-sorted-intersection
3735 gnus-newsgroup-unreads
3736 (setq fetched-articles
3737 (mapcar (lambda (headers) (mail-header-number headers))
3738 gnus-newsgroup-headers))))
3739 ;; Removed marked articles that do not exist.
3740 (gnus-update-missing-marks
3741 (gnus-sorted-complement fetched-articles articles))
3742 ;; Let the Gnus agent mark articles as read.
3744 (gnus-agent-get-undownloaded-list))
3745 ;; We might want to build some more threads first.
3746 (and gnus-fetch-old-headers
3747 (eq gnus-headers-retrieved-by 'nov)
3748 (gnus-build-old-threads))
3749 ;; Check whether auto-expire is to be done in this group.
3750 (setq gnus-newsgroup-auto-expire
3751 (gnus-group-auto-expirable-p group))
3752 ;; Set up the article buffer now, if necessary.
3753 (unless gnus-single-article-buffer
3754 (gnus-article-setup-buffer))
3755 ;; First and last article in this newsgroup.
3756 (when gnus-newsgroup-headers
3757 (setq gnus-newsgroup-begin
3758 (mail-header-number (car gnus-newsgroup-headers))
3761 (gnus-last-element gnus-newsgroup-headers))))
3762 ;; GROUP is successfully selected.
3763 (or gnus-newsgroup-headers t)))))
3765 (defun gnus-articles-to-read (group &optional read-all)
3766 ;; Find out what articles the user wants to read.
3768 ;; Select all articles if `read-all' is non-nil, or if there
3769 ;; are no unread articles.
3771 (and (zerop (length gnus-newsgroup-marked))
3772 (zerop (length gnus-newsgroup-unreads)))
3773 (eq (gnus-group-find-parameter group 'display)
3775 (gnus-uncompress-range (gnus-active group))
3776 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3777 (copy-sequence gnus-newsgroup-unreads))
3779 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3780 (scored (length scored-list))
3781 (number (length articles))
3782 (marked (+ (length gnus-newsgroup-marked)
3783 (length gnus-newsgroup-dormant)))
3791 ((and (or (<= scored marked) (= scored number))
3792 (numberp gnus-large-newsgroup)
3793 (> number gnus-large-newsgroup))
3797 "How many articles from %s (default %d): "
3798 (gnus-limit-string gnus-newsgroup-name 35)
3800 (if (string-match "^[ \t]*$" input) number input)))
3801 ((and (> scored marked) (< scored number)
3802 (> (- scored number) 20))
3805 (format "%s %s (%d scored, %d total): "
3806 "How many articles from"
3807 group scored number))))
3808 (if (string-match "^[ \t]*$" input)
3812 (setq select (if (stringp select) (string-to-number select) select))
3813 (if (or (null select) (zerop select))
3815 (if (and (not (zerop scored)) (<= (abs select) scored))
3817 (setq articles (sort scored-list '<))
3818 (setq number (length articles)))
3819 (setq articles (copy-sequence articles)))
3821 (when (< (abs select) number)
3823 ;; Select the N oldest articles.
3824 (setcdr (nthcdr (1- (abs select)) articles) nil)
3825 ;; Select the N most recent articles.
3826 (setq articles (nthcdr (- number select) articles))))
3827 (setq gnus-newsgroup-unselected
3828 (gnus-sorted-intersection
3829 gnus-newsgroup-unreads
3830 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3833 (defun gnus-killed-articles (killed articles)
3836 (when (inline (gnus-member-of-range (car articles) killed))
3837 (push (car articles) out))
3838 (setq articles (cdr articles)))
3841 (defun gnus-uncompress-marks (marks)
3842 "Uncompress the mark ranges in MARKS."
3843 (let ((uncompressed '(score bookmark))
3846 (if (memq (caar marks) uncompressed)
3847 (push (car marks) out)
3848 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3849 (setq marks (cdr marks)))
3852 (defun gnus-adjust-marked-articles (info)
3853 "Set all article lists and remove all marks that are no longer legal."
3854 (let* ((marked-lists (gnus-info-marks info))
3855 (active (gnus-active (gnus-info-group info)))
3858 (types gnus-article-mark-lists)
3859 (uncompressed '(score bookmark killed))
3860 marks var articles article mark)
3863 (setq marks (pop marked-lists))
3864 (set (setq var (intern (format "gnus-newsgroup-%s"
3865 (car (rassq (setq mark (car marks))
3867 (if (memq (car marks) uncompressed) (cdr marks)
3868 (gnus-uncompress-range (cdr marks))))
3870 (setq articles (symbol-value var))
3872 ;; All articles have to be subsets of the active articles.
3874 ;; Adjust "simple" lists.
3875 ((memq mark '(tick dormant expire reply save))
3877 (when (or (< (setq article (pop articles)) min) (> article max))
3878 (set var (delq article (symbol-value var))))))
3880 ((memq mark uncompressed)
3881 (when (not (listp (cdr (symbol-value var))))
3882 (set var (list (symbol-value var))))
3883 (when (not (listp (cdr articles)))
3884 (setq articles (list articles)))
3886 (when (or (not (consp (setq article (pop articles))))
3887 (< (car article) min)
3888 (> (car article) max))
3889 (set var (delq article (symbol-value var))))))))))
3891 (defun gnus-update-missing-marks (missing)
3892 "Go through the list of MISSING articles and remove them mark lists."
3894 (let ((types gnus-article-mark-lists)
3896 ;; Go through all types.
3898 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3899 (when (symbol-value var)
3900 ;; This list has articles. So we delete all missing articles
3904 (set var (delq (pop m) (symbol-value var)))))))))
3906 (defun gnus-update-marks ()
3907 "Enter the various lists of marked articles into the newsgroup info list."
3908 (let ((types gnus-article-mark-lists)
3909 (info (gnus-get-info gnus-newsgroup-name))
3910 (uncompressed '(score bookmark killed))
3911 type list newmarked symbol)
3913 ;; Add all marks lists that are non-nil to the list of marks lists.
3914 (while (setq type (pop types))
3915 (when (setq list (symbol-value
3917 (intern (format "gnus-newsgroup-%s"
3920 ;; Get rid of the entries of the articles that have the
3922 (when (and (eq (cdr type) 'score)
3926 (prev (cons nil list))
3929 (if (or (not (consp (car arts)))
3930 (= (cdar arts) gnus-summary-default-score))
3931 (setcdr prev (cdr arts))
3933 (setq arts (cdr arts)))
3934 (setq list (cdr all))))
3936 (push (cons (cdr type)
3937 (if (memq (cdr type) uncompressed) list
3938 (gnus-compress-sequence
3939 (set symbol (sort list '<)) t)))
3942 ;; Enter these new marks into the info of the group.
3944 (setcar (nthcdr 3 info) newmarked)
3945 ;; Add the marks lists to the end of the info.
3947 (setcdr (nthcdr 2 info) (list newmarked))))
3949 ;; Cut off the end of the info if there's nothing else there.
3953 (when (nthcdr (decf i) info)
3954 (setcdr (nthcdr i info) nil)))))))
3956 (defun gnus-set-mode-line (where)
3957 "This function sets the mode line of the article or summary buffers.
3958 If WHERE is `summary', the summary mode line format will be used."
3959 ;; Is this mode line one we keep updated?
3960 (when (memq where gnus-updated-mode-lines)
3963 ;; We evaluate this in the summary buffer since these
3964 ;; variables are buffer-local to that buffer.
3965 (set-buffer gnus-summary-buffer)
3966 ;; We bind all these variables that are used in the `eval' form
3968 (let* ((mformat (symbol-value
3970 (format "gnus-%s-mode-line-format-spec" where))))
3971 (gnus-tmp-group-name gnus-newsgroup-name)
3972 (gnus-tmp-article-number (or gnus-current-article 0))
3973 (gnus-tmp-unread gnus-newsgroup-unreads)
3974 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3975 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3976 (gnus-tmp-unread-and-unselected
3977 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3978 (zerop gnus-tmp-unselected))
3980 ((zerop gnus-tmp-unselected)
3981 (format "{%d more}" gnus-tmp-unread-and-unticked))
3982 (t (format "{%d(+%d) more}"
3983 gnus-tmp-unread-and-unticked
3984 gnus-tmp-unselected))))
3986 (if (and gnus-current-headers
3987 (vectorp gnus-current-headers))
3988 (gnus-mode-string-quote
3989 (mail-header-subject gnus-current-headers))
3991 bufname-length max-len
3992 gnus-tmp-header);; passed as argument to any user-format-funcs
3993 (setq mode-string (eval mformat))
3994 (setq bufname-length (if (string-match "%b" mode-string)
3997 (if (eq where 'summary)
3999 (get-buffer gnus-article-buffer))))
4002 (setq max-len (max 4 (if gnus-mode-non-string-length
4004 gnus-mode-non-string-length
4006 (length mode-string))))
4007 ;; We might have to chop a bit of the string off...
4008 (when (> (length mode-string) max-len)
4010 (concat (gnus-truncate-string mode-string (- max-len 3))
4012 ;; Pad the mode string a bit.
4013 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4014 ;; Update the mode line.
4015 (setq mode-line-buffer-identification
4016 (gnus-mode-line-buffer-identification (list mode-string)))
4017 (set-buffer-modified-p t))))
4019 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4020 "Go through the HEADERS list and add all Xrefs to a hash table.
4021 The resulting hash table is returned, or nil if no Xrefs were found."
4022 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4023 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4024 (xref-hashtb (gnus-make-hashtable))
4025 start group entry number xrefs header)
4027 (setq header (pop headers))
4028 (when (and (setq xrefs (mail-header-xref header))
4029 (not (memq (setq number (mail-header-number header))
4032 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4033 (setq start (match-end 0))
4034 (setq group (if prefix
4035 (concat prefix (substring xrefs (match-beginning 1)
4037 (substring xrefs (match-beginning 1) (match-end 1))))
4039 (string-to-int (substring xrefs (match-beginning 2)
4041 (if (setq entry (gnus-gethash group xref-hashtb))
4042 (setcdr entry (cons number (cdr entry)))
4043 (gnus-sethash group (cons number nil) xref-hashtb)))))
4044 (and start xref-hashtb)))
4046 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4047 "Look through all the headers and mark the Xrefs as read."
4048 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4049 name entry info xref-hashtb idlist method nth4)
4051 (set-buffer gnus-group-buffer)
4052 (when (setq xref-hashtb
4053 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4056 (unless (string= from-newsgroup (setq name (symbol-name group)))
4057 (setq idlist (symbol-value group))
4058 ;; Dead groups are not updated.
4060 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4062 (when (stringp (setq nth4 (gnus-info-method info)))
4063 (setq nth4 (gnus-server-to-method nth4))))
4064 ;; Only do the xrefs if the group has the same
4065 ;; select method as the group we have just read.
4066 (or (gnus-methods-equal-p
4067 nth4 (gnus-find-method-for-group from-newsgroup))
4069 (equal nth4 (setq method (gnus-find-method-for-group
4071 (and (equal (car nth4) (car method))
4072 (equal (nth 1 nth4) (nth 1 method))))
4073 gnus-use-cross-reference
4074 (or (not (eq gnus-use-cross-reference t))
4076 ;; Only do cross-references on subscribed
4077 ;; groups, if that is what is wanted.
4078 (<= (gnus-info-level info) gnus-level-subscribed))
4079 (gnus-group-make-articles-read name idlist))))
4082 (defun gnus-compute-read-articles (group articles)
4083 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4084 (info (nth 2 entry))
4085 (active (gnus-active group)))
4087 ;; First peel off all illegal article numbers.
4089 (let ((ids articles)
4091 (while (setq id (pop ids))
4092 (when (and first (> id (cdr active)))
4093 ;; We'll end up in this situation in one particular
4094 ;; obscure situation. If you re-scan a group and get
4095 ;; a new article that is cross-posted to a different
4096 ;; group that has not been re-scanned, you might get
4097 ;; crossposted article that has a higher number than
4098 ;; Gnus believes possible. So we re-activate this
4099 ;; group as well. This might mean doing the
4100 ;; crossposting thingy will *increase* the number
4101 ;; of articles in some groups. Tsk, tsk.
4102 (setq active (or (gnus-activate-group group) active)))
4103 (when (or (> id (cdr active))
4104 (< id (car active)))
4105 (setq articles (delq id articles))))))
4106 ;; If the read list is nil, we init it.
4108 (null (gnus-info-read info))
4110 (setq ninfo (cons 1 (1- (car active))))
4111 (setq ninfo (gnus-info-read info)))
4112 ;; Then we add the read articles to the range.
4114 ninfo (setq articles (sort articles '<))))))
4116 (defun gnus-group-make-articles-read (group articles)
4117 "Update the info of GROUP to say that ARTICLES are read."
4119 (entry (gnus-gethash group gnus-newsrc-hashtb))
4120 (info (nth 2 entry))
4121 (active (gnus-active group))
4124 (setq range (gnus-compute-read-articles group articles))
4126 (set-buffer gnus-group-buffer)
4129 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4130 (gnus-info-set-read ',info ',(gnus-info-read info))
4131 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4132 (gnus-group-update-group ,group t))))
4133 ;; Add the read articles to the range.
4134 (gnus-info-set-read info range)
4135 ;; Then we have to re-compute how many unread
4136 ;; articles there are in this group.
4140 (setq num (- (1+ (cdr active)) (car active))))
4141 ((not (listp (cdr range)))
4142 (setq num (- (cdr active) (- (1+ (cdr range))
4146 (if (numberp (car range))
4148 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4149 (setq range (cdr range)))
4150 (setq num (- (cdr active) num))))
4151 ;; Update the number of unread articles.
4153 ;; Update the group buffer.
4154 (gnus-group-update-group group t)))))
4156 (defun gnus-methods-equal-p (m1 m2)
4157 (let ((m1 (or m1 gnus-select-method))
4158 (m2 (or m2 gnus-select-method)))
4160 (and (eq (car m1) (car m2))
4161 (or (not (memq 'address (assoc (symbol-name (car m1))
4162 gnus-valid-select-methods)))
4163 (equal (nth 1 m1) (nth 1 m2)))))))
4165 (defvar gnus-newsgroup-none-id 0)
4167 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4168 (let ((cur nntp-server-buffer)
4171 (save-excursion (set-buffer gnus-summary-buffer)
4172 gnus-newsgroup-dependencies)))
4173 headers id id-dep ref-dep end ref)
4175 (set-buffer nntp-server-buffer)
4176 ;; Translate all TAB characters into SPACE characters.
4177 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4178 (run-hooks 'gnus-parse-headers-hook)
4179 (let ((case-fold-search t)
4180 in-reply-to header p lines)
4181 (goto-char (point-min))
4182 ;; Search to the beginning of the next header. Error messages
4183 ;; do not begin with 2 or 3.
4184 (while (re-search-forward "^[23][0-9]+ " nil t)
4187 ;; This implementation of this function, with nine
4188 ;; search-forwards instead of the one re-search-forward and
4189 ;; a case (which basically was the old function) is actually
4190 ;; about twice as fast, even though it looks messier. You
4191 ;; can't have everything, I guess. Speed and elegance
4192 ;; doesn't always go hand in hand.
4201 (narrow-to-region (point)
4202 (or (and (search-forward "\n.\n" nil t)
4208 (if (search-forward "\nsubject: " nil t)
4209 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4211 gnus-unstructured-field-decoder (nnheader-header-value))
4216 (if (search-forward "\nfrom: " nil t)
4217 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4219 gnus-structured-field-decoder (nnheader-header-value))
4224 (if (search-forward "\ndate: " nil t)
4225 (nnheader-header-value) ""))
4229 (setq id (if (search-forward "\nmessage-id:" nil t)
4231 (1- (or (search-forward "<" nil t) (point)))
4232 (or (search-forward ">" nil t) (point)))
4233 ;; If there was no message-id, we just fake one
4234 ;; to make subsequent routines simpler.
4235 (nnheader-generate-fake-message-id))))
4239 (if (search-forward "\nreferences: " nil t)
4243 (nnheader-header-value)
4248 (search-backward ">" end t)
4251 (search-backward "<" end t)
4253 ;; Get the references from the in-reply-to header if there
4254 ;; were no references and the in-reply-to header looks
4256 (if (and (search-forward "\nin-reply-to: " nil t)
4257 (setq in-reply-to (nnheader-header-value))
4258 (string-match "<[^>]+>" in-reply-to))
4259 (setq ref (substring in-reply-to (match-beginning 0)
4267 (if (search-forward "\nlines: " nil t)
4268 (if (numberp (setq lines (ignore-errors (read cur))))
4274 (and (search-forward "\nxref: " nil t)
4275 (nnheader-header-value)))))
4276 (when (equal id ref)
4278 ;; We do the threading while we read the headers. The
4279 ;; message-id and the last reference are both entered into
4280 ;; the same hash table. Some tippy-toeing around has to be
4281 ;; done in case an article has arrived before the article
4282 ;; which it refers to.
4283 (if (boundp (setq id-dep (intern id dependencies)))
4284 (if (and (car (symbol-value id-dep))
4286 ;; An article with this Message-ID has already been seen.
4287 (if gnus-summary-ignore-duplicates
4288 ;; We ignore this one, except we add
4289 ;; any additional Xrefs (in case the two articles
4290 ;; came from different servers).
4292 (mail-header-set-xref
4293 (car (symbol-value id-dep))
4294 (concat (or (mail-header-xref
4295 (car (symbol-value id-dep)))
4297 (or (mail-header-xref header) "")))
4299 ;; We rename the Message-ID.
4301 (setq id-dep (intern (setq id (nnmail-message-id))
4304 (mail-header-set-id header id))
4305 (setcar (symbol-value id-dep) header))
4306 (set id-dep (list header)))
4308 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4309 (setcdr (symbol-value ref-dep)
4310 (nconc (cdr (symbol-value ref-dep))
4311 (list (symbol-value id-dep))))
4312 (set ref-dep (list nil (symbol-value id-dep))))
4313 (push header headers))
4314 (goto-char (point-max))
4316 (nreverse headers)))))
4318 ;; The following macros and functions were written by Felix Lee
4319 ;; <flee@cse.psu.edu>.
4321 (defmacro gnus-nov-read-integer ()
4323 (if (= (following-char) ?\t)
4325 (let ((num (ignore-errors (read buffer))))
4326 (if (numberp num) num 0)))
4330 (defmacro gnus-nov-skip-field ()
4331 '(search-forward "\t" eol 'move))
4333 (defmacro gnus-nov-field ()
4334 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4336 ;; (defvar gnus-nov-none-counter 0)
4338 ;; This function has to be called with point after the article number
4339 ;; on the beginning of the line.
4340 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4341 (let ((eol (gnus-point-at-eol))
4342 (buffer (current-buffer))
4343 header ref id id-dep ref-dep)
4345 ;; overview: [num subject from date id refs chars lines misc]
4348 (narrow-to-region (point) eol)
4355 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4357 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4359 gnus-structured-field-decoder (gnus-nov-field)) ; from
4360 (gnus-nov-field) ; date
4361 (setq id (or (gnus-nov-field)
4362 (nnheader-generate-fake-message-id))) ; id
4364 (let ((beg (point)))
4365 (search-forward "\t" eol)
4366 (if (search-backward ">" beg t)
4370 (search-backward "<" beg t)))
4373 (gnus-nov-field)) ; refs
4374 (gnus-nov-read-integer) ; chars
4375 (gnus-nov-read-integer) ; lines
4376 (if (= (following-char) ?\n)
4378 (gnus-nov-field))))) ; misc
4382 ;; We build the thread tree.
4383 (when (equal id ref)
4384 ;; This article refers back to itself. Naughty, naughty.
4386 (if (boundp (setq id-dep (intern id dependencies)))
4387 (if (and (car (symbol-value id-dep))
4389 ;; An article with this Message-ID has already been seen.
4390 (if gnus-summary-ignore-duplicates
4391 ;; We ignore this one, except we add any additional
4392 ;; Xrefs (in case the two articles came from different
4395 (mail-header-set-xref
4396 (car (symbol-value id-dep))
4397 (concat (or (mail-header-xref
4398 (car (symbol-value id-dep)))
4400 (or (mail-header-xref header) "")))
4402 ;; We rename the Message-ID.
4404 (setq id-dep (intern (setq id (nnmail-message-id))
4407 (mail-header-set-id header id))
4408 (setcar (symbol-value id-dep) header))
4409 (set id-dep (list header)))
4411 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4412 (setcdr (symbol-value ref-dep)
4413 (nconc (cdr (symbol-value ref-dep))
4414 (list (symbol-value id-dep))))
4415 (set ref-dep (list nil (symbol-value id-dep)))))
4418 ;; Goes through the xover lines and returns a list of vectors
4419 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4420 force-new dependencies
4421 group also-fetch-heads)
4422 "Parse the news overview data in the server buffer, and return a
4423 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4424 ;; Get the Xref when the users reads the articles since most/some
4425 ;; NNTP servers do not include Xrefs when using XOVER.
4426 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4427 (let ((cur nntp-server-buffer)
4428 (dependencies (or dependencies gnus-newsgroup-dependencies))
4429 number headers header)
4431 (set-buffer nntp-server-buffer)
4432 ;; Allow the user to mangle the headers before parsing them.
4433 (run-hooks 'gnus-parse-headers-hook)
4434 (goto-char (point-min))
4437 (while (and sequence (not (eobp)))
4438 (setq number (read cur))
4439 (while (and sequence
4440 (< (car sequence) number))
4441 (setq sequence (cdr sequence)))
4443 (eq number (car sequence))
4445 (setq sequence (cdr sequence))
4446 (setq header (inline
4447 (gnus-nov-parse-line
4448 number dependencies force-new))))
4449 (push header headers))
4452 (gnus-error 4 "Strange nov line (%d)"
4453 (count-lines (point-min) (point)))))
4455 ;; A common bug in inn is that if you have posted an article and
4456 ;; then retrieves the active file, it will answer correctly --
4457 ;; the new article is included. However, a NOV entry for the
4458 ;; article may not have been generated yet, so this may fail.
4459 ;; We work around this problem by retrieving the last few
4460 ;; headers using HEAD.
4461 (if (or (not also-fetch-heads)
4463 ;; We (probably) got all the headers.
4465 (let ((gnus-nov-is-evil t))
4468 (when (gnus-retrieve-headers sequence group)
4469 (gnus-get-newsgroup-headers))))))))
4471 (defun gnus-article-get-xrefs ()
4472 "Fill in the Xref value in `gnus-current-headers', if necessary.
4473 This is meant to be called in `gnus-article-internal-prepare-hook'."
4474 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4475 gnus-current-headers)))
4476 (or (not gnus-use-cross-reference)
4478 (and (mail-header-xref headers)
4479 (not (string= (mail-header-xref headers) "")))
4480 (let ((case-fold-search t)
4483 (nnheader-narrow-to-headers)
4484 (goto-char (point-min))
4485 (when (or (and (eq (downcase (following-char)) ?x)
4486 (looking-at "Xref:"))
4487 (search-forward "\nXref:" nil t))
4488 (goto-char (1+ (match-end 0)))
4489 (setq xref (buffer-substring (point)
4490 (progn (end-of-line) (point))))
4491 (mail-header-set-xref headers xref)))))))
4493 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4494 "Find article ID and insert the summary line for that article."
4495 (let ((header (if (and old-header use-old-header)
4496 old-header (gnus-read-header id)))
4497 (number (and (numberp id) id))
4500 ;; Rebuild the thread that this article is part of and go to the
4501 ;; article we have fetched.
4502 (when (and (not gnus-show-threads)
4504 (when (setq d (gnus-data-find (mail-header-number old-header)))
4505 (goto-char (gnus-data-pos d))
4508 (- (gnus-point-at-bol)
4510 (1+ (gnus-point-at-eol))
4511 (gnus-delete-line))))))
4513 (mail-header-set-number header (mail-header-number old-header)))
4514 (setq gnus-newsgroup-sparse
4515 (delq (setq number (mail-header-number header))
4516 gnus-newsgroup-sparse))
4517 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4518 (gnus-rebuild-thread (mail-header-id header))
4519 (gnus-summary-goto-subject number nil t))
4520 (when (and (numberp number)
4522 ;; We have to update the boundaries even if we can't fetch the
4523 ;; article if ID is a number -- so that the next `P' or `N'
4524 ;; command will fetch the previous (or next) article even
4525 ;; if the one we tried to fetch this time has been canceled.
4526 (when (> number gnus-newsgroup-end)
4527 (setq gnus-newsgroup-end number))
4528 (when (< number gnus-newsgroup-begin)
4529 (setq gnus-newsgroup-begin number))
4530 (setq gnus-newsgroup-unselected
4531 (delq number gnus-newsgroup-unselected)))
4532 ;; Report back a success?
4533 (and header (mail-header-number header))))
4535 ;;; Process/prefix in the summary buffer
4537 (defun gnus-summary-work-articles (n)
4538 "Return a list of articles to be worked upon. The prefix argument,
4539 the list of process marked articles, and the current article will be
4540 taken into consideration."
4543 ;; A numerical prefix has been given.
4544 (setq n (prefix-numeric-value n))
4545 (let ((backward (< n 0))
4546 (n (abs (prefix-numeric-value n)))
4551 (push (setq article (gnus-summary-article-number))
4554 (gnus-summary-find-prev nil article)
4555 (gnus-summary-find-next nil article)))
4557 (nreverse articles)))
4558 ((gnus-region-active-p)
4559 ;; Work on the region between point and mark.
4560 (let ((max (max (point) (mark)))
4563 (goto-char (min (point) (mark)))
4566 (push (setq article (gnus-summary-article-number)) articles)
4567 (gnus-summary-find-next nil article)
4569 (nreverse articles))))
4570 (gnus-newsgroup-processable
4571 ;; There are process-marked articles present.
4572 ;; Save current state.
4573 (gnus-summary-save-process-mark)
4575 (reverse gnus-newsgroup-processable))
4577 ;; Just return the current article.
4578 (list (gnus-summary-article-number)))))
4580 (defun gnus-summary-save-process-mark ()
4581 "Push the current set of process marked articles on the stack."
4583 (push (copy-sequence gnus-newsgroup-processable)
4584 gnus-newsgroup-process-stack))
4586 (defun gnus-summary-kill-process-mark ()
4587 "Push the current set of process marked articles on the stack and unmark."
4589 (gnus-summary-save-process-mark)
4590 (gnus-summary-unmark-all-processable))
4592 (defun gnus-summary-yank-process-mark ()
4593 "Pop the last process mark state off the stack and restore it."
4595 (unless gnus-newsgroup-process-stack
4596 (error "Empty mark stack"))
4597 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4599 (defun gnus-summary-process-mark-set (set)
4600 "Make SET into the current process marked articles."
4601 (gnus-summary-unmark-all-processable)
4603 (gnus-summary-set-process-mark (pop set))))
4605 ;;; Searching and stuff
4607 (defun gnus-summary-search-group (&optional backward use-level)
4608 "Search for next unread newsgroup.
4609 If optional argument BACKWARD is non-nil, search backward instead."
4611 (set-buffer gnus-group-buffer)
4612 (when (gnus-group-search-forward
4613 backward nil (if use-level (gnus-group-group-level) nil))
4614 (gnus-group-group-name))))
4616 (defun gnus-summary-best-group (&optional exclude-group)
4617 "Find the name of the best unread group.
4618 If EXCLUDE-GROUP, do not go to this group."
4620 (set-buffer gnus-group-buffer)
4622 (gnus-group-best-unread-group exclude-group))))
4624 (defun gnus-summary-find-next (&optional unread article backward)
4625 (if backward (gnus-summary-find-prev)
4626 (let* ((dummy (gnus-summary-article-intangible-p))
4627 (article (or article (gnus-summary-article-number)))
4628 (arts (gnus-data-find-list article))
4630 (when (and (not dummy)
4631 (or (not gnus-summary-check-current)
4633 (not (gnus-data-unread-p (car arts)))))
4634 (setq arts (cdr arts)))
4639 (when (gnus-data-unread-p (car arts))
4640 (setq result (car arts)
4642 (setq arts (cdr arts)))
4645 (goto-char (gnus-data-pos result))
4646 (gnus-data-number result)))))
4648 (defun gnus-summary-find-prev (&optional unread article)
4649 (let* ((eobp (eobp))
4650 (article (or article (gnus-summary-article-number)))
4651 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4653 (when (and (not eobp)
4654 (or (not gnus-summary-check-current)
4656 (not (gnus-data-unread-p (car arts)))))
4657 (setq arts (cdr arts)))
4662 (when (gnus-data-unread-p (car arts))
4663 (setq result (car arts)
4665 (setq arts (cdr arts)))
4668 (goto-char (gnus-data-pos result))
4669 (gnus-data-number result))))
4671 (defun gnus-summary-find-subject (subject &optional unread backward article)
4672 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4673 (article (or article (gnus-summary-article-number)))
4674 (articles (gnus-data-list backward))
4675 (arts (gnus-data-find-list article articles))
4677 (when (or (not gnus-summary-check-current)
4679 (not (gnus-data-unread-p (car arts))))
4680 (setq arts (cdr arts)))
4682 (and (or (not unread)
4683 (gnus-data-unread-p (car arts)))
4684 (vectorp (gnus-data-header (car arts)))
4686 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4687 (setq result (car arts)
4689 (setq arts (cdr arts)))
4691 (goto-char (gnus-data-pos result))
4692 (gnus-data-number result))))
4694 (defun gnus-summary-search-forward (&optional unread subject backward)
4695 "Search forward for an article.
4696 If UNREAD, look for unread articles. If SUBJECT, look for
4697 articles with that subject. If BACKWARD, search backward instead."
4698 (cond (subject (gnus-summary-find-subject subject unread backward))
4699 (backward (gnus-summary-find-prev unread))
4700 (t (gnus-summary-find-next unread))))
4702 (defun gnus-recenter (&optional n)
4703 "Center point in window and redisplay frame.
4704 Also do horizontal recentering."
4706 (when (and gnus-auto-center-summary
4707 (not (eq gnus-auto-center-summary 'vertical)))
4708 (gnus-horizontal-recenter))
4711 (defun gnus-summary-recenter ()
4712 "Center point in the summary window.
4713 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4714 displayed, no centering will be performed."
4715 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4716 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4717 (let* ((top (cond ((< (window-height) 4) 0)
4718 ((< (window-height) 7) 1)
4720 (height (1- (window-height)))
4721 (bottom (save-excursion (goto-char (point-max))
4722 (forward-line (- height))
4724 (window (get-buffer-window (current-buffer))))
4725 ;; The user has to want it.
4726 (when gnus-auto-center-summary
4727 (when (get-buffer-window gnus-article-buffer)
4728 ;; Only do recentering when the article buffer is displayed,
4729 ;; Set the window start to either `bottom', which is the biggest
4730 ;; possible valid number, or the second line from the top,
4731 ;; whichever is the least.
4733 window (min bottom (save-excursion
4734 (forward-line (- top)) (point)))))
4735 ;; Do horizontal recentering while we're at it.
4736 (when (and (get-buffer-window (current-buffer) t)
4737 (not (eq gnus-auto-center-summary 'vertical)))
4738 (let ((selected (selected-window)))
4739 (select-window (get-buffer-window (current-buffer) t))
4740 (gnus-summary-position-point)
4741 (gnus-horizontal-recenter)
4742 (select-window selected))))))
4744 (defun gnus-summary-jump-to-group (newsgroup)
4745 "Move point to NEWSGROUP in group mode buffer."
4746 ;; Keep update point of group mode buffer if visible.
4747 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4748 (save-window-excursion
4749 ;; Take care of tree window mode.
4750 (when (get-buffer-window gnus-group-buffer)
4751 (pop-to-buffer gnus-group-buffer))
4752 (gnus-group-jump-to-group newsgroup))
4754 ;; Take care of tree window mode.
4755 (if (get-buffer-window gnus-group-buffer)
4756 (pop-to-buffer gnus-group-buffer)
4757 (set-buffer gnus-group-buffer))
4758 (gnus-group-jump-to-group newsgroup))))
4760 ;; This function returns a list of article numbers based on the
4761 ;; difference between the ranges of read articles in this group and
4762 ;; the range of active articles.
4763 (defun gnus-list-of-unread-articles (group)
4764 (let* ((read (gnus-info-read (gnus-get-info group)))
4765 (active (or (gnus-active group) (gnus-activate-group group)))
4768 ;; If none are read, then all are unread.
4770 (setq first (car active))
4771 ;; If the range of read articles is a single range, then the
4772 ;; first unread article is the article after the last read
4773 ;; article. Sounds logical, doesn't it?
4774 (if (not (listp (cdr read)))
4775 (setq first (1+ (cdr read)))
4776 ;; `read' is a list of ranges.
4777 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4783 (while (< first nlast)
4785 (setq first (1+ first))))
4786 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4787 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4788 (setq read (cdr read)))))
4789 ;; And add the last unread articles.
4790 (while (<= first last)
4792 (setq first (1+ first)))
4793 ;; Return the list of unread articles.
4794 (delq 0 (nreverse unread))))
4796 (defun gnus-list-of-read-articles (group)
4797 "Return a list of unread, unticked and non-dormant articles."
4798 (let* ((info (gnus-get-info group))
4799 (marked (gnus-info-marks info))
4800 (active (gnus-active group)))
4802 (gnus-set-difference
4803 (gnus-sorted-complement
4804 (gnus-uncompress-range active)
4805 (gnus-list-of-unread-articles group))
4807 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4808 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4810 ;; Various summary commands
4812 (defun gnus-summary-universal-argument (arg)
4813 "Perform any operation on all articles that are process/prefixed."
4815 (gnus-set-global-variables)
4816 (let ((articles (gnus-summary-work-articles arg))
4823 (substitute-command-keys
4824 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4827 (gnus-error 1 "Undefined key")
4830 (gnus-summary-goto-subject (setq article (pop articles)))
4831 (let (gnus-newsgroup-processable)
4832 (command-execute func))
4833 (gnus-summary-remove-process-mark article)))))
4834 (gnus-summary-position-point))
4836 (defun gnus-summary-toggle-truncation (&optional arg)
4837 "Toggle truncation of summary lines.
4838 With arg, turn line truncation on iff arg is positive."
4840 (setq truncate-lines
4841 (if (null arg) (not truncate-lines)
4842 (> (prefix-numeric-value arg) 0)))
4845 (defun gnus-summary-reselect-current-group (&optional all rescan)
4846 "Exit and then reselect the current newsgroup.
4847 The prefix argument ALL means to select all articles."
4849 (gnus-set-global-variables)
4850 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4851 (error "Ephemeral groups can't be reselected"))
4852 (let ((current-subject (gnus-summary-article-number))
4853 (group gnus-newsgroup-name))
4854 (setq gnus-newsgroup-begin nil)
4856 ;; We have to adjust the point of group mode buffer because
4857 ;; point was moved to the next unread newsgroup by exiting.
4858 (gnus-summary-jump-to-group group)
4861 (gnus-group-get-new-news-this-group 1)))
4862 (gnus-group-read-group all t)
4863 (gnus-summary-goto-subject current-subject nil t)))
4865 (defun gnus-summary-rescan-group (&optional all)
4866 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4868 (gnus-summary-reselect-current-group all t))
4870 (defun gnus-summary-update-info (&optional non-destructive)
4872 (let ((group gnus-newsgroup-name))
4873 (when gnus-newsgroup-kill-headers
4874 (setq gnus-newsgroup-killed
4875 (gnus-compress-sequence
4877 (gnus-set-sorted-intersection
4878 (gnus-uncompress-range gnus-newsgroup-killed)
4879 (setq gnus-newsgroup-unselected
4880 (sort gnus-newsgroup-unselected '<)))
4881 (setq gnus-newsgroup-unreads
4882 (sort gnus-newsgroup-unreads '<)))
4884 (unless (listp (cdr gnus-newsgroup-killed))
4885 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4886 (let ((headers gnus-newsgroup-headers))
4887 (when (and (not gnus-save-score)
4888 (not non-destructive))
4889 (setq gnus-newsgroup-scored nil))
4890 ;; Set the new ranges of read articles.
4892 (set-buffer gnus-group-buffer)
4893 (gnus-undo-force-boundary))
4894 (gnus-update-read-articles
4895 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4896 ;; Set the current article marks.
4898 ;; Do the cross-ref thing.
4899 (when gnus-use-cross-reference
4900 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4901 ;; Do adaptive scoring, and possibly save score files.
4902 (when gnus-newsgroup-adaptive
4903 (gnus-score-adaptive))
4904 (when gnus-use-scoring
4906 ;; Do not switch windows but change the buffer to work.
4907 (set-buffer gnus-group-buffer)
4908 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4909 (gnus-group-update-group group))))))
4911 (defun gnus-summary-save-newsrc (&optional force)
4912 "Save the current number of read/marked articles in the dribble buffer.
4913 The dribble buffer will then be saved.
4914 If FORCE (the prefix), also save the .newsrc file(s)."
4916 (gnus-summary-update-info t)
4918 (gnus-save-newsrc-file)
4919 (gnus-dribble-save)))
4921 (defun gnus-summary-exit (&optional temporary)
4922 "Exit reading current newsgroup, and then return to group selection mode.
4923 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4925 (gnus-set-global-variables)
4926 (gnus-kill-save-kill-buffer)
4927 (let* ((group gnus-newsgroup-name)
4928 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4931 (buf (current-buffer)))
4932 (run-hooks 'gnus-summary-prepare-exit-hook)
4933 ;; If we have several article buffers, we kill them at exit.
4934 (unless gnus-single-article-buffer
4935 (gnus-kill-buffer gnus-original-article-buffer)
4936 (setq gnus-article-current nil))
4937 (when gnus-use-cache
4938 (gnus-cache-possibly-remove-articles)
4939 (gnus-cache-save-buffers))
4940 (gnus-async-prefetch-remove-group group)
4941 (when gnus-suppress-duplicates
4942 (gnus-dup-enter-articles))
4943 (when gnus-use-trees
4944 (gnus-tree-close group))
4945 ;; Make all changes in this group permanent.
4947 (run-hooks 'gnus-exit-group-hook)
4948 (gnus-summary-update-info))
4949 (gnus-close-group group)
4950 ;; Make sure where we were, and go to next newsgroup.
4951 (set-buffer gnus-group-buffer)
4953 (gnus-group-jump-to-group group))
4954 (run-hooks 'gnus-summary-exit-hook)
4956 (gnus-group-next-unread-group 1))
4957 (setq group-point (point))
4960 ;; If we have several article buffers, we kill them at exit.
4961 (unless gnus-single-article-buffer
4962 (gnus-kill-buffer gnus-article-buffer)
4963 (gnus-kill-buffer gnus-original-article-buffer)
4964 (setq gnus-article-current nil))
4966 (if (not gnus-kill-summary-on-exit)
4967 (gnus-deaden-summary)
4968 ;; We set all buffer-local variables to nil. It is unclear why
4969 ;; this is needed, but if we don't, buffer-local variables are
4970 ;; not garbage-collected, it seems. This would the lead to en
4971 ;; ever-growing Emacs.
4972 (gnus-summary-clear-local-variables)
4973 (when (get-buffer gnus-article-buffer)
4974 (bury-buffer gnus-article-buffer))
4975 ;; We clear the global counterparts of the buffer-local
4976 ;; variables as well, just to be on the safe side.
4977 (set-buffer gnus-group-buffer)
4978 (gnus-summary-clear-local-variables)
4979 ;; Return to group mode buffer.
4980 (when (eq mode 'gnus-summary-mode)
4981 (gnus-kill-buffer buf)))
4982 (setq gnus-current-select-method gnus-select-method)
4983 (pop-to-buffer gnus-group-buffer)
4984 ;; Clear the current group name.
4985 (if (not quit-config)
4987 (goto-char group-point)
4988 (gnus-configure-windows 'group 'force))
4989 (gnus-handle-ephemeral-exit quit-config))
4991 (setq gnus-newsgroup-name nil)))))
4993 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4994 (defun gnus-summary-exit-no-update (&optional no-questions)
4995 "Quit reading current newsgroup without updating read article info."
4997 (gnus-set-global-variables)
4998 (let* ((group gnus-newsgroup-name)
4999 (quit-config (gnus-group-quit-config group)))
5000 (when (or no-questions
5002 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5003 ;; If we have several article buffers, we kill them at exit.
5004 (unless gnus-single-article-buffer
5005 (gnus-kill-buffer gnus-article-buffer)
5006 (gnus-kill-buffer gnus-original-article-buffer)
5007 (setq gnus-article-current nil))
5008 (if (not gnus-kill-summary-on-exit)
5009 (gnus-deaden-summary)
5010 (gnus-close-group group)
5011 (gnus-summary-clear-local-variables)
5012 (set-buffer gnus-group-buffer)
5013 (gnus-summary-clear-local-variables)
5014 (when (get-buffer gnus-summary-buffer)
5015 (kill-buffer gnus-summary-buffer)))
5016 (unless gnus-single-article-buffer
5017 (setq gnus-article-current nil))
5018 (when gnus-use-trees
5019 (gnus-tree-close group))
5020 (gnus-async-prefetch-remove-group group)
5021 (when (get-buffer gnus-article-buffer)
5022 (bury-buffer gnus-article-buffer))
5023 ;; Return to the group buffer.
5024 (gnus-configure-windows 'group 'force)
5025 ;; Clear the current group name.
5026 (setq gnus-newsgroup-name nil)
5027 (when (equal (gnus-group-group-name) group)
5028 (gnus-group-next-unread-group 1))
5030 (gnus-handle-ephemeral-exit quit-config)))))
5032 (defun gnus-handle-ephemeral-exit (quit-config)
5033 "Handle movement when leaving an ephemeral group. The state
5034 which existed when entering the ephemeral is reset."
5035 (if (not (buffer-name (car quit-config)))
5036 (gnus-configure-windows 'group 'force)
5037 (set-buffer (car quit-config))
5038 (cond ((eq major-mode 'gnus-summary-mode)
5039 (gnus-set-global-variables))
5040 ((eq major-mode 'gnus-article-mode)
5042 ;; The `gnus-summary-buffer' variable may point
5043 ;; to the old summary buffer when using a single
5045 (unless (gnus-buffer-live-p gnus-summary-buffer)
5046 (set-buffer gnus-group-buffer))
5047 (set-buffer gnus-summary-buffer)
5048 (gnus-set-global-variables))))
5049 (if (or (eq (cdr quit-config) 'article)
5050 (eq (cdr quit-config) 'pick))
5052 ;; The current article may be from the ephemeral group
5053 ;; thus it is best that we reload this article
5054 (gnus-summary-show-article)
5055 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5056 (gnus-configure-windows 'pick 'force)
5057 (gnus-configure-windows (cdr quit-config) 'force)))
5058 (gnus-configure-windows (cdr quit-config) 'force))
5059 (when (eq major-mode 'gnus-summary-mode)
5060 (gnus-summary-next-subject 1 nil t)
5061 (gnus-summary-recenter)
5062 (gnus-summary-position-point))))
5066 (defvar gnus-dead-summary-mode-map nil)
5068 (unless gnus-dead-summary-mode-map
5069 (setq gnus-dead-summary-mode-map (make-keymap))
5070 (suppress-keymap gnus-dead-summary-mode-map)
5071 (substitute-key-definition
5072 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5073 (let ((keys '("\C-d" "\r" "\177" [delete])))
5075 (define-key gnus-dead-summary-mode-map
5076 (pop keys) 'gnus-summary-wake-up-the-dead))))
5078 (defvar gnus-dead-summary-mode nil
5079 "Minor mode for Gnus summary buffers.")
5081 (defun gnus-dead-summary-mode (&optional arg)
5082 "Minor mode for Gnus summary buffers."
5084 (when (eq major-mode 'gnus-summary-mode)
5085 (make-local-variable 'gnus-dead-summary-mode)
5086 (setq gnus-dead-summary-mode
5087 (if (null arg) (not gnus-dead-summary-mode)
5088 (> (prefix-numeric-value arg) 0)))
5089 (when gnus-dead-summary-mode
5090 (gnus-add-minor-mode
5091 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5093 (defun gnus-deaden-summary ()
5094 "Make the current summary buffer into a dead summary buffer."
5095 ;; Kill any previous dead summary buffer.
5096 (when (and gnus-dead-summary
5097 (buffer-name gnus-dead-summary))
5099 (set-buffer gnus-dead-summary)
5100 (when gnus-dead-summary-mode
5101 (kill-buffer (current-buffer)))))
5102 ;; Make this the current dead summary.
5103 (setq gnus-dead-summary (current-buffer))
5104 (gnus-dead-summary-mode 1)
5105 (let ((name (buffer-name)))
5106 (when (string-match "Summary" name)
5108 (concat (substring name 0 (match-beginning 0)) "Dead "
5109 (substring name (match-beginning 0)))
5112 (defun gnus-kill-or-deaden-summary (buffer)
5113 "Kill or deaden the summary BUFFER."
5114 (when (and (buffer-name buffer)
5115 (not gnus-single-article-buffer))
5118 (gnus-kill-buffer gnus-article-buffer)
5119 (gnus-kill-buffer gnus-original-article-buffer)))
5120 (cond (gnus-kill-summary-on-exit
5121 (when (and gnus-use-trees
5122 (and (get-buffer buffer)
5123 (buffer-name (get-buffer buffer))))
5125 (set-buffer (get-buffer buffer))
5126 (gnus-tree-close gnus-newsgroup-name)))
5127 (gnus-kill-buffer buffer))
5128 ((and (get-buffer buffer)
5129 (buffer-name (get-buffer buffer)))
5132 (gnus-deaden-summary)))))
5134 (defun gnus-summary-wake-up-the-dead (&rest args)
5135 "Wake up the dead summary buffer."
5137 (gnus-dead-summary-mode -1)
5138 (let ((name (buffer-name)))
5139 (when (string-match "Dead " name)
5141 (concat (substring name 0 (match-beginning 0))
5142 (substring name (match-end 0)))
5144 (gnus-message 3 "This dead summary is now alive again"))
5146 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5147 (defun gnus-summary-fetch-faq (&optional faq-dir)
5148 "Fetch the FAQ for the current group.
5149 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5153 (when current-prefix-arg
5155 "Faq dir: " (and (listp gnus-group-faq-directory)
5156 (mapcar (lambda (file) (list file))
5157 gnus-group-faq-directory))))))
5158 (let (gnus-faq-buffer)
5159 (when (setq gnus-faq-buffer
5160 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5161 (gnus-configure-windows 'summary-faq))))
5163 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5164 (defun gnus-summary-describe-group (&optional force)
5165 "Describe the current newsgroup."
5167 (gnus-group-describe-group force gnus-newsgroup-name))
5169 (defun gnus-summary-describe-briefly ()
5170 "Describe summary mode commands briefly."
5173 (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")))
5175 ;; Walking around group mode buffer from summary mode.
5177 (defun gnus-summary-next-group (&optional no-article target-group backward)
5178 "Exit current newsgroup and then select next unread newsgroup.
5179 If prefix argument NO-ARTICLE is non-nil, no article is selected
5180 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5181 previous group instead."
5183 (gnus-set-global-variables)
5184 ;; Stop pre-fetching.
5185 (gnus-async-halt-prefetch)
5186 (let ((current-group gnus-newsgroup-name)
5187 (current-buffer (current-buffer))
5189 ;; First we semi-exit this group to update Xrefs and all variables.
5190 ;; We can't do a real exit, because the window conf must remain
5191 ;; the same in case the user is prompted for info, and we don't
5192 ;; want the window conf to change before that...
5193 (gnus-summary-exit t)
5194 (while (not entered)
5195 ;; Then we find what group we are supposed to enter.
5196 (set-buffer gnus-group-buffer)
5197 (gnus-group-jump-to-group current-group)
5200 (if (eq gnus-keep-same-level 'best)
5201 (gnus-summary-best-group gnus-newsgroup-name)
5202 (gnus-summary-search-group backward gnus-keep-same-level))))
5203 (if (not target-group)
5204 ;; There are no further groups, so we return to the group
5207 (gnus-message 5 "Returning to the group buffer")
5209 (when (gnus-buffer-live-p current-buffer)
5210 (set-buffer current-buffer)
5211 (gnus-summary-exit))
5212 (run-hooks 'gnus-group-no-more-groups-hook))
5213 ;; We try to enter the target group.
5214 (gnus-group-jump-to-group target-group)
5215 (let ((unreads (gnus-group-group-unread)))
5216 (if (and (or (eq t unreads)
5217 (and unreads (not (zerop unreads))))
5218 (gnus-summary-read-group
5219 target-group nil no-article
5220 (and (buffer-name current-buffer) current-buffer)))
5222 (setq current-group target-group
5223 target-group nil)))))))
5225 (defun gnus-summary-prev-group (&optional no-article)
5226 "Exit current newsgroup and then select previous unread newsgroup.
5227 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5229 (gnus-summary-next-group no-article nil t))
5231 ;; Walking around summary lines.
5233 (defun gnus-summary-first-subject (&optional unread)
5234 "Go to the first unread subject.
5235 If UNREAD is non-nil, go to the first unread article.
5236 Returns the article selected or nil if there are no unread articles."
5241 ((null gnus-newsgroup-data)
5242 (gnus-message 3 "No articles in the group")
5244 ;; Pick the first article.
5246 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5247 (gnus-data-number (car gnus-newsgroup-data)))
5248 ;; No unread articles.
5249 ((null gnus-newsgroup-unreads)
5250 (gnus-message 3 "No more unread articles")
5252 ;; Find the first unread article.
5254 (let ((data gnus-newsgroup-data))
5256 (not (gnus-data-unread-p (car data))))
5257 (setq data (cdr data)))
5259 (goto-char (gnus-data-pos (car data)))
5260 (gnus-data-number (car data))))))
5261 (gnus-summary-position-point)))
5263 (defun gnus-summary-next-subject (n &optional unread dont-display)
5264 "Go to next N'th summary line.
5265 If N is negative, go to the previous N'th subject line.
5266 If UNREAD is non-nil, only unread articles are selected.
5267 The difference between N and the actual number of steps taken is
5270 (let ((backward (< n 0))
5274 (gnus-summary-find-prev unread)
5275 (gnus-summary-find-next unread)))
5278 (gnus-message 7 "No more%s articles"
5279 (if unread " unread" "")))
5280 (unless dont-display
5281 (gnus-summary-recenter)
5282 (gnus-summary-position-point))
5285 (defun gnus-summary-next-unread-subject (n)
5286 "Go to next N'th unread summary line."
5288 (gnus-summary-next-subject n t))
5290 (defun gnus-summary-prev-subject (n &optional unread)
5291 "Go to previous N'th summary line.
5292 If optional argument UNREAD is non-nil, only unread article is selected."
5294 (gnus-summary-next-subject (- n) unread))
5296 (defun gnus-summary-prev-unread-subject (n)
5297 "Go to previous N'th unread summary line."
5299 (gnus-summary-next-subject (- n) t))
5301 (defun gnus-summary-goto-subject (article &optional force silent)
5302 "Go the subject line of ARTICLE.
5303 If FORCE, also allow jumping to articles not currently shown."
5304 (interactive "nArticle number: ")
5306 (data (gnus-data-find article)))
5307 ;; We read in the article if we have to.
5310 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5311 (setq data (gnus-data-find article)))
5316 (gnus-message 3 "Can't find article %d" article))
5318 (goto-char (gnus-data-pos data))
5321 ;; Walking around summary lines with displaying articles.
5323 (defun gnus-summary-expand-window (&optional arg)
5324 "Make the summary buffer take up the entire Emacs frame.
5325 Given a prefix, will force an `article' buffer configuration."
5327 (gnus-set-global-variables)
5329 (gnus-configure-windows 'article 'force)
5330 (gnus-configure-windows 'summary 'force)))
5332 (defun gnus-summary-display-article (article &optional all-header)
5333 "Display ARTICLE in article buffer."
5334 (gnus-set-global-variables)
5338 (if gnus-summary-display-article-function
5339 (funcall gnus-summary-display-article-function article all-header)
5340 (gnus-article-prepare article all-header))
5341 (run-hooks 'gnus-select-article-hook)
5342 (when (and gnus-current-article
5343 (not (zerop gnus-current-article)))
5344 (gnus-summary-goto-subject gnus-current-article))
5345 (gnus-summary-recenter)
5346 (when (and gnus-use-trees gnus-show-threads)
5347 (gnus-possibly-generate-tree article)
5348 (gnus-highlight-selected-tree article))
5349 ;; Successfully display article.
5350 (gnus-article-set-window-start
5351 (cdr (assq article gnus-newsgroup-bookmarks))))))
5353 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5354 "Select the current article.
5355 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5356 non-nil, the article will be re-fetched even if it already present in
5357 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5359 ;; Make sure we are in the summary buffer to work around bbdb bug.
5360 (unless (eq major-mode 'gnus-summary-mode)
5361 (set-buffer gnus-summary-buffer))
5362 (let ((article (or article (gnus-summary-article-number)))
5363 (all-headers (not (not all-headers))) ;Must be T or NIL.
5364 gnus-summary-display-article-function
5367 (gnus-summary-article-pseudo-p article)
5368 (error "This is a pseudo-article"))
5371 (set-buffer gnus-summary-buffer)
5372 (if (or (and gnus-single-article-buffer
5373 (or (null gnus-current-article)
5374 (null gnus-article-current)
5375 (null (get-buffer gnus-article-buffer))
5376 (not (eq article (cdr gnus-article-current)))
5377 (not (equal (car gnus-article-current)
5378 gnus-newsgroup-name))))
5379 (and (not gnus-single-article-buffer)
5380 (or (null gnus-current-article)
5381 (not (eq gnus-current-article article))))
5383 ;; The requested article is different from the current article.
5385 (gnus-summary-display-article article all-headers)
5387 (when (or all-headers gnus-show-all-headers)
5388 (gnus-article-show-all-headers))
5391 (gnus-article-set-window-start
5392 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5394 (defun gnus-summary-set-current-mark (&optional current-mark)
5395 "Obsolete function."
5398 (defun gnus-summary-next-article (&optional unread subject backward push)
5399 "Select the next article.
5400 If UNREAD, only unread articles are selected.
5401 If SUBJECT, only articles with SUBJECT are selected.
5402 If BACKWARD, the previous article is selected instead of the next."
5404 (gnus-set-global-variables)
5406 ;; Is there such an article?
5407 ((and (gnus-summary-search-forward unread subject backward)
5408 (or (gnus-summary-display-article (gnus-summary-article-number))
5409 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5410 (gnus-summary-position-point))
5411 ;; If not, we try the first unread, if that is wanted.
5413 gnus-auto-select-same
5414 (gnus-summary-first-unread-article))
5415 (gnus-summary-position-point)
5416 (gnus-message 6 "Wrapped"))
5417 ;; Try to get next/previous article not displayed in this group.
5418 ((and gnus-auto-extend-newsgroup
5419 (not unread) (not subject))
5420 (gnus-summary-goto-article
5421 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5423 ;; Go to next/previous group.
5425 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5426 (gnus-summary-jump-to-group gnus-newsgroup-name))
5427 (let ((cmd last-command-char)
5430 (set-buffer gnus-group-buffer)
5433 (if (eq gnus-keep-same-level 'best)
5434 (gnus-summary-best-group gnus-newsgroup-name)
5435 (gnus-summary-search-group backward gnus-keep-same-level))))
5436 ;; For some reason, the group window gets selected. We change
5438 (select-window (get-buffer-window (current-buffer)))
5439 ;; Select next unread newsgroup automagically.
5441 ((or (not gnus-auto-select-next)
5443 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5444 ((or (eq gnus-auto-select-next 'quietly)
5445 (and (eq gnus-auto-select-next 'slightly-quietly)
5447 (and (eq gnus-auto-select-next 'almost-quietly)
5448 (gnus-summary-last-article-p)))
5450 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5452 (gnus-message 7 "No more%s articles (%s)..."
5453 (if unread " unread" "")
5454 (if group (concat "selecting " group)
5456 (gnus-summary-next-group nil group backward)))
5458 (when (gnus-key-press-event-p last-input-event)
5459 (gnus-summary-walk-group-buffer
5460 gnus-newsgroup-name cmd unread backward point))))))))
5462 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5463 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5464 (?\C-p (gnus-group-prev-unread-group 1))))
5465 (cursor-in-echo-area t)
5466 keve key group ended)
5468 (set-buffer gnus-group-buffer)
5471 (if (eq gnus-keep-same-level 'best)
5472 (gnus-summary-best-group gnus-newsgroup-name)
5473 (gnus-summary-search-group backward gnus-keep-same-level))))
5476 5 "No more%s articles%s" (if unread " unread" "")
5478 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5479 (format " (Type %s for %s [%s])"
5480 (single-key-description cmd) group
5481 (car (gnus-gethash group gnus-newsrc-hashtb)))
5482 (format " (Type %s to exit %s)"
5483 (single-key-description cmd)
5484 gnus-newsgroup-name)))
5485 ;; Confirm auto selection.
5486 (setq key (car (setq keve (gnus-read-event-char))))
5489 ((assq key keystrokes)
5490 (let ((obuf (current-buffer)))
5491 (switch-to-buffer gnus-group-buffer)
5493 (gnus-group-jump-to-group group))
5494 (eval (cadr (assq key keystrokes)))
5495 (setq group (gnus-group-group-name))
5496 (switch-to-buffer obuf))
5500 (gnus-ephemeral-group-p gnus-newsgroup-name))
5502 (gnus-summary-next-group nil group backward)))
5504 (push (cdr keve) unread-command-events))))))
5506 (defun gnus-summary-next-unread-article ()
5507 "Select unread article after current one."
5509 (gnus-summary-next-article
5510 (or (not (eq gnus-summary-goto-unread 'never))
5511 (gnus-summary-last-article-p (gnus-summary-article-number)))
5512 (and gnus-auto-select-same
5513 (gnus-summary-article-subject))))
5515 (defun gnus-summary-prev-article (&optional unread subject)
5516 "Select the article after the current one.
5517 If UNREAD is non-nil, only unread articles are selected."
5519 (gnus-summary-next-article unread subject t))
5521 (defun gnus-summary-prev-unread-article ()
5522 "Select unread article before current one."
5524 (gnus-summary-prev-article
5525 (or (not (eq gnus-summary-goto-unread 'never))
5526 (gnus-summary-first-article-p (gnus-summary-article-number)))
5527 (and gnus-auto-select-same
5528 (gnus-summary-article-subject))))
5530 (defun gnus-summary-next-page (&optional lines circular)
5531 "Show next page of the selected article.
5532 If at the end of the current article, select the next article.
5533 LINES says how many lines should be scrolled up.
5535 If CIRCULAR is non-nil, go to the start of the article instead of
5536 selecting the next article when reaching the end of the current
5539 (setq gnus-summary-buffer (current-buffer))
5540 (gnus-set-global-variables)
5541 (let ((article (gnus-summary-article-number))
5542 (article-window (get-buffer-window gnus-article-buffer t))
5544 (gnus-configure-windows 'article)
5545 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5546 (if (and (eq gnus-summary-goto-unread 'never)
5547 (not (gnus-summary-last-article-p article)))
5548 (gnus-summary-next-article)
5549 (gnus-summary-next-unread-article))
5550 (if (or (null gnus-current-article)
5551 (null gnus-article-current)
5552 (/= article (cdr gnus-article-current))
5553 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5554 ;; Selected subject is different from current article's.
5555 (gnus-summary-display-article article)
5556 (when article-window
5557 (gnus-eval-in-buffer-window gnus-article-buffer
5558 (setq endp (gnus-article-next-page lines)))
5561 (gnus-summary-beginning-of-article))
5563 (gnus-message 3 "End of message"))
5565 (if (and (eq gnus-summary-goto-unread 'never)
5566 (not (gnus-summary-last-article-p article)))
5567 (gnus-summary-next-article)
5568 (gnus-summary-next-unread-article))))))))
5569 (gnus-summary-recenter)
5570 (gnus-summary-position-point)))
5572 (defun gnus-summary-prev-page (&optional lines move)
5573 "Show previous page of selected article.
5574 Argument LINES specifies lines to be scrolled down.
5575 If MOVE, move to the previous unread article if point is at
5576 the beginning of the buffer."
5578 (gnus-set-global-variables)
5579 (let ((article (gnus-summary-article-number))
5580 (article-window (get-buffer-window gnus-article-buffer t))
5582 (gnus-configure-windows 'article)
5583 (if (or (null gnus-current-article)
5584 (null gnus-article-current)
5585 (/= article (cdr gnus-article-current))
5586 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5587 ;; Selected subject is different from current article's.
5588 (gnus-summary-display-article article)
5589 (gnus-summary-recenter)
5590 (when article-window
5591 (gnus-eval-in-buffer-window gnus-article-buffer
5592 (setq endp (gnus-article-prev-page lines)))
5593 (when (and move endp)
5595 (gnus-message 3 "Beginning of message"))
5597 (if (and (eq gnus-summary-goto-unread 'never)
5598 (not (gnus-summary-first-article-p article)))
5599 (gnus-summary-prev-article)
5600 (gnus-summary-prev-unread-article))))))))
5601 (gnus-summary-position-point))
5603 (defun gnus-summary-prev-page-or-article (&optional lines)
5604 "Show previous page of selected article.
5605 Argument LINES specifies lines to be scrolled down.
5606 If at the beginning of the article, go to the next article."
5608 (gnus-summary-prev-page lines t))
5610 (defun gnus-summary-scroll-up (lines)
5611 "Scroll up (or down) one line current article.
5612 Argument LINES specifies lines to be scrolled up (or down if negative)."
5614 (gnus-set-global-variables)
5615 (gnus-configure-windows 'article)
5616 (gnus-summary-show-thread)
5617 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5618 (gnus-eval-in-buffer-window gnus-article-buffer
5620 (when (gnus-article-next-page lines)
5621 (gnus-message 3 "End of message")))
5623 (gnus-article-prev-page (- lines))))))
5624 (gnus-summary-recenter)
5625 (gnus-summary-position-point))
5627 (defun gnus-summary-next-same-subject ()
5628 "Select next article which has the same subject as current one."
5630 (gnus-set-global-variables)
5631 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5633 (defun gnus-summary-prev-same-subject ()
5634 "Select previous article which has the same subject as current one."
5636 (gnus-set-global-variables)
5637 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5639 (defun gnus-summary-next-unread-same-subject ()
5640 "Select next unread article which has the same subject as current one."
5642 (gnus-set-global-variables)
5643 (gnus-summary-next-article t (gnus-summary-article-subject)))
5645 (defun gnus-summary-prev-unread-same-subject ()
5646 "Select previous unread article which has the same subject as current one."
5648 (gnus-set-global-variables)
5649 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5651 (defun gnus-summary-first-unread-article ()
5652 "Select the first unread article.
5653 Return nil if there are no unread articles."
5655 (gnus-set-global-variables)
5657 (when (gnus-summary-first-subject t)
5658 (gnus-summary-show-thread)
5659 (gnus-summary-first-subject t)
5660 (gnus-summary-display-article (gnus-summary-article-number)))
5661 (gnus-summary-position-point)))
5663 (defun gnus-summary-first-article ()
5664 "Select the first article.
5665 Return nil if there are no articles."
5667 (gnus-set-global-variables)
5669 (when (gnus-summary-first-subject)
5670 (gnus-summary-show-thread)
5671 (gnus-summary-first-subject)
5672 (gnus-summary-display-article (gnus-summary-article-number)))
5673 (gnus-summary-position-point)))
5675 (defun gnus-summary-best-unread-article ()
5676 "Select the unread article with the highest score."
5678 (gnus-set-global-variables)
5679 (let ((best -1000000)
5680 (data gnus-newsgroup-data)
5683 (and (gnus-data-unread-p (car data))
5685 (gnus-summary-article-score (gnus-data-number (car data))))
5688 article (gnus-data-number (car data))))
5689 (setq data (cdr data)))
5692 (gnus-summary-goto-article article)
5693 (error "No unread articles"))
5694 (gnus-summary-position-point))))
5696 (defun gnus-summary-last-subject ()
5697 "Go to the last displayed subject line in the group."
5698 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5700 (gnus-summary-goto-subject article))))
5702 (defun gnus-summary-goto-article (article &optional all-headers force)
5703 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5704 If ALL-HEADERS is non-nil, no header lines are hidden."
5708 "Article number or Message-ID: "
5709 (mapcar (lambda (number) (list (int-to-string number)))
5710 gnus-newsgroup-limit))
5714 (if (and (stringp article)
5715 (string-match "@" article))
5716 (gnus-summary-refer-article article)
5717 (when (stringp article)
5718 (setq article (string-to-number article)))
5719 (if (gnus-summary-goto-subject article force)
5720 (gnus-summary-display-article article all-headers)
5721 (gnus-message 4 "Couldn't go to article %s" article) nil))
5722 (gnus-summary-position-point)))
5724 (defun gnus-summary-goto-last-article ()
5725 "Go to the previously read article."
5728 (when gnus-last-article
5729 (gnus-summary-goto-article gnus-last-article))
5730 (gnus-summary-position-point)))
5732 (defun gnus-summary-pop-article (number)
5733 "Pop one article off the history and go to the previous.
5734 NUMBER articles will be popped off."
5737 (setq gnus-newsgroup-history
5738 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5740 (gnus-summary-goto-article (car to))
5741 (error "Article history empty")))
5742 (gnus-summary-position-point))
5744 ;; Summary commands and functions for limiting the summary buffer.
5746 (defun gnus-summary-limit-to-articles (n)
5747 "Limit the summary buffer to the next N articles.
5748 If not given a prefix, use the process marked articles instead."
5750 (gnus-set-global-variables)
5752 (let ((articles (gnus-summary-work-articles n)))
5753 (setq gnus-newsgroup-processable nil)
5754 (gnus-summary-limit articles))
5755 (gnus-summary-position-point)))
5757 (defun gnus-summary-pop-limit (&optional total)
5758 "Restore the previous limit.
5759 If given a prefix, remove all limits."
5761 (gnus-set-global-variables)
5763 (setq gnus-newsgroup-limits
5764 (list (mapcar (lambda (h) (mail-header-number h))
5765 gnus-newsgroup-headers))))
5766 (unless gnus-newsgroup-limits
5767 (error "No limit to pop"))
5769 (gnus-summary-limit nil 'pop)
5770 (gnus-summary-position-point)))
5772 (defun gnus-summary-limit-to-subject (subject &optional header)
5773 "Limit the summary buffer to articles that have subjects that match a regexp."
5774 (interactive "sLimit to subject (regexp): ")
5776 (setq header "subject"))
5777 (when (not (equal "" subject))
5779 (let ((articles (gnus-summary-find-matching
5780 (or header "subject") subject 'all)))
5782 (error "Found no matches for \"%s\"" subject))
5783 (gnus-summary-limit articles))
5784 (gnus-summary-position-point))))
5786 (defun gnus-summary-limit-to-author (from)
5787 "Limit the summary buffer to articles that have authors that match a regexp."
5788 (interactive "sLimit to author (regexp): ")
5789 (gnus-summary-limit-to-subject from "from"))
5791 (defun gnus-summary-limit-to-age (age &optional younger-p)
5792 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5793 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5794 articles that are younger than AGE days."
5795 (interactive "nTime in days: \nP")
5797 (let ((data gnus-newsgroup-data)
5798 (cutoff (nnmail-days-to-time age))
5799 articles d date is-younger)
5800 (while (setq d (pop data))
5801 (when (and (vectorp (gnus-data-header d))
5802 (setq date (mail-header-date (gnus-data-header d))))
5803 (setq is-younger (nnmail-time-less
5804 (nnmail-time-since (nnmail-date-to-time date))
5806 (when (if younger-p is-younger (not is-younger))
5807 (push (gnus-data-number d) articles))))
5808 (gnus-summary-limit (nreverse articles)))
5809 (gnus-summary-position-point)))
5811 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5813 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5815 (defun gnus-summary-limit-to-unread (&optional all)
5816 "Limit the summary buffer to articles that are not marked as read.
5817 If ALL is non-nil, limit strictly to unread articles."
5820 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5821 (gnus-summary-limit-to-marks
5822 ;; Concat all the marks that say that an article is read and have
5824 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5825 gnus-killed-mark gnus-kill-file-mark
5826 gnus-low-score-mark gnus-expirable-mark
5827 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5828 gnus-duplicate-mark gnus-souped-mark)
5831 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5832 (make-obsolete 'gnus-summary-delete-marked-with
5833 'gnus-summary-limit-exlude-marks)
5835 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5836 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5837 If REVERSE, limit the summary buffer to articles that are marked
5838 with MARKS. MARKS can either be a string of marks or a list of marks.
5839 Returns how many articles were removed."
5840 (interactive "sMarks: ")
5841 (gnus-summary-limit-to-marks marks t))
5843 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5844 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5845 If REVERSE (the prefix), limit the summary buffer to articles that are
5846 not marked with MARKS. MARKS can either be a string of marks or a
5848 Returns how many articles were removed."
5849 (interactive (list (read-string "Marks: ") current-prefix-arg))
5850 (gnus-set-global-variables)
5852 (let ((data gnus-newsgroup-data)
5853 (marks (if (listp marks) marks
5854 (append marks nil))) ; Transform to list.
5857 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5858 (memq (gnus-data-mark (car data)) marks))
5859 (push (gnus-data-number (car data)) articles))
5860 (setq data (cdr data)))
5861 (gnus-summary-limit articles))
5862 (gnus-summary-position-point)))
5864 (defun gnus-summary-limit-to-score (&optional score)
5865 "Limit to articles with score at or above SCORE."
5867 (gnus-set-global-variables)
5868 (setq score (if score
5869 (prefix-numeric-value score)
5870 (or gnus-summary-default-score 0)))
5871 (let ((data gnus-newsgroup-data)
5874 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5876 (push (gnus-data-number (car data)) articles))
5877 (setq data (cdr data)))
5879 (gnus-summary-limit articles)
5880 (gnus-summary-position-point))))
5882 (defun gnus-summary-limit-include-dormant ()
5883 "Display all the hidden articles that are marked as dormant."
5885 (gnus-set-global-variables)
5886 (unless gnus-newsgroup-dormant
5887 (error "There are no dormant articles in this group"))
5889 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5890 (gnus-summary-position-point)))
5892 (defun gnus-summary-limit-exclude-dormant ()
5893 "Hide all dormant articles."
5895 (gnus-set-global-variables)
5897 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5898 (gnus-summary-position-point)))
5900 (defun gnus-summary-limit-exclude-childless-dormant ()
5901 "Hide all dormant articles that have no children."
5903 (gnus-set-global-variables)
5904 (let ((data (gnus-data-list t))
5905 articles d children)
5906 ;; Find all articles that are either not dormant or have
5908 (while (setq d (pop data))
5909 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5911 (gnus-article-children (gnus-data-number d)))
5914 (when (memq (car children) articles)
5919 (push (gnus-data-number d) articles)))
5922 (gnus-summary-limit articles)
5923 (gnus-summary-position-point))))
5925 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5926 "Mark all unread excluded articles as read.
5927 If ALL, mark even excluded ticked and dormants as read."
5929 (let ((articles (gnus-sorted-complement
5931 (mapcar (lambda (h) (mail-header-number h))
5932 gnus-newsgroup-headers)
5934 (sort gnus-newsgroup-limit '<)))
5936 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
5938 (setq gnus-newsgroup-dormant nil
5939 gnus-newsgroup-marked nil
5940 gnus-newsgroup-reads
5942 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5943 gnus-newsgroup-reads))
5944 (while (setq article (pop articles))
5945 (unless (or (memq article gnus-newsgroup-dormant)
5946 (memq article gnus-newsgroup-marked))
5947 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5949 (defun gnus-summary-limit (articles &optional pop)
5951 ;; We pop the previous limit off the stack and use that.
5952 (setq articles (car gnus-newsgroup-limits)
5953 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5954 ;; We use the new limit, so we push the old limit on the stack.
5955 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5957 (setq gnus-newsgroup-limit articles)
5958 (let ((total (length gnus-newsgroup-data))
5959 (data (gnus-data-find-list (gnus-summary-article-number)))
5960 (gnus-summary-mark-below nil) ; Inhibit this.
5962 ;; This will do all the work of generating the new summary buffer
5963 ;; according to the new limit.
5964 (gnus-summary-prepare)
5965 ;; Hide any threads, possibly.
5966 (and gnus-show-threads
5967 gnus-thread-hide-subtree
5968 (gnus-summary-hide-all-threads))
5969 ;; Try to return to the article you were at, or one in the
5972 ;; We try to find some article after the current one.
5974 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5977 (setq data (cdr data))))
5979 ;; If there is no data, that means that we were after the last
5980 ;; article. The same goes when we can't find any articles
5981 ;; after the current one.
5982 (goto-char (point-max))
5983 (gnus-summary-find-prev))
5984 ;; We return how many articles were removed from the summary
5985 ;; buffer as a result of the new limit.
5986 (- total (length gnus-newsgroup-data))))
5988 (defsubst gnus-invisible-cut-children (threads)
5991 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5996 (defsubst gnus-cut-thread (thread)
5997 "Go forwards in the thread until we find an article that we want to display."
5998 (when (or (eq gnus-fetch-old-headers 'some)
5999 (eq gnus-build-sparse-threads 'some)
6000 (eq gnus-build-sparse-threads 'more))
6001 ;; Deal with old-fetched headers and sparse threads.
6005 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6006 (gnus-summary-article-ancient-p
6007 (mail-header-number (car thread))))
6009 (if (<= (length (cdr thread)) 1)
6010 (setq gnus-newsgroup-limit
6011 (delq (mail-header-number (car thread))
6012 gnus-newsgroup-limit)
6013 thread (cadr thread))
6014 (when (gnus-invisible-cut-children (cdr thread))
6015 (let ((th (cdr thread)))
6017 (if (memq (mail-header-number (caar th))
6018 gnus-newsgroup-limit)
6019 (setq thread (car th)
6021 (setq th (cdr th)))))))))))
6024 (defun gnus-cut-threads (threads)
6025 "Cut off all uninteresting articles from the beginning of threads."
6026 (when (or (eq gnus-fetch-old-headers 'some)
6027 (eq gnus-build-sparse-threads 'some)
6028 (eq gnus-build-sparse-threads 'more))
6031 (setcar th (gnus-cut-thread (car th)))
6032 (setq th (cdr th)))))
6033 ;; Remove nixed out threads.
6036 (defun gnus-summary-initial-limit (&optional show-if-empty)
6037 "Figure out what the initial limit is supposed to be on group entry.
6038 This entails weeding out unwanted dormants, low-scored articles,
6039 fetch-old-headers verbiage, and so on."
6040 ;; Most groups have nothing to remove.
6041 (if (or gnus-inhibit-limiting
6042 (and (null gnus-newsgroup-dormant)
6043 (not (eq gnus-fetch-old-headers 'some))
6044 (null gnus-summary-expunge-below)
6045 (not (eq gnus-build-sparse-threads 'some))
6046 (not (eq gnus-build-sparse-threads 'more))
6047 (null gnus-thread-expunge-below)
6048 (not gnus-use-nocem)))
6050 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6051 (setq gnus-newsgroup-limit nil)
6054 (unless (car (symbol-value node))
6055 ;; These threads have no parents -- they are roots.
6056 (let ((nodes (cdr (symbol-value node)))
6059 (if (and gnus-thread-expunge-below
6060 (< (gnus-thread-total-score (car nodes))
6061 gnus-thread-expunge-below))
6062 (gnus-expunge-thread (pop nodes))
6063 (setq thread (pop nodes))
6064 (gnus-summary-limit-children thread))))))
6065 gnus-newsgroup-dependencies)
6066 ;; If this limitation resulted in an empty group, we might
6067 ;; pop the previous limit and use it instead.
6068 (when (and (not gnus-newsgroup-limit)
6070 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6071 gnus-newsgroup-limit))
6073 (defun gnus-summary-limit-children (thread)
6074 "Return 1 if this subthread is visible and 0 if it is not."
6075 ;; First we get the number of visible children to this thread. This
6076 ;; is done by recursing down the thread using this function, so this
6077 ;; will really go down to a leaf article first, before slowly
6078 ;; working its way up towards the root.
6082 (apply '+ (mapcar 'gnus-summary-limit-children
6085 (number (mail-header-number (car thread)))
6088 (not (memq number gnus-newsgroup-marked))
6090 ;; If this article is dormant and has absolutely no visible
6091 ;; children, then this article isn't visible.
6092 (and (memq number gnus-newsgroup-dormant)
6094 ;; If this is "fetch-old-headered" and there is no
6095 ;; visible children, then we don't want this article.
6096 (and (eq gnus-fetch-old-headers 'some)
6097 (gnus-summary-article-ancient-p number)
6099 ;; If this is a sparsely inserted article with no children,
6100 ;; we don't want it.
6101 (and (eq gnus-build-sparse-threads 'some)
6102 (gnus-summary-article-sparse-p number)
6104 ;; If we use expunging, and this article is really
6105 ;; low-scored, then we don't want this article.
6106 (when (and gnus-summary-expunge-below
6108 (or (cdr (assq number gnus-newsgroup-scored))
6109 gnus-summary-default-score))
6110 gnus-summary-expunge-below))
6111 ;; We increase the expunge-tally here, but that has
6112 ;; nothing to do with the limits, really.
6113 (incf gnus-newsgroup-expunged-tally)
6114 ;; We also mark as read here, if that's wanted.
6115 (when (and gnus-summary-mark-below
6116 (< score gnus-summary-mark-below))
6117 (setq gnus-newsgroup-unreads
6118 (delq number gnus-newsgroup-unreads))
6119 (if gnus-newsgroup-auto-expire
6120 (push number gnus-newsgroup-expirable)
6121 (push (cons number gnus-low-score-mark)
6122 gnus-newsgroup-reads)))
6124 ;; Check NoCeM things.
6125 (if (and gnus-use-nocem
6126 (gnus-nocem-unwanted-article-p
6127 (mail-header-id (car thread))))
6129 (setq gnus-newsgroup-unreads
6130 (delq number gnus-newsgroup-unreads))
6132 ;; Nope, invisible article.
6134 ;; Ok, this article is to be visible, so we add it to the limit
6136 (push number gnus-newsgroup-limit)
6139 (defun gnus-expunge-thread (thread)
6140 "Mark all articles in THREAD as read."
6141 (let* ((number (mail-header-number (car thread))))
6142 (incf gnus-newsgroup-expunged-tally)
6143 ;; We also mark as read here, if that's wanted.
6144 (setq gnus-newsgroup-unreads
6145 (delq number gnus-newsgroup-unreads))
6146 (if gnus-newsgroup-auto-expire
6147 (push number gnus-newsgroup-expirable)
6148 (push (cons number gnus-low-score-mark)
6149 gnus-newsgroup-reads)))
6150 ;; Go recursively through all subthreads.
6151 (mapcar 'gnus-expunge-thread (cdr thread)))
6153 ;; Summary article oriented commands
6155 (defun gnus-summary-refer-parent-article (n)
6156 "Refer parent article N times.
6157 If N is negative, go to ancestor -N instead.
6158 The difference between N and the number of articles fetched is returned."
6160 (gnus-set-global-variables)
6163 (when (not (natnump n))
6168 (setq header (gnus-summary-article-header))
6169 (if (and (eq (mail-header-number header)
6170 (cdr gnus-article-current))
6171 (equal gnus-newsgroup-name
6172 (car gnus-article-current)))
6173 ;; If we try to find the parent of the currently
6174 ;; displayed article, then we take a look at the actual
6175 ;; References header, since this is slightly more
6176 ;; reliable than the References field we got from the
6179 (set-buffer gnus-original-article-buffer)
6180 (nnheader-narrow-to-headers)
6181 (unless (setq ref (message-fetch-field "references"))
6182 (setq ref (message-fetch-field "in-reply-to")))
6185 ;; It's not the current article, so we take a bet on
6186 ;; the value we got from the server.
6187 (mail-header-references header)))
6189 (not (equal ref "")))
6190 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6191 (gnus-message 1 "Couldn't find parent"))
6192 (gnus-message 1 "No references in article %d"
6193 (gnus-summary-article-number))
6196 (gnus-summary-position-point)
6199 (defun gnus-summary-refer-references ()
6200 "Fetch all articles mentioned in the References header.
6201 Return how many articles were fetched."
6203 (gnus-set-global-variables)
6204 (let ((ref (mail-header-references (gnus-summary-article-header)))
6205 (current (gnus-summary-article-number))
6209 (error "No References in the current article")
6210 ;; For each Message-ID in the References header...
6211 (while (string-match "<[^>]*>" ref)
6213 ;; ... fetch that article.
6214 (gnus-summary-refer-article
6215 (prog1 (match-string 0 ref)
6216 (setq ref (substring ref (match-end 0))))))
6217 (gnus-summary-goto-subject current)
6218 (gnus-summary-position-point)
6221 (defun gnus-summary-refer-article (message-id &optional arg)
6222 "Fetch an article specified by MESSAGE-ID.
6223 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6224 or `gnus-select-method', no matter what backend the article comes from."
6225 (interactive "sMessage-ID: \nP")
6226 (when (and (stringp message-id)
6227 (not (zerop (length message-id))))
6228 ;; Construct the correct Message-ID if necessary.
6229 ;; Suggested by tale@pawl.rpi.edu.
6230 (unless (string-match "^<" message-id)
6231 (setq message-id (concat "<" message-id)))
6232 (unless (string-match ">$" message-id)
6233 (setq message-id (concat message-id ">")))
6234 (let* ((header (gnus-id-to-header message-id))
6236 (gnus-summary-article-sparse-p
6237 (mail-header-number header))
6238 (memq (mail-header-number header)
6239 gnus-newsgroup-limit))))
6241 (or (not (gnus-summary-article-sparse-p
6242 (mail-header-number header)))
6245 ;; The article is present in the buffer, so we just go to it.
6246 (gnus-summary-goto-article
6247 (mail-header-number header) nil t)
6249 (gnus-summary-update-article (mail-header-number header))))
6250 ;; We fetch the article
6251 (let ((gnus-override-method
6252 (cond ((gnus-news-group-p gnus-newsgroup-name)
6253 gnus-refer-article-method)
6255 (or gnus-refer-article-method gnus-select-method))
6258 ;; Start the special refer-article method, if necessary.
6259 (when (and gnus-refer-article-method
6260 (gnus-news-group-p gnus-newsgroup-name))
6261 (gnus-check-server gnus-refer-article-method))
6262 ;; Fetch the header, and display the article.
6263 (if (setq number (gnus-summary-insert-subject message-id))
6264 (gnus-summary-select-article nil nil nil number)
6265 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6267 (defun gnus-summary-enter-digest-group (&optional force)
6268 "Enter an nndoc group based on the current article.
6269 If FORCE, force a digest interpretation. If not, try
6270 to guess what the document format is."
6272 (gnus-set-global-variables)
6273 (let ((conf gnus-current-window-configuration))
6275 (gnus-summary-select-article))
6276 (setq gnus-current-window-configuration conf)
6277 (let* ((name (format "%s-%d"
6278 (gnus-group-prefixed-name
6279 gnus-newsgroup-name (list 'nndoc ""))
6281 (set-buffer gnus-summary-buffer)
6282 gnus-current-article)))
6283 (ogroup gnus-newsgroup-name)
6284 (params (append (gnus-info-params (gnus-get-info ogroup))
6285 (list (cons 'to-group ogroup))
6286 (list (cons 'save-article-group ogroup))))
6287 (case-fold-search t)
6288 (buf (current-buffer))
6291 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6292 (insert-buffer-substring gnus-original-article-buffer)
6293 ;; Remove lines that may lead nndoc to misinterpret the
6296 (goto-char (point-min))
6297 (or (search-forward "\n\n" nil t) (point)))
6298 (goto-char (point-min))
6299 (delete-matching-lines "^\\(Path\\):\\|^From ")
6302 (if (gnus-group-read-ephemeral-group
6303 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6305 ,(if force 'digest 'guess))) t)
6306 ;; Make all postings to this group go to the parent group.
6307 (nconc (gnus-info-params (gnus-get-info name))
6309 ;; Couldn't select this doc group.
6310 (switch-to-buffer buf)
6311 (gnus-set-global-variables)
6312 (gnus-configure-windows 'summary)
6313 (gnus-message 3 "Article couldn't be entered?"))
6314 (kill-buffer dig)))))
6316 (defun gnus-summary-read-document (n)
6317 "Open a new group based on the current article(s).
6318 This will allow you to read digests and other similar
6319 documents as newsgroups.
6320 Obeys the standard process/prefix convention."
6322 (let* ((articles (gnus-summary-work-articles n))
6323 (ogroup gnus-newsgroup-name)
6324 (params (append (gnus-info-params (gnus-get-info ogroup))
6325 (list (cons 'to-group ogroup))))
6326 article group egroup groups vgroup)
6327 (while (setq article (pop articles))
6328 (setq group (format "%s-%d" gnus-newsgroup-name article))
6329 (gnus-summary-remove-process-mark article)
6330 (when (gnus-summary-display-article article)
6332 (nnheader-temp-write nil
6333 (insert-buffer-substring gnus-original-article-buffer)
6334 ;; Remove some headers that may lead nndoc to make
6336 (message-narrow-to-head)
6337 (goto-char (point-min))
6338 (delete-matching-lines "^\\(Path\\):\\|^From ")
6341 (gnus-group-read-ephemeral-group
6342 group `(nndoc ,group (nndoc-address ,(current-buffer))
6343 (nndoc-article-type guess))
6346 ;; Make all postings to this group go to the parent group.
6347 (nconc (gnus-info-params (gnus-get-info egroup))
6349 (push egroup groups))
6350 ;; Couldn't select this doc group.
6351 (gnus-error 3 "Article couldn't be entered"))))))
6352 ;; Now we have selected all the documents.
6355 (error "None of the articles could be interpreted as documents"))
6356 ((gnus-group-read-ephemeral-group
6357 (setq vgroup (format
6358 "nnvirtual:%s-%s" gnus-newsgroup-name
6359 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6360 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6362 (cons (current-buffer) 'summary)))
6364 (error "Couldn't select virtual nndoc group")))))
6366 (defun gnus-summary-isearch-article (&optional regexp-p)
6367 "Do incremental search forward on the current article.
6368 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6370 (gnus-set-global-variables)
6371 (gnus-summary-select-article)
6372 (gnus-configure-windows 'article)
6373 (gnus-eval-in-buffer-window gnus-article-buffer
6374 ;;(goto-char (point-min))
6375 (isearch-forward regexp-p)))
6377 (defun gnus-summary-search-article-forward (regexp &optional backward)
6378 "Search for an article containing REGEXP forward.
6379 If BACKWARD, search backward instead."
6382 (format "Search article %s (regexp%s): "
6383 (if current-prefix-arg "backward" "forward")
6384 (if gnus-last-search-regexp
6385 (concat ", default " gnus-last-search-regexp)
6387 current-prefix-arg))
6388 (gnus-set-global-variables)
6389 (if (string-equal regexp "")
6390 (setq regexp (or gnus-last-search-regexp ""))
6391 (setq gnus-last-search-regexp regexp))
6392 (if (gnus-summary-search-article regexp backward)
6393 (gnus-summary-show-thread)
6394 (error "Search failed: \"%s\"" regexp)))
6396 (defun gnus-summary-search-article-backward (regexp)
6397 "Search for an article containing REGEXP backward."
6400 (format "Search article backward (regexp%s): "
6401 (if gnus-last-search-regexp
6402 (concat ", default " gnus-last-search-regexp)
6404 (gnus-summary-search-article-forward regexp 'backward))
6406 (defun gnus-summary-search-article (regexp &optional backward)
6407 "Search for an article containing REGEXP.
6408 Optional argument BACKWARD means do search for backward.
6409 `gnus-select-article-hook' is not called during the search."
6410 ;; We have to require this here to make sure that the following
6411 ;; dynamic binding isn't shadowed by autoloading.
6412 (require 'gnus-async)
6413 (let ((gnus-select-article-hook nil) ;Disable hook.
6414 (gnus-article-display-hook nil)
6415 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6416 (gnus-use-article-prefetch nil)
6417 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6418 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6419 (sum (current-buffer))
6422 (gnus-save-hidden-threads
6423 (gnus-summary-select-article)
6424 (set-buffer gnus-article-buffer)
6428 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6430 (re-search-backward regexp nil t)
6431 (re-search-forward regexp nil t))
6432 ;; We found the regexp.
6437 (get-buffer-window (current-buffer))
6441 (setq point (point)))
6442 ;; We didn't find it, so we go to the next article.
6445 (while (eq found 'not)
6446 (if (not (if backward (gnus-summary-find-prev)
6447 (gnus-summary-find-next)))
6448 ;; No more articles.
6450 ;; Select the next article and adjust point.
6451 (unless (gnus-summary-article-sparse-p
6452 (gnus-summary-article-number))
6454 (gnus-summary-select-article)
6455 (set-buffer gnus-article-buffer)
6457 (goto-char (if backward (point-max) (point-min))))))))
6458 (gnus-message 7 ""))
6459 ;; Return whether we found the regexp.
6460 (when (eq found 'found)
6462 (gnus-summary-show-thread)
6463 (gnus-summary-goto-subject gnus-current-article)
6464 (gnus-summary-position-point)
6467 (defun gnus-summary-find-matching (header regexp &optional backward unread
6469 "Return a list of all articles that match REGEXP on HEADER.
6470 The search stars on the current article and goes forwards unless
6471 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6472 If UNREAD is non-nil, only unread articles will
6473 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6474 in the comparisons."
6475 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6476 (gnus-data-find-list
6477 (gnus-summary-article-number) (gnus-data-list backward))))
6478 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6479 (case-fold-search (not not-case-fold))
6481 (unless (fboundp (intern (concat "mail-header-" header)))
6482 (error "%s is not a valid header" header))
6485 (and (or (not unread) ; We want all articles...
6486 (gnus-data-unread-p d)) ; Or just unreads.
6487 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6488 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6489 (push (gnus-data-number d) articles)) ; Success!
6490 (setq data (cdr data)))
6491 (nreverse articles)))
6493 (defun gnus-summary-execute-command (header regexp command &optional backward)
6494 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6495 If HEADER is an empty string (or nil), the match is done on the entire
6496 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6498 (list (let ((completion-ignore-case t))
6501 (mapcar (lambda (string) (list string))
6502 '("Number" "Subject" "From" "Lines" "Date"
6503 "Message-ID" "Xref" "References" "Body"))
6504 nil 'require-match))
6505 (read-string "Regexp: ")
6506 (read-key-sequence "Command: ")
6507 current-prefix-arg))
6508 (when (equal header "Body")
6510 (gnus-set-global-variables)
6511 ;; Hidden thread subtrees must be searched as well.
6512 (gnus-summary-show-all-threads)
6513 ;; We don't want to change current point nor window configuration.
6515 (save-window-excursion
6516 (gnus-message 6 "Executing %s..." (key-description command))
6517 ;; We'd like to execute COMMAND interactively so as to give arguments.
6518 (gnus-execute header regexp
6519 `(call-interactively ',(key-binding command))
6521 (gnus-message 6 "Executing %s...done" (key-description command)))))
6523 (defun gnus-summary-beginning-of-article ()
6524 "Scroll the article back to the beginning."
6526 (gnus-set-global-variables)
6527 (gnus-summary-select-article)
6528 (gnus-configure-windows 'article)
6529 (gnus-eval-in-buffer-window gnus-article-buffer
6531 (goto-char (point-min))
6532 (when gnus-page-broken
6533 (gnus-narrow-to-page))))
6535 (defun gnus-summary-end-of-article ()
6536 "Scroll to the end of the article."
6538 (gnus-set-global-variables)
6539 (gnus-summary-select-article)
6540 (gnus-configure-windows 'article)
6541 (gnus-eval-in-buffer-window gnus-article-buffer
6543 (goto-char (point-max))
6545 (when gnus-page-broken
6546 (gnus-narrow-to-page))))
6548 (defun gnus-summary-print-article (&optional filename)
6549 "Generate and print a PostScript image of the article buffer.
6551 If the optional argument FILENAME is nil, send the image to the printer.
6552 If FILENAME is a string, save the PostScript image in a file with that
6553 name. If FILENAME is a number, prompt the user for the name of the file
6555 (interactive (list (ps-print-preprint current-prefix-arg)))
6556 (gnus-summary-select-article)
6557 (gnus-eval-in-buffer-window gnus-article-buffer
6558 (let ((buffer (generate-new-buffer " *print*")))
6561 (copy-to-buffer buffer (point-min) (point-max))
6563 (gnus-article-delete-invisible-text)
6564 (run-hooks 'gnus-ps-print-hook)
6565 (ps-print-buffer-with-faces filename))
6566 (kill-buffer buffer)))))
6568 (defun gnus-summary-show-article (&optional arg)
6569 "Force re-fetching of the current article.
6570 If ARG (the prefix) is non-nil, show the raw article without any
6571 article massaging functions being run."
6573 (gnus-set-global-variables)
6575 ;; Select the article the normal way.
6576 (gnus-summary-select-article nil 'force)
6577 ;; Bind the article treatment functions to nil.
6578 (let ((gnus-have-all-headers t)
6579 gnus-article-display-hook
6580 gnus-article-prepare-hook
6584 (gnus-summary-select-article nil 'force)))
6585 (gnus-summary-goto-subject gnus-current-article)
6586 (gnus-summary-position-point))
6588 (defun gnus-summary-verbose-headers (&optional arg)
6589 "Toggle permanent full header display.
6590 If ARG is a positive number, turn header display on.
6591 If ARG is a negative number, turn header display off."
6593 (gnus-set-global-variables)
6594 (setq gnus-show-all-headers
6595 (cond ((or (not (numberp arg))
6597 (not gnus-show-all-headers))
6600 (gnus-summary-show-article))
6602 (defun gnus-summary-toggle-header (&optional arg)
6603 "Show the headers if they are hidden, or hide them if they are shown.
6604 If ARG is a positive number, show the entire header.
6605 If ARG is a negative number, hide the unwanted header lines."
6607 (gnus-set-global-variables)
6609 (set-buffer gnus-article-buffer)
6610 (let* ((buffer-read-only nil)
6611 (inhibit-point-motion-hooks t)
6612 (hidden (text-property-any
6613 (goto-char (point-min)) (search-forward "\n\n")
6616 (goto-char (point-min))
6617 (when (search-forward "\n\n" nil t)
6618 (delete-region (point-min) (1- (point))))
6619 (goto-char (point-min))
6621 (set-buffer gnus-original-article-buffer)
6622 (goto-char (point-min))
6623 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6624 (insert-buffer-substring gnus-original-article-buffer 1 e)
6625 (let ((article-inhibit-hiding t))
6626 (run-hooks 'gnus-article-display-hook))
6627 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6628 (gnus-article-hide-headers)))))
6630 (defun gnus-summary-show-all-headers ()
6631 "Make all header lines visible."
6633 (gnus-set-global-variables)
6634 (gnus-article-show-all-headers))
6636 (defun gnus-summary-toggle-mime (&optional arg)
6637 "Toggle MIME processing.
6638 If ARG is a positive number, turn MIME processing on."
6640 (gnus-set-global-variables)
6641 (setq gnus-show-mime
6642 (if (null arg) (not gnus-show-mime)
6643 (> (prefix-numeric-value arg) 0)))
6644 (gnus-summary-select-article t 'force))
6646 (defun gnus-summary-caesar-message (&optional arg)
6647 "Caesar rotate the current article by 13.
6648 The numerical prefix specifies how many places to rotate each letter
6651 (gnus-set-global-variables)
6652 (gnus-summary-select-article)
6653 (let ((mail-header-separator ""))
6654 (gnus-eval-in-buffer-window gnus-article-buffer
6657 (let ((start (window-start))
6659 (message-caesar-buffer-body arg)
6660 (set-window-start (get-buffer-window (current-buffer)) start))))))
6662 (defun gnus-summary-stop-page-breaking ()
6663 "Stop page breaking in the current article."
6665 (gnus-set-global-variables)
6666 (gnus-summary-select-article)
6667 (gnus-eval-in-buffer-window gnus-article-buffer
6669 (when (gnus-visual-p 'page-marker)
6670 (let ((buffer-read-only nil))
6671 (gnus-remove-text-with-property 'gnus-prev)
6672 (gnus-remove-text-with-property 'gnus-next)))))
6674 (defun gnus-summary-move-article (&optional n to-newsgroup
6675 select-method action)
6676 "Move the current article to a different newsgroup.
6677 If N is a positive number, move the N next articles.
6678 If N is a negative number, move the N previous articles.
6679 If N is nil and any articles have been marked with the process mark,
6680 move those articles instead.
6681 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6682 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6683 re-spool using this method.
6685 For this function to work, both the current newsgroup and the
6686 newsgroup that you want to move to have to support the `request-move'
6687 and `request-accept' functions."
6690 (setq action 'move))
6691 (gnus-set-global-variables)
6692 ;; Disable marking as read.
6693 (let (gnus-mark-article-hook)
6694 (save-window-excursion
6695 (gnus-summary-select-article)))
6696 ;; Check whether the source group supports the required functions.
6697 (cond ((and (eq action 'move)
6698 (not (gnus-check-backend-function
6699 'request-move-article gnus-newsgroup-name)))
6700 (error "The current group does not support article moving"))
6701 ((and (eq action 'crosspost)
6702 (not (gnus-check-backend-function
6703 'request-replace-article gnus-newsgroup-name)))
6704 (error "The current group does not support article editing")))
6705 (let ((articles (gnus-summary-work-articles n))
6706 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6707 (names '((move "Move" "Moving")
6708 (copy "Copy" "Copying")
6709 (crosspost "Crosspost" "Crossposting")))
6710 (copy-buf (save-excursion
6711 (nnheader-set-temp-buffer " *copy article*")))
6712 art-group to-method new-xref article to-groups)
6713 (unless (assq action names)
6714 (error "Unknown action %s" action))
6715 ;; Read the newsgroup name.
6716 (when (and (not to-newsgroup)
6717 (not select-method))
6719 (gnus-read-move-group-name
6720 (cadr (assq action names))
6721 (symbol-value (intern (format "gnus-current-%s-group" action)))
6723 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6724 (setq to-method (or select-method
6725 (gnus-group-name-to-method to-newsgroup)))
6726 ;; Check the method we are to move this article to...
6727 (unless (gnus-check-backend-function
6728 'request-accept-article (car to-method))
6729 (error "%s does not support article copying" (car to-method)))
6730 (unless (gnus-check-server to-method)
6731 (error "Can't open server %s" (car to-method)))
6732 (gnus-message 6 "%s to %s: %s..."
6733 (caddr (assq action names))
6734 (or (car select-method) to-newsgroup) articles)
6736 (setq article (pop articles))
6740 ;; Move the article.
6742 ;; Remove this article from future suppression.
6743 (gnus-dup-unsuppress-article article)
6744 (gnus-request-move-article
6745 article ; Article to move
6746 gnus-newsgroup-name ; From newsgroup
6747 (nth 1 (gnus-find-method-for-group
6748 gnus-newsgroup-name)) ; Server
6749 (list 'gnus-request-accept-article
6750 to-newsgroup (list 'quote select-method)
6751 (not articles)) ; Accept form
6752 (not articles))) ; Only save nov last time
6753 ;; Copy the article.
6756 (set-buffer copy-buf)
6757 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6758 (gnus-request-accept-article
6759 to-newsgroup select-method (not articles))))
6760 ;; Crosspost the article.
6761 ((eq action 'crosspost)
6762 (let ((xref (message-tokenize-header
6763 (mail-header-xref (gnus-summary-article-header article))
6765 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6768 (setq xref (list (system-name))))
6771 (mapconcat 'identity
6772 (delete "Xref:" (delete new-xref xref))
6776 (set-buffer copy-buf)
6777 ;; First put the article in the destination group.
6778 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6779 (when (consp (setq art-group
6780 (gnus-request-accept-article
6781 to-newsgroup select-method (not articles))))
6782 (setq new-xref (concat new-xref " " (car art-group)
6783 ":" (cdr art-group)))
6784 ;; Now we have the new Xrefs header, so we insert
6785 ;; it and replace the new article.
6786 (nnheader-replace-header "Xref" new-xref)
6787 (gnus-request-replace-article
6788 (cdr art-group) to-newsgroup (current-buffer))
6792 (gnus-message 1 "Couldn't %s article %s"
6793 (cadr (assq action names)) article))
6794 ((and (eq art-group 'junk)
6796 (gnus-summary-mark-article article gnus-canceled-mark)
6797 (gnus-message 4 "Deleted article %s" article))
6801 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6803 (gnus-group-prefixed-name
6806 (gnus-find-method-for-group to-newsgroup)))
6807 gnus-newsrc-hashtb)))
6808 (info (nth 2 entry))
6809 (to-group (gnus-info-group info)))
6810 ;; Update the group that has been moved to.
6812 (memq action '(move copy)))
6813 (unless (member to-group to-groups)
6814 (push to-group to-groups))
6816 (unless (memq article gnus-newsgroup-unreads)
6818 info (gnus-add-to-range (gnus-info-read info)
6819 (list (cdr art-group)))))
6821 ;; Copy any marks over to the new group.
6822 (let ((marks gnus-article-mark-lists)
6823 (to-article (cdr art-group)))
6825 ;; See whether the article is to be put in the cache.
6826 (when gnus-use-cache
6827 (gnus-cache-possibly-enter-article
6829 (let ((header (copy-sequence
6830 (gnus-summary-article-header article))))
6831 (mail-header-set-number header to-article)
6833 (memq article gnus-newsgroup-marked)
6834 (memq article gnus-newsgroup-dormant)
6835 (memq article gnus-newsgroup-unreads)))
6837 (when (and (equal to-group gnus-newsgroup-name)
6838 (not (memq article gnus-newsgroup-unreads)))
6839 ;; Mark this article as read in this group.
6840 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6841 (setcdr (gnus-active to-group) to-article)
6842 (setcdr gnus-newsgroup-active to-article))
6845 (when (memq article (symbol-value
6846 (intern (format "gnus-newsgroup-%s"
6848 ;; If the other group is the same as this group,
6849 ;; then we have to add the mark to the list.
6850 (when (equal to-group gnus-newsgroup-name)
6851 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6854 (intern (format "gnus-newsgroup-%s"
6856 ;; Copy the marks to other group.
6857 (gnus-add-marked-articles
6858 to-group (cdar marks) (list to-article) info))
6859 (setq marks (cdr marks)))
6862 (concat "(gnus-group-set-info '"
6863 (gnus-prin1-to-string (gnus-get-info to-group))
6866 ;; Update the Xref header in this article to point to
6867 ;; the new crossposted article we have just created.
6868 (when (eq action 'crosspost)
6870 (set-buffer copy-buf)
6871 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6872 (nnheader-replace-header "Xref" new-xref)
6873 (gnus-request-replace-article
6874 article gnus-newsgroup-name (current-buffer)))))
6876 (gnus-summary-goto-subject article)
6877 (when (eq action 'move)
6878 (gnus-summary-mark-article article gnus-canceled-mark))))
6879 (gnus-summary-remove-process-mark article))
6880 ;; Re-activate all groups that have been moved to.
6883 (set-buffer gnus-group-buffer)
6884 (when (gnus-group-goto-group (car to-groups) t)
6885 (gnus-group-get-new-news-this-group 1 t))
6888 (gnus-kill-buffer copy-buf)
6889 (gnus-summary-position-point)
6890 (gnus-set-mode-line 'summary)))
6892 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6893 "Move the current article to a different newsgroup.
6894 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6895 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6896 re-spool using this method."
6898 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6900 (defun gnus-summary-crosspost-article (&optional n)
6901 "Crosspost the current article to some other group."
6903 (gnus-summary-move-article n nil nil 'crosspost))
6905 (defcustom gnus-summary-respool-default-method nil
6906 "Default method for respooling an article.
6907 If nil, use to the current newsgroup method."
6908 :type 'gnus-select-method-name
6909 :group 'gnus-summary-mail)
6911 (defun gnus-summary-respool-article (&optional n method)
6912 "Respool the current article.
6913 The article will be squeezed through the mail spooling process again,
6914 which means that it will be put in some mail newsgroup or other
6915 depending on `nnmail-split-methods'.
6916 If N is a positive number, respool the N next articles.
6917 If N is a negative number, respool the N previous articles.
6918 If N is nil and any articles have been marked with the process mark,
6919 respool those articles instead.
6921 Respooling can be done both from mail groups and \"real\" newsgroups.
6922 In the former case, the articles in question will be moved from the
6923 current group into whatever groups they are destined to. In the
6924 latter case, they will be copied into the relevant groups."
6926 (list current-prefix-arg
6927 (let* ((methods (gnus-methods-using 'respool))
6929 (symbol-name (or gnus-summary-respool-default-method
6930 (car (gnus-find-method-for-group
6931 gnus-newsgroup-name)))))
6933 (gnus-completing-read
6934 methname "What backend do you want to use when respooling?"
6935 methods nil t nil 'gnus-mail-method-history))
6938 ((zerop (length (setq ms (gnus-servers-using-backend
6940 (list (intern method) ""))
6944 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6945 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6947 (gnus-set-global-variables)
6949 (error "No method given for respooling"))
6950 (if (assoc (symbol-name
6951 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6952 (gnus-methods-using 'respool))
6953 (gnus-summary-move-article n nil method)
6954 (gnus-summary-copy-article n nil method)))
6956 (defun gnus-summary-import-article (file)
6957 "Import a random file into a mail newsgroup."
6958 (interactive "fImport file: ")
6959 (gnus-set-global-variables)
6960 (let ((group gnus-newsgroup-name)
6961 (now (current-time))
6963 (unless (gnus-check-backend-function 'request-accept-article group)
6964 (error "%s does not support article importing" group))
6965 (or (file-readable-p file)
6966 (not (file-regular-p file))
6967 (error "Can't read %s" file))
6969 (set-buffer (get-buffer-create " *import file*"))
6970 (buffer-disable-undo (current-buffer))
6972 (insert-file-contents file)
6973 (goto-char (point-min))
6974 (unless (nnheader-article-p)
6975 ;; This doesn't look like an article, so we fudge some headers.
6976 (setq atts (file-attributes file)
6977 lines (count-lines (point-min) (point-max)))
6978 (insert "From: " (read-string "From: ") "\n"
6979 "Subject: " (read-string "Subject: ") "\n"
6980 "Date: " (timezone-make-date-arpa-standard
6981 (current-time-string (nth 5 atts))
6982 (current-time-zone now)
6983 (current-time-zone now))
6985 "Message-ID: " (message-make-message-id) "\n"
6986 "Lines: " (int-to-string lines) "\n"
6987 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6988 (gnus-request-accept-article group nil t)
6989 (kill-buffer (current-buffer)))))
6991 (defun gnus-summary-article-posted-p ()
6992 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6993 This will be the case if the article has both been mailed and posted."
6995 (let ((id (mail-header-references (gnus-summary-article-header)))
6996 (gnus-override-method
6997 (or gnus-refer-article-method gnus-select-method)))
6998 (if (gnus-request-head id "")
6999 (gnus-message 2 "The current message was found on %s"
7000 gnus-override-method)
7001 (gnus-message 2 "The current message couldn't be found on %s"
7002 gnus-override-method)
7005 (defun gnus-summary-expire-articles (&optional now)
7006 "Expire all articles that are marked as expirable in the current group."
7008 (gnus-set-global-variables)
7009 (when (gnus-check-backend-function
7010 'request-expire-articles gnus-newsgroup-name)
7011 ;; This backend supports expiry.
7012 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7013 (expirable (if total
7015 ;; We need to update the info for
7016 ;; this group for `gnus-list-of-read-articles'
7017 ;; to give us the right answer.
7018 (run-hooks 'gnus-exit-group-hook)
7019 (gnus-summary-update-info)
7020 (gnus-list-of-read-articles gnus-newsgroup-name))
7021 (setq gnus-newsgroup-expirable
7022 (sort gnus-newsgroup-expirable '<))))
7023 (expiry-wait (if now 'immediate
7024 (gnus-group-find-parameter
7025 gnus-newsgroup-name 'expiry-wait)))
7028 ;; There are expirable articles in this group, so we run them
7029 ;; through the expiry process.
7030 (gnus-message 6 "Expiring articles...")
7031 ;; The list of articles that weren't expired is returned.
7033 (let ((nnmail-expiry-wait-function nil)
7034 (nnmail-expiry-wait expiry-wait))
7035 (setq es (gnus-request-expire-articles
7036 expirable gnus-newsgroup-name)))
7037 (setq es (gnus-request-expire-articles
7038 expirable gnus-newsgroup-name)))
7040 (setq gnus-newsgroup-expirable es))
7041 ;; We go through the old list of expirable, and mark all
7042 ;; really expired articles as nonexistent.
7043 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7044 (let ((gnus-use-cache nil))
7046 (unless (memq (car expirable) es)
7047 (when (gnus-data-find (car expirable))
7048 (gnus-summary-mark-article
7049 (car expirable) gnus-canceled-mark)))
7050 (setq expirable (cdr expirable)))))
7051 (gnus-message 6 "Expiring articles...done")))))
7053 (defun gnus-summary-expire-articles-now ()
7054 "Expunge all expirable articles in the current group.
7055 This means that *all* articles that are marked as expirable will be
7056 deleted forever, right now."
7058 (gnus-set-global-variables)
7059 (or gnus-expert-user
7061 "Are you really, really, really sure you want to delete all these messages? ")
7063 (gnus-summary-expire-articles t))
7065 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7066 (defun gnus-summary-delete-article (&optional n)
7067 "Delete the N next (mail) articles.
7068 This command actually deletes articles. This is not a marking
7069 command. The article will disappear forever from your life, never to
7071 If N is negative, delete backwards.
7072 If N is nil and articles have been marked with the process mark,
7073 delete these instead."
7075 (gnus-set-global-variables)
7076 (unless (gnus-check-backend-function 'request-expire-articles
7077 gnus-newsgroup-name)
7078 (error "The current newsgroup does not support article deletion"))
7079 ;; Compute the list of articles to delete.
7080 (let ((articles (gnus-summary-work-articles n))
7082 (if (and gnus-novice-user
7083 (not (gnus-yes-or-no-p
7084 (format "Do you really want to delete %s forever? "
7085 (if (> (length articles) 1)
7086 (format "these %s articles" (length articles))
7089 ;; Delete the articles.
7090 (setq not-deleted (gnus-request-expire-articles
7091 articles gnus-newsgroup-name 'force))
7093 (gnus-summary-remove-process-mark (car articles))
7094 ;; The backend might not have been able to delete the article
7096 (unless (memq (car articles) not-deleted)
7097 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7098 (setq articles (cdr articles)))
7100 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7101 (gnus-summary-position-point)
7102 (gnus-set-mode-line 'summary)
7105 (defun gnus-summary-edit-article (&optional force)
7106 "Edit the current article.
7107 This will have permanent effect only in mail groups.
7108 If FORCE is non-nil, allow editing of articles even in read-only
7112 (set-buffer gnus-summary-buffer)
7113 (gnus-set-global-variables)
7114 (when (and (not force)
7115 (gnus-group-read-only-p))
7116 (error "The current newsgroup does not support article editing"))
7117 ;; Select article if needed.
7118 (unless (eq (gnus-summary-article-number)
7119 gnus-current-article)
7120 (gnus-summary-select-article t))
7121 (gnus-article-date-original)
7122 (gnus-article-edit-article
7124 (gnus-summary-edit-article-done
7125 ,(or (mail-header-references gnus-current-headers) "")
7126 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
7128 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7130 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
7131 "Make edits to the current article permanent."
7133 ;; Replace the article.
7134 (if (and (not read-only)
7135 (not (gnus-request-replace-article
7136 (cdr gnus-article-current) (car gnus-article-current)
7138 (error "Couldn't replace article")
7139 ;; Update the summary buffer.
7141 (equal (message-tokenize-header references " ")
7142 (message-tokenize-header
7143 (or (message-fetch-field "references") "") " ")))
7144 ;; We only have to update this line.
7147 (message-narrow-to-head)
7148 (let ((head (buffer-string))
7150 (nnheader-temp-write nil
7151 (insert (format "211 %d Article retrieved.\n"
7152 (cdr gnus-article-current)))
7155 (let ((nntp-server-buffer (current-buffer)))
7156 (setq header (car (gnus-get-newsgroup-headers
7158 (set-buffer gnus-summary-buffer)
7159 gnus-newsgroup-dependencies)
7162 (set-buffer gnus-summary-buffer)
7163 (gnus-data-set-header
7164 (gnus-data-find (cdr gnus-article-current))
7166 (gnus-summary-update-article-line
7167 (cdr gnus-article-current) header))))))
7169 (set-buffer (or buffer gnus-summary-buffer))
7170 (gnus-summary-update-article (cdr gnus-article-current)))
7171 ;; Prettify the article buffer again.
7173 (set-buffer gnus-article-buffer)
7174 (run-hooks 'gnus-article-display-hook)
7175 (set-buffer gnus-original-article-buffer)
7176 (gnus-request-article
7177 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
7178 ;; Prettify the summary buffer line.
7179 (when (gnus-visual-p 'summary-highlight 'highlight)
7180 (run-hooks 'gnus-visual-mark-article-hook))))
7182 (defun gnus-summary-edit-wash (key)
7183 "Perform editing command in the article buffer."
7187 (message "%s" (concat (this-command-keys) "- "))
7190 (gnus-summary-edit-article)
7191 (execute-kbd-macro (concat (this-command-keys) key))
7192 (gnus-article-edit-done))
7196 (defun gnus-summary-respool-query (&optional silent)
7197 "Query where the respool algorithm would put this article."
7199 (gnus-set-global-variables)
7200 (let (gnus-mark-article-hook)
7201 (gnus-summary-select-article)
7203 (set-buffer gnus-original-article-buffer)
7205 (message-narrow-to-head)
7206 (let ((groups (nnmail-article-group 'identity)))
7209 (message "This message would go to %s"
7210 (mapconcat 'car groups ", "))
7211 (message "This message would go to no groups"))
7214 ;; Summary marking commands.
7216 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7217 "Mark articles which has the same subject as read, and then select the next.
7218 If UNMARK is positive, remove any kind of mark.
7219 If UNMARK is negative, tick articles."
7221 (gnus-set-global-variables)
7223 (setq unmark (prefix-numeric-value unmark)))
7225 (gnus-summary-mark-same-subject
7226 (gnus-summary-article-subject) unmark)))
7227 ;; Select next unread article. If auto-select-same mode, should
7228 ;; select the first unread article.
7229 (gnus-summary-next-article t (and gnus-auto-select-same
7230 (gnus-summary-article-subject)))
7231 (gnus-message 7 "%d article%s marked as %s"
7232 count (if (= count 1) " is" "s are")
7233 (if unmark "unread" "read"))))
7235 (defun gnus-summary-kill-same-subject (&optional unmark)
7236 "Mark articles which has the same subject as read.
7237 If UNMARK is positive, remove any kind of mark.
7238 If UNMARK is negative, tick articles."
7240 (gnus-set-global-variables)
7242 (setq unmark (prefix-numeric-value unmark)))
7244 (gnus-summary-mark-same-subject
7245 (gnus-summary-article-subject) unmark)))
7246 ;; If marked as read, go to next unread subject.
7248 ;; Go to next unread subject.
7249 (gnus-summary-next-subject 1 t))
7250 (gnus-message 7 "%d articles are marked as %s"
7251 count (if unmark "unread" "read"))))
7253 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7254 "Mark articles with same SUBJECT as read, and return marked number.
7255 If optional argument UNMARK is positive, remove any kinds of marks.
7256 If optional argument UNMARK is negative, mark articles as unread instead."
7260 ((null unmark) ; Mark as read.
7263 (gnus-summary-mark-article-as-read gnus-killed-mark)
7264 (gnus-summary-show-thread) t)
7265 (gnus-summary-find-subject subject))
7266 (setq count (1+ count))))
7267 ((> unmark 0) ; Tick.
7270 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7271 (gnus-summary-show-thread) t)
7272 (gnus-summary-find-subject subject))
7273 (setq count (1+ count))))
7274 (t ; Mark as unread.
7277 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7278 (gnus-summary-show-thread) t)
7279 (gnus-summary-find-subject subject))
7280 (setq count (1+ count)))))
7281 (gnus-set-mode-line 'summary)
7282 ;; Return the number of marked articles.
7285 (defun gnus-summary-mark-as-processable (n &optional unmark)
7286 "Set the process mark on the next N articles.
7287 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7288 the process mark instead. The difference between N and the actual
7289 number of articles marked is returned."
7291 (gnus-set-global-variables)
7292 (let ((backward (< n 0))
7297 (gnus-summary-remove-process-mark
7298 (gnus-summary-article-number))
7299 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7300 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7303 (gnus-message 7 "No more articles"))
7304 (gnus-summary-recenter)
7305 (gnus-summary-position-point)
7308 (defun gnus-summary-unmark-as-processable (n)
7309 "Remove the process mark from the next N articles.
7310 If N is negative, unmark backward instead. The difference between N and
7311 the actual number of articles unmarked is returned."
7313 (gnus-set-global-variables)
7314 (gnus-summary-mark-as-processable n t))
7316 (defun gnus-summary-unmark-all-processable ()
7317 "Remove the process mark from all articles."
7319 (gnus-set-global-variables)
7321 (while gnus-newsgroup-processable
7322 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7323 (gnus-summary-position-point))
7325 (defun gnus-summary-mark-as-expirable (n)
7326 "Mark N articles forward as expirable.
7327 If N is negative, mark backward instead. The difference between N and
7328 the actual number of articles marked is returned."
7330 (gnus-set-global-variables)
7331 (gnus-summary-mark-forward n gnus-expirable-mark))
7333 (defun gnus-summary-mark-article-as-replied (article)
7334 "Mark ARTICLE replied and update the summary line."
7335 (push article gnus-newsgroup-replied)
7336 (let ((buffer-read-only nil))
7337 (when (gnus-summary-goto-subject article)
7338 (gnus-summary-update-secondary-mark article))))
7340 (defun gnus-summary-set-bookmark (article)
7341 "Set a bookmark in current article."
7342 (interactive (list (gnus-summary-article-number)))
7343 (gnus-set-global-variables)
7344 (when (or (not (get-buffer gnus-article-buffer))
7345 (not gnus-current-article)
7346 (not gnus-article-current)
7347 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7348 (error "No current article selected"))
7349 ;; Remove old bookmark, if one exists.
7350 (let ((old (assq article gnus-newsgroup-bookmarks)))
7352 (setq gnus-newsgroup-bookmarks
7353 (delq old gnus-newsgroup-bookmarks))))
7354 ;; Set the new bookmark, which is on the form
7355 ;; (article-number . line-number-in-body).
7359 (set-buffer gnus-article-buffer)
7363 (goto-char (point-min))
7364 (search-forward "\n\n" nil t)
7367 gnus-newsgroup-bookmarks)
7368 (gnus-message 6 "A bookmark has been added to the current article."))
7370 (defun gnus-summary-remove-bookmark (article)
7371 "Remove the bookmark from the current article."
7372 (interactive (list (gnus-summary-article-number)))
7373 (gnus-set-global-variables)
7374 ;; Remove old bookmark, if one exists.
7375 (let ((old (assq article gnus-newsgroup-bookmarks)))
7378 (setq gnus-newsgroup-bookmarks
7379 (delq old gnus-newsgroup-bookmarks))
7380 (gnus-message 6 "Removed bookmark."))
7381 (gnus-message 6 "No bookmark in current article."))))
7383 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7384 (defun gnus-summary-mark-as-dormant (n)
7385 "Mark N articles forward as dormant.
7386 If N is negative, mark backward instead. The difference between N and
7387 the actual number of articles marked is returned."
7389 (gnus-set-global-variables)
7390 (gnus-summary-mark-forward n gnus-dormant-mark))
7392 (defun gnus-summary-set-process-mark (article)
7393 "Set the process mark on ARTICLE and update the summary line."
7394 (setq gnus-newsgroup-processable
7396 (delq article gnus-newsgroup-processable)))
7397 (when (gnus-summary-goto-subject article)
7398 (gnus-summary-show-thread)
7399 (gnus-summary-update-secondary-mark article)))
7401 (defun gnus-summary-remove-process-mark (article)
7402 "Remove the process mark from ARTICLE and update the summary line."
7403 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7404 (when (gnus-summary-goto-subject article)
7405 (gnus-summary-show-thread)
7406 (gnus-summary-update-secondary-mark article)))
7408 (defun gnus-summary-set-saved-mark (article)
7409 "Set the process mark on ARTICLE and update the summary line."
7410 (push article gnus-newsgroup-saved)
7411 (when (gnus-summary-goto-subject article)
7412 (gnus-summary-update-secondary-mark article)))
7414 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7415 "Mark N articles as read forwards.
7416 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7417 The difference between N and the actual number of articles marked is
7420 (gnus-set-global-variables)
7421 (let ((backward (< n 0))
7422 (gnus-summary-goto-unread
7423 (and gnus-summary-goto-unread
7424 (not (eq gnus-summary-goto-unread 'never))
7425 (not (memq mark (list gnus-unread-mark
7426 gnus-ticked-mark gnus-dormant-mark)))))
7428 (mark (or mark gnus-del-mark)))
7430 (gnus-summary-mark-article nil mark no-expire)
7431 (zerop (gnus-summary-next-subject
7433 (and gnus-summary-goto-unread
7434 (not (eq gnus-summary-goto-unread 'never)))
7438 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7439 (gnus-summary-recenter)
7440 (gnus-summary-position-point)
7441 (gnus-set-mode-line 'summary)
7444 (defun gnus-summary-mark-article-as-read (mark)
7445 "Mark the current article quickly as read with MARK."
7446 (let ((article (gnus-summary-article-number)))
7447 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7448 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7449 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7450 (push (cons article mark) gnus-newsgroup-reads)
7451 ;; Possibly remove from cache, if that is used.
7452 (when gnus-use-cache
7453 (gnus-cache-enter-remove-article article))
7454 ;; Allow the backend to change the mark.
7455 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7456 ;; Check for auto-expiry.
7457 (when (and gnus-newsgroup-auto-expire
7458 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7459 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7460 (= mark gnus-ancient-mark)
7461 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7462 (= mark gnus-duplicate-mark)))
7463 (setq mark gnus-expirable-mark)
7464 (push article gnus-newsgroup-expirable))
7465 ;; Set the mark in the buffer.
7466 (gnus-summary-update-mark mark 'unread)
7469 (defun gnus-summary-mark-article-as-unread (mark)
7470 "Mark the current article quickly as unread with MARK."
7471 (let ((article (gnus-summary-article-number)))
7473 (gnus-error 1 "Unmarkable article")
7474 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7475 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7476 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7477 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7478 (cond ((= mark gnus-ticked-mark)
7479 (push article gnus-newsgroup-marked))
7480 ((= mark gnus-dormant-mark)
7481 (push article gnus-newsgroup-dormant))
7483 (push article gnus-newsgroup-unreads)))
7484 (setq gnus-newsgroup-reads
7485 (delq (assq article gnus-newsgroup-reads)
7486 gnus-newsgroup-reads))
7488 ;; See whether the article is to be put in the cache.
7490 (vectorp (gnus-summary-article-header article))
7492 (gnus-cache-possibly-enter-article
7493 gnus-newsgroup-name article
7494 (gnus-summary-article-header article)
7495 (= mark gnus-ticked-mark)
7496 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7499 (gnus-summary-update-mark mark 'unread))
7502 (defun gnus-summary-mark-article (&optional article mark no-expire)
7503 "Mark ARTICLE with MARK. MARK can be any character.
7504 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7505 `??' (dormant) and `?E' (expirable).
7506 If MARK is nil, then the default character `?D' is used.
7507 If ARTICLE is nil, then the article on the current line will be
7509 ;; The mark might be a string.
7510 (when (stringp mark)
7511 (setq mark (aref mark 0)))
7512 ;; If no mark is given, then we check auto-expiring.
7513 (and (not no-expire)
7514 gnus-newsgroup-auto-expire
7516 (and (gnus-characterp mark)
7517 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7518 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7519 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7520 (= mark gnus-duplicate-mark))))
7521 (setq mark gnus-expirable-mark))
7522 (let* ((mark (or mark gnus-del-mark))
7523 (article (or article (gnus-summary-article-number))))
7525 (error "No article on current line"))
7526 (if (or (= mark gnus-unread-mark)
7527 (= mark gnus-ticked-mark)
7528 (= mark gnus-dormant-mark))
7529 (gnus-mark-article-as-unread article mark)
7530 (gnus-mark-article-as-read article mark))
7532 ;; See whether the article is to be put in the cache.
7534 (not (= mark gnus-canceled-mark))
7535 (vectorp (gnus-summary-article-header article))
7537 (gnus-cache-possibly-enter-article
7538 gnus-newsgroup-name article
7539 (gnus-summary-article-header article)
7540 (= mark gnus-ticked-mark)
7541 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7543 (when (gnus-summary-goto-subject article nil t)
7544 (let ((buffer-read-only nil))
7545 (gnus-summary-show-thread)
7547 (gnus-summary-update-mark mark 'unread)
7550 (defun gnus-summary-update-secondary-mark (article)
7551 "Update the secondary (read, process, cache) mark."
7552 (gnus-summary-update-mark
7553 (cond ((memq article gnus-newsgroup-processable)
7555 ((memq article gnus-newsgroup-cached)
7557 ((memq article gnus-newsgroup-replied)
7559 ((memq article gnus-newsgroup-saved)
7561 (t gnus-unread-mark))
7563 (when (gnus-visual-p 'summary-highlight 'highlight)
7564 (run-hooks 'gnus-summary-update-hook))
7567 (defun gnus-summary-update-mark (mark type)
7568 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7569 (buffer-read-only nil))
7570 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7571 (when (looking-at "\r")
7574 (<= (+ forward (point)) (point-max)))
7575 ;; Go to the right position on the line.
7576 (goto-char (+ forward (point)))
7577 ;; Replace the old mark with the new mark.
7578 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7579 ;; Optionally update the marks by some user rule.
7580 (when (eq type 'unread)
7582 (gnus-data-find (gnus-summary-article-number)) mark)
7583 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7585 (defun gnus-mark-article-as-read (article &optional mark)
7586 "Enter ARTICLE in the pertinent lists and remove it from others."
7587 ;; Make the article expirable.
7588 (let ((mark (or mark gnus-del-mark)))
7589 (if (= mark gnus-expirable-mark)
7590 (push article gnus-newsgroup-expirable)
7591 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7592 ;; Remove from unread and marked lists.
7593 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7594 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7595 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7596 (push (cons article mark) gnus-newsgroup-reads)
7597 ;; Possibly remove from cache, if that is used.
7598 (when gnus-use-cache
7599 (gnus-cache-enter-remove-article article))))
7601 (defun gnus-mark-article-as-unread (article &optional mark)
7602 "Enter ARTICLE in the pertinent lists and remove it from others."
7603 (let ((mark (or mark gnus-ticked-mark)))
7604 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7605 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7606 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7607 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7609 ;; Unsuppress duplicates?
7610 (when gnus-suppress-duplicates
7611 (gnus-dup-unsuppress-article article))
7613 (cond ((= mark gnus-ticked-mark)
7614 (push article gnus-newsgroup-marked))
7615 ((= mark gnus-dormant-mark)
7616 (push article gnus-newsgroup-dormant))
7618 (push article gnus-newsgroup-unreads)))
7619 (setq gnus-newsgroup-reads
7620 (delq (assq article gnus-newsgroup-reads)
7621 gnus-newsgroup-reads))))
7623 (defalias 'gnus-summary-mark-as-unread-forward
7624 'gnus-summary-tick-article-forward)
7625 (make-obsolete 'gnus-summary-mark-as-unread-forward
7626 'gnus-summary-tick-article-forward)
7627 (defun gnus-summary-tick-article-forward (n)
7628 "Tick N articles forwards.
7629 If N is negative, tick backwards instead.
7630 The difference between N and the number of articles ticked is returned."
7632 (gnus-summary-mark-forward n gnus-ticked-mark))
7634 (defalias 'gnus-summary-mark-as-unread-backward
7635 'gnus-summary-tick-article-backward)
7636 (make-obsolete 'gnus-summary-mark-as-unread-backward
7637 'gnus-summary-tick-article-backward)
7638 (defun gnus-summary-tick-article-backward (n)
7639 "Tick N articles backwards.
7640 The difference between N and the number of articles ticked is returned."
7642 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7644 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7645 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7646 (defun gnus-summary-tick-article (&optional article clear-mark)
7647 "Mark current article as unread.
7648 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7649 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7651 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7654 (defun gnus-summary-mark-as-read-forward (n)
7655 "Mark N articles as read forwards.
7656 If N is negative, mark backwards instead.
7657 The difference between N and the actual number of articles marked is
7660 (gnus-summary-mark-forward n gnus-del-mark t))
7662 (defun gnus-summary-mark-as-read-backward (n)
7663 "Mark the N articles as read backwards.
7664 The difference between N and the actual number of articles marked is
7667 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7669 (defun gnus-summary-mark-as-read (&optional article mark)
7670 "Mark current article as read.
7671 ARTICLE specifies the article to be marked as read.
7672 MARK specifies a string to be inserted at the beginning of the line."
7673 (gnus-summary-mark-article article mark))
7675 (defun gnus-summary-clear-mark-forward (n)
7676 "Clear marks from N articles forward.
7677 If N is negative, clear backward instead.
7678 The difference between N and the number of marks cleared is returned."
7680 (gnus-summary-mark-forward n gnus-unread-mark))
7682 (defun gnus-summary-clear-mark-backward (n)
7683 "Clear marks from N articles backward.
7684 The difference between N and the number of marks cleared is returned."
7686 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7688 (defun gnus-summary-mark-unread-as-read ()
7689 "Intended to be used by `gnus-summary-mark-article-hook'."
7690 (when (memq gnus-current-article gnus-newsgroup-unreads)
7691 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7693 (defun gnus-summary-mark-read-and-unread-as-read ()
7694 "Intended to be used by `gnus-summary-mark-article-hook'."
7695 (let ((mark (gnus-summary-article-mark)))
7696 (when (or (gnus-unread-mark-p mark)
7697 (gnus-read-mark-p mark))
7698 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7700 (defun gnus-summary-mark-region-as-read (point mark all)
7701 "Mark all unread articles between point and mark as read.
7702 If given a prefix, mark all articles between point and mark as read,
7703 even ticked and dormant ones."
7704 (interactive "r\nP")
7713 (memq (setq article (gnus-summary-article-number))
7714 gnus-newsgroup-unreads))
7715 (gnus-summary-mark-article article gnus-del-mark))
7717 (gnus-summary-find-next))))))
7719 (defun gnus-summary-mark-below (score mark)
7720 "Mark articles with score less than SCORE with MARK."
7721 (interactive "P\ncMark: ")
7722 (gnus-set-global-variables)
7723 (setq score (if score
7724 (prefix-numeric-value score)
7725 (or gnus-summary-default-score 0)))
7727 (set-buffer gnus-summary-buffer)
7728 (goto-char (point-min))
7731 (and (< (gnus-summary-article-score) score)
7732 (gnus-summary-mark-article nil mark))
7733 (gnus-summary-find-next)))))
7735 (defun gnus-summary-kill-below (&optional score)
7736 "Mark articles with score below SCORE as read."
7738 (gnus-set-global-variables)
7739 (gnus-summary-mark-below score gnus-killed-mark))
7741 (defun gnus-summary-clear-above (&optional score)
7742 "Clear all marks from articles with score above SCORE."
7744 (gnus-set-global-variables)
7745 (gnus-summary-mark-above score gnus-unread-mark))
7747 (defun gnus-summary-tick-above (&optional score)
7748 "Tick all articles with score above SCORE."
7750 (gnus-set-global-variables)
7751 (gnus-summary-mark-above score gnus-ticked-mark))
7753 (defun gnus-summary-mark-above (score mark)
7754 "Mark articles with score over SCORE with MARK."
7755 (interactive "P\ncMark: ")
7756 (gnus-set-global-variables)
7757 (setq score (if score
7758 (prefix-numeric-value score)
7759 (or gnus-summary-default-score 0)))
7761 (set-buffer gnus-summary-buffer)
7762 (goto-char (point-min))
7764 (when (> (gnus-summary-article-score) score)
7765 (gnus-summary-mark-article nil mark))
7767 (gnus-summary-find-next)))))
7769 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7770 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7771 (defun gnus-summary-limit-include-expunged (&optional no-error)
7772 "Display all the hidden articles that were expunged for low scores."
7774 (gnus-set-global-variables)
7775 (let ((buffer-read-only nil))
7776 (let ((scored gnus-newsgroup-scored)
7779 (unless (gnus-summary-goto-subject (caar scored))
7780 (and (setq h (gnus-summary-article-header (caar scored)))
7781 (< (cdar scored) gnus-summary-expunge-below)
7783 (setq scored (cdr scored)))
7785 (when (not no-error)
7786 (error "No expunged articles hidden"))
7787 (goto-char (point-min))
7788 (gnus-summary-prepare-unthreaded (nreverse headers))
7789 (goto-char (point-min))
7790 (gnus-summary-position-point)
7793 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7794 "Mark all unread articles in this newsgroup as read.
7795 If prefix argument ALL is non-nil, ticked and dormant articles will
7796 also be marked as read.
7797 If QUIETLY is non-nil, no questions will be asked.
7798 If TO-HERE is non-nil, it should be a point in the buffer. All
7799 articles before this point will be marked as read.
7800 Note that this function will only catch up the unread article
7801 in the current summary buffer limitation.
7802 The number of articles marked as read is returned."
7804 (gnus-set-global-variables)
7808 (not gnus-interactive-catchup) ;Without confirmation?
7812 "Mark absolutely all articles as read? "
7813 "Mark all unread articles as read? ")))
7815 (not gnus-newsgroup-adaptive)
7816 (not gnus-newsgroup-auto-expire)
7817 (not gnus-suppress-duplicates)
7818 (or (not gnus-use-cache)
7819 (eq gnus-use-cache 'passive)))
7822 (setq gnus-newsgroup-marked nil
7823 gnus-newsgroup-dormant nil))
7824 (setq gnus-newsgroup-unreads nil))
7825 ;; We actually mark all articles as canceled, which we
7826 ;; have to do when using auto-expiry or adaptive scoring.
7827 (gnus-summary-show-all-threads)
7828 (when (gnus-summary-first-subject (not all))
7830 (if to-here (< (point) to-here) t)
7831 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7832 (gnus-summary-find-next (not all)))))
7833 (gnus-set-mode-line 'summary))
7835 (gnus-summary-position-point)))
7837 (defun gnus-summary-catchup-to-here (&optional all)
7838 "Mark all unticked articles before the current one as read.
7839 If ALL is non-nil, also mark ticked and dormant articles as read."
7841 (gnus-set-global-variables)
7843 (gnus-save-hidden-threads
7844 (let ((beg (point)))
7845 ;; We check that there are unread articles.
7846 (when (or all (gnus-summary-find-prev))
7847 (gnus-summary-catchup all t beg)))))
7848 (gnus-summary-position-point))
7850 (defun gnus-summary-catchup-all (&optional quietly)
7851 "Mark all articles in this newsgroup as read."
7853 (gnus-set-global-variables)
7854 (gnus-summary-catchup t quietly))
7856 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7857 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7858 If prefix argument ALL is non-nil, all articles are marked as read."
7860 (gnus-set-global-variables)
7861 (when (gnus-summary-catchup all quietly nil 'fast)
7862 ;; Select next newsgroup or exit.
7863 (if (eq gnus-auto-select-next 'quietly)
7864 (gnus-summary-next-group nil)
7865 (gnus-summary-exit))))
7867 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7868 "Mark all articles in this newsgroup as read, and then exit."
7870 (gnus-set-global-variables)
7871 (gnus-summary-catchup-and-exit t quietly))
7873 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7874 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7875 "Mark all articles in this group as read and select the next group.
7876 If given a prefix, mark all articles, unread as well as ticked, as
7879 (gnus-set-global-variables)
7881 (gnus-summary-catchup all))
7882 (gnus-summary-next-article t nil nil t))
7884 ;; Thread-based commands.
7886 (defun gnus-summary-articles-in-thread (&optional article)
7887 "Return a list of all articles in the current thread.
7888 If ARTICLE is non-nil, return all articles in the thread that starts
7890 (let* ((article (or article (gnus-summary-article-number)))
7891 (data (gnus-data-find-list article))
7892 (top-level (gnus-data-level (car data)))
7894 (cond ((null gnus-thread-operation-ignore-subject)
7895 (gnus-simplify-subject-re
7896 (mail-header-subject (gnus-data-header (car data)))))
7897 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7898 (gnus-simplify-subject-fuzzy
7899 (mail-header-subject (gnus-data-header (car data)))))
7901 (end-point (save-excursion
7902 (if (gnus-summary-go-to-next-thread)
7903 (point) (point-max))))
7906 (< (gnus-data-pos (car data)) end-point))
7907 (when (or (not top-subject)
7908 (string= top-subject
7909 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7910 (gnus-simplify-subject-fuzzy
7911 (mail-header-subject
7912 (gnus-data-header (car data))))
7913 (gnus-simplify-subject-re
7914 (mail-header-subject
7915 (gnus-data-header (car data)))))))
7916 (push (gnus-data-number (car data)) articles))
7917 (unless (and (setq data (cdr data))
7918 (> (gnus-data-level (car data)) top-level))
7920 ;; Return the list of articles.
7921 (nreverse articles)))
7923 (defun gnus-summary-rethread-current ()
7924 "Rethread the thread the current article is part of."
7926 (gnus-set-global-variables)
7927 (let* ((gnus-show-threads t)
7928 (article (gnus-summary-article-number))
7929 (id (mail-header-id (gnus-summary-article-header)))
7930 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7932 (error "No article on the current line"))
7933 (gnus-rebuild-thread id)
7934 (gnus-summary-goto-subject article)))
7936 (defun gnus-summary-reparent-thread ()
7937 "Make the current article child of the marked (or previous) article.
7939 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7940 is non-nil or the Subject: of both articles are the same."
7942 (unless (not (gnus-group-read-only-p))
7943 (error "The current newsgroup does not support article editing"))
7944 (unless (<= (length gnus-newsgroup-processable) 1)
7945 (error "No more than one article may be marked"))
7946 (save-window-excursion
7947 (let ((gnus-article-buffer " *reparent*")
7948 (current-article (gnus-summary-article-number))
7949 ;; First grab the marked article, otherwise one line up.
7950 (parent-article (if (not (null gnus-newsgroup-processable))
7951 (car gnus-newsgroup-processable)
7953 (if (eq (forward-line -1) 0)
7954 (gnus-summary-article-number)
7955 (error "Beginning of summary buffer"))))))
7956 (unless (not (eq current-article parent-article))
7957 (error "An article may not be self-referential"))
7958 (let ((message-id (mail-header-id
7959 (gnus-summary-article-header parent-article))))
7960 (unless (and message-id (not (equal message-id "")))
7961 (error "No message-id in desired parent"))
7962 (gnus-summary-select-article t t nil current-article)
7963 (set-buffer gnus-original-article-buffer)
7964 (let ((buf (format "%s" (buffer-string))))
7965 (nnheader-temp-write nil
7967 (goto-char (point-min))
7968 (if (search-forward-regexp "^References: " nil t)
7969 (insert message-id " " )
7970 (insert "References: " message-id "\n"))
7971 (unless (gnus-request-replace-article
7972 current-article (car gnus-article-current)
7974 (error "Couldn't replace article"))))
7975 (set-buffer gnus-summary-buffer)
7976 (gnus-summary-unmark-all-processable)
7977 (gnus-summary-rethread-current)
7978 (gnus-message 3 "Article %d is now the child of article %d"
7979 current-article parent-article)))))
7981 (defun gnus-summary-toggle-threads (&optional arg)
7982 "Toggle showing conversation threads.
7983 If ARG is positive number, turn showing conversation threads on."
7985 (gnus-set-global-variables)
7986 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7987 (setq gnus-show-threads
7988 (if (null arg) (not gnus-show-threads)
7989 (> (prefix-numeric-value arg) 0)))
7990 (gnus-summary-prepare)
7991 (gnus-summary-goto-subject current)
7992 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7993 (gnus-summary-position-point)))
7995 (defun gnus-summary-show-all-threads ()
7998 (gnus-set-global-variables)
8000 (let ((buffer-read-only nil))
8001 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8002 (gnus-summary-position-point))
8004 (defun gnus-summary-show-thread ()
8005 "Show thread subtrees.
8006 Returns nil if no thread was there to be shown."
8008 (gnus-set-global-variables)
8009 (let ((buffer-read-only nil)
8011 ;; first goto end then to beg, to have point at beg after let
8012 (end (progn (end-of-line) (point)))
8013 (beg (progn (beginning-of-line) (point))))
8015 ;; Any hidden lines here?
8016 (search-forward "\r" end t)
8017 (subst-char-in-region beg end ?\^M ?\n t)
8019 (gnus-summary-position-point))))
8021 (defun gnus-summary-hide-all-threads ()
8022 "Hide all thread subtrees."
8024 (gnus-set-global-variables)
8026 (goto-char (point-min))
8027 (gnus-summary-hide-thread)
8028 (while (zerop (gnus-summary-next-thread 1 t))
8029 (gnus-summary-hide-thread)))
8030 (gnus-summary-position-point))
8032 (defun gnus-summary-hide-thread ()
8033 "Hide thread subtrees.
8034 Returns nil if no threads were there to be hidden."
8036 (gnus-set-global-variables)
8037 (let ((buffer-read-only nil)
8039 (article (gnus-summary-article-number)))
8041 ;; Go forward until either the buffer ends or the subthread
8043 (when (and (not (eobp))
8044 (or (zerop (gnus-summary-next-thread 1 t))
8045 (goto-char (point-max))))
8047 (if (and (> (point) start)
8048 (search-backward "\n" start t))
8050 (subst-char-in-region start (point) ?\n ?\^M)
8051 (gnus-summary-goto-subject article))
8054 ;;(gnus-summary-position-point)
8057 (defun gnus-summary-go-to-next-thread (&optional previous)
8058 "Go to the same level (or less) next thread.
8059 If PREVIOUS is non-nil, go to previous thread instead.
8060 Return the article number moved to, or nil if moving was impossible."
8061 (let ((level (gnus-summary-thread-level))
8062 (way (if previous -1 1))
8065 (while (and (not (eobp))
8066 (< level (gnus-summary-thread-level)))
8074 (gnus-summary-article-number)
8077 (defun gnus-summary-next-thread (n &optional silent)
8078 "Go to the same level next N'th thread.
8079 If N is negative, search backward instead.
8080 Returns the difference between N and the number of skips actually
8083 If SILENT, don't output messages."
8085 (gnus-set-global-variables)
8086 (let ((backward (< n 0))
8089 (gnus-summary-go-to-next-thread backward))
8092 (gnus-summary-position-point))
8093 (when (and (not silent) (/= 0 n))
8094 (gnus-message 7 "No more threads"))
8097 (defun gnus-summary-prev-thread (n)
8098 "Go to the same level previous N'th thread.
8099 Returns the difference between N and the number of skips actually
8102 (gnus-set-global-variables)
8103 (gnus-summary-next-thread (- n)))
8105 (defun gnus-summary-go-down-thread ()
8106 "Go down one level in the current thread."
8107 (let ((children (gnus-summary-article-children)))
8109 (gnus-summary-goto-subject (car children)))))
8111 (defun gnus-summary-go-up-thread ()
8112 "Go up one level in the current thread."
8113 (let ((parent (gnus-summary-article-parent)))
8115 (gnus-summary-goto-subject parent))))
8117 (defun gnus-summary-down-thread (n)
8118 "Go down thread N steps.
8119 If N is negative, go up instead.
8120 Returns the difference between N and how many steps down that were
8123 (gnus-set-global-variables)
8127 (if up (gnus-summary-go-up-thread)
8128 (gnus-summary-go-down-thread)))
8130 (gnus-summary-position-point)
8132 (gnus-message 7 "Can't go further"))
8135 (defun gnus-summary-up-thread (n)
8136 "Go up thread N steps.
8137 If N is negative, go up instead.
8138 Returns the difference between N and how many steps down that were
8141 (gnus-set-global-variables)
8142 (gnus-summary-down-thread (- n)))
8144 (defun gnus-summary-top-thread ()
8145 "Go to the top of the thread."
8147 (gnus-set-global-variables)
8148 (while (gnus-summary-go-up-thread))
8149 (gnus-summary-article-number))
8151 (defun gnus-summary-kill-thread (&optional unmark)
8152 "Mark articles under current thread as read.
8153 If the prefix argument is positive, remove any kinds of marks.
8154 If the prefix argument is negative, tick articles instead."
8156 (gnus-set-global-variables)
8158 (setq unmark (prefix-numeric-value unmark)))
8159 (let ((articles (gnus-summary-articles-in-thread)))
8161 ;; Expand the thread.
8162 (gnus-summary-show-thread)
8163 ;; Mark all the articles.
8165 (gnus-summary-goto-subject (car articles))
8166 (cond ((null unmark)
8167 (gnus-summary-mark-article-as-read gnus-killed-mark))
8169 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8171 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8172 (setq articles (cdr articles))))
8173 ;; Hide killed subtrees.
8175 gnus-thread-hide-killed
8176 (gnus-summary-hide-thread))
8177 ;; If marked as read, go to next unread subject.
8179 ;; Go to next unread subject.
8180 (gnus-summary-next-subject 1 t)))
8181 (gnus-set-mode-line 'summary))
8183 ;; Summary sorting commands
8185 (defun gnus-summary-sort-by-number (&optional reverse)
8186 "Sort the summary buffer by article number.
8187 Argument REVERSE means reverse order."
8189 (gnus-summary-sort 'number reverse))
8191 (defun gnus-summary-sort-by-author (&optional reverse)
8192 "Sort the summary buffer by author name alphabetically.
8193 If case-fold-search is non-nil, case of letters is ignored.
8194 Argument REVERSE means reverse order."
8196 (gnus-summary-sort 'author reverse))
8198 (defun gnus-summary-sort-by-subject (&optional reverse)
8199 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8200 If case-fold-search is non-nil, case of letters is ignored.
8201 Argument REVERSE means reverse order."
8203 (gnus-summary-sort 'subject reverse))
8205 (defun gnus-summary-sort-by-date (&optional reverse)
8206 "Sort the summary buffer by date.
8207 Argument REVERSE means reverse order."
8209 (gnus-summary-sort 'date reverse))
8211 (defun gnus-summary-sort-by-score (&optional reverse)
8212 "Sort the summary buffer by score.
8213 Argument REVERSE means reverse order."
8215 (gnus-summary-sort 'score reverse))
8217 (defun gnus-summary-sort-by-lines (&optional reverse)
8218 "Sort the summary buffer by article length.
8219 Argument REVERSE means reverse order."
8221 (gnus-summary-sort 'lines reverse))
8223 (defun gnus-summary-sort (predicate reverse)
8224 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8225 (gnus-set-global-variables)
8226 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8227 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8228 (gnus-thread-sort-functions
8234 (gnus-article-sort-functions
8239 (,article t2 t1)))))
8241 (gnus-summary-prepare-hook nil))
8242 ;; We do the sorting by regenerating the threads.
8243 (gnus-summary-prepare)
8244 ;; Hide subthreads if needed.
8245 (when (and gnus-show-threads gnus-thread-hide-subtree)
8246 (gnus-summary-hide-all-threads))))
8248 ;; Summary saving commands.
8250 (defun gnus-summary-save-article (&optional n not-saved)
8251 "Save the current article using the default saver function.
8252 If N is a positive number, save the N next articles.
8253 If N is a negative number, save the N previous articles.
8254 If N is nil and any articles have been marked with the process mark,
8255 save those articles instead.
8256 The variable `gnus-default-article-saver' specifies the saver function."
8258 (gnus-set-global-variables)
8259 (let* ((articles (gnus-summary-work-articles n))
8260 (save-buffer (save-excursion
8261 (nnheader-set-temp-buffer " *Gnus Save*")))
8262 (num (length articles))
8263 header article file)
8265 (setq header (gnus-summary-article-header
8266 (setq article (pop articles))))
8267 (if (not (vectorp header))
8268 ;; This is a pseudo-article.
8269 (if (assq 'name header)
8270 (gnus-copy-file (cdr (assq 'name header)))
8271 (gnus-message 1 "Article %d is unsaveable" article))
8272 ;; This is a real article.
8273 (save-window-excursion
8274 (gnus-summary-select-article t nil nil article))
8276 (set-buffer save-buffer)
8278 (insert-buffer-substring gnus-original-article-buffer))
8279 (setq file (gnus-article-save save-buffer file num))
8280 (gnus-summary-remove-process-mark article)
8282 (gnus-summary-set-saved-mark article))))
8283 (gnus-kill-buffer save-buffer)
8284 (gnus-summary-position-point)
8285 (gnus-set-mode-line 'summary)
8288 (defun gnus-summary-pipe-output (&optional arg)
8289 "Pipe the current article to a subprocess.
8290 If N is a positive number, pipe the N next articles.
8291 If N is a negative number, pipe the N previous articles.
8292 If N is nil and any articles have been marked with the process mark,
8293 pipe those articles instead."
8295 (gnus-set-global-variables)
8296 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8297 (gnus-summary-save-article arg t))
8298 (gnus-configure-windows 'pipe))
8300 (defun gnus-summary-save-article-mail (&optional arg)
8301 "Append the current article to an mail file.
8302 If N is a positive number, save the N next articles.
8303 If N is a negative number, save the N previous articles.
8304 If N is nil and any articles have been marked with the process mark,
8305 save those articles instead."
8307 (gnus-set-global-variables)
8308 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8309 (gnus-summary-save-article arg)))
8311 (defun gnus-summary-save-article-rmail (&optional arg)
8312 "Append the current article to an rmail file.
8313 If N is a positive number, save the N next articles.
8314 If N is a negative number, save the N previous articles.
8315 If N is nil and any articles have been marked with the process mark,
8316 save those articles instead."
8318 (gnus-set-global-variables)
8319 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8320 (gnus-summary-save-article arg)))
8322 (defun gnus-summary-save-article-file (&optional arg)
8323 "Append the current article to a file.
8324 If N is a positive number, save the N next articles.
8325 If N is a negative number, save the N previous articles.
8326 If N is nil and any articles have been marked with the process mark,
8327 save those articles instead."
8329 (gnus-set-global-variables)
8330 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8331 (gnus-summary-save-article arg)))
8333 (defun gnus-summary-write-article-file (&optional arg)
8334 "Write the current article to a file, deleting the previous file.
8335 If N is a positive number, save the N next articles.
8336 If N is a negative number, save the N previous articles.
8337 If N is nil and any articles have been marked with the process mark,
8338 save those articles instead."
8340 (gnus-set-global-variables)
8341 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8342 (gnus-summary-save-article arg)))
8344 (defun gnus-summary-save-article-body-file (&optional arg)
8345 "Append the current article body to a file.
8346 If N is a positive number, save the N next articles.
8347 If N is a negative number, save the N previous articles.
8348 If N is nil and any articles have been marked with the process mark,
8349 save those articles instead."
8351 (gnus-set-global-variables)
8352 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8353 (gnus-summary-save-article arg)))
8355 (defun gnus-summary-pipe-message (program)
8356 "Pipe the current article through PROGRAM."
8357 (interactive "sProgram: ")
8358 (gnus-set-global-variables)
8359 (gnus-summary-select-article)
8360 (let ((mail-header-separator "")
8361 (art-buf (get-buffer gnus-article-buffer)))
8362 (gnus-eval-in-buffer-window gnus-article-buffer
8365 (let ((start (window-start))
8367 (message-pipe-buffer-body program)
8368 (set-window-start (get-buffer-window (current-buffer)) start))))))
8370 (defun gnus-get-split-value (methods)
8371 "Return a value based on the split METHODS."
8372 (let (split-name method result match)
8375 (set-buffer gnus-original-article-buffer)
8377 (nnheader-narrow-to-headers)
8379 (goto-char (point-min))
8380 (setq method (pop methods))
8381 (setq match (car method))
8384 ;; Regular expression.
8386 (re-search-forward match nil t)))
8387 ((gnus-functionp match)
8391 (setq result (funcall match gnus-newsgroup-name))))
8396 (setq result (eval match)))))
8397 (setq split-name (append (cdr method) split-name))
8398 (cond ((stringp result)
8399 (push (expand-file-name
8400 result gnus-article-save-directory)
8403 (setq split-name (append result split-name)))))))))
8406 (defun gnus-valid-move-group-p (group)
8411 (car (gnus-find-method-for-group
8412 (symbol-name group))))
8413 gnus-valid-select-methods))))
8415 (defun gnus-read-move-group-name (prompt default articles prefix)
8416 "Read a group name."
8417 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8418 (minibuffer-confirm-incomplete nil) ; XEmacs
8422 (if (> (length articles) 1)
8423 (format "these %d articles" (length articles))
8428 (gnus-completing-read default prom
8430 'gnus-valid-move-group-p
8432 'gnus-group-history))
8433 ((= 1 (length split-name))
8434 (gnus-completing-read (car split-name) prom
8436 'gnus-valid-move-group-p
8438 'gnus-group-history))
8440 (gnus-completing-read nil prom
8441 (mapcar (lambda (el) (list el))
8442 (nreverse split-name))
8444 'gnus-group-history)))))
8446 (if (or (string= to-newsgroup "")
8447 (string= to-newsgroup prefix))
8448 (setq to-newsgroup default))
8449 (unless to-newsgroup
8450 (error "No group name entered"))
8451 (or (gnus-active to-newsgroup)
8452 (gnus-activate-group to-newsgroup)
8453 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8455 (or (and (gnus-request-create-group
8456 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8457 (gnus-activate-group to-newsgroup nil nil
8458 (gnus-group-name-to-method
8460 (error "Couldn't create group %s" to-newsgroup)))
8461 (error "No such group: %s" to-newsgroup)))
8464 ;; Summary extract commands
8466 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8467 (let ((buffer-read-only nil)
8468 (article (gnus-summary-article-number))
8470 (unless (gnus-summary-goto-subject article)
8471 (error "No such article: %d" article))
8472 (gnus-summary-position-point)
8473 ;; If all commands are to be bunched up on one line, we collect
8475 (unless gnus-view-pseudos-separately
8476 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8479 (setq action (cdr (assq 'action (car ps))))
8480 (setq files (list (cdr (assq 'name (car ps)))))
8481 (while (and ps (cdr ps)
8482 (string= (or action "1")
8483 (or (cdr (assq 'action (cadr ps))) "2")))
8484 (push (cdr (assq 'name (cadr ps))) files)
8485 (setcdr ps (cddr ps)))
8487 (when (not (string-match "%s" action))
8490 (when (assq 'execute (car ps))
8491 (setcdr (assq 'execute (car ps))
8492 (funcall (if (string-match "%s" action)
8499 (gnus-quote-arg-for-sh-or-csh f)))
8501 (setq ps (cdr ps)))))
8502 (if (and gnus-view-pseudos (not not-view))
8504 (when (assq 'execute (car pslist))
8505 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8506 (eq gnus-view-pseudos 'not-confirm)))
8507 (setq pslist (cdr pslist)))
8510 (setq after-article (or (cdr (assq 'article (car pslist)))
8511 (gnus-summary-article-number)))
8512 (gnus-summary-goto-subject after-article)
8515 (insert " " (file-name-nondirectory
8516 (cdr (assq 'name (car pslist))))
8517 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8519 (forward-line -1) ; back to `b'
8520 (gnus-add-text-properties
8521 b (1- e) (list 'gnus-number gnus-reffed-article-number
8522 gnus-mouse-face-prop gnus-mouse-face))
8524 after-article gnus-reffed-article-number
8525 gnus-unread-mark b (car pslist) 0 (- e b))
8526 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8527 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8528 (setq pslist (cdr pslist)))))))
8530 (defun gnus-pseudos< (p1 p2)
8531 (let ((c1 (cdr (assq 'action p1)))
8532 (c2 (cdr (assq 'action p2))))
8533 (and c1 c2 (string< c1 c2))))
8535 (defun gnus-request-pseudo-article (props)
8536 (cond ((assq 'execute props)
8537 (gnus-execute-command (cdr (assq 'execute props)))))
8538 (let ((gnus-current-article (gnus-summary-article-number)))
8539 (run-hooks 'gnus-mark-article-hook)))
8541 (defun gnus-execute-command (command &optional automatic)
8543 (gnus-article-setup-buffer)
8544 (set-buffer gnus-article-buffer)
8545 (setq buffer-read-only nil)
8546 (let ((command (if automatic command
8547 (read-string "Command: " (cons command 0)))))
8549 (insert "$ " command "\n\n")
8550 (if gnus-view-pseudo-asynchronously
8551 (start-process "gnus-execute" (current-buffer) shell-file-name
8552 shell-command-switch command)
8553 (call-process shell-file-name nil t nil
8554 shell-command-switch command)))))
8556 ;; Summary kill commands.
8558 (defun gnus-summary-edit-global-kill (article)
8559 "Edit the \"global\" kill file."
8560 (interactive (list (gnus-summary-article-number)))
8561 (gnus-set-global-variables)
8562 (gnus-group-edit-global-kill article))
8564 (defun gnus-summary-edit-local-kill ()
8565 "Edit a local kill file applied to the current newsgroup."
8567 (gnus-set-global-variables)
8568 (setq gnus-current-headers (gnus-summary-article-header))
8569 (gnus-set-global-variables)
8570 (gnus-group-edit-local-kill
8571 (gnus-summary-article-number) gnus-newsgroup-name))
8575 (defun gnus-read-header (id &optional header)
8576 "Read the headers of article ID and enter them into the Gnus system."
8577 (let ((group gnus-newsgroup-name)
8578 (gnus-override-method
8579 (and (gnus-news-group-p gnus-newsgroup-name)
8580 gnus-refer-article-method))
8582 ;; First we check to see whether the header in question is already
8585 ;; This is a Message-ID.
8586 (setq header (or header (gnus-id-to-header id)))
8587 ;; This is an article number.
8588 (setq header (or header (gnus-summary-article-header id))))
8590 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8591 ;; We have found the header.
8593 ;; We have to really fetch the header to this article.
8595 (set-buffer nntp-server-buffer)
8596 (when (setq where (gnus-request-head id group))
8597 (nnheader-fold-continuation-lines)
8598 (goto-char (point-max))
8600 (goto-char (point-min))
8604 ((cdr where) (cdr where))
8605 (header (mail-header-number header))
8606 (t gnus-reffed-article-number))
8608 (insert " Article retrieved.\n"))
8610 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8611 () ; Malformed head.
8612 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8613 (when (and (stringp id)
8614 (not (string= (gnus-group-real-name group)
8616 ;; If we fetched by Message-ID and the article came
8617 ;; from a different group, we fudge some bogus article
8618 ;; numbers for this article.
8619 (mail-header-set-number header gnus-reffed-article-number))
8621 (set-buffer gnus-summary-buffer)
8622 (decf gnus-reffed-article-number)
8623 (gnus-remove-header (mail-header-number header))
8624 (push header gnus-newsgroup-headers)
8625 (setq gnus-current-headers header)
8626 (push (mail-header-number header) gnus-newsgroup-limit)))
8629 (defun gnus-remove-header (number)
8630 "Remove header NUMBER from `gnus-newsgroup-headers'."
8631 (if (and gnus-newsgroup-headers
8632 (= number (mail-header-number (car gnus-newsgroup-headers))))
8633 (pop gnus-newsgroup-headers)
8634 (let ((headers gnus-newsgroup-headers))
8635 (while (and (cdr headers)
8636 (not (= number (mail-header-number (cadr headers)))))
8639 (setcdr headers (cddr headers))))))
8642 ;;; summary highlights
8645 (defun gnus-highlight-selected-summary ()
8646 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8647 ;; Highlight selected article in summary buffer
8648 (when gnus-summary-selected-face
8650 (let* ((beg (progn (beginning-of-line) (point)))
8651 (end (progn (end-of-line) (point)))
8652 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8653 (from (if (get-text-property beg gnus-mouse-face-prop)
8655 (or (next-single-property-change
8656 beg gnus-mouse-face-prop nil end)
8661 (or (next-single-property-change
8662 from gnus-mouse-face-prop nil end)
8664 ;; If no mouse-face prop on line we will have to = from = end,
8665 ;; so we highlight the entire line instead.
8666 (when (= (+ to 2) from)
8669 (if gnus-newsgroup-selected-overlay
8670 ;; Move old overlay.
8672 gnus-newsgroup-selected-overlay from to (current-buffer))
8673 ;; Create new overlay.
8675 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8676 'face gnus-summary-selected-face))))))
8678 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8679 (defun gnus-summary-highlight-line ()
8680 "Highlight current line according to `gnus-summary-highlight'."
8681 (let* ((list gnus-summary-highlight)
8683 (end (progn (end-of-line) (point)))
8684 ;; now find out where the line starts and leave point there.
8685 (beg (progn (beginning-of-line) (point)))
8686 (article (gnus-summary-article-number))
8687 (score (or (cdr (assq (or article gnus-current-article)
8688 gnus-newsgroup-scored))
8689 gnus-summary-default-score 0))
8690 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8691 (inhibit-read-only t))
8692 ;; Eval the cars of the lists until we find a match.
8693 (let ((default gnus-summary-default-score))
8695 (not (eval (caar list))))
8696 (setq list (cdr list))))
8697 (let ((face (cdar list)))
8698 (unless (eq face (get-text-property beg 'face))
8699 (gnus-put-text-property
8701 (setq face (if (boundp face) (symbol-value face) face)))
8702 (when gnus-summary-highlight-line-function
8703 (funcall gnus-summary-highlight-line-function article face))))
8706 (defun gnus-update-read-articles (group unread &optional compute)
8707 "Update the list of read articles in GROUP."
8708 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8709 (entry (gnus-gethash group gnus-newsrc-hashtb))
8710 (info (nth 2 entry))
8712 (unread (sort (copy-sequence unread) '<))
8714 (if (or (not info) (not active))
8715 ;; There is no info on this group if it was, in fact,
8716 ;; killed. Gnus stores no information on killed groups, so
8717 ;; there's nothing to be done.
8718 ;; One could store the information somewhere temporarily,
8719 ;; perhaps... Hmmm...
8721 ;; Remove any negative articles numbers.
8722 (while (and unread (< (car unread) 0))
8723 (setq unread (cdr unread)))
8724 ;; Remove any expired article numbers
8725 (while (and unread (< (car unread) (car active)))
8726 (setq unread (cdr unread)))
8727 ;; Compute the ranges of read articles by looking at the list of
8730 (when (/= (car unread) prev)
8731 (push (if (= prev (1- (car unread))) prev
8732 (cons prev (1- (car unread))))
8734 (setq prev (1+ (car unread)))
8735 (setq unread (cdr unread)))
8736 (when (<= prev (cdr active))
8737 (push (cons prev (cdr active)) read))
8739 (if (> (length read) 1) (nreverse read) read)
8741 (set-buffer gnus-group-buffer)
8744 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8745 (gnus-info-set-read ',info ',(gnus-info-read info))
8746 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8747 (gnus-group-update-group ,group t))))
8748 ;; Enter this list into the group info.
8750 info (if (> (length read) 1) (nreverse read) read))
8751 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8752 (gnus-get-unread-articles-in-group info (gnus-active group))
8755 (defun gnus-offer-save-summaries ()
8756 "Offer to save all active summary buffers."
8758 (let ((buflist (buffer-list))
8760 ;; Go through all buffers and find all summaries.
8762 (and (setq bufname (buffer-name (car buflist)))
8763 (string-match "Summary" bufname)
8765 (set-buffer bufname)
8766 ;; We check that this is, indeed, a summary buffer.
8767 (and (eq major-mode 'gnus-summary-mode)
8768 ;; Also make sure this isn't bogus.
8769 gnus-newsgroup-prepared
8770 ;; Also make sure that this isn't a dead summary buffer.
8771 (not gnus-dead-summary-mode)))
8772 (push bufname buffers))
8773 (setq buflist (cdr buflist)))
8774 ;; Go through all these summary buffers and offer to save them.
8777 "Update summary buffer %s? "
8778 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8785 (run-hooks 'gnus-sum-load-hook)
8787 ;;; gnus-sum.el ends here