1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Katsumi Yamaoka <yamaoka@jpl.org>
7 ;; Keywords: mail, news, MIME
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
30 (eval-when-compile (require 'cl))
43 ;; Avoid byte-compile warnings.
44 (defvar gnus-article-decoded-p)
45 (defvar gnus-decode-encoded-word-function)
49 (autoload 'gnus-cache-articles-in-group "gnus-cache"))
51 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
52 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
54 (defcustom gnus-kill-summary-on-exit t
55 "*If non-nil, kill the summary buffer when you exit from it.
56 If nil, the summary will become a \"*Dead Summary*\" buffer, and
57 it will be killed sometime later."
58 :group 'gnus-summary-exit
61 (defcustom gnus-fetch-old-headers nil
62 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
63 If an unread article in the group refers to an older, already read (or
64 just marked as read) article, the old article will not normally be
65 displayed in the Summary buffer. If this variable is non-nil, Gnus
66 will attempt to grab the headers to the old articles, and thereby
67 build complete threads. If it has the value `some', only enough
68 headers to connect otherwise loose threads will be displayed. This
69 variable can also be a number. In that case, no more than that number
70 of old headers will be fetched. If it has the value `invisible', all
71 old headers will be fetched, but none will be displayed.
73 The server has to support NOV for any of this to work."
75 :type '(choice (const :tag "off" nil)
78 (sexp :menu-tag "other" t)))
80 (defcustom gnus-refer-thread-limit 200
81 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
82 If t, fetch all the available old headers."
85 (sexp :menu-tag "other" t)))
87 (defcustom gnus-summary-make-false-root 'adopt
88 "*nil means that Gnus won't gather loose threads.
89 If the root of a thread has expired or been read in a previous
90 session, the information necessary to build a complete thread has been
91 lost. Instead of having many small sub-threads from this original thread
92 scattered all over the summary buffer, Gnus can gather them.
94 If non-nil, Gnus will try to gather all loose sub-threads from an
95 original thread into one large thread.
97 If this variable is non-nil, it should be one of `none', `adopt',
100 If this variable is `none', Gnus will not make a false root, but just
101 present the sub-threads after another.
102 If this variable is `dummy', Gnus will create a dummy root that will
103 have all the sub-threads as children.
104 If this variable is `adopt', Gnus will make one of the \"children\"
105 the parent and mark all the step-children as such.
106 If this variable is `empty', the \"children\" are printed with empty
107 subject fields. (Or rather, they will be printed with a string
108 given by the `gnus-summary-same-subject' variable.)"
110 :type '(choice (const :tag "off" nil)
116 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
117 "*A regexp to match subjects to be excluded from loose thread gathering.
118 As loose thread gathering is done on subjects only, that means that
119 there can be many false gatherings performed. By rooting out certain
120 common subjects, gathering might become saner."
124 (defcustom gnus-summary-gather-subject-limit nil
125 "*Maximum length of subject comparisons when gathering loose threads.
126 Use nil to compare full subjects. Setting this variable to a low
127 number will help gather threads that have been corrupted by
128 newsreaders chopping off subject lines, but it might also mean that
129 unrelated articles that have subject that happen to begin with the
130 same few characters will be incorrectly gathered.
132 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
135 :type '(choice (const :tag "off" nil)
137 (sexp :menu-tag "on" t)))
139 (defcustom gnus-simplify-subject-functions nil
140 "List of functions taking a string argument that simplify subjects.
141 The functions are applied recursively.
143 Useful functions to put in this list include: `gnus-simplify-subject-re',
144 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
146 :type '(repeat function))
148 (defcustom gnus-simplify-ignored-prefixes nil
149 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
151 :type '(choice (const :tag "off" nil)
154 (defcustom gnus-build-sparse-threads nil
155 "*If non-nil, fill in the gaps in threads.
156 If `some', only fill in the gaps that are needed to tie loose threads
157 together. If `more', fill in all leaf nodes that Gnus can find. If
158 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
160 :type '(choice (const :tag "off" nil)
163 (sexp :menu-tag "all" t)))
165 (defcustom gnus-summary-thread-gathering-function
166 'gnus-gather-threads-by-subject
167 "*Function used for gathering loose threads.
168 There are two pre-defined functions: `gnus-gather-threads-by-subject',
169 which only takes Subjects into consideration; and
170 `gnus-gather-threads-by-references', which compared the References
171 headers of the articles to find matches."
173 :type '(radio (function-item gnus-gather-threads-by-subject)
174 (function-item gnus-gather-threads-by-references)
175 (function :tag "other")))
177 (defcustom gnus-summary-same-subject ""
178 "*String indicating that the current article has the same subject as the previous.
179 This variable will only be used if the value of
180 `gnus-summary-make-false-root' is `empty'."
181 :group 'gnus-summary-format
184 (defcustom gnus-summary-goto-unread t
185 "*If t, marking commands will go to the next unread article.
186 If `never', commands that usually go to the next unread article, will
187 go to the next article, whether it is read or not.
188 If nil, only the marking commands will go to the next (un)read article."
189 :group 'gnus-summary-marks
190 :link '(custom-manual "(gnus)Setting Marks")
191 :type '(choice (const :tag "off" nil)
193 (sexp :menu-tag "on" t)))
195 (defcustom gnus-summary-default-score 0
196 "*Default article score level.
197 All scores generated by the score files will be added to this score.
198 If this variable is nil, scoring will be disabled."
199 :group 'gnus-score-default
200 :type '(choice (const :tag "disable")
203 (defcustom gnus-summary-zcore-fuzz 0
204 "*Fuzziness factor for the zcore in the summary buffer.
205 Articles with scores closer than this to `gnus-summary-default-score'
207 :group 'gnus-summary-format
210 (defcustom gnus-simplify-subject-fuzzy-regexp nil
211 "*Strings to be removed when doing fuzzy matches.
212 This can either be a regular expression or list of regular expressions
213 that will be removed from subject strings if fuzzy subject
214 simplification is selected."
216 :type '(repeat regexp))
218 (defcustom gnus-show-threads t
219 "*If non-nil, display threads in summary mode."
223 (defcustom gnus-thread-hide-subtree nil
224 "*If non-nil, hide all threads initially.
225 If threads are hidden, you have to run the command
226 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
227 to expose hidden threads."
231 (defcustom gnus-thread-hide-killed t
232 "*If non-nil, hide killed threads automatically."
236 (defcustom gnus-thread-ignore-subject t
237 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
238 If nil, articles that have different subjects from their parents will
239 start separate threads."
243 (defcustom gnus-thread-operation-ignore-subject t
244 "*If non-nil, subjects will be ignored when doing thread commands.
245 This affects commands like `gnus-summary-kill-thread' and
246 `gnus-summary-lower-thread'.
248 If this variable is nil, articles in the same thread with different
249 subjects will not be included in the operation in question. If this
250 variable is `fuzzy', only articles that have subjects that are fuzzily
251 equal will be included."
253 :type '(choice (const :tag "off" nil)
257 (defcustom gnus-thread-indent-level 4
258 "*Number that says how much each sub-thread should be indented."
262 (defcustom gnus-auto-extend-newsgroup t
263 "*If non-nil, extend newsgroup forward and backward when requested."
264 :group 'gnus-summary-choose
267 (defcustom gnus-auto-select-first t
268 "*If nil, don't select the first unread article when entering a group.
269 If this variable is `best', select the highest-scored unread article
270 in the group. If t, select the first unread article.
272 This variable can also be a function to place point on a likely
273 subject line. Useful values include `gnus-summary-first-unread-subject',
274 `gnus-summary-first-unread-article' and
275 `gnus-summary-best-unread-article'.
277 If you want to prevent automatic selection of the first unread article
278 in some newsgroups, set the variable to nil in
279 `gnus-select-group-hook'."
280 :group 'gnus-group-select
281 :type '(choice (const :tag "none" nil)
283 (sexp :menu-tag "first" t)
284 (function-item gnus-summary-first-unread-subject)
285 (function-item gnus-summary-first-unread-article)
286 (function-item gnus-summary-best-unread-article)))
288 (defcustom gnus-auto-select-next t
289 "*If non-nil, offer to go to the next group from the end of the previous.
290 If the value is t and the next newsgroup is empty, Gnus will exit
291 summary mode and go back to group mode. If the value is neither nil
292 nor t, Gnus will select the following unread newsgroup. In
293 particular, if the value is the symbol `quietly', the next unread
294 newsgroup will be selected without any confirmation, and if it is
295 `almost-quietly', the next group will be selected without any
296 confirmation if you are located on the last article in the group.
297 Finally, if this variable is `slightly-quietly', the `Z n' command
298 will go to the next group without confirmation."
299 :group 'gnus-summary-maneuvering
300 :type '(choice (const :tag "off" nil)
302 (const almost-quietly)
303 (const slightly-quietly)
304 (sexp :menu-tag "on" t)))
306 (defcustom gnus-auto-select-same nil
307 "*If non-nil, select the next article with the same subject.
308 If there are no more articles with the same subject, go to
309 the first unread article."
310 :group 'gnus-summary-maneuvering
313 (defcustom gnus-summary-check-current nil
314 "*If non-nil, consider the current article when moving.
315 The \"unread\" movement commands will stay on the same line if the
316 current article is unread."
317 :group 'gnus-summary-maneuvering
320 (defcustom gnus-auto-center-summary t
321 "*If non-nil, always center the current summary buffer.
322 In particular, if `vertical' do only vertical recentering. If non-nil
323 and non-`vertical', do both horizontal and vertical recentering."
324 :group 'gnus-summary-maneuvering
325 :type '(choice (const :tag "none" nil)
327 (integer :tag "height")
328 (sexp :menu-tag "both" t)))
330 (defcustom gnus-show-all-headers nil
331 "*If non-nil, don't hide any headers."
332 :group 'gnus-article-hiding
333 :group 'gnus-article-headers
336 (defcustom gnus-summary-ignore-duplicates nil
337 "*If non-nil, ignore articles with identical Message-ID headers."
341 (defcustom gnus-single-article-buffer t
342 "*If non-nil, display all articles in the same buffer.
343 If nil, each group will get its own article buffer."
344 :group 'gnus-article-various
347 (defcustom gnus-break-pages t
348 "*If non-nil, do page breaking on articles.
349 The page delimiter is specified by the `gnus-page-delimiter'
351 :group 'gnus-article-various
354 (defcustom gnus-show-mime t
355 "*If non-nil, do mime processing of articles.
356 The articles will simply be fed to the function given by
357 `gnus-article-display-method-for-mime'."
358 :group 'gnus-article-mime
361 (defcustom gnus-move-split-methods nil
362 "*Variable used to suggest where articles are to be moved to.
363 It uses the same syntax as the `gnus-split-methods' variable."
364 :group 'gnus-summary-mail
365 :type '(repeat (choice (list :value (fun) function)
366 (cons :value ("" "") regexp (repeat string))
369 (defcustom gnus-unread-mark ? ;Whitespace
370 "*Mark used for unread articles."
371 :group 'gnus-summary-marks
374 (defcustom gnus-ticked-mark ?!
375 "*Mark used for ticked articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-dormant-mark ??
380 "*Mark used for dormant articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-del-mark ?r
385 "*Mark used for del'd articles."
386 :group 'gnus-summary-marks
389 (defcustom gnus-read-mark ?R
390 "*Mark used for read articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-expirable-mark ?E
395 "*Mark used for expirable articles."
396 :group 'gnus-summary-marks
399 (defcustom gnus-killed-mark ?K
400 "*Mark used for killed articles."
401 :group 'gnus-summary-marks
404 (defcustom gnus-souped-mark ?F
405 "*Mark used for killed articles."
406 :group 'gnus-summary-marks
409 (defcustom gnus-kill-file-mark ?X
410 "*Mark used for articles killed by kill files."
411 :group 'gnus-summary-marks
414 (defcustom gnus-low-score-mark ?Y
415 "*Mark used for articles with a low score."
416 :group 'gnus-summary-marks
419 (defcustom gnus-catchup-mark ?C
420 "*Mark used for articles that are caught up."
421 :group 'gnus-summary-marks
424 (defcustom gnus-replied-mark ?A
425 "*Mark used for articles that have been replied to."
426 :group 'gnus-summary-marks
429 (defcustom gnus-cached-mark ?*
430 "*Mark used for articles that are in the cache."
431 :group 'gnus-summary-marks
434 (defcustom gnus-saved-mark ?S
435 "*Mark used for articles that have been saved to."
436 :group 'gnus-summary-marks
439 (defcustom gnus-ancient-mark ?O
440 "*Mark used for ancient articles."
441 :group 'gnus-summary-marks
444 (defcustom gnus-sparse-mark ?Q
445 "*Mark used for sparsely reffed articles."
446 :group 'gnus-summary-marks
449 (defcustom gnus-canceled-mark ?G
450 "*Mark used for canceled articles."
451 :group 'gnus-summary-marks
454 (defcustom gnus-duplicate-mark ?M
455 "*Mark used for duplicate articles."
456 :group 'gnus-summary-marks
459 (defcustom gnus-undownloaded-mark ?@
460 "*Mark used for articles that weren't downloaded."
461 :group 'gnus-summary-marks
464 (defcustom gnus-downloadable-mark ?%
465 "*Mark used for articles that are to be downloaded."
466 :group 'gnus-summary-marks
469 (defcustom gnus-unsendable-mark ?=
470 "*Mark used for articles that won't be sent."
471 :group 'gnus-summary-marks
474 (defcustom gnus-score-over-mark ?+
475 "*Score mark used for articles with high scores."
476 :group 'gnus-summary-marks
479 (defcustom gnus-score-below-mark ?-
480 "*Score mark used for articles with low scores."
481 :group 'gnus-summary-marks
484 (defcustom gnus-empty-thread-mark ? ;Whitespace
485 "*There is no thread under the article."
486 :group 'gnus-summary-marks
489 (defcustom gnus-not-empty-thread-mark ?=
490 "*There is a thread under the article."
491 :group 'gnus-summary-marks
494 (defcustom gnus-view-pseudo-asynchronously nil
495 "*If non-nil, Gnus will view pseudo-articles asynchronously."
496 :group 'gnus-extract-view
499 (defcustom gnus-auto-expirable-marks
500 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
501 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
502 gnus-souped-mark gnus-duplicate-mark)
503 "*The list of marks converted into expiration if a group is auto-expirable."
505 :type '(repeat character))
507 (defcustom gnus-inhibit-user-auto-expire t
508 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
512 (defcustom gnus-view-pseudos nil
513 "*If `automatic', pseudo-articles will be viewed automatically.
514 If `not-confirm', pseudos will be viewed automatically, and the user
515 will not be asked to confirm the command."
516 :group 'gnus-extract-view
517 :type '(choice (const :tag "off" nil)
519 (const not-confirm)))
521 (defcustom gnus-view-pseudos-separately t
522 "*If non-nil, one pseudo-article will be created for each file to be viewed.
523 If nil, all files that use the same viewing command will be given as a
524 list of parameters to that command."
525 :group 'gnus-extract-view
528 (defcustom gnus-insert-pseudo-articles t
529 "*If non-nil, insert pseudo-articles when decoding articles."
530 :group 'gnus-extract-view
533 (defcustom gnus-summary-dummy-line-format
535 "*The format specification for the dummy roots in the summary buffer.
536 It works along the same lines as a normal formatting string,
537 with some simple extensions.
540 :group 'gnus-threading
543 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
544 "*The format specification for the summary mode line.
545 It works along the same lines as a normal formatting string,
546 with some simple extensions:
549 %p Unprefixed group name
550 %A Current article number
551 %z Current article score
553 %U Number of unread articles in the group
554 %e Number of unselected articles in the group
555 %Z A string with unread/unselected article counts
556 %g Shortish group name
557 %S Subject of the current article
559 %s Current score file name
560 %d Number of dormant articles
561 %r Number of articles that have been marked as read in this session
562 %E Number of articles expunged by the score files"
563 :group 'gnus-summary-format
566 (defcustom gnus-summary-mark-below 0
567 "*Mark all articles with a score below this variable as read.
568 This variable is local to each summary buffer and usually set by the
570 :group 'gnus-score-default
573 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
574 "*List of functions used for sorting articles in the summary buffer.
575 This variable is only used when not using a threaded display."
576 :group 'gnus-summary-sort
577 :type '(repeat (choice (function-item gnus-article-sort-by-number)
578 (function-item gnus-article-sort-by-author)
579 (function-item gnus-article-sort-by-subject)
580 (function-item gnus-article-sort-by-date)
581 (function-item gnus-article-sort-by-score)
582 (function :tag "other"))))
584 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
585 "*List of functions used for sorting threads in the summary buffer.
586 By default, threads are sorted by article number.
588 Each function takes two threads and return non-nil if the first thread
589 should be sorted before the other. If you use more than one function,
590 the primary sort function should be the last. You should probably
591 always include `gnus-thread-sort-by-number' in the list of sorting
592 functions -- preferably first.
594 Ready-made functions include `gnus-thread-sort-by-number',
595 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
596 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
597 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
598 :group 'gnus-summary-sort
599 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
600 (function-item gnus-thread-sort-by-author)
601 (function-item gnus-thread-sort-by-subject)
602 (function-item gnus-thread-sort-by-date)
603 (function-item gnus-thread-sort-by-score)
604 (function-item gnus-thread-sort-by-total-score)
605 (function :tag "other"))))
607 (defcustom gnus-thread-score-function '+
608 "*Function used for calculating the total score of a thread.
610 The function is called with the scores of the article and each
611 subthread and should then return the score of the thread.
613 Some functions you can use are `+', `max', or `min'."
614 :group 'gnus-summary-sort
617 (defcustom gnus-summary-expunge-below nil
618 "All articles that have a score less than this variable will be expunged.
619 This variable is local to the summary buffers."
620 :group 'gnus-score-default
621 :type '(choice (const :tag "off" nil)
624 (defcustom gnus-thread-expunge-below nil
625 "All threads that have a total score less than this variable will be expunged.
626 See `gnus-thread-score-function' for en explanation of what a
629 This variable is local to the summary buffers."
630 :group 'gnus-threading
631 :group 'gnus-score-default
632 :type '(choice (const :tag "off" nil)
635 (defcustom gnus-summary-mode-hook nil
636 "*A hook for Gnus summary mode.
637 This hook is run before any variables are set in the summary buffer."
638 :group 'gnus-summary-various
641 (defcustom gnus-summary-menu-hook nil
642 "*Hook run after the creation of the summary mode menu."
643 :group 'gnus-summary-visual
646 (defcustom gnus-summary-exit-hook nil
647 "*A hook called on exit from the summary buffer.
648 It will be called with point in the group buffer."
649 :group 'gnus-summary-exit
652 (defcustom gnus-summary-prepare-hook nil
653 "*A hook called after the summary buffer has been generated.
654 If you want to modify the summary buffer, you can use this hook."
655 :group 'gnus-summary-various
658 (defcustom gnus-summary-prepared-hook nil
659 "*A hook called as the last thing after the summary buffer has been generated."
660 :group 'gnus-summary-various
663 (defcustom gnus-summary-generate-hook nil
664 "*A hook run just before generating the summary buffer.
665 This hook is commonly used to customize threading variables and the
667 :group 'gnus-summary-various
670 (defcustom gnus-select-group-hook nil
671 "*A hook called when a newsgroup is selected.
673 If you'd like to simplify subjects like the
674 `gnus-summary-next-same-subject' command does, you can use the
677 (setq gnus-select-group-hook
680 (mapcar (lambda (header)
681 (mail-header-set-subject
683 (gnus-simplify-subject
684 (mail-header-subject header) 're-only)))
685 gnus-newsgroup-headers))))"
686 :group 'gnus-group-select
689 (defcustom gnus-select-article-hook nil
690 "*A hook called when an article is selected."
691 :group 'gnus-summary-choose
694 (defcustom gnus-visual-mark-article-hook
695 (list 'gnus-highlight-selected-summary)
696 "*Hook run after selecting an article in the summary buffer.
697 It is meant to be used for highlighting the article in some way. It
698 is not run if `gnus-visual' is nil."
699 :group 'gnus-summary-visual
702 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
703 "*A hook called before parsing the headers."
707 (defcustom gnus-exit-group-hook nil
708 "*A hook called when exiting (not quitting) summary mode."
712 (defcustom gnus-summary-update-hook
713 (list 'gnus-summary-highlight-line)
714 "*A hook called when a summary line is changed.
715 The hook will not be called if `gnus-visual' is nil.
717 The default function `gnus-summary-highlight-line' will
718 highlight the line according to the `gnus-summary-highlight'
720 :group 'gnus-summary-visual
723 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
724 "*A hook called when an article is selected for the first time.
725 The hook is intended to mark an article as read (or unread)
726 automatically when it is selected."
727 :group 'gnus-summary-choose
730 (defcustom gnus-group-no-more-groups-hook nil
731 "*A hook run when returning to group mode having no more (unread) groups."
732 :group 'gnus-group-select
735 (defcustom gnus-ps-print-hook nil
736 "*A hook run before ps-printing something from Gnus."
740 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
741 "Face used for highlighting the current article in the summary buffer."
742 :group 'gnus-summary-visual
745 (defcustom gnus-summary-highlight
746 '(((= mark gnus-canceled-mark)
747 . gnus-summary-cancelled-face)
748 ((and (> score default)
749 (or (= mark gnus-dormant-mark)
750 (= mark gnus-ticked-mark)))
751 . gnus-summary-high-ticked-face)
752 ((and (< score default)
753 (or (= mark gnus-dormant-mark)
754 (= mark gnus-ticked-mark)))
755 . gnus-summary-low-ticked-face)
756 ((or (= mark gnus-dormant-mark)
757 (= mark gnus-ticked-mark))
758 . gnus-summary-normal-ticked-face)
759 ((and (> score default) (= mark gnus-ancient-mark))
760 . gnus-summary-high-ancient-face)
761 ((and (< score default) (= mark gnus-ancient-mark))
762 . gnus-summary-low-ancient-face)
763 ((= mark gnus-ancient-mark)
764 . gnus-summary-normal-ancient-face)
765 ((and (> score default) (= mark gnus-unread-mark))
766 . gnus-summary-high-unread-face)
767 ((and (< score default) (= mark gnus-unread-mark))
768 . gnus-summary-low-unread-face)
769 ((= mark gnus-unread-mark)
770 . gnus-summary-normal-unread-face)
771 ((and (> score default) (memq mark (list gnus-downloadable-mark
772 gnus-undownloaded-mark)))
773 . gnus-summary-high-unread-face)
774 ((and (< score default) (memq mark (list gnus-downloadable-mark
775 gnus-undownloaded-mark)))
776 . gnus-summary-low-unread-face)
777 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
778 . gnus-summary-normal-unread-face)
780 . gnus-summary-high-read-face)
782 . gnus-summary-low-read-face)
784 . gnus-summary-normal-read-face))
785 "*Controls the highlighting of summary buffer lines.
787 A list of (FORM . FACE) pairs. When deciding how a a particular
788 summary line should be displayed, each form is evaluated. The content
789 of the face field after the first true form is used. You can change
790 how those summary lines are displayed, by editing the face field.
792 You can use the following variables in the FORM field.
794 score: The articles score
795 default: The default article score.
796 below: The score below which articles are automatically marked as read.
797 mark: The articles mark."
798 :group 'gnus-summary-visual
799 :type '(repeat (cons (sexp :tag "Form" nil)
802 (defcustom gnus-alter-header-function nil
803 "Function called to allow alteration of article header structures.
804 The function is called with one parameter, the article header vector,
805 which it may alter in any way.")
807 (defcustom gnus-extra-headers nil
808 "*Extra headers to parse."
810 :type '(repeat symbol))
812 (defcustom gnus-ignored-from-addresses
813 (and user-mail-address (regexp-quote user-mail-address))
814 "*Regexp of From headers that may be suppressed in favor of To headers."
818 (defcustom gnus-group-charset-alist
819 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
820 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
821 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
822 ("^relcom\\>" koi8-r)
823 ("^\\(cz\\|hun\\|pl\\|sk\\)\\>" iso-8859-2)
824 ("^israel\\>" iso-8859-1)
826 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
828 "Alist of regexps (to match group names) and default charsets to be used when reading."
829 :type '(repeat (list (regexp :tag "Group")
830 (symbol :tag "Charset")))
831 :group 'gnus-charset)
833 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit)
834 "List of charsets that should be ignored.
835 When these charsets are used in the \"charset\" parameter, the
836 default charset will be used instead."
837 :type '(repeat symbol)
838 :group 'gnus-charset)
840 ;;; Internal variables
842 (defvar gnus-scores-exclude-files nil)
843 (defvar gnus-page-broken nil)
844 (defvar gnus-inhibit-mime-unbuttonizing nil)
846 (defvar gnus-original-article nil)
847 (defvar gnus-article-internal-prepare-hook nil)
848 (defvar gnus-newsgroup-process-stack nil)
850 (defvar gnus-thread-indent-array nil)
851 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
853 ;; Avoid highlighting in kill files.
854 (defvar gnus-summary-inhibit-highlight nil)
855 (defvar gnus-newsgroup-selected-overlay nil)
856 (defvar gnus-inhibit-limiting nil)
857 (defvar gnus-newsgroup-adaptive-score-file nil)
858 (defvar gnus-current-score-file nil)
859 (defvar gnus-current-move-group nil)
860 (defvar gnus-current-copy-group nil)
861 (defvar gnus-current-crosspost-group nil)
863 (defvar gnus-newsgroup-dependencies nil)
864 (defvar gnus-newsgroup-adaptive nil)
865 (defvar gnus-summary-display-article-function nil)
866 (defvar gnus-summary-highlight-line-function nil
867 "Function called after highlighting a summary line.")
869 (defvar gnus-summary-line-format-alist
870 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
871 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
872 (?s gnus-tmp-subject-or-nil ?s)
873 (?n gnus-tmp-name ?s)
874 (?A (std11-address-string
875 (car (mime-read-field 'From gnus-tmp-header))) ?s)
876 (?a (or (std11-full-name-string
877 (car (mime-read-field 'From gnus-tmp-header)))
879 (?F gnus-tmp-from ?s)
880 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
881 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
882 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
883 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
884 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
885 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
886 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
887 (?L gnus-tmp-lines ?d)
888 (?I gnus-tmp-indentation ?s)
889 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
890 (?R gnus-tmp-replied ?c)
891 (?\[ gnus-tmp-opening-bracket ?c)
892 (?\] gnus-tmp-closing-bracket ?c)
893 (?\> (make-string gnus-tmp-level ? ) ?s)
894 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
895 (?i gnus-tmp-score ?d)
896 (?z gnus-tmp-score-char ?c)
897 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
898 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
899 (?U gnus-tmp-unread ?c)
900 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
901 (?t (gnus-summary-number-of-articles-in-thread
902 (and (boundp 'thread) (car thread)) gnus-tmp-level)
904 (?e (gnus-summary-number-of-articles-in-thread
905 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
907 (?u gnus-tmp-user-defined ?s)
908 (?P (gnus-pick-line-number) ?d))
909 "An alist of format specifications that can appear in summary lines,
910 and what variables they correspond with, along with the type of the
911 variable (string, integer, character, etc).")
913 (defvar gnus-summary-dummy-line-format-alist
914 `((?S gnus-tmp-subject ?s)
915 (?N gnus-tmp-number ?d)
916 (?u gnus-tmp-user-defined ?s)))
918 (defvar gnus-summary-mode-line-format-alist
919 `((?G gnus-tmp-group-name ?s)
920 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
921 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
922 (?A gnus-tmp-article-number ?d)
923 (?Z gnus-tmp-unread-and-unselected ?s)
925 (?U gnus-tmp-unread-and-unticked ?d)
926 (?S gnus-tmp-subject ?s)
927 (?e gnus-tmp-unselected ?d)
928 (?u gnus-tmp-user-defined ?s)
929 (?d (length gnus-newsgroup-dormant) ?d)
930 (?t (length gnus-newsgroup-marked) ?d)
931 (?r (length gnus-newsgroup-reads) ?d)
932 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
933 (?E gnus-newsgroup-expunged-tally ?d)
934 (?s (gnus-current-score-file-nondirectory) ?s)))
936 (defvar gnus-last-search-regexp nil
937 "Default regexp for article search command.")
939 (defvar gnus-last-shell-command nil
940 "Default shell command on article.")
942 (defvar gnus-newsgroup-begin nil)
943 (defvar gnus-newsgroup-end nil)
944 (defvar gnus-newsgroup-last-rmail nil)
945 (defvar gnus-newsgroup-last-mail nil)
946 (defvar gnus-newsgroup-last-folder nil)
947 (defvar gnus-newsgroup-last-file nil)
948 (defvar gnus-newsgroup-auto-expire nil)
949 (defvar gnus-newsgroup-active nil)
951 (defvar gnus-newsgroup-data nil)
952 (defvar gnus-newsgroup-data-reverse nil)
953 (defvar gnus-newsgroup-limit nil)
954 (defvar gnus-newsgroup-limits nil)
956 (defvar gnus-newsgroup-unreads nil
957 "List of unread articles in the current newsgroup.")
959 (defvar gnus-newsgroup-unselected nil
960 "List of unselected unread articles in the current newsgroup.")
962 (defvar gnus-newsgroup-reads nil
963 "Alist of read articles and article marks in the current newsgroup.")
965 (defvar gnus-newsgroup-expunged-tally nil)
967 (defvar gnus-newsgroup-marked nil
968 "List of ticked articles in the current newsgroup (a subset of unread art).")
970 (defvar gnus-newsgroup-killed nil
971 "List of ranges of articles that have been through the scoring process.")
973 (defvar gnus-newsgroup-cached nil
974 "List of articles that come from the article cache.")
976 (defvar gnus-newsgroup-saved nil
977 "List of articles that have been saved.")
979 (defvar gnus-newsgroup-kill-headers nil)
981 (defvar gnus-newsgroup-replied nil
982 "List of articles that have been replied to in the current newsgroup.")
984 (defvar gnus-newsgroup-expirable nil
985 "List of articles in the current newsgroup that can be expired.")
987 (defvar gnus-newsgroup-processable nil
988 "List of articles in the current newsgroup that can be processed.")
990 (defvar gnus-newsgroup-downloadable nil
991 "List of articles in the current newsgroup that can be processed.")
993 (defvar gnus-newsgroup-undownloaded nil
994 "List of articles in the current newsgroup that haven't been downloaded..")
996 (defvar gnus-newsgroup-unsendable nil
997 "List of articles in the current newsgroup that won't be sent.")
999 (defvar gnus-newsgroup-bookmarks nil
1000 "List of articles in the current newsgroup that have bookmarks.")
1002 (defvar gnus-newsgroup-dormant nil
1003 "List of dormant articles in the current newsgroup.")
1005 (defvar gnus-newsgroup-scored nil
1006 "List of scored articles in the current newsgroup.")
1008 (defvar gnus-newsgroup-headers nil
1009 "List of article headers in the current newsgroup.")
1011 (defvar gnus-newsgroup-threads nil)
1013 (defvar gnus-newsgroup-prepared nil
1014 "Whether the current group has been prepared properly.")
1016 (defvar gnus-newsgroup-ancient nil
1017 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1019 (defvar gnus-newsgroup-sparse nil)
1021 (defvar gnus-current-article nil)
1022 (defvar gnus-article-current nil)
1023 (defvar gnus-current-headers nil)
1024 (defvar gnus-have-all-headers nil)
1025 (defvar gnus-last-article nil)
1026 (defvar gnus-newsgroup-history nil)
1027 (defvar gnus-newsgroup-charset nil)
1029 (defconst gnus-summary-local-variables
1030 '(gnus-newsgroup-name
1031 gnus-newsgroup-begin gnus-newsgroup-end
1032 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1033 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1034 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1035 gnus-newsgroup-unselected gnus-newsgroup-marked
1036 gnus-newsgroup-reads gnus-newsgroup-saved
1037 gnus-newsgroup-replied gnus-newsgroup-expirable
1038 gnus-newsgroup-processable gnus-newsgroup-killed
1039 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1040 gnus-newsgroup-unsendable
1041 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1042 gnus-newsgroup-headers gnus-newsgroup-threads
1043 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1044 gnus-current-article gnus-current-headers gnus-have-all-headers
1045 gnus-last-article gnus-article-internal-prepare-hook
1046 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1047 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1048 gnus-thread-expunge-below
1049 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1050 (gnus-summary-mark-below . global)
1051 gnus-newsgroup-active gnus-scores-exclude-files
1052 gnus-newsgroup-history gnus-newsgroup-ancient
1053 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1054 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1055 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1056 (gnus-newsgroup-expunged-tally . 0)
1057 gnus-cache-removable-articles gnus-newsgroup-cached
1058 gnus-newsgroup-data gnus-newsgroup-data-reverse
1059 gnus-newsgroup-limit gnus-newsgroup-limits
1060 gnus-newsgroup-charset)
1061 "Variables that are buffer-local to the summary buffers.")
1063 ;; Byte-compiler warning.
1064 (defvar gnus-article-mode-map)
1066 ;; Subject simplification.
1068 (defun gnus-simplify-whitespace (str)
1069 "Remove excessive whitespace."
1072 (while (string-match "[ \t][ \t]+" mystr)
1073 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1075 (substring mystr (match-end 0)))))
1077 (when (string-match "^[ \t]+" mystr)
1078 (setq mystr (substring mystr (match-end 0))))
1080 (when (string-match "[ \t]+$" mystr)
1081 (setq mystr (substring mystr 0 (match-beginning 0))))
1084 (defsubst gnus-simplify-subject-re (subject)
1085 "Remove \"Re:\" from subject lines."
1086 (if (string-match "^[Rr][Ee]: *" subject)
1087 (substring subject (match-end 0))
1090 (defun gnus-simplify-subject (subject &optional re-only)
1091 "Remove `Re:' and words in parentheses.
1092 If RE-ONLY is non-nil, strip leading `Re:'s only."
1093 (let ((case-fold-search t)) ;Ignore case.
1094 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1095 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1096 (setq subject (substring subject (match-end 0))))
1097 ;; Remove uninteresting prefixes.
1098 (when (and (not re-only)
1099 gnus-simplify-ignored-prefixes
1100 (string-match gnus-simplify-ignored-prefixes subject))
1101 (setq subject (substring subject (match-end 0))))
1102 ;; Remove words in parentheses from end.
1104 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1105 (setq subject (substring subject 0 (match-beginning 0)))))
1106 ;; Return subject string.
1109 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1111 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1112 (goto-char (point-min))
1113 (while (re-search-forward regexp nil t)
1114 (replace-match (or newtext ""))))
1116 (defun gnus-simplify-buffer-fuzzy ()
1117 "Simplify string in the buffer fuzzily.
1118 The string in the accessible portion of the current buffer is simplified.
1119 It is assumed to be a single-line subject.
1120 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1121 matter is removed. Additional things can be deleted by setting
1122 gnus-simplify-subject-fuzzy-regexp."
1123 (let ((case-fold-search t)
1125 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1127 (while (not (eq modified-tick (buffer-modified-tick)))
1128 (setq modified-tick (buffer-modified-tick))
1130 ((listp gnus-simplify-subject-fuzzy-regexp)
1131 (mapcar 'gnus-simplify-buffer-fuzzy-step
1132 gnus-simplify-subject-fuzzy-regexp))
1133 (gnus-simplify-subject-fuzzy-regexp
1134 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1135 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1136 (gnus-simplify-buffer-fuzzy-step
1137 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1138 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1140 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1141 (gnus-simplify-buffer-fuzzy-step " +" " ")
1142 (gnus-simplify-buffer-fuzzy-step " $")
1143 (gnus-simplify-buffer-fuzzy-step "^ +")))
1145 (defun gnus-simplify-subject-fuzzy (subject)
1146 "Simplify a subject string fuzzily.
1147 See `gnus-simplify-buffer-fuzzy' for details."
1149 (gnus-set-work-buffer)
1150 (let ((case-fold-search t))
1151 ;; Remove uninteresting prefixes.
1152 (when (and gnus-simplify-ignored-prefixes
1153 (string-match gnus-simplify-ignored-prefixes subject))
1154 (setq subject (substring subject (match-end 0))))
1156 (inline (gnus-simplify-buffer-fuzzy))
1159 (defsubst gnus-simplify-subject-fully (subject)
1160 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1162 (gnus-simplify-subject-functions
1163 (gnus-map-function gnus-simplify-subject-functions subject))
1164 ((null gnus-summary-gather-subject-limit)
1165 (gnus-simplify-subject-re subject))
1166 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1167 (gnus-simplify-subject-fuzzy subject))
1168 ((numberp gnus-summary-gather-subject-limit)
1169 (gnus-limit-string (gnus-simplify-subject-re subject)
1170 gnus-summary-gather-subject-limit))
1174 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1175 "Check whether two subjects are equal.
1176 If optional argument simple-first is t, first argument is already
1179 ((null simple-first)
1180 (equal (gnus-simplify-subject-fully s1)
1181 (gnus-simplify-subject-fully s2)))
1184 (gnus-simplify-subject-fully s2)))))
1186 (defun gnus-summary-bubble-group ()
1187 "Increase the score of the current group.
1188 This is a handy function to add to `gnus-summary-exit-hook' to
1189 increase the score of each group you read."
1190 (gnus-group-add-score gnus-newsgroup-name))
1194 ;;; Gnus summary mode
1197 (put 'gnus-summary-mode 'mode-class 'special)
1200 ;; Non-orthogonal keys
1202 (gnus-define-keys gnus-summary-mode-map
1203 " " gnus-summary-next-page
1204 "\177" gnus-summary-prev-page
1205 [delete] gnus-summary-prev-page
1206 [backspace] gnus-summary-prev-page
1207 "\r" gnus-summary-scroll-up
1208 "\M-\r" gnus-summary-scroll-down
1209 "n" gnus-summary-next-unread-article
1210 "p" gnus-summary-prev-unread-article
1211 "N" gnus-summary-next-article
1212 "P" gnus-summary-prev-article
1213 "\M-\C-n" gnus-summary-next-same-subject
1214 "\M-\C-p" gnus-summary-prev-same-subject
1215 "\M-n" gnus-summary-next-unread-subject
1216 "\M-p" gnus-summary-prev-unread-subject
1217 "." gnus-summary-first-unread-article
1218 "," gnus-summary-best-unread-article
1219 "\M-s" gnus-summary-search-article-forward
1220 "\M-r" gnus-summary-search-article-backward
1221 "<" gnus-summary-beginning-of-article
1222 ">" gnus-summary-end-of-article
1223 "j" gnus-summary-goto-article
1224 "^" gnus-summary-refer-parent-article
1225 "\M-^" gnus-summary-refer-article
1226 "u" gnus-summary-tick-article-forward
1227 "!" gnus-summary-tick-article-forward
1228 "U" gnus-summary-tick-article-backward
1229 "d" gnus-summary-mark-as-read-forward
1230 "D" gnus-summary-mark-as-read-backward
1231 "E" gnus-summary-mark-as-expirable
1232 "\M-u" gnus-summary-clear-mark-forward
1233 "\M-U" gnus-summary-clear-mark-backward
1234 "k" gnus-summary-kill-same-subject-and-select
1235 "\C-k" gnus-summary-kill-same-subject
1236 "\M-\C-k" gnus-summary-kill-thread
1237 "\M-\C-l" gnus-summary-lower-thread
1238 "e" gnus-summary-edit-article
1239 "#" gnus-summary-mark-as-processable
1240 "\M-#" gnus-summary-unmark-as-processable
1241 "\M-\C-t" gnus-summary-toggle-threads
1242 "\M-\C-s" gnus-summary-show-thread
1243 "\M-\C-h" gnus-summary-hide-thread
1244 "\M-\C-f" gnus-summary-next-thread
1245 "\M-\C-b" gnus-summary-prev-thread
1246 "\M-\C-u" gnus-summary-up-thread
1247 "\M-\C-d" gnus-summary-down-thread
1248 "&" gnus-summary-execute-command
1249 "c" gnus-summary-catchup-and-exit
1250 "\C-w" gnus-summary-mark-region-as-read
1251 "\C-t" gnus-summary-toggle-truncation
1252 "?" gnus-summary-mark-as-dormant
1253 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1254 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1255 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1256 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1257 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1258 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1259 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1260 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1261 "=" gnus-summary-expand-window
1262 "\C-x\C-s" gnus-summary-reselect-current-group
1263 "\M-g" gnus-summary-rescan-group
1264 "w" gnus-summary-stop-page-breaking
1265 "\C-c\C-r" gnus-summary-caesar-message
1266 "\M-t" gnus-summary-toggle-mime
1267 "f" gnus-summary-followup
1268 "F" gnus-summary-followup-with-original
1269 "C" gnus-summary-cancel-article
1270 "r" gnus-summary-reply
1271 "R" gnus-summary-reply-with-original
1272 "\C-c\C-f" gnus-summary-mail-forward
1273 "o" gnus-summary-save-article
1274 "\C-o" gnus-summary-save-article-mail
1275 "|" gnus-summary-pipe-output
1276 "\M-k" gnus-summary-edit-local-kill
1277 "\M-K" gnus-summary-edit-global-kill
1279 "\C-c\C-d" gnus-summary-describe-group
1280 "q" gnus-summary-exit
1281 "Q" gnus-summary-exit-no-update
1282 "\C-c\C-i" gnus-info-find-node
1283 gnus-mouse-2 gnus-mouse-pick-article
1284 "m" gnus-summary-mail-other-window
1285 "a" gnus-summary-post-news
1286 "x" gnus-summary-limit-to-unread
1287 "s" gnus-summary-isearch-article
1288 "t" gnus-article-hide-headers
1289 "g" gnus-summary-show-article
1290 "l" gnus-summary-goto-last-article
1291 "v" gnus-summary-preview-mime-message
1292 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1293 "\C-d" gnus-summary-enter-digest-group
1294 "\M-\C-d" gnus-summary-read-document
1295 "\M-\C-e" gnus-summary-edit-parameters
1296 "\M-\C-g" gnus-summary-customize-parameters
1298 "*" gnus-cache-enter-article
1299 "\M-*" gnus-cache-remove-article
1300 "\M-&" gnus-summary-universal-argument
1301 "\C-l" gnus-recenter
1302 "I" gnus-summary-increase-score
1303 "L" gnus-summary-lower-score
1304 "\M-i" gnus-symbolic-argument
1305 "h" gnus-summary-select-article-buffer
1307 "V" gnus-summary-score-map
1308 "X" gnus-uu-extract-map
1309 "S" gnus-summary-send-map)
1311 ;; Sort of orthogonal keymap
1312 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1313 "t" gnus-summary-tick-article-forward
1314 "!" gnus-summary-tick-article-forward
1315 "d" gnus-summary-mark-as-read-forward
1316 "r" gnus-summary-mark-as-read-forward
1317 "c" gnus-summary-clear-mark-forward
1318 " " gnus-summary-clear-mark-forward
1319 "e" gnus-summary-mark-as-expirable
1320 "x" gnus-summary-mark-as-expirable
1321 "?" gnus-summary-mark-as-dormant
1322 "b" gnus-summary-set-bookmark
1323 "B" gnus-summary-remove-bookmark
1324 "#" gnus-summary-mark-as-processable
1325 "\M-#" gnus-summary-unmark-as-processable
1326 "S" gnus-summary-limit-include-expunged
1327 "C" gnus-summary-catchup
1328 "H" gnus-summary-catchup-to-here
1329 "\C-c" gnus-summary-catchup-all
1330 "k" gnus-summary-kill-same-subject-and-select
1331 "K" gnus-summary-kill-same-subject
1332 "P" gnus-uu-mark-map)
1334 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1335 "c" gnus-summary-clear-above
1336 "u" gnus-summary-tick-above
1337 "m" gnus-summary-mark-above
1338 "k" gnus-summary-kill-below)
1340 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1341 "/" gnus-summary-limit-to-subject
1342 "n" gnus-summary-limit-to-articles
1343 "w" gnus-summary-pop-limit
1344 "s" gnus-summary-limit-to-subject
1345 "a" gnus-summary-limit-to-author
1346 "u" gnus-summary-limit-to-unread
1347 "m" gnus-summary-limit-to-marks
1348 "M" gnus-summary-limit-exclude-marks
1349 "v" gnus-summary-limit-to-score
1350 "*" gnus-summary-limit-include-cached
1351 "D" gnus-summary-limit-include-dormant
1352 "T" gnus-summary-limit-include-thread
1353 "d" gnus-summary-limit-exclude-dormant
1354 "t" gnus-summary-limit-to-age
1355 "E" gnus-summary-limit-include-expunged
1356 "c" gnus-summary-limit-exclude-childless-dormant
1357 "C" gnus-summary-limit-mark-excluded-as-read)
1359 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1360 "n" gnus-summary-next-unread-article
1361 "p" gnus-summary-prev-unread-article
1362 "N" gnus-summary-next-article
1363 "P" gnus-summary-prev-article
1364 "\C-n" gnus-summary-next-same-subject
1365 "\C-p" gnus-summary-prev-same-subject
1366 "\M-n" gnus-summary-next-unread-subject
1367 "\M-p" gnus-summary-prev-unread-subject
1368 "f" gnus-summary-first-unread-article
1369 "b" gnus-summary-best-unread-article
1370 "j" gnus-summary-goto-article
1371 "g" gnus-summary-goto-subject
1372 "l" gnus-summary-goto-last-article
1373 "o" gnus-summary-pop-article)
1375 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1376 "k" gnus-summary-kill-thread
1377 "l" gnus-summary-lower-thread
1378 "i" gnus-summary-raise-thread
1379 "T" gnus-summary-toggle-threads
1380 "t" gnus-summary-rethread-current
1381 "^" gnus-summary-reparent-thread
1382 "s" gnus-summary-show-thread
1383 "S" gnus-summary-show-all-threads
1384 "h" gnus-summary-hide-thread
1385 "H" gnus-summary-hide-all-threads
1386 "n" gnus-summary-next-thread
1387 "p" gnus-summary-prev-thread
1388 "u" gnus-summary-up-thread
1389 "o" gnus-summary-top-thread
1390 "d" gnus-summary-down-thread
1391 "#" gnus-uu-mark-thread
1392 "\M-#" gnus-uu-unmark-thread)
1394 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1395 "g" gnus-summary-prepare
1396 "c" gnus-summary-insert-cached-articles)
1398 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1399 "c" gnus-summary-catchup-and-exit
1400 "C" gnus-summary-catchup-all-and-exit
1401 "E" gnus-summary-exit-no-update
1402 "Q" gnus-summary-exit
1403 "Z" gnus-summary-exit
1404 "n" gnus-summary-catchup-and-goto-next-group
1405 "R" gnus-summary-reselect-current-group
1406 "G" gnus-summary-rescan-group
1407 "N" gnus-summary-next-group
1408 "s" gnus-summary-save-newsrc
1409 "P" gnus-summary-prev-group)
1411 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1412 " " gnus-summary-next-page
1413 "n" gnus-summary-next-page
1414 "\177" gnus-summary-prev-page
1415 [delete] gnus-summary-prev-page
1416 "p" gnus-summary-prev-page
1417 "\r" gnus-summary-scroll-up
1418 "\M-\r" gnus-summary-scroll-down
1419 "<" gnus-summary-beginning-of-article
1420 ">" gnus-summary-end-of-article
1421 "b" gnus-summary-beginning-of-article
1422 "e" gnus-summary-end-of-article
1423 "^" gnus-summary-refer-parent-article
1424 "r" gnus-summary-refer-parent-article
1425 "R" gnus-summary-refer-references
1426 "T" gnus-summary-refer-thread
1427 "g" gnus-summary-show-article
1428 "s" gnus-summary-isearch-article
1429 "P" gnus-summary-print-article)
1431 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1432 "b" gnus-article-add-buttons
1433 "B" gnus-article-add-buttons-to-head
1434 "o" gnus-article-treat-overstrike
1435 "e" gnus-article-emphasize
1436 "w" gnus-article-fill-cited-article
1437 "Q" gnus-article-fill-long-lines
1438 "C" gnus-article-capitalize-sentences
1439 "c" gnus-article-remove-cr
1440 "f" gnus-article-display-x-face
1441 "l" gnus-summary-stop-page-breaking
1442 "r" gnus-summary-caesar-message
1443 "t" gnus-article-hide-headers
1444 "v" gnus-summary-verbose-headers
1445 "m" gnus-summary-toggle-mime
1446 "h" gnus-article-treat-html
1447 "d" gnus-article-treat-dumbquotes)
1449 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1450 "a" gnus-article-hide
1451 "h" gnus-article-hide-headers
1452 "b" gnus-article-hide-boring-headers
1453 "s" gnus-article-hide-signature
1454 "c" gnus-article-hide-citation
1455 "C" gnus-article-hide-citation-in-followups
1456 "p" gnus-article-hide-pgp
1457 "B" gnus-article-strip-banner
1458 "P" gnus-article-hide-pem
1459 "\C-c" gnus-article-hide-citation-maybe)
1461 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1462 "a" gnus-article-highlight
1463 "h" gnus-article-highlight-headers
1464 "c" gnus-article-highlight-citation
1465 "s" gnus-article-highlight-signature)
1467 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1468 "z" gnus-article-date-ut
1469 "u" gnus-article-date-ut
1470 "l" gnus-article-date-local
1471 "e" gnus-article-date-lapsed
1472 "o" gnus-article-date-original
1473 "i" gnus-article-date-iso8601
1474 "s" gnus-article-date-user)
1476 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1477 "t" gnus-article-remove-trailing-blank-lines
1478 "l" gnus-article-strip-leading-blank-lines
1479 "m" gnus-article-strip-multiple-blank-lines
1480 "a" gnus-article-strip-blank-lines
1481 "A" gnus-article-strip-all-blank-lines
1482 "s" gnus-article-strip-leading-space
1483 "e" gnus-article-strip-trailing-space)
1485 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1487 "f" gnus-summary-fetch-faq
1488 "d" gnus-summary-describe-group
1489 "h" gnus-summary-describe-briefly
1490 "i" gnus-info-find-node)
1492 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1493 "e" gnus-summary-expire-articles
1494 "\M-\C-e" gnus-summary-expire-articles-now
1495 "\177" gnus-summary-delete-article
1496 [delete] gnus-summary-delete-article
1497 "m" gnus-summary-move-article
1498 "r" gnus-summary-respool-article
1499 "w" gnus-summary-edit-article
1500 "c" gnus-summary-copy-article
1501 "B" gnus-summary-crosspost-article
1502 "q" gnus-summary-respool-query
1503 "t" gnus-summary-respool-trace
1504 "i" gnus-summary-import-article
1505 "p" gnus-summary-article-posted-p)
1507 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1508 "o" gnus-summary-save-article
1509 "m" gnus-summary-save-article-mail
1510 "F" gnus-summary-write-article-file
1511 "r" gnus-summary-save-article-rmail
1512 "f" gnus-summary-save-article-file
1513 "b" gnus-summary-save-article-body-file
1514 "h" gnus-summary-save-article-folder
1515 "v" gnus-summary-save-article-vm
1516 "p" gnus-summary-pipe-output
1517 "s" gnus-soup-add-article)
1519 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1520 "b" gnus-summary-display-buttonized
1521 "m" gnus-summary-repair-multipart
1522 "v" gnus-article-view-part
1523 "o" gnus-article-save-part
1524 "c" gnus-article-copy-part
1525 "e" gnus-article-externalize-part
1526 "i" gnus-article-inline-part
1527 "|" gnus-article-pipe-part)
1530 (defun gnus-summary-make-menu-bar ()
1531 (gnus-turn-off-edit-menu 'summary)
1533 (unless (boundp 'gnus-summary-misc-menu)
1536 gnus-summary-kill-menu gnus-summary-mode-map ""
1541 ["Enter score..." gnus-summary-score-entry t]
1542 ["Customize" gnus-score-customize t])
1543 (gnus-make-score-map 'increase)
1544 (gnus-make-score-map 'lower)
1546 ["Kill below" gnus-summary-kill-below t]
1547 ["Mark above" gnus-summary-mark-above t]
1548 ["Tick above" gnus-summary-tick-above t]
1549 ["Clear above" gnus-summary-clear-above t])
1550 ["Current score" gnus-summary-current-score t]
1551 ["Set score" gnus-summary-set-score t]
1552 ["Switch current score file..." gnus-score-change-score-file t]
1553 ["Set mark below..." gnus-score-set-mark-below t]
1554 ["Set expunge below..." gnus-score-set-expunge-below t]
1555 ["Edit current score file" gnus-score-edit-current-scores t]
1556 ["Edit score file" gnus-score-edit-file t]
1557 ["Trace score" gnus-score-find-trace t]
1558 ["Find words" gnus-score-find-favourite-words t]
1559 ["Rescore buffer" gnus-summary-rescore t]
1560 ["Increase score..." gnus-summary-increase-score t]
1561 ["Lower score..." gnus-summary-lower-score t]))))
1563 ;; Define both the Article menu in the summary buffer and the equivalent
1564 ;; Commands menu in the article buffer here for consistency.
1567 ["All" gnus-article-hide t]
1568 ["Headers" gnus-article-hide-headers t]
1569 ["Signature" gnus-article-hide-signature t]
1570 ["Citation" gnus-article-hide-citation t]
1571 ["PGP" gnus-article-hide-pgp t]
1572 ["Banner" gnus-article-strip-banner t]
1573 ["Boring headers" gnus-article-hide-boring-headers t])
1575 ["All" gnus-article-highlight t]
1576 ["Headers" gnus-article-highlight-headers t]
1577 ["Signature" gnus-article-highlight-signature t]
1578 ["Citation" gnus-article-highlight-citation t])
1580 ["Local" gnus-article-date-local t]
1581 ["ISO8601" gnus-article-date-iso8601 t]
1582 ["UT" gnus-article-date-ut t]
1583 ["Original" gnus-article-date-original t]
1584 ["Lapsed" gnus-article-date-lapsed t]
1585 ["User-defined" gnus-article-date-user t])
1588 ["Leading" gnus-article-strip-leading-blank-lines t]
1589 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1590 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1591 ["All of the above" gnus-article-strip-blank-lines t]
1592 ["All" gnus-article-strip-all-blank-lines t]
1593 ["Leading space" gnus-article-strip-leading-space t]
1594 ["Trailing space" gnus-article-strip-trailing-space t])
1595 ["Overstrike" gnus-article-treat-overstrike t]
1596 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1597 ["Emphasis" gnus-article-emphasize t]
1598 ["Word wrap" gnus-article-fill-cited-article t]
1599 ["Fill long lines" gnus-article-fill-long-lines t]
1600 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1601 ["CR" gnus-article-remove-cr t]
1602 ["Show X-Face" gnus-article-display-x-face t]
1603 ["UnHTMLize" gnus-article-treat-html t]
1604 ["Rot 13" gnus-summary-caesar-message t]
1605 ["Unix pipe" gnus-summary-pipe-message t]
1606 ["Add buttons" gnus-article-add-buttons t]
1607 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1608 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1609 ["Toggle MIME" gnus-summary-toggle-mime t]
1610 ["Verbose header" gnus-summary-verbose-headers t]
1611 ["Toggle header" gnus-summary-toggle-header t])
1613 ["Save in default format" gnus-summary-save-article t]
1614 ["Save in file" gnus-summary-save-article-file t]
1615 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1616 ["Save in MH folder" gnus-summary-save-article-folder t]
1617 ["Save in VM folder" gnus-summary-save-article-vm t]
1618 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1619 ["Save body in file" gnus-summary-save-article-body-file t]
1620 ["Pipe through a filter" gnus-summary-pipe-output t]
1621 ["Add to SOUP packet" gnus-soup-add-article t]
1622 ["Print" gnus-summary-print-article t])
1624 ["Respool article..." gnus-summary-respool-article t]
1625 ["Move article..." gnus-summary-move-article
1626 (gnus-check-backend-function
1627 'request-move-article gnus-newsgroup-name)]
1628 ["Copy article..." gnus-summary-copy-article t]
1629 ["Crosspost article..." gnus-summary-crosspost-article
1630 (gnus-check-backend-function
1631 'request-replace-article gnus-newsgroup-name)]
1632 ["Import file..." gnus-summary-import-article t]
1633 ["Check if posted" gnus-summary-article-posted-p t]
1634 ["Edit article" gnus-summary-edit-article
1635 (not (gnus-group-read-only-p))]
1636 ["Delete article" gnus-summary-delete-article
1637 (gnus-check-backend-function
1638 'request-expire-articles gnus-newsgroup-name)]
1639 ["Query respool" gnus-summary-respool-query t]
1640 ["Trace respool" gnus-summary-respool-trace t]
1641 ["Delete expirable articles" gnus-summary-expire-articles-now
1642 (gnus-check-backend-function
1643 'request-expire-articles gnus-newsgroup-name)])
1645 ["Uudecode" gnus-uu-decode-uu t]
1646 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1647 ["Unshar" gnus-uu-decode-unshar t]
1648 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1649 ["Save" gnus-uu-decode-save t]
1650 ["Binhex" gnus-uu-decode-binhex t]
1651 ["Postscript" gnus-uu-decode-postscript t])
1653 ["Enter article" gnus-cache-enter-article t]
1654 ["Remove article" gnus-cache-remove-article t])
1655 ["Select article buffer" gnus-summary-select-article-buffer t]
1656 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1657 ["Isearch article..." gnus-summary-isearch-article t]
1658 ["Beginning of the article" gnus-summary-beginning-of-article t]
1659 ["End of the article" gnus-summary-end-of-article t]
1660 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1661 ["Fetch referenced articles" gnus-summary-refer-references t]
1662 ["Fetch current thread" gnus-summary-refer-thread t]
1663 ["Fetch article with id..." gnus-summary-refer-article t]
1664 ["Redisplay" gnus-summary-show-article t])))
1666 gnus-summary-article-menu gnus-summary-mode-map ""
1667 (cons "Article" innards))
1670 gnus-article-commands-menu gnus-article-mode-map ""
1671 (cons "Commands" innards)))
1674 gnus-summary-thread-menu gnus-summary-mode-map ""
1676 ["Toggle threading" gnus-summary-toggle-threads t]
1677 ["Hide threads" gnus-summary-hide-all-threads t]
1678 ["Show threads" gnus-summary-show-all-threads t]
1679 ["Hide thread" gnus-summary-hide-thread t]
1680 ["Show thread" gnus-summary-show-thread t]
1681 ["Go to next thread" gnus-summary-next-thread t]
1682 ["Go to previous thread" gnus-summary-prev-thread t]
1683 ["Go down thread" gnus-summary-down-thread t]
1684 ["Go up thread" gnus-summary-up-thread t]
1685 ["Top of thread" gnus-summary-top-thread t]
1686 ["Mark thread as read" gnus-summary-kill-thread t]
1687 ["Lower thread score" gnus-summary-lower-thread t]
1688 ["Raise thread score" gnus-summary-raise-thread t]
1689 ["Rethread current" gnus-summary-rethread-current t]
1693 gnus-summary-post-menu gnus-summary-mode-map ""
1695 ["Post an article" gnus-summary-post-news t]
1696 ["Followup" gnus-summary-followup t]
1697 ["Followup and yank" gnus-summary-followup-with-original t]
1698 ["Supersede article" gnus-summary-supersede-article t]
1699 ["Cancel article" gnus-summary-cancel-article t]
1700 ["Reply" gnus-summary-reply t]
1701 ["Reply and yank" gnus-summary-reply-with-original t]
1702 ["Wide reply" gnus-summary-wide-reply t]
1703 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1704 ["Mail forward" gnus-summary-mail-forward t]
1705 ["Post forward" gnus-summary-post-forward t]
1706 ["Digest and mail" gnus-summary-mail-digest t]
1707 ["Digest and post" gnus-summary-post-digest t]
1708 ["Resend message" gnus-summary-resend-message t]
1709 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1710 ["Send a mail" gnus-summary-mail-other-window t]
1711 ["Uuencode and post" gnus-uu-post-news t]
1712 ["Followup via news" gnus-summary-followup-to-mail t]
1713 ["Followup via news and yank"
1714 gnus-summary-followup-to-mail-with-original t]
1716 ;;["Send" gnus-summary-send-draft t]
1717 ;;["Send bounced" gnus-resend-bounced-mail t])
1721 gnus-summary-misc-menu gnus-summary-mode-map ""
1724 ["Mark as read" gnus-summary-mark-as-read-forward t]
1725 ["Mark same subject and select"
1726 gnus-summary-kill-same-subject-and-select t]
1727 ["Mark same subject" gnus-summary-kill-same-subject t]
1728 ["Catchup" gnus-summary-catchup t]
1729 ["Catchup all" gnus-summary-catchup-all t]
1730 ["Catchup to here" gnus-summary-catchup-to-here t]
1731 ["Catchup region" gnus-summary-mark-region-as-read t]
1732 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1734 ["Tick" gnus-summary-tick-article-forward t]
1735 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1736 ["Remove marks" gnus-summary-clear-mark-forward t]
1737 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1738 ["Set bookmark" gnus-summary-set-bookmark t]
1739 ["Remove bookmark" gnus-summary-remove-bookmark t])
1741 ["Marks..." gnus-summary-limit-to-marks t]
1742 ["Subject..." gnus-summary-limit-to-subject t]
1743 ["Author..." gnus-summary-limit-to-author t]
1744 ["Age..." gnus-summary-limit-to-age t]
1745 ["Score" gnus-summary-limit-to-score t]
1746 ["Unread" gnus-summary-limit-to-unread t]
1747 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1748 ["Articles" gnus-summary-limit-to-articles t]
1749 ["Pop limit" gnus-summary-pop-limit t]
1750 ["Show dormant" gnus-summary-limit-include-dormant t]
1751 ["Hide childless dormant"
1752 gnus-summary-limit-exclude-childless-dormant t]
1753 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1754 ["Hide marked" gnus-summary-limit-exclude-marks t]
1755 ["Show expunged" gnus-summary-show-all-expunged t])
1757 ["Set mark" gnus-summary-mark-as-processable t]
1758 ["Remove mark" gnus-summary-unmark-as-processable t]
1759 ["Remove all marks" gnus-summary-unmark-all-processable t]
1760 ["Mark above" gnus-uu-mark-over t]
1761 ["Mark series" gnus-uu-mark-series t]
1762 ["Mark region" gnus-uu-mark-region t]
1763 ["Unmark region" gnus-uu-unmark-region t]
1764 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1765 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1766 ["Mark all" gnus-uu-mark-all t]
1767 ["Mark buffer" gnus-uu-mark-buffer t]
1768 ["Mark sparse" gnus-uu-mark-sparse t]
1769 ["Mark thread" gnus-uu-mark-thread t]
1770 ["Unmark thread" gnus-uu-unmark-thread t]
1771 ("Process Mark Sets"
1772 ["Kill" gnus-summary-kill-process-mark t]
1773 ["Yank" gnus-summary-yank-process-mark
1774 gnus-newsgroup-process-stack]
1775 ["Save" gnus-summary-save-process-mark t]))
1777 ["Page forward" gnus-summary-next-page t]
1778 ["Page backward" gnus-summary-prev-page t]
1779 ["Line forward" gnus-summary-scroll-up t])
1781 ["Next unread article" gnus-summary-next-unread-article t]
1782 ["Previous unread article" gnus-summary-prev-unread-article t]
1783 ["Next article" gnus-summary-next-article t]
1784 ["Previous article" gnus-summary-prev-article t]
1785 ["Next unread subject" gnus-summary-next-unread-subject t]
1786 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1787 ["Next article same subject" gnus-summary-next-same-subject t]
1788 ["Previous article same subject" gnus-summary-prev-same-subject t]
1789 ["First unread article" gnus-summary-first-unread-article t]
1790 ["Best unread article" gnus-summary-best-unread-article t]
1791 ["Go to subject number..." gnus-summary-goto-subject t]
1792 ["Go to article number..." gnus-summary-goto-article t]
1793 ["Go to the last article" gnus-summary-goto-last-article t]
1794 ["Pop article off history" gnus-summary-pop-article t])
1796 ["Sort by number" gnus-summary-sort-by-number t]
1797 ["Sort by author" gnus-summary-sort-by-author t]
1798 ["Sort by subject" gnus-summary-sort-by-subject t]
1799 ["Sort by date" gnus-summary-sort-by-date t]
1800 ["Sort by score" gnus-summary-sort-by-score t]
1801 ["Sort by lines" gnus-summary-sort-by-lines t]
1802 ["Sort by characters" gnus-summary-sort-by-chars t])
1804 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1805 ["Describe group" gnus-summary-describe-group t]
1806 ["Read manual" gnus-info-find-node t])
1808 ["Pick and read" gnus-pick-mode t]
1809 ["Binary" gnus-binary-mode t])
1811 ["Regenerate" gnus-summary-prepare t]
1812 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1813 ["Toggle threading" gnus-summary-toggle-threads t])
1814 ["Filter articles..." gnus-summary-execute-command t]
1815 ["Run command on subjects..." gnus-summary-universal-argument t]
1816 ["Search articles forward..." gnus-summary-search-article-forward t]
1817 ["Search articles backward..." gnus-summary-search-article-backward t]
1818 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1819 ["Expand window" gnus-summary-expand-window t]
1820 ["Expire expirable articles" gnus-summary-expire-articles
1821 (gnus-check-backend-function
1822 'request-expire-articles gnus-newsgroup-name)]
1823 ["Edit local kill file" gnus-summary-edit-local-kill t]
1824 ["Edit main kill file" gnus-summary-edit-global-kill t]
1825 ["Edit group parameters" gnus-summary-edit-parameters t]
1826 ["Customize group parameters" gnus-summary-customize-parameters t]
1827 ["Send a bug report" gnus-bug t]
1829 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1830 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1831 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1832 ["Exit group" gnus-summary-exit t]
1833 ["Exit group without updating" gnus-summary-exit-no-update t]
1834 ["Exit and goto next group" gnus-summary-next-group t]
1835 ["Exit and goto prev group" gnus-summary-prev-group t]
1836 ["Reselect group" gnus-summary-reselect-current-group t]
1837 ["Rescan group" gnus-summary-rescan-group t]
1838 ["Update dribble" gnus-summary-save-newsrc t])))
1840 (gnus-run-hooks 'gnus-summary-menu-hook)))
1842 (defun gnus-score-set-default (var value)
1843 "A version of set that updates the GNU Emacs menu-bar."
1845 ;; It is the message that forces the active status to be updated.
1848 (defun gnus-make-score-map (type)
1849 "Make a summary score map of type TYPE."
1852 (let ((headers '(("author" "from" string)
1853 ("subject" "subject" string)
1854 ("article body" "body" string)
1855 ("article head" "head" string)
1856 ("xref" "xref" string)
1857 ("extra header" "extra" string)
1858 ("lines" "lines" number)
1859 ("followups to author" "followup" string)))
1860 (types '((number ("less than" <)
1863 (string ("substring" s)
1867 (perms '(("temporary" (current-time-string))
1875 (if (eq type 'lower)
1880 (setq header (car headers))
1886 (let ((ts (cdr (assoc (nth 2 header) types)))
1902 'gnus-summary-score-entry
1904 (if (or (string= (nth 1 header)
1906 (string= (nth 1 header)
1909 (list 'gnus-summary-header
1911 (list 'quote (nth 1 (car ts)))
1912 (list 'gnus-score-default nil)
1918 (list (nreverse outp))))
1921 (list (nreverse outt))))
1923 (setq headers (cdr headers)))
1924 (list (nreverse outh))))))))
1928 (defun gnus-summary-mode (&optional group)
1929 "Major mode for reading articles.
1931 All normal editing commands are switched off.
1932 \\<gnus-summary-mode-map>
1933 Each line in this buffer represents one article. To read an
1934 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1935 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1938 You can also post articles and send mail from this buffer. To
1939 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1940 of an article, type `\\[gnus-summary-reply]'.
1942 There are approx. one gazillion commands you can execute in this
1943 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1945 The following commands are available:
1947 \\{gnus-summary-mode-map}"
1949 (when (gnus-visual-p 'summary-menu 'menu)
1950 (gnus-summary-make-menu-bar))
1951 (kill-all-local-variables)
1952 (gnus-summary-make-local-variables)
1953 (gnus-make-thread-indent-array)
1954 (gnus-simplify-mode-line)
1955 (setq major-mode 'gnus-summary-mode)
1956 (setq mode-name "Summary")
1957 (make-local-variable 'minor-mode-alist)
1958 (use-local-map gnus-summary-mode-map)
1959 (buffer-disable-undo)
1960 (setq buffer-read-only t) ;Disable modification
1961 (setq truncate-lines t)
1962 (setq selective-display t)
1963 (setq selective-display-ellipses t) ;Display `...'
1964 (gnus-summary-set-display-table)
1965 (gnus-set-default-directory)
1966 (setq gnus-newsgroup-name group)
1967 (make-local-variable 'gnus-summary-line-format)
1968 (make-local-variable 'gnus-summary-line-format-spec)
1969 (make-local-variable 'gnus-summary-dummy-line-format)
1970 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1971 (make-local-variable 'gnus-summary-mark-positions)
1972 (make-local-hook 'pre-command-hook)
1973 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1974 (gnus-run-hooks 'gnus-summary-mode-hook)
1975 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1976 (gnus-update-summary-mark-positions))
1978 (defun gnus-summary-make-local-variables ()
1979 "Make all the local summary buffer variables."
1981 (dolist (local gnus-summary-local-variables)
1984 (if (eq (cdr local) 'global)
1985 ;; Copy the global value of the variable.
1986 (setq global (symbol-value (car local)))
1987 ;; Use the value from the list.
1988 (setq global (eval (cdr local))))
1989 (set (make-local-variable (car local)) global))
1990 ;; Simple nil-valued local variable.
1991 (set (make-local-variable local) nil)))))
1993 (defun gnus-summary-clear-local-variables ()
1994 (let ((locals gnus-summary-local-variables))
1996 (if (consp (car locals))
1997 (and (vectorp (caar locals))
1998 (set (caar locals) nil))
1999 (and (vectorp (car locals))
2000 (set (car locals) nil)))
2001 (setq locals (cdr locals)))))
2003 ;; Summary data functions.
2005 (defmacro gnus-data-number (data)
2008 (defmacro gnus-data-set-number (data number)
2009 `(setcar ,data ,number))
2011 (defmacro gnus-data-mark (data)
2014 (defmacro gnus-data-set-mark (data mark)
2015 `(setcar (nthcdr 1 ,data) ,mark))
2017 (defmacro gnus-data-pos (data)
2020 (defmacro gnus-data-set-pos (data pos)
2021 `(setcar (nthcdr 2 ,data) ,pos))
2023 (defmacro gnus-data-header (data)
2026 (defmacro gnus-data-set-header (data header)
2027 `(setf (nth 3 ,data) ,header))
2029 (defmacro gnus-data-level (data)
2032 (defmacro gnus-data-unread-p (data)
2033 `(= (nth 1 ,data) gnus-unread-mark))
2035 (defmacro gnus-data-read-p (data)
2036 `(/= (nth 1 ,data) gnus-unread-mark))
2038 (defmacro gnus-data-pseudo-p (data)
2039 `(consp (nth 3 ,data)))
2041 (defmacro gnus-data-find (number)
2042 `(assq ,number gnus-newsgroup-data))
2044 (defmacro gnus-data-find-list (number &optional data)
2045 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2046 (memq (assq ,number bdata)
2049 (defmacro gnus-data-make (number mark pos header level)
2050 `(list ,number ,mark ,pos ,header ,level))
2052 (defun gnus-data-enter (after-article number mark pos header level offset)
2053 (let ((data (gnus-data-find-list after-article)))
2055 (error "No such article: %d" after-article))
2056 (setcdr data (cons (gnus-data-make number mark pos header level)
2058 (setq gnus-newsgroup-data-reverse nil)
2059 (gnus-data-update-list (cddr data) offset)))
2061 (defun gnus-data-enter-list (after-article list &optional offset)
2063 (let ((data (and after-article (gnus-data-find-list after-article)))
2067 (let ((odata gnus-newsgroup-data))
2068 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2070 (gnus-data-update-list odata offset)))
2071 ;; Find the last element in the list to be spliced into the main
2074 (setq list (cdr list)))
2077 (setcdr list gnus-newsgroup-data)
2078 (setq gnus-newsgroup-data ilist)
2080 (gnus-data-update-list (cdr list) offset)))
2081 (setcdr list (cdr data))
2084 (gnus-data-update-list (cdr list) offset))))
2085 (setq gnus-newsgroup-data-reverse nil))))
2087 (defun gnus-data-remove (article &optional offset)
2088 (let ((data gnus-newsgroup-data))
2089 (if (= (gnus-data-number (car data)) article)
2091 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2092 gnus-newsgroup-data-reverse nil)
2094 (gnus-data-update-list gnus-newsgroup-data offset)))
2096 (when (= (gnus-data-number (cadr data)) article)
2097 (setcdr data (cddr data))
2099 (gnus-data-update-list (cdr data) offset))
2101 gnus-newsgroup-data-reverse nil))
2102 (setq data (cdr data))))))
2104 (defmacro gnus-data-list (backward)
2106 (or gnus-newsgroup-data-reverse
2107 (setq gnus-newsgroup-data-reverse
2108 (reverse gnus-newsgroup-data)))
2109 gnus-newsgroup-data))
2111 (defun gnus-data-update-list (data offset)
2112 "Add OFFSET to the POS of all data entries in DATA."
2113 (setq gnus-newsgroup-data-reverse nil)
2115 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2116 (setq data (cdr data))))
2118 (defun gnus-summary-article-pseudo-p (article)
2119 "Say whether this article is a pseudo article or not."
2120 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2122 (defmacro gnus-summary-article-sparse-p (article)
2123 "Say whether this article is a sparse article or not."
2124 `(memq ,article gnus-newsgroup-sparse))
2126 (defmacro gnus-summary-article-ancient-p (article)
2127 "Say whether this article is a sparse article or not."
2128 `(memq ,article gnus-newsgroup-ancient))
2130 (defun gnus-article-parent-p (number)
2131 "Say whether this article is a parent or not."
2132 (let ((data (gnus-data-find-list number)))
2133 (and (cdr data) ; There has to be an article after...
2134 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2135 (gnus-data-level (nth 1 data))))))
2137 (defun gnus-article-children (number)
2138 "Return a list of all children to NUMBER."
2139 (let* ((data (gnus-data-find-list number))
2140 (level (gnus-data-level (car data)))
2142 (setq data (cdr data))
2144 (= (gnus-data-level (car data)) (1+ level)))
2145 (push (gnus-data-number (car data)) children)
2146 (setq data (cdr data)))
2149 (defmacro gnus-summary-skip-intangible ()
2150 "If the current article is intangible, then jump to a different article."
2151 '(let ((to (get-text-property (point) 'gnus-intangible)))
2152 (and to (gnus-summary-goto-subject to))))
2154 (defmacro gnus-summary-article-intangible-p ()
2155 "Say whether this article is intangible or not."
2156 '(get-text-property (point) 'gnus-intangible))
2158 (defun gnus-article-read-p (article)
2159 "Say whether ARTICLE is read or not."
2160 (not (or (memq article gnus-newsgroup-marked)
2161 (memq article gnus-newsgroup-unreads)
2162 (memq article gnus-newsgroup-unselected)
2163 (memq article gnus-newsgroup-dormant))))
2165 ;; Some summary mode macros.
2167 (defmacro gnus-summary-article-number ()
2168 "The article number of the article on the current line.
2169 If there isn's an article number here, then we return the current
2172 (gnus-summary-skip-intangible)
2173 (or (get-text-property (point) 'gnus-number)
2174 (gnus-summary-last-subject))))
2176 (defmacro gnus-summary-article-header (&optional number)
2177 "Return the header of article NUMBER."
2178 `(gnus-data-header (gnus-data-find
2179 ,(or number '(gnus-summary-article-number)))))
2181 (defmacro gnus-summary-thread-level (&optional number)
2182 "Return the level of thread that starts with article NUMBER."
2183 `(if (and (eq gnus-summary-make-false-root 'dummy)
2184 (get-text-property (point) 'gnus-intangible))
2186 (gnus-data-level (gnus-data-find
2187 ,(or number '(gnus-summary-article-number))))))
2189 (defmacro gnus-summary-article-mark (&optional number)
2190 "Return the mark of article NUMBER."
2191 `(gnus-data-mark (gnus-data-find
2192 ,(or number '(gnus-summary-article-number)))))
2194 (defmacro gnus-summary-article-pos (&optional number)
2195 "Return the position of the line of article NUMBER."
2196 `(gnus-data-pos (gnus-data-find
2197 ,(or number '(gnus-summary-article-number)))))
2199 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2200 (defmacro gnus-summary-article-subject (&optional number)
2201 "Return current subject string or nil if nothing."
2204 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2205 '(gnus-data-header (assq (gnus-summary-article-number)
2206 gnus-newsgroup-data)))))
2209 (mail-header-subject headers))))
2211 (defmacro gnus-summary-article-score (&optional number)
2212 "Return current article score."
2213 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2214 gnus-newsgroup-scored))
2215 gnus-summary-default-score 0))
2217 (defun gnus-summary-article-children (&optional number)
2218 "Return a list of article numbers that are children of article NUMBER."
2219 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2220 (level (gnus-data-level (car data)))
2222 (while (and (setq data (cdr data))
2223 (> (setq l (gnus-data-level (car data))) level))
2224 (and (= (1+ level) l)
2225 (push (gnus-data-number (car data))
2227 (nreverse children)))
2229 (defun gnus-summary-article-parent (&optional number)
2230 "Return the article number of the parent of article NUMBER."
2231 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2232 (gnus-data-list t)))
2233 (level (gnus-data-level (car data))))
2235 () ; This is a root.
2236 ;; We search until we find an article with a level less than
2237 ;; this one. That function has to be the parent.
2238 (while (and (setq data (cdr data))
2239 (not (< (gnus-data-level (car data)) level))))
2240 (and data (gnus-data-number (car data))))))
2242 (defun gnus-unread-mark-p (mark)
2243 "Say whether MARK is the unread mark."
2244 (= mark gnus-unread-mark))
2246 (defun gnus-read-mark-p (mark)
2247 "Say whether MARK is one of the marks that mark as read.
2248 This is all marks except unread, ticked, dormant, and expirable."
2249 (not (or (= mark gnus-unread-mark)
2250 (= mark gnus-ticked-mark)
2251 (= mark gnus-dormant-mark)
2252 (= mark gnus-expirable-mark))))
2254 (defmacro gnus-article-mark (number)
2255 "Return the MARK of article NUMBER.
2256 This macro should only be used when computing the mark the \"first\"
2257 time; i.e., when generating the summary lines. After that,
2258 `gnus-summary-article-mark' should be used to examine the
2261 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2262 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2263 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2264 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2265 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2266 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2267 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2268 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2269 gnus-ancient-mark))))
2271 ;; Saving hidden threads.
2273 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2274 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2276 (defmacro gnus-save-hidden-threads (&rest forms)
2277 "Save hidden threads, eval FORMS, and restore the hidden threads."
2278 (let ((config (make-symbol "config")))
2279 `(let ((,config (gnus-hidden-threads-configuration)))
2283 (gnus-restore-hidden-threads-configuration ,config)))))
2285 (defun gnus-data-compute-positions ()
2286 "Compute the positions of all articles."
2287 (setq gnus-newsgroup-data-reverse nil)
2288 (let ((data gnus-newsgroup-data))
2290 (gnus-save-hidden-threads
2291 (gnus-summary-show-all-threads)
2292 (goto-char (point-min))
2294 (while (get-text-property (point) 'gnus-intangible)
2296 (gnus-data-set-pos (car data) (+ (point) 3))
2297 (setq data (cdr data))
2298 (forward-line 1))))))
2300 (defun gnus-hidden-threads-configuration ()
2301 "Return the current hidden threads configuration."
2304 (goto-char (point-min))
2305 (while (search-forward "\r" nil t)
2306 (push (1- (point)) config))
2309 (defun gnus-restore-hidden-threads-configuration (config)
2310 "Restore hidden threads configuration from CONFIG."
2311 (let (point buffer-read-only)
2312 (while (setq point (pop config))
2313 (when (and (< point (point-max))
2315 (eq (char-after) ?\n))
2316 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2318 ;; Various summary mode internalish functions.
2320 (defun gnus-mouse-pick-article (e)
2323 (gnus-summary-next-page nil t))
2325 (defun gnus-summary-set-display-table ()
2326 ;; Change the display table. Odd characters have a tendency to mess
2327 ;; up nicely formatted displays - we make all possible glyphs
2328 ;; display only a single character.
2330 ;; We start from the standard display table, if any.
2331 (let ((table (or (copy-sequence standard-display-table)
2332 (make-display-table)))
2334 ;; Nix out all the control chars...
2335 (while (>= (setq i (1- i)) 0)
2336 (aset table i [??]))
2337 ;; ... but not newline and cr, of course. (cr is necessary for the
2338 ;; selective display).
2339 (aset table ?\n nil)
2340 (aset table ?\r nil)
2341 ;; We keep TAB as well.
2342 (aset table ?\t nil)
2343 ;; We nix out any glyphs over 126 that are not set already.
2345 (while (>= (setq i (1- i)) 127)
2346 ;; Only modify if the entry is nil.
2347 (unless (aref table i)
2348 (aset table i [??]))))
2349 (setq buffer-display-table table)))
2351 (defun gnus-summary-setup-buffer (group)
2352 "Initialize summary buffer."
2353 (let ((buffer (concat "*Summary " group "*")))
2354 (if (get-buffer buffer)
2357 (setq gnus-summary-buffer (current-buffer))
2358 (not gnus-newsgroup-prepared))
2359 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2360 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2361 (gnus-summary-mode group)
2363 (gnus-carpal-setup-buffer 'summary))
2364 (unless gnus-single-article-buffer
2365 (make-local-variable 'gnus-article-buffer)
2366 (make-local-variable 'gnus-article-current)
2367 (make-local-variable 'gnus-original-article-buffer))
2368 (setq gnus-newsgroup-name group)
2371 (defun gnus-set-global-variables ()
2372 ;; Set the global equivalents of the summary buffer-local variables
2373 ;; to the latest values they had. These reflect the summary buffer
2374 ;; that was in action when the last article was fetched.
2375 (when (eq major-mode 'gnus-summary-mode)
2376 (setq gnus-summary-buffer (current-buffer))
2377 (let ((name gnus-newsgroup-name)
2378 (marked gnus-newsgroup-marked)
2379 (unread gnus-newsgroup-unreads)
2380 (headers gnus-current-headers)
2381 (data gnus-newsgroup-data)
2382 (summary gnus-summary-buffer)
2383 (article-buffer gnus-article-buffer)
2384 (original gnus-original-article-buffer)
2385 (gac gnus-article-current)
2386 (reffed gnus-reffed-article-number)
2387 (score-file gnus-current-score-file)
2388 (default-charset gnus-newsgroup-charset))
2390 (set-buffer gnus-group-buffer)
2391 (setq gnus-newsgroup-name name
2392 gnus-newsgroup-marked marked
2393 gnus-newsgroup-unreads unread
2394 gnus-current-headers headers
2395 gnus-newsgroup-data data
2396 gnus-article-current gac
2397 gnus-summary-buffer summary
2398 gnus-article-buffer article-buffer
2399 gnus-original-article-buffer original
2400 gnus-reffed-article-number reffed
2401 gnus-current-score-file score-file
2402 gnus-newsgroup-charset default-charset)
2403 ;; The article buffer also has local variables.
2404 (when (gnus-buffer-live-p gnus-article-buffer)
2405 (set-buffer gnus-article-buffer)
2406 (setq gnus-summary-buffer summary))))))
2408 (defun gnus-summary-article-unread-p (article)
2409 "Say whether ARTICLE is unread or not."
2410 (memq article gnus-newsgroup-unreads))
2412 (defun gnus-summary-first-article-p (&optional article)
2413 "Return whether ARTICLE is the first article in the buffer."
2414 (if (not (setq article (or article (gnus-summary-article-number))))
2416 (eq article (caar gnus-newsgroup-data))))
2418 (defun gnus-summary-last-article-p (&optional article)
2419 "Return whether ARTICLE is the last article in the buffer."
2420 (if (not (setq article (or article (gnus-summary-article-number))))
2421 ;; All non-existent numbers are the last article. :-)
2423 (not (cdr (gnus-data-find-list article)))))
2425 (defun gnus-make-thread-indent-array ()
2427 (unless (and gnus-thread-indent-array
2428 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2429 (setq gnus-thread-indent-array (make-vector 201 "")
2430 gnus-thread-indent-array-level gnus-thread-indent-level)
2432 (aset gnus-thread-indent-array n
2433 (make-string (* n gnus-thread-indent-level) ? ))
2436 (defun gnus-update-summary-mark-positions ()
2437 "Compute where the summary marks are to go."
2439 (when (gnus-buffer-exists-p gnus-summary-buffer)
2440 (set-buffer gnus-summary-buffer))
2441 (let ((gnus-replied-mark 129)
2442 (gnus-score-below-mark 130)
2443 (gnus-score-over-mark 130)
2444 (gnus-download-mark 131)
2445 (spec gnus-summary-line-format-spec)
2448 (gnus-set-work-buffer)
2449 (let ((gnus-summary-line-format-spec spec)
2450 (gnus-newsgroup-downloadable '((0 . t))))
2451 (gnus-summary-insert-line
2452 (make-full-mail-header 0 "" "" "" "" "" 0 0 "" nil)
2453 0 nil 128 t nil "" nil 1)
2454 (goto-char (point-min))
2455 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2457 (goto-char (point-min))
2458 (push (cons 'replied (and (search-forward "\201" nil t)
2461 (goto-char (point-min))
2462 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2464 (goto-char (point-min))
2465 (push (cons 'download
2466 (and (search-forward "\203" nil t) (- (point) 2)))
2468 (setq gnus-summary-mark-positions pos))))
2470 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2471 "Insert a dummy root in the summary buffer."
2473 (gnus-add-text-properties
2474 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2475 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2477 (defun gnus-summary-from-or-to-or-newsgroups (header)
2478 (let ((to (cdr (assq 'To (mail-header-extra header))))
2479 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2480 (mail-parse-charset gnus-newsgroup-charset))
2483 gnus-ignored-from-addresses
2484 (string-match gnus-ignored-from-addresses
2485 (mail-header-from header)))
2487 (or (car (funcall gnus-extract-address-components
2489 gnus-decode-encoded-word-function to)))
2490 (funcall gnus-decode-encoded-word-function to))))
2492 gnus-ignored-from-addresses
2493 (string-match gnus-ignored-from-addresses
2494 (mail-header-from header)))
2495 (concat "=> " newsgroups))
2497 (or (car (funcall gnus-extract-address-components
2498 (mail-header-from header)))
2499 (mail-header-from header))))))
2501 (defun gnus-summary-insert-line (gnus-tmp-header
2502 gnus-tmp-level gnus-tmp-current
2503 gnus-tmp-unread gnus-tmp-replied
2504 gnus-tmp-expirable gnus-tmp-subject-or-nil
2505 &optional gnus-tmp-dummy gnus-tmp-score
2507 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2508 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2509 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2510 (gnus-tmp-score-char
2511 (if (or (null gnus-summary-default-score)
2512 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2513 gnus-summary-zcore-fuzz))
2515 (if (< gnus-tmp-score gnus-summary-default-score)
2516 gnus-score-below-mark gnus-score-over-mark)))
2518 (cond (gnus-tmp-process gnus-process-mark)
2519 ((memq gnus-tmp-current gnus-newsgroup-cached)
2521 (gnus-tmp-replied gnus-replied-mark)
2522 ((memq gnus-tmp-current gnus-newsgroup-saved)
2524 (t gnus-unread-mark)))
2525 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2528 ((string-match "<[^>]+> *$" gnus-tmp-from)
2529 (let ((beg (match-beginning 0)))
2530 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2531 (substring gnus-tmp-from (1+ (match-beginning 0))
2532 (1- (match-end 0))))
2533 (substring gnus-tmp-from 0 beg))))
2534 ((string-match "(.+)" gnus-tmp-from)
2535 (substring gnus-tmp-from
2536 (1+ (match-beginning 0)) (1- (match-end 0))))
2538 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2539 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2540 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2541 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2542 (buffer-read-only nil))
2543 (when (string= gnus-tmp-name "")
2544 (setq gnus-tmp-name gnus-tmp-from))
2545 (unless (numberp gnus-tmp-lines)
2546 (setq gnus-tmp-lines 0))
2547 (gnus-put-text-property-excluding-characters-with-faces
2549 (progn (eval gnus-summary-line-format-spec) (point))
2550 'gnus-number gnus-tmp-number)
2551 (when (gnus-visual-p 'summary-highlight 'highlight)
2553 (gnus-run-hooks 'gnus-summary-update-hook)
2556 (defun gnus-summary-update-line (&optional dont-update)
2557 ;; Update summary line after change.
2558 (when (and gnus-summary-default-score
2559 (not gnus-summary-inhibit-highlight))
2560 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2561 (article (gnus-summary-article-number))
2562 (score (gnus-summary-article-score article)))
2564 (if (and gnus-summary-mark-below
2565 (< (gnus-summary-article-score)
2566 gnus-summary-mark-below))
2567 ;; This article has a low score, so we mark it as read.
2568 (when (memq article gnus-newsgroup-unreads)
2569 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2570 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2571 ;; This article was previously marked as read on account
2572 ;; of a low score, but now it has risen, so we mark it as
2574 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2575 (gnus-summary-update-mark
2576 (if (or (null gnus-summary-default-score)
2577 (<= (abs (- score gnus-summary-default-score))
2578 gnus-summary-zcore-fuzz))
2580 (if (< score gnus-summary-default-score)
2581 gnus-score-below-mark gnus-score-over-mark))
2583 ;; Do visual highlighting.
2584 (when (gnus-visual-p 'summary-highlight 'highlight)
2585 (gnus-run-hooks 'gnus-summary-update-hook)))))
2587 (defvar gnus-tmp-new-adopts nil)
2589 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2590 "Return the number of articles in THREAD.
2591 This may be 0 in some cases -- if none of the articles in
2592 the thread are to be displayed."
2594 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2596 ((not (listp thread))
2598 ((and (consp thread) (cdr thread))
2601 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2604 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2607 (when (and level (zerop level) gnus-tmp-new-adopts)
2610 'gnus-summary-number-of-articles-in-thread
2611 gnus-tmp-new-adopts))))
2613 (if (> number 1) gnus-not-empty-thread-mark
2614 gnus-empty-thread-mark)
2617 (defun gnus-summary-set-local-parameters (group)
2618 "Go through the local params of GROUP and set all variable specs in that list."
2619 (let ((params (gnus-group-find-parameter group))
2622 (setq elem (car params)
2623 params (cdr params))
2624 (and (consp elem) ; Has to be a cons.
2625 (consp (cdr elem)) ; The cdr has to be a list.
2626 (symbolp (car elem)) ; Has to be a symbol in there.
2627 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2628 (ignore-errors ; So we set it.
2629 (make-local-variable (car elem))
2630 (set (car elem) (eval (nth 1 elem))))))))
2632 (defun gnus-summary-read-group (group &optional show-all no-article
2633 kill-buffer no-display backward
2635 "Start reading news in newsgroup GROUP.
2636 If SHOW-ALL is non-nil, already read articles are also listed.
2637 If NO-ARTICLE is non-nil, no article is selected initially.
2638 If NO-DISPLAY, don't generate a summary buffer."
2642 (let ((gnus-auto-select-next nil))
2643 (or (gnus-summary-read-group-1
2644 group show-all no-article
2645 kill-buffer no-display
2648 select-articles nil)))))
2649 (eq gnus-auto-select-next 'quietly))
2650 (set-buffer gnus-group-buffer)
2651 ;; The entry function called above goes to the next
2652 ;; group automatically, so we go two groups back
2653 ;; if we are searching for the previous group.
2655 (gnus-group-prev-unread-group 2))
2656 (if (not (equal group (gnus-group-group-name)))
2657 (setq group (gnus-group-group-name))
2661 (defun gnus-summary-read-group-1 (group show-all no-article
2662 kill-buffer no-display
2663 &optional select-articles)
2664 ;; Killed foreign groups can't be entered.
2665 (when (and (not (gnus-group-native-p group))
2666 (not (gnus-gethash group gnus-newsrc-hashtb)))
2667 (error "Dead non-native groups can't be entered"))
2668 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2669 (let* ((new-group (gnus-summary-setup-buffer group))
2670 (quit-config (gnus-group-quit-config group))
2671 (did-select (and new-group (gnus-select-newsgroup
2672 group show-all select-articles))))
2674 ;; This summary buffer exists already, so we just select it.
2676 (gnus-set-global-variables)
2678 (gnus-kill-or-deaden-summary kill-buffer))
2679 (gnus-configure-windows 'summary 'force)
2680 (gnus-set-mode-line 'summary)
2681 (gnus-summary-position-point)
2684 ;; We couldn't select this group.
2686 (when (and (eq major-mode 'gnus-summary-mode)
2687 (not (equal (current-buffer) kill-buffer)))
2688 (kill-buffer (current-buffer))
2689 (if (not quit-config)
2691 ;; Update the info -- marks might need to be removed,
2693 (gnus-summary-update-info)
2694 (set-buffer gnus-group-buffer)
2695 (gnus-group-jump-to-group group)
2696 (gnus-group-next-unread-group 1))
2697 (gnus-handle-ephemeral-exit quit-config)))
2698 (gnus-message 3 "Can't select group")
2700 ;; The user did a `C-g' while prompting for number of articles,
2701 ;; so we exit this group.
2702 ((eq did-select 'quit)
2703 (and (eq major-mode 'gnus-summary-mode)
2704 (not (equal (current-buffer) kill-buffer))
2705 (kill-buffer (current-buffer)))
2707 (gnus-kill-or-deaden-summary kill-buffer))
2708 (if (not quit-config)
2710 (set-buffer gnus-group-buffer)
2711 (gnus-group-jump-to-group group)
2712 (gnus-group-next-unread-group 1)
2713 (gnus-configure-windows 'group 'force))
2714 (gnus-handle-ephemeral-exit quit-config))
2715 ;; Finally signal the quit.
2717 ;; The group was successfully selected.
2719 (gnus-set-global-variables)
2720 ;; Save the active value in effect when the group was entered.
2721 (setq gnus-newsgroup-active
2723 (gnus-active gnus-newsgroup-name)))
2724 ;; You can change the summary buffer in some way with this hook.
2725 (gnus-run-hooks 'gnus-select-group-hook)
2726 ;; Set any local variables in the group parameters.
2727 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2728 (gnus-update-format-specifications
2729 nil 'summary 'summary-mode 'summary-dummy)
2730 ;; Do score processing.
2731 (when gnus-use-scoring
2732 (gnus-possibly-score-headers))
2733 ;; Check whether to fill in the gaps in the threads.
2734 (when gnus-build-sparse-threads
2735 (gnus-build-sparse-threads))
2736 ;; Find the initial limit.
2737 (if gnus-show-threads
2739 (let ((gnus-newsgroup-dormant nil))
2740 (gnus-summary-initial-limit show-all))
2741 (gnus-summary-initial-limit show-all))
2742 (setq gnus-newsgroup-limit
2744 (lambda (header) (mail-header-number header))
2745 gnus-newsgroup-headers)))
2746 ;; Generate the summary buffer.
2748 (gnus-summary-prepare))
2749 (when gnus-use-trees
2750 (gnus-tree-open group)
2751 (setq gnus-summary-highlight-line-function
2752 'gnus-tree-highlight-article))
2753 ;; If the summary buffer is empty, but there are some low-scored
2754 ;; articles or some excluded dormants, we include these in the
2756 (when (and (zerop (buffer-size))
2758 (cond (gnus-newsgroup-dormant
2759 (gnus-summary-limit-include-dormant))
2760 ((and gnus-newsgroup-scored show-all)
2761 (gnus-summary-limit-include-expunged t))))
2762 ;; Function `gnus-apply-kill-file' must be called in this hook.
2763 (gnus-run-hooks 'gnus-apply-kill-hook)
2764 (if (and (zerop (buffer-size))
2767 ;; This newsgroup is empty.
2768 (gnus-summary-catchup-and-exit nil t)
2769 (gnus-message 6 "No unread news")
2771 (gnus-kill-or-deaden-summary kill-buffer))
2772 ;; Return nil from this function.
2774 ;; Hide conversation thread subtrees. We cannot do this in
2775 ;; gnus-summary-prepare-hook since kill processing may not
2776 ;; work with hidden articles.
2777 (and gnus-show-threads
2778 gnus-thread-hide-subtree
2779 (gnus-summary-hide-all-threads))
2781 (gnus-kill-or-deaden-summary kill-buffer))
2782 ;; Show first unread article if requested.
2783 (if (and (not no-article)
2785 gnus-newsgroup-unreads
2786 gnus-auto-select-first)
2788 (gnus-configure-windows 'summary)
2790 ((eq gnus-auto-select-first 'best)
2791 (gnus-summary-best-unread-article))
2792 ((eq gnus-auto-select-first t)
2793 (gnus-summary-first-unread-article))
2794 ((gnus-functionp gnus-auto-select-first)
2795 (funcall gnus-auto-select-first))))
2796 ;; Don't select any articles, just move point to the first
2797 ;; article in the group.
2798 (goto-char (point-min))
2799 (gnus-summary-position-point)
2800 (gnus-configure-windows 'summary 'force)
2801 (gnus-set-mode-line 'summary))
2802 (when (get-buffer-window gnus-group-buffer t)
2803 ;; Gotta use windows, because recenter does weird stuff if
2804 ;; the current buffer ain't the displayed window.
2805 (let ((owin (selected-window)))
2806 (select-window (get-buffer-window gnus-group-buffer t))
2807 (when (gnus-group-goto-group group)
2809 (select-window owin)))
2810 ;; Mark this buffer as "prepared".
2811 (setq gnus-newsgroup-prepared t)
2812 (gnus-run-hooks 'gnus-summary-prepared-hook)
2815 (defun gnus-summary-prepare ()
2816 "Generate the summary buffer."
2818 (let ((buffer-read-only nil))
2820 (setq gnus-newsgroup-data nil
2821 gnus-newsgroup-data-reverse nil)
2822 (gnus-run-hooks 'gnus-summary-generate-hook)
2823 ;; Generate the buffer, either with threads or without.
2824 (when gnus-newsgroup-headers
2825 (gnus-summary-prepare-threads
2826 (if gnus-show-threads
2827 (gnus-sort-gathered-threads
2828 (funcall gnus-summary-thread-gathering-function
2830 (gnus-cut-threads (gnus-make-threads)))))
2831 ;; Unthreaded display.
2832 (gnus-sort-articles gnus-newsgroup-headers))))
2833 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2834 ;; Call hooks for modifying summary buffer.
2835 (goto-char (point-min))
2836 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2838 (defsubst gnus-general-simplify-subject (subject)
2839 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2842 ;; Truncate the subject.
2843 (gnus-simplify-subject-functions
2844 (gnus-map-function gnus-simplify-subject-functions subject))
2845 ((numberp gnus-summary-gather-subject-limit)
2846 (setq subject (gnus-simplify-subject-re subject))
2847 (if (> (length subject) gnus-summary-gather-subject-limit)
2848 (substring subject 0 gnus-summary-gather-subject-limit)
2850 ;; Fuzzily simplify it.
2851 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2852 (gnus-simplify-subject-fuzzy subject))
2853 ;; Just remove the leading "Re:".
2855 (gnus-simplify-subject-re subject))))
2857 (if (and gnus-summary-gather-exclude-subject
2858 (string-match gnus-summary-gather-exclude-subject subject))
2859 nil ; This article shouldn't be gathered
2862 (defun gnus-summary-simplify-subject-query ()
2863 "Query where the respool algorithm would put this article."
2865 (gnus-summary-select-article)
2866 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2868 (defun gnus-gather-threads-by-subject (threads)
2869 "Gather threads by looking at Subject headers."
2870 (if (not gnus-summary-make-false-root)
2872 (let ((hashtb (gnus-make-hashtable 1024))
2875 subject hthread whole-subject)
2877 (setq subject (gnus-general-simplify-subject
2878 (setq whole-subject (mail-header-subject
2881 (if (setq hthread (gnus-gethash subject hashtb))
2883 ;; We enter a dummy root into the thread, if we
2884 ;; haven't done that already.
2885 (unless (stringp (caar hthread))
2886 (setcar hthread (list whole-subject (car hthread))))
2887 ;; We add this new gathered thread to this gathered
2889 (setcdr (car hthread)
2890 (nconc (cdar hthread) (list (car threads))))
2891 ;; Remove it from the list of threads.
2892 (setcdr prev (cdr threads))
2893 (setq threads prev))
2894 ;; Enter this thread into the hash table.
2895 (gnus-sethash subject threads hashtb)))
2897 (setq threads (cdr threads)))
2900 (defun gnus-gather-threads-by-references (threads)
2901 "Gather threads by looking at References headers."
2902 (let ((idhashtb (gnus-make-hashtable 1024))
2903 (thhashtb (gnus-make-hashtable 1024))
2906 ids references id gthread gid entered ref)
2908 (when (setq references (mail-header-references (caar threads)))
2909 (setq id (mail-header-id (caar threads))
2910 ids (gnus-split-references references)
2912 (while (setq ref (pop ids))
2913 (setq ids (delete ref ids))
2914 (if (not (setq gid (gnus-gethash ref idhashtb)))
2916 (gnus-sethash ref id idhashtb)
2917 (gnus-sethash id threads thhashtb))
2918 (setq gthread (gnus-gethash gid thhashtb))
2920 ;; We enter a dummy root into the thread, if we
2921 ;; haven't done that already.
2922 (unless (stringp (caar gthread))
2923 (setcar gthread (list (mail-header-subject (caar gthread))
2925 ;; We add this new gathered thread to this gathered
2927 (setcdr (car gthread)
2928 (nconc (cdar gthread) (list (car threads)))))
2929 ;; Add it into the thread hash table.
2930 (gnus-sethash id gthread thhashtb)
2932 ;; Remove it from the list of threads.
2933 (setcdr prev (cdr threads))
2934 (setq threads prev))))
2936 (setq threads (cdr threads)))
2939 (defun gnus-sort-gathered-threads (threads)
2940 "Sort subtreads inside each gathered thread by article number."
2941 (let ((result threads))
2943 (when (stringp (caar threads))
2944 (setcdr (car threads)
2945 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2946 (setq threads (cdr threads)))
2949 (defun gnus-thread-loop-p (root thread)
2950 "Say whether ROOT is in THREAD."
2951 (let ((stack (list thread))
2954 (while (setq thread (pop stack))
2955 (setq th (cdr thread))
2957 (not (eq (caar th) root)))
2960 ;; We have found a loop.
2962 (setcdr thread (delq (car th) (cdr thread)))
2963 (if (boundp (setq ref-dep (intern "none"
2964 gnus-newsgroup-dependencies)))
2965 (setcdr (symbol-value ref-dep)
2966 (nconc (cdr (symbol-value ref-dep))
2968 (set ref-dep (list nil (car th))))
2971 ;; Push all the subthreads onto the stack.
2972 (push (cdr thread) stack)))
2975 (defun gnus-make-threads ()
2976 "Go through the dependency hashtb and find the roots. Return all threads."
2978 (while (catch 'infloop
2981 ;; Deal with self-referencing References loops.
2982 (when (and (car (symbol-value refs))
2989 (car (symbol-value refs)) thread))
2990 (cdr (symbol-value refs)))))))
2993 (unless (car (symbol-value refs))
2994 ;; These threads do not refer back to any other articles,
2995 ;; so they're roots.
2996 (setq threads (append (cdr (symbol-value refs)) threads))))
2997 gnus-newsgroup-dependencies)))
3000 ;; Build the thread tree.
3001 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3002 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3004 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3005 if it was already present.
3007 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3008 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3009 Message-IDs will be renamed be renamed to a unique Message-ID before
3012 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3013 (let* ((id (mail-header-id header))
3014 (id-dep (and id (intern id dependencies)))
3015 ref ref-dep ref-header)
3016 ;; Enter this `header' in the `dependencies' table.
3020 ;; The first two cases do the normal part: enter a new `header'
3021 ;; in the `dependencies' table.
3022 ((not (boundp id-dep))
3023 (set id-dep (list header)))
3024 ((null (car (symbol-value id-dep)))
3025 (setcar (symbol-value id-dep) header))
3027 ;; From here the `header' was already present in the
3028 ;; `dependencies' table.
3030 ;; Overrides an existing entry;
3031 ;; just set the header part of the entry.
3032 (setcar (symbol-value id-dep) header))
3034 ;; Renames the existing `header' to a unique Message-ID.
3035 ((not gnus-summary-ignore-duplicates)
3036 ;; An article with this Message-ID has already been seen.
3037 ;; We rename the Message-ID.
3038 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3040 (mail-header-set-id header id))
3042 ;; The last case ignores an existing entry, except it adds any
3043 ;; additional Xrefs (in case the two articles came from different
3045 ;; Also sets `header' to `nil' meaning that the `dependencies'
3046 ;; table was *not* modified.
3048 (mail-header-set-xref
3049 (car (symbol-value id-dep))
3050 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3052 (or (mail-header-xref header) "")))
3056 ;; First check if that we are not creating a References loop.
3057 (setq ref (gnus-parent-id (mail-header-references header)))
3059 (setq ref-dep (intern-soft ref dependencies))
3061 (setq ref-header (car (symbol-value ref-dep))))
3062 (if (string= id ref)
3063 ;; Yuk! This is a reference loop. Make the article be a
3066 (mail-header-set-references (car (symbol-value id-dep)) "none")
3068 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3069 (setq ref (gnus-parent-id (mail-header-references header)))
3070 (setq ref-dep (intern (or ref "none") dependencies))
3071 (if (boundp ref-dep)
3072 (setcdr (symbol-value ref-dep)
3073 (nconc (cdr (symbol-value ref-dep))
3074 (list (symbol-value id-dep))))
3075 (set ref-dep (list nil (symbol-value id-dep)))))
3078 (defun gnus-build-sparse-threads ()
3079 (let ((headers gnus-newsgroup-headers)
3080 (gnus-summary-ignore-duplicates t)
3081 header references generation relations
3082 subject child end new-child date)
3083 ;; First we create an alist of generations/relations, where
3084 ;; generations is how much we trust the relation, and the relation
3086 (gnus-message 7 "Making sparse threads...")
3088 (nnheader-set-temp-buffer " *gnus sparse threads*")
3089 (while (setq header (pop headers))
3090 (when (and (setq references (mail-header-references header))
3091 (not (string= references "")))
3093 (setq child (mail-header-id header)
3094 subject (mail-header-subject header)
3095 date (mail-header-date header)
3097 (while (search-backward ">" nil t)
3098 (setq end (1+ (point)))
3099 (when (search-backward "<" nil t)
3100 (setq new-child (buffer-substring (point) end))
3101 (push (list (incf generation)
3102 child (setq child new-child)
3106 (push (list (1+ generation) child nil subject) relations))
3108 (kill-buffer (current-buffer)))
3109 ;; Sort over trustworthiness.
3112 (when (gnus-dependencies-add-header
3113 (make-full-mail-header
3114 gnus-reffed-article-number
3115 (nth 3 relation) "" (or (nth 4 relation) "")
3117 (or (nth 2 relation) "") 0 0 "")
3118 gnus-newsgroup-dependencies nil)
3119 (push gnus-reffed-article-number gnus-newsgroup-limit)
3120 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3121 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3122 gnus-newsgroup-reads)
3123 (decf gnus-reffed-article-number)))
3124 (sort relations 'car-less-than-car))
3125 (gnus-message 7 "Making sparse threads...done")))
3127 (defun gnus-build-old-threads ()
3128 ;; Look at all the articles that refer back to old articles, and
3129 ;; fetch the headers for the articles that aren't there. This will
3130 ;; build complete threads - if the roots haven't been expired by the
3135 (when (not (car (symbol-value refs)))
3136 (setq heads (cdr (symbol-value refs)))
3138 (if (memq (mail-header-number (caar heads))
3139 gnus-newsgroup-dormant)
3140 (setq heads (cdr heads))
3141 (setq id (symbol-name refs))
3142 (while (and (setq id (gnus-build-get-header id))
3143 (not (car (gnus-id-to-thread id)))))
3144 (setq heads nil)))))
3145 gnus-newsgroup-dependencies)))
3147 ;; This function has to be called with point after the article number
3148 ;; on the beginning of the line.
3149 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3150 (let ((eol (gnus-point-at-eol))
3151 (buffer (current-buffer))
3154 ;; overview: [num subject from date id refs chars lines misc]
3159 (make-full-mail-header
3161 (nnheader-nov-field) ; subject
3162 (nnheader-nov-field) ; from
3163 (nnheader-nov-field) ; date
3164 (nnheader-nov-read-message-id) ; id
3165 (nnheader-nov-field) ; refs
3166 (nnheader-nov-read-integer) ; chars
3167 (nnheader-nov-read-integer) ; lines
3169 (nnheader-nov-field)) ; misc
3170 (nnheader-nov-parse-extra))) ; extra
3172 (when gnus-alter-header-function
3173 (funcall gnus-alter-header-function header))
3174 (gnus-dependencies-add-header header dependencies force-new)))
3176 (defun gnus-build-get-header (id)
3177 ;; Look through the buffer of NOV lines and find the header to
3178 ;; ID. Enter this line into the dependencies hash table, and return
3179 ;; the id of the parent article (if any).
3180 (let ((deps gnus-newsgroup-dependencies)
3184 (set-buffer nntp-server-buffer)
3185 (let ((case-fold-search nil))
3186 (goto-char (point-min))
3187 (while (and (not found)
3188 (search-forward id nil t))
3190 (setq found (looking-at
3191 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3192 (regexp-quote id))))
3193 (or found (beginning-of-line 2)))
3197 (setq header (gnus-nov-parse-line
3198 (read (current-buffer)) deps))
3199 (gnus-parent-id (mail-header-references header))))))
3201 (let ((number (mail-header-number header)))
3202 (push number gnus-newsgroup-limit)
3203 (push header gnus-newsgroup-headers)
3204 (if (memq number gnus-newsgroup-unselected)
3206 (push number gnus-newsgroup-unreads)
3207 (setq gnus-newsgroup-unselected
3208 (delq number gnus-newsgroup-unselected)))
3209 (push number gnus-newsgroup-ancient)))))))
3211 (defun gnus-build-all-threads ()
3212 "Read all the headers."
3213 (let ((gnus-summary-ignore-duplicates t)
3214 (dependencies gnus-newsgroup-dependencies)
3217 (set-buffer nntp-server-buffer)
3218 (let ((case-fold-search nil))
3219 (goto-char (point-min))
3222 (setq article (read (current-buffer))
3223 header (gnus-nov-parse-line
3224 article dependencies)))
3227 (set-buffer gnus-summary-buffer)
3228 (push header gnus-newsgroup-headers)
3229 (if (memq (setq article (mail-header-number header))
3230 gnus-newsgroup-unselected)
3232 (push article gnus-newsgroup-unreads)
3233 (setq gnus-newsgroup-unselected
3234 (delq article gnus-newsgroup-unselected)))
3235 (push article gnus-newsgroup-ancient)))
3236 (forward-line 1)))))))
3238 (defun gnus-summary-update-article-line (article header)
3239 "Update the line for ARTICLE using HEADERS."
3240 (let* ((id (mail-header-id header))
3241 (thread (gnus-id-to-thread id)))
3243 (error "Article in no thread"))
3244 ;; Update the thread.
3245 (setcar thread header)
3246 (gnus-summary-goto-subject article)
3247 (let* ((datal (gnus-data-find-list article))
3249 (length (when (cdr datal)
3250 (- (gnus-data-pos data)
3251 (gnus-data-pos (cadr datal)))))
3252 (buffer-read-only nil)
3253 (level (gnus-summary-thread-level)))
3255 (gnus-summary-insert-line
3256 header level nil (gnus-article-mark article)
3257 (memq article gnus-newsgroup-replied)
3258 (memq article gnus-newsgroup-expirable)
3259 ;; Only insert the Subject string when it's different
3260 ;; from the previous Subject string.
3261 (if (gnus-subject-equal
3263 (mail-header-subject
3266 (gnus-data-find-list
3268 (gnus-data-list t)))))
3269 ;; Error on the side of excessive subjects.
3271 (mail-header-subject header))
3273 (mail-header-subject header))
3274 nil (cdr (assq article gnus-newsgroup-scored))
3275 (memq article gnus-newsgroup-processable))
3277 (gnus-data-update-list
3278 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3280 (defun gnus-summary-update-article (article &optional iheader)
3281 "Update ARTICLE in the summary buffer."
3282 (set-buffer gnus-summary-buffer)
3283 (let* ((header (gnus-summary-article-header article))
3284 (id (mail-header-id header))
3285 (data (gnus-data-find article))
3286 (thread (gnus-id-to-thread id))
3287 (references (mail-header-references header))
3291 (when (and references
3292 (not (equal "" references)))
3295 (buffer-read-only nil)
3301 (delq thread parent)))
3302 (if (gnus-summary-insert-subject id header)
3303 ;; Set the (possibly) new article number in the data structure.
3304 (gnus-data-set-number data (gnus-id-to-article id))
3308 (defun gnus-rebuild-thread (id &optional line)
3309 "Rebuild the thread containing ID.
3310 If LINE, insert the rebuilt thread starting on line LINE."
3311 (let ((buffer-read-only nil)
3312 old-pos current thread data)
3313 (if (not gnus-show-threads)
3314 (setq thread (list (car (gnus-id-to-thread id))))
3315 ;; Get the thread this article is part of.
3316 (setq thread (gnus-remove-thread id)))
3317 (setq old-pos (gnus-point-at-bol))
3318 (setq current (save-excursion
3319 (and (zerop (forward-line -1))
3320 (gnus-summary-article-number))))
3321 ;; If this is a gathered thread, we have to go some re-gathering.
3322 (when (stringp (car thread))
3323 (let ((subject (car thread))
3325 (setq thread (cdr thread))
3327 (unless (memq (setq thr (gnus-id-to-thread
3329 (mail-header-id (caar thread)))))
3332 (setq thread (cdr thread)))
3333 ;; We now have all (unique) roots.
3334 (if (= (length roots) 1)
3335 ;; All the loose roots are now one solid root.
3336 (setq thread (car roots))
3337 (setq thread (cons subject (gnus-sort-threads roots))))))
3339 ;; We then insert this thread into the summary buffer.
3341 (goto-char (point-min))
3342 (forward-line (1- line)))
3343 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3344 (if gnus-show-threads
3345 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3346 (gnus-summary-prepare-unthreaded thread))
3347 (setq data (nreverse gnus-newsgroup-data))
3348 (setq threads gnus-newsgroup-threads))
3349 ;; We splice the new data into the data structure.
3350 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3351 ;;!!! then we want to insert at the beginning of the buffer.
3352 ;;!!! That happens to be true with Gnus now, but that may
3353 ;;!!! change in the future. Perhaps.
3354 (gnus-data-enter-list
3355 (if line nil current) data (- (point) old-pos))
3356 (setq gnus-newsgroup-threads
3357 (nconc threads gnus-newsgroup-threads))
3358 (gnus-data-compute-positions))))
3360 (defun gnus-number-to-header (number)
3361 "Return the header for article NUMBER."
3362 (let ((headers gnus-newsgroup-headers))
3364 (not (= number (mail-header-number (car headers)))))
3369 (defun gnus-parent-headers (in-headers &optional generation)
3370 "Return the headers of the GENERATIONeth parent of HEADERS."
3372 (setq generation 1))
3374 (headers in-headers)
3377 (not (zerop generation))
3378 (setq references (mail-header-references headers)))
3379 (setq headers (if (and references
3380 (setq parent (gnus-parent-id references)))
3381 (car (gnus-id-to-thread parent))
3384 (and (not (eq headers in-headers))
3387 (defun gnus-id-to-thread (id)
3388 "Return the (sub-)thread where ID appears."
3389 (gnus-gethash id gnus-newsgroup-dependencies))
3391 (defun gnus-id-to-article (id)
3392 "Return the article number of ID."
3393 (let ((thread (gnus-id-to-thread id)))
3396 (mail-header-number (car thread)))))
3398 (defun gnus-id-to-header (id)
3399 "Return the article headers of ID."
3400 (car (gnus-id-to-thread id)))
3402 (defun gnus-article-displayed-root-p (article)
3403 "Say whether ARTICLE is a root(ish) article."
3404 (let ((level (gnus-summary-thread-level article))
3405 (refs (mail-header-references (gnus-summary-article-header article)))
3411 ((null (gnus-parent-id refs)) t)
3413 (null (setq particle (gnus-id-to-article
3414 (gnus-parent-id refs))))
3415 (null (gnus-summary-thread-level particle)))))))
3417 (defun gnus-root-id (id)
3418 "Return the id of the root of the thread where ID appears."
3420 (while (and id (setq prev (car (gnus-id-to-thread id))))
3422 id (gnus-parent-id (mail-header-references prev))))
3425 (defun gnus-articles-in-thread (thread)
3426 "Return the list of articles in THREAD."
3427 (cons (mail-header-number (car thread))
3428 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3430 (defun gnus-remove-thread (id &optional dont-remove)
3431 "Remove the thread that has ID in it."
3432 (let (headers thread last-id)
3433 ;; First go up in this thread until we find the root.
3434 (setq last-id (gnus-root-id id)
3435 headers (message-flatten-list (gnus-id-to-thread last-id)))
3436 ;; We have now found the real root of this thread. It might have
3437 ;; been gathered into some loose thread, so we have to search
3438 ;; through the threads to find the thread we wanted.
3439 (let ((threads gnus-newsgroup-threads)
3442 (setq sub (car threads))
3443 (if (stringp (car sub))
3444 ;; This is a gathered thread, so we look at the roots
3445 ;; below it to find whether this article is in this
3448 (setq sub (cdr sub))
3450 (when (member (caar sub) headers)
3451 (setq thread (car threads)
3454 (setq sub (cdr sub))))
3455 ;; It's an ordinary thread, so we check it.
3456 (when (eq (car sub) (car headers))
3459 (setq threads (cdr threads)))
3460 ;; If this article is in no thread, then it's a root.
3463 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3464 (setq thread (gnus-id-to-thread last-id)))
3467 thread ; We return this thread.
3469 (if (stringp (car thread))
3471 ;; If we use dummy roots, then we have to remove the
3472 ;; dummy root as well.
3473 (when (eq gnus-summary-make-false-root 'dummy)
3474 ;; We go to the dummy root by going to
3475 ;; the first sub-"thread", and then one line up.
3476 (gnus-summary-goto-article
3477 (mail-header-number (caadr thread)))
3480 (gnus-data-compute-positions))
3481 (setq thread (cdr thread))
3483 (gnus-remove-thread-1 (car thread))
3484 (setq thread (cdr thread))))
3485 (gnus-summary-show-all-threads)
3486 (gnus-remove-thread-1 thread))))))))
3488 (defun gnus-remove-thread-1 (thread)
3489 "Remove the thread THREAD recursively."
3490 (let ((number (mail-header-number (pop thread)))
3492 (setq thread (reverse thread))
3494 (gnus-remove-thread-1 (pop thread)))
3495 (when (setq d (gnus-data-find number))
3496 (goto-char (gnus-data-pos d))
3499 (- (gnus-point-at-bol)
3501 (1+ (gnus-point-at-eol))
3502 (gnus-delete-line)))))))
3504 (defun gnus-sort-threads (threads)
3506 (if (not gnus-thread-sort-functions)
3508 (gnus-message 8 "Sorting threads...")
3510 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3511 (gnus-message 8 "Sorting threads...done"))))
3513 (defun gnus-sort-articles (articles)
3515 (when gnus-article-sort-functions
3516 (gnus-message 7 "Sorting articles...")
3518 (setq gnus-newsgroup-headers
3519 (sort articles (gnus-make-sort-function
3520 gnus-article-sort-functions)))
3521 (gnus-message 7 "Sorting articles...done"))))
3523 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3524 (defmacro gnus-thread-header (thread)
3525 ;; Return header of first article in THREAD.
3526 ;; Note that THREAD must never, ever be anything else than a variable -
3527 ;; using some other form will lead to serious barfage.
3528 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3529 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3530 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3533 (defsubst gnus-article-sort-by-number (h1 h2)
3534 "Sort articles by article number."
3535 (< (mail-header-number h1)
3536 (mail-header-number h2)))
3538 (defun gnus-thread-sort-by-number (h1 h2)
3539 "Sort threads by root article number."
3540 (gnus-article-sort-by-number
3541 (gnus-thread-header h1) (gnus-thread-header h2)))
3543 (defsubst gnus-article-sort-by-lines (h1 h2)
3544 "Sort articles by article Lines header."
3545 (< (mail-header-lines h1)
3546 (mail-header-lines h2)))
3548 (defun gnus-thread-sort-by-lines (h1 h2)
3549 "Sort threads by root article Lines header."
3550 (gnus-article-sort-by-lines
3551 (gnus-thread-header h1) (gnus-thread-header h2)))
3553 (defsubst gnus-article-sort-by-chars (h1 h2)
3554 "Sort articles by octet length."
3555 (< (mail-header-chars h1)
3556 (mail-header-chars h2)))
3558 (defun gnus-thread-sort-by-chars (h1 h2)
3559 "Sort threads by root article octet length."
3560 (gnus-article-sort-by-chars
3561 (gnus-thread-header h1) (gnus-thread-header h2)))
3563 (defsubst gnus-article-sort-by-author (h1 h2)
3564 "Sort articles by root author."
3566 (let ((addr (mime-read-field 'From h1)))
3567 (or (std11-full-name-string addr)
3568 (std11-address-string addr)
3570 (let ((addr (mime-read-field 'From h2)))
3571 (or (std11-full-name-string addr)
3572 (std11-address-string addr)
3576 (defun gnus-thread-sort-by-author (h1 h2)
3577 "Sort threads by root author."
3578 (gnus-article-sort-by-author
3579 (gnus-thread-header h1) (gnus-thread-header h2)))
3581 (defsubst gnus-article-sort-by-subject (h1 h2)
3582 "Sort articles by root subject."
3584 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3585 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3587 (defun gnus-thread-sort-by-subject (h1 h2)
3588 "Sort threads by root subject."
3589 (gnus-article-sort-by-subject
3590 (gnus-thread-header h1) (gnus-thread-header h2)))
3592 (defsubst gnus-article-sort-by-date (h1 h2)
3593 "Sort articles by root article date."
3595 (gnus-date-get-time (mail-header-date h1))
3596 (gnus-date-get-time (mail-header-date h2))))
3598 (defun gnus-thread-sort-by-date (h1 h2)
3599 "Sort threads by root article date."
3600 (gnus-article-sort-by-date
3601 (gnus-thread-header h1) (gnus-thread-header h2)))
3603 (defsubst gnus-article-sort-by-score (h1 h2)
3604 "Sort articles by root article score.
3605 Unscored articles will be counted as having a score of zero."
3606 (> (or (cdr (assq (mail-header-number h1)
3607 gnus-newsgroup-scored))
3608 gnus-summary-default-score 0)
3609 (or (cdr (assq (mail-header-number h2)
3610 gnus-newsgroup-scored))
3611 gnus-summary-default-score 0)))
3613 (defun gnus-thread-sort-by-score (h1 h2)
3614 "Sort threads by root article score."
3615 (gnus-article-sort-by-score
3616 (gnus-thread-header h1) (gnus-thread-header h2)))
3618 (defun gnus-thread-sort-by-total-score (h1 h2)
3619 "Sort threads by the sum of all scores in the thread.
3620 Unscored articles will be counted as having a score of zero."
3621 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3623 (defun gnus-thread-total-score (thread)
3624 ;; This function find the total score of THREAD.
3625 (cond ((null thread)
3628 (if (stringp (car thread))
3629 (apply gnus-thread-score-function 0
3630 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3631 (gnus-thread-total-score-1 thread)))
3633 (gnus-thread-total-score-1 (list thread)))))
3635 (defun gnus-thread-total-score-1 (root)
3636 ;; This function find the total score of the thread below ROOT.
3637 (setq root (car root))
3638 (apply gnus-thread-score-function
3640 (mapcar 'gnus-thread-total-score
3641 (cdr (gnus-id-to-thread (mail-header-id root))))
3642 (when (> (mail-header-number root) 0)
3643 (list (or (cdr (assq (mail-header-number root)
3644 gnus-newsgroup-scored))
3645 gnus-summary-default-score 0))))
3646 (list gnus-summary-default-score)
3649 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3650 (defvar gnus-tmp-prev-subject nil)
3651 (defvar gnus-tmp-false-parent nil)
3652 (defvar gnus-tmp-root-expunged nil)
3653 (defvar gnus-tmp-dummy-line nil)
3655 (defvar gnus-tmp-header)
3656 (defun gnus-extra-header (type &optional header)
3657 "Return the extra header of TYPE."
3658 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3661 (defun gnus-summary-prepare-threads (threads)
3662 "Prepare summary buffer from THREADS and indentation LEVEL.
3663 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3664 or a straight list of headers."
3665 (gnus-message 7 "Generating summary...")
3667 (setq gnus-newsgroup-threads threads)
3670 (let ((gnus-tmp-level 0)
3671 (default-score (or gnus-summary-default-score 0))
3672 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3673 thread number subject stack state gnus-tmp-gathered beg-match
3674 new-roots gnus-tmp-new-adopts thread-end
3675 gnus-tmp-header gnus-tmp-unread
3676 gnus-tmp-replied gnus-tmp-subject-or-nil
3677 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3678 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3679 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3681 (setq gnus-tmp-prev-subject nil)
3683 (if (vectorp (car threads))
3684 ;; If this is a straight (sic) list of headers, then a
3685 ;; threaded summary display isn't required, so we just create
3686 ;; an unthreaded one.
3687 (gnus-summary-prepare-unthreaded threads)
3689 ;; Do the threaded display.
3691 (while (or threads stack gnus-tmp-new-adopts new-roots)
3693 (if (and (= gnus-tmp-level 0)
3696 (not gnus-tmp-false-parent)
3697 (or gnus-tmp-new-adopts new-roots))
3698 (if gnus-tmp-new-adopts
3699 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3700 thread (list (car gnus-tmp-new-adopts))
3701 gnus-tmp-header (caar thread)
3702 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3704 (setq thread (list (car new-roots))
3705 gnus-tmp-header (caar thread)
3706 new-roots (cdr new-roots))))
3709 ;; If there are some threads, we do them before the
3710 ;; threads on the stack.
3711 (setq thread threads
3712 gnus-tmp-header (caar thread))
3713 ;; There were no current threads, so we pop something off
3715 (setq state (car stack)
3716 gnus-tmp-level (car state)
3719 gnus-tmp-header (caar thread))))
3721 (setq gnus-tmp-false-parent nil)
3722 (setq gnus-tmp-root-expunged nil)
3723 (setq thread-end nil)
3725 (if (stringp gnus-tmp-header)
3726 ;; The header is a dummy root.
3728 ((eq gnus-summary-make-false-root 'adopt)
3729 ;; We let the first article adopt the rest.
3730 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3732 (setq gnus-tmp-gathered
3734 (lambda (h) (mail-header-number (car h)))
3737 (setq thread (cons (list (caar thread)
3740 (setq gnus-tmp-level -1
3741 gnus-tmp-false-parent t))
3742 ((eq gnus-summary-make-false-root 'empty)
3743 ;; We print adopted articles with empty subject fields.
3744 (setq gnus-tmp-gathered
3746 (lambda (h) (mail-header-number (car h)))
3749 (setq gnus-tmp-level -1))
3750 ((eq gnus-summary-make-false-root 'dummy)
3751 ;; We remember that we probably want to output a dummy
3753 (setq gnus-tmp-dummy-line gnus-tmp-header)
3754 (setq gnus-tmp-prev-subject gnus-tmp-header))
3756 ;; We do not make a root for the gathered
3757 ;; sub-threads at all.
3758 (setq gnus-tmp-level -1)))
3760 (setq number (mail-header-number gnus-tmp-header)
3761 subject (mail-header-subject gnus-tmp-header))
3764 ;; If the thread has changed subject, we might want to make
3765 ;; this subthread into a root.
3766 ((and (null gnus-thread-ignore-subject)
3767 (not (zerop gnus-tmp-level))
3768 gnus-tmp-prev-subject
3770 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3771 (setq new-roots (nconc new-roots (list (car thread)))
3773 gnus-tmp-header nil))
3774 ;; If the article lies outside the current limit,
3775 ;; then we do not display it.
3776 ((not (memq number gnus-newsgroup-limit))
3777 (setq gnus-tmp-gathered
3779 (lambda (h) (mail-header-number (car h)))
3782 (setq gnus-tmp-new-adopts (if (cdar thread)
3783 (append gnus-tmp-new-adopts
3785 gnus-tmp-new-adopts)
3787 gnus-tmp-header nil)
3788 (when (zerop gnus-tmp-level)
3789 (setq gnus-tmp-root-expunged t)))
3790 ;; Perhaps this article is to be marked as read?
3791 ((and gnus-summary-mark-below
3792 (< (or (cdr (assq number gnus-newsgroup-scored))
3794 gnus-summary-mark-below)
3795 ;; Don't touch sparse articles.
3796 (not (gnus-summary-article-sparse-p number))
3797 (not (gnus-summary-article-ancient-p number)))
3798 (setq gnus-newsgroup-unreads
3799 (delq number gnus-newsgroup-unreads))
3800 (if gnus-newsgroup-auto-expire
3801 (push number gnus-newsgroup-expirable)
3802 (push (cons number gnus-low-score-mark)
3803 gnus-newsgroup-reads))))
3805 (when gnus-tmp-header
3806 ;; We may have an old dummy line to output before this
3808 (when (and gnus-tmp-dummy-line
3811 (mail-header-subject gnus-tmp-header)))
3812 (gnus-summary-insert-dummy-line
3813 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3814 (setq gnus-tmp-dummy-line nil))
3816 ;; Compute the mark.
3817 (setq gnus-tmp-unread (gnus-article-mark number))
3819 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3820 gnus-tmp-header gnus-tmp-level)
3821 gnus-newsgroup-data)
3823 ;; Actually insert the line.
3825 gnus-tmp-subject-or-nil
3827 ((and gnus-thread-ignore-subject
3828 gnus-tmp-prev-subject
3829 (not (inline (gnus-subject-equal
3830 gnus-tmp-prev-subject subject))))
3832 ((zerop gnus-tmp-level)
3833 (if (and (eq gnus-summary-make-false-root 'empty)
3834 (memq number gnus-tmp-gathered)
3835 gnus-tmp-prev-subject
3836 (inline (gnus-subject-equal
3837 gnus-tmp-prev-subject subject)))
3838 gnus-summary-same-subject
3840 (t gnus-summary-same-subject)))
3841 (if (and (eq gnus-summary-make-false-root 'adopt)
3842 (= gnus-tmp-level 1)
3843 (memq number gnus-tmp-gathered))
3844 (setq gnus-tmp-opening-bracket ?\<
3845 gnus-tmp-closing-bracket ?\>)
3846 (setq gnus-tmp-opening-bracket ?\[
3847 gnus-tmp-closing-bracket ?\]))
3849 gnus-tmp-indentation
3850 (aref gnus-thread-indent-array gnus-tmp-level)
3851 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3852 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3853 gnus-summary-default-score 0)
3855 (if (or (null gnus-summary-default-score)
3856 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3857 gnus-summary-zcore-fuzz))
3859 (if (< gnus-tmp-score gnus-summary-default-score)
3860 gnus-score-below-mark gnus-score-over-mark))
3862 (cond ((memq number gnus-newsgroup-processable)
3864 ((memq number gnus-newsgroup-cached)
3866 ((memq number gnus-newsgroup-replied)
3868 ((memq number gnus-newsgroup-saved)
3870 (t gnus-unread-mark))
3871 gnus-tmp-from (mail-header-from gnus-tmp-header)
3874 ((string-match "<[^>]+> *$" gnus-tmp-from)
3875 (setq beg-match (match-beginning 0))
3876 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3877 (substring gnus-tmp-from (1+ (match-beginning 0))
3878 (1- (match-end 0))))
3879 (substring gnus-tmp-from 0 beg-match)))
3880 ((string-match "(.+)" gnus-tmp-from)
3881 (substring gnus-tmp-from
3882 (1+ (match-beginning 0)) (1- (match-end 0))))
3884 (when (string= gnus-tmp-name "")
3885 (setq gnus-tmp-name gnus-tmp-from))
3886 (unless (numberp gnus-tmp-lines)
3887 (setq gnus-tmp-lines 0))
3888 (gnus-put-text-property
3890 (progn (eval gnus-summary-line-format-spec) (point))
3891 'gnus-number number)
3894 (gnus-run-hooks 'gnus-summary-update-hook)
3897 (setq gnus-tmp-prev-subject subject)))
3899 (when (nth 1 thread)
3900 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3901 (incf gnus-tmp-level)
3902 (setq threads (if thread-end nil (cdar thread)))
3904 (setq gnus-tmp-level 0)))))
3905 (gnus-message 7 "Generating summary...done"))
3907 (defun gnus-summary-prepare-unthreaded (headers)
3908 "Generate an unthreaded summary buffer based on HEADERS."
3909 (let (header number mark)
3914 ;; We may have to root out some bad articles...
3915 (when (memq (setq number (mail-header-number
3916 (setq header (pop headers))))
3917 gnus-newsgroup-limit)
3918 ;; Mark article as read when it has a low score.
3919 (when (and gnus-summary-mark-below
3920 (< (or (cdr (assq number gnus-newsgroup-scored))
3921 gnus-summary-default-score 0)
3922 gnus-summary-mark-below)
3923 (not (gnus-summary-article-ancient-p number)))
3924 (setq gnus-newsgroup-unreads
3925 (delq number gnus-newsgroup-unreads))
3926 (if gnus-newsgroup-auto-expire
3927 (push number gnus-newsgroup-expirable)
3928 (push (cons number gnus-low-score-mark)
3929 gnus-newsgroup-reads)))
3931 (setq mark (gnus-article-mark number))
3932 (push (gnus-data-make number mark (1+ (point)) header 0)
3933 gnus-newsgroup-data)
3934 (gnus-summary-insert-line
3936 mark (memq number gnus-newsgroup-replied)
3937 (memq number gnus-newsgroup-expirable)
3938 (mail-header-subject header) nil
3939 (cdr (assq number gnus-newsgroup-scored))
3940 (memq number gnus-newsgroup-processable))))))
3942 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3943 "Select newsgroup GROUP.
3944 If READ-ALL is non-nil, all articles in the group are selected.
3945 If SELECT-ARTICLES, only select those articles from GROUP."
3946 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3947 ;;!!! Dirty hack; should be removed.
3948 (gnus-summary-ignore-duplicates
3949 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3951 gnus-summary-ignore-duplicates))
3952 (info (nth 2 entry))
3953 articles fetched-articles cached)
3955 (unless (gnus-check-server
3956 (setq gnus-current-select-method
3957 (gnus-find-method-for-group group)))
3958 (error "Couldn't open server"))
3960 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3961 (gnus-activate-group group) ; Or we can activate it...
3962 (progn ; Or we bug out.
3963 (when (equal major-mode 'gnus-summary-mode)
3964 (kill-buffer (current-buffer)))
3965 (error "Couldn't request group %s: %s"
3966 group (gnus-status-message group))))
3968 (unless (gnus-request-group group t)
3969 (when (equal major-mode 'gnus-summary-mode)
3970 (kill-buffer (current-buffer)))
3971 (error "Couldn't request group %s: %s"
3972 group (gnus-status-message group)))
3974 (setq gnus-newsgroup-name group)
3975 (setq gnus-newsgroup-unselected nil)
3976 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3977 (gnus-summary-setup-default-charset)
3979 ;; Adjust and set lists of article marks.
3981 (gnus-adjust-marked-articles info))
3983 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3985 (if (gnus-virtual-group-p group)
3986 gnus-newsgroup-cached
3987 (gnus-cache-articles-in-group group)))
3989 (setq gnus-newsgroup-unreads
3990 (gnus-set-difference
3991 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3992 gnus-newsgroup-dormant))
3994 (setq gnus-newsgroup-processable nil)
3996 (gnus-update-read-articles group gnus-newsgroup-unreads)
3998 (if (setq articles select-articles)
3999 (setq gnus-newsgroup-unselected
4000 (gnus-sorted-intersection
4001 gnus-newsgroup-unreads
4002 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4003 (setq articles (gnus-articles-to-read group read-all)))
4007 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4009 ((eq articles 0) nil)
4011 ;; Init the dependencies hash table.
4012 (setq gnus-newsgroup-dependencies
4013 (gnus-make-hashtable (length articles)))
4014 (gnus-set-global-variables)
4015 ;; Retrieve the headers and read them in.
4016 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4017 (setq gnus-newsgroup-headers
4018 (gnus-retrieve-parsed-headers
4019 articles gnus-newsgroup-name
4020 ;; We might want to fetch old headers, but
4021 ;; not if there is only 1 article.
4022 (and (or (and (not (eq gnus-fetch-old-headers 'some))
4023 (not (numberp gnus-fetch-old-headers)))
4024 (> (length articles) 1))
4025 gnus-fetch-old-headers)))
4026 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4028 ;; Suppress duplicates?
4029 (when gnus-suppress-duplicates
4030 (gnus-dup-suppress-articles))
4032 ;; Set the initial limit.
4033 (setq gnus-newsgroup-limit (copy-sequence articles))
4034 ;; Remove canceled articles from the list of unread articles.
4035 (setq gnus-newsgroup-unreads
4036 (gnus-set-sorted-intersection
4037 gnus-newsgroup-unreads
4038 (setq fetched-articles
4039 (mapcar (lambda (headers) (mail-header-number headers))
4040 gnus-newsgroup-headers))))
4041 ;; Removed marked articles that do not exist.
4042 (gnus-update-missing-marks
4043 (gnus-sorted-complement fetched-articles articles))
4045 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4047 (setq gnus-newsgroup-cached cached))
4049 ;; We might want to build some more threads first.
4050 (when (and gnus-fetch-old-headers
4051 (eq gnus-headers-retrieved-by 'nov))
4052 (if (eq gnus-fetch-old-headers 'invisible)
4053 (gnus-build-all-threads)
4054 (gnus-build-old-threads)))
4055 ;; Let the Gnus agent mark articles as read.
4057 (gnus-agent-get-undownloaded-list))
4058 ;; Check whether auto-expire is to be done in this group.
4059 (setq gnus-newsgroup-auto-expire
4060 (gnus-group-auto-expirable-p group))
4061 ;; Set up the article buffer now, if necessary.
4062 (unless gnus-single-article-buffer
4063 (gnus-article-setup-buffer))
4064 ;; First and last article in this newsgroup.
4065 (when gnus-newsgroup-headers
4066 (setq gnus-newsgroup-begin
4067 (mail-header-number (car gnus-newsgroup-headers))
4070 (gnus-last-element gnus-newsgroup-headers))))
4071 ;; GROUP is successfully selected.
4072 (or gnus-newsgroup-headers t)))))
4074 (defun gnus-articles-to-read (group &optional read-all)
4075 ;; Find out what articles the user wants to read.
4077 ;; Select all articles if `read-all' is non-nil, or if there
4078 ;; are no unread articles.
4080 (and (zerop (length gnus-newsgroup-marked))
4081 (zerop (length gnus-newsgroup-unreads)))
4082 (eq (gnus-group-find-parameter group 'display)
4084 (gnus-uncompress-range (gnus-active group))
4085 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4086 (copy-sequence gnus-newsgroup-unreads))
4088 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4089 (scored (length scored-list))
4090 (number (length articles))
4091 (marked (+ (length gnus-newsgroup-marked)
4092 (length gnus-newsgroup-dormant)))
4100 ((and (or (<= scored marked) (= scored number))
4101 (natnump gnus-large-newsgroup)
4102 (> number gnus-large-newsgroup))
4103 (let* ((minibuffer-setup-hook (append
4104 minibuffer-setup-hook
4105 '(beginning-of-line)))
4108 "How many articles from %s (max %d): "
4109 (gnus-limit-string gnus-newsgroup-name 35)
4111 (number-to-string gnus-large-newsgroup))))
4112 (if (string-match "^[ \t]*$" input)
4115 ((and (> scored marked) (< scored number)
4116 (> (- scored number) 20))
4119 (format "%s %s (%d scored, %d total): "
4120 "How many articles from"
4121 group scored number))))
4122 (if (string-match "^[ \t]*$" input)
4126 (setq select (if (stringp select) (string-to-number select) select))
4127 (if (or (null select) (zerop select))
4129 (if (and (not (zerop scored)) (<= (abs select) scored))
4131 (setq articles (sort scored-list '<))
4132 (setq number (length articles)))
4133 (setq articles (copy-sequence articles)))
4135 (when (< (abs select) number)
4137 ;; Select the N oldest articles.
4138 (setcdr (nthcdr (1- (abs select)) articles) nil)
4139 ;; Select the N most recent articles.
4140 (setq articles (nthcdr (- number select) articles))))
4141 (setq gnus-newsgroup-unselected
4142 (gnus-sorted-intersection
4143 gnus-newsgroup-unreads
4144 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4147 (defun gnus-killed-articles (killed articles)
4150 (when (inline (gnus-member-of-range (car articles) killed))
4151 (push (car articles) out))
4152 (setq articles (cdr articles)))
4155 (defun gnus-uncompress-marks (marks)
4156 "Uncompress the mark ranges in MARKS."
4157 (let ((uncompressed '(score bookmark))
4160 (if (memq (caar marks) uncompressed)
4161 (push (car marks) out)
4162 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4163 (setq marks (cdr marks)))
4166 (defun gnus-adjust-marked-articles (info)
4167 "Set all article lists and remove all marks that are no longer valid."
4168 (let* ((marked-lists (gnus-info-marks info))
4169 (active (gnus-active (gnus-info-group info)))
4172 (types gnus-article-mark-lists)
4173 (uncompressed '(score bookmark killed))
4174 marks var articles article mark)
4177 (setq marks (pop marked-lists))
4178 (set (setq var (intern (format "gnus-newsgroup-%s"
4179 (car (rassq (setq mark (car marks))
4181 (if (memq (car marks) uncompressed) (cdr marks)
4182 (gnus-uncompress-range (cdr marks))))
4184 (setq articles (symbol-value var))
4186 ;; All articles have to be subsets of the active articles.
4188 ;; Adjust "simple" lists.
4189 ((memq mark '(tick dormant expire reply save))
4191 (when (or (< (setq article (pop articles)) min) (> article max))
4192 (set var (delq article (symbol-value var))))))
4194 ((memq mark uncompressed)
4195 (when (not (listp (cdr (symbol-value var))))
4196 (set var (list (symbol-value var))))
4197 (when (not (listp (cdr articles)))
4198 (setq articles (list articles)))
4200 (when (or (not (consp (setq article (pop articles))))
4201 (< (car article) min)
4202 (> (car article) max))
4203 (set var (delq article (symbol-value var))))))))))
4205 (defun gnus-update-missing-marks (missing)
4206 "Go through the list of MISSING articles and remove them from the mark lists."
4208 (let ((types gnus-article-mark-lists)
4210 ;; Go through all types.
4212 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4213 (when (symbol-value var)
4214 ;; This list has articles. So we delete all missing articles
4218 (set var (delq (pop m) (symbol-value var)))))))))
4220 (defun gnus-update-marks ()
4221 "Enter the various lists of marked articles into the newsgroup info list."
4222 (let ((types gnus-article-mark-lists)
4223 (info (gnus-get-info gnus-newsgroup-name))
4224 (uncompressed '(score bookmark killed))
4225 type list newmarked symbol delta-marks)
4227 ;; Add all marks lists that are non-nil to the list of marks lists.
4228 (while (setq type (pop types))
4229 (when (setq list (symbol-value
4231 (intern (format "gnus-newsgroup-%s"
4234 ;; Get rid of the entries of the articles that have the
4236 (when (and (eq (cdr type) 'score)
4240 (prev (cons nil list))
4243 (if (or (not (consp (car arts)))
4244 (= (cdar arts) gnus-summary-default-score))
4245 (setcdr prev (cdr arts))
4247 (setq arts (cdr arts)))
4248 (setq list (cdr all))))
4250 (when (gnus-check-backend-function 'request-set-mark
4251 gnus-newsgroup-name)
4252 ;; score & bookmark are not proper flags (they are cons cells)
4253 ;; cache is a internal gnus flag
4254 (unless (memq (cdr type) '(cache score bookmark))
4255 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4256 (del (gnus-remove-from-range old list))
4257 (add (gnus-remove-from-range list old)))
4259 (push (list add 'add (list (cdr type))) delta-marks))
4261 (push (list del 'del (list (cdr type))) delta-marks)))))
4263 (push (cons (cdr type)
4264 (if (memq (cdr type) uncompressed) list
4265 (gnus-compress-sequence
4266 (set symbol (sort list '<)) t)))
4270 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4272 ;; Enter these new marks into the info of the group.
4274 (setcar (nthcdr 3 info) newmarked)
4275 ;; Add the marks lists to the end of the info.
4277 (setcdr (nthcdr 2 info) (list newmarked))))
4279 ;; Cut off the end of the info if there's nothing else there.
4283 (when (nthcdr (decf i) info)
4284 (setcdr (nthcdr i info) nil)))))))
4286 (defun gnus-set-mode-line (where)
4287 "This function sets the mode line of the article or summary buffers.
4288 If WHERE is `summary', the summary mode line format will be used."
4289 ;; Is this mode line one we keep updated?
4290 (when (and (memq where gnus-updated-mode-lines)
4292 (intern (format "gnus-%s-mode-line-format-spec" where))))
4295 ;; We evaluate this in the summary buffer since these
4296 ;; variables are buffer-local to that buffer.
4297 (set-buffer gnus-summary-buffer)
4298 ;; We bind all these variables that are used in the `eval' form
4300 (let* ((mformat (symbol-value
4302 (format "gnus-%s-mode-line-format-spec" where))))
4303 (gnus-tmp-group-name gnus-newsgroup-name)
4304 (gnus-tmp-article-number (or gnus-current-article 0))
4305 (gnus-tmp-unread gnus-newsgroup-unreads)
4306 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4307 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4308 (gnus-tmp-unread-and-unselected
4309 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4310 (zerop gnus-tmp-unselected))
4312 ((zerop gnus-tmp-unselected)
4313 (format "{%d more}" gnus-tmp-unread-and-unticked))
4314 (t (format "{%d(+%d) more}"
4315 gnus-tmp-unread-and-unticked
4316 gnus-tmp-unselected))))
4318 (if (and gnus-current-headers
4319 (vectorp gnus-current-headers))
4320 (gnus-mode-string-quote
4321 (mail-header-subject gnus-current-headers))
4323 bufname-length max-len
4324 gnus-tmp-header);; passed as argument to any user-format-funcs
4325 (setq mode-string (eval mformat))
4326 (setq bufname-length (if (string-match "%b" mode-string)
4329 (if (eq where 'summary)
4331 (get-buffer gnus-article-buffer))))
4334 (setq max-len (max 4 (if gnus-mode-non-string-length
4336 gnus-mode-non-string-length
4338 (length mode-string))))
4339 ;; We might have to chop a bit of the string off...
4340 (when (> (length mode-string) max-len)
4342 (concat (gnus-truncate-string mode-string (- max-len 3))
4344 ;; Pad the mode string a bit.
4345 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4346 ;; Update the mode line.
4347 (setq mode-line-buffer-identification
4348 (gnus-mode-line-buffer-identification (list mode-string)))
4349 (set-buffer-modified-p t))))
4351 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4352 "Go through the HEADERS list and add all Xrefs to a hash table.
4353 The resulting hash table is returned, or nil if no Xrefs were found."
4354 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4355 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4356 (xref-hashtb (gnus-make-hashtable))
4357 start group entry number xrefs header)
4359 (setq header (pop headers))
4360 (when (and (setq xrefs (mail-header-xref header))
4361 (not (memq (setq number (mail-header-number header))
4364 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4365 (setq start (match-end 0))
4366 (setq group (if prefix
4367 (concat prefix (substring xrefs (match-beginning 1)
4369 (substring xrefs (match-beginning 1) (match-end 1))))
4371 (string-to-int (substring xrefs (match-beginning 2)
4373 (if (setq entry (gnus-gethash group xref-hashtb))
4374 (setcdr entry (cons number (cdr entry)))
4375 (gnus-sethash group (cons number nil) xref-hashtb)))))
4376 (and start xref-hashtb)))
4378 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4379 "Look through all the headers and mark the Xrefs as read."
4380 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4381 name entry info xref-hashtb idlist method nth4)
4383 (set-buffer gnus-group-buffer)
4384 (when (setq xref-hashtb
4385 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4388 (unless (string= from-newsgroup (setq name (symbol-name group)))
4389 (setq idlist (symbol-value group))
4390 ;; Dead groups are not updated.
4392 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4394 (when (stringp (setq nth4 (gnus-info-method info)))
4395 (setq nth4 (gnus-server-to-method nth4))))
4396 ;; Only do the xrefs if the group has the same
4397 ;; select method as the group we have just read.
4398 (or (gnus-methods-equal-p
4399 nth4 (gnus-find-method-for-group from-newsgroup))
4401 (equal nth4 (setq method (gnus-find-method-for-group
4403 (and (equal (car nth4) (car method))
4404 (equal (nth 1 nth4) (nth 1 method))))
4405 gnus-use-cross-reference
4406 (or (not (eq gnus-use-cross-reference t))
4408 ;; Only do cross-references on subscribed
4409 ;; groups, if that is what is wanted.
4410 (<= (gnus-info-level info) gnus-level-subscribed))
4411 (gnus-group-make-articles-read name idlist))))
4414 (defun gnus-compute-read-articles (group articles)
4415 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4416 (info (nth 2 entry))
4417 (active (gnus-active group))
4420 ;; First peel off all invalid article numbers.
4422 (let ((ids articles)
4424 (while (setq id (pop ids))
4425 (when (and first (> id (cdr active)))
4426 ;; We'll end up in this situation in one particular
4427 ;; obscure situation. If you re-scan a group and get
4428 ;; a new article that is cross-posted to a different
4429 ;; group that has not been re-scanned, you might get
4430 ;; crossposted article that has a higher number than
4431 ;; Gnus believes possible. So we re-activate this
4432 ;; group as well. This might mean doing the
4433 ;; crossposting thingy will *increase* the number
4434 ;; of articles in some groups. Tsk, tsk.
4435 (setq active (or (gnus-activate-group group) active)))
4436 (when (or (> id (cdr active))
4437 (< id (car active)))
4438 (setq articles (delq id articles))))))
4439 ;; If the read list is nil, we init it.
4441 (null (gnus-info-read info))
4443 (setq ninfo (cons 1 (1- (car active))))
4444 (setq ninfo (gnus-info-read info)))
4445 ;; Then we add the read articles to the range.
4447 ninfo (setq articles (sort articles '<))))))
4449 (defun gnus-group-make-articles-read (group articles)
4450 "Update the info of GROUP to say that ARTICLES are read."
4452 (entry (gnus-gethash group gnus-newsrc-hashtb))
4453 (info (nth 2 entry))
4454 (active (gnus-active group))
4457 (setq range (gnus-compute-read-articles group articles))
4459 (set-buffer gnus-group-buffer)
4462 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4463 (gnus-info-set-read ',info ',(gnus-info-read info))
4464 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4465 (gnus-group-update-group ,group t))))
4466 ;; Add the read articles to the range.
4467 (gnus-info-set-read info range)
4468 ;; Then we have to re-compute how many unread
4469 ;; articles there are in this group.
4473 (setq num (- (1+ (cdr active)) (car active))))
4474 ((not (listp (cdr range)))
4475 (setq num (- (cdr active) (- (1+ (cdr range))
4479 (if (numberp (car range))
4481 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4482 (setq range (cdr range)))
4483 (setq num (- (cdr active) num))))
4484 ;; Update the number of unread articles.
4486 ;; Update the group buffer.
4487 (gnus-group-update-group group t)))))
4489 (defun gnus-methods-equal-p (m1 m2)
4490 (let ((m1 (or m1 gnus-select-method))
4491 (m2 (or m2 gnus-select-method)))
4493 (and (eq (car m1) (car m2))
4494 (or (not (memq 'address (assoc (symbol-name (car m1))
4495 gnus-valid-select-methods)))
4496 (equal (nth 1 m1) (nth 1 m2)))))))
4498 (defvar gnus-newsgroup-none-id 0)
4500 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4501 (let ((cur nntp-server-buffer)
4504 (save-excursion (set-buffer gnus-summary-buffer)
4505 gnus-newsgroup-dependencies)))
4507 (mail-parse-charset gnus-newsgroup-charset))
4509 (set-buffer nntp-server-buffer)
4510 ;; Translate all TAB characters into SPACE characters.
4511 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4512 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4513 (gnus-run-hooks 'gnus-parse-headers-hook)
4514 (let ((case-fold-search t)
4515 in-reply-to header p lines chars ctype)
4516 (goto-char (point-min))
4517 ;; Search to the beginning of the next header. Error messages
4518 ;; do not begin with 2 or 3.
4519 (while (re-search-forward "^[23][0-9]+ " nil t)
4522 ;; This implementation of this function, with nine
4523 ;; search-forwards instead of the one re-search-forward and
4524 ;; a case (which basically was the old function) is actually
4525 ;; about twice as fast, even though it looks messier. You
4526 ;; can't have everything, I guess. Speed and elegance
4527 ;; doesn't always go hand in hand.
4530 (make-full-mail-header
4536 (narrow-to-region (point)
4537 (or (and (search-forward "\n.\n" nil t)
4543 (if (search-forward "\nsubject: " nil t)
4544 (buffer-substring (match-end 0) (std11-field-end))
4549 (if (search-forward "\nfrom: " nil t)
4550 (buffer-substring (match-end 0) (std11-field-end))
4555 (if (search-forward "\ndate: " nil t)
4556 (buffer-substring (match-end 0) (std11-field-end))
4561 (setq id (if (re-search-forward
4562 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4563 ;; We do it this way to make sure the Message-ID
4564 ;; is (somewhat) syntactically valid.
4565 (buffer-substring (match-beginning 1)
4567 ;; If there was no message-id, we just fake one
4568 ;; to make subsequent routines simpler.
4569 (nnheader-generate-fake-message-id))))
4573 (if (search-forward "\nreferences: " nil t)
4577 (buffer-substring (match-end 0) (std11-field-end))
4582 (search-backward ">" end t)
4585 (search-backward "<" end t)
4587 ;; Get the references from the in-reply-to header if there
4588 ;; were no references and the in-reply-to header looks
4590 (if (and (search-forward "\nin-reply-to: " nil t)
4592 (buffer-substring (match-end 0)
4594 (string-match "<[^>]+>" in-reply-to))
4596 (setq ref (substring in-reply-to (match-beginning 0)
4598 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4599 (setq ref2 (substring in-reply-to (match-beginning 0)
4601 (when (> (length ref2) (length ref))
4608 (if (search-forward "\nchars: " nil t)
4609 (if (numberp (setq chars (ignore-errors (read cur))))
4615 (if (search-forward "\nlines: " nil t)
4616 (if (numberp (setq lines (ignore-errors (read cur))))
4622 (and (search-forward "\nxref: " nil t)
4623 (buffer-substring (match-end 0) (std11-field-end))))
4625 (when gnus-extra-headers
4626 (let ((extra gnus-extra-headers)
4630 (when (search-forward
4631 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4632 (push (cons (car extra)
4633 (buffer-substring (match-end 0)
4639 (if (and (search-forward "\ncontent-type: " nil t)
4641 (buffer-substring (match-end 0) (std11-field-end))))
4642 (mime-entity-set-content-type-internal
4643 header (mime-parse-Content-Type ctype)))
4644 (when (equal id ref)
4647 (when gnus-alter-header-function
4648 (funcall gnus-alter-header-function header)
4649 (setq id (mail-header-id header)
4650 ref (gnus-parent-id (mail-header-references header))))
4653 (gnus-dependencies-add-header
4654 header dependencies force-new))
4655 (push header headers))
4656 (goto-char (point-max))
4658 (nreverse headers)))))
4660 ;; Goes through the xover lines and returns a list of vectors
4661 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4662 force-new dependencies
4663 group also-fetch-heads)
4664 "Parse the news overview data in the server buffer, and return a
4665 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4666 ;; Get the Xref when the users reads the articles since most/some
4667 ;; NNTP servers do not include Xrefs when using XOVER.
4668 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4669 (let ((mail-parse-charset gnus-newsgroup-charset)
4670 (cur nntp-server-buffer)
4671 (dependencies (or dependencies gnus-newsgroup-dependencies))
4672 number headers header)
4674 (set-buffer nntp-server-buffer)
4675 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4676 ;; Allow the user to mangle the headers before parsing them.
4677 (gnus-run-hooks 'gnus-parse-headers-hook)
4678 (goto-char (point-min))
4681 (while (and sequence (not (eobp)))
4682 (setq number (read cur))
4683 (while (and sequence
4684 (< (car sequence) number))
4685 (setq sequence (cdr sequence)))
4687 (eq number (car sequence))
4689 (setq sequence (cdr sequence))
4690 (setq header (inline
4691 (gnus-nov-parse-line
4692 number dependencies force-new))))
4693 (push header headers))
4696 (gnus-error 4 "Strange nov line (%d)"
4697 (count-lines (point-min) (point)))))
4699 ;; A common bug in inn is that if you have posted an article and
4700 ;; then retrieves the active file, it will answer correctly --
4701 ;; the new article is included. However, a NOV entry for the
4702 ;; article may not have been generated yet, so this may fail.
4703 ;; We work around this problem by retrieving the last few
4704 ;; headers using HEAD.
4705 (if (or (not also-fetch-heads)
4707 ;; We (probably) got all the headers.
4709 (let ((gnus-nov-is-evil t))
4712 (gnus-retrieve-parsed-headers sequence group)
4715 (defun gnus-article-get-xrefs ()
4716 "Fill in the Xref value in `gnus-current-headers', if necessary.
4717 This is meant to be called in `gnus-article-internal-prepare-hook'."
4718 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4719 gnus-current-headers)))
4720 (or (not gnus-use-cross-reference)
4722 (and (mail-header-xref headers)
4723 (not (string= (mail-header-xref headers) "")))
4724 (let ((case-fold-search t)
4727 (nnheader-narrow-to-headers)
4728 (goto-char (point-min))
4729 (when (or (and (eq (downcase (char-after)) ?x)
4730 (looking-at "Xref:"))
4731 (search-forward "\nXref:" nil t))
4732 (goto-char (1+ (match-end 0)))
4733 (setq xref (buffer-substring (point)
4734 (progn (end-of-line) (point))))
4735 (mail-header-set-xref headers xref)))))))
4737 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4738 "Find article ID and insert the summary line for that article.
4739 OLD-HEADER can either be a header or a line number to insert
4740 the subject line on."
4741 (let* ((line (and (numberp old-header) old-header))
4742 (old-header (and (vectorp old-header) old-header))
4743 (header (cond ((and old-header use-old-header)
4746 (gnus-number-to-header id))
4747 (gnus-number-to-header id))
4749 (gnus-read-header id))))
4750 (number (and (numberp id) id))
4753 ;; Rebuild the thread that this article is part of and go to the
4754 ;; article we have fetched.
4755 (when (and (not gnus-show-threads)
4758 (setq d (gnus-data-find (mail-header-number old-header))))
4759 (goto-char (gnus-data-pos d))
4762 (- (gnus-point-at-bol)
4764 (1+ (gnus-point-at-eol))
4765 (gnus-delete-line))))))
4767 (mail-header-set-number header (mail-header-number old-header)))
4768 (setq gnus-newsgroup-sparse
4769 (delq (setq number (mail-header-number header))
4770 gnus-newsgroup-sparse))
4771 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4772 (push number gnus-newsgroup-limit)
4773 (gnus-rebuild-thread (mail-header-id header) line)
4774 (gnus-summary-goto-subject number nil t))
4775 (when (and (numberp number)
4777 ;; We have to update the boundaries even if we can't fetch the
4778 ;; article if ID is a number -- so that the next `P' or `N'
4779 ;; command will fetch the previous (or next) article even
4780 ;; if the one we tried to fetch this time has been canceled.
4781 (when (> number gnus-newsgroup-end)
4782 (setq gnus-newsgroup-end number))
4783 (when (< number gnus-newsgroup-begin)
4784 (setq gnus-newsgroup-begin number))
4785 (setq gnus-newsgroup-unselected
4786 (delq number gnus-newsgroup-unselected)))
4787 ;; Report back a success?
4788 (and header (mail-header-number header))))
4790 ;;; Process/prefix in the summary buffer
4792 (defun gnus-summary-work-articles (n)
4793 "Return a list of articles to be worked upon.
4794 The prefix argument, the list of process marked articles, and the
4795 current article will be taken into consideration."
4797 (set-buffer gnus-summary-buffer)
4800 ;; A numerical prefix has been given.
4801 (setq n (prefix-numeric-value n))
4802 (let ((backward (< n 0))
4803 (n (abs (prefix-numeric-value n)))
4808 (push (setq article (gnus-summary-article-number))
4811 (gnus-summary-find-prev nil article)
4812 (gnus-summary-find-next nil article)))
4814 (nreverse articles)))
4815 ((and (gnus-region-active-p) (mark))
4816 (message "region active")
4817 ;; Work on the region between point and mark.
4818 (let ((max (max (point) (mark)))
4821 (goto-char (min (point) (mark)))
4824 (push (setq article (gnus-summary-article-number)) articles)
4825 (gnus-summary-find-next nil article)
4827 (nreverse articles))))
4828 (gnus-newsgroup-processable
4829 ;; There are process-marked articles present.
4830 ;; Save current state.
4831 (gnus-summary-save-process-mark)
4833 (reverse gnus-newsgroup-processable))
4835 ;; Just return the current article.
4836 (list (gnus-summary-article-number))))))
4838 (defmacro gnus-summary-iterate (arg &rest forms)
4839 "Iterate over the process/prefixed articles and do FORMS.
4840 ARG is the interactive prefix given to the command. FORMS will be
4841 executed with point over the summary line of the articles."
4842 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4843 `(let ((,articles (gnus-summary-work-articles ,arg)))
4845 (gnus-summary-goto-subject (car ,articles))
4848 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4849 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4851 (defun gnus-summary-save-process-mark ()
4852 "Push the current set of process marked articles on the stack."
4854 (push (copy-sequence gnus-newsgroup-processable)
4855 gnus-newsgroup-process-stack))
4857 (defun gnus-summary-kill-process-mark ()
4858 "Push the current set of process marked articles on the stack and unmark."
4860 (gnus-summary-save-process-mark)
4861 (gnus-summary-unmark-all-processable))
4863 (defun gnus-summary-yank-process-mark ()
4864 "Pop the last process mark state off the stack and restore it."
4866 (unless gnus-newsgroup-process-stack
4867 (error "Empty mark stack"))
4868 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4870 (defun gnus-summary-process-mark-set (set)
4871 "Make SET into the current process marked articles."
4872 (gnus-summary-unmark-all-processable)
4874 (gnus-summary-set-process-mark (pop set))))
4876 ;;; Searching and stuff
4878 (defun gnus-summary-search-group (&optional backward use-level)
4879 "Search for next unread newsgroup.
4880 If optional argument BACKWARD is non-nil, search backward instead."
4882 (set-buffer gnus-group-buffer)
4883 (when (gnus-group-search-forward
4884 backward nil (if use-level (gnus-group-group-level) nil))
4885 (gnus-group-group-name))))
4887 (defun gnus-summary-best-group (&optional exclude-group)
4888 "Find the name of the best unread group.
4889 If EXCLUDE-GROUP, do not go to this group."
4891 (set-buffer gnus-group-buffer)
4893 (gnus-group-best-unread-group exclude-group))))
4895 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4896 (if backward (gnus-summary-find-prev)
4897 (let* ((dummy (gnus-summary-article-intangible-p))
4898 (article (or article (gnus-summary-article-number)))
4899 (arts (gnus-data-find-list article))
4901 (when (and (not dummy)
4902 (or (not gnus-summary-check-current)
4904 (not (gnus-data-unread-p (car arts)))))
4905 (setq arts (cdr arts)))
4910 (when (or (and undownloaded
4911 (eq gnus-undownloaded-mark
4912 (gnus-data-mark (car arts))))
4913 (gnus-data-unread-p (car arts)))
4914 (setq result (car arts)
4916 (setq arts (cdr arts)))
4919 (goto-char (gnus-data-pos result))
4920 (gnus-data-number result)))))
4922 (defun gnus-summary-find-prev (&optional unread article)
4923 (let* ((eobp (eobp))
4924 (article (or article (gnus-summary-article-number)))
4925 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4927 (when (and (not eobp)
4928 (or (not gnus-summary-check-current)
4930 (not (gnus-data-unread-p (car arts)))))
4931 (setq arts (cdr arts)))
4936 (when (gnus-data-unread-p (car arts))
4937 (setq result (car arts)
4939 (setq arts (cdr arts)))
4942 (goto-char (gnus-data-pos result))
4943 (gnus-data-number result))))
4945 (defun gnus-summary-find-subject (subject &optional unread backward article)
4946 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4947 (article (or article (gnus-summary-article-number)))
4948 (articles (gnus-data-list backward))
4949 (arts (gnus-data-find-list article articles))
4951 (when (or (not gnus-summary-check-current)
4953 (not (gnus-data-unread-p (car arts))))
4954 (setq arts (cdr arts)))
4956 (and (or (not unread)
4957 (gnus-data-unread-p (car arts)))
4958 (vectorp (gnus-data-header (car arts)))
4960 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4961 (setq result (car arts)
4963 (setq arts (cdr arts)))
4965 (goto-char (gnus-data-pos result))
4966 (gnus-data-number result))))
4968 (defun gnus-summary-search-forward (&optional unread subject backward)
4969 "Search forward for an article.
4970 If UNREAD, look for unread articles. If SUBJECT, look for
4971 articles with that subject. If BACKWARD, search backward instead."
4972 (cond (subject (gnus-summary-find-subject subject unread backward))
4973 (backward (gnus-summary-find-prev unread))
4974 (t (gnus-summary-find-next unread))))
4976 (defun gnus-recenter (&optional n)
4977 "Center point in window and redisplay frame.
4978 Also do horizontal recentering."
4980 (when (and gnus-auto-center-summary
4981 (not (eq gnus-auto-center-summary 'vertical)))
4982 (gnus-horizontal-recenter))
4985 (defun gnus-summary-recenter ()
4986 "Center point in the summary window.
4987 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4988 displayed, no centering will be performed."
4989 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4990 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4991 (let* ((top (cond ((< (window-height) 4) 0)
4992 ((< (window-height) 7) 1)
4993 (t (if (numberp gnus-auto-center-summary)
4994 gnus-auto-center-summary
4996 (height (1- (window-height)))
4997 (bottom (save-excursion (goto-char (point-max))
4998 (forward-line (- height))
5000 (window (get-buffer-window (current-buffer))))
5001 ;; The user has to want it.
5002 (when gnus-auto-center-summary
5003 (when (get-buffer-window gnus-article-buffer)
5004 ;; Only do recentering when the article buffer is displayed,
5005 ;; Set the window start to either `bottom', which is the biggest
5006 ;; possible valid number, or the second line from the top,
5007 ;; whichever is the least.
5009 window (min bottom (save-excursion
5010 (forward-line (- top)) (point)))))
5011 ;; Do horizontal recentering while we're at it.
5012 (when (and (get-buffer-window (current-buffer) t)
5013 (not (eq gnus-auto-center-summary 'vertical)))
5014 (let ((selected (selected-window)))
5015 (select-window (get-buffer-window (current-buffer) t))
5016 (gnus-summary-position-point)
5017 (gnus-horizontal-recenter)
5018 (select-window selected))))))
5020 (defun gnus-summary-jump-to-group (newsgroup)
5021 "Move point to NEWSGROUP in group mode buffer."
5022 ;; Keep update point of group mode buffer if visible.
5023 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5024 (save-window-excursion
5025 ;; Take care of tree window mode.
5026 (when (get-buffer-window gnus-group-buffer)
5027 (pop-to-buffer gnus-group-buffer))
5028 (gnus-group-jump-to-group newsgroup))
5030 ;; Take care of tree window mode.
5031 (if (get-buffer-window gnus-group-buffer)
5032 (pop-to-buffer gnus-group-buffer)
5033 (set-buffer gnus-group-buffer))
5034 (gnus-group-jump-to-group newsgroup))))
5036 ;; This function returns a list of article numbers based on the
5037 ;; difference between the ranges of read articles in this group and
5038 ;; the range of active articles.
5039 (defun gnus-list-of-unread-articles (group)
5040 (let* ((read (gnus-info-read (gnus-get-info group)))
5041 (active (or (gnus-active group) (gnus-activate-group group)))
5044 ;; If none are read, then all are unread.
5046 (setq first (car active))
5047 ;; If the range of read articles is a single range, then the
5048 ;; first unread article is the article after the last read
5049 ;; article. Sounds logical, doesn't it?
5050 (if (not (listp (cdr read)))
5051 (setq first (max (car active) (1+ (cdr read))))
5052 ;; `read' is a list of ranges.
5053 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5056 (setq first (car active)))
5059 (while (< first nlast)
5061 (setq first (1+ first))))
5062 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5063 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5064 (setq read (cdr read)))))
5065 ;; And add the last unread articles.
5066 (while (<= first last)
5068 (setq first (1+ first)))
5069 ;; Return the list of unread articles.
5070 (delq 0 (nreverse unread))))
5072 (defun gnus-list-of-read-articles (group)
5073 "Return a list of unread, unticked and non-dormant articles."
5074 (let* ((info (gnus-get-info group))
5075 (marked (gnus-info-marks info))
5076 (active (gnus-active group)))
5078 (gnus-set-difference
5079 (gnus-sorted-complement
5080 (gnus-uncompress-range active)
5081 (gnus-list-of-unread-articles group))
5083 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5084 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5086 ;; Various summary commands
5088 (defun gnus-summary-select-article-buffer ()
5089 "Reconfigure windows to show article buffer."
5091 (if (not (gnus-buffer-live-p gnus-article-buffer))
5092 (error "There is no article buffer for this summary buffer")
5093 (gnus-configure-windows 'article)
5094 (select-window (get-buffer-window gnus-article-buffer))))
5096 (defun gnus-summary-universal-argument (arg)
5097 "Perform any operation on all articles that are process/prefixed."
5099 (let ((articles (gnus-summary-work-articles arg))
5106 (substitute-command-keys
5107 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5110 (gnus-error 1 "Undefined key")
5113 (gnus-summary-goto-subject (setq article (pop articles)))
5114 (let (gnus-newsgroup-processable)
5115 (command-execute func))
5116 (gnus-summary-remove-process-mark article)))))
5117 (gnus-summary-position-point))
5119 (defun gnus-summary-toggle-truncation (&optional arg)
5120 "Toggle truncation of summary lines.
5121 With arg, turn line truncation on iff arg is positive."
5123 (setq truncate-lines
5124 (if (null arg) (not truncate-lines)
5125 (> (prefix-numeric-value arg) 0)))
5128 (defun gnus-summary-reselect-current-group (&optional all rescan)
5129 "Exit and then reselect the current newsgroup.
5130 The prefix argument ALL means to select all articles."
5132 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5133 (error "Ephemeral groups can't be reselected"))
5134 (let ((current-subject (gnus-summary-article-number))
5135 (group gnus-newsgroup-name))
5136 (setq gnus-newsgroup-begin nil)
5138 ;; We have to adjust the point of group mode buffer because
5139 ;; point was moved to the next unread newsgroup by exiting.
5140 (gnus-summary-jump-to-group group)
5143 (gnus-group-get-new-news-this-group 1)))
5144 (gnus-group-read-group all t)
5145 (gnus-summary-goto-subject current-subject nil t)))
5147 (defun gnus-summary-rescan-group (&optional all)
5148 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5150 (gnus-summary-reselect-current-group all t))
5152 (defun gnus-summary-update-info (&optional non-destructive)
5154 (let ((group gnus-newsgroup-name))
5156 (when gnus-newsgroup-kill-headers
5157 (setq gnus-newsgroup-killed
5158 (gnus-compress-sequence
5160 (gnus-set-sorted-intersection
5161 (gnus-uncompress-range gnus-newsgroup-killed)
5162 (setq gnus-newsgroup-unselected
5163 (sort gnus-newsgroup-unselected '<)))
5164 (setq gnus-newsgroup-unreads
5165 (sort gnus-newsgroup-unreads '<)))
5167 (unless (listp (cdr gnus-newsgroup-killed))
5168 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5169 (let ((headers gnus-newsgroup-headers))
5170 ;; Set the new ranges of read articles.
5172 (set-buffer gnus-group-buffer)
5173 (gnus-undo-force-boundary))
5174 (gnus-update-read-articles
5175 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5176 ;; Set the current article marks.
5177 (let ((gnus-newsgroup-scored
5178 (if (and (not gnus-save-score)
5179 (not non-destructive))
5181 gnus-newsgroup-scored)))
5183 (gnus-update-marks)))
5184 ;; Do the cross-ref thing.
5185 (when gnus-use-cross-reference
5186 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5187 ;; Do not switch windows but change the buffer to work.
5188 (set-buffer gnus-group-buffer)
5189 (unless (gnus-ephemeral-group-p group)
5190 (gnus-group-update-group group)))))))
5192 (defun gnus-summary-save-newsrc (&optional force)
5193 "Save the current number of read/marked articles in the dribble buffer.
5194 The dribble buffer will then be saved.
5195 If FORCE (the prefix), also save the .newsrc file(s)."
5197 (gnus-summary-update-info t)
5199 (gnus-save-newsrc-file)
5200 (gnus-dribble-save)))
5202 (defun gnus-summary-exit (&optional temporary)
5203 "Exit reading current newsgroup, and then return to group selection mode.
5204 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5206 (gnus-set-global-variables)
5207 (gnus-kill-save-kill-buffer)
5208 (gnus-async-halt-prefetch)
5209 (let* ((group gnus-newsgroup-name)
5210 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5213 (buf (current-buffer)))
5215 ;; Do adaptive scoring, and possibly save score files.
5216 (when gnus-newsgroup-adaptive
5217 (gnus-score-adaptive))
5218 (when gnus-use-scoring
5220 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5221 ;; If we have several article buffers, we kill them at exit.
5222 (unless gnus-single-article-buffer
5223 (gnus-kill-buffer gnus-original-article-buffer)
5224 (setq gnus-article-current nil))
5225 (when gnus-use-cache
5226 (gnus-cache-possibly-remove-articles)
5227 (gnus-cache-save-buffers))
5228 (gnus-async-prefetch-remove-group group)
5229 (when gnus-suppress-duplicates
5230 (gnus-dup-enter-articles))
5231 (when gnus-use-trees
5232 (gnus-tree-close group))
5233 ;; Remove entries for this group.
5234 (nnmail-purge-split-history (gnus-group-real-name group))
5235 ;; Make all changes in this group permanent.
5237 (gnus-run-hooks 'gnus-exit-group-hook)
5238 (gnus-summary-update-info))
5239 (gnus-close-group group)
5240 ;; Make sure where we were, and go to next newsgroup.
5241 (set-buffer gnus-group-buffer)
5243 (gnus-group-jump-to-group group))
5244 (gnus-run-hooks 'gnus-summary-exit-hook)
5245 (unless (or quit-config
5246 ;; If this group has disappeared from the summary
5247 ;; buffer, don't skip forwards.
5248 (not (string= group (gnus-group-group-name))))
5249 (gnus-group-next-unread-group 1))
5250 (setq group-point (point))
5253 ;; If we have several article buffers, we kill them at exit.
5254 (unless gnus-single-article-buffer
5255 (gnus-kill-buffer gnus-article-buffer)
5256 (gnus-kill-buffer gnus-original-article-buffer)
5257 (setq gnus-article-current nil))
5259 (if (not gnus-kill-summary-on-exit)
5260 (gnus-deaden-summary)
5261 ;; We set all buffer-local variables to nil. It is unclear why
5262 ;; this is needed, but if we don't, buffer-local variables are
5263 ;; not garbage-collected, it seems. This would the lead to en
5264 ;; ever-growing Emacs.
5265 (gnus-summary-clear-local-variables)
5266 (when (get-buffer gnus-article-buffer)
5267 (bury-buffer gnus-article-buffer))
5268 ;; We clear the global counterparts of the buffer-local
5269 ;; variables as well, just to be on the safe side.
5270 (set-buffer gnus-group-buffer)
5271 (gnus-summary-clear-local-variables)
5272 ;; Return to group mode buffer.
5273 (when (eq mode 'gnus-summary-mode)
5274 (gnus-kill-buffer buf)))
5275 (setq gnus-current-select-method gnus-select-method)
5276 (pop-to-buffer gnus-group-buffer)
5277 (if (not quit-config)
5279 (goto-char group-point)
5280 (gnus-configure-windows 'group 'force))
5281 (gnus-handle-ephemeral-exit quit-config))
5282 ;; Clear the current group name.
5284 (setq gnus-newsgroup-name nil)))))
5286 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5287 (defun gnus-summary-exit-no-update (&optional no-questions)
5288 "Quit reading current newsgroup without updating read article info."
5290 (let* ((group gnus-newsgroup-name)
5291 (quit-config (gnus-group-quit-config group)))
5292 (when (or no-questions
5294 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5295 (gnus-async-halt-prefetch)
5297 (delq 'gnus-summary-expire-articles
5298 (copy-list gnus-summary-prepare-exit-hook)))
5299 ;; If we have several article buffers, we kill them at exit.
5300 (unless gnus-single-article-buffer
5301 (gnus-kill-buffer gnus-article-buffer)
5302 (gnus-kill-buffer gnus-original-article-buffer)
5303 (setq gnus-article-current nil))
5304 (if (not gnus-kill-summary-on-exit)
5305 (gnus-deaden-summary)
5306 (gnus-close-group group)
5307 (gnus-summary-clear-local-variables)
5308 (set-buffer gnus-group-buffer)
5309 (gnus-summary-clear-local-variables)
5310 (when (get-buffer gnus-summary-buffer)
5311 (kill-buffer gnus-summary-buffer)))
5312 (unless gnus-single-article-buffer
5313 (setq gnus-article-current nil))
5314 (when gnus-use-trees
5315 (gnus-tree-close group))
5316 (gnus-async-prefetch-remove-group group)
5317 (when (get-buffer gnus-article-buffer)
5318 (bury-buffer gnus-article-buffer))
5319 ;; Return to the group buffer.
5320 (gnus-configure-windows 'group 'force)
5321 ;; Clear the current group name.
5322 (setq gnus-newsgroup-name nil)
5323 (when (equal (gnus-group-group-name) group)
5324 (gnus-group-next-unread-group 1))
5326 (gnus-handle-ephemeral-exit quit-config)))))
5328 (defun gnus-handle-ephemeral-exit (quit-config)
5329 "Handle movement when leaving an ephemeral group.
5330 The state which existed when entering the ephemeral is reset."
5331 (if (not (buffer-name (car quit-config)))
5332 (gnus-configure-windows 'group 'force)
5333 (set-buffer (car quit-config))
5334 (cond ((eq major-mode 'gnus-summary-mode)
5335 (gnus-set-global-variables))
5336 ((eq major-mode 'gnus-article-mode)
5338 ;; The `gnus-summary-buffer' variable may point
5339 ;; to the old summary buffer when using a single
5341 (unless (gnus-buffer-live-p gnus-summary-buffer)
5342 (set-buffer gnus-group-buffer))
5343 (set-buffer gnus-summary-buffer)
5344 (gnus-set-global-variables))))
5345 (if (or (eq (cdr quit-config) 'article)
5346 (eq (cdr quit-config) 'pick))
5348 ;; The current article may be from the ephemeral group
5349 ;; thus it is best that we reload this article
5350 (gnus-summary-show-article)
5351 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5352 (gnus-configure-windows 'pick 'force)
5353 (gnus-configure-windows (cdr quit-config) 'force)))
5354 (gnus-configure-windows (cdr quit-config) 'force))
5355 (when (eq major-mode 'gnus-summary-mode)
5356 (gnus-summary-next-subject 1 nil t)
5357 (gnus-summary-recenter)
5358 (gnus-summary-position-point))))
5360 (defun gnus-summary-preview-mime-message ()
5361 "MIME decode and play this message."
5363 (let ((gnus-break-pages nil)
5365 (gnus-summary-select-article gnus-show-all-headers t))
5366 (select-window (get-buffer-window gnus-article-buffer)))
5370 (defvar gnus-dead-summary-mode-map nil)
5372 (unless gnus-dead-summary-mode-map
5373 (setq gnus-dead-summary-mode-map (make-keymap))
5374 (suppress-keymap gnus-dead-summary-mode-map)
5375 (substitute-key-definition
5376 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5377 (let ((keys '("\C-d" "\r" "\177" [delete])))
5379 (define-key gnus-dead-summary-mode-map
5380 (pop keys) 'gnus-summary-wake-up-the-dead))))
5382 (defvar gnus-dead-summary-mode nil
5383 "Minor mode for Gnus summary buffers.")
5385 (defun gnus-dead-summary-mode (&optional arg)
5386 "Minor mode for Gnus summary buffers."
5388 (when (eq major-mode 'gnus-summary-mode)
5389 (make-local-variable 'gnus-dead-summary-mode)
5390 (setq gnus-dead-summary-mode
5391 (if (null arg) (not gnus-dead-summary-mode)
5392 (> (prefix-numeric-value arg) 0)))
5393 (when gnus-dead-summary-mode
5394 (gnus-add-minor-mode
5395 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5397 (defun gnus-deaden-summary ()
5398 "Make the current summary buffer into a dead summary buffer."
5399 ;; Kill any previous dead summary buffer.
5400 (when (and gnus-dead-summary
5401 (buffer-name gnus-dead-summary))
5403 (set-buffer gnus-dead-summary)
5404 (when gnus-dead-summary-mode
5405 (kill-buffer (current-buffer)))))
5406 ;; Make this the current dead summary.
5407 (setq gnus-dead-summary (current-buffer))
5408 (gnus-dead-summary-mode 1)
5409 (let ((name (buffer-name)))
5410 (when (string-match "Summary" name)
5412 (concat (substring name 0 (match-beginning 0)) "Dead "
5413 (substring name (match-beginning 0)))
5416 (defun gnus-kill-or-deaden-summary (buffer)
5417 "Kill or deaden the summary BUFFER."
5419 (when (and (buffer-name buffer)
5420 (not gnus-single-article-buffer))
5423 (gnus-kill-buffer gnus-article-buffer)
5424 (gnus-kill-buffer gnus-original-article-buffer)))
5425 (cond (gnus-kill-summary-on-exit
5426 (when (and gnus-use-trees
5427 (gnus-buffer-exists-p buffer))
5430 (gnus-tree-close gnus-newsgroup-name)))
5431 (gnus-kill-buffer buffer))
5432 ((gnus-buffer-exists-p buffer)
5435 (gnus-deaden-summary))))))
5437 (defun gnus-summary-wake-up-the-dead (&rest args)
5438 "Wake up the dead summary buffer."
5440 (gnus-dead-summary-mode -1)
5441 (let ((name (buffer-name)))
5442 (when (string-match "Dead " name)
5444 (concat (substring name 0 (match-beginning 0))
5445 (substring name (match-end 0)))
5447 (gnus-message 3 "This dead summary is now alive again"))
5449 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5450 (defun gnus-summary-fetch-faq (&optional faq-dir)
5451 "Fetch the FAQ for the current group.
5452 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5456 (when current-prefix-arg
5458 "Faq dir: " (and (listp gnus-group-faq-directory)
5459 (mapcar (lambda (file) (list file))
5460 gnus-group-faq-directory))))))
5461 (let (gnus-faq-buffer)
5462 (when (setq gnus-faq-buffer
5463 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5464 (gnus-configure-windows 'summary-faq))))
5466 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5467 (defun gnus-summary-describe-group (&optional force)
5468 "Describe the current newsgroup."
5470 (gnus-group-describe-group force gnus-newsgroup-name))
5472 (defun gnus-summary-describe-briefly ()
5473 "Describe summary mode commands briefly."
5475 (gnus-message 6 (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")))
5477 ;; Walking around group mode buffer from summary mode.
5479 (defun gnus-summary-next-group (&optional no-article target-group backward)
5480 "Exit current newsgroup and then select next unread newsgroup.
5481 If prefix argument NO-ARTICLE is non-nil, no article is selected
5482 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5483 previous group instead."
5485 ;; Stop pre-fetching.
5486 (gnus-async-halt-prefetch)
5487 (let ((current-group gnus-newsgroup-name)
5488 (current-buffer (current-buffer))
5490 ;; First we semi-exit this group to update Xrefs and all variables.
5491 ;; We can't do a real exit, because the window conf must remain
5492 ;; the same in case the user is prompted for info, and we don't
5493 ;; want the window conf to change before that...
5494 (gnus-summary-exit t)
5495 (while (not entered)
5496 ;; Then we find what group we are supposed to enter.
5497 (set-buffer gnus-group-buffer)
5498 (gnus-group-jump-to-group current-group)
5501 (if (eq gnus-keep-same-level 'best)
5502 (gnus-summary-best-group gnus-newsgroup-name)
5503 (gnus-summary-search-group backward gnus-keep-same-level))))
5504 (if (not target-group)
5505 ;; There are no further groups, so we return to the group
5508 (gnus-message 5 "Returning to the group buffer")
5510 (when (gnus-buffer-live-p current-buffer)
5511 (set-buffer current-buffer)
5512 (gnus-summary-exit))
5513 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5514 ;; We try to enter the target group.
5515 (gnus-group-jump-to-group target-group)
5516 (let ((unreads (gnus-group-group-unread)))
5517 (if (and (or (eq t unreads)
5518 (and unreads (not (zerop unreads))))
5519 (gnus-summary-read-group
5520 target-group nil no-article
5521 (and (buffer-name current-buffer) current-buffer)
5524 (setq current-group target-group
5525 target-group nil)))))))
5527 (defun gnus-summary-prev-group (&optional no-article)
5528 "Exit current newsgroup and then select previous unread newsgroup.
5529 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5531 (gnus-summary-next-group no-article nil t))
5533 ;; Walking around summary lines.
5535 (defun gnus-summary-first-subject (&optional unread undownloaded)
5536 "Go to the first unread subject.
5537 If UNREAD is non-nil, go to the first unread article.
5538 Returns the article selected or nil if there are no unread articles."
5543 ((null gnus-newsgroup-data)
5544 (gnus-message 3 "No articles in the group")
5546 ;; Pick the first article.
5548 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5549 (gnus-data-number (car gnus-newsgroup-data)))
5550 ;; No unread articles.
5551 ((null gnus-newsgroup-unreads)
5552 (gnus-message 3 "No more unread articles")
5554 ;; Find the first unread article.
5556 (let ((data gnus-newsgroup-data))
5558 (and (not (and undownloaded
5559 (eq gnus-undownloaded-mark
5560 (gnus-data-mark (car data)))))
5561 (not (gnus-data-unread-p (car data)))))
5562 (setq data (cdr data)))
5564 (goto-char (gnus-data-pos (car data)))
5565 (gnus-data-number (car data))))))
5566 (gnus-summary-position-point)))
5568 (defun gnus-summary-next-subject (n &optional unread dont-display)
5569 "Go to next N'th summary line.
5570 If N is negative, go to the previous N'th subject line.
5571 If UNREAD is non-nil, only unread articles are selected.
5572 The difference between N and the actual number of steps taken is
5575 (let ((backward (< n 0))
5579 (gnus-summary-find-prev unread)
5580 (gnus-summary-find-next unread)))
5581 (gnus-summary-show-thread)
5584 (gnus-message 7 "No more%s articles"
5585 (if unread " unread" "")))
5586 (unless dont-display
5587 (gnus-summary-recenter)
5588 (gnus-summary-position-point))
5591 (defun gnus-summary-next-unread-subject (n)
5592 "Go to next N'th unread summary line."
5594 (gnus-summary-next-subject n t))
5596 (defun gnus-summary-prev-subject (n &optional unread)
5597 "Go to previous N'th summary line.
5598 If optional argument UNREAD is non-nil, only unread article is selected."
5600 (gnus-summary-next-subject (- n) unread))
5602 (defun gnus-summary-prev-unread-subject (n)
5603 "Go to previous N'th unread summary line."
5605 (gnus-summary-next-subject (- n) t))
5607 (defun gnus-summary-goto-subject (article &optional force silent)
5608 "Go the subject line of ARTICLE.
5609 If FORCE, also allow jumping to articles not currently shown."
5610 (interactive "nArticle number: ")
5612 (data (gnus-data-find article)))
5613 ;; We read in the article if we have to.
5616 (gnus-summary-insert-subject
5618 (if (or (numberp force) (vectorp force)) force)
5620 (setq data (gnus-data-find article)))
5625 (gnus-message 3 "Can't find article %d" article))
5627 (goto-char (gnus-data-pos data))
5628 (gnus-summary-position-point)
5631 ;; Walking around summary lines with displaying articles.
5633 (defun gnus-summary-expand-window (&optional arg)
5634 "Make the summary buffer take up the entire Emacs frame.
5635 Given a prefix, will force an `article' buffer configuration."
5638 (gnus-configure-windows 'article 'force)
5639 (gnus-configure-windows 'summary 'force)))
5641 (defun gnus-summary-display-article (article &optional all-header)
5642 "Display ARTICLE in article buffer."
5643 (gnus-set-global-variables)
5647 (if gnus-summary-display-article-function
5648 (funcall gnus-summary-display-article-function article all-header)
5649 (gnus-article-prepare article all-header))
5650 (gnus-run-hooks 'gnus-select-article-hook)
5651 (when (and gnus-current-article
5652 (not (zerop gnus-current-article)))
5653 (gnus-summary-goto-subject gnus-current-article))
5654 (gnus-summary-recenter)
5655 (when (and gnus-use-trees gnus-show-threads)
5656 (gnus-possibly-generate-tree article)
5657 (gnus-highlight-selected-tree article))
5658 ;; Successfully display article.
5659 (gnus-article-set-window-start
5660 (cdr (assq article gnus-newsgroup-bookmarks))))))
5662 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5663 "Select the current article.
5664 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5665 non-nil, the article will be re-fetched even if it already present in
5666 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5668 ;; Make sure we are in the summary buffer to work around bbdb bug.
5669 (unless (eq major-mode 'gnus-summary-mode)
5670 (set-buffer gnus-summary-buffer))
5671 (let ((article (or article (gnus-summary-article-number)))
5672 (all-headers (not (not all-headers))) ;Must be T or NIL.
5673 gnus-summary-display-article-function
5676 (gnus-summary-article-pseudo-p article)
5677 (error "This is a pseudo-article"))
5680 (set-buffer gnus-summary-buffer)
5681 (if (or (and gnus-single-article-buffer
5682 (or (null gnus-current-article)
5683 (null gnus-article-current)
5684 (null (get-buffer gnus-article-buffer))
5685 (not (eq article (cdr gnus-article-current)))
5686 (not (equal (car gnus-article-current)
5687 gnus-newsgroup-name))))
5688 (and (not gnus-single-article-buffer)
5689 (or (null gnus-current-article)
5690 (not (eq gnus-current-article article))))
5692 ;; The requested article is different from the current article.
5694 (gnus-summary-display-article article all-headers)
5696 (when (or all-headers gnus-show-all-headers)
5697 (gnus-article-show-all-headers)))
5698 (when (or all-headers gnus-show-all-headers)
5699 (gnus-article-show-all-headers))
5702 (gnus-article-set-window-start
5703 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5705 (defun gnus-summary-set-current-mark (&optional current-mark)
5706 "Obsolete function."
5709 (defun gnus-summary-next-article (&optional unread subject backward push)
5710 "Select the next article.
5711 If UNREAD, only unread articles are selected.
5712 If SUBJECT, only articles with SUBJECT are selected.
5713 If BACKWARD, the previous article is selected instead of the next."
5716 ;; Is there such an article?
5717 ((and (gnus-summary-search-forward unread subject backward)
5718 (or (gnus-summary-display-article (gnus-summary-article-number))
5719 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5720 (gnus-summary-position-point))
5721 ;; If not, we try the first unread, if that is wanted.
5723 gnus-auto-select-same
5724 (gnus-summary-first-unread-article))
5725 (gnus-summary-position-point)
5726 (gnus-message 6 "Wrapped"))
5727 ;; Try to get next/previous article not displayed in this group.
5728 ((and gnus-auto-extend-newsgroup
5729 (not unread) (not subject))
5730 (gnus-summary-goto-article
5731 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5732 nil (count-lines (point-min) (point))))
5733 ;; Go to next/previous group.
5735 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5736 (gnus-summary-jump-to-group gnus-newsgroup-name))
5737 (let ((cmd last-command-char)
5740 (set-buffer gnus-group-buffer)
5743 (if (eq gnus-keep-same-level 'best)
5744 (gnus-summary-best-group gnus-newsgroup-name)
5745 (gnus-summary-search-group backward gnus-keep-same-level))))
5746 ;; For some reason, the group window gets selected. We change
5748 (select-window (get-buffer-window (current-buffer)))
5749 ;; Select next unread newsgroup automagically.
5751 ((or (not gnus-auto-select-next)
5753 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5754 ((or (eq gnus-auto-select-next 'quietly)
5755 (and (eq gnus-auto-select-next 'slightly-quietly)
5757 (and (eq gnus-auto-select-next 'almost-quietly)
5758 (gnus-summary-last-article-p)))
5760 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5762 (gnus-message 7 "No more%s articles (%s)..."
5763 (if unread " unread" "")
5764 (if group (concat "selecting " group)
5766 (gnus-summary-next-group nil group backward)))
5768 (when (gnus-key-press-event-p last-input-event)
5769 (gnus-summary-walk-group-buffer
5770 gnus-newsgroup-name cmd unread backward point))))))))
5772 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5773 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5774 (?\C-p (gnus-group-prev-unread-group 1))))
5775 (cursor-in-echo-area t)
5776 keve key group ended)
5778 (set-buffer gnus-group-buffer)
5781 (if (eq gnus-keep-same-level 'best)
5782 (gnus-summary-best-group gnus-newsgroup-name)
5783 (gnus-summary-search-group backward gnus-keep-same-level))))
5786 5 "No more%s articles%s" (if unread " unread" "")
5788 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5789 (format " (Type %s for %s [%s])"
5790 (single-key-description cmd) group
5791 (car (gnus-gethash group gnus-newsrc-hashtb)))
5792 (format " (Type %s to exit %s)"
5793 (single-key-description cmd)
5794 gnus-newsgroup-name)))
5795 ;; Confirm auto selection.
5796 (setq key (car (setq keve (gnus-read-event-char))))
5799 ((assq key keystrokes)
5800 (let ((obuf (current-buffer)))
5801 (switch-to-buffer gnus-group-buffer)
5803 (gnus-group-jump-to-group group))
5804 (eval (cadr (assq key keystrokes)))
5805 (setq group (gnus-group-group-name))
5806 (switch-to-buffer obuf))
5810 (gnus-ephemeral-group-p gnus-newsgroup-name))
5812 (gnus-summary-next-group nil group backward)))
5814 (push (cdr keve) unread-command-events))))))
5816 (defun gnus-summary-next-unread-article ()
5817 "Select unread article after current one."
5819 (gnus-summary-next-article
5820 (or (not (eq gnus-summary-goto-unread 'never))
5821 (gnus-summary-last-article-p (gnus-summary-article-number)))
5822 (and gnus-auto-select-same
5823 (gnus-summary-article-subject))))
5825 (defun gnus-summary-prev-article (&optional unread subject)
5826 "Select the article after the current one.
5827 If UNREAD is non-nil, only unread articles are selected."
5829 (gnus-summary-next-article unread subject t))
5831 (defun gnus-summary-prev-unread-article ()
5832 "Select unread article before current one."
5834 (gnus-summary-prev-article
5835 (or (not (eq gnus-summary-goto-unread 'never))
5836 (gnus-summary-first-article-p (gnus-summary-article-number)))
5837 (and gnus-auto-select-same
5838 (gnus-summary-article-subject))))
5840 (defun gnus-summary-next-page (&optional lines circular)
5841 "Show next page of the selected article.
5842 If at the end of the current article, select the next article.
5843 LINES says how many lines should be scrolled up.
5845 If CIRCULAR is non-nil, go to the start of the article instead of
5846 selecting the next article when reaching the end of the current
5849 (setq gnus-summary-buffer (current-buffer))
5850 (gnus-set-global-variables)
5851 (let ((article (gnus-summary-article-number))
5852 (article-window (get-buffer-window gnus-article-buffer t))
5854 ;; If the buffer is empty, we have no article.
5856 (error "No article to select"))
5857 (gnus-configure-windows 'article)
5858 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5859 (if (and (eq gnus-summary-goto-unread 'never)
5860 (not (gnus-summary-last-article-p article)))
5861 (gnus-summary-next-article)
5862 (gnus-summary-next-unread-article))
5863 (if (or (null gnus-current-article)
5864 (null gnus-article-current)
5865 (/= article (cdr gnus-article-current))
5866 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5867 ;; Selected subject is different from current article's.
5868 (gnus-summary-display-article article)
5869 (when article-window
5870 (gnus-eval-in-buffer-window gnus-article-buffer
5871 (setq endp (gnus-article-next-page lines)))
5874 (gnus-summary-beginning-of-article))
5876 (gnus-message 3 "End of message"))
5878 (if (and (eq gnus-summary-goto-unread 'never)
5879 (not (gnus-summary-last-article-p article)))
5880 (gnus-summary-next-article)
5881 (gnus-summary-next-unread-article))))))))
5882 (gnus-summary-recenter)
5883 (gnus-summary-position-point)))
5885 (defun gnus-summary-prev-page (&optional lines move)
5886 "Show previous page of selected article.
5887 Argument LINES specifies lines to be scrolled down.
5888 If MOVE, move to the previous unread article if point is at
5889 the beginning of the buffer."
5891 (let ((article (gnus-summary-article-number))
5892 (article-window (get-buffer-window gnus-article-buffer t))
5894 (gnus-configure-windows 'article)
5895 (if (or (null gnus-current-article)
5896 (null gnus-article-current)
5897 (/= article (cdr gnus-article-current))
5898 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5899 ;; Selected subject is different from current article's.
5900 (gnus-summary-display-article article)
5901 (gnus-summary-recenter)
5902 (when article-window
5903 (gnus-eval-in-buffer-window gnus-article-buffer
5904 (setq endp (gnus-article-prev-page lines)))
5905 (when (and move endp)
5907 (gnus-message 3 "Beginning of message"))
5909 (if (and (eq gnus-summary-goto-unread 'never)
5910 (not (gnus-summary-first-article-p article)))
5911 (gnus-summary-prev-article)
5912 (gnus-summary-prev-unread-article))))))))
5913 (gnus-summary-position-point))
5915 (defun gnus-summary-prev-page-or-article (&optional lines)
5916 "Show previous page of selected article.
5917 Argument LINES specifies lines to be scrolled down.
5918 If at the beginning of the article, go to the next article."
5920 (gnus-summary-prev-page lines t))
5922 (defun gnus-summary-scroll-up (lines)
5923 "Scroll up (or down) one line current article.
5924 Argument LINES specifies lines to be scrolled up (or down if negative)."
5926 (gnus-configure-windows 'article)
5927 (gnus-summary-show-thread)
5928 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5929 (gnus-eval-in-buffer-window gnus-article-buffer
5931 (when (gnus-article-next-page lines)
5932 (gnus-message 3 "End of message")))
5934 (gnus-article-prev-page (- lines))))))
5935 (gnus-summary-recenter)
5936 (gnus-summary-position-point))
5938 (defun gnus-summary-scroll-down (lines)
5939 "Scroll down (or up) one line current article.
5940 Argument LINES specifies lines to be scrolled down (or up if negative)."
5942 (gnus-summary-scroll-up (- lines)))
5944 (defun gnus-summary-next-same-subject ()
5945 "Select next article which has the same subject as current one."
5947 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5949 (defun gnus-summary-prev-same-subject ()
5950 "Select previous article which has the same subject as current one."
5952 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5954 (defun gnus-summary-next-unread-same-subject ()
5955 "Select next unread article which has the same subject as current one."
5957 (gnus-summary-next-article t (gnus-summary-article-subject)))
5959 (defun gnus-summary-prev-unread-same-subject ()
5960 "Select previous unread article which has the same subject as current one."
5962 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5964 (defun gnus-summary-first-unread-article ()
5965 "Select the first unread article.
5966 Return nil if there are no unread articles."
5969 (when (gnus-summary-first-subject t)
5970 (gnus-summary-show-thread)
5971 (gnus-summary-first-subject t)
5972 (gnus-summary-display-article (gnus-summary-article-number)))
5973 (gnus-summary-position-point)))
5975 (defun gnus-summary-first-unread-subject ()
5976 "Place the point on the subject line of the first unread article.
5977 Return nil if there are no unread articles."
5980 (when (gnus-summary-first-subject t)
5981 (gnus-summary-show-thread)
5982 (gnus-summary-first-subject t))
5983 (gnus-summary-position-point)))
5985 (defun gnus-summary-first-article ()
5986 "Select the first article.
5987 Return nil if there are no articles."
5990 (when (gnus-summary-first-subject)
5991 (gnus-summary-show-thread)
5992 (gnus-summary-first-subject)
5993 (gnus-summary-display-article (gnus-summary-article-number)))
5994 (gnus-summary-position-point)))
5996 (defun gnus-summary-best-unread-article ()
5997 "Select the unread article with the highest score."
5999 (let ((best -1000000)
6000 (data gnus-newsgroup-data)
6003 (and (gnus-data-unread-p (car data))
6005 (gnus-summary-article-score (gnus-data-number (car data))))
6008 article (gnus-data-number (car data))))
6009 (setq data (cdr data)))
6012 (gnus-summary-goto-article article)
6013 (error "No unread articles"))
6014 (gnus-summary-position-point))))
6016 (defun gnus-summary-last-subject ()
6017 "Go to the last displayed subject line in the group."
6018 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6020 (gnus-summary-goto-subject article))))
6022 (defun gnus-summary-goto-article (article &optional all-headers force)
6023 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6024 If ALL-HEADERS is non-nil, no header lines are hidden.
6025 If FORCE, go to the article even if it isn't displayed. If FORCE
6026 is a number, it is the line the article is to be displayed on."
6030 "Article number or Message-ID: "
6031 (mapcar (lambda (number) (list (int-to-string number)))
6032 gnus-newsgroup-limit))
6036 (if (and (stringp article)
6037 (string-match "@" article))
6038 (gnus-summary-refer-article article)
6039 (when (stringp article)
6040 (setq article (string-to-number article)))
6041 (if (gnus-summary-goto-subject article force)
6042 (gnus-summary-display-article article all-headers)
6043 (gnus-message 4 "Couldn't go to article %s" article) nil))
6044 (gnus-summary-position-point)))
6046 (defun gnus-summary-goto-last-article ()
6047 "Go to the previously read article."
6050 (when gnus-last-article
6051 (gnus-summary-goto-article gnus-last-article nil t))
6052 (gnus-summary-position-point)))
6054 (defun gnus-summary-pop-article (number)
6055 "Pop one article off the history and go to the previous.
6056 NUMBER articles will be popped off."
6059 (setq gnus-newsgroup-history
6060 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6062 (gnus-summary-goto-article (car to) nil t)
6063 (error "Article history empty")))
6064 (gnus-summary-position-point))
6066 ;; Summary commands and functions for limiting the summary buffer.
6068 (defun gnus-summary-limit-to-articles (n)
6069 "Limit the summary buffer to the next N articles.
6070 If not given a prefix, use the process marked articles instead."
6073 (let ((articles (gnus-summary-work-articles n)))
6074 (setq gnus-newsgroup-processable nil)
6075 (gnus-summary-limit articles))
6076 (gnus-summary-position-point)))
6078 (defun gnus-summary-pop-limit (&optional total)
6079 "Restore the previous limit.
6080 If given a prefix, remove all limits."
6083 (setq gnus-newsgroup-limits
6084 (list (mapcar (lambda (h) (mail-header-number h))
6085 gnus-newsgroup-headers))))
6086 (unless gnus-newsgroup-limits
6087 (error "No limit to pop"))
6089 (gnus-summary-limit nil 'pop)
6090 (gnus-summary-position-point)))
6092 (defun gnus-summary-limit-to-subject (subject &optional header)
6093 "Limit the summary buffer to articles that have subjects that match a regexp."
6094 (interactive "sLimit to subject (regexp): ")
6096 (setq header "subject"))
6097 (when (not (equal "" subject))
6099 (let ((articles (gnus-summary-find-matching
6100 (or header "subject") subject 'all)))
6102 (error "Found no matches for \"%s\"" subject))
6103 (gnus-summary-limit articles))
6104 (gnus-summary-position-point))))
6106 (defun gnus-summary-limit-to-author (from)
6107 "Limit the summary buffer to articles that have authors that match a regexp."
6108 (interactive "sLimit to author (regexp): ")
6109 (gnus-summary-limit-to-subject from "from"))
6111 (defun gnus-summary-limit-to-age (age &optional younger-p)
6112 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6113 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6114 articles that are younger than AGE days."
6115 (interactive "nTime in days: \nP")
6117 (let ((data gnus-newsgroup-data)
6118 (cutoff (days-to-time age))
6119 articles d date is-younger)
6120 (while (setq d (pop data))
6121 (when (and (vectorp (gnus-data-header d))
6122 (setq date (mail-header-date (gnus-data-header d))))
6123 (setq is-younger (time-less-p
6124 (time-since (date-to-time date))
6129 (push (gnus-data-number d) articles))))
6130 (gnus-summary-limit (nreverse articles)))
6131 (gnus-summary-position-point)))
6133 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6135 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6137 (defun gnus-summary-limit-to-unread (&optional all)
6138 "Limit the summary buffer to articles that are not marked as read.
6139 If ALL is non-nil, limit strictly to unread articles."
6142 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6143 (gnus-summary-limit-to-marks
6144 ;; Concat all the marks that say that an article is read and have
6146 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6147 gnus-killed-mark gnus-kill-file-mark
6148 gnus-low-score-mark gnus-expirable-mark
6149 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6150 gnus-duplicate-mark gnus-souped-mark)
6153 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6154 (make-obsolete 'gnus-summary-delete-marked-with
6155 'gnus-summary-limit-exlude-marks)
6157 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6158 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6159 If REVERSE, limit the summary buffer to articles that are marked
6160 with MARKS. MARKS can either be a string of marks or a list of marks.
6161 Returns how many articles were removed."
6162 (interactive "sMarks: ")
6163 (gnus-summary-limit-to-marks marks t))
6165 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6166 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6167 If REVERSE (the prefix), limit the summary buffer to articles that are
6168 not marked with MARKS. MARKS can either be a string of marks or a
6170 Returns how many articles were removed."
6171 (interactive "sMarks: \nP")
6173 (let ((data gnus-newsgroup-data)
6174 (marks (if (listp marks) marks
6175 (append marks nil))) ; Transform to list.
6178 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6179 (memq (gnus-data-mark (car data)) marks))
6180 (push (gnus-data-number (car data)) articles))
6181 (setq data (cdr data)))
6182 (gnus-summary-limit articles))
6183 (gnus-summary-position-point)))
6185 (defun gnus-summary-limit-to-score (&optional score)
6186 "Limit to articles with score at or above SCORE."
6188 (setq score (if score
6189 (prefix-numeric-value score)
6190 (or gnus-summary-default-score 0)))
6191 (let ((data gnus-newsgroup-data)
6194 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6196 (push (gnus-data-number (car data)) articles))
6197 (setq data (cdr data)))
6199 (gnus-summary-limit articles)
6200 (gnus-summary-position-point))))
6202 (defun gnus-summary-limit-include-thread (id)
6203 "Display all the hidden articles that in the current thread."
6204 (interactive (list (mail-header-id (gnus-summary-article-header))))
6205 (let ((articles (gnus-articles-in-thread
6206 (gnus-id-to-thread (gnus-root-id id)))))
6208 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6209 (gnus-summary-position-point))))
6211 (defun gnus-summary-limit-include-dormant ()
6212 "Display all the hidden articles that are marked as dormant.
6213 Note that this command only works on a subset of the articles currently
6214 fetched for this group."
6216 (unless gnus-newsgroup-dormant
6217 (error "There are no dormant articles in this group"))
6219 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6220 (gnus-summary-position-point)))
6222 (defun gnus-summary-limit-exclude-dormant ()
6223 "Hide all dormant articles."
6226 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6227 (gnus-summary-position-point)))
6229 (defun gnus-summary-limit-exclude-childless-dormant ()
6230 "Hide all dormant articles that have no children."
6232 (let ((data (gnus-data-list t))
6233 articles d children)
6234 ;; Find all articles that are either not dormant or have
6236 (while (setq d (pop data))
6237 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6239 (gnus-article-children (gnus-data-number d)))
6242 (when (memq (car children) articles)
6247 (push (gnus-data-number d) articles)))
6250 (gnus-summary-limit articles)
6251 (gnus-summary-position-point))))
6253 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6254 "Mark all unread excluded articles as read.
6255 If ALL, mark even excluded ticked and dormants as read."
6257 (let ((articles (gnus-sorted-complement
6259 (mapcar (lambda (h) (mail-header-number h))
6260 gnus-newsgroup-headers)
6262 (sort gnus-newsgroup-limit '<)))
6264 (setq gnus-newsgroup-unreads
6265 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6267 (setq gnus-newsgroup-dormant nil
6268 gnus-newsgroup-marked nil
6269 gnus-newsgroup-reads
6271 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6272 gnus-newsgroup-reads))
6273 (while (setq article (pop articles))
6274 (unless (or (memq article gnus-newsgroup-dormant)
6275 (memq article gnus-newsgroup-marked))
6276 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6278 (defun gnus-summary-limit (articles &optional pop)
6280 ;; We pop the previous limit off the stack and use that.
6281 (setq articles (car gnus-newsgroup-limits)
6282 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6283 ;; We use the new limit, so we push the old limit on the stack.
6284 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6286 (setq gnus-newsgroup-limit articles)
6287 (let ((total (length gnus-newsgroup-data))
6288 (data (gnus-data-find-list (gnus-summary-article-number)))
6289 (gnus-summary-mark-below nil) ; Inhibit this.
6291 ;; This will do all the work of generating the new summary buffer
6292 ;; according to the new limit.
6293 (gnus-summary-prepare)
6294 ;; Hide any threads, possibly.
6295 (and gnus-show-threads
6296 gnus-thread-hide-subtree
6297 (gnus-summary-hide-all-threads))
6298 ;; Try to return to the article you were at, or one in the
6301 ;; We try to find some article after the current one.
6303 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6306 (setq data (cdr data))))
6308 ;; If there is no data, that means that we were after the last
6309 ;; article. The same goes when we can't find any articles
6310 ;; after the current one.
6311 (goto-char (point-max))
6312 (gnus-summary-find-prev))
6313 (gnus-set-mode-line 'summary)
6314 ;; We return how many articles were removed from the summary
6315 ;; buffer as a result of the new limit.
6316 (- total (length gnus-newsgroup-data))))
6318 (defsubst gnus-invisible-cut-children (threads)
6321 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6326 (defsubst gnus-cut-thread (thread)
6327 "Go forwards in the thread until we find an article that we want to display."
6328 (when (or (eq gnus-fetch-old-headers 'some)
6329 (eq gnus-fetch-old-headers 'invisible)
6330 (eq gnus-build-sparse-threads 'some)
6331 (eq gnus-build-sparse-threads 'more))
6332 ;; Deal with old-fetched headers and sparse threads.
6336 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6337 (gnus-summary-article-ancient-p
6338 (mail-header-number (car thread))))
6339 (if (or (<= (length (cdr thread)) 1)
6340 (eq gnus-fetch-old-headers 'invisible))
6341 (setq gnus-newsgroup-limit
6342 (delq (mail-header-number (car thread))
6343 gnus-newsgroup-limit)
6344 thread (cadr thread))
6345 (when (gnus-invisible-cut-children (cdr thread))
6346 (let ((th (cdr thread)))
6348 (if (memq (mail-header-number (caar th))
6349 gnus-newsgroup-limit)
6350 (setq thread (car th)
6352 (setq th (cdr th))))))))))
6355 (defun gnus-cut-threads (threads)
6356 "Cut off all uninteresting articles from the beginning of threads."
6357 (when (or (eq gnus-fetch-old-headers 'some)
6358 (eq gnus-fetch-old-headers 'invisible)
6359 (eq gnus-build-sparse-threads 'some)
6360 (eq gnus-build-sparse-threads 'more))
6363 (setcar th (gnus-cut-thread (car th)))
6364 (setq th (cdr th)))))
6365 ;; Remove nixed out threads.
6368 (defun gnus-summary-initial-limit (&optional show-if-empty)
6369 "Figure out what the initial limit is supposed to be on group entry.
6370 This entails weeding out unwanted dormants, low-scored articles,
6371 fetch-old-headers verbiage, and so on."
6372 ;; Most groups have nothing to remove.
6373 (if (or gnus-inhibit-limiting
6374 (and (null gnus-newsgroup-dormant)
6375 (not (eq gnus-fetch-old-headers 'some))
6376 (not (eq gnus-fetch-old-headers 'invisible))
6377 (null gnus-summary-expunge-below)
6378 (not (eq gnus-build-sparse-threads 'some))
6379 (not (eq gnus-build-sparse-threads 'more))
6380 (null gnus-thread-expunge-below)
6381 (not gnus-use-nocem)))
6383 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6384 (setq gnus-newsgroup-limit nil)
6387 (unless (car (symbol-value node))
6388 ;; These threads have no parents -- they are roots.
6389 (let ((nodes (cdr (symbol-value node)))
6392 (if (and gnus-thread-expunge-below
6393 (< (gnus-thread-total-score (car nodes))
6394 gnus-thread-expunge-below))
6395 (gnus-expunge-thread (pop nodes))
6396 (setq thread (pop nodes))
6397 (gnus-summary-limit-children thread))))))
6398 gnus-newsgroup-dependencies)
6399 ;; If this limitation resulted in an empty group, we might
6400 ;; pop the previous limit and use it instead.
6401 (when (and (not gnus-newsgroup-limit)
6403 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6404 gnus-newsgroup-limit))
6406 (defun gnus-summary-limit-children (thread)
6407 "Return 1 if this subthread is visible and 0 if it is not."
6408 ;; First we get the number of visible children to this thread. This
6409 ;; is done by recursing down the thread using this function, so this
6410 ;; will really go down to a leaf article first, before slowly
6411 ;; working its way up towards the root.
6415 (apply '+ (mapcar 'gnus-summary-limit-children
6418 (number (mail-header-number (car thread)))
6421 (not (memq number gnus-newsgroup-marked))
6423 ;; If this article is dormant and has absolutely no visible
6424 ;; children, then this article isn't visible.
6425 (and (memq number gnus-newsgroup-dormant)
6427 ;; If this is "fetch-old-headered" and there is no
6428 ;; visible children, then we don't want this article.
6429 (and (eq gnus-fetch-old-headers 'some)
6430 (gnus-summary-article-ancient-p number)
6432 ;; If this is "fetch-old-headered" and `invisible', then
6433 ;; we don't want this article.
6434 (and (eq gnus-fetch-old-headers 'invisible)
6435 (gnus-summary-article-ancient-p number))
6436 ;; If this is a sparsely inserted article with no children,
6437 ;; we don't want it.
6438 (and (eq gnus-build-sparse-threads 'some)
6439 (gnus-summary-article-sparse-p number)
6441 ;; If we use expunging, and this article is really
6442 ;; low-scored, then we don't want this article.
6443 (when (and gnus-summary-expunge-below
6445 (or (cdr (assq number gnus-newsgroup-scored))
6446 gnus-summary-default-score))
6447 gnus-summary-expunge-below))
6448 ;; We increase the expunge-tally here, but that has
6449 ;; nothing to do with the limits, really.
6450 (incf gnus-newsgroup-expunged-tally)
6451 ;; We also mark as read here, if that's wanted.
6452 (when (and gnus-summary-mark-below
6453 (< score gnus-summary-mark-below))
6454 (setq gnus-newsgroup-unreads
6455 (delq number gnus-newsgroup-unreads))
6456 (if gnus-newsgroup-auto-expire
6457 (push number gnus-newsgroup-expirable)
6458 (push (cons number gnus-low-score-mark)
6459 gnus-newsgroup-reads)))
6461 ;; Check NoCeM things.
6462 (if (and gnus-use-nocem
6463 (gnus-nocem-unwanted-article-p
6464 (mail-header-id (car thread))))
6466 (setq gnus-newsgroup-unreads
6467 (delq number gnus-newsgroup-unreads))
6469 ;; Nope, invisible article.
6471 ;; Ok, this article is to be visible, so we add it to the limit
6473 (push number gnus-newsgroup-limit)
6476 (defun gnus-expunge-thread (thread)
6477 "Mark all articles in THREAD as read."
6478 (let* ((number (mail-header-number (car thread))))
6479 (incf gnus-newsgroup-expunged-tally)
6480 ;; We also mark as read here, if that's wanted.
6481 (setq gnus-newsgroup-unreads
6482 (delq number gnus-newsgroup-unreads))
6483 (if gnus-newsgroup-auto-expire
6484 (push number gnus-newsgroup-expirable)
6485 (push (cons number gnus-low-score-mark)
6486 gnus-newsgroup-reads)))
6487 ;; Go recursively through all subthreads.
6488 (mapcar 'gnus-expunge-thread (cdr thread)))
6490 ;; Summary article oriented commands
6492 (defun gnus-summary-refer-parent-article (n)
6493 "Refer parent article N times.
6494 If N is negative, go to ancestor -N instead.
6495 The difference between N and the number of articles fetched is returned."
6499 (when (not (natnump n))
6504 (setq header (gnus-summary-article-header))
6505 (if (and (eq (mail-header-number header)
6506 (cdr gnus-article-current))
6507 (equal gnus-newsgroup-name
6508 (car gnus-article-current)))
6509 ;; If we try to find the parent of the currently
6510 ;; displayed article, then we take a look at the actual
6511 ;; References header, since this is slightly more
6512 ;; reliable than the References field we got from the
6515 (set-buffer gnus-original-article-buffer)
6516 (nnheader-narrow-to-headers)
6517 (unless (setq ref (message-fetch-field "references"))
6518 (setq ref (message-fetch-field "in-reply-to")))
6521 ;; It's not the current article, so we take a bet on
6522 ;; the value we got from the server.
6523 (mail-header-references header)))
6525 (not (equal ref "")))
6526 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6527 (gnus-message 1 "Couldn't find parent"))
6528 (gnus-message 1 "No references in article %d"
6529 (gnus-summary-article-number))
6532 (gnus-summary-position-point)
6535 (defun gnus-summary-refer-references ()
6536 "Fetch all articles mentioned in the References header.
6537 Return the number of articles fetched."
6539 (let ((ref (mail-header-references (gnus-summary-article-header)))
6540 (current (gnus-summary-article-number))
6544 (error "No References in the current article")
6545 ;; For each Message-ID in the References header...
6546 (while (string-match "<[^>]*>" ref)
6548 ;; ... fetch that article.
6549 (gnus-summary-refer-article
6550 (prog1 (match-string 0 ref)
6551 (setq ref (substring ref (match-end 0))))))
6552 (gnus-summary-goto-subject current)
6553 (gnus-summary-position-point)
6556 (defun gnus-summary-refer-thread (&optional limit)
6557 "Fetch all articles in the current thread.
6558 If LIMIT (the numerical prefix), fetch that many old headers instead
6559 of what's specified by the `gnus-refer-thread-limit' variable."
6561 (let ((id (mail-header-id (gnus-summary-article-header)))
6562 (limit (if limit (prefix-numeric-value limit)
6563 gnus-refer-thread-limit)))
6564 ;; We want to fetch LIMIT *old* headers, but we also have to
6565 ;; re-fetch all the headers in the current buffer, because many of
6566 ;; them may be undisplayed. So we adjust LIMIT.
6567 (when (numberp limit)
6568 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6569 (unless (eq gnus-fetch-old-headers 'invisible)
6570 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6571 ;; Retrieve the headers and read them in.
6572 (if (eq (gnus-retrieve-headers
6573 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6575 (gnus-build-all-threads)
6576 (error "Can't fetch thread from backends that don't support NOV"))
6577 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6578 (gnus-summary-limit-include-thread id)))
6580 (defun gnus-summary-refer-article (message-id &optional arg)
6581 "Fetch an article specified by MESSAGE-ID.
6582 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6583 or `gnus-select-method', no matter what backend the article comes from."
6584 (interactive "sMessage-ID: \nP")
6585 (when (and (stringp message-id)
6586 (not (zerop (length message-id))))
6587 ;; Construct the correct Message-ID if necessary.
6588 ;; Suggested by tale@pawl.rpi.edu.
6589 (unless (string-match "^<" message-id)
6590 (setq message-id (concat "<" message-id)))
6591 (unless (string-match ">$" message-id)
6592 (setq message-id (concat message-id ">")))
6593 (let* ((header (gnus-id-to-header message-id))
6595 (gnus-summary-article-sparse-p
6596 (mail-header-number header))
6597 (memq (mail-header-number header)
6598 gnus-newsgroup-limit))))
6600 ;; If the article is present in the buffer we just go to it.
6602 (or (not (gnus-summary-article-sparse-p
6603 (mail-header-number header)))
6606 (gnus-summary-goto-article
6607 (mail-header-number header) nil t)
6609 (gnus-summary-update-article (mail-header-number header)))))
6611 ;; We fetch the article
6612 (let ((gnus-override-method
6613 (cond ((gnus-news-group-p gnus-newsgroup-name)
6614 gnus-refer-article-method)
6616 (or gnus-refer-article-method gnus-select-method))
6619 ;; Start the special refer-article method, if necessary.
6620 (when (and gnus-refer-article-method
6621 (gnus-news-group-p gnus-newsgroup-name))
6622 (gnus-check-server gnus-refer-article-method))
6623 ;; Fetch the header, and display the article.
6624 (if (setq number (gnus-summary-insert-subject message-id))
6625 (gnus-summary-select-article nil nil nil number)
6626 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6628 (defun gnus-summary-edit-parameters ()
6629 "Edit the group parameters of the current group."
6631 (gnus-group-edit-group gnus-newsgroup-name 'params))
6633 (defun gnus-summary-customize-parameters ()
6634 "Customize the group parameters of the current group."
6636 (gnus-group-customize gnus-newsgroup-name))
6638 (defun gnus-summary-enter-digest-group (&optional force)
6639 "Enter an nndoc group based on the current article.
6640 If FORCE, force a digest interpretation. If not, try
6641 to guess what the document format is."
6643 (let ((conf gnus-current-window-configuration))
6645 (gnus-summary-select-article))
6646 (setq gnus-current-window-configuration conf)
6647 (let* ((name (format "%s-%d"
6648 (gnus-group-prefixed-name
6649 gnus-newsgroup-name (list 'nndoc ""))
6651 (set-buffer gnus-summary-buffer)
6652 gnus-current-article)))
6653 (ogroup gnus-newsgroup-name)
6654 (params (append (gnus-info-params (gnus-get-info ogroup))
6655 (list (cons 'to-group ogroup))
6656 (list (cons 'save-article-group ogroup))))
6657 (case-fold-search t)
6658 (buf (current-buffer))
6661 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6662 (insert-buffer-substring gnus-original-article-buffer)
6663 ;; Remove lines that may lead nndoc to misinterpret the
6666 (goto-char (point-min))
6667 (or (search-forward "\n\n" nil t) (point)))
6668 (goto-char (point-min))
6669 (delete-matching-lines "^\\(Path\\):\\|^From ")
6672 (if (gnus-group-read-ephemeral-group
6673 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6675 ,(if force 'digest 'guess))) t)
6676 ;; Make all postings to this group go to the parent group.
6677 (nconc (gnus-info-params (gnus-get-info name))
6679 ;; Couldn't select this doc group.
6680 (switch-to-buffer buf)
6681 (gnus-set-global-variables)
6682 (gnus-configure-windows 'summary)
6683 (gnus-message 3 "Article couldn't be entered?"))
6684 (kill-buffer dig)))))
6686 (defun gnus-summary-read-document (n)
6687 "Open a new group based on the current article(s).
6688 This will allow you to read digests and other similar
6689 documents as newsgroups.
6690 Obeys the standard process/prefix convention."
6692 (let* ((articles (gnus-summary-work-articles n))
6693 (ogroup gnus-newsgroup-name)
6694 (params (append (gnus-info-params (gnus-get-info ogroup))
6695 (list (cons 'to-group ogroup))))
6696 article group egroup groups vgroup)
6697 (while (setq article (pop articles))
6698 (setq group (format "%s-%d" gnus-newsgroup-name article))
6699 (gnus-summary-remove-process-mark article)
6700 (when (gnus-summary-display-article article)
6703 (insert-buffer-substring gnus-original-article-buffer)
6704 ;; Remove some headers that may lead nndoc to make
6706 (message-narrow-to-head)
6707 (goto-char (point-min))
6708 (delete-matching-lines "^\\(Path\\):\\|^From ")
6711 (gnus-group-read-ephemeral-group
6712 group `(nndoc ,group (nndoc-address ,(current-buffer))
6713 (nndoc-article-type guess))
6716 ;; Make all postings to this group go to the parent group.
6717 (nconc (gnus-info-params (gnus-get-info egroup))
6719 (push egroup groups))
6720 ;; Couldn't select this doc group.
6721 (gnus-error 3 "Article couldn't be entered"))))))
6722 ;; Now we have selected all the documents.
6725 (error "None of the articles could be interpreted as documents"))
6726 ((gnus-group-read-ephemeral-group
6727 (setq vgroup (format
6728 "nnvirtual:%s-%s" gnus-newsgroup-name
6729 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6730 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6732 (cons (current-buffer) 'summary)))
6734 (error "Couldn't select virtual nndoc group")))))
6736 (defun gnus-summary-isearch-article (&optional regexp-p)
6737 "Do incremental search forward on the current article.
6738 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6740 (gnus-summary-select-article)
6741 (gnus-configure-windows 'article)
6742 (gnus-eval-in-buffer-window gnus-article-buffer
6745 (isearch-forward regexp-p))))
6747 (defun gnus-summary-search-article-forward (regexp &optional backward)
6748 "Search for an article containing REGEXP forward.
6749 If BACKWARD, search backward instead."
6752 (format "Search article %s (regexp%s): "
6753 (if current-prefix-arg "backward" "forward")
6754 (if gnus-last-search-regexp
6755 (concat ", default " gnus-last-search-regexp)
6757 current-prefix-arg))
6758 (if (string-equal regexp "")
6759 (setq regexp (or gnus-last-search-regexp ""))
6760 (setq gnus-last-search-regexp regexp))
6761 (if (gnus-summary-search-article regexp backward)
6762 (gnus-summary-show-thread)
6763 (error "Search failed: \"%s\"" regexp)))
6765 (defun gnus-summary-search-article-backward (regexp)
6766 "Search for an article containing REGEXP backward."
6769 (format "Search article backward (regexp%s): "
6770 (if gnus-last-search-regexp
6771 (concat ", default " gnus-last-search-regexp)
6773 (gnus-summary-search-article-forward regexp 'backward))
6775 (defun gnus-summary-search-article (regexp &optional backward)
6776 "Search for an article containing REGEXP.
6777 Optional argument BACKWARD means do search for backward.
6778 `gnus-select-article-hook' is not called during the search."
6779 ;; We have to require this here to make sure that the following
6780 ;; dynamic binding isn't shadowed by autoloading.
6781 (require 'gnus-async)
6783 (let ((gnus-select-article-hook nil) ;Disable hook.
6784 (gnus-article-display-hook nil)
6785 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6786 (gnus-use-article-prefetch nil)
6787 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6788 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6789 (sum (current-buffer))
6792 (gnus-save-hidden-threads
6793 (gnus-summary-select-article)
6794 (set-buffer gnus-article-buffer)
6798 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6800 (re-search-backward regexp nil t)
6801 (re-search-forward regexp nil t))
6802 ;; We found the regexp.
6807 (get-buffer-window (current-buffer))
6811 (setq point (point)))
6812 ;; We didn't find it, so we go to the next article.
6815 (while (eq found 'not)
6816 (if (not (if backward (gnus-summary-find-prev)
6817 (gnus-summary-find-next)))
6818 ;; No more articles.
6820 ;; Select the next article and adjust point.
6821 (unless (gnus-summary-article-sparse-p
6822 (gnus-summary-article-number))
6824 (gnus-summary-select-article)
6825 (set-buffer gnus-article-buffer)
6827 (goto-char (if backward (point-max) (point-min))))))))
6828 (gnus-message 7 ""))
6829 ;; Return whether we found the regexp.
6830 (when (eq found 'found)
6832 (gnus-summary-show-thread)
6833 (gnus-summary-goto-subject gnus-current-article)
6834 (gnus-summary-position-point)
6837 (defun gnus-summary-find-matching (header regexp &optional backward unread
6839 "Return a list of all articles that match REGEXP on HEADER.
6840 The search stars on the current article and goes forwards unless
6841 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6842 If UNREAD is non-nil, only unread articles will
6843 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6844 in the comparisons."
6845 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6846 (gnus-data-find-list
6847 (gnus-summary-article-number) (gnus-data-list backward))))
6848 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6849 (case-fold-search (not not-case-fold))
6851 (unless (fboundp (intern (concat "mail-header-" header)))
6852 (error "%s is not a valid header" header))
6855 (and (or (not unread) ; We want all articles...
6856 (gnus-data-unread-p d)) ; Or just unreads.
6857 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6858 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6859 (push (gnus-data-number d) articles)) ; Success!
6860 (setq data (cdr data)))
6861 (nreverse articles)))
6863 (defun gnus-summary-execute-command (header regexp command &optional backward)
6864 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6865 If HEADER is an empty string (or nil), the match is done on the entire
6866 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6868 (list (let ((completion-ignore-case t))
6871 (mapcar (lambda (string) (list string))
6872 '("Number" "Subject" "From" "Lines" "Date"
6873 "Message-ID" "Xref" "References" "Body"))
6874 nil 'require-match))
6875 (read-string "Regexp: ")
6876 (read-key-sequence "Command: ")
6877 current-prefix-arg))
6878 (when (equal header "Body")
6880 ;; Hidden thread subtrees must be searched as well.
6881 (gnus-summary-show-all-threads)
6882 ;; We don't want to change current point nor window configuration.
6884 (save-window-excursion
6885 (gnus-message 6 "Executing %s..." (key-description command))
6886 ;; We'd like to execute COMMAND interactively so as to give arguments.
6887 (gnus-execute header regexp
6888 `(call-interactively ',(key-binding command))
6890 (gnus-message 6 "Executing %s...done" (key-description command)))))
6892 (defun gnus-summary-beginning-of-article ()
6893 "Scroll the article back to the beginning."
6895 (gnus-summary-select-article)
6896 (gnus-configure-windows 'article)
6897 (gnus-eval-in-buffer-window gnus-article-buffer
6899 (goto-char (point-min))
6900 (when gnus-page-broken
6901 (gnus-narrow-to-page))))
6903 (defun gnus-summary-end-of-article ()
6904 "Scroll to the end of the article."
6906 (gnus-summary-select-article)
6907 (gnus-configure-windows 'article)
6908 (gnus-eval-in-buffer-window gnus-article-buffer
6910 (goto-char (point-max))
6912 (when gnus-page-broken
6913 (gnus-narrow-to-page))))
6915 (defun gnus-summary-print-article (&optional filename n)
6916 "Generate and print a PostScript image of the N next (mail) articles.
6918 If N is negative, print the N previous articles. If N is nil and articles
6919 have been marked with the process mark, print these instead.
6921 If the optional first argument FILENAME is nil, send the image to the
6922 printer. If FILENAME is a string, save the PostScript image in a file with
6923 that name. If FILENAME is a number, prompt the user for the name of the file
6925 (interactive (list (ps-print-preprint current-prefix-arg)
6926 current-prefix-arg))
6927 (dolist (article (gnus-summary-work-articles n))
6928 (gnus-summary-select-article nil nil 'pseudo article)
6929 (gnus-eval-in-buffer-window gnus-article-buffer
6930 (let ((buffer (generate-new-buffer " *print*")))
6933 (copy-to-buffer buffer (point-min) (point-max))
6935 (gnus-article-delete-invisible-text)
6936 (let ((ps-left-header
6939 (mail-header-subject gnus-current-headers) ")")
6941 (mail-header-from gnus-current-headers) ")")))
6944 "/pagenumberstring load"
6946 (mail-header-date gnus-current-headers) ")"))))
6947 (gnus-run-hooks 'gnus-ps-print-hook)
6949 (ps-print-buffer-with-faces filename))))
6950 (kill-buffer buffer))))))
6952 (defun gnus-summary-show-article (&optional arg)
6953 "Force re-fetching of the current article.
6954 If ARG (the prefix) is non-nil, show the raw article without any
6955 article massaging functions being run."
6958 ;; Select the article the normal way.
6959 (gnus-summary-select-article nil 'force)
6960 ;; We have to require this here to make sure that the following
6961 ;; dynamic binding isn't shadowed by autoloading.
6962 (require 'gnus-async)
6964 ;; Bind the article treatment functions to nil.
6965 (let ((gnus-have-all-headers t)
6966 gnus-article-display-hook
6967 gnus-article-prepare-hook
6968 gnus-article-decode-hook
6972 (gnus-summary-select-article nil 'force)))
6973 (gnus-summary-goto-subject gnus-current-article)
6974 (gnus-summary-position-point))
6976 (defun gnus-summary-verbose-headers (&optional arg)
6977 "Toggle permanent full header display.
6978 If ARG is a positive number, turn header display on.
6979 If ARG is a negative number, turn header display off."
6981 (setq gnus-show-all-headers
6982 (cond ((or (not (numberp arg))
6984 (not gnus-show-all-headers))
6987 (gnus-summary-show-article))
6989 (defun gnus-summary-toggle-header (&optional arg)
6990 "Show the headers if they are hidden, or hide them if they are shown.
6991 If ARG is a positive number, show the entire header.
6992 If ARG is a negative number, hide the unwanted header lines."
6995 (set-buffer gnus-article-buffer)
6997 (let* ((buffer-read-only nil)
6998 (inhibit-point-motion-hooks t)
6999 (hidden (gnus-article-hidden-text-p 'headers))
7001 (goto-char (point-min))
7002 (when (search-forward "\n\n" nil t)
7003 (delete-region (point-min) (1- (point))))
7004 (goto-char (point-min))
7006 (set-buffer gnus-original-article-buffer)
7007 (goto-char (point-min))
7008 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7009 (insert-buffer-substring gnus-original-article-buffer 1 e)
7011 (narrow-to-region (point-min) (point))
7013 (and (numberp arg) (< arg 0)))
7014 (let ((gnus-treat-hide-headers nil)
7015 (gnus-treat-hide-boring-headers nil))
7016 (gnus-treat-article 'head))
7017 (gnus-treat-article 'head)))))))
7019 (defun gnus-summary-show-all-headers ()
7020 "Make all header lines visible."
7022 (gnus-article-show-all-headers))
7024 (defun gnus-summary-toggle-mime (&optional arg)
7025 "Toggle MIME processing.
7026 If ARG is a positive number, turn MIME processing on."
7028 (setq gnus-show-mime
7030 (not gnus-show-mime)
7031 (> (prefix-numeric-value arg) 0)))
7032 (gnus-summary-select-article t 'force))
7034 (defun gnus-summary-caesar-message (&optional arg)
7035 "Caesar rotate the current article by 13.
7036 The numerical prefix specifies how many places to rotate each letter
7039 (gnus-summary-select-article)
7040 (let ((mail-header-separator ""))
7041 (gnus-eval-in-buffer-window gnus-article-buffer
7044 (let ((start (window-start))
7046 (message-caesar-buffer-body arg)
7047 (set-window-start (get-buffer-window (current-buffer)) start))))))
7049 (defun gnus-summary-stop-page-breaking ()
7050 "Stop page breaking in the current article."
7052 (gnus-summary-select-article)
7053 (gnus-eval-in-buffer-window gnus-article-buffer
7055 (when (gnus-visual-p 'page-marker)
7056 (let ((buffer-read-only nil))
7057 (gnus-remove-text-with-property 'gnus-prev)
7058 (gnus-remove-text-with-property 'gnus-next))
7059 (setq gnus-page-broken nil))))
7061 (defun gnus-summary-move-article (&optional n to-newsgroup
7062 select-method action)
7063 "Move the current article to a different newsgroup.
7064 If N is a positive number, move the N next articles.
7065 If N is a negative number, move the N previous articles.
7066 If N is nil and any articles have been marked with the process mark,
7067 move those articles instead.
7068 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7069 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7070 re-spool using this method.
7072 For this function to work, both the current newsgroup and the
7073 newsgroup that you want to move to have to support the `request-move'
7074 and `request-accept' functions."
7077 (setq action 'move))
7078 ;; Disable marking as read.
7079 (let (gnus-mark-article-hook)
7080 (save-window-excursion
7081 (gnus-summary-select-article)))
7082 ;; Check whether the source group supports the required functions.
7083 (cond ((and (eq action 'move)
7084 (not (gnus-check-backend-function
7085 'request-move-article gnus-newsgroup-name)))
7086 (error "The current group does not support article moving"))
7087 ((and (eq action 'crosspost)
7088 (not (gnus-check-backend-function
7089 'request-replace-article gnus-newsgroup-name)))
7090 (error "The current group does not support article editing")))
7091 (let ((articles (gnus-summary-work-articles n))
7092 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7093 (names '((move "Move" "Moving")
7094 (copy "Copy" "Copying")
7095 (crosspost "Crosspost" "Crossposting")))
7096 (copy-buf (save-excursion
7097 (nnheader-set-temp-buffer " *copy article*")))
7098 art-group to-method new-xref article to-groups)
7099 (unless (assq action names)
7100 (error "Unknown action %s" action))
7101 ;; Read the newsgroup name.
7102 (when (and (not to-newsgroup)
7103 (not select-method))
7105 (gnus-read-move-group-name
7106 (cadr (assq action names))
7107 (symbol-value (intern (format "gnus-current-%s-group" action)))
7109 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7110 (setq to-method (or select-method
7111 (gnus-group-name-to-method to-newsgroup)))
7112 ;; Check the method we are to move this article to...
7113 (unless (gnus-check-backend-function
7114 'request-accept-article (car to-method))
7115 (error "%s does not support article copying" (car to-method)))
7116 (unless (gnus-check-server to-method)
7117 (error "Can't open server %s" (car to-method)))
7118 (gnus-message 6 "%s to %s: %s..."
7119 (caddr (assq action names))
7120 (or (car select-method) to-newsgroup) articles)
7122 (setq article (pop articles))
7126 ;; Move the article.
7128 ;; Remove this article from future suppression.
7129 (gnus-dup-unsuppress-article article)
7130 (gnus-request-move-article
7131 article ; Article to move
7132 gnus-newsgroup-name ; From newsgroup
7133 (nth 1 (gnus-find-method-for-group
7134 gnus-newsgroup-name)) ; Server
7135 (list 'gnus-request-accept-article
7136 to-newsgroup (list 'quote select-method)
7137 (not articles) t) ; Accept form
7138 (not articles))) ; Only save nov last time
7139 ;; Copy the article.
7142 (set-buffer copy-buf)
7143 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7144 (gnus-request-accept-article
7145 to-newsgroup select-method (not articles) t))))
7146 ;; Crosspost the article.
7147 ((eq action 'crosspost)
7148 (let ((xref (message-tokenize-header
7149 (mail-header-xref (gnus-summary-article-header article))
7151 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7154 (setq xref (list (system-name))))
7157 (mapconcat 'identity
7158 (delete "Xref:" (delete new-xref xref))
7162 (set-buffer copy-buf)
7163 ;; First put the article in the destination group.
7164 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7165 (when (consp (setq art-group
7166 (gnus-request-accept-article
7167 to-newsgroup select-method (not articles))))
7168 (setq new-xref (concat new-xref " " (car art-group)
7169 ":" (cdr art-group)))
7170 ;; Now we have the new Xrefs header, so we insert
7171 ;; it and replace the new article.
7172 (nnheader-replace-header "Xref" new-xref)
7173 (gnus-request-replace-article
7174 (cdr art-group) to-newsgroup (current-buffer))
7178 (gnus-message 1 "Couldn't %s article %s"
7179 (cadr (assq action names)) article))
7180 ((and (eq art-group 'junk)
7182 (gnus-summary-mark-article article gnus-canceled-mark)
7183 (gnus-message 4 "Deleted article %s" article))
7185 (let* ((pto-group (gnus-group-prefixed-name
7186 (car art-group) to-method))
7188 (gnus-gethash pto-group gnus-newsrc-hashtb))
7189 (info (nth 2 entry))
7190 (to-group (gnus-info-group info)))
7191 ;; Update the group that has been moved to.
7193 (memq action '(move copy)))
7194 (unless (member to-group to-groups)
7195 (push to-group to-groups))
7197 (unless (memq article gnus-newsgroup-unreads)
7199 info (gnus-add-to-range (gnus-info-read info)
7200 (list (cdr art-group)))))
7202 ;; Copy any marks over to the new group.
7203 (let ((marks gnus-article-mark-lists)
7204 (to-article (cdr art-group)))
7205 (unless (gnus-group-auto-expirable-p to-group)
7206 (setq marks (delete '(expirable . expire) marks)))
7208 ;; See whether the article is to be put in the cache.
7209 (when gnus-use-cache
7210 (gnus-cache-possibly-enter-article
7212 (let ((header (copy-sequence
7213 (gnus-summary-article-header article))))
7214 (mail-header-set-number header to-article)
7216 (memq article gnus-newsgroup-marked)
7217 (memq article gnus-newsgroup-dormant)
7218 (memq article gnus-newsgroup-unreads)))
7220 (when (and (equal to-group gnus-newsgroup-name)
7221 (not (memq article gnus-newsgroup-unreads)))
7222 ;; Mark this article as read in this group.
7223 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7224 (setcdr (gnus-active to-group) to-article)
7225 (setcdr gnus-newsgroup-active to-article))
7228 (when (memq article (symbol-value
7229 (intern (format "gnus-newsgroup-%s"
7231 ;; If the other group is the same as this group,
7232 ;; then we have to add the mark to the list.
7233 (when (equal to-group gnus-newsgroup-name)
7234 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7237 (intern (format "gnus-newsgroup-%s"
7239 ;; Copy the marks to other group.
7240 (gnus-add-marked-articles
7241 to-group (cdar marks) (list to-article) info))
7242 (setq marks (cdr marks)))
7245 (concat "(gnus-group-set-info '"
7246 (gnus-prin1-to-string (gnus-get-info to-group))
7249 ;; Update the Xref header in this article to point to
7250 ;; the new crossposted article we have just created.
7251 (when (eq action 'crosspost)
7253 (set-buffer copy-buf)
7254 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7255 (nnheader-replace-header "Xref" new-xref)
7256 (gnus-request-replace-article
7257 article gnus-newsgroup-name (current-buffer)))))
7259 ;;;!!!Why is this necessary?
7260 (set-buffer gnus-summary-buffer)
7262 (gnus-summary-goto-subject article)
7263 (when (eq action 'move)
7264 (gnus-summary-mark-article article gnus-canceled-mark))))
7265 (gnus-summary-remove-process-mark article))
7266 ;; Re-activate all groups that have been moved to.
7269 (set-buffer gnus-group-buffer)
7270 (when (gnus-group-goto-group (car to-groups) t)
7271 (gnus-group-get-new-news-this-group 1 t))
7274 (gnus-kill-buffer copy-buf)
7275 (gnus-summary-position-point)
7276 (gnus-set-mode-line 'summary)))
7278 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7279 "Move the current article to a different newsgroup.
7280 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7281 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7282 re-spool using this method."
7284 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7286 (defun gnus-summary-crosspost-article (&optional n)
7287 "Crosspost the current article to some other group."
7289 (gnus-summary-move-article n nil nil 'crosspost))
7291 (defcustom gnus-summary-respool-default-method nil
7292 "Default method for respooling an article.
7293 If nil, use to the current newsgroup method."
7294 :type '(choice (gnus-select-method :value (nnml ""))
7296 :group 'gnus-summary-mail)
7298 (defun gnus-summary-respool-article (&optional n method)
7299 "Respool the current article.
7300 The article will be squeezed through the mail spooling process again,
7301 which means that it will be put in some mail newsgroup or other
7302 depending on `nnmail-split-methods'.
7303 If N is a positive number, respool the N next articles.
7304 If N is a negative number, respool the N previous articles.
7305 If N is nil and any articles have been marked with the process mark,
7306 respool those articles instead.
7308 Respooling can be done both from mail groups and \"real\" newsgroups.
7309 In the former case, the articles in question will be moved from the
7310 current group into whatever groups they are destined to. In the
7311 latter case, they will be copied into the relevant groups."
7313 (list current-prefix-arg
7314 (let* ((methods (gnus-methods-using 'respool))
7316 (symbol-name (or gnus-summary-respool-default-method
7317 (car (gnus-find-method-for-group
7318 gnus-newsgroup-name)))))
7320 (gnus-completing-read
7321 methname "What backend do you want to use when respooling?"
7322 methods nil t nil 'gnus-mail-method-history))
7325 ((zerop (length (setq ms (gnus-servers-using-backend
7327 (list (intern method) ""))
7331 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7332 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7335 (error "No method given for respooling"))
7336 (if (assoc (symbol-name
7337 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7338 (gnus-methods-using 'respool))
7339 (gnus-summary-move-article n nil method)
7340 (gnus-summary-copy-article n nil method)))
7342 (defun gnus-summary-import-article (file)
7343 "Import an arbitrary file into a mail newsgroup."
7344 (interactive "fImport file: ")
7345 (let ((group gnus-newsgroup-name)
7346 (now (current-time))
7348 (unless (gnus-check-backend-function 'request-accept-article group)
7349 (error "%s does not support article importing" group))
7350 (or (file-readable-p file)
7351 (not (file-regular-p file))
7352 (error "Can't read %s" file))
7354 (set-buffer (gnus-get-buffer-create " *import file*"))
7356 (nnheader-insert-file-contents file)
7357 (goto-char (point-min))
7358 (unless (nnheader-article-p)
7359 ;; This doesn't look like an article, so we fudge some headers.
7360 (setq atts (file-attributes file)
7361 lines (count-lines (point-min) (point-max)))
7362 (insert "From: " (read-string "From: ") "\n"
7363 "Subject: " (read-string "Subject: ") "\n"
7364 "Date: " (message-make-date (nth 5 atts))
7366 "Message-ID: " (message-make-message-id) "\n"
7367 "Lines: " (int-to-string lines) "\n"
7368 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7369 (gnus-request-accept-article group nil t)
7370 (kill-buffer (current-buffer)))))
7372 (defun gnus-summary-article-posted-p ()
7373 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7374 This will be the case if the article has both been mailed and posted."
7376 (let ((id (mail-header-references (gnus-summary-article-header)))
7377 (gnus-override-method
7378 (or gnus-refer-article-method gnus-select-method)))
7379 (if (gnus-request-head id "")
7380 (gnus-message 2 "The current message was found on %s"
7381 gnus-override-method)
7382 (gnus-message 2 "The current message couldn't be found on %s"
7383 gnus-override-method)
7386 (defun gnus-summary-expire-articles (&optional now)
7387 "Expire all articles that are marked as expirable in the current group."
7389 (when (gnus-check-backend-function
7390 'request-expire-articles gnus-newsgroup-name)
7391 ;; This backend supports expiry.
7392 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7393 (expirable (if total
7395 ;; We need to update the info for
7396 ;; this group for `gnus-list-of-read-articles'
7397 ;; to give us the right answer.
7398 (gnus-run-hooks 'gnus-exit-group-hook)
7399 (gnus-summary-update-info)
7400 (gnus-list-of-read-articles gnus-newsgroup-name))
7401 (setq gnus-newsgroup-expirable
7402 (sort gnus-newsgroup-expirable '<))))
7403 (expiry-wait (if now 'immediate
7404 (gnus-group-find-parameter
7405 gnus-newsgroup-name 'expiry-wait)))
7408 ;; There are expirable articles in this group, so we run them
7409 ;; through the expiry process.
7410 (gnus-message 6 "Expiring articles...")
7411 ;; The list of articles that weren't expired is returned.
7414 (let ((nnmail-expiry-wait-function nil)
7415 (nnmail-expiry-wait expiry-wait))
7416 (setq es (gnus-request-expire-articles
7417 expirable gnus-newsgroup-name)))
7418 (setq es (gnus-request-expire-articles
7419 expirable gnus-newsgroup-name))))
7421 (setq gnus-newsgroup-expirable es))
7422 ;; We go through the old list of expirable, and mark all
7423 ;; really expired articles as nonexistent.
7424 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7425 (let ((gnus-use-cache nil))
7427 (unless (memq (car expirable) es)
7428 (when (gnus-data-find (car expirable))
7429 (gnus-summary-mark-article
7430 (car expirable) gnus-canceled-mark)))
7431 (setq expirable (cdr expirable)))))
7432 (gnus-message 6 "Expiring articles...done")))))
7434 (defun gnus-summary-expire-articles-now ()
7435 "Expunge all expirable articles in the current group.
7436 This means that *all* articles that are marked as expirable will be
7437 deleted forever, right now."
7439 (or gnus-expert-user
7441 "Are you really, really, really sure you want to delete all these messages? ")
7443 (gnus-summary-expire-articles t))
7445 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7446 (defun gnus-summary-delete-article (&optional n)
7447 "Delete the N next (mail) articles.
7448 This command actually deletes articles. This is not a marking
7449 command. The article will disappear forever from your life, never to
7451 If N is negative, delete backwards.
7452 If N is nil and articles have been marked with the process mark,
7453 delete these instead."
7455 (unless (gnus-check-backend-function 'request-expire-articles
7456 gnus-newsgroup-name)
7457 (error "The current newsgroup does not support article deletion"))
7458 ;; Compute the list of articles to delete.
7459 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7461 (if (and gnus-novice-user
7462 (not (gnus-yes-or-no-p
7463 (format "Do you really want to delete %s forever? "
7464 (if (> (length articles) 1)
7465 (format "these %s articles" (length articles))
7468 ;; Delete the articles.
7469 (setq not-deleted (gnus-request-expire-articles
7470 articles gnus-newsgroup-name 'force))
7472 (gnus-summary-remove-process-mark (car articles))
7473 ;; The backend might not have been able to delete the article
7475 (unless (memq (car articles) not-deleted)
7476 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7477 (setq articles (cdr articles)))
7479 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7480 (gnus-summary-position-point)
7481 (gnus-set-mode-line 'summary)
7484 (defun gnus-summary-edit-article (&optional force)
7485 "Edit the current article.
7486 This will have permanent effect only in mail groups.
7487 If FORCE is non-nil, allow editing of articles even in read-only
7490 (let ((mail-parse-charset gnus-newsgroup-charset))
7492 (set-buffer gnus-summary-buffer)
7493 (gnus-set-global-variables)
7494 (when (and (not force)
7495 (gnus-group-read-only-p))
7496 (error "The current newsgroup does not support article editing"))
7497 (gnus-summary-show-article t)
7498 (gnus-article-edit-article
7500 `(lambda (no-highlight)
7501 (let ((mail-parse-charset ',gnus-newsgroup-charset))
7503 (gnus-summary-edit-article-done
7504 ,(or (mail-header-references gnus-current-headers) "")
7505 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7507 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7509 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7511 "Make edits to the current article permanent."
7513 ;; Replace the article.
7514 (let ((buf (current-buffer)))
7516 (insert-buffer-substring buf)
7517 (if (and (not read-only)
7518 (not (gnus-request-replace-article
7519 (cdr gnus-article-current) (car gnus-article-current)
7520 (current-buffer) t)))
7521 (error "Couldn't replace article")
7522 ;; Update the summary buffer.
7524 (equal (message-tokenize-header references " ")
7525 (message-tokenize-header
7526 (or (message-fetch-field "references") "") " ")))
7527 ;; We only have to update this line.
7530 (message-narrow-to-head)
7531 (let ((head (buffer-string))
7534 (insert (format "211 %d Article retrieved.\n"
7535 (cdr gnus-article-current)))
7538 (let ((nntp-server-buffer (current-buffer)))
7539 (setq header (car (gnus-get-newsgroup-headers
7541 (set-buffer gnus-summary-buffer)
7542 gnus-newsgroup-dependencies)
7545 (set-buffer gnus-summary-buffer)
7546 (gnus-data-set-header
7547 (gnus-data-find (cdr gnus-article-current))
7549 (gnus-summary-update-article-line
7550 (cdr gnus-article-current) header))))))
7552 (set-buffer (or buffer gnus-summary-buffer))
7553 (gnus-summary-update-article (cdr gnus-article-current)))
7554 ;; Prettify the article buffer again.
7555 (unless no-highlight
7557 (set-buffer gnus-article-buffer)
7558 ;;;!!! Fix this -- article should be rehighlighted.
7559 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7560 (set-buffer gnus-original-article-buffer)
7561 (gnus-request-article
7562 (cdr gnus-article-current)
7563 (car gnus-article-current) (current-buffer))))
7564 ;; Prettify the summary buffer line.
7565 (when (gnus-visual-p 'summary-highlight 'highlight)
7566 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7568 (defun gnus-summary-edit-wash (key)
7569 "Perform editing command KEY in the article buffer."
7573 (message "%s" (concat (this-command-keys) "- "))
7576 (gnus-summary-edit-article)
7577 (execute-kbd-macro (concat (this-command-keys) key))
7578 (gnus-article-edit-done))
7582 (defun gnus-summary-respool-query (&optional silent trace)
7583 "Query where the respool algorithm would put this article."
7585 (let (gnus-mark-article-hook)
7586 (gnus-summary-select-article)
7588 (set-buffer gnus-original-article-buffer)
7590 (message-narrow-to-head)
7591 (let ((groups (nnmail-article-group 'identity trace)))
7594 (message "This message would go to %s"
7595 (mapconcat 'car groups ", "))
7596 (message "This message would go to no groups"))
7599 (defun gnus-summary-respool-trace ()
7600 "Trace where the respool algorithm would put this article.
7601 Display a buffer showing all fancy splitting patterns which matched."
7603 (gnus-summary-respool-query nil t))
7605 ;; Summary marking commands.
7607 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7608 "Mark articles which has the same subject as read, and then select the next.
7609 If UNMARK is positive, remove any kind of mark.
7610 If UNMARK is negative, tick articles."
7613 (setq unmark (prefix-numeric-value unmark)))
7615 (gnus-summary-mark-same-subject
7616 (gnus-summary-article-subject) unmark)))
7617 ;; Select next unread article. If auto-select-same mode, should
7618 ;; select the first unread article.
7619 (gnus-summary-next-article t (and gnus-auto-select-same
7620 (gnus-summary-article-subject)))
7621 (gnus-message 7 "%d article%s marked as %s"
7622 count (if (= count 1) " is" "s are")
7623 (if unmark "unread" "read"))))
7625 (defun gnus-summary-kill-same-subject (&optional unmark)
7626 "Mark articles which has the same subject as read.
7627 If UNMARK is positive, remove any kind of mark.
7628 If UNMARK is negative, tick articles."
7631 (setq unmark (prefix-numeric-value unmark)))
7633 (gnus-summary-mark-same-subject
7634 (gnus-summary-article-subject) unmark)))
7635 ;; If marked as read, go to next unread subject.
7637 ;; Go to next unread subject.
7638 (gnus-summary-next-subject 1 t))
7639 (gnus-message 7 "%d articles are marked as %s"
7640 count (if unmark "unread" "read"))))
7642 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7643 "Mark articles with same SUBJECT as read, and return marked number.
7644 If optional argument UNMARK is positive, remove any kinds of marks.
7645 If optional argument UNMARK is negative, mark articles as unread instead."
7649 ((null unmark) ; Mark as read.
7652 (gnus-summary-mark-article-as-read gnus-killed-mark)
7653 (gnus-summary-show-thread) t)
7654 (gnus-summary-find-subject subject))
7655 (setq count (1+ count))))
7656 ((> unmark 0) ; Tick.
7659 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7660 (gnus-summary-show-thread) t)
7661 (gnus-summary-find-subject subject))
7662 (setq count (1+ count))))
7663 (t ; Mark as unread.
7666 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7667 (gnus-summary-show-thread) t)
7668 (gnus-summary-find-subject subject))
7669 (setq count (1+ count)))))
7670 (gnus-set-mode-line 'summary)
7671 ;; Return the number of marked articles.
7674 (defun gnus-summary-mark-as-processable (n &optional unmark)
7675 "Set the process mark on the next N articles.
7676 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7677 the process mark instead. The difference between N and the actual
7678 number of articles marked is returned."
7680 (let ((backward (< n 0))
7685 (gnus-summary-remove-process-mark
7686 (gnus-summary-article-number))
7687 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7688 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7691 (gnus-message 7 "No more articles"))
7692 (gnus-summary-recenter)
7693 (gnus-summary-position-point)
7696 (defun gnus-summary-unmark-as-processable (n)
7697 "Remove the process mark from the next N articles.
7698 If N is negative, unmark backward instead. The difference between N and
7699 the actual number of articles unmarked is returned."
7701 (gnus-summary-mark-as-processable n t))
7703 (defun gnus-summary-unmark-all-processable ()
7704 "Remove the process mark from all articles."
7707 (while gnus-newsgroup-processable
7708 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7709 (gnus-summary-position-point))
7711 (defun gnus-summary-mark-as-expirable (n)
7712 "Mark N articles forward as expirable.
7713 If N is negative, mark backward instead. The difference between N and
7714 the actual number of articles marked is returned."
7716 (gnus-summary-mark-forward n gnus-expirable-mark))
7718 (defun gnus-summary-mark-article-as-replied (article)
7719 "Mark ARTICLE replied and update the summary line."
7720 (push article gnus-newsgroup-replied)
7721 (let ((buffer-read-only nil))
7722 (when (gnus-summary-goto-subject article nil t)
7723 (gnus-summary-update-secondary-mark article))))
7725 (defun gnus-summary-set-bookmark (article)
7726 "Set a bookmark in current article."
7727 (interactive (list (gnus-summary-article-number)))
7728 (when (or (not (get-buffer gnus-article-buffer))
7729 (not gnus-current-article)
7730 (not gnus-article-current)
7731 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7732 (error "No current article selected"))
7733 ;; Remove old bookmark, if one exists.
7734 (let ((old (assq article gnus-newsgroup-bookmarks)))
7736 (setq gnus-newsgroup-bookmarks
7737 (delq old gnus-newsgroup-bookmarks))))
7738 ;; Set the new bookmark, which is on the form
7739 ;; (article-number . line-number-in-body).
7743 (set-buffer gnus-article-buffer)
7747 (goto-char (point-min))
7748 (search-forward "\n\n" nil t)
7751 gnus-newsgroup-bookmarks)
7752 (gnus-message 6 "A bookmark has been added to the current article."))
7754 (defun gnus-summary-remove-bookmark (article)
7755 "Remove the bookmark from the current article."
7756 (interactive (list (gnus-summary-article-number)))
7757 ;; Remove old bookmark, if one exists.
7758 (let ((old (assq article gnus-newsgroup-bookmarks)))
7761 (setq gnus-newsgroup-bookmarks
7762 (delq old gnus-newsgroup-bookmarks))
7763 (gnus-message 6 "Removed bookmark."))
7764 (gnus-message 6 "No bookmark in current article."))))
7766 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7767 (defun gnus-summary-mark-as-dormant (n)
7768 "Mark N articles forward as dormant.
7769 If N is negative, mark backward instead. The difference between N and
7770 the actual number of articles marked is returned."
7772 (gnus-summary-mark-forward n gnus-dormant-mark))
7774 (defun gnus-summary-set-process-mark (article)
7775 "Set the process mark on ARTICLE and update the summary line."
7776 (setq gnus-newsgroup-processable
7778 (delq article gnus-newsgroup-processable)))
7779 (when (gnus-summary-goto-subject article)
7780 (gnus-summary-show-thread)
7781 (gnus-summary-goto-subject article)
7782 (gnus-summary-update-secondary-mark article)))
7784 (defun gnus-summary-remove-process-mark (article)
7785 "Remove the process mark from ARTICLE and update the summary line."
7786 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7787 (when (gnus-summary-goto-subject article)
7788 (gnus-summary-show-thread)
7789 (gnus-summary-goto-subject article)
7790 (gnus-summary-update-secondary-mark article)))
7792 (defun gnus-summary-set-saved-mark (article)
7793 "Set the process mark on ARTICLE and update the summary line."
7794 (push article gnus-newsgroup-saved)
7795 (when (gnus-summary-goto-subject article)
7796 (gnus-summary-update-secondary-mark article)))
7798 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7799 "Mark N articles as read forwards.
7800 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7801 The difference between N and the actual number of articles marked is
7804 (gnus-summary-show-thread)
7805 (let ((backward (< n 0))
7806 (gnus-summary-goto-unread
7807 (and gnus-summary-goto-unread
7808 (not (eq gnus-summary-goto-unread 'never))
7809 (not (memq mark (list gnus-unread-mark
7810 gnus-ticked-mark gnus-dormant-mark)))))
7812 (mark (or mark gnus-del-mark)))
7814 (gnus-summary-mark-article nil mark no-expire)
7815 (zerop (gnus-summary-next-subject
7817 (and gnus-summary-goto-unread
7818 (not (eq gnus-summary-goto-unread 'never)))
7822 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7823 (gnus-summary-recenter)
7824 (gnus-summary-position-point)
7825 (gnus-set-mode-line 'summary)
7828 (defun gnus-summary-mark-article-as-read (mark)
7829 "Mark the current article quickly as read with MARK."
7830 (let ((article (gnus-summary-article-number)))
7831 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7832 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7833 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7834 (push (cons article mark) gnus-newsgroup-reads)
7835 ;; Possibly remove from cache, if that is used.
7836 (when gnus-use-cache
7837 (gnus-cache-enter-remove-article article))
7838 ;; Allow the backend to change the mark.
7839 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7840 ;; Check for auto-expiry.
7841 (when (and gnus-newsgroup-auto-expire
7842 (memq mark gnus-auto-expirable-marks))
7843 (setq mark gnus-expirable-mark)
7844 ;; Let the backend know about the mark change.
7845 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7846 (push article gnus-newsgroup-expirable))
7847 ;; Set the mark in the buffer.
7848 (gnus-summary-update-mark mark 'unread)
7851 (defun gnus-summary-mark-article-as-unread (mark)
7852 "Mark the current article quickly as unread with MARK."
7853 (let* ((article (gnus-summary-article-number))
7854 (old-mark (gnus-summary-article-mark article)))
7855 ;; Allow the backend to change the mark.
7856 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7857 (if (eq mark old-mark)
7861 (gnus-error 1 "Can't mark negative article numbers")
7863 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7864 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7865 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7866 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7867 (cond ((= mark gnus-ticked-mark)
7868 (push article gnus-newsgroup-marked))
7869 ((= mark gnus-dormant-mark)
7870 (push article gnus-newsgroup-dormant))
7872 (push article gnus-newsgroup-unreads)))
7873 (gnus-pull article gnus-newsgroup-reads)
7875 ;; See whether the article is to be put in the cache.
7877 (vectorp (gnus-summary-article-header article))
7879 (gnus-cache-possibly-enter-article
7880 gnus-newsgroup-name article
7881 (gnus-summary-article-header article)
7882 (= mark gnus-ticked-mark)
7883 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7886 (gnus-summary-update-mark mark 'unread)
7889 (defun gnus-summary-mark-article (&optional article mark no-expire)
7890 "Mark ARTICLE with MARK. MARK can be any character.
7891 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7892 `??' (dormant) and `?E' (expirable).
7893 If MARK is nil, then the default character `?r' is used.
7894 If ARTICLE is nil, then the article on the current line will be
7896 ;; The mark might be a string.
7897 (when (stringp mark)
7898 (setq mark (aref mark 0)))
7899 ;; If no mark is given, then we check auto-expiring.
7901 (setq mark gnus-del-mark))
7902 (when (and (not no-expire)
7903 gnus-newsgroup-auto-expire
7904 (memq mark gnus-auto-expirable-marks))
7905 (setq mark gnus-expirable-mark))
7906 (let ((article (or article (gnus-summary-article-number)))
7907 (old-mark (gnus-summary-article-mark article)))
7908 ;; Allow the backend to change the mark.
7909 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7910 (if (eq mark old-mark)
7913 (error "No article on current line"))
7914 (if (not (if (or (= mark gnus-unread-mark)
7915 (= mark gnus-ticked-mark)
7916 (= mark gnus-dormant-mark))
7917 (gnus-mark-article-as-unread article mark)
7918 (gnus-mark-article-as-read article mark)))
7920 ;; See whether the article is to be put in the cache.
7922 (not (= mark gnus-canceled-mark))
7923 (vectorp (gnus-summary-article-header article))
7925 (gnus-cache-possibly-enter-article
7926 gnus-newsgroup-name article
7927 (gnus-summary-article-header article)
7928 (= mark gnus-ticked-mark)
7929 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7931 (when (gnus-summary-goto-subject article nil t)
7932 (let ((buffer-read-only nil))
7933 (gnus-summary-show-thread)
7935 (gnus-summary-update-mark mark 'unread)
7938 (defun gnus-summary-update-secondary-mark (article)
7939 "Update the secondary (read, process, cache) mark."
7940 (gnus-summary-update-mark
7941 (cond ((memq article gnus-newsgroup-processable)
7943 ((memq article gnus-newsgroup-cached)
7945 ((memq article gnus-newsgroup-replied)
7947 ((memq article gnus-newsgroup-saved)
7949 (t gnus-unread-mark))
7951 (when (gnus-visual-p 'summary-highlight 'highlight)
7952 (gnus-run-hooks 'gnus-summary-update-hook))
7955 (defun gnus-summary-update-mark (mark type)
7956 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7957 (buffer-read-only nil))
7958 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7960 (when (looking-at "\r")
7962 (when (<= (+ forward (point)) (point-max))
7963 ;; Go to the right position on the line.
7964 (goto-char (+ forward (point)))
7965 ;; Replace the old mark with the new mark.
7966 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7967 ;; Optionally update the marks by some user rule.
7968 (when (eq type 'unread)
7970 (gnus-data-find (gnus-summary-article-number)) mark)
7971 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7973 (defun gnus-mark-article-as-read (article &optional mark)
7974 "Enter ARTICLE in the pertinent lists and remove it from others."
7975 ;; Make the article expirable.
7976 (let ((mark (or mark gnus-del-mark)))
7977 (if (= mark gnus-expirable-mark)
7978 (push article gnus-newsgroup-expirable)
7979 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7980 ;; Remove from unread and marked lists.
7981 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7982 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7983 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7984 (push (cons article mark) gnus-newsgroup-reads)
7985 ;; Possibly remove from cache, if that is used.
7986 (when gnus-use-cache
7987 (gnus-cache-enter-remove-article article))
7990 (defun gnus-mark-article-as-unread (article &optional mark)
7991 "Enter ARTICLE in the pertinent lists and remove it from others."
7992 (let ((mark (or mark gnus-ticked-mark)))
7995 (gnus-error 1 "Can't mark negative article numbers")
7997 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7998 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7999 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8000 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8002 ;; Unsuppress duplicates?
8003 (when gnus-suppress-duplicates
8004 (gnus-dup-unsuppress-article article))
8006 (cond ((= mark gnus-ticked-mark)
8007 (push article gnus-newsgroup-marked))
8008 ((= mark gnus-dormant-mark)
8009 (push article gnus-newsgroup-dormant))
8011 (push article gnus-newsgroup-unreads)))
8012 (gnus-pull article gnus-newsgroup-reads)
8015 (defalias 'gnus-summary-mark-as-unread-forward
8016 'gnus-summary-tick-article-forward)
8017 (make-obsolete 'gnus-summary-mark-as-unread-forward
8018 'gnus-summary-tick-article-forward)
8019 (defun gnus-summary-tick-article-forward (n)
8020 "Tick N articles forwards.
8021 If N is negative, tick backwards instead.
8022 The difference between N and the number of articles ticked is returned."
8024 (gnus-summary-mark-forward n gnus-ticked-mark))
8026 (defalias 'gnus-summary-mark-as-unread-backward
8027 'gnus-summary-tick-article-backward)
8028 (make-obsolete 'gnus-summary-mark-as-unread-backward
8029 'gnus-summary-tick-article-backward)
8030 (defun gnus-summary-tick-article-backward (n)
8031 "Tick N articles backwards.
8032 The difference between N and the number of articles ticked is returned."
8034 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8036 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8037 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8038 (defun gnus-summary-tick-article (&optional article clear-mark)
8039 "Mark current article as unread.
8040 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8041 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8043 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8046 (defun gnus-summary-mark-as-read-forward (n)
8047 "Mark N articles as read forwards.
8048 If N is negative, mark backwards instead.
8049 The difference between N and the actual number of articles marked is
8052 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8054 (defun gnus-summary-mark-as-read-backward (n)
8055 "Mark the N articles as read backwards.
8056 The difference between N and the actual number of articles marked is
8059 (gnus-summary-mark-forward
8060 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8062 (defun gnus-summary-mark-as-read (&optional article mark)
8063 "Mark current article as read.
8064 ARTICLE specifies the article to be marked as read.
8065 MARK specifies a string to be inserted at the beginning of the line."
8066 (gnus-summary-mark-article article mark))
8068 (defun gnus-summary-clear-mark-forward (n)
8069 "Clear marks from N articles forward.
8070 If N is negative, clear backward instead.
8071 The difference between N and the number of marks cleared is returned."
8073 (gnus-summary-mark-forward n gnus-unread-mark))
8075 (defun gnus-summary-clear-mark-backward (n)
8076 "Clear marks from N articles backward.
8077 The difference between N and the number of marks cleared is returned."
8079 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8081 (defun gnus-summary-mark-unread-as-read ()
8082 "Intended to be used by `gnus-summary-mark-article-hook'."
8083 (when (memq gnus-current-article gnus-newsgroup-unreads)
8084 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8086 (defun gnus-summary-mark-read-and-unread-as-read ()
8087 "Intended to be used by `gnus-summary-mark-article-hook'."
8088 (let ((mark (gnus-summary-article-mark)))
8089 (when (or (gnus-unread-mark-p mark)
8090 (gnus-read-mark-p mark))
8091 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8093 (defun gnus-summary-mark-region-as-read (point mark all)
8094 "Mark all unread articles between point and mark as read.
8095 If given a prefix, mark all articles between point and mark as read,
8096 even ticked and dormant ones."
8097 (interactive "r\nP")
8106 (memq (setq article (gnus-summary-article-number))
8107 gnus-newsgroup-unreads))
8108 (gnus-summary-mark-article article gnus-del-mark))
8110 (gnus-summary-find-next))))))
8112 (defun gnus-summary-mark-below (score mark)
8113 "Mark articles with score less than SCORE with MARK."
8114 (interactive "P\ncMark: ")
8115 (setq score (if score
8116 (prefix-numeric-value score)
8117 (or gnus-summary-default-score 0)))
8119 (set-buffer gnus-summary-buffer)
8120 (goto-char (point-min))
8123 (and (< (gnus-summary-article-score) score)
8124 (gnus-summary-mark-article nil mark))
8125 (gnus-summary-find-next)))))
8127 (defun gnus-summary-kill-below (&optional score)
8128 "Mark articles with score below SCORE as read."
8130 (gnus-summary-mark-below score gnus-killed-mark))
8132 (defun gnus-summary-clear-above (&optional score)
8133 "Clear all marks from articles with score above SCORE."
8135 (gnus-summary-mark-above score gnus-unread-mark))
8137 (defun gnus-summary-tick-above (&optional score)
8138 "Tick all articles with score above SCORE."
8140 (gnus-summary-mark-above score gnus-ticked-mark))
8142 (defun gnus-summary-mark-above (score mark)
8143 "Mark articles with score over SCORE with MARK."
8144 (interactive "P\ncMark: ")
8145 (setq score (if score
8146 (prefix-numeric-value score)
8147 (or gnus-summary-default-score 0)))
8149 (set-buffer gnus-summary-buffer)
8150 (goto-char (point-min))
8152 (when (> (gnus-summary-article-score) score)
8153 (gnus-summary-mark-article nil mark))
8155 (gnus-summary-find-next)))))
8157 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8158 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8159 (defun gnus-summary-limit-include-expunged (&optional no-error)
8160 "Display all the hidden articles that were expunged for low scores."
8162 (let ((buffer-read-only nil))
8163 (let ((scored gnus-newsgroup-scored)
8166 (unless (gnus-summary-goto-subject (caar scored))
8167 (and (setq h (gnus-summary-article-header (caar scored)))
8168 (< (cdar scored) gnus-summary-expunge-below)
8170 (setq scored (cdr scored)))
8172 (when (not no-error)
8173 (error "No expunged articles hidden"))
8174 (goto-char (point-min))
8175 (gnus-summary-prepare-unthreaded (nreverse headers))
8176 (goto-char (point-min))
8177 (gnus-summary-position-point)
8180 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8181 "Mark all unread articles in this newsgroup as read.
8182 If prefix argument ALL is non-nil, ticked and dormant articles will
8183 also be marked as read.
8184 If QUIETLY is non-nil, no questions will be asked.
8185 If TO-HERE is non-nil, it should be a point in the buffer. All
8186 articles before this point will be marked as read.
8187 Note that this function will only catch up the unread article
8188 in the current summary buffer limitation.
8189 The number of articles marked as read is returned."
8194 (not gnus-interactive-catchup) ;Without confirmation?
8198 "Mark absolutely all articles as read? "
8199 "Mark all unread articles as read? ")))
8201 (not gnus-newsgroup-adaptive)
8202 (not gnus-newsgroup-auto-expire)
8203 (not gnus-suppress-duplicates)
8204 (or (not gnus-use-cache)
8205 (eq gnus-use-cache 'passive)))
8208 (setq gnus-newsgroup-marked nil
8209 gnus-newsgroup-dormant nil))
8210 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8211 ;; We actually mark all articles as canceled, which we
8212 ;; have to do when using auto-expiry or adaptive scoring.
8213 (gnus-summary-show-all-threads)
8214 (when (gnus-summary-first-subject (not all) t)
8216 (if to-here (< (point) to-here) t)
8217 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8218 (gnus-summary-find-next (not all) nil nil t))))
8219 (gnus-set-mode-line 'summary))
8221 (gnus-summary-position-point)))
8223 (defun gnus-summary-catchup-to-here (&optional all)
8224 "Mark all unticked articles before the current one as read.
8225 If ALL is non-nil, also mark ticked and dormant articles as read."
8228 (gnus-save-hidden-threads
8229 (let ((beg (point)))
8230 ;; We check that there are unread articles.
8231 (when (or all (gnus-summary-find-prev))
8232 (gnus-summary-catchup all t beg)))))
8233 (gnus-summary-position-point))
8235 (defun gnus-summary-catchup-all (&optional quietly)
8236 "Mark all articles in this newsgroup as read."
8238 (gnus-summary-catchup t quietly))
8240 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8241 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8242 If prefix argument ALL is non-nil, all articles are marked as read."
8244 (when (gnus-summary-catchup all quietly nil 'fast)
8245 ;; Select next newsgroup or exit.
8246 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8247 (eq gnus-auto-select-next 'quietly))
8248 (gnus-summary-next-group nil)
8249 (gnus-summary-exit))))
8251 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8252 "Mark all articles in this newsgroup as read, and then exit."
8254 (gnus-summary-catchup-and-exit t quietly))
8256 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8257 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8258 "Mark all articles in this group as read and select the next group.
8259 If given a prefix, mark all articles, unread as well as ticked, as
8263 (gnus-summary-catchup all))
8264 (gnus-summary-next-article t nil nil t))
8266 ;; Thread-based commands.
8268 (defun gnus-summary-articles-in-thread (&optional article)
8269 "Return a list of all articles in the current thread.
8270 If ARTICLE is non-nil, return all articles in the thread that starts
8272 (let* ((article (or article (gnus-summary-article-number)))
8273 (data (gnus-data-find-list article))
8274 (top-level (gnus-data-level (car data)))
8276 (cond ((null gnus-thread-operation-ignore-subject)
8277 (gnus-simplify-subject-re
8278 (mail-header-subject (gnus-data-header (car data)))))
8279 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8280 (gnus-simplify-subject-fuzzy
8281 (mail-header-subject (gnus-data-header (car data)))))
8283 (end-point (save-excursion
8284 (if (gnus-summary-go-to-next-thread)
8285 (point) (point-max))))
8288 (< (gnus-data-pos (car data)) end-point))
8289 (when (or (not top-subject)
8290 (string= top-subject
8291 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8292 (gnus-simplify-subject-fuzzy
8293 (mail-header-subject
8294 (gnus-data-header (car data))))
8295 (gnus-simplify-subject-re
8296 (mail-header-subject
8297 (gnus-data-header (car data)))))))
8298 (push (gnus-data-number (car data)) articles))
8299 (unless (and (setq data (cdr data))
8300 (> (gnus-data-level (car data)) top-level))
8302 ;; Return the list of articles.
8303 (nreverse articles)))
8305 (defun gnus-summary-rethread-current ()
8306 "Rethread the thread the current article is part of."
8308 (let* ((gnus-show-threads t)
8309 (article (gnus-summary-article-number))
8310 (id (mail-header-id (gnus-summary-article-header)))
8311 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8313 (error "No article on the current line"))
8314 (gnus-rebuild-thread id)
8315 (gnus-summary-goto-subject article)))
8317 (defun gnus-summary-reparent-thread ()
8318 "Make the current article child of the marked (or previous) article.
8320 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8321 is non-nil or the Subject: of both articles are the same."
8323 (unless (not (gnus-group-read-only-p))
8324 (error "The current newsgroup does not support article editing"))
8325 (unless (<= (length gnus-newsgroup-processable) 1)
8326 (error "No more than one article may be marked"))
8327 (save-window-excursion
8328 (let ((gnus-article-buffer " *reparent*")
8329 (current-article (gnus-summary-article-number))
8330 ;; First grab the marked article, otherwise one line up.
8331 (parent-article (if (not (null gnus-newsgroup-processable))
8332 (car gnus-newsgroup-processable)
8334 (if (eq (forward-line -1) 0)
8335 (gnus-summary-article-number)
8336 (error "Beginning of summary buffer"))))))
8337 (unless (not (eq current-article parent-article))
8338 (error "An article may not be self-referential"))
8339 (let ((message-id (mail-header-id
8340 (gnus-summary-article-header parent-article))))
8341 (unless (and message-id (not (equal message-id "")))
8342 (error "No message-id in desired parent"))
8343 (gnus-with-article current-article
8344 (goto-char (point-min))
8345 (if (re-search-forward "^References: " nil t)
8347 (re-search-forward "^[^ \t]" nil t)
8350 (insert " " message-id))
8351 (insert "References: " message-id "\n")))
8352 (set-buffer gnus-summary-buffer)
8353 (gnus-summary-unmark-all-processable)
8354 (gnus-summary-update-article current-article)
8355 (gnus-summary-rethread-current)
8356 (gnus-message 3 "Article %d is now the child of article %d"
8357 current-article parent-article)))))
8359 (defun gnus-summary-toggle-threads (&optional arg)
8360 "Toggle showing conversation threads.
8361 If ARG is positive number, turn showing conversation threads on."
8363 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8364 (setq gnus-show-threads
8365 (if (null arg) (not gnus-show-threads)
8366 (> (prefix-numeric-value arg) 0)))
8367 (gnus-summary-prepare)
8368 (gnus-summary-goto-subject current)
8369 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8370 (gnus-summary-position-point)))
8372 (defun gnus-summary-show-all-threads ()
8376 (let ((buffer-read-only nil))
8377 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8378 (gnus-summary-position-point))
8380 (defun gnus-summary-show-thread ()
8381 "Show thread subtrees.
8382 Returns nil if no thread was there to be shown."
8384 (let ((buffer-read-only nil)
8386 ;; first goto end then to beg, to have point at beg after let
8387 (end (progn (end-of-line) (point)))
8388 (beg (progn (beginning-of-line) (point))))
8390 ;; Any hidden lines here?
8391 (search-forward "\r" end t)
8392 (subst-char-in-region beg end ?\^M ?\n t)
8394 (gnus-summary-position-point))))
8396 (defun gnus-summary-hide-all-threads ()
8397 "Hide all thread subtrees."
8400 (goto-char (point-min))
8401 (gnus-summary-hide-thread)
8402 (while (zerop (gnus-summary-next-thread 1 t))
8403 (gnus-summary-hide-thread)))
8404 (gnus-summary-position-point))
8406 (defun gnus-summary-hide-thread ()
8407 "Hide thread subtrees.
8408 Returns nil if no threads were there to be hidden."
8410 (let ((buffer-read-only nil)
8412 (article (gnus-summary-article-number)))
8414 ;; Go forward until either the buffer ends or the subthread
8416 (when (and (not (eobp))
8417 (or (zerop (gnus-summary-next-thread 1 t))
8418 (goto-char (point-max))))
8420 (if (and (> (point) start)
8421 (search-backward "\n" start t))
8423 (subst-char-in-region start (point) ?\n ?\^M)
8424 (gnus-summary-goto-subject article))
8427 ;;(gnus-summary-position-point)
8430 (defun gnus-summary-go-to-next-thread (&optional previous)
8431 "Go to the same level (or less) next thread.
8432 If PREVIOUS is non-nil, go to previous thread instead.
8433 Return the article number moved to, or nil if moving was impossible."
8434 (let ((level (gnus-summary-thread-level))
8435 (way (if previous -1 1))
8438 (while (and (not (eobp))
8439 (< level (gnus-summary-thread-level)))
8447 (gnus-summary-article-number)
8450 (defun gnus-summary-next-thread (n &optional silent)
8451 "Go to the same level next N'th thread.
8452 If N is negative, search backward instead.
8453 Returns the difference between N and the number of skips actually
8456 If SILENT, don't output messages."
8458 (let ((backward (< n 0))
8461 (gnus-summary-go-to-next-thread backward))
8464 (gnus-summary-position-point))
8465 (when (and (not silent) (/= 0 n))
8466 (gnus-message 7 "No more threads"))
8469 (defun gnus-summary-prev-thread (n)
8470 "Go to the same level previous N'th thread.
8471 Returns the difference between N and the number of skips actually
8474 (gnus-summary-next-thread (- n)))
8476 (defun gnus-summary-go-down-thread ()
8477 "Go down one level in the current thread."
8478 (let ((children (gnus-summary-article-children)))
8480 (gnus-summary-goto-subject (car children)))))
8482 (defun gnus-summary-go-up-thread ()
8483 "Go up one level in the current thread."
8484 (let ((parent (gnus-summary-article-parent)))
8486 (gnus-summary-goto-subject parent))))
8488 (defun gnus-summary-down-thread (n)
8489 "Go down thread N steps.
8490 If N is negative, go up instead.
8491 Returns the difference between N and how many steps down that were
8497 (if up (gnus-summary-go-up-thread)
8498 (gnus-summary-go-down-thread)))
8500 (gnus-summary-position-point)
8502 (gnus-message 7 "Can't go further"))
8505 (defun gnus-summary-up-thread (n)
8506 "Go up thread N steps.
8507 If N is negative, go up instead.
8508 Returns the difference between N and how many steps down that were
8511 (gnus-summary-down-thread (- n)))
8513 (defun gnus-summary-top-thread ()
8514 "Go to the top of the thread."
8516 (while (gnus-summary-go-up-thread))
8517 (gnus-summary-article-number))
8519 (defun gnus-summary-kill-thread (&optional unmark)
8520 "Mark articles under current thread as read.
8521 If the prefix argument is positive, remove any kinds of marks.
8522 If the prefix argument is negative, tick articles instead."
8525 (setq unmark (prefix-numeric-value unmark)))
8526 (let ((articles (gnus-summary-articles-in-thread)))
8528 ;; Expand the thread.
8529 (gnus-summary-show-thread)
8530 ;; Mark all the articles.
8532 (gnus-summary-goto-subject (car articles))
8533 (cond ((null unmark)
8534 (gnus-summary-mark-article-as-read gnus-killed-mark))
8536 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8538 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8539 (setq articles (cdr articles))))
8540 ;; Hide killed subtrees.
8542 gnus-thread-hide-killed
8543 (gnus-summary-hide-thread))
8544 ;; If marked as read, go to next unread subject.
8546 ;; Go to next unread subject.
8547 (gnus-summary-next-subject 1 t)))
8548 (gnus-set-mode-line 'summary))
8550 ;; Summary sorting commands
8552 (defun gnus-summary-sort-by-number (&optional reverse)
8553 "Sort the summary buffer by article number.
8554 Argument REVERSE means reverse order."
8556 (gnus-summary-sort 'number reverse))
8558 (defun gnus-summary-sort-by-author (&optional reverse)
8559 "Sort the summary buffer by author name alphabetically.
8560 If case-fold-search is non-nil, case of letters is ignored.
8561 Argument REVERSE means reverse order."
8563 (gnus-summary-sort 'author reverse))
8565 (defun gnus-summary-sort-by-subject (&optional reverse)
8566 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8567 If case-fold-search is non-nil, case of letters is ignored.
8568 Argument REVERSE means reverse order."
8570 (gnus-summary-sort 'subject reverse))
8572 (defun gnus-summary-sort-by-date (&optional reverse)
8573 "Sort the summary buffer by date.
8574 Argument REVERSE means reverse order."
8576 (gnus-summary-sort 'date reverse))
8578 (defun gnus-summary-sort-by-score (&optional reverse)
8579 "Sort the summary buffer by score.
8580 Argument REVERSE means reverse order."
8582 (gnus-summary-sort 'score reverse))
8584 (defun gnus-summary-sort-by-lines (&optional reverse)
8585 "Sort the summary buffer by the number of lines.
8586 Argument REVERSE means reverse order."
8588 (gnus-summary-sort 'lines reverse))
8590 (defun gnus-summary-sort-by-chars (&optional reverse)
8591 "Sort the summary buffer by article length.
8592 Argument REVERSE means reverse order."
8594 (gnus-summary-sort 'chars reverse))
8596 (defun gnus-summary-sort (predicate reverse)
8597 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8598 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8599 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8600 (gnus-thread-sort-functions
8605 (gnus-article-sort-functions
8611 (gnus-summary-prepare-hook nil))
8612 ;; We do the sorting by regenerating the threads.
8613 (gnus-summary-prepare)
8614 ;; Hide subthreads if needed.
8615 (when (and gnus-show-threads gnus-thread-hide-subtree)
8616 (gnus-summary-hide-all-threads))))
8618 ;; Summary saving commands.
8620 (defun gnus-summary-save-article (&optional n not-saved)
8621 "Save the current article using the default saver function.
8622 If N is a positive number, save the N next articles.
8623 If N is a negative number, save the N previous articles.
8624 If N is nil and any articles have been marked with the process mark,
8625 save those articles instead.
8626 The variable `gnus-default-article-saver' specifies the saver function."
8628 (let* ((articles (gnus-summary-work-articles n))
8629 (save-buffer (save-excursion
8630 (nnheader-set-temp-buffer " *Gnus Save*")))
8631 (num (length articles))
8633 (dolist (article articles)
8634 (setq header (gnus-summary-article-header article))
8635 (if (not (vectorp header))
8636 ;; This is a pseudo-article.
8637 (if (assq 'name header)
8638 (gnus-copy-file (cdr (assq 'name header)))
8639 (gnus-message 1 "Article %d is unsaveable" article))
8640 ;; This is a real article.
8641 (save-window-excursion
8642 (gnus-summary-select-article t nil nil article))
8644 (set-buffer save-buffer)
8646 (insert-buffer-substring gnus-original-article-buffer))
8647 (setq file (gnus-article-save save-buffer file num))
8648 (gnus-summary-remove-process-mark article)
8650 (gnus-summary-set-saved-mark article))))
8651 (gnus-kill-buffer save-buffer)
8652 (gnus-summary-position-point)
8653 (gnus-set-mode-line 'summary)
8656 (defun gnus-summary-pipe-output (&optional arg)
8657 "Pipe the current article to a subprocess.
8658 If N is a positive number, pipe the N next articles.
8659 If N is a negative number, pipe the N previous articles.
8660 If N is nil and any articles have been marked with the process mark,
8661 pipe those articles instead."
8663 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8664 (gnus-summary-save-article arg t))
8665 (gnus-configure-windows 'pipe))
8667 (defun gnus-summary-save-article-mail (&optional arg)
8668 "Append the current article to an mail file.
8669 If N is a positive number, save the N next articles.
8670 If N is a negative number, save the N previous articles.
8671 If N is nil and any articles have been marked with the process mark,
8672 save those articles instead."
8674 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8675 (gnus-summary-save-article arg)))
8677 (defun gnus-summary-save-article-rmail (&optional arg)
8678 "Append the current article to an rmail file.
8679 If N is a positive number, save the N next articles.
8680 If N is a negative number, save the N previous articles.
8681 If N is nil and any articles have been marked with the process mark,
8682 save those articles instead."
8684 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8685 (gnus-summary-save-article arg)))
8687 (defun gnus-summary-save-article-file (&optional arg)
8688 "Append the current article to a file.
8689 If N is a positive number, save the N next articles.
8690 If N is a negative number, save the N previous articles.
8691 If N is nil and any articles have been marked with the process mark,
8692 save those articles instead."
8694 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8695 (gnus-summary-save-article arg)))
8697 (defun gnus-summary-write-article-file (&optional arg)
8698 "Write the current article to a file, deleting the previous file.
8699 If N is a positive number, save the N next articles.
8700 If N is a negative number, save the N previous articles.
8701 If N is nil and any articles have been marked with the process mark,
8702 save those articles instead."
8704 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8705 (gnus-summary-save-article arg)))
8707 (defun gnus-summary-save-article-body-file (&optional arg)
8708 "Append the current article body to a file.
8709 If N is a positive number, save the N next articles.
8710 If N is a negative number, save the N previous articles.
8711 If N is nil and any articles have been marked with the process mark,
8712 save those articles instead."
8714 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8715 (gnus-summary-save-article arg)))
8717 (defun gnus-summary-pipe-message (program)
8718 "Pipe the current article through PROGRAM."
8719 (interactive "sProgram: ")
8720 (gnus-summary-select-article)
8721 (let ((mail-header-separator ""))
8722 (gnus-eval-in-buffer-window gnus-article-buffer
8725 (let ((start (window-start))
8727 (message-pipe-buffer-body program)
8728 (set-window-start (get-buffer-window (current-buffer)) start))))))
8730 (defun gnus-get-split-value (methods)
8731 "Return a value based on the split METHODS."
8732 (let (split-name method result match)
8735 (set-buffer gnus-original-article-buffer)
8737 (nnheader-narrow-to-headers)
8739 (goto-char (point-min))
8740 (setq method (pop methods))
8741 (setq match (car method))
8744 ;; Regular expression.
8746 (re-search-forward match nil t)))
8747 ((gnus-functionp match)
8751 (setq result (funcall match gnus-newsgroup-name))))
8756 (setq result (eval match)))))
8757 (setq split-name (append (cdr method) split-name))
8758 (cond ((stringp result)
8759 (push (expand-file-name
8760 result gnus-article-save-directory)
8763 (setq split-name (append result split-name)))))))))
8766 (defun gnus-valid-move-group-p (group)
8769 (symbol-value group)
8772 (car (gnus-find-method-for-group
8773 (symbol-name group))))
8774 gnus-valid-select-methods))))
8776 (defun gnus-read-move-group-name (prompt default articles prefix)
8777 "Read a group name."
8778 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8779 (minibuffer-confirm-incomplete nil) ; XEmacs
8783 (if (> (length articles) 1)
8784 (format "these %d articles" (length articles))
8789 (gnus-completing-read default prom
8791 'gnus-valid-move-group-p
8793 'gnus-group-history))
8794 ((= 1 (length split-name))
8795 (gnus-completing-read (car split-name) prom
8797 'gnus-valid-move-group-p
8799 'gnus-group-history))
8801 (gnus-completing-read nil prom
8802 (mapcar (lambda (el) (list el))
8803 (nreverse split-name))
8805 'gnus-group-history)))))
8807 (if (or (string= to-newsgroup "")
8808 (string= to-newsgroup prefix))
8809 (setq to-newsgroup default))
8810 (unless to-newsgroup
8811 (error "No group name entered"))
8812 (or (gnus-active to-newsgroup)
8813 (gnus-activate-group to-newsgroup)
8814 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8816 (or (and (gnus-request-create-group
8817 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8818 (gnus-activate-group to-newsgroup nil nil
8819 (gnus-group-name-to-method
8821 (error "Couldn't create group %s" to-newsgroup)))
8822 (error "No such group: %s" to-newsgroup)))
8825 ;; Summary extract commands
8827 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8828 (let ((buffer-read-only nil)
8829 (article (gnus-summary-article-number))
8831 (unless (gnus-summary-goto-subject article)
8832 (error "No such article: %d" article))
8833 (gnus-summary-position-point)
8834 ;; If all commands are to be bunched up on one line, we collect
8836 (unless gnus-view-pseudos-separately
8837 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8840 (setq action (cdr (assq 'action (car ps))))
8841 (setq files (list (cdr (assq 'name (car ps)))))
8842 (while (and ps (cdr ps)
8843 (string= (or action "1")
8844 (or (cdr (assq 'action (cadr ps))) "2")))
8845 (push (cdr (assq 'name (cadr ps))) files)
8846 (setcdr ps (cddr ps)))
8848 (when (not (string-match "%s" action))
8851 (when (assq 'execute (car ps))
8852 (setcdr (assq 'execute (car ps))
8853 (funcall (if (string-match "%s" action)
8860 (gnus-quote-arg-for-sh-or-csh f)))
8862 (setq ps (cdr ps)))))
8863 (if (and gnus-view-pseudos (not not-view))
8865 (when (assq 'execute (car pslist))
8866 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8867 (eq gnus-view-pseudos 'not-confirm)))
8868 (setq pslist (cdr pslist)))
8871 (setq after-article (or (cdr (assq 'article (car pslist)))
8872 (gnus-summary-article-number)))
8873 (gnus-summary-goto-subject after-article)
8876 (insert " " (file-name-nondirectory
8877 (cdr (assq 'name (car pslist))))
8878 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8880 (forward-line -1) ; back to `b'
8881 (gnus-add-text-properties
8882 b (1- e) (list 'gnus-number gnus-reffed-article-number
8883 gnus-mouse-face-prop gnus-mouse-face))
8885 after-article gnus-reffed-article-number
8886 gnus-unread-mark b (car pslist) 0 (- e b))
8887 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8888 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8889 (setq pslist (cdr pslist)))))))
8891 (defun gnus-pseudos< (p1 p2)
8892 (let ((c1 (cdr (assq 'action p1)))
8893 (c2 (cdr (assq 'action p2))))
8894 (and c1 c2 (string< c1 c2))))
8896 (defun gnus-request-pseudo-article (props)
8897 (cond ((assq 'execute props)
8898 (gnus-execute-command (cdr (assq 'execute props)))))
8899 (let ((gnus-current-article (gnus-summary-article-number)))
8900 (gnus-run-hooks 'gnus-mark-article-hook)))
8902 (defun gnus-execute-command (command &optional automatic)
8904 (gnus-article-setup-buffer)
8905 (set-buffer gnus-article-buffer)
8906 (setq buffer-read-only nil)
8907 (let ((command (if automatic command
8908 (read-string "Command: " (cons command 0)))))
8910 (insert "$ " command "\n\n")
8911 (if gnus-view-pseudo-asynchronously
8912 (start-process "gnus-execute" (current-buffer) shell-file-name
8913 shell-command-switch command)
8914 (call-process shell-file-name nil t nil
8915 shell-command-switch command)))))
8917 ;; Summary kill commands.
8919 (defun gnus-summary-edit-global-kill (article)
8920 "Edit the \"global\" kill file."
8921 (interactive (list (gnus-summary-article-number)))
8922 (gnus-group-edit-global-kill article))
8924 (defun gnus-summary-edit-local-kill ()
8925 "Edit a local kill file applied to the current newsgroup."
8927 (setq gnus-current-headers (gnus-summary-article-header))
8928 (gnus-group-edit-local-kill
8929 (gnus-summary-article-number) gnus-newsgroup-name))
8933 (defun gnus-read-header (id &optional header)
8934 "Read the headers of article ID and enter them into the Gnus system."
8935 (let ((group gnus-newsgroup-name)
8936 (gnus-override-method
8937 (and (gnus-news-group-p gnus-newsgroup-name)
8938 gnus-refer-article-method))
8940 ;; First we check to see whether the header in question is already
8943 ;; This is a Message-ID.
8944 (setq header (or header (gnus-id-to-header id)))
8945 ;; This is an article number.
8946 (setq header (or header (gnus-summary-article-header id))))
8948 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8949 ;; We have found the header.
8951 ;; If this is a sparse article, we have to nix out its
8952 ;; previous entry in the thread hashtb.
8954 (gnus-summary-article-sparse-p (mail-header-number header)))
8955 (let* ((parent (gnus-parent-id (mail-header-references header)))
8956 (thread (and parent (gnus-id-to-thread parent))))
8958 (delq (assq header thread) thread))))
8959 ;; We have to really fetch the header to this article.
8961 (set-buffer nntp-server-buffer)
8962 (when (setq where (gnus-request-head id group))
8963 (nnheader-fold-continuation-lines)
8964 (goto-char (point-max))
8966 (goto-char (point-min))
8970 ((cdr where) (cdr where))
8971 (header (mail-header-number header))
8972 (t gnus-reffed-article-number))
8974 (insert " Article retrieved.\n"))
8976 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8977 () ; Malformed head.
8978 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8979 (when (and (stringp id)
8980 (not (string= (gnus-group-real-name group)
8982 ;; If we fetched by Message-ID and the article came
8983 ;; from a different group, we fudge some bogus article
8984 ;; numbers for this article.
8985 (mail-header-set-number header gnus-reffed-article-number))
8987 (set-buffer gnus-summary-buffer)
8988 (decf gnus-reffed-article-number)
8989 (gnus-remove-header (mail-header-number header))
8990 (push header gnus-newsgroup-headers)
8991 (setq gnus-current-headers header)
8992 (push (mail-header-number header) gnus-newsgroup-limit)))
8995 (defun gnus-remove-header (number)
8996 "Remove header NUMBER from `gnus-newsgroup-headers'."
8997 (if (and gnus-newsgroup-headers
8998 (= number (mail-header-number (car gnus-newsgroup-headers))))
8999 (pop gnus-newsgroup-headers)
9000 (let ((headers gnus-newsgroup-headers))
9001 (while (and (cdr headers)
9002 (not (= number (mail-header-number (cadr headers)))))
9005 (setcdr headers (cddr headers))))))
9008 ;;; summary highlights
9011 (defun gnus-highlight-selected-summary ()
9012 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9013 ;; Highlight selected article in summary buffer
9014 (when gnus-summary-selected-face
9016 (let* ((beg (progn (beginning-of-line) (point)))
9017 (end (progn (end-of-line) (point)))
9018 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9019 (from (if (get-text-property beg gnus-mouse-face-prop)
9021 (or (next-single-property-change
9022 beg gnus-mouse-face-prop nil end)
9027 (or (next-single-property-change
9028 from gnus-mouse-face-prop nil end)
9030 ;; If no mouse-face prop on line we will have to = from = end,
9031 ;; so we highlight the entire line instead.
9032 (when (= (+ to 2) from)
9035 (if gnus-newsgroup-selected-overlay
9036 ;; Move old overlay.
9038 gnus-newsgroup-selected-overlay from to (current-buffer))
9039 ;; Create new overlay.
9041 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9042 'face gnus-summary-selected-face))))))
9044 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9045 (defun gnus-summary-highlight-line ()
9046 "Highlight current line according to `gnus-summary-highlight'."
9047 (let* ((list gnus-summary-highlight)
9049 (end (progn (end-of-line) (point)))
9050 ;; now find out where the line starts and leave point there.
9051 (beg (progn (beginning-of-line) (point)))
9052 (article (gnus-summary-article-number))
9053 (score (or (cdr (assq (or article gnus-current-article)
9054 gnus-newsgroup-scored))
9055 gnus-summary-default-score 0))
9056 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9057 (inhibit-read-only t))
9058 ;; Eval the cars of the lists until we find a match.
9059 (let ((default gnus-summary-default-score))
9061 (not (eval (caar list))))
9062 (setq list (cdr list))))
9063 (let ((face (cdar list)))
9064 (unless (eq face (get-text-property beg 'face))
9065 (gnus-put-text-property-excluding-characters-with-faces
9067 (setq face (if (boundp face) (symbol-value face) face)))
9068 (when gnus-summary-highlight-line-function
9069 (funcall gnus-summary-highlight-line-function article face))))
9072 (defun gnus-update-read-articles (group unread &optional compute)
9073 "Update the list of read articles in GROUP."
9074 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9075 (entry (gnus-gethash group gnus-newsrc-hashtb))
9076 (info (nth 2 entry))
9078 (unread (sort (copy-sequence unread) '<))
9080 (if (or (not info) (not active))
9081 ;; There is no info on this group if it was, in fact,
9082 ;; killed. Gnus stores no information on killed groups, so
9083 ;; there's nothing to be done.
9084 ;; One could store the information somewhere temporarily,
9085 ;; perhaps... Hmmm...
9087 ;; Remove any negative articles numbers.
9088 (while (and unread (< (car unread) 0))
9089 (setq unread (cdr unread)))
9090 ;; Remove any expired article numbers
9091 (while (and unread (< (car unread) (car active)))
9092 (setq unread (cdr unread)))
9093 ;; Compute the ranges of read articles by looking at the list of
9096 (when (/= (car unread) prev)
9097 (push (if (= prev (1- (car unread))) prev
9098 (cons prev (1- (car unread))))
9100 (setq prev (1+ (car unread)))
9101 (setq unread (cdr unread)))
9102 (when (<= prev (cdr active))
9103 (push (cons prev (cdr active)) read))
9104 (setq read (if (> (length read) 1) (nreverse read) read))
9108 (set-buffer gnus-group-buffer)
9111 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9112 (gnus-info-set-read ',info ',(gnus-info-read info))
9113 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9114 (gnus-group-update-group ,group t))))
9115 ;; Propagate the read marks to the backend.
9116 (if (gnus-check-backend-function 'request-set-mark group)
9117 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9118 (add (gnus-remove-from-range read (gnus-info-read info))))
9120 (gnus-request-set-mark
9121 group (delq nil (list (if add (list add 'add '(read)))
9122 (if del (list del 'del '(read)))))))))
9123 ;; Enter this list into the group info.
9124 (gnus-info-set-read info read)
9125 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9126 (gnus-get-unread-articles-in-group info (gnus-active group))
9129 (defun gnus-offer-save-summaries ()
9130 "Offer to save all active summary buffers."
9132 (let ((buflist (buffer-list))
9134 ;; Go through all buffers and find all summaries.
9136 (and (setq bufname (buffer-name (car buflist)))
9137 (string-match "Summary" bufname)
9139 (set-buffer bufname)
9140 ;; We check that this is, indeed, a summary buffer.
9141 (and (eq major-mode 'gnus-summary-mode)
9142 ;; Also make sure this isn't bogus.
9143 gnus-newsgroup-prepared
9144 ;; Also make sure that this isn't a dead summary buffer.
9145 (not gnus-dead-summary-mode)))
9146 (push bufname buffers))
9147 (setq buflist (cdr buflist)))
9148 ;; Go through all these summary buffers and offer to save them.
9151 "Update summary buffer %s? "
9153 (switch-to-buffer buf)
9154 (gnus-summary-exit))
9158 ;;; @ for mime-partial
9161 (defun gnus-request-partial-message ()
9163 (let ((number (gnus-summary-article-number))
9164 (group gnus-newsgroup-name)
9165 (mother gnus-article-buffer))
9166 (set-buffer (get-buffer-create " *Partial Article*"))
9168 (setq mime-preview-buffer mother)
9169 (gnus-request-article-this-buffer number group)
9173 (autoload 'mime-combine-message/partial-pieces-automatically
9175 "Internal method to combine message/partial messages automatically.")
9178 'action '((type . message)(subtype . partial)
9179 (major-mode . gnus-original-article-mode)
9180 (method . mime-combine-message/partial-pieces-automatically)
9181 (summary-buffer-exp . gnus-summary-buffer)
9182 (request-partial-message-method . gnus-request-partial-message)
9186 ;;; @ for message/rfc822
9189 (defun gnus-mime-extract-message/rfc822 (entity situation)
9190 (let (group article num cwin swin cur)
9191 (with-current-buffer (mime-entity-buffer entity)
9193 (narrow-to-region (mime-entity-body-start entity)
9194 (mime-entity-body-end entity))
9195 (setq group (or (cdr (assq 'group situation))
9196 (completing-read "Group: "
9199 (gnus-read-active-file-p)
9200 gnus-newsgroup-name))
9201 article (gnus-request-accept-article group)
9204 (when (and (consp article)
9205 (numberp (setq article (cdr article))))
9206 (setq num (1+ (or (cdr (assq 'number situation)) 0))
9207 cwin (get-buffer-window (current-buffer) t)
9209 (save-window-excursion
9210 (if (setq swin (get-buffer-window gnus-summary-buffer t))
9211 (select-window swin)
9212 (set-buffer gnus-summary-buffer)
9214 (setq cur gnus-current-article)
9216 (let (gnus-show-threads)
9217 (gnus-summary-goto-subject article t)
9219 (gnus-summary-clear-mark-forward 1)
9220 (gnus-summary-goto-subject cur)
9222 (when (and cwin (window-frame cwin))
9223 (select-frame (window-frame cwin))
9225 (when (boundp 'mime-acting-situation-to-override)
9226 (set-alist 'mime-acting-situation-to-override
9229 (set-alist 'mime-acting-situation-to-override
9232 (save-current-buffer
9233 (set-buffer gnus-group-buffer)
9234 (gnus-activate-group ,group)
9236 (gnus-summary-goto-article ,cur
9237 gnus-show-all-headers)
9239 (set-alist 'mime-acting-situation-to-override
9245 'action '((type . message)(subtype . rfc822)
9246 (major-mode . gnus-original-article-mode)
9247 (method . gnus-mime-extract-message/rfc822)
9252 'action '((type . message)(subtype . news)
9253 (major-mode . gnus-original-article-mode)
9254 (method . gnus-mime-extract-message/rfc822)
9258 (defun gnus-mime-extract-multipart (entity situation)
9259 (let ((children (mime-entity-children entity))
9260 mime-acting-situation-to-override
9263 (mime-play-entity (car children)
9264 (cons (assq 'mode situation)
9265 mime-acting-situation-to-override))
9266 (setq children (cdr children)))
9267 (if (setq f (cdr (assq 'after-method
9268 mime-acting-situation-to-override)))
9273 'action '((type . multipart)
9274 (method . gnus-mime-extract-multipart)
9283 (defun gnus-summary-setup-default-charset ()
9284 "Setup newsgroup default charset."
9285 (let ((name (and gnus-newsgroup-name
9286 (gnus-group-real-name gnus-newsgroup-name))))
9287 (setq gnus-newsgroup-charset
9288 (or (and gnus-newsgroup-name
9289 (or (gnus-group-find-parameter gnus-newsgroup-name
9291 (let ((alist gnus-group-charset-alist)
9293 (while (setq elem (pop alist))
9295 (string-match (car elem) name))
9297 charset (cadr elem))))
9299 gnus-default-charset))))
9305 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9306 "Display the current article buffer fully MIME-buttonized.
9307 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9308 treated as multipart/mixed."
9311 (let ((gnus-unbuttonized-mime-types nil)
9312 (gnus-mime-display-multipart-as-mixed show-all-parts))
9313 (gnus-summary-show-article)))
9315 (defun gnus-summary-repair-multipart (article)
9316 "Add a Content-Type header to a multipart article without one."
9317 (interactive (list (gnus-summary-article-number)))
9318 (gnus-with-article article
9319 (message-narrow-to-head)
9320 (goto-char (point-max))
9322 (when (search-forward "\n--" nil t)
9323 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9324 (message-narrow-to-head)
9325 (message-remove-header "Mime-Version")
9326 (message-remove-header "Content-Type")
9327 (goto-char (point-max))
9328 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9330 (insert "Mime-Version: 1.0\n")
9332 (let (gnus-mark-article-hook)
9333 (gnus-summary-select-article t t nil article)))
9335 (defun gnus-summary-toggle-display-buttonized ()
9336 "Toggle the buttonizing of the article buffer."
9339 (if (setq gnus-inhibit-mime-unbuttonizing
9340 (not gnus-inhibit-mime-unbuttonizing))
9341 (let ((gnus-unbuttonized-mime-types nil))
9342 (gnus-summary-show-article))
9343 (gnus-summary-show-article)))
9349 (run-hooks 'gnus-sum-load-hook)
9351 ;;; gnus-sum.el ends here