1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Katsumi Yamaoka <yamaoka@jpl.org>
7 ;; Keywords: mail, news, MIME
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
30 (eval-when-compile (require 'cl))
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
46 (defcustom gnus-kill-summary-on-exit t
47 "*If non-nil, kill the summary buffer when you exit from it.
48 If nil, the summary will become a \"*Dead Summary*\" buffer, and
49 it will be killed sometime later."
50 :group 'gnus-summary-exit
53 (defcustom gnus-fetch-old-headers nil
54 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
55 If an unread article in the group refers to an older, already read (or
56 just marked as read) article, the old article will not normally be
57 displayed in the Summary buffer. If this variable is non-nil, Gnus
58 will attempt to grab the headers to the old articles, and thereby
59 build complete threads. If it has the value `some', only enough
60 headers to connect otherwise loose threads will be displayed. This
61 variable can also be a number. In that case, no more than that number
62 of old headers will be fetched. If it has the value `invisible', all
63 old headers will be fetched, but none will be displayed.
65 The server has to support NOV for any of this to work."
67 :type '(choice (const :tag "off" nil)
70 (sexp :menu-tag "other" t)))
72 (defcustom gnus-refer-thread-limit 200
73 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
74 If t, fetch all the available old headers."
77 (sexp :menu-tag "other" t)))
79 (defcustom gnus-summary-make-false-root 'adopt
80 "*nil means that Gnus won't gather loose threads.
81 If the root of a thread has expired or been read in a previous
82 session, the information necessary to build a complete thread has been
83 lost. Instead of having many small sub-threads from this original thread
84 scattered all over the summary buffer, Gnus can gather them.
86 If non-nil, Gnus will try to gather all loose sub-threads from an
87 original thread into one large thread.
89 If this variable is non-nil, it should be one of `none', `adopt',
92 If this variable is `none', Gnus will not make a false root, but just
93 present the sub-threads after another.
94 If this variable is `dummy', Gnus will create a dummy root that will
95 have all the sub-threads as children.
96 If this variable is `adopt', Gnus will make one of the \"children\"
97 the parent and mark all the step-children as such.
98 If this variable is `empty', the \"children\" are printed with empty
99 subject fields. (Or rather, they will be printed with a string
100 given by the `gnus-summary-same-subject' variable.)"
102 :type '(choice (const :tag "off" nil)
108 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
109 "*A regexp to match subjects to be excluded from loose thread gathering.
110 As loose thread gathering is done on subjects only, that means that
111 there can be many false gatherings performed. By rooting out certain
112 common subjects, gathering might become saner."
116 (defcustom gnus-summary-gather-subject-limit nil
117 "*Maximum length of subject comparisons when gathering loose threads.
118 Use nil to compare full subjects. Setting this variable to a low
119 number will help gather threads that have been corrupted by
120 newsreaders chopping off subject lines, but it might also mean that
121 unrelated articles that have subject that happen to begin with the
122 same few characters will be incorrectly gathered.
124 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
127 :type '(choice (const :tag "off" nil)
129 (sexp :menu-tag "on" t)))
131 (defcustom gnus-simplify-subject-functions nil
132 "List of functions taking a string argument that simplify subjects.
133 The functions are applied recursively.
135 Useful functions to put in this list include: `gnus-simplify-subject-re',
136 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
138 :type '(repeat function))
140 (defcustom gnus-simplify-ignored-prefixes nil
141 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
143 :type '(choice (const :tag "off" nil)
146 (defcustom gnus-build-sparse-threads nil
147 "*If non-nil, fill in the gaps in threads.
148 If `some', only fill in the gaps that are needed to tie loose threads
149 together. If `more', fill in all leaf nodes that Gnus can find. If
150 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
152 :type '(choice (const :tag "off" nil)
155 (sexp :menu-tag "all" t)))
157 (defcustom gnus-summary-thread-gathering-function
158 'gnus-gather-threads-by-subject
159 "*Function used for gathering loose threads.
160 There are two pre-defined functions: `gnus-gather-threads-by-subject',
161 which only takes Subjects into consideration; and
162 `gnus-gather-threads-by-references', which compared the References
163 headers of the articles to find matches."
165 :type '(radio (function-item gnus-gather-threads-by-subject)
166 (function-item gnus-gather-threads-by-references)
167 (function :tag "other")))
169 (defcustom gnus-summary-same-subject ""
170 "*String indicating that the current article has the same subject as the previous.
171 This variable will only be used if the value of
172 `gnus-summary-make-false-root' is `empty'."
173 :group 'gnus-summary-format
176 (defcustom gnus-summary-goto-unread t
177 "*If t, marking commands will go to the next unread article.
178 If `never', commands that usually go to the next unread article, will
179 go to the next article, whether it is read or not.
180 If nil, only the marking commands will go to the next (un)read article."
181 :group 'gnus-summary-marks
182 :link '(custom-manual "(gnus)Setting Marks")
183 :type '(choice (const :tag "off" nil)
185 (sexp :menu-tag "on" t)))
187 (defcustom gnus-summary-default-score 0
188 "*Default article score level.
189 All scores generated by the score files will be added to this score.
190 If this variable is nil, scoring will be disabled."
191 :group 'gnus-score-default
192 :type '(choice (const :tag "disable")
195 (defcustom gnus-summary-zcore-fuzz 0
196 "*Fuzziness factor for the zcore in the summary buffer.
197 Articles with scores closer than this to `gnus-summary-default-score'
199 :group 'gnus-summary-format
202 (defcustom gnus-simplify-subject-fuzzy-regexp nil
203 "*Strings to be removed when doing fuzzy matches.
204 This can either be a regular expression or list of regular expressions
205 that will be removed from subject strings if fuzzy subject
206 simplification is selected."
208 :type '(repeat regexp))
210 (defcustom gnus-show-threads t
211 "*If non-nil, display threads in summary mode."
215 (defcustom gnus-thread-hide-subtree nil
216 "*If non-nil, hide all threads initially.
217 If threads are hidden, you have to run the command
218 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
219 to expose hidden threads."
223 (defcustom gnus-thread-hide-killed t
224 "*If non-nil, hide killed threads automatically."
228 (defcustom gnus-thread-ignore-subject t
229 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
230 If nil, articles that have different subjects from their parents will
231 start separate threads."
235 (defcustom gnus-thread-operation-ignore-subject t
236 "*If non-nil, subjects will be ignored when doing thread commands.
237 This affects commands like `gnus-summary-kill-thread' and
238 `gnus-summary-lower-thread'.
240 If this variable is nil, articles in the same thread with different
241 subjects will not be included in the operation in question. If this
242 variable is `fuzzy', only articles that have subjects that are fuzzily
243 equal will be included."
245 :type '(choice (const :tag "off" nil)
249 (defcustom gnus-thread-indent-level 4
250 "*Number that says how much each sub-thread should be indented."
254 (defcustom gnus-auto-extend-newsgroup t
255 "*If non-nil, extend newsgroup forward and backward when requested."
256 :group 'gnus-summary-choose
259 (defcustom gnus-auto-select-first t
260 "*If nil, don't select the first unread article when entering a group.
261 If this variable is `best', select the highest-scored unread article
262 in the group. If neither nil nor `best', select the first unread
265 If you want to prevent automatic selection of the first unread article
266 in some newsgroups, set the variable to nil in
267 `gnus-select-group-hook'."
268 :group 'gnus-group-select
269 :type '(choice (const :tag "none" nil)
271 (sexp :menu-tag "first" t)))
273 (defcustom gnus-auto-select-next t
274 "*If non-nil, offer to go to the next group from the end of the previous.
275 If the value is t and the next newsgroup is empty, Gnus will exit
276 summary mode and go back to group mode. If the value is neither nil
277 nor t, Gnus will select the following unread newsgroup. In
278 particular, if the value is the symbol `quietly', the next unread
279 newsgroup will be selected without any confirmation, and if it is
280 `almost-quietly', the next group will be selected without any
281 confirmation if you are located on the last article in the group.
282 Finally, if this variable is `slightly-quietly', the `Z n' command
283 will go to the next group without confirmation."
284 :group 'gnus-summary-maneuvering
285 :type '(choice (const :tag "off" nil)
287 (const almost-quietly)
288 (const slightly-quietly)
289 (sexp :menu-tag "on" t)))
291 (defcustom gnus-auto-select-same nil
292 "*If non-nil, select the next article with the same subject.
293 If there are no more articles with the same subject, go to
294 the first unread article."
295 :group 'gnus-summary-maneuvering
298 (defcustom gnus-summary-check-current nil
299 "*If non-nil, consider the current article when moving.
300 The \"unread\" movement commands will stay on the same line if the
301 current article is unread."
302 :group 'gnus-summary-maneuvering
305 (defcustom gnus-auto-center-summary t
306 "*If non-nil, always center the current summary buffer.
307 In particular, if `vertical' do only vertical recentering. If non-nil
308 and non-`vertical', do both horizontal and vertical recentering."
309 :group 'gnus-summary-maneuvering
310 :type '(choice (const :tag "none" nil)
312 (sexp :menu-tag "both" t)))
314 (defcustom gnus-show-all-headers nil
315 "*If non-nil, don't hide any headers."
316 :group 'gnus-article-hiding
317 :group 'gnus-article-headers
320 (defcustom gnus-summary-ignore-duplicates nil
321 "*If non-nil, ignore articles with identical Message-ID headers."
325 (defcustom gnus-single-article-buffer t
326 "*If non-nil, display all articles in the same buffer.
327 If nil, each group will get its own article buffer."
328 :group 'gnus-article-various
331 (defcustom gnus-break-pages t
332 "*If non-nil, do page breaking on articles.
333 The page delimiter is specified by the `gnus-page-delimiter'
335 :group 'gnus-article-various
338 (defcustom gnus-show-mime t
339 "*If non-nil, do mime processing of articles.
340 The articles will simply be fed to the function given by
341 `gnus-show-mime-method'."
342 :group 'gnus-article-mime
345 (defcustom gnus-move-split-methods nil
346 "*Variable used to suggest where articles are to be moved to.
347 It uses the same syntax as the `gnus-split-methods' variable."
348 :group 'gnus-summary-mail
349 :type '(repeat (choice (list :value (fun) function)
350 (cons :value ("" "") regexp (repeat string))
353 (defcustom gnus-unread-mark ?
354 "*Mark used for unread articles."
355 :group 'gnus-summary-marks
358 (defcustom gnus-ticked-mark ?!
359 "*Mark used for ticked articles."
360 :group 'gnus-summary-marks
363 (defcustom gnus-dormant-mark ??
364 "*Mark used for dormant articles."
365 :group 'gnus-summary-marks
368 (defcustom gnus-del-mark ?r
369 "*Mark used for del'd articles."
370 :group 'gnus-summary-marks
373 (defcustom gnus-read-mark ?R
374 "*Mark used for read articles."
375 :group 'gnus-summary-marks
378 (defcustom gnus-expirable-mark ?E
379 "*Mark used for expirable articles."
380 :group 'gnus-summary-marks
383 (defcustom gnus-killed-mark ?K
384 "*Mark used for killed articles."
385 :group 'gnus-summary-marks
388 (defcustom gnus-souped-mark ?F
389 "*Mark used for killed articles."
390 :group 'gnus-summary-marks
393 (defcustom gnus-kill-file-mark ?X
394 "*Mark used for articles killed by kill files."
395 :group 'gnus-summary-marks
398 (defcustom gnus-low-score-mark ?Y
399 "*Mark used for articles with a low score."
400 :group 'gnus-summary-marks
403 (defcustom gnus-catchup-mark ?C
404 "*Mark used for articles that are caught up."
405 :group 'gnus-summary-marks
408 (defcustom gnus-replied-mark ?A
409 "*Mark used for articles that have been replied to."
410 :group 'gnus-summary-marks
413 (defcustom gnus-cached-mark ?*
414 "*Mark used for articles that are in the cache."
415 :group 'gnus-summary-marks
418 (defcustom gnus-saved-mark ?S
419 "*Mark used for articles that have been saved to."
420 :group 'gnus-summary-marks
423 (defcustom gnus-ancient-mark ?O
424 "*Mark used for ancient articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-sparse-mark ?Q
429 "*Mark used for sparsely reffed articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-canceled-mark ?G
434 "*Mark used for canceled articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-duplicate-mark ?M
439 "*Mark used for duplicate articles."
440 :group 'gnus-summary-marks
443 (defcustom gnus-undownloaded-mark ?@
444 "*Mark used for articles that weren't downloaded."
445 :group 'gnus-summary-marks
448 (defcustom gnus-downloadable-mark ?%
449 "*Mark used for articles that are to be downloaded."
450 :group 'gnus-summary-marks
453 (defcustom gnus-unsendable-mark ?=
454 "*Mark used for articles that won't be sent."
455 :group 'gnus-summary-marks
458 (defcustom gnus-score-over-mark ?+
459 "*Score mark used for articles with high scores."
460 :group 'gnus-summary-marks
463 (defcustom gnus-score-below-mark ?-
464 "*Score mark used for articles with low scores."
465 :group 'gnus-summary-marks
468 (defcustom gnus-empty-thread-mark ?
469 "*There is no thread under the article."
470 :group 'gnus-summary-marks
473 (defcustom gnus-not-empty-thread-mark ?=
474 "*There is a thread under the article."
475 :group 'gnus-summary-marks
478 (defcustom gnus-view-pseudo-asynchronously nil
479 "*If non-nil, Gnus will view pseudo-articles asynchronously."
480 :group 'gnus-extract-view
483 (defcustom gnus-view-pseudos nil
484 "*If `automatic', pseudo-articles will be viewed automatically.
485 If `not-confirm', pseudos will be viewed automatically, and the user
486 will not be asked to confirm the command."
487 :group 'gnus-extract-view
488 :type '(choice (const :tag "off" nil)
490 (const not-confirm)))
492 (defcustom gnus-view-pseudos-separately t
493 "*If non-nil, one pseudo-article will be created for each file to be viewed.
494 If nil, all files that use the same viewing command will be given as a
495 list of parameters to that command."
496 :group 'gnus-extract-view
499 (defcustom gnus-insert-pseudo-articles t
500 "*If non-nil, insert pseudo-articles when decoding articles."
501 :group 'gnus-extract-view
504 (defcustom gnus-summary-dummy-line-format
506 "*The format specification for the dummy roots in the summary buffer.
507 It works along the same lines as a normal formatting string,
508 with some simple extensions.
511 :group 'gnus-threading
514 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
515 "*The format specification for the summary mode line.
516 It works along the same lines as a normal formatting string,
517 with some simple extensions:
520 %p Unprefixed group name
521 %A Current article number
522 %z Current article score
524 %U Number of unread articles in the group
525 %e Number of unselected articles in the group
526 %Z A string with unread/unselected article counts
527 %g Shortish group name
528 %S Subject of the current article
530 %s Current score file name
531 %d Number of dormant articles
532 %r Number of articles that have been marked as read in this session
533 %E Number of articles expunged by the score files"
534 :group 'gnus-summary-format
537 (defcustom gnus-summary-mark-below 0
538 "*Mark all articles with a score below this variable as read.
539 This variable is local to each summary buffer and usually set by the
541 :group 'gnus-score-default
544 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
545 "*List of functions used for sorting articles in the summary buffer.
546 This variable is only used when not using a threaded display."
547 :group 'gnus-summary-sort
548 :type '(repeat (choice (function-item gnus-article-sort-by-number)
549 (function-item gnus-article-sort-by-author)
550 (function-item gnus-article-sort-by-subject)
551 (function-item gnus-article-sort-by-date)
552 (function-item gnus-article-sort-by-score)
553 (function :tag "other"))))
555 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
556 "*List of functions used for sorting threads in the summary buffer.
557 By default, threads are sorted by article number.
559 Each function takes two threads and return non-nil if the first thread
560 should be sorted before the other. If you use more than one function,
561 the primary sort function should be the last. You should probably
562 always include `gnus-thread-sort-by-number' in the list of sorting
563 functions -- preferably first.
565 Ready-made functions include `gnus-thread-sort-by-number',
566 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
567 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
568 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
569 :group 'gnus-summary-sort
570 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
571 (function-item gnus-thread-sort-by-author)
572 (function-item gnus-thread-sort-by-subject)
573 (function-item gnus-thread-sort-by-date)
574 (function-item gnus-thread-sort-by-score)
575 (function-item gnus-thread-sort-by-total-score)
576 (function :tag "other"))))
578 (defcustom gnus-thread-score-function '+
579 "*Function used for calculating the total score of a thread.
581 The function is called with the scores of the article and each
582 subthread and should then return the score of the thread.
584 Some functions you can use are `+', `max', or `min'."
585 :group 'gnus-summary-sort
588 (defcustom gnus-summary-expunge-below nil
589 "All articles that have a score less than this variable will be expunged.
590 This variable is local to the summary buffers."
591 :group 'gnus-score-default
592 :type '(choice (const :tag "off" nil)
595 (defcustom gnus-thread-expunge-below nil
596 "All threads that have a total score less than this variable will be expunged.
597 See `gnus-thread-score-function' for en explanation of what a
600 This variable is local to the summary buffers."
601 :group 'gnus-treading
602 :group 'gnus-score-default
603 :type '(choice (const :tag "off" nil)
606 (defcustom gnus-summary-mode-hook nil
607 "*A hook for Gnus summary mode.
608 This hook is run before any variables are set in the summary buffer."
609 :group 'gnus-summary-various
612 (defcustom gnus-summary-menu-hook nil
613 "*Hook run after the creation of the summary mode menu."
614 :group 'gnus-summary-visual
617 (defcustom gnus-summary-exit-hook nil
618 "*A hook called on exit from the summary buffer.
619 It will be called with point in the group buffer."
620 :group 'gnus-summary-exit
623 (defcustom gnus-summary-prepare-hook nil
624 "*A hook called after the summary buffer has been generated.
625 If you want to modify the summary buffer, you can use this hook."
626 :group 'gnus-summary-various
629 (defcustom gnus-summary-prepared-hook nil
630 "*A hook called as the last thing after the summary buffer has been generated."
631 :group 'gnus-summary-various
634 (defcustom gnus-summary-generate-hook nil
635 "*A hook run just before generating the summary buffer.
636 This hook is commonly used to customize threading variables and the
638 :group 'gnus-summary-various
641 (defcustom gnus-select-group-hook nil
642 "*A hook called when a newsgroup is selected.
644 If you'd like to simplify subjects like the
645 `gnus-summary-next-same-subject' command does, you can use the
648 (setq gnus-select-group-hook
651 (mapcar (lambda (header)
652 (mail-header-set-subject
654 (gnus-simplify-subject
655 (mail-header-subject header) 're-only)))
656 gnus-newsgroup-headers))))"
657 :group 'gnus-group-select
660 (defcustom gnus-select-article-hook nil
661 "*A hook called when an article is selected."
662 :group 'gnus-summary-choose
665 (defcustom gnus-visual-mark-article-hook
666 (list 'gnus-highlight-selected-summary)
667 "*Hook run after selecting an article in the summary buffer.
668 It is meant to be used for highlighting the article in some way. It
669 is not run if `gnus-visual' is nil."
670 :group 'gnus-summary-visual
673 (defcustom gnus-parse-headers-hook
674 '(gnus-set-summary-default-charset)
675 "*A hook called before parsing the headers."
679 (defcustom gnus-exit-group-hook nil
680 "*A hook called when exiting (not quitting) summary mode."
684 (defcustom gnus-summary-update-hook
685 (list 'gnus-summary-highlight-line)
686 "*A hook called when a summary line is changed.
687 The hook will not be called if `gnus-visual' is nil.
689 The default function `gnus-summary-highlight-line' will
690 highlight the line according to the `gnus-summary-highlight'
692 :group 'gnus-summary-visual
695 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
696 "*A hook called when an article is selected for the first time.
697 The hook is intended to mark an article as read (or unread)
698 automatically when it is selected."
699 :group 'gnus-summary-choose
702 (defcustom gnus-group-no-more-groups-hook nil
703 "*A hook run when returning to group mode having no more (unread) groups."
704 :group 'gnus-group-select
707 (defcustom gnus-ps-print-hook nil
708 "*A hook run before ps-printing something from Gnus."
712 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
713 "Face used for highlighting the current article in the summary buffer."
714 :group 'gnus-summary-visual
717 (defcustom gnus-summary-highlight
718 '(((= mark gnus-canceled-mark)
719 . gnus-summary-cancelled-face)
720 ((and (> score default)
721 (or (= mark gnus-dormant-mark)
722 (= mark gnus-ticked-mark)))
723 . gnus-summary-high-ticked-face)
724 ((and (< score default)
725 (or (= mark gnus-dormant-mark)
726 (= mark gnus-ticked-mark)))
727 . gnus-summary-low-ticked-face)
728 ((or (= mark gnus-dormant-mark)
729 (= mark gnus-ticked-mark))
730 . gnus-summary-normal-ticked-face)
731 ((and (> score default) (= mark gnus-ancient-mark))
732 . gnus-summary-high-ancient-face)
733 ((and (< score default) (= mark gnus-ancient-mark))
734 . gnus-summary-low-ancient-face)
735 ((= mark gnus-ancient-mark)
736 . gnus-summary-normal-ancient-face)
737 ((and (> score default) (= mark gnus-unread-mark))
738 . gnus-summary-high-unread-face)
739 ((and (< score default) (= mark gnus-unread-mark))
740 . gnus-summary-low-unread-face)
741 ((= mark gnus-unread-mark)
742 . gnus-summary-normal-unread-face)
743 ((and (> score default) (memq mark (list gnus-downloadable-mark
744 gnus-undownloaded-mark)))
745 . gnus-summary-high-unread-face)
746 ((and (< score default) (memq mark (list gnus-downloadable-mark
747 gnus-undownloaded-mark)))
748 . gnus-summary-low-unread-face)
749 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
750 . gnus-summary-normal-unread-face)
752 . gnus-summary-high-read-face)
754 . gnus-summary-low-read-face)
756 . gnus-summary-normal-read-face))
757 "*Controls the highlighting of summary buffer lines.
759 A list of (FORM . FACE) pairs. When deciding how a a particular
760 summary line should be displayed, each form is evaluated. The content
761 of the face field after the first true form is used. You can change
762 how those summary lines are displayed, by editing the face field.
764 You can use the following variables in the FORM field.
766 score: The articles score
767 default: The default article score.
768 below: The score below which articles are automatically marked as read.
769 mark: The articles mark."
770 :group 'gnus-summary-visual
771 :type '(repeat (cons (sexp :tag "Form" nil)
774 (defcustom gnus-alter-header-function nil
775 "Function called to allow alteration of article header structures.
776 The function is called with one parameter, the article header vector,
777 which it may alter in any way.")
779 ;;; Internal variables
781 (defvar gnus-scores-exclude-files nil)
782 (defvar gnus-page-broken nil)
784 (defvar gnus-original-article nil)
785 (defvar gnus-article-internal-prepare-hook nil)
786 (defvar gnus-newsgroup-process-stack nil)
788 (defvar gnus-thread-indent-array nil)
789 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
791 ;; Avoid highlighting in kill files.
792 (defvar gnus-summary-inhibit-highlight nil)
793 (defvar gnus-newsgroup-selected-overlay nil)
794 (defvar gnus-inhibit-limiting nil)
795 (defvar gnus-newsgroup-adaptive-score-file nil)
796 (defvar gnus-current-score-file nil)
797 (defvar gnus-current-move-group nil)
798 (defvar gnus-current-copy-group nil)
799 (defvar gnus-current-crosspost-group nil)
801 (defvar gnus-newsgroup-dependencies nil)
802 (defvar gnus-newsgroup-adaptive nil)
803 (defvar gnus-summary-display-article-function nil)
804 (defvar gnus-summary-highlight-line-function nil
805 "Function called after highlighting a summary line.")
807 (defvar gnus-summary-line-format-alist
808 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
809 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
810 (?s gnus-tmp-subject-or-nil ?s)
811 (?n gnus-tmp-name ?s)
812 (?A (std11-address-string
813 (car (mime-read-field 'From gnus-tmp-header))) ?s)
814 (?a (or (std11-full-name-string
815 (car (mime-read-field 'From gnus-tmp-header)))
817 (?F gnus-tmp-from ?s)
818 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
819 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
820 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
821 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
822 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
823 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
824 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
825 (?L gnus-tmp-lines ?d)
826 (?I gnus-tmp-indentation ?s)
827 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
828 (?R gnus-tmp-replied ?c)
829 (?\[ gnus-tmp-opening-bracket ?c)
830 (?\] gnus-tmp-closing-bracket ?c)
831 (?\> (make-string gnus-tmp-level ? ) ?s)
832 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
833 (?i gnus-tmp-score ?d)
834 (?z gnus-tmp-score-char ?c)
835 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
836 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
837 (?U gnus-tmp-unread ?c)
838 (?t (gnus-summary-number-of-articles-in-thread
839 (and (boundp 'thread) (car thread)) gnus-tmp-level)
841 (?e (gnus-summary-number-of-articles-in-thread
842 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
844 (?u gnus-tmp-user-defined ?s)
845 (?P (gnus-pick-line-number) ?d))
846 "An alist of format specifications that can appear in summary lines,
847 and what variables they correspond with, along with the type of the
848 variable (string, integer, character, etc).")
850 (defvar gnus-summary-dummy-line-format-alist
851 `((?S gnus-tmp-subject ?s)
852 (?N gnus-tmp-number ?d)
853 (?u gnus-tmp-user-defined ?s)))
855 (defvar gnus-summary-mode-line-format-alist
856 `((?G gnus-tmp-group-name ?s)
857 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
858 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
859 (?A gnus-tmp-article-number ?d)
860 (?Z gnus-tmp-unread-and-unselected ?s)
862 (?U gnus-tmp-unread-and-unticked ?d)
863 (?S gnus-tmp-subject ?s)
864 (?e gnus-tmp-unselected ?d)
865 (?u gnus-tmp-user-defined ?s)
866 (?d (length gnus-newsgroup-dormant) ?d)
867 (?t (length gnus-newsgroup-marked) ?d)
868 (?r (length gnus-newsgroup-reads) ?d)
869 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
870 (?E gnus-newsgroup-expunged-tally ?d)
871 (?s (gnus-current-score-file-nondirectory) ?s)))
873 (defvar gnus-last-search-regexp nil
874 "Default regexp for article search command.")
876 (defvar gnus-last-shell-command nil
877 "Default shell command on article.")
879 (defvar gnus-newsgroup-begin nil)
880 (defvar gnus-newsgroup-end nil)
881 (defvar gnus-newsgroup-last-rmail nil)
882 (defvar gnus-newsgroup-last-mail nil)
883 (defvar gnus-newsgroup-last-folder nil)
884 (defvar gnus-newsgroup-last-file nil)
885 (defvar gnus-newsgroup-auto-expire nil)
886 (defvar gnus-newsgroup-active nil)
888 (defvar gnus-newsgroup-data nil)
889 (defvar gnus-newsgroup-data-reverse nil)
890 (defvar gnus-newsgroup-limit nil)
891 (defvar gnus-newsgroup-limits nil)
893 (defvar gnus-newsgroup-unreads nil
894 "List of unread articles in the current newsgroup.")
896 (defvar gnus-newsgroup-unselected nil
897 "List of unselected unread articles in the current newsgroup.")
899 (defvar gnus-newsgroup-reads nil
900 "Alist of read articles and article marks in the current newsgroup.")
902 (defvar gnus-newsgroup-expunged-tally nil)
904 (defvar gnus-newsgroup-marked nil
905 "List of ticked articles in the current newsgroup (a subset of unread art).")
907 (defvar gnus-newsgroup-killed nil
908 "List of ranges of articles that have been through the scoring process.")
910 (defvar gnus-newsgroup-cached nil
911 "List of articles that come from the article cache.")
913 (defvar gnus-newsgroup-saved nil
914 "List of articles that have been saved.")
916 (defvar gnus-newsgroup-kill-headers nil)
918 (defvar gnus-newsgroup-replied nil
919 "List of articles that have been replied to in the current newsgroup.")
921 (defvar gnus-newsgroup-expirable nil
922 "List of articles in the current newsgroup that can be expired.")
924 (defvar gnus-newsgroup-processable nil
925 "List of articles in the current newsgroup that can be processed.")
927 (defvar gnus-newsgroup-downloadable nil
928 "List of articles in the current newsgroup that can be processed.")
930 (defvar gnus-newsgroup-undownloaded nil
931 "List of articles in the current newsgroup that haven't been downloaded..")
933 (defvar gnus-newsgroup-unsendable nil
934 "List of articles in the current newsgroup that won't be sent.")
936 (defvar gnus-newsgroup-bookmarks nil
937 "List of articles in the current newsgroup that have bookmarks.")
939 (defvar gnus-newsgroup-dormant nil
940 "List of dormant articles in the current newsgroup.")
942 (defvar gnus-newsgroup-scored nil
943 "List of scored articles in the current newsgroup.")
945 (defvar gnus-newsgroup-headers nil
946 "List of article headers in the current newsgroup.")
948 (defvar gnus-newsgroup-threads nil)
950 (defvar gnus-newsgroup-prepared nil
951 "Whether the current group has been prepared properly.")
953 (defvar gnus-newsgroup-ancient nil
954 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
956 (defvar gnus-newsgroup-sparse nil)
958 (defvar gnus-current-article nil)
959 (defvar gnus-article-current nil)
960 (defvar gnus-current-headers nil)
961 (defvar gnus-have-all-headers nil)
962 (defvar gnus-last-article nil)
963 (defvar gnus-newsgroup-history nil)
965 (defconst gnus-summary-local-variables
966 '(gnus-newsgroup-name
967 gnus-newsgroup-begin gnus-newsgroup-end
968 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
969 gnus-newsgroup-last-folder gnus-newsgroup-last-file
970 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
971 gnus-newsgroup-unselected gnus-newsgroup-marked
972 gnus-newsgroup-reads gnus-newsgroup-saved
973 gnus-newsgroup-replied gnus-newsgroup-expirable
974 gnus-newsgroup-processable gnus-newsgroup-killed
975 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
976 gnus-newsgroup-unsendable
977 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
978 gnus-newsgroup-headers gnus-newsgroup-threads
979 gnus-newsgroup-prepared gnus-summary-highlight-line-function
980 gnus-current-article gnus-current-headers gnus-have-all-headers
981 gnus-last-article gnus-article-internal-prepare-hook
982 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
983 gnus-newsgroup-scored gnus-newsgroup-kill-headers
984 gnus-thread-expunge-below
985 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
986 (gnus-summary-mark-below . global)
987 gnus-newsgroup-active gnus-scores-exclude-files
988 gnus-newsgroup-history gnus-newsgroup-ancient
989 gnus-newsgroup-sparse gnus-newsgroup-process-stack
990 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
991 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
992 (gnus-newsgroup-expunged-tally . 0)
993 gnus-cache-removable-articles gnus-newsgroup-cached
994 gnus-newsgroup-data gnus-newsgroup-data-reverse
995 gnus-newsgroup-limit gnus-newsgroup-limits)
996 "Variables that are buffer-local to the summary buffers.")
998 ;; Byte-compiler warning.
999 (defvar gnus-article-mode-map)
1001 ;; Subject simplification.
1003 (defun gnus-simplify-whitespace (str)
1004 "Remove excessive whitespace."
1007 (while (string-match "[ \t][ \t]+" mystr)
1008 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1010 (substring mystr (match-end 0)))))
1012 (when (string-match "^[ \t]+" mystr)
1013 (setq mystr (substring mystr (match-end 0))))
1015 (when (string-match "[ \t]+$" mystr)
1016 (setq mystr (substring mystr 0 (match-beginning 0))))
1019 (defsubst gnus-simplify-subject-re (subject)
1020 "Remove \"Re:\" from subject lines."
1021 (if (string-match "^[Rr][Ee]: *" subject)
1022 (substring subject (match-end 0))
1025 (defun gnus-simplify-subject (subject &optional re-only)
1026 "Remove `Re:' and words in parentheses.
1027 If RE-ONLY is non-nil, strip leading `Re:'s only."
1028 (let ((case-fold-search t)) ;Ignore case.
1029 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1030 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1031 (setq subject (substring subject (match-end 0))))
1032 ;; Remove uninteresting prefixes.
1033 (when (and (not re-only)
1034 gnus-simplify-ignored-prefixes
1035 (string-match gnus-simplify-ignored-prefixes subject))
1036 (setq subject (substring subject (match-end 0))))
1037 ;; Remove words in parentheses from end.
1039 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1040 (setq subject (substring subject 0 (match-beginning 0)))))
1041 ;; Return subject string.
1044 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1046 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1047 (goto-char (point-min))
1048 (while (re-search-forward regexp nil t)
1049 (replace-match (or newtext ""))))
1051 (defun gnus-simplify-buffer-fuzzy ()
1052 "Simplify string in the buffer fuzzily.
1053 The string in the accessible portion of the current buffer is simplified.
1054 It is assumed to be a single-line subject.
1055 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1056 matter is removed. Additional things can be deleted by setting
1057 gnus-simplify-subject-fuzzy-regexp."
1058 (let ((case-fold-search t)
1060 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1062 (while (not (eq modified-tick (buffer-modified-tick)))
1063 (setq modified-tick (buffer-modified-tick))
1065 ((listp gnus-simplify-subject-fuzzy-regexp)
1066 (mapcar 'gnus-simplify-buffer-fuzzy-step
1067 gnus-simplify-subject-fuzzy-regexp))
1068 (gnus-simplify-subject-fuzzy-regexp
1069 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1070 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1071 (gnus-simplify-buffer-fuzzy-step
1072 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1073 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1074 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1075 (goto-char (point-min))
1076 (while (re-search-forward " +" nil t)
1077 (delete-region (match-beginning 0) (match-end 0))
1079 (> (char-after) 127) (> (char-before) 127)
1082 (defun gnus-simplify-subject-fuzzy (subject)
1083 "Simplify a subject string fuzzily.
1084 See `gnus-simplify-buffer-fuzzy' for details."
1085 (let ((case-fold-search t)
1086 ;; Save group parameter.
1087 (fuzzy-regexp gnus-simplify-subject-fuzzy-regexp))
1088 ;; Remove uninteresting prefixes.
1089 (when (and gnus-simplify-ignored-prefixes
1090 (string-match gnus-simplify-ignored-prefixes subject))
1091 (setq subject (substring subject (match-end 0))))
1093 (gnus-set-work-buffer)
1095 (let ((gnus-simplify-subject-fuzzy-regexp fuzzy-regexp))
1096 (inline (gnus-simplify-buffer-fuzzy)))
1099 (defsubst gnus-simplify-subject-fully (subject)
1100 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1102 (gnus-simplify-subject-functions
1103 (gnus-map-function gnus-simplify-subject-functions subject))
1104 ((null gnus-summary-gather-subject-limit)
1105 (gnus-simplify-subject-re subject))
1106 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1107 (gnus-simplify-subject-fuzzy subject))
1108 ((numberp gnus-summary-gather-subject-limit)
1109 (gnus-limit-string (gnus-simplify-subject-re subject)
1110 gnus-summary-gather-subject-limit))
1114 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1115 "Check whether two subjects are equal.
1116 If optional argument simple-first is t, first argument is already
1119 ((null simple-first)
1120 (equal (gnus-simplify-subject-fully s1)
1121 (gnus-simplify-subject-fully s2)))
1124 (gnus-simplify-subject-fully s2)))))
1126 (defun gnus-summary-bubble-group ()
1127 "Increase the score of the current group.
1128 This is a handy function to add to `gnus-summary-exit-hook' to
1129 increase the score of each group you read."
1130 (gnus-group-add-score gnus-newsgroup-name))
1134 ;;; Gnus summary mode
1137 (put 'gnus-summary-mode 'mode-class 'special)
1140 ;; Non-orthogonal keys
1142 (gnus-define-keys gnus-summary-mode-map
1143 " " gnus-summary-next-page
1144 "\177" gnus-summary-prev-page
1145 [delete] gnus-summary-prev-page
1146 [backspace] gnus-summary-prev-page
1147 "\r" gnus-summary-scroll-up
1148 "\M-\r" gnus-summary-scroll-down
1149 "n" gnus-summary-next-unread-article
1150 "p" gnus-summary-prev-unread-article
1151 "N" gnus-summary-next-article
1152 "P" gnus-summary-prev-article
1153 "\M-\C-n" gnus-summary-next-same-subject
1154 "\M-\C-p" gnus-summary-prev-same-subject
1155 "\M-n" gnus-summary-next-unread-subject
1156 "\M-p" gnus-summary-prev-unread-subject
1157 "." gnus-summary-first-unread-article
1158 "," gnus-summary-best-unread-article
1159 "\M-s" gnus-summary-search-article-forward
1160 "\M-r" gnus-summary-search-article-backward
1161 "<" gnus-summary-beginning-of-article
1162 ">" gnus-summary-end-of-article
1163 "j" gnus-summary-goto-article
1164 "^" gnus-summary-refer-parent-article
1165 "\M-^" gnus-summary-refer-article
1166 "u" gnus-summary-tick-article-forward
1167 "!" gnus-summary-tick-article-forward
1168 "U" gnus-summary-tick-article-backward
1169 "d" gnus-summary-mark-as-read-forward
1170 "D" gnus-summary-mark-as-read-backward
1171 "E" gnus-summary-mark-as-expirable
1172 "\M-u" gnus-summary-clear-mark-forward
1173 "\M-U" gnus-summary-clear-mark-backward
1174 "k" gnus-summary-kill-same-subject-and-select
1175 "\C-k" gnus-summary-kill-same-subject
1176 "\M-\C-k" gnus-summary-kill-thread
1177 "\M-\C-l" gnus-summary-lower-thread
1178 "e" gnus-summary-edit-article
1179 "#" gnus-summary-mark-as-processable
1180 "\M-#" gnus-summary-unmark-as-processable
1181 "\M-\C-t" gnus-summary-toggle-threads
1182 "\M-\C-s" gnus-summary-show-thread
1183 "\M-\C-h" gnus-summary-hide-thread
1184 "\M-\C-f" gnus-summary-next-thread
1185 "\M-\C-b" gnus-summary-prev-thread
1186 "\M-\C-u" gnus-summary-up-thread
1187 "\M-\C-d" gnus-summary-down-thread
1188 "&" gnus-summary-execute-command
1189 "c" gnus-summary-catchup-and-exit
1190 "\C-w" gnus-summary-mark-region-as-read
1191 "\C-t" gnus-summary-toggle-truncation
1192 "?" gnus-summary-mark-as-dormant
1193 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1194 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1195 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1196 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1197 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1198 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1199 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1200 "=" gnus-summary-expand-window
1201 "\C-x\C-s" gnus-summary-reselect-current-group
1202 "\M-g" gnus-summary-rescan-group
1203 "w" gnus-summary-stop-page-breaking
1204 "\C-c\C-r" gnus-summary-caesar-message
1205 "\M-t" gnus-summary-toggle-mime
1206 "f" gnus-summary-followup
1207 "F" gnus-summary-followup-with-original
1208 "C" gnus-summary-cancel-article
1209 "r" gnus-summary-reply
1210 "R" gnus-summary-reply-with-original
1211 "\C-c\C-f" gnus-summary-mail-forward
1212 "o" gnus-summary-save-article
1213 "\C-o" gnus-summary-save-article-mail
1214 "|" gnus-summary-pipe-output
1215 "\M-k" gnus-summary-edit-local-kill
1216 "\M-K" gnus-summary-edit-global-kill
1218 "\C-c\C-d" gnus-summary-describe-group
1219 "q" gnus-summary-exit
1220 "Q" gnus-summary-exit-no-update
1221 "\C-c\C-i" gnus-info-find-node
1222 gnus-mouse-2 gnus-mouse-pick-article
1223 "m" gnus-summary-mail-other-window
1224 "a" gnus-summary-post-news
1225 "x" gnus-summary-limit-to-unread
1226 "s" gnus-summary-isearch-article
1227 "t" gnus-article-hide-headers
1228 "g" gnus-summary-show-article
1229 "l" gnus-summary-goto-last-article
1230 "v" gnus-summary-preview-mime-message
1231 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1232 "\C-d" gnus-summary-enter-digest-group
1233 "\M-\C-d" gnus-summary-read-document
1234 "\M-\C-e" gnus-summary-edit-parameters
1236 "*" gnus-cache-enter-article
1237 "\M-*" gnus-cache-remove-article
1238 "\M-&" gnus-summary-universal-argument
1239 "\C-l" gnus-recenter
1240 "I" gnus-summary-increase-score
1241 "L" gnus-summary-lower-score
1242 "\M-i" gnus-symbolic-argument
1243 "h" gnus-summary-select-article-buffer
1245 "V" gnus-summary-score-map
1246 "X" gnus-uu-extract-map
1247 "S" gnus-summary-send-map)
1249 ;; Sort of orthogonal keymap
1250 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1251 "t" gnus-summary-tick-article-forward
1252 "!" gnus-summary-tick-article-forward
1253 "d" gnus-summary-mark-as-read-forward
1254 "r" gnus-summary-mark-as-read-forward
1255 "c" gnus-summary-clear-mark-forward
1256 " " gnus-summary-clear-mark-forward
1257 "e" gnus-summary-mark-as-expirable
1258 "x" gnus-summary-mark-as-expirable
1259 "?" gnus-summary-mark-as-dormant
1260 "b" gnus-summary-set-bookmark
1261 "B" gnus-summary-remove-bookmark
1262 "#" gnus-summary-mark-as-processable
1263 "\M-#" gnus-summary-unmark-as-processable
1264 "S" gnus-summary-limit-include-expunged
1265 "C" gnus-summary-catchup
1266 "H" gnus-summary-catchup-to-here
1267 "\C-c" gnus-summary-catchup-all
1268 "k" gnus-summary-kill-same-subject-and-select
1269 "K" gnus-summary-kill-same-subject
1270 "P" gnus-uu-mark-map)
1272 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1273 "c" gnus-summary-clear-above
1274 "u" gnus-summary-tick-above
1275 "m" gnus-summary-mark-above
1276 "k" gnus-summary-kill-below)
1278 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1279 "/" gnus-summary-limit-to-subject
1280 "n" gnus-summary-limit-to-articles
1281 "w" gnus-summary-pop-limit
1282 "s" gnus-summary-limit-to-subject
1283 "a" gnus-summary-limit-to-author
1284 "u" gnus-summary-limit-to-unread
1285 "m" gnus-summary-limit-to-marks
1286 "v" gnus-summary-limit-to-score
1287 "*" gnus-summary-limit-include-cached
1288 "D" gnus-summary-limit-include-dormant
1289 "T" gnus-summary-limit-include-thread
1290 "d" gnus-summary-limit-exclude-dormant
1291 "t" gnus-summary-limit-to-age
1292 "E" gnus-summary-limit-include-expunged
1293 "c" gnus-summary-limit-exclude-childless-dormant
1294 "C" gnus-summary-limit-mark-excluded-as-read)
1296 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1297 "n" gnus-summary-next-unread-article
1298 "p" gnus-summary-prev-unread-article
1299 "N" gnus-summary-next-article
1300 "P" gnus-summary-prev-article
1301 "\C-n" gnus-summary-next-same-subject
1302 "\C-p" gnus-summary-prev-same-subject
1303 "\M-n" gnus-summary-next-unread-subject
1304 "\M-p" gnus-summary-prev-unread-subject
1305 "f" gnus-summary-first-unread-article
1306 "b" gnus-summary-best-unread-article
1307 "j" gnus-summary-goto-article
1308 "g" gnus-summary-goto-subject
1309 "l" gnus-summary-goto-last-article
1310 "o" gnus-summary-pop-article)
1312 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1313 "k" gnus-summary-kill-thread
1314 "l" gnus-summary-lower-thread
1315 "i" gnus-summary-raise-thread
1316 "T" gnus-summary-toggle-threads
1317 "t" gnus-summary-rethread-current
1318 "^" gnus-summary-reparent-thread
1319 "s" gnus-summary-show-thread
1320 "S" gnus-summary-show-all-threads
1321 "h" gnus-summary-hide-thread
1322 "H" gnus-summary-hide-all-threads
1323 "n" gnus-summary-next-thread
1324 "p" gnus-summary-prev-thread
1325 "u" gnus-summary-up-thread
1326 "o" gnus-summary-top-thread
1327 "d" gnus-summary-down-thread
1328 "#" gnus-uu-mark-thread
1329 "\M-#" gnus-uu-unmark-thread)
1331 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1332 "g" gnus-summary-prepare
1333 "c" gnus-summary-insert-cached-articles)
1335 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1336 "c" gnus-summary-catchup-and-exit
1337 "C" gnus-summary-catchup-all-and-exit
1338 "E" gnus-summary-exit-no-update
1339 "Q" gnus-summary-exit
1340 "Z" gnus-summary-exit
1341 "n" gnus-summary-catchup-and-goto-next-group
1342 "R" gnus-summary-reselect-current-group
1343 "G" gnus-summary-rescan-group
1344 "N" gnus-summary-next-group
1345 "s" gnus-summary-save-newsrc
1346 "P" gnus-summary-prev-group)
1348 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1349 " " gnus-summary-next-page
1350 "n" gnus-summary-next-page
1351 "\177" gnus-summary-prev-page
1352 [delete] gnus-summary-prev-page
1353 "p" gnus-summary-prev-page
1354 "\r" gnus-summary-scroll-up
1355 "\M-\r" gnus-summary-scroll-down
1356 "<" gnus-summary-beginning-of-article
1357 ">" gnus-summary-end-of-article
1358 "b" gnus-summary-beginning-of-article
1359 "e" gnus-summary-end-of-article
1360 "^" gnus-summary-refer-parent-article
1361 "r" gnus-summary-refer-parent-article
1362 "R" gnus-summary-refer-references
1363 "T" gnus-summary-refer-thread
1364 "g" gnus-summary-show-article
1365 "s" gnus-summary-isearch-article
1366 "P" gnus-summary-print-article)
1368 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1369 "b" gnus-article-add-buttons
1370 "B" gnus-article-add-buttons-to-head
1371 "o" gnus-article-treat-overstrike
1372 "e" gnus-article-emphasize
1373 "w" gnus-article-fill-cited-article
1374 "c" gnus-article-remove-cr
1375 "f" gnus-article-display-x-face
1376 "l" gnus-summary-stop-page-breaking
1377 "r" gnus-summary-caesar-message
1378 "t" gnus-article-hide-headers
1379 "v" gnus-summary-verbose-headers
1380 "m" gnus-summary-toggle-mime
1381 "h" gnus-article-treat-html
1382 "d" gnus-article-treat-dumbquotes)
1384 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1385 "a" gnus-article-hide
1386 "h" gnus-article-hide-headers
1387 "b" gnus-article-hide-boring-headers
1388 "s" gnus-article-hide-signature
1389 "c" gnus-article-hide-citation
1390 "C" gnus-article-hide-citation-in-followups
1391 "p" gnus-article-hide-pgp
1392 "P" gnus-article-hide-pem
1393 "\C-c" gnus-article-hide-citation-maybe)
1395 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1396 "a" gnus-article-highlight
1397 "h" gnus-article-highlight-headers
1398 "c" gnus-article-highlight-citation
1399 "s" gnus-article-highlight-signature)
1401 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1402 "z" gnus-article-date-ut
1403 "u" gnus-article-date-ut
1404 "l" gnus-article-date-local
1405 "e" gnus-article-date-lapsed
1406 "o" gnus-article-date-original
1407 "i" gnus-article-date-iso8601
1408 "s" gnus-article-date-user)
1410 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1411 "t" gnus-article-remove-trailing-blank-lines
1412 "l" gnus-article-strip-leading-blank-lines
1413 "m" gnus-article-strip-multiple-blank-lines
1414 "a" gnus-article-strip-blank-lines
1415 "A" gnus-article-strip-all-blank-lines
1416 "s" gnus-article-strip-leading-space)
1418 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1420 "f" gnus-summary-fetch-faq
1421 "d" gnus-summary-describe-group
1422 "h" gnus-summary-describe-briefly
1423 "i" gnus-info-find-node)
1425 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1426 "e" gnus-summary-expire-articles
1427 "\M-\C-e" gnus-summary-expire-articles-now
1428 "\177" gnus-summary-delete-article
1429 [delete] gnus-summary-delete-article
1430 "m" gnus-summary-move-article
1431 "r" gnus-summary-respool-article
1432 "w" gnus-summary-edit-article
1433 "c" gnus-summary-copy-article
1434 "B" gnus-summary-crosspost-article
1435 "q" gnus-summary-respool-query
1436 "t" gnus-summary-respool-trace
1437 "i" gnus-summary-import-article
1438 "p" gnus-summary-article-posted-p)
1440 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1441 "o" gnus-summary-save-article
1442 "m" gnus-summary-save-article-mail
1443 "F" gnus-summary-write-article-file
1444 "r" gnus-summary-save-article-rmail
1445 "f" gnus-summary-save-article-file
1446 "b" gnus-summary-save-article-body-file
1447 "h" gnus-summary-save-article-folder
1448 "v" gnus-summary-save-article-vm
1449 "p" gnus-summary-pipe-output
1450 "s" gnus-soup-add-article))
1452 (defun gnus-summary-make-menu-bar ()
1453 (gnus-turn-off-edit-menu 'summary)
1455 (unless (boundp 'gnus-summary-misc-menu)
1458 gnus-summary-kill-menu gnus-summary-mode-map ""
1463 ["Enter score..." gnus-summary-score-entry t]
1464 ["Customize" gnus-score-customize t])
1465 (gnus-make-score-map 'increase)
1466 (gnus-make-score-map 'lower)
1468 ["Kill below" gnus-summary-kill-below t]
1469 ["Mark above" gnus-summary-mark-above t]
1470 ["Tick above" gnus-summary-tick-above t]
1471 ["Clear above" gnus-summary-clear-above t])
1472 ["Current score" gnus-summary-current-score t]
1473 ["Set score" gnus-summary-set-score t]
1474 ["Switch current score file..." gnus-score-change-score-file t]
1475 ["Set mark below..." gnus-score-set-mark-below t]
1476 ["Set expunge below..." gnus-score-set-expunge-below t]
1477 ["Edit current score file" gnus-score-edit-current-scores t]
1478 ["Edit score file" gnus-score-edit-file t]
1479 ["Trace score" gnus-score-find-trace t]
1480 ["Find words" gnus-score-find-favourite-words t]
1481 ["Rescore buffer" gnus-summary-rescore t]
1482 ["Increase score..." gnus-summary-increase-score t]
1483 ["Lower score..." gnus-summary-lower-score t]))))
1485 ;; Define both the Article menu in the summary buffer and the equivalent
1486 ;; Commands menu in the article buffer here for consistency.
1489 ["All" gnus-article-hide t]
1490 ["Headers" gnus-article-hide-headers t]
1491 ["Signature" gnus-article-hide-signature t]
1492 ["Citation" gnus-article-hide-citation t]
1493 ["PGP" gnus-article-hide-pgp t]
1494 ["Boring headers" gnus-article-hide-boring-headers t])
1496 ["All" gnus-article-highlight t]
1497 ["Headers" gnus-article-highlight-headers t]
1498 ["Signature" gnus-article-highlight-signature t]
1499 ["Citation" gnus-article-highlight-citation t])
1501 ["Local" gnus-article-date-local t]
1502 ["ISO8601" gnus-article-date-iso8601 t]
1503 ["UT" gnus-article-date-ut t]
1504 ["Original" gnus-article-date-original t]
1505 ["Lapsed" gnus-article-date-lapsed t]
1506 ["User-defined" gnus-article-date-user t])
1509 ["Leading" gnus-article-strip-leading-blank-lines t]
1510 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1511 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1512 ["All of the above" gnus-article-strip-blank-lines t]
1513 ["All" gnus-article-strip-all-blank-lines t]
1514 ["Leading space" gnus-article-strip-leading-space t])
1515 ["Overstrike" gnus-article-treat-overstrike t]
1516 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1517 ["Emphasis" gnus-article-emphasize t]
1518 ["Word wrap" gnus-article-fill-cited-article t]
1519 ["CR" gnus-article-remove-cr t]
1520 ["Show X-Face" gnus-article-display-x-face t]
1521 ["UnHTMLize" gnus-article-treat-html t]
1522 ["Rot 13" gnus-summary-caesar-message t]
1523 ["Unix pipe" gnus-summary-pipe-message t]
1524 ["Add buttons" gnus-article-add-buttons t]
1525 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1526 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1527 ["Toggle MIME" gnus-summary-toggle-mime t]
1528 ["Verbose header" gnus-summary-verbose-headers t]
1529 ["Toggle header" gnus-summary-toggle-header t])
1531 ["Save in default format" gnus-summary-save-article t]
1532 ["Save in file" gnus-summary-save-article-file t]
1533 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1534 ["Save in MH folder" gnus-summary-save-article-folder t]
1535 ["Save in VM folder" gnus-summary-save-article-vm t]
1536 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1537 ["Save body in file" gnus-summary-save-article-body-file t]
1538 ["Pipe through a filter" gnus-summary-pipe-output t]
1539 ["Add to SOUP packet" gnus-soup-add-article t]
1540 ["Print" gnus-summary-print-article t])
1542 ["Respool article..." gnus-summary-respool-article t]
1543 ["Move article..." gnus-summary-move-article
1544 (gnus-check-backend-function
1545 'request-move-article gnus-newsgroup-name)]
1546 ["Copy article..." gnus-summary-copy-article t]
1547 ["Crosspost article..." gnus-summary-crosspost-article
1548 (gnus-check-backend-function
1549 'request-replace-article gnus-newsgroup-name)]
1550 ["Import file..." gnus-summary-import-article t]
1551 ["Check if posted" gnus-summary-article-posted-p t]
1552 ["Edit article" gnus-summary-edit-article
1553 (not (gnus-group-read-only-p))]
1554 ["Delete article" gnus-summary-delete-article
1555 (gnus-check-backend-function
1556 'request-expire-articles gnus-newsgroup-name)]
1557 ["Query respool" gnus-summary-respool-query t]
1558 ["Trace respool" gnus-summary-respool-trace t]
1559 ["Delete expirable articles" gnus-summary-expire-articles-now
1560 (gnus-check-backend-function
1561 'request-expire-articles gnus-newsgroup-name)])
1563 ["Uudecode" gnus-uu-decode-uu t]
1564 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1565 ["Unshar" gnus-uu-decode-unshar t]
1566 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1567 ["Save" gnus-uu-decode-save t]
1568 ["Binhex" gnus-uu-decode-binhex t]
1569 ["Postscript" gnus-uu-decode-postscript t])
1571 ["Enter article" gnus-cache-enter-article t]
1572 ["Remove article" gnus-cache-remove-article t])
1573 ["Select article buffer" gnus-summary-select-article-buffer t]
1574 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1575 ["Isearch article..." gnus-summary-isearch-article t]
1576 ["Beginning of the article" gnus-summary-beginning-of-article t]
1577 ["End of the article" gnus-summary-end-of-article t]
1578 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1579 ["Fetch referenced articles" gnus-summary-refer-references t]
1580 ["Fetch current thread" gnus-summary-refer-thread t]
1581 ["Fetch article with id..." gnus-summary-refer-article t]
1582 ["Redisplay" gnus-summary-show-article t])))
1584 gnus-summary-article-menu gnus-summary-mode-map ""
1585 (cons "Article" innards))
1588 gnus-article-commands-menu gnus-article-mode-map ""
1589 (cons "Commands" innards)))
1592 gnus-summary-thread-menu gnus-summary-mode-map ""
1594 ["Toggle threading" gnus-summary-toggle-threads t]
1595 ["Hide threads" gnus-summary-hide-all-threads t]
1596 ["Show threads" gnus-summary-show-all-threads t]
1597 ["Hide thread" gnus-summary-hide-thread t]
1598 ["Show thread" gnus-summary-show-thread t]
1599 ["Go to next thread" gnus-summary-next-thread t]
1600 ["Go to previous thread" gnus-summary-prev-thread t]
1601 ["Go down thread" gnus-summary-down-thread t]
1602 ["Go up thread" gnus-summary-up-thread t]
1603 ["Top of thread" gnus-summary-top-thread t]
1604 ["Mark thread as read" gnus-summary-kill-thread t]
1605 ["Lower thread score" gnus-summary-lower-thread t]
1606 ["Raise thread score" gnus-summary-raise-thread t]
1607 ["Rethread current" gnus-summary-rethread-current t]
1611 gnus-summary-post-menu gnus-summary-mode-map ""
1613 ["Post an article" gnus-summary-post-news t]
1614 ["Followup" gnus-summary-followup t]
1615 ["Followup and yank" gnus-summary-followup-with-original t]
1616 ["Supersede article" gnus-summary-supersede-article t]
1617 ["Cancel article" gnus-summary-cancel-article t]
1618 ["Reply" gnus-summary-reply t]
1619 ["Reply and yank" gnus-summary-reply-with-original t]
1620 ["Wide reply" gnus-summary-wide-reply t]
1621 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1622 ["Mail forward" gnus-summary-mail-forward t]
1623 ["Post forward" gnus-summary-post-forward t]
1624 ["Digest and mail" gnus-summary-mail-digest t]
1625 ["Digest and post" gnus-summary-post-digest t]
1626 ["Resend message" gnus-summary-resend-message t]
1627 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1628 ["Send a mail" gnus-summary-mail-other-window t]
1629 ["Uuencode and post" gnus-uu-post-news t]
1630 ["Followup via news" gnus-summary-followup-to-mail t]
1631 ["Followup via news and yank"
1632 gnus-summary-followup-to-mail-with-original t]
1634 ;;["Send" gnus-summary-send-draft t]
1635 ;;["Send bounced" gnus-resend-bounced-mail t])
1639 gnus-summary-misc-menu gnus-summary-mode-map ""
1642 ["Mark as read" gnus-summary-mark-as-read-forward t]
1643 ["Mark same subject and select"
1644 gnus-summary-kill-same-subject-and-select t]
1645 ["Mark same subject" gnus-summary-kill-same-subject t]
1646 ["Catchup" gnus-summary-catchup t]
1647 ["Catchup all" gnus-summary-catchup-all t]
1648 ["Catchup to here" gnus-summary-catchup-to-here t]
1649 ["Catchup region" gnus-summary-mark-region-as-read t]
1650 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1652 ["Tick" gnus-summary-tick-article-forward t]
1653 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1654 ["Remove marks" gnus-summary-clear-mark-forward t]
1655 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1656 ["Set bookmark" gnus-summary-set-bookmark t]
1657 ["Remove bookmark" gnus-summary-remove-bookmark t])
1659 ["Marks..." gnus-summary-limit-to-marks t]
1660 ["Subject..." gnus-summary-limit-to-subject t]
1661 ["Author..." gnus-summary-limit-to-author t]
1662 ["Age..." gnus-summary-limit-to-age t]
1663 ["Score" gnus-summary-limit-to-score t]
1664 ["Unread" gnus-summary-limit-to-unread t]
1665 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1666 ["Articles" gnus-summary-limit-to-articles t]
1667 ["Pop limit" gnus-summary-pop-limit t]
1668 ["Show dormant" gnus-summary-limit-include-dormant t]
1669 ["Hide childless dormant"
1670 gnus-summary-limit-exclude-childless-dormant t]
1671 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1672 ["Show expunged" gnus-summary-show-all-expunged t])
1674 ["Set mark" gnus-summary-mark-as-processable t]
1675 ["Remove mark" gnus-summary-unmark-as-processable t]
1676 ["Remove all marks" gnus-summary-unmark-all-processable t]
1677 ["Mark above" gnus-uu-mark-over t]
1678 ["Mark series" gnus-uu-mark-series t]
1679 ["Mark region" gnus-uu-mark-region t]
1680 ["Unmark region" gnus-uu-unmark-region t]
1681 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1682 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1683 ["Mark all" gnus-uu-mark-all t]
1684 ["Mark buffer" gnus-uu-mark-buffer t]
1685 ["Mark sparse" gnus-uu-mark-sparse t]
1686 ["Mark thread" gnus-uu-mark-thread t]
1687 ["Unmark thread" gnus-uu-unmark-thread t]
1688 ("Process Mark Sets"
1689 ["Kill" gnus-summary-kill-process-mark t]
1690 ["Yank" gnus-summary-yank-process-mark
1691 gnus-newsgroup-process-stack]
1692 ["Save" gnus-summary-save-process-mark t]))
1694 ["Page forward" gnus-summary-next-page t]
1695 ["Page backward" gnus-summary-prev-page t]
1696 ["Line forward" gnus-summary-scroll-up t])
1698 ["Next unread article" gnus-summary-next-unread-article t]
1699 ["Previous unread article" gnus-summary-prev-unread-article t]
1700 ["Next article" gnus-summary-next-article t]
1701 ["Previous article" gnus-summary-prev-article t]
1702 ["Next unread subject" gnus-summary-next-unread-subject t]
1703 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1704 ["Next article same subject" gnus-summary-next-same-subject t]
1705 ["Previous article same subject" gnus-summary-prev-same-subject t]
1706 ["First unread article" gnus-summary-first-unread-article t]
1707 ["Best unread article" gnus-summary-best-unread-article t]
1708 ["Go to subject number..." gnus-summary-goto-subject t]
1709 ["Go to article number..." gnus-summary-goto-article t]
1710 ["Go to the last article" gnus-summary-goto-last-article t]
1711 ["Pop article off history" gnus-summary-pop-article t])
1713 ["Sort by number" gnus-summary-sort-by-number t]
1714 ["Sort by author" gnus-summary-sort-by-author t]
1715 ["Sort by subject" gnus-summary-sort-by-subject t]
1716 ["Sort by date" gnus-summary-sort-by-date t]
1717 ["Sort by score" gnus-summary-sort-by-score t]
1718 ["Sort by lines" gnus-summary-sort-by-lines t])
1720 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1721 ["Describe group" gnus-summary-describe-group t]
1722 ["Read manual" gnus-info-find-node t])
1724 ["Pick and read" gnus-pick-mode t]
1725 ["Binary" gnus-binary-mode t])
1727 ["Regenerate" gnus-summary-prepare t]
1728 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1729 ["Toggle threading" gnus-summary-toggle-threads t])
1730 ["Filter articles..." gnus-summary-execute-command t]
1731 ["Run command on subjects..." gnus-summary-universal-argument t]
1732 ["Search articles forward..." gnus-summary-search-article-forward t]
1733 ["Search articles backward..." gnus-summary-search-article-backward t]
1734 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1735 ["Expand window" gnus-summary-expand-window t]
1736 ["Expire expirable articles" gnus-summary-expire-articles
1737 (gnus-check-backend-function
1738 'request-expire-articles gnus-newsgroup-name)]
1739 ["Edit local kill file" gnus-summary-edit-local-kill t]
1740 ["Edit main kill file" gnus-summary-edit-global-kill t]
1741 ["Edit group parameters" gnus-summary-edit-parameters t]
1742 ["Send a bug report" gnus-bug t]
1744 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1745 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1746 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1747 ["Exit group" gnus-summary-exit t]
1748 ["Exit group without updating" gnus-summary-exit-no-update t]
1749 ["Exit and goto next group" gnus-summary-next-group t]
1750 ["Exit and goto prev group" gnus-summary-prev-group t]
1751 ["Reselect group" gnus-summary-reselect-current-group t]
1752 ["Rescan group" gnus-summary-rescan-group t]
1753 ["Update dribble" gnus-summary-save-newsrc t])))
1755 (gnus-run-hooks 'gnus-summary-menu-hook)))
1757 (defun gnus-score-set-default (var value)
1758 "A version of set that updates the GNU Emacs menu-bar."
1760 ;; It is the message that forces the active status to be updated.
1763 (defun gnus-make-score-map (type)
1764 "Make a summary score map of type TYPE."
1767 (let ((headers '(("author" "from" string)
1768 ("subject" "subject" string)
1769 ("article body" "body" string)
1770 ("article head" "head" string)
1771 ("xref" "xref" string)
1772 ("lines" "lines" number)
1773 ("followups to author" "followup" string)))
1774 (types '((number ("less than" <)
1777 (string ("substring" s)
1781 (perms '(("temporary" (current-time-string))
1789 (if (eq type 'lower)
1794 (setq header (car headers))
1800 (let ((ts (cdr (assoc (nth 2 header) types)))
1816 'gnus-summary-score-entry
1818 (if (or (string= (nth 1 header)
1820 (string= (nth 1 header)
1823 (list 'gnus-summary-header
1825 (list 'quote (nth 1 (car ts)))
1826 (list 'gnus-score-default nil)
1832 (list (nreverse outp))))
1835 (list (nreverse outt))))
1837 (setq headers (cdr headers)))
1838 (list (nreverse outh))))))))
1842 (defun gnus-summary-mode (&optional group)
1843 "Major mode for reading articles.
1845 All normal editing commands are switched off.
1846 \\<gnus-summary-mode-map>
1847 Each line in this buffer represents one article. To read an
1848 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1849 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1852 You can also post articles and send mail from this buffer. To
1853 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1854 of an article, type `\\[gnus-summary-reply]'.
1856 There are approx. one gazillion commands you can execute in this
1857 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1859 The following commands are available:
1861 \\{gnus-summary-mode-map}"
1863 (when (gnus-visual-p 'summary-menu 'menu)
1864 (gnus-summary-make-menu-bar))
1865 (kill-all-local-variables)
1866 (gnus-summary-make-local-variables)
1867 (gnus-make-thread-indent-array)
1868 (gnus-simplify-mode-line)
1869 (setq major-mode 'gnus-summary-mode)
1870 (setq mode-name "Summary")
1871 (make-local-variable 'minor-mode-alist)
1872 (use-local-map gnus-summary-mode-map)
1873 (buffer-disable-undo (current-buffer))
1874 (setq buffer-read-only t) ;Disable modification
1875 (setq truncate-lines t)
1876 (setq selective-display t)
1877 (setq selective-display-ellipses t) ;Display `...'
1878 (gnus-summary-set-display-table)
1879 (gnus-set-default-directory)
1880 (setq gnus-newsgroup-name group)
1881 (make-local-variable 'gnus-summary-line-format)
1882 (make-local-variable 'gnus-summary-line-format-spec)
1883 (make-local-variable 'gnus-summary-dummy-line-format)
1884 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1885 (make-local-variable 'gnus-summary-mark-positions)
1886 (make-local-hook 'post-command-hook)
1887 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1888 (make-local-hook 'pre-command-hook)
1889 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1890 (gnus-run-hooks 'gnus-summary-mode-hook)
1891 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1892 (gnus-update-summary-mark-positions))
1894 (defun gnus-summary-make-local-variables ()
1895 "Make all the local summary buffer variables."
1896 (let ((locals gnus-summary-local-variables)
1898 (while (setq local (pop locals))
1901 (if (eq (cdr local) 'global)
1902 ;; Copy the global value of the variable.
1903 (setq global (symbol-value (car local)))
1904 ;; Use the value from the list.
1905 (setq global (eval (cdr local))))
1906 (make-local-variable (car local))
1907 (set (car local) global))
1908 ;; Simple nil-valued local variable.
1909 (make-local-variable local)
1912 (defun gnus-summary-clear-local-variables ()
1913 (let ((locals gnus-summary-local-variables))
1915 (if (consp (car locals))
1916 (and (vectorp (caar locals))
1917 (set (caar locals) nil))
1918 (and (vectorp (car locals))
1919 (set (car locals) nil)))
1920 (setq locals (cdr locals)))))
1922 ;; Summary data functions.
1924 (defmacro gnus-data-number (data)
1927 (defmacro gnus-data-set-number (data number)
1928 `(setcar ,data ,number))
1930 (defmacro gnus-data-mark (data)
1933 (defmacro gnus-data-set-mark (data mark)
1934 `(setcar (nthcdr 1 ,data) ,mark))
1936 (defmacro gnus-data-pos (data)
1939 (defmacro gnus-data-set-pos (data pos)
1940 `(setcar (nthcdr 2 ,data) ,pos))
1942 (defmacro gnus-data-header (data)
1945 (defmacro gnus-data-set-header (data header)
1946 `(setf (nth 3 ,data) ,header))
1948 (defmacro gnus-data-level (data)
1951 (defmacro gnus-data-unread-p (data)
1952 `(= (nth 1 ,data) gnus-unread-mark))
1954 (defmacro gnus-data-read-p (data)
1955 `(/= (nth 1 ,data) gnus-unread-mark))
1957 (defmacro gnus-data-pseudo-p (data)
1958 `(consp (nth 3 ,data)))
1960 (defmacro gnus-data-find (number)
1961 `(assq ,number gnus-newsgroup-data))
1963 (defmacro gnus-data-find-list (number &optional data)
1964 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1965 (memq (assq ,number bdata)
1968 (defmacro gnus-data-make (number mark pos header level)
1969 `(list ,number ,mark ,pos ,header ,level))
1971 (defun gnus-data-enter (after-article number mark pos header level offset)
1972 (let ((data (gnus-data-find-list after-article)))
1974 (error "No such article: %d" after-article))
1975 (setcdr data (cons (gnus-data-make number mark pos header level)
1977 (setq gnus-newsgroup-data-reverse nil)
1978 (gnus-data-update-list (cddr data) offset)))
1980 (defun gnus-data-enter-list (after-article list &optional offset)
1982 (let ((data (and after-article (gnus-data-find-list after-article)))
1986 (let ((odata gnus-newsgroup-data))
1987 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
1989 (gnus-data-update-list odata offset)))
1990 ;; Find the last element in the list to be spliced into the main
1993 (setq list (cdr list)))
1996 (setcdr list gnus-newsgroup-data)
1997 (setq gnus-newsgroup-data ilist)
1999 (gnus-data-update-list (cdr list) offset)))
2000 (setcdr list (cdr data))
2003 (gnus-data-update-list (cdr list) offset))))
2004 (setq gnus-newsgroup-data-reverse nil))))
2006 (defun gnus-data-remove (article &optional offset)
2007 (let ((data gnus-newsgroup-data))
2008 (if (= (gnus-data-number (car data)) article)
2010 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2011 gnus-newsgroup-data-reverse nil)
2013 (gnus-data-update-list gnus-newsgroup-data offset)))
2015 (when (= (gnus-data-number (cadr data)) article)
2016 (setcdr data (cddr data))
2018 (gnus-data-update-list (cdr data) offset))
2020 gnus-newsgroup-data-reverse nil))
2021 (setq data (cdr data))))))
2023 (defmacro gnus-data-list (backward)
2025 (or gnus-newsgroup-data-reverse
2026 (setq gnus-newsgroup-data-reverse
2027 (reverse gnus-newsgroup-data)))
2028 gnus-newsgroup-data))
2030 (defun gnus-data-update-list (data offset)
2031 "Add OFFSET to the POS of all data entries in DATA."
2032 (setq gnus-newsgroup-data-reverse nil)
2034 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2035 (setq data (cdr data))))
2037 (defun gnus-data-compute-positions ()
2038 "Compute the positions of all articles."
2039 (setq gnus-newsgroup-data-reverse nil)
2040 (let ((data gnus-newsgroup-data))
2042 (gnus-save-hidden-threads
2043 (gnus-summary-show-all-threads)
2044 (goto-char (point-min))
2046 (while (get-text-property (point) 'gnus-intangible)
2048 (gnus-data-set-pos (car data) (+ (point) 3))
2049 (setq data (cdr data))
2050 (forward-line 1))))))
2052 (defun gnus-summary-article-pseudo-p (article)
2053 "Say whether this article is a pseudo article or not."
2054 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2056 (defmacro gnus-summary-article-sparse-p (article)
2057 "Say whether this article is a sparse article or not."
2058 `(memq ,article gnus-newsgroup-sparse))
2060 (defmacro gnus-summary-article-ancient-p (article)
2061 "Say whether this article is a sparse article or not."
2062 `(memq ,article gnus-newsgroup-ancient))
2064 (defun gnus-article-parent-p (number)
2065 "Say whether this article is a parent or not."
2066 (let ((data (gnus-data-find-list number)))
2067 (and (cdr data) ; There has to be an article after...
2068 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2069 (gnus-data-level (nth 1 data))))))
2071 (defun gnus-article-children (number)
2072 "Return a list of all children to NUMBER."
2073 (let* ((data (gnus-data-find-list number))
2074 (level (gnus-data-level (car data)))
2076 (setq data (cdr data))
2078 (= (gnus-data-level (car data)) (1+ level)))
2079 (push (gnus-data-number (car data)) children)
2080 (setq data (cdr data)))
2083 (defmacro gnus-summary-skip-intangible ()
2084 "If the current article is intangible, then jump to a different article."
2085 '(let ((to (get-text-property (point) 'gnus-intangible)))
2086 (and to (gnus-summary-goto-subject to))))
2088 (defmacro gnus-summary-article-intangible-p ()
2089 "Say whether this article is intangible or not."
2090 '(get-text-property (point) 'gnus-intangible))
2092 (defun gnus-article-read-p (article)
2093 "Say whether ARTICLE is read or not."
2094 (not (or (memq article gnus-newsgroup-marked)
2095 (memq article gnus-newsgroup-unreads)
2096 (memq article gnus-newsgroup-unselected)
2097 (memq article gnus-newsgroup-dormant))))
2099 ;; Some summary mode macros.
2101 (defmacro gnus-summary-article-number ()
2102 "The article number of the article on the current line.
2103 If there isn's an article number here, then we return the current
2106 (gnus-summary-skip-intangible)
2107 (or (get-text-property (point) 'gnus-number)
2108 (gnus-summary-last-subject))))
2110 (defmacro gnus-summary-article-header (&optional number)
2111 "Return the header of article NUMBER."
2112 `(gnus-data-header (gnus-data-find
2113 ,(or number '(gnus-summary-article-number)))))
2115 (defmacro gnus-summary-thread-level (&optional number)
2116 "Return the level of thread that starts with article NUMBER."
2117 `(if (and (eq gnus-summary-make-false-root 'dummy)
2118 (get-text-property (point) 'gnus-intangible))
2120 (gnus-data-level (gnus-data-find
2121 ,(or number '(gnus-summary-article-number))))))
2123 (defmacro gnus-summary-article-mark (&optional number)
2124 "Return the mark of article NUMBER."
2125 `(gnus-data-mark (gnus-data-find
2126 ,(or number '(gnus-summary-article-number)))))
2128 (defmacro gnus-summary-article-pos (&optional number)
2129 "Return the position of the line of article NUMBER."
2130 `(gnus-data-pos (gnus-data-find
2131 ,(or number '(gnus-summary-article-number)))))
2133 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2134 (defmacro gnus-summary-article-subject (&optional number)
2135 "Return current subject string or nil if nothing."
2138 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2139 '(gnus-data-header (assq (gnus-summary-article-number)
2140 gnus-newsgroup-data)))))
2143 (mail-header-subject headers))))
2145 (defmacro gnus-summary-article-score (&optional number)
2146 "Return current article score."
2147 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2148 gnus-newsgroup-scored))
2149 gnus-summary-default-score 0))
2151 (defun gnus-summary-article-children (&optional number)
2152 "Return a list of article numbers that are children of article NUMBER."
2153 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2154 (level (gnus-data-level (car data)))
2156 (while (and (setq data (cdr data))
2157 (> (setq l (gnus-data-level (car data))) level))
2158 (and (= (1+ level) l)
2159 (push (gnus-data-number (car data))
2161 (nreverse children)))
2163 (defun gnus-summary-article-parent (&optional number)
2164 "Return the article number of the parent of article NUMBER."
2165 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2166 (gnus-data-list t)))
2167 (level (gnus-data-level (car data))))
2169 () ; This is a root.
2170 ;; We search until we find an article with a level less than
2171 ;; this one. That function has to be the parent.
2172 (while (and (setq data (cdr data))
2173 (not (< (gnus-data-level (car data)) level))))
2174 (and data (gnus-data-number (car data))))))
2176 (defun gnus-unread-mark-p (mark)
2177 "Say whether MARK is the unread mark."
2178 (= mark gnus-unread-mark))
2180 (defun gnus-read-mark-p (mark)
2181 "Say whether MARK is one of the marks that mark as read.
2182 This is all marks except unread, ticked, dormant, and expirable."
2183 (not (or (= mark gnus-unread-mark)
2184 (= mark gnus-ticked-mark)
2185 (= mark gnus-dormant-mark)
2186 (= mark gnus-expirable-mark))))
2188 (defmacro gnus-article-mark (number)
2189 "Return the MARK of article NUMBER.
2190 This macro should only be used when computing the mark the \"first\"
2191 time; i.e., when generating the summary lines. After that,
2192 `gnus-summary-article-mark' should be used to examine the
2195 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2196 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2197 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2198 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2199 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2200 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2201 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2202 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2203 gnus-ancient-mark))))
2205 ;; Saving hidden threads.
2207 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2208 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2210 (defmacro gnus-save-hidden-threads (&rest forms)
2211 "Save hidden threads, eval FORMS, and restore the hidden threads."
2212 (let ((config (make-symbol "config")))
2213 `(let ((,config (gnus-hidden-threads-configuration)))
2217 (gnus-restore-hidden-threads-configuration ,config)))))
2219 (defun gnus-hidden-threads-configuration ()
2220 "Return the current hidden threads configuration."
2223 (goto-char (point-min))
2224 (while (search-forward "\r" nil t)
2225 (push (1- (point)) config))
2228 (defun gnus-restore-hidden-threads-configuration (config)
2229 "Restore hidden threads configuration from CONFIG."
2230 (let (point buffer-read-only)
2231 (while (setq point (pop config))
2232 (when (and (< point (point-max))
2234 (eq (char-after) ?\n))
2235 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2237 ;; Various summary mode internalish functions.
2239 (defun gnus-mouse-pick-article (e)
2242 (gnus-summary-next-page nil t))
2244 (defun gnus-summary-set-display-table ()
2245 ;; Change the display table. Odd characters have a tendency to mess
2246 ;; up nicely formatted displays - we make all possible glyphs
2247 ;; display only a single character.
2249 ;; We start from the standard display table, if any.
2250 (let ((table (or (copy-sequence standard-display-table)
2251 (make-display-table)))
2253 ;; Nix out all the control chars...
2254 (while (>= (setq i (1- i)) 0)
2255 (aset table i [??]))
2256 ;; ... but not newline and cr, of course. (cr is necessary for the
2257 ;; selective display).
2258 (aset table ?\n nil)
2259 (aset table ?\r nil)
2260 ;; We keep TAB as well.
2261 (aset table ?\t nil)
2262 ;; We nix out any glyphs over 126 that are not set already.
2264 (while (>= (setq i (1- i)) 127)
2265 ;; Only modify if the entry is nil.
2266 (unless (aref table i)
2267 (aset table i [??]))))
2268 (setq buffer-display-table table)))
2270 (defun gnus-summary-setup-buffer (group)
2271 "Initialize summary buffer."
2272 (let ((buffer (concat "*Summary " group "*")))
2273 (if (get-buffer buffer)
2276 (setq gnus-summary-buffer (current-buffer))
2277 (not gnus-newsgroup-prepared))
2278 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2279 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2280 (gnus-summary-mode group)
2282 (gnus-carpal-setup-buffer 'summary))
2283 (unless gnus-single-article-buffer
2284 (make-local-variable 'gnus-article-buffer)
2285 (make-local-variable 'gnus-article-current)
2286 (make-local-variable 'gnus-original-article-buffer))
2287 (setq gnus-newsgroup-name group)
2290 (defun gnus-set-global-variables ()
2291 ;; Set the global equivalents of the summary buffer-local variables
2292 ;; to the latest values they had. These reflect the summary buffer
2293 ;; that was in action when the last article was fetched.
2294 (when (eq major-mode 'gnus-summary-mode)
2295 (setq gnus-summary-buffer (current-buffer))
2296 (let ((name gnus-newsgroup-name)
2297 (marked gnus-newsgroup-marked)
2298 (unread gnus-newsgroup-unreads)
2299 (headers gnus-current-headers)
2300 (data gnus-newsgroup-data)
2301 (summary gnus-summary-buffer)
2302 (article-buffer gnus-article-buffer)
2303 (original gnus-original-article-buffer)
2304 (gac gnus-article-current)
2305 (reffed gnus-reffed-article-number)
2306 (score-file gnus-current-score-file))
2308 (set-buffer gnus-group-buffer)
2309 (setq gnus-newsgroup-name name
2310 gnus-newsgroup-marked marked
2311 gnus-newsgroup-unreads unread
2312 gnus-current-headers headers
2313 gnus-newsgroup-data data
2314 gnus-article-current gac
2315 gnus-summary-buffer summary
2316 gnus-article-buffer article-buffer
2317 gnus-original-article-buffer original
2318 gnus-reffed-article-number reffed
2319 gnus-current-score-file score-file)
2320 ;; The article buffer also has local variables.
2321 (when (gnus-buffer-live-p gnus-article-buffer)
2322 (set-buffer gnus-article-buffer)
2323 (setq gnus-summary-buffer summary))))))
2325 (defun gnus-summary-article-unread-p (article)
2326 "Say whether ARTICLE is unread or not."
2327 (memq article gnus-newsgroup-unreads))
2329 (defun gnus-summary-first-article-p (&optional article)
2330 "Return whether ARTICLE is the first article in the buffer."
2331 (if (not (setq article (or article (gnus-summary-article-number))))
2333 (eq article (caar gnus-newsgroup-data))))
2335 (defun gnus-summary-last-article-p (&optional article)
2336 "Return whether ARTICLE is the last article in the buffer."
2337 (if (not (setq article (or article (gnus-summary-article-number))))
2338 t ; All non-existent numbers are the last article. :-)
2339 (not (cdr (gnus-data-find-list article)))))
2341 (defun gnus-make-thread-indent-array ()
2343 (unless (and gnus-thread-indent-array
2344 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2345 (setq gnus-thread-indent-array (make-vector 201 "")
2346 gnus-thread-indent-array-level gnus-thread-indent-level)
2348 (aset gnus-thread-indent-array n
2349 (make-string (* n gnus-thread-indent-level) ? ))
2352 (defun gnus-update-summary-mark-positions ()
2353 "Compute where the summary marks are to go."
2355 (when (gnus-buffer-exists-p gnus-summary-buffer)
2356 (set-buffer gnus-summary-buffer))
2357 (let ((gnus-replied-mark 129)
2358 (gnus-score-below-mark 130)
2359 (gnus-score-over-mark 130)
2360 (gnus-download-mark 131)
2361 (spec gnus-summary-line-format-spec)
2364 (gnus-set-work-buffer)
2365 (let ((gnus-summary-line-format-spec spec)
2366 (gnus-newsgroup-downloadable '((0 . t))))
2367 (gnus-summary-insert-line
2368 (make-full-mail-header 0 "" "" "" "" "" 0 0 "")
2369 0 nil 128 t nil "" nil 1)
2370 (goto-char (point-min))
2371 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2373 (goto-char (point-min))
2374 (push (cons 'replied (and (search-forward "\201" nil t)
2377 (goto-char (point-min))
2378 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2380 (goto-char (point-min))
2381 (push (cons 'download
2382 (and (search-forward "\203" nil t) (- (point) 2)))
2384 (setq gnus-summary-mark-positions pos))))
2386 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2387 "Insert a dummy root in the summary buffer."
2389 (gnus-add-text-properties
2390 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2391 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2393 (defun gnus-summary-insert-line (gnus-tmp-header
2394 gnus-tmp-level gnus-tmp-current
2395 gnus-tmp-unread gnus-tmp-replied
2396 gnus-tmp-expirable gnus-tmp-subject-or-nil
2397 &optional gnus-tmp-dummy gnus-tmp-score
2399 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2400 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2401 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2402 (gnus-tmp-score-char
2403 (if (or (null gnus-summary-default-score)
2404 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2405 gnus-summary-zcore-fuzz))
2407 (if (< gnus-tmp-score gnus-summary-default-score)
2408 gnus-score-below-mark gnus-score-over-mark)))
2410 (cond (gnus-tmp-process gnus-process-mark)
2411 ((memq gnus-tmp-current gnus-newsgroup-cached)
2413 (gnus-tmp-replied gnus-replied-mark)
2414 ((memq gnus-tmp-current gnus-newsgroup-saved)
2416 (t gnus-unread-mark)))
2417 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2420 ((string-match "<[^>]+> *$" gnus-tmp-from)
2421 (let ((beg (match-beginning 0)))
2422 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2423 (substring gnus-tmp-from (1+ (match-beginning 0))
2424 (1- (match-end 0))))
2425 (substring gnus-tmp-from 0 beg))))
2426 ((string-match "(.+)" gnus-tmp-from)
2427 (substring gnus-tmp-from
2428 (1+ (match-beginning 0)) (1- (match-end 0))))
2430 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2431 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2432 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2433 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2434 (buffer-read-only nil))
2435 (when (string= gnus-tmp-name "")
2436 (setq gnus-tmp-name gnus-tmp-from))
2437 (unless (numberp gnus-tmp-lines)
2438 (setq gnus-tmp-lines 0))
2439 (gnus-put-text-property-excluding-characters-with-faces
2441 (progn (eval gnus-summary-line-format-spec) (point))
2442 'gnus-number gnus-tmp-number)
2443 (when (gnus-visual-p 'summary-highlight 'highlight)
2445 (gnus-run-hooks 'gnus-summary-update-hook)
2448 (defun gnus-summary-update-line (&optional dont-update)
2449 ;; Update summary line after change.
2450 (when (and gnus-summary-default-score
2451 (not gnus-summary-inhibit-highlight))
2452 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2453 (article (gnus-summary-article-number))
2454 (score (gnus-summary-article-score article)))
2456 (if (and gnus-summary-mark-below
2457 (< (gnus-summary-article-score)
2458 gnus-summary-mark-below))
2459 ;; This article has a low score, so we mark it as read.
2460 (when (memq article gnus-newsgroup-unreads)
2461 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2462 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2463 ;; This article was previously marked as read on account
2464 ;; of a low score, but now it has risen, so we mark it as
2466 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2467 (gnus-summary-update-mark
2468 (if (or (null gnus-summary-default-score)
2469 (<= (abs (- score gnus-summary-default-score))
2470 gnus-summary-zcore-fuzz))
2472 (if (< score gnus-summary-default-score)
2473 gnus-score-below-mark gnus-score-over-mark))
2475 ;; Do visual highlighting.
2476 (when (gnus-visual-p 'summary-highlight 'highlight)
2477 (gnus-run-hooks 'gnus-summary-update-hook)))))
2479 (defvar gnus-tmp-new-adopts nil)
2481 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2482 "Return the number of articles in THREAD.
2483 This may be 0 in some cases -- if none of the articles in
2484 the thread are to be displayed."
2486 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2488 ((not (listp thread))
2490 ((and (consp thread) (cdr thread))
2493 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2496 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2499 (when (and level (zerop level) gnus-tmp-new-adopts)
2502 'gnus-summary-number-of-articles-in-thread
2503 gnus-tmp-new-adopts))))
2505 (if (> number 1) gnus-not-empty-thread-mark
2506 gnus-empty-thread-mark)
2509 (defun gnus-summary-set-local-parameters (group)
2510 "Go through the local params of GROUP and set all variable specs in that list."
2511 (let ((params (gnus-group-find-parameter group))
2514 (setq elem (car params)
2515 params (cdr params))
2516 (and (consp elem) ; Has to be a cons.
2517 (consp (cdr elem)) ; The cdr has to be a list.
2518 (symbolp (car elem)) ; Has to be a symbol in there.
2519 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2520 (ignore-errors ; So we set it.
2521 (make-local-variable (car elem))
2522 (set (car elem) (eval (nth 1 elem))))))))
2524 (defun gnus-summary-read-group (group &optional show-all no-article
2525 kill-buffer no-display backward
2527 "Start reading news in newsgroup GROUP.
2528 If SHOW-ALL is non-nil, already read articles are also listed.
2529 If NO-ARTICLE is non-nil, no article is selected initially.
2530 If NO-DISPLAY, don't generate a summary buffer."
2534 (let ((gnus-auto-select-next nil))
2535 (or (gnus-summary-read-group-1
2536 group show-all no-article
2537 kill-buffer no-display
2540 select-articles nil)))))
2541 (eq gnus-auto-select-next 'quietly))
2542 (set-buffer gnus-group-buffer)
2543 ;; The entry function called above goes to the next
2544 ;; group automatically, so we go two groups back
2545 ;; if we are searching for the previous group.
2547 (gnus-group-prev-unread-group 2))
2548 (if (not (equal group (gnus-group-group-name)))
2549 (setq group (gnus-group-group-name))
2553 (defun gnus-summary-read-group-1 (group show-all no-article
2554 kill-buffer no-display
2555 &optional select-articles)
2556 ;; Killed foreign groups can't be entered.
2557 (when (and (not (gnus-group-native-p group))
2558 (not (gnus-gethash group gnus-newsrc-hashtb)))
2559 (error "Dead non-native groups can't be entered"))
2560 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2561 (let* ((new-group (gnus-summary-setup-buffer group))
2562 (quit-config (gnus-group-quit-config group))
2563 (did-select (and new-group (gnus-select-newsgroup
2564 group show-all select-articles))))
2566 ;; This summary buffer exists already, so we just select it.
2568 (gnus-set-global-variables)
2570 (gnus-kill-or-deaden-summary kill-buffer))
2571 (gnus-configure-windows 'summary 'force)
2572 (gnus-set-mode-line 'summary)
2573 (gnus-summary-position-point)
2576 ;; We couldn't select this group.
2578 (when (and (eq major-mode 'gnus-summary-mode)
2579 (not (equal (current-buffer) kill-buffer)))
2580 (kill-buffer (current-buffer))
2581 (if (not quit-config)
2583 ;; Update the info -- marks might need to be removed,
2585 (gnus-summary-update-info)
2586 (set-buffer gnus-group-buffer)
2587 (gnus-group-jump-to-group group)
2588 (gnus-group-next-unread-group 1))
2589 (gnus-handle-ephemeral-exit quit-config)))
2590 (gnus-message 3 "Can't select group")
2592 ;; The user did a `C-g' while prompting for number of articles,
2593 ;; so we exit this group.
2594 ((eq did-select 'quit)
2595 (and (eq major-mode 'gnus-summary-mode)
2596 (not (equal (current-buffer) kill-buffer))
2597 (kill-buffer (current-buffer)))
2599 (gnus-kill-or-deaden-summary kill-buffer))
2600 (if (not quit-config)
2602 (set-buffer gnus-group-buffer)
2603 (gnus-group-jump-to-group group)
2604 (gnus-group-next-unread-group 1)
2605 (gnus-configure-windows 'group 'force))
2606 (gnus-handle-ephemeral-exit quit-config))
2607 ;; Finally signal the quit.
2609 ;; The group was successfully selected.
2611 (gnus-set-global-variables)
2612 ;; Save the active value in effect when the group was entered.
2613 (setq gnus-newsgroup-active
2615 (gnus-active gnus-newsgroup-name)))
2616 ;; You can change the summary buffer in some way with this hook.
2617 (gnus-run-hooks 'gnus-select-group-hook)
2618 ;; Set any local variables in the group parameters.
2619 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2620 (gnus-update-format-specifications
2621 nil 'summary 'summary-mode 'summary-dummy)
2622 ;; Do score processing.
2623 (when gnus-use-scoring
2624 (gnus-possibly-score-headers))
2625 ;; Check whether to fill in the gaps in the threads.
2626 (when gnus-build-sparse-threads
2627 (gnus-build-sparse-threads))
2628 ;; Find the initial limit.
2629 (if gnus-show-threads
2631 (let ((gnus-newsgroup-dormant nil))
2632 (gnus-summary-initial-limit show-all))
2633 (gnus-summary-initial-limit show-all))
2634 (setq gnus-newsgroup-limit
2636 (lambda (header) (mail-header-number header))
2637 gnus-newsgroup-headers)))
2638 ;; Generate the summary buffer.
2640 (gnus-summary-prepare))
2641 (when gnus-use-trees
2642 (gnus-tree-open group)
2643 (setq gnus-summary-highlight-line-function
2644 'gnus-tree-highlight-article))
2645 ;; If the summary buffer is empty, but there are some low-scored
2646 ;; articles or some excluded dormants, we include these in the
2648 (when (and (zerop (buffer-size))
2650 (cond (gnus-newsgroup-dormant
2651 (gnus-summary-limit-include-dormant))
2652 ((and gnus-newsgroup-scored show-all)
2653 (gnus-summary-limit-include-expunged t))))
2654 ;; Function `gnus-apply-kill-file' must be called in this hook.
2655 (gnus-run-hooks 'gnus-apply-kill-hook)
2656 (if (and (zerop (buffer-size))
2659 ;; This newsgroup is empty.
2660 (gnus-summary-catchup-and-exit nil t)
2661 (gnus-message 6 "No unread news")
2663 (gnus-kill-or-deaden-summary kill-buffer))
2664 ;; Return nil from this function.
2666 ;; Hide conversation thread subtrees. We cannot do this in
2667 ;; gnus-summary-prepare-hook since kill processing may not
2668 ;; work with hidden articles.
2669 (and gnus-show-threads
2670 gnus-thread-hide-subtree
2671 (gnus-summary-hide-all-threads))
2673 (gnus-kill-or-deaden-summary kill-buffer))
2674 ;; Show first unread article if requested.
2675 (if (and (not no-article)
2677 gnus-newsgroup-unreads
2678 gnus-auto-select-first)
2679 (unless (if (eq gnus-auto-select-first 'best)
2680 (gnus-summary-best-unread-article)
2681 (gnus-summary-first-unread-article))
2682 (gnus-configure-windows 'summary))
2683 ;; Don't select any articles, just move point to the first
2684 ;; article in the group.
2685 (goto-char (point-min))
2686 (gnus-summary-position-point)
2687 (gnus-configure-windows 'summary 'force)
2688 (gnus-set-mode-line 'summary))
2689 (when (get-buffer-window gnus-group-buffer t)
2690 ;; Gotta use windows, because recenter does weird stuff if
2691 ;; the current buffer ain't the displayed window.
2692 (let ((owin (selected-window)))
2693 (select-window (get-buffer-window gnus-group-buffer t))
2694 (when (gnus-group-goto-group group)
2696 (select-window owin)))
2697 ;; Mark this buffer as "prepared".
2698 (setq gnus-newsgroup-prepared t)
2699 (gnus-run-hooks 'gnus-summary-prepared-hook)
2702 (defun gnus-summary-prepare ()
2703 "Generate the summary buffer."
2705 (let ((buffer-read-only nil))
2707 (setq gnus-newsgroup-data nil
2708 gnus-newsgroup-data-reverse nil)
2709 (gnus-run-hooks 'gnus-summary-generate-hook)
2710 ;; Generate the buffer, either with threads or without.
2711 (when gnus-newsgroup-headers
2712 (gnus-summary-prepare-threads
2713 (if gnus-show-threads
2714 (gnus-sort-gathered-threads
2715 (funcall gnus-summary-thread-gathering-function
2717 (gnus-cut-threads (gnus-make-threads)))))
2718 ;; Unthreaded display.
2719 (gnus-sort-articles gnus-newsgroup-headers))))
2720 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2721 ;; Call hooks for modifying summary buffer.
2722 (goto-char (point-min))
2723 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2725 (defsubst gnus-general-simplify-subject (subject)
2726 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2729 ;; Truncate the subject.
2730 (gnus-simplify-subject-functions
2731 (gnus-map-function gnus-simplify-subject-functions subject))
2732 ((numberp gnus-summary-gather-subject-limit)
2733 (setq subject (gnus-simplify-subject-re subject))
2734 (if (> (length subject) gnus-summary-gather-subject-limit)
2735 (substring subject 0 gnus-summary-gather-subject-limit)
2737 ;; Fuzzily simplify it.
2738 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2739 (gnus-simplify-subject-fuzzy subject))
2740 ;; Just remove the leading "Re:".
2742 (gnus-simplify-subject-re subject))))
2744 (if (and gnus-summary-gather-exclude-subject
2745 (string-match gnus-summary-gather-exclude-subject subject))
2746 nil ; This article shouldn't be gathered
2749 (defun gnus-summary-simplify-subject-query ()
2750 "Query where the respool algorithm would put this article."
2752 (gnus-summary-select-article)
2753 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2755 (defun gnus-gather-threads-by-subject (threads)
2756 "Gather threads by looking at Subject headers."
2757 (if (not gnus-summary-make-false-root)
2759 (let ((hashtb (gnus-make-hashtable 1024))
2762 subject hthread whole-subject)
2764 (setq subject (gnus-general-simplify-subject
2765 (setq whole-subject (mail-header-subject
2768 (if (setq hthread (gnus-gethash subject hashtb))
2770 ;; We enter a dummy root into the thread, if we
2771 ;; haven't done that already.
2772 (unless (stringp (caar hthread))
2773 (setcar hthread (list whole-subject (car hthread))))
2774 ;; We add this new gathered thread to this gathered
2776 (setcdr (car hthread)
2777 (nconc (cdar hthread) (list (car threads))))
2778 ;; Remove it from the list of threads.
2779 (setcdr prev (cdr threads))
2780 (setq threads prev))
2781 ;; Enter this thread into the hash table.
2782 (gnus-sethash subject threads hashtb)))
2784 (setq threads (cdr threads)))
2787 (defun gnus-gather-threads-by-references (threads)
2788 "Gather threads by looking at References headers."
2789 (let ((idhashtb (gnus-make-hashtable 1024))
2790 (thhashtb (gnus-make-hashtable 1024))
2793 ids references id gthread gid entered ref)
2795 (when (setq references (mail-header-references (caar threads)))
2796 (setq id (mail-header-id (caar threads))
2797 ids (gnus-split-references references)
2799 (while (setq ref (pop ids))
2800 (setq ids (delete ref ids))
2801 (if (not (setq gid (gnus-gethash ref idhashtb)))
2803 (gnus-sethash ref id idhashtb)
2804 (gnus-sethash id threads thhashtb))
2805 (setq gthread (gnus-gethash gid thhashtb))
2807 ;; We enter a dummy root into the thread, if we
2808 ;; haven't done that already.
2809 (unless (stringp (caar gthread))
2810 (setcar gthread (list (mail-header-subject (caar gthread))
2812 ;; We add this new gathered thread to this gathered
2814 (setcdr (car gthread)
2815 (nconc (cdar gthread) (list (car threads)))))
2816 ;; Add it into the thread hash table.
2817 (gnus-sethash id gthread thhashtb)
2819 ;; Remove it from the list of threads.
2820 (setcdr prev (cdr threads))
2821 (setq threads prev))))
2823 (setq threads (cdr threads)))
2826 (defun gnus-sort-gathered-threads (threads)
2827 "Sort subtreads inside each gathered thread by article number."
2828 (let ((result threads))
2830 (when (stringp (caar threads))
2831 (setcdr (car threads)
2832 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2833 (setq threads (cdr threads)))
2836 (defun gnus-thread-loop-p (root thread)
2837 "Say whether ROOT is in THREAD."
2838 (let ((stack (list thread))
2841 (while (setq thread (pop stack))
2842 (setq th (cdr thread))
2844 (not (eq (caar th) root)))
2847 ;; We have found a loop.
2849 (setcdr thread (delq (car th) (cdr thread)))
2850 (if (boundp (setq ref-dep (intern "none"
2851 gnus-newsgroup-dependencies)))
2852 (setcdr (symbol-value ref-dep)
2853 (nconc (cdr (symbol-value ref-dep))
2855 (set ref-dep (list nil (car th))))
2858 ;; Push all the subthreads onto the stack.
2859 (push (cdr thread) stack)))
2862 (defun gnus-make-threads ()
2863 "Go through the dependency hashtb and find the roots. Return all threads."
2865 (while (catch 'infloop
2868 ;; Deal with self-referencing References loops.
2869 (when (and (car (symbol-value refs))
2876 (car (symbol-value refs)) thread))
2877 (cdr (symbol-value refs)))))))
2880 (unless (car (symbol-value refs))
2881 ;; These threads do not refer back to any other articles,
2882 ;; so they're roots.
2883 (setq threads (append (cdr (symbol-value refs)) threads))))
2884 gnus-newsgroup-dependencies)))
2887 ;; Build the thread tree.
2888 (defun gnus-dependencies-add-header (header dependencies force-new)
2889 "Enter HEADER into the DEPENDENCIES table if it is not already there.
2891 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
2892 if it was already present.
2894 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
2895 will not be entered in the DEPENDENCIES table. Otherwise duplicate
2896 Message-IDs will be renamed be renamed to a unique Message-ID before
2899 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
2900 (let* ((id (mail-header-id header))
2901 (id-dep (and id (intern id dependencies)))
2902 ref ref-dep ref-header)
2903 ;; Enter this `header' in the `dependencies' table.
2907 ;; The first two cases do the normal part: enter a new `header'
2908 ;; in the `dependencies' table.
2909 ((not (boundp id-dep))
2910 (set id-dep (list header)))
2911 ((null (car (symbol-value id-dep)))
2912 (setcar (symbol-value id-dep) header))
2914 ;; From here the `header' was already present in the
2915 ;; `dependencies' table.
2917 ;; Overrides an existing entry;
2918 ;; just set the header part of the entry.
2919 (setcar (symbol-value id-dep) header))
2921 ;; Renames the existing `header' to a unique Message-ID.
2922 ((not gnus-summary-ignore-duplicates)
2923 ;; An article with this Message-ID has already been seen.
2924 ;; We rename the Message-ID.
2925 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
2927 (mail-header-set-id header id))
2929 ;; The last case ignores an existing entry, except it adds any
2930 ;; additional Xrefs (in case the two articles came from different
2932 ;; Also sets `header' to `nil' meaning that the `dependencies'
2933 ;; table was *not* modified.
2935 (mail-header-set-xref
2936 (car (symbol-value id-dep))
2937 (concat (or (mail-header-xref (car (symbol-value id-dep)))
2939 (or (mail-header-xref header) "")))
2943 ;; First check if that we are not creating a References loop.
2944 (setq ref (gnus-parent-id (mail-header-references header)))
2946 (setq ref-dep (intern-soft ref dependencies))
2948 (setq ref-header (car (symbol-value ref-dep))))
2949 (if (string= id ref)
2950 ;; Yuk! This is a reference loop. Make the article be a
2953 (mail-header-set-references (car (symbol-value id-dep)) "none")
2955 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
2956 (setq ref (gnus-parent-id (mail-header-references header)))
2957 (setq ref-dep (intern (or ref "none") dependencies))
2958 (if (boundp ref-dep)
2959 (setcdr (symbol-value ref-dep)
2960 (nconc (cdr (symbol-value ref-dep))
2961 (list (symbol-value id-dep))))
2962 (set ref-dep (list nil (symbol-value id-dep)))))
2965 (defun gnus-build-sparse-threads ()
2966 (let ((headers gnus-newsgroup-headers)
2967 (gnus-summary-ignore-duplicates t)
2968 header references generation relations
2969 subject child end new-child date)
2970 ;; First we create an alist of generations/relations, where
2971 ;; generations is how much we trust the relation, and the relation
2973 (gnus-message 7 "Making sparse threads...")
2975 (nnheader-set-temp-buffer " *gnus sparse threads*")
2976 (while (setq header (pop headers))
2977 (when (and (setq references (mail-header-references header))
2978 (not (string= references "")))
2980 (setq child (mail-header-id header)
2981 subject (mail-header-subject header)
2982 date (mail-header-date header)
2984 (while (search-backward ">" nil t)
2985 (setq end (1+ (point)))
2986 (when (search-backward "<" nil t)
2987 (setq new-child (buffer-substring (point) end))
2988 (push (list (incf generation)
2989 child (setq child new-child)
2993 (push (list (1+ generation) child nil subject) relations))
2995 (kill-buffer (current-buffer)))
2996 ;; Sort over trustworthiness.
2999 (when (gnus-dependencies-add-header
3000 (make-full-mail-header
3001 gnus-reffed-article-number
3002 (nth 3 relation) "" (or (nth 4 relation) "")
3004 (or (nth 2 relation) "") 0 0 "")
3005 gnus-newsgroup-dependencies nil)
3006 (push gnus-reffed-article-number gnus-newsgroup-limit)
3007 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3008 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3009 gnus-newsgroup-reads)
3010 (decf gnus-reffed-article-number)))
3011 (sort relations 'car-less-than-car))
3012 (gnus-message 7 "Making sparse threads...done")))
3014 (defun gnus-build-old-threads ()
3015 ;; Look at all the articles that refer back to old articles, and
3016 ;; fetch the headers for the articles that aren't there. This will
3017 ;; build complete threads - if the roots haven't been expired by the
3022 (when (not (car (symbol-value refs)))
3023 (setq heads (cdr (symbol-value refs)))
3025 (if (memq (mail-header-number (caar heads))
3026 gnus-newsgroup-dormant)
3027 (setq heads (cdr heads))
3028 (setq id (symbol-name refs))
3029 (while (and (setq id (gnus-build-get-header id))
3030 (not (car (gnus-id-to-thread id)))))
3031 (setq heads nil)))))
3032 gnus-newsgroup-dependencies)))
3034 ;; This function has to be called with point after the article number
3035 ;; on the beginning of the line.
3036 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3037 (let ((eol (gnus-point-at-eol))
3038 (buffer (current-buffer))
3041 ;; overview: [num subject from date id refs chars lines misc]
3044 (narrow-to-region (point) eol)
3049 (make-full-mail-header
3051 (nnheader-nov-field) ; subject
3052 (nnheader-nov-field) ; from
3053 (nnheader-nov-field) ; date
3054 (nnheader-nov-read-message-id) ; id
3055 (nnheader-nov-field) ; refs
3056 (nnheader-nov-read-integer) ; chars
3057 (nnheader-nov-read-integer) ; lines
3059 (nnheader-nov-field))))) ; misc
3063 (when gnus-alter-header-function
3064 (funcall gnus-alter-header-function header))
3065 (gnus-dependencies-add-header header dependencies force-new)))
3067 (defun gnus-build-get-header (id)
3068 ;; Look through the buffer of NOV lines and find the header to
3069 ;; ID. Enter this line into the dependencies hash table, and return
3070 ;; the id of the parent article (if any).
3071 (let ((deps gnus-newsgroup-dependencies)
3075 (set-buffer nntp-server-buffer)
3076 (let ((case-fold-search nil))
3077 (goto-char (point-min))
3078 (while (and (not found)
3079 (search-forward id nil t))
3081 (setq found (looking-at
3082 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3083 (regexp-quote id))))
3084 (or found (beginning-of-line 2)))
3088 (setq header (gnus-nov-parse-line
3089 (read (current-buffer)) deps))
3090 (gnus-parent-id (mail-header-references header))))))
3092 (let ((number (mail-header-number header)))
3093 (push number gnus-newsgroup-limit)
3094 (push header gnus-newsgroup-headers)
3095 (if (memq number gnus-newsgroup-unselected)
3097 (push number gnus-newsgroup-unreads)
3098 (setq gnus-newsgroup-unselected
3099 (delq number gnus-newsgroup-unselected)))
3100 (push number gnus-newsgroup-ancient)))))))
3102 (defun gnus-build-all-threads ()
3103 "Read all the headers."
3104 (let ((gnus-summary-ignore-duplicates t)
3105 (dependencies gnus-newsgroup-dependencies)
3108 (set-buffer nntp-server-buffer)
3109 (let ((case-fold-search nil))
3110 (goto-char (point-min))
3113 (setq article (read (current-buffer))
3114 header (gnus-nov-parse-line
3115 article dependencies)))
3118 (set-buffer gnus-summary-buffer)
3119 (push header gnus-newsgroup-headers)
3120 (if (memq (setq article (mail-header-number header))
3121 gnus-newsgroup-unselected)
3123 (push article gnus-newsgroup-unreads)
3124 (setq gnus-newsgroup-unselected
3125 (delq article gnus-newsgroup-unselected)))
3126 (push article gnus-newsgroup-ancient)))
3127 (forward-line 1)))))))
3129 (defun gnus-summary-update-article-line (article header)
3130 "Update the line for ARTICLE using HEADERS."
3131 (let* ((id (mail-header-id header))
3132 (thread (gnus-id-to-thread id)))
3134 (error "Article in no thread"))
3135 ;; Update the thread.
3136 (setcar thread header)
3137 (gnus-summary-goto-subject article)
3138 (let* ((datal (gnus-data-find-list article))
3140 (length (when (cdr datal)
3141 (- (gnus-data-pos data)
3142 (gnus-data-pos (cadr datal)))))
3143 (buffer-read-only nil)
3144 (level (gnus-summary-thread-level)))
3146 (gnus-summary-insert-line
3147 header level nil (gnus-article-mark article)
3148 (memq article gnus-newsgroup-replied)
3149 (memq article gnus-newsgroup-expirable)
3150 ;; Only insert the Subject string when it's different
3151 ;; from the previous Subject string.
3152 (if (gnus-subject-equal
3154 (mail-header-subject
3157 (gnus-data-find-list
3159 (gnus-data-list t)))))
3160 ;; Error on the side of excessive subjects.
3162 (mail-header-subject header))
3164 (mail-header-subject header))
3165 nil (cdr (assq article gnus-newsgroup-scored))
3166 (memq article gnus-newsgroup-processable))
3168 (gnus-data-update-list
3169 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3171 (defun gnus-summary-update-article (article &optional iheader)
3172 "Update ARTICLE in the summary buffer."
3173 (set-buffer gnus-summary-buffer)
3174 (let* ((header (gnus-summary-article-header article))
3175 (id (mail-header-id header))
3176 (data (gnus-data-find article))
3177 (thread (gnus-id-to-thread id))
3178 (references (mail-header-references header))
3182 (when (and references
3183 (not (equal "" references)))
3186 (buffer-read-only nil)
3192 (delq thread parent)))
3193 (if (gnus-summary-insert-subject id header)
3194 ;; Set the (possibly) new article number in the data structure.
3195 (gnus-data-set-number data (gnus-id-to-article id))
3199 (defun gnus-rebuild-thread (id &optional line)
3200 "Rebuild the thread containing ID.
3201 If LINE, insert the rebuilt thread starting on line LINE."
3202 (let ((buffer-read-only nil)
3203 old-pos current thread data)
3204 (if (not gnus-show-threads)
3205 (setq thread (list (car (gnus-id-to-thread id))))
3206 ;; Get the thread this article is part of.
3207 (setq thread (gnus-remove-thread id)))
3208 (setq old-pos (gnus-point-at-bol))
3209 (setq current (save-excursion
3210 (and (zerop (forward-line -1))
3211 (gnus-summary-article-number))))
3212 ;; If this is a gathered thread, we have to go some re-gathering.
3213 (when (stringp (car thread))
3214 (let ((subject (car thread))
3216 (setq thread (cdr thread))
3218 (unless (memq (setq thr (gnus-id-to-thread
3220 (mail-header-id (caar thread)))))
3223 (setq thread (cdr thread)))
3224 ;; We now have all (unique) roots.
3225 (if (= (length roots) 1)
3226 ;; All the loose roots are now one solid root.
3227 (setq thread (car roots))
3228 (setq thread (cons subject (gnus-sort-threads roots))))))
3230 ;; We then insert this thread into the summary buffer.
3232 (goto-char (point-min))
3233 (forward-line (1- line)))
3234 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3235 (if gnus-show-threads
3236 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3237 (gnus-summary-prepare-unthreaded thread))
3238 (setq data (nreverse gnus-newsgroup-data))
3239 (setq threads gnus-newsgroup-threads))
3240 ;; We splice the new data into the data structure.
3241 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3242 ;;!!! then we want to insert at the beginning of the buffer.
3243 ;;!!! That happens to be true with Gnus now, but that may
3244 ;;!!! change in the future. Perhaps.
3245 (gnus-data-enter-list
3246 (if line nil current) data (- (point) old-pos))
3247 (setq gnus-newsgroup-threads
3248 (nconc threads gnus-newsgroup-threads))
3249 (gnus-data-compute-positions))))
3251 (defun gnus-number-to-header (number)
3252 "Return the header for article NUMBER."
3253 (let ((headers gnus-newsgroup-headers))
3255 (not (= number (mail-header-number (car headers)))))
3260 (defun gnus-parent-headers (in-headers &optional generation)
3261 "Return the headers of the GENERATIONeth parent of HEADERS."
3263 (setq generation 1))
3265 (headers in-headers)
3268 (not (zerop generation))
3269 (setq references (mail-header-references headers)))
3270 (setq headers (if (and references
3271 (setq parent (gnus-parent-id references)))
3272 (car (gnus-id-to-thread parent))
3275 (and (not (eq headers in-headers))
3278 (defun gnus-id-to-thread (id)
3279 "Return the (sub-)thread where ID appears."
3280 (gnus-gethash id gnus-newsgroup-dependencies))
3282 (defun gnus-id-to-article (id)
3283 "Return the article number of ID."
3284 (let ((thread (gnus-id-to-thread id)))
3287 (mail-header-number (car thread)))))
3289 (defun gnus-id-to-header (id)
3290 "Return the article headers of ID."
3291 (car (gnus-id-to-thread id)))
3293 (defun gnus-article-displayed-root-p (article)
3294 "Say whether ARTICLE is a root(ish) article."
3295 (let ((level (gnus-summary-thread-level article))
3296 (refs (mail-header-references (gnus-summary-article-header article)))
3302 ((null (gnus-parent-id refs)) t)
3304 (null (setq particle (gnus-id-to-article
3305 (gnus-parent-id refs))))
3306 (null (gnus-summary-thread-level particle)))))))
3308 (defun gnus-root-id (id)
3309 "Return the id of the root of the thread where ID appears."
3311 (while (and id (setq prev (car (gnus-id-to-thread id))))
3313 id (gnus-parent-id (mail-header-references prev))))
3316 (defun gnus-articles-in-thread (thread)
3317 "Return the list of articles in THREAD."
3318 (cons (mail-header-number (car thread))
3319 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3321 (defun gnus-remove-thread (id &optional dont-remove)
3322 "Remove the thread that has ID in it."
3323 (let (headers thread last-id)
3324 ;; First go up in this thread until we find the root.
3325 (setq last-id (gnus-root-id id)
3326 headers (message-flatten-list (gnus-id-to-thread last-id)))
3327 ;; We have now found the real root of this thread. It might have
3328 ;; been gathered into some loose thread, so we have to search
3329 ;; through the threads to find the thread we wanted.
3330 (let ((threads gnus-newsgroup-threads)
3333 (setq sub (car threads))
3334 (if (stringp (car sub))
3335 ;; This is a gathered thread, so we look at the roots
3336 ;; below it to find whether this article is in this
3339 (setq sub (cdr sub))
3341 (when (member (caar sub) headers)
3342 (setq thread (car threads)
3345 (setq sub (cdr sub))))
3346 ;; It's an ordinary thread, so we check it.
3347 (when (eq (car sub) (car headers))
3350 (setq threads (cdr threads)))
3351 ;; If this article is in no thread, then it's a root.
3354 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3355 (setq thread (gnus-id-to-thread last-id)))
3358 thread ; We return this thread.
3360 (if (stringp (car thread))
3362 ;; If we use dummy roots, then we have to remove the
3363 ;; dummy root as well.
3364 (when (eq gnus-summary-make-false-root 'dummy)
3365 ;; We go to the dummy root by going to
3366 ;; the first sub-"thread", and then one line up.
3367 (gnus-summary-goto-article
3368 (mail-header-number (caadr thread)))
3371 (gnus-data-compute-positions))
3372 (setq thread (cdr thread))
3374 (gnus-remove-thread-1 (car thread))
3375 (setq thread (cdr thread))))
3376 (gnus-summary-show-all-threads)
3377 (gnus-remove-thread-1 thread))))))))
3379 (defun gnus-remove-thread-1 (thread)
3380 "Remove the thread THREAD recursively."
3381 (let ((number (mail-header-number (pop thread)))
3383 (setq thread (reverse thread))
3385 (gnus-remove-thread-1 (pop thread)))
3386 (when (setq d (gnus-data-find number))
3387 (goto-char (gnus-data-pos d))
3390 (- (gnus-point-at-bol)
3392 (1+ (gnus-point-at-eol))
3393 (gnus-delete-line)))))))
3395 (defun gnus-sort-threads (threads)
3397 (if (not gnus-thread-sort-functions)
3399 (gnus-message 8 "Sorting threads...")
3401 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3402 (gnus-message 8 "Sorting threads...done"))))
3404 (defun gnus-sort-articles (articles)
3406 (when gnus-article-sort-functions
3407 (gnus-message 7 "Sorting articles...")
3409 (setq gnus-newsgroup-headers
3410 (sort articles (gnus-make-sort-function
3411 gnus-article-sort-functions)))
3412 (gnus-message 7 "Sorting articles...done"))))
3414 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3415 (defmacro gnus-thread-header (thread)
3416 ;; Return header of first article in THREAD.
3417 ;; Note that THREAD must never, ever be anything else than a variable -
3418 ;; using some other form will lead to serious barfage.
3419 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3420 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3421 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3424 (defsubst gnus-article-sort-by-number (h1 h2)
3425 "Sort articles by article number."
3426 (< (mail-header-number h1)
3427 (mail-header-number h2)))
3429 (defun gnus-thread-sort-by-number (h1 h2)
3430 "Sort threads by root article number."
3431 (gnus-article-sort-by-number
3432 (gnus-thread-header h1) (gnus-thread-header h2)))
3434 (defsubst gnus-article-sort-by-lines (h1 h2)
3435 "Sort articles by article Lines header."
3436 (< (mail-header-lines h1)
3437 (mail-header-lines h2)))
3439 (defun gnus-thread-sort-by-lines (h1 h2)
3440 "Sort threads by root article Lines header."
3441 (gnus-article-sort-by-lines
3442 (gnus-thread-header h1) (gnus-thread-header h2)))
3444 (defsubst gnus-article-sort-by-author (h1 h2)
3445 "Sort articles by root author."
3447 (let ((addr (car (mime-read-field 'From h1))))
3448 (or (std11-full-name-string addr)
3449 (std11-address-string addr)
3451 (let ((addr (car (mime-read-field 'From h2))))
3452 (or (std11-full-name-string addr)
3453 (std11-address-string addr)
3457 (defun gnus-thread-sort-by-author (h1 h2)
3458 "Sort threads by root author."
3459 (gnus-article-sort-by-author
3460 (gnus-thread-header h1) (gnus-thread-header h2)))
3462 (defsubst gnus-article-sort-by-subject (h1 h2)
3463 "Sort articles by root subject."
3465 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3466 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3468 (defun gnus-thread-sort-by-subject (h1 h2)
3469 "Sort threads by root subject."
3470 (gnus-article-sort-by-subject
3471 (gnus-thread-header h1) (gnus-thread-header h2)))
3473 (defsubst gnus-article-sort-by-date (h1 h2)
3474 "Sort articles by root article date."
3476 (gnus-date-get-time (mail-header-date h1))
3477 (gnus-date-get-time (mail-header-date h2))))
3479 (defun gnus-thread-sort-by-date (h1 h2)
3480 "Sort threads by root article date."
3481 (gnus-article-sort-by-date
3482 (gnus-thread-header h1) (gnus-thread-header h2)))
3484 (defsubst gnus-article-sort-by-score (h1 h2)
3485 "Sort articles by root article score.
3486 Unscored articles will be counted as having a score of zero."
3487 (> (or (cdr (assq (mail-header-number h1)
3488 gnus-newsgroup-scored))
3489 gnus-summary-default-score 0)
3490 (or (cdr (assq (mail-header-number h2)
3491 gnus-newsgroup-scored))
3492 gnus-summary-default-score 0)))
3494 (defun gnus-thread-sort-by-score (h1 h2)
3495 "Sort threads by root article score."
3496 (gnus-article-sort-by-score
3497 (gnus-thread-header h1) (gnus-thread-header h2)))
3499 (defun gnus-thread-sort-by-total-score (h1 h2)
3500 "Sort threads by the sum of all scores in the thread.
3501 Unscored articles will be counted as having a score of zero."
3502 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3504 (defun gnus-thread-total-score (thread)
3505 ;; This function find the total score of THREAD.
3506 (cond ((null thread)
3509 (if (stringp (car thread))
3510 (apply gnus-thread-score-function 0
3511 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3512 (gnus-thread-total-score-1 thread)))
3514 (gnus-thread-total-score-1 (list thread)))))
3516 (defun gnus-thread-total-score-1 (root)
3517 ;; This function find the total score of the thread below ROOT.
3518 (setq root (car root))
3519 (apply gnus-thread-score-function
3521 (mapcar 'gnus-thread-total-score
3522 (cdr (gnus-id-to-thread (mail-header-id root))))
3523 (when (> (mail-header-number root) 0)
3524 (list (or (cdr (assq (mail-header-number root)
3525 gnus-newsgroup-scored))
3526 gnus-summary-default-score 0))))
3527 (list gnus-summary-default-score)
3530 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3531 (defvar gnus-tmp-prev-subject nil)
3532 (defvar gnus-tmp-false-parent nil)
3533 (defvar gnus-tmp-root-expunged nil)
3534 (defvar gnus-tmp-dummy-line nil)
3536 (defun gnus-summary-prepare-threads (threads)
3537 "Prepare summary buffer from THREADS and indentation LEVEL.
3538 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3539 or a straight list of headers."
3540 (gnus-message 7 "Generating summary...")
3542 (setq gnus-newsgroup-threads threads)
3545 (let ((gnus-tmp-level 0)
3546 (default-score (or gnus-summary-default-score 0))
3547 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3548 thread number subject stack state gnus-tmp-gathered beg-match
3549 new-roots gnus-tmp-new-adopts thread-end
3550 gnus-tmp-header gnus-tmp-unread
3551 gnus-tmp-replied gnus-tmp-subject-or-nil
3552 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3553 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3554 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3556 (setq gnus-tmp-prev-subject nil)
3558 (if (vectorp (car threads))
3559 ;; If this is a straight (sic) list of headers, then a
3560 ;; threaded summary display isn't required, so we just create
3561 ;; an unthreaded one.
3562 (gnus-summary-prepare-unthreaded threads)
3564 ;; Do the threaded display.
3566 (while (or threads stack gnus-tmp-new-adopts new-roots)
3568 (if (and (= gnus-tmp-level 0)
3571 (not gnus-tmp-false-parent)
3572 (or gnus-tmp-new-adopts new-roots))
3573 (if gnus-tmp-new-adopts
3574 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3575 thread (list (car gnus-tmp-new-adopts))
3576 gnus-tmp-header (caar thread)
3577 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3579 (setq thread (list (car new-roots))
3580 gnus-tmp-header (caar thread)
3581 new-roots (cdr new-roots))))
3584 ;; If there are some threads, we do them before the
3585 ;; threads on the stack.
3586 (setq thread threads
3587 gnus-tmp-header (caar thread))
3588 ;; There were no current threads, so we pop something off
3590 (setq state (car stack)
3591 gnus-tmp-level (car state)
3594 gnus-tmp-header (caar thread))))
3596 (setq gnus-tmp-false-parent nil)
3597 (setq gnus-tmp-root-expunged nil)
3598 (setq thread-end nil)
3600 (if (stringp gnus-tmp-header)
3601 ;; The header is a dummy root.
3603 ((eq gnus-summary-make-false-root 'adopt)
3604 ;; We let the first article adopt the rest.
3605 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3607 (setq gnus-tmp-gathered
3609 (lambda (h) (mail-header-number (car h)))
3612 (setq thread (cons (list (caar thread)
3615 (setq gnus-tmp-level -1
3616 gnus-tmp-false-parent t))
3617 ((eq gnus-summary-make-false-root 'empty)
3618 ;; We print adopted articles with empty subject fields.
3619 (setq gnus-tmp-gathered
3621 (lambda (h) (mail-header-number (car h)))
3624 (setq gnus-tmp-level -1))
3625 ((eq gnus-summary-make-false-root 'dummy)
3626 ;; We remember that we probably want to output a dummy
3628 (setq gnus-tmp-dummy-line gnus-tmp-header)
3629 (setq gnus-tmp-prev-subject gnus-tmp-header))
3631 ;; We do not make a root for the gathered
3632 ;; sub-threads at all.
3633 (setq gnus-tmp-level -1)))
3635 (setq number (mail-header-number gnus-tmp-header)
3636 subject (mail-header-subject gnus-tmp-header))
3639 ;; If the thread has changed subject, we might want to make
3640 ;; this subthread into a root.
3641 ((and (null gnus-thread-ignore-subject)
3642 (not (zerop gnus-tmp-level))
3643 gnus-tmp-prev-subject
3645 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3646 (setq new-roots (nconc new-roots (list (car thread)))
3648 gnus-tmp-header nil))
3649 ;; If the article lies outside the current limit,
3650 ;; then we do not display it.
3651 ((not (memq number gnus-newsgroup-limit))
3652 (setq gnus-tmp-gathered
3654 (lambda (h) (mail-header-number (car h)))
3657 (setq gnus-tmp-new-adopts (if (cdar thread)
3658 (append gnus-tmp-new-adopts
3660 gnus-tmp-new-adopts)
3662 gnus-tmp-header nil)
3663 (when (zerop gnus-tmp-level)
3664 (setq gnus-tmp-root-expunged t)))
3665 ;; Perhaps this article is to be marked as read?
3666 ((and gnus-summary-mark-below
3667 (< (or (cdr (assq number gnus-newsgroup-scored))
3669 gnus-summary-mark-below)
3670 ;; Don't touch sparse articles.
3671 (not (gnus-summary-article-sparse-p number))
3672 (not (gnus-summary-article-ancient-p number)))
3673 (setq gnus-newsgroup-unreads
3674 (delq number gnus-newsgroup-unreads))
3675 (if gnus-newsgroup-auto-expire
3676 (push number gnus-newsgroup-expirable)
3677 (push (cons number gnus-low-score-mark)
3678 gnus-newsgroup-reads))))
3680 (when gnus-tmp-header
3681 ;; We may have an old dummy line to output before this
3683 (when (and gnus-tmp-dummy-line
3686 (mail-header-subject gnus-tmp-header)))
3687 (gnus-summary-insert-dummy-line
3688 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3689 (setq gnus-tmp-dummy-line nil))
3691 ;; Compute the mark.
3692 (setq gnus-tmp-unread (gnus-article-mark number))
3694 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3695 gnus-tmp-header gnus-tmp-level)
3696 gnus-newsgroup-data)
3698 ;; Actually insert the line.
3700 gnus-tmp-subject-or-nil
3702 ((and gnus-thread-ignore-subject
3703 gnus-tmp-prev-subject
3704 (not (inline (gnus-subject-equal
3705 gnus-tmp-prev-subject subject))))
3707 ((zerop gnus-tmp-level)
3708 (if (and (eq gnus-summary-make-false-root 'empty)
3709 (memq number gnus-tmp-gathered)
3710 gnus-tmp-prev-subject
3711 (inline (gnus-subject-equal
3712 gnus-tmp-prev-subject subject)))
3713 gnus-summary-same-subject
3715 (t gnus-summary-same-subject)))
3716 (if (and (eq gnus-summary-make-false-root 'adopt)
3717 (= gnus-tmp-level 1)
3718 (memq number gnus-tmp-gathered))
3719 (setq gnus-tmp-opening-bracket ?\<
3720 gnus-tmp-closing-bracket ?\>)
3721 (setq gnus-tmp-opening-bracket ?\[
3722 gnus-tmp-closing-bracket ?\]))
3724 gnus-tmp-indentation
3725 (aref gnus-thread-indent-array gnus-tmp-level)
3726 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3727 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3728 gnus-summary-default-score 0)
3730 (if (or (null gnus-summary-default-score)
3731 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3732 gnus-summary-zcore-fuzz))
3734 (if (< gnus-tmp-score gnus-summary-default-score)
3735 gnus-score-below-mark gnus-score-over-mark))
3737 (cond ((memq number gnus-newsgroup-processable)
3739 ((memq number gnus-newsgroup-cached)
3741 ((memq number gnus-newsgroup-replied)
3743 ((memq number gnus-newsgroup-saved)
3745 (t gnus-unread-mark))
3746 gnus-tmp-from (mail-header-from gnus-tmp-header)
3749 ((string-match "<[^>]+> *$" gnus-tmp-from)
3750 (setq beg-match (match-beginning 0))
3751 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3752 (substring gnus-tmp-from (1+ (match-beginning 0))
3753 (1- (match-end 0))))
3754 (substring gnus-tmp-from 0 beg-match)))
3755 ((string-match "(.+)" gnus-tmp-from)
3756 (substring gnus-tmp-from
3757 (1+ (match-beginning 0)) (1- (match-end 0))))
3759 (when (string= gnus-tmp-name "")
3760 (setq gnus-tmp-name gnus-tmp-from))
3761 (unless (numberp gnus-tmp-lines)
3762 (setq gnus-tmp-lines 0))
3763 (gnus-put-text-property-excluding-characters-with-faces
3765 (progn (eval gnus-summary-line-format-spec) (point))
3766 'gnus-number number)
3769 (gnus-run-hooks 'gnus-summary-update-hook)
3772 (setq gnus-tmp-prev-subject subject)))
3774 (when (nth 1 thread)
3775 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3776 (incf gnus-tmp-level)
3777 (setq threads (if thread-end nil (cdar thread)))
3779 (setq gnus-tmp-level 0)))))
3780 (gnus-message 7 "Generating summary...done"))
3782 (defun gnus-summary-prepare-unthreaded (headers)
3783 "Generate an unthreaded summary buffer based on HEADERS."
3784 (let (header number mark)
3789 ;; We may have to root out some bad articles...
3790 (when (memq (setq number (mail-header-number
3791 (setq header (pop headers))))
3792 gnus-newsgroup-limit)
3793 ;; Mark article as read when it has a low score.
3794 (when (and gnus-summary-mark-below
3795 (< (or (cdr (assq number gnus-newsgroup-scored))
3796 gnus-summary-default-score 0)
3797 gnus-summary-mark-below)
3798 (not (gnus-summary-article-ancient-p number)))
3799 (setq gnus-newsgroup-unreads
3800 (delq number gnus-newsgroup-unreads))
3801 (if gnus-newsgroup-auto-expire
3802 (push number gnus-newsgroup-expirable)
3803 (push (cons number gnus-low-score-mark)
3804 gnus-newsgroup-reads)))
3806 (setq mark (gnus-article-mark number))
3807 (push (gnus-data-make number mark (1+ (point)) header 0)
3808 gnus-newsgroup-data)
3809 (gnus-summary-insert-line
3811 mark (memq number gnus-newsgroup-replied)
3812 (memq number gnus-newsgroup-expirable)
3813 (mail-header-subject header) nil
3814 (cdr (assq number gnus-newsgroup-scored))
3815 (memq number gnus-newsgroup-processable))))))
3817 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3818 "Select newsgroup GROUP.
3819 If READ-ALL is non-nil, all articles in the group are selected.
3820 If SELECT-ARTICLES, only select those articles from GROUP."
3821 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3822 ;;!!! Dirty hack; should be removed.
3823 (gnus-summary-ignore-duplicates
3824 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3826 gnus-summary-ignore-duplicates))
3827 (info (nth 2 entry))
3828 articles fetched-articles cached)
3830 (unless (gnus-check-server
3831 (setq gnus-current-select-method
3832 (gnus-find-method-for-group group)))
3833 (error "Couldn't open server"))
3835 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3836 (gnus-activate-group group) ; Or we can activate it...
3837 (progn ; Or we bug out.
3838 (when (equal major-mode 'gnus-summary-mode)
3839 (kill-buffer (current-buffer)))
3840 (error "Couldn't request group %s: %s"
3841 group (gnus-status-message group))))
3843 (unless (gnus-request-group group t)
3844 (when (equal major-mode 'gnus-summary-mode)
3845 (kill-buffer (current-buffer)))
3846 (error "Couldn't request group %s: %s"
3847 group (gnus-status-message group)))
3849 (setq gnus-newsgroup-name group)
3850 (setq gnus-newsgroup-unselected nil)
3851 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3853 ;; Adjust and set lists of article marks.
3855 (gnus-adjust-marked-articles info))
3857 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3858 (when (gnus-virtual-group-p group)
3859 (setq cached gnus-newsgroup-cached))
3861 (setq gnus-newsgroup-unreads
3862 (gnus-set-difference
3863 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3864 gnus-newsgroup-dormant))
3866 (setq gnus-newsgroup-processable nil)
3868 (gnus-update-read-articles group gnus-newsgroup-unreads)
3870 (if (setq articles select-articles)
3871 (setq gnus-newsgroup-unselected
3872 (gnus-sorted-intersection
3873 gnus-newsgroup-unreads
3874 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3875 (setq articles (gnus-articles-to-read group read-all)))
3879 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3881 ((eq articles 0) nil)
3883 ;; Init the dependencies hash table.
3884 (setq gnus-newsgroup-dependencies
3885 (gnus-make-hashtable (length articles)))
3886 ;; Retrieve the headers and read them in.
3887 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3888 (setq gnus-newsgroup-headers
3890 (setq gnus-headers-retrieved-by
3891 (gnus-retrieve-headers
3892 articles gnus-newsgroup-name
3893 ;; We might want to fetch old headers, but
3894 ;; not if there is only 1 article.
3896 (not (eq gnus-fetch-old-headers 'some))
3897 (not (numberp gnus-fetch-old-headers)))
3898 (> (length articles) 1))
3899 gnus-fetch-old-headers))))
3900 (gnus-get-newsgroup-headers-xover
3901 articles nil nil gnus-newsgroup-name t)
3902 (gnus-get-newsgroup-headers)))
3903 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3905 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3907 (setq gnus-newsgroup-cached cached))
3909 ;; Suppress duplicates?
3910 (when gnus-suppress-duplicates
3911 (gnus-dup-suppress-articles))
3913 ;; Set the initial limit.
3914 (setq gnus-newsgroup-limit (copy-sequence articles))
3915 ;; Remove canceled articles from the list of unread articles.
3916 (setq gnus-newsgroup-unreads
3917 (gnus-set-sorted-intersection
3918 gnus-newsgroup-unreads
3919 (setq fetched-articles
3920 (mapcar (lambda (headers) (mail-header-number headers))
3921 gnus-newsgroup-headers))))
3922 ;; Removed marked articles that do not exist.
3923 (gnus-update-missing-marks
3924 (gnus-sorted-complement fetched-articles articles))
3925 ;; We might want to build some more threads first.
3926 (when (and gnus-fetch-old-headers
3927 (eq gnus-headers-retrieved-by 'nov))
3928 (if (eq gnus-fetch-old-headers 'invisible)
3929 (gnus-build-all-threads)
3930 (gnus-build-old-threads)))
3931 ;; Let the Gnus agent mark articles as read.
3933 (gnus-agent-get-undownloaded-list))
3934 ;; Check whether auto-expire is to be done in this group.
3935 (setq gnus-newsgroup-auto-expire
3936 (gnus-group-auto-expirable-p group))
3937 ;; Set up the article buffer now, if necessary.
3938 (unless gnus-single-article-buffer
3939 (gnus-article-setup-buffer))
3940 ;; First and last article in this newsgroup.
3941 (when gnus-newsgroup-headers
3942 (setq gnus-newsgroup-begin
3943 (mail-header-number (car gnus-newsgroup-headers))
3946 (gnus-last-element gnus-newsgroup-headers))))
3947 ;; GROUP is successfully selected.
3948 (or gnus-newsgroup-headers t)))))
3950 (defun gnus-articles-to-read (group &optional read-all)
3951 ;; Find out what articles the user wants to read.
3953 ;; Select all articles if `read-all' is non-nil, or if there
3954 ;; are no unread articles.
3956 (and (zerop (length gnus-newsgroup-marked))
3957 (zerop (length gnus-newsgroup-unreads)))
3958 (eq (gnus-group-find-parameter group 'display)
3960 (gnus-uncompress-range (gnus-active group))
3961 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3962 (copy-sequence gnus-newsgroup-unreads))
3964 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3965 (scored (length scored-list))
3966 (number (length articles))
3967 (marked (+ (length gnus-newsgroup-marked)
3968 (length gnus-newsgroup-dormant)))
3976 ((and (or (<= scored marked) (= scored number))
3977 (natnump gnus-large-newsgroup)
3978 (> number gnus-large-newsgroup))
3979 (let* ((minibuffer-setup-hook (append
3980 minibuffer-setup-hook
3981 '(beginning-of-line)))
3984 "How many articles from %s (max %d): "
3985 (gnus-limit-string gnus-newsgroup-name 35)
3987 (number-to-string gnus-large-newsgroup))))
3988 (if (string-match "^[ \t]*$" input)
3991 ((and (> scored marked) (< scored number)
3992 (> (- scored number) 20))
3995 (format "%s %s (%d scored, %d total): "
3996 "How many articles from"
3997 group scored number))))
3998 (if (string-match "^[ \t]*$" input)
4002 (setq select (if (stringp select) (string-to-number select) select))
4003 (if (or (null select) (zerop select))
4005 (if (and (not (zerop scored)) (<= (abs select) scored))
4007 (setq articles (sort scored-list '<))
4008 (setq number (length articles)))
4009 (setq articles (copy-sequence articles)))
4011 (when (< (abs select) number)
4013 ;; Select the N oldest articles.
4014 (setcdr (nthcdr (1- (abs select)) articles) nil)
4015 ;; Select the N most recent articles.
4016 (setq articles (nthcdr (- number select) articles))))
4017 (setq gnus-newsgroup-unselected
4018 (gnus-sorted-intersection
4019 gnus-newsgroup-unreads
4020 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4023 (defun gnus-killed-articles (killed articles)
4026 (when (inline (gnus-member-of-range (car articles) killed))
4027 (push (car articles) out))
4028 (setq articles (cdr articles)))
4031 (defun gnus-uncompress-marks (marks)
4032 "Uncompress the mark ranges in MARKS."
4033 (let ((uncompressed '(score bookmark))
4036 (if (memq (caar marks) uncompressed)
4037 (push (car marks) out)
4038 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4039 (setq marks (cdr marks)))
4042 (defun gnus-adjust-marked-articles (info)
4043 "Set all article lists and remove all marks that are no longer legal."
4044 (let* ((marked-lists (gnus-info-marks info))
4045 (active (gnus-active (gnus-info-group info)))
4048 (types gnus-article-mark-lists)
4049 (uncompressed '(score bookmark killed))
4050 marks var articles article mark)
4053 (setq marks (pop marked-lists))
4054 (set (setq var (intern (format "gnus-newsgroup-%s"
4055 (car (rassq (setq mark (car marks))
4057 (if (memq (car marks) uncompressed) (cdr marks)
4058 (gnus-uncompress-range (cdr marks))))
4060 (setq articles (symbol-value var))
4062 ;; All articles have to be subsets of the active articles.
4064 ;; Adjust "simple" lists.
4065 ((memq mark '(tick dormant expire reply save))
4067 (when (or (< (setq article (pop articles)) min) (> article max))
4068 (set var (delq article (symbol-value var))))))
4070 ((memq mark uncompressed)
4071 (when (not (listp (cdr (symbol-value var))))
4072 (set var (list (symbol-value var))))
4073 (when (not (listp (cdr articles)))
4074 (setq articles (list articles)))
4076 (when (or (not (consp (setq article (pop articles))))
4077 (< (car article) min)
4078 (> (car article) max))
4079 (set var (delq article (symbol-value var))))))))))
4081 (defun gnus-update-missing-marks (missing)
4082 "Go through the list of MISSING articles and remove them from the mark lists."
4084 (let ((types gnus-article-mark-lists)
4086 ;; Go through all types.
4088 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4089 (when (symbol-value var)
4090 ;; This list has articles. So we delete all missing articles
4094 (set var (delq (pop m) (symbol-value var)))))))))
4096 (defun gnus-update-marks ()
4097 "Enter the various lists of marked articles into the newsgroup info list."
4098 (let ((types gnus-article-mark-lists)
4099 (info (gnus-get-info gnus-newsgroup-name))
4100 (uncompressed '(score bookmark killed))
4101 type list newmarked symbol)
4103 ;; Add all marks lists that are non-nil to the list of marks lists.
4104 (while (setq type (pop types))
4105 (when (setq list (symbol-value
4107 (intern (format "gnus-newsgroup-%s"
4110 ;; Get rid of the entries of the articles that have the
4112 (when (and (eq (cdr type) 'score)
4116 (prev (cons nil list))
4119 (if (or (not (consp (car arts)))
4120 (= (cdar arts) gnus-summary-default-score))
4121 (setcdr prev (cdr arts))
4123 (setq arts (cdr arts)))
4124 (setq list (cdr all))))
4126 (push (cons (cdr type)
4127 (if (memq (cdr type) uncompressed) list
4128 (gnus-compress-sequence
4129 (set symbol (sort list '<)) t)))
4132 ;; Enter these new marks into the info of the group.
4134 (setcar (nthcdr 3 info) newmarked)
4135 ;; Add the marks lists to the end of the info.
4137 (setcdr (nthcdr 2 info) (list newmarked))))
4139 ;; Cut off the end of the info if there's nothing else there.
4143 (when (nthcdr (decf i) info)
4144 (setcdr (nthcdr i info) nil)))))))
4146 (defun gnus-set-mode-line (where)
4147 "This function sets the mode line of the article or summary buffers.
4148 If WHERE is `summary', the summary mode line format will be used."
4149 ;; Is this mode line one we keep updated?
4150 (when (memq where gnus-updated-mode-lines)
4153 ;; We evaluate this in the summary buffer since these
4154 ;; variables are buffer-local to that buffer.
4155 (set-buffer gnus-summary-buffer)
4156 ;; We bind all these variables that are used in the `eval' form
4158 (let* ((mformat (symbol-value
4160 (format "gnus-%s-mode-line-format-spec" where))))
4161 (gnus-tmp-group-name gnus-newsgroup-name)
4162 (gnus-tmp-article-number (or gnus-current-article 0))
4163 (gnus-tmp-unread gnus-newsgroup-unreads)
4164 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4165 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4166 (gnus-tmp-unread-and-unselected
4167 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4168 (zerop gnus-tmp-unselected))
4170 ((zerop gnus-tmp-unselected)
4171 (format "{%d more}" gnus-tmp-unread-and-unticked))
4172 (t (format "{%d(+%d) more}"
4173 gnus-tmp-unread-and-unticked
4174 gnus-tmp-unselected))))
4176 (if (and gnus-current-headers
4177 (vectorp gnus-current-headers))
4178 (gnus-mode-string-quote
4179 (mail-header-subject gnus-current-headers))
4181 bufname-length max-len
4182 gnus-tmp-header);; passed as argument to any user-format-funcs
4183 (setq mode-string (eval mformat))
4184 (setq bufname-length (if (string-match "%b" mode-string)
4187 (if (eq where 'summary)
4189 (get-buffer gnus-article-buffer))))
4192 (setq max-len (max 4 (if gnus-mode-non-string-length
4194 gnus-mode-non-string-length
4196 (length mode-string))))
4197 ;; We might have to chop a bit of the string off...
4198 (when (> (length mode-string) max-len)
4200 (concat (gnus-truncate-string mode-string (- max-len 3))
4202 ;; Pad the mode string a bit.
4203 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4204 ;; Update the mode line.
4205 (setq mode-line-buffer-identification
4206 (gnus-mode-line-buffer-identification (list mode-string)))
4207 (set-buffer-modified-p t))))
4209 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4210 "Go through the HEADERS list and add all Xrefs to a hash table.
4211 The resulting hash table is returned, or nil if no Xrefs were found."
4212 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4213 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4214 (xref-hashtb (gnus-make-hashtable))
4215 start group entry number xrefs header)
4217 (setq header (pop headers))
4218 (when (and (setq xrefs (mail-header-xref header))
4219 (not (memq (setq number (mail-header-number header))
4222 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4223 (setq start (match-end 0))
4224 (setq group (if prefix
4225 (concat prefix (substring xrefs (match-beginning 1)
4227 (substring xrefs (match-beginning 1) (match-end 1))))
4229 (string-to-int (substring xrefs (match-beginning 2)
4231 (if (setq entry (gnus-gethash group xref-hashtb))
4232 (setcdr entry (cons number (cdr entry)))
4233 (gnus-sethash group (cons number nil) xref-hashtb)))))
4234 (and start xref-hashtb)))
4236 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4237 "Look through all the headers and mark the Xrefs as read."
4238 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4239 name entry info xref-hashtb idlist method nth4)
4241 (set-buffer gnus-group-buffer)
4242 (when (setq xref-hashtb
4243 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4246 (unless (string= from-newsgroup (setq name (symbol-name group)))
4247 (setq idlist (symbol-value group))
4248 ;; Dead groups are not updated.
4250 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4252 (when (stringp (setq nth4 (gnus-info-method info)))
4253 (setq nth4 (gnus-server-to-method nth4))))
4254 ;; Only do the xrefs if the group has the same
4255 ;; select method as the group we have just read.
4256 (or (gnus-methods-equal-p
4257 nth4 (gnus-find-method-for-group from-newsgroup))
4259 (equal nth4 (setq method (gnus-find-method-for-group
4261 (and (equal (car nth4) (car method))
4262 (equal (nth 1 nth4) (nth 1 method))))
4263 gnus-use-cross-reference
4264 (or (not (eq gnus-use-cross-reference t))
4266 ;; Only do cross-references on subscribed
4267 ;; groups, if that is what is wanted.
4268 (<= (gnus-info-level info) gnus-level-subscribed))
4269 (gnus-group-make-articles-read name idlist))))
4272 (defun gnus-compute-read-articles (group articles)
4273 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4274 (info (nth 2 entry))
4275 (active (gnus-active group))
4278 ;; First peel off all illegal article numbers.
4280 (let ((ids articles)
4282 (while (setq id (pop ids))
4283 (when (and first (> id (cdr active)))
4284 ;; We'll end up in this situation in one particular
4285 ;; obscure situation. If you re-scan a group and get
4286 ;; a new article that is cross-posted to a different
4287 ;; group that has not been re-scanned, you might get
4288 ;; crossposted article that has a higher number than
4289 ;; Gnus believes possible. So we re-activate this
4290 ;; group as well. This might mean doing the
4291 ;; crossposting thingy will *increase* the number
4292 ;; of articles in some groups. Tsk, tsk.
4293 (setq active (or (gnus-activate-group group) active)))
4294 (when (or (> id (cdr active))
4295 (< id (car active)))
4296 (setq articles (delq id articles))))))
4297 ;; If the read list is nil, we init it.
4299 (null (gnus-info-read info))
4301 (setq ninfo (cons 1 (1- (car active))))
4302 (setq ninfo (gnus-info-read info)))
4303 ;; Then we add the read articles to the range.
4305 ninfo (setq articles (sort articles '<))))))
4307 (defun gnus-group-make-articles-read (group articles)
4308 "Update the info of GROUP to say that ARTICLES are read."
4310 (entry (gnus-gethash group gnus-newsrc-hashtb))
4311 (info (nth 2 entry))
4312 (active (gnus-active group))
4315 (setq range (gnus-compute-read-articles group articles))
4317 (set-buffer gnus-group-buffer)
4320 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4321 (gnus-info-set-read ',info ',(gnus-info-read info))
4322 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4323 (gnus-group-update-group ,group t))))
4324 ;; Add the read articles to the range.
4325 (gnus-info-set-read info range)
4326 ;; Then we have to re-compute how many unread
4327 ;; articles there are in this group.
4331 (setq num (- (1+ (cdr active)) (car active))))
4332 ((not (listp (cdr range)))
4333 (setq num (- (cdr active) (- (1+ (cdr range))
4337 (if (numberp (car range))
4339 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4340 (setq range (cdr range)))
4341 (setq num (- (cdr active) num))))
4342 ;; Update the number of unread articles.
4344 ;; Update the group buffer.
4345 (gnus-group-update-group group t)))))
4347 (defun gnus-methods-equal-p (m1 m2)
4348 (let ((m1 (or m1 gnus-select-method))
4349 (m2 (or m2 gnus-select-method)))
4351 (and (eq (car m1) (car m2))
4352 (or (not (memq 'address (assoc (symbol-name (car m1))
4353 gnus-valid-select-methods)))
4354 (equal (nth 1 m1) (nth 1 m2)))))))
4356 (defvar gnus-newsgroup-none-id 0)
4358 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4359 (let ((cur nntp-server-buffer)
4362 (save-excursion (set-buffer gnus-summary-buffer)
4363 gnus-newsgroup-dependencies)))
4366 (set-buffer nntp-server-buffer)
4367 ;; Translate all TAB characters into SPACE characters.
4368 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4369 (gnus-run-hooks 'gnus-parse-headers-hook)
4370 (let ((case-fold-search t)
4371 in-reply-to header p lines chars ctype)
4372 (goto-char (point-min))
4373 ;; Search to the beginning of the next header. Error messages
4374 ;; do not begin with 2 or 3.
4375 (while (re-search-forward "^[23][0-9]+ " nil t)
4378 ;; This implementation of this function, with nine
4379 ;; search-forwards instead of the one re-search-forward and
4380 ;; a case (which basically was the old function) is actually
4381 ;; about twice as fast, even though it looks messier. You
4382 ;; can't have everything, I guess. Speed and elegance
4383 ;; doesn't always go hand in hand.
4386 (make-full-mail-header
4392 (narrow-to-region (point)
4393 (or (and (search-forward "\n.\n" nil t)
4399 (if (search-forward "\nsubject: " nil t)
4400 (buffer-substring (match-end 0) (std11-field-end))
4405 (if (search-forward "\nfrom: " nil t)
4406 (buffer-substring (match-end 0) (std11-field-end))
4411 (if (search-forward "\ndate: " nil t)
4412 (buffer-substring (match-end 0) (std11-field-end))
4417 (setq id (if (re-search-forward
4418 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4419 ;; We do it this way to make sure the Message-ID
4420 ;; is (somewhat) syntactically valid.
4421 (buffer-substring (match-beginning 1)
4423 ;; If there was no message-id, we just fake one
4424 ;; to make subsequent routines simpler.
4425 (nnheader-generate-fake-message-id))))
4429 (if (search-forward "\nreferences: " nil t)
4433 (buffer-substring (match-end 0) (std11-field-end))
4437 (search-backward ">" end t)
4440 (search-backward "<" end t)
4442 ;; Get the references from the in-reply-to header if there
4443 ;; were no references and the in-reply-to header looks
4445 (if (and (search-forward "\nin-reply-to: " nil t)
4447 (buffer-substring (match-end 0)
4449 (string-match "<[^>]+>" in-reply-to))
4451 (setq ref (substring in-reply-to (match-beginning 0)
4453 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4454 (setq ref2 (substring in-reply-to (match-beginning 0)
4456 (when (> (length ref2) (length ref))
4463 (if (search-forward "\nchars: " nil t)
4464 (if (numberp (setq chars (ignore-errors (read cur))))
4470 (if (search-forward "\nlines: " nil t)
4471 (if (numberp (setq lines (ignore-errors (read cur))))
4477 (and (search-forward "\nxref: " nil t)
4478 (buffer-substring (match-end 0) (std11-field-end))))))
4480 (if (and (search-forward "\ncontent-type: " nil t)
4482 (buffer-substring (match-end 0) (std11-field-end))))
4483 (mime-entity-set-content-type-internal
4484 header (mime-parse-Content-Type ctype)))
4485 (when (equal id ref)
4488 (when gnus-alter-header-function
4489 (funcall gnus-alter-header-function header)
4490 (setq id (mail-header-id header)
4491 ref (gnus-parent-id (mail-header-references header))))
4494 (gnus-dependencies-add-header
4495 header dependencies force-new))
4496 (push header headers))
4497 (goto-char (point-max))
4499 (nreverse headers)))))
4501 ;; Goes through the xover lines and returns a list of vectors
4502 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4503 force-new dependencies
4504 group also-fetch-heads)
4505 "Parse the news overview data in the server buffer, and return a
4506 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4507 ;; Get the Xref when the users reads the articles since most/some
4508 ;; NNTP servers do not include Xrefs when using XOVER.
4509 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4510 (let ((cur nntp-server-buffer)
4511 (dependencies (or dependencies gnus-newsgroup-dependencies))
4512 number headers header)
4514 (set-buffer nntp-server-buffer)
4515 ;; Allow the user to mangle the headers before parsing them.
4516 (gnus-run-hooks 'gnus-parse-headers-hook)
4517 (goto-char (point-min))
4520 (while (and sequence (not (eobp)))
4521 (setq number (read cur))
4522 (while (and sequence
4523 (< (car sequence) number))
4524 (setq sequence (cdr sequence)))
4526 (eq number (car sequence))
4528 (setq sequence (cdr sequence))
4529 (setq header (inline
4530 (gnus-nov-parse-line
4531 number dependencies force-new))))
4532 (push header headers))
4535 (gnus-error 4 "Strange nov line (%d)"
4536 (count-lines (point-min) (point)))))
4538 ;; A common bug in inn is that if you have posted an article and
4539 ;; then retrieves the active file, it will answer correctly --
4540 ;; the new article is included. However, a NOV entry for the
4541 ;; article may not have been generated yet, so this may fail.
4542 ;; We work around this problem by retrieving the last few
4543 ;; headers using HEAD.
4544 (if (or (not also-fetch-heads)
4546 ;; We (probably) got all the headers.
4548 (let ((gnus-nov-is-evil t))
4551 (when (gnus-retrieve-headers sequence group)
4552 (gnus-get-newsgroup-headers))))))))
4554 (defun gnus-article-get-xrefs ()
4555 "Fill in the Xref value in `gnus-current-headers', if necessary.
4556 This is meant to be called in `gnus-article-internal-prepare-hook'."
4557 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4558 gnus-current-headers)))
4559 (or (not gnus-use-cross-reference)
4561 (and (mail-header-xref headers)
4562 (not (string= (mail-header-xref headers) "")))
4563 (let ((case-fold-search t)
4566 (nnheader-narrow-to-headers)
4567 (goto-char (point-min))
4568 (when (or (and (eq (downcase (char-after)) ?x)
4569 (looking-at "Xref:"))
4570 (search-forward "\nXref:" nil t))
4571 (goto-char (1+ (match-end 0)))
4572 (setq xref (buffer-substring (point)
4573 (progn (end-of-line) (point))))
4574 (mail-header-set-xref headers xref)))))))
4576 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4577 "Find article ID and insert the summary line for that article.
4578 OLD-HEADER can either be a header or a line number to insert
4579 the subject line on."
4580 (let* ((line (and (numberp old-header) old-header))
4581 (old-header (and (vectorp old-header) old-header))
4582 (header (cond ((and old-header use-old-header)
4585 (gnus-number-to-header id))
4586 (gnus-number-to-header id))
4588 (gnus-read-header id))))
4589 (number (and (numberp id) id))
4592 ;; Rebuild the thread that this article is part of and go to the
4593 ;; article we have fetched.
4594 (when (and (not gnus-show-threads)
4597 (setq d (gnus-data-find (mail-header-number old-header))))
4598 (goto-char (gnus-data-pos d))
4601 (- (gnus-point-at-bol)
4603 (1+ (gnus-point-at-eol))
4604 (gnus-delete-line))))))
4606 (mail-header-set-number header (mail-header-number old-header)))
4607 (setq gnus-newsgroup-sparse
4608 (delq (setq number (mail-header-number header))
4609 gnus-newsgroup-sparse))
4610 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4611 (push number gnus-newsgroup-limit)
4612 (gnus-rebuild-thread (mail-header-id header) line)
4613 (gnus-summary-goto-subject number nil t))
4614 (when (and (numberp number)
4616 ;; We have to update the boundaries even if we can't fetch the
4617 ;; article if ID is a number -- so that the next `P' or `N'
4618 ;; command will fetch the previous (or next) article even
4619 ;; if the one we tried to fetch this time has been canceled.
4620 (when (> number gnus-newsgroup-end)
4621 (setq gnus-newsgroup-end number))
4622 (when (< number gnus-newsgroup-begin)
4623 (setq gnus-newsgroup-begin number))
4624 (setq gnus-newsgroup-unselected
4625 (delq number gnus-newsgroup-unselected)))
4626 ;; Report back a success?
4627 (and header (mail-header-number header))))
4629 ;;; Process/prefix in the summary buffer
4631 (defun gnus-summary-work-articles (n)
4632 "Return a list of articles to be worked upon.
4633 The prefix argument, the list of process marked articles, and the
4634 current article will be taken into consideration."
4636 (set-buffer gnus-summary-buffer)
4639 ;; A numerical prefix has been given.
4640 (setq n (prefix-numeric-value n))
4641 (let ((backward (< n 0))
4642 (n (abs (prefix-numeric-value n)))
4647 (push (setq article (gnus-summary-article-number))
4650 (gnus-summary-find-prev nil article)
4651 (gnus-summary-find-next nil article)))
4653 (nreverse articles)))
4654 ((and (gnus-region-active-p) (mark))
4655 (message "region active")
4656 ;; Work on the region between point and mark.
4657 (let ((max (max (point) (mark)))
4660 (goto-char (min (point) (mark)))
4663 (push (setq article (gnus-summary-article-number)) articles)
4664 (gnus-summary-find-next nil article)
4666 (nreverse articles))))
4667 (gnus-newsgroup-processable
4668 ;; There are process-marked articles present.
4669 ;; Save current state.
4670 (gnus-summary-save-process-mark)
4672 (reverse gnus-newsgroup-processable))
4674 ;; Just return the current article.
4675 (list (gnus-summary-article-number))))))
4677 (defmacro gnus-summary-iterate (arg &rest forms)
4678 "Iterate over the process/prefixed articles and do FORMS.
4679 ARG is the interactive prefix given to the command. FORMS will be
4680 executed with point over the summary line of the articles."
4681 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4682 `(let ((,articles (gnus-summary-work-articles ,arg)))
4684 (gnus-summary-goto-subject (car ,articles))
4687 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4688 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4690 (defun gnus-summary-save-process-mark ()
4691 "Push the current set of process marked articles on the stack."
4693 (push (copy-sequence gnus-newsgroup-processable)
4694 gnus-newsgroup-process-stack))
4696 (defun gnus-summary-kill-process-mark ()
4697 "Push the current set of process marked articles on the stack and unmark."
4699 (gnus-summary-save-process-mark)
4700 (gnus-summary-unmark-all-processable))
4702 (defun gnus-summary-yank-process-mark ()
4703 "Pop the last process mark state off the stack and restore it."
4705 (unless gnus-newsgroup-process-stack
4706 (error "Empty mark stack"))
4707 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4709 (defun gnus-summary-process-mark-set (set)
4710 "Make SET into the current process marked articles."
4711 (gnus-summary-unmark-all-processable)
4713 (gnus-summary-set-process-mark (pop set))))
4715 ;;; Searching and stuff
4717 (defun gnus-summary-search-group (&optional backward use-level)
4718 "Search for next unread newsgroup.
4719 If optional argument BACKWARD is non-nil, search backward instead."
4721 (set-buffer gnus-group-buffer)
4722 (when (gnus-group-search-forward
4723 backward nil (if use-level (gnus-group-group-level) nil))
4724 (gnus-group-group-name))))
4726 (defun gnus-summary-best-group (&optional exclude-group)
4727 "Find the name of the best unread group.
4728 If EXCLUDE-GROUP, do not go to this group."
4730 (set-buffer gnus-group-buffer)
4732 (gnus-group-best-unread-group exclude-group))))
4734 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4735 (if backward (gnus-summary-find-prev)
4736 (let* ((dummy (gnus-summary-article-intangible-p))
4737 (article (or article (gnus-summary-article-number)))
4738 (arts (gnus-data-find-list article))
4740 (when (and (not dummy)
4741 (or (not gnus-summary-check-current)
4743 (not (gnus-data-unread-p (car arts)))))
4744 (setq arts (cdr arts)))
4749 (when (or (and undownloaded
4750 (eq gnus-undownloaded-mark
4751 (gnus-data-mark (car arts))))
4752 (gnus-data-unread-p (car arts)))
4753 (setq result (car arts)
4755 (setq arts (cdr arts)))
4758 (goto-char (gnus-data-pos result))
4759 (gnus-data-number result)))))
4761 (defun gnus-summary-find-prev (&optional unread article)
4762 (let* ((eobp (eobp))
4763 (article (or article (gnus-summary-article-number)))
4764 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4766 (when (and (not eobp)
4767 (or (not gnus-summary-check-current)
4769 (not (gnus-data-unread-p (car arts)))))
4770 (setq arts (cdr arts)))
4775 (when (gnus-data-unread-p (car arts))
4776 (setq result (car arts)
4778 (setq arts (cdr arts)))
4781 (goto-char (gnus-data-pos result))
4782 (gnus-data-number result))))
4784 (defun gnus-summary-find-subject (subject &optional unread backward article)
4785 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4786 (article (or article (gnus-summary-article-number)))
4787 (articles (gnus-data-list backward))
4788 (arts (gnus-data-find-list article articles))
4790 (when (or (not gnus-summary-check-current)
4792 (not (gnus-data-unread-p (car arts))))
4793 (setq arts (cdr arts)))
4795 (and (or (not unread)
4796 (gnus-data-unread-p (car arts)))
4797 (vectorp (gnus-data-header (car arts)))
4799 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4800 (setq result (car arts)
4802 (setq arts (cdr arts)))
4804 (goto-char (gnus-data-pos result))
4805 (gnus-data-number result))))
4807 (defun gnus-summary-search-forward (&optional unread subject backward)
4808 "Search forward for an article.
4809 If UNREAD, look for unread articles. If SUBJECT, look for
4810 articles with that subject. If BACKWARD, search backward instead."
4811 (cond (subject (gnus-summary-find-subject subject unread backward))
4812 (backward (gnus-summary-find-prev unread))
4813 (t (gnus-summary-find-next unread))))
4815 (defun gnus-recenter (&optional n)
4816 "Center point in window and redisplay frame.
4817 Also do horizontal recentering."
4819 (when (and gnus-auto-center-summary
4820 (not (eq gnus-auto-center-summary 'vertical)))
4821 (gnus-horizontal-recenter))
4824 (defun gnus-summary-recenter ()
4825 "Center point in the summary window.
4826 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4827 displayed, no centering will be performed."
4828 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4829 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4830 (let* ((top (cond ((< (window-height) 4) 0)
4831 ((< (window-height) 7) 1)
4833 (height (1- (window-height)))
4834 (bottom (save-excursion (goto-char (point-max))
4835 (forward-line (- height))
4837 (window (get-buffer-window (current-buffer))))
4838 ;; The user has to want it.
4839 (when gnus-auto-center-summary
4840 (when (get-buffer-window gnus-article-buffer)
4841 ;; Only do recentering when the article buffer is displayed,
4842 ;; Set the window start to either `bottom', which is the biggest
4843 ;; possible valid number, or the second line from the top,
4844 ;; whichever is the least.
4846 window (min bottom (save-excursion
4847 (forward-line (- top)) (point)))))
4848 ;; Do horizontal recentering while we're at it.
4849 (when (and (get-buffer-window (current-buffer) t)
4850 (not (eq gnus-auto-center-summary 'vertical)))
4851 (let ((selected (selected-window)))
4852 (select-window (get-buffer-window (current-buffer) t))
4853 (gnus-summary-position-point)
4854 (gnus-horizontal-recenter)
4855 (select-window selected))))))
4857 (defun gnus-summary-jump-to-group (newsgroup)
4858 "Move point to NEWSGROUP in group mode buffer."
4859 ;; Keep update point of group mode buffer if visible.
4860 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4861 (save-window-excursion
4862 ;; Take care of tree window mode.
4863 (when (get-buffer-window gnus-group-buffer)
4864 (pop-to-buffer gnus-group-buffer))
4865 (gnus-group-jump-to-group newsgroup))
4867 ;; Take care of tree window mode.
4868 (if (get-buffer-window gnus-group-buffer)
4869 (pop-to-buffer gnus-group-buffer)
4870 (set-buffer gnus-group-buffer))
4871 (gnus-group-jump-to-group newsgroup))))
4873 ;; This function returns a list of article numbers based on the
4874 ;; difference between the ranges of read articles in this group and
4875 ;; the range of active articles.
4876 (defun gnus-list-of-unread-articles (group)
4877 (let* ((read (gnus-info-read (gnus-get-info group)))
4878 (active (or (gnus-active group) (gnus-activate-group group)))
4881 ;; If none are read, then all are unread.
4883 (setq first (car active))
4884 ;; If the range of read articles is a single range, then the
4885 ;; first unread article is the article after the last read
4886 ;; article. Sounds logical, doesn't it?
4887 (if (not (listp (cdr read)))
4888 (setq first (max (car active) (1+ (cdr read))))
4889 ;; `read' is a list of ranges.
4890 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4893 (setq first (car active)))
4896 (while (< first nlast)
4898 (setq first (1+ first))))
4899 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4900 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4901 (setq read (cdr read)))))
4902 ;; And add the last unread articles.
4903 (while (<= first last)
4905 (setq first (1+ first)))
4906 ;; Return the list of unread articles.
4907 (delq 0 (nreverse unread))))
4909 (defun gnus-list-of-read-articles (group)
4910 "Return a list of unread, unticked and non-dormant articles."
4911 (let* ((info (gnus-get-info group))
4912 (marked (gnus-info-marks info))
4913 (active (gnus-active group)))
4915 (gnus-set-difference
4916 (gnus-sorted-complement
4917 (gnus-uncompress-range active)
4918 (gnus-list-of-unread-articles group))
4920 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4921 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4923 ;; Various summary commands
4925 (defun gnus-summary-select-article-buffer ()
4926 "Reconfigure windows to show article buffer."
4928 (if (not (gnus-buffer-live-p gnus-article-buffer))
4929 (error "There is no article buffer for this summary buffer")
4930 (gnus-configure-windows 'article)
4931 (select-window (get-buffer-window gnus-article-buffer))))
4933 (defun gnus-summary-universal-argument (arg)
4934 "Perform any operation on all articles that are process/prefixed."
4936 (let ((articles (gnus-summary-work-articles arg))
4943 (substitute-command-keys
4944 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4947 (gnus-error 1 "Undefined key")
4950 (gnus-summary-goto-subject (setq article (pop articles)))
4951 (let (gnus-newsgroup-processable)
4952 (command-execute func))
4953 (gnus-summary-remove-process-mark article)))))
4954 (gnus-summary-position-point))
4956 (defun gnus-summary-toggle-truncation (&optional arg)
4957 "Toggle truncation of summary lines.
4958 With arg, turn line truncation on iff arg is positive."
4960 (setq truncate-lines
4961 (if (null arg) (not truncate-lines)
4962 (> (prefix-numeric-value arg) 0)))
4965 (defun gnus-summary-reselect-current-group (&optional all rescan)
4966 "Exit and then reselect the current newsgroup.
4967 The prefix argument ALL means to select all articles."
4969 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4970 (error "Ephemeral groups can't be reselected"))
4971 (let ((current-subject (gnus-summary-article-number))
4972 (group gnus-newsgroup-name))
4973 (setq gnus-newsgroup-begin nil)
4975 ;; We have to adjust the point of group mode buffer because
4976 ;; point was moved to the next unread newsgroup by exiting.
4977 (gnus-summary-jump-to-group group)
4980 (gnus-group-get-new-news-this-group 1)))
4981 (gnus-group-read-group all t)
4982 (gnus-summary-goto-subject current-subject nil t)))
4984 (defun gnus-summary-rescan-group (&optional all)
4985 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4987 (gnus-summary-reselect-current-group all t))
4989 (defun gnus-summary-update-info (&optional non-destructive)
4991 (let ((group gnus-newsgroup-name))
4993 (when gnus-newsgroup-kill-headers
4994 (setq gnus-newsgroup-killed
4995 (gnus-compress-sequence
4997 (gnus-set-sorted-intersection
4998 (gnus-uncompress-range gnus-newsgroup-killed)
4999 (setq gnus-newsgroup-unselected
5000 (sort gnus-newsgroup-unselected '<)))
5001 (setq gnus-newsgroup-unreads
5002 (sort gnus-newsgroup-unreads '<)))
5004 (unless (listp (cdr gnus-newsgroup-killed))
5005 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5006 (let ((headers gnus-newsgroup-headers))
5007 ;; Set the new ranges of read articles.
5009 (set-buffer gnus-group-buffer)
5010 (gnus-undo-force-boundary))
5011 (gnus-update-read-articles
5012 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5013 ;; Set the current article marks.
5014 (let ((gnus-newsgroup-scored
5015 (if (and (not gnus-save-score)
5016 (not non-destructive))
5018 gnus-newsgroup-scored)))
5020 (gnus-update-marks)))
5021 ;; Do the cross-ref thing.
5022 (when gnus-use-cross-reference
5023 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5024 ;; Do not switch windows but change the buffer to work.
5025 (set-buffer gnus-group-buffer)
5026 (unless (gnus-ephemeral-group-p group)
5027 (gnus-group-update-group group)))))))
5029 (defun gnus-summary-save-newsrc (&optional force)
5030 "Save the current number of read/marked articles in the dribble buffer.
5031 The dribble buffer will then be saved.
5032 If FORCE (the prefix), also save the .newsrc file(s)."
5034 (gnus-summary-update-info t)
5036 (gnus-save-newsrc-file)
5037 (gnus-dribble-save)))
5039 (defun gnus-summary-exit (&optional temporary)
5040 "Exit reading current newsgroup, and then return to group selection mode.
5041 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5043 (gnus-set-global-variables)
5044 (gnus-kill-save-kill-buffer)
5045 (gnus-async-halt-prefetch)
5046 (let* ((group gnus-newsgroup-name)
5047 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5050 (buf (current-buffer)))
5051 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5052 ;; If we have several article buffers, we kill them at exit.
5053 (unless gnus-single-article-buffer
5054 (gnus-kill-buffer gnus-original-article-buffer)
5055 (setq gnus-article-current nil))
5056 (when gnus-use-cache
5057 (gnus-cache-possibly-remove-articles)
5058 (gnus-cache-save-buffers))
5059 (gnus-async-prefetch-remove-group group)
5060 (when gnus-suppress-duplicates
5061 (gnus-dup-enter-articles))
5062 (when gnus-use-trees
5063 (gnus-tree-close group))
5064 ;; Remove entries for this group.
5065 (nnmail-purge-split-history (gnus-group-real-name group))
5066 ;; Make all changes in this group permanent.
5068 (gnus-run-hooks 'gnus-exit-group-hook)
5069 (gnus-summary-update-info)
5070 ;; Do adaptive scoring, and possibly save score files.
5071 (when gnus-newsgroup-adaptive
5072 (gnus-score-adaptive))
5073 (when gnus-use-scoring
5075 (gnus-close-group group)
5076 ;; Make sure where we were, and go to next newsgroup.
5077 (set-buffer gnus-group-buffer)
5079 (gnus-group-jump-to-group group))
5080 (gnus-run-hooks 'gnus-summary-exit-hook)
5081 (unless (or quit-config
5082 ;; If this group has disappeared from the summary
5083 ;; buffer, don't skip forwards.
5084 (not (string= group (gnus-group-group-name))))
5085 (gnus-group-next-unread-group 1))
5086 (setq group-point (point))
5089 ;; If we have several article buffers, we kill them at exit.
5090 (unless gnus-single-article-buffer
5091 (gnus-kill-buffer gnus-article-buffer)
5092 (gnus-kill-buffer gnus-original-article-buffer)
5093 (setq gnus-article-current nil))
5095 (if (not gnus-kill-summary-on-exit)
5096 (gnus-deaden-summary)
5097 ;; We set all buffer-local variables to nil. It is unclear why
5098 ;; this is needed, but if we don't, buffer-local variables are
5099 ;; not garbage-collected, it seems. This would the lead to en
5100 ;; ever-growing Emacs.
5101 (gnus-summary-clear-local-variables)
5102 (when (get-buffer gnus-article-buffer)
5103 (bury-buffer gnus-article-buffer))
5104 ;; We clear the global counterparts of the buffer-local
5105 ;; variables as well, just to be on the safe side.
5106 (set-buffer gnus-group-buffer)
5107 (gnus-summary-clear-local-variables)
5108 ;; Return to group mode buffer.
5109 (when (eq mode 'gnus-summary-mode)
5110 (gnus-kill-buffer buf)))
5111 (setq gnus-current-select-method gnus-select-method)
5112 (pop-to-buffer gnus-group-buffer)
5113 (if (not quit-config)
5115 (goto-char group-point)
5116 (gnus-configure-windows 'group 'force))
5117 (gnus-handle-ephemeral-exit quit-config))
5118 ;; Clear the current group name.
5120 (setq gnus-newsgroup-name nil)))))
5122 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5123 (defun gnus-summary-exit-no-update (&optional no-questions)
5124 "Quit reading current newsgroup without updating read article info."
5126 (let* ((group gnus-newsgroup-name)
5127 (quit-config (gnus-group-quit-config group)))
5128 (when (or no-questions
5130 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5131 (gnus-async-halt-prefetch)
5132 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5133 ;; If we have several article buffers, we kill them at exit.
5134 (unless gnus-single-article-buffer
5135 (gnus-kill-buffer gnus-article-buffer)
5136 (gnus-kill-buffer gnus-original-article-buffer)
5137 (setq gnus-article-current nil))
5138 (if (not gnus-kill-summary-on-exit)
5139 (gnus-deaden-summary)
5140 (gnus-close-group group)
5141 (gnus-summary-clear-local-variables)
5142 (set-buffer gnus-group-buffer)
5143 (gnus-summary-clear-local-variables)
5144 (when (get-buffer gnus-summary-buffer)
5145 (kill-buffer gnus-summary-buffer)))
5146 (unless gnus-single-article-buffer
5147 (setq gnus-article-current nil))
5148 (when gnus-use-trees
5149 (gnus-tree-close group))
5150 (gnus-async-prefetch-remove-group group)
5151 (when (get-buffer gnus-article-buffer)
5152 (bury-buffer gnus-article-buffer))
5153 ;; Return to the group buffer.
5154 (gnus-configure-windows 'group 'force)
5155 ;; Clear the current group name.
5156 (setq gnus-newsgroup-name nil)
5157 (when (equal (gnus-group-group-name) group)
5158 (gnus-group-next-unread-group 1))
5160 (gnus-handle-ephemeral-exit quit-config)))))
5162 (defun gnus-handle-ephemeral-exit (quit-config)
5163 "Handle movement when leaving an ephemeral group.
5164 The state which existed when entering the ephemeral is reset."
5165 (if (not (buffer-name (car quit-config)))
5166 (gnus-configure-windows 'group 'force)
5167 (set-buffer (car quit-config))
5168 (cond ((eq major-mode 'gnus-summary-mode)
5169 (gnus-set-global-variables))
5170 ((eq major-mode 'gnus-article-mode)
5172 ;; The `gnus-summary-buffer' variable may point
5173 ;; to the old summary buffer when using a single
5175 (unless (gnus-buffer-live-p gnus-summary-buffer)
5176 (set-buffer gnus-group-buffer))
5177 (set-buffer gnus-summary-buffer)
5178 (gnus-set-global-variables))))
5179 (if (or (eq (cdr quit-config) 'article)
5180 (eq (cdr quit-config) 'pick))
5182 ;; The current article may be from the ephemeral group
5183 ;; thus it is best that we reload this article
5184 (gnus-summary-show-article)
5185 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5186 (gnus-configure-windows 'pick 'force)
5187 (gnus-configure-windows (cdr quit-config) 'force)))
5188 (gnus-configure-windows (cdr quit-config) 'force))
5189 (when (eq major-mode 'gnus-summary-mode)
5190 (gnus-summary-next-subject 1 nil t)
5191 (gnus-summary-recenter)
5192 (gnus-summary-position-point))))
5194 (defun gnus-summary-preview-mime-message ()
5195 "MIME decode and play this message."
5197 (let ((gnus-break-pages nil)
5199 (gnus-summary-select-article gnus-show-all-headers t))
5200 (select-window (get-buffer-window gnus-article-buffer)))
5204 (defvar gnus-dead-summary-mode-map nil)
5206 (unless gnus-dead-summary-mode-map
5207 (setq gnus-dead-summary-mode-map (make-keymap))
5208 (suppress-keymap gnus-dead-summary-mode-map)
5209 (substitute-key-definition
5210 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5211 (let ((keys '("\C-d" "\r" "\177" [delete])))
5213 (define-key gnus-dead-summary-mode-map
5214 (pop keys) 'gnus-summary-wake-up-the-dead))))
5216 (defvar gnus-dead-summary-mode nil
5217 "Minor mode for Gnus summary buffers.")
5219 (defun gnus-dead-summary-mode (&optional arg)
5220 "Minor mode for Gnus summary buffers."
5222 (when (eq major-mode 'gnus-summary-mode)
5223 (make-local-variable 'gnus-dead-summary-mode)
5224 (setq gnus-dead-summary-mode
5225 (if (null arg) (not gnus-dead-summary-mode)
5226 (> (prefix-numeric-value arg) 0)))
5227 (when gnus-dead-summary-mode
5228 (gnus-add-minor-mode
5229 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5231 (defun gnus-deaden-summary ()
5232 "Make the current summary buffer into a dead summary buffer."
5233 ;; Kill any previous dead summary buffer.
5234 (when (and gnus-dead-summary
5235 (buffer-name gnus-dead-summary))
5237 (set-buffer gnus-dead-summary)
5238 (when gnus-dead-summary-mode
5239 (kill-buffer (current-buffer)))))
5240 ;; Make this the current dead summary.
5241 (setq gnus-dead-summary (current-buffer))
5242 (gnus-dead-summary-mode 1)
5243 (let ((name (buffer-name)))
5244 (when (string-match "Summary" name)
5246 (concat (substring name 0 (match-beginning 0)) "Dead "
5247 (substring name (match-beginning 0)))
5250 (defun gnus-kill-or-deaden-summary (buffer)
5251 "Kill or deaden the summary BUFFER."
5253 (when (and (buffer-name buffer)
5254 (not gnus-single-article-buffer))
5257 (gnus-kill-buffer gnus-article-buffer)
5258 (gnus-kill-buffer gnus-original-article-buffer)))
5259 (cond (gnus-kill-summary-on-exit
5260 (when (and gnus-use-trees
5261 (gnus-buffer-exists-p buffer))
5264 (gnus-tree-close gnus-newsgroup-name)))
5265 (gnus-kill-buffer buffer))
5266 ((gnus-buffer-exists-p buffer)
5269 (gnus-deaden-summary))))))
5271 (defun gnus-summary-wake-up-the-dead (&rest args)
5272 "Wake up the dead summary buffer."
5274 (gnus-dead-summary-mode -1)
5275 (let ((name (buffer-name)))
5276 (when (string-match "Dead " name)
5278 (concat (substring name 0 (match-beginning 0))
5279 (substring name (match-end 0)))
5281 (gnus-message 3 "This dead summary is now alive again"))
5283 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5284 (defun gnus-summary-fetch-faq (&optional faq-dir)
5285 "Fetch the FAQ for the current group.
5286 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5290 (when current-prefix-arg
5292 "Faq dir: " (and (listp gnus-group-faq-directory)
5293 (mapcar (lambda (file) (list file))
5294 gnus-group-faq-directory))))))
5295 (let (gnus-faq-buffer)
5296 (when (setq gnus-faq-buffer
5297 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5298 (gnus-configure-windows 'summary-faq))))
5300 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5301 (defun gnus-summary-describe-group (&optional force)
5302 "Describe the current newsgroup."
5304 (gnus-group-describe-group force gnus-newsgroup-name))
5306 (defun gnus-summary-describe-briefly ()
5307 "Describe summary mode commands briefly."
5310 (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")))
5312 ;; Walking around group mode buffer from summary mode.
5314 (defun gnus-summary-next-group (&optional no-article target-group backward)
5315 "Exit current newsgroup and then select next unread newsgroup.
5316 If prefix argument NO-ARTICLE is non-nil, no article is selected
5317 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5318 previous group instead."
5320 ;; Stop pre-fetching.
5321 (gnus-async-halt-prefetch)
5322 (let ((current-group gnus-newsgroup-name)
5323 (current-buffer (current-buffer))
5325 ;; First we semi-exit this group to update Xrefs and all variables.
5326 ;; We can't do a real exit, because the window conf must remain
5327 ;; the same in case the user is prompted for info, and we don't
5328 ;; want the window conf to change before that...
5329 (gnus-summary-exit t)
5330 (while (not entered)
5331 ;; Then we find what group we are supposed to enter.
5332 (set-buffer gnus-group-buffer)
5333 (gnus-group-jump-to-group current-group)
5336 (if (eq gnus-keep-same-level 'best)
5337 (gnus-summary-best-group gnus-newsgroup-name)
5338 (gnus-summary-search-group backward gnus-keep-same-level))))
5339 (if (not target-group)
5340 ;; There are no further groups, so we return to the group
5343 (gnus-message 5 "Returning to the group buffer")
5345 (when (gnus-buffer-live-p current-buffer)
5346 (set-buffer current-buffer)
5347 (gnus-summary-exit))
5348 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5349 ;; We try to enter the target group.
5350 (gnus-group-jump-to-group target-group)
5351 (let ((unreads (gnus-group-group-unread)))
5352 (if (and (or (eq t unreads)
5353 (and unreads (not (zerop unreads))))
5354 (gnus-summary-read-group
5355 target-group nil no-article
5356 (and (buffer-name current-buffer) current-buffer)
5359 (setq current-group target-group
5360 target-group nil)))))))
5362 (defun gnus-summary-prev-group (&optional no-article)
5363 "Exit current newsgroup and then select previous unread newsgroup.
5364 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5366 (gnus-summary-next-group no-article nil t))
5368 ;; Walking around summary lines.
5370 (defun gnus-summary-first-subject (&optional unread undownloaded)
5371 "Go to the first unread subject.
5372 If UNREAD is non-nil, go to the first unread article.
5373 Returns the article selected or nil if there are no unread articles."
5378 ((null gnus-newsgroup-data)
5379 (gnus-message 3 "No articles in the group")
5381 ;; Pick the first article.
5383 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5384 (gnus-data-number (car gnus-newsgroup-data)))
5385 ;; No unread articles.
5386 ((null gnus-newsgroup-unreads)
5387 (gnus-message 3 "No more unread articles")
5389 ;; Find the first unread article.
5391 (let ((data gnus-newsgroup-data))
5393 (and (not (and undownloaded
5394 (eq gnus-undownloaded-mark
5395 (gnus-data-mark (car data)))))
5396 (not (gnus-data-unread-p (car data)))))
5397 (setq data (cdr data)))
5399 (goto-char (gnus-data-pos (car data)))
5400 (gnus-data-number (car data))))))
5401 (gnus-summary-position-point)))
5403 (defun gnus-summary-next-subject (n &optional unread dont-display)
5404 "Go to next N'th summary line.
5405 If N is negative, go to the previous N'th subject line.
5406 If UNREAD is non-nil, only unread articles are selected.
5407 The difference between N and the actual number of steps taken is
5410 (let ((backward (< n 0))
5414 (gnus-summary-find-prev unread)
5415 (gnus-summary-find-next unread)))
5416 (gnus-summary-show-thread)
5419 (gnus-message 7 "No more%s articles"
5420 (if unread " unread" "")))
5421 (unless dont-display
5422 (gnus-summary-recenter)
5423 (gnus-summary-position-point))
5426 (defun gnus-summary-next-unread-subject (n)
5427 "Go to next N'th unread summary line."
5429 (gnus-summary-next-subject n t))
5431 (defun gnus-summary-prev-subject (n &optional unread)
5432 "Go to previous N'th summary line.
5433 If optional argument UNREAD is non-nil, only unread article is selected."
5435 (gnus-summary-next-subject (- n) unread))
5437 (defun gnus-summary-prev-unread-subject (n)
5438 "Go to previous N'th unread summary line."
5440 (gnus-summary-next-subject (- n) t))
5442 (defun gnus-summary-goto-subject (article &optional force silent)
5443 "Go the subject line of ARTICLE.
5444 If FORCE, also allow jumping to articles not currently shown."
5445 (interactive "nArticle number: ")
5447 (data (gnus-data-find article)))
5448 ;; We read in the article if we have to.
5451 (gnus-summary-insert-subject
5453 (if (or (numberp force) (vectorp force)) force)
5455 (setq data (gnus-data-find article)))
5460 (gnus-message 3 "Can't find article %d" article))
5462 (goto-char (gnus-data-pos data))
5463 (gnus-summary-position-point)
5466 ;; Walking around summary lines with displaying articles.
5468 (defun gnus-summary-expand-window (&optional arg)
5469 "Make the summary buffer take up the entire Emacs frame.
5470 Given a prefix, will force an `article' buffer configuration."
5473 (gnus-configure-windows 'article 'force)
5474 (gnus-configure-windows 'summary 'force)))
5476 (defun gnus-summary-display-article (article &optional all-header)
5477 "Display ARTICLE in article buffer."
5478 (gnus-set-global-variables)
5482 (if gnus-summary-display-article-function
5483 (funcall gnus-summary-display-article-function article all-header)
5484 (gnus-article-prepare article all-header))
5485 (gnus-run-hooks 'gnus-select-article-hook)
5486 (when (and gnus-current-article
5487 (not (zerop gnus-current-article)))
5488 (gnus-summary-goto-subject gnus-current-article))
5489 (gnus-summary-recenter)
5490 (when (and gnus-use-trees gnus-show-threads)
5491 (gnus-possibly-generate-tree article)
5492 (gnus-highlight-selected-tree article))
5493 ;; Successfully display article.
5494 (gnus-article-set-window-start
5495 (cdr (assq article gnus-newsgroup-bookmarks))))))
5497 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5498 "Select the current article.
5499 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5500 non-nil, the article will be re-fetched even if it already present in
5501 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5503 ;; Make sure we are in the summary buffer to work around bbdb bug.
5504 (unless (eq major-mode 'gnus-summary-mode)
5505 (set-buffer gnus-summary-buffer))
5506 (let ((article (or article (gnus-summary-article-number)))
5507 (all-headers (not (not all-headers))) ;Must be T or NIL.
5508 gnus-summary-display-article-function
5511 (gnus-summary-article-pseudo-p article)
5512 (error "This is a pseudo-article"))
5515 (set-buffer gnus-summary-buffer)
5516 (if (or (and gnus-single-article-buffer
5517 (or (null gnus-current-article)
5518 (null gnus-article-current)
5519 (null (get-buffer gnus-article-buffer))
5520 (not (eq article (cdr gnus-article-current)))
5521 (not (equal (car gnus-article-current)
5522 gnus-newsgroup-name))))
5523 (and (not gnus-single-article-buffer)
5524 (or (null gnus-current-article)
5525 (not (eq gnus-current-article article))))
5527 ;; The requested article is different from the current article.
5529 (gnus-summary-display-article article all-headers)
5531 (when (or all-headers gnus-show-all-headers)
5532 (gnus-article-show-all-headers))
5535 (gnus-article-set-window-start
5536 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5538 (defun gnus-summary-set-current-mark (&optional current-mark)
5539 "Obsolete function."
5542 (defun gnus-summary-next-article (&optional unread subject backward push)
5543 "Select the next article.
5544 If UNREAD, only unread articles are selected.
5545 If SUBJECT, only articles with SUBJECT are selected.
5546 If BACKWARD, the previous article is selected instead of the next."
5549 ;; Is there such an article?
5550 ((and (gnus-summary-search-forward unread subject backward)
5551 (or (gnus-summary-display-article (gnus-summary-article-number))
5552 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5553 (gnus-summary-position-point))
5554 ;; If not, we try the first unread, if that is wanted.
5556 gnus-auto-select-same
5557 (gnus-summary-first-unread-article))
5558 (gnus-summary-position-point)
5559 (gnus-message 6 "Wrapped"))
5560 ;; Try to get next/previous article not displayed in this group.
5561 ((and gnus-auto-extend-newsgroup
5562 (not unread) (not subject))
5563 (gnus-summary-goto-article
5564 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5565 nil (count-lines (point-min) (point))))
5566 ;; Go to next/previous group.
5568 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5569 (gnus-summary-jump-to-group gnus-newsgroup-name))
5570 (let ((cmd last-command-char)
5573 (set-buffer gnus-group-buffer)
5576 (if (eq gnus-keep-same-level 'best)
5577 (gnus-summary-best-group gnus-newsgroup-name)
5578 (gnus-summary-search-group backward gnus-keep-same-level))))
5579 ;; For some reason, the group window gets selected. We change
5581 (select-window (get-buffer-window (current-buffer)))
5582 ;; Select next unread newsgroup automagically.
5584 ((or (not gnus-auto-select-next)
5586 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5587 ((or (eq gnus-auto-select-next 'quietly)
5588 (and (eq gnus-auto-select-next 'slightly-quietly)
5590 (and (eq gnus-auto-select-next 'almost-quietly)
5591 (gnus-summary-last-article-p)))
5593 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5595 (gnus-message 7 "No more%s articles (%s)..."
5596 (if unread " unread" "")
5597 (if group (concat "selecting " group)
5599 (gnus-summary-next-group nil group backward)))
5601 (when (gnus-key-press-event-p last-input-event)
5602 (gnus-summary-walk-group-buffer
5603 gnus-newsgroup-name cmd unread backward point))))))))
5605 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5606 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5607 (?\C-p (gnus-group-prev-unread-group 1))))
5608 (cursor-in-echo-area t)
5609 keve key group ended)
5611 (set-buffer gnus-group-buffer)
5614 (if (eq gnus-keep-same-level 'best)
5615 (gnus-summary-best-group gnus-newsgroup-name)
5616 (gnus-summary-search-group backward gnus-keep-same-level))))
5619 5 "No more%s articles%s" (if unread " unread" "")
5621 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5622 (format " (Type %s for %s [%s])"
5623 (single-key-description cmd) group
5624 (car (gnus-gethash group gnus-newsrc-hashtb)))
5625 (format " (Type %s to exit %s)"
5626 (single-key-description cmd)
5627 gnus-newsgroup-name)))
5628 ;; Confirm auto selection.
5629 (setq key (car (setq keve (gnus-read-event-char))))
5632 ((assq key keystrokes)
5633 (let ((obuf (current-buffer)))
5634 (switch-to-buffer gnus-group-buffer)
5636 (gnus-group-jump-to-group group))
5637 (eval (cadr (assq key keystrokes)))
5638 (setq group (gnus-group-group-name))
5639 (switch-to-buffer obuf))
5643 (gnus-ephemeral-group-p gnus-newsgroup-name))
5645 (gnus-summary-next-group nil group backward)))
5647 (push (cdr keve) unread-command-events))))))
5649 (defun gnus-summary-next-unread-article ()
5650 "Select unread article after current one."
5652 (gnus-summary-next-article
5653 (or (not (eq gnus-summary-goto-unread 'never))
5654 (gnus-summary-last-article-p (gnus-summary-article-number)))
5655 (and gnus-auto-select-same
5656 (gnus-summary-article-subject))))
5658 (defun gnus-summary-prev-article (&optional unread subject)
5659 "Select the article after the current one.
5660 If UNREAD is non-nil, only unread articles are selected."
5662 (gnus-summary-next-article unread subject t))
5664 (defun gnus-summary-prev-unread-article ()
5665 "Select unread article before current one."
5667 (gnus-summary-prev-article
5668 (or (not (eq gnus-summary-goto-unread 'never))
5669 (gnus-summary-first-article-p (gnus-summary-article-number)))
5670 (and gnus-auto-select-same
5671 (gnus-summary-article-subject))))
5673 (defun gnus-summary-next-page (&optional lines circular)
5674 "Show next page of the selected article.
5675 If at the end of the current article, select the next article.
5676 LINES says how many lines should be scrolled up.
5678 If CIRCULAR is non-nil, go to the start of the article instead of
5679 selecting the next article when reaching the end of the current
5682 (setq gnus-summary-buffer (current-buffer))
5683 (gnus-set-global-variables)
5684 (let ((article (gnus-summary-article-number))
5685 (article-window (get-buffer-window gnus-article-buffer t))
5687 ;; If the buffer is empty, we have no article.
5689 (error "No article to select"))
5690 (gnus-configure-windows 'article)
5691 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5692 (if (and (eq gnus-summary-goto-unread 'never)
5693 (not (gnus-summary-last-article-p article)))
5694 (gnus-summary-next-article)
5695 (gnus-summary-next-unread-article))
5696 (if (or (null gnus-current-article)
5697 (null gnus-article-current)
5698 (/= article (cdr gnus-article-current))
5699 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5700 ;; Selected subject is different from current article's.
5701 (gnus-summary-display-article article)
5702 (when article-window
5703 (gnus-eval-in-buffer-window gnus-article-buffer
5704 (setq endp (gnus-article-next-page lines)))
5707 (gnus-summary-beginning-of-article))
5709 (gnus-message 3 "End of message"))
5711 (if (and (eq gnus-summary-goto-unread 'never)
5712 (not (gnus-summary-last-article-p article)))
5713 (gnus-summary-next-article)
5714 (gnus-summary-next-unread-article))))))))
5715 (gnus-summary-recenter)
5716 (gnus-summary-position-point)))
5718 (defun gnus-summary-prev-page (&optional lines move)
5719 "Show previous page of selected article.
5720 Argument LINES specifies lines to be scrolled down.
5721 If MOVE, move to the previous unread article if point is at
5722 the beginning of the buffer."
5724 (let ((article (gnus-summary-article-number))
5725 (article-window (get-buffer-window gnus-article-buffer t))
5727 (gnus-configure-windows 'article)
5728 (if (or (null gnus-current-article)
5729 (null gnus-article-current)
5730 (/= article (cdr gnus-article-current))
5731 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5732 ;; Selected subject is different from current article's.
5733 (gnus-summary-display-article article)
5734 (gnus-summary-recenter)
5735 (when article-window
5736 (gnus-eval-in-buffer-window gnus-article-buffer
5737 (setq endp (gnus-article-prev-page lines)))
5738 (when (and move endp)
5740 (gnus-message 3 "Beginning of message"))
5742 (if (and (eq gnus-summary-goto-unread 'never)
5743 (not (gnus-summary-first-article-p article)))
5744 (gnus-summary-prev-article)
5745 (gnus-summary-prev-unread-article))))))))
5746 (gnus-summary-position-point))
5748 (defun gnus-summary-prev-page-or-article (&optional lines)
5749 "Show previous page of selected article.
5750 Argument LINES specifies lines to be scrolled down.
5751 If at the beginning of the article, go to the next article."
5753 (gnus-summary-prev-page lines t))
5755 (defun gnus-summary-scroll-up (lines)
5756 "Scroll up (or down) one line current article.
5757 Argument LINES specifies lines to be scrolled up (or down if negative)."
5759 (gnus-configure-windows 'article)
5760 (gnus-summary-show-thread)
5761 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5762 (gnus-eval-in-buffer-window gnus-article-buffer
5764 (when (gnus-article-next-page lines)
5765 (gnus-message 3 "End of message")))
5767 (gnus-article-prev-page (- lines))))))
5768 (gnus-summary-recenter)
5769 (gnus-summary-position-point))
5771 (defun gnus-summary-scroll-down (lines)
5772 "Scroll down (or up) one line current article.
5773 Argument LINES specifies lines to be scrolled down (or up if negative)."
5775 (gnus-summary-scroll-up (- lines)))
5777 (defun gnus-summary-next-same-subject ()
5778 "Select next article which has the same subject as current one."
5780 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5782 (defun gnus-summary-prev-same-subject ()
5783 "Select previous article which has the same subject as current one."
5785 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5787 (defun gnus-summary-next-unread-same-subject ()
5788 "Select next unread article which has the same subject as current one."
5790 (gnus-summary-next-article t (gnus-summary-article-subject)))
5792 (defun gnus-summary-prev-unread-same-subject ()
5793 "Select previous unread article which has the same subject as current one."
5795 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5797 (defun gnus-summary-first-unread-article ()
5798 "Select the first unread article.
5799 Return nil if there are no unread articles."
5802 (when (gnus-summary-first-subject t)
5803 (gnus-summary-show-thread)
5804 (gnus-summary-first-subject t)
5805 (gnus-summary-display-article (gnus-summary-article-number)))
5806 (gnus-summary-position-point)))
5808 (defun gnus-summary-first-article ()
5809 "Select the first article.
5810 Return nil if there are no articles."
5813 (when (gnus-summary-first-subject)
5814 (gnus-summary-show-thread)
5815 (gnus-summary-first-subject)
5816 (gnus-summary-display-article (gnus-summary-article-number)))
5817 (gnus-summary-position-point)))
5819 (defun gnus-summary-best-unread-article ()
5820 "Select the unread article with the highest score."
5822 (let ((best -1000000)
5823 (data gnus-newsgroup-data)
5826 (and (gnus-data-unread-p (car data))
5828 (gnus-summary-article-score (gnus-data-number (car data))))
5831 article (gnus-data-number (car data))))
5832 (setq data (cdr data)))
5835 (gnus-summary-goto-article article)
5836 (error "No unread articles"))
5837 (gnus-summary-position-point))))
5839 (defun gnus-summary-last-subject ()
5840 "Go to the last displayed subject line in the group."
5841 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5843 (gnus-summary-goto-subject article))))
5845 (defun gnus-summary-goto-article (article &optional all-headers force)
5846 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5847 If ALL-HEADERS is non-nil, no header lines are hidden.
5848 If FORCE, go to the article even if it isn't displayed. If FORCE
5849 is a number, it is the line the article is to be displayed on."
5853 "Article number or Message-ID: "
5854 (mapcar (lambda (number) (list (int-to-string number)))
5855 gnus-newsgroup-limit))
5859 (if (and (stringp article)
5860 (string-match "@" article))
5861 (gnus-summary-refer-article article)
5862 (when (stringp article)
5863 (setq article (string-to-number article)))
5864 (if (gnus-summary-goto-subject article force)
5865 (gnus-summary-display-article article all-headers)
5866 (gnus-message 4 "Couldn't go to article %s" article) nil))
5867 (gnus-summary-position-point)))
5869 (defun gnus-summary-goto-last-article ()
5870 "Go to the previously read article."
5873 (when gnus-last-article
5874 (gnus-summary-goto-article gnus-last-article nil t))
5875 (gnus-summary-position-point)))
5877 (defun gnus-summary-pop-article (number)
5878 "Pop one article off the history and go to the previous.
5879 NUMBER articles will be popped off."
5882 (setq gnus-newsgroup-history
5883 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5885 (gnus-summary-goto-article (car to) nil t)
5886 (error "Article history empty")))
5887 (gnus-summary-position-point))
5889 ;; Summary commands and functions for limiting the summary buffer.
5891 (defun gnus-summary-limit-to-articles (n)
5892 "Limit the summary buffer to the next N articles.
5893 If not given a prefix, use the process marked articles instead."
5896 (let ((articles (gnus-summary-work-articles n)))
5897 (setq gnus-newsgroup-processable nil)
5898 (gnus-summary-limit articles))
5899 (gnus-summary-position-point)))
5901 (defun gnus-summary-pop-limit (&optional total)
5902 "Restore the previous limit.
5903 If given a prefix, remove all limits."
5906 (setq gnus-newsgroup-limits
5907 (list (mapcar (lambda (h) (mail-header-number h))
5908 gnus-newsgroup-headers))))
5909 (unless gnus-newsgroup-limits
5910 (error "No limit to pop"))
5912 (gnus-summary-limit nil 'pop)
5913 (gnus-summary-position-point)))
5915 (defun gnus-summary-limit-to-subject (subject &optional header)
5916 "Limit the summary buffer to articles that have subjects that match a regexp."
5917 (interactive "sLimit to subject (regexp): ")
5919 (setq header "subject"))
5920 (when (not (equal "" subject))
5922 (let ((articles (gnus-summary-find-matching
5923 (or header "subject") subject 'all)))
5925 (error "Found no matches for \"%s\"" subject))
5926 (gnus-summary-limit articles))
5927 (gnus-summary-position-point))))
5929 (defun gnus-summary-limit-to-author (from)
5930 "Limit the summary buffer to articles that have authors that match a regexp."
5931 (interactive "sLimit to author (regexp): ")
5932 (gnus-summary-limit-to-subject from "from"))
5934 (defun gnus-summary-limit-to-age (age &optional younger-p)
5935 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5936 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5937 articles that are younger than AGE days."
5938 (interactive "nTime in days: \nP")
5940 (let ((data gnus-newsgroup-data)
5941 (cutoff (nnmail-days-to-time age))
5942 articles d date is-younger)
5943 (while (setq d (pop data))
5944 (when (and (vectorp (gnus-data-header d))
5945 (setq date (mail-header-date (gnus-data-header d))))
5946 (setq is-younger (nnmail-time-less
5947 (nnmail-time-since (nnmail-date-to-time date))
5952 (push (gnus-data-number d) articles))))
5953 (gnus-summary-limit (nreverse articles)))
5954 (gnus-summary-position-point)))
5956 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5958 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5960 (defun gnus-summary-limit-to-unread (&optional all)
5961 "Limit the summary buffer to articles that are not marked as read.
5962 If ALL is non-nil, limit strictly to unread articles."
5965 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5966 (gnus-summary-limit-to-marks
5967 ;; Concat all the marks that say that an article is read and have
5969 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5970 gnus-killed-mark gnus-kill-file-mark
5971 gnus-low-score-mark gnus-expirable-mark
5972 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5973 gnus-duplicate-mark gnus-souped-mark)
5976 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5977 (make-obsolete 'gnus-summary-delete-marked-with
5978 'gnus-summary-limit-exlude-marks)
5980 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5981 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5982 If REVERSE, limit the summary buffer to articles that are marked
5983 with MARKS. MARKS can either be a string of marks or a list of marks.
5984 Returns how many articles were removed."
5985 (interactive "sMarks: ")
5986 (gnus-summary-limit-to-marks marks t))
5988 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5989 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5990 If REVERSE (the prefix), limit the summary buffer to articles that are
5991 not marked with MARKS. MARKS can either be a string of marks or a
5993 Returns how many articles were removed."
5994 (interactive "sMarks: \nP")
5996 (let ((data gnus-newsgroup-data)
5997 (marks (if (listp marks) marks
5998 (append marks nil))) ; Transform to list.
6001 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6002 (memq (gnus-data-mark (car data)) marks))
6003 (push (gnus-data-number (car data)) articles))
6004 (setq data (cdr data)))
6005 (gnus-summary-limit articles))
6006 (gnus-summary-position-point)))
6008 (defun gnus-summary-limit-to-score (&optional score)
6009 "Limit to articles with score at or above SCORE."
6011 (setq score (if score
6012 (prefix-numeric-value score)
6013 (or gnus-summary-default-score 0)))
6014 (let ((data gnus-newsgroup-data)
6017 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6019 (push (gnus-data-number (car data)) articles))
6020 (setq data (cdr data)))
6022 (gnus-summary-limit articles)
6023 (gnus-summary-position-point))))
6025 (defun gnus-summary-limit-include-thread (id)
6026 "Display all the hidden articles that in the current thread."
6027 (interactive (list (mail-header-id (gnus-summary-article-header))))
6028 (let ((articles (gnus-articles-in-thread
6029 (gnus-id-to-thread (gnus-root-id id)))))
6031 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6032 (gnus-summary-position-point))))
6034 (defun gnus-summary-limit-include-dormant ()
6035 "Display all the hidden articles that are marked as dormant.
6036 Note that this command only works on a subset of the articles currently
6037 fetched for this group."
6039 (unless gnus-newsgroup-dormant
6040 (error "There are no dormant articles in this group"))
6042 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6043 (gnus-summary-position-point)))
6045 (defun gnus-summary-limit-exclude-dormant ()
6046 "Hide all dormant articles."
6049 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6050 (gnus-summary-position-point)))
6052 (defun gnus-summary-limit-exclude-childless-dormant ()
6053 "Hide all dormant articles that have no children."
6055 (let ((data (gnus-data-list t))
6056 articles d children)
6057 ;; Find all articles that are either not dormant or have
6059 (while (setq d (pop data))
6060 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6062 (gnus-article-children (gnus-data-number d)))
6065 (when (memq (car children) articles)
6070 (push (gnus-data-number d) articles)))
6073 (gnus-summary-limit articles)
6074 (gnus-summary-position-point))))
6076 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6077 "Mark all unread excluded articles as read.
6078 If ALL, mark even excluded ticked and dormants as read."
6080 (let ((articles (gnus-sorted-complement
6082 (mapcar (lambda (h) (mail-header-number h))
6083 gnus-newsgroup-headers)
6085 (sort gnus-newsgroup-limit '<)))
6087 (setq gnus-newsgroup-unreads
6088 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6090 (setq gnus-newsgroup-dormant nil
6091 gnus-newsgroup-marked nil
6092 gnus-newsgroup-reads
6094 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6095 gnus-newsgroup-reads))
6096 (while (setq article (pop articles))
6097 (unless (or (memq article gnus-newsgroup-dormant)
6098 (memq article gnus-newsgroup-marked))
6099 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6101 (defun gnus-summary-limit (articles &optional pop)
6103 ;; We pop the previous limit off the stack and use that.
6104 (setq articles (car gnus-newsgroup-limits)
6105 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6106 ;; We use the new limit, so we push the old limit on the stack.
6107 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6109 (setq gnus-newsgroup-limit articles)
6110 (let ((total (length gnus-newsgroup-data))
6111 (data (gnus-data-find-list (gnus-summary-article-number)))
6112 (gnus-summary-mark-below nil) ; Inhibit this.
6114 ;; This will do all the work of generating the new summary buffer
6115 ;; according to the new limit.
6116 (gnus-summary-prepare)
6117 ;; Hide any threads, possibly.
6118 (and gnus-show-threads
6119 gnus-thread-hide-subtree
6120 (gnus-summary-hide-all-threads))
6121 ;; Try to return to the article you were at, or one in the
6124 ;; We try to find some article after the current one.
6126 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6129 (setq data (cdr data))))
6131 ;; If there is no data, that means that we were after the last
6132 ;; article. The same goes when we can't find any articles
6133 ;; after the current one.
6134 (goto-char (point-max))
6135 (gnus-summary-find-prev))
6136 (gnus-set-mode-line 'summary)
6137 ;; We return how many articles were removed from the summary
6138 ;; buffer as a result of the new limit.
6139 (- total (length gnus-newsgroup-data))))
6141 (defsubst gnus-invisible-cut-children (threads)
6144 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6149 (defsubst gnus-cut-thread (thread)
6150 "Go forwards in the thread until we find an article that we want to display."
6151 (when (or (eq gnus-fetch-old-headers 'some)
6152 (eq gnus-fetch-old-headers 'invisible)
6153 (eq gnus-build-sparse-threads 'some)
6154 (eq gnus-build-sparse-threads 'more))
6155 ;; Deal with old-fetched headers and sparse threads.
6159 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6160 (gnus-summary-article-ancient-p
6161 (mail-header-number (car thread))))
6162 (if (or (<= (length (cdr thread)) 1)
6163 (eq gnus-fetch-old-headers 'invisible))
6164 (setq gnus-newsgroup-limit
6165 (delq (mail-header-number (car thread))
6166 gnus-newsgroup-limit)
6167 thread (cadr thread))
6168 (when (gnus-invisible-cut-children (cdr thread))
6169 (let ((th (cdr thread)))
6171 (if (memq (mail-header-number (caar th))
6172 gnus-newsgroup-limit)
6173 (setq thread (car th)
6175 (setq th (cdr th))))))))))
6178 (defun gnus-cut-threads (threads)
6179 "Cut off all uninteresting articles from the beginning of threads."
6180 (when (or (eq gnus-fetch-old-headers 'some)
6181 (eq gnus-fetch-old-headers 'invisible)
6182 (eq gnus-build-sparse-threads 'some)
6183 (eq gnus-build-sparse-threads 'more))
6186 (setcar th (gnus-cut-thread (car th)))
6187 (setq th (cdr th)))))
6188 ;; Remove nixed out threads.
6191 (defun gnus-summary-initial-limit (&optional show-if-empty)
6192 "Figure out what the initial limit is supposed to be on group entry.
6193 This entails weeding out unwanted dormants, low-scored articles,
6194 fetch-old-headers verbiage, and so on."
6195 ;; Most groups have nothing to remove.
6196 (if (or gnus-inhibit-limiting
6197 (and (null gnus-newsgroup-dormant)
6198 (not (eq gnus-fetch-old-headers 'some))
6199 (not (eq gnus-fetch-old-headers 'invisible))
6200 (null gnus-summary-expunge-below)
6201 (not (eq gnus-build-sparse-threads 'some))
6202 (not (eq gnus-build-sparse-threads 'more))
6203 (null gnus-thread-expunge-below)
6204 (not gnus-use-nocem)))
6206 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6207 (setq gnus-newsgroup-limit nil)
6210 (unless (car (symbol-value node))
6211 ;; These threads have no parents -- they are roots.
6212 (let ((nodes (cdr (symbol-value node)))
6215 (if (and gnus-thread-expunge-below
6216 (< (gnus-thread-total-score (car nodes))
6217 gnus-thread-expunge-below))
6218 (gnus-expunge-thread (pop nodes))
6219 (setq thread (pop nodes))
6220 (gnus-summary-limit-children thread))))))
6221 gnus-newsgroup-dependencies)
6222 ;; If this limitation resulted in an empty group, we might
6223 ;; pop the previous limit and use it instead.
6224 (when (and (not gnus-newsgroup-limit)
6226 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6227 gnus-newsgroup-limit))
6229 (defun gnus-summary-limit-children (thread)
6230 "Return 1 if this subthread is visible and 0 if it is not."
6231 ;; First we get the number of visible children to this thread. This
6232 ;; is done by recursing down the thread using this function, so this
6233 ;; will really go down to a leaf article first, before slowly
6234 ;; working its way up towards the root.
6238 (apply '+ (mapcar 'gnus-summary-limit-children
6241 (number (mail-header-number (car thread)))
6244 (not (memq number gnus-newsgroup-marked))
6246 ;; If this article is dormant and has absolutely no visible
6247 ;; children, then this article isn't visible.
6248 (and (memq number gnus-newsgroup-dormant)
6250 ;; If this is "fetch-old-headered" and there is no
6251 ;; visible children, then we don't want this article.
6252 (and (eq gnus-fetch-old-headers 'some)
6253 (gnus-summary-article-ancient-p number)
6255 ;; If this is "fetch-old-headered" and `invisible', then
6256 ;; we don't want this article.
6257 (and (eq gnus-fetch-old-headers 'invisible)
6258 (gnus-summary-article-ancient-p number))
6259 ;; If this is a sparsely inserted article with no children,
6260 ;; we don't want it.
6261 (and (eq gnus-build-sparse-threads 'some)
6262 (gnus-summary-article-sparse-p number)
6264 ;; If we use expunging, and this article is really
6265 ;; low-scored, then we don't want this article.
6266 (when (and gnus-summary-expunge-below
6268 (or (cdr (assq number gnus-newsgroup-scored))
6269 gnus-summary-default-score))
6270 gnus-summary-expunge-below))
6271 ;; We increase the expunge-tally here, but that has
6272 ;; nothing to do with the limits, really.
6273 (incf gnus-newsgroup-expunged-tally)
6274 ;; We also mark as read here, if that's wanted.
6275 (when (and gnus-summary-mark-below
6276 (< score gnus-summary-mark-below))
6277 (setq gnus-newsgroup-unreads
6278 (delq number gnus-newsgroup-unreads))
6279 (if gnus-newsgroup-auto-expire
6280 (push number gnus-newsgroup-expirable)
6281 (push (cons number gnus-low-score-mark)
6282 gnus-newsgroup-reads)))
6284 ;; Check NoCeM things.
6285 (if (and gnus-use-nocem
6286 (gnus-nocem-unwanted-article-p
6287 (mail-header-id (car thread))))
6289 (setq gnus-newsgroup-unreads
6290 (delq number gnus-newsgroup-unreads))
6292 ;; Nope, invisible article.
6294 ;; Ok, this article is to be visible, so we add it to the limit
6296 (push number gnus-newsgroup-limit)
6299 (defun gnus-expunge-thread (thread)
6300 "Mark all articles in THREAD as read."
6301 (let* ((number (mail-header-number (car thread))))
6302 (incf gnus-newsgroup-expunged-tally)
6303 ;; We also mark as read here, if that's wanted.
6304 (setq gnus-newsgroup-unreads
6305 (delq number gnus-newsgroup-unreads))
6306 (if gnus-newsgroup-auto-expire
6307 (push number gnus-newsgroup-expirable)
6308 (push (cons number gnus-low-score-mark)
6309 gnus-newsgroup-reads)))
6310 ;; Go recursively through all subthreads.
6311 (mapcar 'gnus-expunge-thread (cdr thread)))
6313 ;; Summary article oriented commands
6315 (defun gnus-summary-refer-parent-article (n)
6316 "Refer parent article N times.
6317 If N is negative, go to ancestor -N instead.
6318 The difference between N and the number of articles fetched is returned."
6322 (when (not (natnump n))
6327 (setq header (gnus-summary-article-header))
6328 (if (and (eq (mail-header-number header)
6329 (cdr gnus-article-current))
6330 (equal gnus-newsgroup-name
6331 (car gnus-article-current)))
6332 ;; If we try to find the parent of the currently
6333 ;; displayed article, then we take a look at the actual
6334 ;; References header, since this is slightly more
6335 ;; reliable than the References field we got from the
6338 (set-buffer gnus-original-article-buffer)
6339 (nnheader-narrow-to-headers)
6340 (unless (setq ref (message-fetch-field "references"))
6341 (setq ref (message-fetch-field "in-reply-to")))
6344 ;; It's not the current article, so we take a bet on
6345 ;; the value we got from the server.
6346 (mail-header-references header)))
6348 (not (equal ref "")))
6349 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6350 (gnus-message 1 "Couldn't find parent"))
6351 (gnus-message 1 "No references in article %d"
6352 (gnus-summary-article-number))
6355 (gnus-summary-position-point)
6358 (defun gnus-summary-refer-references ()
6359 "Fetch all articles mentioned in the References header.
6360 Return the number of articles fetched."
6362 (let ((ref (mail-header-references (gnus-summary-article-header)))
6363 (current (gnus-summary-article-number))
6367 (error "No References in the current article")
6368 ;; For each Message-ID in the References header...
6369 (while (string-match "<[^>]*>" ref)
6371 ;; ... fetch that article.
6372 (gnus-summary-refer-article
6373 (prog1 (match-string 0 ref)
6374 (setq ref (substring ref (match-end 0))))))
6375 (gnus-summary-goto-subject current)
6376 (gnus-summary-position-point)
6379 (defun gnus-summary-refer-thread (&optional limit)
6380 "Fetch all articles in the current thread.
6381 If LIMIT (the numerical prefix), fetch that many old headers instead
6382 of what's specified by the `gnus-refer-thread-limit' variable."
6384 (let ((id (mail-header-id (gnus-summary-article-header)))
6385 (limit (if limit (prefix-numeric-value limit)
6386 gnus-refer-thread-limit)))
6387 ;; We want to fetch LIMIT *old* headers, but we also have to
6388 ;; re-fetch all the headers in the current buffer, because many of
6389 ;; them may be undisplayed. So we adjust LIMIT.
6390 (when (numberp limit)
6391 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6392 (unless (eq gnus-fetch-old-headers 'invisible)
6393 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6394 ;; Retrieve the headers and read them in.
6395 (if (eq (gnus-retrieve-headers
6396 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6398 (gnus-build-all-threads)
6399 (error "Can't fetch thread from backends that don't support NOV"))
6400 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6401 (gnus-summary-limit-include-thread id)))
6403 (defun gnus-summary-refer-article (message-id &optional arg)
6404 "Fetch an article specified by MESSAGE-ID.
6405 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6406 or `gnus-select-method', no matter what backend the article comes from."
6407 (interactive "sMessage-ID: \nP")
6408 (when (and (stringp message-id)
6409 (not (zerop (length message-id))))
6410 ;; Construct the correct Message-ID if necessary.
6411 ;; Suggested by tale@pawl.rpi.edu.
6412 (unless (string-match "^<" message-id)
6413 (setq message-id (concat "<" message-id)))
6414 (unless (string-match ">$" message-id)
6415 (setq message-id (concat message-id ">")))
6416 (let* ((header (gnus-id-to-header message-id))
6418 (gnus-summary-article-sparse-p
6419 (mail-header-number header))
6420 (memq (mail-header-number header)
6421 gnus-newsgroup-limit))))
6423 ;; If the article is present in the buffer we just go to it.
6425 (or (not (gnus-summary-article-sparse-p
6426 (mail-header-number header)))
6429 (gnus-summary-goto-article
6430 (mail-header-number header) nil t)
6432 (gnus-summary-update-article (mail-header-number header)))))
6434 ;; We fetch the article
6435 (let ((gnus-override-method
6436 (cond ((gnus-news-group-p gnus-newsgroup-name)
6437 gnus-refer-article-method)
6439 (or gnus-refer-article-method gnus-select-method))
6442 ;; Start the special refer-article method, if necessary.
6443 (when (and gnus-refer-article-method
6444 (gnus-news-group-p gnus-newsgroup-name))
6445 (gnus-check-server gnus-refer-article-method))
6446 ;; Fetch the header, and display the article.
6447 (if (setq number (gnus-summary-insert-subject message-id))
6448 (gnus-summary-select-article nil nil nil number)
6449 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6451 (defun gnus-summary-edit-parameters ()
6452 "Edit the group parameters of the current group."
6454 (gnus-group-edit-group gnus-newsgroup-name 'params))
6456 (defun gnus-summary-enter-digest-group (&optional force)
6457 "Enter an nndoc group based on the current article.
6458 If FORCE, force a digest interpretation. If not, try
6459 to guess what the document format is."
6461 (let ((conf gnus-current-window-configuration))
6463 (gnus-summary-select-article))
6464 (setq gnus-current-window-configuration conf)
6465 (let* ((name (format "%s-%d"
6466 (gnus-group-prefixed-name
6467 gnus-newsgroup-name (list 'nndoc ""))
6469 (set-buffer gnus-summary-buffer)
6470 gnus-current-article)))
6471 (ogroup gnus-newsgroup-name)
6472 (params (append (gnus-info-params (gnus-get-info ogroup))
6473 (list (cons 'to-group ogroup))
6474 (list (cons 'save-article-group ogroup))))
6475 (case-fold-search t)
6476 (buf (current-buffer))
6479 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6480 (insert-buffer-substring gnus-original-article-buffer)
6481 ;; Remove lines that may lead nndoc to misinterpret the
6484 (goto-char (point-min))
6485 (or (search-forward "\n\n" nil t) (point)))
6486 (goto-char (point-min))
6487 (delete-matching-lines "^\\(Path\\):\\|^From ")
6490 (if (gnus-group-read-ephemeral-group
6491 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6493 ,(if force 'digest 'guess))) t)
6494 ;; Make all postings to this group go to the parent group.
6495 (nconc (gnus-info-params (gnus-get-info name))
6497 ;; Couldn't select this doc group.
6498 (switch-to-buffer buf)
6499 (gnus-set-global-variables)
6500 (gnus-configure-windows 'summary)
6501 (gnus-message 3 "Article couldn't be entered?"))
6502 (kill-buffer dig)))))
6504 (defun gnus-summary-read-document (n)
6505 "Open a new group based on the current article(s).
6506 This will allow you to read digests and other similar
6507 documents as newsgroups.
6508 Obeys the standard process/prefix convention."
6510 (let* ((articles (gnus-summary-work-articles n))
6511 (ogroup gnus-newsgroup-name)
6512 (params (append (gnus-info-params (gnus-get-info ogroup))
6513 (list (cons 'to-group ogroup))))
6514 article group egroup groups vgroup)
6515 (while (setq article (pop articles))
6516 (setq group (format "%s-%d" gnus-newsgroup-name article))
6517 (gnus-summary-remove-process-mark article)
6518 (when (gnus-summary-display-article article)
6520 (nnheader-temp-write nil
6521 (insert-buffer-substring gnus-original-article-buffer)
6522 ;; Remove some headers that may lead nndoc to make
6524 (message-narrow-to-head)
6525 (goto-char (point-min))
6526 (delete-matching-lines "^\\(Path\\):\\|^From ")
6529 (gnus-group-read-ephemeral-group
6530 group `(nndoc ,group (nndoc-address ,(current-buffer))
6531 (nndoc-article-type guess))
6534 ;; Make all postings to this group go to the parent group.
6535 (nconc (gnus-info-params (gnus-get-info egroup))
6537 (push egroup groups))
6538 ;; Couldn't select this doc group.
6539 (gnus-error 3 "Article couldn't be entered"))))))
6540 ;; Now we have selected all the documents.
6543 (error "None of the articles could be interpreted as documents"))
6544 ((gnus-group-read-ephemeral-group
6545 (setq vgroup (format
6546 "nnvirtual:%s-%s" gnus-newsgroup-name
6547 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6548 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6550 (cons (current-buffer) 'summary)))
6552 (error "Couldn't select virtual nndoc group")))))
6554 (defun gnus-summary-isearch-article (&optional regexp-p)
6555 "Do incremental search forward on the current article.
6556 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6558 (gnus-summary-select-article)
6559 (gnus-configure-windows 'article)
6560 (gnus-eval-in-buffer-window gnus-article-buffer
6563 (isearch-forward regexp-p))))
6565 (defun gnus-summary-search-article-forward (regexp &optional backward)
6566 "Search for an article containing REGEXP forward.
6567 If BACKWARD, search backward instead."
6570 (format "Search article %s (regexp%s): "
6571 (if current-prefix-arg "backward" "forward")
6572 (if gnus-last-search-regexp
6573 (concat ", default " gnus-last-search-regexp)
6575 current-prefix-arg))
6576 (if (string-equal regexp "")
6577 (setq regexp (or gnus-last-search-regexp ""))
6578 (setq gnus-last-search-regexp regexp))
6579 (if (gnus-summary-search-article regexp backward)
6580 (gnus-summary-show-thread)
6581 (error "Search failed: \"%s\"" regexp)))
6583 (defun gnus-summary-search-article-backward (regexp)
6584 "Search for an article containing REGEXP backward."
6587 (format "Search article backward (regexp%s): "
6588 (if gnus-last-search-regexp
6589 (concat ", default " gnus-last-search-regexp)
6591 (gnus-summary-search-article-forward regexp 'backward))
6593 (defun gnus-summary-search-article (regexp &optional backward)
6594 "Search for an article containing REGEXP.
6595 Optional argument BACKWARD means do search for backward.
6596 `gnus-select-article-hook' is not called during the search."
6597 ;; We have to require this here to make sure that the following
6598 ;; dynamic binding isn't shadowed by autoloading.
6599 (require 'gnus-async)
6600 (let ((gnus-select-article-hook nil) ;Disable hook.
6601 (gnus-article-display-hook nil)
6602 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6603 (gnus-use-article-prefetch nil)
6604 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6605 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6606 (sum (current-buffer))
6609 (gnus-save-hidden-threads
6610 (gnus-summary-select-article)
6611 (set-buffer gnus-article-buffer)
6615 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6617 (re-search-backward regexp nil t)
6618 (re-search-forward regexp nil t))
6619 ;; We found the regexp.
6624 (get-buffer-window (current-buffer))
6628 (setq point (point)))
6629 ;; We didn't find it, so we go to the next article.
6632 (while (eq found 'not)
6633 (if (not (if backward (gnus-summary-find-prev)
6634 (gnus-summary-find-next)))
6635 ;; No more articles.
6637 ;; Select the next article and adjust point.
6638 (unless (gnus-summary-article-sparse-p
6639 (gnus-summary-article-number))
6641 (gnus-summary-select-article)
6642 (set-buffer gnus-article-buffer)
6644 (goto-char (if backward (point-max) (point-min))))))))
6645 (gnus-message 7 ""))
6646 ;; Return whether we found the regexp.
6647 (when (eq found 'found)
6649 (gnus-summary-show-thread)
6650 (gnus-summary-goto-subject gnus-current-article)
6651 (gnus-summary-position-point)
6654 (defun gnus-summary-find-matching (header regexp &optional backward unread
6656 "Return a list of all articles that match REGEXP on HEADER.
6657 The search stars on the current article and goes forwards unless
6658 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6659 If UNREAD is non-nil, only unread articles will
6660 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6661 in the comparisons."
6662 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6663 (gnus-data-find-list
6664 (gnus-summary-article-number) (gnus-data-list backward))))
6665 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6666 (case-fold-search (not not-case-fold))
6668 (unless (fboundp (intern (concat "mail-header-" header)))
6669 (error "%s is not a valid header" header))
6672 (and (or (not unread) ; We want all articles...
6673 (gnus-data-unread-p d)) ; Or just unreads.
6674 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6675 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6676 (push (gnus-data-number d) articles)) ; Success!
6677 (setq data (cdr data)))
6678 (nreverse articles)))
6680 (defun gnus-summary-execute-command (header regexp command &optional backward)
6681 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6682 If HEADER is an empty string (or nil), the match is done on the entire
6683 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6685 (list (let ((completion-ignore-case t))
6688 (mapcar (lambda (string) (list string))
6689 '("Number" "Subject" "From" "Lines" "Date"
6690 "Message-ID" "Xref" "References" "Body"))
6691 nil 'require-match))
6692 (read-string "Regexp: ")
6693 (read-key-sequence "Command: ")
6694 current-prefix-arg))
6695 (when (equal header "Body")
6697 ;; Hidden thread subtrees must be searched as well.
6698 (gnus-summary-show-all-threads)
6699 ;; We don't want to change current point nor window configuration.
6701 (save-window-excursion
6702 (gnus-message 6 "Executing %s..." (key-description command))
6703 ;; We'd like to execute COMMAND interactively so as to give arguments.
6704 (gnus-execute header regexp
6705 `(call-interactively ',(key-binding command))
6707 (gnus-message 6 "Executing %s...done" (key-description command)))))
6709 (defun gnus-summary-beginning-of-article ()
6710 "Scroll the article back to the beginning."
6712 (gnus-summary-select-article)
6713 (gnus-configure-windows 'article)
6714 (gnus-eval-in-buffer-window gnus-article-buffer
6716 (goto-char (point-min))
6717 (when gnus-page-broken
6718 (gnus-narrow-to-page))))
6720 (defun gnus-summary-end-of-article ()
6721 "Scroll to the end of the article."
6723 (gnus-summary-select-article)
6724 (gnus-configure-windows 'article)
6725 (gnus-eval-in-buffer-window gnus-article-buffer
6727 (goto-char (point-max))
6729 (when gnus-page-broken
6730 (gnus-narrow-to-page))))
6732 (defun gnus-summary-print-article (&optional filename n)
6733 "Generate and print a PostScript image of the N next (mail) articles.
6735 If N is negative, print the N previous articles. If N is nil and articles
6736 have been marked with the process mark, print these instead.
6738 If the optional second argument FILENAME is nil, send the image to the
6739 printer. If FILENAME is a string, save the PostScript image in a file with
6740 that name. If FILENAME is a number, prompt the user for the name of the file
6742 (interactive (list (ps-print-preprint current-prefix-arg)
6743 current-prefix-arg))
6744 (dolist (article (gnus-summary-work-articles n))
6745 (gnus-summary-select-article nil nil 'pseudo article)
6746 (gnus-eval-in-buffer-window gnus-article-buffer
6747 (let ((buffer (generate-new-buffer " *print*")))
6750 (copy-to-buffer buffer (point-min) (point-max))
6752 (gnus-article-delete-invisible-text)
6753 (let ((ps-left-header
6756 (mail-header-subject gnus-current-headers) ")")
6758 (mail-header-from gnus-current-headers) ")")))
6761 "/pagenumberstring load"
6763 (mail-header-date gnus-current-headers) ")"))))
6764 (gnus-run-hooks 'gnus-ps-print-hook)
6766 (ps-print-buffer-with-faces filename))))
6767 (kill-buffer buffer))))))
6769 (defun gnus-summary-show-article (&optional arg)
6770 "Force re-fetching of the current article.
6771 If ARG (the prefix) is non-nil, show the raw article without any
6772 article massaging functions being run."
6775 ;; Select the article the normal way.
6776 (gnus-summary-select-article nil 'force)
6777 ;; Bind the article treatment functions to nil.
6778 (let ((gnus-have-all-headers t)
6779 gnus-article-display-hook
6780 gnus-article-prepare-hook
6784 (gnus-summary-select-article nil 'force)))
6785 (gnus-summary-goto-subject gnus-current-article)
6786 (gnus-summary-position-point))
6788 (defun gnus-summary-verbose-headers (&optional arg)
6789 "Toggle permanent full header display.
6790 If ARG is a positive number, turn header display on.
6791 If ARG is a negative number, turn header display off."
6793 (setq gnus-show-all-headers
6794 (cond ((or (not (numberp arg))
6796 (not gnus-show-all-headers))
6799 (gnus-summary-show-article))
6801 (defun gnus-summary-toggle-header (&optional arg)
6802 "Show the headers if they are hidden, or hide them if they are shown.
6803 If ARG is a positive number, show the entire header.
6804 If ARG is a negative number, hide the unwanted header lines."
6807 (set-buffer gnus-article-buffer)
6808 (let* ((buffer-read-only nil)
6809 (inhibit-point-motion-hooks t)
6810 (hidden (text-property-any
6811 (goto-char (point-min)) (search-forward "\n\n")
6814 (goto-char (point-min))
6815 (when (search-forward "\n\n" nil t)
6816 (delete-region (point-min) (1- (point))))
6817 (goto-char (point-min))
6819 (set-buffer gnus-original-article-buffer)
6820 (goto-char (point-min))
6821 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6822 (insert-buffer-substring gnus-original-article-buffer 1 e)
6823 (let ((article-inhibit-hiding t))
6824 (gnus-run-hooks 'gnus-article-display-hook))
6825 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6826 (gnus-article-hide-headers)))))
6828 (defun gnus-summary-show-all-headers ()
6829 "Make all header lines visible."
6831 (gnus-article-show-all-headers))
6833 (defun gnus-summary-toggle-mime (&optional arg)
6834 "Toggle MIME processing.
6835 If ARG is a positive number, turn MIME processing on."
6837 (setq gnus-show-mime
6838 (if (null arg) (not gnus-show-mime)
6839 (> (prefix-numeric-value arg) 0)))
6840 (gnus-summary-select-article t 'force))
6842 (defun gnus-summary-set-default-charset (charset)
6843 "Display the current article with MIME CHARSET."
6845 (list (completing-read "MIME-charset = "
6848 (list (symbol-name cs))
6850 (mime-charset-list)))))
6851 (let ((default-mime-charset charset))
6852 (gnus-summary-select-article t 'force)
6855 (defun gnus-summary-caesar-message (&optional arg)
6856 "Caesar rotate the current article by 13.
6857 The numerical prefix specifies how many places to rotate each letter
6860 (gnus-summary-select-article)
6861 (let ((mail-header-separator ""))
6862 (gnus-eval-in-buffer-window gnus-article-buffer
6865 (let ((start (window-start))
6867 (message-caesar-buffer-body arg)
6868 (set-window-start (get-buffer-window (current-buffer)) start))))))
6870 (defun gnus-summary-stop-page-breaking ()
6871 "Stop page breaking in the current article."
6873 (gnus-summary-select-article)
6874 (gnus-eval-in-buffer-window gnus-article-buffer
6876 (when (gnus-visual-p 'page-marker)
6877 (let ((buffer-read-only nil))
6878 (gnus-remove-text-with-property 'gnus-prev)
6879 (gnus-remove-text-with-property 'gnus-next))
6880 (setq gnus-page-broken nil))))
6882 (defun gnus-summary-move-article (&optional n to-newsgroup
6883 select-method action)
6884 "Move the current article to a different newsgroup.
6885 If N is a positive number, move the N next articles.
6886 If N is a negative number, move the N previous articles.
6887 If N is nil and any articles have been marked with the process mark,
6888 move those articles instead.
6889 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6890 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6891 re-spool using this method.
6893 For this function to work, both the current newsgroup and the
6894 newsgroup that you want to move to have to support the `request-move'
6895 and `request-accept' functions."
6898 (setq action 'move))
6899 ;; Disable marking as read.
6900 (let (gnus-mark-article-hook)
6901 (save-window-excursion
6902 (gnus-summary-select-article)))
6903 ;; Check whether the source group supports the required functions.
6904 (cond ((and (eq action 'move)
6905 (not (gnus-check-backend-function
6906 'request-move-article gnus-newsgroup-name)))
6907 (error "The current group does not support article moving"))
6908 ((and (eq action 'crosspost)
6909 (not (gnus-check-backend-function
6910 'request-replace-article gnus-newsgroup-name)))
6911 (error "The current group does not support article editing")))
6912 (let ((articles (gnus-summary-work-articles n))
6913 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6914 (names '((move "Move" "Moving")
6915 (copy "Copy" "Copying")
6916 (crosspost "Crosspost" "Crossposting")))
6917 (copy-buf (save-excursion
6918 (nnheader-set-temp-buffer " *copy article*")))
6919 (default-marks gnus-article-mark-lists)
6920 (no-expire-marks (delete '(expirable . expire)
6921 (copy-sequence gnus-article-mark-lists)))
6922 art-group to-method new-xref article to-groups)
6923 (unless (assq action names)
6924 (error "Unknown action %s" action))
6925 ;; Read the newsgroup name.
6926 (when (and (not to-newsgroup)
6927 (not select-method))
6929 (gnus-read-move-group-name
6930 (cadr (assq action names))
6931 (symbol-value (intern (format "gnus-current-%s-group" action)))
6933 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6934 (setq to-method (or select-method
6935 (gnus-group-name-to-method to-newsgroup)))
6936 ;; Check the method we are to move this article to...
6937 (unless (gnus-check-backend-function
6938 'request-accept-article (car to-method))
6939 (error "%s does not support article copying" (car to-method)))
6940 (unless (gnus-check-server to-method)
6941 (error "Can't open server %s" (car to-method)))
6942 (gnus-message 6 "%s to %s: %s..."
6943 (caddr (assq action names))
6944 (or (car select-method) to-newsgroup) articles)
6946 (setq article (pop articles))
6950 ;; Move the article.
6952 ;; Remove this article from future suppression.
6953 (gnus-dup-unsuppress-article article)
6954 (gnus-request-move-article
6955 article ; Article to move
6956 gnus-newsgroup-name ; From newsgroup
6957 (nth 1 (gnus-find-method-for-group
6958 gnus-newsgroup-name)) ; Server
6959 (list 'gnus-request-accept-article
6960 to-newsgroup (list 'quote select-method)
6961 (not articles)) ; Accept form
6962 (not articles))) ; Only save nov last time
6963 ;; Copy the article.
6966 (set-buffer copy-buf)
6967 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
6968 (gnus-request-accept-article
6969 to-newsgroup select-method (not articles)))))
6970 ;; Crosspost the article.
6971 ((eq action 'crosspost)
6972 (let ((xref (message-tokenize-header
6973 (mail-header-xref (gnus-summary-article-header article))
6975 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6978 (setq xref (list (system-name))))
6981 (mapconcat 'identity
6982 (delete "Xref:" (delete new-xref xref))
6986 (set-buffer copy-buf)
6987 ;; First put the article in the destination group.
6988 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6989 (when (consp (setq art-group
6990 (gnus-request-accept-article
6991 to-newsgroup select-method (not articles))))
6992 (setq new-xref (concat new-xref " " (car art-group)
6993 ":" (cdr art-group)))
6994 ;; Now we have the new Xrefs header, so we insert
6995 ;; it and replace the new article.
6996 (nnheader-replace-header "Xref" new-xref)
6997 (gnus-request-replace-article
6998 (cdr art-group) to-newsgroup (current-buffer))
7002 (gnus-message 1 "Couldn't %s article %s"
7003 (cadr (assq action names)) article))
7004 ((and (eq art-group 'junk)
7006 (gnus-summary-mark-article article gnus-canceled-mark)
7007 (gnus-message 4 "Deleted article %s" article))
7009 (let* ((pto-group (gnus-group-prefixed-name
7010 (car art-group) to-method))
7012 (gnus-gethash pto-group gnus-newsrc-hashtb))
7013 (info (nth 2 entry))
7014 (to-group (gnus-info-group info)))
7015 ;; Update the group that has been moved to.
7017 (memq action '(move copy)))
7018 (unless (member to-group to-groups)
7019 (push to-group to-groups))
7021 (unless (memq article gnus-newsgroup-unreads)
7023 info (gnus-add-to-range (gnus-info-read info)
7024 (list (cdr art-group)))))
7026 ;; Copy any marks over to the new group.
7027 (let ((marks (if (gnus-group-auto-expirable-p to-group)
7030 (to-article (cdr art-group)))
7032 ;; See whether the article is to be put in the cache.
7033 (when gnus-use-cache
7034 (gnus-cache-possibly-enter-article
7036 (let ((header (copy-sequence
7037 (gnus-summary-article-header article))))
7038 (mail-header-set-number header to-article)
7040 (memq article gnus-newsgroup-marked)
7041 (memq article gnus-newsgroup-dormant)
7042 (memq article gnus-newsgroup-unreads)))
7044 (when (and (equal to-group gnus-newsgroup-name)
7045 (not (memq article gnus-newsgroup-unreads)))
7046 ;; Mark this article as read in this group.
7047 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7048 (setcdr (gnus-active to-group) to-article)
7049 (setcdr gnus-newsgroup-active to-article))
7052 (when (memq article (symbol-value
7053 (intern (format "gnus-newsgroup-%s"
7055 ;; If the other group is the same as this group,
7056 ;; then we have to add the mark to the list.
7057 (when (equal to-group gnus-newsgroup-name)
7058 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7061 (intern (format "gnus-newsgroup-%s"
7063 ;; Copy the marks to other group.
7064 (gnus-add-marked-articles
7065 to-group (cdar marks) (list to-article) info))
7066 (setq marks (cdr marks)))
7069 (concat "(gnus-group-set-info '"
7070 (gnus-prin1-to-string (gnus-get-info to-group))
7073 ;; Update the Xref header in this article to point to
7074 ;; the new crossposted article we have just created.
7075 (when (eq action 'crosspost)
7077 (set-buffer copy-buf)
7078 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7079 (nnheader-replace-header "Xref" new-xref)
7080 (gnus-request-replace-article
7081 article gnus-newsgroup-name (current-buffer)))))
7083 ;;;!!!Why is this necessary?
7084 (set-buffer gnus-summary-buffer)
7086 (gnus-summary-goto-subject article)
7087 (when (eq action 'move)
7088 (gnus-summary-mark-article article gnus-canceled-mark))))
7089 (gnus-summary-remove-process-mark article))
7090 ;; Re-activate all groups that have been moved to.
7093 (set-buffer gnus-group-buffer)
7094 (when (gnus-group-goto-group (car to-groups) t)
7095 (gnus-group-get-new-news-this-group 1 t))
7098 (gnus-kill-buffer copy-buf)
7099 (gnus-summary-position-point)
7100 (gnus-set-mode-line 'summary)))
7102 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7103 "Move the current article to a different newsgroup.
7104 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7105 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7106 re-spool using this method."
7108 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7110 (defun gnus-summary-crosspost-article (&optional n)
7111 "Crosspost the current article to some other group."
7113 (gnus-summary-move-article n nil nil 'crosspost))
7115 (defcustom gnus-summary-respool-default-method nil
7116 "Default method for respooling an article.
7117 If nil, use to the current newsgroup method."
7118 :type '(choice (gnus-select-method :value (nnml ""))
7120 :group 'gnus-summary-mail)
7122 (defun gnus-summary-respool-article (&optional n method)
7123 "Respool the current article.
7124 The article will be squeezed through the mail spooling process again,
7125 which means that it will be put in some mail newsgroup or other
7126 depending on `nnmail-split-methods'.
7127 If N is a positive number, respool the N next articles.
7128 If N is a negative number, respool the N previous articles.
7129 If N is nil and any articles have been marked with the process mark,
7130 respool those articles instead.
7132 Respooling can be done both from mail groups and \"real\" newsgroups.
7133 In the former case, the articles in question will be moved from the
7134 current group into whatever groups they are destined to. In the
7135 latter case, they will be copied into the relevant groups."
7137 (list current-prefix-arg
7138 (let* ((methods (gnus-methods-using 'respool))
7140 (symbol-name (or gnus-summary-respool-default-method
7141 (car (gnus-find-method-for-group
7142 gnus-newsgroup-name)))))
7144 (gnus-completing-read
7145 methname "What backend do you want to use when respooling?"
7146 methods nil t nil 'gnus-mail-method-history))
7149 ((zerop (length (setq ms (gnus-servers-using-backend
7151 (list (intern method) ""))
7155 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7156 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7159 (error "No method given for respooling"))
7160 (if (assoc (symbol-name
7161 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7162 (gnus-methods-using 'respool))
7163 (gnus-summary-move-article n nil method)
7164 (gnus-summary-copy-article n nil method)))
7166 (defun gnus-summary-import-article (file)
7167 "Import an arbitrary file into a mail newsgroup."
7168 (interactive "fImport file: ")
7169 (let ((group gnus-newsgroup-name)
7170 (now (current-time))
7172 (unless (gnus-check-backend-function 'request-accept-article group)
7173 (error "%s does not support article importing" group))
7174 (or (file-readable-p file)
7175 (not (file-regular-p file))
7176 (error "Can't read %s" file))
7178 (set-buffer (gnus-get-buffer-create " *import file*"))
7179 (buffer-disable-undo (current-buffer))
7181 (nnheader-insert-file-contents file)
7182 (goto-char (point-min))
7183 (unless (nnheader-article-p)
7184 ;; This doesn't look like an article, so we fudge some headers.
7185 (setq atts (file-attributes file)
7186 lines (count-lines (point-min) (point-max)))
7187 (insert "From: " (read-string "From: ") "\n"
7188 "Subject: " (read-string "Subject: ") "\n"
7189 "Date: " (timezone-make-date-arpa-standard
7190 (current-time-string (nth 5 atts))
7191 (current-time-zone now)
7192 (current-time-zone now))
7194 "Message-ID: " (message-make-message-id) "\n"
7195 "Lines: " (int-to-string lines) "\n"
7196 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7197 (gnus-request-accept-article group nil t)
7198 (kill-buffer (current-buffer)))))
7200 (defun gnus-summary-article-posted-p ()
7201 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7202 This will be the case if the article has both been mailed and posted."
7204 (let ((id (mail-header-references (gnus-summary-article-header)))
7205 (gnus-override-method
7206 (or gnus-refer-article-method gnus-select-method)))
7207 (if (gnus-request-head id "")
7208 (gnus-message 2 "The current message was found on %s"
7209 gnus-override-method)
7210 (gnus-message 2 "The current message couldn't be found on %s"
7211 gnus-override-method)
7214 (defun gnus-summary-expire-articles (&optional now)
7215 "Expire all articles that are marked as expirable in the current group."
7217 (when (gnus-check-backend-function
7218 'request-expire-articles gnus-newsgroup-name)
7219 ;; This backend supports expiry.
7220 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7221 (expirable (if total
7223 ;; We need to update the info for
7224 ;; this group for `gnus-list-of-read-articles'
7225 ;; to give us the right answer.
7226 (gnus-run-hooks 'gnus-exit-group-hook)
7227 (gnus-summary-update-info)
7228 (gnus-list-of-read-articles gnus-newsgroup-name))
7229 (setq gnus-newsgroup-expirable
7230 (sort gnus-newsgroup-expirable '<))))
7231 (expiry-wait (if now 'immediate
7232 (gnus-group-find-parameter
7233 gnus-newsgroup-name 'expiry-wait)))
7236 ;; There are expirable articles in this group, so we run them
7237 ;; through the expiry process.
7238 (gnus-message 6 "Expiring articles...")
7239 ;; The list of articles that weren't expired is returned.
7242 (let ((nnmail-expiry-wait-function nil)
7243 (nnmail-expiry-wait expiry-wait))
7244 (setq es (gnus-request-expire-articles
7245 expirable gnus-newsgroup-name)))
7246 (setq es (gnus-request-expire-articles
7247 expirable gnus-newsgroup-name))))
7249 (setq gnus-newsgroup-expirable es))
7250 ;; We go through the old list of expirable, and mark all
7251 ;; really expired articles as nonexistent.
7252 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7253 (let ((gnus-use-cache nil))
7255 (unless (memq (car expirable) es)
7256 (when (gnus-data-find (car expirable))
7257 (gnus-summary-mark-article
7258 (car expirable) gnus-canceled-mark)))
7259 (setq expirable (cdr expirable)))))
7260 (gnus-message 6 "Expiring articles...done")))))
7262 (defun gnus-summary-expire-articles-now ()
7263 "Expunge all expirable articles in the current group.
7264 This means that *all* articles that are marked as expirable will be
7265 deleted forever, right now."
7267 (or gnus-expert-user
7269 "Are you really, really, really sure you want to delete all these messages? ")
7271 (gnus-summary-expire-articles t))
7273 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7274 (defun gnus-summary-delete-article (&optional n)
7275 "Delete the N next (mail) articles.
7276 This command actually deletes articles. This is not a marking
7277 command. The article will disappear forever from your life, never to
7279 If N is negative, delete backwards.
7280 If N is nil and articles have been marked with the process mark,
7281 delete these instead."
7283 (unless (gnus-check-backend-function 'request-expire-articles
7284 gnus-newsgroup-name)
7285 (error "The current newsgroup does not support article deletion"))
7286 ;; Compute the list of articles to delete.
7287 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7289 (if (and gnus-novice-user
7290 (not (gnus-yes-or-no-p
7291 (format "Do you really want to delete %s forever? "
7292 (if (> (length articles) 1)
7293 (format "these %s articles" (length articles))
7296 ;; Delete the articles.
7297 (setq not-deleted (gnus-request-expire-articles
7298 articles gnus-newsgroup-name 'force))
7300 (gnus-summary-remove-process-mark (car articles))
7301 ;; The backend might not have been able to delete the article
7303 (unless (memq (car articles) not-deleted)
7304 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7305 (setq articles (cdr articles)))
7307 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7308 (gnus-summary-position-point)
7309 (gnus-set-mode-line 'summary)
7312 (defun gnus-summary-edit-article (&optional force)
7313 "Edit the current article.
7314 This will have permanent effect only in mail groups.
7315 If FORCE is non-nil, allow editing of articles even in read-only
7319 (set-buffer gnus-summary-buffer)
7320 (gnus-set-global-variables)
7321 (when (and (not force)
7322 (gnus-group-read-only-p))
7323 (error "The current newsgroup does not support article editing"))
7324 ;; Select article if needed.
7325 (unless (eq (gnus-summary-article-number)
7326 gnus-current-article)
7327 (gnus-summary-select-article t))
7328 (gnus-article-date-original)
7329 (gnus-article-edit-article
7330 `(lambda (no-highlight)
7331 (gnus-summary-edit-article-done
7332 ,(or (mail-header-references gnus-current-headers) "")
7333 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7335 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7337 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7339 "Make edits to the current article permanent."
7341 ;; Replace the article.
7342 (let ((buf (current-buffer)))
7343 (nnheader-temp-write nil
7345 (if (and (not read-only)
7346 (not (gnus-request-replace-article
7347 (cdr gnus-article-current) (car gnus-article-current)
7349 (error "Couldn't replace article")
7350 ;; Update the summary buffer.
7352 (equal (message-tokenize-header references " ")
7353 (message-tokenize-header
7354 (or (message-fetch-field "references") "") " ")))
7355 ;; We only have to update this line.
7358 (message-narrow-to-head)
7359 (let ((head (buffer-string))
7361 (nnheader-temp-write nil
7362 (insert (format "211 %d Article retrieved.\n"
7363 (cdr gnus-article-current)))
7366 (let ((nntp-server-buffer (current-buffer)))
7367 (setq header (car (gnus-get-newsgroup-headers
7369 (set-buffer gnus-summary-buffer)
7370 gnus-newsgroup-dependencies)
7373 (set-buffer gnus-summary-buffer)
7374 (gnus-data-set-header
7375 (gnus-data-find (cdr gnus-article-current))
7377 (gnus-summary-update-article-line
7378 (cdr gnus-article-current) header))))))
7380 (set-buffer (or buffer gnus-summary-buffer))
7381 (gnus-summary-update-article (cdr gnus-article-current)))
7382 ;; Prettify the article buffer again.
7383 (unless no-highlight
7385 (set-buffer gnus-article-buffer)
7386 (gnus-run-hooks 'gnus-article-display-hook)
7387 (set-buffer gnus-original-article-buffer)
7388 (gnus-request-article
7389 (cdr gnus-article-current)
7390 (car gnus-article-current) (current-buffer))))
7391 ;; Prettify the summary buffer line.
7392 (when (gnus-visual-p 'summary-highlight 'highlight)
7393 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7395 (defun gnus-summary-edit-wash (key)
7396 "Perform editing command KEY in the article buffer."
7400 (message "%s" (concat (this-command-keys) "- "))
7403 (gnus-summary-edit-article)
7404 (execute-kbd-macro (concat (this-command-keys) key))
7405 (gnus-article-edit-done))
7409 (defun gnus-summary-respool-query (&optional silent trace)
7410 "Query where the respool algorithm would put this article."
7412 (let (gnus-mark-article-hook)
7413 (gnus-summary-select-article)
7415 (set-buffer gnus-original-article-buffer)
7417 (message-narrow-to-head)
7418 (let ((groups (nnmail-article-group 'identity trace)))
7421 (message "This message would go to %s"
7422 (mapconcat 'car groups ", "))
7423 (message "This message would go to no groups"))
7426 (defun gnus-summary-respool-trace ()
7427 "Trace where the respool algorithm would put this article.
7428 Display a buffer showing all fancy splitting patterns which matched."
7430 (gnus-summary-respool-query nil t))
7432 ;; Summary marking commands.
7434 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7435 "Mark articles which has the same subject as read, and then select the next.
7436 If UNMARK is positive, remove any kind of mark.
7437 If UNMARK is negative, tick articles."
7440 (setq unmark (prefix-numeric-value unmark)))
7442 (gnus-summary-mark-same-subject
7443 (gnus-summary-article-subject) unmark)))
7444 ;; Select next unread article. If auto-select-same mode, should
7445 ;; select the first unread article.
7446 (gnus-summary-next-article t (and gnus-auto-select-same
7447 (gnus-summary-article-subject)))
7448 (gnus-message 7 "%d article%s marked as %s"
7449 count (if (= count 1) " is" "s are")
7450 (if unmark "unread" "read"))))
7452 (defun gnus-summary-kill-same-subject (&optional unmark)
7453 "Mark articles which has the same subject as read.
7454 If UNMARK is positive, remove any kind of mark.
7455 If UNMARK is negative, tick articles."
7458 (setq unmark (prefix-numeric-value unmark)))
7460 (gnus-summary-mark-same-subject
7461 (gnus-summary-article-subject) unmark)))
7462 ;; If marked as read, go to next unread subject.
7464 ;; Go to next unread subject.
7465 (gnus-summary-next-subject 1 t))
7466 (gnus-message 7 "%d articles are marked as %s"
7467 count (if unmark "unread" "read"))))
7469 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7470 "Mark articles with same SUBJECT as read, and return marked number.
7471 If optional argument UNMARK is positive, remove any kinds of marks.
7472 If optional argument UNMARK is negative, mark articles as unread instead."
7476 ((null unmark) ; Mark as read.
7479 (gnus-summary-mark-article-as-read gnus-killed-mark)
7480 (gnus-summary-show-thread) t)
7481 (gnus-summary-find-subject subject))
7482 (setq count (1+ count))))
7483 ((> unmark 0) ; Tick.
7486 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7487 (gnus-summary-show-thread) t)
7488 (gnus-summary-find-subject subject))
7489 (setq count (1+ count))))
7490 (t ; Mark as unread.
7493 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7494 (gnus-summary-show-thread) t)
7495 (gnus-summary-find-subject subject))
7496 (setq count (1+ count)))))
7497 (gnus-set-mode-line 'summary)
7498 ;; Return the number of marked articles.
7501 (defun gnus-summary-mark-as-processable (n &optional unmark)
7502 "Set the process mark on the next N articles.
7503 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7504 the process mark instead. The difference between N and the actual
7505 number of articles marked is returned."
7507 (let ((backward (< n 0))
7512 (gnus-summary-remove-process-mark
7513 (gnus-summary-article-number))
7514 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7515 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7518 (gnus-message 7 "No more articles"))
7519 (gnus-summary-recenter)
7520 (gnus-summary-position-point)
7523 (defun gnus-summary-unmark-as-processable (n)
7524 "Remove the process mark from the next N articles.
7525 If N is negative, unmark backward instead. The difference between N and
7526 the actual number of articles unmarked is returned."
7528 (gnus-summary-mark-as-processable n t))
7530 (defun gnus-summary-unmark-all-processable ()
7531 "Remove the process mark from all articles."
7534 (while gnus-newsgroup-processable
7535 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7536 (gnus-summary-position-point))
7538 (defun gnus-summary-mark-as-expirable (n)
7539 "Mark N articles forward as expirable.
7540 If N is negative, mark backward instead. The difference between N and
7541 the actual number of articles marked is returned."
7543 (gnus-summary-mark-forward n gnus-expirable-mark))
7545 (defun gnus-summary-mark-article-as-replied (article)
7546 "Mark ARTICLE replied and update the summary line."
7547 (push article gnus-newsgroup-replied)
7548 (let ((buffer-read-only nil))
7549 (when (gnus-summary-goto-subject article)
7550 (gnus-summary-update-secondary-mark article))))
7552 (defun gnus-summary-set-bookmark (article)
7553 "Set a bookmark in current article."
7554 (interactive (list (gnus-summary-article-number)))
7555 (when (or (not (get-buffer gnus-article-buffer))
7556 (not gnus-current-article)
7557 (not gnus-article-current)
7558 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7559 (error "No current article selected"))
7560 ;; Remove old bookmark, if one exists.
7561 (let ((old (assq article gnus-newsgroup-bookmarks)))
7563 (setq gnus-newsgroup-bookmarks
7564 (delq old gnus-newsgroup-bookmarks))))
7565 ;; Set the new bookmark, which is on the form
7566 ;; (article-number . line-number-in-body).
7570 (set-buffer gnus-article-buffer)
7574 (goto-char (point-min))
7575 (search-forward "\n\n" nil t)
7578 gnus-newsgroup-bookmarks)
7579 (gnus-message 6 "A bookmark has been added to the current article."))
7581 (defun gnus-summary-remove-bookmark (article)
7582 "Remove the bookmark from the current article."
7583 (interactive (list (gnus-summary-article-number)))
7584 ;; Remove old bookmark, if one exists.
7585 (let ((old (assq article gnus-newsgroup-bookmarks)))
7588 (setq gnus-newsgroup-bookmarks
7589 (delq old gnus-newsgroup-bookmarks))
7590 (gnus-message 6 "Removed bookmark."))
7591 (gnus-message 6 "No bookmark in current article."))))
7593 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7594 (defun gnus-summary-mark-as-dormant (n)
7595 "Mark N articles forward as dormant.
7596 If N is negative, mark backward instead. The difference between N and
7597 the actual number of articles marked is returned."
7599 (gnus-summary-mark-forward n gnus-dormant-mark))
7601 (defun gnus-summary-set-process-mark (article)
7602 "Set the process mark on ARTICLE and update the summary line."
7603 (setq gnus-newsgroup-processable
7605 (delq article gnus-newsgroup-processable)))
7606 (when (gnus-summary-goto-subject article)
7607 (gnus-summary-show-thread)
7608 (gnus-summary-goto-subject article)
7609 (gnus-summary-update-secondary-mark article)))
7611 (defun gnus-summary-remove-process-mark (article)
7612 "Remove the process mark from ARTICLE and update the summary line."
7613 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7614 (when (gnus-summary-goto-subject article)
7615 (gnus-summary-show-thread)
7616 (gnus-summary-goto-subject article)
7617 (gnus-summary-update-secondary-mark article)))
7619 (defun gnus-summary-set-saved-mark (article)
7620 "Set the process mark on ARTICLE and update the summary line."
7621 (push article gnus-newsgroup-saved)
7622 (when (gnus-summary-goto-subject article)
7623 (gnus-summary-update-secondary-mark article)))
7625 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7626 "Mark N articles as read forwards.
7627 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7628 The difference between N and the actual number of articles marked is
7631 (let ((backward (< n 0))
7632 (gnus-summary-goto-unread
7633 (and gnus-summary-goto-unread
7634 (not (eq gnus-summary-goto-unread 'never))
7635 (not (memq mark (list gnus-unread-mark
7636 gnus-ticked-mark gnus-dormant-mark)))))
7638 (mark (or mark gnus-del-mark)))
7640 (gnus-summary-mark-article nil mark no-expire)
7641 (zerop (gnus-summary-next-subject
7643 (and gnus-summary-goto-unread
7644 (not (eq gnus-summary-goto-unread 'never)))
7648 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7649 (gnus-summary-recenter)
7650 (gnus-summary-position-point)
7651 (gnus-set-mode-line 'summary)
7654 (defun gnus-summary-mark-article-as-read (mark)
7655 "Mark the current article quickly as read with MARK."
7656 (let ((article (gnus-summary-article-number)))
7657 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7658 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7659 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7660 (push (cons article mark) gnus-newsgroup-reads)
7661 ;; Possibly remove from cache, if that is used.
7662 (when gnus-use-cache
7663 (gnus-cache-enter-remove-article article))
7664 ;; Allow the backend to change the mark.
7665 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7666 ;; Check for auto-expiry.
7667 (when (and gnus-newsgroup-auto-expire
7668 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7669 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7670 (= mark gnus-ancient-mark)
7671 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7672 (= mark gnus-duplicate-mark)))
7673 (setq mark gnus-expirable-mark)
7674 ;; Let the backend know about the mark change.
7675 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7676 (push article gnus-newsgroup-expirable))
7677 ;; Set the mark in the buffer.
7678 (gnus-summary-update-mark mark 'unread)
7681 (defun gnus-summary-mark-article-as-unread (mark)
7682 "Mark the current article quickly as unread with MARK."
7683 (let* ((article (gnus-summary-article-number))
7684 (old-mark (gnus-summary-article-mark article)))
7685 ;; Let the backend know about the mark change.
7686 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7687 (if (eq mark old-mark)
7691 (gnus-error 1 "Can't mark negative article numbers")
7693 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7694 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7695 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7696 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7697 (cond ((= mark gnus-ticked-mark)
7698 (push article gnus-newsgroup-marked))
7699 ((= mark gnus-dormant-mark)
7700 (push article gnus-newsgroup-dormant))
7702 (push article gnus-newsgroup-unreads)))
7703 (gnus-pull article gnus-newsgroup-reads)
7705 ;; See whether the article is to be put in the cache.
7707 (vectorp (gnus-summary-article-header article))
7709 (gnus-cache-possibly-enter-article
7710 gnus-newsgroup-name article
7711 (gnus-summary-article-header article)
7712 (= mark gnus-ticked-mark)
7713 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7716 (gnus-summary-update-mark mark 'unread)
7719 (defun gnus-summary-mark-article (&optional article mark no-expire)
7720 "Mark ARTICLE with MARK. MARK can be any character.
7721 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7722 `??' (dormant) and `?E' (expirable).
7723 If MARK is nil, then the default character `?D' is used.
7724 If ARTICLE is nil, then the article on the current line will be
7726 ;; The mark might be a string.
7727 (when (stringp mark)
7728 (setq mark (aref mark 0)))
7729 ;; If no mark is given, then we check auto-expiring.
7730 (and (not no-expire)
7731 gnus-newsgroup-auto-expire
7733 (and (gnus-characterp mark)
7734 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7735 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7736 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7737 (= mark gnus-duplicate-mark))))
7738 (setq mark gnus-expirable-mark))
7739 (let* ((mark (or mark gnus-del-mark))
7740 (article (or article (gnus-summary-article-number)))
7741 (old-mark (gnus-summary-article-mark article)))
7742 ;; Let the backend know about the mark change.
7743 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7744 (if (eq mark old-mark)
7747 (error "No article on current line"))
7748 (if (not (if (or (= mark gnus-unread-mark)
7749 (= mark gnus-ticked-mark)
7750 (= mark gnus-dormant-mark))
7751 (gnus-mark-article-as-unread article mark)
7752 (gnus-mark-article-as-read article mark)))
7754 ;; See whether the article is to be put in the cache.
7756 (not (= mark gnus-canceled-mark))
7757 (vectorp (gnus-summary-article-header article))
7759 (gnus-cache-possibly-enter-article
7760 gnus-newsgroup-name article
7761 (gnus-summary-article-header article)
7762 (= mark gnus-ticked-mark)
7763 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7765 (when (gnus-summary-goto-subject article nil t)
7766 (let ((buffer-read-only nil))
7767 (gnus-summary-show-thread)
7769 (gnus-summary-update-mark mark 'unread)
7772 (defun gnus-summary-update-secondary-mark (article)
7773 "Update the secondary (read, process, cache) mark."
7774 (gnus-summary-update-mark
7775 (cond ((memq article gnus-newsgroup-processable)
7777 ((memq article gnus-newsgroup-cached)
7779 ((memq article gnus-newsgroup-replied)
7781 ((memq article gnus-newsgroup-saved)
7783 (t gnus-unread-mark))
7785 (when (gnus-visual-p 'summary-highlight 'highlight)
7786 (gnus-run-hooks 'gnus-summary-update-hook))
7789 (defun gnus-summary-update-mark (mark type)
7790 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7791 (buffer-read-only nil))
7792 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7793 (when (looking-at "\r")
7796 (<= (+ forward (point)) (point-max)))
7797 ;; Go to the right position on the line.
7798 (goto-char (+ forward (point)))
7799 ;; Replace the old mark with the new mark.
7800 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7801 ;; Optionally update the marks by some user rule.
7802 (when (eq type 'unread)
7804 (gnus-data-find (gnus-summary-article-number)) mark)
7805 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7807 (defun gnus-mark-article-as-read (article &optional mark)
7808 "Enter ARTICLE in the pertinent lists and remove it from others."
7809 ;; Make the article expirable.
7810 (let ((mark (or mark gnus-del-mark)))
7811 (if (= mark gnus-expirable-mark)
7812 (push article gnus-newsgroup-expirable)
7813 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7814 ;; Remove from unread and marked lists.
7815 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7816 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7817 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7818 (push (cons article mark) gnus-newsgroup-reads)
7819 ;; Possibly remove from cache, if that is used.
7820 (when gnus-use-cache
7821 (gnus-cache-enter-remove-article article))
7824 (defun gnus-mark-article-as-unread (article &optional mark)
7825 "Enter ARTICLE in the pertinent lists and remove it from others."
7826 (let ((mark (or mark gnus-ticked-mark)))
7829 (gnus-error 1 "Can't mark negative article numbers")
7831 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7832 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7833 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7834 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7836 ;; Unsuppress duplicates?
7837 (when gnus-suppress-duplicates
7838 (gnus-dup-unsuppress-article article))
7840 (cond ((= mark gnus-ticked-mark)
7841 (push article gnus-newsgroup-marked))
7842 ((= mark gnus-dormant-mark)
7843 (push article gnus-newsgroup-dormant))
7845 (push article gnus-newsgroup-unreads)))
7846 (gnus-pull article gnus-newsgroup-reads)
7849 (defalias 'gnus-summary-mark-as-unread-forward
7850 'gnus-summary-tick-article-forward)
7851 (make-obsolete 'gnus-summary-mark-as-unread-forward
7852 'gnus-summary-tick-article-forward)
7853 (defun gnus-summary-tick-article-forward (n)
7854 "Tick N articles forwards.
7855 If N is negative, tick backwards instead.
7856 The difference between N and the number of articles ticked is returned."
7858 (gnus-summary-mark-forward n gnus-ticked-mark))
7860 (defalias 'gnus-summary-mark-as-unread-backward
7861 'gnus-summary-tick-article-backward)
7862 (make-obsolete 'gnus-summary-mark-as-unread-backward
7863 'gnus-summary-tick-article-backward)
7864 (defun gnus-summary-tick-article-backward (n)
7865 "Tick N articles backwards.
7866 The difference between N and the number of articles ticked is returned."
7868 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7870 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7871 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7872 (defun gnus-summary-tick-article (&optional article clear-mark)
7873 "Mark current article as unread.
7874 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7875 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7877 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7880 (defun gnus-summary-mark-as-read-forward (n)
7881 "Mark N articles as read forwards.
7882 If N is negative, mark backwards instead.
7883 The difference between N and the actual number of articles marked is
7886 (gnus-summary-mark-forward n gnus-del-mark t))
7888 (defun gnus-summary-mark-as-read-backward (n)
7889 "Mark the N articles as read backwards.
7890 The difference between N and the actual number of articles marked is
7893 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7895 (defun gnus-summary-mark-as-read (&optional article mark)
7896 "Mark current article as read.
7897 ARTICLE specifies the article to be marked as read.
7898 MARK specifies a string to be inserted at the beginning of the line."
7899 (gnus-summary-mark-article article mark))
7901 (defun gnus-summary-clear-mark-forward (n)
7902 "Clear marks from N articles forward.
7903 If N is negative, clear backward instead.
7904 The difference between N and the number of marks cleared is returned."
7906 (gnus-summary-mark-forward n gnus-unread-mark))
7908 (defun gnus-summary-clear-mark-backward (n)
7909 "Clear marks from N articles backward.
7910 The difference between N and the number of marks cleared is returned."
7912 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7914 (defun gnus-summary-mark-unread-as-read ()
7915 "Intended to be used by `gnus-summary-mark-article-hook'."
7916 (when (memq gnus-current-article gnus-newsgroup-unreads)
7917 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7919 (defun gnus-summary-mark-read-and-unread-as-read ()
7920 "Intended to be used by `gnus-summary-mark-article-hook'."
7921 (let ((mark (gnus-summary-article-mark)))
7922 (when (or (gnus-unread-mark-p mark)
7923 (gnus-read-mark-p mark))
7924 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7926 (defun gnus-summary-mark-region-as-read (point mark all)
7927 "Mark all unread articles between point and mark as read.
7928 If given a prefix, mark all articles between point and mark as read,
7929 even ticked and dormant ones."
7930 (interactive "r\nP")
7939 (memq (setq article (gnus-summary-article-number))
7940 gnus-newsgroup-unreads))
7941 (gnus-summary-mark-article article gnus-del-mark))
7943 (gnus-summary-find-next))))))
7945 (defun gnus-summary-mark-below (score mark)
7946 "Mark articles with score less than SCORE with MARK."
7947 (interactive "P\ncMark: ")
7948 (setq score (if score
7949 (prefix-numeric-value score)
7950 (or gnus-summary-default-score 0)))
7952 (set-buffer gnus-summary-buffer)
7953 (goto-char (point-min))
7956 (and (< (gnus-summary-article-score) score)
7957 (gnus-summary-mark-article nil mark))
7958 (gnus-summary-find-next)))))
7960 (defun gnus-summary-kill-below (&optional score)
7961 "Mark articles with score below SCORE as read."
7963 (gnus-summary-mark-below score gnus-killed-mark))
7965 (defun gnus-summary-clear-above (&optional score)
7966 "Clear all marks from articles with score above SCORE."
7968 (gnus-summary-mark-above score gnus-unread-mark))
7970 (defun gnus-summary-tick-above (&optional score)
7971 "Tick all articles with score above SCORE."
7973 (gnus-summary-mark-above score gnus-ticked-mark))
7975 (defun gnus-summary-mark-above (score mark)
7976 "Mark articles with score over SCORE with MARK."
7977 (interactive "P\ncMark: ")
7978 (setq score (if score
7979 (prefix-numeric-value score)
7980 (or gnus-summary-default-score 0)))
7982 (set-buffer gnus-summary-buffer)
7983 (goto-char (point-min))
7985 (when (> (gnus-summary-article-score) score)
7986 (gnus-summary-mark-article nil mark))
7988 (gnus-summary-find-next)))))
7990 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7991 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7992 (defun gnus-summary-limit-include-expunged (&optional no-error)
7993 "Display all the hidden articles that were expunged for low scores."
7995 (let ((buffer-read-only nil))
7996 (let ((scored gnus-newsgroup-scored)
7999 (unless (gnus-summary-goto-subject (caar scored))
8000 (and (setq h (gnus-summary-article-header (caar scored)))
8001 (< (cdar scored) gnus-summary-expunge-below)
8003 (setq scored (cdr scored)))
8005 (when (not no-error)
8006 (error "No expunged articles hidden"))
8007 (goto-char (point-min))
8008 (gnus-summary-prepare-unthreaded (nreverse headers))
8009 (goto-char (point-min))
8010 (gnus-summary-position-point)
8013 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8014 "Mark all unread articles in this newsgroup as read.
8015 If prefix argument ALL is non-nil, ticked and dormant articles will
8016 also be marked as read.
8017 If QUIETLY is non-nil, no questions will be asked.
8018 If TO-HERE is non-nil, it should be a point in the buffer. All
8019 articles before this point will be marked as read.
8020 Note that this function will only catch up the unread article
8021 in the current summary buffer limitation.
8022 The number of articles marked as read is returned."
8027 (not gnus-interactive-catchup) ;Without confirmation?
8031 "Mark absolutely all articles as read? "
8032 "Mark all unread articles as read? ")))
8034 (not gnus-newsgroup-adaptive)
8035 (not gnus-newsgroup-auto-expire)
8036 (not gnus-suppress-duplicates)
8037 (or (not gnus-use-cache)
8038 (eq gnus-use-cache 'passive)))
8041 (setq gnus-newsgroup-marked nil
8042 gnus-newsgroup-dormant nil))
8043 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8044 ;; We actually mark all articles as canceled, which we
8045 ;; have to do when using auto-expiry or adaptive scoring.
8046 (gnus-summary-show-all-threads)
8047 (when (gnus-summary-first-subject (not all) t)
8049 (if to-here (< (point) to-here) t)
8050 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8051 (gnus-summary-find-next (not all) nil nil t))))
8052 (gnus-set-mode-line 'summary))
8054 (gnus-summary-position-point)))
8056 (defun gnus-summary-catchup-to-here (&optional all)
8057 "Mark all unticked articles before the current one as read.
8058 If ALL is non-nil, also mark ticked and dormant articles as read."
8061 (gnus-save-hidden-threads
8062 (let ((beg (point)))
8063 ;; We check that there are unread articles.
8064 (when (or all (gnus-summary-find-prev))
8065 (gnus-summary-catchup all t beg)))))
8066 (gnus-summary-position-point))
8068 (defun gnus-summary-catchup-all (&optional quietly)
8069 "Mark all articles in this newsgroup as read."
8071 (gnus-summary-catchup t quietly))
8073 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8074 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8075 If prefix argument ALL is non-nil, all articles are marked as read."
8077 (when (gnus-summary-catchup all quietly nil 'fast)
8078 ;; Select next newsgroup or exit.
8079 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8080 (eq gnus-auto-select-next 'quietly))
8081 (gnus-summary-next-group nil)
8082 (gnus-summary-exit))))
8084 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8085 "Mark all articles in this newsgroup as read, and then exit."
8087 (gnus-summary-catchup-and-exit t quietly))
8089 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8090 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8091 "Mark all articles in this group as read and select the next group.
8092 If given a prefix, mark all articles, unread as well as ticked, as
8096 (gnus-summary-catchup all))
8097 (gnus-summary-next-article t nil nil t))
8099 ;; Thread-based commands.
8101 (defun gnus-summary-articles-in-thread (&optional article)
8102 "Return a list of all articles in the current thread.
8103 If ARTICLE is non-nil, return all articles in the thread that starts
8105 (let* ((article (or article (gnus-summary-article-number)))
8106 (data (gnus-data-find-list article))
8107 (top-level (gnus-data-level (car data)))
8109 (cond ((null gnus-thread-operation-ignore-subject)
8110 (gnus-simplify-subject-re
8111 (mail-header-subject (gnus-data-header (car data)))))
8112 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8113 (gnus-simplify-subject-fuzzy
8114 (mail-header-subject (gnus-data-header (car data)))))
8116 (end-point (save-excursion
8117 (if (gnus-summary-go-to-next-thread)
8118 (point) (point-max))))
8121 (< (gnus-data-pos (car data)) end-point))
8122 (when (or (not top-subject)
8123 (string= top-subject
8124 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8125 (gnus-simplify-subject-fuzzy
8126 (mail-header-subject
8127 (gnus-data-header (car data))))
8128 (gnus-simplify-subject-re
8129 (mail-header-subject
8130 (gnus-data-header (car data)))))))
8131 (push (gnus-data-number (car data)) articles))
8132 (unless (and (setq data (cdr data))
8133 (> (gnus-data-level (car data)) top-level))
8135 ;; Return the list of articles.
8136 (nreverse articles)))
8138 (defun gnus-summary-rethread-current ()
8139 "Rethread the thread the current article is part of."
8141 (let* ((gnus-show-threads t)
8142 (article (gnus-summary-article-number))
8143 (id (mail-header-id (gnus-summary-article-header)))
8144 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8146 (error "No article on the current line"))
8147 (gnus-rebuild-thread id)
8148 (gnus-summary-goto-subject article)))
8150 (defun gnus-summary-reparent-thread ()
8151 "Make the current article child of the marked (or previous) article.
8153 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8154 is non-nil or the Subject: of both articles are the same."
8156 (unless (not (gnus-group-read-only-p))
8157 (error "The current newsgroup does not support article editing"))
8158 (unless (<= (length gnus-newsgroup-processable) 1)
8159 (error "No more than one article may be marked"))
8160 (save-window-excursion
8161 (let ((gnus-article-buffer " *reparent*")
8162 (current-article (gnus-summary-article-number))
8163 ;; First grab the marked article, otherwise one line up.
8164 (parent-article (if (not (null gnus-newsgroup-processable))
8165 (car gnus-newsgroup-processable)
8167 (if (eq (forward-line -1) 0)
8168 (gnus-summary-article-number)
8169 (error "Beginning of summary buffer"))))))
8170 (unless (not (eq current-article parent-article))
8171 (error "An article may not be self-referential"))
8172 (let ((message-id (mail-header-id
8173 (gnus-summary-article-header parent-article))))
8174 (unless (and message-id (not (equal message-id "")))
8175 (error "No message-id in desired parent"))
8176 ;; We don't want the article to be marked as read.
8177 (let (gnus-mark-article-hook)
8178 (gnus-summary-select-article t t nil current-article))
8179 (set-buffer gnus-original-article-buffer)
8180 (let ((buf (format "%s" (buffer-string))))
8181 (nnheader-temp-write nil
8183 (goto-char (point-min))
8184 (if (re-search-forward "^References: " nil t)
8186 (re-search-forward "^[^ \t]" nil t)
8189 (insert " " message-id))
8190 (insert "References: " message-id "\n"))
8191 (unless (gnus-request-replace-article
8192 current-article (car gnus-article-current)
8194 (error "Couldn't replace article"))))
8195 (set-buffer gnus-summary-buffer)
8196 (gnus-summary-unmark-all-processable)
8197 (gnus-summary-update-article current-article)
8198 (gnus-summary-rethread-current)
8199 (gnus-message 3 "Article %d is now the child of article %d"
8200 current-article parent-article)))))
8202 (defun gnus-summary-toggle-threads (&optional arg)
8203 "Toggle showing conversation threads.
8204 If ARG is positive number, turn showing conversation threads on."
8206 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8207 (setq gnus-show-threads
8208 (if (null arg) (not gnus-show-threads)
8209 (> (prefix-numeric-value arg) 0)))
8210 (gnus-summary-prepare)
8211 (gnus-summary-goto-subject current)
8212 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8213 (gnus-summary-position-point)))
8215 (defun gnus-summary-show-all-threads ()
8219 (let ((buffer-read-only nil))
8220 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8221 (gnus-summary-position-point))
8223 (defun gnus-summary-show-thread ()
8224 "Show thread subtrees.
8225 Returns nil if no thread was there to be shown."
8227 (let ((buffer-read-only nil)
8229 ;; first goto end then to beg, to have point at beg after let
8230 (end (progn (end-of-line) (point)))
8231 (beg (progn (beginning-of-line) (point))))
8233 ;; Any hidden lines here?
8234 (search-forward "\r" end t)
8235 (subst-char-in-region beg end ?\^M ?\n t)
8237 (gnus-summary-position-point))))
8239 (defun gnus-summary-hide-all-threads ()
8240 "Hide all thread subtrees."
8243 (goto-char (point-min))
8244 (gnus-summary-hide-thread)
8245 (while (zerop (gnus-summary-next-thread 1 t))
8246 (gnus-summary-hide-thread)))
8247 (gnus-summary-position-point))
8249 (defun gnus-summary-hide-thread ()
8250 "Hide thread subtrees.
8251 Returns nil if no threads were there to be hidden."
8253 (let ((buffer-read-only nil)
8255 (article (gnus-summary-article-number)))
8257 ;; Go forward until either the buffer ends or the subthread
8259 (when (and (not (eobp))
8260 (or (zerop (gnus-summary-next-thread 1 t))
8261 (goto-char (point-max))))
8263 (if (and (> (point) start)
8264 (search-backward "\n" start t))
8266 (subst-char-in-region start (point) ?\n ?\^M)
8267 (gnus-summary-goto-subject article))
8270 ;;(gnus-summary-position-point)
8273 (defun gnus-summary-go-to-next-thread (&optional previous)
8274 "Go to the same level (or less) next thread.
8275 If PREVIOUS is non-nil, go to previous thread instead.
8276 Return the article number moved to, or nil if moving was impossible."
8277 (let ((level (gnus-summary-thread-level))
8278 (way (if previous -1 1))
8281 (while (and (not (eobp))
8282 (< level (gnus-summary-thread-level)))
8290 (gnus-summary-article-number)
8293 (defun gnus-summary-next-thread (n &optional silent)
8294 "Go to the same level next N'th thread.
8295 If N is negative, search backward instead.
8296 Returns the difference between N and the number of skips actually
8299 If SILENT, don't output messages."
8301 (let ((backward (< n 0))
8304 (gnus-summary-go-to-next-thread backward))
8307 (gnus-summary-position-point))
8308 (when (and (not silent) (/= 0 n))
8309 (gnus-message 7 "No more threads"))
8312 (defun gnus-summary-prev-thread (n)
8313 "Go to the same level previous N'th thread.
8314 Returns the difference between N and the number of skips actually
8317 (gnus-summary-next-thread (- n)))
8319 (defun gnus-summary-go-down-thread ()
8320 "Go down one level in the current thread."
8321 (let ((children (gnus-summary-article-children)))
8323 (gnus-summary-goto-subject (car children)))))
8325 (defun gnus-summary-go-up-thread ()
8326 "Go up one level in the current thread."
8327 (let ((parent (gnus-summary-article-parent)))
8329 (gnus-summary-goto-subject parent))))
8331 (defun gnus-summary-down-thread (n)
8332 "Go down thread N steps.
8333 If N is negative, go up instead.
8334 Returns the difference between N and how many steps down that were
8340 (if up (gnus-summary-go-up-thread)
8341 (gnus-summary-go-down-thread)))
8343 (gnus-summary-position-point)
8345 (gnus-message 7 "Can't go further"))
8348 (defun gnus-summary-up-thread (n)
8349 "Go up thread N steps.
8350 If N is negative, go up instead.
8351 Returns the difference between N and how many steps down that were
8354 (gnus-summary-down-thread (- n)))
8356 (defun gnus-summary-top-thread ()
8357 "Go to the top of the thread."
8359 (while (gnus-summary-go-up-thread))
8360 (gnus-summary-article-number))
8362 (defun gnus-summary-kill-thread (&optional unmark)
8363 "Mark articles under current thread as read.
8364 If the prefix argument is positive, remove any kinds of marks.
8365 If the prefix argument is negative, tick articles instead."
8368 (setq unmark (prefix-numeric-value unmark)))
8369 (let ((articles (gnus-summary-articles-in-thread)))
8371 ;; Expand the thread.
8372 (gnus-summary-show-thread)
8373 ;; Mark all the articles.
8375 (gnus-summary-goto-subject (car articles))
8376 (cond ((null unmark)
8377 (gnus-summary-mark-article-as-read gnus-killed-mark))
8379 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8381 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8382 (setq articles (cdr articles))))
8383 ;; Hide killed subtrees.
8385 gnus-thread-hide-killed
8386 (gnus-summary-hide-thread))
8387 ;; If marked as read, go to next unread subject.
8389 ;; Go to next unread subject.
8390 (gnus-summary-next-subject 1 t)))
8391 (gnus-set-mode-line 'summary))
8393 ;; Summary sorting commands
8395 (defun gnus-summary-sort-by-number (&optional reverse)
8396 "Sort the summary buffer by article number.
8397 Argument REVERSE means reverse order."
8399 (gnus-summary-sort 'number reverse))
8401 (defun gnus-summary-sort-by-author (&optional reverse)
8402 "Sort the summary buffer by author name alphabetically.
8403 If case-fold-search is non-nil, case of letters is ignored.
8404 Argument REVERSE means reverse order."
8406 (gnus-summary-sort 'author reverse))
8408 (defun gnus-summary-sort-by-subject (&optional reverse)
8409 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8410 If case-fold-search is non-nil, case of letters is ignored.
8411 Argument REVERSE means reverse order."
8413 (gnus-summary-sort 'subject reverse))
8415 (defun gnus-summary-sort-by-date (&optional reverse)
8416 "Sort the summary buffer by date.
8417 Argument REVERSE means reverse order."
8419 (gnus-summary-sort 'date reverse))
8421 (defun gnus-summary-sort-by-score (&optional reverse)
8422 "Sort the summary buffer by score.
8423 Argument REVERSE means reverse order."
8425 (gnus-summary-sort 'score reverse))
8427 (defun gnus-summary-sort-by-lines (&optional reverse)
8428 "Sort the summary buffer by article length.
8429 Argument REVERSE means reverse order."
8431 (gnus-summary-sort 'lines reverse))
8433 (defun gnus-summary-sort (predicate reverse)
8434 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8435 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8436 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8437 (gnus-thread-sort-functions
8443 (gnus-article-sort-functions
8448 (,article t2 t1)))))
8450 (gnus-summary-prepare-hook nil))
8451 ;; We do the sorting by regenerating the threads.
8452 (gnus-summary-prepare)
8453 ;; Hide subthreads if needed.
8454 (when (and gnus-show-threads gnus-thread-hide-subtree)
8455 (gnus-summary-hide-all-threads))))
8457 ;; Summary saving commands.
8459 (defun gnus-summary-save-article (&optional n not-saved)
8460 "Save the current article using the default saver function.
8461 If N is a positive number, save the N next articles.
8462 If N is a negative number, save the N previous articles.
8463 If N is nil and any articles have been marked with the process mark,
8464 save those articles instead.
8465 The variable `gnus-default-article-saver' specifies the saver function."
8467 (let* ((articles (gnus-summary-work-articles n))
8468 (save-buffer (save-excursion
8469 (nnheader-set-temp-buffer " *Gnus Save*")))
8470 (num (length articles))
8471 header article file)
8473 (setq header (gnus-summary-article-header
8474 (setq article (pop articles))))
8475 (if (not (vectorp header))
8476 ;; This is a pseudo-article.
8477 (if (assq 'name header)
8478 (gnus-copy-file (cdr (assq 'name header)))
8479 (gnus-message 1 "Article %d is unsaveable" article))
8480 ;; This is a real article.
8481 (save-window-excursion
8482 (gnus-summary-select-article t nil nil article))
8484 (set-buffer save-buffer)
8486 (insert-buffer-substring gnus-original-article-buffer))
8487 (setq file (gnus-article-save save-buffer file num))
8488 (gnus-summary-remove-process-mark article)
8490 (gnus-summary-set-saved-mark article))))
8491 (gnus-kill-buffer save-buffer)
8492 (gnus-summary-position-point)
8493 (gnus-set-mode-line 'summary)
8496 (defun gnus-summary-pipe-output (&optional arg)
8497 "Pipe the current article to a subprocess.
8498 If N is a positive number, pipe the N next articles.
8499 If N is a negative number, pipe the N previous articles.
8500 If N is nil and any articles have been marked with the process mark,
8501 pipe those articles instead."
8503 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8504 (gnus-summary-save-article arg t))
8505 (gnus-configure-windows 'pipe))
8507 (defun gnus-summary-save-article-mail (&optional arg)
8508 "Append the current article to an mail file.
8509 If N is a positive number, save the N next articles.
8510 If N is a negative number, save the N previous articles.
8511 If N is nil and any articles have been marked with the process mark,
8512 save those articles instead."
8514 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8515 (gnus-summary-save-article arg)))
8517 (defun gnus-summary-save-article-rmail (&optional arg)
8518 "Append the current article to an rmail file.
8519 If N is a positive number, save the N next articles.
8520 If N is a negative number, save the N previous articles.
8521 If N is nil and any articles have been marked with the process mark,
8522 save those articles instead."
8524 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8525 (gnus-summary-save-article arg)))
8527 (defun gnus-summary-save-article-file (&optional arg)
8528 "Append the current article to a file.
8529 If N is a positive number, save the N next articles.
8530 If N is a negative number, save the N previous articles.
8531 If N is nil and any articles have been marked with the process mark,
8532 save those articles instead."
8534 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8535 (gnus-summary-save-article arg)))
8537 (defun gnus-summary-write-article-file (&optional arg)
8538 "Write the current article to a file, deleting the previous file.
8539 If N is a positive number, save the N next articles.
8540 If N is a negative number, save the N previous articles.
8541 If N is nil and any articles have been marked with the process mark,
8542 save those articles instead."
8544 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8545 (gnus-summary-save-article arg)))
8547 (defun gnus-summary-save-article-body-file (&optional arg)
8548 "Append the current article body to a file.
8549 If N is a positive number, save the N next articles.
8550 If N is a negative number, save the N previous articles.
8551 If N is nil and any articles have been marked with the process mark,
8552 save those articles instead."
8554 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8555 (gnus-summary-save-article arg)))
8557 (defun gnus-summary-pipe-message (program)
8558 "Pipe the current article through PROGRAM."
8559 (interactive "sProgram: ")
8560 (gnus-summary-select-article)
8561 (let ((mail-header-separator ""))
8562 (gnus-eval-in-buffer-window gnus-article-buffer
8565 (let ((start (window-start))
8567 (message-pipe-buffer-body program)
8568 (set-window-start (get-buffer-window (current-buffer)) start))))))
8570 (defun gnus-get-split-value (methods)
8571 "Return a value based on the split METHODS."
8572 (let (split-name method result match)
8575 (set-buffer gnus-original-article-buffer)
8577 (nnheader-narrow-to-headers)
8579 (goto-char (point-min))
8580 (setq method (pop methods))
8581 (setq match (car method))
8584 ;; Regular expression.
8586 (re-search-forward match nil t)))
8587 ((gnus-functionp match)
8591 (setq result (funcall match gnus-newsgroup-name))))
8596 (setq result (eval match)))))
8597 (setq split-name (append (cdr method) split-name))
8598 (cond ((stringp result)
8599 (push (expand-file-name
8600 result gnus-article-save-directory)
8603 (setq split-name (append result split-name)))))))))
8606 (defun gnus-valid-move-group-p (group)
8611 (car (gnus-find-method-for-group
8612 (symbol-name group))))
8613 gnus-valid-select-methods))))
8615 (defun gnus-read-move-group-name (prompt default articles prefix)
8616 "Read a group name."
8617 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8618 (minibuffer-confirm-incomplete nil) ; XEmacs
8622 (if (> (length articles) 1)
8623 (format "these %d articles" (length articles))
8628 (gnus-completing-read default prom
8630 'gnus-valid-move-group-p
8632 'gnus-group-history))
8633 ((= 1 (length split-name))
8634 (gnus-completing-read (car split-name) prom
8636 'gnus-valid-move-group-p
8638 'gnus-group-history))
8640 (gnus-completing-read nil prom
8641 (mapcar (lambda (el) (list el))
8642 (nreverse split-name))
8644 'gnus-group-history)))))
8646 (if (or (string= to-newsgroup "")
8647 (string= to-newsgroup prefix))
8648 (setq to-newsgroup default))
8649 (unless to-newsgroup
8650 (error "No group name entered"))
8651 (or (gnus-active to-newsgroup)
8652 (gnus-activate-group to-newsgroup)
8653 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8655 (or (and (gnus-request-create-group
8656 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8657 (gnus-activate-group to-newsgroup nil nil
8658 (gnus-group-name-to-method
8660 (error "Couldn't create group %s" to-newsgroup)))
8661 (error "No such group: %s" to-newsgroup)))
8664 ;; Summary extract commands
8666 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8667 (let ((buffer-read-only nil)
8668 (article (gnus-summary-article-number))
8670 (unless (gnus-summary-goto-subject article)
8671 (error "No such article: %d" article))
8672 (gnus-summary-position-point)
8673 ;; If all commands are to be bunched up on one line, we collect
8675 (unless gnus-view-pseudos-separately
8676 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8679 (setq action (cdr (assq 'action (car ps))))
8680 (setq files (list (cdr (assq 'name (car ps)))))
8681 (while (and ps (cdr ps)
8682 (string= (or action "1")
8683 (or (cdr (assq 'action (cadr ps))) "2")))
8684 (push (cdr (assq 'name (cadr ps))) files)
8685 (setcdr ps (cddr ps)))
8687 (when (not (string-match "%s" action))
8690 (when (assq 'execute (car ps))
8691 (setcdr (assq 'execute (car ps))
8692 (funcall (if (string-match "%s" action)
8699 (gnus-quote-arg-for-sh-or-csh f)))
8701 (setq ps (cdr ps)))))
8702 (if (and gnus-view-pseudos (not not-view))
8704 (when (assq 'execute (car pslist))
8705 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8706 (eq gnus-view-pseudos 'not-confirm)))
8707 (setq pslist (cdr pslist)))
8710 (setq after-article (or (cdr (assq 'article (car pslist)))
8711 (gnus-summary-article-number)))
8712 (gnus-summary-goto-subject after-article)
8715 (insert " " (file-name-nondirectory
8716 (cdr (assq 'name (car pslist))))
8717 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8719 (forward-line -1) ; back to `b'
8720 (gnus-add-text-properties
8721 b (1- e) (list 'gnus-number gnus-reffed-article-number
8722 gnus-mouse-face-prop gnus-mouse-face))
8724 after-article gnus-reffed-article-number
8725 gnus-unread-mark b (car pslist) 0 (- e b))
8726 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8727 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8728 (setq pslist (cdr pslist)))))))
8730 (defun gnus-pseudos< (p1 p2)
8731 (let ((c1 (cdr (assq 'action p1)))
8732 (c2 (cdr (assq 'action p2))))
8733 (and c1 c2 (string< c1 c2))))
8735 (defun gnus-request-pseudo-article (props)
8736 (cond ((assq 'execute props)
8737 (gnus-execute-command (cdr (assq 'execute props)))))
8738 (let ((gnus-current-article (gnus-summary-article-number)))
8739 (gnus-run-hooks 'gnus-mark-article-hook)))
8741 (defun gnus-execute-command (command &optional automatic)
8743 (gnus-article-setup-buffer)
8744 (set-buffer gnus-article-buffer)
8745 (setq buffer-read-only nil)
8746 (let ((command (if automatic command
8747 (read-string "Command: " (cons command 0)))))
8749 (insert "$ " command "\n\n")
8750 (if gnus-view-pseudo-asynchronously
8751 (start-process "gnus-execute" (current-buffer) shell-file-name
8752 shell-command-switch command)
8753 (call-process shell-file-name nil t nil
8754 shell-command-switch command)))))
8756 ;; Summary kill commands.
8758 (defun gnus-summary-edit-global-kill (article)
8759 "Edit the \"global\" kill file."
8760 (interactive (list (gnus-summary-article-number)))
8761 (gnus-group-edit-global-kill article))
8763 (defun gnus-summary-edit-local-kill ()
8764 "Edit a local kill file applied to the current newsgroup."
8766 (setq gnus-current-headers (gnus-summary-article-header))
8767 (gnus-group-edit-local-kill
8768 (gnus-summary-article-number) gnus-newsgroup-name))
8772 (defun gnus-read-header (id &optional header)
8773 "Read the headers of article ID and enter them into the Gnus system."
8774 (let ((group gnus-newsgroup-name)
8775 (gnus-override-method
8776 (and (gnus-news-group-p gnus-newsgroup-name)
8777 gnus-refer-article-method))
8779 ;; First we check to see whether the header in question is already
8782 ;; This is a Message-ID.
8783 (setq header (or header (gnus-id-to-header id)))
8784 ;; This is an article number.
8785 (setq header (or header (gnus-summary-article-header id))))
8787 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8788 ;; We have found the header.
8790 ;; If this is a sparse article, we have to nix out its
8791 ;; previous entry in the thread hashtb.
8793 (gnus-summary-article-sparse-p (mail-header-number header)))
8794 (let* ((parent (gnus-parent-id (mail-header-references header)))
8795 (thread (and parent (gnus-id-to-thread parent))))
8797 (delq (assq header thread) thread))))
8798 ;; We have to really fetch the header to this article.
8800 (set-buffer nntp-server-buffer)
8801 (when (setq where (gnus-request-head id group))
8802 (nnheader-fold-continuation-lines)
8803 (goto-char (point-max))
8805 (goto-char (point-min))
8809 ((cdr where) (cdr where))
8810 (header (mail-header-number header))
8811 (t gnus-reffed-article-number))
8813 (insert " Article retrieved.\n"))
8815 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8816 () ; Malformed head.
8817 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8818 (when (and (stringp id)
8819 (not (string= (gnus-group-real-name group)
8821 ;; If we fetched by Message-ID and the article came
8822 ;; from a different group, we fudge some bogus article
8823 ;; numbers for this article.
8824 (mail-header-set-number header gnus-reffed-article-number))
8826 (set-buffer gnus-summary-buffer)
8827 (decf gnus-reffed-article-number)
8828 (gnus-remove-header (mail-header-number header))
8829 (push header gnus-newsgroup-headers)
8830 (setq gnus-current-headers header)
8831 (push (mail-header-number header) gnus-newsgroup-limit)))
8834 (defun gnus-remove-header (number)
8835 "Remove header NUMBER from `gnus-newsgroup-headers'."
8836 (if (and gnus-newsgroup-headers
8837 (= number (mail-header-number (car gnus-newsgroup-headers))))
8838 (pop gnus-newsgroup-headers)
8839 (let ((headers gnus-newsgroup-headers))
8840 (while (and (cdr headers)
8841 (not (= number (mail-header-number (cadr headers)))))
8844 (setcdr headers (cddr headers))))))
8847 ;;; summary highlights
8850 (defun gnus-highlight-selected-summary ()
8851 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8852 ;; Highlight selected article in summary buffer
8853 (when gnus-summary-selected-face
8855 (let* ((beg (progn (beginning-of-line) (point)))
8856 (end (progn (end-of-line) (point)))
8857 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8858 (from (if (get-text-property beg gnus-mouse-face-prop)
8860 (or (next-single-property-change
8861 beg gnus-mouse-face-prop nil end)
8866 (or (next-single-property-change
8867 from gnus-mouse-face-prop nil end)
8869 ;; If no mouse-face prop on line we will have to = from = end,
8870 ;; so we highlight the entire line instead.
8871 (when (= (+ to 2) from)
8874 (if gnus-newsgroup-selected-overlay
8875 ;; Move old overlay.
8877 gnus-newsgroup-selected-overlay from to (current-buffer))
8878 ;; Create new overlay.
8880 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8881 'face gnus-summary-selected-face))))))
8883 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8884 (defun gnus-summary-highlight-line ()
8885 "Highlight current line according to `gnus-summary-highlight'."
8886 (let* ((list gnus-summary-highlight)
8888 (end (progn (end-of-line) (point)))
8889 ;; now find out where the line starts and leave point there.
8890 (beg (progn (beginning-of-line) (point)))
8891 (article (gnus-summary-article-number))
8892 (score (or (cdr (assq (or article gnus-current-article)
8893 gnus-newsgroup-scored))
8894 gnus-summary-default-score 0))
8895 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8896 (inhibit-read-only t))
8897 ;; Eval the cars of the lists until we find a match.
8898 (let ((default gnus-summary-default-score))
8900 (not (eval (caar list))))
8901 (setq list (cdr list))))
8902 (let ((face (cdar list)))
8903 (unless (eq face (get-text-property beg 'face))
8904 (gnus-put-text-property-excluding-characters-with-faces
8906 (setq face (if (boundp face) (symbol-value face) face)))
8907 (when gnus-summary-highlight-line-function
8908 (funcall gnus-summary-highlight-line-function article face))))
8911 (defun gnus-update-read-articles (group unread &optional compute)
8912 "Update the list of read articles in GROUP."
8913 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8914 (entry (gnus-gethash group gnus-newsrc-hashtb))
8915 (info (nth 2 entry))
8917 (unread (sort (copy-sequence unread) '<))
8919 (if (or (not info) (not active))
8920 ;; There is no info on this group if it was, in fact,
8921 ;; killed. Gnus stores no information on killed groups, so
8922 ;; there's nothing to be done.
8923 ;; One could store the information somewhere temporarily,
8924 ;; perhaps... Hmmm...
8926 ;; Remove any negative articles numbers.
8927 (while (and unread (< (car unread) 0))
8928 (setq unread (cdr unread)))
8929 ;; Remove any expired article numbers
8930 (while (and unread (< (car unread) (car active)))
8931 (setq unread (cdr unread)))
8932 ;; Compute the ranges of read articles by looking at the list of
8935 (when (/= (car unread) prev)
8936 (push (if (= prev (1- (car unread))) prev
8937 (cons prev (1- (car unread))))
8939 (setq prev (1+ (car unread)))
8940 (setq unread (cdr unread)))
8941 (when (<= prev (cdr active))
8942 (push (cons prev (cdr active)) read))
8944 (if (> (length read) 1) (nreverse read) read)
8946 (set-buffer gnus-group-buffer)
8949 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8950 (gnus-info-set-read ',info ',(gnus-info-read info))
8951 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8952 (gnus-group-update-group ,group t))))
8953 ;; Enter this list into the group info.
8955 info (if (> (length read) 1) (nreverse read) read))
8956 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8957 (gnus-get-unread-articles-in-group info (gnus-active group))
8960 (defun gnus-offer-save-summaries ()
8961 "Offer to save all active summary buffers."
8963 (let ((buflist (buffer-list))
8965 ;; Go through all buffers and find all summaries.
8967 (and (setq bufname (buffer-name (car buflist)))
8968 (string-match "Summary" bufname)
8970 (set-buffer bufname)
8971 ;; We check that this is, indeed, a summary buffer.
8972 (and (eq major-mode 'gnus-summary-mode)
8973 ;; Also make sure this isn't bogus.
8974 gnus-newsgroup-prepared
8975 ;; Also make sure that this isn't a dead summary buffer.
8976 (not gnus-dead-summary-mode)))
8977 (push bufname buffers))
8978 (setq buflist (cdr buflist)))
8979 ;; Go through all these summary buffers and offer to save them.
8982 "Update summary buffer %s? "
8984 (switch-to-buffer buf)
8985 (gnus-summary-exit))
8989 ;;; @ for mime-partial
8992 (defun gnus-request-partial-message ()
8994 (let ((number (gnus-summary-article-number))
8995 (group gnus-newsgroup-name)
8996 (mother gnus-article-buffer))
8997 (set-buffer (get-buffer-create " *Partial Article*"))
8999 (setq mime-preview-buffer mother)
9000 (gnus-request-article-this-buffer number group)
9004 (autoload 'mime-combine-message/partial-pieces-automatically
9006 "Internal method to combine message/partial messages automatically.")
9009 'action '((type . message)(subtype . partial)
9010 (major-mode . gnus-original-article-mode)
9011 (method . mime-combine-message/partial-pieces-automatically)
9012 (summary-buffer-exp . gnus-summary-buffer)
9013 (request-partial-message-method . gnus-request-partial-message)
9017 ;;; @ for message/rfc822
9020 (defun gnus-mime-extract-message/rfc822 (entity situation)
9021 (let (group article num cwin swin cur)
9022 (with-current-buffer (mime-entity-buffer entity)
9024 (narrow-to-region (mime-entity-body-start entity)
9025 (mime-entity-body-end entity))
9026 (setq group (or (cdr (assq 'group situation))
9027 (completing-read "Group: "
9030 (gnus-read-active-file-p)
9031 gnus-newsgroup-name))
9032 article (gnus-request-accept-article group)
9035 (when (and (consp article)
9036 (numberp (setq article (cdr article))))
9037 (setq num (1+ (or (cdr (assq 'number situation)) 0))
9038 cwin (get-buffer-window (current-buffer) t)
9040 (save-window-excursion
9041 (if (setq swin (get-buffer-window gnus-summary-buffer t))
9042 (select-window swin)
9043 (set-buffer gnus-summary-buffer)
9045 (setq cur gnus-current-article)
9047 (let (gnus-show-threads)
9048 (gnus-summary-goto-subject article t)
9050 (gnus-summary-clear-mark-forward 1)
9051 (gnus-summary-goto-subject cur)
9053 (when (and cwin (window-frame cwin))
9054 (select-frame (window-frame cwin))
9056 (when (boundp 'mime-acting-situation-to-override)
9057 (set-alist 'mime-acting-situation-to-override
9060 (set-alist 'mime-acting-situation-to-override
9063 (save-current-buffer
9064 (set-buffer gnus-group-buffer)
9065 (gnus-activate-group ,group)
9067 (gnus-summary-goto-article ,cur
9068 gnus-show-all-headers)
9070 (set-alist 'mime-acting-situation-to-override
9076 'action '((type . message)(subtype . rfc822)
9077 (major-mode . gnus-original-article-mode)
9078 (method . gnus-mime-extract-message/rfc822)
9083 'action '((type . message)(subtype . news)
9084 (major-mode . gnus-original-article-mode)
9085 (method . gnus-mime-extract-message/rfc822)
9089 (defun gnus-mime-extract-multipart (entity situation)
9090 (let ((children (mime-entity-children entity))
9091 mime-acting-situation-to-override
9094 (mime-play-entity (car children)
9095 (cons (assq 'mode situation)
9096 mime-acting-situation-to-override))
9097 (setq children (cdr children)))
9098 (if (setq f (cdr (assq 'after-method
9099 mime-acting-situation-to-override)))
9104 'action '((type . multipart)
9105 (method . gnus-mime-extract-multipart)
9118 (run-hooks 'gnus-sum-load-hook)
9120 ;;; gnus-sum.el ends here