1 ;;; gnus-sum.el --- summary mode commands for Semi-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 :value (fun) function)
341 (cons :value ("" "") 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 ((memq mark (list gnus-unread-mark gnus-downloadable-mark
748 gnus-undownloaded-mark))
749 . gnus-summary-normal-unread-face)
751 . gnus-summary-high-read-face)
753 . gnus-summary-low-read-face)
755 . gnus-summary-normal-read-face))
756 "Controls the highlighting of summary buffer lines.
758 A list of (FORM . FACE) pairs. When deciding how a a particular
759 summary line should be displayed, each form is evaluated. The content
760 of the face field after the first true form is used. You can change
761 how those summary lines are displayed, by editing the face field.
763 You can use the following variables in the FORM field.
765 score: The articles score
766 default: The default article score.
767 below: The score below which articles are automatically marked as read.
768 mark: The articles mark."
769 :group 'gnus-summary-visual
770 :type '(repeat (cons (sexp :tag "Form" nil)
773 (defcustom gnus-alter-header-function nil
774 "Function called to allow alteration of article header structures.
775 The function is called with one parameter, the article header vector,
776 which it may alter in any way.")
778 ;;; Internal variables
780 (defvar gnus-scores-exclude-files nil)
781 (defvar gnus-page-broken nil)
783 (defvar gnus-original-article nil)
784 (defvar gnus-article-internal-prepare-hook nil)
785 (defvar gnus-newsgroup-process-stack nil)
787 (defvar gnus-thread-indent-array nil)
788 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
790 ;; Avoid highlighting in kill files.
791 (defvar gnus-summary-inhibit-highlight nil)
792 (defvar gnus-newsgroup-selected-overlay nil)
793 (defvar gnus-inhibit-limiting nil)
794 (defvar gnus-newsgroup-adaptive-score-file nil)
795 (defvar gnus-current-score-file nil)
796 (defvar gnus-current-move-group nil)
797 (defvar gnus-current-copy-group nil)
798 (defvar gnus-current-crosspost-group nil)
800 (defvar gnus-newsgroup-dependencies nil)
801 (defvar gnus-newsgroup-adaptive nil)
802 (defvar gnus-summary-display-article-function nil)
803 (defvar gnus-summary-highlight-line-function nil
804 "Function called after highlighting a summary line.")
806 (defvar gnus-summary-line-format-alist
807 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
808 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
809 (?s gnus-tmp-subject-or-nil ?s)
810 (?n gnus-tmp-name ?s)
811 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
813 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
815 (?F gnus-tmp-from ?s)
816 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
817 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
818 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
819 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
820 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
821 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
822 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
823 (?L gnus-tmp-lines ?d)
824 (?I gnus-tmp-indentation ?s)
825 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
826 (?R gnus-tmp-replied ?c)
827 (?\[ gnus-tmp-opening-bracket ?c)
828 (?\] gnus-tmp-closing-bracket ?c)
829 (?\> (make-string gnus-tmp-level ? ) ?s)
830 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
831 (?i gnus-tmp-score ?d)
832 (?z gnus-tmp-score-char ?c)
833 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
834 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
835 (?U gnus-tmp-unread ?c)
836 (?t (gnus-summary-number-of-articles-in-thread
837 (and (boundp 'thread) (car thread)) gnus-tmp-level)
839 (?e (gnus-summary-number-of-articles-in-thread
840 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
842 (?u gnus-tmp-user-defined ?s)
843 (?P (gnus-pick-line-number) ?d))
844 "An alist of format specifications that can appear in summary lines,
845 and what variables they correspond with, along with the type of the
846 variable (string, integer, character, etc).")
848 (defvar gnus-summary-dummy-line-format-alist
849 `((?S gnus-tmp-subject ?s)
850 (?N gnus-tmp-number ?d)
851 (?u gnus-tmp-user-defined ?s)))
853 (defvar gnus-summary-mode-line-format-alist
854 `((?G gnus-tmp-group-name ?s)
855 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
856 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
857 (?A gnus-tmp-article-number ?d)
858 (?Z gnus-tmp-unread-and-unselected ?s)
860 (?U gnus-tmp-unread-and-unticked ?d)
861 (?S gnus-tmp-subject ?s)
862 (?e gnus-tmp-unselected ?d)
863 (?u gnus-tmp-user-defined ?s)
864 (?d (length gnus-newsgroup-dormant) ?d)
865 (?t (length gnus-newsgroup-marked) ?d)
866 (?r (length gnus-newsgroup-reads) ?d)
867 (?E gnus-newsgroup-expunged-tally ?d)
868 (?s (gnus-current-score-file-nondirectory) ?s)))
870 (defvar gnus-last-search-regexp nil
871 "Default regexp for article search command.")
873 (defvar gnus-last-shell-command nil
874 "Default shell command on article.")
876 (defvar gnus-newsgroup-begin nil)
877 (defvar gnus-newsgroup-end nil)
878 (defvar gnus-newsgroup-last-rmail nil)
879 (defvar gnus-newsgroup-last-mail nil)
880 (defvar gnus-newsgroup-last-folder nil)
881 (defvar gnus-newsgroup-last-file nil)
882 (defvar gnus-newsgroup-auto-expire nil)
883 (defvar gnus-newsgroup-active nil)
885 (defvar gnus-newsgroup-data nil)
886 (defvar gnus-newsgroup-data-reverse nil)
887 (defvar gnus-newsgroup-limit nil)
888 (defvar gnus-newsgroup-limits nil)
890 (defvar gnus-newsgroup-unreads nil
891 "List of unread articles in the current newsgroup.")
893 (defvar gnus-newsgroup-unselected nil
894 "List of unselected unread articles in the current newsgroup.")
896 (defvar gnus-newsgroup-reads nil
897 "Alist of read articles and article marks in the current newsgroup.")
899 (defvar gnus-newsgroup-expunged-tally nil)
901 (defvar gnus-newsgroup-marked nil
902 "List of ticked articles in the current newsgroup (a subset of unread art).")
904 (defvar gnus-newsgroup-killed nil
905 "List of ranges of articles that have been through the scoring process.")
907 (defvar gnus-newsgroup-cached nil
908 "List of articles that come from the article cache.")
910 (defvar gnus-newsgroup-saved nil
911 "List of articles that have been saved.")
913 (defvar gnus-newsgroup-kill-headers nil)
915 (defvar gnus-newsgroup-replied nil
916 "List of articles that have been replied to in the current newsgroup.")
918 (defvar gnus-newsgroup-expirable nil
919 "List of articles in the current newsgroup that can be expired.")
921 (defvar gnus-newsgroup-processable nil
922 "List of articles in the current newsgroup that can be processed.")
924 (defvar gnus-newsgroup-downloadable nil
925 "List of articles in the current newsgroup that can be processed.")
927 (defvar gnus-newsgroup-undownloaded nil
928 "List of articles in the current newsgroup that haven't been downloaded..")
930 (defvar gnus-newsgroup-unsendable nil
931 "List of articles in the current newsgroup that won't be sent.")
933 (defvar gnus-newsgroup-bookmarks nil
934 "List of articles in the current newsgroup that have bookmarks.")
936 (defvar gnus-newsgroup-dormant nil
937 "List of dormant articles in the current newsgroup.")
939 (defvar gnus-newsgroup-scored nil
940 "List of scored articles in the current newsgroup.")
942 (defvar gnus-newsgroup-headers nil
943 "List of article headers in the current newsgroup.")
945 (defvar gnus-newsgroup-threads nil)
947 (defvar gnus-newsgroup-prepared nil
948 "Whether the current group has been prepared properly.")
950 (defvar gnus-newsgroup-ancient nil
951 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
953 (defvar gnus-newsgroup-sparse nil)
955 (defvar gnus-current-article nil)
956 (defvar gnus-article-current nil)
957 (defvar gnus-current-headers nil)
958 (defvar gnus-have-all-headers nil)
959 (defvar gnus-last-article nil)
960 (defvar gnus-newsgroup-history nil)
962 (defconst gnus-summary-local-variables
963 '(gnus-newsgroup-name
964 gnus-newsgroup-begin gnus-newsgroup-end
965 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
966 gnus-newsgroup-last-folder gnus-newsgroup-last-file
967 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
968 gnus-newsgroup-unselected gnus-newsgroup-marked
969 gnus-newsgroup-reads gnus-newsgroup-saved
970 gnus-newsgroup-replied gnus-newsgroup-expirable
971 gnus-newsgroup-processable gnus-newsgroup-killed
972 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
973 gnus-newsgroup-unsendable
974 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
975 gnus-newsgroup-headers gnus-newsgroup-threads
976 gnus-newsgroup-prepared gnus-summary-highlight-line-function
977 gnus-current-article gnus-current-headers gnus-have-all-headers
978 gnus-last-article gnus-article-internal-prepare-hook
979 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
980 gnus-newsgroup-scored gnus-newsgroup-kill-headers
981 gnus-thread-expunge-below
982 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
983 (gnus-summary-mark-below . global)
984 gnus-newsgroup-active gnus-scores-exclude-files
985 gnus-newsgroup-history gnus-newsgroup-ancient
986 gnus-newsgroup-sparse gnus-newsgroup-process-stack
987 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
988 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
989 (gnus-newsgroup-expunged-tally . 0)
990 gnus-cache-removable-articles gnus-newsgroup-cached
991 gnus-newsgroup-data gnus-newsgroup-data-reverse
992 gnus-newsgroup-limit gnus-newsgroup-limits)
993 "Variables that are buffer-local to the summary buffers.")
995 ;; Byte-compiler warning.
996 (defvar gnus-article-mode-map)
998 ;; Subject simplification.
1000 (defun gnus-simplify-whitespace (str)
1001 "Remove excessive whitespace."
1004 (while (string-match "[ \t][ \t]+" mystr)
1005 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1007 (substring mystr (match-end 0)))))
1009 (when (string-match "^[ \t]+" mystr)
1010 (setq mystr (substring mystr (match-end 0))))
1012 (when (string-match "[ \t]+$" mystr)
1013 (setq mystr (substring mystr 0 (match-beginning 0))))
1016 (defsubst gnus-simplify-subject-re (subject)
1017 "Remove \"Re:\" from subject lines."
1018 (if (string-match "^[Rr][Ee]: *" subject)
1019 (substring subject (match-end 0))
1022 (defun gnus-simplify-subject (subject &optional re-only)
1023 "Remove `Re:' and words in parentheses.
1024 If RE-ONLY is non-nil, strip leading `Re:'s only."
1025 (let ((case-fold-search t)) ;Ignore case.
1026 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1027 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1028 (setq subject (substring subject (match-end 0))))
1029 ;; Remove uninteresting prefixes.
1030 (when (and (not re-only)
1031 gnus-simplify-ignored-prefixes
1032 (string-match gnus-simplify-ignored-prefixes subject))
1033 (setq subject (substring subject (match-end 0))))
1034 ;; Remove words in parentheses from end.
1036 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1037 (setq subject (substring subject 0 (match-beginning 0)))))
1038 ;; Return subject string.
1041 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1043 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1044 (goto-char (point-min))
1045 (while (re-search-forward regexp nil t)
1046 (replace-match (or newtext ""))))
1048 (defun gnus-simplify-buffer-fuzzy ()
1049 "Simplify string in the buffer fuzzily.
1050 The string in the accessible portion of the current buffer is simplified.
1051 It is assumed to be a single-line subject.
1052 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1053 matter is removed. Additional things can be deleted by setting
1054 gnus-simplify-subject-fuzzy-regexp."
1055 (let ((case-fold-search t)
1057 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1059 (while (not (eq modified-tick (buffer-modified-tick)))
1060 (setq modified-tick (buffer-modified-tick))
1062 ((listp gnus-simplify-subject-fuzzy-regexp)
1063 (mapcar 'gnus-simplify-buffer-fuzzy-step
1064 gnus-simplify-subject-fuzzy-regexp))
1065 (gnus-simplify-subject-fuzzy-regexp
1066 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1067 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1068 (gnus-simplify-buffer-fuzzy-step
1069 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1070 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1072 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1073 (gnus-simplify-buffer-fuzzy-step " +" " ")
1074 (gnus-simplify-buffer-fuzzy-step " $")
1075 (gnus-simplify-buffer-fuzzy-step "^ +")))
1077 (defun gnus-simplify-subject-fuzzy (subject)
1078 "Simplify a subject string fuzzily.
1079 See `gnus-simplify-buffer-fuzzy' for details."
1081 (gnus-set-work-buffer)
1082 (let ((case-fold-search t))
1084 (inline (gnus-simplify-buffer-fuzzy))
1087 (defsubst gnus-simplify-subject-fully (subject)
1088 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1090 (gnus-simplify-subject-functions
1091 (gnus-map-function gnus-simplify-subject-functions subject))
1092 ((null gnus-summary-gather-subject-limit)
1093 (gnus-simplify-subject-re subject))
1094 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1095 (gnus-simplify-subject-fuzzy subject))
1096 ((numberp gnus-summary-gather-subject-limit)
1097 (gnus-limit-string (gnus-simplify-subject-re subject)
1098 gnus-summary-gather-subject-limit))
1102 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1103 "Check whether two subjects are equal.
1104 If optional argument simple-first is t, first argument is already
1107 ((null simple-first)
1108 (equal (gnus-simplify-subject-fully s1)
1109 (gnus-simplify-subject-fully s2)))
1112 (gnus-simplify-subject-fully s2)))))
1114 (defun gnus-summary-bubble-group ()
1115 "Increase the score of the current group.
1116 This is a handy function to add to `gnus-summary-exit-hook' to
1117 increase the score of each group you read."
1118 (gnus-group-add-score gnus-newsgroup-name))
1122 ;;; Gnus summary mode
1125 (put 'gnus-summary-mode 'mode-class 'special)
1128 ;; Non-orthogonal keys
1130 (gnus-define-keys gnus-summary-mode-map
1131 " " gnus-summary-next-page
1132 "\177" gnus-summary-prev-page
1133 [delete] gnus-summary-prev-page
1134 [backspace] gnus-summary-prev-page
1135 "\r" gnus-summary-scroll-up
1136 "\e\r" gnus-summary-scroll-down
1137 "n" gnus-summary-next-unread-article
1138 "p" gnus-summary-prev-unread-article
1139 "N" gnus-summary-next-article
1140 "P" gnus-summary-prev-article
1141 "\M-\C-n" gnus-summary-next-same-subject
1142 "\M-\C-p" gnus-summary-prev-same-subject
1143 "\M-n" gnus-summary-next-unread-subject
1144 "\M-p" gnus-summary-prev-unread-subject
1145 "." gnus-summary-first-unread-article
1146 "," gnus-summary-best-unread-article
1147 "\M-s" gnus-summary-search-article-forward
1148 "\M-r" gnus-summary-search-article-backward
1149 "<" gnus-summary-beginning-of-article
1150 ">" gnus-summary-end-of-article
1151 "j" gnus-summary-goto-article
1152 "^" gnus-summary-refer-parent-article
1153 "\M-^" gnus-summary-refer-article
1154 "u" gnus-summary-tick-article-forward
1155 "!" gnus-summary-tick-article-forward
1156 "U" gnus-summary-tick-article-backward
1157 "d" gnus-summary-mark-as-read-forward
1158 "D" gnus-summary-mark-as-read-backward
1159 "E" gnus-summary-mark-as-expirable
1160 "\M-u" gnus-summary-clear-mark-forward
1161 "\M-U" gnus-summary-clear-mark-backward
1162 "k" gnus-summary-kill-same-subject-and-select
1163 "\C-k" gnus-summary-kill-same-subject
1164 "\M-\C-k" gnus-summary-kill-thread
1165 "\M-\C-l" gnus-summary-lower-thread
1166 "e" gnus-summary-edit-article
1167 "#" gnus-summary-mark-as-processable
1168 "\M-#" gnus-summary-unmark-as-processable
1169 "\M-\C-t" gnus-summary-toggle-threads
1170 "\M-\C-s" gnus-summary-show-thread
1171 "\M-\C-h" gnus-summary-hide-thread
1172 "\M-\C-f" gnus-summary-next-thread
1173 "\M-\C-b" gnus-summary-prev-thread
1174 "\M-\C-u" gnus-summary-up-thread
1175 "\M-\C-d" gnus-summary-down-thread
1176 "&" gnus-summary-execute-command
1177 "c" gnus-summary-catchup-and-exit
1178 "\C-w" gnus-summary-mark-region-as-read
1179 "\C-t" gnus-summary-toggle-truncation
1180 "?" gnus-summary-mark-as-dormant
1181 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1182 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1183 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1184 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1185 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1186 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1187 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1188 "=" gnus-summary-expand-window
1189 "\C-x\C-s" gnus-summary-reselect-current-group
1190 "\M-g" gnus-summary-rescan-group
1191 "w" gnus-summary-stop-page-breaking
1192 "\C-c\C-r" gnus-summary-caesar-message
1193 "\M-t" gnus-summary-toggle-mime
1194 "f" gnus-summary-followup
1195 "F" gnus-summary-followup-with-original
1196 "C" gnus-summary-cancel-article
1197 "r" gnus-summary-reply
1198 "R" gnus-summary-reply-with-original
1199 "\C-c\C-f" gnus-summary-mail-forward
1200 "o" gnus-summary-save-article
1201 "\C-o" gnus-summary-save-article-mail
1202 "|" gnus-summary-pipe-output
1203 "\M-k" gnus-summary-edit-local-kill
1204 "\M-K" gnus-summary-edit-global-kill
1206 "\C-c\C-d" gnus-summary-describe-group
1207 "q" gnus-summary-exit
1208 "Q" gnus-summary-exit-no-update
1209 "\C-c\C-i" gnus-info-find-node
1210 gnus-mouse-2 gnus-mouse-pick-article
1211 "m" gnus-summary-mail-other-window
1212 "a" gnus-summary-post-news
1213 "x" gnus-summary-limit-to-unread
1214 "s" gnus-summary-isearch-article
1215 "t" gnus-article-hide-headers
1216 "g" gnus-summary-show-article
1217 "l" gnus-summary-goto-last-article
1218 "v" gnus-summary-preview-mime-message
1219 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1220 "\C-d" gnus-summary-enter-digest-group
1221 "\M-\C-d" gnus-summary-read-document
1223 "*" gnus-cache-enter-article
1224 "\M-*" gnus-cache-remove-article
1225 "\M-&" gnus-summary-universal-argument
1226 "\C-l" gnus-recenter
1227 "I" gnus-summary-increase-score
1228 "L" gnus-summary-lower-score
1229 "\M-i" gnus-symbolic-argument
1230 "h" gnus-summary-select-article-buffer
1232 "V" gnus-summary-score-map
1233 "X" gnus-uu-extract-map
1234 "S" gnus-summary-send-map)
1236 ;; Sort of orthogonal keymap
1237 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1238 "t" gnus-summary-tick-article-forward
1239 "!" gnus-summary-tick-article-forward
1240 "d" gnus-summary-mark-as-read-forward
1241 "r" gnus-summary-mark-as-read-forward
1242 "c" gnus-summary-clear-mark-forward
1243 " " gnus-summary-clear-mark-forward
1244 "e" gnus-summary-mark-as-expirable
1245 "x" gnus-summary-mark-as-expirable
1246 "?" gnus-summary-mark-as-dormant
1247 "b" gnus-summary-set-bookmark
1248 "B" gnus-summary-remove-bookmark
1249 "#" gnus-summary-mark-as-processable
1250 "\M-#" gnus-summary-unmark-as-processable
1251 "S" gnus-summary-limit-include-expunged
1252 "C" gnus-summary-catchup
1253 "H" gnus-summary-catchup-to-here
1254 "\C-c" gnus-summary-catchup-all
1255 "k" gnus-summary-kill-same-subject-and-select
1256 "K" gnus-summary-kill-same-subject
1257 "P" gnus-uu-mark-map)
1259 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1260 "c" gnus-summary-clear-above
1261 "u" gnus-summary-tick-above
1262 "m" gnus-summary-mark-above
1263 "k" gnus-summary-kill-below)
1265 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1266 "/" gnus-summary-limit-to-subject
1267 "n" gnus-summary-limit-to-articles
1268 "w" gnus-summary-pop-limit
1269 "s" gnus-summary-limit-to-subject
1270 "a" gnus-summary-limit-to-author
1271 "u" gnus-summary-limit-to-unread
1272 "m" gnus-summary-limit-to-marks
1273 "v" gnus-summary-limit-to-score
1274 "*" gnus-summary-limit-include-cached
1275 "D" gnus-summary-limit-include-dormant
1276 "T" gnus-summary-limit-include-thread
1277 "d" gnus-summary-limit-exclude-dormant
1278 "t" gnus-summary-limit-to-age
1279 "E" gnus-summary-limit-include-expunged
1280 "c" gnus-summary-limit-exclude-childless-dormant
1281 "C" gnus-summary-limit-mark-excluded-as-read)
1283 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1284 "n" gnus-summary-next-unread-article
1285 "p" gnus-summary-prev-unread-article
1286 "N" gnus-summary-next-article
1287 "P" gnus-summary-prev-article
1288 "\C-n" gnus-summary-next-same-subject
1289 "\C-p" gnus-summary-prev-same-subject
1290 "\M-n" gnus-summary-next-unread-subject
1291 "\M-p" gnus-summary-prev-unread-subject
1292 "f" gnus-summary-first-unread-article
1293 "b" gnus-summary-best-unread-article
1294 "j" gnus-summary-goto-article
1295 "g" gnus-summary-goto-subject
1296 "l" gnus-summary-goto-last-article
1297 "o" gnus-summary-pop-article)
1299 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1300 "k" gnus-summary-kill-thread
1301 "l" gnus-summary-lower-thread
1302 "i" gnus-summary-raise-thread
1303 "T" gnus-summary-toggle-threads
1304 "t" gnus-summary-rethread-current
1305 "^" gnus-summary-reparent-thread
1306 "s" gnus-summary-show-thread
1307 "S" gnus-summary-show-all-threads
1308 "h" gnus-summary-hide-thread
1309 "H" gnus-summary-hide-all-threads
1310 "n" gnus-summary-next-thread
1311 "p" gnus-summary-prev-thread
1312 "u" gnus-summary-up-thread
1313 "o" gnus-summary-top-thread
1314 "d" gnus-summary-down-thread
1315 "#" gnus-uu-mark-thread
1316 "\M-#" gnus-uu-unmark-thread)
1318 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1319 "g" gnus-summary-prepare
1320 "c" gnus-summary-insert-cached-articles)
1322 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1323 "c" gnus-summary-catchup-and-exit
1324 "C" gnus-summary-catchup-all-and-exit
1325 "E" gnus-summary-exit-no-update
1326 "Q" gnus-summary-exit
1327 "Z" gnus-summary-exit
1328 "n" gnus-summary-catchup-and-goto-next-group
1329 "R" gnus-summary-reselect-current-group
1330 "G" gnus-summary-rescan-group
1331 "N" gnus-summary-next-group
1332 "s" gnus-summary-save-newsrc
1333 "P" gnus-summary-prev-group)
1335 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1336 " " gnus-summary-next-page
1337 "n" gnus-summary-next-page
1338 "\177" gnus-summary-prev-page
1339 [delete] gnus-summary-prev-page
1340 "p" gnus-summary-prev-page
1341 "\r" gnus-summary-scroll-up
1342 "<" gnus-summary-beginning-of-article
1343 ">" gnus-summary-end-of-article
1344 "b" gnus-summary-beginning-of-article
1345 "e" gnus-summary-end-of-article
1346 "^" gnus-summary-refer-parent-article
1347 "r" gnus-summary-refer-parent-article
1348 "R" gnus-summary-refer-references
1349 "T" gnus-summary-refer-thread
1350 "g" gnus-summary-show-article
1351 "s" gnus-summary-isearch-article
1352 "P" gnus-summary-print-article)
1354 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1355 "b" gnus-article-add-buttons
1356 "B" gnus-article-add-buttons-to-head
1357 "o" gnus-article-treat-overstrike
1358 "e" gnus-article-emphasize
1359 "w" gnus-article-fill-cited-article
1360 "c" gnus-article-remove-cr
1361 "q" gnus-article-de-quoted-unreadable
1362 "f" gnus-article-display-x-face
1363 "l" gnus-summary-stop-page-breaking
1364 "r" gnus-summary-caesar-message
1365 "t" gnus-article-hide-headers
1366 "v" gnus-summary-verbose-headers
1367 "m" gnus-summary-toggle-mime
1368 "h" gnus-article-treat-html
1369 "d" gnus-article-treat-dumbquotes)
1371 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1372 "a" gnus-article-hide
1373 "h" gnus-article-hide-headers
1374 "b" gnus-article-hide-boring-headers
1375 "s" gnus-article-hide-signature
1376 "c" gnus-article-hide-citation
1377 "p" gnus-article-hide-pgp
1378 "P" gnus-article-hide-pem
1379 "\C-c" gnus-article-hide-citation-maybe)
1381 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1382 "a" gnus-article-highlight
1383 "h" gnus-article-highlight-headers
1384 "c" gnus-article-highlight-citation
1385 "s" gnus-article-highlight-signature)
1387 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1388 "z" gnus-article-date-ut
1389 "u" gnus-article-date-ut
1390 "l" gnus-article-date-local
1391 "e" gnus-article-date-lapsed
1392 "o" gnus-article-date-original
1393 "s" gnus-article-date-user)
1395 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1396 "t" gnus-article-remove-trailing-blank-lines
1397 "l" gnus-article-strip-leading-blank-lines
1398 "m" gnus-article-strip-multiple-blank-lines
1399 "a" gnus-article-strip-blank-lines
1400 "s" gnus-article-strip-leading-space)
1402 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1404 "f" gnus-summary-fetch-faq
1405 "d" gnus-summary-describe-group
1406 "h" gnus-summary-describe-briefly
1407 "i" gnus-info-find-node)
1409 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1410 "e" gnus-summary-expire-articles
1411 "\M-\C-e" gnus-summary-expire-articles-now
1412 "\177" gnus-summary-delete-article
1413 [delete] gnus-summary-delete-article
1414 "m" gnus-summary-move-article
1415 "r" gnus-summary-respool-article
1416 "w" gnus-summary-edit-article
1417 "c" gnus-summary-copy-article
1418 "B" gnus-summary-crosspost-article
1419 "q" gnus-summary-respool-query
1420 "i" gnus-summary-import-article
1421 "p" gnus-summary-article-posted-p)
1423 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1424 "o" gnus-summary-save-article
1425 "m" gnus-summary-save-article-mail
1426 "F" gnus-summary-write-article-file
1427 "r" gnus-summary-save-article-rmail
1428 "f" gnus-summary-save-article-file
1429 "b" gnus-summary-save-article-body-file
1430 "h" gnus-summary-save-article-folder
1431 "v" gnus-summary-save-article-vm
1432 "p" gnus-summary-pipe-output
1433 "s" gnus-soup-add-article))
1435 (defun gnus-summary-make-menu-bar ()
1436 (gnus-turn-off-edit-menu 'summary)
1438 (unless (boundp 'gnus-summary-misc-menu)
1441 gnus-summary-kill-menu gnus-summary-mode-map ""
1446 ["Enter score..." gnus-summary-score-entry t]
1447 ["Customize" gnus-score-customize t])
1448 (gnus-make-score-map 'increase)
1449 (gnus-make-score-map 'lower)
1451 ["Kill below" gnus-summary-kill-below t]
1452 ["Mark above" gnus-summary-mark-above t]
1453 ["Tick above" gnus-summary-tick-above t]
1454 ["Clear above" gnus-summary-clear-above t])
1455 ["Current score" gnus-summary-current-score t]
1456 ["Set score" gnus-summary-set-score t]
1457 ["Switch current score file..." gnus-score-change-score-file t]
1458 ["Set mark below..." gnus-score-set-mark-below t]
1459 ["Set expunge below..." gnus-score-set-expunge-below t]
1460 ["Edit current score file" gnus-score-edit-current-scores t]
1461 ["Edit score file" gnus-score-edit-file t]
1462 ["Trace score" gnus-score-find-trace t]
1463 ["Find words" gnus-score-find-favourite-words t]
1464 ["Rescore buffer" gnus-summary-rescore t]
1465 ["Increase score..." gnus-summary-increase-score t]
1466 ["Lower score..." gnus-summary-lower-score t]))))
1469 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1471 :selected (null gnus-score-default-header)]
1472 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1474 :selected (eq gnus-score-default-header 'a)]
1475 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1477 :selected (eq gnus-score-default-header 's)]
1479 (gnus-score-set-default 'gnus-score-default-header 'b)
1481 :selected (eq gnus-score-default-header 'b )]
1483 (gnus-score-set-default 'gnus-score-default-header 'h)
1485 :selected (eq gnus-score-default-header 'h )]
1486 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1488 :selected (eq gnus-score-default-header 'i )]
1489 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1491 :selected (eq gnus-score-default-header 't )]
1493 (gnus-score-set-default 'gnus-score-default-header 'x)
1495 :selected (eq gnus-score-default-header 'x )]
1496 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1498 :selected (eq gnus-score-default-header 'l )]
1499 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1501 :selected (eq gnus-score-default-header 'd )]
1502 ["Followups to author"
1503 (gnus-score-set-default 'gnus-score-default-header 'f)
1505 :selected (eq gnus-score-default-header 'f )])
1507 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1509 :selected (null gnus-score-default-type)]
1510 ;; The `:active' key is commented out in the following,
1511 ;; because the GNU Emacs hack to support radio buttons use
1512 ;; active to indicate which button is selected.
1513 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1515 ;; :active (not (memq gnus-score-default-header '(l d)))
1516 :selected (eq gnus-score-default-type 's)]
1517 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1519 ;; :active (not (memq gnus-score-default-header '(l d)))
1520 :selected (eq gnus-score-default-type 'r)]
1521 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1523 ;; :active (not (memq gnus-score-default-header '(l d)))
1524 :selected (eq gnus-score-default-type 'e)]
1525 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1527 ;; :active (not (memq gnus-score-default-header '(l d)))
1528 :selected (eq gnus-score-default-type 'f)]
1529 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1531 ;; :active (eq (gnus-score-default-header 'd))
1532 :selected (eq gnus-score-default-type 'b)]
1533 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1535 ;; :active (eq (gnus-score-default-header 'd))
1536 :selected (eq gnus-score-default-type 'n)]
1537 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1539 ;; :active (eq (gnus-score-default-header 'd))
1540 :selected (eq gnus-score-default-type 'a)]
1542 (gnus-score-set-default 'gnus-score-default-type '<)
1544 ;; :active (eq (gnus-score-default-header 'l))
1545 :selected (eq gnus-score-default-type '<)]
1547 (gnus-score-set-default 'gnus-score-default-type '=)
1549 ;; :active (eq (gnus-score-default-header 'l))
1550 :selected (eq gnus-score-default-type '=)]
1551 ["Greater than number"
1552 (gnus-score-set-default 'gnus-score-default-type '>)
1554 ;; :active (eq (gnus-score-default-header 'l))
1555 :selected (eq gnus-score-default-type '>)])
1556 ["Default fold" gnus-score-default-fold-toggle
1558 :selected gnus-score-default-fold]
1560 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1562 :selected (null gnus-score-default-duration)]
1564 (gnus-score-set-default 'gnus-score-default-duration 'p)
1566 :selected (eq gnus-score-default-duration 'p)]
1568 (gnus-score-set-default 'gnus-score-default-duration 't)
1570 :selected (eq gnus-score-default-duration 't)]
1572 (gnus-score-set-default 'gnus-score-default-duration 'i)
1574 :selected (eq gnus-score-default-duration 'i)]))
1577 gnus-summary-article-menu gnus-summary-mode-map ""
1580 ["All" gnus-article-hide t]
1581 ["Headers" gnus-article-hide-headers t]
1582 ["Signature" gnus-article-hide-signature t]
1583 ["Citation" gnus-article-hide-citation t]
1584 ["PGP" gnus-article-hide-pgp t]
1585 ["Boring headers" gnus-article-hide-boring-headers t])
1587 ["All" gnus-article-highlight t]
1588 ["Headers" gnus-article-highlight-headers t]
1589 ["Signature" gnus-article-highlight-signature t]
1590 ["Citation" gnus-article-highlight-citation t])
1592 ["Local" gnus-article-date-local t]
1593 ["UT" gnus-article-date-ut t]
1594 ["Original" gnus-article-date-original t]
1595 ["Lapsed" gnus-article-date-lapsed t]
1596 ["User-defined" gnus-article-date-user t])
1599 ["Leading" gnus-article-strip-leading-blank-lines t]
1600 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1601 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1602 ["All of the above" gnus-article-strip-blank-lines t]
1603 ["Leading space" gnus-article-strip-leading-space t])
1604 ["Overstrike" gnus-article-treat-overstrike t]
1605 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1606 ["Emphasis" gnus-article-emphasize t]
1607 ["Word wrap" gnus-article-fill-cited-article t]
1608 ["CR" gnus-article-remove-cr t]
1609 ["Show X-Face" gnus-article-display-x-face t]
1610 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1611 ["UnHTMLize" gnus-article-treat-html t]
1612 ["Rot 13" gnus-summary-caesar-message t]
1613 ["Unix pipe" gnus-summary-pipe-message t]
1614 ["Add buttons" gnus-article-add-buttons t]
1615 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1616 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1617 ["Toggle MIME" gnus-summary-toggle-mime t]
1618 ["Verbose header" gnus-summary-verbose-headers t]
1619 ["Toggle header" gnus-summary-toggle-header t])
1621 ["Save in default format" gnus-summary-save-article t]
1622 ["Save in file" gnus-summary-save-article-file t]
1623 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1624 ["Save in MH folder" gnus-summary-save-article-folder t]
1625 ["Save in VM folder" gnus-summary-save-article-vm t]
1626 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1627 ["Save body in file" gnus-summary-save-article-body-file t]
1628 ["Pipe through a filter" gnus-summary-pipe-output t]
1629 ["Add to SOUP packet" gnus-soup-add-article t]
1630 ["Print" gnus-summary-print-article t])
1632 ["Respool article..." gnus-summary-respool-article t]
1633 ["Move article..." gnus-summary-move-article
1634 (gnus-check-backend-function
1635 'request-move-article gnus-newsgroup-name)]
1636 ["Copy article..." gnus-summary-copy-article t]
1637 ["Crosspost article..." gnus-summary-crosspost-article
1638 (gnus-check-backend-function
1639 'request-replace-article gnus-newsgroup-name)]
1640 ["Import file..." gnus-summary-import-article t]
1641 ["Check if posted" gnus-summary-article-posted-p t]
1642 ["Edit article" gnus-summary-edit-article
1643 (not (gnus-group-read-only-p))]
1644 ["Delete article" gnus-summary-delete-article
1645 (gnus-check-backend-function
1646 'request-expire-articles gnus-newsgroup-name)]
1647 ["Query respool" gnus-summary-respool-query t]
1648 ["Delete expirable articles" gnus-summary-expire-articles-now
1649 (gnus-check-backend-function
1650 'request-expire-articles gnus-newsgroup-name)])
1652 ["Uudecode" gnus-uu-decode-uu t]
1653 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1654 ["Unshar" gnus-uu-decode-unshar t]
1655 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1656 ["Save" gnus-uu-decode-save t]
1657 ["Binhex" gnus-uu-decode-binhex t]
1658 ["Postscript" gnus-uu-decode-postscript t])
1660 ["Enter article" gnus-cache-enter-article t]
1661 ["Remove article" gnus-cache-remove-article t])
1662 ["Select article buffer" gnus-summary-select-article-buffer t]
1663 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1664 ["Isearch article..." gnus-summary-isearch-article t]
1665 ["Beginning of the article" gnus-summary-beginning-of-article t]
1666 ["End of the article" gnus-summary-end-of-article t]
1667 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1668 ["Fetch referenced articles" gnus-summary-refer-references t]
1669 ["Fetch current thread" gnus-summary-refer-thread t]
1670 ["Fetch article with id..." gnus-summary-refer-article t]
1671 ["Redisplay" gnus-summary-show-article t]))
1674 gnus-summary-thread-menu gnus-summary-mode-map ""
1676 ["Toggle threading" gnus-summary-toggle-threads t]
1677 ["Hide threads" gnus-summary-hide-all-threads t]
1678 ["Show threads" gnus-summary-show-all-threads t]
1679 ["Hide thread" gnus-summary-hide-thread t]
1680 ["Show thread" gnus-summary-show-thread t]
1681 ["Go to next thread" gnus-summary-next-thread t]
1682 ["Go to previous thread" gnus-summary-prev-thread t]
1683 ["Go down thread" gnus-summary-down-thread t]
1684 ["Go up thread" gnus-summary-up-thread t]
1685 ["Top of thread" gnus-summary-top-thread t]
1686 ["Mark thread as read" gnus-summary-kill-thread t]
1687 ["Lower thread score" gnus-summary-lower-thread t]
1688 ["Raise thread score" gnus-summary-raise-thread t]
1689 ["Rethread current" gnus-summary-rethread-current t]
1693 gnus-summary-post-menu gnus-summary-mode-map ""
1695 ["Post an article" gnus-summary-post-news t]
1696 ["Followup" gnus-summary-followup t]
1697 ["Followup and yank" gnus-summary-followup-with-original t]
1698 ["Supersede article" gnus-summary-supersede-article t]
1699 ["Cancel article" gnus-summary-cancel-article t]
1700 ["Reply" gnus-summary-reply t]
1701 ["Reply and yank" gnus-summary-reply-with-original t]
1702 ["Wide reply" gnus-summary-wide-reply t]
1703 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1704 ["Mail forward" gnus-summary-mail-forward t]
1705 ["Post forward" gnus-summary-post-forward t]
1706 ["Digest and mail" gnus-uu-digest-mail-forward t]
1707 ["Digest and post" gnus-uu-digest-post-forward t]
1708 ["Resend message" gnus-summary-resend-message t]
1709 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1710 ["Send a mail" gnus-summary-mail-other-window t]
1711 ["Uuencode and post" gnus-uu-post-news t]
1712 ["Followup via news" gnus-summary-followup-to-mail t]
1713 ["Followup via news and yank"
1714 gnus-summary-followup-to-mail-with-original t]
1716 ;;["Send" gnus-summary-send-draft t]
1717 ;;["Send bounced" gnus-resend-bounced-mail t])
1721 gnus-summary-misc-menu gnus-summary-mode-map ""
1724 ["Mark as read" gnus-summary-mark-as-read-forward t]
1725 ["Mark same subject and select"
1726 gnus-summary-kill-same-subject-and-select t]
1727 ["Mark same subject" gnus-summary-kill-same-subject t]
1728 ["Catchup" gnus-summary-catchup t]
1729 ["Catchup all" gnus-summary-catchup-all t]
1730 ["Catchup to here" gnus-summary-catchup-to-here t]
1731 ["Catchup region" gnus-summary-mark-region-as-read t]
1732 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1734 ["Tick" gnus-summary-tick-article-forward t]
1735 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1736 ["Remove marks" gnus-summary-clear-mark-forward t]
1737 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1738 ["Set bookmark" gnus-summary-set-bookmark t]
1739 ["Remove bookmark" gnus-summary-remove-bookmark t])
1741 ["Marks..." gnus-summary-limit-to-marks t]
1742 ["Subject..." gnus-summary-limit-to-subject t]
1743 ["Author..." gnus-summary-limit-to-author t]
1744 ["Age..." gnus-summary-limit-to-age t]
1745 ["Score" gnus-summary-limit-to-score t]
1746 ["Unread" gnus-summary-limit-to-unread t]
1747 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1748 ["Articles" gnus-summary-limit-to-articles t]
1749 ["Pop limit" gnus-summary-pop-limit t]
1750 ["Show dormant" gnus-summary-limit-include-dormant t]
1751 ["Hide childless dormant"
1752 gnus-summary-limit-exclude-childless-dormant t]
1753 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1754 ["Show expunged" gnus-summary-show-all-expunged t])
1756 ["Set mark" gnus-summary-mark-as-processable t]
1757 ["Remove mark" gnus-summary-unmark-as-processable t]
1758 ["Remove all marks" gnus-summary-unmark-all-processable t]
1759 ["Mark above" gnus-uu-mark-over t]
1760 ["Mark series" gnus-uu-mark-series t]
1761 ["Mark region" gnus-uu-mark-region t]
1762 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1763 ["Mark all" gnus-uu-mark-all t]
1764 ["Mark buffer" gnus-uu-mark-buffer t]
1765 ["Mark sparse" gnus-uu-mark-sparse t]
1766 ["Mark thread" gnus-uu-mark-thread t]
1767 ["Unmark thread" gnus-uu-unmark-thread t]
1768 ("Process Mark Sets"
1769 ["Kill" gnus-summary-kill-process-mark t]
1770 ["Yank" gnus-summary-yank-process-mark
1771 gnus-newsgroup-process-stack]
1772 ["Save" gnus-summary-save-process-mark t]))
1774 ["Page forward" gnus-summary-next-page t]
1775 ["Page backward" gnus-summary-prev-page t]
1776 ["Line forward" gnus-summary-scroll-up t])
1778 ["Next unread article" gnus-summary-next-unread-article t]
1779 ["Previous unread article" gnus-summary-prev-unread-article t]
1780 ["Next article" gnus-summary-next-article t]
1781 ["Previous article" gnus-summary-prev-article t]
1782 ["Next unread subject" gnus-summary-next-unread-subject t]
1783 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1784 ["Next article same subject" gnus-summary-next-same-subject t]
1785 ["Previous article same subject" gnus-summary-prev-same-subject t]
1786 ["First unread article" gnus-summary-first-unread-article t]
1787 ["Best unread article" gnus-summary-best-unread-article t]
1788 ["Go to subject number..." gnus-summary-goto-subject t]
1789 ["Go to article number..." gnus-summary-goto-article t]
1790 ["Go to the last article" gnus-summary-goto-last-article t]
1791 ["Pop article off history" gnus-summary-pop-article t])
1793 ["Sort by number" gnus-summary-sort-by-number t]
1794 ["Sort by author" gnus-summary-sort-by-author t]
1795 ["Sort by subject" gnus-summary-sort-by-subject t]
1796 ["Sort by date" gnus-summary-sort-by-date t]
1797 ["Sort by score" gnus-summary-sort-by-score t]
1798 ["Sort by lines" gnus-summary-sort-by-lines t])
1800 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1801 ["Describe group" gnus-summary-describe-group t]
1802 ["Read manual" gnus-info-find-node t])
1804 ["Pick and read" gnus-pick-mode t]
1805 ["Binary" gnus-binary-mode t])
1807 ["Regenerate" gnus-summary-prepare t]
1808 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1809 ["Toggle threading" gnus-summary-toggle-threads t])
1810 ["Filter articles..." gnus-summary-execute-command t]
1811 ["Run command on subjects..." gnus-summary-universal-argument t]
1812 ["Search articles forward..." gnus-summary-search-article-forward t]
1813 ["Search articles backward..." gnus-summary-search-article-backward t]
1814 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1815 ["Expand window" gnus-summary-expand-window t]
1816 ["Expire expirable articles" gnus-summary-expire-articles
1817 (gnus-check-backend-function
1818 'request-expire-articles gnus-newsgroup-name)]
1819 ["Edit local kill file" gnus-summary-edit-local-kill t]
1820 ["Edit main kill file" gnus-summary-edit-global-kill t]
1822 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1823 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1824 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1825 ["Exit group" gnus-summary-exit t]
1826 ["Exit group without updating" gnus-summary-exit-no-update t]
1827 ["Exit and goto next group" gnus-summary-next-group t]
1828 ["Exit and goto prev group" gnus-summary-prev-group t]
1829 ["Reselect group" gnus-summary-reselect-current-group t]
1830 ["Rescan group" gnus-summary-rescan-group t]
1831 ["Update dribble" gnus-summary-save-newsrc t])))
1833 (run-hooks 'gnus-summary-menu-hook)))
1835 (defun gnus-score-set-default (var value)
1836 "A version of set that updates the GNU Emacs menu-bar."
1838 ;; It is the message that forces the active status to be updated.
1841 (defun gnus-make-score-map (type)
1842 "Make a summary score map of type TYPE."
1845 (let ((headers '(("author" "from" string)
1846 ("subject" "subject" string)
1847 ("article body" "body" string)
1848 ("article head" "head" string)
1849 ("xref" "xref" string)
1850 ("lines" "lines" number)
1851 ("followups to author" "followup" string)))
1852 (types '((number ("less than" <)
1855 (string ("substring" s)
1859 (perms '(("temporary" (current-time-string))
1867 (if (eq type 'lower)
1872 (setq header (car headers))
1878 (let ((ts (cdr (assoc (nth 2 header) types)))
1894 'gnus-summary-score-entry
1896 (if (or (string= (nth 1 header)
1898 (string= (nth 1 header)
1901 (list 'gnus-summary-header
1903 (list 'quote (nth 1 (car ts)))
1904 (list 'gnus-score-default nil)
1910 (list (nreverse outp))))
1913 (list (nreverse outt))))
1915 (setq headers (cdr headers)))
1916 (list (nreverse outh))))))))
1920 (defun gnus-summary-mode (&optional group)
1921 "Major mode for reading articles.
1923 All normal editing commands are switched off.
1924 \\<gnus-summary-mode-map>
1925 Each line in this buffer represents one article. To read an
1926 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1927 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1930 You can also post articles and send mail from this buffer. To
1931 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1932 of an article, type `\\[gnus-summary-reply]'.
1934 There are approx. one gazillion commands you can execute in this
1935 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1937 The following commands are available:
1939 \\{gnus-summary-mode-map}"
1941 (when (gnus-visual-p 'summary-menu 'menu)
1942 (gnus-summary-make-menu-bar))
1943 (kill-all-local-variables)
1944 (gnus-summary-make-local-variables)
1945 (gnus-make-thread-indent-array)
1946 (gnus-simplify-mode-line)
1947 (setq major-mode 'gnus-summary-mode)
1948 (setq mode-name "Summary")
1949 (make-local-variable 'minor-mode-alist)
1950 (use-local-map gnus-summary-mode-map)
1951 (buffer-disable-undo (current-buffer))
1952 (setq buffer-read-only t) ;Disable modification
1953 (setq truncate-lines t)
1954 (setq selective-display t)
1955 (setq selective-display-ellipses t) ;Display `...'
1956 (gnus-summary-set-display-table)
1957 (gnus-set-default-directory)
1958 (setq gnus-newsgroup-name group)
1959 (make-local-variable 'gnus-summary-line-format)
1960 (make-local-variable 'gnus-summary-line-format-spec)
1961 (make-local-variable 'gnus-summary-dummy-line-format)
1962 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1963 (make-local-variable 'gnus-summary-mark-positions)
1964 (make-local-hook 'post-command-hook)
1965 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1966 (make-local-hook 'pre-command-hook)
1967 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1968 (run-hooks 'gnus-summary-mode-hook)
1969 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1970 (gnus-update-summary-mark-positions))
1972 (defun gnus-summary-make-local-variables ()
1973 "Make all the local summary buffer variables."
1974 (let ((locals gnus-summary-local-variables)
1976 (while (setq local (pop locals))
1979 (if (eq (cdr local) 'global)
1980 ;; Copy the global value of the variable.
1981 (setq global (symbol-value (car local)))
1982 ;; Use the value from the list.
1983 (setq global (eval (cdr local))))
1984 (make-local-variable (car local))
1985 (set (car local) global))
1986 ;; Simple nil-valued local variable.
1987 (make-local-variable local)
1990 (defun gnus-summary-clear-local-variables ()
1991 (let ((locals gnus-summary-local-variables))
1993 (if (consp (car locals))
1994 (and (vectorp (caar locals))
1995 (set (caar locals) nil))
1996 (and (vectorp (car locals))
1997 (set (car locals) nil)))
1998 (setq locals (cdr locals)))))
2000 ;; Summary data functions.
2002 (defmacro gnus-data-number (data)
2005 (defmacro gnus-data-set-number (data number)
2006 `(setcar ,data ,number))
2008 (defmacro gnus-data-mark (data)
2011 (defmacro gnus-data-set-mark (data mark)
2012 `(setcar (nthcdr 1 ,data) ,mark))
2014 (defmacro gnus-data-pos (data)
2017 (defmacro gnus-data-set-pos (data pos)
2018 `(setcar (nthcdr 2 ,data) ,pos))
2020 (defmacro gnus-data-header (data)
2023 (defmacro gnus-data-set-header (data header)
2024 `(setf (nth 3 ,data) ,header))
2026 (defmacro gnus-data-level (data)
2029 (defmacro gnus-data-unread-p (data)
2030 `(= (nth 1 ,data) gnus-unread-mark))
2032 (defmacro gnus-data-read-p (data)
2033 `(/= (nth 1 ,data) gnus-unread-mark))
2035 (defmacro gnus-data-pseudo-p (data)
2036 `(consp (nth 3 ,data)))
2038 (defmacro gnus-data-find (number)
2039 `(assq ,number gnus-newsgroup-data))
2041 (defmacro gnus-data-find-list (number &optional data)
2042 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2043 (memq (assq ,number bdata)
2046 (defmacro gnus-data-make (number mark pos header level)
2047 `(list ,number ,mark ,pos ,header ,level))
2049 (defun gnus-data-enter (after-article number mark pos header level offset)
2050 (let ((data (gnus-data-find-list after-article)))
2052 (error "No such article: %d" after-article))
2053 (setcdr data (cons (gnus-data-make number mark pos header level)
2055 (setq gnus-newsgroup-data-reverse nil)
2056 (gnus-data-update-list (cddr data) offset)))
2058 (defun gnus-data-enter-list (after-article list &optional offset)
2060 (let ((data (and after-article (gnus-data-find-list after-article)))
2062 (or data (not after-article) (error "No such article: %d" after-article))
2063 ;; Find the last element in the list to be spliced into the main
2066 (setq list (cdr list)))
2069 (setcdr list gnus-newsgroup-data)
2070 (setq gnus-newsgroup-data ilist)
2072 (gnus-data-update-list (cdr list) offset)))
2073 (setcdr list (cdr data))
2076 (gnus-data-update-list (cdr list) offset)))
2077 (setq gnus-newsgroup-data-reverse nil))))
2079 (defun gnus-data-remove (article &optional offset)
2080 (let ((data gnus-newsgroup-data))
2081 (if (= (gnus-data-number (car data)) article)
2083 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2084 gnus-newsgroup-data-reverse nil)
2086 (gnus-data-update-list gnus-newsgroup-data offset)))
2088 (when (= (gnus-data-number (cadr data)) article)
2089 (setcdr data (cddr data))
2091 (gnus-data-update-list (cdr data) offset))
2093 gnus-newsgroup-data-reverse nil))
2094 (setq data (cdr data))))))
2096 (defmacro gnus-data-list (backward)
2098 (or gnus-newsgroup-data-reverse
2099 (setq gnus-newsgroup-data-reverse
2100 (reverse gnus-newsgroup-data)))
2101 gnus-newsgroup-data))
2103 (defun gnus-data-update-list (data offset)
2104 "Add OFFSET to the POS of all data entries in DATA."
2106 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2107 (setq data (cdr data))))
2109 (defun gnus-data-compute-positions ()
2110 "Compute the positions of all articles."
2111 (let ((data gnus-newsgroup-data)
2114 (when (setq pos (text-property-any
2115 (point-min) (point-max)
2116 'gnus-number (gnus-data-number (car data))))
2117 (gnus-data-set-pos (car data) (+ pos 3)))
2118 (setq data (cdr data)))))
2120 (defun gnus-summary-article-pseudo-p (article)
2121 "Say whether this article is a pseudo article or not."
2122 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2124 (defmacro gnus-summary-article-sparse-p (article)
2125 "Say whether this article is a sparse article or not."
2126 `(memq ,article gnus-newsgroup-sparse))
2128 (defmacro gnus-summary-article-ancient-p (article)
2129 "Say whether this article is a sparse article or not."
2130 `(memq ,article gnus-newsgroup-ancient))
2132 (defun gnus-article-parent-p (number)
2133 "Say whether this article is a parent or not."
2134 (let ((data (gnus-data-find-list number)))
2135 (and (cdr data) ; There has to be an article after...
2136 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2137 (gnus-data-level (nth 1 data))))))
2139 (defun gnus-article-children (number)
2140 "Return a list of all children to NUMBER."
2141 (let* ((data (gnus-data-find-list number))
2142 (level (gnus-data-level (car data)))
2144 (setq data (cdr data))
2146 (= (gnus-data-level (car data)) (1+ level)))
2147 (push (gnus-data-number (car data)) children)
2148 (setq data (cdr data)))
2151 (defmacro gnus-summary-skip-intangible ()
2152 "If the current article is intangible, then jump to a different article."
2153 '(let ((to (get-text-property (point) 'gnus-intangible)))
2154 (and to (gnus-summary-goto-subject to))))
2156 (defmacro gnus-summary-article-intangible-p ()
2157 "Say whether this article is intangible or not."
2158 '(get-text-property (point) 'gnus-intangible))
2160 (defun gnus-article-read-p (article)
2161 "Say whether ARTICLE is read or not."
2162 (not (or (memq article gnus-newsgroup-marked)
2163 (memq article gnus-newsgroup-unreads)
2164 (memq article gnus-newsgroup-unselected)
2165 (memq article gnus-newsgroup-dormant))))
2167 ;; Some summary mode macros.
2169 (defmacro gnus-summary-article-number ()
2170 "The article number of the article on the current line.
2171 If there isn's an article number here, then we return the current
2174 (gnus-summary-skip-intangible)
2175 (or (get-text-property (point) 'gnus-number)
2176 (gnus-summary-last-subject))))
2178 (defmacro gnus-summary-article-header (&optional number)
2179 `(gnus-data-header (gnus-data-find
2180 ,(or number '(gnus-summary-article-number)))))
2182 (defmacro gnus-summary-thread-level (&optional number)
2183 `(if (and (eq gnus-summary-make-false-root 'dummy)
2184 (get-text-property (point) 'gnus-intangible))
2186 (gnus-data-level (gnus-data-find
2187 ,(or number '(gnus-summary-article-number))))))
2189 (defmacro gnus-summary-article-mark (&optional number)
2190 `(gnus-data-mark (gnus-data-find
2191 ,(or number '(gnus-summary-article-number)))))
2193 (defmacro gnus-summary-article-pos (&optional number)
2194 `(gnus-data-pos (gnus-data-find
2195 ,(or number '(gnus-summary-article-number)))))
2197 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2198 (defmacro gnus-summary-article-subject (&optional number)
2199 "Return current subject string or nil if nothing."
2202 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2203 '(gnus-data-header (assq (gnus-summary-article-number)
2204 gnus-newsgroup-data)))))
2207 (mail-header-subject headers))))
2209 (defmacro gnus-summary-article-score (&optional number)
2210 "Return current article score."
2211 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2212 gnus-newsgroup-scored))
2213 gnus-summary-default-score 0))
2215 (defun gnus-summary-article-children (&optional number)
2216 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2217 (level (gnus-data-level (car data)))
2219 (while (and (setq data (cdr data))
2220 (> (setq l (gnus-data-level (car data))) level))
2221 (and (= (1+ level) l)
2222 (push (gnus-data-number (car data))
2224 (nreverse children)))
2226 (defun gnus-summary-article-parent (&optional number)
2227 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2228 (gnus-data-list t)))
2229 (level (gnus-data-level (car data))))
2231 () ; This is a root.
2232 ;; We search until we find an article with a level less than
2233 ;; this one. That function has to be the parent.
2234 (while (and (setq data (cdr data))
2235 (not (< (gnus-data-level (car data)) level))))
2236 (and data (gnus-data-number (car data))))))
2238 (defun gnus-unread-mark-p (mark)
2239 "Say whether MARK is the unread mark."
2240 (= mark gnus-unread-mark))
2242 (defun gnus-read-mark-p (mark)
2243 "Say whether MARK is one of the marks that mark as read.
2244 This is all marks except unread, ticked, dormant, and expirable."
2245 (not (or (= mark gnus-unread-mark)
2246 (= mark gnus-ticked-mark)
2247 (= mark gnus-dormant-mark)
2248 (= mark gnus-expirable-mark))))
2250 (defmacro gnus-article-mark (number)
2252 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2253 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2254 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2255 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2256 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2257 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2258 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2259 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2260 gnus-ancient-mark))))
2262 ;; Saving hidden threads.
2264 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2265 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2267 (defmacro gnus-save-hidden-threads (&rest forms)
2268 "Save hidden threads, eval FORMS, and restore the hidden threads."
2269 (let ((config (make-symbol "config")))
2270 `(let ((,config (gnus-hidden-threads-configuration)))
2274 (gnus-restore-hidden-threads-configuration ,config)))))
2276 (defun gnus-hidden-threads-configuration ()
2277 "Return the current hidden threads configuration."
2280 (goto-char (point-min))
2281 (while (search-forward "\r" nil t)
2282 (push (1- (point)) config))
2285 (defun gnus-restore-hidden-threads-configuration (config)
2286 "Restore hidden threads configuration from CONFIG."
2287 (let (point buffer-read-only)
2288 (while (setq point (pop config))
2289 (when (and (< point (point-max))
2291 (= (following-char) ?\n))
2292 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2294 ;; Various summary mode internalish functions.
2296 (defun gnus-mouse-pick-article (e)
2299 (gnus-summary-next-page nil t))
2301 (defun gnus-summary-set-display-table ()
2302 ;; Change the display table. Odd characters have a tendency to mess
2303 ;; up nicely formatted displays - we make all possible glyphs
2304 ;; display only a single character.
2306 ;; We start from the standard display table, if any.
2307 (let ((table (or (copy-sequence standard-display-table)
2308 (make-display-table)))
2310 ;; Nix out all the control chars...
2311 (while (>= (setq i (1- i)) 0)
2312 (aset table i [??]))
2313 ;; ... but not newline and cr, of course. (cr is necessary for the
2314 ;; selective display).
2315 (aset table ?\n nil)
2316 (aset table ?\r nil)
2317 ;; We nix out any glyphs over 126 that are not set already.
2319 (while (>= (setq i (1- i)) 127)
2320 ;; Only modify if the entry is nil.
2321 (unless (aref table i)
2322 (aset table i [??]))))
2323 (setq buffer-display-table table)))
2325 (defun gnus-summary-setup-buffer (group)
2326 "Initialize summary buffer."
2327 (let ((buffer (concat "*Summary " group "*")))
2328 (if (get-buffer buffer)
2331 (setq gnus-summary-buffer (current-buffer))
2332 (not gnus-newsgroup-prepared))
2333 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2334 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2335 (gnus-add-current-to-buffer-list)
2336 (gnus-summary-mode group)
2338 (gnus-carpal-setup-buffer 'summary))
2339 (unless gnus-single-article-buffer
2340 (make-local-variable 'gnus-article-buffer)
2341 (make-local-variable 'gnus-article-current)
2342 (make-local-variable 'gnus-original-article-buffer))
2343 (setq gnus-newsgroup-name group)
2346 (defun gnus-set-global-variables ()
2347 ;; Set the global equivalents of the summary buffer-local variables
2348 ;; to the latest values they had. These reflect the summary buffer
2349 ;; that was in action when the last article was fetched.
2350 (when (eq major-mode 'gnus-summary-mode)
2351 (setq gnus-summary-buffer (current-buffer))
2352 (let ((name gnus-newsgroup-name)
2353 (marked gnus-newsgroup-marked)
2354 (unread gnus-newsgroup-unreads)
2355 (headers gnus-current-headers)
2356 (data gnus-newsgroup-data)
2357 (summary gnus-summary-buffer)
2358 (article-buffer gnus-article-buffer)
2359 (original gnus-original-article-buffer)
2360 (gac gnus-article-current)
2361 (reffed gnus-reffed-article-number)
2362 (score-file gnus-current-score-file))
2364 (set-buffer gnus-group-buffer)
2365 (setq gnus-newsgroup-name name
2366 gnus-newsgroup-marked marked
2367 gnus-newsgroup-unreads unread
2368 gnus-current-headers headers
2369 gnus-newsgroup-data data
2370 gnus-article-current gac
2371 gnus-summary-buffer summary
2372 gnus-article-buffer article-buffer
2373 gnus-original-article-buffer original
2374 gnus-reffed-article-number reffed
2375 gnus-current-score-file score-file)
2376 ;; The article buffer also has local variables.
2377 (when (gnus-buffer-live-p gnus-article-buffer)
2378 (set-buffer gnus-article-buffer)
2379 (setq gnus-summary-buffer summary))))))
2381 (defun gnus-summary-article-unread-p (article)
2382 "Say whether ARTICLE is unread or not."
2383 (memq article gnus-newsgroup-unreads))
2385 (defun gnus-summary-first-article-p (&optional article)
2386 "Return whether ARTICLE is the first article in the buffer."
2387 (if (not (setq article (or article (gnus-summary-article-number))))
2389 (eq article (caar gnus-newsgroup-data))))
2391 (defun gnus-summary-last-article-p (&optional article)
2392 "Return whether ARTICLE is the last article in the buffer."
2393 (if (not (setq article (or article (gnus-summary-article-number))))
2394 t ; All non-existent numbers are the last article. :-)
2395 (not (cdr (gnus-data-find-list article)))))
2397 (defun gnus-make-thread-indent-array ()
2399 (unless (and gnus-thread-indent-array
2400 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2401 (setq gnus-thread-indent-array (make-vector 201 "")
2402 gnus-thread-indent-array-level gnus-thread-indent-level)
2404 (aset gnus-thread-indent-array n
2405 (make-string (* n gnus-thread-indent-level) ? ))
2408 (defun gnus-update-summary-mark-positions ()
2409 "Compute where the summary marks are to go."
2411 (when (and gnus-summary-buffer
2412 (get-buffer gnus-summary-buffer)
2413 (buffer-name (get-buffer gnus-summary-buffer)))
2414 (set-buffer gnus-summary-buffer))
2415 (let ((gnus-replied-mark 129)
2416 (gnus-score-below-mark 130)
2417 (gnus-score-over-mark 130)
2418 (gnus-download-mark 131)
2419 (spec gnus-summary-line-format-spec)
2420 thread gnus-visual pos)
2422 (gnus-set-work-buffer)
2423 (let ((gnus-summary-line-format-spec spec)
2424 (gnus-newsgroup-downloadable '((0 . t))))
2425 (gnus-summary-insert-line
2426 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2427 (goto-char (point-min))
2428 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2430 (goto-char (point-min))
2431 (push (cons 'replied (and (search-forward "\201" nil t)
2434 (goto-char (point-min))
2435 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2437 (goto-char (point-min))
2438 (push (cons 'download
2439 (and (search-forward "\203" nil t) (- (point) 2)))
2441 (setq gnus-summary-mark-positions pos))))
2443 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2444 "Insert a dummy root in the summary buffer."
2446 (gnus-add-text-properties
2447 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2448 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2450 (defun gnus-summary-insert-line (gnus-tmp-header
2451 gnus-tmp-level gnus-tmp-current
2452 gnus-tmp-unread gnus-tmp-replied
2453 gnus-tmp-expirable gnus-tmp-subject-or-nil
2454 &optional gnus-tmp-dummy gnus-tmp-score
2456 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2457 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2458 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2459 (gnus-tmp-score-char
2460 (if (or (null gnus-summary-default-score)
2461 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2462 gnus-summary-zcore-fuzz))
2464 (if (< gnus-tmp-score gnus-summary-default-score)
2465 gnus-score-below-mark gnus-score-over-mark)))
2467 (cond (gnus-tmp-process gnus-process-mark)
2468 ((memq gnus-tmp-current gnus-newsgroup-cached)
2470 (gnus-tmp-replied gnus-replied-mark)
2471 ((memq gnus-tmp-current gnus-newsgroup-saved)
2473 (t gnus-unread-mark)))
2474 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2477 ((string-match "<[^>]+> *$" gnus-tmp-from)
2478 (let ((beg (match-beginning 0)))
2479 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2480 (substring gnus-tmp-from (1+ (match-beginning 0))
2481 (1- (match-end 0))))
2482 (substring gnus-tmp-from 0 beg))))
2483 ((string-match "(.+)" gnus-tmp-from)
2484 (substring gnus-tmp-from
2485 (1+ (match-beginning 0)) (1- (match-end 0))))
2487 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2488 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2489 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2490 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2491 (buffer-read-only nil))
2492 (when (string= gnus-tmp-name "")
2493 (setq gnus-tmp-name gnus-tmp-from))
2494 (unless (numberp gnus-tmp-lines)
2495 (setq gnus-tmp-lines 0))
2496 (gnus-put-text-property
2498 (progn (eval gnus-summary-line-format-spec) (point))
2499 'gnus-number gnus-tmp-number)
2500 (when (gnus-visual-p 'summary-highlight 'highlight)
2502 (run-hooks 'gnus-summary-update-hook)
2505 (defun gnus-summary-update-line (&optional dont-update)
2506 ;; Update summary line after change.
2507 (when (and gnus-summary-default-score
2508 (not gnus-summary-inhibit-highlight))
2509 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2510 (article (gnus-summary-article-number))
2511 (score (gnus-summary-article-score article)))
2513 (if (and gnus-summary-mark-below
2514 (< (gnus-summary-article-score)
2515 gnus-summary-mark-below))
2516 ;; This article has a low score, so we mark it as read.
2517 (when (memq article gnus-newsgroup-unreads)
2518 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2519 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2520 ;; This article was previously marked as read on account
2521 ;; of a low score, but now it has risen, so we mark it as
2523 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2524 (gnus-summary-update-mark
2525 (if (or (null gnus-summary-default-score)
2526 (<= (abs (- score gnus-summary-default-score))
2527 gnus-summary-zcore-fuzz))
2529 (if (< score gnus-summary-default-score)
2530 gnus-score-below-mark gnus-score-over-mark))
2532 ;; Do visual highlighting.
2533 (when (gnus-visual-p 'summary-highlight 'highlight)
2534 (run-hooks 'gnus-summary-update-hook)))))
2536 (defvar gnus-tmp-new-adopts nil)
2538 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2539 "Return the number of articles in THREAD.
2540 This may be 0 in some cases -- if none of the articles in
2541 the thread are to be displayed."
2543 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2545 ((not (listp thread))
2547 ((and (consp thread) (cdr thread))
2550 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2553 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2556 (when (and level (zerop level) gnus-tmp-new-adopts)
2559 'gnus-summary-number-of-articles-in-thread
2560 gnus-tmp-new-adopts))))
2562 (if (> number 1) gnus-not-empty-thread-mark
2563 gnus-empty-thread-mark)
2566 (defun gnus-summary-set-local-parameters (group)
2567 "Go through the local params of GROUP and set all variable specs in that list."
2568 (let ((params (gnus-group-find-parameter group))
2571 (setq elem (car params)
2572 params (cdr params))
2573 (and (consp elem) ; Has to be a cons.
2574 (consp (cdr elem)) ; The cdr has to be a list.
2575 (symbolp (car elem)) ; Has to be a symbol in there.
2576 (not (memq (car elem)
2577 '(quit-config to-address to-list to-group)))
2578 (ignore-errors ; So we set it.
2579 (make-local-variable (car elem))
2580 (set (car elem) (eval (nth 1 elem))))))))
2582 (defun gnus-summary-read-group (group &optional show-all no-article
2583 kill-buffer no-display)
2584 "Start reading news in newsgroup GROUP.
2585 If SHOW-ALL is non-nil, already read articles are also listed.
2586 If NO-ARTICLE is non-nil, no article is selected initially.
2587 If NO-DISPLAY, don't generate a summary buffer."
2591 (let ((gnus-auto-select-next nil))
2592 (or (gnus-summary-read-group-1
2593 group show-all no-article
2594 kill-buffer no-display)
2595 (setq show-all nil)))))
2596 (eq gnus-auto-select-next 'quietly))
2597 (set-buffer gnus-group-buffer)
2598 (if (not (equal group (gnus-group-group-name)))
2599 (setq group (gnus-group-group-name))
2603 (defun gnus-summary-read-group-1 (group show-all no-article
2604 kill-buffer no-display)
2605 ;; Killed foreign groups can't be entered.
2606 (when (and (not (gnus-group-native-p group))
2607 (not (gnus-gethash group gnus-newsrc-hashtb)))
2608 (error "Dead non-native groups can't be entered"))
2609 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2610 (let* ((new-group (gnus-summary-setup-buffer group))
2611 (quit-config (gnus-group-quit-config group))
2612 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2614 ;; This summary buffer exists already, so we just select it.
2616 (gnus-set-global-variables)
2618 (gnus-kill-or-deaden-summary kill-buffer))
2619 (gnus-configure-windows 'summary 'force)
2620 (gnus-set-mode-line 'summary)
2621 (gnus-summary-position-point)
2624 ;; We couldn't select this group.
2626 (when (and (eq major-mode 'gnus-summary-mode)
2627 (not (equal (current-buffer) kill-buffer)))
2628 (kill-buffer (current-buffer))
2629 (if (not quit-config)
2631 ;; Update the info -- marks might need to be removed,
2633 (gnus-summary-update-info)
2634 (set-buffer gnus-group-buffer)
2635 (gnus-group-jump-to-group group)
2636 (gnus-group-next-unread-group 1))
2637 (gnus-handle-ephemeral-exit quit-config)))
2638 (gnus-message 3 "Can't select group")
2640 ;; The user did a `C-g' while prompting for number of articles,
2641 ;; so we exit this group.
2642 ((eq did-select 'quit)
2643 (and (eq major-mode 'gnus-summary-mode)
2644 (not (equal (current-buffer) kill-buffer))
2645 (kill-buffer (current-buffer)))
2647 (gnus-kill-or-deaden-summary kill-buffer))
2648 (if (not quit-config)
2650 (set-buffer gnus-group-buffer)
2651 (gnus-group-jump-to-group group)
2652 (gnus-group-next-unread-group 1)
2653 (gnus-configure-windows 'group 'force))
2654 (gnus-handle-ephemeral-exit quit-config))
2655 ;; Finally signal the quit.
2657 ;; The group was successfully selected.
2659 (gnus-set-global-variables)
2660 ;; Save the active value in effect when the group was entered.
2661 (setq gnus-newsgroup-active
2663 (gnus-active gnus-newsgroup-name)))
2664 ;; You can change the summary buffer in some way with this hook.
2665 (run-hooks 'gnus-select-group-hook)
2666 ;; Set any local variables in the group parameters.
2667 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2668 (gnus-update-format-specifications
2669 nil 'summary 'summary-mode 'summary-dummy)
2670 ;; Do score processing.
2671 (when gnus-use-scoring
2672 (gnus-possibly-score-headers))
2673 ;; Check whether to fill in the gaps in the threads.
2674 (when gnus-build-sparse-threads
2675 (gnus-build-sparse-threads))
2676 ;; Find the initial limit.
2677 (if gnus-show-threads
2679 (let ((gnus-newsgroup-dormant nil))
2680 (gnus-summary-initial-limit show-all))
2681 (gnus-summary-initial-limit show-all))
2682 (setq gnus-newsgroup-limit
2684 (lambda (header) (mail-header-number header))
2685 gnus-newsgroup-headers)))
2686 ;; Generate the summary buffer.
2688 (gnus-summary-prepare))
2689 (when gnus-use-trees
2690 (gnus-tree-open group)
2691 (setq gnus-summary-highlight-line-function
2692 'gnus-tree-highlight-article))
2693 ;; If the summary buffer is empty, but there are some low-scored
2694 ;; articles or some excluded dormants, we include these in the
2696 (when (and (zerop (buffer-size))
2698 (cond (gnus-newsgroup-dormant
2699 (gnus-summary-limit-include-dormant))
2700 ((and gnus-newsgroup-scored show-all)
2701 (gnus-summary-limit-include-expunged t))))
2702 ;; Function `gnus-apply-kill-file' must be called in this hook.
2703 (run-hooks 'gnus-apply-kill-hook)
2704 (if (and (zerop (buffer-size))
2707 ;; This newsgroup is empty.
2708 (gnus-summary-catchup-and-exit nil t)
2709 (gnus-message 6 "No unread news")
2711 (gnus-kill-or-deaden-summary kill-buffer))
2712 ;; Return nil from this function.
2714 ;; Hide conversation thread subtrees. We cannot do this in
2715 ;; gnus-summary-prepare-hook since kill processing may not
2716 ;; work with hidden articles.
2717 (and gnus-show-threads
2718 gnus-thread-hide-subtree
2719 (gnus-summary-hide-all-threads))
2721 (gnus-kill-or-deaden-summary kill-buffer))
2722 ;; Show first unread article if requested.
2723 (if (and (not no-article)
2725 gnus-newsgroup-unreads
2726 gnus-auto-select-first)
2727 (unless (if (eq gnus-auto-select-first 'best)
2728 (gnus-summary-best-unread-article)
2729 (gnus-summary-first-unread-article))
2730 (gnus-configure-windows 'summary))
2731 ;; Don't select any articles, just move point to the first
2732 ;; article in the group.
2733 (goto-char (point-min))
2734 (gnus-summary-position-point)
2735 (gnus-configure-windows 'summary 'force)
2736 (gnus-set-mode-line 'summary))
2737 (when (get-buffer-window gnus-group-buffer t)
2738 ;; Gotta use windows, because recenter does weird stuff if
2739 ;; the current buffer ain't the displayed window.
2740 (let ((owin (selected-window)))
2741 (select-window (get-buffer-window gnus-group-buffer t))
2742 (when (gnus-group-goto-group group)
2744 (select-window owin)))
2745 ;; Mark this buffer as "prepared".
2746 (setq gnus-newsgroup-prepared t)
2749 (defun gnus-summary-prepare ()
2750 "Generate the summary buffer."
2752 (let ((buffer-read-only nil))
2754 (setq gnus-newsgroup-data nil
2755 gnus-newsgroup-data-reverse nil)
2756 (run-hooks 'gnus-summary-generate-hook)
2757 ;; Generate the buffer, either with threads or without.
2758 (when gnus-newsgroup-headers
2759 (gnus-summary-prepare-threads
2760 (if gnus-show-threads
2761 (gnus-sort-gathered-threads
2762 (funcall gnus-summary-thread-gathering-function
2764 (gnus-cut-threads (gnus-make-threads)))))
2765 ;; Unthreaded display.
2766 (gnus-sort-articles gnus-newsgroup-headers))))
2767 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2768 ;; Call hooks for modifying summary buffer.
2769 (goto-char (point-min))
2770 (run-hooks 'gnus-summary-prepare-hook)))
2772 (defsubst gnus-general-simplify-subject (subject)
2773 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2776 ;; Truncate the subject.
2777 (gnus-simplify-subject-functions
2778 (gnus-map-function gnus-simplify-subject-functions subject))
2779 ((numberp gnus-summary-gather-subject-limit)
2780 (setq subject (gnus-simplify-subject-re subject))
2781 (if (> (length subject) gnus-summary-gather-subject-limit)
2782 (substring subject 0 gnus-summary-gather-subject-limit)
2784 ;; Fuzzily simplify it.
2785 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2786 (gnus-simplify-subject-fuzzy subject))
2787 ;; Just remove the leading "Re:".
2789 (gnus-simplify-subject-re subject))))
2791 (if (and gnus-summary-gather-exclude-subject
2792 (string-match gnus-summary-gather-exclude-subject subject))
2793 nil ; This article shouldn't be gathered
2796 (defun gnus-summary-simplify-subject-query ()
2797 "Query where the respool algorithm would put this article."
2799 (gnus-summary-select-article)
2800 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2802 (defun gnus-gather-threads-by-subject (threads)
2803 "Gather threads by looking at Subject headers."
2804 (if (not gnus-summary-make-false-root)
2806 (let ((hashtb (gnus-make-hashtable 1024))
2809 subject hthread whole-subject)
2811 (setq subject (gnus-general-simplify-subject
2812 (setq whole-subject (mail-header-subject
2815 (if (setq hthread (gnus-gethash subject hashtb))
2817 ;; We enter a dummy root into the thread, if we
2818 ;; haven't done that already.
2819 (unless (stringp (caar hthread))
2820 (setcar hthread (list whole-subject (car hthread))))
2821 ;; We add this new gathered thread to this gathered
2823 (setcdr (car hthread)
2824 (nconc (cdar hthread) (list (car threads))))
2825 ;; Remove it from the list of threads.
2826 (setcdr prev (cdr threads))
2827 (setq threads prev))
2828 ;; Enter this thread into the hash table.
2829 (gnus-sethash subject threads hashtb)))
2831 (setq threads (cdr threads)))
2834 (defun gnus-gather-threads-by-references (threads)
2835 "Gather threads by looking at References headers."
2836 (let ((idhashtb (gnus-make-hashtable 1024))
2837 (thhashtb (gnus-make-hashtable 1024))
2840 ids references id gthread gid entered ref)
2842 (when (setq references (mail-header-references (caar threads)))
2843 (setq id (mail-header-id (caar threads))
2844 ids (gnus-split-references references)
2846 (while (setq ref (pop ids))
2847 (setq ids (delete ref ids))
2848 (if (not (setq gid (gnus-gethash ref idhashtb)))
2850 (gnus-sethash ref id idhashtb)
2851 (gnus-sethash id threads thhashtb))
2852 (setq gthread (gnus-gethash gid thhashtb))
2854 ;; We enter a dummy root into the thread, if we
2855 ;; haven't done that already.
2856 (unless (stringp (caar gthread))
2857 (setcar gthread (list (mail-header-subject (caar gthread))
2859 ;; We add this new gathered thread to this gathered
2861 (setcdr (car gthread)
2862 (nconc (cdar gthread) (list (car threads)))))
2863 ;; Add it into the thread hash table.
2864 (gnus-sethash id gthread thhashtb)
2866 ;; Remove it from the list of threads.
2867 (setcdr prev (cdr threads))
2868 (setq threads prev))))
2870 (setq threads (cdr threads)))
2873 (defun gnus-sort-gathered-threads (threads)
2874 "Sort subtreads inside each gathered thread by article number."
2875 (let ((result threads))
2877 (when (stringp (caar threads))
2878 (setcdr (car threads)
2879 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2880 (setq threads (cdr threads)))
2883 (defun gnus-thread-loop-p (root thread)
2884 "Say whether ROOT is in THREAD."
2885 (let ((stack (list thread))
2888 (while (setq thread (pop stack))
2889 (setq th (cdr thread))
2891 (not (eq (caar th) root)))
2894 ;; We have found a loop.
2896 (setcdr thread (delq (car th) (cdr thread)))
2897 (if (boundp (setq ref-dep (intern "none"
2898 gnus-newsgroup-dependencies)))
2899 (setcdr (symbol-value ref-dep)
2900 (nconc (cdr (symbol-value ref-dep))
2902 (set ref-dep (list nil (car th))))
2905 ;; Push all the subthreads onto the stack.
2906 (push (cdr thread) stack)))
2909 (defun gnus-make-threads ()
2910 "Go through the dependency hashtb and find the roots. Return all threads."
2912 (while (catch 'infloop
2915 ;; Deal with self-referencing References loops.
2916 (when (and (car (symbol-value refs))
2923 (car (symbol-value refs)) thread))
2924 (cdr (symbol-value refs)))))))
2927 (unless (car (symbol-value refs))
2928 ;; These threads do not refer back to any other articles,
2929 ;; so they're roots.
2930 (setq threads (append (cdr (symbol-value refs)) threads))))
2931 gnus-newsgroup-dependencies)))
2934 (defun gnus-build-sparse-threads ()
2935 (let ((headers gnus-newsgroup-headers)
2936 (deps gnus-newsgroup-dependencies)
2937 header references generation relations
2938 cthread subject child end pthread relation new-child)
2939 ;; First we create an alist of generations/relations, where
2940 ;; generations is how much we trust the relation, and the relation
2942 (gnus-message 7 "Making sparse threads...")
2944 (nnheader-set-temp-buffer " *gnus sparse threads*")
2945 (while (setq header (pop headers))
2946 (when (and (setq references (mail-header-references header))
2947 (not (string= references "")))
2949 (setq child (mail-header-id header)
2950 subject (mail-header-subject header))
2952 (while (search-backward ">" nil t)
2953 (setq end (1+ (point)))
2954 (when (search-backward "<" nil t)
2955 (unless (string= (setq new-child (buffer-substring (point) end))
2957 (push (list (incf generation)
2958 child (setq child new-child)
2961 (push (list (1+ generation) child nil subject) relations)
2963 (kill-buffer (current-buffer)))
2964 ;; Sort over trustworthiness.
2965 (setq relations (sort relations 'car-less-than-car))
2966 (while (setq relation (pop relations))
2967 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2968 (unless (car (symbol-value cthread))
2969 ;; Make this article the parent of these threads.
2970 (setcar (symbol-value cthread)
2971 (vector gnus-reffed-article-number
2975 (or (caddr relation) "") 0 0 "")))
2976 (set cthread (list (vector gnus-reffed-article-number
2978 "" "" (cadr relation)
2979 (or (caddr relation) "") 0 0 ""))))
2980 (push gnus-reffed-article-number gnus-newsgroup-limit)
2981 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2982 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2983 gnus-newsgroup-reads)
2984 (decf gnus-reffed-article-number)
2985 ;; Make this new thread the child of its parent.
2986 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2987 (setcdr (symbol-value pthread)
2988 (nconc (cdr (symbol-value pthread))
2989 (list (symbol-value cthread))))
2990 (set pthread (list nil (symbol-value cthread))))))
2991 (gnus-message 7 "Making sparse threads...done")))
2993 (defun gnus-build-old-threads ()
2994 ;; Look at all the articles that refer back to old articles, and
2995 ;; fetch the headers for the articles that aren't there. This will
2996 ;; build complete threads - if the roots haven't been expired by the
3001 (when (not (car (symbol-value refs)))
3002 (setq heads (cdr (symbol-value refs)))
3004 (if (memq (mail-header-number (caar heads))
3005 gnus-newsgroup-dormant)
3006 (setq heads (cdr heads))
3007 (setq id (symbol-name refs))
3008 (while (and (setq id (gnus-build-get-header id))
3009 (not (car (gnus-gethash
3010 id gnus-newsgroup-dependencies)))))
3011 (setq heads nil)))))
3012 gnus-newsgroup-dependencies)))
3014 (defun gnus-build-get-header (id)
3015 ;; Look through the buffer of NOV lines and find the header to
3016 ;; ID. Enter this line into the dependencies hash table, and return
3017 ;; the id of the parent article (if any).
3018 (let ((deps gnus-newsgroup-dependencies)
3022 (set-buffer nntp-server-buffer)
3023 (let ((case-fold-search nil))
3024 (goto-char (point-min))
3025 (while (and (not found)
3026 (search-forward id nil t))
3028 (setq found (looking-at
3029 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3030 (regexp-quote id))))
3031 (or found (beginning-of-line 2)))
3035 (setq header (gnus-nov-parse-line
3036 (read (current-buffer)) deps))
3037 (gnus-parent-id (mail-header-references header))))))
3039 (let ((number (mail-header-number header)))
3040 (push number gnus-newsgroup-limit)
3041 (push header gnus-newsgroup-headers)
3042 (if (memq number gnus-newsgroup-unselected)
3044 (push number gnus-newsgroup-unreads)
3045 (setq gnus-newsgroup-unselected
3046 (delq number gnus-newsgroup-unselected)))
3047 (push number gnus-newsgroup-ancient)))))))
3049 (defun gnus-build-all-threads ()
3050 "Read all the headers."
3051 (let ((deps gnus-newsgroup-dependencies)
3052 (gnus-summary-ignore-duplicates t)
3053 found header article)
3055 (set-buffer nntp-server-buffer)
3056 (let ((case-fold-search nil))
3057 (goto-char (point-min))
3060 (setq article (read (current-buffer)))
3061 (setq header (gnus-nov-parse-line article deps)))
3063 (push header gnus-newsgroup-headers)
3064 (if (memq (setq article (mail-header-number header))
3065 gnus-newsgroup-unselected)
3067 (push article gnus-newsgroup-unreads)
3068 (setq gnus-newsgroup-unselected
3069 (delq article gnus-newsgroup-unselected)))
3070 (push article gnus-newsgroup-ancient))
3071 (forward-line 1)))))))
3073 (defun gnus-summary-update-article-line (article header)
3074 "Update the line for ARTICLE using HEADERS."
3075 (let* ((id (mail-header-id header))
3076 (thread (gnus-id-to-thread id)))
3078 (error "Article in no thread"))
3079 ;; Update the thread.
3080 (setcar thread header)
3081 (gnus-summary-goto-subject article)
3082 (let* ((datal (gnus-data-find-list article))
3084 (length (when (cdr datal)
3085 (- (gnus-data-pos data)
3086 (gnus-data-pos (cadr datal)))))
3087 (buffer-read-only nil)
3088 (level (gnus-summary-thread-level)))
3090 (gnus-summary-insert-line
3091 header level nil (gnus-article-mark article)
3092 (memq article gnus-newsgroup-replied)
3093 (memq article gnus-newsgroup-expirable)
3094 ;; Only insert the Subject string when it's different
3095 ;; from the previous Subject string.
3096 (if (gnus-subject-equal
3098 (mail-header-subject
3101 (gnus-data-find-list
3103 (gnus-data-list t)))))
3104 ;; Error on the side of excessive subjects.
3106 (mail-header-subject header))
3108 (mail-header-subject header))
3109 nil (cdr (assq article gnus-newsgroup-scored))
3110 (memq article gnus-newsgroup-processable))
3112 (gnus-data-update-list
3113 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3115 (defun gnus-summary-update-article (article &optional iheader)
3116 "Update ARTICLE in the summary buffer."
3117 (set-buffer gnus-summary-buffer)
3118 (let* ((header (or iheader (gnus-summary-article-header article)))
3119 (id (mail-header-id header))
3120 (data (gnus-data-find article))
3121 (thread (gnus-id-to-thread id))
3122 (references (mail-header-references header))
3126 (when (and references
3127 (not (equal "" references)))
3130 (buffer-read-only nil)
3132 (number (mail-header-number header))
3135 ;; !!! Should this be in or not?
3137 (setcar thread nil))
3139 (delq thread parent))
3140 (if (gnus-summary-insert-subject id header iheader)
3141 ;; Set the (possibly) new article number in the data structure.
3142 (gnus-data-set-number data (gnus-id-to-article id))
3146 (defun gnus-rebuild-thread (id)
3147 "Rebuild the thread containing ID."
3148 (let ((buffer-read-only nil)
3149 old-pos current thread data)
3150 (if (not gnus-show-threads)
3151 (setq thread (list (car (gnus-id-to-thread id))))
3152 ;; Get the thread this article is part of.
3153 (setq thread (gnus-remove-thread id)))
3154 (setq old-pos (gnus-point-at-bol))
3155 (setq current (save-excursion
3156 (and (zerop (forward-line -1))
3157 (gnus-summary-article-number))))
3158 ;; If this is a gathered thread, we have to go some re-gathering.
3159 (when (stringp (car thread))
3160 (let ((subject (car thread))
3162 (setq thread (cdr thread))
3164 (unless (memq (setq thr (gnus-id-to-thread
3166 (mail-header-id (caar thread)))))
3169 (setq thread (cdr thread)))
3170 ;; We now have all (unique) roots.
3171 (if (= (length roots) 1)
3172 ;; All the loose roots are now one solid root.
3173 (setq thread (car roots))
3174 (setq thread (cons subject (gnus-sort-threads roots))))))
3176 ;; We then insert this thread into the summary buffer.
3177 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3178 (if gnus-show-threads
3179 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3180 (gnus-summary-prepare-unthreaded thread))
3181 (setq data (nreverse gnus-newsgroup-data))
3182 (setq threads gnus-newsgroup-threads))
3183 ;; We splice the new data into the data structure.
3184 (gnus-data-enter-list current data (- (point) old-pos))
3185 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3187 (defun gnus-number-to-header (number)
3188 "Return the header for article NUMBER."
3189 (let ((headers gnus-newsgroup-headers))
3191 (not (= number (mail-header-number (car headers)))))
3196 (defun gnus-parent-headers (headers &optional generation)
3197 "Return the headers of the GENERATIONeth parent of HEADERS."
3199 (setq generation 1))
3202 (while (and parent headers (not (zerop generation)))
3203 (setq references (mail-header-references headers))
3204 (when (and references
3205 (setq parent (gnus-parent-id references))
3206 (setq headers (car (gnus-id-to-thread parent))))
3210 (defun gnus-id-to-thread (id)
3211 "Return the (sub-)thread where ID appears."
3212 (gnus-gethash id gnus-newsgroup-dependencies))
3214 (defun gnus-id-to-article (id)
3215 "Return the article number of ID."
3216 (let ((thread (gnus-id-to-thread id)))
3219 (mail-header-number (car thread)))))
3221 (defun gnus-id-to-header (id)
3222 "Return the article headers of ID."
3223 (car (gnus-id-to-thread id)))
3225 (defun gnus-article-displayed-root-p (article)
3226 "Say whether ARTICLE is a root(ish) article."
3227 (let ((level (gnus-summary-thread-level article))
3228 (refs (mail-header-references (gnus-summary-article-header article)))
3234 ((null (gnus-parent-id refs)) t)
3236 (null (setq particle (gnus-id-to-article
3237 (gnus-parent-id refs))))
3238 (null (gnus-summary-thread-level particle)))))))
3240 (defun gnus-root-id (id)
3241 "Return the id of the root of the thread where ID appears."
3243 (while (and id (setq prev (car (gnus-gethash
3244 id gnus-newsgroup-dependencies))))
3246 id (gnus-parent-id (mail-header-references prev))))
3249 (defun gnus-articles-in-thread (thread)
3250 "Return the list of articles in THREAD."
3251 (cons (mail-header-number (car thread))
3252 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3254 (defun gnus-remove-thread (id &optional dont-remove)
3255 "Remove the thread that has ID in it."
3256 (let ((dep gnus-newsgroup-dependencies)
3257 headers thread last-id)
3258 ;; First go up in this thread until we find the root.
3259 (setq last-id (gnus-root-id id))
3260 (setq headers (list (car (gnus-id-to-thread last-id))
3261 (caadr (gnus-id-to-thread last-id))))
3262 ;; We have now found the real root of this thread. It might have
3263 ;; been gathered into some loose thread, so we have to search
3264 ;; through the threads to find the thread we wanted.
3265 (let ((threads gnus-newsgroup-threads)
3268 (setq sub (car threads))
3269 (if (stringp (car sub))
3270 ;; This is a gathered thread, so we look at the roots
3271 ;; below it to find whether this article is in this
3274 (setq sub (cdr sub))
3276 (when (member (caar sub) headers)
3277 (setq thread (car threads)
3280 (setq sub (cdr sub))))
3281 ;; It's an ordinary thread, so we check it.
3282 (when (eq (car sub) (car headers))
3285 (setq threads (cdr threads)))
3286 ;; If this article is in no thread, then it's a root.
3289 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3290 (setq thread (gnus-gethash last-id dep)))
3293 thread ; We return this thread.
3295 (if (stringp (car thread))
3297 ;; If we use dummy roots, then we have to remove the
3298 ;; dummy root as well.
3299 (when (eq gnus-summary-make-false-root 'dummy)
3301 (gnus-data-compute-positions))
3302 (setq thread (cdr thread))
3304 (gnus-remove-thread-1 (car thread))
3305 (setq thread (cdr thread))))
3306 (gnus-remove-thread-1 thread))))))))
3308 (defun gnus-remove-thread-1 (thread)
3309 "Remove the thread THREAD recursively."
3310 (let ((number (mail-header-number (pop thread)))
3312 (setq thread (reverse thread))
3314 (gnus-remove-thread-1 (pop thread)))
3315 (when (setq d (gnus-data-find number))
3316 (goto-char (gnus-data-pos d))
3319 (- (gnus-point-at-bol)
3321 (1+ (gnus-point-at-eol))
3322 (gnus-delete-line)))))))
3324 (defun gnus-sort-threads (threads)
3326 (if (not gnus-thread-sort-functions)
3328 (gnus-message 7 "Sorting threads...")
3330 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3331 (gnus-message 7 "Sorting threads...done"))))
3333 (defun gnus-sort-articles (articles)
3335 (when gnus-article-sort-functions
3336 (gnus-message 7 "Sorting articles...")
3338 (setq gnus-newsgroup-headers
3339 (sort articles (gnus-make-sort-function
3340 gnus-article-sort-functions)))
3341 (gnus-message 7 "Sorting articles...done"))))
3343 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3344 (defmacro gnus-thread-header (thread)
3345 ;; Return header of first article in THREAD.
3346 ;; Note that THREAD must never, ever be anything else than a variable -
3347 ;; using some other form will lead to serious barfage.
3348 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3349 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3350 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3353 (defsubst gnus-article-sort-by-number (h1 h2)
3354 "Sort articles by article number."
3355 (< (mail-header-number h1)
3356 (mail-header-number h2)))
3358 (defun gnus-thread-sort-by-number (h1 h2)
3359 "Sort threads by root article number."
3360 (gnus-article-sort-by-number
3361 (gnus-thread-header h1) (gnus-thread-header h2)))
3363 (defsubst gnus-article-sort-by-lines (h1 h2)
3364 "Sort articles by article Lines header."
3365 (< (mail-header-lines h1)
3366 (mail-header-lines h2)))
3368 (defun gnus-thread-sort-by-lines (h1 h2)
3369 "Sort threads by root article Lines header."
3370 (gnus-article-sort-by-lines
3371 (gnus-thread-header h1) (gnus-thread-header h2)))
3373 (defsubst gnus-article-sort-by-author (h1 h2)
3374 "Sort articles by root author."
3376 (let ((extract (funcall
3377 gnus-extract-address-components
3378 (mail-header-from h1))))
3379 (or (car extract) (cadr extract) ""))
3380 (let ((extract (funcall
3381 gnus-extract-address-components
3382 (mail-header-from h2))))
3383 (or (car extract) (cadr extract) ""))))
3385 (defun gnus-thread-sort-by-author (h1 h2)
3386 "Sort threads by root author."
3387 (gnus-article-sort-by-author
3388 (gnus-thread-header h1) (gnus-thread-header h2)))
3390 (defsubst gnus-article-sort-by-subject (h1 h2)
3391 "Sort articles by root subject."
3393 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3394 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3396 (defun gnus-thread-sort-by-subject (h1 h2)
3397 "Sort threads by root subject."
3398 (gnus-article-sort-by-subject
3399 (gnus-thread-header h1) (gnus-thread-header h2)))
3401 (defsubst gnus-article-sort-by-date (h1 h2)
3402 "Sort articles by root article date."
3404 (gnus-date-get-time (mail-header-date h1))
3405 (gnus-date-get-time (mail-header-date h2))))
3407 (defun gnus-thread-sort-by-date (h1 h2)
3408 "Sort threads by root article date."
3409 (gnus-article-sort-by-date
3410 (gnus-thread-header h1) (gnus-thread-header h2)))
3412 (defsubst gnus-article-sort-by-score (h1 h2)
3413 "Sort articles by root article score.
3414 Unscored articles will be counted as having a score of zero."
3415 (> (or (cdr (assq (mail-header-number h1)
3416 gnus-newsgroup-scored))
3417 gnus-summary-default-score 0)
3418 (or (cdr (assq (mail-header-number h2)
3419 gnus-newsgroup-scored))
3420 gnus-summary-default-score 0)))
3422 (defun gnus-thread-sort-by-score (h1 h2)
3423 "Sort threads by root article score."
3424 (gnus-article-sort-by-score
3425 (gnus-thread-header h1) (gnus-thread-header h2)))
3427 (defun gnus-thread-sort-by-total-score (h1 h2)
3428 "Sort threads by the sum of all scores in the thread.
3429 Unscored articles will be counted as having a score of zero."
3430 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3432 (defun gnus-thread-total-score (thread)
3433 ;; This function find the total score of THREAD.
3434 (cond ((null thread)
3437 (if (stringp (car thread))
3438 (apply gnus-thread-score-function 0
3439 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3440 (gnus-thread-total-score-1 thread)))
3442 (gnus-thread-total-score-1 (list thread)))))
3444 (defun gnus-thread-total-score-1 (root)
3445 ;; This function find the total score of the thread below ROOT.
3446 (setq root (car root))
3447 (apply gnus-thread-score-function
3449 (mapcar 'gnus-thread-total-score
3450 (cdr (gnus-gethash (mail-header-id root)
3451 gnus-newsgroup-dependencies)))
3452 (when (> (mail-header-number root) 0)
3453 (list (or (cdr (assq (mail-header-number root)
3454 gnus-newsgroup-scored))
3455 gnus-summary-default-score 0))))
3456 (list gnus-summary-default-score)
3459 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3460 (defvar gnus-tmp-prev-subject nil)
3461 (defvar gnus-tmp-false-parent nil)
3462 (defvar gnus-tmp-root-expunged nil)
3463 (defvar gnus-tmp-dummy-line nil)
3465 (defun gnus-summary-prepare-threads (threads)
3466 "Prepare summary buffer from THREADS and indentation LEVEL.
3467 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3468 or a straight list of headers."
3469 (gnus-message 7 "Generating summary...")
3471 (setq gnus-newsgroup-threads threads)
3474 (let ((gnus-tmp-level 0)
3475 (default-score (or gnus-summary-default-score 0))
3476 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3477 thread number subject stack state gnus-tmp-gathered beg-match
3478 new-roots gnus-tmp-new-adopts thread-end
3479 gnus-tmp-header gnus-tmp-unread
3480 gnus-tmp-replied gnus-tmp-subject-or-nil
3481 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3482 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3483 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3485 (setq gnus-tmp-prev-subject nil)
3487 (if (vectorp (car threads))
3488 ;; If this is a straight (sic) list of headers, then a
3489 ;; threaded summary display isn't required, so we just create
3490 ;; an unthreaded one.
3491 (gnus-summary-prepare-unthreaded threads)
3493 ;; Do the threaded display.
3495 (while (or threads stack gnus-tmp-new-adopts new-roots)
3497 (if (and (= gnus-tmp-level 0)
3498 (not (setq gnus-tmp-dummy-line nil))
3501 (not gnus-tmp-false-parent)
3502 (or gnus-tmp-new-adopts new-roots))
3503 (if gnus-tmp-new-adopts
3504 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3505 thread (list (car gnus-tmp-new-adopts))
3506 gnus-tmp-header (caar thread)
3507 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3509 (setq thread (list (car new-roots))
3510 gnus-tmp-header (caar thread)
3511 new-roots (cdr new-roots))))
3514 ;; If there are some threads, we do them before the
3515 ;; threads on the stack.
3516 (setq thread threads
3517 gnus-tmp-header (caar thread))
3518 ;; There were no current threads, so we pop something off
3520 (setq state (car stack)
3521 gnus-tmp-level (car state)
3524 gnus-tmp-header (caar thread))))
3526 (setq gnus-tmp-false-parent nil)
3527 (setq gnus-tmp-root-expunged nil)
3528 (setq thread-end nil)
3530 (if (stringp gnus-tmp-header)
3531 ;; The header is a dummy root.
3533 ((eq gnus-summary-make-false-root 'adopt)
3534 ;; We let the first article adopt the rest.
3535 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3537 (setq gnus-tmp-gathered
3539 (lambda (h) (mail-header-number (car h)))
3542 (setq thread (cons (list (caar thread)
3545 (setq gnus-tmp-level -1
3546 gnus-tmp-false-parent t))
3547 ((eq gnus-summary-make-false-root 'empty)
3548 ;; We print adopted articles with empty subject fields.
3549 (setq gnus-tmp-gathered
3551 (lambda (h) (mail-header-number (car h)))
3554 (setq gnus-tmp-level -1))
3555 ((eq gnus-summary-make-false-root 'dummy)
3556 ;; We remember that we probably want to output a dummy
3558 (setq gnus-tmp-dummy-line gnus-tmp-header)
3559 (setq gnus-tmp-prev-subject gnus-tmp-header))
3561 ;; We do not make a root for the gathered
3562 ;; sub-threads at all.
3563 (setq gnus-tmp-level -1)))
3565 (setq number (mail-header-number gnus-tmp-header)
3566 subject (mail-header-subject gnus-tmp-header))
3569 ;; If the thread has changed subject, we might want to make
3570 ;; this subthread into a root.
3571 ((and (null gnus-thread-ignore-subject)
3572 (not (zerop gnus-tmp-level))
3573 gnus-tmp-prev-subject
3575 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3576 (setq new-roots (nconc new-roots (list (car thread)))
3578 gnus-tmp-header nil))
3579 ;; If the article lies outside the current limit,
3580 ;; then we do not display it.
3581 ((not (memq number gnus-newsgroup-limit))
3582 (setq gnus-tmp-gathered
3584 (lambda (h) (mail-header-number (car h)))
3587 (setq gnus-tmp-new-adopts (if (cdar thread)
3588 (append gnus-tmp-new-adopts
3590 gnus-tmp-new-adopts)
3592 gnus-tmp-header nil)
3593 (when (zerop gnus-tmp-level)
3594 (setq gnus-tmp-root-expunged t)))
3595 ;; Perhaps this article is to be marked as read?
3596 ((and gnus-summary-mark-below
3597 (< (or (cdr (assq number gnus-newsgroup-scored))
3599 gnus-summary-mark-below)
3600 ;; Don't touch sparse articles.
3601 (not (gnus-summary-article-sparse-p number))
3602 (not (gnus-summary-article-ancient-p number)))
3603 (setq gnus-newsgroup-unreads
3604 (delq number gnus-newsgroup-unreads))
3605 (if gnus-newsgroup-auto-expire
3606 (push number gnus-newsgroup-expirable)
3607 (push (cons number gnus-low-score-mark)
3608 gnus-newsgroup-reads))))
3610 (when gnus-tmp-header
3611 ;; We may have an old dummy line to output before this
3613 (when gnus-tmp-dummy-line
3614 (gnus-summary-insert-dummy-line
3615 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3616 (setq gnus-tmp-dummy-line nil))
3618 ;; Compute the mark.
3619 (setq gnus-tmp-unread (gnus-article-mark number))
3621 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3622 gnus-tmp-header gnus-tmp-level)
3623 gnus-newsgroup-data)
3625 ;; Actually insert the line.
3627 gnus-tmp-subject-or-nil
3629 ((and gnus-thread-ignore-subject
3630 gnus-tmp-prev-subject
3631 (not (inline (gnus-subject-equal
3632 gnus-tmp-prev-subject subject))))
3634 ((zerop gnus-tmp-level)
3635 (if (and (eq gnus-summary-make-false-root 'empty)
3636 (memq number gnus-tmp-gathered)
3637 gnus-tmp-prev-subject
3638 (inline (gnus-subject-equal
3639 gnus-tmp-prev-subject subject)))
3640 gnus-summary-same-subject
3642 (t gnus-summary-same-subject)))
3643 (if (and (eq gnus-summary-make-false-root 'adopt)
3644 (= gnus-tmp-level 1)
3645 (memq number gnus-tmp-gathered))
3646 (setq gnus-tmp-opening-bracket ?\<
3647 gnus-tmp-closing-bracket ?\>)
3648 (setq gnus-tmp-opening-bracket ?\[
3649 gnus-tmp-closing-bracket ?\]))
3651 gnus-tmp-indentation
3652 (aref gnus-thread-indent-array gnus-tmp-level)
3653 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3654 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3655 gnus-summary-default-score 0)
3657 (if (or (null gnus-summary-default-score)
3658 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3659 gnus-summary-zcore-fuzz))
3661 (if (< gnus-tmp-score gnus-summary-default-score)
3662 gnus-score-below-mark gnus-score-over-mark))
3664 (cond ((memq number gnus-newsgroup-processable)
3666 ((memq number gnus-newsgroup-cached)
3668 ((memq number gnus-newsgroup-replied)
3670 ((memq number gnus-newsgroup-saved)
3672 (t gnus-unread-mark))
3673 gnus-tmp-from (mail-header-from gnus-tmp-header)
3676 ((string-match "<[^>]+> *$" gnus-tmp-from)
3677 (setq beg-match (match-beginning 0))
3678 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3679 (substring gnus-tmp-from (1+ (match-beginning 0))
3680 (1- (match-end 0))))
3681 (substring gnus-tmp-from 0 beg-match)))
3682 ((string-match "(.+)" gnus-tmp-from)
3683 (substring gnus-tmp-from
3684 (1+ (match-beginning 0)) (1- (match-end 0))))
3686 (when (string= gnus-tmp-name "")
3687 (setq gnus-tmp-name gnus-tmp-from))
3688 (unless (numberp gnus-tmp-lines)
3689 (setq gnus-tmp-lines 0))
3690 (gnus-put-text-property
3692 (progn (eval gnus-summary-line-format-spec) (point))
3693 'gnus-number number)
3696 (run-hooks 'gnus-summary-update-hook)
3699 (setq gnus-tmp-prev-subject subject)))
3701 (when (nth 1 thread)
3702 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3703 (incf gnus-tmp-level)
3704 (setq threads (if thread-end nil (cdar thread)))
3706 (setq gnus-tmp-level 0)))))
3707 (gnus-message 7 "Generating summary...done"))
3709 (defun gnus-summary-prepare-unthreaded (headers)
3710 "Generate an unthreaded summary buffer based on HEADERS."
3711 (let (header number mark)
3716 ;; We may have to root out some bad articles...
3717 (when (memq (setq number (mail-header-number
3718 (setq header (pop headers))))
3719 gnus-newsgroup-limit)
3720 ;; Mark article as read when it has a low score.
3721 (when (and gnus-summary-mark-below
3722 (< (or (cdr (assq number gnus-newsgroup-scored))
3723 gnus-summary-default-score 0)
3724 gnus-summary-mark-below)
3725 (not (gnus-summary-article-ancient-p number)))
3726 (setq gnus-newsgroup-unreads
3727 (delq number gnus-newsgroup-unreads))
3728 (if gnus-newsgroup-auto-expire
3729 (push number gnus-newsgroup-expirable)
3730 (push (cons number gnus-low-score-mark)
3731 gnus-newsgroup-reads)))
3733 (setq mark (gnus-article-mark number))
3734 (push (gnus-data-make number mark (1+ (point)) header 0)
3735 gnus-newsgroup-data)
3736 (gnus-summary-insert-line
3738 mark (memq number gnus-newsgroup-replied)
3739 (memq number gnus-newsgroup-expirable)
3740 (mail-header-subject header) nil
3741 (cdr (assq number gnus-newsgroup-scored))
3742 (memq number gnus-newsgroup-processable))))))
3744 (defun gnus-select-newsgroup (group &optional read-all)
3745 "Select newsgroup GROUP.
3746 If READ-ALL is non-nil, all articles in the group are selected."
3747 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3748 ;;!!! Dirty hack; should be removed.
3749 (gnus-summary-ignore-duplicates
3750 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3752 gnus-summary-ignore-duplicates))
3753 (info (nth 2 entry))
3754 articles fetched-articles cached)
3756 (unless (gnus-check-server
3757 (setq gnus-current-select-method
3758 (gnus-find-method-for-group group)))
3759 (error "Couldn't open server"))
3761 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3762 (gnus-activate-group group) ; Or we can activate it...
3763 (progn ; Or we bug out.
3764 (when (equal major-mode 'gnus-summary-mode)
3765 (kill-buffer (current-buffer)))
3766 (error "Couldn't request group %s: %s"
3767 group (gnus-status-message group))))
3769 (unless (gnus-request-group group t)
3770 (when (equal major-mode 'gnus-summary-mode)
3771 (kill-buffer (current-buffer)))
3772 (error "Couldn't request group %s: %s"
3773 group (gnus-status-message group)))
3775 (setq gnus-newsgroup-name group)
3776 (setq gnus-newsgroup-unselected nil)
3777 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3779 ;; Adjust and set lists of article marks.
3781 (gnus-adjust-marked-articles info))
3783 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3784 (when (gnus-virtual-group-p group)
3785 (setq cached gnus-newsgroup-cached))
3787 (setq gnus-newsgroup-unreads
3788 (gnus-set-difference
3789 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3790 gnus-newsgroup-dormant))
3792 (setq gnus-newsgroup-processable nil)
3794 (gnus-update-read-articles group gnus-newsgroup-unreads)
3795 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3796 (gnus-group-update-group group))
3798 (setq articles (gnus-articles-to-read group read-all))
3802 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3804 ((eq articles 0) nil)
3806 ;; Init the dependencies hash table.
3807 (setq gnus-newsgroup-dependencies
3808 (gnus-make-hashtable (length articles)))
3809 ;; Retrieve the headers and read them in.
3810 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3811 (setq gnus-newsgroup-headers
3813 (setq gnus-headers-retrieved-by
3814 (gnus-retrieve-headers
3815 articles gnus-newsgroup-name
3816 ;; We might want to fetch old headers, but
3817 ;; not if there is only 1 article.
3818 (and gnus-fetch-old-headers
3820 (not (eq gnus-fetch-old-headers 'some))
3821 (not (numberp gnus-fetch-old-headers)))
3822 (> (length articles) 1))))))
3823 (gnus-get-newsgroup-headers-xover
3824 articles nil nil gnus-newsgroup-name t)
3825 (gnus-get-newsgroup-headers)))
3826 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3828 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3830 (setq gnus-newsgroup-cached cached))
3832 ;; Suppress duplicates?
3833 (when gnus-suppress-duplicates
3834 (gnus-dup-suppress-articles))
3836 ;; Set the initial limit.
3837 (setq gnus-newsgroup-limit (copy-sequence articles))
3838 ;; Remove canceled articles from the list of unread articles.
3839 (setq gnus-newsgroup-unreads
3840 (gnus-set-sorted-intersection
3841 gnus-newsgroup-unreads
3842 (setq fetched-articles
3843 (mapcar (lambda (headers) (mail-header-number headers))
3844 gnus-newsgroup-headers))))
3845 ;; Removed marked articles that do not exist.
3846 (gnus-update-missing-marks
3847 (gnus-sorted-complement fetched-articles articles))
3848 ;; Let the Gnus agent mark articles as read.
3850 (gnus-agent-get-undownloaded-list))
3851 ;; We might want to build some more threads first.
3852 (when (and gnus-fetch-old-headers
3853 (eq gnus-headers-retrieved-by 'nov))
3854 (if (eq gnus-fetch-old-headers 'invisible)
3855 (gnus-build-all-threads)
3856 (gnus-build-old-threads)))
3857 ;; Check whether auto-expire is to be done in this group.
3858 (setq gnus-newsgroup-auto-expire
3859 (gnus-group-auto-expirable-p group))
3860 ;; Set up the article buffer now, if necessary.
3861 (unless gnus-single-article-buffer
3862 (gnus-article-setup-buffer))
3863 ;; First and last article in this newsgroup.
3864 (when gnus-newsgroup-headers
3865 (setq gnus-newsgroup-begin
3866 (mail-header-number (car gnus-newsgroup-headers))
3869 (gnus-last-element gnus-newsgroup-headers))))
3870 ;; GROUP is successfully selected.
3871 (or gnus-newsgroup-headers t)))))
3873 (defun gnus-articles-to-read (group &optional read-all)
3874 ;; Find out what articles the user wants to read.
3876 ;; Select all articles if `read-all' is non-nil, or if there
3877 ;; are no unread articles.
3879 (and (zerop (length gnus-newsgroup-marked))
3880 (zerop (length gnus-newsgroup-unreads)))
3881 (eq (gnus-group-find-parameter group 'display)
3883 (gnus-uncompress-range (gnus-active group))
3884 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3885 (copy-sequence gnus-newsgroup-unreads))
3887 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3888 (scored (length scored-list))
3889 (number (length articles))
3890 (marked (+ (length gnus-newsgroup-marked)
3891 (length gnus-newsgroup-dormant)))
3899 ((and (or (<= scored marked) (= scored number))
3900 (numberp gnus-large-newsgroup)
3901 (> number gnus-large-newsgroup))
3905 "How many articles from %s (default %d): "
3906 (gnus-limit-string gnus-newsgroup-name 35)
3908 (if (string-match "^[ \t]*$" input) number input)))
3909 ((and (> scored marked) (< scored number)
3910 (> (- scored number) 20))
3913 (format "%s %s (%d scored, %d total): "
3914 "How many articles from"
3915 group scored number))))
3916 (if (string-match "^[ \t]*$" input)
3920 (setq select (if (stringp select) (string-to-number select) select))
3921 (if (or (null select) (zerop select))
3923 (if (and (not (zerop scored)) (<= (abs select) scored))
3925 (setq articles (sort scored-list '<))
3926 (setq number (length articles)))
3927 (setq articles (copy-sequence articles)))
3929 (when (< (abs select) number)
3931 ;; Select the N oldest articles.
3932 (setcdr (nthcdr (1- (abs select)) articles) nil)
3933 ;; Select the N most recent articles.
3934 (setq articles (nthcdr (- number select) articles))))
3935 (setq gnus-newsgroup-unselected
3936 (gnus-sorted-intersection
3937 gnus-newsgroup-unreads
3938 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3941 (defun gnus-killed-articles (killed articles)
3944 (when (inline (gnus-member-of-range (car articles) killed))
3945 (push (car articles) out))
3946 (setq articles (cdr articles)))
3949 (defun gnus-uncompress-marks (marks)
3950 "Uncompress the mark ranges in MARKS."
3951 (let ((uncompressed '(score bookmark))
3954 (if (memq (caar marks) uncompressed)
3955 (push (car marks) out)
3956 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3957 (setq marks (cdr marks)))
3960 (defun gnus-adjust-marked-articles (info)
3961 "Set all article lists and remove all marks that are no longer legal."
3962 (let* ((marked-lists (gnus-info-marks info))
3963 (active (gnus-active (gnus-info-group info)))
3966 (types gnus-article-mark-lists)
3967 (uncompressed '(score bookmark killed))
3968 marks var articles article mark)
3971 (setq marks (pop marked-lists))
3972 (set (setq var (intern (format "gnus-newsgroup-%s"
3973 (car (rassq (setq mark (car marks))
3975 (if (memq (car marks) uncompressed) (cdr marks)
3976 (gnus-uncompress-range (cdr marks))))
3978 (setq articles (symbol-value var))
3980 ;; All articles have to be subsets of the active articles.
3982 ;; Adjust "simple" lists.
3983 ((memq mark '(tick dormant expire reply save))
3985 (when (or (< (setq article (pop articles)) min) (> article max))
3986 (set var (delq article (symbol-value var))))))
3988 ((memq mark uncompressed)
3989 (when (not (listp (cdr (symbol-value var))))
3990 (set var (list (symbol-value var))))
3991 (when (not (listp (cdr articles)))
3992 (setq articles (list articles)))
3994 (when (or (not (consp (setq article (pop articles))))
3995 (< (car article) min)
3996 (> (car article) max))
3997 (set var (delq article (symbol-value var))))))))))
3999 (defun gnus-update-missing-marks (missing)
4000 "Go through the list of MISSING articles and remove them from the mark lists."
4002 (let ((types gnus-article-mark-lists)
4004 ;; Go through all types.
4006 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4007 (when (symbol-value var)
4008 ;; This list has articles. So we delete all missing articles
4012 (set var (delq (pop m) (symbol-value var)))))))))
4014 (defun gnus-update-marks ()
4015 "Enter the various lists of marked articles into the newsgroup info list."
4016 (let ((types gnus-article-mark-lists)
4017 (info (gnus-get-info gnus-newsgroup-name))
4018 (uncompressed '(score bookmark killed))
4019 type list newmarked symbol)
4021 ;; Add all marks lists that are non-nil to the list of marks lists.
4022 (while (setq type (pop types))
4023 (when (setq list (symbol-value
4025 (intern (format "gnus-newsgroup-%s"
4028 ;; Get rid of the entries of the articles that have the
4030 (when (and (eq (cdr type) 'score)
4034 (prev (cons nil list))
4037 (if (or (not (consp (car arts)))
4038 (= (cdar arts) gnus-summary-default-score))
4039 (setcdr prev (cdr arts))
4041 (setq arts (cdr arts)))
4042 (setq list (cdr all))))
4044 (push (cons (cdr type)
4045 (if (memq (cdr type) uncompressed) list
4046 (gnus-compress-sequence
4047 (set symbol (sort list '<)) t)))
4050 ;; Enter these new marks into the info of the group.
4052 (setcar (nthcdr 3 info) newmarked)
4053 ;; Add the marks lists to the end of the info.
4055 (setcdr (nthcdr 2 info) (list newmarked))))
4057 ;; Cut off the end of the info if there's nothing else there.
4061 (when (nthcdr (decf i) info)
4062 (setcdr (nthcdr i info) nil)))))))
4064 (defun gnus-set-mode-line (where)
4065 "This function sets the mode line of the article or summary buffers.
4066 If WHERE is `summary', the summary mode line format will be used."
4067 ;; Is this mode line one we keep updated?
4068 (when (memq where gnus-updated-mode-lines)
4071 ;; We evaluate this in the summary buffer since these
4072 ;; variables are buffer-local to that buffer.
4073 (set-buffer gnus-summary-buffer)
4074 ;; We bind all these variables that are used in the `eval' form
4076 (let* ((mformat (symbol-value
4078 (format "gnus-%s-mode-line-format-spec" where))))
4079 (gnus-tmp-group-name gnus-newsgroup-name)
4080 (gnus-tmp-article-number (or gnus-current-article 0))
4081 (gnus-tmp-unread gnus-newsgroup-unreads)
4082 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4083 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4084 (gnus-tmp-unread-and-unselected
4085 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4086 (zerop gnus-tmp-unselected))
4088 ((zerop gnus-tmp-unselected)
4089 (format "{%d more}" gnus-tmp-unread-and-unticked))
4090 (t (format "{%d(+%d) more}"
4091 gnus-tmp-unread-and-unticked
4092 gnus-tmp-unselected))))
4094 (if (and gnus-current-headers
4095 (vectorp gnus-current-headers))
4096 (gnus-mode-string-quote
4097 (mail-header-subject gnus-current-headers))
4099 bufname-length max-len
4100 gnus-tmp-header);; passed as argument to any user-format-funcs
4101 (setq mode-string (eval mformat))
4102 (setq bufname-length (if (string-match "%b" mode-string)
4105 (if (eq where 'summary)
4107 (get-buffer gnus-article-buffer))))
4110 (setq max-len (max 4 (if gnus-mode-non-string-length
4112 gnus-mode-non-string-length
4114 (length mode-string))))
4115 ;; We might have to chop a bit of the string off...
4116 (when (> (length mode-string) max-len)
4118 (concat (gnus-truncate-string mode-string (- max-len 3))
4120 ;; Pad the mode string a bit.
4121 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4122 ;; Update the mode line.
4123 (setq mode-line-buffer-identification
4124 (gnus-mode-line-buffer-identification (list mode-string)))
4125 (set-buffer-modified-p t))))
4127 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4128 "Go through the HEADERS list and add all Xrefs to a hash table.
4129 The resulting hash table is returned, or nil if no Xrefs were found."
4130 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4131 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4132 (xref-hashtb (gnus-make-hashtable))
4133 start group entry number xrefs header)
4135 (setq header (pop headers))
4136 (when (and (setq xrefs (mail-header-xref header))
4137 (not (memq (setq number (mail-header-number header))
4140 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4141 (setq start (match-end 0))
4142 (setq group (if prefix
4143 (concat prefix (substring xrefs (match-beginning 1)
4145 (substring xrefs (match-beginning 1) (match-end 1))))
4147 (string-to-int (substring xrefs (match-beginning 2)
4149 (if (setq entry (gnus-gethash group xref-hashtb))
4150 (setcdr entry (cons number (cdr entry)))
4151 (gnus-sethash group (cons number nil) xref-hashtb)))))
4152 (and start xref-hashtb)))
4154 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4155 "Look through all the headers and mark the Xrefs as read."
4156 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4157 name entry info xref-hashtb idlist method nth4)
4159 (set-buffer gnus-group-buffer)
4160 (when (setq xref-hashtb
4161 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4164 (unless (string= from-newsgroup (setq name (symbol-name group)))
4165 (setq idlist (symbol-value group))
4166 ;; Dead groups are not updated.
4168 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4170 (when (stringp (setq nth4 (gnus-info-method info)))
4171 (setq nth4 (gnus-server-to-method nth4))))
4172 ;; Only do the xrefs if the group has the same
4173 ;; select method as the group we have just read.
4174 (or (gnus-methods-equal-p
4175 nth4 (gnus-find-method-for-group from-newsgroup))
4177 (equal nth4 (setq method (gnus-find-method-for-group
4179 (and (equal (car nth4) (car method))
4180 (equal (nth 1 nth4) (nth 1 method))))
4181 gnus-use-cross-reference
4182 (or (not (eq gnus-use-cross-reference t))
4184 ;; Only do cross-references on subscribed
4185 ;; groups, if that is what is wanted.
4186 (<= (gnus-info-level info) gnus-level-subscribed))
4187 (gnus-group-make-articles-read name idlist))))
4190 (defun gnus-compute-read-articles (group articles)
4191 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4192 (info (nth 2 entry))
4193 (active (gnus-active group))
4196 ;; First peel off all illegal article numbers.
4198 (let ((ids articles)
4200 (while (setq id (pop ids))
4201 (when (and first (> id (cdr active)))
4202 ;; We'll end up in this situation in one particular
4203 ;; obscure situation. If you re-scan a group and get
4204 ;; a new article that is cross-posted to a different
4205 ;; group that has not been re-scanned, you might get
4206 ;; crossposted article that has a higher number than
4207 ;; Gnus believes possible. So we re-activate this
4208 ;; group as well. This might mean doing the
4209 ;; crossposting thingy will *increase* the number
4210 ;; of articles in some groups. Tsk, tsk.
4211 (setq active (or (gnus-activate-group group) active)))
4212 (when (or (> id (cdr active))
4213 (< id (car active)))
4214 (setq articles (delq id articles))))))
4215 ;; If the read list is nil, we init it.
4217 (null (gnus-info-read info))
4219 (setq ninfo (cons 1 (1- (car active))))
4220 (setq ninfo (gnus-info-read info)))
4221 ;; Then we add the read articles to the range.
4223 ninfo (setq articles (sort articles '<))))))
4225 (defun gnus-group-make-articles-read (group articles)
4226 "Update the info of GROUP to say that ARTICLES are read."
4228 (entry (gnus-gethash group gnus-newsrc-hashtb))
4229 (info (nth 2 entry))
4230 (active (gnus-active group))
4233 (setq range (gnus-compute-read-articles group articles))
4235 (set-buffer gnus-group-buffer)
4238 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4239 (gnus-info-set-read ',info ',(gnus-info-read info))
4240 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4241 (gnus-group-update-group ,group t))))
4242 ;; Add the read articles to the range.
4243 (gnus-info-set-read info range)
4244 ;; Then we have to re-compute how many unread
4245 ;; articles there are in this group.
4249 (setq num (- (1+ (cdr active)) (car active))))
4250 ((not (listp (cdr range)))
4251 (setq num (- (cdr active) (- (1+ (cdr range))
4255 (if (numberp (car range))
4257 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4258 (setq range (cdr range)))
4259 (setq num (- (cdr active) num))))
4260 ;; Update the number of unread articles.
4262 ;; Update the group buffer.
4263 (gnus-group-update-group group t)))))
4265 (defun gnus-methods-equal-p (m1 m2)
4266 (let ((m1 (or m1 gnus-select-method))
4267 (m2 (or m2 gnus-select-method)))
4269 (and (eq (car m1) (car m2))
4270 (or (not (memq 'address (assoc (symbol-name (car m1))
4271 gnus-valid-select-methods)))
4272 (equal (nth 1 m1) (nth 1 m2)))))))
4274 (defvar gnus-newsgroup-none-id 0)
4276 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4277 (let ((cur nntp-server-buffer)
4280 (save-excursion (set-buffer gnus-summary-buffer)
4281 gnus-newsgroup-dependencies)))
4282 headers id id-dep ref-dep end ref)
4284 (set-buffer nntp-server-buffer)
4285 ;; Translate all TAB characters into SPACE characters.
4286 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4287 (run-hooks 'gnus-parse-headers-hook)
4288 (let ((case-fold-search t)
4289 in-reply-to header p lines)
4290 (goto-char (point-min))
4291 ;; Search to the beginning of the next header. Error messages
4292 ;; do not begin with 2 or 3.
4293 (while (re-search-forward "^[23][0-9]+ " nil t)
4296 ;; This implementation of this function, with nine
4297 ;; search-forwards instead of the one re-search-forward and
4298 ;; a case (which basically was the old function) is actually
4299 ;; about twice as fast, even though it looks messier. You
4300 ;; can't have everything, I guess. Speed and elegance
4301 ;; doesn't always go hand in hand.
4310 (narrow-to-region (point)
4311 (or (and (search-forward "\n.\n" nil t)
4317 (if (search-forward "\nsubject: " nil t)
4318 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4320 gnus-unstructured-field-decoder (nnheader-header-value))
4325 (if (search-forward "\nfrom: " nil t)
4326 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4328 gnus-structured-field-decoder (nnheader-header-value))
4333 (if (search-forward "\ndate: " nil t)
4334 (nnheader-header-value) ""))
4338 (setq id (if (search-forward "\nmessage-id:" nil t)
4340 (1- (or (search-forward "<" nil t) (point)))
4341 (or (search-forward ">" nil t) (point)))
4342 ;; If there was no message-id, we just fake one
4343 ;; to make subsequent routines simpler.
4344 (nnheader-generate-fake-message-id))))
4348 (if (search-forward "\nreferences: " nil t)
4352 (nnheader-header-value)
4357 (search-backward ">" end t)
4360 (search-backward "<" end t)
4362 ;; Get the references from the in-reply-to header if there
4363 ;; were no references and the in-reply-to header looks
4365 (if (and (search-forward "\nin-reply-to: " nil t)
4366 (setq in-reply-to (nnheader-header-value))
4367 (string-match "<[^>]+>" in-reply-to))
4368 (setq ref (substring in-reply-to (match-beginning 0)
4376 (if (search-forward "\nlines: " nil t)
4377 (if (numberp (setq lines (ignore-errors (read cur))))
4383 (and (search-forward "\nxref: " nil t)
4384 (nnheader-header-value)))))
4385 (when (equal id ref)
4388 (when gnus-alter-header-function
4389 (funcall gnus-alter-header-function header)
4390 (setq id (mail-header-id header)
4391 ref (gnus-parent-id (mail-header-references header))))
4393 ;; We do the threading while we read the headers. The
4394 ;; message-id and the last reference are both entered into
4395 ;; the same hash table. Some tippy-toeing around has to be
4396 ;; done in case an article has arrived before the article
4397 ;; which it refers to.
4398 (if (boundp (setq id-dep (intern id dependencies)))
4399 (if (and (car (symbol-value id-dep))
4401 ;; An article with this Message-ID has already been seen.
4402 (if gnus-summary-ignore-duplicates
4403 ;; We ignore this one, except we add
4404 ;; any additional Xrefs (in case the two articles
4405 ;; came from different servers).
4407 (mail-header-set-xref
4408 (car (symbol-value id-dep))
4409 (concat (or (mail-header-xref
4410 (car (symbol-value id-dep)))
4412 (or (mail-header-xref header) "")))
4414 ;; We rename the Message-ID.
4416 (setq id-dep (intern (setq id (nnmail-message-id))
4419 (mail-header-set-id header id))
4420 (setcar (symbol-value id-dep) header))
4421 (set id-dep (list header)))
4423 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4424 (setcdr (symbol-value ref-dep)
4425 (nconc (cdr (symbol-value ref-dep))
4426 (list (symbol-value id-dep))))
4427 (set ref-dep (list nil (symbol-value id-dep))))
4428 (push header headers))
4429 (goto-char (point-max))
4431 (nreverse headers)))))
4433 ;; The following macros and functions were written by Felix Lee
4434 ;; <flee@cse.psu.edu>.
4436 (defmacro gnus-nov-read-integer ()
4438 (if (= (following-char) ?\t)
4440 (let ((num (ignore-errors (read buffer))))
4441 (if (numberp num) num 0)))
4443 (search-forward "\t" eol 'move))))
4445 (defmacro gnus-nov-skip-field ()
4446 '(search-forward "\t" eol 'move))
4448 (defmacro gnus-nov-field ()
4449 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4451 ;; (defvar gnus-nov-none-counter 0)
4453 ;; This function has to be called with point after the article number
4454 ;; on the beginning of the line.
4455 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4456 (let ((eol (gnus-point-at-eol))
4457 (buffer (current-buffer))
4458 header ref id id-dep ref-dep)
4460 ;; overview: [num subject from date id refs chars lines misc]
4463 (narrow-to-region (point) eol)
4471 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4473 gnus-structured-field-decoder (gnus-nov-field)) ; from
4474 (gnus-nov-field) ; date
4475 (setq id (or (gnus-nov-field)
4476 (nnheader-generate-fake-message-id))) ; id
4478 (let ((beg (point)))
4479 (search-forward "\t" eol)
4480 (if (search-backward ">" beg t)
4484 (search-backward "<" beg t)))
4487 (gnus-nov-field)) ; refs
4488 (gnus-nov-read-integer) ; chars
4489 (gnus-nov-read-integer) ; lines
4490 (if (= (following-char) ?\n)
4492 (gnus-nov-field))))) ; misc
4496 (when gnus-alter-header-function
4497 (funcall gnus-alter-header-function header)
4498 (setq id (mail-header-id header)
4499 ref (gnus-parent-id (mail-header-references header))))
4501 ;; We build the thread tree.
4502 (when (equal id ref)
4503 ;; This article refers back to itself. Naughty, naughty.
4505 (if (boundp (setq id-dep (intern id dependencies)))
4506 (if (and (car (symbol-value id-dep))
4508 ;; An article with this Message-ID has already been seen.
4509 (if gnus-summary-ignore-duplicates
4510 ;; We ignore this one, except we add any additional
4511 ;; Xrefs (in case the two articles came from different
4514 (mail-header-set-xref
4515 (car (symbol-value id-dep))
4516 (concat (or (mail-header-xref
4517 (car (symbol-value id-dep)))
4519 (or (mail-header-xref header) "")))
4521 ;; We rename the Message-ID.
4523 (setq id-dep (intern (setq id (nnmail-message-id))
4526 (mail-header-set-id header id))
4527 (setcar (symbol-value id-dep) header))
4528 (set id-dep (list header)))
4530 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4531 (setcdr (symbol-value ref-dep)
4532 (nconc (cdr (symbol-value ref-dep))
4533 (list (symbol-value id-dep))))
4534 (set ref-dep (list nil (symbol-value id-dep)))))
4537 ;; Goes through the xover lines and returns a list of vectors
4538 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4539 force-new dependencies
4540 group also-fetch-heads)
4541 "Parse the news overview data in the server buffer, and return a
4542 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4543 ;; Get the Xref when the users reads the articles since most/some
4544 ;; NNTP servers do not include Xrefs when using XOVER.
4545 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4546 (let ((cur nntp-server-buffer)
4547 (dependencies (or dependencies gnus-newsgroup-dependencies))
4548 number headers header)
4550 (set-buffer nntp-server-buffer)
4551 ;; Allow the user to mangle the headers before parsing them.
4552 (run-hooks 'gnus-parse-headers-hook)
4553 (goto-char (point-min))
4556 (while (and sequence (not (eobp)))
4557 (setq number (read cur))
4558 (while (and sequence
4559 (< (car sequence) number))
4560 (setq sequence (cdr sequence)))
4562 (eq number (car sequence))
4564 (setq sequence (cdr sequence))
4565 (setq header (inline
4566 (gnus-nov-parse-line
4567 number dependencies force-new))))
4568 (push header headers))
4571 (gnus-error 4 "Strange nov line (%d)"
4572 (count-lines (point-min) (point)))))
4574 ;; A common bug in inn is that if you have posted an article and
4575 ;; then retrieves the active file, it will answer correctly --
4576 ;; the new article is included. However, a NOV entry for the
4577 ;; article may not have been generated yet, so this may fail.
4578 ;; We work around this problem by retrieving the last few
4579 ;; headers using HEAD.
4580 (if (or (not also-fetch-heads)
4582 ;; We (probably) got all the headers.
4584 (let ((gnus-nov-is-evil t))
4587 (when (gnus-retrieve-headers sequence group)
4588 (gnus-get-newsgroup-headers))))))))
4590 (defun gnus-article-get-xrefs ()
4591 "Fill in the Xref value in `gnus-current-headers', if necessary.
4592 This is meant to be called in `gnus-article-internal-prepare-hook'."
4593 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4594 gnus-current-headers)))
4595 (or (not gnus-use-cross-reference)
4597 (and (mail-header-xref headers)
4598 (not (string= (mail-header-xref headers) "")))
4599 (let ((case-fold-search t)
4602 (nnheader-narrow-to-headers)
4603 (goto-char (point-min))
4604 (when (or (and (eq (downcase (following-char)) ?x)
4605 (looking-at "Xref:"))
4606 (search-forward "\nXref:" nil t))
4607 (goto-char (1+ (match-end 0)))
4608 (setq xref (buffer-substring (point)
4609 (progn (end-of-line) (point))))
4610 (mail-header-set-xref headers xref)))))))
4612 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4613 "Find article ID and insert the summary line for that article."
4614 (let ((header (if (and old-header use-old-header)
4615 old-header (gnus-read-header id)))
4616 (number (and (numberp id) id))
4619 ;; Rebuild the thread that this article is part of and go to the
4620 ;; article we have fetched.
4621 (when (and (not gnus-show-threads)
4623 (when (setq d (gnus-data-find (mail-header-number old-header)))
4624 (goto-char (gnus-data-pos d))
4627 (- (gnus-point-at-bol)
4629 (1+ (gnus-point-at-eol))
4630 (gnus-delete-line))))))
4632 (mail-header-set-number header (mail-header-number old-header)))
4633 (setq gnus-newsgroup-sparse
4634 (delq (setq number (mail-header-number header))
4635 gnus-newsgroup-sparse))
4636 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4637 (gnus-rebuild-thread (mail-header-id header))
4638 (gnus-summary-goto-subject number nil t))
4639 (when (and (numberp number)
4641 ;; We have to update the boundaries even if we can't fetch the
4642 ;; article if ID is a number -- so that the next `P' or `N'
4643 ;; command will fetch the previous (or next) article even
4644 ;; if the one we tried to fetch this time has been canceled.
4645 (when (> number gnus-newsgroup-end)
4646 (setq gnus-newsgroup-end number))
4647 (when (< number gnus-newsgroup-begin)
4648 (setq gnus-newsgroup-begin number))
4649 (setq gnus-newsgroup-unselected
4650 (delq number gnus-newsgroup-unselected)))
4651 ;; Report back a success?
4652 (and header (mail-header-number header))))
4654 ;;; Process/prefix in the summary buffer
4656 (defun gnus-summary-work-articles (n)
4657 "Return a list of articles to be worked upon. The prefix argument,
4658 the list of process marked articles, and the current article will be
4659 taken into consideration."
4662 ;; A numerical prefix has been given.
4663 (setq n (prefix-numeric-value n))
4664 (let ((backward (< n 0))
4665 (n (abs (prefix-numeric-value n)))
4670 (push (setq article (gnus-summary-article-number))
4673 (gnus-summary-find-prev nil article)
4674 (gnus-summary-find-next nil article)))
4676 (nreverse articles)))
4677 ((gnus-region-active-p)
4678 ;; Work on the region between point and mark.
4679 (let ((max (max (point) (mark)))
4682 (goto-char (min (point) (mark)))
4685 (push (setq article (gnus-summary-article-number)) articles)
4686 (gnus-summary-find-next nil article)
4688 (nreverse articles))))
4689 (gnus-newsgroup-processable
4690 ;; There are process-marked articles present.
4691 ;; Save current state.
4692 (gnus-summary-save-process-mark)
4694 (reverse gnus-newsgroup-processable))
4696 ;; Just return the current article.
4697 (list (gnus-summary-article-number)))))
4699 (defun gnus-summary-save-process-mark ()
4700 "Push the current set of process marked articles on the stack."
4702 (push (copy-sequence gnus-newsgroup-processable)
4703 gnus-newsgroup-process-stack))
4705 (defun gnus-summary-kill-process-mark ()
4706 "Push the current set of process marked articles on the stack and unmark."
4708 (gnus-summary-save-process-mark)
4709 (gnus-summary-unmark-all-processable))
4711 (defun gnus-summary-yank-process-mark ()
4712 "Pop the last process mark state off the stack and restore it."
4714 (unless gnus-newsgroup-process-stack
4715 (error "Empty mark stack"))
4716 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4718 (defun gnus-summary-process-mark-set (set)
4719 "Make SET into the current process marked articles."
4720 (gnus-summary-unmark-all-processable)
4722 (gnus-summary-set-process-mark (pop set))))
4724 ;;; Searching and stuff
4726 (defun gnus-summary-search-group (&optional backward use-level)
4727 "Search for next unread newsgroup.
4728 If optional argument BACKWARD is non-nil, search backward instead."
4730 (set-buffer gnus-group-buffer)
4731 (when (gnus-group-search-forward
4732 backward nil (if use-level (gnus-group-group-level) nil))
4733 (gnus-group-group-name))))
4735 (defun gnus-summary-best-group (&optional exclude-group)
4736 "Find the name of the best unread group.
4737 If EXCLUDE-GROUP, do not go to this group."
4739 (set-buffer gnus-group-buffer)
4741 (gnus-group-best-unread-group exclude-group))))
4743 (defun gnus-summary-find-next (&optional unread article backward)
4744 (if backward (gnus-summary-find-prev)
4745 (let* ((dummy (gnus-summary-article-intangible-p))
4746 (article (or article (gnus-summary-article-number)))
4747 (arts (gnus-data-find-list article))
4749 (when (and (not dummy)
4750 (or (not gnus-summary-check-current)
4752 (not (gnus-data-unread-p (car arts)))))
4753 (setq arts (cdr arts)))
4758 (when (gnus-data-unread-p (car arts))
4759 (setq result (car arts)
4761 (setq arts (cdr arts)))
4764 (goto-char (gnus-data-pos result))
4765 (gnus-data-number result)))))
4767 (defun gnus-summary-find-prev (&optional unread article)
4768 (let* ((eobp (eobp))
4769 (article (or article (gnus-summary-article-number)))
4770 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4772 (when (and (not eobp)
4773 (or (not gnus-summary-check-current)
4775 (not (gnus-data-unread-p (car arts)))))
4776 (setq arts (cdr arts)))
4781 (when (gnus-data-unread-p (car arts))
4782 (setq result (car arts)
4784 (setq arts (cdr arts)))
4787 (goto-char (gnus-data-pos result))
4788 (gnus-data-number result))))
4790 (defun gnus-summary-find-subject (subject &optional unread backward article)
4791 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4792 (article (or article (gnus-summary-article-number)))
4793 (articles (gnus-data-list backward))
4794 (arts (gnus-data-find-list article articles))
4796 (when (or (not gnus-summary-check-current)
4798 (not (gnus-data-unread-p (car arts))))
4799 (setq arts (cdr arts)))
4801 (and (or (not unread)
4802 (gnus-data-unread-p (car arts)))
4803 (vectorp (gnus-data-header (car arts)))
4805 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4806 (setq result (car arts)
4808 (setq arts (cdr arts)))
4810 (goto-char (gnus-data-pos result))
4811 (gnus-data-number result))))
4813 (defun gnus-summary-search-forward (&optional unread subject backward)
4814 "Search forward for an article.
4815 If UNREAD, look for unread articles. If SUBJECT, look for
4816 articles with that subject. If BACKWARD, search backward instead."
4817 (cond (subject (gnus-summary-find-subject subject unread backward))
4818 (backward (gnus-summary-find-prev unread))
4819 (t (gnus-summary-find-next unread))))
4821 (defun gnus-recenter (&optional n)
4822 "Center point in window and redisplay frame.
4823 Also do horizontal recentering."
4825 (when (and gnus-auto-center-summary
4826 (not (eq gnus-auto-center-summary 'vertical)))
4827 (gnus-horizontal-recenter))
4830 (defun gnus-summary-recenter ()
4831 "Center point in the summary window.
4832 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4833 displayed, no centering will be performed."
4834 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4835 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4836 (let* ((top (cond ((< (window-height) 4) 0)
4837 ((< (window-height) 7) 1)
4839 (height (1- (window-height)))
4840 (bottom (save-excursion (goto-char (point-max))
4841 (forward-line (- height))
4843 (window (get-buffer-window (current-buffer))))
4844 ;; The user has to want it.
4845 (when gnus-auto-center-summary
4846 (when (get-buffer-window gnus-article-buffer)
4847 ;; Only do recentering when the article buffer is displayed,
4848 ;; Set the window start to either `bottom', which is the biggest
4849 ;; possible valid number, or the second line from the top,
4850 ;; whichever is the least.
4852 window (min bottom (save-excursion
4853 (forward-line (- top)) (point)))))
4854 ;; Do horizontal recentering while we're at it.
4855 (when (and (get-buffer-window (current-buffer) t)
4856 (not (eq gnus-auto-center-summary 'vertical)))
4857 (let ((selected (selected-window)))
4858 (select-window (get-buffer-window (current-buffer) t))
4859 (gnus-summary-position-point)
4860 (gnus-horizontal-recenter)
4861 (select-window selected))))))
4863 (defun gnus-summary-jump-to-group (newsgroup)
4864 "Move point to NEWSGROUP in group mode buffer."
4865 ;; Keep update point of group mode buffer if visible.
4866 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4867 (save-window-excursion
4868 ;; Take care of tree window mode.
4869 (when (get-buffer-window gnus-group-buffer)
4870 (pop-to-buffer gnus-group-buffer))
4871 (gnus-group-jump-to-group newsgroup))
4873 ;; Take care of tree window mode.
4874 (if (get-buffer-window gnus-group-buffer)
4875 (pop-to-buffer gnus-group-buffer)
4876 (set-buffer gnus-group-buffer))
4877 (gnus-group-jump-to-group newsgroup))))
4879 ;; This function returns a list of article numbers based on the
4880 ;; difference between the ranges of read articles in this group and
4881 ;; the range of active articles.
4882 (defun gnus-list-of-unread-articles (group)
4883 (let* ((read (gnus-info-read (gnus-get-info group)))
4884 (active (or (gnus-active group) (gnus-activate-group group)))
4887 ;; If none are read, then all are unread.
4889 (setq first (car active))
4890 ;; If the range of read articles is a single range, then the
4891 ;; first unread article is the article after the last read
4892 ;; article. Sounds logical, doesn't it?
4893 (if (not (listp (cdr read)))
4894 (setq first (1+ (cdr read)))
4895 ;; `read' is a list of ranges.
4896 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4902 (while (< first nlast)
4904 (setq first (1+ first))))
4905 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4906 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4907 (setq read (cdr read)))))
4908 ;; And add the last unread articles.
4909 (while (<= first last)
4911 (setq first (1+ first)))
4912 ;; Return the list of unread articles.
4913 (delq 0 (nreverse unread))))
4915 (defun gnus-list-of-read-articles (group)
4916 "Return a list of unread, unticked and non-dormant articles."
4917 (let* ((info (gnus-get-info group))
4918 (marked (gnus-info-marks info))
4919 (active (gnus-active group)))
4921 (gnus-set-difference
4922 (gnus-sorted-complement
4923 (gnus-uncompress-range active)
4924 (gnus-list-of-unread-articles group))
4926 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4927 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4929 ;; Various summary commands
4931 (defun gnus-summary-select-article-buffer ()
4932 "Reconfigure windows to show article buffer."
4934 (if (not (gnus-buffer-live-p gnus-article-buffer))
4935 (error "There is no article buffer for this summary buffer")
4936 (gnus-configure-windows 'article)
4937 (select-window (get-buffer-window gnus-article-buffer))))
4939 (defun gnus-summary-universal-argument (arg)
4940 "Perform any operation on all articles that are process/prefixed."
4942 (let ((articles (gnus-summary-work-articles arg))
4949 (substitute-command-keys
4950 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4953 (gnus-error 1 "Undefined key")
4956 (gnus-summary-goto-subject (setq article (pop articles)))
4957 (let (gnus-newsgroup-processable)
4958 (command-execute func))
4959 (gnus-summary-remove-process-mark article)))))
4960 (gnus-summary-position-point))
4962 (defun gnus-summary-toggle-truncation (&optional arg)
4963 "Toggle truncation of summary lines.
4964 With arg, turn line truncation on iff arg is positive."
4966 (setq truncate-lines
4967 (if (null arg) (not truncate-lines)
4968 (> (prefix-numeric-value arg) 0)))
4971 (defun gnus-summary-reselect-current-group (&optional all rescan)
4972 "Exit and then reselect the current newsgroup.
4973 The prefix argument ALL means to select all articles."
4975 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4976 (error "Ephemeral groups can't be reselected"))
4977 (let ((current-subject (gnus-summary-article-number))
4978 (group gnus-newsgroup-name))
4979 (setq gnus-newsgroup-begin nil)
4981 ;; We have to adjust the point of group mode buffer because
4982 ;; point was moved to the next unread newsgroup by exiting.
4983 (gnus-summary-jump-to-group group)
4986 (gnus-group-get-new-news-this-group 1)))
4987 (gnus-group-read-group all t)
4988 (gnus-summary-goto-subject current-subject nil t)))
4990 (defun gnus-summary-rescan-group (&optional all)
4991 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4993 (gnus-summary-reselect-current-group all t))
4995 (defun gnus-summary-update-info (&optional non-destructive)
4997 (let ((group gnus-newsgroup-name))
4999 (when gnus-newsgroup-kill-headers
5000 (setq gnus-newsgroup-killed
5001 (gnus-compress-sequence
5003 (gnus-set-sorted-intersection
5004 (gnus-uncompress-range gnus-newsgroup-killed)
5005 (setq gnus-newsgroup-unselected
5006 (sort gnus-newsgroup-unselected '<)))
5007 (setq gnus-newsgroup-unreads
5008 (sort gnus-newsgroup-unreads '<)))
5010 (unless (listp (cdr gnus-newsgroup-killed))
5011 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5012 (let ((headers gnus-newsgroup-headers))
5013 (when (and (not gnus-save-score)
5014 (not non-destructive))
5015 (setq gnus-newsgroup-scored nil))
5016 ;; Set the new ranges of read articles.
5018 (set-buffer gnus-group-buffer)
5019 (gnus-undo-force-boundary))
5020 (gnus-update-read-articles
5021 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5022 ;; Set the current article marks.
5024 ;; Do the cross-ref thing.
5025 (when gnus-use-cross-reference
5026 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5027 ;; Do not switch windows but change the buffer to work.
5028 (set-buffer gnus-group-buffer)
5029 (unless (gnus-ephemeral-group-p group)
5030 (gnus-group-update-group group)))))))
5032 (defun gnus-summary-save-newsrc (&optional force)
5033 "Save the current number of read/marked articles in the dribble buffer.
5034 The dribble buffer will then be saved.
5035 If FORCE (the prefix), also save the .newsrc file(s)."
5037 (gnus-summary-update-info t)
5039 (gnus-save-newsrc-file)
5040 (gnus-dribble-save)))
5042 (defun gnus-summary-exit (&optional temporary)
5043 "Exit reading current newsgroup, and then return to group selection mode.
5044 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5046 (gnus-kill-save-kill-buffer)
5047 (let* ((group gnus-newsgroup-name)
5048 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5051 (buf (current-buffer)))
5052 (run-hooks 'gnus-summary-prepare-exit-hook)
5053 ;; If we have several article buffers, we kill them at exit.
5054 (unless gnus-single-article-buffer
5055 (gnus-kill-buffer gnus-original-article-buffer)
5056 (setq gnus-article-current nil))
5057 (when gnus-use-cache
5058 (gnus-cache-possibly-remove-articles)
5059 (gnus-cache-save-buffers))
5060 (gnus-async-prefetch-remove-group group)
5061 (when gnus-suppress-duplicates
5062 (gnus-dup-enter-articles))
5063 (when gnus-use-trees
5064 (gnus-tree-close group))
5065 ;; Make all changes in this group permanent.
5067 (run-hooks 'gnus-exit-group-hook)
5068 (gnus-summary-update-info)
5069 ;; Do adaptive scoring, and possibly save score files.
5070 (when gnus-newsgroup-adaptive
5071 (gnus-score-adaptive))
5072 (when gnus-use-scoring
5074 (gnus-close-group group)
5075 ;; Make sure where we were, and go to next newsgroup.
5076 (set-buffer gnus-group-buffer)
5078 (gnus-group-jump-to-group group))
5079 (run-hooks 'gnus-summary-exit-hook)
5080 (unless (or quit-config
5081 ;; If this group has disappeared from the summary
5082 ;; buffer, don't skip forwards.
5083 (not (string= group (gnus-group-group-name))))
5084 (gnus-group-next-unread-group 1))
5085 (setq group-point (point))
5088 ;; If we have several article buffers, we kill them at exit.
5089 (unless gnus-single-article-buffer
5090 (gnus-kill-buffer gnus-article-buffer)
5091 (gnus-kill-buffer gnus-original-article-buffer)
5092 (setq gnus-article-current nil))
5094 (if (not gnus-kill-summary-on-exit)
5095 (gnus-deaden-summary)
5096 ;; We set all buffer-local variables to nil. It is unclear why
5097 ;; this is needed, but if we don't, buffer-local variables are
5098 ;; not garbage-collected, it seems. This would the lead to en
5099 ;; ever-growing Emacs.
5100 (gnus-summary-clear-local-variables)
5101 (when (get-buffer gnus-article-buffer)
5102 (bury-buffer gnus-article-buffer))
5103 ;; We clear the global counterparts of the buffer-local
5104 ;; variables as well, just to be on the safe side.
5105 (set-buffer gnus-group-buffer)
5106 (gnus-summary-clear-local-variables)
5107 ;; Return to group mode buffer.
5108 (when (eq mode 'gnus-summary-mode)
5109 (gnus-kill-buffer buf)))
5110 (setq gnus-current-select-method gnus-select-method)
5111 (pop-to-buffer gnus-group-buffer)
5112 ;; Clear the current group name.
5113 (if (not quit-config)
5115 (goto-char group-point)
5116 (gnus-configure-windows 'group 'force))
5117 (gnus-handle-ephemeral-exit quit-config))
5119 (setq gnus-newsgroup-name nil)))))
5121 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5122 (defun gnus-summary-exit-no-update (&optional no-questions)
5123 "Quit reading current newsgroup without updating read article info."
5125 (let* ((group gnus-newsgroup-name)
5126 (quit-config (gnus-group-quit-config group)))
5127 (when (or no-questions
5129 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5130 ;; If we have several article buffers, we kill them at exit.
5131 (unless gnus-single-article-buffer
5132 (gnus-kill-buffer gnus-article-buffer)
5133 (gnus-kill-buffer gnus-original-article-buffer)
5134 (setq gnus-article-current nil))
5135 (if (not gnus-kill-summary-on-exit)
5136 (gnus-deaden-summary)
5137 (gnus-close-group group)
5138 (gnus-summary-clear-local-variables)
5139 (set-buffer gnus-group-buffer)
5140 (gnus-summary-clear-local-variables)
5141 (when (get-buffer gnus-summary-buffer)
5142 (kill-buffer gnus-summary-buffer)))
5143 (unless gnus-single-article-buffer
5144 (setq gnus-article-current nil))
5145 (when gnus-use-trees
5146 (gnus-tree-close group))
5147 (gnus-async-prefetch-remove-group group)
5148 (when (get-buffer gnus-article-buffer)
5149 (bury-buffer gnus-article-buffer))
5150 ;; Return to the group buffer.
5151 (gnus-configure-windows 'group 'force)
5152 ;; Clear the current group name.
5153 (setq gnus-newsgroup-name nil)
5154 (when (equal (gnus-group-group-name) group)
5155 (gnus-group-next-unread-group 1))
5157 (gnus-handle-ephemeral-exit quit-config)))))
5159 (defun gnus-handle-ephemeral-exit (quit-config)
5160 "Handle movement when leaving an ephemeral group. The state
5161 which existed when entering the ephemeral is reset."
5162 (if (not (buffer-name (car quit-config)))
5163 (gnus-configure-windows 'group 'force)
5164 (set-buffer (car quit-config))
5165 (cond ((eq major-mode 'gnus-summary-mode)
5166 (gnus-set-global-variables))
5167 ((eq major-mode 'gnus-article-mode)
5169 ;; The `gnus-summary-buffer' variable may point
5170 ;; to the old summary buffer when using a single
5172 (unless (gnus-buffer-live-p gnus-summary-buffer)
5173 (set-buffer gnus-group-buffer))
5174 (set-buffer gnus-summary-buffer)
5175 (gnus-set-global-variables))))
5176 (if (or (eq (cdr quit-config) 'article)
5177 (eq (cdr quit-config) 'pick))
5179 ;; The current article may be from the ephemeral group
5180 ;; thus it is best that we reload this article
5181 (gnus-summary-show-article)
5182 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5183 (gnus-configure-windows 'pick 'force)
5184 (gnus-configure-windows (cdr quit-config) 'force)))
5185 (gnus-configure-windows (cdr quit-config) 'force))
5186 (when (eq major-mode 'gnus-summary-mode)
5187 (gnus-summary-next-subject 1 nil t)
5188 (gnus-summary-recenter)
5189 (gnus-summary-position-point))))
5191 (defun gnus-summary-preview-mime-message (arg)
5192 "MIME decode and play this message."
5194 (let ((gnus-break-pages nil))
5195 (gnus-summary-select-article t t)
5197 (pop-to-buffer gnus-original-article-buffer t)
5198 (let (buffer-read-only)
5199 (if (text-property-any (point-min) (point-max) 'invisible t)
5200 (remove-text-properties (point-min) (point-max)
5201 gnus-hidden-properties)
5203 (mime-view-mode nil nil nil gnus-original-article-buffer
5204 gnus-article-buffer)
5207 (defun gnus-summary-scroll-down ()
5208 "Scroll down one line current article."
5210 (gnus-summary-scroll-up -1)
5215 (defvar gnus-dead-summary-mode-map nil)
5217 (unless gnus-dead-summary-mode-map
5218 (setq gnus-dead-summary-mode-map (make-keymap))
5219 (suppress-keymap gnus-dead-summary-mode-map)
5220 (substitute-key-definition
5221 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5222 (let ((keys '("\C-d" "\r" "\177" [delete])))
5224 (define-key gnus-dead-summary-mode-map
5225 (pop keys) 'gnus-summary-wake-up-the-dead))))
5227 (defvar gnus-dead-summary-mode nil
5228 "Minor mode for Gnus summary buffers.")
5230 (defun gnus-dead-summary-mode (&optional arg)
5231 "Minor mode for Gnus summary buffers."
5233 (when (eq major-mode 'gnus-summary-mode)
5234 (make-local-variable 'gnus-dead-summary-mode)
5235 (setq gnus-dead-summary-mode
5236 (if (null arg) (not gnus-dead-summary-mode)
5237 (> (prefix-numeric-value arg) 0)))
5238 (when gnus-dead-summary-mode
5239 (gnus-add-minor-mode
5240 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5242 (defun gnus-deaden-summary ()
5243 "Make the current summary buffer into a dead summary buffer."
5244 ;; Kill any previous dead summary buffer.
5245 (when (and gnus-dead-summary
5246 (buffer-name gnus-dead-summary))
5248 (set-buffer gnus-dead-summary)
5249 (when gnus-dead-summary-mode
5250 (kill-buffer (current-buffer)))))
5251 ;; Make this the current dead summary.
5252 (setq gnus-dead-summary (current-buffer))
5253 (gnus-dead-summary-mode 1)
5254 (let ((name (buffer-name)))
5255 (when (string-match "Summary" name)
5257 (concat (substring name 0 (match-beginning 0)) "Dead "
5258 (substring name (match-beginning 0)))
5261 (defun gnus-kill-or-deaden-summary (buffer)
5262 "Kill or deaden the summary BUFFER."
5264 (when (and (buffer-name buffer)
5265 (not gnus-single-article-buffer))
5268 (gnus-kill-buffer gnus-article-buffer)
5269 (gnus-kill-buffer gnus-original-article-buffer)))
5270 (cond (gnus-kill-summary-on-exit
5271 (when (and gnus-use-trees
5272 (and (get-buffer buffer)
5273 (buffer-name (get-buffer buffer))))
5275 (set-buffer (get-buffer buffer))
5276 (gnus-tree-close gnus-newsgroup-name)))
5277 (gnus-kill-buffer buffer))
5278 ((and (get-buffer buffer)
5279 (buffer-name (get-buffer buffer)))
5282 (gnus-deaden-summary))))))
5284 (defun gnus-summary-wake-up-the-dead (&rest args)
5285 "Wake up the dead summary buffer."
5287 (gnus-dead-summary-mode -1)
5288 (let ((name (buffer-name)))
5289 (when (string-match "Dead " name)
5291 (concat (substring name 0 (match-beginning 0))
5292 (substring name (match-end 0)))
5294 (gnus-message 3 "This dead summary is now alive again"))
5296 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5297 (defun gnus-summary-fetch-faq (&optional faq-dir)
5298 "Fetch the FAQ for the current group.
5299 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5303 (when current-prefix-arg
5305 "Faq dir: " (and (listp gnus-group-faq-directory)
5306 (mapcar (lambda (file) (list file))
5307 gnus-group-faq-directory))))))
5308 (let (gnus-faq-buffer)
5309 (when (setq gnus-faq-buffer
5310 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5311 (gnus-configure-windows 'summary-faq))))
5313 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5314 (defun gnus-summary-describe-group (&optional force)
5315 "Describe the current newsgroup."
5317 (gnus-group-describe-group force gnus-newsgroup-name))
5319 (defun gnus-summary-describe-briefly ()
5320 "Describe summary mode commands briefly."
5323 (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")))
5325 ;; Walking around group mode buffer from summary mode.
5327 (defun gnus-summary-next-group (&optional no-article target-group backward)
5328 "Exit current newsgroup and then select next unread newsgroup.
5329 If prefix argument NO-ARTICLE is non-nil, no article is selected
5330 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5331 previous group instead."
5333 ;; Stop pre-fetching.
5334 (gnus-async-halt-prefetch)
5335 (let ((current-group gnus-newsgroup-name)
5336 (current-buffer (current-buffer))
5338 ;; First we semi-exit this group to update Xrefs and all variables.
5339 ;; We can't do a real exit, because the window conf must remain
5340 ;; the same in case the user is prompted for info, and we don't
5341 ;; want the window conf to change before that...
5342 (gnus-summary-exit t)
5343 (while (not entered)
5344 ;; Then we find what group we are supposed to enter.
5345 (set-buffer gnus-group-buffer)
5346 (gnus-group-jump-to-group current-group)
5349 (if (eq gnus-keep-same-level 'best)
5350 (gnus-summary-best-group gnus-newsgroup-name)
5351 (gnus-summary-search-group backward gnus-keep-same-level))))
5352 (if (not target-group)
5353 ;; There are no further groups, so we return to the group
5356 (gnus-message 5 "Returning to the group buffer")
5358 (when (gnus-buffer-live-p current-buffer)
5359 (set-buffer current-buffer)
5360 (gnus-summary-exit))
5361 (run-hooks 'gnus-group-no-more-groups-hook))
5362 ;; We try to enter the target group.
5363 (gnus-group-jump-to-group target-group)
5364 (let ((unreads (gnus-group-group-unread)))
5365 (if (and (or (eq t unreads)
5366 (and unreads (not (zerop unreads))))
5367 (gnus-summary-read-group
5368 target-group nil no-article
5369 (and (buffer-name current-buffer) current-buffer)))
5371 (setq current-group target-group
5372 target-group nil)))))))
5374 (defun gnus-summary-prev-group (&optional no-article)
5375 "Exit current newsgroup and then select previous unread newsgroup.
5376 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5378 (gnus-summary-next-group no-article nil t))
5380 ;; Walking around summary lines.
5382 (defun gnus-summary-first-subject (&optional unread)
5383 "Go to the first unread subject.
5384 If UNREAD is non-nil, go to the first unread article.
5385 Returns the article selected or nil if there are no unread articles."
5390 ((null gnus-newsgroup-data)
5391 (gnus-message 3 "No articles in the group")
5393 ;; Pick the first article.
5395 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5396 (gnus-data-number (car gnus-newsgroup-data)))
5397 ;; No unread articles.
5398 ((null gnus-newsgroup-unreads)
5399 (gnus-message 3 "No more unread articles")
5401 ;; Find the first unread article.
5403 (let ((data gnus-newsgroup-data))
5405 (not (gnus-data-unread-p (car data))))
5406 (setq data (cdr data)))
5408 (goto-char (gnus-data-pos (car data)))
5409 (gnus-data-number (car data))))))
5410 (gnus-summary-position-point)))
5412 (defun gnus-summary-next-subject (n &optional unread dont-display)
5413 "Go to next N'th summary line.
5414 If N is negative, go to the previous N'th subject line.
5415 If UNREAD is non-nil, only unread articles are selected.
5416 The difference between N and the actual number of steps taken is
5419 (let ((backward (< n 0))
5423 (gnus-summary-find-prev unread)
5424 (gnus-summary-find-next unread)))
5427 (gnus-message 7 "No more%s articles"
5428 (if unread " unread" "")))
5429 (unless dont-display
5430 (gnus-summary-recenter)
5431 (gnus-summary-position-point))
5434 (defun gnus-summary-next-unread-subject (n)
5435 "Go to next N'th unread summary line."
5437 (gnus-summary-next-subject n t))
5439 (defun gnus-summary-prev-subject (n &optional unread)
5440 "Go to previous N'th summary line.
5441 If optional argument UNREAD is non-nil, only unread article is selected."
5443 (gnus-summary-next-subject (- n) unread))
5445 (defun gnus-summary-prev-unread-subject (n)
5446 "Go to previous N'th unread summary line."
5448 (gnus-summary-next-subject (- n) t))
5450 (defun gnus-summary-goto-subject (article &optional force silent)
5451 "Go the subject line of ARTICLE.
5452 If FORCE, also allow jumping to articles not currently shown."
5453 (interactive "nArticle number: ")
5455 (data (gnus-data-find article)))
5456 ;; We read in the article if we have to.
5459 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5460 (setq data (gnus-data-find article)))
5465 (gnus-message 3 "Can't find article %d" article))
5467 (goto-char (gnus-data-pos data))
5470 ;; Walking around summary lines with displaying articles.
5472 (defun gnus-summary-expand-window (&optional arg)
5473 "Make the summary buffer take up the entire Emacs frame.
5474 Given a prefix, will force an `article' buffer configuration."
5477 (gnus-configure-windows 'article 'force)
5478 (gnus-configure-windows 'summary 'force)))
5480 (defun gnus-summary-display-article (article &optional all-header)
5481 "Display ARTICLE in article buffer."
5482 (gnus-set-global-variables)
5486 (if gnus-summary-display-article-function
5487 (funcall gnus-summary-display-article-function article all-header)
5488 (gnus-article-prepare article all-header))
5489 (run-hooks 'gnus-select-article-hook)
5490 (when (and gnus-current-article
5491 (not (zerop gnus-current-article)))
5492 (gnus-summary-goto-subject gnus-current-article))
5493 (gnus-summary-recenter)
5494 (when (and gnus-use-trees gnus-show-threads)
5495 (gnus-possibly-generate-tree article)
5496 (gnus-highlight-selected-tree article))
5497 ;; Successfully display article.
5498 (gnus-article-set-window-start
5499 (cdr (assq article gnus-newsgroup-bookmarks))))))
5501 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5502 "Select the current article.
5503 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5504 non-nil, the article will be re-fetched even if it already present in
5505 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5507 ;; Make sure we are in the summary buffer to work around bbdb bug.
5508 (unless (eq major-mode 'gnus-summary-mode)
5509 (set-buffer gnus-summary-buffer))
5510 (let ((article (or article (gnus-summary-article-number)))
5511 (all-headers (not (not all-headers))) ;Must be T or NIL.
5512 gnus-summary-display-article-function
5515 (gnus-summary-article-pseudo-p article)
5516 (error "This is a pseudo-article"))
5519 (set-buffer gnus-summary-buffer)
5520 (if (or (and gnus-single-article-buffer
5521 (or (null gnus-current-article)
5522 (null gnus-article-current)
5523 (null (get-buffer gnus-article-buffer))
5524 (not (eq article (cdr gnus-article-current)))
5525 (not (equal (car gnus-article-current)
5526 gnus-newsgroup-name))))
5527 (and (not gnus-single-article-buffer)
5528 (or (null gnus-current-article)
5529 (not (eq gnus-current-article article))))
5531 ;; The requested article is different from the current article.
5533 (gnus-summary-display-article article all-headers)
5535 (when (or all-headers gnus-show-all-headers)
5536 (gnus-article-show-all-headers))
5539 (gnus-article-set-window-start
5540 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5542 (defun gnus-summary-set-current-mark (&optional current-mark)
5543 "Obsolete function."
5546 (defun gnus-summary-next-article (&optional unread subject backward push)
5547 "Select the next article.
5548 If UNREAD, only unread articles are selected.
5549 If SUBJECT, only articles with SUBJECT are selected.
5550 If BACKWARD, the previous article is selected instead of the next."
5553 ;; Is there such an article?
5554 ((and (gnus-summary-search-forward unread subject backward)
5555 (or (gnus-summary-display-article (gnus-summary-article-number))
5556 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5557 (gnus-summary-position-point))
5558 ;; If not, we try the first unread, if that is wanted.
5560 gnus-auto-select-same
5561 (gnus-summary-first-unread-article))
5562 (gnus-summary-position-point)
5563 (gnus-message 6 "Wrapped"))
5564 ;; Try to get next/previous article not displayed in this group.
5565 ((and gnus-auto-extend-newsgroup
5566 (not unread) (not subject))
5567 (gnus-summary-goto-article
5568 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5570 ;; Go to next/previous group.
5572 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5573 (gnus-summary-jump-to-group gnus-newsgroup-name))
5574 (let ((cmd last-command-char)
5577 (set-buffer gnus-group-buffer)
5580 (if (eq gnus-keep-same-level 'best)
5581 (gnus-summary-best-group gnus-newsgroup-name)
5582 (gnus-summary-search-group backward gnus-keep-same-level))))
5583 ;; For some reason, the group window gets selected. We change
5585 (select-window (get-buffer-window (current-buffer)))
5586 ;; Select next unread newsgroup automagically.
5588 ((or (not gnus-auto-select-next)
5590 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5591 ((or (eq gnus-auto-select-next 'quietly)
5592 (and (eq gnus-auto-select-next 'slightly-quietly)
5594 (and (eq gnus-auto-select-next 'almost-quietly)
5595 (gnus-summary-last-article-p)))
5597 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5599 (gnus-message 7 "No more%s articles (%s)..."
5600 (if unread " unread" "")
5601 (if group (concat "selecting " group)
5603 (gnus-summary-next-group nil group backward)))
5605 (when (gnus-key-press-event-p last-input-event)
5606 (gnus-summary-walk-group-buffer
5607 gnus-newsgroup-name cmd unread backward point))))))))
5609 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5610 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5611 (?\C-p (gnus-group-prev-unread-group 1))))
5612 (cursor-in-echo-area t)
5613 keve key group ended)
5615 (set-buffer gnus-group-buffer)
5618 (if (eq gnus-keep-same-level 'best)
5619 (gnus-summary-best-group gnus-newsgroup-name)
5620 (gnus-summary-search-group backward gnus-keep-same-level))))
5623 5 "No more%s articles%s" (if unread " unread" "")
5625 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5626 (format " (Type %s for %s [%s])"
5627 (single-key-description cmd) group
5628 (car (gnus-gethash group gnus-newsrc-hashtb)))
5629 (format " (Type %s to exit %s)"
5630 (single-key-description cmd)
5631 gnus-newsgroup-name)))
5632 ;; Confirm auto selection.
5633 (setq key (car (setq keve (gnus-read-event-char))))
5636 ((assq key keystrokes)
5637 (let ((obuf (current-buffer)))
5638 (switch-to-buffer gnus-group-buffer)
5640 (gnus-group-jump-to-group group))
5641 (eval (cadr (assq key keystrokes)))
5642 (setq group (gnus-group-group-name))
5643 (switch-to-buffer obuf))
5647 (gnus-ephemeral-group-p gnus-newsgroup-name))
5649 (gnus-summary-next-group nil group backward)))
5651 (push (cdr keve) unread-command-events))))))
5653 (defun gnus-summary-next-unread-article ()
5654 "Select unread article after current one."
5656 (gnus-summary-next-article
5657 (or (not (eq gnus-summary-goto-unread 'never))
5658 (gnus-summary-last-article-p (gnus-summary-article-number)))
5659 (and gnus-auto-select-same
5660 (gnus-summary-article-subject))))
5662 (defun gnus-summary-prev-article (&optional unread subject)
5663 "Select the article after the current one.
5664 If UNREAD is non-nil, only unread articles are selected."
5666 (gnus-summary-next-article unread subject t))
5668 (defun gnus-summary-prev-unread-article ()
5669 "Select unread article before current one."
5671 (gnus-summary-prev-article
5672 (or (not (eq gnus-summary-goto-unread 'never))
5673 (gnus-summary-first-article-p (gnus-summary-article-number)))
5674 (and gnus-auto-select-same
5675 (gnus-summary-article-subject))))
5677 (defun gnus-summary-next-page (&optional lines circular)
5678 "Show next page of the selected article.
5679 If at the end of the current article, select the next article.
5680 LINES says how many lines should be scrolled up.
5682 If CIRCULAR is non-nil, go to the start of the article instead of
5683 selecting the next article when reaching the end of the current
5686 (setq gnus-summary-buffer (current-buffer))
5687 (gnus-set-global-variables)
5688 (let ((article (gnus-summary-article-number))
5689 (article-window (get-buffer-window gnus-article-buffer t))
5691 (gnus-configure-windows 'article)
5692 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5693 (if (and (eq gnus-summary-goto-unread 'never)
5694 (not (gnus-summary-last-article-p article)))
5695 (gnus-summary-next-article)
5696 (gnus-summary-next-unread-article))
5697 (if (or (null gnus-current-article)
5698 (null gnus-article-current)
5699 (/= article (cdr gnus-article-current))
5700 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5701 ;; Selected subject is different from current article's.
5702 (gnus-summary-display-article article)
5703 (when article-window
5704 (gnus-eval-in-buffer-window gnus-article-buffer
5705 (setq endp (gnus-article-next-page lines)))
5708 (gnus-summary-beginning-of-article))
5710 (gnus-message 3 "End of message"))
5712 (if (and (eq gnus-summary-goto-unread 'never)
5713 (not (gnus-summary-last-article-p article)))
5714 (gnus-summary-next-article)
5715 (gnus-summary-next-unread-article))))))))
5716 (gnus-summary-recenter)
5717 (gnus-summary-position-point)))
5719 (defun gnus-summary-prev-page (&optional lines move)
5720 "Show previous page of selected article.
5721 Argument LINES specifies lines to be scrolled down.
5722 If MOVE, move to the previous unread article if point is at
5723 the beginning of the buffer."
5725 (let ((article (gnus-summary-article-number))
5726 (article-window (get-buffer-window gnus-article-buffer t))
5728 (gnus-configure-windows 'article)
5729 (if (or (null gnus-current-article)
5730 (null gnus-article-current)
5731 (/= article (cdr gnus-article-current))
5732 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5733 ;; Selected subject is different from current article's.
5734 (gnus-summary-display-article article)
5735 (gnus-summary-recenter)
5736 (when article-window
5737 (gnus-eval-in-buffer-window gnus-article-buffer
5738 (setq endp (gnus-article-prev-page lines)))
5739 (when (and move endp)
5741 (gnus-message 3 "Beginning of message"))
5743 (if (and (eq gnus-summary-goto-unread 'never)
5744 (not (gnus-summary-first-article-p article)))
5745 (gnus-summary-prev-article)
5746 (gnus-summary-prev-unread-article))))))))
5747 (gnus-summary-position-point))
5749 (defun gnus-summary-prev-page-or-article (&optional lines)
5750 "Show previous page of selected article.
5751 Argument LINES specifies lines to be scrolled down.
5752 If at the beginning of the article, go to the next article."
5754 (gnus-summary-prev-page lines t))
5756 (defun gnus-summary-scroll-up (lines)
5757 "Scroll up (or down) one line current article.
5758 Argument LINES specifies lines to be scrolled up (or down if negative)."
5760 (gnus-configure-windows 'article)
5761 (gnus-summary-show-thread)
5762 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5763 (gnus-eval-in-buffer-window gnus-article-buffer
5765 (when (gnus-article-next-page lines)
5766 (gnus-message 3 "End of message")))
5768 (gnus-article-prev-page (- lines))))))
5769 (gnus-summary-recenter)
5770 (gnus-summary-position-point))
5772 (defun gnus-summary-next-same-subject ()
5773 "Select next article which has the same subject as current one."
5775 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5777 (defun gnus-summary-prev-same-subject ()
5778 "Select previous article which has the same subject as current one."
5780 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5782 (defun gnus-summary-next-unread-same-subject ()
5783 "Select next unread article which has the same subject as current one."
5785 (gnus-summary-next-article t (gnus-summary-article-subject)))
5787 (defun gnus-summary-prev-unread-same-subject ()
5788 "Select previous unread article which has the same subject as current one."
5790 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5792 (defun gnus-summary-first-unread-article ()
5793 "Select the first unread article.
5794 Return nil if there are no unread articles."
5797 (when (gnus-summary-first-subject t)
5798 (gnus-summary-show-thread)
5799 (gnus-summary-first-subject t)
5800 (gnus-summary-display-article (gnus-summary-article-number)))
5801 (gnus-summary-position-point)))
5803 (defun gnus-summary-first-article ()
5804 "Select the first article.
5805 Return nil if there are no articles."
5808 (when (gnus-summary-first-subject)
5809 (gnus-summary-show-thread)
5810 (gnus-summary-first-subject)
5811 (gnus-summary-display-article (gnus-summary-article-number)))
5812 (gnus-summary-position-point)))
5814 (defun gnus-summary-best-unread-article ()
5815 "Select the unread article with the highest score."
5817 (let ((best -1000000)
5818 (data gnus-newsgroup-data)
5821 (and (gnus-data-unread-p (car data))
5823 (gnus-summary-article-score (gnus-data-number (car data))))
5826 article (gnus-data-number (car data))))
5827 (setq data (cdr data)))
5830 (gnus-summary-goto-article article)
5831 (error "No unread articles"))
5832 (gnus-summary-position-point))))
5834 (defun gnus-summary-last-subject ()
5835 "Go to the last displayed subject line in the group."
5836 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5838 (gnus-summary-goto-subject article))))
5840 (defun gnus-summary-goto-article (article &optional all-headers force)
5841 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5842 If ALL-HEADERS is non-nil, no header lines are hidden."
5846 "Article number or Message-ID: "
5847 (mapcar (lambda (number) (list (int-to-string number)))
5848 gnus-newsgroup-limit))
5852 (if (and (stringp article)
5853 (string-match "@" article))
5854 (gnus-summary-refer-article article)
5855 (when (stringp article)
5856 (setq article (string-to-number article)))
5857 (if (gnus-summary-goto-subject article force)
5858 (gnus-summary-display-article article all-headers)
5859 (gnus-message 4 "Couldn't go to article %s" article) nil))
5860 (gnus-summary-position-point)))
5862 (defun gnus-summary-goto-last-article ()
5863 "Go to the previously read article."
5866 (when gnus-last-article
5867 (gnus-summary-goto-article gnus-last-article))
5868 (gnus-summary-position-point)))
5870 (defun gnus-summary-pop-article (number)
5871 "Pop one article off the history and go to the previous.
5872 NUMBER articles will be popped off."
5875 (setq gnus-newsgroup-history
5876 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5878 (gnus-summary-goto-article (car to) nil t)
5879 (error "Article history empty")))
5880 (gnus-summary-position-point))
5882 ;; Summary commands and functions for limiting the summary buffer.
5884 (defun gnus-summary-limit-to-articles (n)
5885 "Limit the summary buffer to the next N articles.
5886 If not given a prefix, use the process marked articles instead."
5889 (let ((articles (gnus-summary-work-articles n)))
5890 (setq gnus-newsgroup-processable nil)
5891 (gnus-summary-limit articles))
5892 (gnus-summary-position-point)))
5894 (defun gnus-summary-pop-limit (&optional total)
5895 "Restore the previous limit.
5896 If given a prefix, remove all limits."
5899 (setq gnus-newsgroup-limits
5900 (list (mapcar (lambda (h) (mail-header-number h))
5901 gnus-newsgroup-headers))))
5902 (unless gnus-newsgroup-limits
5903 (error "No limit to pop"))
5905 (gnus-summary-limit nil 'pop)
5906 (gnus-summary-position-point)))
5908 (defun gnus-summary-limit-to-subject (subject &optional header)
5909 "Limit the summary buffer to articles that have subjects that match a regexp."
5910 (interactive "sLimit to subject (regexp): ")
5912 (setq header "subject"))
5913 (when (not (equal "" subject))
5915 (let ((articles (gnus-summary-find-matching
5916 (or header "subject") subject 'all)))
5918 (error "Found no matches for \"%s\"" subject))
5919 (gnus-summary-limit articles))
5920 (gnus-summary-position-point))))
5922 (defun gnus-summary-limit-to-author (from)
5923 "Limit the summary buffer to articles that have authors that match a regexp."
5924 (interactive "sLimit to author (regexp): ")
5925 (gnus-summary-limit-to-subject from "from"))
5927 (defun gnus-summary-limit-to-age (age &optional younger-p)
5928 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5929 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5930 articles that are younger than AGE days."
5931 (interactive "nTime in days: \nP")
5933 (let ((data gnus-newsgroup-data)
5934 (cutoff (nnmail-days-to-time age))
5935 articles d date is-younger)
5936 (while (setq d (pop data))
5937 (when (and (vectorp (gnus-data-header d))
5938 (setq date (mail-header-date (gnus-data-header d))))
5939 (setq is-younger (nnmail-time-less
5940 (nnmail-time-since (nnmail-date-to-time date))
5942 (when (if younger-p is-younger (not is-younger))
5943 (push (gnus-data-number d) articles))))
5944 (gnus-summary-limit (nreverse articles)))
5945 (gnus-summary-position-point)))
5947 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5949 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5951 (defun gnus-summary-limit-to-unread (&optional all)
5952 "Limit the summary buffer to articles that are not marked as read.
5953 If ALL is non-nil, limit strictly to unread articles."
5956 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5957 (gnus-summary-limit-to-marks
5958 ;; Concat all the marks that say that an article is read and have
5960 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5961 gnus-killed-mark gnus-kill-file-mark
5962 gnus-low-score-mark gnus-expirable-mark
5963 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5964 gnus-duplicate-mark gnus-souped-mark)
5967 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5968 (make-obsolete 'gnus-summary-delete-marked-with
5969 'gnus-summary-limit-exlude-marks)
5971 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5972 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5973 If REVERSE, limit the summary buffer to articles that are marked
5974 with MARKS. MARKS can either be a string of marks or a list of marks.
5975 Returns how many articles were removed."
5976 (interactive "sMarks: ")
5977 (gnus-summary-limit-to-marks marks t))
5979 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5980 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5981 If REVERSE (the prefix), limit the summary buffer to articles that are
5982 not marked with MARKS. MARKS can either be a string of marks or a
5984 Returns how many articles were removed."
5985 (interactive "sMarks: \nP")
5987 (let ((data gnus-newsgroup-data)
5988 (marks (if (listp marks) marks
5989 (append marks nil))) ; Transform to list.
5992 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5993 (memq (gnus-data-mark (car data)) marks))
5994 (push (gnus-data-number (car data)) articles))
5995 (setq data (cdr data)))
5996 (gnus-summary-limit articles))
5997 (gnus-summary-position-point)))
5999 (defun gnus-summary-limit-to-score (&optional score)
6000 "Limit to articles with score at or above SCORE."
6002 (setq score (if score
6003 (prefix-numeric-value score)
6004 (or gnus-summary-default-score 0)))
6005 (let ((data gnus-newsgroup-data)
6008 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6010 (push (gnus-data-number (car data)) articles))
6011 (setq data (cdr data)))
6013 (gnus-summary-limit articles)
6014 (gnus-summary-position-point))))
6016 (defun gnus-summary-limit-include-thread (id)
6017 "Display all the hidden articles that in the current thread."
6018 (interactive (list (mail-header-id (gnus-summary-article-header))))
6019 (let ((articles (gnus-articles-in-thread
6020 (gnus-id-to-thread (gnus-root-id id)))))
6022 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6023 (gnus-summary-position-point))))
6025 (defun gnus-summary-limit-include-dormant ()
6026 "Display all the hidden articles that are marked as dormant.
6027 Note that this command only works on a subset of the articles currently
6028 fetched for this group."
6030 (unless gnus-newsgroup-dormant
6031 (error "There are no dormant articles in this group"))
6033 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6034 (gnus-summary-position-point)))
6036 (defun gnus-summary-limit-exclude-dormant ()
6037 "Hide all dormant articles."
6040 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6041 (gnus-summary-position-point)))
6043 (defun gnus-summary-limit-exclude-childless-dormant ()
6044 "Hide all dormant articles that have no children."
6046 (let ((data (gnus-data-list t))
6047 articles d children)
6048 ;; Find all articles that are either not dormant or have
6050 (while (setq d (pop data))
6051 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6053 (gnus-article-children (gnus-data-number d)))
6056 (when (memq (car children) articles)
6061 (push (gnus-data-number d) articles)))
6064 (gnus-summary-limit articles)
6065 (gnus-summary-position-point))))
6067 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6068 "Mark all unread excluded articles as read.
6069 If ALL, mark even excluded ticked and dormants as read."
6071 (let ((articles (gnus-sorted-complement
6073 (mapcar (lambda (h) (mail-header-number h))
6074 gnus-newsgroup-headers)
6076 (sort gnus-newsgroup-limit '<)))
6078 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
6080 (setq gnus-newsgroup-dormant nil
6081 gnus-newsgroup-marked nil
6082 gnus-newsgroup-reads
6084 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6085 gnus-newsgroup-reads))
6086 (while (setq article (pop articles))
6087 (unless (or (memq article gnus-newsgroup-dormant)
6088 (memq article gnus-newsgroup-marked))
6089 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6091 (defun gnus-summary-limit (articles &optional pop)
6093 ;; We pop the previous limit off the stack and use that.
6094 (setq articles (car gnus-newsgroup-limits)
6095 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6096 ;; We use the new limit, so we push the old limit on the stack.
6097 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6099 (setq gnus-newsgroup-limit articles)
6100 (let ((total (length gnus-newsgroup-data))
6101 (data (gnus-data-find-list (gnus-summary-article-number)))
6102 (gnus-summary-mark-below nil) ; Inhibit this.
6104 ;; This will do all the work of generating the new summary buffer
6105 ;; according to the new limit.
6106 (gnus-summary-prepare)
6107 ;; Hide any threads, possibly.
6108 (and gnus-show-threads
6109 gnus-thread-hide-subtree
6110 (gnus-summary-hide-all-threads))
6111 ;; Try to return to the article you were at, or one in the
6114 ;; We try to find some article after the current one.
6116 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6119 (setq data (cdr data))))
6121 ;; If there is no data, that means that we were after the last
6122 ;; article. The same goes when we can't find any articles
6123 ;; after the current one.
6124 (goto-char (point-max))
6125 (gnus-summary-find-prev))
6126 ;; We return how many articles were removed from the summary
6127 ;; buffer as a result of the new limit.
6128 (- total (length gnus-newsgroup-data))))
6130 (defsubst gnus-invisible-cut-children (threads)
6133 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6138 (defsubst gnus-cut-thread (thread)
6139 "Go forwards in the thread until we find an article that we want to display."
6140 (when (or (eq gnus-fetch-old-headers 'some)
6141 (eq gnus-fetch-old-headers 'invisible)
6142 (eq gnus-build-sparse-threads 'some)
6143 (eq gnus-build-sparse-threads 'more))
6144 ;; Deal with old-fetched headers and sparse threads.
6148 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6149 (gnus-summary-article-ancient-p
6150 (mail-header-number (car thread))))
6151 (if (or (<= (length (cdr thread)) 1)
6152 (eq gnus-fetch-old-headers 'invisible))
6153 (setq gnus-newsgroup-limit
6154 (delq (mail-header-number (car thread))
6155 gnus-newsgroup-limit)
6156 thread (cadr thread))
6157 (when (gnus-invisible-cut-children (cdr thread))
6158 (let ((th (cdr thread)))
6160 (if (memq (mail-header-number (caar th))
6161 gnus-newsgroup-limit)
6162 (setq thread (car th)
6164 (setq th (cdr th))))))))))
6167 (defun gnus-cut-threads (threads)
6168 "Cut off all uninteresting articles from the beginning of threads."
6169 (when (or (eq gnus-fetch-old-headers 'some)
6170 (eq gnus-fetch-old-headers 'invisible)
6171 (eq gnus-build-sparse-threads 'some)
6172 (eq gnus-build-sparse-threads 'more))
6175 (setcar th (gnus-cut-thread (car th)))
6176 (setq th (cdr th)))))
6177 ;; Remove nixed out threads.
6180 (defun gnus-summary-initial-limit (&optional show-if-empty)
6181 "Figure out what the initial limit is supposed to be on group entry.
6182 This entails weeding out unwanted dormants, low-scored articles,
6183 fetch-old-headers verbiage, and so on."
6184 ;; Most groups have nothing to remove.
6185 (if (or gnus-inhibit-limiting
6186 (and (null gnus-newsgroup-dormant)
6187 (not (eq gnus-fetch-old-headers 'some))
6188 (not (eq gnus-fetch-old-headers 'invisible))
6189 (null gnus-summary-expunge-below)
6190 (not (eq gnus-build-sparse-threads 'some))
6191 (not (eq gnus-build-sparse-threads 'more))
6192 (null gnus-thread-expunge-below)
6193 (not gnus-use-nocem)))
6195 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6196 (setq gnus-newsgroup-limit nil)
6199 (unless (car (symbol-value node))
6200 ;; These threads have no parents -- they are roots.
6201 (let ((nodes (cdr (symbol-value node)))
6204 (if (and gnus-thread-expunge-below
6205 (< (gnus-thread-total-score (car nodes))
6206 gnus-thread-expunge-below))
6207 (gnus-expunge-thread (pop nodes))
6208 (setq thread (pop nodes))
6209 (gnus-summary-limit-children thread))))))
6210 gnus-newsgroup-dependencies)
6211 ;; If this limitation resulted in an empty group, we might
6212 ;; pop the previous limit and use it instead.
6213 (when (and (not gnus-newsgroup-limit)
6215 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6216 gnus-newsgroup-limit))
6218 (defun gnus-summary-limit-children (thread)
6219 "Return 1 if this subthread is visible and 0 if it is not."
6220 ;; First we get the number of visible children to this thread. This
6221 ;; is done by recursing down the thread using this function, so this
6222 ;; will really go down to a leaf article first, before slowly
6223 ;; working its way up towards the root.
6227 (apply '+ (mapcar 'gnus-summary-limit-children
6230 (number (mail-header-number (car thread)))
6233 (not (memq number gnus-newsgroup-marked))
6235 ;; If this article is dormant and has absolutely no visible
6236 ;; children, then this article isn't visible.
6237 (and (memq number gnus-newsgroup-dormant)
6239 ;; If this is "fetch-old-headered" and there is no
6240 ;; visible children, then we don't want this article.
6241 (and (eq gnus-fetch-old-headers 'some)
6242 (gnus-summary-article-ancient-p number)
6244 ;; If this is "fetch-old-headered" and `invisible', then
6245 ;; we don't want this article.
6246 (and (eq gnus-fetch-old-headers 'invisible)
6247 (gnus-summary-article-ancient-p number))
6248 ;; If this is a sparsely inserted article with no children,
6249 ;; we don't want it.
6250 (and (eq gnus-build-sparse-threads 'some)
6251 (gnus-summary-article-sparse-p number)
6253 ;; If we use expunging, and this article is really
6254 ;; low-scored, then we don't want this article.
6255 (when (and gnus-summary-expunge-below
6257 (or (cdr (assq number gnus-newsgroup-scored))
6258 gnus-summary-default-score))
6259 gnus-summary-expunge-below))
6260 ;; We increase the expunge-tally here, but that has
6261 ;; nothing to do with the limits, really.
6262 (incf gnus-newsgroup-expunged-tally)
6263 ;; We also mark as read here, if that's wanted.
6264 (when (and gnus-summary-mark-below
6265 (< score gnus-summary-mark-below))
6266 (setq gnus-newsgroup-unreads
6267 (delq number gnus-newsgroup-unreads))
6268 (if gnus-newsgroup-auto-expire
6269 (push number gnus-newsgroup-expirable)
6270 (push (cons number gnus-low-score-mark)
6271 gnus-newsgroup-reads)))
6273 ;; Check NoCeM things.
6274 (if (and gnus-use-nocem
6275 (gnus-nocem-unwanted-article-p
6276 (mail-header-id (car thread))))
6278 (setq gnus-newsgroup-unreads
6279 (delq number gnus-newsgroup-unreads))
6281 ;; Nope, invisible article.
6283 ;; Ok, this article is to be visible, so we add it to the limit
6285 (push number gnus-newsgroup-limit)
6288 (defun gnus-expunge-thread (thread)
6289 "Mark all articles in THREAD as read."
6290 (let* ((number (mail-header-number (car thread))))
6291 (incf gnus-newsgroup-expunged-tally)
6292 ;; We also mark as read here, if that's wanted.
6293 (setq gnus-newsgroup-unreads
6294 (delq number gnus-newsgroup-unreads))
6295 (if gnus-newsgroup-auto-expire
6296 (push number gnus-newsgroup-expirable)
6297 (push (cons number gnus-low-score-mark)
6298 gnus-newsgroup-reads)))
6299 ;; Go recursively through all subthreads.
6300 (mapcar 'gnus-expunge-thread (cdr thread)))
6302 ;; Summary article oriented commands
6304 (defun gnus-summary-refer-parent-article (n)
6305 "Refer parent article N times.
6306 If N is negative, go to ancestor -N instead.
6307 The difference between N and the number of articles fetched is returned."
6311 (when (not (natnump n))
6316 (setq header (gnus-summary-article-header))
6317 (if (and (eq (mail-header-number header)
6318 (cdr gnus-article-current))
6319 (equal gnus-newsgroup-name
6320 (car gnus-article-current)))
6321 ;; If we try to find the parent of the currently
6322 ;; displayed article, then we take a look at the actual
6323 ;; References header, since this is slightly more
6324 ;; reliable than the References field we got from the
6327 (set-buffer gnus-original-article-buffer)
6328 (nnheader-narrow-to-headers)
6329 (unless (setq ref (message-fetch-field "references"))
6330 (setq ref (message-fetch-field "in-reply-to")))
6333 ;; It's not the current article, so we take a bet on
6334 ;; the value we got from the server.
6335 (mail-header-references header)))
6337 (not (equal ref "")))
6338 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6339 (gnus-message 1 "Couldn't find parent"))
6340 (gnus-message 1 "No references in article %d"
6341 (gnus-summary-article-number))
6344 (gnus-summary-position-point)
6347 (defun gnus-summary-refer-references ()
6348 "Fetch all articles mentioned in the References header.
6349 Return the number of articles fetched."
6351 (let ((ref (mail-header-references (gnus-summary-article-header)))
6352 (current (gnus-summary-article-number))
6356 (error "No References in the current article")
6357 ;; For each Message-ID in the References header...
6358 (while (string-match "<[^>]*>" ref)
6360 ;; ... fetch that article.
6361 (gnus-summary-refer-article
6362 (prog1 (match-string 0 ref)
6363 (setq ref (substring ref (match-end 0))))))
6364 (gnus-summary-goto-subject current)
6365 (gnus-summary-position-point)
6368 (defun gnus-summary-refer-thread (&optional limit)
6369 "Fetch all articles in the current thread.
6370 If LIMIT (the numerical prefix), fetch that many old headers instead
6371 of what's specified by the `gnus-refer-thread-limit' variable."
6373 (let ((id (mail-header-id (gnus-summary-article-header)))
6374 (limit (if limit (prefix-numeric-value limit)
6375 gnus-refer-thread-limit))
6377 ;; We want to fetch LIMIT *old* headers, but we also have to
6378 ;; re-fetch all the headers in the current buffer, because many of
6379 ;; them may be undisplayed. So we adjust LIMIT.
6380 (when (numberp limit)
6381 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6382 (unless (eq gnus-fetch-old-headers 'invisible)
6383 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6384 ;; Retrieve the headers and read them in.
6385 (if (eq (gnus-retrieve-headers
6386 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6388 (gnus-build-all-threads)
6389 (error "Can't fetch thread from backends that don't support NOV"))
6390 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6391 (gnus-summary-limit-include-thread id)))
6393 (defun gnus-summary-refer-article (message-id &optional arg)
6394 "Fetch an article specified by MESSAGE-ID.
6395 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6396 or `gnus-select-method', no matter what backend the article comes from."
6397 (interactive "sMessage-ID: \nP")
6398 (when (and (stringp message-id)
6399 (not (zerop (length message-id))))
6400 ;; Construct the correct Message-ID if necessary.
6401 ;; Suggested by tale@pawl.rpi.edu.
6402 (unless (string-match "^<" message-id)
6403 (setq message-id (concat "<" message-id)))
6404 (unless (string-match ">$" message-id)
6405 (setq message-id (concat message-id ">")))
6406 (let* ((header (gnus-id-to-header message-id))
6408 (gnus-summary-article-sparse-p
6409 (mail-header-number header))
6410 (memq (mail-header-number header)
6411 gnus-newsgroup-limit)))
6414 ;; If the article is present in the buffer we just go to it.
6416 (or (not (gnus-summary-article-sparse-p
6417 (mail-header-number header)))
6420 (gnus-summary-goto-article
6421 (mail-header-number header) nil t)
6423 (gnus-summary-update-article (mail-header-number header)))))
6425 ;; We fetch the article
6426 (let ((gnus-override-method
6427 (cond ((gnus-news-group-p gnus-newsgroup-name)
6428 gnus-refer-article-method)
6430 (or gnus-refer-article-method gnus-select-method))
6433 ;; Start the special refer-article method, if necessary.
6434 (when (and gnus-refer-article-method
6435 (gnus-news-group-p gnus-newsgroup-name))
6436 (gnus-check-server gnus-refer-article-method))
6437 ;; Fetch the header, and display the article.
6438 (if (setq number (gnus-summary-insert-subject message-id))
6439 (gnus-summary-select-article nil nil nil number)
6440 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6442 (defun gnus-summary-enter-digest-group (&optional force)
6443 "Enter an nndoc group based on the current article.
6444 If FORCE, force a digest interpretation. If not, try
6445 to guess what the document format is."
6447 (let ((conf gnus-current-window-configuration))
6449 (gnus-summary-select-article))
6450 (setq gnus-current-window-configuration conf)
6451 (let* ((name (format "%s-%d"
6452 (gnus-group-prefixed-name
6453 gnus-newsgroup-name (list 'nndoc ""))
6455 (set-buffer gnus-summary-buffer)
6456 gnus-current-article)))
6457 (ogroup gnus-newsgroup-name)
6458 (params (append (gnus-info-params (gnus-get-info ogroup))
6459 (list (cons 'to-group ogroup))
6460 (list (cons 'save-article-group ogroup))))
6461 (case-fold-search t)
6462 (buf (current-buffer))
6465 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6466 (insert-buffer-substring gnus-original-article-buffer)
6467 ;; Remove lines that may lead nndoc to misinterpret the
6470 (goto-char (point-min))
6471 (or (search-forward "\n\n" nil t) (point)))
6472 (goto-char (point-min))
6473 (delete-matching-lines "^\\(Path\\):\\|^From ")
6476 (if (gnus-group-read-ephemeral-group
6477 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6479 ,(if force 'digest 'guess))) t)
6480 ;; Make all postings to this group go to the parent group.
6481 (nconc (gnus-info-params (gnus-get-info name))
6483 ;; Couldn't select this doc group.
6484 (switch-to-buffer buf)
6485 (gnus-set-global-variables)
6486 (gnus-configure-windows 'summary)
6487 (gnus-message 3 "Article couldn't be entered?"))
6488 (kill-buffer dig)))))
6490 (defun gnus-summary-read-document (n)
6491 "Open a new group based on the current article(s).
6492 This will allow you to read digests and other similar
6493 documents as newsgroups.
6494 Obeys the standard process/prefix convention."
6496 (let* ((articles (gnus-summary-work-articles n))
6497 (ogroup gnus-newsgroup-name)
6498 (params (append (gnus-info-params (gnus-get-info ogroup))
6499 (list (cons 'to-group ogroup))))
6500 article group egroup groups vgroup)
6501 (while (setq article (pop articles))
6502 (setq group (format "%s-%d" gnus-newsgroup-name article))
6503 (gnus-summary-remove-process-mark article)
6504 (when (gnus-summary-display-article article)
6506 (nnheader-temp-write nil
6507 (insert-buffer-substring gnus-original-article-buffer)
6508 ;; Remove some headers that may lead nndoc to make
6510 (message-narrow-to-head)
6511 (goto-char (point-min))
6512 (delete-matching-lines "^\\(Path\\):\\|^From ")
6515 (gnus-group-read-ephemeral-group
6516 group `(nndoc ,group (nndoc-address ,(current-buffer))
6517 (nndoc-article-type guess))
6520 ;; Make all postings to this group go to the parent group.
6521 (nconc (gnus-info-params (gnus-get-info egroup))
6523 (push egroup groups))
6524 ;; Couldn't select this doc group.
6525 (gnus-error 3 "Article couldn't be entered"))))))
6526 ;; Now we have selected all the documents.
6529 (error "None of the articles could be interpreted as documents"))
6530 ((gnus-group-read-ephemeral-group
6531 (setq vgroup (format
6532 "nnvirtual:%s-%s" gnus-newsgroup-name
6533 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6534 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6536 (cons (current-buffer) 'summary)))
6538 (error "Couldn't select virtual nndoc group")))))
6540 (defun gnus-summary-isearch-article (&optional regexp-p)
6541 "Do incremental search forward on the current article.
6542 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6544 (gnus-summary-select-article)
6545 (gnus-configure-windows 'article)
6546 (gnus-eval-in-buffer-window gnus-article-buffer
6549 (isearch-forward regexp-p))))
6551 (defun gnus-summary-search-article-forward (regexp &optional backward)
6552 "Search for an article containing REGEXP forward.
6553 If BACKWARD, search backward instead."
6556 (format "Search article %s (regexp%s): "
6557 (if current-prefix-arg "backward" "forward")
6558 (if gnus-last-search-regexp
6559 (concat ", default " gnus-last-search-regexp)
6561 current-prefix-arg))
6562 (if (string-equal regexp "")
6563 (setq regexp (or gnus-last-search-regexp ""))
6564 (setq gnus-last-search-regexp regexp))
6565 (if (gnus-summary-search-article regexp backward)
6566 (gnus-summary-show-thread)
6567 (error "Search failed: \"%s\"" regexp)))
6569 (defun gnus-summary-search-article-backward (regexp)
6570 "Search for an article containing REGEXP backward."
6573 (format "Search article backward (regexp%s): "
6574 (if gnus-last-search-regexp
6575 (concat ", default " gnus-last-search-regexp)
6577 (gnus-summary-search-article-forward regexp 'backward))
6579 (defun gnus-summary-search-article (regexp &optional backward)
6580 "Search for an article containing REGEXP.
6581 Optional argument BACKWARD means do search for backward.
6582 `gnus-select-article-hook' is not called during the search."
6583 ;; We have to require this here to make sure that the following
6584 ;; dynamic binding isn't shadowed by autoloading.
6585 (require 'gnus-async)
6586 (let ((gnus-select-article-hook nil) ;Disable hook.
6587 (gnus-article-display-hook nil)
6588 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6589 (gnus-use-article-prefetch nil)
6590 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6591 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6592 (sum (current-buffer))
6595 (gnus-save-hidden-threads
6596 (gnus-summary-select-article)
6597 (set-buffer gnus-article-buffer)
6601 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6603 (re-search-backward regexp nil t)
6604 (re-search-forward regexp nil t))
6605 ;; We found the regexp.
6610 (get-buffer-window (current-buffer))
6614 (setq point (point)))
6615 ;; We didn't find it, so we go to the next article.
6618 (while (eq found 'not)
6619 (if (not (if backward (gnus-summary-find-prev)
6620 (gnus-summary-find-next)))
6621 ;; No more articles.
6623 ;; Select the next article and adjust point.
6624 (unless (gnus-summary-article-sparse-p
6625 (gnus-summary-article-number))
6627 (gnus-summary-select-article)
6628 (set-buffer gnus-article-buffer)
6630 (goto-char (if backward (point-max) (point-min))))))))
6631 (gnus-message 7 ""))
6632 ;; Return whether we found the regexp.
6633 (when (eq found 'found)
6635 (gnus-summary-show-thread)
6636 (gnus-summary-goto-subject gnus-current-article)
6637 (gnus-summary-position-point)
6640 (defun gnus-summary-find-matching (header regexp &optional backward unread
6642 "Return a list of all articles that match REGEXP on HEADER.
6643 The search stars on the current article and goes forwards unless
6644 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6645 If UNREAD is non-nil, only unread articles will
6646 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6647 in the comparisons."
6648 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6649 (gnus-data-find-list
6650 (gnus-summary-article-number) (gnus-data-list backward))))
6651 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6652 (case-fold-search (not not-case-fold))
6654 (unless (fboundp (intern (concat "mail-header-" header)))
6655 (error "%s is not a valid header" header))
6658 (and (or (not unread) ; We want all articles...
6659 (gnus-data-unread-p d)) ; Or just unreads.
6660 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6661 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6662 (push (gnus-data-number d) articles)) ; Success!
6663 (setq data (cdr data)))
6664 (nreverse articles)))
6666 (defun gnus-summary-execute-command (header regexp command &optional backward)
6667 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6668 If HEADER is an empty string (or nil), the match is done on the entire
6669 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6671 (list (let ((completion-ignore-case t))
6674 (mapcar (lambda (string) (list string))
6675 '("Number" "Subject" "From" "Lines" "Date"
6676 "Message-ID" "Xref" "References" "Body"))
6677 nil 'require-match))
6678 (read-string "Regexp: ")
6679 (read-key-sequence "Command: ")
6680 current-prefix-arg))
6681 (when (equal header "Body")
6683 ;; Hidden thread subtrees must be searched as well.
6684 (gnus-summary-show-all-threads)
6685 ;; We don't want to change current point nor window configuration.
6687 (save-window-excursion
6688 (gnus-message 6 "Executing %s..." (key-description command))
6689 ;; We'd like to execute COMMAND interactively so as to give arguments.
6690 (gnus-execute header regexp
6691 `(call-interactively ',(key-binding command))
6693 (gnus-message 6 "Executing %s...done" (key-description command)))))
6695 (defun gnus-summary-beginning-of-article ()
6696 "Scroll the article back to the beginning."
6698 (gnus-summary-select-article)
6699 (gnus-configure-windows 'article)
6700 (gnus-eval-in-buffer-window gnus-article-buffer
6702 (goto-char (point-min))
6703 (when gnus-page-broken
6704 (gnus-narrow-to-page))))
6706 (defun gnus-summary-end-of-article ()
6707 "Scroll to the end of the article."
6709 (gnus-summary-select-article)
6710 (gnus-configure-windows 'article)
6711 (gnus-eval-in-buffer-window gnus-article-buffer
6713 (goto-char (point-max))
6715 (when gnus-page-broken
6716 (gnus-narrow-to-page))))
6718 (defun gnus-summary-print-article (&optional filename n)
6719 "Generate and print a PostScript image of the N next (mail) articles.
6721 If N is negative, print the N previous articles. If N is nil and articles
6722 have been marked with the process mark, print these instead.
6724 If the optional second argument FILENAME is nil, send the image to the
6725 printer. If FILENAME is a string, save the PostScript image in a file with
6726 that name. If FILENAME is a number, prompt the user for the name of the file
6728 (interactive (list (ps-print-preprint current-prefix-arg)
6729 current-prefix-arg))
6730 (dolist (nbr (gnus-summary-work-articles n))
6731 (gnus-summary-select-article 'all nil 'pseudo nbr)
6732 (gnus-eval-in-buffer-window gnus-article-buffer
6733 (let ((buffer (generate-new-buffer " *print*")))
6736 (copy-to-buffer buffer (point-min) (point-max))
6738 (gnus-article-delete-invisible-text)
6739 (let ((ps-left-header
6742 (mail-header-subject gnus-current-headers) ")")
6744 (mail-header-from gnus-current-headers) ")")))
6747 "/pagenumberstring load"
6749 (mail-header-date gnus-current-headers) ")"))))
6750 (run-hooks 'gnus-ps-print-hook)
6751 (ps-print-buffer-with-faces filename)))
6752 (kill-buffer buffer))))))
6754 (defun gnus-summary-show-article (&optional arg)
6755 "Force re-fetching of the current article.
6756 If ARG (the prefix) is non-nil, show the raw article without any
6757 article massaging functions being run."
6760 ;; Select the article the normal way.
6761 (gnus-summary-select-article nil 'force)
6762 ;; Bind the article treatment functions to nil.
6763 (let ((gnus-have-all-headers t)
6764 gnus-article-display-hook
6765 gnus-article-prepare-hook
6769 (gnus-summary-select-article nil 'force)))
6770 (gnus-summary-goto-subject gnus-current-article)
6771 (gnus-summary-position-point))
6773 (defun gnus-summary-verbose-headers (&optional arg)
6774 "Toggle permanent full header display.
6775 If ARG is a positive number, turn header display on.
6776 If ARG is a negative number, turn header display off."
6778 (setq gnus-show-all-headers
6779 (cond ((or (not (numberp arg))
6781 (not gnus-show-all-headers))
6784 (gnus-summary-show-article))
6786 (defun gnus-summary-toggle-header (&optional arg)
6787 "Show the headers if they are hidden, or hide them if they are shown.
6788 If ARG is a positive number, show the entire header.
6789 If ARG is a negative number, hide the unwanted header lines."
6792 (set-buffer gnus-article-buffer)
6793 (let* ((buffer-read-only nil)
6794 (inhibit-point-motion-hooks t)
6795 (hidden (text-property-any
6796 (goto-char (point-min)) (search-forward "\n\n")
6799 (goto-char (point-min))
6800 (when (search-forward "\n\n" nil t)
6801 (delete-region (point-min) (1- (point))))
6802 (goto-char (point-min))
6804 (set-buffer gnus-original-article-buffer)
6805 (goto-char (point-min))
6806 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6807 (insert-buffer-substring gnus-original-article-buffer 1 e)
6808 (let ((article-inhibit-hiding t))
6809 (run-hooks 'gnus-article-display-hook))
6810 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6811 (gnus-article-hide-headers)))))
6813 (defun gnus-summary-show-all-headers ()
6814 "Make all header lines visible."
6816 (gnus-article-show-all-headers))
6818 (defun gnus-summary-toggle-mime (&optional arg)
6819 "Toggle MIME processing.
6820 If ARG is a positive number, turn MIME processing on."
6822 (setq gnus-show-mime
6823 (if (null arg) (not gnus-show-mime)
6824 (> (prefix-numeric-value arg) 0)))
6825 (gnus-summary-select-article t 'force))
6827 (defun gnus-summary-caesar-message (&optional arg)
6828 "Caesar rotate the current article by 13.
6829 The numerical prefix specifies how many places to rotate each letter
6832 (gnus-summary-select-article)
6833 (let ((mail-header-separator ""))
6834 (gnus-eval-in-buffer-window gnus-article-buffer
6837 (let ((start (window-start))
6839 (message-caesar-buffer-body arg)
6840 (set-window-start (get-buffer-window (current-buffer)) start))))))
6842 (defun gnus-summary-stop-page-breaking ()
6843 "Stop page breaking in the current article."
6845 (gnus-summary-select-article)
6846 (gnus-eval-in-buffer-window gnus-article-buffer
6848 (when (gnus-visual-p 'page-marker)
6849 (let ((buffer-read-only nil))
6850 (gnus-remove-text-with-property 'gnus-prev)
6851 (gnus-remove-text-with-property 'gnus-next)))))
6853 (defun gnus-summary-move-article (&optional n to-newsgroup
6854 select-method action)
6855 "Move the current article to a different newsgroup.
6856 If N is a positive number, move the N next articles.
6857 If N is a negative number, move the N previous articles.
6858 If N is nil and any articles have been marked with the process mark,
6859 move those articles instead.
6860 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6861 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6862 re-spool using this method.
6864 For this function to work, both the current newsgroup and the
6865 newsgroup that you want to move to have to support the `request-move'
6866 and `request-accept' functions."
6869 (setq action 'move))
6870 ;; Disable marking as read.
6871 (let (gnus-mark-article-hook)
6872 (save-window-excursion
6873 (gnus-summary-select-article)))
6874 ;; Check whether the source group supports the required functions.
6875 (cond ((and (eq action 'move)
6876 (not (gnus-check-backend-function
6877 'request-move-article gnus-newsgroup-name)))
6878 (error "The current group does not support article moving"))
6879 ((and (eq action 'crosspost)
6880 (not (gnus-check-backend-function
6881 'request-replace-article gnus-newsgroup-name)))
6882 (error "The current group does not support article editing")))
6883 (let ((articles (gnus-summary-work-articles n))
6884 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6885 (names '((move "Move" "Moving")
6886 (copy "Copy" "Copying")
6887 (crosspost "Crosspost" "Crossposting")))
6888 (copy-buf (save-excursion
6889 (nnheader-set-temp-buffer " *copy article*")))
6890 art-group to-method new-xref article to-groups)
6891 (unless (assq action names)
6892 (error "Unknown action %s" action))
6893 ;; Read the newsgroup name.
6894 (when (and (not to-newsgroup)
6895 (not select-method))
6897 (gnus-read-move-group-name
6898 (cadr (assq action names))
6899 (symbol-value (intern (format "gnus-current-%s-group" action)))
6901 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6902 (setq to-method (or select-method
6903 (gnus-group-name-to-method to-newsgroup)))
6904 ;; Check the method we are to move this article to...
6905 (unless (gnus-check-backend-function
6906 'request-accept-article (car to-method))
6907 (error "%s does not support article copying" (car to-method)))
6908 (unless (gnus-check-server to-method)
6909 (error "Can't open server %s" (car to-method)))
6910 (gnus-message 6 "%s to %s: %s..."
6911 (caddr (assq action names))
6912 (or (car select-method) to-newsgroup) articles)
6914 (setq article (pop articles))
6918 ;; Move the article.
6920 ;; Remove this article from future suppression.
6921 (gnus-dup-unsuppress-article article)
6922 (gnus-request-move-article
6923 article ; Article to move
6924 gnus-newsgroup-name ; From newsgroup
6925 (nth 1 (gnus-find-method-for-group
6926 gnus-newsgroup-name)) ; Server
6927 (list 'gnus-request-accept-article
6928 to-newsgroup (list 'quote select-method)
6929 (not articles)) ; Accept form
6930 (not articles))) ; Only save nov last time
6931 ;; Copy the article.
6934 (set-buffer copy-buf)
6935 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
6936 (gnus-request-accept-article
6937 to-newsgroup select-method (not articles)))))
6938 ;; Crosspost the article.
6939 ((eq action 'crosspost)
6940 (let ((xref (message-tokenize-header
6941 (mail-header-xref (gnus-summary-article-header article))
6943 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6946 (setq xref (list (system-name))))
6949 (mapconcat 'identity
6950 (delete "Xref:" (delete new-xref xref))
6954 (set-buffer copy-buf)
6955 ;; First put the article in the destination group.
6956 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6957 (when (consp (setq art-group
6958 (gnus-request-accept-article
6959 to-newsgroup select-method (not articles))))
6960 (setq new-xref (concat new-xref " " (car art-group)
6961 ":" (cdr art-group)))
6962 ;; Now we have the new Xrefs header, so we insert
6963 ;; it and replace the new article.
6964 (nnheader-replace-header "Xref" new-xref)
6965 (gnus-request-replace-article
6966 (cdr art-group) to-newsgroup (current-buffer))
6970 (gnus-message 1 "Couldn't %s article %s"
6971 (cadr (assq action names)) article))
6972 ((and (eq art-group 'junk)
6974 (gnus-summary-mark-article article gnus-canceled-mark)
6975 (gnus-message 4 "Deleted article %s" article))
6979 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6981 (gnus-group-prefixed-name
6984 (gnus-find-method-for-group to-newsgroup)))
6985 gnus-newsrc-hashtb)))
6986 (info (nth 2 entry))
6987 (to-group (gnus-info-group info)))
6988 ;; Update the group that has been moved to.
6990 (memq action '(move copy)))
6991 (unless (member to-group to-groups)
6992 (push to-group to-groups))
6994 (unless (memq article gnus-newsgroup-unreads)
6996 info (gnus-add-to-range (gnus-info-read info)
6997 (list (cdr art-group)))))
6999 ;; Copy any marks over to the new group.
7000 (let ((marks gnus-article-mark-lists)
7001 (to-article (cdr art-group)))
7003 ;; See whether the article is to be put in the cache.
7004 (when gnus-use-cache
7005 (gnus-cache-possibly-enter-article
7007 (let ((header (copy-sequence
7008 (gnus-summary-article-header article))))
7009 (mail-header-set-number header to-article)
7011 (memq article gnus-newsgroup-marked)
7012 (memq article gnus-newsgroup-dormant)
7013 (memq article gnus-newsgroup-unreads)))
7015 (when (and (equal to-group gnus-newsgroup-name)
7016 (not (memq article gnus-newsgroup-unreads)))
7017 ;; Mark this article as read in this group.
7018 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7019 (setcdr (gnus-active to-group) to-article)
7020 (setcdr gnus-newsgroup-active to-article))
7023 (when (memq article (symbol-value
7024 (intern (format "gnus-newsgroup-%s"
7026 ;; If the other group is the same as this group,
7027 ;; then we have to add the mark to the list.
7028 (when (equal to-group gnus-newsgroup-name)
7029 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7032 (intern (format "gnus-newsgroup-%s"
7034 ;; Copy the marks to other group.
7035 (gnus-add-marked-articles
7036 to-group (cdar marks) (list to-article) info))
7037 (setq marks (cdr marks)))
7040 (concat "(gnus-group-set-info '"
7041 (gnus-prin1-to-string (gnus-get-info to-group))
7044 ;; Update the Xref header in this article to point to
7045 ;; the new crossposted article we have just created.
7046 (when (eq action 'crosspost)
7048 (set-buffer copy-buf)
7049 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7050 (nnheader-replace-header "Xref" new-xref)
7051 (gnus-request-replace-article
7052 article gnus-newsgroup-name (current-buffer)))))
7054 (gnus-summary-goto-subject article)
7055 (when (eq action 'move)
7056 (gnus-summary-mark-article article gnus-canceled-mark))))
7057 (gnus-summary-remove-process-mark article))
7058 ;; Re-activate all groups that have been moved to.
7061 (set-buffer gnus-group-buffer)
7062 (when (gnus-group-goto-group (car to-groups) t)
7063 (gnus-group-get-new-news-this-group 1 t))
7066 (gnus-kill-buffer copy-buf)
7067 (gnus-summary-position-point)
7068 (gnus-set-mode-line 'summary)))
7070 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7071 "Move the current article to a different newsgroup.
7072 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7073 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7074 re-spool using this method."
7076 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7078 (defun gnus-summary-crosspost-article (&optional n)
7079 "Crosspost the current article to some other group."
7081 (gnus-summary-move-article n nil nil 'crosspost))
7083 (defcustom gnus-summary-respool-default-method nil
7084 "Default method for respooling an article.
7085 If nil, use to the current newsgroup method."
7086 :type `(choice (gnus-select-method :value (nnml ""))
7088 :group 'gnus-summary-mail)
7090 (defun gnus-summary-respool-article (&optional n method)
7091 "Respool the current article.
7092 The article will be squeezed through the mail spooling process again,
7093 which means that it will be put in some mail newsgroup or other
7094 depending on `nnmail-split-methods'.
7095 If N is a positive number, respool the N next articles.
7096 If N is a negative number, respool the N previous articles.
7097 If N is nil and any articles have been marked with the process mark,
7098 respool those articles instead.
7100 Respooling can be done both from mail groups and \"real\" newsgroups.
7101 In the former case, the articles in question will be moved from the
7102 current group into whatever groups they are destined to. In the
7103 latter case, they will be copied into the relevant groups."
7105 (list current-prefix-arg
7106 (let* ((methods (gnus-methods-using 'respool))
7108 (symbol-name (or gnus-summary-respool-default-method
7109 (car (gnus-find-method-for-group
7110 gnus-newsgroup-name)))))
7112 (gnus-completing-read
7113 methname "What backend do you want to use when respooling?"
7114 methods nil t nil 'gnus-mail-method-history))
7117 ((zerop (length (setq ms (gnus-servers-using-backend
7119 (list (intern method) ""))
7123 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7124 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7127 (error "No method given for respooling"))
7128 (if (assoc (symbol-name
7129 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7130 (gnus-methods-using 'respool))
7131 (gnus-summary-move-article n nil method)
7132 (gnus-summary-copy-article n nil method)))
7134 (defun gnus-summary-import-article (file)
7135 "Import a random file into a mail newsgroup."
7136 (interactive "fImport file: ")
7137 (let ((group gnus-newsgroup-name)
7138 (now (current-time))
7140 (unless (gnus-check-backend-function 'request-accept-article group)
7141 (error "%s does not support article importing" group))
7142 (or (file-readable-p file)
7143 (not (file-regular-p file))
7144 (error "Can't read %s" file))
7146 (set-buffer (get-buffer-create " *import file*"))
7147 (buffer-disable-undo (current-buffer))
7149 (insert-file-contents file)
7150 (goto-char (point-min))
7151 (unless (nnheader-article-p)
7152 ;; This doesn't look like an article, so we fudge some headers.
7153 (setq atts (file-attributes file)
7154 lines (count-lines (point-min) (point-max)))
7155 (insert "From: " (read-string "From: ") "\n"
7156 "Subject: " (read-string "Subject: ") "\n"
7157 "Date: " (timezone-make-date-arpa-standard
7158 (current-time-string (nth 5 atts))
7159 (current-time-zone now)
7160 (current-time-zone now))
7162 "Message-ID: " (message-make-message-id) "\n"
7163 "Lines: " (int-to-string lines) "\n"
7164 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7165 (gnus-request-accept-article group nil t)
7166 (kill-buffer (current-buffer)))))
7168 (defun gnus-summary-article-posted-p ()
7169 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7170 This will be the case if the article has both been mailed and posted."
7172 (let ((id (mail-header-references (gnus-summary-article-header)))
7173 (gnus-override-method
7174 (or gnus-refer-article-method gnus-select-method)))
7175 (if (gnus-request-head id "")
7176 (gnus-message 2 "The current message was found on %s"
7177 gnus-override-method)
7178 (gnus-message 2 "The current message couldn't be found on %s"
7179 gnus-override-method)
7182 (defun gnus-summary-expire-articles (&optional now)
7183 "Expire all articles that are marked as expirable in the current group."
7185 (when (gnus-check-backend-function
7186 'request-expire-articles gnus-newsgroup-name)
7187 ;; This backend supports expiry.
7188 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7189 (expirable (if total
7191 ;; We need to update the info for
7192 ;; this group for `gnus-list-of-read-articles'
7193 ;; to give us the right answer.
7194 (run-hooks 'gnus-exit-group-hook)
7195 (gnus-summary-update-info)
7196 (gnus-list-of-read-articles gnus-newsgroup-name))
7197 (setq gnus-newsgroup-expirable
7198 (sort gnus-newsgroup-expirable '<))))
7199 (expiry-wait (if now 'immediate
7200 (gnus-group-find-parameter
7201 gnus-newsgroup-name 'expiry-wait)))
7204 ;; There are expirable articles in this group, so we run them
7205 ;; through the expiry process.
7206 (gnus-message 6 "Expiring articles...")
7207 ;; The list of articles that weren't expired is returned.
7209 (let ((nnmail-expiry-wait-function nil)
7210 (nnmail-expiry-wait expiry-wait))
7211 (setq es (gnus-request-expire-articles
7212 expirable gnus-newsgroup-name)))
7213 (setq es (gnus-request-expire-articles
7214 expirable gnus-newsgroup-name)))
7216 (setq gnus-newsgroup-expirable es))
7217 ;; We go through the old list of expirable, and mark all
7218 ;; really expired articles as nonexistent.
7219 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7220 (let ((gnus-use-cache nil))
7222 (unless (memq (car expirable) es)
7223 (when (gnus-data-find (car expirable))
7224 (gnus-summary-mark-article
7225 (car expirable) gnus-canceled-mark)))
7226 (setq expirable (cdr expirable)))))
7227 (gnus-message 6 "Expiring articles...done")))))
7229 (defun gnus-summary-expire-articles-now ()
7230 "Expunge all expirable articles in the current group.
7231 This means that *all* articles that are marked as expirable will be
7232 deleted forever, right now."
7234 (or gnus-expert-user
7236 "Are you really, really, really sure you want to delete all these messages? ")
7238 (gnus-summary-expire-articles t))
7240 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7241 (defun gnus-summary-delete-article (&optional n)
7242 "Delete the N next (mail) articles.
7243 This command actually deletes articles. This is not a marking
7244 command. The article will disappear forever from your life, never to
7246 If N is negative, delete backwards.
7247 If N is nil and articles have been marked with the process mark,
7248 delete these instead."
7250 (unless (gnus-check-backend-function 'request-expire-articles
7251 gnus-newsgroup-name)
7252 (error "The current newsgroup does not support article deletion"))
7253 ;; Compute the list of articles to delete.
7254 (let ((articles (gnus-summary-work-articles n))
7256 (if (and gnus-novice-user
7257 (not (gnus-yes-or-no-p
7258 (format "Do you really want to delete %s forever? "
7259 (if (> (length articles) 1)
7260 (format "these %s articles" (length articles))
7263 ;; Delete the articles.
7264 (setq not-deleted (gnus-request-expire-articles
7265 articles gnus-newsgroup-name 'force))
7267 (gnus-summary-remove-process-mark (car articles))
7268 ;; The backend might not have been able to delete the article
7270 (unless (memq (car articles) not-deleted)
7271 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7272 (setq articles (cdr articles)))
7274 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7275 (gnus-summary-position-point)
7276 (gnus-set-mode-line 'summary)
7279 (defun gnus-summary-edit-article (&optional force)
7280 "Edit the current article.
7281 This will have permanent effect only in mail groups.
7282 If FORCE is non-nil, allow editing of articles even in read-only
7286 (set-buffer gnus-summary-buffer)
7287 (gnus-set-global-variables)
7288 (when (and (not force)
7289 (gnus-group-read-only-p))
7290 (error "The current newsgroup does not support article editing"))
7291 ;; Select article if needed.
7292 (unless (eq (gnus-summary-article-number)
7293 gnus-current-article)
7294 (gnus-summary-select-article t))
7295 (gnus-article-date-original)
7296 (gnus-article-edit-article
7297 `(lambda (no-highlight)
7298 (gnus-summary-edit-article-done
7299 ,(or (mail-header-references gnus-current-headers) "")
7300 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7302 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7304 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7306 "Make edits to the current article permanent."
7308 ;; Replace the article.
7309 (if (and (not read-only)
7310 (not (gnus-request-replace-article
7311 (cdr gnus-article-current) (car gnus-article-current)
7313 (error "Couldn't replace article")
7314 ;; Update the summary buffer.
7316 (equal (message-tokenize-header references " ")
7317 (message-tokenize-header
7318 (or (message-fetch-field "references") "") " ")))
7319 ;; We only have to update this line.
7322 (message-narrow-to-head)
7323 (let ((head (buffer-string))
7325 (nnheader-temp-write nil
7326 (insert (format "211 %d Article retrieved.\n"
7327 (cdr gnus-article-current)))
7330 (let ((nntp-server-buffer (current-buffer)))
7331 (setq header (car (gnus-get-newsgroup-headers
7333 (set-buffer gnus-summary-buffer)
7334 gnus-newsgroup-dependencies)
7337 (set-buffer gnus-summary-buffer)
7338 (gnus-data-set-header
7339 (gnus-data-find (cdr gnus-article-current))
7341 (gnus-summary-update-article-line
7342 (cdr gnus-article-current) header))))))
7344 (set-buffer (or buffer gnus-summary-buffer))
7345 (gnus-summary-update-article (cdr gnus-article-current)))
7346 ;; Prettify the article buffer again.
7347 (unless no-highlight
7349 (set-buffer gnus-article-buffer)
7350 (run-hooks 'gnus-article-display-hook)
7351 (set-buffer gnus-original-article-buffer)
7352 (gnus-request-article
7353 (cdr gnus-article-current)
7354 (car gnus-article-current) (current-buffer))))
7355 ;; Prettify the summary buffer line.
7356 (when (gnus-visual-p 'summary-highlight 'highlight)
7357 (run-hooks 'gnus-visual-mark-article-hook))))
7359 (defun gnus-summary-edit-wash (key)
7360 "Perform editing command in the article buffer."
7364 (message "%s" (concat (this-command-keys) "- "))
7367 (gnus-summary-edit-article)
7368 (execute-kbd-macro (concat (this-command-keys) key))
7369 (gnus-article-edit-done))
7373 (defun gnus-summary-respool-query (&optional silent)
7374 "Query where the respool algorithm would put this article."
7376 (let (gnus-mark-article-hook)
7377 (gnus-summary-select-article)
7379 (set-buffer gnus-original-article-buffer)
7381 (message-narrow-to-head)
7382 (let ((groups (nnmail-article-group 'identity)))
7385 (message "This message would go to %s"
7386 (mapconcat 'car groups ", "))
7387 (message "This message would go to no groups"))
7390 ;; Summary marking commands.
7392 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7393 "Mark articles which has the same subject as read, and then select the next.
7394 If UNMARK is positive, remove any kind of mark.
7395 If UNMARK is negative, tick articles."
7398 (setq unmark (prefix-numeric-value unmark)))
7400 (gnus-summary-mark-same-subject
7401 (gnus-summary-article-subject) unmark)))
7402 ;; Select next unread article. If auto-select-same mode, should
7403 ;; select the first unread article.
7404 (gnus-summary-next-article t (and gnus-auto-select-same
7405 (gnus-summary-article-subject)))
7406 (gnus-message 7 "%d article%s marked as %s"
7407 count (if (= count 1) " is" "s are")
7408 (if unmark "unread" "read"))))
7410 (defun gnus-summary-kill-same-subject (&optional unmark)
7411 "Mark articles which has the same subject as read.
7412 If UNMARK is positive, remove any kind of mark.
7413 If UNMARK is negative, tick articles."
7416 (setq unmark (prefix-numeric-value unmark)))
7418 (gnus-summary-mark-same-subject
7419 (gnus-summary-article-subject) unmark)))
7420 ;; If marked as read, go to next unread subject.
7422 ;; Go to next unread subject.
7423 (gnus-summary-next-subject 1 t))
7424 (gnus-message 7 "%d articles are marked as %s"
7425 count (if unmark "unread" "read"))))
7427 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7428 "Mark articles with same SUBJECT as read, and return marked number.
7429 If optional argument UNMARK is positive, remove any kinds of marks.
7430 If optional argument UNMARK is negative, mark articles as unread instead."
7434 ((null unmark) ; Mark as read.
7437 (gnus-summary-mark-article-as-read gnus-killed-mark)
7438 (gnus-summary-show-thread) t)
7439 (gnus-summary-find-subject subject))
7440 (setq count (1+ count))))
7441 ((> unmark 0) ; Tick.
7444 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7445 (gnus-summary-show-thread) t)
7446 (gnus-summary-find-subject subject))
7447 (setq count (1+ count))))
7448 (t ; Mark as unread.
7451 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7452 (gnus-summary-show-thread) t)
7453 (gnus-summary-find-subject subject))
7454 (setq count (1+ count)))))
7455 (gnus-set-mode-line 'summary)
7456 ;; Return the number of marked articles.
7459 (defun gnus-summary-mark-as-processable (n &optional unmark)
7460 "Set the process mark on the next N articles.
7461 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7462 the process mark instead. The difference between N and the actual
7463 number of articles marked is returned."
7465 (let ((backward (< n 0))
7470 (gnus-summary-remove-process-mark
7471 (gnus-summary-article-number))
7472 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7473 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7476 (gnus-message 7 "No more articles"))
7477 (gnus-summary-recenter)
7478 (gnus-summary-position-point)
7481 (defun gnus-summary-unmark-as-processable (n)
7482 "Remove the process mark from the next N articles.
7483 If N is negative, unmark backward instead. The difference between N and
7484 the actual number of articles unmarked is returned."
7486 (gnus-summary-mark-as-processable n t))
7488 (defun gnus-summary-unmark-all-processable ()
7489 "Remove the process mark from all articles."
7492 (while gnus-newsgroup-processable
7493 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7494 (gnus-summary-position-point))
7496 (defun gnus-summary-mark-as-expirable (n)
7497 "Mark N articles forward as expirable.
7498 If N is negative, mark backward instead. The difference between N and
7499 the actual number of articles marked is returned."
7501 (gnus-summary-mark-forward n gnus-expirable-mark))
7503 (defun gnus-summary-mark-article-as-replied (article)
7504 "Mark ARTICLE replied and update the summary line."
7505 (push article gnus-newsgroup-replied)
7506 (let ((buffer-read-only nil))
7507 (when (gnus-summary-goto-subject article)
7508 (gnus-summary-update-secondary-mark article))))
7510 (defun gnus-summary-set-bookmark (article)
7511 "Set a bookmark in current article."
7512 (interactive (list (gnus-summary-article-number)))
7513 (when (or (not (get-buffer gnus-article-buffer))
7514 (not gnus-current-article)
7515 (not gnus-article-current)
7516 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7517 (error "No current article selected"))
7518 ;; Remove old bookmark, if one exists.
7519 (let ((old (assq article gnus-newsgroup-bookmarks)))
7521 (setq gnus-newsgroup-bookmarks
7522 (delq old gnus-newsgroup-bookmarks))))
7523 ;; Set the new bookmark, which is on the form
7524 ;; (article-number . line-number-in-body).
7528 (set-buffer gnus-article-buffer)
7532 (goto-char (point-min))
7533 (search-forward "\n\n" nil t)
7536 gnus-newsgroup-bookmarks)
7537 (gnus-message 6 "A bookmark has been added to the current article."))
7539 (defun gnus-summary-remove-bookmark (article)
7540 "Remove the bookmark from the current article."
7541 (interactive (list (gnus-summary-article-number)))
7542 ;; Remove old bookmark, if one exists.
7543 (let ((old (assq article gnus-newsgroup-bookmarks)))
7546 (setq gnus-newsgroup-bookmarks
7547 (delq old gnus-newsgroup-bookmarks))
7548 (gnus-message 6 "Removed bookmark."))
7549 (gnus-message 6 "No bookmark in current article."))))
7551 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7552 (defun gnus-summary-mark-as-dormant (n)
7553 "Mark N articles forward as dormant.
7554 If N is negative, mark backward instead. The difference between N and
7555 the actual number of articles marked is returned."
7557 (gnus-summary-mark-forward n gnus-dormant-mark))
7559 (defun gnus-summary-set-process-mark (article)
7560 "Set the process mark on ARTICLE and update the summary line."
7561 (setq gnus-newsgroup-processable
7563 (delq article gnus-newsgroup-processable)))
7564 (when (gnus-summary-goto-subject article)
7565 (gnus-summary-show-thread)
7566 (gnus-summary-update-secondary-mark article)))
7568 (defun gnus-summary-remove-process-mark (article)
7569 "Remove the process mark from ARTICLE and update the summary line."
7570 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7571 (when (gnus-summary-goto-subject article)
7572 (gnus-summary-show-thread)
7573 (gnus-summary-update-secondary-mark article)))
7575 (defun gnus-summary-set-saved-mark (article)
7576 "Set the process mark on ARTICLE and update the summary line."
7577 (push article gnus-newsgroup-saved)
7578 (when (gnus-summary-goto-subject article)
7579 (gnus-summary-update-secondary-mark article)))
7581 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7582 "Mark N articles as read forwards.
7583 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7584 The difference between N and the actual number of articles marked is
7587 (let ((backward (< n 0))
7588 (gnus-summary-goto-unread
7589 (and gnus-summary-goto-unread
7590 (not (eq gnus-summary-goto-unread 'never))
7591 (not (memq mark (list gnus-unread-mark
7592 gnus-ticked-mark gnus-dormant-mark)))))
7594 (mark (or mark gnus-del-mark)))
7596 (gnus-summary-mark-article nil mark no-expire)
7597 (zerop (gnus-summary-next-subject
7599 (and gnus-summary-goto-unread
7600 (not (eq gnus-summary-goto-unread 'never)))
7604 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7605 (gnus-summary-recenter)
7606 (gnus-summary-position-point)
7607 (gnus-set-mode-line 'summary)
7610 (defun gnus-summary-mark-article-as-read (mark)
7611 "Mark the current article quickly as read with MARK."
7612 (let ((article (gnus-summary-article-number)))
7613 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7614 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7615 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7616 (push (cons article mark) gnus-newsgroup-reads)
7617 ;; Possibly remove from cache, if that is used.
7618 (when gnus-use-cache
7619 (gnus-cache-enter-remove-article article))
7620 ;; Allow the backend to change the mark.
7621 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7622 ;; Check for auto-expiry.
7623 (when (and gnus-newsgroup-auto-expire
7624 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7625 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7626 (= mark gnus-ancient-mark)
7627 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7628 (= mark gnus-duplicate-mark)))
7629 (setq mark gnus-expirable-mark)
7630 (push article gnus-newsgroup-expirable))
7631 ;; Set the mark in the buffer.
7632 (gnus-summary-update-mark mark 'unread)
7635 (defun gnus-summary-mark-article-as-unread (mark)
7636 "Mark the current article quickly as unread with MARK."
7637 (let ((article (gnus-summary-article-number)))
7640 (gnus-error 1 "Can't mark negative article numbers")
7642 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7643 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7644 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7645 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7646 (cond ((= mark gnus-ticked-mark)
7647 (push article gnus-newsgroup-marked))
7648 ((= mark gnus-dormant-mark)
7649 (push article gnus-newsgroup-dormant))
7651 (push article gnus-newsgroup-unreads)))
7652 (setq gnus-newsgroup-reads
7653 (delq (assq article gnus-newsgroup-reads)
7654 gnus-newsgroup-reads))
7656 ;; See whether the article is to be put in the cache.
7658 (vectorp (gnus-summary-article-header article))
7660 (gnus-cache-possibly-enter-article
7661 gnus-newsgroup-name article
7662 (gnus-summary-article-header article)
7663 (= mark gnus-ticked-mark)
7664 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7667 (gnus-summary-update-mark mark 'unread)
7670 (defun gnus-summary-mark-article (&optional article mark no-expire)
7671 "Mark ARTICLE with MARK. MARK can be any character.
7672 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7673 `??' (dormant) and `?E' (expirable).
7674 If MARK is nil, then the default character `?D' is used.
7675 If ARTICLE is nil, then the article on the current line will be
7677 ;; The mark might be a string.
7678 (when (stringp mark)
7679 (setq mark (aref mark 0)))
7680 ;; If no mark is given, then we check auto-expiring.
7681 (and (not no-expire)
7682 gnus-newsgroup-auto-expire
7684 (and (gnus-characterp mark)
7685 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7686 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7687 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7688 (= mark gnus-duplicate-mark))))
7689 (setq mark gnus-expirable-mark))
7690 (let* ((mark (or mark gnus-del-mark))
7691 (article (or article (gnus-summary-article-number))))
7693 (error "No article on current line"))
7694 (if (not (if (or (= mark gnus-unread-mark)
7695 (= mark gnus-ticked-mark)
7696 (= mark gnus-dormant-mark))
7697 (gnus-mark-article-as-unread article mark)
7698 (gnus-mark-article-as-read article mark)))
7700 ;; See whether the article is to be put in the cache.
7702 (not (= mark gnus-canceled-mark))
7703 (vectorp (gnus-summary-article-header article))
7705 (gnus-cache-possibly-enter-article
7706 gnus-newsgroup-name article
7707 (gnus-summary-article-header article)
7708 (= mark gnus-ticked-mark)
7709 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7711 (when (gnus-summary-goto-subject article nil t)
7712 (let ((buffer-read-only nil))
7713 (gnus-summary-show-thread)
7715 (gnus-summary-update-mark mark 'unread)
7718 (defun gnus-summary-update-secondary-mark (article)
7719 "Update the secondary (read, process, cache) mark."
7720 (gnus-summary-update-mark
7721 (cond ((memq article gnus-newsgroup-processable)
7723 ((memq article gnus-newsgroup-cached)
7725 ((memq article gnus-newsgroup-replied)
7727 ((memq article gnus-newsgroup-saved)
7729 (t gnus-unread-mark))
7731 (when (gnus-visual-p 'summary-highlight 'highlight)
7732 (run-hooks 'gnus-summary-update-hook))
7735 (defun gnus-summary-update-mark (mark type)
7736 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7737 (buffer-read-only nil))
7738 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7739 (when (looking-at "\r")
7742 (<= (+ forward (point)) (point-max)))
7743 ;; Go to the right position on the line.
7744 (goto-char (+ forward (point)))
7745 ;; Replace the old mark with the new mark.
7746 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7747 ;; Optionally update the marks by some user rule.
7748 (when (eq type 'unread)
7750 (gnus-data-find (gnus-summary-article-number)) mark)
7751 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7753 (defun gnus-mark-article-as-read (article &optional mark)
7754 "Enter ARTICLE in the pertinent lists and remove it from others."
7755 ;; Make the article expirable.
7756 (let ((mark (or mark gnus-del-mark)))
7757 (if (= mark gnus-expirable-mark)
7758 (push article gnus-newsgroup-expirable)
7759 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7760 ;; Remove from unread and marked lists.
7761 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7762 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7763 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7764 (push (cons article mark) gnus-newsgroup-reads)
7765 ;; Possibly remove from cache, if that is used.
7766 (when gnus-use-cache
7767 (gnus-cache-enter-remove-article article))))
7769 (defun gnus-mark-article-as-unread (article &optional mark)
7770 "Enter ARTICLE in the pertinent lists and remove it from others."
7771 (let ((mark (or mark gnus-ticked-mark)))
7774 (gnus-error 1 "Can't mark negative article numbers")
7776 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7777 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7778 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7779 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7781 ;; Unsuppress duplicates?
7782 (when gnus-suppress-duplicates
7783 (gnus-dup-unsuppress-article article))
7785 (cond ((= mark gnus-ticked-mark)
7786 (push article gnus-newsgroup-marked))
7787 ((= mark gnus-dormant-mark)
7788 (push article gnus-newsgroup-dormant))
7790 (push article gnus-newsgroup-unreads)))
7791 (setq gnus-newsgroup-reads
7792 (delq (assq article gnus-newsgroup-reads)
7793 gnus-newsgroup-reads))
7796 (defalias 'gnus-summary-mark-as-unread-forward
7797 'gnus-summary-tick-article-forward)
7798 (make-obsolete 'gnus-summary-mark-as-unread-forward
7799 'gnus-summary-tick-article-forward)
7800 (defun gnus-summary-tick-article-forward (n)
7801 "Tick N articles forwards.
7802 If N is negative, tick backwards instead.
7803 The difference between N and the number of articles ticked is returned."
7805 (gnus-summary-mark-forward n gnus-ticked-mark))
7807 (defalias 'gnus-summary-mark-as-unread-backward
7808 'gnus-summary-tick-article-backward)
7809 (make-obsolete 'gnus-summary-mark-as-unread-backward
7810 'gnus-summary-tick-article-backward)
7811 (defun gnus-summary-tick-article-backward (n)
7812 "Tick N articles backwards.
7813 The difference between N and the number of articles ticked is returned."
7815 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7817 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7818 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7819 (defun gnus-summary-tick-article (&optional article clear-mark)
7820 "Mark current article as unread.
7821 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7822 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7824 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7827 (defun gnus-summary-mark-as-read-forward (n)
7828 "Mark N articles as read forwards.
7829 If N is negative, mark backwards instead.
7830 The difference between N and the actual number of articles marked is
7833 (gnus-summary-mark-forward n gnus-del-mark t))
7835 (defun gnus-summary-mark-as-read-backward (n)
7836 "Mark the N articles as read backwards.
7837 The difference between N and the actual number of articles marked is
7840 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7842 (defun gnus-summary-mark-as-read (&optional article mark)
7843 "Mark current article as read.
7844 ARTICLE specifies the article to be marked as read.
7845 MARK specifies a string to be inserted at the beginning of the line."
7846 (gnus-summary-mark-article article mark))
7848 (defun gnus-summary-clear-mark-forward (n)
7849 "Clear marks from N articles forward.
7850 If N is negative, clear backward instead.
7851 The difference between N and the number of marks cleared is returned."
7853 (gnus-summary-mark-forward n gnus-unread-mark))
7855 (defun gnus-summary-clear-mark-backward (n)
7856 "Clear marks from N articles backward.
7857 The difference between N and the number of marks cleared is returned."
7859 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7861 (defun gnus-summary-mark-unread-as-read ()
7862 "Intended to be used by `gnus-summary-mark-article-hook'."
7863 (when (memq gnus-current-article gnus-newsgroup-unreads)
7864 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7866 (defun gnus-summary-mark-read-and-unread-as-read ()
7867 "Intended to be used by `gnus-summary-mark-article-hook'."
7868 (let ((mark (gnus-summary-article-mark)))
7869 (when (or (gnus-unread-mark-p mark)
7870 (gnus-read-mark-p mark))
7871 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7873 (defun gnus-summary-mark-region-as-read (point mark all)
7874 "Mark all unread articles between point and mark as read.
7875 If given a prefix, mark all articles between point and mark as read,
7876 even ticked and dormant ones."
7877 (interactive "r\nP")
7886 (memq (setq article (gnus-summary-article-number))
7887 gnus-newsgroup-unreads))
7888 (gnus-summary-mark-article article gnus-del-mark))
7890 (gnus-summary-find-next))))))
7892 (defun gnus-summary-mark-below (score mark)
7893 "Mark articles with score less than SCORE with MARK."
7894 (interactive "P\ncMark: ")
7895 (setq score (if score
7896 (prefix-numeric-value score)
7897 (or gnus-summary-default-score 0)))
7899 (set-buffer gnus-summary-buffer)
7900 (goto-char (point-min))
7903 (and (< (gnus-summary-article-score) score)
7904 (gnus-summary-mark-article nil mark))
7905 (gnus-summary-find-next)))))
7907 (defun gnus-summary-kill-below (&optional score)
7908 "Mark articles with score below SCORE as read."
7910 (gnus-summary-mark-below score gnus-killed-mark))
7912 (defun gnus-summary-clear-above (&optional score)
7913 "Clear all marks from articles with score above SCORE."
7915 (gnus-summary-mark-above score gnus-unread-mark))
7917 (defun gnus-summary-tick-above (&optional score)
7918 "Tick all articles with score above SCORE."
7920 (gnus-summary-mark-above score gnus-ticked-mark))
7922 (defun gnus-summary-mark-above (score mark)
7923 "Mark articles with score over SCORE with MARK."
7924 (interactive "P\ncMark: ")
7925 (setq score (if score
7926 (prefix-numeric-value score)
7927 (or gnus-summary-default-score 0)))
7929 (set-buffer gnus-summary-buffer)
7930 (goto-char (point-min))
7932 (when (> (gnus-summary-article-score) score)
7933 (gnus-summary-mark-article nil mark))
7935 (gnus-summary-find-next)))))
7937 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7938 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7939 (defun gnus-summary-limit-include-expunged (&optional no-error)
7940 "Display all the hidden articles that were expunged for low scores."
7942 (let ((buffer-read-only nil))
7943 (let ((scored gnus-newsgroup-scored)
7946 (unless (gnus-summary-goto-subject (caar scored))
7947 (and (setq h (gnus-summary-article-header (caar scored)))
7948 (< (cdar scored) gnus-summary-expunge-below)
7950 (setq scored (cdr scored)))
7952 (when (not no-error)
7953 (error "No expunged articles hidden"))
7954 (goto-char (point-min))
7955 (gnus-summary-prepare-unthreaded (nreverse headers))
7956 (goto-char (point-min))
7957 (gnus-summary-position-point)
7960 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7961 "Mark all unread articles in this newsgroup as read.
7962 If prefix argument ALL is non-nil, ticked and dormant articles will
7963 also be marked as read.
7964 If QUIETLY is non-nil, no questions will be asked.
7965 If TO-HERE is non-nil, it should be a point in the buffer. All
7966 articles before this point will be marked as read.
7967 Note that this function will only catch up the unread article
7968 in the current summary buffer limitation.
7969 The number of articles marked as read is returned."
7974 (not gnus-interactive-catchup) ;Without confirmation?
7978 "Mark absolutely all articles as read? "
7979 "Mark all unread articles as read? ")))
7981 (not gnus-newsgroup-adaptive)
7982 (not gnus-newsgroup-auto-expire)
7983 (not gnus-suppress-duplicates)
7984 (or (not gnus-use-cache)
7985 (eq gnus-use-cache 'passive)))
7988 (setq gnus-newsgroup-marked nil
7989 gnus-newsgroup-dormant nil))
7990 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
7991 ;; We actually mark all articles as canceled, which we
7992 ;; have to do when using auto-expiry or adaptive scoring.
7993 (gnus-summary-show-all-threads)
7994 (when (gnus-summary-first-subject (not all))
7996 (if to-here (< (point) to-here) t)
7997 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7998 (gnus-summary-find-next (not all)))))
7999 (gnus-set-mode-line 'summary))
8001 (gnus-summary-position-point)))
8003 (defun gnus-summary-catchup-to-here (&optional all)
8004 "Mark all unticked articles before the current one as read.
8005 If ALL is non-nil, also mark ticked and dormant articles as read."
8008 (gnus-save-hidden-threads
8009 (let ((beg (point)))
8010 ;; We check that there are unread articles.
8011 (when (or all (gnus-summary-find-prev))
8012 (gnus-summary-catchup all t beg)))))
8013 (gnus-summary-position-point))
8015 (defun gnus-summary-catchup-all (&optional quietly)
8016 "Mark all articles in this newsgroup as read."
8018 (gnus-summary-catchup t quietly))
8020 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8021 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8022 If prefix argument ALL is non-nil, all articles are marked as read."
8024 (when (gnus-summary-catchup all quietly nil 'fast)
8025 ;; Select next newsgroup or exit.
8026 (if (eq gnus-auto-select-next 'quietly)
8027 (gnus-summary-next-group nil)
8028 (gnus-summary-exit))))
8030 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8031 "Mark all articles in this newsgroup as read, and then exit."
8033 (gnus-summary-catchup-and-exit t quietly))
8035 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8036 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8037 "Mark all articles in this group as read and select the next group.
8038 If given a prefix, mark all articles, unread as well as ticked, as
8042 (gnus-summary-catchup all))
8043 (gnus-summary-next-article t nil nil t))
8045 ;; Thread-based commands.
8047 (defun gnus-summary-articles-in-thread (&optional article)
8048 "Return a list of all articles in the current thread.
8049 If ARTICLE is non-nil, return all articles in the thread that starts
8051 (let* ((article (or article (gnus-summary-article-number)))
8052 (data (gnus-data-find-list article))
8053 (top-level (gnus-data-level (car data)))
8055 (cond ((null gnus-thread-operation-ignore-subject)
8056 (gnus-simplify-subject-re
8057 (mail-header-subject (gnus-data-header (car data)))))
8058 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8059 (gnus-simplify-subject-fuzzy
8060 (mail-header-subject (gnus-data-header (car data)))))
8062 (end-point (save-excursion
8063 (if (gnus-summary-go-to-next-thread)
8064 (point) (point-max))))
8067 (< (gnus-data-pos (car data)) end-point))
8068 (when (or (not top-subject)
8069 (string= top-subject
8070 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8071 (gnus-simplify-subject-fuzzy
8072 (mail-header-subject
8073 (gnus-data-header (car data))))
8074 (gnus-simplify-subject-re
8075 (mail-header-subject
8076 (gnus-data-header (car data)))))))
8077 (push (gnus-data-number (car data)) articles))
8078 (unless (and (setq data (cdr data))
8079 (> (gnus-data-level (car data)) top-level))
8081 ;; Return the list of articles.
8082 (nreverse articles)))
8084 (defun gnus-summary-rethread-current ()
8085 "Rethread the thread the current article is part of."
8087 (let* ((gnus-show-threads t)
8088 (article (gnus-summary-article-number))
8089 (id (mail-header-id (gnus-summary-article-header)))
8090 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8092 (error "No article on the current line"))
8093 (gnus-rebuild-thread id)
8094 (gnus-summary-goto-subject article)))
8096 (defun gnus-summary-reparent-thread ()
8097 "Make the current article child of the marked (or previous) article.
8099 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8100 is non-nil or the Subject: of both articles are the same."
8102 (unless (not (gnus-group-read-only-p))
8103 (error "The current newsgroup does not support article editing"))
8104 (unless (<= (length gnus-newsgroup-processable) 1)
8105 (error "No more than one article may be marked"))
8106 (save-window-excursion
8107 (let ((gnus-article-buffer " *reparent*")
8108 (current-article (gnus-summary-article-number))
8109 ;; First grab the marked article, otherwise one line up.
8110 (parent-article (if (not (null gnus-newsgroup-processable))
8111 (car gnus-newsgroup-processable)
8113 (if (eq (forward-line -1) 0)
8114 (gnus-summary-article-number)
8115 (error "Beginning of summary buffer"))))))
8116 (unless (not (eq current-article parent-article))
8117 (error "An article may not be self-referential"))
8118 (let ((message-id (mail-header-id
8119 (gnus-summary-article-header parent-article))))
8120 (unless (and message-id (not (equal message-id "")))
8121 (error "No message-id in desired parent"))
8122 (gnus-summary-select-article t t nil current-article)
8123 (set-buffer gnus-original-article-buffer)
8124 (let ((buf (format "%s" (buffer-string))))
8125 (nnheader-temp-write nil
8127 (goto-char (point-min))
8128 (if (re-search-forward "^References: " nil t)
8130 (re-search-forward "^[^ \t]" nil t)
8133 (insert " " message-id))
8134 (insert "References: " message-id "\n"))
8135 (unless (gnus-request-replace-article
8136 current-article (car gnus-article-current)
8138 (error "Couldn't replace article"))))
8139 (set-buffer gnus-summary-buffer)
8140 (gnus-summary-unmark-all-processable)
8141 (gnus-summary-update-article current-article)
8142 (gnus-summary-rethread-current)
8143 (gnus-message 3 "Article %d is now the child of article %d"
8144 current-article parent-article)))))
8146 (defun gnus-summary-toggle-threads (&optional arg)
8147 "Toggle showing conversation threads.
8148 If ARG is positive number, turn showing conversation threads on."
8150 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8151 (setq gnus-show-threads
8152 (if (null arg) (not gnus-show-threads)
8153 (> (prefix-numeric-value arg) 0)))
8154 (gnus-summary-prepare)
8155 (gnus-summary-goto-subject current)
8156 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8157 (gnus-summary-position-point)))
8159 (defun gnus-summary-show-all-threads ()
8163 (let ((buffer-read-only nil))
8164 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8165 (gnus-summary-position-point))
8167 (defun gnus-summary-show-thread ()
8168 "Show thread subtrees.
8169 Returns nil if no thread was there to be shown."
8171 (let ((buffer-read-only nil)
8173 ;; first goto end then to beg, to have point at beg after let
8174 (end (progn (end-of-line) (point)))
8175 (beg (progn (beginning-of-line) (point))))
8177 ;; Any hidden lines here?
8178 (search-forward "\r" end t)
8179 (subst-char-in-region beg end ?\^M ?\n t)
8181 (gnus-summary-position-point))))
8183 (defun gnus-summary-hide-all-threads ()
8184 "Hide all thread subtrees."
8187 (goto-char (point-min))
8188 (gnus-summary-hide-thread)
8189 (while (zerop (gnus-summary-next-thread 1 t))
8190 (gnus-summary-hide-thread)))
8191 (gnus-summary-position-point))
8193 (defun gnus-summary-hide-thread ()
8194 "Hide thread subtrees.
8195 Returns nil if no threads were there to be hidden."
8197 (let ((buffer-read-only nil)
8199 (article (gnus-summary-article-number)))
8201 ;; Go forward until either the buffer ends or the subthread
8203 (when (and (not (eobp))
8204 (or (zerop (gnus-summary-next-thread 1 t))
8205 (goto-char (point-max))))
8207 (if (and (> (point) start)
8208 (search-backward "\n" start t))
8210 (subst-char-in-region start (point) ?\n ?\^M)
8211 (gnus-summary-goto-subject article))
8214 ;;(gnus-summary-position-point)
8217 (defun gnus-summary-go-to-next-thread (&optional previous)
8218 "Go to the same level (or less) next thread.
8219 If PREVIOUS is non-nil, go to previous thread instead.
8220 Return the article number moved to, or nil if moving was impossible."
8221 (let ((level (gnus-summary-thread-level))
8222 (way (if previous -1 1))
8225 (while (and (not (eobp))
8226 (< level (gnus-summary-thread-level)))
8234 (gnus-summary-article-number)
8237 (defun gnus-summary-next-thread (n &optional silent)
8238 "Go to the same level next N'th thread.
8239 If N is negative, search backward instead.
8240 Returns the difference between N and the number of skips actually
8243 If SILENT, don't output messages."
8245 (let ((backward (< n 0))
8248 (gnus-summary-go-to-next-thread backward))
8251 (gnus-summary-position-point))
8252 (when (and (not silent) (/= 0 n))
8253 (gnus-message 7 "No more threads"))
8256 (defun gnus-summary-prev-thread (n)
8257 "Go to the same level previous N'th thread.
8258 Returns the difference between N and the number of skips actually
8261 (gnus-summary-next-thread (- n)))
8263 (defun gnus-summary-go-down-thread ()
8264 "Go down one level in the current thread."
8265 (let ((children (gnus-summary-article-children)))
8267 (gnus-summary-goto-subject (car children)))))
8269 (defun gnus-summary-go-up-thread ()
8270 "Go up one level in the current thread."
8271 (let ((parent (gnus-summary-article-parent)))
8273 (gnus-summary-goto-subject parent))))
8275 (defun gnus-summary-down-thread (n)
8276 "Go down thread N steps.
8277 If N is negative, go up instead.
8278 Returns the difference between N and how many steps down that were
8284 (if up (gnus-summary-go-up-thread)
8285 (gnus-summary-go-down-thread)))
8287 (gnus-summary-position-point)
8289 (gnus-message 7 "Can't go further"))
8292 (defun gnus-summary-up-thread (n)
8293 "Go up thread N steps.
8294 If N is negative, go up instead.
8295 Returns the difference between N and how many steps down that were
8298 (gnus-summary-down-thread (- n)))
8300 (defun gnus-summary-top-thread ()
8301 "Go to the top of the thread."
8303 (while (gnus-summary-go-up-thread))
8304 (gnus-summary-article-number))
8306 (defun gnus-summary-kill-thread (&optional unmark)
8307 "Mark articles under current thread as read.
8308 If the prefix argument is positive, remove any kinds of marks.
8309 If the prefix argument is negative, tick articles instead."
8312 (setq unmark (prefix-numeric-value unmark)))
8313 (let ((articles (gnus-summary-articles-in-thread)))
8315 ;; Expand the thread.
8316 (gnus-summary-show-thread)
8317 ;; Mark all the articles.
8319 (gnus-summary-goto-subject (car articles))
8320 (cond ((null unmark)
8321 (gnus-summary-mark-article-as-read gnus-killed-mark))
8323 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8325 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8326 (setq articles (cdr articles))))
8327 ;; Hide killed subtrees.
8329 gnus-thread-hide-killed
8330 (gnus-summary-hide-thread))
8331 ;; If marked as read, go to next unread subject.
8333 ;; Go to next unread subject.
8334 (gnus-summary-next-subject 1 t)))
8335 (gnus-set-mode-line 'summary))
8337 ;; Summary sorting commands
8339 (defun gnus-summary-sort-by-number (&optional reverse)
8340 "Sort the summary buffer by article number.
8341 Argument REVERSE means reverse order."
8343 (gnus-summary-sort 'number reverse))
8345 (defun gnus-summary-sort-by-author (&optional reverse)
8346 "Sort the summary buffer by author name alphabetically.
8347 If case-fold-search is non-nil, case of letters is ignored.
8348 Argument REVERSE means reverse order."
8350 (gnus-summary-sort 'author reverse))
8352 (defun gnus-summary-sort-by-subject (&optional reverse)
8353 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8354 If case-fold-search is non-nil, case of letters is ignored.
8355 Argument REVERSE means reverse order."
8357 (gnus-summary-sort 'subject reverse))
8359 (defun gnus-summary-sort-by-date (&optional reverse)
8360 "Sort the summary buffer by date.
8361 Argument REVERSE means reverse order."
8363 (gnus-summary-sort 'date reverse))
8365 (defun gnus-summary-sort-by-score (&optional reverse)
8366 "Sort the summary buffer by score.
8367 Argument REVERSE means reverse order."
8369 (gnus-summary-sort 'score reverse))
8371 (defun gnus-summary-sort-by-lines (&optional reverse)
8372 "Sort the summary buffer by article length.
8373 Argument REVERSE means reverse order."
8375 (gnus-summary-sort 'lines reverse))
8377 (defun gnus-summary-sort (predicate reverse)
8378 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8379 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8380 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8381 (gnus-thread-sort-functions
8387 (gnus-article-sort-functions
8392 (,article t2 t1)))))
8394 (gnus-summary-prepare-hook nil))
8395 ;; We do the sorting by regenerating the threads.
8396 (gnus-summary-prepare)
8397 ;; Hide subthreads if needed.
8398 (when (and gnus-show-threads gnus-thread-hide-subtree)
8399 (gnus-summary-hide-all-threads))))
8401 ;; Summary saving commands.
8403 (defun gnus-summary-save-article (&optional n not-saved)
8404 "Save the current article using the default saver function.
8405 If N is a positive number, save the N next articles.
8406 If N is a negative number, save the N previous articles.
8407 If N is nil and any articles have been marked with the process mark,
8408 save those articles instead.
8409 The variable `gnus-default-article-saver' specifies the saver function."
8411 (let* ((articles (gnus-summary-work-articles n))
8412 (save-buffer (save-excursion
8413 (nnheader-set-temp-buffer " *Gnus Save*")))
8414 (num (length articles))
8415 header article file)
8417 (setq header (gnus-summary-article-header
8418 (setq article (pop articles))))
8419 (if (not (vectorp header))
8420 ;; This is a pseudo-article.
8421 (if (assq 'name header)
8422 (gnus-copy-file (cdr (assq 'name header)))
8423 (gnus-message 1 "Article %d is unsaveable" article))
8424 ;; This is a real article.
8425 (save-window-excursion
8426 (gnus-summary-select-article t nil nil article))
8428 (set-buffer save-buffer)
8430 (insert-buffer-substring gnus-original-article-buffer))
8431 (setq file (gnus-article-save save-buffer file num))
8432 (gnus-summary-remove-process-mark article)
8434 (gnus-summary-set-saved-mark article))))
8435 (gnus-kill-buffer save-buffer)
8436 (gnus-summary-position-point)
8437 (gnus-set-mode-line 'summary)
8440 (defun gnus-summary-pipe-output (&optional arg)
8441 "Pipe the current article to a subprocess.
8442 If N is a positive number, pipe the N next articles.
8443 If N is a negative number, pipe the N previous articles.
8444 If N is nil and any articles have been marked with the process mark,
8445 pipe those articles instead."
8447 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8448 (gnus-summary-save-article arg t))
8449 (gnus-configure-windows 'pipe))
8451 (defun gnus-summary-save-article-mail (&optional arg)
8452 "Append the current article to an mail file.
8453 If N is a positive number, save the N next articles.
8454 If N is a negative number, save the N previous articles.
8455 If N is nil and any articles have been marked with the process mark,
8456 save those articles instead."
8458 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8459 (gnus-summary-save-article arg)))
8461 (defun gnus-summary-save-article-rmail (&optional arg)
8462 "Append the current article to an rmail file.
8463 If N is a positive number, save the N next articles.
8464 If N is a negative number, save the N previous articles.
8465 If N is nil and any articles have been marked with the process mark,
8466 save those articles instead."
8468 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8469 (gnus-summary-save-article arg)))
8471 (defun gnus-summary-save-article-file (&optional arg)
8472 "Append the current article to a file.
8473 If N is a positive number, save the N next articles.
8474 If N is a negative number, save the N previous articles.
8475 If N is nil and any articles have been marked with the process mark,
8476 save those articles instead."
8478 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8479 (gnus-summary-save-article arg)))
8481 (defun gnus-summary-write-article-file (&optional arg)
8482 "Write the current article to a file, deleting the previous file.
8483 If N is a positive number, save the N next articles.
8484 If N is a negative number, save the N previous articles.
8485 If N is nil and any articles have been marked with the process mark,
8486 save those articles instead."
8488 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8489 (gnus-summary-save-article arg)))
8491 (defun gnus-summary-save-article-body-file (&optional arg)
8492 "Append the current article body to a file.
8493 If N is a positive number, save the N next articles.
8494 If N is a negative number, save the N previous articles.
8495 If N is nil and any articles have been marked with the process mark,
8496 save those articles instead."
8498 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8499 (gnus-summary-save-article arg)))
8501 (defun gnus-summary-pipe-message (program)
8502 "Pipe the current article through PROGRAM."
8503 (interactive "sProgram: ")
8504 (gnus-summary-select-article)
8505 (let ((mail-header-separator "")
8506 (art-buf (get-buffer gnus-article-buffer)))
8507 (gnus-eval-in-buffer-window gnus-article-buffer
8510 (let ((start (window-start))
8512 (message-pipe-buffer-body program)
8513 (set-window-start (get-buffer-window (current-buffer)) start))))))
8515 (defun gnus-get-split-value (methods)
8516 "Return a value based on the split METHODS."
8517 (let (split-name method result match)
8520 (set-buffer gnus-original-article-buffer)
8522 (nnheader-narrow-to-headers)
8524 (goto-char (point-min))
8525 (setq method (pop methods))
8526 (setq match (car method))
8529 ;; Regular expression.
8531 (re-search-forward match nil t)))
8532 ((gnus-functionp match)
8536 (setq result (funcall match gnus-newsgroup-name))))
8541 (setq result (eval match)))))
8542 (setq split-name (append (cdr method) split-name))
8543 (cond ((stringp result)
8544 (push (expand-file-name
8545 result gnus-article-save-directory)
8548 (setq split-name (append result split-name)))))))))
8551 (defun gnus-valid-move-group-p (group)
8556 (car (gnus-find-method-for-group
8557 (symbol-name group))))
8558 gnus-valid-select-methods))))
8560 (defun gnus-read-move-group-name (prompt default articles prefix)
8561 "Read a group name."
8562 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8563 (minibuffer-confirm-incomplete nil) ; XEmacs
8567 (if (> (length articles) 1)
8568 (format "these %d articles" (length articles))
8573 (gnus-completing-read default prom
8575 'gnus-valid-move-group-p
8577 'gnus-group-history))
8578 ((= 1 (length split-name))
8579 (gnus-completing-read (car split-name) prom
8581 'gnus-valid-move-group-p
8583 'gnus-group-history))
8585 (gnus-completing-read nil prom
8586 (mapcar (lambda (el) (list el))
8587 (nreverse split-name))
8589 'gnus-group-history)))))
8591 (if (or (string= to-newsgroup "")
8592 (string= to-newsgroup prefix))
8593 (setq to-newsgroup default))
8594 (unless to-newsgroup
8595 (error "No group name entered"))
8596 (or (gnus-active to-newsgroup)
8597 (gnus-activate-group to-newsgroup)
8598 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8600 (or (and (gnus-request-create-group
8601 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8602 (gnus-activate-group to-newsgroup nil nil
8603 (gnus-group-name-to-method
8605 (error "Couldn't create group %s" to-newsgroup)))
8606 (error "No such group: %s" to-newsgroup)))
8609 ;; Summary extract commands
8611 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8612 (let ((buffer-read-only nil)
8613 (article (gnus-summary-article-number))
8615 (unless (gnus-summary-goto-subject article)
8616 (error "No such article: %d" article))
8617 (gnus-summary-position-point)
8618 ;; If all commands are to be bunched up on one line, we collect
8620 (unless gnus-view-pseudos-separately
8621 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8624 (setq action (cdr (assq 'action (car ps))))
8625 (setq files (list (cdr (assq 'name (car ps)))))
8626 (while (and ps (cdr ps)
8627 (string= (or action "1")
8628 (or (cdr (assq 'action (cadr ps))) "2")))
8629 (push (cdr (assq 'name (cadr ps))) files)
8630 (setcdr ps (cddr ps)))
8632 (when (not (string-match "%s" action))
8635 (when (assq 'execute (car ps))
8636 (setcdr (assq 'execute (car ps))
8637 (funcall (if (string-match "%s" action)
8644 (gnus-quote-arg-for-sh-or-csh f)))
8646 (setq ps (cdr ps)))))
8647 (if (and gnus-view-pseudos (not not-view))
8649 (when (assq 'execute (car pslist))
8650 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8651 (eq gnus-view-pseudos 'not-confirm)))
8652 (setq pslist (cdr pslist)))
8655 (setq after-article (or (cdr (assq 'article (car pslist)))
8656 (gnus-summary-article-number)))
8657 (gnus-summary-goto-subject after-article)
8660 (insert " " (file-name-nondirectory
8661 (cdr (assq 'name (car pslist))))
8662 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8664 (forward-line -1) ; back to `b'
8665 (gnus-add-text-properties
8666 b (1- e) (list 'gnus-number gnus-reffed-article-number
8667 gnus-mouse-face-prop gnus-mouse-face))
8669 after-article gnus-reffed-article-number
8670 gnus-unread-mark b (car pslist) 0 (- e b))
8671 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8672 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8673 (setq pslist (cdr pslist)))))))
8675 (defun gnus-pseudos< (p1 p2)
8676 (let ((c1 (cdr (assq 'action p1)))
8677 (c2 (cdr (assq 'action p2))))
8678 (and c1 c2 (string< c1 c2))))
8680 (defun gnus-request-pseudo-article (props)
8681 (cond ((assq 'execute props)
8682 (gnus-execute-command (cdr (assq 'execute props)))))
8683 (let ((gnus-current-article (gnus-summary-article-number)))
8684 (run-hooks 'gnus-mark-article-hook)))
8686 (defun gnus-execute-command (command &optional automatic)
8688 (gnus-article-setup-buffer)
8689 (set-buffer gnus-article-buffer)
8690 (setq buffer-read-only nil)
8691 (let ((command (if automatic command
8692 (read-string "Command: " (cons command 0)))))
8694 (insert "$ " command "\n\n")
8695 (if gnus-view-pseudo-asynchronously
8696 (start-process "gnus-execute" (current-buffer) shell-file-name
8697 shell-command-switch command)
8698 (call-process shell-file-name nil t nil
8699 shell-command-switch command)))))
8701 ;; Summary kill commands.
8703 (defun gnus-summary-edit-global-kill (article)
8704 "Edit the \"global\" kill file."
8705 (interactive (list (gnus-summary-article-number)))
8706 (gnus-group-edit-global-kill article))
8708 (defun gnus-summary-edit-local-kill ()
8709 "Edit a local kill file applied to the current newsgroup."
8711 (setq gnus-current-headers (gnus-summary-article-header))
8712 (gnus-group-edit-local-kill
8713 (gnus-summary-article-number) gnus-newsgroup-name))
8717 (defun gnus-read-header (id &optional header)
8718 "Read the headers of article ID and enter them into the Gnus system."
8719 (let ((group gnus-newsgroup-name)
8720 (gnus-override-method
8721 (and (gnus-news-group-p gnus-newsgroup-name)
8722 gnus-refer-article-method))
8724 ;; First we check to see whether the header in question is already
8727 ;; This is a Message-ID.
8728 (setq header (or header (gnus-id-to-header id)))
8729 ;; This is an article number.
8730 (setq header (or header (gnus-summary-article-header id))))
8732 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8733 ;; We have found the header.
8735 ;; If this is a sparse article, we have to nix out its
8736 ;; previous entry in the thread hashtb.
8738 (gnus-summary-article-sparse-p (mail-header-number header)))
8739 (let* ((parent (gnus-parent-id (mail-header-references header)))
8742 (gnus-gethash parent gnus-newsgroup-dependencies))))
8744 (delq (assq header thread) thread))))
8745 ;; We have to really fetch the header to this article.
8747 (set-buffer nntp-server-buffer)
8748 (when (setq where (gnus-request-head id group))
8749 (nnheader-fold-continuation-lines)
8750 (goto-char (point-max))
8752 (goto-char (point-min))
8756 ((cdr where) (cdr where))
8757 (header (mail-header-number header))
8758 (t gnus-reffed-article-number))
8760 (insert " Article retrieved.\n"))
8762 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8763 () ; Malformed head.
8764 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8765 (when (and (stringp id)
8766 (not (string= (gnus-group-real-name group)
8768 ;; If we fetched by Message-ID and the article came
8769 ;; from a different group, we fudge some bogus article
8770 ;; numbers for this article.
8771 (mail-header-set-number header gnus-reffed-article-number))
8773 (set-buffer gnus-summary-buffer)
8774 (decf gnus-reffed-article-number)
8775 (gnus-remove-header (mail-header-number header))
8776 (push header gnus-newsgroup-headers)
8777 (setq gnus-current-headers header)
8778 (push (mail-header-number header) gnus-newsgroup-limit)))
8781 (defun gnus-remove-header (number)
8782 "Remove header NUMBER from `gnus-newsgroup-headers'."
8783 (if (and gnus-newsgroup-headers
8784 (= number (mail-header-number (car gnus-newsgroup-headers))))
8785 (pop gnus-newsgroup-headers)
8786 (let ((headers gnus-newsgroup-headers))
8787 (while (and (cdr headers)
8788 (not (= number (mail-header-number (cadr headers)))))
8791 (setcdr headers (cddr headers))))))
8794 ;;; summary highlights
8797 (defun gnus-highlight-selected-summary ()
8798 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8799 ;; Highlight selected article in summary buffer
8800 (when gnus-summary-selected-face
8802 (let* ((beg (progn (beginning-of-line) (point)))
8803 (end (progn (end-of-line) (point)))
8804 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8805 (from (if (get-text-property beg gnus-mouse-face-prop)
8807 (or (next-single-property-change
8808 beg gnus-mouse-face-prop nil end)
8813 (or (next-single-property-change
8814 from gnus-mouse-face-prop nil end)
8816 ;; If no mouse-face prop on line we will have to = from = end,
8817 ;; so we highlight the entire line instead.
8818 (when (= (+ to 2) from)
8821 (if gnus-newsgroup-selected-overlay
8822 ;; Move old overlay.
8824 gnus-newsgroup-selected-overlay from to (current-buffer))
8825 ;; Create new overlay.
8827 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8828 'face gnus-summary-selected-face))))))
8830 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8831 (defun gnus-summary-highlight-line ()
8832 "Highlight current line according to `gnus-summary-highlight'."
8833 (let* ((list gnus-summary-highlight)
8835 (end (progn (end-of-line) (point)))
8836 ;; now find out where the line starts and leave point there.
8837 (beg (progn (beginning-of-line) (point)))
8838 (article (gnus-summary-article-number))
8839 (score (or (cdr (assq (or article gnus-current-article)
8840 gnus-newsgroup-scored))
8841 gnus-summary-default-score 0))
8842 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8843 (inhibit-read-only t))
8844 ;; Eval the cars of the lists until we find a match.
8845 (let ((default gnus-summary-default-score))
8847 (not (eval (caar list))))
8848 (setq list (cdr list))))
8849 (let ((face (cdar list)))
8850 (unless (eq face (get-text-property beg 'face))
8851 (gnus-put-text-property
8853 (setq face (if (boundp face) (symbol-value face) face)))
8854 (when gnus-summary-highlight-line-function
8855 (funcall gnus-summary-highlight-line-function article face))))
8858 (defun gnus-update-read-articles (group unread &optional compute)
8859 "Update the list of read articles in GROUP."
8860 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8861 (entry (gnus-gethash group gnus-newsrc-hashtb))
8862 (info (nth 2 entry))
8864 (unread (sort (copy-sequence unread) '<))
8866 (if (or (not info) (not active))
8867 ;; There is no info on this group if it was, in fact,
8868 ;; killed. Gnus stores no information on killed groups, so
8869 ;; there's nothing to be done.
8870 ;; One could store the information somewhere temporarily,
8871 ;; perhaps... Hmmm...
8873 ;; Remove any negative articles numbers.
8874 (while (and unread (< (car unread) 0))
8875 (setq unread (cdr unread)))
8876 ;; Remove any expired article numbers
8877 (while (and unread (< (car unread) (car active)))
8878 (setq unread (cdr unread)))
8879 ;; Compute the ranges of read articles by looking at the list of
8882 (when (/= (car unread) prev)
8883 (push (if (= prev (1- (car unread))) prev
8884 (cons prev (1- (car unread))))
8886 (setq prev (1+ (car unread)))
8887 (setq unread (cdr unread)))
8888 (when (<= prev (cdr active))
8889 (push (cons prev (cdr active)) read))
8891 (if (> (length read) 1) (nreverse read) read)
8893 (set-buffer gnus-group-buffer)
8896 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8897 (gnus-info-set-read ',info ',(gnus-info-read info))
8898 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8899 (gnus-group-update-group ,group t))))
8900 ;; Enter this list into the group info.
8902 info (if (> (length read) 1) (nreverse read) read))
8903 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8904 (gnus-get-unread-articles-in-group info (gnus-active group))
8907 (defun gnus-offer-save-summaries ()
8908 "Offer to save all active summary buffers."
8910 (let ((buflist (buffer-list))
8912 ;; Go through all buffers and find all summaries.
8914 (and (setq bufname (buffer-name (car buflist)))
8915 (string-match "Summary" bufname)
8917 (set-buffer bufname)
8918 ;; We check that this is, indeed, a summary buffer.
8919 (and (eq major-mode 'gnus-summary-mode)
8920 ;; Also make sure this isn't bogus.
8921 gnus-newsgroup-prepared
8922 ;; Also make sure that this isn't a dead summary buffer.
8923 (not gnus-dead-summary-mode)))
8924 (push bufname buffers))
8925 (setq buflist (cdr buflist)))
8926 ;; Go through all these summary buffers and offer to save them.
8929 "Update summary buffer %s? "
8930 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8934 ;;; @ for mime-partial
8937 (defun gnus-mime-partial-preview-function ()
8938 (gnus-summary-preview-mime-message (gnus-summary-article-number))
8941 (autoload 'mime-combine-message/partials-automatically
8943 "Internal method to combine message/partial messages automatically.")
8945 (set-atype 'mime-acting-condition
8946 '((type . "message/partial")
8947 (method . mime-combine-message/partials-automatically)
8948 (major-mode . gnus-original-article-mode)
8949 (summary-buffer-exp . gnus-summary-buffer)
8952 (set-alist 'mime-view-partial-message-method-alist
8953 'gnus-original-article-mode
8954 'gnus-mime-partial-preview-function)
8964 (run-hooks 'gnus-sum-load-hook)
8966 ;;; gnus-sum.el ends here