1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
40 ;; Avoid byte-compile warnings.
42 (defvar gnus-article-decoded-p)
43 (defvar gnus-decode-encoded-word-function)
46 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
47 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
49 (defcustom gnus-kill-summary-on-exit t
50 "*If non-nil, kill the summary buffer when you exit from it.
51 If nil, the summary will become a \"*Dead Summary*\" buffer, and
52 it will be killed sometime later."
53 :group 'gnus-summary-exit
56 (defcustom gnus-fetch-old-headers nil
57 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
58 If an unread article in the group refers to an older, already read (or
59 just marked as read) article, the old article will not normally be
60 displayed in the Summary buffer. If this variable is non-nil, Gnus
61 will attempt to grab the headers to the old articles, and thereby
62 build complete threads. If it has the value `some', only enough
63 headers to connect otherwise loose threads will be displayed. This
64 variable can also be a number. In that case, no more than that number
65 of old headers will be fetched. If it has the value `invisible', all
66 old headers will be fetched, but none will be displayed.
68 The server has to support NOV for any of this to work."
70 :type '(choice (const :tag "off" nil)
73 (sexp :menu-tag "other" t)))
75 (defcustom gnus-refer-thread-limit 200
76 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
77 If t, fetch all the available old headers."
80 (sexp :menu-tag "other" t)))
82 (defcustom gnus-summary-make-false-root 'adopt
83 "*nil means that Gnus won't gather loose threads.
84 If the root of a thread has expired or been read in a previous
85 session, the information necessary to build a complete thread has been
86 lost. Instead of having many small sub-threads from this original thread
87 scattered all over the summary buffer, Gnus can gather them.
89 If non-nil, Gnus will try to gather all loose sub-threads from an
90 original thread into one large thread.
92 If this variable is non-nil, it should be one of `none', `adopt',
95 If this variable is `none', Gnus will not make a false root, but just
96 present the sub-threads after another.
97 If this variable is `dummy', Gnus will create a dummy root that will
98 have all the sub-threads as children.
99 If this variable is `adopt', Gnus will make one of the \"children\"
100 the parent and mark all the step-children as such.
101 If this variable is `empty', the \"children\" are printed with empty
102 subject fields. (Or rather, they will be printed with a string
103 given by the `gnus-summary-same-subject' variable.)"
105 :type '(choice (const :tag "off" nil)
111 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
112 "*A regexp to match subjects to be excluded from loose thread gathering.
113 As loose thread gathering is done on subjects only, that means that
114 there can be many false gatherings performed. By rooting out certain
115 common subjects, gathering might become saner."
119 (defcustom gnus-summary-gather-subject-limit nil
120 "*Maximum length of subject comparisons when gathering loose threads.
121 Use nil to compare full subjects. Setting this variable to a low
122 number will help gather threads that have been corrupted by
123 newsreaders chopping off subject lines, but it might also mean that
124 unrelated articles that have subject that happen to begin with the
125 same few characters will be incorrectly gathered.
127 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
130 :type '(choice (const :tag "off" nil)
132 (sexp :menu-tag "on" t)))
134 (defcustom gnus-simplify-subject-functions nil
135 "List of functions taking a string argument that simplify subjects.
136 The functions are applied recursively.
138 Useful functions to put in this list include: `gnus-simplify-subject-re',
139 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
141 :type '(repeat function))
143 (defcustom gnus-simplify-ignored-prefixes nil
144 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
146 :type '(choice (const :tag "off" nil)
149 (defcustom gnus-build-sparse-threads nil
150 "*If non-nil, fill in the gaps in threads.
151 If `some', only fill in the gaps that are needed to tie loose threads
152 together. If `more', fill in all leaf nodes that Gnus can find. If
153 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
155 :type '(choice (const :tag "off" nil)
158 (sexp :menu-tag "all" t)))
160 (defcustom gnus-summary-thread-gathering-function
161 'gnus-gather-threads-by-subject
162 "*Function used for gathering loose threads.
163 There are two pre-defined functions: `gnus-gather-threads-by-subject',
164 which only takes Subjects into consideration; and
165 `gnus-gather-threads-by-references', which compared the References
166 headers of the articles to find matches."
168 :type '(radio (function-item gnus-gather-threads-by-subject)
169 (function-item gnus-gather-threads-by-references)
170 (function :tag "other")))
172 (defcustom gnus-summary-same-subject ""
173 "*String indicating that the current article has the same subject as the previous.
174 This variable will only be used if the value of
175 `gnus-summary-make-false-root' is `empty'."
176 :group 'gnus-summary-format
179 (defcustom gnus-summary-goto-unread t
180 "*If t, marking commands will go to the next unread article.
181 If `never', commands that usually go to the next unread article, will
182 go to the next article, whether it is read or not.
183 If nil, only the marking commands will go to the next (un)read article."
184 :group 'gnus-summary-marks
185 :link '(custom-manual "(gnus)Setting Marks")
186 :type '(choice (const :tag "off" nil)
188 (sexp :menu-tag "on" t)))
190 (defcustom gnus-summary-default-score 0
191 "*Default article score level.
192 All scores generated by the score files will be added to this score.
193 If this variable is nil, scoring will be disabled."
194 :group 'gnus-score-default
195 :type '(choice (const :tag "disable")
198 (defcustom gnus-summary-zcore-fuzz 0
199 "*Fuzziness factor for the zcore in the summary buffer.
200 Articles with scores closer than this to `gnus-summary-default-score'
202 :group 'gnus-summary-format
205 (defcustom gnus-simplify-subject-fuzzy-regexp nil
206 "*Strings to be removed when doing fuzzy matches.
207 This can either be a regular expression or list of regular expressions
208 that will be removed from subject strings if fuzzy subject
209 simplification is selected."
211 :type '(repeat regexp))
213 (defcustom gnus-show-threads t
214 "*If non-nil, display threads in summary mode."
218 (defcustom gnus-thread-hide-subtree nil
219 "*If non-nil, hide all threads initially.
220 If threads are hidden, you have to run the command
221 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
222 to expose hidden threads."
226 (defcustom gnus-thread-hide-killed t
227 "*If non-nil, hide killed threads automatically."
231 (defcustom gnus-thread-ignore-subject t
232 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
233 If nil, articles that have different subjects from their parents will
234 start separate threads."
238 (defcustom gnus-thread-operation-ignore-subject t
239 "*If non-nil, subjects will be ignored when doing thread commands.
240 This affects commands like `gnus-summary-kill-thread' and
241 `gnus-summary-lower-thread'.
243 If this variable is nil, articles in the same thread with different
244 subjects will not be included in the operation in question. If this
245 variable is `fuzzy', only articles that have subjects that are fuzzily
246 equal will be included."
248 :type '(choice (const :tag "off" nil)
252 (defcustom gnus-thread-indent-level 4
253 "*Number that says how much each sub-thread should be indented."
257 (defcustom gnus-auto-extend-newsgroup t
258 "*If non-nil, extend newsgroup forward and backward when requested."
259 :group 'gnus-summary-choose
262 (defcustom gnus-auto-select-first t
263 "*If nil, don't select the first unread article when entering a group.
264 If this variable is `best', select the highest-scored unread article
265 in the group. If t, select the first unread article.
267 This variable can also be a function to place point on a likely
268 subject line. Useful values include `gnus-summary-first-unread-subject',
269 `gnus-summary-first-unread-article' and
270 `gnus-summary-best-unread-article'.
272 If you want to prevent automatic selection of the first unread article
273 in some newsgroups, set the variable to nil in
274 `gnus-select-group-hook'."
275 :group 'gnus-group-select
276 :type '(choice (const :tag "none" nil)
278 (sexp :menu-tag "first" t)
279 (function-item gnus-summary-first-unread-subject)
280 (function-item gnus-summary-first-unread-article)
281 (function-item gnus-summary-best-unread-article)))
283 (defcustom gnus-auto-select-next t
284 "*If non-nil, offer to go to the next group from the end of the previous.
285 If the value is t and the next newsgroup is empty, Gnus will exit
286 summary mode and go back to group mode. If the value is neither nil
287 nor t, Gnus will select the following unread newsgroup. In
288 particular, if the value is the symbol `quietly', the next unread
289 newsgroup will be selected without any confirmation, and if it is
290 `almost-quietly', the next group will be selected without any
291 confirmation if you are located on the last article in the group.
292 Finally, if this variable is `slightly-quietly', the `Z n' command
293 will go to the next group without confirmation."
294 :group 'gnus-summary-maneuvering
295 :type '(choice (const :tag "off" nil)
297 (const almost-quietly)
298 (const slightly-quietly)
299 (sexp :menu-tag "on" t)))
301 (defcustom gnus-auto-select-same nil
302 "*If non-nil, select the next article with the same subject.
303 If there are no more articles with the same subject, go to
304 the first unread article."
305 :group 'gnus-summary-maneuvering
308 (defcustom gnus-summary-check-current nil
309 "*If non-nil, consider the current article when moving.
310 The \"unread\" movement commands will stay on the same line if the
311 current article is unread."
312 :group 'gnus-summary-maneuvering
315 (defcustom gnus-auto-center-summary t
316 "*If non-nil, always center the current summary buffer.
317 In particular, if `vertical' do only vertical recentering. If non-nil
318 and non-`vertical', do both horizontal and vertical recentering."
319 :group 'gnus-summary-maneuvering
320 :type '(choice (const :tag "none" nil)
322 (integer :tag "height")
323 (sexp :menu-tag "both" t)))
325 (defcustom gnus-show-all-headers nil
326 "*If non-nil, don't hide any headers."
327 :group 'gnus-article-hiding
328 :group 'gnus-article-headers
331 (defcustom gnus-summary-ignore-duplicates nil
332 "*If non-nil, ignore articles with identical Message-ID headers."
336 (defcustom gnus-single-article-buffer t
337 "*If non-nil, display all articles in the same buffer.
338 If nil, each group will get its own article buffer."
339 :group 'gnus-article-various
342 (defcustom gnus-break-pages t
343 "*If non-nil, do page breaking on articles.
344 The page delimiter is specified by the `gnus-page-delimiter'
346 :group 'gnus-article-various
349 (defcustom gnus-show-mime t
350 "*If non-nil, do mime processing of articles.
351 The articles will simply be fed to the function given by
352 `gnus-article-display-method-for-mime'."
353 :group 'gnus-article-mime
356 (defcustom gnus-move-split-methods nil
357 "*Variable used to suggest where articles are to be moved to.
358 It uses the same syntax as the `gnus-split-methods' variable."
359 :group 'gnus-summary-mail
360 :type '(repeat (choice (list :value (fun) function)
361 (cons :value ("" "") regexp (repeat string))
364 (defcustom gnus-unread-mark ?
365 "*Mark used for unread articles."
366 :group 'gnus-summary-marks
369 (defcustom gnus-ticked-mark ?!
370 "*Mark used for ticked articles."
371 :group 'gnus-summary-marks
374 (defcustom gnus-dormant-mark ??
375 "*Mark used for dormant articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-del-mark ?r
380 "*Mark used for del'd articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-read-mark ?R
385 "*Mark used for read articles."
386 :group 'gnus-summary-marks
389 (defcustom gnus-expirable-mark ?E
390 "*Mark used for expirable articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-killed-mark ?K
395 "*Mark used for killed articles."
396 :group 'gnus-summary-marks
399 (defcustom gnus-souped-mark ?F
400 "*Mark used for killed articles."
401 :group 'gnus-summary-marks
404 (defcustom gnus-kill-file-mark ?X
405 "*Mark used for articles killed by kill files."
406 :group 'gnus-summary-marks
409 (defcustom gnus-low-score-mark ?Y
410 "*Mark used for articles with a low score."
411 :group 'gnus-summary-marks
414 (defcustom gnus-catchup-mark ?C
415 "*Mark used for articles that are caught up."
416 :group 'gnus-summary-marks
419 (defcustom gnus-replied-mark ?A
420 "*Mark used for articles that have been replied to."
421 :group 'gnus-summary-marks
424 (defcustom gnus-cached-mark ?*
425 "*Mark used for articles that are in the cache."
426 :group 'gnus-summary-marks
429 (defcustom gnus-saved-mark ?S
430 "*Mark used for articles that have been saved to."
431 :group 'gnus-summary-marks
434 (defcustom gnus-ancient-mark ?O
435 "*Mark used for ancient articles."
436 :group 'gnus-summary-marks
439 (defcustom gnus-sparse-mark ?Q
440 "*Mark used for sparsely reffed articles."
441 :group 'gnus-summary-marks
444 (defcustom gnus-canceled-mark ?G
445 "*Mark used for canceled articles."
446 :group 'gnus-summary-marks
449 (defcustom gnus-duplicate-mark ?M
450 "*Mark used for duplicate articles."
451 :group 'gnus-summary-marks
454 (defcustom gnus-undownloaded-mark ?@
455 "*Mark used for articles that weren't downloaded."
456 :group 'gnus-summary-marks
459 (defcustom gnus-downloadable-mark ?%
460 "*Mark used for articles that are to be downloaded."
461 :group 'gnus-summary-marks
464 (defcustom gnus-unsendable-mark ?=
465 "*Mark used for articles that won't be sent."
466 :group 'gnus-summary-marks
469 (defcustom gnus-score-over-mark ?+
470 "*Score mark used for articles with high scores."
471 :group 'gnus-summary-marks
474 (defcustom gnus-score-below-mark ?-
475 "*Score mark used for articles with low scores."
476 :group 'gnus-summary-marks
479 (defcustom gnus-empty-thread-mark ?
480 "*There is no thread under the article."
481 :group 'gnus-summary-marks
484 (defcustom gnus-not-empty-thread-mark ?=
485 "*There is a thread under the article."
486 :group 'gnus-summary-marks
489 (defcustom gnus-view-pseudo-asynchronously nil
490 "*If non-nil, Gnus will view pseudo-articles asynchronously."
491 :group 'gnus-extract-view
494 (defcustom gnus-auto-expirable-marks
495 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
496 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
497 gnus-souped-mark gnus-duplicate-mark)
498 "*The list of marks converted into expiration if a group is auto-expirable."
500 :type '(repeat character))
502 (defcustom gnus-inhibit-user-auto-expire t
503 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
507 (defcustom gnus-view-pseudos nil
508 "*If `automatic', pseudo-articles will be viewed automatically.
509 If `not-confirm', pseudos will be viewed automatically, and the user
510 will not be asked to confirm the command."
511 :group 'gnus-extract-view
512 :type '(choice (const :tag "off" nil)
514 (const not-confirm)))
516 (defcustom gnus-view-pseudos-separately t
517 "*If non-nil, one pseudo-article will be created for each file to be viewed.
518 If nil, all files that use the same viewing command will be given as a
519 list of parameters to that command."
520 :group 'gnus-extract-view
523 (defcustom gnus-insert-pseudo-articles t
524 "*If non-nil, insert pseudo-articles when decoding articles."
525 :group 'gnus-extract-view
528 (defcustom gnus-summary-dummy-line-format
530 "*The format specification for the dummy roots in the summary buffer.
531 It works along the same lines as a normal formatting string,
532 with some simple extensions.
535 :group 'gnus-threading
538 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
539 "*The format specification for the summary mode line.
540 It works along the same lines as a normal formatting string,
541 with some simple extensions:
544 %p Unprefixed group name
545 %A Current article number
546 %z Current article score
548 %U Number of unread articles in the group
549 %e Number of unselected articles in the group
550 %Z A string with unread/unselected article counts
551 %g Shortish group name
552 %S Subject of the current article
554 %s Current score file name
555 %d Number of dormant articles
556 %r Number of articles that have been marked as read in this session
557 %E Number of articles expunged by the score files"
558 :group 'gnus-summary-format
561 (defcustom gnus-summary-mark-below 0
562 "*Mark all articles with a score below this variable as read.
563 This variable is local to each summary buffer and usually set by the
565 :group 'gnus-score-default
568 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
569 "*List of functions used for sorting articles in the summary buffer.
570 This variable is only used when not using a threaded display."
571 :group 'gnus-summary-sort
572 :type '(repeat (choice (function-item gnus-article-sort-by-number)
573 (function-item gnus-article-sort-by-author)
574 (function-item gnus-article-sort-by-subject)
575 (function-item gnus-article-sort-by-date)
576 (function-item gnus-article-sort-by-score)
577 (function :tag "other"))))
579 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
580 "*List of functions used for sorting threads in the summary buffer.
581 By default, threads are sorted by article number.
583 Each function takes two threads and return non-nil if the first thread
584 should be sorted before the other. If you use more than one function,
585 the primary sort function should be the last. You should probably
586 always include `gnus-thread-sort-by-number' in the list of sorting
587 functions -- preferably first.
589 Ready-made functions include `gnus-thread-sort-by-number',
590 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
591 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
592 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
593 :group 'gnus-summary-sort
594 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
595 (function-item gnus-thread-sort-by-author)
596 (function-item gnus-thread-sort-by-subject)
597 (function-item gnus-thread-sort-by-date)
598 (function-item gnus-thread-sort-by-score)
599 (function-item gnus-thread-sort-by-total-score)
600 (function :tag "other"))))
602 (defcustom gnus-thread-score-function '+
603 "*Function used for calculating the total score of a thread.
605 The function is called with the scores of the article and each
606 subthread and should then return the score of the thread.
608 Some functions you can use are `+', `max', or `min'."
609 :group 'gnus-summary-sort
612 (defcustom gnus-summary-expunge-below nil
613 "All articles that have a score less than this variable will be expunged.
614 This variable is local to the summary buffers."
615 :group 'gnus-score-default
616 :type '(choice (const :tag "off" nil)
619 (defcustom gnus-thread-expunge-below nil
620 "All threads that have a total score less than this variable will be expunged.
621 See `gnus-thread-score-function' for en explanation of what a
624 This variable is local to the summary buffers."
625 :group 'gnus-treading
626 :group 'gnus-score-default
627 :type '(choice (const :tag "off" nil)
630 (defcustom gnus-summary-mode-hook nil
631 "*A hook for Gnus summary mode.
632 This hook is run before any variables are set in the summary buffer."
633 :group 'gnus-summary-various
636 (defcustom gnus-summary-menu-hook nil
637 "*Hook run after the creation of the summary mode menu."
638 :group 'gnus-summary-visual
641 (defcustom gnus-summary-exit-hook nil
642 "*A hook called on exit from the summary buffer.
643 It will be called with point in the group buffer."
644 :group 'gnus-summary-exit
647 (defcustom gnus-summary-prepare-hook nil
648 "*A hook called after the summary buffer has been generated.
649 If you want to modify the summary buffer, you can use this hook."
650 :group 'gnus-summary-various
653 (defcustom gnus-summary-prepared-hook nil
654 "*A hook called as the last thing after the summary buffer has been generated."
655 :group 'gnus-summary-various
658 (defcustom gnus-summary-generate-hook nil
659 "*A hook run just before generating the summary buffer.
660 This hook is commonly used to customize threading variables and the
662 :group 'gnus-summary-various
665 (defcustom gnus-select-group-hook nil
666 "*A hook called when a newsgroup is selected.
668 If you'd like to simplify subjects like the
669 `gnus-summary-next-same-subject' command does, you can use the
672 (setq gnus-select-group-hook
675 (mapcar (lambda (header)
676 (mail-header-set-subject
678 (gnus-simplify-subject
679 (mail-header-subject header) 're-only)))
680 gnus-newsgroup-headers))))"
681 :group 'gnus-group-select
684 (defcustom gnus-select-article-hook nil
685 "*A hook called when an article is selected."
686 :group 'gnus-summary-choose
689 (defcustom gnus-visual-mark-article-hook
690 (list 'gnus-highlight-selected-summary)
691 "*Hook run after selecting an article in the summary buffer.
692 It is meant to be used for highlighting the article in some way. It
693 is not run if `gnus-visual' is nil."
694 :group 'gnus-summary-visual
697 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
698 "*A hook called before parsing the headers."
702 (defcustom gnus-exit-group-hook nil
703 "*A hook called when exiting (not quitting) summary mode."
707 (defcustom gnus-summary-update-hook
708 (list 'gnus-summary-highlight-line)
709 "*A hook called when a summary line is changed.
710 The hook will not be called if `gnus-visual' is nil.
712 The default function `gnus-summary-highlight-line' will
713 highlight the line according to the `gnus-summary-highlight'
715 :group 'gnus-summary-visual
718 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
719 "*A hook called when an article is selected for the first time.
720 The hook is intended to mark an article as read (or unread)
721 automatically when it is selected."
722 :group 'gnus-summary-choose
725 (defcustom gnus-group-no-more-groups-hook nil
726 "*A hook run when returning to group mode having no more (unread) groups."
727 :group 'gnus-group-select
730 (defcustom gnus-ps-print-hook nil
731 "*A hook run before ps-printing something from Gnus."
735 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
736 "Face used for highlighting the current article in the summary buffer."
737 :group 'gnus-summary-visual
740 (defcustom gnus-summary-highlight
741 '(((= mark gnus-canceled-mark)
742 . gnus-summary-cancelled-face)
743 ((and (> score default)
744 (or (= mark gnus-dormant-mark)
745 (= mark gnus-ticked-mark)))
746 . gnus-summary-high-ticked-face)
747 ((and (< score default)
748 (or (= mark gnus-dormant-mark)
749 (= mark gnus-ticked-mark)))
750 . gnus-summary-low-ticked-face)
751 ((or (= mark gnus-dormant-mark)
752 (= mark gnus-ticked-mark))
753 . gnus-summary-normal-ticked-face)
754 ((and (> score default) (= mark gnus-ancient-mark))
755 . gnus-summary-high-ancient-face)
756 ((and (< score default) (= mark gnus-ancient-mark))
757 . gnus-summary-low-ancient-face)
758 ((= mark gnus-ancient-mark)
759 . gnus-summary-normal-ancient-face)
760 ((and (> score default) (= mark gnus-unread-mark))
761 . gnus-summary-high-unread-face)
762 ((and (< score default) (= mark gnus-unread-mark))
763 . gnus-summary-low-unread-face)
764 ((= mark gnus-unread-mark)
765 . gnus-summary-normal-unread-face)
766 ((and (> score default) (memq mark (list gnus-downloadable-mark
767 gnus-undownloaded-mark)))
768 . gnus-summary-high-unread-face)
769 ((and (< score default) (memq mark (list gnus-downloadable-mark
770 gnus-undownloaded-mark)))
771 . gnus-summary-low-unread-face)
772 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
773 . gnus-summary-normal-unread-face)
775 . gnus-summary-high-read-face)
777 . gnus-summary-low-read-face)
779 . gnus-summary-normal-read-face))
780 "*Controls the highlighting of summary buffer lines.
782 A list of (FORM . FACE) pairs. When deciding how a a particular
783 summary line should be displayed, each form is evaluated. The content
784 of the face field after the first true form is used. You can change
785 how those summary lines are displayed, by editing the face field.
787 You can use the following variables in the FORM field.
789 score: The articles score
790 default: The default article score.
791 below: The score below which articles are automatically marked as read.
792 mark: The articles mark."
793 :group 'gnus-summary-visual
794 :type '(repeat (cons (sexp :tag "Form" nil)
797 (defcustom gnus-alter-header-function nil
798 "Function called to allow alteration of article header structures.
799 The function is called with one parameter, the article header vector,
800 which it may alter in any way.")
802 (defcustom gnus-extra-headers nil
803 "*Extra headers to parse."
805 :type '(repeat symbol))
807 (defcustom gnus-ignored-from-addresses
808 (and user-mail-address (regexp-quote user-mail-address))
809 "*Regexp of From headers that may be suppressed in favor of To headers."
813 (defcustom gnus-default-charset 'iso-8859-1
814 "Default charset assumed to be used when viewing non-ASCII characters.
815 This variable is used only in non-Mule Emacsen.")
817 (defcustom gnus-newsgroup-default-charset-alist
818 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" . cn-big5)
819 ("^cn\\>\\|\\<chinese\\>" . cn-gb-2312)
820 ("^fj\\>\\|^japan\\>" . iso-2022-jp-2)
821 ("^relcom\\>" . koi8-r))
822 "Alist of Regexps (to match group names) and default charsets to be applied."
823 :type '(repeat (cons (regexp :tag "Group")
824 (symbol :tag "Charset")))
827 (defcustom gnus-newsgroup-iso-8859-1-forced-regexp
828 "^tw\\>\\|^hk\\>\\|^cn\\>\\|\\<chinese\\>"
829 "Regexp of newsgroup in which ISO-8859-1 is forced to other charset."
833 ;;; Internal variables
835 (defvar gnus-scores-exclude-files nil)
836 (defvar gnus-page-broken nil)
837 (defvar gnus-inhibit-mime-unbuttonizing nil)
839 (defvar gnus-original-article nil)
840 (defvar gnus-article-internal-prepare-hook nil)
841 (defvar gnus-newsgroup-process-stack nil)
843 (defvar gnus-thread-indent-array nil)
844 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
846 ;; Avoid highlighting in kill files.
847 (defvar gnus-summary-inhibit-highlight nil)
848 (defvar gnus-newsgroup-selected-overlay nil)
849 (defvar gnus-inhibit-limiting nil)
850 (defvar gnus-newsgroup-adaptive-score-file nil)
851 (defvar gnus-current-score-file nil)
852 (defvar gnus-current-move-group nil)
853 (defvar gnus-current-copy-group nil)
854 (defvar gnus-current-crosspost-group nil)
856 (defvar gnus-newsgroup-dependencies nil)
857 (defvar gnus-newsgroup-adaptive nil)
858 (defvar gnus-summary-display-article-function nil)
859 (defvar gnus-summary-highlight-line-function nil
860 "Function called after highlighting a summary line.")
862 (defvar gnus-summary-line-format-alist
863 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
864 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
865 (?s gnus-tmp-subject-or-nil ?s)
866 (?n gnus-tmp-name ?s)
867 (?A (std11-address-string
868 (car (mime-read-field 'From gnus-tmp-header))) ?s)
869 (?a (or (std11-full-name-string
870 (car (mime-read-field 'From gnus-tmp-header)))
872 (?F gnus-tmp-from ?s)
873 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
874 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
875 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
876 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
877 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
878 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
879 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
880 (?L gnus-tmp-lines ?d)
881 (?I gnus-tmp-indentation ?s)
882 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
883 (?R gnus-tmp-replied ?c)
884 (?\[ gnus-tmp-opening-bracket ?c)
885 (?\] gnus-tmp-closing-bracket ?c)
886 (?\> (make-string gnus-tmp-level ? ) ?s)
887 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
888 (?i gnus-tmp-score ?d)
889 (?z gnus-tmp-score-char ?c)
890 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
891 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
892 (?U gnus-tmp-unread ?c)
893 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
894 (?t (gnus-summary-number-of-articles-in-thread
895 (and (boundp 'thread) (car thread)) gnus-tmp-level)
897 (?e (gnus-summary-number-of-articles-in-thread
898 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
900 (?u gnus-tmp-user-defined ?s)
901 (?P (gnus-pick-line-number) ?d))
902 "An alist of format specifications that can appear in summary lines,
903 and what variables they correspond with, along with the type of the
904 variable (string, integer, character, etc).")
906 (defvar gnus-summary-dummy-line-format-alist
907 `((?S gnus-tmp-subject ?s)
908 (?N gnus-tmp-number ?d)
909 (?u gnus-tmp-user-defined ?s)))
911 (defvar gnus-summary-mode-line-format-alist
912 `((?G gnus-tmp-group-name ?s)
913 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
914 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
915 (?A gnus-tmp-article-number ?d)
916 (?Z gnus-tmp-unread-and-unselected ?s)
918 (?U gnus-tmp-unread-and-unticked ?d)
919 (?S gnus-tmp-subject ?s)
920 (?e gnus-tmp-unselected ?d)
921 (?u gnus-tmp-user-defined ?s)
922 (?d (length gnus-newsgroup-dormant) ?d)
923 (?t (length gnus-newsgroup-marked) ?d)
924 (?r (length gnus-newsgroup-reads) ?d)
925 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
926 (?E gnus-newsgroup-expunged-tally ?d)
927 (?s (gnus-current-score-file-nondirectory) ?s)))
929 (defvar gnus-last-search-regexp nil
930 "Default regexp for article search command.")
932 (defvar gnus-last-shell-command nil
933 "Default shell command on article.")
935 (defvar gnus-newsgroup-begin nil)
936 (defvar gnus-newsgroup-end nil)
937 (defvar gnus-newsgroup-last-rmail nil)
938 (defvar gnus-newsgroup-last-mail nil)
939 (defvar gnus-newsgroup-last-folder nil)
940 (defvar gnus-newsgroup-last-file nil)
941 (defvar gnus-newsgroup-auto-expire nil)
942 (defvar gnus-newsgroup-active nil)
944 (defvar gnus-newsgroup-data nil)
945 (defvar gnus-newsgroup-data-reverse nil)
946 (defvar gnus-newsgroup-limit nil)
947 (defvar gnus-newsgroup-limits nil)
949 (defvar gnus-newsgroup-unreads nil
950 "List of unread articles in the current newsgroup.")
952 (defvar gnus-newsgroup-unselected nil
953 "List of unselected unread articles in the current newsgroup.")
955 (defvar gnus-newsgroup-reads nil
956 "Alist of read articles and article marks in the current newsgroup.")
958 (defvar gnus-newsgroup-expunged-tally nil)
960 (defvar gnus-newsgroup-marked nil
961 "List of ticked articles in the current newsgroup (a subset of unread art).")
963 (defvar gnus-newsgroup-killed nil
964 "List of ranges of articles that have been through the scoring process.")
966 (defvar gnus-newsgroup-cached nil
967 "List of articles that come from the article cache.")
969 (defvar gnus-newsgroup-saved nil
970 "List of articles that have been saved.")
972 (defvar gnus-newsgroup-kill-headers nil)
974 (defvar gnus-newsgroup-replied nil
975 "List of articles that have been replied to in the current newsgroup.")
977 (defvar gnus-newsgroup-expirable nil
978 "List of articles in the current newsgroup that can be expired.")
980 (defvar gnus-newsgroup-processable nil
981 "List of articles in the current newsgroup that can be processed.")
983 (defvar gnus-newsgroup-downloadable nil
984 "List of articles in the current newsgroup that can be processed.")
986 (defvar gnus-newsgroup-undownloaded nil
987 "List of articles in the current newsgroup that haven't been downloaded..")
989 (defvar gnus-newsgroup-unsendable nil
990 "List of articles in the current newsgroup that won't be sent.")
992 (defvar gnus-newsgroup-bookmarks nil
993 "List of articles in the current newsgroup that have bookmarks.")
995 (defvar gnus-newsgroup-dormant nil
996 "List of dormant articles in the current newsgroup.")
998 (defvar gnus-newsgroup-scored nil
999 "List of scored articles in the current newsgroup.")
1001 (defvar gnus-newsgroup-headers nil
1002 "List of article headers in the current newsgroup.")
1004 (defvar gnus-newsgroup-threads nil)
1006 (defvar gnus-newsgroup-prepared nil
1007 "Whether the current group has been prepared properly.")
1009 (defvar gnus-newsgroup-ancient nil
1010 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1012 (defvar gnus-newsgroup-sparse nil)
1014 (defvar gnus-current-article nil)
1015 (defvar gnus-article-current nil)
1016 (defvar gnus-current-headers nil)
1017 (defvar gnus-have-all-headers nil)
1018 (defvar gnus-last-article nil)
1019 (defvar gnus-newsgroup-history nil)
1021 (defvar gnus-newsgroup-default-charset nil)
1022 (defvar gnus-newsgroup-iso-8859-1-forced nil)
1024 (defconst gnus-summary-local-variables
1025 '(gnus-newsgroup-name
1026 gnus-newsgroup-begin gnus-newsgroup-end
1027 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1028 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1029 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1030 gnus-newsgroup-unselected gnus-newsgroup-marked
1031 gnus-newsgroup-reads gnus-newsgroup-saved
1032 gnus-newsgroup-replied gnus-newsgroup-expirable
1033 gnus-newsgroup-processable gnus-newsgroup-killed
1034 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1035 gnus-newsgroup-unsendable
1036 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1037 gnus-newsgroup-headers gnus-newsgroup-threads
1038 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1039 gnus-current-article gnus-current-headers gnus-have-all-headers
1040 gnus-last-article gnus-article-internal-prepare-hook
1041 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1042 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1043 gnus-thread-expunge-below
1044 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1045 (gnus-summary-mark-below . global)
1046 gnus-newsgroup-active gnus-scores-exclude-files
1047 gnus-newsgroup-history gnus-newsgroup-ancient
1048 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1049 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1050 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1051 (gnus-newsgroup-expunged-tally . 0)
1052 gnus-cache-removable-articles gnus-newsgroup-cached
1053 gnus-newsgroup-data gnus-newsgroup-data-reverse
1054 gnus-newsgroup-limit gnus-newsgroup-limits
1055 gnus-newsgroup-default-charset gnus-newsgroup-iso-8859-1-forced)
1056 "Variables that are buffer-local to the summary buffers.")
1058 ;; Byte-compiler warning.
1059 (defvar gnus-article-mode-map)
1061 ;; Subject simplification.
1063 (defun gnus-simplify-whitespace (str)
1064 "Remove excessive whitespace."
1067 (while (string-match "[ \t][ \t]+" mystr)
1068 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1070 (substring mystr (match-end 0)))))
1072 (when (string-match "^[ \t]+" mystr)
1073 (setq mystr (substring mystr (match-end 0))))
1075 (when (string-match "[ \t]+$" mystr)
1076 (setq mystr (substring mystr 0 (match-beginning 0))))
1079 (defsubst gnus-simplify-subject-re (subject)
1080 "Remove \"Re:\" from subject lines."
1081 (if (string-match "^[Rr][Ee]: *" subject)
1082 (substring subject (match-end 0))
1085 (defun gnus-simplify-subject (subject &optional re-only)
1086 "Remove `Re:' and words in parentheses.
1087 If RE-ONLY is non-nil, strip leading `Re:'s only."
1088 (let ((case-fold-search t)) ;Ignore case.
1089 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1090 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1091 (setq subject (substring subject (match-end 0))))
1092 ;; Remove uninteresting prefixes.
1093 (when (and (not re-only)
1094 gnus-simplify-ignored-prefixes
1095 (string-match gnus-simplify-ignored-prefixes subject))
1096 (setq subject (substring subject (match-end 0))))
1097 ;; Remove words in parentheses from end.
1099 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1100 (setq subject (substring subject 0 (match-beginning 0)))))
1101 ;; Return subject string.
1104 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1106 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1107 (goto-char (point-min))
1108 (while (re-search-forward regexp nil t)
1109 (replace-match (or newtext ""))))
1111 (defun gnus-simplify-buffer-fuzzy ()
1112 "Simplify string in the buffer fuzzily.
1113 The string in the accessible portion of the current buffer is simplified.
1114 It is assumed to be a single-line subject.
1115 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1116 matter is removed. Additional things can be deleted by setting
1117 gnus-simplify-subject-fuzzy-regexp."
1118 (let ((case-fold-search t)
1120 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1122 (while (not (eq modified-tick (buffer-modified-tick)))
1123 (setq modified-tick (buffer-modified-tick))
1125 ((listp gnus-simplify-subject-fuzzy-regexp)
1126 (mapcar 'gnus-simplify-buffer-fuzzy-step
1127 gnus-simplify-subject-fuzzy-regexp))
1128 (gnus-simplify-subject-fuzzy-regexp
1129 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1130 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1131 (gnus-simplify-buffer-fuzzy-step
1132 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1133 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1135 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1136 (gnus-simplify-buffer-fuzzy-step " +" " ")
1137 (gnus-simplify-buffer-fuzzy-step " $")
1138 (gnus-simplify-buffer-fuzzy-step "^ +")))
1140 (defun gnus-simplify-subject-fuzzy (subject)
1141 "Simplify a subject string fuzzily.
1142 See `gnus-simplify-buffer-fuzzy' for details."
1144 (gnus-set-work-buffer)
1145 (let ((case-fold-search t))
1146 ;; Remove uninteresting prefixes.
1147 (when (and gnus-simplify-ignored-prefixes
1148 (string-match gnus-simplify-ignored-prefixes subject))
1149 (setq subject (substring subject (match-end 0))))
1151 (inline (gnus-simplify-buffer-fuzzy))
1154 (defsubst gnus-simplify-subject-fully (subject)
1155 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1157 (gnus-simplify-subject-functions
1158 (gnus-map-function gnus-simplify-subject-functions subject))
1159 ((null gnus-summary-gather-subject-limit)
1160 (gnus-simplify-subject-re subject))
1161 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1162 (gnus-simplify-subject-fuzzy subject))
1163 ((numberp gnus-summary-gather-subject-limit)
1164 (gnus-limit-string (gnus-simplify-subject-re subject)
1165 gnus-summary-gather-subject-limit))
1169 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1170 "Check whether two subjects are equal.
1171 If optional argument simple-first is t, first argument is already
1174 ((null simple-first)
1175 (equal (gnus-simplify-subject-fully s1)
1176 (gnus-simplify-subject-fully s2)))
1179 (gnus-simplify-subject-fully s2)))))
1181 (defun gnus-summary-bubble-group ()
1182 "Increase the score of the current group.
1183 This is a handy function to add to `gnus-summary-exit-hook' to
1184 increase the score of each group you read."
1185 (gnus-group-add-score gnus-newsgroup-name))
1189 ;;; Gnus summary mode
1192 (put 'gnus-summary-mode 'mode-class 'special)
1195 ;; Non-orthogonal keys
1197 (gnus-define-keys gnus-summary-mode-map
1198 " " gnus-summary-next-page
1199 "\177" gnus-summary-prev-page
1200 [delete] gnus-summary-prev-page
1201 [backspace] gnus-summary-prev-page
1202 "\r" gnus-summary-scroll-up
1203 "\M-\r" gnus-summary-scroll-down
1204 "n" gnus-summary-next-unread-article
1205 "p" gnus-summary-prev-unread-article
1206 "N" gnus-summary-next-article
1207 "P" gnus-summary-prev-article
1208 "\M-\C-n" gnus-summary-next-same-subject
1209 "\M-\C-p" gnus-summary-prev-same-subject
1210 "\M-n" gnus-summary-next-unread-subject
1211 "\M-p" gnus-summary-prev-unread-subject
1212 "." gnus-summary-first-unread-article
1213 "," gnus-summary-best-unread-article
1214 "\M-s" gnus-summary-search-article-forward
1215 "\M-r" gnus-summary-search-article-backward
1216 "<" gnus-summary-beginning-of-article
1217 ">" gnus-summary-end-of-article
1218 "j" gnus-summary-goto-article
1219 "^" gnus-summary-refer-parent-article
1220 "\M-^" gnus-summary-refer-article
1221 "u" gnus-summary-tick-article-forward
1222 "!" gnus-summary-tick-article-forward
1223 "U" gnus-summary-tick-article-backward
1224 "d" gnus-summary-mark-as-read-forward
1225 "D" gnus-summary-mark-as-read-backward
1226 "E" gnus-summary-mark-as-expirable
1227 "\M-u" gnus-summary-clear-mark-forward
1228 "\M-U" gnus-summary-clear-mark-backward
1229 "k" gnus-summary-kill-same-subject-and-select
1230 "\C-k" gnus-summary-kill-same-subject
1231 "\M-\C-k" gnus-summary-kill-thread
1232 "\M-\C-l" gnus-summary-lower-thread
1233 "e" gnus-summary-edit-article
1234 "#" gnus-summary-mark-as-processable
1235 "\M-#" gnus-summary-unmark-as-processable
1236 "\M-\C-t" gnus-summary-toggle-threads
1237 "\M-\C-s" gnus-summary-show-thread
1238 "\M-\C-h" gnus-summary-hide-thread
1239 "\M-\C-f" gnus-summary-next-thread
1240 "\M-\C-b" gnus-summary-prev-thread
1241 "\M-\C-u" gnus-summary-up-thread
1242 "\M-\C-d" gnus-summary-down-thread
1243 "&" gnus-summary-execute-command
1244 "c" gnus-summary-catchup-and-exit
1245 "\C-w" gnus-summary-mark-region-as-read
1246 "\C-t" gnus-summary-toggle-truncation
1247 "?" gnus-summary-mark-as-dormant
1248 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1249 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1250 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1251 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1252 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1253 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1254 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1255 "=" gnus-summary-expand-window
1256 "\C-x\C-s" gnus-summary-reselect-current-group
1257 "\M-g" gnus-summary-rescan-group
1258 "w" gnus-summary-stop-page-breaking
1259 "\C-c\C-r" gnus-summary-caesar-message
1260 "\M-t" gnus-summary-toggle-mime
1261 "f" gnus-summary-followup
1262 "F" gnus-summary-followup-with-original
1263 "C" gnus-summary-cancel-article
1264 "r" gnus-summary-reply
1265 "R" gnus-summary-reply-with-original
1266 "\C-c\C-f" gnus-summary-mail-forward
1267 "o" gnus-summary-save-article
1268 "\C-o" gnus-summary-save-article-mail
1269 "|" gnus-summary-pipe-output
1270 "\M-k" gnus-summary-edit-local-kill
1271 "\M-K" gnus-summary-edit-global-kill
1273 "\C-c\C-d" gnus-summary-describe-group
1274 "q" gnus-summary-exit
1275 "Q" gnus-summary-exit-no-update
1276 "\C-c\C-i" gnus-info-find-node
1277 gnus-mouse-2 gnus-mouse-pick-article
1278 "m" gnus-summary-mail-other-window
1279 "a" gnus-summary-post-news
1280 "x" gnus-summary-limit-to-unread
1281 "s" gnus-summary-isearch-article
1282 "t" gnus-article-hide-headers
1283 "g" gnus-summary-show-article
1284 "l" gnus-summary-goto-last-article
1285 "v" gnus-summary-preview-mime-message
1286 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1287 "\C-d" gnus-summary-enter-digest-group
1288 "\M-\C-d" gnus-summary-read-document
1289 "\M-\C-e" gnus-summary-edit-parameters
1290 "\M-\C-g" gnus-summary-customize-parameters
1292 "*" gnus-cache-enter-article
1293 "\M-*" gnus-cache-remove-article
1294 "\M-&" gnus-summary-universal-argument
1295 "\C-l" gnus-recenter
1296 "I" gnus-summary-increase-score
1297 "L" gnus-summary-lower-score
1298 "\M-i" gnus-symbolic-argument
1299 "h" gnus-summary-select-article-buffer
1301 "V" gnus-summary-score-map
1302 "X" gnus-uu-extract-map
1303 "S" gnus-summary-send-map)
1305 ;; Sort of orthogonal keymap
1306 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1307 "t" gnus-summary-tick-article-forward
1308 "!" gnus-summary-tick-article-forward
1309 "d" gnus-summary-mark-as-read-forward
1310 "r" gnus-summary-mark-as-read-forward
1311 "c" gnus-summary-clear-mark-forward
1312 " " gnus-summary-clear-mark-forward
1313 "e" gnus-summary-mark-as-expirable
1314 "x" gnus-summary-mark-as-expirable
1315 "?" gnus-summary-mark-as-dormant
1316 "b" gnus-summary-set-bookmark
1317 "B" gnus-summary-remove-bookmark
1318 "#" gnus-summary-mark-as-processable
1319 "\M-#" gnus-summary-unmark-as-processable
1320 "S" gnus-summary-limit-include-expunged
1321 "C" gnus-summary-catchup
1322 "H" gnus-summary-catchup-to-here
1323 "\C-c" gnus-summary-catchup-all
1324 "k" gnus-summary-kill-same-subject-and-select
1325 "K" gnus-summary-kill-same-subject
1326 "P" gnus-uu-mark-map)
1328 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1329 "c" gnus-summary-clear-above
1330 "u" gnus-summary-tick-above
1331 "m" gnus-summary-mark-above
1332 "k" gnus-summary-kill-below)
1334 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1335 "/" gnus-summary-limit-to-subject
1336 "n" gnus-summary-limit-to-articles
1337 "w" gnus-summary-pop-limit
1338 "s" gnus-summary-limit-to-subject
1339 "a" gnus-summary-limit-to-author
1340 "u" gnus-summary-limit-to-unread
1341 "m" gnus-summary-limit-to-marks
1342 "v" gnus-summary-limit-to-score
1343 "*" gnus-summary-limit-include-cached
1344 "D" gnus-summary-limit-include-dormant
1345 "T" gnus-summary-limit-include-thread
1346 "d" gnus-summary-limit-exclude-dormant
1347 "t" gnus-summary-limit-to-age
1348 "E" gnus-summary-limit-include-expunged
1349 "c" gnus-summary-limit-exclude-childless-dormant
1350 "C" gnus-summary-limit-mark-excluded-as-read)
1352 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1353 "n" gnus-summary-next-unread-article
1354 "p" gnus-summary-prev-unread-article
1355 "N" gnus-summary-next-article
1356 "P" gnus-summary-prev-article
1357 "\C-n" gnus-summary-next-same-subject
1358 "\C-p" gnus-summary-prev-same-subject
1359 "\M-n" gnus-summary-next-unread-subject
1360 "\M-p" gnus-summary-prev-unread-subject
1361 "f" gnus-summary-first-unread-article
1362 "b" gnus-summary-best-unread-article
1363 "j" gnus-summary-goto-article
1364 "g" gnus-summary-goto-subject
1365 "l" gnus-summary-goto-last-article
1366 "o" gnus-summary-pop-article)
1368 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1369 "k" gnus-summary-kill-thread
1370 "l" gnus-summary-lower-thread
1371 "i" gnus-summary-raise-thread
1372 "T" gnus-summary-toggle-threads
1373 "t" gnus-summary-rethread-current
1374 "^" gnus-summary-reparent-thread
1375 "s" gnus-summary-show-thread
1376 "S" gnus-summary-show-all-threads
1377 "h" gnus-summary-hide-thread
1378 "H" gnus-summary-hide-all-threads
1379 "n" gnus-summary-next-thread
1380 "p" gnus-summary-prev-thread
1381 "u" gnus-summary-up-thread
1382 "o" gnus-summary-top-thread
1383 "d" gnus-summary-down-thread
1384 "#" gnus-uu-mark-thread
1385 "\M-#" gnus-uu-unmark-thread)
1387 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1388 "g" gnus-summary-prepare
1389 "c" gnus-summary-insert-cached-articles)
1391 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1392 "c" gnus-summary-catchup-and-exit
1393 "C" gnus-summary-catchup-all-and-exit
1394 "E" gnus-summary-exit-no-update
1395 "Q" gnus-summary-exit
1396 "Z" gnus-summary-exit
1397 "n" gnus-summary-catchup-and-goto-next-group
1398 "R" gnus-summary-reselect-current-group
1399 "G" gnus-summary-rescan-group
1400 "N" gnus-summary-next-group
1401 "s" gnus-summary-save-newsrc
1402 "P" gnus-summary-prev-group)
1404 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1405 " " gnus-summary-next-page
1406 "n" gnus-summary-next-page
1407 "\177" gnus-summary-prev-page
1408 [delete] gnus-summary-prev-page
1409 "p" gnus-summary-prev-page
1410 "\r" gnus-summary-scroll-up
1411 "\M-\r" gnus-summary-scroll-down
1412 "<" gnus-summary-beginning-of-article
1413 ">" gnus-summary-end-of-article
1414 "b" gnus-summary-beginning-of-article
1415 "e" gnus-summary-end-of-article
1416 "^" gnus-summary-refer-parent-article
1417 "r" gnus-summary-refer-parent-article
1418 "R" gnus-summary-refer-references
1419 "T" gnus-summary-refer-thread
1420 "g" gnus-summary-show-article
1421 "s" gnus-summary-isearch-article
1422 "P" gnus-summary-print-article)
1424 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1425 "b" gnus-article-add-buttons
1426 "B" gnus-article-add-buttons-to-head
1427 "o" gnus-article-treat-overstrike
1428 "e" gnus-article-emphasize
1429 "w" gnus-article-fill-cited-article
1430 "c" gnus-article-remove-cr
1431 "f" gnus-article-display-x-face
1432 "l" gnus-summary-stop-page-breaking
1433 "r" gnus-summary-caesar-message
1434 "t" gnus-article-hide-headers
1435 "v" gnus-summary-verbose-headers
1436 "m" gnus-summary-toggle-mime
1437 "h" gnus-article-treat-html
1438 "d" gnus-article-treat-dumbquotes)
1440 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1441 "a" gnus-article-hide
1442 "h" gnus-article-hide-headers
1443 "b" gnus-article-hide-boring-headers
1444 "s" gnus-article-hide-signature
1445 "c" gnus-article-hide-citation
1446 "C" gnus-article-hide-citation-in-followups
1447 "p" gnus-article-hide-pgp
1448 "P" gnus-article-hide-pem
1449 "\C-c" gnus-article-hide-citation-maybe)
1451 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1452 "a" gnus-article-highlight
1453 "h" gnus-article-highlight-headers
1454 "c" gnus-article-highlight-citation
1455 "s" gnus-article-highlight-signature)
1457 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1458 "z" gnus-article-date-ut
1459 "u" gnus-article-date-ut
1460 "l" gnus-article-date-local
1461 "e" gnus-article-date-lapsed
1462 "o" gnus-article-date-original
1463 "i" gnus-article-date-iso8601
1464 "s" gnus-article-date-user)
1466 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1467 "t" gnus-article-remove-trailing-blank-lines
1468 "l" gnus-article-strip-leading-blank-lines
1469 "m" gnus-article-strip-multiple-blank-lines
1470 "a" gnus-article-strip-blank-lines
1471 "A" gnus-article-strip-all-blank-lines
1472 "s" gnus-article-strip-leading-space
1473 "e" gnus-article-strip-trailing-space)
1475 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1477 "f" gnus-summary-fetch-faq
1478 "d" gnus-summary-describe-group
1479 "h" gnus-summary-describe-briefly
1480 "i" gnus-info-find-node)
1482 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1483 "e" gnus-summary-expire-articles
1484 "\M-\C-e" gnus-summary-expire-articles-now
1485 "\177" gnus-summary-delete-article
1486 [delete] gnus-summary-delete-article
1487 "m" gnus-summary-move-article
1488 "r" gnus-summary-respool-article
1489 "w" gnus-summary-edit-article
1490 "c" gnus-summary-copy-article
1491 "B" gnus-summary-crosspost-article
1492 "q" gnus-summary-respool-query
1493 "t" gnus-summary-respool-trace
1494 "i" gnus-summary-import-article
1495 "p" gnus-summary-article-posted-p)
1497 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1498 "o" gnus-summary-save-article
1499 "m" gnus-summary-save-article-mail
1500 "F" gnus-summary-write-article-file
1501 "r" gnus-summary-save-article-rmail
1502 "f" gnus-summary-save-article-file
1503 "b" gnus-summary-save-article-body-file
1504 "h" gnus-summary-save-article-folder
1505 "v" gnus-summary-save-article-vm
1506 "p" gnus-summary-pipe-output
1507 "s" gnus-soup-add-article)
1509 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1510 "b" gnus-summary-display-buttonized
1511 "m" gnus-summary-repair-multipart
1512 "v" gnus-article-view-part
1513 "o" gnus-article-save-part
1514 "c" gnus-article-copy-part
1515 "e" gnus-article-externalize-part
1516 "|" gnus-article-pipe-part)
1519 (defun gnus-summary-make-menu-bar ()
1520 (gnus-turn-off-edit-menu 'summary)
1522 (unless (boundp 'gnus-summary-misc-menu)
1525 gnus-summary-kill-menu gnus-summary-mode-map ""
1530 ["Enter score..." gnus-summary-score-entry t]
1531 ["Customize" gnus-score-customize t])
1532 (gnus-make-score-map 'increase)
1533 (gnus-make-score-map 'lower)
1535 ["Kill below" gnus-summary-kill-below t]
1536 ["Mark above" gnus-summary-mark-above t]
1537 ["Tick above" gnus-summary-tick-above t]
1538 ["Clear above" gnus-summary-clear-above t])
1539 ["Current score" gnus-summary-current-score t]
1540 ["Set score" gnus-summary-set-score t]
1541 ["Switch current score file..." gnus-score-change-score-file t]
1542 ["Set mark below..." gnus-score-set-mark-below t]
1543 ["Set expunge below..." gnus-score-set-expunge-below t]
1544 ["Edit current score file" gnus-score-edit-current-scores t]
1545 ["Edit score file" gnus-score-edit-file t]
1546 ["Trace score" gnus-score-find-trace t]
1547 ["Find words" gnus-score-find-favourite-words t]
1548 ["Rescore buffer" gnus-summary-rescore t]
1549 ["Increase score..." gnus-summary-increase-score t]
1550 ["Lower score..." gnus-summary-lower-score t]))))
1552 ;; Define both the Article menu in the summary buffer and the equivalent
1553 ;; Commands menu in the article buffer here for consistency.
1556 ["All" gnus-article-hide t]
1557 ["Headers" gnus-article-hide-headers t]
1558 ["Signature" gnus-article-hide-signature t]
1559 ["Citation" gnus-article-hide-citation t]
1560 ["PGP" gnus-article-hide-pgp t]
1561 ["Boring headers" gnus-article-hide-boring-headers t])
1563 ["All" gnus-article-highlight t]
1564 ["Headers" gnus-article-highlight-headers t]
1565 ["Signature" gnus-article-highlight-signature t]
1566 ["Citation" gnus-article-highlight-citation t])
1568 ["Local" gnus-article-date-local t]
1569 ["ISO8601" gnus-article-date-iso8601 t]
1570 ["UT" gnus-article-date-ut t]
1571 ["Original" gnus-article-date-original t]
1572 ["Lapsed" gnus-article-date-lapsed t]
1573 ["User-defined" gnus-article-date-user t])
1576 ["Leading" gnus-article-strip-leading-blank-lines t]
1577 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1578 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1579 ["All of the above" gnus-article-strip-blank-lines t]
1580 ["All" gnus-article-strip-all-blank-lines t]
1581 ["Leading space" gnus-article-strip-leading-space t]
1582 ["Trailing space" gnus-article-strip-trailing-space t])
1583 ["Overstrike" gnus-article-treat-overstrike t]
1584 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1585 ["Emphasis" gnus-article-emphasize t]
1586 ["Word wrap" gnus-article-fill-cited-article t]
1587 ["CR" gnus-article-remove-cr t]
1588 ["Show X-Face" gnus-article-display-x-face t]
1589 ["UnHTMLize" gnus-article-treat-html t]
1590 ["Rot 13" gnus-summary-caesar-message t]
1591 ["Unix pipe" gnus-summary-pipe-message t]
1592 ["Add buttons" gnus-article-add-buttons t]
1593 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1594 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1595 ["Toggle MIME" gnus-summary-toggle-mime t]
1596 ["Verbose header" gnus-summary-verbose-headers t]
1597 ["Toggle header" gnus-summary-toggle-header t])
1599 ["Save in default format" gnus-summary-save-article t]
1600 ["Save in file" gnus-summary-save-article-file t]
1601 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1602 ["Save in MH folder" gnus-summary-save-article-folder t]
1603 ["Save in VM folder" gnus-summary-save-article-vm t]
1604 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1605 ["Save body in file" gnus-summary-save-article-body-file t]
1606 ["Pipe through a filter" gnus-summary-pipe-output t]
1607 ["Add to SOUP packet" gnus-soup-add-article t]
1608 ["Print" gnus-summary-print-article t])
1610 ["Respool article..." gnus-summary-respool-article t]
1611 ["Move article..." gnus-summary-move-article
1612 (gnus-check-backend-function
1613 'request-move-article gnus-newsgroup-name)]
1614 ["Copy article..." gnus-summary-copy-article t]
1615 ["Crosspost article..." gnus-summary-crosspost-article
1616 (gnus-check-backend-function
1617 'request-replace-article gnus-newsgroup-name)]
1618 ["Import file..." gnus-summary-import-article t]
1619 ["Check if posted" gnus-summary-article-posted-p t]
1620 ["Edit article" gnus-summary-edit-article
1621 (not (gnus-group-read-only-p))]
1622 ["Delete article" gnus-summary-delete-article
1623 (gnus-check-backend-function
1624 'request-expire-articles gnus-newsgroup-name)]
1625 ["Query respool" gnus-summary-respool-query t]
1626 ["Trace respool" gnus-summary-respool-trace t]
1627 ["Delete expirable articles" gnus-summary-expire-articles-now
1628 (gnus-check-backend-function
1629 'request-expire-articles gnus-newsgroup-name)])
1631 ["Uudecode" gnus-uu-decode-uu t]
1632 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1633 ["Unshar" gnus-uu-decode-unshar t]
1634 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1635 ["Save" gnus-uu-decode-save t]
1636 ["Binhex" gnus-uu-decode-binhex t]
1637 ["Postscript" gnus-uu-decode-postscript t])
1639 ["Enter article" gnus-cache-enter-article t]
1640 ["Remove article" gnus-cache-remove-article t])
1641 ["Select article buffer" gnus-summary-select-article-buffer t]
1642 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1643 ["Isearch article..." gnus-summary-isearch-article t]
1644 ["Beginning of the article" gnus-summary-beginning-of-article t]
1645 ["End of the article" gnus-summary-end-of-article t]
1646 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1647 ["Fetch referenced articles" gnus-summary-refer-references t]
1648 ["Fetch current thread" gnus-summary-refer-thread t]
1649 ["Fetch article with id..." gnus-summary-refer-article t]
1650 ["Redisplay" gnus-summary-show-article t])))
1652 gnus-summary-article-menu gnus-summary-mode-map ""
1653 (cons "Article" innards))
1656 gnus-article-commands-menu gnus-article-mode-map ""
1657 (cons "Commands" innards)))
1660 gnus-summary-thread-menu gnus-summary-mode-map ""
1662 ["Toggle threading" gnus-summary-toggle-threads t]
1663 ["Hide threads" gnus-summary-hide-all-threads t]
1664 ["Show threads" gnus-summary-show-all-threads t]
1665 ["Hide thread" gnus-summary-hide-thread t]
1666 ["Show thread" gnus-summary-show-thread t]
1667 ["Go to next thread" gnus-summary-next-thread t]
1668 ["Go to previous thread" gnus-summary-prev-thread t]
1669 ["Go down thread" gnus-summary-down-thread t]
1670 ["Go up thread" gnus-summary-up-thread t]
1671 ["Top of thread" gnus-summary-top-thread t]
1672 ["Mark thread as read" gnus-summary-kill-thread t]
1673 ["Lower thread score" gnus-summary-lower-thread t]
1674 ["Raise thread score" gnus-summary-raise-thread t]
1675 ["Rethread current" gnus-summary-rethread-current t]
1679 gnus-summary-post-menu gnus-summary-mode-map ""
1681 ["Post an article" gnus-summary-post-news t]
1682 ["Followup" gnus-summary-followup t]
1683 ["Followup and yank" gnus-summary-followup-with-original t]
1684 ["Supersede article" gnus-summary-supersede-article t]
1685 ["Cancel article" gnus-summary-cancel-article t]
1686 ["Reply" gnus-summary-reply t]
1687 ["Reply and yank" gnus-summary-reply-with-original t]
1688 ["Wide reply" gnus-summary-wide-reply t]
1689 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1690 ["Mail forward" gnus-summary-mail-forward t]
1691 ["Post forward" gnus-summary-post-forward t]
1692 ["Digest and mail" gnus-summary-mail-digest t]
1693 ["Digest and post" gnus-summary-post-digest t]
1694 ["Resend message" gnus-summary-resend-message t]
1695 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1696 ["Send a mail" gnus-summary-mail-other-window t]
1697 ["Uuencode and post" gnus-uu-post-news t]
1698 ["Followup via news" gnus-summary-followup-to-mail t]
1699 ["Followup via news and yank"
1700 gnus-summary-followup-to-mail-with-original t]
1702 ;;["Send" gnus-summary-send-draft t]
1703 ;;["Send bounced" gnus-resend-bounced-mail t])
1707 gnus-summary-misc-menu gnus-summary-mode-map ""
1710 ["Mark as read" gnus-summary-mark-as-read-forward t]
1711 ["Mark same subject and select"
1712 gnus-summary-kill-same-subject-and-select t]
1713 ["Mark same subject" gnus-summary-kill-same-subject t]
1714 ["Catchup" gnus-summary-catchup t]
1715 ["Catchup all" gnus-summary-catchup-all t]
1716 ["Catchup to here" gnus-summary-catchup-to-here t]
1717 ["Catchup region" gnus-summary-mark-region-as-read t]
1718 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1720 ["Tick" gnus-summary-tick-article-forward t]
1721 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1722 ["Remove marks" gnus-summary-clear-mark-forward t]
1723 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1724 ["Set bookmark" gnus-summary-set-bookmark t]
1725 ["Remove bookmark" gnus-summary-remove-bookmark t])
1727 ["Marks..." gnus-summary-limit-to-marks t]
1728 ["Subject..." gnus-summary-limit-to-subject t]
1729 ["Author..." gnus-summary-limit-to-author t]
1730 ["Age..." gnus-summary-limit-to-age t]
1731 ["Score" gnus-summary-limit-to-score t]
1732 ["Unread" gnus-summary-limit-to-unread t]
1733 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1734 ["Articles" gnus-summary-limit-to-articles t]
1735 ["Pop limit" gnus-summary-pop-limit t]
1736 ["Show dormant" gnus-summary-limit-include-dormant t]
1737 ["Hide childless dormant"
1738 gnus-summary-limit-exclude-childless-dormant t]
1739 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1740 ["Show expunged" gnus-summary-show-all-expunged t])
1742 ["Set mark" gnus-summary-mark-as-processable t]
1743 ["Remove mark" gnus-summary-unmark-as-processable t]
1744 ["Remove all marks" gnus-summary-unmark-all-processable t]
1745 ["Mark above" gnus-uu-mark-over t]
1746 ["Mark series" gnus-uu-mark-series t]
1747 ["Mark region" gnus-uu-mark-region t]
1748 ["Unmark region" gnus-uu-unmark-region t]
1749 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1750 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1751 ["Mark all" gnus-uu-mark-all t]
1752 ["Mark buffer" gnus-uu-mark-buffer t]
1753 ["Mark sparse" gnus-uu-mark-sparse t]
1754 ["Mark thread" gnus-uu-mark-thread t]
1755 ["Unmark thread" gnus-uu-unmark-thread t]
1756 ("Process Mark Sets"
1757 ["Kill" gnus-summary-kill-process-mark t]
1758 ["Yank" gnus-summary-yank-process-mark
1759 gnus-newsgroup-process-stack]
1760 ["Save" gnus-summary-save-process-mark t]))
1762 ["Page forward" gnus-summary-next-page t]
1763 ["Page backward" gnus-summary-prev-page t]
1764 ["Line forward" gnus-summary-scroll-up t])
1766 ["Next unread article" gnus-summary-next-unread-article t]
1767 ["Previous unread article" gnus-summary-prev-unread-article t]
1768 ["Next article" gnus-summary-next-article t]
1769 ["Previous article" gnus-summary-prev-article t]
1770 ["Next unread subject" gnus-summary-next-unread-subject t]
1771 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1772 ["Next article same subject" gnus-summary-next-same-subject t]
1773 ["Previous article same subject" gnus-summary-prev-same-subject t]
1774 ["First unread article" gnus-summary-first-unread-article t]
1775 ["Best unread article" gnus-summary-best-unread-article t]
1776 ["Go to subject number..." gnus-summary-goto-subject t]
1777 ["Go to article number..." gnus-summary-goto-article t]
1778 ["Go to the last article" gnus-summary-goto-last-article t]
1779 ["Pop article off history" gnus-summary-pop-article t])
1781 ["Sort by number" gnus-summary-sort-by-number t]
1782 ["Sort by author" gnus-summary-sort-by-author t]
1783 ["Sort by subject" gnus-summary-sort-by-subject t]
1784 ["Sort by date" gnus-summary-sort-by-date t]
1785 ["Sort by score" gnus-summary-sort-by-score t]
1786 ["Sort by lines" gnus-summary-sort-by-lines t])
1788 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1789 ["Describe group" gnus-summary-describe-group t]
1790 ["Read manual" gnus-info-find-node t])
1792 ["Pick and read" gnus-pick-mode t]
1793 ["Binary" gnus-binary-mode t])
1795 ["Regenerate" gnus-summary-prepare t]
1796 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1797 ["Toggle threading" gnus-summary-toggle-threads t])
1798 ["Filter articles..." gnus-summary-execute-command t]
1799 ["Run command on subjects..." gnus-summary-universal-argument t]
1800 ["Search articles forward..." gnus-summary-search-article-forward t]
1801 ["Search articles backward..." gnus-summary-search-article-backward t]
1802 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1803 ["Expand window" gnus-summary-expand-window t]
1804 ["Expire expirable articles" gnus-summary-expire-articles
1805 (gnus-check-backend-function
1806 'request-expire-articles gnus-newsgroup-name)]
1807 ["Edit local kill file" gnus-summary-edit-local-kill t]
1808 ["Edit main kill file" gnus-summary-edit-global-kill t]
1809 ["Edit group parameters" gnus-summary-edit-parameters t]
1810 ["Customize group parameters" gnus-summary-customize-parameters t]
1811 ["Send a bug report" gnus-bug t]
1813 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1814 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1815 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1816 ["Exit group" gnus-summary-exit t]
1817 ["Exit group without updating" gnus-summary-exit-no-update t]
1818 ["Exit and goto next group" gnus-summary-next-group t]
1819 ["Exit and goto prev group" gnus-summary-prev-group t]
1820 ["Reselect group" gnus-summary-reselect-current-group t]
1821 ["Rescan group" gnus-summary-rescan-group t]
1822 ["Update dribble" gnus-summary-save-newsrc t])))
1824 (gnus-run-hooks 'gnus-summary-menu-hook)))
1826 (defun gnus-score-set-default (var value)
1827 "A version of set that updates the GNU Emacs menu-bar."
1829 ;; It is the message that forces the active status to be updated.
1832 (defun gnus-make-score-map (type)
1833 "Make a summary score map of type TYPE."
1836 (let ((headers '(("author" "from" string)
1837 ("subject" "subject" string)
1838 ("article body" "body" string)
1839 ("article head" "head" string)
1840 ("xref" "xref" string)
1841 ("extra header" "extra" string)
1842 ("lines" "lines" number)
1843 ("followups to author" "followup" string)))
1844 (types '((number ("less than" <)
1847 (string ("substring" s)
1851 (perms '(("temporary" (current-time-string))
1859 (if (eq type 'lower)
1864 (setq header (car headers))
1870 (let ((ts (cdr (assoc (nth 2 header) types)))
1886 'gnus-summary-score-entry
1888 (if (or (string= (nth 1 header)
1890 (string= (nth 1 header)
1893 (list 'gnus-summary-header
1895 (list 'quote (nth 1 (car ts)))
1896 (list 'gnus-score-default nil)
1902 (list (nreverse outp))))
1905 (list (nreverse outt))))
1907 (setq headers (cdr headers)))
1908 (list (nreverse outh))))))))
1912 (defun gnus-summary-mode (&optional group)
1913 "Major mode for reading articles.
1915 All normal editing commands are switched off.
1916 \\<gnus-summary-mode-map>
1917 Each line in this buffer represents one article. To read an
1918 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1919 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1922 You can also post articles and send mail from this buffer. To
1923 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1924 of an article, type `\\[gnus-summary-reply]'.
1926 There are approx. one gazillion commands you can execute in this
1927 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1929 The following commands are available:
1931 \\{gnus-summary-mode-map}"
1933 (when (gnus-visual-p 'summary-menu 'menu)
1934 (gnus-summary-make-menu-bar))
1935 (kill-all-local-variables)
1936 (gnus-summary-make-local-variables)
1937 (gnus-make-thread-indent-array)
1938 (gnus-simplify-mode-line)
1939 (setq major-mode 'gnus-summary-mode)
1940 (setq mode-name "Summary")
1941 (make-local-variable 'minor-mode-alist)
1942 (use-local-map gnus-summary-mode-map)
1943 (buffer-disable-undo)
1944 (setq buffer-read-only t) ;Disable modification
1945 (setq truncate-lines t)
1946 (setq selective-display t)
1947 (setq selective-display-ellipses t) ;Display `...'
1948 (gnus-summary-set-display-table)
1949 (gnus-set-default-directory)
1950 (setq gnus-newsgroup-name group)
1951 (make-local-variable 'gnus-summary-line-format)
1952 (make-local-variable 'gnus-summary-line-format-spec)
1953 (make-local-variable 'gnus-summary-dummy-line-format)
1954 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1955 (make-local-variable 'gnus-summary-mark-positions)
1956 (make-local-hook 'post-command-hook)
1957 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1958 (make-local-hook 'pre-command-hook)
1959 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1960 (gnus-run-hooks 'gnus-summary-mode-hook)
1961 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1962 (gnus-update-summary-mark-positions))
1964 (defun gnus-summary-make-local-variables ()
1965 "Make all the local summary buffer variables."
1966 (let ((locals gnus-summary-local-variables)
1968 (while (setq local (pop locals))
1971 (if (eq (cdr local) 'global)
1972 ;; Copy the global value of the variable.
1973 (setq global (symbol-value (car local)))
1974 ;; Use the value from the list.
1975 (setq global (eval (cdr local))))
1976 (make-local-variable (car local))
1977 (set (car local) global))
1978 ;; Simple nil-valued local variable.
1979 (make-local-variable local)
1982 (defun gnus-summary-clear-local-variables ()
1983 (let ((locals gnus-summary-local-variables))
1985 (if (consp (car locals))
1986 (and (vectorp (caar locals))
1987 (set (caar locals) nil))
1988 (and (vectorp (car locals))
1989 (set (car locals) nil)))
1990 (setq locals (cdr locals)))))
1992 ;; Summary data functions.
1994 (defmacro gnus-data-number (data)
1997 (defmacro gnus-data-set-number (data number)
1998 `(setcar ,data ,number))
2000 (defmacro gnus-data-mark (data)
2003 (defmacro gnus-data-set-mark (data mark)
2004 `(setcar (nthcdr 1 ,data) ,mark))
2006 (defmacro gnus-data-pos (data)
2009 (defmacro gnus-data-set-pos (data pos)
2010 `(setcar (nthcdr 2 ,data) ,pos))
2012 (defmacro gnus-data-header (data)
2015 (defmacro gnus-data-set-header (data header)
2016 `(setf (nth 3 ,data) ,header))
2018 (defmacro gnus-data-level (data)
2021 (defmacro gnus-data-unread-p (data)
2022 `(= (nth 1 ,data) gnus-unread-mark))
2024 (defmacro gnus-data-read-p (data)
2025 `(/= (nth 1 ,data) gnus-unread-mark))
2027 (defmacro gnus-data-pseudo-p (data)
2028 `(consp (nth 3 ,data)))
2030 (defmacro gnus-data-find (number)
2031 `(assq ,number gnus-newsgroup-data))
2033 (defmacro gnus-data-find-list (number &optional data)
2034 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2035 (memq (assq ,number bdata)
2038 (defmacro gnus-data-make (number mark pos header level)
2039 `(list ,number ,mark ,pos ,header ,level))
2041 (defun gnus-data-enter (after-article number mark pos header level offset)
2042 (let ((data (gnus-data-find-list after-article)))
2044 (error "No such article: %d" after-article))
2045 (setcdr data (cons (gnus-data-make number mark pos header level)
2047 (setq gnus-newsgroup-data-reverse nil)
2048 (gnus-data-update-list (cddr data) offset)))
2050 (defun gnus-data-enter-list (after-article list &optional offset)
2052 (let ((data (and after-article (gnus-data-find-list after-article)))
2056 (let ((odata gnus-newsgroup-data))
2057 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2059 (gnus-data-update-list odata offset)))
2060 ;; Find the last element in the list to be spliced into the main
2063 (setq list (cdr list)))
2066 (setcdr list gnus-newsgroup-data)
2067 (setq gnus-newsgroup-data ilist)
2069 (gnus-data-update-list (cdr list) offset)))
2070 (setcdr list (cdr data))
2073 (gnus-data-update-list (cdr list) offset))))
2074 (setq gnus-newsgroup-data-reverse nil))))
2076 (defun gnus-data-remove (article &optional offset)
2077 (let ((data gnus-newsgroup-data))
2078 (if (= (gnus-data-number (car data)) article)
2080 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2081 gnus-newsgroup-data-reverse nil)
2083 (gnus-data-update-list gnus-newsgroup-data offset)))
2085 (when (= (gnus-data-number (cadr data)) article)
2086 (setcdr data (cddr data))
2088 (gnus-data-update-list (cdr data) offset))
2090 gnus-newsgroup-data-reverse nil))
2091 (setq data (cdr data))))))
2093 (defmacro gnus-data-list (backward)
2095 (or gnus-newsgroup-data-reverse
2096 (setq gnus-newsgroup-data-reverse
2097 (reverse gnus-newsgroup-data)))
2098 gnus-newsgroup-data))
2100 (defun gnus-data-update-list (data offset)
2101 "Add OFFSET to the POS of all data entries in DATA."
2102 (setq gnus-newsgroup-data-reverse nil)
2104 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2105 (setq data (cdr data))))
2107 (defun gnus-summary-article-pseudo-p (article)
2108 "Say whether this article is a pseudo article or not."
2109 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2111 (defmacro gnus-summary-article-sparse-p (article)
2112 "Say whether this article is a sparse article or not."
2113 `(memq ,article gnus-newsgroup-sparse))
2115 (defmacro gnus-summary-article-ancient-p (article)
2116 "Say whether this article is a sparse article or not."
2117 `(memq ,article gnus-newsgroup-ancient))
2119 (defun gnus-article-parent-p (number)
2120 "Say whether this article is a parent or not."
2121 (let ((data (gnus-data-find-list number)))
2122 (and (cdr data) ; There has to be an article after...
2123 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2124 (gnus-data-level (nth 1 data))))))
2126 (defun gnus-article-children (number)
2127 "Return a list of all children to NUMBER."
2128 (let* ((data (gnus-data-find-list number))
2129 (level (gnus-data-level (car data)))
2131 (setq data (cdr data))
2133 (= (gnus-data-level (car data)) (1+ level)))
2134 (push (gnus-data-number (car data)) children)
2135 (setq data (cdr data)))
2138 (defmacro gnus-summary-skip-intangible ()
2139 "If the current article is intangible, then jump to a different article."
2140 '(let ((to (get-text-property (point) 'gnus-intangible)))
2141 (and to (gnus-summary-goto-subject to))))
2143 (defmacro gnus-summary-article-intangible-p ()
2144 "Say whether this article is intangible or not."
2145 '(get-text-property (point) 'gnus-intangible))
2147 (defun gnus-article-read-p (article)
2148 "Say whether ARTICLE is read or not."
2149 (not (or (memq article gnus-newsgroup-marked)
2150 (memq article gnus-newsgroup-unreads)
2151 (memq article gnus-newsgroup-unselected)
2152 (memq article gnus-newsgroup-dormant))))
2154 ;; Some summary mode macros.
2156 (defmacro gnus-summary-article-number ()
2157 "The article number of the article on the current line.
2158 If there isn's an article number here, then we return the current
2161 (gnus-summary-skip-intangible)
2162 (or (get-text-property (point) 'gnus-number)
2163 (gnus-summary-last-subject))))
2165 (defmacro gnus-summary-article-header (&optional number)
2166 "Return the header of article NUMBER."
2167 `(gnus-data-header (gnus-data-find
2168 ,(or number '(gnus-summary-article-number)))))
2170 (defmacro gnus-summary-thread-level (&optional number)
2171 "Return the level of thread that starts with article NUMBER."
2172 `(if (and (eq gnus-summary-make-false-root 'dummy)
2173 (get-text-property (point) 'gnus-intangible))
2175 (gnus-data-level (gnus-data-find
2176 ,(or number '(gnus-summary-article-number))))))
2178 (defmacro gnus-summary-article-mark (&optional number)
2179 "Return the mark of article NUMBER."
2180 `(gnus-data-mark (gnus-data-find
2181 ,(or number '(gnus-summary-article-number)))))
2183 (defmacro gnus-summary-article-pos (&optional number)
2184 "Return the position of the line of article NUMBER."
2185 `(gnus-data-pos (gnus-data-find
2186 ,(or number '(gnus-summary-article-number)))))
2188 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2189 (defmacro gnus-summary-article-subject (&optional number)
2190 "Return current subject string or nil if nothing."
2193 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2194 '(gnus-data-header (assq (gnus-summary-article-number)
2195 gnus-newsgroup-data)))))
2198 (mail-header-subject headers))))
2200 (defmacro gnus-summary-article-score (&optional number)
2201 "Return current article score."
2202 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2203 gnus-newsgroup-scored))
2204 gnus-summary-default-score 0))
2206 (defun gnus-summary-article-children (&optional number)
2207 "Return a list of article numbers that are children of article NUMBER."
2208 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2209 (level (gnus-data-level (car data)))
2211 (while (and (setq data (cdr data))
2212 (> (setq l (gnus-data-level (car data))) level))
2213 (and (= (1+ level) l)
2214 (push (gnus-data-number (car data))
2216 (nreverse children)))
2218 (defun gnus-summary-article-parent (&optional number)
2219 "Return the article number of the parent of article NUMBER."
2220 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2221 (gnus-data-list t)))
2222 (level (gnus-data-level (car data))))
2224 () ; This is a root.
2225 ;; We search until we find an article with a level less than
2226 ;; this one. That function has to be the parent.
2227 (while (and (setq data (cdr data))
2228 (not (< (gnus-data-level (car data)) level))))
2229 (and data (gnus-data-number (car data))))))
2231 (defun gnus-unread-mark-p (mark)
2232 "Say whether MARK is the unread mark."
2233 (= mark gnus-unread-mark))
2235 (defun gnus-read-mark-p (mark)
2236 "Say whether MARK is one of the marks that mark as read.
2237 This is all marks except unread, ticked, dormant, and expirable."
2238 (not (or (= mark gnus-unread-mark)
2239 (= mark gnus-ticked-mark)
2240 (= mark gnus-dormant-mark)
2241 (= mark gnus-expirable-mark))))
2243 (defmacro gnus-article-mark (number)
2244 "Return the MARK of article NUMBER.
2245 This macro should only be used when computing the mark the \"first\"
2246 time; i.e., when generating the summary lines. After that,
2247 `gnus-summary-article-mark' should be used to examine the
2250 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2251 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2252 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2253 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2254 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2255 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2256 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2257 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2258 gnus-ancient-mark))))
2260 ;; Saving hidden threads.
2262 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2263 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2265 (defmacro gnus-save-hidden-threads (&rest forms)
2266 "Save hidden threads, eval FORMS, and restore the hidden threads."
2267 (let ((config (make-symbol "config")))
2268 `(let ((,config (gnus-hidden-threads-configuration)))
2272 (gnus-restore-hidden-threads-configuration ,config)))))
2274 (defun gnus-data-compute-positions ()
2275 "Compute the positions of all articles."
2276 (setq gnus-newsgroup-data-reverse nil)
2277 (let ((data gnus-newsgroup-data))
2279 (gnus-save-hidden-threads
2280 (gnus-summary-show-all-threads)
2281 (goto-char (point-min))
2283 (while (get-text-property (point) 'gnus-intangible)
2285 (gnus-data-set-pos (car data) (+ (point) 3))
2286 (setq data (cdr data))
2287 (forward-line 1))))))
2289 (defun gnus-hidden-threads-configuration ()
2290 "Return the current hidden threads configuration."
2293 (goto-char (point-min))
2294 (while (search-forward "\r" nil t)
2295 (push (1- (point)) config))
2298 (defun gnus-restore-hidden-threads-configuration (config)
2299 "Restore hidden threads configuration from CONFIG."
2300 (let (point buffer-read-only)
2301 (while (setq point (pop config))
2302 (when (and (< point (point-max))
2304 (eq (char-after) ?\n))
2305 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2307 ;; Various summary mode internalish functions.
2309 (defun gnus-mouse-pick-article (e)
2312 (gnus-summary-next-page nil t))
2314 (defun gnus-summary-set-display-table ()
2315 ;; Change the display table. Odd characters have a tendency to mess
2316 ;; up nicely formatted displays - we make all possible glyphs
2317 ;; display only a single character.
2319 ;; We start from the standard display table, if any.
2320 (let ((table (or (copy-sequence standard-display-table)
2321 (make-display-table)))
2323 ;; Nix out all the control chars...
2324 (while (>= (setq i (1- i)) 0)
2325 (aset table i [??]))
2326 ;; ... but not newline and cr, of course. (cr is necessary for the
2327 ;; selective display).
2328 (aset table ?\n nil)
2329 (aset table ?\r nil)
2330 ;; We keep TAB as well.
2331 (aset table ?\t nil)
2332 ;; We nix out any glyphs over 126 that are not set already.
2334 (while (>= (setq i (1- i)) 127)
2335 ;; Only modify if the entry is nil.
2336 (unless (aref table i)
2337 (aset table i [??]))))
2338 (setq buffer-display-table table)))
2340 (defun gnus-summary-setup-buffer (group)
2341 "Initialize summary buffer."
2342 (let ((buffer (concat "*Summary " group "*")))
2343 (if (get-buffer buffer)
2346 (setq gnus-summary-buffer (current-buffer))
2347 (not gnus-newsgroup-prepared))
2348 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2349 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2350 (gnus-summary-mode group)
2352 (gnus-carpal-setup-buffer 'summary))
2353 (unless gnus-single-article-buffer
2354 (make-local-variable 'gnus-article-buffer)
2355 (make-local-variable 'gnus-article-current)
2356 (make-local-variable 'gnus-original-article-buffer))
2357 (setq gnus-newsgroup-name group)
2360 (defun gnus-set-global-variables ()
2361 ;; Set the global equivalents of the summary buffer-local variables
2362 ;; to the latest values they had. These reflect the summary buffer
2363 ;; that was in action when the last article was fetched.
2364 (when (eq major-mode 'gnus-summary-mode)
2365 (setq gnus-summary-buffer (current-buffer))
2366 (let ((name gnus-newsgroup-name)
2367 (marked gnus-newsgroup-marked)
2368 (unread gnus-newsgroup-unreads)
2369 (headers gnus-current-headers)
2370 (data gnus-newsgroup-data)
2371 (summary gnus-summary-buffer)
2372 (article-buffer gnus-article-buffer)
2373 (original gnus-original-article-buffer)
2374 (gac gnus-article-current)
2375 (reffed gnus-reffed-article-number)
2376 (score-file gnus-current-score-file)
2377 (default-charset gnus-newsgroup-default-charset)
2378 (iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
2380 (set-buffer gnus-group-buffer)
2381 (setq gnus-newsgroup-name name
2382 gnus-newsgroup-marked marked
2383 gnus-newsgroup-unreads unread
2384 gnus-current-headers headers
2385 gnus-newsgroup-data data
2386 gnus-article-current gac
2387 gnus-summary-buffer summary
2388 gnus-article-buffer article-buffer
2389 gnus-original-article-buffer original
2390 gnus-reffed-article-number reffed
2391 gnus-current-score-file score-file
2392 gnus-newsgroup-default-charset default-charset
2393 gnus-newsgroup-iso-8859-1-forced iso-8859-1-forced)
2394 ;; The article buffer also has local variables.
2395 (when (gnus-buffer-live-p gnus-article-buffer)
2396 (set-buffer gnus-article-buffer)
2397 (setq gnus-summary-buffer summary))))))
2399 (defun gnus-summary-article-unread-p (article)
2400 "Say whether ARTICLE is unread or not."
2401 (memq article gnus-newsgroup-unreads))
2403 (defun gnus-summary-first-article-p (&optional article)
2404 "Return whether ARTICLE is the first article in the buffer."
2405 (if (not (setq article (or article (gnus-summary-article-number))))
2407 (eq article (caar gnus-newsgroup-data))))
2409 (defun gnus-summary-last-article-p (&optional article)
2410 "Return whether ARTICLE is the last article in the buffer."
2411 (if (not (setq article (or article (gnus-summary-article-number))))
2412 t ; All non-existent numbers are the last article. :-)
2413 (not (cdr (gnus-data-find-list article)))))
2415 (defun gnus-make-thread-indent-array ()
2417 (unless (and gnus-thread-indent-array
2418 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2419 (setq gnus-thread-indent-array (make-vector 201 "")
2420 gnus-thread-indent-array-level gnus-thread-indent-level)
2422 (aset gnus-thread-indent-array n
2423 (make-string (* n gnus-thread-indent-level) ? ))
2426 (defun gnus-update-summary-mark-positions ()
2427 "Compute where the summary marks are to go."
2429 (when (gnus-buffer-exists-p gnus-summary-buffer)
2430 (set-buffer gnus-summary-buffer))
2431 (let ((gnus-replied-mark 129)
2432 (gnus-score-below-mark 130)
2433 (gnus-score-over-mark 130)
2434 (gnus-download-mark 131)
2435 (spec gnus-summary-line-format-spec)
2438 (gnus-set-work-buffer)
2439 (let ((gnus-summary-line-format-spec spec)
2440 (gnus-newsgroup-downloadable '((0 . t))))
2441 (gnus-summary-insert-line
2442 (make-full-mail-header 0 "" "" "" "" "" 0 0 "" nil)
2443 0 nil 128 t nil "" nil 1)
2444 (goto-char (point-min))
2445 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2447 (goto-char (point-min))
2448 (push (cons 'replied (and (search-forward "\201" nil t)
2451 (goto-char (point-min))
2452 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2454 (goto-char (point-min))
2455 (push (cons 'download
2456 (and (search-forward "\203" nil t) (- (point) 2)))
2458 (setq gnus-summary-mark-positions pos))))
2460 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2461 "Insert a dummy root in the summary buffer."
2463 (gnus-add-text-properties
2464 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2465 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2467 (defun gnus-summary-from-or-to-or-newsgroups (header)
2468 (let ((to (cdr (assq 'To (mail-header-extra header))))
2469 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2470 (rfc2047-default-charset gnus-newsgroup-default-charset)
2471 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
2474 gnus-ignored-from-addresses
2475 (string-match gnus-ignored-from-addresses
2476 (mail-header-from header)))
2478 (or (car (funcall gnus-extract-address-components
2480 gnus-decode-encoded-word-function to)))
2481 (funcall gnus-decode-encoded-word-function to))))
2483 gnus-ignored-from-addresses
2484 (string-match gnus-ignored-from-addresses
2485 (mail-header-from header)))
2486 (concat "=> " newsgroups))
2488 (or (car (funcall gnus-extract-address-components
2489 (mail-header-from header)))
2490 (mail-header-from header))))))
2492 (defun gnus-summary-insert-line (gnus-tmp-header
2493 gnus-tmp-level gnus-tmp-current
2494 gnus-tmp-unread gnus-tmp-replied
2495 gnus-tmp-expirable gnus-tmp-subject-or-nil
2496 &optional gnus-tmp-dummy gnus-tmp-score
2498 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2499 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2500 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2501 (gnus-tmp-score-char
2502 (if (or (null gnus-summary-default-score)
2503 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2504 gnus-summary-zcore-fuzz))
2506 (if (< gnus-tmp-score gnus-summary-default-score)
2507 gnus-score-below-mark gnus-score-over-mark)))
2509 (cond (gnus-tmp-process gnus-process-mark)
2510 ((memq gnus-tmp-current gnus-newsgroup-cached)
2512 (gnus-tmp-replied gnus-replied-mark)
2513 ((memq gnus-tmp-current gnus-newsgroup-saved)
2515 (t gnus-unread-mark)))
2516 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2519 ((string-match "<[^>]+> *$" gnus-tmp-from)
2520 (let ((beg (match-beginning 0)))
2521 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2522 (substring gnus-tmp-from (1+ (match-beginning 0))
2523 (1- (match-end 0))))
2524 (substring gnus-tmp-from 0 beg))))
2525 ((string-match "(.+)" gnus-tmp-from)
2526 (substring gnus-tmp-from
2527 (1+ (match-beginning 0)) (1- (match-end 0))))
2529 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2530 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2531 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2532 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2533 (buffer-read-only nil))
2534 (when (string= gnus-tmp-name "")
2535 (setq gnus-tmp-name gnus-tmp-from))
2536 (unless (numberp gnus-tmp-lines)
2537 (setq gnus-tmp-lines 0))
2538 (gnus-put-text-property-excluding-characters-with-faces
2540 (progn (eval gnus-summary-line-format-spec) (point))
2541 'gnus-number gnus-tmp-number)
2542 (when (gnus-visual-p 'summary-highlight 'highlight)
2544 (gnus-run-hooks 'gnus-summary-update-hook)
2547 (defun gnus-summary-update-line (&optional dont-update)
2548 ;; Update summary line after change.
2549 (when (and gnus-summary-default-score
2550 (not gnus-summary-inhibit-highlight))
2551 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2552 (article (gnus-summary-article-number))
2553 (score (gnus-summary-article-score article)))
2555 (if (and gnus-summary-mark-below
2556 (< (gnus-summary-article-score)
2557 gnus-summary-mark-below))
2558 ;; This article has a low score, so we mark it as read.
2559 (when (memq article gnus-newsgroup-unreads)
2560 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2561 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2562 ;; This article was previously marked as read on account
2563 ;; of a low score, but now it has risen, so we mark it as
2565 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2566 (gnus-summary-update-mark
2567 (if (or (null gnus-summary-default-score)
2568 (<= (abs (- score gnus-summary-default-score))
2569 gnus-summary-zcore-fuzz))
2571 (if (< score gnus-summary-default-score)
2572 gnus-score-below-mark gnus-score-over-mark))
2574 ;; Do visual highlighting.
2575 (when (gnus-visual-p 'summary-highlight 'highlight)
2576 (gnus-run-hooks 'gnus-summary-update-hook)))))
2578 (defvar gnus-tmp-new-adopts nil)
2580 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2581 "Return the number of articles in THREAD.
2582 This may be 0 in some cases -- if none of the articles in
2583 the thread are to be displayed."
2585 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2587 ((not (listp thread))
2589 ((and (consp thread) (cdr thread))
2592 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2595 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2598 (when (and level (zerop level) gnus-tmp-new-adopts)
2601 'gnus-summary-number-of-articles-in-thread
2602 gnus-tmp-new-adopts))))
2604 (if (> number 1) gnus-not-empty-thread-mark
2605 gnus-empty-thread-mark)
2608 (defun gnus-summary-set-local-parameters (group)
2609 "Go through the local params of GROUP and set all variable specs in that list."
2610 (let ((params (gnus-group-find-parameter group))
2613 (setq elem (car params)
2614 params (cdr params))
2615 (and (consp elem) ; Has to be a cons.
2616 (consp (cdr elem)) ; The cdr has to be a list.
2617 (symbolp (car elem)) ; Has to be a symbol in there.
2618 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2619 (ignore-errors ; So we set it.
2620 (make-local-variable (car elem))
2621 (set (car elem) (eval (nth 1 elem))))))))
2623 (defun gnus-summary-read-group (group &optional show-all no-article
2624 kill-buffer no-display backward
2626 "Start reading news in newsgroup GROUP.
2627 If SHOW-ALL is non-nil, already read articles are also listed.
2628 If NO-ARTICLE is non-nil, no article is selected initially.
2629 If NO-DISPLAY, don't generate a summary buffer."
2633 (let ((gnus-auto-select-next nil))
2634 (or (gnus-summary-read-group-1
2635 group show-all no-article
2636 kill-buffer no-display
2639 select-articles nil)))))
2640 (eq gnus-auto-select-next 'quietly))
2641 (set-buffer gnus-group-buffer)
2642 ;; The entry function called above goes to the next
2643 ;; group automatically, so we go two groups back
2644 ;; if we are searching for the previous group.
2646 (gnus-group-prev-unread-group 2))
2647 (if (not (equal group (gnus-group-group-name)))
2648 (setq group (gnus-group-group-name))
2652 (defun gnus-summary-read-group-1 (group show-all no-article
2653 kill-buffer no-display
2654 &optional select-articles)
2655 ;; Killed foreign groups can't be entered.
2656 (when (and (not (gnus-group-native-p group))
2657 (not (gnus-gethash group gnus-newsrc-hashtb)))
2658 (error "Dead non-native groups can't be entered"))
2659 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2660 (let* ((new-group (gnus-summary-setup-buffer group))
2661 (quit-config (gnus-group-quit-config group))
2662 (did-select (and new-group (gnus-select-newsgroup
2663 group show-all select-articles))))
2665 ;; This summary buffer exists already, so we just select it.
2667 (gnus-set-global-variables)
2669 (gnus-kill-or-deaden-summary kill-buffer))
2670 (gnus-configure-windows 'summary 'force)
2671 (gnus-set-mode-line 'summary)
2672 (gnus-summary-position-point)
2675 ;; We couldn't select this group.
2677 (when (and (eq major-mode 'gnus-summary-mode)
2678 (not (equal (current-buffer) kill-buffer)))
2679 (kill-buffer (current-buffer))
2680 (if (not quit-config)
2682 ;; Update the info -- marks might need to be removed,
2684 (gnus-summary-update-info)
2685 (set-buffer gnus-group-buffer)
2686 (gnus-group-jump-to-group group)
2687 (gnus-group-next-unread-group 1))
2688 (gnus-handle-ephemeral-exit quit-config)))
2689 (gnus-message 3 "Can't select group")
2691 ;; The user did a `C-g' while prompting for number of articles,
2692 ;; so we exit this group.
2693 ((eq did-select 'quit)
2694 (and (eq major-mode 'gnus-summary-mode)
2695 (not (equal (current-buffer) kill-buffer))
2696 (kill-buffer (current-buffer)))
2698 (gnus-kill-or-deaden-summary kill-buffer))
2699 (if (not quit-config)
2701 (set-buffer gnus-group-buffer)
2702 (gnus-group-jump-to-group group)
2703 (gnus-group-next-unread-group 1)
2704 (gnus-configure-windows 'group 'force))
2705 (gnus-handle-ephemeral-exit quit-config))
2706 ;; Finally signal the quit.
2708 ;; The group was successfully selected.
2710 (gnus-set-global-variables)
2711 ;; Save the active value in effect when the group was entered.
2712 (setq gnus-newsgroup-active
2714 (gnus-active gnus-newsgroup-name)))
2715 ;; You can change the summary buffer in some way with this hook.
2716 (gnus-run-hooks 'gnus-select-group-hook)
2717 ;; Set any local variables in the group parameters.
2718 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2719 (gnus-update-format-specifications
2720 nil 'summary 'summary-mode 'summary-dummy)
2721 ;; Do score processing.
2722 (when gnus-use-scoring
2723 (gnus-possibly-score-headers))
2724 ;; Check whether to fill in the gaps in the threads.
2725 (when gnus-build-sparse-threads
2726 (gnus-build-sparse-threads))
2727 ;; Find the initial limit.
2728 (if gnus-show-threads
2730 (let ((gnus-newsgroup-dormant nil))
2731 (gnus-summary-initial-limit show-all))
2732 (gnus-summary-initial-limit show-all))
2733 (setq gnus-newsgroup-limit
2735 (lambda (header) (mail-header-number header))
2736 gnus-newsgroup-headers)))
2737 ;; Generate the summary buffer.
2739 (gnus-summary-prepare))
2740 (when gnus-use-trees
2741 (gnus-tree-open group)
2742 (setq gnus-summary-highlight-line-function
2743 'gnus-tree-highlight-article))
2744 ;; If the summary buffer is empty, but there are some low-scored
2745 ;; articles or some excluded dormants, we include these in the
2747 (when (and (zerop (buffer-size))
2749 (cond (gnus-newsgroup-dormant
2750 (gnus-summary-limit-include-dormant))
2751 ((and gnus-newsgroup-scored show-all)
2752 (gnus-summary-limit-include-expunged t))))
2753 ;; Function `gnus-apply-kill-file' must be called in this hook.
2754 (gnus-run-hooks 'gnus-apply-kill-hook)
2755 (if (and (zerop (buffer-size))
2758 ;; This newsgroup is empty.
2759 (gnus-summary-catchup-and-exit nil t)
2760 (gnus-message 6 "No unread news")
2762 (gnus-kill-or-deaden-summary kill-buffer))
2763 ;; Return nil from this function.
2765 ;; Hide conversation thread subtrees. We cannot do this in
2766 ;; gnus-summary-prepare-hook since kill processing may not
2767 ;; work with hidden articles.
2768 (and gnus-show-threads
2769 gnus-thread-hide-subtree
2770 (gnus-summary-hide-all-threads))
2772 (gnus-kill-or-deaden-summary kill-buffer))
2773 ;; Show first unread article if requested.
2774 (if (and (not no-article)
2776 gnus-newsgroup-unreads
2777 gnus-auto-select-first)
2779 (gnus-configure-windows 'summary)
2781 ((eq gnus-auto-select-first 'best)
2782 (gnus-summary-best-unread-article))
2783 ((eq gnus-auto-select-first t)
2784 (gnus-summary-first-unread-article))
2785 ((gnus-functionp gnus-auto-select-first)
2786 (funcall gnus-auto-select-first))))
2787 ;; Don't select any articles, just move point to the first
2788 ;; article in the group.
2789 (goto-char (point-min))
2790 (gnus-summary-position-point)
2791 (gnus-configure-windows 'summary 'force)
2792 (gnus-set-mode-line 'summary))
2793 (when (get-buffer-window gnus-group-buffer t)
2794 ;; Gotta use windows, because recenter does weird stuff if
2795 ;; the current buffer ain't the displayed window.
2796 (let ((owin (selected-window)))
2797 (select-window (get-buffer-window gnus-group-buffer t))
2798 (when (gnus-group-goto-group group)
2800 (select-window owin)))
2801 ;; Mark this buffer as "prepared".
2802 (setq gnus-newsgroup-prepared t)
2803 (gnus-run-hooks 'gnus-summary-prepared-hook)
2806 (defun gnus-summary-prepare ()
2807 "Generate the summary buffer."
2809 (let ((buffer-read-only nil))
2811 (setq gnus-newsgroup-data nil
2812 gnus-newsgroup-data-reverse nil)
2813 (gnus-run-hooks 'gnus-summary-generate-hook)
2814 ;; Generate the buffer, either with threads or without.
2815 (when gnus-newsgroup-headers
2816 (gnus-summary-prepare-threads
2817 (if gnus-show-threads
2818 (gnus-sort-gathered-threads
2819 (funcall gnus-summary-thread-gathering-function
2821 (gnus-cut-threads (gnus-make-threads)))))
2822 ;; Unthreaded display.
2823 (gnus-sort-articles gnus-newsgroup-headers))))
2824 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2825 ;; Call hooks for modifying summary buffer.
2826 (goto-char (point-min))
2827 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2829 (defsubst gnus-general-simplify-subject (subject)
2830 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2833 ;; Truncate the subject.
2834 (gnus-simplify-subject-functions
2835 (gnus-map-function gnus-simplify-subject-functions subject))
2836 ((numberp gnus-summary-gather-subject-limit)
2837 (setq subject (gnus-simplify-subject-re subject))
2838 (if (> (length subject) gnus-summary-gather-subject-limit)
2839 (substring subject 0 gnus-summary-gather-subject-limit)
2841 ;; Fuzzily simplify it.
2842 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2843 (gnus-simplify-subject-fuzzy subject))
2844 ;; Just remove the leading "Re:".
2846 (gnus-simplify-subject-re subject))))
2848 (if (and gnus-summary-gather-exclude-subject
2849 (string-match gnus-summary-gather-exclude-subject subject))
2850 nil ; This article shouldn't be gathered
2853 (defun gnus-summary-simplify-subject-query ()
2854 "Query where the respool algorithm would put this article."
2856 (gnus-summary-select-article)
2857 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2859 (defun gnus-gather-threads-by-subject (threads)
2860 "Gather threads by looking at Subject headers."
2861 (if (not gnus-summary-make-false-root)
2863 (let ((hashtb (gnus-make-hashtable 1024))
2866 subject hthread whole-subject)
2868 (setq subject (gnus-general-simplify-subject
2869 (setq whole-subject (mail-header-subject
2872 (if (setq hthread (gnus-gethash subject hashtb))
2874 ;; We enter a dummy root into the thread, if we
2875 ;; haven't done that already.
2876 (unless (stringp (caar hthread))
2877 (setcar hthread (list whole-subject (car hthread))))
2878 ;; We add this new gathered thread to this gathered
2880 (setcdr (car hthread)
2881 (nconc (cdar hthread) (list (car threads))))
2882 ;; Remove it from the list of threads.
2883 (setcdr prev (cdr threads))
2884 (setq threads prev))
2885 ;; Enter this thread into the hash table.
2886 (gnus-sethash subject threads hashtb)))
2888 (setq threads (cdr threads)))
2891 (defun gnus-gather-threads-by-references (threads)
2892 "Gather threads by looking at References headers."
2893 (let ((idhashtb (gnus-make-hashtable 1024))
2894 (thhashtb (gnus-make-hashtable 1024))
2897 ids references id gthread gid entered ref)
2899 (when (setq references (mail-header-references (caar threads)))
2900 (setq id (mail-header-id (caar threads))
2901 ids (gnus-split-references references)
2903 (while (setq ref (pop ids))
2904 (setq ids (delete ref ids))
2905 (if (not (setq gid (gnus-gethash ref idhashtb)))
2907 (gnus-sethash ref id idhashtb)
2908 (gnus-sethash id threads thhashtb))
2909 (setq gthread (gnus-gethash gid thhashtb))
2911 ;; We enter a dummy root into the thread, if we
2912 ;; haven't done that already.
2913 (unless (stringp (caar gthread))
2914 (setcar gthread (list (mail-header-subject (caar gthread))
2916 ;; We add this new gathered thread to this gathered
2918 (setcdr (car gthread)
2919 (nconc (cdar gthread) (list (car threads)))))
2920 ;; Add it into the thread hash table.
2921 (gnus-sethash id gthread thhashtb)
2923 ;; Remove it from the list of threads.
2924 (setcdr prev (cdr threads))
2925 (setq threads prev))))
2927 (setq threads (cdr threads)))
2930 (defun gnus-sort-gathered-threads (threads)
2931 "Sort subtreads inside each gathered thread by article number."
2932 (let ((result threads))
2934 (when (stringp (caar threads))
2935 (setcdr (car threads)
2936 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2937 (setq threads (cdr threads)))
2940 (defun gnus-thread-loop-p (root thread)
2941 "Say whether ROOT is in THREAD."
2942 (let ((stack (list thread))
2945 (while (setq thread (pop stack))
2946 (setq th (cdr thread))
2948 (not (eq (caar th) root)))
2951 ;; We have found a loop.
2953 (setcdr thread (delq (car th) (cdr thread)))
2954 (if (boundp (setq ref-dep (intern "none"
2955 gnus-newsgroup-dependencies)))
2956 (setcdr (symbol-value ref-dep)
2957 (nconc (cdr (symbol-value ref-dep))
2959 (set ref-dep (list nil (car th))))
2962 ;; Push all the subthreads onto the stack.
2963 (push (cdr thread) stack)))
2966 (defun gnus-make-threads ()
2967 "Go through the dependency hashtb and find the roots. Return all threads."
2969 (while (catch 'infloop
2972 ;; Deal with self-referencing References loops.
2973 (when (and (car (symbol-value refs))
2980 (car (symbol-value refs)) thread))
2981 (cdr (symbol-value refs)))))))
2984 (unless (car (symbol-value refs))
2985 ;; These threads do not refer back to any other articles,
2986 ;; so they're roots.
2987 (setq threads (append (cdr (symbol-value refs)) threads))))
2988 gnus-newsgroup-dependencies)))
2991 ;; Build the thread tree.
2992 (defsubst gnus-dependencies-add-header (header dependencies force-new)
2993 "Enter HEADER into the DEPENDENCIES table if it is not already there.
2995 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
2996 if it was already present.
2998 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
2999 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3000 Message-IDs will be renamed be renamed to a unique Message-ID before
3003 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3004 (let* ((id (mail-header-id header))
3005 (id-dep (and id (intern id dependencies)))
3006 ref ref-dep ref-header)
3007 ;; Enter this `header' in the `dependencies' table.
3011 ;; The first two cases do the normal part: enter a new `header'
3012 ;; in the `dependencies' table.
3013 ((not (boundp id-dep))
3014 (set id-dep (list header)))
3015 ((null (car (symbol-value id-dep)))
3016 (setcar (symbol-value id-dep) header))
3018 ;; From here the `header' was already present in the
3019 ;; `dependencies' table.
3021 ;; Overrides an existing entry;
3022 ;; just set the header part of the entry.
3023 (setcar (symbol-value id-dep) header))
3025 ;; Renames the existing `header' to a unique Message-ID.
3026 ((not gnus-summary-ignore-duplicates)
3027 ;; An article with this Message-ID has already been seen.
3028 ;; We rename the Message-ID.
3029 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3031 (mail-header-set-id header id))
3033 ;; The last case ignores an existing entry, except it adds any
3034 ;; additional Xrefs (in case the two articles came from different
3036 ;; Also sets `header' to `nil' meaning that the `dependencies'
3037 ;; table was *not* modified.
3039 (mail-header-set-xref
3040 (car (symbol-value id-dep))
3041 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3043 (or (mail-header-xref header) "")))
3047 ;; First check if that we are not creating a References loop.
3048 (setq ref (gnus-parent-id (mail-header-references header)))
3050 (setq ref-dep (intern-soft ref dependencies))
3052 (setq ref-header (car (symbol-value ref-dep))))
3053 (if (string= id ref)
3054 ;; Yuk! This is a reference loop. Make the article be a
3057 (mail-header-set-references (car (symbol-value id-dep)) "none")
3059 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3060 (setq ref (gnus-parent-id (mail-header-references header)))
3061 (setq ref-dep (intern (or ref "none") dependencies))
3062 (if (boundp ref-dep)
3063 (setcdr (symbol-value ref-dep)
3064 (nconc (cdr (symbol-value ref-dep))
3065 (list (symbol-value id-dep))))
3066 (set ref-dep (list nil (symbol-value id-dep)))))
3069 (defun gnus-build-sparse-threads ()
3070 (let ((headers gnus-newsgroup-headers)
3071 (gnus-summary-ignore-duplicates t)
3072 header references generation relations
3073 subject child end new-child date)
3074 ;; First we create an alist of generations/relations, where
3075 ;; generations is how much we trust the relation, and the relation
3077 (gnus-message 7 "Making sparse threads...")
3079 (nnheader-set-temp-buffer " *gnus sparse threads*")
3080 (while (setq header (pop headers))
3081 (when (and (setq references (mail-header-references header))
3082 (not (string= references "")))
3084 (setq child (mail-header-id header)
3085 subject (mail-header-subject header)
3086 date (mail-header-date header)
3088 (while (search-backward ">" nil t)
3089 (setq end (1+ (point)))
3090 (when (search-backward "<" nil t)
3091 (setq new-child (buffer-substring (point) end))
3092 (push (list (incf generation)
3093 child (setq child new-child)
3097 (push (list (1+ generation) child nil subject) relations))
3099 (kill-buffer (current-buffer)))
3100 ;; Sort over trustworthiness.
3103 (when (gnus-dependencies-add-header
3104 (make-full-mail-header
3105 gnus-reffed-article-number
3106 (nth 3 relation) "" (or (nth 4 relation) "")
3108 (or (nth 2 relation) "") 0 0 "")
3109 gnus-newsgroup-dependencies nil)
3110 (push gnus-reffed-article-number gnus-newsgroup-limit)
3111 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3112 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3113 gnus-newsgroup-reads)
3114 (decf gnus-reffed-article-number)))
3115 (sort relations 'car-less-than-car))
3116 (gnus-message 7 "Making sparse threads...done")))
3118 (defun gnus-build-old-threads ()
3119 ;; Look at all the articles that refer back to old articles, and
3120 ;; fetch the headers for the articles that aren't there. This will
3121 ;; build complete threads - if the roots haven't been expired by the
3126 (when (not (car (symbol-value refs)))
3127 (setq heads (cdr (symbol-value refs)))
3129 (if (memq (mail-header-number (caar heads))
3130 gnus-newsgroup-dormant)
3131 (setq heads (cdr heads))
3132 (setq id (symbol-name refs))
3133 (while (and (setq id (gnus-build-get-header id))
3134 (not (car (gnus-id-to-thread id)))))
3135 (setq heads nil)))))
3136 gnus-newsgroup-dependencies)))
3138 (defmacro gnus-nov-read-integer ()
3140 (if (eq (char-after) ?\t)
3142 (let ((num (ignore-errors (read buffer))))
3143 (if (numberp num) num 0)))
3145 (search-forward "\t" eol 'move))))
3147 (defmacro gnus-nov-skip-field ()
3148 '(search-forward "\t" eol 'move))
3150 (defmacro gnus-nov-field ()
3151 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
3153 (defmacro gnus-nov-parse-extra ()
3155 (while (not (memq (char-after) '(?\n nil)))
3156 (setq string (gnus-nov-field))
3157 (when (string-match "^\\([^ :]+\\): " string)
3158 (push (cons (intern (match-string 1 string))
3159 (substring string (match-end 0)))
3163 ;; This function has to be called with point after the article number
3164 ;; on the beginning of the line.
3165 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3166 (let ((eol (gnus-point-at-eol))
3167 (buffer (current-buffer))
3170 ;; overview: [num subject from date id refs chars lines misc]
3173 (narrow-to-region (point) eol)
3178 (make-full-mail-header
3180 (gnus-nov-field) ; subject
3181 (gnus-nov-field) ; from
3182 (gnus-nov-field) ; date
3183 (or (gnus-nov-field)
3184 (nnheader-generate-fake-message-id)) ; id
3185 (gnus-nov-field) ; refs
3186 (gnus-nov-read-integer) ; chars
3187 (gnus-nov-read-integer) ; lines
3188 (unless (eq (char-after) ?\n)
3189 (gnus-nov-field)) ; misc
3190 (gnus-nov-parse-extra)))) ; extra
3194 (when gnus-alter-header-function
3195 (funcall gnus-alter-header-function header))
3196 (gnus-dependencies-add-header header dependencies force-new)))
3198 (defun gnus-build-get-header (id)
3199 ;; Look through the buffer of NOV lines and find the header to
3200 ;; ID. Enter this line into the dependencies hash table, and return
3201 ;; the id of the parent article (if any).
3202 (let ((deps gnus-newsgroup-dependencies)
3206 (set-buffer nntp-server-buffer)
3207 (let ((case-fold-search nil))
3208 (goto-char (point-min))
3209 (while (and (not found)
3210 (search-forward id nil t))
3212 (setq found (looking-at
3213 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3214 (regexp-quote id))))
3215 (or found (beginning-of-line 2)))
3219 (setq header (gnus-nov-parse-line
3220 (read (current-buffer)) deps))
3221 (gnus-parent-id (mail-header-references header))))))
3223 (let ((number (mail-header-number header)))
3224 (push number gnus-newsgroup-limit)
3225 (push header gnus-newsgroup-headers)
3226 (if (memq number gnus-newsgroup-unselected)
3228 (push number gnus-newsgroup-unreads)
3229 (setq gnus-newsgroup-unselected
3230 (delq number gnus-newsgroup-unselected)))
3231 (push number gnus-newsgroup-ancient)))))))
3233 (defun gnus-build-all-threads ()
3234 "Read all the headers."
3235 (let ((gnus-summary-ignore-duplicates t)
3236 (dependencies gnus-newsgroup-dependencies)
3239 (set-buffer nntp-server-buffer)
3240 (let ((case-fold-search nil))
3241 (goto-char (point-min))
3244 (setq article (read (current-buffer))
3245 header (gnus-nov-parse-line
3246 article dependencies)))
3249 (set-buffer gnus-summary-buffer)
3250 (push header gnus-newsgroup-headers)
3251 (if (memq (setq article (mail-header-number header))
3252 gnus-newsgroup-unselected)
3254 (push article gnus-newsgroup-unreads)
3255 (setq gnus-newsgroup-unselected
3256 (delq article gnus-newsgroup-unselected)))
3257 (push article gnus-newsgroup-ancient)))
3258 (forward-line 1)))))))
3260 (defun gnus-summary-update-article-line (article header)
3261 "Update the line for ARTICLE using HEADERS."
3262 (let* ((id (mail-header-id header))
3263 (thread (gnus-id-to-thread id)))
3265 (error "Article in no thread"))
3266 ;; Update the thread.
3267 (setcar thread header)
3268 (gnus-summary-goto-subject article)
3269 (let* ((datal (gnus-data-find-list article))
3271 (length (when (cdr datal)
3272 (- (gnus-data-pos data)
3273 (gnus-data-pos (cadr datal)))))
3274 (buffer-read-only nil)
3275 (level (gnus-summary-thread-level)))
3277 (gnus-summary-insert-line
3278 header level nil (gnus-article-mark article)
3279 (memq article gnus-newsgroup-replied)
3280 (memq article gnus-newsgroup-expirable)
3281 ;; Only insert the Subject string when it's different
3282 ;; from the previous Subject string.
3283 (if (gnus-subject-equal
3285 (mail-header-subject
3288 (gnus-data-find-list
3290 (gnus-data-list t)))))
3291 ;; Error on the side of excessive subjects.
3293 (mail-header-subject header))
3295 (mail-header-subject header))
3296 nil (cdr (assq article gnus-newsgroup-scored))
3297 (memq article gnus-newsgroup-processable))
3299 (gnus-data-update-list
3300 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3302 (defun gnus-summary-update-article (article &optional iheader)
3303 "Update ARTICLE in the summary buffer."
3304 (set-buffer gnus-summary-buffer)
3305 (let* ((header (gnus-summary-article-header article))
3306 (id (mail-header-id header))
3307 (data (gnus-data-find article))
3308 (thread (gnus-id-to-thread id))
3309 (references (mail-header-references header))
3313 (when (and references
3314 (not (equal "" references)))
3317 (buffer-read-only nil)
3323 (delq thread parent)))
3324 (if (gnus-summary-insert-subject id header)
3325 ;; Set the (possibly) new article number in the data structure.
3326 (gnus-data-set-number data (gnus-id-to-article id))
3330 (defun gnus-rebuild-thread (id &optional line)
3331 "Rebuild the thread containing ID.
3332 If LINE, insert the rebuilt thread starting on line LINE."
3333 (let ((buffer-read-only nil)
3334 old-pos current thread data)
3335 (if (not gnus-show-threads)
3336 (setq thread (list (car (gnus-id-to-thread id))))
3337 ;; Get the thread this article is part of.
3338 (setq thread (gnus-remove-thread id)))
3339 (setq old-pos (gnus-point-at-bol))
3340 (setq current (save-excursion
3341 (and (zerop (forward-line -1))
3342 (gnus-summary-article-number))))
3343 ;; If this is a gathered thread, we have to go some re-gathering.
3344 (when (stringp (car thread))
3345 (let ((subject (car thread))
3347 (setq thread (cdr thread))
3349 (unless (memq (setq thr (gnus-id-to-thread
3351 (mail-header-id (caar thread)))))
3354 (setq thread (cdr thread)))
3355 ;; We now have all (unique) roots.
3356 (if (= (length roots) 1)
3357 ;; All the loose roots are now one solid root.
3358 (setq thread (car roots))
3359 (setq thread (cons subject (gnus-sort-threads roots))))))
3361 ;; We then insert this thread into the summary buffer.
3363 (goto-char (point-min))
3364 (forward-line (1- line)))
3365 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3366 (if gnus-show-threads
3367 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3368 (gnus-summary-prepare-unthreaded thread))
3369 (setq data (nreverse gnus-newsgroup-data))
3370 (setq threads gnus-newsgroup-threads))
3371 ;; We splice the new data into the data structure.
3372 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3373 ;;!!! then we want to insert at the beginning of the buffer.
3374 ;;!!! That happens to be true with Gnus now, but that may
3375 ;;!!! change in the future. Perhaps.
3376 (gnus-data-enter-list
3377 (if line nil current) data (- (point) old-pos))
3378 (setq gnus-newsgroup-threads
3379 (nconc threads gnus-newsgroup-threads))
3380 (gnus-data-compute-positions))))
3382 (defun gnus-number-to-header (number)
3383 "Return the header for article NUMBER."
3384 (let ((headers gnus-newsgroup-headers))
3386 (not (= number (mail-header-number (car headers)))))
3391 (defun gnus-parent-headers (in-headers &optional generation)
3392 "Return the headers of the GENERATIONeth parent of HEADERS."
3394 (setq generation 1))
3396 (headers in-headers)
3399 (not (zerop generation))
3400 (setq references (mail-header-references headers)))
3401 (setq headers (if (and references
3402 (setq parent (gnus-parent-id references)))
3403 (car (gnus-id-to-thread parent))
3406 (and (not (eq headers in-headers))
3409 (defun gnus-id-to-thread (id)
3410 "Return the (sub-)thread where ID appears."
3411 (gnus-gethash id gnus-newsgroup-dependencies))
3413 (defun gnus-id-to-article (id)
3414 "Return the article number of ID."
3415 (let ((thread (gnus-id-to-thread id)))
3418 (mail-header-number (car thread)))))
3420 (defun gnus-id-to-header (id)
3421 "Return the article headers of ID."
3422 (car (gnus-id-to-thread id)))
3424 (defun gnus-article-displayed-root-p (article)
3425 "Say whether ARTICLE is a root(ish) article."
3426 (let ((level (gnus-summary-thread-level article))
3427 (refs (mail-header-references (gnus-summary-article-header article)))
3433 ((null (gnus-parent-id refs)) t)
3435 (null (setq particle (gnus-id-to-article
3436 (gnus-parent-id refs))))
3437 (null (gnus-summary-thread-level particle)))))))
3439 (defun gnus-root-id (id)
3440 "Return the id of the root of the thread where ID appears."
3442 (while (and id (setq prev (car (gnus-id-to-thread id))))
3444 id (gnus-parent-id (mail-header-references prev))))
3447 (defun gnus-articles-in-thread (thread)
3448 "Return the list of articles in THREAD."
3449 (cons (mail-header-number (car thread))
3450 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3452 (defun gnus-remove-thread (id &optional dont-remove)
3453 "Remove the thread that has ID in it."
3454 (let (headers thread last-id)
3455 ;; First go up in this thread until we find the root.
3456 (setq last-id (gnus-root-id id)
3457 headers (message-flatten-list (gnus-id-to-thread last-id)))
3458 ;; We have now found the real root of this thread. It might have
3459 ;; been gathered into some loose thread, so we have to search
3460 ;; through the threads to find the thread we wanted.
3461 (let ((threads gnus-newsgroup-threads)
3464 (setq sub (car threads))
3465 (if (stringp (car sub))
3466 ;; This is a gathered thread, so we look at the roots
3467 ;; below it to find whether this article is in this
3470 (setq sub (cdr sub))
3472 (when (member (caar sub) headers)
3473 (setq thread (car threads)
3476 (setq sub (cdr sub))))
3477 ;; It's an ordinary thread, so we check it.
3478 (when (eq (car sub) (car headers))
3481 (setq threads (cdr threads)))
3482 ;; If this article is in no thread, then it's a root.
3485 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3486 (setq thread (gnus-id-to-thread last-id)))
3489 thread ; We return this thread.
3491 (if (stringp (car thread))
3493 ;; If we use dummy roots, then we have to remove the
3494 ;; dummy root as well.
3495 (when (eq gnus-summary-make-false-root 'dummy)
3496 ;; We go to the dummy root by going to
3497 ;; the first sub-"thread", and then one line up.
3498 (gnus-summary-goto-article
3499 (mail-header-number (caadr thread)))
3502 (gnus-data-compute-positions))
3503 (setq thread (cdr thread))
3505 (gnus-remove-thread-1 (car thread))
3506 (setq thread (cdr thread))))
3507 (gnus-summary-show-all-threads)
3508 (gnus-remove-thread-1 thread))))))))
3510 (defun gnus-remove-thread-1 (thread)
3511 "Remove the thread THREAD recursively."
3512 (let ((number (mail-header-number (pop thread)))
3514 (setq thread (reverse thread))
3516 (gnus-remove-thread-1 (pop thread)))
3517 (when (setq d (gnus-data-find number))
3518 (goto-char (gnus-data-pos d))
3521 (- (gnus-point-at-bol)
3523 (1+ (gnus-point-at-eol))
3524 (gnus-delete-line)))))))
3526 (defun gnus-sort-threads (threads)
3528 (if (not gnus-thread-sort-functions)
3530 (gnus-message 8 "Sorting threads...")
3532 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3533 (gnus-message 8 "Sorting threads...done"))))
3535 (defun gnus-sort-articles (articles)
3537 (when gnus-article-sort-functions
3538 (gnus-message 7 "Sorting articles...")
3540 (setq gnus-newsgroup-headers
3541 (sort articles (gnus-make-sort-function
3542 gnus-article-sort-functions)))
3543 (gnus-message 7 "Sorting articles...done"))))
3545 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3546 (defmacro gnus-thread-header (thread)
3547 ;; Return header of first article in THREAD.
3548 ;; Note that THREAD must never, ever be anything else than a variable -
3549 ;; using some other form will lead to serious barfage.
3550 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3551 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3552 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3555 (defsubst gnus-article-sort-by-number (h1 h2)
3556 "Sort articles by article number."
3557 (< (mail-header-number h1)
3558 (mail-header-number h2)))
3560 (defun gnus-thread-sort-by-number (h1 h2)
3561 "Sort threads by root article number."
3562 (gnus-article-sort-by-number
3563 (gnus-thread-header h1) (gnus-thread-header h2)))
3565 (defsubst gnus-article-sort-by-lines (h1 h2)
3566 "Sort articles by article Lines header."
3567 (< (mail-header-lines h1)
3568 (mail-header-lines h2)))
3570 (defun gnus-thread-sort-by-lines (h1 h2)
3571 "Sort threads by root article Lines header."
3572 (gnus-article-sort-by-lines
3573 (gnus-thread-header h1) (gnus-thread-header h2)))
3575 (defsubst gnus-article-sort-by-author (h1 h2)
3576 "Sort articles by root author."
3578 (let ((addr (mime-read-field 'From h1)))
3579 (or (std11-full-name-string addr)
3580 (std11-address-string addr)
3582 (let ((addr (mime-read-field 'From h2)))
3583 (or (std11-full-name-string addr)
3584 (std11-address-string addr)
3588 (defun gnus-thread-sort-by-author (h1 h2)
3589 "Sort threads by root author."
3590 (gnus-article-sort-by-author
3591 (gnus-thread-header h1) (gnus-thread-header h2)))
3593 (defsubst gnus-article-sort-by-subject (h1 h2)
3594 "Sort articles by root subject."
3596 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3597 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3599 (defun gnus-thread-sort-by-subject (h1 h2)
3600 "Sort threads by root subject."
3601 (gnus-article-sort-by-subject
3602 (gnus-thread-header h1) (gnus-thread-header h2)))
3604 (defsubst gnus-article-sort-by-date (h1 h2)
3605 "Sort articles by root article date."
3607 (gnus-date-get-time (mail-header-date h1))
3608 (gnus-date-get-time (mail-header-date h2))))
3610 (defun gnus-thread-sort-by-date (h1 h2)
3611 "Sort threads by root article date."
3612 (gnus-article-sort-by-date
3613 (gnus-thread-header h1) (gnus-thread-header h2)))
3615 (defsubst gnus-article-sort-by-score (h1 h2)
3616 "Sort articles by root article score.
3617 Unscored articles will be counted as having a score of zero."
3618 (> (or (cdr (assq (mail-header-number h1)
3619 gnus-newsgroup-scored))
3620 gnus-summary-default-score 0)
3621 (or (cdr (assq (mail-header-number h2)
3622 gnus-newsgroup-scored))
3623 gnus-summary-default-score 0)))
3625 (defun gnus-thread-sort-by-score (h1 h2)
3626 "Sort threads by root article score."
3627 (gnus-article-sort-by-score
3628 (gnus-thread-header h1) (gnus-thread-header h2)))
3630 (defun gnus-thread-sort-by-total-score (h1 h2)
3631 "Sort threads by the sum of all scores in the thread.
3632 Unscored articles will be counted as having a score of zero."
3633 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3635 (defun gnus-thread-total-score (thread)
3636 ;; This function find the total score of THREAD.
3637 (cond ((null thread)
3640 (if (stringp (car thread))
3641 (apply gnus-thread-score-function 0
3642 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3643 (gnus-thread-total-score-1 thread)))
3645 (gnus-thread-total-score-1 (list thread)))))
3647 (defun gnus-thread-total-score-1 (root)
3648 ;; This function find the total score of the thread below ROOT.
3649 (setq root (car root))
3650 (apply gnus-thread-score-function
3652 (mapcar 'gnus-thread-total-score
3653 (cdr (gnus-id-to-thread (mail-header-id root))))
3654 (when (> (mail-header-number root) 0)
3655 (list (or (cdr (assq (mail-header-number root)
3656 gnus-newsgroup-scored))
3657 gnus-summary-default-score 0))))
3658 (list gnus-summary-default-score)
3661 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3662 (defvar gnus-tmp-prev-subject nil)
3663 (defvar gnus-tmp-false-parent nil)
3664 (defvar gnus-tmp-root-expunged nil)
3665 (defvar gnus-tmp-dummy-line nil)
3667 (defvar gnus-tmp-header)
3668 (defun gnus-extra-header (type &optional header)
3669 "Return the extra header of TYPE."
3670 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3673 (defun gnus-summary-prepare-threads (threads)
3674 "Prepare summary buffer from THREADS and indentation LEVEL.
3675 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3676 or a straight list of headers."
3677 (gnus-message 7 "Generating summary...")
3679 (setq gnus-newsgroup-threads threads)
3682 (let ((gnus-tmp-level 0)
3683 (default-score (or gnus-summary-default-score 0))
3684 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3685 thread number subject stack state gnus-tmp-gathered beg-match
3686 new-roots gnus-tmp-new-adopts thread-end
3687 gnus-tmp-header gnus-tmp-unread
3688 gnus-tmp-replied gnus-tmp-subject-or-nil
3689 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3690 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3691 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3693 (setq gnus-tmp-prev-subject nil)
3695 (if (vectorp (car threads))
3696 ;; If this is a straight (sic) list of headers, then a
3697 ;; threaded summary display isn't required, so we just create
3698 ;; an unthreaded one.
3699 (gnus-summary-prepare-unthreaded threads)
3701 ;; Do the threaded display.
3703 (while (or threads stack gnus-tmp-new-adopts new-roots)
3705 (if (and (= gnus-tmp-level 0)
3708 (not gnus-tmp-false-parent)
3709 (or gnus-tmp-new-adopts new-roots))
3710 (if gnus-tmp-new-adopts
3711 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3712 thread (list (car gnus-tmp-new-adopts))
3713 gnus-tmp-header (caar thread)
3714 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3716 (setq thread (list (car new-roots))
3717 gnus-tmp-header (caar thread)
3718 new-roots (cdr new-roots))))
3721 ;; If there are some threads, we do them before the
3722 ;; threads on the stack.
3723 (setq thread threads
3724 gnus-tmp-header (caar thread))
3725 ;; There were no current threads, so we pop something off
3727 (setq state (car stack)
3728 gnus-tmp-level (car state)
3731 gnus-tmp-header (caar thread))))
3733 (setq gnus-tmp-false-parent nil)
3734 (setq gnus-tmp-root-expunged nil)
3735 (setq thread-end nil)
3737 (if (stringp gnus-tmp-header)
3738 ;; The header is a dummy root.
3740 ((eq gnus-summary-make-false-root 'adopt)
3741 ;; We let the first article adopt the rest.
3742 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3744 (setq gnus-tmp-gathered
3746 (lambda (h) (mail-header-number (car h)))
3749 (setq thread (cons (list (caar thread)
3752 (setq gnus-tmp-level -1
3753 gnus-tmp-false-parent t))
3754 ((eq gnus-summary-make-false-root 'empty)
3755 ;; We print adopted articles with empty subject fields.
3756 (setq gnus-tmp-gathered
3758 (lambda (h) (mail-header-number (car h)))
3761 (setq gnus-tmp-level -1))
3762 ((eq gnus-summary-make-false-root 'dummy)
3763 ;; We remember that we probably want to output a dummy
3765 (setq gnus-tmp-dummy-line gnus-tmp-header)
3766 (setq gnus-tmp-prev-subject gnus-tmp-header))
3768 ;; We do not make a root for the gathered
3769 ;; sub-threads at all.
3770 (setq gnus-tmp-level -1)))
3772 (setq number (mail-header-number gnus-tmp-header)
3773 subject (mail-header-subject gnus-tmp-header))
3776 ;; If the thread has changed subject, we might want to make
3777 ;; this subthread into a root.
3778 ((and (null gnus-thread-ignore-subject)
3779 (not (zerop gnus-tmp-level))
3780 gnus-tmp-prev-subject
3782 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3783 (setq new-roots (nconc new-roots (list (car thread)))
3785 gnus-tmp-header nil))
3786 ;; If the article lies outside the current limit,
3787 ;; then we do not display it.
3788 ((not (memq number gnus-newsgroup-limit))
3789 (setq gnus-tmp-gathered
3791 (lambda (h) (mail-header-number (car h)))
3794 (setq gnus-tmp-new-adopts (if (cdar thread)
3795 (append gnus-tmp-new-adopts
3797 gnus-tmp-new-adopts)
3799 gnus-tmp-header nil)
3800 (when (zerop gnus-tmp-level)
3801 (setq gnus-tmp-root-expunged t)))
3802 ;; Perhaps this article is to be marked as read?
3803 ((and gnus-summary-mark-below
3804 (< (or (cdr (assq number gnus-newsgroup-scored))
3806 gnus-summary-mark-below)
3807 ;; Don't touch sparse articles.
3808 (not (gnus-summary-article-sparse-p number))
3809 (not (gnus-summary-article-ancient-p number)))
3810 (setq gnus-newsgroup-unreads
3811 (delq number gnus-newsgroup-unreads))
3812 (if gnus-newsgroup-auto-expire
3813 (push number gnus-newsgroup-expirable)
3814 (push (cons number gnus-low-score-mark)
3815 gnus-newsgroup-reads))))
3817 (when gnus-tmp-header
3818 ;; We may have an old dummy line to output before this
3820 (when (and gnus-tmp-dummy-line
3823 (mail-header-subject gnus-tmp-header)))
3824 (gnus-summary-insert-dummy-line
3825 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3826 (setq gnus-tmp-dummy-line nil))
3828 ;; Compute the mark.
3829 (setq gnus-tmp-unread (gnus-article-mark number))
3831 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3832 gnus-tmp-header gnus-tmp-level)
3833 gnus-newsgroup-data)
3835 ;; Actually insert the line.
3837 gnus-tmp-subject-or-nil
3839 ((and gnus-thread-ignore-subject
3840 gnus-tmp-prev-subject
3841 (not (inline (gnus-subject-equal
3842 gnus-tmp-prev-subject subject))))
3844 ((zerop gnus-tmp-level)
3845 (if (and (eq gnus-summary-make-false-root 'empty)
3846 (memq number gnus-tmp-gathered)
3847 gnus-tmp-prev-subject
3848 (inline (gnus-subject-equal
3849 gnus-tmp-prev-subject subject)))
3850 gnus-summary-same-subject
3852 (t gnus-summary-same-subject)))
3853 (if (and (eq gnus-summary-make-false-root 'adopt)
3854 (= gnus-tmp-level 1)
3855 (memq number gnus-tmp-gathered))
3856 (setq gnus-tmp-opening-bracket ?\<
3857 gnus-tmp-closing-bracket ?\>)
3858 (setq gnus-tmp-opening-bracket ?\[
3859 gnus-tmp-closing-bracket ?\]))
3861 gnus-tmp-indentation
3862 (aref gnus-thread-indent-array gnus-tmp-level)
3863 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3864 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3865 gnus-summary-default-score 0)
3867 (if (or (null gnus-summary-default-score)
3868 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3869 gnus-summary-zcore-fuzz))
3871 (if (< gnus-tmp-score gnus-summary-default-score)
3872 gnus-score-below-mark gnus-score-over-mark))
3874 (cond ((memq number gnus-newsgroup-processable)
3876 ((memq number gnus-newsgroup-cached)
3878 ((memq number gnus-newsgroup-replied)
3880 ((memq number gnus-newsgroup-saved)
3882 (t gnus-unread-mark))
3883 gnus-tmp-from (mail-header-from gnus-tmp-header)
3886 ((string-match "<[^>]+> *$" gnus-tmp-from)
3887 (setq beg-match (match-beginning 0))
3888 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3889 (substring gnus-tmp-from (1+ (match-beginning 0))
3890 (1- (match-end 0))))
3891 (substring gnus-tmp-from 0 beg-match)))
3892 ((string-match "(.+)" gnus-tmp-from)
3893 (substring gnus-tmp-from
3894 (1+ (match-beginning 0)) (1- (match-end 0))))
3896 (when (string= gnus-tmp-name "")
3897 (setq gnus-tmp-name gnus-tmp-from))
3898 (unless (numberp gnus-tmp-lines)
3899 (setq gnus-tmp-lines 0))
3900 (gnus-put-text-property
3902 (progn (eval gnus-summary-line-format-spec) (point))
3903 'gnus-number number)
3906 (gnus-run-hooks 'gnus-summary-update-hook)
3909 (setq gnus-tmp-prev-subject subject)))
3911 (when (nth 1 thread)
3912 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3913 (incf gnus-tmp-level)
3914 (setq threads (if thread-end nil (cdar thread)))
3916 (setq gnus-tmp-level 0)))))
3917 (gnus-message 7 "Generating summary...done"))
3919 (defun gnus-summary-prepare-unthreaded (headers)
3920 "Generate an unthreaded summary buffer based on HEADERS."
3921 (let (header number mark)
3926 ;; We may have to root out some bad articles...
3927 (when (memq (setq number (mail-header-number
3928 (setq header (pop headers))))
3929 gnus-newsgroup-limit)
3930 ;; Mark article as read when it has a low score.
3931 (when (and gnus-summary-mark-below
3932 (< (or (cdr (assq number gnus-newsgroup-scored))
3933 gnus-summary-default-score 0)
3934 gnus-summary-mark-below)
3935 (not (gnus-summary-article-ancient-p number)))
3936 (setq gnus-newsgroup-unreads
3937 (delq number gnus-newsgroup-unreads))
3938 (if gnus-newsgroup-auto-expire
3939 (push number gnus-newsgroup-expirable)
3940 (push (cons number gnus-low-score-mark)
3941 gnus-newsgroup-reads)))
3943 (setq mark (gnus-article-mark number))
3944 (push (gnus-data-make number mark (1+ (point)) header 0)
3945 gnus-newsgroup-data)
3946 (gnus-summary-insert-line
3948 mark (memq number gnus-newsgroup-replied)
3949 (memq number gnus-newsgroup-expirable)
3950 (mail-header-subject header) nil
3951 (cdr (assq number gnus-newsgroup-scored))
3952 (memq number gnus-newsgroup-processable))))))
3954 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3955 "Select newsgroup GROUP.
3956 If READ-ALL is non-nil, all articles in the group are selected.
3957 If SELECT-ARTICLES, only select those articles from GROUP."
3958 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3959 ;;!!! Dirty hack; should be removed.
3960 (gnus-summary-ignore-duplicates
3961 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3963 gnus-summary-ignore-duplicates))
3964 (info (nth 2 entry))
3965 articles fetched-articles cached)
3967 (unless (gnus-check-server
3968 (setq gnus-current-select-method
3969 (gnus-find-method-for-group group)))
3970 (error "Couldn't open server"))
3972 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3973 (gnus-activate-group group) ; Or we can activate it...
3974 (progn ; Or we bug out.
3975 (when (equal major-mode 'gnus-summary-mode)
3976 (kill-buffer (current-buffer)))
3977 (error "Couldn't request group %s: %s"
3978 group (gnus-status-message group))))
3980 (unless (gnus-request-group group t)
3981 (when (equal major-mode 'gnus-summary-mode)
3982 (kill-buffer (current-buffer)))
3983 (error "Couldn't request group %s: %s"
3984 group (gnus-status-message group)))
3986 (setq gnus-newsgroup-name group)
3987 (setq gnus-newsgroup-unselected nil)
3988 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3990 ;; Adjust and set lists of article marks.
3992 (gnus-adjust-marked-articles info))
3994 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3995 (when (gnus-virtual-group-p group)
3996 (setq cached gnus-newsgroup-cached))
3998 (setq gnus-newsgroup-unreads
3999 (gnus-set-difference
4000 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4001 gnus-newsgroup-dormant))
4003 (setq gnus-newsgroup-processable nil)
4005 (gnus-update-read-articles group gnus-newsgroup-unreads)
4007 (if (setq articles select-articles)
4008 (setq gnus-newsgroup-unselected
4009 (gnus-sorted-intersection
4010 gnus-newsgroup-unreads
4011 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4012 (setq articles (gnus-articles-to-read group read-all)))
4016 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4018 ((eq articles 0) nil)
4020 ;; Init the dependencies hash table.
4021 (setq gnus-newsgroup-dependencies
4022 (gnus-make-hashtable (length articles)))
4023 (gnus-set-global-variables)
4024 ;; Retrieve the headers and read them in.
4025 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4026 (setq gnus-newsgroup-headers
4028 (setq gnus-headers-retrieved-by
4029 (gnus-retrieve-headers
4030 articles gnus-newsgroup-name
4031 ;; We might want to fetch old headers, but
4032 ;; not if there is only 1 article.
4034 (not (eq gnus-fetch-old-headers 'some))
4035 (not (numberp gnus-fetch-old-headers)))
4036 (> (length articles) 1))
4037 gnus-fetch-old-headers))))
4038 (gnus-get-newsgroup-headers-xover
4039 articles nil nil gnus-newsgroup-name t)
4040 (gnus-get-newsgroup-headers)))
4041 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4043 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4045 (setq gnus-newsgroup-cached cached))
4047 ;; Suppress duplicates?
4048 (when gnus-suppress-duplicates
4049 (gnus-dup-suppress-articles))
4051 ;; Set the initial limit.
4052 (setq gnus-newsgroup-limit (copy-sequence articles))
4053 ;; Remove canceled articles from the list of unread articles.
4054 (setq gnus-newsgroup-unreads
4055 (gnus-set-sorted-intersection
4056 gnus-newsgroup-unreads
4057 (setq fetched-articles
4058 (mapcar (lambda (headers) (mail-header-number headers))
4059 gnus-newsgroup-headers))))
4060 ;; Removed marked articles that do not exist.
4061 (gnus-update-missing-marks
4062 (gnus-sorted-complement fetched-articles articles))
4063 ;; We might want to build some more threads first.
4064 (when (and gnus-fetch-old-headers
4065 (eq gnus-headers-retrieved-by 'nov))
4066 (if (eq gnus-fetch-old-headers 'invisible)
4067 (gnus-build-all-threads)
4068 (gnus-build-old-threads)))
4069 ;; Let the Gnus agent mark articles as read.
4071 (gnus-agent-get-undownloaded-list))
4072 ;; Check whether auto-expire is to be done in this group.
4073 (setq gnus-newsgroup-auto-expire
4074 (gnus-group-auto-expirable-p group))
4075 ;; Set up the article buffer now, if necessary.
4076 (unless gnus-single-article-buffer
4077 (gnus-article-setup-buffer))
4078 ;; First and last article in this newsgroup.
4079 (when gnus-newsgroup-headers
4080 (setq gnus-newsgroup-begin
4081 (mail-header-number (car gnus-newsgroup-headers))
4084 (gnus-last-element gnus-newsgroup-headers))))
4085 ;; GROUP is successfully selected.
4086 (or gnus-newsgroup-headers t)))))
4088 (defun gnus-articles-to-read (group &optional read-all)
4089 ;; Find out what articles the user wants to read.
4091 ;; Select all articles if `read-all' is non-nil, or if there
4092 ;; are no unread articles.
4094 (and (zerop (length gnus-newsgroup-marked))
4095 (zerop (length gnus-newsgroup-unreads)))
4096 (eq (gnus-group-find-parameter group 'display)
4098 (gnus-uncompress-range (gnus-active group))
4099 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4100 (copy-sequence gnus-newsgroup-unreads))
4102 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4103 (scored (length scored-list))
4104 (number (length articles))
4105 (marked (+ (length gnus-newsgroup-marked)
4106 (length gnus-newsgroup-dormant)))
4114 ((and (or (<= scored marked) (= scored number))
4115 (numberp gnus-large-newsgroup)
4116 (> number gnus-large-newsgroup))
4120 "How many articles from %s (default %d): "
4121 (gnus-limit-string gnus-newsgroup-name 35)
4123 (if (string-match "^[ \t]*$" input) number input)))
4124 ((and (> scored marked) (< scored number)
4125 (> (- scored number) 20))
4128 (format "%s %s (%d scored, %d total): "
4129 "How many articles from"
4130 group scored number))))
4131 (if (string-match "^[ \t]*$" input)
4135 (setq select (if (stringp select) (string-to-number select) select))
4136 (if (or (null select) (zerop select))
4138 (if (and (not (zerop scored)) (<= (abs select) scored))
4140 (setq articles (sort scored-list '<))
4141 (setq number (length articles)))
4142 (setq articles (copy-sequence articles)))
4144 (when (< (abs select) number)
4146 ;; Select the N oldest articles.
4147 (setcdr (nthcdr (1- (abs select)) articles) nil)
4148 ;; Select the N most recent articles.
4149 (setq articles (nthcdr (- number select) articles))))
4150 (setq gnus-newsgroup-unselected
4151 (gnus-sorted-intersection
4152 gnus-newsgroup-unreads
4153 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4156 (defun gnus-killed-articles (killed articles)
4159 (when (inline (gnus-member-of-range (car articles) killed))
4160 (push (car articles) out))
4161 (setq articles (cdr articles)))
4164 (defun gnus-uncompress-marks (marks)
4165 "Uncompress the mark ranges in MARKS."
4166 (let ((uncompressed '(score bookmark))
4169 (if (memq (caar marks) uncompressed)
4170 (push (car marks) out)
4171 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4172 (setq marks (cdr marks)))
4175 (defun gnus-adjust-marked-articles (info)
4176 "Set all article lists and remove all marks that are no longer legal."
4177 (let* ((marked-lists (gnus-info-marks info))
4178 (active (gnus-active (gnus-info-group info)))
4181 (types gnus-article-mark-lists)
4182 (uncompressed '(score bookmark killed))
4183 marks var articles article mark)
4186 (setq marks (pop marked-lists))
4187 (set (setq var (intern (format "gnus-newsgroup-%s"
4188 (car (rassq (setq mark (car marks))
4190 (if (memq (car marks) uncompressed) (cdr marks)
4191 (gnus-uncompress-range (cdr marks))))
4193 (setq articles (symbol-value var))
4195 ;; All articles have to be subsets of the active articles.
4197 ;; Adjust "simple" lists.
4198 ((memq mark '(tick dormant expire reply save))
4200 (when (or (< (setq article (pop articles)) min) (> article max))
4201 (set var (delq article (symbol-value var))))))
4203 ((memq mark uncompressed)
4204 (when (not (listp (cdr (symbol-value var))))
4205 (set var (list (symbol-value var))))
4206 (when (not (listp (cdr articles)))
4207 (setq articles (list articles)))
4209 (when (or (not (consp (setq article (pop articles))))
4210 (< (car article) min)
4211 (> (car article) max))
4212 (set var (delq article (symbol-value var))))))))))
4214 (defun gnus-update-missing-marks (missing)
4215 "Go through the list of MISSING articles and remove them from the mark lists."
4217 (let ((types gnus-article-mark-lists)
4219 ;; Go through all types.
4221 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4222 (when (symbol-value var)
4223 ;; This list has articles. So we delete all missing articles
4227 (set var (delq (pop m) (symbol-value var)))))))))
4229 (defun gnus-update-marks ()
4230 "Enter the various lists of marked articles into the newsgroup info list."
4231 (let ((types gnus-article-mark-lists)
4232 (info (gnus-get-info gnus-newsgroup-name))
4233 (uncompressed '(score bookmark killed))
4234 type list newmarked symbol delta-marks)
4236 ;; Add all marks lists that are non-nil to the list of marks lists.
4237 (while (setq type (pop types))
4238 (when (setq list (symbol-value
4240 (intern (format "gnus-newsgroup-%s"
4243 ;; Get rid of the entries of the articles that have the
4245 (when (and (eq (cdr type) 'score)
4249 (prev (cons nil list))
4252 (if (or (not (consp (car arts)))
4253 (= (cdar arts) gnus-summary-default-score))
4254 (setcdr prev (cdr arts))
4256 (setq arts (cdr arts)))
4257 (setq list (cdr all))))
4259 (push (cons (cdr type)
4260 (if (memq (cdr type) uncompressed) list
4261 (gnus-compress-sequence
4262 (set symbol (sort list '<)) t)))
4265 ;; Enter these new marks into the info of the group.
4267 (setcar (nthcdr 3 info) newmarked)
4268 ;; Add the marks lists to the end of the info.
4270 (setcdr (nthcdr 2 info) (list newmarked))))
4272 ;; Cut off the end of the info if there's nothing else there.
4276 (when (nthcdr (decf i) info)
4277 (setcdr (nthcdr i info) nil)))))))
4279 (defun gnus-set-mode-line (where)
4280 "This function sets the mode line of the article or summary buffers.
4281 If WHERE is `summary', the summary mode line format will be used."
4282 ;; Is this mode line one we keep updated?
4283 (when (and (memq where gnus-updated-mode-lines)
4285 (intern (format "gnus-%s-mode-line-format-spec" where))))
4288 ;; We evaluate this in the summary buffer since these
4289 ;; variables are buffer-local to that buffer.
4290 (set-buffer gnus-summary-buffer)
4291 ;; We bind all these variables that are used in the `eval' form
4293 (let* ((mformat (symbol-value
4295 (format "gnus-%s-mode-line-format-spec" where))))
4296 (gnus-tmp-group-name gnus-newsgroup-name)
4297 (gnus-tmp-article-number (or gnus-current-article 0))
4298 (gnus-tmp-unread gnus-newsgroup-unreads)
4299 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4300 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4301 (gnus-tmp-unread-and-unselected
4302 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4303 (zerop gnus-tmp-unselected))
4305 ((zerop gnus-tmp-unselected)
4306 (format "{%d more}" gnus-tmp-unread-and-unticked))
4307 (t (format "{%d(+%d) more}"
4308 gnus-tmp-unread-and-unticked
4309 gnus-tmp-unselected))))
4311 (if (and gnus-current-headers
4312 (vectorp gnus-current-headers))
4313 (gnus-mode-string-quote
4314 (mail-header-subject gnus-current-headers))
4316 bufname-length max-len
4317 gnus-tmp-header);; passed as argument to any user-format-funcs
4318 (setq mode-string (eval mformat))
4319 (setq bufname-length (if (string-match "%b" mode-string)
4322 (if (eq where 'summary)
4324 (get-buffer gnus-article-buffer))))
4327 (setq max-len (max 4 (if gnus-mode-non-string-length
4329 gnus-mode-non-string-length
4331 (length mode-string))))
4332 ;; We might have to chop a bit of the string off...
4333 (when (> (length mode-string) max-len)
4335 (concat (gnus-truncate-string mode-string (- max-len 3))
4337 ;; Pad the mode string a bit.
4338 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4339 ;; Update the mode line.
4340 (setq mode-line-buffer-identification
4341 (gnus-mode-line-buffer-identification (list mode-string)))
4342 (set-buffer-modified-p t))))
4344 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4345 "Go through the HEADERS list and add all Xrefs to a hash table.
4346 The resulting hash table is returned, or nil if no Xrefs were found."
4347 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4348 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4349 (xref-hashtb (gnus-make-hashtable))
4350 start group entry number xrefs header)
4352 (setq header (pop headers))
4353 (when (and (setq xrefs (mail-header-xref header))
4354 (not (memq (setq number (mail-header-number header))
4357 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4358 (setq start (match-end 0))
4359 (setq group (if prefix
4360 (concat prefix (substring xrefs (match-beginning 1)
4362 (substring xrefs (match-beginning 1) (match-end 1))))
4364 (string-to-int (substring xrefs (match-beginning 2)
4366 (if (setq entry (gnus-gethash group xref-hashtb))
4367 (setcdr entry (cons number (cdr entry)))
4368 (gnus-sethash group (cons number nil) xref-hashtb)))))
4369 (and start xref-hashtb)))
4371 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4372 "Look through all the headers and mark the Xrefs as read."
4373 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4374 name entry info xref-hashtb idlist method nth4)
4376 (set-buffer gnus-group-buffer)
4377 (when (setq xref-hashtb
4378 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4381 (unless (string= from-newsgroup (setq name (symbol-name group)))
4382 (setq idlist (symbol-value group))
4383 ;; Dead groups are not updated.
4385 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4387 (when (stringp (setq nth4 (gnus-info-method info)))
4388 (setq nth4 (gnus-server-to-method nth4))))
4389 ;; Only do the xrefs if the group has the same
4390 ;; select method as the group we have just read.
4391 (or (gnus-methods-equal-p
4392 nth4 (gnus-find-method-for-group from-newsgroup))
4394 (equal nth4 (setq method (gnus-find-method-for-group
4396 (and (equal (car nth4) (car method))
4397 (equal (nth 1 nth4) (nth 1 method))))
4398 gnus-use-cross-reference
4399 (or (not (eq gnus-use-cross-reference t))
4401 ;; Only do cross-references on subscribed
4402 ;; groups, if that is what is wanted.
4403 (<= (gnus-info-level info) gnus-level-subscribed))
4404 (gnus-group-make-articles-read name idlist))))
4407 (defun gnus-compute-read-articles (group articles)
4408 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4409 (info (nth 2 entry))
4410 (active (gnus-active group))
4413 ;; First peel off all illegal article numbers.
4415 (let ((ids articles)
4417 (while (setq id (pop ids))
4418 (when (and first (> id (cdr active)))
4419 ;; We'll end up in this situation in one particular
4420 ;; obscure situation. If you re-scan a group and get
4421 ;; a new article that is cross-posted to a different
4422 ;; group that has not been re-scanned, you might get
4423 ;; crossposted article that has a higher number than
4424 ;; Gnus believes possible. So we re-activate this
4425 ;; group as well. This might mean doing the
4426 ;; crossposting thingy will *increase* the number
4427 ;; of articles in some groups. Tsk, tsk.
4428 (setq active (or (gnus-activate-group group) active)))
4429 (when (or (> id (cdr active))
4430 (< id (car active)))
4431 (setq articles (delq id articles))))))
4432 ;; If the read list is nil, we init it.
4434 (null (gnus-info-read info))
4436 (setq ninfo (cons 1 (1- (car active))))
4437 (setq ninfo (gnus-info-read info)))
4438 ;; Then we add the read articles to the range.
4440 ninfo (setq articles (sort articles '<))))))
4442 (defun gnus-group-make-articles-read (group articles)
4443 "Update the info of GROUP to say that ARTICLES are read."
4445 (entry (gnus-gethash group gnus-newsrc-hashtb))
4446 (info (nth 2 entry))
4447 (active (gnus-active group))
4450 (setq range (gnus-compute-read-articles group articles))
4452 (set-buffer gnus-group-buffer)
4455 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4456 (gnus-info-set-read ',info ',(gnus-info-read info))
4457 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4458 (gnus-group-update-group ,group t))))
4459 ;; Add the read articles to the range.
4460 (gnus-info-set-read info range)
4461 ;; Then we have to re-compute how many unread
4462 ;; articles there are in this group.
4466 (setq num (- (1+ (cdr active)) (car active))))
4467 ((not (listp (cdr range)))
4468 (setq num (- (cdr active) (- (1+ (cdr range))
4472 (if (numberp (car range))
4474 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4475 (setq range (cdr range)))
4476 (setq num (- (cdr active) num))))
4477 ;; Update the number of unread articles.
4479 ;; Update the group buffer.
4480 (gnus-group-update-group group t)))))
4482 (defun gnus-methods-equal-p (m1 m2)
4483 (let ((m1 (or m1 gnus-select-method))
4484 (m2 (or m2 gnus-select-method)))
4486 (and (eq (car m1) (car m2))
4487 (or (not (memq 'address (assoc (symbol-name (car m1))
4488 gnus-valid-select-methods)))
4489 (equal (nth 1 m1) (nth 1 m2)))))))
4491 (defvar gnus-newsgroup-none-id 0)
4493 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4494 (let ((cur nntp-server-buffer)
4497 (save-excursion (set-buffer gnus-summary-buffer)
4498 gnus-newsgroup-dependencies)))
4500 (rfc2047-default-charset gnus-newsgroup-default-charset)
4501 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
4503 (set-buffer nntp-server-buffer)
4504 ;; Translate all TAB characters into SPACE characters.
4505 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4506 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4507 (gnus-run-hooks 'gnus-parse-headers-hook)
4508 (let ((case-fold-search t)
4509 in-reply-to header p lines chars ctype)
4510 (goto-char (point-min))
4511 ;; Search to the beginning of the next header. Error messages
4512 ;; do not begin with 2 or 3.
4513 (while (re-search-forward "^[23][0-9]+ " nil t)
4516 ;; This implementation of this function, with nine
4517 ;; search-forwards instead of the one re-search-forward and
4518 ;; a case (which basically was the old function) is actually
4519 ;; about twice as fast, even though it looks messier. You
4520 ;; can't have everything, I guess. Speed and elegance
4521 ;; doesn't always go hand in hand.
4524 (make-full-mail-header
4530 (narrow-to-region (point)
4531 (or (and (search-forward "\n.\n" nil t)
4537 (if (search-forward "\nsubject: " nil t)
4538 (buffer-substring (match-end 0) (std11-field-end))
4543 (if (search-forward "\nfrom: " nil t)
4544 (buffer-substring (match-end 0) (std11-field-end))
4549 (if (search-forward "\ndate: " nil t)
4550 (buffer-substring (match-end 0) (std11-field-end))
4555 (setq id (if (re-search-forward
4556 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4557 ;; We do it this way to make sure the Message-ID
4558 ;; is (somewhat) syntactically valid.
4559 (buffer-substring (match-beginning 1)
4561 ;; If there was no message-id, we just fake one
4562 ;; to make subsequent routines simpler.
4563 (nnheader-generate-fake-message-id))))
4567 (if (search-forward "\nreferences: " nil t)
4571 (buffer-substring (match-end 0) (std11-field-end))
4576 (search-backward ">" end t)
4579 (search-backward "<" end t)
4581 ;; Get the references from the in-reply-to header if there
4582 ;; were no references and the in-reply-to header looks
4584 (if (and (search-forward "\nin-reply-to: " nil t)
4586 (buffer-substring (match-end 0)
4588 (string-match "<[^>]+>" in-reply-to))
4590 (setq ref (substring in-reply-to (match-beginning 0)
4592 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4593 (setq ref2 (substring in-reply-to (match-beginning 0)
4595 (when (> (length ref2) (length ref))
4602 (if (search-forward "\nchars: " nil t)
4603 (if (numberp (setq chars (ignore-errors (read cur))))
4609 (if (search-forward "\nlines: " nil t)
4610 (if (numberp (setq lines (ignore-errors (read cur))))
4616 (and (search-forward "\nxref: " nil t)
4617 (buffer-substring (match-end 0) (std11-field-end))))
4619 (when gnus-extra-headers
4620 (let ((extra gnus-extra-headers)
4624 (when (search-forward
4625 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4626 (push (cons (car extra)
4627 (buffer-substring (match-end 0)
4633 (if (and (search-forward "\ncontent-type: " nil t)
4635 (buffer-substring (match-end 0) (std11-field-end))))
4636 (mime-entity-set-content-type-internal
4637 header (mime-parse-Content-Type ctype)))
4638 (when (equal id ref)
4641 (when gnus-alter-header-function
4642 (funcall gnus-alter-header-function header)
4643 (setq id (mail-header-id header)
4644 ref (gnus-parent-id (mail-header-references header))))
4647 (gnus-dependencies-add-header
4648 header dependencies force-new))
4649 (push header headers))
4650 (goto-char (point-max))
4652 (nreverse headers)))))
4654 ;; Goes through the xover lines and returns a list of vectors
4655 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4656 force-new dependencies
4657 group also-fetch-heads)
4658 "Parse the news overview data in the server buffer, and return a
4659 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4660 ;; Get the Xref when the users reads the articles since most/some
4661 ;; NNTP servers do not include Xrefs when using XOVER.
4662 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4663 (let ((rfc2047-default-charset gnus-newsgroup-default-charset)
4664 (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced)
4665 (cur nntp-server-buffer)
4666 (dependencies (or dependencies gnus-newsgroup-dependencies))
4667 number headers header)
4669 (set-buffer nntp-server-buffer)
4670 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4671 ;; Allow the user to mangle the headers before parsing them.
4672 (gnus-run-hooks 'gnus-parse-headers-hook)
4673 (goto-char (point-min))
4676 (while (and sequence (not (eobp)))
4677 (setq number (read cur))
4678 (while (and sequence
4679 (< (car sequence) number))
4680 (setq sequence (cdr sequence)))
4682 (eq number (car sequence))
4684 (setq sequence (cdr sequence))
4685 (setq header (inline
4686 (gnus-nov-parse-line
4687 number dependencies force-new))))
4688 (push header headers))
4691 (gnus-error 4 "Strange nov line (%d)"
4692 (count-lines (point-min) (point)))))
4694 ;; A common bug in inn is that if you have posted an article and
4695 ;; then retrieves the active file, it will answer correctly --
4696 ;; the new article is included. However, a NOV entry for the
4697 ;; article may not have been generated yet, so this may fail.
4698 ;; We work around this problem by retrieving the last few
4699 ;; headers using HEAD.
4700 (if (or (not also-fetch-heads)
4702 ;; We (probably) got all the headers.
4704 (let ((gnus-nov-is-evil t))
4707 (when (gnus-retrieve-headers sequence group)
4708 (gnus-get-newsgroup-headers))))))))
4710 (defun gnus-article-get-xrefs ()
4711 "Fill in the Xref value in `gnus-current-headers', if necessary.
4712 This is meant to be called in `gnus-article-internal-prepare-hook'."
4713 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4714 gnus-current-headers)))
4715 (or (not gnus-use-cross-reference)
4717 (and (mail-header-xref headers)
4718 (not (string= (mail-header-xref headers) "")))
4719 (let ((case-fold-search t)
4722 (nnheader-narrow-to-headers)
4723 (goto-char (point-min))
4724 (when (or (and (eq (downcase (char-after)) ?x)
4725 (looking-at "Xref:"))
4726 (search-forward "\nXref:" nil t))
4727 (goto-char (1+ (match-end 0)))
4728 (setq xref (buffer-substring (point)
4729 (progn (end-of-line) (point))))
4730 (mail-header-set-xref headers xref)))))))
4732 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4733 "Find article ID and insert the summary line for that article.
4734 OLD-HEADER can either be a header or a line number to insert
4735 the subject line on."
4736 (let* ((line (and (numberp old-header) old-header))
4737 (old-header (and (vectorp old-header) old-header))
4738 (header (cond ((and old-header use-old-header)
4741 (gnus-number-to-header id))
4742 (gnus-number-to-header id))
4744 (gnus-read-header id))))
4745 (number (and (numberp id) id))
4748 ;; Rebuild the thread that this article is part of and go to the
4749 ;; article we have fetched.
4750 (when (and (not gnus-show-threads)
4753 (setq d (gnus-data-find (mail-header-number old-header))))
4754 (goto-char (gnus-data-pos d))
4757 (- (gnus-point-at-bol)
4759 (1+ (gnus-point-at-eol))
4760 (gnus-delete-line))))))
4762 (mail-header-set-number header (mail-header-number old-header)))
4763 (setq gnus-newsgroup-sparse
4764 (delq (setq number (mail-header-number header))
4765 gnus-newsgroup-sparse))
4766 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4767 (push number gnus-newsgroup-limit)
4768 (gnus-rebuild-thread (mail-header-id header) line)
4769 (gnus-summary-goto-subject number nil t))
4770 (when (and (numberp number)
4772 ;; We have to update the boundaries even if we can't fetch the
4773 ;; article if ID is a number -- so that the next `P' or `N'
4774 ;; command will fetch the previous (or next) article even
4775 ;; if the one we tried to fetch this time has been canceled.
4776 (when (> number gnus-newsgroup-end)
4777 (setq gnus-newsgroup-end number))
4778 (when (< number gnus-newsgroup-begin)
4779 (setq gnus-newsgroup-begin number))
4780 (setq gnus-newsgroup-unselected
4781 (delq number gnus-newsgroup-unselected)))
4782 ;; Report back a success?
4783 (and header (mail-header-number header))))
4785 ;;; Process/prefix in the summary buffer
4787 (defun gnus-summary-work-articles (n)
4788 "Return a list of articles to be worked upon.
4789 The prefix argument, the list of process marked articles, and the
4790 current article will be taken into consideration."
4792 (set-buffer gnus-summary-buffer)
4795 ;; A numerical prefix has been given.
4796 (setq n (prefix-numeric-value n))
4797 (let ((backward (< n 0))
4798 (n (abs (prefix-numeric-value n)))
4803 (push (setq article (gnus-summary-article-number))
4806 (gnus-summary-find-prev nil article)
4807 (gnus-summary-find-next nil article)))
4809 (nreverse articles)))
4810 ((and (gnus-region-active-p) (mark))
4811 (message "region active")
4812 ;; Work on the region between point and mark.
4813 (let ((max (max (point) (mark)))
4816 (goto-char (min (point) (mark)))
4819 (push (setq article (gnus-summary-article-number)) articles)
4820 (gnus-summary-find-next nil article)
4822 (nreverse articles))))
4823 (gnus-newsgroup-processable
4824 ;; There are process-marked articles present.
4825 ;; Save current state.
4826 (gnus-summary-save-process-mark)
4828 (reverse gnus-newsgroup-processable))
4830 ;; Just return the current article.
4831 (list (gnus-summary-article-number))))))
4833 (defmacro gnus-summary-iterate (arg &rest forms)
4834 "Iterate over the process/prefixed articles and do FORMS.
4835 ARG is the interactive prefix given to the command. FORMS will be
4836 executed with point over the summary line of the articles."
4837 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4838 `(let ((,articles (gnus-summary-work-articles ,arg)))
4840 (gnus-summary-goto-subject (car ,articles))
4843 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4844 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4846 (defun gnus-summary-save-process-mark ()
4847 "Push the current set of process marked articles on the stack."
4849 (push (copy-sequence gnus-newsgroup-processable)
4850 gnus-newsgroup-process-stack))
4852 (defun gnus-summary-kill-process-mark ()
4853 "Push the current set of process marked articles on the stack and unmark."
4855 (gnus-summary-save-process-mark)
4856 (gnus-summary-unmark-all-processable))
4858 (defun gnus-summary-yank-process-mark ()
4859 "Pop the last process mark state off the stack and restore it."
4861 (unless gnus-newsgroup-process-stack
4862 (error "Empty mark stack"))
4863 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4865 (defun gnus-summary-process-mark-set (set)
4866 "Make SET into the current process marked articles."
4867 (gnus-summary-unmark-all-processable)
4869 (gnus-summary-set-process-mark (pop set))))
4871 ;;; Searching and stuff
4873 (defun gnus-summary-search-group (&optional backward use-level)
4874 "Search for next unread newsgroup.
4875 If optional argument BACKWARD is non-nil, search backward instead."
4877 (set-buffer gnus-group-buffer)
4878 (when (gnus-group-search-forward
4879 backward nil (if use-level (gnus-group-group-level) nil))
4880 (gnus-group-group-name))))
4882 (defun gnus-summary-best-group (&optional exclude-group)
4883 "Find the name of the best unread group.
4884 If EXCLUDE-GROUP, do not go to this group."
4886 (set-buffer gnus-group-buffer)
4888 (gnus-group-best-unread-group exclude-group))))
4890 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4891 (if backward (gnus-summary-find-prev)
4892 (let* ((dummy (gnus-summary-article-intangible-p))
4893 (article (or article (gnus-summary-article-number)))
4894 (arts (gnus-data-find-list article))
4896 (when (and (not dummy)
4897 (or (not gnus-summary-check-current)
4899 (not (gnus-data-unread-p (car arts)))))
4900 (setq arts (cdr arts)))
4905 (when (or (and undownloaded
4906 (eq gnus-undownloaded-mark
4907 (gnus-data-mark (car arts))))
4908 (gnus-data-unread-p (car arts)))
4909 (setq result (car arts)
4911 (setq arts (cdr arts)))
4914 (goto-char (gnus-data-pos result))
4915 (gnus-data-number result)))))
4917 (defun gnus-summary-find-prev (&optional unread article)
4918 (let* ((eobp (eobp))
4919 (article (or article (gnus-summary-article-number)))
4920 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4922 (when (and (not eobp)
4923 (or (not gnus-summary-check-current)
4925 (not (gnus-data-unread-p (car arts)))))
4926 (setq arts (cdr arts)))
4931 (when (gnus-data-unread-p (car arts))
4932 (setq result (car arts)
4934 (setq arts (cdr arts)))
4937 (goto-char (gnus-data-pos result))
4938 (gnus-data-number result))))
4940 (defun gnus-summary-find-subject (subject &optional unread backward article)
4941 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4942 (article (or article (gnus-summary-article-number)))
4943 (articles (gnus-data-list backward))
4944 (arts (gnus-data-find-list article articles))
4946 (when (or (not gnus-summary-check-current)
4948 (not (gnus-data-unread-p (car arts))))
4949 (setq arts (cdr arts)))
4951 (and (or (not unread)
4952 (gnus-data-unread-p (car arts)))
4953 (vectorp (gnus-data-header (car arts)))
4955 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4956 (setq result (car arts)
4958 (setq arts (cdr arts)))
4960 (goto-char (gnus-data-pos result))
4961 (gnus-data-number result))))
4963 (defun gnus-summary-search-forward (&optional unread subject backward)
4964 "Search forward for an article.
4965 If UNREAD, look for unread articles. If SUBJECT, look for
4966 articles with that subject. If BACKWARD, search backward instead."
4967 (cond (subject (gnus-summary-find-subject subject unread backward))
4968 (backward (gnus-summary-find-prev unread))
4969 (t (gnus-summary-find-next unread))))
4971 (defun gnus-recenter (&optional n)
4972 "Center point in window and redisplay frame.
4973 Also do horizontal recentering."
4975 (when (and gnus-auto-center-summary
4976 (not (eq gnus-auto-center-summary 'vertical)))
4977 (gnus-horizontal-recenter))
4980 (defun gnus-summary-recenter ()
4981 "Center point in the summary window.
4982 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4983 displayed, no centering will be performed."
4984 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4985 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4986 (let* ((top (cond ((< (window-height) 4) 0)
4987 ((< (window-height) 7) 1)
4988 (t (if (numberp gnus-auto-center-summary)
4989 gnus-auto-center-summary
4991 (height (1- (window-height)))
4992 (bottom (save-excursion (goto-char (point-max))
4993 (forward-line (- height))
4995 (window (get-buffer-window (current-buffer))))
4996 ;; The user has to want it.
4997 (when gnus-auto-center-summary
4998 (when (get-buffer-window gnus-article-buffer)
4999 ;; Only do recentering when the article buffer is displayed,
5000 ;; Set the window start to either `bottom', which is the biggest
5001 ;; possible valid number, or the second line from the top,
5002 ;; whichever is the least.
5004 window (min bottom (save-excursion
5005 (forward-line (- top)) (point)))))
5006 ;; Do horizontal recentering while we're at it.
5007 (when (and (get-buffer-window (current-buffer) t)
5008 (not (eq gnus-auto-center-summary 'vertical)))
5009 (let ((selected (selected-window)))
5010 (select-window (get-buffer-window (current-buffer) t))
5011 (gnus-summary-position-point)
5012 (gnus-horizontal-recenter)
5013 (select-window selected))))))
5015 (defun gnus-summary-jump-to-group (newsgroup)
5016 "Move point to NEWSGROUP in group mode buffer."
5017 ;; Keep update point of group mode buffer if visible.
5018 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5019 (save-window-excursion
5020 ;; Take care of tree window mode.
5021 (when (get-buffer-window gnus-group-buffer)
5022 (pop-to-buffer gnus-group-buffer))
5023 (gnus-group-jump-to-group newsgroup))
5025 ;; Take care of tree window mode.
5026 (if (get-buffer-window gnus-group-buffer)
5027 (pop-to-buffer gnus-group-buffer)
5028 (set-buffer gnus-group-buffer))
5029 (gnus-group-jump-to-group newsgroup))))
5031 ;; This function returns a list of article numbers based on the
5032 ;; difference between the ranges of read articles in this group and
5033 ;; the range of active articles.
5034 (defun gnus-list-of-unread-articles (group)
5035 (let* ((read (gnus-info-read (gnus-get-info group)))
5036 (active (or (gnus-active group) (gnus-activate-group group)))
5039 ;; If none are read, then all are unread.
5041 (setq first (car active))
5042 ;; If the range of read articles is a single range, then the
5043 ;; first unread article is the article after the last read
5044 ;; article. Sounds logical, doesn't it?
5045 (if (not (listp (cdr read)))
5046 (setq first (max (car active) (1+ (cdr read))))
5047 ;; `read' is a list of ranges.
5048 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5051 (setq first (car active)))
5054 (while (< first nlast)
5056 (setq first (1+ first))))
5057 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5058 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5059 (setq read (cdr read)))))
5060 ;; And add the last unread articles.
5061 (while (<= first last)
5063 (setq first (1+ first)))
5064 ;; Return the list of unread articles.
5065 (delq 0 (nreverse unread))))
5067 (defun gnus-list-of-read-articles (group)
5068 "Return a list of unread, unticked and non-dormant articles."
5069 (let* ((info (gnus-get-info group))
5070 (marked (gnus-info-marks info))
5071 (active (gnus-active group)))
5073 (gnus-set-difference
5074 (gnus-sorted-complement
5075 (gnus-uncompress-range active)
5076 (gnus-list-of-unread-articles group))
5078 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5079 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5081 ;; Various summary commands
5083 (defun gnus-summary-select-article-buffer ()
5084 "Reconfigure windows to show article buffer."
5086 (if (not (gnus-buffer-live-p gnus-article-buffer))
5087 (error "There is no article buffer for this summary buffer")
5088 (gnus-configure-windows 'article)
5089 (select-window (get-buffer-window gnus-article-buffer))))
5091 (defun gnus-summary-universal-argument (arg)
5092 "Perform any operation on all articles that are process/prefixed."
5094 (let ((articles (gnus-summary-work-articles arg))
5101 (substitute-command-keys
5102 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5105 (gnus-error 1 "Undefined key")
5108 (gnus-summary-goto-subject (setq article (pop articles)))
5109 (let (gnus-newsgroup-processable)
5110 (command-execute func))
5111 (gnus-summary-remove-process-mark article)))))
5112 (gnus-summary-position-point))
5114 (defun gnus-summary-toggle-truncation (&optional arg)
5115 "Toggle truncation of summary lines.
5116 With arg, turn line truncation on iff arg is positive."
5118 (setq truncate-lines
5119 (if (null arg) (not truncate-lines)
5120 (> (prefix-numeric-value arg) 0)))
5123 (defun gnus-summary-reselect-current-group (&optional all rescan)
5124 "Exit and then reselect the current newsgroup.
5125 The prefix argument ALL means to select all articles."
5127 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5128 (error "Ephemeral groups can't be reselected"))
5129 (let ((current-subject (gnus-summary-article-number))
5130 (group gnus-newsgroup-name))
5131 (setq gnus-newsgroup-begin nil)
5133 ;; We have to adjust the point of group mode buffer because
5134 ;; point was moved to the next unread newsgroup by exiting.
5135 (gnus-summary-jump-to-group group)
5138 (gnus-group-get-new-news-this-group 1)))
5139 (gnus-group-read-group all t)
5140 (gnus-summary-goto-subject current-subject nil t)))
5142 (defun gnus-summary-rescan-group (&optional all)
5143 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5145 (gnus-summary-reselect-current-group all t))
5147 (defun gnus-summary-update-info (&optional non-destructive)
5149 (let ((group gnus-newsgroup-name))
5151 (when gnus-newsgroup-kill-headers
5152 (setq gnus-newsgroup-killed
5153 (gnus-compress-sequence
5155 (gnus-set-sorted-intersection
5156 (gnus-uncompress-range gnus-newsgroup-killed)
5157 (setq gnus-newsgroup-unselected
5158 (sort gnus-newsgroup-unselected '<)))
5159 (setq gnus-newsgroup-unreads
5160 (sort gnus-newsgroup-unreads '<)))
5162 (unless (listp (cdr gnus-newsgroup-killed))
5163 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5164 (let ((headers gnus-newsgroup-headers))
5165 ;; Set the new ranges of read articles.
5167 (set-buffer gnus-group-buffer)
5168 (gnus-undo-force-boundary))
5169 (gnus-update-read-articles
5170 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5171 ;; Set the current article marks.
5172 (let ((gnus-newsgroup-scored
5173 (if (and (not gnus-save-score)
5174 (not non-destructive))
5176 gnus-newsgroup-scored)))
5178 (gnus-update-marks)))
5179 ;; Do the cross-ref thing.
5180 (when gnus-use-cross-reference
5181 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5182 ;; Do not switch windows but change the buffer to work.
5183 (set-buffer gnus-group-buffer)
5184 (unless (gnus-ephemeral-group-p group)
5185 (gnus-group-update-group group)))))))
5187 (defun gnus-summary-save-newsrc (&optional force)
5188 "Save the current number of read/marked articles in the dribble buffer.
5189 The dribble buffer will then be saved.
5190 If FORCE (the prefix), also save the .newsrc file(s)."
5192 (gnus-summary-update-info t)
5194 (gnus-save-newsrc-file)
5195 (gnus-dribble-save)))
5197 (defun gnus-summary-exit (&optional temporary)
5198 "Exit reading current newsgroup, and then return to group selection mode.
5199 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5201 (gnus-set-global-variables)
5202 (gnus-kill-save-kill-buffer)
5203 (gnus-async-halt-prefetch)
5204 (let* ((group gnus-newsgroup-name)
5205 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5208 (buf (current-buffer)))
5209 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5210 ;; If we have several article buffers, we kill them at exit.
5211 (unless gnus-single-article-buffer
5212 (gnus-kill-buffer gnus-original-article-buffer)
5213 (setq gnus-article-current nil))
5214 (when gnus-use-cache
5215 (gnus-cache-possibly-remove-articles)
5216 (gnus-cache-save-buffers))
5217 (gnus-async-prefetch-remove-group group)
5218 (when gnus-suppress-duplicates
5219 (gnus-dup-enter-articles))
5220 (when gnus-use-trees
5221 (gnus-tree-close group))
5222 ;; Remove entries for this group.
5223 (nnmail-purge-split-history (gnus-group-real-name group))
5224 ;; Make all changes in this group permanent.
5226 (gnus-run-hooks 'gnus-exit-group-hook)
5227 (gnus-summary-update-info)
5228 ;; Do adaptive scoring, and possibly save score files.
5229 (when gnus-newsgroup-adaptive
5230 (gnus-score-adaptive))
5231 (when gnus-use-scoring
5233 (gnus-close-group group)
5234 ;; Make sure where we were, and go to next newsgroup.
5235 (set-buffer gnus-group-buffer)
5237 (gnus-group-jump-to-group group))
5238 (gnus-run-hooks 'gnus-summary-exit-hook)
5239 (unless (or quit-config
5240 ;; If this group has disappeared from the summary
5241 ;; buffer, don't skip forwards.
5242 (not (string= group (gnus-group-group-name))))
5243 (gnus-group-next-unread-group 1))
5244 (setq group-point (point))
5247 ;; If we have several article buffers, we kill them at exit.
5248 (unless gnus-single-article-buffer
5249 (gnus-kill-buffer gnus-article-buffer)
5250 (gnus-kill-buffer gnus-original-article-buffer)
5251 (setq gnus-article-current nil))
5253 (if (not gnus-kill-summary-on-exit)
5254 (gnus-deaden-summary)
5255 ;; We set all buffer-local variables to nil. It is unclear why
5256 ;; this is needed, but if we don't, buffer-local variables are
5257 ;; not garbage-collected, it seems. This would the lead to en
5258 ;; ever-growing Emacs.
5259 (gnus-summary-clear-local-variables)
5260 (when (get-buffer gnus-article-buffer)
5261 (bury-buffer gnus-article-buffer))
5262 ;; We clear the global counterparts of the buffer-local
5263 ;; variables as well, just to be on the safe side.
5264 (set-buffer gnus-group-buffer)
5265 (gnus-summary-clear-local-variables)
5266 ;; Return to group mode buffer.
5267 (when (eq mode 'gnus-summary-mode)
5268 (gnus-kill-buffer buf)))
5269 (setq gnus-current-select-method gnus-select-method)
5270 (pop-to-buffer gnus-group-buffer)
5271 (if (not quit-config)
5273 (goto-char group-point)
5274 (gnus-configure-windows 'group 'force))
5275 (gnus-handle-ephemeral-exit quit-config))
5276 ;; Clear the current group name.
5278 (setq gnus-newsgroup-name nil)))))
5280 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5281 (defun gnus-summary-exit-no-update (&optional no-questions)
5282 "Quit reading current newsgroup without updating read article info."
5284 (let* ((group gnus-newsgroup-name)
5285 (quit-config (gnus-group-quit-config group)))
5286 (when (or no-questions
5288 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5289 (gnus-async-halt-prefetch)
5290 (gnus-run-hooks (delq 'gnus-summary-expire-articles
5291 (copy-list gnus-summary-prepare-exit-hook)))
5292 ;; If we have several article buffers, we kill them at exit.
5293 (unless gnus-single-article-buffer
5294 (gnus-kill-buffer gnus-article-buffer)
5295 (gnus-kill-buffer gnus-original-article-buffer)
5296 (setq gnus-article-current nil))
5297 (if (not gnus-kill-summary-on-exit)
5298 (gnus-deaden-summary)
5299 (gnus-close-group group)
5300 (gnus-summary-clear-local-variables)
5301 (set-buffer gnus-group-buffer)
5302 (gnus-summary-clear-local-variables)
5303 (when (get-buffer gnus-summary-buffer)
5304 (kill-buffer gnus-summary-buffer)))
5305 (unless gnus-single-article-buffer
5306 (setq gnus-article-current nil))
5307 (when gnus-use-trees
5308 (gnus-tree-close group))
5309 (gnus-async-prefetch-remove-group group)
5310 (when (get-buffer gnus-article-buffer)
5311 (bury-buffer gnus-article-buffer))
5312 ;; Return to the group buffer.
5313 (gnus-configure-windows 'group 'force)
5314 ;; Clear the current group name.
5315 (setq gnus-newsgroup-name nil)
5316 (when (equal (gnus-group-group-name) group)
5317 (gnus-group-next-unread-group 1))
5319 (gnus-handle-ephemeral-exit quit-config)))))
5321 (defun gnus-handle-ephemeral-exit (quit-config)
5322 "Handle movement when leaving an ephemeral group.
5323 The state which existed when entering the ephemeral is reset."
5324 (if (not (buffer-name (car quit-config)))
5325 (gnus-configure-windows 'group 'force)
5326 (set-buffer (car quit-config))
5327 (cond ((eq major-mode 'gnus-summary-mode)
5328 (gnus-set-global-variables))
5329 ((eq major-mode 'gnus-article-mode)
5331 ;; The `gnus-summary-buffer' variable may point
5332 ;; to the old summary buffer when using a single
5334 (unless (gnus-buffer-live-p gnus-summary-buffer)
5335 (set-buffer gnus-group-buffer))
5336 (set-buffer gnus-summary-buffer)
5337 (gnus-set-global-variables))))
5338 (if (or (eq (cdr quit-config) 'article)
5339 (eq (cdr quit-config) 'pick))
5341 ;; The current article may be from the ephemeral group
5342 ;; thus it is best that we reload this article
5343 (gnus-summary-show-article)
5344 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5345 (gnus-configure-windows 'pick 'force)
5346 (gnus-configure-windows (cdr quit-config) 'force)))
5347 (gnus-configure-windows (cdr quit-config) 'force))
5348 (when (eq major-mode 'gnus-summary-mode)
5349 (gnus-summary-next-subject 1 nil t)
5350 (gnus-summary-recenter)
5351 (gnus-summary-position-point))))
5353 (defun gnus-summary-preview-mime-message (arg)
5354 "MIME decode and play this message."
5357 (let ((gnus-break-pages nil)
5359 (gnus-summary-select-article t t)
5361 (select-window (get-buffer-window gnus-article-buffer))
5366 (defvar gnus-dead-summary-mode-map nil)
5368 (unless gnus-dead-summary-mode-map
5369 (setq gnus-dead-summary-mode-map (make-keymap))
5370 (suppress-keymap gnus-dead-summary-mode-map)
5371 (substitute-key-definition
5372 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5373 (let ((keys '("\C-d" "\r" "\177" [delete])))
5375 (define-key gnus-dead-summary-mode-map
5376 (pop keys) 'gnus-summary-wake-up-the-dead))))
5378 (defvar gnus-dead-summary-mode nil
5379 "Minor mode for Gnus summary buffers.")
5381 (defun gnus-dead-summary-mode (&optional arg)
5382 "Minor mode for Gnus summary buffers."
5384 (when (eq major-mode 'gnus-summary-mode)
5385 (make-local-variable 'gnus-dead-summary-mode)
5386 (setq gnus-dead-summary-mode
5387 (if (null arg) (not gnus-dead-summary-mode)
5388 (> (prefix-numeric-value arg) 0)))
5389 (when gnus-dead-summary-mode
5390 (gnus-add-minor-mode
5391 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5393 (defun gnus-deaden-summary ()
5394 "Make the current summary buffer into a dead summary buffer."
5395 ;; Kill any previous dead summary buffer.
5396 (when (and gnus-dead-summary
5397 (buffer-name gnus-dead-summary))
5399 (set-buffer gnus-dead-summary)
5400 (when gnus-dead-summary-mode
5401 (kill-buffer (current-buffer)))))
5402 ;; Make this the current dead summary.
5403 (setq gnus-dead-summary (current-buffer))
5404 (gnus-dead-summary-mode 1)
5405 (let ((name (buffer-name)))
5406 (when (string-match "Summary" name)
5408 (concat (substring name 0 (match-beginning 0)) "Dead "
5409 (substring name (match-beginning 0)))
5412 (defun gnus-kill-or-deaden-summary (buffer)
5413 "Kill or deaden the summary BUFFER."
5415 (when (and (buffer-name buffer)
5416 (not gnus-single-article-buffer))
5419 (gnus-kill-buffer gnus-article-buffer)
5420 (gnus-kill-buffer gnus-original-article-buffer)))
5421 (cond (gnus-kill-summary-on-exit
5422 (when (and gnus-use-trees
5423 (gnus-buffer-exists-p buffer))
5426 (gnus-tree-close gnus-newsgroup-name)))
5427 (gnus-kill-buffer buffer))
5428 ((gnus-buffer-exists-p buffer)
5431 (gnus-deaden-summary))))))
5433 (defun gnus-summary-wake-up-the-dead (&rest args)
5434 "Wake up the dead summary buffer."
5436 (gnus-dead-summary-mode -1)
5437 (let ((name (buffer-name)))
5438 (when (string-match "Dead " name)
5440 (concat (substring name 0 (match-beginning 0))
5441 (substring name (match-end 0)))
5443 (gnus-message 3 "This dead summary is now alive again"))
5445 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5446 (defun gnus-summary-fetch-faq (&optional faq-dir)
5447 "Fetch the FAQ for the current group.
5448 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5452 (when current-prefix-arg
5454 "Faq dir: " (and (listp gnus-group-faq-directory)
5455 (mapcar (lambda (file) (list file))
5456 gnus-group-faq-directory))))))
5457 (let (gnus-faq-buffer)
5458 (when (setq gnus-faq-buffer
5459 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5460 (gnus-configure-windows 'summary-faq))))
5462 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5463 (defun gnus-summary-describe-group (&optional force)
5464 "Describe the current newsgroup."
5466 (gnus-group-describe-group force gnus-newsgroup-name))
5468 (defun gnus-summary-describe-briefly ()
5469 "Describe summary mode commands briefly."
5472 (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")))
5474 ;; Walking around group mode buffer from summary mode.
5476 (defun gnus-summary-next-group (&optional no-article target-group backward)
5477 "Exit current newsgroup and then select next unread newsgroup.
5478 If prefix argument NO-ARTICLE is non-nil, no article is selected
5479 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5480 previous group instead."
5482 ;; Stop pre-fetching.
5483 (gnus-async-halt-prefetch)
5484 (let ((current-group gnus-newsgroup-name)
5485 (current-buffer (current-buffer))
5487 ;; First we semi-exit this group to update Xrefs and all variables.
5488 ;; We can't do a real exit, because the window conf must remain
5489 ;; the same in case the user is prompted for info, and we don't
5490 ;; want the window conf to change before that...
5491 (gnus-summary-exit t)
5492 (while (not entered)
5493 ;; Then we find what group we are supposed to enter.
5494 (set-buffer gnus-group-buffer)
5495 (gnus-group-jump-to-group current-group)
5498 (if (eq gnus-keep-same-level 'best)
5499 (gnus-summary-best-group gnus-newsgroup-name)
5500 (gnus-summary-search-group backward gnus-keep-same-level))))
5501 (if (not target-group)
5502 ;; There are no further groups, so we return to the group
5505 (gnus-message 5 "Returning to the group buffer")
5507 (when (gnus-buffer-live-p current-buffer)
5508 (set-buffer current-buffer)
5509 (gnus-summary-exit))
5510 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5511 ;; We try to enter the target group.
5512 (gnus-group-jump-to-group target-group)
5513 (let ((unreads (gnus-group-group-unread)))
5514 (if (and (or (eq t unreads)
5515 (and unreads (not (zerop unreads))))
5516 (gnus-summary-read-group
5517 target-group nil no-article
5518 (and (buffer-name current-buffer) current-buffer)
5521 (setq current-group target-group
5522 target-group nil)))))))
5524 (defun gnus-summary-prev-group (&optional no-article)
5525 "Exit current newsgroup and then select previous unread newsgroup.
5526 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5528 (gnus-summary-next-group no-article nil t))
5530 ;; Walking around summary lines.
5532 (defun gnus-summary-first-subject (&optional unread undownloaded)
5533 "Go to the first unread subject.
5534 If UNREAD is non-nil, go to the first unread article.
5535 Returns the article selected or nil if there are no unread articles."
5540 ((null gnus-newsgroup-data)
5541 (gnus-message 3 "No articles in the group")
5543 ;; Pick the first article.
5545 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5546 (gnus-data-number (car gnus-newsgroup-data)))
5547 ;; No unread articles.
5548 ((null gnus-newsgroup-unreads)
5549 (gnus-message 3 "No more unread articles")
5551 ;; Find the first unread article.
5553 (let ((data gnus-newsgroup-data))
5555 (and (not (and undownloaded
5556 (eq gnus-undownloaded-mark
5557 (gnus-data-mark (car data)))))
5558 (not (gnus-data-unread-p (car data)))))
5559 (setq data (cdr data)))
5561 (goto-char (gnus-data-pos (car data)))
5562 (gnus-data-number (car data))))))
5563 (gnus-summary-position-point)))
5565 (defun gnus-summary-next-subject (n &optional unread dont-display)
5566 "Go to next N'th summary line.
5567 If N is negative, go to the previous N'th subject line.
5568 If UNREAD is non-nil, only unread articles are selected.
5569 The difference between N and the actual number of steps taken is
5572 (let ((backward (< n 0))
5576 (gnus-summary-find-prev unread)
5577 (gnus-summary-find-next unread)))
5578 (gnus-summary-show-thread)
5581 (gnus-message 7 "No more%s articles"
5582 (if unread " unread" "")))
5583 (unless dont-display
5584 (gnus-summary-recenter)
5585 (gnus-summary-position-point))
5588 (defun gnus-summary-next-unread-subject (n)
5589 "Go to next N'th unread summary line."
5591 (gnus-summary-next-subject n t))
5593 (defun gnus-summary-prev-subject (n &optional unread)
5594 "Go to previous N'th summary line.
5595 If optional argument UNREAD is non-nil, only unread article is selected."
5597 (gnus-summary-next-subject (- n) unread))
5599 (defun gnus-summary-prev-unread-subject (n)
5600 "Go to previous N'th unread summary line."
5602 (gnus-summary-next-subject (- n) t))
5604 (defun gnus-summary-goto-subject (article &optional force silent)
5605 "Go the subject line of ARTICLE.
5606 If FORCE, also allow jumping to articles not currently shown."
5607 (interactive "nArticle number: ")
5609 (data (gnus-data-find article)))
5610 ;; We read in the article if we have to.
5613 (gnus-summary-insert-subject
5615 (if (or (numberp force) (vectorp force)) force)
5617 (setq data (gnus-data-find article)))
5622 (gnus-message 3 "Can't find article %d" article))
5624 (goto-char (gnus-data-pos data))
5625 (gnus-summary-position-point)
5628 ;; Walking around summary lines with displaying articles.
5630 (defun gnus-summary-expand-window (&optional arg)
5631 "Make the summary buffer take up the entire Emacs frame.
5632 Given a prefix, will force an `article' buffer configuration."
5635 (gnus-configure-windows 'article 'force)
5636 (gnus-configure-windows 'summary 'force)))
5638 (defun gnus-summary-display-article (article &optional all-header)
5639 "Display ARTICLE in article buffer."
5640 (gnus-set-global-variables)
5644 (if gnus-summary-display-article-function
5645 (funcall gnus-summary-display-article-function article all-header)
5646 (gnus-article-prepare article all-header))
5647 (gnus-run-hooks 'gnus-select-article-hook)
5648 (when (and gnus-current-article
5649 (not (zerop gnus-current-article)))
5650 (gnus-summary-goto-subject gnus-current-article))
5651 (gnus-summary-recenter)
5652 (when (and gnus-use-trees gnus-show-threads)
5653 (gnus-possibly-generate-tree article)
5654 (gnus-highlight-selected-tree article))
5655 ;; Successfully display article.
5656 (gnus-article-set-window-start
5657 (cdr (assq article gnus-newsgroup-bookmarks))))))
5659 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5660 "Select the current article.
5661 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5662 non-nil, the article will be re-fetched even if it already present in
5663 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5665 ;; Make sure we are in the summary buffer to work around bbdb bug.
5666 (unless (eq major-mode 'gnus-summary-mode)
5667 (set-buffer gnus-summary-buffer))
5668 (let ((article (or article (gnus-summary-article-number)))
5669 (all-headers (not (not all-headers))) ;Must be T or NIL.
5670 gnus-summary-display-article-function
5673 (gnus-summary-article-pseudo-p article)
5674 (error "This is a pseudo-article"))
5677 (set-buffer gnus-summary-buffer)
5678 (if (or (and gnus-single-article-buffer
5679 (or (null gnus-current-article)
5680 (null gnus-article-current)
5681 (null (get-buffer gnus-article-buffer))
5682 (not (eq article (cdr gnus-article-current)))
5683 (not (equal (car gnus-article-current)
5684 gnus-newsgroup-name))))
5685 (and (not gnus-single-article-buffer)
5686 (or (null gnus-current-article)
5687 (not (eq gnus-current-article article))))
5689 ;; The requested article is different from the current article.
5691 (gnus-summary-display-article article all-headers)
5693 (when (or all-headers gnus-show-all-headers)
5694 (gnus-article-show-all-headers))
5697 (gnus-article-set-window-start
5698 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5700 (defun gnus-summary-set-current-mark (&optional current-mark)
5701 "Obsolete function."
5704 (defun gnus-summary-next-article (&optional unread subject backward push)
5705 "Select the next article.
5706 If UNREAD, only unread articles are selected.
5707 If SUBJECT, only articles with SUBJECT are selected.
5708 If BACKWARD, the previous article is selected instead of the next."
5711 ;; Is there such an article?
5712 ((and (gnus-summary-search-forward unread subject backward)
5713 (or (gnus-summary-display-article (gnus-summary-article-number))
5714 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5715 (gnus-summary-position-point))
5716 ;; If not, we try the first unread, if that is wanted.
5718 gnus-auto-select-same
5719 (gnus-summary-first-unread-article))
5720 (gnus-summary-position-point)
5721 (gnus-message 6 "Wrapped"))
5722 ;; Try to get next/previous article not displayed in this group.
5723 ((and gnus-auto-extend-newsgroup
5724 (not unread) (not subject))
5725 (gnus-summary-goto-article
5726 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5727 nil (count-lines (point-min) (point))))
5728 ;; Go to next/previous group.
5730 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5731 (gnus-summary-jump-to-group gnus-newsgroup-name))
5732 (let ((cmd last-command-char)
5735 (set-buffer gnus-group-buffer)
5738 (if (eq gnus-keep-same-level 'best)
5739 (gnus-summary-best-group gnus-newsgroup-name)
5740 (gnus-summary-search-group backward gnus-keep-same-level))))
5741 ;; For some reason, the group window gets selected. We change
5743 (select-window (get-buffer-window (current-buffer)))
5744 ;; Select next unread newsgroup automagically.
5746 ((or (not gnus-auto-select-next)
5748 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5749 ((or (eq gnus-auto-select-next 'quietly)
5750 (and (eq gnus-auto-select-next 'slightly-quietly)
5752 (and (eq gnus-auto-select-next 'almost-quietly)
5753 (gnus-summary-last-article-p)))
5755 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5757 (gnus-message 7 "No more%s articles (%s)..."
5758 (if unread " unread" "")
5759 (if group (concat "selecting " group)
5761 (gnus-summary-next-group nil group backward)))
5763 (when (gnus-key-press-event-p last-input-event)
5764 (gnus-summary-walk-group-buffer
5765 gnus-newsgroup-name cmd unread backward point))))))))
5767 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5768 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5769 (?\C-p (gnus-group-prev-unread-group 1))))
5770 (cursor-in-echo-area t)
5771 keve key group ended)
5773 (set-buffer gnus-group-buffer)
5776 (if (eq gnus-keep-same-level 'best)
5777 (gnus-summary-best-group gnus-newsgroup-name)
5778 (gnus-summary-search-group backward gnus-keep-same-level))))
5781 5 "No more%s articles%s" (if unread " unread" "")
5783 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5784 (format " (Type %s for %s [%s])"
5785 (single-key-description cmd) group
5786 (car (gnus-gethash group gnus-newsrc-hashtb)))
5787 (format " (Type %s to exit %s)"
5788 (single-key-description cmd)
5789 gnus-newsgroup-name)))
5790 ;; Confirm auto selection.
5791 (setq key (car (setq keve (gnus-read-event-char))))
5794 ((assq key keystrokes)
5795 (let ((obuf (current-buffer)))
5796 (switch-to-buffer gnus-group-buffer)
5798 (gnus-group-jump-to-group group))
5799 (eval (cadr (assq key keystrokes)))
5800 (setq group (gnus-group-group-name))
5801 (switch-to-buffer obuf))
5805 (gnus-ephemeral-group-p gnus-newsgroup-name))
5807 (gnus-summary-next-group nil group backward)))
5809 (push (cdr keve) unread-command-events))))))
5811 (defun gnus-summary-next-unread-article ()
5812 "Select unread article after current one."
5814 (gnus-summary-next-article
5815 (or (not (eq gnus-summary-goto-unread 'never))
5816 (gnus-summary-last-article-p (gnus-summary-article-number)))
5817 (and gnus-auto-select-same
5818 (gnus-summary-article-subject))))
5820 (defun gnus-summary-prev-article (&optional unread subject)
5821 "Select the article after the current one.
5822 If UNREAD is non-nil, only unread articles are selected."
5824 (gnus-summary-next-article unread subject t))
5826 (defun gnus-summary-prev-unread-article ()
5827 "Select unread article before current one."
5829 (gnus-summary-prev-article
5830 (or (not (eq gnus-summary-goto-unread 'never))
5831 (gnus-summary-first-article-p (gnus-summary-article-number)))
5832 (and gnus-auto-select-same
5833 (gnus-summary-article-subject))))
5835 (defun gnus-summary-next-page (&optional lines circular)
5836 "Show next page of the selected article.
5837 If at the end of the current article, select the next article.
5838 LINES says how many lines should be scrolled up.
5840 If CIRCULAR is non-nil, go to the start of the article instead of
5841 selecting the next article when reaching the end of the current
5844 (setq gnus-summary-buffer (current-buffer))
5845 (gnus-set-global-variables)
5846 (let ((article (gnus-summary-article-number))
5847 (article-window (get-buffer-window gnus-article-buffer t))
5849 ;; If the buffer is empty, we have no article.
5851 (error "No article to select"))
5852 (gnus-configure-windows 'article)
5853 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5854 (if (and (eq gnus-summary-goto-unread 'never)
5855 (not (gnus-summary-last-article-p article)))
5856 (gnus-summary-next-article)
5857 (gnus-summary-next-unread-article))
5858 (if (or (null gnus-current-article)
5859 (null gnus-article-current)
5860 (/= article (cdr gnus-article-current))
5861 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5862 ;; Selected subject is different from current article's.
5863 (gnus-summary-display-article article)
5864 (when article-window
5865 (gnus-eval-in-buffer-window gnus-article-buffer
5866 (setq endp (gnus-article-next-page lines)))
5869 (gnus-summary-beginning-of-article))
5871 (gnus-message 3 "End of message"))
5873 (if (and (eq gnus-summary-goto-unread 'never)
5874 (not (gnus-summary-last-article-p article)))
5875 (gnus-summary-next-article)
5876 (gnus-summary-next-unread-article))))))))
5877 (gnus-summary-recenter)
5878 (gnus-summary-position-point)))
5880 (defun gnus-summary-prev-page (&optional lines move)
5881 "Show previous page of selected article.
5882 Argument LINES specifies lines to be scrolled down.
5883 If MOVE, move to the previous unread article if point is at
5884 the beginning of the buffer."
5886 (let ((article (gnus-summary-article-number))
5887 (article-window (get-buffer-window gnus-article-buffer t))
5889 (gnus-configure-windows 'article)
5890 (if (or (null gnus-current-article)
5891 (null gnus-article-current)
5892 (/= article (cdr gnus-article-current))
5893 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5894 ;; Selected subject is different from current article's.
5895 (gnus-summary-display-article article)
5896 (gnus-summary-recenter)
5897 (when article-window
5898 (gnus-eval-in-buffer-window gnus-article-buffer
5899 (setq endp (gnus-article-prev-page lines)))
5900 (when (and move endp)
5902 (gnus-message 3 "Beginning of message"))
5904 (if (and (eq gnus-summary-goto-unread 'never)
5905 (not (gnus-summary-first-article-p article)))
5906 (gnus-summary-prev-article)
5907 (gnus-summary-prev-unread-article))))))))
5908 (gnus-summary-position-point))
5910 (defun gnus-summary-prev-page-or-article (&optional lines)
5911 "Show previous page of selected article.
5912 Argument LINES specifies lines to be scrolled down.
5913 If at the beginning of the article, go to the next article."
5915 (gnus-summary-prev-page lines t))
5917 (defun gnus-summary-scroll-up (lines)
5918 "Scroll up (or down) one line current article.
5919 Argument LINES specifies lines to be scrolled up (or down if negative)."
5921 (gnus-configure-windows 'article)
5922 (gnus-summary-show-thread)
5923 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5924 (gnus-eval-in-buffer-window gnus-article-buffer
5926 (when (gnus-article-next-page lines)
5927 (gnus-message 3 "End of message")))
5929 (gnus-article-prev-page (- lines))))))
5930 (gnus-summary-recenter)
5931 (gnus-summary-position-point))
5933 (defun gnus-summary-scroll-down (lines)
5934 "Scroll down (or up) one line current article.
5935 Argument LINES specifies lines to be scrolled down (or up if negative)."
5937 (gnus-summary-scroll-up (- lines)))
5939 (defun gnus-summary-next-same-subject ()
5940 "Select next article which has the same subject as current one."
5942 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5944 (defun gnus-summary-prev-same-subject ()
5945 "Select previous article which has the same subject as current one."
5947 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5949 (defun gnus-summary-next-unread-same-subject ()
5950 "Select next unread article which has the same subject as current one."
5952 (gnus-summary-next-article t (gnus-summary-article-subject)))
5954 (defun gnus-summary-prev-unread-same-subject ()
5955 "Select previous unread article which has the same subject as current one."
5957 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5959 (defun gnus-summary-first-unread-article ()
5960 "Select the first unread article.
5961 Return nil if there are no unread articles."
5964 (when (gnus-summary-first-subject t)
5965 (gnus-summary-show-thread)
5966 (gnus-summary-first-subject t)
5967 (gnus-summary-display-article (gnus-summary-article-number)))
5968 (gnus-summary-position-point)))
5970 (defun gnus-summary-first-unread-subject ()
5971 "Place the point on the subject line of the first unread article.
5972 Return nil if there are no unread articles."
5975 (when (gnus-summary-first-subject t)
5976 (gnus-summary-show-thread)
5977 (gnus-summary-first-subject t))
5978 (gnus-summary-position-point)))
5980 (defun gnus-summary-first-article ()
5981 "Select the first article.
5982 Return nil if there are no articles."
5985 (when (gnus-summary-first-subject)
5986 (gnus-summary-show-thread)
5987 (gnus-summary-first-subject)
5988 (gnus-summary-display-article (gnus-summary-article-number)))
5989 (gnus-summary-position-point)))
5991 (defun gnus-summary-best-unread-article ()
5992 "Select the unread article with the highest score."
5994 (let ((best -1000000)
5995 (data gnus-newsgroup-data)
5998 (and (gnus-data-unread-p (car data))
6000 (gnus-summary-article-score (gnus-data-number (car data))))
6003 article (gnus-data-number (car data))))
6004 (setq data (cdr data)))
6007 (gnus-summary-goto-article article)
6008 (error "No unread articles"))
6009 (gnus-summary-position-point))))
6011 (defun gnus-summary-last-subject ()
6012 "Go to the last displayed subject line in the group."
6013 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6015 (gnus-summary-goto-subject article))))
6017 (defun gnus-summary-goto-article (article &optional all-headers force)
6018 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6019 If ALL-HEADERS is non-nil, no header lines are hidden.
6020 If FORCE, go to the article even if it isn't displayed. If FORCE
6021 is a number, it is the line the article is to be displayed on."
6025 "Article number or Message-ID: "
6026 (mapcar (lambda (number) (list (int-to-string number)))
6027 gnus-newsgroup-limit))
6031 (if (and (stringp article)
6032 (string-match "@" article))
6033 (gnus-summary-refer-article article)
6034 (when (stringp article)
6035 (setq article (string-to-number article)))
6036 (if (gnus-summary-goto-subject article force)
6037 (gnus-summary-display-article article all-headers)
6038 (gnus-message 4 "Couldn't go to article %s" article) nil))
6039 (gnus-summary-position-point)))
6041 (defun gnus-summary-goto-last-article ()
6042 "Go to the previously read article."
6045 (when gnus-last-article
6046 (gnus-summary-goto-article gnus-last-article nil t))
6047 (gnus-summary-position-point)))
6049 (defun gnus-summary-pop-article (number)
6050 "Pop one article off the history and go to the previous.
6051 NUMBER articles will be popped off."
6054 (setq gnus-newsgroup-history
6055 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6057 (gnus-summary-goto-article (car to) nil t)
6058 (error "Article history empty")))
6059 (gnus-summary-position-point))
6061 ;; Summary commands and functions for limiting the summary buffer.
6063 (defun gnus-summary-limit-to-articles (n)
6064 "Limit the summary buffer to the next N articles.
6065 If not given a prefix, use the process marked articles instead."
6068 (let ((articles (gnus-summary-work-articles n)))
6069 (setq gnus-newsgroup-processable nil)
6070 (gnus-summary-limit articles))
6071 (gnus-summary-position-point)))
6073 (defun gnus-summary-pop-limit (&optional total)
6074 "Restore the previous limit.
6075 If given a prefix, remove all limits."
6078 (setq gnus-newsgroup-limits
6079 (list (mapcar (lambda (h) (mail-header-number h))
6080 gnus-newsgroup-headers))))
6081 (unless gnus-newsgroup-limits
6082 (error "No limit to pop"))
6084 (gnus-summary-limit nil 'pop)
6085 (gnus-summary-position-point)))
6087 (defun gnus-summary-limit-to-subject (subject &optional header)
6088 "Limit the summary buffer to articles that have subjects that match a regexp."
6089 (interactive "sLimit to subject (regexp): ")
6091 (setq header "subject"))
6092 (when (not (equal "" subject))
6094 (let ((articles (gnus-summary-find-matching
6095 (or header "subject") subject 'all)))
6097 (error "Found no matches for \"%s\"" subject))
6098 (gnus-summary-limit articles))
6099 (gnus-summary-position-point))))
6101 (defun gnus-summary-limit-to-author (from)
6102 "Limit the summary buffer to articles that have authors that match a regexp."
6103 (interactive "sLimit to author (regexp): ")
6104 (gnus-summary-limit-to-subject from "from"))
6106 (defun gnus-summary-limit-to-age (age &optional younger-p)
6107 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6108 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6109 articles that are younger than AGE days."
6110 (interactive "nTime in days: \nP")
6112 (let ((data gnus-newsgroup-data)
6113 (cutoff (days-to-time age))
6114 articles d date is-younger)
6115 (while (setq d (pop data))
6116 (when (and (vectorp (gnus-data-header d))
6117 (setq date (mail-header-date (gnus-data-header d))))
6118 (setq is-younger (time-less-p
6119 (time-since (date-to-time date))
6124 (push (gnus-data-number d) articles))))
6125 (gnus-summary-limit (nreverse articles)))
6126 (gnus-summary-position-point)))
6128 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6130 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6132 (defun gnus-summary-limit-to-unread (&optional all)
6133 "Limit the summary buffer to articles that are not marked as read.
6134 If ALL is non-nil, limit strictly to unread articles."
6137 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6138 (gnus-summary-limit-to-marks
6139 ;; Concat all the marks that say that an article is read and have
6141 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6142 gnus-killed-mark gnus-kill-file-mark
6143 gnus-low-score-mark gnus-expirable-mark
6144 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6145 gnus-duplicate-mark gnus-souped-mark)
6148 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6149 (make-obsolete 'gnus-summary-delete-marked-with
6150 'gnus-summary-limit-exlude-marks)
6152 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6153 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6154 If REVERSE, limit the summary buffer to articles that are marked
6155 with MARKS. MARKS can either be a string of marks or a list of marks.
6156 Returns how many articles were removed."
6157 (interactive "sMarks: ")
6158 (gnus-summary-limit-to-marks marks t))
6160 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6161 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6162 If REVERSE (the prefix), limit the summary buffer to articles that are
6163 not marked with MARKS. MARKS can either be a string of marks or a
6165 Returns how many articles were removed."
6166 (interactive "sMarks: \nP")
6168 (let ((data gnus-newsgroup-data)
6169 (marks (if (listp marks) marks
6170 (append marks nil))) ; Transform to list.
6173 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6174 (memq (gnus-data-mark (car data)) marks))
6175 (push (gnus-data-number (car data)) articles))
6176 (setq data (cdr data)))
6177 (gnus-summary-limit articles))
6178 (gnus-summary-position-point)))
6180 (defun gnus-summary-limit-to-score (&optional score)
6181 "Limit to articles with score at or above SCORE."
6183 (setq score (if score
6184 (prefix-numeric-value score)
6185 (or gnus-summary-default-score 0)))
6186 (let ((data gnus-newsgroup-data)
6189 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6191 (push (gnus-data-number (car data)) articles))
6192 (setq data (cdr data)))
6194 (gnus-summary-limit articles)
6195 (gnus-summary-position-point))))
6197 (defun gnus-summary-limit-include-thread (id)
6198 "Display all the hidden articles that in the current thread."
6199 (interactive (list (mail-header-id (gnus-summary-article-header))))
6200 (let ((articles (gnus-articles-in-thread
6201 (gnus-id-to-thread (gnus-root-id id)))))
6203 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6204 (gnus-summary-position-point))))
6206 (defun gnus-summary-limit-include-dormant ()
6207 "Display all the hidden articles that are marked as dormant.
6208 Note that this command only works on a subset of the articles currently
6209 fetched for this group."
6211 (unless gnus-newsgroup-dormant
6212 (error "There are no dormant articles in this group"))
6214 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6215 (gnus-summary-position-point)))
6217 (defun gnus-summary-limit-exclude-dormant ()
6218 "Hide all dormant articles."
6221 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6222 (gnus-summary-position-point)))
6224 (defun gnus-summary-limit-exclude-childless-dormant ()
6225 "Hide all dormant articles that have no children."
6227 (let ((data (gnus-data-list t))
6228 articles d children)
6229 ;; Find all articles that are either not dormant or have
6231 (while (setq d (pop data))
6232 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6234 (gnus-article-children (gnus-data-number d)))
6237 (when (memq (car children) articles)
6242 (push (gnus-data-number d) articles)))
6245 (gnus-summary-limit articles)
6246 (gnus-summary-position-point))))
6248 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6249 "Mark all unread excluded articles as read.
6250 If ALL, mark even excluded ticked and dormants as read."
6252 (let ((articles (gnus-sorted-complement
6254 (mapcar (lambda (h) (mail-header-number h))
6255 gnus-newsgroup-headers)
6257 (sort gnus-newsgroup-limit '<)))
6259 (setq gnus-newsgroup-unreads
6260 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6262 (setq gnus-newsgroup-dormant nil
6263 gnus-newsgroup-marked nil
6264 gnus-newsgroup-reads
6266 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6267 gnus-newsgroup-reads))
6268 (while (setq article (pop articles))
6269 (unless (or (memq article gnus-newsgroup-dormant)
6270 (memq article gnus-newsgroup-marked))
6271 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6273 (defun gnus-summary-limit (articles &optional pop)
6275 ;; We pop the previous limit off the stack and use that.
6276 (setq articles (car gnus-newsgroup-limits)
6277 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6278 ;; We use the new limit, so we push the old limit on the stack.
6279 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6281 (setq gnus-newsgroup-limit articles)
6282 (let ((total (length gnus-newsgroup-data))
6283 (data (gnus-data-find-list (gnus-summary-article-number)))
6284 (gnus-summary-mark-below nil) ; Inhibit this.
6286 ;; This will do all the work of generating the new summary buffer
6287 ;; according to the new limit.
6288 (gnus-summary-prepare)
6289 ;; Hide any threads, possibly.
6290 (and gnus-show-threads
6291 gnus-thread-hide-subtree
6292 (gnus-summary-hide-all-threads))
6293 ;; Try to return to the article you were at, or one in the
6296 ;; We try to find some article after the current one.
6298 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6301 (setq data (cdr data))))
6303 ;; If there is no data, that means that we were after the last
6304 ;; article. The same goes when we can't find any articles
6305 ;; after the current one.
6306 (goto-char (point-max))
6307 (gnus-summary-find-prev))
6308 (gnus-set-mode-line 'summary)
6309 ;; We return how many articles were removed from the summary
6310 ;; buffer as a result of the new limit.
6311 (- total (length gnus-newsgroup-data))))
6313 (defsubst gnus-invisible-cut-children (threads)
6316 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6321 (defsubst gnus-cut-thread (thread)
6322 "Go forwards in the thread until we find an article that we want to display."
6323 (when (or (eq gnus-fetch-old-headers 'some)
6324 (eq gnus-fetch-old-headers 'invisible)
6325 (eq gnus-build-sparse-threads 'some)
6326 (eq gnus-build-sparse-threads 'more))
6327 ;; Deal with old-fetched headers and sparse threads.
6331 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6332 (gnus-summary-article-ancient-p
6333 (mail-header-number (car thread))))
6334 (if (or (<= (length (cdr thread)) 1)
6335 (eq gnus-fetch-old-headers 'invisible))
6336 (setq gnus-newsgroup-limit
6337 (delq (mail-header-number (car thread))
6338 gnus-newsgroup-limit)
6339 thread (cadr thread))
6340 (when (gnus-invisible-cut-children (cdr thread))
6341 (let ((th (cdr thread)))
6343 (if (memq (mail-header-number (caar th))
6344 gnus-newsgroup-limit)
6345 (setq thread (car th)
6347 (setq th (cdr th))))))))))
6350 (defun gnus-cut-threads (threads)
6351 "Cut off all uninteresting articles from the beginning of threads."
6352 (when (or (eq gnus-fetch-old-headers 'some)
6353 (eq gnus-fetch-old-headers 'invisible)
6354 (eq gnus-build-sparse-threads 'some)
6355 (eq gnus-build-sparse-threads 'more))
6358 (setcar th (gnus-cut-thread (car th)))
6359 (setq th (cdr th)))))
6360 ;; Remove nixed out threads.
6363 (defun gnus-summary-initial-limit (&optional show-if-empty)
6364 "Figure out what the initial limit is supposed to be on group entry.
6365 This entails weeding out unwanted dormants, low-scored articles,
6366 fetch-old-headers verbiage, and so on."
6367 ;; Most groups have nothing to remove.
6368 (if (or gnus-inhibit-limiting
6369 (and (null gnus-newsgroup-dormant)
6370 (not (eq gnus-fetch-old-headers 'some))
6371 (not (eq gnus-fetch-old-headers 'invisible))
6372 (null gnus-summary-expunge-below)
6373 (not (eq gnus-build-sparse-threads 'some))
6374 (not (eq gnus-build-sparse-threads 'more))
6375 (null gnus-thread-expunge-below)
6376 (not gnus-use-nocem)))
6378 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6379 (setq gnus-newsgroup-limit nil)
6382 (unless (car (symbol-value node))
6383 ;; These threads have no parents -- they are roots.
6384 (let ((nodes (cdr (symbol-value node)))
6387 (if (and gnus-thread-expunge-below
6388 (< (gnus-thread-total-score (car nodes))
6389 gnus-thread-expunge-below))
6390 (gnus-expunge-thread (pop nodes))
6391 (setq thread (pop nodes))
6392 (gnus-summary-limit-children thread))))))
6393 gnus-newsgroup-dependencies)
6394 ;; If this limitation resulted in an empty group, we might
6395 ;; pop the previous limit and use it instead.
6396 (when (and (not gnus-newsgroup-limit)
6398 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6399 gnus-newsgroup-limit))
6401 (defun gnus-summary-limit-children (thread)
6402 "Return 1 if this subthread is visible and 0 if it is not."
6403 ;; First we get the number of visible children to this thread. This
6404 ;; is done by recursing down the thread using this function, so this
6405 ;; will really go down to a leaf article first, before slowly
6406 ;; working its way up towards the root.
6410 (apply '+ (mapcar 'gnus-summary-limit-children
6413 (number (mail-header-number (car thread)))
6416 (not (memq number gnus-newsgroup-marked))
6418 ;; If this article is dormant and has absolutely no visible
6419 ;; children, then this article isn't visible.
6420 (and (memq number gnus-newsgroup-dormant)
6422 ;; If this is "fetch-old-headered" and there is no
6423 ;; visible children, then we don't want this article.
6424 (and (eq gnus-fetch-old-headers 'some)
6425 (gnus-summary-article-ancient-p number)
6427 ;; If this is "fetch-old-headered" and `invisible', then
6428 ;; we don't want this article.
6429 (and (eq gnus-fetch-old-headers 'invisible)
6430 (gnus-summary-article-ancient-p number))
6431 ;; If this is a sparsely inserted article with no children,
6432 ;; we don't want it.
6433 (and (eq gnus-build-sparse-threads 'some)
6434 (gnus-summary-article-sparse-p number)
6436 ;; If we use expunging, and this article is really
6437 ;; low-scored, then we don't want this article.
6438 (when (and gnus-summary-expunge-below
6440 (or (cdr (assq number gnus-newsgroup-scored))
6441 gnus-summary-default-score))
6442 gnus-summary-expunge-below))
6443 ;; We increase the expunge-tally here, but that has
6444 ;; nothing to do with the limits, really.
6445 (incf gnus-newsgroup-expunged-tally)
6446 ;; We also mark as read here, if that's wanted.
6447 (when (and gnus-summary-mark-below
6448 (< score gnus-summary-mark-below))
6449 (setq gnus-newsgroup-unreads
6450 (delq number gnus-newsgroup-unreads))
6451 (if gnus-newsgroup-auto-expire
6452 (push number gnus-newsgroup-expirable)
6453 (push (cons number gnus-low-score-mark)
6454 gnus-newsgroup-reads)))
6456 ;; Check NoCeM things.
6457 (if (and gnus-use-nocem
6458 (gnus-nocem-unwanted-article-p
6459 (mail-header-id (car thread))))
6461 (setq gnus-newsgroup-unreads
6462 (delq number gnus-newsgroup-unreads))
6464 ;; Nope, invisible article.
6466 ;; Ok, this article is to be visible, so we add it to the limit
6468 (push number gnus-newsgroup-limit)
6471 (defun gnus-expunge-thread (thread)
6472 "Mark all articles in THREAD as read."
6473 (let* ((number (mail-header-number (car thread))))
6474 (incf gnus-newsgroup-expunged-tally)
6475 ;; We also mark as read here, if that's wanted.
6476 (setq gnus-newsgroup-unreads
6477 (delq number gnus-newsgroup-unreads))
6478 (if gnus-newsgroup-auto-expire
6479 (push number gnus-newsgroup-expirable)
6480 (push (cons number gnus-low-score-mark)
6481 gnus-newsgroup-reads)))
6482 ;; Go recursively through all subthreads.
6483 (mapcar 'gnus-expunge-thread (cdr thread)))
6485 ;; Summary article oriented commands
6487 (defun gnus-summary-refer-parent-article (n)
6488 "Refer parent article N times.
6489 If N is negative, go to ancestor -N instead.
6490 The difference between N and the number of articles fetched is returned."
6494 (when (not (natnump n))
6499 (setq header (gnus-summary-article-header))
6500 (if (and (eq (mail-header-number header)
6501 (cdr gnus-article-current))
6502 (equal gnus-newsgroup-name
6503 (car gnus-article-current)))
6504 ;; If we try to find the parent of the currently
6505 ;; displayed article, then we take a look at the actual
6506 ;; References header, since this is slightly more
6507 ;; reliable than the References field we got from the
6510 (set-buffer gnus-original-article-buffer)
6511 (nnheader-narrow-to-headers)
6512 (unless (setq ref (message-fetch-field "references"))
6513 (setq ref (message-fetch-field "in-reply-to")))
6516 ;; It's not the current article, so we take a bet on
6517 ;; the value we got from the server.
6518 (mail-header-references header)))
6520 (not (equal ref "")))
6521 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6522 (gnus-message 1 "Couldn't find parent"))
6523 (gnus-message 1 "No references in article %d"
6524 (gnus-summary-article-number))
6527 (gnus-summary-position-point)
6530 (defun gnus-summary-refer-references ()
6531 "Fetch all articles mentioned in the References header.
6532 Return the number of articles fetched."
6534 (let ((ref (mail-header-references (gnus-summary-article-header)))
6535 (current (gnus-summary-article-number))
6539 (error "No References in the current article")
6540 ;; For each Message-ID in the References header...
6541 (while (string-match "<[^>]*>" ref)
6543 ;; ... fetch that article.
6544 (gnus-summary-refer-article
6545 (prog1 (match-string 0 ref)
6546 (setq ref (substring ref (match-end 0))))))
6547 (gnus-summary-goto-subject current)
6548 (gnus-summary-position-point)
6551 (defun gnus-summary-refer-thread (&optional limit)
6552 "Fetch all articles in the current thread.
6553 If LIMIT (the numerical prefix), fetch that many old headers instead
6554 of what's specified by the `gnus-refer-thread-limit' variable."
6556 (let ((id (mail-header-id (gnus-summary-article-header)))
6557 (limit (if limit (prefix-numeric-value limit)
6558 gnus-refer-thread-limit)))
6559 ;; We want to fetch LIMIT *old* headers, but we also have to
6560 ;; re-fetch all the headers in the current buffer, because many of
6561 ;; them may be undisplayed. So we adjust LIMIT.
6562 (when (numberp limit)
6563 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6564 (unless (eq gnus-fetch-old-headers 'invisible)
6565 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6566 ;; Retrieve the headers and read them in.
6567 (if (eq (gnus-retrieve-headers
6568 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6570 (gnus-build-all-threads)
6571 (error "Can't fetch thread from backends that don't support NOV"))
6572 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6573 (gnus-summary-limit-include-thread id)))
6575 (defun gnus-summary-refer-article (message-id &optional arg)
6576 "Fetch an article specified by MESSAGE-ID.
6577 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6578 or `gnus-select-method', no matter what backend the article comes from."
6579 (interactive "sMessage-ID: \nP")
6580 (when (and (stringp message-id)
6581 (not (zerop (length message-id))))
6582 ;; Construct the correct Message-ID if necessary.
6583 ;; Suggested by tale@pawl.rpi.edu.
6584 (unless (string-match "^<" message-id)
6585 (setq message-id (concat "<" message-id)))
6586 (unless (string-match ">$" message-id)
6587 (setq message-id (concat message-id ">")))
6588 (let* ((header (gnus-id-to-header message-id))
6590 (gnus-summary-article-sparse-p
6591 (mail-header-number header))
6592 (memq (mail-header-number header)
6593 gnus-newsgroup-limit))))
6595 ;; If the article is present in the buffer we just go to it.
6597 (or (not (gnus-summary-article-sparse-p
6598 (mail-header-number header)))
6601 (gnus-summary-goto-article
6602 (mail-header-number header) nil t)
6604 (gnus-summary-update-article (mail-header-number header)))))
6606 ;; We fetch the article
6607 (let ((gnus-override-method
6608 (cond ((gnus-news-group-p gnus-newsgroup-name)
6609 gnus-refer-article-method)
6611 (or gnus-refer-article-method gnus-select-method))
6614 ;; Start the special refer-article method, if necessary.
6615 (when (and gnus-refer-article-method
6616 (gnus-news-group-p gnus-newsgroup-name))
6617 (gnus-check-server gnus-refer-article-method))
6618 ;; Fetch the header, and display the article.
6619 (if (setq number (gnus-summary-insert-subject message-id))
6620 (gnus-summary-select-article nil nil nil number)
6621 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6623 (defun gnus-summary-edit-parameters ()
6624 "Edit the group parameters of the current group."
6626 (gnus-group-edit-group gnus-newsgroup-name 'params))
6628 (defun gnus-summary-customize-parameters ()
6629 "Customize the group parameters of the current group."
6631 (gnus-group-customize gnus-newsgroup-name))
6633 (defun gnus-summary-enter-digest-group (&optional force)
6634 "Enter an nndoc group based on the current article.
6635 If FORCE, force a digest interpretation. If not, try
6636 to guess what the document format is."
6638 (let ((conf gnus-current-window-configuration))
6640 (gnus-summary-select-article))
6641 (setq gnus-current-window-configuration conf)
6642 (let* ((name (format "%s-%d"
6643 (gnus-group-prefixed-name
6644 gnus-newsgroup-name (list 'nndoc ""))
6646 (set-buffer gnus-summary-buffer)
6647 gnus-current-article)))
6648 (ogroup gnus-newsgroup-name)
6649 (params (append (gnus-info-params (gnus-get-info ogroup))
6650 (list (cons 'to-group ogroup))
6651 (list (cons 'save-article-group ogroup))))
6652 (case-fold-search t)
6653 (buf (current-buffer))
6656 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6657 (insert-buffer-substring gnus-original-article-buffer)
6658 ;; Remove lines that may lead nndoc to misinterpret the
6661 (goto-char (point-min))
6662 (or (search-forward "\n\n" nil t) (point)))
6663 (goto-char (point-min))
6664 (delete-matching-lines "^\\(Path\\):\\|^From ")
6667 (if (gnus-group-read-ephemeral-group
6668 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6670 ,(if force 'digest 'guess))) t)
6671 ;; Make all postings to this group go to the parent group.
6672 (nconc (gnus-info-params (gnus-get-info name))
6674 ;; Couldn't select this doc group.
6675 (switch-to-buffer buf)
6676 (gnus-set-global-variables)
6677 (gnus-configure-windows 'summary)
6678 (gnus-message 3 "Article couldn't be entered?"))
6679 (kill-buffer dig)))))
6681 (defun gnus-summary-read-document (n)
6682 "Open a new group based on the current article(s).
6683 This will allow you to read digests and other similar
6684 documents as newsgroups.
6685 Obeys the standard process/prefix convention."
6687 (let* ((articles (gnus-summary-work-articles n))
6688 (ogroup gnus-newsgroup-name)
6689 (params (append (gnus-info-params (gnus-get-info ogroup))
6690 (list (cons 'to-group ogroup))))
6691 article group egroup groups vgroup)
6692 (while (setq article (pop articles))
6693 (setq group (format "%s-%d" gnus-newsgroup-name article))
6694 (gnus-summary-remove-process-mark article)
6695 (when (gnus-summary-display-article article)
6698 (insert-buffer-substring gnus-original-article-buffer)
6699 ;; Remove some headers that may lead nndoc to make
6701 (message-narrow-to-head)
6702 (goto-char (point-min))
6703 (delete-matching-lines "^\\(Path\\):\\|^From ")
6706 (gnus-group-read-ephemeral-group
6707 group `(nndoc ,group (nndoc-address ,(current-buffer))
6708 (nndoc-article-type guess))
6711 ;; Make all postings to this group go to the parent group.
6712 (nconc (gnus-info-params (gnus-get-info egroup))
6714 (push egroup groups))
6715 ;; Couldn't select this doc group.
6716 (gnus-error 3 "Article couldn't be entered"))))))
6717 ;; Now we have selected all the documents.
6720 (error "None of the articles could be interpreted as documents"))
6721 ((gnus-group-read-ephemeral-group
6722 (setq vgroup (format
6723 "nnvirtual:%s-%s" gnus-newsgroup-name
6724 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6725 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6727 (cons (current-buffer) 'summary)))
6729 (error "Couldn't select virtual nndoc group")))))
6731 (defun gnus-summary-isearch-article (&optional regexp-p)
6732 "Do incremental search forward on the current article.
6733 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6735 (gnus-summary-select-article)
6736 (gnus-configure-windows 'article)
6737 (gnus-eval-in-buffer-window gnus-article-buffer
6740 (isearch-forward regexp-p))))
6742 (defun gnus-summary-search-article-forward (regexp &optional backward)
6743 "Search for an article containing REGEXP forward.
6744 If BACKWARD, search backward instead."
6747 (format "Search article %s (regexp%s): "
6748 (if current-prefix-arg "backward" "forward")
6749 (if gnus-last-search-regexp
6750 (concat ", default " gnus-last-search-regexp)
6752 current-prefix-arg))
6753 (if (string-equal regexp "")
6754 (setq regexp (or gnus-last-search-regexp ""))
6755 (setq gnus-last-search-regexp regexp))
6756 (if (gnus-summary-search-article regexp backward)
6757 (gnus-summary-show-thread)
6758 (error "Search failed: \"%s\"" regexp)))
6760 (defun gnus-summary-search-article-backward (regexp)
6761 "Search for an article containing REGEXP backward."
6764 (format "Search article backward (regexp%s): "
6765 (if gnus-last-search-regexp
6766 (concat ", default " gnus-last-search-regexp)
6768 (gnus-summary-search-article-forward regexp 'backward))
6770 (defun gnus-summary-search-article (regexp &optional backward)
6771 "Search for an article containing REGEXP.
6772 Optional argument BACKWARD means do search for backward.
6773 `gnus-select-article-hook' is not called during the search."
6774 ;; We have to require this here to make sure that the following
6775 ;; dynamic binding isn't shadowed by autoloading.
6776 (require 'gnus-async)
6778 (let ((gnus-select-article-hook nil) ;Disable hook.
6779 (gnus-article-display-hook nil)
6780 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6781 (gnus-use-article-prefetch nil)
6782 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6783 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6784 (sum (current-buffer))
6787 (gnus-save-hidden-threads
6788 (gnus-summary-select-article)
6789 (set-buffer gnus-article-buffer)
6793 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6795 (re-search-backward regexp nil t)
6796 (re-search-forward regexp nil t))
6797 ;; We found the regexp.
6802 (get-buffer-window (current-buffer))
6806 (setq point (point)))
6807 ;; We didn't find it, so we go to the next article.
6810 (while (eq found 'not)
6811 (if (not (if backward (gnus-summary-find-prev)
6812 (gnus-summary-find-next)))
6813 ;; No more articles.
6815 ;; Select the next article and adjust point.
6816 (unless (gnus-summary-article-sparse-p
6817 (gnus-summary-article-number))
6819 (gnus-summary-select-article)
6820 (set-buffer gnus-article-buffer)
6822 (goto-char (if backward (point-max) (point-min))))))))
6823 (gnus-message 7 ""))
6824 ;; Return whether we found the regexp.
6825 (when (eq found 'found)
6827 (gnus-summary-show-thread)
6828 (gnus-summary-goto-subject gnus-current-article)
6829 (gnus-summary-position-point)
6832 (defun gnus-summary-find-matching (header regexp &optional backward unread
6834 "Return a list of all articles that match REGEXP on HEADER.
6835 The search stars on the current article and goes forwards unless
6836 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6837 If UNREAD is non-nil, only unread articles will
6838 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6839 in the comparisons."
6840 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6841 (gnus-data-find-list
6842 (gnus-summary-article-number) (gnus-data-list backward))))
6843 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6844 (case-fold-search (not not-case-fold))
6846 (unless (fboundp (intern (concat "mail-header-" header)))
6847 (error "%s is not a valid header" header))
6850 (and (or (not unread) ; We want all articles...
6851 (gnus-data-unread-p d)) ; Or just unreads.
6852 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6853 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6854 (push (gnus-data-number d) articles)) ; Success!
6855 (setq data (cdr data)))
6856 (nreverse articles)))
6858 (defun gnus-summary-execute-command (header regexp command &optional backward)
6859 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6860 If HEADER is an empty string (or nil), the match is done on the entire
6861 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6863 (list (let ((completion-ignore-case t))
6866 (mapcar (lambda (string) (list string))
6867 '("Number" "Subject" "From" "Lines" "Date"
6868 "Message-ID" "Xref" "References" "Body"))
6869 nil 'require-match))
6870 (read-string "Regexp: ")
6871 (read-key-sequence "Command: ")
6872 current-prefix-arg))
6873 (when (equal header "Body")
6875 ;; Hidden thread subtrees must be searched as well.
6876 (gnus-summary-show-all-threads)
6877 ;; We don't want to change current point nor window configuration.
6879 (save-window-excursion
6880 (gnus-message 6 "Executing %s..." (key-description command))
6881 ;; We'd like to execute COMMAND interactively so as to give arguments.
6882 (gnus-execute header regexp
6883 `(call-interactively ',(key-binding command))
6885 (gnus-message 6 "Executing %s...done" (key-description command)))))
6887 (defun gnus-summary-beginning-of-article ()
6888 "Scroll the article back to the beginning."
6890 (gnus-summary-select-article)
6891 (gnus-configure-windows 'article)
6892 (gnus-eval-in-buffer-window gnus-article-buffer
6894 (goto-char (point-min))
6895 (when gnus-page-broken
6896 (gnus-narrow-to-page))))
6898 (defun gnus-summary-end-of-article ()
6899 "Scroll to the end of the article."
6901 (gnus-summary-select-article)
6902 (gnus-configure-windows 'article)
6903 (gnus-eval-in-buffer-window gnus-article-buffer
6905 (goto-char (point-max))
6907 (when gnus-page-broken
6908 (gnus-narrow-to-page))))
6910 (defun gnus-summary-print-article (&optional filename n)
6911 "Generate and print a PostScript image of the N next (mail) articles.
6913 If N is negative, print the N previous articles. If N is nil and articles
6914 have been marked with the process mark, print these instead.
6916 If the optional second argument FILENAME is nil, send the image to the
6917 printer. If FILENAME is a string, save the PostScript image in a file with
6918 that name. If FILENAME is a number, prompt the user for the name of the file
6920 (interactive (list (ps-print-preprint current-prefix-arg)
6921 current-prefix-arg))
6922 (dolist (article (gnus-summary-work-articles n))
6923 (gnus-summary-select-article nil nil 'pseudo article)
6924 (gnus-eval-in-buffer-window gnus-article-buffer
6925 (let ((buffer (generate-new-buffer " *print*")))
6928 (copy-to-buffer buffer (point-min) (point-max))
6930 (gnus-article-delete-invisible-text)
6931 (let ((ps-left-header
6934 (mail-header-subject gnus-current-headers) ")")
6936 (mail-header-from gnus-current-headers) ")")))
6939 "/pagenumberstring load"
6941 (mail-header-date gnus-current-headers) ")"))))
6942 (gnus-run-hooks 'gnus-ps-print-hook)
6944 (ps-print-buffer-with-faces filename))))
6945 (kill-buffer buffer))))))
6947 (defun gnus-summary-show-article (&optional arg)
6948 "Force re-fetching of the current article.
6949 If ARG (the prefix) is non-nil, show the raw article without any
6950 article massaging functions being run."
6953 ;; Select the article the normal way.
6954 (gnus-summary-select-article nil 'force)
6955 ;; We have to require this here to make sure that the following
6956 ;; dynamic binding isn't shadowed by autoloading.
6957 (require 'gnus-async)
6959 ;; Bind the article treatment functions to nil.
6960 (let ((gnus-have-all-headers t)
6961 gnus-article-display-hook
6962 gnus-article-prepare-hook
6963 gnus-article-decode-hook
6967 (gnus-summary-select-article nil 'force)))
6968 (gnus-summary-goto-subject gnus-current-article)
6969 (gnus-summary-position-point))
6971 (defun gnus-summary-verbose-headers (&optional arg)
6972 "Toggle permanent full header display.
6973 If ARG is a positive number, turn header display on.
6974 If ARG is a negative number, turn header display off."
6976 (setq gnus-show-all-headers
6977 (cond ((or (not (numberp arg))
6979 (not gnus-show-all-headers))
6982 (gnus-summary-show-article))
6984 (defun gnus-summary-toggle-header (&optional arg)
6985 "Show the headers if they are hidden, or hide them if they are shown.
6986 If ARG is a positive number, show the entire header.
6987 If ARG is a negative number, hide the unwanted header lines."
6990 (set-buffer gnus-article-buffer)
6991 (let* ((buffer-read-only nil)
6992 (inhibit-point-motion-hooks t)
6993 (hidden (text-property-any
6994 (goto-char (point-min)) (search-forward "\n\n")
6997 (goto-char (point-min))
6998 (when (search-forward "\n\n" nil t)
6999 (delete-region (point-min) (1- (point))))
7000 (goto-char (point-min))
7002 (set-buffer gnus-original-article-buffer)
7003 (goto-char (point-min))
7004 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7005 (insert-buffer-substring gnus-original-article-buffer 1 e)
7006 (let ((article-inhibit-hiding t))
7007 (gnus-run-hooks 'gnus-article-display-hook))
7008 (when (or (not hidden) (and (numberp arg) (< arg 0)))
7009 (gnus-article-hide-headers)))))
7011 (defun gnus-summary-show-all-headers ()
7012 "Make all header lines visible."
7014 (gnus-article-show-all-headers))
7016 (defun gnus-summary-toggle-mime (&optional arg)
7017 "Toggle MIME processing.
7018 If ARG is a positive number, turn MIME processing on."
7020 (setq gnus-show-mime
7021 (if (null arg) (not gnus-show-mime)
7022 (> (prefix-numeric-value arg) 0)))
7023 (gnus-summary-select-article t 'force))
7025 (defun gnus-summary-caesar-message (&optional arg)
7026 "Caesar rotate the current article by 13.
7027 The numerical prefix specifies how many places to rotate each letter
7030 (gnus-summary-select-article)
7031 (let ((mail-header-separator ""))
7032 (gnus-eval-in-buffer-window gnus-article-buffer
7035 (let ((start (window-start))
7037 (message-caesar-buffer-body arg)
7038 (set-window-start (get-buffer-window (current-buffer)) start))))))
7040 (defun gnus-summary-stop-page-breaking ()
7041 "Stop page breaking in the current article."
7043 (gnus-summary-select-article)
7044 (gnus-eval-in-buffer-window gnus-article-buffer
7046 (when (gnus-visual-p 'page-marker)
7047 (let ((buffer-read-only nil))
7048 (gnus-remove-text-with-property 'gnus-prev)
7049 (gnus-remove-text-with-property 'gnus-next))
7050 (setq gnus-page-broken nil))))
7052 (defun gnus-summary-move-article (&optional n to-newsgroup
7053 select-method action)
7054 "Move the current article to a different newsgroup.
7055 If N is a positive number, move the N next articles.
7056 If N is a negative number, move the N previous articles.
7057 If N is nil and any articles have been marked with the process mark,
7058 move those articles instead.
7059 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7060 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7061 re-spool using this method.
7063 For this function to work, both the current newsgroup and the
7064 newsgroup that you want to move to have to support the `request-move'
7065 and `request-accept' functions."
7068 (setq action 'move))
7069 ;; Disable marking as read.
7070 (let (gnus-mark-article-hook)
7071 (save-window-excursion
7072 (gnus-summary-select-article)))
7073 ;; Check whether the source group supports the required functions.
7074 (cond ((and (eq action 'move)
7075 (not (gnus-check-backend-function
7076 'request-move-article gnus-newsgroup-name)))
7077 (error "The current group does not support article moving"))
7078 ((and (eq action 'crosspost)
7079 (not (gnus-check-backend-function
7080 'request-replace-article gnus-newsgroup-name)))
7081 (error "The current group does not support article editing")))
7082 (let ((articles (gnus-summary-work-articles n))
7083 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7084 (names '((move "Move" "Moving")
7085 (copy "Copy" "Copying")
7086 (crosspost "Crosspost" "Crossposting")))
7087 (copy-buf (save-excursion
7088 (nnheader-set-temp-buffer " *copy article*")))
7089 art-group to-method new-xref article to-groups)
7090 (unless (assq action names)
7091 (error "Unknown action %s" action))
7092 ;; Read the newsgroup name.
7093 (when (and (not to-newsgroup)
7094 (not select-method))
7096 (gnus-read-move-group-name
7097 (cadr (assq action names))
7098 (symbol-value (intern (format "gnus-current-%s-group" action)))
7100 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7101 (setq to-method (or select-method
7102 (gnus-group-name-to-method to-newsgroup)))
7103 ;; Check the method we are to move this article to...
7104 (unless (gnus-check-backend-function
7105 'request-accept-article (car to-method))
7106 (error "%s does not support article copying" (car to-method)))
7107 (unless (gnus-check-server to-method)
7108 (error "Can't open server %s" (car to-method)))
7109 (gnus-message 6 "%s to %s: %s..."
7110 (caddr (assq action names))
7111 (or (car select-method) to-newsgroup) articles)
7113 (setq article (pop articles))
7117 ;; Move the article.
7119 ;; Remove this article from future suppression.
7120 (gnus-dup-unsuppress-article article)
7121 (gnus-request-move-article
7122 article ; Article to move
7123 gnus-newsgroup-name ; From newsgroup
7124 (nth 1 (gnus-find-method-for-group
7125 gnus-newsgroup-name)) ; Server
7126 (list 'gnus-request-accept-article
7127 to-newsgroup (list 'quote select-method)
7128 (not articles) t) ; Accept form
7129 (not articles))) ; Only save nov last time
7130 ;; Copy the article.
7133 (set-buffer copy-buf)
7134 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7135 (gnus-request-accept-article
7136 to-newsgroup select-method (not articles) t))))
7137 ;; Crosspost the article.
7138 ((eq action 'crosspost)
7139 (let ((xref (message-tokenize-header
7140 (mail-header-xref (gnus-summary-article-header article))
7142 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7145 (setq xref (list (system-name))))
7148 (mapconcat 'identity
7149 (delete "Xref:" (delete new-xref xref))
7153 (set-buffer copy-buf)
7154 ;; First put the article in the destination group.
7155 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7156 (when (consp (setq art-group
7157 (gnus-request-accept-article
7158 to-newsgroup select-method (not articles))))
7159 (setq new-xref (concat new-xref " " (car art-group)
7160 ":" (cdr art-group)))
7161 ;; Now we have the new Xrefs header, so we insert
7162 ;; it and replace the new article.
7163 (nnheader-replace-header "Xref" new-xref)
7164 (gnus-request-replace-article
7165 (cdr art-group) to-newsgroup (current-buffer))
7169 (gnus-message 1 "Couldn't %s article %s"
7170 (cadr (assq action names)) article))
7171 ((and (eq art-group 'junk)
7173 (gnus-summary-mark-article article gnus-canceled-mark)
7174 (gnus-message 4 "Deleted article %s" article))
7176 (let* ((pto-group (gnus-group-prefixed-name
7177 (car art-group) to-method))
7179 (gnus-gethash pto-group gnus-newsrc-hashtb))
7180 (info (nth 2 entry))
7181 (to-group (gnus-info-group info)))
7182 ;; Update the group that has been moved to.
7184 (memq action '(move copy)))
7185 (unless (member to-group to-groups)
7186 (push to-group to-groups))
7188 (unless (memq article gnus-newsgroup-unreads)
7190 info (gnus-add-to-range (gnus-info-read info)
7191 (list (cdr art-group)))))
7193 ;; Copy any marks over to the new group.
7194 (let ((marks gnus-article-mark-lists)
7195 (to-article (cdr art-group)))
7197 ;; See whether the article is to be put in the cache.
7198 (when gnus-use-cache
7199 (gnus-cache-possibly-enter-article
7201 (let ((header (copy-sequence
7202 (gnus-summary-article-header article))))
7203 (mail-header-set-number header to-article)
7205 (memq article gnus-newsgroup-marked)
7206 (memq article gnus-newsgroup-dormant)
7207 (memq article gnus-newsgroup-unreads)))
7209 (when (and (equal to-group gnus-newsgroup-name)
7210 (not (memq article gnus-newsgroup-unreads)))
7211 ;; Mark this article as read in this group.
7212 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7213 (setcdr (gnus-active to-group) to-article)
7214 (setcdr gnus-newsgroup-active to-article))
7217 (when (memq article (symbol-value
7218 (intern (format "gnus-newsgroup-%s"
7220 ;; If the other group is the same as this group,
7221 ;; then we have to add the mark to the list.
7222 (when (equal to-group gnus-newsgroup-name)
7223 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7226 (intern (format "gnus-newsgroup-%s"
7228 ;; Copy the marks to other group.
7229 (gnus-add-marked-articles
7230 to-group (cdar marks) (list to-article) info))
7231 (setq marks (cdr marks)))
7234 (concat "(gnus-group-set-info '"
7235 (gnus-prin1-to-string (gnus-get-info to-group))
7238 ;; Update the Xref header in this article to point to
7239 ;; the new crossposted article we have just created.
7240 (when (eq action 'crosspost)
7242 (set-buffer copy-buf)
7243 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7244 (nnheader-replace-header "Xref" new-xref)
7245 (gnus-request-replace-article
7246 article gnus-newsgroup-name (current-buffer)))))
7248 ;;;!!!Why is this necessary?
7249 (set-buffer gnus-summary-buffer)
7251 (gnus-summary-goto-subject article)
7252 (when (eq action 'move)
7253 (gnus-summary-mark-article article gnus-canceled-mark))))
7254 (gnus-summary-remove-process-mark article))
7255 ;; Re-activate all groups that have been moved to.
7258 (set-buffer gnus-group-buffer)
7259 (when (gnus-group-goto-group (car to-groups) t)
7260 (gnus-group-get-new-news-this-group 1 t))
7263 (gnus-kill-buffer copy-buf)
7264 (gnus-summary-position-point)
7265 (gnus-set-mode-line 'summary)))
7267 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7268 "Move the current article to a different newsgroup.
7269 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7270 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7271 re-spool using this method."
7273 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7275 (defun gnus-summary-crosspost-article (&optional n)
7276 "Crosspost the current article to some other group."
7278 (gnus-summary-move-article n nil nil 'crosspost))
7280 (defcustom gnus-summary-respool-default-method nil
7281 "Default method for respooling an article.
7282 If nil, use to the current newsgroup method."
7283 :type '(choice (gnus-select-method :value (nnml ""))
7285 :group 'gnus-summary-mail)
7287 (defun gnus-summary-respool-article (&optional n method)
7288 "Respool the current article.
7289 The article will be squeezed through the mail spooling process again,
7290 which means that it will be put in some mail newsgroup or other
7291 depending on `nnmail-split-methods'.
7292 If N is a positive number, respool the N next articles.
7293 If N is a negative number, respool the N previous articles.
7294 If N is nil and any articles have been marked with the process mark,
7295 respool those articles instead.
7297 Respooling can be done both from mail groups and \"real\" newsgroups.
7298 In the former case, the articles in question will be moved from the
7299 current group into whatever groups they are destined to. In the
7300 latter case, they will be copied into the relevant groups."
7302 (list current-prefix-arg
7303 (let* ((methods (gnus-methods-using 'respool))
7305 (symbol-name (or gnus-summary-respool-default-method
7306 (car (gnus-find-method-for-group
7307 gnus-newsgroup-name)))))
7309 (gnus-completing-read
7310 methname "What backend do you want to use when respooling?"
7311 methods nil t nil 'gnus-mail-method-history))
7314 ((zerop (length (setq ms (gnus-servers-using-backend
7316 (list (intern method) ""))
7320 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7321 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7324 (error "No method given for respooling"))
7325 (if (assoc (symbol-name
7326 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7327 (gnus-methods-using 'respool))
7328 (gnus-summary-move-article n nil method)
7329 (gnus-summary-copy-article n nil method)))
7331 (defun gnus-summary-import-article (file)
7332 "Import an arbitrary file into a mail newsgroup."
7333 (interactive "fImport file: ")
7334 (let ((group gnus-newsgroup-name)
7335 (now (current-time))
7337 (unless (gnus-check-backend-function 'request-accept-article group)
7338 (error "%s does not support article importing" group))
7339 (or (file-readable-p file)
7340 (not (file-regular-p file))
7341 (error "Can't read %s" file))
7343 (set-buffer (gnus-get-buffer-create " *import file*"))
7345 (nnheader-insert-file-contents file)
7346 (goto-char (point-min))
7347 (unless (nnheader-article-p)
7348 ;; This doesn't look like an article, so we fudge some headers.
7349 (setq atts (file-attributes file)
7350 lines (count-lines (point-min) (point-max)))
7351 (insert "From: " (read-string "From: ") "\n"
7352 "Subject: " (read-string "Subject: ") "\n"
7353 "Date: " (message-make-date (nth 5 atts))
7355 "Message-ID: " (message-make-message-id) "\n"
7356 "Lines: " (int-to-string lines) "\n"
7357 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7358 (gnus-request-accept-article group nil t)
7359 (kill-buffer (current-buffer)))))
7361 (defun gnus-summary-article-posted-p ()
7362 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7363 This will be the case if the article has both been mailed and posted."
7365 (let ((id (mail-header-references (gnus-summary-article-header)))
7366 (gnus-override-method
7367 (or gnus-refer-article-method gnus-select-method)))
7368 (if (gnus-request-head id "")
7369 (gnus-message 2 "The current message was found on %s"
7370 gnus-override-method)
7371 (gnus-message 2 "The current message couldn't be found on %s"
7372 gnus-override-method)
7375 (defun gnus-summary-expire-articles (&optional now)
7376 "Expire all articles that are marked as expirable in the current group."
7378 (when (gnus-check-backend-function
7379 'request-expire-articles gnus-newsgroup-name)
7380 ;; This backend supports expiry.
7381 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7382 (expirable (if total
7384 ;; We need to update the info for
7385 ;; this group for `gnus-list-of-read-articles'
7386 ;; to give us the right answer.
7387 (gnus-run-hooks 'gnus-exit-group-hook)
7388 (gnus-summary-update-info)
7389 (gnus-list-of-read-articles gnus-newsgroup-name))
7390 (setq gnus-newsgroup-expirable
7391 (sort gnus-newsgroup-expirable '<))))
7392 (expiry-wait (if now 'immediate
7393 (gnus-group-find-parameter
7394 gnus-newsgroup-name 'expiry-wait)))
7397 ;; There are expirable articles in this group, so we run them
7398 ;; through the expiry process.
7399 (gnus-message 6 "Expiring articles...")
7400 ;; The list of articles that weren't expired is returned.
7403 (let ((nnmail-expiry-wait-function nil)
7404 (nnmail-expiry-wait expiry-wait))
7405 (setq es (gnus-request-expire-articles
7406 expirable gnus-newsgroup-name)))
7407 (setq es (gnus-request-expire-articles
7408 expirable gnus-newsgroup-name))))
7410 (setq gnus-newsgroup-expirable es))
7411 ;; We go through the old list of expirable, and mark all
7412 ;; really expired articles as nonexistent.
7413 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7414 (let ((gnus-use-cache nil))
7416 (unless (memq (car expirable) es)
7417 (when (gnus-data-find (car expirable))
7418 (gnus-summary-mark-article
7419 (car expirable) gnus-canceled-mark)))
7420 (setq expirable (cdr expirable)))))
7421 (gnus-message 6 "Expiring articles...done")))))
7423 (defun gnus-summary-expire-articles-now ()
7424 "Expunge all expirable articles in the current group.
7425 This means that *all* articles that are marked as expirable will be
7426 deleted forever, right now."
7428 (or gnus-expert-user
7430 "Are you really, really, really sure you want to delete all these messages? ")
7432 (gnus-summary-expire-articles t))
7434 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7435 (defun gnus-summary-delete-article (&optional n)
7436 "Delete the N next (mail) articles.
7437 This command actually deletes articles. This is not a marking
7438 command. The article will disappear forever from your life, never to
7440 If N is negative, delete backwards.
7441 If N is nil and articles have been marked with the process mark,
7442 delete these instead."
7444 (unless (gnus-check-backend-function 'request-expire-articles
7445 gnus-newsgroup-name)
7446 (error "The current newsgroup does not support article deletion"))
7447 ;; Compute the list of articles to delete.
7448 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7450 (if (and gnus-novice-user
7451 (not (gnus-yes-or-no-p
7452 (format "Do you really want to delete %s forever? "
7453 (if (> (length articles) 1)
7454 (format "these %s articles" (length articles))
7457 ;; Delete the articles.
7458 (setq not-deleted (gnus-request-expire-articles
7459 articles gnus-newsgroup-name 'force))
7461 (gnus-summary-remove-process-mark (car articles))
7462 ;; The backend might not have been able to delete the article
7464 (unless (memq (car articles) not-deleted)
7465 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7466 (setq articles (cdr articles)))
7468 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7469 (gnus-summary-position-point)
7470 (gnus-set-mode-line 'summary)
7473 (defun gnus-summary-edit-article (&optional force)
7474 "Edit the current article.
7475 This will have permanent effect only in mail groups.
7476 If FORCE is non-nil, allow editing of articles even in read-only
7480 (set-buffer gnus-summary-buffer)
7481 (gnus-set-global-variables)
7482 (when (and (not force)
7483 (gnus-group-read-only-p))
7484 (error "The current newsgroup does not support article editing"))
7485 ;; Select article if needed.
7486 (unless (eq (gnus-summary-article-number)
7487 gnus-current-article)
7488 (gnus-summary-select-article t))
7489 (gnus-article-date-original)
7490 (gnus-article-edit-article
7491 `(lambda (no-highlight)
7492 (gnus-summary-edit-article-done
7493 ,(or (mail-header-references gnus-current-headers) "")
7494 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7496 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7498 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7500 "Make edits to the current article permanent."
7502 ;; Replace the article.
7503 (let ((buf (current-buffer)))
7506 (if (and (not read-only)
7507 (not (gnus-request-replace-article
7508 (cdr gnus-article-current) (car gnus-article-current)
7510 (error "Couldn't replace article")
7511 ;; Update the summary buffer.
7513 (equal (message-tokenize-header references " ")
7514 (message-tokenize-header
7515 (or (message-fetch-field "references") "") " ")))
7516 ;; We only have to update this line.
7519 (message-narrow-to-head)
7520 (let ((head (buffer-string))
7523 (insert (format "211 %d Article retrieved.\n"
7524 (cdr gnus-article-current)))
7527 (let ((nntp-server-buffer (current-buffer)))
7528 (setq header (car (gnus-get-newsgroup-headers
7530 (set-buffer gnus-summary-buffer)
7531 gnus-newsgroup-dependencies)
7534 (set-buffer gnus-summary-buffer)
7535 (gnus-data-set-header
7536 (gnus-data-find (cdr gnus-article-current))
7538 (gnus-summary-update-article-line
7539 (cdr gnus-article-current) header))))))
7541 (set-buffer (or buffer gnus-summary-buffer))
7542 (gnus-summary-update-article (cdr gnus-article-current)))
7543 ;; Prettify the article buffer again.
7544 (unless no-highlight
7546 (set-buffer gnus-article-buffer)
7547 (gnus-run-hooks 'gnus-article-display-hook)
7548 (set-buffer gnus-original-article-buffer)
7549 (gnus-request-article
7550 (cdr gnus-article-current)
7551 (car gnus-article-current) (current-buffer))))
7552 ;; Prettify the summary buffer line.
7553 (when (gnus-visual-p 'summary-highlight 'highlight)
7554 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7556 (defun gnus-summary-edit-wash (key)
7557 "Perform editing command KEY in the article buffer."
7561 (message "%s" (concat (this-command-keys) "- "))
7564 (gnus-summary-edit-article)
7565 (execute-kbd-macro (concat (this-command-keys) key))
7566 (gnus-article-edit-done))
7570 (defun gnus-summary-respool-query (&optional silent trace)
7571 "Query where the respool algorithm would put this article."
7573 (let (gnus-mark-article-hook)
7574 (gnus-summary-select-article)
7576 (set-buffer gnus-original-article-buffer)
7578 (message-narrow-to-head)
7579 (let ((groups (nnmail-article-group 'identity trace)))
7582 (message "This message would go to %s"
7583 (mapconcat 'car groups ", "))
7584 (message "This message would go to no groups"))
7587 (defun gnus-summary-respool-trace ()
7588 "Trace where the respool algorithm would put this article.
7589 Display a buffer showing all fancy splitting patterns which matched."
7591 (gnus-summary-respool-query nil t))
7593 ;; Summary marking commands.
7595 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7596 "Mark articles which has the same subject as read, and then select the next.
7597 If UNMARK is positive, remove any kind of mark.
7598 If UNMARK is negative, tick articles."
7601 (setq unmark (prefix-numeric-value unmark)))
7603 (gnus-summary-mark-same-subject
7604 (gnus-summary-article-subject) unmark)))
7605 ;; Select next unread article. If auto-select-same mode, should
7606 ;; select the first unread article.
7607 (gnus-summary-next-article t (and gnus-auto-select-same
7608 (gnus-summary-article-subject)))
7609 (gnus-message 7 "%d article%s marked as %s"
7610 count (if (= count 1) " is" "s are")
7611 (if unmark "unread" "read"))))
7613 (defun gnus-summary-kill-same-subject (&optional unmark)
7614 "Mark articles which has the same subject as read.
7615 If UNMARK is positive, remove any kind of mark.
7616 If UNMARK is negative, tick articles."
7619 (setq unmark (prefix-numeric-value unmark)))
7621 (gnus-summary-mark-same-subject
7622 (gnus-summary-article-subject) unmark)))
7623 ;; If marked as read, go to next unread subject.
7625 ;; Go to next unread subject.
7626 (gnus-summary-next-subject 1 t))
7627 (gnus-message 7 "%d articles are marked as %s"
7628 count (if unmark "unread" "read"))))
7630 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7631 "Mark articles with same SUBJECT as read, and return marked number.
7632 If optional argument UNMARK is positive, remove any kinds of marks.
7633 If optional argument UNMARK is negative, mark articles as unread instead."
7637 ((null unmark) ; Mark as read.
7640 (gnus-summary-mark-article-as-read gnus-killed-mark)
7641 (gnus-summary-show-thread) t)
7642 (gnus-summary-find-subject subject))
7643 (setq count (1+ count))))
7644 ((> unmark 0) ; Tick.
7647 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7648 (gnus-summary-show-thread) t)
7649 (gnus-summary-find-subject subject))
7650 (setq count (1+ count))))
7651 (t ; Mark as unread.
7654 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7655 (gnus-summary-show-thread) t)
7656 (gnus-summary-find-subject subject))
7657 (setq count (1+ count)))))
7658 (gnus-set-mode-line 'summary)
7659 ;; Return the number of marked articles.
7662 (defun gnus-summary-mark-as-processable (n &optional unmark)
7663 "Set the process mark on the next N articles.
7664 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7665 the process mark instead. The difference between N and the actual
7666 number of articles marked is returned."
7668 (let ((backward (< n 0))
7673 (gnus-summary-remove-process-mark
7674 (gnus-summary-article-number))
7675 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7676 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7679 (gnus-message 7 "No more articles"))
7680 (gnus-summary-recenter)
7681 (gnus-summary-position-point)
7684 (defun gnus-summary-unmark-as-processable (n)
7685 "Remove the process mark from the next N articles.
7686 If N is negative, unmark backward instead. The difference between N and
7687 the actual number of articles unmarked is returned."
7689 (gnus-summary-mark-as-processable n t))
7691 (defun gnus-summary-unmark-all-processable ()
7692 "Remove the process mark from all articles."
7695 (while gnus-newsgroup-processable
7696 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7697 (gnus-summary-position-point))
7699 (defun gnus-summary-mark-as-expirable (n)
7700 "Mark N articles forward as expirable.
7701 If N is negative, mark backward instead. The difference between N and
7702 the actual number of articles marked is returned."
7704 (gnus-summary-mark-forward n gnus-expirable-mark))
7706 (defun gnus-summary-mark-article-as-replied (article)
7707 "Mark ARTICLE replied and update the summary line."
7708 (push article gnus-newsgroup-replied)
7709 (let ((buffer-read-only nil))
7710 (when (gnus-summary-goto-subject article nil t)
7711 (gnus-summary-update-secondary-mark article))))
7713 (defun gnus-summary-set-bookmark (article)
7714 "Set a bookmark in current article."
7715 (interactive (list (gnus-summary-article-number)))
7716 (when (or (not (get-buffer gnus-article-buffer))
7717 (not gnus-current-article)
7718 (not gnus-article-current)
7719 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7720 (error "No current article selected"))
7721 ;; Remove old bookmark, if one exists.
7722 (let ((old (assq article gnus-newsgroup-bookmarks)))
7724 (setq gnus-newsgroup-bookmarks
7725 (delq old gnus-newsgroup-bookmarks))))
7726 ;; Set the new bookmark, which is on the form
7727 ;; (article-number . line-number-in-body).
7731 (set-buffer gnus-article-buffer)
7735 (goto-char (point-min))
7736 (search-forward "\n\n" nil t)
7739 gnus-newsgroup-bookmarks)
7740 (gnus-message 6 "A bookmark has been added to the current article."))
7742 (defun gnus-summary-remove-bookmark (article)
7743 "Remove the bookmark from the current article."
7744 (interactive (list (gnus-summary-article-number)))
7745 ;; Remove old bookmark, if one exists.
7746 (let ((old (assq article gnus-newsgroup-bookmarks)))
7749 (setq gnus-newsgroup-bookmarks
7750 (delq old gnus-newsgroup-bookmarks))
7751 (gnus-message 6 "Removed bookmark."))
7752 (gnus-message 6 "No bookmark in current article."))))
7754 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7755 (defun gnus-summary-mark-as-dormant (n)
7756 "Mark N articles forward as dormant.
7757 If N is negative, mark backward instead. The difference between N and
7758 the actual number of articles marked is returned."
7760 (gnus-summary-mark-forward n gnus-dormant-mark))
7762 (defun gnus-summary-set-process-mark (article)
7763 "Set the process mark on ARTICLE and update the summary line."
7764 (setq gnus-newsgroup-processable
7766 (delq article gnus-newsgroup-processable)))
7767 (when (gnus-summary-goto-subject article)
7768 (gnus-summary-show-thread)
7769 (gnus-summary-goto-subject article)
7770 (gnus-summary-update-secondary-mark article)))
7772 (defun gnus-summary-remove-process-mark (article)
7773 "Remove the process mark from ARTICLE and update the summary line."
7774 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7775 (when (gnus-summary-goto-subject article)
7776 (gnus-summary-show-thread)
7777 (gnus-summary-goto-subject article)
7778 (gnus-summary-update-secondary-mark article)))
7780 (defun gnus-summary-set-saved-mark (article)
7781 "Set the process mark on ARTICLE and update the summary line."
7782 (push article gnus-newsgroup-saved)
7783 (when (gnus-summary-goto-subject article)
7784 (gnus-summary-update-secondary-mark article)))
7786 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7787 "Mark N articles as read forwards.
7788 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7789 The difference between N and the actual number of articles marked is
7792 (gnus-summary-show-thread)
7793 (let ((backward (< n 0))
7794 (gnus-summary-goto-unread
7795 (and gnus-summary-goto-unread
7796 (not (eq gnus-summary-goto-unread 'never))
7797 (not (memq mark (list gnus-unread-mark
7798 gnus-ticked-mark gnus-dormant-mark)))))
7800 (mark (or mark gnus-del-mark)))
7802 (gnus-summary-mark-article nil mark no-expire)
7803 (zerop (gnus-summary-next-subject
7805 (and gnus-summary-goto-unread
7806 (not (eq gnus-summary-goto-unread 'never)))
7810 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7811 (gnus-summary-recenter)
7812 (gnus-summary-position-point)
7813 (gnus-set-mode-line 'summary)
7816 (defun gnus-summary-mark-article-as-read (mark)
7817 "Mark the current article quickly as read with MARK."
7818 (let ((article (gnus-summary-article-number)))
7819 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7820 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7821 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7822 (push (cons article mark) gnus-newsgroup-reads)
7823 ;; Possibly remove from cache, if that is used.
7824 (when gnus-use-cache
7825 (gnus-cache-enter-remove-article article))
7826 ;; Allow the backend to change the mark.
7827 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7828 ;; Check for auto-expiry.
7829 (when (and gnus-newsgroup-auto-expire
7830 (memq mark gnus-auto-expirable-marks))
7831 (setq mark gnus-expirable-mark)
7832 ;; Let the backend know about the mark change.
7833 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7834 (push article gnus-newsgroup-expirable))
7835 ;; Set the mark in the buffer.
7836 (gnus-summary-update-mark mark 'unread)
7839 (defun gnus-summary-mark-article-as-unread (mark)
7840 "Mark the current article quickly as unread with MARK."
7841 (let* ((article (gnus-summary-article-number))
7842 (old-mark (gnus-summary-article-mark article)))
7843 ;; Allow the backend to change the mark.
7844 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7845 (if (eq mark old-mark)
7849 (gnus-error 1 "Can't mark negative article numbers")
7851 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7852 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7853 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7854 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7855 (cond ((= mark gnus-ticked-mark)
7856 (push article gnus-newsgroup-marked))
7857 ((= mark gnus-dormant-mark)
7858 (push article gnus-newsgroup-dormant))
7860 (push article gnus-newsgroup-unreads)))
7861 (gnus-pull article gnus-newsgroup-reads)
7863 ;; See whether the article is to be put in the cache.
7865 (vectorp (gnus-summary-article-header article))
7867 (gnus-cache-possibly-enter-article
7868 gnus-newsgroup-name article
7869 (gnus-summary-article-header article)
7870 (= mark gnus-ticked-mark)
7871 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7874 (gnus-summary-update-mark mark 'unread)
7877 (defun gnus-summary-mark-article (&optional article mark no-expire)
7878 "Mark ARTICLE with MARK. MARK can be any character.
7879 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7880 `??' (dormant) and `?E' (expirable).
7881 If MARK is nil, then the default character `?r' is used.
7882 If ARTICLE is nil, then the article on the current line will be
7884 ;; The mark might be a string.
7885 (when (stringp mark)
7886 (setq mark (aref mark 0)))
7887 ;; If no mark is given, then we check auto-expiring.
7889 (setq mark gnus-del-mark))
7890 (when (and (not no-expire)
7891 gnus-newsgroup-auto-expire
7892 (memq mark gnus-auto-expirable-marks))
7893 (setq mark gnus-expirable-mark))
7894 (let ((article (or article (gnus-summary-article-number)))
7895 (old-mark (gnus-summary-article-mark article)))
7896 ;; Allow the backend to change the mark.
7897 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7898 (if (eq mark old-mark)
7901 (error "No article on current line"))
7902 (if (not (if (or (= mark gnus-unread-mark)
7903 (= mark gnus-ticked-mark)
7904 (= mark gnus-dormant-mark))
7905 (gnus-mark-article-as-unread article mark)
7906 (gnus-mark-article-as-read article mark)))
7908 ;; See whether the article is to be put in the cache.
7910 (not (= mark gnus-canceled-mark))
7911 (vectorp (gnus-summary-article-header article))
7913 (gnus-cache-possibly-enter-article
7914 gnus-newsgroup-name article
7915 (gnus-summary-article-header article)
7916 (= mark gnus-ticked-mark)
7917 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7919 (when (gnus-summary-goto-subject article nil t)
7920 (let ((buffer-read-only nil))
7921 (gnus-summary-show-thread)
7923 (gnus-summary-update-mark mark 'unread)
7926 (defun gnus-summary-update-secondary-mark (article)
7927 "Update the secondary (read, process, cache) mark."
7928 (gnus-summary-update-mark
7929 (cond ((memq article gnus-newsgroup-processable)
7931 ((memq article gnus-newsgroup-cached)
7933 ((memq article gnus-newsgroup-replied)
7935 ((memq article gnus-newsgroup-saved)
7937 (t gnus-unread-mark))
7939 (when (gnus-visual-p 'summary-highlight 'highlight)
7940 (gnus-run-hooks 'gnus-summary-update-hook))
7943 (defun gnus-summary-update-mark (mark type)
7944 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7945 (buffer-read-only nil))
7946 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7948 (when (looking-at "\r")
7950 (when (<= (+ forward (point)) (point-max))
7951 ;; Go to the right position on the line.
7952 (goto-char (+ forward (point)))
7953 ;; Replace the old mark with the new mark.
7954 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7955 ;; Optionally update the marks by some user rule.
7956 (when (eq type 'unread)
7958 (gnus-data-find (gnus-summary-article-number)) mark)
7959 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7961 (defun gnus-mark-article-as-read (article &optional mark)
7962 "Enter ARTICLE in the pertinent lists and remove it from others."
7963 ;; Make the article expirable.
7964 (let ((mark (or mark gnus-del-mark)))
7965 (if (= mark gnus-expirable-mark)
7966 (push article gnus-newsgroup-expirable)
7967 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7968 ;; Remove from unread and marked lists.
7969 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7970 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7971 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7972 (push (cons article mark) gnus-newsgroup-reads)
7973 ;; Possibly remove from cache, if that is used.
7974 (when gnus-use-cache
7975 (gnus-cache-enter-remove-article article))
7978 (defun gnus-mark-article-as-unread (article &optional mark)
7979 "Enter ARTICLE in the pertinent lists and remove it from others."
7980 (let ((mark (or mark gnus-ticked-mark)))
7983 (gnus-error 1 "Can't mark negative article numbers")
7985 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7986 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7987 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7988 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7990 ;; Unsuppress duplicates?
7991 (when gnus-suppress-duplicates
7992 (gnus-dup-unsuppress-article article))
7994 (cond ((= mark gnus-ticked-mark)
7995 (push article gnus-newsgroup-marked))
7996 ((= mark gnus-dormant-mark)
7997 (push article gnus-newsgroup-dormant))
7999 (push article gnus-newsgroup-unreads)))
8000 (gnus-pull article gnus-newsgroup-reads)
8003 (defalias 'gnus-summary-mark-as-unread-forward
8004 'gnus-summary-tick-article-forward)
8005 (make-obsolete 'gnus-summary-mark-as-unread-forward
8006 'gnus-summary-tick-article-forward)
8007 (defun gnus-summary-tick-article-forward (n)
8008 "Tick N articles forwards.
8009 If N is negative, tick backwards instead.
8010 The difference between N and the number of articles ticked is returned."
8012 (gnus-summary-mark-forward n gnus-ticked-mark))
8014 (defalias 'gnus-summary-mark-as-unread-backward
8015 'gnus-summary-tick-article-backward)
8016 (make-obsolete 'gnus-summary-mark-as-unread-backward
8017 'gnus-summary-tick-article-backward)
8018 (defun gnus-summary-tick-article-backward (n)
8019 "Tick N articles backwards.
8020 The difference between N and the number of articles ticked is returned."
8022 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8024 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8025 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8026 (defun gnus-summary-tick-article (&optional article clear-mark)
8027 "Mark current article as unread.
8028 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8029 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8031 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8034 (defun gnus-summary-mark-as-read-forward (n)
8035 "Mark N articles as read forwards.
8036 If N is negative, mark backwards instead.
8037 The difference between N and the actual number of articles marked is
8040 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8042 (defun gnus-summary-mark-as-read-backward (n)
8043 "Mark the N articles as read backwards.
8044 The difference between N and the actual number of articles marked is
8047 (gnus-summary-mark-forward (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8049 (defun gnus-summary-mark-as-read (&optional article mark)
8050 "Mark current article as read.
8051 ARTICLE specifies the article to be marked as read.
8052 MARK specifies a string to be inserted at the beginning of the line."
8053 (gnus-summary-mark-article article mark))
8055 (defun gnus-summary-clear-mark-forward (n)
8056 "Clear marks from N articles forward.
8057 If N is negative, clear backward instead.
8058 The difference between N and the number of marks cleared is returned."
8060 (gnus-summary-mark-forward n gnus-unread-mark))
8062 (defun gnus-summary-clear-mark-backward (n)
8063 "Clear marks from N articles backward.
8064 The difference between N and the number of marks cleared is returned."
8066 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8068 (defun gnus-summary-mark-unread-as-read ()
8069 "Intended to be used by `gnus-summary-mark-article-hook'."
8070 (when (memq gnus-current-article gnus-newsgroup-unreads)
8071 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8073 (defun gnus-summary-mark-read-and-unread-as-read ()
8074 "Intended to be used by `gnus-summary-mark-article-hook'."
8075 (let ((mark (gnus-summary-article-mark)))
8076 (when (or (gnus-unread-mark-p mark)
8077 (gnus-read-mark-p mark))
8078 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8080 (defun gnus-summary-mark-region-as-read (point mark all)
8081 "Mark all unread articles between point and mark as read.
8082 If given a prefix, mark all articles between point and mark as read,
8083 even ticked and dormant ones."
8084 (interactive "r\nP")
8093 (memq (setq article (gnus-summary-article-number))
8094 gnus-newsgroup-unreads))
8095 (gnus-summary-mark-article article gnus-del-mark))
8097 (gnus-summary-find-next))))))
8099 (defun gnus-summary-mark-below (score mark)
8100 "Mark articles with score less than SCORE with MARK."
8101 (interactive "P\ncMark: ")
8102 (setq score (if score
8103 (prefix-numeric-value score)
8104 (or gnus-summary-default-score 0)))
8106 (set-buffer gnus-summary-buffer)
8107 (goto-char (point-min))
8110 (and (< (gnus-summary-article-score) score)
8111 (gnus-summary-mark-article nil mark))
8112 (gnus-summary-find-next)))))
8114 (defun gnus-summary-kill-below (&optional score)
8115 "Mark articles with score below SCORE as read."
8117 (gnus-summary-mark-below score gnus-killed-mark))
8119 (defun gnus-summary-clear-above (&optional score)
8120 "Clear all marks from articles with score above SCORE."
8122 (gnus-summary-mark-above score gnus-unread-mark))
8124 (defun gnus-summary-tick-above (&optional score)
8125 "Tick all articles with score above SCORE."
8127 (gnus-summary-mark-above score gnus-ticked-mark))
8129 (defun gnus-summary-mark-above (score mark)
8130 "Mark articles with score over SCORE with MARK."
8131 (interactive "P\ncMark: ")
8132 (setq score (if score
8133 (prefix-numeric-value score)
8134 (or gnus-summary-default-score 0)))
8136 (set-buffer gnus-summary-buffer)
8137 (goto-char (point-min))
8139 (when (> (gnus-summary-article-score) score)
8140 (gnus-summary-mark-article nil mark))
8142 (gnus-summary-find-next)))))
8144 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8145 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8146 (defun gnus-summary-limit-include-expunged (&optional no-error)
8147 "Display all the hidden articles that were expunged for low scores."
8149 (let ((buffer-read-only nil))
8150 (let ((scored gnus-newsgroup-scored)
8153 (unless (gnus-summary-goto-subject (caar scored))
8154 (and (setq h (gnus-summary-article-header (caar scored)))
8155 (< (cdar scored) gnus-summary-expunge-below)
8157 (setq scored (cdr scored)))
8159 (when (not no-error)
8160 (error "No expunged articles hidden"))
8161 (goto-char (point-min))
8162 (gnus-summary-prepare-unthreaded (nreverse headers))
8163 (goto-char (point-min))
8164 (gnus-summary-position-point)
8167 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8168 "Mark all unread articles in this newsgroup as read.
8169 If prefix argument ALL is non-nil, ticked and dormant articles will
8170 also be marked as read.
8171 If QUIETLY is non-nil, no questions will be asked.
8172 If TO-HERE is non-nil, it should be a point in the buffer. All
8173 articles before this point will be marked as read.
8174 Note that this function will only catch up the unread article
8175 in the current summary buffer limitation.
8176 The number of articles marked as read is returned."
8181 (not gnus-interactive-catchup) ;Without confirmation?
8185 "Mark absolutely all articles as read? "
8186 "Mark all unread articles as read? ")))
8188 (not gnus-newsgroup-adaptive)
8189 (not gnus-newsgroup-auto-expire)
8190 (not gnus-suppress-duplicates)
8191 (or (not gnus-use-cache)
8192 (eq gnus-use-cache 'passive)))
8195 (setq gnus-newsgroup-marked nil
8196 gnus-newsgroup-dormant nil))
8197 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8198 ;; We actually mark all articles as canceled, which we
8199 ;; have to do when using auto-expiry or adaptive scoring.
8200 (gnus-summary-show-all-threads)
8201 (when (gnus-summary-first-subject (not all) t)
8203 (if to-here (< (point) to-here) t)
8204 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8205 (gnus-summary-find-next (not all) nil nil t))))
8206 (gnus-set-mode-line 'summary))
8208 (gnus-summary-position-point)))
8210 (defun gnus-summary-catchup-to-here (&optional all)
8211 "Mark all unticked articles before the current one as read.
8212 If ALL is non-nil, also mark ticked and dormant articles as read."
8215 (gnus-save-hidden-threads
8216 (let ((beg (point)))
8217 ;; We check that there are unread articles.
8218 (when (or all (gnus-summary-find-prev))
8219 (gnus-summary-catchup all t beg)))))
8220 (gnus-summary-position-point))
8222 (defun gnus-summary-catchup-all (&optional quietly)
8223 "Mark all articles in this newsgroup as read."
8225 (gnus-summary-catchup t quietly))
8227 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8228 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8229 If prefix argument ALL is non-nil, all articles are marked as read."
8231 (when (gnus-summary-catchup all quietly nil 'fast)
8232 ;; Select next newsgroup or exit.
8233 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8234 (eq gnus-auto-select-next 'quietly))
8235 (gnus-summary-next-group nil)
8236 (gnus-summary-exit))))
8238 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8239 "Mark all articles in this newsgroup as read, and then exit."
8241 (gnus-summary-catchup-and-exit t quietly))
8243 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8244 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8245 "Mark all articles in this group as read and select the next group.
8246 If given a prefix, mark all articles, unread as well as ticked, as
8250 (gnus-summary-catchup all))
8251 (gnus-summary-next-article t nil nil t))
8253 ;; Thread-based commands.
8255 (defun gnus-summary-articles-in-thread (&optional article)
8256 "Return a list of all articles in the current thread.
8257 If ARTICLE is non-nil, return all articles in the thread that starts
8259 (let* ((article (or article (gnus-summary-article-number)))
8260 (data (gnus-data-find-list article))
8261 (top-level (gnus-data-level (car data)))
8263 (cond ((null gnus-thread-operation-ignore-subject)
8264 (gnus-simplify-subject-re
8265 (mail-header-subject (gnus-data-header (car data)))))
8266 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8267 (gnus-simplify-subject-fuzzy
8268 (mail-header-subject (gnus-data-header (car data)))))
8270 (end-point (save-excursion
8271 (if (gnus-summary-go-to-next-thread)
8272 (point) (point-max))))
8275 (< (gnus-data-pos (car data)) end-point))
8276 (when (or (not top-subject)
8277 (string= top-subject
8278 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8279 (gnus-simplify-subject-fuzzy
8280 (mail-header-subject
8281 (gnus-data-header (car data))))
8282 (gnus-simplify-subject-re
8283 (mail-header-subject
8284 (gnus-data-header (car data)))))))
8285 (push (gnus-data-number (car data)) articles))
8286 (unless (and (setq data (cdr data))
8287 (> (gnus-data-level (car data)) top-level))
8289 ;; Return the list of articles.
8290 (nreverse articles)))
8292 (defun gnus-summary-rethread-current ()
8293 "Rethread the thread the current article is part of."
8295 (let* ((gnus-show-threads t)
8296 (article (gnus-summary-article-number))
8297 (id (mail-header-id (gnus-summary-article-header)))
8298 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8300 (error "No article on the current line"))
8301 (gnus-rebuild-thread id)
8302 (gnus-summary-goto-subject article)))
8304 (defun gnus-summary-reparent-thread ()
8305 "Make the current article child of the marked (or previous) article.
8307 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8308 is non-nil or the Subject: of both articles are the same."
8310 (unless (not (gnus-group-read-only-p))
8311 (error "The current newsgroup does not support article editing"))
8312 (unless (<= (length gnus-newsgroup-processable) 1)
8313 (error "No more than one article may be marked"))
8314 (save-window-excursion
8315 (let ((gnus-article-buffer " *reparent*")
8316 (current-article (gnus-summary-article-number))
8317 ;; First grab the marked article, otherwise one line up.
8318 (parent-article (if (not (null gnus-newsgroup-processable))
8319 (car gnus-newsgroup-processable)
8321 (if (eq (forward-line -1) 0)
8322 (gnus-summary-article-number)
8323 (error "Beginning of summary buffer"))))))
8324 (unless (not (eq current-article parent-article))
8325 (error "An article may not be self-referential"))
8326 (let ((message-id (mail-header-id
8327 (gnus-summary-article-header parent-article))))
8328 (unless (and message-id (not (equal message-id "")))
8329 (error "No message-id in desired parent"))
8330 (gnus-with-article current-article
8331 (goto-char (point-min))
8332 (if (re-search-forward "^References: " nil t)
8334 (re-search-forward "^[^ \t]" nil t)
8337 (insert " " message-id))
8338 (insert "References: " message-id "\n")))
8339 (set-buffer gnus-summary-buffer)
8340 (gnus-summary-unmark-all-processable)
8341 (gnus-summary-update-article current-article)
8342 (gnus-summary-rethread-current)
8343 (gnus-message 3 "Article %d is now the child of article %d"
8344 current-article parent-article)))))
8346 (defun gnus-summary-toggle-threads (&optional arg)
8347 "Toggle showing conversation threads.
8348 If ARG is positive number, turn showing conversation threads on."
8350 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8351 (setq gnus-show-threads
8352 (if (null arg) (not gnus-show-threads)
8353 (> (prefix-numeric-value arg) 0)))
8354 (gnus-summary-prepare)
8355 (gnus-summary-goto-subject current)
8356 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8357 (gnus-summary-position-point)))
8359 (defun gnus-summary-show-all-threads ()
8363 (let ((buffer-read-only nil))
8364 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8365 (gnus-summary-position-point))
8367 (defun gnus-summary-show-thread ()
8368 "Show thread subtrees.
8369 Returns nil if no thread was there to be shown."
8371 (let ((buffer-read-only nil)
8373 ;; first goto end then to beg, to have point at beg after let
8374 (end (progn (end-of-line) (point)))
8375 (beg (progn (beginning-of-line) (point))))
8377 ;; Any hidden lines here?
8378 (search-forward "\r" end t)
8379 (subst-char-in-region beg end ?\^M ?\n t)
8381 (gnus-summary-position-point))))
8383 (defun gnus-summary-hide-all-threads ()
8384 "Hide all thread subtrees."
8387 (goto-char (point-min))
8388 (gnus-summary-hide-thread)
8389 (while (zerop (gnus-summary-next-thread 1 t))
8390 (gnus-summary-hide-thread)))
8391 (gnus-summary-position-point))
8393 (defun gnus-summary-hide-thread ()
8394 "Hide thread subtrees.
8395 Returns nil if no threads were there to be hidden."
8397 (let ((buffer-read-only nil)
8399 (article (gnus-summary-article-number)))
8401 ;; Go forward until either the buffer ends or the subthread
8403 (when (and (not (eobp))
8404 (or (zerop (gnus-summary-next-thread 1 t))
8405 (goto-char (point-max))))
8407 (if (and (> (point) start)
8408 (search-backward "\n" start t))
8410 (subst-char-in-region start (point) ?\n ?\^M)
8411 (gnus-summary-goto-subject article))
8414 ;;(gnus-summary-position-point)
8417 (defun gnus-summary-go-to-next-thread (&optional previous)
8418 "Go to the same level (or less) next thread.
8419 If PREVIOUS is non-nil, go to previous thread instead.
8420 Return the article number moved to, or nil if moving was impossible."
8421 (let ((level (gnus-summary-thread-level))
8422 (way (if previous -1 1))
8425 (while (and (not (eobp))
8426 (< level (gnus-summary-thread-level)))
8434 (gnus-summary-article-number)
8437 (defun gnus-summary-next-thread (n &optional silent)
8438 "Go to the same level next N'th thread.
8439 If N is negative, search backward instead.
8440 Returns the difference between N and the number of skips actually
8443 If SILENT, don't output messages."
8445 (let ((backward (< n 0))
8448 (gnus-summary-go-to-next-thread backward))
8451 (gnus-summary-position-point))
8452 (when (and (not silent) (/= 0 n))
8453 (gnus-message 7 "No more threads"))
8456 (defun gnus-summary-prev-thread (n)
8457 "Go to the same level previous N'th thread.
8458 Returns the difference between N and the number of skips actually
8461 (gnus-summary-next-thread (- n)))
8463 (defun gnus-summary-go-down-thread ()
8464 "Go down one level in the current thread."
8465 (let ((children (gnus-summary-article-children)))
8467 (gnus-summary-goto-subject (car children)))))
8469 (defun gnus-summary-go-up-thread ()
8470 "Go up one level in the current thread."
8471 (let ((parent (gnus-summary-article-parent)))
8473 (gnus-summary-goto-subject parent))))
8475 (defun gnus-summary-down-thread (n)
8476 "Go down thread N steps.
8477 If N is negative, go up instead.
8478 Returns the difference between N and how many steps down that were
8484 (if up (gnus-summary-go-up-thread)
8485 (gnus-summary-go-down-thread)))
8487 (gnus-summary-position-point)
8489 (gnus-message 7 "Can't go further"))
8492 (defun gnus-summary-up-thread (n)
8493 "Go up thread N steps.
8494 If N is negative, go up instead.
8495 Returns the difference between N and how many steps down that were
8498 (gnus-summary-down-thread (- n)))
8500 (defun gnus-summary-top-thread ()
8501 "Go to the top of the thread."
8503 (while (gnus-summary-go-up-thread))
8504 (gnus-summary-article-number))
8506 (defun gnus-summary-kill-thread (&optional unmark)
8507 "Mark articles under current thread as read.
8508 If the prefix argument is positive, remove any kinds of marks.
8509 If the prefix argument is negative, tick articles instead."
8512 (setq unmark (prefix-numeric-value unmark)))
8513 (let ((articles (gnus-summary-articles-in-thread)))
8515 ;; Expand the thread.
8516 (gnus-summary-show-thread)
8517 ;; Mark all the articles.
8519 (gnus-summary-goto-subject (car articles))
8520 (cond ((null unmark)
8521 (gnus-summary-mark-article-as-read gnus-killed-mark))
8523 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8525 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8526 (setq articles (cdr articles))))
8527 ;; Hide killed subtrees.
8529 gnus-thread-hide-killed
8530 (gnus-summary-hide-thread))
8531 ;; If marked as read, go to next unread subject.
8533 ;; Go to next unread subject.
8534 (gnus-summary-next-subject 1 t)))
8535 (gnus-set-mode-line 'summary))
8537 ;; Summary sorting commands
8539 (defun gnus-summary-sort-by-number (&optional reverse)
8540 "Sort the summary buffer by article number.
8541 Argument REVERSE means reverse order."
8543 (gnus-summary-sort 'number reverse))
8545 (defun gnus-summary-sort-by-author (&optional reverse)
8546 "Sort the summary buffer by author name alphabetically.
8547 If case-fold-search is non-nil, case of letters is ignored.
8548 Argument REVERSE means reverse order."
8550 (gnus-summary-sort 'author reverse))
8552 (defun gnus-summary-sort-by-subject (&optional reverse)
8553 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8554 If case-fold-search is non-nil, case of letters is ignored.
8555 Argument REVERSE means reverse order."
8557 (gnus-summary-sort 'subject reverse))
8559 (defun gnus-summary-sort-by-date (&optional reverse)
8560 "Sort the summary buffer by date.
8561 Argument REVERSE means reverse order."
8563 (gnus-summary-sort 'date reverse))
8565 (defun gnus-summary-sort-by-score (&optional reverse)
8566 "Sort the summary buffer by score.
8567 Argument REVERSE means reverse order."
8569 (gnus-summary-sort 'score reverse))
8571 (defun gnus-summary-sort-by-lines (&optional reverse)
8572 "Sort the summary buffer by article length.
8573 Argument REVERSE means reverse order."
8575 (gnus-summary-sort 'lines reverse))
8577 (defun gnus-summary-sort (predicate reverse)
8578 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8579 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8580 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8581 (gnus-thread-sort-functions
8586 (gnus-article-sort-functions
8592 (gnus-summary-prepare-hook nil))
8593 ;; We do the sorting by regenerating the threads.
8594 (gnus-summary-prepare)
8595 ;; Hide subthreads if needed.
8596 (when (and gnus-show-threads gnus-thread-hide-subtree)
8597 (gnus-summary-hide-all-threads))))
8599 ;; Summary saving commands.
8601 (defun gnus-summary-save-article (&optional n not-saved)
8602 "Save the current article using the default saver function.
8603 If N is a positive number, save the N next articles.
8604 If N is a negative number, save the N previous articles.
8605 If N is nil and any articles have been marked with the process mark,
8606 save those articles instead.
8607 The variable `gnus-default-article-saver' specifies the saver function."
8609 (let* ((articles (gnus-summary-work-articles n))
8610 (save-buffer (save-excursion
8611 (nnheader-set-temp-buffer " *Gnus Save*")))
8612 (num (length articles))
8613 header article file)
8615 (setq header (gnus-summary-article-header
8616 (setq article (pop articles))))
8617 (if (not (vectorp header))
8618 ;; This is a pseudo-article.
8619 (if (assq 'name header)
8620 (gnus-copy-file (cdr (assq 'name header)))
8621 (gnus-message 1 "Article %d is unsaveable" article))
8622 ;; This is a real article.
8623 (save-window-excursion
8624 (gnus-summary-select-article t nil nil article))
8626 (set-buffer save-buffer)
8628 (insert-buffer-substring gnus-original-article-buffer))
8629 (setq file (gnus-article-save save-buffer file num))
8630 (gnus-summary-remove-process-mark article)
8632 (gnus-summary-set-saved-mark article))))
8633 (gnus-kill-buffer save-buffer)
8634 (gnus-summary-position-point)
8635 (gnus-set-mode-line 'summary)
8638 (defun gnus-summary-pipe-output (&optional arg)
8639 "Pipe the current article to a subprocess.
8640 If N is a positive number, pipe the N next articles.
8641 If N is a negative number, pipe the N previous articles.
8642 If N is nil and any articles have been marked with the process mark,
8643 pipe those articles instead."
8645 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8646 (gnus-summary-save-article arg t))
8647 (gnus-configure-windows 'pipe))
8649 (defun gnus-summary-save-article-mail (&optional arg)
8650 "Append the current article to an mail file.
8651 If N is a positive number, save the N next articles.
8652 If N is a negative number, save the N previous articles.
8653 If N is nil and any articles have been marked with the process mark,
8654 save those articles instead."
8656 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8657 (gnus-summary-save-article arg)))
8659 (defun gnus-summary-save-article-rmail (&optional arg)
8660 "Append the current article to an rmail file.
8661 If N is a positive number, save the N next articles.
8662 If N is a negative number, save the N previous articles.
8663 If N is nil and any articles have been marked with the process mark,
8664 save those articles instead."
8666 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8667 (gnus-summary-save-article arg)))
8669 (defun gnus-summary-save-article-file (&optional arg)
8670 "Append the current article to a file.
8671 If N is a positive number, save the N next articles.
8672 If N is a negative number, save the N previous articles.
8673 If N is nil and any articles have been marked with the process mark,
8674 save those articles instead."
8676 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8677 (gnus-summary-save-article arg)))
8679 (defun gnus-summary-write-article-file (&optional arg)
8680 "Write the current article to a file, deleting the previous file.
8681 If N is a positive number, save the N next articles.
8682 If N is a negative number, save the N previous articles.
8683 If N is nil and any articles have been marked with the process mark,
8684 save those articles instead."
8686 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8687 (gnus-summary-save-article arg)))
8689 (defun gnus-summary-save-article-body-file (&optional arg)
8690 "Append the current article body to a file.
8691 If N is a positive number, save the N next articles.
8692 If N is a negative number, save the N previous articles.
8693 If N is nil and any articles have been marked with the process mark,
8694 save those articles instead."
8696 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8697 (gnus-summary-save-article arg)))
8699 (defun gnus-summary-pipe-message (program)
8700 "Pipe the current article through PROGRAM."
8701 (interactive "sProgram: ")
8702 (gnus-summary-select-article)
8703 (let ((mail-header-separator ""))
8704 (gnus-eval-in-buffer-window gnus-article-buffer
8707 (let ((start (window-start))
8709 (message-pipe-buffer-body program)
8710 (set-window-start (get-buffer-window (current-buffer)) start))))))
8712 (defun gnus-get-split-value (methods)
8713 "Return a value based on the split METHODS."
8714 (let (split-name method result match)
8717 (set-buffer gnus-original-article-buffer)
8719 (nnheader-narrow-to-headers)
8721 (goto-char (point-min))
8722 (setq method (pop methods))
8723 (setq match (car method))
8726 ;; Regular expression.
8728 (re-search-forward match nil t)))
8729 ((gnus-functionp match)
8733 (setq result (funcall match gnus-newsgroup-name))))
8738 (setq result (eval match)))))
8739 (setq split-name (append (cdr method) split-name))
8740 (cond ((stringp result)
8741 (push (expand-file-name
8742 result gnus-article-save-directory)
8745 (setq split-name (append result split-name)))))))))
8748 (defun gnus-valid-move-group-p (group)
8751 (symbol-value group)
8754 (car (gnus-find-method-for-group
8755 (symbol-name group))))
8756 gnus-valid-select-methods))))
8758 (defun gnus-read-move-group-name (prompt default articles prefix)
8759 "Read a group name."
8760 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8761 (minibuffer-confirm-incomplete nil) ; XEmacs
8765 (if (> (length articles) 1)
8766 (format "these %d articles" (length articles))
8771 (gnus-completing-read default prom
8773 'gnus-valid-move-group-p
8775 'gnus-group-history))
8776 ((= 1 (length split-name))
8777 (gnus-completing-read (car split-name) prom
8779 'gnus-valid-move-group-p
8781 'gnus-group-history))
8783 (gnus-completing-read nil prom
8784 (mapcar (lambda (el) (list el))
8785 (nreverse split-name))
8787 'gnus-group-history)))))
8789 (if (or (string= to-newsgroup "")
8790 (string= to-newsgroup prefix))
8791 (setq to-newsgroup default))
8792 (unless to-newsgroup
8793 (error "No group name entered"))
8794 (or (gnus-active to-newsgroup)
8795 (gnus-activate-group to-newsgroup)
8796 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8798 (or (and (gnus-request-create-group
8799 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8800 (gnus-activate-group to-newsgroup nil nil
8801 (gnus-group-name-to-method
8803 (error "Couldn't create group %s" to-newsgroup)))
8804 (error "No such group: %s" to-newsgroup)))
8807 ;; Summary extract commands
8809 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8810 (let ((buffer-read-only nil)
8811 (article (gnus-summary-article-number))
8813 (unless (gnus-summary-goto-subject article)
8814 (error "No such article: %d" article))
8815 (gnus-summary-position-point)
8816 ;; If all commands are to be bunched up on one line, we collect
8818 (unless gnus-view-pseudos-separately
8819 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8822 (setq action (cdr (assq 'action (car ps))))
8823 (setq files (list (cdr (assq 'name (car ps)))))
8824 (while (and ps (cdr ps)
8825 (string= (or action "1")
8826 (or (cdr (assq 'action (cadr ps))) "2")))
8827 (push (cdr (assq 'name (cadr ps))) files)
8828 (setcdr ps (cddr ps)))
8830 (when (not (string-match "%s" action))
8833 (when (assq 'execute (car ps))
8834 (setcdr (assq 'execute (car ps))
8835 (funcall (if (string-match "%s" action)
8842 (gnus-quote-arg-for-sh-or-csh f)))
8844 (setq ps (cdr ps)))))
8845 (if (and gnus-view-pseudos (not not-view))
8847 (when (assq 'execute (car pslist))
8848 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8849 (eq gnus-view-pseudos 'not-confirm)))
8850 (setq pslist (cdr pslist)))
8853 (setq after-article (or (cdr (assq 'article (car pslist)))
8854 (gnus-summary-article-number)))
8855 (gnus-summary-goto-subject after-article)
8858 (insert " " (file-name-nondirectory
8859 (cdr (assq 'name (car pslist))))
8860 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8862 (forward-line -1) ; back to `b'
8863 (gnus-add-text-properties
8864 b (1- e) (list 'gnus-number gnus-reffed-article-number
8865 gnus-mouse-face-prop gnus-mouse-face))
8867 after-article gnus-reffed-article-number
8868 gnus-unread-mark b (car pslist) 0 (- e b))
8869 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8870 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8871 (setq pslist (cdr pslist)))))))
8873 (defun gnus-pseudos< (p1 p2)
8874 (let ((c1 (cdr (assq 'action p1)))
8875 (c2 (cdr (assq 'action p2))))
8876 (and c1 c2 (string< c1 c2))))
8878 (defun gnus-request-pseudo-article (props)
8879 (cond ((assq 'execute props)
8880 (gnus-execute-command (cdr (assq 'execute props)))))
8881 (let ((gnus-current-article (gnus-summary-article-number)))
8882 (gnus-run-hooks 'gnus-mark-article-hook)))
8884 (defun gnus-execute-command (command &optional automatic)
8886 (gnus-article-setup-buffer)
8887 (set-buffer gnus-article-buffer)
8888 (setq buffer-read-only nil)
8889 (let ((command (if automatic command
8890 (read-string "Command: " (cons command 0)))))
8892 (insert "$ " command "\n\n")
8893 (if gnus-view-pseudo-asynchronously
8894 (start-process "gnus-execute" (current-buffer) shell-file-name
8895 shell-command-switch command)
8896 (call-process shell-file-name nil t nil
8897 shell-command-switch command)))))
8899 ;; Summary kill commands.
8901 (defun gnus-summary-edit-global-kill (article)
8902 "Edit the \"global\" kill file."
8903 (interactive (list (gnus-summary-article-number)))
8904 (gnus-group-edit-global-kill article))
8906 (defun gnus-summary-edit-local-kill ()
8907 "Edit a local kill file applied to the current newsgroup."
8909 (setq gnus-current-headers (gnus-summary-article-header))
8910 (gnus-group-edit-local-kill
8911 (gnus-summary-article-number) gnus-newsgroup-name))
8915 (defun gnus-read-header (id &optional header)
8916 "Read the headers of article ID and enter them into the Gnus system."
8917 (let ((group gnus-newsgroup-name)
8918 (gnus-override-method
8919 (and (gnus-news-group-p gnus-newsgroup-name)
8920 gnus-refer-article-method))
8922 ;; First we check to see whether the header in question is already
8925 ;; This is a Message-ID.
8926 (setq header (or header (gnus-id-to-header id)))
8927 ;; This is an article number.
8928 (setq header (or header (gnus-summary-article-header id))))
8930 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8931 ;; We have found the header.
8933 ;; If this is a sparse article, we have to nix out its
8934 ;; previous entry in the thread hashtb.
8936 (gnus-summary-article-sparse-p (mail-header-number header)))
8937 (let* ((parent (gnus-parent-id (mail-header-references header)))
8938 (thread (and parent (gnus-id-to-thread parent))))
8940 (delq (assq header thread) thread))))
8941 ;; We have to really fetch the header to this article.
8943 (set-buffer nntp-server-buffer)
8944 (when (setq where (gnus-request-head id group))
8945 (nnheader-fold-continuation-lines)
8946 (goto-char (point-max))
8948 (goto-char (point-min))
8952 ((cdr where) (cdr where))
8953 (header (mail-header-number header))
8954 (t gnus-reffed-article-number))
8956 (insert " Article retrieved.\n"))
8958 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8959 () ; Malformed head.
8960 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8961 (when (and (stringp id)
8962 (not (string= (gnus-group-real-name group)
8964 ;; If we fetched by Message-ID and the article came
8965 ;; from a different group, we fudge some bogus article
8966 ;; numbers for this article.
8967 (mail-header-set-number header gnus-reffed-article-number))
8969 (set-buffer gnus-summary-buffer)
8970 (decf gnus-reffed-article-number)
8971 (gnus-remove-header (mail-header-number header))
8972 (push header gnus-newsgroup-headers)
8973 (setq gnus-current-headers header)
8974 (push (mail-header-number header) gnus-newsgroup-limit)))
8977 (defun gnus-remove-header (number)
8978 "Remove header NUMBER from `gnus-newsgroup-headers'."
8979 (if (and gnus-newsgroup-headers
8980 (= number (mail-header-number (car gnus-newsgroup-headers))))
8981 (pop gnus-newsgroup-headers)
8982 (let ((headers gnus-newsgroup-headers))
8983 (while (and (cdr headers)
8984 (not (= number (mail-header-number (cadr headers)))))
8987 (setcdr headers (cddr headers))))))
8990 ;;; summary highlights
8993 (defun gnus-highlight-selected-summary ()
8994 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8995 ;; Highlight selected article in summary buffer
8996 (when gnus-summary-selected-face
8998 (let* ((beg (progn (beginning-of-line) (point)))
8999 (end (progn (end-of-line) (point)))
9000 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9001 (from (if (get-text-property beg gnus-mouse-face-prop)
9003 (or (next-single-property-change
9004 beg gnus-mouse-face-prop nil end)
9009 (or (next-single-property-change
9010 from gnus-mouse-face-prop nil end)
9012 ;; If no mouse-face prop on line we will have to = from = end,
9013 ;; so we highlight the entire line instead.
9014 (when (= (+ to 2) from)
9017 (if gnus-newsgroup-selected-overlay
9018 ;; Move old overlay.
9020 gnus-newsgroup-selected-overlay from to (current-buffer))
9021 ;; Create new overlay.
9023 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9024 'face gnus-summary-selected-face))))))
9026 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9027 (defun gnus-summary-highlight-line ()
9028 "Highlight current line according to `gnus-summary-highlight'."
9029 (let* ((list gnus-summary-highlight)
9031 (end (progn (end-of-line) (point)))
9032 ;; now find out where the line starts and leave point there.
9033 (beg (progn (beginning-of-line) (point)))
9034 (article (gnus-summary-article-number))
9035 (score (or (cdr (assq (or article gnus-current-article)
9036 gnus-newsgroup-scored))
9037 gnus-summary-default-score 0))
9038 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9039 (inhibit-read-only t))
9040 ;; Eval the cars of the lists until we find a match.
9041 (let ((default gnus-summary-default-score))
9043 (not (eval (caar list))))
9044 (setq list (cdr list))))
9045 (let ((face (cdar list)))
9046 (unless (eq face (get-text-property beg 'face))
9047 (gnus-put-text-property-excluding-characters-with-faces
9049 (setq face (if (boundp face) (symbol-value face) face)))
9050 (when gnus-summary-highlight-line-function
9051 (funcall gnus-summary-highlight-line-function article face))))
9054 (defun gnus-update-read-articles (group unread &optional compute)
9055 "Update the list of read articles in GROUP."
9056 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9057 (entry (gnus-gethash group gnus-newsrc-hashtb))
9058 (info (nth 2 entry))
9060 (unread (sort (copy-sequence unread) '<))
9062 (if (or (not info) (not active))
9063 ;; There is no info on this group if it was, in fact,
9064 ;; killed. Gnus stores no information on killed groups, so
9065 ;; there's nothing to be done.
9066 ;; One could store the information somewhere temporarily,
9067 ;; perhaps... Hmmm...
9069 ;; Remove any negative articles numbers.
9070 (while (and unread (< (car unread) 0))
9071 (setq unread (cdr unread)))
9072 ;; Remove any expired article numbers
9073 (while (and unread (< (car unread) (car active)))
9074 (setq unread (cdr unread)))
9075 ;; Compute the ranges of read articles by looking at the list of
9078 (when (/= (car unread) prev)
9079 (push (if (= prev (1- (car unread))) prev
9080 (cons prev (1- (car unread))))
9082 (setq prev (1+ (car unread)))
9083 (setq unread (cdr unread)))
9084 (when (<= prev (cdr active))
9085 (push (cons prev (cdr active)) read))
9086 (setq read (if (> (length read) 1) (nreverse read) read))
9090 (set-buffer gnus-group-buffer)
9093 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9094 (gnus-info-set-read ',info ',(gnus-info-read info))
9095 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9096 (gnus-group-update-group ,group t))))
9097 ;; Enter this list into the group info.
9098 (gnus-info-set-read info read)
9099 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9100 (gnus-get-unread-articles-in-group info (gnus-active group))
9103 (defun gnus-offer-save-summaries ()
9104 "Offer to save all active summary buffers."
9106 (let ((buflist (buffer-list))
9108 ;; Go through all buffers and find all summaries.
9110 (and (setq bufname (buffer-name (car buflist)))
9111 (string-match "Summary" bufname)
9113 (set-buffer bufname)
9114 ;; We check that this is, indeed, a summary buffer.
9115 (and (eq major-mode 'gnus-summary-mode)
9116 ;; Also make sure this isn't bogus.
9117 gnus-newsgroup-prepared
9118 ;; Also make sure that this isn't a dead summary buffer.
9119 (not gnus-dead-summary-mode)))
9120 (push bufname buffers))
9121 (setq buflist (cdr buflist)))
9122 ;; Go through all these summary buffers and offer to save them.
9125 "Update summary buffer %s? "
9127 (switch-to-buffer buf)
9128 (gnus-summary-exit))
9132 ;;; @ for mime-partial
9135 (defun gnus-request-partial-message ()
9137 (let ((number (gnus-summary-article-number))
9138 (group gnus-newsgroup-name)
9139 (mother gnus-article-buffer))
9140 (set-buffer (get-buffer-create " *Partial Article*"))
9142 (setq mime-preview-buffer mother)
9143 (gnus-request-article-this-buffer number group)
9147 (autoload 'mime-combine-message/partial-pieces-automatically
9149 "Internal method to combine message/partial messages automatically.")
9152 'action '((type . message)(subtype . partial)
9153 (major-mode . gnus-original-article-mode)
9154 (method . mime-combine-message/partial-pieces-automatically)
9155 (summary-buffer-exp . gnus-summary-buffer)
9156 (request-partial-message-method . gnus-request-partial-message)
9163 (defun gnus-newsgroup-setup-default-charset ()
9164 "Setup newsgroup default charset."
9165 (let ((name (and gnus-newsgroup-name
9166 (string-match "[^:]+$" gnus-newsgroup-name)
9167 (match-string 0 gnus-newsgroup-name))))
9168 (setq gnus-newsgroup-default-charset
9169 (or (and gnus-newsgroup-name
9170 (or (gnus-group-find-parameter
9171 gnus-newsgroup-name 'charset)
9172 (let ((alist gnus-newsgroup-default-charset-alist)
9177 (car (setq elem (pop alist)))
9180 charset (cdr elem))))
9182 gnus-default-charset))
9183 (setq gnus-newsgroup-iso-8859-1-forced
9184 (and gnus-newsgroup-name
9185 (or (gnus-group-find-parameter
9186 gnus-newsgroup-name 'iso-8859-1-forced)
9188 (string-match gnus-newsgroup-iso-8859-1-forced-regexp
9190 (if (stringp gnus-newsgroup-default-charset)
9191 (setq gnus-newsgroup-default-charset
9192 (intern (downcase gnus-newsgroup-default-charset))))
9193 (setq gnus-newsgroup-iso-8859-1-forced
9194 (if (stringp gnus-newsgroup-iso-8859-1-forced)
9195 (intern (downcase gnus-newsgroup-iso-8859-1-forced))
9196 (and gnus-newsgroup-iso-8859-1-forced
9197 gnus-newsgroup-default-charset))))
9203 (defun gnus-summary-display-buttonized ()
9204 "Display the current article buffer fully MIME-buttonized."
9207 (let ((gnus-unbuttonized-mime-types nil))
9208 (gnus-summary-show-article)))
9210 (defun gnus-summary-repair-multipart (article)
9211 "Add a Content-Type header to a multipart article without one."
9212 (interactive (list (gnus-summary-article-number)))
9213 (gnus-with-article article
9214 (message-narrow-to-head)
9215 (goto-char (point-max))
9217 (when (search-forward "\n--" nil t)
9218 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9219 (message-narrow-to-head)
9220 (message-remove-header "Mime-Version")
9221 (message-remove-header "Content-Type")
9222 (goto-char (point-max))
9223 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9225 (insert "Mime-Version: 1.0\n")
9227 (let (gnus-mark-article-hook)
9228 (gnus-summary-select-article t t nil article)))
9230 (defun gnus-summary-toggle-display-buttonized ()
9231 "Toggle the buttonizing of the article buffer."
9234 (if (setq gnus-inhibit-mime-unbuttonizing
9235 (not gnus-inhibit-mime-unbuttonizing))
9236 (let ((gnus-unbuttonized-mime-types nil))
9237 (gnus-summary-show-article))
9238 (gnus-summary-show-article)))
9244 (run-hooks 'gnus-sum-load-hook)
9246 ;;; gnus-sum.el ends here