1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
40 ;; Avoid byte-compile warnings.
42 (defvar gnus-article-decoded-p)
43 (defvar gnus-decode-encoded-word-function)
46 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
47 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
49 (defcustom gnus-kill-summary-on-exit t
50 "*If non-nil, kill the summary buffer when you exit from it.
51 If nil, the summary will become a \"*Dead Summary*\" buffer, and
52 it will be killed sometime later."
53 :group 'gnus-summary-exit
56 (defcustom gnus-fetch-old-headers nil
57 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
58 If an unread article in the group refers to an older, already read (or
59 just marked as read) article, the old article will not normally be
60 displayed in the Summary buffer. If this variable is non-nil, Gnus
61 will attempt to grab the headers to the old articles, and thereby
62 build complete threads. If it has the value `some', only enough
63 headers to connect otherwise loose threads will be displayed. This
64 variable can also be a number. In that case, no more than that number
65 of old headers will be fetched. If it has the value `invisible', all
66 old headers will be fetched, but none will be displayed.
68 The server has to support NOV for any of this to work."
70 :type '(choice (const :tag "off" nil)
73 (sexp :menu-tag "other" t)))
75 (defcustom gnus-refer-thread-limit 200
76 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
77 If t, fetch all the available old headers."
80 (sexp :menu-tag "other" t)))
82 (defcustom gnus-summary-make-false-root 'adopt
83 "*nil means that Gnus won't gather loose threads.
84 If the root of a thread has expired or been read in a previous
85 session, the information necessary to build a complete thread has been
86 lost. Instead of having many small sub-threads from this original thread
87 scattered all over the summary buffer, Gnus can gather them.
89 If non-nil, Gnus will try to gather all loose sub-threads from an
90 original thread into one large thread.
92 If this variable is non-nil, it should be one of `none', `adopt',
95 If this variable is `none', Gnus will not make a false root, but just
96 present the sub-threads after another.
97 If this variable is `dummy', Gnus will create a dummy root that will
98 have all the sub-threads as children.
99 If this variable is `adopt', Gnus will make one of the \"children\"
100 the parent and mark all the step-children as such.
101 If this variable is `empty', the \"children\" are printed with empty
102 subject fields. (Or rather, they will be printed with a string
103 given by the `gnus-summary-same-subject' variable.)"
105 :type '(choice (const :tag "off" nil)
111 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
112 "*A regexp to match subjects to be excluded from loose thread gathering.
113 As loose thread gathering is done on subjects only, that means that
114 there can be many false gatherings performed. By rooting out certain
115 common subjects, gathering might become saner."
119 (defcustom gnus-summary-gather-subject-limit nil
120 "*Maximum length of subject comparisons when gathering loose threads.
121 Use nil to compare full subjects. Setting this variable to a low
122 number will help gather threads that have been corrupted by
123 newsreaders chopping off subject lines, but it might also mean that
124 unrelated articles that have subject that happen to begin with the
125 same few characters will be incorrectly gathered.
127 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
130 :type '(choice (const :tag "off" nil)
132 (sexp :menu-tag "on" t)))
134 (defcustom gnus-simplify-subject-functions nil
135 "List of functions taking a string argument that simplify subjects.
136 The functions are applied recursively.
138 Useful functions to put in this list include: `gnus-simplify-subject-re',
139 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
141 :type '(repeat function))
143 (defcustom gnus-simplify-ignored-prefixes nil
144 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
146 :type '(choice (const :tag "off" nil)
149 (defcustom gnus-build-sparse-threads nil
150 "*If non-nil, fill in the gaps in threads.
151 If `some', only fill in the gaps that are needed to tie loose threads
152 together. If `more', fill in all leaf nodes that Gnus can find. If
153 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
155 :type '(choice (const :tag "off" nil)
158 (sexp :menu-tag "all" t)))
160 (defcustom gnus-summary-thread-gathering-function
161 'gnus-gather-threads-by-subject
162 "*Function used for gathering loose threads.
163 There are two pre-defined functions: `gnus-gather-threads-by-subject',
164 which only takes Subjects into consideration; and
165 `gnus-gather-threads-by-references', which compared the References
166 headers of the articles to find matches."
168 :type '(radio (function-item gnus-gather-threads-by-subject)
169 (function-item gnus-gather-threads-by-references)
170 (function :tag "other")))
172 (defcustom gnus-summary-same-subject ""
173 "*String indicating that the current article has the same subject as the previous.
174 This variable will only be used if the value of
175 `gnus-summary-make-false-root' is `empty'."
176 :group 'gnus-summary-format
179 (defcustom gnus-summary-goto-unread t
180 "*If t, marking commands will go to the next unread article.
181 If `never', commands that usually go to the next unread article, will
182 go to the next article, whether it is read or not.
183 If nil, only the marking commands will go to the next (un)read article."
184 :group 'gnus-summary-marks
185 :link '(custom-manual "(gnus)Setting Marks")
186 :type '(choice (const :tag "off" nil)
188 (sexp :menu-tag "on" t)))
190 (defcustom gnus-summary-default-score 0
191 "*Default article score level.
192 All scores generated by the score files will be added to this score.
193 If this variable is nil, scoring will be disabled."
194 :group 'gnus-score-default
195 :type '(choice (const :tag "disable")
198 (defcustom gnus-summary-zcore-fuzz 0
199 "*Fuzziness factor for the zcore in the summary buffer.
200 Articles with scores closer than this to `gnus-summary-default-score'
202 :group 'gnus-summary-format
205 (defcustom gnus-simplify-subject-fuzzy-regexp nil
206 "*Strings to be removed when doing fuzzy matches.
207 This can either be a regular expression or list of regular expressions
208 that will be removed from subject strings if fuzzy subject
209 simplification is selected."
211 :type '(repeat regexp))
213 (defcustom gnus-show-threads t
214 "*If non-nil, display threads in summary mode."
218 (defcustom gnus-thread-hide-subtree nil
219 "*If non-nil, hide all threads initially.
220 If threads are hidden, you have to run the command
221 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
222 to expose hidden threads."
226 (defcustom gnus-thread-hide-killed t
227 "*If non-nil, hide killed threads automatically."
231 (defcustom gnus-thread-ignore-subject t
232 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
233 If nil, articles that have different subjects from their parents will
234 start separate threads."
238 (defcustom gnus-thread-operation-ignore-subject t
239 "*If non-nil, subjects will be ignored when doing thread commands.
240 This affects commands like `gnus-summary-kill-thread' and
241 `gnus-summary-lower-thread'.
243 If this variable is nil, articles in the same thread with different
244 subjects will not be included in the operation in question. If this
245 variable is `fuzzy', only articles that have subjects that are fuzzily
246 equal will be included."
248 :type '(choice (const :tag "off" nil)
252 (defcustom gnus-thread-indent-level 4
253 "*Number that says how much each sub-thread should be indented."
257 (defcustom gnus-auto-extend-newsgroup t
258 "*If non-nil, extend newsgroup forward and backward when requested."
259 :group 'gnus-summary-choose
262 (defcustom gnus-auto-select-first t
263 "*If nil, don't select the first unread article when entering a group.
264 If this variable is `best', select the highest-scored unread article
265 in the group. If t, select the first unread article.
267 This variable can also be a function to place point on a likely
268 subject line. Useful values include `gnus-summary-first-unread-subject',
269 `gnus-summary-first-unread-article' and
270 `gnus-summary-best-unread-article'.
272 If you want to prevent automatic selection of the first unread article
273 in some newsgroups, set the variable to nil in
274 `gnus-select-group-hook'."
275 :group 'gnus-group-select
276 :type '(choice (const :tag "none" nil)
278 (sexp :menu-tag "first" t)
279 (function-item gnus-summary-first-unread-subject)
280 (function-item gnus-summary-first-unread-article)
281 (function-item gnus-summary-best-unread-article)))
283 (defcustom gnus-auto-select-next t
284 "*If non-nil, offer to go to the next group from the end of the previous.
285 If the value is t and the next newsgroup is empty, Gnus will exit
286 summary mode and go back to group mode. If the value is neither nil
287 nor t, Gnus will select the following unread newsgroup. In
288 particular, if the value is the symbol `quietly', the next unread
289 newsgroup will be selected without any confirmation, and if it is
290 `almost-quietly', the next group will be selected without any
291 confirmation if you are located on the last article in the group.
292 Finally, if this variable is `slightly-quietly', the `Z n' command
293 will go to the next group without confirmation."
294 :group 'gnus-summary-maneuvering
295 :type '(choice (const :tag "off" nil)
297 (const almost-quietly)
298 (const slightly-quietly)
299 (sexp :menu-tag "on" t)))
301 (defcustom gnus-auto-select-same nil
302 "*If non-nil, select the next article with the same subject.
303 If there are no more articles with the same subject, go to
304 the first unread article."
305 :group 'gnus-summary-maneuvering
308 (defcustom gnus-summary-check-current nil
309 "*If non-nil, consider the current article when moving.
310 The \"unread\" movement commands will stay on the same line if the
311 current article is unread."
312 :group 'gnus-summary-maneuvering
315 (defcustom gnus-auto-center-summary t
316 "*If non-nil, always center the current summary buffer.
317 In particular, if `vertical' do only vertical recentering. If non-nil
318 and non-`vertical', do both horizontal and vertical recentering."
319 :group 'gnus-summary-maneuvering
320 :type '(choice (const :tag "none" nil)
322 (integer :tag "height")
323 (sexp :menu-tag "both" t)))
325 (defcustom gnus-show-all-headers nil
326 "*If non-nil, don't hide any headers."
327 :group 'gnus-article-hiding
328 :group 'gnus-article-headers
331 (defcustom gnus-summary-ignore-duplicates nil
332 "*If non-nil, ignore articles with identical Message-ID headers."
336 (defcustom gnus-single-article-buffer t
337 "*If non-nil, display all articles in the same buffer.
338 If nil, each group will get its own article buffer."
339 :group 'gnus-article-various
342 (defcustom gnus-break-pages t
343 "*If non-nil, do page breaking on articles.
344 The page delimiter is specified by the `gnus-page-delimiter'
346 :group 'gnus-article-various
349 (defcustom gnus-show-mime t
350 "*If non-nil, do mime processing of articles.
351 The articles will simply be fed to the function given by
352 `gnus-article-display-method-for-mime'."
353 :group 'gnus-article-mime
356 (defcustom gnus-move-split-methods nil
357 "*Variable used to suggest where articles are to be moved to.
358 It uses the same syntax as the `gnus-split-methods' variable."
359 :group 'gnus-summary-mail
360 :type '(repeat (choice (list :value (fun) function)
361 (cons :value ("" "") regexp (repeat string))
364 (defcustom gnus-unread-mark ?
365 "*Mark used for unread articles."
366 :group 'gnus-summary-marks
369 (defcustom gnus-ticked-mark ?!
370 "*Mark used for ticked articles."
371 :group 'gnus-summary-marks
374 (defcustom gnus-dormant-mark ??
375 "*Mark used for dormant articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-del-mark ?r
380 "*Mark used for del'd articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-read-mark ?R
385 "*Mark used for read articles."
386 :group 'gnus-summary-marks
389 (defcustom gnus-expirable-mark ?E
390 "*Mark used for expirable articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-killed-mark ?K
395 "*Mark used for killed articles."
396 :group 'gnus-summary-marks
399 (defcustom gnus-souped-mark ?F
400 "*Mark used for killed articles."
401 :group 'gnus-summary-marks
404 (defcustom gnus-kill-file-mark ?X
405 "*Mark used for articles killed by kill files."
406 :group 'gnus-summary-marks
409 (defcustom gnus-low-score-mark ?Y
410 "*Mark used for articles with a low score."
411 :group 'gnus-summary-marks
414 (defcustom gnus-catchup-mark ?C
415 "*Mark used for articles that are caught up."
416 :group 'gnus-summary-marks
419 (defcustom gnus-replied-mark ?A
420 "*Mark used for articles that have been replied to."
421 :group 'gnus-summary-marks
424 (defcustom gnus-cached-mark ?*
425 "*Mark used for articles that are in the cache."
426 :group 'gnus-summary-marks
429 (defcustom gnus-saved-mark ?S
430 "*Mark used for articles that have been saved to."
431 :group 'gnus-summary-marks
434 (defcustom gnus-ancient-mark ?O
435 "*Mark used for ancient articles."
436 :group 'gnus-summary-marks
439 (defcustom gnus-sparse-mark ?Q
440 "*Mark used for sparsely reffed articles."
441 :group 'gnus-summary-marks
444 (defcustom gnus-canceled-mark ?G
445 "*Mark used for canceled articles."
446 :group 'gnus-summary-marks
449 (defcustom gnus-duplicate-mark ?M
450 "*Mark used for duplicate articles."
451 :group 'gnus-summary-marks
454 (defcustom gnus-undownloaded-mark ?@
455 "*Mark used for articles that weren't downloaded."
456 :group 'gnus-summary-marks
459 (defcustom gnus-downloadable-mark ?%
460 "*Mark used for articles that are to be downloaded."
461 :group 'gnus-summary-marks
464 (defcustom gnus-unsendable-mark ?=
465 "*Mark used for articles that won't be sent."
466 :group 'gnus-summary-marks
469 (defcustom gnus-score-over-mark ?+
470 "*Score mark used for articles with high scores."
471 :group 'gnus-summary-marks
474 (defcustom gnus-score-below-mark ?-
475 "*Score mark used for articles with low scores."
476 :group 'gnus-summary-marks
479 (defcustom gnus-empty-thread-mark ?
480 "*There is no thread under the article."
481 :group 'gnus-summary-marks
484 (defcustom gnus-not-empty-thread-mark ?=
485 "*There is a thread under the article."
486 :group 'gnus-summary-marks
489 (defcustom gnus-view-pseudo-asynchronously nil
490 "*If non-nil, Gnus will view pseudo-articles asynchronously."
491 :group 'gnus-extract-view
494 (defcustom gnus-auto-expirable-marks
495 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
496 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
497 gnus-souped-mark gnus-duplicate-mark)
498 "*The list of marks converted into expiration if a group is auto-expirable."
500 :type '(repeat character))
502 (defcustom gnus-inhibit-user-auto-expire t
503 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
507 (defcustom gnus-view-pseudos nil
508 "*If `automatic', pseudo-articles will be viewed automatically.
509 If `not-confirm', pseudos will be viewed automatically, and the user
510 will not be asked to confirm the command."
511 :group 'gnus-extract-view
512 :type '(choice (const :tag "off" nil)
514 (const not-confirm)))
516 (defcustom gnus-view-pseudos-separately t
517 "*If non-nil, one pseudo-article will be created for each file to be viewed.
518 If nil, all files that use the same viewing command will be given as a
519 list of parameters to that command."
520 :group 'gnus-extract-view
523 (defcustom gnus-insert-pseudo-articles t
524 "*If non-nil, insert pseudo-articles when decoding articles."
525 :group 'gnus-extract-view
528 (defcustom gnus-summary-dummy-line-format
530 "*The format specification for the dummy roots in the summary buffer.
531 It works along the same lines as a normal formatting string,
532 with some simple extensions.
535 :group 'gnus-threading
538 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
539 "*The format specification for the summary mode line.
540 It works along the same lines as a normal formatting string,
541 with some simple extensions:
544 %p Unprefixed group name
545 %A Current article number
546 %z Current article score
548 %U Number of unread articles in the group
549 %e Number of unselected articles in the group
550 %Z A string with unread/unselected article counts
551 %g Shortish group name
552 %S Subject of the current article
554 %s Current score file name
555 %d Number of dormant articles
556 %r Number of articles that have been marked as read in this session
557 %E Number of articles expunged by the score files"
558 :group 'gnus-summary-format
561 (defcustom gnus-summary-mark-below 0
562 "*Mark all articles with a score below this variable as read.
563 This variable is local to each summary buffer and usually set by the
565 :group 'gnus-score-default
568 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
569 "*List of functions used for sorting articles in the summary buffer.
570 This variable is only used when not using a threaded display."
571 :group 'gnus-summary-sort
572 :type '(repeat (choice (function-item gnus-article-sort-by-number)
573 (function-item gnus-article-sort-by-author)
574 (function-item gnus-article-sort-by-subject)
575 (function-item gnus-article-sort-by-date)
576 (function-item gnus-article-sort-by-score)
577 (function :tag "other"))))
579 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
580 "*List of functions used for sorting threads in the summary buffer.
581 By default, threads are sorted by article number.
583 Each function takes two threads and return non-nil if the first thread
584 should be sorted before the other. If you use more than one function,
585 the primary sort function should be the last. You should probably
586 always include `gnus-thread-sort-by-number' in the list of sorting
587 functions -- preferably first.
589 Ready-made functions include `gnus-thread-sort-by-number',
590 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
591 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
592 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
593 :group 'gnus-summary-sort
594 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
595 (function-item gnus-thread-sort-by-author)
596 (function-item gnus-thread-sort-by-subject)
597 (function-item gnus-thread-sort-by-date)
598 (function-item gnus-thread-sort-by-score)
599 (function-item gnus-thread-sort-by-total-score)
600 (function :tag "other"))))
602 (defcustom gnus-thread-score-function '+
603 "*Function used for calculating the total score of a thread.
605 The function is called with the scores of the article and each
606 subthread and should then return the score of the thread.
608 Some functions you can use are `+', `max', or `min'."
609 :group 'gnus-summary-sort
612 (defcustom gnus-summary-expunge-below nil
613 "All articles that have a score less than this variable will be expunged.
614 This variable is local to the summary buffers."
615 :group 'gnus-score-default
616 :type '(choice (const :tag "off" nil)
619 (defcustom gnus-thread-expunge-below nil
620 "All threads that have a total score less than this variable will be expunged.
621 See `gnus-thread-score-function' for en explanation of what a
624 This variable is local to the summary buffers."
625 :group 'gnus-treading
626 :group 'gnus-score-default
627 :type '(choice (const :tag "off" nil)
630 (defcustom gnus-summary-mode-hook nil
631 "*A hook for Gnus summary mode.
632 This hook is run before any variables are set in the summary buffer."
633 :group 'gnus-summary-various
636 (defcustom gnus-summary-menu-hook nil
637 "*Hook run after the creation of the summary mode menu."
638 :group 'gnus-summary-visual
641 (defcustom gnus-summary-exit-hook nil
642 "*A hook called on exit from the summary buffer.
643 It will be called with point in the group buffer."
644 :group 'gnus-summary-exit
647 (defcustom gnus-summary-prepare-hook nil
648 "*A hook called after the summary buffer has been generated.
649 If you want to modify the summary buffer, you can use this hook."
650 :group 'gnus-summary-various
653 (defcustom gnus-summary-prepared-hook nil
654 "*A hook called as the last thing after the summary buffer has been generated."
655 :group 'gnus-summary-various
658 (defcustom gnus-summary-generate-hook nil
659 "*A hook run just before generating the summary buffer.
660 This hook is commonly used to customize threading variables and the
662 :group 'gnus-summary-various
665 (defcustom gnus-select-group-hook nil
666 "*A hook called when a newsgroup is selected.
668 If you'd like to simplify subjects like the
669 `gnus-summary-next-same-subject' command does, you can use the
672 (setq gnus-select-group-hook
675 (mapcar (lambda (header)
676 (mail-header-set-subject
678 (gnus-simplify-subject
679 (mail-header-subject header) 're-only)))
680 gnus-newsgroup-headers))))"
681 :group 'gnus-group-select
684 (defcustom gnus-select-article-hook nil
685 "*A hook called when an article is selected."
686 :group 'gnus-summary-choose
689 (defcustom gnus-visual-mark-article-hook
690 (list 'gnus-highlight-selected-summary)
691 "*Hook run after selecting an article in the summary buffer.
692 It is meant to be used for highlighting the article in some way. It
693 is not run if `gnus-visual' is nil."
694 :group 'gnus-summary-visual
697 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
698 "*A hook called before parsing the headers."
702 (defcustom gnus-exit-group-hook nil
703 "*A hook called when exiting (not quitting) summary mode."
707 (defcustom gnus-summary-update-hook
708 (list 'gnus-summary-highlight-line)
709 "*A hook called when a summary line is changed.
710 The hook will not be called if `gnus-visual' is nil.
712 The default function `gnus-summary-highlight-line' will
713 highlight the line according to the `gnus-summary-highlight'
715 :group 'gnus-summary-visual
718 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
719 "*A hook called when an article is selected for the first time.
720 The hook is intended to mark an article as read (or unread)
721 automatically when it is selected."
722 :group 'gnus-summary-choose
725 (defcustom gnus-group-no-more-groups-hook nil
726 "*A hook run when returning to group mode having no more (unread) groups."
727 :group 'gnus-group-select
730 (defcustom gnus-ps-print-hook nil
731 "*A hook run before ps-printing something from Gnus."
735 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
736 "Face used for highlighting the current article in the summary buffer."
737 :group 'gnus-summary-visual
740 (defcustom gnus-summary-highlight
741 '(((= mark gnus-canceled-mark)
742 . gnus-summary-cancelled-face)
743 ((and (> score default)
744 (or (= mark gnus-dormant-mark)
745 (= mark gnus-ticked-mark)))
746 . gnus-summary-high-ticked-face)
747 ((and (< score default)
748 (or (= mark gnus-dormant-mark)
749 (= mark gnus-ticked-mark)))
750 . gnus-summary-low-ticked-face)
751 ((or (= mark gnus-dormant-mark)
752 (= mark gnus-ticked-mark))
753 . gnus-summary-normal-ticked-face)
754 ((and (> score default) (= mark gnus-ancient-mark))
755 . gnus-summary-high-ancient-face)
756 ((and (< score default) (= mark gnus-ancient-mark))
757 . gnus-summary-low-ancient-face)
758 ((= mark gnus-ancient-mark)
759 . gnus-summary-normal-ancient-face)
760 ((and (> score default) (= mark gnus-unread-mark))
761 . gnus-summary-high-unread-face)
762 ((and (< score default) (= mark gnus-unread-mark))
763 . gnus-summary-low-unread-face)
764 ((= mark gnus-unread-mark)
765 . gnus-summary-normal-unread-face)
766 ((and (> score default) (memq mark (list gnus-downloadable-mark
767 gnus-undownloaded-mark)))
768 . gnus-summary-high-unread-face)
769 ((and (< score default) (memq mark (list gnus-downloadable-mark
770 gnus-undownloaded-mark)))
771 . gnus-summary-low-unread-face)
772 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
773 . gnus-summary-normal-unread-face)
775 . gnus-summary-high-read-face)
777 . gnus-summary-low-read-face)
779 . gnus-summary-normal-read-face))
780 "*Controls the highlighting of summary buffer lines.
782 A list of (FORM . FACE) pairs. When deciding how a a particular
783 summary line should be displayed, each form is evaluated. The content
784 of the face field after the first true form is used. You can change
785 how those summary lines are displayed, by editing the face field.
787 You can use the following variables in the FORM field.
789 score: The articles score
790 default: The default article score.
791 below: The score below which articles are automatically marked as read.
792 mark: The articles mark."
793 :group 'gnus-summary-visual
794 :type '(repeat (cons (sexp :tag "Form" nil)
797 (defcustom gnus-alter-header-function nil
798 "Function called to allow alteration of article header structures.
799 The function is called with one parameter, the article header vector,
800 which it may alter in any way.")
802 (defcustom gnus-extra-headers nil
803 "*Extra headers to parse."
805 :type '(repeat symbol))
807 (defcustom gnus-ignored-from-addresses
808 (and user-mail-address (regexp-quote user-mail-address))
809 "*Regexp of From headers that may be suppressed in favor of To headers."
813 (defcustom gnus-newsgroup-default-charset-alist
814 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" . cn-big5)
815 ("^cn\\>\\|\\<chinese\\>" . cn-gb-2312)
816 ("^fj\\>\\|^japan\\>" . iso-2022-jp-2)
817 ("^relcom\\>" . koi8-r))
818 "Alist of Regexps (to match group names) and default charsets to be applied."
819 :type '(repeat (cons (regexp :tag "Group")
820 (symbol :tag "Charset")))
823 (defcustom gnus-newsgroup-iso-8859-1-forced-regexp
824 "^tw\\>\\|^hk\\>\\|^cn\\>\\|\\<chinese\\>"
825 "Regexp of newsgroup in which ISO-8859-1 is forced to other charset."
829 ;;; Internal variables
831 (defvar gnus-scores-exclude-files nil)
832 (defvar gnus-page-broken nil)
833 (defvar gnus-inhibit-mime-unbuttonizing nil)
835 (defvar gnus-original-article nil)
836 (defvar gnus-article-internal-prepare-hook nil)
837 (defvar gnus-newsgroup-process-stack nil)
839 (defvar gnus-thread-indent-array nil)
840 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
842 ;; Avoid highlighting in kill files.
843 (defvar gnus-summary-inhibit-highlight nil)
844 (defvar gnus-newsgroup-selected-overlay nil)
845 (defvar gnus-inhibit-limiting nil)
846 (defvar gnus-newsgroup-adaptive-score-file nil)
847 (defvar gnus-current-score-file nil)
848 (defvar gnus-current-move-group nil)
849 (defvar gnus-current-copy-group nil)
850 (defvar gnus-current-crosspost-group nil)
852 (defvar gnus-newsgroup-dependencies nil)
853 (defvar gnus-newsgroup-adaptive nil)
854 (defvar gnus-summary-display-article-function nil)
855 (defvar gnus-summary-highlight-line-function nil
856 "Function called after highlighting a summary line.")
858 (defvar gnus-summary-line-format-alist
859 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
860 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
861 (?s gnus-tmp-subject-or-nil ?s)
862 (?n gnus-tmp-name ?s)
863 (?A (std11-address-string
864 (car (mime-read-field 'From gnus-tmp-header))) ?s)
865 (?a (or (std11-full-name-string
866 (car (mime-read-field 'From gnus-tmp-header)))
868 (?F gnus-tmp-from ?s)
869 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
870 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
871 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
872 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
873 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
874 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
875 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
876 (?L gnus-tmp-lines ?d)
877 (?I gnus-tmp-indentation ?s)
878 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
879 (?R gnus-tmp-replied ?c)
880 (?\[ gnus-tmp-opening-bracket ?c)
881 (?\] gnus-tmp-closing-bracket ?c)
882 (?\> (make-string gnus-tmp-level ? ) ?s)
883 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
884 (?i gnus-tmp-score ?d)
885 (?z gnus-tmp-score-char ?c)
886 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
887 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
888 (?U gnus-tmp-unread ?c)
889 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
890 (?t (gnus-summary-number-of-articles-in-thread
891 (and (boundp 'thread) (car thread)) gnus-tmp-level)
893 (?e (gnus-summary-number-of-articles-in-thread
894 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
896 (?u gnus-tmp-user-defined ?s)
897 (?P (gnus-pick-line-number) ?d))
898 "An alist of format specifications that can appear in summary lines,
899 and what variables they correspond with, along with the type of the
900 variable (string, integer, character, etc).")
902 (defvar gnus-summary-dummy-line-format-alist
903 `((?S gnus-tmp-subject ?s)
904 (?N gnus-tmp-number ?d)
905 (?u gnus-tmp-user-defined ?s)))
907 (defvar gnus-summary-mode-line-format-alist
908 `((?G gnus-tmp-group-name ?s)
909 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
910 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
911 (?A gnus-tmp-article-number ?d)
912 (?Z gnus-tmp-unread-and-unselected ?s)
914 (?U gnus-tmp-unread-and-unticked ?d)
915 (?S gnus-tmp-subject ?s)
916 (?e gnus-tmp-unselected ?d)
917 (?u gnus-tmp-user-defined ?s)
918 (?d (length gnus-newsgroup-dormant) ?d)
919 (?t (length gnus-newsgroup-marked) ?d)
920 (?r (length gnus-newsgroup-reads) ?d)
921 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
922 (?E gnus-newsgroup-expunged-tally ?d)
923 (?s (gnus-current-score-file-nondirectory) ?s)))
925 (defvar gnus-last-search-regexp nil
926 "Default regexp for article search command.")
928 (defvar gnus-last-shell-command nil
929 "Default shell command on article.")
931 (defvar gnus-newsgroup-begin nil)
932 (defvar gnus-newsgroup-end nil)
933 (defvar gnus-newsgroup-last-rmail nil)
934 (defvar gnus-newsgroup-last-mail nil)
935 (defvar gnus-newsgroup-last-folder nil)
936 (defvar gnus-newsgroup-last-file nil)
937 (defvar gnus-newsgroup-auto-expire nil)
938 (defvar gnus-newsgroup-active nil)
940 (defvar gnus-newsgroup-data nil)
941 (defvar gnus-newsgroup-data-reverse nil)
942 (defvar gnus-newsgroup-limit nil)
943 (defvar gnus-newsgroup-limits nil)
945 (defvar gnus-newsgroup-unreads nil
946 "List of unread articles in the current newsgroup.")
948 (defvar gnus-newsgroup-unselected nil
949 "List of unselected unread articles in the current newsgroup.")
951 (defvar gnus-newsgroup-reads nil
952 "Alist of read articles and article marks in the current newsgroup.")
954 (defvar gnus-newsgroup-expunged-tally nil)
956 (defvar gnus-newsgroup-marked nil
957 "List of ticked articles in the current newsgroup (a subset of unread art).")
959 (defvar gnus-newsgroup-killed nil
960 "List of ranges of articles that have been through the scoring process.")
962 (defvar gnus-newsgroup-cached nil
963 "List of articles that come from the article cache.")
965 (defvar gnus-newsgroup-saved nil
966 "List of articles that have been saved.")
968 (defvar gnus-newsgroup-kill-headers nil)
970 (defvar gnus-newsgroup-replied nil
971 "List of articles that have been replied to in the current newsgroup.")
973 (defvar gnus-newsgroup-expirable nil
974 "List of articles in the current newsgroup that can be expired.")
976 (defvar gnus-newsgroup-processable nil
977 "List of articles in the current newsgroup that can be processed.")
979 (defvar gnus-newsgroup-downloadable nil
980 "List of articles in the current newsgroup that can be processed.")
982 (defvar gnus-newsgroup-undownloaded nil
983 "List of articles in the current newsgroup that haven't been downloaded..")
985 (defvar gnus-newsgroup-unsendable nil
986 "List of articles in the current newsgroup that won't be sent.")
988 (defvar gnus-newsgroup-bookmarks nil
989 "List of articles in the current newsgroup that have bookmarks.")
991 (defvar gnus-newsgroup-dormant nil
992 "List of dormant articles in the current newsgroup.")
994 (defvar gnus-newsgroup-scored nil
995 "List of scored articles in the current newsgroup.")
997 (defvar gnus-newsgroup-headers nil
998 "List of article headers in the current newsgroup.")
1000 (defvar gnus-newsgroup-threads nil)
1002 (defvar gnus-newsgroup-prepared nil
1003 "Whether the current group has been prepared properly.")
1005 (defvar gnus-newsgroup-ancient nil
1006 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1008 (defvar gnus-newsgroup-sparse nil)
1010 (defvar gnus-current-article nil)
1011 (defvar gnus-article-current nil)
1012 (defvar gnus-current-headers nil)
1013 (defvar gnus-have-all-headers nil)
1014 (defvar gnus-last-article nil)
1015 (defvar gnus-newsgroup-history nil)
1017 (defvar gnus-newsgroup-default-charset nil)
1018 (defvar gnus-newsgroup-iso-8859-1-forced nil)
1020 (defconst gnus-summary-local-variables
1021 '(gnus-newsgroup-name
1022 gnus-newsgroup-begin gnus-newsgroup-end
1023 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1024 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1025 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1026 gnus-newsgroup-unselected gnus-newsgroup-marked
1027 gnus-newsgroup-reads gnus-newsgroup-saved
1028 gnus-newsgroup-replied gnus-newsgroup-expirable
1029 gnus-newsgroup-processable gnus-newsgroup-killed
1030 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1031 gnus-newsgroup-unsendable
1032 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1033 gnus-newsgroup-headers gnus-newsgroup-threads
1034 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1035 gnus-current-article gnus-current-headers gnus-have-all-headers
1036 gnus-last-article gnus-article-internal-prepare-hook
1037 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1038 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1039 gnus-thread-expunge-below
1040 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1041 (gnus-summary-mark-below . global)
1042 gnus-newsgroup-active gnus-scores-exclude-files
1043 gnus-newsgroup-history gnus-newsgroup-ancient
1044 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1045 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1046 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1047 (gnus-newsgroup-expunged-tally . 0)
1048 gnus-cache-removable-articles gnus-newsgroup-cached
1049 gnus-newsgroup-data gnus-newsgroup-data-reverse
1050 gnus-newsgroup-limit gnus-newsgroup-limits
1051 gnus-newsgroup-default-charset gnus-newsgroup-iso-8859-1-forced)
1052 "Variables that are buffer-local to the summary buffers.")
1054 ;; Byte-compiler warning.
1055 (defvar gnus-article-mode-map)
1057 ;; Subject simplification.
1059 (defun gnus-simplify-whitespace (str)
1060 "Remove excessive whitespace."
1063 (while (string-match "[ \t][ \t]+" mystr)
1064 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1066 (substring mystr (match-end 0)))))
1068 (when (string-match "^[ \t]+" mystr)
1069 (setq mystr (substring mystr (match-end 0))))
1071 (when (string-match "[ \t]+$" mystr)
1072 (setq mystr (substring mystr 0 (match-beginning 0))))
1075 (defsubst gnus-simplify-subject-re (subject)
1076 "Remove \"Re:\" from subject lines."
1077 (if (string-match "^[Rr][Ee]: *" subject)
1078 (substring subject (match-end 0))
1081 (defun gnus-simplify-subject (subject &optional re-only)
1082 "Remove `Re:' and words in parentheses.
1083 If RE-ONLY is non-nil, strip leading `Re:'s only."
1084 (let ((case-fold-search t)) ;Ignore case.
1085 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1086 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1087 (setq subject (substring subject (match-end 0))))
1088 ;; Remove uninteresting prefixes.
1089 (when (and (not re-only)
1090 gnus-simplify-ignored-prefixes
1091 (string-match gnus-simplify-ignored-prefixes subject))
1092 (setq subject (substring subject (match-end 0))))
1093 ;; Remove words in parentheses from end.
1095 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1096 (setq subject (substring subject 0 (match-beginning 0)))))
1097 ;; Return subject string.
1100 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1102 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1103 (goto-char (point-min))
1104 (while (re-search-forward regexp nil t)
1105 (replace-match (or newtext ""))))
1107 (defun gnus-simplify-buffer-fuzzy ()
1108 "Simplify string in the buffer fuzzily.
1109 The string in the accessible portion of the current buffer is simplified.
1110 It is assumed to be a single-line subject.
1111 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1112 matter is removed. Additional things can be deleted by setting
1113 gnus-simplify-subject-fuzzy-regexp."
1114 (let ((case-fold-search t)
1116 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1118 (while (not (eq modified-tick (buffer-modified-tick)))
1119 (setq modified-tick (buffer-modified-tick))
1121 ((listp gnus-simplify-subject-fuzzy-regexp)
1122 (mapcar 'gnus-simplify-buffer-fuzzy-step
1123 gnus-simplify-subject-fuzzy-regexp))
1124 (gnus-simplify-subject-fuzzy-regexp
1125 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1126 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1127 (gnus-simplify-buffer-fuzzy-step
1128 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1129 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1131 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1132 (gnus-simplify-buffer-fuzzy-step " +" " ")
1133 (gnus-simplify-buffer-fuzzy-step " $")
1134 (gnus-simplify-buffer-fuzzy-step "^ +")))
1136 (defun gnus-simplify-subject-fuzzy (subject)
1137 "Simplify a subject string fuzzily.
1138 See `gnus-simplify-buffer-fuzzy' for details."
1140 (gnus-set-work-buffer)
1141 (let ((case-fold-search t))
1142 ;; Remove uninteresting prefixes.
1143 (when (and gnus-simplify-ignored-prefixes
1144 (string-match gnus-simplify-ignored-prefixes subject))
1145 (setq subject (substring subject (match-end 0))))
1147 (inline (gnus-simplify-buffer-fuzzy))
1150 (defsubst gnus-simplify-subject-fully (subject)
1151 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1153 (gnus-simplify-subject-functions
1154 (gnus-map-function gnus-simplify-subject-functions subject))
1155 ((null gnus-summary-gather-subject-limit)
1156 (gnus-simplify-subject-re subject))
1157 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1158 (gnus-simplify-subject-fuzzy subject))
1159 ((numberp gnus-summary-gather-subject-limit)
1160 (gnus-limit-string (gnus-simplify-subject-re subject)
1161 gnus-summary-gather-subject-limit))
1165 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1166 "Check whether two subjects are equal.
1167 If optional argument simple-first is t, first argument is already
1170 ((null simple-first)
1171 (equal (gnus-simplify-subject-fully s1)
1172 (gnus-simplify-subject-fully s2)))
1175 (gnus-simplify-subject-fully s2)))))
1177 (defun gnus-summary-bubble-group ()
1178 "Increase the score of the current group.
1179 This is a handy function to add to `gnus-summary-exit-hook' to
1180 increase the score of each group you read."
1181 (gnus-group-add-score gnus-newsgroup-name))
1185 ;;; Gnus summary mode
1188 (put 'gnus-summary-mode 'mode-class 'special)
1191 ;; Non-orthogonal keys
1193 (gnus-define-keys gnus-summary-mode-map
1194 " " gnus-summary-next-page
1195 "\177" gnus-summary-prev-page
1196 [delete] gnus-summary-prev-page
1197 [backspace] gnus-summary-prev-page
1198 "\r" gnus-summary-scroll-up
1199 "\M-\r" gnus-summary-scroll-down
1200 "n" gnus-summary-next-unread-article
1201 "p" gnus-summary-prev-unread-article
1202 "N" gnus-summary-next-article
1203 "P" gnus-summary-prev-article
1204 "\M-\C-n" gnus-summary-next-same-subject
1205 "\M-\C-p" gnus-summary-prev-same-subject
1206 "\M-n" gnus-summary-next-unread-subject
1207 "\M-p" gnus-summary-prev-unread-subject
1208 "." gnus-summary-first-unread-article
1209 "," gnus-summary-best-unread-article
1210 "\M-s" gnus-summary-search-article-forward
1211 "\M-r" gnus-summary-search-article-backward
1212 "<" gnus-summary-beginning-of-article
1213 ">" gnus-summary-end-of-article
1214 "j" gnus-summary-goto-article
1215 "^" gnus-summary-refer-parent-article
1216 "\M-^" gnus-summary-refer-article
1217 "u" gnus-summary-tick-article-forward
1218 "!" gnus-summary-tick-article-forward
1219 "U" gnus-summary-tick-article-backward
1220 "d" gnus-summary-mark-as-read-forward
1221 "D" gnus-summary-mark-as-read-backward
1222 "E" gnus-summary-mark-as-expirable
1223 "\M-u" gnus-summary-clear-mark-forward
1224 "\M-U" gnus-summary-clear-mark-backward
1225 "k" gnus-summary-kill-same-subject-and-select
1226 "\C-k" gnus-summary-kill-same-subject
1227 "\M-\C-k" gnus-summary-kill-thread
1228 "\M-\C-l" gnus-summary-lower-thread
1229 "e" gnus-summary-edit-article
1230 "#" gnus-summary-mark-as-processable
1231 "\M-#" gnus-summary-unmark-as-processable
1232 "\M-\C-t" gnus-summary-toggle-threads
1233 "\M-\C-s" gnus-summary-show-thread
1234 "\M-\C-h" gnus-summary-hide-thread
1235 "\M-\C-f" gnus-summary-next-thread
1236 "\M-\C-b" gnus-summary-prev-thread
1237 "\M-\C-u" gnus-summary-up-thread
1238 "\M-\C-d" gnus-summary-down-thread
1239 "&" gnus-summary-execute-command
1240 "c" gnus-summary-catchup-and-exit
1241 "\C-w" gnus-summary-mark-region-as-read
1242 "\C-t" gnus-summary-toggle-truncation
1243 "?" gnus-summary-mark-as-dormant
1244 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1245 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1246 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1247 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1248 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1249 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1250 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1251 "=" gnus-summary-expand-window
1252 "\C-x\C-s" gnus-summary-reselect-current-group
1253 "\M-g" gnus-summary-rescan-group
1254 "w" gnus-summary-stop-page-breaking
1255 "\C-c\C-r" gnus-summary-caesar-message
1256 "\M-t" gnus-summary-toggle-mime
1257 "f" gnus-summary-followup
1258 "F" gnus-summary-followup-with-original
1259 "C" gnus-summary-cancel-article
1260 "r" gnus-summary-reply
1261 "R" gnus-summary-reply-with-original
1262 "\C-c\C-f" gnus-summary-mail-forward
1263 "o" gnus-summary-save-article
1264 "\C-o" gnus-summary-save-article-mail
1265 "|" gnus-summary-pipe-output
1266 "\M-k" gnus-summary-edit-local-kill
1267 "\M-K" gnus-summary-edit-global-kill
1269 "\C-c\C-d" gnus-summary-describe-group
1270 "q" gnus-summary-exit
1271 "Q" gnus-summary-exit-no-update
1272 "\C-c\C-i" gnus-info-find-node
1273 gnus-mouse-2 gnus-mouse-pick-article
1274 "m" gnus-summary-mail-other-window
1275 "a" gnus-summary-post-news
1276 "x" gnus-summary-limit-to-unread
1277 "s" gnus-summary-isearch-article
1278 "t" gnus-article-hide-headers
1279 "g" gnus-summary-show-article
1280 "l" gnus-summary-goto-last-article
1281 "v" gnus-summary-preview-mime-message
1282 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1283 "\C-d" gnus-summary-enter-digest-group
1284 "\M-\C-d" gnus-summary-read-document
1285 "\M-\C-e" gnus-summary-edit-parameters
1286 "\M-\C-g" gnus-summary-customize-parameters
1288 "*" gnus-cache-enter-article
1289 "\M-*" gnus-cache-remove-article
1290 "\M-&" gnus-summary-universal-argument
1291 "\C-l" gnus-recenter
1292 "I" gnus-summary-increase-score
1293 "L" gnus-summary-lower-score
1294 "\M-i" gnus-symbolic-argument
1295 "h" gnus-summary-select-article-buffer
1297 "V" gnus-summary-score-map
1298 "X" gnus-uu-extract-map
1299 "S" gnus-summary-send-map)
1301 ;; Sort of orthogonal keymap
1302 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1303 "t" gnus-summary-tick-article-forward
1304 "!" gnus-summary-tick-article-forward
1305 "d" gnus-summary-mark-as-read-forward
1306 "r" gnus-summary-mark-as-read-forward
1307 "c" gnus-summary-clear-mark-forward
1308 " " gnus-summary-clear-mark-forward
1309 "e" gnus-summary-mark-as-expirable
1310 "x" gnus-summary-mark-as-expirable
1311 "?" gnus-summary-mark-as-dormant
1312 "b" gnus-summary-set-bookmark
1313 "B" gnus-summary-remove-bookmark
1314 "#" gnus-summary-mark-as-processable
1315 "\M-#" gnus-summary-unmark-as-processable
1316 "S" gnus-summary-limit-include-expunged
1317 "C" gnus-summary-catchup
1318 "H" gnus-summary-catchup-to-here
1319 "\C-c" gnus-summary-catchup-all
1320 "k" gnus-summary-kill-same-subject-and-select
1321 "K" gnus-summary-kill-same-subject
1322 "P" gnus-uu-mark-map)
1324 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1325 "c" gnus-summary-clear-above
1326 "u" gnus-summary-tick-above
1327 "m" gnus-summary-mark-above
1328 "k" gnus-summary-kill-below)
1330 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1331 "/" gnus-summary-limit-to-subject
1332 "n" gnus-summary-limit-to-articles
1333 "w" gnus-summary-pop-limit
1334 "s" gnus-summary-limit-to-subject
1335 "a" gnus-summary-limit-to-author
1336 "u" gnus-summary-limit-to-unread
1337 "m" gnus-summary-limit-to-marks
1338 "v" gnus-summary-limit-to-score
1339 "*" gnus-summary-limit-include-cached
1340 "D" gnus-summary-limit-include-dormant
1341 "T" gnus-summary-limit-include-thread
1342 "d" gnus-summary-limit-exclude-dormant
1343 "t" gnus-summary-limit-to-age
1344 "E" gnus-summary-limit-include-expunged
1345 "c" gnus-summary-limit-exclude-childless-dormant
1346 "C" gnus-summary-limit-mark-excluded-as-read)
1348 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1349 "n" gnus-summary-next-unread-article
1350 "p" gnus-summary-prev-unread-article
1351 "N" gnus-summary-next-article
1352 "P" gnus-summary-prev-article
1353 "\C-n" gnus-summary-next-same-subject
1354 "\C-p" gnus-summary-prev-same-subject
1355 "\M-n" gnus-summary-next-unread-subject
1356 "\M-p" gnus-summary-prev-unread-subject
1357 "f" gnus-summary-first-unread-article
1358 "b" gnus-summary-best-unread-article
1359 "j" gnus-summary-goto-article
1360 "g" gnus-summary-goto-subject
1361 "l" gnus-summary-goto-last-article
1362 "o" gnus-summary-pop-article)
1364 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1365 "k" gnus-summary-kill-thread
1366 "l" gnus-summary-lower-thread
1367 "i" gnus-summary-raise-thread
1368 "T" gnus-summary-toggle-threads
1369 "t" gnus-summary-rethread-current
1370 "^" gnus-summary-reparent-thread
1371 "s" gnus-summary-show-thread
1372 "S" gnus-summary-show-all-threads
1373 "h" gnus-summary-hide-thread
1374 "H" gnus-summary-hide-all-threads
1375 "n" gnus-summary-next-thread
1376 "p" gnus-summary-prev-thread
1377 "u" gnus-summary-up-thread
1378 "o" gnus-summary-top-thread
1379 "d" gnus-summary-down-thread
1380 "#" gnus-uu-mark-thread
1381 "\M-#" gnus-uu-unmark-thread)
1383 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1384 "g" gnus-summary-prepare
1385 "c" gnus-summary-insert-cached-articles)
1387 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1388 "c" gnus-summary-catchup-and-exit
1389 "C" gnus-summary-catchup-all-and-exit
1390 "E" gnus-summary-exit-no-update
1391 "Q" gnus-summary-exit
1392 "Z" gnus-summary-exit
1393 "n" gnus-summary-catchup-and-goto-next-group
1394 "R" gnus-summary-reselect-current-group
1395 "G" gnus-summary-rescan-group
1396 "N" gnus-summary-next-group
1397 "s" gnus-summary-save-newsrc
1398 "P" gnus-summary-prev-group)
1400 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1401 " " gnus-summary-next-page
1402 "n" gnus-summary-next-page
1403 "\177" gnus-summary-prev-page
1404 [delete] gnus-summary-prev-page
1405 "p" gnus-summary-prev-page
1406 "\r" gnus-summary-scroll-up
1407 "\M-\r" gnus-summary-scroll-down
1408 "<" gnus-summary-beginning-of-article
1409 ">" gnus-summary-end-of-article
1410 "b" gnus-summary-beginning-of-article
1411 "e" gnus-summary-end-of-article
1412 "^" gnus-summary-refer-parent-article
1413 "r" gnus-summary-refer-parent-article
1414 "R" gnus-summary-refer-references
1415 "T" gnus-summary-refer-thread
1416 "g" gnus-summary-show-article
1417 "s" gnus-summary-isearch-article
1418 "P" gnus-summary-print-article)
1420 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1421 "b" gnus-article-add-buttons
1422 "B" gnus-article-add-buttons-to-head
1423 "o" gnus-article-treat-overstrike
1424 "e" gnus-article-emphasize
1425 "w" gnus-article-fill-cited-article
1426 "c" gnus-article-remove-cr
1427 "f" gnus-article-display-x-face
1428 "l" gnus-summary-stop-page-breaking
1429 "r" gnus-summary-caesar-message
1430 "t" gnus-article-hide-headers
1431 "v" gnus-summary-verbose-headers
1432 "m" gnus-summary-toggle-mime
1433 "h" gnus-article-treat-html
1434 "d" gnus-article-treat-dumbquotes)
1436 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1437 "a" gnus-article-hide
1438 "h" gnus-article-hide-headers
1439 "b" gnus-article-hide-boring-headers
1440 "s" gnus-article-hide-signature
1441 "c" gnus-article-hide-citation
1442 "C" gnus-article-hide-citation-in-followups
1443 "p" gnus-article-hide-pgp
1444 "P" gnus-article-hide-pem
1445 "\C-c" gnus-article-hide-citation-maybe)
1447 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1448 "a" gnus-article-highlight
1449 "h" gnus-article-highlight-headers
1450 "c" gnus-article-highlight-citation
1451 "s" gnus-article-highlight-signature)
1453 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1454 "z" gnus-article-date-ut
1455 "u" gnus-article-date-ut
1456 "l" gnus-article-date-local
1457 "e" gnus-article-date-lapsed
1458 "o" gnus-article-date-original
1459 "i" gnus-article-date-iso8601
1460 "s" gnus-article-date-user)
1462 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1463 "t" gnus-article-remove-trailing-blank-lines
1464 "l" gnus-article-strip-leading-blank-lines
1465 "m" gnus-article-strip-multiple-blank-lines
1466 "a" gnus-article-strip-blank-lines
1467 "A" gnus-article-strip-all-blank-lines
1468 "s" gnus-article-strip-leading-space
1469 "e" gnus-article-strip-trailing-space)
1471 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1473 "f" gnus-summary-fetch-faq
1474 "d" gnus-summary-describe-group
1475 "h" gnus-summary-describe-briefly
1476 "i" gnus-info-find-node)
1478 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1479 "e" gnus-summary-expire-articles
1480 "\M-\C-e" gnus-summary-expire-articles-now
1481 "\177" gnus-summary-delete-article
1482 [delete] gnus-summary-delete-article
1483 "m" gnus-summary-move-article
1484 "r" gnus-summary-respool-article
1485 "w" gnus-summary-edit-article
1486 "c" gnus-summary-copy-article
1487 "B" gnus-summary-crosspost-article
1488 "q" gnus-summary-respool-query
1489 "t" gnus-summary-respool-trace
1490 "i" gnus-summary-import-article
1491 "p" gnus-summary-article-posted-p)
1493 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1494 "o" gnus-summary-save-article
1495 "m" gnus-summary-save-article-mail
1496 "F" gnus-summary-write-article-file
1497 "r" gnus-summary-save-article-rmail
1498 "f" gnus-summary-save-article-file
1499 "b" gnus-summary-save-article-body-file
1500 "h" gnus-summary-save-article-folder
1501 "v" gnus-summary-save-article-vm
1502 "p" gnus-summary-pipe-output
1503 "s" gnus-soup-add-article)
1505 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1506 "b" gnus-summary-display-buttonized
1507 "v" gnus-article-view-part
1508 "o" gnus-article-save-part
1509 "c" gnus-article-copy-part
1510 "e" gnus-article-externalize-part
1511 "|" gnus-article-pipe-part)
1514 (defun gnus-summary-make-menu-bar ()
1515 (gnus-turn-off-edit-menu 'summary)
1517 (unless (boundp 'gnus-summary-misc-menu)
1520 gnus-summary-kill-menu gnus-summary-mode-map ""
1525 ["Enter score..." gnus-summary-score-entry t]
1526 ["Customize" gnus-score-customize t])
1527 (gnus-make-score-map 'increase)
1528 (gnus-make-score-map 'lower)
1530 ["Kill below" gnus-summary-kill-below t]
1531 ["Mark above" gnus-summary-mark-above t]
1532 ["Tick above" gnus-summary-tick-above t]
1533 ["Clear above" gnus-summary-clear-above t])
1534 ["Current score" gnus-summary-current-score t]
1535 ["Set score" gnus-summary-set-score t]
1536 ["Switch current score file..." gnus-score-change-score-file t]
1537 ["Set mark below..." gnus-score-set-mark-below t]
1538 ["Set expunge below..." gnus-score-set-expunge-below t]
1539 ["Edit current score file" gnus-score-edit-current-scores t]
1540 ["Edit score file" gnus-score-edit-file t]
1541 ["Trace score" gnus-score-find-trace t]
1542 ["Find words" gnus-score-find-favourite-words t]
1543 ["Rescore buffer" gnus-summary-rescore t]
1544 ["Increase score..." gnus-summary-increase-score t]
1545 ["Lower score..." gnus-summary-lower-score t]))))
1547 ;; Define both the Article menu in the summary buffer and the equivalent
1548 ;; Commands menu in the article buffer here for consistency.
1551 ["All" gnus-article-hide t]
1552 ["Headers" gnus-article-hide-headers t]
1553 ["Signature" gnus-article-hide-signature t]
1554 ["Citation" gnus-article-hide-citation t]
1555 ["PGP" gnus-article-hide-pgp t]
1556 ["Boring headers" gnus-article-hide-boring-headers t])
1558 ["All" gnus-article-highlight t]
1559 ["Headers" gnus-article-highlight-headers t]
1560 ["Signature" gnus-article-highlight-signature t]
1561 ["Citation" gnus-article-highlight-citation t])
1563 ["Local" gnus-article-date-local t]
1564 ["ISO8601" gnus-article-date-iso8601 t]
1565 ["UT" gnus-article-date-ut t]
1566 ["Original" gnus-article-date-original t]
1567 ["Lapsed" gnus-article-date-lapsed t]
1568 ["User-defined" gnus-article-date-user t])
1571 ["Leading" gnus-article-strip-leading-blank-lines t]
1572 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1573 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1574 ["All of the above" gnus-article-strip-blank-lines t]
1575 ["All" gnus-article-strip-all-blank-lines t]
1576 ["Leading space" gnus-article-strip-leading-space t]
1577 ["Trailing space" gnus-article-strip-trailing-space t])
1578 ["Overstrike" gnus-article-treat-overstrike t]
1579 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1580 ["Emphasis" gnus-article-emphasize t]
1581 ["Word wrap" gnus-article-fill-cited-article t]
1582 ["CR" gnus-article-remove-cr t]
1583 ["Show X-Face" gnus-article-display-x-face t]
1584 ["UnHTMLize" gnus-article-treat-html t]
1585 ["Rot 13" gnus-summary-caesar-message t]
1586 ["Unix pipe" gnus-summary-pipe-message t]
1587 ["Add buttons" gnus-article-add-buttons t]
1588 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1589 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1590 ["Toggle MIME" gnus-summary-toggle-mime t]
1591 ["Verbose header" gnus-summary-verbose-headers t]
1592 ["Toggle header" gnus-summary-toggle-header t])
1594 ["Save in default format" gnus-summary-save-article t]
1595 ["Save in file" gnus-summary-save-article-file t]
1596 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1597 ["Save in MH folder" gnus-summary-save-article-folder t]
1598 ["Save in VM folder" gnus-summary-save-article-vm t]
1599 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1600 ["Save body in file" gnus-summary-save-article-body-file t]
1601 ["Pipe through a filter" gnus-summary-pipe-output t]
1602 ["Add to SOUP packet" gnus-soup-add-article t]
1603 ["Print" gnus-summary-print-article t])
1605 ["Respool article..." gnus-summary-respool-article t]
1606 ["Move article..." gnus-summary-move-article
1607 (gnus-check-backend-function
1608 'request-move-article gnus-newsgroup-name)]
1609 ["Copy article..." gnus-summary-copy-article t]
1610 ["Crosspost article..." gnus-summary-crosspost-article
1611 (gnus-check-backend-function
1612 'request-replace-article gnus-newsgroup-name)]
1613 ["Import file..." gnus-summary-import-article t]
1614 ["Check if posted" gnus-summary-article-posted-p t]
1615 ["Edit article" gnus-summary-edit-article
1616 (not (gnus-group-read-only-p))]
1617 ["Delete article" gnus-summary-delete-article
1618 (gnus-check-backend-function
1619 'request-expire-articles gnus-newsgroup-name)]
1620 ["Query respool" gnus-summary-respool-query t]
1621 ["Trace respool" gnus-summary-respool-trace t]
1622 ["Delete expirable articles" gnus-summary-expire-articles-now
1623 (gnus-check-backend-function
1624 'request-expire-articles gnus-newsgroup-name)])
1626 ["Uudecode" gnus-uu-decode-uu t]
1627 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1628 ["Unshar" gnus-uu-decode-unshar t]
1629 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1630 ["Save" gnus-uu-decode-save t]
1631 ["Binhex" gnus-uu-decode-binhex t]
1632 ["Postscript" gnus-uu-decode-postscript t])
1634 ["Enter article" gnus-cache-enter-article t]
1635 ["Remove article" gnus-cache-remove-article t])
1636 ["Select article buffer" gnus-summary-select-article-buffer t]
1637 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1638 ["Isearch article..." gnus-summary-isearch-article t]
1639 ["Beginning of the article" gnus-summary-beginning-of-article t]
1640 ["End of the article" gnus-summary-end-of-article t]
1641 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1642 ["Fetch referenced articles" gnus-summary-refer-references t]
1643 ["Fetch current thread" gnus-summary-refer-thread t]
1644 ["Fetch article with id..." gnus-summary-refer-article t]
1645 ["Redisplay" gnus-summary-show-article t])))
1647 gnus-summary-article-menu gnus-summary-mode-map ""
1648 (cons "Article" innards))
1651 gnus-article-commands-menu gnus-article-mode-map ""
1652 (cons "Commands" innards)))
1655 gnus-summary-thread-menu gnus-summary-mode-map ""
1657 ["Toggle threading" gnus-summary-toggle-threads t]
1658 ["Hide threads" gnus-summary-hide-all-threads t]
1659 ["Show threads" gnus-summary-show-all-threads t]
1660 ["Hide thread" gnus-summary-hide-thread t]
1661 ["Show thread" gnus-summary-show-thread t]
1662 ["Go to next thread" gnus-summary-next-thread t]
1663 ["Go to previous thread" gnus-summary-prev-thread t]
1664 ["Go down thread" gnus-summary-down-thread t]
1665 ["Go up thread" gnus-summary-up-thread t]
1666 ["Top of thread" gnus-summary-top-thread t]
1667 ["Mark thread as read" gnus-summary-kill-thread t]
1668 ["Lower thread score" gnus-summary-lower-thread t]
1669 ["Raise thread score" gnus-summary-raise-thread t]
1670 ["Rethread current" gnus-summary-rethread-current t]
1674 gnus-summary-post-menu gnus-summary-mode-map ""
1676 ["Post an article" gnus-summary-post-news t]
1677 ["Followup" gnus-summary-followup t]
1678 ["Followup and yank" gnus-summary-followup-with-original t]
1679 ["Supersede article" gnus-summary-supersede-article t]
1680 ["Cancel article" gnus-summary-cancel-article t]
1681 ["Reply" gnus-summary-reply t]
1682 ["Reply and yank" gnus-summary-reply-with-original t]
1683 ["Wide reply" gnus-summary-wide-reply t]
1684 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1685 ["Mail forward" gnus-summary-mail-forward t]
1686 ["Post forward" gnus-summary-post-forward t]
1687 ["Digest and mail" gnus-summary-mail-digest t]
1688 ["Digest and post" gnus-summary-post-digest t]
1689 ["Resend message" gnus-summary-resend-message t]
1690 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1691 ["Send a mail" gnus-summary-mail-other-window t]
1692 ["Uuencode and post" gnus-uu-post-news t]
1693 ["Followup via news" gnus-summary-followup-to-mail t]
1694 ["Followup via news and yank"
1695 gnus-summary-followup-to-mail-with-original t]
1697 ;;["Send" gnus-summary-send-draft t]
1698 ;;["Send bounced" gnus-resend-bounced-mail t])
1702 gnus-summary-misc-menu gnus-summary-mode-map ""
1705 ["Mark as read" gnus-summary-mark-as-read-forward t]
1706 ["Mark same subject and select"
1707 gnus-summary-kill-same-subject-and-select t]
1708 ["Mark same subject" gnus-summary-kill-same-subject t]
1709 ["Catchup" gnus-summary-catchup t]
1710 ["Catchup all" gnus-summary-catchup-all t]
1711 ["Catchup to here" gnus-summary-catchup-to-here t]
1712 ["Catchup region" gnus-summary-mark-region-as-read t]
1713 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1715 ["Tick" gnus-summary-tick-article-forward t]
1716 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1717 ["Remove marks" gnus-summary-clear-mark-forward t]
1718 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1719 ["Set bookmark" gnus-summary-set-bookmark t]
1720 ["Remove bookmark" gnus-summary-remove-bookmark t])
1722 ["Marks..." gnus-summary-limit-to-marks t]
1723 ["Subject..." gnus-summary-limit-to-subject t]
1724 ["Author..." gnus-summary-limit-to-author t]
1725 ["Age..." gnus-summary-limit-to-age t]
1726 ["Score" gnus-summary-limit-to-score t]
1727 ["Unread" gnus-summary-limit-to-unread t]
1728 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1729 ["Articles" gnus-summary-limit-to-articles t]
1730 ["Pop limit" gnus-summary-pop-limit t]
1731 ["Show dormant" gnus-summary-limit-include-dormant t]
1732 ["Hide childless dormant"
1733 gnus-summary-limit-exclude-childless-dormant t]
1734 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1735 ["Show expunged" gnus-summary-show-all-expunged t])
1737 ["Set mark" gnus-summary-mark-as-processable t]
1738 ["Remove mark" gnus-summary-unmark-as-processable t]
1739 ["Remove all marks" gnus-summary-unmark-all-processable t]
1740 ["Mark above" gnus-uu-mark-over t]
1741 ["Mark series" gnus-uu-mark-series t]
1742 ["Mark region" gnus-uu-mark-region t]
1743 ["Unmark region" gnus-uu-unmark-region t]
1744 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1745 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1746 ["Mark all" gnus-uu-mark-all t]
1747 ["Mark buffer" gnus-uu-mark-buffer t]
1748 ["Mark sparse" gnus-uu-mark-sparse t]
1749 ["Mark thread" gnus-uu-mark-thread t]
1750 ["Unmark thread" gnus-uu-unmark-thread t]
1751 ("Process Mark Sets"
1752 ["Kill" gnus-summary-kill-process-mark t]
1753 ["Yank" gnus-summary-yank-process-mark
1754 gnus-newsgroup-process-stack]
1755 ["Save" gnus-summary-save-process-mark t]))
1757 ["Page forward" gnus-summary-next-page t]
1758 ["Page backward" gnus-summary-prev-page t]
1759 ["Line forward" gnus-summary-scroll-up t])
1761 ["Next unread article" gnus-summary-next-unread-article t]
1762 ["Previous unread article" gnus-summary-prev-unread-article t]
1763 ["Next article" gnus-summary-next-article t]
1764 ["Previous article" gnus-summary-prev-article t]
1765 ["Next unread subject" gnus-summary-next-unread-subject t]
1766 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1767 ["Next article same subject" gnus-summary-next-same-subject t]
1768 ["Previous article same subject" gnus-summary-prev-same-subject t]
1769 ["First unread article" gnus-summary-first-unread-article t]
1770 ["Best unread article" gnus-summary-best-unread-article t]
1771 ["Go to subject number..." gnus-summary-goto-subject t]
1772 ["Go to article number..." gnus-summary-goto-article t]
1773 ["Go to the last article" gnus-summary-goto-last-article t]
1774 ["Pop article off history" gnus-summary-pop-article t])
1776 ["Sort by number" gnus-summary-sort-by-number t]
1777 ["Sort by author" gnus-summary-sort-by-author t]
1778 ["Sort by subject" gnus-summary-sort-by-subject t]
1779 ["Sort by date" gnus-summary-sort-by-date t]
1780 ["Sort by score" gnus-summary-sort-by-score t]
1781 ["Sort by lines" gnus-summary-sort-by-lines t])
1783 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1784 ["Describe group" gnus-summary-describe-group t]
1785 ["Read manual" gnus-info-find-node t])
1787 ["Pick and read" gnus-pick-mode t]
1788 ["Binary" gnus-binary-mode t])
1790 ["Regenerate" gnus-summary-prepare t]
1791 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1792 ["Toggle threading" gnus-summary-toggle-threads t])
1793 ["Filter articles..." gnus-summary-execute-command t]
1794 ["Run command on subjects..." gnus-summary-universal-argument t]
1795 ["Search articles forward..." gnus-summary-search-article-forward t]
1796 ["Search articles backward..." gnus-summary-search-article-backward t]
1797 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1798 ["Expand window" gnus-summary-expand-window t]
1799 ["Expire expirable articles" gnus-summary-expire-articles
1800 (gnus-check-backend-function
1801 'request-expire-articles gnus-newsgroup-name)]
1802 ["Edit local kill file" gnus-summary-edit-local-kill t]
1803 ["Edit main kill file" gnus-summary-edit-global-kill t]
1804 ["Edit group parameters" gnus-summary-edit-parameters t]
1805 ["Customize group parameters" gnus-summary-customize-parameters t]
1806 ["Send a bug report" gnus-bug t]
1808 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1809 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1810 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1811 ["Exit group" gnus-summary-exit t]
1812 ["Exit group without updating" gnus-summary-exit-no-update t]
1813 ["Exit and goto next group" gnus-summary-next-group t]
1814 ["Exit and goto prev group" gnus-summary-prev-group t]
1815 ["Reselect group" gnus-summary-reselect-current-group t]
1816 ["Rescan group" gnus-summary-rescan-group t]
1817 ["Update dribble" gnus-summary-save-newsrc t])))
1819 (gnus-run-hooks 'gnus-summary-menu-hook)))
1821 (defun gnus-score-set-default (var value)
1822 "A version of set that updates the GNU Emacs menu-bar."
1824 ;; It is the message that forces the active status to be updated.
1827 (defun gnus-make-score-map (type)
1828 "Make a summary score map of type TYPE."
1831 (let ((headers '(("author" "from" string)
1832 ("subject" "subject" string)
1833 ("article body" "body" string)
1834 ("article head" "head" string)
1835 ("xref" "xref" string)
1836 ("extra header" "extra" string)
1837 ("lines" "lines" number)
1838 ("followups to author" "followup" string)))
1839 (types '((number ("less than" <)
1842 (string ("substring" s)
1846 (perms '(("temporary" (current-time-string))
1854 (if (eq type 'lower)
1859 (setq header (car headers))
1865 (let ((ts (cdr (assoc (nth 2 header) types)))
1881 'gnus-summary-score-entry
1883 (if (or (string= (nth 1 header)
1885 (string= (nth 1 header)
1888 (list 'gnus-summary-header
1890 (list 'quote (nth 1 (car ts)))
1891 (list 'gnus-score-default nil)
1897 (list (nreverse outp))))
1900 (list (nreverse outt))))
1902 (setq headers (cdr headers)))
1903 (list (nreverse outh))))))))
1907 (defun gnus-summary-mode (&optional group)
1908 "Major mode for reading articles.
1910 All normal editing commands are switched off.
1911 \\<gnus-summary-mode-map>
1912 Each line in this buffer represents one article. To read an
1913 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1914 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1917 You can also post articles and send mail from this buffer. To
1918 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1919 of an article, type `\\[gnus-summary-reply]'.
1921 There are approx. one gazillion commands you can execute in this
1922 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1924 The following commands are available:
1926 \\{gnus-summary-mode-map}"
1928 (when (gnus-visual-p 'summary-menu 'menu)
1929 (gnus-summary-make-menu-bar))
1930 (kill-all-local-variables)
1931 (gnus-summary-make-local-variables)
1932 (gnus-make-thread-indent-array)
1933 (gnus-simplify-mode-line)
1934 (setq major-mode 'gnus-summary-mode)
1935 (setq mode-name "Summary")
1936 (make-local-variable 'minor-mode-alist)
1937 (use-local-map gnus-summary-mode-map)
1938 (buffer-disable-undo)
1939 (setq buffer-read-only t) ;Disable modification
1940 (setq truncate-lines t)
1941 (setq selective-display t)
1942 (setq selective-display-ellipses t) ;Display `...'
1943 (gnus-summary-set-display-table)
1944 (gnus-set-default-directory)
1945 (setq gnus-newsgroup-name group)
1946 (make-local-variable 'gnus-summary-line-format)
1947 (make-local-variable 'gnus-summary-line-format-spec)
1948 (make-local-variable 'gnus-summary-dummy-line-format)
1949 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1950 (make-local-variable 'gnus-summary-mark-positions)
1951 (make-local-hook 'post-command-hook)
1952 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1953 (make-local-hook 'pre-command-hook)
1954 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1955 (gnus-run-hooks 'gnus-summary-mode-hook)
1956 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1957 (gnus-update-summary-mark-positions))
1959 (defun gnus-summary-make-local-variables ()
1960 "Make all the local summary buffer variables."
1961 (let ((locals gnus-summary-local-variables)
1963 (while (setq local (pop locals))
1966 (if (eq (cdr local) 'global)
1967 ;; Copy the global value of the variable.
1968 (setq global (symbol-value (car local)))
1969 ;; Use the value from the list.
1970 (setq global (eval (cdr local))))
1971 (make-local-variable (car local))
1972 (set (car local) global))
1973 ;; Simple nil-valued local variable.
1974 (make-local-variable local)
1977 (defun gnus-summary-clear-local-variables ()
1978 (let ((locals gnus-summary-local-variables))
1980 (if (consp (car locals))
1981 (and (vectorp (caar locals))
1982 (set (caar locals) nil))
1983 (and (vectorp (car locals))
1984 (set (car locals) nil)))
1985 (setq locals (cdr locals)))))
1987 ;; Summary data functions.
1989 (defmacro gnus-data-number (data)
1992 (defmacro gnus-data-set-number (data number)
1993 `(setcar ,data ,number))
1995 (defmacro gnus-data-mark (data)
1998 (defmacro gnus-data-set-mark (data mark)
1999 `(setcar (nthcdr 1 ,data) ,mark))
2001 (defmacro gnus-data-pos (data)
2004 (defmacro gnus-data-set-pos (data pos)
2005 `(setcar (nthcdr 2 ,data) ,pos))
2007 (defmacro gnus-data-header (data)
2010 (defmacro gnus-data-set-header (data header)
2011 `(setf (nth 3 ,data) ,header))
2013 (defmacro gnus-data-level (data)
2016 (defmacro gnus-data-unread-p (data)
2017 `(= (nth 1 ,data) gnus-unread-mark))
2019 (defmacro gnus-data-read-p (data)
2020 `(/= (nth 1 ,data) gnus-unread-mark))
2022 (defmacro gnus-data-pseudo-p (data)
2023 `(consp (nth 3 ,data)))
2025 (defmacro gnus-data-find (number)
2026 `(assq ,number gnus-newsgroup-data))
2028 (defmacro gnus-data-find-list (number &optional data)
2029 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2030 (memq (assq ,number bdata)
2033 (defmacro gnus-data-make (number mark pos header level)
2034 `(list ,number ,mark ,pos ,header ,level))
2036 (defun gnus-data-enter (after-article number mark pos header level offset)
2037 (let ((data (gnus-data-find-list after-article)))
2039 (error "No such article: %d" after-article))
2040 (setcdr data (cons (gnus-data-make number mark pos header level)
2042 (setq gnus-newsgroup-data-reverse nil)
2043 (gnus-data-update-list (cddr data) offset)))
2045 (defun gnus-data-enter-list (after-article list &optional offset)
2047 (let ((data (and after-article (gnus-data-find-list after-article)))
2051 (let ((odata gnus-newsgroup-data))
2052 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2054 (gnus-data-update-list odata offset)))
2055 ;; Find the last element in the list to be spliced into the main
2058 (setq list (cdr list)))
2061 (setcdr list gnus-newsgroup-data)
2062 (setq gnus-newsgroup-data ilist)
2064 (gnus-data-update-list (cdr list) offset)))
2065 (setcdr list (cdr data))
2068 (gnus-data-update-list (cdr list) offset))))
2069 (setq gnus-newsgroup-data-reverse nil))))
2071 (defun gnus-data-remove (article &optional offset)
2072 (let ((data gnus-newsgroup-data))
2073 (if (= (gnus-data-number (car data)) article)
2075 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2076 gnus-newsgroup-data-reverse nil)
2078 (gnus-data-update-list gnus-newsgroup-data offset)))
2080 (when (= (gnus-data-number (cadr data)) article)
2081 (setcdr data (cddr data))
2083 (gnus-data-update-list (cdr data) offset))
2085 gnus-newsgroup-data-reverse nil))
2086 (setq data (cdr data))))))
2088 (defmacro gnus-data-list (backward)
2090 (or gnus-newsgroup-data-reverse
2091 (setq gnus-newsgroup-data-reverse
2092 (reverse gnus-newsgroup-data)))
2093 gnus-newsgroup-data))
2095 (defun gnus-data-update-list (data offset)
2096 "Add OFFSET to the POS of all data entries in DATA."
2097 (setq gnus-newsgroup-data-reverse nil)
2099 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2100 (setq data (cdr data))))
2102 (defun gnus-summary-article-pseudo-p (article)
2103 "Say whether this article is a pseudo article or not."
2104 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2106 (defmacro gnus-summary-article-sparse-p (article)
2107 "Say whether this article is a sparse article or not."
2108 `(memq ,article gnus-newsgroup-sparse))
2110 (defmacro gnus-summary-article-ancient-p (article)
2111 "Say whether this article is a sparse article or not."
2112 `(memq ,article gnus-newsgroup-ancient))
2114 (defun gnus-article-parent-p (number)
2115 "Say whether this article is a parent or not."
2116 (let ((data (gnus-data-find-list number)))
2117 (and (cdr data) ; There has to be an article after...
2118 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2119 (gnus-data-level (nth 1 data))))))
2121 (defun gnus-article-children (number)
2122 "Return a list of all children to NUMBER."
2123 (let* ((data (gnus-data-find-list number))
2124 (level (gnus-data-level (car data)))
2126 (setq data (cdr data))
2128 (= (gnus-data-level (car data)) (1+ level)))
2129 (push (gnus-data-number (car data)) children)
2130 (setq data (cdr data)))
2133 (defmacro gnus-summary-skip-intangible ()
2134 "If the current article is intangible, then jump to a different article."
2135 '(let ((to (get-text-property (point) 'gnus-intangible)))
2136 (and to (gnus-summary-goto-subject to))))
2138 (defmacro gnus-summary-article-intangible-p ()
2139 "Say whether this article is intangible or not."
2140 '(get-text-property (point) 'gnus-intangible))
2142 (defun gnus-article-read-p (article)
2143 "Say whether ARTICLE is read or not."
2144 (not (or (memq article gnus-newsgroup-marked)
2145 (memq article gnus-newsgroup-unreads)
2146 (memq article gnus-newsgroup-unselected)
2147 (memq article gnus-newsgroup-dormant))))
2149 ;; Some summary mode macros.
2151 (defmacro gnus-summary-article-number ()
2152 "The article number of the article on the current line.
2153 If there isn's an article number here, then we return the current
2156 (gnus-summary-skip-intangible)
2157 (or (get-text-property (point) 'gnus-number)
2158 (gnus-summary-last-subject))))
2160 (defmacro gnus-summary-article-header (&optional number)
2161 "Return the header of article NUMBER."
2162 `(gnus-data-header (gnus-data-find
2163 ,(or number '(gnus-summary-article-number)))))
2165 (defmacro gnus-summary-thread-level (&optional number)
2166 "Return the level of thread that starts with article NUMBER."
2167 `(if (and (eq gnus-summary-make-false-root 'dummy)
2168 (get-text-property (point) 'gnus-intangible))
2170 (gnus-data-level (gnus-data-find
2171 ,(or number '(gnus-summary-article-number))))))
2173 (defmacro gnus-summary-article-mark (&optional number)
2174 "Return the mark of article NUMBER."
2175 `(gnus-data-mark (gnus-data-find
2176 ,(or number '(gnus-summary-article-number)))))
2178 (defmacro gnus-summary-article-pos (&optional number)
2179 "Return the position of the line of article NUMBER."
2180 `(gnus-data-pos (gnus-data-find
2181 ,(or number '(gnus-summary-article-number)))))
2183 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2184 (defmacro gnus-summary-article-subject (&optional number)
2185 "Return current subject string or nil if nothing."
2188 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2189 '(gnus-data-header (assq (gnus-summary-article-number)
2190 gnus-newsgroup-data)))))
2193 (mail-header-subject headers))))
2195 (defmacro gnus-summary-article-score (&optional number)
2196 "Return current article score."
2197 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2198 gnus-newsgroup-scored))
2199 gnus-summary-default-score 0))
2201 (defun gnus-summary-article-children (&optional number)
2202 "Return a list of article numbers that are children of article NUMBER."
2203 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2204 (level (gnus-data-level (car data)))
2206 (while (and (setq data (cdr data))
2207 (> (setq l (gnus-data-level (car data))) level))
2208 (and (= (1+ level) l)
2209 (push (gnus-data-number (car data))
2211 (nreverse children)))
2213 (defun gnus-summary-article-parent (&optional number)
2214 "Return the article number of the parent of article NUMBER."
2215 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2216 (gnus-data-list t)))
2217 (level (gnus-data-level (car data))))
2219 () ; This is a root.
2220 ;; We search until we find an article with a level less than
2221 ;; this one. That function has to be the parent.
2222 (while (and (setq data (cdr data))
2223 (not (< (gnus-data-level (car data)) level))))
2224 (and data (gnus-data-number (car data))))))
2226 (defun gnus-unread-mark-p (mark)
2227 "Say whether MARK is the unread mark."
2228 (= mark gnus-unread-mark))
2230 (defun gnus-read-mark-p (mark)
2231 "Say whether MARK is one of the marks that mark as read.
2232 This is all marks except unread, ticked, dormant, and expirable."
2233 (not (or (= mark gnus-unread-mark)
2234 (= mark gnus-ticked-mark)
2235 (= mark gnus-dormant-mark)
2236 (= mark gnus-expirable-mark))))
2238 (defmacro gnus-article-mark (number)
2239 "Return the MARK of article NUMBER.
2240 This macro should only be used when computing the mark the \"first\"
2241 time; i.e., when generating the summary lines. After that,
2242 `gnus-summary-article-mark' should be used to examine the
2245 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2246 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2247 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2248 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2249 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2250 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2251 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2252 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2253 gnus-ancient-mark))))
2255 ;; Saving hidden threads.
2257 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2258 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2260 (defmacro gnus-save-hidden-threads (&rest forms)
2261 "Save hidden threads, eval FORMS, and restore the hidden threads."
2262 (let ((config (make-symbol "config")))
2263 `(let ((,config (gnus-hidden-threads-configuration)))
2267 (gnus-restore-hidden-threads-configuration ,config)))))
2269 (defun gnus-data-compute-positions ()
2270 "Compute the positions of all articles."
2271 (setq gnus-newsgroup-data-reverse nil)
2272 (let ((data gnus-newsgroup-data))
2274 (gnus-save-hidden-threads
2275 (gnus-summary-show-all-threads)
2276 (goto-char (point-min))
2278 (while (get-text-property (point) 'gnus-intangible)
2280 (gnus-data-set-pos (car data) (+ (point) 3))
2281 (setq data (cdr data))
2282 (forward-line 1))))))
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 (eq (char-after) ?\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 (gnus-get-buffer-create buffer)))
2345 (gnus-summary-mode group)
2347 (gnus-carpal-setup-buffer 'summary))
2348 (unless gnus-single-article-buffer
2349 (make-local-variable 'gnus-article-buffer)
2350 (make-local-variable 'gnus-article-current)
2351 (make-local-variable 'gnus-original-article-buffer))
2352 (setq gnus-newsgroup-name group)
2355 (defun gnus-set-global-variables ()
2356 ;; Set the global equivalents of the summary buffer-local variables
2357 ;; to the latest values they had. These reflect the summary buffer
2358 ;; that was in action when the last article was fetched.
2359 (when (eq major-mode 'gnus-summary-mode)
2360 (setq gnus-summary-buffer (current-buffer))
2361 (let ((name gnus-newsgroup-name)
2362 (marked gnus-newsgroup-marked)
2363 (unread gnus-newsgroup-unreads)
2364 (headers gnus-current-headers)
2365 (data gnus-newsgroup-data)
2366 (summary gnus-summary-buffer)
2367 (article-buffer gnus-article-buffer)
2368 (original gnus-original-article-buffer)
2369 (gac gnus-article-current)
2370 (reffed gnus-reffed-article-number)
2371 (score-file gnus-current-score-file)
2372 (default-charset gnus-newsgroup-default-charset)
2373 (iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
2375 (set-buffer gnus-group-buffer)
2376 (setq gnus-newsgroup-name name
2377 gnus-newsgroup-marked marked
2378 gnus-newsgroup-unreads unread
2379 gnus-current-headers headers
2380 gnus-newsgroup-data data
2381 gnus-article-current gac
2382 gnus-summary-buffer summary
2383 gnus-article-buffer article-buffer
2384 gnus-original-article-buffer original
2385 gnus-reffed-article-number reffed
2386 gnus-current-score-file score-file
2387 gnus-newsgroup-default-charset default-charset
2388 gnus-newsgroup-iso-8859-1-forced iso-8859-1-forced)
2389 ;; The article buffer also has local variables.
2390 (when (gnus-buffer-live-p gnus-article-buffer)
2391 (set-buffer gnus-article-buffer)
2392 (setq gnus-summary-buffer summary))))))
2394 (defun gnus-summary-article-unread-p (article)
2395 "Say whether ARTICLE is unread or not."
2396 (memq article gnus-newsgroup-unreads))
2398 (defun gnus-summary-first-article-p (&optional article)
2399 "Return whether ARTICLE is the first article in the buffer."
2400 (if (not (setq article (or article (gnus-summary-article-number))))
2402 (eq article (caar gnus-newsgroup-data))))
2404 (defun gnus-summary-last-article-p (&optional article)
2405 "Return whether ARTICLE is the last article in the buffer."
2406 (if (not (setq article (or article (gnus-summary-article-number))))
2407 t ; All non-existent numbers are the last article. :-)
2408 (not (cdr (gnus-data-find-list article)))))
2410 (defun gnus-make-thread-indent-array ()
2412 (unless (and gnus-thread-indent-array
2413 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2414 (setq gnus-thread-indent-array (make-vector 201 "")
2415 gnus-thread-indent-array-level gnus-thread-indent-level)
2417 (aset gnus-thread-indent-array n
2418 (make-string (* n gnus-thread-indent-level) ? ))
2421 (defun gnus-update-summary-mark-positions ()
2422 "Compute where the summary marks are to go."
2424 (when (gnus-buffer-exists-p gnus-summary-buffer)
2425 (set-buffer gnus-summary-buffer))
2426 (let ((gnus-replied-mark 129)
2427 (gnus-score-below-mark 130)
2428 (gnus-score-over-mark 130)
2429 (gnus-download-mark 131)
2430 (spec gnus-summary-line-format-spec)
2433 (gnus-set-work-buffer)
2434 (let ((gnus-summary-line-format-spec spec)
2435 (gnus-newsgroup-downloadable '((0 . t))))
2436 (gnus-summary-insert-line
2437 (make-full-mail-header 0 "" "" "" "" "" 0 0 "" nil)
2438 0 nil 128 t nil "" nil 1)
2439 (goto-char (point-min))
2440 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2442 (goto-char (point-min))
2443 (push (cons 'replied (and (search-forward "\201" nil t)
2446 (goto-char (point-min))
2447 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2449 (goto-char (point-min))
2450 (push (cons 'download
2451 (and (search-forward "\203" nil t) (- (point) 2)))
2453 (setq gnus-summary-mark-positions pos))))
2455 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2456 "Insert a dummy root in the summary buffer."
2458 (gnus-add-text-properties
2459 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2460 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2462 (defun gnus-summary-from-or-to-or-newsgroups (header)
2463 (let ((to (cdr (assq 'To (mail-header-extra header))))
2464 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2465 (rfc2047-default-charset gnus-newsgroup-default-charset)
2466 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
2469 gnus-ignored-from-addresses
2470 (string-match gnus-ignored-from-addresses
2471 (mail-header-from header)))
2473 (or (car (funcall gnus-extract-address-components
2475 gnus-decode-encoded-word-function to)))
2476 (funcall gnus-decode-encoded-word-function to))))
2478 gnus-ignored-from-addresses
2479 (string-match gnus-ignored-from-addresses
2480 (mail-header-from header)))
2481 (concat "=> " newsgroups))
2483 (or (car (funcall gnus-extract-address-components
2484 (mail-header-from header)))
2485 (mail-header-from header))))))
2487 (defun gnus-summary-insert-line (gnus-tmp-header
2488 gnus-tmp-level gnus-tmp-current
2489 gnus-tmp-unread gnus-tmp-replied
2490 gnus-tmp-expirable gnus-tmp-subject-or-nil
2491 &optional gnus-tmp-dummy gnus-tmp-score
2493 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2494 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2495 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2496 (gnus-tmp-score-char
2497 (if (or (null gnus-summary-default-score)
2498 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2499 gnus-summary-zcore-fuzz))
2501 (if (< gnus-tmp-score gnus-summary-default-score)
2502 gnus-score-below-mark gnus-score-over-mark)))
2504 (cond (gnus-tmp-process gnus-process-mark)
2505 ((memq gnus-tmp-current gnus-newsgroup-cached)
2507 (gnus-tmp-replied gnus-replied-mark)
2508 ((memq gnus-tmp-current gnus-newsgroup-saved)
2510 (t gnus-unread-mark)))
2511 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2514 ((string-match "<[^>]+> *$" gnus-tmp-from)
2515 (let ((beg (match-beginning 0)))
2516 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2517 (substring gnus-tmp-from (1+ (match-beginning 0))
2518 (1- (match-end 0))))
2519 (substring gnus-tmp-from 0 beg))))
2520 ((string-match "(.+)" gnus-tmp-from)
2521 (substring gnus-tmp-from
2522 (1+ (match-beginning 0)) (1- (match-end 0))))
2524 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2525 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2526 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2527 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2528 (buffer-read-only nil))
2529 (when (string= gnus-tmp-name "")
2530 (setq gnus-tmp-name gnus-tmp-from))
2531 (unless (numberp gnus-tmp-lines)
2532 (setq gnus-tmp-lines 0))
2533 (gnus-put-text-property-excluding-characters-with-faces
2535 (progn (eval gnus-summary-line-format-spec) (point))
2536 'gnus-number gnus-tmp-number)
2537 (when (gnus-visual-p 'summary-highlight 'highlight)
2539 (gnus-run-hooks 'gnus-summary-update-hook)
2542 (defun gnus-summary-update-line (&optional dont-update)
2543 ;; Update summary line after change.
2544 (when (and gnus-summary-default-score
2545 (not gnus-summary-inhibit-highlight))
2546 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2547 (article (gnus-summary-article-number))
2548 (score (gnus-summary-article-score article)))
2550 (if (and gnus-summary-mark-below
2551 (< (gnus-summary-article-score)
2552 gnus-summary-mark-below))
2553 ;; This article has a low score, so we mark it as read.
2554 (when (memq article gnus-newsgroup-unreads)
2555 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2556 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2557 ;; This article was previously marked as read on account
2558 ;; of a low score, but now it has risen, so we mark it as
2560 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2561 (gnus-summary-update-mark
2562 (if (or (null gnus-summary-default-score)
2563 (<= (abs (- score gnus-summary-default-score))
2564 gnus-summary-zcore-fuzz))
2566 (if (< score gnus-summary-default-score)
2567 gnus-score-below-mark gnus-score-over-mark))
2569 ;; Do visual highlighting.
2570 (when (gnus-visual-p 'summary-highlight 'highlight)
2571 (gnus-run-hooks 'gnus-summary-update-hook)))))
2573 (defvar gnus-tmp-new-adopts nil)
2575 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2576 "Return the number of articles in THREAD.
2577 This may be 0 in some cases -- if none of the articles in
2578 the thread are to be displayed."
2580 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2582 ((not (listp thread))
2584 ((and (consp thread) (cdr thread))
2587 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2590 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2593 (when (and level (zerop level) gnus-tmp-new-adopts)
2596 'gnus-summary-number-of-articles-in-thread
2597 gnus-tmp-new-adopts))))
2599 (if (> number 1) gnus-not-empty-thread-mark
2600 gnus-empty-thread-mark)
2603 (defun gnus-summary-set-local-parameters (group)
2604 "Go through the local params of GROUP and set all variable specs in that list."
2605 (let ((params (gnus-group-find-parameter group))
2608 (setq elem (car params)
2609 params (cdr params))
2610 (and (consp elem) ; Has to be a cons.
2611 (consp (cdr elem)) ; The cdr has to be a list.
2612 (symbolp (car elem)) ; Has to be a symbol in there.
2613 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2614 (ignore-errors ; So we set it.
2615 (make-local-variable (car elem))
2616 (set (car elem) (eval (nth 1 elem))))))))
2618 (defun gnus-summary-read-group (group &optional show-all no-article
2619 kill-buffer no-display backward
2621 "Start reading news in newsgroup GROUP.
2622 If SHOW-ALL is non-nil, already read articles are also listed.
2623 If NO-ARTICLE is non-nil, no article is selected initially.
2624 If NO-DISPLAY, don't generate a summary buffer."
2628 (let ((gnus-auto-select-next nil))
2629 (or (gnus-summary-read-group-1
2630 group show-all no-article
2631 kill-buffer no-display
2634 select-articles nil)))))
2635 (eq gnus-auto-select-next 'quietly))
2636 (set-buffer gnus-group-buffer)
2637 ;; The entry function called above goes to the next
2638 ;; group automatically, so we go two groups back
2639 ;; if we are searching for the previous group.
2641 (gnus-group-prev-unread-group 2))
2642 (if (not (equal group (gnus-group-group-name)))
2643 (setq group (gnus-group-group-name))
2647 (defun gnus-summary-read-group-1 (group show-all no-article
2648 kill-buffer no-display
2649 &optional select-articles)
2650 ;; Killed foreign groups can't be entered.
2651 (when (and (not (gnus-group-native-p group))
2652 (not (gnus-gethash group gnus-newsrc-hashtb)))
2653 (error "Dead non-native groups can't be entered"))
2654 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2655 (let* ((new-group (gnus-summary-setup-buffer group))
2656 (quit-config (gnus-group-quit-config group))
2657 (did-select (and new-group (gnus-select-newsgroup
2658 group show-all select-articles))))
2660 ;; This summary buffer exists already, so we just select it.
2662 (gnus-set-global-variables)
2664 (gnus-kill-or-deaden-summary kill-buffer))
2665 (gnus-configure-windows 'summary 'force)
2666 (gnus-set-mode-line 'summary)
2667 (gnus-summary-position-point)
2670 ;; We couldn't select this group.
2672 (when (and (eq major-mode 'gnus-summary-mode)
2673 (not (equal (current-buffer) kill-buffer)))
2674 (kill-buffer (current-buffer))
2675 (if (not quit-config)
2677 ;; Update the info -- marks might need to be removed,
2679 (gnus-summary-update-info)
2680 (set-buffer gnus-group-buffer)
2681 (gnus-group-jump-to-group group)
2682 (gnus-group-next-unread-group 1))
2683 (gnus-handle-ephemeral-exit quit-config)))
2684 (gnus-message 3 "Can't select group")
2686 ;; The user did a `C-g' while prompting for number of articles,
2687 ;; so we exit this group.
2688 ((eq did-select 'quit)
2689 (and (eq major-mode 'gnus-summary-mode)
2690 (not (equal (current-buffer) kill-buffer))
2691 (kill-buffer (current-buffer)))
2693 (gnus-kill-or-deaden-summary kill-buffer))
2694 (if (not quit-config)
2696 (set-buffer gnus-group-buffer)
2697 (gnus-group-jump-to-group group)
2698 (gnus-group-next-unread-group 1)
2699 (gnus-configure-windows 'group 'force))
2700 (gnus-handle-ephemeral-exit quit-config))
2701 ;; Finally signal the quit.
2703 ;; The group was successfully selected.
2705 (gnus-set-global-variables)
2706 ;; Save the active value in effect when the group was entered.
2707 (setq gnus-newsgroup-active
2709 (gnus-active gnus-newsgroup-name)))
2710 ;; You can change the summary buffer in some way with this hook.
2711 (gnus-run-hooks 'gnus-select-group-hook)
2712 ;; Set any local variables in the group parameters.
2713 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2714 (gnus-update-format-specifications
2715 nil 'summary 'summary-mode 'summary-dummy)
2716 ;; Do score processing.
2717 (when gnus-use-scoring
2718 (gnus-possibly-score-headers))
2719 ;; Check whether to fill in the gaps in the threads.
2720 (when gnus-build-sparse-threads
2721 (gnus-build-sparse-threads))
2722 ;; Find the initial limit.
2723 (if gnus-show-threads
2725 (let ((gnus-newsgroup-dormant nil))
2726 (gnus-summary-initial-limit show-all))
2727 (gnus-summary-initial-limit show-all))
2728 (setq gnus-newsgroup-limit
2730 (lambda (header) (mail-header-number header))
2731 gnus-newsgroup-headers)))
2732 ;; Generate the summary buffer.
2734 (gnus-summary-prepare))
2735 (when gnus-use-trees
2736 (gnus-tree-open group)
2737 (setq gnus-summary-highlight-line-function
2738 'gnus-tree-highlight-article))
2739 ;; If the summary buffer is empty, but there are some low-scored
2740 ;; articles or some excluded dormants, we include these in the
2742 (when (and (zerop (buffer-size))
2744 (cond (gnus-newsgroup-dormant
2745 (gnus-summary-limit-include-dormant))
2746 ((and gnus-newsgroup-scored show-all)
2747 (gnus-summary-limit-include-expunged t))))
2748 ;; Function `gnus-apply-kill-file' must be called in this hook.
2749 (gnus-run-hooks 'gnus-apply-kill-hook)
2750 (if (and (zerop (buffer-size))
2753 ;; This newsgroup is empty.
2754 (gnus-summary-catchup-and-exit nil t)
2755 (gnus-message 6 "No unread news")
2757 (gnus-kill-or-deaden-summary kill-buffer))
2758 ;; Return nil from this function.
2760 ;; Hide conversation thread subtrees. We cannot do this in
2761 ;; gnus-summary-prepare-hook since kill processing may not
2762 ;; work with hidden articles.
2763 (and gnus-show-threads
2764 gnus-thread-hide-subtree
2765 (gnus-summary-hide-all-threads))
2767 (gnus-kill-or-deaden-summary kill-buffer))
2768 ;; Show first unread article if requested.
2769 (if (and (not no-article)
2771 gnus-newsgroup-unreads
2772 gnus-auto-select-first)
2774 (gnus-configure-windows 'summary)
2776 ((eq gnus-auto-select-first 'best)
2777 (gnus-summary-best-unread-article))
2778 ((eq gnus-auto-select-first t)
2779 (gnus-summary-first-unread-article))
2780 ((gnus-functionp gnus-auto-select-first)
2781 (funcall gnus-auto-select-first))))
2782 ;; Don't select any articles, just move point to the first
2783 ;; article in the group.
2784 (goto-char (point-min))
2785 (gnus-summary-position-point)
2786 (gnus-configure-windows 'summary 'force)
2787 (gnus-set-mode-line 'summary))
2788 (when (get-buffer-window gnus-group-buffer t)
2789 ;; Gotta use windows, because recenter does weird stuff if
2790 ;; the current buffer ain't the displayed window.
2791 (let ((owin (selected-window)))
2792 (select-window (get-buffer-window gnus-group-buffer t))
2793 (when (gnus-group-goto-group group)
2795 (select-window owin)))
2796 ;; Mark this buffer as "prepared".
2797 (setq gnus-newsgroup-prepared t)
2798 (gnus-run-hooks 'gnus-summary-prepared-hook)
2801 (defun gnus-summary-prepare ()
2802 "Generate the summary buffer."
2804 (let ((buffer-read-only nil))
2806 (setq gnus-newsgroup-data nil
2807 gnus-newsgroup-data-reverse nil)
2808 (gnus-run-hooks 'gnus-summary-generate-hook)
2809 ;; Generate the buffer, either with threads or without.
2810 (when gnus-newsgroup-headers
2811 (gnus-summary-prepare-threads
2812 (if gnus-show-threads
2813 (gnus-sort-gathered-threads
2814 (funcall gnus-summary-thread-gathering-function
2816 (gnus-cut-threads (gnus-make-threads)))))
2817 ;; Unthreaded display.
2818 (gnus-sort-articles gnus-newsgroup-headers))))
2819 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2820 ;; Call hooks for modifying summary buffer.
2821 (goto-char (point-min))
2822 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2824 (defsubst gnus-general-simplify-subject (subject)
2825 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2828 ;; Truncate the subject.
2829 (gnus-simplify-subject-functions
2830 (gnus-map-function gnus-simplify-subject-functions subject))
2831 ((numberp gnus-summary-gather-subject-limit)
2832 (setq subject (gnus-simplify-subject-re subject))
2833 (if (> (length subject) gnus-summary-gather-subject-limit)
2834 (substring subject 0 gnus-summary-gather-subject-limit)
2836 ;; Fuzzily simplify it.
2837 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2838 (gnus-simplify-subject-fuzzy subject))
2839 ;; Just remove the leading "Re:".
2841 (gnus-simplify-subject-re subject))))
2843 (if (and gnus-summary-gather-exclude-subject
2844 (string-match gnus-summary-gather-exclude-subject subject))
2845 nil ; This article shouldn't be gathered
2848 (defun gnus-summary-simplify-subject-query ()
2849 "Query where the respool algorithm would put this article."
2851 (gnus-summary-select-article)
2852 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2854 (defun gnus-gather-threads-by-subject (threads)
2855 "Gather threads by looking at Subject headers."
2856 (if (not gnus-summary-make-false-root)
2858 (let ((hashtb (gnus-make-hashtable 1024))
2861 subject hthread whole-subject)
2863 (setq subject (gnus-general-simplify-subject
2864 (setq whole-subject (mail-header-subject
2867 (if (setq hthread (gnus-gethash subject hashtb))
2869 ;; We enter a dummy root into the thread, if we
2870 ;; haven't done that already.
2871 (unless (stringp (caar hthread))
2872 (setcar hthread (list whole-subject (car hthread))))
2873 ;; We add this new gathered thread to this gathered
2875 (setcdr (car hthread)
2876 (nconc (cdar hthread) (list (car threads))))
2877 ;; Remove it from the list of threads.
2878 (setcdr prev (cdr threads))
2879 (setq threads prev))
2880 ;; Enter this thread into the hash table.
2881 (gnus-sethash subject threads hashtb)))
2883 (setq threads (cdr threads)))
2886 (defun gnus-gather-threads-by-references (threads)
2887 "Gather threads by looking at References headers."
2888 (let ((idhashtb (gnus-make-hashtable 1024))
2889 (thhashtb (gnus-make-hashtable 1024))
2892 ids references id gthread gid entered ref)
2894 (when (setq references (mail-header-references (caar threads)))
2895 (setq id (mail-header-id (caar threads))
2896 ids (gnus-split-references references)
2898 (while (setq ref (pop ids))
2899 (setq ids (delete ref ids))
2900 (if (not (setq gid (gnus-gethash ref idhashtb)))
2902 (gnus-sethash ref id idhashtb)
2903 (gnus-sethash id threads thhashtb))
2904 (setq gthread (gnus-gethash gid thhashtb))
2906 ;; We enter a dummy root into the thread, if we
2907 ;; haven't done that already.
2908 (unless (stringp (caar gthread))
2909 (setcar gthread (list (mail-header-subject (caar gthread))
2911 ;; We add this new gathered thread to this gathered
2913 (setcdr (car gthread)
2914 (nconc (cdar gthread) (list (car threads)))))
2915 ;; Add it into the thread hash table.
2916 (gnus-sethash id gthread thhashtb)
2918 ;; Remove it from the list of threads.
2919 (setcdr prev (cdr threads))
2920 (setq threads prev))))
2922 (setq threads (cdr threads)))
2925 (defun gnus-sort-gathered-threads (threads)
2926 "Sort subtreads inside each gathered thread by article number."
2927 (let ((result threads))
2929 (when (stringp (caar threads))
2930 (setcdr (car threads)
2931 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2932 (setq threads (cdr threads)))
2935 (defun gnus-thread-loop-p (root thread)
2936 "Say whether ROOT is in THREAD."
2937 (let ((stack (list thread))
2940 (while (setq thread (pop stack))
2941 (setq th (cdr thread))
2943 (not (eq (caar th) root)))
2946 ;; We have found a loop.
2948 (setcdr thread (delq (car th) (cdr thread)))
2949 (if (boundp (setq ref-dep (intern "none"
2950 gnus-newsgroup-dependencies)))
2951 (setcdr (symbol-value ref-dep)
2952 (nconc (cdr (symbol-value ref-dep))
2954 (set ref-dep (list nil (car th))))
2957 ;; Push all the subthreads onto the stack.
2958 (push (cdr thread) stack)))
2961 (defun gnus-make-threads ()
2962 "Go through the dependency hashtb and find the roots. Return all threads."
2964 (while (catch 'infloop
2967 ;; Deal with self-referencing References loops.
2968 (when (and (car (symbol-value refs))
2975 (car (symbol-value refs)) thread))
2976 (cdr (symbol-value refs)))))))
2979 (unless (car (symbol-value refs))
2980 ;; These threads do not refer back to any other articles,
2981 ;; so they're roots.
2982 (setq threads (append (cdr (symbol-value refs)) threads))))
2983 gnus-newsgroup-dependencies)))
2986 ;; Build the thread tree.
2987 (defsubst gnus-dependencies-add-header (header dependencies force-new)
2988 "Enter HEADER into the DEPENDENCIES table if it is not already there.
2990 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
2991 if it was already present.
2993 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
2994 will not be entered in the DEPENDENCIES table. Otherwise duplicate
2995 Message-IDs will be renamed be renamed to a unique Message-ID before
2998 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
2999 (let* ((id (mail-header-id header))
3000 (id-dep (and id (intern id dependencies)))
3001 ref ref-dep ref-header)
3002 ;; Enter this `header' in the `dependencies' table.
3006 ;; The first two cases do the normal part: enter a new `header'
3007 ;; in the `dependencies' table.
3008 ((not (boundp id-dep))
3009 (set id-dep (list header)))
3010 ((null (car (symbol-value id-dep)))
3011 (setcar (symbol-value id-dep) header))
3013 ;; From here the `header' was already present in the
3014 ;; `dependencies' table.
3016 ;; Overrides an existing entry;
3017 ;; just set the header part of the entry.
3018 (setcar (symbol-value id-dep) header))
3020 ;; Renames the existing `header' to a unique Message-ID.
3021 ((not gnus-summary-ignore-duplicates)
3022 ;; An article with this Message-ID has already been seen.
3023 ;; We rename the Message-ID.
3024 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3026 (mail-header-set-id header id))
3028 ;; The last case ignores an existing entry, except it adds any
3029 ;; additional Xrefs (in case the two articles came from different
3031 ;; Also sets `header' to `nil' meaning that the `dependencies'
3032 ;; table was *not* modified.
3034 (mail-header-set-xref
3035 (car (symbol-value id-dep))
3036 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3038 (or (mail-header-xref header) "")))
3042 ;; First check if that we are not creating a References loop.
3043 (setq ref (gnus-parent-id (mail-header-references header)))
3045 (setq ref-dep (intern-soft ref dependencies))
3047 (setq ref-header (car (symbol-value ref-dep))))
3048 (if (string= id ref)
3049 ;; Yuk! This is a reference loop. Make the article be a
3052 (mail-header-set-references (car (symbol-value id-dep)) "none")
3054 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3055 (setq ref (gnus-parent-id (mail-header-references header)))
3056 (setq ref-dep (intern (or ref "none") dependencies))
3057 (if (boundp ref-dep)
3058 (setcdr (symbol-value ref-dep)
3059 (nconc (cdr (symbol-value ref-dep))
3060 (list (symbol-value id-dep))))
3061 (set ref-dep (list nil (symbol-value id-dep)))))
3064 (defun gnus-build-sparse-threads ()
3065 (let ((headers gnus-newsgroup-headers)
3066 (gnus-summary-ignore-duplicates t)
3067 header references generation relations
3068 subject child end new-child date)
3069 ;; First we create an alist of generations/relations, where
3070 ;; generations is how much we trust the relation, and the relation
3072 (gnus-message 7 "Making sparse threads...")
3074 (nnheader-set-temp-buffer " *gnus sparse threads*")
3075 (while (setq header (pop headers))
3076 (when (and (setq references (mail-header-references header))
3077 (not (string= references "")))
3079 (setq child (mail-header-id header)
3080 subject (mail-header-subject header)
3081 date (mail-header-date header)
3083 (while (search-backward ">" nil t)
3084 (setq end (1+ (point)))
3085 (when (search-backward "<" nil t)
3086 (setq new-child (buffer-substring (point) end))
3087 (push (list (incf generation)
3088 child (setq child new-child)
3092 (push (list (1+ generation) child nil subject) relations))
3094 (kill-buffer (current-buffer)))
3095 ;; Sort over trustworthiness.
3098 (when (gnus-dependencies-add-header
3099 (make-full-mail-header
3100 gnus-reffed-article-number
3101 (nth 3 relation) "" (or (nth 4 relation) "")
3103 (or (nth 2 relation) "") 0 0 "")
3104 gnus-newsgroup-dependencies nil)
3105 (push gnus-reffed-article-number gnus-newsgroup-limit)
3106 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3107 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3108 gnus-newsgroup-reads)
3109 (decf gnus-reffed-article-number)))
3110 (sort relations 'car-less-than-car))
3111 (gnus-message 7 "Making sparse threads...done")))
3113 (defun gnus-build-old-threads ()
3114 ;; Look at all the articles that refer back to old articles, and
3115 ;; fetch the headers for the articles that aren't there. This will
3116 ;; build complete threads - if the roots haven't been expired by the
3121 (when (not (car (symbol-value refs)))
3122 (setq heads (cdr (symbol-value refs)))
3124 (if (memq (mail-header-number (caar heads))
3125 gnus-newsgroup-dormant)
3126 (setq heads (cdr heads))
3127 (setq id (symbol-name refs))
3128 (while (and (setq id (gnus-build-get-header id))
3129 (not (car (gnus-id-to-thread id)))))
3130 (setq heads nil)))))
3131 gnus-newsgroup-dependencies)))
3133 (defmacro gnus-nov-read-integer ()
3135 (if (eq (char-after) ?\t)
3137 (let ((num (ignore-errors (read buffer))))
3138 (if (numberp num) num 0)))
3140 (search-forward "\t" eol 'move))))
3142 (defmacro gnus-nov-skip-field ()
3143 '(search-forward "\t" eol 'move))
3145 (defmacro gnus-nov-field ()
3146 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
3148 (defmacro gnus-nov-parse-extra ()
3150 (while (not (memq (char-after) '(?\n nil)))
3151 (setq string (gnus-nov-field))
3152 (when (string-match "^\\([^ :]+\\): " string)
3153 (push (cons (intern (match-string 1 string))
3154 (substring string (match-end 0)))
3158 ;; This function has to be called with point after the article number
3159 ;; on the beginning of the line.
3160 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3161 (let ((eol (gnus-point-at-eol))
3162 (buffer (current-buffer))
3165 ;; overview: [num subject from date id refs chars lines misc]
3168 (narrow-to-region (point) eol)
3173 (make-full-mail-header
3175 (gnus-nov-field) ; subject
3176 (gnus-nov-field) ; from
3177 (gnus-nov-field) ; date
3178 (or (gnus-nov-field)
3179 (nnheader-generate-fake-message-id)) ; id
3180 (gnus-nov-field) ; refs
3181 (gnus-nov-read-integer) ; chars
3182 (gnus-nov-read-integer) ; lines
3183 (unless (eq (char-after) ?\n)
3184 (gnus-nov-field)) ; misc
3185 (gnus-nov-parse-extra)))) ; extra
3189 (when gnus-alter-header-function
3190 (funcall gnus-alter-header-function header))
3191 (gnus-dependencies-add-header header dependencies force-new)))
3193 (defun gnus-build-get-header (id)
3194 ;; Look through the buffer of NOV lines and find the header to
3195 ;; ID. Enter this line into the dependencies hash table, and return
3196 ;; the id of the parent article (if any).
3197 (let ((deps gnus-newsgroup-dependencies)
3201 (set-buffer nntp-server-buffer)
3202 (let ((case-fold-search nil))
3203 (goto-char (point-min))
3204 (while (and (not found)
3205 (search-forward id nil t))
3207 (setq found (looking-at
3208 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3209 (regexp-quote id))))
3210 (or found (beginning-of-line 2)))
3214 (setq header (gnus-nov-parse-line
3215 (read (current-buffer)) deps))
3216 (gnus-parent-id (mail-header-references header))))))
3218 (let ((number (mail-header-number header)))
3219 (push number gnus-newsgroup-limit)
3220 (push header gnus-newsgroup-headers)
3221 (if (memq number gnus-newsgroup-unselected)
3223 (push number gnus-newsgroup-unreads)
3224 (setq gnus-newsgroup-unselected
3225 (delq number gnus-newsgroup-unselected)))
3226 (push number gnus-newsgroup-ancient)))))))
3228 (defun gnus-build-all-threads ()
3229 "Read all the headers."
3230 (let ((gnus-summary-ignore-duplicates t)
3231 (dependencies gnus-newsgroup-dependencies)
3234 (set-buffer nntp-server-buffer)
3235 (let ((case-fold-search nil))
3236 (goto-char (point-min))
3239 (setq article (read (current-buffer))
3240 header (gnus-nov-parse-line
3241 article dependencies)))
3244 (set-buffer gnus-summary-buffer)
3245 (push header gnus-newsgroup-headers)
3246 (if (memq (setq article (mail-header-number header))
3247 gnus-newsgroup-unselected)
3249 (push article gnus-newsgroup-unreads)
3250 (setq gnus-newsgroup-unselected
3251 (delq article gnus-newsgroup-unselected)))
3252 (push article gnus-newsgroup-ancient)))
3253 (forward-line 1)))))))
3255 (defun gnus-summary-update-article-line (article header)
3256 "Update the line for ARTICLE using HEADERS."
3257 (let* ((id (mail-header-id header))
3258 (thread (gnus-id-to-thread id)))
3260 (error "Article in no thread"))
3261 ;; Update the thread.
3262 (setcar thread header)
3263 (gnus-summary-goto-subject article)
3264 (let* ((datal (gnus-data-find-list article))
3266 (length (when (cdr datal)
3267 (- (gnus-data-pos data)
3268 (gnus-data-pos (cadr datal)))))
3269 (buffer-read-only nil)
3270 (level (gnus-summary-thread-level)))
3272 (gnus-summary-insert-line
3273 header level nil (gnus-article-mark article)
3274 (memq article gnus-newsgroup-replied)
3275 (memq article gnus-newsgroup-expirable)
3276 ;; Only insert the Subject string when it's different
3277 ;; from the previous Subject string.
3278 (if (gnus-subject-equal
3280 (mail-header-subject
3283 (gnus-data-find-list
3285 (gnus-data-list t)))))
3286 ;; Error on the side of excessive subjects.
3288 (mail-header-subject header))
3290 (mail-header-subject header))
3291 nil (cdr (assq article gnus-newsgroup-scored))
3292 (memq article gnus-newsgroup-processable))
3294 (gnus-data-update-list
3295 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3297 (defun gnus-summary-update-article (article &optional iheader)
3298 "Update ARTICLE in the summary buffer."
3299 (set-buffer gnus-summary-buffer)
3300 (let* ((header (gnus-summary-article-header article))
3301 (id (mail-header-id header))
3302 (data (gnus-data-find article))
3303 (thread (gnus-id-to-thread id))
3304 (references (mail-header-references header))
3308 (when (and references
3309 (not (equal "" references)))
3312 (buffer-read-only nil)
3318 (delq thread parent)))
3319 (if (gnus-summary-insert-subject id header)
3320 ;; Set the (possibly) new article number in the data structure.
3321 (gnus-data-set-number data (gnus-id-to-article id))
3325 (defun gnus-rebuild-thread (id &optional line)
3326 "Rebuild the thread containing ID.
3327 If LINE, insert the rebuilt thread starting on line LINE."
3328 (let ((buffer-read-only nil)
3329 old-pos current thread data)
3330 (if (not gnus-show-threads)
3331 (setq thread (list (car (gnus-id-to-thread id))))
3332 ;; Get the thread this article is part of.
3333 (setq thread (gnus-remove-thread id)))
3334 (setq old-pos (gnus-point-at-bol))
3335 (setq current (save-excursion
3336 (and (zerop (forward-line -1))
3337 (gnus-summary-article-number))))
3338 ;; If this is a gathered thread, we have to go some re-gathering.
3339 (when (stringp (car thread))
3340 (let ((subject (car thread))
3342 (setq thread (cdr thread))
3344 (unless (memq (setq thr (gnus-id-to-thread
3346 (mail-header-id (caar thread)))))
3349 (setq thread (cdr thread)))
3350 ;; We now have all (unique) roots.
3351 (if (= (length roots) 1)
3352 ;; All the loose roots are now one solid root.
3353 (setq thread (car roots))
3354 (setq thread (cons subject (gnus-sort-threads roots))))))
3356 ;; We then insert this thread into the summary buffer.
3358 (goto-char (point-min))
3359 (forward-line (1- line)))
3360 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3361 (if gnus-show-threads
3362 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3363 (gnus-summary-prepare-unthreaded thread))
3364 (setq data (nreverse gnus-newsgroup-data))
3365 (setq threads gnus-newsgroup-threads))
3366 ;; We splice the new data into the data structure.
3367 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3368 ;;!!! then we want to insert at the beginning of the buffer.
3369 ;;!!! That happens to be true with Gnus now, but that may
3370 ;;!!! change in the future. Perhaps.
3371 (gnus-data-enter-list
3372 (if line nil current) data (- (point) old-pos))
3373 (setq gnus-newsgroup-threads
3374 (nconc threads gnus-newsgroup-threads))
3375 (gnus-data-compute-positions))))
3377 (defun gnus-number-to-header (number)
3378 "Return the header for article NUMBER."
3379 (let ((headers gnus-newsgroup-headers))
3381 (not (= number (mail-header-number (car headers)))))
3386 (defun gnus-parent-headers (in-headers &optional generation)
3387 "Return the headers of the GENERATIONeth parent of HEADERS."
3389 (setq generation 1))
3391 (headers in-headers)
3394 (not (zerop generation))
3395 (setq references (mail-header-references headers)))
3396 (setq headers (if (and references
3397 (setq parent (gnus-parent-id references)))
3398 (car (gnus-id-to-thread parent))
3401 (and (not (eq headers in-headers))
3404 (defun gnus-id-to-thread (id)
3405 "Return the (sub-)thread where ID appears."
3406 (gnus-gethash id gnus-newsgroup-dependencies))
3408 (defun gnus-id-to-article (id)
3409 "Return the article number of ID."
3410 (let ((thread (gnus-id-to-thread id)))
3413 (mail-header-number (car thread)))))
3415 (defun gnus-id-to-header (id)
3416 "Return the article headers of ID."
3417 (car (gnus-id-to-thread id)))
3419 (defun gnus-article-displayed-root-p (article)
3420 "Say whether ARTICLE is a root(ish) article."
3421 (let ((level (gnus-summary-thread-level article))
3422 (refs (mail-header-references (gnus-summary-article-header article)))
3428 ((null (gnus-parent-id refs)) t)
3430 (null (setq particle (gnus-id-to-article
3431 (gnus-parent-id refs))))
3432 (null (gnus-summary-thread-level particle)))))))
3434 (defun gnus-root-id (id)
3435 "Return the id of the root of the thread where ID appears."
3437 (while (and id (setq prev (car (gnus-id-to-thread id))))
3439 id (gnus-parent-id (mail-header-references prev))))
3442 (defun gnus-articles-in-thread (thread)
3443 "Return the list of articles in THREAD."
3444 (cons (mail-header-number (car thread))
3445 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3447 (defun gnus-remove-thread (id &optional dont-remove)
3448 "Remove the thread that has ID in it."
3449 (let (headers thread last-id)
3450 ;; First go up in this thread until we find the root.
3451 (setq last-id (gnus-root-id id)
3452 headers (message-flatten-list (gnus-id-to-thread last-id)))
3453 ;; We have now found the real root of this thread. It might have
3454 ;; been gathered into some loose thread, so we have to search
3455 ;; through the threads to find the thread we wanted.
3456 (let ((threads gnus-newsgroup-threads)
3459 (setq sub (car threads))
3460 (if (stringp (car sub))
3461 ;; This is a gathered thread, so we look at the roots
3462 ;; below it to find whether this article is in this
3465 (setq sub (cdr sub))
3467 (when (member (caar sub) headers)
3468 (setq thread (car threads)
3471 (setq sub (cdr sub))))
3472 ;; It's an ordinary thread, so we check it.
3473 (when (eq (car sub) (car headers))
3476 (setq threads (cdr threads)))
3477 ;; If this article is in no thread, then it's a root.
3480 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3481 (setq thread (gnus-id-to-thread last-id)))
3484 thread ; We return this thread.
3486 (if (stringp (car thread))
3488 ;; If we use dummy roots, then we have to remove the
3489 ;; dummy root as well.
3490 (when (eq gnus-summary-make-false-root 'dummy)
3491 ;; We go to the dummy root by going to
3492 ;; the first sub-"thread", and then one line up.
3493 (gnus-summary-goto-article
3494 (mail-header-number (caadr thread)))
3497 (gnus-data-compute-positions))
3498 (setq thread (cdr thread))
3500 (gnus-remove-thread-1 (car thread))
3501 (setq thread (cdr thread))))
3502 (gnus-summary-show-all-threads)
3503 (gnus-remove-thread-1 thread))))))))
3505 (defun gnus-remove-thread-1 (thread)
3506 "Remove the thread THREAD recursively."
3507 (let ((number (mail-header-number (pop thread)))
3509 (setq thread (reverse thread))
3511 (gnus-remove-thread-1 (pop thread)))
3512 (when (setq d (gnus-data-find number))
3513 (goto-char (gnus-data-pos d))
3516 (- (gnus-point-at-bol)
3518 (1+ (gnus-point-at-eol))
3519 (gnus-delete-line)))))))
3521 (defun gnus-sort-threads (threads)
3523 (if (not gnus-thread-sort-functions)
3525 (gnus-message 8 "Sorting threads...")
3527 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3528 (gnus-message 8 "Sorting threads...done"))))
3530 (defun gnus-sort-articles (articles)
3532 (when gnus-article-sort-functions
3533 (gnus-message 7 "Sorting articles...")
3535 (setq gnus-newsgroup-headers
3536 (sort articles (gnus-make-sort-function
3537 gnus-article-sort-functions)))
3538 (gnus-message 7 "Sorting articles...done"))))
3540 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3541 (defmacro gnus-thread-header (thread)
3542 ;; Return header of first article in THREAD.
3543 ;; Note that THREAD must never, ever be anything else than a variable -
3544 ;; using some other form will lead to serious barfage.
3545 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3546 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3547 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3550 (defsubst gnus-article-sort-by-number (h1 h2)
3551 "Sort articles by article number."
3552 (< (mail-header-number h1)
3553 (mail-header-number h2)))
3555 (defun gnus-thread-sort-by-number (h1 h2)
3556 "Sort threads by root article number."
3557 (gnus-article-sort-by-number
3558 (gnus-thread-header h1) (gnus-thread-header h2)))
3560 (defsubst gnus-article-sort-by-lines (h1 h2)
3561 "Sort articles by article Lines header."
3562 (< (mail-header-lines h1)
3563 (mail-header-lines h2)))
3565 (defun gnus-thread-sort-by-lines (h1 h2)
3566 "Sort threads by root article Lines header."
3567 (gnus-article-sort-by-lines
3568 (gnus-thread-header h1) (gnus-thread-header h2)))
3570 (defsubst gnus-article-sort-by-author (h1 h2)
3571 "Sort articles by root author."
3573 (let ((addr (mime-read-field 'From h1)))
3574 (or (std11-full-name-string addr)
3575 (std11-address-string addr)
3577 (let ((addr (mime-read-field 'From h2)))
3578 (or (std11-full-name-string addr)
3579 (std11-address-string addr)
3583 (defun gnus-thread-sort-by-author (h1 h2)
3584 "Sort threads by root author."
3585 (gnus-article-sort-by-author
3586 (gnus-thread-header h1) (gnus-thread-header h2)))
3588 (defsubst gnus-article-sort-by-subject (h1 h2)
3589 "Sort articles by root subject."
3591 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3592 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3594 (defun gnus-thread-sort-by-subject (h1 h2)
3595 "Sort threads by root subject."
3596 (gnus-article-sort-by-subject
3597 (gnus-thread-header h1) (gnus-thread-header h2)))
3599 (defsubst gnus-article-sort-by-date (h1 h2)
3600 "Sort articles by root article date."
3602 (gnus-date-get-time (mail-header-date h1))
3603 (gnus-date-get-time (mail-header-date h2))))
3605 (defun gnus-thread-sort-by-date (h1 h2)
3606 "Sort threads by root article date."
3607 (gnus-article-sort-by-date
3608 (gnus-thread-header h1) (gnus-thread-header h2)))
3610 (defsubst gnus-article-sort-by-score (h1 h2)
3611 "Sort articles by root article score.
3612 Unscored articles will be counted as having a score of zero."
3613 (> (or (cdr (assq (mail-header-number h1)
3614 gnus-newsgroup-scored))
3615 gnus-summary-default-score 0)
3616 (or (cdr (assq (mail-header-number h2)
3617 gnus-newsgroup-scored))
3618 gnus-summary-default-score 0)))
3620 (defun gnus-thread-sort-by-score (h1 h2)
3621 "Sort threads by root article score."
3622 (gnus-article-sort-by-score
3623 (gnus-thread-header h1) (gnus-thread-header h2)))
3625 (defun gnus-thread-sort-by-total-score (h1 h2)
3626 "Sort threads by the sum of all scores in the thread.
3627 Unscored articles will be counted as having a score of zero."
3628 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3630 (defun gnus-thread-total-score (thread)
3631 ;; This function find the total score of THREAD.
3632 (cond ((null thread)
3635 (if (stringp (car thread))
3636 (apply gnus-thread-score-function 0
3637 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3638 (gnus-thread-total-score-1 thread)))
3640 (gnus-thread-total-score-1 (list thread)))))
3642 (defun gnus-thread-total-score-1 (root)
3643 ;; This function find the total score of the thread below ROOT.
3644 (setq root (car root))
3645 (apply gnus-thread-score-function
3647 (mapcar 'gnus-thread-total-score
3648 (cdr (gnus-id-to-thread (mail-header-id root))))
3649 (when (> (mail-header-number root) 0)
3650 (list (or (cdr (assq (mail-header-number root)
3651 gnus-newsgroup-scored))
3652 gnus-summary-default-score 0))))
3653 (list gnus-summary-default-score)
3656 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3657 (defvar gnus-tmp-prev-subject nil)
3658 (defvar gnus-tmp-false-parent nil)
3659 (defvar gnus-tmp-root-expunged nil)
3660 (defvar gnus-tmp-dummy-line nil)
3662 (defvar gnus-tmp-header)
3663 (defun gnus-extra-header (type &optional header)
3664 "Return the extra header of TYPE."
3665 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3668 (defun gnus-summary-prepare-threads (threads)
3669 "Prepare summary buffer from THREADS and indentation LEVEL.
3670 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3671 or a straight list of headers."
3672 (gnus-message 7 "Generating summary...")
3674 (setq gnus-newsgroup-threads threads)
3677 (let ((gnus-tmp-level 0)
3678 (default-score (or gnus-summary-default-score 0))
3679 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3680 thread number subject stack state gnus-tmp-gathered beg-match
3681 new-roots gnus-tmp-new-adopts thread-end
3682 gnus-tmp-header gnus-tmp-unread
3683 gnus-tmp-replied gnus-tmp-subject-or-nil
3684 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3685 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3686 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3688 (setq gnus-tmp-prev-subject nil)
3690 (if (vectorp (car threads))
3691 ;; If this is a straight (sic) list of headers, then a
3692 ;; threaded summary display isn't required, so we just create
3693 ;; an unthreaded one.
3694 (gnus-summary-prepare-unthreaded threads)
3696 ;; Do the threaded display.
3698 (while (or threads stack gnus-tmp-new-adopts new-roots)
3700 (if (and (= gnus-tmp-level 0)
3703 (not gnus-tmp-false-parent)
3704 (or gnus-tmp-new-adopts new-roots))
3705 (if gnus-tmp-new-adopts
3706 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3707 thread (list (car gnus-tmp-new-adopts))
3708 gnus-tmp-header (caar thread)
3709 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3711 (setq thread (list (car new-roots))
3712 gnus-tmp-header (caar thread)
3713 new-roots (cdr new-roots))))
3716 ;; If there are some threads, we do them before the
3717 ;; threads on the stack.
3718 (setq thread threads
3719 gnus-tmp-header (caar thread))
3720 ;; There were no current threads, so we pop something off
3722 (setq state (car stack)
3723 gnus-tmp-level (car state)
3726 gnus-tmp-header (caar thread))))
3728 (setq gnus-tmp-false-parent nil)
3729 (setq gnus-tmp-root-expunged nil)
3730 (setq thread-end nil)
3732 (if (stringp gnus-tmp-header)
3733 ;; The header is a dummy root.
3735 ((eq gnus-summary-make-false-root 'adopt)
3736 ;; We let the first article adopt the rest.
3737 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3739 (setq gnus-tmp-gathered
3741 (lambda (h) (mail-header-number (car h)))
3744 (setq thread (cons (list (caar thread)
3747 (setq gnus-tmp-level -1
3748 gnus-tmp-false-parent t))
3749 ((eq gnus-summary-make-false-root 'empty)
3750 ;; We print adopted articles with empty subject fields.
3751 (setq gnus-tmp-gathered
3753 (lambda (h) (mail-header-number (car h)))
3756 (setq gnus-tmp-level -1))
3757 ((eq gnus-summary-make-false-root 'dummy)
3758 ;; We remember that we probably want to output a dummy
3760 (setq gnus-tmp-dummy-line gnus-tmp-header)
3761 (setq gnus-tmp-prev-subject gnus-tmp-header))
3763 ;; We do not make a root for the gathered
3764 ;; sub-threads at all.
3765 (setq gnus-tmp-level -1)))
3767 (setq number (mail-header-number gnus-tmp-header)
3768 subject (mail-header-subject gnus-tmp-header))
3771 ;; If the thread has changed subject, we might want to make
3772 ;; this subthread into a root.
3773 ((and (null gnus-thread-ignore-subject)
3774 (not (zerop gnus-tmp-level))
3775 gnus-tmp-prev-subject
3777 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3778 (setq new-roots (nconc new-roots (list (car thread)))
3780 gnus-tmp-header nil))
3781 ;; If the article lies outside the current limit,
3782 ;; then we do not display it.
3783 ((not (memq number gnus-newsgroup-limit))
3784 (setq gnus-tmp-gathered
3786 (lambda (h) (mail-header-number (car h)))
3789 (setq gnus-tmp-new-adopts (if (cdar thread)
3790 (append gnus-tmp-new-adopts
3792 gnus-tmp-new-adopts)
3794 gnus-tmp-header nil)
3795 (when (zerop gnus-tmp-level)
3796 (setq gnus-tmp-root-expunged t)))
3797 ;; Perhaps this article is to be marked as read?
3798 ((and gnus-summary-mark-below
3799 (< (or (cdr (assq number gnus-newsgroup-scored))
3801 gnus-summary-mark-below)
3802 ;; Don't touch sparse articles.
3803 (not (gnus-summary-article-sparse-p number))
3804 (not (gnus-summary-article-ancient-p number)))
3805 (setq gnus-newsgroup-unreads
3806 (delq number gnus-newsgroup-unreads))
3807 (if gnus-newsgroup-auto-expire
3808 (push number gnus-newsgroup-expirable)
3809 (push (cons number gnus-low-score-mark)
3810 gnus-newsgroup-reads))))
3812 (when gnus-tmp-header
3813 ;; We may have an old dummy line to output before this
3815 (when (and gnus-tmp-dummy-line
3818 (mail-header-subject gnus-tmp-header)))
3819 (gnus-summary-insert-dummy-line
3820 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3821 (setq gnus-tmp-dummy-line nil))
3823 ;; Compute the mark.
3824 (setq gnus-tmp-unread (gnus-article-mark number))
3826 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3827 gnus-tmp-header gnus-tmp-level)
3828 gnus-newsgroup-data)
3830 ;; Actually insert the line.
3832 gnus-tmp-subject-or-nil
3834 ((and gnus-thread-ignore-subject
3835 gnus-tmp-prev-subject
3836 (not (inline (gnus-subject-equal
3837 gnus-tmp-prev-subject subject))))
3839 ((zerop gnus-tmp-level)
3840 (if (and (eq gnus-summary-make-false-root 'empty)
3841 (memq number gnus-tmp-gathered)
3842 gnus-tmp-prev-subject
3843 (inline (gnus-subject-equal
3844 gnus-tmp-prev-subject subject)))
3845 gnus-summary-same-subject
3847 (t gnus-summary-same-subject)))
3848 (if (and (eq gnus-summary-make-false-root 'adopt)
3849 (= gnus-tmp-level 1)
3850 (memq number gnus-tmp-gathered))
3851 (setq gnus-tmp-opening-bracket ?\<
3852 gnus-tmp-closing-bracket ?\>)
3853 (setq gnus-tmp-opening-bracket ?\[
3854 gnus-tmp-closing-bracket ?\]))
3856 gnus-tmp-indentation
3857 (aref gnus-thread-indent-array gnus-tmp-level)
3858 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3859 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3860 gnus-summary-default-score 0)
3862 (if (or (null gnus-summary-default-score)
3863 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3864 gnus-summary-zcore-fuzz))
3866 (if (< gnus-tmp-score gnus-summary-default-score)
3867 gnus-score-below-mark gnus-score-over-mark))
3869 (cond ((memq number gnus-newsgroup-processable)
3871 ((memq number gnus-newsgroup-cached)
3873 ((memq number gnus-newsgroup-replied)
3875 ((memq number gnus-newsgroup-saved)
3877 (t gnus-unread-mark))
3878 gnus-tmp-from (mail-header-from gnus-tmp-header)
3881 ((string-match "<[^>]+> *$" gnus-tmp-from)
3882 (setq beg-match (match-beginning 0))
3883 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3884 (substring gnus-tmp-from (1+ (match-beginning 0))
3885 (1- (match-end 0))))
3886 (substring gnus-tmp-from 0 beg-match)))
3887 ((string-match "(.+)" gnus-tmp-from)
3888 (substring gnus-tmp-from
3889 (1+ (match-beginning 0)) (1- (match-end 0))))
3891 (when (string= gnus-tmp-name "")
3892 (setq gnus-tmp-name gnus-tmp-from))
3893 (unless (numberp gnus-tmp-lines)
3894 (setq gnus-tmp-lines 0))
3895 (gnus-put-text-property
3897 (progn (eval gnus-summary-line-format-spec) (point))
3898 'gnus-number number)
3901 (gnus-run-hooks 'gnus-summary-update-hook)
3904 (setq gnus-tmp-prev-subject subject)))
3906 (when (nth 1 thread)
3907 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3908 (incf gnus-tmp-level)
3909 (setq threads (if thread-end nil (cdar thread)))
3911 (setq gnus-tmp-level 0)))))
3912 (gnus-message 7 "Generating summary...done"))
3914 (defun gnus-summary-prepare-unthreaded (headers)
3915 "Generate an unthreaded summary buffer based on HEADERS."
3916 (let (header number mark)
3921 ;; We may have to root out some bad articles...
3922 (when (memq (setq number (mail-header-number
3923 (setq header (pop headers))))
3924 gnus-newsgroup-limit)
3925 ;; Mark article as read when it has a low score.
3926 (when (and gnus-summary-mark-below
3927 (< (or (cdr (assq number gnus-newsgroup-scored))
3928 gnus-summary-default-score 0)
3929 gnus-summary-mark-below)
3930 (not (gnus-summary-article-ancient-p number)))
3931 (setq gnus-newsgroup-unreads
3932 (delq number gnus-newsgroup-unreads))
3933 (if gnus-newsgroup-auto-expire
3934 (push number gnus-newsgroup-expirable)
3935 (push (cons number gnus-low-score-mark)
3936 gnus-newsgroup-reads)))
3938 (setq mark (gnus-article-mark number))
3939 (push (gnus-data-make number mark (1+ (point)) header 0)
3940 gnus-newsgroup-data)
3941 (gnus-summary-insert-line
3943 mark (memq number gnus-newsgroup-replied)
3944 (memq number gnus-newsgroup-expirable)
3945 (mail-header-subject header) nil
3946 (cdr (assq number gnus-newsgroup-scored))
3947 (memq number gnus-newsgroup-processable))))))
3949 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3950 "Select newsgroup GROUP.
3951 If READ-ALL is non-nil, all articles in the group are selected.
3952 If SELECT-ARTICLES, only select those articles from GROUP."
3953 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3954 ;;!!! Dirty hack; should be removed.
3955 (gnus-summary-ignore-duplicates
3956 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3958 gnus-summary-ignore-duplicates))
3959 (info (nth 2 entry))
3960 articles fetched-articles cached)
3962 (unless (gnus-check-server
3963 (setq gnus-current-select-method
3964 (gnus-find-method-for-group group)))
3965 (error "Couldn't open server"))
3967 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3968 (gnus-activate-group group) ; Or we can activate it...
3969 (progn ; Or we bug out.
3970 (when (equal major-mode 'gnus-summary-mode)
3971 (kill-buffer (current-buffer)))
3972 (error "Couldn't request group %s: %s"
3973 group (gnus-status-message group))))
3975 (unless (gnus-request-group group t)
3976 (when (equal major-mode 'gnus-summary-mode)
3977 (kill-buffer (current-buffer)))
3978 (error "Couldn't request group %s: %s"
3979 group (gnus-status-message group)))
3981 (setq gnus-newsgroup-name group)
3982 (setq gnus-newsgroup-unselected nil)
3983 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3985 ;; Adjust and set lists of article marks.
3987 (gnus-adjust-marked-articles info))
3989 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3990 (when (gnus-virtual-group-p group)
3991 (setq cached gnus-newsgroup-cached))
3993 (setq gnus-newsgroup-unreads
3994 (gnus-set-difference
3995 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3996 gnus-newsgroup-dormant))
3998 (setq gnus-newsgroup-processable nil)
4000 (gnus-update-read-articles group gnus-newsgroup-unreads)
4002 (if (setq articles select-articles)
4003 (setq gnus-newsgroup-unselected
4004 (gnus-sorted-intersection
4005 gnus-newsgroup-unreads
4006 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4007 (setq articles (gnus-articles-to-read group read-all)))
4011 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4013 ((eq articles 0) nil)
4015 ;; Init the dependencies hash table.
4016 (setq gnus-newsgroup-dependencies
4017 (gnus-make-hashtable (length articles)))
4018 (gnus-set-global-variables)
4019 ;; Retrieve the headers and read them in.
4020 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4021 (setq gnus-newsgroup-headers
4023 (setq gnus-headers-retrieved-by
4024 (gnus-retrieve-headers
4025 articles gnus-newsgroup-name
4026 ;; We might want to fetch old headers, but
4027 ;; not if there is only 1 article.
4029 (not (eq gnus-fetch-old-headers 'some))
4030 (not (numberp gnus-fetch-old-headers)))
4031 (> (length articles) 1))
4032 gnus-fetch-old-headers))))
4033 (gnus-get-newsgroup-headers-xover
4034 articles nil nil gnus-newsgroup-name t)
4035 (gnus-get-newsgroup-headers)))
4036 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4038 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4040 (setq gnus-newsgroup-cached cached))
4042 ;; Suppress duplicates?
4043 (when gnus-suppress-duplicates
4044 (gnus-dup-suppress-articles))
4046 ;; Set the initial limit.
4047 (setq gnus-newsgroup-limit (copy-sequence articles))
4048 ;; Remove canceled articles from the list of unread articles.
4049 (setq gnus-newsgroup-unreads
4050 (gnus-set-sorted-intersection
4051 gnus-newsgroup-unreads
4052 (setq fetched-articles
4053 (mapcar (lambda (headers) (mail-header-number headers))
4054 gnus-newsgroup-headers))))
4055 ;; Removed marked articles that do not exist.
4056 (gnus-update-missing-marks
4057 (gnus-sorted-complement fetched-articles articles))
4058 ;; We might want to build some more threads first.
4059 (when (and gnus-fetch-old-headers
4060 (eq gnus-headers-retrieved-by 'nov))
4061 (if (eq gnus-fetch-old-headers 'invisible)
4062 (gnus-build-all-threads)
4063 (gnus-build-old-threads)))
4064 ;; Let the Gnus agent mark articles as read.
4066 (gnus-agent-get-undownloaded-list))
4067 ;; Check whether auto-expire is to be done in this group.
4068 (setq gnus-newsgroup-auto-expire
4069 (gnus-group-auto-expirable-p group))
4070 ;; Set up the article buffer now, if necessary.
4071 (unless gnus-single-article-buffer
4072 (gnus-article-setup-buffer))
4073 ;; First and last article in this newsgroup.
4074 (when gnus-newsgroup-headers
4075 (setq gnus-newsgroup-begin
4076 (mail-header-number (car gnus-newsgroup-headers))
4079 (gnus-last-element gnus-newsgroup-headers))))
4080 ;; GROUP is successfully selected.
4081 (or gnus-newsgroup-headers t)))))
4083 (defun gnus-articles-to-read (group &optional read-all)
4084 ;; Find out what articles the user wants to read.
4086 ;; Select all articles if `read-all' is non-nil, or if there
4087 ;; are no unread articles.
4089 (and (zerop (length gnus-newsgroup-marked))
4090 (zerop (length gnus-newsgroup-unreads)))
4091 (eq (gnus-group-find-parameter group 'display)
4093 (gnus-uncompress-range (gnus-active group))
4094 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4095 (copy-sequence gnus-newsgroup-unreads))
4097 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4098 (scored (length scored-list))
4099 (number (length articles))
4100 (marked (+ (length gnus-newsgroup-marked)
4101 (length gnus-newsgroup-dormant)))
4109 ((and (or (<= scored marked) (= scored number))
4110 (numberp gnus-large-newsgroup)
4111 (> number gnus-large-newsgroup))
4115 "How many articles from %s (default %d): "
4116 (gnus-limit-string gnus-newsgroup-name 35)
4118 (if (string-match "^[ \t]*$" input) number input)))
4119 ((and (> scored marked) (< scored number)
4120 (> (- scored number) 20))
4123 (format "%s %s (%d scored, %d total): "
4124 "How many articles from"
4125 group scored number))))
4126 (if (string-match "^[ \t]*$" input)
4130 (setq select (if (stringp select) (string-to-number select) select))
4131 (if (or (null select) (zerop select))
4133 (if (and (not (zerop scored)) (<= (abs select) scored))
4135 (setq articles (sort scored-list '<))
4136 (setq number (length articles)))
4137 (setq articles (copy-sequence articles)))
4139 (when (< (abs select) number)
4141 ;; Select the N oldest articles.
4142 (setcdr (nthcdr (1- (abs select)) articles) nil)
4143 ;; Select the N most recent articles.
4144 (setq articles (nthcdr (- number select) articles))))
4145 (setq gnus-newsgroup-unselected
4146 (gnus-sorted-intersection
4147 gnus-newsgroup-unreads
4148 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4151 (defun gnus-killed-articles (killed articles)
4154 (when (inline (gnus-member-of-range (car articles) killed))
4155 (push (car articles) out))
4156 (setq articles (cdr articles)))
4159 (defun gnus-uncompress-marks (marks)
4160 "Uncompress the mark ranges in MARKS."
4161 (let ((uncompressed '(score bookmark))
4164 (if (memq (caar marks) uncompressed)
4165 (push (car marks) out)
4166 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4167 (setq marks (cdr marks)))
4170 (defun gnus-adjust-marked-articles (info)
4171 "Set all article lists and remove all marks that are no longer legal."
4172 (let* ((marked-lists (gnus-info-marks info))
4173 (active (gnus-active (gnus-info-group info)))
4176 (types gnus-article-mark-lists)
4177 (uncompressed '(score bookmark killed))
4178 marks var articles article mark)
4181 (setq marks (pop marked-lists))
4182 (set (setq var (intern (format "gnus-newsgroup-%s"
4183 (car (rassq (setq mark (car marks))
4185 (if (memq (car marks) uncompressed) (cdr marks)
4186 (gnus-uncompress-range (cdr marks))))
4188 (setq articles (symbol-value var))
4190 ;; All articles have to be subsets of the active articles.
4192 ;; Adjust "simple" lists.
4193 ((memq mark '(tick dormant expire reply save))
4195 (when (or (< (setq article (pop articles)) min) (> article max))
4196 (set var (delq article (symbol-value var))))))
4198 ((memq mark uncompressed)
4199 (when (not (listp (cdr (symbol-value var))))
4200 (set var (list (symbol-value var))))
4201 (when (not (listp (cdr articles)))
4202 (setq articles (list articles)))
4204 (when (or (not (consp (setq article (pop articles))))
4205 (< (car article) min)
4206 (> (car article) max))
4207 (set var (delq article (symbol-value var))))))))))
4209 (defun gnus-update-missing-marks (missing)
4210 "Go through the list of MISSING articles and remove them from the mark lists."
4212 (let ((types gnus-article-mark-lists)
4214 ;; Go through all types.
4216 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4217 (when (symbol-value var)
4218 ;; This list has articles. So we delete all missing articles
4222 (set var (delq (pop m) (symbol-value var)))))))))
4224 (defun gnus-update-marks ()
4225 "Enter the various lists of marked articles into the newsgroup info list."
4226 (let ((types gnus-article-mark-lists)
4227 (info (gnus-get-info gnus-newsgroup-name))
4228 (uncompressed '(score bookmark killed))
4229 type list newmarked symbol delta-marks)
4231 ;; Add all marks lists that are non-nil to the list of marks lists.
4232 (while (setq type (pop types))
4233 (when (setq list (symbol-value
4235 (intern (format "gnus-newsgroup-%s"
4238 ;; Get rid of the entries of the articles that have the
4240 (when (and (eq (cdr type) 'score)
4244 (prev (cons nil list))
4247 (if (or (not (consp (car arts)))
4248 (= (cdar arts) gnus-summary-default-score))
4249 (setcdr prev (cdr arts))
4251 (setq arts (cdr arts)))
4252 (setq list (cdr all))))
4254 (push (cons (cdr type)
4255 (if (memq (cdr type) uncompressed) list
4256 (gnus-compress-sequence
4257 (set symbol (sort list '<)) t)))
4260 ;; Enter these new marks into the info of the group.
4262 (setcar (nthcdr 3 info) newmarked)
4263 ;; Add the marks lists to the end of the info.
4265 (setcdr (nthcdr 2 info) (list newmarked))))
4267 ;; Cut off the end of the info if there's nothing else there.
4271 (when (nthcdr (decf i) info)
4272 (setcdr (nthcdr i info) nil)))))))
4274 (defun gnus-set-mode-line (where)
4275 "This function sets the mode line of the article or summary buffers.
4276 If WHERE is `summary', the summary mode line format will be used."
4277 ;; Is this mode line one we keep updated?
4278 (when (and (memq where gnus-updated-mode-lines)
4280 (intern (format "gnus-%s-mode-line-format-spec" where))))
4283 ;; We evaluate this in the summary buffer since these
4284 ;; variables are buffer-local to that buffer.
4285 (set-buffer gnus-summary-buffer)
4286 ;; We bind all these variables that are used in the `eval' form
4288 (let* ((mformat (symbol-value
4290 (format "gnus-%s-mode-line-format-spec" where))))
4291 (gnus-tmp-group-name gnus-newsgroup-name)
4292 (gnus-tmp-article-number (or gnus-current-article 0))
4293 (gnus-tmp-unread gnus-newsgroup-unreads)
4294 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4295 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4296 (gnus-tmp-unread-and-unselected
4297 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4298 (zerop gnus-tmp-unselected))
4300 ((zerop gnus-tmp-unselected)
4301 (format "{%d more}" gnus-tmp-unread-and-unticked))
4302 (t (format "{%d(+%d) more}"
4303 gnus-tmp-unread-and-unticked
4304 gnus-tmp-unselected))))
4306 (if (and gnus-current-headers
4307 (vectorp gnus-current-headers))
4308 (gnus-mode-string-quote
4309 (mail-header-subject gnus-current-headers))
4311 bufname-length max-len
4312 gnus-tmp-header);; passed as argument to any user-format-funcs
4313 (setq mode-string (eval mformat))
4314 (setq bufname-length (if (string-match "%b" mode-string)
4317 (if (eq where 'summary)
4319 (get-buffer gnus-article-buffer))))
4322 (setq max-len (max 4 (if gnus-mode-non-string-length
4324 gnus-mode-non-string-length
4326 (length mode-string))))
4327 ;; We might have to chop a bit of the string off...
4328 (when (> (length mode-string) max-len)
4330 (concat (gnus-truncate-string mode-string (- max-len 3))
4332 ;; Pad the mode string a bit.
4333 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4334 ;; Update the mode line.
4335 (setq mode-line-buffer-identification
4336 (gnus-mode-line-buffer-identification (list mode-string)))
4337 (set-buffer-modified-p t))))
4339 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4340 "Go through the HEADERS list and add all Xrefs to a hash table.
4341 The resulting hash table is returned, or nil if no Xrefs were found."
4342 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4343 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4344 (xref-hashtb (gnus-make-hashtable))
4345 start group entry number xrefs header)
4347 (setq header (pop headers))
4348 (when (and (setq xrefs (mail-header-xref header))
4349 (not (memq (setq number (mail-header-number header))
4352 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4353 (setq start (match-end 0))
4354 (setq group (if prefix
4355 (concat prefix (substring xrefs (match-beginning 1)
4357 (substring xrefs (match-beginning 1) (match-end 1))))
4359 (string-to-int (substring xrefs (match-beginning 2)
4361 (if (setq entry (gnus-gethash group xref-hashtb))
4362 (setcdr entry (cons number (cdr entry)))
4363 (gnus-sethash group (cons number nil) xref-hashtb)))))
4364 (and start xref-hashtb)))
4366 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4367 "Look through all the headers and mark the Xrefs as read."
4368 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4369 name entry info xref-hashtb idlist method nth4)
4371 (set-buffer gnus-group-buffer)
4372 (when (setq xref-hashtb
4373 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4376 (unless (string= from-newsgroup (setq name (symbol-name group)))
4377 (setq idlist (symbol-value group))
4378 ;; Dead groups are not updated.
4380 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4382 (when (stringp (setq nth4 (gnus-info-method info)))
4383 (setq nth4 (gnus-server-to-method nth4))))
4384 ;; Only do the xrefs if the group has the same
4385 ;; select method as the group we have just read.
4386 (or (gnus-methods-equal-p
4387 nth4 (gnus-find-method-for-group from-newsgroup))
4389 (equal nth4 (setq method (gnus-find-method-for-group
4391 (and (equal (car nth4) (car method))
4392 (equal (nth 1 nth4) (nth 1 method))))
4393 gnus-use-cross-reference
4394 (or (not (eq gnus-use-cross-reference t))
4396 ;; Only do cross-references on subscribed
4397 ;; groups, if that is what is wanted.
4398 (<= (gnus-info-level info) gnus-level-subscribed))
4399 (gnus-group-make-articles-read name idlist))))
4402 (defun gnus-compute-read-articles (group articles)
4403 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4404 (info (nth 2 entry))
4405 (active (gnus-active group))
4408 ;; First peel off all illegal article numbers.
4410 (let ((ids articles)
4412 (while (setq id (pop ids))
4413 (when (and first (> id (cdr active)))
4414 ;; We'll end up in this situation in one particular
4415 ;; obscure situation. If you re-scan a group and get
4416 ;; a new article that is cross-posted to a different
4417 ;; group that has not been re-scanned, you might get
4418 ;; crossposted article that has a higher number than
4419 ;; Gnus believes possible. So we re-activate this
4420 ;; group as well. This might mean doing the
4421 ;; crossposting thingy will *increase* the number
4422 ;; of articles in some groups. Tsk, tsk.
4423 (setq active (or (gnus-activate-group group) active)))
4424 (when (or (> id (cdr active))
4425 (< id (car active)))
4426 (setq articles (delq id articles))))))
4427 ;; If the read list is nil, we init it.
4429 (null (gnus-info-read info))
4431 (setq ninfo (cons 1 (1- (car active))))
4432 (setq ninfo (gnus-info-read info)))
4433 ;; Then we add the read articles to the range.
4435 ninfo (setq articles (sort articles '<))))))
4437 (defun gnus-group-make-articles-read (group articles)
4438 "Update the info of GROUP to say that ARTICLES are read."
4440 (entry (gnus-gethash group gnus-newsrc-hashtb))
4441 (info (nth 2 entry))
4442 (active (gnus-active group))
4445 (setq range (gnus-compute-read-articles group articles))
4447 (set-buffer gnus-group-buffer)
4450 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4451 (gnus-info-set-read ',info ',(gnus-info-read info))
4452 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4453 (gnus-group-update-group ,group t))))
4454 ;; Add the read articles to the range.
4455 (gnus-info-set-read info range)
4456 ;; Then we have to re-compute how many unread
4457 ;; articles there are in this group.
4461 (setq num (- (1+ (cdr active)) (car active))))
4462 ((not (listp (cdr range)))
4463 (setq num (- (cdr active) (- (1+ (cdr range))
4467 (if (numberp (car range))
4469 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4470 (setq range (cdr range)))
4471 (setq num (- (cdr active) num))))
4472 ;; Update the number of unread articles.
4474 ;; Update the group buffer.
4475 (gnus-group-update-group group t)))))
4477 (defun gnus-methods-equal-p (m1 m2)
4478 (let ((m1 (or m1 gnus-select-method))
4479 (m2 (or m2 gnus-select-method)))
4481 (and (eq (car m1) (car m2))
4482 (or (not (memq 'address (assoc (symbol-name (car m1))
4483 gnus-valid-select-methods)))
4484 (equal (nth 1 m1) (nth 1 m2)))))))
4486 (defvar gnus-newsgroup-none-id 0)
4488 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4489 (let ((cur nntp-server-buffer)
4492 (save-excursion (set-buffer gnus-summary-buffer)
4493 gnus-newsgroup-dependencies)))
4495 (rfc2047-default-charset gnus-newsgroup-default-charset)
4496 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
4498 (set-buffer nntp-server-buffer)
4499 ;; Translate all TAB characters into SPACE characters.
4500 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4501 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4502 (gnus-run-hooks 'gnus-parse-headers-hook)
4503 (let ((case-fold-search t)
4504 in-reply-to header p lines chars ctype)
4505 (goto-char (point-min))
4506 ;; Search to the beginning of the next header. Error messages
4507 ;; do not begin with 2 or 3.
4508 (while (re-search-forward "^[23][0-9]+ " nil t)
4511 ;; This implementation of this function, with nine
4512 ;; search-forwards instead of the one re-search-forward and
4513 ;; a case (which basically was the old function) is actually
4514 ;; about twice as fast, even though it looks messier. You
4515 ;; can't have everything, I guess. Speed and elegance
4516 ;; doesn't always go hand in hand.
4519 (make-full-mail-header
4525 (narrow-to-region (point)
4526 (or (and (search-forward "\n.\n" nil t)
4532 (if (search-forward "\nsubject: " nil t)
4533 (buffer-substring (match-end 0) (std11-field-end))
4538 (if (search-forward "\nfrom: " nil t)
4539 (buffer-substring (match-end 0) (std11-field-end))
4544 (if (search-forward "\ndate: " nil t)
4545 (buffer-substring (match-end 0) (std11-field-end))
4550 (setq id (if (re-search-forward
4551 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4552 ;; We do it this way to make sure the Message-ID
4553 ;; is (somewhat) syntactically valid.
4554 (buffer-substring (match-beginning 1)
4556 ;; If there was no message-id, we just fake one
4557 ;; to make subsequent routines simpler.
4558 (nnheader-generate-fake-message-id))))
4562 (if (search-forward "\nreferences: " nil t)
4566 (buffer-substring (match-end 0) (std11-field-end))
4571 (search-backward ">" end t)
4574 (search-backward "<" end t)
4576 ;; Get the references from the in-reply-to header if there
4577 ;; were no references and the in-reply-to header looks
4579 (if (and (search-forward "\nin-reply-to: " nil t)
4581 (buffer-substring (match-end 0)
4583 (string-match "<[^>]+>" in-reply-to))
4585 (setq ref (substring in-reply-to (match-beginning 0)
4587 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4588 (setq ref2 (substring in-reply-to (match-beginning 0)
4590 (when (> (length ref2) (length ref))
4597 (if (search-forward "\nchars: " nil t)
4598 (if (numberp (setq chars (ignore-errors (read cur))))
4604 (if (search-forward "\nlines: " nil t)
4605 (if (numberp (setq lines (ignore-errors (read cur))))
4611 (and (search-forward "\nxref: " nil t)
4612 (buffer-substring (match-end 0) (std11-field-end))))
4614 (when gnus-extra-headers
4615 (let ((extra gnus-extra-headers)
4619 (when (search-forward
4620 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4621 (push (cons (car extra)
4622 (buffer-substring (match-end 0)
4628 (if (and (search-forward "\ncontent-type: " nil t)
4630 (buffer-substring (match-end 0) (std11-field-end))))
4631 (mime-entity-set-content-type-internal
4632 header (mime-parse-Content-Type ctype)))
4633 (when (equal id ref)
4636 (when gnus-alter-header-function
4637 (funcall gnus-alter-header-function header)
4638 (setq id (mail-header-id header)
4639 ref (gnus-parent-id (mail-header-references header))))
4642 (gnus-dependencies-add-header
4643 header dependencies force-new))
4644 (push header headers))
4645 (goto-char (point-max))
4647 (nreverse headers)))))
4649 ;; Goes through the xover lines and returns a list of vectors
4650 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4651 force-new dependencies
4652 group also-fetch-heads)
4653 "Parse the news overview data in the server buffer, and return a
4654 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4655 ;; Get the Xref when the users reads the articles since most/some
4656 ;; NNTP servers do not include Xrefs when using XOVER.
4657 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4658 (let ((rfc2047-default-charset gnus-newsgroup-default-charset)
4659 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced)
4660 (cur nntp-server-buffer)
4661 (dependencies (or dependencies gnus-newsgroup-dependencies))
4662 number headers header)
4664 (set-buffer nntp-server-buffer)
4665 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4666 ;; Allow the user to mangle the headers before parsing them.
4667 (gnus-run-hooks 'gnus-parse-headers-hook)
4668 (goto-char (point-min))
4671 (while (and sequence (not (eobp)))
4672 (setq number (read cur))
4673 (while (and sequence
4674 (< (car sequence) number))
4675 (setq sequence (cdr sequence)))
4677 (eq number (car sequence))
4679 (setq sequence (cdr sequence))
4680 (setq header (inline
4681 (gnus-nov-parse-line
4682 number dependencies force-new))))
4683 (push header headers))
4686 (gnus-error 4 "Strange nov line (%d)"
4687 (count-lines (point-min) (point)))))
4689 ;; A common bug in inn is that if you have posted an article and
4690 ;; then retrieves the active file, it will answer correctly --
4691 ;; the new article is included. However, a NOV entry for the
4692 ;; article may not have been generated yet, so this may fail.
4693 ;; We work around this problem by retrieving the last few
4694 ;; headers using HEAD.
4695 (if (or (not also-fetch-heads)
4697 ;; We (probably) got all the headers.
4699 (let ((gnus-nov-is-evil t))
4702 (when (gnus-retrieve-headers sequence group)
4703 (gnus-get-newsgroup-headers))))))))
4705 (defun gnus-article-get-xrefs ()
4706 "Fill in the Xref value in `gnus-current-headers', if necessary.
4707 This is meant to be called in `gnus-article-internal-prepare-hook'."
4708 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4709 gnus-current-headers)))
4710 (or (not gnus-use-cross-reference)
4712 (and (mail-header-xref headers)
4713 (not (string= (mail-header-xref headers) "")))
4714 (let ((case-fold-search t)
4717 (nnheader-narrow-to-headers)
4718 (goto-char (point-min))
4719 (when (or (and (eq (downcase (char-after)) ?x)
4720 (looking-at "Xref:"))
4721 (search-forward "\nXref:" nil t))
4722 (goto-char (1+ (match-end 0)))
4723 (setq xref (buffer-substring (point)
4724 (progn (end-of-line) (point))))
4725 (mail-header-set-xref headers xref)))))))
4727 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4728 "Find article ID and insert the summary line for that article.
4729 OLD-HEADER can either be a header or a line number to insert
4730 the subject line on."
4731 (let* ((line (and (numberp old-header) old-header))
4732 (old-header (and (vectorp old-header) old-header))
4733 (header (cond ((and old-header use-old-header)
4736 (gnus-number-to-header id))
4737 (gnus-number-to-header id))
4739 (gnus-read-header id))))
4740 (number (and (numberp id) id))
4743 ;; Rebuild the thread that this article is part of and go to the
4744 ;; article we have fetched.
4745 (when (and (not gnus-show-threads)
4748 (setq d (gnus-data-find (mail-header-number old-header))))
4749 (goto-char (gnus-data-pos d))
4752 (- (gnus-point-at-bol)
4754 (1+ (gnus-point-at-eol))
4755 (gnus-delete-line))))))
4757 (mail-header-set-number header (mail-header-number old-header)))
4758 (setq gnus-newsgroup-sparse
4759 (delq (setq number (mail-header-number header))
4760 gnus-newsgroup-sparse))
4761 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4762 (push number gnus-newsgroup-limit)
4763 (gnus-rebuild-thread (mail-header-id header) line)
4764 (gnus-summary-goto-subject number nil t))
4765 (when (and (numberp number)
4767 ;; We have to update the boundaries even if we can't fetch the
4768 ;; article if ID is a number -- so that the next `P' or `N'
4769 ;; command will fetch the previous (or next) article even
4770 ;; if the one we tried to fetch this time has been canceled.
4771 (when (> number gnus-newsgroup-end)
4772 (setq gnus-newsgroup-end number))
4773 (when (< number gnus-newsgroup-begin)
4774 (setq gnus-newsgroup-begin number))
4775 (setq gnus-newsgroup-unselected
4776 (delq number gnus-newsgroup-unselected)))
4777 ;; Report back a success?
4778 (and header (mail-header-number header))))
4780 ;;; Process/prefix in the summary buffer
4782 (defun gnus-summary-work-articles (n)
4783 "Return a list of articles to be worked upon.
4784 The prefix argument, the list of process marked articles, and the
4785 current article will be taken into consideration."
4787 (set-buffer gnus-summary-buffer)
4790 ;; A numerical prefix has been given.
4791 (setq n (prefix-numeric-value n))
4792 (let ((backward (< n 0))
4793 (n (abs (prefix-numeric-value n)))
4798 (push (setq article (gnus-summary-article-number))
4801 (gnus-summary-find-prev nil article)
4802 (gnus-summary-find-next nil article)))
4804 (nreverse articles)))
4805 ((and (gnus-region-active-p) (mark))
4806 (message "region active")
4807 ;; Work on the region between point and mark.
4808 (let ((max (max (point) (mark)))
4811 (goto-char (min (point) (mark)))
4814 (push (setq article (gnus-summary-article-number)) articles)
4815 (gnus-summary-find-next nil article)
4817 (nreverse articles))))
4818 (gnus-newsgroup-processable
4819 ;; There are process-marked articles present.
4820 ;; Save current state.
4821 (gnus-summary-save-process-mark)
4823 (reverse gnus-newsgroup-processable))
4825 ;; Just return the current article.
4826 (list (gnus-summary-article-number))))))
4828 (defmacro gnus-summary-iterate (arg &rest forms)
4829 "Iterate over the process/prefixed articles and do FORMS.
4830 ARG is the interactive prefix given to the command. FORMS will be
4831 executed with point over the summary line of the articles."
4832 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4833 `(let ((,articles (gnus-summary-work-articles ,arg)))
4835 (gnus-summary-goto-subject (car ,articles))
4838 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4839 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4841 (defun gnus-summary-save-process-mark ()
4842 "Push the current set of process marked articles on the stack."
4844 (push (copy-sequence gnus-newsgroup-processable)
4845 gnus-newsgroup-process-stack))
4847 (defun gnus-summary-kill-process-mark ()
4848 "Push the current set of process marked articles on the stack and unmark."
4850 (gnus-summary-save-process-mark)
4851 (gnus-summary-unmark-all-processable))
4853 (defun gnus-summary-yank-process-mark ()
4854 "Pop the last process mark state off the stack and restore it."
4856 (unless gnus-newsgroup-process-stack
4857 (error "Empty mark stack"))
4858 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4860 (defun gnus-summary-process-mark-set (set)
4861 "Make SET into the current process marked articles."
4862 (gnus-summary-unmark-all-processable)
4864 (gnus-summary-set-process-mark (pop set))))
4866 ;;; Searching and stuff
4868 (defun gnus-summary-search-group (&optional backward use-level)
4869 "Search for next unread newsgroup.
4870 If optional argument BACKWARD is non-nil, search backward instead."
4872 (set-buffer gnus-group-buffer)
4873 (when (gnus-group-search-forward
4874 backward nil (if use-level (gnus-group-group-level) nil))
4875 (gnus-group-group-name))))
4877 (defun gnus-summary-best-group (&optional exclude-group)
4878 "Find the name of the best unread group.
4879 If EXCLUDE-GROUP, do not go to this group."
4881 (set-buffer gnus-group-buffer)
4883 (gnus-group-best-unread-group exclude-group))))
4885 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4886 (if backward (gnus-summary-find-prev)
4887 (let* ((dummy (gnus-summary-article-intangible-p))
4888 (article (or article (gnus-summary-article-number)))
4889 (arts (gnus-data-find-list article))
4891 (when (and (not dummy)
4892 (or (not gnus-summary-check-current)
4894 (not (gnus-data-unread-p (car arts)))))
4895 (setq arts (cdr arts)))
4900 (when (or (and undownloaded
4901 (eq gnus-undownloaded-mark
4902 (gnus-data-mark (car arts))))
4903 (gnus-data-unread-p (car arts)))
4904 (setq result (car arts)
4906 (setq arts (cdr arts)))
4909 (goto-char (gnus-data-pos result))
4910 (gnus-data-number result)))))
4912 (defun gnus-summary-find-prev (&optional unread article)
4913 (let* ((eobp (eobp))
4914 (article (or article (gnus-summary-article-number)))
4915 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4917 (when (and (not eobp)
4918 (or (not gnus-summary-check-current)
4920 (not (gnus-data-unread-p (car arts)))))
4921 (setq arts (cdr arts)))
4926 (when (gnus-data-unread-p (car arts))
4927 (setq result (car arts)
4929 (setq arts (cdr arts)))
4932 (goto-char (gnus-data-pos result))
4933 (gnus-data-number result))))
4935 (defun gnus-summary-find-subject (subject &optional unread backward article)
4936 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4937 (article (or article (gnus-summary-article-number)))
4938 (articles (gnus-data-list backward))
4939 (arts (gnus-data-find-list article articles))
4941 (when (or (not gnus-summary-check-current)
4943 (not (gnus-data-unread-p (car arts))))
4944 (setq arts (cdr arts)))
4946 (and (or (not unread)
4947 (gnus-data-unread-p (car arts)))
4948 (vectorp (gnus-data-header (car arts)))
4950 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4951 (setq result (car arts)
4953 (setq arts (cdr arts)))
4955 (goto-char (gnus-data-pos result))
4956 (gnus-data-number result))))
4958 (defun gnus-summary-search-forward (&optional unread subject backward)
4959 "Search forward for an article.
4960 If UNREAD, look for unread articles. If SUBJECT, look for
4961 articles with that subject. If BACKWARD, search backward instead."
4962 (cond (subject (gnus-summary-find-subject subject unread backward))
4963 (backward (gnus-summary-find-prev unread))
4964 (t (gnus-summary-find-next unread))))
4966 (defun gnus-recenter (&optional n)
4967 "Center point in window and redisplay frame.
4968 Also do horizontal recentering."
4970 (when (and gnus-auto-center-summary
4971 (not (eq gnus-auto-center-summary 'vertical)))
4972 (gnus-horizontal-recenter))
4975 (defun gnus-summary-recenter ()
4976 "Center point in the summary window.
4977 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4978 displayed, no centering will be performed."
4979 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4980 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4981 (let* ((top (cond ((< (window-height) 4) 0)
4982 ((< (window-height) 7) 1)
4983 (t (if (numberp gnus-auto-center-summary)
4984 gnus-auto-center-summary
4986 (height (1- (window-height)))
4987 (bottom (save-excursion (goto-char (point-max))
4988 (forward-line (- height))
4990 (window (get-buffer-window (current-buffer))))
4991 ;; The user has to want it.
4992 (when gnus-auto-center-summary
4993 (when (get-buffer-window gnus-article-buffer)
4994 ;; Only do recentering when the article buffer is displayed,
4995 ;; Set the window start to either `bottom', which is the biggest
4996 ;; possible valid number, or the second line from the top,
4997 ;; whichever is the least.
4999 window (min bottom (save-excursion
5000 (forward-line (- top)) (point)))))
5001 ;; Do horizontal recentering while we're at it.
5002 (when (and (get-buffer-window (current-buffer) t)
5003 (not (eq gnus-auto-center-summary 'vertical)))
5004 (let ((selected (selected-window)))
5005 (select-window (get-buffer-window (current-buffer) t))
5006 (gnus-summary-position-point)
5007 (gnus-horizontal-recenter)
5008 (select-window selected))))))
5010 (defun gnus-summary-jump-to-group (newsgroup)
5011 "Move point to NEWSGROUP in group mode buffer."
5012 ;; Keep update point of group mode buffer if visible.
5013 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5014 (save-window-excursion
5015 ;; Take care of tree window mode.
5016 (when (get-buffer-window gnus-group-buffer)
5017 (pop-to-buffer gnus-group-buffer))
5018 (gnus-group-jump-to-group newsgroup))
5020 ;; Take care of tree window mode.
5021 (if (get-buffer-window gnus-group-buffer)
5022 (pop-to-buffer gnus-group-buffer)
5023 (set-buffer gnus-group-buffer))
5024 (gnus-group-jump-to-group newsgroup))))
5026 ;; This function returns a list of article numbers based on the
5027 ;; difference between the ranges of read articles in this group and
5028 ;; the range of active articles.
5029 (defun gnus-list-of-unread-articles (group)
5030 (let* ((read (gnus-info-read (gnus-get-info group)))
5031 (active (or (gnus-active group) (gnus-activate-group group)))
5034 ;; If none are read, then all are unread.
5036 (setq first (car active))
5037 ;; If the range of read articles is a single range, then the
5038 ;; first unread article is the article after the last read
5039 ;; article. Sounds logical, doesn't it?
5040 (if (not (listp (cdr read)))
5041 (setq first (max (car active) (1+ (cdr read))))
5042 ;; `read' is a list of ranges.
5043 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5046 (setq first (car active)))
5049 (while (< first nlast)
5051 (setq first (1+ first))))
5052 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5053 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5054 (setq read (cdr read)))))
5055 ;; And add the last unread articles.
5056 (while (<= first last)
5058 (setq first (1+ first)))
5059 ;; Return the list of unread articles.
5060 (delq 0 (nreverse unread))))
5062 (defun gnus-list-of-read-articles (group)
5063 "Return a list of unread, unticked and non-dormant articles."
5064 (let* ((info (gnus-get-info group))
5065 (marked (gnus-info-marks info))
5066 (active (gnus-active group)))
5068 (gnus-set-difference
5069 (gnus-sorted-complement
5070 (gnus-uncompress-range active)
5071 (gnus-list-of-unread-articles group))
5073 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5074 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5076 ;; Various summary commands
5078 (defun gnus-summary-select-article-buffer ()
5079 "Reconfigure windows to show article buffer."
5081 (if (not (gnus-buffer-live-p gnus-article-buffer))
5082 (error "There is no article buffer for this summary buffer")
5083 (gnus-configure-windows 'article)
5084 (select-window (get-buffer-window gnus-article-buffer))))
5086 (defun gnus-summary-universal-argument (arg)
5087 "Perform any operation on all articles that are process/prefixed."
5089 (let ((articles (gnus-summary-work-articles arg))
5096 (substitute-command-keys
5097 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5100 (gnus-error 1 "Undefined key")
5103 (gnus-summary-goto-subject (setq article (pop articles)))
5104 (let (gnus-newsgroup-processable)
5105 (command-execute func))
5106 (gnus-summary-remove-process-mark article)))))
5107 (gnus-summary-position-point))
5109 (defun gnus-summary-toggle-truncation (&optional arg)
5110 "Toggle truncation of summary lines.
5111 With arg, turn line truncation on iff arg is positive."
5113 (setq truncate-lines
5114 (if (null arg) (not truncate-lines)
5115 (> (prefix-numeric-value arg) 0)))
5118 (defun gnus-summary-reselect-current-group (&optional all rescan)
5119 "Exit and then reselect the current newsgroup.
5120 The prefix argument ALL means to select all articles."
5122 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5123 (error "Ephemeral groups can't be reselected"))
5124 (let ((current-subject (gnus-summary-article-number))
5125 (group gnus-newsgroup-name))
5126 (setq gnus-newsgroup-begin nil)
5128 ;; We have to adjust the point of group mode buffer because
5129 ;; point was moved to the next unread newsgroup by exiting.
5130 (gnus-summary-jump-to-group group)
5133 (gnus-group-get-new-news-this-group 1)))
5134 (gnus-group-read-group all t)
5135 (gnus-summary-goto-subject current-subject nil t)))
5137 (defun gnus-summary-rescan-group (&optional all)
5138 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5140 (gnus-summary-reselect-current-group all t))
5142 (defun gnus-summary-update-info (&optional non-destructive)
5144 (let ((group gnus-newsgroup-name))
5146 (when gnus-newsgroup-kill-headers
5147 (setq gnus-newsgroup-killed
5148 (gnus-compress-sequence
5150 (gnus-set-sorted-intersection
5151 (gnus-uncompress-range gnus-newsgroup-killed)
5152 (setq gnus-newsgroup-unselected
5153 (sort gnus-newsgroup-unselected '<)))
5154 (setq gnus-newsgroup-unreads
5155 (sort gnus-newsgroup-unreads '<)))
5157 (unless (listp (cdr gnus-newsgroup-killed))
5158 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5159 (let ((headers gnus-newsgroup-headers))
5160 ;; Set the new ranges of read articles.
5162 (set-buffer gnus-group-buffer)
5163 (gnus-undo-force-boundary))
5164 (gnus-update-read-articles
5165 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5166 ;; Set the current article marks.
5167 (let ((gnus-newsgroup-scored
5168 (if (and (not gnus-save-score)
5169 (not non-destructive))
5171 gnus-newsgroup-scored)))
5173 (gnus-update-marks)))
5174 ;; Do the cross-ref thing.
5175 (when gnus-use-cross-reference
5176 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5177 ;; Do not switch windows but change the buffer to work.
5178 (set-buffer gnus-group-buffer)
5179 (unless (gnus-ephemeral-group-p group)
5180 (gnus-group-update-group group)))))))
5182 (defun gnus-summary-save-newsrc (&optional force)
5183 "Save the current number of read/marked articles in the dribble buffer.
5184 The dribble buffer will then be saved.
5185 If FORCE (the prefix), also save the .newsrc file(s)."
5187 (gnus-summary-update-info t)
5189 (gnus-save-newsrc-file)
5190 (gnus-dribble-save)))
5192 (defun gnus-summary-exit (&optional temporary)
5193 "Exit reading current newsgroup, and then return to group selection mode.
5194 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5196 (gnus-set-global-variables)
5197 (gnus-kill-save-kill-buffer)
5198 (gnus-async-halt-prefetch)
5199 (let* ((group gnus-newsgroup-name)
5200 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5203 (buf (current-buffer)))
5204 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5205 ;; If we have several article buffers, we kill them at exit.
5206 (unless gnus-single-article-buffer
5207 (gnus-kill-buffer gnus-original-article-buffer)
5208 (setq gnus-article-current nil))
5209 (when gnus-use-cache
5210 (gnus-cache-possibly-remove-articles)
5211 (gnus-cache-save-buffers))
5212 (gnus-async-prefetch-remove-group group)
5213 (when gnus-suppress-duplicates
5214 (gnus-dup-enter-articles))
5215 (when gnus-use-trees
5216 (gnus-tree-close group))
5217 ;; Remove entries for this group.
5218 (nnmail-purge-split-history (gnus-group-real-name group))
5219 ;; Make all changes in this group permanent.
5221 (gnus-run-hooks 'gnus-exit-group-hook)
5222 (gnus-summary-update-info)
5223 ;; Do adaptive scoring, and possibly save score files.
5224 (when gnus-newsgroup-adaptive
5225 (gnus-score-adaptive))
5226 (when gnus-use-scoring
5228 (gnus-close-group group)
5229 ;; Make sure where we were, and go to next newsgroup.
5230 (set-buffer gnus-group-buffer)
5232 (gnus-group-jump-to-group group))
5233 (gnus-run-hooks 'gnus-summary-exit-hook)
5234 (unless (or quit-config
5235 ;; If this group has disappeared from the summary
5236 ;; buffer, don't skip forwards.
5237 (not (string= group (gnus-group-group-name))))
5238 (gnus-group-next-unread-group 1))
5239 (setq group-point (point))
5242 ;; If we have several article buffers, we kill them at exit.
5243 (unless gnus-single-article-buffer
5244 (gnus-kill-buffer gnus-article-buffer)
5245 (gnus-kill-buffer gnus-original-article-buffer)
5246 (setq gnus-article-current nil))
5248 (if (not gnus-kill-summary-on-exit)
5249 (gnus-deaden-summary)
5250 ;; We set all buffer-local variables to nil. It is unclear why
5251 ;; this is needed, but if we don't, buffer-local variables are
5252 ;; not garbage-collected, it seems. This would the lead to en
5253 ;; ever-growing Emacs.
5254 (gnus-summary-clear-local-variables)
5255 (when (get-buffer gnus-article-buffer)
5256 (bury-buffer gnus-article-buffer))
5257 ;; We clear the global counterparts of the buffer-local
5258 ;; variables as well, just to be on the safe side.
5259 (set-buffer gnus-group-buffer)
5260 (gnus-summary-clear-local-variables)
5261 ;; Return to group mode buffer.
5262 (when (eq mode 'gnus-summary-mode)
5263 (gnus-kill-buffer buf)))
5264 (setq gnus-current-select-method gnus-select-method)
5265 (pop-to-buffer gnus-group-buffer)
5266 (if (not quit-config)
5268 (goto-char group-point)
5269 (gnus-configure-windows 'group 'force))
5270 (gnus-handle-ephemeral-exit quit-config))
5271 ;; Clear the current group name.
5273 (setq gnus-newsgroup-name nil)))))
5275 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5276 (defun gnus-summary-exit-no-update (&optional no-questions)
5277 "Quit reading current newsgroup without updating read article info."
5279 (let* ((group gnus-newsgroup-name)
5280 (quit-config (gnus-group-quit-config group)))
5281 (when (or no-questions
5283 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5284 (gnus-async-halt-prefetch)
5285 (gnus-run-hooks (delq 'gnus-summary-expire-articles
5286 (copy-list gnus-summary-prepare-exit-hook)))
5287 ;; If we have several article buffers, we kill them at exit.
5288 (unless gnus-single-article-buffer
5289 (gnus-kill-buffer gnus-article-buffer)
5290 (gnus-kill-buffer gnus-original-article-buffer)
5291 (setq gnus-article-current nil))
5292 (if (not gnus-kill-summary-on-exit)
5293 (gnus-deaden-summary)
5294 (gnus-close-group group)
5295 (gnus-summary-clear-local-variables)
5296 (set-buffer gnus-group-buffer)
5297 (gnus-summary-clear-local-variables)
5298 (when (get-buffer gnus-summary-buffer)
5299 (kill-buffer gnus-summary-buffer)))
5300 (unless gnus-single-article-buffer
5301 (setq gnus-article-current nil))
5302 (when gnus-use-trees
5303 (gnus-tree-close group))
5304 (gnus-async-prefetch-remove-group group)
5305 (when (get-buffer gnus-article-buffer)
5306 (bury-buffer gnus-article-buffer))
5307 ;; Return to the group buffer.
5308 (gnus-configure-windows 'group 'force)
5309 ;; Clear the current group name.
5310 (setq gnus-newsgroup-name nil)
5311 (when (equal (gnus-group-group-name) group)
5312 (gnus-group-next-unread-group 1))
5314 (gnus-handle-ephemeral-exit quit-config)))))
5316 (defun gnus-handle-ephemeral-exit (quit-config)
5317 "Handle movement when leaving an ephemeral group.
5318 The state which existed when entering the ephemeral is reset."
5319 (if (not (buffer-name (car quit-config)))
5320 (gnus-configure-windows 'group 'force)
5321 (set-buffer (car quit-config))
5322 (cond ((eq major-mode 'gnus-summary-mode)
5323 (gnus-set-global-variables))
5324 ((eq major-mode 'gnus-article-mode)
5326 ;; The `gnus-summary-buffer' variable may point
5327 ;; to the old summary buffer when using a single
5329 (unless (gnus-buffer-live-p gnus-summary-buffer)
5330 (set-buffer gnus-group-buffer))
5331 (set-buffer gnus-summary-buffer)
5332 (gnus-set-global-variables))))
5333 (if (or (eq (cdr quit-config) 'article)
5334 (eq (cdr quit-config) 'pick))
5336 ;; The current article may be from the ephemeral group
5337 ;; thus it is best that we reload this article
5338 (gnus-summary-show-article)
5339 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5340 (gnus-configure-windows 'pick 'force)
5341 (gnus-configure-windows (cdr quit-config) 'force)))
5342 (gnus-configure-windows (cdr quit-config) 'force))
5343 (when (eq major-mode 'gnus-summary-mode)
5344 (gnus-summary-next-subject 1 nil t)
5345 (gnus-summary-recenter)
5346 (gnus-summary-position-point))))
5348 (defun gnus-summary-preview-mime-message (arg)
5349 "MIME decode and play this message."
5352 (let ((gnus-break-pages nil)
5354 (gnus-summary-select-article t t)
5356 (select-window (get-buffer-window gnus-article-buffer))
5361 (defvar gnus-dead-summary-mode-map nil)
5363 (unless gnus-dead-summary-mode-map
5364 (setq gnus-dead-summary-mode-map (make-keymap))
5365 (suppress-keymap gnus-dead-summary-mode-map)
5366 (substitute-key-definition
5367 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5368 (let ((keys '("\C-d" "\r" "\177" [delete])))
5370 (define-key gnus-dead-summary-mode-map
5371 (pop keys) 'gnus-summary-wake-up-the-dead))))
5373 (defvar gnus-dead-summary-mode nil
5374 "Minor mode for Gnus summary buffers.")
5376 (defun gnus-dead-summary-mode (&optional arg)
5377 "Minor mode for Gnus summary buffers."
5379 (when (eq major-mode 'gnus-summary-mode)
5380 (make-local-variable 'gnus-dead-summary-mode)
5381 (setq gnus-dead-summary-mode
5382 (if (null arg) (not gnus-dead-summary-mode)
5383 (> (prefix-numeric-value arg) 0)))
5384 (when gnus-dead-summary-mode
5385 (gnus-add-minor-mode
5386 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5388 (defun gnus-deaden-summary ()
5389 "Make the current summary buffer into a dead summary buffer."
5390 ;; Kill any previous dead summary buffer.
5391 (when (and gnus-dead-summary
5392 (buffer-name gnus-dead-summary))
5394 (set-buffer gnus-dead-summary)
5395 (when gnus-dead-summary-mode
5396 (kill-buffer (current-buffer)))))
5397 ;; Make this the current dead summary.
5398 (setq gnus-dead-summary (current-buffer))
5399 (gnus-dead-summary-mode 1)
5400 (let ((name (buffer-name)))
5401 (when (string-match "Summary" name)
5403 (concat (substring name 0 (match-beginning 0)) "Dead "
5404 (substring name (match-beginning 0)))
5407 (defun gnus-kill-or-deaden-summary (buffer)
5408 "Kill or deaden the summary BUFFER."
5410 (when (and (buffer-name buffer)
5411 (not gnus-single-article-buffer))
5414 (gnus-kill-buffer gnus-article-buffer)
5415 (gnus-kill-buffer gnus-original-article-buffer)))
5416 (cond (gnus-kill-summary-on-exit
5417 (when (and gnus-use-trees
5418 (gnus-buffer-exists-p buffer))
5421 (gnus-tree-close gnus-newsgroup-name)))
5422 (gnus-kill-buffer buffer))
5423 ((gnus-buffer-exists-p buffer)
5426 (gnus-deaden-summary))))))
5428 (defun gnus-summary-wake-up-the-dead (&rest args)
5429 "Wake up the dead summary buffer."
5431 (gnus-dead-summary-mode -1)
5432 (let ((name (buffer-name)))
5433 (when (string-match "Dead " name)
5435 (concat (substring name 0 (match-beginning 0))
5436 (substring name (match-end 0)))
5438 (gnus-message 3 "This dead summary is now alive again"))
5440 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5441 (defun gnus-summary-fetch-faq (&optional faq-dir)
5442 "Fetch the FAQ for the current group.
5443 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5447 (when current-prefix-arg
5449 "Faq dir: " (and (listp gnus-group-faq-directory)
5450 (mapcar (lambda (file) (list file))
5451 gnus-group-faq-directory))))))
5452 (let (gnus-faq-buffer)
5453 (when (setq gnus-faq-buffer
5454 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5455 (gnus-configure-windows 'summary-faq))))
5457 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5458 (defun gnus-summary-describe-group (&optional force)
5459 "Describe the current newsgroup."
5461 (gnus-group-describe-group force gnus-newsgroup-name))
5463 (defun gnus-summary-describe-briefly ()
5464 "Describe summary mode commands briefly."
5467 (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")))
5469 ;; Walking around group mode buffer from summary mode.
5471 (defun gnus-summary-next-group (&optional no-article target-group backward)
5472 "Exit current newsgroup and then select next unread newsgroup.
5473 If prefix argument NO-ARTICLE is non-nil, no article is selected
5474 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5475 previous group instead."
5477 ;; Stop pre-fetching.
5478 (gnus-async-halt-prefetch)
5479 (let ((current-group gnus-newsgroup-name)
5480 (current-buffer (current-buffer))
5482 ;; First we semi-exit this group to update Xrefs and all variables.
5483 ;; We can't do a real exit, because the window conf must remain
5484 ;; the same in case the user is prompted for info, and we don't
5485 ;; want the window conf to change before that...
5486 (gnus-summary-exit t)
5487 (while (not entered)
5488 ;; Then we find what group we are supposed to enter.
5489 (set-buffer gnus-group-buffer)
5490 (gnus-group-jump-to-group current-group)
5493 (if (eq gnus-keep-same-level 'best)
5494 (gnus-summary-best-group gnus-newsgroup-name)
5495 (gnus-summary-search-group backward gnus-keep-same-level))))
5496 (if (not target-group)
5497 ;; There are no further groups, so we return to the group
5500 (gnus-message 5 "Returning to the group buffer")
5502 (when (gnus-buffer-live-p current-buffer)
5503 (set-buffer current-buffer)
5504 (gnus-summary-exit))
5505 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5506 ;; We try to enter the target group.
5507 (gnus-group-jump-to-group target-group)
5508 (let ((unreads (gnus-group-group-unread)))
5509 (if (and (or (eq t unreads)
5510 (and unreads (not (zerop unreads))))
5511 (gnus-summary-read-group
5512 target-group nil no-article
5513 (and (buffer-name current-buffer) current-buffer)
5516 (setq current-group target-group
5517 target-group nil)))))))
5519 (defun gnus-summary-prev-group (&optional no-article)
5520 "Exit current newsgroup and then select previous unread newsgroup.
5521 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5523 (gnus-summary-next-group no-article nil t))
5525 ;; Walking around summary lines.
5527 (defun gnus-summary-first-subject (&optional unread undownloaded)
5528 "Go to the first unread subject.
5529 If UNREAD is non-nil, go to the first unread article.
5530 Returns the article selected or nil if there are no unread articles."
5535 ((null gnus-newsgroup-data)
5536 (gnus-message 3 "No articles in the group")
5538 ;; Pick the first article.
5540 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5541 (gnus-data-number (car gnus-newsgroup-data)))
5542 ;; No unread articles.
5543 ((null gnus-newsgroup-unreads)
5544 (gnus-message 3 "No more unread articles")
5546 ;; Find the first unread article.
5548 (let ((data gnus-newsgroup-data))
5550 (and (not (and undownloaded
5551 (eq gnus-undownloaded-mark
5552 (gnus-data-mark (car data)))))
5553 (not (gnus-data-unread-p (car data)))))
5554 (setq data (cdr data)))
5556 (goto-char (gnus-data-pos (car data)))
5557 (gnus-data-number (car data))))))
5558 (gnus-summary-position-point)))
5560 (defun gnus-summary-next-subject (n &optional unread dont-display)
5561 "Go to next N'th summary line.
5562 If N is negative, go to the previous N'th subject line.
5563 If UNREAD is non-nil, only unread articles are selected.
5564 The difference between N and the actual number of steps taken is
5567 (let ((backward (< n 0))
5571 (gnus-summary-find-prev unread)
5572 (gnus-summary-find-next unread)))
5573 (gnus-summary-show-thread)
5576 (gnus-message 7 "No more%s articles"
5577 (if unread " unread" "")))
5578 (unless dont-display
5579 (gnus-summary-recenter)
5580 (gnus-summary-position-point))
5583 (defun gnus-summary-next-unread-subject (n)
5584 "Go to next N'th unread summary line."
5586 (gnus-summary-next-subject n t))
5588 (defun gnus-summary-prev-subject (n &optional unread)
5589 "Go to previous N'th summary line.
5590 If optional argument UNREAD is non-nil, only unread article is selected."
5592 (gnus-summary-next-subject (- n) unread))
5594 (defun gnus-summary-prev-unread-subject (n)
5595 "Go to previous N'th unread summary line."
5597 (gnus-summary-next-subject (- n) t))
5599 (defun gnus-summary-goto-subject (article &optional force silent)
5600 "Go the subject line of ARTICLE.
5601 If FORCE, also allow jumping to articles not currently shown."
5602 (interactive "nArticle number: ")
5604 (data (gnus-data-find article)))
5605 ;; We read in the article if we have to.
5608 (gnus-summary-insert-subject
5610 (if (or (numberp force) (vectorp force)) force)
5612 (setq data (gnus-data-find article)))
5617 (gnus-message 3 "Can't find article %d" article))
5619 (goto-char (gnus-data-pos data))
5620 (gnus-summary-position-point)
5623 ;; Walking around summary lines with displaying articles.
5625 (defun gnus-summary-expand-window (&optional arg)
5626 "Make the summary buffer take up the entire Emacs frame.
5627 Given a prefix, will force an `article' buffer configuration."
5630 (gnus-configure-windows 'article 'force)
5631 (gnus-configure-windows 'summary 'force)))
5633 (defun gnus-summary-display-article (article &optional all-header)
5634 "Display ARTICLE in article buffer."
5635 (gnus-set-global-variables)
5639 (if gnus-summary-display-article-function
5640 (funcall gnus-summary-display-article-function article all-header)
5641 (gnus-article-prepare article all-header))
5642 (gnus-run-hooks 'gnus-select-article-hook)
5643 (when (and gnus-current-article
5644 (not (zerop gnus-current-article)))
5645 (gnus-summary-goto-subject gnus-current-article))
5646 (gnus-summary-recenter)
5647 (when (and gnus-use-trees gnus-show-threads)
5648 (gnus-possibly-generate-tree article)
5649 (gnus-highlight-selected-tree article))
5650 ;; Successfully display article.
5651 (gnus-article-set-window-start
5652 (cdr (assq article gnus-newsgroup-bookmarks))))))
5654 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5655 "Select the current article.
5656 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5657 non-nil, the article will be re-fetched even if it already present in
5658 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5660 ;; Make sure we are in the summary buffer to work around bbdb bug.
5661 (unless (eq major-mode 'gnus-summary-mode)
5662 (set-buffer gnus-summary-buffer))
5663 (let ((article (or article (gnus-summary-article-number)))
5664 (all-headers (not (not all-headers))) ;Must be T or NIL.
5665 gnus-summary-display-article-function
5668 (gnus-summary-article-pseudo-p article)
5669 (error "This is a pseudo-article"))
5672 (set-buffer gnus-summary-buffer)
5673 (if (or (and gnus-single-article-buffer
5674 (or (null gnus-current-article)
5675 (null gnus-article-current)
5676 (null (get-buffer gnus-article-buffer))
5677 (not (eq article (cdr gnus-article-current)))
5678 (not (equal (car gnus-article-current)
5679 gnus-newsgroup-name))))
5680 (and (not gnus-single-article-buffer)
5681 (or (null gnus-current-article)
5682 (not (eq gnus-current-article article))))
5684 ;; The requested article is different from the current article.
5686 (gnus-summary-display-article article all-headers)
5688 (when (or all-headers gnus-show-all-headers)
5689 (gnus-article-show-all-headers))
5692 (gnus-article-set-window-start
5693 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5695 (defun gnus-summary-set-current-mark (&optional current-mark)
5696 "Obsolete function."
5699 (defun gnus-summary-next-article (&optional unread subject backward push)
5700 "Select the next article.
5701 If UNREAD, only unread articles are selected.
5702 If SUBJECT, only articles with SUBJECT are selected.
5703 If BACKWARD, the previous article is selected instead of the next."
5706 ;; Is there such an article?
5707 ((and (gnus-summary-search-forward unread subject backward)
5708 (or (gnus-summary-display-article (gnus-summary-article-number))
5709 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5710 (gnus-summary-position-point))
5711 ;; If not, we try the first unread, if that is wanted.
5713 gnus-auto-select-same
5714 (gnus-summary-first-unread-article))
5715 (gnus-summary-position-point)
5716 (gnus-message 6 "Wrapped"))
5717 ;; Try to get next/previous article not displayed in this group.
5718 ((and gnus-auto-extend-newsgroup
5719 (not unread) (not subject))
5720 (gnus-summary-goto-article
5721 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5722 nil (count-lines (point-min) (point))))
5723 ;; Go to next/previous group.
5725 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5726 (gnus-summary-jump-to-group gnus-newsgroup-name))
5727 (let ((cmd last-command-char)
5730 (set-buffer gnus-group-buffer)
5733 (if (eq gnus-keep-same-level 'best)
5734 (gnus-summary-best-group gnus-newsgroup-name)
5735 (gnus-summary-search-group backward gnus-keep-same-level))))
5736 ;; For some reason, the group window gets selected. We change
5738 (select-window (get-buffer-window (current-buffer)))
5739 ;; Select next unread newsgroup automagically.
5741 ((or (not gnus-auto-select-next)
5743 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5744 ((or (eq gnus-auto-select-next 'quietly)
5745 (and (eq gnus-auto-select-next 'slightly-quietly)
5747 (and (eq gnus-auto-select-next 'almost-quietly)
5748 (gnus-summary-last-article-p)))
5750 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5752 (gnus-message 7 "No more%s articles (%s)..."
5753 (if unread " unread" "")
5754 (if group (concat "selecting " group)
5756 (gnus-summary-next-group nil group backward)))
5758 (when (gnus-key-press-event-p last-input-event)
5759 (gnus-summary-walk-group-buffer
5760 gnus-newsgroup-name cmd unread backward point))))))))
5762 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5763 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5764 (?\C-p (gnus-group-prev-unread-group 1))))
5765 (cursor-in-echo-area t)
5766 keve key group ended)
5768 (set-buffer gnus-group-buffer)
5771 (if (eq gnus-keep-same-level 'best)
5772 (gnus-summary-best-group gnus-newsgroup-name)
5773 (gnus-summary-search-group backward gnus-keep-same-level))))
5776 5 "No more%s articles%s" (if unread " unread" "")
5778 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5779 (format " (Type %s for %s [%s])"
5780 (single-key-description cmd) group
5781 (car (gnus-gethash group gnus-newsrc-hashtb)))
5782 (format " (Type %s to exit %s)"
5783 (single-key-description cmd)
5784 gnus-newsgroup-name)))
5785 ;; Confirm auto selection.
5786 (setq key (car (setq keve (gnus-read-event-char))))
5789 ((assq key keystrokes)
5790 (let ((obuf (current-buffer)))
5791 (switch-to-buffer gnus-group-buffer)
5793 (gnus-group-jump-to-group group))
5794 (eval (cadr (assq key keystrokes)))
5795 (setq group (gnus-group-group-name))
5796 (switch-to-buffer obuf))
5800 (gnus-ephemeral-group-p gnus-newsgroup-name))
5802 (gnus-summary-next-group nil group backward)))
5804 (push (cdr keve) unread-command-events))))))
5806 (defun gnus-summary-next-unread-article ()
5807 "Select unread article after current one."
5809 (gnus-summary-next-article
5810 (or (not (eq gnus-summary-goto-unread 'never))
5811 (gnus-summary-last-article-p (gnus-summary-article-number)))
5812 (and gnus-auto-select-same
5813 (gnus-summary-article-subject))))
5815 (defun gnus-summary-prev-article (&optional unread subject)
5816 "Select the article after the current one.
5817 If UNREAD is non-nil, only unread articles are selected."
5819 (gnus-summary-next-article unread subject t))
5821 (defun gnus-summary-prev-unread-article ()
5822 "Select unread article before current one."
5824 (gnus-summary-prev-article
5825 (or (not (eq gnus-summary-goto-unread 'never))
5826 (gnus-summary-first-article-p (gnus-summary-article-number)))
5827 (and gnus-auto-select-same
5828 (gnus-summary-article-subject))))
5830 (defun gnus-summary-next-page (&optional lines circular)
5831 "Show next page of the selected article.
5832 If at the end of the current article, select the next article.
5833 LINES says how many lines should be scrolled up.
5835 If CIRCULAR is non-nil, go to the start of the article instead of
5836 selecting the next article when reaching the end of the current
5839 (setq gnus-summary-buffer (current-buffer))
5840 (gnus-set-global-variables)
5841 (let ((article (gnus-summary-article-number))
5842 (article-window (get-buffer-window gnus-article-buffer t))
5844 ;; If the buffer is empty, we have no article.
5846 (error "No article to select"))
5847 (gnus-configure-windows 'article)
5848 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5849 (if (and (eq gnus-summary-goto-unread 'never)
5850 (not (gnus-summary-last-article-p article)))
5851 (gnus-summary-next-article)
5852 (gnus-summary-next-unread-article))
5853 (if (or (null gnus-current-article)
5854 (null gnus-article-current)
5855 (/= article (cdr gnus-article-current))
5856 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5857 ;; Selected subject is different from current article's.
5858 (gnus-summary-display-article article)
5859 (when article-window
5860 (gnus-eval-in-buffer-window gnus-article-buffer
5861 (setq endp (gnus-article-next-page lines)))
5864 (gnus-summary-beginning-of-article))
5866 (gnus-message 3 "End of message"))
5868 (if (and (eq gnus-summary-goto-unread 'never)
5869 (not (gnus-summary-last-article-p article)))
5870 (gnus-summary-next-article)
5871 (gnus-summary-next-unread-article))))))))
5872 (gnus-summary-recenter)
5873 (gnus-summary-position-point)))
5875 (defun gnus-summary-prev-page (&optional lines move)
5876 "Show previous page of selected article.
5877 Argument LINES specifies lines to be scrolled down.
5878 If MOVE, move to the previous unread article if point is at
5879 the beginning of the buffer."
5881 (let ((article (gnus-summary-article-number))
5882 (article-window (get-buffer-window gnus-article-buffer t))
5884 (gnus-configure-windows 'article)
5885 (if (or (null gnus-current-article)
5886 (null gnus-article-current)
5887 (/= article (cdr gnus-article-current))
5888 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5889 ;; Selected subject is different from current article's.
5890 (gnus-summary-display-article article)
5891 (gnus-summary-recenter)
5892 (when article-window
5893 (gnus-eval-in-buffer-window gnus-article-buffer
5894 (setq endp (gnus-article-prev-page lines)))
5895 (when (and move endp)
5897 (gnus-message 3 "Beginning of message"))
5899 (if (and (eq gnus-summary-goto-unread 'never)
5900 (not (gnus-summary-first-article-p article)))
5901 (gnus-summary-prev-article)
5902 (gnus-summary-prev-unread-article))))))))
5903 (gnus-summary-position-point))
5905 (defun gnus-summary-prev-page-or-article (&optional lines)
5906 "Show previous page of selected article.
5907 Argument LINES specifies lines to be scrolled down.
5908 If at the beginning of the article, go to the next article."
5910 (gnus-summary-prev-page lines t))
5912 (defun gnus-summary-scroll-up (lines)
5913 "Scroll up (or down) one line current article.
5914 Argument LINES specifies lines to be scrolled up (or down if negative)."
5916 (gnus-configure-windows 'article)
5917 (gnus-summary-show-thread)
5918 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5919 (gnus-eval-in-buffer-window gnus-article-buffer
5921 (when (gnus-article-next-page lines)
5922 (gnus-message 3 "End of message")))
5924 (gnus-article-prev-page (- lines))))))
5925 (gnus-summary-recenter)
5926 (gnus-summary-position-point))
5928 (defun gnus-summary-scroll-down (lines)
5929 "Scroll down (or up) one line current article.
5930 Argument LINES specifies lines to be scrolled down (or up if negative)."
5932 (gnus-summary-scroll-up (- lines)))
5934 (defun gnus-summary-next-same-subject ()
5935 "Select next article which has the same subject as current one."
5937 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5939 (defun gnus-summary-prev-same-subject ()
5940 "Select previous article which has the same subject as current one."
5942 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5944 (defun gnus-summary-next-unread-same-subject ()
5945 "Select next unread article which has the same subject as current one."
5947 (gnus-summary-next-article t (gnus-summary-article-subject)))
5949 (defun gnus-summary-prev-unread-same-subject ()
5950 "Select previous unread article which has the same subject as current one."
5952 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5954 (defun gnus-summary-first-unread-article ()
5955 "Select the first unread article.
5956 Return nil if there are no unread articles."
5959 (when (gnus-summary-first-subject t)
5960 (gnus-summary-show-thread)
5961 (gnus-summary-first-subject t)
5962 (gnus-summary-display-article (gnus-summary-article-number)))
5963 (gnus-summary-position-point)))
5965 (defun gnus-summary-first-unread-subject ()
5966 "Place the point on the subject line of the first unread article.
5967 Return nil if there are no unread articles."
5970 (when (gnus-summary-first-subject t)
5971 (gnus-summary-show-thread)
5972 (gnus-summary-first-subject t))
5973 (gnus-summary-position-point)))
5975 (defun gnus-summary-first-article ()
5976 "Select the first article.
5977 Return nil if there are no articles."
5980 (when (gnus-summary-first-subject)
5981 (gnus-summary-show-thread)
5982 (gnus-summary-first-subject)
5983 (gnus-summary-display-article (gnus-summary-article-number)))
5984 (gnus-summary-position-point)))
5986 (defun gnus-summary-best-unread-article ()
5987 "Select the unread article with the highest score."
5989 (let ((best -1000000)
5990 (data gnus-newsgroup-data)
5993 (and (gnus-data-unread-p (car data))
5995 (gnus-summary-article-score (gnus-data-number (car data))))
5998 article (gnus-data-number (car data))))
5999 (setq data (cdr data)))
6002 (gnus-summary-goto-article article)
6003 (error "No unread articles"))
6004 (gnus-summary-position-point))))
6006 (defun gnus-summary-last-subject ()
6007 "Go to the last displayed subject line in the group."
6008 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6010 (gnus-summary-goto-subject article))))
6012 (defun gnus-summary-goto-article (article &optional all-headers force)
6013 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6014 If ALL-HEADERS is non-nil, no header lines are hidden.
6015 If FORCE, go to the article even if it isn't displayed. If FORCE
6016 is a number, it is the line the article is to be displayed on."
6020 "Article number or Message-ID: "
6021 (mapcar (lambda (number) (list (int-to-string number)))
6022 gnus-newsgroup-limit))
6026 (if (and (stringp article)
6027 (string-match "@" article))
6028 (gnus-summary-refer-article article)
6029 (when (stringp article)
6030 (setq article (string-to-number article)))
6031 (if (gnus-summary-goto-subject article force)
6032 (gnus-summary-display-article article all-headers)
6033 (gnus-message 4 "Couldn't go to article %s" article) nil))
6034 (gnus-summary-position-point)))
6036 (defun gnus-summary-goto-last-article ()
6037 "Go to the previously read article."
6040 (when gnus-last-article
6041 (gnus-summary-goto-article gnus-last-article nil t))
6042 (gnus-summary-position-point)))
6044 (defun gnus-summary-pop-article (number)
6045 "Pop one article off the history and go to the previous.
6046 NUMBER articles will be popped off."
6049 (setq gnus-newsgroup-history
6050 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6052 (gnus-summary-goto-article (car to) nil t)
6053 (error "Article history empty")))
6054 (gnus-summary-position-point))
6056 ;; Summary commands and functions for limiting the summary buffer.
6058 (defun gnus-summary-limit-to-articles (n)
6059 "Limit the summary buffer to the next N articles.
6060 If not given a prefix, use the process marked articles instead."
6063 (let ((articles (gnus-summary-work-articles n)))
6064 (setq gnus-newsgroup-processable nil)
6065 (gnus-summary-limit articles))
6066 (gnus-summary-position-point)))
6068 (defun gnus-summary-pop-limit (&optional total)
6069 "Restore the previous limit.
6070 If given a prefix, remove all limits."
6073 (setq gnus-newsgroup-limits
6074 (list (mapcar (lambda (h) (mail-header-number h))
6075 gnus-newsgroup-headers))))
6076 (unless gnus-newsgroup-limits
6077 (error "No limit to pop"))
6079 (gnus-summary-limit nil 'pop)
6080 (gnus-summary-position-point)))
6082 (defun gnus-summary-limit-to-subject (subject &optional header)
6083 "Limit the summary buffer to articles that have subjects that match a regexp."
6084 (interactive "sLimit to subject (regexp): ")
6086 (setq header "subject"))
6087 (when (not (equal "" subject))
6089 (let ((articles (gnus-summary-find-matching
6090 (or header "subject") subject 'all)))
6092 (error "Found no matches for \"%s\"" subject))
6093 (gnus-summary-limit articles))
6094 (gnus-summary-position-point))))
6096 (defun gnus-summary-limit-to-author (from)
6097 "Limit the summary buffer to articles that have authors that match a regexp."
6098 (interactive "sLimit to author (regexp): ")
6099 (gnus-summary-limit-to-subject from "from"))
6101 (defun gnus-summary-limit-to-age (age &optional younger-p)
6102 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6103 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6104 articles that are younger than AGE days."
6105 (interactive "nTime in days: \nP")
6107 (let ((data gnus-newsgroup-data)
6108 (cutoff (days-to-time age))
6109 articles d date is-younger)
6110 (while (setq d (pop data))
6111 (when (and (vectorp (gnus-data-header d))
6112 (setq date (mail-header-date (gnus-data-header d))))
6113 (setq is-younger (time-less-p
6114 (time-since (date-to-time date))
6119 (push (gnus-data-number d) articles))))
6120 (gnus-summary-limit (nreverse articles)))
6121 (gnus-summary-position-point)))
6123 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6125 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6127 (defun gnus-summary-limit-to-unread (&optional all)
6128 "Limit the summary buffer to articles that are not marked as read.
6129 If ALL is non-nil, limit strictly to unread articles."
6132 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6133 (gnus-summary-limit-to-marks
6134 ;; Concat all the marks that say that an article is read and have
6136 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6137 gnus-killed-mark gnus-kill-file-mark
6138 gnus-low-score-mark gnus-expirable-mark
6139 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6140 gnus-duplicate-mark gnus-souped-mark)
6143 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6144 (make-obsolete 'gnus-summary-delete-marked-with
6145 'gnus-summary-limit-exlude-marks)
6147 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6148 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6149 If REVERSE, limit the summary buffer to articles that are marked
6150 with MARKS. MARKS can either be a string of marks or a list of marks.
6151 Returns how many articles were removed."
6152 (interactive "sMarks: ")
6153 (gnus-summary-limit-to-marks marks t))
6155 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6156 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6157 If REVERSE (the prefix), limit the summary buffer to articles that are
6158 not marked with MARKS. MARKS can either be a string of marks or a
6160 Returns how many articles were removed."
6161 (interactive "sMarks: \nP")
6163 (let ((data gnus-newsgroup-data)
6164 (marks (if (listp marks) marks
6165 (append marks nil))) ; Transform to list.
6168 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6169 (memq (gnus-data-mark (car data)) marks))
6170 (push (gnus-data-number (car data)) articles))
6171 (setq data (cdr data)))
6172 (gnus-summary-limit articles))
6173 (gnus-summary-position-point)))
6175 (defun gnus-summary-limit-to-score (&optional score)
6176 "Limit to articles with score at or above SCORE."
6178 (setq score (if score
6179 (prefix-numeric-value score)
6180 (or gnus-summary-default-score 0)))
6181 (let ((data gnus-newsgroup-data)
6184 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6186 (push (gnus-data-number (car data)) articles))
6187 (setq data (cdr data)))
6189 (gnus-summary-limit articles)
6190 (gnus-summary-position-point))))
6192 (defun gnus-summary-limit-include-thread (id)
6193 "Display all the hidden articles that in the current thread."
6194 (interactive (list (mail-header-id (gnus-summary-article-header))))
6195 (let ((articles (gnus-articles-in-thread
6196 (gnus-id-to-thread (gnus-root-id id)))))
6198 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6199 (gnus-summary-position-point))))
6201 (defun gnus-summary-limit-include-dormant ()
6202 "Display all the hidden articles that are marked as dormant.
6203 Note that this command only works on a subset of the articles currently
6204 fetched for this group."
6206 (unless gnus-newsgroup-dormant
6207 (error "There are no dormant articles in this group"))
6209 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6210 (gnus-summary-position-point)))
6212 (defun gnus-summary-limit-exclude-dormant ()
6213 "Hide all dormant articles."
6216 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6217 (gnus-summary-position-point)))
6219 (defun gnus-summary-limit-exclude-childless-dormant ()
6220 "Hide all dormant articles that have no children."
6222 (let ((data (gnus-data-list t))
6223 articles d children)
6224 ;; Find all articles that are either not dormant or have
6226 (while (setq d (pop data))
6227 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6229 (gnus-article-children (gnus-data-number d)))
6232 (when (memq (car children) articles)
6237 (push (gnus-data-number d) articles)))
6240 (gnus-summary-limit articles)
6241 (gnus-summary-position-point))))
6243 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6244 "Mark all unread excluded articles as read.
6245 If ALL, mark even excluded ticked and dormants as read."
6247 (let ((articles (gnus-sorted-complement
6249 (mapcar (lambda (h) (mail-header-number h))
6250 gnus-newsgroup-headers)
6252 (sort gnus-newsgroup-limit '<)))
6254 (setq gnus-newsgroup-unreads
6255 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6257 (setq gnus-newsgroup-dormant nil
6258 gnus-newsgroup-marked nil
6259 gnus-newsgroup-reads
6261 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6262 gnus-newsgroup-reads))
6263 (while (setq article (pop articles))
6264 (unless (or (memq article gnus-newsgroup-dormant)
6265 (memq article gnus-newsgroup-marked))
6266 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6268 (defun gnus-summary-limit (articles &optional pop)
6270 ;; We pop the previous limit off the stack and use that.
6271 (setq articles (car gnus-newsgroup-limits)
6272 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6273 ;; We use the new limit, so we push the old limit on the stack.
6274 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6276 (setq gnus-newsgroup-limit articles)
6277 (let ((total (length gnus-newsgroup-data))
6278 (data (gnus-data-find-list (gnus-summary-article-number)))
6279 (gnus-summary-mark-below nil) ; Inhibit this.
6281 ;; This will do all the work of generating the new summary buffer
6282 ;; according to the new limit.
6283 (gnus-summary-prepare)
6284 ;; Hide any threads, possibly.
6285 (and gnus-show-threads
6286 gnus-thread-hide-subtree
6287 (gnus-summary-hide-all-threads))
6288 ;; Try to return to the article you were at, or one in the
6291 ;; We try to find some article after the current one.
6293 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6296 (setq data (cdr data))))
6298 ;; If there is no data, that means that we were after the last
6299 ;; article. The same goes when we can't find any articles
6300 ;; after the current one.
6301 (goto-char (point-max))
6302 (gnus-summary-find-prev))
6303 (gnus-set-mode-line 'summary)
6304 ;; We return how many articles were removed from the summary
6305 ;; buffer as a result of the new limit.
6306 (- total (length gnus-newsgroup-data))))
6308 (defsubst gnus-invisible-cut-children (threads)
6311 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6316 (defsubst gnus-cut-thread (thread)
6317 "Go forwards in the thread until we find an article that we want to display."
6318 (when (or (eq gnus-fetch-old-headers 'some)
6319 (eq gnus-fetch-old-headers 'invisible)
6320 (eq gnus-build-sparse-threads 'some)
6321 (eq gnus-build-sparse-threads 'more))
6322 ;; Deal with old-fetched headers and sparse threads.
6326 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6327 (gnus-summary-article-ancient-p
6328 (mail-header-number (car thread))))
6329 (if (or (<= (length (cdr thread)) 1)
6330 (eq gnus-fetch-old-headers 'invisible))
6331 (setq gnus-newsgroup-limit
6332 (delq (mail-header-number (car thread))
6333 gnus-newsgroup-limit)
6334 thread (cadr thread))
6335 (when (gnus-invisible-cut-children (cdr thread))
6336 (let ((th (cdr thread)))
6338 (if (memq (mail-header-number (caar th))
6339 gnus-newsgroup-limit)
6340 (setq thread (car th)
6342 (setq th (cdr th))))))))))
6345 (defun gnus-cut-threads (threads)
6346 "Cut off all uninteresting articles from the beginning of threads."
6347 (when (or (eq gnus-fetch-old-headers 'some)
6348 (eq gnus-fetch-old-headers 'invisible)
6349 (eq gnus-build-sparse-threads 'some)
6350 (eq gnus-build-sparse-threads 'more))
6353 (setcar th (gnus-cut-thread (car th)))
6354 (setq th (cdr th)))))
6355 ;; Remove nixed out threads.
6358 (defun gnus-summary-initial-limit (&optional show-if-empty)
6359 "Figure out what the initial limit is supposed to be on group entry.
6360 This entails weeding out unwanted dormants, low-scored articles,
6361 fetch-old-headers verbiage, and so on."
6362 ;; Most groups have nothing to remove.
6363 (if (or gnus-inhibit-limiting
6364 (and (null gnus-newsgroup-dormant)
6365 (not (eq gnus-fetch-old-headers 'some))
6366 (not (eq gnus-fetch-old-headers 'invisible))
6367 (null gnus-summary-expunge-below)
6368 (not (eq gnus-build-sparse-threads 'some))
6369 (not (eq gnus-build-sparse-threads 'more))
6370 (null gnus-thread-expunge-below)
6371 (not gnus-use-nocem)))
6373 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6374 (setq gnus-newsgroup-limit nil)
6377 (unless (car (symbol-value node))
6378 ;; These threads have no parents -- they are roots.
6379 (let ((nodes (cdr (symbol-value node)))
6382 (if (and gnus-thread-expunge-below
6383 (< (gnus-thread-total-score (car nodes))
6384 gnus-thread-expunge-below))
6385 (gnus-expunge-thread (pop nodes))
6386 (setq thread (pop nodes))
6387 (gnus-summary-limit-children thread))))))
6388 gnus-newsgroup-dependencies)
6389 ;; If this limitation resulted in an empty group, we might
6390 ;; pop the previous limit and use it instead.
6391 (when (and (not gnus-newsgroup-limit)
6393 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6394 gnus-newsgroup-limit))
6396 (defun gnus-summary-limit-children (thread)
6397 "Return 1 if this subthread is visible and 0 if it is not."
6398 ;; First we get the number of visible children to this thread. This
6399 ;; is done by recursing down the thread using this function, so this
6400 ;; will really go down to a leaf article first, before slowly
6401 ;; working its way up towards the root.
6405 (apply '+ (mapcar 'gnus-summary-limit-children
6408 (number (mail-header-number (car thread)))
6411 (not (memq number gnus-newsgroup-marked))
6413 ;; If this article is dormant and has absolutely no visible
6414 ;; children, then this article isn't visible.
6415 (and (memq number gnus-newsgroup-dormant)
6417 ;; If this is "fetch-old-headered" and there is no
6418 ;; visible children, then we don't want this article.
6419 (and (eq gnus-fetch-old-headers 'some)
6420 (gnus-summary-article-ancient-p number)
6422 ;; If this is "fetch-old-headered" and `invisible', then
6423 ;; we don't want this article.
6424 (and (eq gnus-fetch-old-headers 'invisible)
6425 (gnus-summary-article-ancient-p number))
6426 ;; If this is a sparsely inserted article with no children,
6427 ;; we don't want it.
6428 (and (eq gnus-build-sparse-threads 'some)
6429 (gnus-summary-article-sparse-p number)
6431 ;; If we use expunging, and this article is really
6432 ;; low-scored, then we don't want this article.
6433 (when (and gnus-summary-expunge-below
6435 (or (cdr (assq number gnus-newsgroup-scored))
6436 gnus-summary-default-score))
6437 gnus-summary-expunge-below))
6438 ;; We increase the expunge-tally here, but that has
6439 ;; nothing to do with the limits, really.
6440 (incf gnus-newsgroup-expunged-tally)
6441 ;; We also mark as read here, if that's wanted.
6442 (when (and gnus-summary-mark-below
6443 (< score gnus-summary-mark-below))
6444 (setq gnus-newsgroup-unreads
6445 (delq number gnus-newsgroup-unreads))
6446 (if gnus-newsgroup-auto-expire
6447 (push number gnus-newsgroup-expirable)
6448 (push (cons number gnus-low-score-mark)
6449 gnus-newsgroup-reads)))
6451 ;; Check NoCeM things.
6452 (if (and gnus-use-nocem
6453 (gnus-nocem-unwanted-article-p
6454 (mail-header-id (car thread))))
6456 (setq gnus-newsgroup-unreads
6457 (delq number gnus-newsgroup-unreads))
6459 ;; Nope, invisible article.
6461 ;; Ok, this article is to be visible, so we add it to the limit
6463 (push number gnus-newsgroup-limit)
6466 (defun gnus-expunge-thread (thread)
6467 "Mark all articles in THREAD as read."
6468 (let* ((number (mail-header-number (car thread))))
6469 (incf gnus-newsgroup-expunged-tally)
6470 ;; We also mark as read here, if that's wanted.
6471 (setq gnus-newsgroup-unreads
6472 (delq number gnus-newsgroup-unreads))
6473 (if gnus-newsgroup-auto-expire
6474 (push number gnus-newsgroup-expirable)
6475 (push (cons number gnus-low-score-mark)
6476 gnus-newsgroup-reads)))
6477 ;; Go recursively through all subthreads.
6478 (mapcar 'gnus-expunge-thread (cdr thread)))
6480 ;; Summary article oriented commands
6482 (defun gnus-summary-refer-parent-article (n)
6483 "Refer parent article N times.
6484 If N is negative, go to ancestor -N instead.
6485 The difference between N and the number of articles fetched is returned."
6489 (when (not (natnump n))
6494 (setq header (gnus-summary-article-header))
6495 (if (and (eq (mail-header-number header)
6496 (cdr gnus-article-current))
6497 (equal gnus-newsgroup-name
6498 (car gnus-article-current)))
6499 ;; If we try to find the parent of the currently
6500 ;; displayed article, then we take a look at the actual
6501 ;; References header, since this is slightly more
6502 ;; reliable than the References field we got from the
6505 (set-buffer gnus-original-article-buffer)
6506 (nnheader-narrow-to-headers)
6507 (unless (setq ref (message-fetch-field "references"))
6508 (setq ref (message-fetch-field "in-reply-to")))
6511 ;; It's not the current article, so we take a bet on
6512 ;; the value we got from the server.
6513 (mail-header-references header)))
6515 (not (equal ref "")))
6516 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6517 (gnus-message 1 "Couldn't find parent"))
6518 (gnus-message 1 "No references in article %d"
6519 (gnus-summary-article-number))
6522 (gnus-summary-position-point)
6525 (defun gnus-summary-refer-references ()
6526 "Fetch all articles mentioned in the References header.
6527 Return the number of articles fetched."
6529 (let ((ref (mail-header-references (gnus-summary-article-header)))
6530 (current (gnus-summary-article-number))
6534 (error "No References in the current article")
6535 ;; For each Message-ID in the References header...
6536 (while (string-match "<[^>]*>" ref)
6538 ;; ... fetch that article.
6539 (gnus-summary-refer-article
6540 (prog1 (match-string 0 ref)
6541 (setq ref (substring ref (match-end 0))))))
6542 (gnus-summary-goto-subject current)
6543 (gnus-summary-position-point)
6546 (defun gnus-summary-refer-thread (&optional limit)
6547 "Fetch all articles in the current thread.
6548 If LIMIT (the numerical prefix), fetch that many old headers instead
6549 of what's specified by the `gnus-refer-thread-limit' variable."
6551 (let ((id (mail-header-id (gnus-summary-article-header)))
6552 (limit (if limit (prefix-numeric-value limit)
6553 gnus-refer-thread-limit)))
6554 ;; We want to fetch LIMIT *old* headers, but we also have to
6555 ;; re-fetch all the headers in the current buffer, because many of
6556 ;; them may be undisplayed. So we adjust LIMIT.
6557 (when (numberp limit)
6558 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6559 (unless (eq gnus-fetch-old-headers 'invisible)
6560 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6561 ;; Retrieve the headers and read them in.
6562 (if (eq (gnus-retrieve-headers
6563 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6565 (gnus-build-all-threads)
6566 (error "Can't fetch thread from backends that don't support NOV"))
6567 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6568 (gnus-summary-limit-include-thread id)))
6570 (defun gnus-summary-refer-article (message-id &optional arg)
6571 "Fetch an article specified by MESSAGE-ID.
6572 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6573 or `gnus-select-method', no matter what backend the article comes from."
6574 (interactive "sMessage-ID: \nP")
6575 (when (and (stringp message-id)
6576 (not (zerop (length message-id))))
6577 ;; Construct the correct Message-ID if necessary.
6578 ;; Suggested by tale@pawl.rpi.edu.
6579 (unless (string-match "^<" message-id)
6580 (setq message-id (concat "<" message-id)))
6581 (unless (string-match ">$" message-id)
6582 (setq message-id (concat message-id ">")))
6583 (let* ((header (gnus-id-to-header message-id))
6585 (gnus-summary-article-sparse-p
6586 (mail-header-number header))
6587 (memq (mail-header-number header)
6588 gnus-newsgroup-limit))))
6590 ;; If the article is present in the buffer we just go to it.
6592 (or (not (gnus-summary-article-sparse-p
6593 (mail-header-number header)))
6596 (gnus-summary-goto-article
6597 (mail-header-number header) nil t)
6599 (gnus-summary-update-article (mail-header-number header)))))
6601 ;; We fetch the article
6602 (let ((gnus-override-method
6603 (cond ((gnus-news-group-p gnus-newsgroup-name)
6604 gnus-refer-article-method)
6606 (or gnus-refer-article-method gnus-select-method))
6609 ;; Start the special refer-article method, if necessary.
6610 (when (and gnus-refer-article-method
6611 (gnus-news-group-p gnus-newsgroup-name))
6612 (gnus-check-server gnus-refer-article-method))
6613 ;; Fetch the header, and display the article.
6614 (if (setq number (gnus-summary-insert-subject message-id))
6615 (gnus-summary-select-article nil nil nil number)
6616 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6618 (defun gnus-summary-edit-parameters ()
6619 "Edit the group parameters of the current group."
6621 (gnus-group-edit-group gnus-newsgroup-name 'params))
6623 (defun gnus-summary-customize-parameters ()
6624 "Customize the group parameters of the current group."
6626 (gnus-group-customize gnus-newsgroup-name))
6628 (defun gnus-summary-enter-digest-group (&optional force)
6629 "Enter an nndoc group based on the current article.
6630 If FORCE, force a digest interpretation. If not, try
6631 to guess what the document format is."
6633 (let ((conf gnus-current-window-configuration))
6635 (gnus-summary-select-article))
6636 (setq gnus-current-window-configuration conf)
6637 (let* ((name (format "%s-%d"
6638 (gnus-group-prefixed-name
6639 gnus-newsgroup-name (list 'nndoc ""))
6641 (set-buffer gnus-summary-buffer)
6642 gnus-current-article)))
6643 (ogroup gnus-newsgroup-name)
6644 (params (append (gnus-info-params (gnus-get-info ogroup))
6645 (list (cons 'to-group ogroup))
6646 (list (cons 'save-article-group ogroup))))
6647 (case-fold-search t)
6648 (buf (current-buffer))
6651 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6652 (insert-buffer-substring gnus-original-article-buffer)
6653 ;; Remove lines that may lead nndoc to misinterpret the
6656 (goto-char (point-min))
6657 (or (search-forward "\n\n" nil t) (point)))
6658 (goto-char (point-min))
6659 (delete-matching-lines "^\\(Path\\):\\|^From ")
6662 (if (gnus-group-read-ephemeral-group
6663 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6665 ,(if force 'digest 'guess))) t)
6666 ;; Make all postings to this group go to the parent group.
6667 (nconc (gnus-info-params (gnus-get-info name))
6669 ;; Couldn't select this doc group.
6670 (switch-to-buffer buf)
6671 (gnus-set-global-variables)
6672 (gnus-configure-windows 'summary)
6673 (gnus-message 3 "Article couldn't be entered?"))
6674 (kill-buffer dig)))))
6676 (defun gnus-summary-read-document (n)
6677 "Open a new group based on the current article(s).
6678 This will allow you to read digests and other similar
6679 documents as newsgroups.
6680 Obeys the standard process/prefix convention."
6682 (let* ((articles (gnus-summary-work-articles n))
6683 (ogroup gnus-newsgroup-name)
6684 (params (append (gnus-info-params (gnus-get-info ogroup))
6685 (list (cons 'to-group ogroup))))
6686 article group egroup groups vgroup)
6687 (while (setq article (pop articles))
6688 (setq group (format "%s-%d" gnus-newsgroup-name article))
6689 (gnus-summary-remove-process-mark article)
6690 (when (gnus-summary-display-article article)
6693 (insert-buffer-substring gnus-original-article-buffer)
6694 ;; Remove some headers that may lead nndoc to make
6696 (message-narrow-to-head)
6697 (goto-char (point-min))
6698 (delete-matching-lines "^\\(Path\\):\\|^From ")
6701 (gnus-group-read-ephemeral-group
6702 group `(nndoc ,group (nndoc-address ,(current-buffer))
6703 (nndoc-article-type guess))
6706 ;; Make all postings to this group go to the parent group.
6707 (nconc (gnus-info-params (gnus-get-info egroup))
6709 (push egroup groups))
6710 ;; Couldn't select this doc group.
6711 (gnus-error 3 "Article couldn't be entered"))))))
6712 ;; Now we have selected all the documents.
6715 (error "None of the articles could be interpreted as documents"))
6716 ((gnus-group-read-ephemeral-group
6717 (setq vgroup (format
6718 "nnvirtual:%s-%s" gnus-newsgroup-name
6719 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6720 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6722 (cons (current-buffer) 'summary)))
6724 (error "Couldn't select virtual nndoc group")))))
6726 (defun gnus-summary-isearch-article (&optional regexp-p)
6727 "Do incremental search forward on the current article.
6728 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6730 (gnus-summary-select-article)
6731 (gnus-configure-windows 'article)
6732 (gnus-eval-in-buffer-window gnus-article-buffer
6735 (isearch-forward regexp-p))))
6737 (defun gnus-summary-search-article-forward (regexp &optional backward)
6738 "Search for an article containing REGEXP forward.
6739 If BACKWARD, search backward instead."
6742 (format "Search article %s (regexp%s): "
6743 (if current-prefix-arg "backward" "forward")
6744 (if gnus-last-search-regexp
6745 (concat ", default " gnus-last-search-regexp)
6747 current-prefix-arg))
6748 (if (string-equal regexp "")
6749 (setq regexp (or gnus-last-search-regexp ""))
6750 (setq gnus-last-search-regexp regexp))
6751 (if (gnus-summary-search-article regexp backward)
6752 (gnus-summary-show-thread)
6753 (error "Search failed: \"%s\"" regexp)))
6755 (defun gnus-summary-search-article-backward (regexp)
6756 "Search for an article containing REGEXP backward."
6759 (format "Search article backward (regexp%s): "
6760 (if gnus-last-search-regexp
6761 (concat ", default " gnus-last-search-regexp)
6763 (gnus-summary-search-article-forward regexp 'backward))
6765 (defun gnus-summary-search-article (regexp &optional backward)
6766 "Search for an article containing REGEXP.
6767 Optional argument BACKWARD means do search for backward.
6768 `gnus-select-article-hook' is not called during the search."
6769 ;; We have to require this here to make sure that the following
6770 ;; dynamic binding isn't shadowed by autoloading.
6771 (require 'gnus-async)
6773 (let ((gnus-select-article-hook nil) ;Disable hook.
6774 (gnus-article-display-hook nil)
6775 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6776 (gnus-use-article-prefetch nil)
6777 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6778 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6779 (sum (current-buffer))
6782 (gnus-save-hidden-threads
6783 (gnus-summary-select-article)
6784 (set-buffer gnus-article-buffer)
6788 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6790 (re-search-backward regexp nil t)
6791 (re-search-forward regexp nil t))
6792 ;; We found the regexp.
6797 (get-buffer-window (current-buffer))
6801 (setq point (point)))
6802 ;; We didn't find it, so we go to the next article.
6805 (while (eq found 'not)
6806 (if (not (if backward (gnus-summary-find-prev)
6807 (gnus-summary-find-next)))
6808 ;; No more articles.
6810 ;; Select the next article and adjust point.
6811 (unless (gnus-summary-article-sparse-p
6812 (gnus-summary-article-number))
6814 (gnus-summary-select-article)
6815 (set-buffer gnus-article-buffer)
6817 (goto-char (if backward (point-max) (point-min))))))))
6818 (gnus-message 7 ""))
6819 ;; Return whether we found the regexp.
6820 (when (eq found 'found)
6822 (gnus-summary-show-thread)
6823 (gnus-summary-goto-subject gnus-current-article)
6824 (gnus-summary-position-point)
6827 (defun gnus-summary-find-matching (header regexp &optional backward unread
6829 "Return a list of all articles that match REGEXP on HEADER.
6830 The search stars on the current article and goes forwards unless
6831 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6832 If UNREAD is non-nil, only unread articles will
6833 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6834 in the comparisons."
6835 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6836 (gnus-data-find-list
6837 (gnus-summary-article-number) (gnus-data-list backward))))
6838 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6839 (case-fold-search (not not-case-fold))
6841 (unless (fboundp (intern (concat "mail-header-" header)))
6842 (error "%s is not a valid header" header))
6845 (and (or (not unread) ; We want all articles...
6846 (gnus-data-unread-p d)) ; Or just unreads.
6847 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6848 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6849 (push (gnus-data-number d) articles)) ; Success!
6850 (setq data (cdr data)))
6851 (nreverse articles)))
6853 (defun gnus-summary-execute-command (header regexp command &optional backward)
6854 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6855 If HEADER is an empty string (or nil), the match is done on the entire
6856 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6858 (list (let ((completion-ignore-case t))
6861 (mapcar (lambda (string) (list string))
6862 '("Number" "Subject" "From" "Lines" "Date"
6863 "Message-ID" "Xref" "References" "Body"))
6864 nil 'require-match))
6865 (read-string "Regexp: ")
6866 (read-key-sequence "Command: ")
6867 current-prefix-arg))
6868 (when (equal header "Body")
6870 ;; Hidden thread subtrees must be searched as well.
6871 (gnus-summary-show-all-threads)
6872 ;; We don't want to change current point nor window configuration.
6874 (save-window-excursion
6875 (gnus-message 6 "Executing %s..." (key-description command))
6876 ;; We'd like to execute COMMAND interactively so as to give arguments.
6877 (gnus-execute header regexp
6878 `(call-interactively ',(key-binding command))
6880 (gnus-message 6 "Executing %s...done" (key-description command)))))
6882 (defun gnus-summary-beginning-of-article ()
6883 "Scroll the article back to the beginning."
6885 (gnus-summary-select-article)
6886 (gnus-configure-windows 'article)
6887 (gnus-eval-in-buffer-window gnus-article-buffer
6889 (goto-char (point-min))
6890 (when gnus-page-broken
6891 (gnus-narrow-to-page))))
6893 (defun gnus-summary-end-of-article ()
6894 "Scroll to the end of the article."
6896 (gnus-summary-select-article)
6897 (gnus-configure-windows 'article)
6898 (gnus-eval-in-buffer-window gnus-article-buffer
6900 (goto-char (point-max))
6902 (when gnus-page-broken
6903 (gnus-narrow-to-page))))
6905 (defun gnus-summary-print-article (&optional filename n)
6906 "Generate and print a PostScript image of the N next (mail) articles.
6908 If N is negative, print the N previous articles. If N is nil and articles
6909 have been marked with the process mark, print these instead.
6911 If the optional second argument FILENAME is nil, send the image to the
6912 printer. If FILENAME is a string, save the PostScript image in a file with
6913 that name. If FILENAME is a number, prompt the user for the name of the file
6915 (interactive (list (ps-print-preprint current-prefix-arg)
6916 current-prefix-arg))
6917 (dolist (article (gnus-summary-work-articles n))
6918 (gnus-summary-select-article nil nil 'pseudo article)
6919 (gnus-eval-in-buffer-window gnus-article-buffer
6920 (let ((buffer (generate-new-buffer " *print*")))
6923 (copy-to-buffer buffer (point-min) (point-max))
6925 (gnus-article-delete-invisible-text)
6926 (let ((ps-left-header
6929 (mail-header-subject gnus-current-headers) ")")
6931 (mail-header-from gnus-current-headers) ")")))
6934 "/pagenumberstring load"
6936 (mail-header-date gnus-current-headers) ")"))))
6937 (gnus-run-hooks 'gnus-ps-print-hook)
6939 (ps-print-buffer-with-faces filename))))
6940 (kill-buffer buffer))))))
6942 (defun gnus-summary-show-article (&optional arg)
6943 "Force re-fetching of the current article.
6944 If ARG (the prefix) is non-nil, show the raw article without any
6945 article massaging functions being run."
6948 ;; Select the article the normal way.
6949 (gnus-summary-select-article nil 'force)
6950 ;; We have to require this here to make sure that the following
6951 ;; dynamic binding isn't shadowed by autoloading.
6952 (require 'gnus-async)
6954 ;; Bind the article treatment functions to nil.
6955 (let ((gnus-have-all-headers t)
6956 gnus-article-display-hook
6957 gnus-article-prepare-hook
6958 gnus-article-decode-hook
6962 (gnus-summary-select-article nil 'force)))
6963 (gnus-summary-goto-subject gnus-current-article)
6964 (gnus-summary-position-point))
6966 (defun gnus-summary-verbose-headers (&optional arg)
6967 "Toggle permanent full header display.
6968 If ARG is a positive number, turn header display on.
6969 If ARG is a negative number, turn header display off."
6971 (setq gnus-show-all-headers
6972 (cond ((or (not (numberp arg))
6974 (not gnus-show-all-headers))
6977 (gnus-summary-show-article))
6979 (defun gnus-summary-toggle-header (&optional arg)
6980 "Show the headers if they are hidden, or hide them if they are shown.
6981 If ARG is a positive number, show the entire header.
6982 If ARG is a negative number, hide the unwanted header lines."
6985 (set-buffer gnus-article-buffer)
6986 (let* ((buffer-read-only nil)
6987 (inhibit-point-motion-hooks t)
6988 (hidden (text-property-any
6989 (goto-char (point-min)) (search-forward "\n\n")
6992 (goto-char (point-min))
6993 (when (search-forward "\n\n" nil t)
6994 (delete-region (point-min) (1- (point))))
6995 (goto-char (point-min))
6997 (set-buffer gnus-original-article-buffer)
6998 (goto-char (point-min))
6999 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7000 (insert-buffer-substring gnus-original-article-buffer 1 e)
7001 (let ((article-inhibit-hiding t))
7002 (gnus-run-hooks 'gnus-article-display-hook))
7003 (when (or (not hidden) (and (numberp arg) (< arg 0)))
7004 (gnus-article-hide-headers)))))
7006 (defun gnus-summary-show-all-headers ()
7007 "Make all header lines visible."
7009 (gnus-article-show-all-headers))
7011 (defun gnus-summary-toggle-mime (&optional arg)
7012 "Toggle MIME processing.
7013 If ARG is a positive number, turn MIME processing on."
7015 (setq gnus-show-mime
7016 (if (null arg) (not gnus-show-mime)
7017 (> (prefix-numeric-value arg) 0)))
7018 (gnus-summary-select-article t 'force))
7020 (defun gnus-summary-caesar-message (&optional arg)
7021 "Caesar rotate the current article by 13.
7022 The numerical prefix specifies how many places to rotate each letter
7025 (gnus-summary-select-article)
7026 (let ((mail-header-separator ""))
7027 (gnus-eval-in-buffer-window gnus-article-buffer
7030 (let ((start (window-start))
7032 (message-caesar-buffer-body arg)
7033 (set-window-start (get-buffer-window (current-buffer)) start))))))
7035 (defun gnus-summary-stop-page-breaking ()
7036 "Stop page breaking in the current article."
7038 (gnus-summary-select-article)
7039 (gnus-eval-in-buffer-window gnus-article-buffer
7041 (when (gnus-visual-p 'page-marker)
7042 (let ((buffer-read-only nil))
7043 (gnus-remove-text-with-property 'gnus-prev)
7044 (gnus-remove-text-with-property 'gnus-next))
7045 (setq gnus-page-broken nil))))
7047 (defun gnus-summary-move-article (&optional n to-newsgroup
7048 select-method action)
7049 "Move the current article to a different newsgroup.
7050 If N is a positive number, move the N next articles.
7051 If N is a negative number, move the N previous articles.
7052 If N is nil and any articles have been marked with the process mark,
7053 move those articles instead.
7054 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7055 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7056 re-spool using this method.
7058 For this function to work, both the current newsgroup and the
7059 newsgroup that you want to move to have to support the `request-move'
7060 and `request-accept' functions."
7063 (setq action 'move))
7064 ;; Disable marking as read.
7065 (let (gnus-mark-article-hook)
7066 (save-window-excursion
7067 (gnus-summary-select-article)))
7068 ;; Check whether the source group supports the required functions.
7069 (cond ((and (eq action 'move)
7070 (not (gnus-check-backend-function
7071 'request-move-article gnus-newsgroup-name)))
7072 (error "The current group does not support article moving"))
7073 ((and (eq action 'crosspost)
7074 (not (gnus-check-backend-function
7075 'request-replace-article gnus-newsgroup-name)))
7076 (error "The current group does not support article editing")))
7077 (let ((articles (gnus-summary-work-articles n))
7078 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7079 (names '((move "Move" "Moving")
7080 (copy "Copy" "Copying")
7081 (crosspost "Crosspost" "Crossposting")))
7082 (copy-buf (save-excursion
7083 (nnheader-set-temp-buffer " *copy article*")))
7084 art-group to-method new-xref article to-groups)
7085 (unless (assq action names)
7086 (error "Unknown action %s" action))
7087 ;; Read the newsgroup name.
7088 (when (and (not to-newsgroup)
7089 (not select-method))
7091 (gnus-read-move-group-name
7092 (cadr (assq action names))
7093 (symbol-value (intern (format "gnus-current-%s-group" action)))
7095 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7096 (setq to-method (or select-method
7097 (gnus-group-name-to-method to-newsgroup)))
7098 ;; Check the method we are to move this article to...
7099 (unless (gnus-check-backend-function
7100 'request-accept-article (car to-method))
7101 (error "%s does not support article copying" (car to-method)))
7102 (unless (gnus-check-server to-method)
7103 (error "Can't open server %s" (car to-method)))
7104 (gnus-message 6 "%s to %s: %s..."
7105 (caddr (assq action names))
7106 (or (car select-method) to-newsgroup) articles)
7108 (setq article (pop articles))
7112 ;; Move the article.
7114 ;; Remove this article from future suppression.
7115 (gnus-dup-unsuppress-article article)
7116 (gnus-request-move-article
7117 article ; Article to move
7118 gnus-newsgroup-name ; From newsgroup
7119 (nth 1 (gnus-find-method-for-group
7120 gnus-newsgroup-name)) ; Server
7121 (list 'gnus-request-accept-article
7122 to-newsgroup (list 'quote select-method)
7123 (not articles) t) ; Accept form
7124 (not articles))) ; Only save nov last time
7125 ;; Copy the article.
7128 (set-buffer copy-buf)
7129 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7130 (gnus-request-accept-article
7131 to-newsgroup select-method (not articles) t))))
7132 ;; Crosspost the article.
7133 ((eq action 'crosspost)
7134 (let ((xref (message-tokenize-header
7135 (mail-header-xref (gnus-summary-article-header article))
7137 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7140 (setq xref (list (system-name))))
7143 (mapconcat 'identity
7144 (delete "Xref:" (delete new-xref xref))
7148 (set-buffer copy-buf)
7149 ;; First put the article in the destination group.
7150 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7151 (when (consp (setq art-group
7152 (gnus-request-accept-article
7153 to-newsgroup select-method (not articles))))
7154 (setq new-xref (concat new-xref " " (car art-group)
7155 ":" (cdr art-group)))
7156 ;; Now we have the new Xrefs header, so we insert
7157 ;; it and replace the new article.
7158 (nnheader-replace-header "Xref" new-xref)
7159 (gnus-request-replace-article
7160 (cdr art-group) to-newsgroup (current-buffer))
7164 (gnus-message 1 "Couldn't %s article %s"
7165 (cadr (assq action names)) article))
7166 ((and (eq art-group 'junk)
7168 (gnus-summary-mark-article article gnus-canceled-mark)
7169 (gnus-message 4 "Deleted article %s" article))
7171 (let* ((pto-group (gnus-group-prefixed-name
7172 (car art-group) to-method))
7174 (gnus-gethash pto-group gnus-newsrc-hashtb))
7175 (info (nth 2 entry))
7176 (to-group (gnus-info-group info)))
7177 ;; Update the group that has been moved to.
7179 (memq action '(move copy)))
7180 (unless (member to-group to-groups)
7181 (push to-group to-groups))
7183 (unless (memq article gnus-newsgroup-unreads)
7185 info (gnus-add-to-range (gnus-info-read info)
7186 (list (cdr art-group)))))
7188 ;; Copy any marks over to the new group.
7189 (let ((marks gnus-article-mark-lists)
7190 (to-article (cdr art-group)))
7192 ;; See whether the article is to be put in the cache.
7193 (when gnus-use-cache
7194 (gnus-cache-possibly-enter-article
7196 (let ((header (copy-sequence
7197 (gnus-summary-article-header article))))
7198 (mail-header-set-number header to-article)
7200 (memq article gnus-newsgroup-marked)
7201 (memq article gnus-newsgroup-dormant)
7202 (memq article gnus-newsgroup-unreads)))
7204 (when (and (equal to-group gnus-newsgroup-name)
7205 (not (memq article gnus-newsgroup-unreads)))
7206 ;; Mark this article as read in this group.
7207 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7208 (setcdr (gnus-active to-group) to-article)
7209 (setcdr gnus-newsgroup-active to-article))
7212 (when (memq article (symbol-value
7213 (intern (format "gnus-newsgroup-%s"
7215 ;; If the other group is the same as this group,
7216 ;; then we have to add the mark to the list.
7217 (when (equal to-group gnus-newsgroup-name)
7218 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7221 (intern (format "gnus-newsgroup-%s"
7223 ;; Copy the marks to other group.
7224 (gnus-add-marked-articles
7225 to-group (cdar marks) (list to-article) info))
7226 (setq marks (cdr marks)))
7229 (concat "(gnus-group-set-info '"
7230 (gnus-prin1-to-string (gnus-get-info to-group))
7233 ;; Update the Xref header in this article to point to
7234 ;; the new crossposted article we have just created.
7235 (when (eq action 'crosspost)
7237 (set-buffer copy-buf)
7238 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7239 (nnheader-replace-header "Xref" new-xref)
7240 (gnus-request-replace-article
7241 article gnus-newsgroup-name (current-buffer)))))
7243 ;;;!!!Why is this necessary?
7244 (set-buffer gnus-summary-buffer)
7246 (gnus-summary-goto-subject article)
7247 (when (eq action 'move)
7248 (gnus-summary-mark-article article gnus-canceled-mark))))
7249 (gnus-summary-remove-process-mark article))
7250 ;; Re-activate all groups that have been moved to.
7253 (set-buffer gnus-group-buffer)
7254 (when (gnus-group-goto-group (car to-groups) t)
7255 (gnus-group-get-new-news-this-group 1 t))
7258 (gnus-kill-buffer copy-buf)
7259 (gnus-summary-position-point)
7260 (gnus-set-mode-line 'summary)))
7262 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7263 "Move the current article to a different newsgroup.
7264 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7265 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7266 re-spool using this method."
7268 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7270 (defun gnus-summary-crosspost-article (&optional n)
7271 "Crosspost the current article to some other group."
7273 (gnus-summary-move-article n nil nil 'crosspost))
7275 (defcustom gnus-summary-respool-default-method nil
7276 "Default method for respooling an article.
7277 If nil, use to the current newsgroup method."
7278 :type '(choice (gnus-select-method :value (nnml ""))
7280 :group 'gnus-summary-mail)
7282 (defun gnus-summary-respool-article (&optional n method)
7283 "Respool the current article.
7284 The article will be squeezed through the mail spooling process again,
7285 which means that it will be put in some mail newsgroup or other
7286 depending on `nnmail-split-methods'.
7287 If N is a positive number, respool the N next articles.
7288 If N is a negative number, respool the N previous articles.
7289 If N is nil and any articles have been marked with the process mark,
7290 respool those articles instead.
7292 Respooling can be done both from mail groups and \"real\" newsgroups.
7293 In the former case, the articles in question will be moved from the
7294 current group into whatever groups they are destined to. In the
7295 latter case, they will be copied into the relevant groups."
7297 (list current-prefix-arg
7298 (let* ((methods (gnus-methods-using 'respool))
7300 (symbol-name (or gnus-summary-respool-default-method
7301 (car (gnus-find-method-for-group
7302 gnus-newsgroup-name)))))
7304 (gnus-completing-read
7305 methname "What backend do you want to use when respooling?"
7306 methods nil t nil 'gnus-mail-method-history))
7309 ((zerop (length (setq ms (gnus-servers-using-backend
7311 (list (intern method) ""))
7315 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7316 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7319 (error "No method given for respooling"))
7320 (if (assoc (symbol-name
7321 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7322 (gnus-methods-using 'respool))
7323 (gnus-summary-move-article n nil method)
7324 (gnus-summary-copy-article n nil method)))
7326 (defun gnus-summary-import-article (file)
7327 "Import an arbitrary file into a mail newsgroup."
7328 (interactive "fImport file: ")
7329 (let ((group gnus-newsgroup-name)
7330 (now (current-time))
7332 (unless (gnus-check-backend-function 'request-accept-article group)
7333 (error "%s does not support article importing" group))
7334 (or (file-readable-p file)
7335 (not (file-regular-p file))
7336 (error "Can't read %s" file))
7338 (set-buffer (gnus-get-buffer-create " *import file*"))
7340 (nnheader-insert-file-contents file)
7341 (goto-char (point-min))
7342 (unless (nnheader-article-p)
7343 ;; This doesn't look like an article, so we fudge some headers.
7344 (setq atts (file-attributes file)
7345 lines (count-lines (point-min) (point-max)))
7346 (insert "From: " (read-string "From: ") "\n"
7347 "Subject: " (read-string "Subject: ") "\n"
7348 "Date: " (message-make-date (nth 5 atts))
7350 "Message-ID: " (message-make-message-id) "\n"
7351 "Lines: " (int-to-string lines) "\n"
7352 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7353 (gnus-request-accept-article group nil t)
7354 (kill-buffer (current-buffer)))))
7356 (defun gnus-summary-article-posted-p ()
7357 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7358 This will be the case if the article has both been mailed and posted."
7360 (let ((id (mail-header-references (gnus-summary-article-header)))
7361 (gnus-override-method
7362 (or gnus-refer-article-method gnus-select-method)))
7363 (if (gnus-request-head id "")
7364 (gnus-message 2 "The current message was found on %s"
7365 gnus-override-method)
7366 (gnus-message 2 "The current message couldn't be found on %s"
7367 gnus-override-method)
7370 (defun gnus-summary-expire-articles (&optional now)
7371 "Expire all articles that are marked as expirable in the current group."
7373 (when (gnus-check-backend-function
7374 'request-expire-articles gnus-newsgroup-name)
7375 ;; This backend supports expiry.
7376 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7377 (expirable (if total
7379 ;; We need to update the info for
7380 ;; this group for `gnus-list-of-read-articles'
7381 ;; to give us the right answer.
7382 (gnus-run-hooks 'gnus-exit-group-hook)
7383 (gnus-summary-update-info)
7384 (gnus-list-of-read-articles gnus-newsgroup-name))
7385 (setq gnus-newsgroup-expirable
7386 (sort gnus-newsgroup-expirable '<))))
7387 (expiry-wait (if now 'immediate
7388 (gnus-group-find-parameter
7389 gnus-newsgroup-name 'expiry-wait)))
7392 ;; There are expirable articles in this group, so we run them
7393 ;; through the expiry process.
7394 (gnus-message 6 "Expiring articles...")
7395 ;; The list of articles that weren't expired is returned.
7398 (let ((nnmail-expiry-wait-function nil)
7399 (nnmail-expiry-wait expiry-wait))
7400 (setq es (gnus-request-expire-articles
7401 expirable gnus-newsgroup-name)))
7402 (setq es (gnus-request-expire-articles
7403 expirable gnus-newsgroup-name))))
7405 (setq gnus-newsgroup-expirable es))
7406 ;; We go through the old list of expirable, and mark all
7407 ;; really expired articles as nonexistent.
7408 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7409 (let ((gnus-use-cache nil))
7411 (unless (memq (car expirable) es)
7412 (when (gnus-data-find (car expirable))
7413 (gnus-summary-mark-article
7414 (car expirable) gnus-canceled-mark)))
7415 (setq expirable (cdr expirable)))))
7416 (gnus-message 6 "Expiring articles...done")))))
7418 (defun gnus-summary-expire-articles-now ()
7419 "Expunge all expirable articles in the current group.
7420 This means that *all* articles that are marked as expirable will be
7421 deleted forever, right now."
7423 (or gnus-expert-user
7425 "Are you really, really, really sure you want to delete all these messages? ")
7427 (gnus-summary-expire-articles t))
7429 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7430 (defun gnus-summary-delete-article (&optional n)
7431 "Delete the N next (mail) articles.
7432 This command actually deletes articles. This is not a marking
7433 command. The article will disappear forever from your life, never to
7435 If N is negative, delete backwards.
7436 If N is nil and articles have been marked with the process mark,
7437 delete these instead."
7439 (unless (gnus-check-backend-function 'request-expire-articles
7440 gnus-newsgroup-name)
7441 (error "The current newsgroup does not support article deletion"))
7442 ;; Compute the list of articles to delete.
7443 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7445 (if (and gnus-novice-user
7446 (not (gnus-yes-or-no-p
7447 (format "Do you really want to delete %s forever? "
7448 (if (> (length articles) 1)
7449 (format "these %s articles" (length articles))
7452 ;; Delete the articles.
7453 (setq not-deleted (gnus-request-expire-articles
7454 articles gnus-newsgroup-name 'force))
7456 (gnus-summary-remove-process-mark (car articles))
7457 ;; The backend might not have been able to delete the article
7459 (unless (memq (car articles) not-deleted)
7460 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7461 (setq articles (cdr articles)))
7463 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7464 (gnus-summary-position-point)
7465 (gnus-set-mode-line 'summary)
7468 (defun gnus-summary-edit-article (&optional force)
7469 "Edit the current article.
7470 This will have permanent effect only in mail groups.
7471 If FORCE is non-nil, allow editing of articles even in read-only
7475 (set-buffer gnus-summary-buffer)
7476 (gnus-set-global-variables)
7477 (when (and (not force)
7478 (gnus-group-read-only-p))
7479 (error "The current newsgroup does not support article editing"))
7480 ;; Select article if needed.
7481 (unless (eq (gnus-summary-article-number)
7482 gnus-current-article)
7483 (gnus-summary-select-article t))
7484 (gnus-article-date-original)
7485 (gnus-article-edit-article
7486 `(lambda (no-highlight)
7487 (gnus-summary-edit-article-done
7488 ,(or (mail-header-references gnus-current-headers) "")
7489 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7491 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7493 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7495 "Make edits to the current article permanent."
7497 ;; Replace the article.
7498 (let ((buf (current-buffer)))
7501 (if (and (not read-only)
7502 (not (gnus-request-replace-article
7503 (cdr gnus-article-current) (car gnus-article-current)
7505 (error "Couldn't replace article")
7506 ;; Update the summary buffer.
7508 (equal (message-tokenize-header references " ")
7509 (message-tokenize-header
7510 (or (message-fetch-field "references") "") " ")))
7511 ;; We only have to update this line.
7514 (message-narrow-to-head)
7515 (let ((head (buffer-string))
7518 (insert (format "211 %d Article retrieved.\n"
7519 (cdr gnus-article-current)))
7522 (let ((nntp-server-buffer (current-buffer)))
7523 (setq header (car (gnus-get-newsgroup-headers
7525 (set-buffer gnus-summary-buffer)
7526 gnus-newsgroup-dependencies)
7529 (set-buffer gnus-summary-buffer)
7530 (gnus-data-set-header
7531 (gnus-data-find (cdr gnus-article-current))
7533 (gnus-summary-update-article-line
7534 (cdr gnus-article-current) header))))))
7536 (set-buffer (or buffer gnus-summary-buffer))
7537 (gnus-summary-update-article (cdr gnus-article-current)))
7538 ;; Prettify the article buffer again.
7539 (unless no-highlight
7541 (set-buffer gnus-article-buffer)
7542 (gnus-run-hooks 'gnus-article-display-hook)
7543 (set-buffer gnus-original-article-buffer)
7544 (gnus-request-article
7545 (cdr gnus-article-current)
7546 (car gnus-article-current) (current-buffer))))
7547 ;; Prettify the summary buffer line.
7548 (when (gnus-visual-p 'summary-highlight 'highlight)
7549 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7551 (defun gnus-summary-edit-wash (key)
7552 "Perform editing command KEY in the article buffer."
7556 (message "%s" (concat (this-command-keys) "- "))
7559 (gnus-summary-edit-article)
7560 (execute-kbd-macro (concat (this-command-keys) key))
7561 (gnus-article-edit-done))
7565 (defun gnus-summary-respool-query (&optional silent trace)
7566 "Query where the respool algorithm would put this article."
7568 (let (gnus-mark-article-hook)
7569 (gnus-summary-select-article)
7571 (set-buffer gnus-original-article-buffer)
7573 (message-narrow-to-head)
7574 (let ((groups (nnmail-article-group 'identity trace)))
7577 (message "This message would go to %s"
7578 (mapconcat 'car groups ", "))
7579 (message "This message would go to no groups"))
7582 (defun gnus-summary-respool-trace ()
7583 "Trace where the respool algorithm would put this article.
7584 Display a buffer showing all fancy splitting patterns which matched."
7586 (gnus-summary-respool-query nil t))
7588 ;; Summary marking commands.
7590 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7591 "Mark articles which has the same subject as read, and then select the next.
7592 If UNMARK is positive, remove any kind of mark.
7593 If UNMARK is negative, tick articles."
7596 (setq unmark (prefix-numeric-value unmark)))
7598 (gnus-summary-mark-same-subject
7599 (gnus-summary-article-subject) unmark)))
7600 ;; Select next unread article. If auto-select-same mode, should
7601 ;; select the first unread article.
7602 (gnus-summary-next-article t (and gnus-auto-select-same
7603 (gnus-summary-article-subject)))
7604 (gnus-message 7 "%d article%s marked as %s"
7605 count (if (= count 1) " is" "s are")
7606 (if unmark "unread" "read"))))
7608 (defun gnus-summary-kill-same-subject (&optional unmark)
7609 "Mark articles which has the same subject as read.
7610 If UNMARK is positive, remove any kind of mark.
7611 If UNMARK is negative, tick articles."
7614 (setq unmark (prefix-numeric-value unmark)))
7616 (gnus-summary-mark-same-subject
7617 (gnus-summary-article-subject) unmark)))
7618 ;; If marked as read, go to next unread subject.
7620 ;; Go to next unread subject.
7621 (gnus-summary-next-subject 1 t))
7622 (gnus-message 7 "%d articles are marked as %s"
7623 count (if unmark "unread" "read"))))
7625 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7626 "Mark articles with same SUBJECT as read, and return marked number.
7627 If optional argument UNMARK is positive, remove any kinds of marks.
7628 If optional argument UNMARK is negative, mark articles as unread instead."
7632 ((null unmark) ; Mark as read.
7635 (gnus-summary-mark-article-as-read gnus-killed-mark)
7636 (gnus-summary-show-thread) t)
7637 (gnus-summary-find-subject subject))
7638 (setq count (1+ count))))
7639 ((> unmark 0) ; Tick.
7642 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7643 (gnus-summary-show-thread) t)
7644 (gnus-summary-find-subject subject))
7645 (setq count (1+ count))))
7646 (t ; Mark as unread.
7649 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7650 (gnus-summary-show-thread) t)
7651 (gnus-summary-find-subject subject))
7652 (setq count (1+ count)))))
7653 (gnus-set-mode-line 'summary)
7654 ;; Return the number of marked articles.
7657 (defun gnus-summary-mark-as-processable (n &optional unmark)
7658 "Set the process mark on the next N articles.
7659 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7660 the process mark instead. The difference between N and the actual
7661 number of articles marked is returned."
7663 (let ((backward (< n 0))
7668 (gnus-summary-remove-process-mark
7669 (gnus-summary-article-number))
7670 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7671 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7674 (gnus-message 7 "No more articles"))
7675 (gnus-summary-recenter)
7676 (gnus-summary-position-point)
7679 (defun gnus-summary-unmark-as-processable (n)
7680 "Remove the process mark from the next N articles.
7681 If N is negative, unmark backward instead. The difference between N and
7682 the actual number of articles unmarked is returned."
7684 (gnus-summary-mark-as-processable n t))
7686 (defun gnus-summary-unmark-all-processable ()
7687 "Remove the process mark from all articles."
7690 (while gnus-newsgroup-processable
7691 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7692 (gnus-summary-position-point))
7694 (defun gnus-summary-mark-as-expirable (n)
7695 "Mark N articles forward as expirable.
7696 If N is negative, mark backward instead. The difference between N and
7697 the actual number of articles marked is returned."
7699 (gnus-summary-mark-forward n gnus-expirable-mark))
7701 (defun gnus-summary-mark-article-as-replied (article)
7702 "Mark ARTICLE replied and update the summary line."
7703 (push article gnus-newsgroup-replied)
7704 (let ((buffer-read-only nil))
7705 (when (gnus-summary-goto-subject article nil t)
7706 (gnus-summary-update-secondary-mark article))))
7708 (defun gnus-summary-set-bookmark (article)
7709 "Set a bookmark in current article."
7710 (interactive (list (gnus-summary-article-number)))
7711 (when (or (not (get-buffer gnus-article-buffer))
7712 (not gnus-current-article)
7713 (not gnus-article-current)
7714 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7715 (error "No current article selected"))
7716 ;; Remove old bookmark, if one exists.
7717 (let ((old (assq article gnus-newsgroup-bookmarks)))
7719 (setq gnus-newsgroup-bookmarks
7720 (delq old gnus-newsgroup-bookmarks))))
7721 ;; Set the new bookmark, which is on the form
7722 ;; (article-number . line-number-in-body).
7726 (set-buffer gnus-article-buffer)
7730 (goto-char (point-min))
7731 (search-forward "\n\n" nil t)
7734 gnus-newsgroup-bookmarks)
7735 (gnus-message 6 "A bookmark has been added to the current article."))
7737 (defun gnus-summary-remove-bookmark (article)
7738 "Remove the bookmark from the current article."
7739 (interactive (list (gnus-summary-article-number)))
7740 ;; Remove old bookmark, if one exists.
7741 (let ((old (assq article gnus-newsgroup-bookmarks)))
7744 (setq gnus-newsgroup-bookmarks
7745 (delq old gnus-newsgroup-bookmarks))
7746 (gnus-message 6 "Removed bookmark."))
7747 (gnus-message 6 "No bookmark in current article."))))
7749 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7750 (defun gnus-summary-mark-as-dormant (n)
7751 "Mark N articles forward as dormant.
7752 If N is negative, mark backward instead. The difference between N and
7753 the actual number of articles marked is returned."
7755 (gnus-summary-mark-forward n gnus-dormant-mark))
7757 (defun gnus-summary-set-process-mark (article)
7758 "Set the process mark on ARTICLE and update the summary line."
7759 (setq gnus-newsgroup-processable
7761 (delq article gnus-newsgroup-processable)))
7762 (when (gnus-summary-goto-subject article)
7763 (gnus-summary-show-thread)
7764 (gnus-summary-goto-subject article)
7765 (gnus-summary-update-secondary-mark article)))
7767 (defun gnus-summary-remove-process-mark (article)
7768 "Remove the process mark from ARTICLE and update the summary line."
7769 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7770 (when (gnus-summary-goto-subject article)
7771 (gnus-summary-show-thread)
7772 (gnus-summary-goto-subject article)
7773 (gnus-summary-update-secondary-mark article)))
7775 (defun gnus-summary-set-saved-mark (article)
7776 "Set the process mark on ARTICLE and update the summary line."
7777 (push article gnus-newsgroup-saved)
7778 (when (gnus-summary-goto-subject article)
7779 (gnus-summary-update-secondary-mark article)))
7781 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7782 "Mark N articles as read forwards.
7783 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7784 The difference between N and the actual number of articles marked is
7787 (gnus-summary-show-thread)
7788 (let ((backward (< n 0))
7789 (gnus-summary-goto-unread
7790 (and gnus-summary-goto-unread
7791 (not (eq gnus-summary-goto-unread 'never))
7792 (not (memq mark (list gnus-unread-mark
7793 gnus-ticked-mark gnus-dormant-mark)))))
7795 (mark (or mark gnus-del-mark)))
7797 (gnus-summary-mark-article nil mark no-expire)
7798 (zerop (gnus-summary-next-subject
7800 (and gnus-summary-goto-unread
7801 (not (eq gnus-summary-goto-unread 'never)))
7805 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7806 (gnus-summary-recenter)
7807 (gnus-summary-position-point)
7808 (gnus-set-mode-line 'summary)
7811 (defun gnus-summary-mark-article-as-read (mark)
7812 "Mark the current article quickly as read with MARK."
7813 (let ((article (gnus-summary-article-number)))
7814 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7815 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7816 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7817 (push (cons article mark) gnus-newsgroup-reads)
7818 ;; Possibly remove from cache, if that is used.
7819 (when gnus-use-cache
7820 (gnus-cache-enter-remove-article article))
7821 ;; Allow the backend to change the mark.
7822 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7823 ;; Check for auto-expiry.
7824 (when (and gnus-newsgroup-auto-expire
7825 (memq mark gnus-auto-expirable-marks))
7826 (setq mark gnus-expirable-mark)
7827 ;; Let the backend know about the mark change.
7828 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7829 (push article gnus-newsgroup-expirable))
7830 ;; Set the mark in the buffer.
7831 (gnus-summary-update-mark mark 'unread)
7834 (defun gnus-summary-mark-article-as-unread (mark)
7835 "Mark the current article quickly as unread with MARK."
7836 (let* ((article (gnus-summary-article-number))
7837 (old-mark (gnus-summary-article-mark article)))
7838 ;; Allow the backend to change the mark.
7839 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7840 (if (eq mark old-mark)
7844 (gnus-error 1 "Can't mark negative article numbers")
7846 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7847 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7848 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7849 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7850 (cond ((= mark gnus-ticked-mark)
7851 (push article gnus-newsgroup-marked))
7852 ((= mark gnus-dormant-mark)
7853 (push article gnus-newsgroup-dormant))
7855 (push article gnus-newsgroup-unreads)))
7856 (gnus-pull article gnus-newsgroup-reads)
7858 ;; See whether the article is to be put in the cache.
7860 (vectorp (gnus-summary-article-header article))
7862 (gnus-cache-possibly-enter-article
7863 gnus-newsgroup-name article
7864 (gnus-summary-article-header article)
7865 (= mark gnus-ticked-mark)
7866 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7869 (gnus-summary-update-mark mark 'unread)
7872 (defun gnus-summary-mark-article (&optional article mark no-expire)
7873 "Mark ARTICLE with MARK. MARK can be any character.
7874 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7875 `??' (dormant) and `?E' (expirable).
7876 If MARK is nil, then the default character `?r' is used.
7877 If ARTICLE is nil, then the article on the current line will be
7879 ;; The mark might be a string.
7880 (when (stringp mark)
7881 (setq mark (aref mark 0)))
7882 ;; If no mark is given, then we check auto-expiring.
7884 (setq mark gnus-del-mark))
7885 (when (and (not no-expire)
7886 gnus-newsgroup-auto-expire
7887 (memq mark gnus-auto-expirable-marks))
7888 (setq mark gnus-expirable-mark))
7889 (let ((article (or article (gnus-summary-article-number)))
7890 (old-mark (gnus-summary-article-mark article)))
7891 ;; Allow the backend to change the mark.
7892 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7893 (if (eq mark old-mark)
7896 (error "No article on current line"))
7897 (if (not (if (or (= mark gnus-unread-mark)
7898 (= mark gnus-ticked-mark)
7899 (= mark gnus-dormant-mark))
7900 (gnus-mark-article-as-unread article mark)
7901 (gnus-mark-article-as-read article mark)))
7903 ;; See whether the article is to be put in the cache.
7905 (not (= mark gnus-canceled-mark))
7906 (vectorp (gnus-summary-article-header article))
7908 (gnus-cache-possibly-enter-article
7909 gnus-newsgroup-name article
7910 (gnus-summary-article-header article)
7911 (= mark gnus-ticked-mark)
7912 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7914 (when (gnus-summary-goto-subject article nil t)
7915 (let ((buffer-read-only nil))
7916 (gnus-summary-show-thread)
7918 (gnus-summary-update-mark mark 'unread)
7921 (defun gnus-summary-update-secondary-mark (article)
7922 "Update the secondary (read, process, cache) mark."
7923 (gnus-summary-update-mark
7924 (cond ((memq article gnus-newsgroup-processable)
7926 ((memq article gnus-newsgroup-cached)
7928 ((memq article gnus-newsgroup-replied)
7930 ((memq article gnus-newsgroup-saved)
7932 (t gnus-unread-mark))
7934 (when (gnus-visual-p 'summary-highlight 'highlight)
7935 (gnus-run-hooks 'gnus-summary-update-hook))
7938 (defun gnus-summary-update-mark (mark type)
7939 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7940 (buffer-read-only nil))
7941 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7943 (when (looking-at "\r")
7945 (when (<= (+ forward (point)) (point-max))
7946 ;; Go to the right position on the line.
7947 (goto-char (+ forward (point)))
7948 ;; Replace the old mark with the new mark.
7949 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7950 ;; Optionally update the marks by some user rule.
7951 (when (eq type 'unread)
7953 (gnus-data-find (gnus-summary-article-number)) mark)
7954 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7956 (defun gnus-mark-article-as-read (article &optional mark)
7957 "Enter ARTICLE in the pertinent lists and remove it from others."
7958 ;; Make the article expirable.
7959 (let ((mark (or mark gnus-del-mark)))
7960 (if (= mark gnus-expirable-mark)
7961 (push article gnus-newsgroup-expirable)
7962 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7963 ;; Remove from unread and marked lists.
7964 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7965 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7966 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7967 (push (cons article mark) gnus-newsgroup-reads)
7968 ;; Possibly remove from cache, if that is used.
7969 (when gnus-use-cache
7970 (gnus-cache-enter-remove-article article))
7973 (defun gnus-mark-article-as-unread (article &optional mark)
7974 "Enter ARTICLE in the pertinent lists and remove it from others."
7975 (let ((mark (or mark gnus-ticked-mark)))
7978 (gnus-error 1 "Can't mark negative article numbers")
7980 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7981 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7982 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7983 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7985 ;; Unsuppress duplicates?
7986 (when gnus-suppress-duplicates
7987 (gnus-dup-unsuppress-article article))
7989 (cond ((= mark gnus-ticked-mark)
7990 (push article gnus-newsgroup-marked))
7991 ((= mark gnus-dormant-mark)
7992 (push article gnus-newsgroup-dormant))
7994 (push article gnus-newsgroup-unreads)))
7995 (gnus-pull article gnus-newsgroup-reads)
7998 (defalias 'gnus-summary-mark-as-unread-forward
7999 'gnus-summary-tick-article-forward)
8000 (make-obsolete 'gnus-summary-mark-as-unread-forward
8001 'gnus-summary-tick-article-forward)
8002 (defun gnus-summary-tick-article-forward (n)
8003 "Tick N articles forwards.
8004 If N is negative, tick backwards instead.
8005 The difference between N and the number of articles ticked is returned."
8007 (gnus-summary-mark-forward n gnus-ticked-mark))
8009 (defalias 'gnus-summary-mark-as-unread-backward
8010 'gnus-summary-tick-article-backward)
8011 (make-obsolete 'gnus-summary-mark-as-unread-backward
8012 'gnus-summary-tick-article-backward)
8013 (defun gnus-summary-tick-article-backward (n)
8014 "Tick N articles backwards.
8015 The difference between N and the number of articles ticked is returned."
8017 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8019 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8020 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8021 (defun gnus-summary-tick-article (&optional article clear-mark)
8022 "Mark current article as unread.
8023 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8024 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8026 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8029 (defun gnus-summary-mark-as-read-forward (n)
8030 "Mark N articles as read forwards.
8031 If N is negative, mark backwards instead.
8032 The difference between N and the actual number of articles marked is
8035 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8037 (defun gnus-summary-mark-as-read-backward (n)
8038 "Mark the N articles as read backwards.
8039 The difference between N and the actual number of articles marked is
8042 (gnus-summary-mark-forward (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8044 (defun gnus-summary-mark-as-read (&optional article mark)
8045 "Mark current article as read.
8046 ARTICLE specifies the article to be marked as read.
8047 MARK specifies a string to be inserted at the beginning of the line."
8048 (gnus-summary-mark-article article mark))
8050 (defun gnus-summary-clear-mark-forward (n)
8051 "Clear marks from N articles forward.
8052 If N is negative, clear backward instead.
8053 The difference between N and the number of marks cleared is returned."
8055 (gnus-summary-mark-forward n gnus-unread-mark))
8057 (defun gnus-summary-clear-mark-backward (n)
8058 "Clear marks from N articles backward.
8059 The difference between N and the number of marks cleared is returned."
8061 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8063 (defun gnus-summary-mark-unread-as-read ()
8064 "Intended to be used by `gnus-summary-mark-article-hook'."
8065 (when (memq gnus-current-article gnus-newsgroup-unreads)
8066 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8068 (defun gnus-summary-mark-read-and-unread-as-read ()
8069 "Intended to be used by `gnus-summary-mark-article-hook'."
8070 (let ((mark (gnus-summary-article-mark)))
8071 (when (or (gnus-unread-mark-p mark)
8072 (gnus-read-mark-p mark))
8073 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8075 (defun gnus-summary-mark-region-as-read (point mark all)
8076 "Mark all unread articles between point and mark as read.
8077 If given a prefix, mark all articles between point and mark as read,
8078 even ticked and dormant ones."
8079 (interactive "r\nP")
8088 (memq (setq article (gnus-summary-article-number))
8089 gnus-newsgroup-unreads))
8090 (gnus-summary-mark-article article gnus-del-mark))
8092 (gnus-summary-find-next))))))
8094 (defun gnus-summary-mark-below (score mark)
8095 "Mark articles with score less than SCORE with MARK."
8096 (interactive "P\ncMark: ")
8097 (setq score (if score
8098 (prefix-numeric-value score)
8099 (or gnus-summary-default-score 0)))
8101 (set-buffer gnus-summary-buffer)
8102 (goto-char (point-min))
8105 (and (< (gnus-summary-article-score) score)
8106 (gnus-summary-mark-article nil mark))
8107 (gnus-summary-find-next)))))
8109 (defun gnus-summary-kill-below (&optional score)
8110 "Mark articles with score below SCORE as read."
8112 (gnus-summary-mark-below score gnus-killed-mark))
8114 (defun gnus-summary-clear-above (&optional score)
8115 "Clear all marks from articles with score above SCORE."
8117 (gnus-summary-mark-above score gnus-unread-mark))
8119 (defun gnus-summary-tick-above (&optional score)
8120 "Tick all articles with score above SCORE."
8122 (gnus-summary-mark-above score gnus-ticked-mark))
8124 (defun gnus-summary-mark-above (score mark)
8125 "Mark articles with score over SCORE with MARK."
8126 (interactive "P\ncMark: ")
8127 (setq score (if score
8128 (prefix-numeric-value score)
8129 (or gnus-summary-default-score 0)))
8131 (set-buffer gnus-summary-buffer)
8132 (goto-char (point-min))
8134 (when (> (gnus-summary-article-score) score)
8135 (gnus-summary-mark-article nil mark))
8137 (gnus-summary-find-next)))))
8139 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8140 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8141 (defun gnus-summary-limit-include-expunged (&optional no-error)
8142 "Display all the hidden articles that were expunged for low scores."
8144 (let ((buffer-read-only nil))
8145 (let ((scored gnus-newsgroup-scored)
8148 (unless (gnus-summary-goto-subject (caar scored))
8149 (and (setq h (gnus-summary-article-header (caar scored)))
8150 (< (cdar scored) gnus-summary-expunge-below)
8152 (setq scored (cdr scored)))
8154 (when (not no-error)
8155 (error "No expunged articles hidden"))
8156 (goto-char (point-min))
8157 (gnus-summary-prepare-unthreaded (nreverse headers))
8158 (goto-char (point-min))
8159 (gnus-summary-position-point)
8162 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8163 "Mark all unread articles in this newsgroup as read.
8164 If prefix argument ALL is non-nil, ticked and dormant articles will
8165 also be marked as read.
8166 If QUIETLY is non-nil, no questions will be asked.
8167 If TO-HERE is non-nil, it should be a point in the buffer. All
8168 articles before this point will be marked as read.
8169 Note that this function will only catch up the unread article
8170 in the current summary buffer limitation.
8171 The number of articles marked as read is returned."
8176 (not gnus-interactive-catchup) ;Without confirmation?
8180 "Mark absolutely all articles as read? "
8181 "Mark all unread articles as read? ")))
8183 (not gnus-newsgroup-adaptive)
8184 (not gnus-newsgroup-auto-expire)
8185 (not gnus-suppress-duplicates)
8186 (or (not gnus-use-cache)
8187 (eq gnus-use-cache 'passive)))
8190 (setq gnus-newsgroup-marked nil
8191 gnus-newsgroup-dormant nil))
8192 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8193 ;; We actually mark all articles as canceled, which we
8194 ;; have to do when using auto-expiry or adaptive scoring.
8195 (gnus-summary-show-all-threads)
8196 (when (gnus-summary-first-subject (not all) t)
8198 (if to-here (< (point) to-here) t)
8199 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8200 (gnus-summary-find-next (not all) nil nil t))))
8201 (gnus-set-mode-line 'summary))
8203 (gnus-summary-position-point)))
8205 (defun gnus-summary-catchup-to-here (&optional all)
8206 "Mark all unticked articles before the current one as read.
8207 If ALL is non-nil, also mark ticked and dormant articles as read."
8210 (gnus-save-hidden-threads
8211 (let ((beg (point)))
8212 ;; We check that there are unread articles.
8213 (when (or all (gnus-summary-find-prev))
8214 (gnus-summary-catchup all t beg)))))
8215 (gnus-summary-position-point))
8217 (defun gnus-summary-catchup-all (&optional quietly)
8218 "Mark all articles in this newsgroup as read."
8220 (gnus-summary-catchup t quietly))
8222 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8223 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8224 If prefix argument ALL is non-nil, all articles are marked as read."
8226 (when (gnus-summary-catchup all quietly nil 'fast)
8227 ;; Select next newsgroup or exit.
8228 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8229 (eq gnus-auto-select-next 'quietly))
8230 (gnus-summary-next-group nil)
8231 (gnus-summary-exit))))
8233 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8234 "Mark all articles in this newsgroup as read, and then exit."
8236 (gnus-summary-catchup-and-exit t quietly))
8238 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8239 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8240 "Mark all articles in this group as read and select the next group.
8241 If given a prefix, mark all articles, unread as well as ticked, as
8245 (gnus-summary-catchup all))
8246 (gnus-summary-next-article t nil nil t))
8248 ;; Thread-based commands.
8250 (defun gnus-summary-articles-in-thread (&optional article)
8251 "Return a list of all articles in the current thread.
8252 If ARTICLE is non-nil, return all articles in the thread that starts
8254 (let* ((article (or article (gnus-summary-article-number)))
8255 (data (gnus-data-find-list article))
8256 (top-level (gnus-data-level (car data)))
8258 (cond ((null gnus-thread-operation-ignore-subject)
8259 (gnus-simplify-subject-re
8260 (mail-header-subject (gnus-data-header (car data)))))
8261 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8262 (gnus-simplify-subject-fuzzy
8263 (mail-header-subject (gnus-data-header (car data)))))
8265 (end-point (save-excursion
8266 (if (gnus-summary-go-to-next-thread)
8267 (point) (point-max))))
8270 (< (gnus-data-pos (car data)) end-point))
8271 (when (or (not top-subject)
8272 (string= top-subject
8273 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8274 (gnus-simplify-subject-fuzzy
8275 (mail-header-subject
8276 (gnus-data-header (car data))))
8277 (gnus-simplify-subject-re
8278 (mail-header-subject
8279 (gnus-data-header (car data)))))))
8280 (push (gnus-data-number (car data)) articles))
8281 (unless (and (setq data (cdr data))
8282 (> (gnus-data-level (car data)) top-level))
8284 ;; Return the list of articles.
8285 (nreverse articles)))
8287 (defun gnus-summary-rethread-current ()
8288 "Rethread the thread the current article is part of."
8290 (let* ((gnus-show-threads t)
8291 (article (gnus-summary-article-number))
8292 (id (mail-header-id (gnus-summary-article-header)))
8293 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8295 (error "No article on the current line"))
8296 (gnus-rebuild-thread id)
8297 (gnus-summary-goto-subject article)))
8299 (defun gnus-summary-reparent-thread ()
8300 "Make the current article child of the marked (or previous) article.
8302 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8303 is non-nil or the Subject: of both articles are the same."
8305 (unless (not (gnus-group-read-only-p))
8306 (error "The current newsgroup does not support article editing"))
8307 (unless (<= (length gnus-newsgroup-processable) 1)
8308 (error "No more than one article may be marked"))
8309 (save-window-excursion
8310 (let ((gnus-article-buffer " *reparent*")
8311 (current-article (gnus-summary-article-number))
8312 ;; First grab the marked article, otherwise one line up.
8313 (parent-article (if (not (null gnus-newsgroup-processable))
8314 (car gnus-newsgroup-processable)
8316 (if (eq (forward-line -1) 0)
8317 (gnus-summary-article-number)
8318 (error "Beginning of summary buffer"))))))
8319 (unless (not (eq current-article parent-article))
8320 (error "An article may not be self-referential"))
8321 (let ((message-id (mail-header-id
8322 (gnus-summary-article-header parent-article))))
8323 (unless (and message-id (not (equal message-id "")))
8324 (error "No message-id in desired parent"))
8325 ;; We don't want the article to be marked as read.
8326 (let (gnus-mark-article-hook)
8327 (gnus-summary-select-article t t nil current-article))
8328 (set-buffer gnus-original-article-buffer)
8329 (let ((buf (format "%s" (buffer-string))))
8332 (goto-char (point-min))
8333 (if (re-search-forward "^References: " nil t)
8335 (re-search-forward "^[^ \t]" nil t)
8338 (insert " " message-id))
8339 (insert "References: " message-id "\n"))
8340 (unless (gnus-request-replace-article
8341 current-article (car gnus-article-current)
8343 (error "Couldn't replace article"))))
8344 (set-buffer gnus-summary-buffer)
8345 (gnus-summary-unmark-all-processable)
8346 (gnus-summary-update-article current-article)
8347 (gnus-summary-rethread-current)
8348 (gnus-message 3 "Article %d is now the child of article %d"
8349 current-article parent-article)))))
8351 (defun gnus-summary-toggle-threads (&optional arg)
8352 "Toggle showing conversation threads.
8353 If ARG is positive number, turn showing conversation threads on."
8355 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8356 (setq gnus-show-threads
8357 (if (null arg) (not gnus-show-threads)
8358 (> (prefix-numeric-value arg) 0)))
8359 (gnus-summary-prepare)
8360 (gnus-summary-goto-subject current)
8361 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8362 (gnus-summary-position-point)))
8364 (defun gnus-summary-show-all-threads ()
8368 (let ((buffer-read-only nil))
8369 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8370 (gnus-summary-position-point))
8372 (defun gnus-summary-show-thread ()
8373 "Show thread subtrees.
8374 Returns nil if no thread was there to be shown."
8376 (let ((buffer-read-only nil)
8378 ;; first goto end then to beg, to have point at beg after let
8379 (end (progn (end-of-line) (point)))
8380 (beg (progn (beginning-of-line) (point))))
8382 ;; Any hidden lines here?
8383 (search-forward "\r" end t)
8384 (subst-char-in-region beg end ?\^M ?\n t)
8386 (gnus-summary-position-point))))
8388 (defun gnus-summary-hide-all-threads ()
8389 "Hide all thread subtrees."
8392 (goto-char (point-min))
8393 (gnus-summary-hide-thread)
8394 (while (zerop (gnus-summary-next-thread 1 t))
8395 (gnus-summary-hide-thread)))
8396 (gnus-summary-position-point))
8398 (defun gnus-summary-hide-thread ()
8399 "Hide thread subtrees.
8400 Returns nil if no threads were there to be hidden."
8402 (let ((buffer-read-only nil)
8404 (article (gnus-summary-article-number)))
8406 ;; Go forward until either the buffer ends or the subthread
8408 (when (and (not (eobp))
8409 (or (zerop (gnus-summary-next-thread 1 t))
8410 (goto-char (point-max))))
8412 (if (and (> (point) start)
8413 (search-backward "\n" start t))
8415 (subst-char-in-region start (point) ?\n ?\^M)
8416 (gnus-summary-goto-subject article))
8419 ;;(gnus-summary-position-point)
8422 (defun gnus-summary-go-to-next-thread (&optional previous)
8423 "Go to the same level (or less) next thread.
8424 If PREVIOUS is non-nil, go to previous thread instead.
8425 Return the article number moved to, or nil if moving was impossible."
8426 (let ((level (gnus-summary-thread-level))
8427 (way (if previous -1 1))
8430 (while (and (not (eobp))
8431 (< level (gnus-summary-thread-level)))
8439 (gnus-summary-article-number)
8442 (defun gnus-summary-next-thread (n &optional silent)
8443 "Go to the same level next N'th thread.
8444 If N is negative, search backward instead.
8445 Returns the difference between N and the number of skips actually
8448 If SILENT, don't output messages."
8450 (let ((backward (< n 0))
8453 (gnus-summary-go-to-next-thread backward))
8456 (gnus-summary-position-point))
8457 (when (and (not silent) (/= 0 n))
8458 (gnus-message 7 "No more threads"))
8461 (defun gnus-summary-prev-thread (n)
8462 "Go to the same level previous N'th thread.
8463 Returns the difference between N and the number of skips actually
8466 (gnus-summary-next-thread (- n)))
8468 (defun gnus-summary-go-down-thread ()
8469 "Go down one level in the current thread."
8470 (let ((children (gnus-summary-article-children)))
8472 (gnus-summary-goto-subject (car children)))))
8474 (defun gnus-summary-go-up-thread ()
8475 "Go up one level in the current thread."
8476 (let ((parent (gnus-summary-article-parent)))
8478 (gnus-summary-goto-subject parent))))
8480 (defun gnus-summary-down-thread (n)
8481 "Go down thread N steps.
8482 If N is negative, go up instead.
8483 Returns the difference between N and how many steps down that were
8489 (if up (gnus-summary-go-up-thread)
8490 (gnus-summary-go-down-thread)))
8492 (gnus-summary-position-point)
8494 (gnus-message 7 "Can't go further"))
8497 (defun gnus-summary-up-thread (n)
8498 "Go up thread N steps.
8499 If N is negative, go up instead.
8500 Returns the difference between N and how many steps down that were
8503 (gnus-summary-down-thread (- n)))
8505 (defun gnus-summary-top-thread ()
8506 "Go to the top of the thread."
8508 (while (gnus-summary-go-up-thread))
8509 (gnus-summary-article-number))
8511 (defun gnus-summary-kill-thread (&optional unmark)
8512 "Mark articles under current thread as read.
8513 If the prefix argument is positive, remove any kinds of marks.
8514 If the prefix argument is negative, tick articles instead."
8517 (setq unmark (prefix-numeric-value unmark)))
8518 (let ((articles (gnus-summary-articles-in-thread)))
8520 ;; Expand the thread.
8521 (gnus-summary-show-thread)
8522 ;; Mark all the articles.
8524 (gnus-summary-goto-subject (car articles))
8525 (cond ((null unmark)
8526 (gnus-summary-mark-article-as-read gnus-killed-mark))
8528 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8530 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8531 (setq articles (cdr articles))))
8532 ;; Hide killed subtrees.
8534 gnus-thread-hide-killed
8535 (gnus-summary-hide-thread))
8536 ;; If marked as read, go to next unread subject.
8538 ;; Go to next unread subject.
8539 (gnus-summary-next-subject 1 t)))
8540 (gnus-set-mode-line 'summary))
8542 ;; Summary sorting commands
8544 (defun gnus-summary-sort-by-number (&optional reverse)
8545 "Sort the summary buffer by article number.
8546 Argument REVERSE means reverse order."
8548 (gnus-summary-sort 'number reverse))
8550 (defun gnus-summary-sort-by-author (&optional reverse)
8551 "Sort the summary buffer by author name alphabetically.
8552 If case-fold-search is non-nil, case of letters is ignored.
8553 Argument REVERSE means reverse order."
8555 (gnus-summary-sort 'author reverse))
8557 (defun gnus-summary-sort-by-subject (&optional reverse)
8558 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8559 If case-fold-search is non-nil, case of letters is ignored.
8560 Argument REVERSE means reverse order."
8562 (gnus-summary-sort 'subject reverse))
8564 (defun gnus-summary-sort-by-date (&optional reverse)
8565 "Sort the summary buffer by date.
8566 Argument REVERSE means reverse order."
8568 (gnus-summary-sort 'date reverse))
8570 (defun gnus-summary-sort-by-score (&optional reverse)
8571 "Sort the summary buffer by score.
8572 Argument REVERSE means reverse order."
8574 (gnus-summary-sort 'score reverse))
8576 (defun gnus-summary-sort-by-lines (&optional reverse)
8577 "Sort the summary buffer by article length.
8578 Argument REVERSE means reverse order."
8580 (gnus-summary-sort 'lines reverse))
8582 (defun gnus-summary-sort (predicate reverse)
8583 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8584 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8585 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8586 (gnus-thread-sort-functions
8591 (gnus-article-sort-functions
8597 (gnus-summary-prepare-hook nil))
8598 ;; We do the sorting by regenerating the threads.
8599 (gnus-summary-prepare)
8600 ;; Hide subthreads if needed.
8601 (when (and gnus-show-threads gnus-thread-hide-subtree)
8602 (gnus-summary-hide-all-threads))))
8604 ;; Summary saving commands.
8606 (defun gnus-summary-save-article (&optional n not-saved)
8607 "Save the current article using the default saver function.
8608 If N is a positive number, save the N next articles.
8609 If N is a negative number, save the N previous articles.
8610 If N is nil and any articles have been marked with the process mark,
8611 save those articles instead.
8612 The variable `gnus-default-article-saver' specifies the saver function."
8614 (let* ((articles (gnus-summary-work-articles n))
8615 (save-buffer (save-excursion
8616 (nnheader-set-temp-buffer " *Gnus Save*")))
8617 (num (length articles))
8618 header article file)
8620 (setq header (gnus-summary-article-header
8621 (setq article (pop articles))))
8622 (if (not (vectorp header))
8623 ;; This is a pseudo-article.
8624 (if (assq 'name header)
8625 (gnus-copy-file (cdr (assq 'name header)))
8626 (gnus-message 1 "Article %d is unsaveable" article))
8627 ;; This is a real article.
8628 (save-window-excursion
8629 (gnus-summary-select-article t nil nil article))
8631 (set-buffer save-buffer)
8633 (insert-buffer-substring gnus-original-article-buffer))
8634 (setq file (gnus-article-save save-buffer file num))
8635 (gnus-summary-remove-process-mark article)
8637 (gnus-summary-set-saved-mark article))))
8638 (gnus-kill-buffer save-buffer)
8639 (gnus-summary-position-point)
8640 (gnus-set-mode-line 'summary)
8643 (defun gnus-summary-pipe-output (&optional arg)
8644 "Pipe the current article to a subprocess.
8645 If N is a positive number, pipe the N next articles.
8646 If N is a negative number, pipe the N previous articles.
8647 If N is nil and any articles have been marked with the process mark,
8648 pipe those articles instead."
8650 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8651 (gnus-summary-save-article arg t))
8652 (gnus-configure-windows 'pipe))
8654 (defun gnus-summary-save-article-mail (&optional arg)
8655 "Append the current article to an mail file.
8656 If N is a positive number, save the N next articles.
8657 If N is a negative number, save the N previous articles.
8658 If N is nil and any articles have been marked with the process mark,
8659 save those articles instead."
8661 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8662 (gnus-summary-save-article arg)))
8664 (defun gnus-summary-save-article-rmail (&optional arg)
8665 "Append the current article to an rmail file.
8666 If N is a positive number, save the N next articles.
8667 If N is a negative number, save the N previous articles.
8668 If N is nil and any articles have been marked with the process mark,
8669 save those articles instead."
8671 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8672 (gnus-summary-save-article arg)))
8674 (defun gnus-summary-save-article-file (&optional arg)
8675 "Append the current article to a file.
8676 If N is a positive number, save the N next articles.
8677 If N is a negative number, save the N previous articles.
8678 If N is nil and any articles have been marked with the process mark,
8679 save those articles instead."
8681 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8682 (gnus-summary-save-article arg)))
8684 (defun gnus-summary-write-article-file (&optional arg)
8685 "Write the current article to a file, deleting the previous file.
8686 If N is a positive number, save the N next articles.
8687 If N is a negative number, save the N previous articles.
8688 If N is nil and any articles have been marked with the process mark,
8689 save those articles instead."
8691 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8692 (gnus-summary-save-article arg)))
8694 (defun gnus-summary-save-article-body-file (&optional arg)
8695 "Append the current article body to a file.
8696 If N is a positive number, save the N next articles.
8697 If N is a negative number, save the N previous articles.
8698 If N is nil and any articles have been marked with the process mark,
8699 save those articles instead."
8701 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8702 (gnus-summary-save-article arg)))
8704 (defun gnus-summary-pipe-message (program)
8705 "Pipe the current article through PROGRAM."
8706 (interactive "sProgram: ")
8707 (gnus-summary-select-article)
8708 (let ((mail-header-separator ""))
8709 (gnus-eval-in-buffer-window gnus-article-buffer
8712 (let ((start (window-start))
8714 (message-pipe-buffer-body program)
8715 (set-window-start (get-buffer-window (current-buffer)) start))))))
8717 (defun gnus-get-split-value (methods)
8718 "Return a value based on the split METHODS."
8719 (let (split-name method result match)
8722 (set-buffer gnus-original-article-buffer)
8724 (nnheader-narrow-to-headers)
8726 (goto-char (point-min))
8727 (setq method (pop methods))
8728 (setq match (car method))
8731 ;; Regular expression.
8733 (re-search-forward match nil t)))
8734 ((gnus-functionp match)
8738 (setq result (funcall match gnus-newsgroup-name))))
8743 (setq result (eval match)))))
8744 (setq split-name (append (cdr method) split-name))
8745 (cond ((stringp result)
8746 (push (expand-file-name
8747 result gnus-article-save-directory)
8750 (setq split-name (append result split-name)))))))))
8753 (defun gnus-valid-move-group-p (group)
8756 (symbol-value group)
8759 (car (gnus-find-method-for-group
8760 (symbol-name group))))
8761 gnus-valid-select-methods))))
8763 (defun gnus-read-move-group-name (prompt default articles prefix)
8764 "Read a group name."
8765 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8766 (minibuffer-confirm-incomplete nil) ; XEmacs
8770 (if (> (length articles) 1)
8771 (format "these %d articles" (length articles))
8776 (gnus-completing-read default prom
8778 'gnus-valid-move-group-p
8780 'gnus-group-history))
8781 ((= 1 (length split-name))
8782 (gnus-completing-read (car split-name) prom
8784 'gnus-valid-move-group-p
8786 'gnus-group-history))
8788 (gnus-completing-read nil prom
8789 (mapcar (lambda (el) (list el))
8790 (nreverse split-name))
8792 'gnus-group-history)))))
8794 (if (or (string= to-newsgroup "")
8795 (string= to-newsgroup prefix))
8796 (setq to-newsgroup default))
8797 (unless to-newsgroup
8798 (error "No group name entered"))
8799 (or (gnus-active to-newsgroup)
8800 (gnus-activate-group to-newsgroup)
8801 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8803 (or (and (gnus-request-create-group
8804 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8805 (gnus-activate-group to-newsgroup nil nil
8806 (gnus-group-name-to-method
8808 (error "Couldn't create group %s" to-newsgroup)))
8809 (error "No such group: %s" to-newsgroup)))
8812 ;; Summary extract commands
8814 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8815 (let ((buffer-read-only nil)
8816 (article (gnus-summary-article-number))
8818 (unless (gnus-summary-goto-subject article)
8819 (error "No such article: %d" article))
8820 (gnus-summary-position-point)
8821 ;; If all commands are to be bunched up on one line, we collect
8823 (unless gnus-view-pseudos-separately
8824 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8827 (setq action (cdr (assq 'action (car ps))))
8828 (setq files (list (cdr (assq 'name (car ps)))))
8829 (while (and ps (cdr ps)
8830 (string= (or action "1")
8831 (or (cdr (assq 'action (cadr ps))) "2")))
8832 (push (cdr (assq 'name (cadr ps))) files)
8833 (setcdr ps (cddr ps)))
8835 (when (not (string-match "%s" action))
8838 (when (assq 'execute (car ps))
8839 (setcdr (assq 'execute (car ps))
8840 (funcall (if (string-match "%s" action)
8847 (gnus-quote-arg-for-sh-or-csh f)))
8849 (setq ps (cdr ps)))))
8850 (if (and gnus-view-pseudos (not not-view))
8852 (when (assq 'execute (car pslist))
8853 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8854 (eq gnus-view-pseudos 'not-confirm)))
8855 (setq pslist (cdr pslist)))
8858 (setq after-article (or (cdr (assq 'article (car pslist)))
8859 (gnus-summary-article-number)))
8860 (gnus-summary-goto-subject after-article)
8863 (insert " " (file-name-nondirectory
8864 (cdr (assq 'name (car pslist))))
8865 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8867 (forward-line -1) ; back to `b'
8868 (gnus-add-text-properties
8869 b (1- e) (list 'gnus-number gnus-reffed-article-number
8870 gnus-mouse-face-prop gnus-mouse-face))
8872 after-article gnus-reffed-article-number
8873 gnus-unread-mark b (car pslist) 0 (- e b))
8874 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8875 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8876 (setq pslist (cdr pslist)))))))
8878 (defun gnus-pseudos< (p1 p2)
8879 (let ((c1 (cdr (assq 'action p1)))
8880 (c2 (cdr (assq 'action p2))))
8881 (and c1 c2 (string< c1 c2))))
8883 (defun gnus-request-pseudo-article (props)
8884 (cond ((assq 'execute props)
8885 (gnus-execute-command (cdr (assq 'execute props)))))
8886 (let ((gnus-current-article (gnus-summary-article-number)))
8887 (gnus-run-hooks 'gnus-mark-article-hook)))
8889 (defun gnus-execute-command (command &optional automatic)
8891 (gnus-article-setup-buffer)
8892 (set-buffer gnus-article-buffer)
8893 (setq buffer-read-only nil)
8894 (let ((command (if automatic command
8895 (read-string "Command: " (cons command 0)))))
8897 (insert "$ " command "\n\n")
8898 (if gnus-view-pseudo-asynchronously
8899 (start-process "gnus-execute" (current-buffer) shell-file-name
8900 shell-command-switch command)
8901 (call-process shell-file-name nil t nil
8902 shell-command-switch command)))))
8904 ;; Summary kill commands.
8906 (defun gnus-summary-edit-global-kill (article)
8907 "Edit the \"global\" kill file."
8908 (interactive (list (gnus-summary-article-number)))
8909 (gnus-group-edit-global-kill article))
8911 (defun gnus-summary-edit-local-kill ()
8912 "Edit a local kill file applied to the current newsgroup."
8914 (setq gnus-current-headers (gnus-summary-article-header))
8915 (gnus-group-edit-local-kill
8916 (gnus-summary-article-number) gnus-newsgroup-name))
8920 (defun gnus-read-header (id &optional header)
8921 "Read the headers of article ID and enter them into the Gnus system."
8922 (let ((group gnus-newsgroup-name)
8923 (gnus-override-method
8924 (and (gnus-news-group-p gnus-newsgroup-name)
8925 gnus-refer-article-method))
8927 ;; First we check to see whether the header in question is already
8930 ;; This is a Message-ID.
8931 (setq header (or header (gnus-id-to-header id)))
8932 ;; This is an article number.
8933 (setq header (or header (gnus-summary-article-header id))))
8935 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8936 ;; We have found the header.
8938 ;; If this is a sparse article, we have to nix out its
8939 ;; previous entry in the thread hashtb.
8941 (gnus-summary-article-sparse-p (mail-header-number header)))
8942 (let* ((parent (gnus-parent-id (mail-header-references header)))
8943 (thread (and parent (gnus-id-to-thread parent))))
8945 (delq (assq header thread) thread))))
8946 ;; We have to really fetch the header to this article.
8948 (set-buffer nntp-server-buffer)
8949 (when (setq where (gnus-request-head id group))
8950 (nnheader-fold-continuation-lines)
8951 (goto-char (point-max))
8953 (goto-char (point-min))
8957 ((cdr where) (cdr where))
8958 (header (mail-header-number header))
8959 (t gnus-reffed-article-number))
8961 (insert " Article retrieved.\n"))
8963 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8964 () ; Malformed head.
8965 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8966 (when (and (stringp id)
8967 (not (string= (gnus-group-real-name group)
8969 ;; If we fetched by Message-ID and the article came
8970 ;; from a different group, we fudge some bogus article
8971 ;; numbers for this article.
8972 (mail-header-set-number header gnus-reffed-article-number))
8974 (set-buffer gnus-summary-buffer)
8975 (decf gnus-reffed-article-number)
8976 (gnus-remove-header (mail-header-number header))
8977 (push header gnus-newsgroup-headers)
8978 (setq gnus-current-headers header)
8979 (push (mail-header-number header) gnus-newsgroup-limit)))
8982 (defun gnus-remove-header (number)
8983 "Remove header NUMBER from `gnus-newsgroup-headers'."
8984 (if (and gnus-newsgroup-headers
8985 (= number (mail-header-number (car gnus-newsgroup-headers))))
8986 (pop gnus-newsgroup-headers)
8987 (let ((headers gnus-newsgroup-headers))
8988 (while (and (cdr headers)
8989 (not (= number (mail-header-number (cadr headers)))))
8992 (setcdr headers (cddr headers))))))
8995 ;;; summary highlights
8998 (defun gnus-highlight-selected-summary ()
8999 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9000 ;; Highlight selected article in summary buffer
9001 (when gnus-summary-selected-face
9003 (let* ((beg (progn (beginning-of-line) (point)))
9004 (end (progn (end-of-line) (point)))
9005 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9006 (from (if (get-text-property beg gnus-mouse-face-prop)
9008 (or (next-single-property-change
9009 beg gnus-mouse-face-prop nil end)
9014 (or (next-single-property-change
9015 from gnus-mouse-face-prop nil end)
9017 ;; If no mouse-face prop on line we will have to = from = end,
9018 ;; so we highlight the entire line instead.
9019 (when (= (+ to 2) from)
9022 (if gnus-newsgroup-selected-overlay
9023 ;; Move old overlay.
9025 gnus-newsgroup-selected-overlay from to (current-buffer))
9026 ;; Create new overlay.
9028 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9029 'face gnus-summary-selected-face))))))
9031 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9032 (defun gnus-summary-highlight-line ()
9033 "Highlight current line according to `gnus-summary-highlight'."
9034 (let* ((list gnus-summary-highlight)
9036 (end (progn (end-of-line) (point)))
9037 ;; now find out where the line starts and leave point there.
9038 (beg (progn (beginning-of-line) (point)))
9039 (article (gnus-summary-article-number))
9040 (score (or (cdr (assq (or article gnus-current-article)
9041 gnus-newsgroup-scored))
9042 gnus-summary-default-score 0))
9043 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9044 (inhibit-read-only t))
9045 ;; Eval the cars of the lists until we find a match.
9046 (let ((default gnus-summary-default-score))
9048 (not (eval (caar list))))
9049 (setq list (cdr list))))
9050 (let ((face (cdar list)))
9051 (unless (eq face (get-text-property beg 'face))
9052 (gnus-put-text-property-excluding-characters-with-faces
9054 (setq face (if (boundp face) (symbol-value face) face)))
9055 (when gnus-summary-highlight-line-function
9056 (funcall gnus-summary-highlight-line-function article face))))
9059 (defun gnus-update-read-articles (group unread &optional compute)
9060 "Update the list of read articles in GROUP."
9061 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9062 (entry (gnus-gethash group gnus-newsrc-hashtb))
9063 (info (nth 2 entry))
9065 (unread (sort (copy-sequence unread) '<))
9067 (if (or (not info) (not active))
9068 ;; There is no info on this group if it was, in fact,
9069 ;; killed. Gnus stores no information on killed groups, so
9070 ;; there's nothing to be done.
9071 ;; One could store the information somewhere temporarily,
9072 ;; perhaps... Hmmm...
9074 ;; Remove any negative articles numbers.
9075 (while (and unread (< (car unread) 0))
9076 (setq unread (cdr unread)))
9077 ;; Remove any expired article numbers
9078 (while (and unread (< (car unread) (car active)))
9079 (setq unread (cdr unread)))
9080 ;; Compute the ranges of read articles by looking at the list of
9083 (when (/= (car unread) prev)
9084 (push (if (= prev (1- (car unread))) prev
9085 (cons prev (1- (car unread))))
9087 (setq prev (1+ (car unread)))
9088 (setq unread (cdr unread)))
9089 (when (<= prev (cdr active))
9090 (push (cons prev (cdr active)) read))
9091 (setq read (if (> (length read) 1) (nreverse read) read))
9095 (set-buffer gnus-group-buffer)
9098 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9099 (gnus-info-set-read ',info ',(gnus-info-read info))
9100 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9101 (gnus-group-update-group ,group t))))
9102 ;; Enter this list into the group info.
9103 (gnus-info-set-read info read)
9104 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9105 (gnus-get-unread-articles-in-group info (gnus-active group))
9108 (defun gnus-offer-save-summaries ()
9109 "Offer to save all active summary buffers."
9111 (let ((buflist (buffer-list))
9113 ;; Go through all buffers and find all summaries.
9115 (and (setq bufname (buffer-name (car buflist)))
9116 (string-match "Summary" bufname)
9118 (set-buffer bufname)
9119 ;; We check that this is, indeed, a summary buffer.
9120 (and (eq major-mode 'gnus-summary-mode)
9121 ;; Also make sure this isn't bogus.
9122 gnus-newsgroup-prepared
9123 ;; Also make sure that this isn't a dead summary buffer.
9124 (not gnus-dead-summary-mode)))
9125 (push bufname buffers))
9126 (setq buflist (cdr buflist)))
9127 ;; Go through all these summary buffers and offer to save them.
9130 "Update summary buffer %s? "
9132 (switch-to-buffer buf)
9133 (gnus-summary-exit))
9137 ;;; @ for mime-partial
9140 (defun gnus-request-partial-message ()
9142 (let ((number (gnus-summary-article-number))
9143 (group gnus-newsgroup-name)
9144 (mother gnus-article-buffer))
9145 (set-buffer (get-buffer-create " *Partial Article*"))
9147 (setq mime-preview-buffer mother)
9148 (gnus-request-article-this-buffer number group)
9152 (autoload 'mime-combine-message/partial-pieces-automatically
9154 "Internal method to combine message/partial messages automatically.")
9157 'action '((type . message)(subtype . partial)
9158 (major-mode . gnus-original-article-mode)
9159 (method . mime-combine-message/partial-pieces-automatically)
9160 (summary-buffer-exp . gnus-summary-buffer)
9161 (request-partial-message-method . gnus-request-partial-message)
9168 (defun gnus-newsgroup-setup-default-charset ()
9169 "Setup newsgroup default charset."
9170 (let ((name (and gnus-newsgroup-name
9171 (string-match "[^:]+$" gnus-newsgroup-name)
9172 (match-string 0 gnus-newsgroup-name))))
9173 (setq gnus-newsgroup-default-charset
9174 (or (and gnus-newsgroup-name
9175 (or (gnus-group-find-parameter
9176 gnus-newsgroup-name 'charset)
9177 (let ((alist gnus-newsgroup-default-charset-alist)
9182 (car (setq elem (pop alist)))
9185 charset (cdr elem))))
9187 rfc2047-default-charset))
9188 (setq gnus-newsgroup-iso-8859-1-forced
9189 (and gnus-newsgroup-name
9190 (or (gnus-group-find-parameter
9191 gnus-newsgroup-name 'iso-8859-1-forced)
9193 (string-match gnus-newsgroup-iso-8859-1-forced-regexp
9195 (if (stringp gnus-newsgroup-default-charset)
9196 (setq gnus-newsgroup-default-charset
9197 (intern (downcase gnus-newsgroup-default-charset))))
9198 (setq gnus-newsgroup-iso-8859-1-forced
9199 (if (stringp gnus-newsgroup-iso-8859-1-forced)
9200 (intern (downcase gnus-newsgroup-iso-8859-1-forced))
9201 (and gnus-newsgroup-iso-8859-1-forced
9202 gnus-newsgroup-default-charset))))
9208 (defun gnus-summary-display-buttonized ()
9209 "Display the current article buffer fully MIME-buttonized."
9212 (let ((gnus-unbuttonized-mime-types nil))
9213 (gnus-summary-show-article)))
9215 (defun gnus-summary-toggle-display-buttonized ()
9216 "Toggle the buttonizing of the article buffer."
9219 (if (setq gnus-inhibit-mime-unbuttonizing
9220 (not gnus-inhibit-mime-unbuttonizing))
9221 (let ((gnus-unbuttonized-mime-types nil))
9222 (gnus-summary-show-article))
9223 (gnus-summary-show-article)))
9229 (run-hooks 'gnus-sum-load-hook)
9231 ;;; gnus-sum.el ends here