1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (eval-when-compile (require 'cl))
36 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
38 (defcustom gnus-kill-summary-on-exit t
39 "*If non-nil, kill the summary buffer when you exit from it.
40 If nil, the summary will become a \"*Dead Summary*\" buffer, and
41 it will be killed sometime later."
42 :group 'gnus-summary-exit
45 (defcustom gnus-fetch-old-headers nil
46 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
47 If an unread article in the group refers to an older, already read (or
48 just marked as read) article, the old article will not normally be
49 displayed in the Summary buffer. If this variable is non-nil, Gnus
50 will attempt to grab the headers to the old articles, and thereby
51 build complete threads. If it has the value `some', only enough
52 headers to connect otherwise loose threads will be displayed. This
53 variable can also be a number. In that case, no more than that number
54 of old headers will be fetched. If it has the value `invisible', all
55 old headers will be fetched, but none will be displayed.
57 The server has to support NOV for any of this to work."
59 :type '(choice (const :tag "off" nil)
62 (sexp :menu-tag "other" t)))
64 (defcustom gnus-refer-thread-limit 200
65 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
66 If t, fetch all the available old headers."
69 (sexp :menu-tag "other" t)))
71 (defcustom gnus-summary-make-false-root 'adopt
72 "*nil means that Gnus won't gather loose threads.
73 If the root of a thread has expired or been read in a previous
74 session, the information necessary to build a complete thread has been
75 lost. Instead of having many small sub-threads from this original thread
76 scattered all over the summary buffer, Gnus can gather them.
78 If non-nil, Gnus will try to gather all loose sub-threads from an
79 original thread into one large thread.
81 If this variable is non-nil, it should be one of `none', `adopt',
84 If this variable is `none', Gnus will not make a false root, but just
85 present the sub-threads after another.
86 If this variable is `dummy', Gnus will create a dummy root that will
87 have all the sub-threads as children.
88 If this variable is `adopt', Gnus will make one of the \"children\"
89 the parent and mark all the step-children as such.
90 If this variable is `empty', the \"children\" are printed with empty
91 subject fields. (Or rather, they will be printed with a string
92 given by the `gnus-summary-same-subject' variable.)"
94 :type '(choice (const :tag "off" nil)
100 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
101 "*A regexp to match subjects to be excluded from loose thread gathering.
102 As loose thread gathering is done on subjects only, that means that
103 there can be many false gatherings performed. By rooting out certain
104 common subjects, gathering might become saner."
108 (defcustom gnus-summary-gather-subject-limit nil
109 "*Maximum length of subject comparisons when gathering loose threads.
110 Use nil to compare full subjects. Setting this variable to a low
111 number will help gather threads that have been corrupted by
112 newsreaders chopping off subject lines, but it might also mean that
113 unrelated articles that have subject that happen to begin with the
114 same few characters will be incorrectly gathered.
116 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
119 :type '(choice (const :tag "off" nil)
121 (sexp :menu-tag "on" t)))
123 (defcustom gnus-simplify-subject-functions nil
124 "List of functions taking a string argument that simplify subjects.
125 The functions are applied recursively."
127 :type '(repeat (list function)))
129 (defcustom gnus-simplify-ignored-prefixes nil
130 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
132 :type '(choice (const :tag "off" nil)
135 (defcustom gnus-build-sparse-threads nil
136 "*If non-nil, fill in the gaps in threads.
137 If `some', only fill in the gaps that are needed to tie loose threads
138 together. If `more', fill in all leaf nodes that Gnus can find. If
139 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
141 :type '(choice (const :tag "off" nil)
144 (sexp :menu-tag "all" t)))
146 (defcustom gnus-summary-thread-gathering-function
147 'gnus-gather-threads-by-subject
148 "Function used for gathering loose threads.
149 There are two pre-defined functions: `gnus-gather-threads-by-subject',
150 which only takes Subjects into consideration; and
151 `gnus-gather-threads-by-references', which compared the References
152 headers of the articles to find matches."
154 :type '(radio (function-item gnus-gather-threads-by-subject)
155 (function-item gnus-gather-threads-by-references)
156 (function :tag "other")))
158 (defcustom gnus-summary-same-subject ""
159 "*String indicating that the current article has the same subject as the previous.
160 This variable will only be used if the value of
161 `gnus-summary-make-false-root' is `empty'."
162 :group 'gnus-summary-format
165 (defcustom gnus-summary-goto-unread t
166 "*If t, marking commands will go to the next unread article.
167 If `never', commands that usually go to the next unread article, will
168 go to the next article, whether it is read or not.
169 If nil, only the marking commands will go to the next (un)read article."
170 :group 'gnus-summary-marks
171 :link '(custom-manual "(gnus)Setting Marks")
172 :type '(choice (const :tag "off" nil)
174 (sexp :menu-tag "on" t)))
176 (defcustom gnus-summary-default-score 0
177 "*Default article score level.
178 All scores generated by the score files will be added to this score.
179 If this variable is nil, scoring will be disabled."
180 :group 'gnus-score-default
181 :type '(choice (const :tag "disable")
184 (defcustom gnus-summary-zcore-fuzz 0
185 "*Fuzziness factor for the zcore in the summary buffer.
186 Articles with scores closer than this to `gnus-summary-default-score'
188 :group 'gnus-summary-format
191 (defcustom gnus-simplify-subject-fuzzy-regexp nil
192 "*Strings to be removed when doing fuzzy matches.
193 This can either be a regular expression or list of regular expressions
194 that will be removed from subject strings if fuzzy subject
195 simplification is selected."
197 :type '(repeat regexp))
199 (defcustom gnus-show-threads t
200 "*If non-nil, display threads in summary mode."
204 (defcustom gnus-thread-hide-subtree nil
205 "*If non-nil, hide all threads initially.
206 If threads are hidden, you have to run the command
207 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
208 to expose hidden threads."
212 (defcustom gnus-thread-hide-killed t
213 "*If non-nil, hide killed threads automatically."
217 (defcustom gnus-thread-ignore-subject nil
218 "*If non-nil, ignore subjects and do all threading based on the Reference header.
219 If nil, which is the default, articles that have different subjects
220 from their parents will start separate threads."
224 (defcustom gnus-thread-operation-ignore-subject t
225 "*If non-nil, subjects will be ignored when doing thread commands.
226 This affects commands like `gnus-summary-kill-thread' and
227 `gnus-summary-lower-thread'.
229 If this variable is nil, articles in the same thread with different
230 subjects will not be included in the operation in question. If this
231 variable is `fuzzy', only articles that have subjects that are fuzzily
232 equal will be included."
234 :type '(choice (const :tag "off" nil)
238 (defcustom gnus-thread-indent-level 4
239 "*Number that says how much each sub-thread should be indented."
243 (defcustom gnus-auto-extend-newsgroup t
244 "*If non-nil, extend newsgroup forward and backward when requested."
245 :group 'gnus-summary-choose
248 (defcustom gnus-auto-select-first t
249 "*If nil, don't select the first unread article when entering a group.
250 If this variable is `best', select the highest-scored unread article
251 in the group. If neither nil nor `best', select the first unread
254 If you want to prevent automatic selection of the first unread article
255 in some newsgroups, set the variable to nil in
256 `gnus-select-group-hook'."
257 :group 'gnus-group-select
258 :type '(choice (const :tag "none" nil)
260 (sexp :menu-tag "first" t)))
262 (defcustom gnus-auto-select-next t
263 "*If non-nil, offer to go to the next group from the end of the previous.
264 If the value is t and the next newsgroup is empty, Gnus will exit
265 summary mode and go back to group mode. If the value is neither nil
266 nor t, Gnus will select the following unread newsgroup. In
267 particular, if the value is the symbol `quietly', the next unread
268 newsgroup will be selected without any confirmation, and if it is
269 `almost-quietly', the next group will be selected without any
270 confirmation if you are located on the last article in the group.
271 Finally, if this variable is `slightly-quietly', the `Z n' command
272 will go to the next group without confirmation."
273 :group 'gnus-summary-maneuvering
274 :type '(choice (const :tag "off" nil)
276 (const almost-quietly)
277 (const slightly-quietly)
278 (sexp :menu-tag "on" t)))
280 (defcustom gnus-auto-select-same nil
281 "*If non-nil, select the next article with the same subject."
282 :group 'gnus-summary-maneuvering
285 (defcustom gnus-summary-check-current nil
286 "*If non-nil, consider the current article when moving.
287 The \"unread\" movement commands will stay on the same line if the
288 current article is unread."
289 :group 'gnus-summary-maneuvering
292 (defcustom gnus-auto-center-summary t
293 "*If non-nil, always center the current summary buffer.
294 In particular, if `vertical' do only vertical recentering. If non-nil
295 and non-`vertical', do both horizontal and vertical recentering."
296 :group 'gnus-summary-maneuvering
297 :type '(choice (const :tag "none" nil)
299 (sexp :menu-tag "both" t)))
301 (defcustom gnus-show-all-headers nil
302 "*If non-nil, don't hide any headers."
303 :group 'gnus-article-hiding
304 :group 'gnus-article-headers
307 (defcustom gnus-summary-ignore-duplicates nil
308 "*If non-nil, ignore articles with identical Message-ID headers."
312 (defcustom gnus-single-article-buffer t
313 "*If non-nil, display all articles in the same buffer.
314 If nil, each group will get its own article buffer."
315 :group 'gnus-article-various
318 (defcustom gnus-break-pages t
319 "*If non-nil, do page breaking on articles.
320 The page delimiter is specified by the `gnus-page-delimiter'
322 :group 'gnus-article-various
325 (defcustom gnus-show-mime nil
326 "*If non-nil, do mime processing of articles.
327 The articles will simply be fed to the function given by
328 `gnus-show-mime-method'."
329 :group 'gnus-article-mime
332 (defcustom gnus-move-split-methods nil
333 "*Variable used to suggest where articles are to be moved to.
334 It uses the same syntax as the `gnus-split-methods' variable."
335 :group 'gnus-summary-mail
336 :type '(repeat (choice (list :value (fun) function)
337 (cons :value ("" "") regexp (repeat string))
340 (defcustom gnus-unread-mark ?
341 "*Mark used for unread articles."
342 :group 'gnus-summary-marks
345 (defcustom gnus-ticked-mark ?!
346 "*Mark used for ticked articles."
347 :group 'gnus-summary-marks
350 (defcustom gnus-dormant-mark ??
351 "*Mark used for dormant articles."
352 :group 'gnus-summary-marks
355 (defcustom gnus-del-mark ?r
356 "*Mark used for del'd articles."
357 :group 'gnus-summary-marks
360 (defcustom gnus-read-mark ?R
361 "*Mark used for read articles."
362 :group 'gnus-summary-marks
365 (defcustom gnus-expirable-mark ?E
366 "*Mark used for expirable articles."
367 :group 'gnus-summary-marks
370 (defcustom gnus-killed-mark ?K
371 "*Mark used for killed articles."
372 :group 'gnus-summary-marks
375 (defcustom gnus-souped-mark ?F
376 "*Mark used for killed articles."
377 :group 'gnus-summary-marks
380 (defcustom gnus-kill-file-mark ?X
381 "*Mark used for articles killed by kill files."
382 :group 'gnus-summary-marks
385 (defcustom gnus-low-score-mark ?Y
386 "*Mark used for articles with a low score."
387 :group 'gnus-summary-marks
390 (defcustom gnus-catchup-mark ?C
391 "*Mark used for articles that are caught up."
392 :group 'gnus-summary-marks
395 (defcustom gnus-replied-mark ?A
396 "*Mark used for articles that have been replied to."
397 :group 'gnus-summary-marks
400 (defcustom gnus-cached-mark ?*
401 "*Mark used for articles that are in the cache."
402 :group 'gnus-summary-marks
405 (defcustom gnus-saved-mark ?S
406 "*Mark used for articles that have been saved to."
407 :group 'gnus-summary-marks
410 (defcustom gnus-ancient-mark ?O
411 "*Mark used for ancient articles."
412 :group 'gnus-summary-marks
415 (defcustom gnus-sparse-mark ?Q
416 "*Mark used for sparsely reffed articles."
417 :group 'gnus-summary-marks
420 (defcustom gnus-canceled-mark ?G
421 "*Mark used for canceled articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-duplicate-mark ?M
426 "*Mark used for duplicate articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-undownloaded-mark ?@
431 "*Mark used for articles that weren't downloaded."
432 :group 'gnus-summary-marks
435 (defcustom gnus-downloadable-mark ?%
436 "*Mark used for articles that are to be downloaded."
437 :group 'gnus-summary-marks
440 (defcustom gnus-unsendable-mark ?=
441 "*Mark used for articles that won't be sent."
442 :group 'gnus-summary-marks
445 (defcustom gnus-score-over-mark ?+
446 "*Score mark used for articles with high scores."
447 :group 'gnus-summary-marks
450 (defcustom gnus-score-below-mark ?-
451 "*Score mark used for articles with low scores."
452 :group 'gnus-summary-marks
455 (defcustom gnus-empty-thread-mark ?
456 "*There is no thread under the article."
457 :group 'gnus-summary-marks
460 (defcustom gnus-not-empty-thread-mark ?=
461 "*There is a thread under the article."
462 :group 'gnus-summary-marks
465 (defcustom gnus-view-pseudo-asynchronously nil
466 "*If non-nil, Gnus will view pseudo-articles asynchronously."
467 :group 'gnus-extract-view
470 (defcustom gnus-view-pseudos nil
471 "*If `automatic', pseudo-articles will be viewed automatically.
472 If `not-confirm', pseudos will be viewed automatically, and the user
473 will not be asked to confirm the command."
474 :group 'gnus-extract-view
475 :type '(choice (const :tag "off" nil)
477 (const not-confirm)))
479 (defcustom gnus-view-pseudos-separately t
480 "*If non-nil, one pseudo-article will be created for each file to be viewed.
481 If nil, all files that use the same viewing command will be given as a
482 list of parameters to that command."
483 :group 'gnus-extract-view
486 (defcustom gnus-insert-pseudo-articles t
487 "*If non-nil, insert pseudo-articles when decoding articles."
488 :group 'gnus-extract-view
491 (defcustom gnus-summary-dummy-line-format
493 "*The format specification for the dummy roots in the summary buffer.
494 It works along the same lines as a normal formatting string,
495 with some simple extensions.
498 :group 'gnus-threading
501 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
502 "*The format specification for the summary mode line.
503 It works along the same lines as a normal formatting string,
504 with some simple extensions:
507 %p Unprefixed group name
508 %A Current article number
510 %U Number of unread articles in the group
511 %e Number of unselected articles in the group
512 %Z A string with unread/unselected article counts
513 %g Shortish group name
514 %S Subject of the current article
516 %s Current score file name
517 %d Number of dormant articles
518 %r Number of articles that have been marked as read in this session
519 %E Number of articles expunged by the score files"
520 :group 'gnus-summary-format
523 (defcustom gnus-summary-mark-below 0
524 "*Mark all articles with a score below this variable as read.
525 This variable is local to each summary buffer and usually set by the
527 :group 'gnus-score-default
530 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
531 "*List of functions used for sorting articles in the summary buffer.
532 This variable is only used when not using a threaded display."
533 :group 'gnus-summary-sort
534 :type '(repeat (choice (function-item gnus-article-sort-by-number)
535 (function-item gnus-article-sort-by-author)
536 (function-item gnus-article-sort-by-subject)
537 (function-item gnus-article-sort-by-date)
538 (function-item gnus-article-sort-by-score)
539 (function :tag "other"))))
541 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
542 "*List of functions used for sorting threads in the summary buffer.
543 By default, threads are sorted by article number.
545 Each function takes two threads and return non-nil if the first thread
546 should be sorted before the other. If you use more than one function,
547 the primary sort function should be the last. You should probably
548 always include `gnus-thread-sort-by-number' in the list of sorting
549 functions -- preferably first.
551 Ready-made functions include `gnus-thread-sort-by-number',
552 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
553 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
554 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
555 :group 'gnus-summary-sort
556 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
557 (function-item gnus-thread-sort-by-author)
558 (function-item gnus-thread-sort-by-subject)
559 (function-item gnus-thread-sort-by-date)
560 (function-item gnus-thread-sort-by-score)
561 (function-item gnus-thread-sort-by-total-score)
562 (function :tag "other"))))
564 (defcustom gnus-thread-score-function '+
565 "*Function used for calculating the total score of a thread.
567 The function is called with the scores of the article and each
568 subthread and should then return the score of the thread.
570 Some functions you can use are `+', `max', or `min'."
571 :group 'gnus-summary-sort
574 (defcustom gnus-summary-expunge-below nil
575 "All articles that have a score less than this variable will be expunged.
576 This variable is local to the summary buffers."
577 :group 'gnus-score-default
578 :type '(choice (const :tag "off" nil)
581 (defcustom gnus-thread-expunge-below nil
582 "All threads that have a total score less than this variable will be expunged.
583 See `gnus-thread-score-function' for en explanation of what a
586 This variable is local to the summary buffers."
587 :group 'gnus-treading
588 :group 'gnus-score-default
589 :type '(choice (const :tag "off" nil)
592 (defcustom gnus-summary-mode-hook nil
593 "*A hook for Gnus summary mode.
594 This hook is run before any variables are set in the summary buffer."
595 :group 'gnus-summary-various
598 (defcustom gnus-summary-menu-hook nil
599 "*Hook run after the creation of the summary mode menu."
600 :group 'gnus-summary-visual
603 (defcustom gnus-summary-exit-hook nil
604 "*A hook called on exit from the summary buffer.
605 It will be called with point in the group buffer."
606 :group 'gnus-summary-exit
609 (defcustom gnus-summary-prepare-hook nil
610 "*A hook called after the summary buffer has been generated.
611 If you want to modify the summary buffer, you can use this hook."
612 :group 'gnus-summary-various
615 (defcustom gnus-summary-prepared-hook nil
616 "*A hook called as the last thing after the summary buffer has been generated."
617 :group 'gnus-summary-various
620 (defcustom gnus-summary-generate-hook nil
621 "*A hook run just before generating the summary buffer.
622 This hook is commonly used to customize threading variables and the
624 :group 'gnus-summary-various
627 (defcustom gnus-select-group-hook nil
628 "*A hook called when a newsgroup is selected.
630 If you'd like to simplify subjects like the
631 `gnus-summary-next-same-subject' command does, you can use the
634 (setq gnus-select-group-hook
637 (mapcar (lambda (header)
638 (mail-header-set-subject
640 (gnus-simplify-subject
641 (mail-header-subject header) 're-only)))
642 gnus-newsgroup-headers))))"
643 :group 'gnus-group-select
646 (defcustom gnus-select-article-hook nil
647 "*A hook called when an article is selected."
648 :group 'gnus-summary-choose
651 (defcustom gnus-visual-mark-article-hook
652 (list 'gnus-highlight-selected-summary)
653 "*Hook run after selecting an article in the summary buffer.
654 It is meant to be used for highlighting the article in some way. It
655 is not run if `gnus-visual' is nil."
656 :group 'gnus-summary-visual
659 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
660 (defcustom gnus-structured-field-decoder 'identity
661 "Function to decode non-ASCII characters in structured field for summary."
665 (defcustom gnus-unstructured-field-decoder 'identity
666 "Function to decode non-ASCII characters in unstructured field for summary."
670 (defcustom gnus-parse-headers-hook
671 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522)
672 "*A hook called before parsing the headers."
676 (defcustom gnus-exit-group-hook nil
677 "*A hook called when exiting (not quitting) summary mode."
681 (defcustom gnus-summary-update-hook
682 (list 'gnus-summary-highlight-line)
683 "*A hook called when a summary line is changed.
684 The hook will not be called if `gnus-visual' is nil.
686 The default function `gnus-summary-highlight-line' will
687 highlight the line according to the `gnus-summary-highlight'
689 :group 'gnus-summary-visual
692 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
693 "*A hook called when an article is selected for the first time.
694 The hook is intended to mark an article as read (or unread)
695 automatically when it is selected."
696 :group 'gnus-summary-choose
699 (defcustom gnus-group-no-more-groups-hook nil
700 "*A hook run when returning to group mode having no more (unread) groups."
701 :group 'gnus-group-select
704 (defcustom gnus-ps-print-hook nil
705 "*A hook run before ps-printing something from Gnus."
709 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
710 "Face used for highlighting the current article in the summary buffer."
711 :group 'gnus-summary-visual
714 (defcustom gnus-summary-highlight
715 '(((= mark gnus-canceled-mark)
716 . gnus-summary-cancelled-face)
717 ((and (> score default)
718 (or (= mark gnus-dormant-mark)
719 (= mark gnus-ticked-mark)))
720 . gnus-summary-high-ticked-face)
721 ((and (< score default)
722 (or (= mark gnus-dormant-mark)
723 (= mark gnus-ticked-mark)))
724 . gnus-summary-low-ticked-face)
725 ((or (= mark gnus-dormant-mark)
726 (= mark gnus-ticked-mark))
727 . gnus-summary-normal-ticked-face)
728 ((and (> score default) (= mark gnus-ancient-mark))
729 . gnus-summary-high-ancient-face)
730 ((and (< score default) (= mark gnus-ancient-mark))
731 . gnus-summary-low-ancient-face)
732 ((= mark gnus-ancient-mark)
733 . gnus-summary-normal-ancient-face)
734 ((and (> score default) (= mark gnus-unread-mark))
735 . gnus-summary-high-unread-face)
736 ((and (< score default) (= mark gnus-unread-mark))
737 . gnus-summary-low-unread-face)
738 ((memq mark (list gnus-unread-mark gnus-downloadable-mark
739 gnus-undownloaded-mark))
740 . gnus-summary-normal-unread-face)
742 . gnus-summary-high-read-face)
744 . gnus-summary-low-read-face)
746 . gnus-summary-normal-read-face))
747 "Controls the highlighting of summary buffer lines.
749 A list of (FORM . FACE) pairs. When deciding how a a particular
750 summary line should be displayed, each form is evaluated. The content
751 of the face field after the first true form is used. You can change
752 how those summary lines are displayed, by editing the face field.
754 You can use the following variables in the FORM field.
756 score: The articles score
757 default: The default article score.
758 below: The score below which articles are automatically marked as read.
759 mark: The articles mark."
760 :group 'gnus-summary-visual
761 :type '(repeat (cons (sexp :tag "Form" nil)
764 (defcustom gnus-alter-header-function nil
765 "Function called to allow alteration of article header structures.
766 The function is called with one parameter, the article header vector,
767 which it may alter in any way.")
769 ;;; Internal variables
771 (defvar gnus-scores-exclude-files nil)
772 (defvar gnus-page-broken nil)
774 (defvar gnus-original-article nil)
775 (defvar gnus-article-internal-prepare-hook nil)
776 (defvar gnus-newsgroup-process-stack nil)
778 (defvar gnus-thread-indent-array nil)
779 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
781 ;; Avoid highlighting in kill files.
782 (defvar gnus-summary-inhibit-highlight nil)
783 (defvar gnus-newsgroup-selected-overlay nil)
784 (defvar gnus-inhibit-limiting nil)
785 (defvar gnus-newsgroup-adaptive-score-file nil)
786 (defvar gnus-current-score-file nil)
787 (defvar gnus-current-move-group nil)
788 (defvar gnus-current-copy-group nil)
789 (defvar gnus-current-crosspost-group nil)
791 (defvar gnus-newsgroup-dependencies nil)
792 (defvar gnus-newsgroup-adaptive nil)
793 (defvar gnus-summary-display-article-function nil)
794 (defvar gnus-summary-highlight-line-function nil
795 "Function called after highlighting a summary line.")
797 (defvar gnus-summary-line-format-alist
798 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
799 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
800 (?s gnus-tmp-subject-or-nil ?s)
801 (?n gnus-tmp-name ?s)
802 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
804 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
806 (?F gnus-tmp-from ?s)
807 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
808 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
809 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
810 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
811 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
812 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
813 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
814 (?L gnus-tmp-lines ?d)
815 (?I gnus-tmp-indentation ?s)
816 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
817 (?R gnus-tmp-replied ?c)
818 (?\[ gnus-tmp-opening-bracket ?c)
819 (?\] gnus-tmp-closing-bracket ?c)
820 (?\> (make-string gnus-tmp-level ? ) ?s)
821 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
822 (?i gnus-tmp-score ?d)
823 (?z gnus-tmp-score-char ?c)
824 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
825 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
826 (?U gnus-tmp-unread ?c)
827 (?t (gnus-summary-number-of-articles-in-thread
828 (and (boundp 'thread) (car thread)) gnus-tmp-level)
830 (?e (gnus-summary-number-of-articles-in-thread
831 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
833 (?u gnus-tmp-user-defined ?s)
834 (?P (gnus-pick-line-number) ?d))
835 "An alist of format specifications that can appear in summary lines,
836 and what variables they correspond with, along with the type of the
837 variable (string, integer, character, etc).")
839 (defvar gnus-summary-dummy-line-format-alist
840 `((?S gnus-tmp-subject ?s)
841 (?N gnus-tmp-number ?d)
842 (?u gnus-tmp-user-defined ?s)))
844 (defvar gnus-summary-mode-line-format-alist
845 `((?G gnus-tmp-group-name ?s)
846 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
847 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
848 (?A gnus-tmp-article-number ?d)
849 (?Z gnus-tmp-unread-and-unselected ?s)
851 (?U gnus-tmp-unread-and-unticked ?d)
852 (?S gnus-tmp-subject ?s)
853 (?e gnus-tmp-unselected ?d)
854 (?u gnus-tmp-user-defined ?s)
855 (?d (length gnus-newsgroup-dormant) ?d)
856 (?t (length gnus-newsgroup-marked) ?d)
857 (?r (length gnus-newsgroup-reads) ?d)
858 (?E gnus-newsgroup-expunged-tally ?d)
859 (?s (gnus-current-score-file-nondirectory) ?s)))
861 (defvar gnus-last-search-regexp nil
862 "Default regexp for article search command.")
864 (defvar gnus-last-shell-command nil
865 "Default shell command on article.")
867 (defvar gnus-newsgroup-begin nil)
868 (defvar gnus-newsgroup-end nil)
869 (defvar gnus-newsgroup-last-rmail nil)
870 (defvar gnus-newsgroup-last-mail nil)
871 (defvar gnus-newsgroup-last-folder nil)
872 (defvar gnus-newsgroup-last-file nil)
873 (defvar gnus-newsgroup-auto-expire nil)
874 (defvar gnus-newsgroup-active nil)
876 (defvar gnus-newsgroup-data nil)
877 (defvar gnus-newsgroup-data-reverse nil)
878 (defvar gnus-newsgroup-limit nil)
879 (defvar gnus-newsgroup-limits nil)
881 (defvar gnus-newsgroup-unreads nil
882 "List of unread articles in the current newsgroup.")
884 (defvar gnus-newsgroup-unselected nil
885 "List of unselected unread articles in the current newsgroup.")
887 (defvar gnus-newsgroup-reads nil
888 "Alist of read articles and article marks in the current newsgroup.")
890 (defvar gnus-newsgroup-expunged-tally nil)
892 (defvar gnus-newsgroup-marked nil
893 "List of ticked articles in the current newsgroup (a subset of unread art).")
895 (defvar gnus-newsgroup-killed nil
896 "List of ranges of articles that have been through the scoring process.")
898 (defvar gnus-newsgroup-cached nil
899 "List of articles that come from the article cache.")
901 (defvar gnus-newsgroup-saved nil
902 "List of articles that have been saved.")
904 (defvar gnus-newsgroup-kill-headers nil)
906 (defvar gnus-newsgroup-replied nil
907 "List of articles that have been replied to in the current newsgroup.")
909 (defvar gnus-newsgroup-expirable nil
910 "List of articles in the current newsgroup that can be expired.")
912 (defvar gnus-newsgroup-processable nil
913 "List of articles in the current newsgroup that can be processed.")
915 (defvar gnus-newsgroup-downloadable nil
916 "List of articles in the current newsgroup that can be processed.")
918 (defvar gnus-newsgroup-undownloaded nil
919 "List of articles in the current newsgroup that haven't been downloaded..")
921 (defvar gnus-newsgroup-unsendable nil
922 "List of articles in the current newsgroup that won't be sent.")
924 (defvar gnus-newsgroup-bookmarks nil
925 "List of articles in the current newsgroup that have bookmarks.")
927 (defvar gnus-newsgroup-dormant nil
928 "List of dormant articles in the current newsgroup.")
930 (defvar gnus-newsgroup-scored nil
931 "List of scored articles in the current newsgroup.")
933 (defvar gnus-newsgroup-headers nil
934 "List of article headers in the current newsgroup.")
936 (defvar gnus-newsgroup-threads nil)
938 (defvar gnus-newsgroup-prepared nil
939 "Whether the current group has been prepared properly.")
941 (defvar gnus-newsgroup-ancient nil
942 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
944 (defvar gnus-newsgroup-sparse nil)
946 (defvar gnus-current-article nil)
947 (defvar gnus-article-current nil)
948 (defvar gnus-current-headers nil)
949 (defvar gnus-have-all-headers nil)
950 (defvar gnus-last-article nil)
951 (defvar gnus-newsgroup-history nil)
953 (defconst gnus-summary-local-variables
954 '(gnus-newsgroup-name
955 gnus-newsgroup-begin gnus-newsgroup-end
956 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
957 gnus-newsgroup-last-folder gnus-newsgroup-last-file
958 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
959 gnus-newsgroup-unselected gnus-newsgroup-marked
960 gnus-newsgroup-reads gnus-newsgroup-saved
961 gnus-newsgroup-replied gnus-newsgroup-expirable
962 gnus-newsgroup-processable gnus-newsgroup-killed
963 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
964 gnus-newsgroup-unsendable
965 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
966 gnus-newsgroup-headers gnus-newsgroup-threads
967 gnus-newsgroup-prepared gnus-summary-highlight-line-function
968 gnus-current-article gnus-current-headers gnus-have-all-headers
969 gnus-last-article gnus-article-internal-prepare-hook
970 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
971 gnus-newsgroup-scored gnus-newsgroup-kill-headers
972 gnus-thread-expunge-below
973 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
974 (gnus-summary-mark-below . global)
975 gnus-newsgroup-active gnus-scores-exclude-files
976 gnus-newsgroup-history gnus-newsgroup-ancient
977 gnus-newsgroup-sparse gnus-newsgroup-process-stack
978 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
979 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
980 (gnus-newsgroup-expunged-tally . 0)
981 gnus-cache-removable-articles gnus-newsgroup-cached
982 gnus-newsgroup-data gnus-newsgroup-data-reverse
983 gnus-newsgroup-limit gnus-newsgroup-limits)
984 "Variables that are buffer-local to the summary buffers.")
986 ;; Byte-compiler warning.
987 (defvar gnus-article-mode-map)
989 ;; Subject simplification.
991 (defun gnus-simplify-whitespace (str)
992 "Remove excessive whitespace."
995 (while (string-match "[ \t][ \t]+" mystr)
996 (setq mystr (concat (substring mystr 0 (match-beginning 0))
998 (substring mystr (match-end 0)))))
1000 (when (string-match "^[ \t]+" mystr)
1001 (setq mystr (substring mystr (match-end 0))))
1003 (when (string-match "[ \t]+$" mystr)
1004 (setq mystr (substring mystr 0 (match-beginning 0))))
1007 (defsubst gnus-simplify-subject-re (subject)
1008 "Remove \"Re:\" from subject lines."
1009 (if (string-match "^[Rr][Ee]: *" subject)
1010 (substring subject (match-end 0))
1013 (defun gnus-simplify-subject (subject &optional re-only)
1014 "Remove `Re:' and words in parentheses.
1015 If RE-ONLY is non-nil, strip leading `Re:'s only."
1016 (let ((case-fold-search t)) ;Ignore case.
1017 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1018 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1019 (setq subject (substring subject (match-end 0))))
1020 ;; Remove uninteresting prefixes.
1021 (when (and (not re-only)
1022 gnus-simplify-ignored-prefixes
1023 (string-match gnus-simplify-ignored-prefixes subject))
1024 (setq subject (substring subject (match-end 0))))
1025 ;; Remove words in parentheses from end.
1027 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1028 (setq subject (substring subject 0 (match-beginning 0)))))
1029 ;; Return subject string.
1032 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1034 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1035 (goto-char (point-min))
1036 (while (re-search-forward regexp nil t)
1037 (replace-match (or newtext ""))))
1039 (defun gnus-simplify-buffer-fuzzy ()
1040 "Simplify string in the buffer fuzzily.
1041 The string in the accessible portion of the current buffer is simplified.
1042 It is assumed to be a single-line subject.
1043 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1044 matter is removed. Additional things can be deleted by setting
1045 gnus-simplify-subject-fuzzy-regexp."
1046 (let ((case-fold-search t)
1048 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1050 (while (not (eq modified-tick (buffer-modified-tick)))
1051 (setq modified-tick (buffer-modified-tick))
1053 ((listp gnus-simplify-subject-fuzzy-regexp)
1054 (mapcar 'gnus-simplify-buffer-fuzzy-step
1055 gnus-simplify-subject-fuzzy-regexp))
1056 (gnus-simplify-subject-fuzzy-regexp
1057 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1058 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1059 (gnus-simplify-buffer-fuzzy-step
1060 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1061 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1063 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1064 (gnus-simplify-buffer-fuzzy-step " +" " ")
1065 (gnus-simplify-buffer-fuzzy-step " $")
1066 (gnus-simplify-buffer-fuzzy-step "^ +")))
1068 (defun gnus-simplify-subject-fuzzy (subject)
1069 "Simplify a subject string fuzzily.
1070 See `gnus-simplify-buffer-fuzzy' for details."
1072 (gnus-set-work-buffer)
1073 (let ((case-fold-search t))
1074 ;; Remove uninteresting prefixes.
1075 (when (and gnus-simplify-ignored-prefixes
1076 (string-match gnus-simplify-ignored-prefixes subject))
1077 (setq subject (substring subject (match-end 0))))
1079 (inline (gnus-simplify-buffer-fuzzy))
1082 (defsubst gnus-simplify-subject-fully (subject)
1083 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1085 (gnus-simplify-subject-functions
1086 (gnus-map-function gnus-simplify-subject-functions subject))
1087 ((null gnus-summary-gather-subject-limit)
1088 (gnus-simplify-subject-re subject))
1089 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1090 (gnus-simplify-subject-fuzzy subject))
1091 ((numberp gnus-summary-gather-subject-limit)
1092 (gnus-limit-string (gnus-simplify-subject-re subject)
1093 gnus-summary-gather-subject-limit))
1097 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1098 "Check whether two subjects are equal.
1099 If optional argument simple-first is t, first argument is already
1102 ((null simple-first)
1103 (equal (gnus-simplify-subject-fully s1)
1104 (gnus-simplify-subject-fully s2)))
1107 (gnus-simplify-subject-fully s2)))))
1109 (defun gnus-summary-bubble-group ()
1110 "Increase the score of the current group.
1111 This is a handy function to add to `gnus-summary-exit-hook' to
1112 increase the score of each group you read."
1113 (gnus-group-add-score gnus-newsgroup-name))
1117 ;;; Gnus summary mode
1120 (put 'gnus-summary-mode 'mode-class 'special)
1123 ;; Non-orthogonal keys
1125 (gnus-define-keys gnus-summary-mode-map
1126 " " gnus-summary-next-page
1127 "\177" gnus-summary-prev-page
1128 [delete] gnus-summary-prev-page
1129 [backspace] gnus-summary-prev-page
1130 "\r" gnus-summary-scroll-up
1131 "n" gnus-summary-next-unread-article
1132 "p" gnus-summary-prev-unread-article
1133 "N" gnus-summary-next-article
1134 "P" gnus-summary-prev-article
1135 "\M-\C-n" gnus-summary-next-same-subject
1136 "\M-\C-p" gnus-summary-prev-same-subject
1137 "\M-n" gnus-summary-next-unread-subject
1138 "\M-p" gnus-summary-prev-unread-subject
1139 "." gnus-summary-first-unread-article
1140 "," gnus-summary-best-unread-article
1141 "\M-s" gnus-summary-search-article-forward
1142 "\M-r" gnus-summary-search-article-backward
1143 "<" gnus-summary-beginning-of-article
1144 ">" gnus-summary-end-of-article
1145 "j" gnus-summary-goto-article
1146 "^" gnus-summary-refer-parent-article
1147 "\M-^" gnus-summary-refer-article
1148 "u" gnus-summary-tick-article-forward
1149 "!" gnus-summary-tick-article-forward
1150 "U" gnus-summary-tick-article-backward
1151 "d" gnus-summary-mark-as-read-forward
1152 "D" gnus-summary-mark-as-read-backward
1153 "E" gnus-summary-mark-as-expirable
1154 "\M-u" gnus-summary-clear-mark-forward
1155 "\M-U" gnus-summary-clear-mark-backward
1156 "k" gnus-summary-kill-same-subject-and-select
1157 "\C-k" gnus-summary-kill-same-subject
1158 "\M-\C-k" gnus-summary-kill-thread
1159 "\M-\C-l" gnus-summary-lower-thread
1160 "e" gnus-summary-edit-article
1161 "#" gnus-summary-mark-as-processable
1162 "\M-#" gnus-summary-unmark-as-processable
1163 "\M-\C-t" gnus-summary-toggle-threads
1164 "\M-\C-s" gnus-summary-show-thread
1165 "\M-\C-h" gnus-summary-hide-thread
1166 "\M-\C-f" gnus-summary-next-thread
1167 "\M-\C-b" gnus-summary-prev-thread
1168 "\M-\C-u" gnus-summary-up-thread
1169 "\M-\C-d" gnus-summary-down-thread
1170 "&" gnus-summary-execute-command
1171 "c" gnus-summary-catchup-and-exit
1172 "\C-w" gnus-summary-mark-region-as-read
1173 "\C-t" gnus-summary-toggle-truncation
1174 "?" gnus-summary-mark-as-dormant
1175 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1176 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1177 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1178 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1179 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1180 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1181 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1182 "=" gnus-summary-expand-window
1183 "\C-x\C-s" gnus-summary-reselect-current-group
1184 "\M-g" gnus-summary-rescan-group
1185 "w" gnus-summary-stop-page-breaking
1186 "\C-c\C-r" gnus-summary-caesar-message
1187 "\M-t" gnus-summary-toggle-mime
1188 "f" gnus-summary-followup
1189 "F" gnus-summary-followup-with-original
1190 "C" gnus-summary-cancel-article
1191 "r" gnus-summary-reply
1192 "R" gnus-summary-reply-with-original
1193 "\C-c\C-f" gnus-summary-mail-forward
1194 "o" gnus-summary-save-article
1195 "\C-o" gnus-summary-save-article-mail
1196 "|" gnus-summary-pipe-output
1197 "\M-k" gnus-summary-edit-local-kill
1198 "\M-K" gnus-summary-edit-global-kill
1200 "\C-c\C-d" gnus-summary-describe-group
1201 "q" gnus-summary-exit
1202 "Q" gnus-summary-exit-no-update
1203 "\C-c\C-i" gnus-info-find-node
1204 gnus-mouse-2 gnus-mouse-pick-article
1205 "m" gnus-summary-mail-other-window
1206 "a" gnus-summary-post-news
1207 "x" gnus-summary-limit-to-unread
1208 "s" gnus-summary-isearch-article
1209 "t" gnus-article-hide-headers
1210 "g" gnus-summary-show-article
1211 "l" gnus-summary-goto-last-article
1212 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1213 "\C-d" gnus-summary-enter-digest-group
1214 "\M-\C-d" gnus-summary-read-document
1216 "*" gnus-cache-enter-article
1217 "\M-*" gnus-cache-remove-article
1218 "\M-&" gnus-summary-universal-argument
1219 "\C-l" gnus-recenter
1220 "I" gnus-summary-increase-score
1221 "L" gnus-summary-lower-score
1222 "\M-i" gnus-symbolic-argument
1223 "h" gnus-summary-select-article-buffer
1225 "V" gnus-summary-score-map
1226 "X" gnus-uu-extract-map
1227 "S" gnus-summary-send-map)
1229 ;; Sort of orthogonal keymap
1230 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1231 "t" gnus-summary-tick-article-forward
1232 "!" gnus-summary-tick-article-forward
1233 "d" gnus-summary-mark-as-read-forward
1234 "r" gnus-summary-mark-as-read-forward
1235 "c" gnus-summary-clear-mark-forward
1236 " " gnus-summary-clear-mark-forward
1237 "e" gnus-summary-mark-as-expirable
1238 "x" gnus-summary-mark-as-expirable
1239 "?" gnus-summary-mark-as-dormant
1240 "b" gnus-summary-set-bookmark
1241 "B" gnus-summary-remove-bookmark
1242 "#" gnus-summary-mark-as-processable
1243 "\M-#" gnus-summary-unmark-as-processable
1244 "S" gnus-summary-limit-include-expunged
1245 "C" gnus-summary-catchup
1246 "H" gnus-summary-catchup-to-here
1247 "\C-c" gnus-summary-catchup-all
1248 "k" gnus-summary-kill-same-subject-and-select
1249 "K" gnus-summary-kill-same-subject
1250 "P" gnus-uu-mark-map)
1252 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1253 "c" gnus-summary-clear-above
1254 "u" gnus-summary-tick-above
1255 "m" gnus-summary-mark-above
1256 "k" gnus-summary-kill-below)
1258 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1259 "/" gnus-summary-limit-to-subject
1260 "n" gnus-summary-limit-to-articles
1261 "w" gnus-summary-pop-limit
1262 "s" gnus-summary-limit-to-subject
1263 "a" gnus-summary-limit-to-author
1264 "u" gnus-summary-limit-to-unread
1265 "m" gnus-summary-limit-to-marks
1266 "v" gnus-summary-limit-to-score
1267 "*" gnus-summary-limit-include-cached
1268 "D" gnus-summary-limit-include-dormant
1269 "T" gnus-summary-limit-include-thread
1270 "d" gnus-summary-limit-exclude-dormant
1271 "t" gnus-summary-limit-to-age
1272 "E" gnus-summary-limit-include-expunged
1273 "c" gnus-summary-limit-exclude-childless-dormant
1274 "C" gnus-summary-limit-mark-excluded-as-read)
1276 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1277 "n" gnus-summary-next-unread-article
1278 "p" gnus-summary-prev-unread-article
1279 "N" gnus-summary-next-article
1280 "P" gnus-summary-prev-article
1281 "\C-n" gnus-summary-next-same-subject
1282 "\C-p" gnus-summary-prev-same-subject
1283 "\M-n" gnus-summary-next-unread-subject
1284 "\M-p" gnus-summary-prev-unread-subject
1285 "f" gnus-summary-first-unread-article
1286 "b" gnus-summary-best-unread-article
1287 "j" gnus-summary-goto-article
1288 "g" gnus-summary-goto-subject
1289 "l" gnus-summary-goto-last-article
1290 "o" gnus-summary-pop-article)
1292 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1293 "k" gnus-summary-kill-thread
1294 "l" gnus-summary-lower-thread
1295 "i" gnus-summary-raise-thread
1296 "T" gnus-summary-toggle-threads
1297 "t" gnus-summary-rethread-current
1298 "^" gnus-summary-reparent-thread
1299 "s" gnus-summary-show-thread
1300 "S" gnus-summary-show-all-threads
1301 "h" gnus-summary-hide-thread
1302 "H" gnus-summary-hide-all-threads
1303 "n" gnus-summary-next-thread
1304 "p" gnus-summary-prev-thread
1305 "u" gnus-summary-up-thread
1306 "o" gnus-summary-top-thread
1307 "d" gnus-summary-down-thread
1308 "#" gnus-uu-mark-thread
1309 "\M-#" gnus-uu-unmark-thread)
1311 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1312 "g" gnus-summary-prepare
1313 "c" gnus-summary-insert-cached-articles)
1315 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1316 "c" gnus-summary-catchup-and-exit
1317 "C" gnus-summary-catchup-all-and-exit
1318 "E" gnus-summary-exit-no-update
1319 "Q" gnus-summary-exit
1320 "Z" gnus-summary-exit
1321 "n" gnus-summary-catchup-and-goto-next-group
1322 "R" gnus-summary-reselect-current-group
1323 "G" gnus-summary-rescan-group
1324 "N" gnus-summary-next-group
1325 "s" gnus-summary-save-newsrc
1326 "P" gnus-summary-prev-group)
1328 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1329 " " gnus-summary-next-page
1330 "n" gnus-summary-next-page
1331 "\177" gnus-summary-prev-page
1332 [delete] gnus-summary-prev-page
1333 "p" gnus-summary-prev-page
1334 "\r" gnus-summary-scroll-up
1335 "<" gnus-summary-beginning-of-article
1336 ">" gnus-summary-end-of-article
1337 "b" gnus-summary-beginning-of-article
1338 "e" gnus-summary-end-of-article
1339 "^" gnus-summary-refer-parent-article
1340 "r" gnus-summary-refer-parent-article
1341 "R" gnus-summary-refer-references
1342 "T" gnus-summary-refer-thread
1343 "g" gnus-summary-show-article
1344 "s" gnus-summary-isearch-article
1345 "P" gnus-summary-print-article)
1347 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1348 "b" gnus-article-add-buttons
1349 "B" gnus-article-add-buttons-to-head
1350 "o" gnus-article-treat-overstrike
1351 "e" gnus-article-emphasize
1352 "w" gnus-article-fill-cited-article
1353 "c" gnus-article-remove-cr
1354 "q" gnus-article-de-quoted-unreadable
1355 "f" gnus-article-display-x-face
1356 "l" gnus-summary-stop-page-breaking
1357 "r" gnus-summary-caesar-message
1358 "t" gnus-article-hide-headers
1359 "v" gnus-summary-verbose-headers
1360 "m" gnus-summary-toggle-mime
1361 "h" gnus-article-treat-html
1362 "d" gnus-article-treat-dumbquotes)
1364 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1365 "a" gnus-article-hide
1366 "h" gnus-article-hide-headers
1367 "b" gnus-article-hide-boring-headers
1368 "s" gnus-article-hide-signature
1369 "c" gnus-article-hide-citation
1370 "p" gnus-article-hide-pgp
1371 "P" gnus-article-hide-pem
1372 "\C-c" gnus-article-hide-citation-maybe)
1374 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1375 "a" gnus-article-highlight
1376 "h" gnus-article-highlight-headers
1377 "c" gnus-article-highlight-citation
1378 "s" gnus-article-highlight-signature)
1380 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1381 "z" gnus-article-date-ut
1382 "u" gnus-article-date-ut
1383 "l" gnus-article-date-local
1384 "e" gnus-article-date-lapsed
1385 "o" gnus-article-date-original
1386 "i" gnus-article-date-iso8601
1387 "s" gnus-article-date-user)
1389 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1390 "t" gnus-article-remove-trailing-blank-lines
1391 "l" gnus-article-strip-leading-blank-lines
1392 "m" gnus-article-strip-multiple-blank-lines
1393 "a" gnus-article-strip-blank-lines
1394 "A" gnus-article-strip-all-blank-lines
1395 "s" gnus-article-strip-leading-space)
1397 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1399 "f" gnus-summary-fetch-faq
1400 "d" gnus-summary-describe-group
1401 "h" gnus-summary-describe-briefly
1402 "i" gnus-info-find-node)
1404 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1405 "e" gnus-summary-expire-articles
1406 "\M-\C-e" gnus-summary-expire-articles-now
1407 "\177" gnus-summary-delete-article
1408 [delete] gnus-summary-delete-article
1409 "m" gnus-summary-move-article
1410 "r" gnus-summary-respool-article
1411 "w" gnus-summary-edit-article
1412 "c" gnus-summary-copy-article
1413 "B" gnus-summary-crosspost-article
1414 "q" gnus-summary-respool-query
1415 "i" gnus-summary-import-article
1416 "p" gnus-summary-article-posted-p)
1418 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1419 "o" gnus-summary-save-article
1420 "m" gnus-summary-save-article-mail
1421 "F" gnus-summary-write-article-file
1422 "r" gnus-summary-save-article-rmail
1423 "f" gnus-summary-save-article-file
1424 "b" gnus-summary-save-article-body-file
1425 "h" gnus-summary-save-article-folder
1426 "v" gnus-summary-save-article-vm
1427 "p" gnus-summary-pipe-output
1428 "s" gnus-soup-add-article))
1430 (defun gnus-summary-make-menu-bar ()
1431 (gnus-turn-off-edit-menu 'summary)
1433 (unless (boundp 'gnus-summary-misc-menu)
1436 gnus-summary-kill-menu gnus-summary-mode-map ""
1441 ["Enter score..." gnus-summary-score-entry t]
1442 ["Customize" gnus-score-customize t])
1443 (gnus-make-score-map 'increase)
1444 (gnus-make-score-map 'lower)
1446 ["Kill below" gnus-summary-kill-below t]
1447 ["Mark above" gnus-summary-mark-above t]
1448 ["Tick above" gnus-summary-tick-above t]
1449 ["Clear above" gnus-summary-clear-above t])
1450 ["Current score" gnus-summary-current-score t]
1451 ["Set score" gnus-summary-set-score t]
1452 ["Switch current score file..." gnus-score-change-score-file t]
1453 ["Set mark below..." gnus-score-set-mark-below t]
1454 ["Set expunge below..." gnus-score-set-expunge-below t]
1455 ["Edit current score file" gnus-score-edit-current-scores t]
1456 ["Edit score file" gnus-score-edit-file t]
1457 ["Trace score" gnus-score-find-trace t]
1458 ["Find words" gnus-score-find-favourite-words t]
1459 ["Rescore buffer" gnus-summary-rescore t]
1460 ["Increase score..." gnus-summary-increase-score t]
1461 ["Lower score..." gnus-summary-lower-score t]))))
1464 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1466 :selected (null gnus-score-default-header)]
1467 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1469 :selected (eq gnus-score-default-header 'a)]
1470 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1472 :selected (eq gnus-score-default-header 's)]
1474 (gnus-score-set-default 'gnus-score-default-header 'b)
1476 :selected (eq gnus-score-default-header 'b )]
1478 (gnus-score-set-default 'gnus-score-default-header 'h)
1480 :selected (eq gnus-score-default-header 'h )]
1481 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1483 :selected (eq gnus-score-default-header 'i )]
1484 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1486 :selected (eq gnus-score-default-header 't )]
1488 (gnus-score-set-default 'gnus-score-default-header 'x)
1490 :selected (eq gnus-score-default-header 'x )]
1491 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1493 :selected (eq gnus-score-default-header 'l )]
1494 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1496 :selected (eq gnus-score-default-header 'd )]
1497 ["Followups to author"
1498 (gnus-score-set-default 'gnus-score-default-header 'f)
1500 :selected (eq gnus-score-default-header 'f )])
1502 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1504 :selected (null gnus-score-default-type)]
1505 ;; The `:active' key is commented out in the following,
1506 ;; because the GNU Emacs hack to support radio buttons use
1507 ;; active to indicate which button is selected.
1508 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1510 ;; :active (not (memq gnus-score-default-header '(l d)))
1511 :selected (eq gnus-score-default-type 's)]
1512 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1514 ;; :active (not (memq gnus-score-default-header '(l d)))
1515 :selected (eq gnus-score-default-type 'r)]
1516 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1518 ;; :active (not (memq gnus-score-default-header '(l d)))
1519 :selected (eq gnus-score-default-type 'e)]
1520 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1522 ;; :active (not (memq gnus-score-default-header '(l d)))
1523 :selected (eq gnus-score-default-type 'f)]
1524 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1526 ;; :active (eq (gnus-score-default-header 'd))
1527 :selected (eq gnus-score-default-type 'b)]
1528 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1530 ;; :active (eq (gnus-score-default-header 'd))
1531 :selected (eq gnus-score-default-type 'n)]
1532 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1534 ;; :active (eq (gnus-score-default-header 'd))
1535 :selected (eq gnus-score-default-type 'a)]
1537 (gnus-score-set-default 'gnus-score-default-type '<)
1539 ;; :active (eq (gnus-score-default-header 'l))
1540 :selected (eq gnus-score-default-type '<)]
1542 (gnus-score-set-default 'gnus-score-default-type '=)
1544 ;; :active (eq (gnus-score-default-header 'l))
1545 :selected (eq gnus-score-default-type '=)]
1546 ["Greater than number"
1547 (gnus-score-set-default 'gnus-score-default-type '>)
1549 ;; :active (eq (gnus-score-default-header 'l))
1550 :selected (eq gnus-score-default-type '>)])
1551 ["Default fold" gnus-score-default-fold-toggle
1553 :selected gnus-score-default-fold]
1555 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1557 :selected (null gnus-score-default-duration)]
1559 (gnus-score-set-default 'gnus-score-default-duration 'p)
1561 :selected (eq gnus-score-default-duration 'p)]
1563 (gnus-score-set-default 'gnus-score-default-duration 't)
1565 :selected (eq gnus-score-default-duration 't)]
1567 (gnus-score-set-default 'gnus-score-default-duration 'i)
1569 :selected (eq gnus-score-default-duration 'i)]))
1572 gnus-summary-article-menu gnus-summary-mode-map ""
1575 ["All" gnus-article-hide t]
1576 ["Headers" gnus-article-hide-headers t]
1577 ["Signature" gnus-article-hide-signature t]
1578 ["Citation" gnus-article-hide-citation t]
1579 ["PGP" gnus-article-hide-pgp t]
1580 ["Boring headers" gnus-article-hide-boring-headers t])
1582 ["All" gnus-article-highlight t]
1583 ["Headers" gnus-article-highlight-headers t]
1584 ["Signature" gnus-article-highlight-signature t]
1585 ["Citation" gnus-article-highlight-citation t])
1587 ["Local" gnus-article-date-local t]
1588 ["ISO8601" gnus-article-date-iso8601 t]
1589 ["UT" gnus-article-date-ut t]
1590 ["Original" gnus-article-date-original t]
1591 ["Lapsed" gnus-article-date-lapsed t]
1592 ["User-defined" gnus-article-date-user t])
1595 ["Leading" gnus-article-strip-leading-blank-lines t]
1596 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1597 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1598 ["All of the above" gnus-article-strip-blank-lines t]
1599 ["All" gnus-article-strip-all-blank-lines t]
1600 ["Leading space" gnus-article-strip-leading-space t])
1601 ["Overstrike" gnus-article-treat-overstrike t]
1602 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1603 ["Emphasis" gnus-article-emphasize t]
1604 ["Word wrap" gnus-article-fill-cited-article t]
1605 ["CR" gnus-article-remove-cr t]
1606 ["Show X-Face" gnus-article-display-x-face t]
1607 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1608 ["UnHTMLize" gnus-article-treat-html t]
1609 ["Rot 13" gnus-summary-caesar-message t]
1610 ["Unix pipe" gnus-summary-pipe-message t]
1611 ["Add buttons" gnus-article-add-buttons t]
1612 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1613 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1614 ["Toggle MIME" gnus-summary-toggle-mime t]
1615 ["Verbose header" gnus-summary-verbose-headers t]
1616 ["Toggle header" gnus-summary-toggle-header t])
1618 ["Save in default format" gnus-summary-save-article t]
1619 ["Save in file" gnus-summary-save-article-file t]
1620 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1621 ["Save in MH folder" gnus-summary-save-article-folder t]
1622 ["Save in VM folder" gnus-summary-save-article-vm t]
1623 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1624 ["Save body in file" gnus-summary-save-article-body-file t]
1625 ["Pipe through a filter" gnus-summary-pipe-output t]
1626 ["Add to SOUP packet" gnus-soup-add-article t]
1627 ["Print" gnus-summary-print-article t])
1629 ["Respool article..." gnus-summary-respool-article t]
1630 ["Move article..." gnus-summary-move-article
1631 (gnus-check-backend-function
1632 'request-move-article gnus-newsgroup-name)]
1633 ["Copy article..." gnus-summary-copy-article t]
1634 ["Crosspost article..." gnus-summary-crosspost-article
1635 (gnus-check-backend-function
1636 'request-replace-article gnus-newsgroup-name)]
1637 ["Import file..." gnus-summary-import-article t]
1638 ["Check if posted" gnus-summary-article-posted-p t]
1639 ["Edit article" gnus-summary-edit-article
1640 (not (gnus-group-read-only-p))]
1641 ["Delete article" gnus-summary-delete-article
1642 (gnus-check-backend-function
1643 'request-expire-articles gnus-newsgroup-name)]
1644 ["Query respool" gnus-summary-respool-query t]
1645 ["Delete expirable articles" gnus-summary-expire-articles-now
1646 (gnus-check-backend-function
1647 'request-expire-articles gnus-newsgroup-name)])
1649 ["Uudecode" gnus-uu-decode-uu t]
1650 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1651 ["Unshar" gnus-uu-decode-unshar t]
1652 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1653 ["Save" gnus-uu-decode-save t]
1654 ["Binhex" gnus-uu-decode-binhex t]
1655 ["Postscript" gnus-uu-decode-postscript t])
1657 ["Enter article" gnus-cache-enter-article t]
1658 ["Remove article" gnus-cache-remove-article t])
1659 ["Select article buffer" gnus-summary-select-article-buffer t]
1660 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1661 ["Isearch article..." gnus-summary-isearch-article t]
1662 ["Beginning of the article" gnus-summary-beginning-of-article t]
1663 ["End of the article" gnus-summary-end-of-article t]
1664 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1665 ["Fetch referenced articles" gnus-summary-refer-references t]
1666 ["Fetch current thread" gnus-summary-refer-thread t]
1667 ["Fetch article with id..." gnus-summary-refer-article t]
1668 ["Redisplay" gnus-summary-show-article t]))
1671 gnus-summary-thread-menu gnus-summary-mode-map ""
1673 ["Toggle threading" gnus-summary-toggle-threads t]
1674 ["Hide threads" gnus-summary-hide-all-threads t]
1675 ["Show threads" gnus-summary-show-all-threads t]
1676 ["Hide thread" gnus-summary-hide-thread t]
1677 ["Show thread" gnus-summary-show-thread t]
1678 ["Go to next thread" gnus-summary-next-thread t]
1679 ["Go to previous thread" gnus-summary-prev-thread t]
1680 ["Go down thread" gnus-summary-down-thread t]
1681 ["Go up thread" gnus-summary-up-thread t]
1682 ["Top of thread" gnus-summary-top-thread t]
1683 ["Mark thread as read" gnus-summary-kill-thread t]
1684 ["Lower thread score" gnus-summary-lower-thread t]
1685 ["Raise thread score" gnus-summary-raise-thread t]
1686 ["Rethread current" gnus-summary-rethread-current t]
1690 gnus-summary-post-menu gnus-summary-mode-map ""
1692 ["Post an article" gnus-summary-post-news t]
1693 ["Followup" gnus-summary-followup t]
1694 ["Followup and yank" gnus-summary-followup-with-original t]
1695 ["Supersede article" gnus-summary-supersede-article t]
1696 ["Cancel article" gnus-summary-cancel-article t]
1697 ["Reply" gnus-summary-reply t]
1698 ["Reply and yank" gnus-summary-reply-with-original t]
1699 ["Wide reply" gnus-summary-wide-reply t]
1700 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1701 ["Mail forward" gnus-summary-mail-forward t]
1702 ["Post forward" gnus-summary-post-forward t]
1703 ["Digest and mail" gnus-uu-digest-mail-forward t]
1704 ["Digest and post" gnus-uu-digest-post-forward t]
1705 ["Resend message" gnus-summary-resend-message t]
1706 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1707 ["Send a mail" gnus-summary-mail-other-window t]
1708 ["Uuencode and post" gnus-uu-post-news t]
1709 ["Followup via news" gnus-summary-followup-to-mail t]
1710 ["Followup via news and yank"
1711 gnus-summary-followup-to-mail-with-original t]
1713 ;;["Send" gnus-summary-send-draft t]
1714 ;;["Send bounced" gnus-resend-bounced-mail t])
1718 gnus-summary-misc-menu gnus-summary-mode-map ""
1721 ["Mark as read" gnus-summary-mark-as-read-forward t]
1722 ["Mark same subject and select"
1723 gnus-summary-kill-same-subject-and-select t]
1724 ["Mark same subject" gnus-summary-kill-same-subject t]
1725 ["Catchup" gnus-summary-catchup t]
1726 ["Catchup all" gnus-summary-catchup-all t]
1727 ["Catchup to here" gnus-summary-catchup-to-here t]
1728 ["Catchup region" gnus-summary-mark-region-as-read t]
1729 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1731 ["Tick" gnus-summary-tick-article-forward t]
1732 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1733 ["Remove marks" gnus-summary-clear-mark-forward t]
1734 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1735 ["Set bookmark" gnus-summary-set-bookmark t]
1736 ["Remove bookmark" gnus-summary-remove-bookmark t])
1738 ["Marks..." gnus-summary-limit-to-marks t]
1739 ["Subject..." gnus-summary-limit-to-subject t]
1740 ["Author..." gnus-summary-limit-to-author t]
1741 ["Age..." gnus-summary-limit-to-age t]
1742 ["Score" gnus-summary-limit-to-score t]
1743 ["Unread" gnus-summary-limit-to-unread t]
1744 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1745 ["Articles" gnus-summary-limit-to-articles t]
1746 ["Pop limit" gnus-summary-pop-limit t]
1747 ["Show dormant" gnus-summary-limit-include-dormant t]
1748 ["Hide childless dormant"
1749 gnus-summary-limit-exclude-childless-dormant t]
1750 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1751 ["Show expunged" gnus-summary-show-all-expunged t])
1753 ["Set mark" gnus-summary-mark-as-processable t]
1754 ["Remove mark" gnus-summary-unmark-as-processable t]
1755 ["Remove all marks" gnus-summary-unmark-all-processable t]
1756 ["Mark above" gnus-uu-mark-over t]
1757 ["Mark series" gnus-uu-mark-series t]
1758 ["Mark region" gnus-uu-mark-region t]
1759 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1760 ["Mark all" gnus-uu-mark-all t]
1761 ["Mark buffer" gnus-uu-mark-buffer t]
1762 ["Mark sparse" gnus-uu-mark-sparse t]
1763 ["Mark thread" gnus-uu-mark-thread t]
1764 ["Unmark thread" gnus-uu-unmark-thread t]
1765 ("Process Mark Sets"
1766 ["Kill" gnus-summary-kill-process-mark t]
1767 ["Yank" gnus-summary-yank-process-mark
1768 gnus-newsgroup-process-stack]
1769 ["Save" gnus-summary-save-process-mark t]))
1771 ["Page forward" gnus-summary-next-page t]
1772 ["Page backward" gnus-summary-prev-page t]
1773 ["Line forward" gnus-summary-scroll-up t])
1775 ["Next unread article" gnus-summary-next-unread-article t]
1776 ["Previous unread article" gnus-summary-prev-unread-article t]
1777 ["Next article" gnus-summary-next-article t]
1778 ["Previous article" gnus-summary-prev-article t]
1779 ["Next unread subject" gnus-summary-next-unread-subject t]
1780 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1781 ["Next article same subject" gnus-summary-next-same-subject t]
1782 ["Previous article same subject" gnus-summary-prev-same-subject t]
1783 ["First unread article" gnus-summary-first-unread-article t]
1784 ["Best unread article" gnus-summary-best-unread-article t]
1785 ["Go to subject number..." gnus-summary-goto-subject t]
1786 ["Go to article number..." gnus-summary-goto-article t]
1787 ["Go to the last article" gnus-summary-goto-last-article t]
1788 ["Pop article off history" gnus-summary-pop-article t])
1790 ["Sort by number" gnus-summary-sort-by-number t]
1791 ["Sort by author" gnus-summary-sort-by-author t]
1792 ["Sort by subject" gnus-summary-sort-by-subject t]
1793 ["Sort by date" gnus-summary-sort-by-date t]
1794 ["Sort by score" gnus-summary-sort-by-score t]
1795 ["Sort by lines" gnus-summary-sort-by-lines t])
1797 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1798 ["Describe group" gnus-summary-describe-group t]
1799 ["Read manual" gnus-info-find-node t])
1801 ["Pick and read" gnus-pick-mode t]
1802 ["Binary" gnus-binary-mode t])
1804 ["Regenerate" gnus-summary-prepare t]
1805 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1806 ["Toggle threading" gnus-summary-toggle-threads t])
1807 ["Filter articles..." gnus-summary-execute-command t]
1808 ["Run command on subjects..." gnus-summary-universal-argument t]
1809 ["Search articles forward..." gnus-summary-search-article-forward t]
1810 ["Search articles backward..." gnus-summary-search-article-backward t]
1811 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1812 ["Expand window" gnus-summary-expand-window t]
1813 ["Expire expirable articles" gnus-summary-expire-articles
1814 (gnus-check-backend-function
1815 'request-expire-articles gnus-newsgroup-name)]
1816 ["Edit local kill file" gnus-summary-edit-local-kill t]
1817 ["Edit main kill file" gnus-summary-edit-global-kill t]
1819 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1820 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1821 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1822 ["Exit group" gnus-summary-exit t]
1823 ["Exit group without updating" gnus-summary-exit-no-update t]
1824 ["Exit and goto next group" gnus-summary-next-group t]
1825 ["Exit and goto prev group" gnus-summary-prev-group t]
1826 ["Reselect group" gnus-summary-reselect-current-group t]
1827 ["Rescan group" gnus-summary-rescan-group t]
1828 ["Update dribble" gnus-summary-save-newsrc t])))
1830 (run-hooks 'gnus-summary-menu-hook)))
1832 (defun gnus-score-set-default (var value)
1833 "A version of set that updates the GNU Emacs menu-bar."
1835 ;; It is the message that forces the active status to be updated.
1838 (defun gnus-make-score-map (type)
1839 "Make a summary score map of type TYPE."
1842 (let ((headers '(("author" "from" string)
1843 ("subject" "subject" string)
1844 ("article body" "body" string)
1845 ("article head" "head" string)
1846 ("xref" "xref" string)
1847 ("lines" "lines" number)
1848 ("followups to author" "followup" string)))
1849 (types '((number ("less than" <)
1852 (string ("substring" s)
1856 (perms '(("temporary" (current-time-string))
1864 (if (eq type 'lower)
1869 (setq header (car headers))
1875 (let ((ts (cdr (assoc (nth 2 header) types)))
1891 'gnus-summary-score-entry
1893 (if (or (string= (nth 1 header)
1895 (string= (nth 1 header)
1898 (list 'gnus-summary-header
1900 (list 'quote (nth 1 (car ts)))
1901 (list 'gnus-score-default nil)
1907 (list (nreverse outp))))
1910 (list (nreverse outt))))
1912 (setq headers (cdr headers)))
1913 (list (nreverse outh))))))))
1917 (defun gnus-summary-mode (&optional group)
1918 "Major mode for reading articles.
1920 All normal editing commands are switched off.
1921 \\<gnus-summary-mode-map>
1922 Each line in this buffer represents one article. To read an
1923 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1924 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1927 You can also post articles and send mail from this buffer. To
1928 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1929 of an article, type `\\[gnus-summary-reply]'.
1931 There are approx. one gazillion commands you can execute in this
1932 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1934 The following commands are available:
1936 \\{gnus-summary-mode-map}"
1938 (when (gnus-visual-p 'summary-menu 'menu)
1939 (gnus-summary-make-menu-bar))
1940 (kill-all-local-variables)
1941 (gnus-summary-make-local-variables)
1942 (gnus-make-thread-indent-array)
1943 (gnus-simplify-mode-line)
1944 (setq major-mode 'gnus-summary-mode)
1945 (setq mode-name "Summary")
1946 (make-local-variable 'minor-mode-alist)
1947 (use-local-map gnus-summary-mode-map)
1948 (buffer-disable-undo (current-buffer))
1949 (setq buffer-read-only t) ;Disable modification
1950 (setq truncate-lines t)
1951 (setq selective-display t)
1952 (setq selective-display-ellipses t) ;Display `...'
1953 (gnus-summary-set-display-table)
1954 (gnus-set-default-directory)
1955 (setq gnus-newsgroup-name group)
1956 (make-local-variable 'gnus-summary-line-format)
1957 (make-local-variable 'gnus-summary-line-format-spec)
1958 (make-local-variable 'gnus-summary-dummy-line-format)
1959 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1960 (make-local-variable 'gnus-summary-mark-positions)
1961 (make-local-hook 'post-command-hook)
1962 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1963 (make-local-hook 'pre-command-hook)
1964 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1965 (run-hooks 'gnus-summary-mode-hook)
1966 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1967 (gnus-update-summary-mark-positions))
1969 (defun gnus-summary-make-local-variables ()
1970 "Make all the local summary buffer variables."
1971 (let ((locals gnus-summary-local-variables)
1973 (while (setq local (pop locals))
1976 (if (eq (cdr local) 'global)
1977 ;; Copy the global value of the variable.
1978 (setq global (symbol-value (car local)))
1979 ;; Use the value from the list.
1980 (setq global (eval (cdr local))))
1981 (make-local-variable (car local))
1982 (set (car local) global))
1983 ;; Simple nil-valued local variable.
1984 (make-local-variable local)
1987 (defun gnus-summary-clear-local-variables ()
1988 (let ((locals gnus-summary-local-variables))
1990 (if (consp (car locals))
1991 (and (vectorp (caar locals))
1992 (set (caar locals) nil))
1993 (and (vectorp (car locals))
1994 (set (car locals) nil)))
1995 (setq locals (cdr locals)))))
1997 ;; Summary data functions.
1999 (defmacro gnus-data-number (data)
2002 (defmacro gnus-data-set-number (data number)
2003 `(setcar ,data ,number))
2005 (defmacro gnus-data-mark (data)
2008 (defmacro gnus-data-set-mark (data mark)
2009 `(setcar (nthcdr 1 ,data) ,mark))
2011 (defmacro gnus-data-pos (data)
2014 (defmacro gnus-data-set-pos (data pos)
2015 `(setcar (nthcdr 2 ,data) ,pos))
2017 (defmacro gnus-data-header (data)
2020 (defmacro gnus-data-set-header (data header)
2021 `(setf (nth 3 ,data) ,header))
2023 (defmacro gnus-data-level (data)
2026 (defmacro gnus-data-unread-p (data)
2027 `(= (nth 1 ,data) gnus-unread-mark))
2029 (defmacro gnus-data-read-p (data)
2030 `(/= (nth 1 ,data) gnus-unread-mark))
2032 (defmacro gnus-data-pseudo-p (data)
2033 `(consp (nth 3 ,data)))
2035 (defmacro gnus-data-find (number)
2036 `(assq ,number gnus-newsgroup-data))
2038 (defmacro gnus-data-find-list (number &optional data)
2039 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2040 (memq (assq ,number bdata)
2043 (defmacro gnus-data-make (number mark pos header level)
2044 `(list ,number ,mark ,pos ,header ,level))
2046 (defun gnus-data-enter (after-article number mark pos header level offset)
2047 (let ((data (gnus-data-find-list after-article)))
2049 (error "No such article: %d" after-article))
2050 (setcdr data (cons (gnus-data-make number mark pos header level)
2052 (setq gnus-newsgroup-data-reverse nil)
2053 (gnus-data-update-list (cddr data) offset)))
2055 (defun gnus-data-enter-list (after-article list &optional offset)
2057 (let ((data (and after-article (gnus-data-find-list after-article)))
2059 (or data (not after-article) (error "No such article: %d" after-article))
2060 ;; Find the last element in the list to be spliced into the main
2063 (setq list (cdr list)))
2066 (setcdr list gnus-newsgroup-data)
2067 (setq gnus-newsgroup-data ilist)
2069 (gnus-data-update-list (cdr list) offset)))
2070 (setcdr list (cdr data))
2073 (gnus-data-update-list (cdr list) offset)))
2074 (setq gnus-newsgroup-data-reverse nil))))
2076 (defun gnus-data-remove (article &optional offset)
2077 (let ((data gnus-newsgroup-data))
2078 (if (= (gnus-data-number (car data)) article)
2080 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2081 gnus-newsgroup-data-reverse nil)
2083 (gnus-data-update-list gnus-newsgroup-data offset)))
2085 (when (= (gnus-data-number (cadr data)) article)
2086 (setcdr data (cddr data))
2088 (gnus-data-update-list (cdr data) offset))
2090 gnus-newsgroup-data-reverse nil))
2091 (setq data (cdr data))))))
2093 (defmacro gnus-data-list (backward)
2095 (or gnus-newsgroup-data-reverse
2096 (setq gnus-newsgroup-data-reverse
2097 (reverse gnus-newsgroup-data)))
2098 gnus-newsgroup-data))
2100 (defun gnus-data-update-list (data offset)
2101 "Add OFFSET to the POS of all data entries in DATA."
2103 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2104 (setq data (cdr data))))
2106 (defun gnus-data-compute-positions ()
2107 "Compute the positions of all articles."
2108 (let ((data gnus-newsgroup-data)
2111 (when (setq pos (text-property-any
2112 (point-min) (point-max)
2113 'gnus-number (gnus-data-number (car data))))
2114 (gnus-data-set-pos (car data) (+ pos 3)))
2115 (setq data (cdr data)))))
2117 (defun gnus-summary-article-pseudo-p (article)
2118 "Say whether this article is a pseudo article or not."
2119 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2121 (defmacro gnus-summary-article-sparse-p (article)
2122 "Say whether this article is a sparse article or not."
2123 `(memq ,article gnus-newsgroup-sparse))
2125 (defmacro gnus-summary-article-ancient-p (article)
2126 "Say whether this article is a sparse article or not."
2127 `(memq ,article gnus-newsgroup-ancient))
2129 (defun gnus-article-parent-p (number)
2130 "Say whether this article is a parent or not."
2131 (let ((data (gnus-data-find-list number)))
2132 (and (cdr data) ; There has to be an article after...
2133 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2134 (gnus-data-level (nth 1 data))))))
2136 (defun gnus-article-children (number)
2137 "Return a list of all children to NUMBER."
2138 (let* ((data (gnus-data-find-list number))
2139 (level (gnus-data-level (car data)))
2141 (setq data (cdr data))
2143 (= (gnus-data-level (car data)) (1+ level)))
2144 (push (gnus-data-number (car data)) children)
2145 (setq data (cdr data)))
2148 (defmacro gnus-summary-skip-intangible ()
2149 "If the current article is intangible, then jump to a different article."
2150 '(let ((to (get-text-property (point) 'gnus-intangible)))
2151 (and to (gnus-summary-goto-subject to))))
2153 (defmacro gnus-summary-article-intangible-p ()
2154 "Say whether this article is intangible or not."
2155 '(get-text-property (point) 'gnus-intangible))
2157 (defun gnus-article-read-p (article)
2158 "Say whether ARTICLE is read or not."
2159 (not (or (memq article gnus-newsgroup-marked)
2160 (memq article gnus-newsgroup-unreads)
2161 (memq article gnus-newsgroup-unselected)
2162 (memq article gnus-newsgroup-dormant))))
2164 ;; Some summary mode macros.
2166 (defmacro gnus-summary-article-number ()
2167 "The article number of the article on the current line.
2168 If there isn's an article number here, then we return the current
2171 (gnus-summary-skip-intangible)
2172 (or (get-text-property (point) 'gnus-number)
2173 (gnus-summary-last-subject))))
2175 (defmacro gnus-summary-article-header (&optional number)
2176 "Return the header of article NUMBER."
2177 `(gnus-data-header (gnus-data-find
2178 ,(or number '(gnus-summary-article-number)))))
2180 (defmacro gnus-summary-thread-level (&optional number)
2181 "Return the level of thread that starts with article NUMBER."
2182 `(if (and (eq gnus-summary-make-false-root 'dummy)
2183 (get-text-property (point) 'gnus-intangible))
2185 (gnus-data-level (gnus-data-find
2186 ,(or number '(gnus-summary-article-number))))))
2188 (defmacro gnus-summary-article-mark (&optional number)
2189 "Return the mark of article NUMBER."
2190 `(gnus-data-mark (gnus-data-find
2191 ,(or number '(gnus-summary-article-number)))))
2193 (defmacro gnus-summary-article-pos (&optional number)
2194 "Return the position of the line of article NUMBER."
2195 `(gnus-data-pos (gnus-data-find
2196 ,(or number '(gnus-summary-article-number)))))
2198 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2199 (defmacro gnus-summary-article-subject (&optional number)
2200 "Return current subject string or nil if nothing."
2203 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2204 '(gnus-data-header (assq (gnus-summary-article-number)
2205 gnus-newsgroup-data)))))
2208 (mail-header-subject headers))))
2210 (defmacro gnus-summary-article-score (&optional number)
2211 "Return current article score."
2212 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2213 gnus-newsgroup-scored))
2214 gnus-summary-default-score 0))
2216 (defun gnus-summary-article-children (&optional number)
2217 "Return a list of article numbers that are children of article NUMBER."
2218 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2219 (level (gnus-data-level (car data)))
2221 (while (and (setq data (cdr data))
2222 (> (setq l (gnus-data-level (car data))) level))
2223 (and (= (1+ level) l)
2224 (push (gnus-data-number (car data))
2226 (nreverse children)))
2228 (defun gnus-summary-article-parent (&optional number)
2229 "Return the article number of the parent of article NUMBER."
2230 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2231 (gnus-data-list t)))
2232 (level (gnus-data-level (car data))))
2234 () ; This is a root.
2235 ;; We search until we find an article with a level less than
2236 ;; this one. That function has to be the parent.
2237 (while (and (setq data (cdr data))
2238 (not (< (gnus-data-level (car data)) level))))
2239 (and data (gnus-data-number (car data))))))
2241 (defun gnus-unread-mark-p (mark)
2242 "Say whether MARK is the unread mark."
2243 (= mark gnus-unread-mark))
2245 (defun gnus-read-mark-p (mark)
2246 "Say whether MARK is one of the marks that mark as read.
2247 This is all marks except unread, ticked, dormant, and expirable."
2248 (not (or (= mark gnus-unread-mark)
2249 (= mark gnus-ticked-mark)
2250 (= mark gnus-dormant-mark)
2251 (= mark gnus-expirable-mark))))
2253 (defmacro gnus-article-mark (number)
2254 "Return the MARK of article NUMBER.
2255 This macro should only be used when computing the mark the \"first\"
2256 time; i.e., when generating the summary lines. After that,
2257 `gnus-summary-article-mark' should be used to examine the
2260 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2261 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2262 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2263 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2264 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2265 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2266 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2267 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2268 gnus-ancient-mark))))
2270 ;; Saving hidden threads.
2272 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2273 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2275 (defmacro gnus-save-hidden-threads (&rest forms)
2276 "Save hidden threads, eval FORMS, and restore the hidden threads."
2277 (let ((config (make-symbol "config")))
2278 `(let ((,config (gnus-hidden-threads-configuration)))
2282 (gnus-restore-hidden-threads-configuration ,config)))))
2284 (defun gnus-hidden-threads-configuration ()
2285 "Return the current hidden threads configuration."
2288 (goto-char (point-min))
2289 (while (search-forward "\r" nil t)
2290 (push (1- (point)) config))
2293 (defun gnus-restore-hidden-threads-configuration (config)
2294 "Restore hidden threads configuration from CONFIG."
2295 (let (point buffer-read-only)
2296 (while (setq point (pop config))
2297 (when (and (< point (point-max))
2299 (= (following-char) ?\n))
2300 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2302 ;; Various summary mode internalish functions.
2304 (defun gnus-mouse-pick-article (e)
2307 (gnus-summary-next-page nil t))
2309 (defun gnus-summary-set-display-table ()
2310 ;; Change the display table. Odd characters have a tendency to mess
2311 ;; up nicely formatted displays - we make all possible glyphs
2312 ;; display only a single character.
2314 ;; We start from the standard display table, if any.
2315 (let ((table (or (copy-sequence standard-display-table)
2316 (make-display-table)))
2318 ;; Nix out all the control chars...
2319 (while (>= (setq i (1- i)) 0)
2320 (aset table i [??]))
2321 ;; ... but not newline and cr, of course. (cr is necessary for the
2322 ;; selective display).
2323 (aset table ?\n nil)
2324 (aset table ?\r nil)
2325 ;; We keep TAB as well.
2326 (aset table ?\t nil)
2327 ;; We nix out any glyphs over 126 that are not set already.
2329 (while (>= (setq i (1- i)) 127)
2330 ;; Only modify if the entry is nil.
2331 (unless (aref table i)
2332 (aset table i [??]))))
2333 (setq buffer-display-table table)))
2335 (defun gnus-summary-setup-buffer (group)
2336 "Initialize summary buffer."
2337 (let ((buffer (concat "*Summary " group "*")))
2338 (if (get-buffer buffer)
2341 (setq gnus-summary-buffer (current-buffer))
2342 (not gnus-newsgroup-prepared))
2343 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2344 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2345 (gnus-add-current-to-buffer-list)
2346 (gnus-summary-mode group)
2348 (gnus-carpal-setup-buffer 'summary))
2349 (unless gnus-single-article-buffer
2350 (make-local-variable 'gnus-article-buffer)
2351 (make-local-variable 'gnus-article-current)
2352 (make-local-variable 'gnus-original-article-buffer))
2353 (setq gnus-newsgroup-name group)
2356 (defun gnus-set-global-variables ()
2357 ;; Set the global equivalents of the summary buffer-local variables
2358 ;; to the latest values they had. These reflect the summary buffer
2359 ;; that was in action when the last article was fetched.
2360 (when (eq major-mode 'gnus-summary-mode)
2361 (setq gnus-summary-buffer (current-buffer))
2362 (let ((name gnus-newsgroup-name)
2363 (marked gnus-newsgroup-marked)
2364 (unread gnus-newsgroup-unreads)
2365 (headers gnus-current-headers)
2366 (data gnus-newsgroup-data)
2367 (summary gnus-summary-buffer)
2368 (article-buffer gnus-article-buffer)
2369 (original gnus-original-article-buffer)
2370 (gac gnus-article-current)
2371 (reffed gnus-reffed-article-number)
2372 (score-file gnus-current-score-file))
2374 (set-buffer gnus-group-buffer)
2375 (setq gnus-newsgroup-name name
2376 gnus-newsgroup-marked marked
2377 gnus-newsgroup-unreads unread
2378 gnus-current-headers headers
2379 gnus-newsgroup-data data
2380 gnus-article-current gac
2381 gnus-summary-buffer summary
2382 gnus-article-buffer article-buffer
2383 gnus-original-article-buffer original
2384 gnus-reffed-article-number reffed
2385 gnus-current-score-file score-file)
2386 ;; The article buffer also has local variables.
2387 (when (gnus-buffer-live-p gnus-article-buffer)
2388 (set-buffer gnus-article-buffer)
2389 (setq gnus-summary-buffer summary))))))
2391 (defun gnus-summary-article-unread-p (article)
2392 "Say whether ARTICLE is unread or not."
2393 (memq article gnus-newsgroup-unreads))
2395 (defun gnus-summary-first-article-p (&optional article)
2396 "Return whether ARTICLE is the first article in the buffer."
2397 (if (not (setq article (or article (gnus-summary-article-number))))
2399 (eq article (caar gnus-newsgroup-data))))
2401 (defun gnus-summary-last-article-p (&optional article)
2402 "Return whether ARTICLE is the last article in the buffer."
2403 (if (not (setq article (or article (gnus-summary-article-number))))
2404 t ; All non-existent numbers are the last article. :-)
2405 (not (cdr (gnus-data-find-list article)))))
2407 (defun gnus-make-thread-indent-array ()
2409 (unless (and gnus-thread-indent-array
2410 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2411 (setq gnus-thread-indent-array (make-vector 201 "")
2412 gnus-thread-indent-array-level gnus-thread-indent-level)
2414 (aset gnus-thread-indent-array n
2415 (make-string (* n gnus-thread-indent-level) ? ))
2418 (defun gnus-update-summary-mark-positions ()
2419 "Compute where the summary marks are to go."
2421 (when (and gnus-summary-buffer
2422 (get-buffer gnus-summary-buffer)
2423 (buffer-name (get-buffer gnus-summary-buffer)))
2424 (set-buffer gnus-summary-buffer))
2425 (let ((gnus-replied-mark 129)
2426 (gnus-score-below-mark 130)
2427 (gnus-score-over-mark 130)
2428 (gnus-download-mark 131)
2429 (spec gnus-summary-line-format-spec)
2430 thread gnus-visual pos)
2432 (gnus-set-work-buffer)
2433 (let ((gnus-summary-line-format-spec spec)
2434 (gnus-newsgroup-downloadable '((0 . t))))
2435 (gnus-summary-insert-line
2436 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2437 (goto-char (point-min))
2438 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2440 (goto-char (point-min))
2441 (push (cons 'replied (and (search-forward "\201" nil t)
2444 (goto-char (point-min))
2445 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2447 (goto-char (point-min))
2448 (push (cons 'download
2449 (and (search-forward "\203" nil t) (- (point) 2)))
2451 (setq gnus-summary-mark-positions pos))))
2453 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2454 "Insert a dummy root in the summary buffer."
2456 (gnus-add-text-properties
2457 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2458 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2460 (defun gnus-summary-insert-line (gnus-tmp-header
2461 gnus-tmp-level gnus-tmp-current
2462 gnus-tmp-unread gnus-tmp-replied
2463 gnus-tmp-expirable gnus-tmp-subject-or-nil
2464 &optional gnus-tmp-dummy gnus-tmp-score
2466 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2467 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2468 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2469 (gnus-tmp-score-char
2470 (if (or (null gnus-summary-default-score)
2471 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2472 gnus-summary-zcore-fuzz))
2474 (if (< gnus-tmp-score gnus-summary-default-score)
2475 gnus-score-below-mark gnus-score-over-mark)))
2477 (cond (gnus-tmp-process gnus-process-mark)
2478 ((memq gnus-tmp-current gnus-newsgroup-cached)
2480 (gnus-tmp-replied gnus-replied-mark)
2481 ((memq gnus-tmp-current gnus-newsgroup-saved)
2483 (t gnus-unread-mark)))
2484 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2487 ((string-match "<[^>]+> *$" gnus-tmp-from)
2488 (let ((beg (match-beginning 0)))
2489 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2490 (substring gnus-tmp-from (1+ (match-beginning 0))
2491 (1- (match-end 0))))
2492 (substring gnus-tmp-from 0 beg))))
2493 ((string-match "(.+)" gnus-tmp-from)
2494 (substring gnus-tmp-from
2495 (1+ (match-beginning 0)) (1- (match-end 0))))
2497 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2498 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2499 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2500 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2501 (buffer-read-only nil))
2502 (when (string= gnus-tmp-name "")
2503 (setq gnus-tmp-name gnus-tmp-from))
2504 (unless (numberp gnus-tmp-lines)
2505 (setq gnus-tmp-lines 0))
2506 (gnus-put-text-property
2508 (progn (eval gnus-summary-line-format-spec) (point))
2509 'gnus-number gnus-tmp-number)
2510 (when (gnus-visual-p 'summary-highlight 'highlight)
2512 (run-hooks 'gnus-summary-update-hook)
2515 (defun gnus-summary-update-line (&optional dont-update)
2516 ;; Update summary line after change.
2517 (when (and gnus-summary-default-score
2518 (not gnus-summary-inhibit-highlight))
2519 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2520 (article (gnus-summary-article-number))
2521 (score (gnus-summary-article-score article)))
2523 (if (and gnus-summary-mark-below
2524 (< (gnus-summary-article-score)
2525 gnus-summary-mark-below))
2526 ;; This article has a low score, so we mark it as read.
2527 (when (memq article gnus-newsgroup-unreads)
2528 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2529 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2530 ;; This article was previously marked as read on account
2531 ;; of a low score, but now it has risen, so we mark it as
2533 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2534 (gnus-summary-update-mark
2535 (if (or (null gnus-summary-default-score)
2536 (<= (abs (- score gnus-summary-default-score))
2537 gnus-summary-zcore-fuzz))
2539 (if (< score gnus-summary-default-score)
2540 gnus-score-below-mark gnus-score-over-mark))
2542 ;; Do visual highlighting.
2543 (when (gnus-visual-p 'summary-highlight 'highlight)
2544 (run-hooks 'gnus-summary-update-hook)))))
2546 (defvar gnus-tmp-new-adopts nil)
2548 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2549 "Return the number of articles in THREAD.
2550 This may be 0 in some cases -- if none of the articles in
2551 the thread are to be displayed."
2553 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2555 ((not (listp thread))
2557 ((and (consp thread) (cdr thread))
2560 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2563 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2566 (when (and level (zerop level) gnus-tmp-new-adopts)
2569 'gnus-summary-number-of-articles-in-thread
2570 gnus-tmp-new-adopts))))
2572 (if (> number 1) gnus-not-empty-thread-mark
2573 gnus-empty-thread-mark)
2576 (defun gnus-summary-set-local-parameters (group)
2577 "Go through the local params of GROUP and set all variable specs in that list."
2578 (let ((params (gnus-group-find-parameter group))
2581 (setq elem (car params)
2582 params (cdr params))
2583 (and (consp elem) ; Has to be a cons.
2584 (consp (cdr elem)) ; The cdr has to be a list.
2585 (symbolp (car elem)) ; Has to be a symbol in there.
2586 (not (memq (car elem)
2587 '(quit-config to-address to-list to-group)))
2588 (ignore-errors ; So we set it.
2589 (make-local-variable (car elem))
2590 (set (car elem) (eval (nth 1 elem))))))))
2592 (defun gnus-summary-read-group (group &optional show-all no-article
2593 kill-buffer no-display)
2594 "Start reading news in newsgroup GROUP.
2595 If SHOW-ALL is non-nil, already read articles are also listed.
2596 If NO-ARTICLE is non-nil, no article is selected initially.
2597 If NO-DISPLAY, don't generate a summary buffer."
2601 (let ((gnus-auto-select-next nil))
2602 (or (gnus-summary-read-group-1
2603 group show-all no-article
2604 kill-buffer no-display)
2605 (setq show-all nil)))))
2606 (eq gnus-auto-select-next 'quietly))
2607 (set-buffer gnus-group-buffer)
2608 (if (not (equal group (gnus-group-group-name)))
2609 (setq group (gnus-group-group-name))
2613 (defun gnus-summary-read-group-1 (group show-all no-article
2614 kill-buffer no-display)
2615 ;; Killed foreign groups can't be entered.
2616 (when (and (not (gnus-group-native-p group))
2617 (not (gnus-gethash group gnus-newsrc-hashtb)))
2618 (error "Dead non-native groups can't be entered"))
2619 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2620 (let* ((new-group (gnus-summary-setup-buffer group))
2621 (quit-config (gnus-group-quit-config group))
2622 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2624 ;; This summary buffer exists already, so we just select it.
2626 (gnus-set-global-variables)
2628 (gnus-kill-or-deaden-summary kill-buffer))
2629 (gnus-configure-windows 'summary 'force)
2630 (gnus-set-mode-line 'summary)
2631 (gnus-summary-position-point)
2634 ;; We couldn't select this group.
2636 (when (and (eq major-mode 'gnus-summary-mode)
2637 (not (equal (current-buffer) kill-buffer)))
2638 (kill-buffer (current-buffer))
2639 (if (not quit-config)
2641 ;; Update the info -- marks might need to be removed,
2643 (gnus-summary-update-info)
2644 (set-buffer gnus-group-buffer)
2645 (gnus-group-jump-to-group group)
2646 (gnus-group-next-unread-group 1))
2647 (gnus-handle-ephemeral-exit quit-config)))
2648 (gnus-message 3 "Can't select group")
2650 ;; The user did a `C-g' while prompting for number of articles,
2651 ;; so we exit this group.
2652 ((eq did-select 'quit)
2653 (and (eq major-mode 'gnus-summary-mode)
2654 (not (equal (current-buffer) kill-buffer))
2655 (kill-buffer (current-buffer)))
2657 (gnus-kill-or-deaden-summary kill-buffer))
2658 (if (not quit-config)
2660 (set-buffer gnus-group-buffer)
2661 (gnus-group-jump-to-group group)
2662 (gnus-group-next-unread-group 1)
2663 (gnus-configure-windows 'group 'force))
2664 (gnus-handle-ephemeral-exit quit-config))
2665 ;; Finally signal the quit.
2667 ;; The group was successfully selected.
2669 (gnus-set-global-variables)
2670 ;; Save the active value in effect when the group was entered.
2671 (setq gnus-newsgroup-active
2673 (gnus-active gnus-newsgroup-name)))
2674 ;; You can change the summary buffer in some way with this hook.
2675 (run-hooks 'gnus-select-group-hook)
2676 ;; Set any local variables in the group parameters.
2677 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2678 (gnus-update-format-specifications
2679 nil 'summary 'summary-mode 'summary-dummy)
2680 ;; Do score processing.
2681 (when gnus-use-scoring
2682 (gnus-possibly-score-headers))
2683 ;; Check whether to fill in the gaps in the threads.
2684 (when gnus-build-sparse-threads
2685 (gnus-build-sparse-threads))
2686 ;; Find the initial limit.
2687 (if gnus-show-threads
2689 (let ((gnus-newsgroup-dormant nil))
2690 (gnus-summary-initial-limit show-all))
2691 (gnus-summary-initial-limit show-all))
2692 (setq gnus-newsgroup-limit
2694 (lambda (header) (mail-header-number header))
2695 gnus-newsgroup-headers)))
2696 ;; Generate the summary buffer.
2698 (gnus-summary-prepare))
2699 (when gnus-use-trees
2700 (gnus-tree-open group)
2701 (setq gnus-summary-highlight-line-function
2702 'gnus-tree-highlight-article))
2703 ;; If the summary buffer is empty, but there are some low-scored
2704 ;; articles or some excluded dormants, we include these in the
2706 (when (and (zerop (buffer-size))
2708 (cond (gnus-newsgroup-dormant
2709 (gnus-summary-limit-include-dormant))
2710 ((and gnus-newsgroup-scored show-all)
2711 (gnus-summary-limit-include-expunged t))))
2712 ;; Function `gnus-apply-kill-file' must be called in this hook.
2713 (run-hooks 'gnus-apply-kill-hook)
2714 (if (and (zerop (buffer-size))
2717 ;; This newsgroup is empty.
2718 (gnus-summary-catchup-and-exit nil t)
2719 (gnus-message 6 "No unread news")
2721 (gnus-kill-or-deaden-summary kill-buffer))
2722 ;; Return nil from this function.
2724 ;; Hide conversation thread subtrees. We cannot do this in
2725 ;; gnus-summary-prepare-hook since kill processing may not
2726 ;; work with hidden articles.
2727 (and gnus-show-threads
2728 gnus-thread-hide-subtree
2729 (gnus-summary-hide-all-threads))
2731 (gnus-kill-or-deaden-summary kill-buffer))
2732 ;; Show first unread article if requested.
2733 (if (and (not no-article)
2735 gnus-newsgroup-unreads
2736 gnus-auto-select-first)
2737 (unless (if (eq gnus-auto-select-first 'best)
2738 (gnus-summary-best-unread-article)
2739 (gnus-summary-first-unread-article))
2740 (gnus-configure-windows 'summary))
2741 ;; Don't select any articles, just move point to the first
2742 ;; article in the group.
2743 (goto-char (point-min))
2744 (gnus-summary-position-point)
2745 (gnus-configure-windows 'summary 'force)
2746 (gnus-set-mode-line 'summary))
2747 (when (get-buffer-window gnus-group-buffer t)
2748 ;; Gotta use windows, because recenter does weird stuff if
2749 ;; the current buffer ain't the displayed window.
2750 (let ((owin (selected-window)))
2751 (select-window (get-buffer-window gnus-group-buffer t))
2752 (when (gnus-group-goto-group group)
2754 (select-window owin)))
2755 ;; Mark this buffer as "prepared".
2756 (setq gnus-newsgroup-prepared t)
2757 (run-hooks 'gnus-summary-prepared-hook)
2760 (defun gnus-summary-prepare ()
2761 "Generate the summary buffer."
2763 (let ((buffer-read-only nil))
2765 (setq gnus-newsgroup-data nil
2766 gnus-newsgroup-data-reverse nil)
2767 (run-hooks 'gnus-summary-generate-hook)
2768 ;; Generate the buffer, either with threads or without.
2769 (when gnus-newsgroup-headers
2770 (gnus-summary-prepare-threads
2771 (if gnus-show-threads
2772 (gnus-sort-gathered-threads
2773 (funcall gnus-summary-thread-gathering-function
2775 (gnus-cut-threads (gnus-make-threads)))))
2776 ;; Unthreaded display.
2777 (gnus-sort-articles gnus-newsgroup-headers))))
2778 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2779 ;; Call hooks for modifying summary buffer.
2780 (goto-char (point-min))
2781 (run-hooks 'gnus-summary-prepare-hook)))
2783 (defsubst gnus-general-simplify-subject (subject)
2784 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2787 ;; Truncate the subject.
2788 (gnus-simplify-subject-functions
2789 (gnus-map-function gnus-simplify-subject-functions subject))
2790 ((numberp gnus-summary-gather-subject-limit)
2791 (setq subject (gnus-simplify-subject-re subject))
2792 (if (> (length subject) gnus-summary-gather-subject-limit)
2793 (substring subject 0 gnus-summary-gather-subject-limit)
2795 ;; Fuzzily simplify it.
2796 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2797 (gnus-simplify-subject-fuzzy subject))
2798 ;; Just remove the leading "Re:".
2800 (gnus-simplify-subject-re subject))))
2802 (if (and gnus-summary-gather-exclude-subject
2803 (string-match gnus-summary-gather-exclude-subject subject))
2804 nil ; This article shouldn't be gathered
2807 (defun gnus-summary-simplify-subject-query ()
2808 "Query where the respool algorithm would put this article."
2810 (gnus-summary-select-article)
2811 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2813 (defun gnus-gather-threads-by-subject (threads)
2814 "Gather threads by looking at Subject headers."
2815 (if (not gnus-summary-make-false-root)
2817 (let ((hashtb (gnus-make-hashtable 1024))
2820 subject hthread whole-subject)
2822 (setq subject (gnus-general-simplify-subject
2823 (setq whole-subject (mail-header-subject
2826 (if (setq hthread (gnus-gethash subject hashtb))
2828 ;; We enter a dummy root into the thread, if we
2829 ;; haven't done that already.
2830 (unless (stringp (caar hthread))
2831 (setcar hthread (list whole-subject (car hthread))))
2832 ;; We add this new gathered thread to this gathered
2834 (setcdr (car hthread)
2835 (nconc (cdar hthread) (list (car threads))))
2836 ;; Remove it from the list of threads.
2837 (setcdr prev (cdr threads))
2838 (setq threads prev))
2839 ;; Enter this thread into the hash table.
2840 (gnus-sethash subject threads hashtb)))
2842 (setq threads (cdr threads)))
2845 (defun gnus-gather-threads-by-references (threads)
2846 "Gather threads by looking at References headers."
2847 (let ((idhashtb (gnus-make-hashtable 1024))
2848 (thhashtb (gnus-make-hashtable 1024))
2851 ids references id gthread gid entered ref)
2853 (when (setq references (mail-header-references (caar threads)))
2854 (setq id (mail-header-id (caar threads))
2855 ids (gnus-split-references references)
2857 (while (setq ref (pop ids))
2858 (setq ids (delete ref ids))
2859 (if (not (setq gid (gnus-gethash ref idhashtb)))
2861 (gnus-sethash ref id idhashtb)
2862 (gnus-sethash id threads thhashtb))
2863 (setq gthread (gnus-gethash gid thhashtb))
2865 ;; We enter a dummy root into the thread, if we
2866 ;; haven't done that already.
2867 (unless (stringp (caar gthread))
2868 (setcar gthread (list (mail-header-subject (caar gthread))
2870 ;; We add this new gathered thread to this gathered
2872 (setcdr (car gthread)
2873 (nconc (cdar gthread) (list (car threads)))))
2874 ;; Add it into the thread hash table.
2875 (gnus-sethash id gthread thhashtb)
2877 ;; Remove it from the list of threads.
2878 (setcdr prev (cdr threads))
2879 (setq threads prev))))
2881 (setq threads (cdr threads)))
2884 (defun gnus-sort-gathered-threads (threads)
2885 "Sort subtreads inside each gathered thread by article number."
2886 (let ((result threads))
2888 (when (stringp (caar threads))
2889 (setcdr (car threads)
2890 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2891 (setq threads (cdr threads)))
2894 (defun gnus-thread-loop-p (root thread)
2895 "Say whether ROOT is in THREAD."
2896 (let ((stack (list thread))
2899 (while (setq thread (pop stack))
2900 (setq th (cdr thread))
2902 (not (eq (caar th) root)))
2905 ;; We have found a loop.
2907 (setcdr thread (delq (car th) (cdr thread)))
2908 (if (boundp (setq ref-dep (intern "none"
2909 gnus-newsgroup-dependencies)))
2910 (setcdr (symbol-value ref-dep)
2911 (nconc (cdr (symbol-value ref-dep))
2913 (set ref-dep (list nil (car th))))
2916 ;; Push all the subthreads onto the stack.
2917 (push (cdr thread) stack)))
2920 (defun gnus-make-threads ()
2921 "Go through the dependency hashtb and find the roots. Return all threads."
2923 (while (catch 'infloop
2926 ;; Deal with self-referencing References loops.
2927 (when (and (car (symbol-value refs))
2934 (car (symbol-value refs)) thread))
2935 (cdr (symbol-value refs)))))))
2938 (unless (car (symbol-value refs))
2939 ;; These threads do not refer back to any other articles,
2940 ;; so they're roots.
2941 (setq threads (append (cdr (symbol-value refs)) threads))))
2942 gnus-newsgroup-dependencies)))
2945 (defun gnus-build-sparse-threads ()
2946 (let ((headers gnus-newsgroup-headers)
2947 (deps gnus-newsgroup-dependencies)
2948 header references generation relations
2949 cthread subject child end pthread relation new-child)
2950 ;; First we create an alist of generations/relations, where
2951 ;; generations is how much we trust the relation, and the relation
2953 (gnus-message 7 "Making sparse threads...")
2955 (nnheader-set-temp-buffer " *gnus sparse threads*")
2956 (while (setq header (pop headers))
2957 (when (and (setq references (mail-header-references header))
2958 (not (string= references "")))
2960 (setq child (mail-header-id header)
2961 subject (mail-header-subject header))
2963 (while (search-backward ">" nil t)
2964 (setq end (1+ (point)))
2965 (when (search-backward "<" nil t)
2966 (unless (string= (setq new-child (buffer-substring (point) end))
2968 (push (list (incf generation)
2969 child (setq child new-child)
2972 (push (list (1+ generation) child nil subject) relations)
2974 (kill-buffer (current-buffer)))
2975 ;; Sort over trustworthiness.
2976 (setq relations (sort relations 'car-less-than-car))
2977 (while (setq relation (pop relations))
2978 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2979 (unless (car (symbol-value cthread))
2980 ;; Make this article the parent of these threads.
2981 (setcar (symbol-value cthread)
2982 (vector gnus-reffed-article-number
2986 (or (caddr relation) "") 0 0 "")))
2987 (set cthread (list (vector gnus-reffed-article-number
2989 "" "" (cadr relation)
2990 (or (caddr relation) "") 0 0 ""))))
2991 (push gnus-reffed-article-number gnus-newsgroup-limit)
2992 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2993 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2994 gnus-newsgroup-reads)
2995 (decf gnus-reffed-article-number)
2996 ;; Make this new thread the child of its parent.
2997 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2998 (setcdr (symbol-value pthread)
2999 (nconc (cdr (symbol-value pthread))
3000 (list (symbol-value cthread))))
3001 (set pthread (list nil (symbol-value cthread))))))
3002 (gnus-message 7 "Making sparse threads...done")))
3004 (defun gnus-build-old-threads ()
3005 ;; Look at all the articles that refer back to old articles, and
3006 ;; fetch the headers for the articles that aren't there. This will
3007 ;; build complete threads - if the roots haven't been expired by the
3012 (when (not (car (symbol-value refs)))
3013 (setq heads (cdr (symbol-value refs)))
3015 (if (memq (mail-header-number (caar heads))
3016 gnus-newsgroup-dormant)
3017 (setq heads (cdr heads))
3018 (setq id (symbol-name refs))
3019 (while (and (setq id (gnus-build-get-header id))
3020 (not (car (gnus-gethash
3021 id gnus-newsgroup-dependencies)))))
3022 (setq heads nil)))))
3023 gnus-newsgroup-dependencies)))
3025 (defun gnus-build-get-header (id)
3026 ;; Look through the buffer of NOV lines and find the header to
3027 ;; ID. Enter this line into the dependencies hash table, and return
3028 ;; the id of the parent article (if any).
3029 (let ((deps gnus-newsgroup-dependencies)
3033 (set-buffer nntp-server-buffer)
3034 (let ((case-fold-search nil))
3035 (goto-char (point-min))
3036 (while (and (not found)
3037 (search-forward id nil t))
3039 (setq found (looking-at
3040 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3041 (regexp-quote id))))
3042 (or found (beginning-of-line 2)))
3046 (setq header (gnus-nov-parse-line
3047 (read (current-buffer)) deps))
3048 (gnus-parent-id (mail-header-references header))))))
3050 (let ((number (mail-header-number header)))
3051 (push number gnus-newsgroup-limit)
3052 (push header gnus-newsgroup-headers)
3053 (if (memq number gnus-newsgroup-unselected)
3055 (push number gnus-newsgroup-unreads)
3056 (setq gnus-newsgroup-unselected
3057 (delq number gnus-newsgroup-unselected)))
3058 (push number gnus-newsgroup-ancient)))))))
3060 (defun gnus-build-all-threads ()
3061 "Read all the headers."
3062 (let ((deps gnus-newsgroup-dependencies)
3063 (gnus-summary-ignore-duplicates t)
3064 found header article)
3066 (set-buffer nntp-server-buffer)
3067 (let ((case-fold-search nil))
3068 (goto-char (point-min))
3071 (setq article (read (current-buffer)))
3072 (setq header (gnus-nov-parse-line article deps)))
3074 (push header gnus-newsgroup-headers)
3075 (if (memq (setq article (mail-header-number header))
3076 gnus-newsgroup-unselected)
3078 (push article gnus-newsgroup-unreads)
3079 (setq gnus-newsgroup-unselected
3080 (delq article gnus-newsgroup-unselected)))
3081 (push article gnus-newsgroup-ancient))
3082 (forward-line 1)))))))
3084 (defun gnus-summary-update-article-line (article header)
3085 "Update the line for ARTICLE using HEADERS."
3086 (let* ((id (mail-header-id header))
3087 (thread (gnus-id-to-thread id)))
3089 (error "Article in no thread"))
3090 ;; Update the thread.
3091 (setcar thread header)
3092 (gnus-summary-goto-subject article)
3093 (let* ((datal (gnus-data-find-list article))
3095 (length (when (cdr datal)
3096 (- (gnus-data-pos data)
3097 (gnus-data-pos (cadr datal)))))
3098 (buffer-read-only nil)
3099 (level (gnus-summary-thread-level)))
3101 (gnus-summary-insert-line
3102 header level nil (gnus-article-mark article)
3103 (memq article gnus-newsgroup-replied)
3104 (memq article gnus-newsgroup-expirable)
3105 ;; Only insert the Subject string when it's different
3106 ;; from the previous Subject string.
3107 (if (gnus-subject-equal
3109 (mail-header-subject
3112 (gnus-data-find-list
3114 (gnus-data-list t)))))
3115 ;; Error on the side of excessive subjects.
3117 (mail-header-subject header))
3119 (mail-header-subject header))
3120 nil (cdr (assq article gnus-newsgroup-scored))
3121 (memq article gnus-newsgroup-processable))
3123 (gnus-data-update-list
3124 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3126 (defun gnus-summary-update-article (article &optional iheader)
3127 "Update ARTICLE in the summary buffer."
3128 (set-buffer gnus-summary-buffer)
3129 (let* ((header (or iheader (gnus-summary-article-header article)))
3130 (id (mail-header-id header))
3131 (data (gnus-data-find article))
3132 (thread (gnus-id-to-thread id))
3133 (references (mail-header-references header))
3137 (when (and references
3138 (not (equal "" references)))
3141 (buffer-read-only nil)
3143 (number (mail-header-number header))
3146 ;; !!! Should this be in or not?
3148 (setcar thread nil))
3150 (delq thread parent))
3151 (if (gnus-summary-insert-subject id header iheader)
3152 ;; Set the (possibly) new article number in the data structure.
3153 (gnus-data-set-number data (gnus-id-to-article id))
3157 (defun gnus-rebuild-thread (id)
3158 "Rebuild the thread containing ID."
3159 (let ((buffer-read-only nil)
3160 old-pos current thread data)
3161 (if (not gnus-show-threads)
3162 (setq thread (list (car (gnus-id-to-thread id))))
3163 ;; Get the thread this article is part of.
3164 (setq thread (gnus-remove-thread id)))
3165 (setq old-pos (gnus-point-at-bol))
3166 (setq current (save-excursion
3167 (and (zerop (forward-line -1))
3168 (gnus-summary-article-number))))
3169 ;; If this is a gathered thread, we have to go some re-gathering.
3170 (when (stringp (car thread))
3171 (let ((subject (car thread))
3173 (setq thread (cdr thread))
3175 (unless (memq (setq thr (gnus-id-to-thread
3177 (mail-header-id (caar thread)))))
3180 (setq thread (cdr thread)))
3181 ;; We now have all (unique) roots.
3182 (if (= (length roots) 1)
3183 ;; All the loose roots are now one solid root.
3184 (setq thread (car roots))
3185 (setq thread (cons subject (gnus-sort-threads roots))))))
3187 ;; We then insert this thread into the summary buffer.
3188 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3189 (if gnus-show-threads
3190 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3191 (gnus-summary-prepare-unthreaded thread))
3192 (setq data (nreverse gnus-newsgroup-data))
3193 (setq threads gnus-newsgroup-threads))
3194 ;; We splice the new data into the data structure.
3195 (gnus-data-enter-list current data (- (point) old-pos))
3196 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3198 (defun gnus-number-to-header (number)
3199 "Return the header for article NUMBER."
3200 (let ((headers gnus-newsgroup-headers))
3202 (not (= number (mail-header-number (car headers)))))
3207 (defun gnus-parent-headers (headers &optional generation)
3208 "Return the headers of the GENERATIONeth parent of HEADERS."
3210 (setq generation 1))
3213 (while (and parent headers (not (zerop generation)))
3214 (setq references (mail-header-references headers))
3215 (when (and references
3216 (setq parent (gnus-parent-id references))
3217 (setq headers (car (gnus-id-to-thread parent))))
3221 (defun gnus-id-to-thread (id)
3222 "Return the (sub-)thread where ID appears."
3223 (gnus-gethash id gnus-newsgroup-dependencies))
3225 (defun gnus-id-to-article (id)
3226 "Return the article number of ID."
3227 (let ((thread (gnus-id-to-thread id)))
3230 (mail-header-number (car thread)))))
3232 (defun gnus-id-to-header (id)
3233 "Return the article headers of ID."
3234 (car (gnus-id-to-thread id)))
3236 (defun gnus-article-displayed-root-p (article)
3237 "Say whether ARTICLE is a root(ish) article."
3238 (let ((level (gnus-summary-thread-level article))
3239 (refs (mail-header-references (gnus-summary-article-header article)))
3245 ((null (gnus-parent-id refs)) t)
3247 (null (setq particle (gnus-id-to-article
3248 (gnus-parent-id refs))))
3249 (null (gnus-summary-thread-level particle)))))))
3251 (defun gnus-root-id (id)
3252 "Return the id of the root of the thread where ID appears."
3254 (while (and id (setq prev (car (gnus-gethash
3255 id gnus-newsgroup-dependencies))))
3257 id (gnus-parent-id (mail-header-references prev))))
3260 (defun gnus-articles-in-thread (thread)
3261 "Return the list of articles in THREAD."
3262 (cons (mail-header-number (car thread))
3263 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3265 (defun gnus-remove-thread (id &optional dont-remove)
3266 "Remove the thread that has ID in it."
3267 (let ((dep gnus-newsgroup-dependencies)
3268 headers thread last-id)
3269 ;; First go up in this thread until we find the root.
3270 (setq last-id (gnus-root-id id))
3271 (setq headers (list (car (gnus-id-to-thread last-id))
3272 (caadr (gnus-id-to-thread last-id))))
3273 ;; We have now found the real root of this thread. It might have
3274 ;; been gathered into some loose thread, so we have to search
3275 ;; through the threads to find the thread we wanted.
3276 (let ((threads gnus-newsgroup-threads)
3279 (setq sub (car threads))
3280 (if (stringp (car sub))
3281 ;; This is a gathered thread, so we look at the roots
3282 ;; below it to find whether this article is in this
3285 (setq sub (cdr sub))
3287 (when (member (caar sub) headers)
3288 (setq thread (car threads)
3291 (setq sub (cdr sub))))
3292 ;; It's an ordinary thread, so we check it.
3293 (when (eq (car sub) (car headers))
3296 (setq threads (cdr threads)))
3297 ;; If this article is in no thread, then it's a root.
3300 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3301 (setq thread (gnus-gethash last-id dep)))
3304 thread ; We return this thread.
3306 (if (stringp (car thread))
3308 ;; If we use dummy roots, then we have to remove the
3309 ;; dummy root as well.
3310 (when (eq gnus-summary-make-false-root 'dummy)
3312 (gnus-data-compute-positions))
3313 (setq thread (cdr thread))
3315 (gnus-remove-thread-1 (car thread))
3316 (setq thread (cdr thread))))
3317 (gnus-remove-thread-1 thread))))))))
3319 (defun gnus-remove-thread-1 (thread)
3320 "Remove the thread THREAD recursively."
3321 (let ((number (mail-header-number (pop thread)))
3323 (setq thread (reverse thread))
3325 (gnus-remove-thread-1 (pop thread)))
3326 (when (setq d (gnus-data-find number))
3327 (goto-char (gnus-data-pos d))
3330 (- (gnus-point-at-bol)
3332 (1+ (gnus-point-at-eol))
3333 (gnus-delete-line)))))))
3335 (defun gnus-sort-threads (threads)
3337 (if (not gnus-thread-sort-functions)
3339 (gnus-message 7 "Sorting threads...")
3341 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3342 (gnus-message 7 "Sorting threads...done"))))
3344 (defun gnus-sort-articles (articles)
3346 (when gnus-article-sort-functions
3347 (gnus-message 7 "Sorting articles...")
3349 (setq gnus-newsgroup-headers
3350 (sort articles (gnus-make-sort-function
3351 gnus-article-sort-functions)))
3352 (gnus-message 7 "Sorting articles...done"))))
3354 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3355 (defmacro gnus-thread-header (thread)
3356 ;; Return header of first article in THREAD.
3357 ;; Note that THREAD must never, ever be anything else than a variable -
3358 ;; using some other form will lead to serious barfage.
3359 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3360 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3361 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3364 (defsubst gnus-article-sort-by-number (h1 h2)
3365 "Sort articles by article number."
3366 (< (mail-header-number h1)
3367 (mail-header-number h2)))
3369 (defun gnus-thread-sort-by-number (h1 h2)
3370 "Sort threads by root article number."
3371 (gnus-article-sort-by-number
3372 (gnus-thread-header h1) (gnus-thread-header h2)))
3374 (defsubst gnus-article-sort-by-lines (h1 h2)
3375 "Sort articles by article Lines header."
3376 (< (mail-header-lines h1)
3377 (mail-header-lines h2)))
3379 (defun gnus-thread-sort-by-lines (h1 h2)
3380 "Sort threads by root article Lines header."
3381 (gnus-article-sort-by-lines
3382 (gnus-thread-header h1) (gnus-thread-header h2)))
3384 (defsubst gnus-article-sort-by-author (h1 h2)
3385 "Sort articles by root author."
3387 (let ((extract (funcall
3388 gnus-extract-address-components
3389 (mail-header-from h1))))
3390 (or (car extract) (cadr extract) ""))
3391 (let ((extract (funcall
3392 gnus-extract-address-components
3393 (mail-header-from h2))))
3394 (or (car extract) (cadr extract) ""))))
3396 (defun gnus-thread-sort-by-author (h1 h2)
3397 "Sort threads by root author."
3398 (gnus-article-sort-by-author
3399 (gnus-thread-header h1) (gnus-thread-header h2)))
3401 (defsubst gnus-article-sort-by-subject (h1 h2)
3402 "Sort articles by root subject."
3404 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3405 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3407 (defun gnus-thread-sort-by-subject (h1 h2)
3408 "Sort threads by root subject."
3409 (gnus-article-sort-by-subject
3410 (gnus-thread-header h1) (gnus-thread-header h2)))
3412 (defsubst gnus-article-sort-by-date (h1 h2)
3413 "Sort articles by root article date."
3415 (gnus-date-get-time (mail-header-date h1))
3416 (gnus-date-get-time (mail-header-date h2))))
3418 (defun gnus-thread-sort-by-date (h1 h2)
3419 "Sort threads by root article date."
3420 (gnus-article-sort-by-date
3421 (gnus-thread-header h1) (gnus-thread-header h2)))
3423 (defsubst gnus-article-sort-by-score (h1 h2)
3424 "Sort articles by root article score.
3425 Unscored articles will be counted as having a score of zero."
3426 (> (or (cdr (assq (mail-header-number h1)
3427 gnus-newsgroup-scored))
3428 gnus-summary-default-score 0)
3429 (or (cdr (assq (mail-header-number h2)
3430 gnus-newsgroup-scored))
3431 gnus-summary-default-score 0)))
3433 (defun gnus-thread-sort-by-score (h1 h2)
3434 "Sort threads by root article score."
3435 (gnus-article-sort-by-score
3436 (gnus-thread-header h1) (gnus-thread-header h2)))
3438 (defun gnus-thread-sort-by-total-score (h1 h2)
3439 "Sort threads by the sum of all scores in the thread.
3440 Unscored articles will be counted as having a score of zero."
3441 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3443 (defun gnus-thread-total-score (thread)
3444 ;; This function find the total score of THREAD.
3445 (cond ((null thread)
3448 (if (stringp (car thread))
3449 (apply gnus-thread-score-function 0
3450 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3451 (gnus-thread-total-score-1 thread)))
3453 (gnus-thread-total-score-1 (list thread)))))
3455 (defun gnus-thread-total-score-1 (root)
3456 ;; This function find the total score of the thread below ROOT.
3457 (setq root (car root))
3458 (apply gnus-thread-score-function
3460 (mapcar 'gnus-thread-total-score
3461 (cdr (gnus-gethash (mail-header-id root)
3462 gnus-newsgroup-dependencies)))
3463 (when (> (mail-header-number root) 0)
3464 (list (or (cdr (assq (mail-header-number root)
3465 gnus-newsgroup-scored))
3466 gnus-summary-default-score 0))))
3467 (list gnus-summary-default-score)
3470 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3471 (defvar gnus-tmp-prev-subject nil)
3472 (defvar gnus-tmp-false-parent nil)
3473 (defvar gnus-tmp-root-expunged nil)
3474 (defvar gnus-tmp-dummy-line nil)
3476 (defun gnus-summary-prepare-threads (threads)
3477 "Prepare summary buffer from THREADS and indentation LEVEL.
3478 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3479 or a straight list of headers."
3480 (gnus-message 7 "Generating summary...")
3482 (setq gnus-newsgroup-threads threads)
3485 (let ((gnus-tmp-level 0)
3486 (default-score (or gnus-summary-default-score 0))
3487 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3488 thread number subject stack state gnus-tmp-gathered beg-match
3489 new-roots gnus-tmp-new-adopts thread-end
3490 gnus-tmp-header gnus-tmp-unread
3491 gnus-tmp-replied gnus-tmp-subject-or-nil
3492 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3493 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3494 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3496 (setq gnus-tmp-prev-subject nil)
3498 (if (vectorp (car threads))
3499 ;; If this is a straight (sic) list of headers, then a
3500 ;; threaded summary display isn't required, so we just create
3501 ;; an unthreaded one.
3502 (gnus-summary-prepare-unthreaded threads)
3504 ;; Do the threaded display.
3506 (while (or threads stack gnus-tmp-new-adopts new-roots)
3508 (if (and (= gnus-tmp-level 0)
3509 (not (setq gnus-tmp-dummy-line nil))
3512 (not gnus-tmp-false-parent)
3513 (or gnus-tmp-new-adopts new-roots))
3514 (if gnus-tmp-new-adopts
3515 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3516 thread (list (car gnus-tmp-new-adopts))
3517 gnus-tmp-header (caar thread)
3518 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3520 (setq thread (list (car new-roots))
3521 gnus-tmp-header (caar thread)
3522 new-roots (cdr new-roots))))
3525 ;; If there are some threads, we do them before the
3526 ;; threads on the stack.
3527 (setq thread threads
3528 gnus-tmp-header (caar thread))
3529 ;; There were no current threads, so we pop something off
3531 (setq state (car stack)
3532 gnus-tmp-level (car state)
3535 gnus-tmp-header (caar thread))))
3537 (setq gnus-tmp-false-parent nil)
3538 (setq gnus-tmp-root-expunged nil)
3539 (setq thread-end nil)
3541 (if (stringp gnus-tmp-header)
3542 ;; The header is a dummy root.
3544 ((eq gnus-summary-make-false-root 'adopt)
3545 ;; We let the first article adopt the rest.
3546 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3548 (setq gnus-tmp-gathered
3550 (lambda (h) (mail-header-number (car h)))
3553 (setq thread (cons (list (caar thread)
3556 (setq gnus-tmp-level -1
3557 gnus-tmp-false-parent t))
3558 ((eq gnus-summary-make-false-root 'empty)
3559 ;; We print adopted articles with empty subject fields.
3560 (setq gnus-tmp-gathered
3562 (lambda (h) (mail-header-number (car h)))
3565 (setq gnus-tmp-level -1))
3566 ((eq gnus-summary-make-false-root 'dummy)
3567 ;; We remember that we probably want to output a dummy
3569 (setq gnus-tmp-dummy-line gnus-tmp-header)
3570 (setq gnus-tmp-prev-subject gnus-tmp-header))
3572 ;; We do not make a root for the gathered
3573 ;; sub-threads at all.
3574 (setq gnus-tmp-level -1)))
3576 (setq number (mail-header-number gnus-tmp-header)
3577 subject (mail-header-subject gnus-tmp-header))
3580 ;; If the thread has changed subject, we might want to make
3581 ;; this subthread into a root.
3582 ((and (null gnus-thread-ignore-subject)
3583 (not (zerop gnus-tmp-level))
3584 gnus-tmp-prev-subject
3586 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3587 (setq new-roots (nconc new-roots (list (car thread)))
3589 gnus-tmp-header nil))
3590 ;; If the article lies outside the current limit,
3591 ;; then we do not display it.
3592 ((not (memq number gnus-newsgroup-limit))
3593 (setq gnus-tmp-gathered
3595 (lambda (h) (mail-header-number (car h)))
3598 (setq gnus-tmp-new-adopts (if (cdar thread)
3599 (append gnus-tmp-new-adopts
3601 gnus-tmp-new-adopts)
3603 gnus-tmp-header nil)
3604 (when (zerop gnus-tmp-level)
3605 (setq gnus-tmp-root-expunged t)))
3606 ;; Perhaps this article is to be marked as read?
3607 ((and gnus-summary-mark-below
3608 (< (or (cdr (assq number gnus-newsgroup-scored))
3610 gnus-summary-mark-below)
3611 ;; Don't touch sparse articles.
3612 (not (gnus-summary-article-sparse-p number))
3613 (not (gnus-summary-article-ancient-p number)))
3614 (setq gnus-newsgroup-unreads
3615 (delq number gnus-newsgroup-unreads))
3616 (if gnus-newsgroup-auto-expire
3617 (push number gnus-newsgroup-expirable)
3618 (push (cons number gnus-low-score-mark)
3619 gnus-newsgroup-reads))))
3621 (when gnus-tmp-header
3622 ;; We may have an old dummy line to output before this
3624 (when gnus-tmp-dummy-line
3625 (gnus-summary-insert-dummy-line
3626 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3627 (setq gnus-tmp-dummy-line nil))
3629 ;; Compute the mark.
3630 (setq gnus-tmp-unread (gnus-article-mark number))
3632 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3633 gnus-tmp-header gnus-tmp-level)
3634 gnus-newsgroup-data)
3636 ;; Actually insert the line.
3638 gnus-tmp-subject-or-nil
3640 ((and gnus-thread-ignore-subject
3641 gnus-tmp-prev-subject
3642 (not (inline (gnus-subject-equal
3643 gnus-tmp-prev-subject subject))))
3645 ((zerop gnus-tmp-level)
3646 (if (and (eq gnus-summary-make-false-root 'empty)
3647 (memq number gnus-tmp-gathered)
3648 gnus-tmp-prev-subject
3649 (inline (gnus-subject-equal
3650 gnus-tmp-prev-subject subject)))
3651 gnus-summary-same-subject
3653 (t gnus-summary-same-subject)))
3654 (if (and (eq gnus-summary-make-false-root 'adopt)
3655 (= gnus-tmp-level 1)
3656 (memq number gnus-tmp-gathered))
3657 (setq gnus-tmp-opening-bracket ?\<
3658 gnus-tmp-closing-bracket ?\>)
3659 (setq gnus-tmp-opening-bracket ?\[
3660 gnus-tmp-closing-bracket ?\]))
3662 gnus-tmp-indentation
3663 (aref gnus-thread-indent-array gnus-tmp-level)
3664 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3665 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3666 gnus-summary-default-score 0)
3668 (if (or (null gnus-summary-default-score)
3669 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3670 gnus-summary-zcore-fuzz))
3672 (if (< gnus-tmp-score gnus-summary-default-score)
3673 gnus-score-below-mark gnus-score-over-mark))
3675 (cond ((memq number gnus-newsgroup-processable)
3677 ((memq number gnus-newsgroup-cached)
3679 ((memq number gnus-newsgroup-replied)
3681 ((memq number gnus-newsgroup-saved)
3683 (t gnus-unread-mark))
3684 gnus-tmp-from (mail-header-from gnus-tmp-header)
3687 ((string-match "<[^>]+> *$" gnus-tmp-from)
3688 (setq beg-match (match-beginning 0))
3689 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3690 (substring gnus-tmp-from (1+ (match-beginning 0))
3691 (1- (match-end 0))))
3692 (substring gnus-tmp-from 0 beg-match)))
3693 ((string-match "(.+)" gnus-tmp-from)
3694 (substring gnus-tmp-from
3695 (1+ (match-beginning 0)) (1- (match-end 0))))
3697 (when (string= gnus-tmp-name "")
3698 (setq gnus-tmp-name gnus-tmp-from))
3699 (unless (numberp gnus-tmp-lines)
3700 (setq gnus-tmp-lines 0))
3701 (gnus-put-text-property
3703 (progn (eval gnus-summary-line-format-spec) (point))
3704 'gnus-number number)
3707 (run-hooks 'gnus-summary-update-hook)
3710 (setq gnus-tmp-prev-subject subject)))
3712 (when (nth 1 thread)
3713 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3714 (incf gnus-tmp-level)
3715 (setq threads (if thread-end nil (cdar thread)))
3717 (setq gnus-tmp-level 0)))))
3718 (gnus-message 7 "Generating summary...done"))
3720 (defun gnus-summary-prepare-unthreaded (headers)
3721 "Generate an unthreaded summary buffer based on HEADERS."
3722 (let (header number mark)
3727 ;; We may have to root out some bad articles...
3728 (when (memq (setq number (mail-header-number
3729 (setq header (pop headers))))
3730 gnus-newsgroup-limit)
3731 ;; Mark article as read when it has a low score.
3732 (when (and gnus-summary-mark-below
3733 (< (or (cdr (assq number gnus-newsgroup-scored))
3734 gnus-summary-default-score 0)
3735 gnus-summary-mark-below)
3736 (not (gnus-summary-article-ancient-p number)))
3737 (setq gnus-newsgroup-unreads
3738 (delq number gnus-newsgroup-unreads))
3739 (if gnus-newsgroup-auto-expire
3740 (push number gnus-newsgroup-expirable)
3741 (push (cons number gnus-low-score-mark)
3742 gnus-newsgroup-reads)))
3744 (setq mark (gnus-article-mark number))
3745 (push (gnus-data-make number mark (1+ (point)) header 0)
3746 gnus-newsgroup-data)
3747 (gnus-summary-insert-line
3749 mark (memq number gnus-newsgroup-replied)
3750 (memq number gnus-newsgroup-expirable)
3751 (mail-header-subject header) nil
3752 (cdr (assq number gnus-newsgroup-scored))
3753 (memq number gnus-newsgroup-processable))))))
3755 (defun gnus-select-newsgroup (group &optional read-all)
3756 "Select newsgroup GROUP.
3757 If READ-ALL is non-nil, all articles in the group are selected."
3758 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3759 ;;!!! Dirty hack; should be removed.
3760 (gnus-summary-ignore-duplicates
3761 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3763 gnus-summary-ignore-duplicates))
3764 (info (nth 2 entry))
3765 articles fetched-articles cached)
3767 (unless (gnus-check-server
3768 (setq gnus-current-select-method
3769 (gnus-find-method-for-group group)))
3770 (error "Couldn't open server"))
3772 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3773 (gnus-activate-group group) ; Or we can activate it...
3774 (progn ; Or we bug out.
3775 (when (equal major-mode 'gnus-summary-mode)
3776 (kill-buffer (current-buffer)))
3777 (error "Couldn't request group %s: %s"
3778 group (gnus-status-message group))))
3780 (unless (gnus-request-group group t)
3781 (when (equal major-mode 'gnus-summary-mode)
3782 (kill-buffer (current-buffer)))
3783 (error "Couldn't request group %s: %s"
3784 group (gnus-status-message group)))
3786 (setq gnus-newsgroup-name group)
3787 (setq gnus-newsgroup-unselected nil)
3788 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3790 ;; Adjust and set lists of article marks.
3792 (gnus-adjust-marked-articles info))
3794 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3795 (when (gnus-virtual-group-p group)
3796 (setq cached gnus-newsgroup-cached))
3798 (setq gnus-newsgroup-unreads
3799 (gnus-set-difference
3800 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3801 gnus-newsgroup-dormant))
3803 (setq gnus-newsgroup-processable nil)
3805 (gnus-update-read-articles group gnus-newsgroup-unreads)
3806 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3807 (gnus-group-update-group group))
3809 (setq articles (gnus-articles-to-read group read-all))
3813 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3815 ((eq articles 0) nil)
3817 ;; Init the dependencies hash table.
3818 (setq gnus-newsgroup-dependencies
3819 (gnus-make-hashtable (length articles)))
3820 ;; Retrieve the headers and read them in.
3821 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3822 (setq gnus-newsgroup-headers
3824 (setq gnus-headers-retrieved-by
3825 (gnus-retrieve-headers
3826 articles gnus-newsgroup-name
3827 ;; We might want to fetch old headers, but
3828 ;; not if there is only 1 article.
3829 (and gnus-fetch-old-headers
3831 (not (eq gnus-fetch-old-headers 'some))
3832 (not (numberp gnus-fetch-old-headers)))
3833 (> (length articles) 1))))))
3834 (gnus-get-newsgroup-headers-xover
3835 articles nil nil gnus-newsgroup-name t)
3836 (gnus-get-newsgroup-headers)))
3837 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3839 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3841 (setq gnus-newsgroup-cached cached))
3843 ;; Suppress duplicates?
3844 (when gnus-suppress-duplicates
3845 (gnus-dup-suppress-articles))
3847 ;; Set the initial limit.
3848 (setq gnus-newsgroup-limit (copy-sequence articles))
3849 ;; Remove canceled articles from the list of unread articles.
3850 (setq gnus-newsgroup-unreads
3851 (gnus-set-sorted-intersection
3852 gnus-newsgroup-unreads
3853 (setq fetched-articles
3854 (mapcar (lambda (headers) (mail-header-number headers))
3855 gnus-newsgroup-headers))))
3856 ;; Removed marked articles that do not exist.
3857 (gnus-update-missing-marks
3858 (gnus-sorted-complement fetched-articles articles))
3859 ;; Let the Gnus agent mark articles as read.
3861 (gnus-agent-get-undownloaded-list))
3862 ;; We might want to build some more threads first.
3863 (when (and gnus-fetch-old-headers
3864 (eq gnus-headers-retrieved-by 'nov))
3865 (if (eq gnus-fetch-old-headers 'invisible)
3866 (gnus-build-all-threads)
3867 (gnus-build-old-threads)))
3868 ;; Check whether auto-expire is to be done in this group.
3869 (setq gnus-newsgroup-auto-expire
3870 (gnus-group-auto-expirable-p group))
3871 ;; Set up the article buffer now, if necessary.
3872 (unless gnus-single-article-buffer
3873 (gnus-article-setup-buffer))
3874 ;; First and last article in this newsgroup.
3875 (when gnus-newsgroup-headers
3876 (setq gnus-newsgroup-begin
3877 (mail-header-number (car gnus-newsgroup-headers))
3880 (gnus-last-element gnus-newsgroup-headers))))
3881 ;; GROUP is successfully selected.
3882 (or gnus-newsgroup-headers t)))))
3884 (defun gnus-articles-to-read (group &optional read-all)
3885 ;; Find out what articles the user wants to read.
3887 ;; Select all articles if `read-all' is non-nil, or if there
3888 ;; are no unread articles.
3890 (and (zerop (length gnus-newsgroup-marked))
3891 (zerop (length gnus-newsgroup-unreads)))
3892 (eq (gnus-group-find-parameter group 'display)
3894 (gnus-uncompress-range (gnus-active group))
3895 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3896 (copy-sequence gnus-newsgroup-unreads))
3898 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3899 (scored (length scored-list))
3900 (number (length articles))
3901 (marked (+ (length gnus-newsgroup-marked)
3902 (length gnus-newsgroup-dormant)))
3910 ((and (or (<= scored marked) (= scored number))
3911 (numberp gnus-large-newsgroup)
3912 (> number gnus-large-newsgroup))
3916 "How many articles from %s (default %d): "
3917 (gnus-limit-string gnus-newsgroup-name 35)
3919 (if (string-match "^[ \t]*$" input) number input)))
3920 ((and (> scored marked) (< scored number)
3921 (> (- scored number) 20))
3924 (format "%s %s (%d scored, %d total): "
3925 "How many articles from"
3926 group scored number))))
3927 (if (string-match "^[ \t]*$" input)
3931 (setq select (if (stringp select) (string-to-number select) select))
3932 (if (or (null select) (zerop select))
3934 (if (and (not (zerop scored)) (<= (abs select) scored))
3936 (setq articles (sort scored-list '<))
3937 (setq number (length articles)))
3938 (setq articles (copy-sequence articles)))
3940 (when (< (abs select) number)
3942 ;; Select the N oldest articles.
3943 (setcdr (nthcdr (1- (abs select)) articles) nil)
3944 ;; Select the N most recent articles.
3945 (setq articles (nthcdr (- number select) articles))))
3946 (setq gnus-newsgroup-unselected
3947 (gnus-sorted-intersection
3948 gnus-newsgroup-unreads
3949 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3952 (defun gnus-killed-articles (killed articles)
3955 (when (inline (gnus-member-of-range (car articles) killed))
3956 (push (car articles) out))
3957 (setq articles (cdr articles)))
3960 (defun gnus-uncompress-marks (marks)
3961 "Uncompress the mark ranges in MARKS."
3962 (let ((uncompressed '(score bookmark))
3965 (if (memq (caar marks) uncompressed)
3966 (push (car marks) out)
3967 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3968 (setq marks (cdr marks)))
3971 (defun gnus-adjust-marked-articles (info)
3972 "Set all article lists and remove all marks that are no longer legal."
3973 (let* ((marked-lists (gnus-info-marks info))
3974 (active (gnus-active (gnus-info-group info)))
3977 (types gnus-article-mark-lists)
3978 (uncompressed '(score bookmark killed))
3979 marks var articles article mark)
3982 (setq marks (pop marked-lists))
3983 (set (setq var (intern (format "gnus-newsgroup-%s"
3984 (car (rassq (setq mark (car marks))
3986 (if (memq (car marks) uncompressed) (cdr marks)
3987 (gnus-uncompress-range (cdr marks))))
3989 (setq articles (symbol-value var))
3991 ;; All articles have to be subsets of the active articles.
3993 ;; Adjust "simple" lists.
3994 ((memq mark '(tick dormant expire reply save))
3996 (when (or (< (setq article (pop articles)) min) (> article max))
3997 (set var (delq article (symbol-value var))))))
3999 ((memq mark uncompressed)
4000 (when (not (listp (cdr (symbol-value var))))
4001 (set var (list (symbol-value var))))
4002 (when (not (listp (cdr articles)))
4003 (setq articles (list articles)))
4005 (when (or (not (consp (setq article (pop articles))))
4006 (< (car article) min)
4007 (> (car article) max))
4008 (set var (delq article (symbol-value var))))))))))
4010 (defun gnus-update-missing-marks (missing)
4011 "Go through the list of MISSING articles and remove them from the mark lists."
4013 (let ((types gnus-article-mark-lists)
4015 ;; Go through all types.
4017 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4018 (when (symbol-value var)
4019 ;; This list has articles. So we delete all missing articles
4023 (set var (delq (pop m) (symbol-value var)))))))))
4025 (defun gnus-update-marks ()
4026 "Enter the various lists of marked articles into the newsgroup info list."
4027 (let ((types gnus-article-mark-lists)
4028 (info (gnus-get-info gnus-newsgroup-name))
4029 (uncompressed '(score bookmark killed))
4030 type list newmarked symbol)
4032 ;; Add all marks lists that are non-nil to the list of marks lists.
4033 (while (setq type (pop types))
4034 (when (setq list (symbol-value
4036 (intern (format "gnus-newsgroup-%s"
4039 ;; Get rid of the entries of the articles that have the
4041 (when (and (eq (cdr type) 'score)
4045 (prev (cons nil list))
4048 (if (or (not (consp (car arts)))
4049 (= (cdar arts) gnus-summary-default-score))
4050 (setcdr prev (cdr arts))
4052 (setq arts (cdr arts)))
4053 (setq list (cdr all))))
4055 (push (cons (cdr type)
4056 (if (memq (cdr type) uncompressed) list
4057 (gnus-compress-sequence
4058 (set symbol (sort list '<)) t)))
4061 ;; Enter these new marks into the info of the group.
4063 (setcar (nthcdr 3 info) newmarked)
4064 ;; Add the marks lists to the end of the info.
4066 (setcdr (nthcdr 2 info) (list newmarked))))
4068 ;; Cut off the end of the info if there's nothing else there.
4072 (when (nthcdr (decf i) info)
4073 (setcdr (nthcdr i info) nil)))))))
4075 (defun gnus-set-mode-line (where)
4076 "This function sets the mode line of the article or summary buffers.
4077 If WHERE is `summary', the summary mode line format will be used."
4078 ;; Is this mode line one we keep updated?
4079 (when (memq where gnus-updated-mode-lines)
4082 ;; We evaluate this in the summary buffer since these
4083 ;; variables are buffer-local to that buffer.
4084 (set-buffer gnus-summary-buffer)
4085 ;; We bind all these variables that are used in the `eval' form
4087 (let* ((mformat (symbol-value
4089 (format "gnus-%s-mode-line-format-spec" where))))
4090 (gnus-tmp-group-name gnus-newsgroup-name)
4091 (gnus-tmp-article-number (or gnus-current-article 0))
4092 (gnus-tmp-unread gnus-newsgroup-unreads)
4093 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4094 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4095 (gnus-tmp-unread-and-unselected
4096 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4097 (zerop gnus-tmp-unselected))
4099 ((zerop gnus-tmp-unselected)
4100 (format "{%d more}" gnus-tmp-unread-and-unticked))
4101 (t (format "{%d(+%d) more}"
4102 gnus-tmp-unread-and-unticked
4103 gnus-tmp-unselected))))
4105 (if (and gnus-current-headers
4106 (vectorp gnus-current-headers))
4107 (gnus-mode-string-quote
4108 (mail-header-subject gnus-current-headers))
4110 bufname-length max-len
4111 gnus-tmp-header);; passed as argument to any user-format-funcs
4112 (setq mode-string (eval mformat))
4113 (setq bufname-length (if (string-match "%b" mode-string)
4116 (if (eq where 'summary)
4118 (get-buffer gnus-article-buffer))))
4121 (setq max-len (max 4 (if gnus-mode-non-string-length
4123 gnus-mode-non-string-length
4125 (length mode-string))))
4126 ;; We might have to chop a bit of the string off...
4127 (when (> (length mode-string) max-len)
4129 (concat (gnus-truncate-string mode-string (- max-len 3))
4131 ;; Pad the mode string a bit.
4132 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4133 ;; Update the mode line.
4134 (setq mode-line-buffer-identification
4135 (gnus-mode-line-buffer-identification (list mode-string)))
4136 (set-buffer-modified-p t))))
4138 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4139 "Go through the HEADERS list and add all Xrefs to a hash table.
4140 The resulting hash table is returned, or nil if no Xrefs were found."
4141 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4142 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4143 (xref-hashtb (gnus-make-hashtable))
4144 start group entry number xrefs header)
4146 (setq header (pop headers))
4147 (when (and (setq xrefs (mail-header-xref header))
4148 (not (memq (setq number (mail-header-number header))
4151 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4152 (setq start (match-end 0))
4153 (setq group (if prefix
4154 (concat prefix (substring xrefs (match-beginning 1)
4156 (substring xrefs (match-beginning 1) (match-end 1))))
4158 (string-to-int (substring xrefs (match-beginning 2)
4160 (if (setq entry (gnus-gethash group xref-hashtb))
4161 (setcdr entry (cons number (cdr entry)))
4162 (gnus-sethash group (cons number nil) xref-hashtb)))))
4163 (and start xref-hashtb)))
4165 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4166 "Look through all the headers and mark the Xrefs as read."
4167 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4168 name entry info xref-hashtb idlist method nth4)
4170 (set-buffer gnus-group-buffer)
4171 (when (setq xref-hashtb
4172 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4175 (unless (string= from-newsgroup (setq name (symbol-name group)))
4176 (setq idlist (symbol-value group))
4177 ;; Dead groups are not updated.
4179 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4181 (when (stringp (setq nth4 (gnus-info-method info)))
4182 (setq nth4 (gnus-server-to-method nth4))))
4183 ;; Only do the xrefs if the group has the same
4184 ;; select method as the group we have just read.
4185 (or (gnus-methods-equal-p
4186 nth4 (gnus-find-method-for-group from-newsgroup))
4188 (equal nth4 (setq method (gnus-find-method-for-group
4190 (and (equal (car nth4) (car method))
4191 (equal (nth 1 nth4) (nth 1 method))))
4192 gnus-use-cross-reference
4193 (or (not (eq gnus-use-cross-reference t))
4195 ;; Only do cross-references on subscribed
4196 ;; groups, if that is what is wanted.
4197 (<= (gnus-info-level info) gnus-level-subscribed))
4198 (gnus-group-make-articles-read name idlist))))
4201 (defun gnus-compute-read-articles (group articles)
4202 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4203 (info (nth 2 entry))
4204 (active (gnus-active group))
4207 ;; First peel off all illegal article numbers.
4209 (let ((ids articles)
4211 (while (setq id (pop ids))
4212 (when (and first (> id (cdr active)))
4213 ;; We'll end up in this situation in one particular
4214 ;; obscure situation. If you re-scan a group and get
4215 ;; a new article that is cross-posted to a different
4216 ;; group that has not been re-scanned, you might get
4217 ;; crossposted article that has a higher number than
4218 ;; Gnus believes possible. So we re-activate this
4219 ;; group as well. This might mean doing the
4220 ;; crossposting thingy will *increase* the number
4221 ;; of articles in some groups. Tsk, tsk.
4222 (setq active (or (gnus-activate-group group) active)))
4223 (when (or (> id (cdr active))
4224 (< id (car active)))
4225 (setq articles (delq id articles))))))
4226 ;; If the read list is nil, we init it.
4228 (null (gnus-info-read info))
4230 (setq ninfo (cons 1 (1- (car active))))
4231 (setq ninfo (gnus-info-read info)))
4232 ;; Then we add the read articles to the range.
4234 ninfo (setq articles (sort articles '<))))))
4236 (defun gnus-group-make-articles-read (group articles)
4237 "Update the info of GROUP to say that ARTICLES are read."
4239 (entry (gnus-gethash group gnus-newsrc-hashtb))
4240 (info (nth 2 entry))
4241 (active (gnus-active group))
4244 (setq range (gnus-compute-read-articles group articles))
4246 (set-buffer gnus-group-buffer)
4249 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4250 (gnus-info-set-read ',info ',(gnus-info-read info))
4251 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4252 (gnus-group-update-group ,group t))))
4253 ;; Add the read articles to the range.
4254 (gnus-info-set-read info range)
4255 ;; Then we have to re-compute how many unread
4256 ;; articles there are in this group.
4260 (setq num (- (1+ (cdr active)) (car active))))
4261 ((not (listp (cdr range)))
4262 (setq num (- (cdr active) (- (1+ (cdr range))
4266 (if (numberp (car range))
4268 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4269 (setq range (cdr range)))
4270 (setq num (- (cdr active) num))))
4271 ;; Update the number of unread articles.
4273 ;; Update the group buffer.
4274 (gnus-group-update-group group t)))))
4276 (defun gnus-methods-equal-p (m1 m2)
4277 (let ((m1 (or m1 gnus-select-method))
4278 (m2 (or m2 gnus-select-method)))
4280 (and (eq (car m1) (car m2))
4281 (or (not (memq 'address (assoc (symbol-name (car m1))
4282 gnus-valid-select-methods)))
4283 (equal (nth 1 m1) (nth 1 m2)))))))
4285 (defvar gnus-newsgroup-none-id 0)
4287 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4288 (let ((cur nntp-server-buffer)
4291 (save-excursion (set-buffer gnus-summary-buffer)
4292 gnus-newsgroup-dependencies)))
4293 headers id id-dep ref-dep end ref)
4295 (set-buffer nntp-server-buffer)
4296 ;; Translate all TAB characters into SPACE characters.
4297 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4298 (run-hooks 'gnus-parse-headers-hook)
4299 (let ((case-fold-search t)
4300 in-reply-to header p lines)
4301 (goto-char (point-min))
4302 ;; Search to the beginning of the next header. Error messages
4303 ;; do not begin with 2 or 3.
4304 (while (re-search-forward "^[23][0-9]+ " nil t)
4307 ;; This implementation of this function, with nine
4308 ;; search-forwards instead of the one re-search-forward and
4309 ;; a case (which basically was the old function) is actually
4310 ;; about twice as fast, even though it looks messier. You
4311 ;; can't have everything, I guess. Speed and elegance
4312 ;; doesn't always go hand in hand.
4321 (narrow-to-region (point)
4322 (or (and (search-forward "\n.\n" nil t)
4328 (if (search-forward "\nsubject: " nil t)
4329 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4331 gnus-unstructured-field-decoder (nnheader-header-value))
4336 (if (search-forward "\nfrom: " nil t)
4337 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
4339 gnus-structured-field-decoder (nnheader-header-value))
4344 (if (search-forward "\ndate: " nil t)
4345 (nnheader-header-value) ""))
4349 (setq id (if (search-forward "\nmessage-id:" nil t)
4351 (1- (or (search-forward "<" nil t) (point)))
4352 (or (search-forward ">" nil t) (point)))
4353 ;; If there was no message-id, we just fake one
4354 ;; to make subsequent routines simpler.
4355 (nnheader-generate-fake-message-id))))
4359 (if (search-forward "\nreferences: " nil t)
4363 (nnheader-header-value)
4368 (search-backward ">" end t)
4371 (search-backward "<" end t)
4373 ;; Get the references from the in-reply-to header if there
4374 ;; were no references and the in-reply-to header looks
4376 (if (and (search-forward "\nin-reply-to: " nil t)
4377 (setq in-reply-to (nnheader-header-value))
4378 (string-match "<[^>]+>" in-reply-to))
4380 (setq ref (substring in-reply-to (match-beginning 0)
4382 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4383 (setq ref2 (substring in-reply-to (match-beginning 0)
4385 (when (> (length ref2) (length ref))
4393 (if (search-forward "\nlines: " nil t)
4394 (if (numberp (setq lines (ignore-errors (read cur))))
4400 (and (search-forward "\nxref: " nil t)
4401 (nnheader-header-value)))))
4402 (when (equal id ref)
4405 (when gnus-alter-header-function
4406 (funcall gnus-alter-header-function header)
4407 (setq id (mail-header-id header)
4408 ref (gnus-parent-id (mail-header-references header))))
4410 ;; We do the threading while we read the headers. The
4411 ;; message-id and the last reference are both entered into
4412 ;; the same hash table. Some tippy-toeing around has to be
4413 ;; done in case an article has arrived before the article
4414 ;; which it refers to.
4415 (if (boundp (setq id-dep (intern id dependencies)))
4416 (if (and (car (symbol-value id-dep))
4418 ;; An article with this Message-ID has already been seen.
4419 (if gnus-summary-ignore-duplicates
4420 ;; We ignore this one, except we add
4421 ;; any additional Xrefs (in case the two articles
4422 ;; came from different servers).
4424 (mail-header-set-xref
4425 (car (symbol-value id-dep))
4426 (concat (or (mail-header-xref
4427 (car (symbol-value id-dep)))
4429 (or (mail-header-xref header) "")))
4431 ;; We rename the Message-ID.
4433 (setq id-dep (intern (setq id (nnmail-message-id))
4436 (mail-header-set-id header id))
4437 (setcar (symbol-value id-dep) header))
4438 (set id-dep (list header)))
4440 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4441 (setcdr (symbol-value ref-dep)
4442 (nconc (cdr (symbol-value ref-dep))
4443 (list (symbol-value id-dep))))
4444 (set ref-dep (list nil (symbol-value id-dep))))
4445 (push header headers))
4446 (goto-char (point-max))
4448 (nreverse headers)))))
4450 ;; The following macros and functions were written by Felix Lee
4451 ;; <flee@cse.psu.edu>.
4453 (defmacro gnus-nov-read-integer ()
4455 (if (= (following-char) ?\t)
4457 (let ((num (ignore-errors (read buffer))))
4458 (if (numberp num) num 0)))
4460 (search-forward "\t" eol 'move))))
4462 (defmacro gnus-nov-skip-field ()
4463 '(search-forward "\t" eol 'move))
4465 (defmacro gnus-nov-field ()
4466 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4468 ;; (defvar gnus-nov-none-counter 0)
4470 ;; This function has to be called with point after the article number
4471 ;; on the beginning of the line.
4472 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4473 (let ((eol (gnus-point-at-eol))
4474 (buffer (current-buffer))
4475 header ref id id-dep ref-dep)
4477 ;; overview: [num subject from date id refs chars lines misc]
4480 (narrow-to-region (point) eol)
4488 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
4490 gnus-structured-field-decoder (gnus-nov-field)) ; from
4491 (gnus-nov-field) ; date
4492 (setq id (or (gnus-nov-field)
4493 (nnheader-generate-fake-message-id))) ; id
4495 (let ((beg (point)))
4496 (search-forward "\t" eol)
4497 (if (search-backward ">" beg t)
4501 (search-backward "<" beg t)))
4504 (gnus-nov-field)) ; refs
4505 (gnus-nov-read-integer) ; chars
4506 (gnus-nov-read-integer) ; lines
4507 (if (= (following-char) ?\n)
4509 (gnus-nov-field))))) ; misc
4513 (when gnus-alter-header-function
4514 (funcall gnus-alter-header-function header)
4515 (setq id (mail-header-id header)
4516 ref (gnus-parent-id (mail-header-references header))))
4518 ;; We build the thread tree.
4519 (when (equal id ref)
4520 ;; This article refers back to itself. Naughty, naughty.
4522 (if (boundp (setq id-dep (intern id dependencies)))
4523 (if (and (car (symbol-value id-dep))
4525 ;; An article with this Message-ID has already been seen.
4526 (if gnus-summary-ignore-duplicates
4527 ;; We ignore this one, except we add any additional
4528 ;; Xrefs (in case the two articles came from different
4531 (mail-header-set-xref
4532 (car (symbol-value id-dep))
4533 (concat (or (mail-header-xref
4534 (car (symbol-value id-dep)))
4536 (or (mail-header-xref header) "")))
4538 ;; We rename the Message-ID.
4540 (setq id-dep (intern (setq id (nnmail-message-id))
4543 (mail-header-set-id header id))
4544 (setcar (symbol-value id-dep) header))
4545 (set id-dep (list header)))
4547 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4548 (setcdr (symbol-value ref-dep)
4549 (nconc (cdr (symbol-value ref-dep))
4550 (list (symbol-value id-dep))))
4551 (set ref-dep (list nil (symbol-value id-dep)))))
4554 ;; Goes through the xover lines and returns a list of vectors
4555 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4556 force-new dependencies
4557 group also-fetch-heads)
4558 "Parse the news overview data in the server buffer, and return a
4559 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4560 ;; Get the Xref when the users reads the articles since most/some
4561 ;; NNTP servers do not include Xrefs when using XOVER.
4562 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4563 (let ((cur nntp-server-buffer)
4564 (dependencies (or dependencies gnus-newsgroup-dependencies))
4565 number headers header)
4567 (set-buffer nntp-server-buffer)
4568 ;; Allow the user to mangle the headers before parsing them.
4569 (run-hooks 'gnus-parse-headers-hook)
4570 (goto-char (point-min))
4573 (while (and sequence (not (eobp)))
4574 (setq number (read cur))
4575 (while (and sequence
4576 (< (car sequence) number))
4577 (setq sequence (cdr sequence)))
4579 (eq number (car sequence))
4581 (setq sequence (cdr sequence))
4582 (setq header (inline
4583 (gnus-nov-parse-line
4584 number dependencies force-new))))
4585 (push header headers))
4588 (gnus-error 4 "Strange nov line (%d)"
4589 (count-lines (point-min) (point)))))
4591 ;; A common bug in inn is that if you have posted an article and
4592 ;; then retrieves the active file, it will answer correctly --
4593 ;; the new article is included. However, a NOV entry for the
4594 ;; article may not have been generated yet, so this may fail.
4595 ;; We work around this problem by retrieving the last few
4596 ;; headers using HEAD.
4597 (if (or (not also-fetch-heads)
4599 ;; We (probably) got all the headers.
4601 (let ((gnus-nov-is-evil t))
4604 (when (gnus-retrieve-headers sequence group)
4605 (gnus-get-newsgroup-headers))))))))
4607 (defun gnus-article-get-xrefs ()
4608 "Fill in the Xref value in `gnus-current-headers', if necessary.
4609 This is meant to be called in `gnus-article-internal-prepare-hook'."
4610 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4611 gnus-current-headers)))
4612 (or (not gnus-use-cross-reference)
4614 (and (mail-header-xref headers)
4615 (not (string= (mail-header-xref headers) "")))
4616 (let ((case-fold-search t)
4619 (nnheader-narrow-to-headers)
4620 (goto-char (point-min))
4621 (when (or (and (eq (downcase (following-char)) ?x)
4622 (looking-at "Xref:"))
4623 (search-forward "\nXref:" nil t))
4624 (goto-char (1+ (match-end 0)))
4625 (setq xref (buffer-substring (point)
4626 (progn (end-of-line) (point))))
4627 (mail-header-set-xref headers xref)))))))
4629 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4630 "Find article ID and insert the summary line for that article."
4631 (let ((header (if (and old-header use-old-header)
4632 old-header (gnus-read-header id)))
4633 (number (and (numberp id) id))
4636 ;; Rebuild the thread that this article is part of and go to the
4637 ;; article we have fetched.
4638 (when (and (not gnus-show-threads)
4640 (when (setq d (gnus-data-find (mail-header-number old-header)))
4641 (goto-char (gnus-data-pos d))
4644 (- (gnus-point-at-bol)
4646 (1+ (gnus-point-at-eol))
4647 (gnus-delete-line))))))
4649 (mail-header-set-number header (mail-header-number old-header)))
4650 (setq gnus-newsgroup-sparse
4651 (delq (setq number (mail-header-number header))
4652 gnus-newsgroup-sparse))
4653 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4654 (gnus-rebuild-thread (mail-header-id header))
4655 (gnus-summary-goto-subject number nil t))
4656 (when (and (numberp number)
4658 ;; We have to update the boundaries even if we can't fetch the
4659 ;; article if ID is a number -- so that the next `P' or `N'
4660 ;; command will fetch the previous (or next) article even
4661 ;; if the one we tried to fetch this time has been canceled.
4662 (when (> number gnus-newsgroup-end)
4663 (setq gnus-newsgroup-end number))
4664 (when (< number gnus-newsgroup-begin)
4665 (setq gnus-newsgroup-begin number))
4666 (setq gnus-newsgroup-unselected
4667 (delq number gnus-newsgroup-unselected)))
4668 ;; Report back a success?
4669 (and header (mail-header-number header))))
4671 ;;; Process/prefix in the summary buffer
4673 (defun gnus-summary-work-articles (n)
4674 "Return a list of articles to be worked upon. The prefix argument,
4675 the list of process marked articles, and the current article will be
4676 taken into consideration."
4679 ;; A numerical prefix has been given.
4680 (setq n (prefix-numeric-value n))
4681 (let ((backward (< n 0))
4682 (n (abs (prefix-numeric-value n)))
4687 (push (setq article (gnus-summary-article-number))
4690 (gnus-summary-find-prev nil article)
4691 (gnus-summary-find-next nil article)))
4693 (nreverse articles)))
4694 ((gnus-region-active-p)
4695 ;; Work on the region between point and mark.
4696 (let ((max (max (point) (mark)))
4699 (goto-char (min (point) (mark)))
4702 (push (setq article (gnus-summary-article-number)) articles)
4703 (gnus-summary-find-next nil article)
4705 (nreverse articles))))
4706 (gnus-newsgroup-processable
4707 ;; There are process-marked articles present.
4708 ;; Save current state.
4709 (gnus-summary-save-process-mark)
4711 (reverse gnus-newsgroup-processable))
4713 ;; Just return the current article.
4714 (list (gnus-summary-article-number)))))
4716 (defun gnus-summary-save-process-mark ()
4717 "Push the current set of process marked articles on the stack."
4719 (push (copy-sequence gnus-newsgroup-processable)
4720 gnus-newsgroup-process-stack))
4722 (defun gnus-summary-kill-process-mark ()
4723 "Push the current set of process marked articles on the stack and unmark."
4725 (gnus-summary-save-process-mark)
4726 (gnus-summary-unmark-all-processable))
4728 (defun gnus-summary-yank-process-mark ()
4729 "Pop the last process mark state off the stack and restore it."
4731 (unless gnus-newsgroup-process-stack
4732 (error "Empty mark stack"))
4733 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4735 (defun gnus-summary-process-mark-set (set)
4736 "Make SET into the current process marked articles."
4737 (gnus-summary-unmark-all-processable)
4739 (gnus-summary-set-process-mark (pop set))))
4741 ;;; Searching and stuff
4743 (defun gnus-summary-search-group (&optional backward use-level)
4744 "Search for next unread newsgroup.
4745 If optional argument BACKWARD is non-nil, search backward instead."
4747 (set-buffer gnus-group-buffer)
4748 (when (gnus-group-search-forward
4749 backward nil (if use-level (gnus-group-group-level) nil))
4750 (gnus-group-group-name))))
4752 (defun gnus-summary-best-group (&optional exclude-group)
4753 "Find the name of the best unread group.
4754 If EXCLUDE-GROUP, do not go to this group."
4756 (set-buffer gnus-group-buffer)
4758 (gnus-group-best-unread-group exclude-group))))
4760 (defun gnus-summary-find-next (&optional unread article backward)
4761 (if backward (gnus-summary-find-prev)
4762 (let* ((dummy (gnus-summary-article-intangible-p))
4763 (article (or article (gnus-summary-article-number)))
4764 (arts (gnus-data-find-list article))
4766 (when (and (not dummy)
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-prev (&optional unread article)
4785 (let* ((eobp (eobp))
4786 (article (or article (gnus-summary-article-number)))
4787 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4789 (when (and (not eobp)
4790 (or (not gnus-summary-check-current)
4792 (not (gnus-data-unread-p (car arts)))))
4793 (setq arts (cdr arts)))
4798 (when (gnus-data-unread-p (car arts))
4799 (setq result (car arts)
4801 (setq arts (cdr arts)))
4804 (goto-char (gnus-data-pos result))
4805 (gnus-data-number result))))
4807 (defun gnus-summary-find-subject (subject &optional unread backward article)
4808 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4809 (article (or article (gnus-summary-article-number)))
4810 (articles (gnus-data-list backward))
4811 (arts (gnus-data-find-list article articles))
4813 (when (or (not gnus-summary-check-current)
4815 (not (gnus-data-unread-p (car arts))))
4816 (setq arts (cdr arts)))
4818 (and (or (not unread)
4819 (gnus-data-unread-p (car arts)))
4820 (vectorp (gnus-data-header (car arts)))
4822 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4823 (setq result (car arts)
4825 (setq arts (cdr arts)))
4827 (goto-char (gnus-data-pos result))
4828 (gnus-data-number result))))
4830 (defun gnus-summary-search-forward (&optional unread subject backward)
4831 "Search forward for an article.
4832 If UNREAD, look for unread articles. If SUBJECT, look for
4833 articles with that subject. If BACKWARD, search backward instead."
4834 (cond (subject (gnus-summary-find-subject subject unread backward))
4835 (backward (gnus-summary-find-prev unread))
4836 (t (gnus-summary-find-next unread))))
4838 (defun gnus-recenter (&optional n)
4839 "Center point in window and redisplay frame.
4840 Also do horizontal recentering."
4842 (when (and gnus-auto-center-summary
4843 (not (eq gnus-auto-center-summary 'vertical)))
4844 (gnus-horizontal-recenter))
4847 (defun gnus-summary-recenter ()
4848 "Center point in the summary window.
4849 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4850 displayed, no centering will be performed."
4851 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4852 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4853 (let* ((top (cond ((< (window-height) 4) 0)
4854 ((< (window-height) 7) 1)
4856 (height (1- (window-height)))
4857 (bottom (save-excursion (goto-char (point-max))
4858 (forward-line (- height))
4860 (window (get-buffer-window (current-buffer))))
4861 ;; The user has to want it.
4862 (when gnus-auto-center-summary
4863 (when (get-buffer-window gnus-article-buffer)
4864 ;; Only do recentering when the article buffer is displayed,
4865 ;; Set the window start to either `bottom', which is the biggest
4866 ;; possible valid number, or the second line from the top,
4867 ;; whichever is the least.
4869 window (min bottom (save-excursion
4870 (forward-line (- top)) (point)))))
4871 ;; Do horizontal recentering while we're at it.
4872 (when (and (get-buffer-window (current-buffer) t)
4873 (not (eq gnus-auto-center-summary 'vertical)))
4874 (let ((selected (selected-window)))
4875 (select-window (get-buffer-window (current-buffer) t))
4876 (gnus-summary-position-point)
4877 (gnus-horizontal-recenter)
4878 (select-window selected))))))
4880 (defun gnus-summary-jump-to-group (newsgroup)
4881 "Move point to NEWSGROUP in group mode buffer."
4882 ;; Keep update point of group mode buffer if visible.
4883 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4884 (save-window-excursion
4885 ;; Take care of tree window mode.
4886 (when (get-buffer-window gnus-group-buffer)
4887 (pop-to-buffer gnus-group-buffer))
4888 (gnus-group-jump-to-group newsgroup))
4890 ;; Take care of tree window mode.
4891 (if (get-buffer-window gnus-group-buffer)
4892 (pop-to-buffer gnus-group-buffer)
4893 (set-buffer gnus-group-buffer))
4894 (gnus-group-jump-to-group newsgroup))))
4896 ;; This function returns a list of article numbers based on the
4897 ;; difference between the ranges of read articles in this group and
4898 ;; the range of active articles.
4899 (defun gnus-list-of-unread-articles (group)
4900 (let* ((read (gnus-info-read (gnus-get-info group)))
4901 (active (or (gnus-active group) (gnus-activate-group group)))
4904 ;; If none are read, then all are unread.
4906 (setq first (car active))
4907 ;; If the range of read articles is a single range, then the
4908 ;; first unread article is the article after the last read
4909 ;; article. Sounds logical, doesn't it?
4910 (if (not (listp (cdr read)))
4911 (setq first (1+ (cdr read)))
4912 ;; `read' is a list of ranges.
4913 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4919 (while (< first nlast)
4921 (setq first (1+ first))))
4922 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4923 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4924 (setq read (cdr read)))))
4925 ;; And add the last unread articles.
4926 (while (<= first last)
4928 (setq first (1+ first)))
4929 ;; Return the list of unread articles.
4930 (delq 0 (nreverse unread))))
4932 (defun gnus-list-of-read-articles (group)
4933 "Return a list of unread, unticked and non-dormant articles."
4934 (let* ((info (gnus-get-info group))
4935 (marked (gnus-info-marks info))
4936 (active (gnus-active group)))
4938 (gnus-set-difference
4939 (gnus-sorted-complement
4940 (gnus-uncompress-range active)
4941 (gnus-list-of-unread-articles group))
4943 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4944 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4946 ;; Various summary commands
4948 (defun gnus-summary-select-article-buffer ()
4949 "Reconfigure windows to show article buffer."
4951 (if (not (gnus-buffer-live-p gnus-article-buffer))
4952 (error "There is no article buffer for this summary buffer")
4953 (gnus-configure-windows 'article)
4954 (select-window (get-buffer-window gnus-article-buffer))))
4956 (defun gnus-summary-universal-argument (arg)
4957 "Perform any operation on all articles that are process/prefixed."
4959 (let ((articles (gnus-summary-work-articles arg))
4966 (substitute-command-keys
4967 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4970 (gnus-error 1 "Undefined key")
4973 (gnus-summary-goto-subject (setq article (pop articles)))
4974 (let (gnus-newsgroup-processable)
4975 (command-execute func))
4976 (gnus-summary-remove-process-mark article)))))
4977 (gnus-summary-position-point))
4979 (defun gnus-summary-toggle-truncation (&optional arg)
4980 "Toggle truncation of summary lines.
4981 With arg, turn line truncation on iff arg is positive."
4983 (setq truncate-lines
4984 (if (null arg) (not truncate-lines)
4985 (> (prefix-numeric-value arg) 0)))
4988 (defun gnus-summary-reselect-current-group (&optional all rescan)
4989 "Exit and then reselect the current newsgroup.
4990 The prefix argument ALL means to select all articles."
4992 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4993 (error "Ephemeral groups can't be reselected"))
4994 (let ((current-subject (gnus-summary-article-number))
4995 (group gnus-newsgroup-name))
4996 (setq gnus-newsgroup-begin nil)
4998 ;; We have to adjust the point of group mode buffer because
4999 ;; point was moved to the next unread newsgroup by exiting.
5000 (gnus-summary-jump-to-group group)
5003 (gnus-group-get-new-news-this-group 1)))
5004 (gnus-group-read-group all t)
5005 (gnus-summary-goto-subject current-subject nil t)))
5007 (defun gnus-summary-rescan-group (&optional all)
5008 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5010 (gnus-summary-reselect-current-group all t))
5012 (defun gnus-summary-update-info (&optional non-destructive)
5014 (let ((group gnus-newsgroup-name))
5016 (when gnus-newsgroup-kill-headers
5017 (setq gnus-newsgroup-killed
5018 (gnus-compress-sequence
5020 (gnus-set-sorted-intersection
5021 (gnus-uncompress-range gnus-newsgroup-killed)
5022 (setq gnus-newsgroup-unselected
5023 (sort gnus-newsgroup-unselected '<)))
5024 (setq gnus-newsgroup-unreads
5025 (sort gnus-newsgroup-unreads '<)))
5027 (unless (listp (cdr gnus-newsgroup-killed))
5028 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5029 (let ((headers gnus-newsgroup-headers))
5030 (when (and (not gnus-save-score)
5031 (not non-destructive))
5032 (setq gnus-newsgroup-scored nil))
5033 ;; Set the new ranges of read articles.
5035 (set-buffer gnus-group-buffer)
5036 (gnus-undo-force-boundary))
5037 (gnus-update-read-articles
5038 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5039 ;; Set the current article marks.
5041 ;; Do the cross-ref thing.
5042 (when gnus-use-cross-reference
5043 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5044 ;; Do not switch windows but change the buffer to work.
5045 (set-buffer gnus-group-buffer)
5046 (unless (gnus-ephemeral-group-p group)
5047 (gnus-group-update-group group)))))))
5049 (defun gnus-summary-save-newsrc (&optional force)
5050 "Save the current number of read/marked articles in the dribble buffer.
5051 The dribble buffer will then be saved.
5052 If FORCE (the prefix), also save the .newsrc file(s)."
5054 (gnus-summary-update-info t)
5056 (gnus-save-newsrc-file)
5057 (gnus-dribble-save)))
5059 (defun gnus-summary-exit (&optional temporary)
5060 "Exit reading current newsgroup, and then return to group selection mode.
5061 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5063 (gnus-kill-save-kill-buffer)
5064 (let* ((group gnus-newsgroup-name)
5065 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5068 (buf (current-buffer)))
5069 (run-hooks 'gnus-summary-prepare-exit-hook)
5070 ;; If we have several article buffers, we kill them at exit.
5071 (unless gnus-single-article-buffer
5072 (gnus-kill-buffer gnus-original-article-buffer)
5073 (setq gnus-article-current nil))
5074 (when gnus-use-cache
5075 (gnus-cache-possibly-remove-articles)
5076 (gnus-cache-save-buffers))
5077 (gnus-async-prefetch-remove-group group)
5078 (when gnus-suppress-duplicates
5079 (gnus-dup-enter-articles))
5080 (when gnus-use-trees
5081 (gnus-tree-close group))
5082 ;; Remove entries for this group.
5083 (nnmail-purge-split-history group)
5084 ;; Make all changes in this group permanent.
5086 (run-hooks 'gnus-exit-group-hook)
5087 (gnus-summary-update-info)
5088 ;; Do adaptive scoring, and possibly save score files.
5089 (when gnus-newsgroup-adaptive
5090 (gnus-score-adaptive))
5091 (when gnus-use-scoring
5093 (gnus-close-group group)
5094 ;; Make sure where we were, and go to next newsgroup.
5095 (set-buffer gnus-group-buffer)
5097 (gnus-group-jump-to-group group))
5098 (run-hooks 'gnus-summary-exit-hook)
5099 (unless (or quit-config
5100 ;; If this group has disappeared from the summary
5101 ;; buffer, don't skip forwards.
5102 (not (string= group (gnus-group-group-name))))
5103 (gnus-group-next-unread-group 1))
5104 (setq group-point (point))
5107 ;; If we have several article buffers, we kill them at exit.
5108 (unless gnus-single-article-buffer
5109 (gnus-kill-buffer gnus-article-buffer)
5110 (gnus-kill-buffer gnus-original-article-buffer)
5111 (setq gnus-article-current nil))
5113 (if (not gnus-kill-summary-on-exit)
5114 (gnus-deaden-summary)
5115 ;; We set all buffer-local variables to nil. It is unclear why
5116 ;; this is needed, but if we don't, buffer-local variables are
5117 ;; not garbage-collected, it seems. This would the lead to en
5118 ;; ever-growing Emacs.
5119 (gnus-summary-clear-local-variables)
5120 (when (get-buffer gnus-article-buffer)
5121 (bury-buffer gnus-article-buffer))
5122 ;; We clear the global counterparts of the buffer-local
5123 ;; variables as well, just to be on the safe side.
5124 (set-buffer gnus-group-buffer)
5125 (gnus-summary-clear-local-variables)
5126 ;; Return to group mode buffer.
5127 (when (eq mode 'gnus-summary-mode)
5128 (gnus-kill-buffer buf)))
5129 (setq gnus-current-select-method gnus-select-method)
5130 (pop-to-buffer gnus-group-buffer)
5131 ;; Clear the current group name.
5132 (if (not quit-config)
5134 (goto-char group-point)
5135 (gnus-configure-windows 'group 'force))
5136 (gnus-handle-ephemeral-exit quit-config))
5138 (setq gnus-newsgroup-name nil)))))
5140 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5141 (defun gnus-summary-exit-no-update (&optional no-questions)
5142 "Quit reading current newsgroup without updating read article info."
5144 (let* ((group gnus-newsgroup-name)
5145 (quit-config (gnus-group-quit-config group)))
5146 (when (or no-questions
5148 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5149 ;; If we have several article buffers, we kill them at exit.
5150 (unless gnus-single-article-buffer
5151 (gnus-kill-buffer gnus-article-buffer)
5152 (gnus-kill-buffer gnus-original-article-buffer)
5153 (setq gnus-article-current nil))
5154 (if (not gnus-kill-summary-on-exit)
5155 (gnus-deaden-summary)
5156 (gnus-close-group group)
5157 (gnus-summary-clear-local-variables)
5158 (set-buffer gnus-group-buffer)
5159 (gnus-summary-clear-local-variables)
5160 (when (get-buffer gnus-summary-buffer)
5161 (kill-buffer gnus-summary-buffer)))
5162 (unless gnus-single-article-buffer
5163 (setq gnus-article-current nil))
5164 (when gnus-use-trees
5165 (gnus-tree-close group))
5166 (gnus-async-prefetch-remove-group group)
5167 (when (get-buffer gnus-article-buffer)
5168 (bury-buffer gnus-article-buffer))
5169 ;; Return to the group buffer.
5170 (gnus-configure-windows 'group 'force)
5171 ;; Clear the current group name.
5172 (setq gnus-newsgroup-name nil)
5173 (when (equal (gnus-group-group-name) group)
5174 (gnus-group-next-unread-group 1))
5176 (gnus-handle-ephemeral-exit quit-config)))))
5178 (defun gnus-handle-ephemeral-exit (quit-config)
5179 "Handle movement when leaving an ephemeral group. The state
5180 which existed when entering the ephemeral is reset."
5181 (if (not (buffer-name (car quit-config)))
5182 (gnus-configure-windows 'group 'force)
5183 (set-buffer (car quit-config))
5184 (cond ((eq major-mode 'gnus-summary-mode)
5185 (gnus-set-global-variables))
5186 ((eq major-mode 'gnus-article-mode)
5188 ;; The `gnus-summary-buffer' variable may point
5189 ;; to the old summary buffer when using a single
5191 (unless (gnus-buffer-live-p gnus-summary-buffer)
5192 (set-buffer gnus-group-buffer))
5193 (set-buffer gnus-summary-buffer)
5194 (gnus-set-global-variables))))
5195 (if (or (eq (cdr quit-config) 'article)
5196 (eq (cdr quit-config) 'pick))
5198 ;; The current article may be from the ephemeral group
5199 ;; thus it is best that we reload this article
5200 (gnus-summary-show-article)
5201 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5202 (gnus-configure-windows 'pick 'force)
5203 (gnus-configure-windows (cdr quit-config) 'force)))
5204 (gnus-configure-windows (cdr quit-config) 'force))
5205 (when (eq major-mode 'gnus-summary-mode)
5206 (gnus-summary-next-subject 1 nil t)
5207 (gnus-summary-recenter)
5208 (gnus-summary-position-point))))
5212 (defvar gnus-dead-summary-mode-map nil)
5214 (unless gnus-dead-summary-mode-map
5215 (setq gnus-dead-summary-mode-map (make-keymap))
5216 (suppress-keymap gnus-dead-summary-mode-map)
5217 (substitute-key-definition
5218 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5219 (let ((keys '("\C-d" "\r" "\177" [delete])))
5221 (define-key gnus-dead-summary-mode-map
5222 (pop keys) 'gnus-summary-wake-up-the-dead))))
5224 (defvar gnus-dead-summary-mode nil
5225 "Minor mode for Gnus summary buffers.")
5227 (defun gnus-dead-summary-mode (&optional arg)
5228 "Minor mode for Gnus summary buffers."
5230 (when (eq major-mode 'gnus-summary-mode)
5231 (make-local-variable 'gnus-dead-summary-mode)
5232 (setq gnus-dead-summary-mode
5233 (if (null arg) (not gnus-dead-summary-mode)
5234 (> (prefix-numeric-value arg) 0)))
5235 (when gnus-dead-summary-mode
5236 (gnus-add-minor-mode
5237 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5239 (defun gnus-deaden-summary ()
5240 "Make the current summary buffer into a dead summary buffer."
5241 ;; Kill any previous dead summary buffer.
5242 (when (and gnus-dead-summary
5243 (buffer-name gnus-dead-summary))
5245 (set-buffer gnus-dead-summary)
5246 (when gnus-dead-summary-mode
5247 (kill-buffer (current-buffer)))))
5248 ;; Make this the current dead summary.
5249 (setq gnus-dead-summary (current-buffer))
5250 (gnus-dead-summary-mode 1)
5251 (let ((name (buffer-name)))
5252 (when (string-match "Summary" name)
5254 (concat (substring name 0 (match-beginning 0)) "Dead "
5255 (substring name (match-beginning 0)))
5258 (defun gnus-kill-or-deaden-summary (buffer)
5259 "Kill or deaden the summary BUFFER."
5261 (when (and (buffer-name buffer)
5262 (not gnus-single-article-buffer))
5265 (gnus-kill-buffer gnus-article-buffer)
5266 (gnus-kill-buffer gnus-original-article-buffer)))
5267 (cond (gnus-kill-summary-on-exit
5268 (when (and gnus-use-trees
5269 (and (get-buffer buffer)
5270 (buffer-name (get-buffer buffer))))
5272 (set-buffer (get-buffer buffer))
5273 (gnus-tree-close gnus-newsgroup-name)))
5274 (gnus-kill-buffer buffer))
5275 ((and (get-buffer buffer)
5276 (buffer-name (get-buffer buffer)))
5279 (gnus-deaden-summary))))))
5281 (defun gnus-summary-wake-up-the-dead (&rest args)
5282 "Wake up the dead summary buffer."
5284 (gnus-dead-summary-mode -1)
5285 (let ((name (buffer-name)))
5286 (when (string-match "Dead " name)
5288 (concat (substring name 0 (match-beginning 0))
5289 (substring name (match-end 0)))
5291 (gnus-message 3 "This dead summary is now alive again"))
5293 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5294 (defun gnus-summary-fetch-faq (&optional faq-dir)
5295 "Fetch the FAQ for the current group.
5296 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5300 (when current-prefix-arg
5302 "Faq dir: " (and (listp gnus-group-faq-directory)
5303 (mapcar (lambda (file) (list file))
5304 gnus-group-faq-directory))))))
5305 (let (gnus-faq-buffer)
5306 (when (setq gnus-faq-buffer
5307 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5308 (gnus-configure-windows 'summary-faq))))
5310 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5311 (defun gnus-summary-describe-group (&optional force)
5312 "Describe the current newsgroup."
5314 (gnus-group-describe-group force gnus-newsgroup-name))
5316 (defun gnus-summary-describe-briefly ()
5317 "Describe summary mode commands briefly."
5320 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
5322 ;; Walking around group mode buffer from summary mode.
5324 (defun gnus-summary-next-group (&optional no-article target-group backward)
5325 "Exit current newsgroup and then select next unread newsgroup.
5326 If prefix argument NO-ARTICLE is non-nil, no article is selected
5327 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5328 previous group instead."
5330 ;; Stop pre-fetching.
5331 (gnus-async-halt-prefetch)
5332 (let ((current-group gnus-newsgroup-name)
5333 (current-buffer (current-buffer))
5335 ;; First we semi-exit this group to update Xrefs and all variables.
5336 ;; We can't do a real exit, because the window conf must remain
5337 ;; the same in case the user is prompted for info, and we don't
5338 ;; want the window conf to change before that...
5339 (gnus-summary-exit t)
5340 (while (not entered)
5341 ;; Then we find what group we are supposed to enter.
5342 (set-buffer gnus-group-buffer)
5343 (gnus-group-jump-to-group current-group)
5346 (if (eq gnus-keep-same-level 'best)
5347 (gnus-summary-best-group gnus-newsgroup-name)
5348 (gnus-summary-search-group backward gnus-keep-same-level))))
5349 (if (not target-group)
5350 ;; There are no further groups, so we return to the group
5353 (gnus-message 5 "Returning to the group buffer")
5355 (when (gnus-buffer-live-p current-buffer)
5356 (set-buffer current-buffer)
5357 (gnus-summary-exit))
5358 (run-hooks 'gnus-group-no-more-groups-hook))
5359 ;; We try to enter the target group.
5360 (gnus-group-jump-to-group target-group)
5361 (let ((unreads (gnus-group-group-unread)))
5362 (if (and (or (eq t unreads)
5363 (and unreads (not (zerop unreads))))
5364 (gnus-summary-read-group
5365 target-group nil no-article
5366 (and (buffer-name current-buffer) current-buffer)))
5368 (setq current-group target-group
5369 target-group nil)))))))
5371 (defun gnus-summary-prev-group (&optional no-article)
5372 "Exit current newsgroup and then select previous unread newsgroup.
5373 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5375 (gnus-summary-next-group no-article nil t))
5377 ;; Walking around summary lines.
5379 (defun gnus-summary-first-subject (&optional unread)
5380 "Go to the first unread subject.
5381 If UNREAD is non-nil, go to the first unread article.
5382 Returns the article selected or nil if there are no unread articles."
5387 ((null gnus-newsgroup-data)
5388 (gnus-message 3 "No articles in the group")
5390 ;; Pick the first article.
5392 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5393 (gnus-data-number (car gnus-newsgroup-data)))
5394 ;; No unread articles.
5395 ((null gnus-newsgroup-unreads)
5396 (gnus-message 3 "No more unread articles")
5398 ;; Find the first unread article.
5400 (let ((data gnus-newsgroup-data))
5402 (not (gnus-data-unread-p (car data))))
5403 (setq data (cdr data)))
5405 (goto-char (gnus-data-pos (car data)))
5406 (gnus-data-number (car data))))))
5407 (gnus-summary-position-point)))
5409 (defun gnus-summary-next-subject (n &optional unread dont-display)
5410 "Go to next N'th summary line.
5411 If N is negative, go to the previous N'th subject line.
5412 If UNREAD is non-nil, only unread articles are selected.
5413 The difference between N and the actual number of steps taken is
5416 (let ((backward (< n 0))
5420 (gnus-summary-find-prev unread)
5421 (gnus-summary-find-next unread)))
5424 (gnus-message 7 "No more%s articles"
5425 (if unread " unread" "")))
5426 (unless dont-display
5427 (gnus-summary-recenter)
5428 (gnus-summary-position-point))
5431 (defun gnus-summary-next-unread-subject (n)
5432 "Go to next N'th unread summary line."
5434 (gnus-summary-next-subject n t))
5436 (defun gnus-summary-prev-subject (n &optional unread)
5437 "Go to previous N'th summary line.
5438 If optional argument UNREAD is non-nil, only unread article is selected."
5440 (gnus-summary-next-subject (- n) unread))
5442 (defun gnus-summary-prev-unread-subject (n)
5443 "Go to previous N'th unread summary line."
5445 (gnus-summary-next-subject (- n) t))
5447 (defun gnus-summary-goto-subject (article &optional force silent)
5448 "Go the subject line of ARTICLE.
5449 If FORCE, also allow jumping to articles not currently shown."
5450 (interactive "nArticle number: ")
5452 (data (gnus-data-find article)))
5453 ;; We read in the article if we have to.
5456 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5457 (setq data (gnus-data-find article)))
5462 (gnus-message 3 "Can't find article %d" article))
5464 (goto-char (gnus-data-pos data))
5467 ;; Walking around summary lines with displaying articles.
5469 (defun gnus-summary-expand-window (&optional arg)
5470 "Make the summary buffer take up the entire Emacs frame.
5471 Given a prefix, will force an `article' buffer configuration."
5474 (gnus-configure-windows 'article 'force)
5475 (gnus-configure-windows 'summary 'force)))
5477 (defun gnus-summary-display-article (article &optional all-header)
5478 "Display ARTICLE in article buffer."
5479 (gnus-set-global-variables)
5483 (if gnus-summary-display-article-function
5484 (funcall gnus-summary-display-article-function article all-header)
5485 (gnus-article-prepare article all-header))
5486 (run-hooks 'gnus-select-article-hook)
5487 (when (and gnus-current-article
5488 (not (zerop gnus-current-article)))
5489 (gnus-summary-goto-subject gnus-current-article))
5490 (gnus-summary-recenter)
5491 (when (and gnus-use-trees gnus-show-threads)
5492 (gnus-possibly-generate-tree article)
5493 (gnus-highlight-selected-tree article))
5494 ;; Successfully display article.
5495 (gnus-article-set-window-start
5496 (cdr (assq article gnus-newsgroup-bookmarks))))))
5498 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5499 "Select the current article.
5500 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5501 non-nil, the article will be re-fetched even if it already present in
5502 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5504 ;; Make sure we are in the summary buffer to work around bbdb bug.
5505 (unless (eq major-mode 'gnus-summary-mode)
5506 (set-buffer gnus-summary-buffer))
5507 (let ((article (or article (gnus-summary-article-number)))
5508 (all-headers (not (not all-headers))) ;Must be T or NIL.
5509 gnus-summary-display-article-function
5512 (gnus-summary-article-pseudo-p article)
5513 (error "This is a pseudo-article"))
5516 (set-buffer gnus-summary-buffer)
5517 (if (or (and gnus-single-article-buffer
5518 (or (null gnus-current-article)
5519 (null gnus-article-current)
5520 (null (get-buffer gnus-article-buffer))
5521 (not (eq article (cdr gnus-article-current)))
5522 (not (equal (car gnus-article-current)
5523 gnus-newsgroup-name))))
5524 (and (not gnus-single-article-buffer)
5525 (or (null gnus-current-article)
5526 (not (eq gnus-current-article article))))
5528 ;; The requested article is different from the current article.
5530 (gnus-summary-display-article article all-headers)
5532 (when (or all-headers gnus-show-all-headers)
5533 (gnus-article-show-all-headers))
5536 (gnus-article-set-window-start
5537 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5539 (defun gnus-summary-set-current-mark (&optional current-mark)
5540 "Obsolete function."
5543 (defun gnus-summary-next-article (&optional unread subject backward push)
5544 "Select the next article.
5545 If UNREAD, only unread articles are selected.
5546 If SUBJECT, only articles with SUBJECT are selected.
5547 If BACKWARD, the previous article is selected instead of the next."
5550 ;; Is there such an article?
5551 ((and (gnus-summary-search-forward unread subject backward)
5552 (or (gnus-summary-display-article (gnus-summary-article-number))
5553 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5554 (gnus-summary-position-point))
5555 ;; If not, we try the first unread, if that is wanted.
5557 gnus-auto-select-same
5558 (gnus-summary-first-unread-article))
5559 (gnus-summary-position-point)
5560 (gnus-message 6 "Wrapped"))
5561 ;; Try to get next/previous article not displayed in this group.
5562 ((and gnus-auto-extend-newsgroup
5563 (not unread) (not subject))
5564 (gnus-summary-goto-article
5565 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5567 ;; Go to next/previous group.
5569 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5570 (gnus-summary-jump-to-group gnus-newsgroup-name))
5571 (let ((cmd last-command-char)
5574 (set-buffer gnus-group-buffer)
5577 (if (eq gnus-keep-same-level 'best)
5578 (gnus-summary-best-group gnus-newsgroup-name)
5579 (gnus-summary-search-group backward gnus-keep-same-level))))
5580 ;; For some reason, the group window gets selected. We change
5582 (select-window (get-buffer-window (current-buffer)))
5583 ;; Select next unread newsgroup automagically.
5585 ((or (not gnus-auto-select-next)
5587 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5588 ((or (eq gnus-auto-select-next 'quietly)
5589 (and (eq gnus-auto-select-next 'slightly-quietly)
5591 (and (eq gnus-auto-select-next 'almost-quietly)
5592 (gnus-summary-last-article-p)))
5594 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5596 (gnus-message 7 "No more%s articles (%s)..."
5597 (if unread " unread" "")
5598 (if group (concat "selecting " group)
5600 (gnus-summary-next-group nil group backward)))
5602 (when (gnus-key-press-event-p last-input-event)
5603 (gnus-summary-walk-group-buffer
5604 gnus-newsgroup-name cmd unread backward point))))))))
5606 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5607 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5608 (?\C-p (gnus-group-prev-unread-group 1))))
5609 (cursor-in-echo-area t)
5610 keve key group ended)
5612 (set-buffer gnus-group-buffer)
5615 (if (eq gnus-keep-same-level 'best)
5616 (gnus-summary-best-group gnus-newsgroup-name)
5617 (gnus-summary-search-group backward gnus-keep-same-level))))
5620 5 "No more%s articles%s" (if unread " unread" "")
5622 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5623 (format " (Type %s for %s [%s])"
5624 (single-key-description cmd) group
5625 (car (gnus-gethash group gnus-newsrc-hashtb)))
5626 (format " (Type %s to exit %s)"
5627 (single-key-description cmd)
5628 gnus-newsgroup-name)))
5629 ;; Confirm auto selection.
5630 (setq key (car (setq keve (gnus-read-event-char))))
5633 ((assq key keystrokes)
5634 (let ((obuf (current-buffer)))
5635 (switch-to-buffer gnus-group-buffer)
5637 (gnus-group-jump-to-group group))
5638 (eval (cadr (assq key keystrokes)))
5639 (setq group (gnus-group-group-name))
5640 (switch-to-buffer obuf))
5644 (gnus-ephemeral-group-p gnus-newsgroup-name))
5646 (gnus-summary-next-group nil group backward)))
5648 (push (cdr keve) unread-command-events))))))
5650 (defun gnus-summary-next-unread-article ()
5651 "Select unread article after current one."
5653 (gnus-summary-next-article
5654 (or (not (eq gnus-summary-goto-unread 'never))
5655 (gnus-summary-last-article-p (gnus-summary-article-number)))
5656 (and gnus-auto-select-same
5657 (gnus-summary-article-subject))))
5659 (defun gnus-summary-prev-article (&optional unread subject)
5660 "Select the article after the current one.
5661 If UNREAD is non-nil, only unread articles are selected."
5663 (gnus-summary-next-article unread subject t))
5665 (defun gnus-summary-prev-unread-article ()
5666 "Select unread article before current one."
5668 (gnus-summary-prev-article
5669 (or (not (eq gnus-summary-goto-unread 'never))
5670 (gnus-summary-first-article-p (gnus-summary-article-number)))
5671 (and gnus-auto-select-same
5672 (gnus-summary-article-subject))))
5674 (defun gnus-summary-next-page (&optional lines circular)
5675 "Show next page of the selected article.
5676 If at the end of the current article, select the next article.
5677 LINES says how many lines should be scrolled up.
5679 If CIRCULAR is non-nil, go to the start of the article instead of
5680 selecting the next article when reaching the end of the current
5683 (setq gnus-summary-buffer (current-buffer))
5684 (gnus-set-global-variables)
5685 (let ((article (gnus-summary-article-number))
5686 (article-window (get-buffer-window gnus-article-buffer t))
5688 (gnus-configure-windows 'article)
5689 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5690 (if (and (eq gnus-summary-goto-unread 'never)
5691 (not (gnus-summary-last-article-p article)))
5692 (gnus-summary-next-article)
5693 (gnus-summary-next-unread-article))
5694 (if (or (null gnus-current-article)
5695 (null gnus-article-current)
5696 (/= article (cdr gnus-article-current))
5697 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5698 ;; Selected subject is different from current article's.
5699 (gnus-summary-display-article article)
5700 (when article-window
5701 (gnus-eval-in-buffer-window gnus-article-buffer
5702 (setq endp (gnus-article-next-page lines)))
5705 (gnus-summary-beginning-of-article))
5707 (gnus-message 3 "End of message"))
5709 (if (and (eq gnus-summary-goto-unread 'never)
5710 (not (gnus-summary-last-article-p article)))
5711 (gnus-summary-next-article)
5712 (gnus-summary-next-unread-article))))))))
5713 (gnus-summary-recenter)
5714 (gnus-summary-position-point)))
5716 (defun gnus-summary-prev-page (&optional lines move)
5717 "Show previous page of selected article.
5718 Argument LINES specifies lines to be scrolled down.
5719 If MOVE, move to the previous unread article if point is at
5720 the beginning of the buffer."
5722 (let ((article (gnus-summary-article-number))
5723 (article-window (get-buffer-window gnus-article-buffer t))
5725 (gnus-configure-windows 'article)
5726 (if (or (null gnus-current-article)
5727 (null gnus-article-current)
5728 (/= article (cdr gnus-article-current))
5729 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5730 ;; Selected subject is different from current article's.
5731 (gnus-summary-display-article article)
5732 (gnus-summary-recenter)
5733 (when article-window
5734 (gnus-eval-in-buffer-window gnus-article-buffer
5735 (setq endp (gnus-article-prev-page lines)))
5736 (when (and move endp)
5738 (gnus-message 3 "Beginning of message"))
5740 (if (and (eq gnus-summary-goto-unread 'never)
5741 (not (gnus-summary-first-article-p article)))
5742 (gnus-summary-prev-article)
5743 (gnus-summary-prev-unread-article))))))))
5744 (gnus-summary-position-point))
5746 (defun gnus-summary-prev-page-or-article (&optional lines)
5747 "Show previous page of selected article.
5748 Argument LINES specifies lines to be scrolled down.
5749 If at the beginning of the article, go to the next article."
5751 (gnus-summary-prev-page lines t))
5753 (defun gnus-summary-scroll-up (lines)
5754 "Scroll up (or down) one line current article.
5755 Argument LINES specifies lines to be scrolled up (or down if negative)."
5757 (gnus-configure-windows 'article)
5758 (gnus-summary-show-thread)
5759 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5760 (gnus-eval-in-buffer-window gnus-article-buffer
5762 (when (gnus-article-next-page lines)
5763 (gnus-message 3 "End of message")))
5765 (gnus-article-prev-page (- lines))))))
5766 (gnus-summary-recenter)
5767 (gnus-summary-position-point))
5769 (defun gnus-summary-next-same-subject ()
5770 "Select next article which has the same subject as current one."
5772 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5774 (defun gnus-summary-prev-same-subject ()
5775 "Select previous article which has the same subject as current one."
5777 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5779 (defun gnus-summary-next-unread-same-subject ()
5780 "Select next unread article which has the same subject as current one."
5782 (gnus-summary-next-article t (gnus-summary-article-subject)))
5784 (defun gnus-summary-prev-unread-same-subject ()
5785 "Select previous unread article which has the same subject as current one."
5787 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5789 (defun gnus-summary-first-unread-article ()
5790 "Select the first unread article.
5791 Return nil if there are no unread articles."
5794 (when (gnus-summary-first-subject t)
5795 (gnus-summary-show-thread)
5796 (gnus-summary-first-subject t)
5797 (gnus-summary-display-article (gnus-summary-article-number)))
5798 (gnus-summary-position-point)))
5800 (defun gnus-summary-first-article ()
5801 "Select the first article.
5802 Return nil if there are no articles."
5805 (when (gnus-summary-first-subject)
5806 (gnus-summary-show-thread)
5807 (gnus-summary-first-subject)
5808 (gnus-summary-display-article (gnus-summary-article-number)))
5809 (gnus-summary-position-point)))
5811 (defun gnus-summary-best-unread-article ()
5812 "Select the unread article with the highest score."
5814 (let ((best -1000000)
5815 (data gnus-newsgroup-data)
5818 (and (gnus-data-unread-p (car data))
5820 (gnus-summary-article-score (gnus-data-number (car data))))
5823 article (gnus-data-number (car data))))
5824 (setq data (cdr data)))
5827 (gnus-summary-goto-article article)
5828 (error "No unread articles"))
5829 (gnus-summary-position-point))))
5831 (defun gnus-summary-last-subject ()
5832 "Go to the last displayed subject line in the group."
5833 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5835 (gnus-summary-goto-subject article))))
5837 (defun gnus-summary-goto-article (article &optional all-headers force)
5838 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5839 If ALL-HEADERS is non-nil, no header lines are hidden."
5843 "Article number or Message-ID: "
5844 (mapcar (lambda (number) (list (int-to-string number)))
5845 gnus-newsgroup-limit))
5849 (if (and (stringp article)
5850 (string-match "@" article))
5851 (gnus-summary-refer-article article)
5852 (when (stringp article)
5853 (setq article (string-to-number article)))
5854 (if (gnus-summary-goto-subject article force)
5855 (gnus-summary-display-article article all-headers)
5856 (gnus-message 4 "Couldn't go to article %s" article) nil))
5857 (gnus-summary-position-point)))
5859 (defun gnus-summary-goto-last-article ()
5860 "Go to the previously read article."
5863 (when gnus-last-article
5864 (gnus-summary-goto-article gnus-last-article))
5865 (gnus-summary-position-point)))
5867 (defun gnus-summary-pop-article (number)
5868 "Pop one article off the history and go to the previous.
5869 NUMBER articles will be popped off."
5872 (setq gnus-newsgroup-history
5873 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5875 (gnus-summary-goto-article (car to) nil t)
5876 (error "Article history empty")))
5877 (gnus-summary-position-point))
5879 ;; Summary commands and functions for limiting the summary buffer.
5881 (defun gnus-summary-limit-to-articles (n)
5882 "Limit the summary buffer to the next N articles.
5883 If not given a prefix, use the process marked articles instead."
5886 (let ((articles (gnus-summary-work-articles n)))
5887 (setq gnus-newsgroup-processable nil)
5888 (gnus-summary-limit articles))
5889 (gnus-summary-position-point)))
5891 (defun gnus-summary-pop-limit (&optional total)
5892 "Restore the previous limit.
5893 If given a prefix, remove all limits."
5896 (setq gnus-newsgroup-limits
5897 (list (mapcar (lambda (h) (mail-header-number h))
5898 gnus-newsgroup-headers))))
5899 (unless gnus-newsgroup-limits
5900 (error "No limit to pop"))
5902 (gnus-summary-limit nil 'pop)
5903 (gnus-summary-position-point)))
5905 (defun gnus-summary-limit-to-subject (subject &optional header)
5906 "Limit the summary buffer to articles that have subjects that match a regexp."
5907 (interactive "sLimit to subject (regexp): ")
5909 (setq header "subject"))
5910 (when (not (equal "" subject))
5912 (let ((articles (gnus-summary-find-matching
5913 (or header "subject") subject 'all)))
5915 (error "Found no matches for \"%s\"" subject))
5916 (gnus-summary-limit articles))
5917 (gnus-summary-position-point))))
5919 (defun gnus-summary-limit-to-author (from)
5920 "Limit the summary buffer to articles that have authors that match a regexp."
5921 (interactive "sLimit to author (regexp): ")
5922 (gnus-summary-limit-to-subject from "from"))
5924 (defun gnus-summary-limit-to-age (age &optional younger-p)
5925 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5926 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5927 articles that are younger than AGE days."
5928 (interactive "nTime in days: \nP")
5930 (let ((data gnus-newsgroup-data)
5931 (cutoff (nnmail-days-to-time age))
5932 articles d date is-younger)
5933 (while (setq d (pop data))
5934 (when (and (vectorp (gnus-data-header d))
5935 (setq date (mail-header-date (gnus-data-header d))))
5936 (setq is-younger (nnmail-time-less
5937 (nnmail-time-since (nnmail-date-to-time date))
5939 (when (if younger-p is-younger (not is-younger))
5940 (push (gnus-data-number d) articles))))
5941 (gnus-summary-limit (nreverse articles)))
5942 (gnus-summary-position-point)))
5944 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5946 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5948 (defun gnus-summary-limit-to-unread (&optional all)
5949 "Limit the summary buffer to articles that are not marked as read.
5950 If ALL is non-nil, limit strictly to unread articles."
5953 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5954 (gnus-summary-limit-to-marks
5955 ;; Concat all the marks that say that an article is read and have
5957 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5958 gnus-killed-mark gnus-kill-file-mark
5959 gnus-low-score-mark gnus-expirable-mark
5960 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5961 gnus-duplicate-mark gnus-souped-mark)
5964 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5965 (make-obsolete 'gnus-summary-delete-marked-with
5966 'gnus-summary-limit-exlude-marks)
5968 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5969 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5970 If REVERSE, limit the summary buffer to articles that are marked
5971 with MARKS. MARKS can either be a string of marks or a list of marks.
5972 Returns how many articles were removed."
5973 (interactive "sMarks: ")
5974 (gnus-summary-limit-to-marks marks t))
5976 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5977 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5978 If REVERSE (the prefix), limit the summary buffer to articles that are
5979 not marked with MARKS. MARKS can either be a string of marks or a
5981 Returns how many articles were removed."
5982 (interactive "sMarks: \nP")
5984 (let ((data gnus-newsgroup-data)
5985 (marks (if (listp marks) marks
5986 (append marks nil))) ; Transform to list.
5989 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5990 (memq (gnus-data-mark (car data)) marks))
5991 (push (gnus-data-number (car data)) articles))
5992 (setq data (cdr data)))
5993 (gnus-summary-limit articles))
5994 (gnus-summary-position-point)))
5996 (defun gnus-summary-limit-to-score (&optional score)
5997 "Limit to articles with score at or above SCORE."
5999 (setq score (if score
6000 (prefix-numeric-value score)
6001 (or gnus-summary-default-score 0)))
6002 (let ((data gnus-newsgroup-data)
6005 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6007 (push (gnus-data-number (car data)) articles))
6008 (setq data (cdr data)))
6010 (gnus-summary-limit articles)
6011 (gnus-summary-position-point))))
6013 (defun gnus-summary-limit-include-thread (id)
6014 "Display all the hidden articles that in the current thread."
6015 (interactive (list (mail-header-id (gnus-summary-article-header))))
6016 (let ((articles (gnus-articles-in-thread
6017 (gnus-id-to-thread (gnus-root-id id)))))
6019 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6020 (gnus-summary-position-point))))
6022 (defun gnus-summary-limit-include-dormant ()
6023 "Display all the hidden articles that are marked as dormant.
6024 Note that this command only works on a subset of the articles currently
6025 fetched for this group."
6027 (unless gnus-newsgroup-dormant
6028 (error "There are no dormant articles in this group"))
6030 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6031 (gnus-summary-position-point)))
6033 (defun gnus-summary-limit-exclude-dormant ()
6034 "Hide all dormant articles."
6037 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6038 (gnus-summary-position-point)))
6040 (defun gnus-summary-limit-exclude-childless-dormant ()
6041 "Hide all dormant articles that have no children."
6043 (let ((data (gnus-data-list t))
6044 articles d children)
6045 ;; Find all articles that are either not dormant or have
6047 (while (setq d (pop data))
6048 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6050 (gnus-article-children (gnus-data-number d)))
6053 (when (memq (car children) articles)
6058 (push (gnus-data-number d) articles)))
6061 (gnus-summary-limit articles)
6062 (gnus-summary-position-point))))
6064 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6065 "Mark all unread excluded articles as read.
6066 If ALL, mark even excluded ticked and dormants as read."
6068 (let ((articles (gnus-sorted-complement
6070 (mapcar (lambda (h) (mail-header-number h))
6071 gnus-newsgroup-headers)
6073 (sort gnus-newsgroup-limit '<)))
6075 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
6077 (setq gnus-newsgroup-dormant nil
6078 gnus-newsgroup-marked nil
6079 gnus-newsgroup-reads
6081 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6082 gnus-newsgroup-reads))
6083 (while (setq article (pop articles))
6084 (unless (or (memq article gnus-newsgroup-dormant)
6085 (memq article gnus-newsgroup-marked))
6086 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6088 (defun gnus-summary-limit (articles &optional pop)
6090 ;; We pop the previous limit off the stack and use that.
6091 (setq articles (car gnus-newsgroup-limits)
6092 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6093 ;; We use the new limit, so we push the old limit on the stack.
6094 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6096 (setq gnus-newsgroup-limit articles)
6097 (let ((total (length gnus-newsgroup-data))
6098 (data (gnus-data-find-list (gnus-summary-article-number)))
6099 (gnus-summary-mark-below nil) ; Inhibit this.
6101 ;; This will do all the work of generating the new summary buffer
6102 ;; according to the new limit.
6103 (gnus-summary-prepare)
6104 ;; Hide any threads, possibly.
6105 (and gnus-show-threads
6106 gnus-thread-hide-subtree
6107 (gnus-summary-hide-all-threads))
6108 ;; Try to return to the article you were at, or one in the
6111 ;; We try to find some article after the current one.
6113 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6116 (setq data (cdr data))))
6118 ;; If there is no data, that means that we were after the last
6119 ;; article. The same goes when we can't find any articles
6120 ;; after the current one.
6121 (goto-char (point-max))
6122 (gnus-summary-find-prev))
6123 ;; We return how many articles were removed from the summary
6124 ;; buffer as a result of the new limit.
6125 (- total (length gnus-newsgroup-data))))
6127 (defsubst gnus-invisible-cut-children (threads)
6130 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6135 (defsubst gnus-cut-thread (thread)
6136 "Go forwards in the thread until we find an article that we want to display."
6137 (when (or (eq gnus-fetch-old-headers 'some)
6138 (eq gnus-fetch-old-headers 'invisible)
6139 (eq gnus-build-sparse-threads 'some)
6140 (eq gnus-build-sparse-threads 'more))
6141 ;; Deal with old-fetched headers and sparse threads.
6145 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6146 (gnus-summary-article-ancient-p
6147 (mail-header-number (car thread))))
6148 (if (or (<= (length (cdr thread)) 1)
6149 (eq gnus-fetch-old-headers 'invisible))
6150 (setq gnus-newsgroup-limit
6151 (delq (mail-header-number (car thread))
6152 gnus-newsgroup-limit)
6153 thread (cadr thread))
6154 (when (gnus-invisible-cut-children (cdr thread))
6155 (let ((th (cdr thread)))
6157 (if (memq (mail-header-number (caar th))
6158 gnus-newsgroup-limit)
6159 (setq thread (car th)
6161 (setq th (cdr th))))))))))
6164 (defun gnus-cut-threads (threads)
6165 "Cut off all uninteresting articles from the beginning of threads."
6166 (when (or (eq gnus-fetch-old-headers 'some)
6167 (eq gnus-fetch-old-headers 'invisible)
6168 (eq gnus-build-sparse-threads 'some)
6169 (eq gnus-build-sparse-threads 'more))
6172 (setcar th (gnus-cut-thread (car th)))
6173 (setq th (cdr th)))))
6174 ;; Remove nixed out threads.
6177 (defun gnus-summary-initial-limit (&optional show-if-empty)
6178 "Figure out what the initial limit is supposed to be on group entry.
6179 This entails weeding out unwanted dormants, low-scored articles,
6180 fetch-old-headers verbiage, and so on."
6181 ;; Most groups have nothing to remove.
6182 (if (or gnus-inhibit-limiting
6183 (and (null gnus-newsgroup-dormant)
6184 (not (eq gnus-fetch-old-headers 'some))
6185 (not (eq gnus-fetch-old-headers 'invisible))
6186 (null gnus-summary-expunge-below)
6187 (not (eq gnus-build-sparse-threads 'some))
6188 (not (eq gnus-build-sparse-threads 'more))
6189 (null gnus-thread-expunge-below)
6190 (not gnus-use-nocem)))
6192 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6193 (setq gnus-newsgroup-limit nil)
6196 (unless (car (symbol-value node))
6197 ;; These threads have no parents -- they are roots.
6198 (let ((nodes (cdr (symbol-value node)))
6201 (if (and gnus-thread-expunge-below
6202 (< (gnus-thread-total-score (car nodes))
6203 gnus-thread-expunge-below))
6204 (gnus-expunge-thread (pop nodes))
6205 (setq thread (pop nodes))
6206 (gnus-summary-limit-children thread))))))
6207 gnus-newsgroup-dependencies)
6208 ;; If this limitation resulted in an empty group, we might
6209 ;; pop the previous limit and use it instead.
6210 (when (and (not gnus-newsgroup-limit)
6212 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6213 gnus-newsgroup-limit))
6215 (defun gnus-summary-limit-children (thread)
6216 "Return 1 if this subthread is visible and 0 if it is not."
6217 ;; First we get the number of visible children to this thread. This
6218 ;; is done by recursing down the thread using this function, so this
6219 ;; will really go down to a leaf article first, before slowly
6220 ;; working its way up towards the root.
6224 (apply '+ (mapcar 'gnus-summary-limit-children
6227 (number (mail-header-number (car thread)))
6230 (not (memq number gnus-newsgroup-marked))
6232 ;; If this article is dormant and has absolutely no visible
6233 ;; children, then this article isn't visible.
6234 (and (memq number gnus-newsgroup-dormant)
6236 ;; If this is "fetch-old-headered" and there is no
6237 ;; visible children, then we don't want this article.
6238 (and (eq gnus-fetch-old-headers 'some)
6239 (gnus-summary-article-ancient-p number)
6241 ;; If this is "fetch-old-headered" and `invisible', then
6242 ;; we don't want this article.
6243 (and (eq gnus-fetch-old-headers 'invisible)
6244 (gnus-summary-article-ancient-p number))
6245 ;; If this is a sparsely inserted article with no children,
6246 ;; we don't want it.
6247 (and (eq gnus-build-sparse-threads 'some)
6248 (gnus-summary-article-sparse-p number)
6250 ;; If we use expunging, and this article is really
6251 ;; low-scored, then we don't want this article.
6252 (when (and gnus-summary-expunge-below
6254 (or (cdr (assq number gnus-newsgroup-scored))
6255 gnus-summary-default-score))
6256 gnus-summary-expunge-below))
6257 ;; We increase the expunge-tally here, but that has
6258 ;; nothing to do with the limits, really.
6259 (incf gnus-newsgroup-expunged-tally)
6260 ;; We also mark as read here, if that's wanted.
6261 (when (and gnus-summary-mark-below
6262 (< score gnus-summary-mark-below))
6263 (setq gnus-newsgroup-unreads
6264 (delq number gnus-newsgroup-unreads))
6265 (if gnus-newsgroup-auto-expire
6266 (push number gnus-newsgroup-expirable)
6267 (push (cons number gnus-low-score-mark)
6268 gnus-newsgroup-reads)))
6270 ;; Check NoCeM things.
6271 (if (and gnus-use-nocem
6272 (gnus-nocem-unwanted-article-p
6273 (mail-header-id (car thread))))
6275 (setq gnus-newsgroup-unreads
6276 (delq number gnus-newsgroup-unreads))
6278 ;; Nope, invisible article.
6280 ;; Ok, this article is to be visible, so we add it to the limit
6282 (push number gnus-newsgroup-limit)
6285 (defun gnus-expunge-thread (thread)
6286 "Mark all articles in THREAD as read."
6287 (let* ((number (mail-header-number (car thread))))
6288 (incf gnus-newsgroup-expunged-tally)
6289 ;; We also mark as read here, if that's wanted.
6290 (setq gnus-newsgroup-unreads
6291 (delq number gnus-newsgroup-unreads))
6292 (if gnus-newsgroup-auto-expire
6293 (push number gnus-newsgroup-expirable)
6294 (push (cons number gnus-low-score-mark)
6295 gnus-newsgroup-reads)))
6296 ;; Go recursively through all subthreads.
6297 (mapcar 'gnus-expunge-thread (cdr thread)))
6299 ;; Summary article oriented commands
6301 (defun gnus-summary-refer-parent-article (n)
6302 "Refer parent article N times.
6303 If N is negative, go to ancestor -N instead.
6304 The difference between N and the number of articles fetched is returned."
6308 (when (not (natnump n))
6313 (setq header (gnus-summary-article-header))
6314 (if (and (eq (mail-header-number header)
6315 (cdr gnus-article-current))
6316 (equal gnus-newsgroup-name
6317 (car gnus-article-current)))
6318 ;; If we try to find the parent of the currently
6319 ;; displayed article, then we take a look at the actual
6320 ;; References header, since this is slightly more
6321 ;; reliable than the References field we got from the
6324 (set-buffer gnus-original-article-buffer)
6325 (nnheader-narrow-to-headers)
6326 (unless (setq ref (message-fetch-field "references"))
6327 (setq ref (message-fetch-field "in-reply-to")))
6330 ;; It's not the current article, so we take a bet on
6331 ;; the value we got from the server.
6332 (mail-header-references header)))
6334 (not (equal ref "")))
6335 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6336 (gnus-message 1 "Couldn't find parent"))
6337 (gnus-message 1 "No references in article %d"
6338 (gnus-summary-article-number))
6341 (gnus-summary-position-point)
6344 (defun gnus-summary-refer-references ()
6345 "Fetch all articles mentioned in the References header.
6346 Return the number of articles fetched."
6348 (let ((ref (mail-header-references (gnus-summary-article-header)))
6349 (current (gnus-summary-article-number))
6353 (error "No References in the current article")
6354 ;; For each Message-ID in the References header...
6355 (while (string-match "<[^>]*>" ref)
6357 ;; ... fetch that article.
6358 (gnus-summary-refer-article
6359 (prog1 (match-string 0 ref)
6360 (setq ref (substring ref (match-end 0))))))
6361 (gnus-summary-goto-subject current)
6362 (gnus-summary-position-point)
6365 (defun gnus-summary-refer-thread (&optional limit)
6366 "Fetch all articles in the current thread.
6367 If LIMIT (the numerical prefix), fetch that many old headers instead
6368 of what's specified by the `gnus-refer-thread-limit' variable."
6370 (let ((id (mail-header-id (gnus-summary-article-header)))
6371 (limit (if limit (prefix-numeric-value limit)
6372 gnus-refer-thread-limit))
6374 ;; We want to fetch LIMIT *old* headers, but we also have to
6375 ;; re-fetch all the headers in the current buffer, because many of
6376 ;; them may be undisplayed. So we adjust LIMIT.
6377 (when (numberp limit)
6378 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6379 (unless (eq gnus-fetch-old-headers 'invisible)
6380 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6381 ;; Retrieve the headers and read them in.
6382 (if (eq (gnus-retrieve-headers
6383 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6385 (gnus-build-all-threads)
6386 (error "Can't fetch thread from backends that don't support NOV"))
6387 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6388 (gnus-summary-limit-include-thread id)))
6390 (defun gnus-summary-refer-article (message-id &optional arg)
6391 "Fetch an article specified by MESSAGE-ID.
6392 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6393 or `gnus-select-method', no matter what backend the article comes from."
6394 (interactive "sMessage-ID: \nP")
6395 (when (and (stringp message-id)
6396 (not (zerop (length message-id))))
6397 ;; Construct the correct Message-ID if necessary.
6398 ;; Suggested by tale@pawl.rpi.edu.
6399 (unless (string-match "^<" message-id)
6400 (setq message-id (concat "<" message-id)))
6401 (unless (string-match ">$" message-id)
6402 (setq message-id (concat message-id ">")))
6403 (let* ((header (gnus-id-to-header message-id))
6405 (gnus-summary-article-sparse-p
6406 (mail-header-number header))
6407 (memq (mail-header-number header)
6408 gnus-newsgroup-limit)))
6411 ;; If the article is present in the buffer we just go to it.
6413 (or (not (gnus-summary-article-sparse-p
6414 (mail-header-number header)))
6417 (gnus-summary-goto-article
6418 (mail-header-number header) nil t)
6420 (gnus-summary-update-article (mail-header-number header)))))
6422 ;; We fetch the article
6423 (let ((gnus-override-method
6424 (cond ((gnus-news-group-p gnus-newsgroup-name)
6425 gnus-refer-article-method)
6427 (or gnus-refer-article-method gnus-select-method))
6430 ;; Start the special refer-article method, if necessary.
6431 (when (and gnus-refer-article-method
6432 (gnus-news-group-p gnus-newsgroup-name))
6433 (gnus-check-server gnus-refer-article-method))
6434 ;; Fetch the header, and display the article.
6435 (if (setq number (gnus-summary-insert-subject message-id))
6436 (gnus-summary-select-article nil nil nil number)
6437 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6439 (defun gnus-summary-enter-digest-group (&optional force)
6440 "Enter an nndoc group based on the current article.
6441 If FORCE, force a digest interpretation. If not, try
6442 to guess what the document format is."
6444 (let ((conf gnus-current-window-configuration))
6446 (gnus-summary-select-article))
6447 (setq gnus-current-window-configuration conf)
6448 (let* ((name (format "%s-%d"
6449 (gnus-group-prefixed-name
6450 gnus-newsgroup-name (list 'nndoc ""))
6452 (set-buffer gnus-summary-buffer)
6453 gnus-current-article)))
6454 (ogroup gnus-newsgroup-name)
6455 (params (append (gnus-info-params (gnus-get-info ogroup))
6456 (list (cons 'to-group ogroup))
6457 (list (cons 'save-article-group ogroup))))
6458 (case-fold-search t)
6459 (buf (current-buffer))
6462 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6463 (insert-buffer-substring gnus-original-article-buffer)
6464 ;; Remove lines that may lead nndoc to misinterpret the
6467 (goto-char (point-min))
6468 (or (search-forward "\n\n" nil t) (point)))
6469 (goto-char (point-min))
6470 (delete-matching-lines "^\\(Path\\):\\|^From ")
6473 (if (gnus-group-read-ephemeral-group
6474 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6476 ,(if force 'digest 'guess))) t)
6477 ;; Make all postings to this group go to the parent group.
6478 (nconc (gnus-info-params (gnus-get-info name))
6480 ;; Couldn't select this doc group.
6481 (switch-to-buffer buf)
6482 (gnus-set-global-variables)
6483 (gnus-configure-windows 'summary)
6484 (gnus-message 3 "Article couldn't be entered?"))
6485 (kill-buffer dig)))))
6487 (defun gnus-summary-read-document (n)
6488 "Open a new group based on the current article(s).
6489 This will allow you to read digests and other similar
6490 documents as newsgroups.
6491 Obeys the standard process/prefix convention."
6493 (let* ((articles (gnus-summary-work-articles n))
6494 (ogroup gnus-newsgroup-name)
6495 (params (append (gnus-info-params (gnus-get-info ogroup))
6496 (list (cons 'to-group ogroup))))
6497 article group egroup groups vgroup)
6498 (while (setq article (pop articles))
6499 (setq group (format "%s-%d" gnus-newsgroup-name article))
6500 (gnus-summary-remove-process-mark article)
6501 (when (gnus-summary-display-article article)
6503 (nnheader-temp-write nil
6504 (insert-buffer-substring gnus-original-article-buffer)
6505 ;; Remove some headers that may lead nndoc to make
6507 (message-narrow-to-head)
6508 (goto-char (point-min))
6509 (delete-matching-lines "^\\(Path\\):\\|^From ")
6512 (gnus-group-read-ephemeral-group
6513 group `(nndoc ,group (nndoc-address ,(current-buffer))
6514 (nndoc-article-type guess))
6517 ;; Make all postings to this group go to the parent group.
6518 (nconc (gnus-info-params (gnus-get-info egroup))
6520 (push egroup groups))
6521 ;; Couldn't select this doc group.
6522 (gnus-error 3 "Article couldn't be entered"))))))
6523 ;; Now we have selected all the documents.
6526 (error "None of the articles could be interpreted as documents"))
6527 ((gnus-group-read-ephemeral-group
6528 (setq vgroup (format
6529 "nnvirtual:%s-%s" gnus-newsgroup-name
6530 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6531 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6533 (cons (current-buffer) 'summary)))
6535 (error "Couldn't select virtual nndoc group")))))
6537 (defun gnus-summary-isearch-article (&optional regexp-p)
6538 "Do incremental search forward on the current article.
6539 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6541 (gnus-summary-select-article)
6542 (gnus-configure-windows 'article)
6543 (gnus-eval-in-buffer-window gnus-article-buffer
6546 (isearch-forward regexp-p))))
6548 (defun gnus-summary-search-article-forward (regexp &optional backward)
6549 "Search for an article containing REGEXP forward.
6550 If BACKWARD, search backward instead."
6553 (format "Search article %s (regexp%s): "
6554 (if current-prefix-arg "backward" "forward")
6555 (if gnus-last-search-regexp
6556 (concat ", default " gnus-last-search-regexp)
6558 current-prefix-arg))
6559 (if (string-equal regexp "")
6560 (setq regexp (or gnus-last-search-regexp ""))
6561 (setq gnus-last-search-regexp regexp))
6562 (if (gnus-summary-search-article regexp backward)
6563 (gnus-summary-show-thread)
6564 (error "Search failed: \"%s\"" regexp)))
6566 (defun gnus-summary-search-article-backward (regexp)
6567 "Search for an article containing REGEXP backward."
6570 (format "Search article backward (regexp%s): "
6571 (if gnus-last-search-regexp
6572 (concat ", default " gnus-last-search-regexp)
6574 (gnus-summary-search-article-forward regexp 'backward))
6576 (defun gnus-summary-search-article (regexp &optional backward)
6577 "Search for an article containing REGEXP.
6578 Optional argument BACKWARD means do search for backward.
6579 `gnus-select-article-hook' is not called during the search."
6580 ;; We have to require this here to make sure that the following
6581 ;; dynamic binding isn't shadowed by autoloading.
6582 (require 'gnus-async)
6583 (let ((gnus-select-article-hook nil) ;Disable hook.
6584 (gnus-article-display-hook nil)
6585 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6586 (gnus-use-article-prefetch nil)
6587 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6588 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6589 (sum (current-buffer))
6592 (gnus-save-hidden-threads
6593 (gnus-summary-select-article)
6594 (set-buffer gnus-article-buffer)
6598 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6600 (re-search-backward regexp nil t)
6601 (re-search-forward regexp nil t))
6602 ;; We found the regexp.
6607 (get-buffer-window (current-buffer))
6611 (setq point (point)))
6612 ;; We didn't find it, so we go to the next article.
6615 (while (eq found 'not)
6616 (if (not (if backward (gnus-summary-find-prev)
6617 (gnus-summary-find-next)))
6618 ;; No more articles.
6620 ;; Select the next article and adjust point.
6621 (unless (gnus-summary-article-sparse-p
6622 (gnus-summary-article-number))
6624 (gnus-summary-select-article)
6625 (set-buffer gnus-article-buffer)
6627 (goto-char (if backward (point-max) (point-min))))))))
6628 (gnus-message 7 ""))
6629 ;; Return whether we found the regexp.
6630 (when (eq found 'found)
6632 (gnus-summary-show-thread)
6633 (gnus-summary-goto-subject gnus-current-article)
6634 (gnus-summary-position-point)
6637 (defun gnus-summary-find-matching (header regexp &optional backward unread
6639 "Return a list of all articles that match REGEXP on HEADER.
6640 The search stars on the current article and goes forwards unless
6641 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6642 If UNREAD is non-nil, only unread articles will
6643 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6644 in the comparisons."
6645 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6646 (gnus-data-find-list
6647 (gnus-summary-article-number) (gnus-data-list backward))))
6648 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6649 (case-fold-search (not not-case-fold))
6651 (unless (fboundp (intern (concat "mail-header-" header)))
6652 (error "%s is not a valid header" header))
6655 (and (or (not unread) ; We want all articles...
6656 (gnus-data-unread-p d)) ; Or just unreads.
6657 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6658 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6659 (push (gnus-data-number d) articles)) ; Success!
6660 (setq data (cdr data)))
6661 (nreverse articles)))
6663 (defun gnus-summary-execute-command (header regexp command &optional backward)
6664 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6665 If HEADER is an empty string (or nil), the match is done on the entire
6666 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6668 (list (let ((completion-ignore-case t))
6671 (mapcar (lambda (string) (list string))
6672 '("Number" "Subject" "From" "Lines" "Date"
6673 "Message-ID" "Xref" "References" "Body"))
6674 nil 'require-match))
6675 (read-string "Regexp: ")
6676 (read-key-sequence "Command: ")
6677 current-prefix-arg))
6678 (when (equal header "Body")
6680 ;; Hidden thread subtrees must be searched as well.
6681 (gnus-summary-show-all-threads)
6682 ;; We don't want to change current point nor window configuration.
6684 (save-window-excursion
6685 (gnus-message 6 "Executing %s..." (key-description command))
6686 ;; We'd like to execute COMMAND interactively so as to give arguments.
6687 (gnus-execute header regexp
6688 `(call-interactively ',(key-binding command))
6690 (gnus-message 6 "Executing %s...done" (key-description command)))))
6692 (defun gnus-summary-beginning-of-article ()
6693 "Scroll the article back to the beginning."
6695 (gnus-summary-select-article)
6696 (gnus-configure-windows 'article)
6697 (gnus-eval-in-buffer-window gnus-article-buffer
6699 (goto-char (point-min))
6700 (when gnus-page-broken
6701 (gnus-narrow-to-page))))
6703 (defun gnus-summary-end-of-article ()
6704 "Scroll to the end of the article."
6706 (gnus-summary-select-article)
6707 (gnus-configure-windows 'article)
6708 (gnus-eval-in-buffer-window gnus-article-buffer
6710 (goto-char (point-max))
6712 (when gnus-page-broken
6713 (gnus-narrow-to-page))))
6715 (defun gnus-summary-print-article (&optional filename n)
6716 "Generate and print a PostScript image of the N next (mail) articles.
6718 If N is negative, print the N previous articles. If N is nil and articles
6719 have been marked with the process mark, print these instead.
6721 If the optional second argument FILENAME is nil, send the image to the
6722 printer. If FILENAME is a string, save the PostScript image in a file with
6723 that name. If FILENAME is a number, prompt the user for the name of the file
6725 (interactive (list (ps-print-preprint current-prefix-arg)
6726 current-prefix-arg))
6727 (dolist (nbr (gnus-summary-work-articles n))
6728 (gnus-summary-select-article 'all nil 'pseudo nbr)
6729 (gnus-eval-in-buffer-window gnus-article-buffer
6730 (let ((buffer (generate-new-buffer " *print*")))
6733 (copy-to-buffer buffer (point-min) (point-max))
6735 (gnus-article-delete-invisible-text)
6736 (let ((ps-left-header
6739 (mail-header-subject gnus-current-headers) ")")
6741 (mail-header-from gnus-current-headers) ")")))
6744 "/pagenumberstring load"
6746 (mail-header-date gnus-current-headers) ")"))))
6747 (run-hooks 'gnus-ps-print-hook)
6748 (ps-print-buffer-with-faces filename)))
6749 (kill-buffer buffer))))))
6751 (defun gnus-summary-show-article (&optional arg)
6752 "Force re-fetching of the current article.
6753 If ARG (the prefix) is non-nil, show the raw article without any
6754 article massaging functions being run."
6757 ;; Select the article the normal way.
6758 (gnus-summary-select-article nil 'force)
6759 ;; Bind the article treatment functions to nil.
6760 (let ((gnus-have-all-headers t)
6761 gnus-article-display-hook
6762 gnus-article-prepare-hook
6766 (gnus-summary-select-article nil 'force)))
6767 (gnus-summary-goto-subject gnus-current-article)
6768 (gnus-summary-position-point))
6770 (defun gnus-summary-verbose-headers (&optional arg)
6771 "Toggle permanent full header display.
6772 If ARG is a positive number, turn header display on.
6773 If ARG is a negative number, turn header display off."
6775 (setq gnus-show-all-headers
6776 (cond ((or (not (numberp arg))
6778 (not gnus-show-all-headers))
6781 (gnus-summary-show-article))
6783 (defun gnus-summary-toggle-header (&optional arg)
6784 "Show the headers if they are hidden, or hide them if they are shown.
6785 If ARG is a positive number, show the entire header.
6786 If ARG is a negative number, hide the unwanted header lines."
6789 (set-buffer gnus-article-buffer)
6790 (let* ((buffer-read-only nil)
6791 (inhibit-point-motion-hooks t)
6792 (hidden (text-property-any
6793 (goto-char (point-min)) (search-forward "\n\n")
6796 (goto-char (point-min))
6797 (when (search-forward "\n\n" nil t)
6798 (delete-region (point-min) (1- (point))))
6799 (goto-char (point-min))
6801 (set-buffer gnus-original-article-buffer)
6802 (goto-char (point-min))
6803 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6804 (insert-buffer-substring gnus-original-article-buffer 1 e)
6805 (let ((article-inhibit-hiding t))
6806 (run-hooks 'gnus-article-display-hook))
6807 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6808 (gnus-article-hide-headers)))))
6810 (defun gnus-summary-show-all-headers ()
6811 "Make all header lines visible."
6813 (gnus-article-show-all-headers))
6815 (defun gnus-summary-toggle-mime (&optional arg)
6816 "Toggle MIME processing.
6817 If ARG is a positive number, turn MIME processing on."
6819 (setq gnus-show-mime
6820 (if (null arg) (not gnus-show-mime)
6821 (> (prefix-numeric-value arg) 0)))
6822 (gnus-summary-select-article t 'force))
6824 (defun gnus-summary-caesar-message (&optional arg)
6825 "Caesar rotate the current article by 13.
6826 The numerical prefix specifies how many places to rotate each letter
6829 (gnus-summary-select-article)
6830 (let ((mail-header-separator ""))
6831 (gnus-eval-in-buffer-window gnus-article-buffer
6834 (let ((start (window-start))
6836 (message-caesar-buffer-body arg)
6837 (set-window-start (get-buffer-window (current-buffer)) start))))))
6839 (defun gnus-summary-stop-page-breaking ()
6840 "Stop page breaking in the current article."
6842 (gnus-summary-select-article)
6843 (gnus-eval-in-buffer-window gnus-article-buffer
6845 (when (gnus-visual-p 'page-marker)
6846 (let ((buffer-read-only nil))
6847 (gnus-remove-text-with-property 'gnus-prev)
6848 (gnus-remove-text-with-property 'gnus-next)))))
6850 (defun gnus-summary-move-article (&optional n to-newsgroup
6851 select-method action)
6852 "Move the current article to a different newsgroup.
6853 If N is a positive number, move the N next articles.
6854 If N is a negative number, move the N previous articles.
6855 If N is nil and any articles have been marked with the process mark,
6856 move those articles instead.
6857 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6858 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6859 re-spool using this method.
6861 For this function to work, both the current newsgroup and the
6862 newsgroup that you want to move to have to support the `request-move'
6863 and `request-accept' functions."
6866 (setq action 'move))
6867 ;; Disable marking as read.
6868 (let (gnus-mark-article-hook)
6869 (save-window-excursion
6870 (gnus-summary-select-article)))
6871 ;; Check whether the source group supports the required functions.
6872 (cond ((and (eq action 'move)
6873 (not (gnus-check-backend-function
6874 'request-move-article gnus-newsgroup-name)))
6875 (error "The current group does not support article moving"))
6876 ((and (eq action 'crosspost)
6877 (not (gnus-check-backend-function
6878 'request-replace-article gnus-newsgroup-name)))
6879 (error "The current group does not support article editing")))
6880 (let ((articles (gnus-summary-work-articles n))
6881 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6882 (names '((move "Move" "Moving")
6883 (copy "Copy" "Copying")
6884 (crosspost "Crosspost" "Crossposting")))
6885 (copy-buf (save-excursion
6886 (nnheader-set-temp-buffer " *copy article*")))
6887 art-group to-method new-xref article to-groups)
6888 (unless (assq action names)
6889 (error "Unknown action %s" action))
6890 ;; Read the newsgroup name.
6891 (when (and (not to-newsgroup)
6892 (not select-method))
6894 (gnus-read-move-group-name
6895 (cadr (assq action names))
6896 (symbol-value (intern (format "gnus-current-%s-group" action)))
6898 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6899 (setq to-method (or select-method
6900 (gnus-group-name-to-method to-newsgroup)))
6901 ;; Check the method we are to move this article to...
6902 (unless (gnus-check-backend-function
6903 'request-accept-article (car to-method))
6904 (error "%s does not support article copying" (car to-method)))
6905 (unless (gnus-check-server to-method)
6906 (error "Can't open server %s" (car to-method)))
6907 (gnus-message 6 "%s to %s: %s..."
6908 (caddr (assq action names))
6909 (or (car select-method) to-newsgroup) articles)
6911 (setq article (pop articles))
6915 ;; Move the article.
6917 ;; Remove this article from future suppression.
6918 (gnus-dup-unsuppress-article article)
6919 (gnus-request-move-article
6920 article ; Article to move
6921 gnus-newsgroup-name ; From newsgroup
6922 (nth 1 (gnus-find-method-for-group
6923 gnus-newsgroup-name)) ; Server
6924 (list 'gnus-request-accept-article
6925 to-newsgroup (list 'quote select-method)
6926 (not articles)) ; Accept form
6927 (not articles))) ; Only save nov last time
6928 ;; Copy the article.
6931 (set-buffer copy-buf)
6932 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
6933 (gnus-request-accept-article
6934 to-newsgroup select-method (not articles)))))
6935 ;; Crosspost the article.
6936 ((eq action 'crosspost)
6937 (let ((xref (message-tokenize-header
6938 (mail-header-xref (gnus-summary-article-header article))
6940 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6943 (setq xref (list (system-name))))
6946 (mapconcat 'identity
6947 (delete "Xref:" (delete new-xref xref))
6951 (set-buffer copy-buf)
6952 ;; First put the article in the destination group.
6953 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6954 (when (consp (setq art-group
6955 (gnus-request-accept-article
6956 to-newsgroup select-method (not articles))))
6957 (setq new-xref (concat new-xref " " (car art-group)
6958 ":" (cdr art-group)))
6959 ;; Now we have the new Xrefs header, so we insert
6960 ;; it and replace the new article.
6961 (nnheader-replace-header "Xref" new-xref)
6962 (gnus-request-replace-article
6963 (cdr art-group) to-newsgroup (current-buffer))
6967 (gnus-message 1 "Couldn't %s article %s"
6968 (cadr (assq action names)) article))
6969 ((and (eq art-group 'junk)
6971 (gnus-summary-mark-article article gnus-canceled-mark)
6972 (gnus-message 4 "Deleted article %s" article))
6976 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6978 (gnus-group-prefixed-name
6981 (gnus-find-method-for-group to-newsgroup)))
6982 gnus-newsrc-hashtb)))
6983 (info (nth 2 entry))
6984 (to-group (gnus-info-group info)))
6985 ;; Update the group that has been moved to.
6987 (memq action '(move copy)))
6988 (unless (member to-group to-groups)
6989 (push to-group to-groups))
6991 (unless (memq article gnus-newsgroup-unreads)
6993 info (gnus-add-to-range (gnus-info-read info)
6994 (list (cdr art-group)))))
6996 ;; Copy any marks over to the new group.
6997 (let ((marks gnus-article-mark-lists)
6998 (to-article (cdr art-group)))
7000 ;; See whether the article is to be put in the cache.
7001 (when gnus-use-cache
7002 (gnus-cache-possibly-enter-article
7004 (let ((header (copy-sequence
7005 (gnus-summary-article-header article))))
7006 (mail-header-set-number header to-article)
7008 (memq article gnus-newsgroup-marked)
7009 (memq article gnus-newsgroup-dormant)
7010 (memq article gnus-newsgroup-unreads)))
7012 (when (and (equal to-group gnus-newsgroup-name)
7013 (not (memq article gnus-newsgroup-unreads)))
7014 ;; Mark this article as read in this group.
7015 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7016 (setcdr (gnus-active to-group) to-article)
7017 (setcdr gnus-newsgroup-active to-article))
7020 (when (memq article (symbol-value
7021 (intern (format "gnus-newsgroup-%s"
7023 ;; If the other group is the same as this group,
7024 ;; then we have to add the mark to the list.
7025 (when (equal to-group gnus-newsgroup-name)
7026 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7029 (intern (format "gnus-newsgroup-%s"
7031 ;; Copy the marks to other group.
7032 (gnus-add-marked-articles
7033 to-group (cdar marks) (list to-article) info))
7034 (setq marks (cdr marks)))
7037 (concat "(gnus-group-set-info '"
7038 (gnus-prin1-to-string (gnus-get-info to-group))
7041 ;; Update the Xref header in this article to point to
7042 ;; the new crossposted article we have just created.
7043 (when (eq action 'crosspost)
7045 (set-buffer copy-buf)
7046 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7047 (nnheader-replace-header "Xref" new-xref)
7048 (gnus-request-replace-article
7049 article gnus-newsgroup-name (current-buffer)))))
7051 ;;;!!!Why is this necessary?
7052 (set-buffer gnus-summary-buffer)
7054 (gnus-summary-goto-subject article)
7055 (when (eq action 'move)
7056 (gnus-summary-mark-article article gnus-canceled-mark))))
7057 (gnus-summary-remove-process-mark article))
7058 ;; Re-activate all groups that have been moved to.
7061 (set-buffer gnus-group-buffer)
7062 (when (gnus-group-goto-group (car to-groups) t)
7063 (gnus-group-get-new-news-this-group 1 t))
7066 (gnus-kill-buffer copy-buf)
7067 (gnus-summary-position-point)
7068 (gnus-set-mode-line 'summary)))
7070 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7071 "Move the current article to a different newsgroup.
7072 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7073 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7074 re-spool using this method."
7076 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7078 (defun gnus-summary-crosspost-article (&optional n)
7079 "Crosspost the current article to some other group."
7081 (gnus-summary-move-article n nil nil 'crosspost))
7083 (defcustom gnus-summary-respool-default-method nil
7084 "Default method for respooling an article.
7085 If nil, use to the current newsgroup method."
7086 :type `(choice (gnus-select-method :value (nnml ""))
7088 :group 'gnus-summary-mail)
7090 (defun gnus-summary-respool-article (&optional n method)
7091 "Respool the current article.
7092 The article will be squeezed through the mail spooling process again,
7093 which means that it will be put in some mail newsgroup or other
7094 depending on `nnmail-split-methods'.
7095 If N is a positive number, respool the N next articles.
7096 If N is a negative number, respool the N previous articles.
7097 If N is nil and any articles have been marked with the process mark,
7098 respool those articles instead.
7100 Respooling can be done both from mail groups and \"real\" newsgroups.
7101 In the former case, the articles in question will be moved from the
7102 current group into whatever groups they are destined to. In the
7103 latter case, they will be copied into the relevant groups."
7105 (list current-prefix-arg
7106 (let* ((methods (gnus-methods-using 'respool))
7108 (symbol-name (or gnus-summary-respool-default-method
7109 (car (gnus-find-method-for-group
7110 gnus-newsgroup-name)))))
7112 (gnus-completing-read
7113 methname "What backend do you want to use when respooling?"
7114 methods nil t nil 'gnus-mail-method-history))
7117 ((zerop (length (setq ms (gnus-servers-using-backend
7119 (list (intern method) ""))
7123 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7124 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7127 (error "No method given for respooling"))
7128 (if (assoc (symbol-name
7129 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7130 (gnus-methods-using 'respool))
7131 (gnus-summary-move-article n nil method)
7132 (gnus-summary-copy-article n nil method)))
7134 (defun gnus-summary-import-article (file)
7135 "Import a random file into a mail newsgroup."
7136 (interactive "fImport file: ")
7137 (let ((group gnus-newsgroup-name)
7138 (now (current-time))
7140 (unless (gnus-check-backend-function 'request-accept-article group)
7141 (error "%s does not support article importing" group))
7142 (or (file-readable-p file)
7143 (not (file-regular-p file))
7144 (error "Can't read %s" file))
7146 (set-buffer (get-buffer-create " *import file*"))
7147 (buffer-disable-undo (current-buffer))
7149 (insert-file-contents file)
7150 (goto-char (point-min))
7151 (unless (nnheader-article-p)
7152 ;; This doesn't look like an article, so we fudge some headers.
7153 (setq atts (file-attributes file)
7154 lines (count-lines (point-min) (point-max)))
7155 (insert "From: " (read-string "From: ") "\n"
7156 "Subject: " (read-string "Subject: ") "\n"
7157 "Date: " (timezone-make-date-arpa-standard
7158 (current-time-string (nth 5 atts))
7159 (current-time-zone now)
7160 (current-time-zone now))
7162 "Message-ID: " (message-make-message-id) "\n"
7163 "Lines: " (int-to-string lines) "\n"
7164 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7165 (gnus-request-accept-article group nil t)
7166 (kill-buffer (current-buffer)))))
7168 (defun gnus-summary-article-posted-p ()
7169 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7170 This will be the case if the article has both been mailed and posted."
7172 (let ((id (mail-header-references (gnus-summary-article-header)))
7173 (gnus-override-method
7174 (or gnus-refer-article-method gnus-select-method)))
7175 (if (gnus-request-head id "")
7176 (gnus-message 2 "The current message was found on %s"
7177 gnus-override-method)
7178 (gnus-message 2 "The current message couldn't be found on %s"
7179 gnus-override-method)
7182 (defun gnus-summary-expire-articles (&optional now)
7183 "Expire all articles that are marked as expirable in the current group."
7185 (when (gnus-check-backend-function
7186 'request-expire-articles gnus-newsgroup-name)
7187 ;; This backend supports expiry.
7188 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7189 (expirable (if total
7191 ;; We need to update the info for
7192 ;; this group for `gnus-list-of-read-articles'
7193 ;; to give us the right answer.
7194 (run-hooks 'gnus-exit-group-hook)
7195 (gnus-summary-update-info)
7196 (gnus-list-of-read-articles gnus-newsgroup-name))
7197 (setq gnus-newsgroup-expirable
7198 (sort gnus-newsgroup-expirable '<))))
7199 (expiry-wait (if now 'immediate
7200 (gnus-group-find-parameter
7201 gnus-newsgroup-name 'expiry-wait)))
7204 ;; There are expirable articles in this group, so we run them
7205 ;; through the expiry process.
7206 (gnus-message 6 "Expiring articles...")
7207 ;; The list of articles that weren't expired is returned.
7209 (let ((nnmail-expiry-wait-function nil)
7210 (nnmail-expiry-wait expiry-wait))
7211 (setq es (gnus-request-expire-articles
7212 expirable gnus-newsgroup-name)))
7213 (setq es (gnus-request-expire-articles
7214 expirable gnus-newsgroup-name)))
7216 (setq gnus-newsgroup-expirable es))
7217 ;; We go through the old list of expirable, and mark all
7218 ;; really expired articles as nonexistent.
7219 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7220 (let ((gnus-use-cache nil))
7222 (unless (memq (car expirable) es)
7223 (when (gnus-data-find (car expirable))
7224 (gnus-summary-mark-article
7225 (car expirable) gnus-canceled-mark)))
7226 (setq expirable (cdr expirable)))))
7227 (gnus-message 6 "Expiring articles...done")))))
7229 (defun gnus-summary-expire-articles-now ()
7230 "Expunge all expirable articles in the current group.
7231 This means that *all* articles that are marked as expirable will be
7232 deleted forever, right now."
7234 (or gnus-expert-user
7236 "Are you really, really, really sure you want to delete all these messages? ")
7238 (gnus-summary-expire-articles t))
7240 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7241 (defun gnus-summary-delete-article (&optional n)
7242 "Delete the N next (mail) articles.
7243 This command actually deletes articles. This is not a marking
7244 command. The article will disappear forever from your life, never to
7246 If N is negative, delete backwards.
7247 If N is nil and articles have been marked with the process mark,
7248 delete these instead."
7250 (unless (gnus-check-backend-function 'request-expire-articles
7251 gnus-newsgroup-name)
7252 (error "The current newsgroup does not support article deletion"))
7253 ;; Compute the list of articles to delete.
7254 (let ((articles (gnus-summary-work-articles n))
7256 (if (and gnus-novice-user
7257 (not (gnus-yes-or-no-p
7258 (format "Do you really want to delete %s forever? "
7259 (if (> (length articles) 1)
7260 (format "these %s articles" (length articles))
7263 ;; Delete the articles.
7264 (setq not-deleted (gnus-request-expire-articles
7265 articles gnus-newsgroup-name 'force))
7267 (gnus-summary-remove-process-mark (car articles))
7268 ;; The backend might not have been able to delete the article
7270 (unless (memq (car articles) not-deleted)
7271 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7272 (setq articles (cdr articles)))
7274 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7275 (gnus-summary-position-point)
7276 (gnus-set-mode-line 'summary)
7279 (defun gnus-summary-edit-article (&optional force)
7280 "Edit the current article.
7281 This will have permanent effect only in mail groups.
7282 If FORCE is non-nil, allow editing of articles even in read-only
7286 (set-buffer gnus-summary-buffer)
7287 (gnus-set-global-variables)
7288 (when (and (not force)
7289 (gnus-group-read-only-p))
7290 (error "The current newsgroup does not support article editing"))
7291 ;; Select article if needed.
7292 (unless (eq (gnus-summary-article-number)
7293 gnus-current-article)
7294 (gnus-summary-select-article t))
7295 (gnus-article-date-original)
7296 (gnus-article-edit-article
7297 `(lambda (no-highlight)
7298 (gnus-summary-edit-article-done
7299 ,(or (mail-header-references gnus-current-headers) "")
7300 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7302 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7304 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7306 "Make edits to the current article permanent."
7308 ;; Replace the article.
7309 (if (and (not read-only)
7310 (not (gnus-request-replace-article
7311 (cdr gnus-article-current) (car gnus-article-current)
7313 (error "Couldn't replace article")
7314 ;; Update the summary buffer.
7316 (equal (message-tokenize-header references " ")
7317 (message-tokenize-header
7318 (or (message-fetch-field "references") "") " ")))
7319 ;; We only have to update this line.
7322 (message-narrow-to-head)
7323 (let ((head (buffer-string))
7325 (nnheader-temp-write nil
7326 (insert (format "211 %d Article retrieved.\n"
7327 (cdr gnus-article-current)))
7330 (let ((nntp-server-buffer (current-buffer)))
7331 (setq header (car (gnus-get-newsgroup-headers
7333 (set-buffer gnus-summary-buffer)
7334 gnus-newsgroup-dependencies)
7337 (set-buffer gnus-summary-buffer)
7338 (gnus-data-set-header
7339 (gnus-data-find (cdr gnus-article-current))
7341 (gnus-summary-update-article-line
7342 (cdr gnus-article-current) header))))))
7344 (set-buffer (or buffer gnus-summary-buffer))
7345 (gnus-summary-update-article (cdr gnus-article-current)))
7346 ;; Prettify the article buffer again.
7347 (unless no-highlight
7349 (set-buffer gnus-article-buffer)
7350 (run-hooks 'gnus-article-display-hook)
7351 (set-buffer gnus-original-article-buffer)
7352 (gnus-request-article
7353 (cdr gnus-article-current)
7354 (car gnus-article-current) (current-buffer))))
7355 ;; Prettify the summary buffer line.
7356 (when (gnus-visual-p 'summary-highlight 'highlight)
7357 (run-hooks 'gnus-visual-mark-article-hook))))
7359 (defun gnus-summary-edit-wash (key)
7360 "Perform editing command in the article buffer."
7364 (message "%s" (concat (this-command-keys) "- "))
7367 (gnus-summary-edit-article)
7368 (execute-kbd-macro (concat (this-command-keys) key))
7369 (gnus-article-edit-done))
7373 (defun gnus-summary-respool-query (&optional silent)
7374 "Query where the respool algorithm would put this article."
7376 (let (gnus-mark-article-hook)
7377 (gnus-summary-select-article)
7379 (set-buffer gnus-original-article-buffer)
7381 (message-narrow-to-head)
7382 (let ((groups (nnmail-article-group 'identity)))
7385 (message "This message would go to %s"
7386 (mapconcat 'car groups ", "))
7387 (message "This message would go to no groups"))
7390 ;; Summary marking commands.
7392 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7393 "Mark articles which has the same subject as read, and then select the next.
7394 If UNMARK is positive, remove any kind of mark.
7395 If UNMARK is negative, tick articles."
7398 (setq unmark (prefix-numeric-value unmark)))
7400 (gnus-summary-mark-same-subject
7401 (gnus-summary-article-subject) unmark)))
7402 ;; Select next unread article. If auto-select-same mode, should
7403 ;; select the first unread article.
7404 (gnus-summary-next-article t (and gnus-auto-select-same
7405 (gnus-summary-article-subject)))
7406 (gnus-message 7 "%d article%s marked as %s"
7407 count (if (= count 1) " is" "s are")
7408 (if unmark "unread" "read"))))
7410 (defun gnus-summary-kill-same-subject (&optional unmark)
7411 "Mark articles which has the same subject as read.
7412 If UNMARK is positive, remove any kind of mark.
7413 If UNMARK is negative, tick articles."
7416 (setq unmark (prefix-numeric-value unmark)))
7418 (gnus-summary-mark-same-subject
7419 (gnus-summary-article-subject) unmark)))
7420 ;; If marked as read, go to next unread subject.
7422 ;; Go to next unread subject.
7423 (gnus-summary-next-subject 1 t))
7424 (gnus-message 7 "%d articles are marked as %s"
7425 count (if unmark "unread" "read"))))
7427 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7428 "Mark articles with same SUBJECT as read, and return marked number.
7429 If optional argument UNMARK is positive, remove any kinds of marks.
7430 If optional argument UNMARK is negative, mark articles as unread instead."
7434 ((null unmark) ; Mark as read.
7437 (gnus-summary-mark-article-as-read gnus-killed-mark)
7438 (gnus-summary-show-thread) t)
7439 (gnus-summary-find-subject subject))
7440 (setq count (1+ count))))
7441 ((> unmark 0) ; Tick.
7444 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7445 (gnus-summary-show-thread) t)
7446 (gnus-summary-find-subject subject))
7447 (setq count (1+ count))))
7448 (t ; Mark as unread.
7451 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7452 (gnus-summary-show-thread) t)
7453 (gnus-summary-find-subject subject))
7454 (setq count (1+ count)))))
7455 (gnus-set-mode-line 'summary)
7456 ;; Return the number of marked articles.
7459 (defun gnus-summary-mark-as-processable (n &optional unmark)
7460 "Set the process mark on the next N articles.
7461 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7462 the process mark instead. The difference between N and the actual
7463 number of articles marked is returned."
7465 (let ((backward (< n 0))
7470 (gnus-summary-remove-process-mark
7471 (gnus-summary-article-number))
7472 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7473 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7476 (gnus-message 7 "No more articles"))
7477 (gnus-summary-recenter)
7478 (gnus-summary-position-point)
7481 (defun gnus-summary-unmark-as-processable (n)
7482 "Remove the process mark from the next N articles.
7483 If N is negative, unmark backward instead. The difference between N and
7484 the actual number of articles unmarked is returned."
7486 (gnus-summary-mark-as-processable n t))
7488 (defun gnus-summary-unmark-all-processable ()
7489 "Remove the process mark from all articles."
7492 (while gnus-newsgroup-processable
7493 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7494 (gnus-summary-position-point))
7496 (defun gnus-summary-mark-as-expirable (n)
7497 "Mark N articles forward as expirable.
7498 If N is negative, mark backward instead. The difference between N and
7499 the actual number of articles marked is returned."
7501 (gnus-summary-mark-forward n gnus-expirable-mark))
7503 (defun gnus-summary-mark-article-as-replied (article)
7504 "Mark ARTICLE replied and update the summary line."
7505 (push article gnus-newsgroup-replied)
7506 (let ((buffer-read-only nil))
7507 (when (gnus-summary-goto-subject article)
7508 (gnus-summary-update-secondary-mark article))))
7510 (defun gnus-summary-set-bookmark (article)
7511 "Set a bookmark in current article."
7512 (interactive (list (gnus-summary-article-number)))
7513 (when (or (not (get-buffer gnus-article-buffer))
7514 (not gnus-current-article)
7515 (not gnus-article-current)
7516 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7517 (error "No current article selected"))
7518 ;; Remove old bookmark, if one exists.
7519 (let ((old (assq article gnus-newsgroup-bookmarks)))
7521 (setq gnus-newsgroup-bookmarks
7522 (delq old gnus-newsgroup-bookmarks))))
7523 ;; Set the new bookmark, which is on the form
7524 ;; (article-number . line-number-in-body).
7528 (set-buffer gnus-article-buffer)
7532 (goto-char (point-min))
7533 (search-forward "\n\n" nil t)
7536 gnus-newsgroup-bookmarks)
7537 (gnus-message 6 "A bookmark has been added to the current article."))
7539 (defun gnus-summary-remove-bookmark (article)
7540 "Remove the bookmark from the current article."
7541 (interactive (list (gnus-summary-article-number)))
7542 ;; Remove old bookmark, if one exists.
7543 (let ((old (assq article gnus-newsgroup-bookmarks)))
7546 (setq gnus-newsgroup-bookmarks
7547 (delq old gnus-newsgroup-bookmarks))
7548 (gnus-message 6 "Removed bookmark."))
7549 (gnus-message 6 "No bookmark in current article."))))
7551 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7552 (defun gnus-summary-mark-as-dormant (n)
7553 "Mark N articles forward as dormant.
7554 If N is negative, mark backward instead. The difference between N and
7555 the actual number of articles marked is returned."
7557 (gnus-summary-mark-forward n gnus-dormant-mark))
7559 (defun gnus-summary-set-process-mark (article)
7560 "Set the process mark on ARTICLE and update the summary line."
7561 (setq gnus-newsgroup-processable
7563 (delq article gnus-newsgroup-processable)))
7564 (when (gnus-summary-goto-subject article)
7565 (gnus-summary-show-thread)
7566 (gnus-summary-update-secondary-mark article)))
7568 (defun gnus-summary-remove-process-mark (article)
7569 "Remove the process mark from ARTICLE and update the summary line."
7570 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7571 (when (gnus-summary-goto-subject article)
7572 (gnus-summary-show-thread)
7573 (gnus-summary-update-secondary-mark article)))
7575 (defun gnus-summary-set-saved-mark (article)
7576 "Set the process mark on ARTICLE and update the summary line."
7577 (push article gnus-newsgroup-saved)
7578 (when (gnus-summary-goto-subject article)
7579 (gnus-summary-update-secondary-mark article)))
7581 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7582 "Mark N articles as read forwards.
7583 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7584 The difference between N and the actual number of articles marked is
7587 (let ((backward (< n 0))
7588 (gnus-summary-goto-unread
7589 (and gnus-summary-goto-unread
7590 (not (eq gnus-summary-goto-unread 'never))
7591 (not (memq mark (list gnus-unread-mark
7592 gnus-ticked-mark gnus-dormant-mark)))))
7594 (mark (or mark gnus-del-mark)))
7596 (gnus-summary-mark-article nil mark no-expire)
7597 (zerop (gnus-summary-next-subject
7599 (and gnus-summary-goto-unread
7600 (not (eq gnus-summary-goto-unread 'never)))
7604 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7605 (gnus-summary-recenter)
7606 (gnus-summary-position-point)
7607 (gnus-set-mode-line 'summary)
7610 (defun gnus-summary-mark-article-as-read (mark)
7611 "Mark the current article quickly as read with MARK."
7612 (let ((article (gnus-summary-article-number)))
7613 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7614 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7615 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7616 (push (cons article mark) gnus-newsgroup-reads)
7617 ;; Possibly remove from cache, if that is used.
7618 (when gnus-use-cache
7619 (gnus-cache-enter-remove-article article))
7620 ;; Allow the backend to change the mark.
7621 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7622 ;; Check for auto-expiry.
7623 (when (and gnus-newsgroup-auto-expire
7624 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7625 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7626 (= mark gnus-ancient-mark)
7627 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7628 (= mark gnus-duplicate-mark)))
7629 (setq mark gnus-expirable-mark)
7630 (push article gnus-newsgroup-expirable))
7631 ;; Set the mark in the buffer.
7632 (gnus-summary-update-mark mark 'unread)
7635 (defun gnus-summary-mark-article-as-unread (mark)
7636 "Mark the current article quickly as unread with MARK."
7637 (let ((article (gnus-summary-article-number)))
7640 (gnus-error 1 "Can't mark negative article numbers")
7642 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7643 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7644 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7645 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7646 (cond ((= mark gnus-ticked-mark)
7647 (push article gnus-newsgroup-marked))
7648 ((= mark gnus-dormant-mark)
7649 (push article gnus-newsgroup-dormant))
7651 (push article gnus-newsgroup-unreads)))
7652 (setq gnus-newsgroup-reads
7653 (delq (assq article gnus-newsgroup-reads)
7654 gnus-newsgroup-reads))
7656 ;; See whether the article is to be put in the cache.
7658 (vectorp (gnus-summary-article-header article))
7660 (gnus-cache-possibly-enter-article
7661 gnus-newsgroup-name article
7662 (gnus-summary-article-header article)
7663 (= mark gnus-ticked-mark)
7664 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7667 (gnus-summary-update-mark mark 'unread)
7670 (defun gnus-summary-mark-article (&optional article mark no-expire)
7671 "Mark ARTICLE with MARK. MARK can be any character.
7672 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7673 `??' (dormant) and `?E' (expirable).
7674 If MARK is nil, then the default character `?D' is used.
7675 If ARTICLE is nil, then the article on the current line will be
7677 ;; The mark might be a string.
7678 (when (stringp mark)
7679 (setq mark (aref mark 0)))
7680 ;; If no mark is given, then we check auto-expiring.
7681 (and (not no-expire)
7682 gnus-newsgroup-auto-expire
7684 (and (gnus-characterp mark)
7685 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7686 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7687 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7688 (= mark gnus-duplicate-mark))))
7689 (setq mark gnus-expirable-mark))
7690 (let* ((mark (or mark gnus-del-mark))
7691 (article (or article (gnus-summary-article-number))))
7693 (error "No article on current line"))
7694 (if (not (if (or (= mark gnus-unread-mark)
7695 (= mark gnus-ticked-mark)
7696 (= mark gnus-dormant-mark))
7697 (gnus-mark-article-as-unread article mark)
7698 (gnus-mark-article-as-read article mark)))
7700 ;; See whether the article is to be put in the cache.
7702 (not (= mark gnus-canceled-mark))
7703 (vectorp (gnus-summary-article-header article))
7705 (gnus-cache-possibly-enter-article
7706 gnus-newsgroup-name article
7707 (gnus-summary-article-header article)
7708 (= mark gnus-ticked-mark)
7709 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7711 (when (gnus-summary-goto-subject article nil t)
7712 (let ((buffer-read-only nil))
7713 (gnus-summary-show-thread)
7715 (gnus-summary-update-mark mark 'unread)
7718 (defun gnus-summary-update-secondary-mark (article)
7719 "Update the secondary (read, process, cache) mark."
7720 (gnus-summary-update-mark
7721 (cond ((memq article gnus-newsgroup-processable)
7723 ((memq article gnus-newsgroup-cached)
7725 ((memq article gnus-newsgroup-replied)
7727 ((memq article gnus-newsgroup-saved)
7729 (t gnus-unread-mark))
7731 (when (gnus-visual-p 'summary-highlight 'highlight)
7732 (run-hooks 'gnus-summary-update-hook))
7735 (defun gnus-summary-update-mark (mark type)
7736 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7737 (buffer-read-only nil))
7738 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7739 (when (looking-at "\r")
7742 (<= (+ forward (point)) (point-max)))
7743 ;; Go to the right position on the line.
7744 (goto-char (+ forward (point)))
7745 ;; Replace the old mark with the new mark.
7746 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7747 ;; Optionally update the marks by some user rule.
7748 (when (eq type 'unread)
7750 (gnus-data-find (gnus-summary-article-number)) mark)
7751 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7753 (defun gnus-mark-article-as-read (article &optional mark)
7754 "Enter ARTICLE in the pertinent lists and remove it from others."
7755 ;; Make the article expirable.
7756 (let ((mark (or mark gnus-del-mark)))
7757 (if (= mark gnus-expirable-mark)
7758 (push article gnus-newsgroup-expirable)
7759 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7760 ;; Remove from unread and marked lists.
7761 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7762 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7763 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7764 (push (cons article mark) gnus-newsgroup-reads)
7765 ;; Possibly remove from cache, if that is used.
7766 (when gnus-use-cache
7767 (gnus-cache-enter-remove-article article))))
7769 (defun gnus-mark-article-as-unread (article &optional mark)
7770 "Enter ARTICLE in the pertinent lists and remove it from others."
7771 (let ((mark (or mark gnus-ticked-mark)))
7774 (gnus-error 1 "Can't mark negative article numbers")
7776 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7777 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7778 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7779 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7781 ;; Unsuppress duplicates?
7782 (when gnus-suppress-duplicates
7783 (gnus-dup-unsuppress-article article))
7785 (cond ((= mark gnus-ticked-mark)
7786 (push article gnus-newsgroup-marked))
7787 ((= mark gnus-dormant-mark)
7788 (push article gnus-newsgroup-dormant))
7790 (push article gnus-newsgroup-unreads)))
7791 (setq gnus-newsgroup-reads
7792 (delq (assq article gnus-newsgroup-reads)
7793 gnus-newsgroup-reads))
7796 (defalias 'gnus-summary-mark-as-unread-forward
7797 'gnus-summary-tick-article-forward)
7798 (make-obsolete 'gnus-summary-mark-as-unread-forward
7799 'gnus-summary-tick-article-forward)
7800 (defun gnus-summary-tick-article-forward (n)
7801 "Tick N articles forwards.
7802 If N is negative, tick backwards instead.
7803 The difference between N and the number of articles ticked is returned."
7805 (gnus-summary-mark-forward n gnus-ticked-mark))
7807 (defalias 'gnus-summary-mark-as-unread-backward
7808 'gnus-summary-tick-article-backward)
7809 (make-obsolete 'gnus-summary-mark-as-unread-backward
7810 'gnus-summary-tick-article-backward)
7811 (defun gnus-summary-tick-article-backward (n)
7812 "Tick N articles backwards.
7813 The difference between N and the number of articles ticked is returned."
7815 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7817 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7818 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7819 (defun gnus-summary-tick-article (&optional article clear-mark)
7820 "Mark current article as unread.
7821 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7822 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7824 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7827 (defun gnus-summary-mark-as-read-forward (n)
7828 "Mark N articles as read forwards.
7829 If N is negative, mark backwards instead.
7830 The difference between N and the actual number of articles marked is
7833 (gnus-summary-mark-forward n gnus-del-mark t))
7835 (defun gnus-summary-mark-as-read-backward (n)
7836 "Mark the N articles as read backwards.
7837 The difference between N and the actual number of articles marked is
7840 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7842 (defun gnus-summary-mark-as-read (&optional article mark)
7843 "Mark current article as read.
7844 ARTICLE specifies the article to be marked as read.
7845 MARK specifies a string to be inserted at the beginning of the line."
7846 (gnus-summary-mark-article article mark))
7848 (defun gnus-summary-clear-mark-forward (n)
7849 "Clear marks from N articles forward.
7850 If N is negative, clear backward instead.
7851 The difference between N and the number of marks cleared is returned."
7853 (gnus-summary-mark-forward n gnus-unread-mark))
7855 (defun gnus-summary-clear-mark-backward (n)
7856 "Clear marks from N articles backward.
7857 The difference between N and the number of marks cleared is returned."
7859 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7861 (defun gnus-summary-mark-unread-as-read ()
7862 "Intended to be used by `gnus-summary-mark-article-hook'."
7863 (when (memq gnus-current-article gnus-newsgroup-unreads)
7864 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7866 (defun gnus-summary-mark-read-and-unread-as-read ()
7867 "Intended to be used by `gnus-summary-mark-article-hook'."
7868 (let ((mark (gnus-summary-article-mark)))
7869 (when (or (gnus-unread-mark-p mark)
7870 (gnus-read-mark-p mark))
7871 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7873 (defun gnus-summary-mark-region-as-read (point mark all)
7874 "Mark all unread articles between point and mark as read.
7875 If given a prefix, mark all articles between point and mark as read,
7876 even ticked and dormant ones."
7877 (interactive "r\nP")
7886 (memq (setq article (gnus-summary-article-number))
7887 gnus-newsgroup-unreads))
7888 (gnus-summary-mark-article article gnus-del-mark))
7890 (gnus-summary-find-next))))))
7892 (defun gnus-summary-mark-below (score mark)
7893 "Mark articles with score less than SCORE with MARK."
7894 (interactive "P\ncMark: ")
7895 (setq score (if score
7896 (prefix-numeric-value score)
7897 (or gnus-summary-default-score 0)))
7899 (set-buffer gnus-summary-buffer)
7900 (goto-char (point-min))
7903 (and (< (gnus-summary-article-score) score)
7904 (gnus-summary-mark-article nil mark))
7905 (gnus-summary-find-next)))))
7907 (defun gnus-summary-kill-below (&optional score)
7908 "Mark articles with score below SCORE as read."
7910 (gnus-summary-mark-below score gnus-killed-mark))
7912 (defun gnus-summary-clear-above (&optional score)
7913 "Clear all marks from articles with score above SCORE."
7915 (gnus-summary-mark-above score gnus-unread-mark))
7917 (defun gnus-summary-tick-above (&optional score)
7918 "Tick all articles with score above SCORE."
7920 (gnus-summary-mark-above score gnus-ticked-mark))
7922 (defun gnus-summary-mark-above (score mark)
7923 "Mark articles with score over SCORE with MARK."
7924 (interactive "P\ncMark: ")
7925 (setq score (if score
7926 (prefix-numeric-value score)
7927 (or gnus-summary-default-score 0)))
7929 (set-buffer gnus-summary-buffer)
7930 (goto-char (point-min))
7932 (when (> (gnus-summary-article-score) score)
7933 (gnus-summary-mark-article nil mark))
7935 (gnus-summary-find-next)))))
7937 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7938 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7939 (defun gnus-summary-limit-include-expunged (&optional no-error)
7940 "Display all the hidden articles that were expunged for low scores."
7942 (let ((buffer-read-only nil))
7943 (let ((scored gnus-newsgroup-scored)
7946 (unless (gnus-summary-goto-subject (caar scored))
7947 (and (setq h (gnus-summary-article-header (caar scored)))
7948 (< (cdar scored) gnus-summary-expunge-below)
7950 (setq scored (cdr scored)))
7952 (when (not no-error)
7953 (error "No expunged articles hidden"))
7954 (goto-char (point-min))
7955 (gnus-summary-prepare-unthreaded (nreverse headers))
7956 (goto-char (point-min))
7957 (gnus-summary-position-point)
7960 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7961 "Mark all unread articles in this newsgroup as read.
7962 If prefix argument ALL is non-nil, ticked and dormant articles will
7963 also be marked as read.
7964 If QUIETLY is non-nil, no questions will be asked.
7965 If TO-HERE is non-nil, it should be a point in the buffer. All
7966 articles before this point will be marked as read.
7967 Note that this function will only catch up the unread article
7968 in the current summary buffer limitation.
7969 The number of articles marked as read is returned."
7974 (not gnus-interactive-catchup) ;Without confirmation?
7978 "Mark absolutely all articles as read? "
7979 "Mark all unread articles as read? ")))
7981 (not gnus-newsgroup-adaptive)
7982 (not gnus-newsgroup-auto-expire)
7983 (not gnus-suppress-duplicates)
7984 (or (not gnus-use-cache)
7985 (eq gnus-use-cache 'passive)))
7988 (setq gnus-newsgroup-marked nil
7989 gnus-newsgroup-dormant nil))
7990 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
7991 ;; We actually mark all articles as canceled, which we
7992 ;; have to do when using auto-expiry or adaptive scoring.
7993 (gnus-summary-show-all-threads)
7994 (when (gnus-summary-first-subject (not all))
7996 (if to-here (< (point) to-here) t)
7997 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7998 (gnus-summary-find-next (not all)))))
7999 (gnus-set-mode-line 'summary))
8001 (gnus-summary-position-point)))
8003 (defun gnus-summary-catchup-to-here (&optional all)
8004 "Mark all unticked articles before the current one as read.
8005 If ALL is non-nil, also mark ticked and dormant articles as read."
8008 (gnus-save-hidden-threads
8009 (let ((beg (point)))
8010 ;; We check that there are unread articles.
8011 (when (or all (gnus-summary-find-prev))
8012 (gnus-summary-catchup all t beg)))))
8013 (gnus-summary-position-point))
8015 (defun gnus-summary-catchup-all (&optional quietly)
8016 "Mark all articles in this newsgroup as read."
8018 (gnus-summary-catchup t quietly))
8020 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8021 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8022 If prefix argument ALL is non-nil, all articles are marked as read."
8024 (when (gnus-summary-catchup all quietly nil 'fast)
8025 ;; Select next newsgroup or exit.
8026 (if (eq gnus-auto-select-next 'quietly)
8027 (gnus-summary-next-group nil)
8028 (gnus-summary-exit))))
8030 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8031 "Mark all articles in this newsgroup as read, and then exit."
8033 (gnus-summary-catchup-and-exit t quietly))
8035 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8036 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8037 "Mark all articles in this group as read and select the next group.
8038 If given a prefix, mark all articles, unread as well as ticked, as
8042 (gnus-summary-catchup all))
8043 (gnus-summary-next-article t nil nil t))
8045 ;; Thread-based commands.
8047 (defun gnus-summary-articles-in-thread (&optional article)
8048 "Return a list of all articles in the current thread.
8049 If ARTICLE is non-nil, return all articles in the thread that starts
8051 (let* ((article (or article (gnus-summary-article-number)))
8052 (data (gnus-data-find-list article))
8053 (top-level (gnus-data-level (car data)))
8055 (cond ((null gnus-thread-operation-ignore-subject)
8056 (gnus-simplify-subject-re
8057 (mail-header-subject (gnus-data-header (car data)))))
8058 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8059 (gnus-simplify-subject-fuzzy
8060 (mail-header-subject (gnus-data-header (car data)))))
8062 (end-point (save-excursion
8063 (if (gnus-summary-go-to-next-thread)
8064 (point) (point-max))))
8067 (< (gnus-data-pos (car data)) end-point))
8068 (when (or (not top-subject)
8069 (string= top-subject
8070 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8071 (gnus-simplify-subject-fuzzy
8072 (mail-header-subject
8073 (gnus-data-header (car data))))
8074 (gnus-simplify-subject-re
8075 (mail-header-subject
8076 (gnus-data-header (car data)))))))
8077 (push (gnus-data-number (car data)) articles))
8078 (unless (and (setq data (cdr data))
8079 (> (gnus-data-level (car data)) top-level))
8081 ;; Return the list of articles.
8082 (nreverse articles)))
8084 (defun gnus-summary-rethread-current ()
8085 "Rethread the thread the current article is part of."
8087 (let* ((gnus-show-threads t)
8088 (article (gnus-summary-article-number))
8089 (id (mail-header-id (gnus-summary-article-header)))
8090 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8092 (error "No article on the current line"))
8093 (gnus-rebuild-thread id)
8094 (gnus-summary-goto-subject article)))
8096 (defun gnus-summary-reparent-thread ()
8097 "Make the current article child of the marked (or previous) article.
8099 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8100 is non-nil or the Subject: of both articles are the same."
8102 (unless (not (gnus-group-read-only-p))
8103 (error "The current newsgroup does not support article editing"))
8104 (unless (<= (length gnus-newsgroup-processable) 1)
8105 (error "No more than one article may be marked"))
8106 (save-window-excursion
8107 (let ((gnus-article-buffer " *reparent*")
8108 (current-article (gnus-summary-article-number))
8109 ;; First grab the marked article, otherwise one line up.
8110 (parent-article (if (not (null gnus-newsgroup-processable))
8111 (car gnus-newsgroup-processable)
8113 (if (eq (forward-line -1) 0)
8114 (gnus-summary-article-number)
8115 (error "Beginning of summary buffer"))))))
8116 (unless (not (eq current-article parent-article))
8117 (error "An article may not be self-referential"))
8118 (let ((message-id (mail-header-id
8119 (gnus-summary-article-header parent-article))))
8120 (unless (and message-id (not (equal message-id "")))
8121 (error "No message-id in desired parent"))
8122 (gnus-summary-select-article t t nil current-article)
8123 (set-buffer gnus-original-article-buffer)
8124 (let ((buf (format "%s" (buffer-string))))
8125 (nnheader-temp-write nil
8127 (goto-char (point-min))
8128 (if (re-search-forward "^References: " nil t)
8130 (re-search-forward "^[^ \t]" nil t)
8133 (insert " " message-id))
8134 (insert "References: " message-id "\n"))
8135 (unless (gnus-request-replace-article
8136 current-article (car gnus-article-current)
8138 (error "Couldn't replace article"))))
8139 (set-buffer gnus-summary-buffer)
8140 (gnus-summary-unmark-all-processable)
8141 (gnus-summary-update-article current-article)
8142 (gnus-summary-rethread-current)
8143 (gnus-message 3 "Article %d is now the child of article %d"
8144 current-article parent-article)))))
8146 (defun gnus-summary-toggle-threads (&optional arg)
8147 "Toggle showing conversation threads.
8148 If ARG is positive number, turn showing conversation threads on."
8150 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8151 (setq gnus-show-threads
8152 (if (null arg) (not gnus-show-threads)
8153 (> (prefix-numeric-value arg) 0)))
8154 (gnus-summary-prepare)
8155 (gnus-summary-goto-subject current)
8156 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8157 (gnus-summary-position-point)))
8159 (defun gnus-summary-show-all-threads ()
8163 (let ((buffer-read-only nil))
8164 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8165 (gnus-summary-position-point))
8167 (defun gnus-summary-show-thread ()
8168 "Show thread subtrees.
8169 Returns nil if no thread was there to be shown."
8171 (let ((buffer-read-only nil)
8173 ;; first goto end then to beg, to have point at beg after let
8174 (end (progn (end-of-line) (point)))
8175 (beg (progn (beginning-of-line) (point))))
8177 ;; Any hidden lines here?
8178 (search-forward "\r" end t)
8179 (subst-char-in-region beg end ?\^M ?\n t)
8181 (gnus-summary-position-point))))
8183 (defun gnus-summary-hide-all-threads ()
8184 "Hide all thread subtrees."
8187 (goto-char (point-min))
8188 (gnus-summary-hide-thread)
8189 (while (zerop (gnus-summary-next-thread 1 t))
8190 (gnus-summary-hide-thread)))
8191 (gnus-summary-position-point))
8193 (defun gnus-summary-hide-thread ()
8194 "Hide thread subtrees.
8195 Returns nil if no threads were there to be hidden."
8197 (let ((buffer-read-only nil)
8199 (article (gnus-summary-article-number)))
8201 ;; Go forward until either the buffer ends or the subthread
8203 (when (and (not (eobp))
8204 (or (zerop (gnus-summary-next-thread 1 t))
8205 (goto-char (point-max))))
8207 (if (and (> (point) start)
8208 (search-backward "\n" start t))
8210 (subst-char-in-region start (point) ?\n ?\^M)
8211 (gnus-summary-goto-subject article))
8214 ;;(gnus-summary-position-point)
8217 (defun gnus-summary-go-to-next-thread (&optional previous)
8218 "Go to the same level (or less) next thread.
8219 If PREVIOUS is non-nil, go to previous thread instead.
8220 Return the article number moved to, or nil if moving was impossible."
8221 (let ((level (gnus-summary-thread-level))
8222 (way (if previous -1 1))
8225 (while (and (not (eobp))
8226 (< level (gnus-summary-thread-level)))
8234 (gnus-summary-article-number)
8237 (defun gnus-summary-next-thread (n &optional silent)
8238 "Go to the same level next N'th thread.
8239 If N is negative, search backward instead.
8240 Returns the difference between N and the number of skips actually
8243 If SILENT, don't output messages."
8245 (let ((backward (< n 0))
8248 (gnus-summary-go-to-next-thread backward))
8251 (gnus-summary-position-point))
8252 (when (and (not silent) (/= 0 n))
8253 (gnus-message 7 "No more threads"))
8256 (defun gnus-summary-prev-thread (n)
8257 "Go to the same level previous N'th thread.
8258 Returns the difference between N and the number of skips actually
8261 (gnus-summary-next-thread (- n)))
8263 (defun gnus-summary-go-down-thread ()
8264 "Go down one level in the current thread."
8265 (let ((children (gnus-summary-article-children)))
8267 (gnus-summary-goto-subject (car children)))))
8269 (defun gnus-summary-go-up-thread ()
8270 "Go up one level in the current thread."
8271 (let ((parent (gnus-summary-article-parent)))
8273 (gnus-summary-goto-subject parent))))
8275 (defun gnus-summary-down-thread (n)
8276 "Go down thread N steps.
8277 If N is negative, go up instead.
8278 Returns the difference between N and how many steps down that were
8284 (if up (gnus-summary-go-up-thread)
8285 (gnus-summary-go-down-thread)))
8287 (gnus-summary-position-point)
8289 (gnus-message 7 "Can't go further"))
8292 (defun gnus-summary-up-thread (n)
8293 "Go up thread N steps.
8294 If N is negative, go up instead.
8295 Returns the difference between N and how many steps down that were
8298 (gnus-summary-down-thread (- n)))
8300 (defun gnus-summary-top-thread ()
8301 "Go to the top of the thread."
8303 (while (gnus-summary-go-up-thread))
8304 (gnus-summary-article-number))
8306 (defun gnus-summary-kill-thread (&optional unmark)
8307 "Mark articles under current thread as read.
8308 If the prefix argument is positive, remove any kinds of marks.
8309 If the prefix argument is negative, tick articles instead."
8312 (setq unmark (prefix-numeric-value unmark)))
8313 (let ((articles (gnus-summary-articles-in-thread)))
8315 ;; Expand the thread.
8316 (gnus-summary-show-thread)
8317 ;; Mark all the articles.
8319 (gnus-summary-goto-subject (car articles))
8320 (cond ((null unmark)
8321 (gnus-summary-mark-article-as-read gnus-killed-mark))
8323 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8325 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8326 (setq articles (cdr articles))))
8327 ;; Hide killed subtrees.
8329 gnus-thread-hide-killed
8330 (gnus-summary-hide-thread))
8331 ;; If marked as read, go to next unread subject.
8333 ;; Go to next unread subject.
8334 (gnus-summary-next-subject 1 t)))
8335 (gnus-set-mode-line 'summary))
8337 ;; Summary sorting commands
8339 (defun gnus-summary-sort-by-number (&optional reverse)
8340 "Sort the summary buffer by article number.
8341 Argument REVERSE means reverse order."
8343 (gnus-summary-sort 'number reverse))
8345 (defun gnus-summary-sort-by-author (&optional reverse)
8346 "Sort the summary buffer by author name alphabetically.
8347 If case-fold-search is non-nil, case of letters is ignored.
8348 Argument REVERSE means reverse order."
8350 (gnus-summary-sort 'author reverse))
8352 (defun gnus-summary-sort-by-subject (&optional reverse)
8353 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8354 If case-fold-search is non-nil, case of letters is ignored.
8355 Argument REVERSE means reverse order."
8357 (gnus-summary-sort 'subject reverse))
8359 (defun gnus-summary-sort-by-date (&optional reverse)
8360 "Sort the summary buffer by date.
8361 Argument REVERSE means reverse order."
8363 (gnus-summary-sort 'date reverse))
8365 (defun gnus-summary-sort-by-score (&optional reverse)
8366 "Sort the summary buffer by score.
8367 Argument REVERSE means reverse order."
8369 (gnus-summary-sort 'score reverse))
8371 (defun gnus-summary-sort-by-lines (&optional reverse)
8372 "Sort the summary buffer by article length.
8373 Argument REVERSE means reverse order."
8375 (gnus-summary-sort 'lines reverse))
8377 (defun gnus-summary-sort (predicate reverse)
8378 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8379 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8380 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8381 (gnus-thread-sort-functions
8387 (gnus-article-sort-functions
8392 (,article t2 t1)))))
8394 (gnus-summary-prepare-hook nil))
8395 ;; We do the sorting by regenerating the threads.
8396 (gnus-summary-prepare)
8397 ;; Hide subthreads if needed.
8398 (when (and gnus-show-threads gnus-thread-hide-subtree)
8399 (gnus-summary-hide-all-threads))))
8401 ;; Summary saving commands.
8403 (defun gnus-summary-save-article (&optional n not-saved)
8404 "Save the current article using the default saver function.
8405 If N is a positive number, save the N next articles.
8406 If N is a negative number, save the N previous articles.
8407 If N is nil and any articles have been marked with the process mark,
8408 save those articles instead.
8409 The variable `gnus-default-article-saver' specifies the saver function."
8411 (let* ((articles (gnus-summary-work-articles n))
8412 (save-buffer (save-excursion
8413 (nnheader-set-temp-buffer " *Gnus Save*")))
8414 (num (length articles))
8415 header article file)
8417 (setq header (gnus-summary-article-header
8418 (setq article (pop articles))))
8419 (if (not (vectorp header))
8420 ;; This is a pseudo-article.
8421 (if (assq 'name header)
8422 (gnus-copy-file (cdr (assq 'name header)))
8423 (gnus-message 1 "Article %d is unsaveable" article))
8424 ;; This is a real article.
8425 (save-window-excursion
8426 (gnus-summary-select-article t nil nil article))
8428 (set-buffer save-buffer)
8430 (insert-buffer-substring gnus-original-article-buffer))
8431 (setq file (gnus-article-save save-buffer file num))
8432 (gnus-summary-remove-process-mark article)
8434 (gnus-summary-set-saved-mark article))))
8435 (gnus-kill-buffer save-buffer)
8436 (gnus-summary-position-point)
8437 (gnus-set-mode-line 'summary)
8440 (defun gnus-summary-pipe-output (&optional arg)
8441 "Pipe the current article to a subprocess.
8442 If N is a positive number, pipe the N next articles.
8443 If N is a negative number, pipe the N previous articles.
8444 If N is nil and any articles have been marked with the process mark,
8445 pipe those articles instead."
8447 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8448 (gnus-summary-save-article arg t))
8449 (gnus-configure-windows 'pipe))
8451 (defun gnus-summary-save-article-mail (&optional arg)
8452 "Append the current article to an mail file.
8453 If N is a positive number, save the N next articles.
8454 If N is a negative number, save the N previous articles.
8455 If N is nil and any articles have been marked with the process mark,
8456 save those articles instead."
8458 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8459 (gnus-summary-save-article arg)))
8461 (defun gnus-summary-save-article-rmail (&optional arg)
8462 "Append the current article to an rmail file.
8463 If N is a positive number, save the N next articles.
8464 If N is a negative number, save the N previous articles.
8465 If N is nil and any articles have been marked with the process mark,
8466 save those articles instead."
8468 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8469 (gnus-summary-save-article arg)))
8471 (defun gnus-summary-save-article-file (&optional arg)
8472 "Append the current article to a file.
8473 If N is a positive number, save the N next articles.
8474 If N is a negative number, save the N previous articles.
8475 If N is nil and any articles have been marked with the process mark,
8476 save those articles instead."
8478 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8479 (gnus-summary-save-article arg)))
8481 (defun gnus-summary-write-article-file (&optional arg)
8482 "Write the current article to a file, deleting the previous file.
8483 If N is a positive number, save the N next articles.
8484 If N is a negative number, save the N previous articles.
8485 If N is nil and any articles have been marked with the process mark,
8486 save those articles instead."
8488 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8489 (gnus-summary-save-article arg)))
8491 (defun gnus-summary-save-article-body-file (&optional arg)
8492 "Append the current article body to a file.
8493 If N is a positive number, save the N next articles.
8494 If N is a negative number, save the N previous articles.
8495 If N is nil and any articles have been marked with the process mark,
8496 save those articles instead."
8498 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8499 (gnus-summary-save-article arg)))
8501 (defun gnus-summary-pipe-message (program)
8502 "Pipe the current article through PROGRAM."
8503 (interactive "sProgram: ")
8504 (gnus-summary-select-article)
8505 (let ((mail-header-separator "")
8506 (art-buf (get-buffer gnus-article-buffer)))
8507 (gnus-eval-in-buffer-window gnus-article-buffer
8510 (let ((start (window-start))
8512 (message-pipe-buffer-body program)
8513 (set-window-start (get-buffer-window (current-buffer)) start))))))
8515 (defun gnus-get-split-value (methods)
8516 "Return a value based on the split METHODS."
8517 (let (split-name method result match)
8520 (set-buffer gnus-original-article-buffer)
8522 (nnheader-narrow-to-headers)
8524 (goto-char (point-min))
8525 (setq method (pop methods))
8526 (setq match (car method))
8529 ;; Regular expression.
8531 (re-search-forward match nil t)))
8532 ((gnus-functionp match)
8536 (setq result (funcall match gnus-newsgroup-name))))
8541 (setq result (eval match)))))
8542 (setq split-name (append (cdr method) split-name))
8543 (cond ((stringp result)
8544 (push (expand-file-name
8545 result gnus-article-save-directory)
8548 (setq split-name (append result split-name)))))))))
8551 (defun gnus-valid-move-group-p (group)
8556 (car (gnus-find-method-for-group
8557 (symbol-name group))))
8558 gnus-valid-select-methods))))
8560 (defun gnus-read-move-group-name (prompt default articles prefix)
8561 "Read a group name."
8562 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8563 (minibuffer-confirm-incomplete nil) ; XEmacs
8567 (if (> (length articles) 1)
8568 (format "these %d articles" (length articles))
8573 (gnus-completing-read default prom
8575 'gnus-valid-move-group-p
8577 'gnus-group-history))
8578 ((= 1 (length split-name))
8579 (gnus-completing-read (car split-name) prom
8581 'gnus-valid-move-group-p
8583 'gnus-group-history))
8585 (gnus-completing-read nil prom
8586 (mapcar (lambda (el) (list el))
8587 (nreverse split-name))
8589 'gnus-group-history)))))
8591 (if (or (string= to-newsgroup "")
8592 (string= to-newsgroup prefix))
8593 (setq to-newsgroup default))
8594 (unless to-newsgroup
8595 (error "No group name entered"))
8596 (or (gnus-active to-newsgroup)
8597 (gnus-activate-group to-newsgroup)
8598 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8600 (or (and (gnus-request-create-group
8601 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8602 (gnus-activate-group to-newsgroup nil nil
8603 (gnus-group-name-to-method
8605 (error "Couldn't create group %s" to-newsgroup)))
8606 (error "No such group: %s" to-newsgroup)))
8609 ;; Summary extract commands
8611 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8612 (let ((buffer-read-only nil)
8613 (article (gnus-summary-article-number))
8615 (unless (gnus-summary-goto-subject article)
8616 (error "No such article: %d" article))
8617 (gnus-summary-position-point)
8618 ;; If all commands are to be bunched up on one line, we collect
8620 (unless gnus-view-pseudos-separately
8621 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8624 (setq action (cdr (assq 'action (car ps))))
8625 (setq files (list (cdr (assq 'name (car ps)))))
8626 (while (and ps (cdr ps)
8627 (string= (or action "1")
8628 (or (cdr (assq 'action (cadr ps))) "2")))
8629 (push (cdr (assq 'name (cadr ps))) files)
8630 (setcdr ps (cddr ps)))
8632 (when (not (string-match "%s" action))
8635 (when (assq 'execute (car ps))
8636 (setcdr (assq 'execute (car ps))
8637 (funcall (if (string-match "%s" action)
8644 (gnus-quote-arg-for-sh-or-csh f)))
8646 (setq ps (cdr ps)))))
8647 (if (and gnus-view-pseudos (not not-view))
8649 (when (assq 'execute (car pslist))
8650 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8651 (eq gnus-view-pseudos 'not-confirm)))
8652 (setq pslist (cdr pslist)))
8655 (setq after-article (or (cdr (assq 'article (car pslist)))
8656 (gnus-summary-article-number)))
8657 (gnus-summary-goto-subject after-article)
8660 (insert " " (file-name-nondirectory
8661 (cdr (assq 'name (car pslist))))
8662 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8664 (forward-line -1) ; back to `b'
8665 (gnus-add-text-properties
8666 b (1- e) (list 'gnus-number gnus-reffed-article-number
8667 gnus-mouse-face-prop gnus-mouse-face))
8669 after-article gnus-reffed-article-number
8670 gnus-unread-mark b (car pslist) 0 (- e b))
8671 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8672 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8673 (setq pslist (cdr pslist)))))))
8675 (defun gnus-pseudos< (p1 p2)
8676 (let ((c1 (cdr (assq 'action p1)))
8677 (c2 (cdr (assq 'action p2))))
8678 (and c1 c2 (string< c1 c2))))
8680 (defun gnus-request-pseudo-article (props)
8681 (cond ((assq 'execute props)
8682 (gnus-execute-command (cdr (assq 'execute props)))))
8683 (let ((gnus-current-article (gnus-summary-article-number)))
8684 (run-hooks 'gnus-mark-article-hook)))
8686 (defun gnus-execute-command (command &optional automatic)
8688 (gnus-article-setup-buffer)
8689 (set-buffer gnus-article-buffer)
8690 (setq buffer-read-only nil)
8691 (let ((command (if automatic command
8692 (read-string "Command: " (cons command 0)))))
8694 (insert "$ " command "\n\n")
8695 (if gnus-view-pseudo-asynchronously
8696 (start-process "gnus-execute" (current-buffer) shell-file-name
8697 shell-command-switch command)
8698 (call-process shell-file-name nil t nil
8699 shell-command-switch command)))))
8701 ;; Summary kill commands.
8703 (defun gnus-summary-edit-global-kill (article)
8704 "Edit the \"global\" kill file."
8705 (interactive (list (gnus-summary-article-number)))
8706 (gnus-group-edit-global-kill article))
8708 (defun gnus-summary-edit-local-kill ()
8709 "Edit a local kill file applied to the current newsgroup."
8711 (setq gnus-current-headers (gnus-summary-article-header))
8712 (gnus-group-edit-local-kill
8713 (gnus-summary-article-number) gnus-newsgroup-name))
8717 (defun gnus-read-header (id &optional header)
8718 "Read the headers of article ID and enter them into the Gnus system."
8719 (let ((group gnus-newsgroup-name)
8720 (gnus-override-method
8721 (and (gnus-news-group-p gnus-newsgroup-name)
8722 gnus-refer-article-method))
8724 ;; First we check to see whether the header in question is already
8727 ;; This is a Message-ID.
8728 (setq header (or header (gnus-id-to-header id)))
8729 ;; This is an article number.
8730 (setq header (or header (gnus-summary-article-header id))))
8732 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8733 ;; We have found the header.
8735 ;; If this is a sparse article, we have to nix out its
8736 ;; previous entry in the thread hashtb.
8738 (gnus-summary-article-sparse-p (mail-header-number header)))
8739 (let* ((parent (gnus-parent-id (mail-header-references header)))
8742 (gnus-gethash parent gnus-newsgroup-dependencies))))
8744 (delq (assq header thread) thread))))
8745 ;; We have to really fetch the header to this article.
8747 (set-buffer nntp-server-buffer)
8748 (when (setq where (gnus-request-head id group))
8749 (nnheader-fold-continuation-lines)
8750 (goto-char (point-max))
8752 (goto-char (point-min))
8756 ((cdr where) (cdr where))
8757 (header (mail-header-number header))
8758 (t gnus-reffed-article-number))
8760 (insert " Article retrieved.\n"))
8762 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8763 () ; Malformed head.
8764 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8765 (when (and (stringp id)
8766 (not (string= (gnus-group-real-name group)
8768 ;; If we fetched by Message-ID and the article came
8769 ;; from a different group, we fudge some bogus article
8770 ;; numbers for this article.
8771 (mail-header-set-number header gnus-reffed-article-number))
8773 (set-buffer gnus-summary-buffer)
8774 (decf gnus-reffed-article-number)
8775 (gnus-remove-header (mail-header-number header))
8776 (push header gnus-newsgroup-headers)
8777 (setq gnus-current-headers header)
8778 (push (mail-header-number header) gnus-newsgroup-limit)))
8781 (defun gnus-remove-header (number)
8782 "Remove header NUMBER from `gnus-newsgroup-headers'."
8783 (if (and gnus-newsgroup-headers
8784 (= number (mail-header-number (car gnus-newsgroup-headers))))
8785 (pop gnus-newsgroup-headers)
8786 (let ((headers gnus-newsgroup-headers))
8787 (while (and (cdr headers)
8788 (not (= number (mail-header-number (cadr headers)))))
8791 (setcdr headers (cddr headers))))))
8794 ;;; summary highlights
8797 (defun gnus-highlight-selected-summary ()
8798 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8799 ;; Highlight selected article in summary buffer
8800 (when gnus-summary-selected-face
8802 (let* ((beg (progn (beginning-of-line) (point)))
8803 (end (progn (end-of-line) (point)))
8804 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8805 (from (if (get-text-property beg gnus-mouse-face-prop)
8807 (or (next-single-property-change
8808 beg gnus-mouse-face-prop nil end)
8813 (or (next-single-property-change
8814 from gnus-mouse-face-prop nil end)
8816 ;; If no mouse-face prop on line we will have to = from = end,
8817 ;; so we highlight the entire line instead.
8818 (when (= (+ to 2) from)
8821 (if gnus-newsgroup-selected-overlay
8822 ;; Move old overlay.
8824 gnus-newsgroup-selected-overlay from to (current-buffer))
8825 ;; Create new overlay.
8827 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8828 'face gnus-summary-selected-face))))))
8830 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8831 (defun gnus-summary-highlight-line ()
8832 "Highlight current line according to `gnus-summary-highlight'."
8833 (let* ((list gnus-summary-highlight)
8835 (end (progn (end-of-line) (point)))
8836 ;; now find out where the line starts and leave point there.
8837 (beg (progn (beginning-of-line) (point)))
8838 (article (gnus-summary-article-number))
8839 (score (or (cdr (assq (or article gnus-current-article)
8840 gnus-newsgroup-scored))
8841 gnus-summary-default-score 0))
8842 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8843 (inhibit-read-only t))
8844 ;; Eval the cars of the lists until we find a match.
8845 (let ((default gnus-summary-default-score))
8847 (not (eval (caar list))))
8848 (setq list (cdr list))))
8849 (let ((face (cdar list)))
8850 (unless (eq face (get-text-property beg 'face))
8851 (gnus-put-text-property
8853 (setq face (if (boundp face) (symbol-value face) face)))
8854 (when gnus-summary-highlight-line-function
8855 (funcall gnus-summary-highlight-line-function article face))))
8858 (defun gnus-update-read-articles (group unread &optional compute)
8859 "Update the list of read articles in GROUP."
8860 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8861 (entry (gnus-gethash group gnus-newsrc-hashtb))
8862 (info (nth 2 entry))
8864 (unread (sort (copy-sequence unread) '<))
8866 (if (or (not info) (not active))
8867 ;; There is no info on this group if it was, in fact,
8868 ;; killed. Gnus stores no information on killed groups, so
8869 ;; there's nothing to be done.
8870 ;; One could store the information somewhere temporarily,
8871 ;; perhaps... Hmmm...
8873 ;; Remove any negative articles numbers.
8874 (while (and unread (< (car unread) 0))
8875 (setq unread (cdr unread)))
8876 ;; Remove any expired article numbers
8877 (while (and unread (< (car unread) (car active)))
8878 (setq unread (cdr unread)))
8879 ;; Compute the ranges of read articles by looking at the list of
8882 (when (/= (car unread) prev)
8883 (push (if (= prev (1- (car unread))) prev
8884 (cons prev (1- (car unread))))
8886 (setq prev (1+ (car unread)))
8887 (setq unread (cdr unread)))
8888 (when (<= prev (cdr active))
8889 (push (cons prev (cdr active)) read))
8891 (if (> (length read) 1) (nreverse read) read)
8893 (set-buffer gnus-group-buffer)
8896 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8897 (gnus-info-set-read ',info ',(gnus-info-read info))
8898 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8899 (gnus-group-update-group ,group t))))
8900 ;; Enter this list into the group info.
8902 info (if (> (length read) 1) (nreverse read) read))
8903 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8904 (gnus-get-unread-articles-in-group info (gnus-active group))
8907 (defun gnus-offer-save-summaries ()
8908 "Offer to save all active summary buffers."
8910 (let ((buflist (buffer-list))
8912 ;; Go through all buffers and find all summaries.
8914 (and (setq bufname (buffer-name (car buflist)))
8915 (string-match "Summary" bufname)
8917 (set-buffer bufname)
8918 ;; We check that this is, indeed, a summary buffer.
8919 (and (eq major-mode 'gnus-summary-mode)
8920 ;; Also make sure this isn't bogus.
8921 gnus-newsgroup-prepared
8922 ;; Also make sure that this isn't a dead summary buffer.
8923 (not gnus-dead-summary-mode)))
8924 (push bufname buffers))
8925 (setq buflist (cdr buflist)))
8926 ;; Go through all these summary buffers and offer to save them.
8929 "Update summary buffer %s? "
8930 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8937 (run-hooks 'gnus-sum-load-hook)
8939 ;;; gnus-sum.el ends here