1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Katsumi Yamaoka <yamaoka@jpl.org>
8 ;; Keywords: mail, news, MIME
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
31 (eval-when-compile (require 'cl))
32 (eval-when-compile (require 'gnus-clfns))
49 (autoload 'pgg-decrypt-region "pgg" nil t)
50 (autoload 'pgg-verify-region "pgg" nil t))
52 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
53 (autoload 'gnus-cache-write-active "gnus-cache")
54 (autoload 'gnus-set-summary-default-charset "gnus-i18n" nil t)
55 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
56 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
57 (autoload 'mm-uu-dissect "mm-uu")
59 (defcustom gnus-kill-summary-on-exit t
60 "*If non-nil, kill the summary buffer when you exit from it.
61 If nil, the summary will become a \"*Dead Summary*\" buffer, and
62 it will be killed sometime later."
63 :group 'gnus-summary-exit
66 (defcustom gnus-fetch-old-headers nil
67 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
68 If an unread article in the group refers to an older, already read (or
69 just marked as read) article, the old article will not normally be
70 displayed in the Summary buffer. If this variable is non-nil, Gnus
71 will attempt to grab the headers to the old articles, and thereby
72 build complete threads. If it has the value `some', only enough
73 headers to connect otherwise loose threads will be displayed. This
74 variable can also be a number. In that case, no more than that number
75 of old headers will be fetched. If it has the value `invisible', all
76 old headers will be fetched, but none will be displayed.
78 The server has to support NOV for any of this to work."
80 :type '(choice (const :tag "off" nil)
83 (sexp :menu-tag "other" t)))
85 (defcustom gnus-refer-thread-limit 200
86 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
87 If t, fetch all the available old headers."
90 (sexp :menu-tag "other" t)))
92 (defcustom gnus-summary-make-false-root 'adopt
93 "*nil means that Gnus won't gather loose threads.
94 If the root of a thread has expired or been read in a previous
95 session, the information necessary to build a complete thread has been
96 lost. Instead of having many small sub-threads from this original thread
97 scattered all over the summary buffer, Gnus can gather them.
99 If non-nil, Gnus will try to gather all loose sub-threads from an
100 original thread into one large thread.
102 If this variable is non-nil, it should be one of `none', `adopt',
105 If this variable is `none', Gnus will not make a false root, but just
106 present the sub-threads after another.
107 If this variable is `dummy', Gnus will create a dummy root that will
108 have all the sub-threads as children.
109 If this variable is `adopt', Gnus will make one of the \"children\"
110 the parent and mark all the step-children as such.
111 If this variable is `empty', the \"children\" are printed with empty
112 subject fields. (Or rather, they will be printed with a string
113 given by the `gnus-summary-same-subject' variable.)"
115 :type '(choice (const :tag "off" nil)
121 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
122 "*A regexp to match subjects to be excluded from loose thread gathering.
123 As loose thread gathering is done on subjects only, that means that
124 there can be many false gatherings performed. By rooting out certain
125 common subjects, gathering might become saner."
129 (defcustom gnus-summary-gather-subject-limit nil
130 "*Maximum length of subject comparisons when gathering loose threads.
131 Use nil to compare full subjects. Setting this variable to a low
132 number will help gather threads that have been corrupted by
133 newsreaders chopping off subject lines, but it might also mean that
134 unrelated articles that have subject that happen to begin with the
135 same few characters will be incorrectly gathered.
137 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
140 :type '(choice (const :tag "off" nil)
142 (sexp :menu-tag "on" t)))
144 (defcustom gnus-simplify-subject-functions nil
145 "List of functions taking a string argument that simplify subjects.
146 The functions are applied recursively.
148 Useful functions to put in this list include: `gnus-simplify-subject-re',
149 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
151 :type '(repeat function))
153 (defcustom gnus-simplify-ignored-prefixes nil
154 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
156 :type '(choice (const :tag "off" nil)
159 (defcustom gnus-build-sparse-threads nil
160 "*If non-nil, fill in the gaps in threads.
161 If `some', only fill in the gaps that are needed to tie loose threads
162 together. If `more', fill in all leaf nodes that Gnus can find. If
163 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
165 :type '(choice (const :tag "off" nil)
168 (sexp :menu-tag "all" t)))
170 (defcustom gnus-summary-thread-gathering-function
171 'gnus-gather-threads-by-subject
172 "*Function used for gathering loose threads.
173 There are two pre-defined functions: `gnus-gather-threads-by-subject',
174 which only takes Subjects into consideration; and
175 `gnus-gather-threads-by-references', which compared the References
176 headers of the articles to find matches."
178 :type '(radio (function-item gnus-gather-threads-by-subject)
179 (function-item gnus-gather-threads-by-references)
180 (function :tag "other")))
182 (defcustom gnus-summary-same-subject ""
183 "*String indicating that the current article has the same subject as the previous.
184 This variable will only be used if the value of
185 `gnus-summary-make-false-root' is `empty'."
186 :group 'gnus-summary-format
189 (defcustom gnus-summary-goto-unread t
190 "*If t, many commands will go to the next unread article.
191 This applies to marking commands as well as other commands that
192 \"naturally\" select the next article, like, for instance, `SPC' at
193 the end of an article.
195 If nil, the marking commands do NOT go to the next unread article
196 (they go to the next article instead). If `never', commands that
197 usually go to the next unread article, will go to the next article,
198 whether it is read or not."
199 :group 'gnus-summary-marks
200 :link '(custom-manual "(gnus)Setting Marks")
201 :type '(choice (const :tag "off" nil)
203 (sexp :menu-tag "on" t)))
205 (defcustom gnus-summary-default-score 0
206 "*Default article score level.
207 All scores generated by the score files will be added to this score.
208 If this variable is nil, scoring will be disabled."
209 :group 'gnus-score-default
210 :type '(choice (const :tag "disable")
213 (defcustom gnus-summary-default-high-score 0
214 "*Default threshold for a high scored article.
215 An article will be highlighted as high scored if its score is greater
217 :group 'gnus-score-default
220 (defcustom gnus-summary-default-low-score 0
221 "*Default threshold for a low scored article.
222 An article will be highlighted as low scored if its score is smaller
224 :group 'gnus-score-default
227 (defcustom gnus-summary-zcore-fuzz 0
228 "*Fuzziness factor for the zcore in the summary buffer.
229 Articles with scores closer than this to `gnus-summary-default-score'
231 :group 'gnus-summary-format
234 (defcustom gnus-simplify-subject-fuzzy-regexp nil
235 "*Strings to be removed when doing fuzzy matches.
236 This can either be a regular expression or list of regular expressions
237 that will be removed from subject strings if fuzzy subject
238 simplification is selected."
240 :type '(repeat regexp))
242 (defcustom gnus-show-threads t
243 "*If non-nil, display threads in summary mode."
247 (defcustom gnus-thread-hide-subtree nil
248 "*If non-nil, hide all threads initially.
249 If threads are hidden, you have to run the command
250 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
251 to expose hidden threads."
255 (defcustom gnus-thread-hide-killed t
256 "*If non-nil, hide killed threads automatically."
260 (defcustom gnus-thread-ignore-subject t
261 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
262 If nil, articles that have different subjects from their parents will
263 start separate threads."
267 (defcustom gnus-thread-operation-ignore-subject t
268 "*If non-nil, subjects will be ignored when doing thread commands.
269 This affects commands like `gnus-summary-kill-thread' and
270 `gnus-summary-lower-thread'.
272 If this variable is nil, articles in the same thread with different
273 subjects will not be included in the operation in question. If this
274 variable is `fuzzy', only articles that have subjects that are fuzzily
275 equal will be included."
277 :type '(choice (const :tag "off" nil)
281 (defcustom gnus-thread-indent-level 4
282 "*Number that says how much each sub-thread should be indented."
286 (defcustom gnus-auto-extend-newsgroup t
287 "*If non-nil, extend newsgroup forward and backward when requested."
288 :group 'gnus-summary-choose
291 (defcustom gnus-auto-select-first t
292 "*If non-nil, select the article under point.
293 Which article this is is controlled by the `gnus-auto-select-subject'
296 If you want to prevent automatic selection of articles in some
297 newsgroups, set the variable to nil in `gnus-select-group-hook'."
298 :group 'gnus-group-select
299 :type '(choice (const :tag "none" nil)
300 (sexp :menu-tag "first" t)))
302 (defcustom gnus-auto-select-subject 'unread
303 "*Says what subject to place under point when entering a group.
305 This variable can either be the symbols `first' (place point on the
306 first subject), `unread' (place point on the subject line of the first
307 unread article), `best' (place point on the subject line of the
308 higest-scored article), `unseen' (place point on the subject line of
309 the first unseen article), or a function to be called to place point on
311 :group 'gnus-group-select
312 :type '(choice (const best)
317 (defcustom gnus-dont-select-after-jump-to-other-group nil
318 "If non-nil, don't select the first unread article after entering the
319 other group by the command `gnus-summary-jump-to-other-group'. If nil,
320 it is depend on the value of `gnus-auto-select-first' whether to select
322 :group 'gnus-group-select
325 (defcustom gnus-auto-select-next t
326 "*If non-nil, offer to go to the next group from the end of the previous.
327 If the value is t and the next newsgroup is empty, Gnus will exit
328 summary mode and go back to group mode. If the value is neither nil
329 nor t, Gnus will select the following unread newsgroup. In
330 particular, if the value is the symbol `quietly', the next unread
331 newsgroup will be selected without any confirmation, and if it is
332 `almost-quietly', the next group will be selected without any
333 confirmation if you are located on the last article in the group.
334 Finally, if this variable is `slightly-quietly', the `Z n' command
335 will go to the next group without confirmation."
336 :group 'gnus-summary-maneuvering
337 :type '(choice (const :tag "off" nil)
339 (const almost-quietly)
340 (const slightly-quietly)
341 (sexp :menu-tag "on" t)))
343 (defcustom gnus-auto-select-same nil
344 "*If non-nil, select the next article with the same subject.
345 If there are no more articles with the same subject, go to
346 the first unread article."
347 :group 'gnus-summary-maneuvering
350 (defcustom gnus-summary-check-current nil
351 "*If non-nil, consider the current article when moving.
352 The \"unread\" movement commands will stay on the same line if the
353 current article is unread."
354 :group 'gnus-summary-maneuvering
357 (defcustom gnus-auto-center-summary t
358 "*If non-nil, always center the current summary buffer.
359 In particular, if `vertical' do only vertical recentering. If non-nil
360 and non-`vertical', do both horizontal and vertical recentering."
361 :group 'gnus-summary-maneuvering
362 :type '(choice (const :tag "none" nil)
364 (integer :tag "height")
365 (sexp :menu-tag "both" t)))
367 (defcustom gnus-show-all-headers nil
368 "*If non-nil, don't hide any headers."
369 :group 'gnus-article-hiding
370 :group 'gnus-article-headers
373 (defcustom gnus-summary-ignore-duplicates nil
374 "*If non-nil, ignore articles with identical Message-ID headers."
378 (defcustom gnus-single-article-buffer t
379 "*If non-nil, display all articles in the same buffer.
380 If nil, each group will get its own article buffer."
381 :group 'gnus-article-various
384 (defcustom gnus-break-pages t
385 "*If non-nil, do page breaking on articles.
386 The page delimiter is specified by the `gnus-page-delimiter'
388 :group 'gnus-article-various
391 (defcustom gnus-show-mime t
392 "*If non-nil, do mime processing of articles.
393 The articles will simply be fed to the function given by
394 `gnus-article-display-method-for-mime'."
395 :group 'gnus-article-mime
398 (defcustom gnus-move-split-methods nil
399 "*Variable used to suggest where articles are to be moved to.
400 It uses the same syntax as the `gnus-split-methods' variable.
401 However, whereas `gnus-split-methods' specifies file names as targets,
402 this variable specifies group names."
403 :group 'gnus-summary-mail
404 :type '(repeat (choice (list :value (fun) function)
405 (cons :value ("" "") regexp (repeat string))
408 (defcustom gnus-unread-mark ?\ ;;;Whitespace
409 "*Mark used for unread articles."
410 :group 'gnus-summary-marks
413 (defcustom gnus-ticked-mark ?!
414 "*Mark used for ticked articles."
415 :group 'gnus-summary-marks
418 (defcustom gnus-dormant-mark ??
419 "*Mark used for dormant articles."
420 :group 'gnus-summary-marks
423 (defcustom gnus-del-mark ?r
424 "*Mark used for del'd articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-read-mark ?R
429 "*Mark used for read articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-expirable-mark ?E
434 "*Mark used for expirable articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-killed-mark ?K
439 "*Mark used for killed articles."
440 :group 'gnus-summary-marks
443 (defcustom gnus-souped-mark ?F
444 "*Mark used for souped articles."
445 :group 'gnus-summary-marks
448 (defcustom gnus-kill-file-mark ?X
449 "*Mark used for articles killed by kill files."
450 :group 'gnus-summary-marks
453 (defcustom gnus-low-score-mark ?Y
454 "*Mark used for articles with a low score."
455 :group 'gnus-summary-marks
458 (defcustom gnus-catchup-mark ?C
459 "*Mark used for articles that are caught up."
460 :group 'gnus-summary-marks
463 (defcustom gnus-replied-mark ?A
464 "*Mark used for articles that have been replied to."
465 :group 'gnus-summary-marks
468 (defcustom gnus-forwarded-mark ?F
469 "*Mark used for articles that have been forwarded."
470 :group 'gnus-summary-marks
473 (defcustom gnus-recent-mark ?N
474 "*Mark used for articles that are recent."
475 :group 'gnus-summary-marks
478 (defcustom gnus-cached-mark ?*
479 "*Mark used for articles that are in the cache."
480 :group 'gnus-summary-marks
483 (defcustom gnus-saved-mark ?S
484 "*Mark used for articles that have been saved."
485 :group 'gnus-summary-marks
488 (defcustom gnus-unseen-mark ?.
489 "*Mark used for articles that haven't been seen."
490 :group 'gnus-summary-marks
493 (defcustom gnus-no-mark ?\ ;;;Whitespace
494 "*Mark used for articles that have no other secondary mark."
495 :group 'gnus-summary-marks
498 (defcustom gnus-ancient-mark ?O
499 "*Mark used for ancient articles."
500 :group 'gnus-summary-marks
503 (defcustom gnus-sparse-mark ?Q
504 "*Mark used for sparsely reffed articles."
505 :group 'gnus-summary-marks
508 (defcustom gnus-canceled-mark ?G
509 "*Mark used for canceled articles."
510 :group 'gnus-summary-marks
513 (defcustom gnus-duplicate-mark ?M
514 "*Mark used for duplicate articles."
515 :group 'gnus-summary-marks
518 (defcustom gnus-undownloaded-mark ?@
519 "*Mark used for articles that weren't downloaded."
520 :group 'gnus-summary-marks
523 (defcustom gnus-downloadable-mark ?%
524 "*Mark used for articles that are to be downloaded."
525 :group 'gnus-summary-marks
528 (defcustom gnus-unsendable-mark ?=
529 "*Mark used for articles that won't be sent."
530 :group 'gnus-summary-marks
533 (defcustom gnus-score-over-mark ?+
534 "*Score mark used for articles with high scores."
535 :group 'gnus-summary-marks
538 (defcustom gnus-score-below-mark ?-
539 "*Score mark used for articles with low scores."
540 :group 'gnus-summary-marks
543 (defcustom gnus-empty-thread-mark ?\ ;;;Whitespace
544 "*There is no thread under the article."
545 :group 'gnus-summary-marks
548 (defcustom gnus-not-empty-thread-mark ?=
549 "*There is a thread under the article."
550 :group 'gnus-summary-marks
553 (defcustom gnus-view-pseudo-asynchronously nil
554 "*If non-nil, Gnus will view pseudo-articles asynchronously."
555 :group 'gnus-extract-view
558 (defcustom gnus-auto-expirable-marks
559 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
560 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
561 gnus-souped-mark gnus-duplicate-mark)
562 "*The list of marks converted into expiration if a group is auto-expirable."
565 :type '(repeat character))
567 (defcustom gnus-inhibit-user-auto-expire t
568 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
573 (defcustom gnus-view-pseudos nil
574 "*If `automatic', pseudo-articles will be viewed automatically.
575 If `not-confirm', pseudos will be viewed automatically, and the user
576 will not be asked to confirm the command."
577 :group 'gnus-extract-view
578 :type '(choice (const :tag "off" nil)
580 (const not-confirm)))
582 (defcustom gnus-view-pseudos-separately t
583 "*If non-nil, one pseudo-article will be created for each file to be viewed.
584 If nil, all files that use the same viewing command will be given as a
585 list of parameters to that command."
586 :group 'gnus-extract-view
589 (defcustom gnus-insert-pseudo-articles t
590 "*If non-nil, insert pseudo-articles when decoding articles."
591 :group 'gnus-extract-view
594 (defcustom gnus-summary-dummy-line-format
596 "*The format specification for the dummy roots in the summary buffer.
597 It works along the same lines as a normal formatting string,
598 with some simple extensions.
601 :group 'gnus-threading
604 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
605 "*The format specification for the summary mode line.
606 It works along the same lines as a normal formatting string,
607 with some simple extensions:
610 %p Unprefixed group name
611 %A Current article number
612 %z Current article score
614 %U Number of unread articles in the group
615 %e Number of unselected articles in the group
616 %Z A string with unread/unselected article counts
617 %g Shortish group name
618 %S Subject of the current article
620 %s Current score file name
621 %d Number of dormant articles
622 %r Number of articles that have been marked as read in this session
623 %E Number of articles expunged by the score files"
624 :group 'gnus-summary-format
627 (defcustom gnus-list-identifiers nil
628 "Regexp that matches list identifiers to be removed from subject.
629 This can also be a list of regexps."
631 :group 'gnus-summary-format
632 :group 'gnus-article-hiding
633 :type '(choice (const :tag "none" nil)
635 (repeat :value (".*") regexp)))
637 (defcustom gnus-summary-mark-below 0
638 "*Mark all articles with a score below this variable as read.
639 This variable is local to each summary buffer and usually set by the
641 :group 'gnus-score-default
644 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
645 "*List of functions used for sorting articles in the summary buffer.
647 Each function takes two articles and returns non-nil if the first
648 article should be sorted before the other. If you use more than one
649 function, the primary sort function should be the last. You should
650 probably always include `gnus-article-sort-by-number' in the list of
651 sorting functions -- preferably first. Also note that sorting by date
652 is often much slower than sorting by number, and the sorting order is
653 very similar. (Sorting by date means sorting by the time the message
654 was sent, sorting by number means sorting by arrival time.)
656 Ready-made functions include `gnus-article-sort-by-number',
657 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
658 `gnus-article-sort-by-date' and `gnus-article-sort-by-score'.
660 When threading is turned on, the variable `gnus-thread-sort-functions'
661 controls how articles are sorted."
662 :group 'gnus-summary-sort
663 :type '(repeat (choice (function-item gnus-article-sort-by-number)
664 (function-item gnus-article-sort-by-author)
665 (function-item gnus-article-sort-by-subject)
666 (function-item gnus-article-sort-by-date)
667 (function-item gnus-article-sort-by-score)
668 (function :tag "other"))))
670 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
671 "*List of functions used for sorting threads in the summary buffer.
672 By default, threads are sorted by article number.
674 Each function takes two threads and returns non-nil if the first
675 thread should be sorted before the other. If you use more than one
676 function, the primary sort function should be the last. You should
677 probably always include `gnus-thread-sort-by-number' in the list of
678 sorting functions -- preferably first. Also note that sorting by date
679 is often much slower than sorting by number, and the sorting order is
680 very similar. (Sorting by date means sorting by the time the message
681 was sent, sorting by number means sorting by arrival time.)
683 Ready-made functions include `gnus-thread-sort-by-number',
684 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
685 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
686 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
688 When threading is turned off, the variable
689 `gnus-article-sort-functions' controls how articles are sorted."
690 :group 'gnus-summary-sort
691 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
692 (function-item gnus-thread-sort-by-author)
693 (function-item gnus-thread-sort-by-subject)
694 (function-item gnus-thread-sort-by-date)
695 (function-item gnus-thread-sort-by-score)
696 (function-item gnus-thread-sort-by-total-score)
697 (function :tag "other"))))
699 (defcustom gnus-thread-score-function '+
700 "*Function used for calculating the total score of a thread.
702 The function is called with the scores of the article and each
703 subthread and should then return the score of the thread.
705 Some functions you can use are `+', `max', or `min'."
706 :group 'gnus-summary-sort
709 (defcustom gnus-summary-expunge-below nil
710 "All articles that have a score less than this variable will be expunged.
711 This variable is local to the summary buffers."
712 :group 'gnus-score-default
713 :type '(choice (const :tag "off" nil)
716 (defcustom gnus-thread-expunge-below nil
717 "All threads that have a total score less than this variable will be expunged.
718 See `gnus-thread-score-function' for en explanation of what a
721 This variable is local to the summary buffers."
722 :group 'gnus-threading
723 :group 'gnus-score-default
724 :type '(choice (const :tag "off" nil)
727 (defcustom gnus-summary-mode-hook nil
728 "*A hook for Gnus summary mode.
729 This hook is run before any variables are set in the summary buffer."
730 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
731 :group 'gnus-summary-various
734 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
735 (when (featurep 'xemacs)
736 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
737 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
738 (add-hook 'gnus-summary-mode-hook
739 'gnus-xmas-switch-horizontal-scrollbar-off))
741 (defcustom gnus-summary-menu-hook nil
742 "*Hook run after the creation of the summary mode menu."
743 :group 'gnus-summary-visual
746 (defcustom gnus-summary-exit-hook nil
747 "*A hook called on exit from the summary buffer.
748 It will be called with point in the group buffer."
749 :group 'gnus-summary-exit
752 (defcustom gnus-summary-prepare-hook nil
753 "*A hook called after the summary buffer has been generated.
754 If you want to modify the summary buffer, you can use this hook."
755 :group 'gnus-summary-various
758 (defcustom gnus-summary-prepared-hook nil
759 "*A hook called as the last thing after the summary buffer has been generated."
760 :group 'gnus-summary-various
763 (defcustom gnus-summary-generate-hook nil
764 "*A hook run just before generating the summary buffer.
765 This hook is commonly used to customize threading variables and the
767 :group 'gnus-summary-various
770 (defcustom gnus-select-group-hook nil
771 "*A hook called when a newsgroup is selected.
773 If you'd like to simplify subjects like the
774 `gnus-summary-next-same-subject' command does, you can use the
777 (setq gnus-select-group-hook
780 (mapcar (lambda (header)
781 (mail-header-set-subject
783 (gnus-simplify-subject
784 (mail-header-subject header) 're-only)))
785 gnus-newsgroup-headers))))"
786 :group 'gnus-group-select
789 (defcustom gnus-select-article-hook nil
790 "*A hook called when an article is selected."
791 :group 'gnus-summary-choose
794 (defcustom gnus-visual-mark-article-hook
795 (list 'gnus-highlight-selected-summary)
796 "*Hook run after selecting an article in the summary buffer.
797 It is meant to be used for highlighting the article in some way. It
798 is not run if `gnus-visual' is nil."
799 :group 'gnus-summary-visual
802 (defcustom gnus-parse-headers-hook '(gnus-set-summary-default-charset)
803 "*A hook called before parsing the headers."
807 (defcustom gnus-exit-group-hook nil
808 "*A hook called when exiting summary mode.
809 This hook is not called from the non-updating exit commands like `Q'."
813 (defcustom gnus-summary-update-hook
814 (list 'gnus-summary-highlight-line)
815 "*A hook called when a summary line is changed.
816 The hook will not be called if `gnus-visual' is nil.
818 The default function `gnus-summary-highlight-line' will
819 highlight the line according to the `gnus-summary-highlight'
821 :group 'gnus-summary-visual
824 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
825 "*A hook called when an article is selected for the first time.
826 The hook is intended to mark an article as read (or unread)
827 automatically when it is selected."
828 :group 'gnus-summary-choose
831 (defcustom gnus-group-no-more-groups-hook nil
832 "*A hook run when returning to group mode having no more (unread) groups."
833 :group 'gnus-group-select
836 (defcustom gnus-ps-print-hook nil
837 "*A hook run before ps-printing something from Gnus."
841 (defcustom gnus-summary-display-arrow
842 (and (fboundp 'display-graphic-p)
844 "*If non-nil, display an arrow highlighting the current article."
849 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
850 "Face used for highlighting the current article in the summary buffer."
851 :group 'gnus-summary-visual
854 (defcustom gnus-summary-highlight
855 '(((= mark gnus-canceled-mark)
856 . gnus-summary-cancelled-face)
857 ((and (> score default-high)
858 (or (= mark gnus-dormant-mark)
859 (= mark gnus-ticked-mark)))
860 . gnus-summary-high-ticked-face)
861 ((and (< score default-low)
862 (or (= mark gnus-dormant-mark)
863 (= mark gnus-ticked-mark)))
864 . gnus-summary-low-ticked-face)
865 ((or (= mark gnus-dormant-mark)
866 (= mark gnus-ticked-mark))
867 . gnus-summary-normal-ticked-face)
868 ((and (> score default-high) (= mark gnus-ancient-mark))
869 . gnus-summary-high-ancient-face)
870 ((and (< score default-low) (= mark gnus-ancient-mark))
871 . gnus-summary-low-ancient-face)
872 ((= mark gnus-ancient-mark)
873 . gnus-summary-normal-ancient-face)
874 ((and (> score default-high) (= mark gnus-unread-mark))
875 . gnus-summary-high-unread-face)
876 ((and (< score default-low) (= mark gnus-unread-mark))
877 . gnus-summary-low-unread-face)
878 ((= mark gnus-unread-mark)
879 . gnus-summary-normal-unread-face)
880 ((and (> score default-high) (memq mark (list gnus-downloadable-mark
881 gnus-undownloaded-mark)))
882 . gnus-summary-high-unread-face)
883 ((and (< score default-low) (memq mark (list gnus-downloadable-mark
884 gnus-undownloaded-mark)))
885 . gnus-summary-low-unread-face)
886 ((and (memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
887 (memq article gnus-newsgroup-unreads))
888 . gnus-summary-normal-unread-face)
889 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
890 . gnus-summary-normal-read-face)
891 ((> score default-high)
892 . gnus-summary-high-read-face)
893 ((< score default-low)
894 . gnus-summary-low-read-face)
896 . gnus-summary-normal-read-face))
897 "*Controls the highlighting of summary buffer lines.
899 A list of (FORM . FACE) pairs. When deciding how a a particular
900 summary line should be displayed, each form is evaluated. The content
901 of the face field after the first true form is used. You can change
902 how those summary lines are displayed, by editing the face field.
904 You can use the following variables in the FORM field.
906 score: The article's score
907 default: The default article score.
908 default-high: The default score for high scored articles.
909 default-low: The default score for low scored articles.
910 below: The score below which articles are automatically marked as read.
911 mark: The articles mark."
912 :group 'gnus-summary-visual
913 :type '(repeat (cons (sexp :tag "Form" nil)
916 (defcustom gnus-alter-header-function nil
917 "Function called to allow alteration of article header structures.
918 The function is called with one parameter, the article header vector,
919 which it may alter in any way.")
921 (defvar gnus-decode-encoded-word-function
922 (mime-find-field-decoder 'From 'nov)
923 "Variable that says which function should be used to decode a string with encoded words.")
925 (defcustom gnus-extra-headers nil
926 "*Extra headers to parse."
929 :type '(repeat symbol))
931 (defcustom gnus-ignored-from-addresses
932 (and user-mail-address (regexp-quote user-mail-address))
933 "*Regexp of From headers that may be suppressed in favor of To headers."
938 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
939 "List of charsets that should be ignored.
940 When these charsets are used in the \"charset\" parameter, the
941 default charset will be used instead."
943 :type '(repeat symbol)
944 :group 'gnus-charset)
946 (gnus-define-group-parameter
950 "Return the ignored charsets of GROUP."
951 :variable gnus-group-ignored-charsets-alist
953 '(("alt\\.chinese\\.text" iso-8859-1))
955 "Alist of regexps (to match group names) and charsets that should be ignored.
956 When these charsets are used in the \"charset\" parameter, the
957 default charset will be used instead."
958 :variable-group gnus-charset
959 :variable-type '(repeat (cons (regexp :tag "Group")
961 :parameter-type '(choice :tag "Ignored charsets"
964 :parameter-document "\
965 List of charsets that should be ignored.
967 When these charsets are used in the \"charset\" parameter, the
968 default charset will be used instead.")
970 (defcustom gnus-group-highlight-words-alist nil
971 "Alist of group regexps and highlight regexps.
972 This variable uses the same syntax as `gnus-emphasis-alist'."
974 :type '(repeat (cons (regexp :tag "Group")
975 (repeat (list (regexp :tag "Highlight regexp")
976 (number :tag "Group for entire word" 0)
977 (number :tag "Group for displayed part" 0)
979 gnus-emphasis-highlight-words)))))
980 :group 'gnus-summary-visual)
982 (defcustom gnus-use-wheel nil
983 "Use Intelli-mouse on summary movement"
985 :group 'gnus-summary-maneuvering)
987 (defcustom gnus-wheel-scroll-amount '(5 . 1)
988 "Amount to scroll messages by spinning the mouse wheel.
989 This is actually a cons cell, where the first item is the amount to scroll
990 on a normal wheel event, and the second is the amount to scroll when the
991 wheel is moved with the shift key depressed."
992 :type '(cons (integer :tag "Shift") integer)
993 :group 'gnus-summary-maneuvering)
995 (defcustom gnus-wheel-edge-resistance 2
996 "How hard it should be to change the current article
997 by moving the mouse over the edge of the article window."
999 :group 'gnus-summary-maneuvering)
1001 (defcustom gnus-summary-show-article-charset-alist
1003 "Alist of number and charset.
1004 The article will be shown with the charset corresponding to the
1006 For example: ((1 . cn-gb-2312) (2 . big5))."
1008 :type '(repeat (cons (number :tag "Argument" 1)
1009 (symbol :tag "Charset")))
1010 :group 'gnus-charset)
1012 (defcustom gnus-preserve-marks t
1013 "Whether marks are preserved when moving, copying and respooling messages."
1016 :group 'gnus-summary-marks)
1018 (defcustom gnus-alter-articles-to-read-function nil
1019 "Function to be called to alter the list of articles to be selected."
1020 :type '(choice (const nil) function)
1021 :group 'gnus-summary)
1023 (defcustom gnus-orphan-score nil
1024 "*All orphans get this score added. Set in the score file."
1025 :group 'gnus-score-default
1026 :type '(choice (const nil)
1029 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1030 "*A regexp to match MIME parts when saving multiple parts of a message
1031 with gnus-summary-save-parts (X m). This regexp will be used by default
1032 when prompting the user for which type of files to save."
1033 :group 'gnus-summary
1037 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1038 "*A regexp to match MIME parts when saving multiple parts of a message
1039 with gnus-summary-save-parts (X m). This regexp will be used by default
1040 when prompting the user for which type of files to save."
1041 :group 'gnus-summary
1044 (defcustom gnus-read-all-available-headers nil
1045 "Whether Gnus should parse all headers made available to it.
1046 This is mostly relevant for slow backends where the user may
1047 wish to widen the summary buffer to include all headers
1048 that were fetched. Say, for nnultimate groups."
1049 :group 'gnus-summary
1050 :type '(choice boolean regexp))
1052 (defcustom gnus-summary-muttprint-program "muttprint"
1053 "Command (and optional arguments) used to run Muttprint."
1054 :group 'gnus-summary
1057 ;;; Internal variables
1059 (defvar gnus-summary-display-cache nil)
1060 (defvar gnus-article-mime-handles nil)
1061 (defvar gnus-article-decoded-p nil)
1062 (defvar gnus-article-charset nil)
1063 (defvar gnus-article-ignored-charsets nil)
1064 (defvar gnus-scores-exclude-files nil)
1065 (defvar gnus-page-broken nil)
1066 (defvar gnus-inhibit-mime-unbuttonizing nil)
1068 (defvar gnus-original-article nil)
1069 (defvar gnus-article-internal-prepare-hook nil)
1070 (defvar gnus-newsgroup-process-stack nil)
1072 (defvar gnus-thread-indent-array nil)
1073 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1074 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1075 "Function called to sort the articles within a thread after it has been gathered together.")
1077 (defvar gnus-summary-save-parts-type-history nil)
1078 (defvar gnus-summary-save-parts-last-directory nil)
1080 (defvar gnus-summary-save-parts-type-history nil)
1081 (defvar gnus-summary-save-parts-last-directory nil)
1083 ;; Avoid highlighting in kill files.
1084 (defvar gnus-summary-inhibit-highlight nil)
1085 (defvar gnus-newsgroup-selected-overlay nil)
1086 (defvar gnus-inhibit-limiting nil)
1087 (defvar gnus-newsgroup-adaptive-score-file nil)
1088 (defvar gnus-current-score-file nil)
1089 (defvar gnus-current-move-group nil)
1090 (defvar gnus-current-copy-group nil)
1091 (defvar gnus-current-crosspost-group nil)
1092 (defvar gnus-newsgroup-display nil)
1094 (defvar gnus-newsgroup-dependencies nil)
1095 (defvar gnus-newsgroup-adaptive nil)
1096 (defvar gnus-summary-display-article-function nil)
1097 (defvar gnus-summary-highlight-line-function nil
1098 "Function called after highlighting a summary line.")
1100 (defvar gnus-summary-line-format-alist
1101 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1102 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1103 (?s gnus-tmp-subject-or-nil ?s)
1104 (?n gnus-tmp-name ?s)
1105 (?A (std11-address-string
1106 (car (mime-entity-read-field gnus-tmp-header 'From))) ?s)
1107 (?a (or (std11-full-name-string
1108 (car (mime-entity-read-field gnus-tmp-header 'From)))
1110 (?F gnus-tmp-from ?s)
1111 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1112 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1113 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1114 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1115 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1116 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1117 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1118 (?L gnus-tmp-lines ?s)
1119 (?I gnus-tmp-indentation ?s)
1120 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1121 (?R gnus-tmp-replied ?c)
1122 (?\[ gnus-tmp-opening-bracket ?c)
1123 (?\] gnus-tmp-closing-bracket ?c)
1124 (?\> (make-string gnus-tmp-level ? ) ?s)
1125 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1126 (?i gnus-tmp-score ?d)
1127 (?z gnus-tmp-score-char ?c)
1128 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1129 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1130 (?U gnus-tmp-unread ?c)
1131 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1133 (?t (gnus-summary-number-of-articles-in-thread
1134 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1136 (?e (gnus-summary-number-of-articles-in-thread
1137 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1139 (?u gnus-tmp-user-defined ?s)
1140 (?P (gnus-pick-line-number) ?d)
1141 (?B gnus-tmp-thread-tree-header-string ?s)
1142 (user-date (gnus-user-date
1143 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1144 "An alist of format specifications that can appear in summary lines.
1145 These are paired with what variables they correspond with, along with
1146 the type of the variable (string, integer, character, etc).")
1148 (defvar gnus-summary-dummy-line-format-alist
1149 `((?S gnus-tmp-subject ?s)
1150 (?N gnus-tmp-number ?d)
1151 (?u gnus-tmp-user-defined ?s)))
1153 (defvar gnus-summary-mode-line-format-alist
1154 `((?G gnus-tmp-group-name ?s)
1155 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1156 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1157 (?A gnus-tmp-article-number ?d)
1158 (?Z gnus-tmp-unread-and-unselected ?s)
1159 (?V gnus-version ?s)
1160 (?U gnus-tmp-unread-and-unticked ?d)
1161 (?S gnus-tmp-subject ?s)
1162 (?e gnus-tmp-unselected ?d)
1163 (?u gnus-tmp-user-defined ?s)
1164 (?d (length gnus-newsgroup-dormant) ?d)
1165 (?t (length gnus-newsgroup-marked) ?d)
1166 (?r (length gnus-newsgroup-reads) ?d)
1167 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1168 (?E gnus-newsgroup-expunged-tally ?d)
1169 (?s (gnus-current-score-file-nondirectory) ?s)))
1171 (defvar gnus-last-search-regexp nil
1172 "Default regexp for article search command.")
1174 (defvar gnus-summary-search-article-matched-data nil
1175 "Last matched data of article search command. It is the local variable
1176 in `gnus-article-buffer' which consists of the list of start position,
1177 end position and text.")
1179 (defvar gnus-last-shell-command nil
1180 "Default shell command on article.")
1182 (defvar gnus-newsgroup-begin nil)
1183 (defvar gnus-newsgroup-end nil)
1184 (defvar gnus-newsgroup-last-rmail nil)
1185 (defvar gnus-newsgroup-last-mail nil)
1186 (defvar gnus-newsgroup-last-folder nil)
1187 (defvar gnus-newsgroup-last-file nil)
1188 (defvar gnus-newsgroup-auto-expire nil)
1189 (defvar gnus-newsgroup-active nil)
1191 (defvar gnus-newsgroup-data nil)
1192 (defvar gnus-newsgroup-data-reverse nil)
1193 (defvar gnus-newsgroup-limit nil)
1194 (defvar gnus-newsgroup-limits nil)
1196 (defvar gnus-newsgroup-unreads nil
1197 "List of unread articles in the current newsgroup.")
1199 (defvar gnus-newsgroup-unselected nil
1200 "List of unselected unread articles in the current newsgroup.")
1202 (defvar gnus-newsgroup-reads nil
1203 "Alist of read articles and article marks in the current newsgroup.")
1205 (defvar gnus-newsgroup-expunged-tally nil)
1207 (defvar gnus-newsgroup-marked nil
1208 "List of ticked articles in the current newsgroup (a subset of unread art).")
1210 (defvar gnus-newsgroup-killed nil
1211 "List of ranges of articles that have been through the scoring process.")
1213 (defvar gnus-newsgroup-cached nil
1214 "List of articles that come from the article cache.")
1216 (defvar gnus-newsgroup-saved nil
1217 "List of articles that have been saved.")
1219 (defvar gnus-newsgroup-kill-headers nil)
1221 (defvar gnus-newsgroup-replied nil
1222 "List of articles that have been replied to in the current newsgroup.")
1224 (defvar gnus-newsgroup-forwarded nil
1225 "List of articles that have been forwarded in the current newsgroup.")
1227 (defvar gnus-newsgroup-recent nil
1228 "List of articles that have are recent in the current newsgroup.")
1230 (defvar gnus-newsgroup-expirable nil
1231 "List of articles in the current newsgroup that can be expired.")
1233 (defvar gnus-newsgroup-processable nil
1234 "List of articles in the current newsgroup that can be processed.")
1236 (defvar gnus-newsgroup-downloadable nil
1237 "List of articles in the current newsgroup that can be processed.")
1239 (defvar gnus-newsgroup-undownloaded nil
1240 "List of articles in the current newsgroup that haven't been downloaded..")
1242 (defvar gnus-newsgroup-unsendable nil
1243 "List of articles in the current newsgroup that won't be sent.")
1245 (defvar gnus-newsgroup-bookmarks nil
1246 "List of articles in the current newsgroup that have bookmarks.")
1248 (defvar gnus-newsgroup-dormant nil
1249 "List of dormant articles in the current newsgroup.")
1251 (defvar gnus-newsgroup-unseen nil
1252 "List of unseen articles in the current newsgroup.")
1254 (defvar gnus-newsgroup-seen nil
1255 "Range of seen articles in the current newsgroup.")
1257 (defvar gnus-newsgroup-articles nil
1258 "List of articles in the current newsgroup.")
1260 (defvar gnus-newsgroup-scored nil
1261 "List of scored articles in the current newsgroup.")
1263 (defvar gnus-newsgroup-incorporated nil
1264 "List of incorporated articles in the current newsgroup.")
1266 (defvar gnus-newsgroup-headers nil
1267 "List of article headers in the current newsgroup.")
1269 (defvar gnus-newsgroup-threads nil)
1271 (defvar gnus-newsgroup-prepared nil
1272 "Whether the current group has been prepared properly.")
1274 (defvar gnus-newsgroup-ancient nil
1275 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1277 (defvar gnus-newsgroup-sparse nil)
1279 (defvar gnus-current-article nil)
1280 (defvar gnus-article-current nil)
1281 (defvar gnus-current-headers nil)
1282 (defvar gnus-have-all-headers nil)
1283 (defvar gnus-last-article nil)
1284 (defvar gnus-newsgroup-history nil)
1285 (defvar gnus-newsgroup-charset nil)
1286 (defvar gnus-newsgroup-ephemeral-charset nil)
1287 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1289 (defvar gnus-article-before-search nil)
1291 (defconst gnus-summary-local-variables
1292 '(gnus-newsgroup-name
1293 gnus-newsgroup-begin gnus-newsgroup-end
1294 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1295 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1296 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1297 gnus-newsgroup-unselected gnus-newsgroup-marked
1298 gnus-newsgroup-reads gnus-newsgroup-saved
1299 gnus-newsgroup-replied gnus-newsgroup-forwarded
1300 gnus-newsgroup-recent
1301 gnus-newsgroup-expirable
1302 gnus-newsgroup-processable gnus-newsgroup-killed
1303 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1304 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1305 gnus-newsgroup-seen gnus-newsgroup-articles
1306 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1307 gnus-newsgroup-headers gnus-newsgroup-threads
1308 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1309 gnus-current-article gnus-current-headers gnus-have-all-headers
1310 gnus-last-article gnus-article-internal-prepare-hook
1311 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1312 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1313 gnus-thread-expunge-below
1314 gnus-score-alist gnus-current-score-file
1315 (gnus-summary-expunge-below . global)
1316 (gnus-summary-mark-below . global)
1317 (gnus-orphan-score . global)
1318 gnus-newsgroup-active gnus-scores-exclude-files
1319 gnus-newsgroup-history gnus-newsgroup-ancient
1320 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1321 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1322 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1323 (gnus-newsgroup-expunged-tally . 0)
1324 gnus-cache-removable-articles gnus-newsgroup-cached
1325 gnus-newsgroup-data gnus-newsgroup-data-reverse
1326 gnus-newsgroup-limit gnus-newsgroup-limits
1327 gnus-newsgroup-charset gnus-newsgroup-display
1328 gnus-newsgroup-incorporated)
1329 "Variables that are buffer-local to the summary buffers.")
1331 (defvar gnus-newsgroup-variables nil
1332 "A list of variables that have separate values in different newsgroups.
1333 A list of newsgroup (summary buffer) local variables, or cons of
1334 variables and their default values (when the default values are not
1335 nil), that should be made global while the summary buffer is active.
1336 These variables can be used to set variables in the group parameters
1337 while still allowing them to affect operations done in other
1338 buffers. For example:
1340 \(setq gnus-newsgroup-variables
1341 '(message-use-followup-to
1342 (gnus-visible-headers .
1343 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1346 ;; Byte-compiler warning.
1347 (eval-when-compile (defvar gnus-article-mode-map))
1349 ;; Subject simplification.
1351 (defun gnus-simplify-whitespace (str)
1352 "Remove excessive whitespace from STR."
1355 (while (string-match "[ \t][ \t]+" mystr)
1356 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1358 (substring mystr (match-end 0)))))
1360 (when (string-match "^[ \t]+" mystr)
1361 (setq mystr (substring mystr (match-end 0))))
1363 (when (string-match "[ \t]+$" mystr)
1364 (setq mystr (substring mystr 0 (match-beginning 0))))
1367 (defsubst gnus-simplify-subject-re (subject)
1368 "Remove \"Re:\" from subject lines."
1369 (if (string-match message-subject-re-regexp subject)
1370 (substring subject (match-end 0))
1373 (defun gnus-simplify-subject (subject &optional re-only)
1374 "Remove `Re:' and words in parentheses.
1375 If RE-ONLY is non-nil, strip leading `Re:'s only."
1376 (let ((case-fold-search t)) ;Ignore case.
1377 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1378 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1379 (setq subject (substring subject (match-end 0))))
1380 ;; Remove uninteresting prefixes.
1381 (when (and (not re-only)
1382 gnus-simplify-ignored-prefixes
1383 (string-match gnus-simplify-ignored-prefixes subject))
1384 (setq subject (substring subject (match-end 0))))
1385 ;; Remove words in parentheses from end.
1387 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1388 (setq subject (substring subject 0 (match-beginning 0)))))
1389 ;; Return subject string.
1392 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1394 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1395 (goto-char (point-min))
1396 (while (re-search-forward regexp nil t)
1397 (replace-match (or newtext ""))))
1399 (defun gnus-simplify-buffer-fuzzy ()
1400 "Simplify string in the buffer fuzzily.
1401 The string in the accessible portion of the current buffer is simplified.
1402 It is assumed to be a single-line subject.
1403 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1404 matter is removed. Additional things can be deleted by setting
1405 `gnus-simplify-subject-fuzzy-regexp'."
1406 (let ((case-fold-search t)
1408 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1410 (while (not (eq modified-tick (buffer-modified-tick)))
1411 (setq modified-tick (buffer-modified-tick))
1413 ((listp gnus-simplify-subject-fuzzy-regexp)
1414 (mapcar 'gnus-simplify-buffer-fuzzy-step
1415 gnus-simplify-subject-fuzzy-regexp))
1416 (gnus-simplify-subject-fuzzy-regexp
1417 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1418 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1419 (gnus-simplify-buffer-fuzzy-step
1420 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1421 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1423 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1424 (gnus-simplify-buffer-fuzzy-step " +" " ")
1425 (gnus-simplify-buffer-fuzzy-step " $")
1426 (gnus-simplify-buffer-fuzzy-step "^ +")))
1428 (defun gnus-simplify-subject-fuzzy (subject)
1429 "Simplify a subject string fuzzily.
1430 See `gnus-simplify-buffer-fuzzy' for details."
1432 (gnus-set-work-buffer)
1433 (let ((case-fold-search t))
1434 ;; Remove uninteresting prefixes.
1435 (when (and gnus-simplify-ignored-prefixes
1436 (string-match gnus-simplify-ignored-prefixes subject))
1437 (setq subject (substring subject (match-end 0))))
1439 (inline (gnus-simplify-buffer-fuzzy))
1442 (defsubst gnus-simplify-subject-fully (subject)
1443 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1445 (gnus-simplify-subject-functions
1446 (gnus-map-function gnus-simplify-subject-functions subject))
1447 ((null gnus-summary-gather-subject-limit)
1448 (gnus-simplify-subject-re subject))
1449 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1450 (gnus-simplify-subject-fuzzy subject))
1451 ((numberp gnus-summary-gather-subject-limit)
1452 (gnus-limit-string (gnus-simplify-subject-re subject)
1453 gnus-summary-gather-subject-limit))
1457 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1458 "Check whether two subjects are equal.
1459 If optional argument simple-first is t, first argument is already
1462 ((null simple-first)
1463 (equal (gnus-simplify-subject-fully s1)
1464 (gnus-simplify-subject-fully s2)))
1467 (gnus-simplify-subject-fully s2)))))
1469 (defun gnus-summary-bubble-group ()
1470 "Increase the score of the current group.
1471 This is a handy function to add to `gnus-summary-exit-hook' to
1472 increase the score of each group you read."
1473 (gnus-group-add-score gnus-newsgroup-name))
1477 ;;; Gnus summary mode
1480 (put 'gnus-summary-mode 'mode-class 'special)
1482 (defvar gnus-article-commands-menu)
1485 ;; Non-orthogonal keys
1487 (gnus-define-keys gnus-summary-mode-map
1488 " " gnus-summary-next-page
1489 "\177" gnus-summary-prev-page
1490 [delete] gnus-summary-prev-page
1491 [backspace] gnus-summary-prev-page
1492 "\r" gnus-summary-scroll-up
1493 "\M-\r" gnus-summary-scroll-down
1494 "n" gnus-summary-next-unread-article
1495 "p" gnus-summary-prev-unread-article
1496 "N" gnus-summary-next-article
1497 "P" gnus-summary-prev-article
1498 "\M-\C-n" gnus-summary-next-same-subject
1499 "\M-\C-p" gnus-summary-prev-same-subject
1500 "\M-n" gnus-summary-next-unread-subject
1501 "\M-p" gnus-summary-prev-unread-subject
1502 "." gnus-summary-first-unread-article
1503 "," gnus-summary-best-unread-article
1504 "\M-s" gnus-summary-search-article-forward
1505 "\M-r" gnus-summary-search-article-backward
1506 "<" gnus-summary-beginning-of-article
1507 ">" gnus-summary-end-of-article
1508 "j" gnus-summary-goto-article
1509 "^" gnus-summary-refer-parent-article
1510 "\M-^" gnus-summary-refer-article
1511 "u" gnus-summary-tick-article-forward
1512 "!" gnus-summary-tick-article-forward
1513 "U" gnus-summary-tick-article-backward
1514 "d" gnus-summary-mark-as-read-forward
1515 "D" gnus-summary-mark-as-read-backward
1516 "E" gnus-summary-mark-as-expirable
1517 "\M-u" gnus-summary-clear-mark-forward
1518 "\M-U" gnus-summary-clear-mark-backward
1519 "k" gnus-summary-kill-same-subject-and-select
1520 "\C-k" gnus-summary-kill-same-subject
1521 "\M-\C-k" gnus-summary-kill-thread
1522 "\M-\C-l" gnus-summary-lower-thread
1523 "e" gnus-summary-edit-article
1524 "#" gnus-summary-mark-as-processable
1525 "\M-#" gnus-summary-unmark-as-processable
1526 "\M-\C-t" gnus-summary-toggle-threads
1527 "\M-\C-s" gnus-summary-show-thread
1528 "\M-\C-h" gnus-summary-hide-thread
1529 "\M-\C-f" gnus-summary-next-thread
1530 "\M-\C-b" gnus-summary-prev-thread
1531 [(meta down)] gnus-summary-next-thread
1532 [(meta up)] gnus-summary-prev-thread
1533 "\M-\C-u" gnus-summary-up-thread
1534 "\M-\C-d" gnus-summary-down-thread
1535 "&" gnus-summary-execute-command
1536 "c" gnus-summary-catchup-and-exit
1537 "\C-w" gnus-summary-mark-region-as-read
1538 "\C-t" gnus-summary-toggle-truncation
1539 "?" gnus-summary-mark-as-dormant
1540 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1541 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1542 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1543 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1544 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1545 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1546 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1547 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1548 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1549 "=" gnus-summary-expand-window
1550 "\C-x\C-s" gnus-summary-reselect-current-group
1551 "\M-g" gnus-summary-rescan-group
1552 "w" gnus-summary-stop-page-breaking
1553 "\C-c\C-r" gnus-summary-caesar-message
1554 "\M-t" gnus-summary-toggle-mime
1555 "f" gnus-summary-followup
1556 "F" gnus-summary-followup-with-original
1557 "C" gnus-summary-cancel-article
1558 "r" gnus-summary-reply
1559 "R" gnus-summary-reply-with-original
1560 "\C-c\C-f" gnus-summary-mail-forward
1561 "o" gnus-summary-save-article
1562 "\C-o" gnus-summary-save-article-mail
1563 "|" gnus-summary-pipe-output
1564 "\M-k" gnus-summary-edit-local-kill
1565 "\M-K" gnus-summary-edit-global-kill
1567 "\C-c\C-d" gnus-summary-describe-group
1568 "q" gnus-summary-exit
1569 "Q" gnus-summary-exit-no-update
1570 "\C-c\C-i" gnus-info-find-node
1571 gnus-mouse-2 gnus-mouse-pick-article
1572 "m" gnus-summary-mail-other-window
1573 "a" gnus-summary-post-news
1574 "i" gnus-summary-news-other-window
1575 "x" gnus-summary-limit-to-unread
1576 "s" gnus-summary-isearch-article
1577 "t" gnus-article-toggle-headers
1578 "g" gnus-summary-show-article
1579 "l" gnus-summary-goto-last-article
1580 "v" gnus-summary-preview-mime-message
1581 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1582 "\C-d" gnus-summary-enter-digest-group
1583 "\M-\C-d" gnus-summary-read-document
1584 "\M-\C-e" gnus-summary-edit-parameters
1585 "\M-\C-a" gnus-summary-customize-parameters
1587 "\C-c\C-n" gnus-namazu-search
1588 "*" gnus-cache-enter-article
1589 "\M-*" gnus-cache-remove-article
1590 "\M-&" gnus-summary-universal-argument
1591 "\C-l" gnus-recenter
1592 "I" gnus-summary-increase-score
1593 "L" gnus-summary-lower-score
1594 "\M-i" gnus-symbolic-argument
1595 "h" gnus-summary-select-article-buffer
1597 "V" gnus-summary-score-map
1598 "X" gnus-uu-extract-map
1599 "S" gnus-summary-send-map)
1601 ;; Sort of orthogonal keymap
1602 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1603 "t" gnus-summary-tick-article-forward
1604 "!" gnus-summary-tick-article-forward
1605 "d" gnus-summary-mark-as-read-forward
1606 "r" gnus-summary-mark-as-read-forward
1607 "c" gnus-summary-clear-mark-forward
1608 " " gnus-summary-clear-mark-forward
1609 "e" gnus-summary-mark-as-expirable
1610 "x" gnus-summary-mark-as-expirable
1611 "?" gnus-summary-mark-as-dormant
1612 "b" gnus-summary-set-bookmark
1613 "B" gnus-summary-remove-bookmark
1614 "#" gnus-summary-mark-as-processable
1615 "\M-#" gnus-summary-unmark-as-processable
1616 "S" gnus-summary-limit-include-expunged
1617 "C" gnus-summary-catchup
1618 "H" gnus-summary-catchup-to-here
1619 "h" gnus-summary-catchup-from-here
1620 "\C-c" gnus-summary-catchup-all
1621 "k" gnus-summary-kill-same-subject-and-select
1622 "K" gnus-summary-kill-same-subject
1623 "P" gnus-uu-mark-map)
1625 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1626 "c" gnus-summary-clear-above
1627 "u" gnus-summary-tick-above
1628 "m" gnus-summary-mark-above
1629 "k" gnus-summary-kill-below)
1631 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1632 "/" gnus-summary-limit-to-subject
1633 "n" gnus-summary-limit-to-articles
1634 "w" gnus-summary-pop-limit
1635 "s" gnus-summary-limit-to-subject
1636 "a" gnus-summary-limit-to-author
1637 "u" gnus-summary-limit-to-unread
1638 "m" gnus-summary-limit-to-marks
1639 "M" gnus-summary-limit-exclude-marks
1640 "v" gnus-summary-limit-to-score
1641 "*" gnus-summary-limit-include-cached
1642 "D" gnus-summary-limit-include-dormant
1643 "T" gnus-summary-limit-include-thread
1644 "d" gnus-summary-limit-exclude-dormant
1645 "t" gnus-summary-limit-to-age
1646 "x" gnus-summary-limit-to-extra
1647 "p" gnus-summary-limit-to-display-predicate
1648 "E" gnus-summary-limit-include-expunged
1649 "c" gnus-summary-limit-exclude-childless-dormant
1650 "C" gnus-summary-limit-mark-excluded-as-read
1651 "o" gnus-summary-insert-old-articles
1652 "N" gnus-summary-insert-new-articles)
1654 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1655 "n" gnus-summary-next-unread-article
1656 "p" gnus-summary-prev-unread-article
1657 "N" gnus-summary-next-article
1658 "P" gnus-summary-prev-article
1659 "\C-n" gnus-summary-next-same-subject
1660 "\C-p" gnus-summary-prev-same-subject
1661 "\M-n" gnus-summary-next-unread-subject
1662 "\M-p" gnus-summary-prev-unread-subject
1663 "f" gnus-summary-first-unread-article
1664 "b" gnus-summary-best-unread-article
1665 "j" gnus-summary-goto-article
1666 "g" gnus-summary-goto-subject
1667 "l" gnus-summary-goto-last-article
1668 "o" gnus-summary-pop-article)
1670 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1671 "k" gnus-summary-kill-thread
1672 "l" gnus-summary-lower-thread
1673 "i" gnus-summary-raise-thread
1674 "T" gnus-summary-toggle-threads
1675 "t" gnus-summary-rethread-current
1676 "^" gnus-summary-reparent-thread
1677 "s" gnus-summary-show-thread
1678 "S" gnus-summary-show-all-threads
1679 "h" gnus-summary-hide-thread
1680 "H" gnus-summary-hide-all-threads
1681 "n" gnus-summary-next-thread
1682 "p" gnus-summary-prev-thread
1683 "u" gnus-summary-up-thread
1684 "o" gnus-summary-top-thread
1685 "d" gnus-summary-down-thread
1686 "#" gnus-uu-mark-thread
1687 "\M-#" gnus-uu-unmark-thread)
1689 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1690 "g" gnus-summary-prepare
1691 "c" gnus-summary-insert-cached-articles)
1693 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1694 "c" gnus-summary-catchup-and-exit
1695 "C" gnus-summary-catchup-all-and-exit
1696 "E" gnus-summary-exit-no-update
1697 "J" gnus-summary-jump-to-other-group
1698 "Q" gnus-summary-exit
1699 "Z" gnus-summary-exit
1700 "n" gnus-summary-catchup-and-goto-next-group
1701 "R" gnus-summary-reselect-current-group
1702 "G" gnus-summary-rescan-group
1703 "N" gnus-summary-next-group
1704 "s" gnus-summary-save-newsrc
1705 "P" gnus-summary-prev-group)
1707 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1708 " " gnus-summary-next-page
1709 "n" gnus-summary-next-page
1710 "\177" gnus-summary-prev-page
1711 [delete] gnus-summary-prev-page
1712 "p" gnus-summary-prev-page
1713 "\r" gnus-summary-scroll-up
1714 "\M-\r" gnus-summary-scroll-down
1715 "<" gnus-summary-beginning-of-article
1716 ">" gnus-summary-end-of-article
1717 "b" gnus-summary-beginning-of-article
1718 "e" gnus-summary-end-of-article
1719 "^" gnus-summary-refer-parent-article
1720 "r" gnus-summary-refer-parent-article
1721 "D" gnus-summary-enter-digest-group
1722 "R" gnus-summary-refer-references
1723 "T" gnus-summary-refer-thread
1724 "g" gnus-summary-show-article
1725 "s" gnus-summary-isearch-article
1726 "P" gnus-summary-print-article
1727 "M" gnus-mailing-list-insinuate
1728 "t" gnus-article-babel)
1730 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1731 "b" gnus-article-add-buttons
1732 "B" gnus-article-add-buttons-to-head
1733 "o" gnus-article-treat-overstrike
1734 "e" gnus-article-emphasize
1735 "w" gnus-article-fill-cited-article
1736 "Q" gnus-article-fill-long-lines
1737 "C" gnus-article-capitalize-sentences
1738 "c" gnus-article-remove-cr
1739 "Z" gnus-article-decode-HZ
1740 "f" gnus-article-display-x-face
1741 "l" gnus-summary-stop-page-breaking
1742 "r" gnus-summary-caesar-message
1743 "t" gnus-article-toggle-headers
1744 "g" gnus-summary-toggle-smiley
1745 "u" gnus-article-treat-unfold-headers
1746 "n" gnus-article-treat-fold-newsgroups
1747 "v" gnus-summary-verbose-headers
1748 "m" gnus-summary-toggle-mime
1749 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1750 "p" gnus-article-verify-x-pgp-sig
1751 "d" gnus-article-treat-dumbquotes)
1753 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1754 "a" gnus-article-hide
1755 "h" gnus-article-toggle-headers
1756 "b" gnus-article-hide-boring-headers
1757 "s" gnus-article-hide-signature
1758 "c" gnus-article-hide-citation
1759 "C" gnus-article-hide-citation-in-followups
1760 "l" gnus-article-hide-list-identifiers
1761 "p" gnus-article-hide-pgp
1762 "B" gnus-article-strip-banner
1763 "P" gnus-article-hide-pem
1764 "\C-c" gnus-article-hide-citation-maybe)
1766 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1767 "a" gnus-article-highlight
1768 "h" gnus-article-highlight-headers
1769 "c" gnus-article-highlight-citation
1770 "s" gnus-article-highlight-signature)
1772 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1773 "x" gnus-article-display-x-face
1774 "s" gnus-summary-toggle-smiley
1775 "f" gnus-treat-from-picon
1776 "m" gnus-treat-mail-picon
1777 "n" gnus-treat-newsgroups-picon)
1779 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1780 "z" gnus-article-date-ut
1781 "u" gnus-article-date-ut
1782 "l" gnus-article-date-local
1783 "p" gnus-article-date-english
1784 "e" gnus-article-date-lapsed
1785 "o" gnus-article-date-original
1786 "i" gnus-article-date-iso8601
1787 "s" gnus-article-date-user)
1789 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1790 "t" gnus-article-remove-trailing-blank-lines
1791 "l" gnus-article-strip-leading-blank-lines
1792 "m" gnus-article-strip-multiple-blank-lines
1793 "a" gnus-article-strip-blank-lines
1794 "A" gnus-article-strip-all-blank-lines
1795 "s" gnus-article-strip-leading-space
1796 "e" gnus-article-strip-trailing-space
1797 "w" gnus-article-remove-leading-whitespace)
1799 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1801 "f" gnus-summary-fetch-faq
1802 "d" gnus-summary-describe-group
1803 "h" gnus-summary-describe-briefly
1804 "i" gnus-info-find-node)
1806 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1807 "e" gnus-summary-expire-articles
1808 "\M-\C-e" gnus-summary-expire-articles-now
1809 "\177" gnus-summary-delete-article
1810 [delete] gnus-summary-delete-article
1811 [backspace] gnus-summary-delete-article
1812 "m" gnus-summary-move-article
1813 "r" gnus-summary-respool-article
1814 "w" gnus-summary-edit-article
1815 "c" gnus-summary-copy-article
1816 "B" gnus-summary-crosspost-article
1817 "q" gnus-summary-respool-query
1818 "t" gnus-summary-respool-trace
1819 "i" gnus-summary-import-article
1820 "I" gnus-summary-create-article
1821 "p" gnus-summary-article-posted-p)
1823 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1824 "o" gnus-summary-save-article
1825 "m" gnus-summary-save-article-mail
1826 "F" gnus-summary-write-article-file
1827 "r" gnus-summary-save-article-rmail
1828 "f" gnus-summary-save-article-file
1829 "b" gnus-summary-save-article-body-file
1830 "h" gnus-summary-save-article-folder
1831 "v" gnus-summary-save-article-vm
1832 "p" gnus-summary-pipe-output
1833 "P" gnus-summary-muttprint
1834 "s" gnus-soup-add-article)
1836 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1837 "b" gnus-summary-display-buttonized
1838 "m" gnus-summary-repair-multipart
1839 "v" gnus-article-view-part
1840 "o" gnus-article-save-part
1841 "c" gnus-article-copy-part
1842 "C" gnus-article-view-part-as-charset
1843 "e" gnus-article-externalize-part
1844 "E" gnus-article-encrypt-body
1845 "i" gnus-article-inline-part
1846 "|" gnus-article-pipe-part))
1848 (defvar gnus-article-post-menu nil)
1850 (defun gnus-summary-make-menu-bar ()
1851 (gnus-turn-off-edit-menu 'summary)
1853 (unless (boundp 'gnus-summary-misc-menu)
1856 gnus-summary-kill-menu gnus-summary-mode-map ""
1861 ["Customize" gnus-score-customize t])
1862 (gnus-make-score-map 'increase)
1863 (gnus-make-score-map 'lower)
1865 ["Kill below" gnus-summary-kill-below t]
1866 ["Mark above" gnus-summary-mark-above t]
1867 ["Tick above" gnus-summary-tick-above t]
1868 ["Clear above" gnus-summary-clear-above t])
1869 ["Current score" gnus-summary-current-score t]
1870 ["Set score" gnus-summary-set-score t]
1871 ["Switch current score file..." gnus-score-change-score-file t]
1872 ["Set mark below..." gnus-score-set-mark-below t]
1873 ["Set expunge below..." gnus-score-set-expunge-below t]
1874 ["Edit current score file" gnus-score-edit-current-scores t]
1875 ["Edit score file" gnus-score-edit-file t]
1876 ["Trace score" gnus-score-find-trace t]
1877 ["Find words" gnus-score-find-favourite-words t]
1878 ["Rescore buffer" gnus-summary-rescore t]
1879 ["Increase score..." gnus-summary-increase-score t]
1880 ["Lower score..." gnus-summary-lower-score t]))))
1882 ;; Define both the Article menu in the summary buffer and the
1883 ;; equivalent Commands menu in the article buffer here for
1887 ["All" gnus-article-hide t]
1888 ["Headers" gnus-article-toggle-headers t]
1889 ["Signature" gnus-article-hide-signature t]
1890 ["Citation" gnus-article-hide-citation t]
1891 ["List identifiers" gnus-article-hide-list-identifiers t]
1892 ["PGP" gnus-article-hide-pgp t]
1893 ["Banner" gnus-article-strip-banner t]
1894 ["Boring headers" gnus-article-hide-boring-headers t])
1896 ["All" gnus-article-highlight t]
1897 ["Headers" gnus-article-highlight-headers t]
1898 ["Signature" gnus-article-highlight-signature t]
1899 ["Citation" gnus-article-highlight-citation t])
1901 ["Local" gnus-article-date-local t]
1902 ["ISO8601" gnus-article-date-iso8601 t]
1903 ["UT" gnus-article-date-ut t]
1904 ["Original" gnus-article-date-original t]
1905 ["Lapsed" gnus-article-date-lapsed t]
1906 ["User-defined" gnus-article-date-user t])
1908 ["Toggle smiley" gnus-summary-toggle-smiley t]
1909 ["Show X-Face" gnus-article-display-x-face t]
1910 ["Show picons in From" gnus-treat-from-picon t]
1911 ["Show picons in mail headers" gnus-treat-mail-picon t]
1912 ["Show picons in news headers" gnus-treat-newsgroups-picon t])
1915 ["Leading" gnus-article-strip-leading-blank-lines t]
1916 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1917 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1918 ["All of the above" gnus-article-strip-blank-lines t]
1919 ["All" gnus-article-strip-all-blank-lines t]
1920 ["Leading space" gnus-article-strip-leading-space t]
1921 ["Trailing space" gnus-article-strip-trailing-space t]
1922 ["Leading space in headers"
1923 gnus-article-remove-leading-whitespace t])
1924 ["Overstrike" gnus-article-treat-overstrike t]
1925 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1926 ["Emphasis" gnus-article-emphasize t]
1927 ["Word wrap" gnus-article-fill-cited-article t]
1928 ["Fill long lines" gnus-article-fill-long-lines t]
1929 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1930 ["CR" gnus-article-remove-cr t]
1931 ["Rot 13" gnus-summary-caesar-message
1932 ,@(if (featurep 'xemacs) '(t)
1933 '(:help "\"Caesar rotate\" article by 13"))]
1934 ["Unix pipe" gnus-summary-pipe-message t]
1935 ["Add buttons" gnus-article-add-buttons t]
1936 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1937 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1938 ["Toggle MIME" gnus-summary-toggle-mime t]
1939 ["Verbose header" gnus-summary-verbose-headers t]
1940 ["Toggle header" gnus-summary-toggle-header t]
1941 ["Unfold headers" gnus-article-treat-unfold-headers t]
1942 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
1943 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
1944 ["HZ" gnus-article-decode-HZ t])
1946 ["Save in default format" gnus-summary-save-article
1947 ,@(if (featurep 'xemacs) '(t)
1948 '(:help "Save article using default method"))]
1949 ["Save in file" gnus-summary-save-article-file
1950 ,@(if (featurep 'xemacs) '(t)
1951 '(:help "Save article in file"))]
1952 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1953 ["Save in MH folder" gnus-summary-save-article-folder t]
1954 ["Save in VM folder" gnus-summary-save-article-vm t]
1955 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1956 ["Save body in file" gnus-summary-save-article-body-file t]
1957 ["Pipe through a filter" gnus-summary-pipe-output t]
1958 ["Add to SOUP packet" gnus-soup-add-article t]
1959 ["Print with Muttprint" gnus-summary-muttprint t]
1960 ["Print" gnus-summary-print-article t])
1962 ["Respool article..." gnus-summary-respool-article t]
1963 ["Move article..." gnus-summary-move-article
1964 (gnus-check-backend-function
1965 'request-move-article gnus-newsgroup-name)]
1966 ["Copy article..." gnus-summary-copy-article t]
1967 ["Crosspost article..." gnus-summary-crosspost-article
1968 (gnus-check-backend-function
1969 'request-replace-article gnus-newsgroup-name)]
1970 ["Import file..." gnus-summary-import-article t]
1971 ["Create article..." gnus-summary-create-article t]
1972 ["Check if posted" gnus-summary-article-posted-p t]
1973 ["Edit article" gnus-summary-edit-article
1974 (not (gnus-group-read-only-p))]
1975 ["Delete article" gnus-summary-delete-article
1976 (gnus-check-backend-function
1977 'request-expire-articles gnus-newsgroup-name)]
1978 ["Query respool" gnus-summary-respool-query t]
1979 ["Trace respool" gnus-summary-respool-trace t]
1980 ["Delete expirable articles" gnus-summary-expire-articles-now
1981 (gnus-check-backend-function
1982 'request-expire-articles gnus-newsgroup-name)])
1984 ["Uudecode" gnus-uu-decode-uu
1985 ,@(if (featurep 'xemacs) '(t)
1986 '(:help "Decode uuencoded article(s)"))]
1987 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1988 ["Unshar" gnus-uu-decode-unshar t]
1989 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1990 ["Save" gnus-uu-decode-save t]
1991 ["Binhex" gnus-uu-decode-binhex t]
1992 ["Postscript" gnus-uu-decode-postscript t])
1994 ["Enter article" gnus-cache-enter-article t]
1995 ["Remove article" gnus-cache-remove-article t])
1996 ["Translate" gnus-article-babel t]
1997 ["Select article buffer" gnus-summary-select-article-buffer t]
1998 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1999 ["Isearch article..." gnus-summary-isearch-article t]
2000 ["Beginning of the article" gnus-summary-beginning-of-article t]
2001 ["End of the article" gnus-summary-end-of-article t]
2002 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2003 ["Fetch referenced articles" gnus-summary-refer-references t]
2004 ["Fetch current thread" gnus-summary-refer-thread t]
2005 ["Fetch article with id..." gnus-summary-refer-article t]
2006 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2007 ["Redisplay" gnus-summary-show-article t]
2008 ["Raw article" gnus-summary-show-raw-article t])))
2010 gnus-summary-article-menu gnus-summary-mode-map ""
2011 (cons "Article" innards))
2013 (if (not (keymapp gnus-summary-article-menu))
2015 gnus-article-commands-menu gnus-article-mode-map ""
2016 (cons "Commands" innards))
2017 ;; in Emacs, don't share menu.
2018 (setq gnus-article-commands-menu
2019 (copy-keymap gnus-summary-article-menu))
2020 (define-key gnus-article-mode-map [menu-bar commands]
2021 (cons "Commands" gnus-article-commands-menu))))
2024 gnus-summary-thread-menu gnus-summary-mode-map ""
2026 ["Toggle threading" gnus-summary-toggle-threads t]
2027 ["Hide threads" gnus-summary-hide-all-threads t]
2028 ["Show threads" gnus-summary-show-all-threads t]
2029 ["Hide thread" gnus-summary-hide-thread t]
2030 ["Show thread" gnus-summary-show-thread t]
2031 ["Go to next thread" gnus-summary-next-thread t]
2032 ["Go to previous thread" gnus-summary-prev-thread t]
2033 ["Go down thread" gnus-summary-down-thread t]
2034 ["Go up thread" gnus-summary-up-thread t]
2035 ["Top of thread" gnus-summary-top-thread t]
2036 ["Mark thread as read" gnus-summary-kill-thread t]
2037 ["Lower thread score" gnus-summary-lower-thread t]
2038 ["Raise thread score" gnus-summary-raise-thread t]
2039 ["Rethread current" gnus-summary-rethread-current t]))
2042 gnus-summary-post-menu gnus-summary-mode-map ""
2044 ["Send a message (mail or news)" gnus-summary-post-news
2045 ,@(if (featurep 'xemacs) '(t)
2046 '(:help "Post an article"))]
2047 ["Followup" gnus-summary-followup
2048 ,@(if (featurep 'xemacs) '(t)
2049 '(:help "Post followup to this article"))]
2050 ["Followup and yank" gnus-summary-followup-with-original
2051 ,@(if (featurep 'xemacs) '(t)
2052 '(:help "Post followup to this article, quoting its contents"))]
2053 ["Supersede article" gnus-summary-supersede-article t]
2054 ["Cancel article" gnus-summary-cancel-article
2055 ,@(if (featurep 'xemacs) '(t)
2056 '(:help "Cancel an article you posted"))]
2057 ["Reply" gnus-summary-reply t]
2058 ["Reply and yank" gnus-summary-reply-with-original t]
2059 ["Wide reply" gnus-summary-wide-reply t]
2060 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2061 ,@(if (featurep 'xemacs) '(t)
2062 '(:help "Mail a reply, quoting this article"))]
2063 ["Mail forward" gnus-summary-mail-forward t]
2064 ["Post forward" gnus-summary-post-forward t]
2065 ["Digest and mail" gnus-summary-digest-mail-forward t]
2066 ["Digest and post" gnus-summary-digest-post-forward t]
2067 ["Resend message" gnus-summary-resend-message t]
2068 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2069 ["Send a mail" gnus-summary-mail-other-window t]
2070 ["Create a local message" gnus-summary-news-other-window t]
2071 ["Uuencode and post" gnus-uu-post-news
2072 ,@(if (featurep 'xemacs) '(t)
2073 '(:help "Post a uuencoded article"))]
2074 ["Followup via news" gnus-summary-followup-to-mail t]
2075 ["Followup via news and yank"
2076 gnus-summary-followup-to-mail-with-original t]
2078 ;;["Send" gnus-summary-send-draft t]
2079 ;;["Send bounced" gnus-resend-bounced-mail t])
2083 ((not (keymapp gnus-summary-post-menu))
2084 (setq gnus-article-post-menu gnus-summary-post-menu))
2085 ((not gnus-article-post-menu)
2086 ;; Don't share post menu.
2087 (setq gnus-article-post-menu
2088 (copy-keymap gnus-summary-post-menu))))
2089 (define-key gnus-article-mode-map [menu-bar post]
2090 (cons "Post" gnus-article-post-menu))
2093 gnus-summary-misc-menu gnus-summary-mode-map ""
2096 ["Mark as read" gnus-summary-mark-as-read-forward t]
2097 ["Mark same subject and select"
2098 gnus-summary-kill-same-subject-and-select t]
2099 ["Mark same subject" gnus-summary-kill-same-subject t]
2100 ["Catchup" gnus-summary-catchup
2101 ,@(if (featurep 'xemacs) '(t)
2102 '(:help "Mark unread articles in this group as read"))]
2103 ["Catchup all" gnus-summary-catchup-all t]
2104 ["Catchup to here" gnus-summary-catchup-to-here t]
2105 ["Catchup from here" gnus-summary-catchup-from-here t]
2106 ["Catchup region" gnus-summary-mark-region-as-read t]
2107 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2109 ["Tick" gnus-summary-tick-article-forward t]
2110 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2111 ["Remove marks" gnus-summary-clear-mark-forward t]
2112 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2113 ["Set bookmark" gnus-summary-set-bookmark t]
2114 ["Remove bookmark" gnus-summary-remove-bookmark t])
2116 ["Marks..." gnus-summary-limit-to-marks t]
2117 ["Subject..." gnus-summary-limit-to-subject t]
2118 ["Author..." gnus-summary-limit-to-author t]
2119 ["Age..." gnus-summary-limit-to-age t]
2120 ["Extra..." gnus-summary-limit-to-extra t]
2121 ["Score" gnus-summary-limit-to-score t]
2122 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2123 ["Unread" gnus-summary-limit-to-unread t]
2124 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2125 ["Articles" gnus-summary-limit-to-articles t]
2126 ["Pop limit" gnus-summary-pop-limit t]
2127 ["Show dormant" gnus-summary-limit-include-dormant t]
2128 ["Hide childless dormant"
2129 gnus-summary-limit-exclude-childless-dormant t]
2130 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2131 ["Hide marked" gnus-summary-limit-exclude-marks t]
2132 ["Show expunged" gnus-summary-limit-include-expunged t])
2134 ["Set mark" gnus-summary-mark-as-processable t]
2135 ["Remove mark" gnus-summary-unmark-as-processable t]
2136 ["Remove all marks" gnus-summary-unmark-all-processable t]
2137 ["Mark above" gnus-uu-mark-over t]
2138 ["Mark series" gnus-uu-mark-series t]
2139 ["Mark region" gnus-uu-mark-region t]
2140 ["Unmark region" gnus-uu-unmark-region t]
2141 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2142 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2143 ["Mark all" gnus-uu-mark-all t]
2144 ["Mark buffer" gnus-uu-mark-buffer t]
2145 ["Mark sparse" gnus-uu-mark-sparse t]
2146 ["Mark thread" gnus-uu-mark-thread t]
2147 ["Unmark thread" gnus-uu-unmark-thread t]
2148 ("Process Mark Sets"
2149 ["Kill" gnus-summary-kill-process-mark t]
2150 ["Yank" gnus-summary-yank-process-mark
2151 gnus-newsgroup-process-stack]
2152 ["Save" gnus-summary-save-process-mark t]))
2154 ["Page forward" gnus-summary-next-page
2155 ,@(if (featurep 'xemacs) '(t)
2156 '(:help "Show next page of article"))]
2157 ["Page backward" gnus-summary-prev-page
2158 ,@(if (featurep 'xemacs) '(t)
2159 '(:help "Show previous page of article"))]
2160 ["Line forward" gnus-summary-scroll-up t])
2162 ["Next unread article" gnus-summary-next-unread-article t]
2163 ["Previous unread article" gnus-summary-prev-unread-article t]
2164 ["Next article" gnus-summary-next-article t]
2165 ["Previous article" gnus-summary-prev-article t]
2166 ["Next unread subject" gnus-summary-next-unread-subject t]
2167 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2168 ["Next article same subject" gnus-summary-next-same-subject t]
2169 ["Previous article same subject" gnus-summary-prev-same-subject t]
2170 ["First unread article" gnus-summary-first-unread-article t]
2171 ["Best unread article" gnus-summary-best-unread-article t]
2172 ["Go to subject number..." gnus-summary-goto-subject t]
2173 ["Go to article number..." gnus-summary-goto-article t]
2174 ["Go to the last article" gnus-summary-goto-last-article t]
2175 ["Pop article off history" gnus-summary-pop-article t])
2177 ["Sort by number" gnus-summary-sort-by-number t]
2178 ["Sort by author" gnus-summary-sort-by-author t]
2179 ["Sort by subject" gnus-summary-sort-by-subject t]
2180 ["Sort by date" gnus-summary-sort-by-date t]
2181 ["Sort by score" gnus-summary-sort-by-score t]
2182 ["Sort by lines" gnus-summary-sort-by-lines t]
2183 ["Sort by characters" gnus-summary-sort-by-chars t]
2184 ["Original sort" gnus-summary-sort-by-original t])
2186 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2187 ["Describe group" gnus-summary-describe-group t]
2188 ["Read manual" gnus-info-find-node t])
2190 ["Pick and read" gnus-pick-mode t]
2191 ["Binary" gnus-binary-mode t])
2193 ["Regenerate" gnus-summary-prepare t]
2194 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2195 ["Toggle threading" gnus-summary-toggle-threads t])
2196 ["See old articles" gnus-summary-insert-old-articles t]
2197 ["See new articles" gnus-summary-insert-new-articles t]
2198 ["Filter articles..." gnus-summary-execute-command t]
2199 ["Run command on subjects..." gnus-summary-universal-argument t]
2200 ["Search articles forward..." gnus-summary-search-article-forward t]
2201 ["Search articles backward..." gnus-summary-search-article-backward t]
2202 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2203 ["Expand window" gnus-summary-expand-window t]
2204 ["Expire expirable articles" gnus-summary-expire-articles
2205 (gnus-check-backend-function
2206 'request-expire-articles gnus-newsgroup-name)]
2207 ["Edit local kill file" gnus-summary-edit-local-kill t]
2208 ["Edit main kill file" gnus-summary-edit-global-kill t]
2209 ["Edit group parameters" gnus-summary-edit-parameters t]
2210 ["Customize group parameters" gnus-summary-customize-parameters t]
2211 ["Send a bug report" gnus-bug t]
2213 ["Catchup and exit" gnus-summary-catchup-and-exit
2214 ,@(if (featurep 'xemacs) '(t)
2215 '(:help "Mark unread articles in this group as read, then exit"))]
2216 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2217 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2218 ["Exit group" gnus-summary-exit
2219 ,@(if (featurep 'xemacs) '(t)
2220 '(:help "Exit current group, return to group selection mode"))]
2221 ["Exit group without updating" gnus-summary-exit-no-update t]
2222 ["Exit and goto next group" gnus-summary-next-group t]
2223 ["Exit and goto prev group" gnus-summary-prev-group t]
2224 ["Reselect group" gnus-summary-reselect-current-group t]
2225 ["Rescan group" gnus-summary-rescan-group t]
2226 ["Update dribble" gnus-summary-save-newsrc t])))
2228 (gnus-run-hooks 'gnus-summary-menu-hook)))
2230 (defvar gnus-summary-tool-bar-map nil)
2232 ;; Emacs 21 tool bar. Should be no-op otherwise.
2233 (defun gnus-summary-make-tool-bar ()
2234 (if (and (fboundp 'tool-bar-add-item-from-menu)
2235 (default-value 'tool-bar-mode)
2236 (not gnus-summary-tool-bar-map))
2237 (setq gnus-summary-tool-bar-map
2238 (let ((tool-bar-map (make-sparse-keymap))
2239 (load-path (mm-image-load-path)))
2240 (tool-bar-add-item-from-menu
2241 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2242 (tool-bar-add-item-from-menu
2243 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2244 (tool-bar-add-item-from-menu
2245 'gnus-summary-post-news "post" gnus-summary-mode-map)
2246 (tool-bar-add-item-from-menu
2247 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2248 (tool-bar-add-item-from-menu
2249 'gnus-summary-followup "followup" gnus-summary-mode-map)
2250 (tool-bar-add-item-from-menu
2251 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2252 (tool-bar-add-item-from-menu
2253 'gnus-summary-reply "reply" gnus-summary-mode-map)
2254 (tool-bar-add-item-from-menu
2255 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2256 (tool-bar-add-item-from-menu
2257 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2258 (tool-bar-add-item-from-menu
2259 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2260 (tool-bar-add-item-from-menu
2261 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2262 (tool-bar-add-item-from-menu
2263 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2264 (tool-bar-add-item-from-menu
2265 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2266 (tool-bar-add-item-from-menu
2267 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2268 (tool-bar-add-item-from-menu
2269 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2271 (if gnus-summary-tool-bar-map
2272 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2274 (defun gnus-score-set-default (var value)
2275 "A version of set that updates the GNU Emacs menu-bar."
2277 ;; It is the message that forces the active status to be updated.
2280 (defun gnus-make-score-map (type)
2281 "Make a summary score map of type TYPE."
2284 (let ((headers '(("author" "from" string)
2285 ("subject" "subject" string)
2286 ("article body" "body" string)
2287 ("article head" "head" string)
2288 ("xref" "xref" string)
2289 ("extra header" "extra" string)
2290 ("lines" "lines" number)
2291 ("followups to author" "followup" string)))
2292 (types '((number ("less than" <)
2295 (string ("substring" s)
2299 (perms '(("temporary" (current-time-string))
2307 (if (eq type 'lower)
2312 (setq header (car headers))
2318 (let ((ts (cdr (assoc (nth 2 header) types)))
2334 'gnus-summary-score-entry
2336 (if (or (string= (nth 1 header)
2338 (string= (nth 1 header)
2341 (list 'gnus-summary-header
2343 (list 'quote (nth 1 (car ts)))
2344 (list 'gnus-score-delta-default
2351 (list (nreverse outp))))
2354 (list (nreverse outt))))
2356 (setq headers (cdr headers)))
2357 (list (nreverse outh))))))))
2361 (defun gnus-summary-mode (&optional group)
2362 "Major mode for reading articles.
2364 All normal editing commands are switched off.
2365 \\<gnus-summary-mode-map>
2366 Each line in this buffer represents one article. To read an
2367 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2368 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2371 You can also post articles and send mail from this buffer. To
2372 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2373 of an article, type `\\[gnus-summary-reply]'.
2375 There are approx. one gazillion commands you can execute in this
2376 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2378 The following commands are available:
2380 \\{gnus-summary-mode-map}"
2382 (kill-all-local-variables)
2383 (when (gnus-visual-p 'summary-menu 'menu)
2384 (gnus-summary-make-menu-bar)
2385 (gnus-summary-make-tool-bar))
2386 (gnus-summary-make-local-variables)
2387 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2388 (gnus-summary-make-local-variables))
2389 (gnus-make-thread-indent-array)
2390 (gnus-simplify-mode-line)
2391 (setq major-mode 'gnus-summary-mode)
2392 (setq mode-name "Summary")
2393 (make-local-variable 'minor-mode-alist)
2394 (use-local-map gnus-summary-mode-map)
2395 (buffer-disable-undo)
2396 (setq buffer-read-only t) ;Disable modification
2397 (setq truncate-lines t)
2398 (setq selective-display t)
2399 (setq selective-display-ellipses t) ;Display `...'
2400 (gnus-summary-set-display-table)
2401 (gnus-set-default-directory)
2402 (setq gnus-newsgroup-name group)
2403 (unless (gnus-news-group-p group)
2404 (setq gnus-newsgroup-incorporated
2405 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2406 (make-local-variable 'gnus-summary-line-format)
2407 (make-local-variable 'gnus-summary-line-format-spec)
2408 (make-local-variable 'gnus-summary-dummy-line-format)
2409 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2410 (make-local-variable 'gnus-summary-mark-positions)
2411 (make-local-hook 'pre-command-hook)
2412 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2413 (gnus-run-hooks 'gnus-summary-mode-hook)
2414 (turn-on-gnus-mailing-list-mode)
2415 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2416 (gnus-update-summary-mark-positions))
2418 (defun gnus-summary-make-local-variables ()
2419 "Make all the local summary buffer variables."
2421 (dolist (local gnus-summary-local-variables)
2424 (if (eq (cdr local) 'global)
2425 ;; Copy the global value of the variable.
2426 (setq global (symbol-value (car local)))
2427 ;; Use the value from the list.
2428 (setq global (eval (cdr local))))
2429 (set (make-local-variable (car local)) global))
2430 ;; Simple nil-valued local variable.
2431 (set (make-local-variable local) nil)))))
2433 (defun gnus-summary-clear-local-variables ()
2434 (let ((locals gnus-summary-local-variables))
2436 (if (consp (car locals))
2437 (and (vectorp (caar locals))
2438 (set (caar locals) nil))
2439 (and (vectorp (car locals))
2440 (set (car locals) nil)))
2441 (setq locals (cdr locals)))))
2443 ;; Summary data functions.
2445 (defmacro gnus-data-number (data)
2448 (defmacro gnus-data-set-number (data number)
2449 `(setcar ,data ,number))
2451 (defmacro gnus-data-mark (data)
2454 (defmacro gnus-data-set-mark (data mark)
2455 `(setcar (nthcdr 1 ,data) ,mark))
2457 (defmacro gnus-data-pos (data)
2460 (defmacro gnus-data-set-pos (data pos)
2461 `(setcar (nthcdr 2 ,data) ,pos))
2463 (defmacro gnus-data-header (data)
2466 (defmacro gnus-data-set-header (data header)
2467 `(setcar (nthcdr 3 ,data) ,header))
2469 (defmacro gnus-data-level (data)
2472 (defmacro gnus-data-unread-p (data)
2473 `(= (nth 1 ,data) gnus-unread-mark))
2475 (defmacro gnus-data-read-p (data)
2476 `(/= (nth 1 ,data) gnus-unread-mark))
2478 (defmacro gnus-data-pseudo-p (data)
2479 `(consp (nth 3 ,data)))
2481 (defmacro gnus-data-find (number)
2482 `(assq ,number gnus-newsgroup-data))
2484 (defmacro gnus-data-find-list (number &optional data)
2485 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2486 (memq (assq ,number bdata)
2489 (defmacro gnus-data-make (number mark pos header level)
2490 `(list ,number ,mark ,pos ,header ,level))
2492 (defun gnus-data-enter (after-article number mark pos header level offset)
2493 (let ((data (gnus-data-find-list after-article)))
2495 (error "No such article: %d" after-article))
2496 (setcdr data (cons (gnus-data-make number mark pos header level)
2498 (setq gnus-newsgroup-data-reverse nil)
2499 (gnus-data-update-list (cddr data) offset)))
2501 (defun gnus-data-enter-list (after-article list &optional offset)
2503 (let ((data (and after-article (gnus-data-find-list after-article)))
2507 (let ((odata gnus-newsgroup-data))
2508 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2510 (gnus-data-update-list odata offset)))
2511 ;; Find the last element in the list to be spliced into the main
2514 (setq list (cdr list)))
2517 (setcdr list gnus-newsgroup-data)
2518 (setq gnus-newsgroup-data ilist)
2520 (gnus-data-update-list (cdr list) offset)))
2521 (setcdr list (cdr data))
2524 (gnus-data-update-list (cdr list) offset))))
2525 (setq gnus-newsgroup-data-reverse nil))))
2527 (defun gnus-data-remove (article &optional offset)
2528 (let ((data gnus-newsgroup-data))
2529 (if (= (gnus-data-number (car data)) article)
2531 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2532 gnus-newsgroup-data-reverse nil)
2534 (gnus-data-update-list gnus-newsgroup-data offset)))
2536 (when (= (gnus-data-number (cadr data)) article)
2537 (setcdr data (cddr data))
2539 (gnus-data-update-list (cdr data) offset))
2541 gnus-newsgroup-data-reverse nil))
2542 (setq data (cdr data))))))
2544 (defmacro gnus-data-list (backward)
2546 (or gnus-newsgroup-data-reverse
2547 (setq gnus-newsgroup-data-reverse
2548 (reverse gnus-newsgroup-data)))
2549 gnus-newsgroup-data))
2551 (defun gnus-data-update-list (data offset)
2552 "Add OFFSET to the POS of all data entries in DATA."
2553 (setq gnus-newsgroup-data-reverse nil)
2555 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2556 (setq data (cdr data))))
2558 (defun gnus-summary-article-pseudo-p (article)
2559 "Say whether this article is a pseudo article or not."
2560 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2562 (defmacro gnus-summary-article-sparse-p (article)
2563 "Say whether this article is a sparse article or not."
2564 `(memq ,article gnus-newsgroup-sparse))
2566 (defmacro gnus-summary-article-ancient-p (article)
2567 "Say whether this article is a sparse article or not."
2568 `(memq ,article gnus-newsgroup-ancient))
2570 (defun gnus-article-parent-p (number)
2571 "Say whether this article is a parent or not."
2572 (let ((data (gnus-data-find-list number)))
2573 (and (cdr data) ; There has to be an article after...
2574 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2575 (gnus-data-level (nth 1 data))))))
2577 (defun gnus-article-children (number)
2578 "Return a list of all children to NUMBER."
2579 (let* ((data (gnus-data-find-list number))
2580 (level (gnus-data-level (car data)))
2582 (setq data (cdr data))
2584 (= (gnus-data-level (car data)) (1+ level)))
2585 (push (gnus-data-number (car data)) children)
2586 (setq data (cdr data)))
2589 (defmacro gnus-summary-skip-intangible ()
2590 "If the current article is intangible, then jump to a different article."
2591 '(let ((to (get-text-property (point) 'gnus-intangible)))
2592 (and to (gnus-summary-goto-subject to))))
2594 (defmacro gnus-summary-article-intangible-p ()
2595 "Say whether this article is intangible or not."
2596 '(get-text-property (point) 'gnus-intangible))
2598 (defun gnus-article-read-p (article)
2599 "Say whether ARTICLE is read or not."
2600 (not (or (memq article gnus-newsgroup-marked)
2601 (memq article gnus-newsgroup-unreads)
2602 (memq article gnus-newsgroup-unselected)
2603 (memq article gnus-newsgroup-dormant))))
2605 ;; Some summary mode macros.
2607 (defmacro gnus-summary-article-number ()
2608 "The article number of the article on the current line.
2609 If there isn's an article number here, then we return the current
2612 (gnus-summary-skip-intangible)
2613 (or (get-text-property (point) 'gnus-number)
2614 (gnus-summary-last-subject))))
2616 (defmacro gnus-summary-article-header (&optional number)
2617 "Return the header of article NUMBER."
2618 `(gnus-data-header (gnus-data-find
2619 ,(or number '(gnus-summary-article-number)))))
2621 (defmacro gnus-summary-thread-level (&optional number)
2622 "Return the level of thread that starts with article NUMBER."
2623 `(if (and (eq gnus-summary-make-false-root 'dummy)
2624 (get-text-property (point) 'gnus-intangible))
2626 (gnus-data-level (gnus-data-find
2627 ,(or number '(gnus-summary-article-number))))))
2629 (defmacro gnus-summary-article-mark (&optional number)
2630 "Return the mark of article NUMBER."
2631 `(gnus-data-mark (gnus-data-find
2632 ,(or number '(gnus-summary-article-number)))))
2634 (defmacro gnus-summary-article-pos (&optional number)
2635 "Return the position of the line of article NUMBER."
2636 `(gnus-data-pos (gnus-data-find
2637 ,(or number '(gnus-summary-article-number)))))
2639 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2640 (defmacro gnus-summary-article-subject (&optional number)
2641 "Return current subject string or nil if nothing."
2644 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2645 '(gnus-data-header (assq (gnus-summary-article-number)
2646 gnus-newsgroup-data)))))
2649 (mail-header-subject headers))))
2651 (defmacro gnus-summary-article-score (&optional number)
2652 "Return current article score."
2653 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2654 gnus-newsgroup-scored))
2655 gnus-summary-default-score 0))
2657 (defun gnus-summary-article-children (&optional number)
2658 "Return a list of article numbers that are children of article NUMBER."
2659 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2660 (level (gnus-data-level (car data)))
2662 (while (and (setq data (cdr data))
2663 (> (setq l (gnus-data-level (car data))) level))
2664 (and (= (1+ level) l)
2665 (push (gnus-data-number (car data))
2667 (nreverse children)))
2669 (defun gnus-summary-article-parent (&optional number)
2670 "Return the article number of the parent of article NUMBER."
2671 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2672 (gnus-data-list t)))
2673 (level (gnus-data-level (car data))))
2675 () ; This is a root.
2676 ;; We search until we find an article with a level less than
2677 ;; this one. That function has to be the parent.
2678 (while (and (setq data (cdr data))
2679 (not (< (gnus-data-level (car data)) level))))
2680 (and data (gnus-data-number (car data))))))
2682 (defun gnus-unread-mark-p (mark)
2683 "Say whether MARK is the unread mark."
2684 (= mark gnus-unread-mark))
2686 (defun gnus-read-mark-p (mark)
2687 "Say whether MARK is one of the marks that mark as read.
2688 This is all marks except unread, ticked, dormant, and expirable."
2689 (not (or (= mark gnus-unread-mark)
2690 (= mark gnus-ticked-mark)
2691 (= mark gnus-dormant-mark)
2692 (= mark gnus-expirable-mark))))
2694 (defmacro gnus-article-mark (number)
2695 "Return the MARK of article NUMBER.
2696 This macro should only be used when computing the mark the \"first\"
2697 time; i.e., when generating the summary lines. After that,
2698 `gnus-summary-article-mark' should be used to examine the
2701 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2702 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2703 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2704 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2705 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2706 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2707 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2708 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2709 gnus-ancient-mark))))
2711 ;; Saving hidden threads.
2713 (defmacro gnus-save-hidden-threads (&rest forms)
2714 "Save hidden threads, eval FORMS, and restore the hidden threads."
2715 (let ((config (make-symbol "config")))
2716 `(let ((,config (gnus-hidden-threads-configuration)))
2720 (gnus-restore-hidden-threads-configuration ,config)))))
2721 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2722 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2724 (defun gnus-data-compute-positions ()
2725 "Compute the positions of all articles."
2726 (setq gnus-newsgroup-data-reverse nil)
2727 (let ((data gnus-newsgroup-data))
2729 (gnus-save-hidden-threads
2730 (gnus-summary-show-all-threads)
2731 (goto-char (point-min))
2733 (while (get-text-property (point) 'gnus-intangible)
2735 (gnus-data-set-pos (car data) (+ (point) 3))
2736 (setq data (cdr data))
2737 (forward-line 1))))))
2739 (defun gnus-hidden-threads-configuration ()
2740 "Return the current hidden threads configuration."
2743 (goto-char (point-min))
2744 (while (search-forward "\r" nil t)
2745 (push (1- (point)) config))
2748 (defun gnus-restore-hidden-threads-configuration (config)
2749 "Restore hidden threads configuration from CONFIG."
2751 (let (point buffer-read-only)
2752 (while (setq point (pop config))
2753 (when (and (< point (point-max))
2755 (eq (char-after) ?\n))
2756 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2758 ;; Various summary mode internalish functions.
2760 (defun gnus-mouse-pick-article (e)
2763 (gnus-summary-next-page nil t))
2765 (defun gnus-summary-set-display-table ()
2766 "Change the display table.
2767 Odd characters have a tendency to mess
2768 up nicely formatted displays - we make all possible glyphs
2769 display only a single character."
2771 ;; We start from the standard display table, if any.
2772 (let ((table (or (copy-sequence standard-display-table)
2773 (make-display-table)))
2775 ;; Nix out all the control chars...
2776 (while (>= (setq i (1- i)) 0)
2777 (aset table i [??]))
2778 ;; ... but not newline and cr, of course. (cr is necessary for the
2779 ;; selective display).
2780 (aset table ?\n nil)
2781 (aset table ?\r nil)
2782 ;; We keep TAB as well.
2783 (aset table ?\t nil)
2784 ;; We nix out any glyphs over 126 that are not set already.
2786 (while (>= (setq i (1- i)) 127)
2787 ;; Only modify if the entry is nil.
2788 (unless (aref table i)
2789 (aset table i [??]))))
2790 (setq buffer-display-table table)))
2792 (defun gnus-summary-set-article-display-arrow (pos)
2793 "Update the overlay arrow to point to line at position POS."
2794 (when (and gnus-summary-display-arrow
2795 (boundp 'overlay-arrow-position)
2796 (boundp 'overlay-arrow-string))
2800 (unless overlay-arrow-position
2801 (setq overlay-arrow-position (make-marker)))
2802 (setq overlay-arrow-string "=>"
2803 overlay-arrow-position (set-marker overlay-arrow-position
2805 (current-buffer))))))
2807 (defun gnus-summary-buffer-name (group)
2808 "Return the summary buffer name of GROUP."
2809 (concat "*Summary " (gnus-group-decoded-name group) "*"))
2811 (defun gnus-summary-setup-buffer (group)
2812 "Initialize summary buffer."
2813 (let ((buffer (gnus-summary-buffer-name group)))
2814 (if (get-buffer buffer)
2817 (setq gnus-summary-buffer (current-buffer))
2818 (not gnus-newsgroup-prepared))
2819 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2820 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2821 (gnus-summary-mode group)
2823 (gnus-carpal-setup-buffer 'summary))
2824 (unless gnus-single-article-buffer
2825 (make-local-variable 'gnus-article-buffer)
2826 (make-local-variable 'gnus-article-current)
2827 (make-local-variable 'gnus-original-article-buffer))
2828 (setq gnus-newsgroup-name group)
2829 ;; Set any local variables in the group parameters.
2830 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2833 (defun gnus-set-global-variables ()
2834 "Set the global equivalents of the buffer-local variables.
2835 They are set to the latest values they had. These reflect the summary
2836 buffer that was in action when the last article was fetched."
2837 (when (eq major-mode 'gnus-summary-mode)
2838 (setq gnus-summary-buffer (current-buffer))
2839 (let ((name gnus-newsgroup-name)
2840 (marked gnus-newsgroup-marked)
2841 (unread gnus-newsgroup-unreads)
2842 (headers gnus-current-headers)
2843 (data gnus-newsgroup-data)
2844 (summary gnus-summary-buffer)
2845 (article-buffer gnus-article-buffer)
2846 (original gnus-original-article-buffer)
2847 (gac gnus-article-current)
2848 (reffed gnus-reffed-article-number)
2849 (score-file gnus-current-score-file)
2850 (default-charset gnus-newsgroup-charset)
2852 (let ((locals gnus-newsgroup-variables))
2854 (if (consp (car locals))
2855 (push (eval (caar locals)) vlist)
2856 (push (eval (car locals)) vlist))
2857 (setq locals (cdr locals)))
2858 (setq vlist (nreverse vlist)))
2860 (set-buffer gnus-group-buffer)
2861 (setq gnus-newsgroup-name name
2862 gnus-newsgroup-marked marked
2863 gnus-newsgroup-unreads unread
2864 gnus-current-headers headers
2865 gnus-newsgroup-data data
2866 gnus-article-current gac
2867 gnus-summary-buffer summary
2868 gnus-article-buffer article-buffer
2869 gnus-original-article-buffer original
2870 gnus-reffed-article-number reffed
2871 gnus-current-score-file score-file
2872 gnus-newsgroup-charset default-charset)
2873 (let ((locals gnus-newsgroup-variables))
2875 (if (consp (car locals))
2876 (set (caar locals) (pop vlist))
2877 (set (car locals) (pop vlist)))
2878 (setq locals (cdr locals))))
2879 ;; The article buffer also has local variables.
2880 (when (gnus-buffer-live-p gnus-article-buffer)
2881 (set-buffer gnus-article-buffer)
2882 (setq gnus-summary-buffer summary))))))
2884 (defun gnus-summary-article-unread-p (article)
2885 "Say whether ARTICLE is unread or not."
2886 (memq article gnus-newsgroup-unreads))
2888 (defun gnus-summary-first-article-p (&optional article)
2889 "Return whether ARTICLE is the first article in the buffer."
2890 (if (not (setq article (or article (gnus-summary-article-number))))
2892 (eq article (caar gnus-newsgroup-data))))
2894 (defun gnus-summary-last-article-p (&optional article)
2895 "Return whether ARTICLE is the last article in the buffer."
2896 (if (not (setq article (or article (gnus-summary-article-number))))
2897 ;; All non-existent numbers are the last article. :-)
2899 (not (cdr (gnus-data-find-list article)))))
2901 (defun gnus-make-thread-indent-array ()
2903 (unless (and gnus-thread-indent-array
2904 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2905 (setq gnus-thread-indent-array (make-vector 201 "")
2906 gnus-thread-indent-array-level gnus-thread-indent-level)
2908 (aset gnus-thread-indent-array n
2909 (make-string (* n gnus-thread-indent-level) ? ))
2912 (defun gnus-update-summary-mark-positions ()
2913 "Compute where the summary marks are to go."
2915 (when (gnus-buffer-exists-p gnus-summary-buffer)
2916 (set-buffer gnus-summary-buffer))
2917 (let ((gnus-replied-mark 129)
2918 (gnus-score-below-mark 130)
2919 (gnus-score-over-mark 130)
2920 (gnus-download-mark 131)
2921 (spec gnus-summary-line-format-spec)
2924 (gnus-set-work-buffer)
2925 (let ((gnus-summary-line-format-spec spec)
2926 (gnus-newsgroup-downloadable '((0 . t))))
2927 (gnus-summary-insert-line
2928 (make-full-mail-header 0 "" "nobody"
2929 "05 Apr 2001 23:33:09 +0400"
2931 0 nil 128 t nil "" nil 1)
2932 (goto-char (point-min))
2933 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2935 (goto-char (point-min))
2936 (push (cons 'replied (and (search-forward "\201" nil t)
2939 (goto-char (point-min))
2940 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2942 (goto-char (point-min))
2943 (push (cons 'download
2944 (and (search-forward "\203" nil t) (- (point) 2)))
2946 (setq gnus-summary-mark-positions pos))))
2948 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2949 "Insert a dummy root in the summary buffer."
2951 (gnus-add-text-properties
2952 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2953 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2955 (defun gnus-summary-extract-address-component (from)
2956 (or (car (funcall gnus-extract-address-components from))
2959 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
2960 (let ((default-mime-charset (with-current-buffer gnus-summary-buffer
2961 default-mime-charset)))
2962 ;; Is it really necessary to do this next part for each summary line?
2963 ;; Luckily, doesn't seem to slow things down much.
2965 (and gnus-ignored-from-addresses
2966 (string-match gnus-ignored-from-addresses gnus-tmp-from)
2967 (let ((extra-headers (mail-header-extra header))
2971 ((setq to (cdr (assq 'To extra-headers)))
2973 (gnus-summary-extract-address-component
2974 (funcall gnus-decode-encoded-word-function to))))
2975 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
2976 (concat "=> " newsgroups)))))
2977 (gnus-summary-extract-address-component gnus-tmp-from))))
2979 (defun gnus-summary-insert-line (gnus-tmp-header
2980 gnus-tmp-level gnus-tmp-current
2981 gnus-tmp-unread gnus-tmp-replied
2982 gnus-tmp-expirable gnus-tmp-subject-or-nil
2983 &optional gnus-tmp-dummy gnus-tmp-score
2985 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2986 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2987 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2988 (gnus-tmp-score-char
2989 (if (or (null gnus-summary-default-score)
2990 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2991 gnus-summary-zcore-fuzz))
2993 (if (< gnus-tmp-score gnus-summary-default-score)
2994 gnus-score-below-mark gnus-score-over-mark)))
2995 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2997 (cond (gnus-tmp-process gnus-process-mark)
2998 ((memq gnus-tmp-current gnus-newsgroup-cached)
3000 (gnus-tmp-replied gnus-replied-mark)
3001 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3002 gnus-forwarded-mark)
3003 ((memq gnus-tmp-current gnus-newsgroup-saved)
3005 ((memq gnus-tmp-number gnus-newsgroup-recent)
3007 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3010 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3013 ((string-match "<[^>]+> *$" gnus-tmp-from)
3014 (let ((beg (match-beginning 0)))
3015 (or (and (string-match "^\".+\"" gnus-tmp-from)
3016 (substring gnus-tmp-from 1 (1- (match-end 0))))
3017 (substring gnus-tmp-from 0 beg))))
3018 ((string-match "(.+)" gnus-tmp-from)
3019 (substring gnus-tmp-from
3020 (1+ (match-beginning 0)) (1- (match-end 0))))
3022 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3023 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3024 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3025 (buffer-read-only nil))
3026 (when (string= gnus-tmp-name "")
3027 (setq gnus-tmp-name gnus-tmp-from))
3028 (unless (numberp gnus-tmp-lines)
3029 (setq gnus-tmp-lines -1))
3030 (if (= gnus-tmp-lines -1)
3031 (setq gnus-tmp-lines "?")
3032 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3033 (gnus-put-text-property-excluding-characters-with-faces
3035 (progn (eval gnus-summary-line-format-spec) (point))
3036 'gnus-number gnus-tmp-number)
3037 (when (gnus-visual-p 'summary-highlight 'highlight)
3039 (gnus-run-hooks 'gnus-summary-update-hook)
3042 (defun gnus-summary-update-line (&optional dont-update)
3043 "Update summary line after change."
3044 (when (and gnus-summary-default-score
3045 (not gnus-summary-inhibit-highlight))
3046 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3047 (article (gnus-summary-article-number))
3048 (score (gnus-summary-article-score article)))
3050 (if (and gnus-summary-mark-below
3051 (< (gnus-summary-article-score)
3052 gnus-summary-mark-below))
3053 ;; This article has a low score, so we mark it as read.
3054 (when (memq article gnus-newsgroup-unreads)
3055 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3056 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3057 ;; This article was previously marked as read on account
3058 ;; of a low score, but now it has risen, so we mark it as
3060 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3061 (gnus-summary-update-mark
3062 (if (or (null gnus-summary-default-score)
3063 (<= (abs (- score gnus-summary-default-score))
3064 gnus-summary-zcore-fuzz))
3066 (if (< score gnus-summary-default-score)
3067 gnus-score-below-mark gnus-score-over-mark))
3069 ;; Do visual highlighting.
3070 (when (gnus-visual-p 'summary-highlight 'highlight)
3071 (gnus-run-hooks 'gnus-summary-update-hook)))))
3073 (defvar gnus-tmp-new-adopts nil)
3075 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3076 "Return the number of articles in THREAD.
3077 This may be 0 in some cases -- if none of the articles in
3078 the thread are to be displayed."
3080 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3082 ((not (listp thread))
3084 ((and (consp thread) (cdr thread))
3087 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3090 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3093 (when (and level (zerop level) gnus-tmp-new-adopts)
3096 'gnus-summary-number-of-articles-in-thread
3097 gnus-tmp-new-adopts))))
3099 (if (> number 1) gnus-not-empty-thread-mark
3100 gnus-empty-thread-mark)
3103 (defun gnus-summary-set-local-parameters (group)
3104 "Go through the local params of GROUP and set all variable specs in that list."
3105 (let ((params (gnus-group-find-parameter group))
3106 (vars '(quit-config)) ; Ignore quit-config.
3109 (setq elem (car params)
3110 params (cdr params))
3111 (and (consp elem) ; Has to be a cons.
3112 (consp (cdr elem)) ; The cdr has to be a list.
3113 (symbolp (car elem)) ; Has to be a symbol in there.
3114 (not (memq (car elem) vars))
3115 (ignore-errors ; So we set it.
3116 (push (car elem) vars)
3117 (make-local-variable (car elem))
3118 (set (car elem) (eval (nth 1 elem))))))))
3120 (defun gnus-summary-read-group (group &optional show-all no-article
3121 kill-buffer no-display backward
3123 "Start reading news in newsgroup GROUP.
3124 If SHOW-ALL is non-nil, already read articles are also listed.
3125 If NO-ARTICLE is non-nil, no article is selected initially.
3126 If NO-DISPLAY, don't generate a summary buffer."
3130 (let ((gnus-auto-select-next nil))
3131 (or (gnus-summary-read-group-1
3132 group show-all no-article
3133 kill-buffer no-display
3136 select-articles nil)))))
3137 (eq gnus-auto-select-next 'quietly))
3138 (set-buffer gnus-group-buffer)
3139 ;; The entry function called above goes to the next
3140 ;; group automatically, so we go two groups back
3141 ;; if we are searching for the previous group.
3143 (gnus-group-prev-unread-group 2))
3144 (if (not (equal group (gnus-group-group-name)))
3145 (setq group (gnus-group-group-name))
3149 (defun gnus-summary-jump-to-other-group (group &optional show-all)
3150 "Directly jump to the other GROUP from summary buffer.
3151 If SHOW-ALL is non-nil, already read articles are also listed."
3153 (if (eq gnus-summary-buffer (current-buffer))
3154 (list (completing-read
3155 "Group: " gnus-active-hashtb nil t
3156 (when (and gnus-newsgroup-name
3157 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
3158 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
3159 'gnus-group-history)
3161 (error "%s must be invoked from a gnus summary buffer." this-command)))
3162 (unless (or (zerop (length group))
3163 (and gnus-newsgroup-name
3164 (string-equal gnus-newsgroup-name group)))
3166 (gnus-summary-read-group group show-all
3167 gnus-dont-select-after-jump-to-other-group)))
3169 (defun gnus-summary-read-group-1 (group show-all no-article
3170 kill-buffer no-display
3171 &optional select-articles)
3172 ;; Killed foreign groups can't be entered.
3173 ;; (when (and (not (gnus-group-native-p group))
3174 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3175 ;; (error "Dead non-native groups can't be entered"))
3176 (gnus-message 5 "Retrieving newsgroup: %s..."
3177 (gnus-group-decoded-name group))
3178 (let* ((new-group (gnus-summary-setup-buffer group))
3179 (quit-config (gnus-group-quit-config group))
3180 (did-select (and new-group (gnus-select-newsgroup
3181 group show-all select-articles))))
3183 ;; This summary buffer exists already, so we just select it.
3185 (gnus-set-global-variables)
3187 (gnus-kill-or-deaden-summary kill-buffer))
3188 (gnus-configure-windows 'summary 'force)
3189 (gnus-set-mode-line 'summary)
3190 (gnus-summary-position-point)
3193 ;; We couldn't select this group.
3195 (when (and (eq major-mode 'gnus-summary-mode)
3196 (not (equal (current-buffer) kill-buffer)))
3197 (kill-buffer (current-buffer))
3198 (if (not quit-config)
3200 ;; Update the info -- marks might need to be removed,
3202 (gnus-summary-update-info)
3203 (set-buffer gnus-group-buffer)
3204 (gnus-group-jump-to-group group)
3205 (gnus-group-next-unread-group 1))
3206 (gnus-handle-ephemeral-exit quit-config)))
3207 (let ((grpinfo (gnus-get-info group)))
3208 (if (null (gnus-info-read grpinfo))
3209 (gnus-message 3 "Group %s contains no messages"
3210 (gnus-group-decoded-name group))
3211 (gnus-message 3 "Can't select group")))
3213 ;; The user did a `C-g' while prompting for number of articles,
3214 ;; so we exit this group.
3215 ((eq did-select 'quit)
3216 (and (eq major-mode 'gnus-summary-mode)
3217 (not (equal (current-buffer) kill-buffer))
3218 (kill-buffer (current-buffer)))
3220 (gnus-kill-or-deaden-summary kill-buffer))
3221 (if (not quit-config)
3223 (set-buffer gnus-group-buffer)
3224 (gnus-group-jump-to-group group)
3225 (gnus-group-next-unread-group 1)
3226 (gnus-configure-windows 'group 'force))
3227 (gnus-handle-ephemeral-exit quit-config))
3228 ;; Finally signal the quit.
3230 ;; The group was successfully selected.
3232 (gnus-set-global-variables)
3233 ;; Save the active value in effect when the group was entered.
3234 (setq gnus-newsgroup-active
3236 (gnus-active gnus-newsgroup-name)))
3237 ;; You can change the summary buffer in some way with this hook.
3238 (gnus-run-hooks 'gnus-select-group-hook)
3239 (gnus-update-format-specifications
3240 nil 'summary 'summary-mode 'summary-dummy)
3241 (gnus-update-summary-mark-positions)
3242 ;; Do score processing.
3243 (when gnus-use-scoring
3244 (gnus-possibly-score-headers))
3245 ;; Check whether to fill in the gaps in the threads.
3246 (when gnus-build-sparse-threads
3247 (gnus-build-sparse-threads))
3248 ;; Find the initial limit.
3249 (if gnus-show-threads
3251 (let ((gnus-newsgroup-dormant nil))
3252 (gnus-summary-initial-limit show-all))
3253 (gnus-summary-initial-limit show-all))
3254 ;; When untreaded, all articles are always shown.
3255 (setq gnus-newsgroup-limit
3257 (lambda (header) (mail-header-number header))
3258 gnus-newsgroup-headers)))
3259 ;; Generate the summary buffer.
3261 (gnus-summary-prepare))
3262 (when gnus-use-trees
3263 (gnus-tree-open group)
3264 (setq gnus-summary-highlight-line-function
3265 'gnus-tree-highlight-article))
3266 ;; If the summary buffer is empty, but there are some low-scored
3267 ;; articles or some excluded dormants, we include these in the
3269 (when (and (zerop (buffer-size))
3271 (cond (gnus-newsgroup-dormant
3272 (gnus-summary-limit-include-dormant))
3273 ((and gnus-newsgroup-scored show-all)
3274 (gnus-summary-limit-include-expunged t))))
3275 ;; Function `gnus-apply-kill-file' must be called in this hook.
3276 (gnus-run-hooks 'gnus-apply-kill-hook)
3277 (if (and (zerop (buffer-size))
3280 ;; This newsgroup is empty.
3281 (gnus-summary-catchup-and-exit nil t)
3282 (gnus-message 6 "No unread news")
3284 (gnus-kill-or-deaden-summary kill-buffer))
3285 ;; Return nil from this function.
3287 ;; Hide conversation thread subtrees. We cannot do this in
3288 ;; gnus-summary-prepare-hook since kill processing may not
3289 ;; work with hidden articles.
3290 (and gnus-show-threads
3291 gnus-thread-hide-subtree
3292 (gnus-summary-hide-all-threads))
3294 (gnus-kill-or-deaden-summary kill-buffer))
3295 (gnus-summary-auto-select-subject)
3296 ;; Show first unread article if requested.
3297 (if (and (not no-article)
3299 gnus-newsgroup-unreads
3300 gnus-auto-select-first)
3302 (gnus-configure-windows 'summary)
3303 (gnus-summary-goto-article (gnus-summary-article-number)))
3304 ;; Don't select any articles.
3305 (gnus-summary-position-point)
3306 (gnus-configure-windows 'summary 'force)
3307 (gnus-set-mode-line 'summary))
3308 (when (get-buffer-window gnus-group-buffer t)
3309 ;; Gotta use windows, because recenter does weird stuff if
3310 ;; the current buffer ain't the displayed window.
3311 (let ((owin (selected-window)))
3312 (select-window (get-buffer-window gnus-group-buffer t))
3313 (when (gnus-group-goto-group group)
3315 (select-window owin)))
3316 ;; Mark this buffer as "prepared".
3317 (setq gnus-newsgroup-prepared t)
3318 (gnus-run-hooks 'gnus-summary-prepared-hook)
3321 (defun gnus-summary-auto-select-subject ()
3322 "Select the subject line on initial group entry."
3323 (goto-char (point-min))
3325 ((eq gnus-auto-select-subject 'best)
3326 (gnus-summary-best-unread-subject))
3327 ((eq gnus-auto-select-subject 'unread)
3328 (gnus-summary-first-unread-subject))
3329 ((eq gnus-auto-select-subject 'unseen)
3330 (gnus-summary-first-unseen-subject))
3331 ((eq gnus-auto-select-subject 'first)
3334 ((gnus-functionp gnus-auto-select-subject)
3335 (funcall gnus-auto-select-subject))))
3337 (defun gnus-summary-prepare ()
3338 "Generate the summary buffer."
3340 (let ((buffer-read-only nil))
3342 (setq gnus-newsgroup-data nil
3343 gnus-newsgroup-data-reverse nil)
3344 (gnus-run-hooks 'gnus-summary-generate-hook)
3345 ;; Generate the buffer, either with threads or without.
3346 (when gnus-newsgroup-headers
3347 (gnus-summary-prepare-threads
3348 (if gnus-show-threads
3349 (gnus-sort-gathered-threads
3350 (funcall gnus-summary-thread-gathering-function
3352 (gnus-cut-threads (gnus-make-threads)))))
3353 ;; Unthreaded display.
3354 (gnus-sort-articles gnus-newsgroup-headers))))
3355 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3356 ;; Call hooks for modifying summary buffer.
3357 (goto-char (point-min))
3358 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3360 (defsubst gnus-general-simplify-subject (subject)
3361 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3364 ;; Truncate the subject.
3365 (gnus-simplify-subject-functions
3366 (gnus-map-function gnus-simplify-subject-functions subject))
3367 ((numberp gnus-summary-gather-subject-limit)
3368 (setq subject (gnus-simplify-subject-re subject))
3369 (if (> (length subject) gnus-summary-gather-subject-limit)
3370 (substring subject 0 gnus-summary-gather-subject-limit)
3372 ;; Fuzzily simplify it.
3373 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3374 (gnus-simplify-subject-fuzzy subject))
3375 ;; Just remove the leading "Re:".
3377 (gnus-simplify-subject-re subject))))
3379 (if (and gnus-summary-gather-exclude-subject
3380 (string-match gnus-summary-gather-exclude-subject subject))
3381 nil ; This article shouldn't be gathered
3384 (defun gnus-summary-simplify-subject-query ()
3385 "Query where the respool algorithm would put this article."
3387 (gnus-summary-select-article)
3389 (gnus-general-simplify-subject (gnus-summary-article-subject))))
3391 (defun gnus-gather-threads-by-subject (threads)
3392 "Gather threads by looking at Subject headers."
3393 (if (not gnus-summary-make-false-root)
3395 (let ((hashtb (gnus-make-hashtable 1024))
3398 subject hthread whole-subject)
3400 (setq subject (gnus-general-simplify-subject
3401 (setq whole-subject (mail-header-subject
3404 (if (setq hthread (gnus-gethash subject hashtb))
3406 ;; We enter a dummy root into the thread, if we
3407 ;; haven't done that already.
3408 (unless (stringp (caar hthread))
3409 (setcar hthread (list whole-subject (car hthread))))
3410 ;; We add this new gathered thread to this gathered
3412 (setcdr (car hthread)
3413 (nconc (cdar hthread) (list (car threads))))
3414 ;; Remove it from the list of threads.
3415 (setcdr prev (cdr threads))
3416 (setq threads prev))
3417 ;; Enter this thread into the hash table.
3418 (gnus-sethash subject threads hashtb)))
3420 (setq threads (cdr threads)))
3423 (defun gnus-gather-threads-by-references (threads)
3424 "Gather threads by looking at References headers."
3425 (let ((idhashtb (gnus-make-hashtable 1024))
3426 (thhashtb (gnus-make-hashtable 1024))
3429 ids references id gthread gid entered ref)
3431 (when (setq references (mail-header-references (caar threads)))
3432 (setq id (mail-header-id (caar threads))
3433 ids (gnus-split-references references)
3435 (while (setq ref (pop ids))
3436 (setq ids (delete ref ids))
3437 (if (not (setq gid (gnus-gethash ref idhashtb)))
3439 (gnus-sethash ref id idhashtb)
3440 (gnus-sethash id threads thhashtb))
3441 (setq gthread (gnus-gethash gid thhashtb))
3443 ;; We enter a dummy root into the thread, if we
3444 ;; haven't done that already.
3445 (unless (stringp (caar gthread))
3446 (setcar gthread (list (mail-header-subject (caar gthread))
3448 ;; We add this new gathered thread to this gathered
3450 (setcdr (car gthread)
3451 (nconc (cdar gthread) (list (car threads)))))
3452 ;; Add it into the thread hash table.
3453 (gnus-sethash id gthread thhashtb)
3455 ;; Remove it from the list of threads.
3456 (setcdr prev (cdr threads))
3457 (setq threads prev))))
3459 (setq threads (cdr threads)))
3462 (defun gnus-sort-gathered-threads (threads)
3463 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3464 (let ((result threads))
3466 (when (stringp (caar threads))
3467 (setcdr (car threads)
3468 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3469 (setq threads (cdr threads)))
3472 (defun gnus-thread-loop-p (root thread)
3473 "Say whether ROOT is in THREAD."
3474 (let ((stack (list thread))
3477 (while (setq thread (pop stack))
3478 (setq th (cdr thread))
3480 (not (eq (caar th) root)))
3483 ;; We have found a loop.
3485 (setcdr thread (delq (car th) (cdr thread)))
3486 (if (boundp (setq ref-dep (intern "none"
3487 gnus-newsgroup-dependencies)))
3488 (setcdr (symbol-value ref-dep)
3489 (nconc (cdr (symbol-value ref-dep))
3491 (set ref-dep (list nil (car th))))
3494 ;; Push all the subthreads onto the stack.
3495 (push (cdr thread) stack)))
3498 (defun gnus-make-threads ()
3499 "Go through the dependency hashtb and find the roots. Return all threads."
3501 (while (catch 'infloop
3504 ;; Deal with self-referencing References loops.
3505 (when (and (car (symbol-value refs))
3512 (car (symbol-value refs)) thread))
3513 (cdr (symbol-value refs)))))))
3516 (unless (car (symbol-value refs))
3517 ;; These threads do not refer back to any other articles,
3518 ;; so they're roots.
3519 (setq threads (append (cdr (symbol-value refs)) threads))))
3520 gnus-newsgroup-dependencies)))
3523 ;; Build the thread tree.
3524 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3525 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3527 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3528 if it was already present.
3530 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3531 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3532 Message-IDs will be renamed be renamed to a unique Message-ID before
3535 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3536 (let* ((id (mail-header-id header))
3537 (id-dep (and id (intern id dependencies)))
3538 ref ref-dep ref-header)
3539 ;; Enter this `header' in the `dependencies' table.
3543 ;; The first two cases do the normal part: enter a new `header'
3544 ;; in the `dependencies' table.
3545 ((not (boundp id-dep))
3546 (set id-dep (list header)))
3547 ((null (car (symbol-value id-dep)))
3548 (setcar (symbol-value id-dep) header))
3550 ;; From here the `header' was already present in the
3551 ;; `dependencies' table.
3553 ;; Overrides an existing entry;
3554 ;; just set the header part of the entry.
3555 (setcar (symbol-value id-dep) header))
3557 ;; Renames the existing `header' to a unique Message-ID.
3558 ((not gnus-summary-ignore-duplicates)
3559 ;; An article with this Message-ID has already been seen.
3560 ;; We rename the Message-ID.
3561 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3563 (mail-header-set-id header id))
3565 ;; The last case ignores an existing entry, except it adds any
3566 ;; additional Xrefs (in case the two articles came from different
3568 ;; Also sets `header' to `nil' meaning that the `dependencies'
3569 ;; table was *not* modified.
3571 (mail-header-set-xref
3572 (car (symbol-value id-dep))
3573 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3575 (or (mail-header-xref header) "")))
3579 ;; First check if that we are not creating a References loop.
3580 (setq ref (gnus-parent-id (mail-header-references header)))
3582 (setq ref-dep (intern-soft ref dependencies))
3584 (setq ref-header (car (symbol-value ref-dep))))
3585 (if (string= id ref)
3586 ;; Yuk! This is a reference loop. Make the article be a
3589 (mail-header-set-references (car (symbol-value id-dep)) "none")
3591 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3592 (setq ref (gnus-parent-id (mail-header-references header)))
3593 (setq ref-dep (intern (or ref "none") dependencies))
3594 (if (boundp ref-dep)
3595 (setcdr (symbol-value ref-dep)
3596 (nconc (cdr (symbol-value ref-dep))
3597 (list (symbol-value id-dep))))
3598 (set ref-dep (list nil (symbol-value id-dep)))))
3601 (defun gnus-build-sparse-threads ()
3602 (let ((headers gnus-newsgroup-headers)
3603 (mail-parse-charset gnus-newsgroup-charset)
3604 (gnus-summary-ignore-duplicates t)
3605 header references generation relations
3606 subject child end new-child date)
3607 ;; First we create an alist of generations/relations, where
3608 ;; generations is how much we trust the relation, and the relation
3610 (gnus-message 7 "Making sparse threads...")
3612 (nnheader-set-temp-buffer " *gnus sparse threads*")
3613 (while (setq header (pop headers))
3614 (when (and (setq references (mail-header-references header))
3615 (not (string= references "")))
3617 (setq child (mail-header-id header)
3618 subject (mail-header-subject header)
3619 date (mail-header-date header)
3621 (while (search-backward ">" nil t)
3622 (setq end (1+ (point)))
3623 (when (search-backward "<" nil t)
3624 (setq new-child (buffer-substring (point) end))
3625 (push (list (incf generation)
3626 child (setq child new-child)
3630 (push (list (1+ generation) child nil subject) relations))
3632 (kill-buffer (current-buffer)))
3633 ;; Sort over trustworthiness.
3636 (when (gnus-dependencies-add-header
3637 (make-full-mail-header-from-decoded-header
3638 gnus-reffed-article-number
3639 (nth 3 relation) "" (or (nth 4 relation) "")
3641 (or (nth 2 relation) "") 0 0 "")
3642 gnus-newsgroup-dependencies nil)
3643 (push gnus-reffed-article-number gnus-newsgroup-limit)
3644 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3645 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3646 gnus-newsgroup-reads)
3647 (decf gnus-reffed-article-number)))
3648 (sort relations 'car-less-than-car))
3649 (gnus-message 7 "Making sparse threads...done")))
3651 (defun gnus-build-old-threads ()
3652 ;; Look at all the articles that refer back to old articles, and
3653 ;; fetch the headers for the articles that aren't there. This will
3654 ;; build complete threads - if the roots haven't been expired by the
3656 (let ((mail-parse-charset gnus-newsgroup-charset)
3660 (when (not (car (symbol-value refs)))
3661 (setq heads (cdr (symbol-value refs)))
3663 (if (memq (mail-header-number (caar heads))
3664 gnus-newsgroup-dormant)
3665 (setq heads (cdr heads))
3666 (setq id (symbol-name refs))
3667 (while (and (setq id (gnus-build-get-header id))
3668 (not (car (gnus-id-to-thread id)))))
3669 (setq heads nil)))))
3670 gnus-newsgroup-dependencies)))
3672 ;; This function has to be called with point after the article number
3673 ;; on the beginning of the line.
3674 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3675 (let ((eol (gnus-point-at-eol))
3676 (buffer (current-buffer))
3679 ;; overview: [num subject from date id refs chars lines misc]
3682 (narrow-to-region (point) eol)
3687 (make-full-mail-header
3689 (nnheader-nov-field) ; subject
3690 (nnheader-nov-field) ; from
3691 (nnheader-nov-field) ; date
3692 (nnheader-nov-read-message-id) ; id
3693 (nnheader-nov-field) ; refs
3694 (nnheader-nov-read-integer) ; chars
3695 (nnheader-nov-read-integer) ; lines
3697 (if (looking-at "Xref: ")
3698 (goto-char (match-end 0)))
3699 (nnheader-nov-field)) ; Xref
3700 (nnheader-nov-parse-extra)))) ; extra
3704 (when gnus-alter-header-function
3705 (funcall gnus-alter-header-function header))
3706 (gnus-dependencies-add-header header dependencies force-new)))
3708 (defun gnus-build-get-header (id)
3709 "Look through the buffer of NOV lines and find the header to ID.
3710 Enter this line into the dependencies hash table, and return
3711 the id of the parent article (if any)."
3712 (let ((deps gnus-newsgroup-dependencies)
3716 (set-buffer nntp-server-buffer)
3717 (let ((case-fold-search nil))
3718 (goto-char (point-min))
3719 (while (and (not found)
3720 (search-forward id nil t))
3722 (setq found (looking-at
3723 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3724 (regexp-quote id))))
3725 (or found (beginning-of-line 2)))
3729 (setq header (gnus-nov-parse-line
3730 (read (current-buffer)) deps))
3731 (gnus-parent-id (mail-header-references header))))))
3733 (let ((number (mail-header-number header)))
3734 (push number gnus-newsgroup-limit)
3735 (push header gnus-newsgroup-headers)
3736 (if (memq number gnus-newsgroup-unselected)
3738 (push number gnus-newsgroup-unreads)
3739 (setq gnus-newsgroup-unselected
3740 (delq number gnus-newsgroup-unselected)))
3741 (push number gnus-newsgroup-ancient)))))))
3743 (defun gnus-build-all-threads ()
3744 "Read all the headers."
3745 (let ((gnus-summary-ignore-duplicates t)
3746 (mail-parse-charset gnus-newsgroup-charset)
3747 (dependencies gnus-newsgroup-dependencies)
3750 (set-buffer nntp-server-buffer)
3751 (let ((case-fold-search nil))
3752 (goto-char (point-min))
3755 (setq article (read (current-buffer))
3756 header (gnus-nov-parse-line article dependencies)))
3759 (set-buffer gnus-summary-buffer)
3760 (push header gnus-newsgroup-headers)
3761 (if (memq (setq article (mail-header-number header))
3762 gnus-newsgroup-unselected)
3764 (push article gnus-newsgroup-unreads)
3765 (setq gnus-newsgroup-unselected
3766 (delq article gnus-newsgroup-unselected)))
3767 (push article gnus-newsgroup-ancient)))
3768 (forward-line 1)))))))
3770 (defun gnus-summary-update-article-line (article header)
3771 "Update the line for ARTICLE using HEADERS."
3772 (let* ((id (mail-header-id header))
3773 (thread (gnus-id-to-thread id)))
3775 (error "Article in no thread"))
3776 ;; Update the thread.
3777 (setcar thread header)
3778 (gnus-summary-goto-subject article)
3779 (let* ((datal (gnus-data-find-list article))
3781 (length (when (cdr datal)
3782 (- (gnus-data-pos data)
3783 (gnus-data-pos (cadr datal)))))
3784 (buffer-read-only nil)
3785 (level (gnus-summary-thread-level)))
3787 (gnus-summary-insert-line
3788 header level nil (gnus-article-mark article)
3789 (memq article gnus-newsgroup-replied)
3790 (memq article gnus-newsgroup-expirable)
3791 ;; Only insert the Subject string when it's different
3792 ;; from the previous Subject string.
3797 (mail-header-subject
3800 (gnus-data-find-list
3802 (gnus-data-list t)))))
3803 ;; Error on the side of excessive subjects.
3805 (mail-header-subject header)))
3807 (mail-header-subject header))
3808 nil (cdr (assq article gnus-newsgroup-scored))
3809 (memq article gnus-newsgroup-processable))
3811 (gnus-data-update-list
3812 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3814 (defun gnus-summary-update-article (article &optional iheader)
3815 "Update ARTICLE in the summary buffer."
3816 (set-buffer gnus-summary-buffer)
3817 (let* ((header (gnus-summary-article-header article))
3818 (id (mail-header-id header))
3819 (data (gnus-data-find article))
3820 (thread (gnus-id-to-thread id))
3821 (references (mail-header-references header))
3825 (when (and references
3826 (not (equal "" references)))
3829 (buffer-read-only nil)
3835 (delq thread parent)))
3836 (if (gnus-summary-insert-subject id header)
3837 ;; Set the (possibly) new article number in the data structure.
3838 (gnus-data-set-number data (gnus-id-to-article id))
3842 (defun gnus-rebuild-thread (id &optional line)
3843 "Rebuild the thread containing ID.
3844 If LINE, insert the rebuilt thread starting on line LINE."
3845 (let ((buffer-read-only nil)
3846 old-pos current thread data)
3847 (if (not gnus-show-threads)
3848 (setq thread (list (car (gnus-id-to-thread id))))
3849 ;; Get the thread this article is part of.
3850 (setq thread (gnus-remove-thread id)))
3851 (setq old-pos (gnus-point-at-bol))
3852 (setq current (save-excursion
3853 (and (re-search-backward "[\r\n]" nil t)
3854 (gnus-summary-article-number))))
3855 ;; If this is a gathered thread, we have to go some re-gathering.
3856 (when (stringp (car thread))
3857 (let ((subject (car thread))
3859 (setq thread (cdr thread))
3861 (unless (memq (setq thr (gnus-id-to-thread
3863 (mail-header-id (caar thread)))))
3866 (setq thread (cdr thread)))
3867 ;; We now have all (unique) roots.
3868 (if (= (length roots) 1)
3869 ;; All the loose roots are now one solid root.
3870 (setq thread (car roots))
3871 (setq thread (cons subject (gnus-sort-threads roots))))))
3873 ;; We then insert this thread into the summary buffer.
3875 (goto-char (point-min))
3876 (forward-line (1- line)))
3877 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3878 (if gnus-show-threads
3879 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3880 (gnus-summary-prepare-unthreaded thread))
3881 (setq data (nreverse gnus-newsgroup-data))
3882 (setq threads gnus-newsgroup-threads))
3883 ;; We splice the new data into the data structure.
3884 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3885 ;;!!! then we want to insert at the beginning of the buffer.
3886 ;;!!! That happens to be true with Gnus now, but that may
3887 ;;!!! change in the future. Perhaps.
3888 (gnus-data-enter-list
3889 (if line nil current) data (- (point) old-pos))
3890 (setq gnus-newsgroup-threads
3891 (nconc threads gnus-newsgroup-threads))
3892 (gnus-data-compute-positions))))
3894 (defun gnus-number-to-header (number)
3895 "Return the header for article NUMBER."
3896 (let ((headers gnus-newsgroup-headers))
3898 (not (= number (mail-header-number (car headers)))))
3903 (defun gnus-parent-headers (in-headers &optional generation)
3904 "Return the headers of the GENERATIONeth parent of HEADERS."
3906 (setq generation 1))
3908 (headers in-headers)
3911 (not (zerop generation))
3912 (setq references (mail-header-references headers)))
3913 (setq headers (if (and references
3914 (setq parent (gnus-parent-id references)))
3915 (car (gnus-id-to-thread parent))
3918 (and (not (eq headers in-headers))
3921 (defun gnus-id-to-thread (id)
3922 "Return the (sub-)thread where ID appears."
3923 (gnus-gethash id gnus-newsgroup-dependencies))
3925 (defun gnus-id-to-article (id)
3926 "Return the article number of ID."
3927 (let ((thread (gnus-id-to-thread id)))
3930 (mail-header-number (car thread)))))
3932 (defun gnus-id-to-header (id)
3933 "Return the article headers of ID."
3934 (car (gnus-id-to-thread id)))
3936 (defun gnus-article-displayed-root-p (article)
3937 "Say whether ARTICLE is a root(ish) article."
3938 (let ((level (gnus-summary-thread-level article))
3939 (refs (mail-header-references (gnus-summary-article-header article)))
3945 ((null (gnus-parent-id refs)) t)
3947 (null (setq particle (gnus-id-to-article
3948 (gnus-parent-id refs))))
3949 (null (gnus-summary-thread-level particle)))))))
3951 (defun gnus-root-id (id)
3952 "Return the id of the root of the thread where ID appears."
3954 (while (and id (setq prev (car (gnus-id-to-thread id))))
3956 id (gnus-parent-id (mail-header-references prev))))
3959 (defun gnus-articles-in-thread (thread)
3960 "Return the list of articles in THREAD."
3961 (cons (mail-header-number (car thread))
3962 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3964 (defun gnus-remove-thread (id &optional dont-remove)
3965 "Remove the thread that has ID in it."
3966 (let (headers thread last-id)
3967 ;; First go up in this thread until we find the root.
3968 (setq last-id (gnus-root-id id)
3969 headers (message-flatten-list (gnus-id-to-thread last-id)))
3970 ;; We have now found the real root of this thread. It might have
3971 ;; been gathered into some loose thread, so we have to search
3972 ;; through the threads to find the thread we wanted.
3973 (let ((threads gnus-newsgroup-threads)
3976 (setq sub (car threads))
3977 (if (stringp (car sub))
3978 ;; This is a gathered thread, so we look at the roots
3979 ;; below it to find whether this article is in this
3982 (setq sub (cdr sub))
3984 (when (member (caar sub) headers)
3985 (setq thread (car threads)
3988 (setq sub (cdr sub))))
3989 ;; It's an ordinary thread, so we check it.
3990 (when (eq (car sub) (car headers))
3993 (setq threads (cdr threads)))
3994 ;; If this article is in no thread, then it's a root.
3997 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3998 (setq thread (gnus-id-to-thread last-id)))
4001 thread ; We return this thread.
4003 (if (stringp (car thread))
4005 ;; If we use dummy roots, then we have to remove the
4006 ;; dummy root as well.
4007 (when (eq gnus-summary-make-false-root 'dummy)
4008 ;; We go to the dummy root by going to
4009 ;; the first sub-"thread", and then one line up.
4010 (gnus-summary-goto-article
4011 (mail-header-number (caadr thread)))
4014 (gnus-data-compute-positions))
4015 (setq thread (cdr thread))
4017 (gnus-remove-thread-1 (car thread))
4018 (setq thread (cdr thread))))
4019 (gnus-remove-thread-1 thread))))))))
4021 (defun gnus-remove-thread-1 (thread)
4022 "Remove the thread THREAD recursively."
4023 (let ((number (mail-header-number (pop thread)))
4025 (setq thread (reverse thread))
4027 (gnus-remove-thread-1 (pop thread)))
4028 (when (setq d (gnus-data-find number))
4029 (goto-char (gnus-data-pos d))
4030 (gnus-summary-show-thread)
4033 (- (gnus-point-at-bol)
4035 (1+ (gnus-point-at-eol))
4036 (gnus-delete-line)))))))
4038 (defun gnus-sort-threads-1 (threads func)
4039 (sort (mapcar (lambda (thread)
4042 (gnus-sort-threads-1 (cdr thread) func))))
4045 (defun gnus-sort-threads (threads)
4047 (if (not gnus-thread-sort-functions)
4049 (gnus-message 8 "Sorting threads...")
4051 (gnus-sort-threads-1
4053 (gnus-make-sort-function gnus-thread-sort-functions))
4054 (gnus-message 8 "Sorting threads...done"))))
4056 (defun gnus-sort-articles (articles)
4058 (when gnus-article-sort-functions
4059 (gnus-message 7 "Sorting articles...")
4061 (setq gnus-newsgroup-headers
4062 (sort articles (gnus-make-sort-function
4063 gnus-article-sort-functions)))
4064 (gnus-message 7 "Sorting articles...done"))))
4066 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4067 (defmacro gnus-thread-header (thread)
4068 "Return header of first article in THREAD.
4069 Note that THREAD must never, ever be anything else than a variable -
4070 using some other form will lead to serious barfage."
4071 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4072 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4073 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4076 (defsubst gnus-article-sort-by-number (h1 h2)
4077 "Sort articles by article number."
4078 (< (mail-header-number h1)
4079 (mail-header-number h2)))
4081 (defun gnus-thread-sort-by-number (h1 h2)
4082 "Sort threads by root article number."
4083 (gnus-article-sort-by-number
4084 (gnus-thread-header h1) (gnus-thread-header h2)))
4086 (defsubst gnus-article-sort-by-lines (h1 h2)
4087 "Sort articles by article Lines header."
4088 (< (mail-header-lines h1)
4089 (mail-header-lines h2)))
4091 (defun gnus-thread-sort-by-lines (h1 h2)
4092 "Sort threads by root article Lines header."
4093 (gnus-article-sort-by-lines
4094 (gnus-thread-header h1) (gnus-thread-header h2)))
4096 (defsubst gnus-article-sort-by-chars (h1 h2)
4097 "Sort articles by octet length."
4098 (< (mail-header-chars h1)
4099 (mail-header-chars h2)))
4101 (defun gnus-thread-sort-by-chars (h1 h2)
4102 "Sort threads by root article octet length."
4103 (gnus-article-sort-by-chars
4104 (gnus-thread-header h1) (gnus-thread-header h2)))
4106 (defsubst gnus-article-sort-by-author (h1 h2)
4107 "Sort articles by root author."
4109 (let ((addr (car (mime-entity-read-field h1 'From))))
4110 (or (std11-full-name-string addr)
4111 (std11-address-string addr)
4113 (let ((addr (car (mime-entity-read-field h2 'From))))
4114 (or (std11-full-name-string addr)
4115 (std11-address-string addr)
4119 (defun gnus-thread-sort-by-author (h1 h2)
4120 "Sort threads by root author."
4121 (gnus-article-sort-by-author
4122 (gnus-thread-header h1) (gnus-thread-header h2)))
4124 (defsubst gnus-article-sort-by-subject (h1 h2)
4125 "Sort articles by root subject."
4127 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4128 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4130 (defun gnus-thread-sort-by-subject (h1 h2)
4131 "Sort threads by root subject."
4132 (gnus-article-sort-by-subject
4133 (gnus-thread-header h1) (gnus-thread-header h2)))
4135 (defsubst gnus-article-sort-by-date (h1 h2)
4136 "Sort articles by root article date."
4138 (gnus-date-get-time (mail-header-date h1))
4139 (gnus-date-get-time (mail-header-date h2))))
4141 (defun gnus-thread-sort-by-date (h1 h2)
4142 "Sort threads by root article date."
4143 (gnus-article-sort-by-date
4144 (gnus-thread-header h1) (gnus-thread-header h2)))
4146 (defsubst gnus-article-sort-by-score (h1 h2)
4147 "Sort articles by root article score.
4148 Unscored articles will be counted as having a score of zero."
4149 (> (or (cdr (assq (mail-header-number h1)
4150 gnus-newsgroup-scored))
4151 gnus-summary-default-score 0)
4152 (or (cdr (assq (mail-header-number h2)
4153 gnus-newsgroup-scored))
4154 gnus-summary-default-score 0)))
4156 (defun gnus-thread-sort-by-score (h1 h2)
4157 "Sort threads by root article score."
4158 (gnus-article-sort-by-score
4159 (gnus-thread-header h1) (gnus-thread-header h2)))
4161 (defun gnus-thread-sort-by-total-score (h1 h2)
4162 "Sort threads by the sum of all scores in the thread.
4163 Unscored articles will be counted as having a score of zero."
4164 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4166 (defun gnus-thread-total-score (thread)
4167 ;; This function find the total score of THREAD.
4168 (cond ((null thread)
4171 (if (stringp (car thread))
4172 (apply gnus-thread-score-function 0
4173 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4174 (gnus-thread-total-score-1 thread)))
4176 (gnus-thread-total-score-1 (list thread)))))
4178 (defun gnus-thread-total-score-1 (root)
4179 ;; This function find the total score of the thread below ROOT.
4180 (setq root (car root))
4181 (apply gnus-thread-score-function
4183 (mapcar 'gnus-thread-total-score
4184 (cdr (gnus-id-to-thread (mail-header-id root))))
4185 (when (> (mail-header-number root) 0)
4186 (list (or (cdr (assq (mail-header-number root)
4187 gnus-newsgroup-scored))
4188 gnus-summary-default-score 0))))
4189 (list gnus-summary-default-score)
4192 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4193 (defvar gnus-tmp-prev-subject nil)
4194 (defvar gnus-tmp-false-parent nil)
4195 (defvar gnus-tmp-root-expunged nil)
4196 (defvar gnus-tmp-dummy-line nil)
4198 (eval-when-compile (defvar gnus-tmp-header))
4199 (defun gnus-extra-header (type &optional header)
4200 "Return the extra header of TYPE."
4201 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4204 (defvar gnus-tmp-thread-tree-header-string "")
4206 (defvar gnus-sum-thread-tree-root "> "
4207 "With %B spec, used for the root of a thread.
4208 If nil, use subject instead.")
4209 (defvar gnus-sum-thread-tree-single-indent ""
4210 "With %B spec, used for a thread with just one message.
4211 If nil, use subject instead.")
4212 (defvar gnus-sum-thread-tree-vertical "| "
4213 "With %B spec, used for drawing a vertical line.")
4214 (defvar gnus-sum-thread-tree-indent " "
4215 "With %B spec, used for indenting.")
4216 (defvar gnus-sum-thread-tree-leaf-with-other "+-> "
4217 "With %B spec, used for a leaf with brothers.")
4218 (defvar gnus-sum-thread-tree-single-leaf "\\-> "
4219 "With %B spec, used for a leaf without brothers.")
4221 (defun gnus-summary-prepare-threads (threads)
4222 "Prepare summary buffer from THREADS and indentation LEVEL.
4223 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4224 or a straight list of headers."
4225 (gnus-message 7 "Generating summary...")
4227 (setq gnus-newsgroup-threads threads)
4230 (let ((gnus-tmp-level 0)
4231 (default-score (or gnus-summary-default-score 0))
4232 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4233 thread number subject stack state gnus-tmp-gathered beg-match
4234 new-roots gnus-tmp-new-adopts thread-end
4235 gnus-tmp-header gnus-tmp-unread
4236 gnus-tmp-replied gnus-tmp-subject-or-nil
4237 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4238 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4239 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4242 (setq gnus-tmp-prev-subject nil)
4244 (if (vectorp (car threads))
4245 ;; If this is a straight (sic) list of headers, then a
4246 ;; threaded summary display isn't required, so we just create
4247 ;; an unthreaded one.
4248 (gnus-summary-prepare-unthreaded threads)
4250 ;; Do the threaded display.
4252 (while (or threads stack gnus-tmp-new-adopts new-roots)
4254 (if (and (= gnus-tmp-level 0)
4257 (not gnus-tmp-false-parent)
4258 (or gnus-tmp-new-adopts new-roots))
4259 (if gnus-tmp-new-adopts
4260 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4261 thread (list (car gnus-tmp-new-adopts))
4262 gnus-tmp-header (caar thread)
4263 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4265 (setq thread (list (car new-roots))
4266 gnus-tmp-header (caar thread)
4267 new-roots (cdr new-roots))))
4270 ;; If there are some threads, we do them before the
4271 ;; threads on the stack.
4272 (setq thread threads
4273 gnus-tmp-header (caar thread))
4274 ;; There were no current threads, so we pop something off
4276 (setq state (car stack)
4277 gnus-tmp-level (car state)
4278 tree-stack (cadr state)
4279 thread (caddr state)
4281 gnus-tmp-header (caar thread))))
4283 (setq gnus-tmp-false-parent nil)
4284 (setq gnus-tmp-root-expunged nil)
4285 (setq thread-end nil)
4287 (if (stringp gnus-tmp-header)
4288 ;; The header is a dummy root.
4290 ((eq gnus-summary-make-false-root 'adopt)
4291 ;; We let the first article adopt the rest.
4292 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4294 (setq gnus-tmp-gathered
4296 (lambda (h) (mail-header-number (car h)))
4299 (setq thread (cons (list (caar thread)
4302 (setq gnus-tmp-level -1
4303 gnus-tmp-false-parent t))
4304 ((eq gnus-summary-make-false-root 'empty)
4305 ;; We print adopted articles with empty subject fields.
4306 (setq gnus-tmp-gathered
4308 (lambda (h) (mail-header-number (car h)))
4311 (setq gnus-tmp-level -1))
4312 ((eq gnus-summary-make-false-root 'dummy)
4313 ;; We remember that we probably want to output a dummy
4315 (setq gnus-tmp-dummy-line gnus-tmp-header)
4316 (setq gnus-tmp-prev-subject gnus-tmp-header))
4318 ;; We do not make a root for the gathered
4319 ;; sub-threads at all.
4320 (setq gnus-tmp-level -1)))
4322 (setq number (mail-header-number gnus-tmp-header)
4323 subject (mail-header-subject gnus-tmp-header))
4326 ;; If the thread has changed subject, we might want to make
4327 ;; this subthread into a root.
4328 ((and (null gnus-thread-ignore-subject)
4329 (not (zerop gnus-tmp-level))
4330 gnus-tmp-prev-subject
4332 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4333 (setq new-roots (nconc new-roots (list (car thread)))
4335 gnus-tmp-header nil))
4336 ;; If the article lies outside the current limit,
4337 ;; then we do not display it.
4338 ((not (memq number gnus-newsgroup-limit))
4339 (setq gnus-tmp-gathered
4341 (lambda (h) (mail-header-number (car h)))
4344 (setq gnus-tmp-new-adopts (if (cdar thread)
4345 (append gnus-tmp-new-adopts
4347 gnus-tmp-new-adopts)
4349 gnus-tmp-header nil)
4350 (when (zerop gnus-tmp-level)
4351 (setq gnus-tmp-root-expunged t)))
4352 ;; Perhaps this article is to be marked as read?
4353 ((and gnus-summary-mark-below
4354 (< (or (cdr (assq number gnus-newsgroup-scored))
4356 gnus-summary-mark-below)
4357 ;; Don't touch sparse articles.
4358 (not (gnus-summary-article-sparse-p number))
4359 (not (gnus-summary-article-ancient-p number)))
4360 (setq gnus-newsgroup-unreads
4361 (delq number gnus-newsgroup-unreads))
4362 (if gnus-newsgroup-auto-expire
4363 (push number gnus-newsgroup-expirable)
4364 (push (cons number gnus-low-score-mark)
4365 gnus-newsgroup-reads))))
4367 (when gnus-tmp-header
4368 ;; We may have an old dummy line to output before this
4370 (when (and gnus-tmp-dummy-line
4373 (mail-header-subject gnus-tmp-header)))
4374 (gnus-summary-insert-dummy-line
4375 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4376 (setq gnus-tmp-dummy-line nil))
4378 ;; Compute the mark.
4379 (setq gnus-tmp-unread (gnus-article-mark number))
4381 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4382 gnus-tmp-header gnus-tmp-level)
4383 gnus-newsgroup-data)
4385 ;; Actually insert the line.
4387 gnus-tmp-subject-or-nil
4389 ((and gnus-thread-ignore-subject
4390 gnus-tmp-prev-subject
4391 (not (inline (gnus-subject-equal
4392 gnus-tmp-prev-subject subject))))
4394 ((zerop gnus-tmp-level)
4395 (if (and (eq gnus-summary-make-false-root 'empty)
4396 (memq number gnus-tmp-gathered)
4397 gnus-tmp-prev-subject
4398 (inline (gnus-subject-equal
4399 gnus-tmp-prev-subject subject)))
4400 gnus-summary-same-subject
4402 (t gnus-summary-same-subject)))
4403 (if (and (eq gnus-summary-make-false-root 'adopt)
4404 (= gnus-tmp-level 1)
4405 (memq number gnus-tmp-gathered))
4406 (setq gnus-tmp-opening-bracket ?\<
4407 gnus-tmp-closing-bracket ?\>)
4408 (setq gnus-tmp-opening-bracket ?\[
4409 gnus-tmp-closing-bracket ?\]))
4411 gnus-tmp-indentation
4412 (aref gnus-thread-indent-array gnus-tmp-level)
4413 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4414 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4415 gnus-summary-default-score 0)
4417 (if (or (null gnus-summary-default-score)
4418 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4419 gnus-summary-zcore-fuzz))
4421 (if (< gnus-tmp-score gnus-summary-default-score)
4422 gnus-score-below-mark gnus-score-over-mark))
4424 (cond ((memq number gnus-newsgroup-processable)
4426 ((memq number gnus-newsgroup-cached)
4428 ((memq number gnus-newsgroup-replied)
4430 ((memq number gnus-newsgroup-forwarded)
4431 gnus-forwarded-mark)
4432 ((memq number gnus-newsgroup-saved)
4434 ((memq number gnus-newsgroup-recent)
4436 ((memq number gnus-newsgroup-unseen)
4439 gnus-tmp-from (mail-header-from gnus-tmp-header)
4442 ((string-match "<[^>]+> *$" gnus-tmp-from)
4443 (setq beg-match (match-beginning 0))
4444 (or (and (string-match "^\".+\"" gnus-tmp-from)
4445 (substring gnus-tmp-from 1 (1- (match-end 0))))
4446 (substring gnus-tmp-from 0 beg-match)))
4447 ((string-match "(.+)" gnus-tmp-from)
4448 (substring gnus-tmp-from
4449 (1+ (match-beginning 0)) (1- (match-end 0))))
4451 gnus-tmp-thread-tree-header-string
4453 ((not gnus-show-threads) "")
4454 ((zerop gnus-tmp-level)
4456 (or gnus-sum-thread-tree-root subject)
4457 (or gnus-sum-thread-tree-single-indent subject)))
4459 (concat (apply 'concat
4460 (mapcar (lambda (item)
4462 gnus-sum-thread-tree-vertical
4463 gnus-sum-thread-tree-indent))
4464 (cdr (reverse tree-stack))))
4466 gnus-sum-thread-tree-leaf-with-other
4467 gnus-sum-thread-tree-single-leaf)))))
4468 (when (string= gnus-tmp-name "")
4469 (setq gnus-tmp-name gnus-tmp-from))
4470 (unless (numberp gnus-tmp-lines)
4471 (setq gnus-tmp-lines -1))
4472 (if (= gnus-tmp-lines -1)
4473 (setq gnus-tmp-lines "?")
4474 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4475 (gnus-put-text-property
4477 (progn (eval gnus-summary-line-format-spec) (point))
4478 'gnus-number number)
4481 (gnus-run-hooks 'gnus-summary-update-hook)
4484 (setq gnus-tmp-prev-subject subject)))
4486 (when (nth 1 thread)
4487 (push (list (max 0 gnus-tmp-level)
4488 (copy-list tree-stack)
4491 (push (if (nth 1 thread) 1 0) tree-stack)
4492 (incf gnus-tmp-level)
4493 (setq threads (if thread-end nil (cdar thread)))
4495 (setq gnus-tmp-level 0)))))
4496 (gnus-message 7 "Generating summary...done"))
4498 (defun gnus-summary-prepare-unthreaded (headers)
4499 "Generate an unthreaded summary buffer based on HEADERS."
4500 (let (header number mark)
4505 ;; We may have to root out some bad articles...
4506 (when (memq (setq number (mail-header-number
4507 (setq header (pop headers))))
4508 gnus-newsgroup-limit)
4509 ;; Mark article as read when it has a low score.
4510 (when (and gnus-summary-mark-below
4511 (< (or (cdr (assq number gnus-newsgroup-scored))
4512 gnus-summary-default-score 0)
4513 gnus-summary-mark-below)
4514 (not (gnus-summary-article-ancient-p number)))
4515 (setq gnus-newsgroup-unreads
4516 (delq number gnus-newsgroup-unreads))
4517 (if gnus-newsgroup-auto-expire
4518 (push number gnus-newsgroup-expirable)
4519 (push (cons number gnus-low-score-mark)
4520 gnus-newsgroup-reads)))
4522 (setq mark (gnus-article-mark number))
4523 (push (gnus-data-make number mark (1+ (point)) header 0)
4524 gnus-newsgroup-data)
4525 (gnus-summary-insert-line
4527 mark (memq number gnus-newsgroup-replied)
4528 (memq number gnus-newsgroup-expirable)
4529 (mail-header-subject header) nil
4530 (cdr (assq number gnus-newsgroup-scored))
4531 (memq number gnus-newsgroup-processable))))))
4533 (defun gnus-summary-remove-list-identifiers ()
4534 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4535 (let ((regexp (if (consp gnus-list-identifiers)
4536 (mapconcat 'identity gnus-list-identifiers " *\\|")
4537 gnus-list-identifiers))
4540 (dolist (header gnus-newsgroup-headers)
4541 (setq subject (mail-header-subject header)
4543 (while (string-match
4544 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4547 (concat (substring subject 0 (match-beginning 2))
4548 (substring subject (match-end 0)))
4552 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4554 (concat (substring subject 0 (match-beginning 1))
4555 (substring subject (match-end 1)))))
4557 (mail-header-set-subject header subject))))))
4559 (defun gnus-fetch-headers (articles)
4560 "Fetch headers of ARTICLES."
4561 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4562 (gnus-message 5 "Fetching headers for %s..." name)
4565 (setq gnus-headers-retrieved-by
4566 (gnus-retrieve-headers
4567 articles gnus-newsgroup-name
4568 ;; We might want to fetch old headers, but
4569 ;; not if there is only 1 article.
4571 (not (eq gnus-fetch-old-headers 'some))
4572 (not (numberp gnus-fetch-old-headers)))
4573 (> (length articles) 1))
4574 gnus-fetch-old-headers))))
4575 (gnus-get-newsgroup-headers-xover
4576 articles nil nil gnus-newsgroup-name t)
4577 (gnus-get-newsgroup-headers))
4578 (gnus-message 5 "Fetching headers for %s...done" name))))
4580 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4581 "Select newsgroup GROUP.
4582 If READ-ALL is non-nil, all articles in the group are selected.
4583 If SELECT-ARTICLES, only select those articles from GROUP."
4584 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4585 ;;!!! Dirty hack; should be removed.
4586 (gnus-summary-ignore-duplicates
4587 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4589 gnus-summary-ignore-duplicates))
4590 (info (nth 2 entry))
4591 articles fetched-articles cached)
4593 (unless (gnus-check-server
4594 (set (make-local-variable 'gnus-current-select-method)
4595 (gnus-find-method-for-group group)))
4596 (error "Couldn't open server"))
4598 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4599 (gnus-activate-group group) ; Or we can activate it...
4600 (progn ; Or we bug out.
4601 (when (equal major-mode 'gnus-summary-mode)
4602 (kill-buffer (current-buffer)))
4603 (error "Couldn't activate group %s: %s"
4604 group (gnus-status-message group))))
4606 (unless (gnus-request-group group t)
4607 (when (equal major-mode 'gnus-summary-mode)
4608 (kill-buffer (current-buffer)))
4609 (error "Couldn't request group %s: %s"
4610 group (gnus-status-message group)))
4612 (setq gnus-newsgroup-name group
4613 gnus-newsgroup-unselected nil
4614 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4616 (let ((display (gnus-group-find-parameter group 'display)))
4617 (setq gnus-newsgroup-display
4619 ((not (zerop (or (car-safe read-all) 0)))
4620 ;; The user entered the group with C-u SPC/RET, let's show
4626 (gnus-summary-display-make-predicate (mapcar 'identity display)))
4628 ;; The following is probably the "correct" solution, but
4629 ;; it makes Gnus fetch all headers and then limit the
4630 ;; articles (which is slow), so instead we hack the
4631 ;; select-articles parameter instead. -- Simon Josefsson
4634 ;; (gnus-byte-compile
4635 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
4637 (setq select-articles
4638 (gnus-uncompress-range
4639 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
4643 (cdr (gnus-active group)))))
4648 (gnus-summary-setup-default-charset)
4650 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4651 (when (gnus-virtual-group-p group)
4652 (setq cached gnus-newsgroup-cached))
4654 (setq gnus-newsgroup-unreads
4655 (gnus-set-difference
4656 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4657 gnus-newsgroup-dormant))
4659 (setq gnus-newsgroup-processable nil)
4661 (gnus-update-read-articles group gnus-newsgroup-unreads)
4663 ;; Adjust and set lists of article marks.
4665 (gnus-adjust-marked-articles info))
4667 (if (setq articles select-articles)
4668 (setq gnus-newsgroup-unselected
4669 (gnus-sorted-intersection
4670 gnus-newsgroup-unreads
4671 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4672 (setq articles (gnus-articles-to-read group read-all)))
4676 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4678 ((eq articles 0) nil)
4680 ;; Init the dependencies hash table.
4681 (setq gnus-newsgroup-dependencies
4682 (gnus-make-hashtable (length articles)))
4683 (gnus-set-global-variables)
4684 ;; Retrieve the headers and read them in.
4685 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
4687 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4689 (setq gnus-newsgroup-cached cached))
4691 ;; Suppress duplicates?
4692 (when gnus-suppress-duplicates
4693 (gnus-dup-suppress-articles))
4695 ;; Set the initial limit.
4696 (setq gnus-newsgroup-limit (copy-sequence articles))
4697 ;; Remove canceled articles from the list of unread articles.
4698 (setq fetched-articles
4699 (mapcar (lambda (headers) (mail-header-number headers))
4700 gnus-newsgroup-headers))
4701 (setq gnus-newsgroup-articles fetched-articles)
4702 (setq gnus-newsgroup-unreads
4703 (gnus-set-sorted-intersection
4704 gnus-newsgroup-unreads fetched-articles))
4706 ;; The `seen' marks are treated specially.
4707 (if (not gnus-newsgroup-seen)
4708 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
4709 (dolist (article gnus-newsgroup-articles)
4710 (unless (gnus-member-of-range article gnus-newsgroup-seen)
4711 (push article gnus-newsgroup-unseen)))
4712 (setq gnus-newsgroup-unseen (nreverse gnus-newsgroup-unseen)))
4714 ;; Removed marked articles that do not exist.
4715 (gnus-update-missing-marks
4716 (gnus-sorted-complement fetched-articles articles))
4717 ;; We might want to build some more threads first.
4718 (when (and gnus-fetch-old-headers
4719 (eq gnus-headers-retrieved-by 'nov))
4720 (if (eq gnus-fetch-old-headers 'invisible)
4721 (gnus-build-all-threads)
4722 (gnus-build-old-threads)))
4723 ;; Let the Gnus agent mark articles as read.
4725 (gnus-agent-get-undownloaded-list))
4726 ;; Remove list identifiers from subject
4727 (when gnus-list-identifiers
4728 (gnus-summary-remove-list-identifiers))
4729 ;; Check whether auto-expire is to be done in this group.
4730 (setq gnus-newsgroup-auto-expire
4731 (gnus-group-auto-expirable-p group))
4732 ;; Set up the article buffer now, if necessary.
4733 (unless gnus-single-article-buffer
4734 (gnus-article-setup-buffer))
4735 ;; First and last article in this newsgroup.
4736 (when gnus-newsgroup-headers
4737 (setq gnus-newsgroup-begin
4738 (mail-header-number (car gnus-newsgroup-headers))
4741 (gnus-last-element gnus-newsgroup-headers))))
4742 ;; GROUP is successfully selected.
4743 (or gnus-newsgroup-headers t)))))
4745 (defun gnus-summary-display-make-predicate (display)
4746 (require 'gnus-agent)
4747 (when (= (length display) 1)
4748 (setq display (car display)))
4749 (unless gnus-summary-display-cache
4750 (dolist (elem (append (list (cons 'read 'read)
4751 (cons 'unseen 'unseen))
4752 gnus-article-mark-lists))
4753 (push (cons (cdr elem)
4755 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
4756 gnus-summary-display-cache)))
4757 (let ((gnus-category-predicate-alist gnus-summary-display-cache))
4758 (gnus-get-predicate display)))
4760 ;; Uses the dynamically bound `number' variable.
4762 (defun gnus-article-marked-p (type &optional article)
4763 (let ((article (or article number)))
4766 (memq article gnus-newsgroup-marked))
4768 (memq article gnus-newsgroup-unsendable))
4769 ((eq type 'undownload)
4770 (memq article gnus-newsgroup-undownloaded))
4771 ((eq type 'download)
4772 (memq article gnus-newsgroup-downloadable))
4774 (memq article gnus-newsgroup-unreads))
4776 (memq article gnus-newsgroup-reads))
4778 (memq article gnus-newsgroup-dormant) )
4780 (memq article gnus-newsgroup-expirable))
4782 (memq article gnus-newsgroup-replied))
4784 (memq article gnus-newsgroup-killed))
4785 ((eq type 'bookmark)
4786 (assq article gnus-newsgroup-bookmarks))
4788 (assq article gnus-newsgroup-scored))
4790 (memq article gnus-newsgroup-saved))
4792 (memq article gnus-newsgroup-cached))
4794 (memq article gnus-newsgroup-forwarded))
4796 (not (memq article gnus-newsgroup-unseen)))
4798 (memq article gnus-newsgroup-recent))
4801 (defun gnus-articles-to-read (group &optional read-all)
4802 "Find out what articles the user wants to read."
4804 ;; Select all articles if `read-all' is non-nil, or if there
4805 ;; are no unread articles.
4807 (and (zerop (length gnus-newsgroup-marked))
4808 (zerop (length gnus-newsgroup-unreads)))
4809 (eq gnus-newsgroup-display 'gnus-not-ignore))
4810 ;; We want to select the headers for all the articles in
4811 ;; the group, so we select either all the active
4812 ;; articles in the group, or (if that's nil), the
4813 ;; articles in the cache.
4815 (gnus-uncompress-range (gnus-active group))
4816 (gnus-cache-articles-in-group group))
4817 ;; Select only the "normal" subset of articles.
4818 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4819 (copy-sequence gnus-newsgroup-unreads))
4821 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4822 (scored (length scored-list))
4823 (number (length articles))
4824 (marked (+ (length gnus-newsgroup-marked)
4825 (length gnus-newsgroup-dormant)))
4833 ((and (or (<= scored marked) (= scored number))
4834 (natnump gnus-large-newsgroup)
4835 (> number gnus-large-newsgroup))
4836 (let* ((cursor-in-echo-area nil)
4838 (read-from-minibuffer
4840 "How many articles from %s (max %d): "
4842 (gnus-group-decoded-name gnus-newsgroup-name)
4845 (cons (number-to-string gnus-large-newsgroup)
4847 (if (string-match "^[ \t]*$" input)
4850 ((and (> scored marked) (< scored number)
4851 (> (- scored number) 20))
4854 (format "%s %s (%d scored, %d total): "
4855 "How many articles from"
4856 (gnus-group-decoded-name group)
4858 (if (string-match "^[ \t]*$" input)
4862 (message "Quit getting the articles to read")
4864 (setq select (if (stringp select) (string-to-number select) select))
4865 (if (or (null select) (zerop select))
4867 (if (and (not (zerop scored)) (<= (abs select) scored))
4869 (setq articles (sort scored-list '<))
4870 (setq number (length articles)))
4871 (setq articles (copy-sequence articles)))
4873 (when (< (abs select) number)
4875 ;; Select the N oldest articles.
4876 (setcdr (nthcdr (1- (abs select)) articles) nil)
4877 ;; Select the N most recent articles.
4878 (setq articles (nthcdr (- number select) articles))))
4879 (setq gnus-newsgroup-unselected
4880 (gnus-sorted-intersection
4881 gnus-newsgroup-unreads
4882 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4883 (when gnus-alter-articles-to-read-function
4884 (setq gnus-newsgroup-unreads
4886 (funcall gnus-alter-articles-to-read-function
4887 gnus-newsgroup-name gnus-newsgroup-unreads)
4891 (defun gnus-killed-articles (killed articles)
4894 (when (inline (gnus-member-of-range (car articles) killed))
4895 (push (car articles) out))
4896 (setq articles (cdr articles)))
4899 (defun gnus-uncompress-marks (marks)
4900 "Uncompress the mark ranges in MARKS."
4901 (let ((uncompressed '(score bookmark))
4904 (if (memq (caar marks) uncompressed)
4905 (push (car marks) out)
4906 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4907 (setq marks (cdr marks)))
4910 (defun gnus-article-mark-to-type (mark)
4911 "Return the type of MARK."
4912 (or (cadr (assq mark gnus-article-special-mark-lists))
4915 (defun gnus-article-unpropagatable-p (mark)
4916 "Return whether MARK should be propagated to backend."
4917 (memq mark gnus-article-unpropagated-mark-lists))
4919 (defun gnus-adjust-marked-articles (info)
4920 "Set all article lists and remove all marks that are no longer valid."
4921 (let* ((marked-lists (gnus-info-marks info))
4922 (active (gnus-active (gnus-info-group info)))
4925 (types gnus-article-mark-lists)
4926 marks var articles article mark mark-type)
4928 (dolist (marks marked-lists)
4929 (setq mark (car marks)
4930 mark-type (gnus-article-mark-to-type mark)
4931 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
4933 ;; We set the variable according to the type of the marks list,
4934 ;; and then adjust the marks to a subset of the active articles.
4936 ;; Adjust "simple" lists.
4937 ((eq mark-type 'list)
4938 (set var (setq articles (gnus-uncompress-range (cdr marks))))
4939 (when (memq mark '(tick dormant expire reply save))
4941 (when (or (< (setq article (pop articles)) min) (> article max))
4942 (set var (delq article (symbol-value var)))))))
4944 ((eq mark-type 'tuple)
4945 (set var (setq articles (cdr marks)))
4946 (when (not (listp (cdr (symbol-value var))))
4947 (set var (list (symbol-value var))))
4948 (when (not (listp (cdr articles)))
4949 (setq articles (list articles)))
4951 (when (or (not (consp (setq article (pop articles))))
4952 (< (car article) min)
4953 (> (car article) max))
4954 (set var (delq article (symbol-value var))))))
4955 ;; Adjust ranges (sloppily).
4956 ((eq mark-type 'range)
4959 ;; T-gnus change: Fix the record for `seen' if it looks like
4960 ;; (seen NUM1 . NUM2). It should be (seen (NUM1 . NUM2)).
4961 (when (numberp (cddr marks))
4962 (setcdr marks (list (cdr marks))))
4963 (setq articles (cdr marks))
4964 (while (and articles
4965 (or (and (consp (car articles))
4966 (> min (cdar articles)))
4967 (and (numberp (car articles))
4968 (> min (car articles)))))
4970 (set var articles))))))))
4972 (defun gnus-update-missing-marks (missing)
4973 "Go through the list of MISSING articles and remove them from the mark lists."
4976 ;; Go through all types.
4977 (dolist (elem gnus-article-mark-lists)
4978 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
4979 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
4980 (when (symbol-value var)
4981 ;; This list has articles. So we delete all missing
4982 ;; articles from it.
4985 (set var (delq (pop m) (symbol-value var))))))))))
4987 (defun gnus-update-marks ()
4988 "Enter the various lists of marked articles into the newsgroup info list."
4989 (let ((types gnus-article-mark-lists)
4990 (info (gnus-get-info gnus-newsgroup-name))
4991 type list newmarked symbol delta-marks)
4993 ;; Add all marks lists to the list of marks lists.
4994 (while (setq type (pop types))
4995 (setq list (symbol-value
4997 (intern (format "gnus-newsgroup-%s" (car type))))))
5000 ;; Get rid of the entries of the articles that have the
5002 (when (and (eq (cdr type) 'score)
5006 (prev (cons nil list))
5009 (if (or (not (consp (car arts)))
5010 (= (cdar arts) gnus-summary-default-score))
5011 (setcdr prev (cdr arts))
5013 (setq arts (cdr arts)))
5014 (setq list (cdr all)))))
5016 (when (eq (cdr type) 'seen)
5017 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5019 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5020 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5022 (when (and (gnus-check-backend-function
5023 'request-set-mark gnus-newsgroup-name)
5024 (not (gnus-article-unpropagatable-p (cdr type))))
5025 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5026 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5027 (add (gnus-remove-from-range
5028 (gnus-copy-sequence list) old)))
5030 (push (list add 'add (list (cdr type))) delta-marks))
5032 (push (list del 'del (list (cdr type))) delta-marks))))
5035 (push (cons (cdr type) list) newmarked)))
5038 (unless (gnus-check-group gnus-newsgroup-name)
5039 (error "Can't open server for %s" gnus-newsgroup-name))
5040 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5042 ;; Enter these new marks into the info of the group.
5044 (setcar (nthcdr 3 info) newmarked)
5045 ;; Add the marks lists to the end of the info.
5047 (setcdr (nthcdr 2 info) (list newmarked))))
5049 ;; Cut off the end of the info if there's nothing else there.
5053 (when (nthcdr (decf i) info)
5054 (setcdr (nthcdr i info) nil)))))))
5056 (defun gnus-set-mode-line (where)
5057 "Set the mode line of the article or summary buffers.
5058 If WHERE is `summary', the summary mode line format will be used."
5059 ;; Is this mode line one we keep updated?
5060 (when (and (memq where gnus-updated-mode-lines)
5062 (intern (format "gnus-%s-mode-line-format-spec" where))))
5065 ;; We evaluate this in the summary buffer since these
5066 ;; variables are buffer-local to that buffer.
5067 (set-buffer gnus-summary-buffer)
5068 ;; We bind all these variables that are used in the `eval' form
5070 (let* ((mformat (symbol-value
5072 (format "gnus-%s-mode-line-format-spec" where))))
5073 (gnus-tmp-group-name (gnus-group-decoded-name
5074 gnus-newsgroup-name))
5075 (gnus-tmp-article-number (or gnus-current-article 0))
5076 (gnus-tmp-unread gnus-newsgroup-unreads)
5077 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5078 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5079 (gnus-tmp-unread-and-unselected
5080 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5081 (zerop gnus-tmp-unselected))
5083 ((zerop gnus-tmp-unselected)
5084 (format "{%d more}" gnus-tmp-unread-and-unticked))
5085 (t (format "{%d(+%d) more}"
5086 gnus-tmp-unread-and-unticked
5087 gnus-tmp-unselected))))
5089 (if (and gnus-current-headers
5090 (vectorp gnus-current-headers))
5091 (gnus-mode-string-quote
5092 (mail-header-subject gnus-current-headers))
5094 bufname-length max-len
5095 gnus-tmp-header);; passed as argument to any user-format-funcs
5096 (setq mode-string (eval mformat))
5097 (setq bufname-length (if (string-match "%b" mode-string)
5100 (if (eq where 'summary)
5102 (get-buffer gnus-article-buffer))))
5105 (setq max-len (max 4 (if gnus-mode-non-string-length
5107 gnus-mode-non-string-length
5109 (length mode-string))))
5110 ;; We might have to chop a bit of the string off...
5111 (when (> (length mode-string) max-len)
5113 (concat (gnus-truncate-string mode-string (- max-len 3))
5115 ;; Pad the mode string a bit.
5116 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5117 ;; Update the mode line.
5118 (setq mode-line-buffer-identification
5119 (gnus-mode-line-buffer-identification (list mode-string)))
5120 (set-buffer-modified-p t))))
5122 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5123 "Go through the HEADERS list and add all Xrefs to a hash table.
5124 The resulting hash table is returned, or nil if no Xrefs were found."
5125 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5126 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5127 (xref-hashtb (gnus-make-hashtable))
5128 start group entry number xrefs header)
5130 (setq header (pop headers))
5131 (when (and (setq xrefs (mail-header-xref header))
5132 (not (memq (setq number (mail-header-number header))
5135 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5136 (setq start (match-end 0))
5137 (setq group (if prefix
5138 (concat prefix (substring xrefs (match-beginning 1)
5140 (substring xrefs (match-beginning 1) (match-end 1))))
5142 (string-to-int (substring xrefs (match-beginning 2)
5144 (if (setq entry (gnus-gethash group xref-hashtb))
5145 (setcdr entry (cons number (cdr entry)))
5146 (gnus-sethash group (cons number nil) xref-hashtb)))))
5147 (and start xref-hashtb)))
5149 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5150 "Look through all the headers and mark the Xrefs as read."
5151 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5152 name entry info xref-hashtb idlist method nth4)
5154 (set-buffer gnus-group-buffer)
5155 (when (setq xref-hashtb
5156 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5159 (unless (string= from-newsgroup (setq name (symbol-name group)))
5160 (setq idlist (symbol-value group))
5161 ;; Dead groups are not updated.
5163 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5165 (when (stringp (setq nth4 (gnus-info-method info)))
5166 (setq nth4 (gnus-server-to-method nth4))))
5167 ;; Only do the xrefs if the group has the same
5168 ;; select method as the group we have just read.
5169 (or (gnus-methods-equal-p
5170 nth4 (gnus-find-method-for-group from-newsgroup))
5172 (equal nth4 (setq method (gnus-find-method-for-group
5174 (and (equal (car nth4) (car method))
5175 (equal (nth 1 nth4) (nth 1 method))))
5176 gnus-use-cross-reference
5177 (or (not (eq gnus-use-cross-reference t))
5179 ;; Only do cross-references on subscribed
5180 ;; groups, if that is what is wanted.
5181 (<= (gnus-info-level info) gnus-level-subscribed))
5182 (gnus-group-make-articles-read name idlist))))
5185 (defun gnus-compute-read-articles (group articles)
5186 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5187 (info (nth 2 entry))
5188 (active (gnus-active group))
5191 ;; First peel off all invalid article numbers.
5193 (let ((ids articles)
5195 (while (setq id (pop ids))
5196 (when (and first (> id (cdr active)))
5197 ;; We'll end up in this situation in one particular
5198 ;; obscure situation. If you re-scan a group and get
5199 ;; a new article that is cross-posted to a different
5200 ;; group that has not been re-scanned, you might get
5201 ;; crossposted article that has a higher number than
5202 ;; Gnus believes possible. So we re-activate this
5203 ;; group as well. This might mean doing the
5204 ;; crossposting thingy will *increase* the number
5205 ;; of articles in some groups. Tsk, tsk.
5206 (setq active (or (gnus-activate-group group) active)))
5207 (when (or (> id (cdr active))
5208 (< id (car active)))
5209 (setq articles (delq id articles))))))
5210 ;; If the read list is nil, we init it.
5212 (null (gnus-info-read info))
5214 (setq ninfo (cons 1 (1- (car active))))
5215 (setq ninfo (gnus-info-read info)))
5216 ;; Then we add the read articles to the range.
5218 ninfo (setq articles (sort articles '<))))))
5220 (defun gnus-group-make-articles-read (group articles)
5221 "Update the info of GROUP to say that ARTICLES are read."
5223 (entry (gnus-gethash group gnus-newsrc-hashtb))
5224 (info (nth 2 entry))
5225 (active (gnus-active group))
5228 (setq range (gnus-compute-read-articles group articles))
5230 (set-buffer gnus-group-buffer)
5233 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5234 (gnus-info-set-read ',info ',(gnus-info-read info))
5235 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5236 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5237 (gnus-group-update-group ,group t))))
5238 ;; Add the read articles to the range.
5239 (gnus-info-set-read info range)
5240 (gnus-request-set-mark group (list (list range 'add '(read))))
5241 ;; Then we have to re-compute how many unread
5242 ;; articles there are in this group.
5246 (setq num (- (1+ (cdr active)) (car active))))
5247 ((not (listp (cdr range)))
5248 (setq num (- (cdr active) (- (1+ (cdr range))
5252 (if (numberp (car range))
5254 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5255 (setq range (cdr range)))
5256 (setq num (- (cdr active) num))))
5257 ;; Update the number of unread articles.
5259 ;; Update the group buffer.
5260 (gnus-group-update-group group t)))))
5262 (defvar gnus-newsgroup-none-id 0)
5264 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5265 (let ((cur nntp-server-buffer)
5268 (save-excursion (set-buffer gnus-summary-buffer)
5269 gnus-newsgroup-dependencies)))
5271 (mail-parse-charset gnus-newsgroup-charset)
5272 (mail-parse-ignored-charsets
5273 (save-excursion (condition-case nil
5274 (set-buffer gnus-summary-buffer)
5276 gnus-newsgroup-ignored-charsets)))
5278 (set-buffer nntp-server-buffer)
5279 ;; Translate all TAB characters into SPACE characters.
5280 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5281 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5282 (gnus-run-hooks 'gnus-parse-headers-hook)
5283 (let ((case-fold-search t)
5284 in-reply-to header p lines chars ctype)
5285 (goto-char (point-min))
5286 ;; Search to the beginning of the next header. Error messages
5287 ;; do not begin with 2 or 3.
5288 (while (re-search-forward "^[23][0-9]+ " nil t)
5291 ;; This implementation of this function, with nine
5292 ;; search-forwards instead of the one re-search-forward and
5293 ;; a case (which basically was the old function) is actually
5294 ;; about twice as fast, even though it looks messier. You
5295 ;; can't have everything, I guess. Speed and elegance
5296 ;; doesn't always go hand in hand.
5299 (make-full-mail-header
5305 (narrow-to-region (point)
5306 (or (and (search-forward "\n.\n" nil t)
5312 (if (search-forward "\nsubject:" nil t)
5313 (nnheader-header-value)
5318 (if (search-forward "\nfrom:" nil t)
5319 (nnheader-header-value)
5324 (if (search-forward "\ndate:" nil t)
5325 (nnheader-header-value) ""))
5329 (setq id (if (re-search-forward
5330 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5331 ;; We do it this way to make sure the Message-ID
5332 ;; is (somewhat) syntactically valid.
5333 (buffer-substring (match-beginning 1)
5335 ;; If there was no message-id, we just fake one
5336 ;; to make subsequent routines simpler.
5337 (nnheader-generate-fake-message-id))))
5341 (if (search-forward "\nreferences:" nil t)
5345 (nnheader-header-value)
5350 (search-backward ">" end t)
5353 (search-backward "<" end t)
5355 ;; Get the references from the in-reply-to header if there
5356 ;; were no references and the in-reply-to header looks
5358 (if (and (search-forward "\nin-reply-to:" nil t)
5359 (setq in-reply-to (nnheader-header-value))
5360 (string-match "<[^>]+>" in-reply-to))
5362 (setq ref (substring in-reply-to (match-beginning 0)
5364 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5365 (setq ref2 (substring in-reply-to (match-beginning 0)
5367 (when (> (length ref2) (length ref))
5374 (if (search-forward "\nchars: " nil t)
5375 (if (numberp (setq chars (ignore-errors (read cur))))
5381 (if (search-forward "\nlines: " nil t)
5382 (if (numberp (setq lines (ignore-errors (read cur))))
5388 (and (search-forward "\nxref:" nil t)
5389 (nnheader-header-value)))
5391 (when gnus-extra-headers
5392 (let ((extra gnus-extra-headers)
5396 (when (search-forward
5397 (concat "\n" (symbol-name (car extra)) ":") nil t)
5398 (push (cons (car extra) (nnheader-header-value)) out))
5402 (if (and (search-forward "\ncontent-type: " nil t)
5403 (setq ctype (nnheader-header-value)))
5404 (mime-entity-set-content-type-internal
5405 header (mime-parse-Content-Type ctype)))
5406 (when (equal id ref)
5409 (when gnus-alter-header-function
5410 (funcall gnus-alter-header-function header)
5411 (setq id (mail-header-id header)
5412 ref (gnus-parent-id (mail-header-references header))))
5415 (gnus-dependencies-add-header
5416 header dependencies force-new))
5417 (push header headers))
5418 (goto-char (point-max))
5420 (nreverse headers)))))
5422 ;; Goes through the xover lines and returns a list of vectors
5423 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5424 force-new dependencies
5425 group also-fetch-heads)
5426 "Parse the news overview data in the server buffer.
5427 Return a list of headers that match SEQUENCE (see
5428 `nntp-retrieve-headers')."
5429 ;; Get the Xref when the users reads the articles since most/some
5430 ;; NNTP servers do not include Xrefs when using XOVER.
5431 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5432 (let ((mail-parse-charset gnus-newsgroup-charset)
5433 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5434 (cur nntp-server-buffer)
5435 (dependencies (or dependencies gnus-newsgroup-dependencies))
5437 ((eq gnus-read-all-available-headers t)
5439 ((stringp gnus-read-all-available-headers)
5440 (string-match gnus-read-all-available-headers group))
5443 number headers header)
5445 (set-buffer nntp-server-buffer)
5446 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5447 ;; Allow the user to mangle the headers before parsing them.
5448 (gnus-run-hooks 'gnus-parse-headers-hook)
5449 (goto-char (point-min))
5452 (while (and (or sequence allp)
5454 (setq number (read cur))
5456 (while (and sequence
5457 (< (car sequence) number))
5458 (setq sequence (cdr sequence))))
5461 (eq number (car sequence))))
5463 (setq sequence (cdr sequence))
5464 (setq header (inline
5465 (gnus-nov-parse-line
5466 number dependencies force-new)))))
5467 (push header headers))
5470 (gnus-error 4 "Strange nov line (%d)"
5471 (count-lines (point-min) (point)))))
5473 ;; A common bug in inn is that if you have posted an article and
5474 ;; then retrieves the active file, it will answer correctly --
5475 ;; the new article is included. However, a NOV entry for the
5476 ;; article may not have been generated yet, so this may fail.
5477 ;; We work around this problem by retrieving the last few
5478 ;; headers using HEAD.
5479 (if (or (not also-fetch-heads)
5481 ;; We (probably) got all the headers.
5483 (let ((gnus-nov-is-evil t))
5486 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5487 (gnus-get-newsgroup-headers))))))))
5489 (defun gnus-article-get-xrefs ()
5490 "Fill in the Xref value in `gnus-current-headers', if necessary.
5491 This is meant to be called in `gnus-article-internal-prepare-hook'."
5492 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5493 gnus-current-headers)))
5494 (or (not gnus-use-cross-reference)
5496 (and (mail-header-xref headers)
5497 (not (string= (mail-header-xref headers) "")))
5498 (let ((case-fold-search t)
5501 (nnheader-narrow-to-headers)
5502 (goto-char (point-min))
5503 (when (or (and (not (eobp))
5504 (eq (downcase (char-after)) ?x)
5505 (looking-at "Xref:"))
5506 (search-forward "\nXref:" nil t))
5507 (goto-char (1+ (match-end 0)))
5508 (setq xref (buffer-substring (point)
5509 (progn (end-of-line) (point))))
5510 (mail-header-set-xref headers xref)))))))
5512 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5513 "Find article ID and insert the summary line for that article.
5514 OLD-HEADER can either be a header or a line number to insert
5515 the subject line on."
5516 (let* ((line (and (numberp old-header) old-header))
5517 (old-header (and (vectorp old-header) old-header))
5518 (header (cond ((and old-header use-old-header)
5521 (gnus-number-to-header id))
5522 (gnus-number-to-header id))
5524 (gnus-read-header id))))
5525 (number (and (numberp id) id))
5528 ;; Rebuild the thread that this article is part of and go to the
5529 ;; article we have fetched.
5530 (when (and (not gnus-show-threads)
5533 (setq d (gnus-data-find (mail-header-number old-header))))
5534 (goto-char (gnus-data-pos d))
5537 (- (gnus-point-at-bol)
5539 (1+ (gnus-point-at-eol))
5540 (gnus-delete-line))))))
5542 (mail-header-set-number header (mail-header-number old-header)))
5543 (setq gnus-newsgroup-sparse
5544 (delq (setq number (mail-header-number header))
5545 gnus-newsgroup-sparse))
5546 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5547 (push number gnus-newsgroup-limit)
5548 (gnus-rebuild-thread (mail-header-id header) line)
5549 (gnus-summary-goto-subject number nil t))
5550 (when (and (numberp number)
5552 ;; We have to update the boundaries even if we can't fetch the
5553 ;; article if ID is a number -- so that the next `P' or `N'
5554 ;; command will fetch the previous (or next) article even
5555 ;; if the one we tried to fetch this time has been canceled.
5556 (when (> number gnus-newsgroup-end)
5557 (setq gnus-newsgroup-end number))
5558 (when (< number gnus-newsgroup-begin)
5559 (setq gnus-newsgroup-begin number))
5560 (setq gnus-newsgroup-unselected
5561 (delq number gnus-newsgroup-unselected)))
5562 ;; Report back a success?
5563 (and header (mail-header-number header))))
5565 ;;; Process/prefix in the summary buffer
5567 (defun gnus-summary-work-articles (n)
5568 "Return a list of articles to be worked upon.
5569 The prefix argument, the list of process marked articles, and the
5570 current article will be taken into consideration."
5572 (set-buffer gnus-summary-buffer)
5575 ;; A numerical prefix has been given.
5576 (setq n (prefix-numeric-value n))
5577 (let ((backward (< n 0))
5578 (n (abs (prefix-numeric-value n)))
5583 (push (setq article (gnus-summary-article-number))
5586 (gnus-summary-find-prev nil article)
5587 (gnus-summary-find-next nil article)))
5589 (nreverse articles)))
5590 ((and (gnus-region-active-p) (mark))
5591 (message "region active")
5592 ;; Work on the region between point and mark.
5593 (let ((max (max (point) (mark)))
5596 (goto-char (min (point) (mark)))
5599 (push (setq article (gnus-summary-article-number)) articles)
5600 (gnus-summary-find-next nil article)
5602 (nreverse articles))))
5603 (gnus-newsgroup-processable
5604 ;; There are process-marked articles present.
5605 ;; Save current state.
5606 (gnus-summary-save-process-mark)
5608 (reverse gnus-newsgroup-processable))
5610 ;; Just return the current article.
5611 (list (gnus-summary-article-number))))))
5613 (defmacro gnus-summary-iterate (arg &rest forms)
5614 "Iterate over the process/prefixed articles and do FORMS.
5615 ARG is the interactive prefix given to the command. FORMS will be
5616 executed with point over the summary line of the articles."
5617 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5618 `(let ((,articles (gnus-summary-work-articles ,arg)))
5620 (gnus-summary-goto-subject (car ,articles))
5624 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5625 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5627 (defun gnus-summary-save-process-mark ()
5628 "Push the current set of process marked articles on the stack."
5630 (push (copy-sequence gnus-newsgroup-processable)
5631 gnus-newsgroup-process-stack))
5633 (defun gnus-summary-kill-process-mark ()
5634 "Push the current set of process marked articles on the stack and unmark."
5636 (gnus-summary-save-process-mark)
5637 (gnus-summary-unmark-all-processable))
5639 (defun gnus-summary-yank-process-mark ()
5640 "Pop the last process mark state off the stack and restore it."
5642 (unless gnus-newsgroup-process-stack
5643 (error "Empty mark stack"))
5644 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5646 (defun gnus-summary-process-mark-set (set)
5647 "Make SET into the current process marked articles."
5648 (gnus-summary-unmark-all-processable)
5650 (gnus-summary-set-process-mark (pop set))))
5652 ;;; Searching and stuff
5654 (defun gnus-summary-search-group (&optional backward use-level)
5655 "Search for next unread newsgroup.
5656 If optional argument BACKWARD is non-nil, search backward instead."
5658 (set-buffer gnus-group-buffer)
5659 (when (gnus-group-search-forward
5660 backward nil (if use-level (gnus-group-group-level) nil))
5661 (gnus-group-group-name))))
5663 (defun gnus-summary-best-group (&optional exclude-group)
5664 "Find the name of the best unread group.
5665 If EXCLUDE-GROUP, do not go to this group."
5667 (set-buffer gnus-group-buffer)
5669 (gnus-group-best-unread-group exclude-group))))
5671 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5672 (if backward (gnus-summary-find-prev)
5673 (let* ((dummy (gnus-summary-article-intangible-p))
5674 (article (or article (gnus-summary-article-number)))
5675 (arts (gnus-data-find-list article))
5677 (when (and (not dummy)
5678 (or (not gnus-summary-check-current)
5680 (not (gnus-data-unread-p (car arts)))))
5681 (setq arts (cdr arts)))
5686 (when (or (and undownloaded
5687 (eq gnus-undownloaded-mark
5688 (gnus-data-mark (car arts))))
5689 (gnus-data-unread-p (car arts)))
5690 (setq result (car arts)
5692 (setq arts (cdr arts)))
5695 (goto-char (gnus-data-pos result))
5696 (gnus-data-number result)))))
5698 (defun gnus-summary-find-prev (&optional unread article)
5699 (let* ((eobp (eobp))
5700 (article (or article (gnus-summary-article-number)))
5701 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5703 (when (and (not eobp)
5704 (or (not gnus-summary-check-current)
5706 (not (gnus-data-unread-p (car arts)))))
5707 (setq arts (cdr arts)))
5712 (when (gnus-data-unread-p (car arts))
5713 (setq result (car arts)
5715 (setq arts (cdr arts)))
5718 (goto-char (gnus-data-pos result))
5719 (gnus-data-number result))))
5721 (defun gnus-summary-find-subject (subject &optional unread backward article)
5722 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5723 (article (or article (gnus-summary-article-number)))
5724 (articles (gnus-data-list backward))
5725 (arts (gnus-data-find-list article articles))
5727 (when (or (not gnus-summary-check-current)
5729 (not (gnus-data-unread-p (car arts))))
5730 (setq arts (cdr arts)))
5732 (and (or (not unread)
5733 (gnus-data-unread-p (car arts)))
5734 (vectorp (gnus-data-header (car arts)))
5736 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5737 (setq result (car arts)
5739 (setq arts (cdr arts)))
5741 (goto-char (gnus-data-pos result))
5742 (gnus-data-number result))))
5744 (defun gnus-summary-search-forward (&optional unread subject backward)
5745 "Search forward for an article.
5746 If UNREAD, look for unread articles. If SUBJECT, look for
5747 articles with that subject. If BACKWARD, search backward instead."
5748 (cond (subject (gnus-summary-find-subject subject unread backward))
5749 (backward (gnus-summary-find-prev unread))
5750 (t (gnus-summary-find-next unread))))
5752 (defun gnus-recenter (&optional n)
5753 "Center point in window and redisplay frame.
5754 Also do horizontal recentering."
5756 (when (and gnus-auto-center-summary
5757 (not (eq gnus-auto-center-summary 'vertical)))
5758 (gnus-horizontal-recenter))
5761 (defun gnus-summary-recenter ()
5762 "Center point in the summary window.
5763 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5764 displayed, no centering will be performed."
5765 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5766 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5768 (let* ((top (cond ((< (window-height) 4) 0)
5769 ((< (window-height) 7) 1)
5770 (t (if (numberp gnus-auto-center-summary)
5771 gnus-auto-center-summary
5773 (height (1- (window-height)))
5774 (bottom (save-excursion (goto-char (point-max))
5775 (forward-line (- height))
5777 (window (get-buffer-window (current-buffer))))
5778 ;; The user has to want it.
5779 (when gnus-auto-center-summary
5780 (when (get-buffer-window gnus-article-buffer)
5781 ;; Only do recentering when the article buffer is displayed,
5782 ;; Set the window start to either `bottom', which is the biggest
5783 ;; possible valid number, or the second line from the top,
5784 ;; whichever is the least.
5785 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5786 (if (> bottom top-pos)
5787 ;; Keep the second line from the top visible
5788 (set-window-start window top-pos t)
5789 ;; Try to keep the bottom line visible; if it's partially
5790 ;; obscured, either scroll one more line to make it fully
5791 ;; visible, or revert to using TOP-POS.
5793 (goto-char (point-max))
5795 (let ((last-line-start (point)))
5797 (set-window-start window (point) t)
5798 (when (not (pos-visible-in-window-p last-line-start window))
5800 (set-window-start window (min (point) top-pos) t)))))))
5801 ;; Do horizontal recentering while we're at it.
5802 (when (and (get-buffer-window (current-buffer) t)
5803 (not (eq gnus-auto-center-summary 'vertical)))
5804 (let ((selected (selected-window)))
5805 (select-window (get-buffer-window (current-buffer) t))
5806 (gnus-summary-position-point)
5807 (gnus-horizontal-recenter)
5808 (select-window selected))))))
5810 (defun gnus-summary-jump-to-group (newsgroup)
5811 "Move point to NEWSGROUP in group mode buffer."
5812 ;; Keep update point of group mode buffer if visible.
5813 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5814 (save-window-excursion
5815 ;; Take care of tree window mode.
5816 (when (get-buffer-window gnus-group-buffer)
5817 (pop-to-buffer gnus-group-buffer))
5818 (gnus-group-jump-to-group newsgroup))
5820 ;; Take care of tree window mode.
5821 (if (get-buffer-window gnus-group-buffer)
5822 (pop-to-buffer gnus-group-buffer)
5823 (set-buffer gnus-group-buffer))
5824 (gnus-group-jump-to-group newsgroup))))
5826 ;; This function returns a list of article numbers based on the
5827 ;; difference between the ranges of read articles in this group and
5828 ;; the range of active articles.
5829 (defun gnus-list-of-unread-articles (group)
5830 (let* ((read (gnus-info-read (gnus-get-info group)))
5831 (active (or (gnus-active group) (gnus-activate-group group)))
5834 ;; If none are read, then all are unread.
5836 (setq first (car active))
5837 ;; If the range of read articles is a single range, then the
5838 ;; first unread article is the article after the last read
5839 ;; article. Sounds logical, doesn't it?
5840 (if (and (not (listp (cdr read)))
5841 (or (< (car read) (car active))
5842 (progn (setq read (list read))
5844 (setq first (max (car active) (1+ (cdr read))))
5845 ;; `read' is a list of ranges.
5846 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5849 (setq first (car active)))
5852 (while (< first nlast)
5854 (setq first (1+ first))))
5855 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5856 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5857 (setq read (cdr read)))))
5858 ;; And add the last unread articles.
5859 (while (<= first last)
5861 (setq first (1+ first)))
5862 ;; Return the list of unread articles.
5863 (delq 0 (nreverse unread))))
5865 (defun gnus-list-of-read-articles (group)
5866 "Return a list of unread, unticked and non-dormant articles."
5867 (let* ((info (gnus-get-info group))
5868 (marked (gnus-info-marks info))
5869 (active (gnus-active group)))
5871 (gnus-set-difference
5872 (gnus-sorted-complement
5873 (gnus-uncompress-range active)
5874 (gnus-list-of-unread-articles group))
5876 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5877 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5879 ;; Various summary commands
5881 (defun gnus-summary-select-article-buffer ()
5882 "Reconfigure windows to show article buffer."
5884 (if (not (gnus-buffer-live-p gnus-article-buffer))
5885 (error "There is no article buffer for this summary buffer")
5886 (gnus-configure-windows 'article)
5887 (select-window (get-buffer-window gnus-article-buffer))))
5889 (defun gnus-summary-universal-argument (arg)
5890 "Perform any operation on all articles that are process/prefixed."
5892 (let ((articles (gnus-summary-work-articles arg))
5899 (substitute-command-keys
5900 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5902 (gnus-error 1 "Undefined key")
5905 (gnus-summary-goto-subject (setq article (pop articles)))
5906 (let (gnus-newsgroup-processable)
5907 (command-execute func))
5908 (gnus-summary-remove-process-mark article)))))
5909 (gnus-summary-position-point))
5911 (defun gnus-summary-toggle-truncation (&optional arg)
5912 "Toggle truncation of summary lines.
5913 With arg, turn line truncation on iff arg is positive."
5915 (setq truncate-lines
5916 (if (null arg) (not truncate-lines)
5917 (> (prefix-numeric-value arg) 0)))
5920 (defun gnus-summary-reselect-current-group (&optional all rescan)
5921 "Exit and then reselect the current newsgroup.
5922 The prefix argument ALL means to select all articles."
5924 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5925 (error "Ephemeral groups can't be reselected"))
5926 (let ((current-subject (gnus-summary-article-number))
5927 (group gnus-newsgroup-name))
5928 (setq gnus-newsgroup-begin nil)
5930 ;; We have to adjust the point of group mode buffer because
5931 ;; point was moved to the next unread newsgroup by exiting.
5932 (gnus-summary-jump-to-group group)
5935 (save-window-excursion
5936 ;; Don't show group contents.
5937 (set-window-start (selected-window) (point-max))
5938 (gnus-group-get-new-news-this-group 1))))
5939 (gnus-group-read-group all t)
5940 (gnus-summary-goto-subject current-subject nil t)))
5942 (defun gnus-summary-rescan-group (&optional all)
5943 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5945 (gnus-summary-reselect-current-group all t))
5947 (defun gnus-summary-update-info (&optional non-destructive)
5949 (let ((group gnus-newsgroup-name))
5951 (when gnus-newsgroup-kill-headers
5952 (setq gnus-newsgroup-killed
5953 (gnus-compress-sequence
5955 (gnus-set-sorted-intersection
5956 (gnus-uncompress-range gnus-newsgroup-killed)
5957 (setq gnus-newsgroup-unselected
5958 (sort gnus-newsgroup-unselected '<)))
5959 (setq gnus-newsgroup-unreads
5960 (sort gnus-newsgroup-unreads '<)))
5962 (unless (listp (cdr gnus-newsgroup-killed))
5963 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5964 (let ((headers gnus-newsgroup-headers))
5965 ;; Set the new ranges of read articles.
5967 (set-buffer gnus-group-buffer)
5968 (gnus-undo-force-boundary))
5969 (gnus-update-read-articles
5970 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5971 ;; Set the current article marks.
5972 (let ((gnus-newsgroup-scored
5973 (if (and (not gnus-save-score)
5974 (not non-destructive))
5976 gnus-newsgroup-scored)))
5978 (gnus-update-marks)))
5979 ;; Do the cross-ref thing.
5980 (when gnus-use-cross-reference
5981 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5982 ;; Do not switch windows but change the buffer to work.
5983 (set-buffer gnus-group-buffer)
5984 (unless (gnus-ephemeral-group-p group)
5985 (gnus-group-update-group group)))))))
5987 (defun gnus-summary-save-newsrc (&optional force)
5988 "Save the current number of read/marked articles in the dribble buffer.
5989 The dribble buffer will then be saved.
5990 If FORCE (the prefix), also save the .newsrc file(s)."
5992 (gnus-summary-update-info t)
5994 (gnus-save-newsrc-file)
5995 (gnus-dribble-save)))
5997 (defun gnus-summary-exit (&optional temporary)
5998 "Exit reading current newsgroup, and then return to group selection mode.
5999 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6001 (gnus-set-global-variables)
6002 (gnus-kill-save-kill-buffer)
6003 (gnus-async-halt-prefetch)
6004 (let* ((group gnus-newsgroup-name)
6005 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6008 (buf (current-buffer)))
6010 ;; Do adaptive scoring, and possibly save score files.
6011 (when gnus-newsgroup-adaptive
6012 (gnus-score-adaptive))
6013 (when gnus-use-scoring
6015 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6016 ;; If we have several article buffers, we kill them at exit.
6017 (unless gnus-single-article-buffer
6018 (gnus-kill-buffer gnus-original-article-buffer)
6019 (setq gnus-article-current nil))
6020 (when gnus-use-cache
6021 (gnus-cache-possibly-remove-articles)
6022 (gnus-cache-save-buffers))
6023 (gnus-async-prefetch-remove-group group)
6024 (when gnus-suppress-duplicates
6025 (gnus-dup-enter-articles))
6026 (when gnus-use-trees
6027 (gnus-tree-close group))
6028 (when gnus-use-cache
6029 (gnus-cache-write-active))
6030 ;; Remove entries for this group.
6031 (nnmail-purge-split-history (gnus-group-real-name group))
6032 ;; Make all changes in this group permanent.
6034 (gnus-run-hooks 'gnus-exit-group-hook)
6035 (gnus-summary-update-info))
6036 (gnus-close-group group)
6037 ;; Make sure where we were, and go to next newsgroup.
6038 (set-buffer gnus-group-buffer)
6040 (gnus-group-jump-to-group group))
6041 (gnus-run-hooks 'gnus-summary-exit-hook)
6042 (unless (or quit-config
6043 ;; If this group has disappeared from the summary
6044 ;; buffer, don't skip forwards.
6045 (not (string= group (gnus-group-group-name))))
6046 (gnus-group-next-unread-group 1))
6047 (setq group-point (point))
6050 ;; If we have several article buffers, we kill them at exit.
6051 (unless gnus-single-article-buffer
6052 (gnus-kill-buffer gnus-article-buffer)
6053 (gnus-kill-buffer gnus-original-article-buffer)
6054 (setq gnus-article-current nil))
6056 (if (not gnus-kill-summary-on-exit)
6058 (gnus-deaden-summary)
6060 ;; We set all buffer-local variables to nil. It is unclear why
6061 ;; this is needed, but if we don't, buffer-local variables are
6062 ;; not garbage-collected, it seems. This would the lead to en
6063 ;; ever-growing Emacs.
6064 (gnus-summary-clear-local-variables)
6065 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6066 (gnus-summary-clear-local-variables))
6067 (when (get-buffer gnus-article-buffer)
6068 (bury-buffer gnus-article-buffer))
6069 ;; We clear the global counterparts of the buffer-local
6070 ;; variables as well, just to be on the safe side.
6071 (set-buffer gnus-group-buffer)
6072 (gnus-summary-clear-local-variables)
6073 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6074 (gnus-summary-clear-local-variables)))
6075 (setq gnus-current-select-method gnus-select-method)
6076 (pop-to-buffer gnus-group-buffer)
6077 (if (not quit-config)
6079 (goto-char group-point)
6080 (gnus-configure-windows 'group 'force)
6081 (unless (pos-visible-in-window-p)
6082 (forward-line (/ (static-if (featurep 'xemacs)
6083 (window-displayed-height)
6084 (1- (window-height)))
6086 (set-window-start (selected-window) (point))
6087 (goto-char group-point)))
6088 (gnus-handle-ephemeral-exit quit-config))
6089 ;; Return to group mode buffer.
6090 (when (eq mode 'gnus-summary-mode)
6091 (gnus-kill-buffer buf))
6092 ;; Clear the current group name.
6094 (setq gnus-newsgroup-name nil)))))
6096 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6097 (defun gnus-summary-exit-no-update (&optional no-questions)
6098 "Quit reading current newsgroup without updating read article info."
6100 (let* ((group gnus-newsgroup-name)
6101 (quit-config (gnus-group-quit-config group)))
6102 (when (or no-questions
6104 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6105 (gnus-async-halt-prefetch)
6107 (delq 'gnus-summary-expire-articles
6108 (copy-sequence gnus-summary-prepare-exit-hook)))
6109 ;; If we have several article buffers, we kill them at exit.
6110 (unless gnus-single-article-buffer
6111 (gnus-kill-buffer gnus-article-buffer)
6112 (gnus-kill-buffer gnus-original-article-buffer)
6113 (setq gnus-article-current nil))
6114 (if (not gnus-kill-summary-on-exit)
6115 (gnus-deaden-summary)
6116 (gnus-close-group group)
6117 (gnus-summary-clear-local-variables)
6118 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6119 (gnus-summary-clear-local-variables))
6120 (set-buffer gnus-group-buffer)
6121 (gnus-summary-clear-local-variables)
6122 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6123 (gnus-summary-clear-local-variables))
6124 (when (get-buffer gnus-summary-buffer)
6125 (kill-buffer gnus-summary-buffer)))
6126 (unless gnus-single-article-buffer
6127 (setq gnus-article-current nil))
6128 (when gnus-use-trees
6129 (gnus-tree-close group))
6130 (gnus-async-prefetch-remove-group group)
6131 (when (get-buffer gnus-article-buffer)
6132 (bury-buffer gnus-article-buffer))
6133 ;; Return to the group buffer.
6134 (gnus-configure-windows 'group 'force)
6135 ;; Clear the current group name.
6136 (setq gnus-newsgroup-name nil)
6137 (when (equal (gnus-group-group-name) group)
6138 (gnus-group-next-unread-group 1))
6140 (gnus-handle-ephemeral-exit quit-config)))))
6142 (defun gnus-handle-ephemeral-exit (quit-config)
6143 "Handle movement when leaving an ephemeral group.
6144 The state which existed when entering the ephemeral is reset."
6145 (if (not (buffer-name (car quit-config)))
6146 (gnus-configure-windows 'group 'force)
6147 (set-buffer (car quit-config))
6148 (cond ((eq major-mode 'gnus-summary-mode)
6149 (gnus-set-global-variables))
6150 ((eq major-mode 'gnus-article-mode)
6152 ;; The `gnus-summary-buffer' variable may point
6153 ;; to the old summary buffer when using a single
6155 (unless (gnus-buffer-live-p gnus-summary-buffer)
6156 (set-buffer gnus-group-buffer))
6157 (set-buffer gnus-summary-buffer)
6158 (gnus-set-global-variables))))
6159 (if (or (eq (cdr quit-config) 'article)
6160 (eq (cdr quit-config) 'pick))
6162 ;; The current article may be from the ephemeral group
6163 ;; thus it is best that we reload this article
6164 (gnus-summary-show-article)
6165 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6166 (gnus-configure-windows 'pick 'force)
6167 (gnus-configure-windows (cdr quit-config) 'force)))
6168 (gnus-configure-windows (cdr quit-config) 'force))
6169 (when (eq major-mode 'gnus-summary-mode)
6170 (gnus-summary-next-subject 1 nil t)
6171 (gnus-summary-recenter)
6172 (gnus-summary-position-point))))
6174 (defun gnus-summary-preview-mime-message ()
6175 "MIME decode and play this message."
6177 (let ((gnus-break-pages nil)
6179 (gnus-summary-select-article gnus-show-all-headers t))
6180 (select-window (get-buffer-window gnus-article-buffer)))
6184 (defvar gnus-dead-summary-mode-map nil)
6186 (unless gnus-dead-summary-mode-map
6187 (setq gnus-dead-summary-mode-map (make-keymap))
6188 (suppress-keymap gnus-dead-summary-mode-map)
6189 (substitute-key-definition
6190 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6191 (let ((keys '("\C-d" "\r" "\177" [delete])))
6193 (define-key gnus-dead-summary-mode-map
6194 (pop keys) 'gnus-summary-wake-up-the-dead))))
6196 (defvar gnus-dead-summary-mode nil
6197 "Minor mode for Gnus summary buffers.")
6199 (defun gnus-dead-summary-mode (&optional arg)
6200 "Minor mode for Gnus summary buffers."
6202 (when (eq major-mode 'gnus-summary-mode)
6203 (make-local-variable 'gnus-dead-summary-mode)
6204 (setq gnus-dead-summary-mode
6205 (if (null arg) (not gnus-dead-summary-mode)
6206 (> (prefix-numeric-value arg) 0)))
6207 (when gnus-dead-summary-mode
6208 (gnus-add-minor-mode
6209 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6211 (defun gnus-deaden-summary ()
6212 "Make the current summary buffer into a dead summary buffer."
6213 ;; Kill any previous dead summary buffer.
6214 (when (and gnus-dead-summary
6215 (buffer-name gnus-dead-summary))
6217 (set-buffer gnus-dead-summary)
6218 (when gnus-dead-summary-mode
6219 (kill-buffer (current-buffer)))))
6220 ;; Make this the current dead summary.
6221 (setq gnus-dead-summary (current-buffer))
6222 (gnus-dead-summary-mode 1)
6223 (let ((name (buffer-name)))
6224 (when (string-match "Summary" name)
6226 (concat (substring name 0 (match-beginning 0)) "Dead "
6227 (substring name (match-beginning 0)))
6231 (defun gnus-kill-or-deaden-summary (buffer)
6232 "Kill or deaden the summary BUFFER."
6234 (when (and (buffer-name buffer)
6235 (not gnus-single-article-buffer))
6238 (gnus-kill-buffer gnus-article-buffer)
6239 (gnus-kill-buffer gnus-original-article-buffer)))
6240 (cond (gnus-kill-summary-on-exit
6241 (when (and gnus-use-trees
6242 (gnus-buffer-exists-p buffer))
6245 (gnus-tree-close gnus-newsgroup-name)))
6246 (gnus-kill-buffer buffer))
6247 ((gnus-buffer-exists-p buffer)
6250 (gnus-deaden-summary))))))
6252 (defun gnus-summary-wake-up-the-dead (&rest args)
6253 "Wake up the dead summary buffer."
6255 (gnus-dead-summary-mode -1)
6256 (let ((name (buffer-name)))
6257 (when (string-match "Dead " name)
6259 (concat (substring name 0 (match-beginning 0))
6260 (substring name (match-end 0)))
6262 (gnus-message 3 "This dead summary is now alive again"))
6264 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6265 (defun gnus-summary-fetch-faq (&optional faq-dir)
6266 "Fetch the FAQ for the current group.
6267 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6271 (when current-prefix-arg
6273 "Faq dir: " (and (listp gnus-group-faq-directory)
6274 (mapcar (lambda (file) (list file))
6275 gnus-group-faq-directory))))))
6276 (let (gnus-faq-buffer)
6277 (when (setq gnus-faq-buffer
6278 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6279 (gnus-configure-windows 'summary-faq))))
6281 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6282 (defun gnus-summary-describe-group (&optional force)
6283 "Describe the current newsgroup."
6285 (gnus-group-describe-group force gnus-newsgroup-name))
6287 (defun gnus-summary-describe-briefly ()
6288 "Describe summary mode commands briefly."
6290 (gnus-message 6 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
6292 ;; Walking around group mode buffer from summary mode.
6294 (defun gnus-summary-next-group (&optional no-article target-group backward)
6295 "Exit current newsgroup and then select next unread newsgroup.
6296 If prefix argument NO-ARTICLE is non-nil, no article is selected
6297 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
6298 previous group instead."
6300 ;; Stop pre-fetching.
6301 (gnus-async-halt-prefetch)
6302 (let ((current-group gnus-newsgroup-name)
6303 (current-buffer (current-buffer))
6305 ;; First we semi-exit this group to update Xrefs and all variables.
6306 ;; We can't do a real exit, because the window conf must remain
6307 ;; the same in case the user is prompted for info, and we don't
6308 ;; want the window conf to change before that...
6309 (gnus-summary-exit t)
6310 (while (not entered)
6311 ;; Then we find what group we are supposed to enter.
6312 (set-buffer gnus-group-buffer)
6313 (gnus-group-jump-to-group current-group)
6316 (if (eq gnus-keep-same-level 'best)
6317 (gnus-summary-best-group gnus-newsgroup-name)
6318 (gnus-summary-search-group backward gnus-keep-same-level))))
6319 (if (not target-group)
6320 ;; There are no further groups, so we return to the group
6323 (gnus-message 5 "Returning to the group buffer")
6325 (when (gnus-buffer-live-p current-buffer)
6326 (set-buffer current-buffer)
6327 (gnus-summary-exit))
6328 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6329 ;; We try to enter the target group.
6330 (gnus-group-jump-to-group target-group)
6331 (let ((unreads (gnus-group-group-unread)))
6332 (if (and (or (eq t unreads)
6333 (and unreads (not (zerop unreads))))
6334 (gnus-summary-read-group
6335 target-group nil no-article
6336 (and (buffer-name current-buffer) current-buffer)
6339 (setq current-group target-group
6340 target-group nil)))))))
6342 (defun gnus-summary-prev-group (&optional no-article)
6343 "Exit current newsgroup and then select previous unread newsgroup.
6344 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6346 (gnus-summary-next-group no-article nil t))
6348 ;; Walking around summary lines.
6350 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6351 "Go to the first unread subject.
6352 If UNREAD is non-nil, go to the first unread article.
6353 Returns the article selected or nil if there are no unread articles."
6358 ((null gnus-newsgroup-data)
6359 (gnus-message 3 "No articles in the group")
6361 ;; Pick the first article.
6363 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6364 (gnus-data-number (car gnus-newsgroup-data)))
6365 ;; No unread articles.
6366 ((null gnus-newsgroup-unreads)
6367 (gnus-message 3 "No more unread articles")
6369 ;; Find the first unread article.
6371 (let ((data gnus-newsgroup-data))
6373 (and (not (and undownloaded
6374 (eq gnus-undownloaded-mark
6375 (gnus-data-mark (car data)))))
6377 (memq (car data) gnus-newsgroup-unseen)))
6378 (not (gnus-data-unread-p (car data)))))
6379 (setq data (cdr data)))
6381 (goto-char (gnus-data-pos (car data)))
6382 (gnus-data-number (car data))))))
6383 (gnus-summary-position-point)))
6385 (defun gnus-summary-next-subject (n &optional unread dont-display)
6386 "Go to next N'th summary line.
6387 If N is negative, go to the previous N'th subject line.
6388 If UNREAD is non-nil, only unread articles are selected.
6389 The difference between N and the actual number of steps taken is
6392 (let ((backward (< n 0))
6396 (gnus-summary-find-prev unread)
6397 (gnus-summary-find-next unread)))
6398 (unless (zerop (setq n (1- n)))
6399 (gnus-summary-show-thread)))
6401 (gnus-message 7 "No more%s articles"
6402 (if unread " unread" "")))
6403 (unless dont-display
6404 (gnus-summary-recenter)
6405 (gnus-summary-position-point))
6408 (defun gnus-summary-next-unread-subject (n)
6409 "Go to next N'th unread summary line."
6411 (gnus-summary-next-subject n t))
6413 (defun gnus-summary-prev-subject (n &optional unread)
6414 "Go to previous N'th summary line.
6415 If optional argument UNREAD is non-nil, only unread article is selected."
6417 (gnus-summary-next-subject (- n) unread))
6419 (defun gnus-summary-prev-unread-subject (n)
6420 "Go to previous N'th unread summary line."
6422 (gnus-summary-next-subject (- n) t))
6424 (defun gnus-summary-goto-subject (article &optional force silent)
6425 "Go the subject line of ARTICLE.
6426 If FORCE, also allow jumping to articles not currently shown."
6427 (interactive "nArticle number: ")
6429 (data (gnus-data-find article)))
6430 ;; We read in the article if we have to.
6433 (gnus-summary-insert-subject
6435 (if (or (numberp force) (vectorp force)) force)
6437 (setq data (gnus-data-find article)))
6442 (gnus-message 3 "Can't find article %d" article))
6444 (let ((pt (gnus-data-pos data)))
6446 (gnus-summary-set-article-display-arrow pt))
6447 (gnus-summary-position-point)
6450 ;; Walking around summary lines with displaying articles.
6452 (defun gnus-summary-expand-window (&optional arg)
6453 "Make the summary buffer take up the entire Emacs frame.
6454 Given a prefix, will force an `article' buffer configuration."
6457 (gnus-configure-windows 'article 'force)
6458 (gnus-configure-windows 'summary 'force)))
6460 (defun gnus-summary-display-article (article &optional all-header)
6461 "Display ARTICLE in article buffer."
6462 (when (gnus-buffer-live-p gnus-article-buffer)
6463 (with-current-buffer gnus-article-buffer
6464 (set-buffer-multibyte t)))
6465 (gnus-set-global-variables)
6466 (when (gnus-buffer-live-p gnus-article-buffer)
6467 (with-current-buffer gnus-article-buffer
6468 (setq gnus-article-charset gnus-newsgroup-charset)
6469 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)))
6473 (if gnus-summary-display-article-function
6474 (funcall gnus-summary-display-article-function article all-header)
6475 (gnus-article-prepare article all-header))
6476 (with-current-buffer gnus-article-buffer
6477 (set (make-local-variable 'gnus-summary-search-article-matched-data)
6479 (gnus-run-hooks 'gnus-select-article-hook)
6480 (when (and gnus-current-article
6481 (not (zerop gnus-current-article)))
6482 (gnus-summary-goto-subject gnus-current-article))
6483 (gnus-summary-recenter)
6484 (when (and gnus-use-trees gnus-show-threads)
6485 (gnus-possibly-generate-tree article)
6486 (gnus-highlight-selected-tree article))
6487 ;; Successfully display article.
6488 (gnus-article-set-window-start
6489 (cdr (assq article gnus-newsgroup-bookmarks))))))
6491 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
6492 "Select the current article.
6493 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
6494 non-nil, the article will be re-fetched even if it already present in
6495 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
6497 ;; Make sure we are in the summary buffer to work around bbdb bug.
6498 (unless (eq major-mode 'gnus-summary-mode)
6499 (set-buffer gnus-summary-buffer))
6500 (let ((article (or article (gnus-summary-article-number)))
6501 (all-headers (not (not all-headers))) ;Must be T or NIL.
6502 gnus-summary-display-article-function)
6504 (gnus-summary-article-pseudo-p article)
6505 (error "This is a pseudo-article"))
6507 (set-buffer gnus-summary-buffer)
6508 (if (or (and gnus-single-article-buffer
6509 (or (null gnus-current-article)
6510 (null gnus-article-current)
6511 (null (get-buffer gnus-article-buffer))
6512 (not (eq article (cdr gnus-article-current)))
6513 (not (equal (car gnus-article-current)
6514 gnus-newsgroup-name))))
6515 (and (not gnus-single-article-buffer)
6516 (or (null gnus-current-article)
6517 (not (eq gnus-current-article article))))
6519 ;; The requested article is different from the current article.
6521 (gnus-summary-display-article article all-headers)
6522 (when (or all-headers gnus-show-all-headers)
6523 (gnus-article-show-all-headers))
6524 (gnus-article-set-window-start
6525 (cdr (assq article gnus-newsgroup-bookmarks)))
6527 (when (or all-headers gnus-show-all-headers)
6528 (gnus-article-show-all-headers))
6531 (defun gnus-summary-force-verify-and-decrypt ()
6533 (let ((mm-verify-option 'known)
6534 (mm-decrypt-option 'known))
6535 (gnus-summary-select-article nil 'force)))
6537 (defun gnus-summary-set-current-mark (&optional current-mark)
6538 "Obsolete function."
6541 (defun gnus-summary-next-article (&optional unread subject backward push)
6542 "Select the next article.
6543 If UNREAD, only unread articles are selected.
6544 If SUBJECT, only articles with SUBJECT are selected.
6545 If BACKWARD, the previous article is selected instead of the next."
6548 ;; Is there such an article?
6549 ((and (gnus-summary-search-forward unread subject backward)
6550 (or (gnus-summary-display-article (gnus-summary-article-number))
6551 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
6552 (gnus-summary-position-point))
6553 ;; If not, we try the first unread, if that is wanted.
6555 gnus-auto-select-same
6556 (gnus-summary-first-unread-article))
6557 (gnus-summary-position-point)
6558 (gnus-message 6 "Wrapped"))
6559 ;; Try to get next/previous article not displayed in this group.
6560 ((and gnus-auto-extend-newsgroup
6561 (not unread) (not subject))
6562 (gnus-summary-goto-article
6563 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
6564 nil (count-lines (point-min) (point))))
6565 ;; Go to next/previous group.
6567 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
6568 (gnus-summary-jump-to-group gnus-newsgroup-name))
6569 (let ((cmd last-command-char)
6572 (set-buffer gnus-group-buffer)
6575 (if (eq gnus-keep-same-level 'best)
6576 (gnus-summary-best-group gnus-newsgroup-name)
6577 (gnus-summary-search-group backward gnus-keep-same-level))))
6578 ;; For some reason, the group window gets selected. We change
6580 (select-window (get-buffer-window (current-buffer)))
6581 ;; Select next unread newsgroup automagically.
6583 ((or (not gnus-auto-select-next)
6585 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6586 ((or (eq gnus-auto-select-next 'quietly)
6587 (and (eq gnus-auto-select-next 'slightly-quietly)
6589 (and (eq gnus-auto-select-next 'almost-quietly)
6590 (gnus-summary-last-article-p)))
6592 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6594 (gnus-message 7 "No more%s articles (%s)..."
6595 (if unread " unread" "")
6596 (if group (concat "selecting " group)
6598 (gnus-summary-next-group nil group backward)))
6600 (when (gnus-key-press-event-p last-input-event)
6601 (gnus-summary-walk-group-buffer
6602 gnus-newsgroup-name cmd unread backward point))))))))
6604 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6605 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6606 (?\C-p (gnus-group-prev-unread-group 1))))
6607 (cursor-in-echo-area t)
6608 keve key group ended)
6610 (set-buffer gnus-group-buffer)
6613 (if (eq gnus-keep-same-level 'best)
6614 (gnus-summary-best-group gnus-newsgroup-name)
6615 (gnus-summary-search-group backward gnus-keep-same-level))))
6618 5 "No more%s articles%s" (if unread " unread" "")
6620 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
6621 (format " (Type %s for %s [%s])"
6622 (single-key-description cmd) group
6623 (car (gnus-gethash group gnus-newsrc-hashtb)))
6624 (format " (Type %s to exit %s)"
6625 (single-key-description cmd)
6626 gnus-newsgroup-name)))
6627 ;; Confirm auto selection.
6628 (setq key (car (setq keve (gnus-read-event-char))))
6631 ((assq key keystrokes)
6632 (let ((obuf (current-buffer)))
6633 (switch-to-buffer gnus-group-buffer)
6635 (gnus-group-jump-to-group group))
6636 (eval (cadr (assq key keystrokes)))
6637 (setq group (gnus-group-group-name))
6638 (switch-to-buffer obuf))
6642 (gnus-ephemeral-group-p gnus-newsgroup-name))
6644 (gnus-summary-next-group nil group backward)))
6646 (push (cdr keve) unread-command-events))))))
6648 (defun gnus-summary-next-unread-article ()
6649 "Select unread article after current one."
6651 (gnus-summary-next-article
6652 (or (not (eq gnus-summary-goto-unread 'never))
6653 (gnus-summary-last-article-p (gnus-summary-article-number)))
6654 (and gnus-auto-select-same
6655 (gnus-summary-article-subject))))
6657 (defun gnus-summary-prev-article (&optional unread subject)
6658 "Select the article after the current one.
6659 If UNREAD is non-nil, only unread articles are selected."
6661 (gnus-summary-next-article unread subject t))
6663 (defun gnus-summary-prev-unread-article ()
6664 "Select unread article before current one."
6666 (gnus-summary-prev-article
6667 (or (not (eq gnus-summary-goto-unread 'never))
6668 (gnus-summary-first-article-p (gnus-summary-article-number)))
6669 (and gnus-auto-select-same
6670 (gnus-summary-article-subject))))
6672 (defun gnus-summary-next-page (&optional lines circular)
6673 "Show next page of the selected article.
6674 If at the end of the current article, select the next article.
6675 LINES says how many lines should be scrolled up.
6677 If CIRCULAR is non-nil, go to the start of the article instead of
6678 selecting the next article when reaching the end of the current
6681 (setq gnus-summary-buffer (current-buffer))
6682 (gnus-set-global-variables)
6683 (let ((article (gnus-summary-article-number))
6684 (article-window (get-buffer-window gnus-article-buffer t))
6686 ;; If the buffer is empty, we have no article.
6688 (error "No article to select"))
6689 (gnus-configure-windows 'article)
6690 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6691 (if (and (eq gnus-summary-goto-unread 'never)
6692 (not (gnus-summary-last-article-p article)))
6693 (gnus-summary-next-article)
6694 (gnus-summary-next-unread-article))
6695 (if (or (null gnus-current-article)
6696 (null gnus-article-current)
6697 (/= article (cdr gnus-article-current))
6698 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6699 ;; Selected subject is different from current article's.
6700 (gnus-summary-display-article article)
6701 (when article-window
6702 (gnus-eval-in-buffer-window gnus-article-buffer
6703 (setq endp (gnus-article-next-page lines)))
6706 (gnus-summary-beginning-of-article))
6708 (gnus-message 3 "End of message"))
6710 (if (and (eq gnus-summary-goto-unread 'never)
6711 (not (gnus-summary-last-article-p article)))
6712 (gnus-summary-next-article)
6713 (gnus-summary-next-unread-article))))))))
6714 (gnus-summary-recenter)
6715 (gnus-summary-position-point)))
6717 (defun gnus-summary-prev-page (&optional lines move)
6718 "Show previous page of selected article.
6719 Argument LINES specifies lines to be scrolled down.
6720 If MOVE, move to the previous unread article if point is at
6721 the beginning of the buffer."
6723 (let ((article (gnus-summary-article-number))
6724 (article-window (get-buffer-window gnus-article-buffer t))
6726 (gnus-configure-windows 'article)
6727 (if (or (null gnus-current-article)
6728 (null gnus-article-current)
6729 (/= article (cdr gnus-article-current))
6730 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6731 ;; Selected subject is different from current article's.
6732 (gnus-summary-display-article article)
6733 (gnus-summary-recenter)
6734 (when article-window
6735 (gnus-eval-in-buffer-window gnus-article-buffer
6736 (setq endp (gnus-article-prev-page lines)))
6737 (when (and move endp)
6739 (gnus-message 3 "Beginning of message"))
6741 (if (and (eq gnus-summary-goto-unread 'never)
6742 (not (gnus-summary-first-article-p article)))
6743 (gnus-summary-prev-article)
6744 (gnus-summary-prev-unread-article))))))))
6745 (gnus-summary-position-point))
6747 (defun gnus-summary-prev-page-or-article (&optional lines)
6748 "Show previous page of selected article.
6749 Argument LINES specifies lines to be scrolled down.
6750 If at the beginning of the article, go to the next article."
6752 (gnus-summary-prev-page lines t))
6754 (defun gnus-summary-scroll-up (lines)
6755 "Scroll up (or down) one line current article.
6756 Argument LINES specifies lines to be scrolled up (or down if negative)."
6758 (gnus-configure-windows 'article)
6759 (gnus-summary-show-thread)
6760 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6761 (gnus-eval-in-buffer-window gnus-article-buffer
6763 (when (gnus-article-next-page lines)
6764 (gnus-message 3 "End of message")))
6766 (gnus-article-prev-page (- lines))))))
6767 (gnus-summary-recenter)
6768 (gnus-summary-position-point))
6770 (defun gnus-summary-scroll-down (lines)
6771 "Scroll down (or up) one line current article.
6772 Argument LINES specifies lines to be scrolled down (or up if negative)."
6774 (gnus-summary-scroll-up (- lines)))
6776 (defun gnus-summary-next-same-subject ()
6777 "Select next article which has the same subject as current one."
6779 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6781 (defun gnus-summary-prev-same-subject ()
6782 "Select previous article which has the same subject as current one."
6784 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6786 (defun gnus-summary-next-unread-same-subject ()
6787 "Select next unread article which has the same subject as current one."
6789 (gnus-summary-next-article t (gnus-summary-article-subject)))
6791 (defun gnus-summary-prev-unread-same-subject ()
6792 "Select previous unread article which has the same subject as current one."
6794 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6796 (defun gnus-summary-first-unread-article ()
6797 "Select the first unread article.
6798 Return nil if there are no unread articles."
6801 (when (gnus-summary-first-subject t)
6802 (gnus-summary-show-thread)
6803 (gnus-summary-first-subject t)
6804 (gnus-summary-display-article (gnus-summary-article-number)))
6805 (gnus-summary-position-point)))
6807 (defun gnus-summary-first-unread-subject ()
6808 "Place the point on the subject line of the first unread article.
6809 Return nil if there are no unread articles."
6812 (when (gnus-summary-first-subject t)
6813 (gnus-summary-show-thread)
6814 (gnus-summary-first-subject t))
6815 (gnus-summary-position-point)))
6817 (defun gnus-summary-first-unseen-subject ()
6818 "Place the point on the subject line of the first unseen article.
6819 Return nil if there are no unseen articles."
6822 (when (gnus-summary-first-subject t t t)
6823 (gnus-summary-show-thread)
6824 (gnus-summary-first-subject t t t))
6825 (gnus-summary-position-point)))
6827 (defun gnus-summary-first-article ()
6828 "Select the first article.
6829 Return nil if there are no articles."
6832 (when (gnus-summary-first-subject)
6833 (gnus-summary-show-thread)
6834 (gnus-summary-first-subject)
6835 (gnus-summary-display-article (gnus-summary-article-number)))
6836 (gnus-summary-position-point)))
6838 (defun gnus-summary-best-unread-article (&optional arg)
6839 "Select the unread article with the highest score.
6840 If given a prefix argument, select the next unread article that has a
6841 score higher than the default score."
6843 (let ((article (if arg
6844 (gnus-summary-better-unread-subject)
6845 (gnus-summary-best-unread-subject))))
6847 (gnus-summary-goto-article article)
6848 (error "No unread articles"))))
6850 (defun gnus-summary-best-unread-subject ()
6851 "Select the unread subject with the highest score."
6853 (let ((best -1000000)
6854 (data gnus-newsgroup-data)
6857 (and (gnus-data-unread-p (car data))
6859 (gnus-summary-article-score (gnus-data-number (car data))))
6862 article (gnus-data-number (car data))))
6863 (setq data (cdr data)))
6865 (gnus-summary-goto-subject article))
6866 (gnus-summary-position-point)
6869 (defun gnus-summary-better-unread-subject ()
6870 "Select the first unread subject that has a score over the default score."
6872 (let ((data gnus-newsgroup-data)
6874 (while (and (setq article (gnus-data-number (car data)))
6875 (or (gnus-data-read-p (car data))
6876 (not (> (gnus-summary-article-score article)
6877 gnus-summary-default-score))))
6878 (setq data (cdr data)))
6880 (gnus-summary-goto-subject article))
6881 (gnus-summary-position-point)
6884 (defun gnus-summary-last-subject ()
6885 "Go to the last displayed subject line in the group."
6886 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6888 (gnus-summary-goto-subject article))))
6890 (defun gnus-summary-goto-article (article &optional all-headers force)
6891 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6892 If ALL-HEADERS is non-nil, no header lines are hidden.
6893 If FORCE, go to the article even if it isn't displayed. If FORCE
6894 is a number, it is the line the article is to be displayed on."
6898 "Article number or Message-ID: "
6899 (mapcar (lambda (number) (list (int-to-string number)))
6900 gnus-newsgroup-limit))
6904 (if (and (stringp article)
6905 (string-match "@" article))
6906 (gnus-summary-refer-article article)
6907 (when (stringp article)
6908 (setq article (string-to-number article)))
6909 (if (gnus-summary-goto-subject article force)
6910 (gnus-summary-display-article article all-headers)
6911 (gnus-message 4 "Couldn't go to article %s" article) nil))
6912 (gnus-summary-position-point)))
6914 (defun gnus-summary-goto-last-article ()
6915 "Go to the previously read article."
6918 (when gnus-last-article
6919 (gnus-summary-goto-article gnus-last-article nil t))
6920 (gnus-summary-position-point)))
6922 (defun gnus-summary-pop-article (number)
6923 "Pop one article off the history and go to the previous.
6924 NUMBER articles will be popped off."
6927 (setq gnus-newsgroup-history
6928 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6930 (gnus-summary-goto-article (car to) nil t)
6931 (error "Article history empty")))
6932 (gnus-summary-position-point))
6934 ;; Summary commands and functions for limiting the summary buffer.
6936 (defun gnus-summary-limit-to-articles (n)
6937 "Limit the summary buffer to the next N articles.
6938 If not given a prefix, use the process marked articles instead."
6941 (let ((articles (gnus-summary-work-articles n)))
6942 (setq gnus-newsgroup-processable nil)
6943 (gnus-summary-limit articles))
6944 (gnus-summary-position-point)))
6946 (defun gnus-summary-pop-limit (&optional total)
6947 "Restore the previous limit.
6948 If given a prefix, remove all limits."
6951 (setq gnus-newsgroup-limits
6952 (list (mapcar (lambda (h) (mail-header-number h))
6953 gnus-newsgroup-headers))))
6954 (unless gnus-newsgroup-limits
6955 (error "No limit to pop"))
6957 (gnus-summary-limit nil 'pop)
6958 (gnus-summary-position-point)))
6960 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
6961 "Limit the summary buffer to articles that have subjects that match a regexp.
6962 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
6964 (list (read-string (if current-prefix-arg
6965 "Exclude subject (regexp): "
6966 "Limit to subject (regexp): "))
6967 nil current-prefix-arg))
6969 (setq header "subject"))
6970 (when (not (equal "" subject))
6972 (let ((articles (gnus-summary-find-matching
6973 (or header "subject") subject 'all nil nil
6976 (error "Found no matches for \"%s\"" subject))
6977 (gnus-summary-limit articles))
6978 (gnus-summary-position-point))))
6980 (defun gnus-summary-limit-to-author (from &optional not-matching)
6981 "Limit the summary buffer to articles that have authors that match a regexp.
6982 If NOT-MATCHING, excluding articles that have authors that match a regexp."
6984 (list (read-string (if current-prefix-arg
6985 "Exclude author (regexp): "
6986 "Limit to author (regexp): "))
6987 current-prefix-arg))
6988 (gnus-summary-limit-to-subject from "from" not-matching))
6990 (defun gnus-summary-limit-to-age (age &optional younger-p)
6991 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6992 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6993 articles that are younger than AGE days."
6995 (let ((younger current-prefix-arg)
6998 (while (not days-got)
6999 (setq days (if younger
7000 (read-string "Limit to articles within (in days): ")
7001 (read-string "Limit to articles older than (in days): ")))
7002 (when (> (length days) 0)
7003 (setq days (read days)))
7009 (setq younger (not younger))
7010 (setq days (* days -1)))))
7011 (message "Please enter a number.")
7013 (list days younger)))
7015 (let ((data gnus-newsgroup-data)
7016 (cutoff (days-to-time age))
7017 articles d date is-younger)
7018 (while (setq d (pop data))
7019 (when (and (vectorp (gnus-data-header d))
7020 (setq date (mail-header-date (gnus-data-header d))))
7021 (setq is-younger (time-less-p
7022 (time-since (condition-case ()
7029 (push (gnus-data-number d) articles))))
7030 (gnus-summary-limit (nreverse articles)))
7031 (gnus-summary-position-point)))
7033 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7034 "Limit the summary buffer to articles that match an 'extra' header."
7038 (gnus-completing-read
7039 (symbol-name (car gnus-extra-headers))
7040 (if current-prefix-arg
7041 "Exclude extra header:"
7042 "Limit extra header:")
7044 (cons (symbol-name x) x))
7049 (read-string (format "%s header %s (regexp): "
7050 (if current-prefix-arg "Exclude" "Limit to")
7052 current-prefix-arg)))
7053 (when (not (equal "" regexp))
7055 (let ((articles (gnus-summary-find-matching
7056 (cons 'extra header) regexp 'all nil nil
7059 (error "Found no matches for \"%s\"" regexp))
7060 (gnus-summary-limit articles))
7061 (gnus-summary-position-point))))
7063 (defun gnus-summary-limit-to-display-predicate ()
7064 "Limit the summary buffer to the predicated in the `display' group parameter."
7066 (unless gnus-newsgroup-display
7067 (error "There is no `display' group parameter"))
7069 (dolist (number gnus-newsgroup-articles)
7070 (when (funcall gnus-newsgroup-display)
7071 (push number articles)))
7072 (gnus-summary-limit articles))
7073 (gnus-summary-position-point))
7075 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7077 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7079 (defun gnus-summary-limit-to-unread (&optional all)
7080 "Limit the summary buffer to articles that are not marked as read.
7081 If ALL is non-nil, limit strictly to unread articles."
7084 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7085 (gnus-summary-limit-to-marks
7086 ;; Concat all the marks that say that an article is read and have
7088 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7089 gnus-killed-mark gnus-kill-file-mark
7090 gnus-low-score-mark gnus-expirable-mark
7091 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7092 gnus-duplicate-mark gnus-souped-mark)
7095 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7096 (make-obsolete 'gnus-summary-delete-marked-with
7097 'gnus-summary-limit-exlude-marks)
7099 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7100 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7101 If REVERSE, limit the summary buffer to articles that are marked
7102 with MARKS. MARKS can either be a string of marks or a list of marks.
7103 Returns how many articles were removed."
7104 (interactive "sMarks: ")
7105 (gnus-summary-limit-to-marks marks t))
7107 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7108 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7109 If REVERSE (the prefix), limit the summary buffer to articles that are
7110 not marked with MARKS. MARKS can either be a string of marks or a
7112 Returns how many articles were removed."
7113 (interactive "sMarks: \nP")
7115 (let ((data gnus-newsgroup-data)
7116 (marks (if (listp marks) marks
7117 (append marks nil))) ; Transform to list.
7120 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7121 (memq (gnus-data-mark (car data)) marks))
7122 (push (gnus-data-number (car data)) articles))
7123 (setq data (cdr data)))
7124 (gnus-summary-limit articles))
7125 (gnus-summary-position-point)))
7127 (defun gnus-summary-limit-to-score (score)
7128 "Limit to articles with score at or above SCORE."
7129 (interactive "NLimit to articles with score of at least: ")
7130 (let ((data gnus-newsgroup-data)
7133 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7135 (push (gnus-data-number (car data)) articles))
7136 (setq data (cdr data)))
7138 (gnus-summary-limit articles)
7139 (gnus-summary-position-point))))
7141 (defun gnus-summary-limit-include-thread (id)
7142 "Display all the hidden articles that is in the thread with ID in it.
7143 When called interactively, ID is the Message-ID of the current
7145 (interactive (list (mail-header-id (gnus-summary-article-header))))
7146 (let ((articles (gnus-articles-in-thread
7147 (gnus-id-to-thread (gnus-root-id id)))))
7149 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7150 (gnus-summary-limit-include-matching-articles
7152 (regexp-quote (gnus-simplify-subject-re
7153 (mail-header-subject (gnus-id-to-header id)))))
7154 (gnus-summary-position-point))))
7156 (defun gnus-summary-limit-include-matching-articles (header regexp)
7157 "Display all the hidden articles that have HEADERs that match REGEXP."
7158 (interactive (list (read-string "Match on header: ")
7159 (read-string "Regexp: ")))
7160 (let ((articles (gnus-find-matching-articles header regexp)))
7162 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7163 (gnus-summary-position-point))))
7165 (defun gnus-summary-limit-include-dormant ()
7166 "Display all the hidden articles that are marked as dormant.
7167 Note that this command only works on a subset of the articles currently
7168 fetched for this group."
7170 (unless gnus-newsgroup-dormant
7171 (error "There are no dormant articles in this group"))
7173 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7174 (gnus-summary-position-point)))
7176 (defun gnus-summary-limit-exclude-dormant ()
7177 "Hide all dormant articles."
7180 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7181 (gnus-summary-position-point)))
7183 (defun gnus-summary-limit-exclude-childless-dormant ()
7184 "Hide all dormant articles that have no children."
7186 (let ((data (gnus-data-list t))
7187 articles d children)
7188 ;; Find all articles that are either not dormant or have
7190 (while (setq d (pop data))
7191 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7193 (gnus-article-children (gnus-data-number d)))
7196 (when (memq (car children) articles)
7201 (push (gnus-data-number d) articles)))
7204 (gnus-summary-limit articles)
7205 (gnus-summary-position-point))))
7207 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7208 "Mark all unread excluded articles as read.
7209 If ALL, mark even excluded ticked and dormants as read."
7211 (let ((articles (gnus-sorted-complement
7213 (mapcar (lambda (h) (mail-header-number h))
7214 gnus-newsgroup-headers)
7216 (sort gnus-newsgroup-limit '<)))
7218 (setq gnus-newsgroup-unreads
7219 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
7221 (setq gnus-newsgroup-dormant nil
7222 gnus-newsgroup-marked nil
7223 gnus-newsgroup-reads
7225 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7226 gnus-newsgroup-reads))
7227 (while (setq article (pop articles))
7228 (unless (or (memq article gnus-newsgroup-dormant)
7229 (memq article gnus-newsgroup-marked))
7230 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7232 (defun gnus-summary-limit (articles &optional pop)
7234 ;; We pop the previous limit off the stack and use that.
7235 (setq articles (car gnus-newsgroup-limits)
7236 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7237 ;; We use the new limit, so we push the old limit on the stack.
7238 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7240 (setq gnus-newsgroup-limit articles)
7241 (let ((total (length gnus-newsgroup-data))
7242 (data (gnus-data-find-list (gnus-summary-article-number)))
7243 (gnus-summary-mark-below nil) ; Inhibit this.
7245 ;; This will do all the work of generating the new summary buffer
7246 ;; according to the new limit.
7247 (gnus-summary-prepare)
7248 ;; Hide any threads, possibly.
7249 (and gnus-show-threads
7250 gnus-thread-hide-subtree
7251 (gnus-summary-hide-all-threads))
7252 ;; Try to return to the article you were at, or one in the
7255 ;; We try to find some article after the current one.
7257 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7260 (setq data (cdr data))))
7262 ;; If there is no data, that means that we were after the last
7263 ;; article. The same goes when we can't find any articles
7264 ;; after the current one.
7265 (goto-char (point-max))
7266 (gnus-summary-find-prev))
7267 (gnus-set-mode-line 'summary)
7268 ;; We return how many articles were removed from the summary
7269 ;; buffer as a result of the new limit.
7270 (- total (length gnus-newsgroup-data))))
7272 (defsubst gnus-invisible-cut-children (threads)
7275 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7280 (defsubst gnus-cut-thread (thread)
7281 "Go forwards in the thread until we find an article that we want to display."
7282 (when (or (eq gnus-fetch-old-headers 'some)
7283 (eq gnus-fetch-old-headers 'invisible)
7284 (numberp gnus-fetch-old-headers)
7285 (eq gnus-build-sparse-threads 'some)
7286 (eq gnus-build-sparse-threads 'more))
7287 ;; Deal with old-fetched headers and sparse threads.
7291 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7292 (gnus-summary-article-ancient-p
7293 (mail-header-number (car thread))))
7294 (if (or (<= (length (cdr thread)) 1)
7295 (eq gnus-fetch-old-headers 'invisible))
7296 (setq gnus-newsgroup-limit
7297 (delq (mail-header-number (car thread))
7298 gnus-newsgroup-limit)
7299 thread (cadr thread))
7300 (when (gnus-invisible-cut-children (cdr thread))
7301 (let ((th (cdr thread)))
7303 (if (memq (mail-header-number (caar th))
7304 gnus-newsgroup-limit)
7305 (setq thread (car th)
7307 (setq th (cdr th))))))))))
7310 (defun gnus-cut-threads (threads)
7311 "Cut off all uninteresting articles from the beginning of threads."
7312 (when (or (eq gnus-fetch-old-headers 'some)
7313 (eq gnus-fetch-old-headers 'invisible)
7314 (numberp gnus-fetch-old-headers)
7315 (eq gnus-build-sparse-threads 'some)
7316 (eq gnus-build-sparse-threads 'more))
7319 (setcar th (gnus-cut-thread (car th)))
7320 (setq th (cdr th)))))
7321 ;; Remove nixed out threads.
7324 (defun gnus-summary-initial-limit (&optional show-if-empty)
7325 "Figure out what the initial limit is supposed to be on group entry.
7326 This entails weeding out unwanted dormants, low-scored articles,
7327 fetch-old-headers verbiage, and so on."
7328 ;; Most groups have nothing to remove.
7329 (if (or gnus-inhibit-limiting
7330 (and (null gnus-newsgroup-dormant)
7331 (eq gnus-newsgroup-display 'gnus-not-ignore)
7332 (not (eq gnus-fetch-old-headers 'some))
7333 (not (numberp gnus-fetch-old-headers))
7334 (not (eq gnus-fetch-old-headers 'invisible))
7335 (null gnus-summary-expunge-below)
7336 (not (eq gnus-build-sparse-threads 'some))
7337 (not (eq gnus-build-sparse-threads 'more))
7338 (null gnus-thread-expunge-below)
7339 (not gnus-use-nocem)))
7341 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7342 (setq gnus-newsgroup-limit nil)
7345 (unless (car (symbol-value node))
7346 ;; These threads have no parents -- they are roots.
7347 (let ((nodes (cdr (symbol-value node)))
7350 (if (and gnus-thread-expunge-below
7351 (< (gnus-thread-total-score (car nodes))
7352 gnus-thread-expunge-below))
7353 (gnus-expunge-thread (pop nodes))
7354 (setq thread (pop nodes))
7355 (gnus-summary-limit-children thread))))))
7356 gnus-newsgroup-dependencies)
7357 ;; If this limitation resulted in an empty group, we might
7358 ;; pop the previous limit and use it instead.
7359 (when (and (not gnus-newsgroup-limit)
7361 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7362 gnus-newsgroup-limit))
7364 (defun gnus-summary-limit-children (thread)
7365 "Return 1 if this subthread is visible and 0 if it is not."
7366 ;; First we get the number of visible children to this thread. This
7367 ;; is done by recursing down the thread using this function, so this
7368 ;; will really go down to a leaf article first, before slowly
7369 ;; working its way up towards the root.
7373 (apply '+ (mapcar 'gnus-summary-limit-children
7376 (number (mail-header-number (car thread)))
7379 (not (memq number gnus-newsgroup-marked))
7381 ;; If this article is dormant and has absolutely no visible
7382 ;; children, then this article isn't visible.
7383 (and (memq number gnus-newsgroup-dormant)
7385 ;; If this is "fetch-old-headered" and there is no
7386 ;; visible children, then we don't want this article.
7387 (and (or (eq gnus-fetch-old-headers 'some)
7388 (numberp gnus-fetch-old-headers))
7389 (gnus-summary-article-ancient-p number)
7391 ;; If this is "fetch-old-headered" and `invisible', then
7392 ;; we don't want this article.
7393 (and (eq gnus-fetch-old-headers 'invisible)
7394 (gnus-summary-article-ancient-p number))
7395 ;; If this is a sparsely inserted article with no children,
7396 ;; we don't want it.
7397 (and (eq gnus-build-sparse-threads 'some)
7398 (gnus-summary-article-sparse-p number)
7400 ;; If we use expunging, and this article is really
7401 ;; low-scored, then we don't want this article.
7402 (when (and gnus-summary-expunge-below
7404 (or (cdr (assq number gnus-newsgroup-scored))
7405 gnus-summary-default-score))
7406 gnus-summary-expunge-below))
7407 ;; We increase the expunge-tally here, but that has
7408 ;; nothing to do with the limits, really.
7409 (incf gnus-newsgroup-expunged-tally)
7410 ;; We also mark as read here, if that's wanted.
7411 (when (and gnus-summary-mark-below
7412 (< score gnus-summary-mark-below))
7413 (setq gnus-newsgroup-unreads
7414 (delq number gnus-newsgroup-unreads))
7415 (if gnus-newsgroup-auto-expire
7416 (push number gnus-newsgroup-expirable)
7417 (push (cons number gnus-low-score-mark)
7418 gnus-newsgroup-reads)))
7420 ;; Do the `display' group parameter.
7421 (and gnus-newsgroup-display
7422 (not (funcall gnus-newsgroup-display)))
7423 ;; Check NoCeM things.
7424 (if (and gnus-use-nocem
7425 (gnus-nocem-unwanted-article-p
7426 (mail-header-id (car thread))))
7428 (setq gnus-newsgroup-unreads
7429 (delq number gnus-newsgroup-unreads))
7431 ;; Nope, invisible article.
7433 ;; Ok, this article is to be visible, so we add it to the limit
7435 (push number gnus-newsgroup-limit)
7438 (defun gnus-expunge-thread (thread)
7439 "Mark all articles in THREAD as read."
7440 (let* ((number (mail-header-number (car thread))))
7441 (incf gnus-newsgroup-expunged-tally)
7442 ;; We also mark as read here, if that's wanted.
7443 (setq gnus-newsgroup-unreads
7444 (delq number gnus-newsgroup-unreads))
7445 (if gnus-newsgroup-auto-expire
7446 (push number gnus-newsgroup-expirable)
7447 (push (cons number gnus-low-score-mark)
7448 gnus-newsgroup-reads)))
7449 ;; Go recursively through all subthreads.
7450 (mapcar 'gnus-expunge-thread (cdr thread)))
7452 ;; Summary article oriented commands
7454 (defun gnus-summary-refer-parent-article (n)
7455 "Refer parent article N times.
7456 If N is negative, go to ancestor -N instead.
7457 The difference between N and the number of articles fetched is returned."
7461 (when (not (natnump n))
7466 (setq header (gnus-summary-article-header))
7467 (if (and (eq (mail-header-number header)
7468 (cdr gnus-article-current))
7469 (equal gnus-newsgroup-name
7470 (car gnus-article-current)))
7471 ;; If we try to find the parent of the currently
7472 ;; displayed article, then we take a look at the actual
7473 ;; References header, since this is slightly more
7474 ;; reliable than the References field we got from the
7477 (set-buffer gnus-original-article-buffer)
7478 (nnheader-narrow-to-headers)
7479 (unless (setq ref (message-fetch-field "references"))
7480 (setq ref (message-fetch-field "in-reply-to")))
7483 ;; It's not the current article, so we take a bet on
7484 ;; the value we got from the server.
7485 (mail-header-references header)))
7487 (not (equal ref "")))
7488 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
7489 (gnus-message 1 "Couldn't find parent"))
7490 (gnus-message 1 "No references in article %d"
7491 (gnus-summary-article-number))
7494 (gnus-summary-position-point)
7497 (defun gnus-summary-refer-references ()
7498 "Fetch all articles mentioned in the References header.
7499 Return the number of articles fetched."
7501 (let ((ref (mail-header-references (gnus-summary-article-header)))
7502 (current (gnus-summary-article-number))
7506 (error "No References in the current article")
7507 ;; For each Message-ID in the References header...
7508 (while (string-match "<[^>]*>" ref)
7510 ;; ... fetch that article.
7511 (gnus-summary-refer-article
7512 (prog1 (match-string 0 ref)
7513 (setq ref (substring ref (match-end 0))))))
7514 (gnus-summary-goto-subject current)
7515 (gnus-summary-position-point)
7518 (defun gnus-summary-refer-thread (&optional limit)
7519 "Fetch all articles in the current thread.
7520 If LIMIT (the numerical prefix), fetch that many old headers instead
7521 of what's specified by the `gnus-refer-thread-limit' variable."
7523 (let ((id (mail-header-id (gnus-summary-article-header)))
7524 (limit (if limit (prefix-numeric-value limit)
7525 gnus-refer-thread-limit)))
7526 ;; We want to fetch LIMIT *old* headers, but we also have to
7527 ;; re-fetch all the headers in the current buffer, because many of
7528 ;; them may be undisplayed. So we adjust LIMIT.
7529 (when (numberp limit)
7530 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
7531 (unless (eq gnus-fetch-old-headers 'invisible)
7532 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
7533 ;; Retrieve the headers and read them in.
7534 (if (eq (gnus-retrieve-headers
7535 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
7537 (gnus-build-all-threads)
7538 (error "Can't fetch thread from backends that don't support NOV"))
7539 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
7540 (gnus-summary-limit-include-thread id)))
7542 (defun gnus-summary-refer-article (message-id)
7543 "Fetch an article specified by MESSAGE-ID."
7544 (interactive "sMessage-ID: ")
7545 (when (and (stringp message-id)
7546 (not (zerop (length message-id))))
7547 ;; Construct the correct Message-ID if necessary.
7548 ;; Suggested by tale@pawl.rpi.edu.
7549 (unless (string-match "^<" message-id)
7550 (setq message-id (concat "<" message-id)))
7551 (unless (string-match ">$" message-id)
7552 (setq message-id (concat message-id ">")))
7553 (let* ((header (gnus-id-to-header message-id))
7555 (gnus-summary-article-sparse-p
7556 (mail-header-number header))
7557 (memq (mail-header-number header)
7558 gnus-newsgroup-limit)))
7561 ;; If the article is present in the buffer we just go to it.
7563 (or (not (gnus-summary-article-sparse-p
7564 (mail-header-number header)))
7567 (gnus-summary-goto-article
7568 (mail-header-number header) nil t)
7570 (gnus-summary-update-article (mail-header-number header)))))
7572 ;; We fetch the article.
7574 (dolist (gnus-override-method (gnus-refer-article-methods))
7575 (gnus-check-server gnus-override-method)
7576 ;; Fetch the header, and display the article.
7577 (when (setq number (gnus-summary-insert-subject message-id))
7578 (gnus-summary-select-article nil nil nil number)
7580 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
7582 (defun gnus-refer-article-methods ()
7583 "Return a list of referrable methods."
7585 ;; No method, so we default to current and native.
7586 ((null gnus-refer-article-method)
7587 (list gnus-current-select-method gnus-select-method))
7589 ((eq 'current gnus-refer-article-method)
7590 (list gnus-current-select-method))
7591 ;; List of select methods.
7592 ((not (and (symbolp (car gnus-refer-article-method))
7593 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
7595 (dolist (method gnus-refer-article-method)
7596 (push (if (eq 'current method)
7597 gnus-current-select-method
7601 ;; One single select method.
7603 (list gnus-refer-article-method))))
7605 (defun gnus-summary-edit-parameters ()
7606 "Edit the group parameters of the current group."
7608 (gnus-group-edit-group gnus-newsgroup-name 'params))
7610 (defun gnus-summary-customize-parameters ()
7611 "Customize the group parameters of the current group."
7613 (gnus-group-customize gnus-newsgroup-name))
7615 (defun gnus-summary-enter-digest-group (&optional force)
7616 "Enter an nndoc group based on the current article.
7617 If FORCE, force a digest interpretation. If not, try
7618 to guess what the document format is."
7620 (let ((conf gnus-current-window-configuration))
7622 (gnus-summary-select-article))
7623 (setq gnus-current-window-configuration conf)
7624 (let* ((name (format "%s-%d"
7625 (gnus-group-prefixed-name
7626 gnus-newsgroup-name (list 'nndoc ""))
7628 (set-buffer gnus-summary-buffer)
7629 gnus-current-article)))
7630 (ogroup gnus-newsgroup-name)
7631 (params (append (gnus-info-params (gnus-get-info ogroup))
7632 (list (cons 'to-group ogroup))
7633 (list (cons 'save-article-group ogroup))))
7634 (case-fold-search t)
7635 (buf (current-buffer))
7638 (set-buffer gnus-original-article-buffer)
7639 ;; Have the digest group inherit the main mail address of
7640 ;; the parent article.
7641 (when (setq to-address (or (message-fetch-field "reply-to")
7642 (message-fetch-field "from")))
7643 (setq params (append
7644 (list (cons 'to-address
7645 (funcall gnus-decode-encoded-word-function
7647 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
7648 (insert-buffer-substring gnus-original-article-buffer)
7649 ;; Remove lines that may lead nndoc to misinterpret the
7652 (goto-char (point-min))
7653 (or (search-forward "\n\n" nil t) (point)))
7654 (goto-char (point-min))
7655 (delete-matching-lines "^Path:\\|^From ")
7658 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
7659 (gnus-newsgroup-ephemeral-ignored-charsets
7660 gnus-newsgroup-ignored-charsets))
7661 (gnus-group-read-ephemeral-group
7662 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
7664 ,(if force 'mbox 'guess))) t))
7665 ;; Make all postings to this group go to the parent group.
7666 (nconc (gnus-info-params (gnus-get-info name))
7668 ;; Couldn't select this doc group.
7669 (switch-to-buffer buf)
7670 (gnus-set-global-variables)
7671 (gnus-configure-windows 'summary)
7672 (gnus-message 3 "Article couldn't be entered?"))
7673 (kill-buffer dig)))))
7675 (defun gnus-summary-read-document (n)
7676 "Open a new group based on the current article(s).
7677 This will allow you to read digests and other similar
7678 documents as newsgroups.
7679 Obeys the standard process/prefix convention."
7681 (let* ((articles (gnus-summary-work-articles n))
7682 (ogroup gnus-newsgroup-name)
7683 (params (append (gnus-info-params (gnus-get-info ogroup))
7684 (list (cons 'to-group ogroup))))
7685 article group egroup groups vgroup)
7686 (while (setq article (pop articles))
7687 (setq group (format "%s-%d" gnus-newsgroup-name article))
7688 (gnus-summary-remove-process-mark article)
7689 (when (gnus-summary-display-article article)
7692 (insert-buffer-substring gnus-original-article-buffer)
7693 ;; Remove some headers that may lead nndoc to make
7695 (message-narrow-to-head)
7696 (goto-char (point-min))
7697 (delete-matching-lines "^\\(Path\\):\\|^From ")
7700 (gnus-group-read-ephemeral-group
7701 group `(nndoc ,group (nndoc-address ,(current-buffer))
7702 (nndoc-article-type guess))
7705 ;; Make all postings to this group go to the parent group.
7706 (nconc (gnus-info-params (gnus-get-info egroup))
7708 (push egroup groups))
7709 ;; Couldn't select this doc group.
7710 (gnus-error 3 "Article couldn't be entered"))))))
7711 ;; Now we have selected all the documents.
7714 (error "None of the articles could be interpreted as documents"))
7715 ((gnus-group-read-ephemeral-group
7716 (setq vgroup (format
7717 "nnvirtual:%s-%s" gnus-newsgroup-name
7718 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7719 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
7721 (cons (current-buffer) 'summary)))
7723 (error "Couldn't select virtual nndoc group")))))
7725 (defun gnus-summary-isearch-article (&optional regexp-p)
7726 "Do incremental search forward on the current article.
7727 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7729 (let* ((gnus-inhibit-treatment t)
7730 (old (gnus-summary-select-article)))
7731 (gnus-configure-windows 'article)
7732 (gnus-eval-in-buffer-window gnus-article-buffer
7736 (gnus-article-show-all-headers))
7737 (goto-char (point-min))
7738 (isearch-forward regexp-p)))))
7740 (defun gnus-summary-search-article-forward (regexp &optional backward)
7741 "Search for an article containing REGEXP forward.
7742 If BACKWARD, search backward instead."
7745 (format "Search article %s (regexp%s): "
7746 (if current-prefix-arg "backward" "forward")
7747 (if gnus-last-search-regexp
7748 (concat ", default " gnus-last-search-regexp)
7750 current-prefix-arg))
7751 (if (string-equal regexp "")
7752 (setq regexp (or gnus-last-search-regexp ""))
7753 (setq gnus-last-search-regexp regexp)
7754 (setq gnus-article-before-search gnus-current-article))
7755 ;; Intentionally set gnus-last-article.
7756 (setq gnus-last-article gnus-article-before-search)
7757 (let ((gnus-last-article gnus-last-article))
7758 (if (gnus-summary-search-article regexp backward)
7759 (gnus-summary-show-thread)
7760 (error "Search failed: \"%s\"" regexp))))
7762 (defun gnus-summary-search-article-backward (regexp)
7763 "Search for an article containing REGEXP backward."
7766 (format "Search article backward (regexp%s): "
7767 (if gnus-last-search-regexp
7768 (concat ", default " gnus-last-search-regexp)
7770 (gnus-summary-search-article-forward regexp 'backward))
7773 (defmacro gnus-summary-search-article-position-point (regexp backward)
7774 "Dehighlight the last matched text and goto the beginning position."
7775 (` (if (and gnus-summary-search-article-matched-data
7776 (let ((text (caddr gnus-summary-search-article-matched-data))
7777 (inhibit-read-only t)
7780 (goto-char (car gnus-summary-search-article-matched-data))
7781 (cadr gnus-summary-search-article-matched-data))
7783 (string-match (, regexp) text)))
7784 (if (, backward) (beginning-of-line) (end-of-line))
7785 (goto-char (if (, backward) (point-max) (point-min))))))
7787 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
7788 "Place point where X-Face image is displayed."
7789 (if (featurep 'xemacs)
7790 (` (let ((end (if (search-forward "\n\n" nil t)
7791 (goto-char (1- (point)))
7794 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
7795 (unless (and (re-search-forward "^From:" end t)
7796 (setq extent (extent-at (point)))
7797 (extent-begin-glyph extent))
7798 (goto-char (, opoint)))))
7799 (` (let ((end (if (search-forward "\n\n" nil t)
7800 (goto-char (1- (point)))
7802 (start (or (search-backward "\n\n" nil t) (point-min))))
7804 (or (text-property-any start end 'x-face-image t);; x-face-e21
7805 (text-property-any start end 'x-face-mule-bitmap-image t)
7808 (defmacro gnus-summary-search-article-highlight-matched-text
7809 (backward treated x-face)
7810 "Highlight matched text in the function `gnus-summary-search-article'."
7811 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
7812 (end (set-marker (make-marker) (match-end 0)))
7813 (inhibit-read-only t)
7817 (let ((items (mapcar 'car gnus-treatment-function-alist)))
7819 (lambda (item) (setq items (delq item items)))
7820 '(gnus-treat-buttonize
7821 gnus-treat-fill-article
7822 gnus-treat-fill-long-lines
7823 gnus-treat-emphasize
7824 gnus-treat-highlight-headers
7825 gnus-treat-highlight-citation
7826 gnus-treat-highlight-signature
7827 gnus-treat-overstrike
7828 gnus-treat-display-xface
7829 gnus-treat-buttonize-head
7830 gnus-treat-decode-article-as-default-mime-charset))
7831 (static-if (featurep 'xemacs)
7833 (cons '(x-face-mule-delete-x-face-field
7836 (gnus-treat-display-xface
7837 (when (, x-face) gnus-treat-display-xface)))
7838 (gnus-article-prepare-mime-display)))
7839 (goto-char (if (, backward) start end))
7841 (gnus-summary-search-article-highlight-goto-x-face (point)))
7842 (setq gnus-summary-search-article-matched-data
7843 (list start end (buffer-substring start end)))
7844 (unless (eq start end);; matched text has been deleted. :-<
7845 (put-text-property start end 'face
7846 (or (find-face 'isearch)
7847 'secondary-selection))))))
7850 (defun gnus-summary-search-article (regexp &optional backward)
7851 "Search for an article containing REGEXP.
7852 Optional argument BACKWARD means do search for backward.
7853 `gnus-select-article-hook' is not called during the search."
7854 ;; We have to require this here to make sure that the following
7855 ;; dynamic binding isn't shadowed by autoloading.
7856 (require 'gnus-async)
7858 (let ((gnus-select-article-hook nil) ;Disable hook.
7859 (gnus-article-prepare-hook nil)
7860 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7861 (gnus-use-article-prefetch nil)
7862 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7863 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7864 (sum (current-buffer))
7867 (gnus-save-hidden-threads
7868 (static-if (featurep 'xemacs)
7869 (let ((gnus-inhibit-treatment t))
7870 (setq treated (eq 'old (gnus-summary-select-article)))
7872 (not (and (gnus-buffer-live-p gnus-article-buffer)
7873 (window-live-p (get-buffer-window
7874 gnus-article-buffer t)))))
7875 (gnus-summary-select-article nil t)
7876 (setq treated nil)))
7877 (let ((gnus-inhibit-treatment t)
7878 (x-face-mule-delete-x-face-field 'never))
7879 (setq treated (eq 'old (gnus-summary-select-article)))
7882 (and (gnus-buffer-live-p gnus-article-buffer)
7883 (window-live-p (get-buffer-window
7884 gnus-article-buffer t))
7885 (or (not (string-match "^\\^X-Face:" regexp))
7886 (with-current-buffer gnus-article-buffer
7887 gnus-summary-search-article-matched-data)))))
7888 (gnus-summary-select-article nil t)
7889 (setq treated nil))))
7890 (set-buffer gnus-article-buffer)
7894 (gnus-article-show-all-headers)
7895 (gnus-summary-search-article-position-point regexp backward))
7896 (goto-char (if backward (point-max) (point-min))))
7898 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7900 (re-search-backward regexp nil t)
7901 (re-search-forward regexp nil t))
7902 ;; We found the regexp.
7904 (gnus-summary-search-article-highlight-matched-text
7905 backward treated (string-match "^\\^X-Face:" regexp))
7908 (/ (- 2 (window-height
7909 (get-buffer-window gnus-article-buffer t)))
7912 (get-buffer-window (current-buffer))
7915 (setq point (point)))
7916 ;; We didn't find it, so we go to the next article.
7919 (while (eq found 'not)
7920 (if (not (if backward (gnus-summary-find-prev)
7921 (gnus-summary-find-next)))
7922 ;; No more articles.
7924 ;; Select the next article and adjust point.
7925 (unless (gnus-summary-article-sparse-p
7926 (gnus-summary-article-number))
7928 (let ((gnus-inhibit-treatment t))
7929 (gnus-summary-select-article))
7931 (set-buffer gnus-article-buffer)
7933 (goto-char (if backward (point-max) (point-min))))))))
7934 (gnus-message 7 ""))
7935 ;; Return whether we found the regexp.
7936 (when (eq found 'found)
7938 (gnus-summary-show-thread)
7939 (gnus-summary-goto-subject gnus-current-article)
7940 (gnus-summary-position-point)
7943 (defun gnus-find-matching-articles (header regexp)
7944 "Return a list of all articles that match REGEXP on HEADER.
7945 This search includes all articles in the current group that Gnus has
7946 fetched headers for, whether they are displayed or not."
7947 (let ((articles nil)
7948 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
7949 (case-fold-search t))
7950 (dolist (header gnus-newsgroup-headers)
7951 (when (string-match regexp (funcall func header))
7952 (push (mail-header-number header) articles)))
7953 (nreverse articles)))
7955 (defun gnus-summary-find-matching (header regexp &optional backward unread
7956 not-case-fold not-matching)
7957 "Return a list of all articles that match REGEXP on HEADER.
7958 The search stars on the current article and goes forwards unless
7959 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7960 If UNREAD is non-nil, only unread articles will
7961 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7962 in the comparisons. If NOT-MATCHING, return a list of all articles that
7963 not match REGEXP on HEADER."
7964 (let ((case-fold-search (not not-case-fold))
7967 (if (eq (car header) 'extra)
7970 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
7972 (error "%s is an invalid header" header))
7973 (unless (fboundp (intern (concat "mail-header-" header)))
7974 (error "%s is not a valid header" header))
7975 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
7976 (dolist (d (if (eq backward 'all)
7978 (gnus-data-find-list
7979 (gnus-summary-article-number)
7980 (gnus-data-list backward))))
7981 (when (and (or (not unread) ; We want all articles...
7982 (gnus-data-unread-p d)) ; Or just unreads.
7983 (vectorp (gnus-data-header d)) ; It's not a pseudo.
7987 (funcall func (gnus-data-header d))))
7988 (string-match regexp
7989 (funcall func (gnus-data-header d)))))
7990 (push (gnus-data-number d) articles))) ; Success!
7991 (nreverse articles)))
7993 (defun gnus-summary-execute-command (header regexp command &optional backward)
7994 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7995 If HEADER is an empty string (or nil), the match is done on the entire
7996 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7998 (list (let ((completion-ignore-case t))
8001 (mapcar (lambda (header) (list (format "%s" header)))
8003 '("Number" "Subject" "From" "Lines" "Date"
8004 "Message-ID" "Xref" "References" "Body")
8005 gnus-extra-headers))
8006 nil 'require-match))
8007 (read-string "Regexp: ")
8008 (read-key-sequence "Command: ")
8009 current-prefix-arg))
8010 (when (equal header "Body")
8012 ;; Hidden thread subtrees must be searched as well.
8013 (gnus-summary-show-all-threads)
8014 ;; We don't want to change current point nor window configuration.
8016 (save-window-excursion
8017 (gnus-message 6 "Executing %s..." (key-description command))
8018 ;; We'd like to execute COMMAND interactively so as to give arguments.
8019 (gnus-execute header regexp
8020 `(call-interactively ',(key-binding command))
8022 (gnus-message 6 "Executing %s...done" (key-description command)))))
8024 (defun gnus-summary-beginning-of-article ()
8025 "Scroll the article back to the beginning."
8027 (gnus-summary-select-article)
8028 (gnus-configure-windows 'article)
8029 (gnus-eval-in-buffer-window gnus-article-buffer
8031 (goto-char (point-min))
8032 (when gnus-page-broken
8033 (gnus-narrow-to-page))))
8035 (defun gnus-summary-end-of-article ()
8036 "Scroll to the end of the article."
8038 (gnus-summary-select-article)
8039 (gnus-configure-windows 'article)
8040 (gnus-eval-in-buffer-window gnus-article-buffer
8042 (goto-char (point-max))
8044 (when gnus-page-broken
8045 (gnus-narrow-to-page))))
8047 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8048 "Truncate to LEN and quote all \"(\"'s in STRING."
8049 (gnus-replace-in-string (if (and len (> (length string) len))
8050 (substring string 0 len)
8054 (defun gnus-summary-print-article (&optional filename n)
8055 "Generate and print a PostScript image of the N next (mail) articles.
8057 If N is negative, print the N previous articles. If N is nil and articles
8058 have been marked with the process mark, print these instead.
8060 If the optional first argument FILENAME is nil, send the image to the
8061 printer. If FILENAME is a string, save the PostScript image in a file with
8062 that name. If FILENAME is a number, prompt the user for the name of the file
8064 (interactive (list (ps-print-preprint current-prefix-arg)))
8065 (dolist (article (gnus-summary-work-articles n))
8066 (gnus-summary-select-article nil nil 'pseudo article)
8067 (gnus-eval-in-buffer-window gnus-article-buffer
8068 (gnus-print-buffer))
8069 (gnus-summary-remove-process-mark article))
8070 (ps-despool filename))
8072 (defun gnus-print-buffer ()
8073 (let ((buffer (generate-new-buffer " *print*")))
8076 (copy-to-buffer buffer (point-min) (point-max))
8078 (gnus-article-delete-invisible-text)
8079 (when (gnus-visual-p 'article-highlight 'highlight)
8080 ;; Copy-to-buffer doesn't copy overlay. So redo
8082 (let ((gnus-article-buffer buffer))
8083 (gnus-article-highlight-citation t)
8084 (gnus-article-highlight-signature)))
8085 (let ((ps-left-header
8088 (gnus-summary-print-truncate-and-quote
8089 (mail-header-subject gnus-current-headers)
8092 (gnus-summary-print-truncate-and-quote
8093 (mail-header-from gnus-current-headers)
8097 "/pagenumberstring load"
8099 (mail-header-date gnus-current-headers) ")"))))
8100 (gnus-run-hooks 'gnus-ps-print-hook)
8103 (ps-spool-buffer-with-faces)
8104 (ps-spool-buffer)))))
8105 (kill-buffer buffer))))
8107 (defun gnus-summary-show-article (&optional arg)
8108 "Force redisplaying of the current article.
8109 If ARG (the prefix) is a number, show the article with the charset
8110 defined in `gnus-summary-show-article-charset-alist', or the charset
8112 If ARG (the prefix) is non-nil and not a number, show the raw article
8113 without any article massaging functions being run. Normally, the key strokes
8118 (gnus-summary-show-article t)
8119 (let ((gnus-newsgroup-charset
8120 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8121 (mm-read-coding-system
8124 (set-buffer gnus-article-buffer)
8125 (let ((coding-systems
8126 (detect-coding-region (point) (point-max))))
8127 (or (car-safe coding-systems)
8128 coding-systems))))))
8129 (gnus-newsgroup-ignored-charsets 'gnus-all))
8130 (gnus-summary-select-article nil 'force)
8131 (let ((deps gnus-newsgroup-dependencies)
8134 (set-buffer gnus-original-article-buffer)
8136 (message-narrow-to-head)
8137 (setq head (buffer-string))
8138 (goto-char (point-min))
8139 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8140 (goto-char (point-max))
8142 (setq lines (1- (count-lines (point) (point-max))))))
8144 (insert (format "211 %d Article retrieved.\n"
8145 (cdr gnus-article-current)))
8147 (if lines (insert (format "Lines: %d\n" lines)))
8149 (let ((nntp-server-buffer (current-buffer)))
8150 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8151 (gnus-data-set-header
8152 (gnus-data-find (cdr gnus-article-current))
8154 (gnus-summary-update-article-line
8155 (cdr gnus-article-current) header)
8156 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8157 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8159 ;; Select the article the normal way.
8160 (gnus-summary-select-article nil 'force))
8162 ;; We have to require this here to make sure that the following
8163 ;; dynamic binding isn't shadowed by autoloading.
8164 (require 'gnus-async)
8166 ;; Bind the article treatment functions to nil.
8167 (let ((gnus-have-all-headers t)
8168 gnus-article-prepare-hook
8169 gnus-article-decode-hook
8172 (gnus-inhibit-treatment t))
8173 (gnus-summary-select-article nil 'force))))
8174 (gnus-summary-goto-subject gnus-current-article)
8175 (gnus-summary-position-point))
8177 (defun gnus-summary-show-raw-article ()
8178 "Show the raw article without any article massaging functions being run."
8180 (gnus-summary-show-article t))
8182 (defun gnus-summary-verbose-headers (&optional arg)
8183 "Toggle permanent full header display.
8184 If ARG is a positive number, turn header display on.
8185 If ARG is a negative number, turn header display off."
8187 (setq gnus-show-all-headers
8188 (cond ((or (not (numberp arg))
8190 (not gnus-show-all-headers))
8193 (gnus-summary-show-article))
8195 (defun gnus-summary-toggle-header (&optional arg)
8196 "Show the headers if they are hidden, or hide them if they are shown.
8197 If ARG is a positive number, show the entire header.
8198 If ARG is a negative number, hide the unwanted header lines."
8201 (set-buffer gnus-article-buffer)
8203 (let* ((buffer-read-only nil)
8204 (inhibit-point-motion-hooks t)
8210 (article-narrow-to-head)
8211 (gnus-article-hidden-text-p 'headers))))
8212 (goto-char (point-min))
8213 (when (search-forward "\n\n" nil t)
8214 (delete-region (point-min) (1- (point))))
8215 (goto-char (point-min))
8217 (set-buffer gnus-original-article-buffer)
8218 (goto-char (point-min))
8219 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
8220 (insert-buffer-substring gnus-original-article-buffer 1 e)
8222 (narrow-to-region (point-min) (point))
8223 (article-decode-encoded-words)
8225 (let ((gnus-treat-hide-headers nil)
8226 (gnus-treat-hide-boring-headers nil))
8227 (gnus-delete-wash-type 'headers)
8228 (gnus-treat-article 'head))
8229 (gnus-treat-article 'head)))
8230 (gnus-set-mode-line 'article)))))
8232 (defun gnus-summary-show-all-headers ()
8233 "Make all header lines visible."
8235 (gnus-summary-toggle-header 1))
8237 (defun gnus-summary-toggle-mime (&optional arg)
8238 "Toggle MIME processing.
8239 If ARG is a positive number, turn MIME processing on."
8241 (setq gnus-show-mime
8243 (not gnus-show-mime)
8244 (> (prefix-numeric-value arg) 0)))
8245 (gnus-summary-select-article t 'force))
8247 (defun gnus-summary-caesar-message (&optional arg)
8248 "Caesar rotate the current article by 13.
8249 The numerical prefix specifies how many places to rotate each letter
8252 (gnus-summary-select-article)
8253 (let ((mail-header-separator ""))
8254 (gnus-eval-in-buffer-window gnus-article-buffer
8257 (let ((start (window-start))
8259 (message-caesar-buffer-body arg)
8260 (set-window-start (get-buffer-window (current-buffer)) start))))))
8262 (defun gnus-summary-stop-page-breaking ()
8263 "Stop page breaking in the current article."
8265 (gnus-summary-select-article)
8266 (gnus-eval-in-buffer-window gnus-article-buffer
8268 (when (gnus-visual-p 'page-marker)
8269 (let ((buffer-read-only nil))
8270 (gnus-remove-text-with-property 'gnus-prev)
8271 (gnus-remove-text-with-property 'gnus-next))
8272 (setq gnus-page-broken nil))))
8274 (defun gnus-summary-move-article (&optional n to-newsgroup
8275 select-method action)
8276 "Move the current article to a different newsgroup.
8277 If N is a positive number, move the N next articles.
8278 If N is a negative number, move the N previous articles.
8279 If N is nil and any articles have been marked with the process mark,
8280 move those articles instead.
8281 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8282 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8283 re-spool using this method.
8285 For this function to work, both the current newsgroup and the
8286 newsgroup that you want to move to have to support the `request-move'
8287 and `request-accept' functions.
8289 ACTION can be either `move' (the default), `crosspost' or `copy'."
8292 (setq action 'move))
8293 ;; Check whether the source group supports the required functions.
8294 (cond ((and (eq action 'move)
8295 (not (gnus-check-backend-function
8296 'request-move-article gnus-newsgroup-name)))
8297 (error "The current group does not support article moving"))
8298 ((and (eq action 'crosspost)
8299 (not (gnus-check-backend-function
8300 'request-replace-article gnus-newsgroup-name)))
8301 (error "The current group does not support article editing")))
8302 (let ((articles (gnus-summary-work-articles n))
8303 (prefix (if (gnus-check-backend-function
8304 'request-move-article gnus-newsgroup-name)
8305 (gnus-group-real-prefix gnus-newsgroup-name)
8307 (names '((move "Move" "Moving")
8308 (copy "Copy" "Copying")
8309 (crosspost "Crosspost" "Crossposting")))
8310 (copy-buf (save-excursion
8311 (nnheader-set-temp-buffer " *copy article*")))
8312 (default-marks gnus-article-mark-lists)
8313 (no-expire-marks (delete '(expirable . expire)
8314 (copy-sequence gnus-article-mark-lists)))
8315 art-group to-method new-xref article to-groups)
8316 (unless (assq action names)
8317 (error "Unknown action %s" action))
8318 ;; We have to select an article to give
8319 ;; `gnus-read-move-group-name' an opportunity to suggest an
8320 ;; appropriate default.
8321 (unless (gnus-buffer-live-p gnus-original-article-buffer)
8322 (gnus-summary-select-article nil nil nil (car articles)))
8323 ;; Read the newsgroup name.
8324 (when (and (not to-newsgroup)
8325 (not select-method))
8327 (gnus-read-move-group-name
8328 (cadr (assq action names))
8329 (symbol-value (intern (format "gnus-current-%s-group" action)))
8331 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8332 (setq to-method (or select-method
8333 (gnus-server-to-method
8334 (gnus-group-method to-newsgroup))))
8335 ;; Check the method we are to move this article to...
8336 (unless (gnus-check-backend-function
8337 'request-accept-article (car to-method))
8338 (error "%s does not support article copying" (car to-method)))
8339 (unless (gnus-check-server to-method)
8340 (error "Can't open server %s" (car to-method)))
8341 (gnus-message 6 "%s to %s: %s..."
8342 (caddr (assq action names))
8343 (or (car select-method) to-newsgroup) articles)
8345 (setq article (pop articles))
8349 ;; Move the article.
8351 ;; Remove this article from future suppression.
8352 (gnus-dup-unsuppress-article article)
8353 (gnus-request-move-article
8354 article ; Article to move
8355 gnus-newsgroup-name ; From newsgroup
8356 (nth 1 (gnus-find-method-for-group
8357 gnus-newsgroup-name)) ; Server
8358 (list 'gnus-request-accept-article
8359 to-newsgroup (list 'quote select-method)
8360 (not articles) t) ; Accept form
8361 (not articles))) ; Only save nov last time
8362 ;; Copy the article.
8365 (set-buffer copy-buf)
8366 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8367 (gnus-request-accept-article
8368 to-newsgroup select-method (not articles) t))))
8369 ;; Crosspost the article.
8370 ((eq action 'crosspost)
8371 (let ((xref (message-tokenize-header
8372 (mail-header-xref (gnus-summary-article-header article))
8374 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8375 ":" (number-to-string article)))
8377 (setq xref (list (system-name))))
8380 (mapconcat 'identity
8381 (delete "Xref:" (delete new-xref xref))
8385 (set-buffer copy-buf)
8386 ;; First put the article in the destination group.
8387 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8388 (when (consp (setq art-group
8389 (gnus-request-accept-article
8390 to-newsgroup select-method (not articles))))
8391 (setq new-xref (concat new-xref " " (car art-group)
8393 (number-to-string (cdr art-group))))
8394 ;; Now we have the new Xrefs header, so we insert
8395 ;; it and replace the new article.
8396 (nnheader-replace-header "Xref" new-xref)
8397 (gnus-request-replace-article
8398 (cdr art-group) to-newsgroup (current-buffer))
8402 (gnus-message 1 "Couldn't %s article %s: %s"
8403 (cadr (assq action names)) article
8404 (nnheader-get-report (car to-method))))
8405 ((eq art-group 'junk)
8406 (when (eq action 'move)
8407 (gnus-summary-mark-article article gnus-canceled-mark)
8408 (gnus-message 4 "Deleted article %s" article)))
8410 (let* ((pto-group (gnus-group-prefixed-name
8411 (car art-group) to-method))
8413 (gnus-gethash pto-group gnus-newsrc-hashtb))
8414 (info (nth 2 entry))
8415 (to-group (gnus-info-group info))
8417 ;; Update the group that has been moved to.
8419 (memq action '(move copy)))
8420 (unless (member to-group to-groups)
8421 (push to-group to-groups))
8423 (unless (memq article gnus-newsgroup-unreads)
8424 (push 'read to-marks)
8426 info (gnus-add-to-range (gnus-info-read info)
8427 (list (cdr art-group)))))
8429 ;; See whether the article is to be put in the cache.
8430 (let ((marks (if (gnus-group-auto-expirable-p to-group)
8433 (to-article (cdr art-group)))
8435 ;; Enter the article into the cache in the new group,
8436 ;; if that is required.
8437 (when gnus-use-cache
8438 (gnus-cache-possibly-enter-article
8440 (let ((header (copy-sequence
8441 (gnus-summary-article-header article))))
8442 (mail-header-set-number header to-article)
8444 (memq article gnus-newsgroup-marked)
8445 (memq article gnus-newsgroup-dormant)
8446 (memq article gnus-newsgroup-unreads)))
8448 (when gnus-preserve-marks
8449 ;; Copy any marks over to the new group.
8450 (when (and (equal to-group gnus-newsgroup-name)
8451 (not (memq article gnus-newsgroup-unreads)))
8452 ;; Mark this article as read in this group.
8453 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8454 (setcdr (gnus-active to-group) to-article)
8455 (setcdr gnus-newsgroup-active to-article))
8458 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8459 (when (memq article (symbol-value
8460 (intern (format "gnus-newsgroup-%s"
8462 (push (cdar marks) to-marks)
8463 ;; If the other group is the same as this group,
8464 ;; then we have to add the mark to the list.
8465 (when (equal to-group gnus-newsgroup-name)
8466 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
8469 (intern (format "gnus-newsgroup-%s"
8471 ;; Copy the marks to other group.
8472 (gnus-add-marked-articles
8473 to-group (cdar marks) (list to-article) info)))
8474 (setq marks (cdr marks)))
8476 (gnus-request-set-mark to-group (list (list (list to-article)
8481 (concat "(gnus-group-set-info '"
8482 (gnus-prin1-to-string (gnus-get-info to-group))
8485 ;; Update the Xref header in this article to point to
8486 ;; the new crossposted article we have just created.
8487 (when (eq action 'crosspost)
8489 (set-buffer copy-buf)
8490 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8491 (nnheader-replace-header "Xref" new-xref)
8492 (gnus-request-replace-article
8493 article gnus-newsgroup-name (current-buffer)))))
8495 ;;;!!!Why is this necessary?
8496 (set-buffer gnus-summary-buffer)
8498 (gnus-summary-goto-subject article)
8499 (when (eq action 'move)
8500 (gnus-summary-mark-article article gnus-canceled-mark))))
8501 (gnus-summary-remove-process-mark article))
8502 ;; Re-activate all groups that have been moved to.
8504 (set-buffer gnus-group-buffer)
8505 (let ((gnus-group-marked to-groups))
8506 (gnus-group-get-new-news-this-group nil t)))
8508 (gnus-kill-buffer copy-buf)
8509 (gnus-summary-position-point)
8510 (gnus-set-mode-line 'summary)))
8512 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
8513 "Move the current article to a different newsgroup.
8514 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8515 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8516 re-spool using this method."
8518 (gnus-summary-move-article n to-newsgroup select-method 'copy))
8520 (defun gnus-summary-crosspost-article (&optional n)
8521 "Crosspost the current article to some other group."
8523 (gnus-summary-move-article n nil nil 'crosspost))
8525 (defcustom gnus-summary-respool-default-method nil
8526 "Default method type for respooling an article.
8527 If nil, use to the current newsgroup method."
8529 :group 'gnus-summary-mail)
8531 (defun gnus-summary-respool-article (&optional n method)
8532 "Respool the current article.
8533 The article will be squeezed through the mail spooling process again,
8534 which means that it will be put in some mail newsgroup or other
8535 depending on `nnmail-split-methods'.
8536 If N is a positive number, respool the N next articles.
8537 If N is a negative number, respool the N previous articles.
8538 If N is nil and any articles have been marked with the process mark,
8539 respool those articles instead.
8541 Respooling can be done both from mail groups and \"real\" newsgroups.
8542 In the former case, the articles in question will be moved from the
8543 current group into whatever groups they are destined to. In the
8544 latter case, they will be copied into the relevant groups."
8546 (list current-prefix-arg
8547 (let* ((methods (gnus-methods-using 'respool))
8549 (symbol-name (or gnus-summary-respool-default-method
8550 (car (gnus-find-method-for-group
8551 gnus-newsgroup-name)))))
8553 (gnus-completing-read
8554 methname "What backend do you want to use when respooling?"
8555 methods nil t nil 'gnus-mail-method-history))
8558 ((zerop (length (setq ms (gnus-servers-using-backend
8560 (list (intern method) ""))
8564 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
8565 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
8568 (error "No method given for respooling"))
8569 (if (assoc (symbol-name
8570 (car (gnus-find-method-for-group gnus-newsgroup-name)))
8571 (gnus-methods-using 'respool))
8572 (gnus-summary-move-article n nil method)
8573 (gnus-summary-copy-article n nil method)))
8575 (defun gnus-summary-import-article (file &optional edit)
8576 "Import an arbitrary file into a mail newsgroup."
8577 (interactive "fImport file: \nP")
8578 (let ((group gnus-newsgroup-name)
8579 (now (current-time))
8580 atts lines group-art)
8581 (unless (gnus-check-backend-function 'request-accept-article group)
8582 (error "%s does not support article importing" group))
8583 (or (file-readable-p file)
8584 (not (file-regular-p file))
8585 (error "Can't read %s" file))
8587 (set-buffer (gnus-get-buffer-create " *import file*"))
8589 (nnheader-insert-file-contents file)
8590 (goto-char (point-min))
8591 (if (nnheader-article-p)
8593 (goto-char (point-min))
8594 (search-forward "\n\n" nil t)
8595 (narrow-to-region (point-min) (1- (point)))
8596 (goto-char (point-min))
8597 (unless (re-search-forward "^date:" nil t)
8598 (goto-char (point-max))
8599 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
8600 ;; This doesn't look like an article, so we fudge some headers.
8601 (setq atts (file-attributes file)
8602 lines (count-lines (point-min) (point-max)))
8603 (insert "From: " (read-string "From: ") "\n"
8604 "Subject: " (read-string "Subject: ") "\n"
8605 "Date: " (message-make-date (nth 5 atts)) "\n"
8606 "Message-ID: " (message-make-message-id) "\n"
8607 "Lines: " (int-to-string lines) "\n"
8608 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
8609 (setq group-art (gnus-request-accept-article group nil t))
8610 (kill-buffer (current-buffer)))
8611 (setq gnus-newsgroup-active (gnus-activate-group group))
8613 (gnus-summary-goto-article (cdr group-art) nil t)
8615 (gnus-summary-edit-article))))
8617 (defun gnus-summary-create-article ()
8618 "Create an article in a mail newsgroup."
8620 (let ((group gnus-newsgroup-name)
8621 (now (current-time))
8623 (unless (gnus-check-backend-function 'request-accept-article group)
8624 (error "%s does not support article importing" group))
8626 (set-buffer (gnus-get-buffer-create " *import file*"))
8628 (goto-char (point-min))
8629 ;; This doesn't look like an article, so we fudge some headers.
8630 (insert "From: " (read-string "From: ") "\n"
8631 "Subject: " (read-string "Subject: ") "\n"
8632 "Date: " (message-make-date now) "\n"
8633 "Message-ID: " (message-make-message-id) "\n")
8634 (setq group-art (gnus-request-accept-article group nil t))
8635 (kill-buffer (current-buffer)))
8636 (setq gnus-newsgroup-active (gnus-activate-group group))
8638 (gnus-summary-goto-article (cdr group-art) nil t)
8639 (gnus-summary-edit-article)))
8641 (defun gnus-summary-article-posted-p ()
8642 "Say whether the current (mail) article is available from news as well.
8643 This will be the case if the article has both been mailed and posted."
8645 (let ((id (mail-header-references (gnus-summary-article-header)))
8646 (gnus-override-method (car (gnus-refer-article-methods))))
8647 (if (gnus-request-head id "")
8648 (gnus-message 2 "The current message was found on %s"
8649 gnus-override-method)
8650 (gnus-message 2 "The current message couldn't be found on %s"
8651 gnus-override-method)
8654 (defun gnus-summary-expire-articles (&optional now)
8655 "Expire all articles that are marked as expirable in the current group."
8657 (when (gnus-check-backend-function
8658 'request-expire-articles gnus-newsgroup-name)
8659 ;; This backend supports expiry.
8660 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
8661 (expirable (if total
8663 ;; We need to update the info for
8664 ;; this group for `gnus-list-of-read-articles'
8665 ;; to give us the right answer.
8666 (gnus-run-hooks 'gnus-exit-group-hook)
8667 (gnus-summary-update-info)
8668 (gnus-list-of-read-articles gnus-newsgroup-name))
8669 (setq gnus-newsgroup-expirable
8670 (sort gnus-newsgroup-expirable '<))))
8671 (expiry-wait (if now 'immediate
8672 (gnus-group-find-parameter
8673 gnus-newsgroup-name 'expiry-wait)))
8674 (nnmail-expiry-target
8675 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
8676 nnmail-expiry-target))
8679 ;; There are expirable articles in this group, so we run them
8680 ;; through the expiry process.
8681 (gnus-message 6 "Expiring articles...")
8682 (unless (gnus-check-group gnus-newsgroup-name)
8683 (error "Can't open server for %s" gnus-newsgroup-name))
8684 ;; The list of articles that weren't expired is returned.
8687 (let ((nnmail-expiry-wait-function nil)
8688 (nnmail-expiry-wait expiry-wait))
8689 (setq es (gnus-request-expire-articles
8690 expirable gnus-newsgroup-name)))
8691 (setq es (gnus-request-expire-articles
8692 expirable gnus-newsgroup-name)))
8694 (setq gnus-newsgroup-expirable es))
8695 ;; We go through the old list of expirable, and mark all
8696 ;; really expired articles as nonexistent.
8697 (unless (eq es expirable) ;If nothing was expired, we don't mark.
8698 (let ((gnus-use-cache nil))
8700 (unless (memq (car expirable) es)
8701 (when (gnus-data-find (car expirable))
8702 (gnus-summary-mark-article
8703 (car expirable) gnus-canceled-mark)))
8704 (setq expirable (cdr expirable))))))
8705 (gnus-message 6 "Expiring articles...done")))))
8707 (defun gnus-summary-expire-articles-now ()
8708 "Expunge all expirable articles in the current group.
8709 This means that *all* articles that are marked as expirable will be
8710 deleted forever, right now."
8712 (or gnus-expert-user
8714 "Are you really, really, really sure you want to delete all these messages? ")
8716 (gnus-summary-expire-articles t))
8718 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
8719 (defun gnus-summary-delete-article (&optional n)
8720 "Delete the N next (mail) articles.
8721 This command actually deletes articles. This is not a marking
8722 command. The article will disappear forever from your life, never to
8724 If N is negative, delete backwards.
8725 If N is nil and articles have been marked with the process mark,
8726 delete these instead."
8728 (unless (gnus-check-backend-function 'request-expire-articles
8729 gnus-newsgroup-name)
8730 (error "The current newsgroup does not support article deletion"))
8731 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
8732 (error "Couldn't open server"))
8733 ;; Compute the list of articles to delete.
8734 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
8736 (if (and gnus-novice-user
8737 (not (gnus-yes-or-no-p
8738 (format "Do you really want to delete %s forever? "
8739 (if (> (length articles) 1)
8740 (format "these %s articles" (length articles))
8743 ;; Delete the articles.
8744 (setq not-deleted (gnus-request-expire-articles
8745 articles gnus-newsgroup-name 'force))
8747 (gnus-summary-remove-process-mark (car articles))
8748 ;; The backend might not have been able to delete the article
8750 (unless (memq (car articles) not-deleted)
8751 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
8752 (setq articles (cdr articles)))
8754 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
8755 (gnus-summary-position-point)
8756 (gnus-set-mode-line 'summary)
8759 (defun gnus-summary-edit-article (&optional force)
8760 "Edit the current article.
8761 This will have permanent effect only in mail groups.
8762 If FORCE is non-nil, allow editing of articles even in read-only
8766 (set-buffer gnus-summary-buffer)
8767 (let ((mail-parse-charset gnus-newsgroup-charset)
8768 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
8769 (gnus-set-global-variables)
8770 (when (and (not force)
8771 (gnus-group-read-only-p))
8772 (error "The current newsgroup does not support article editing"))
8773 (gnus-summary-show-article t)
8774 (gnus-article-edit-article
8776 `(lambda (no-highlight)
8777 (let ((mail-parse-charset ',gnus-newsgroup-charset)
8778 (message-options message-options)
8779 (message-options-set-recipient)
8780 (mail-parse-ignored-charsets
8781 ',gnus-newsgroup-ignored-charsets))
8782 (gnus-summary-edit-article-done
8783 ,(or (mail-header-references gnus-current-headers) "")
8784 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
8786 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
8788 (defun gnus-summary-edit-article-done (&optional references read-only buffer
8790 "Make edits to the current article permanent."
8793 ;; The buffer restriction contains the entire article if it exists.
8794 (when (article-goto-body)
8795 (let ((lines (count-lines (point) (point-max)))
8796 (length (- (point-max) (point)))
8797 (case-fold-search t)
8798 (body (copy-marker (point))))
8799 (goto-char (point-min))
8800 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
8801 (delete-region (match-beginning 1) (match-end 1))
8802 (insert (number-to-string length)))
8803 (goto-char (point-min))
8804 (when (re-search-forward
8805 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
8806 (delete-region (match-beginning 1) (match-end 1))
8807 (insert (number-to-string length)))
8808 (goto-char (point-min))
8809 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
8810 (delete-region (match-beginning 1) (match-end 1))
8811 (insert (number-to-string lines))))))
8812 ;; Replace the article.
8813 (let ((buf (current-buffer)))
8815 (insert-buffer-substring buf)
8817 (if (and (not read-only)
8818 (not (gnus-request-replace-article
8819 (cdr gnus-article-current) (car gnus-article-current)
8820 (current-buffer) t)))
8821 (error "Couldn't replace article")
8822 ;; Update the summary buffer.
8824 (equal (message-tokenize-header references " ")
8825 (message-tokenize-header
8826 (or (message-fetch-field "references") "") " ")))
8827 ;; We only have to update this line.
8830 (message-narrow-to-head)
8831 (let ((head (buffer-string))
8834 (insert (format "211 %d Article retrieved.\n"
8835 (cdr gnus-article-current)))
8838 (let ((nntp-server-buffer (current-buffer)))
8839 (setq header (car (gnus-get-newsgroup-headers
8841 (set-buffer gnus-summary-buffer)
8842 gnus-newsgroup-dependencies)
8845 (set-buffer gnus-summary-buffer)
8846 (gnus-data-set-header
8847 (gnus-data-find (cdr gnus-article-current))
8849 (gnus-summary-update-article-line
8850 (cdr gnus-article-current) header)
8851 (if (gnus-summary-goto-subject
8852 (cdr gnus-article-current) nil t)
8853 (gnus-summary-update-secondary-mark
8854 (cdr gnus-article-current))))))))
8856 (set-buffer (or buffer gnus-summary-buffer))
8857 (gnus-summary-update-article (cdr gnus-article-current))
8858 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8859 (gnus-summary-update-secondary-mark
8860 (cdr gnus-article-current))))
8861 ;; Prettify the article buffer again.
8862 (unless no-highlight
8864 (set-buffer gnus-article-buffer)
8865 ;;;!!! Fix this -- article should be rehighlighted.
8866 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8867 (set-buffer gnus-original-article-buffer)
8868 (gnus-request-article
8869 (cdr gnus-article-current)
8870 (car gnus-article-current) (current-buffer))))
8871 ;; Prettify the summary buffer line.
8872 (when (gnus-visual-p 'summary-highlight 'highlight)
8873 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
8875 (defun gnus-summary-edit-wash (key)
8876 "Perform editing command KEY in the article buffer."
8880 (message "%s" (concat (this-command-keys) "- "))
8883 (gnus-summary-edit-article)
8884 (execute-kbd-macro (concat (this-command-keys) key))
8885 (gnus-article-edit-done))
8887 (defun gnus-summary-toggle-smiley (&optional arg)
8888 "Toggle the display of smilies as small graphical icons."
8891 (set-buffer gnus-article-buffer)
8892 (gnus-article-smiley-display arg)))
8896 (defun gnus-summary-respool-query (&optional silent trace)
8897 "Query where the respool algorithm would put this article."
8899 (let (gnus-mark-article-hook)
8900 (gnus-summary-select-article)
8902 (set-buffer gnus-original-article-buffer)
8904 (message-narrow-to-head)
8905 (let ((groups (nnmail-article-group 'identity trace)))
8908 (message "This message would go to %s"
8909 (mapconcat 'car groups ", "))
8910 (message "This message would go to no groups"))
8913 (defun gnus-summary-respool-trace ()
8914 "Trace where the respool algorithm would put this article.
8915 Display a buffer showing all fancy splitting patterns which matched."
8917 (gnus-summary-respool-query nil t))
8919 ;; Summary marking commands.
8921 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
8922 "Mark articles which has the same subject as read, and then select the next.
8923 If UNMARK is positive, remove any kind of mark.
8924 If UNMARK is negative, tick articles."
8927 (setq unmark (prefix-numeric-value unmark)))
8929 (gnus-summary-mark-same-subject
8930 (gnus-summary-article-subject) unmark)))
8931 ;; Select next unread article. If auto-select-same mode, should
8932 ;; select the first unread article.
8933 (gnus-summary-next-article t (and gnus-auto-select-same
8934 (gnus-summary-article-subject)))
8935 (gnus-message 7 "%d article%s marked as %s"
8936 count (if (= count 1) " is" "s are")
8937 (if unmark "unread" "read"))))
8939 (defun gnus-summary-kill-same-subject (&optional unmark)
8940 "Mark articles which has the same subject as read.
8941 If UNMARK is positive, remove any kind of mark.
8942 If UNMARK is negative, tick articles."
8945 (setq unmark (prefix-numeric-value unmark)))
8947 (gnus-summary-mark-same-subject
8948 (gnus-summary-article-subject) unmark)))
8949 ;; If marked as read, go to next unread subject.
8951 ;; Go to next unread subject.
8952 (gnus-summary-next-subject 1 t))
8953 (gnus-message 7 "%d articles are marked as %s"
8954 count (if unmark "unread" "read"))))
8956 (defun gnus-summary-mark-same-subject (subject &optional unmark)
8957 "Mark articles with same SUBJECT as read, and return marked number.
8958 If optional argument UNMARK is positive, remove any kinds of marks.
8959 If optional argument UNMARK is negative, mark articles as unread instead."
8963 ((null unmark) ; Mark as read.
8966 (gnus-summary-mark-article-as-read gnus-killed-mark)
8967 (gnus-summary-show-thread) t)
8968 (gnus-summary-find-subject subject))
8969 (setq count (1+ count))))
8970 ((> unmark 0) ; Tick.
8973 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
8974 (gnus-summary-show-thread) t)
8975 (gnus-summary-find-subject subject))
8976 (setq count (1+ count))))
8977 (t ; Mark as unread.
8980 (gnus-summary-mark-article-as-unread gnus-unread-mark)
8981 (gnus-summary-show-thread) t)
8982 (gnus-summary-find-subject subject))
8983 (setq count (1+ count)))))
8984 (gnus-set-mode-line 'summary)
8985 ;; Return the number of marked articles.
8988 (defun gnus-summary-mark-as-processable (n &optional unmark)
8989 "Set the process mark on the next N articles.
8990 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8991 the process mark instead. The difference between N and the actual
8992 number of articles marked is returned."
8994 (if (and (null n) (gnus-region-active-p))
8995 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
8996 (setq n (prefix-numeric-value n))
8997 (let ((backward (< n 0))
9002 (gnus-summary-remove-process-mark
9003 (gnus-summary-article-number))
9004 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9005 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9008 (gnus-message 7 "No more articles"))
9009 (gnus-summary-recenter)
9010 (gnus-summary-position-point)
9013 (defun gnus-summary-unmark-as-processable (n)
9014 "Remove the process mark from the next N articles.
9015 If N is negative, unmark backward instead. The difference between N and
9016 the actual number of articles unmarked is returned."
9018 (gnus-summary-mark-as-processable n t))
9020 (defun gnus-summary-unmark-all-processable ()
9021 "Remove the process mark from all articles."
9024 (while gnus-newsgroup-processable
9025 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9026 (gnus-summary-position-point))
9028 (defun gnus-summary-add-mark (article type)
9029 "Mark ARTICLE with a mark of TYPE."
9030 (let ((vtype (car (assq type gnus-article-mark-lists)))
9033 (error "No such mark type: %s" type)
9034 (setq var (intern (format "gnus-newsgroup-%s" type)))
9035 (set var (cons article (symbol-value var)))
9036 (if (memq type '(processable cached replied forwarded recent saved))
9037 (gnus-summary-update-secondary-mark article)
9038 ;;; !!! This is bogus. We should find out what primary
9039 ;;; !!! mark we want to set.
9040 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9042 (defun gnus-summary-mark-as-expirable (n)
9043 "Mark N articles forward as expirable.
9044 If N is negative, mark backward instead. The difference between N and
9045 the actual number of articles marked is returned."
9047 (gnus-summary-mark-forward n gnus-expirable-mark))
9049 (defun gnus-summary-mark-article-as-replied (article)
9050 "Mark ARTICLE as replied to and update the summary line.
9051 ARTICLE can also be a list of articles."
9052 (interactive (list (gnus-summary-article-number)))
9053 (let ((articles (if (listp article) article (list article))))
9054 (dolist (article articles)
9055 (push article gnus-newsgroup-replied)
9056 (let ((buffer-read-only nil))
9057 (when (gnus-summary-goto-subject article nil t)
9058 (gnus-summary-update-secondary-mark article))))))
9060 (defun gnus-summary-mark-article-as-forwarded (article)
9061 "Mark ARTICLE as forwarded and update the summary line.
9062 ARTICLE can also be a list of articles."
9063 (let ((articles (if (listp article) article (list article))))
9064 (dolist (article articles)
9065 (push article gnus-newsgroup-forwarded)
9066 (let ((buffer-read-only nil))
9067 (when (gnus-summary-goto-subject article nil t)
9068 (gnus-summary-update-secondary-mark article))))))
9070 (defun gnus-summary-set-bookmark (article)
9071 "Set a bookmark in current article."
9072 (interactive (list (gnus-summary-article-number)))
9073 (when (or (not (get-buffer gnus-article-buffer))
9074 (not gnus-current-article)
9075 (not gnus-article-current)
9076 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9077 (error "No current article selected"))
9078 ;; Remove old bookmark, if one exists.
9079 (let ((old (assq article gnus-newsgroup-bookmarks)))
9081 (setq gnus-newsgroup-bookmarks
9082 (delq old gnus-newsgroup-bookmarks))))
9083 ;; Set the new bookmark, which is on the form
9084 ;; (article-number . line-number-in-body).
9088 (set-buffer gnus-article-buffer)
9092 (goto-char (point-min))
9093 (search-forward "\n\n" nil t)
9096 gnus-newsgroup-bookmarks)
9097 (gnus-message 6 "A bookmark has been added to the current article."))
9099 (defun gnus-summary-remove-bookmark (article)
9100 "Remove the bookmark from the current article."
9101 (interactive (list (gnus-summary-article-number)))
9102 ;; Remove old bookmark, if one exists.
9103 (let ((old (assq article gnus-newsgroup-bookmarks)))
9106 (setq gnus-newsgroup-bookmarks
9107 (delq old gnus-newsgroup-bookmarks))
9108 (gnus-message 6 "Removed bookmark."))
9109 (gnus-message 6 "No bookmark in current article."))))
9111 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9112 (defun gnus-summary-mark-as-dormant (n)
9113 "Mark N articles forward as dormant.
9114 If N is negative, mark backward instead. The difference between N and
9115 the actual number of articles marked is returned."
9117 (gnus-summary-mark-forward n gnus-dormant-mark))
9119 (defun gnus-summary-set-process-mark (article)
9120 "Set the process mark on ARTICLE and update the summary line."
9121 (setq gnus-newsgroup-processable
9123 (delq article gnus-newsgroup-processable)))
9124 (when (gnus-summary-goto-subject article)
9125 (gnus-summary-show-thread)
9126 (gnus-summary-goto-subject article)
9127 (gnus-summary-update-secondary-mark article)))
9129 (defun gnus-summary-remove-process-mark (article)
9130 "Remove the process mark from ARTICLE and update the summary line."
9131 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9132 (when (gnus-summary-goto-subject article)
9133 (gnus-summary-show-thread)
9134 (gnus-summary-goto-subject article)
9135 (gnus-summary-update-secondary-mark article)))
9137 (defun gnus-summary-set-saved-mark (article)
9138 "Set the process mark on ARTICLE and update the summary line."
9139 (push article gnus-newsgroup-saved)
9140 (when (gnus-summary-goto-subject article)
9141 (gnus-summary-update-secondary-mark article)))
9143 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9144 "Mark N articles as read forwards.
9145 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9146 The difference between N and the actual number of articles marked is
9148 Iff NO-EXPIRE, auto-expiry will be inhibited."
9150 (gnus-summary-show-thread)
9151 (let ((backward (< n 0))
9152 (gnus-summary-goto-unread
9153 (and gnus-summary-goto-unread
9154 (not (eq gnus-summary-goto-unread 'never))
9155 (not (memq mark (list gnus-unread-mark
9156 gnus-ticked-mark gnus-dormant-mark)))))
9158 (mark (or mark gnus-del-mark)))
9160 (gnus-summary-mark-article nil mark no-expire)
9161 (zerop (gnus-summary-next-subject
9163 (and gnus-summary-goto-unread
9164 (not (eq gnus-summary-goto-unread 'never)))
9168 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9169 (gnus-summary-recenter)
9170 (gnus-summary-position-point)
9171 (gnus-set-mode-line 'summary)
9174 (defun gnus-summary-mark-article-as-read (mark)
9175 "Mark the current article quickly as read with MARK."
9176 (let ((article (gnus-summary-article-number)))
9177 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9178 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9179 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9180 (push (cons article mark) gnus-newsgroup-reads)
9181 ;; Possibly remove from cache, if that is used.
9182 (when gnus-use-cache
9183 (gnus-cache-enter-remove-article article))
9184 ;; Allow the backend to change the mark.
9185 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9186 ;; Check for auto-expiry.
9187 (when (and gnus-newsgroup-auto-expire
9188 (memq mark gnus-auto-expirable-marks))
9189 (setq mark gnus-expirable-mark)
9190 ;; Let the backend know about the mark change.
9191 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9192 (push article gnus-newsgroup-expirable))
9193 ;; Set the mark in the buffer.
9194 (gnus-summary-update-mark mark 'unread)
9197 (defun gnus-summary-mark-article-as-unread (mark)
9198 "Mark the current article quickly as unread with MARK."
9199 (let* ((article (gnus-summary-article-number))
9200 (old-mark (gnus-summary-article-mark article)))
9201 ;; Allow the backend to change the mark.
9202 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9203 (if (eq mark old-mark)
9207 (gnus-error 1 "Can't mark negative article numbers")
9209 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9210 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9211 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9212 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9213 (cond ((= mark gnus-ticked-mark)
9214 (push article gnus-newsgroup-marked))
9215 ((= mark gnus-dormant-mark)
9216 (push article gnus-newsgroup-dormant))
9218 (push article gnus-newsgroup-unreads)))
9219 (gnus-pull article gnus-newsgroup-reads)
9221 ;; See whether the article is to be put in the cache.
9223 (vectorp (gnus-summary-article-header article))
9225 (gnus-cache-possibly-enter-article
9226 gnus-newsgroup-name article
9227 (gnus-summary-article-header article)
9228 (= mark gnus-ticked-mark)
9229 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9232 (gnus-summary-update-mark mark 'unread)
9235 (defun gnus-summary-mark-article (&optional article mark no-expire)
9236 "Mark ARTICLE with MARK. MARK can be any character.
9237 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9238 `??' (dormant) and `?E' (expirable).
9239 If MARK is nil, then the default character `?r' is used.
9240 If ARTICLE is nil, then the article on the current line will be
9242 Iff NO-EXPIRE, auto-expiry will be inhibited."
9243 ;; The mark might be a string.
9244 (when (stringp mark)
9245 (setq mark (aref mark 0)))
9246 ;; If no mark is given, then we check auto-expiring.
9248 (setq mark gnus-del-mark))
9249 (when (and (not no-expire)
9250 gnus-newsgroup-auto-expire
9251 (memq mark gnus-auto-expirable-marks))
9252 (setq mark gnus-expirable-mark))
9253 (let ((article (or article (gnus-summary-article-number)))
9254 (old-mark (gnus-summary-article-mark article)))
9255 ;; Allow the backend to change the mark.
9256 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9257 (if (eq mark old-mark)
9260 (error "No article on current line"))
9261 (if (not (if (or (= mark gnus-unread-mark)
9262 (= mark gnus-ticked-mark)
9263 (= mark gnus-dormant-mark))
9264 (gnus-mark-article-as-unread article mark)
9265 (gnus-mark-article-as-read article mark)))
9267 ;; See whether the article is to be put in the cache.
9269 (not (= mark gnus-canceled-mark))
9270 (vectorp (gnus-summary-article-header article))
9272 (gnus-cache-possibly-enter-article
9273 gnus-newsgroup-name article
9274 (gnus-summary-article-header article)
9275 (= mark gnus-ticked-mark)
9276 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9278 (when (gnus-summary-goto-subject article nil t)
9279 (let ((buffer-read-only nil))
9280 (gnus-summary-show-thread)
9282 (gnus-summary-update-mark mark 'unread)
9285 (defun gnus-summary-update-secondary-mark (article)
9286 "Update the secondary (read, process, cache) mark."
9287 (gnus-summary-update-mark
9288 (cond ((memq article gnus-newsgroup-processable)
9290 ((memq article gnus-newsgroup-cached)
9292 ((memq article gnus-newsgroup-replied)
9294 ((memq article gnus-newsgroup-forwarded)
9295 gnus-forwarded-mark)
9296 ((memq article gnus-newsgroup-saved)
9298 ((memq article gnus-newsgroup-recent)
9300 ((memq article gnus-newsgroup-unseen)
9304 (when (gnus-visual-p 'summary-highlight 'highlight)
9305 (gnus-run-hooks 'gnus-summary-update-hook))
9308 (defun gnus-summary-update-mark (mark type)
9309 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9310 (buffer-read-only nil))
9311 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9313 (when (looking-at "\r")
9315 (when (<= (+ forward (point)) (point-max))
9316 ;; Go to the right position on the line.
9317 (goto-char (+ forward (point)))
9318 ;; Replace the old mark with the new mark.
9319 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9320 ;; Optionally update the marks by some user rule.
9321 (when (eq type 'unread)
9323 (gnus-data-find (gnus-summary-article-number)) mark)
9324 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9326 (defun gnus-mark-article-as-read (article &optional mark)
9327 "Enter ARTICLE in the pertinent lists and remove it from others."
9328 ;; Make the article expirable.
9329 (let ((mark (or mark gnus-del-mark)))
9330 (if (= mark gnus-expirable-mark)
9331 (push article gnus-newsgroup-expirable)
9332 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
9333 ;; Remove from unread and marked lists.
9334 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9335 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9336 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9337 (push (cons article mark) gnus-newsgroup-reads)
9338 ;; Possibly remove from cache, if that is used.
9339 (when gnus-use-cache
9340 (gnus-cache-enter-remove-article article))
9343 (defun gnus-mark-article-as-unread (article &optional mark)
9344 "Enter ARTICLE in the pertinent lists and remove it from others."
9345 (let ((mark (or mark gnus-ticked-mark)))
9348 (gnus-error 1 "Can't mark negative article numbers")
9350 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9351 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9352 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9353 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9355 ;; Unsuppress duplicates?
9356 (when gnus-suppress-duplicates
9357 (gnus-dup-unsuppress-article article))
9359 (cond ((= mark gnus-ticked-mark)
9360 (push article gnus-newsgroup-marked))
9361 ((= mark gnus-dormant-mark)
9362 (push article gnus-newsgroup-dormant))
9364 (push article gnus-newsgroup-unreads)))
9365 (gnus-pull article gnus-newsgroup-reads)
9368 (defalias 'gnus-summary-mark-as-unread-forward
9369 'gnus-summary-tick-article-forward)
9370 (make-obsolete 'gnus-summary-mark-as-unread-forward
9371 'gnus-summary-tick-article-forward)
9372 (defun gnus-summary-tick-article-forward (n)
9373 "Tick N articles forwards.
9374 If N is negative, tick backwards instead.
9375 The difference between N and the number of articles ticked is returned."
9377 (gnus-summary-mark-forward n gnus-ticked-mark))
9379 (defalias 'gnus-summary-mark-as-unread-backward
9380 'gnus-summary-tick-article-backward)
9381 (make-obsolete 'gnus-summary-mark-as-unread-backward
9382 'gnus-summary-tick-article-backward)
9383 (defun gnus-summary-tick-article-backward (n)
9384 "Tick N articles backwards.
9385 The difference between N and the number of articles ticked is returned."
9387 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
9389 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9390 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9391 (defun gnus-summary-tick-article (&optional article clear-mark)
9392 "Mark current article as unread.
9393 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9394 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9396 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
9399 (defun gnus-summary-mark-as-read-forward (n)
9400 "Mark N articles as read forwards.
9401 If N is negative, mark backwards instead.
9402 The difference between N and the actual number of articles marked is
9405 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
9407 (defun gnus-summary-mark-as-read-backward (n)
9408 "Mark the N articles as read backwards.
9409 The difference between N and the actual number of articles marked is
9412 (gnus-summary-mark-forward
9413 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
9415 (defun gnus-summary-mark-as-read (&optional article mark)
9416 "Mark current article as read.
9417 ARTICLE specifies the article to be marked as read.
9418 MARK specifies a string to be inserted at the beginning of the line."
9419 (gnus-summary-mark-article article mark))
9421 (defun gnus-summary-clear-mark-forward (n)
9422 "Clear marks from N articles forward.
9423 If N is negative, clear backward instead.
9424 The difference between N and the number of marks cleared is returned."
9426 (gnus-summary-mark-forward n gnus-unread-mark))
9428 (defun gnus-summary-clear-mark-backward (n)
9429 "Clear marks from N articles backward.
9430 The difference between N and the number of marks cleared is returned."
9432 (gnus-summary-mark-forward (- n) gnus-unread-mark))
9434 (defun gnus-summary-mark-unread-as-read ()
9435 "Intended to be used by `gnus-summary-mark-article-hook'."
9436 (when (memq gnus-current-article gnus-newsgroup-unreads)
9437 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
9439 (defun gnus-summary-mark-read-and-unread-as-read ()
9440 "Intended to be used by `gnus-summary-mark-article-hook'."
9441 (let ((mark (gnus-summary-article-mark)))
9442 (when (or (gnus-unread-mark-p mark)
9443 (gnus-read-mark-p mark))
9444 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
9446 (defun gnus-summary-mark-unread-as-ticked ()
9447 "Intended to be used by `gnus-summary-mark-article-hook'."
9448 (when (memq gnus-current-article gnus-newsgroup-unreads)
9449 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
9451 (defun gnus-summary-mark-region-as-read (point mark all)
9452 "Mark all unread articles between point and mark as read.
9453 If given a prefix, mark all articles between point and mark as read,
9454 even ticked and dormant ones."
9455 (interactive "r\nP")
9464 (memq (setq article (gnus-summary-article-number))
9465 gnus-newsgroup-unreads))
9466 (gnus-summary-mark-article article gnus-del-mark))
9468 (gnus-summary-find-next))))))
9470 (defun gnus-summary-mark-below (score mark)
9471 "Mark articles with score less than SCORE with MARK."
9472 (interactive "P\ncMark: ")
9473 (setq score (if score
9474 (prefix-numeric-value score)
9475 (or gnus-summary-default-score 0)))
9477 (set-buffer gnus-summary-buffer)
9478 (goto-char (point-min))
9481 (and (< (gnus-summary-article-score) score)
9482 (gnus-summary-mark-article nil mark))
9483 (gnus-summary-find-next)))))
9485 (defun gnus-summary-kill-below (&optional score)
9486 "Mark articles with score below SCORE as read."
9488 (gnus-summary-mark-below score gnus-killed-mark))
9490 (defun gnus-summary-clear-above (&optional score)
9491 "Clear all marks from articles with score above SCORE."
9493 (gnus-summary-mark-above score gnus-unread-mark))
9495 (defun gnus-summary-tick-above (&optional score)
9496 "Tick all articles with score above SCORE."
9498 (gnus-summary-mark-above score gnus-ticked-mark))
9500 (defun gnus-summary-mark-above (score mark)
9501 "Mark articles with score over SCORE with MARK."
9502 (interactive "P\ncMark: ")
9503 (setq score (if score
9504 (prefix-numeric-value score)
9505 (or gnus-summary-default-score 0)))
9507 (set-buffer gnus-summary-buffer)
9508 (goto-char (point-min))
9510 (when (> (gnus-summary-article-score) score)
9511 (gnus-summary-mark-article nil mark))
9513 (gnus-summary-find-next)))))
9515 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9516 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
9517 (defun gnus-summary-limit-include-expunged (&optional no-error)
9518 "Display all the hidden articles that were expunged for low scores."
9520 (let ((buffer-read-only nil))
9521 (let ((scored gnus-newsgroup-scored)
9524 (unless (gnus-summary-article-header (caar scored))
9525 (and (setq h (gnus-number-to-header (caar scored)))
9526 (< (cdar scored) gnus-summary-expunge-below)
9528 (setq scored (cdr scored)))
9530 (when (not no-error)
9531 (error "No expunged articles hidden"))
9532 (goto-char (point-min))
9533 (push gnus-newsgroup-limit gnus-newsgroup-limits)
9534 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
9535 (mapcar (lambda (x) (push (mail-header-number x)
9536 gnus-newsgroup-limit))
9538 (gnus-summary-prepare-unthreaded (nreverse headers))
9539 (goto-char (point-min))
9540 (gnus-summary-position-point)
9543 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
9544 "Mark all unread articles in this newsgroup as read.
9545 If prefix argument ALL is non-nil, ticked and dormant articles will
9546 also be marked as read.
9547 If QUIETLY is non-nil, no questions will be asked.
9548 If TO-HERE is non-nil, it should be a point in the buffer. All
9549 articles before (after, if REVERSE is set) this point will be marked as read.
9550 Note that this function will only catch up the unread article
9551 in the current summary buffer limitation.
9552 The number of articles marked as read is returned."
9557 (not gnus-interactive-catchup) ;Without confirmation?
9561 "Mark absolutely all articles as read? "
9562 "Mark all unread articles as read? ")))
9564 (not gnus-newsgroup-adaptive)
9565 (not gnus-newsgroup-auto-expire)
9566 (not gnus-suppress-duplicates)
9567 (or (not gnus-use-cache)
9568 (eq gnus-use-cache 'passive)))
9571 (setq gnus-newsgroup-marked nil
9572 gnus-newsgroup-dormant nil))
9573 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
9574 ;; We actually mark all articles as canceled, which we
9575 ;; have to do when using auto-expiry or adaptive scoring.
9576 (gnus-summary-show-all-threads)
9577 (if (and to-here reverse)
9581 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9582 (gnus-summary-find-next (not all) nil nil t))))
9583 (when (gnus-summary-first-subject (not all) t)
9585 (if to-here (< (point) to-here) t)
9586 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9587 (gnus-summary-find-next (not all) nil nil t)))))
9588 (gnus-set-mode-line 'summary))
9590 (gnus-summary-position-point)))
9592 (defun gnus-summary-catchup-to-here (&optional all)
9593 "Mark all unticked articles before the current one as read.
9594 If ALL is non-nil, also mark ticked and dormant articles as read."
9597 (gnus-save-hidden-threads
9598 (let ((beg (point)))
9599 ;; We check that there are unread articles.
9600 (when (or all (gnus-summary-find-prev))
9601 (gnus-summary-catchup all t beg)))))
9602 (gnus-summary-position-point))
9604 (defun gnus-summary-catchup-from-here (&optional all)
9605 "Mark all unticked articles after the current one as read.
9606 If ALL is non-nil, also mark ticked and dormant articles as read."
9609 (gnus-save-hidden-threads
9610 (let ((beg (point)))
9611 ;; We check that there are unread articles.
9612 (when (or all (gnus-summary-find-next))
9613 (gnus-summary-catchup all t beg nil t)))))
9614 (gnus-summary-position-point))
9616 (defun gnus-summary-catchup-all (&optional quietly)
9617 "Mark all articles in this newsgroup as read."
9619 (gnus-summary-catchup t quietly))
9621 (defun gnus-summary-catchup-and-exit (&optional all quietly)
9622 "Mark all unread articles in this group as read, then exit.
9623 If prefix argument ALL is non-nil, all articles are marked as read.
9624 If QUIETLY is non-nil, no questions will be asked."
9626 (when (gnus-summary-catchup all quietly nil 'fast)
9627 ;; Select next newsgroup or exit.
9628 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
9629 (eq gnus-auto-select-next 'quietly))
9630 (gnus-summary-next-group nil)
9631 (gnus-summary-exit))))
9633 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
9634 "Mark all articles in this newsgroup as read, and then exit."
9636 (gnus-summary-catchup-and-exit t quietly))
9638 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
9639 "Mark all articles in this group as read and select the next group.
9640 If given a prefix, mark all articles, unread as well as ticked, as
9644 (gnus-summary-catchup all))
9645 (gnus-summary-next-group))
9651 (defmacro gnus-with-article (article &rest forms)
9652 "Select ARTICLE and perform FORMS in the original article buffer.
9653 Then replace the article with the result."
9655 ;; We don't want the article to be marked as read.
9656 (let (gnus-mark-article-hook)
9657 (gnus-summary-select-article t t nil ,article))
9658 (set-buffer gnus-original-article-buffer)
9660 (if (not (gnus-check-backend-function
9661 'request-replace-article (car gnus-article-current)))
9662 (gnus-message 5 "Read-only group; not replacing")
9663 (unless (gnus-request-replace-article
9664 ,article (car gnus-article-current)
9666 (error "Couldn't replace article")))
9667 ;; The cache and backlog have to be flushed somewhat.
9668 (when gnus-keep-backlog
9669 (gnus-backlog-remove-article
9670 (car gnus-article-current) (cdr gnus-article-current)))
9671 (when gnus-use-cache
9672 (gnus-cache-update-article
9673 (car gnus-article-current) (cdr gnus-article-current)))))
9675 (put 'gnus-with-article 'lisp-indent-function 1)
9676 (put 'gnus-with-article 'edebug-form-spec '(form body))
9678 ;; Thread-based commands.
9680 (defun gnus-summary-articles-in-thread (&optional article)
9681 "Return a list of all articles in the current thread.
9682 If ARTICLE is non-nil, return all articles in the thread that starts
9684 (let* ((article (or article (gnus-summary-article-number)))
9685 (data (gnus-data-find-list article))
9686 (top-level (gnus-data-level (car data)))
9688 (cond ((null gnus-thread-operation-ignore-subject)
9689 (gnus-simplify-subject-re
9690 (mail-header-subject (gnus-data-header (car data)))))
9691 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
9692 (gnus-simplify-subject-fuzzy
9693 (mail-header-subject (gnus-data-header (car data)))))
9695 (end-point (save-excursion
9696 (if (gnus-summary-go-to-next-thread)
9697 (point) (point-max))))
9700 (< (gnus-data-pos (car data)) end-point))
9701 (when (or (not top-subject)
9702 (string= top-subject
9703 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
9704 (gnus-simplify-subject-fuzzy
9705 (mail-header-subject
9706 (gnus-data-header (car data))))
9707 (gnus-simplify-subject-re
9708 (mail-header-subject
9709 (gnus-data-header (car data)))))))
9710 (push (gnus-data-number (car data)) articles))
9711 (unless (and (setq data (cdr data))
9712 (> (gnus-data-level (car data)) top-level))
9714 ;; Return the list of articles.
9715 (nreverse articles)))
9717 (defun gnus-summary-rethread-current ()
9718 "Rethread the thread the current article is part of."
9720 (let* ((gnus-show-threads t)
9721 (article (gnus-summary-article-number))
9722 (id (mail-header-id (gnus-summary-article-header)))
9723 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
9725 (error "No article on the current line"))
9726 (gnus-rebuild-thread id)
9727 (gnus-summary-goto-subject article)))
9729 (defun gnus-summary-reparent-thread ()
9730 "Make the current article child of the marked (or previous) article.
9732 Note that the re-threading will only work if `gnus-thread-ignore-subject'
9733 is non-nil or the Subject: of both articles are the same."
9735 (unless (not (gnus-group-read-only-p))
9736 (error "The current newsgroup does not support article editing"))
9737 (unless (<= (length gnus-newsgroup-processable) 1)
9738 (error "No more than one article may be marked"))
9739 (save-window-excursion
9740 (let ((gnus-article-buffer " *reparent*")
9741 (current-article (gnus-summary-article-number))
9742 ;; First grab the marked article, otherwise one line up.
9743 (parent-article (if (not (null gnus-newsgroup-processable))
9744 (car gnus-newsgroup-processable)
9746 (if (eq (forward-line -1) 0)
9747 (gnus-summary-article-number)
9748 (error "Beginning of summary buffer"))))))
9749 (unless (not (eq current-article parent-article))
9750 (error "An article may not be self-referential"))
9751 (let ((message-id (mail-header-id
9752 (gnus-summary-article-header parent-article))))
9753 (unless (and message-id (not (equal message-id "")))
9754 (error "No message-id in desired parent"))
9755 (gnus-with-article current-article
9757 (goto-char (point-min))
9758 (message-narrow-to-head)
9759 (if (re-search-forward "^References: " nil t)
9761 (re-search-forward "^[^ \t]" nil t)
9764 (insert " " message-id))
9765 (insert "References: " message-id "\n"))))
9766 (set-buffer gnus-summary-buffer)
9767 (gnus-summary-unmark-all-processable)
9768 (gnus-summary-update-article current-article)
9769 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9770 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
9771 (gnus-summary-rethread-current)
9772 (gnus-message 3 "Article %d is now the child of article %d"
9773 current-article parent-article)))))
9775 (defun gnus-summary-toggle-threads (&optional arg)
9776 "Toggle showing conversation threads.
9777 If ARG is positive number, turn showing conversation threads on."
9779 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
9780 (setq gnus-show-threads
9781 (if (null arg) (not gnus-show-threads)
9782 (> (prefix-numeric-value arg) 0)))
9783 (gnus-summary-prepare)
9784 (gnus-summary-goto-subject current)
9785 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
9786 (gnus-summary-position-point)))
9788 (defun gnus-summary-show-all-threads ()
9792 (let ((buffer-read-only nil))
9793 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
9794 (gnus-summary-position-point))
9796 (defun gnus-summary-show-thread ()
9797 "Show thread subtrees.
9798 Returns nil if no thread was there to be shown."
9800 (let ((buffer-read-only nil)
9802 ;; first goto end then to beg, to have point at beg after let
9803 (end (progn (end-of-line) (point)))
9804 (beg (progn (beginning-of-line) (point))))
9806 ;; Any hidden lines here?
9807 (search-forward "\r" end t)
9808 (subst-char-in-region beg end ?\^M ?\n t)
9810 (gnus-summary-position-point))))
9812 (defun gnus-summary-hide-all-threads ()
9813 "Hide all thread subtrees."
9816 (goto-char (point-min))
9817 (gnus-summary-hide-thread)
9818 (while (zerop (gnus-summary-next-thread 1 t))
9819 (gnus-summary-hide-thread)))
9820 (gnus-summary-position-point))
9822 (defun gnus-summary-hide-thread ()
9823 "Hide thread subtrees.
9824 Returns nil if no threads were there to be hidden."
9826 (let ((buffer-read-only nil)
9828 (article (gnus-summary-article-number)))
9830 ;; Go forward until either the buffer ends or the subthread
9832 (when (and (not (eobp))
9833 (or (zerop (gnus-summary-next-thread 1 t))
9834 (goto-char (point-max))))
9836 (if (and (> (point) start)
9837 (search-backward "\n" start t))
9839 (subst-char-in-region start (point) ?\n ?\^M)
9840 (gnus-summary-goto-subject article))
9844 (defun gnus-summary-go-to-next-thread (&optional previous)
9845 "Go to the same level (or less) next thread.
9846 If PREVIOUS is non-nil, go to previous thread instead.
9847 Return the article number moved to, or nil if moving was impossible."
9848 (let ((level (gnus-summary-thread-level))
9849 (way (if previous -1 1))
9852 (while (and (not (eobp))
9853 (< level (gnus-summary-thread-level)))
9861 (gnus-summary-article-number)
9864 (defun gnus-summary-next-thread (n &optional silent)
9865 "Go to the same level next N'th thread.
9866 If N is negative, search backward instead.
9867 Returns the difference between N and the number of skips actually
9870 If SILENT, don't output messages."
9872 (let ((backward (< n 0))
9875 (gnus-summary-go-to-next-thread backward))
9878 (gnus-summary-position-point))
9879 (when (and (not silent) (/= 0 n))
9880 (gnus-message 7 "No more threads"))
9883 (defun gnus-summary-prev-thread (n)
9884 "Go to the same level previous N'th thread.
9885 Returns the difference between N and the number of skips actually
9888 (gnus-summary-next-thread (- n)))
9890 (defun gnus-summary-go-down-thread ()
9891 "Go down one level in the current thread."
9892 (let ((children (gnus-summary-article-children)))
9894 (gnus-summary-goto-subject (car children)))))
9896 (defun gnus-summary-go-up-thread ()
9897 "Go up one level in the current thread."
9898 (let ((parent (gnus-summary-article-parent)))
9900 (gnus-summary-goto-subject parent))))
9902 (defun gnus-summary-down-thread (n)
9903 "Go down thread N steps.
9904 If N is negative, go up instead.
9905 Returns the difference between N and how many steps down that were
9911 (if up (gnus-summary-go-up-thread)
9912 (gnus-summary-go-down-thread)))
9914 (gnus-summary-position-point)
9916 (gnus-message 7 "Can't go further"))
9919 (defun gnus-summary-up-thread (n)
9920 "Go up thread N steps.
9921 If N is negative, go down instead.
9922 Returns the difference between N and how many steps down that were
9925 (gnus-summary-down-thread (- n)))
9927 (defun gnus-summary-top-thread ()
9928 "Go to the top of the thread."
9930 (while (gnus-summary-go-up-thread))
9931 (gnus-summary-article-number))
9933 (defun gnus-summary-kill-thread (&optional unmark)
9934 "Mark articles under current thread as read.
9935 If the prefix argument is positive, remove any kinds of marks.
9936 If the prefix argument is negative, tick articles instead."
9939 (setq unmark (prefix-numeric-value unmark)))
9940 (let ((articles (gnus-summary-articles-in-thread)))
9942 ;; Expand the thread.
9943 (gnus-summary-show-thread)
9944 ;; Mark all the articles.
9946 (gnus-summary-goto-subject (car articles))
9947 (cond ((null unmark)
9948 (gnus-summary-mark-article-as-read gnus-killed-mark))
9950 (gnus-summary-mark-article-as-unread gnus-unread-mark))
9952 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
9953 (setq articles (cdr articles))))
9954 ;; Hide killed subtrees.
9956 gnus-thread-hide-killed
9957 (gnus-summary-hide-thread))
9958 ;; If marked as read, go to next unread subject.
9960 ;; Go to next unread subject.
9961 (gnus-summary-next-subject 1 t)))
9962 (gnus-set-mode-line 'summary))
9964 ;; Summary sorting commands
9966 (defun gnus-summary-sort-by-number (&optional reverse)
9967 "Sort the summary buffer by article number.
9968 Argument REVERSE means reverse order."
9970 (gnus-summary-sort 'number reverse))
9972 (defun gnus-summary-sort-by-author (&optional reverse)
9973 "Sort the summary buffer by author name alphabetically.
9974 If `case-fold-search' is non-nil, case of letters is ignored.
9975 Argument REVERSE means reverse order."
9977 (gnus-summary-sort 'author reverse))
9979 (defun gnus-summary-sort-by-subject (&optional reverse)
9980 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9981 If `case-fold-search' is non-nil, case of letters is ignored.
9982 Argument REVERSE means reverse order."
9984 (gnus-summary-sort 'subject reverse))
9986 (defun gnus-summary-sort-by-date (&optional reverse)
9987 "Sort the summary buffer by date.
9988 Argument REVERSE means reverse order."
9990 (gnus-summary-sort 'date reverse))
9992 (defun gnus-summary-sort-by-score (&optional reverse)
9993 "Sort the summary buffer by score.
9994 Argument REVERSE means reverse order."
9996 (gnus-summary-sort 'score reverse))
9998 (defun gnus-summary-sort-by-lines (&optional reverse)
9999 "Sort the summary buffer by the number of lines.
10000 Argument REVERSE means reverse order."
10002 (gnus-summary-sort 'lines reverse))
10004 (defun gnus-summary-sort-by-chars (&optional reverse)
10005 "Sort the summary buffer by article length.
10006 Argument REVERSE means reverse order."
10008 (gnus-summary-sort 'chars reverse))
10010 (defun gnus-summary-sort-by-original (&optional reverse)
10011 "Sort the summary buffer using the default sorting method.
10012 Argument REVERSE means reverse order."
10014 (let* ((buffer-read-only)
10015 (gnus-summary-prepare-hook nil))
10016 ;; We do the sorting by regenerating the threads.
10017 (gnus-summary-prepare)
10018 ;; Hide subthreads if needed.
10019 (when (and gnus-show-threads gnus-thread-hide-subtree)
10020 (gnus-summary-hide-all-threads))))
10022 (defun gnus-summary-sort (predicate reverse)
10023 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10024 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10025 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10026 (gnus-thread-sort-functions
10031 (gnus-sort-gathered-threads-function
10032 gnus-thread-sort-functions)
10033 (gnus-article-sort-functions
10037 (,article t2 t1))))
10039 (gnus-summary-prepare-hook nil))
10040 ;; We do the sorting by regenerating the threads.
10041 (gnus-summary-prepare)
10042 ;; Hide subthreads if needed.
10043 (when (and gnus-show-threads gnus-thread-hide-subtree)
10044 (gnus-summary-hide-all-threads))))
10046 ;; Summary saving commands.
10048 (defun gnus-summary-save-article (&optional n not-saved)
10049 "Save the current article using the default saver function.
10050 If N is a positive number, save the N next articles.
10051 If N is a negative number, save the N previous articles.
10052 If N is nil and any articles have been marked with the process mark,
10053 save those articles instead.
10054 The variable `gnus-default-article-saver' specifies the saver function."
10056 (let* ((articles (gnus-summary-work-articles n))
10057 (save-buffer (save-excursion
10058 (nnheader-set-temp-buffer " *Gnus Save*")))
10059 (num (length articles))
10061 (dolist (article articles)
10062 (setq header (gnus-summary-article-header article))
10063 (if (not (vectorp header))
10064 ;; This is a pseudo-article.
10065 (if (assq 'name header)
10066 (gnus-copy-file (cdr (assq 'name header)))
10067 (gnus-message 1 "Article %d is unsaveable" article))
10068 ;; This is a real article.
10069 (save-window-excursion
10070 (let ((gnus-display-mime-function nil)
10071 (gnus-article-prepare-hook nil))
10072 (gnus-summary-select-article t nil nil article)))
10074 (set-buffer save-buffer)
10076 (insert-buffer-substring gnus-original-article-buffer))
10077 (setq file (gnus-article-save save-buffer file num))
10078 (gnus-summary-remove-process-mark article)
10080 (gnus-summary-set-saved-mark article))))
10081 (gnus-kill-buffer save-buffer)
10082 (gnus-summary-position-point)
10083 (gnus-set-mode-line 'summary)
10086 (defun gnus-summary-pipe-output (&optional arg)
10087 "Pipe the current article to a subprocess.
10088 If N is a positive number, pipe the N next articles.
10089 If N is a negative number, pipe the N previous articles.
10090 If N is nil and any articles have been marked with the process mark,
10091 pipe those articles instead."
10093 (require 'gnus-art)
10094 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
10095 (gnus-summary-save-article arg t))
10096 (let ((buffer (get-buffer "*Shell Command Output*")))
10098 (with-current-buffer buffer (> (point-max) (point-min))))
10099 (gnus-configure-windows 'pipe))))
10101 (defun gnus-summary-save-article-mail (&optional arg)
10102 "Append the current article to an mail file.
10103 If N is a positive number, save the N next articles.
10104 If N is a negative number, save the N previous articles.
10105 If N is nil and any articles have been marked with the process mark,
10106 save those articles instead."
10108 (require 'gnus-art)
10109 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10110 (gnus-summary-save-article arg)))
10112 (defun gnus-summary-save-article-rmail (&optional arg)
10113 "Append the current article to an rmail file.
10114 If N is a positive number, save the N next articles.
10115 If N is a negative number, save the N previous articles.
10116 If N is nil and any articles have been marked with the process mark,
10117 save those articles instead."
10119 (require 'gnus-art)
10120 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10121 (gnus-summary-save-article arg)))
10123 (defun gnus-summary-save-article-file (&optional arg)
10124 "Append the current article to a file.
10125 If N is a positive number, save the N next articles.
10126 If N is a negative number, save the N previous articles.
10127 If N is nil and any articles have been marked with the process mark,
10128 save those articles instead."
10130 (require 'gnus-art)
10131 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10132 (gnus-summary-save-article arg)))
10134 (defun gnus-summary-write-article-file (&optional arg)
10135 "Write the current article to a file, deleting the previous file.
10136 If N is a positive number, save the N next articles.
10137 If N is a negative number, save the N previous articles.
10138 If N is nil and any articles have been marked with the process mark,
10139 save those articles instead."
10141 (require 'gnus-art)
10142 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10143 (gnus-summary-save-article arg)))
10145 (defun gnus-summary-save-article-body-file (&optional arg)
10146 "Append the current article body to a file.
10147 If N is a positive number, save the N next articles.
10148 If N is a negative number, save the N previous articles.
10149 If N is nil and any articles have been marked with the process mark,
10150 save those articles instead."
10152 (require 'gnus-art)
10153 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10154 (gnus-summary-save-article arg)))
10156 (defun gnus-summary-muttprint (&optional arg)
10157 "Print the current article using Muttprint.
10158 If N is a positive number, save the N next articles.
10159 If N is a negative number, save the N previous articles.
10160 If N is nil and any articles have been marked with the process mark,
10161 save those articles instead."
10163 (require 'gnus-art)
10164 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10165 (gnus-summary-save-article arg t)))
10167 (defun gnus-summary-pipe-message (program)
10168 "Pipe the current article through PROGRAM."
10169 (interactive "sProgram: ")
10170 (gnus-summary-select-article)
10171 (let ((mail-header-separator ""))
10172 (gnus-eval-in-buffer-window gnus-article-buffer
10175 (let ((start (window-start))
10177 (message-pipe-buffer-body program)
10178 (set-window-start (get-buffer-window (current-buffer)) start))))))
10180 (defun gnus-get-split-value (methods)
10181 "Return a value based on the split METHODS."
10182 (let (split-name method result match)
10185 (set-buffer gnus-original-article-buffer)
10187 (nnheader-narrow-to-headers)
10188 (while (and methods (not split-name))
10189 (goto-char (point-min))
10190 (setq method (pop methods))
10191 (setq match (car method))
10194 ;; Regular expression.
10196 (re-search-forward match nil t)))
10197 ((gnus-functionp match)
10201 (setq result (funcall match gnus-newsgroup-name))))
10206 (setq result (eval match)))))
10207 (setq split-name (cdr method))
10208 (cond ((stringp result)
10209 (push (expand-file-name
10210 result gnus-article-save-directory)
10213 (setq split-name (append result split-name)))))))))
10214 (nreverse split-name)))
10216 (defun gnus-valid-move-group-p (group)
10217 (and (boundp group)
10218 (symbol-name group)
10219 (symbol-value group)
10220 (gnus-get-function (gnus-find-method-for-group
10221 (symbol-name group)) 'request-accept-article t)))
10223 (defun gnus-read-move-group-name (prompt default articles prefix)
10224 "Read a group name."
10225 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10226 (minibuffer-confirm-incomplete nil) ; XEmacs
10228 (format "%s %s to:"
10230 (if (> (length articles) 1)
10231 (format "these %d articles" (length articles))
10236 (gnus-completing-read default prom
10238 'gnus-valid-move-group-p
10240 'gnus-group-history))
10241 ((= 1 (length split-name))
10242 (gnus-completing-read (car split-name) prom
10244 'gnus-valid-move-group-p
10246 'gnus-group-history))
10248 (gnus-completing-read nil prom
10249 (mapcar (lambda (el) (list el))
10250 (nreverse split-name))
10252 'gnus-group-history))))
10253 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10255 (if (or (string= to-newsgroup "")
10256 (string= to-newsgroup prefix))
10257 (setq to-newsgroup default))
10258 (unless to-newsgroup
10259 (error "No group name entered"))
10260 (or (gnus-active to-newsgroup)
10261 (gnus-activate-group to-newsgroup nil nil to-method)
10262 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10264 (or (and (gnus-request-create-group to-newsgroup to-method)
10265 (gnus-activate-group
10266 to-newsgroup nil nil to-method)
10267 (gnus-subscribe-group to-newsgroup))
10268 (error "Couldn't create group %s" to-newsgroup)))
10269 (error "No such group: %s" to-newsgroup)))
10272 (defun gnus-summary-save-parts (type dir n &optional reverse)
10273 "Save parts matching TYPE to DIR.
10274 If REVERSE, save parts that do not match TYPE."
10276 (list (read-string "Save parts of type: "
10277 (or (car gnus-summary-save-parts-type-history)
10278 gnus-summary-save-parts-default-mime)
10279 'gnus-summary-save-parts-type-history)
10280 (setq gnus-summary-save-parts-last-directory
10281 (read-file-name "Save to directory: "
10282 gnus-summary-save-parts-last-directory
10284 current-prefix-arg))
10285 (gnus-summary-iterate n
10286 (let ((gnus-display-mime-function nil)
10287 (gnus-inhibit-treatment t))
10288 (gnus-summary-select-article))
10290 (set-buffer gnus-article-buffer)
10291 (let ((handles (or gnus-article-mime-handles
10292 (mm-dissect-buffer) (mm-uu-dissect))))
10294 (gnus-summary-save-parts-1 type dir handles reverse)
10295 (unless gnus-article-mime-handles ;; Don't destroy this case.
10296 (mm-destroy-parts handles)))))))
10298 (defun gnus-summary-save-parts-1 (type dir handle reverse)
10299 (if (stringp (car handle))
10300 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
10303 (not (string-match type (mm-handle-media-type handle)))
10304 (string-match type (mm-handle-media-type handle)))
10305 (let ((file (expand-file-name
10306 (file-name-nondirectory
10308 (mail-content-type-get
10309 (mm-handle-disposition handle) 'filename)
10310 (concat gnus-newsgroup-name
10311 "." (number-to-string
10312 (cdr gnus-article-current)))))
10314 (unless (file-exists-p file)
10315 (mm-save-part-to-file handle file))))))
10317 ;; Summary extract commands
10319 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
10320 (let ((buffer-read-only nil)
10321 (article (gnus-summary-article-number))
10323 (unless (gnus-summary-goto-subject article)
10324 (error "No such article: %d" article))
10325 (gnus-summary-position-point)
10326 ;; If all commands are to be bunched up on one line, we collect
10328 (unless gnus-view-pseudos-separately
10329 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
10332 (setq action (cdr (assq 'action (car ps))))
10333 (setq files (list (cdr (assq 'name (car ps)))))
10334 (while (and ps (cdr ps)
10335 (string= (or action "1")
10336 (or (cdr (assq 'action (cadr ps))) "2")))
10337 (push (cdr (assq 'name (cadr ps))) files)
10338 (setcdr ps (cddr ps)))
10340 (when (not (string-match "%s" action))
10343 (when (assq 'execute (car ps))
10344 (setcdr (assq 'execute (car ps))
10345 (funcall (if (string-match "%s" action)
10352 (gnus-quote-arg-for-sh-or-csh f)))
10354 (setq ps (cdr ps)))))
10355 (if (and gnus-view-pseudos (not not-view))
10357 (when (assq 'execute (car pslist))
10358 (gnus-execute-command (cdr (assq 'execute (car pslist)))
10359 (eq gnus-view-pseudos 'not-confirm)))
10360 (setq pslist (cdr pslist)))
10363 (setq after-article (or (cdr (assq 'article (car pslist)))
10364 (gnus-summary-article-number)))
10365 (gnus-summary-goto-subject after-article)
10368 (insert " " (file-name-nondirectory
10369 (cdr (assq 'name (car pslist))))
10370 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
10372 (forward-line -1) ; back to `b'
10373 (gnus-add-text-properties
10374 b (1- e) (list 'gnus-number gnus-reffed-article-number
10375 gnus-mouse-face-prop gnus-mouse-face))
10377 after-article gnus-reffed-article-number
10378 gnus-unread-mark b (car pslist) 0 (- e b))
10379 (push gnus-reffed-article-number gnus-newsgroup-unreads)
10380 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
10381 (setq pslist (cdr pslist)))))))
10383 (defun gnus-pseudos< (p1 p2)
10384 (let ((c1 (cdr (assq 'action p1)))
10385 (c2 (cdr (assq 'action p2))))
10386 (and c1 c2 (string< c1 c2))))
10388 (defun gnus-request-pseudo-article (props)
10389 (cond ((assq 'execute props)
10390 (gnus-execute-command (cdr (assq 'execute props)))))
10391 (let ((gnus-current-article (gnus-summary-article-number)))
10392 (gnus-run-hooks 'gnus-mark-article-hook)))
10394 (defun gnus-execute-command (command &optional automatic)
10396 (gnus-article-setup-buffer)
10397 (set-buffer gnus-article-buffer)
10398 (setq buffer-read-only nil)
10399 (let ((command (if automatic command
10400 (read-string "Command: " (cons command 0)))))
10402 (insert "$ " command "\n\n")
10403 (if gnus-view-pseudo-asynchronously
10404 (start-process "gnus-execute" (current-buffer) shell-file-name
10405 shell-command-switch command)
10406 (call-process shell-file-name nil t nil
10407 shell-command-switch command)))))
10409 ;; Summary kill commands.
10411 (defun gnus-summary-edit-global-kill (article)
10412 "Edit the \"global\" kill file."
10413 (interactive (list (gnus-summary-article-number)))
10414 (gnus-group-edit-global-kill article))
10416 (defun gnus-summary-edit-local-kill ()
10417 "Edit a local kill file applied to the current newsgroup."
10419 (setq gnus-current-headers (gnus-summary-article-header))
10420 (gnus-group-edit-local-kill
10421 (gnus-summary-article-number) gnus-newsgroup-name))
10423 ;;; Header reading.
10425 (defun gnus-read-header (id &optional header)
10426 "Read the headers of article ID and enter them into the Gnus system."
10427 (let ((group gnus-newsgroup-name)
10428 (gnus-override-method
10430 gnus-override-method
10431 (and (gnus-news-group-p gnus-newsgroup-name)
10432 (car (gnus-refer-article-methods)))))
10434 ;; First we check to see whether the header in question is already
10437 ;; This is a Message-ID.
10438 (setq header (or header (gnus-id-to-header id)))
10439 ;; This is an article number.
10440 (setq header (or header (gnus-summary-article-header id))))
10442 (not (gnus-summary-article-sparse-p (mail-header-number header))))
10443 ;; We have found the header.
10445 ;; If this is a sparse article, we have to nix out its
10446 ;; previous entry in the thread hashtb.
10448 (gnus-summary-article-sparse-p (mail-header-number header)))
10449 (let* ((parent (gnus-parent-id (mail-header-references header)))
10450 (thread (and parent (gnus-id-to-thread parent))))
10452 (delq (assq header thread) thread))))
10453 ;; We have to really fetch the header to this article.
10455 (set-buffer nntp-server-buffer)
10456 (when (setq where (gnus-request-head id group))
10457 (nnheader-fold-continuation-lines)
10458 (goto-char (point-max))
10460 (goto-char (point-min))
10464 ((cdr where) (cdr where))
10465 (header (mail-header-number header))
10466 (t gnus-reffed-article-number))
10468 (insert " Article retrieved.\n"))
10469 (if (or (not where)
10470 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
10471 () ; Malformed head.
10472 (unless (gnus-summary-article-sparse-p (mail-header-number header))
10473 (when (and (stringp id)
10474 (not (string= (gnus-group-real-name group)
10476 ;; If we fetched by Message-ID and the article came
10477 ;; from a different group, we fudge some bogus article
10478 ;; numbers for this article.
10479 (mail-header-set-number header gnus-reffed-article-number))
10481 (set-buffer gnus-summary-buffer)
10482 (decf gnus-reffed-article-number)
10483 (gnus-remove-header (mail-header-number header))
10484 (push header gnus-newsgroup-headers)
10485 (setq gnus-current-headers header)
10486 (push (mail-header-number header) gnus-newsgroup-limit)))
10489 (defun gnus-remove-header (number)
10490 "Remove header NUMBER from `gnus-newsgroup-headers'."
10491 (if (and gnus-newsgroup-headers
10492 (= number (mail-header-number (car gnus-newsgroup-headers))))
10493 (pop gnus-newsgroup-headers)
10494 (let ((headers gnus-newsgroup-headers))
10495 (while (and (cdr headers)
10496 (not (= number (mail-header-number (cadr headers)))))
10498 (when (cdr headers)
10499 (setcdr headers (cddr headers))))))
10502 ;;; summary highlights
10505 (defun gnus-highlight-selected-summary ()
10506 "Highlight selected article in summary buffer."
10507 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
10508 (when gnus-summary-selected-face
10510 (let* ((beg (progn (beginning-of-line) (point)))
10511 (end (progn (end-of-line) (point)))
10512 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
10513 (from (if (get-text-property beg gnus-mouse-face-prop)
10515 (or (next-single-property-change
10516 beg gnus-mouse-face-prop nil end)
10521 (or (next-single-property-change
10522 from gnus-mouse-face-prop nil end)
10524 ;; If no mouse-face prop on line we will have to = from = end,
10525 ;; so we highlight the entire line instead.
10526 (when (= (+ to 2) from)
10529 (if gnus-newsgroup-selected-overlay
10530 ;; Move old overlay.
10532 gnus-newsgroup-selected-overlay from to (current-buffer))
10533 ;; Create new overlay.
10535 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
10536 'face gnus-summary-selected-face))))))
10538 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
10539 (defun gnus-summary-highlight-line ()
10540 "Highlight current line according to `gnus-summary-highlight'."
10541 (let* ((list gnus-summary-highlight)
10543 (end (progn (end-of-line) (point)))
10544 ;; now find out where the line starts and leave point there.
10545 (beg (progn (beginning-of-line) (point)))
10546 (article (gnus-summary-article-number))
10547 (score (or (cdr (assq (or article gnus-current-article)
10548 gnus-newsgroup-scored))
10549 gnus-summary-default-score 0))
10550 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
10551 (inhibit-read-only t))
10552 ;; Eval the cars of the lists until we find a match.
10553 (let ((default gnus-summary-default-score)
10554 (default-high gnus-summary-default-high-score)
10555 (default-low gnus-summary-default-low-score))
10557 (not (eval (caar list))))
10558 (setq list (cdr list))))
10559 (let ((face (cdar list)))
10560 (unless (eq face (get-text-property beg 'face))
10561 (gnus-put-text-property-excluding-characters-with-faces
10563 (setq face (if (boundp face) (symbol-value face) face)))
10564 (when gnus-summary-highlight-line-function
10565 (funcall gnus-summary-highlight-line-function article face))))
10568 (defun gnus-update-read-articles (group unread &optional compute)
10569 "Update the list of read articles in GROUP."
10570 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
10571 (entry (gnus-gethash group gnus-newsrc-hashtb))
10572 (info (nth 2 entry))
10574 (unread (sort (copy-sequence unread) '<))
10576 (if (or (not info) (not active))
10577 ;; There is no info on this group if it was, in fact,
10578 ;; killed. Gnus stores no information on killed groups, so
10579 ;; there's nothing to be done.
10580 ;; One could store the information somewhere temporarily,
10581 ;; perhaps... Hmmm...
10583 ;; Remove any negative articles numbers.
10584 (while (and unread (< (car unread) 0))
10585 (setq unread (cdr unread)))
10586 ;; Remove any expired article numbers
10587 (while (and unread (< (car unread) (car active)))
10588 (setq unread (cdr unread)))
10589 ;; Compute the ranges of read articles by looking at the list of
10590 ;; unread articles.
10592 (when (/= (car unread) prev)
10593 (push (if (= prev (1- (car unread))) prev
10594 (cons prev (1- (car unread))))
10596 (setq prev (1+ (car unread)))
10597 (setq unread (cdr unread)))
10598 (when (<= prev (cdr active))
10599 (push (cons prev (cdr active)) read))
10600 (setq read (if (> (length read) 1) (nreverse read) read))
10605 ;; Propagate the read marks to the backend.
10606 (when (gnus-check-backend-function 'request-set-mark group)
10607 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
10608 (add (gnus-remove-from-range read (gnus-info-read info))))
10610 (unless (gnus-check-group group)
10611 (error "Can't open server for %s" group))
10612 (gnus-request-set-mark
10613 group (delq nil (list (if add (list add 'add '(read)))
10614 (if del (list del 'del '(read))))))
10616 `(gnus-request-set-mark
10619 (if del (list del 'add '(read)))
10620 (if add (list add 'del '(read))))))))))
10621 (set-buffer gnus-group-buffer)
10622 (gnus-undo-register
10624 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
10625 (gnus-info-set-read ',info ',(gnus-info-read info))
10626 (gnus-get-unread-articles-in-group ',info
10627 (gnus-active ,group))
10628 (gnus-group-update-group ,group t)
10630 ;; Enter this list into the group info.
10631 (gnus-info-set-read info read)
10632 ;; Set the number of unread articles in gnus-newsrc-hashtb.
10633 (gnus-get-unread-articles-in-group info (gnus-active group))
10636 (defun gnus-offer-save-summaries ()
10637 "Offer to save all active summary buffers."
10639 ;; Go through all buffers and find all summaries.
10640 (dolist (buffer (buffer-list))
10641 (when (and (setq buffer (buffer-name buffer))
10642 (string-match "Summary" buffer)
10644 (set-buffer buffer)
10645 ;; We check that this is, indeed, a summary buffer.
10646 (and (eq major-mode 'gnus-summary-mode)
10647 ;; Also make sure this isn't bogus.
10648 gnus-newsgroup-prepared
10649 ;; Also make sure that this isn't a
10650 ;; dead summary buffer.
10651 (not gnus-dead-summary-mode))))
10652 (push buffer buffers)))
10653 ;; Go through all these summary buffers and offer to save them.
10657 "Update summary buffer %s? "
10659 (switch-to-buffer buf)
10660 (gnus-summary-exit))
10664 ;;; @ for mime-partial
10667 (defun gnus-request-partial-message ()
10669 (let ((number (gnus-summary-article-number))
10670 (group gnus-newsgroup-name)
10671 (mother gnus-article-buffer))
10672 (set-buffer (get-buffer-create " *Partial Article*"))
10674 (setq mime-preview-buffer mother)
10675 (gnus-request-article-this-buffer number group)
10676 (mime-parse-buffer)
10679 (autoload 'mime-combine-message/partial-pieces-automatically
10681 "Internal method to combine message/partial messages automatically.")
10683 (mime-add-condition
10684 'action '((type . message)(subtype . partial)
10685 (major-mode . gnus-original-article-mode)
10686 (method . mime-combine-message/partial-pieces-automatically)
10687 (summary-buffer-exp . gnus-summary-buffer)
10688 (request-partial-message-method . gnus-request-partial-message)
10692 ;;; @ for message/rfc822
10695 (defun gnus-mime-extract-message/rfc822 (entity situation)
10696 (let (group article num cwin swin cur)
10698 (mime-insert-entity-content entity)
10699 (setq group (or (cdr (assq 'group situation))
10700 (completing-read "Group: "
10703 (gnus-read-active-file-p)
10704 gnus-newsgroup-name))
10705 article (gnus-request-accept-article group)))
10706 (when (and (consp article)
10707 (numberp (setq article (cdr article))))
10708 (setq num (1+ (or (cdr (assq 'number situation)) 0))
10709 cwin (get-buffer-window (current-buffer) t))
10710 (save-window-excursion
10711 (if (setq swin (get-buffer-window gnus-summary-buffer t))
10712 (select-window swin)
10713 (set-buffer gnus-summary-buffer))
10714 (setq cur gnus-current-article)
10716 (let (gnus-show-threads)
10717 (gnus-summary-goto-subject article t))
10718 (gnus-summary-clear-mark-forward 1)
10719 (gnus-summary-goto-subject cur))
10720 (when (and cwin (window-frame cwin))
10721 (select-frame (window-frame cwin)))
10722 (when (boundp 'mime-acting-situation-to-override)
10723 (set-alist 'mime-acting-situation-to-override
10726 (set-alist 'mime-acting-situation-to-override
10729 (save-current-buffer
10730 (set-buffer gnus-group-buffer)
10731 (gnus-activate-group ,group))
10732 (gnus-summary-goto-article ,cur
10733 gnus-show-all-headers)))
10734 (set-alist 'mime-acting-situation-to-override
10737 (mime-add-condition
10738 'action '((type . message)(subtype . rfc822)
10739 (major-mode . gnus-original-article-mode)
10740 (method . gnus-mime-extract-message/rfc822)
10744 (mime-add-condition
10745 'action '((type . message)(subtype . news)
10746 (major-mode . gnus-original-article-mode)
10747 (method . gnus-mime-extract-message/rfc822)
10751 (defun gnus-mime-extract-multipart (entity situation)
10752 (let ((children (mime-entity-children entity))
10753 mime-acting-situation-to-override
10756 (mime-play-entity (car children)
10757 (cons (assq 'mode situation)
10758 mime-acting-situation-to-override))
10759 (setq children (cdr children)))
10760 (if (setq f (cdr (assq 'after-method
10761 mime-acting-situation-to-override)))
10765 (mime-add-condition
10766 'action '((type . multipart)
10767 (method . gnus-mime-extract-multipart)
10776 (defun gnus-summary-setup-default-charset ()
10777 "Setup newsgroup default charset."
10778 (if (equal gnus-newsgroup-name "nndraft:drafts")
10779 (setq gnus-newsgroup-charset nil)
10780 (let* ((ignored-charsets
10781 (or gnus-newsgroup-ephemeral-ignored-charsets
10783 (and gnus-newsgroup-name
10784 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
10785 gnus-newsgroup-ignored-charsets))))
10786 (setq gnus-newsgroup-charset
10787 (or gnus-newsgroup-ephemeral-charset
10788 (and gnus-newsgroup-name
10789 (gnus-parameter-charset gnus-newsgroup-name))
10790 gnus-default-charset))
10791 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
10792 ignored-charsets))))
10798 (defun gnus-summary-display-buttonized (&optional show-all-parts)
10799 "Display the current article buffer fully MIME-buttonized.
10800 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
10801 treated as multipart/mixed."
10803 (require 'gnus-art)
10804 (let ((gnus-unbuttonized-mime-types nil)
10805 (gnus-mime-display-multipart-as-mixed show-all-parts))
10806 (gnus-summary-show-article)))
10808 (defun gnus-summary-repair-multipart (article)
10809 "Add a Content-Type header to a multipart article without one."
10810 (interactive (list (gnus-summary-article-number)))
10811 (gnus-with-article article
10812 (message-narrow-to-head)
10813 (message-remove-header "Mime-Version")
10814 (goto-char (point-max))
10815 (insert "Mime-Version: 1.0\n")
10817 (when (search-forward "\n--" nil t)
10818 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
10819 (message-narrow-to-head)
10820 (message-remove-header "Content-Type")
10821 (goto-char (point-max))
10822 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
10825 (let (gnus-mark-article-hook)
10826 (gnus-summary-select-article t t nil article)))
10828 (defun gnus-summary-toggle-display-buttonized ()
10829 "Toggle the buttonizing of the article buffer."
10831 (require 'gnus-art)
10832 (if (setq gnus-inhibit-mime-unbuttonizing
10833 (not gnus-inhibit-mime-unbuttonizing))
10834 (let ((gnus-unbuttonized-mime-types nil))
10835 (gnus-summary-show-article))
10836 (gnus-summary-show-article)))
10839 ;;; Intelli-mouse commmands
10842 (defun gnus-wheel-summary-scroll (event)
10844 (let ((amount (if (memq 'shift (event-modifiers event))
10845 (car gnus-wheel-scroll-amount)
10846 (cdr gnus-wheel-scroll-amount)))
10847 (direction (- (* (static-if (featurep 'xemacs)
10848 (event-button event)
10849 (cond ((eq 'mouse-4 (event-basic-type event))
10851 ((eq 'mouse-5 (event-basic-type event))
10855 (gnus-summary-scroll-up (* amount direction))
10856 (when (gnus-eval-in-buffer-window gnus-article-buffer
10859 (and (if (< 0 direction)
10860 (gnus-article-next-page 0)
10861 (gnus-article-prev-page 0)
10863 (if (setq edge (get-text-property
10864 (point-min) 'gnus-wheel-edge))
10865 (setq edge (* edge direction))
10868 (let ((buffer-read-only nil)
10869 (inhibit-read-only t))
10870 (put-text-property (point-min) (point-max)
10871 'gnus-wheel-edge direction)
10873 (or (> edge gnus-wheel-edge-resistance)
10874 (let ((buffer-read-only nil)
10875 (inhibit-read-only t))
10876 (put-text-property (point-min) (point-max)
10878 (* (1+ edge) direction))
10880 (eq last-command 'gnus-wheel-summary-scroll))))
10881 (gnus-summary-next-article nil nil (minusp direction)))))
10883 (defun gnus-wheel-install ()
10884 "Enable mouse wheel support on summary window."
10885 (when gnus-use-wheel
10887 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
10889 (define-key gnus-summary-mode-map key
10890 'gnus-wheel-summary-scroll)))))
10892 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
10895 ;;; Traditional PGP commmands
10898 (defun gnus-summary-decrypt-article (&optional force)
10899 "Decrypt the current article in traditional PGP way.
10900 This will have permanent effect only in mail groups.
10901 If FORCE is non-nil, allow editing of articles even in read-only
10904 (gnus-summary-select-article t)
10905 (gnus-eval-in-buffer-window gnus-article-buffer
10909 (goto-char (point-min))
10910 (unless (re-search-forward (car pgg-armor-header-lines) nil t)
10911 (error "Not a traditional PGP message!"))
10912 (let ((armor-start (match-beginning 0)))
10913 (if (and (pgg-decrypt-region armor-start (point-max))
10914 (or force (not (gnus-group-read-only-p))))
10915 (let ((inhibit-read-only t)
10917 (delete-region armor-start
10919 (re-search-forward "^-+END PGP" nil t)
10920 (beginning-of-line 2)
10922 (insert-buffer-substring pgg-output-buffer))))))))
10924 (defun gnus-summary-verify-article ()
10925 "Verify the current article in traditional PGP way."
10928 (set-buffer gnus-original-article-buffer)
10929 (goto-char (point-min))
10930 (unless (re-search-forward "^-+BEGIN PGP SIGNED MESSAGE" nil t)
10931 (error "Not a traditional PGP message!"))
10932 (re-search-forward "^-+END PGP" nil t)
10933 (beginning-of-line 2)
10934 (call-interactively (function pgg-verify-region))))
10937 ;;; Generic summary marking commands
10940 (defvar gnus-summary-marking-alist
10941 '((read gnus-del-mark "d")
10942 (unread gnus-unread-mark "u")
10943 (ticked gnus-ticked-mark "!")
10944 (dormant gnus-dormant-mark "?")
10945 (expirable gnus-expirable-mark "e"))
10946 "An alist of names/marks/keystrokes.")
10948 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
10949 (defvar gnus-summary-mark-map)
10951 (defun gnus-summary-make-all-marking-commands ()
10952 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
10953 (dolist (elem gnus-summary-marking-alist)
10954 (apply 'gnus-summary-make-marking-command elem)))
10956 (defun gnus-summary-make-marking-command (name mark keystroke)
10957 (let ((map (make-sparse-keymap)))
10958 (define-key gnus-summary-generic-mark-map keystroke map)
10959 (dolist (lway `((next "next" next nil "n")
10960 (next-unread "next unread" next t "N")
10961 (prev "previous" prev nil "p")
10962 (prev-unread "previous unread" prev t "P")
10963 (nomove "" nil nil ,keystroke)))
10964 (let ((func (gnus-summary-make-marking-command-1
10965 mark (car lway) lway name)))
10966 (setq func (eval func))
10967 (define-key map (nth 4 lway) func)))))
10969 (defun gnus-summary-make-marking-command-1 (mark way lway name)
10971 (format "gnus-summary-put-mark-as-%s%s"
10972 name (if (eq way 'nomove)
10974 (concat "-" (symbol-name way)))))
10977 "Mark the current article as %s%s.
10978 If N, the prefix, then repeat N times.
10979 If N is negative, move in reverse order.
10980 The difference between N and the actual number of articles marked is
10982 name (car (cdr lway)))
10984 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
10986 (defun gnus-summary-generic-mark (n mark move unread)
10987 "Mark N articles with MARK."
10988 (unless (eq major-mode 'gnus-summary-mode)
10989 (error "This command can only be used in the summary buffer"))
10990 (gnus-summary-show-thread)
10993 ((eq move 'next) 1)
10994 ((eq move 'prev) -1)
10996 (if (zerop nummove)
11000 nummove (* -1 nummove))))
11001 (while (and (> n 0)
11002 (gnus-summary-mark-article nil mark)
11003 (zerop (gnus-summary-next-subject nummove unread t)))
11006 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11007 (gnus-summary-recenter)
11008 (gnus-summary-position-point)
11009 (gnus-set-mode-line 'summary)
11012 (defun gnus-summary-insert-articles (articles)
11013 (when (setq articles
11014 (gnus-set-difference articles
11015 (mapcar (lambda (h) (mail-header-number h))
11016 gnus-newsgroup-headers)))
11017 (setq gnus-newsgroup-headers
11019 gnus-newsgroup-headers
11020 (gnus-fetch-headers articles)
11021 'gnus-article-sort-by-number))
11022 ;; Suppress duplicates?
11023 (when gnus-suppress-duplicates
11024 (gnus-dup-suppress-articles))
11026 ;; We might want to build some more threads first.
11027 (when (and gnus-fetch-old-headers
11028 (eq gnus-headers-retrieved-by 'nov))
11029 (if (eq gnus-fetch-old-headers 'invisible)
11030 (gnus-build-all-threads)
11031 (gnus-build-old-threads)))
11032 ;; Let the Gnus agent mark articles as read.
11034 (gnus-agent-get-undownloaded-list))
11035 ;; Remove list identifiers from subject
11036 (when gnus-list-identifiers
11037 (gnus-summary-remove-list-identifiers))
11038 ;; First and last article in this newsgroup.
11039 (when gnus-newsgroup-headers
11040 (setq gnus-newsgroup-begin
11041 (mail-header-number (car gnus-newsgroup-headers))
11043 (mail-header-number
11044 (gnus-last-element gnus-newsgroup-headers))))
11045 (when gnus-use-scoring
11046 (gnus-possibly-score-headers))))
11048 (defun gnus-summary-insert-old-articles (&optional all)
11049 "Insert all old articles in this group.
11050 If ALL is non-nil, already read articles become readable.
11051 If ALL is a number, fetch this number of articles."
11054 (let ((old (mapcar 'car gnus-newsgroup-data))
11055 (i (car gnus-newsgroup-active))
11057 (while (<= i (cdr gnus-newsgroup-active))
11058 (or (memq i old) (push i older))
11060 (setq len (length older))
11065 (setq older (subseq older 0 all))))
11068 (if (and (numberp gnus-large-newsgroup)
11069 (> len gnus-large-newsgroup))
11073 "How many articles from %s (default %d): "
11075 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11077 (unless (string-match "^[ \t]*$" input)
11078 (setq all (string-to-number input))
11080 (setq older (subseq older 0 all))))))))
11082 (message "No old news.")
11083 (gnus-summary-insert-articles older)
11084 (gnus-summary-limit (gnus-union older old))))
11085 (gnus-summary-position-point)))
11087 (defun gnus-summary-insert-new-articles ()
11088 "Insert all new articles in this group."
11091 (let ((old (mapcar 'car gnus-newsgroup-data))
11092 (old-active gnus-newsgroup-active)
11093 (nnmail-fetched-sources (list t))
11095 (setq gnus-newsgroup-active
11096 (gnus-activate-group gnus-newsgroup-name 'scan))
11097 (setq i (1+ (cdr old-active)))
11098 (while (<= i (cdr gnus-newsgroup-active))
11102 (message "No gnus is bad news.")
11103 (setq new (nreverse new))
11104 (gnus-summary-insert-articles new)
11105 (setq gnus-newsgroup-unreads
11106 (append gnus-newsgroup-unreads new))
11107 (gnus-summary-limit (gnus-union old new))))
11108 (gnus-summary-position-point)))
11110 (gnus-summary-make-all-marking-commands)
11112 (gnus-ems-redefine)
11114 (provide 'gnus-sum)
11116 (run-hooks 'gnus-sum-load-hook)
11118 ;;; gnus-sum.el ends here