1 ;;; gnus-sum.el --- summary mode commands for Open gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
39 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
40 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
42 (defcustom gnus-kill-summary-on-exit t
43 "*If non-nil, kill the summary buffer when you exit from it.
44 If nil, the summary will become a \"*Dead Summary*\" buffer, and
45 it will be killed sometime later."
46 :group 'gnus-summary-exit
49 (defcustom gnus-fetch-old-headers nil
50 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
51 If an unread article in the group refers to an older, already read (or
52 just marked as read) article, the old article will not normally be
53 displayed in the Summary buffer. If this variable is non-nil, Gnus
54 will attempt to grab the headers to the old articles, and thereby
55 build complete threads. If it has the value `some', only enough
56 headers to connect otherwise loose threads will be displayed. This
57 variable can also be a number. In that case, no more than that number
58 of old headers will be fetched. If it has the value `invisible', all
59 old headers will be fetched, but none will be displayed.
61 The server has to support NOV for any of this to work."
63 :type '(choice (const :tag "off" nil)
66 (sexp :menu-tag "other" t)))
68 (defcustom gnus-refer-thread-limit 200
69 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
70 If t, fetch all the available old headers."
73 (sexp :menu-tag "other" t)))
75 (defcustom gnus-summary-make-false-root 'adopt
76 "*nil means that Gnus won't gather loose threads.
77 If the root of a thread has expired or been read in a previous
78 session, the information necessary to build a complete thread has been
79 lost. Instead of having many small sub-threads from this original thread
80 scattered all over the summary buffer, Gnus can gather them.
82 If non-nil, Gnus will try to gather all loose sub-threads from an
83 original thread into one large thread.
85 If this variable is non-nil, it should be one of `none', `adopt',
88 If this variable is `none', Gnus will not make a false root, but just
89 present the sub-threads after another.
90 If this variable is `dummy', Gnus will create a dummy root that will
91 have all the sub-threads as children.
92 If this variable is `adopt', Gnus will make one of the \"children\"
93 the parent and mark all the step-children as such.
94 If this variable is `empty', the \"children\" are printed with empty
95 subject fields. (Or rather, they will be printed with a string
96 given by the `gnus-summary-same-subject' variable.)"
98 :type '(choice (const :tag "off" nil)
104 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
105 "*A regexp to match subjects to be excluded from loose thread gathering.
106 As loose thread gathering is done on subjects only, that means that
107 there can be many false gatherings performed. By rooting out certain
108 common subjects, gathering might become saner."
112 (defcustom gnus-summary-gather-subject-limit nil
113 "*Maximum length of subject comparisons when gathering loose threads.
114 Use nil to compare full subjects. Setting this variable to a low
115 number will help gather threads that have been corrupted by
116 newsreaders chopping off subject lines, but it might also mean that
117 unrelated articles that have subject that happen to begin with the
118 same few characters will be incorrectly gathered.
120 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
123 :type '(choice (const :tag "off" nil)
125 (sexp :menu-tag "on" t)))
127 (defcustom gnus-simplify-subject-functions nil
128 "List of functions taking a string argument that simplify subjects.
129 The functions are applied recursively."
131 :type '(repeat (list function)))
133 (defcustom gnus-simplify-ignored-prefixes nil
134 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
136 :type '(choice (const :tag "off" nil)
139 (defcustom gnus-build-sparse-threads nil
140 "*If non-nil, fill in the gaps in threads.
141 If `some', only fill in the gaps that are needed to tie loose threads
142 together. If `more', fill in all leaf nodes that Gnus can find. If
143 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
145 :type '(choice (const :tag "off" nil)
148 (sexp :menu-tag "all" t)))
150 (defcustom gnus-summary-thread-gathering-function
151 'gnus-gather-threads-by-subject
152 "Function used for gathering loose threads.
153 There are two pre-defined functions: `gnus-gather-threads-by-subject',
154 which only takes Subjects into consideration; and
155 `gnus-gather-threads-by-references', which compared the References
156 headers of the articles to find matches."
158 :type '(radio (function-item gnus-gather-threads-by-subject)
159 (function-item gnus-gather-threads-by-references)
160 (function :tag "other")))
162 (defcustom gnus-summary-same-subject ""
163 "*String indicating that the current article has the same subject as the previous.
164 This variable will only be used if the value of
165 `gnus-summary-make-false-root' is `empty'."
166 :group 'gnus-summary-format
169 (defcustom gnus-summary-goto-unread t
170 "*If t, marking commands will go to the next unread article.
171 If `never', commands that usually go to the next unread article, will
172 go to the next article, whether it is read or not.
173 If nil, only the marking commands will go to the next (un)read article."
174 :group 'gnus-summary-marks
175 :link '(custom-manual "(gnus)Setting Marks")
176 :type '(choice (const :tag "off" nil)
178 (sexp :menu-tag "on" t)))
180 (defcustom gnus-summary-default-score 0
181 "*Default article score level.
182 All scores generated by the score files will be added to this score.
183 If this variable is nil, scoring will be disabled."
184 :group 'gnus-score-default
185 :type '(choice (const :tag "disable")
188 (defcustom gnus-summary-zcore-fuzz 0
189 "*Fuzziness factor for the zcore in the summary buffer.
190 Articles with scores closer than this to `gnus-summary-default-score'
192 :group 'gnus-summary-format
195 (defcustom gnus-simplify-subject-fuzzy-regexp nil
196 "*Strings to be removed when doing fuzzy matches.
197 This can either be a regular expression or list of regular expressions
198 that will be removed from subject strings if fuzzy subject
199 simplification is selected."
201 :type '(repeat regexp))
203 (defcustom gnus-show-threads t
204 "*If non-nil, display threads in summary mode."
208 (defcustom gnus-thread-hide-subtree nil
209 "*If non-nil, hide all threads initially.
210 If threads are hidden, you have to run the command
211 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
212 to expose hidden threads."
216 (defcustom gnus-thread-hide-killed t
217 "*If non-nil, hide killed threads automatically."
221 (defcustom gnus-thread-ignore-subject nil
222 "*If non-nil, ignore subjects and do all threading based on the Reference header.
223 If nil, which is the default, articles that have different subjects
224 from their parents will start separate threads."
228 (defcustom gnus-thread-operation-ignore-subject t
229 "*If non-nil, subjects will be ignored when doing thread commands.
230 This affects commands like `gnus-summary-kill-thread' and
231 `gnus-summary-lower-thread'.
233 If this variable is nil, articles in the same thread with different
234 subjects will not be included in the operation in question. If this
235 variable is `fuzzy', only articles that have subjects that are fuzzily
236 equal will be included."
238 :type '(choice (const :tag "off" nil)
242 (defcustom gnus-thread-indent-level 4
243 "*Number that says how much each sub-thread should be indented."
247 (defcustom gnus-auto-extend-newsgroup t
248 "*If non-nil, extend newsgroup forward and backward when requested."
249 :group 'gnus-summary-choose
252 (defcustom gnus-auto-select-first t
253 "*If nil, don't select the first unread article when entering a group.
254 If this variable is `best', select the highest-scored unread article
255 in the group. If neither nil nor `best', select the first unread
258 If you want to prevent automatic selection of the first unread article
259 in some newsgroups, set the variable to nil in
260 `gnus-select-group-hook'."
261 :group 'gnus-group-select
262 :type '(choice (const :tag "none" nil)
264 (sexp :menu-tag "first" t)))
266 (defcustom gnus-auto-select-next t
267 "*If non-nil, offer to go to the next group from the end of the previous.
268 If the value is t and the next newsgroup is empty, Gnus will exit
269 summary mode and go back to group mode. If the value is neither nil
270 nor t, Gnus will select the following unread newsgroup. In
271 particular, if the value is the symbol `quietly', the next unread
272 newsgroup will be selected without any confirmation, and if it is
273 `almost-quietly', the next group will be selected without any
274 confirmation if you are located on the last article in the group.
275 Finally, if this variable is `slightly-quietly', the `Z n' command
276 will go to the next group without confirmation."
277 :group 'gnus-summary-maneuvering
278 :type '(choice (const :tag "off" nil)
280 (const almost-quietly)
281 (const slightly-quietly)
282 (sexp :menu-tag "on" t)))
284 (defcustom gnus-auto-select-same nil
285 "*If non-nil, select the next article with the same subject."
286 :group 'gnus-summary-maneuvering
289 (defcustom gnus-summary-check-current nil
290 "*If non-nil, consider the current article when moving.
291 The \"unread\" movement commands will stay on the same line if the
292 current article is unread."
293 :group 'gnus-summary-maneuvering
296 (defcustom gnus-auto-center-summary t
297 "*If non-nil, always center the current summary buffer.
298 In particular, if `vertical' do only vertical recentering. If non-nil
299 and non-`vertical', do both horizontal and vertical recentering."
300 :group 'gnus-summary-maneuvering
301 :type '(choice (const :tag "none" nil)
303 (sexp :menu-tag "both" t)))
305 (defcustom gnus-show-all-headers nil
306 "*If non-nil, don't hide any headers."
307 :group 'gnus-article-hiding
308 :group 'gnus-article-headers
311 (defcustom gnus-summary-ignore-duplicates nil
312 "*If non-nil, ignore articles with identical Message-ID headers."
316 (defcustom gnus-single-article-buffer t
317 "*If non-nil, display all articles in the same buffer.
318 If nil, each group will get its own article buffer."
319 :group 'gnus-article-various
322 (defcustom gnus-break-pages t
323 "*If non-nil, do page breaking on articles.
324 The page delimiter is specified by the `gnus-page-delimiter'
326 :group 'gnus-article-various
329 (defcustom gnus-show-mime t
330 "*If non-nil, do mime processing of articles.
331 The articles will simply be fed to the function given by
332 `gnus-show-mime-method'."
333 :group 'gnus-article-mime
336 (defcustom gnus-move-split-methods nil
337 "*Variable used to suggest where articles are to be moved to.
338 It uses the same syntax as the `gnus-split-methods' variable."
339 :group 'gnus-summary-mail
340 :type '(repeat (choice (list function)
341 (cons regexp (repeat string))
344 (defcustom gnus-unread-mark ?
345 "*Mark used for unread articles."
346 :group 'gnus-summary-marks
349 (defcustom gnus-ticked-mark ?!
350 "*Mark used for ticked articles."
351 :group 'gnus-summary-marks
354 (defcustom gnus-dormant-mark ??
355 "*Mark used for dormant articles."
356 :group 'gnus-summary-marks
359 (defcustom gnus-del-mark ?r
360 "*Mark used for del'd articles."
361 :group 'gnus-summary-marks
364 (defcustom gnus-read-mark ?R
365 "*Mark used for read articles."
366 :group 'gnus-summary-marks
369 (defcustom gnus-expirable-mark ?E
370 "*Mark used for expirable articles."
371 :group 'gnus-summary-marks
374 (defcustom gnus-killed-mark ?K
375 "*Mark used for killed articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-souped-mark ?F
380 "*Mark used for killed articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-kill-file-mark ?X
385 "*Mark used for articles killed by kill files."
386 :group 'gnus-summary-marks
389 (defcustom gnus-low-score-mark ?Y
390 "*Mark used for articles with a low score."
391 :group 'gnus-summary-marks
394 (defcustom gnus-catchup-mark ?C
395 "*Mark used for articles that are caught up."
396 :group 'gnus-summary-marks
399 (defcustom gnus-replied-mark ?A
400 "*Mark used for articles that have been replied to."
401 :group 'gnus-summary-marks
404 (defcustom gnus-cached-mark ?*
405 "*Mark used for articles that are in the cache."
406 :group 'gnus-summary-marks
409 (defcustom gnus-saved-mark ?S
410 "*Mark used for articles that have been saved to."
411 :group 'gnus-summary-marks
414 (defcustom gnus-ancient-mark ?O
415 "*Mark used for ancient articles."
416 :group 'gnus-summary-marks
419 (defcustom gnus-sparse-mark ?Q
420 "*Mark used for sparsely reffed articles."
421 :group 'gnus-summary-marks
424 (defcustom gnus-canceled-mark ?G
425 "*Mark used for canceled articles."
426 :group 'gnus-summary-marks
429 (defcustom gnus-duplicate-mark ?M
430 "*Mark used for duplicate articles."
431 :group 'gnus-summary-marks
434 (defcustom gnus-undownloaded-mark ?@
435 "*Mark used for articles that weren't downloaded."
436 :group 'gnus-summary-marks
439 (defcustom gnus-downloadable-mark ?%
440 "*Mark used for articles that are to be downloaded."
441 :group 'gnus-summary-marks
444 (defcustom gnus-unsendable-mark ?=
445 "*Mark used for articles that won't be sent."
446 :group 'gnus-summary-marks
449 (defcustom gnus-score-over-mark ?+
450 "*Score mark used for articles with high scores."
451 :group 'gnus-summary-marks
454 (defcustom gnus-score-below-mark ?-
455 "*Score mark used for articles with low scores."
456 :group 'gnus-summary-marks
459 (defcustom gnus-empty-thread-mark ?
460 "*There is no thread under the article."
461 :group 'gnus-summary-marks
464 (defcustom gnus-not-empty-thread-mark ?=
465 "*There is a thread under the article."
466 :group 'gnus-summary-marks
469 (defcustom gnus-view-pseudo-asynchronously nil
470 "*If non-nil, Gnus will view pseudo-articles asynchronously."
471 :group 'gnus-extract-view
474 (defcustom gnus-view-pseudos nil
475 "*If `automatic', pseudo-articles will be viewed automatically.
476 If `not-confirm', pseudos will be viewed automatically, and the user
477 will not be asked to confirm the command."
478 :group 'gnus-extract-view
479 :type '(choice (const :tag "off" nil)
481 (const not-confirm)))
483 (defcustom gnus-view-pseudos-separately t
484 "*If non-nil, one pseudo-article will be created for each file to be viewed.
485 If nil, all files that use the same viewing command will be given as a
486 list of parameters to that command."
487 :group 'gnus-extract-view
490 (defcustom gnus-insert-pseudo-articles t
491 "*If non-nil, insert pseudo-articles when decoding articles."
492 :group 'gnus-extract-view
495 (defcustom gnus-summary-dummy-line-format
497 "*The format specification for the dummy roots in the summary buffer.
498 It works along the same lines as a normal formatting string,
499 with some simple extensions.
502 :group 'gnus-threading
505 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
506 "*The format specification for the summary mode line.
507 It works along the same lines as a normal formatting string,
508 with some simple extensions:
511 %p Unprefixed group name
512 %A Current article number
514 %U Number of unread articles in the group
515 %e Number of unselected articles in the group
516 %Z A string with unread/unselected article counts
517 %g Shortish group name
518 %S Subject of the current article
520 %s Current score file name
521 %d Number of dormant articles
522 %r Number of articles that have been marked as read in this session
523 %E Number of articles expunged by the score files"
524 :group 'gnus-summary-format
527 (defcustom gnus-summary-mark-below 0
528 "*Mark all articles with a score below this variable as read.
529 This variable is local to each summary buffer and usually set by the
531 :group 'gnus-score-default
534 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
535 "*List of functions used for sorting articles in the summary buffer.
536 This variable is only used when not using a threaded display."
537 :group 'gnus-summary-sort
538 :type '(repeat (choice (function-item gnus-article-sort-by-number)
539 (function-item gnus-article-sort-by-author)
540 (function-item gnus-article-sort-by-subject)
541 (function-item gnus-article-sort-by-date)
542 (function-item gnus-article-sort-by-score)
543 (function :tag "other"))))
545 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
546 "*List of functions used for sorting threads in the summary buffer.
547 By default, threads are sorted by article number.
549 Each function takes two threads and return non-nil if the first thread
550 should be sorted before the other. If you use more than one function,
551 the primary sort function should be the last. You should probably
552 always include `gnus-thread-sort-by-number' in the list of sorting
553 functions -- preferably first.
555 Ready-made functions include `gnus-thread-sort-by-number',
556 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
557 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
558 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
559 :group 'gnus-summary-sort
560 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
561 (function-item gnus-thread-sort-by-author)
562 (function-item gnus-thread-sort-by-subject)
563 (function-item gnus-thread-sort-by-date)
564 (function-item gnus-thread-sort-by-score)
565 (function-item gnus-thread-sort-by-total-score)
566 (function :tag "other"))))
568 (defcustom gnus-thread-score-function '+
569 "*Function used for calculating the total score of a thread.
571 The function is called with the scores of the article and each
572 subthread and should then return the score of the thread.
574 Some functions you can use are `+', `max', or `min'."
575 :group 'gnus-summary-sort
578 (defcustom gnus-summary-expunge-below nil
579 "All articles that have a score less than this variable will be expunged.
580 This variable is local to the summary buffers."
581 :group 'gnus-score-default
582 :type '(choice (const :tag "off" nil)
585 (defcustom gnus-thread-expunge-below nil
586 "All threads that have a total score less than this variable will be expunged.
587 See `gnus-thread-score-function' for en explanation of what a
590 This variable is local to the summary buffers."
591 :group 'gnus-treading
592 :group 'gnus-score-default
593 :type '(choice (const :tag "off" nil)
596 (defcustom gnus-summary-mode-hook nil
597 "*A hook for Gnus summary mode.
598 This hook is run before any variables are set in the summary buffer."
599 :group 'gnus-summary-various
602 (defcustom gnus-summary-menu-hook nil
603 "*Hook run after the creation of the summary mode menu."
604 :group 'gnus-summary-visual
607 (defcustom gnus-summary-exit-hook nil
608 "*A hook called on exit from the summary buffer.
609 It will be called with point in the group buffer."
610 :group 'gnus-summary-exit
613 (defcustom gnus-summary-prepare-hook nil
614 "*A hook called after the summary buffer has been generated.
615 If you want to modify the summary buffer, you can use this hook."
616 :group 'gnus-summary-various
619 (defcustom gnus-summary-generate-hook nil
620 "*A hook run just before generating the summary buffer.
621 This hook is commonly used to customize threading variables and the
623 :group 'gnus-summary-various
626 (defcustom gnus-select-group-hook nil
627 "*A hook called when a newsgroup is selected.
629 If you'd like to simplify subjects like the
630 `gnus-summary-next-same-subject' command does, you can use the
633 (setq gnus-select-group-hook
636 (mapcar (lambda (header)
637 (mail-header-set-subject
639 (gnus-simplify-subject
640 (mail-header-subject header) 're-only)))
641 gnus-newsgroup-headers))))"
642 :group 'gnus-group-select
645 (defcustom gnus-select-article-hook nil
646 "*A hook called when an article is selected."
647 :group 'gnus-summary-choose
650 (defcustom gnus-visual-mark-article-hook
651 (list 'gnus-highlight-selected-summary)
652 "*Hook run after selecting an article in the summary buffer.
653 It is meant to be used for highlighting the article in some way. It
654 is not run if `gnus-visual' is nil."
655 :group 'gnus-summary-visual
658 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
659 (defcustom gnus-structured-field-decoder
662 (eword-decode-structured-field-body
663 (std11-unfold-string string) 'must-unfold)
665 "Function to decode non-ASCII characters in structured field for summary."
669 (defcustom gnus-unstructured-field-decoder
672 (eword-decode-unstructured-field-body
673 (std11-unfold-string string) 'must-unfold)
675 "Function to decode non-ASCII characters in unstructured field for summary."
679 (defcustom gnus-parse-headers-hook
680 '(gnus-set-summary-default-charset)
681 "*A hook called before parsing the headers."
685 (defcustom gnus-exit-group-hook nil
686 "*A hook called when exiting (not quitting) summary mode."
690 (defcustom gnus-summary-update-hook
691 (list 'gnus-summary-highlight-line)
692 "*A hook called when a summary line is changed.
693 The hook will not be called if `gnus-visual' is nil.
695 The default function `gnus-summary-highlight-line' will
696 highlight the line according to the `gnus-summary-highlight'
698 :group 'gnus-summary-visual
701 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
702 "*A hook called when an article is selected for the first time.
703 The hook is intended to mark an article as read (or unread)
704 automatically when it is selected."
705 :group 'gnus-summary-choose
708 (defcustom gnus-group-no-more-groups-hook nil
709 "*A hook run when returning to group mode having no more (unread) groups."
710 :group 'gnus-group-select
713 (defcustom gnus-ps-print-hook nil
714 "*A hook run before ps-printing something from Gnus."
718 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
719 "Face used for highlighting the current article in the summary buffer."
720 :group 'gnus-summary-visual
723 (defcustom gnus-summary-highlight
724 '(((= mark gnus-canceled-mark)
725 . gnus-summary-cancelled-face)
726 ((and (> score default)
727 (or (= mark gnus-dormant-mark)
728 (= mark gnus-ticked-mark)))
729 . gnus-summary-high-ticked-face)
730 ((and (< score default)
731 (or (= mark gnus-dormant-mark)
732 (= mark gnus-ticked-mark)))
733 . gnus-summary-low-ticked-face)
734 ((or (= mark gnus-dormant-mark)
735 (= mark gnus-ticked-mark))
736 . gnus-summary-normal-ticked-face)
737 ((and (> score default) (= mark gnus-ancient-mark))
738 . gnus-summary-high-ancient-face)
739 ((and (< score default) (= mark gnus-ancient-mark))
740 . gnus-summary-low-ancient-face)
741 ((= mark gnus-ancient-mark)
742 . gnus-summary-normal-ancient-face)
743 ((and (> score default) (= mark gnus-unread-mark))
744 . gnus-summary-high-unread-face)
745 ((and (< score default) (= mark gnus-unread-mark))
746 . gnus-summary-low-unread-face)
747 ((and (= mark gnus-unread-mark))
748 . gnus-summary-normal-unread-face)
750 . gnus-summary-high-read-face)
752 . gnus-summary-low-read-face)
754 . gnus-summary-normal-read-face))
755 "Controls the highlighting of summary buffer lines.
757 A list of (FORM . FACE) pairs. When deciding how a a particular
758 summary line should be displayed, each form is evaluated. The content
759 of the face field after the first true form is used. You can change
760 how those summary lines are displayed, by editing the face field.
762 You can use the following variables in the FORM field.
764 score: The articles score
765 default: The default article score.
766 below: The score below which articles are automatically marked as read.
767 mark: The articles mark."
768 :group 'gnus-summary-visual
769 :type '(repeat (cons (sexp :tag "Form" nil)
772 (defcustom gnus-alter-header-function nil
773 "Function called to allow alteration of article header structures.
774 The function is called with one parameter, the article header vector,
775 which it may alter in any way.")
777 ;;; Internal variables
779 (defvar gnus-scores-exclude-files nil)
780 (defvar gnus-page-broken nil)
782 (defvar gnus-original-article nil)
783 (defvar gnus-article-internal-prepare-hook nil)
784 (defvar gnus-newsgroup-process-stack nil)
786 (defvar gnus-thread-indent-array nil)
787 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
789 ;; Avoid highlighting in kill files.
790 (defvar gnus-summary-inhibit-highlight nil)
791 (defvar gnus-newsgroup-selected-overlay nil)
792 (defvar gnus-inhibit-limiting nil)
793 (defvar gnus-newsgroup-adaptive-score-file nil)
794 (defvar gnus-current-score-file nil)
795 (defvar gnus-current-move-group nil)
796 (defvar gnus-current-copy-group nil)
797 (defvar gnus-current-crosspost-group nil)
799 (defvar gnus-newsgroup-dependencies nil)
800 (defvar gnus-newsgroup-adaptive nil)
801 (defvar gnus-summary-display-article-function nil)
802 (defvar gnus-summary-highlight-line-function nil
803 "Function called after highlighting a summary line.")
805 (defvar gnus-summary-line-format-alist
806 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
807 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
808 (?s gnus-tmp-subject-or-nil ?s)
809 (?n gnus-tmp-name ?s)
810 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
812 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
814 (?F gnus-tmp-from ?s)
815 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
816 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
817 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
818 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
819 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
820 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
821 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
822 (?L gnus-tmp-lines ?d)
823 (?I gnus-tmp-indentation ?s)
824 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
825 (?R gnus-tmp-replied ?c)
826 (?\[ gnus-tmp-opening-bracket ?c)
827 (?\] gnus-tmp-closing-bracket ?c)
828 (?\> (make-string gnus-tmp-level ? ) ?s)
829 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
830 (?i gnus-tmp-score ?d)
831 (?z gnus-tmp-score-char ?c)
832 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
833 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
834 (?U gnus-tmp-unread ?c)
835 (?t (gnus-summary-number-of-articles-in-thread
836 (and (boundp 'thread) (car thread)) gnus-tmp-level)
838 (?e (gnus-summary-number-of-articles-in-thread
839 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
841 (?u gnus-tmp-user-defined ?s)
842 (?P (gnus-pick-line-number) ?d))
843 "An alist of format specifications that can appear in summary lines,
844 and what variables they correspond with, along with the type of the
845 variable (string, integer, character, etc).")
847 (defvar gnus-summary-dummy-line-format-alist
848 `((?S gnus-tmp-subject ?s)
849 (?N gnus-tmp-number ?d)
850 (?u gnus-tmp-user-defined ?s)))
852 (defvar gnus-summary-mode-line-format-alist
853 `((?G gnus-tmp-group-name ?s)
854 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
855 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
856 (?A gnus-tmp-article-number ?d)
857 (?Z gnus-tmp-unread-and-unselected ?s)
859 (?U gnus-tmp-unread-and-unticked ?d)
860 (?S gnus-tmp-subject ?s)
861 (?e gnus-tmp-unselected ?d)
862 (?u gnus-tmp-user-defined ?s)
863 (?d (length gnus-newsgroup-dormant) ?d)
864 (?t (length gnus-newsgroup-marked) ?d)
865 (?r (length gnus-newsgroup-reads) ?d)
866 (?E gnus-newsgroup-expunged-tally ?d)
867 (?s (gnus-current-score-file-nondirectory) ?s)))
869 (defvar gnus-last-search-regexp nil
870 "Default regexp for article search command.")
872 (defvar gnus-last-shell-command nil
873 "Default shell command on article.")
875 (defvar gnus-newsgroup-begin nil)
876 (defvar gnus-newsgroup-end nil)
877 (defvar gnus-newsgroup-last-rmail nil)
878 (defvar gnus-newsgroup-last-mail nil)
879 (defvar gnus-newsgroup-last-folder nil)
880 (defvar gnus-newsgroup-last-file nil)
881 (defvar gnus-newsgroup-auto-expire nil)
882 (defvar gnus-newsgroup-active nil)
884 (defvar gnus-newsgroup-data nil)
885 (defvar gnus-newsgroup-data-reverse nil)
886 (defvar gnus-newsgroup-limit nil)
887 (defvar gnus-newsgroup-limits nil)
889 (defvar gnus-newsgroup-unreads nil
890 "List of unread articles in the current newsgroup.")
892 (defvar gnus-newsgroup-unselected nil
893 "List of unselected unread articles in the current newsgroup.")
895 (defvar gnus-newsgroup-reads nil
896 "Alist of read articles and article marks in the current newsgroup.")
898 (defvar gnus-newsgroup-expunged-tally nil)
900 (defvar gnus-newsgroup-marked nil
901 "List of ticked articles in the current newsgroup (a subset of unread art).")
903 (defvar gnus-newsgroup-killed nil
904 "List of ranges of articles that have been through the scoring process.")
906 (defvar gnus-newsgroup-cached nil
907 "List of articles that come from the article cache.")
909 (defvar gnus-newsgroup-saved nil
910 "List of articles that have been saved.")
912 (defvar gnus-newsgroup-kill-headers nil)
914 (defvar gnus-newsgroup-replied nil
915 "List of articles that have been replied to in the current newsgroup.")
917 (defvar gnus-newsgroup-expirable nil
918 "List of articles in the current newsgroup that can be expired.")
920 (defvar gnus-newsgroup-processable nil
921 "List of articles in the current newsgroup that can be processed.")
923 (defvar gnus-newsgroup-downloadable nil
924 "List of articles in the current newsgroup that can be processed.")
926 (defvar gnus-newsgroup-undownloaded nil
927 "List of articles in the current newsgroup that haven't been downloaded..")
929 (defvar gnus-newsgroup-unsendable nil
930 "List of articles in the current newsgroup that won't be sent.")
932 (defvar gnus-newsgroup-bookmarks nil
933 "List of articles in the current newsgroup that have bookmarks.")
935 (defvar gnus-newsgroup-dormant nil
936 "List of dormant articles in the current newsgroup.")
938 (defvar gnus-newsgroup-scored nil
939 "List of scored articles in the current newsgroup.")
941 (defvar gnus-newsgroup-headers nil
942 "List of article headers in the current newsgroup.")
944 (defvar gnus-newsgroup-threads nil)
946 (defvar gnus-newsgroup-prepared nil
947 "Whether the current group has been prepared properly.")
949 (defvar gnus-newsgroup-ancient nil
950 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
952 (defvar gnus-newsgroup-sparse nil)
954 (defvar gnus-current-article nil)
955 (defvar gnus-article-current nil)
956 (defvar gnus-current-headers nil)
957 (defvar gnus-have-all-headers nil)
958 (defvar gnus-last-article nil)
959 (defvar gnus-newsgroup-history nil)
961 (defconst gnus-summary-local-variables
962 '(gnus-newsgroup-name
963 gnus-newsgroup-begin gnus-newsgroup-end
964 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
965 gnus-newsgroup-last-folder gnus-newsgroup-last-file
966 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
967 gnus-newsgroup-unselected gnus-newsgroup-marked
968 gnus-newsgroup-reads gnus-newsgroup-saved
969 gnus-newsgroup-replied gnus-newsgroup-expirable
970 gnus-newsgroup-processable gnus-newsgroup-killed
971 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
972 gnus-newsgroup-unsendable
973 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
974 gnus-newsgroup-headers gnus-newsgroup-threads
975 gnus-newsgroup-prepared gnus-summary-highlight-line-function
976 gnus-current-article gnus-current-headers gnus-have-all-headers
977 gnus-last-article gnus-article-internal-prepare-hook
978 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
979 gnus-newsgroup-scored gnus-newsgroup-kill-headers
980 gnus-thread-expunge-below
981 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
982 (gnus-summary-mark-below . global)
983 gnus-newsgroup-active gnus-scores-exclude-files
984 gnus-newsgroup-history gnus-newsgroup-ancient
985 gnus-newsgroup-sparse gnus-newsgroup-process-stack
986 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
987 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
988 (gnus-newsgroup-expunged-tally . 0)
989 gnus-cache-removable-articles gnus-newsgroup-cached
990 gnus-newsgroup-data gnus-newsgroup-data-reverse
991 gnus-newsgroup-limit gnus-newsgroup-limits)
992 "Variables that are buffer-local to the summary buffers.")
994 ;; Byte-compiler warning.
995 (defvar gnus-article-mode-map)
997 ;; Subject simplification.
999 (defun gnus-simplify-whitespace (str)
1000 "Remove excessive whitespace."
1003 (while (string-match "[ \t][ \t]+" mystr)
1004 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1006 (substring mystr (match-end 0)))))
1008 (when (string-match "^[ \t]+" mystr)
1009 (setq mystr (substring mystr (match-end 0))))
1011 (when (string-match "[ \t]+$" mystr)
1012 (setq mystr (substring mystr 0 (match-beginning 0))))
1015 (defsubst gnus-simplify-subject-re (subject)
1016 "Remove \"Re:\" from subject lines."
1017 (if (string-match "^[Rr][Ee]: *" subject)
1018 (substring subject (match-end 0))
1021 (defun gnus-simplify-subject (subject &optional re-only)
1022 "Remove `Re:' and words in parentheses.
1023 If RE-ONLY is non-nil, strip leading `Re:'s only."
1024 (let ((case-fold-search t)) ;Ignore case.
1025 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1026 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1027 (setq subject (substring subject (match-end 0))))
1028 ;; Remove uninteresting prefixes.
1029 (when (and (not re-only)
1030 gnus-simplify-ignored-prefixes
1031 (string-match gnus-simplify-ignored-prefixes subject))
1032 (setq subject (substring subject (match-end 0))))
1033 ;; Remove words in parentheses from end.
1035 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1036 (setq subject (substring subject 0 (match-beginning 0)))))
1037 ;; Return subject string.
1040 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1042 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1043 (goto-char (point-min))
1044 (while (re-search-forward regexp nil t)
1045 (replace-match (or newtext ""))))
1047 (defun gnus-simplify-buffer-fuzzy ()
1048 "Simplify string in the buffer fuzzily.
1049 The string in the accessible portion of the current buffer is simplified.
1050 It is assumed to be a single-line subject.
1051 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1052 matter is removed. Additional things can be deleted by setting
1053 gnus-simplify-subject-fuzzy-regexp."
1054 (let ((case-fold-search t)
1056 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1058 (while (not (eq modified-tick (buffer-modified-tick)))
1059 (setq modified-tick (buffer-modified-tick))
1061 ((listp gnus-simplify-subject-fuzzy-regexp)
1062 (mapcar 'gnus-simplify-buffer-fuzzy-step
1063 gnus-simplify-subject-fuzzy-regexp))
1064 (gnus-simplify-subject-fuzzy-regexp
1065 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1066 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1067 (gnus-simplify-buffer-fuzzy-step
1068 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1069 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1071 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1072 (gnus-simplify-buffer-fuzzy-step " +" " ")
1073 (gnus-simplify-buffer-fuzzy-step " $")
1074 (gnus-simplify-buffer-fuzzy-step "^ +")))
1076 (defun gnus-simplify-subject-fuzzy (subject)
1077 "Simplify a subject string fuzzily.
1078 See `gnus-simplify-buffer-fuzzy' for details."
1080 (gnus-set-work-buffer)
1081 (let ((case-fold-search t))
1083 (inline (gnus-simplify-buffer-fuzzy))
1086 (defsubst gnus-simplify-subject-fully (subject)
1087 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1089 (gnus-simplify-subject-functions
1090 (gnus-map-function gnus-simplify-subject-functions subject))
1091 ((null gnus-summary-gather-subject-limit)
1092 (gnus-simplify-subject-re subject))
1093 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1094 (gnus-simplify-subject-fuzzy subject))
1095 ((numberp gnus-summary-gather-subject-limit)
1096 (gnus-limit-string (gnus-simplify-subject-re subject)
1097 gnus-summary-gather-subject-limit))
1101 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1102 "Check whether two subjects are equal.
1103 If optional argument simple-first is t, first argument is already
1106 ((null simple-first)
1107 (equal (gnus-simplify-subject-fully s1)
1108 (gnus-simplify-subject-fully s2)))
1111 (gnus-simplify-subject-fully s2)))))
1113 (defun gnus-summary-bubble-group ()
1114 "Increase the score of the current group.
1115 This is a handy function to add to `gnus-summary-exit-hook' to
1116 increase the score of each group you read."
1117 (gnus-group-add-score gnus-newsgroup-name))
1121 ;;; Gnus summary mode
1124 (put 'gnus-summary-mode 'mode-class 'special)
1127 ;; Non-orthogonal keys
1129 (gnus-define-keys gnus-summary-mode-map
1130 " " gnus-summary-next-page
1131 "\177" gnus-summary-prev-page
1132 [delete] gnus-summary-prev-page
1133 "\r" gnus-summary-scroll-up
1134 "\e\r" gnus-summary-scroll-down
1135 "n" gnus-summary-next-unread-article
1136 "p" gnus-summary-prev-unread-article
1137 "N" gnus-summary-next-article
1138 "P" gnus-summary-prev-article
1139 "\M-\C-n" gnus-summary-next-same-subject
1140 "\M-\C-p" gnus-summary-prev-same-subject
1141 "\M-n" gnus-summary-next-unread-subject
1142 "\M-p" gnus-summary-prev-unread-subject
1143 "." gnus-summary-first-unread-article
1144 "," gnus-summary-best-unread-article
1145 "\M-s" gnus-summary-search-article-forward
1146 "\M-r" gnus-summary-search-article-backward
1147 "<" gnus-summary-beginning-of-article
1148 ">" gnus-summary-end-of-article
1149 "j" gnus-summary-goto-article
1150 "^" gnus-summary-refer-parent-article
1151 "\M-^" gnus-summary-refer-article
1152 "u" gnus-summary-tick-article-forward
1153 "!" gnus-summary-tick-article-forward
1154 "U" gnus-summary-tick-article-backward
1155 "d" gnus-summary-mark-as-read-forward
1156 "D" gnus-summary-mark-as-read-backward
1157 "E" gnus-summary-mark-as-expirable
1158 "\M-u" gnus-summary-clear-mark-forward
1159 "\M-U" gnus-summary-clear-mark-backward
1160 "k" gnus-summary-kill-same-subject-and-select
1161 "\C-k" gnus-summary-kill-same-subject
1162 "\M-\C-k" gnus-summary-kill-thread
1163 "\M-\C-l" gnus-summary-lower-thread
1164 "e" gnus-summary-edit-article
1165 "#" gnus-summary-mark-as-processable
1166 "\M-#" gnus-summary-unmark-as-processable
1167 "\M-\C-t" gnus-summary-toggle-threads
1168 "\M-\C-s" gnus-summary-show-thread
1169 "\M-\C-h" gnus-summary-hide-thread
1170 "\M-\C-f" gnus-summary-next-thread
1171 "\M-\C-b" gnus-summary-prev-thread
1172 "\M-\C-u" gnus-summary-up-thread
1173 "\M-\C-d" gnus-summary-down-thread
1174 "&" gnus-summary-execute-command
1175 "c" gnus-summary-catchup-and-exit
1176 "\C-w" gnus-summary-mark-region-as-read
1177 "\C-t" gnus-summary-toggle-truncation
1178 "?" gnus-summary-mark-as-dormant
1179 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1180 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1181 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1182 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1183 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1184 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1185 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1186 "=" gnus-summary-expand-window
1187 "\C-x\C-s" gnus-summary-reselect-current-group
1188 "\M-g" gnus-summary-rescan-group
1189 "w" gnus-summary-stop-page-breaking
1190 "\C-c\C-r" gnus-summary-caesar-message
1191 "\M-t" gnus-summary-toggle-mime
1192 "f" gnus-summary-followup
1193 "F" gnus-summary-followup-with-original
1194 "C" gnus-summary-cancel-article
1195 "r" gnus-summary-reply
1196 "R" gnus-summary-reply-with-original
1197 "\C-c\C-f" gnus-summary-mail-forward
1198 "o" gnus-summary-save-article
1199 "\C-o" gnus-summary-save-article-mail
1200 "|" gnus-summary-pipe-output
1201 "\M-k" gnus-summary-edit-local-kill
1202 "\M-K" gnus-summary-edit-global-kill
1204 "\C-c\C-d" gnus-summary-describe-group
1205 "q" gnus-summary-exit
1206 "Q" gnus-summary-exit-no-update
1207 "\C-c\C-i" gnus-info-find-node
1208 gnus-mouse-2 gnus-mouse-pick-article
1209 "m" gnus-summary-mail-other-window
1210 "a" gnus-summary-post-news
1211 "x" gnus-summary-limit-to-unread
1212 "s" gnus-summary-isearch-article
1213 "t" gnus-article-hide-headers
1214 "g" gnus-summary-show-article
1215 "l" gnus-summary-goto-last-article
1216 "v" gnus-summary-preview-mime-message
1217 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1218 "\C-d" gnus-summary-enter-digest-group
1219 "\M-\C-d" gnus-summary-read-document
1221 "*" gnus-cache-enter-article
1222 "\M-*" gnus-cache-remove-article
1223 "\M-&" gnus-summary-universal-argument
1224 "\C-l" gnus-recenter
1225 "I" gnus-summary-increase-score
1226 "L" gnus-summary-lower-score
1227 "\M-i" gnus-symbolic-argument
1228 "h" gnus-summary-select-article-buffer
1230 "V" gnus-summary-score-map
1231 "X" gnus-uu-extract-map
1232 "S" gnus-summary-send-map)
1234 ;; Sort of orthogonal keymap
1235 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1236 "t" gnus-summary-tick-article-forward
1237 "!" gnus-summary-tick-article-forward
1238 "d" gnus-summary-mark-as-read-forward
1239 "r" gnus-summary-mark-as-read-forward
1240 "c" gnus-summary-clear-mark-forward
1241 " " gnus-summary-clear-mark-forward
1242 "e" gnus-summary-mark-as-expirable
1243 "x" gnus-summary-mark-as-expirable
1244 "?" gnus-summary-mark-as-dormant
1245 "b" gnus-summary-set-bookmark
1246 "B" gnus-summary-remove-bookmark
1247 "#" gnus-summary-mark-as-processable
1248 "\M-#" gnus-summary-unmark-as-processable
1249 "S" gnus-summary-limit-include-expunged
1250 "C" gnus-summary-catchup
1251 "H" gnus-summary-catchup-to-here
1252 "\C-c" gnus-summary-catchup-all
1253 "k" gnus-summary-kill-same-subject-and-select
1254 "K" gnus-summary-kill-same-subject
1255 "P" gnus-uu-mark-map)
1257 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1258 "c" gnus-summary-clear-above
1259 "u" gnus-summary-tick-above
1260 "m" gnus-summary-mark-above
1261 "k" gnus-summary-kill-below)
1263 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1264 "/" gnus-summary-limit-to-subject
1265 "n" gnus-summary-limit-to-articles
1266 "w" gnus-summary-pop-limit
1267 "s" gnus-summary-limit-to-subject
1268 "a" gnus-summary-limit-to-author
1269 "u" gnus-summary-limit-to-unread
1270 "m" gnus-summary-limit-to-marks
1271 "v" gnus-summary-limit-to-score
1272 "*" gnus-summary-limit-include-cached
1273 "D" gnus-summary-limit-include-dormant
1274 "T" gnus-summary-limit-include-thread
1275 "d" gnus-summary-limit-exclude-dormant
1276 "t" gnus-summary-limit-to-age
1277 "E" gnus-summary-limit-include-expunged
1278 "c" gnus-summary-limit-exclude-childless-dormant
1279 "C" gnus-summary-limit-mark-excluded-as-read)
1281 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1282 "n" gnus-summary-next-unread-article
1283 "p" gnus-summary-prev-unread-article
1284 "N" gnus-summary-next-article
1285 "P" gnus-summary-prev-article
1286 "\C-n" gnus-summary-next-same-subject
1287 "\C-p" gnus-summary-prev-same-subject
1288 "\M-n" gnus-summary-next-unread-subject
1289 "\M-p" gnus-summary-prev-unread-subject
1290 "f" gnus-summary-first-unread-article
1291 "b" gnus-summary-best-unread-article
1292 "j" gnus-summary-goto-article
1293 "g" gnus-summary-goto-subject
1294 "l" gnus-summary-goto-last-article
1295 "o" gnus-summary-pop-article)
1297 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1298 "k" gnus-summary-kill-thread
1299 "l" gnus-summary-lower-thread
1300 "i" gnus-summary-raise-thread
1301 "T" gnus-summary-toggle-threads
1302 "t" gnus-summary-rethread-current
1303 "^" gnus-summary-reparent-thread
1304 "s" gnus-summary-show-thread
1305 "S" gnus-summary-show-all-threads
1306 "h" gnus-summary-hide-thread
1307 "H" gnus-summary-hide-all-threads
1308 "n" gnus-summary-next-thread
1309 "p" gnus-summary-prev-thread
1310 "u" gnus-summary-up-thread
1311 "o" gnus-summary-top-thread
1312 "d" gnus-summary-down-thread
1313 "#" gnus-uu-mark-thread
1314 "\M-#" gnus-uu-unmark-thread)
1316 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1317 "g" gnus-summary-prepare
1318 "c" gnus-summary-insert-cached-articles)
1320 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1321 "c" gnus-summary-catchup-and-exit
1322 "C" gnus-summary-catchup-all-and-exit
1323 "E" gnus-summary-exit-no-update
1324 "Q" gnus-summary-exit
1325 "Z" gnus-summary-exit
1326 "n" gnus-summary-catchup-and-goto-next-group
1327 "R" gnus-summary-reselect-current-group
1328 "G" gnus-summary-rescan-group
1329 "N" gnus-summary-next-group
1330 "s" gnus-summary-save-newsrc
1331 "P" gnus-summary-prev-group)
1333 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1334 " " gnus-summary-next-page
1335 "n" gnus-summary-next-page
1336 "\177" gnus-summary-prev-page
1337 [delete] gnus-summary-prev-page
1338 "p" gnus-summary-prev-page
1339 "\r" gnus-summary-scroll-up
1340 "<" gnus-summary-beginning-of-article
1341 ">" gnus-summary-end-of-article
1342 "b" gnus-summary-beginning-of-article
1343 "e" gnus-summary-end-of-article
1344 "^" gnus-summary-refer-parent-article
1345 "r" gnus-summary-refer-parent-article
1346 "R" gnus-summary-refer-references
1347 "T" gnus-summary-refer-thread
1348 "g" gnus-summary-show-article
1349 "s" gnus-summary-isearch-article
1350 "P" gnus-summary-print-article)
1352 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1353 "b" gnus-article-add-buttons
1354 "B" gnus-article-add-buttons-to-head
1355 "o" gnus-article-treat-overstrike
1356 "e" gnus-article-emphasize
1357 "w" gnus-article-fill-cited-article
1358 "c" gnus-article-remove-cr
1359 "q" gnus-article-de-quoted-unreadable
1360 "f" gnus-article-display-x-face
1361 "l" gnus-summary-stop-page-breaking
1362 "r" gnus-summary-caesar-message
1363 "t" gnus-article-hide-headers
1364 "v" gnus-summary-verbose-headers
1365 "m" gnus-summary-toggle-mime
1366 "h" gnus-article-treat-html
1367 "d" gnus-article-treat-dumbquotes)
1369 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1370 "a" gnus-article-hide
1371 "h" gnus-article-hide-headers
1372 "b" gnus-article-hide-boring-headers
1373 "s" gnus-article-hide-signature
1374 "c" gnus-article-hide-citation
1375 "p" gnus-article-hide-pgp
1376 "P" gnus-article-hide-pem
1377 "\C-c" gnus-article-hide-citation-maybe)
1379 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1380 "a" gnus-article-highlight
1381 "h" gnus-article-highlight-headers
1382 "c" gnus-article-highlight-citation
1383 "s" gnus-article-highlight-signature)
1385 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1386 "z" gnus-article-date-ut
1387 "u" gnus-article-date-ut
1388 "l" gnus-article-date-local
1389 "e" gnus-article-date-lapsed
1390 "o" gnus-article-date-original
1391 "s" gnus-article-date-user)
1393 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1394 "t" gnus-article-remove-trailing-blank-lines
1395 "l" gnus-article-strip-leading-blank-lines
1396 "m" gnus-article-strip-multiple-blank-lines
1397 "a" gnus-article-strip-blank-lines
1398 "s" gnus-article-strip-leading-space)
1400 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1402 "f" gnus-summary-fetch-faq
1403 "d" gnus-summary-describe-group
1404 "h" gnus-summary-describe-briefly
1405 "i" gnus-info-find-node)
1407 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1408 "e" gnus-summary-expire-articles
1409 "\M-\C-e" gnus-summary-expire-articles-now
1410 "\177" gnus-summary-delete-article
1411 [delete] gnus-summary-delete-article
1412 "m" gnus-summary-move-article
1413 "r" gnus-summary-respool-article
1414 "w" gnus-summary-edit-article
1415 "c" gnus-summary-copy-article
1416 "B" gnus-summary-crosspost-article
1417 "q" gnus-summary-respool-query
1418 "i" gnus-summary-import-article
1419 "p" gnus-summary-article-posted-p)
1421 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1422 "o" gnus-summary-save-article
1423 "m" gnus-summary-save-article-mail
1424 "F" gnus-summary-write-article-file
1425 "r" gnus-summary-save-article-rmail
1426 "f" gnus-summary-save-article-file
1427 "b" gnus-summary-save-article-body-file
1428 "h" gnus-summary-save-article-folder
1429 "v" gnus-summary-save-article-vm
1430 "p" gnus-summary-pipe-output
1431 "s" gnus-soup-add-article))
1433 (defun gnus-summary-make-menu-bar ()
1434 (gnus-turn-off-edit-menu 'summary)
1436 (unless (boundp 'gnus-summary-misc-menu)
1439 gnus-summary-kill-menu gnus-summary-mode-map ""
1444 ["Enter score..." gnus-summary-score-entry t]
1445 ["Customize" gnus-score-customize t])
1446 (gnus-make-score-map 'increase)
1447 (gnus-make-score-map 'lower)
1449 ["Kill below" gnus-summary-kill-below t]
1450 ["Mark above" gnus-summary-mark-above t]
1451 ["Tick above" gnus-summary-tick-above t]
1452 ["Clear above" gnus-summary-clear-above t])
1453 ["Current score" gnus-summary-current-score t]
1454 ["Set score" gnus-summary-set-score t]
1455 ["Switch current score file..." gnus-score-change-score-file t]
1456 ["Set mark below..." gnus-score-set-mark-below t]
1457 ["Set expunge below..." gnus-score-set-expunge-below t]
1458 ["Edit current score file" gnus-score-edit-current-scores t]
1459 ["Edit score file" gnus-score-edit-file t]
1460 ["Trace score" gnus-score-find-trace t]
1461 ["Find words" gnus-score-find-favourite-words t]
1462 ["Rescore buffer" gnus-summary-rescore t]
1463 ["Increase score..." gnus-summary-increase-score t]
1464 ["Lower score..." gnus-summary-lower-score t]))))
1467 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1469 :selected (null gnus-score-default-header)]
1470 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1472 :selected (eq gnus-score-default-header 'a)]
1473 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1475 :selected (eq gnus-score-default-header 's)]
1477 (gnus-score-set-default 'gnus-score-default-header 'b)
1479 :selected (eq gnus-score-default-header 'b )]
1481 (gnus-score-set-default 'gnus-score-default-header 'h)
1483 :selected (eq gnus-score-default-header 'h )]
1484 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1486 :selected (eq gnus-score-default-header 'i )]
1487 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1489 :selected (eq gnus-score-default-header 't )]
1491 (gnus-score-set-default 'gnus-score-default-header 'x)
1493 :selected (eq gnus-score-default-header 'x )]
1494 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1496 :selected (eq gnus-score-default-header 'l )]
1497 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1499 :selected (eq gnus-score-default-header 'd )]
1500 ["Followups to author"
1501 (gnus-score-set-default 'gnus-score-default-header 'f)
1503 :selected (eq gnus-score-default-header 'f )])
1505 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1507 :selected (null gnus-score-default-type)]
1508 ;; The `:active' key is commented out in the following,
1509 ;; because the GNU Emacs hack to support radio buttons use
1510 ;; active to indicate which button is selected.
1511 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1513 ;; :active (not (memq gnus-score-default-header '(l d)))
1514 :selected (eq gnus-score-default-type 's)]
1515 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1517 ;; :active (not (memq gnus-score-default-header '(l d)))
1518 :selected (eq gnus-score-default-type 'r)]
1519 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1521 ;; :active (not (memq gnus-score-default-header '(l d)))
1522 :selected (eq gnus-score-default-type 'e)]
1523 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1525 ;; :active (not (memq gnus-score-default-header '(l d)))
1526 :selected (eq gnus-score-default-type 'f)]
1527 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1529 ;; :active (eq (gnus-score-default-header 'd))
1530 :selected (eq gnus-score-default-type 'b)]
1531 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1533 ;; :active (eq (gnus-score-default-header 'd))
1534 :selected (eq gnus-score-default-type 'n)]
1535 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1537 ;; :active (eq (gnus-score-default-header 'd))
1538 :selected (eq gnus-score-default-type 'a)]
1540 (gnus-score-set-default 'gnus-score-default-type '<)
1542 ;; :active (eq (gnus-score-default-header 'l))
1543 :selected (eq gnus-score-default-type '<)]
1545 (gnus-score-set-default 'gnus-score-default-type '=)
1547 ;; :active (eq (gnus-score-default-header 'l))
1548 :selected (eq gnus-score-default-type '=)]
1549 ["Greater than number"
1550 (gnus-score-set-default 'gnus-score-default-type '>)
1552 ;; :active (eq (gnus-score-default-header 'l))
1553 :selected (eq gnus-score-default-type '>)])
1554 ["Default fold" gnus-score-default-fold-toggle
1556 :selected gnus-score-default-fold]
1558 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1560 :selected (null gnus-score-default-duration)]
1562 (gnus-score-set-default 'gnus-score-default-duration 'p)
1564 :selected (eq gnus-score-default-duration 'p)]
1566 (gnus-score-set-default 'gnus-score-default-duration 't)
1568 :selected (eq gnus-score-default-duration 't)]
1570 (gnus-score-set-default 'gnus-score-default-duration 'i)
1572 :selected (eq gnus-score-default-duration 'i)]))
1575 gnus-summary-article-menu gnus-summary-mode-map ""
1578 ["All" gnus-article-hide t]
1579 ["Headers" gnus-article-hide-headers t]
1580 ["Signature" gnus-article-hide-signature t]
1581 ["Citation" gnus-article-hide-citation t]
1582 ["PGP" gnus-article-hide-pgp t]
1583 ["Boring headers" gnus-article-hide-boring-headers t])
1585 ["All" gnus-article-highlight t]
1586 ["Headers" gnus-article-highlight-headers t]
1587 ["Signature" gnus-article-highlight-signature t]
1588 ["Citation" gnus-article-highlight-citation t])
1590 ["Local" gnus-article-date-local t]
1591 ["UT" gnus-article-date-ut t]
1592 ["Original" gnus-article-date-original t]
1593 ["Lapsed" gnus-article-date-lapsed t]
1594 ["User-defined" gnus-article-date-user t])
1597 ["Leading" gnus-article-strip-leading-blank-lines t]
1598 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1599 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1600 ["All of the above" gnus-article-strip-blank-lines t]
1601 ["Leading space" gnus-article-strip-leading-space t])
1602 ["Overstrike" gnus-article-treat-overstrike t]
1603 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1604 ["Emphasis" gnus-article-emphasize t]
1605 ["Word wrap" gnus-article-fill-cited-article t]
1606 ["CR" gnus-article-remove-cr t]
1607 ["Show X-Face" gnus-article-display-x-face t]
1608 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1609 ["UnHTMLize" gnus-article-treat-html t]
1610 ["Rot 13" gnus-summary-caesar-message t]
1611 ["Unix pipe" gnus-summary-pipe-message t]
1612 ["Add buttons" gnus-article-add-buttons t]
1613 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1614 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1615 ["Toggle MIME" gnus-summary-toggle-mime t]
1616 ["Verbose header" gnus-summary-verbose-headers t]
1617 ["Toggle header" gnus-summary-toggle-header t])
1619 ["Save in default format" gnus-summary-save-article t]
1620 ["Save in file" gnus-summary-save-article-file t]
1621 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1622 ["Save in MH folder" gnus-summary-save-article-folder t]
1623 ["Save in VM folder" gnus-summary-save-article-vm t]
1624 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1625 ["Save body in file" gnus-summary-save-article-body-file t]
1626 ["Pipe through a filter" gnus-summary-pipe-output t]
1627 ["Add to SOUP packet" gnus-soup-add-article t]
1628 ["Print" gnus-summary-print-article t])
1630 ["Respool article..." gnus-summary-respool-article t]
1631 ["Move article..." gnus-summary-move-article
1632 (gnus-check-backend-function
1633 'request-move-article gnus-newsgroup-name)]
1634 ["Copy article..." gnus-summary-copy-article t]
1635 ["Crosspost article..." gnus-summary-crosspost-article
1636 (gnus-check-backend-function
1637 'request-replace-article gnus-newsgroup-name)]
1638 ["Import file..." gnus-summary-import-article t]
1639 ["Check if posted" gnus-summary-article-posted-p t]
1640 ["Edit article" gnus-summary-edit-article
1641 (not (gnus-group-read-only-p))]
1642 ["Delete article" gnus-summary-delete-article
1643 (gnus-check-backend-function
1644 'request-expire-articles gnus-newsgroup-name)]
1645 ["Query respool" gnus-summary-respool-query t]
1646 ["Delete expirable articles" gnus-summary-expire-articles-now
1647 (gnus-check-backend-function
1648 'request-expire-articles gnus-newsgroup-name)])
1650 ["Uudecode" gnus-uu-decode-uu t]
1651 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1652 ["Unshar" gnus-uu-decode-unshar t]
1653 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1654 ["Save" gnus-uu-decode-save t]
1655 ["Binhex" gnus-uu-decode-binhex t]
1656 ["Postscript" gnus-uu-decode-postscript t])
1658 ["Enter article" gnus-cache-enter-article t]
1659 ["Remove article" gnus-cache-remove-article t])
1660 ["Select article buffer" gnus-summary-select-article-buffer t]
1661 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1662 ["Isearch article..." gnus-summary-isearch-article t]
1663 ["Beginning of the article" gnus-summary-beginning-of-article t]
1664 ["End of the article" gnus-summary-end-of-article t]
1665 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1666 ["Fetch referenced articles" gnus-summary-refer-references t]
1667 ["Fetch current thread" gnus-summary-refer-thread t]
1668 ["Fetch article with id..." gnus-summary-refer-article t]
1669 ["Redisplay" gnus-summary-show-article t]))
1672 gnus-summary-thread-menu gnus-summary-mode-map ""
1674 ["Toggle threading" gnus-summary-toggle-threads t]
1675 ["Hide threads" gnus-summary-hide-all-threads t]
1676 ["Show threads" gnus-summary-show-all-threads t]
1677 ["Hide thread" gnus-summary-hide-thread t]
1678 ["Show thread" gnus-summary-show-thread t]
1679 ["Go to next thread" gnus-summary-next-thread t]
1680 ["Go to previous thread" gnus-summary-prev-thread t]
1681 ["Go down thread" gnus-summary-down-thread t]
1682 ["Go up thread" gnus-summary-up-thread t]
1683 ["Top of thread" gnus-summary-top-thread t]
1684 ["Mark thread as read" gnus-summary-kill-thread t]
1685 ["Lower thread score" gnus-summary-lower-thread t]
1686 ["Raise thread score" gnus-summary-raise-thread t]
1687 ["Rethread current" gnus-summary-rethread-current t]
1691 gnus-summary-post-menu gnus-summary-mode-map ""
1693 ["Post an article" gnus-summary-post-news t]
1694 ["Followup" gnus-summary-followup t]
1695 ["Followup and yank" gnus-summary-followup-with-original t]
1696 ["Supersede article" gnus-summary-supersede-article t]
1697 ["Cancel article" gnus-summary-cancel-article t]
1698 ["Reply" gnus-summary-reply t]
1699 ["Reply and yank" gnus-summary-reply-with-original t]
1700 ["Wide reply" gnus-summary-wide-reply t]
1701 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1702 ["Mail forward" gnus-summary-mail-forward t]
1703 ["Post forward" gnus-summary-post-forward t]
1704 ["Digest and mail" gnus-uu-digest-mail-forward t]
1705 ["Digest and post" gnus-uu-digest-post-forward t]
1706 ["Resend message" gnus-summary-resend-message t]
1707 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1708 ["Send a mail" gnus-summary-mail-other-window t]
1709 ["Uuencode and post" gnus-uu-post-news t]
1710 ["Followup via news" gnus-summary-followup-to-mail t]
1711 ["Followup via news and yank"
1712 gnus-summary-followup-to-mail-with-original t]
1714 ;;["Send" gnus-summary-send-draft t]
1715 ;;["Send bounced" gnus-resend-bounced-mail t])
1719 gnus-summary-misc-menu gnus-summary-mode-map ""
1722 ["Mark as read" gnus-summary-mark-as-read-forward t]
1723 ["Mark same subject and select"
1724 gnus-summary-kill-same-subject-and-select t]
1725 ["Mark same subject" gnus-summary-kill-same-subject t]
1726 ["Catchup" gnus-summary-catchup t]
1727 ["Catchup all" gnus-summary-catchup-all t]
1728 ["Catchup to here" gnus-summary-catchup-to-here t]
1729 ["Catchup region" gnus-summary-mark-region-as-read t]
1730 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1732 ["Tick" gnus-summary-tick-article-forward t]
1733 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1734 ["Remove marks" gnus-summary-clear-mark-forward t]
1735 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1736 ["Set bookmark" gnus-summary-set-bookmark t]
1737 ["Remove bookmark" gnus-summary-remove-bookmark t])
1739 ["Marks..." gnus-summary-limit-to-marks t]
1740 ["Subject..." gnus-summary-limit-to-subject t]
1741 ["Author..." gnus-summary-limit-to-author t]
1742 ["Age..." gnus-summary-limit-to-age t]
1743 ["Score" gnus-summary-limit-to-score t]
1744 ["Unread" gnus-summary-limit-to-unread t]
1745 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1746 ["Articles" gnus-summary-limit-to-articles t]
1747 ["Pop limit" gnus-summary-pop-limit t]
1748 ["Show dormant" gnus-summary-limit-include-dormant t]
1749 ["Hide childless dormant"
1750 gnus-summary-limit-exclude-childless-dormant t]
1751 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1752 ["Show expunged" gnus-summary-show-all-expunged t])
1754 ["Set mark" gnus-summary-mark-as-processable t]
1755 ["Remove mark" gnus-summary-unmark-as-processable t]
1756 ["Remove all marks" gnus-summary-unmark-all-processable t]
1757 ["Mark above" gnus-uu-mark-over t]
1758 ["Mark series" gnus-uu-mark-series t]
1759 ["Mark region" gnus-uu-mark-region t]
1760 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1761 ["Mark all" gnus-uu-mark-all t]
1762 ["Mark buffer" gnus-uu-mark-buffer t]
1763 ["Mark sparse" gnus-uu-mark-sparse t]
1764 ["Mark thread" gnus-uu-mark-thread t]
1765 ["Unmark thread" gnus-uu-unmark-thread t]
1766 ("Process Mark Sets"
1767 ["Kill" gnus-summary-kill-process-mark t]
1768 ["Yank" gnus-summary-yank-process-mark
1769 gnus-newsgroup-process-stack]
1770 ["Save" gnus-summary-save-process-mark t]))
1772 ["Page forward" gnus-summary-next-page t]
1773 ["Page backward" gnus-summary-prev-page t]
1774 ["Line forward" gnus-summary-scroll-up t])
1776 ["Next unread article" gnus-summary-next-unread-article t]
1777 ["Previous unread article" gnus-summary-prev-unread-article t]
1778 ["Next article" gnus-summary-next-article t]
1779 ["Previous article" gnus-summary-prev-article t]
1780 ["Next unread subject" gnus-summary-next-unread-subject t]
1781 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1782 ["Next article same subject" gnus-summary-next-same-subject t]
1783 ["Previous article same subject" gnus-summary-prev-same-subject t]
1784 ["First unread article" gnus-summary-first-unread-article t]
1785 ["Best unread article" gnus-summary-best-unread-article t]
1786 ["Go to subject number..." gnus-summary-goto-subject t]
1787 ["Go to article number..." gnus-summary-goto-article t]
1788 ["Go to the last article" gnus-summary-goto-last-article t]
1789 ["Pop article off history" gnus-summary-pop-article t])
1791 ["Sort by number" gnus-summary-sort-by-number t]
1792 ["Sort by author" gnus-summary-sort-by-author t]
1793 ["Sort by subject" gnus-summary-sort-by-subject t]
1794 ["Sort by date" gnus-summary-sort-by-date t]
1795 ["Sort by score" gnus-summary-sort-by-score t]
1796 ["Sort by lines" gnus-summary-sort-by-lines t])
1798 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1799 ["Describe group" gnus-summary-describe-group t]
1800 ["Read manual" gnus-info-find-node t])
1802 ["Pick and read" gnus-pick-mode t]
1803 ["Binary" gnus-binary-mode t])
1805 ["Regenerate" gnus-summary-prepare t]
1806 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1807 ["Toggle threading" gnus-summary-toggle-threads t])
1808 ["Filter articles..." gnus-summary-execute-command t]
1809 ["Run command on subjects..." gnus-summary-universal-argument t]
1810 ["Search articles forward..." gnus-summary-search-article-forward t]
1811 ["Search articles backward..." gnus-summary-search-article-backward t]
1812 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1813 ["Expand window" gnus-summary-expand-window t]
1814 ["Expire expirable articles" gnus-summary-expire-articles
1815 (gnus-check-backend-function
1816 'request-expire-articles gnus-newsgroup-name)]
1817 ["Edit local kill file" gnus-summary-edit-local-kill t]
1818 ["Edit main kill file" gnus-summary-edit-global-kill t]
1820 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1821 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1822 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1823 ["Exit group" gnus-summary-exit t]
1824 ["Exit group without updating" gnus-summary-exit-no-update t]
1825 ["Exit and goto next group" gnus-summary-next-group t]
1826 ["Exit and goto prev group" gnus-summary-prev-group t]
1827 ["Reselect group" gnus-summary-reselect-current-group t]
1828 ["Rescan group" gnus-summary-rescan-group t]
1829 ["Update dribble" gnus-summary-save-newsrc t])))
1831 (run-hooks 'gnus-summary-menu-hook)))
1833 (defun gnus-score-set-default (var value)
1834 "A version of set that updates the GNU Emacs menu-bar."
1836 ;; It is the message that forces the active status to be updated.
1839 (defun gnus-make-score-map (type)
1840 "Make a summary score map of type TYPE."
1843 (let ((headers '(("author" "from" string)
1844 ("subject" "subject" string)
1845 ("article body" "body" string)
1846 ("article head" "head" string)
1847 ("xref" "xref" string)
1848 ("lines" "lines" number)
1849 ("followups to author" "followup" string)))
1850 (types '((number ("less than" <)
1853 (string ("substring" s)
1857 (perms '(("temporary" (current-time-string))
1865 (if (eq type 'lower)
1870 (setq header (car headers))
1876 (let ((ts (cdr (assoc (nth 2 header) types)))
1892 'gnus-summary-score-entry
1894 (if (or (string= (nth 1 header)
1896 (string= (nth 1 header)
1899 (list 'gnus-summary-header
1901 (list 'quote (nth 1 (car ts)))
1902 (list 'gnus-score-default nil)
1908 (list (nreverse outp))))
1911 (list (nreverse outt))))
1913 (setq headers (cdr headers)))
1914 (list (nreverse outh))))))))
1918 (defun gnus-summary-mode (&optional group)
1919 "Major mode for reading articles.
1921 All normal editing commands are switched off.
1922 \\<gnus-summary-mode-map>
1923 Each line in this buffer represents one article. To read an
1924 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1925 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1928 You can also post articles and send mail from this buffer. To
1929 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1930 of an article, type `\\[gnus-summary-reply]'.
1932 There are approx. one gazillion commands you can execute in this
1933 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1935 The following commands are available:
1937 \\{gnus-summary-mode-map}"
1939 (when (gnus-visual-p 'summary-menu 'menu)
1940 (gnus-summary-make-menu-bar))
1941 (kill-all-local-variables)
1942 (gnus-summary-make-local-variables)
1943 (gnus-make-thread-indent-array)
1944 (gnus-simplify-mode-line)
1945 (setq major-mode 'gnus-summary-mode)
1946 (setq mode-name "Summary")
1947 (make-local-variable 'minor-mode-alist)
1948 (use-local-map gnus-summary-mode-map)
1949 (buffer-disable-undo (current-buffer))
1950 (setq buffer-read-only t) ;Disable modification
1951 (setq truncate-lines t)
1952 (setq selective-display t)
1953 (setq selective-display-ellipses t) ;Display `...'
1954 (gnus-summary-set-display-table)
1955 (gnus-set-default-directory)
1956 (setq gnus-newsgroup-name group)
1957 (make-local-variable 'gnus-summary-line-format)
1958 (make-local-variable 'gnus-summary-line-format-spec)
1959 (make-local-variable 'gnus-summary-dummy-line-format)
1960 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1961 (make-local-variable 'gnus-summary-mark-positions)
1962 (make-local-hook 'post-command-hook)
1963 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1964 (make-local-hook 'pre-command-hook)
1965 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1966 (run-hooks 'gnus-summary-mode-hook)
1967 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1968 (gnus-update-summary-mark-positions))
1970 (defun gnus-summary-make-local-variables ()
1971 "Make all the local summary buffer variables."
1972 (let ((locals gnus-summary-local-variables)
1974 (while (setq local (pop locals))
1977 (if (eq (cdr local) 'global)
1978 ;; Copy the global value of the variable.
1979 (setq global (symbol-value (car local)))
1980 ;; Use the value from the list.
1981 (setq global (eval (cdr local))))
1982 (make-local-variable (car local))
1983 (set (car local) global))
1984 ;; Simple nil-valued local variable.
1985 (make-local-variable local)
1988 (defun gnus-summary-clear-local-variables ()
1989 (let ((locals gnus-summary-local-variables))
1991 (if (consp (car locals))
1992 (and (vectorp (caar locals))
1993 (set (caar locals) nil))
1994 (and (vectorp (car locals))
1995 (set (car locals) nil)))
1996 (setq locals (cdr locals)))))
1998 ;; Summary data functions.
2000 (defmacro gnus-data-number (data)
2003 (defmacro gnus-data-set-number (data number)
2004 `(setcar ,data ,number))
2006 (defmacro gnus-data-mark (data)
2009 (defmacro gnus-data-set-mark (data mark)
2010 `(setcar (nthcdr 1 ,data) ,mark))
2012 (defmacro gnus-data-pos (data)
2015 (defmacro gnus-data-set-pos (data pos)
2016 `(setcar (nthcdr 2 ,data) ,pos))
2018 (defmacro gnus-data-header (data)
2021 (defmacro gnus-data-set-header (data header)
2022 `(setf (nth 3 ,data) ,header))
2024 (defmacro gnus-data-level (data)
2027 (defmacro gnus-data-unread-p (data)
2028 `(= (nth 1 ,data) gnus-unread-mark))
2030 (defmacro gnus-data-read-p (data)
2031 `(/= (nth 1 ,data) gnus-unread-mark))
2033 (defmacro gnus-data-pseudo-p (data)
2034 `(consp (nth 3 ,data)))
2036 (defmacro gnus-data-find (number)
2037 `(assq ,number gnus-newsgroup-data))
2039 (defmacro gnus-data-find-list (number &optional data)
2040 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2041 (memq (assq ,number bdata)
2044 (defmacro gnus-data-make (number mark pos header level)
2045 `(list ,number ,mark ,pos ,header ,level))
2047 (defun gnus-data-enter (after-article number mark pos header level offset)
2048 (let ((data (gnus-data-find-list after-article)))
2050 (error "No such article: %d" after-article))
2051 (setcdr data (cons (gnus-data-make number mark pos header level)
2053 (setq gnus-newsgroup-data-reverse nil)
2054 (gnus-data-update-list (cddr data) offset)))
2056 (defun gnus-data-enter-list (after-article list &optional offset)
2058 (let ((data (and after-article (gnus-data-find-list after-article)))
2060 (or data (not after-article) (error "No such article: %d" after-article))
2061 ;; Find the last element in the list to be spliced into the main
2064 (setq list (cdr list)))
2067 (setcdr list gnus-newsgroup-data)
2068 (setq gnus-newsgroup-data ilist)
2070 (gnus-data-update-list (cdr list) offset)))
2071 (setcdr list (cdr data))
2074 (gnus-data-update-list (cdr list) offset)))
2075 (setq gnus-newsgroup-data-reverse nil))))
2077 (defun gnus-data-remove (article &optional offset)
2078 (let ((data gnus-newsgroup-data))
2079 (if (= (gnus-data-number (car data)) article)
2081 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2082 gnus-newsgroup-data-reverse nil)
2084 (gnus-data-update-list gnus-newsgroup-data offset)))
2086 (when (= (gnus-data-number (cadr data)) article)
2087 (setcdr data (cddr data))
2089 (gnus-data-update-list (cdr data) offset))
2091 gnus-newsgroup-data-reverse nil))
2092 (setq data (cdr data))))))
2094 (defmacro gnus-data-list (backward)
2096 (or gnus-newsgroup-data-reverse
2097 (setq gnus-newsgroup-data-reverse
2098 (reverse gnus-newsgroup-data)))
2099 gnus-newsgroup-data))
2101 (defun gnus-data-update-list (data offset)
2102 "Add OFFSET to the POS of all data entries in DATA."
2104 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2105 (setq data (cdr data))))
2107 (defun gnus-data-compute-positions ()
2108 "Compute the positions of all articles."
2109 (let ((data gnus-newsgroup-data)
2112 (when (setq pos (text-property-any
2113 (point-min) (point-max)
2114 'gnus-number (gnus-data-number (car data))))
2115 (gnus-data-set-pos (car data) (+ pos 3)))
2116 (setq data (cdr data)))))
2118 (defun gnus-summary-article-pseudo-p (article)
2119 "Say whether this article is a pseudo article or not."
2120 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2122 (defmacro gnus-summary-article-sparse-p (article)
2123 "Say whether this article is a sparse article or not."
2124 `(memq ,article gnus-newsgroup-sparse))
2126 (defmacro gnus-summary-article-ancient-p (article)
2127 "Say whether this article is a sparse article or not."
2128 `(memq ,article gnus-newsgroup-ancient))
2130 (defun gnus-article-parent-p (number)
2131 "Say whether this article is a parent or not."
2132 (let ((data (gnus-data-find-list number)))
2133 (and (cdr data) ; There has to be an article after...
2134 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2135 (gnus-data-level (nth 1 data))))))
2137 (defun gnus-article-children (number)
2138 "Return a list of all children to NUMBER."
2139 (let* ((data (gnus-data-find-list number))
2140 (level (gnus-data-level (car data)))
2142 (setq data (cdr data))
2144 (= (gnus-data-level (car data)) (1+ level)))
2145 (push (gnus-data-number (car data)) children)
2146 (setq data (cdr data)))
2149 (defmacro gnus-summary-skip-intangible ()
2150 "If the current article is intangible, then jump to a different article."
2151 '(let ((to (get-text-property (point) 'gnus-intangible)))
2152 (and to (gnus-summary-goto-subject to))))
2154 (defmacro gnus-summary-article-intangible-p ()
2155 "Say whether this article is intangible or not."
2156 '(get-text-property (point) 'gnus-intangible))
2158 (defun gnus-article-read-p (article)
2159 "Say whether ARTICLE is read or not."
2160 (not (or (memq article gnus-newsgroup-marked)
2161 (memq article gnus-newsgroup-unreads)
2162 (memq article gnus-newsgroup-unselected)
2163 (memq article gnus-newsgroup-dormant))))
2165 ;; Some summary mode macros.
2167 (defmacro gnus-summary-article-number ()
2168 "The article number of the article on the current line.
2169 If there isn's an article number here, then we return the current
2172 (gnus-summary-skip-intangible)
2173 (or (get-text-property (point) 'gnus-number)
2174 (gnus-summary-last-subject))))
2176 (defmacro gnus-summary-article-header (&optional number)
2177 `(gnus-data-header (gnus-data-find
2178 ,(or number '(gnus-summary-article-number)))))
2180 (defmacro gnus-summary-thread-level (&optional number)
2181 `(if (and (eq gnus-summary-make-false-root 'dummy)
2182 (get-text-property (point) 'gnus-intangible))
2184 (gnus-data-level (gnus-data-find
2185 ,(or number '(gnus-summary-article-number))))))
2187 (defmacro gnus-summary-article-mark (&optional number)
2188 `(gnus-data-mark (gnus-data-find
2189 ,(or number '(gnus-summary-article-number)))))
2191 (defmacro gnus-summary-article-pos (&optional number)
2192 `(gnus-data-pos (gnus-data-find
2193 ,(or number '(gnus-summary-article-number)))))
2195 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2196 (defmacro gnus-summary-article-subject (&optional number)
2197 "Return current subject string or nil if nothing."
2200 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2201 '(gnus-data-header (assq (gnus-summary-article-number)
2202 gnus-newsgroup-data)))))
2205 (mail-header-subject headers))))
2207 (defmacro gnus-summary-article-score (&optional number)
2208 "Return current article score."
2209 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2210 gnus-newsgroup-scored))
2211 gnus-summary-default-score 0))
2213 (defun gnus-summary-article-children (&optional number)
2214 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2215 (level (gnus-data-level (car data)))
2217 (while (and (setq data (cdr data))
2218 (> (setq l (gnus-data-level (car data))) level))
2219 (and (= (1+ level) l)
2220 (push (gnus-data-number (car data))
2222 (nreverse children)))
2224 (defun gnus-summary-article-parent (&optional number)
2225 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2226 (gnus-data-list t)))
2227 (level (gnus-data-level (car data))))
2229 () ; This is a root.
2230 ;; We search until we find an article with a level less than
2231 ;; this one. That function has to be the parent.
2232 (while (and (setq data (cdr data))
2233 (not (< (gnus-data-level (car data)) level))))
2234 (and data (gnus-data-number (car data))))))
2236 (defun gnus-unread-mark-p (mark)
2237 "Say whether MARK is the unread mark."
2238 (= mark gnus-unread-mark))
2240 (defun gnus-read-mark-p (mark)
2241 "Say whether MARK is one of the marks that mark as read.
2242 This is all marks except unread, ticked, dormant, and expirable."
2243 (not (or (= mark gnus-unread-mark)
2244 (= mark gnus-ticked-mark)
2245 (= mark gnus-dormant-mark)
2246 (= mark gnus-expirable-mark))))
2248 (defmacro gnus-article-mark (number)
2250 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2251 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2252 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2253 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2254 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2255 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2256 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2257 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2258 gnus-ancient-mark))))
2260 ;; Saving hidden threads.
2262 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2263 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2265 (defmacro gnus-save-hidden-threads (&rest forms)
2266 "Save hidden threads, eval FORMS, and restore the hidden threads."
2267 (let ((config (make-symbol "config")))
2268 `(let ((,config (gnus-hidden-threads-configuration)))
2272 (gnus-restore-hidden-threads-configuration ,config)))))
2274 (defun gnus-hidden-threads-configuration ()
2275 "Return the current hidden threads configuration."
2278 (goto-char (point-min))
2279 (while (search-forward "\r" nil t)
2280 (push (1- (point)) config))
2283 (defun gnus-restore-hidden-threads-configuration (config)
2284 "Restore hidden threads configuration from CONFIG."
2285 (let (point buffer-read-only)
2286 (while (setq point (pop config))
2287 (when (and (< point (point-max))
2289 (= (following-char) ?\n))
2290 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2292 ;; Various summary mode internalish functions.
2294 (defun gnus-mouse-pick-article (e)
2297 (gnus-summary-next-page nil t))
2299 (defun gnus-summary-set-display-table ()
2300 ;; Change the display table. Odd characters have a tendency to mess
2301 ;; up nicely formatted displays - we make all possible glyphs
2302 ;; display only a single character.
2304 ;; We start from the standard display table, if any.
2305 (let ((table (or (copy-sequence standard-display-table)
2306 (make-display-table)))
2308 ;; Nix out all the control chars...
2309 (while (>= (setq i (1- i)) 0)
2310 (aset table i [??]))
2311 ;; ... but not newline and cr, of course. (cr is necessary for the
2312 ;; selective display).
2313 (aset table ?\n nil)
2314 (aset table ?\r nil)
2315 ;; We nix out any glyphs over 126 that are not set already.
2317 (while (>= (setq i (1- i)) 127)
2318 ;; Only modify if the entry is nil.
2319 (unless (aref table i)
2320 (aset table i [??]))))
2321 (setq buffer-display-table table)))
2323 (defun gnus-summary-setup-buffer (group)
2324 "Initialize summary buffer."
2325 (let ((buffer (concat "*Summary " group "*")))
2326 (if (get-buffer buffer)
2329 (setq gnus-summary-buffer (current-buffer))
2330 (not gnus-newsgroup-prepared))
2331 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2332 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2333 (gnus-add-current-to-buffer-list)
2334 (gnus-summary-mode group)
2336 (gnus-carpal-setup-buffer 'summary))
2337 (unless gnus-single-article-buffer
2338 (make-local-variable 'gnus-article-buffer)
2339 (make-local-variable 'gnus-article-current)
2340 (make-local-variable 'gnus-original-article-buffer))
2341 (setq gnus-newsgroup-name group)
2344 (defun gnus-set-global-variables ()
2345 ;; Set the global equivalents of the summary buffer-local variables
2346 ;; to the latest values they had. These reflect the summary buffer
2347 ;; that was in action when the last article was fetched.
2348 (when (eq major-mode 'gnus-summary-mode)
2349 (setq gnus-summary-buffer (current-buffer))
2350 (let ((name gnus-newsgroup-name)
2351 (marked gnus-newsgroup-marked)
2352 (unread gnus-newsgroup-unreads)
2353 (headers gnus-current-headers)
2354 (data gnus-newsgroup-data)
2355 (summary gnus-summary-buffer)
2356 (article-buffer gnus-article-buffer)
2357 (original gnus-original-article-buffer)
2358 (gac gnus-article-current)
2359 (reffed gnus-reffed-article-number)
2360 (score-file gnus-current-score-file))
2362 (set-buffer gnus-group-buffer)
2363 (setq gnus-newsgroup-name name
2364 gnus-newsgroup-marked marked
2365 gnus-newsgroup-unreads unread
2366 gnus-current-headers headers
2367 gnus-newsgroup-data data
2368 gnus-article-current gac
2369 gnus-summary-buffer summary
2370 gnus-article-buffer article-buffer
2371 gnus-original-article-buffer original
2372 gnus-reffed-article-number reffed
2373 gnus-current-score-file score-file)
2374 ;; The article buffer also has local variables.
2375 (when (gnus-buffer-live-p gnus-article-buffer)
2376 (set-buffer gnus-article-buffer)
2377 (setq gnus-summary-buffer summary))))))
2379 (defun gnus-summary-article-unread-p (article)
2380 "Say whether ARTICLE is unread or not."
2381 (memq article gnus-newsgroup-unreads))
2383 (defun gnus-summary-first-article-p (&optional article)
2384 "Return whether ARTICLE is the first article in the buffer."
2385 (if (not (setq article (or article (gnus-summary-article-number))))
2387 (eq article (caar gnus-newsgroup-data))))
2389 (defun gnus-summary-last-article-p (&optional article)
2390 "Return whether ARTICLE is the last article in the buffer."
2391 (if (not (setq article (or article (gnus-summary-article-number))))
2392 t ; All non-existent numbers are the last article. :-)
2393 (not (cdr (gnus-data-find-list article)))))
2395 (defun gnus-make-thread-indent-array ()
2397 (unless (and gnus-thread-indent-array
2398 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2399 (setq gnus-thread-indent-array (make-vector 201 "")
2400 gnus-thread-indent-array-level gnus-thread-indent-level)
2402 (aset gnus-thread-indent-array n
2403 (make-string (* n gnus-thread-indent-level) ? ))
2406 (defun gnus-update-summary-mark-positions ()
2407 "Compute where the summary marks are to go."
2409 (when (and gnus-summary-buffer
2410 (get-buffer gnus-summary-buffer)
2411 (buffer-name (get-buffer gnus-summary-buffer)))
2412 (set-buffer gnus-summary-buffer))
2413 (let ((gnus-replied-mark 129)
2414 (gnus-score-below-mark 130)
2415 (gnus-score-over-mark 130)
2416 (gnus-download-mark 131)
2417 (spec gnus-summary-line-format-spec)
2418 thread gnus-visual pos)
2420 (gnus-set-work-buffer)
2421 (let ((gnus-summary-line-format-spec spec)
2422 (gnus-newsgroup-downloadable '((0 . t))))
2423 (gnus-summary-insert-line
2424 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2425 (goto-char (point-min))
2426 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2428 (goto-char (point-min))
2429 (push (cons 'replied (and (search-forward "\201" nil t)
2432 (goto-char (point-min))
2433 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2435 (goto-char (point-min))
2436 (push (cons 'download
2437 (and (search-forward "\203" nil t) (- (point) 2)))
2439 (setq gnus-summary-mark-positions pos))))
2441 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2442 "Insert a dummy root in the summary buffer."
2444 (gnus-add-text-properties
2445 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2446 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2448 (defun gnus-summary-insert-line (gnus-tmp-header
2449 gnus-tmp-level gnus-tmp-current
2450 gnus-tmp-unread gnus-tmp-replied
2451 gnus-tmp-expirable gnus-tmp-subject-or-nil
2452 &optional gnus-tmp-dummy gnus-tmp-score
2454 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2455 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2456 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2457 (gnus-tmp-score-char
2458 (if (or (null gnus-summary-default-score)
2459 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2460 gnus-summary-zcore-fuzz))
2462 (if (< gnus-tmp-score gnus-summary-default-score)
2463 gnus-score-below-mark gnus-score-over-mark)))
2465 (cond (gnus-tmp-process gnus-process-mark)
2466 ((memq gnus-tmp-current gnus-newsgroup-cached)
2468 (gnus-tmp-replied gnus-replied-mark)
2469 ((memq gnus-tmp-current gnus-newsgroup-saved)
2471 (t gnus-unread-mark)))
2472 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2475 ((string-match "<[^>]+> *$" gnus-tmp-from)
2476 (let ((beg (match-beginning 0)))
2477 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2478 (substring gnus-tmp-from (1+ (match-beginning 0))
2479 (1- (match-end 0))))
2480 (substring gnus-tmp-from 0 beg))))
2481 ((string-match "(.+)" gnus-tmp-from)
2482 (substring gnus-tmp-from
2483 (1+ (match-beginning 0)) (1- (match-end 0))))
2485 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2486 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2487 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2488 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2489 (buffer-read-only nil))
2490 (when (string= gnus-tmp-name "")
2491 (setq gnus-tmp-name gnus-tmp-from))
2492 (unless (numberp gnus-tmp-lines)
2493 (setq gnus-tmp-lines 0))
2494 (gnus-put-text-property
2496 (progn (eval gnus-summary-line-format-spec) (point))
2497 'gnus-number gnus-tmp-number)
2498 (when (gnus-visual-p 'summary-highlight 'highlight)
2500 (run-hooks 'gnus-summary-update-hook)
2503 (defun gnus-summary-update-line (&optional dont-update)
2504 ;; Update summary line after change.
2505 (when (and gnus-summary-default-score
2506 (not gnus-summary-inhibit-highlight))
2507 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2508 (article (gnus-summary-article-number))
2509 (score (gnus-summary-article-score article)))
2511 (if (and gnus-summary-mark-below
2512 (< (gnus-summary-article-score)
2513 gnus-summary-mark-below))
2514 ;; This article has a low score, so we mark it as read.
2515 (when (memq article gnus-newsgroup-unreads)
2516 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2517 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2518 ;; This article was previously marked as read on account
2519 ;; of a low score, but now it has risen, so we mark it as
2521 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2522 (gnus-summary-update-mark
2523 (if (or (null gnus-summary-default-score)
2524 (<= (abs (- score gnus-summary-default-score))
2525 gnus-summary-zcore-fuzz))
2527 (if (< score gnus-summary-default-score)
2528 gnus-score-below-mark gnus-score-over-mark))
2530 ;; Do visual highlighting.
2531 (when (gnus-visual-p 'summary-highlight 'highlight)
2532 (run-hooks 'gnus-summary-update-hook)))))
2534 (defvar gnus-tmp-new-adopts nil)
2536 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2537 "Return the number of articles in THREAD.
2538 This may be 0 in some cases -- if none of the articles in
2539 the thread are to be displayed."
2541 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2543 ((not (listp thread))
2545 ((and (consp thread) (cdr thread))
2548 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2551 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2554 (when (and level (zerop level) gnus-tmp-new-adopts)
2557 'gnus-summary-number-of-articles-in-thread
2558 gnus-tmp-new-adopts))))
2560 (if (> number 1) gnus-not-empty-thread-mark
2561 gnus-empty-thread-mark)
2564 (defun gnus-summary-set-local-parameters (group)
2565 "Go through the local params of GROUP and set all variable specs in that list."
2566 (let ((params (gnus-group-find-parameter group))
2569 (setq elem (car params)
2570 params (cdr params))
2571 (and (consp elem) ; Has to be a cons.
2572 (consp (cdr elem)) ; The cdr has to be a list.
2573 (symbolp (car elem)) ; Has to be a symbol in there.
2574 (not (memq (car elem)
2575 '(quit-config to-address to-list to-group)))
2576 (ignore-errors ; So we set it.
2577 (make-local-variable (car elem))
2578 (set (car elem) (eval (nth 1 elem))))))))
2580 (defun gnus-summary-read-group (group &optional show-all no-article
2581 kill-buffer no-display)
2582 "Start reading news in newsgroup GROUP.
2583 If SHOW-ALL is non-nil, already read articles are also listed.
2584 If NO-ARTICLE is non-nil, no article is selected initially.
2585 If NO-DISPLAY, don't generate a summary buffer."
2589 (let ((gnus-auto-select-next nil))
2590 (or (gnus-summary-read-group-1
2591 group show-all no-article
2592 kill-buffer no-display)
2593 (setq show-all nil)))))
2594 (eq gnus-auto-select-next 'quietly))
2595 (set-buffer gnus-group-buffer)
2596 (if (not (equal group (gnus-group-group-name)))
2597 (setq group (gnus-group-group-name))
2601 (defun gnus-summary-read-group-1 (group show-all no-article
2602 kill-buffer no-display)
2603 ;; Killed foreign groups can't be entered.
2604 (when (and (not (gnus-group-native-p group))
2605 (not (gnus-gethash group gnus-newsrc-hashtb)))
2606 (error "Dead non-native groups can't be entered"))
2607 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2608 (let* ((new-group (gnus-summary-setup-buffer group))
2609 (quit-config (gnus-group-quit-config group))
2610 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2612 ;; This summary buffer exists already, so we just select it.
2614 (gnus-set-global-variables)
2616 (gnus-kill-or-deaden-summary kill-buffer))
2617 (gnus-configure-windows 'summary 'force)
2618 (gnus-set-mode-line 'summary)
2619 (gnus-summary-position-point)
2622 ;; We couldn't select this group.
2624 (when (and (eq major-mode 'gnus-summary-mode)
2625 (not (equal (current-buffer) kill-buffer)))
2626 (kill-buffer (current-buffer))
2627 (if (not quit-config)
2629 ;; Update the info -- marks might need to be removed,
2631 (gnus-summary-update-info)
2632 (set-buffer gnus-group-buffer)
2633 (gnus-group-jump-to-group group)
2634 (gnus-group-next-unread-group 1))
2635 (gnus-handle-ephemeral-exit quit-config)))
2636 (gnus-message 3 "Can't select group")
2638 ;; The user did a `C-g' while prompting for number of articles,
2639 ;; so we exit this group.
2640 ((eq did-select 'quit)
2641 (and (eq major-mode 'gnus-summary-mode)
2642 (not (equal (current-buffer) kill-buffer))
2643 (kill-buffer (current-buffer)))
2645 (gnus-kill-or-deaden-summary kill-buffer))
2646 (if (not quit-config)
2648 (set-buffer gnus-group-buffer)
2649 (gnus-group-jump-to-group group)
2650 (gnus-group-next-unread-group 1)
2651 (gnus-configure-windows 'group 'force))
2652 (gnus-handle-ephemeral-exit quit-config))
2653 ;; Finally signal the quit.
2655 ;; The group was successfully selected.
2657 (gnus-set-global-variables)
2658 ;; Save the active value in effect when the group was entered.
2659 (setq gnus-newsgroup-active
2661 (gnus-active gnus-newsgroup-name)))
2662 ;; You can change the summary buffer in some way with this hook.
2663 (run-hooks 'gnus-select-group-hook)
2664 ;; Set any local variables in the group parameters.
2665 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2666 (gnus-update-format-specifications
2667 nil 'summary 'summary-mode 'summary-dummy)
2668 ;; Do score processing.
2669 (when gnus-use-scoring
2670 (gnus-possibly-score-headers))
2671 ;; Check whether to fill in the gaps in the threads.
2672 (when gnus-build-sparse-threads
2673 (gnus-build-sparse-threads))
2674 ;; Find the initial limit.
2675 (if gnus-show-threads
2677 (let ((gnus-newsgroup-dormant nil))
2678 (gnus-summary-initial-limit show-all))
2679 (gnus-summary-initial-limit show-all))
2680 (setq gnus-newsgroup-limit
2682 (lambda (header) (mail-header-number header))
2683 gnus-newsgroup-headers)))
2684 ;; Generate the summary buffer.
2686 (gnus-summary-prepare))
2687 (when gnus-use-trees
2688 (gnus-tree-open group)
2689 (setq gnus-summary-highlight-line-function
2690 'gnus-tree-highlight-article))
2691 ;; If the summary buffer is empty, but there are some low-scored
2692 ;; articles or some excluded dormants, we include these in the
2694 (when (and (zerop (buffer-size))
2696 (cond (gnus-newsgroup-dormant
2697 (gnus-summary-limit-include-dormant))
2698 ((and gnus-newsgroup-scored show-all)
2699 (gnus-summary-limit-include-expunged t))))
2700 ;; Function `gnus-apply-kill-file' must be called in this hook.
2701 (run-hooks 'gnus-apply-kill-hook)
2702 (if (and (zerop (buffer-size))
2705 ;; This newsgroup is empty.
2706 (gnus-summary-catchup-and-exit nil t)
2707 (gnus-message 6 "No unread news")
2709 (gnus-kill-or-deaden-summary kill-buffer))
2710 ;; Return nil from this function.
2712 ;; Hide conversation thread subtrees. We cannot do this in
2713 ;; gnus-summary-prepare-hook since kill processing may not
2714 ;; work with hidden articles.
2715 (and gnus-show-threads
2716 gnus-thread-hide-subtree
2717 (gnus-summary-hide-all-threads))
2719 (gnus-kill-or-deaden-summary kill-buffer))
2720 ;; Show first unread article if requested.
2721 (if (and (not no-article)
2723 gnus-newsgroup-unreads
2724 gnus-auto-select-first)
2725 (unless (if (eq gnus-auto-select-first 'best)
2726 (gnus-summary-best-unread-article)
2727 (gnus-summary-first-unread-article))
2728 (gnus-configure-windows 'summary))
2729 ;; Don't select any articles, just move point to the first
2730 ;; article in the group.
2731 (goto-char (point-min))
2732 (gnus-summary-position-point)
2733 (gnus-set-mode-line 'summary)
2734 (gnus-configure-windows 'summary 'force))
2735 (when (get-buffer-window gnus-group-buffer t)
2736 ;; Gotta use windows, because recenter does weird stuff if
2737 ;; the current buffer ain't the displayed window.
2738 (let ((owin (selected-window)))
2739 (select-window (get-buffer-window gnus-group-buffer t))
2740 (when (gnus-group-goto-group group)
2742 (select-window owin)))
2743 ;; Mark this buffer as "prepared".
2744 (setq gnus-newsgroup-prepared t)
2747 (defun gnus-summary-prepare ()
2748 "Generate the summary buffer."
2750 (let ((buffer-read-only nil))
2752 (setq gnus-newsgroup-data nil
2753 gnus-newsgroup-data-reverse nil)
2754 (run-hooks 'gnus-summary-generate-hook)
2755 ;; Generate the buffer, either with threads or without.
2756 (when gnus-newsgroup-headers
2757 (gnus-summary-prepare-threads
2758 (if gnus-show-threads
2759 (gnus-sort-gathered-threads
2760 (funcall gnus-summary-thread-gathering-function
2762 (gnus-cut-threads (gnus-make-threads)))))
2763 ;; Unthreaded display.
2764 (gnus-sort-articles gnus-newsgroup-headers))))
2765 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2766 ;; Call hooks for modifying summary buffer.
2767 (goto-char (point-min))
2768 (run-hooks 'gnus-summary-prepare-hook)))
2770 (defsubst gnus-general-simplify-subject (subject)
2771 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2774 ;; Truncate the subject.
2775 (gnus-simplify-subject-functions
2776 (gnus-map-function gnus-simplify-subject-functions subject))
2777 ((numberp gnus-summary-gather-subject-limit)
2778 (setq subject (gnus-simplify-subject-re subject))
2779 (if (> (length subject) gnus-summary-gather-subject-limit)
2780 (substring subject 0 gnus-summary-gather-subject-limit)
2782 ;; Fuzzily simplify it.
2783 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2784 (gnus-simplify-subject-fuzzy subject))
2785 ;; Just remove the leading "Re:".
2787 (gnus-simplify-subject-re subject))))
2789 (if (and gnus-summary-gather-exclude-subject
2790 (string-match gnus-summary-gather-exclude-subject subject))
2791 nil ; This article shouldn't be gathered
2794 (defun gnus-summary-simplify-subject-query ()
2795 "Query where the respool algorithm would put this article."
2797 (gnus-summary-select-article)
2798 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2800 (defun gnus-gather-threads-by-subject (threads)
2801 "Gather threads by looking at Subject headers."
2802 (if (not gnus-summary-make-false-root)
2804 (let ((hashtb (gnus-make-hashtable 1024))
2807 subject hthread whole-subject)
2809 (setq subject (gnus-general-simplify-subject
2810 (setq whole-subject (mail-header-subject
2813 (if (setq hthread (gnus-gethash subject hashtb))
2815 ;; We enter a dummy root into the thread, if we
2816 ;; haven't done that already.
2817 (unless (stringp (caar hthread))
2818 (setcar hthread (list whole-subject (car hthread))))
2819 ;; We add this new gathered thread to this gathered
2821 (setcdr (car hthread)
2822 (nconc (cdar hthread) (list (car threads))))
2823 ;; Remove it from the list of threads.
2824 (setcdr prev (cdr threads))
2825 (setq threads prev))
2826 ;; Enter this thread into the hash table.
2827 (gnus-sethash subject threads hashtb)))
2829 (setq threads (cdr threads)))
2832 (defun gnus-gather-threads-by-references (threads)
2833 "Gather threads by looking at References headers."
2834 (let ((idhashtb (gnus-make-hashtable 1024))
2835 (thhashtb (gnus-make-hashtable 1024))
2838 ids references id gthread gid entered ref)
2840 (when (setq references (mail-header-references (caar threads)))
2841 (setq id (mail-header-id (caar threads))
2842 ids (gnus-split-references references)
2844 (while (setq ref (pop ids))
2845 (setq ids (delete ref ids))
2846 (if (not (setq gid (gnus-gethash ref idhashtb)))
2848 (gnus-sethash ref id idhashtb)
2849 (gnus-sethash id threads thhashtb))
2850 (setq gthread (gnus-gethash gid thhashtb))
2852 ;; We enter a dummy root into the thread, if we
2853 ;; haven't done that already.
2854 (unless (stringp (caar gthread))
2855 (setcar gthread (list (mail-header-subject (caar gthread))
2857 ;; We add this new gathered thread to this gathered
2859 (setcdr (car gthread)
2860 (nconc (cdar gthread) (list (car threads)))))
2861 ;; Add it into the thread hash table.
2862 (gnus-sethash id gthread thhashtb)
2864 ;; Remove it from the list of threads.
2865 (setcdr prev (cdr threads))
2866 (setq threads prev))))
2868 (setq threads (cdr threads)))
2871 (defun gnus-sort-gathered-threads (threads)
2872 "Sort subtreads inside each gathered thread by article number."
2873 (let ((result threads))
2875 (when (stringp (caar threads))
2876 (setcdr (car threads)
2877 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2878 (setq threads (cdr threads)))
2881 (defun gnus-thread-loop-p (root thread)
2882 "Say whether ROOT is in THREAD."
2883 (let ((stack (list thread))
2886 (while (setq thread (pop stack))
2887 (setq th (cdr thread))
2889 (not (eq (caar th) root)))
2892 ;; We have found a loop.
2894 (setcdr thread (delq (car th) (cdr thread)))
2895 (if (boundp (setq ref-dep (intern "none"
2896 gnus-newsgroup-dependencies)))
2897 (setcdr (symbol-value ref-dep)
2898 (nconc (cdr (symbol-value ref-dep))
2900 (set ref-dep (list nil (car th))))
2903 ;; Push all the subthreads onto the stack.
2904 (push (cdr thread) stack)))
2907 (defun gnus-make-threads ()
2908 "Go through the dependency hashtb and find the roots. Return all threads."
2910 (while (catch 'infloop
2913 ;; Deal with self-referencing References loops.
2914 (when (and (car (symbol-value refs))
2921 (car (symbol-value refs)) thread))
2922 (cdr (symbol-value refs)))))))
2925 (unless (car (symbol-value refs))
2926 ;; These threads do not refer back to any other articles,
2927 ;; so they're roots.
2928 (setq threads (append (cdr (symbol-value refs)) threads))))
2929 gnus-newsgroup-dependencies)))
2932 (defun gnus-build-sparse-threads ()
2933 (let ((headers gnus-newsgroup-headers)
2934 (deps gnus-newsgroup-dependencies)
2935 header references generation relations
2936 cthread subject child end pthread relation new-child)
2937 ;; First we create an alist of generations/relations, where
2938 ;; generations is how much we trust the relation, and the relation
2940 (gnus-message 7 "Making sparse threads...")
2942 (nnheader-set-temp-buffer " *gnus sparse threads*")
2943 (while (setq header (pop headers))
2944 (when (and (setq references (mail-header-references header))
2945 (not (string= references "")))
2947 (setq child (mail-header-id header)
2948 subject (mail-header-subject header))
2950 (while (search-backward ">" nil t)
2951 (setq end (1+ (point)))
2952 (when (search-backward "<" nil t)
2953 (unless (string= (setq new-child (buffer-substring (point) end))
2955 (push (list (incf generation)
2956 child (setq child new-child)
2959 (push (list (1+ generation) child nil subject) relations)
2961 (kill-buffer (current-buffer)))
2962 ;; Sort over trustworthiness.
2963 (setq relations (sort relations 'car-less-than-car))
2964 (while (setq relation (pop relations))
2965 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2966 (unless (car (symbol-value cthread))
2967 ;; Make this article the parent of these threads.
2968 (setcar (symbol-value cthread)
2969 (vector gnus-reffed-article-number
2973 (or (caddr relation) "") 0 0 "")))
2974 (set cthread (list (vector gnus-reffed-article-number
2976 "" "" (cadr relation)
2977 (or (caddr relation) "") 0 0 ""))))
2978 (push gnus-reffed-article-number gnus-newsgroup-limit)
2979 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2980 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2981 gnus-newsgroup-reads)
2982 (decf gnus-reffed-article-number)
2983 ;; Make this new thread the child of its parent.
2984 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2985 (setcdr (symbol-value pthread)
2986 (nconc (cdr (symbol-value pthread))
2987 (list (symbol-value cthread))))
2988 (set pthread (list nil (symbol-value cthread))))))
2989 (gnus-message 7 "Making sparse threads...done")))
2991 (defun gnus-build-old-threads ()
2992 ;; Look at all the articles that refer back to old articles, and
2993 ;; fetch the headers for the articles that aren't there. This will
2994 ;; build complete threads - if the roots haven't been expired by the
2999 (when (not (car (symbol-value refs)))
3000 (setq heads (cdr (symbol-value refs)))
3002 (if (memq (mail-header-number (caar heads))
3003 gnus-newsgroup-dormant)
3004 (setq heads (cdr heads))
3005 (setq id (symbol-name refs))
3006 (while (and (setq id (gnus-build-get-header id))
3007 (not (car (gnus-gethash
3008 id gnus-newsgroup-dependencies)))))
3009 (setq heads nil)))))
3010 gnus-newsgroup-dependencies)))
3012 (defun gnus-build-get-header (id)
3013 ;; Look through the buffer of NOV lines and find the header to
3014 ;; ID. Enter this line into the dependencies hash table, and return
3015 ;; the id of the parent article (if any).
3016 (let ((deps gnus-newsgroup-dependencies)
3020 (set-buffer nntp-server-buffer)
3021 (let ((case-fold-search nil))
3022 (goto-char (point-min))
3023 (while (and (not found)
3024 (search-forward id nil t))
3026 (setq found (looking-at
3027 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3028 (regexp-quote id))))
3029 (or found (beginning-of-line 2)))
3033 (setq header (gnus-nov-parse-line
3034 (read (current-buffer)) deps))
3035 (gnus-parent-id (mail-header-references header))))))
3037 (let ((number (mail-header-number header)))
3038 (push number gnus-newsgroup-limit)
3039 (push header gnus-newsgroup-headers)
3040 (if (memq number gnus-newsgroup-unselected)
3042 (push number gnus-newsgroup-unreads)
3043 (setq gnus-newsgroup-unselected
3044 (delq number gnus-newsgroup-unselected)))
3045 (push number gnus-newsgroup-ancient)))))))
3047 (defun gnus-build-all-threads ()
3048 "Read all the headers."
3049 (let ((deps gnus-newsgroup-dependencies)
3050 (gnus-summary-ignore-duplicates t)
3051 found header article)
3053 (set-buffer nntp-server-buffer)
3054 (let ((case-fold-search nil))
3055 (goto-char (point-min))
3058 (setq article (read (current-buffer)))
3059 (setq header (gnus-nov-parse-line article deps)))
3061 (push header gnus-newsgroup-headers)
3062 (if (memq (setq article (mail-header-number header))
3063 gnus-newsgroup-unselected)
3065 (push article gnus-newsgroup-unreads)
3066 (setq gnus-newsgroup-unselected
3067 (delq article gnus-newsgroup-unselected)))
3068 (push article gnus-newsgroup-ancient))
3069 (forward-line 1)))))))
3071 (defun gnus-summary-update-article-line (article header)
3072 "Update the line for ARTICLE using HEADERS."
3073 (let* ((id (mail-header-id header))
3074 (thread (gnus-id-to-thread id)))
3076 (error "Article in no thread"))
3077 ;; Update the thread.
3078 (setcar thread header)
3079 (gnus-summary-goto-subject article)
3080 (let* ((datal (gnus-data-find-list article))
3082 (length (when (cdr datal)
3083 (- (gnus-data-pos data)
3084 (gnus-data-pos (cadr datal)))))
3085 (buffer-read-only nil)
3086 (level (gnus-summary-thread-level)))
3088 (gnus-summary-insert-line
3089 header level nil (gnus-article-mark article)
3090 (memq article gnus-newsgroup-replied)
3091 (memq article gnus-newsgroup-expirable)
3092 ;; Only insert the Subject string when it's different
3093 ;; from the previous Subject string.
3094 (if (gnus-subject-equal
3096 (mail-header-subject
3099 (gnus-data-find-list
3101 (gnus-data-list t)))))
3102 ;; Error on the side of excessive subjects.
3104 (mail-header-subject header))
3106 (mail-header-subject header))
3107 nil (cdr (assq article gnus-newsgroup-scored))
3108 (memq article gnus-newsgroup-processable))
3110 (gnus-data-update-list
3111 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3113 (defun gnus-summary-update-article (article &optional iheader)
3114 "Update ARTICLE in the summary buffer."
3115 (set-buffer gnus-summary-buffer)
3116 (let* ((header (or iheader (gnus-summary-article-header article)))
3117 (id (mail-header-id header))
3118 (data (gnus-data-find article))
3119 (thread (gnus-id-to-thread id))
3120 (references (mail-header-references header))
3124 (when (and references
3125 (not (equal "" references)))
3128 (buffer-read-only nil)
3130 (number (mail-header-number header))
3133 ;; !!! Should this be in or not?
3135 (setcar thread nil))
3137 (delq thread parent))
3138 (if (gnus-summary-insert-subject id header iheader)
3139 ;; Set the (possibly) new article number in the data structure.
3140 (gnus-data-set-number data (gnus-id-to-article id))
3144 (defun gnus-rebuild-thread (id)
3145 "Rebuild the thread containing ID."
3146 (let ((buffer-read-only nil)
3147 old-pos current thread data)
3148 (if (not gnus-show-threads)
3149 (setq thread (list (car (gnus-id-to-thread id))))
3150 ;; Get the thread this article is part of.
3151 (setq thread (gnus-remove-thread id)))
3152 (setq old-pos (gnus-point-at-bol))
3153 (setq current (save-excursion
3154 (and (zerop (forward-line -1))
3155 (gnus-summary-article-number))))
3156 ;; If this is a gathered thread, we have to go some re-gathering.
3157 (when (stringp (car thread))
3158 (let ((subject (car thread))
3160 (setq thread (cdr thread))
3162 (unless (memq (setq thr (gnus-id-to-thread
3164 (mail-header-id (caar thread)))))
3167 (setq thread (cdr thread)))
3168 ;; We now have all (unique) roots.
3169 (if (= (length roots) 1)
3170 ;; All the loose roots are now one solid root.
3171 (setq thread (car roots))
3172 (setq thread (cons subject (gnus-sort-threads roots))))))
3174 ;; We then insert this thread into the summary buffer.
3175 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3176 (if gnus-show-threads
3177 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3178 (gnus-summary-prepare-unthreaded thread))
3179 (setq data (nreverse gnus-newsgroup-data))
3180 (setq threads gnus-newsgroup-threads))
3181 ;; We splice the new data into the data structure.
3182 (gnus-data-enter-list current data (- (point) old-pos))
3183 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3185 (defun gnus-number-to-header (number)
3186 "Return the header for article NUMBER."
3187 (let ((headers gnus-newsgroup-headers))
3189 (not (= number (mail-header-number (car headers)))))
3194 (defun gnus-parent-headers (headers &optional generation)
3195 "Return the headers of the GENERATIONeth parent of HEADERS."
3197 (setq generation 1))
3200 (while (and parent headers (not (zerop generation)))
3201 (setq references (mail-header-references headers))
3202 (when (and references
3203 (setq parent (gnus-parent-id references))
3204 (setq headers (car (gnus-id-to-thread parent))))
3208 (defun gnus-id-to-thread (id)
3209 "Return the (sub-)thread where ID appears."
3210 (gnus-gethash id gnus-newsgroup-dependencies))
3212 (defun gnus-id-to-article (id)
3213 "Return the article number of ID."
3214 (let ((thread (gnus-id-to-thread id)))
3217 (mail-header-number (car thread)))))
3219 (defun gnus-id-to-header (id)
3220 "Return the article headers of ID."
3221 (car (gnus-id-to-thread id)))
3223 (defun gnus-article-displayed-root-p (article)
3224 "Say whether ARTICLE is a root(ish) article."
3225 (let ((level (gnus-summary-thread-level article))
3226 (refs (mail-header-references (gnus-summary-article-header article)))
3232 ((null (gnus-parent-id refs)) t)
3234 (null (setq particle (gnus-id-to-article
3235 (gnus-parent-id refs))))
3236 (null (gnus-summary-thread-level particle)))))))
3238 (defun gnus-root-id (id)
3239 "Return the id of the root of the thread where ID appears."
3241 (while (and id (setq prev (car (gnus-gethash
3242 id gnus-newsgroup-dependencies))))
3244 id (gnus-parent-id (mail-header-references prev))))
3247 (defun gnus-articles-in-thread (thread)
3248 "Return the list of articles in THREAD."
3249 (cons (mail-header-number (car thread))
3250 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3252 (defun gnus-remove-thread (id &optional dont-remove)
3253 "Remove the thread that has ID in it."
3254 (let ((dep gnus-newsgroup-dependencies)
3255 headers thread last-id)
3256 ;; First go up in this thread until we find the root.
3257 (setq last-id (gnus-root-id id))
3258 (setq headers (list (car (gnus-id-to-thread last-id))
3259 (caadr (gnus-id-to-thread last-id))))
3260 ;; We have now found the real root of this thread. It might have
3261 ;; been gathered into some loose thread, so we have to search
3262 ;; through the threads to find the thread we wanted.
3263 (let ((threads gnus-newsgroup-threads)
3266 (setq sub (car threads))
3267 (if (stringp (car sub))
3268 ;; This is a gathered thread, so we look at the roots
3269 ;; below it to find whether this article is in this
3272 (setq sub (cdr sub))
3274 (when (member (caar sub) headers)
3275 (setq thread (car threads)
3278 (setq sub (cdr sub))))
3279 ;; It's an ordinary thread, so we check it.
3280 (when (eq (car sub) (car headers))
3283 (setq threads (cdr threads)))
3284 ;; If this article is in no thread, then it's a root.
3287 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3288 (setq thread (gnus-gethash last-id dep)))
3291 thread ; We return this thread.
3293 (if (stringp (car thread))
3295 ;; If we use dummy roots, then we have to remove the
3296 ;; dummy root as well.
3297 (when (eq gnus-summary-make-false-root 'dummy)
3299 (gnus-data-compute-positions))
3300 (setq thread (cdr thread))
3302 (gnus-remove-thread-1 (car thread))
3303 (setq thread (cdr thread))))
3304 (gnus-remove-thread-1 thread))))))))
3306 (defun gnus-remove-thread-1 (thread)
3307 "Remove the thread THREAD recursively."
3308 (let ((number (mail-header-number (pop thread)))
3310 (setq thread (reverse thread))
3312 (gnus-remove-thread-1 (pop thread)))
3313 (when (setq d (gnus-data-find number))
3314 (goto-char (gnus-data-pos d))
3317 (- (gnus-point-at-bol)
3319 (1+ (gnus-point-at-eol))
3320 (gnus-delete-line)))))))
3322 (defun gnus-sort-threads (threads)
3324 (if (not gnus-thread-sort-functions)
3326 (gnus-message 7 "Sorting threads...")
3328 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3329 (gnus-message 7 "Sorting threads...done"))))
3331 (defun gnus-sort-articles (articles)
3333 (when gnus-article-sort-functions
3334 (gnus-message 7 "Sorting articles...")
3336 (setq gnus-newsgroup-headers
3337 (sort articles (gnus-make-sort-function
3338 gnus-article-sort-functions)))
3339 (gnus-message 7 "Sorting articles...done"))))
3341 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3342 (defmacro gnus-thread-header (thread)
3343 ;; Return header of first article in THREAD.
3344 ;; Note that THREAD must never, ever be anything else than a variable -
3345 ;; using some other form will lead to serious barfage.
3346 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3347 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3348 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3351 (defsubst gnus-article-sort-by-number (h1 h2)
3352 "Sort articles by article number."
3353 (< (mail-header-number h1)
3354 (mail-header-number h2)))
3356 (defun gnus-thread-sort-by-number (h1 h2)
3357 "Sort threads by root article number."
3358 (gnus-article-sort-by-number
3359 (gnus-thread-header h1) (gnus-thread-header h2)))
3361 (defsubst gnus-article-sort-by-lines (h1 h2)
3362 "Sort articles by article Lines header."
3363 (< (mail-header-lines h1)
3364 (mail-header-lines h2)))
3366 (defun gnus-thread-sort-by-lines (h1 h2)
3367 "Sort threads by root article Lines header."
3368 (gnus-article-sort-by-lines
3369 (gnus-thread-header h1) (gnus-thread-header h2)))
3371 (defsubst gnus-article-sort-by-author (h1 h2)
3372 "Sort articles by root author."
3374 (let ((extract (funcall
3375 gnus-extract-address-components
3376 (mail-header-from h1))))
3377 (or (car extract) (cadr extract) ""))
3378 (let ((extract (funcall
3379 gnus-extract-address-components
3380 (mail-header-from h2))))
3381 (or (car extract) (cadr extract) ""))))
3383 (defun gnus-thread-sort-by-author (h1 h2)
3384 "Sort threads by root author."
3385 (gnus-article-sort-by-author
3386 (gnus-thread-header h1) (gnus-thread-header h2)))
3388 (defsubst gnus-article-sort-by-subject (h1 h2)
3389 "Sort articles by root subject."
3391 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3392 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3394 (defun gnus-thread-sort-by-subject (h1 h2)
3395 "Sort threads by root subject."
3396 (gnus-article-sort-by-subject
3397 (gnus-thread-header h1) (gnus-thread-header h2)))
3399 (defsubst gnus-article-sort-by-date (h1 h2)
3400 "Sort articles by root article date."
3402 (gnus-date-get-time (mail-header-date h1))
3403 (gnus-date-get-time (mail-header-date h2))))
3405 (defun gnus-thread-sort-by-date (h1 h2)
3406 "Sort threads by root article date."
3407 (gnus-article-sort-by-date
3408 (gnus-thread-header h1) (gnus-thread-header h2)))
3410 (defsubst gnus-article-sort-by-score (h1 h2)
3411 "Sort articles by root article score.
3412 Unscored articles will be counted as having a score of zero."
3413 (> (or (cdr (assq (mail-header-number h1)
3414 gnus-newsgroup-scored))
3415 gnus-summary-default-score 0)
3416 (or (cdr (assq (mail-header-number h2)
3417 gnus-newsgroup-scored))
3418 gnus-summary-default-score 0)))
3420 (defun gnus-thread-sort-by-score (h1 h2)
3421 "Sort threads by root article score."
3422 (gnus-article-sort-by-score
3423 (gnus-thread-header h1) (gnus-thread-header h2)))
3425 (defun gnus-thread-sort-by-total-score (h1 h2)
3426 "Sort threads by the sum of all scores in the thread.
3427 Unscored articles will be counted as having a score of zero."
3428 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3430 (defun gnus-thread-total-score (thread)
3431 ;; This function find the total score of THREAD.
3432 (cond ((null thread)
3435 (if (stringp (car thread))
3436 (apply gnus-thread-score-function 0
3437 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3438 (gnus-thread-total-score-1 thread)))
3440 (gnus-thread-total-score-1 (list thread)))))
3442 (defun gnus-thread-total-score-1 (root)
3443 ;; This function find the total score of the thread below ROOT.
3444 (setq root (car root))
3445 (apply gnus-thread-score-function
3447 (mapcar 'gnus-thread-total-score
3448 (cdr (gnus-gethash (mail-header-id root)
3449 gnus-newsgroup-dependencies)))
3450 (when (> (mail-header-number root) 0)
3451 (list (or (cdr (assq (mail-header-number root)
3452 gnus-newsgroup-scored))
3453 gnus-summary-default-score 0))))
3454 (list gnus-summary-default-score)
3457 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3458 (defvar gnus-tmp-prev-subject nil)
3459 (defvar gnus-tmp-false-parent nil)
3460 (defvar gnus-tmp-root-expunged nil)
3461 (defvar gnus-tmp-dummy-line nil)
3463 (defun gnus-summary-prepare-threads (threads)
3464 "Prepare summary buffer from THREADS and indentation LEVEL.
3465 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3466 or a straight list of headers."
3467 (gnus-message 7 "Generating summary...")
3469 (setq gnus-newsgroup-threads threads)
3472 (let ((gnus-tmp-level 0)
3473 (default-score (or gnus-summary-default-score 0))
3474 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3475 thread number subject stack state gnus-tmp-gathered beg-match
3476 new-roots gnus-tmp-new-adopts thread-end
3477 gnus-tmp-header gnus-tmp-unread
3478 gnus-tmp-replied gnus-tmp-subject-or-nil
3479 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3480 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3481 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3483 (setq gnus-tmp-prev-subject nil)
3485 (if (vectorp (car threads))
3486 ;; If this is a straight (sic) list of headers, then a
3487 ;; threaded summary display isn't required, so we just create
3488 ;; an unthreaded one.
3489 (gnus-summary-prepare-unthreaded threads)
3491 ;; Do the threaded display.
3493 (while (or threads stack gnus-tmp-new-adopts new-roots)
3495 (if (and (= gnus-tmp-level 0)
3496 (not (setq gnus-tmp-dummy-line nil))
3499 (not gnus-tmp-false-parent)
3500 (or gnus-tmp-new-adopts new-roots))
3501 (if gnus-tmp-new-adopts
3502 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3503 thread (list (car gnus-tmp-new-adopts))
3504 gnus-tmp-header (caar thread)
3505 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3507 (setq thread (list (car new-roots))
3508 gnus-tmp-header (caar thread)
3509 new-roots (cdr new-roots))))
3512 ;; If there are some threads, we do them before the
3513 ;; threads on the stack.
3514 (setq thread threads
3515 gnus-tmp-header (caar thread))
3516 ;; There were no current threads, so we pop something off
3518 (setq state (car stack)
3519 gnus-tmp-level (car state)
3522 gnus-tmp-header (caar thread))))
3524 (setq gnus-tmp-false-parent nil)
3525 (setq gnus-tmp-root-expunged nil)
3526 (setq thread-end nil)
3528 (if (stringp gnus-tmp-header)
3529 ;; The header is a dummy root.
3531 ((eq gnus-summary-make-false-root 'adopt)
3532 ;; We let the first article adopt the rest.
3533 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3535 (setq gnus-tmp-gathered
3537 (lambda (h) (mail-header-number (car h)))
3540 (setq thread (cons (list (caar thread)
3543 (setq gnus-tmp-level -1
3544 gnus-tmp-false-parent t))
3545 ((eq gnus-summary-make-false-root 'empty)
3546 ;; We print adopted articles with empty subject fields.
3547 (setq gnus-tmp-gathered
3549 (lambda (h) (mail-header-number (car h)))
3552 (setq gnus-tmp-level -1))
3553 ((eq gnus-summary-make-false-root 'dummy)
3554 ;; We remember that we probably want to output a dummy
3556 (setq gnus-tmp-dummy-line gnus-tmp-header)
3557 (setq gnus-tmp-prev-subject gnus-tmp-header))
3559 ;; We do not make a root for the gathered
3560 ;; sub-threads at all.
3561 (setq gnus-tmp-level -1)))
3563 (setq number (mail-header-number gnus-tmp-header)
3564 subject (mail-header-subject gnus-tmp-header))
3567 ;; If the thread has changed subject, we might want to make
3568 ;; this subthread into a root.
3569 ((and (null gnus-thread-ignore-subject)
3570 (not (zerop gnus-tmp-level))
3571 gnus-tmp-prev-subject
3573 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3574 (setq new-roots (nconc new-roots (list (car thread)))
3576 gnus-tmp-header nil))
3577 ;; If the article lies outside the current limit,
3578 ;; then we do not display it.
3579 ((not (memq number gnus-newsgroup-limit))
3580 (setq gnus-tmp-gathered
3582 (lambda (h) (mail-header-number (car h)))
3585 (setq gnus-tmp-new-adopts (if (cdar thread)
3586 (append gnus-tmp-new-adopts
3588 gnus-tmp-new-adopts)
3590 gnus-tmp-header nil)
3591 (when (zerop gnus-tmp-level)
3592 (setq gnus-tmp-root-expunged t)))
3593 ;; Perhaps this article is to be marked as read?
3594 ((and gnus-summary-mark-below
3595 (< (or (cdr (assq number gnus-newsgroup-scored))
3597 gnus-summary-mark-below)
3598 ;; Don't touch sparse articles.
3599 (not (gnus-summary-article-sparse-p number))
3600 (not (gnus-summary-article-ancient-p number)))
3601 (setq gnus-newsgroup-unreads
3602 (delq number gnus-newsgroup-unreads))
3603 (if gnus-newsgroup-auto-expire
3604 (push number gnus-newsgroup-expirable)
3605 (push (cons number gnus-low-score-mark)
3606 gnus-newsgroup-reads))))
3608 (when gnus-tmp-header
3609 ;; We may have an old dummy line to output before this
3611 (when gnus-tmp-dummy-line
3612 (gnus-summary-insert-dummy-line
3613 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3614 (setq gnus-tmp-dummy-line nil))
3616 ;; Compute the mark.
3617 (setq gnus-tmp-unread (gnus-article-mark number))
3619 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3620 gnus-tmp-header gnus-tmp-level)
3621 gnus-newsgroup-data)
3623 ;; Actually insert the line.
3625 gnus-tmp-subject-or-nil
3627 ((and gnus-thread-ignore-subject
3628 gnus-tmp-prev-subject
3629 (not (inline (gnus-subject-equal
3630 gnus-tmp-prev-subject subject))))
3632 ((zerop gnus-tmp-level)
3633 (if (and (eq gnus-summary-make-false-root 'empty)
3634 (memq number gnus-tmp-gathered)
3635 gnus-tmp-prev-subject
3636 (inline (gnus-subject-equal
3637 gnus-tmp-prev-subject subject)))
3638 gnus-summary-same-subject
3640 (t gnus-summary-same-subject)))
3641 (if (and (eq gnus-summary-make-false-root 'adopt)
3642 (= gnus-tmp-level 1)
3643 (memq number gnus-tmp-gathered))
3644 (setq gnus-tmp-opening-bracket ?\<
3645 gnus-tmp-closing-bracket ?\>)
3646 (setq gnus-tmp-opening-bracket ?\[
3647 gnus-tmp-closing-bracket ?\]))
3649 gnus-tmp-indentation
3650 (aref gnus-thread-indent-array gnus-tmp-level)
3651 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3652 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3653 gnus-summary-default-score 0)
3655 (if (or (null gnus-summary-default-score)
3656 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3657 gnus-summary-zcore-fuzz))
3659 (if (< gnus-tmp-score gnus-summary-default-score)
3660 gnus-score-below-mark gnus-score-over-mark))
3662 (cond ((memq number gnus-newsgroup-processable)
3664 ((memq number gnus-newsgroup-cached)
3666 ((memq number gnus-newsgroup-replied)
3668 ((memq number gnus-newsgroup-saved)
3670 (t gnus-unread-mark))
3671 gnus-tmp-from (mail-header-from gnus-tmp-header)
3674 ((string-match "<[^>]+> *$" gnus-tmp-from)
3675 (setq beg-match (match-beginning 0))
3676 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3677 (substring gnus-tmp-from (1+ (match-beginning 0))
3678 (1- (match-end 0))))
3679 (substring gnus-tmp-from 0 beg-match)))
3680 ((string-match "(.+)" gnus-tmp-from)
3681 (substring gnus-tmp-from
3682 (1+ (match-beginning 0)) (1- (match-end 0))))
3684 (when (string= gnus-tmp-name "")
3685 (setq gnus-tmp-name gnus-tmp-from))
3686 (unless (numberp gnus-tmp-lines)
3687 (setq gnus-tmp-lines 0))
3688 (gnus-put-text-property
3690 (progn (eval gnus-summary-line-format-spec) (point))
3691 'gnus-number number)
3694 (run-hooks 'gnus-summary-update-hook)
3697 (setq gnus-tmp-prev-subject subject)))
3699 (when (nth 1 thread)
3700 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3701 (incf gnus-tmp-level)
3702 (setq threads (if thread-end nil (cdar thread)))
3704 (setq gnus-tmp-level 0)))))
3705 (gnus-message 7 "Generating summary...done"))
3707 (defun gnus-summary-prepare-unthreaded (headers)
3708 "Generate an unthreaded summary buffer based on HEADERS."
3709 (let (header number mark)
3714 ;; We may have to root out some bad articles...
3715 (when (memq (setq number (mail-header-number
3716 (setq header (pop headers))))
3717 gnus-newsgroup-limit)
3718 ;; Mark article as read when it has a low score.
3719 (when (and gnus-summary-mark-below
3720 (< (or (cdr (assq number gnus-newsgroup-scored))
3721 gnus-summary-default-score 0)
3722 gnus-summary-mark-below)
3723 (not (gnus-summary-article-ancient-p number)))
3724 (setq gnus-newsgroup-unreads
3725 (delq number gnus-newsgroup-unreads))
3726 (if gnus-newsgroup-auto-expire
3727 (push number gnus-newsgroup-expirable)
3728 (push (cons number gnus-low-score-mark)
3729 gnus-newsgroup-reads)))
3731 (setq mark (gnus-article-mark number))
3732 (push (gnus-data-make number mark (1+ (point)) header 0)
3733 gnus-newsgroup-data)
3734 (gnus-summary-insert-line
3736 mark (memq number gnus-newsgroup-replied)
3737 (memq number gnus-newsgroup-expirable)
3738 (mail-header-subject header) nil
3739 (cdr (assq number gnus-newsgroup-scored))
3740 (memq number gnus-newsgroup-processable))))))
3742 (defun gnus-select-newsgroup (group &optional read-all)
3743 "Select newsgroup GROUP.
3744 If READ-ALL is non-nil, all articles in the group are selected."
3745 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3746 ;;!!! Dirty hack; should be removed.
3747 (gnus-summary-ignore-duplicates
3748 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3750 gnus-summary-ignore-duplicates))
3751 (info (nth 2 entry))
3752 articles fetched-articles cached)
3754 (unless (gnus-check-server
3755 (setq gnus-current-select-method
3756 (gnus-find-method-for-group group)))
3757 (error "Couldn't open server"))
3759 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3760 (gnus-activate-group group) ; Or we can activate it...
3761 (progn ; Or we bug out.
3762 (when (equal major-mode 'gnus-summary-mode)
3763 (kill-buffer (current-buffer)))
3764 (error "Couldn't request group %s: %s"
3765 group (gnus-status-message group))))
3767 (unless (gnus-request-group group t)
3768 (when (equal major-mode 'gnus-summary-mode)
3769 (kill-buffer (current-buffer)))
3770 (error "Couldn't request group %s: %s"
3771 group (gnus-status-message group)))
3773 (setq gnus-newsgroup-name group)
3774 (setq gnus-newsgroup-unselected nil)
3775 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3777 ;; Adjust and set lists of article marks.
3779 (gnus-adjust-marked-articles info))
3781 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3782 (when (gnus-virtual-group-p group)
3783 (setq cached gnus-newsgroup-cached))
3785 (setq gnus-newsgroup-unreads
3786 (gnus-set-difference
3787 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3788 gnus-newsgroup-dormant))
3790 (setq gnus-newsgroup-processable nil)
3792 (gnus-update-read-articles group gnus-newsgroup-unreads)
3793 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3794 (gnus-group-update-group group))
3796 (setq articles (gnus-articles-to-read group read-all))
3800 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3802 ((eq articles 0) nil)
3804 ;; Init the dependencies hash table.
3805 (setq gnus-newsgroup-dependencies
3806 (gnus-make-hashtable (length articles)))
3807 ;; Retrieve the headers and read them in.
3808 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3809 (setq gnus-newsgroup-headers
3811 (setq gnus-headers-retrieved-by
3812 (gnus-retrieve-headers
3813 articles gnus-newsgroup-name
3814 ;; We might want to fetch old headers, but
3815 ;; not if there is only 1 article.
3816 (and gnus-fetch-old-headers
3818 (not (eq gnus-fetch-old-headers 'some))
3819 (not (numberp gnus-fetch-old-headers)))
3820 (> (length articles) 1))))))
3821 (gnus-get-newsgroup-headers-xover
3822 articles nil nil gnus-newsgroup-name t)
3823 (gnus-get-newsgroup-headers)))
3824 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3826 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3828 (setq gnus-newsgroup-cached cached))
3830 ;; Suppress duplicates?
3831 (when gnus-suppress-duplicates
3832 (gnus-dup-suppress-articles))
3834 ;; Set the initial limit.
3835 (setq gnus-newsgroup-limit (copy-sequence articles))
3836 ;; Remove canceled articles from the list of unread articles.
3837 (setq gnus-newsgroup-unreads
3838 (gnus-set-sorted-intersection
3839 gnus-newsgroup-unreads
3840 (setq fetched-articles
3841 (mapcar (lambda (headers) (mail-header-number headers))
3842 gnus-newsgroup-headers))))
3843 ;; Removed marked articles that do not exist.
3844 (gnus-update-missing-marks
3845 (gnus-sorted-complement fetched-articles articles))
3846 ;; Let the Gnus agent mark articles as read.
3848 (gnus-agent-get-undownloaded-list))
3849 ;; We might want to build some more threads first.
3850 (when (and gnus-fetch-old-headers
3851 (eq gnus-headers-retrieved-by 'nov))
3852 (if (eq gnus-fetch-old-headers 'invisible)
3853 (gnus-build-all-threads)
3854 (gnus-build-old-threads)))
3855 ;; Check whether auto-expire is to be done in this group.
3856 (setq gnus-newsgroup-auto-expire
3857 (gnus-group-auto-expirable-p group))
3858 ;; Set up the article buffer now, if necessary.
3859 (unless gnus-single-article-buffer
3860 (gnus-article-setup-buffer))
3861 ;; First and last article in this newsgroup.
3862 (when gnus-newsgroup-headers
3863 (setq gnus-newsgroup-begin
3864 (mail-header-number (car gnus-newsgroup-headers))
3867 (gnus-last-element gnus-newsgroup-headers))))
3868 ;; GROUP is successfully selected.
3869 (or gnus-newsgroup-headers t)))))
3871 (defun gnus-articles-to-read (group &optional read-all)
3872 ;; Find out what articles the user wants to read.
3874 ;; Select all articles if `read-all' is non-nil, or if there
3875 ;; are no unread articles.
3877 (and (zerop (length gnus-newsgroup-marked))
3878 (zerop (length gnus-newsgroup-unreads)))
3879 (eq (gnus-group-find-parameter group 'display)
3881 (gnus-uncompress-range (gnus-active group))
3882 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3883 (copy-sequence gnus-newsgroup-unreads))
3885 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3886 (scored (length scored-list))
3887 (number (length articles))
3888 (marked (+ (length gnus-newsgroup-marked)
3889 (length gnus-newsgroup-dormant)))
3897 ((and (or (<= scored marked) (= scored number))
3898 (numberp gnus-large-newsgroup)
3899 (> number gnus-large-newsgroup))
3903 "How many articles from %s (default %d): "
3904 (gnus-limit-string gnus-newsgroup-name 35)
3906 (if (string-match "^[ \t]*$" input) number input)))
3907 ((and (> scored marked) (< scored number)
3908 (> (- scored number) 20))
3911 (format "%s %s (%d scored, %d total): "
3912 "How many articles from"
3913 group scored number))))
3914 (if (string-match "^[ \t]*$" input)
3918 (setq select (if (stringp select) (string-to-number select) select))
3919 (if (or (null select) (zerop select))
3921 (if (and (not (zerop scored)) (<= (abs select) scored))
3923 (setq articles (sort scored-list '<))
3924 (setq number (length articles)))
3925 (setq articles (copy-sequence articles)))
3927 (when (< (abs select) number)
3929 ;; Select the N oldest articles.
3930 (setcdr (nthcdr (1- (abs select)) articles) nil)
3931 ;; Select the N most recent articles.
3932 (setq articles (nthcdr (- number select) articles))))
3933 (setq gnus-newsgroup-unselected
3934 (gnus-sorted-intersection
3935 gnus-newsgroup-unreads
3936 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3939 (defun gnus-killed-articles (killed articles)
3942 (when (inline (gnus-member-of-range (car articles) killed))
3943 (push (car articles) out))
3944 (setq articles (cdr articles)))
3947 (defun gnus-uncompress-marks (marks)
3948 "Uncompress the mark ranges in MARKS."
3949 (let ((uncompressed '(score bookmark))
3952 (if (memq (caar marks) uncompressed)
3953 (push (car marks) out)
3954 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3955 (setq marks (cdr marks)))
3958 (defun gnus-adjust-marked-articles (info)
3959 "Set all article lists and remove all marks that are no longer legal."
3960 (let* ((marked-lists (gnus-info-marks info))
3961 (active (gnus-active (gnus-info-group info)))
3964 (types gnus-article-mark-lists)
3965 (uncompressed '(score bookmark killed))
3966 marks var articles article mark)
3969 (setq marks (pop marked-lists))
3970 (set (setq var (intern (format "gnus-newsgroup-%s"
3971 (car (rassq (setq mark (car marks))
3973 (if (memq (car marks) uncompressed) (cdr marks)
3974 (gnus-uncompress-range (cdr marks))))
3976 (setq articles (symbol-value var))
3978 ;; All articles have to be subsets of the active articles.
3980 ;; Adjust "simple" lists.
3981 ((memq mark '(tick dormant expire reply save))
3983 (when (or (< (setq article (pop articles)) min) (> article max))
3984 (set var (delq article (symbol-value var))))))
3986 ((memq mark uncompressed)
3987 (when (not (listp (cdr (symbol-value var))))
3988 (set var (list (symbol-value var))))
3989 (when (not (listp (cdr articles)))
3990 (setq articles (list articles)))
3992 (when (or (not (consp (setq article (pop articles))))
3993 (< (car article) min)
3994 (> (car article) max))
3995 (set var (delq article (symbol-value var))))))))))
3997 (defun gnus-update-missing-marks (missing)
3998 "Go through the list of MISSING articles and remove them from the mark lists."
4000 (let ((types gnus-article-mark-lists)
4002 ;; Go through all types.
4004 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4005 (when (symbol-value var)
4006 ;; This list has articles. So we delete all missing articles
4010 (set var (delq (pop m) (symbol-value var)))))))))
4012 (defun gnus-update-marks ()
4013 "Enter the various lists of marked articles into the newsgroup info list."
4014 (let ((types gnus-article-mark-lists)
4015 (info (gnus-get-info gnus-newsgroup-name))
4016 (uncompressed '(score bookmark killed))
4017 type list newmarked symbol)
4019 ;; Add all marks lists that are non-nil to the list of marks lists.
4020 (while (setq type (pop types))
4021 (when (setq list (symbol-value
4023 (intern (format "gnus-newsgroup-%s"
4026 ;; Get rid of the entries of the articles that have the
4028 (when (and (eq (cdr type) 'score)
4032 (prev (cons nil list))
4035 (if (or (not (consp (car arts)))
4036 (= (cdar arts) gnus-summary-default-score))
4037 (setcdr prev (cdr arts))
4039 (setq arts (cdr arts)))
4040 (setq list (cdr all))))
4042 (push (cons (cdr type)
4043 (if (memq (cdr type) uncompressed) list
4044 (gnus-compress-sequence
4045 (set symbol (sort list '<)) t)))
4048 ;; Enter these new marks into the info of the group.
4050 (setcar (nthcdr 3 info) newmarked)
4051 ;; Add the marks lists to the end of the info.
4053 (setcdr (nthcdr 2 info) (list newmarked))))
4055 ;; Cut off the end of the info if there's nothing else there.
4059 (when (nthcdr (decf i) info)
4060 (setcdr (nthcdr i info) nil)))))))
4062 (defun gnus-set-mode-line (where)
4063 "This function sets the mode line of the article or summary buffers.
4064 If WHERE is `summary', the summary mode line format will be used."
4065 ;; Is this mode line one we keep updated?
4066 (when (memq where gnus-updated-mode-lines)
4069 ;; We evaluate this in the summary buffer since these
4070 ;; variables are buffer-local to that buffer.
4071 (set-buffer gnus-summary-buffer)
4072 ;; We bind all these variables that are used in the `eval' form
4074 (let* ((mformat (symbol-value
4076 (format "gnus-%s-mode-line-format-spec" where))))
4077 (gnus-tmp-group-name gnus-newsgroup-name)
4078 (gnus-tmp-article-number (or gnus-current-article 0))
4079 (gnus-tmp-unread gnus-newsgroup-unreads)
4080 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4081 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4082 (gnus-tmp-unread-and-unselected
4083 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4084 (zerop gnus-tmp-unselected))
4086 ((zerop gnus-tmp-unselected)
4087 (format "{%d more}" gnus-tmp-unread-and-unticked))
4088 (t (format "{%d(+%d) more}"
4089 gnus-tmp-unread-and-unticked
4090 gnus-tmp-unselected))))
4092 (if (and gnus-current-headers
4093 (vectorp gnus-current-headers))
4094 (gnus-mode-string-quote
4095 (mail-header-subject gnus-current-headers))
4097 bufname-length max-len
4098 gnus-tmp-header);; passed as argument to any user-format-funcs
4099 (setq mode-string (eval mformat))
4100 (setq bufname-length (if (string-match "%b" mode-string)
4103 (if (eq where 'summary)
4105 (get-buffer gnus-article-buffer))))
4108 (setq max-len (max 4 (if gnus-mode-non-string-length
4110 gnus-mode-non-string-length
4112 (length mode-string))))
4113 ;; We might have to chop a bit of the string off...
4114 (when (> (length mode-string) max-len)
4116 (concat (gnus-truncate-string mode-string (- max-len 3))
4118 ;; Pad the mode string a bit.
4119 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4120 ;; Update the mode line.
4121 (setq mode-line-buffer-identification
4122 (gnus-mode-line-buffer-identification (list mode-string)))
4123 (set-buffer-modified-p t))))
4125 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4126 "Go through the HEADERS list and add all Xrefs to a hash table.
4127 The resulting hash table is returned, or nil if no Xrefs were found."
4128 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4129 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4130 (xref-hashtb (gnus-make-hashtable))
4131 start group entry number xrefs header)
4133 (setq header (pop headers))
4134 (when (and (setq xrefs (mail-header-xref header))
4135 (not (memq (setq number (mail-header-number header))
4138 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4139 (setq start (match-end 0))
4140 (setq group (if prefix
4141 (concat prefix (substring xrefs (match-beginning 1)
4143 (substring xrefs (match-beginning 1) (match-end 1))))
4145 (string-to-int (substring xrefs (match-beginning 2)
4147 (if (setq entry (gnus-gethash group xref-hashtb))
4148 (setcdr entry (cons number (cdr entry)))
4149 (gnus-sethash group (cons number nil) xref-hashtb)))))
4150 (and start xref-hashtb)))
4152 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4153 "Look through all the headers and mark the Xrefs as read."
4154 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4155 name entry info xref-hashtb idlist method nth4)
4157 (set-buffer gnus-group-buffer)
4158 (when (setq xref-hashtb
4159 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4162 (unless (string= from-newsgroup (setq name (symbol-name group)))
4163 (setq idlist (symbol-value group))
4164 ;; Dead groups are not updated.
4166 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4168 (when (stringp (setq nth4 (gnus-info-method info)))
4169 (setq nth4 (gnus-server-to-method nth4))))
4170 ;; Only do the xrefs if the group has the same
4171 ;; select method as the group we have just read.
4172 (or (gnus-methods-equal-p
4173 nth4 (gnus-find-method-for-group from-newsgroup))
4175 (equal nth4 (setq method (gnus-find-method-for-group
4177 (and (equal (car nth4) (car method))
4178 (equal (nth 1 nth4) (nth 1 method))))
4179 gnus-use-cross-reference
4180 (or (not (eq gnus-use-cross-reference t))
4182 ;; Only do cross-references on subscribed
4183 ;; groups, if that is what is wanted.
4184 (<= (gnus-info-level info) gnus-level-subscribed))
4185 (gnus-group-make-articles-read name idlist))))
4188 (defun gnus-compute-read-articles (group articles)
4189 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4190 (info (nth 2 entry))
4191 (active (gnus-active group))
4194 ;; First peel off all illegal article numbers.
4196 (let ((ids articles)
4198 (while (setq id (pop ids))
4199 (when (and first (> id (cdr active)))
4200 ;; We'll end up in this situation in one particular
4201 ;; obscure situation. If you re-scan a group and get
4202 ;; a new article that is cross-posted to a different
4203 ;; group that has not been re-scanned, you might get
4204 ;; crossposted article that has a higher number than
4205 ;; Gnus believes possible. So we re-activate this
4206 ;; group as well. This might mean doing the
4207 ;; crossposting thingy will *increase* the number
4208 ;; of articles in some groups. Tsk, tsk.
4209 (setq active (or (gnus-activate-group group) active)))
4210 (when (or (> id (cdr active))
4211 (< id (car active)))
4212 (setq articles (delq id articles))))))
4213 ;; If the read list is nil, we init it.
4215 (null (gnus-info-read info))
4217 (setq ninfo (cons 1 (1- (car active))))
4218 (setq ninfo (gnus-info-read info)))
4219 ;; Then we add the read articles to the range.
4221 ninfo (setq articles (sort articles '<))))))
4223 (defun gnus-group-make-articles-read (group articles)
4224 "Update the info of GROUP to say that ARTICLES are read."
4226 (entry (gnus-gethash group gnus-newsrc-hashtb))
4227 (info (nth 2 entry))
4228 (active (gnus-active group))
4231 (setq range (gnus-compute-read-articles group articles))
4233 (set-buffer gnus-group-buffer)
4236 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4237 (gnus-info-set-read ',info ',(gnus-info-read info))
4238 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4239 (gnus-group-update-group ,group t))))
4240 ;; Add the read articles to the range.
4241 (gnus-info-set-read info range)
4242 ;; Then we have to re-compute how many unread
4243 ;; articles there are in this group.
4247 (setq num (- (1+ (cdr active)) (car active))))
4248 ((not (listp (cdr range)))
4249 (setq num (- (cdr active) (- (1+ (cdr range))
4253 (if (numberp (car range))
4255 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4256 (setq range (cdr range)))
4257 (setq num (- (cdr active) num))))
4258 ;; Update the number of unread articles.
4260 ;; Update the group buffer.
4261 (gnus-group-update-group group t)))))
4263 (defun gnus-methods-equal-p (m1 m2)
4264 (let ((m1 (or m1 gnus-select-method))
4265 (m2 (or m2 gnus-select-method)))
4267 (and (eq (car m1) (car m2))
4268 (or (not (memq 'address (assoc (symbol-name (car m1))
4269 gnus-valid-select-methods)))
4270 (equal (nth 1 m1) (nth 1 m2)))))))
4272 (defvar gnus-newsgroup-none-id 0)
4274 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4275 (let ((cur nntp-server-buffer)
4278 (save-excursion (set-buffer gnus-summary-buffer)
4279 gnus-newsgroup-dependencies)))
4280 headers id id-dep ref-dep end ref)
4282 (set-buffer nntp-server-buffer)
4283 ;; Translate all TAB characters into SPACE characters.
4284 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4285 (run-hooks 'gnus-parse-headers-hook)
4286 (let ((case-fold-search t)
4287 in-reply-to header p lines)
4288 (goto-char (point-min))
4289 ;; Search to the beginning of the next header. Error messages
4290 ;; do not begin with 2 or 3.
4291 (while (re-search-forward "^[23][0-9]+ " nil t)
4294 ;; This implementation of this function, with nine
4295 ;; search-forwards instead of the one re-search-forward and
4296 ;; a case (which basically was the old function) is actually
4297 ;; about twice as fast, even though it looks messier. You
4298 ;; can't have everything, I guess. Speed and elegance
4299 ;; doesn't always go hand in hand.
4308 (narrow-to-region (point)
4309 (or (and (search-forward "\n.\n" nil t)
4315 (if (search-forward "\nsubject: " nil t)
4316 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4318 gnus-unstructured-field-decoder (nnheader-header-value))
4323 (if (search-forward "\nfrom: " nil t)
4324 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4326 gnus-structured-field-decoder (nnheader-header-value))
4331 (if (search-forward "\ndate: " nil t)
4332 (nnheader-header-value) ""))
4336 (setq id (if (search-forward "\nmessage-id:" nil t)
4338 (1- (or (search-forward "<" nil t) (point)))
4339 (or (search-forward ">" nil t) (point)))
4340 ;; If there was no message-id, we just fake one
4341 ;; to make subsequent routines simpler.
4342 (nnheader-generate-fake-message-id))))
4346 (if (search-forward "\nreferences: " nil t)
4350 (nnheader-header-value)
4355 (search-backward ">" end t)
4358 (search-backward "<" end t)
4360 ;; Get the references from the in-reply-to header if there
4361 ;; were no references and the in-reply-to header looks
4363 (if (and (search-forward "\nin-reply-to: " nil t)
4364 (setq in-reply-to (nnheader-header-value))
4365 (string-match "<[^>]+>" in-reply-to))
4366 (setq ref (substring in-reply-to (match-beginning 0)
4374 (if (search-forward "\nlines: " nil t)
4375 (if (numberp (setq lines (ignore-errors (read cur))))
4381 (and (search-forward "\nxref: " nil t)
4382 (nnheader-header-value)))))
4383 (when (equal id ref)
4386 (when gnus-alter-header-function
4387 (funcall gnus-alter-header-function header)
4388 (setq id (mail-header-id header)
4389 ref (gnus-parent-id (mail-header-references header))))
4391 ;; We do the threading while we read the headers. The
4392 ;; message-id and the last reference are both entered into
4393 ;; the same hash table. Some tippy-toeing around has to be
4394 ;; done in case an article has arrived before the article
4395 ;; which it refers to.
4396 (if (boundp (setq id-dep (intern id dependencies)))
4397 (if (and (car (symbol-value id-dep))
4399 ;; An article with this Message-ID has already been seen.
4400 (if gnus-summary-ignore-duplicates
4401 ;; We ignore this one, except we add
4402 ;; any additional Xrefs (in case the two articles
4403 ;; came from different servers).
4405 (mail-header-set-xref
4406 (car (symbol-value id-dep))
4407 (concat (or (mail-header-xref
4408 (car (symbol-value id-dep)))
4410 (or (mail-header-xref header) "")))
4412 ;; We rename the Message-ID.
4414 (setq id-dep (intern (setq id (nnmail-message-id))
4417 (mail-header-set-id header id))
4418 (setcar (symbol-value id-dep) header))
4419 (set id-dep (list header)))
4421 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4422 (setcdr (symbol-value ref-dep)
4423 (nconc (cdr (symbol-value ref-dep))
4424 (list (symbol-value id-dep))))
4425 (set ref-dep (list nil (symbol-value id-dep))))
4426 (push header headers))
4427 (goto-char (point-max))
4429 (nreverse headers)))))
4431 ;; The following macros and functions were written by Felix Lee
4432 ;; <flee@cse.psu.edu>.
4434 (defmacro gnus-nov-read-integer ()
4436 (if (= (following-char) ?\t)
4438 (let ((num (ignore-errors (read buffer))))
4439 (if (numberp num) num 0)))
4441 (search-forward "\t" eol 'move))))
4443 (defmacro gnus-nov-skip-field ()
4444 '(search-forward "\t" eol 'move))
4446 (defmacro gnus-nov-field ()
4447 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4449 ;; (defvar gnus-nov-none-counter 0)
4451 ;; This function has to be called with point after the article number
4452 ;; on the beginning of the line.
4453 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4454 (let ((eol (gnus-point-at-eol))
4455 (buffer (current-buffer))
4456 header ref id id-dep ref-dep)
4458 ;; overview: [num subject from date id refs chars lines misc]
4461 (narrow-to-region (point) eol)
4469 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4471 gnus-structured-field-decoder (gnus-nov-field)) ; from
4472 (gnus-nov-field) ; date
4473 (setq id (or (gnus-nov-field)
4474 (nnheader-generate-fake-message-id))) ; id
4476 (let ((beg (point)))
4477 (search-forward "\t" eol)
4478 (if (search-backward ">" beg t)
4482 (search-backward "<" beg t)))
4485 (gnus-nov-field)) ; refs
4486 (gnus-nov-read-integer) ; chars
4487 (gnus-nov-read-integer) ; lines
4488 (if (= (following-char) ?\n)
4490 (gnus-nov-field))))) ; misc
4494 (when gnus-alter-header-function
4495 (funcall gnus-alter-header-function header)
4496 (setq id (mail-header-id header)
4497 ref (gnus-parent-id (mail-header-references header))))
4499 ;; We build the thread tree.
4500 (when (equal id ref)
4501 ;; This article refers back to itself. Naughty, naughty.
4503 (if (boundp (setq id-dep (intern id dependencies)))
4504 (if (and (car (symbol-value id-dep))
4506 ;; An article with this Message-ID has already been seen.
4507 (if gnus-summary-ignore-duplicates
4508 ;; We ignore this one, except we add any additional
4509 ;; Xrefs (in case the two articles came from different
4512 (mail-header-set-xref
4513 (car (symbol-value id-dep))
4514 (concat (or (mail-header-xref
4515 (car (symbol-value id-dep)))
4517 (or (mail-header-xref header) "")))
4519 ;; We rename the Message-ID.
4521 (setq id-dep (intern (setq id (nnmail-message-id))
4524 (mail-header-set-id header id))
4525 (setcar (symbol-value id-dep) header))
4526 (set id-dep (list header)))
4528 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4529 (setcdr (symbol-value ref-dep)
4530 (nconc (cdr (symbol-value ref-dep))
4531 (list (symbol-value id-dep))))
4532 (set ref-dep (list nil (symbol-value id-dep)))))
4535 ;; Goes through the xover lines and returns a list of vectors
4536 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4537 force-new dependencies
4538 group also-fetch-heads)
4539 "Parse the news overview data in the server buffer, and return a
4540 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4541 ;; Get the Xref when the users reads the articles since most/some
4542 ;; NNTP servers do not include Xrefs when using XOVER.
4543 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4544 (let ((cur nntp-server-buffer)
4545 (dependencies (or dependencies gnus-newsgroup-dependencies))
4546 number headers header)
4548 (set-buffer nntp-server-buffer)
4549 ;; Allow the user to mangle the headers before parsing them.
4550 (run-hooks 'gnus-parse-headers-hook)
4551 (goto-char (point-min))
4554 (while (and sequence (not (eobp)))
4555 (setq number (read cur))
4556 (while (and sequence
4557 (< (car sequence) number))
4558 (setq sequence (cdr sequence)))
4560 (eq number (car sequence))
4562 (setq sequence (cdr sequence))
4563 (setq header (inline
4564 (gnus-nov-parse-line
4565 number dependencies force-new))))
4566 (push header headers))
4569 (gnus-error 4 "Strange nov line (%d)"
4570 (count-lines (point-min) (point)))))
4572 ;; A common bug in inn is that if you have posted an article and
4573 ;; then retrieves the active file, it will answer correctly --
4574 ;; the new article is included. However, a NOV entry for the
4575 ;; article may not have been generated yet, so this may fail.
4576 ;; We work around this problem by retrieving the last few
4577 ;; headers using HEAD.
4578 (if (or (not also-fetch-heads)
4580 ;; We (probably) got all the headers.
4582 (let ((gnus-nov-is-evil t))
4585 (when (gnus-retrieve-headers sequence group)
4586 (gnus-get-newsgroup-headers))))))))
4588 (defun gnus-article-get-xrefs ()
4589 "Fill in the Xref value in `gnus-current-headers', if necessary.
4590 This is meant to be called in `gnus-article-internal-prepare-hook'."
4591 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4592 gnus-current-headers)))
4593 (or (not gnus-use-cross-reference)
4595 (and (mail-header-xref headers)
4596 (not (string= (mail-header-xref headers) "")))
4597 (let ((case-fold-search t)
4600 (nnheader-narrow-to-headers)
4601 (goto-char (point-min))
4602 (when (or (and (eq (downcase (following-char)) ?x)
4603 (looking-at "Xref:"))
4604 (search-forward "\nXref:" nil t))
4605 (goto-char (1+ (match-end 0)))
4606 (setq xref (buffer-substring (point)
4607 (progn (end-of-line) (point))))
4608 (mail-header-set-xref headers xref)))))))
4610 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4611 "Find article ID and insert the summary line for that article."
4612 (let ((header (if (and old-header use-old-header)
4613 old-header (gnus-read-header id)))
4614 (number (and (numberp id) id))
4617 ;; Rebuild the thread that this article is part of and go to the
4618 ;; article we have fetched.
4619 (when (and (not gnus-show-threads)
4621 (when (setq d (gnus-data-find (mail-header-number old-header)))
4622 (goto-char (gnus-data-pos d))
4625 (- (gnus-point-at-bol)
4627 (1+ (gnus-point-at-eol))
4628 (gnus-delete-line))))))
4630 (mail-header-set-number header (mail-header-number old-header)))
4631 (setq gnus-newsgroup-sparse
4632 (delq (setq number (mail-header-number header))
4633 gnus-newsgroup-sparse))
4634 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4635 (gnus-rebuild-thread (mail-header-id header))
4636 (gnus-summary-goto-subject number nil t))
4637 (when (and (numberp number)
4639 ;; We have to update the boundaries even if we can't fetch the
4640 ;; article if ID is a number -- so that the next `P' or `N'
4641 ;; command will fetch the previous (or next) article even
4642 ;; if the one we tried to fetch this time has been canceled.
4643 (when (> number gnus-newsgroup-end)
4644 (setq gnus-newsgroup-end number))
4645 (when (< number gnus-newsgroup-begin)
4646 (setq gnus-newsgroup-begin number))
4647 (setq gnus-newsgroup-unselected
4648 (delq number gnus-newsgroup-unselected)))
4649 ;; Report back a success?
4650 (and header (mail-header-number header))))
4652 ;;; Process/prefix in the summary buffer
4654 (defun gnus-summary-work-articles (n)
4655 "Return a list of articles to be worked upon. The prefix argument,
4656 the list of process marked articles, and the current article will be
4657 taken into consideration."
4660 ;; A numerical prefix has been given.
4661 (setq n (prefix-numeric-value n))
4662 (let ((backward (< n 0))
4663 (n (abs (prefix-numeric-value n)))
4668 (push (setq article (gnus-summary-article-number))
4671 (gnus-summary-find-prev nil article)
4672 (gnus-summary-find-next nil article)))
4674 (nreverse articles)))
4675 ((gnus-region-active-p)
4676 ;; Work on the region between point and mark.
4677 (let ((max (max (point) (mark)))
4680 (goto-char (min (point) (mark)))
4683 (push (setq article (gnus-summary-article-number)) articles)
4684 (gnus-summary-find-next nil article)
4686 (nreverse articles))))
4687 (gnus-newsgroup-processable
4688 ;; There are process-marked articles present.
4689 ;; Save current state.
4690 (gnus-summary-save-process-mark)
4692 (reverse gnus-newsgroup-processable))
4694 ;; Just return the current article.
4695 (list (gnus-summary-article-number)))))
4697 (defun gnus-summary-save-process-mark ()
4698 "Push the current set of process marked articles on the stack."
4700 (push (copy-sequence gnus-newsgroup-processable)
4701 gnus-newsgroup-process-stack))
4703 (defun gnus-summary-kill-process-mark ()
4704 "Push the current set of process marked articles on the stack and unmark."
4706 (gnus-summary-save-process-mark)
4707 (gnus-summary-unmark-all-processable))
4709 (defun gnus-summary-yank-process-mark ()
4710 "Pop the last process mark state off the stack and restore it."
4712 (unless gnus-newsgroup-process-stack
4713 (error "Empty mark stack"))
4714 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4716 (defun gnus-summary-process-mark-set (set)
4717 "Make SET into the current process marked articles."
4718 (gnus-summary-unmark-all-processable)
4720 (gnus-summary-set-process-mark (pop set))))
4722 ;;; Searching and stuff
4724 (defun gnus-summary-search-group (&optional backward use-level)
4725 "Search for next unread newsgroup.
4726 If optional argument BACKWARD is non-nil, search backward instead."
4728 (set-buffer gnus-group-buffer)
4729 (when (gnus-group-search-forward
4730 backward nil (if use-level (gnus-group-group-level) nil))
4731 (gnus-group-group-name))))
4733 (defun gnus-summary-best-group (&optional exclude-group)
4734 "Find the name of the best unread group.
4735 If EXCLUDE-GROUP, do not go to this group."
4737 (set-buffer gnus-group-buffer)
4739 (gnus-group-best-unread-group exclude-group))))
4741 (defun gnus-summary-find-next (&optional unread article backward)
4742 (if backward (gnus-summary-find-prev)
4743 (let* ((dummy (gnus-summary-article-intangible-p))
4744 (article (or article (gnus-summary-article-number)))
4745 (arts (gnus-data-find-list article))
4747 (when (and (not dummy)
4748 (or (not gnus-summary-check-current)
4750 (not (gnus-data-unread-p (car arts)))))
4751 (setq arts (cdr arts)))
4756 (when (gnus-data-unread-p (car arts))
4757 (setq result (car arts)
4759 (setq arts (cdr arts)))
4762 (goto-char (gnus-data-pos result))
4763 (gnus-data-number result)))))
4765 (defun gnus-summary-find-prev (&optional unread article)
4766 (let* ((eobp (eobp))
4767 (article (or article (gnus-summary-article-number)))
4768 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4770 (when (and (not eobp)
4771 (or (not gnus-summary-check-current)
4773 (not (gnus-data-unread-p (car arts)))))
4774 (setq arts (cdr arts)))
4779 (when (gnus-data-unread-p (car arts))
4780 (setq result (car arts)
4782 (setq arts (cdr arts)))
4785 (goto-char (gnus-data-pos result))
4786 (gnus-data-number result))))
4788 (defun gnus-summary-find-subject (subject &optional unread backward article)
4789 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4790 (article (or article (gnus-summary-article-number)))
4791 (articles (gnus-data-list backward))
4792 (arts (gnus-data-find-list article articles))
4794 (when (or (not gnus-summary-check-current)
4796 (not (gnus-data-unread-p (car arts))))
4797 (setq arts (cdr arts)))
4799 (and (or (not unread)
4800 (gnus-data-unread-p (car arts)))
4801 (vectorp (gnus-data-header (car arts)))
4803 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4804 (setq result (car arts)
4806 (setq arts (cdr arts)))
4808 (goto-char (gnus-data-pos result))
4809 (gnus-data-number result))))
4811 (defun gnus-summary-search-forward (&optional unread subject backward)
4812 "Search forward for an article.
4813 If UNREAD, look for unread articles. If SUBJECT, look for
4814 articles with that subject. If BACKWARD, search backward instead."
4815 (cond (subject (gnus-summary-find-subject subject unread backward))
4816 (backward (gnus-summary-find-prev unread))
4817 (t (gnus-summary-find-next unread))))
4819 (defun gnus-recenter (&optional n)
4820 "Center point in window and redisplay frame.
4821 Also do horizontal recentering."
4823 (when (and gnus-auto-center-summary
4824 (not (eq gnus-auto-center-summary 'vertical)))
4825 (gnus-horizontal-recenter))
4828 (defun gnus-summary-recenter ()
4829 "Center point in the summary window.
4830 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4831 displayed, no centering will be performed."
4832 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4833 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4834 (let* ((top (cond ((< (window-height) 4) 0)
4835 ((< (window-height) 7) 1)
4837 (height (1- (window-height)))
4838 (bottom (save-excursion (goto-char (point-max))
4839 (forward-line (- height))
4841 (window (get-buffer-window (current-buffer))))
4842 ;; The user has to want it.
4843 (when gnus-auto-center-summary
4844 (when (get-buffer-window gnus-article-buffer)
4845 ;; Only do recentering when the article buffer is displayed,
4846 ;; Set the window start to either `bottom', which is the biggest
4847 ;; possible valid number, or the second line from the top,
4848 ;; whichever is the least.
4850 window (min bottom (save-excursion
4851 (forward-line (- top)) (point)))))
4852 ;; Do horizontal recentering while we're at it.
4853 (when (and (get-buffer-window (current-buffer) t)
4854 (not (eq gnus-auto-center-summary 'vertical)))
4855 (let ((selected (selected-window)))
4856 (select-window (get-buffer-window (current-buffer) t))
4857 (gnus-summary-position-point)
4858 (gnus-horizontal-recenter)
4859 (select-window selected))))))
4861 (defun gnus-summary-jump-to-group (newsgroup)
4862 "Move point to NEWSGROUP in group mode buffer."
4863 ;; Keep update point of group mode buffer if visible.
4864 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4865 (save-window-excursion
4866 ;; Take care of tree window mode.
4867 (when (get-buffer-window gnus-group-buffer)
4868 (pop-to-buffer gnus-group-buffer))
4869 (gnus-group-jump-to-group newsgroup))
4871 ;; Take care of tree window mode.
4872 (if (get-buffer-window gnus-group-buffer)
4873 (pop-to-buffer gnus-group-buffer)
4874 (set-buffer gnus-group-buffer))
4875 (gnus-group-jump-to-group newsgroup))))
4877 ;; This function returns a list of article numbers based on the
4878 ;; difference between the ranges of read articles in this group and
4879 ;; the range of active articles.
4880 (defun gnus-list-of-unread-articles (group)
4881 (let* ((read (gnus-info-read (gnus-get-info group)))
4882 (active (or (gnus-active group) (gnus-activate-group group)))
4885 ;; If none are read, then all are unread.
4887 (setq first (car active))
4888 ;; If the range of read articles is a single range, then the
4889 ;; first unread article is the article after the last read
4890 ;; article. Sounds logical, doesn't it?
4891 (if (not (listp (cdr read)))
4892 (setq first (1+ (cdr read)))
4893 ;; `read' is a list of ranges.
4894 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4900 (while (< first nlast)
4902 (setq first (1+ first))))
4903 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4904 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4905 (setq read (cdr read)))))
4906 ;; And add the last unread articles.
4907 (while (<= first last)
4909 (setq first (1+ first)))
4910 ;; Return the list of unread articles.
4911 (delq 0 (nreverse unread))))
4913 (defun gnus-list-of-read-articles (group)
4914 "Return a list of unread, unticked and non-dormant articles."
4915 (let* ((info (gnus-get-info group))
4916 (marked (gnus-info-marks info))
4917 (active (gnus-active group)))
4919 (gnus-set-difference
4920 (gnus-sorted-complement
4921 (gnus-uncompress-range active)
4922 (gnus-list-of-unread-articles group))
4924 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4925 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4927 ;; Various summary commands
4929 (defun gnus-summary-select-article-buffer ()
4930 "Reconfigure windows to show article buffer."
4932 (if (not (gnus-buffer-live-p gnus-article-buffer))
4933 (error "There is no article buffer for this summary buffer")
4934 (gnus-configure-windows 'article)
4935 (select-window (get-buffer-window gnus-article-buffer))))
4937 (defun gnus-summary-universal-argument (arg)
4938 "Perform any operation on all articles that are process/prefixed."
4940 (let ((articles (gnus-summary-work-articles arg))
4947 (substitute-command-keys
4948 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4951 (gnus-error 1 "Undefined key")
4954 (gnus-summary-goto-subject (setq article (pop articles)))
4955 (let (gnus-newsgroup-processable)
4956 (command-execute func))
4957 (gnus-summary-remove-process-mark article)))))
4958 (gnus-summary-position-point))
4960 (defun gnus-summary-toggle-truncation (&optional arg)
4961 "Toggle truncation of summary lines.
4962 With arg, turn line truncation on iff arg is positive."
4964 (setq truncate-lines
4965 (if (null arg) (not truncate-lines)
4966 (> (prefix-numeric-value arg) 0)))
4969 (defun gnus-summary-reselect-current-group (&optional all rescan)
4970 "Exit and then reselect the current newsgroup.
4971 The prefix argument ALL means to select all articles."
4973 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4974 (error "Ephemeral groups can't be reselected"))
4975 (let ((current-subject (gnus-summary-article-number))
4976 (group gnus-newsgroup-name))
4977 (setq gnus-newsgroup-begin nil)
4979 ;; We have to adjust the point of group mode buffer because
4980 ;; point was moved to the next unread newsgroup by exiting.
4981 (gnus-summary-jump-to-group group)
4984 (gnus-group-get-new-news-this-group 1)))
4985 (gnus-group-read-group all t)
4986 (gnus-summary-goto-subject current-subject nil t)))
4988 (defun gnus-summary-rescan-group (&optional all)
4989 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4991 (gnus-summary-reselect-current-group all t))
4993 (defun gnus-summary-update-info (&optional non-destructive)
4995 (let ((group gnus-newsgroup-name))
4997 (when gnus-newsgroup-kill-headers
4998 (setq gnus-newsgroup-killed
4999 (gnus-compress-sequence
5001 (gnus-set-sorted-intersection
5002 (gnus-uncompress-range gnus-newsgroup-killed)
5003 (setq gnus-newsgroup-unselected
5004 (sort gnus-newsgroup-unselected '<)))
5005 (setq gnus-newsgroup-unreads
5006 (sort gnus-newsgroup-unreads '<)))
5008 (unless (listp (cdr gnus-newsgroup-killed))
5009 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5010 (let ((headers gnus-newsgroup-headers))
5011 (when (and (not gnus-save-score)
5012 (not non-destructive))
5013 (setq gnus-newsgroup-scored nil))
5014 ;; Set the new ranges of read articles.
5016 (set-buffer gnus-group-buffer)
5017 (gnus-undo-force-boundary))
5018 (gnus-update-read-articles
5019 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5020 ;; Set the current article marks.
5022 ;; Do the cross-ref thing.
5023 (when gnus-use-cross-reference
5024 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5025 ;; Do not switch windows but change the buffer to work.
5026 (set-buffer gnus-group-buffer)
5027 (unless (gnus-ephemeral-group-p group)
5028 (gnus-group-update-group group)))))))
5030 (defun gnus-summary-save-newsrc (&optional force)
5031 "Save the current number of read/marked articles in the dribble buffer.
5032 The dribble buffer will then be saved.
5033 If FORCE (the prefix), also save the .newsrc file(s)."
5035 (gnus-summary-update-info t)
5037 (gnus-save-newsrc-file)
5038 (gnus-dribble-save)))
5040 (defun gnus-summary-exit (&optional temporary)
5041 "Exit reading current newsgroup, and then return to group selection mode.
5042 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5044 (gnus-kill-save-kill-buffer)
5045 (let* ((group gnus-newsgroup-name)
5046 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5049 (buf (current-buffer)))
5050 (run-hooks 'gnus-summary-prepare-exit-hook)
5051 ;; If we have several article buffers, we kill them at exit.
5052 (unless gnus-single-article-buffer
5053 (gnus-kill-buffer gnus-original-article-buffer)
5054 (setq gnus-article-current nil))
5055 (when gnus-use-cache
5056 (gnus-cache-possibly-remove-articles)
5057 (gnus-cache-save-buffers))
5058 (gnus-async-prefetch-remove-group group)
5059 (when gnus-suppress-duplicates
5060 (gnus-dup-enter-articles))
5061 (when gnus-use-trees
5062 (gnus-tree-close group))
5063 ;; Make all changes in this group permanent.
5065 (run-hooks 'gnus-exit-group-hook)
5066 (gnus-summary-update-info)
5067 ;; Do adaptive scoring, and possibly save score files.
5068 (when gnus-newsgroup-adaptive
5069 (gnus-score-adaptive))
5070 (when gnus-use-scoring
5072 (gnus-close-group group)
5073 ;; Make sure where we were, and go to next newsgroup.
5074 (set-buffer gnus-group-buffer)
5076 (gnus-group-jump-to-group group))
5077 (run-hooks 'gnus-summary-exit-hook)
5078 (unless (or quit-config
5079 ;; If this group has disappeared from the summary
5080 ;; buffer, don't skip forwards.
5081 (not (string= group (gnus-group-group-name))))
5082 (gnus-group-next-unread-group 1))
5083 (setq group-point (point))
5086 ;; If we have several article buffers, we kill them at exit.
5087 (unless gnus-single-article-buffer
5088 (gnus-kill-buffer gnus-article-buffer)
5089 (gnus-kill-buffer gnus-original-article-buffer)
5090 (setq gnus-article-current nil))
5092 (if (not gnus-kill-summary-on-exit)
5093 (gnus-deaden-summary)
5094 ;; We set all buffer-local variables to nil. It is unclear why
5095 ;; this is needed, but if we don't, buffer-local variables are
5096 ;; not garbage-collected, it seems. This would the lead to en
5097 ;; ever-growing Emacs.
5098 (gnus-summary-clear-local-variables)
5099 (when (get-buffer gnus-article-buffer)
5100 (bury-buffer gnus-article-buffer))
5101 ;; We clear the global counterparts of the buffer-local
5102 ;; variables as well, just to be on the safe side.
5103 (set-buffer gnus-group-buffer)
5104 (gnus-summary-clear-local-variables)
5105 ;; Return to group mode buffer.
5106 (when (eq mode 'gnus-summary-mode)
5107 (gnus-kill-buffer buf)))
5108 (setq gnus-current-select-method gnus-select-method)
5109 (pop-to-buffer gnus-group-buffer)
5110 ;; Clear the current group name.
5111 (if (not quit-config)
5113 (goto-char group-point)
5114 (gnus-configure-windows 'group 'force))
5115 (gnus-handle-ephemeral-exit quit-config))
5117 (setq gnus-newsgroup-name nil)))))
5119 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5120 (defun gnus-summary-exit-no-update (&optional no-questions)
5121 "Quit reading current newsgroup without updating read article info."
5123 (let* ((group gnus-newsgroup-name)
5124 (quit-config (gnus-group-quit-config group)))
5125 (when (or no-questions
5127 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5128 ;; If we have several article buffers, we kill them at exit.
5129 (unless gnus-single-article-buffer
5130 (gnus-kill-buffer gnus-article-buffer)
5131 (gnus-kill-buffer gnus-original-article-buffer)
5132 (setq gnus-article-current nil))
5133 (if (not gnus-kill-summary-on-exit)
5134 (gnus-deaden-summary)
5135 (gnus-close-group group)
5136 (gnus-summary-clear-local-variables)
5137 (set-buffer gnus-group-buffer)
5138 (gnus-summary-clear-local-variables)
5139 (when (get-buffer gnus-summary-buffer)
5140 (kill-buffer gnus-summary-buffer)))
5141 (unless gnus-single-article-buffer
5142 (setq gnus-article-current nil))
5143 (when gnus-use-trees
5144 (gnus-tree-close group))
5145 (gnus-async-prefetch-remove-group group)
5146 (when (get-buffer gnus-article-buffer)
5147 (bury-buffer gnus-article-buffer))
5148 ;; Return to the group buffer.
5149 (gnus-configure-windows 'group 'force)
5150 ;; Clear the current group name.
5151 (setq gnus-newsgroup-name nil)
5152 (when (equal (gnus-group-group-name) group)
5153 (gnus-group-next-unread-group 1))
5155 (gnus-handle-ephemeral-exit quit-config)))))
5157 (defun gnus-handle-ephemeral-exit (quit-config)
5158 "Handle movement when leaving an ephemeral group. The state
5159 which existed when entering the ephemeral is reset."
5160 (if (not (buffer-name (car quit-config)))
5161 (gnus-configure-windows 'group 'force)
5162 (set-buffer (car quit-config))
5163 (cond ((eq major-mode 'gnus-summary-mode)
5164 (gnus-set-global-variables))
5165 ((eq major-mode 'gnus-article-mode)
5167 ;; The `gnus-summary-buffer' variable may point
5168 ;; to the old summary buffer when using a single
5170 (unless (gnus-buffer-live-p gnus-summary-buffer)
5171 (set-buffer gnus-group-buffer))
5172 (set-buffer gnus-summary-buffer)
5173 (gnus-set-global-variables))))
5174 (if (or (eq (cdr quit-config) 'article)
5175 (eq (cdr quit-config) 'pick))
5177 ;; The current article may be from the ephemeral group
5178 ;; thus it is best that we reload this article
5179 (gnus-summary-show-article)
5180 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5181 (gnus-configure-windows 'pick 'force)
5182 (gnus-configure-windows (cdr quit-config) 'force)))
5183 (gnus-configure-windows (cdr quit-config) 'force))
5184 (when (eq major-mode 'gnus-summary-mode)
5185 (gnus-summary-next-subject 1 nil t)
5186 (gnus-summary-recenter)
5187 (gnus-summary-position-point))))
5189 (defun gnus-summary-preview-mime-message (arg)
5190 "MIME decode and play this message."
5192 (let ((gnus-break-pages nil))
5193 (gnus-summary-select-article t t)
5195 (pop-to-buffer gnus-original-article-buffer t)
5196 (let (buffer-read-only)
5197 (if (text-property-any (point-min) (point-max) 'invisible t)
5198 (remove-text-properties (point-min) (point-max)
5199 gnus-hidden-properties)
5201 (mime-view-mode nil nil nil gnus-original-article-buffer
5202 gnus-article-buffer)
5205 (defun gnus-summary-scroll-down ()
5206 "Scroll down one line current article."
5208 (gnus-summary-scroll-up -1)
5213 (defvar gnus-dead-summary-mode-map nil)
5215 (unless gnus-dead-summary-mode-map
5216 (setq gnus-dead-summary-mode-map (make-keymap))
5217 (suppress-keymap gnus-dead-summary-mode-map)
5218 (substitute-key-definition
5219 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5220 (let ((keys '("\C-d" "\r" "\177" [delete])))
5222 (define-key gnus-dead-summary-mode-map
5223 (pop keys) 'gnus-summary-wake-up-the-dead))))
5225 (defvar gnus-dead-summary-mode nil
5226 "Minor mode for Gnus summary buffers.")
5228 (defun gnus-dead-summary-mode (&optional arg)
5229 "Minor mode for Gnus summary buffers."
5231 (when (eq major-mode 'gnus-summary-mode)
5232 (make-local-variable 'gnus-dead-summary-mode)
5233 (setq gnus-dead-summary-mode
5234 (if (null arg) (not gnus-dead-summary-mode)
5235 (> (prefix-numeric-value arg) 0)))
5236 (when gnus-dead-summary-mode
5237 (gnus-add-minor-mode
5238 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5240 (defun gnus-deaden-summary ()
5241 "Make the current summary buffer into a dead summary buffer."
5242 ;; Kill any previous dead summary buffer.
5243 (when (and gnus-dead-summary
5244 (buffer-name gnus-dead-summary))
5246 (set-buffer gnus-dead-summary)
5247 (when gnus-dead-summary-mode
5248 (kill-buffer (current-buffer)))))
5249 ;; Make this the current dead summary.
5250 (setq gnus-dead-summary (current-buffer))
5251 (gnus-dead-summary-mode 1)
5252 (let ((name (buffer-name)))
5253 (when (string-match "Summary" name)
5255 (concat (substring name 0 (match-beginning 0)) "Dead "
5256 (substring name (match-beginning 0)))
5259 (defun gnus-kill-or-deaden-summary (buffer)
5260 "Kill or deaden the summary BUFFER."
5261 (when (and (buffer-name buffer)
5262 (not gnus-single-article-buffer))
5265 (gnus-kill-buffer gnus-article-buffer)
5266 (gnus-kill-buffer gnus-original-article-buffer)))
5267 (cond (gnus-kill-summary-on-exit
5268 (when (and gnus-use-trees
5269 (and (get-buffer buffer)
5270 (buffer-name (get-buffer buffer))))
5272 (set-buffer (get-buffer buffer))
5273 (gnus-tree-close gnus-newsgroup-name)))
5274 (gnus-kill-buffer buffer))
5275 ((and (get-buffer buffer)
5276 (buffer-name (get-buffer buffer)))
5279 (gnus-deaden-summary)))))
5281 (defun gnus-summary-wake-up-the-dead (&rest args)
5282 "Wake up the dead summary buffer."
5284 (gnus-dead-summary-mode -1)
5285 (let ((name (buffer-name)))
5286 (when (string-match "Dead " name)
5288 (concat (substring name 0 (match-beginning 0))
5289 (substring name (match-end 0)))
5291 (gnus-message 3 "This dead summary is now alive again"))
5293 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5294 (defun gnus-summary-fetch-faq (&optional faq-dir)
5295 "Fetch the FAQ for the current group.
5296 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5300 (when current-prefix-arg
5302 "Faq dir: " (and (listp gnus-group-faq-directory)
5303 (mapcar (lambda (file) (list file))
5304 gnus-group-faq-directory))))))
5305 (let (gnus-faq-buffer)
5306 (when (setq gnus-faq-buffer
5307 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5308 (gnus-configure-windows 'summary-faq))))
5310 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5311 (defun gnus-summary-describe-group (&optional force)
5312 "Describe the current newsgroup."
5314 (gnus-group-describe-group force gnus-newsgroup-name))
5316 (defun gnus-summary-describe-briefly ()
5317 "Describe summary mode commands briefly."
5320 (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")))
5322 ;; Walking around group mode buffer from summary mode.
5324 (defun gnus-summary-next-group (&optional no-article target-group backward)
5325 "Exit current newsgroup and then select next unread newsgroup.
5326 If prefix argument NO-ARTICLE is non-nil, no article is selected
5327 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5328 previous group instead."
5330 ;; Stop pre-fetching.
5331 (gnus-async-halt-prefetch)
5332 (let ((current-group gnus-newsgroup-name)
5333 (current-buffer (current-buffer))
5335 ;; First we semi-exit this group to update Xrefs and all variables.
5336 ;; We can't do a real exit, because the window conf must remain
5337 ;; the same in case the user is prompted for info, and we don't
5338 ;; want the window conf to change before that...
5339 (gnus-summary-exit t)
5340 (while (not entered)
5341 ;; Then we find what group we are supposed to enter.
5342 (set-buffer gnus-group-buffer)
5343 (gnus-group-jump-to-group current-group)
5346 (if (eq gnus-keep-same-level 'best)
5347 (gnus-summary-best-group gnus-newsgroup-name)
5348 (gnus-summary-search-group backward gnus-keep-same-level))))
5349 (if (not target-group)
5350 ;; There are no further groups, so we return to the group
5353 (gnus-message 5 "Returning to the group buffer")
5355 (when (gnus-buffer-live-p current-buffer)
5356 (set-buffer current-buffer)
5357 (gnus-summary-exit))
5358 (run-hooks 'gnus-group-no-more-groups-hook))
5359 ;; We try to enter the target group.
5360 (gnus-group-jump-to-group target-group)
5361 (let ((unreads (gnus-group-group-unread)))
5362 (if (and (or (eq t unreads)
5363 (and unreads (not (zerop unreads))))
5364 (gnus-summary-read-group
5365 target-group nil no-article
5366 (and (buffer-name current-buffer) current-buffer)))
5368 (setq current-group target-group
5369 target-group nil)))))))
5371 (defun gnus-summary-prev-group (&optional no-article)
5372 "Exit current newsgroup and then select previous unread newsgroup.
5373 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5375 (gnus-summary-next-group no-article nil t))
5377 ;; Walking around summary lines.
5379 (defun gnus-summary-first-subject (&optional unread)
5380 "Go to the first unread subject.
5381 If UNREAD is non-nil, go to the first unread article.
5382 Returns the article selected or nil if there are no unread articles."
5387 ((null gnus-newsgroup-data)
5388 (gnus-message 3 "No articles in the group")
5390 ;; Pick the first article.
5392 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5393 (gnus-data-number (car gnus-newsgroup-data)))
5394 ;; No unread articles.
5395 ((null gnus-newsgroup-unreads)
5396 (gnus-message 3 "No more unread articles")
5398 ;; Find the first unread article.
5400 (let ((data gnus-newsgroup-data))
5402 (not (gnus-data-unread-p (car data))))
5403 (setq data (cdr data)))
5405 (goto-char (gnus-data-pos (car data)))
5406 (gnus-data-number (car data))))))
5407 (gnus-summary-position-point)))
5409 (defun gnus-summary-next-subject (n &optional unread dont-display)
5410 "Go to next N'th summary line.
5411 If N is negative, go to the previous N'th subject line.
5412 If UNREAD is non-nil, only unread articles are selected.
5413 The difference between N and the actual number of steps taken is
5416 (let ((backward (< n 0))
5420 (gnus-summary-find-prev unread)
5421 (gnus-summary-find-next unread)))
5424 (gnus-message 7 "No more%s articles"
5425 (if unread " unread" "")))
5426 (unless dont-display
5427 (gnus-summary-recenter)
5428 (gnus-summary-position-point))
5431 (defun gnus-summary-next-unread-subject (n)
5432 "Go to next N'th unread summary line."
5434 (gnus-summary-next-subject n t))
5436 (defun gnus-summary-prev-subject (n &optional unread)
5437 "Go to previous N'th summary line.
5438 If optional argument UNREAD is non-nil, only unread article is selected."
5440 (gnus-summary-next-subject (- n) unread))
5442 (defun gnus-summary-prev-unread-subject (n)
5443 "Go to previous N'th unread summary line."
5445 (gnus-summary-next-subject (- n) t))
5447 (defun gnus-summary-goto-subject (article &optional force silent)
5448 "Go the subject line of ARTICLE.
5449 If FORCE, also allow jumping to articles not currently shown."
5450 (interactive "nArticle number: ")
5452 (data (gnus-data-find article)))
5453 ;; We read in the article if we have to.
5456 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5457 (setq data (gnus-data-find article)))
5462 (gnus-message 3 "Can't find article %d" article))
5464 (goto-char (gnus-data-pos data))
5467 ;; Walking around summary lines with displaying articles.
5469 (defun gnus-summary-expand-window (&optional arg)
5470 "Make the summary buffer take up the entire Emacs frame.
5471 Given a prefix, will force an `article' buffer configuration."
5474 (gnus-configure-windows 'article 'force)
5475 (gnus-configure-windows 'summary 'force)))
5477 (defun gnus-summary-display-article (article &optional all-header)
5478 "Display ARTICLE in article buffer."
5479 (gnus-set-global-variables)
5483 (if gnus-summary-display-article-function
5484 (funcall gnus-summary-display-article-function article all-header)
5485 (gnus-article-prepare article all-header))
5486 (run-hooks 'gnus-select-article-hook)
5487 (when (and gnus-current-article
5488 (not (zerop gnus-current-article)))
5489 (gnus-summary-goto-subject gnus-current-article))
5490 (gnus-summary-recenter)
5491 (when (and gnus-use-trees gnus-show-threads)
5492 (gnus-possibly-generate-tree article)
5493 (gnus-highlight-selected-tree article))
5494 ;; Successfully display article.
5495 (gnus-article-set-window-start
5496 (cdr (assq article gnus-newsgroup-bookmarks))))))
5498 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5499 "Select the current article.
5500 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5501 non-nil, the article will be re-fetched even if it already present in
5502 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5504 ;; Make sure we are in the summary buffer to work around bbdb bug.
5505 (unless (eq major-mode 'gnus-summary-mode)
5506 (set-buffer gnus-summary-buffer))
5507 (let ((article (or article (gnus-summary-article-number)))
5508 (all-headers (not (not all-headers))) ;Must be T or NIL.
5509 gnus-summary-display-article-function
5512 (gnus-summary-article-pseudo-p article)
5513 (error "This is a pseudo-article"))
5516 (set-buffer gnus-summary-buffer)
5517 (if (or (and gnus-single-article-buffer
5518 (or (null gnus-current-article)
5519 (null gnus-article-current)
5520 (null (get-buffer gnus-article-buffer))
5521 (not (eq article (cdr gnus-article-current)))
5522 (not (equal (car gnus-article-current)
5523 gnus-newsgroup-name))))
5524 (and (not gnus-single-article-buffer)
5525 (or (null gnus-current-article)
5526 (not (eq gnus-current-article article))))
5528 ;; The requested article is different from the current article.
5530 (gnus-summary-display-article article all-headers)
5532 (when (or all-headers gnus-show-all-headers)
5533 (gnus-article-show-all-headers))
5536 (gnus-article-set-window-start
5537 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5539 (defun gnus-summary-set-current-mark (&optional current-mark)
5540 "Obsolete function."
5543 (defun gnus-summary-next-article (&optional unread subject backward push)
5544 "Select the next article.
5545 If UNREAD, only unread articles are selected.
5546 If SUBJECT, only articles with SUBJECT are selected.
5547 If BACKWARD, the previous article is selected instead of the next."
5550 ;; Is there such an article?
5551 ((and (gnus-summary-search-forward unread subject backward)
5552 (or (gnus-summary-display-article (gnus-summary-article-number))
5553 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5554 (gnus-summary-position-point))
5555 ;; If not, we try the first unread, if that is wanted.
5557 gnus-auto-select-same
5558 (gnus-summary-first-unread-article))
5559 (gnus-summary-position-point)
5560 (gnus-message 6 "Wrapped"))
5561 ;; Try to get next/previous article not displayed in this group.
5562 ((and gnus-auto-extend-newsgroup
5563 (not unread) (not subject))
5564 (gnus-summary-goto-article
5565 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5567 ;; Go to next/previous group.
5569 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5570 (gnus-summary-jump-to-group gnus-newsgroup-name))
5571 (let ((cmd last-command-char)
5574 (set-buffer gnus-group-buffer)
5577 (if (eq gnus-keep-same-level 'best)
5578 (gnus-summary-best-group gnus-newsgroup-name)
5579 (gnus-summary-search-group backward gnus-keep-same-level))))
5580 ;; For some reason, the group window gets selected. We change
5582 (select-window (get-buffer-window (current-buffer)))
5583 ;; Select next unread newsgroup automagically.
5585 ((or (not gnus-auto-select-next)
5587 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5588 ((or (eq gnus-auto-select-next 'quietly)
5589 (and (eq gnus-auto-select-next 'slightly-quietly)
5591 (and (eq gnus-auto-select-next 'almost-quietly)
5592 (gnus-summary-last-article-p)))
5594 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5596 (gnus-message 7 "No more%s articles (%s)..."
5597 (if unread " unread" "")
5598 (if group (concat "selecting " group)
5600 (gnus-summary-next-group nil group backward)))
5602 (when (gnus-key-press-event-p last-input-event)
5603 (gnus-summary-walk-group-buffer
5604 gnus-newsgroup-name cmd unread backward point))))))))
5606 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5607 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5608 (?\C-p (gnus-group-prev-unread-group 1))))
5609 (cursor-in-echo-area t)
5610 keve key group ended)
5612 (set-buffer gnus-group-buffer)
5615 (if (eq gnus-keep-same-level 'best)
5616 (gnus-summary-best-group gnus-newsgroup-name)
5617 (gnus-summary-search-group backward gnus-keep-same-level))))
5620 5 "No more%s articles%s" (if unread " unread" "")
5622 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5623 (format " (Type %s for %s [%s])"
5624 (single-key-description cmd) group
5625 (car (gnus-gethash group gnus-newsrc-hashtb)))
5626 (format " (Type %s to exit %s)"
5627 (single-key-description cmd)
5628 gnus-newsgroup-name)))
5629 ;; Confirm auto selection.
5630 (setq key (car (setq keve (gnus-read-event-char))))
5633 ((assq key keystrokes)
5634 (let ((obuf (current-buffer)))
5635 (switch-to-buffer gnus-group-buffer)
5637 (gnus-group-jump-to-group group))
5638 (eval (cadr (assq key keystrokes)))
5639 (setq group (gnus-group-group-name))
5640 (switch-to-buffer obuf))
5644 (gnus-ephemeral-group-p gnus-newsgroup-name))
5646 (gnus-summary-next-group nil group backward)))
5648 (push (cdr keve) unread-command-events))))))
5650 (defun gnus-summary-next-unread-article ()
5651 "Select unread article after current one."
5653 (gnus-summary-next-article
5654 (or (not (eq gnus-summary-goto-unread 'never))
5655 (gnus-summary-last-article-p (gnus-summary-article-number)))
5656 (and gnus-auto-select-same
5657 (gnus-summary-article-subject))))
5659 (defun gnus-summary-prev-article (&optional unread subject)
5660 "Select the article after the current one.
5661 If UNREAD is non-nil, only unread articles are selected."
5663 (gnus-summary-next-article unread subject t))
5665 (defun gnus-summary-prev-unread-article ()
5666 "Select unread article before current one."
5668 (gnus-summary-prev-article
5669 (or (not (eq gnus-summary-goto-unread 'never))
5670 (gnus-summary-first-article-p (gnus-summary-article-number)))
5671 (and gnus-auto-select-same
5672 (gnus-summary-article-subject))))
5674 (defun gnus-summary-next-page (&optional lines circular)
5675 "Show next page of the selected article.
5676 If at the end of the current article, select the next article.
5677 LINES says how many lines should be scrolled up.
5679 If CIRCULAR is non-nil, go to the start of the article instead of
5680 selecting the next article when reaching the end of the current
5683 (setq gnus-summary-buffer (current-buffer))
5684 (gnus-set-global-variables)
5685 (let ((article (gnus-summary-article-number))
5686 (article-window (get-buffer-window gnus-article-buffer t))
5688 (gnus-configure-windows 'article)
5689 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5690 (if (and (eq gnus-summary-goto-unread 'never)
5691 (not (gnus-summary-last-article-p article)))
5692 (gnus-summary-next-article)
5693 (gnus-summary-next-unread-article))
5694 (if (or (null gnus-current-article)
5695 (null gnus-article-current)
5696 (/= article (cdr gnus-article-current))
5697 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5698 ;; Selected subject is different from current article's.
5699 (gnus-summary-display-article article)
5700 (when article-window
5701 (gnus-eval-in-buffer-window gnus-article-buffer
5702 (setq endp (gnus-article-next-page lines)))
5705 (gnus-summary-beginning-of-article))
5707 (gnus-message 3 "End of message"))
5709 (if (and (eq gnus-summary-goto-unread 'never)
5710 (not (gnus-summary-last-article-p article)))
5711 (gnus-summary-next-article)
5712 (gnus-summary-next-unread-article))))))))
5713 (gnus-summary-recenter)
5714 (gnus-summary-position-point)))
5716 (defun gnus-summary-prev-page (&optional lines move)
5717 "Show previous page of selected article.
5718 Argument LINES specifies lines to be scrolled down.
5719 If MOVE, move to the previous unread article if point is at
5720 the beginning of the buffer."
5722 (let ((article (gnus-summary-article-number))
5723 (article-window (get-buffer-window gnus-article-buffer t))
5725 (gnus-configure-windows 'article)
5726 (if (or (null gnus-current-article)
5727 (null gnus-article-current)
5728 (/= article (cdr gnus-article-current))
5729 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5730 ;; Selected subject is different from current article's.
5731 (gnus-summary-display-article article)
5732 (gnus-summary-recenter)
5733 (when article-window
5734 (gnus-eval-in-buffer-window gnus-article-buffer
5735 (setq endp (gnus-article-prev-page lines)))
5736 (when (and move endp)
5738 (gnus-message 3 "Beginning of message"))
5740 (if (and (eq gnus-summary-goto-unread 'never)
5741 (not (gnus-summary-first-article-p article)))
5742 (gnus-summary-prev-article)
5743 (gnus-summary-prev-unread-article))))))))
5744 (gnus-summary-position-point))
5746 (defun gnus-summary-prev-page-or-article (&optional lines)
5747 "Show previous page of selected article.
5748 Argument LINES specifies lines to be scrolled down.
5749 If at the beginning of the article, go to the next article."
5751 (gnus-summary-prev-page lines t))
5753 (defun gnus-summary-scroll-up (lines)
5754 "Scroll up (or down) one line current article.
5755 Argument LINES specifies lines to be scrolled up (or down if negative)."
5757 (gnus-configure-windows 'article)
5758 (gnus-summary-show-thread)
5759 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5760 (gnus-eval-in-buffer-window gnus-article-buffer
5762 (when (gnus-article-next-page lines)
5763 (gnus-message 3 "End of message")))
5765 (gnus-article-prev-page (- lines))))))
5766 (gnus-summary-recenter)
5767 (gnus-summary-position-point))
5769 (defun gnus-summary-next-same-subject ()
5770 "Select next article which has the same subject as current one."
5772 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5774 (defun gnus-summary-prev-same-subject ()
5775 "Select previous article which has the same subject as current one."
5777 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5779 (defun gnus-summary-next-unread-same-subject ()
5780 "Select next unread article which has the same subject as current one."
5782 (gnus-summary-next-article t (gnus-summary-article-subject)))
5784 (defun gnus-summary-prev-unread-same-subject ()
5785 "Select previous unread article which has the same subject as current one."
5787 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5789 (defun gnus-summary-first-unread-article ()
5790 "Select the first unread article.
5791 Return nil if there are no unread articles."
5794 (when (gnus-summary-first-subject t)
5795 (gnus-summary-show-thread)
5796 (gnus-summary-first-subject t)
5797 (gnus-summary-display-article (gnus-summary-article-number)))
5798 (gnus-summary-position-point)))
5800 (defun gnus-summary-first-article ()
5801 "Select the first article.
5802 Return nil if there are no articles."
5805 (when (gnus-summary-first-subject)
5806 (gnus-summary-show-thread)
5807 (gnus-summary-first-subject)
5808 (gnus-summary-display-article (gnus-summary-article-number)))
5809 (gnus-summary-position-point)))
5811 (defun gnus-summary-best-unread-article ()
5812 "Select the unread article with the highest score."
5814 (let ((best -1000000)
5815 (data gnus-newsgroup-data)
5818 (and (gnus-data-unread-p (car data))
5820 (gnus-summary-article-score (gnus-data-number (car data))))
5823 article (gnus-data-number (car data))))
5824 (setq data (cdr data)))
5827 (gnus-summary-goto-article article)
5828 (error "No unread articles"))
5829 (gnus-summary-position-point))))
5831 (defun gnus-summary-last-subject ()
5832 "Go to the last displayed subject line in the group."
5833 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5835 (gnus-summary-goto-subject article))))
5837 (defun gnus-summary-goto-article (article &optional all-headers force)
5838 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5839 If ALL-HEADERS is non-nil, no header lines are hidden."
5843 "Article number or Message-ID: "
5844 (mapcar (lambda (number) (list (int-to-string number)))
5845 gnus-newsgroup-limit))
5849 (if (and (stringp article)
5850 (string-match "@" article))
5851 (gnus-summary-refer-article article)
5852 (when (stringp article)
5853 (setq article (string-to-number article)))
5854 (if (gnus-summary-goto-subject article force)
5855 (gnus-summary-display-article article all-headers)
5856 (gnus-message 4 "Couldn't go to article %s" article) nil))
5857 (gnus-summary-position-point)))
5859 (defun gnus-summary-goto-last-article ()
5860 "Go to the previously read article."
5863 (when gnus-last-article
5864 (gnus-summary-goto-article gnus-last-article))
5865 (gnus-summary-position-point)))
5867 (defun gnus-summary-pop-article (number)
5868 "Pop one article off the history and go to the previous.
5869 NUMBER articles will be popped off."
5872 (setq gnus-newsgroup-history
5873 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5875 (gnus-summary-goto-article (car to) nil t)
5876 (error "Article history empty")))
5877 (gnus-summary-position-point))
5879 ;; Summary commands and functions for limiting the summary buffer.
5881 (defun gnus-summary-limit-to-articles (n)
5882 "Limit the summary buffer to the next N articles.
5883 If not given a prefix, use the process marked articles instead."
5886 (let ((articles (gnus-summary-work-articles n)))
5887 (setq gnus-newsgroup-processable nil)
5888 (gnus-summary-limit articles))
5889 (gnus-summary-position-point)))
5891 (defun gnus-summary-pop-limit (&optional total)
5892 "Restore the previous limit.
5893 If given a prefix, remove all limits."
5896 (setq gnus-newsgroup-limits
5897 (list (mapcar (lambda (h) (mail-header-number h))
5898 gnus-newsgroup-headers))))
5899 (unless gnus-newsgroup-limits
5900 (error "No limit to pop"))
5902 (gnus-summary-limit nil 'pop)
5903 (gnus-summary-position-point)))
5905 (defun gnus-summary-limit-to-subject (subject &optional header)
5906 "Limit the summary buffer to articles that have subjects that match a regexp."
5907 (interactive "sLimit to subject (regexp): ")
5909 (setq header "subject"))
5910 (when (not (equal "" subject))
5912 (let ((articles (gnus-summary-find-matching
5913 (or header "subject") subject 'all)))
5915 (error "Found no matches for \"%s\"" subject))
5916 (gnus-summary-limit articles))
5917 (gnus-summary-position-point))))
5919 (defun gnus-summary-limit-to-author (from)
5920 "Limit the summary buffer to articles that have authors that match a regexp."
5921 (interactive "sLimit to author (regexp): ")
5922 (gnus-summary-limit-to-subject from "from"))
5924 (defun gnus-summary-limit-to-age (age &optional younger-p)
5925 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5926 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5927 articles that are younger than AGE days."
5928 (interactive "nTime in days: \nP")
5930 (let ((data gnus-newsgroup-data)
5931 (cutoff (nnmail-days-to-time age))
5932 articles d date is-younger)
5933 (while (setq d (pop data))
5934 (when (and (vectorp (gnus-data-header d))
5935 (setq date (mail-header-date (gnus-data-header d))))
5936 (setq is-younger (nnmail-time-less
5937 (nnmail-time-since (nnmail-date-to-time date))
5939 (when (if younger-p is-younger (not is-younger))
5940 (push (gnus-data-number d) articles))))
5941 (gnus-summary-limit (nreverse articles)))
5942 (gnus-summary-position-point)))
5944 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5946 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5948 (defun gnus-summary-limit-to-unread (&optional all)
5949 "Limit the summary buffer to articles that are not marked as read.
5950 If ALL is non-nil, limit strictly to unread articles."
5953 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5954 (gnus-summary-limit-to-marks
5955 ;; Concat all the marks that say that an article is read and have
5957 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5958 gnus-killed-mark gnus-kill-file-mark
5959 gnus-low-score-mark gnus-expirable-mark
5960 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5961 gnus-duplicate-mark gnus-souped-mark)
5964 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5965 (make-obsolete 'gnus-summary-delete-marked-with
5966 'gnus-summary-limit-exlude-marks)
5968 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5969 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5970 If REVERSE, limit the summary buffer to articles that are marked
5971 with MARKS. MARKS can either be a string of marks or a list of marks.
5972 Returns how many articles were removed."
5973 (interactive "sMarks: ")
5974 (gnus-summary-limit-to-marks marks t))
5976 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5977 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5978 If REVERSE (the prefix), limit the summary buffer to articles that are
5979 not marked with MARKS. MARKS can either be a string of marks or a
5981 Returns how many articles were removed."
5982 (interactive "sMarks: \nP")
5984 (let ((data gnus-newsgroup-data)
5985 (marks (if (listp marks) marks
5986 (append marks nil))) ; Transform to list.
5989 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5990 (memq (gnus-data-mark (car data)) marks))
5991 (push (gnus-data-number (car data)) articles))
5992 (setq data (cdr data)))
5993 (gnus-summary-limit articles))
5994 (gnus-summary-position-point)))
5996 (defun gnus-summary-limit-to-score (&optional score)
5997 "Limit to articles with score at or above SCORE."
5999 (setq score (if score
6000 (prefix-numeric-value score)
6001 (or gnus-summary-default-score 0)))
6002 (let ((data gnus-newsgroup-data)
6005 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6007 (push (gnus-data-number (car data)) articles))
6008 (setq data (cdr data)))
6010 (gnus-summary-limit articles)
6011 (gnus-summary-position-point))))
6013 (defun gnus-summary-limit-include-thread (id)
6014 "Display all the hidden articles that in the current thread."
6015 (interactive (list (mail-header-id (gnus-summary-article-header))))
6016 (let ((articles (gnus-articles-in-thread
6017 (gnus-id-to-thread (gnus-root-id id)))))
6019 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6020 (gnus-summary-position-point))))
6022 (defun gnus-summary-limit-include-dormant ()
6023 "Display all the hidden articles that are marked as dormant.
6024 Note that this command only works on a subset of the articles currently
6025 fetched for this group."
6027 (unless gnus-newsgroup-dormant
6028 (error "There are no dormant articles in this group"))
6030 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6031 (gnus-summary-position-point)))
6033 (defun gnus-summary-limit-exclude-dormant ()
6034 "Hide all dormant articles."
6037 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6038 (gnus-summary-position-point)))
6040 (defun gnus-summary-limit-exclude-childless-dormant ()
6041 "Hide all dormant articles that have no children."
6043 (let ((data (gnus-data-list t))
6044 articles d children)
6045 ;; Find all articles that are either not dormant or have
6047 (while (setq d (pop data))
6048 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6050 (gnus-article-children (gnus-data-number d)))
6053 (when (memq (car children) articles)
6058 (push (gnus-data-number d) articles)))
6061 (gnus-summary-limit articles)
6062 (gnus-summary-position-point))))
6064 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6065 "Mark all unread excluded articles as read.
6066 If ALL, mark even excluded ticked and dormants as read."
6068 (let ((articles (gnus-sorted-complement
6070 (mapcar (lambda (h) (mail-header-number h))
6071 gnus-newsgroup-headers)
6073 (sort gnus-newsgroup-limit '<)))
6075 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
6077 (setq gnus-newsgroup-dormant nil
6078 gnus-newsgroup-marked nil
6079 gnus-newsgroup-reads
6081 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6082 gnus-newsgroup-reads))
6083 (while (setq article (pop articles))
6084 (unless (or (memq article gnus-newsgroup-dormant)
6085 (memq article gnus-newsgroup-marked))
6086 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6088 (defun gnus-summary-limit (articles &optional pop)
6090 ;; We pop the previous limit off the stack and use that.
6091 (setq articles (car gnus-newsgroup-limits)
6092 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6093 ;; We use the new limit, so we push the old limit on the stack.
6094 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6096 (setq gnus-newsgroup-limit articles)
6097 (let ((total (length gnus-newsgroup-data))
6098 (data (gnus-data-find-list (gnus-summary-article-number)))
6099 (gnus-summary-mark-below nil) ; Inhibit this.
6101 ;; This will do all the work of generating the new summary buffer
6102 ;; according to the new limit.
6103 (gnus-summary-prepare)
6104 ;; Hide any threads, possibly.
6105 (and gnus-show-threads
6106 gnus-thread-hide-subtree
6107 (gnus-summary-hide-all-threads))
6108 ;; Try to return to the article you were at, or one in the
6111 ;; We try to find some article after the current one.
6113 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6116 (setq data (cdr data))))
6118 ;; If there is no data, that means that we were after the last
6119 ;; article. The same goes when we can't find any articles
6120 ;; after the current one.
6121 (goto-char (point-max))
6122 (gnus-summary-find-prev))
6123 ;; We return how many articles were removed from the summary
6124 ;; buffer as a result of the new limit.
6125 (- total (length gnus-newsgroup-data))))
6127 (defsubst gnus-invisible-cut-children (threads)
6130 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6135 (defsubst gnus-cut-thread (thread)
6136 "Go forwards in the thread until we find an article that we want to display."
6137 (when (or (eq gnus-fetch-old-headers 'some)
6138 (eq gnus-fetch-old-headers 'invisible)
6139 (eq gnus-build-sparse-threads 'some)
6140 (eq gnus-build-sparse-threads 'more))
6141 ;; Deal with old-fetched headers and sparse threads.
6145 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6146 (gnus-summary-article-ancient-p
6147 (mail-header-number (car thread))))
6148 (if (or (<= (length (cdr thread)) 1)
6149 (eq gnus-fetch-old-headers 'invisible))
6150 (setq gnus-newsgroup-limit
6151 (delq (mail-header-number (car thread))
6152 gnus-newsgroup-limit)
6153 thread (cadr thread))
6154 (when (gnus-invisible-cut-children (cdr thread))
6155 (let ((th (cdr thread)))
6157 (if (memq (mail-header-number (caar th))
6158 gnus-newsgroup-limit)
6159 (setq thread (car th)
6161 (setq th (cdr th))))))))))
6164 (defun gnus-cut-threads (threads)
6165 "Cut off all uninteresting articles from the beginning of threads."
6166 (when (or (eq gnus-fetch-old-headers 'some)
6167 (eq gnus-fetch-old-headers 'invisible)
6168 (eq gnus-build-sparse-threads 'some)
6169 (eq gnus-build-sparse-threads 'more))
6172 (setcar th (gnus-cut-thread (car th)))
6173 (setq th (cdr th)))))
6174 ;; Remove nixed out threads.
6177 (defun gnus-summary-initial-limit (&optional show-if-empty)
6178 "Figure out what the initial limit is supposed to be on group entry.
6179 This entails weeding out unwanted dormants, low-scored articles,
6180 fetch-old-headers verbiage, and so on."
6181 ;; Most groups have nothing to remove.
6182 (if (or gnus-inhibit-limiting
6183 (and (null gnus-newsgroup-dormant)
6184 (not (eq gnus-fetch-old-headers 'some))
6185 (not (eq gnus-fetch-old-headers 'invisible))
6186 (null gnus-summary-expunge-below)
6187 (not (eq gnus-build-sparse-threads 'some))
6188 (not (eq gnus-build-sparse-threads 'more))
6189 (null gnus-thread-expunge-below)
6190 (not gnus-use-nocem)))
6192 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6193 (setq gnus-newsgroup-limit nil)
6196 (unless (car (symbol-value node))
6197 ;; These threads have no parents -- they are roots.
6198 (let ((nodes (cdr (symbol-value node)))
6201 (if (and gnus-thread-expunge-below
6202 (< (gnus-thread-total-score (car nodes))
6203 gnus-thread-expunge-below))
6204 (gnus-expunge-thread (pop nodes))
6205 (setq thread (pop nodes))
6206 (gnus-summary-limit-children thread))))))
6207 gnus-newsgroup-dependencies)
6208 ;; If this limitation resulted in an empty group, we might
6209 ;; pop the previous limit and use it instead.
6210 (when (and (not gnus-newsgroup-limit)
6212 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6213 gnus-newsgroup-limit))
6215 (defun gnus-summary-limit-children (thread)
6216 "Return 1 if this subthread is visible and 0 if it is not."
6217 ;; First we get the number of visible children to this thread. This
6218 ;; is done by recursing down the thread using this function, so this
6219 ;; will really go down to a leaf article first, before slowly
6220 ;; working its way up towards the root.
6224 (apply '+ (mapcar 'gnus-summary-limit-children
6227 (number (mail-header-number (car thread)))
6230 (not (memq number gnus-newsgroup-marked))
6232 ;; If this article is dormant and has absolutely no visible
6233 ;; children, then this article isn't visible.
6234 (and (memq number gnus-newsgroup-dormant)
6236 ;; If this is "fetch-old-headered" and there is no
6237 ;; visible children, then we don't want this article.
6238 (and (eq gnus-fetch-old-headers 'some)
6239 (gnus-summary-article-ancient-p number)
6241 ;; If this is "fetch-old-headered" and `invisible', then
6242 ;; we don't want this article.
6243 (and (eq gnus-fetch-old-headers 'invisible)
6244 (gnus-summary-article-ancient-p number))
6245 ;; If this is a sparsely inserted article with no children,
6246 ;; we don't want it.
6247 (and (eq gnus-build-sparse-threads 'some)
6248 (gnus-summary-article-sparse-p number)
6250 ;; If we use expunging, and this article is really
6251 ;; low-scored, then we don't want this article.
6252 (when (and gnus-summary-expunge-below
6254 (or (cdr (assq number gnus-newsgroup-scored))
6255 gnus-summary-default-score))
6256 gnus-summary-expunge-below))
6257 ;; We increase the expunge-tally here, but that has
6258 ;; nothing to do with the limits, really.
6259 (incf gnus-newsgroup-expunged-tally)
6260 ;; We also mark as read here, if that's wanted.
6261 (when (and gnus-summary-mark-below
6262 (< score gnus-summary-mark-below))
6263 (setq gnus-newsgroup-unreads
6264 (delq number gnus-newsgroup-unreads))
6265 (if gnus-newsgroup-auto-expire
6266 (push number gnus-newsgroup-expirable)
6267 (push (cons number gnus-low-score-mark)
6268 gnus-newsgroup-reads)))
6270 ;; Check NoCeM things.
6271 (if (and gnus-use-nocem
6272 (gnus-nocem-unwanted-article-p
6273 (mail-header-id (car thread))))
6275 (setq gnus-newsgroup-unreads
6276 (delq number gnus-newsgroup-unreads))
6278 ;; Nope, invisible article.
6280 ;; Ok, this article is to be visible, so we add it to the limit
6282 (push number gnus-newsgroup-limit)
6285 (defun gnus-expunge-thread (thread)
6286 "Mark all articles in THREAD as read."
6287 (let* ((number (mail-header-number (car thread))))
6288 (incf gnus-newsgroup-expunged-tally)
6289 ;; We also mark as read here, if that's wanted.
6290 (setq gnus-newsgroup-unreads
6291 (delq number gnus-newsgroup-unreads))
6292 (if gnus-newsgroup-auto-expire
6293 (push number gnus-newsgroup-expirable)
6294 (push (cons number gnus-low-score-mark)
6295 gnus-newsgroup-reads)))
6296 ;; Go recursively through all subthreads.
6297 (mapcar 'gnus-expunge-thread (cdr thread)))
6299 ;; Summary article oriented commands
6301 (defun gnus-summary-refer-parent-article (n)
6302 "Refer parent article N times.
6303 If N is negative, go to ancestor -N instead.
6304 The difference between N and the number of articles fetched is returned."
6308 (when (not (natnump n))
6313 (setq header (gnus-summary-article-header))
6314 (if (and (eq (mail-header-number header)
6315 (cdr gnus-article-current))
6316 (equal gnus-newsgroup-name
6317 (car gnus-article-current)))
6318 ;; If we try to find the parent of the currently
6319 ;; displayed article, then we take a look at the actual
6320 ;; References header, since this is slightly more
6321 ;; reliable than the References field we got from the
6324 (set-buffer gnus-original-article-buffer)
6325 (nnheader-narrow-to-headers)
6326 (unless (setq ref (message-fetch-field "references"))
6327 (setq ref (message-fetch-field "in-reply-to")))
6330 ;; It's not the current article, so we take a bet on
6331 ;; the value we got from the server.
6332 (mail-header-references header)))
6334 (not (equal ref "")))
6335 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6336 (gnus-message 1 "Couldn't find parent"))
6337 (gnus-message 1 "No references in article %d"
6338 (gnus-summary-article-number))
6341 (gnus-summary-position-point)
6344 (defun gnus-summary-refer-references ()
6345 "Fetch all articles mentioned in the References header.
6346 Return the number of articles fetched."
6348 (let ((ref (mail-header-references (gnus-summary-article-header)))
6349 (current (gnus-summary-article-number))
6353 (error "No References in the current article")
6354 ;; For each Message-ID in the References header...
6355 (while (string-match "<[^>]*>" ref)
6357 ;; ... fetch that article.
6358 (gnus-summary-refer-article
6359 (prog1 (match-string 0 ref)
6360 (setq ref (substring ref (match-end 0))))))
6361 (gnus-summary-goto-subject current)
6362 (gnus-summary-position-point)
6365 (defun gnus-summary-refer-thread (&optional limit)
6366 "Fetch all articles in the current thread.
6367 If LIMIT (the numerical prefix), fetch that many old headers instead
6368 of what's specified by the `gnus-refer-thread-limit' variable."
6370 (let ((id (mail-header-id (gnus-summary-article-header)))
6371 (limit (if limit (prefix-numeric-value limit)
6372 gnus-refer-thread-limit))
6374 ;; We want to fetch LIMIT *old* headers, but we also have to
6375 ;; re-fetch all the headers in the current buffer, because many of
6376 ;; them may be undisplayed. So we adjust LIMIT.
6377 (when (numberp limit)
6378 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6379 (unless (eq gnus-fetch-old-headers 'invisible)
6380 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6381 ;; Retrieve the headers and read them in.
6382 (if (eq (gnus-retrieve-headers
6383 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6385 (gnus-build-all-threads)
6386 (error "Can't fetch thread from backends that don't support NOV"))
6387 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6388 (gnus-summary-limit-include-thread id)))
6390 (defun gnus-summary-refer-article (message-id &optional arg)
6391 "Fetch an article specified by MESSAGE-ID.
6392 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6393 or `gnus-select-method', no matter what backend the article comes from."
6394 (interactive "sMessage-ID: \nP")
6395 (when (and (stringp message-id)
6396 (not (zerop (length message-id))))
6397 ;; Construct the correct Message-ID if necessary.
6398 ;; Suggested by tale@pawl.rpi.edu.
6399 (unless (string-match "^<" message-id)
6400 (setq message-id (concat "<" message-id)))
6401 (unless (string-match ">$" message-id)
6402 (setq message-id (concat message-id ">")))
6403 (let* ((header (gnus-id-to-header message-id))
6405 (gnus-summary-article-sparse-p
6406 (mail-header-number header))
6407 (memq (mail-header-number header)
6408 gnus-newsgroup-limit)))
6411 ;; If the article is present in the buffer we just go to it.
6413 (or (not (gnus-summary-article-sparse-p
6414 (mail-header-number header)))
6417 (gnus-summary-goto-article
6418 (mail-header-number header) nil t)
6420 (gnus-summary-update-article (mail-header-number header)))))
6422 ;; We fetch the article
6423 (let ((gnus-override-method
6424 (cond ((gnus-news-group-p gnus-newsgroup-name)
6425 gnus-refer-article-method)
6427 (or gnus-refer-article-method gnus-select-method))
6430 ;; Start the special refer-article method, if necessary.
6431 (when (and gnus-refer-article-method
6432 (gnus-news-group-p gnus-newsgroup-name))
6433 (gnus-check-server gnus-refer-article-method))
6434 ;; Fetch the header, and display the article.
6435 (if (setq number (gnus-summary-insert-subject message-id))
6436 (gnus-summary-select-article nil nil nil number)
6437 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6439 (defun gnus-summary-enter-digest-group (&optional force)
6440 "Enter an nndoc group based on the current article.
6441 If FORCE, force a digest interpretation. If not, try
6442 to guess what the document format is."
6444 (let ((conf gnus-current-window-configuration))
6446 (gnus-summary-select-article))
6447 (setq gnus-current-window-configuration conf)
6448 (let* ((name (format "%s-%d"
6449 (gnus-group-prefixed-name
6450 gnus-newsgroup-name (list 'nndoc ""))
6452 (set-buffer gnus-summary-buffer)
6453 gnus-current-article)))
6454 (ogroup gnus-newsgroup-name)
6455 (params (append (gnus-info-params (gnus-get-info ogroup))
6456 (list (cons 'to-group ogroup))
6457 (list (cons 'save-article-group ogroup))))
6458 (case-fold-search t)
6459 (buf (current-buffer))
6462 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6463 (insert-buffer-substring gnus-original-article-buffer)
6464 ;; Remove lines that may lead nndoc to misinterpret the
6467 (goto-char (point-min))
6468 (or (search-forward "\n\n" nil t) (point)))
6469 (goto-char (point-min))
6470 (delete-matching-lines "^\\(Path\\):\\|^From ")
6473 (if (gnus-group-read-ephemeral-group
6474 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6476 ,(if force 'digest 'guess))) t)
6477 ;; Make all postings to this group go to the parent group.
6478 (nconc (gnus-info-params (gnus-get-info name))
6480 ;; Couldn't select this doc group.
6481 (switch-to-buffer buf)
6482 (gnus-set-global-variables)
6483 (gnus-configure-windows 'summary)
6484 (gnus-message 3 "Article couldn't be entered?"))
6485 (kill-buffer dig)))))
6487 (defun gnus-summary-read-document (n)
6488 "Open a new group based on the current article(s).
6489 This will allow you to read digests and other similar
6490 documents as newsgroups.
6491 Obeys the standard process/prefix convention."
6493 (let* ((articles (gnus-summary-work-articles n))
6494 (ogroup gnus-newsgroup-name)
6495 (params (append (gnus-info-params (gnus-get-info ogroup))
6496 (list (cons 'to-group ogroup))))
6497 article group egroup groups vgroup)
6498 (while (setq article (pop articles))
6499 (setq group (format "%s-%d" gnus-newsgroup-name article))
6500 (gnus-summary-remove-process-mark article)
6501 (when (gnus-summary-display-article article)
6503 (nnheader-temp-write nil
6504 (insert-buffer-substring gnus-original-article-buffer)
6505 ;; Remove some headers that may lead nndoc to make
6507 (message-narrow-to-head)
6508 (goto-char (point-min))
6509 (delete-matching-lines "^\\(Path\\):\\|^From ")
6512 (gnus-group-read-ephemeral-group
6513 group `(nndoc ,group (nndoc-address ,(current-buffer))
6514 (nndoc-article-type guess))
6517 ;; Make all postings to this group go to the parent group.
6518 (nconc (gnus-info-params (gnus-get-info egroup))
6520 (push egroup groups))
6521 ;; Couldn't select this doc group.
6522 (gnus-error 3 "Article couldn't be entered"))))))
6523 ;; Now we have selected all the documents.
6526 (error "None of the articles could be interpreted as documents"))
6527 ((gnus-group-read-ephemeral-group
6528 (setq vgroup (format
6529 "nnvirtual:%s-%s" gnus-newsgroup-name
6530 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6531 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6533 (cons (current-buffer) 'summary)))
6535 (error "Couldn't select virtual nndoc group")))))
6537 (defun gnus-summary-isearch-article (&optional regexp-p)
6538 "Do incremental search forward on the current article.
6539 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6541 (gnus-summary-select-article)
6542 (gnus-configure-windows 'article)
6543 (gnus-eval-in-buffer-window gnus-article-buffer
6546 (isearch-forward regexp-p))))
6548 (defun gnus-summary-search-article-forward (regexp &optional backward)
6549 "Search for an article containing REGEXP forward.
6550 If BACKWARD, search backward instead."
6553 (format "Search article %s (regexp%s): "
6554 (if current-prefix-arg "backward" "forward")
6555 (if gnus-last-search-regexp
6556 (concat ", default " gnus-last-search-regexp)
6558 current-prefix-arg))
6559 (if (string-equal regexp "")
6560 (setq regexp (or gnus-last-search-regexp ""))
6561 (setq gnus-last-search-regexp regexp))
6562 (if (gnus-summary-search-article regexp backward)
6563 (gnus-summary-show-thread)
6564 (error "Search failed: \"%s\"" regexp)))
6566 (defun gnus-summary-search-article-backward (regexp)
6567 "Search for an article containing REGEXP backward."
6570 (format "Search article backward (regexp%s): "
6571 (if gnus-last-search-regexp
6572 (concat ", default " gnus-last-search-regexp)
6574 (gnus-summary-search-article-forward regexp 'backward))
6576 (defun gnus-summary-search-article (regexp &optional backward)
6577 "Search for an article containing REGEXP.
6578 Optional argument BACKWARD means do search for backward.
6579 `gnus-select-article-hook' is not called during the search."
6580 ;; We have to require this here to make sure that the following
6581 ;; dynamic binding isn't shadowed by autoloading.
6582 (require 'gnus-async)
6583 (let ((gnus-select-article-hook nil) ;Disable hook.
6584 (gnus-article-display-hook nil)
6585 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6586 (gnus-use-article-prefetch nil)
6587 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6588 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6589 (sum (current-buffer))
6592 (gnus-save-hidden-threads
6593 (gnus-summary-select-article)
6594 (set-buffer gnus-article-buffer)
6598 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6600 (re-search-backward regexp nil t)
6601 (re-search-forward regexp nil t))
6602 ;; We found the regexp.
6607 (get-buffer-window (current-buffer))
6611 (setq point (point)))
6612 ;; We didn't find it, so we go to the next article.
6615 (while (eq found 'not)
6616 (if (not (if backward (gnus-summary-find-prev)
6617 (gnus-summary-find-next)))
6618 ;; No more articles.
6620 ;; Select the next article and adjust point.
6621 (unless (gnus-summary-article-sparse-p
6622 (gnus-summary-article-number))
6624 (gnus-summary-select-article)
6625 (set-buffer gnus-article-buffer)
6627 (goto-char (if backward (point-max) (point-min))))))))
6628 (gnus-message 7 ""))
6629 ;; Return whether we found the regexp.
6630 (when (eq found 'found)
6632 (gnus-summary-show-thread)
6633 (gnus-summary-goto-subject gnus-current-article)
6634 (gnus-summary-position-point)
6637 (defun gnus-summary-find-matching (header regexp &optional backward unread
6639 "Return a list of all articles that match REGEXP on HEADER.
6640 The search stars on the current article and goes forwards unless
6641 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6642 If UNREAD is non-nil, only unread articles will
6643 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6644 in the comparisons."
6645 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6646 (gnus-data-find-list
6647 (gnus-summary-article-number) (gnus-data-list backward))))
6648 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6649 (case-fold-search (not not-case-fold))
6651 (unless (fboundp (intern (concat "mail-header-" header)))
6652 (error "%s is not a valid header" header))
6655 (and (or (not unread) ; We want all articles...
6656 (gnus-data-unread-p d)) ; Or just unreads.
6657 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6658 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6659 (push (gnus-data-number d) articles)) ; Success!
6660 (setq data (cdr data)))
6661 (nreverse articles)))
6663 (defun gnus-summary-execute-command (header regexp command &optional backward)
6664 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6665 If HEADER is an empty string (or nil), the match is done on the entire
6666 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6668 (list (let ((completion-ignore-case t))
6671 (mapcar (lambda (string) (list string))
6672 '("Number" "Subject" "From" "Lines" "Date"
6673 "Message-ID" "Xref" "References" "Body"))
6674 nil 'require-match))
6675 (read-string "Regexp: ")
6676 (read-key-sequence "Command: ")
6677 current-prefix-arg))
6678 (when (equal header "Body")
6680 ;; Hidden thread subtrees must be searched as well.
6681 (gnus-summary-show-all-threads)
6682 ;; We don't want to change current point nor window configuration.
6684 (save-window-excursion
6685 (gnus-message 6 "Executing %s..." (key-description command))
6686 ;; We'd like to execute COMMAND interactively so as to give arguments.
6687 (gnus-execute header regexp
6688 `(call-interactively ',(key-binding command))
6690 (gnus-message 6 "Executing %s...done" (key-description command)))))
6692 (defun gnus-summary-beginning-of-article ()
6693 "Scroll the article back to the beginning."
6695 (gnus-summary-select-article)
6696 (gnus-configure-windows 'article)
6697 (gnus-eval-in-buffer-window gnus-article-buffer
6699 (goto-char (point-min))
6700 (when gnus-page-broken
6701 (gnus-narrow-to-page))))
6703 (defun gnus-summary-end-of-article ()
6704 "Scroll to the end of the article."
6706 (gnus-summary-select-article)
6707 (gnus-configure-windows 'article)
6708 (gnus-eval-in-buffer-window gnus-article-buffer
6710 (goto-char (point-max))
6712 (when gnus-page-broken
6713 (gnus-narrow-to-page))))
6715 (defun gnus-summary-print-article (&optional filename)
6716 "Generate and print a PostScript image of the article buffer.
6718 If the optional argument FILENAME is nil, send the image to the printer.
6719 If FILENAME is a string, save the PostScript image in a file with that
6720 name. If FILENAME is a number, prompt the user for the name of the file
6722 (interactive (list (ps-print-preprint current-prefix-arg)))
6723 (gnus-summary-select-article)
6724 (gnus-eval-in-buffer-window gnus-article-buffer
6725 (let ((buffer (generate-new-buffer " *print*")))
6728 (copy-to-buffer buffer (point-min) (point-max))
6730 (gnus-article-delete-invisible-text)
6731 (run-hooks 'gnus-ps-print-hook)
6732 (ps-print-buffer-with-faces filename))
6733 (kill-buffer buffer)))))
6735 (defun gnus-summary-show-article (&optional arg)
6736 "Force re-fetching of the current article.
6737 If ARG (the prefix) is non-nil, show the raw article without any
6738 article massaging functions being run."
6741 ;; Select the article the normal way.
6742 (gnus-summary-select-article nil 'force)
6743 ;; Bind the article treatment functions to nil.
6744 (let ((gnus-have-all-headers t)
6745 gnus-article-display-hook
6746 gnus-article-prepare-hook
6750 (gnus-summary-select-article nil 'force)))
6751 (gnus-summary-goto-subject gnus-current-article)
6752 (gnus-summary-position-point))
6754 (defun gnus-summary-verbose-headers (&optional arg)
6755 "Toggle permanent full header display.
6756 If ARG is a positive number, turn header display on.
6757 If ARG is a negative number, turn header display off."
6759 (setq gnus-show-all-headers
6760 (cond ((or (not (numberp arg))
6762 (not gnus-show-all-headers))
6765 (gnus-summary-show-article))
6767 (defun gnus-summary-toggle-header (&optional arg)
6768 "Show the headers if they are hidden, or hide them if they are shown.
6769 If ARG is a positive number, show the entire header.
6770 If ARG is a negative number, hide the unwanted header lines."
6773 (set-buffer gnus-article-buffer)
6774 (let* ((buffer-read-only nil)
6775 (inhibit-point-motion-hooks t)
6776 (hidden (text-property-any
6777 (goto-char (point-min)) (search-forward "\n\n")
6780 (goto-char (point-min))
6781 (when (search-forward "\n\n" nil t)
6782 (delete-region (point-min) (1- (point))))
6783 (goto-char (point-min))
6785 (set-buffer gnus-original-article-buffer)
6786 (goto-char (point-min))
6787 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6788 (insert-buffer-substring gnus-original-article-buffer 1 e)
6789 (let ((article-inhibit-hiding t))
6790 (run-hooks 'gnus-article-display-hook))
6791 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6792 (gnus-article-hide-headers)))))
6794 (defun gnus-summary-show-all-headers ()
6795 "Make all header lines visible."
6797 (gnus-article-show-all-headers))
6799 (defun gnus-summary-toggle-mime (&optional arg)
6800 "Toggle MIME processing.
6801 If ARG is a positive number, turn MIME processing on."
6803 (setq gnus-show-mime
6804 (if (null arg) (not gnus-show-mime)
6805 (> (prefix-numeric-value arg) 0)))
6806 (gnus-summary-select-article t 'force))
6808 (defun gnus-summary-caesar-message (&optional arg)
6809 "Caesar rotate the current article by 13.
6810 The numerical prefix specifies how many places to rotate each letter
6813 (gnus-summary-select-article)
6814 (let ((mail-header-separator ""))
6815 (gnus-eval-in-buffer-window gnus-article-buffer
6818 (let ((start (window-start))
6820 (message-caesar-buffer-body arg)
6821 (set-window-start (get-buffer-window (current-buffer)) start))))))
6823 (defun gnus-summary-stop-page-breaking ()
6824 "Stop page breaking in the current article."
6826 (gnus-summary-select-article)
6827 (gnus-eval-in-buffer-window gnus-article-buffer
6829 (when (gnus-visual-p 'page-marker)
6830 (let ((buffer-read-only nil))
6831 (gnus-remove-text-with-property 'gnus-prev)
6832 (gnus-remove-text-with-property 'gnus-next)))))
6834 (defun gnus-summary-move-article (&optional n to-newsgroup
6835 select-method action)
6836 "Move the current article to a different newsgroup.
6837 If N is a positive number, move the N next articles.
6838 If N is a negative number, move the N previous articles.
6839 If N is nil and any articles have been marked with the process mark,
6840 move those articles instead.
6841 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6842 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6843 re-spool using this method.
6845 For this function to work, both the current newsgroup and the
6846 newsgroup that you want to move to have to support the `request-move'
6847 and `request-accept' functions."
6850 (setq action 'move))
6851 ;; Disable marking as read.
6852 (let (gnus-mark-article-hook)
6853 (save-window-excursion
6854 (gnus-summary-select-article)))
6855 ;; Check whether the source group supports the required functions.
6856 (cond ((and (eq action 'move)
6857 (not (gnus-check-backend-function
6858 'request-move-article gnus-newsgroup-name)))
6859 (error "The current group does not support article moving"))
6860 ((and (eq action 'crosspost)
6861 (not (gnus-check-backend-function
6862 'request-replace-article gnus-newsgroup-name)))
6863 (error "The current group does not support article editing")))
6864 (let ((articles (gnus-summary-work-articles n))
6865 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6866 (names '((move "Move" "Moving")
6867 (copy "Copy" "Copying")
6868 (crosspost "Crosspost" "Crossposting")))
6869 (copy-buf (save-excursion
6870 (nnheader-set-temp-buffer " *copy article*")))
6871 art-group to-method new-xref article to-groups)
6872 (unless (assq action names)
6873 (error "Unknown action %s" action))
6874 ;; Read the newsgroup name.
6875 (when (and (not to-newsgroup)
6876 (not select-method))
6878 (gnus-read-move-group-name
6879 (cadr (assq action names))
6880 (symbol-value (intern (format "gnus-current-%s-group" action)))
6882 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6883 (setq to-method (or select-method
6884 (gnus-group-name-to-method to-newsgroup)))
6885 ;; Check the method we are to move this article to...
6886 (unless (gnus-check-backend-function
6887 'request-accept-article (car to-method))
6888 (error "%s does not support article copying" (car to-method)))
6889 (unless (gnus-check-server to-method)
6890 (error "Can't open server %s" (car to-method)))
6891 (gnus-message 6 "%s to %s: %s..."
6892 (caddr (assq action names))
6893 (or (car select-method) to-newsgroup) articles)
6895 (setq article (pop articles))
6899 ;; Move the article.
6901 ;; Remove this article from future suppression.
6902 (gnus-dup-unsuppress-article article)
6903 (gnus-request-move-article
6904 article ; Article to move
6905 gnus-newsgroup-name ; From newsgroup
6906 (nth 1 (gnus-find-method-for-group
6907 gnus-newsgroup-name)) ; Server
6908 (list 'gnus-request-accept-article
6909 to-newsgroup (list 'quote select-method)
6910 (not articles)) ; Accept form
6911 (not articles))) ; Only save nov last time
6912 ;; Copy the article.
6915 (set-buffer copy-buf)
6916 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
6917 (gnus-request-accept-article
6918 to-newsgroup select-method (not articles)))))
6919 ;; Crosspost the article.
6920 ((eq action 'crosspost)
6921 (let ((xref (message-tokenize-header
6922 (mail-header-xref (gnus-summary-article-header article))
6924 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6927 (setq xref (list (system-name))))
6930 (mapconcat 'identity
6931 (delete "Xref:" (delete new-xref xref))
6935 (set-buffer copy-buf)
6936 ;; First put the article in the destination group.
6937 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6938 (when (consp (setq art-group
6939 (gnus-request-accept-article
6940 to-newsgroup select-method (not articles))))
6941 (setq new-xref (concat new-xref " " (car art-group)
6942 ":" (cdr art-group)))
6943 ;; Now we have the new Xrefs header, so we insert
6944 ;; it and replace the new article.
6945 (nnheader-replace-header "Xref" new-xref)
6946 (gnus-request-replace-article
6947 (cdr art-group) to-newsgroup (current-buffer))
6951 (gnus-message 1 "Couldn't %s article %s"
6952 (cadr (assq action names)) article))
6953 ((and (eq art-group 'junk)
6955 (gnus-summary-mark-article article gnus-canceled-mark)
6956 (gnus-message 4 "Deleted article %s" article))
6960 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6962 (gnus-group-prefixed-name
6965 (gnus-find-method-for-group to-newsgroup)))
6966 gnus-newsrc-hashtb)))
6967 (info (nth 2 entry))
6968 (to-group (gnus-info-group info)))
6969 ;; Update the group that has been moved to.
6971 (memq action '(move copy)))
6972 (unless (member to-group to-groups)
6973 (push to-group to-groups))
6975 (unless (memq article gnus-newsgroup-unreads)
6977 info (gnus-add-to-range (gnus-info-read info)
6978 (list (cdr art-group)))))
6980 ;; Copy any marks over to the new group.
6981 (let ((marks gnus-article-mark-lists)
6982 (to-article (cdr art-group)))
6984 ;; See whether the article is to be put in the cache.
6985 (when gnus-use-cache
6986 (gnus-cache-possibly-enter-article
6988 (let ((header (copy-sequence
6989 (gnus-summary-article-header article))))
6990 (mail-header-set-number header to-article)
6992 (memq article gnus-newsgroup-marked)
6993 (memq article gnus-newsgroup-dormant)
6994 (memq article gnus-newsgroup-unreads)))
6996 (when (and (equal to-group gnus-newsgroup-name)
6997 (not (memq article gnus-newsgroup-unreads)))
6998 ;; Mark this article as read in this group.
6999 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7000 (setcdr (gnus-active to-group) to-article)
7001 (setcdr gnus-newsgroup-active to-article))
7004 (when (memq article (symbol-value
7005 (intern (format "gnus-newsgroup-%s"
7007 ;; If the other group is the same as this group,
7008 ;; then we have to add the mark to the list.
7009 (when (equal to-group gnus-newsgroup-name)
7010 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7013 (intern (format "gnus-newsgroup-%s"
7015 ;; Copy the marks to other group.
7016 (gnus-add-marked-articles
7017 to-group (cdar marks) (list to-article) info))
7018 (setq marks (cdr marks)))
7021 (concat "(gnus-group-set-info '"
7022 (gnus-prin1-to-string (gnus-get-info to-group))
7025 ;; Update the Xref header in this article to point to
7026 ;; the new crossposted article we have just created.
7027 (when (eq action 'crosspost)
7029 (set-buffer copy-buf)
7030 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7031 (nnheader-replace-header "Xref" new-xref)
7032 (gnus-request-replace-article
7033 article gnus-newsgroup-name (current-buffer)))))
7035 (gnus-summary-goto-subject article)
7036 (when (eq action 'move)
7037 (gnus-summary-mark-article article gnus-canceled-mark))))
7038 (gnus-summary-remove-process-mark article))
7039 ;; Re-activate all groups that have been moved to.
7042 (set-buffer gnus-group-buffer)
7043 (when (gnus-group-goto-group (car to-groups) t)
7044 (gnus-group-get-new-news-this-group 1 t))
7047 (gnus-kill-buffer copy-buf)
7048 (gnus-summary-position-point)
7049 (gnus-set-mode-line 'summary)))
7051 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7052 "Move the current article to a different newsgroup.
7053 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7054 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7055 re-spool using this method."
7057 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7059 (defun gnus-summary-crosspost-article (&optional n)
7060 "Crosspost the current article to some other group."
7062 (gnus-summary-move-article n nil nil 'crosspost))
7064 (defcustom gnus-summary-respool-default-method nil
7065 "Default method for respooling an article.
7066 If nil, use to the current newsgroup method."
7067 :type `(choice (gnus-select-method :value (nnml ""))
7069 :group 'gnus-summary-mail)
7071 (defun gnus-summary-respool-article (&optional n method)
7072 "Respool the current article.
7073 The article will be squeezed through the mail spooling process again,
7074 which means that it will be put in some mail newsgroup or other
7075 depending on `nnmail-split-methods'.
7076 If N is a positive number, respool the N next articles.
7077 If N is a negative number, respool the N previous articles.
7078 If N is nil and any articles have been marked with the process mark,
7079 respool those articles instead.
7081 Respooling can be done both from mail groups and \"real\" newsgroups.
7082 In the former case, the articles in question will be moved from the
7083 current group into whatever groups they are destined to. In the
7084 latter case, they will be copied into the relevant groups."
7086 (list current-prefix-arg
7087 (let* ((methods (gnus-methods-using 'respool))
7089 (symbol-name (or gnus-summary-respool-default-method
7090 (car (gnus-find-method-for-group
7091 gnus-newsgroup-name)))))
7093 (gnus-completing-read
7094 methname "What backend do you want to use when respooling?"
7095 methods nil t nil 'gnus-mail-method-history))
7098 ((zerop (length (setq ms (gnus-servers-using-backend
7100 (list (intern method) ""))
7104 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7105 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7108 (error "No method given for respooling"))
7109 (if (assoc (symbol-name
7110 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7111 (gnus-methods-using 'respool))
7112 (gnus-summary-move-article n nil method)
7113 (gnus-summary-copy-article n nil method)))
7115 (defun gnus-summary-import-article (file)
7116 "Import a random file into a mail newsgroup."
7117 (interactive "fImport file: ")
7118 (let ((group gnus-newsgroup-name)
7119 (now (current-time))
7121 (unless (gnus-check-backend-function 'request-accept-article group)
7122 (error "%s does not support article importing" group))
7123 (or (file-readable-p file)
7124 (not (file-regular-p file))
7125 (error "Can't read %s" file))
7127 (set-buffer (get-buffer-create " *import file*"))
7128 (buffer-disable-undo (current-buffer))
7130 (insert-file-contents file)
7131 (goto-char (point-min))
7132 (unless (nnheader-article-p)
7133 ;; This doesn't look like an article, so we fudge some headers.
7134 (setq atts (file-attributes file)
7135 lines (count-lines (point-min) (point-max)))
7136 (insert "From: " (read-string "From: ") "\n"
7137 "Subject: " (read-string "Subject: ") "\n"
7138 "Date: " (timezone-make-date-arpa-standard
7139 (current-time-string (nth 5 atts))
7140 (current-time-zone now)
7141 (current-time-zone now))
7143 "Message-ID: " (message-make-message-id) "\n"
7144 "Lines: " (int-to-string lines) "\n"
7145 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7146 (gnus-request-accept-article group nil t)
7147 (kill-buffer (current-buffer)))))
7149 (defun gnus-summary-article-posted-p ()
7150 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7151 This will be the case if the article has both been mailed and posted."
7153 (let ((id (mail-header-references (gnus-summary-article-header)))
7154 (gnus-override-method
7155 (or gnus-refer-article-method gnus-select-method)))
7156 (if (gnus-request-head id "")
7157 (gnus-message 2 "The current message was found on %s"
7158 gnus-override-method)
7159 (gnus-message 2 "The current message couldn't be found on %s"
7160 gnus-override-method)
7163 (defun gnus-summary-expire-articles (&optional now)
7164 "Expire all articles that are marked as expirable in the current group."
7166 (when (gnus-check-backend-function
7167 'request-expire-articles gnus-newsgroup-name)
7168 ;; This backend supports expiry.
7169 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7170 (expirable (if total
7172 ;; We need to update the info for
7173 ;; this group for `gnus-list-of-read-articles'
7174 ;; to give us the right answer.
7175 (run-hooks 'gnus-exit-group-hook)
7176 (gnus-summary-update-info)
7177 (gnus-list-of-read-articles gnus-newsgroup-name))
7178 (setq gnus-newsgroup-expirable
7179 (sort gnus-newsgroup-expirable '<))))
7180 (expiry-wait (if now 'immediate
7181 (gnus-group-find-parameter
7182 gnus-newsgroup-name 'expiry-wait)))
7185 ;; There are expirable articles in this group, so we run them
7186 ;; through the expiry process.
7187 (gnus-message 6 "Expiring articles...")
7188 ;; The list of articles that weren't expired is returned.
7190 (let ((nnmail-expiry-wait-function nil)
7191 (nnmail-expiry-wait expiry-wait))
7192 (setq es (gnus-request-expire-articles
7193 expirable gnus-newsgroup-name)))
7194 (setq es (gnus-request-expire-articles
7195 expirable gnus-newsgroup-name)))
7197 (setq gnus-newsgroup-expirable es))
7198 ;; We go through the old list of expirable, and mark all
7199 ;; really expired articles as nonexistent.
7200 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7201 (let ((gnus-use-cache nil))
7203 (unless (memq (car expirable) es)
7204 (when (gnus-data-find (car expirable))
7205 (gnus-summary-mark-article
7206 (car expirable) gnus-canceled-mark)))
7207 (setq expirable (cdr expirable)))))
7208 (gnus-message 6 "Expiring articles...done")))))
7210 (defun gnus-summary-expire-articles-now ()
7211 "Expunge all expirable articles in the current group.
7212 This means that *all* articles that are marked as expirable will be
7213 deleted forever, right now."
7215 (or gnus-expert-user
7217 "Are you really, really, really sure you want to delete all these messages? ")
7219 (gnus-summary-expire-articles t))
7221 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7222 (defun gnus-summary-delete-article (&optional n)
7223 "Delete the N next (mail) articles.
7224 This command actually deletes articles. This is not a marking
7225 command. The article will disappear forever from your life, never to
7227 If N is negative, delete backwards.
7228 If N is nil and articles have been marked with the process mark,
7229 delete these instead."
7231 (unless (gnus-check-backend-function 'request-expire-articles
7232 gnus-newsgroup-name)
7233 (error "The current newsgroup does not support article deletion"))
7234 ;; Compute the list of articles to delete.
7235 (let ((articles (gnus-summary-work-articles n))
7237 (if (and gnus-novice-user
7238 (not (gnus-yes-or-no-p
7239 (format "Do you really want to delete %s forever? "
7240 (if (> (length articles) 1)
7241 (format "these %s articles" (length articles))
7244 ;; Delete the articles.
7245 (setq not-deleted (gnus-request-expire-articles
7246 articles gnus-newsgroup-name 'force))
7248 (gnus-summary-remove-process-mark (car articles))
7249 ;; The backend might not have been able to delete the article
7251 (unless (memq (car articles) not-deleted)
7252 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7253 (setq articles (cdr articles)))
7255 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7256 (gnus-summary-position-point)
7257 (gnus-set-mode-line 'summary)
7260 (defun gnus-summary-edit-article (&optional force)
7261 "Edit the current article.
7262 This will have permanent effect only in mail groups.
7263 If FORCE is non-nil, allow editing of articles even in read-only
7267 (set-buffer gnus-summary-buffer)
7268 (gnus-set-global-variables)
7269 (when (and (not force)
7270 (gnus-group-read-only-p))
7271 (error "The current newsgroup does not support article editing"))
7272 ;; Select article if needed.
7273 (unless (eq (gnus-summary-article-number)
7274 gnus-current-article)
7275 (gnus-summary-select-article t))
7276 (gnus-article-date-original)
7277 (gnus-article-edit-article
7278 `(lambda (no-highlight)
7279 (gnus-summary-edit-article-done
7280 ,(or (mail-header-references gnus-current-headers) "")
7281 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7283 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7285 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7287 "Make edits to the current article permanent."
7289 ;; Replace the article.
7290 (if (and (not read-only)
7291 (not (gnus-request-replace-article
7292 (cdr gnus-article-current) (car gnus-article-current)
7294 (error "Couldn't replace article")
7295 ;; Update the summary buffer.
7297 (equal (message-tokenize-header references " ")
7298 (message-tokenize-header
7299 (or (message-fetch-field "references") "") " ")))
7300 ;; We only have to update this line.
7303 (message-narrow-to-head)
7304 (let ((head (buffer-string))
7306 (nnheader-temp-write nil
7307 (insert (format "211 %d Article retrieved.\n"
7308 (cdr gnus-article-current)))
7311 (let ((nntp-server-buffer (current-buffer)))
7312 (setq header (car (gnus-get-newsgroup-headers
7314 (set-buffer gnus-summary-buffer)
7315 gnus-newsgroup-dependencies)
7318 (set-buffer gnus-summary-buffer)
7319 (gnus-data-set-header
7320 (gnus-data-find (cdr gnus-article-current))
7322 (gnus-summary-update-article-line
7323 (cdr gnus-article-current) header))))))
7325 (set-buffer (or buffer gnus-summary-buffer))
7326 (gnus-summary-update-article (cdr gnus-article-current)))
7327 ;; Prettify the article buffer again.
7328 (unless no-highlight
7330 (set-buffer gnus-article-buffer)
7331 (run-hooks 'gnus-article-display-hook)
7332 (set-buffer gnus-original-article-buffer)
7333 (gnus-request-article
7334 (cdr gnus-article-current)
7335 (car gnus-article-current) (current-buffer))))
7336 ;; Prettify the summary buffer line.
7337 (when (gnus-visual-p 'summary-highlight 'highlight)
7338 (run-hooks 'gnus-visual-mark-article-hook))))
7340 (defun gnus-summary-edit-wash (key)
7341 "Perform editing command in the article buffer."
7345 (message "%s" (concat (this-command-keys) "- "))
7348 (gnus-summary-edit-article)
7349 (execute-kbd-macro (concat (this-command-keys) key))
7350 (gnus-article-edit-done))
7354 (defun gnus-summary-respool-query (&optional silent)
7355 "Query where the respool algorithm would put this article."
7357 (let (gnus-mark-article-hook)
7358 (gnus-summary-select-article)
7360 (set-buffer gnus-original-article-buffer)
7362 (message-narrow-to-head)
7363 (let ((groups (nnmail-article-group 'identity)))
7366 (message "This message would go to %s"
7367 (mapconcat 'car groups ", "))
7368 (message "This message would go to no groups"))
7371 ;; Summary marking commands.
7373 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7374 "Mark articles which has the same subject as read, and then select the next.
7375 If UNMARK is positive, remove any kind of mark.
7376 If UNMARK is negative, tick articles."
7379 (setq unmark (prefix-numeric-value unmark)))
7381 (gnus-summary-mark-same-subject
7382 (gnus-summary-article-subject) unmark)))
7383 ;; Select next unread article. If auto-select-same mode, should
7384 ;; select the first unread article.
7385 (gnus-summary-next-article t (and gnus-auto-select-same
7386 (gnus-summary-article-subject)))
7387 (gnus-message 7 "%d article%s marked as %s"
7388 count (if (= count 1) " is" "s are")
7389 (if unmark "unread" "read"))))
7391 (defun gnus-summary-kill-same-subject (&optional unmark)
7392 "Mark articles which has the same subject as read.
7393 If UNMARK is positive, remove any kind of mark.
7394 If UNMARK is negative, tick articles."
7397 (setq unmark (prefix-numeric-value unmark)))
7399 (gnus-summary-mark-same-subject
7400 (gnus-summary-article-subject) unmark)))
7401 ;; If marked as read, go to next unread subject.
7403 ;; Go to next unread subject.
7404 (gnus-summary-next-subject 1 t))
7405 (gnus-message 7 "%d articles are marked as %s"
7406 count (if unmark "unread" "read"))))
7408 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7409 "Mark articles with same SUBJECT as read, and return marked number.
7410 If optional argument UNMARK is positive, remove any kinds of marks.
7411 If optional argument UNMARK is negative, mark articles as unread instead."
7415 ((null unmark) ; Mark as read.
7418 (gnus-summary-mark-article-as-read gnus-killed-mark)
7419 (gnus-summary-show-thread) t)
7420 (gnus-summary-find-subject subject))
7421 (setq count (1+ count))))
7422 ((> unmark 0) ; Tick.
7425 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7426 (gnus-summary-show-thread) t)
7427 (gnus-summary-find-subject subject))
7428 (setq count (1+ count))))
7429 (t ; Mark as unread.
7432 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7433 (gnus-summary-show-thread) t)
7434 (gnus-summary-find-subject subject))
7435 (setq count (1+ count)))))
7436 (gnus-set-mode-line 'summary)
7437 ;; Return the number of marked articles.
7440 (defun gnus-summary-mark-as-processable (n &optional unmark)
7441 "Set the process mark on the next N articles.
7442 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7443 the process mark instead. The difference between N and the actual
7444 number of articles marked is returned."
7446 (let ((backward (< n 0))
7451 (gnus-summary-remove-process-mark
7452 (gnus-summary-article-number))
7453 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7454 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7457 (gnus-message 7 "No more articles"))
7458 (gnus-summary-recenter)
7459 (gnus-summary-position-point)
7462 (defun gnus-summary-unmark-as-processable (n)
7463 "Remove the process mark from the next N articles.
7464 If N is negative, unmark backward instead. The difference between N and
7465 the actual number of articles unmarked is returned."
7467 (gnus-summary-mark-as-processable n t))
7469 (defun gnus-summary-unmark-all-processable ()
7470 "Remove the process mark from all articles."
7473 (while gnus-newsgroup-processable
7474 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7475 (gnus-summary-position-point))
7477 (defun gnus-summary-mark-as-expirable (n)
7478 "Mark N articles forward as expirable.
7479 If N is negative, mark backward instead. The difference between N and
7480 the actual number of articles marked is returned."
7482 (gnus-summary-mark-forward n gnus-expirable-mark))
7484 (defun gnus-summary-mark-article-as-replied (article)
7485 "Mark ARTICLE replied and update the summary line."
7486 (push article gnus-newsgroup-replied)
7487 (let ((buffer-read-only nil))
7488 (when (gnus-summary-goto-subject article)
7489 (gnus-summary-update-secondary-mark article))))
7491 (defun gnus-summary-set-bookmark (article)
7492 "Set a bookmark in current article."
7493 (interactive (list (gnus-summary-article-number)))
7494 (when (or (not (get-buffer gnus-article-buffer))
7495 (not gnus-current-article)
7496 (not gnus-article-current)
7497 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7498 (error "No current article selected"))
7499 ;; Remove old bookmark, if one exists.
7500 (let ((old (assq article gnus-newsgroup-bookmarks)))
7502 (setq gnus-newsgroup-bookmarks
7503 (delq old gnus-newsgroup-bookmarks))))
7504 ;; Set the new bookmark, which is on the form
7505 ;; (article-number . line-number-in-body).
7509 (set-buffer gnus-article-buffer)
7513 (goto-char (point-min))
7514 (search-forward "\n\n" nil t)
7517 gnus-newsgroup-bookmarks)
7518 (gnus-message 6 "A bookmark has been added to the current article."))
7520 (defun gnus-summary-remove-bookmark (article)
7521 "Remove the bookmark from the current article."
7522 (interactive (list (gnus-summary-article-number)))
7523 ;; Remove old bookmark, if one exists.
7524 (let ((old (assq article gnus-newsgroup-bookmarks)))
7527 (setq gnus-newsgroup-bookmarks
7528 (delq old gnus-newsgroup-bookmarks))
7529 (gnus-message 6 "Removed bookmark."))
7530 (gnus-message 6 "No bookmark in current article."))))
7532 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7533 (defun gnus-summary-mark-as-dormant (n)
7534 "Mark N articles forward as dormant.
7535 If N is negative, mark backward instead. The difference between N and
7536 the actual number of articles marked is returned."
7538 (gnus-summary-mark-forward n gnus-dormant-mark))
7540 (defun gnus-summary-set-process-mark (article)
7541 "Set the process mark on ARTICLE and update the summary line."
7542 (setq gnus-newsgroup-processable
7544 (delq article gnus-newsgroup-processable)))
7545 (when (gnus-summary-goto-subject article)
7546 (gnus-summary-show-thread)
7547 (gnus-summary-update-secondary-mark article)))
7549 (defun gnus-summary-remove-process-mark (article)
7550 "Remove the process mark from ARTICLE and update the summary line."
7551 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7552 (when (gnus-summary-goto-subject article)
7553 (gnus-summary-show-thread)
7554 (gnus-summary-update-secondary-mark article)))
7556 (defun gnus-summary-set-saved-mark (article)
7557 "Set the process mark on ARTICLE and update the summary line."
7558 (push article gnus-newsgroup-saved)
7559 (when (gnus-summary-goto-subject article)
7560 (gnus-summary-update-secondary-mark article)))
7562 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7563 "Mark N articles as read forwards.
7564 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7565 The difference between N and the actual number of articles marked is
7568 (let ((backward (< n 0))
7569 (gnus-summary-goto-unread
7570 (and gnus-summary-goto-unread
7571 (not (eq gnus-summary-goto-unread 'never))
7572 (not (memq mark (list gnus-unread-mark
7573 gnus-ticked-mark gnus-dormant-mark)))))
7575 (mark (or mark gnus-del-mark)))
7577 (gnus-summary-mark-article nil mark no-expire)
7578 (zerop (gnus-summary-next-subject
7580 (and gnus-summary-goto-unread
7581 (not (eq gnus-summary-goto-unread 'never)))
7585 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7586 (gnus-summary-recenter)
7587 (gnus-summary-position-point)
7588 (gnus-set-mode-line 'summary)
7591 (defun gnus-summary-mark-article-as-read (mark)
7592 "Mark the current article quickly as read with MARK."
7593 (let ((article (gnus-summary-article-number)))
7594 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7595 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7596 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7597 (push (cons article mark) gnus-newsgroup-reads)
7598 ;; Possibly remove from cache, if that is used.
7599 (when gnus-use-cache
7600 (gnus-cache-enter-remove-article article))
7601 ;; Allow the backend to change the mark.
7602 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7603 ;; Check for auto-expiry.
7604 (when (and gnus-newsgroup-auto-expire
7605 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7606 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7607 (= mark gnus-ancient-mark)
7608 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7609 (= mark gnus-duplicate-mark)))
7610 (setq mark gnus-expirable-mark)
7611 (push article gnus-newsgroup-expirable))
7612 ;; Set the mark in the buffer.
7613 (gnus-summary-update-mark mark 'unread)
7616 (defun gnus-summary-mark-article-as-unread (mark)
7617 "Mark the current article quickly as unread with MARK."
7618 (let ((article (gnus-summary-article-number)))
7621 (gnus-error 1 "Can't mark negative article numbers")
7623 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7624 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7625 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7626 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7627 (cond ((= mark gnus-ticked-mark)
7628 (push article gnus-newsgroup-marked))
7629 ((= mark gnus-dormant-mark)
7630 (push article gnus-newsgroup-dormant))
7632 (push article gnus-newsgroup-unreads)))
7633 (setq gnus-newsgroup-reads
7634 (delq (assq article gnus-newsgroup-reads)
7635 gnus-newsgroup-reads))
7637 ;; See whether the article is to be put in the cache.
7639 (vectorp (gnus-summary-article-header article))
7641 (gnus-cache-possibly-enter-article
7642 gnus-newsgroup-name article
7643 (gnus-summary-article-header article)
7644 (= mark gnus-ticked-mark)
7645 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7648 (gnus-summary-update-mark mark 'unread)
7651 (defun gnus-summary-mark-article (&optional article mark no-expire)
7652 "Mark ARTICLE with MARK. MARK can be any character.
7653 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7654 `??' (dormant) and `?E' (expirable).
7655 If MARK is nil, then the default character `?D' is used.
7656 If ARTICLE is nil, then the article on the current line will be
7658 ;; The mark might be a string.
7659 (when (stringp mark)
7660 (setq mark (aref mark 0)))
7661 ;; If no mark is given, then we check auto-expiring.
7662 (and (not no-expire)
7663 gnus-newsgroup-auto-expire
7665 (and (gnus-characterp mark)
7666 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7667 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7668 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7669 (= mark gnus-duplicate-mark))))
7670 (setq mark gnus-expirable-mark))
7671 (let* ((mark (or mark gnus-del-mark))
7672 (article (or article (gnus-summary-article-number))))
7674 (error "No article on current line"))
7675 (if (not (if (or (= mark gnus-unread-mark)
7676 (= mark gnus-ticked-mark)
7677 (= mark gnus-dormant-mark))
7678 (gnus-mark-article-as-unread article mark)
7679 (gnus-mark-article-as-read article mark)))
7681 ;; See whether the article is to be put in the cache.
7683 (not (= mark gnus-canceled-mark))
7684 (vectorp (gnus-summary-article-header article))
7686 (gnus-cache-possibly-enter-article
7687 gnus-newsgroup-name article
7688 (gnus-summary-article-header article)
7689 (= mark gnus-ticked-mark)
7690 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7692 (when (gnus-summary-goto-subject article nil t)
7693 (let ((buffer-read-only nil))
7694 (gnus-summary-show-thread)
7696 (gnus-summary-update-mark mark 'unread)
7699 (defun gnus-summary-update-secondary-mark (article)
7700 "Update the secondary (read, process, cache) mark."
7701 (gnus-summary-update-mark
7702 (cond ((memq article gnus-newsgroup-processable)
7704 ((memq article gnus-newsgroup-cached)
7706 ((memq article gnus-newsgroup-replied)
7708 ((memq article gnus-newsgroup-saved)
7710 (t gnus-unread-mark))
7712 (when (gnus-visual-p 'summary-highlight 'highlight)
7713 (run-hooks 'gnus-summary-update-hook))
7716 (defun gnus-summary-update-mark (mark type)
7717 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7718 (buffer-read-only nil))
7719 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7720 (when (looking-at "\r")
7723 (<= (+ forward (point)) (point-max)))
7724 ;; Go to the right position on the line.
7725 (goto-char (+ forward (point)))
7726 ;; Replace the old mark with the new mark.
7727 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7728 ;; Optionally update the marks by some user rule.
7729 (when (eq type 'unread)
7731 (gnus-data-find (gnus-summary-article-number)) mark)
7732 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7734 (defun gnus-mark-article-as-read (article &optional mark)
7735 "Enter ARTICLE in the pertinent lists and remove it from others."
7736 ;; Make the article expirable.
7737 (let ((mark (or mark gnus-del-mark)))
7738 (if (= mark gnus-expirable-mark)
7739 (push article gnus-newsgroup-expirable)
7740 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7741 ;; Remove from unread and marked lists.
7742 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7743 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7744 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7745 (push (cons article mark) gnus-newsgroup-reads)
7746 ;; Possibly remove from cache, if that is used.
7747 (when gnus-use-cache
7748 (gnus-cache-enter-remove-article article))))
7750 (defun gnus-mark-article-as-unread (article &optional mark)
7751 "Enter ARTICLE in the pertinent lists and remove it from others."
7752 (let ((mark (or mark gnus-ticked-mark)))
7755 (gnus-error 1 "Can't mark negative article numbers")
7757 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7758 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7759 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7760 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7762 ;; Unsuppress duplicates?
7763 (when gnus-suppress-duplicates
7764 (gnus-dup-unsuppress-article article))
7766 (cond ((= mark gnus-ticked-mark)
7767 (push article gnus-newsgroup-marked))
7768 ((= mark gnus-dormant-mark)
7769 (push article gnus-newsgroup-dormant))
7771 (push article gnus-newsgroup-unreads)))
7772 (setq gnus-newsgroup-reads
7773 (delq (assq article gnus-newsgroup-reads)
7774 gnus-newsgroup-reads))
7777 (defalias 'gnus-summary-mark-as-unread-forward
7778 'gnus-summary-tick-article-forward)
7779 (make-obsolete 'gnus-summary-mark-as-unread-forward
7780 'gnus-summary-tick-article-forward)
7781 (defun gnus-summary-tick-article-forward (n)
7782 "Tick N articles forwards.
7783 If N is negative, tick backwards instead.
7784 The difference between N and the number of articles ticked is returned."
7786 (gnus-summary-mark-forward n gnus-ticked-mark))
7788 (defalias 'gnus-summary-mark-as-unread-backward
7789 'gnus-summary-tick-article-backward)
7790 (make-obsolete 'gnus-summary-mark-as-unread-backward
7791 'gnus-summary-tick-article-backward)
7792 (defun gnus-summary-tick-article-backward (n)
7793 "Tick N articles backwards.
7794 The difference between N and the number of articles ticked is returned."
7796 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7798 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7799 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7800 (defun gnus-summary-tick-article (&optional article clear-mark)
7801 "Mark current article as unread.
7802 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7803 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7805 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7808 (defun gnus-summary-mark-as-read-forward (n)
7809 "Mark N articles as read forwards.
7810 If N is negative, mark backwards instead.
7811 The difference between N and the actual number of articles marked is
7814 (gnus-summary-mark-forward n gnus-del-mark t))
7816 (defun gnus-summary-mark-as-read-backward (n)
7817 "Mark the N articles as read backwards.
7818 The difference between N and the actual number of articles marked is
7821 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7823 (defun gnus-summary-mark-as-read (&optional article mark)
7824 "Mark current article as read.
7825 ARTICLE specifies the article to be marked as read.
7826 MARK specifies a string to be inserted at the beginning of the line."
7827 (gnus-summary-mark-article article mark))
7829 (defun gnus-summary-clear-mark-forward (n)
7830 "Clear marks from N articles forward.
7831 If N is negative, clear backward instead.
7832 The difference between N and the number of marks cleared is returned."
7834 (gnus-summary-mark-forward n gnus-unread-mark))
7836 (defun gnus-summary-clear-mark-backward (n)
7837 "Clear marks from N articles backward.
7838 The difference between N and the number of marks cleared is returned."
7840 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7842 (defun gnus-summary-mark-unread-as-read ()
7843 "Intended to be used by `gnus-summary-mark-article-hook'."
7844 (when (memq gnus-current-article gnus-newsgroup-unreads)
7845 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7847 (defun gnus-summary-mark-read-and-unread-as-read ()
7848 "Intended to be used by `gnus-summary-mark-article-hook'."
7849 (let ((mark (gnus-summary-article-mark)))
7850 (when (or (gnus-unread-mark-p mark)
7851 (gnus-read-mark-p mark))
7852 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7854 (defun gnus-summary-mark-region-as-read (point mark all)
7855 "Mark all unread articles between point and mark as read.
7856 If given a prefix, mark all articles between point and mark as read,
7857 even ticked and dormant ones."
7858 (interactive "r\nP")
7867 (memq (setq article (gnus-summary-article-number))
7868 gnus-newsgroup-unreads))
7869 (gnus-summary-mark-article article gnus-del-mark))
7871 (gnus-summary-find-next))))))
7873 (defun gnus-summary-mark-below (score mark)
7874 "Mark articles with score less than SCORE with MARK."
7875 (interactive "P\ncMark: ")
7876 (setq score (if score
7877 (prefix-numeric-value score)
7878 (or gnus-summary-default-score 0)))
7880 (set-buffer gnus-summary-buffer)
7881 (goto-char (point-min))
7884 (and (< (gnus-summary-article-score) score)
7885 (gnus-summary-mark-article nil mark))
7886 (gnus-summary-find-next)))))
7888 (defun gnus-summary-kill-below (&optional score)
7889 "Mark articles with score below SCORE as read."
7891 (gnus-summary-mark-below score gnus-killed-mark))
7893 (defun gnus-summary-clear-above (&optional score)
7894 "Clear all marks from articles with score above SCORE."
7896 (gnus-summary-mark-above score gnus-unread-mark))
7898 (defun gnus-summary-tick-above (&optional score)
7899 "Tick all articles with score above SCORE."
7901 (gnus-summary-mark-above score gnus-ticked-mark))
7903 (defun gnus-summary-mark-above (score mark)
7904 "Mark articles with score over SCORE with MARK."
7905 (interactive "P\ncMark: ")
7906 (setq score (if score
7907 (prefix-numeric-value score)
7908 (or gnus-summary-default-score 0)))
7910 (set-buffer gnus-summary-buffer)
7911 (goto-char (point-min))
7913 (when (> (gnus-summary-article-score) score)
7914 (gnus-summary-mark-article nil mark))
7916 (gnus-summary-find-next)))))
7918 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7919 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7920 (defun gnus-summary-limit-include-expunged (&optional no-error)
7921 "Display all the hidden articles that were expunged for low scores."
7923 (let ((buffer-read-only nil))
7924 (let ((scored gnus-newsgroup-scored)
7927 (unless (gnus-summary-goto-subject (caar scored))
7928 (and (setq h (gnus-summary-article-header (caar scored)))
7929 (< (cdar scored) gnus-summary-expunge-below)
7931 (setq scored (cdr scored)))
7933 (when (not no-error)
7934 (error "No expunged articles hidden"))
7935 (goto-char (point-min))
7936 (gnus-summary-prepare-unthreaded (nreverse headers))
7937 (goto-char (point-min))
7938 (gnus-summary-position-point)
7941 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7942 "Mark all unread articles in this newsgroup as read.
7943 If prefix argument ALL is non-nil, ticked and dormant articles will
7944 also be marked as read.
7945 If QUIETLY is non-nil, no questions will be asked.
7946 If TO-HERE is non-nil, it should be a point in the buffer. All
7947 articles before this point will be marked as read.
7948 Note that this function will only catch up the unread article
7949 in the current summary buffer limitation.
7950 The number of articles marked as read is returned."
7955 (not gnus-interactive-catchup) ;Without confirmation?
7959 "Mark absolutely all articles as read? "
7960 "Mark all unread articles as read? ")))
7962 (not gnus-newsgroup-adaptive)
7963 (not gnus-newsgroup-auto-expire)
7964 (not gnus-suppress-duplicates)
7965 (or (not gnus-use-cache)
7966 (eq gnus-use-cache 'passive)))
7969 (setq gnus-newsgroup-marked nil
7970 gnus-newsgroup-dormant nil))
7971 (setq gnus-newsgroup-unreads nil))
7972 ;; We actually mark all articles as canceled, which we
7973 ;; have to do when using auto-expiry or adaptive scoring.
7974 (gnus-summary-show-all-threads)
7975 (when (gnus-summary-first-subject (not all))
7977 (if to-here (< (point) to-here) t)
7978 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7979 (gnus-summary-find-next (not all)))))
7980 (gnus-set-mode-line 'summary))
7982 (gnus-summary-position-point)))
7984 (defun gnus-summary-catchup-to-here (&optional all)
7985 "Mark all unticked articles before the current one as read.
7986 If ALL is non-nil, also mark ticked and dormant articles as read."
7989 (gnus-save-hidden-threads
7990 (let ((beg (point)))
7991 ;; We check that there are unread articles.
7992 (when (or all (gnus-summary-find-prev))
7993 (gnus-summary-catchup all t beg)))))
7994 (gnus-summary-position-point))
7996 (defun gnus-summary-catchup-all (&optional quietly)
7997 "Mark all articles in this newsgroup as read."
7999 (gnus-summary-catchup t quietly))
8001 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8002 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8003 If prefix argument ALL is non-nil, all articles are marked as read."
8005 (when (gnus-summary-catchup all quietly nil 'fast)
8006 ;; Select next newsgroup or exit.
8007 (if (eq gnus-auto-select-next 'quietly)
8008 (gnus-summary-next-group nil)
8009 (gnus-summary-exit))))
8011 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8012 "Mark all articles in this newsgroup as read, and then exit."
8014 (gnus-summary-catchup-and-exit t quietly))
8016 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8017 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8018 "Mark all articles in this group as read and select the next group.
8019 If given a prefix, mark all articles, unread as well as ticked, as
8023 (gnus-summary-catchup all))
8024 (gnus-summary-next-article t nil nil t))
8026 ;; Thread-based commands.
8028 (defun gnus-summary-articles-in-thread (&optional article)
8029 "Return a list of all articles in the current thread.
8030 If ARTICLE is non-nil, return all articles in the thread that starts
8032 (let* ((article (or article (gnus-summary-article-number)))
8033 (data (gnus-data-find-list article))
8034 (top-level (gnus-data-level (car data)))
8036 (cond ((null gnus-thread-operation-ignore-subject)
8037 (gnus-simplify-subject-re
8038 (mail-header-subject (gnus-data-header (car data)))))
8039 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8040 (gnus-simplify-subject-fuzzy
8041 (mail-header-subject (gnus-data-header (car data)))))
8043 (end-point (save-excursion
8044 (if (gnus-summary-go-to-next-thread)
8045 (point) (point-max))))
8048 (< (gnus-data-pos (car data)) end-point))
8049 (when (or (not top-subject)
8050 (string= top-subject
8051 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8052 (gnus-simplify-subject-fuzzy
8053 (mail-header-subject
8054 (gnus-data-header (car data))))
8055 (gnus-simplify-subject-re
8056 (mail-header-subject
8057 (gnus-data-header (car data)))))))
8058 (push (gnus-data-number (car data)) articles))
8059 (unless (and (setq data (cdr data))
8060 (> (gnus-data-level (car data)) top-level))
8062 ;; Return the list of articles.
8063 (nreverse articles)))
8065 (defun gnus-summary-rethread-current ()
8066 "Rethread the thread the current article is part of."
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 (re-search-forward "^References: " nil t)
8111 (re-search-forward "^[^ \t]" nil t)
8114 (insert " " message-id))
8115 (insert "References: " message-id "\n"))
8116 (unless (gnus-request-replace-article
8117 current-article (car gnus-article-current)
8119 (error "Couldn't replace article"))))
8120 (set-buffer gnus-summary-buffer)
8121 (gnus-summary-unmark-all-processable)
8122 (gnus-summary-update-article current-article)
8123 (gnus-summary-rethread-current)
8124 (gnus-message 3 "Article %d is now the child of article %d"
8125 current-article parent-article)))))
8127 (defun gnus-summary-toggle-threads (&optional arg)
8128 "Toggle showing conversation threads.
8129 If ARG is positive number, turn showing conversation threads on."
8131 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8132 (setq gnus-show-threads
8133 (if (null arg) (not gnus-show-threads)
8134 (> (prefix-numeric-value arg) 0)))
8135 (gnus-summary-prepare)
8136 (gnus-summary-goto-subject current)
8137 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8138 (gnus-summary-position-point)))
8140 (defun gnus-summary-show-all-threads ()
8144 (let ((buffer-read-only nil))
8145 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8146 (gnus-summary-position-point))
8148 (defun gnus-summary-show-thread ()
8149 "Show thread subtrees.
8150 Returns nil if no thread was there to be shown."
8152 (let ((buffer-read-only nil)
8154 ;; first goto end then to beg, to have point at beg after let
8155 (end (progn (end-of-line) (point)))
8156 (beg (progn (beginning-of-line) (point))))
8158 ;; Any hidden lines here?
8159 (search-forward "\r" end t)
8160 (subst-char-in-region beg end ?\^M ?\n t)
8162 (gnus-summary-position-point))))
8164 (defun gnus-summary-hide-all-threads ()
8165 "Hide all thread subtrees."
8168 (goto-char (point-min))
8169 (gnus-summary-hide-thread)
8170 (while (zerop (gnus-summary-next-thread 1 t))
8171 (gnus-summary-hide-thread)))
8172 (gnus-summary-position-point))
8174 (defun gnus-summary-hide-thread ()
8175 "Hide thread subtrees.
8176 Returns nil if no threads were there to be hidden."
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 (let ((backward (< n 0))
8229 (gnus-summary-go-to-next-thread backward))
8232 (gnus-summary-position-point))
8233 (when (and (not silent) (/= 0 n))
8234 (gnus-message 7 "No more threads"))
8237 (defun gnus-summary-prev-thread (n)
8238 "Go to the same level previous N'th thread.
8239 Returns the difference between N and the number of skips actually
8242 (gnus-summary-next-thread (- n)))
8244 (defun gnus-summary-go-down-thread ()
8245 "Go down one level in the current thread."
8246 (let ((children (gnus-summary-article-children)))
8248 (gnus-summary-goto-subject (car children)))))
8250 (defun gnus-summary-go-up-thread ()
8251 "Go up one level in the current thread."
8252 (let ((parent (gnus-summary-article-parent)))
8254 (gnus-summary-goto-subject parent))))
8256 (defun gnus-summary-down-thread (n)
8257 "Go down thread N steps.
8258 If N is negative, go up instead.
8259 Returns the difference between N and how many steps down that were
8265 (if up (gnus-summary-go-up-thread)
8266 (gnus-summary-go-down-thread)))
8268 (gnus-summary-position-point)
8270 (gnus-message 7 "Can't go further"))
8273 (defun gnus-summary-up-thread (n)
8274 "Go up thread N steps.
8275 If N is negative, go up instead.
8276 Returns the difference between N and how many steps down that were
8279 (gnus-summary-down-thread (- n)))
8281 (defun gnus-summary-top-thread ()
8282 "Go to the top of the thread."
8284 (while (gnus-summary-go-up-thread))
8285 (gnus-summary-article-number))
8287 (defun gnus-summary-kill-thread (&optional unmark)
8288 "Mark articles under current thread as read.
8289 If the prefix argument is positive, remove any kinds of marks.
8290 If the prefix argument is negative, tick articles instead."
8293 (setq unmark (prefix-numeric-value unmark)))
8294 (let ((articles (gnus-summary-articles-in-thread)))
8296 ;; Expand the thread.
8297 (gnus-summary-show-thread)
8298 ;; Mark all the articles.
8300 (gnus-summary-goto-subject (car articles))
8301 (cond ((null unmark)
8302 (gnus-summary-mark-article-as-read gnus-killed-mark))
8304 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8306 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8307 (setq articles (cdr articles))))
8308 ;; Hide killed subtrees.
8310 gnus-thread-hide-killed
8311 (gnus-summary-hide-thread))
8312 ;; If marked as read, go to next unread subject.
8314 ;; Go to next unread subject.
8315 (gnus-summary-next-subject 1 t)))
8316 (gnus-set-mode-line 'summary))
8318 ;; Summary sorting commands
8320 (defun gnus-summary-sort-by-number (&optional reverse)
8321 "Sort the summary buffer by article number.
8322 Argument REVERSE means reverse order."
8324 (gnus-summary-sort 'number reverse))
8326 (defun gnus-summary-sort-by-author (&optional reverse)
8327 "Sort the summary buffer by author name alphabetically.
8328 If case-fold-search is non-nil, case of letters is ignored.
8329 Argument REVERSE means reverse order."
8331 (gnus-summary-sort 'author reverse))
8333 (defun gnus-summary-sort-by-subject (&optional reverse)
8334 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8335 If case-fold-search is non-nil, case of letters is ignored.
8336 Argument REVERSE means reverse order."
8338 (gnus-summary-sort 'subject reverse))
8340 (defun gnus-summary-sort-by-date (&optional reverse)
8341 "Sort the summary buffer by date.
8342 Argument REVERSE means reverse order."
8344 (gnus-summary-sort 'date reverse))
8346 (defun gnus-summary-sort-by-score (&optional reverse)
8347 "Sort the summary buffer by score.
8348 Argument REVERSE means reverse order."
8350 (gnus-summary-sort 'score reverse))
8352 (defun gnus-summary-sort-by-lines (&optional reverse)
8353 "Sort the summary buffer by article length.
8354 Argument REVERSE means reverse order."
8356 (gnus-summary-sort 'lines reverse))
8358 (defun gnus-summary-sort (predicate reverse)
8359 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8360 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8361 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8362 (gnus-thread-sort-functions
8368 (gnus-article-sort-functions
8373 (,article t2 t1)))))
8375 (gnus-summary-prepare-hook nil))
8376 ;; We do the sorting by regenerating the threads.
8377 (gnus-summary-prepare)
8378 ;; Hide subthreads if needed.
8379 (when (and gnus-show-threads gnus-thread-hide-subtree)
8380 (gnus-summary-hide-all-threads))))
8382 ;; Summary saving commands.
8384 (defun gnus-summary-save-article (&optional n not-saved)
8385 "Save the current article using the default saver function.
8386 If N is a positive number, save the N next articles.
8387 If N is a negative number, save the N previous articles.
8388 If N is nil and any articles have been marked with the process mark,
8389 save those articles instead.
8390 The variable `gnus-default-article-saver' specifies the saver function."
8392 (let* ((articles (gnus-summary-work-articles n))
8393 (save-buffer (save-excursion
8394 (nnheader-set-temp-buffer " *Gnus Save*")))
8395 (num (length articles))
8396 header article file)
8398 (setq header (gnus-summary-article-header
8399 (setq article (pop articles))))
8400 (if (not (vectorp header))
8401 ;; This is a pseudo-article.
8402 (if (assq 'name header)
8403 (gnus-copy-file (cdr (assq 'name header)))
8404 (gnus-message 1 "Article %d is unsaveable" article))
8405 ;; This is a real article.
8406 (save-window-excursion
8407 (gnus-summary-select-article t nil nil article))
8409 (set-buffer save-buffer)
8411 (insert-buffer-substring gnus-original-article-buffer))
8412 (setq file (gnus-article-save save-buffer file num))
8413 (gnus-summary-remove-process-mark article)
8415 (gnus-summary-set-saved-mark article))))
8416 (gnus-kill-buffer save-buffer)
8417 (gnus-summary-position-point)
8418 (gnus-set-mode-line 'summary)
8421 (defun gnus-summary-pipe-output (&optional arg)
8422 "Pipe the current article to a subprocess.
8423 If N is a positive number, pipe the N next articles.
8424 If N is a negative number, pipe the N previous articles.
8425 If N is nil and any articles have been marked with the process mark,
8426 pipe those articles instead."
8428 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8429 (gnus-summary-save-article arg t))
8430 (gnus-configure-windows 'pipe))
8432 (defun gnus-summary-save-article-mail (&optional arg)
8433 "Append the current article to an mail file.
8434 If N is a positive number, save the N next articles.
8435 If N is a negative number, save the N previous articles.
8436 If N is nil and any articles have been marked with the process mark,
8437 save those articles instead."
8439 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8440 (gnus-summary-save-article arg)))
8442 (defun gnus-summary-save-article-rmail (&optional arg)
8443 "Append the current article to an rmail file.
8444 If N is a positive number, save the N next articles.
8445 If N is a negative number, save the N previous articles.
8446 If N is nil and any articles have been marked with the process mark,
8447 save those articles instead."
8449 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8450 (gnus-summary-save-article arg)))
8452 (defun gnus-summary-save-article-file (&optional arg)
8453 "Append the current article to a 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 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8460 (gnus-summary-save-article arg)))
8462 (defun gnus-summary-write-article-file (&optional arg)
8463 "Write the current article to a file, deleting the previous file.
8464 If N is a positive number, save the N next articles.
8465 If N is a negative number, save the N previous articles.
8466 If N is nil and any articles have been marked with the process mark,
8467 save those articles instead."
8469 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8470 (gnus-summary-save-article arg)))
8472 (defun gnus-summary-save-article-body-file (&optional arg)
8473 "Append the current article body to a file.
8474 If N is a positive number, save the N next articles.
8475 If N is a negative number, save the N previous articles.
8476 If N is nil and any articles have been marked with the process mark,
8477 save those articles instead."
8479 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8480 (gnus-summary-save-article arg)))
8482 (defun gnus-summary-pipe-message (program)
8483 "Pipe the current article through PROGRAM."
8484 (interactive "sProgram: ")
8485 (gnus-summary-select-article)
8486 (let ((mail-header-separator "")
8487 (art-buf (get-buffer gnus-article-buffer)))
8488 (gnus-eval-in-buffer-window gnus-article-buffer
8491 (let ((start (window-start))
8493 (message-pipe-buffer-body program)
8494 (set-window-start (get-buffer-window (current-buffer)) start))))))
8496 (defun gnus-get-split-value (methods)
8497 "Return a value based on the split METHODS."
8498 (let (split-name method result match)
8501 (set-buffer gnus-original-article-buffer)
8503 (nnheader-narrow-to-headers)
8505 (goto-char (point-min))
8506 (setq method (pop methods))
8507 (setq match (car method))
8510 ;; Regular expression.
8512 (re-search-forward match nil t)))
8513 ((gnus-functionp match)
8517 (setq result (funcall match gnus-newsgroup-name))))
8522 (setq result (eval match)))))
8523 (setq split-name (append (cdr method) split-name))
8524 (cond ((stringp result)
8525 (push (expand-file-name
8526 result gnus-article-save-directory)
8529 (setq split-name (append result split-name)))))))))
8532 (defun gnus-valid-move-group-p (group)
8537 (car (gnus-find-method-for-group
8538 (symbol-name group))))
8539 gnus-valid-select-methods))))
8541 (defun gnus-read-move-group-name (prompt default articles prefix)
8542 "Read a group name."
8543 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8544 (minibuffer-confirm-incomplete nil) ; XEmacs
8548 (if (> (length articles) 1)
8549 (format "these %d articles" (length articles))
8554 (gnus-completing-read default prom
8556 'gnus-valid-move-group-p
8558 'gnus-group-history))
8559 ((= 1 (length split-name))
8560 (gnus-completing-read (car split-name) prom
8562 'gnus-valid-move-group-p
8564 'gnus-group-history))
8566 (gnus-completing-read nil prom
8567 (mapcar (lambda (el) (list el))
8568 (nreverse split-name))
8570 'gnus-group-history)))))
8572 (if (or (string= to-newsgroup "")
8573 (string= to-newsgroup prefix))
8574 (setq to-newsgroup default))
8575 (unless to-newsgroup
8576 (error "No group name entered"))
8577 (or (gnus-active to-newsgroup)
8578 (gnus-activate-group to-newsgroup)
8579 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8581 (or (and (gnus-request-create-group
8582 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8583 (gnus-activate-group to-newsgroup nil nil
8584 (gnus-group-name-to-method
8586 (error "Couldn't create group %s" to-newsgroup)))
8587 (error "No such group: %s" to-newsgroup)))
8590 ;; Summary extract commands
8592 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8593 (let ((buffer-read-only nil)
8594 (article (gnus-summary-article-number))
8596 (unless (gnus-summary-goto-subject article)
8597 (error "No such article: %d" article))
8598 (gnus-summary-position-point)
8599 ;; If all commands are to be bunched up on one line, we collect
8601 (unless gnus-view-pseudos-separately
8602 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8605 (setq action (cdr (assq 'action (car ps))))
8606 (setq files (list (cdr (assq 'name (car ps)))))
8607 (while (and ps (cdr ps)
8608 (string= (or action "1")
8609 (or (cdr (assq 'action (cadr ps))) "2")))
8610 (push (cdr (assq 'name (cadr ps))) files)
8611 (setcdr ps (cddr ps)))
8613 (when (not (string-match "%s" action))
8616 (when (assq 'execute (car ps))
8617 (setcdr (assq 'execute (car ps))
8618 (funcall (if (string-match "%s" action)
8625 (gnus-quote-arg-for-sh-or-csh f)))
8627 (setq ps (cdr ps)))))
8628 (if (and gnus-view-pseudos (not not-view))
8630 (when (assq 'execute (car pslist))
8631 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8632 (eq gnus-view-pseudos 'not-confirm)))
8633 (setq pslist (cdr pslist)))
8636 (setq after-article (or (cdr (assq 'article (car pslist)))
8637 (gnus-summary-article-number)))
8638 (gnus-summary-goto-subject after-article)
8641 (insert " " (file-name-nondirectory
8642 (cdr (assq 'name (car pslist))))
8643 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8645 (forward-line -1) ; back to `b'
8646 (gnus-add-text-properties
8647 b (1- e) (list 'gnus-number gnus-reffed-article-number
8648 gnus-mouse-face-prop gnus-mouse-face))
8650 after-article gnus-reffed-article-number
8651 gnus-unread-mark b (car pslist) 0 (- e b))
8652 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8653 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8654 (setq pslist (cdr pslist)))))))
8656 (defun gnus-pseudos< (p1 p2)
8657 (let ((c1 (cdr (assq 'action p1)))
8658 (c2 (cdr (assq 'action p2))))
8659 (and c1 c2 (string< c1 c2))))
8661 (defun gnus-request-pseudo-article (props)
8662 (cond ((assq 'execute props)
8663 (gnus-execute-command (cdr (assq 'execute props)))))
8664 (let ((gnus-current-article (gnus-summary-article-number)))
8665 (run-hooks 'gnus-mark-article-hook)))
8667 (defun gnus-execute-command (command &optional automatic)
8669 (gnus-article-setup-buffer)
8670 (set-buffer gnus-article-buffer)
8671 (setq buffer-read-only nil)
8672 (let ((command (if automatic command
8673 (read-string "Command: " (cons command 0)))))
8675 (insert "$ " command "\n\n")
8676 (if gnus-view-pseudo-asynchronously
8677 (start-process "gnus-execute" (current-buffer) shell-file-name
8678 shell-command-switch command)
8679 (call-process shell-file-name nil t nil
8680 shell-command-switch command)))))
8682 ;; Summary kill commands.
8684 (defun gnus-summary-edit-global-kill (article)
8685 "Edit the \"global\" kill file."
8686 (interactive (list (gnus-summary-article-number)))
8687 (gnus-group-edit-global-kill article))
8689 (defun gnus-summary-edit-local-kill ()
8690 "Edit a local kill file applied to the current newsgroup."
8692 (setq gnus-current-headers (gnus-summary-article-header))
8693 (gnus-group-edit-local-kill
8694 (gnus-summary-article-number) gnus-newsgroup-name))
8698 (defun gnus-read-header (id &optional header)
8699 "Read the headers of article ID and enter them into the Gnus system."
8700 (let ((group gnus-newsgroup-name)
8701 (gnus-override-method
8702 (and (gnus-news-group-p gnus-newsgroup-name)
8703 gnus-refer-article-method))
8705 ;; First we check to see whether the header in question is already
8708 ;; This is a Message-ID.
8709 (setq header (or header (gnus-id-to-header id)))
8710 ;; This is an article number.
8711 (setq header (or header (gnus-summary-article-header id))))
8713 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8714 ;; We have found the header.
8716 ;; If this is a sparse article, we have to nix out its
8717 ;; previous entry in the thread hashtb.
8719 (gnus-summary-article-sparse-p (mail-header-number header)))
8720 (let ((thread (gnus-gethash
8721 (gnus-parent-id (mail-header-references header))
8722 gnus-newsgroup-dependencies)))
8723 (delq (assq header thread) thread)))
8724 ;; We have to really fetch the header to this article.
8726 (set-buffer nntp-server-buffer)
8727 (when (setq where (gnus-request-head id group))
8728 (nnheader-fold-continuation-lines)
8729 (goto-char (point-max))
8731 (goto-char (point-min))
8735 ((cdr where) (cdr where))
8736 (header (mail-header-number header))
8737 (t gnus-reffed-article-number))
8739 (insert " Article retrieved.\n"))
8741 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8742 () ; Malformed head.
8743 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8744 (when (and (stringp id)
8745 (not (string= (gnus-group-real-name group)
8747 ;; If we fetched by Message-ID and the article came
8748 ;; from a different group, we fudge some bogus article
8749 ;; numbers for this article.
8750 (mail-header-set-number header gnus-reffed-article-number))
8752 (set-buffer gnus-summary-buffer)
8753 (decf gnus-reffed-article-number)
8754 (gnus-remove-header (mail-header-number header))
8755 (push header gnus-newsgroup-headers)
8756 (setq gnus-current-headers header)
8757 (push (mail-header-number header) gnus-newsgroup-limit)))
8760 (defun gnus-remove-header (number)
8761 "Remove header NUMBER from `gnus-newsgroup-headers'."
8762 (if (and gnus-newsgroup-headers
8763 (= number (mail-header-number (car gnus-newsgroup-headers))))
8764 (pop gnus-newsgroup-headers)
8765 (let ((headers gnus-newsgroup-headers))
8766 (while (and (cdr headers)
8767 (not (= number (mail-header-number (cadr headers)))))
8770 (setcdr headers (cddr headers))))))
8773 ;;; summary highlights
8776 (defun gnus-highlight-selected-summary ()
8777 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8778 ;; Highlight selected article in summary buffer
8779 (when gnus-summary-selected-face
8781 (let* ((beg (progn (beginning-of-line) (point)))
8782 (end (progn (end-of-line) (point)))
8783 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8784 (from (if (get-text-property beg gnus-mouse-face-prop)
8786 (or (next-single-property-change
8787 beg gnus-mouse-face-prop nil end)
8792 (or (next-single-property-change
8793 from gnus-mouse-face-prop nil end)
8795 ;; If no mouse-face prop on line we will have to = from = end,
8796 ;; so we highlight the entire line instead.
8797 (when (= (+ to 2) from)
8800 (if gnus-newsgroup-selected-overlay
8801 ;; Move old overlay.
8803 gnus-newsgroup-selected-overlay from to (current-buffer))
8804 ;; Create new overlay.
8806 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8807 'face gnus-summary-selected-face))))))
8809 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8810 (defun gnus-summary-highlight-line ()
8811 "Highlight current line according to `gnus-summary-highlight'."
8812 (let* ((list gnus-summary-highlight)
8814 (end (progn (end-of-line) (point)))
8815 ;; now find out where the line starts and leave point there.
8816 (beg (progn (beginning-of-line) (point)))
8817 (article (gnus-summary-article-number))
8818 (score (or (cdr (assq (or article gnus-current-article)
8819 gnus-newsgroup-scored))
8820 gnus-summary-default-score 0))
8821 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8822 (inhibit-read-only t))
8823 ;; Eval the cars of the lists until we find a match.
8824 (let ((default gnus-summary-default-score))
8826 (not (eval (caar list))))
8827 (setq list (cdr list))))
8828 (let ((face (cdar list)))
8829 (unless (eq face (get-text-property beg 'face))
8830 (gnus-put-text-property
8832 (setq face (if (boundp face) (symbol-value face) face)))
8833 (when gnus-summary-highlight-line-function
8834 (funcall gnus-summary-highlight-line-function article face))))
8837 (defun gnus-update-read-articles (group unread &optional compute)
8838 "Update the list of read articles in GROUP."
8839 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8840 (entry (gnus-gethash group gnus-newsrc-hashtb))
8841 (info (nth 2 entry))
8843 (unread (sort (copy-sequence unread) '<))
8845 (if (or (not info) (not active))
8846 ;; There is no info on this group if it was, in fact,
8847 ;; killed. Gnus stores no information on killed groups, so
8848 ;; there's nothing to be done.
8849 ;; One could store the information somewhere temporarily,
8850 ;; perhaps... Hmmm...
8852 ;; Remove any negative articles numbers.
8853 (while (and unread (< (car unread) 0))
8854 (setq unread (cdr unread)))
8855 ;; Remove any expired article numbers
8856 (while (and unread (< (car unread) (car active)))
8857 (setq unread (cdr unread)))
8858 ;; Compute the ranges of read articles by looking at the list of
8861 (when (/= (car unread) prev)
8862 (push (if (= prev (1- (car unread))) prev
8863 (cons prev (1- (car unread))))
8865 (setq prev (1+ (car unread)))
8866 (setq unread (cdr unread)))
8867 (when (<= prev (cdr active))
8868 (push (cons prev (cdr active)) read))
8870 (if (> (length read) 1) (nreverse read) read)
8872 (set-buffer gnus-group-buffer)
8875 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8876 (gnus-info-set-read ',info ',(gnus-info-read info))
8877 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8878 (gnus-group-update-group ,group t))))
8879 ;; Enter this list into the group info.
8881 info (if (> (length read) 1) (nreverse read) read))
8882 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8883 (gnus-get-unread-articles-in-group info (gnus-active group))
8886 (defun gnus-offer-save-summaries ()
8887 "Offer to save all active summary buffers."
8889 (let ((buflist (buffer-list))
8891 ;; Go through all buffers and find all summaries.
8893 (and (setq bufname (buffer-name (car buflist)))
8894 (string-match "Summary" bufname)
8896 (set-buffer bufname)
8897 ;; We check that this is, indeed, a summary buffer.
8898 (and (eq major-mode 'gnus-summary-mode)
8899 ;; Also make sure this isn't bogus.
8900 gnus-newsgroup-prepared
8901 ;; Also make sure that this isn't a dead summary buffer.
8902 (not gnus-dead-summary-mode)))
8903 (push bufname buffers))
8904 (setq buflist (cdr buflist)))
8905 ;; Go through all these summary buffers and offer to save them.
8908 "Update summary buffer %s? "
8909 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8913 ;;; @ for mime-partial
8916 (defun gnus-mime-partial-preview-function ()
8917 (gnus-summary-preview-mime-message (gnus-summary-article-number))
8920 (autoload 'mime-combine-message/partials-automatically
8922 "Internal method to combine message/partial messages automatically.")
8924 (set-atype 'mime-acting-condition
8925 '((type . "message/partial")
8926 (method . mime-combine-message/partials-automatically)
8927 (major-mode . gnus-original-article-mode)
8928 (summary-buffer-exp . gnus-summary-buffer)
8931 (set-alist 'mime-view-partial-message-method-alist
8932 'gnus-original-article-mode
8933 'gnus-mime-partial-preview-function)
8943 (run-hooks 'gnus-sum-load-hook)
8945 ;;; gnus-sum.el ends here