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))
36 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
38 (defcustom gnus-kill-summary-on-exit t
39 "*If non-nil, kill the summary buffer when you exit from it.
40 If nil, the summary will become a \"*Dead Summary*\" buffer, and
41 it will be killed sometime later."
42 :group 'gnus-summary-exit
45 (defcustom gnus-fetch-old-headers nil
46 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
47 If an unread article in the group refers to an older, already read (or
48 just marked as read) article, the old article will not normally be
49 displayed in the Summary buffer. If this variable is non-nil, Gnus
50 will attempt to grab the headers to the old articles, and thereby
51 build complete threads. If it has the value `some', only enough
52 headers to connect otherwise loose threads will be displayed. This
53 variable can also be a number. In that case, no more than that number
54 of old headers will be fetched. If it has the value `invisible', all
55 old headers will be fetched, but none will be displayed.
57 The server has to support NOV for any of this to work."
59 :type '(choice (const :tag "off" nil)
62 (sexp :menu-tag "other" t)))
64 (defcustom gnus-refer-thread-limit 200
65 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
66 If t, fetch all the available old headers."
69 (sexp :menu-tag "other" t)))
71 (defcustom gnus-summary-make-false-root 'adopt
72 "*nil means that Gnus won't gather loose threads.
73 If the root of a thread has expired or been read in a previous
74 session, the information necessary to build a complete thread has been
75 lost. Instead of having many small sub-threads from this original thread
76 scattered all over the summary buffer, Gnus can gather them.
78 If non-nil, Gnus will try to gather all loose sub-threads from an
79 original thread into one large thread.
81 If this variable is non-nil, it should be one of `none', `adopt',
84 If this variable is `none', Gnus will not make a false root, but just
85 present the sub-threads after another.
86 If this variable is `dummy', Gnus will create a dummy root that will
87 have all the sub-threads as children.
88 If this variable is `adopt', Gnus will make one of the \"children\"
89 the parent and mark all the step-children as such.
90 If this variable is `empty', the \"children\" are printed with empty
91 subject fields. (Or rather, they will be printed with a string
92 given by the `gnus-summary-same-subject' variable.)"
94 :type '(choice (const :tag "off" nil)
100 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
101 "*A regexp to match subjects to be excluded from loose thread gathering.
102 As loose thread gathering is done on subjects only, that means that
103 there can be many false gatherings performed. By rooting out certain
104 common subjects, gathering might become saner."
108 (defcustom gnus-summary-gather-subject-limit nil
109 "*Maximum length of subject comparisons when gathering loose threads.
110 Use nil to compare full subjects. Setting this variable to a low
111 number will help gather threads that have been corrupted by
112 newsreaders chopping off subject lines, but it might also mean that
113 unrelated articles that have subject that happen to begin with the
114 same few characters will be incorrectly gathered.
116 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
119 :type '(choice (const :tag "off" nil)
121 (sexp :menu-tag "on" t)))
123 (defcustom gnus-simplify-subject-functions nil
124 "List of functions taking a string argument that simplify subjects.
125 The functions are applied recursively."
127 :type '(repeat (list function)))
129 (defcustom gnus-simplify-ignored-prefixes nil
130 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
132 :type '(choice (const :tag "off" nil)
135 (defcustom gnus-build-sparse-threads nil
136 "*If non-nil, fill in the gaps in threads.
137 If `some', only fill in the gaps that are needed to tie loose threads
138 together. If `more', fill in all leaf nodes that Gnus can find. If
139 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
141 :type '(choice (const :tag "off" nil)
144 (sexp :menu-tag "all" t)))
146 (defcustom gnus-summary-thread-gathering-function
147 'gnus-gather-threads-by-subject
148 "Function used for gathering loose threads.
149 There are two pre-defined functions: `gnus-gather-threads-by-subject',
150 which only takes Subjects into consideration; and
151 `gnus-gather-threads-by-references', which compared the References
152 headers of the articles to find matches."
154 :type '(radio (function-item gnus-gather-threads-by-subject)
155 (function-item gnus-gather-threads-by-references)
156 (function :tag "other")))
158 (defcustom gnus-summary-same-subject ""
159 "*String indicating that the current article has the same subject as the previous.
160 This variable will only be used if the value of
161 `gnus-summary-make-false-root' is `empty'."
162 :group 'gnus-summary-format
165 (defcustom gnus-summary-goto-unread t
166 "*If t, marking commands will go to the next unread article.
167 If `never', commands that usually go to the next unread article, will
168 go to the next article, whether it is read or not.
169 If nil, only the marking commands will go to the next (un)read article."
170 :group 'gnus-summary-marks
171 :link '(custom-manual "(gnus)Setting Marks")
172 :type '(choice (const :tag "off" nil)
174 (sexp :menu-tag "on" t)))
176 (defcustom gnus-summary-default-score 0
177 "*Default article score level.
178 All scores generated by the score files will be added to this score.
179 If this variable is nil, scoring will be disabled."
180 :group 'gnus-score-default
181 :type '(choice (const :tag "disable")
184 (defcustom gnus-summary-zcore-fuzz 0
185 "*Fuzziness factor for the zcore in the summary buffer.
186 Articles with scores closer than this to `gnus-summary-default-score'
188 :group 'gnus-summary-format
191 (defcustom gnus-simplify-subject-fuzzy-regexp nil
192 "*Strings to be removed when doing fuzzy matches.
193 This can either be a regular expression or list of regular expressions
194 that will be removed from subject strings if fuzzy subject
195 simplification is selected."
197 :type '(repeat regexp))
199 (defcustom gnus-show-threads t
200 "*If non-nil, display threads in summary mode."
204 (defcustom gnus-thread-hide-subtree nil
205 "*If non-nil, hide all threads initially.
206 If threads are hidden, you have to run the command
207 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
208 to expose hidden threads."
212 (defcustom gnus-thread-hide-killed t
213 "*If non-nil, hide killed threads automatically."
217 (defcustom gnus-thread-ignore-subject nil
218 "*If non-nil, ignore subjects and do all threading based on the Reference header.
219 If nil, which is the default, articles that have different subjects
220 from their parents will start separate threads."
224 (defcustom gnus-thread-operation-ignore-subject t
225 "*If non-nil, subjects will be ignored when doing thread commands.
226 This affects commands like `gnus-summary-kill-thread' and
227 `gnus-summary-lower-thread'.
229 If this variable is nil, articles in the same thread with different
230 subjects will not be included in the operation in question. If this
231 variable is `fuzzy', only articles that have subjects that are fuzzily
232 equal will be included."
234 :type '(choice (const :tag "off" nil)
238 (defcustom gnus-thread-indent-level 4
239 "*Number that says how much each sub-thread should be indented."
243 (defcustom gnus-auto-extend-newsgroup t
244 "*If non-nil, extend newsgroup forward and backward when requested."
245 :group 'gnus-summary-choose
248 (defcustom gnus-auto-select-first t
249 "*If nil, don't select the first unread article when entering a group.
250 If this variable is `best', select the highest-scored unread article
251 in the group. If neither nil nor `best', select the first unread
254 If you want to prevent automatic selection of the first unread article
255 in some newsgroups, set the variable to nil in
256 `gnus-select-group-hook'."
257 :group 'gnus-group-select
258 :type '(choice (const :tag "none" nil)
260 (sexp :menu-tag "first" t)))
262 (defcustom gnus-auto-select-next t
263 "*If non-nil, offer to go to the next group from the end of the previous.
264 If the value is t and the next newsgroup is empty, Gnus will exit
265 summary mode and go back to group mode. If the value is neither nil
266 nor t, Gnus will select the following unread newsgroup. In
267 particular, if the value is the symbol `quietly', the next unread
268 newsgroup will be selected without any confirmation, and if it is
269 `almost-quietly', the next group will be selected without any
270 confirmation if you are located on the last article in the group.
271 Finally, if this variable is `slightly-quietly', the `Z n' command
272 will go to the next group without confirmation."
273 :group 'gnus-summary-maneuvering
274 :type '(choice (const :tag "off" nil)
276 (const almost-quietly)
277 (const slightly-quietly)
278 (sexp :menu-tag "on" t)))
280 (defcustom gnus-auto-select-same nil
281 "*If non-nil, select the next article with the same subject."
282 :group 'gnus-summary-maneuvering
285 (defcustom gnus-summary-check-current nil
286 "*If non-nil, consider the current article when moving.
287 The \"unread\" movement commands will stay on the same line if the
288 current article is unread."
289 :group 'gnus-summary-maneuvering
292 (defcustom gnus-auto-center-summary t
293 "*If non-nil, always center the current summary buffer.
294 In particular, if `vertical' do only vertical recentering. If non-nil
295 and non-`vertical', do both horizontal and vertical recentering."
296 :group 'gnus-summary-maneuvering
297 :type '(choice (const :tag "none" nil)
299 (sexp :menu-tag "both" t)))
301 (defcustom gnus-show-all-headers nil
302 "*If non-nil, don't hide any headers."
303 :group 'gnus-article-hiding
304 :group 'gnus-article-headers
307 (defcustom gnus-summary-ignore-duplicates nil
308 "*If non-nil, ignore articles with identical Message-ID headers."
312 (defcustom gnus-single-article-buffer t
313 "*If non-nil, display all articles in the same buffer.
314 If nil, each group will get its own article buffer."
315 :group 'gnus-article-various
318 (defcustom gnus-break-pages t
319 "*If non-nil, do page breaking on articles.
320 The page delimiter is specified by the `gnus-page-delimiter'
322 :group 'gnus-article-various
325 (defcustom gnus-show-mime nil
326 "*If non-nil, do mime processing of articles.
327 The articles will simply be fed to the function given by
328 `gnus-show-mime-method'."
329 :group 'gnus-article-mime
332 (defcustom gnus-move-split-methods nil
333 "*Variable used to suggest where articles are to be moved to.
334 It uses the same syntax as the `gnus-split-methods' variable."
335 :group 'gnus-summary-mail
336 :type '(repeat (choice (list function)
337 (cons regexp (repeat string))
340 (defcustom gnus-unread-mark ?
341 "*Mark used for unread articles."
342 :group 'gnus-summary-marks
345 (defcustom gnus-ticked-mark ?!
346 "*Mark used for ticked articles."
347 :group 'gnus-summary-marks
350 (defcustom gnus-dormant-mark ??
351 "*Mark used for dormant articles."
352 :group 'gnus-summary-marks
355 (defcustom gnus-del-mark ?r
356 "*Mark used for del'd articles."
357 :group 'gnus-summary-marks
360 (defcustom gnus-read-mark ?R
361 "*Mark used for read articles."
362 :group 'gnus-summary-marks
365 (defcustom gnus-expirable-mark ?E
366 "*Mark used for expirable articles."
367 :group 'gnus-summary-marks
370 (defcustom gnus-killed-mark ?K
371 "*Mark used for killed articles."
372 :group 'gnus-summary-marks
375 (defcustom gnus-souped-mark ?F
376 "*Mark used for killed articles."
377 :group 'gnus-summary-marks
380 (defcustom gnus-kill-file-mark ?X
381 "*Mark used for articles killed by kill files."
382 :group 'gnus-summary-marks
385 (defcustom gnus-low-score-mark ?Y
386 "*Mark used for articles with a low score."
387 :group 'gnus-summary-marks
390 (defcustom gnus-catchup-mark ?C
391 "*Mark used for articles that are caught up."
392 :group 'gnus-summary-marks
395 (defcustom gnus-replied-mark ?A
396 "*Mark used for articles that have been replied to."
397 :group 'gnus-summary-marks
400 (defcustom gnus-cached-mark ?*
401 "*Mark used for articles that are in the cache."
402 :group 'gnus-summary-marks
405 (defcustom gnus-saved-mark ?S
406 "*Mark used for articles that have been saved to."
407 :group 'gnus-summary-marks
410 (defcustom gnus-ancient-mark ?O
411 "*Mark used for ancient articles."
412 :group 'gnus-summary-marks
415 (defcustom gnus-sparse-mark ?Q
416 "*Mark used for sparsely reffed articles."
417 :group 'gnus-summary-marks
420 (defcustom gnus-canceled-mark ?G
421 "*Mark used for canceled articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-duplicate-mark ?M
426 "*Mark used for duplicate articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-undownloaded-mark ?@
431 "*Mark used for articles that weren't downloaded."
432 :group 'gnus-summary-marks
435 (defcustom gnus-downloadable-mark ?%
436 "*Mark used for articles that are to be downloaded."
437 :group 'gnus-summary-marks
440 (defcustom gnus-unsendable-mark ?=
441 "*Mark used for articles that won't be sent."
442 :group 'gnus-summary-marks
445 (defcustom gnus-score-over-mark ?+
446 "*Score mark used for articles with high scores."
447 :group 'gnus-summary-marks
450 (defcustom gnus-score-below-mark ?-
451 "*Score mark used for articles with low scores."
452 :group 'gnus-summary-marks
455 (defcustom gnus-empty-thread-mark ?
456 "*There is no thread under the article."
457 :group 'gnus-summary-marks
460 (defcustom gnus-not-empty-thread-mark ?=
461 "*There is a thread under the article."
462 :group 'gnus-summary-marks
465 (defcustom gnus-view-pseudo-asynchronously nil
466 "*If non-nil, Gnus will view pseudo-articles asynchronously."
467 :group 'gnus-extract-view
470 (defcustom gnus-view-pseudos nil
471 "*If `automatic', pseudo-articles will be viewed automatically.
472 If `not-confirm', pseudos will be viewed automatically, and the user
473 will not be asked to confirm the command."
474 :group 'gnus-extract-view
475 :type '(choice (const :tag "off" nil)
477 (const not-confirm)))
479 (defcustom gnus-view-pseudos-separately t
480 "*If non-nil, one pseudo-article will be created for each file to be viewed.
481 If nil, all files that use the same viewing command will be given as a
482 list of parameters to that command."
483 :group 'gnus-extract-view
486 (defcustom gnus-insert-pseudo-articles t
487 "*If non-nil, insert pseudo-articles when decoding articles."
488 :group 'gnus-extract-view
491 (defcustom gnus-summary-dummy-line-format
493 "*The format specification for the dummy roots in the summary buffer.
494 It works along the same lines as a normal formatting string,
495 with some simple extensions.
498 :group 'gnus-threading
501 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
502 "*The format specification for the summary mode line.
503 It works along the same lines as a normal formatting string,
504 with some simple extensions:
507 %p Unprefixed group name
508 %A Current article number
510 %U Number of unread articles in the group
511 %e Number of unselected articles in the group
512 %Z A string with unread/unselected article counts
513 %g Shortish group name
514 %S Subject of the current article
516 %s Current score file name
517 %d Number of dormant articles
518 %r Number of articles that have been marked as read in this session
519 %E Number of articles expunged by the score files"
520 :group 'gnus-summary-format
523 (defcustom gnus-summary-mark-below 0
524 "*Mark all articles with a score below this variable as read.
525 This variable is local to each summary buffer and usually set by the
527 :group 'gnus-score-default
530 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
531 "*List of functions used for sorting articles in the summary buffer.
532 This variable is only used when not using a threaded display."
533 :group 'gnus-summary-sort
534 :type '(repeat (choice (function-item gnus-article-sort-by-number)
535 (function-item gnus-article-sort-by-author)
536 (function-item gnus-article-sort-by-subject)
537 (function-item gnus-article-sort-by-date)
538 (function-item gnus-article-sort-by-score)
539 (function :tag "other"))))
541 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
542 "*List of functions used for sorting threads in the summary buffer.
543 By default, threads are sorted by article number.
545 Each function takes two threads and return non-nil if the first thread
546 should be sorted before the other. If you use more than one function,
547 the primary sort function should be the last. You should probably
548 always include `gnus-thread-sort-by-number' in the list of sorting
549 functions -- preferably first.
551 Ready-made functions include `gnus-thread-sort-by-number',
552 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
553 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
554 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
555 :group 'gnus-summary-sort
556 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
557 (function-item gnus-thread-sort-by-author)
558 (function-item gnus-thread-sort-by-subject)
559 (function-item gnus-thread-sort-by-date)
560 (function-item gnus-thread-sort-by-score)
561 (function-item gnus-thread-sort-by-total-score)
562 (function :tag "other"))))
564 (defcustom gnus-thread-score-function '+
565 "*Function used for calculating the total score of a thread.
567 The function is called with the scores of the article and each
568 subthread and should then return the score of the thread.
570 Some functions you can use are `+', `max', or `min'."
571 :group 'gnus-summary-sort
574 (defcustom gnus-summary-expunge-below nil
575 "All articles that have a score less than this variable will be expunged."
576 :group 'gnus-score-default
577 :type '(choice (const :tag "off" nil)
580 (defcustom gnus-thread-expunge-below nil
581 "All threads that have a total score less than this variable will be expunged.
582 See `gnus-thread-score-function' for en explanation of what a
583 \"thread score\" is."
584 :group 'gnus-treading
585 :group 'gnus-score-default
586 :type '(choice (const :tag "off" nil)
589 (defcustom gnus-summary-mode-hook nil
590 "*A hook for Gnus summary mode.
591 This hook is run before any variables are set in the summary buffer."
592 :group 'gnus-summary-various
595 (defcustom gnus-summary-menu-hook nil
596 "*Hook run after the creation of the summary mode menu."
597 :group 'gnus-summary-visual
600 (defcustom gnus-summary-exit-hook nil
601 "*A hook called on exit from the summary buffer.
602 It will be called with point in the group buffer."
603 :group 'gnus-summary-exit
606 (defcustom gnus-summary-prepare-hook nil
607 "*A hook called after the summary buffer has been generated.
608 If you want to modify the summary buffer, you can use this hook."
609 :group 'gnus-summary-various
612 (defcustom gnus-summary-generate-hook nil
613 "*A hook run just before generating the summary buffer.
614 This hook is commonly used to customize threading variables and the
616 :group 'gnus-summary-various
619 (defcustom gnus-select-group-hook nil
620 "*A hook called when a newsgroup is selected.
622 If you'd like to simplify subjects like the
623 `gnus-summary-next-same-subject' command does, you can use the
626 (setq gnus-select-group-hook
629 (mapcar (lambda (header)
630 (mail-header-set-subject
632 (gnus-simplify-subject
633 (mail-header-subject header) 're-only)))
634 gnus-newsgroup-headers))))"
635 :group 'gnus-group-select
638 (defcustom gnus-select-article-hook nil
639 "*A hook called when an article is selected."
640 :group 'gnus-summary-choose
643 (defcustom gnus-visual-mark-article-hook
644 (list 'gnus-highlight-selected-summary)
645 "*Hook run after selecting an article in the summary buffer.
646 It is meant to be used for highlighting the article in some way. It
647 is not run if `gnus-visual' is nil."
648 :group 'gnus-summary-visual
651 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
652 (defcustom gnus-structured-field-decoder 'identity
653 "Function to decode non-ASCII characters in structured field for summary."
657 (defcustom gnus-unstructured-field-decoder 'identity
658 "Function to decode non-ASCII characters in unstructured field for summary."
662 (defcustom gnus-parse-headers-hook
663 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522)
664 "*A hook called before parsing the headers."
668 (defcustom gnus-exit-group-hook nil
669 "*A hook called when exiting (not quitting) summary mode."
673 (defcustom gnus-summary-update-hook
674 (list 'gnus-summary-highlight-line)
675 "*A hook called when a summary line is changed.
676 The hook will not be called if `gnus-visual' is nil.
678 The default function `gnus-summary-highlight-line' will
679 highlight the line according to the `gnus-summary-highlight'
681 :group 'gnus-summary-visual
684 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
685 "*A hook called when an article is selected for the first time.
686 The hook is intended to mark an article as read (or unread)
687 automatically when it is selected."
688 :group 'gnus-summary-choose
691 (defcustom gnus-group-no-more-groups-hook nil
692 "*A hook run when returning to group mode having no more (unread) groups."
693 :group 'gnus-group-select
696 (defcustom gnus-ps-print-hook nil
697 "*A hook run before ps-printing something from Gnus."
701 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
702 "Face used for highlighting the current article in the summary buffer."
703 :group 'gnus-summary-visual
706 (defcustom gnus-summary-highlight
707 '(((= mark gnus-canceled-mark)
708 . gnus-summary-cancelled-face)
709 ((and (> score default)
710 (or (= mark gnus-dormant-mark)
711 (= mark gnus-ticked-mark)))
712 . gnus-summary-high-ticked-face)
713 ((and (< score default)
714 (or (= mark gnus-dormant-mark)
715 (= mark gnus-ticked-mark)))
716 . gnus-summary-low-ticked-face)
717 ((or (= mark gnus-dormant-mark)
718 (= mark gnus-ticked-mark))
719 . gnus-summary-normal-ticked-face)
720 ((and (> score default) (= mark gnus-ancient-mark))
721 . gnus-summary-high-ancient-face)
722 ((and (< score default) (= mark gnus-ancient-mark))
723 . gnus-summary-low-ancient-face)
724 ((= mark gnus-ancient-mark)
725 . gnus-summary-normal-ancient-face)
726 ((and (> score default) (= mark gnus-unread-mark))
727 . gnus-summary-high-unread-face)
728 ((and (< score default) (= mark gnus-unread-mark))
729 . gnus-summary-low-unread-face)
730 ((and (= mark gnus-unread-mark))
731 . gnus-summary-normal-unread-face)
733 . gnus-summary-high-read-face)
735 . gnus-summary-low-read-face)
737 . gnus-summary-normal-read-face))
738 "Controls the highlighting of summary buffer lines.
740 A list of (FORM . FACE) pairs. When deciding how a a particular
741 summary line should be displayed, each form is evaluated. The content
742 of the face field after the first true form is used. You can change
743 how those summary lines are displayed, by editing the face field.
745 You can use the following variables in the FORM field.
747 score: The articles score
748 default: The default article score.
749 below: The score below which articles are automatically marked as read.
750 mark: The articles mark."
751 :group 'gnus-summary-visual
752 :type '(repeat (cons (sexp :tag "Form" nil)
755 (defcustom gnus-alter-header-function nil
756 "Function called to allow alteration of article header structures.
757 The function is called with one parameter, the article header vector,
758 which it may alter in any way.")
760 ;;; Internal variables
762 (defvar gnus-scores-exclude-files nil)
763 (defvar gnus-page-broken nil)
765 (defvar gnus-original-article nil)
766 (defvar gnus-article-internal-prepare-hook nil)
767 (defvar gnus-newsgroup-process-stack nil)
769 (defvar gnus-thread-indent-array nil)
770 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
772 ;; Avoid highlighting in kill files.
773 (defvar gnus-summary-inhibit-highlight nil)
774 (defvar gnus-newsgroup-selected-overlay nil)
775 (defvar gnus-inhibit-limiting nil)
776 (defvar gnus-newsgroup-adaptive-score-file nil)
777 (defvar gnus-current-score-file nil)
778 (defvar gnus-current-move-group nil)
779 (defvar gnus-current-copy-group nil)
780 (defvar gnus-current-crosspost-group nil)
782 (defvar gnus-newsgroup-dependencies nil)
783 (defvar gnus-newsgroup-adaptive nil)
784 (defvar gnus-summary-display-article-function nil)
785 (defvar gnus-summary-highlight-line-function nil
786 "Function called after highlighting a summary line.")
788 (defvar gnus-summary-line-format-alist
789 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
790 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
791 (?s gnus-tmp-subject-or-nil ?s)
792 (?n gnus-tmp-name ?s)
793 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
795 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
797 (?F gnus-tmp-from ?s)
798 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
799 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
800 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
801 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
802 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
803 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
804 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
805 (?L gnus-tmp-lines ?d)
806 (?I gnus-tmp-indentation ?s)
807 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
808 (?R gnus-tmp-replied ?c)
809 (?\[ gnus-tmp-opening-bracket ?c)
810 (?\] gnus-tmp-closing-bracket ?c)
811 (?\> (make-string gnus-tmp-level ? ) ?s)
812 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
813 (?i gnus-tmp-score ?d)
814 (?z gnus-tmp-score-char ?c)
815 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
816 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
817 (?U gnus-tmp-unread ?c)
818 (?t (gnus-summary-number-of-articles-in-thread
819 (and (boundp 'thread) (car thread)) gnus-tmp-level)
821 (?e (gnus-summary-number-of-articles-in-thread
822 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
824 (?u gnus-tmp-user-defined ?s)
825 (?P (gnus-pick-line-number) ?d))
826 "An alist of format specifications that can appear in summary lines,
827 and what variables they correspond with, along with the type of the
828 variable (string, integer, character, etc).")
830 (defvar gnus-summary-dummy-line-format-alist
831 `((?S gnus-tmp-subject ?s)
832 (?N gnus-tmp-number ?d)
833 (?u gnus-tmp-user-defined ?s)))
835 (defvar gnus-summary-mode-line-format-alist
836 `((?G gnus-tmp-group-name ?s)
837 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
838 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
839 (?A gnus-tmp-article-number ?d)
840 (?Z gnus-tmp-unread-and-unselected ?s)
842 (?U gnus-tmp-unread-and-unticked ?d)
843 (?S gnus-tmp-subject ?s)
844 (?e gnus-tmp-unselected ?d)
845 (?u gnus-tmp-user-defined ?s)
846 (?d (length gnus-newsgroup-dormant) ?d)
847 (?t (length gnus-newsgroup-marked) ?d)
848 (?r (length gnus-newsgroup-reads) ?d)
849 (?E gnus-newsgroup-expunged-tally ?d)
850 (?s (gnus-current-score-file-nondirectory) ?s)))
852 (defvar gnus-last-search-regexp nil
853 "Default regexp for article search command.")
855 (defvar gnus-last-shell-command nil
856 "Default shell command on article.")
858 (defvar gnus-newsgroup-begin nil)
859 (defvar gnus-newsgroup-end nil)
860 (defvar gnus-newsgroup-last-rmail nil)
861 (defvar gnus-newsgroup-last-mail nil)
862 (defvar gnus-newsgroup-last-folder nil)
863 (defvar gnus-newsgroup-last-file nil)
864 (defvar gnus-newsgroup-auto-expire nil)
865 (defvar gnus-newsgroup-active nil)
867 (defvar gnus-newsgroup-data nil)
868 (defvar gnus-newsgroup-data-reverse nil)
869 (defvar gnus-newsgroup-limit nil)
870 (defvar gnus-newsgroup-limits nil)
872 (defvar gnus-newsgroup-unreads nil
873 "List of unread articles in the current newsgroup.")
875 (defvar gnus-newsgroup-unselected nil
876 "List of unselected unread articles in the current newsgroup.")
878 (defvar gnus-newsgroup-reads nil
879 "Alist of read articles and article marks in the current newsgroup.")
881 (defvar gnus-newsgroup-expunged-tally nil)
883 (defvar gnus-newsgroup-marked nil
884 "List of ticked articles in the current newsgroup (a subset of unread art).")
886 (defvar gnus-newsgroup-killed nil
887 "List of ranges of articles that have been through the scoring process.")
889 (defvar gnus-newsgroup-cached nil
890 "List of articles that come from the article cache.")
892 (defvar gnus-newsgroup-saved nil
893 "List of articles that have been saved.")
895 (defvar gnus-newsgroup-kill-headers nil)
897 (defvar gnus-newsgroup-replied nil
898 "List of articles that have been replied to in the current newsgroup.")
900 (defvar gnus-newsgroup-expirable nil
901 "List of articles in the current newsgroup that can be expired.")
903 (defvar gnus-newsgroup-processable nil
904 "List of articles in the current newsgroup that can be processed.")
906 (defvar gnus-newsgroup-downloadable nil
907 "List of articles in the current newsgroup that can be processed.")
909 (defvar gnus-newsgroup-undownloaded nil
910 "List of articles in the current newsgroup that haven't been downloaded..")
912 (defvar gnus-newsgroup-unsendable nil
913 "List of articles in the current newsgroup that won't be sent.")
915 (defvar gnus-newsgroup-bookmarks nil
916 "List of articles in the current newsgroup that have bookmarks.")
918 (defvar gnus-newsgroup-dormant nil
919 "List of dormant articles in the current newsgroup.")
921 (defvar gnus-newsgroup-scored nil
922 "List of scored articles in the current newsgroup.")
924 (defvar gnus-newsgroup-headers nil
925 "List of article headers in the current newsgroup.")
927 (defvar gnus-newsgroup-threads nil)
929 (defvar gnus-newsgroup-prepared nil
930 "Whether the current group has been prepared properly.")
932 (defvar gnus-newsgroup-ancient nil
933 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
935 (defvar gnus-newsgroup-sparse nil)
937 (defvar gnus-current-article nil)
938 (defvar gnus-article-current nil)
939 (defvar gnus-current-headers nil)
940 (defvar gnus-have-all-headers nil)
941 (defvar gnus-last-article nil)
942 (defvar gnus-newsgroup-history nil)
944 (defconst gnus-summary-local-variables
945 '(gnus-newsgroup-name
946 gnus-newsgroup-begin gnus-newsgroup-end
947 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
948 gnus-newsgroup-last-folder gnus-newsgroup-last-file
949 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
950 gnus-newsgroup-unselected gnus-newsgroup-marked
951 gnus-newsgroup-reads gnus-newsgroup-saved
952 gnus-newsgroup-replied gnus-newsgroup-expirable
953 gnus-newsgroup-processable gnus-newsgroup-killed
954 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
955 gnus-newsgroup-unsendable
956 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
957 gnus-newsgroup-headers gnus-newsgroup-threads
958 gnus-newsgroup-prepared gnus-summary-highlight-line-function
959 gnus-current-article gnus-current-headers gnus-have-all-headers
960 gnus-last-article gnus-article-internal-prepare-hook
961 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
962 gnus-newsgroup-scored gnus-newsgroup-kill-headers
963 gnus-thread-expunge-below
964 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
965 (gnus-summary-mark-below . global)
966 gnus-newsgroup-active gnus-scores-exclude-files
967 gnus-newsgroup-history gnus-newsgroup-ancient
968 gnus-newsgroup-sparse gnus-newsgroup-process-stack
969 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
970 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
971 (gnus-newsgroup-expunged-tally . 0)
972 gnus-cache-removable-articles gnus-newsgroup-cached
973 gnus-newsgroup-data gnus-newsgroup-data-reverse
974 gnus-newsgroup-limit gnus-newsgroup-limits)
975 "Variables that are buffer-local to the summary buffers.")
977 ;; Byte-compiler warning.
978 (defvar gnus-article-mode-map)
980 ;; Subject simplification.
982 (defun gnus-simplify-whitespace (str)
983 "Remove excessive whitespace."
986 (while (string-match "[ \t][ \t]+" mystr)
987 (setq mystr (concat (substring mystr 0 (match-beginning 0))
989 (substring mystr (match-end 0)))))
991 (when (string-match "^[ \t]+" mystr)
992 (setq mystr (substring mystr (match-end 0))))
994 (when (string-match "[ \t]+$" mystr)
995 (setq mystr (substring mystr 0 (match-beginning 0))))
998 (defsubst gnus-simplify-subject-re (subject)
999 "Remove \"Re:\" from subject lines."
1000 (if (string-match "^[Rr][Ee]: *" subject)
1001 (substring subject (match-end 0))
1004 (defun gnus-simplify-subject (subject &optional re-only)
1005 "Remove `Re:' and words in parentheses.
1006 If RE-ONLY is non-nil, strip leading `Re:'s only."
1007 (let ((case-fold-search t)) ;Ignore case.
1008 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1009 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1010 (setq subject (substring subject (match-end 0))))
1011 ;; Remove uninteresting prefixes.
1012 (when (and (not re-only)
1013 gnus-simplify-ignored-prefixes
1014 (string-match gnus-simplify-ignored-prefixes subject))
1015 (setq subject (substring subject (match-end 0))))
1016 ;; Remove words in parentheses from end.
1018 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1019 (setq subject (substring subject 0 (match-beginning 0)))))
1020 ;; Return subject string.
1023 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1025 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1026 (goto-char (point-min))
1027 (while (re-search-forward regexp nil t)
1028 (replace-match (or newtext ""))))
1030 (defun gnus-simplify-buffer-fuzzy ()
1031 "Simplify string in the buffer fuzzily.
1032 The string in the accessible portion of the current buffer is simplified.
1033 It is assumed to be a single-line subject.
1034 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1035 matter is removed. Additional things can be deleted by setting
1036 gnus-simplify-subject-fuzzy-regexp."
1037 (let ((case-fold-search t)
1039 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1041 (while (not (eq modified-tick (buffer-modified-tick)))
1042 (setq modified-tick (buffer-modified-tick))
1044 ((listp gnus-simplify-subject-fuzzy-regexp)
1045 (mapcar 'gnus-simplify-buffer-fuzzy-step
1046 gnus-simplify-subject-fuzzy-regexp))
1047 (gnus-simplify-subject-fuzzy-regexp
1048 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1049 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1050 (gnus-simplify-buffer-fuzzy-step
1051 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1052 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1054 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1055 (gnus-simplify-buffer-fuzzy-step " +" " ")
1056 (gnus-simplify-buffer-fuzzy-step " $")
1057 (gnus-simplify-buffer-fuzzy-step "^ +")))
1059 (defun gnus-simplify-subject-fuzzy (subject)
1060 "Simplify a subject string fuzzily.
1061 See `gnus-simplify-buffer-fuzzy' for details."
1063 (gnus-set-work-buffer)
1064 (let ((case-fold-search t))
1066 (inline (gnus-simplify-buffer-fuzzy))
1069 (defsubst gnus-simplify-subject-fully (subject)
1070 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1072 (gnus-simplify-subject-functions
1073 (gnus-map-function gnus-simplify-subject-functions subject))
1074 ((null gnus-summary-gather-subject-limit)
1075 (gnus-simplify-subject-re subject))
1076 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1077 (gnus-simplify-subject-fuzzy subject))
1078 ((numberp gnus-summary-gather-subject-limit)
1079 (gnus-limit-string (gnus-simplify-subject-re subject)
1080 gnus-summary-gather-subject-limit))
1084 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1085 "Check whether two subjects are equal.
1086 If optional argument simple-first is t, first argument is already
1089 ((null simple-first)
1090 (equal (gnus-simplify-subject-fully s1)
1091 (gnus-simplify-subject-fully s2)))
1094 (gnus-simplify-subject-fully s2)))))
1096 (defun gnus-summary-bubble-group ()
1097 "Increase the score of the current group.
1098 This is a handy function to add to `gnus-summary-exit-hook' to
1099 increase the score of each group you read."
1100 (gnus-group-add-score gnus-newsgroup-name))
1104 ;;; Gnus summary mode
1107 (put 'gnus-summary-mode 'mode-class 'special)
1110 ;; Non-orthogonal keys
1112 (gnus-define-keys gnus-summary-mode-map
1113 " " gnus-summary-next-page
1114 "\177" gnus-summary-prev-page
1115 [delete] gnus-summary-prev-page
1116 "\r" gnus-summary-scroll-up
1117 "n" gnus-summary-next-unread-article
1118 "p" gnus-summary-prev-unread-article
1119 "N" gnus-summary-next-article
1120 "P" gnus-summary-prev-article
1121 "\M-\C-n" gnus-summary-next-same-subject
1122 "\M-\C-p" gnus-summary-prev-same-subject
1123 "\M-n" gnus-summary-next-unread-subject
1124 "\M-p" gnus-summary-prev-unread-subject
1125 "." gnus-summary-first-unread-article
1126 "," gnus-summary-best-unread-article
1127 "\M-s" gnus-summary-search-article-forward
1128 "\M-r" gnus-summary-search-article-backward
1129 "<" gnus-summary-beginning-of-article
1130 ">" gnus-summary-end-of-article
1131 "j" gnus-summary-goto-article
1132 "^" gnus-summary-refer-parent-article
1133 "\M-^" gnus-summary-refer-article
1134 "u" gnus-summary-tick-article-forward
1135 "!" gnus-summary-tick-article-forward
1136 "U" gnus-summary-tick-article-backward
1137 "d" gnus-summary-mark-as-read-forward
1138 "D" gnus-summary-mark-as-read-backward
1139 "E" gnus-summary-mark-as-expirable
1140 "\M-u" gnus-summary-clear-mark-forward
1141 "\M-U" gnus-summary-clear-mark-backward
1142 "k" gnus-summary-kill-same-subject-and-select
1143 "\C-k" gnus-summary-kill-same-subject
1144 "\M-\C-k" gnus-summary-kill-thread
1145 "\M-\C-l" gnus-summary-lower-thread
1146 "e" gnus-summary-edit-article
1147 "#" gnus-summary-mark-as-processable
1148 "\M-#" gnus-summary-unmark-as-processable
1149 "\M-\C-t" gnus-summary-toggle-threads
1150 "\M-\C-s" gnus-summary-show-thread
1151 "\M-\C-h" gnus-summary-hide-thread
1152 "\M-\C-f" gnus-summary-next-thread
1153 "\M-\C-b" gnus-summary-prev-thread
1154 "\M-\C-u" gnus-summary-up-thread
1155 "\M-\C-d" gnus-summary-down-thread
1156 "&" gnus-summary-execute-command
1157 "c" gnus-summary-catchup-and-exit
1158 "\C-w" gnus-summary-mark-region-as-read
1159 "\C-t" gnus-summary-toggle-truncation
1160 "?" gnus-summary-mark-as-dormant
1161 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1162 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1163 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1164 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1165 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1166 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1167 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1168 "=" gnus-summary-expand-window
1169 "\C-x\C-s" gnus-summary-reselect-current-group
1170 "\M-g" gnus-summary-rescan-group
1171 "w" gnus-summary-stop-page-breaking
1172 "\C-c\C-r" gnus-summary-caesar-message
1173 "\M-t" gnus-summary-toggle-mime
1174 "f" gnus-summary-followup
1175 "F" gnus-summary-followup-with-original
1176 "C" gnus-summary-cancel-article
1177 "r" gnus-summary-reply
1178 "R" gnus-summary-reply-with-original
1179 "\C-c\C-f" gnus-summary-mail-forward
1180 "o" gnus-summary-save-article
1181 "\C-o" gnus-summary-save-article-mail
1182 "|" gnus-summary-pipe-output
1183 "\M-k" gnus-summary-edit-local-kill
1184 "\M-K" gnus-summary-edit-global-kill
1186 "\C-c\C-d" gnus-summary-describe-group
1187 "q" gnus-summary-exit
1188 "Q" gnus-summary-exit-no-update
1189 "\C-c\C-i" gnus-info-find-node
1190 gnus-mouse-2 gnus-mouse-pick-article
1191 "m" gnus-summary-mail-other-window
1192 "a" gnus-summary-post-news
1193 "x" gnus-summary-limit-to-unread
1194 "s" gnus-summary-isearch-article
1195 "t" gnus-article-hide-headers
1196 "g" gnus-summary-show-article
1197 "l" gnus-summary-goto-last-article
1198 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1199 "\C-d" gnus-summary-enter-digest-group
1200 "\M-\C-d" gnus-summary-read-document
1202 "*" gnus-cache-enter-article
1203 "\M-*" gnus-cache-remove-article
1204 "\M-&" gnus-summary-universal-argument
1205 "\C-l" gnus-recenter
1206 "I" gnus-summary-increase-score
1207 "L" gnus-summary-lower-score
1208 "\M-i" gnus-symbolic-argument
1210 "V" gnus-summary-score-map
1211 "X" gnus-uu-extract-map
1212 "S" gnus-summary-send-map)
1214 ;; Sort of orthogonal keymap
1215 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1216 "t" gnus-summary-tick-article-forward
1217 "!" gnus-summary-tick-article-forward
1218 "d" gnus-summary-mark-as-read-forward
1219 "r" gnus-summary-mark-as-read-forward
1220 "c" gnus-summary-clear-mark-forward
1221 " " gnus-summary-clear-mark-forward
1222 "e" gnus-summary-mark-as-expirable
1223 "x" gnus-summary-mark-as-expirable
1224 "?" gnus-summary-mark-as-dormant
1225 "b" gnus-summary-set-bookmark
1226 "B" gnus-summary-remove-bookmark
1227 "#" gnus-summary-mark-as-processable
1228 "\M-#" gnus-summary-unmark-as-processable
1229 "S" gnus-summary-limit-include-expunged
1230 "C" gnus-summary-catchup
1231 "H" gnus-summary-catchup-to-here
1232 "\C-c" gnus-summary-catchup-all
1233 "k" gnus-summary-kill-same-subject-and-select
1234 "K" gnus-summary-kill-same-subject
1235 "P" gnus-uu-mark-map)
1237 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1238 "c" gnus-summary-clear-above
1239 "u" gnus-summary-tick-above
1240 "m" gnus-summary-mark-above
1241 "k" gnus-summary-kill-below)
1243 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1244 "/" gnus-summary-limit-to-subject
1245 "n" gnus-summary-limit-to-articles
1246 "w" gnus-summary-pop-limit
1247 "s" gnus-summary-limit-to-subject
1248 "a" gnus-summary-limit-to-author
1249 "u" gnus-summary-limit-to-unread
1250 "m" gnus-summary-limit-to-marks
1251 "v" gnus-summary-limit-to-score
1252 "*" gnus-summary-limit-include-cached
1253 "D" gnus-summary-limit-include-dormant
1254 "T" gnus-summary-limit-include-thread
1255 "d" gnus-summary-limit-exclude-dormant
1256 "t" gnus-summary-limit-to-age
1257 "E" gnus-summary-limit-include-expunged
1258 "c" gnus-summary-limit-exclude-childless-dormant
1259 "C" gnus-summary-limit-mark-excluded-as-read)
1261 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1262 "n" gnus-summary-next-unread-article
1263 "p" gnus-summary-prev-unread-article
1264 "N" gnus-summary-next-article
1265 "P" gnus-summary-prev-article
1266 "\C-n" gnus-summary-next-same-subject
1267 "\C-p" gnus-summary-prev-same-subject
1268 "\M-n" gnus-summary-next-unread-subject
1269 "\M-p" gnus-summary-prev-unread-subject
1270 "f" gnus-summary-first-unread-article
1271 "b" gnus-summary-best-unread-article
1272 "j" gnus-summary-goto-article
1273 "g" gnus-summary-goto-subject
1274 "l" gnus-summary-goto-last-article
1275 "o" gnus-summary-pop-article)
1277 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1278 "k" gnus-summary-kill-thread
1279 "l" gnus-summary-lower-thread
1280 "i" gnus-summary-raise-thread
1281 "T" gnus-summary-toggle-threads
1282 "t" gnus-summary-rethread-current
1283 "^" gnus-summary-reparent-thread
1284 "s" gnus-summary-show-thread
1285 "S" gnus-summary-show-all-threads
1286 "h" gnus-summary-hide-thread
1287 "H" gnus-summary-hide-all-threads
1288 "n" gnus-summary-next-thread
1289 "p" gnus-summary-prev-thread
1290 "u" gnus-summary-up-thread
1291 "o" gnus-summary-top-thread
1292 "d" gnus-summary-down-thread
1293 "#" gnus-uu-mark-thread
1294 "\M-#" gnus-uu-unmark-thread)
1296 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1297 "g" gnus-summary-prepare
1298 "c" gnus-summary-insert-cached-articles)
1300 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1301 "c" gnus-summary-catchup-and-exit
1302 "C" gnus-summary-catchup-all-and-exit
1303 "E" gnus-summary-exit-no-update
1304 "Q" gnus-summary-exit
1305 "Z" gnus-summary-exit
1306 "n" gnus-summary-catchup-and-goto-next-group
1307 "R" gnus-summary-reselect-current-group
1308 "G" gnus-summary-rescan-group
1309 "N" gnus-summary-next-group
1310 "s" gnus-summary-save-newsrc
1311 "P" gnus-summary-prev-group)
1313 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1314 " " gnus-summary-next-page
1315 "n" gnus-summary-next-page
1316 "\177" gnus-summary-prev-page
1317 [delete] gnus-summary-prev-page
1318 "p" gnus-summary-prev-page
1319 "\r" gnus-summary-scroll-up
1320 "<" gnus-summary-beginning-of-article
1321 ">" gnus-summary-end-of-article
1322 "b" gnus-summary-beginning-of-article
1323 "e" gnus-summary-end-of-article
1324 "^" gnus-summary-refer-parent-article
1325 "r" gnus-summary-refer-parent-article
1326 "R" gnus-summary-refer-references
1327 "T" gnus-summary-refer-thread
1328 "g" gnus-summary-show-article
1329 "s" gnus-summary-isearch-article
1330 "P" gnus-summary-print-article)
1332 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1333 "b" gnus-article-add-buttons
1334 "B" gnus-article-add-buttons-to-head
1335 "o" gnus-article-treat-overstrike
1336 "e" gnus-article-emphasize
1337 "w" gnus-article-fill-cited-article
1338 "c" gnus-article-remove-cr
1339 "q" gnus-article-de-quoted-unreadable
1340 "f" gnus-article-display-x-face
1341 "l" gnus-summary-stop-page-breaking
1342 "r" gnus-summary-caesar-message
1343 "t" gnus-article-hide-headers
1344 "v" gnus-summary-verbose-headers
1345 "m" gnus-summary-toggle-mime
1346 "h" gnus-article-treat-html)
1348 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1349 "a" gnus-article-hide
1350 "h" gnus-article-hide-headers
1351 "b" gnus-article-hide-boring-headers
1352 "s" gnus-article-hide-signature
1353 "c" gnus-article-hide-citation
1354 "p" gnus-article-hide-pgp
1355 "P" gnus-article-hide-pem
1356 "\C-c" gnus-article-hide-citation-maybe)
1358 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1359 "a" gnus-article-highlight
1360 "h" gnus-article-highlight-headers
1361 "c" gnus-article-highlight-citation
1362 "s" gnus-article-highlight-signature)
1364 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1365 "z" gnus-article-date-ut
1366 "u" gnus-article-date-ut
1367 "l" gnus-article-date-local
1368 "e" gnus-article-date-lapsed
1369 "o" gnus-article-date-original
1370 "s" gnus-article-date-user)
1372 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1373 "t" gnus-article-remove-trailing-blank-lines
1374 "l" gnus-article-strip-leading-blank-lines
1375 "m" gnus-article-strip-multiple-blank-lines
1376 "a" gnus-article-strip-blank-lines
1377 "s" gnus-article-strip-leading-space)
1379 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1381 "f" gnus-summary-fetch-faq
1382 "d" gnus-summary-describe-group
1383 "h" gnus-summary-describe-briefly
1384 "i" gnus-info-find-node)
1386 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1387 "e" gnus-summary-expire-articles
1388 "\M-\C-e" gnus-summary-expire-articles-now
1389 "\177" gnus-summary-delete-article
1390 [delete] gnus-summary-delete-article
1391 "m" gnus-summary-move-article
1392 "r" gnus-summary-respool-article
1393 "w" gnus-summary-edit-article
1394 "c" gnus-summary-copy-article
1395 "B" gnus-summary-crosspost-article
1396 "q" gnus-summary-respool-query
1397 "i" gnus-summary-import-article
1398 "p" gnus-summary-article-posted-p)
1400 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1401 "o" gnus-summary-save-article
1402 "m" gnus-summary-save-article-mail
1403 "F" gnus-summary-write-article-file
1404 "r" gnus-summary-save-article-rmail
1405 "f" gnus-summary-save-article-file
1406 "b" gnus-summary-save-article-body-file
1407 "h" gnus-summary-save-article-folder
1408 "v" gnus-summary-save-article-vm
1409 "p" gnus-summary-pipe-output
1410 "s" gnus-soup-add-article))
1412 (defun gnus-summary-make-menu-bar ()
1413 (gnus-turn-off-edit-menu 'summary)
1415 (unless (boundp 'gnus-summary-misc-menu)
1418 gnus-summary-kill-menu gnus-summary-mode-map ""
1423 ["Enter score..." gnus-summary-score-entry t]
1424 ["Customize" gnus-score-customize t])
1425 (gnus-make-score-map 'increase)
1426 (gnus-make-score-map 'lower)
1428 ["Kill below" gnus-summary-kill-below t]
1429 ["Mark above" gnus-summary-mark-above t]
1430 ["Tick above" gnus-summary-tick-above t]
1431 ["Clear above" gnus-summary-clear-above t])
1432 ["Current score" gnus-summary-current-score t]
1433 ["Set score" gnus-summary-set-score t]
1434 ["Switch current score file..." gnus-score-change-score-file t]
1435 ["Set mark below..." gnus-score-set-mark-below t]
1436 ["Set expunge below..." gnus-score-set-expunge-below t]
1437 ["Edit current score file" gnus-score-edit-current-scores t]
1438 ["Edit score file" gnus-score-edit-file t]
1439 ["Trace score" gnus-score-find-trace t]
1440 ["Find words" gnus-score-find-favourite-words t]
1441 ["Rescore buffer" gnus-summary-rescore t]
1442 ["Increase score..." gnus-summary-increase-score t]
1443 ["Lower score..." gnus-summary-lower-score t]))))
1446 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1448 :selected (null gnus-score-default-header)]
1449 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1451 :selected (eq gnus-score-default-header 'a)]
1452 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1454 :selected (eq gnus-score-default-header 's)]
1456 (gnus-score-set-default 'gnus-score-default-header 'b)
1458 :selected (eq gnus-score-default-header 'b )]
1460 (gnus-score-set-default 'gnus-score-default-header 'h)
1462 :selected (eq gnus-score-default-header 'h )]
1463 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1465 :selected (eq gnus-score-default-header 'i )]
1466 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1468 :selected (eq gnus-score-default-header 't )]
1470 (gnus-score-set-default 'gnus-score-default-header 'x)
1472 :selected (eq gnus-score-default-header 'x )]
1473 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1475 :selected (eq gnus-score-default-header 'l )]
1476 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1478 :selected (eq gnus-score-default-header 'd )]
1479 ["Followups to author"
1480 (gnus-score-set-default 'gnus-score-default-header 'f)
1482 :selected (eq gnus-score-default-header 'f )])
1484 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1486 :selected (null gnus-score-default-type)]
1487 ;; The `:active' key is commented out in the following,
1488 ;; because the GNU Emacs hack to support radio buttons use
1489 ;; active to indicate which button is selected.
1490 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1492 ;; :active (not (memq gnus-score-default-header '(l d)))
1493 :selected (eq gnus-score-default-type 's)]
1494 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1496 ;; :active (not (memq gnus-score-default-header '(l d)))
1497 :selected (eq gnus-score-default-type 'r)]
1498 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1500 ;; :active (not (memq gnus-score-default-header '(l d)))
1501 :selected (eq gnus-score-default-type 'e)]
1502 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1504 ;; :active (not (memq gnus-score-default-header '(l d)))
1505 :selected (eq gnus-score-default-type 'f)]
1506 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1508 ;; :active (eq (gnus-score-default-header 'd))
1509 :selected (eq gnus-score-default-type 'b)]
1510 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1512 ;; :active (eq (gnus-score-default-header 'd))
1513 :selected (eq gnus-score-default-type 'n)]
1514 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1516 ;; :active (eq (gnus-score-default-header 'd))
1517 :selected (eq gnus-score-default-type 'a)]
1519 (gnus-score-set-default 'gnus-score-default-type '<)
1521 ;; :active (eq (gnus-score-default-header 'l))
1522 :selected (eq gnus-score-default-type '<)]
1524 (gnus-score-set-default 'gnus-score-default-type '=)
1526 ;; :active (eq (gnus-score-default-header 'l))
1527 :selected (eq gnus-score-default-type '=)]
1528 ["Greater than number"
1529 (gnus-score-set-default 'gnus-score-default-type '>)
1531 ;; :active (eq (gnus-score-default-header 'l))
1532 :selected (eq gnus-score-default-type '>)])
1533 ["Default fold" gnus-score-default-fold-toggle
1535 :selected gnus-score-default-fold]
1537 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1539 :selected (null gnus-score-default-duration)]
1541 (gnus-score-set-default 'gnus-score-default-duration 'p)
1543 :selected (eq gnus-score-default-duration 'p)]
1545 (gnus-score-set-default 'gnus-score-default-duration 't)
1547 :selected (eq gnus-score-default-duration 't)]
1549 (gnus-score-set-default 'gnus-score-default-duration 'i)
1551 :selected (eq gnus-score-default-duration 'i)]))
1554 gnus-summary-article-menu gnus-summary-mode-map ""
1557 ["All" gnus-article-hide t]
1558 ["Headers" gnus-article-hide-headers t]
1559 ["Signature" gnus-article-hide-signature t]
1560 ["Citation" gnus-article-hide-citation t]
1561 ["PGP" gnus-article-hide-pgp t]
1562 ["Boring headers" gnus-article-hide-boring-headers t])
1564 ["All" gnus-article-highlight t]
1565 ["Headers" gnus-article-highlight-headers t]
1566 ["Signature" gnus-article-highlight-signature t]
1567 ["Citation" gnus-article-highlight-citation t])
1569 ["Local" gnus-article-date-local t]
1570 ["UT" gnus-article-date-ut t]
1571 ["Original" gnus-article-date-original t]
1572 ["Lapsed" gnus-article-date-lapsed t]
1573 ["User-defined" gnus-article-date-user t])
1576 ["Leading" gnus-article-strip-leading-blank-lines t]
1577 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1578 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1579 ["All of the above" gnus-article-strip-blank-lines t]
1580 ["Leading space" gnus-article-strip-leading-space t])
1581 ["Overstrike" gnus-article-treat-overstrike t]
1582 ["Emphasis" gnus-article-emphasize t]
1583 ["Word wrap" gnus-article-fill-cited-article t]
1584 ["CR" gnus-article-remove-cr t]
1585 ["Show X-Face" gnus-article-display-x-face t]
1586 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1587 ["UnHTMLize" gnus-article-treat-html t]
1588 ["Rot 13" gnus-summary-caesar-message t]
1589 ["Unix pipe" gnus-summary-pipe-message t]
1590 ["Add buttons" gnus-article-add-buttons t]
1591 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1592 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1593 ["Toggle MIME" gnus-summary-toggle-mime t]
1594 ["Verbose header" gnus-summary-verbose-headers t]
1595 ["Toggle header" gnus-summary-toggle-header t])
1597 ["Save in default format" gnus-summary-save-article t]
1598 ["Save in file" gnus-summary-save-article-file t]
1599 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1600 ["Write to file" gnus-summary-write-article-mail t]
1601 ["Save in MH folder" gnus-summary-save-article-folder t]
1602 ["Save in VM folder" gnus-summary-save-article-vm t]
1603 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1604 ["Save body in file" gnus-summary-save-article-body-file t]
1605 ["Pipe through a filter" gnus-summary-pipe-output t]
1606 ["Add to SOUP packet" gnus-soup-add-article t]
1607 ["Print" gnus-summary-print-article t])
1609 ["Respool article..." gnus-summary-respool-article t]
1610 ["Move article..." gnus-summary-move-article
1611 (gnus-check-backend-function
1612 'request-move-article gnus-newsgroup-name)]
1613 ["Copy article..." gnus-summary-copy-article t]
1614 ["Crosspost article..." gnus-summary-crosspost-article
1615 (gnus-check-backend-function
1616 'request-replace-article gnus-newsgroup-name)]
1617 ["Import file..." gnus-summary-import-article t]
1618 ["Check if posted" gnus-summary-article-posted-p t]
1619 ["Edit article" gnus-summary-edit-article
1620 (not (gnus-group-read-only-p))]
1621 ["Delete article" gnus-summary-delete-article
1622 (gnus-check-backend-function
1623 'request-expire-articles gnus-newsgroup-name)]
1624 ["Query respool" gnus-summary-respool-query t]
1625 ["Delete expirable articles" gnus-summary-expire-articles-now
1626 (gnus-check-backend-function
1627 'request-expire-articles gnus-newsgroup-name)])
1629 ["Uudecode" gnus-uu-decode-uu t]
1630 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1631 ["Unshar" gnus-uu-decode-unshar t]
1632 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1633 ["Save" gnus-uu-decode-save t]
1634 ["Binhex" gnus-uu-decode-binhex t]
1635 ["Postscript" gnus-uu-decode-postscript t])
1637 ["Enter article" gnus-cache-enter-article t]
1638 ["Remove article" gnus-cache-remove-article t])
1639 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1640 ["Isearch article..." gnus-summary-isearch-article t]
1641 ["Beginning of the article" gnus-summary-beginning-of-article t]
1642 ["End of the article" gnus-summary-end-of-article t]
1643 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1644 ["Fetch referenced articles" gnus-summary-refer-references t]
1645 ["Fetch current thread" gnus-summary-refer-thread t]
1646 ["Fetch article with id..." gnus-summary-refer-article t]
1647 ["Redisplay" gnus-summary-show-article t]))
1650 gnus-summary-thread-menu gnus-summary-mode-map ""
1652 ["Toggle threading" gnus-summary-toggle-threads t]
1653 ["Hide threads" gnus-summary-hide-all-threads t]
1654 ["Show threads" gnus-summary-show-all-threads t]
1655 ["Hide thread" gnus-summary-hide-thread t]
1656 ["Show thread" gnus-summary-show-thread t]
1657 ["Go to next thread" gnus-summary-next-thread t]
1658 ["Go to previous thread" gnus-summary-prev-thread t]
1659 ["Go down thread" gnus-summary-down-thread t]
1660 ["Go up thread" gnus-summary-up-thread t]
1661 ["Top of thread" gnus-summary-top-thread t]
1662 ["Mark thread as read" gnus-summary-kill-thread t]
1663 ["Lower thread score" gnus-summary-lower-thread t]
1664 ["Raise thread score" gnus-summary-raise-thread t]
1665 ["Rethread current" gnus-summary-rethread-current t]
1669 gnus-summary-post-menu gnus-summary-mode-map ""
1671 ["Post an article" gnus-summary-post-news t]
1672 ["Followup" gnus-summary-followup t]
1673 ["Followup and yank" gnus-summary-followup-with-original t]
1674 ["Supersede article" gnus-summary-supersede-article t]
1675 ["Cancel article" gnus-summary-cancel-article t]
1676 ["Reply" gnus-summary-reply t]
1677 ["Reply and yank" gnus-summary-reply-with-original t]
1678 ["Wide reply" gnus-summary-wide-reply t]
1679 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1680 ["Mail forward" gnus-summary-mail-forward t]
1681 ["Post forward" gnus-summary-post-forward t]
1682 ["Digest and mail" gnus-uu-digest-mail-forward t]
1683 ["Digest and post" gnus-uu-digest-post-forward t]
1684 ["Resend message" gnus-summary-resend-message t]
1685 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1686 ["Send a mail" gnus-summary-mail-other-window t]
1687 ["Uuencode and post" gnus-uu-post-news t]
1688 ["Followup via news" gnus-summary-followup-to-mail t]
1689 ["Followup via news and yank"
1690 gnus-summary-followup-to-mail-with-original t]
1692 ;;["Send" gnus-summary-send-draft t]
1693 ;;["Send bounced" gnus-resend-bounced-mail t])
1697 gnus-summary-misc-menu gnus-summary-mode-map ""
1700 ["Mark as read" gnus-summary-mark-as-read-forward t]
1701 ["Mark same subject and select"
1702 gnus-summary-kill-same-subject-and-select t]
1703 ["Mark same subject" gnus-summary-kill-same-subject t]
1704 ["Catchup" gnus-summary-catchup t]
1705 ["Catchup all" gnus-summary-catchup-all t]
1706 ["Catchup to here" gnus-summary-catchup-to-here t]
1707 ["Catchup region" gnus-summary-mark-region-as-read t]
1708 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1710 ["Tick" gnus-summary-tick-article-forward t]
1711 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1712 ["Remove marks" gnus-summary-clear-mark-forward t]
1713 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1714 ["Set bookmark" gnus-summary-set-bookmark t]
1715 ["Remove bookmark" gnus-summary-remove-bookmark t])
1717 ["Marks..." gnus-summary-limit-to-marks t]
1718 ["Subject..." gnus-summary-limit-to-subject t]
1719 ["Author..." gnus-summary-limit-to-author t]
1720 ["Age..." gnus-summary-limit-to-age t]
1721 ["Score" gnus-summary-limit-to-score t]
1722 ["Unread" gnus-summary-limit-to-unread t]
1723 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1724 ["Articles" gnus-summary-limit-to-articles t]
1725 ["Pop limit" gnus-summary-pop-limit t]
1726 ["Show dormant" gnus-summary-limit-include-dormant t]
1727 ["Hide childless dormant"
1728 gnus-summary-limit-exclude-childless-dormant t]
1729 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1730 ["Show expunged" gnus-summary-show-all-expunged t])
1732 ["Set mark" gnus-summary-mark-as-processable t]
1733 ["Remove mark" gnus-summary-unmark-as-processable t]
1734 ["Remove all marks" gnus-summary-unmark-all-processable t]
1735 ["Mark above" gnus-uu-mark-over t]
1736 ["Mark series" gnus-uu-mark-series t]
1737 ["Mark region" gnus-uu-mark-region t]
1738 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1739 ["Mark all" gnus-uu-mark-all t]
1740 ["Mark buffer" gnus-uu-mark-buffer t]
1741 ["Mark sparse" gnus-uu-mark-sparse t]
1742 ["Mark thread" gnus-uu-mark-thread t]
1743 ["Unmark thread" gnus-uu-unmark-thread t]
1744 ("Process Mark Sets"
1745 ["Kill" gnus-summary-kill-process-mark t]
1746 ["Yank" gnus-summary-yank-process-mark
1747 gnus-newsgroup-process-stack]
1748 ["Save" gnus-summary-save-process-mark t]))
1750 ["Page forward" gnus-summary-next-page t]
1751 ["Page backward" gnus-summary-prev-page t]
1752 ["Line forward" gnus-summary-scroll-up t])
1754 ["Next unread article" gnus-summary-next-unread-article t]
1755 ["Previous unread article" gnus-summary-prev-unread-article t]
1756 ["Next article" gnus-summary-next-article t]
1757 ["Previous article" gnus-summary-prev-article t]
1758 ["Next unread subject" gnus-summary-next-unread-subject t]
1759 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1760 ["Next article same subject" gnus-summary-next-same-subject t]
1761 ["Previous article same subject" gnus-summary-prev-same-subject t]
1762 ["First unread article" gnus-summary-first-unread-article t]
1763 ["Best unread article" gnus-summary-best-unread-article t]
1764 ["Go to subject number..." gnus-summary-goto-subject t]
1765 ["Go to article number..." gnus-summary-goto-article t]
1766 ["Go to the last article" gnus-summary-goto-last-article t]
1767 ["Pop article off history" gnus-summary-pop-article t])
1769 ["Sort by number" gnus-summary-sort-by-number t]
1770 ["Sort by author" gnus-summary-sort-by-author t]
1771 ["Sort by subject" gnus-summary-sort-by-subject t]
1772 ["Sort by date" gnus-summary-sort-by-date t]
1773 ["Sort by score" gnus-summary-sort-by-score t]
1774 ["Sort by lines" gnus-summary-sort-by-lines t])
1776 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1777 ["Describe group" gnus-summary-describe-group t]
1778 ["Read manual" gnus-info-find-node t])
1780 ["Pick and read" gnus-pick-mode t]
1781 ["Binary" gnus-binary-mode t])
1783 ["Regenerate" gnus-summary-prepare t]
1784 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1785 ["Toggle threading" gnus-summary-toggle-threads t])
1786 ["Filter articles..." gnus-summary-execute-command t]
1787 ["Run command on subjects..." gnus-summary-universal-argument t]
1788 ["Search articles forward..." gnus-summary-search-article-forward t]
1789 ["Search articles backward..." gnus-summary-search-article-backward t]
1790 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1791 ["Expand window" gnus-summary-expand-window t]
1792 ["Expire expirable articles" gnus-summary-expire-articles
1793 (gnus-check-backend-function
1794 'request-expire-articles gnus-newsgroup-name)]
1795 ["Edit local kill file" gnus-summary-edit-local-kill t]
1796 ["Edit main kill file" gnus-summary-edit-global-kill t]
1798 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1799 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1800 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1801 ["Exit group" gnus-summary-exit t]
1802 ["Exit group without updating" gnus-summary-exit-no-update t]
1803 ["Exit and goto next group" gnus-summary-next-group t]
1804 ["Exit and goto prev group" gnus-summary-prev-group t]
1805 ["Reselect group" gnus-summary-reselect-current-group t]
1806 ["Rescan group" gnus-summary-rescan-group t]
1807 ["Update dribble" gnus-summary-save-newsrc t])))
1809 (run-hooks 'gnus-summary-menu-hook)))
1811 (defun gnus-score-set-default (var value)
1812 "A version of set that updates the GNU Emacs menu-bar."
1814 ;; It is the message that forces the active status to be updated.
1817 (defun gnus-make-score-map (type)
1818 "Make a summary score map of type TYPE."
1821 (let ((headers '(("author" "from" string)
1822 ("subject" "subject" string)
1823 ("article body" "body" string)
1824 ("article head" "head" string)
1825 ("xref" "xref" string)
1826 ("lines" "lines" number)
1827 ("followups to author" "followup" string)))
1828 (types '((number ("less than" <)
1831 (string ("substring" s)
1835 (perms '(("temporary" (current-time-string))
1843 (if (eq type 'lower)
1848 (setq header (car headers))
1854 (let ((ts (cdr (assoc (nth 2 header) types)))
1870 'gnus-summary-score-entry
1872 (if (or (string= (nth 1 header)
1874 (string= (nth 1 header)
1877 (list 'gnus-summary-header
1879 (list 'quote (nth 1 (car ts)))
1880 (list 'gnus-score-default nil)
1886 (list (nreverse outp))))
1889 (list (nreverse outt))))
1891 (setq headers (cdr headers)))
1892 (list (nreverse outh))))))))
1896 (defun gnus-summary-mode (&optional group)
1897 "Major mode for reading articles.
1899 All normal editing commands are switched off.
1900 \\<gnus-summary-mode-map>
1901 Each line in this buffer represents one article. To read an
1902 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1903 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1906 You can also post articles and send mail from this buffer. To
1907 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1908 of an article, type `\\[gnus-summary-reply]'.
1910 There are approx. one gazillion commands you can execute in this
1911 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1913 The following commands are available:
1915 \\{gnus-summary-mode-map}"
1917 (when (gnus-visual-p 'summary-menu 'menu)
1918 (gnus-summary-make-menu-bar))
1919 (kill-all-local-variables)
1920 (gnus-summary-make-local-variables)
1921 (gnus-make-thread-indent-array)
1922 (gnus-simplify-mode-line)
1923 (setq major-mode 'gnus-summary-mode)
1924 (setq mode-name "Summary")
1925 (make-local-variable 'minor-mode-alist)
1926 (use-local-map gnus-summary-mode-map)
1927 (buffer-disable-undo (current-buffer))
1928 (setq buffer-read-only t) ;Disable modification
1929 (setq truncate-lines t)
1930 (setq selective-display t)
1931 (setq selective-display-ellipses t) ;Display `...'
1932 (gnus-summary-set-display-table)
1933 (gnus-set-default-directory)
1934 (setq gnus-newsgroup-name group)
1935 (make-local-variable 'gnus-summary-line-format)
1936 (make-local-variable 'gnus-summary-line-format-spec)
1937 (make-local-variable 'gnus-summary-mark-positions)
1938 (make-local-hook 'post-command-hook)
1939 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1940 (run-hooks 'gnus-summary-mode-hook)
1941 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1942 (gnus-update-summary-mark-positions))
1944 (defun gnus-summary-make-local-variables ()
1945 "Make all the local summary buffer variables."
1946 (let ((locals gnus-summary-local-variables)
1948 (while (setq local (pop locals))
1951 (if (eq (cdr local) 'global)
1952 ;; Copy the global value of the variable.
1953 (setq global (symbol-value (car local)))
1954 ;; Use the value from the list.
1955 (setq global (eval (cdr local))))
1956 (make-local-variable (car local))
1957 (set (car local) global))
1958 ;; Simple nil-valued local variable.
1959 (make-local-variable local)
1962 (defun gnus-summary-clear-local-variables ()
1963 (let ((locals gnus-summary-local-variables))
1965 (if (consp (car locals))
1966 (and (vectorp (caar locals))
1967 (set (caar locals) nil))
1968 (and (vectorp (car locals))
1969 (set (car locals) nil)))
1970 (setq locals (cdr locals)))))
1972 ;; Summary data functions.
1974 (defmacro gnus-data-number (data)
1977 (defmacro gnus-data-set-number (data number)
1978 `(setcar ,data ,number))
1980 (defmacro gnus-data-mark (data)
1983 (defmacro gnus-data-set-mark (data mark)
1984 `(setcar (nthcdr 1 ,data) ,mark))
1986 (defmacro gnus-data-pos (data)
1989 (defmacro gnus-data-set-pos (data pos)
1990 `(setcar (nthcdr 2 ,data) ,pos))
1992 (defmacro gnus-data-header (data)
1995 (defmacro gnus-data-set-header (data header)
1996 `(setf (nth 3 ,data) ,header))
1998 (defmacro gnus-data-level (data)
2001 (defmacro gnus-data-unread-p (data)
2002 `(= (nth 1 ,data) gnus-unread-mark))
2004 (defmacro gnus-data-read-p (data)
2005 `(/= (nth 1 ,data) gnus-unread-mark))
2007 (defmacro gnus-data-pseudo-p (data)
2008 `(consp (nth 3 ,data)))
2010 (defmacro gnus-data-find (number)
2011 `(assq ,number gnus-newsgroup-data))
2013 (defmacro gnus-data-find-list (number &optional data)
2014 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2015 (memq (assq ,number bdata)
2018 (defmacro gnus-data-make (number mark pos header level)
2019 `(list ,number ,mark ,pos ,header ,level))
2021 (defun gnus-data-enter (after-article number mark pos header level offset)
2022 (let ((data (gnus-data-find-list after-article)))
2024 (error "No such article: %d" after-article))
2025 (setcdr data (cons (gnus-data-make number mark pos header level)
2027 (setq gnus-newsgroup-data-reverse nil)
2028 (gnus-data-update-list (cddr data) offset)))
2030 (defun gnus-data-enter-list (after-article list &optional offset)
2032 (let ((data (and after-article (gnus-data-find-list after-article)))
2034 (or data (not after-article) (error "No such article: %d" after-article))
2035 ;; Find the last element in the list to be spliced into the main
2038 (setq list (cdr list)))
2041 (setcdr list gnus-newsgroup-data)
2042 (setq gnus-newsgroup-data ilist)
2044 (gnus-data-update-list (cdr list) offset)))
2045 (setcdr list (cdr data))
2048 (gnus-data-update-list (cdr list) offset)))
2049 (setq gnus-newsgroup-data-reverse nil))))
2051 (defun gnus-data-remove (article &optional offset)
2052 (let ((data gnus-newsgroup-data))
2053 (if (= (gnus-data-number (car data)) article)
2055 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2056 gnus-newsgroup-data-reverse nil)
2058 (gnus-data-update-list gnus-newsgroup-data offset)))
2060 (when (= (gnus-data-number (cadr data)) article)
2061 (setcdr data (cddr data))
2063 (gnus-data-update-list (cdr data) offset))
2065 gnus-newsgroup-data-reverse nil))
2066 (setq data (cdr data))))))
2068 (defmacro gnus-data-list (backward)
2070 (or gnus-newsgroup-data-reverse
2071 (setq gnus-newsgroup-data-reverse
2072 (reverse gnus-newsgroup-data)))
2073 gnus-newsgroup-data))
2075 (defun gnus-data-update-list (data offset)
2076 "Add OFFSET to the POS of all data entries in DATA."
2078 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2079 (setq data (cdr data))))
2081 (defun gnus-data-compute-positions ()
2082 "Compute the positions of all articles."
2083 (let ((data gnus-newsgroup-data)
2086 (when (setq pos (text-property-any
2087 (point-min) (point-max)
2088 'gnus-number (gnus-data-number (car data))))
2089 (gnus-data-set-pos (car data) (+ pos 3)))
2090 (setq data (cdr data)))))
2092 (defun gnus-summary-article-pseudo-p (article)
2093 "Say whether this article is a pseudo article or not."
2094 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2096 (defmacro gnus-summary-article-sparse-p (article)
2097 "Say whether this article is a sparse article or not."
2098 `(memq ,article gnus-newsgroup-sparse))
2100 (defmacro gnus-summary-article-ancient-p (article)
2101 "Say whether this article is a sparse article or not."
2102 `(memq ,article gnus-newsgroup-ancient))
2104 (defun gnus-article-parent-p (number)
2105 "Say whether this article is a parent or not."
2106 (let ((data (gnus-data-find-list number)))
2107 (and (cdr data) ; There has to be an article after...
2108 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2109 (gnus-data-level (nth 1 data))))))
2111 (defun gnus-article-children (number)
2112 "Return a list of all children to NUMBER."
2113 (let* ((data (gnus-data-find-list number))
2114 (level (gnus-data-level (car data)))
2116 (setq data (cdr data))
2118 (= (gnus-data-level (car data)) (1+ level)))
2119 (push (gnus-data-number (car data)) children)
2120 (setq data (cdr data)))
2123 (defmacro gnus-summary-skip-intangible ()
2124 "If the current article is intangible, then jump to a different article."
2125 '(let ((to (get-text-property (point) 'gnus-intangible)))
2126 (and to (gnus-summary-goto-subject to))))
2128 (defmacro gnus-summary-article-intangible-p ()
2129 "Say whether this article is intangible or not."
2130 '(get-text-property (point) 'gnus-intangible))
2132 (defun gnus-article-read-p (article)
2133 "Say whether ARTICLE is read or not."
2134 (not (or (memq article gnus-newsgroup-marked)
2135 (memq article gnus-newsgroup-unreads)
2136 (memq article gnus-newsgroup-unselected)
2137 (memq article gnus-newsgroup-dormant))))
2139 ;; Some summary mode macros.
2141 (defmacro gnus-summary-article-number ()
2142 "The article number of the article on the current line.
2143 If there isn's an article number here, then we return the current
2146 (gnus-summary-skip-intangible)
2147 (or (get-text-property (point) 'gnus-number)
2148 (gnus-summary-last-subject))))
2150 (defmacro gnus-summary-article-header (&optional number)
2151 `(gnus-data-header (gnus-data-find
2152 ,(or number '(gnus-summary-article-number)))))
2154 (defmacro gnus-summary-thread-level (&optional number)
2155 `(if (and (eq gnus-summary-make-false-root 'dummy)
2156 (get-text-property (point) 'gnus-intangible))
2158 (gnus-data-level (gnus-data-find
2159 ,(or number '(gnus-summary-article-number))))))
2161 (defmacro gnus-summary-article-mark (&optional number)
2162 `(gnus-data-mark (gnus-data-find
2163 ,(or number '(gnus-summary-article-number)))))
2165 (defmacro gnus-summary-article-pos (&optional number)
2166 `(gnus-data-pos (gnus-data-find
2167 ,(or number '(gnus-summary-article-number)))))
2169 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2170 (defmacro gnus-summary-article-subject (&optional number)
2171 "Return current subject string or nil if nothing."
2174 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2175 '(gnus-data-header (assq (gnus-summary-article-number)
2176 gnus-newsgroup-data)))))
2179 (mail-header-subject headers))))
2181 (defmacro gnus-summary-article-score (&optional number)
2182 "Return current article score."
2183 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2184 gnus-newsgroup-scored))
2185 gnus-summary-default-score 0))
2187 (defun gnus-summary-article-children (&optional number)
2188 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2189 (level (gnus-data-level (car data)))
2191 (while (and (setq data (cdr data))
2192 (> (setq l (gnus-data-level (car data))) level))
2193 (and (= (1+ level) l)
2194 (push (gnus-data-number (car data))
2196 (nreverse children)))
2198 (defun gnus-summary-article-parent (&optional number)
2199 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2200 (gnus-data-list t)))
2201 (level (gnus-data-level (car data))))
2203 () ; This is a root.
2204 ;; We search until we find an article with a level less than
2205 ;; this one. That function has to be the parent.
2206 (while (and (setq data (cdr data))
2207 (not (< (gnus-data-level (car data)) level))))
2208 (and data (gnus-data-number (car data))))))
2210 (defun gnus-unread-mark-p (mark)
2211 "Say whether MARK is the unread mark."
2212 (= mark gnus-unread-mark))
2214 (defun gnus-read-mark-p (mark)
2215 "Say whether MARK is one of the marks that mark as read.
2216 This is all marks except unread, ticked, dormant, and expirable."
2217 (not (or (= mark gnus-unread-mark)
2218 (= mark gnus-ticked-mark)
2219 (= mark gnus-dormant-mark)
2220 (= mark gnus-expirable-mark))))
2222 (defmacro gnus-article-mark (number)
2224 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2225 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2226 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2227 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2228 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2229 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2230 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2231 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2232 gnus-ancient-mark))))
2234 ;; Saving hidden threads.
2236 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2237 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2239 (defmacro gnus-save-hidden-threads (&rest forms)
2240 "Save hidden threads, eval FORMS, and restore the hidden threads."
2241 (let ((config (make-symbol "config")))
2242 `(let ((,config (gnus-hidden-threads-configuration)))
2246 (gnus-restore-hidden-threads-configuration ,config)))))
2248 (defun gnus-hidden-threads-configuration ()
2249 "Return the current hidden threads configuration."
2252 (goto-char (point-min))
2253 (while (search-forward "\r" nil t)
2254 (push (1- (point)) config))
2257 (defun gnus-restore-hidden-threads-configuration (config)
2258 "Restore hidden threads configuration from CONFIG."
2259 (let (point buffer-read-only)
2260 (while (setq point (pop config))
2261 (when (and (< point (point-max))
2263 (= (following-char) ?\n))
2264 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2266 ;; Various summary mode internalish functions.
2268 (defun gnus-mouse-pick-article (e)
2271 (gnus-summary-next-page nil t))
2273 (defun gnus-summary-set-display-table ()
2274 ;; Change the display table. Odd characters have a tendency to mess
2275 ;; up nicely formatted displays - we make all possible glyphs
2276 ;; display only a single character.
2278 ;; We start from the standard display table, if any.
2279 (let ((table (or (copy-sequence standard-display-table)
2280 (make-display-table)))
2282 ;; Nix out all the control chars...
2283 (while (>= (setq i (1- i)) 0)
2284 (aset table i [??]))
2285 ;; ... but not newline and cr, of course. (cr is necessary for the
2286 ;; selective display).
2287 (aset table ?\n nil)
2288 (aset table ?\r nil)
2289 ;; We nix out any glyphs over 126 that are not set already.
2291 (while (>= (setq i (1- i)) 127)
2292 ;; Only modify if the entry is nil.
2293 (unless (aref table i)
2294 (aset table i [??]))))
2295 (setq buffer-display-table table)))
2297 (defun gnus-summary-setup-buffer (group)
2298 "Initialize summary buffer."
2299 (let ((buffer (concat "*Summary " group "*")))
2300 (if (get-buffer buffer)
2303 (setq gnus-summary-buffer (current-buffer))
2304 (not gnus-newsgroup-prepared))
2305 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2306 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2307 (gnus-add-current-to-buffer-list)
2308 (gnus-summary-mode group)
2310 (gnus-carpal-setup-buffer 'summary))
2311 (unless gnus-single-article-buffer
2312 (make-local-variable 'gnus-article-buffer)
2313 (make-local-variable 'gnus-article-current)
2314 (make-local-variable 'gnus-original-article-buffer))
2315 (setq gnus-newsgroup-name group)
2318 (defun gnus-set-global-variables ()
2319 ;; Set the global equivalents of the summary buffer-local variables
2320 ;; to the latest values they had. These reflect the summary buffer
2321 ;; that was in action when the last article was fetched.
2322 (when (eq major-mode 'gnus-summary-mode)
2323 (setq gnus-summary-buffer (current-buffer))
2324 (let ((name gnus-newsgroup-name)
2325 (marked gnus-newsgroup-marked)
2326 (unread gnus-newsgroup-unreads)
2327 (headers gnus-current-headers)
2328 (data gnus-newsgroup-data)
2329 (summary gnus-summary-buffer)
2330 (article-buffer gnus-article-buffer)
2331 (original gnus-original-article-buffer)
2332 (gac gnus-article-current)
2333 (reffed gnus-reffed-article-number)
2334 (score-file gnus-current-score-file))
2336 (set-buffer gnus-group-buffer)
2337 (setq gnus-newsgroup-name name)
2338 (setq gnus-newsgroup-marked marked)
2339 (setq gnus-newsgroup-unreads unread)
2340 (setq gnus-current-headers headers)
2341 (setq gnus-newsgroup-data data)
2342 (setq gnus-article-current gac)
2343 (setq gnus-summary-buffer summary)
2344 (setq gnus-article-buffer article-buffer)
2345 (setq gnus-original-article-buffer original)
2346 (setq gnus-reffed-article-number reffed)
2347 (setq gnus-current-score-file score-file)
2348 ;; The article buffer also has local variables.
2349 (when (gnus-buffer-live-p gnus-article-buffer)
2350 (set-buffer gnus-article-buffer)
2351 (setq gnus-summary-buffer summary))))))
2353 (defun gnus-summary-article-unread-p (article)
2354 "Say whether ARTICLE is unread or not."
2355 (memq article gnus-newsgroup-unreads))
2357 (defun gnus-summary-first-article-p (&optional article)
2358 "Return whether ARTICLE is the first article in the buffer."
2359 (if (not (setq article (or article (gnus-summary-article-number))))
2361 (eq article (caar gnus-newsgroup-data))))
2363 (defun gnus-summary-last-article-p (&optional article)
2364 "Return whether ARTICLE is the last article in the buffer."
2365 (if (not (setq article (or article (gnus-summary-article-number))))
2366 t ; All non-existent numbers are the last article. :-)
2367 (not (cdr (gnus-data-find-list article)))))
2369 (defun gnus-make-thread-indent-array ()
2371 (unless (and gnus-thread-indent-array
2372 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2373 (setq gnus-thread-indent-array (make-vector 201 "")
2374 gnus-thread-indent-array-level gnus-thread-indent-level)
2376 (aset gnus-thread-indent-array n
2377 (make-string (* n gnus-thread-indent-level) ? ))
2380 (defun gnus-update-summary-mark-positions ()
2381 "Compute where the summary marks are to go."
2383 (when (and gnus-summary-buffer
2384 (get-buffer gnus-summary-buffer)
2385 (buffer-name (get-buffer gnus-summary-buffer)))
2386 (set-buffer gnus-summary-buffer))
2387 (let ((gnus-replied-mark 129)
2388 (gnus-score-below-mark 130)
2389 (gnus-score-over-mark 130)
2390 (gnus-download-mark 131)
2391 (spec gnus-summary-line-format-spec)
2392 thread gnus-visual pos)
2394 (gnus-set-work-buffer)
2395 (let ((gnus-summary-line-format-spec spec)
2396 (gnus-newsgroup-downloadable '((0 . t))))
2397 (gnus-summary-insert-line
2398 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2399 (goto-char (point-min))
2400 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2402 (goto-char (point-min))
2403 (push (cons 'replied (and (search-forward "\201" nil t)
2406 (goto-char (point-min))
2407 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2409 (goto-char (point-min))
2410 (push (cons 'download
2411 (and (search-forward "\203" nil t) (- (point) 2)))
2413 (setq gnus-summary-mark-positions pos))))
2415 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2416 "Insert a dummy root in the summary buffer."
2418 (gnus-add-text-properties
2419 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2420 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2422 (defun gnus-summary-insert-line (gnus-tmp-header
2423 gnus-tmp-level gnus-tmp-current
2424 gnus-tmp-unread gnus-tmp-replied
2425 gnus-tmp-expirable gnus-tmp-subject-or-nil
2426 &optional gnus-tmp-dummy gnus-tmp-score
2428 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2429 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2430 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2431 (gnus-tmp-score-char
2432 (if (or (null gnus-summary-default-score)
2433 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2434 gnus-summary-zcore-fuzz))
2436 (if (< gnus-tmp-score gnus-summary-default-score)
2437 gnus-score-below-mark gnus-score-over-mark)))
2439 (cond (gnus-tmp-process gnus-process-mark)
2440 ((memq gnus-tmp-current gnus-newsgroup-cached)
2442 (gnus-tmp-replied gnus-replied-mark)
2443 ((memq gnus-tmp-current gnus-newsgroup-saved)
2445 (t gnus-unread-mark)))
2446 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2449 ((string-match "<[^>]+> *$" gnus-tmp-from)
2450 (let ((beg (match-beginning 0)))
2451 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2452 (substring gnus-tmp-from (1+ (match-beginning 0))
2453 (1- (match-end 0))))
2454 (substring gnus-tmp-from 0 beg))))
2455 ((string-match "(.+)" gnus-tmp-from)
2456 (substring gnus-tmp-from
2457 (1+ (match-beginning 0)) (1- (match-end 0))))
2459 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2460 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2461 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2462 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2463 (buffer-read-only nil))
2464 (when (string= gnus-tmp-name "")
2465 (setq gnus-tmp-name gnus-tmp-from))
2466 (unless (numberp gnus-tmp-lines)
2467 (setq gnus-tmp-lines 0))
2468 (gnus-put-text-property
2470 (progn (eval gnus-summary-line-format-spec) (point))
2471 'gnus-number gnus-tmp-number)
2472 (when (gnus-visual-p 'summary-highlight 'highlight)
2474 (run-hooks 'gnus-summary-update-hook)
2477 (defun gnus-summary-update-line (&optional dont-update)
2478 ;; Update summary line after change.
2479 (when (and gnus-summary-default-score
2480 (not gnus-summary-inhibit-highlight))
2481 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2482 (article (gnus-summary-article-number))
2483 (score (gnus-summary-article-score article)))
2485 (if (and gnus-summary-mark-below
2486 (< (gnus-summary-article-score)
2487 gnus-summary-mark-below))
2488 ;; This article has a low score, so we mark it as read.
2489 (when (memq article gnus-newsgroup-unreads)
2490 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2491 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2492 ;; This article was previously marked as read on account
2493 ;; of a low score, but now it has risen, so we mark it as
2495 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2496 (gnus-summary-update-mark
2497 (if (or (null gnus-summary-default-score)
2498 (<= (abs (- score gnus-summary-default-score))
2499 gnus-summary-zcore-fuzz))
2501 (if (< score gnus-summary-default-score)
2502 gnus-score-below-mark gnus-score-over-mark))
2504 ;; Do visual highlighting.
2505 (when (gnus-visual-p 'summary-highlight 'highlight)
2506 (run-hooks 'gnus-summary-update-hook)))))
2508 (defvar gnus-tmp-new-adopts nil)
2510 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2511 "Return the number of articles in THREAD.
2512 This may be 0 in some cases -- if none of the articles in
2513 the thread are to be displayed."
2515 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2517 ((not (listp thread))
2519 ((and (consp thread) (cdr thread))
2522 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2525 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2528 (when (and level (zerop level) gnus-tmp-new-adopts)
2531 'gnus-summary-number-of-articles-in-thread
2532 gnus-tmp-new-adopts))))
2534 (if (> number 1) gnus-not-empty-thread-mark
2535 gnus-empty-thread-mark)
2538 (defun gnus-summary-set-local-parameters (group)
2539 "Go through the local params of GROUP and set all variable specs in that list."
2540 (let ((params (gnus-group-find-parameter group))
2543 (setq elem (car params)
2544 params (cdr params))
2545 (and (consp elem) ; Has to be a cons.
2546 (consp (cdr elem)) ; The cdr has to be a list.
2547 (symbolp (car elem)) ; Has to be a symbol in there.
2548 (not (memq (car elem)
2549 '(quit-config to-address to-list to-group)))
2550 (ignore-errors ; So we set it.
2551 (make-local-variable (car elem))
2552 (set (car elem) (eval (nth 1 elem))))))))
2554 (defun gnus-summary-read-group (group &optional show-all no-article
2555 kill-buffer no-display)
2556 "Start reading news in newsgroup GROUP.
2557 If SHOW-ALL is non-nil, already read articles are also listed.
2558 If NO-ARTICLE is non-nil, no article is selected initially.
2559 If NO-DISPLAY, don't generate a summary buffer."
2563 (let ((gnus-auto-select-next nil))
2564 (or (gnus-summary-read-group-1
2565 group show-all no-article
2566 kill-buffer no-display)
2567 (setq show-all nil)))))
2568 (eq gnus-auto-select-next 'quietly))
2569 (set-buffer gnus-group-buffer)
2570 (if (not (equal group (gnus-group-group-name)))
2571 (setq group (gnus-group-group-name))
2575 (defun gnus-summary-read-group-1 (group show-all no-article
2576 kill-buffer no-display)
2577 ;; Killed foreign groups can't be entered.
2578 (when (and (not (gnus-group-native-p group))
2579 (not (gnus-gethash group gnus-newsrc-hashtb)))
2580 (error "Dead non-native groups can't be entered"))
2581 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2582 (let* ((new-group (gnus-summary-setup-buffer group))
2583 (quit-config (gnus-group-quit-config group))
2584 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2586 ;; This summary buffer exists already, so we just select it.
2588 (gnus-set-global-variables)
2590 (gnus-kill-or-deaden-summary kill-buffer))
2591 (gnus-configure-windows 'summary 'force)
2592 (gnus-set-mode-line 'summary)
2593 (gnus-summary-position-point)
2596 ;; We couldn't select this group.
2598 (when (and (eq major-mode 'gnus-summary-mode)
2599 (not (equal (current-buffer) kill-buffer)))
2600 (kill-buffer (current-buffer))
2601 (if (not quit-config)
2603 (set-buffer gnus-group-buffer)
2604 (gnus-group-jump-to-group group)
2605 (gnus-group-next-unread-group 1))
2606 (gnus-handle-ephemeral-exit quit-config)))
2607 (gnus-message 3 "Can't select group")
2609 ;; The user did a `C-g' while prompting for number of articles,
2610 ;; so we exit this group.
2611 ((eq did-select 'quit)
2612 (and (eq major-mode 'gnus-summary-mode)
2613 (not (equal (current-buffer) kill-buffer))
2614 (kill-buffer (current-buffer)))
2616 (gnus-kill-or-deaden-summary kill-buffer))
2617 (if (not quit-config)
2619 (set-buffer gnus-group-buffer)
2620 (gnus-group-jump-to-group group)
2621 (gnus-group-next-unread-group 1)
2622 (gnus-configure-windows 'group 'force))
2623 (gnus-handle-ephemeral-exit quit-config))
2624 ;; Finally signal the quit.
2626 ;; The group was successfully selected.
2628 (gnus-set-global-variables)
2629 ;; Save the active value in effect when the group was entered.
2630 (setq gnus-newsgroup-active
2632 (gnus-active gnus-newsgroup-name)))
2633 ;; You can change the summary buffer in some way with this hook.
2634 (run-hooks 'gnus-select-group-hook)
2635 ;; Set any local variables in the group parameters.
2636 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2637 (gnus-update-format-specifications
2638 nil 'summary 'summary-mode 'summary-dummy)
2639 ;; Do score processing.
2640 (when gnus-use-scoring
2641 (gnus-possibly-score-headers))
2642 ;; Check whether to fill in the gaps in the threads.
2643 (when gnus-build-sparse-threads
2644 (gnus-build-sparse-threads))
2645 ;; Find the initial limit.
2646 (if gnus-show-threads
2648 (let ((gnus-newsgroup-dormant nil))
2649 (gnus-summary-initial-limit show-all))
2650 (gnus-summary-initial-limit show-all))
2651 (setq gnus-newsgroup-limit
2653 (lambda (header) (mail-header-number header))
2654 gnus-newsgroup-headers)))
2655 ;; Generate the summary buffer.
2657 (gnus-summary-prepare))
2658 (when gnus-use-trees
2659 (gnus-tree-open group)
2660 (setq gnus-summary-highlight-line-function
2661 'gnus-tree-highlight-article))
2662 ;; If the summary buffer is empty, but there are some low-scored
2663 ;; articles or some excluded dormants, we include these in the
2665 (when (and (zerop (buffer-size))
2667 (cond (gnus-newsgroup-dormant
2668 (gnus-summary-limit-include-dormant))
2669 ((and gnus-newsgroup-scored show-all)
2670 (gnus-summary-limit-include-expunged t))))
2671 ;; Function `gnus-apply-kill-file' must be called in this hook.
2672 (run-hooks 'gnus-apply-kill-hook)
2673 (if (and (zerop (buffer-size))
2676 ;; This newsgroup is empty.
2677 (gnus-summary-catchup-and-exit nil t)
2678 (gnus-message 6 "No unread news")
2680 (gnus-kill-or-deaden-summary kill-buffer))
2681 ;; Return nil from this function.
2683 ;; Hide conversation thread subtrees. We cannot do this in
2684 ;; gnus-summary-prepare-hook since kill processing may not
2685 ;; work with hidden articles.
2686 (and gnus-show-threads
2687 gnus-thread-hide-subtree
2688 (gnus-summary-hide-all-threads))
2689 ;; Show first unread article if requested.
2690 (if (and (not no-article)
2692 gnus-newsgroup-unreads
2693 gnus-auto-select-first)
2694 (unless (if (eq gnus-auto-select-first 'best)
2695 (gnus-summary-best-unread-article)
2696 (gnus-summary-first-unread-article))
2697 (gnus-configure-windows 'summary))
2698 ;; Don't select any articles, just move point to the first
2699 ;; article in the group.
2700 (goto-char (point-min))
2701 (gnus-summary-position-point)
2702 (gnus-set-mode-line 'summary)
2703 (gnus-configure-windows 'summary 'force))
2705 (gnus-kill-or-deaden-summary kill-buffer))
2706 (when (get-buffer-window gnus-group-buffer t)
2707 ;; Gotta use windows, because recenter does weird stuff if
2708 ;; the current buffer ain't the displayed window.
2709 (let ((owin (selected-window)))
2710 (select-window (get-buffer-window gnus-group-buffer t))
2711 (when (gnus-group-goto-group group)
2713 (select-window owin)))
2714 ;; Mark this buffer as "prepared".
2715 (setq gnus-newsgroup-prepared t)
2718 (defun gnus-summary-prepare ()
2719 "Generate the summary buffer."
2721 (let ((buffer-read-only nil))
2723 (setq gnus-newsgroup-data nil
2724 gnus-newsgroup-data-reverse nil)
2725 (run-hooks 'gnus-summary-generate-hook)
2726 ;; Generate the buffer, either with threads or without.
2727 (when gnus-newsgroup-headers
2728 (gnus-summary-prepare-threads
2729 (if gnus-show-threads
2730 (gnus-sort-gathered-threads
2731 (funcall gnus-summary-thread-gathering-function
2733 (gnus-cut-threads (gnus-make-threads)))))
2734 ;; Unthreaded display.
2735 (gnus-sort-articles gnus-newsgroup-headers))))
2736 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2737 ;; Call hooks for modifying summary buffer.
2738 (goto-char (point-min))
2739 (run-hooks 'gnus-summary-prepare-hook)))
2741 (defsubst gnus-general-simplify-subject (subject)
2742 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2745 ;; Truncate the subject.
2746 (gnus-simplify-subject-functions
2747 (gnus-map-function gnus-simplify-subject-functions subject))
2748 ((numberp gnus-summary-gather-subject-limit)
2749 (setq subject (gnus-simplify-subject-re subject))
2750 (if (> (length subject) gnus-summary-gather-subject-limit)
2751 (substring subject 0 gnus-summary-gather-subject-limit)
2753 ;; Fuzzily simplify it.
2754 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2755 (gnus-simplify-subject-fuzzy subject))
2756 ;; Just remove the leading "Re:".
2758 (gnus-simplify-subject-re subject))))
2760 (if (and gnus-summary-gather-exclude-subject
2761 (string-match gnus-summary-gather-exclude-subject subject))
2762 nil ; This article shouldn't be gathered
2765 (defun gnus-summary-simplify-subject-query ()
2766 "Query where the respool algorithm would put this article."
2768 (gnus-set-global-variables)
2769 (gnus-summary-select-article)
2770 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2772 (defun gnus-gather-threads-by-subject (threads)
2773 "Gather threads by looking at Subject headers."
2774 (if (not gnus-summary-make-false-root)
2776 (let ((hashtb (gnus-make-hashtable 1024))
2779 subject hthread whole-subject)
2781 (setq subject (gnus-general-simplify-subject
2782 (setq whole-subject (mail-header-subject
2785 (if (setq hthread (gnus-gethash subject hashtb))
2787 ;; We enter a dummy root into the thread, if we
2788 ;; haven't done that already.
2789 (unless (stringp (caar hthread))
2790 (setcar hthread (list whole-subject (car hthread))))
2791 ;; We add this new gathered thread to this gathered
2793 (setcdr (car hthread)
2794 (nconc (cdar hthread) (list (car threads))))
2795 ;; Remove it from the list of threads.
2796 (setcdr prev (cdr threads))
2797 (setq threads prev))
2798 ;; Enter this thread into the hash table.
2799 (gnus-sethash subject threads hashtb)))
2801 (setq threads (cdr threads)))
2804 (defun gnus-gather-threads-by-references (threads)
2805 "Gather threads by looking at References headers."
2806 (let ((idhashtb (gnus-make-hashtable 1024))
2807 (thhashtb (gnus-make-hashtable 1024))
2810 ids references id gthread gid entered ref)
2812 (when (setq references (mail-header-references (caar threads)))
2813 (setq id (mail-header-id (caar threads))
2814 ids (gnus-split-references references)
2816 (while (setq ref (pop ids))
2817 (setq ids (delete ref ids))
2818 (if (not (setq gid (gnus-gethash ref idhashtb)))
2820 (gnus-sethash ref id idhashtb)
2821 (gnus-sethash id threads thhashtb))
2822 (setq gthread (gnus-gethash gid thhashtb))
2824 ;; We enter a dummy root into the thread, if we
2825 ;; haven't done that already.
2826 (unless (stringp (caar gthread))
2827 (setcar gthread (list (mail-header-subject (caar gthread))
2829 ;; We add this new gathered thread to this gathered
2831 (setcdr (car gthread)
2832 (nconc (cdar gthread) (list (car threads)))))
2833 ;; Add it into the thread hash table.
2834 (gnus-sethash id gthread thhashtb)
2836 ;; Remove it from the list of threads.
2837 (setcdr prev (cdr threads))
2838 (setq threads prev))))
2840 (setq threads (cdr threads)))
2843 (defun gnus-sort-gathered-threads (threads)
2844 "Sort subtreads inside each gathered thread by article number."
2845 (let ((result threads))
2847 (when (stringp (caar threads))
2848 (setcdr (car threads)
2849 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2850 (setq threads (cdr threads)))
2853 (defun gnus-thread-loop-p (root thread)
2854 "Say whether ROOT is in THREAD."
2855 (let ((stack (list thread))
2858 (while (setq thread (pop stack))
2859 (setq th (cdr thread))
2861 (not (eq (caar th) root)))
2864 ;; We have found a loop.
2866 (setcdr thread (delq (car th) (cdr thread)))
2867 (if (boundp (setq ref-dep (intern "none"
2868 gnus-newsgroup-dependencies)))
2869 (setcdr (symbol-value ref-dep)
2870 (nconc (cdr (symbol-value ref-dep))
2872 (set ref-dep (list nil (car th))))
2875 ;; Push all the subthreads onto the stack.
2876 (push (cdr thread) stack)))
2879 (defun gnus-make-threads ()
2880 "Go through the dependency hashtb and find the roots. Return all threads."
2882 (while (catch 'infloop
2885 ;; Deal with self-referencing References loops.
2886 (when (and (car (symbol-value refs))
2893 (car (symbol-value refs)) thread))
2894 (cdr (symbol-value refs)))))))
2897 (unless (car (symbol-value refs))
2898 ;; These threads do not refer back to any other articles,
2899 ;; so they're roots.
2900 (setq threads (append (cdr (symbol-value refs)) threads))))
2901 gnus-newsgroup-dependencies)))
2904 (defun gnus-build-sparse-threads ()
2905 (let ((headers gnus-newsgroup-headers)
2906 (deps gnus-newsgroup-dependencies)
2907 header references generation relations
2908 cthread subject child end pthread relation new-child)
2909 ;; First we create an alist of generations/relations, where
2910 ;; generations is how much we trust the relation, and the relation
2912 (gnus-message 7 "Making sparse threads...")
2914 (nnheader-set-temp-buffer " *gnus sparse threads*")
2915 (while (setq header (pop headers))
2916 (when (and (setq references (mail-header-references header))
2917 (not (string= references "")))
2919 (setq child (mail-header-id header)
2920 subject (mail-header-subject header))
2922 (while (search-backward ">" nil t)
2923 (setq end (1+ (point)))
2924 (when (search-backward "<" nil t)
2925 (unless (string= (setq new-child (buffer-substring (point) end))
2927 (push (list (incf generation)
2928 child (setq child new-child)
2931 (push (list (1+ generation) child nil subject) relations)
2933 (kill-buffer (current-buffer)))
2934 ;; Sort over trustworthiness.
2935 (setq relations (sort relations 'car-less-than-car))
2936 (while (setq relation (pop relations))
2937 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2938 (unless (car (symbol-value cthread))
2939 ;; Make this article the parent of these threads.
2940 (setcar (symbol-value cthread)
2941 (vector gnus-reffed-article-number
2945 (or (caddr relation) "") 0 0 "")))
2946 (set cthread (list (vector gnus-reffed-article-number
2948 "" "" (cadr relation)
2949 (or (caddr relation) "") 0 0 ""))))
2950 (push gnus-reffed-article-number gnus-newsgroup-limit)
2951 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2952 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2953 gnus-newsgroup-reads)
2954 (decf gnus-reffed-article-number)
2955 ;; Make this new thread the child of its parent.
2956 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2957 (setcdr (symbol-value pthread)
2958 (nconc (cdr (symbol-value pthread))
2959 (list (symbol-value cthread))))
2960 (set pthread (list nil (symbol-value cthread))))))
2961 (gnus-message 7 "Making sparse threads...done")))
2963 (defun gnus-build-old-threads ()
2964 ;; Look at all the articles that refer back to old articles, and
2965 ;; fetch the headers for the articles that aren't there. This will
2966 ;; build complete threads - if the roots haven't been expired by the
2971 (when (not (car (symbol-value refs)))
2972 (setq heads (cdr (symbol-value refs)))
2974 (if (memq (mail-header-number (caar heads))
2975 gnus-newsgroup-dormant)
2976 (setq heads (cdr heads))
2977 (setq id (symbol-name refs))
2978 (while (and (setq id (gnus-build-get-header id))
2979 (not (car (gnus-gethash
2980 id gnus-newsgroup-dependencies)))))
2981 (setq heads nil)))))
2982 gnus-newsgroup-dependencies)))
2984 (defun gnus-build-get-header (id)
2985 ;; Look through the buffer of NOV lines and find the header to
2986 ;; ID. Enter this line into the dependencies hash table, and return
2987 ;; the id of the parent article (if any).
2988 (let ((deps gnus-newsgroup-dependencies)
2992 (set-buffer nntp-server-buffer)
2993 (let ((case-fold-search nil))
2994 (goto-char (point-min))
2995 (while (and (not found)
2996 (search-forward id nil t))
2998 (setq found (looking-at
2999 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3000 (regexp-quote id))))
3001 (or found (beginning-of-line 2)))
3005 (setq header (gnus-nov-parse-line
3006 (read (current-buffer)) deps))
3007 (gnus-parent-id (mail-header-references header))))))
3009 (let ((number (mail-header-number header)))
3010 (push number gnus-newsgroup-limit)
3011 (push header gnus-newsgroup-headers)
3012 (if (memq number gnus-newsgroup-unselected)
3014 (push number gnus-newsgroup-unreads)
3015 (setq gnus-newsgroup-unselected
3016 (delq number gnus-newsgroup-unselected)))
3017 (push number gnus-newsgroup-ancient)))))))
3019 (defun gnus-build-all-threads ()
3020 "Read all the headers."
3021 (let ((deps gnus-newsgroup-dependencies)
3022 (gnus-summary-ignore-duplicates t)
3023 found header article)
3025 (set-buffer nntp-server-buffer)
3026 (let ((case-fold-search nil))
3027 (goto-char (point-min))
3030 (setq article (read (current-buffer)))
3031 (setq header (gnus-nov-parse-line article deps)))
3033 (push header gnus-newsgroup-headers)
3034 (if (memq (setq article (mail-header-number header))
3035 gnus-newsgroup-unselected)
3037 (push article gnus-newsgroup-unreads)
3038 (setq gnus-newsgroup-unselected
3039 (delq article gnus-newsgroup-unselected)))
3040 (push article gnus-newsgroup-ancient))
3041 (forward-line 1)))))))
3043 (defun gnus-summary-update-article-line (article header)
3044 "Update the line for ARTICLE using HEADERS."
3045 (let* ((id (mail-header-id header))
3046 (thread (gnus-id-to-thread id)))
3048 (error "Article in no thread"))
3049 ;; Update the thread.
3050 (setcar thread header)
3051 (gnus-summary-goto-subject article)
3052 (let* ((datal (gnus-data-find-list article))
3054 (length (when (cdr datal)
3055 (- (gnus-data-pos data)
3056 (gnus-data-pos (cadr datal)))))
3057 (buffer-read-only nil)
3058 (level (gnus-summary-thread-level)))
3060 (gnus-summary-insert-line
3061 header level nil (gnus-article-mark article)
3062 (memq article gnus-newsgroup-replied)
3063 (memq article gnus-newsgroup-expirable)
3064 ;; Only insert the Subject string when it's different
3065 ;; from the previous Subject string.
3066 (if (gnus-subject-equal
3068 (mail-header-subject
3071 (gnus-data-find-list
3073 (gnus-data-list t)))))
3074 ;; Error on the side of excessive subjects.
3076 (mail-header-subject header))
3078 (mail-header-subject header))
3079 nil (cdr (assq article gnus-newsgroup-scored))
3080 (memq article gnus-newsgroup-processable))
3082 (gnus-data-update-list
3083 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3085 (defun gnus-summary-update-article (article &optional iheader)
3086 "Update ARTICLE in the summary buffer."
3087 (set-buffer gnus-summary-buffer)
3088 (let* ((header (or iheader (gnus-summary-article-header article)))
3089 (id (mail-header-id header))
3090 (data (gnus-data-find article))
3091 (thread (gnus-id-to-thread id))
3092 (references (mail-header-references header))
3096 (when (and references
3097 (not (equal "" references)))
3100 (buffer-read-only nil)
3102 (number (mail-header-number header))
3105 ;; !!! Should this be in or not?
3107 (setcar thread nil))
3109 (delq thread parent))
3110 (if (gnus-summary-insert-subject id header iheader)
3111 ;; Set the (possibly) new article number in the data structure.
3112 (gnus-data-set-number data (gnus-id-to-article id))
3116 (defun gnus-rebuild-thread (id)
3117 "Rebuild the thread containing ID."
3118 (let ((buffer-read-only nil)
3119 old-pos current thread data)
3120 (if (not gnus-show-threads)
3121 (setq thread (list (car (gnus-id-to-thread id))))
3122 ;; Get the thread this article is part of.
3123 (setq thread (gnus-remove-thread id)))
3124 (setq old-pos (gnus-point-at-bol))
3125 (setq current (save-excursion
3126 (and (zerop (forward-line -1))
3127 (gnus-summary-article-number))))
3128 ;; If this is a gathered thread, we have to go some re-gathering.
3129 (when (stringp (car thread))
3130 (let ((subject (car thread))
3132 (setq thread (cdr thread))
3134 (unless (memq (setq thr (gnus-id-to-thread
3136 (mail-header-id (caar thread)))))
3139 (setq thread (cdr thread)))
3140 ;; We now have all (unique) roots.
3141 (if (= (length roots) 1)
3142 ;; All the loose roots are now one solid root.
3143 (setq thread (car roots))
3144 (setq thread (cons subject (gnus-sort-threads roots))))))
3146 ;; We then insert this thread into the summary buffer.
3147 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3148 (if gnus-show-threads
3149 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3150 (gnus-summary-prepare-unthreaded thread))
3151 (setq data (nreverse gnus-newsgroup-data))
3152 (setq threads gnus-newsgroup-threads))
3153 ;; We splice the new data into the data structure.
3154 (gnus-data-enter-list current data (- (point) old-pos))
3155 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3157 (defun gnus-number-to-header (number)
3158 "Return the header for article NUMBER."
3159 (let ((headers gnus-newsgroup-headers))
3161 (not (= number (mail-header-number (car headers)))))
3166 (defun gnus-parent-headers (headers &optional generation)
3167 "Return the headers of the GENERATIONeth parent of HEADERS."
3169 (setq generation 1))
3172 (while (and parent headers (not (zerop generation)))
3173 (setq references (mail-header-references headers))
3174 (when (and references
3175 (setq parent (gnus-parent-id references))
3176 (setq headers (car (gnus-id-to-thread parent))))
3180 (defun gnus-id-to-thread (id)
3181 "Return the (sub-)thread where ID appears."
3182 (gnus-gethash id gnus-newsgroup-dependencies))
3184 (defun gnus-id-to-article (id)
3185 "Return the article number of ID."
3186 (let ((thread (gnus-id-to-thread id)))
3189 (mail-header-number (car thread)))))
3191 (defun gnus-id-to-header (id)
3192 "Return the article headers of ID."
3193 (car (gnus-id-to-thread id)))
3195 (defun gnus-article-displayed-root-p (article)
3196 "Say whether ARTICLE is a root(ish) article."
3197 (let ((level (gnus-summary-thread-level article))
3198 (refs (mail-header-references (gnus-summary-article-header article)))
3204 ((null (gnus-parent-id refs)) t)
3206 (null (setq particle (gnus-id-to-article
3207 (gnus-parent-id refs))))
3208 (null (gnus-summary-thread-level particle)))))))
3210 (defun gnus-root-id (id)
3211 "Return the id of the root of the thread where ID appears."
3213 (while (and id (setq prev (car (gnus-gethash
3214 id gnus-newsgroup-dependencies))))
3216 id (gnus-parent-id (mail-header-references prev))))
3219 (defun gnus-articles-in-thread (thread)
3220 "Return the list of articles in THREAD."
3221 (cons (mail-header-number (car thread))
3222 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3224 (defun gnus-remove-thread (id &optional dont-remove)
3225 "Remove the thread that has ID in it."
3226 (let ((dep gnus-newsgroup-dependencies)
3227 headers thread last-id)
3228 ;; First go up in this thread until we find the root.
3229 (setq last-id (gnus-root-id id))
3230 (setq headers (list (car (gnus-id-to-thread last-id))
3231 (caadr (gnus-id-to-thread last-id))))
3232 ;; We have now found the real root of this thread. It might have
3233 ;; been gathered into some loose thread, so we have to search
3234 ;; through the threads to find the thread we wanted.
3235 (let ((threads gnus-newsgroup-threads)
3238 (setq sub (car threads))
3239 (if (stringp (car sub))
3240 ;; This is a gathered thread, so we look at the roots
3241 ;; below it to find whether this article is in this
3244 (setq sub (cdr sub))
3246 (when (member (caar sub) headers)
3247 (setq thread (car threads)
3250 (setq sub (cdr sub))))
3251 ;; It's an ordinary thread, so we check it.
3252 (when (eq (car sub) (car headers))
3255 (setq threads (cdr threads)))
3256 ;; If this article is in no thread, then it's a root.
3259 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3260 (setq thread (gnus-gethash last-id dep)))
3263 thread ; We return this thread.
3265 (if (stringp (car thread))
3267 ;; If we use dummy roots, then we have to remove the
3268 ;; dummy root as well.
3269 (when (eq gnus-summary-make-false-root 'dummy)
3271 (gnus-data-compute-positions))
3272 (setq thread (cdr thread))
3274 (gnus-remove-thread-1 (car thread))
3275 (setq thread (cdr thread))))
3276 (gnus-remove-thread-1 thread))))))))
3278 (defun gnus-remove-thread-1 (thread)
3279 "Remove the thread THREAD recursively."
3280 (let ((number (mail-header-number (pop thread)))
3282 (setq thread (reverse thread))
3284 (gnus-remove-thread-1 (pop thread)))
3285 (when (setq d (gnus-data-find number))
3286 (goto-char (gnus-data-pos d))
3289 (- (gnus-point-at-bol)
3291 (1+ (gnus-point-at-eol))
3292 (gnus-delete-line)))))))
3294 (defun gnus-sort-threads (threads)
3296 (if (not gnus-thread-sort-functions)
3298 (gnus-message 7 "Sorting threads...")
3300 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3301 (gnus-message 7 "Sorting threads...done"))))
3303 (defun gnus-sort-articles (articles)
3305 (when gnus-article-sort-functions
3306 (gnus-message 7 "Sorting articles...")
3308 (setq gnus-newsgroup-headers
3309 (sort articles (gnus-make-sort-function
3310 gnus-article-sort-functions)))
3311 (gnus-message 7 "Sorting articles...done"))))
3313 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3314 (defmacro gnus-thread-header (thread)
3315 ;; Return header of first article in THREAD.
3316 ;; Note that THREAD must never, ever be anything else than a variable -
3317 ;; using some other form will lead to serious barfage.
3318 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3319 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3320 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3323 (defsubst gnus-article-sort-by-number (h1 h2)
3324 "Sort articles by article number."
3325 (< (mail-header-number h1)
3326 (mail-header-number h2)))
3328 (defun gnus-thread-sort-by-number (h1 h2)
3329 "Sort threads by root article number."
3330 (gnus-article-sort-by-number
3331 (gnus-thread-header h1) (gnus-thread-header h2)))
3333 (defsubst gnus-article-sort-by-lines (h1 h2)
3334 "Sort articles by article Lines header."
3335 (< (mail-header-lines h1)
3336 (mail-header-lines h2)))
3338 (defun gnus-thread-sort-by-lines (h1 h2)
3339 "Sort threads by root article Lines header."
3340 (gnus-article-sort-by-lines
3341 (gnus-thread-header h1) (gnus-thread-header h2)))
3343 (defsubst gnus-article-sort-by-author (h1 h2)
3344 "Sort articles by root author."
3346 (let ((extract (funcall
3347 gnus-extract-address-components
3348 (mail-header-from h1))))
3349 (or (car extract) (cadr extract) ""))
3350 (let ((extract (funcall
3351 gnus-extract-address-components
3352 (mail-header-from h2))))
3353 (or (car extract) (cadr extract) ""))))
3355 (defun gnus-thread-sort-by-author (h1 h2)
3356 "Sort threads by root author."
3357 (gnus-article-sort-by-author
3358 (gnus-thread-header h1) (gnus-thread-header h2)))
3360 (defsubst gnus-article-sort-by-subject (h1 h2)
3361 "Sort articles by root subject."
3363 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3364 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3366 (defun gnus-thread-sort-by-subject (h1 h2)
3367 "Sort threads by root subject."
3368 (gnus-article-sort-by-subject
3369 (gnus-thread-header h1) (gnus-thread-header h2)))
3371 (defsubst gnus-article-sort-by-date (h1 h2)
3372 "Sort articles by root article date."
3374 (gnus-date-get-time (mail-header-date h1))
3375 (gnus-date-get-time (mail-header-date h2))))
3377 (defun gnus-thread-sort-by-date (h1 h2)
3378 "Sort threads by root article date."
3379 (gnus-article-sort-by-date
3380 (gnus-thread-header h1) (gnus-thread-header h2)))
3382 (defsubst gnus-article-sort-by-score (h1 h2)
3383 "Sort articles by root article score.
3384 Unscored articles will be counted as having a score of zero."
3385 (> (or (cdr (assq (mail-header-number h1)
3386 gnus-newsgroup-scored))
3387 gnus-summary-default-score 0)
3388 (or (cdr (assq (mail-header-number h2)
3389 gnus-newsgroup-scored))
3390 gnus-summary-default-score 0)))
3392 (defun gnus-thread-sort-by-score (h1 h2)
3393 "Sort threads by root article score."
3394 (gnus-article-sort-by-score
3395 (gnus-thread-header h1) (gnus-thread-header h2)))
3397 (defun gnus-thread-sort-by-total-score (h1 h2)
3398 "Sort threads by the sum of all scores in the thread.
3399 Unscored articles will be counted as having a score of zero."
3400 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3402 (defun gnus-thread-total-score (thread)
3403 ;; This function find the total score of THREAD.
3404 (cond ((null thread)
3407 (if (stringp (car thread))
3408 (apply gnus-thread-score-function 0
3409 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3410 (gnus-thread-total-score-1 thread)))
3412 (gnus-thread-total-score-1 (list thread)))))
3414 (defun gnus-thread-total-score-1 (root)
3415 ;; This function find the total score of the thread below ROOT.
3416 (setq root (car root))
3417 (apply gnus-thread-score-function
3419 (mapcar 'gnus-thread-total-score
3420 (cdr (gnus-gethash (mail-header-id root)
3421 gnus-newsgroup-dependencies)))
3422 (when (> (mail-header-number root) 0)
3423 (list (or (cdr (assq (mail-header-number root)
3424 gnus-newsgroup-scored))
3425 gnus-summary-default-score 0))))
3426 (list gnus-summary-default-score)
3429 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3430 (defvar gnus-tmp-prev-subject nil)
3431 (defvar gnus-tmp-false-parent nil)
3432 (defvar gnus-tmp-root-expunged nil)
3433 (defvar gnus-tmp-dummy-line nil)
3435 (defun gnus-summary-prepare-threads (threads)
3436 "Prepare summary buffer from THREADS and indentation LEVEL.
3437 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3438 or a straight list of headers."
3439 (gnus-message 7 "Generating summary...")
3441 (setq gnus-newsgroup-threads threads)
3444 (let ((gnus-tmp-level 0)
3445 (default-score (or gnus-summary-default-score 0))
3446 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3447 thread number subject stack state gnus-tmp-gathered beg-match
3448 new-roots gnus-tmp-new-adopts thread-end
3449 gnus-tmp-header gnus-tmp-unread
3450 gnus-tmp-replied gnus-tmp-subject-or-nil
3451 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3452 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3453 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3455 (setq gnus-tmp-prev-subject nil)
3457 (if (vectorp (car threads))
3458 ;; If this is a straight (sic) list of headers, then a
3459 ;; threaded summary display isn't required, so we just create
3460 ;; an unthreaded one.
3461 (gnus-summary-prepare-unthreaded threads)
3463 ;; Do the threaded display.
3465 (while (or threads stack gnus-tmp-new-adopts new-roots)
3467 (if (and (= gnus-tmp-level 0)
3468 (not (setq gnus-tmp-dummy-line nil))
3471 (not gnus-tmp-false-parent)
3472 (or gnus-tmp-new-adopts new-roots))
3473 (if gnus-tmp-new-adopts
3474 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3475 thread (list (car gnus-tmp-new-adopts))
3476 gnus-tmp-header (caar thread)
3477 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3479 (setq thread (list (car new-roots))
3480 gnus-tmp-header (caar thread)
3481 new-roots (cdr new-roots))))
3484 ;; If there are some threads, we do them before the
3485 ;; threads on the stack.
3486 (setq thread threads
3487 gnus-tmp-header (caar thread))
3488 ;; There were no current threads, so we pop something off
3490 (setq state (car stack)
3491 gnus-tmp-level (car state)
3494 gnus-tmp-header (caar thread))))
3496 (setq gnus-tmp-false-parent nil)
3497 (setq gnus-tmp-root-expunged nil)
3498 (setq thread-end nil)
3500 (if (stringp gnus-tmp-header)
3501 ;; The header is a dummy root.
3503 ((eq gnus-summary-make-false-root 'adopt)
3504 ;; We let the first article adopt the rest.
3505 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3507 (setq gnus-tmp-gathered
3509 (lambda (h) (mail-header-number (car h)))
3512 (setq thread (cons (list (caar thread)
3515 (setq gnus-tmp-level -1
3516 gnus-tmp-false-parent t))
3517 ((eq gnus-summary-make-false-root 'empty)
3518 ;; We print adopted articles with empty subject fields.
3519 (setq gnus-tmp-gathered
3521 (lambda (h) (mail-header-number (car h)))
3524 (setq gnus-tmp-level -1))
3525 ((eq gnus-summary-make-false-root 'dummy)
3526 ;; We remember that we probably want to output a dummy
3528 (setq gnus-tmp-dummy-line gnus-tmp-header)
3529 (setq gnus-tmp-prev-subject gnus-tmp-header))
3531 ;; We do not make a root for the gathered
3532 ;; sub-threads at all.
3533 (setq gnus-tmp-level -1)))
3535 (setq number (mail-header-number gnus-tmp-header)
3536 subject (mail-header-subject gnus-tmp-header))
3539 ;; If the thread has changed subject, we might want to make
3540 ;; this subthread into a root.
3541 ((and (null gnus-thread-ignore-subject)
3542 (not (zerop gnus-tmp-level))
3543 gnus-tmp-prev-subject
3545 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3546 (setq new-roots (nconc new-roots (list (car thread)))
3548 gnus-tmp-header nil))
3549 ;; If the article lies outside the current limit,
3550 ;; then we do not display it.
3551 ((not (memq number gnus-newsgroup-limit))
3552 (setq gnus-tmp-gathered
3554 (lambda (h) (mail-header-number (car h)))
3557 (setq gnus-tmp-new-adopts (if (cdar thread)
3558 (append gnus-tmp-new-adopts
3560 gnus-tmp-new-adopts)
3562 gnus-tmp-header nil)
3563 (when (zerop gnus-tmp-level)
3564 (setq gnus-tmp-root-expunged t)))
3565 ;; Perhaps this article is to be marked as read?
3566 ((and gnus-summary-mark-below
3567 (< (or (cdr (assq number gnus-newsgroup-scored))
3569 gnus-summary-mark-below)
3570 ;; Don't touch sparse articles.
3571 (not (gnus-summary-article-sparse-p number))
3572 (not (gnus-summary-article-ancient-p number)))
3573 (setq gnus-newsgroup-unreads
3574 (delq number gnus-newsgroup-unreads))
3575 (if gnus-newsgroup-auto-expire
3576 (push number gnus-newsgroup-expirable)
3577 (push (cons number gnus-low-score-mark)
3578 gnus-newsgroup-reads))))
3580 (when gnus-tmp-header
3581 ;; We may have an old dummy line to output before this
3583 (when gnus-tmp-dummy-line
3584 (gnus-summary-insert-dummy-line
3585 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3586 (setq gnus-tmp-dummy-line nil))
3588 ;; Compute the mark.
3589 (setq gnus-tmp-unread (gnus-article-mark number))
3591 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3592 gnus-tmp-header gnus-tmp-level)
3593 gnus-newsgroup-data)
3595 ;; Actually insert the line.
3597 gnus-tmp-subject-or-nil
3599 ((and gnus-thread-ignore-subject
3600 gnus-tmp-prev-subject
3601 (not (inline (gnus-subject-equal
3602 gnus-tmp-prev-subject subject))))
3604 ((zerop gnus-tmp-level)
3605 (if (and (eq gnus-summary-make-false-root 'empty)
3606 (memq number gnus-tmp-gathered)
3607 gnus-tmp-prev-subject
3608 (inline (gnus-subject-equal
3609 gnus-tmp-prev-subject subject)))
3610 gnus-summary-same-subject
3612 (t gnus-summary-same-subject)))
3613 (if (and (eq gnus-summary-make-false-root 'adopt)
3614 (= gnus-tmp-level 1)
3615 (memq number gnus-tmp-gathered))
3616 (setq gnus-tmp-opening-bracket ?\<
3617 gnus-tmp-closing-bracket ?\>)
3618 (setq gnus-tmp-opening-bracket ?\[
3619 gnus-tmp-closing-bracket ?\]))
3621 gnus-tmp-indentation
3622 (aref gnus-thread-indent-array gnus-tmp-level)
3623 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3624 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3625 gnus-summary-default-score 0)
3627 (if (or (null gnus-summary-default-score)
3628 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3629 gnus-summary-zcore-fuzz))
3631 (if (< gnus-tmp-score gnus-summary-default-score)
3632 gnus-score-below-mark gnus-score-over-mark))
3634 (cond ((memq number gnus-newsgroup-processable)
3636 ((memq number gnus-newsgroup-cached)
3638 ((memq number gnus-newsgroup-replied)
3640 ((memq number gnus-newsgroup-saved)
3642 (t gnus-unread-mark))
3643 gnus-tmp-from (mail-header-from gnus-tmp-header)
3646 ((string-match "<[^>]+> *$" gnus-tmp-from)
3647 (setq beg-match (match-beginning 0))
3648 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3649 (substring gnus-tmp-from (1+ (match-beginning 0))
3650 (1- (match-end 0))))
3651 (substring gnus-tmp-from 0 beg-match)))
3652 ((string-match "(.+)" gnus-tmp-from)
3653 (substring gnus-tmp-from
3654 (1+ (match-beginning 0)) (1- (match-end 0))))
3656 (when (string= gnus-tmp-name "")
3657 (setq gnus-tmp-name gnus-tmp-from))
3658 (unless (numberp gnus-tmp-lines)
3659 (setq gnus-tmp-lines 0))
3660 (gnus-put-text-property
3662 (progn (eval gnus-summary-line-format-spec) (point))
3663 'gnus-number number)
3666 (run-hooks 'gnus-summary-update-hook)
3669 (setq gnus-tmp-prev-subject subject)))
3671 (when (nth 1 thread)
3672 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3673 (incf gnus-tmp-level)
3674 (setq threads (if thread-end nil (cdar thread)))
3676 (setq gnus-tmp-level 0)))))
3677 (gnus-message 7 "Generating summary...done"))
3679 (defun gnus-summary-prepare-unthreaded (headers)
3680 "Generate an unthreaded summary buffer based on HEADERS."
3681 (let (header number mark)
3686 ;; We may have to root out some bad articles...
3687 (when (memq (setq number (mail-header-number
3688 (setq header (pop headers))))
3689 gnus-newsgroup-limit)
3690 ;; Mark article as read when it has a low score.
3691 (when (and gnus-summary-mark-below
3692 (< (or (cdr (assq number gnus-newsgroup-scored))
3693 gnus-summary-default-score 0)
3694 gnus-summary-mark-below)
3695 (not (gnus-summary-article-ancient-p number)))
3696 (setq gnus-newsgroup-unreads
3697 (delq number gnus-newsgroup-unreads))
3698 (if gnus-newsgroup-auto-expire
3699 (push number gnus-newsgroup-expirable)
3700 (push (cons number gnus-low-score-mark)
3701 gnus-newsgroup-reads)))
3703 (setq mark (gnus-article-mark number))
3704 (push (gnus-data-make number mark (1+ (point)) header 0)
3705 gnus-newsgroup-data)
3706 (gnus-summary-insert-line
3708 mark (memq number gnus-newsgroup-replied)
3709 (memq number gnus-newsgroup-expirable)
3710 (mail-header-subject header) nil
3711 (cdr (assq number gnus-newsgroup-scored))
3712 (memq number gnus-newsgroup-processable))))))
3714 (defun gnus-select-newsgroup (group &optional read-all)
3715 "Select newsgroup GROUP.
3716 If READ-ALL is non-nil, all articles in the group are selected."
3717 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3718 ;;!!! Dirty hack; should be removed.
3719 (gnus-summary-ignore-duplicates
3720 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3722 gnus-summary-ignore-duplicates))
3723 (info (nth 2 entry))
3724 articles fetched-articles cached)
3726 (unless (gnus-check-server
3727 (setq gnus-current-select-method
3728 (gnus-find-method-for-group group)))
3729 (error "Couldn't open server"))
3731 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3732 (gnus-activate-group group) ; Or we can activate it...
3733 (progn ; Or we bug out.
3734 (when (equal major-mode 'gnus-summary-mode)
3735 (kill-buffer (current-buffer)))
3736 (error "Couldn't request group %s: %s"
3737 group (gnus-status-message group))))
3739 (unless (gnus-request-group group t)
3740 (when (equal major-mode 'gnus-summary-mode)
3741 (kill-buffer (current-buffer)))
3742 (error "Couldn't request group %s: %s"
3743 group (gnus-status-message group)))
3745 (setq gnus-newsgroup-name group)
3746 (setq gnus-newsgroup-unselected nil)
3747 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3749 ;; Adjust and set lists of article marks.
3751 (gnus-adjust-marked-articles info))
3753 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3754 (when (gnus-virtual-group-p group)
3755 (setq cached gnus-newsgroup-cached))
3757 (setq gnus-newsgroup-unreads
3758 (gnus-set-difference
3759 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3760 gnus-newsgroup-dormant))
3762 (setq gnus-newsgroup-processable nil)
3764 (gnus-update-read-articles group gnus-newsgroup-unreads)
3765 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3766 (gnus-group-update-group group))
3768 (setq articles (gnus-articles-to-read group read-all))
3772 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3774 ((eq articles 0) nil)
3776 ;; Init the dependencies hash table.
3777 (setq gnus-newsgroup-dependencies
3778 (gnus-make-hashtable (length articles)))
3779 ;; Retrieve the headers and read them in.
3780 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3781 (setq gnus-newsgroup-headers
3783 (setq gnus-headers-retrieved-by
3784 (gnus-retrieve-headers
3785 articles gnus-newsgroup-name
3786 ;; We might want to fetch old headers, but
3787 ;; not if there is only 1 article.
3788 (and gnus-fetch-old-headers
3790 (not (eq gnus-fetch-old-headers 'some))
3791 (not (numberp gnus-fetch-old-headers)))
3792 (> (length articles) 1))))))
3793 (gnus-get-newsgroup-headers-xover
3794 articles nil nil gnus-newsgroup-name t)
3795 (gnus-get-newsgroup-headers)))
3796 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3798 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3800 (setq gnus-newsgroup-cached cached))
3802 ;; Suppress duplicates?
3803 (when gnus-suppress-duplicates
3804 (gnus-dup-suppress-articles))
3806 ;; Set the initial limit.
3807 (setq gnus-newsgroup-limit (copy-sequence articles))
3808 ;; Remove canceled articles from the list of unread articles.
3809 (setq gnus-newsgroup-unreads
3810 (gnus-set-sorted-intersection
3811 gnus-newsgroup-unreads
3812 (setq fetched-articles
3813 (mapcar (lambda (headers) (mail-header-number headers))
3814 gnus-newsgroup-headers))))
3815 ;; Removed marked articles that do not exist.
3816 (gnus-update-missing-marks
3817 (gnus-sorted-complement fetched-articles articles))
3818 ;; Let the Gnus agent mark articles as read.
3820 (gnus-agent-get-undownloaded-list))
3821 ;; We might want to build some more threads first.
3822 (when (and gnus-fetch-old-headers
3823 (eq gnus-headers-retrieved-by 'nov))
3824 (if (eq gnus-fetch-old-headers 'invisible)
3825 (gnus-build-all-threads)
3826 (gnus-build-old-threads)))
3827 ;; Check whether auto-expire is to be done in this group.
3828 (setq gnus-newsgroup-auto-expire
3829 (gnus-group-auto-expirable-p group))
3830 ;; Set up the article buffer now, if necessary.
3831 (unless gnus-single-article-buffer
3832 (gnus-article-setup-buffer))
3833 ;; First and last article in this newsgroup.
3834 (when gnus-newsgroup-headers
3835 (setq gnus-newsgroup-begin
3836 (mail-header-number (car gnus-newsgroup-headers))
3839 (gnus-last-element gnus-newsgroup-headers))))
3840 ;; GROUP is successfully selected.
3841 (or gnus-newsgroup-headers t)))))
3843 (defun gnus-articles-to-read (group &optional read-all)
3844 ;; Find out what articles the user wants to read.
3846 ;; Select all articles if `read-all' is non-nil, or if there
3847 ;; are no unread articles.
3849 (and (zerop (length gnus-newsgroup-marked))
3850 (zerop (length gnus-newsgroup-unreads)))
3851 (eq (gnus-group-find-parameter group 'display)
3853 (gnus-uncompress-range (gnus-active group))
3854 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3855 (copy-sequence gnus-newsgroup-unreads))
3857 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3858 (scored (length scored-list))
3859 (number (length articles))
3860 (marked (+ (length gnus-newsgroup-marked)
3861 (length gnus-newsgroup-dormant)))
3869 ((and (or (<= scored marked) (= scored number))
3870 (numberp gnus-large-newsgroup)
3871 (> number gnus-large-newsgroup))
3875 "How many articles from %s (default %d): "
3876 (gnus-limit-string gnus-newsgroup-name 35)
3878 (if (string-match "^[ \t]*$" input) number input)))
3879 ((and (> scored marked) (< scored number)
3880 (> (- scored number) 20))
3883 (format "%s %s (%d scored, %d total): "
3884 "How many articles from"
3885 group scored number))))
3886 (if (string-match "^[ \t]*$" input)
3890 (setq select (if (stringp select) (string-to-number select) select))
3891 (if (or (null select) (zerop select))
3893 (if (and (not (zerop scored)) (<= (abs select) scored))
3895 (setq articles (sort scored-list '<))
3896 (setq number (length articles)))
3897 (setq articles (copy-sequence articles)))
3899 (when (< (abs select) number)
3901 ;; Select the N oldest articles.
3902 (setcdr (nthcdr (1- (abs select)) articles) nil)
3903 ;; Select the N most recent articles.
3904 (setq articles (nthcdr (- number select) articles))))
3905 (setq gnus-newsgroup-unselected
3906 (gnus-sorted-intersection
3907 gnus-newsgroup-unreads
3908 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3911 (defun gnus-killed-articles (killed articles)
3914 (when (inline (gnus-member-of-range (car articles) killed))
3915 (push (car articles) out))
3916 (setq articles (cdr articles)))
3919 (defun gnus-uncompress-marks (marks)
3920 "Uncompress the mark ranges in MARKS."
3921 (let ((uncompressed '(score bookmark))
3924 (if (memq (caar marks) uncompressed)
3925 (push (car marks) out)
3926 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3927 (setq marks (cdr marks)))
3930 (defun gnus-adjust-marked-articles (info)
3931 "Set all article lists and remove all marks that are no longer legal."
3932 (let* ((marked-lists (gnus-info-marks info))
3933 (active (gnus-active (gnus-info-group info)))
3936 (types gnus-article-mark-lists)
3937 (uncompressed '(score bookmark killed))
3938 marks var articles article mark)
3941 (setq marks (pop marked-lists))
3942 (set (setq var (intern (format "gnus-newsgroup-%s"
3943 (car (rassq (setq mark (car marks))
3945 (if (memq (car marks) uncompressed) (cdr marks)
3946 (gnus-uncompress-range (cdr marks))))
3948 (setq articles (symbol-value var))
3950 ;; All articles have to be subsets of the active articles.
3952 ;; Adjust "simple" lists.
3953 ((memq mark '(tick dormant expire reply save))
3955 (when (or (< (setq article (pop articles)) min) (> article max))
3956 (set var (delq article (symbol-value var))))))
3958 ((memq mark uncompressed)
3959 (when (not (listp (cdr (symbol-value var))))
3960 (set var (list (symbol-value var))))
3961 (when (not (listp (cdr articles)))
3962 (setq articles (list articles)))
3964 (when (or (not (consp (setq article (pop articles))))
3965 (< (car article) min)
3966 (> (car article) max))
3967 (set var (delq article (symbol-value var))))))))))
3969 (defun gnus-update-missing-marks (missing)
3970 "Go through the list of MISSING articles and remove them mark lists."
3972 (let ((types gnus-article-mark-lists)
3974 ;; Go through all types.
3976 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3977 (when (symbol-value var)
3978 ;; This list has articles. So we delete all missing articles
3982 (set var (delq (pop m) (symbol-value var)))))))))
3984 (defun gnus-update-marks ()
3985 "Enter the various lists of marked articles into the newsgroup info list."
3986 (let ((types gnus-article-mark-lists)
3987 (info (gnus-get-info gnus-newsgroup-name))
3988 (uncompressed '(score bookmark killed))
3989 type list newmarked symbol)
3991 ;; Add all marks lists that are non-nil to the list of marks lists.
3992 (while (setq type (pop types))
3993 (when (setq list (symbol-value
3995 (intern (format "gnus-newsgroup-%s"
3998 ;; Get rid of the entries of the articles that have the
4000 (when (and (eq (cdr type) 'score)
4004 (prev (cons nil list))
4007 (if (or (not (consp (car arts)))
4008 (= (cdar arts) gnus-summary-default-score))
4009 (setcdr prev (cdr arts))
4011 (setq arts (cdr arts)))
4012 (setq list (cdr all))))
4014 (push (cons (cdr type)
4015 (if (memq (cdr type) uncompressed) list
4016 (gnus-compress-sequence
4017 (set symbol (sort list '<)) t)))
4020 ;; Enter these new marks into the info of the group.
4022 (setcar (nthcdr 3 info) newmarked)
4023 ;; Add the marks lists to the end of the info.
4025 (setcdr (nthcdr 2 info) (list newmarked))))
4027 ;; Cut off the end of the info if there's nothing else there.
4031 (when (nthcdr (decf i) info)
4032 (setcdr (nthcdr i info) nil)))))))
4034 (defun gnus-set-mode-line (where)
4035 "This function sets the mode line of the article or summary buffers.
4036 If WHERE is `summary', the summary mode line format will be used."
4037 ;; Is this mode line one we keep updated?
4038 (when (memq where gnus-updated-mode-lines)
4041 ;; We evaluate this in the summary buffer since these
4042 ;; variables are buffer-local to that buffer.
4043 (set-buffer gnus-summary-buffer)
4044 ;; We bind all these variables that are used in the `eval' form
4046 (let* ((mformat (symbol-value
4048 (format "gnus-%s-mode-line-format-spec" where))))
4049 (gnus-tmp-group-name gnus-newsgroup-name)
4050 (gnus-tmp-article-number (or gnus-current-article 0))
4051 (gnus-tmp-unread gnus-newsgroup-unreads)
4052 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4053 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4054 (gnus-tmp-unread-and-unselected
4055 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4056 (zerop gnus-tmp-unselected))
4058 ((zerop gnus-tmp-unselected)
4059 (format "{%d more}" gnus-tmp-unread-and-unticked))
4060 (t (format "{%d(+%d) more}"
4061 gnus-tmp-unread-and-unticked
4062 gnus-tmp-unselected))))
4064 (if (and gnus-current-headers
4065 (vectorp gnus-current-headers))
4066 (gnus-mode-string-quote
4067 (mail-header-subject gnus-current-headers))
4069 bufname-length max-len
4070 gnus-tmp-header);; passed as argument to any user-format-funcs
4071 (setq mode-string (eval mformat))
4072 (setq bufname-length (if (string-match "%b" mode-string)
4075 (if (eq where 'summary)
4077 (get-buffer gnus-article-buffer))))
4080 (setq max-len (max 4 (if gnus-mode-non-string-length
4082 gnus-mode-non-string-length
4084 (length mode-string))))
4085 ;; We might have to chop a bit of the string off...
4086 (when (> (length mode-string) max-len)
4088 (concat (gnus-truncate-string mode-string (- max-len 3))
4090 ;; Pad the mode string a bit.
4091 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4092 ;; Update the mode line.
4093 (setq mode-line-buffer-identification
4094 (gnus-mode-line-buffer-identification (list mode-string)))
4095 (set-buffer-modified-p t))))
4097 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4098 "Go through the HEADERS list and add all Xrefs to a hash table.
4099 The resulting hash table is returned, or nil if no Xrefs were found."
4100 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4101 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4102 (xref-hashtb (gnus-make-hashtable))
4103 start group entry number xrefs header)
4105 (setq header (pop headers))
4106 (when (and (setq xrefs (mail-header-xref header))
4107 (not (memq (setq number (mail-header-number header))
4110 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4111 (setq start (match-end 0))
4112 (setq group (if prefix
4113 (concat prefix (substring xrefs (match-beginning 1)
4115 (substring xrefs (match-beginning 1) (match-end 1))))
4117 (string-to-int (substring xrefs (match-beginning 2)
4119 (if (setq entry (gnus-gethash group xref-hashtb))
4120 (setcdr entry (cons number (cdr entry)))
4121 (gnus-sethash group (cons number nil) xref-hashtb)))))
4122 (and start xref-hashtb)))
4124 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4125 "Look through all the headers and mark the Xrefs as read."
4126 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4127 name entry info xref-hashtb idlist method nth4)
4129 (set-buffer gnus-group-buffer)
4130 (when (setq xref-hashtb
4131 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4134 (unless (string= from-newsgroup (setq name (symbol-name group)))
4135 (setq idlist (symbol-value group))
4136 ;; Dead groups are not updated.
4138 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4140 (when (stringp (setq nth4 (gnus-info-method info)))
4141 (setq nth4 (gnus-server-to-method nth4))))
4142 ;; Only do the xrefs if the group has the same
4143 ;; select method as the group we have just read.
4144 (or (gnus-methods-equal-p
4145 nth4 (gnus-find-method-for-group from-newsgroup))
4147 (equal nth4 (setq method (gnus-find-method-for-group
4149 (and (equal (car nth4) (car method))
4150 (equal (nth 1 nth4) (nth 1 method))))
4151 gnus-use-cross-reference
4152 (or (not (eq gnus-use-cross-reference t))
4154 ;; Only do cross-references on subscribed
4155 ;; groups, if that is what is wanted.
4156 (<= (gnus-info-level info) gnus-level-subscribed))
4157 (gnus-group-make-articles-read name idlist))))
4160 (defun gnus-compute-read-articles (group articles)
4161 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4162 (info (nth 2 entry))
4163 (active (gnus-active group))
4166 ;; First peel off all illegal article numbers.
4168 (let ((ids articles)
4170 (while (setq id (pop ids))
4171 (when (and first (> id (cdr active)))
4172 ;; We'll end up in this situation in one particular
4173 ;; obscure situation. If you re-scan a group and get
4174 ;; a new article that is cross-posted to a different
4175 ;; group that has not been re-scanned, you might get
4176 ;; crossposted article that has a higher number than
4177 ;; Gnus believes possible. So we re-activate this
4178 ;; group as well. This might mean doing the
4179 ;; crossposting thingy will *increase* the number
4180 ;; of articles in some groups. Tsk, tsk.
4181 (setq active (or (gnus-activate-group group) active)))
4182 (when (or (> id (cdr active))
4183 (< id (car active)))
4184 (setq articles (delq id articles))))))
4185 ;; If the read list is nil, we init it.
4187 (null (gnus-info-read info))
4189 (setq ninfo (cons 1 (1- (car active))))
4190 (setq ninfo (gnus-info-read info)))
4191 ;; Then we add the read articles to the range.
4193 ninfo (setq articles (sort articles '<))))))
4195 (defun gnus-group-make-articles-read (group articles)
4196 "Update the info of GROUP to say that ARTICLES are read."
4198 (entry (gnus-gethash group gnus-newsrc-hashtb))
4199 (info (nth 2 entry))
4200 (active (gnus-active group))
4203 (setq range (gnus-compute-read-articles group articles))
4205 (set-buffer gnus-group-buffer)
4208 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4209 (gnus-info-set-read ',info ',(gnus-info-read info))
4210 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4211 (gnus-group-update-group ,group t))))
4212 ;; Add the read articles to the range.
4213 (gnus-info-set-read info range)
4214 ;; Then we have to re-compute how many unread
4215 ;; articles there are in this group.
4219 (setq num (- (1+ (cdr active)) (car active))))
4220 ((not (listp (cdr range)))
4221 (setq num (- (cdr active) (- (1+ (cdr range))
4225 (if (numberp (car range))
4227 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4228 (setq range (cdr range)))
4229 (setq num (- (cdr active) num))))
4230 ;; Update the number of unread articles.
4232 ;; Update the group buffer.
4233 (gnus-group-update-group group t)))))
4235 (defun gnus-methods-equal-p (m1 m2)
4236 (let ((m1 (or m1 gnus-select-method))
4237 (m2 (or m2 gnus-select-method)))
4239 (and (eq (car m1) (car m2))
4240 (or (not (memq 'address (assoc (symbol-name (car m1))
4241 gnus-valid-select-methods)))
4242 (equal (nth 1 m1) (nth 1 m2)))))))
4244 (defvar gnus-newsgroup-none-id 0)
4246 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4247 (let ((cur nntp-server-buffer)
4250 (save-excursion (set-buffer gnus-summary-buffer)
4251 gnus-newsgroup-dependencies)))
4252 headers id id-dep ref-dep end ref)
4254 (set-buffer nntp-server-buffer)
4255 ;; Translate all TAB characters into SPACE characters.
4256 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4257 (run-hooks 'gnus-parse-headers-hook)
4258 (let ((case-fold-search t)
4259 in-reply-to header p lines)
4260 (goto-char (point-min))
4261 ;; Search to the beginning of the next header. Error messages
4262 ;; do not begin with 2 or 3.
4263 (while (re-search-forward "^[23][0-9]+ " nil t)
4266 ;; This implementation of this function, with nine
4267 ;; search-forwards instead of the one re-search-forward and
4268 ;; a case (which basically was the old function) is actually
4269 ;; about twice as fast, even though it looks messier. You
4270 ;; can't have everything, I guess. Speed and elegance
4271 ;; doesn't always go hand in hand.
4280 (narrow-to-region (point)
4281 (or (and (search-forward "\n.\n" nil t)
4287 (if (search-forward "\nsubject: " nil t)
4288 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4290 gnus-unstructured-field-decoder (nnheader-header-value))
4295 (if (search-forward "\nfrom: " nil t)
4296 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4298 gnus-structured-field-decoder (nnheader-header-value))
4303 (if (search-forward "\ndate: " nil t)
4304 (nnheader-header-value) ""))
4308 (setq id (if (search-forward "\nmessage-id:" nil t)
4310 (1- (or (search-forward "<" nil t) (point)))
4311 (or (search-forward ">" nil t) (point)))
4312 ;; If there was no message-id, we just fake one
4313 ;; to make subsequent routines simpler.
4314 (nnheader-generate-fake-message-id))))
4318 (if (search-forward "\nreferences: " nil t)
4322 (nnheader-header-value)
4327 (search-backward ">" end t)
4330 (search-backward "<" end t)
4332 ;; Get the references from the in-reply-to header if there
4333 ;; were no references and the in-reply-to header looks
4335 (if (and (search-forward "\nin-reply-to: " nil t)
4336 (setq in-reply-to (nnheader-header-value))
4337 (string-match "<[^>]+>" in-reply-to))
4338 (setq ref (substring in-reply-to (match-beginning 0)
4346 (if (search-forward "\nlines: " nil t)
4347 (if (numberp (setq lines (ignore-errors (read cur))))
4353 (and (search-forward "\nxref: " nil t)
4354 (nnheader-header-value)))))
4355 (when (equal id ref)
4358 (when gnus-alter-header-function
4359 (funcall gnus-alter-header-function header)
4360 (setq id (mail-header-id header)
4361 ref (gnus-parent-id (mail-header-references header))))
4363 ;; We do the threading while we read the headers. The
4364 ;; message-id and the last reference are both entered into
4365 ;; the same hash table. Some tippy-toeing around has to be
4366 ;; done in case an article has arrived before the article
4367 ;; which it refers to.
4368 (if (boundp (setq id-dep (intern id dependencies)))
4369 (if (and (car (symbol-value id-dep))
4371 ;; An article with this Message-ID has already been seen.
4372 (if gnus-summary-ignore-duplicates
4373 ;; We ignore this one, except we add
4374 ;; any additional Xrefs (in case the two articles
4375 ;; came from different servers).
4377 (mail-header-set-xref
4378 (car (symbol-value id-dep))
4379 (concat (or (mail-header-xref
4380 (car (symbol-value id-dep)))
4382 (or (mail-header-xref header) "")))
4384 ;; We rename the Message-ID.
4386 (setq id-dep (intern (setq id (nnmail-message-id))
4389 (mail-header-set-id header id))
4390 (setcar (symbol-value id-dep) header))
4391 (set id-dep (list header)))
4393 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4394 (setcdr (symbol-value ref-dep)
4395 (nconc (cdr (symbol-value ref-dep))
4396 (list (symbol-value id-dep))))
4397 (set ref-dep (list nil (symbol-value id-dep))))
4398 (push header headers))
4399 (goto-char (point-max))
4401 (nreverse headers)))))
4403 ;; The following macros and functions were written by Felix Lee
4404 ;; <flee@cse.psu.edu>.
4406 (defmacro gnus-nov-read-integer ()
4408 (if (= (following-char) ?\t)
4410 (let ((num (ignore-errors (read buffer))))
4411 (if (numberp num) num 0)))
4413 (search-forward "\t" eol 'move))))
4415 (defmacro gnus-nov-skip-field ()
4416 '(search-forward "\t" eol 'move))
4418 (defmacro gnus-nov-field ()
4419 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4421 ;; (defvar gnus-nov-none-counter 0)
4423 ;; This function has to be called with point after the article number
4424 ;; on the beginning of the line.
4425 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4426 (let ((eol (gnus-point-at-eol))
4427 (buffer (current-buffer))
4428 header ref id id-dep ref-dep)
4430 ;; overview: [num subject from date id refs chars lines misc]
4433 (narrow-to-region (point) eol)
4441 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4443 gnus-structured-field-decoder (gnus-nov-field)) ; from
4444 (gnus-nov-field) ; date
4445 (setq id (or (gnus-nov-field)
4446 (nnheader-generate-fake-message-id))) ; id
4448 (let ((beg (point)))
4449 (search-forward "\t" eol)
4450 (if (search-backward ">" beg t)
4454 (search-backward "<" beg t)))
4457 (gnus-nov-field)) ; refs
4458 (gnus-nov-read-integer) ; chars
4459 (gnus-nov-read-integer) ; lines
4460 (if (= (following-char) ?\n)
4462 (gnus-nov-field))))) ; misc
4466 (when gnus-alter-header-function
4467 (funcall gnus-alter-header-function header)
4468 (setq id (mail-header-id header)
4469 ref (gnus-parent-id (mail-header-references header))))
4471 ;; We build the thread tree.
4472 (when (equal id ref)
4473 ;; This article refers back to itself. Naughty, naughty.
4475 (if (boundp (setq id-dep (intern id dependencies)))
4476 (if (and (car (symbol-value id-dep))
4478 ;; An article with this Message-ID has already been seen.
4479 (if gnus-summary-ignore-duplicates
4480 ;; We ignore this one, except we add any additional
4481 ;; Xrefs (in case the two articles came from different
4484 (mail-header-set-xref
4485 (car (symbol-value id-dep))
4486 (concat (or (mail-header-xref
4487 (car (symbol-value id-dep)))
4489 (or (mail-header-xref header) "")))
4491 ;; We rename the Message-ID.
4493 (setq id-dep (intern (setq id (nnmail-message-id))
4496 (mail-header-set-id header id))
4497 (setcar (symbol-value id-dep) header))
4498 (set id-dep (list header)))
4500 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4501 (setcdr (symbol-value ref-dep)
4502 (nconc (cdr (symbol-value ref-dep))
4503 (list (symbol-value id-dep))))
4504 (set ref-dep (list nil (symbol-value id-dep)))))
4507 ;; Goes through the xover lines and returns a list of vectors
4508 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4509 force-new dependencies
4510 group also-fetch-heads)
4511 "Parse the news overview data in the server buffer, and return a
4512 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4513 ;; Get the Xref when the users reads the articles since most/some
4514 ;; NNTP servers do not include Xrefs when using XOVER.
4515 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4516 (let ((cur nntp-server-buffer)
4517 (dependencies (or dependencies gnus-newsgroup-dependencies))
4518 number headers header)
4520 (set-buffer nntp-server-buffer)
4521 ;; Allow the user to mangle the headers before parsing them.
4522 (run-hooks 'gnus-parse-headers-hook)
4523 (goto-char (point-min))
4526 (while (and sequence (not (eobp)))
4527 (setq number (read cur))
4528 (while (and sequence
4529 (< (car sequence) number))
4530 (setq sequence (cdr sequence)))
4532 (eq number (car sequence))
4534 (setq sequence (cdr sequence))
4535 (setq header (inline
4536 (gnus-nov-parse-line
4537 number dependencies force-new))))
4538 (push header headers))
4541 (gnus-error 4 "Strange nov line (%d)"
4542 (count-lines (point-min) (point)))))
4544 ;; A common bug in inn is that if you have posted an article and
4545 ;; then retrieves the active file, it will answer correctly --
4546 ;; the new article is included. However, a NOV entry for the
4547 ;; article may not have been generated yet, so this may fail.
4548 ;; We work around this problem by retrieving the last few
4549 ;; headers using HEAD.
4550 (if (or (not also-fetch-heads)
4552 ;; We (probably) got all the headers.
4554 (let ((gnus-nov-is-evil t))
4557 (when (gnus-retrieve-headers sequence group)
4558 (gnus-get-newsgroup-headers))))))))
4560 (defun gnus-article-get-xrefs ()
4561 "Fill in the Xref value in `gnus-current-headers', if necessary.
4562 This is meant to be called in `gnus-article-internal-prepare-hook'."
4563 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4564 gnus-current-headers)))
4565 (or (not gnus-use-cross-reference)
4567 (and (mail-header-xref headers)
4568 (not (string= (mail-header-xref headers) "")))
4569 (let ((case-fold-search t)
4572 (nnheader-narrow-to-headers)
4573 (goto-char (point-min))
4574 (when (or (and (eq (downcase (following-char)) ?x)
4575 (looking-at "Xref:"))
4576 (search-forward "\nXref:" nil t))
4577 (goto-char (1+ (match-end 0)))
4578 (setq xref (buffer-substring (point)
4579 (progn (end-of-line) (point))))
4580 (mail-header-set-xref headers xref)))))))
4582 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4583 "Find article ID and insert the summary line for that article."
4584 (let ((header (if (and old-header use-old-header)
4585 old-header (gnus-read-header id)))
4586 (number (and (numberp id) id))
4589 ;; Rebuild the thread that this article is part of and go to the
4590 ;; article we have fetched.
4591 (when (and (not gnus-show-threads)
4593 (when (setq d (gnus-data-find (mail-header-number old-header)))
4594 (goto-char (gnus-data-pos d))
4597 (- (gnus-point-at-bol)
4599 (1+ (gnus-point-at-eol))
4600 (gnus-delete-line))))))
4602 (mail-header-set-number header (mail-header-number old-header)))
4603 (setq gnus-newsgroup-sparse
4604 (delq (setq number (mail-header-number header))
4605 gnus-newsgroup-sparse))
4606 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4607 (gnus-rebuild-thread (mail-header-id header))
4608 (gnus-summary-goto-subject number nil t))
4609 (when (and (numberp number)
4611 ;; We have to update the boundaries even if we can't fetch the
4612 ;; article if ID is a number -- so that the next `P' or `N'
4613 ;; command will fetch the previous (or next) article even
4614 ;; if the one we tried to fetch this time has been canceled.
4615 (when (> number gnus-newsgroup-end)
4616 (setq gnus-newsgroup-end number))
4617 (when (< number gnus-newsgroup-begin)
4618 (setq gnus-newsgroup-begin number))
4619 (setq gnus-newsgroup-unselected
4620 (delq number gnus-newsgroup-unselected)))
4621 ;; Report back a success?
4622 (and header (mail-header-number header))))
4624 ;;; Process/prefix in the summary buffer
4626 (defun gnus-summary-work-articles (n)
4627 "Return a list of articles to be worked upon. The prefix argument,
4628 the list of process marked articles, and the current article will be
4629 taken into consideration."
4632 ;; A numerical prefix has been given.
4633 (setq n (prefix-numeric-value n))
4634 (let ((backward (< n 0))
4635 (n (abs (prefix-numeric-value n)))
4640 (push (setq article (gnus-summary-article-number))
4643 (gnus-summary-find-prev nil article)
4644 (gnus-summary-find-next nil article)))
4646 (nreverse articles)))
4647 ((gnus-region-active-p)
4648 ;; Work on the region between point and mark.
4649 (let ((max (max (point) (mark)))
4652 (goto-char (min (point) (mark)))
4655 (push (setq article (gnus-summary-article-number)) articles)
4656 (gnus-summary-find-next nil article)
4658 (nreverse articles))))
4659 (gnus-newsgroup-processable
4660 ;; There are process-marked articles present.
4661 ;; Save current state.
4662 (gnus-summary-save-process-mark)
4664 (reverse gnus-newsgroup-processable))
4666 ;; Just return the current article.
4667 (list (gnus-summary-article-number)))))
4669 (defun gnus-summary-save-process-mark ()
4670 "Push the current set of process marked articles on the stack."
4672 (push (copy-sequence gnus-newsgroup-processable)
4673 gnus-newsgroup-process-stack))
4675 (defun gnus-summary-kill-process-mark ()
4676 "Push the current set of process marked articles on the stack and unmark."
4678 (gnus-summary-save-process-mark)
4679 (gnus-summary-unmark-all-processable))
4681 (defun gnus-summary-yank-process-mark ()
4682 "Pop the last process mark state off the stack and restore it."
4684 (unless gnus-newsgroup-process-stack
4685 (error "Empty mark stack"))
4686 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4688 (defun gnus-summary-process-mark-set (set)
4689 "Make SET into the current process marked articles."
4690 (gnus-summary-unmark-all-processable)
4692 (gnus-summary-set-process-mark (pop set))))
4694 ;;; Searching and stuff
4696 (defun gnus-summary-search-group (&optional backward use-level)
4697 "Search for next unread newsgroup.
4698 If optional argument BACKWARD is non-nil, search backward instead."
4700 (set-buffer gnus-group-buffer)
4701 (when (gnus-group-search-forward
4702 backward nil (if use-level (gnus-group-group-level) nil))
4703 (gnus-group-group-name))))
4705 (defun gnus-summary-best-group (&optional exclude-group)
4706 "Find the name of the best unread group.
4707 If EXCLUDE-GROUP, do not go to this group."
4709 (set-buffer gnus-group-buffer)
4711 (gnus-group-best-unread-group exclude-group))))
4713 (defun gnus-summary-find-next (&optional unread article backward)
4714 (if backward (gnus-summary-find-prev)
4715 (let* ((dummy (gnus-summary-article-intangible-p))
4716 (article (or article (gnus-summary-article-number)))
4717 (arts (gnus-data-find-list article))
4719 (when (and (not dummy)
4720 (or (not gnus-summary-check-current)
4722 (not (gnus-data-unread-p (car arts)))))
4723 (setq arts (cdr arts)))
4728 (when (gnus-data-unread-p (car arts))
4729 (setq result (car arts)
4731 (setq arts (cdr arts)))
4734 (goto-char (gnus-data-pos result))
4735 (gnus-data-number result)))))
4737 (defun gnus-summary-find-prev (&optional unread article)
4738 (let* ((eobp (eobp))
4739 (article (or article (gnus-summary-article-number)))
4740 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4742 (when (and (not eobp)
4743 (or (not gnus-summary-check-current)
4745 (not (gnus-data-unread-p (car arts)))))
4746 (setq arts (cdr arts)))
4751 (when (gnus-data-unread-p (car arts))
4752 (setq result (car arts)
4754 (setq arts (cdr arts)))
4757 (goto-char (gnus-data-pos result))
4758 (gnus-data-number result))))
4760 (defun gnus-summary-find-subject (subject &optional unread backward article)
4761 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4762 (article (or article (gnus-summary-article-number)))
4763 (articles (gnus-data-list backward))
4764 (arts (gnus-data-find-list article articles))
4766 (when (or (not gnus-summary-check-current)
4768 (not (gnus-data-unread-p (car arts))))
4769 (setq arts (cdr arts)))
4771 (and (or (not unread)
4772 (gnus-data-unread-p (car arts)))
4773 (vectorp (gnus-data-header (car arts)))
4775 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4776 (setq result (car arts)
4778 (setq arts (cdr arts)))
4780 (goto-char (gnus-data-pos result))
4781 (gnus-data-number result))))
4783 (defun gnus-summary-search-forward (&optional unread subject backward)
4784 "Search forward for an article.
4785 If UNREAD, look for unread articles. If SUBJECT, look for
4786 articles with that subject. If BACKWARD, search backward instead."
4787 (cond (subject (gnus-summary-find-subject subject unread backward))
4788 (backward (gnus-summary-find-prev unread))
4789 (t (gnus-summary-find-next unread))))
4791 (defun gnus-recenter (&optional n)
4792 "Center point in window and redisplay frame.
4793 Also do horizontal recentering."
4795 (when (and gnus-auto-center-summary
4796 (not (eq gnus-auto-center-summary 'vertical)))
4797 (gnus-horizontal-recenter))
4800 (defun gnus-summary-recenter ()
4801 "Center point in the summary window.
4802 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4803 displayed, no centering will be performed."
4804 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4805 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4806 (let* ((top (cond ((< (window-height) 4) 0)
4807 ((< (window-height) 7) 1)
4809 (height (1- (window-height)))
4810 (bottom (save-excursion (goto-char (point-max))
4811 (forward-line (- height))
4813 (window (get-buffer-window (current-buffer))))
4814 ;; The user has to want it.
4815 (when gnus-auto-center-summary
4816 (when (get-buffer-window gnus-article-buffer)
4817 ;; Only do recentering when the article buffer is displayed,
4818 ;; Set the window start to either `bottom', which is the biggest
4819 ;; possible valid number, or the second line from the top,
4820 ;; whichever is the least.
4822 window (min bottom (save-excursion
4823 (forward-line (- top)) (point)))))
4824 ;; Do horizontal recentering while we're at it.
4825 (when (and (get-buffer-window (current-buffer) t)
4826 (not (eq gnus-auto-center-summary 'vertical)))
4827 (let ((selected (selected-window)))
4828 (select-window (get-buffer-window (current-buffer) t))
4829 (gnus-summary-position-point)
4830 (gnus-horizontal-recenter)
4831 (select-window selected))))))
4833 (defun gnus-summary-jump-to-group (newsgroup)
4834 "Move point to NEWSGROUP in group mode buffer."
4835 ;; Keep update point of group mode buffer if visible.
4836 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4837 (save-window-excursion
4838 ;; Take care of tree window mode.
4839 (when (get-buffer-window gnus-group-buffer)
4840 (pop-to-buffer gnus-group-buffer))
4841 (gnus-group-jump-to-group newsgroup))
4843 ;; Take care of tree window mode.
4844 (if (get-buffer-window gnus-group-buffer)
4845 (pop-to-buffer gnus-group-buffer)
4846 (set-buffer gnus-group-buffer))
4847 (gnus-group-jump-to-group newsgroup))))
4849 ;; This function returns a list of article numbers based on the
4850 ;; difference between the ranges of read articles in this group and
4851 ;; the range of active articles.
4852 (defun gnus-list-of-unread-articles (group)
4853 (let* ((read (gnus-info-read (gnus-get-info group)))
4854 (active (or (gnus-active group) (gnus-activate-group group)))
4857 ;; If none are read, then all are unread.
4859 (setq first (car active))
4860 ;; If the range of read articles is a single range, then the
4861 ;; first unread article is the article after the last read
4862 ;; article. Sounds logical, doesn't it?
4863 (if (not (listp (cdr read)))
4864 (setq first (1+ (cdr read)))
4865 ;; `read' is a list of ranges.
4866 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4872 (while (< first nlast)
4874 (setq first (1+ first))))
4875 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4876 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4877 (setq read (cdr read)))))
4878 ;; And add the last unread articles.
4879 (while (<= first last)
4881 (setq first (1+ first)))
4882 ;; Return the list of unread articles.
4883 (delq 0 (nreverse unread))))
4885 (defun gnus-list-of-read-articles (group)
4886 "Return a list of unread, unticked and non-dormant articles."
4887 (let* ((info (gnus-get-info group))
4888 (marked (gnus-info-marks info))
4889 (active (gnus-active group)))
4891 (gnus-set-difference
4892 (gnus-sorted-complement
4893 (gnus-uncompress-range active)
4894 (gnus-list-of-unread-articles group))
4896 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4897 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4899 ;; Various summary commands
4901 (defun gnus-summary-universal-argument (arg)
4902 "Perform any operation on all articles that are process/prefixed."
4904 (gnus-set-global-variables)
4905 (let ((articles (gnus-summary-work-articles arg))
4912 (substitute-command-keys
4913 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4916 (gnus-error 1 "Undefined key")
4919 (gnus-summary-goto-subject (setq article (pop articles)))
4920 (let (gnus-newsgroup-processable)
4921 (command-execute func))
4922 (gnus-summary-remove-process-mark article)))))
4923 (gnus-summary-position-point))
4925 (defun gnus-summary-toggle-truncation (&optional arg)
4926 "Toggle truncation of summary lines.
4927 With arg, turn line truncation on iff arg is positive."
4929 (setq truncate-lines
4930 (if (null arg) (not truncate-lines)
4931 (> (prefix-numeric-value arg) 0)))
4934 (defun gnus-summary-reselect-current-group (&optional all rescan)
4935 "Exit and then reselect the current newsgroup.
4936 The prefix argument ALL means to select all articles."
4938 (gnus-set-global-variables)
4939 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4940 (error "Ephemeral groups can't be reselected"))
4941 (let ((current-subject (gnus-summary-article-number))
4942 (group gnus-newsgroup-name))
4943 (setq gnus-newsgroup-begin nil)
4945 ;; We have to adjust the point of group mode buffer because
4946 ;; point was moved to the next unread newsgroup by exiting.
4947 (gnus-summary-jump-to-group group)
4950 (gnus-group-get-new-news-this-group 1)))
4951 (gnus-group-read-group all t)
4952 (gnus-summary-goto-subject current-subject nil t)))
4954 (defun gnus-summary-rescan-group (&optional all)
4955 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4957 (gnus-summary-reselect-current-group all t))
4959 (defun gnus-summary-update-info (&optional non-destructive)
4961 (let ((group gnus-newsgroup-name))
4962 (when gnus-newsgroup-kill-headers
4963 (setq gnus-newsgroup-killed
4964 (gnus-compress-sequence
4966 (gnus-set-sorted-intersection
4967 (gnus-uncompress-range gnus-newsgroup-killed)
4968 (setq gnus-newsgroup-unselected
4969 (sort gnus-newsgroup-unselected '<)))
4970 (setq gnus-newsgroup-unreads
4971 (sort gnus-newsgroup-unreads '<)))
4973 (unless (listp (cdr gnus-newsgroup-killed))
4974 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4975 (let ((headers gnus-newsgroup-headers))
4976 (when (and (not gnus-save-score)
4977 (not non-destructive))
4978 (setq gnus-newsgroup-scored nil))
4979 ;; Set the new ranges of read articles.
4981 (set-buffer gnus-group-buffer)
4982 (gnus-undo-force-boundary))
4983 (gnus-update-read-articles
4984 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4985 ;; Set the current article marks.
4987 ;; Do the cross-ref thing.
4988 (when gnus-use-cross-reference
4989 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4990 ;; Do adaptive scoring, and possibly save score files.
4991 (when gnus-newsgroup-adaptive
4992 (gnus-score-adaptive))
4993 (when gnus-use-scoring
4995 ;; Do not switch windows but change the buffer to work.
4996 (set-buffer gnus-group-buffer)
4997 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4998 (gnus-group-update-group group))))))
5000 (defun gnus-summary-save-newsrc (&optional force)
5001 "Save the current number of read/marked articles in the dribble buffer.
5002 The dribble buffer will then be saved.
5003 If FORCE (the prefix), also save the .newsrc file(s)."
5005 (gnus-summary-update-info t)
5007 (gnus-save-newsrc-file)
5008 (gnus-dribble-save)))
5010 (defun gnus-summary-exit (&optional temporary)
5011 "Exit reading current newsgroup, and then return to group selection mode.
5012 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5014 (gnus-set-global-variables)
5015 (gnus-kill-save-kill-buffer)
5016 (let* ((group gnus-newsgroup-name)
5017 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5020 (buf (current-buffer)))
5021 (run-hooks 'gnus-summary-prepare-exit-hook)
5022 ;; If we have several article buffers, we kill them at exit.
5023 (unless gnus-single-article-buffer
5024 (gnus-kill-buffer gnus-original-article-buffer)
5025 (setq gnus-article-current nil))
5026 (when gnus-use-cache
5027 (gnus-cache-possibly-remove-articles)
5028 (gnus-cache-save-buffers))
5029 (gnus-async-prefetch-remove-group group)
5030 (when gnus-suppress-duplicates
5031 (gnus-dup-enter-articles))
5032 (when gnus-use-trees
5033 (gnus-tree-close group))
5034 ;; Make all changes in this group permanent.
5036 (run-hooks 'gnus-exit-group-hook)
5037 (gnus-summary-update-info))
5038 (gnus-close-group group)
5039 ;; Make sure where we were, and go to next newsgroup.
5040 (set-buffer gnus-group-buffer)
5042 (gnus-group-jump-to-group group))
5043 (run-hooks 'gnus-summary-exit-hook)
5045 (gnus-group-next-unread-group 1))
5046 (setq group-point (point))
5049 ;; If we have several article buffers, we kill them at exit.
5050 (unless gnus-single-article-buffer
5051 (gnus-kill-buffer gnus-article-buffer)
5052 (gnus-kill-buffer gnus-original-article-buffer)
5053 (setq gnus-article-current nil))
5055 (if (not gnus-kill-summary-on-exit)
5056 (gnus-deaden-summary)
5057 ;; We set all buffer-local variables to nil. It is unclear why
5058 ;; this is needed, but if we don't, buffer-local variables are
5059 ;; not garbage-collected, it seems. This would the lead to en
5060 ;; ever-growing Emacs.
5061 (gnus-summary-clear-local-variables)
5062 (when (get-buffer gnus-article-buffer)
5063 (bury-buffer gnus-article-buffer))
5064 ;; We clear the global counterparts of the buffer-local
5065 ;; variables as well, just to be on the safe side.
5066 (set-buffer gnus-group-buffer)
5067 (gnus-summary-clear-local-variables)
5068 ;; Return to group mode buffer.
5069 (when (eq mode 'gnus-summary-mode)
5070 (gnus-kill-buffer buf)))
5071 (setq gnus-current-select-method gnus-select-method)
5072 (pop-to-buffer gnus-group-buffer)
5073 ;; Clear the current group name.
5074 (if (not quit-config)
5076 (goto-char group-point)
5077 (gnus-configure-windows 'group 'force))
5078 (gnus-handle-ephemeral-exit quit-config))
5080 (setq gnus-newsgroup-name nil)))))
5082 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5083 (defun gnus-summary-exit-no-update (&optional no-questions)
5084 "Quit reading current newsgroup without updating read article info."
5086 (gnus-set-global-variables)
5087 (let* ((group gnus-newsgroup-name)
5088 (quit-config (gnus-group-quit-config group)))
5089 (when (or no-questions
5091 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5092 ;; If we have several article buffers, we kill them at exit.
5093 (unless gnus-single-article-buffer
5094 (gnus-kill-buffer gnus-article-buffer)
5095 (gnus-kill-buffer gnus-original-article-buffer)
5096 (setq gnus-article-current nil))
5097 (if (not gnus-kill-summary-on-exit)
5098 (gnus-deaden-summary)
5099 (gnus-close-group group)
5100 (gnus-summary-clear-local-variables)
5101 (set-buffer gnus-group-buffer)
5102 (gnus-summary-clear-local-variables)
5103 (when (get-buffer gnus-summary-buffer)
5104 (kill-buffer gnus-summary-buffer)))
5105 (unless gnus-single-article-buffer
5106 (setq gnus-article-current nil))
5107 (when gnus-use-trees
5108 (gnus-tree-close group))
5109 (gnus-async-prefetch-remove-group group)
5110 (when (get-buffer gnus-article-buffer)
5111 (bury-buffer gnus-article-buffer))
5112 ;; Return to the group buffer.
5113 (gnus-configure-windows 'group 'force)
5114 ;; Clear the current group name.
5115 (setq gnus-newsgroup-name nil)
5116 (when (equal (gnus-group-group-name) group)
5117 (gnus-group-next-unread-group 1))
5119 (gnus-handle-ephemeral-exit quit-config)))))
5121 (defun gnus-handle-ephemeral-exit (quit-config)
5122 "Handle movement when leaving an ephemeral group. The state
5123 which existed when entering the ephemeral is reset."
5124 (if (not (buffer-name (car quit-config)))
5125 (gnus-configure-windows 'group 'force)
5126 (set-buffer (car quit-config))
5127 (cond ((eq major-mode 'gnus-summary-mode)
5128 (gnus-set-global-variables))
5129 ((eq major-mode 'gnus-article-mode)
5131 ;; The `gnus-summary-buffer' variable may point
5132 ;; to the old summary buffer when using a single
5134 (unless (gnus-buffer-live-p gnus-summary-buffer)
5135 (set-buffer gnus-group-buffer))
5136 (set-buffer gnus-summary-buffer)
5137 (gnus-set-global-variables))))
5138 (if (or (eq (cdr quit-config) 'article)
5139 (eq (cdr quit-config) 'pick))
5141 ;; The current article may be from the ephemeral group
5142 ;; thus it is best that we reload this article
5143 (gnus-summary-show-article)
5144 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5145 (gnus-configure-windows 'pick 'force)
5146 (gnus-configure-windows (cdr quit-config) 'force)))
5147 (gnus-configure-windows (cdr quit-config) 'force))
5148 (when (eq major-mode 'gnus-summary-mode)
5149 (gnus-summary-next-subject 1 nil t)
5150 (gnus-summary-recenter)
5151 (gnus-summary-position-point))))
5155 (defvar gnus-dead-summary-mode-map nil)
5157 (unless gnus-dead-summary-mode-map
5158 (setq gnus-dead-summary-mode-map (make-keymap))
5159 (suppress-keymap gnus-dead-summary-mode-map)
5160 (substitute-key-definition
5161 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5162 (let ((keys '("\C-d" "\r" "\177" [delete])))
5164 (define-key gnus-dead-summary-mode-map
5165 (pop keys) 'gnus-summary-wake-up-the-dead))))
5167 (defvar gnus-dead-summary-mode nil
5168 "Minor mode for Gnus summary buffers.")
5170 (defun gnus-dead-summary-mode (&optional arg)
5171 "Minor mode for Gnus summary buffers."
5173 (when (eq major-mode 'gnus-summary-mode)
5174 (make-local-variable 'gnus-dead-summary-mode)
5175 (setq gnus-dead-summary-mode
5176 (if (null arg) (not gnus-dead-summary-mode)
5177 (> (prefix-numeric-value arg) 0)))
5178 (when gnus-dead-summary-mode
5179 (gnus-add-minor-mode
5180 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5182 (defun gnus-deaden-summary ()
5183 "Make the current summary buffer into a dead summary buffer."
5184 ;; Kill any previous dead summary buffer.
5185 (when (and gnus-dead-summary
5186 (buffer-name gnus-dead-summary))
5188 (set-buffer gnus-dead-summary)
5189 (when gnus-dead-summary-mode
5190 (kill-buffer (current-buffer)))))
5191 ;; Make this the current dead summary.
5192 (setq gnus-dead-summary (current-buffer))
5193 (gnus-dead-summary-mode 1)
5194 (let ((name (buffer-name)))
5195 (when (string-match "Summary" name)
5197 (concat (substring name 0 (match-beginning 0)) "Dead "
5198 (substring name (match-beginning 0)))
5201 (defun gnus-kill-or-deaden-summary (buffer)
5202 "Kill or deaden the summary BUFFER."
5203 (when (and (buffer-name buffer)
5204 (not gnus-single-article-buffer))
5207 (gnus-kill-buffer gnus-article-buffer)
5208 (gnus-kill-buffer gnus-original-article-buffer)))
5209 (cond (gnus-kill-summary-on-exit
5210 (when (and gnus-use-trees
5211 (and (get-buffer buffer)
5212 (buffer-name (get-buffer buffer))))
5214 (set-buffer (get-buffer buffer))
5215 (gnus-tree-close gnus-newsgroup-name)))
5216 (gnus-kill-buffer buffer))
5217 ((and (get-buffer buffer)
5218 (buffer-name (get-buffer buffer)))
5221 (gnus-deaden-summary)))))
5223 (defun gnus-summary-wake-up-the-dead (&rest args)
5224 "Wake up the dead summary buffer."
5226 (gnus-dead-summary-mode -1)
5227 (let ((name (buffer-name)))
5228 (when (string-match "Dead " name)
5230 (concat (substring name 0 (match-beginning 0))
5231 (substring name (match-end 0)))
5233 (gnus-message 3 "This dead summary is now alive again"))
5235 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5236 (defun gnus-summary-fetch-faq (&optional faq-dir)
5237 "Fetch the FAQ for the current group.
5238 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5242 (when current-prefix-arg
5244 "Faq dir: " (and (listp gnus-group-faq-directory)
5245 (mapcar (lambda (file) (list file))
5246 gnus-group-faq-directory))))))
5247 (let (gnus-faq-buffer)
5248 (when (setq gnus-faq-buffer
5249 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5250 (gnus-configure-windows 'summary-faq))))
5252 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5253 (defun gnus-summary-describe-group (&optional force)
5254 "Describe the current newsgroup."
5256 (gnus-group-describe-group force gnus-newsgroup-name))
5258 (defun gnus-summary-describe-briefly ()
5259 "Describe summary mode commands briefly."
5262 (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")))
5264 ;; Walking around group mode buffer from summary mode.
5266 (defun gnus-summary-next-group (&optional no-article target-group backward)
5267 "Exit current newsgroup and then select next unread newsgroup.
5268 If prefix argument NO-ARTICLE is non-nil, no article is selected
5269 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5270 previous group instead."
5272 (gnus-set-global-variables)
5273 ;; Stop pre-fetching.
5274 (gnus-async-halt-prefetch)
5275 (let ((current-group gnus-newsgroup-name)
5276 (current-buffer (current-buffer))
5278 ;; First we semi-exit this group to update Xrefs and all variables.
5279 ;; We can't do a real exit, because the window conf must remain
5280 ;; the same in case the user is prompted for info, and we don't
5281 ;; want the window conf to change before that...
5282 (gnus-summary-exit t)
5283 (while (not entered)
5284 ;; Then we find what group we are supposed to enter.
5285 (set-buffer gnus-group-buffer)
5286 (gnus-group-jump-to-group current-group)
5289 (if (eq gnus-keep-same-level 'best)
5290 (gnus-summary-best-group gnus-newsgroup-name)
5291 (gnus-summary-search-group backward gnus-keep-same-level))))
5292 (if (not target-group)
5293 ;; There are no further groups, so we return to the group
5296 (gnus-message 5 "Returning to the group buffer")
5298 (when (gnus-buffer-live-p current-buffer)
5299 (set-buffer current-buffer)
5300 (gnus-summary-exit))
5301 (run-hooks 'gnus-group-no-more-groups-hook))
5302 ;; We try to enter the target group.
5303 (gnus-group-jump-to-group target-group)
5304 (let ((unreads (gnus-group-group-unread)))
5305 (if (and (or (eq t unreads)
5306 (and unreads (not (zerop unreads))))
5307 (gnus-summary-read-group
5308 target-group nil no-article
5309 (and (buffer-name current-buffer) current-buffer)))
5311 (setq current-group target-group
5312 target-group nil)))))))
5314 (defun gnus-summary-prev-group (&optional no-article)
5315 "Exit current newsgroup and then select previous unread newsgroup.
5316 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5318 (gnus-summary-next-group no-article nil t))
5320 ;; Walking around summary lines.
5322 (defun gnus-summary-first-subject (&optional unread)
5323 "Go to the first unread subject.
5324 If UNREAD is non-nil, go to the first unread article.
5325 Returns the article selected or nil if there are no unread articles."
5330 ((null gnus-newsgroup-data)
5331 (gnus-message 3 "No articles in the group")
5333 ;; Pick the first article.
5335 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5336 (gnus-data-number (car gnus-newsgroup-data)))
5337 ;; No unread articles.
5338 ((null gnus-newsgroup-unreads)
5339 (gnus-message 3 "No more unread articles")
5341 ;; Find the first unread article.
5343 (let ((data gnus-newsgroup-data))
5345 (not (gnus-data-unread-p (car data))))
5346 (setq data (cdr data)))
5348 (goto-char (gnus-data-pos (car data)))
5349 (gnus-data-number (car data))))))
5350 (gnus-summary-position-point)))
5352 (defun gnus-summary-next-subject (n &optional unread dont-display)
5353 "Go to next N'th summary line.
5354 If N is negative, go to the previous N'th subject line.
5355 If UNREAD is non-nil, only unread articles are selected.
5356 The difference between N and the actual number of steps taken is
5359 (let ((backward (< n 0))
5363 (gnus-summary-find-prev unread)
5364 (gnus-summary-find-next unread)))
5367 (gnus-message 7 "No more%s articles"
5368 (if unread " unread" "")))
5369 (unless dont-display
5370 (gnus-summary-recenter)
5371 (gnus-summary-position-point))
5374 (defun gnus-summary-next-unread-subject (n)
5375 "Go to next N'th unread summary line."
5377 (gnus-summary-next-subject n t))
5379 (defun gnus-summary-prev-subject (n &optional unread)
5380 "Go to previous N'th summary line.
5381 If optional argument UNREAD is non-nil, only unread article is selected."
5383 (gnus-summary-next-subject (- n) unread))
5385 (defun gnus-summary-prev-unread-subject (n)
5386 "Go to previous N'th unread summary line."
5388 (gnus-summary-next-subject (- n) t))
5390 (defun gnus-summary-goto-subject (article &optional force silent)
5391 "Go the subject line of ARTICLE.
5392 If FORCE, also allow jumping to articles not currently shown."
5393 (interactive "nArticle number: ")
5395 (data (gnus-data-find article)))
5396 ;; We read in the article if we have to.
5399 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5400 (setq data (gnus-data-find article)))
5405 (gnus-message 3 "Can't find article %d" article))
5407 (goto-char (gnus-data-pos data))
5410 ;; Walking around summary lines with displaying articles.
5412 (defun gnus-summary-expand-window (&optional arg)
5413 "Make the summary buffer take up the entire Emacs frame.
5414 Given a prefix, will force an `article' buffer configuration."
5416 (gnus-set-global-variables)
5418 (gnus-configure-windows 'article 'force)
5419 (gnus-configure-windows 'summary 'force)))
5421 (defun gnus-summary-display-article (article &optional all-header)
5422 "Display ARTICLE in article buffer."
5423 (gnus-set-global-variables)
5427 (if gnus-summary-display-article-function
5428 (funcall gnus-summary-display-article-function article all-header)
5429 (gnus-article-prepare article all-header))
5430 (run-hooks 'gnus-select-article-hook)
5431 (when (and gnus-current-article
5432 (not (zerop gnus-current-article)))
5433 (gnus-summary-goto-subject gnus-current-article))
5434 (gnus-summary-recenter)
5435 (when (and gnus-use-trees gnus-show-threads)
5436 (gnus-possibly-generate-tree article)
5437 (gnus-highlight-selected-tree article))
5438 ;; Successfully display article.
5439 (gnus-article-set-window-start
5440 (cdr (assq article gnus-newsgroup-bookmarks))))))
5442 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5443 "Select the current article.
5444 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5445 non-nil, the article will be re-fetched even if it already present in
5446 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5448 ;; Make sure we are in the summary buffer to work around bbdb bug.
5449 (unless (eq major-mode 'gnus-summary-mode)
5450 (set-buffer gnus-summary-buffer))
5451 (let ((article (or article (gnus-summary-article-number)))
5452 (all-headers (not (not all-headers))) ;Must be T or NIL.
5453 gnus-summary-display-article-function
5456 (gnus-summary-article-pseudo-p article)
5457 (error "This is a pseudo-article"))
5460 (set-buffer gnus-summary-buffer)
5461 (if (or (and gnus-single-article-buffer
5462 (or (null gnus-current-article)
5463 (null gnus-article-current)
5464 (null (get-buffer gnus-article-buffer))
5465 (not (eq article (cdr gnus-article-current)))
5466 (not (equal (car gnus-article-current)
5467 gnus-newsgroup-name))))
5468 (and (not gnus-single-article-buffer)
5469 (or (null gnus-current-article)
5470 (not (eq gnus-current-article article))))
5472 ;; The requested article is different from the current article.
5474 (gnus-summary-display-article article all-headers)
5476 (when (or all-headers gnus-show-all-headers)
5477 (gnus-article-show-all-headers))
5480 (gnus-article-set-window-start
5481 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5483 (defun gnus-summary-set-current-mark (&optional current-mark)
5484 "Obsolete function."
5487 (defun gnus-summary-next-article (&optional unread subject backward push)
5488 "Select the next article.
5489 If UNREAD, only unread articles are selected.
5490 If SUBJECT, only articles with SUBJECT are selected.
5491 If BACKWARD, the previous article is selected instead of the next."
5493 (gnus-set-global-variables)
5495 ;; Is there such an article?
5496 ((and (gnus-summary-search-forward unread subject backward)
5497 (or (gnus-summary-display-article (gnus-summary-article-number))
5498 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5499 (gnus-summary-position-point))
5500 ;; If not, we try the first unread, if that is wanted.
5502 gnus-auto-select-same
5503 (gnus-summary-first-unread-article))
5504 (gnus-summary-position-point)
5505 (gnus-message 6 "Wrapped"))
5506 ;; Try to get next/previous article not displayed in this group.
5507 ((and gnus-auto-extend-newsgroup
5508 (not unread) (not subject))
5509 (gnus-summary-goto-article
5510 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5512 ;; Go to next/previous group.
5514 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5515 (gnus-summary-jump-to-group gnus-newsgroup-name))
5516 (let ((cmd last-command-char)
5519 (set-buffer gnus-group-buffer)
5522 (if (eq gnus-keep-same-level 'best)
5523 (gnus-summary-best-group gnus-newsgroup-name)
5524 (gnus-summary-search-group backward gnus-keep-same-level))))
5525 ;; For some reason, the group window gets selected. We change
5527 (select-window (get-buffer-window (current-buffer)))
5528 ;; Select next unread newsgroup automagically.
5530 ((or (not gnus-auto-select-next)
5532 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5533 ((or (eq gnus-auto-select-next 'quietly)
5534 (and (eq gnus-auto-select-next 'slightly-quietly)
5536 (and (eq gnus-auto-select-next 'almost-quietly)
5537 (gnus-summary-last-article-p)))
5539 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5541 (gnus-message 7 "No more%s articles (%s)..."
5542 (if unread " unread" "")
5543 (if group (concat "selecting " group)
5545 (gnus-summary-next-group nil group backward)))
5547 (when (gnus-key-press-event-p last-input-event)
5548 (gnus-summary-walk-group-buffer
5549 gnus-newsgroup-name cmd unread backward point))))))))
5551 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5552 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5553 (?\C-p (gnus-group-prev-unread-group 1))))
5554 (cursor-in-echo-area t)
5555 keve key group ended)
5557 (set-buffer gnus-group-buffer)
5560 (if (eq gnus-keep-same-level 'best)
5561 (gnus-summary-best-group gnus-newsgroup-name)
5562 (gnus-summary-search-group backward gnus-keep-same-level))))
5565 5 "No more%s articles%s" (if unread " unread" "")
5567 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5568 (format " (Type %s for %s [%s])"
5569 (single-key-description cmd) group
5570 (car (gnus-gethash group gnus-newsrc-hashtb)))
5571 (format " (Type %s to exit %s)"
5572 (single-key-description cmd)
5573 gnus-newsgroup-name)))
5574 ;; Confirm auto selection.
5575 (setq key (car (setq keve (gnus-read-event-char))))
5578 ((assq key keystrokes)
5579 (let ((obuf (current-buffer)))
5580 (switch-to-buffer gnus-group-buffer)
5582 (gnus-group-jump-to-group group))
5583 (eval (cadr (assq key keystrokes)))
5584 (setq group (gnus-group-group-name))
5585 (switch-to-buffer obuf))
5589 (gnus-ephemeral-group-p gnus-newsgroup-name))
5591 (gnus-summary-next-group nil group backward)))
5593 (push (cdr keve) unread-command-events))))))
5595 (defun gnus-summary-next-unread-article ()
5596 "Select unread article after current one."
5598 (gnus-summary-next-article
5599 (or (not (eq gnus-summary-goto-unread 'never))
5600 (gnus-summary-last-article-p (gnus-summary-article-number)))
5601 (and gnus-auto-select-same
5602 (gnus-summary-article-subject))))
5604 (defun gnus-summary-prev-article (&optional unread subject)
5605 "Select the article after the current one.
5606 If UNREAD is non-nil, only unread articles are selected."
5608 (gnus-summary-next-article unread subject t))
5610 (defun gnus-summary-prev-unread-article ()
5611 "Select unread article before current one."
5613 (gnus-summary-prev-article
5614 (or (not (eq gnus-summary-goto-unread 'never))
5615 (gnus-summary-first-article-p (gnus-summary-article-number)))
5616 (and gnus-auto-select-same
5617 (gnus-summary-article-subject))))
5619 (defun gnus-summary-next-page (&optional lines circular)
5620 "Show next page of the selected article.
5621 If at the end of the current article, select the next article.
5622 LINES says how many lines should be scrolled up.
5624 If CIRCULAR is non-nil, go to the start of the article instead of
5625 selecting the next article when reaching the end of the current
5628 (setq gnus-summary-buffer (current-buffer))
5629 (gnus-set-global-variables)
5630 (let ((article (gnus-summary-article-number))
5631 (article-window (get-buffer-window gnus-article-buffer t))
5633 (gnus-configure-windows 'article)
5634 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5635 (if (and (eq gnus-summary-goto-unread 'never)
5636 (not (gnus-summary-last-article-p article)))
5637 (gnus-summary-next-article)
5638 (gnus-summary-next-unread-article))
5639 (if (or (null gnus-current-article)
5640 (null gnus-article-current)
5641 (/= article (cdr gnus-article-current))
5642 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5643 ;; Selected subject is different from current article's.
5644 (gnus-summary-display-article article)
5645 (when article-window
5646 (gnus-eval-in-buffer-window gnus-article-buffer
5647 (setq endp (gnus-article-next-page lines)))
5650 (gnus-summary-beginning-of-article))
5652 (gnus-message 3 "End of message"))
5654 (if (and (eq gnus-summary-goto-unread 'never)
5655 (not (gnus-summary-last-article-p article)))
5656 (gnus-summary-next-article)
5657 (gnus-summary-next-unread-article))))))))
5658 (gnus-summary-recenter)
5659 (gnus-summary-position-point)))
5661 (defun gnus-summary-prev-page (&optional lines move)
5662 "Show previous page of selected article.
5663 Argument LINES specifies lines to be scrolled down.
5664 If MOVE, move to the previous unread article if point is at
5665 the beginning of the buffer."
5667 (gnus-set-global-variables)
5668 (let ((article (gnus-summary-article-number))
5669 (article-window (get-buffer-window gnus-article-buffer t))
5671 (gnus-configure-windows 'article)
5672 (if (or (null gnus-current-article)
5673 (null gnus-article-current)
5674 (/= article (cdr gnus-article-current))
5675 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5676 ;; Selected subject is different from current article's.
5677 (gnus-summary-display-article article)
5678 (gnus-summary-recenter)
5679 (when article-window
5680 (gnus-eval-in-buffer-window gnus-article-buffer
5681 (setq endp (gnus-article-prev-page lines)))
5682 (when (and move endp)
5684 (gnus-message 3 "Beginning of message"))
5686 (if (and (eq gnus-summary-goto-unread 'never)
5687 (not (gnus-summary-first-article-p article)))
5688 (gnus-summary-prev-article)
5689 (gnus-summary-prev-unread-article))))))))
5690 (gnus-summary-position-point))
5692 (defun gnus-summary-prev-page-or-article (&optional lines)
5693 "Show previous page of selected article.
5694 Argument LINES specifies lines to be scrolled down.
5695 If at the beginning of the article, go to the next article."
5697 (gnus-summary-prev-page lines t))
5699 (defun gnus-summary-scroll-up (lines)
5700 "Scroll up (or down) one line current article.
5701 Argument LINES specifies lines to be scrolled up (or down if negative)."
5703 (gnus-set-global-variables)
5704 (gnus-configure-windows 'article)
5705 (gnus-summary-show-thread)
5706 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5707 (gnus-eval-in-buffer-window gnus-article-buffer
5709 (when (gnus-article-next-page lines)
5710 (gnus-message 3 "End of message")))
5712 (gnus-article-prev-page (- lines))))))
5713 (gnus-summary-recenter)
5714 (gnus-summary-position-point))
5716 (defun gnus-summary-next-same-subject ()
5717 "Select next article which has the same subject as current one."
5719 (gnus-set-global-variables)
5720 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5722 (defun gnus-summary-prev-same-subject ()
5723 "Select previous article which has the same subject as current one."
5725 (gnus-set-global-variables)
5726 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5728 (defun gnus-summary-next-unread-same-subject ()
5729 "Select next unread article which has the same subject as current one."
5731 (gnus-set-global-variables)
5732 (gnus-summary-next-article t (gnus-summary-article-subject)))
5734 (defun gnus-summary-prev-unread-same-subject ()
5735 "Select previous unread article which has the same subject as current one."
5737 (gnus-set-global-variables)
5738 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5740 (defun gnus-summary-first-unread-article ()
5741 "Select the first unread article.
5742 Return nil if there are no unread articles."
5744 (gnus-set-global-variables)
5746 (when (gnus-summary-first-subject t)
5747 (gnus-summary-show-thread)
5748 (gnus-summary-first-subject t)
5749 (gnus-summary-display-article (gnus-summary-article-number)))
5750 (gnus-summary-position-point)))
5752 (defun gnus-summary-first-article ()
5753 "Select the first article.
5754 Return nil if there are no articles."
5756 (gnus-set-global-variables)
5758 (when (gnus-summary-first-subject)
5759 (gnus-summary-show-thread)
5760 (gnus-summary-first-subject)
5761 (gnus-summary-display-article (gnus-summary-article-number)))
5762 (gnus-summary-position-point)))
5764 (defun gnus-summary-best-unread-article ()
5765 "Select the unread article with the highest score."
5767 (gnus-set-global-variables)
5768 (let ((best -1000000)
5769 (data gnus-newsgroup-data)
5772 (and (gnus-data-unread-p (car data))
5774 (gnus-summary-article-score (gnus-data-number (car data))))
5777 article (gnus-data-number (car data))))
5778 (setq data (cdr data)))
5781 (gnus-summary-goto-article article)
5782 (error "No unread articles"))
5783 (gnus-summary-position-point))))
5785 (defun gnus-summary-last-subject ()
5786 "Go to the last displayed subject line in the group."
5787 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5789 (gnus-summary-goto-subject article))))
5791 (defun gnus-summary-goto-article (article &optional all-headers force)
5792 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5793 If ALL-HEADERS is non-nil, no header lines are hidden."
5797 "Article number or Message-ID: "
5798 (mapcar (lambda (number) (list (int-to-string number)))
5799 gnus-newsgroup-limit))
5803 (if (and (stringp article)
5804 (string-match "@" article))
5805 (gnus-summary-refer-article article)
5806 (when (stringp article)
5807 (setq article (string-to-number article)))
5808 (if (gnus-summary-goto-subject article force)
5809 (gnus-summary-display-article article all-headers)
5810 (gnus-message 4 "Couldn't go to article %s" article) nil))
5811 (gnus-summary-position-point)))
5813 (defun gnus-summary-goto-last-article ()
5814 "Go to the previously read article."
5817 (when gnus-last-article
5818 (gnus-summary-goto-article gnus-last-article))
5819 (gnus-summary-position-point)))
5821 (defun gnus-summary-pop-article (number)
5822 "Pop one article off the history and go to the previous.
5823 NUMBER articles will be popped off."
5826 (setq gnus-newsgroup-history
5827 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5829 (gnus-summary-goto-article (car to) nil t)
5830 (error "Article history empty")))
5831 (gnus-summary-position-point))
5833 ;; Summary commands and functions for limiting the summary buffer.
5835 (defun gnus-summary-limit-to-articles (n)
5836 "Limit the summary buffer to the next N articles.
5837 If not given a prefix, use the process marked articles instead."
5839 (gnus-set-global-variables)
5841 (let ((articles (gnus-summary-work-articles n)))
5842 (setq gnus-newsgroup-processable nil)
5843 (gnus-summary-limit articles))
5844 (gnus-summary-position-point)))
5846 (defun gnus-summary-pop-limit (&optional total)
5847 "Restore the previous limit.
5848 If given a prefix, remove all limits."
5850 (gnus-set-global-variables)
5852 (setq gnus-newsgroup-limits
5853 (list (mapcar (lambda (h) (mail-header-number h))
5854 gnus-newsgroup-headers))))
5855 (unless gnus-newsgroup-limits
5856 (error "No limit to pop"))
5858 (gnus-summary-limit nil 'pop)
5859 (gnus-summary-position-point)))
5861 (defun gnus-summary-limit-to-subject (subject &optional header)
5862 "Limit the summary buffer to articles that have subjects that match a regexp."
5863 (interactive "sLimit to subject (regexp): ")
5865 (setq header "subject"))
5866 (when (not (equal "" subject))
5868 (let ((articles (gnus-summary-find-matching
5869 (or header "subject") subject 'all)))
5871 (error "Found no matches for \"%s\"" subject))
5872 (gnus-summary-limit articles))
5873 (gnus-summary-position-point))))
5875 (defun gnus-summary-limit-to-author (from)
5876 "Limit the summary buffer to articles that have authors that match a regexp."
5877 (interactive "sLimit to author (regexp): ")
5878 (gnus-summary-limit-to-subject from "from"))
5880 (defun gnus-summary-limit-to-age (age &optional younger-p)
5881 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5882 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5883 articles that are younger than AGE days."
5884 (interactive "nTime in days: \nP")
5886 (let ((data gnus-newsgroup-data)
5887 (cutoff (nnmail-days-to-time age))
5888 articles d date is-younger)
5889 (while (setq d (pop data))
5890 (when (and (vectorp (gnus-data-header d))
5891 (setq date (mail-header-date (gnus-data-header d))))
5892 (setq is-younger (nnmail-time-less
5893 (nnmail-time-since (nnmail-date-to-time date))
5895 (when (if younger-p is-younger (not is-younger))
5896 (push (gnus-data-number d) articles))))
5897 (gnus-summary-limit (nreverse articles)))
5898 (gnus-summary-position-point)))
5900 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5902 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5904 (defun gnus-summary-limit-to-unread (&optional all)
5905 "Limit the summary buffer to articles that are not marked as read.
5906 If ALL is non-nil, limit strictly to unread articles."
5909 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5910 (gnus-summary-limit-to-marks
5911 ;; Concat all the marks that say that an article is read and have
5913 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5914 gnus-killed-mark gnus-kill-file-mark
5915 gnus-low-score-mark gnus-expirable-mark
5916 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5917 gnus-duplicate-mark gnus-souped-mark)
5920 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5921 (make-obsolete 'gnus-summary-delete-marked-with
5922 'gnus-summary-limit-exlude-marks)
5924 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5925 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5926 If REVERSE, limit the summary buffer to articles that are marked
5927 with MARKS. MARKS can either be a string of marks or a list of marks.
5928 Returns how many articles were removed."
5929 (interactive "sMarks: ")
5930 (gnus-summary-limit-to-marks marks t))
5932 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5933 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5934 If REVERSE (the prefix), limit the summary buffer to articles that are
5935 not marked with MARKS. MARKS can either be a string of marks or a
5937 Returns how many articles were removed."
5938 (interactive "sMarks: \nP")
5939 (gnus-set-global-variables)
5941 (let ((data gnus-newsgroup-data)
5942 (marks (if (listp marks) marks
5943 (append marks nil))) ; Transform to list.
5946 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5947 (memq (gnus-data-mark (car data)) marks))
5948 (push (gnus-data-number (car data)) articles))
5949 (setq data (cdr data)))
5950 (gnus-summary-limit articles))
5951 (gnus-summary-position-point)))
5953 (defun gnus-summary-limit-to-score (&optional score)
5954 "Limit to articles with score at or above SCORE."
5956 (gnus-set-global-variables)
5957 (setq score (if score
5958 (prefix-numeric-value score)
5959 (or gnus-summary-default-score 0)))
5960 (let ((data gnus-newsgroup-data)
5963 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5965 (push (gnus-data-number (car data)) articles))
5966 (setq data (cdr data)))
5968 (gnus-summary-limit articles)
5969 (gnus-summary-position-point))))
5971 (defun gnus-summary-limit-include-thread (id)
5972 "Display all the hidden articles that in the current thread."
5973 (interactive (mail-header-id (gnus-summary-article-header)))
5974 (gnus-set-global-variables)
5975 (let ((articles (gnus-articles-in-thread
5976 (gnus-id-to-thread (gnus-root-id id)))))
5978 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
5979 (gnus-summary-position-point))))
5981 (defun gnus-summary-limit-include-dormant ()
5982 "Display all the hidden articles that are marked as dormant."
5984 (gnus-set-global-variables)
5985 (unless gnus-newsgroup-dormant
5986 (error "There are no dormant articles in this group"))
5988 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5989 (gnus-summary-position-point)))
5991 (defun gnus-summary-limit-exclude-dormant ()
5992 "Hide all dormant articles."
5994 (gnus-set-global-variables)
5996 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5997 (gnus-summary-position-point)))
5999 (defun gnus-summary-limit-exclude-childless-dormant ()
6000 "Hide all dormant articles that have no children."
6002 (gnus-set-global-variables)
6003 (let ((data (gnus-data-list t))
6004 articles d children)
6005 ;; Find all articles that are either not dormant or have
6007 (while (setq d (pop data))
6008 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6010 (gnus-article-children (gnus-data-number d)))
6013 (when (memq (car children) articles)
6018 (push (gnus-data-number d) articles)))
6021 (gnus-summary-limit articles)
6022 (gnus-summary-position-point))))
6024 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6025 "Mark all unread excluded articles as read.
6026 If ALL, mark even excluded ticked and dormants as read."
6028 (let ((articles (gnus-sorted-complement
6030 (mapcar (lambda (h) (mail-header-number h))
6031 gnus-newsgroup-headers)
6033 (sort gnus-newsgroup-limit '<)))
6035 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
6037 (setq gnus-newsgroup-dormant nil
6038 gnus-newsgroup-marked nil
6039 gnus-newsgroup-reads
6041 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6042 gnus-newsgroup-reads))
6043 (while (setq article (pop articles))
6044 (unless (or (memq article gnus-newsgroup-dormant)
6045 (memq article gnus-newsgroup-marked))
6046 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6048 (defun gnus-summary-limit (articles &optional pop)
6050 ;; We pop the previous limit off the stack and use that.
6051 (setq articles (car gnus-newsgroup-limits)
6052 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6053 ;; We use the new limit, so we push the old limit on the stack.
6054 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6056 (setq gnus-newsgroup-limit articles)
6057 (let ((total (length gnus-newsgroup-data))
6058 (data (gnus-data-find-list (gnus-summary-article-number)))
6059 (gnus-summary-mark-below nil) ; Inhibit this.
6061 ;; This will do all the work of generating the new summary buffer
6062 ;; according to the new limit.
6063 (gnus-summary-prepare)
6064 ;; Hide any threads, possibly.
6065 (and gnus-show-threads
6066 gnus-thread-hide-subtree
6067 (gnus-summary-hide-all-threads))
6068 ;; Try to return to the article you were at, or one in the
6071 ;; We try to find some article after the current one.
6073 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6076 (setq data (cdr data))))
6078 ;; If there is no data, that means that we were after the last
6079 ;; article. The same goes when we can't find any articles
6080 ;; after the current one.
6081 (goto-char (point-max))
6082 (gnus-summary-find-prev))
6083 ;; We return how many articles were removed from the summary
6084 ;; buffer as a result of the new limit.
6085 (- total (length gnus-newsgroup-data))))
6087 (defsubst gnus-invisible-cut-children (threads)
6090 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6095 (defsubst gnus-cut-thread (thread)
6096 "Go forwards in the thread until we find an article that we want to display."
6097 (when (or (eq gnus-fetch-old-headers 'some)
6098 (eq gnus-fetch-old-headers 'invisible)
6099 (eq gnus-build-sparse-threads 'some)
6100 (eq gnus-build-sparse-threads 'more))
6101 ;; Deal with old-fetched headers and sparse threads.
6105 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6106 (gnus-summary-article-ancient-p
6107 (mail-header-number (car thread))))
6108 (if (or (<= (length (cdr thread)) 1)
6109 (eq gnus-fetch-old-headers 'invisible))
6110 (setq gnus-newsgroup-limit
6111 (delq (mail-header-number (car thread))
6112 gnus-newsgroup-limit)
6113 thread (cadr thread))
6114 (when (gnus-invisible-cut-children (cdr thread))
6115 (let ((th (cdr thread)))
6117 (if (memq (mail-header-number (caar th))
6118 gnus-newsgroup-limit)
6119 (setq thread (car th)
6121 (setq th (cdr th))))))))))
6124 (defun gnus-cut-threads (threads)
6125 "Cut off all uninteresting articles from the beginning of threads."
6126 (when (or (eq gnus-fetch-old-headers 'some)
6127 (eq gnus-fetch-old-headers 'invisible)
6128 (eq gnus-build-sparse-threads 'some)
6129 (eq gnus-build-sparse-threads 'more))
6132 (setcar th (gnus-cut-thread (car th)))
6133 (setq th (cdr th)))))
6134 ;; Remove nixed out threads.
6137 (defun gnus-summary-initial-limit (&optional show-if-empty)
6138 "Figure out what the initial limit is supposed to be on group entry.
6139 This entails weeding out unwanted dormants, low-scored articles,
6140 fetch-old-headers verbiage, and so on."
6141 ;; Most groups have nothing to remove.
6142 (if (or gnus-inhibit-limiting
6143 (and (null gnus-newsgroup-dormant)
6144 (not (eq gnus-fetch-old-headers 'some))
6145 (not (eq gnus-fetch-old-headers 'invisible))
6146 (null gnus-summary-expunge-below)
6147 (not (eq gnus-build-sparse-threads 'some))
6148 (not (eq gnus-build-sparse-threads 'more))
6149 (null gnus-thread-expunge-below)
6150 (not gnus-use-nocem)))
6152 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6153 (setq gnus-newsgroup-limit nil)
6156 (unless (car (symbol-value node))
6157 ;; These threads have no parents -- they are roots.
6158 (let ((nodes (cdr (symbol-value node)))
6161 (if (and gnus-thread-expunge-below
6162 (< (gnus-thread-total-score (car nodes))
6163 gnus-thread-expunge-below))
6164 (gnus-expunge-thread (pop nodes))
6165 (setq thread (pop nodes))
6166 (gnus-summary-limit-children thread))))))
6167 gnus-newsgroup-dependencies)
6168 ;; If this limitation resulted in an empty group, we might
6169 ;; pop the previous limit and use it instead.
6170 (when (and (not gnus-newsgroup-limit)
6172 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6173 gnus-newsgroup-limit))
6175 (defun gnus-summary-limit-children (thread)
6176 "Return 1 if this subthread is visible and 0 if it is not."
6177 ;; First we get the number of visible children to this thread. This
6178 ;; is done by recursing down the thread using this function, so this
6179 ;; will really go down to a leaf article first, before slowly
6180 ;; working its way up towards the root.
6184 (apply '+ (mapcar 'gnus-summary-limit-children
6187 (number (mail-header-number (car thread)))
6190 (not (memq number gnus-newsgroup-marked))
6192 ;; If this article is dormant and has absolutely no visible
6193 ;; children, then this article isn't visible.
6194 (and (memq number gnus-newsgroup-dormant)
6196 ;; If this is "fetch-old-headered" and there is no
6197 ;; visible children, then we don't want this article.
6198 (and (eq gnus-fetch-old-headers 'some)
6199 (gnus-summary-article-ancient-p number)
6201 ;; If this is "fetch-old-headered" and `invisible', then
6202 ;; we don't want this article.
6203 (and (eq gnus-fetch-old-headers 'invisible)
6204 (gnus-summary-article-ancient-p number))
6205 ;; If this is a sparsely inserted article with no children,
6206 ;; we don't want it.
6207 (and (eq gnus-build-sparse-threads 'some)
6208 (gnus-summary-article-sparse-p number)
6210 ;; If we use expunging, and this article is really
6211 ;; low-scored, then we don't want this article.
6212 (when (and gnus-summary-expunge-below
6214 (or (cdr (assq number gnus-newsgroup-scored))
6215 gnus-summary-default-score))
6216 gnus-summary-expunge-below))
6217 ;; We increase the expunge-tally here, but that has
6218 ;; nothing to do with the limits, really.
6219 (incf gnus-newsgroup-expunged-tally)
6220 ;; We also mark as read here, if that's wanted.
6221 (when (and gnus-summary-mark-below
6222 (< score gnus-summary-mark-below))
6223 (setq gnus-newsgroup-unreads
6224 (delq number gnus-newsgroup-unreads))
6225 (if gnus-newsgroup-auto-expire
6226 (push number gnus-newsgroup-expirable)
6227 (push (cons number gnus-low-score-mark)
6228 gnus-newsgroup-reads)))
6230 ;; Check NoCeM things.
6231 (if (and gnus-use-nocem
6232 (gnus-nocem-unwanted-article-p
6233 (mail-header-id (car thread))))
6235 (setq gnus-newsgroup-unreads
6236 (delq number gnus-newsgroup-unreads))
6238 ;; Nope, invisible article.
6240 ;; Ok, this article is to be visible, so we add it to the limit
6242 (push number gnus-newsgroup-limit)
6245 (defun gnus-expunge-thread (thread)
6246 "Mark all articles in THREAD as read."
6247 (let* ((number (mail-header-number (car thread))))
6248 (incf gnus-newsgroup-expunged-tally)
6249 ;; We also mark as read here, if that's wanted.
6250 (setq gnus-newsgroup-unreads
6251 (delq number gnus-newsgroup-unreads))
6252 (if gnus-newsgroup-auto-expire
6253 (push number gnus-newsgroup-expirable)
6254 (push (cons number gnus-low-score-mark)
6255 gnus-newsgroup-reads)))
6256 ;; Go recursively through all subthreads.
6257 (mapcar 'gnus-expunge-thread (cdr thread)))
6259 ;; Summary article oriented commands
6261 (defun gnus-summary-refer-parent-article (n)
6262 "Refer parent article N times.
6263 If N is negative, go to ancestor -N instead.
6264 The difference between N and the number of articles fetched is returned."
6266 (gnus-set-global-variables)
6269 (when (not (natnump n))
6274 (setq header (gnus-summary-article-header))
6275 (if (and (eq (mail-header-number header)
6276 (cdr gnus-article-current))
6277 (equal gnus-newsgroup-name
6278 (car gnus-article-current)))
6279 ;; If we try to find the parent of the currently
6280 ;; displayed article, then we take a look at the actual
6281 ;; References header, since this is slightly more
6282 ;; reliable than the References field we got from the
6285 (set-buffer gnus-original-article-buffer)
6286 (nnheader-narrow-to-headers)
6287 (unless (setq ref (message-fetch-field "references"))
6288 (setq ref (message-fetch-field "in-reply-to")))
6291 ;; It's not the current article, so we take a bet on
6292 ;; the value we got from the server.
6293 (mail-header-references header)))
6295 (not (equal ref "")))
6296 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6297 (gnus-message 1 "Couldn't find parent"))
6298 (gnus-message 1 "No references in article %d"
6299 (gnus-summary-article-number))
6302 (gnus-summary-position-point)
6305 (defun gnus-summary-refer-references ()
6306 "Fetch all articles mentioned in the References header.
6307 Return the number of articles fetched."
6309 (gnus-set-global-variables)
6310 (let ((ref (mail-header-references (gnus-summary-article-header)))
6311 (current (gnus-summary-article-number))
6315 (error "No References in the current article")
6316 ;; For each Message-ID in the References header...
6317 (while (string-match "<[^>]*>" ref)
6319 ;; ... fetch that article.
6320 (gnus-summary-refer-article
6321 (prog1 (match-string 0 ref)
6322 (setq ref (substring ref (match-end 0))))))
6323 (gnus-summary-goto-subject current)
6324 (gnus-summary-position-point)
6327 (defun gnus-summary-refer-thread (&optional limit)
6328 "Fetch all articles in the current thread.
6329 If LIMIT (the numerical prefix), fetch that many old headers instead
6330 of what's specified by the `gnus-refer-thread-limit' variable."
6332 (gnus-set-global-variables)
6333 (let ((id (mail-header-id (gnus-summary-article-header)))
6334 (limit (if limit (prefix-numeric-value limit)
6335 gnus-refer-thread-limit))
6337 ;; We want to fetch LIMIT *old* headers, but we also have to
6338 ;; re-fetch all the headers in the current buffer, because many of
6339 ;; them may be undisplayed. So we adjust LIMIT.
6340 (when (numberp limit)
6341 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6342 (unless (eq gnus-fetch-old-headers 'invisible)
6343 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6344 ;; Retrieve the headers and read them in.
6345 (if (eq (gnus-retrieve-headers
6346 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6348 (gnus-build-all-threads)
6349 (error "Can't fetch thread from backends that don't support NOV"))
6350 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6351 (gnus-summary-limit-include-thread id)))
6353 (defun gnus-summary-refer-article (message-id &optional arg)
6354 "Fetch an article specified by MESSAGE-ID.
6355 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6356 or `gnus-select-method', no matter what backend the article comes from."
6357 (interactive "sMessage-ID: \nP")
6358 (when (and (stringp message-id)
6359 (not (zerop (length message-id))))
6360 ;; Construct the correct Message-ID if necessary.
6361 ;; Suggested by tale@pawl.rpi.edu.
6362 (unless (string-match "^<" message-id)
6363 (setq message-id (concat "<" message-id)))
6364 (unless (string-match ">$" message-id)
6365 (setq message-id (concat message-id ">")))
6366 (let* ((header (gnus-id-to-header message-id))
6368 (gnus-summary-article-sparse-p
6369 (mail-header-number header))
6370 (memq (mail-header-number header)
6371 gnus-newsgroup-limit))))
6373 (or (not (gnus-summary-article-sparse-p
6374 (mail-header-number header)))
6377 ;; The article is present in the buffer, so we just go to it.
6378 (gnus-summary-goto-article
6379 (mail-header-number header) nil t)
6381 (gnus-summary-update-article (mail-header-number header))))
6382 ;; We fetch the article
6383 (let ((gnus-override-method
6384 (cond ((gnus-news-group-p gnus-newsgroup-name)
6385 gnus-refer-article-method)
6387 (or gnus-refer-article-method gnus-select-method))
6390 ;; Start the special refer-article method, if necessary.
6391 (when (and gnus-refer-article-method
6392 (gnus-news-group-p gnus-newsgroup-name))
6393 (gnus-check-server gnus-refer-article-method))
6394 ;; Fetch the header, and display the article.
6395 (if (setq number (gnus-summary-insert-subject message-id))
6396 (gnus-summary-select-article nil nil nil number)
6397 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6399 (defun gnus-summary-enter-digest-group (&optional force)
6400 "Enter an nndoc group based on the current article.
6401 If FORCE, force a digest interpretation. If not, try
6402 to guess what the document format is."
6404 (gnus-set-global-variables)
6405 (let ((conf gnus-current-window-configuration))
6407 (gnus-summary-select-article))
6408 (setq gnus-current-window-configuration conf)
6409 (let* ((name (format "%s-%d"
6410 (gnus-group-prefixed-name
6411 gnus-newsgroup-name (list 'nndoc ""))
6413 (set-buffer gnus-summary-buffer)
6414 gnus-current-article)))
6415 (ogroup gnus-newsgroup-name)
6416 (params (append (gnus-info-params (gnus-get-info ogroup))
6417 (list (cons 'to-group ogroup))
6418 (list (cons 'save-article-group ogroup))))
6419 (case-fold-search t)
6420 (buf (current-buffer))
6423 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6424 (insert-buffer-substring gnus-original-article-buffer)
6425 ;; Remove lines that may lead nndoc to misinterpret the
6428 (goto-char (point-min))
6429 (or (search-forward "\n\n" nil t) (point)))
6430 (goto-char (point-min))
6431 (delete-matching-lines "^\\(Path\\):\\|^From ")
6434 (if (gnus-group-read-ephemeral-group
6435 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6437 ,(if force 'digest 'guess))) t)
6438 ;; Make all postings to this group go to the parent group.
6439 (nconc (gnus-info-params (gnus-get-info name))
6441 ;; Couldn't select this doc group.
6442 (switch-to-buffer buf)
6443 (gnus-set-global-variables)
6444 (gnus-configure-windows 'summary)
6445 (gnus-message 3 "Article couldn't be entered?"))
6446 (kill-buffer dig)))))
6448 (defun gnus-summary-read-document (n)
6449 "Open a new group based on the current article(s).
6450 This will allow you to read digests and other similar
6451 documents as newsgroups.
6452 Obeys the standard process/prefix convention."
6454 (let* ((articles (gnus-summary-work-articles n))
6455 (ogroup gnus-newsgroup-name)
6456 (params (append (gnus-info-params (gnus-get-info ogroup))
6457 (list (cons 'to-group ogroup))))
6458 article group egroup groups vgroup)
6459 (while (setq article (pop articles))
6460 (setq group (format "%s-%d" gnus-newsgroup-name article))
6461 (gnus-summary-remove-process-mark article)
6462 (when (gnus-summary-display-article article)
6464 (nnheader-temp-write nil
6465 (insert-buffer-substring gnus-original-article-buffer)
6466 ;; Remove some headers that may lead nndoc to make
6468 (message-narrow-to-head)
6469 (goto-char (point-min))
6470 (delete-matching-lines "^\\(Path\\):\\|^From ")
6473 (gnus-group-read-ephemeral-group
6474 group `(nndoc ,group (nndoc-address ,(current-buffer))
6475 (nndoc-article-type guess))
6478 ;; Make all postings to this group go to the parent group.
6479 (nconc (gnus-info-params (gnus-get-info egroup))
6481 (push egroup groups))
6482 ;; Couldn't select this doc group.
6483 (gnus-error 3 "Article couldn't be entered"))))))
6484 ;; Now we have selected all the documents.
6487 (error "None of the articles could be interpreted as documents"))
6488 ((gnus-group-read-ephemeral-group
6489 (setq vgroup (format
6490 "nnvirtual:%s-%s" gnus-newsgroup-name
6491 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6492 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6494 (cons (current-buffer) 'summary)))
6496 (error "Couldn't select virtual nndoc group")))))
6498 (defun gnus-summary-isearch-article (&optional regexp-p)
6499 "Do incremental search forward on the current article.
6500 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6502 (gnus-set-global-variables)
6503 (gnus-summary-select-article)
6504 (gnus-configure-windows 'article)
6505 (gnus-eval-in-buffer-window gnus-article-buffer
6506 ;;(goto-char (point-min))
6507 (isearch-forward regexp-p)))
6509 (defun gnus-summary-search-article-forward (regexp &optional backward)
6510 "Search for an article containing REGEXP forward.
6511 If BACKWARD, search backward instead."
6514 (format "Search article %s (regexp%s): "
6515 (if current-prefix-arg "backward" "forward")
6516 (if gnus-last-search-regexp
6517 (concat ", default " gnus-last-search-regexp)
6519 current-prefix-arg))
6520 (gnus-set-global-variables)
6521 (if (string-equal regexp "")
6522 (setq regexp (or gnus-last-search-regexp ""))
6523 (setq gnus-last-search-regexp regexp))
6524 (if (gnus-summary-search-article regexp backward)
6525 (gnus-summary-show-thread)
6526 (error "Search failed: \"%s\"" regexp)))
6528 (defun gnus-summary-search-article-backward (regexp)
6529 "Search for an article containing REGEXP backward."
6532 (format "Search article backward (regexp%s): "
6533 (if gnus-last-search-regexp
6534 (concat ", default " gnus-last-search-regexp)
6536 (gnus-summary-search-article-forward regexp 'backward))
6538 (defun gnus-summary-search-article (regexp &optional backward)
6539 "Search for an article containing REGEXP.
6540 Optional argument BACKWARD means do search for backward.
6541 `gnus-select-article-hook' is not called during the search."
6542 ;; We have to require this here to make sure that the following
6543 ;; dynamic binding isn't shadowed by autoloading.
6544 (require 'gnus-async)
6545 (let ((gnus-select-article-hook nil) ;Disable hook.
6546 (gnus-article-display-hook nil)
6547 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6548 (gnus-use-article-prefetch nil)
6549 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6550 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6551 (sum (current-buffer))
6554 (gnus-save-hidden-threads
6555 (gnus-summary-select-article)
6556 (set-buffer gnus-article-buffer)
6560 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6562 (re-search-backward regexp nil t)
6563 (re-search-forward regexp nil t))
6564 ;; We found the regexp.
6569 (get-buffer-window (current-buffer))
6573 (setq point (point)))
6574 ;; We didn't find it, so we go to the next article.
6577 (while (eq found 'not)
6578 (if (not (if backward (gnus-summary-find-prev)
6579 (gnus-summary-find-next)))
6580 ;; No more articles.
6582 ;; Select the next article and adjust point.
6583 (unless (gnus-summary-article-sparse-p
6584 (gnus-summary-article-number))
6586 (gnus-summary-select-article)
6587 (set-buffer gnus-article-buffer)
6589 (goto-char (if backward (point-max) (point-min))))))))
6590 (gnus-message 7 ""))
6591 ;; Return whether we found the regexp.
6592 (when (eq found 'found)
6594 (gnus-summary-show-thread)
6595 (gnus-summary-goto-subject gnus-current-article)
6596 (gnus-summary-position-point)
6599 (defun gnus-summary-find-matching (header regexp &optional backward unread
6601 "Return a list of all articles that match REGEXP on HEADER.
6602 The search stars on the current article and goes forwards unless
6603 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6604 If UNREAD is non-nil, only unread articles will
6605 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6606 in the comparisons."
6607 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6608 (gnus-data-find-list
6609 (gnus-summary-article-number) (gnus-data-list backward))))
6610 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6611 (case-fold-search (not not-case-fold))
6613 (unless (fboundp (intern (concat "mail-header-" header)))
6614 (error "%s is not a valid header" header))
6617 (and (or (not unread) ; We want all articles...
6618 (gnus-data-unread-p d)) ; Or just unreads.
6619 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6620 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6621 (push (gnus-data-number d) articles)) ; Success!
6622 (setq data (cdr data)))
6623 (nreverse articles)))
6625 (defun gnus-summary-execute-command (header regexp command &optional backward)
6626 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6627 If HEADER is an empty string (or nil), the match is done on the entire
6628 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6630 (list (let ((completion-ignore-case t))
6633 (mapcar (lambda (string) (list string))
6634 '("Number" "Subject" "From" "Lines" "Date"
6635 "Message-ID" "Xref" "References" "Body"))
6636 nil 'require-match))
6637 (read-string "Regexp: ")
6638 (read-key-sequence "Command: ")
6639 current-prefix-arg))
6640 (when (equal header "Body")
6642 (gnus-set-global-variables)
6643 ;; Hidden thread subtrees must be searched as well.
6644 (gnus-summary-show-all-threads)
6645 ;; We don't want to change current point nor window configuration.
6647 (save-window-excursion
6648 (gnus-message 6 "Executing %s..." (key-description command))
6649 ;; We'd like to execute COMMAND interactively so as to give arguments.
6650 (gnus-execute header regexp
6651 `(call-interactively ',(key-binding command))
6653 (gnus-message 6 "Executing %s...done" (key-description command)))))
6655 (defun gnus-summary-beginning-of-article ()
6656 "Scroll the article back to the beginning."
6658 (gnus-set-global-variables)
6659 (gnus-summary-select-article)
6660 (gnus-configure-windows 'article)
6661 (gnus-eval-in-buffer-window gnus-article-buffer
6663 (goto-char (point-min))
6664 (when gnus-page-broken
6665 (gnus-narrow-to-page))))
6667 (defun gnus-summary-end-of-article ()
6668 "Scroll to the end of the article."
6670 (gnus-set-global-variables)
6671 (gnus-summary-select-article)
6672 (gnus-configure-windows 'article)
6673 (gnus-eval-in-buffer-window gnus-article-buffer
6675 (goto-char (point-max))
6677 (when gnus-page-broken
6678 (gnus-narrow-to-page))))
6680 (defun gnus-summary-print-article (&optional filename)
6681 "Generate and print a PostScript image of the article buffer.
6683 If the optional argument FILENAME is nil, send the image to the printer.
6684 If FILENAME is a string, save the PostScript image in a file with that
6685 name. If FILENAME is a number, prompt the user for the name of the file
6687 (interactive (list (ps-print-preprint current-prefix-arg)))
6688 (gnus-summary-select-article)
6689 (gnus-eval-in-buffer-window gnus-article-buffer
6690 (let ((buffer (generate-new-buffer " *print*")))
6693 (copy-to-buffer buffer (point-min) (point-max))
6695 (gnus-article-delete-invisible-text)
6696 (run-hooks 'gnus-ps-print-hook)
6697 (ps-print-buffer-with-faces filename))
6698 (kill-buffer buffer)))))
6700 (defun gnus-summary-show-article (&optional arg)
6701 "Force re-fetching of the current article.
6702 If ARG (the prefix) is non-nil, show the raw article without any
6703 article massaging functions being run."
6705 (gnus-set-global-variables)
6707 ;; Select the article the normal way.
6708 (gnus-summary-select-article nil 'force)
6709 ;; Bind the article treatment functions to nil.
6710 (let ((gnus-have-all-headers t)
6711 gnus-article-display-hook
6712 gnus-article-prepare-hook
6716 (gnus-summary-select-article nil 'force)))
6717 (gnus-summary-goto-subject gnus-current-article)
6718 (gnus-summary-position-point))
6720 (defun gnus-summary-verbose-headers (&optional arg)
6721 "Toggle permanent full header display.
6722 If ARG is a positive number, turn header display on.
6723 If ARG is a negative number, turn header display off."
6725 (gnus-set-global-variables)
6726 (setq gnus-show-all-headers
6727 (cond ((or (not (numberp arg))
6729 (not gnus-show-all-headers))
6732 (gnus-summary-show-article))
6734 (defun gnus-summary-toggle-header (&optional arg)
6735 "Show the headers if they are hidden, or hide them if they are shown.
6736 If ARG is a positive number, show the entire header.
6737 If ARG is a negative number, hide the unwanted header lines."
6739 (gnus-set-global-variables)
6741 (set-buffer gnus-article-buffer)
6742 (let* ((buffer-read-only nil)
6743 (inhibit-point-motion-hooks t)
6744 (hidden (text-property-any
6745 (goto-char (point-min)) (search-forward "\n\n")
6748 (goto-char (point-min))
6749 (when (search-forward "\n\n" nil t)
6750 (delete-region (point-min) (1- (point))))
6751 (goto-char (point-min))
6753 (set-buffer gnus-original-article-buffer)
6754 (goto-char (point-min))
6755 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6756 (insert-buffer-substring gnus-original-article-buffer 1 e)
6757 (let ((article-inhibit-hiding t))
6758 (run-hooks 'gnus-article-display-hook))
6759 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6760 (gnus-article-hide-headers)))))
6762 (defun gnus-summary-show-all-headers ()
6763 "Make all header lines visible."
6765 (gnus-set-global-variables)
6766 (gnus-article-show-all-headers))
6768 (defun gnus-summary-toggle-mime (&optional arg)
6769 "Toggle MIME processing.
6770 If ARG is a positive number, turn MIME processing on."
6772 (gnus-set-global-variables)
6773 (setq gnus-show-mime
6774 (if (null arg) (not gnus-show-mime)
6775 (> (prefix-numeric-value arg) 0)))
6776 (gnus-summary-select-article t 'force))
6778 (defun gnus-summary-caesar-message (&optional arg)
6779 "Caesar rotate the current article by 13.
6780 The numerical prefix specifies how many places to rotate each letter
6783 (gnus-set-global-variables)
6784 (gnus-summary-select-article)
6785 (let ((mail-header-separator ""))
6786 (gnus-eval-in-buffer-window gnus-article-buffer
6789 (let ((start (window-start))
6791 (message-caesar-buffer-body arg)
6792 (set-window-start (get-buffer-window (current-buffer)) start))))))
6794 (defun gnus-summary-stop-page-breaking ()
6795 "Stop page breaking in the current article."
6797 (gnus-set-global-variables)
6798 (gnus-summary-select-article)
6799 (gnus-eval-in-buffer-window gnus-article-buffer
6801 (when (gnus-visual-p 'page-marker)
6802 (let ((buffer-read-only nil))
6803 (gnus-remove-text-with-property 'gnus-prev)
6804 (gnus-remove-text-with-property 'gnus-next)))))
6806 (defun gnus-summary-move-article (&optional n to-newsgroup
6807 select-method action)
6808 "Move the current article to a different newsgroup.
6809 If N is a positive number, move the N next articles.
6810 If N is a negative number, move the N previous articles.
6811 If N is nil and any articles have been marked with the process mark,
6812 move those articles instead.
6813 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6814 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6815 re-spool using this method.
6817 For this function to work, both the current newsgroup and the
6818 newsgroup that you want to move to have to support the `request-move'
6819 and `request-accept' functions."
6822 (setq action 'move))
6823 (gnus-set-global-variables)
6824 ;; Disable marking as read.
6825 (let (gnus-mark-article-hook)
6826 (save-window-excursion
6827 (gnus-summary-select-article)))
6828 ;; Check whether the source group supports the required functions.
6829 (cond ((and (eq action 'move)
6830 (not (gnus-check-backend-function
6831 'request-move-article gnus-newsgroup-name)))
6832 (error "The current group does not support article moving"))
6833 ((and (eq action 'crosspost)
6834 (not (gnus-check-backend-function
6835 'request-replace-article gnus-newsgroup-name)))
6836 (error "The current group does not support article editing")))
6837 (let ((articles (gnus-summary-work-articles n))
6838 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6839 (names '((move "Move" "Moving")
6840 (copy "Copy" "Copying")
6841 (crosspost "Crosspost" "Crossposting")))
6842 (copy-buf (save-excursion
6843 (nnheader-set-temp-buffer " *copy article*")))
6844 art-group to-method new-xref article to-groups)
6845 (unless (assq action names)
6846 (error "Unknown action %s" action))
6847 ;; Read the newsgroup name.
6848 (when (and (not to-newsgroup)
6849 (not select-method))
6851 (gnus-read-move-group-name
6852 (cadr (assq action names))
6853 (symbol-value (intern (format "gnus-current-%s-group" action)))
6855 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6856 (setq to-method (or select-method
6857 (gnus-group-name-to-method to-newsgroup)))
6858 ;; Check the method we are to move this article to...
6859 (unless (gnus-check-backend-function
6860 'request-accept-article (car to-method))
6861 (error "%s does not support article copying" (car to-method)))
6862 (unless (gnus-check-server to-method)
6863 (error "Can't open server %s" (car to-method)))
6864 (gnus-message 6 "%s to %s: %s..."
6865 (caddr (assq action names))
6866 (or (car select-method) to-newsgroup) articles)
6868 (setq article (pop articles))
6872 ;; Move the article.
6874 ;; Remove this article from future suppression.
6875 (gnus-dup-unsuppress-article article)
6876 (gnus-request-move-article
6877 article ; Article to move
6878 gnus-newsgroup-name ; From newsgroup
6879 (nth 1 (gnus-find-method-for-group
6880 gnus-newsgroup-name)) ; Server
6881 (list 'gnus-request-accept-article
6882 to-newsgroup (list 'quote select-method)
6883 (not articles)) ; Accept form
6884 (not articles))) ; Only save nov last time
6885 ;; Copy the article.
6888 (set-buffer copy-buf)
6889 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6890 (gnus-request-accept-article
6891 to-newsgroup select-method (not articles))))
6892 ;; Crosspost the article.
6893 ((eq action 'crosspost)
6894 (let ((xref (message-tokenize-header
6895 (mail-header-xref (gnus-summary-article-header article))
6897 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6900 (setq xref (list (system-name))))
6903 (mapconcat 'identity
6904 (delete "Xref:" (delete new-xref xref))
6908 (set-buffer copy-buf)
6909 ;; First put the article in the destination group.
6910 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6911 (when (consp (setq art-group
6912 (gnus-request-accept-article
6913 to-newsgroup select-method (not articles))))
6914 (setq new-xref (concat new-xref " " (car art-group)
6915 ":" (cdr art-group)))
6916 ;; Now we have the new Xrefs header, so we insert
6917 ;; it and replace the new article.
6918 (nnheader-replace-header "Xref" new-xref)
6919 (gnus-request-replace-article
6920 (cdr art-group) to-newsgroup (current-buffer))
6924 (gnus-message 1 "Couldn't %s article %s"
6925 (cadr (assq action names)) article))
6926 ((and (eq art-group 'junk)
6928 (gnus-summary-mark-article article gnus-canceled-mark)
6929 (gnus-message 4 "Deleted article %s" article))
6933 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6935 (gnus-group-prefixed-name
6938 (gnus-find-method-for-group to-newsgroup)))
6939 gnus-newsrc-hashtb)))
6940 (info (nth 2 entry))
6941 (to-group (gnus-info-group info)))
6942 ;; Update the group that has been moved to.
6944 (memq action '(move copy)))
6945 (unless (member to-group to-groups)
6946 (push to-group to-groups))
6948 (unless (memq article gnus-newsgroup-unreads)
6950 info (gnus-add-to-range (gnus-info-read info)
6951 (list (cdr art-group)))))
6953 ;; Copy any marks over to the new group.
6954 (let ((marks gnus-article-mark-lists)
6955 (to-article (cdr art-group)))
6957 ;; See whether the article is to be put in the cache.
6958 (when gnus-use-cache
6959 (gnus-cache-possibly-enter-article
6961 (let ((header (copy-sequence
6962 (gnus-summary-article-header article))))
6963 (mail-header-set-number header to-article)
6965 (memq article gnus-newsgroup-marked)
6966 (memq article gnus-newsgroup-dormant)
6967 (memq article gnus-newsgroup-unreads)))
6969 (when (and (equal to-group gnus-newsgroup-name)
6970 (not (memq article gnus-newsgroup-unreads)))
6971 ;; Mark this article as read in this group.
6972 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6973 (setcdr (gnus-active to-group) to-article)
6974 (setcdr gnus-newsgroup-active to-article))
6977 (when (memq article (symbol-value
6978 (intern (format "gnus-newsgroup-%s"
6980 ;; If the other group is the same as this group,
6981 ;; then we have to add the mark to the list.
6982 (when (equal to-group gnus-newsgroup-name)
6983 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6986 (intern (format "gnus-newsgroup-%s"
6988 ;; Copy the marks to other group.
6989 (gnus-add-marked-articles
6990 to-group (cdar marks) (list to-article) info))
6991 (setq marks (cdr marks)))
6994 (concat "(gnus-group-set-info '"
6995 (gnus-prin1-to-string (gnus-get-info to-group))
6998 ;; Update the Xref header in this article to point to
6999 ;; the new crossposted article we have just created.
7000 (when (eq action 'crosspost)
7002 (set-buffer copy-buf)
7003 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7004 (nnheader-replace-header "Xref" new-xref)
7005 (gnus-request-replace-article
7006 article gnus-newsgroup-name (current-buffer)))))
7008 (gnus-summary-goto-subject article)
7009 (when (eq action 'move)
7010 (gnus-summary-mark-article article gnus-canceled-mark))))
7011 (gnus-summary-remove-process-mark article))
7012 ;; Re-activate all groups that have been moved to.
7015 (set-buffer gnus-group-buffer)
7016 (when (gnus-group-goto-group (car to-groups) t)
7017 (gnus-group-get-new-news-this-group 1 t))
7020 (gnus-kill-buffer copy-buf)
7021 (gnus-summary-position-point)
7022 (gnus-set-mode-line 'summary)))
7024 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7025 "Move the current article to a different newsgroup.
7026 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7027 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7028 re-spool using this method."
7030 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7032 (defun gnus-summary-crosspost-article (&optional n)
7033 "Crosspost the current article to some other group."
7035 (gnus-summary-move-article n nil nil 'crosspost))
7037 (defcustom gnus-summary-respool-default-method nil
7038 "Default method for respooling an article.
7039 If nil, use to the current newsgroup method."
7040 :type `(choice (gnus-select-method :value (nnml ""))
7042 :group 'gnus-summary-mail)
7044 (defun gnus-summary-respool-article (&optional n method)
7045 "Respool the current article.
7046 The article will be squeezed through the mail spooling process again,
7047 which means that it will be put in some mail newsgroup or other
7048 depending on `nnmail-split-methods'.
7049 If N is a positive number, respool the N next articles.
7050 If N is a negative number, respool the N previous articles.
7051 If N is nil and any articles have been marked with the process mark,
7052 respool those articles instead.
7054 Respooling can be done both from mail groups and \"real\" newsgroups.
7055 In the former case, the articles in question will be moved from the
7056 current group into whatever groups they are destined to. In the
7057 latter case, they will be copied into the relevant groups."
7059 (list current-prefix-arg
7060 (let* ((methods (gnus-methods-using 'respool))
7062 (symbol-name (or gnus-summary-respool-default-method
7063 (car (gnus-find-method-for-group
7064 gnus-newsgroup-name)))))
7066 (gnus-completing-read
7067 methname "What backend do you want to use when respooling?"
7068 methods nil t nil 'gnus-mail-method-history))
7071 ((zerop (length (setq ms (gnus-servers-using-backend
7073 (list (intern method) ""))
7077 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7078 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7080 (gnus-set-global-variables)
7082 (error "No method given for respooling"))
7083 (if (assoc (symbol-name
7084 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7085 (gnus-methods-using 'respool))
7086 (gnus-summary-move-article n nil method)
7087 (gnus-summary-copy-article n nil method)))
7089 (defun gnus-summary-import-article (file)
7090 "Import a random file into a mail newsgroup."
7091 (interactive "fImport file: ")
7092 (gnus-set-global-variables)
7093 (let ((group gnus-newsgroup-name)
7094 (now (current-time))
7096 (unless (gnus-check-backend-function 'request-accept-article group)
7097 (error "%s does not support article importing" group))
7098 (or (file-readable-p file)
7099 (not (file-regular-p file))
7100 (error "Can't read %s" file))
7102 (set-buffer (get-buffer-create " *import file*"))
7103 (buffer-disable-undo (current-buffer))
7105 (insert-file-contents file)
7106 (goto-char (point-min))
7107 (unless (nnheader-article-p)
7108 ;; This doesn't look like an article, so we fudge some headers.
7109 (setq atts (file-attributes file)
7110 lines (count-lines (point-min) (point-max)))
7111 (insert "From: " (read-string "From: ") "\n"
7112 "Subject: " (read-string "Subject: ") "\n"
7113 "Date: " (timezone-make-date-arpa-standard
7114 (current-time-string (nth 5 atts))
7115 (current-time-zone now)
7116 (current-time-zone now))
7118 "Message-ID: " (message-make-message-id) "\n"
7119 "Lines: " (int-to-string lines) "\n"
7120 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7121 (gnus-request-accept-article group nil t)
7122 (kill-buffer (current-buffer)))))
7124 (defun gnus-summary-article-posted-p ()
7125 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7126 This will be the case if the article has both been mailed and posted."
7128 (let ((id (mail-header-references (gnus-summary-article-header)))
7129 (gnus-override-method
7130 (or gnus-refer-article-method gnus-select-method)))
7131 (if (gnus-request-head id "")
7132 (gnus-message 2 "The current message was found on %s"
7133 gnus-override-method)
7134 (gnus-message 2 "The current message couldn't be found on %s"
7135 gnus-override-method)
7138 (defun gnus-summary-expire-articles (&optional now)
7139 "Expire all articles that are marked as expirable in the current group."
7141 (gnus-set-global-variables)
7142 (when (gnus-check-backend-function
7143 'request-expire-articles gnus-newsgroup-name)
7144 ;; This backend supports expiry.
7145 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7146 (expirable (if total
7148 ;; We need to update the info for
7149 ;; this group for `gnus-list-of-read-articles'
7150 ;; to give us the right answer.
7151 (run-hooks 'gnus-exit-group-hook)
7152 (gnus-summary-update-info)
7153 (gnus-list-of-read-articles gnus-newsgroup-name))
7154 (setq gnus-newsgroup-expirable
7155 (sort gnus-newsgroup-expirable '<))))
7156 (expiry-wait (if now 'immediate
7157 (gnus-group-find-parameter
7158 gnus-newsgroup-name 'expiry-wait)))
7161 ;; There are expirable articles in this group, so we run them
7162 ;; through the expiry process.
7163 (gnus-message 6 "Expiring articles...")
7164 ;; The list of articles that weren't expired is returned.
7166 (let ((nnmail-expiry-wait-function nil)
7167 (nnmail-expiry-wait expiry-wait))
7168 (setq es (gnus-request-expire-articles
7169 expirable gnus-newsgroup-name)))
7170 (setq es (gnus-request-expire-articles
7171 expirable gnus-newsgroup-name)))
7173 (setq gnus-newsgroup-expirable es))
7174 ;; We go through the old list of expirable, and mark all
7175 ;; really expired articles as nonexistent.
7176 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7177 (let ((gnus-use-cache nil))
7179 (unless (memq (car expirable) es)
7180 (when (gnus-data-find (car expirable))
7181 (gnus-summary-mark-article
7182 (car expirable) gnus-canceled-mark)))
7183 (setq expirable (cdr expirable)))))
7184 (gnus-message 6 "Expiring articles...done")))))
7186 (defun gnus-summary-expire-articles-now ()
7187 "Expunge all expirable articles in the current group.
7188 This means that *all* articles that are marked as expirable will be
7189 deleted forever, right now."
7191 (gnus-set-global-variables)
7192 (or gnus-expert-user
7194 "Are you really, really, really sure you want to delete all these messages? ")
7196 (gnus-summary-expire-articles t))
7198 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7199 (defun gnus-summary-delete-article (&optional n)
7200 "Delete the N next (mail) articles.
7201 This command actually deletes articles. This is not a marking
7202 command. The article will disappear forever from your life, never to
7204 If N is negative, delete backwards.
7205 If N is nil and articles have been marked with the process mark,
7206 delete these instead."
7208 (gnus-set-global-variables)
7209 (unless (gnus-check-backend-function 'request-expire-articles
7210 gnus-newsgroup-name)
7211 (error "The current newsgroup does not support article deletion"))
7212 ;; Compute the list of articles to delete.
7213 (let ((articles (gnus-summary-work-articles n))
7215 (if (and gnus-novice-user
7216 (not (gnus-yes-or-no-p
7217 (format "Do you really want to delete %s forever? "
7218 (if (> (length articles) 1)
7219 (format "these %s articles" (length articles))
7222 ;; Delete the articles.
7223 (setq not-deleted (gnus-request-expire-articles
7224 articles gnus-newsgroup-name 'force))
7226 (gnus-summary-remove-process-mark (car articles))
7227 ;; The backend might not have been able to delete the article
7229 (unless (memq (car articles) not-deleted)
7230 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7231 (setq articles (cdr articles)))
7233 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7234 (gnus-summary-position-point)
7235 (gnus-set-mode-line 'summary)
7238 (defun gnus-summary-edit-article (&optional force)
7239 "Edit the current article.
7240 This will have permanent effect only in mail groups.
7241 If FORCE is non-nil, allow editing of articles even in read-only
7245 (set-buffer gnus-summary-buffer)
7246 (gnus-set-global-variables)
7247 (when (and (not force)
7248 (gnus-group-read-only-p))
7249 (error "The current newsgroup does not support article editing"))
7250 ;; Select article if needed.
7251 (unless (eq (gnus-summary-article-number)
7252 gnus-current-article)
7253 (gnus-summary-select-article t))
7254 (gnus-article-date-original)
7255 (gnus-article-edit-article
7256 `(lambda (no-highlight)
7257 (gnus-summary-edit-article-done
7258 ,(or (mail-header-references gnus-current-headers) "")
7259 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7261 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7263 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7265 "Make edits to the current article permanent."
7267 ;; Replace the article.
7268 (if (and (not read-only)
7269 (not (gnus-request-replace-article
7270 (cdr gnus-article-current) (car gnus-article-current)
7272 (error "Couldn't replace article")
7273 ;; Update the summary buffer.
7275 (equal (message-tokenize-header references " ")
7276 (message-tokenize-header
7277 (or (message-fetch-field "references") "") " ")))
7278 ;; We only have to update this line.
7281 (message-narrow-to-head)
7282 (let ((head (buffer-string))
7284 (nnheader-temp-write nil
7285 (insert (format "211 %d Article retrieved.\n"
7286 (cdr gnus-article-current)))
7289 (let ((nntp-server-buffer (current-buffer)))
7290 (setq header (car (gnus-get-newsgroup-headers
7292 (set-buffer gnus-summary-buffer)
7293 gnus-newsgroup-dependencies)
7296 (set-buffer gnus-summary-buffer)
7297 (gnus-data-set-header
7298 (gnus-data-find (cdr gnus-article-current))
7300 (gnus-summary-update-article-line
7301 (cdr gnus-article-current) header))))))
7303 (set-buffer (or buffer gnus-summary-buffer))
7304 (gnus-summary-update-article (cdr gnus-article-current)))
7305 ;; Prettify the article buffer again.
7306 (unless no-highlight
7308 (set-buffer gnus-article-buffer)
7309 (run-hooks 'gnus-article-display-hook)
7310 (set-buffer gnus-original-article-buffer)
7311 (gnus-request-article
7312 (cdr gnus-article-current)
7313 (car gnus-article-current) (current-buffer))))
7314 ;; Prettify the summary buffer line.
7315 (when (gnus-visual-p 'summary-highlight 'highlight)
7316 (run-hooks 'gnus-visual-mark-article-hook))))
7318 (defun gnus-summary-edit-wash (key)
7319 "Perform editing command in the article buffer."
7323 (message "%s" (concat (this-command-keys) "- "))
7326 (gnus-summary-edit-article)
7327 (execute-kbd-macro (concat (this-command-keys) key))
7328 (gnus-article-edit-done))
7332 (defun gnus-summary-respool-query (&optional silent)
7333 "Query where the respool algorithm would put this article."
7335 (gnus-set-global-variables)
7336 (let (gnus-mark-article-hook)
7337 (gnus-summary-select-article)
7339 (set-buffer gnus-original-article-buffer)
7341 (message-narrow-to-head)
7342 (let ((groups (nnmail-article-group 'identity)))
7345 (message "This message would go to %s"
7346 (mapconcat 'car groups ", "))
7347 (message "This message would go to no groups"))
7350 ;; Summary marking commands.
7352 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7353 "Mark articles which has the same subject as read, and then select the next.
7354 If UNMARK is positive, remove any kind of mark.
7355 If UNMARK is negative, tick articles."
7357 (gnus-set-global-variables)
7359 (setq unmark (prefix-numeric-value unmark)))
7361 (gnus-summary-mark-same-subject
7362 (gnus-summary-article-subject) unmark)))
7363 ;; Select next unread article. If auto-select-same mode, should
7364 ;; select the first unread article.
7365 (gnus-summary-next-article t (and gnus-auto-select-same
7366 (gnus-summary-article-subject)))
7367 (gnus-message 7 "%d article%s marked as %s"
7368 count (if (= count 1) " is" "s are")
7369 (if unmark "unread" "read"))))
7371 (defun gnus-summary-kill-same-subject (&optional unmark)
7372 "Mark articles which has the same subject as read.
7373 If UNMARK is positive, remove any kind of mark.
7374 If UNMARK is negative, tick articles."
7376 (gnus-set-global-variables)
7378 (setq unmark (prefix-numeric-value unmark)))
7380 (gnus-summary-mark-same-subject
7381 (gnus-summary-article-subject) unmark)))
7382 ;; If marked as read, go to next unread subject.
7384 ;; Go to next unread subject.
7385 (gnus-summary-next-subject 1 t))
7386 (gnus-message 7 "%d articles are marked as %s"
7387 count (if unmark "unread" "read"))))
7389 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7390 "Mark articles with same SUBJECT as read, and return marked number.
7391 If optional argument UNMARK is positive, remove any kinds of marks.
7392 If optional argument UNMARK is negative, mark articles as unread instead."
7396 ((null unmark) ; Mark as read.
7399 (gnus-summary-mark-article-as-read gnus-killed-mark)
7400 (gnus-summary-show-thread) t)
7401 (gnus-summary-find-subject subject))
7402 (setq count (1+ count))))
7403 ((> unmark 0) ; Tick.
7406 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7407 (gnus-summary-show-thread) t)
7408 (gnus-summary-find-subject subject))
7409 (setq count (1+ count))))
7410 (t ; Mark as unread.
7413 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7414 (gnus-summary-show-thread) t)
7415 (gnus-summary-find-subject subject))
7416 (setq count (1+ count)))))
7417 (gnus-set-mode-line 'summary)
7418 ;; Return the number of marked articles.
7421 (defun gnus-summary-mark-as-processable (n &optional unmark)
7422 "Set the process mark on the next N articles.
7423 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7424 the process mark instead. The difference between N and the actual
7425 number of articles marked is returned."
7427 (gnus-set-global-variables)
7428 (let ((backward (< n 0))
7433 (gnus-summary-remove-process-mark
7434 (gnus-summary-article-number))
7435 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7436 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7439 (gnus-message 7 "No more articles"))
7440 (gnus-summary-recenter)
7441 (gnus-summary-position-point)
7444 (defun gnus-summary-unmark-as-processable (n)
7445 "Remove the process mark from the next N articles.
7446 If N is negative, unmark backward instead. The difference between N and
7447 the actual number of articles unmarked is returned."
7449 (gnus-set-global-variables)
7450 (gnus-summary-mark-as-processable n t))
7452 (defun gnus-summary-unmark-all-processable ()
7453 "Remove the process mark from all articles."
7455 (gnus-set-global-variables)
7457 (while gnus-newsgroup-processable
7458 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7459 (gnus-summary-position-point))
7461 (defun gnus-summary-mark-as-expirable (n)
7462 "Mark N articles forward as expirable.
7463 If N is negative, mark backward instead. The difference between N and
7464 the actual number of articles marked is returned."
7466 (gnus-set-global-variables)
7467 (gnus-summary-mark-forward n gnus-expirable-mark))
7469 (defun gnus-summary-mark-article-as-replied (article)
7470 "Mark ARTICLE replied and update the summary line."
7471 (push article gnus-newsgroup-replied)
7472 (let ((buffer-read-only nil))
7473 (when (gnus-summary-goto-subject article)
7474 (gnus-summary-update-secondary-mark article))))
7476 (defun gnus-summary-set-bookmark (article)
7477 "Set a bookmark in current article."
7478 (interactive (gnus-summary-article-number))
7479 (gnus-set-global-variables)
7480 (when (or (not (get-buffer gnus-article-buffer))
7481 (not gnus-current-article)
7482 (not gnus-article-current)
7483 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7484 (error "No current article selected"))
7485 ;; Remove old bookmark, if one exists.
7486 (let ((old (assq article gnus-newsgroup-bookmarks)))
7488 (setq gnus-newsgroup-bookmarks
7489 (delq old gnus-newsgroup-bookmarks))))
7490 ;; Set the new bookmark, which is on the form
7491 ;; (article-number . line-number-in-body).
7495 (set-buffer gnus-article-buffer)
7499 (goto-char (point-min))
7500 (search-forward "\n\n" nil t)
7503 gnus-newsgroup-bookmarks)
7504 (gnus-message 6 "A bookmark has been added to the current article."))
7506 (defun gnus-summary-remove-bookmark (article)
7507 "Remove the bookmark from the current article."
7508 (interactive (gnus-summary-article-number))
7509 (gnus-set-global-variables)
7510 ;; Remove old bookmark, if one exists.
7511 (let ((old (assq article gnus-newsgroup-bookmarks)))
7514 (setq gnus-newsgroup-bookmarks
7515 (delq old gnus-newsgroup-bookmarks))
7516 (gnus-message 6 "Removed bookmark."))
7517 (gnus-message 6 "No bookmark in current article."))))
7519 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7520 (defun gnus-summary-mark-as-dormant (n)
7521 "Mark N articles forward as dormant.
7522 If N is negative, mark backward instead. The difference between N and
7523 the actual number of articles marked is returned."
7525 (gnus-set-global-variables)
7526 (gnus-summary-mark-forward n gnus-dormant-mark))
7528 (defun gnus-summary-set-process-mark (article)
7529 "Set the process mark on ARTICLE and update the summary line."
7530 (setq gnus-newsgroup-processable
7532 (delq article gnus-newsgroup-processable)))
7533 (when (gnus-summary-goto-subject article)
7534 (gnus-summary-show-thread)
7535 (gnus-summary-update-secondary-mark article)))
7537 (defun gnus-summary-remove-process-mark (article)
7538 "Remove the process mark from ARTICLE and update the summary line."
7539 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7540 (when (gnus-summary-goto-subject article)
7541 (gnus-summary-show-thread)
7542 (gnus-summary-update-secondary-mark article)))
7544 (defun gnus-summary-set-saved-mark (article)
7545 "Set the process mark on ARTICLE and update the summary line."
7546 (push article gnus-newsgroup-saved)
7547 (when (gnus-summary-goto-subject article)
7548 (gnus-summary-update-secondary-mark article)))
7550 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7551 "Mark N articles as read forwards.
7552 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7553 The difference between N and the actual number of articles marked is
7556 (gnus-set-global-variables)
7557 (let ((backward (< n 0))
7558 (gnus-summary-goto-unread
7559 (and gnus-summary-goto-unread
7560 (not (eq gnus-summary-goto-unread 'never))
7561 (not (memq mark (list gnus-unread-mark
7562 gnus-ticked-mark gnus-dormant-mark)))))
7564 (mark (or mark gnus-del-mark)))
7566 (gnus-summary-mark-article nil mark no-expire)
7567 (zerop (gnus-summary-next-subject
7569 (and gnus-summary-goto-unread
7570 (not (eq gnus-summary-goto-unread 'never)))
7574 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7575 (gnus-summary-recenter)
7576 (gnus-summary-position-point)
7577 (gnus-set-mode-line 'summary)
7580 (defun gnus-summary-mark-article-as-read (mark)
7581 "Mark the current article quickly as read with MARK."
7582 (let ((article (gnus-summary-article-number)))
7583 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7584 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7585 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7586 (push (cons article mark) gnus-newsgroup-reads)
7587 ;; Possibly remove from cache, if that is used.
7588 (when gnus-use-cache
7589 (gnus-cache-enter-remove-article article))
7590 ;; Allow the backend to change the mark.
7591 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7592 ;; Check for auto-expiry.
7593 (when (and gnus-newsgroup-auto-expire
7594 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7595 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7596 (= mark gnus-ancient-mark)
7597 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7598 (= mark gnus-duplicate-mark)))
7599 (setq mark gnus-expirable-mark)
7600 (push article gnus-newsgroup-expirable))
7601 ;; Set the mark in the buffer.
7602 (gnus-summary-update-mark mark 'unread)
7605 (defun gnus-summary-mark-article-as-unread (mark)
7606 "Mark the current article quickly as unread with MARK."
7607 (let ((article (gnus-summary-article-number)))
7609 (gnus-error 1 "Can't mark negative article numbers")
7610 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7611 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7612 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7613 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7614 (cond ((= mark gnus-ticked-mark)
7615 (push article gnus-newsgroup-marked))
7616 ((= mark gnus-dormant-mark)
7617 (push article gnus-newsgroup-dormant))
7619 (push article gnus-newsgroup-unreads)))
7620 (setq gnus-newsgroup-reads
7621 (delq (assq article gnus-newsgroup-reads)
7622 gnus-newsgroup-reads))
7624 ;; See whether the article is to be put in the cache.
7626 (vectorp (gnus-summary-article-header article))
7628 (gnus-cache-possibly-enter-article
7629 gnus-newsgroup-name article
7630 (gnus-summary-article-header article)
7631 (= mark gnus-ticked-mark)
7632 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7635 (gnus-summary-update-mark mark 'unread))
7638 (defun gnus-summary-mark-article (&optional article mark no-expire)
7639 "Mark ARTICLE with MARK. MARK can be any character.
7640 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7641 `??' (dormant) and `?E' (expirable).
7642 If MARK is nil, then the default character `?D' is used.
7643 If ARTICLE is nil, then the article on the current line will be
7645 ;; The mark might be a string.
7646 (when (stringp mark)
7647 (setq mark (aref mark 0)))
7648 ;; If no mark is given, then we check auto-expiring.
7649 (and (not no-expire)
7650 gnus-newsgroup-auto-expire
7652 (and (gnus-characterp mark)
7653 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7654 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7655 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7656 (= mark gnus-duplicate-mark))))
7657 (setq mark gnus-expirable-mark))
7658 (let* ((mark (or mark gnus-del-mark))
7659 (article (or article (gnus-summary-article-number))))
7661 (error "No article on current line"))
7662 (if (or (= mark gnus-unread-mark)
7663 (= mark gnus-ticked-mark)
7664 (= mark gnus-dormant-mark))
7665 (gnus-mark-article-as-unread article mark)
7666 (gnus-mark-article-as-read article mark))
7668 ;; See whether the article is to be put in the cache.
7670 (not (= mark gnus-canceled-mark))
7671 (vectorp (gnus-summary-article-header article))
7673 (gnus-cache-possibly-enter-article
7674 gnus-newsgroup-name article
7675 (gnus-summary-article-header article)
7676 (= mark gnus-ticked-mark)
7677 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7679 (when (gnus-summary-goto-subject article nil t)
7680 (let ((buffer-read-only nil))
7681 (gnus-summary-show-thread)
7683 (gnus-summary-update-mark mark 'unread)
7686 (defun gnus-summary-update-secondary-mark (article)
7687 "Update the secondary (read, process, cache) mark."
7688 (gnus-summary-update-mark
7689 (cond ((memq article gnus-newsgroup-processable)
7691 ((memq article gnus-newsgroup-cached)
7693 ((memq article gnus-newsgroup-replied)
7695 ((memq article gnus-newsgroup-saved)
7697 (t gnus-unread-mark))
7699 (when (gnus-visual-p 'summary-highlight 'highlight)
7700 (run-hooks 'gnus-summary-update-hook))
7703 (defun gnus-summary-update-mark (mark type)
7704 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7705 (buffer-read-only nil))
7706 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7707 (when (looking-at "\r")
7710 (<= (+ forward (point)) (point-max)))
7711 ;; Go to the right position on the line.
7712 (goto-char (+ forward (point)))
7713 ;; Replace the old mark with the new mark.
7714 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7715 ;; Optionally update the marks by some user rule.
7716 (when (eq type 'unread)
7718 (gnus-data-find (gnus-summary-article-number)) mark)
7719 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7721 (defun gnus-mark-article-as-read (article &optional mark)
7722 "Enter ARTICLE in the pertinent lists and remove it from others."
7723 ;; Make the article expirable.
7724 (let ((mark (or mark gnus-del-mark)))
7725 (if (= mark gnus-expirable-mark)
7726 (push article gnus-newsgroup-expirable)
7727 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7728 ;; Remove from unread and marked lists.
7729 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7730 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7731 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7732 (push (cons article mark) gnus-newsgroup-reads)
7733 ;; Possibly remove from cache, if that is used.
7734 (when gnus-use-cache
7735 (gnus-cache-enter-remove-article article))))
7737 (defun gnus-mark-article-as-unread (article &optional mark)
7738 "Enter ARTICLE in the pertinent lists and remove it from others."
7739 (let ((mark (or mark gnus-ticked-mark)))
7740 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7741 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7742 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7743 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7747 (gnus-error 1 "Can't mark negative article numbers")
7749 ;; Unsuppress duplicates?
7750 (when gnus-suppress-duplicates
7751 (gnus-dup-unsuppress-article article))
7753 (cond ((= mark gnus-ticked-mark)
7754 (push article gnus-newsgroup-marked))
7755 ((= mark gnus-dormant-mark)
7756 (push article gnus-newsgroup-dormant))
7758 (push article gnus-newsgroup-unreads)))
7759 (setq gnus-newsgroup-reads
7760 (delq (assq article gnus-newsgroup-reads)
7761 gnus-newsgroup-reads))
7764 (defalias 'gnus-summary-mark-as-unread-forward
7765 'gnus-summary-tick-article-forward)
7766 (make-obsolete 'gnus-summary-mark-as-unread-forward
7767 'gnus-summary-tick-article-forward)
7768 (defun gnus-summary-tick-article-forward (n)
7769 "Tick N articles forwards.
7770 If N is negative, tick backwards instead.
7771 The difference between N and the number of articles ticked is returned."
7773 (gnus-summary-mark-forward n gnus-ticked-mark))
7775 (defalias 'gnus-summary-mark-as-unread-backward
7776 'gnus-summary-tick-article-backward)
7777 (make-obsolete 'gnus-summary-mark-as-unread-backward
7778 'gnus-summary-tick-article-backward)
7779 (defun gnus-summary-tick-article-backward (n)
7780 "Tick N articles backwards.
7781 The difference between N and the number of articles ticked is returned."
7783 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7785 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7786 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7787 (defun gnus-summary-tick-article (&optional article clear-mark)
7788 "Mark current article as unread.
7789 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7790 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7792 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7795 (defun gnus-summary-mark-as-read-forward (n)
7796 "Mark N articles as read forwards.
7797 If N is negative, mark backwards instead.
7798 The difference between N and the actual number of articles marked is
7801 (gnus-summary-mark-forward n gnus-del-mark t))
7803 (defun gnus-summary-mark-as-read-backward (n)
7804 "Mark the N articles as read backwards.
7805 The difference between N and the actual number of articles marked is
7808 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7810 (defun gnus-summary-mark-as-read (&optional article mark)
7811 "Mark current article as read.
7812 ARTICLE specifies the article to be marked as read.
7813 MARK specifies a string to be inserted at the beginning of the line."
7814 (gnus-summary-mark-article article mark))
7816 (defun gnus-summary-clear-mark-forward (n)
7817 "Clear marks from N articles forward.
7818 If N is negative, clear backward instead.
7819 The difference between N and the number of marks cleared is returned."
7821 (gnus-summary-mark-forward n gnus-unread-mark))
7823 (defun gnus-summary-clear-mark-backward (n)
7824 "Clear marks from N articles backward.
7825 The difference between N and the number of marks cleared is returned."
7827 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7829 (defun gnus-summary-mark-unread-as-read ()
7830 "Intended to be used by `gnus-summary-mark-article-hook'."
7831 (when (memq gnus-current-article gnus-newsgroup-unreads)
7832 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7834 (defun gnus-summary-mark-read-and-unread-as-read ()
7835 "Intended to be used by `gnus-summary-mark-article-hook'."
7836 (let ((mark (gnus-summary-article-mark)))
7837 (when (or (gnus-unread-mark-p mark)
7838 (gnus-read-mark-p mark))
7839 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7841 (defun gnus-summary-mark-region-as-read (point mark all)
7842 "Mark all unread articles between point and mark as read.
7843 If given a prefix, mark all articles between point and mark as read,
7844 even ticked and dormant ones."
7845 (interactive "r\nP")
7854 (memq (setq article (gnus-summary-article-number))
7855 gnus-newsgroup-unreads))
7856 (gnus-summary-mark-article article gnus-del-mark))
7858 (gnus-summary-find-next))))))
7860 (defun gnus-summary-mark-below (score mark)
7861 "Mark articles with score less than SCORE with MARK."
7862 (interactive "P\ncMark: ")
7863 (gnus-set-global-variables)
7864 (setq score (if score
7865 (prefix-numeric-value score)
7866 (or gnus-summary-default-score 0)))
7868 (set-buffer gnus-summary-buffer)
7869 (goto-char (point-min))
7872 (and (< (gnus-summary-article-score) score)
7873 (gnus-summary-mark-article nil mark))
7874 (gnus-summary-find-next)))))
7876 (defun gnus-summary-kill-below (&optional score)
7877 "Mark articles with score below SCORE as read."
7879 (gnus-set-global-variables)
7880 (gnus-summary-mark-below score gnus-killed-mark))
7882 (defun gnus-summary-clear-above (&optional score)
7883 "Clear all marks from articles with score above SCORE."
7885 (gnus-set-global-variables)
7886 (gnus-summary-mark-above score gnus-unread-mark))
7888 (defun gnus-summary-tick-above (&optional score)
7889 "Tick all articles with score above SCORE."
7891 (gnus-set-global-variables)
7892 (gnus-summary-mark-above score gnus-ticked-mark))
7894 (defun gnus-summary-mark-above (score mark)
7895 "Mark articles with score over SCORE with MARK."
7896 (interactive "P\ncMark: ")
7897 (gnus-set-global-variables)
7898 (setq score (if score
7899 (prefix-numeric-value score)
7900 (or gnus-summary-default-score 0)))
7902 (set-buffer gnus-summary-buffer)
7903 (goto-char (point-min))
7905 (when (> (gnus-summary-article-score) score)
7906 (gnus-summary-mark-article nil mark))
7908 (gnus-summary-find-next)))))
7910 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7911 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7912 (defun gnus-summary-limit-include-expunged (&optional no-error)
7913 "Display all the hidden articles that were expunged for low scores."
7915 (gnus-set-global-variables)
7916 (let ((buffer-read-only nil))
7917 (let ((scored gnus-newsgroup-scored)
7920 (unless (gnus-summary-goto-subject (caar scored))
7921 (and (setq h (gnus-summary-article-header (caar scored)))
7922 (< (cdar scored) gnus-summary-expunge-below)
7924 (setq scored (cdr scored)))
7926 (when (not no-error)
7927 (error "No expunged articles hidden"))
7928 (goto-char (point-min))
7929 (gnus-summary-prepare-unthreaded (nreverse headers))
7930 (goto-char (point-min))
7931 (gnus-summary-position-point)
7934 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7935 "Mark all unread articles in this newsgroup as read.
7936 If prefix argument ALL is non-nil, ticked and dormant articles will
7937 also be marked as read.
7938 If QUIETLY is non-nil, no questions will be asked.
7939 If TO-HERE is non-nil, it should be a point in the buffer. All
7940 articles before this point will be marked as read.
7941 Note that this function will only catch up the unread article
7942 in the current summary buffer limitation.
7943 The number of articles marked as read is returned."
7945 (gnus-set-global-variables)
7949 (not gnus-interactive-catchup) ;Without confirmation?
7953 "Mark absolutely all articles as read? "
7954 "Mark all unread articles as read? ")))
7956 (not gnus-newsgroup-adaptive)
7957 (not gnus-newsgroup-auto-expire)
7958 (not gnus-suppress-duplicates)
7959 (or (not gnus-use-cache)
7960 (eq gnus-use-cache 'passive)))
7963 (setq gnus-newsgroup-marked nil
7964 gnus-newsgroup-dormant nil))
7965 (setq gnus-newsgroup-unreads nil))
7966 ;; We actually mark all articles as canceled, which we
7967 ;; have to do when using auto-expiry or adaptive scoring.
7968 (gnus-summary-show-all-threads)
7969 (when (gnus-summary-first-subject (not all))
7971 (if to-here (< (point) to-here) t)
7972 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7973 (gnus-summary-find-next (not all)))))
7974 (gnus-set-mode-line 'summary))
7976 (gnus-summary-position-point)))
7978 (defun gnus-summary-catchup-to-here (&optional all)
7979 "Mark all unticked articles before the current one as read.
7980 If ALL is non-nil, also mark ticked and dormant articles as read."
7982 (gnus-set-global-variables)
7984 (gnus-save-hidden-threads
7985 (let ((beg (point)))
7986 ;; We check that there are unread articles.
7987 (when (or all (gnus-summary-find-prev))
7988 (gnus-summary-catchup all t beg)))))
7989 (gnus-summary-position-point))
7991 (defun gnus-summary-catchup-all (&optional quietly)
7992 "Mark all articles in this newsgroup as read."
7994 (gnus-set-global-variables)
7995 (gnus-summary-catchup t quietly))
7997 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7998 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7999 If prefix argument ALL is non-nil, all articles are marked as read."
8001 (gnus-set-global-variables)
8002 (when (gnus-summary-catchup all quietly nil 'fast)
8003 ;; Select next newsgroup or exit.
8004 (if (eq gnus-auto-select-next 'quietly)
8005 (gnus-summary-next-group nil)
8006 (gnus-summary-exit))))
8008 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8009 "Mark all articles in this newsgroup as read, and then exit."
8011 (gnus-set-global-variables)
8012 (gnus-summary-catchup-and-exit t quietly))
8014 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8015 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8016 "Mark all articles in this group as read and select the next group.
8017 If given a prefix, mark all articles, unread as well as ticked, as
8020 (gnus-set-global-variables)
8022 (gnus-summary-catchup all))
8023 (gnus-summary-next-article t nil nil t))
8025 ;; Thread-based commands.
8027 (defun gnus-summary-articles-in-thread (&optional article)
8028 "Return a list of all articles in the current thread.
8029 If ARTICLE is non-nil, return all articles in the thread that starts
8031 (let* ((article (or article (gnus-summary-article-number)))
8032 (data (gnus-data-find-list article))
8033 (top-level (gnus-data-level (car data)))
8035 (cond ((null gnus-thread-operation-ignore-subject)
8036 (gnus-simplify-subject-re
8037 (mail-header-subject (gnus-data-header (car data)))))
8038 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8039 (gnus-simplify-subject-fuzzy
8040 (mail-header-subject (gnus-data-header (car data)))))
8042 (end-point (save-excursion
8043 (if (gnus-summary-go-to-next-thread)
8044 (point) (point-max))))
8047 (< (gnus-data-pos (car data)) end-point))
8048 (when (or (not top-subject)
8049 (string= top-subject
8050 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8051 (gnus-simplify-subject-fuzzy
8052 (mail-header-subject
8053 (gnus-data-header (car data))))
8054 (gnus-simplify-subject-re
8055 (mail-header-subject
8056 (gnus-data-header (car data)))))))
8057 (push (gnus-data-number (car data)) articles))
8058 (unless (and (setq data (cdr data))
8059 (> (gnus-data-level (car data)) top-level))
8061 ;; Return the list of articles.
8062 (nreverse articles)))
8064 (defun gnus-summary-rethread-current ()
8065 "Rethread the thread the current article is part of."
8067 (gnus-set-global-variables)
8068 (let* ((gnus-show-threads t)
8069 (article (gnus-summary-article-number))
8070 (id (mail-header-id (gnus-summary-article-header)))
8071 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8073 (error "No article on the current line"))
8074 (gnus-rebuild-thread id)
8075 (gnus-summary-goto-subject article)))
8077 (defun gnus-summary-reparent-thread ()
8078 "Make the current article child of the marked (or previous) article.
8080 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8081 is non-nil or the Subject: of both articles are the same."
8083 (unless (not (gnus-group-read-only-p))
8084 (error "The current newsgroup does not support article editing"))
8085 (unless (<= (length gnus-newsgroup-processable) 1)
8086 (error "No more than one article may be marked"))
8087 (save-window-excursion
8088 (let ((gnus-article-buffer " *reparent*")
8089 (current-article (gnus-summary-article-number))
8090 ;; First grab the marked article, otherwise one line up.
8091 (parent-article (if (not (null gnus-newsgroup-processable))
8092 (car gnus-newsgroup-processable)
8094 (if (eq (forward-line -1) 0)
8095 (gnus-summary-article-number)
8096 (error "Beginning of summary buffer"))))))
8097 (unless (not (eq current-article parent-article))
8098 (error "An article may not be self-referential"))
8099 (let ((message-id (mail-header-id
8100 (gnus-summary-article-header parent-article))))
8101 (unless (and message-id (not (equal message-id "")))
8102 (error "No message-id in desired parent"))
8103 (gnus-summary-select-article t t nil current-article)
8104 (set-buffer gnus-original-article-buffer)
8105 (let ((buf (format "%s" (buffer-string))))
8106 (nnheader-temp-write nil
8108 (goto-char (point-min))
8109 (if (search-forward-regexp "^References: " nil t)
8110 (insert message-id " " )
8111 (insert "References: " message-id "\n"))
8112 (unless (gnus-request-replace-article
8113 current-article (car gnus-article-current)
8115 (error "Couldn't replace article"))))
8116 (set-buffer gnus-summary-buffer)
8117 (gnus-summary-unmark-all-processable)
8118 (gnus-summary-rethread-current)
8119 (gnus-message 3 "Article %d is now the child of article %d"
8120 current-article parent-article)))))
8122 (defun gnus-summary-toggle-threads (&optional arg)
8123 "Toggle showing conversation threads.
8124 If ARG is positive number, turn showing conversation threads on."
8126 (gnus-set-global-variables)
8127 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8128 (setq gnus-show-threads
8129 (if (null arg) (not gnus-show-threads)
8130 (> (prefix-numeric-value arg) 0)))
8131 (gnus-summary-prepare)
8132 (gnus-summary-goto-subject current)
8133 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8134 (gnus-summary-position-point)))
8136 (defun gnus-summary-show-all-threads ()
8139 (gnus-set-global-variables)
8141 (let ((buffer-read-only nil))
8142 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8143 (gnus-summary-position-point))
8145 (defun gnus-summary-show-thread ()
8146 "Show thread subtrees.
8147 Returns nil if no thread was there to be shown."
8149 (gnus-set-global-variables)
8150 (let ((buffer-read-only nil)
8152 ;; first goto end then to beg, to have point at beg after let
8153 (end (progn (end-of-line) (point)))
8154 (beg (progn (beginning-of-line) (point))))
8156 ;; Any hidden lines here?
8157 (search-forward "\r" end t)
8158 (subst-char-in-region beg end ?\^M ?\n t)
8160 (gnus-summary-position-point))))
8162 (defun gnus-summary-hide-all-threads ()
8163 "Hide all thread subtrees."
8165 (gnus-set-global-variables)
8167 (goto-char (point-min))
8168 (gnus-summary-hide-thread)
8169 (while (zerop (gnus-summary-next-thread 1 t))
8170 (gnus-summary-hide-thread)))
8171 (gnus-summary-position-point))
8173 (defun gnus-summary-hide-thread ()
8174 "Hide thread subtrees.
8175 Returns nil if no threads were there to be hidden."
8177 (gnus-set-global-variables)
8178 (let ((buffer-read-only nil)
8180 (article (gnus-summary-article-number)))
8182 ;; Go forward until either the buffer ends or the subthread
8184 (when (and (not (eobp))
8185 (or (zerop (gnus-summary-next-thread 1 t))
8186 (goto-char (point-max))))
8188 (if (and (> (point) start)
8189 (search-backward "\n" start t))
8191 (subst-char-in-region start (point) ?\n ?\^M)
8192 (gnus-summary-goto-subject article))
8195 ;;(gnus-summary-position-point)
8198 (defun gnus-summary-go-to-next-thread (&optional previous)
8199 "Go to the same level (or less) next thread.
8200 If PREVIOUS is non-nil, go to previous thread instead.
8201 Return the article number moved to, or nil if moving was impossible."
8202 (let ((level (gnus-summary-thread-level))
8203 (way (if previous -1 1))
8206 (while (and (not (eobp))
8207 (< level (gnus-summary-thread-level)))
8215 (gnus-summary-article-number)
8218 (defun gnus-summary-next-thread (n &optional silent)
8219 "Go to the same level next N'th thread.
8220 If N is negative, search backward instead.
8221 Returns the difference between N and the number of skips actually
8224 If SILENT, don't output messages."
8226 (gnus-set-global-variables)
8227 (let ((backward (< n 0))
8230 (gnus-summary-go-to-next-thread backward))
8233 (gnus-summary-position-point))
8234 (when (and (not silent) (/= 0 n))
8235 (gnus-message 7 "No more threads"))
8238 (defun gnus-summary-prev-thread (n)
8239 "Go to the same level previous N'th thread.
8240 Returns the difference between N and the number of skips actually
8243 (gnus-set-global-variables)
8244 (gnus-summary-next-thread (- n)))
8246 (defun gnus-summary-go-down-thread ()
8247 "Go down one level in the current thread."
8248 (let ((children (gnus-summary-article-children)))
8250 (gnus-summary-goto-subject (car children)))))
8252 (defun gnus-summary-go-up-thread ()
8253 "Go up one level in the current thread."
8254 (let ((parent (gnus-summary-article-parent)))
8256 (gnus-summary-goto-subject parent))))
8258 (defun gnus-summary-down-thread (n)
8259 "Go down thread N steps.
8260 If N is negative, go up instead.
8261 Returns the difference between N and how many steps down that were
8264 (gnus-set-global-variables)
8268 (if up (gnus-summary-go-up-thread)
8269 (gnus-summary-go-down-thread)))
8271 (gnus-summary-position-point)
8273 (gnus-message 7 "Can't go further"))
8276 (defun gnus-summary-up-thread (n)
8277 "Go up thread N steps.
8278 If N is negative, go up instead.
8279 Returns the difference between N and how many steps down that were
8282 (gnus-set-global-variables)
8283 (gnus-summary-down-thread (- n)))
8285 (defun gnus-summary-top-thread ()
8286 "Go to the top of the thread."
8288 (gnus-set-global-variables)
8289 (while (gnus-summary-go-up-thread))
8290 (gnus-summary-article-number))
8292 (defun gnus-summary-kill-thread (&optional unmark)
8293 "Mark articles under current thread as read.
8294 If the prefix argument is positive, remove any kinds of marks.
8295 If the prefix argument is negative, tick articles instead."
8297 (gnus-set-global-variables)
8299 (setq unmark (prefix-numeric-value unmark)))
8300 (let ((articles (gnus-summary-articles-in-thread)))
8302 ;; Expand the thread.
8303 (gnus-summary-show-thread)
8304 ;; Mark all the articles.
8306 (gnus-summary-goto-subject (car articles))
8307 (cond ((null unmark)
8308 (gnus-summary-mark-article-as-read gnus-killed-mark))
8310 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8312 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8313 (setq articles (cdr articles))))
8314 ;; Hide killed subtrees.
8316 gnus-thread-hide-killed
8317 (gnus-summary-hide-thread))
8318 ;; If marked as read, go to next unread subject.
8320 ;; Go to next unread subject.
8321 (gnus-summary-next-subject 1 t)))
8322 (gnus-set-mode-line 'summary))
8324 ;; Summary sorting commands
8326 (defun gnus-summary-sort-by-number (&optional reverse)
8327 "Sort the summary buffer by article number.
8328 Argument REVERSE means reverse order."
8330 (gnus-summary-sort 'number reverse))
8332 (defun gnus-summary-sort-by-author (&optional reverse)
8333 "Sort the summary buffer by author name alphabetically.
8334 If case-fold-search is non-nil, case of letters is ignored.
8335 Argument REVERSE means reverse order."
8337 (gnus-summary-sort 'author reverse))
8339 (defun gnus-summary-sort-by-subject (&optional reverse)
8340 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8341 If case-fold-search is non-nil, case of letters is ignored.
8342 Argument REVERSE means reverse order."
8344 (gnus-summary-sort 'subject reverse))
8346 (defun gnus-summary-sort-by-date (&optional reverse)
8347 "Sort the summary buffer by date.
8348 Argument REVERSE means reverse order."
8350 (gnus-summary-sort 'date reverse))
8352 (defun gnus-summary-sort-by-score (&optional reverse)
8353 "Sort the summary buffer by score.
8354 Argument REVERSE means reverse order."
8356 (gnus-summary-sort 'score reverse))
8358 (defun gnus-summary-sort-by-lines (&optional reverse)
8359 "Sort the summary buffer by article length.
8360 Argument REVERSE means reverse order."
8362 (gnus-summary-sort 'lines reverse))
8364 (defun gnus-summary-sort (predicate reverse)
8365 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8366 (gnus-set-global-variables)
8367 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8368 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8369 (gnus-thread-sort-functions
8375 (gnus-article-sort-functions
8380 (,article t2 t1)))))
8382 (gnus-summary-prepare-hook nil))
8383 ;; We do the sorting by regenerating the threads.
8384 (gnus-summary-prepare)
8385 ;; Hide subthreads if needed.
8386 (when (and gnus-show-threads gnus-thread-hide-subtree)
8387 (gnus-summary-hide-all-threads))))
8389 ;; Summary saving commands.
8391 (defun gnus-summary-save-article (&optional n not-saved)
8392 "Save the current article using the default saver function.
8393 If N is a positive number, save the N next articles.
8394 If N is a negative number, save the N previous articles.
8395 If N is nil and any articles have been marked with the process mark,
8396 save those articles instead.
8397 The variable `gnus-default-article-saver' specifies the saver function."
8399 (gnus-set-global-variables)
8400 (let* ((articles (gnus-summary-work-articles n))
8401 (save-buffer (save-excursion
8402 (nnheader-set-temp-buffer " *Gnus Save*")))
8403 (num (length articles))
8404 header article file)
8406 (setq header (gnus-summary-article-header
8407 (setq article (pop articles))))
8408 (if (not (vectorp header))
8409 ;; This is a pseudo-article.
8410 (if (assq 'name header)
8411 (gnus-copy-file (cdr (assq 'name header)))
8412 (gnus-message 1 "Article %d is unsaveable" article))
8413 ;; This is a real article.
8414 (save-window-excursion
8415 (gnus-summary-select-article t nil nil article))
8417 (set-buffer save-buffer)
8419 (insert-buffer-substring gnus-original-article-buffer))
8420 (setq file (gnus-article-save save-buffer file num))
8421 (gnus-summary-remove-process-mark article)
8423 (gnus-summary-set-saved-mark article))))
8424 (gnus-kill-buffer save-buffer)
8425 (gnus-summary-position-point)
8426 (gnus-set-mode-line 'summary)
8429 (defun gnus-summary-pipe-output (&optional arg)
8430 "Pipe the current article to a subprocess.
8431 If N is a positive number, pipe the N next articles.
8432 If N is a negative number, pipe the N previous articles.
8433 If N is nil and any articles have been marked with the process mark,
8434 pipe those articles instead."
8436 (gnus-set-global-variables)
8437 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8438 (gnus-summary-save-article arg t))
8439 (gnus-configure-windows 'pipe))
8441 (defun gnus-summary-save-article-mail (&optional arg)
8442 "Append the current article to an mail file.
8443 If N is a positive number, save the N next articles.
8444 If N is a negative number, save the N previous articles.
8445 If N is nil and any articles have been marked with the process mark,
8446 save those articles instead."
8448 (gnus-set-global-variables)
8449 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8450 (gnus-summary-save-article arg)))
8452 (defun gnus-summary-save-article-rmail (&optional arg)
8453 "Append the current article to an rmail file.
8454 If N is a positive number, save the N next articles.
8455 If N is a negative number, save the N previous articles.
8456 If N is nil and any articles have been marked with the process mark,
8457 save those articles instead."
8459 (gnus-set-global-variables)
8460 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8461 (gnus-summary-save-article arg)))
8463 (defun gnus-summary-save-article-file (&optional arg)
8464 "Append the current article to a file.
8465 If N is a positive number, save the N next articles.
8466 If N is a negative number, save the N previous articles.
8467 If N is nil and any articles have been marked with the process mark,
8468 save those articles instead."
8470 (gnus-set-global-variables)
8471 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8472 (gnus-summary-save-article arg)))
8474 (defun gnus-summary-write-article-file (&optional arg)
8475 "Write the current article to a file, deleting the previous file.
8476 If N is a positive number, save the N next articles.
8477 If N is a negative number, save the N previous articles.
8478 If N is nil and any articles have been marked with the process mark,
8479 save those articles instead."
8481 (gnus-set-global-variables)
8482 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8483 (gnus-summary-save-article arg)))
8485 (defun gnus-summary-save-article-body-file (&optional arg)
8486 "Append the current article body to a file.
8487 If N is a positive number, save the N next articles.
8488 If N is a negative number, save the N previous articles.
8489 If N is nil and any articles have been marked with the process mark,
8490 save those articles instead."
8492 (gnus-set-global-variables)
8493 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8494 (gnus-summary-save-article arg)))
8496 (defun gnus-summary-pipe-message (program)
8497 "Pipe the current article through PROGRAM."
8498 (interactive "sProgram: ")
8499 (gnus-set-global-variables)
8500 (gnus-summary-select-article)
8501 (let ((mail-header-separator "")
8502 (art-buf (get-buffer gnus-article-buffer)))
8503 (gnus-eval-in-buffer-window gnus-article-buffer
8506 (let ((start (window-start))
8508 (message-pipe-buffer-body program)
8509 (set-window-start (get-buffer-window (current-buffer)) start))))))
8511 (defun gnus-get-split-value (methods)
8512 "Return a value based on the split METHODS."
8513 (let (split-name method result match)
8516 (set-buffer gnus-original-article-buffer)
8518 (nnheader-narrow-to-headers)
8520 (goto-char (point-min))
8521 (setq method (pop methods))
8522 (setq match (car method))
8525 ;; Regular expression.
8527 (re-search-forward match nil t)))
8528 ((gnus-functionp match)
8532 (setq result (funcall match gnus-newsgroup-name))))
8537 (setq result (eval match)))))
8538 (setq split-name (append (cdr method) split-name))
8539 (cond ((stringp result)
8540 (push (expand-file-name
8541 result gnus-article-save-directory)
8544 (setq split-name (append result split-name)))))))))
8547 (defun gnus-valid-move-group-p (group)
8552 (car (gnus-find-method-for-group
8553 (symbol-name group))))
8554 gnus-valid-select-methods))))
8556 (defun gnus-read-move-group-name (prompt default articles prefix)
8557 "Read a group name."
8558 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8559 (minibuffer-confirm-incomplete nil) ; XEmacs
8563 (if (> (length articles) 1)
8564 (format "these %d articles" (length articles))
8569 (gnus-completing-read default prom
8571 'gnus-valid-move-group-p
8573 'gnus-group-history))
8574 ((= 1 (length split-name))
8575 (gnus-completing-read (car split-name) prom
8577 'gnus-valid-move-group-p
8579 'gnus-group-history))
8581 (gnus-completing-read nil prom
8582 (mapcar (lambda (el) (list el))
8583 (nreverse split-name))
8585 'gnus-group-history)))))
8587 (if (or (string= to-newsgroup "")
8588 (string= to-newsgroup prefix))
8589 (setq to-newsgroup default))
8590 (unless to-newsgroup
8591 (error "No group name entered"))
8592 (or (gnus-active to-newsgroup)
8593 (gnus-activate-group to-newsgroup)
8594 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8596 (or (and (gnus-request-create-group
8597 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8598 (gnus-activate-group to-newsgroup nil nil
8599 (gnus-group-name-to-method
8601 (error "Couldn't create group %s" to-newsgroup)))
8602 (error "No such group: %s" to-newsgroup)))
8605 ;; Summary extract commands
8607 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8608 (let ((buffer-read-only nil)
8609 (article (gnus-summary-article-number))
8611 (unless (gnus-summary-goto-subject article)
8612 (error "No such article: %d" article))
8613 (gnus-summary-position-point)
8614 ;; If all commands are to be bunched up on one line, we collect
8616 (unless gnus-view-pseudos-separately
8617 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8620 (setq action (cdr (assq 'action (car ps))))
8621 (setq files (list (cdr (assq 'name (car ps)))))
8622 (while (and ps (cdr ps)
8623 (string= (or action "1")
8624 (or (cdr (assq 'action (cadr ps))) "2")))
8625 (push (cdr (assq 'name (cadr ps))) files)
8626 (setcdr ps (cddr ps)))
8628 (when (not (string-match "%s" action))
8631 (when (assq 'execute (car ps))
8632 (setcdr (assq 'execute (car ps))
8633 (funcall (if (string-match "%s" action)
8640 (gnus-quote-arg-for-sh-or-csh f)))
8642 (setq ps (cdr ps)))))
8643 (if (and gnus-view-pseudos (not not-view))
8645 (when (assq 'execute (car pslist))
8646 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8647 (eq gnus-view-pseudos 'not-confirm)))
8648 (setq pslist (cdr pslist)))
8651 (setq after-article (or (cdr (assq 'article (car pslist)))
8652 (gnus-summary-article-number)))
8653 (gnus-summary-goto-subject after-article)
8656 (insert " " (file-name-nondirectory
8657 (cdr (assq 'name (car pslist))))
8658 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8660 (forward-line -1) ; back to `b'
8661 (gnus-add-text-properties
8662 b (1- e) (list 'gnus-number gnus-reffed-article-number
8663 gnus-mouse-face-prop gnus-mouse-face))
8665 after-article gnus-reffed-article-number
8666 gnus-unread-mark b (car pslist) 0 (- e b))
8667 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8668 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8669 (setq pslist (cdr pslist)))))))
8671 (defun gnus-pseudos< (p1 p2)
8672 (let ((c1 (cdr (assq 'action p1)))
8673 (c2 (cdr (assq 'action p2))))
8674 (and c1 c2 (string< c1 c2))))
8676 (defun gnus-request-pseudo-article (props)
8677 (cond ((assq 'execute props)
8678 (gnus-execute-command (cdr (assq 'execute props)))))
8679 (let ((gnus-current-article (gnus-summary-article-number)))
8680 (run-hooks 'gnus-mark-article-hook)))
8682 (defun gnus-execute-command (command &optional automatic)
8684 (gnus-article-setup-buffer)
8685 (set-buffer gnus-article-buffer)
8686 (setq buffer-read-only nil)
8687 (let ((command (if automatic command
8688 (read-string "Command: " (cons command 0)))))
8690 (insert "$ " command "\n\n")
8691 (if gnus-view-pseudo-asynchronously
8692 (start-process "gnus-execute" (current-buffer) shell-file-name
8693 shell-command-switch command)
8694 (call-process shell-file-name nil t nil
8695 shell-command-switch command)))))
8697 ;; Summary kill commands.
8699 (defun gnus-summary-edit-global-kill (article)
8700 "Edit the \"global\" kill file."
8701 (interactive (gnus-summary-article-number))
8702 (gnus-set-global-variables)
8703 (gnus-group-edit-global-kill article))
8705 (defun gnus-summary-edit-local-kill ()
8706 "Edit a local kill file applied to the current newsgroup."
8708 (gnus-set-global-variables)
8709 (setq gnus-current-headers (gnus-summary-article-header))
8710 (gnus-set-global-variables)
8711 (gnus-group-edit-local-kill
8712 (gnus-summary-article-number) gnus-newsgroup-name))
8716 (defun gnus-read-header (id &optional header)
8717 "Read the headers of article ID and enter them into the Gnus system."
8718 (let ((group gnus-newsgroup-name)
8719 (gnus-override-method
8720 (and (gnus-news-group-p gnus-newsgroup-name)
8721 gnus-refer-article-method))
8723 ;; First we check to see whether the header in question is already
8726 ;; This is a Message-ID.
8727 (setq header (or header (gnus-id-to-header id)))
8728 ;; This is an article number.
8729 (setq header (or header (gnus-summary-article-header id))))
8731 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8732 ;; We have found the header.
8734 ;; We have to really fetch the header to this article.
8736 (set-buffer nntp-server-buffer)
8737 (when (setq where (gnus-request-head id group))
8738 (nnheader-fold-continuation-lines)
8739 (goto-char (point-max))
8741 (goto-char (point-min))
8745 ((cdr where) (cdr where))
8746 (header (mail-header-number header))
8747 (t gnus-reffed-article-number))
8749 (insert " Article retrieved.\n"))
8751 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8752 () ; Malformed head.
8753 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8754 (when (and (stringp id)
8755 (not (string= (gnus-group-real-name group)
8757 ;; If we fetched by Message-ID and the article came
8758 ;; from a different group, we fudge some bogus article
8759 ;; numbers for this article.
8760 (mail-header-set-number header gnus-reffed-article-number))
8762 (set-buffer gnus-summary-buffer)
8763 (decf gnus-reffed-article-number)
8764 (gnus-remove-header (mail-header-number header))
8765 (push header gnus-newsgroup-headers)
8766 (setq gnus-current-headers header)
8767 (push (mail-header-number header) gnus-newsgroup-limit)))
8770 (defun gnus-remove-header (number)
8771 "Remove header NUMBER from `gnus-newsgroup-headers'."
8772 (if (and gnus-newsgroup-headers
8773 (= number (mail-header-number (car gnus-newsgroup-headers))))
8774 (pop gnus-newsgroup-headers)
8775 (let ((headers gnus-newsgroup-headers))
8776 (while (and (cdr headers)
8777 (not (= number (mail-header-number (cadr headers)))))
8780 (setcdr headers (cddr headers))))))
8783 ;;; summary highlights
8786 (defun gnus-highlight-selected-summary ()
8787 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8788 ;; Highlight selected article in summary buffer
8789 (when gnus-summary-selected-face
8791 (let* ((beg (progn (beginning-of-line) (point)))
8792 (end (progn (end-of-line) (point)))
8793 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8794 (from (if (get-text-property beg gnus-mouse-face-prop)
8796 (or (next-single-property-change
8797 beg gnus-mouse-face-prop nil end)
8802 (or (next-single-property-change
8803 from gnus-mouse-face-prop nil end)
8805 ;; If no mouse-face prop on line we will have to = from = end,
8806 ;; so we highlight the entire line instead.
8807 (when (= (+ to 2) from)
8810 (if gnus-newsgroup-selected-overlay
8811 ;; Move old overlay.
8813 gnus-newsgroup-selected-overlay from to (current-buffer))
8814 ;; Create new overlay.
8816 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8817 'face gnus-summary-selected-face))))))
8819 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8820 (defun gnus-summary-highlight-line ()
8821 "Highlight current line according to `gnus-summary-highlight'."
8822 (let* ((list gnus-summary-highlight)
8824 (end (progn (end-of-line) (point)))
8825 ;; now find out where the line starts and leave point there.
8826 (beg (progn (beginning-of-line) (point)))
8827 (article (gnus-summary-article-number))
8828 (score (or (cdr (assq (or article gnus-current-article)
8829 gnus-newsgroup-scored))
8830 gnus-summary-default-score 0))
8831 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8832 (inhibit-read-only t))
8833 ;; Eval the cars of the lists until we find a match.
8834 (let ((default gnus-summary-default-score))
8836 (not (eval (caar list))))
8837 (setq list (cdr list))))
8838 (let ((face (cdar list)))
8839 (unless (eq face (get-text-property beg 'face))
8840 (gnus-put-text-property
8842 (setq face (if (boundp face) (symbol-value face) face)))
8843 (when gnus-summary-highlight-line-function
8844 (funcall gnus-summary-highlight-line-function article face))))
8847 (defun gnus-update-read-articles (group unread &optional compute)
8848 "Update the list of read articles in GROUP."
8849 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8850 (entry (gnus-gethash group gnus-newsrc-hashtb))
8851 (info (nth 2 entry))
8853 (unread (sort (copy-sequence unread) '<))
8855 (if (or (not info) (not active))
8856 ;; There is no info on this group if it was, in fact,
8857 ;; killed. Gnus stores no information on killed groups, so
8858 ;; there's nothing to be done.
8859 ;; One could store the information somewhere temporarily,
8860 ;; perhaps... Hmmm...
8862 ;; Remove any negative articles numbers.
8863 (while (and unread (< (car unread) 0))
8864 (setq unread (cdr unread)))
8865 ;; Remove any expired article numbers
8866 (while (and unread (< (car unread) (car active)))
8867 (setq unread (cdr unread)))
8868 ;; Compute the ranges of read articles by looking at the list of
8871 (when (/= (car unread) prev)
8872 (push (if (= prev (1- (car unread))) prev
8873 (cons prev (1- (car unread))))
8875 (setq prev (1+ (car unread)))
8876 (setq unread (cdr unread)))
8877 (when (<= prev (cdr active))
8878 (push (cons prev (cdr active)) read))
8880 (if (> (length read) 1) (nreverse read) read)
8882 (set-buffer gnus-group-buffer)
8885 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8886 (gnus-info-set-read ',info ',(gnus-info-read info))
8887 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8888 (gnus-group-update-group ,group t))))
8889 ;; Enter this list into the group info.
8891 info (if (> (length read) 1) (nreverse read) read))
8892 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8893 (gnus-get-unread-articles-in-group info (gnus-active group))
8896 (defun gnus-offer-save-summaries ()
8897 "Offer to save all active summary buffers."
8899 (let ((buflist (buffer-list))
8901 ;; Go through all buffers and find all summaries.
8903 (and (setq bufname (buffer-name (car buflist)))
8904 (string-match "Summary" bufname)
8906 (set-buffer bufname)
8907 ;; We check that this is, indeed, a summary buffer.
8908 (and (eq major-mode 'gnus-summary-mode)
8909 ;; Also make sure this isn't bogus.
8910 gnus-newsgroup-prepared
8911 ;; Also make sure that this isn't a dead summary buffer.
8912 (not gnus-dead-summary-mode)))
8913 (push bufname buffers))
8914 (setq buflist (cdr buflist)))
8915 ;; Go through all these summary buffers and offer to save them.
8918 "Update summary buffer %s? "
8919 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8926 (run-hooks 'gnus-sum-load-hook)
8928 ;;; gnus-sum.el ends here