1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
41 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
42 (autoload 'gnus-cache-write-active "gnus-cache")
43 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
44 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
45 (autoload 'mm-uu-dissect "mm-uu")
46 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
47 "Deuglify broken Outlook (Express) articles and redisplay."
50 (defcustom gnus-kill-summary-on-exit t
51 "*If non-nil, kill the summary buffer when you exit from it.
52 If nil, the summary will become a \"*Dead Summary*\" buffer, and
53 it will be killed sometime later."
54 :group 'gnus-summary-exit
57 (defcustom gnus-fetch-old-headers nil
58 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
59 If an unread article in the group refers to an older, already read (or
60 just marked as read) article, the old article will not normally be
61 displayed in the Summary buffer. If this variable is non-nil, Gnus
62 will attempt to grab the headers to the old articles, and thereby
63 build complete threads. If it has the value `some', only enough
64 headers to connect otherwise loose threads will be displayed. This
65 variable can also be a number. In that case, no more than that number
66 of old headers will be fetched. If it has the value `invisible', all
67 old headers will be fetched, but none will be displayed.
69 The server has to support NOV for any of this to work."
71 :type '(choice (const :tag "off" nil)
74 (sexp :menu-tag "other" t)))
76 (defcustom gnus-refer-thread-limit 200
77 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
78 If t, fetch all the available old headers."
81 (sexp :menu-tag "other" t)))
83 (defcustom gnus-summary-make-false-root 'adopt
84 "*nil means that Gnus won't gather loose threads.
85 If the root of a thread has expired or been read in a previous
86 session, the information necessary to build a complete thread has been
87 lost. Instead of having many small sub-threads from this original thread
88 scattered all over the summary buffer, Gnus can gather them.
90 If non-nil, Gnus will try to gather all loose sub-threads from an
91 original thread into one large thread.
93 If this variable is non-nil, it should be one of `none', `adopt',
96 If this variable is `none', Gnus will not make a false root, but just
97 present the sub-threads after another.
98 If this variable is `dummy', Gnus will create a dummy root that will
99 have all the sub-threads as children.
100 If this variable is `adopt', Gnus will make one of the \"children\"
101 the parent and mark all the step-children as such.
102 If this variable is `empty', the \"children\" are printed with empty
103 subject fields. (Or rather, they will be printed with a string
104 given by the `gnus-summary-same-subject' variable.)"
106 :type '(choice (const :tag "off" nil)
112 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
113 "*A regexp to match subjects to be excluded from loose thread gathering.
114 As loose thread gathering is done on subjects only, that means that
115 there can be many false gatherings performed. By rooting out certain
116 common subjects, gathering might become saner."
120 (defcustom gnus-summary-gather-subject-limit nil
121 "*Maximum length of subject comparisons when gathering loose threads.
122 Use nil to compare full subjects. Setting this variable to a low
123 number will help gather threads that have been corrupted by
124 newsreaders chopping off subject lines, but it might also mean that
125 unrelated articles that have subject that happen to begin with the
126 same few characters will be incorrectly gathered.
128 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
131 :type '(choice (const :tag "off" nil)
133 (sexp :menu-tag "on" t)))
135 (defcustom gnus-simplify-subject-functions nil
136 "List of functions taking a string argument that simplify subjects.
137 The functions are applied recursively.
139 Useful functions to put in this list include: `gnus-simplify-subject-re',
140 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
142 :type '(repeat function))
144 (defcustom gnus-simplify-ignored-prefixes nil
145 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
147 :type '(choice (const :tag "off" nil)
150 (defcustom gnus-build-sparse-threads nil
151 "*If non-nil, fill in the gaps in threads.
152 If `some', only fill in the gaps that are needed to tie loose threads
153 together. If `more', fill in all leaf nodes that Gnus can find. If
154 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
156 :type '(choice (const :tag "off" nil)
159 (sexp :menu-tag "all" t)))
161 (defcustom gnus-summary-thread-gathering-function
162 'gnus-gather-threads-by-subject
163 "*Function used for gathering loose threads.
164 There are two pre-defined functions: `gnus-gather-threads-by-subject',
165 which only takes Subjects into consideration; and
166 `gnus-gather-threads-by-references', which compared the References
167 headers of the articles to find matches."
169 :type '(radio (function-item gnus-gather-threads-by-subject)
170 (function-item gnus-gather-threads-by-references)
171 (function :tag "other")))
173 (defcustom gnus-summary-same-subject ""
174 "*String indicating that the current article has the same subject as the previous.
175 This variable will only be used if the value of
176 `gnus-summary-make-false-root' is `empty'."
177 :group 'gnus-summary-format
180 (defcustom gnus-summary-goto-unread t
181 "*If t, many commands will go to the next unread article.
182 This applies to marking commands as well as other commands that
183 \"naturally\" select the next article, like, for instance, `SPC' at
184 the end of an article.
186 If nil, the marking commands do NOT go to the next unread article
187 (they go to the next article instead). If `never', commands that
188 usually go to the next unread article, will go to the next article,
189 whether it is read or not."
190 :group 'gnus-summary-marks
191 :link '(custom-manual "(gnus)Setting Marks")
192 :type '(choice (const :tag "off" nil)
194 (sexp :menu-tag "on" t)))
196 (defcustom gnus-summary-default-score 0
197 "*Default article score level.
198 All scores generated by the score files will be added to this score.
199 If this variable is nil, scoring will be disabled."
200 :group 'gnus-score-default
201 :type '(choice (const :tag "disable")
204 (defcustom gnus-summary-default-high-score 0
205 "*Default threshold for a high scored article.
206 An article will be highlighted as high scored if its score is greater
208 :group 'gnus-score-default
211 (defcustom gnus-summary-default-low-score 0
212 "*Default threshold for a low scored article.
213 An article will be highlighted as low scored if its score is smaller
215 :group 'gnus-score-default
218 (defcustom gnus-summary-zcore-fuzz 0
219 "*Fuzziness factor for the zcore in the summary buffer.
220 Articles with scores closer than this to `gnus-summary-default-score'
222 :group 'gnus-summary-format
225 (defcustom gnus-simplify-subject-fuzzy-regexp nil
226 "*Strings to be removed when doing fuzzy matches.
227 This can either be a regular expression or list of regular expressions
228 that will be removed from subject strings if fuzzy subject
229 simplification is selected."
231 :type '(repeat regexp))
233 (defcustom gnus-show-threads t
234 "*If non-nil, display threads in summary mode."
238 (defcustom gnus-thread-hide-subtree nil
239 "*If non-nil, hide all threads initially.
240 This can be a predicate specifier which says which threads to hide.
241 If threads are hidden, you have to run the command
242 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
243 to expose hidden threads."
247 (defcustom gnus-thread-hide-killed t
248 "*If non-nil, hide killed threads automatically."
252 (defcustom gnus-thread-ignore-subject t
253 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
254 If nil, articles that have different subjects from their parents will
255 start separate threads."
259 (defcustom gnus-thread-operation-ignore-subject t
260 "*If non-nil, subjects will be ignored when doing thread commands.
261 This affects commands like `gnus-summary-kill-thread' and
262 `gnus-summary-lower-thread'.
264 If this variable is nil, articles in the same thread with different
265 subjects will not be included in the operation in question. If this
266 variable is `fuzzy', only articles that have subjects that are fuzzily
267 equal will be included."
269 :type '(choice (const :tag "off" nil)
273 (defcustom gnus-thread-indent-level 4
274 "*Number that says how much each sub-thread should be indented."
278 (defcustom gnus-auto-extend-newsgroup t
279 "*If non-nil, extend newsgroup forward and backward when requested."
280 :group 'gnus-summary-choose
283 (defcustom gnus-auto-select-first t
284 "*If non-nil, select the article under point.
285 Which article this is is controlled by the `gnus-auto-select-subject'
288 If you want to prevent automatic selection of articles in some
289 newsgroups, set the variable to nil in `gnus-select-group-hook'."
290 :group 'gnus-group-select
291 :type '(choice (const :tag "none" nil)
292 (sexp :menu-tag "first" t)))
294 (defcustom gnus-auto-select-subject 'unread
295 "*Says what subject to place under point when entering a group.
297 This variable can either be the symbols `first' (place point on the
298 first subject), `unread' (place point on the subject line of the first
299 unread article), `best' (place point on the subject line of the
300 higest-scored article), `unseen' (place point on the subject line of
301 the first unseen article), 'unseen-or-unread' (place point on the subject
302 line of the first unseen article or, if all article have been seen, on the
303 subject line of the first unread article), or a function to be called to
304 place point on some subject line."
305 :group 'gnus-group-select
306 :type '(choice (const best)
310 (const unseen-or-unread)))
312 (defcustom gnus-auto-select-next t
313 "*If non-nil, offer to go to the next group from the end of the previous.
314 If the value is t and the next newsgroup is empty, Gnus will exit
315 summary mode and go back to group mode. If the value is neither nil
316 nor t, Gnus will select the following unread newsgroup. In
317 particular, if the value is the symbol `quietly', the next unread
318 newsgroup will be selected without any confirmation, and if it is
319 `almost-quietly', the next group will be selected without any
320 confirmation if you are located on the last article in the group.
321 Finally, if this variable is `slightly-quietly', the `Z n' command
322 will go to the next group without confirmation."
323 :group 'gnus-summary-maneuvering
324 :type '(choice (const :tag "off" nil)
326 (const almost-quietly)
327 (const slightly-quietly)
328 (sexp :menu-tag "on" t)))
330 (defcustom gnus-auto-select-same nil
331 "*If non-nil, select the next article with the same subject.
332 If there are no more articles with the same subject, go to
333 the first unread article."
334 :group 'gnus-summary-maneuvering
337 (defcustom gnus-summary-check-current nil
338 "*If non-nil, consider the current article when moving.
339 The \"unread\" movement commands will stay on the same line if the
340 current article is unread."
341 :group 'gnus-summary-maneuvering
344 (defcustom gnus-auto-center-summary t
345 "*If non-nil, always center the current summary buffer.
346 In particular, if `vertical' do only vertical recentering. If non-nil
347 and non-`vertical', do both horizontal and vertical recentering."
348 :group 'gnus-summary-maneuvering
349 :type '(choice (const :tag "none" nil)
351 (integer :tag "height")
352 (sexp :menu-tag "both" t)))
354 (defcustom gnus-show-all-headers nil
355 "*If non-nil, don't hide any headers."
356 :group 'gnus-article-hiding
357 :group 'gnus-article-headers
360 (defcustom gnus-summary-ignore-duplicates nil
361 "*If non-nil, ignore articles with identical Message-ID headers."
365 (defcustom gnus-single-article-buffer t
366 "*If non-nil, display all articles in the same buffer.
367 If nil, each group will get its own article buffer."
368 :group 'gnus-article-various
371 (defcustom gnus-break-pages t
372 "*If non-nil, do page breaking on articles.
373 The page delimiter is specified by the `gnus-page-delimiter'
375 :group 'gnus-article-various
378 (defcustom gnus-move-split-methods nil
379 "*Variable used to suggest where articles are to be moved to.
380 It uses the same syntax as the `gnus-split-methods' variable.
381 However, whereas `gnus-split-methods' specifies file names as targets,
382 this variable specifies group names."
383 :group 'gnus-summary-mail
384 :type '(repeat (choice (list :value (fun) function)
385 (cons :value ("" "") regexp (repeat string))
388 (defcustom gnus-unread-mark ? ;Whitespace
389 "*Mark used for unread articles."
390 :group 'gnus-summary-marks
393 (defcustom gnus-ticked-mark ?!
394 "*Mark used for ticked articles."
395 :group 'gnus-summary-marks
398 (defcustom gnus-dormant-mark ??
399 "*Mark used for dormant articles."
400 :group 'gnus-summary-marks
403 (defcustom gnus-del-mark ?r
404 "*Mark used for del'd articles."
405 :group 'gnus-summary-marks
408 (defcustom gnus-read-mark ?R
409 "*Mark used for read articles."
410 :group 'gnus-summary-marks
413 (defcustom gnus-expirable-mark ?E
414 "*Mark used for expirable articles."
415 :group 'gnus-summary-marks
418 (defcustom gnus-killed-mark ?K
419 "*Mark used for killed articles."
420 :group 'gnus-summary-marks
423 (defcustom gnus-spam-mark ?H
424 "*Mark used for spam articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-souped-mark ?F
429 "*Mark used for souped articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-kill-file-mark ?X
434 "*Mark used for articles killed by kill files."
435 :group 'gnus-summary-marks
438 (defcustom gnus-low-score-mark ?Y
439 "*Mark used for articles with a low score."
440 :group 'gnus-summary-marks
443 (defcustom gnus-catchup-mark ?C
444 "*Mark used for articles that are caught up."
445 :group 'gnus-summary-marks
448 (defcustom gnus-replied-mark ?A
449 "*Mark used for articles that have been replied to."
450 :group 'gnus-summary-marks
453 (defcustom gnus-forwarded-mark ?F
454 "*Mark used for articles that have been forwarded."
455 :group 'gnus-summary-marks
458 (defcustom gnus-recent-mark ?N
459 "*Mark used for articles that are recent."
460 :group 'gnus-summary-marks
463 (defcustom gnus-cached-mark ?*
464 "*Mark used for articles that are in the cache."
465 :group 'gnus-summary-marks
468 (defcustom gnus-saved-mark ?S
469 "*Mark used for articles that have been saved."
470 :group 'gnus-summary-marks
473 (defcustom gnus-unseen-mark ?.
474 "*Mark used for articles that haven't been seen."
475 :group 'gnus-summary-marks
478 (defcustom gnus-no-mark ? ;Whitespace
479 "*Mark used for articles that have no other secondary mark."
480 :group 'gnus-summary-marks
483 (defcustom gnus-ancient-mark ?O
484 "*Mark used for ancient articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-sparse-mark ?Q
489 "*Mark used for sparsely reffed articles."
490 :group 'gnus-summary-marks
493 (defcustom gnus-canceled-mark ?G
494 "*Mark used for canceled articles."
495 :group 'gnus-summary-marks
498 (defcustom gnus-duplicate-mark ?M
499 "*Mark used for duplicate articles."
500 :group 'gnus-summary-marks
503 (defcustom gnus-undownloaded-mark ?@
504 "*Mark used for articles that weren't downloaded."
505 :group 'gnus-summary-marks
508 (defcustom gnus-downloadable-mark ?%
509 "*Mark used for articles that are to be downloaded."
510 :group 'gnus-summary-marks
513 (defcustom gnus-unsendable-mark ?=
514 "*Mark used for articles that won't be sent."
515 :group 'gnus-summary-marks
518 (defcustom gnus-score-over-mark ?+
519 "*Score mark used for articles with high scores."
520 :group 'gnus-summary-marks
523 (defcustom gnus-score-below-mark ?-
524 "*Score mark used for articles with low scores."
525 :group 'gnus-summary-marks
528 (defcustom gnus-empty-thread-mark ? ;Whitespace
529 "*There is no thread under the article."
530 :group 'gnus-summary-marks
533 (defcustom gnus-not-empty-thread-mark ?=
534 "*There is a thread under the article."
535 :group 'gnus-summary-marks
538 (defcustom gnus-view-pseudo-asynchronously nil
539 "*If non-nil, Gnus will view pseudo-articles asynchronously."
540 :group 'gnus-extract-view
543 (defcustom gnus-auto-expirable-marks
544 (list gnus-spam-mark gnus-killed-mark gnus-del-mark gnus-catchup-mark
545 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
546 gnus-souped-mark gnus-duplicate-mark)
547 "*The list of marks converted into expiration if a group is auto-expirable."
550 :type '(repeat character))
552 (defcustom gnus-inhibit-user-auto-expire t
553 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
558 (defcustom gnus-view-pseudos nil
559 "*If `automatic', pseudo-articles will be viewed automatically.
560 If `not-confirm', pseudos will be viewed automatically, and the user
561 will not be asked to confirm the command."
562 :group 'gnus-extract-view
563 :type '(choice (const :tag "off" nil)
565 (const not-confirm)))
567 (defcustom gnus-view-pseudos-separately t
568 "*If non-nil, one pseudo-article will be created for each file to be viewed.
569 If nil, all files that use the same viewing command will be given as a
570 list of parameters to that command."
571 :group 'gnus-extract-view
574 (defcustom gnus-insert-pseudo-articles t
575 "*If non-nil, insert pseudo-articles when decoding articles."
576 :group 'gnus-extract-view
579 (defcustom gnus-summary-dummy-line-format
581 "*The format specification for the dummy roots in the summary buffer.
582 It works along the same lines as a normal formatting string,
583 with some simple extensions.
587 General format specifiers can also be used.
588 See `(gnus)Formatting Variables'."
589 :link '(custom-manual "(gnus)Formatting Variables")
590 :group 'gnus-threading
593 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
594 "*The format specification for the summary mode line.
595 It works along the same lines as a normal formatting string,
596 with some simple extensions:
599 %p Unprefixed group name
600 %A Current article number
601 %z Current article score
603 %U Number of unread articles in the group
604 %e Number of unselected articles in the group
605 %Z A string with unread/unselected article counts
606 %g Shortish group name
607 %S Subject of the current article
609 %s Current score file name
610 %d Number of dormant articles
611 %r Number of articles that have been marked as read in this session
612 %E Number of articles expunged by the score files"
613 :group 'gnus-summary-format
616 (defcustom gnus-list-identifiers nil
617 "Regexp that matches list identifiers to be removed from subject.
618 This can also be a list of regexps."
620 :group 'gnus-summary-format
621 :group 'gnus-article-hiding
622 :type '(choice (const :tag "none" nil)
624 (repeat :value (".*") regexp)))
626 (defcustom gnus-summary-mark-below 0
627 "*Mark all articles with a score below this variable as read.
628 This variable is local to each summary buffer and usually set by the
630 :group 'gnus-score-default
633 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
634 "*List of functions used for sorting articles in the summary buffer.
636 Each function takes two articles and returns non-nil if the first
637 article should be sorted before the other. If you use more than one
638 function, the primary sort function should be the last. You should
639 probably always include `gnus-article-sort-by-number' in the list of
640 sorting functions -- preferably first. Also note that sorting by date
641 is often much slower than sorting by number, and the sorting order is
642 very similar. (Sorting by date means sorting by the time the message
643 was sent, sorting by number means sorting by arrival time.)
645 Ready-made functions include `gnus-article-sort-by-number',
646 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
647 `gnus-article-sort-by-date' and `gnus-article-sort-by-score'.
649 When threading is turned on, the variable `gnus-thread-sort-functions'
650 controls how articles are sorted."
651 :group 'gnus-summary-sort
652 :type '(repeat (choice (function-item gnus-article-sort-by-number)
653 (function-item gnus-article-sort-by-author)
654 (function-item gnus-article-sort-by-subject)
655 (function-item gnus-article-sort-by-date)
656 (function-item gnus-article-sort-by-score)
657 (function :tag "other"))))
659 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
660 "*List of functions used for sorting threads in the summary buffer.
661 By default, threads are sorted by article number.
663 Each function takes two threads and returns non-nil if the first
664 thread should be sorted before the other. If you use more than one
665 function, the primary sort function should be the last. You should
666 probably always include `gnus-thread-sort-by-number' in the list of
667 sorting functions -- preferably first. Also note that sorting by date
668 is often much slower than sorting by number, and the sorting order is
669 very similar. (Sorting by date means sorting by the time the message
670 was sent, sorting by number means sorting by arrival time.)
672 Ready-made functions include `gnus-thread-sort-by-number',
673 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
674 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
675 `gnus-thread-sort-by-most-recent-number',
676 `gnus-thread-sort-by-most-recent-date', and
677 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
679 When threading is turned off, the variable
680 `gnus-article-sort-functions' controls how articles are sorted."
681 :group 'gnus-summary-sort
682 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
683 (function-item gnus-thread-sort-by-author)
684 (function-item gnus-thread-sort-by-subject)
685 (function-item gnus-thread-sort-by-date)
686 (function-item gnus-thread-sort-by-score)
687 (function-item gnus-thread-sort-by-total-score)
688 (function :tag "other"))))
690 (defcustom gnus-thread-score-function '+
691 "*Function used for calculating the total score of a thread.
693 The function is called with the scores of the article and each
694 subthread and should then return the score of the thread.
696 Some functions you can use are `+', `max', or `min'."
697 :group 'gnus-summary-sort
700 (defcustom gnus-summary-expunge-below nil
701 "All articles that have a score less than this variable will be expunged.
702 This variable is local to the summary buffers."
703 :group 'gnus-score-default
704 :type '(choice (const :tag "off" nil)
707 (defcustom gnus-thread-expunge-below nil
708 "All threads that have a total score less than this variable will be expunged.
709 See `gnus-thread-score-function' for en explanation of what a
712 This variable is local to the summary buffers."
713 :group 'gnus-threading
714 :group 'gnus-score-default
715 :type '(choice (const :tag "off" nil)
718 (defcustom gnus-summary-mode-hook nil
719 "*A hook for Gnus summary mode.
720 This hook is run before any variables are set in the summary buffer."
721 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
722 :group 'gnus-summary-various
725 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
726 (when (featurep 'xemacs)
727 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
728 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
729 (add-hook 'gnus-summary-mode-hook
730 'gnus-xmas-switch-horizontal-scrollbar-off))
732 (defcustom gnus-summary-menu-hook nil
733 "*Hook run after the creation of the summary mode menu."
734 :group 'gnus-summary-visual
737 (defcustom gnus-summary-exit-hook nil
738 "*A hook called on exit from the summary buffer.
739 It will be called with point in the group buffer."
740 :group 'gnus-summary-exit
743 (defcustom gnus-summary-prepare-hook nil
744 "*A hook called after the summary buffer has been generated.
745 If you want to modify the summary buffer, you can use this hook."
746 :group 'gnus-summary-various
749 (defcustom gnus-summary-prepared-hook nil
750 "*A hook called as the last thing after the summary buffer has been generated."
751 :group 'gnus-summary-various
754 (defcustom gnus-summary-generate-hook nil
755 "*A hook run just before generating the summary buffer.
756 This hook is commonly used to customize threading variables and the
758 :group 'gnus-summary-various
761 (defcustom gnus-select-group-hook nil
762 "*A hook called when a newsgroup is selected.
764 If you'd like to simplify subjects like the
765 `gnus-summary-next-same-subject' command does, you can use the
768 (add-hook gnus-select-group-hook
770 (mapcar (lambda (header)
771 (mail-header-set-subject
773 (gnus-simplify-subject
774 (mail-header-subject header) 're-only)))
775 gnus-newsgroup-headers)))"
776 :group 'gnus-group-select
779 (defcustom gnus-select-article-hook nil
780 "*A hook called when an article is selected."
781 :group 'gnus-summary-choose
784 (defcustom gnus-visual-mark-article-hook
785 (list 'gnus-highlight-selected-summary)
786 "*Hook run after selecting an article in the summary buffer.
787 It is meant to be used for highlighting the article in some way. It
788 is not run if `gnus-visual' is nil."
789 :group 'gnus-summary-visual
792 (defcustom gnus-parse-headers-hook nil
793 "*A hook called before parsing the headers."
797 (defcustom gnus-exit-group-hook nil
798 "*A hook called when exiting summary mode.
799 This hook is not called from the non-updating exit commands like `Q'."
803 (defcustom gnus-summary-update-hook
804 (list 'gnus-summary-highlight-line)
805 "*A hook called when a summary line is changed.
806 The hook will not be called if `gnus-visual' is nil.
808 The default function `gnus-summary-highlight-line' will
809 highlight the line according to the `gnus-summary-highlight'
811 :group 'gnus-summary-visual
814 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
815 "*A hook called when an article is selected for the first time.
816 The hook is intended to mark an article as read (or unread)
817 automatically when it is selected."
818 :group 'gnus-summary-choose
821 (defcustom gnus-group-no-more-groups-hook nil
822 "*A hook run when returning to group mode having no more (unread) groups."
823 :group 'gnus-group-select
826 (defcustom gnus-ps-print-hook nil
827 "*A hook run before ps-printing something from Gnus."
831 (defcustom gnus-summary-display-arrow
832 (and (fboundp 'display-graphic-p)
834 "*If non-nil, display an arrow highlighting the current article."
839 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
840 "Face used for highlighting the current article in the summary buffer."
841 :group 'gnus-summary-visual
844 (defcustom gnus-summary-highlight
845 '(((eq mark gnus-canceled-mark)
846 . gnus-summary-cancelled-face)
847 ((and (> score default-high)
848 (or (eq mark gnus-dormant-mark)
849 (eq mark gnus-ticked-mark)))
850 . gnus-summary-high-ticked-face)
851 ((and (< score default-low)
852 (or (eq mark gnus-dormant-mark)
853 (eq mark gnus-ticked-mark)))
854 . gnus-summary-low-ticked-face)
855 ((or (eq mark gnus-dormant-mark)
856 (eq mark gnus-ticked-mark))
857 . gnus-summary-normal-ticked-face)
858 ((and (> score default-high) (eq mark gnus-ancient-mark))
859 . gnus-summary-high-ancient-face)
860 ((and (< score default-low) (eq mark gnus-ancient-mark))
861 . gnus-summary-low-ancient-face)
862 ((eq mark gnus-ancient-mark)
863 . gnus-summary-normal-ancient-face)
864 ((and (> score default-high) (eq mark gnus-unread-mark))
865 . gnus-summary-high-unread-face)
866 ((and (< score default-low) (eq mark gnus-unread-mark))
867 . gnus-summary-low-unread-face)
868 ((eq mark gnus-unread-mark)
869 . gnus-summary-normal-unread-face)
870 ((and (> score default-high) (memq mark (list gnus-downloadable-mark
871 gnus-undownloaded-mark)))
872 . gnus-summary-high-unread-face)
873 ((and (< score default-low) (memq mark (list gnus-downloadable-mark
874 gnus-undownloaded-mark)))
875 . gnus-summary-low-unread-face)
876 ((and (memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
877 (memq article gnus-newsgroup-unreads))
878 . gnus-summary-normal-unread-face)
879 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
880 . gnus-summary-normal-read-face)
881 ((> score default-high)
882 . gnus-summary-high-read-face)
883 ((< score default-low)
884 . gnus-summary-low-read-face)
886 . gnus-summary-normal-read-face))
887 "*Controls the highlighting of summary buffer lines.
889 A list of (FORM . FACE) pairs. When deciding how a a particular
890 summary line should be displayed, each form is evaluated. The content
891 of the face field after the first true form is used. You can change
892 how those summary lines are displayed, by editing the face field.
894 You can use the following variables in the FORM field.
896 score: The article's score
897 default: The default article score.
898 default-high: The default score for high scored articles.
899 default-low: The default score for low scored articles.
900 below: The score below which articles are automatically marked as read.
901 mark: The articles mark."
902 :group 'gnus-summary-visual
903 :type '(repeat (cons (sexp :tag "Form" nil)
906 (defcustom gnus-alter-header-function nil
907 "Function called to allow alteration of article header structures.
908 The function is called with one parameter, the article header vector,
909 which it may alter in any way.")
911 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
912 "Variable that says which function should be used to decode a string with encoded words.")
914 (defcustom gnus-extra-headers '(To Newsgroups)
915 "*Extra headers to parse."
918 :type '(repeat symbol))
920 (defcustom gnus-ignored-from-addresses
921 (and user-mail-address (regexp-quote user-mail-address))
922 "*Regexp of From headers that may be suppressed in favor of To headers."
927 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
928 "List of charsets that should be ignored.
929 When these charsets are used in the \"charset\" parameter, the
930 default charset will be used instead."
932 :type '(repeat symbol)
933 :group 'gnus-charset)
935 (gnus-define-group-parameter
939 "Return the ignored charsets of GROUP."
940 :variable gnus-group-ignored-charsets-alist
942 '(("alt\\.chinese\\.text" iso-8859-1))
944 "Alist of regexps (to match group names) and charsets that should be ignored.
945 When these charsets are used in the \"charset\" parameter, the
946 default charset will be used instead."
947 :variable-group gnus-charset
948 :variable-type '(repeat (cons (regexp :tag "Group")
950 :parameter-type '(choice :tag "Ignored charsets"
953 :parameter-document "\
954 List of charsets that should be ignored.
956 When these charsets are used in the \"charset\" parameter, the
957 default charset will be used instead.")
959 (defcustom gnus-group-highlight-words-alist nil
960 "Alist of group regexps and highlight regexps.
961 This variable uses the same syntax as `gnus-emphasis-alist'."
963 :type '(repeat (cons (regexp :tag "Group")
964 (repeat (list (regexp :tag "Highlight regexp")
965 (number :tag "Group for entire word" 0)
966 (number :tag "Group for displayed part" 0)
968 gnus-emphasis-highlight-words)))))
969 :group 'gnus-summary-visual)
971 (defcustom gnus-summary-show-article-charset-alist
973 "Alist of number and charset.
974 The article will be shown with the charset corresponding to the
976 For example: ((1 . cn-gb-2312) (2 . big5))."
978 :type '(repeat (cons (number :tag "Argument" 1)
979 (symbol :tag "Charset")))
980 :group 'gnus-charset)
982 (defcustom gnus-preserve-marks t
983 "Whether marks are preserved when moving, copying and respooling messages."
986 :group 'gnus-summary-marks)
988 (defcustom gnus-alter-articles-to-read-function nil
989 "Function to be called to alter the list of articles to be selected."
990 :type '(choice (const nil) function)
991 :group 'gnus-summary)
993 (defcustom gnus-orphan-score nil
994 "*All orphans get this score added. Set in the score file."
995 :group 'gnus-score-default
996 :type '(choice (const nil)
999 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1000 "*A regexp to match MIME parts when saving multiple parts of a message
1001 with gnus-summary-save-parts (X m). This regexp will be used by default
1002 when prompting the user for which type of files to save."
1003 :group 'gnus-summary
1006 (defcustom gnus-read-all-available-headers nil
1007 "Whether Gnus should parse all headers made available to it.
1008 This is mostly relevant for slow backends where the user may
1009 wish to widen the summary buffer to include all headers
1010 that were fetched. Say, for nnultimate groups."
1011 :group 'gnus-summary
1012 :type '(choice boolean regexp))
1014 (defcustom gnus-summary-muttprint-program "muttprint"
1015 "Command (and optional arguments) used to run Muttprint."
1017 :group 'gnus-summary
1020 (defcustom gnus-article-loose-mime nil
1021 "If non-nil, don't require MIME-Version header.
1022 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1023 supply the MIME-Version header or deliberately strip it From the mail.
1024 Set it to non-nil, Gnus will treat some articles as MIME even if
1025 the MIME-Version header is missed."
1028 :group 'gnus-article)
1030 ;;; Internal variables
1032 (defvar gnus-summary-display-cache nil)
1033 (defvar gnus-article-mime-handles nil)
1034 (defvar gnus-article-decoded-p nil)
1035 (defvar gnus-article-charset nil)
1036 (defvar gnus-article-ignored-charsets nil)
1037 (defvar gnus-scores-exclude-files nil)
1038 (defvar gnus-page-broken nil)
1039 (defvar gnus-inhibit-mime-unbuttonizing nil)
1041 (defvar gnus-original-article nil)
1042 (defvar gnus-article-internal-prepare-hook nil)
1043 (defvar gnus-newsgroup-process-stack nil)
1045 (defvar gnus-thread-indent-array nil)
1046 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1047 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1048 "Function called to sort the articles within a thread after it has been gathered together.")
1050 (defvar gnus-summary-save-parts-type-history nil)
1051 (defvar gnus-summary-save-parts-last-directory nil)
1053 ;; Avoid highlighting in kill files.
1054 (defvar gnus-summary-inhibit-highlight nil)
1055 (defvar gnus-newsgroup-selected-overlay nil)
1056 (defvar gnus-inhibit-limiting nil)
1057 (defvar gnus-newsgroup-adaptive-score-file nil)
1058 (defvar gnus-current-score-file nil)
1059 (defvar gnus-current-move-group nil)
1060 (defvar gnus-current-copy-group nil)
1061 (defvar gnus-current-crosspost-group nil)
1062 (defvar gnus-newsgroup-display nil)
1064 (defvar gnus-newsgroup-dependencies nil)
1065 (defvar gnus-newsgroup-adaptive nil)
1066 (defvar gnus-summary-display-article-function nil)
1067 (defvar gnus-summary-highlight-line-function nil
1068 "Function called after highlighting a summary line.")
1070 (defvar gnus-summary-line-format-alist
1071 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1072 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1073 (?s gnus-tmp-subject-or-nil ?s)
1074 (?n gnus-tmp-name ?s)
1075 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1077 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1079 (?F gnus-tmp-from ?s)
1080 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1081 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1082 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1083 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1084 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1085 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1086 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1087 (?L gnus-tmp-lines ?s)
1088 (?I gnus-tmp-indentation ?s)
1089 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1090 (?R gnus-tmp-replied ?c)
1091 (?\[ gnus-tmp-opening-bracket ?c)
1092 (?\] gnus-tmp-closing-bracket ?c)
1093 (?\> (make-string gnus-tmp-level ? ) ?s)
1094 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1095 (?i gnus-tmp-score ?d)
1096 (?z gnus-tmp-score-char ?c)
1097 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1098 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1099 (?U gnus-tmp-unread ?c)
1100 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1102 (?t (gnus-summary-number-of-articles-in-thread
1103 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1105 (?e (gnus-summary-number-of-articles-in-thread
1106 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1108 (?u gnus-tmp-user-defined ?s)
1109 (?P (gnus-pick-line-number) ?d)
1110 (?B gnus-tmp-thread-tree-header-string ?s)
1111 (user-date (gnus-user-date
1112 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1113 "An alist of format specifications that can appear in summary lines.
1114 These are paired with what variables they correspond with, along with
1115 the type of the variable (string, integer, character, etc).")
1117 (defvar gnus-summary-dummy-line-format-alist
1118 `((?S gnus-tmp-subject ?s)
1119 (?N gnus-tmp-number ?d)
1120 (?u gnus-tmp-user-defined ?s)))
1122 (defvar gnus-summary-mode-line-format-alist
1123 `((?G gnus-tmp-group-name ?s)
1124 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1125 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1126 (?A gnus-tmp-article-number ?d)
1127 (?Z gnus-tmp-unread-and-unselected ?s)
1128 (?V gnus-version ?s)
1129 (?U gnus-tmp-unread-and-unticked ?d)
1130 (?S gnus-tmp-subject ?s)
1131 (?e gnus-tmp-unselected ?d)
1132 (?u gnus-tmp-user-defined ?s)
1133 (?d (length gnus-newsgroup-dormant) ?d)
1134 (?t (length gnus-newsgroup-marked) ?d)
1135 (?r (length gnus-newsgroup-reads) ?d)
1136 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1137 (?E gnus-newsgroup-expunged-tally ?d)
1138 (?s (gnus-current-score-file-nondirectory) ?s)))
1140 (defvar gnus-last-search-regexp nil
1141 "Default regexp for article search command.")
1143 (defvar gnus-last-shell-command nil
1144 "Default shell command on article.")
1146 (defvar gnus-newsgroup-begin nil)
1147 (defvar gnus-newsgroup-end nil)
1148 (defvar gnus-newsgroup-last-rmail nil)
1149 (defvar gnus-newsgroup-last-mail nil)
1150 (defvar gnus-newsgroup-last-folder nil)
1151 (defvar gnus-newsgroup-last-file nil)
1152 (defvar gnus-newsgroup-auto-expire nil)
1153 (defvar gnus-newsgroup-active nil)
1155 (defvar gnus-newsgroup-data nil)
1156 (defvar gnus-newsgroup-data-reverse nil)
1157 (defvar gnus-newsgroup-limit nil)
1158 (defvar gnus-newsgroup-limits nil)
1160 (defvar gnus-newsgroup-unreads nil
1161 "Sorted list of unread articles in the current newsgroup.")
1163 (defvar gnus-newsgroup-unselected nil
1164 "Sorted list of unselected unread articles in the current newsgroup.")
1166 (defvar gnus-newsgroup-reads nil
1167 "Alist of read articles and article marks in the current newsgroup.")
1169 (defvar gnus-newsgroup-expunged-tally nil)
1171 (defvar gnus-newsgroup-marked nil
1172 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1174 (defvar gnus-newsgroup-killed nil
1175 "List of ranges of articles that have been through the scoring process.")
1177 (defvar gnus-newsgroup-cached nil
1178 "Sorted list of articles that come from the article cache.")
1180 (defvar gnus-newsgroup-saved nil
1181 "List of articles that have been saved.")
1183 (defvar gnus-newsgroup-kill-headers nil)
1185 (defvar gnus-newsgroup-replied nil
1186 "List of articles that have been replied to in the current newsgroup.")
1188 (defvar gnus-newsgroup-forwarded nil
1189 "List of articles that have been forwarded in the current newsgroup.")
1191 (defvar gnus-newsgroup-recent nil
1192 "List of articles that have are recent in the current newsgroup.")
1194 (defvar gnus-newsgroup-expirable nil
1195 "Sorted list of articles in the current newsgroup that can be expired.")
1197 (defvar gnus-newsgroup-processable nil
1198 "List of articles in the current newsgroup that can be processed.")
1200 (defvar gnus-newsgroup-downloadable nil
1201 "Sorted list of articles in the current newsgroup that can be processed.")
1203 (defvar gnus-newsgroup-undownloaded nil
1204 "List of articles in the current newsgroup that haven't been downloaded..")
1206 (defvar gnus-newsgroup-unsendable nil
1207 "List of articles in the current newsgroup that won't be sent.")
1209 (defvar gnus-newsgroup-bookmarks nil
1210 "List of articles in the current newsgroup that have bookmarks.")
1212 (defvar gnus-newsgroup-dormant nil
1213 "Sorted list of dormant articles in the current newsgroup.")
1215 (defvar gnus-newsgroup-unseen nil
1216 "List of unseen articles in the current newsgroup.")
1218 (defvar gnus-newsgroup-seen nil
1219 "Range of seen articles in the current newsgroup.")
1221 (defvar gnus-newsgroup-articles nil
1222 "List of articles in the current newsgroup.")
1224 (defvar gnus-newsgroup-scored nil
1225 "List of scored articles in the current newsgroup.")
1227 (defvar gnus-newsgroup-headers nil
1228 "List of article headers in the current newsgroup.")
1230 (defvar gnus-newsgroup-threads nil)
1232 (defvar gnus-newsgroup-prepared nil
1233 "Whether the current group has been prepared properly.")
1235 (defvar gnus-newsgroup-ancient nil
1236 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1238 (defvar gnus-newsgroup-sparse nil)
1240 (defvar gnus-current-article nil)
1241 (defvar gnus-article-current nil)
1242 (defvar gnus-current-headers nil)
1243 (defvar gnus-have-all-headers nil)
1244 (defvar gnus-last-article nil)
1245 (defvar gnus-newsgroup-history nil)
1246 (defvar gnus-newsgroup-charset nil)
1247 (defvar gnus-newsgroup-ephemeral-charset nil)
1248 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1250 (defvar gnus-article-before-search nil)
1252 (defconst gnus-summary-local-variables
1253 '(gnus-newsgroup-name
1254 gnus-newsgroup-begin gnus-newsgroup-end
1255 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1256 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1257 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1258 gnus-newsgroup-unselected gnus-newsgroup-marked
1259 gnus-newsgroup-reads gnus-newsgroup-saved
1260 gnus-newsgroup-replied gnus-newsgroup-forwarded
1261 gnus-newsgroup-recent
1262 gnus-newsgroup-expirable
1263 gnus-newsgroup-processable gnus-newsgroup-killed
1264 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1265 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1266 gnus-newsgroup-seen gnus-newsgroup-articles
1267 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1268 gnus-newsgroup-headers gnus-newsgroup-threads
1269 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1270 gnus-current-article gnus-current-headers gnus-have-all-headers
1271 gnus-last-article gnus-article-internal-prepare-hook
1272 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1273 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1274 gnus-thread-expunge-below
1275 gnus-score-alist gnus-current-score-file
1276 (gnus-summary-expunge-below . global)
1277 (gnus-summary-mark-below . global)
1278 (gnus-orphan-score . global)
1279 gnus-newsgroup-active gnus-scores-exclude-files
1280 gnus-newsgroup-history gnus-newsgroup-ancient
1281 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1282 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1283 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1284 (gnus-newsgroup-expunged-tally . 0)
1285 gnus-cache-removable-articles gnus-newsgroup-cached
1286 gnus-newsgroup-data gnus-newsgroup-data-reverse
1287 gnus-newsgroup-limit gnus-newsgroup-limits
1288 gnus-newsgroup-charset gnus-newsgroup-display)
1289 "Variables that are buffer-local to the summary buffers.")
1291 (defvar gnus-newsgroup-variables nil
1292 "A list of variables that have separate values in different newsgroups.
1293 A list of newsgroup (summary buffer) local variables, or cons of
1294 variables and their default values (when the default values are not
1295 nil), that should be made global while the summary buffer is active.
1296 These variables can be used to set variables in the group parameters
1297 while still allowing them to affect operations done in other
1298 buffers. For example:
1300 \(setq gnus-newsgroup-variables
1301 '(message-use-followup-to
1302 (gnus-visible-headers .
1303 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1306 ;; Byte-compiler warning.
1307 (eval-when-compile (defvar gnus-article-mode-map))
1311 (defvar gnus-decode-encoded-word-methods
1312 '(mail-decode-encoded-word-string)
1313 "List of methods used to decode encoded words.
1315 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1316 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1317 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1318 whose names match REGEXP.
1321 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1322 mail-decode-encoded-word-string
1323 (\"chinese\" . rfc1843-decode-string))")
1325 (defvar gnus-decode-encoded-word-methods-cache nil)
1327 (defun gnus-multi-decode-encoded-word-string (string)
1328 "Apply the functions from `gnus-encoded-word-methods' that match."
1329 (unless (and gnus-decode-encoded-word-methods-cache
1330 (eq gnus-newsgroup-name
1331 (car gnus-decode-encoded-word-methods-cache)))
1332 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1335 (nconc gnus-decode-encoded-word-methods-cache (list x))
1336 (if (and gnus-newsgroup-name
1337 (string-match (car x) gnus-newsgroup-name))
1338 (nconc gnus-decode-encoded-word-methods-cache
1340 gnus-decode-encoded-word-methods))
1341 (let ((xlist gnus-decode-encoded-word-methods-cache))
1344 (setq string (funcall (pop xlist) string))))
1347 ;; Subject simplification.
1349 (defun gnus-simplify-whitespace (str)
1350 "Remove excessive whitespace from STR."
1353 (while (string-match "[ \t][ \t]+" mystr)
1354 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1356 (substring mystr (match-end 0)))))
1358 (when (string-match "^[ \t]+" mystr)
1359 (setq mystr (substring mystr (match-end 0))))
1361 (when (string-match "[ \t]+$" mystr)
1362 (setq mystr (substring mystr 0 (match-beginning 0))))
1365 (defsubst gnus-simplify-subject-re (subject)
1366 "Remove \"Re:\" from subject lines."
1367 (if (string-match message-subject-re-regexp subject)
1368 (substring subject (match-end 0))
1371 (defun gnus-simplify-subject (subject &optional re-only)
1372 "Remove `Re:' and words in parentheses.
1373 If RE-ONLY is non-nil, strip leading `Re:'s only."
1374 (let ((case-fold-search t)) ;Ignore case.
1375 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1376 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1377 (setq subject (substring subject (match-end 0))))
1378 ;; Remove uninteresting prefixes.
1379 (when (and (not re-only)
1380 gnus-simplify-ignored-prefixes
1381 (string-match gnus-simplify-ignored-prefixes subject))
1382 (setq subject (substring subject (match-end 0))))
1383 ;; Remove words in parentheses from end.
1385 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1386 (setq subject (substring subject 0 (match-beginning 0)))))
1387 ;; Return subject string.
1390 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1392 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1393 (goto-char (point-min))
1394 (while (re-search-forward regexp nil t)
1395 (replace-match (or newtext ""))))
1397 (defun gnus-simplify-buffer-fuzzy ()
1398 "Simplify string in the buffer fuzzily.
1399 The string in the accessible portion of the current buffer is simplified.
1400 It is assumed to be a single-line subject.
1401 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1402 matter is removed. Additional things can be deleted by setting
1403 `gnus-simplify-subject-fuzzy-regexp'."
1404 (let ((case-fold-search t)
1406 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1408 (while (not (eq modified-tick (buffer-modified-tick)))
1409 (setq modified-tick (buffer-modified-tick))
1411 ((listp gnus-simplify-subject-fuzzy-regexp)
1412 (mapcar 'gnus-simplify-buffer-fuzzy-step
1413 gnus-simplify-subject-fuzzy-regexp))
1414 (gnus-simplify-subject-fuzzy-regexp
1415 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1416 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1417 (gnus-simplify-buffer-fuzzy-step
1418 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1419 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1421 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1422 (gnus-simplify-buffer-fuzzy-step " +" " ")
1423 (gnus-simplify-buffer-fuzzy-step " $")
1424 (gnus-simplify-buffer-fuzzy-step "^ +")))
1426 (defun gnus-simplify-subject-fuzzy (subject)
1427 "Simplify a subject string fuzzily.
1428 See `gnus-simplify-buffer-fuzzy' for details."
1430 (gnus-set-work-buffer)
1431 (let ((case-fold-search t))
1432 ;; Remove uninteresting prefixes.
1433 (when (and gnus-simplify-ignored-prefixes
1434 (string-match gnus-simplify-ignored-prefixes subject))
1435 (setq subject (substring subject (match-end 0))))
1437 (inline (gnus-simplify-buffer-fuzzy))
1440 (defsubst gnus-simplify-subject-fully (subject)
1441 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1443 (gnus-simplify-subject-functions
1444 (gnus-map-function gnus-simplify-subject-functions subject))
1445 ((null gnus-summary-gather-subject-limit)
1446 (gnus-simplify-subject-re subject))
1447 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1448 (gnus-simplify-subject-fuzzy subject))
1449 ((numberp gnus-summary-gather-subject-limit)
1450 (gnus-limit-string (gnus-simplify-subject-re subject)
1451 gnus-summary-gather-subject-limit))
1455 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1456 "Check whether two subjects are equal.
1457 If optional argument simple-first is t, first argument is already
1460 ((null simple-first)
1461 (equal (gnus-simplify-subject-fully s1)
1462 (gnus-simplify-subject-fully s2)))
1465 (gnus-simplify-subject-fully s2)))))
1467 (defun gnus-summary-bubble-group ()
1468 "Increase the score of the current group.
1469 This is a handy function to add to `gnus-summary-exit-hook' to
1470 increase the score of each group you read."
1471 (gnus-group-add-score gnus-newsgroup-name))
1475 ;;; Gnus summary mode
1478 (put 'gnus-summary-mode 'mode-class 'special)
1480 (defvar gnus-article-commands-menu)
1483 ;; Non-orthogonal keys
1485 (gnus-define-keys gnus-summary-mode-map
1486 " " gnus-summary-next-page
1487 "\177" gnus-summary-prev-page
1488 [delete] gnus-summary-prev-page
1489 [backspace] gnus-summary-prev-page
1490 "\r" gnus-summary-scroll-up
1491 "\M-\r" gnus-summary-scroll-down
1492 "n" gnus-summary-next-unread-article
1493 "p" gnus-summary-prev-unread-article
1494 "N" gnus-summary-next-article
1495 "P" gnus-summary-prev-article
1496 "\M-\C-n" gnus-summary-next-same-subject
1497 "\M-\C-p" gnus-summary-prev-same-subject
1498 "\M-n" gnus-summary-next-unread-subject
1499 "\M-p" gnus-summary-prev-unread-subject
1500 "." gnus-summary-first-unread-article
1501 "," gnus-summary-best-unread-article
1502 "\M-s" gnus-summary-search-article-forward
1503 "\M-r" gnus-summary-search-article-backward
1504 "<" gnus-summary-beginning-of-article
1505 ">" gnus-summary-end-of-article
1506 "j" gnus-summary-goto-article
1507 "^" gnus-summary-refer-parent-article
1508 "\M-^" gnus-summary-refer-article
1509 "u" gnus-summary-tick-article-forward
1510 "!" gnus-summary-tick-article-forward
1511 "U" gnus-summary-tick-article-backward
1512 "d" gnus-summary-mark-as-read-forward
1513 "D" gnus-summary-mark-as-read-backward
1514 "E" gnus-summary-mark-as-expirable
1515 "\M-u" gnus-summary-clear-mark-forward
1516 "\M-U" gnus-summary-clear-mark-backward
1517 "k" gnus-summary-kill-same-subject-and-select
1518 "\C-k" gnus-summary-kill-same-subject
1519 "\M-\C-k" gnus-summary-kill-thread
1520 "\M-\C-l" gnus-summary-lower-thread
1521 "e" gnus-summary-edit-article
1522 "#" gnus-summary-mark-as-processable
1523 "\M-#" gnus-summary-unmark-as-processable
1524 "\M-\C-t" gnus-summary-toggle-threads
1525 "\M-\C-s" gnus-summary-show-thread
1526 "\M-\C-h" gnus-summary-hide-thread
1527 "\M-\C-f" gnus-summary-next-thread
1528 "\M-\C-b" gnus-summary-prev-thread
1529 [(meta down)] gnus-summary-next-thread
1530 [(meta up)] gnus-summary-prev-thread
1531 "\M-\C-u" gnus-summary-up-thread
1532 "\M-\C-d" gnus-summary-down-thread
1533 "&" gnus-summary-execute-command
1534 "c" gnus-summary-catchup-and-exit
1535 "\C-w" gnus-summary-mark-region-as-read
1536 "\C-t" gnus-summary-toggle-truncation
1537 "?" gnus-summary-mark-as-dormant
1538 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1539 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1540 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1541 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1542 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1543 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1544 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1545 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1546 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1547 "=" gnus-summary-expand-window
1548 "\C-x\C-s" gnus-summary-reselect-current-group
1549 "\M-g" gnus-summary-rescan-group
1550 "w" gnus-summary-stop-page-breaking
1551 "\C-c\C-r" gnus-summary-caesar-message
1552 "f" gnus-summary-followup
1553 "F" gnus-summary-followup-with-original
1554 "C" gnus-summary-cancel-article
1555 "r" gnus-summary-reply
1556 "R" gnus-summary-reply-with-original
1557 "\C-c\C-f" gnus-summary-mail-forward
1558 "o" gnus-summary-save-article
1559 "\C-o" gnus-summary-save-article-mail
1560 "|" gnus-summary-pipe-output
1561 "\M-k" gnus-summary-edit-local-kill
1562 "\M-K" gnus-summary-edit-global-kill
1564 "\C-c\C-d" gnus-summary-describe-group
1565 "q" gnus-summary-exit
1566 "Q" gnus-summary-exit-no-update
1567 "\C-c\C-i" gnus-info-find-node
1568 gnus-mouse-2 gnus-mouse-pick-article
1569 "m" gnus-summary-mail-other-window
1570 "a" gnus-summary-post-news
1571 "i" gnus-summary-news-other-window
1572 "x" gnus-summary-limit-to-unread
1573 "s" gnus-summary-isearch-article
1574 "t" gnus-summary-toggle-header
1575 "g" gnus-summary-show-article
1576 "l" gnus-summary-goto-last-article
1577 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1578 "\C-d" gnus-summary-enter-digest-group
1579 "\M-\C-d" gnus-summary-read-document
1580 "\M-\C-e" gnus-summary-edit-parameters
1581 "\M-\C-a" gnus-summary-customize-parameters
1583 "*" gnus-cache-enter-article
1584 "\M-*" gnus-cache-remove-article
1585 "\M-&" gnus-summary-universal-argument
1586 "\C-l" gnus-recenter
1587 "I" gnus-summary-increase-score
1588 "L" gnus-summary-lower-score
1589 "\M-i" gnus-symbolic-argument
1590 "h" gnus-summary-select-article-buffer
1592 "b" gnus-article-view-part
1593 "\M-t" gnus-summary-toggle-display-buttonized
1595 "V" gnus-summary-score-map
1596 "X" gnus-uu-extract-map
1597 "S" gnus-summary-send-map)
1599 ;; Sort of orthogonal keymap
1600 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1601 "t" gnus-summary-tick-article-forward
1602 "!" gnus-summary-tick-article-forward
1603 "d" gnus-summary-mark-as-read-forward
1604 "r" gnus-summary-mark-as-read-forward
1605 "c" gnus-summary-clear-mark-forward
1606 " " gnus-summary-clear-mark-forward
1607 "e" gnus-summary-mark-as-expirable
1608 "x" gnus-summary-mark-as-expirable
1609 "?" gnus-summary-mark-as-dormant
1610 "b" gnus-summary-set-bookmark
1611 "B" gnus-summary-remove-bookmark
1612 "#" gnus-summary-mark-as-processable
1613 "\M-#" gnus-summary-unmark-as-processable
1614 "S" gnus-summary-limit-include-expunged
1615 "C" gnus-summary-catchup
1616 "H" gnus-summary-catchup-to-here
1617 "h" gnus-summary-catchup-from-here
1618 "\C-c" gnus-summary-catchup-all
1619 "k" gnus-summary-kill-same-subject-and-select
1620 "K" gnus-summary-kill-same-subject
1621 "P" gnus-uu-mark-map)
1623 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1624 "c" gnus-summary-clear-above
1625 "u" gnus-summary-tick-above
1626 "m" gnus-summary-mark-above
1627 "k" gnus-summary-kill-below)
1629 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1630 "/" gnus-summary-limit-to-subject
1631 "n" gnus-summary-limit-to-articles
1632 "w" gnus-summary-pop-limit
1633 "s" gnus-summary-limit-to-subject
1634 "a" gnus-summary-limit-to-author
1635 "u" gnus-summary-limit-to-unread
1636 "m" gnus-summary-limit-to-marks
1637 "M" gnus-summary-limit-exclude-marks
1638 "v" gnus-summary-limit-to-score
1639 "*" gnus-summary-limit-include-cached
1640 "D" gnus-summary-limit-include-dormant
1641 "T" gnus-summary-limit-include-thread
1642 "d" gnus-summary-limit-exclude-dormant
1643 "t" gnus-summary-limit-to-age
1644 "x" gnus-summary-limit-to-extra
1645 "p" gnus-summary-limit-to-display-predicate
1646 "E" gnus-summary-limit-include-expunged
1647 "c" gnus-summary-limit-exclude-childless-dormant
1648 "C" gnus-summary-limit-mark-excluded-as-read
1649 "o" gnus-summary-insert-old-articles
1650 "N" gnus-summary-insert-new-articles)
1652 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1653 "n" gnus-summary-next-unread-article
1654 "p" gnus-summary-prev-unread-article
1655 "N" gnus-summary-next-article
1656 "P" gnus-summary-prev-article
1657 "\C-n" gnus-summary-next-same-subject
1658 "\C-p" gnus-summary-prev-same-subject
1659 "\M-n" gnus-summary-next-unread-subject
1660 "\M-p" gnus-summary-prev-unread-subject
1661 "f" gnus-summary-first-unread-article
1662 "b" gnus-summary-best-unread-article
1663 "j" gnus-summary-goto-article
1664 "g" gnus-summary-goto-subject
1665 "l" gnus-summary-goto-last-article
1666 "o" gnus-summary-pop-article)
1668 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1669 "k" gnus-summary-kill-thread
1670 "l" gnus-summary-lower-thread
1671 "i" gnus-summary-raise-thread
1672 "T" gnus-summary-toggle-threads
1673 "t" gnus-summary-rethread-current
1674 "^" gnus-summary-reparent-thread
1675 "s" gnus-summary-show-thread
1676 "S" gnus-summary-show-all-threads
1677 "h" gnus-summary-hide-thread
1678 "H" gnus-summary-hide-all-threads
1679 "n" gnus-summary-next-thread
1680 "p" gnus-summary-prev-thread
1681 "u" gnus-summary-up-thread
1682 "o" gnus-summary-top-thread
1683 "d" gnus-summary-down-thread
1684 "#" gnus-uu-mark-thread
1685 "\M-#" gnus-uu-unmark-thread)
1687 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1688 "g" gnus-summary-prepare
1689 "c" gnus-summary-insert-cached-articles)
1691 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1692 "c" gnus-summary-catchup-and-exit
1693 "C" gnus-summary-catchup-all-and-exit
1694 "E" gnus-summary-exit-no-update
1695 "Q" gnus-summary-exit
1696 "Z" gnus-summary-exit
1697 "n" gnus-summary-catchup-and-goto-next-group
1698 "R" gnus-summary-reselect-current-group
1699 "G" gnus-summary-rescan-group
1700 "N" gnus-summary-next-group
1701 "s" gnus-summary-save-newsrc
1702 "P" gnus-summary-prev-group)
1704 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1705 " " gnus-summary-next-page
1706 "n" gnus-summary-next-page
1707 "\177" gnus-summary-prev-page
1708 [delete] gnus-summary-prev-page
1709 "p" gnus-summary-prev-page
1710 "\r" gnus-summary-scroll-up
1711 "\M-\r" gnus-summary-scroll-down
1712 "<" gnus-summary-beginning-of-article
1713 ">" gnus-summary-end-of-article
1714 "b" gnus-summary-beginning-of-article
1715 "e" gnus-summary-end-of-article
1716 "^" gnus-summary-refer-parent-article
1717 "r" gnus-summary-refer-parent-article
1718 "D" gnus-summary-enter-digest-group
1719 "R" gnus-summary-refer-references
1720 "T" gnus-summary-refer-thread
1721 "g" gnus-summary-show-article
1722 "s" gnus-summary-isearch-article
1723 "P" gnus-summary-print-article
1724 "M" gnus-mailing-list-insinuate
1725 "t" gnus-article-babel)
1727 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1728 "b" gnus-article-add-buttons
1729 "B" gnus-article-add-buttons-to-head
1730 "o" gnus-article-treat-overstrike
1731 "e" gnus-article-emphasize
1732 "w" gnus-article-fill-cited-article
1733 "Q" gnus-article-fill-long-lines
1734 "C" gnus-article-capitalize-sentences
1735 "c" gnus-article-remove-cr
1736 "q" gnus-article-de-quoted-unreadable
1737 "6" gnus-article-de-base64-unreadable
1738 "Z" gnus-article-decode-HZ
1739 "h" gnus-article-wash-html
1740 "u" gnus-article-unsplit-urls
1741 "s" gnus-summary-force-verify-and-decrypt
1742 "f" gnus-article-display-x-face
1743 "l" gnus-summary-stop-page-breaking
1744 "r" gnus-summary-caesar-message
1745 "t" gnus-summary-toggle-header
1746 "g" gnus-treat-smiley
1747 "v" gnus-summary-verbose-headers
1748 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1749 "p" gnus-article-verify-x-pgp-sig
1750 "d" gnus-article-treat-dumbquotes
1751 "k" gnus-article-outlook-deuglify-article)
1753 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1754 "a" gnus-article-hide
1755 "h" gnus-article-hide-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-header-map "G" gnus-summary-wash-map)
1773 "f" gnus-article-treat-fold-headers
1774 "u" gnus-article-treat-unfold-headers
1775 "n" gnus-article-treat-fold-newsgroups)
1777 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1778 "x" gnus-article-display-x-face
1779 "s" gnus-treat-smiley
1780 "D" gnus-article-remove-images
1781 "f" gnus-treat-from-picon
1782 "m" gnus-treat-mail-picon
1783 "n" gnus-treat-newsgroups-picon)
1785 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1786 "w" gnus-article-decode-mime-words
1787 "c" gnus-article-decode-charset
1788 "v" gnus-mime-view-all-parts
1789 "b" gnus-article-view-part)
1791 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1792 "z" gnus-article-date-ut
1793 "u" gnus-article-date-ut
1794 "l" gnus-article-date-local
1795 "p" gnus-article-date-english
1796 "e" gnus-article-date-lapsed
1797 "o" gnus-article-date-original
1798 "i" gnus-article-date-iso8601
1799 "s" gnus-article-date-user)
1801 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1802 "t" gnus-article-remove-trailing-blank-lines
1803 "l" gnus-article-strip-leading-blank-lines
1804 "m" gnus-article-strip-multiple-blank-lines
1805 "a" gnus-article-strip-blank-lines
1806 "A" gnus-article-strip-all-blank-lines
1807 "s" gnus-article-strip-leading-space
1808 "e" gnus-article-strip-trailing-space
1809 "w" gnus-article-remove-leading-whitespace)
1811 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1813 "f" gnus-summary-fetch-faq
1814 "d" gnus-summary-describe-group
1815 "h" gnus-summary-describe-briefly
1816 "i" gnus-info-find-node)
1818 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1819 "e" gnus-summary-expire-articles
1820 "\M-\C-e" gnus-summary-expire-articles-now
1821 "\177" gnus-summary-delete-article
1822 [delete] gnus-summary-delete-article
1823 [backspace] gnus-summary-delete-article
1824 "m" gnus-summary-move-article
1825 "r" gnus-summary-respool-article
1826 "w" gnus-summary-edit-article
1827 "c" gnus-summary-copy-article
1828 "B" gnus-summary-crosspost-article
1829 "q" gnus-summary-respool-query
1830 "t" gnus-summary-respool-trace
1831 "i" gnus-summary-import-article
1832 "I" gnus-summary-create-article
1833 "p" gnus-summary-article-posted-p)
1835 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1836 "o" gnus-summary-save-article
1837 "m" gnus-summary-save-article-mail
1838 "F" gnus-summary-write-article-file
1839 "r" gnus-summary-save-article-rmail
1840 "f" gnus-summary-save-article-file
1841 "b" gnus-summary-save-article-body-file
1842 "h" gnus-summary-save-article-folder
1843 "v" gnus-summary-save-article-vm
1844 "p" gnus-summary-pipe-output
1845 "P" gnus-summary-muttprint
1846 "s" gnus-soup-add-article)
1848 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1849 "b" gnus-summary-display-buttonized
1850 "m" gnus-summary-repair-multipart
1851 "v" gnus-article-view-part
1852 "o" gnus-article-save-part
1853 "c" gnus-article-copy-part
1854 "C" gnus-article-view-part-as-charset
1855 "e" gnus-article-view-part-externally
1856 "E" gnus-article-encrypt-body
1857 "i" gnus-article-inline-part
1858 "|" gnus-article-pipe-part)
1860 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1861 "p" gnus-summary-mark-as-processable
1862 "u" gnus-summary-unmark-as-processable
1863 "U" gnus-summary-unmark-all-processable
1864 "v" gnus-uu-mark-over
1865 "s" gnus-uu-mark-series
1866 "r" gnus-uu-mark-region
1867 "g" gnus-uu-unmark-region
1868 "R" gnus-uu-mark-by-regexp
1869 "G" gnus-uu-unmark-by-regexp
1870 "t" gnus-uu-mark-thread
1871 "T" gnus-uu-unmark-thread
1872 "a" gnus-uu-mark-all
1873 "b" gnus-uu-mark-buffer
1874 "S" gnus-uu-mark-sparse
1875 "k" gnus-summary-kill-process-mark
1876 "y" gnus-summary-yank-process-mark
1877 "w" gnus-summary-save-process-mark
1878 "i" gnus-uu-invert-processable)
1880 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
1881 ;;"x" gnus-uu-extract-any
1882 "m" gnus-summary-save-parts
1883 "u" gnus-uu-decode-uu
1884 "U" gnus-uu-decode-uu-and-save
1885 "s" gnus-uu-decode-unshar
1886 "S" gnus-uu-decode-unshar-and-save
1887 "o" gnus-uu-decode-save
1888 "O" gnus-uu-decode-save
1889 "b" gnus-uu-decode-binhex
1890 "B" gnus-uu-decode-binhex
1891 "p" gnus-uu-decode-postscript
1892 "P" gnus-uu-decode-postscript-and-save)
1895 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
1896 "u" gnus-uu-decode-uu-view
1897 "U" gnus-uu-decode-uu-and-save-view
1898 "s" gnus-uu-decode-unshar-view
1899 "S" gnus-uu-decode-unshar-and-save-view
1900 "o" gnus-uu-decode-save-view
1901 "O" gnus-uu-decode-save-view
1902 "b" gnus-uu-decode-binhex-view
1903 "B" gnus-uu-decode-binhex-view
1904 "p" gnus-uu-decode-postscript-view
1905 "P" gnus-uu-decode-postscript-and-save-view))
1907 (defvar gnus-article-post-menu nil)
1909 (defun gnus-summary-make-menu-bar ()
1910 (gnus-turn-off-edit-menu 'summary)
1912 (unless (boundp 'gnus-summary-misc-menu)
1915 gnus-summary-kill-menu gnus-summary-mode-map ""
1920 ["Customize" gnus-score-customize t])
1921 (gnus-make-score-map 'increase)
1922 (gnus-make-score-map 'lower)
1924 ["Kill below" gnus-summary-kill-below t]
1925 ["Mark above" gnus-summary-mark-above t]
1926 ["Tick above" gnus-summary-tick-above t]
1927 ["Clear above" gnus-summary-clear-above t])
1928 ["Current score" gnus-summary-current-score t]
1929 ["Set score" gnus-summary-set-score t]
1930 ["Switch current score file..." gnus-score-change-score-file t]
1931 ["Set mark below..." gnus-score-set-mark-below t]
1932 ["Set expunge below..." gnus-score-set-expunge-below t]
1933 ["Edit current score file" gnus-score-edit-current-scores t]
1934 ["Edit score file" gnus-score-edit-file t]
1935 ["Trace score" gnus-score-find-trace t]
1936 ["Find words" gnus-score-find-favourite-words t]
1937 ["Rescore buffer" gnus-summary-rescore t]
1938 ["Increase score..." gnus-summary-increase-score t]
1939 ["Lower score..." gnus-summary-lower-score t]))))
1941 ;; Define both the Article menu in the summary buffer and the
1942 ;; equivalent Commands menu in the article buffer here for
1946 ["All" gnus-article-hide t]
1947 ["Headers" gnus-article-hide-headers t]
1948 ["Signature" gnus-article-hide-signature t]
1949 ["Citation" gnus-article-hide-citation t]
1950 ["List identifiers" gnus-article-hide-list-identifiers t]
1951 ["PGP" gnus-article-hide-pgp t]
1952 ["Banner" gnus-article-strip-banner t]
1953 ["Boring headers" gnus-article-hide-boring-headers t])
1955 ["All" gnus-article-highlight t]
1956 ["Headers" gnus-article-highlight-headers t]
1957 ["Signature" gnus-article-highlight-signature t]
1958 ["Citation" gnus-article-highlight-citation t])
1960 ["Words" gnus-article-decode-mime-words t]
1961 ["Charset" gnus-article-decode-charset t]
1962 ["QP" gnus-article-de-quoted-unreadable t]
1963 ["Base64" gnus-article-de-base64-unreadable t]
1964 ["View all" gnus-mime-view-all-parts t]
1965 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
1966 ["Encrypt body" gnus-article-encrypt-body t]
1967 ["Extract all parts" gnus-summary-save-parts t])
1969 ["Local" gnus-article-date-local t]
1970 ["ISO8601" gnus-article-date-iso8601 t]
1971 ["UT" gnus-article-date-ut t]
1972 ["Original" gnus-article-date-original t]
1973 ["Lapsed" gnus-article-date-lapsed t]
1974 ["User-defined" gnus-article-date-user t])
1976 ["Remove images" gnus-article-remove-images t]
1977 ["Toggle smiley" gnus-treat-smiley t]
1978 ["Show X-Face" gnus-article-display-x-face t]
1979 ["Show picons in From" gnus-treat-from-picon t]
1980 ["Show picons in mail headers" gnus-treat-mail-picon t]
1981 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
1982 ("View as different encoding"
1985 ;; Since easymenu under FSF Emacs doesn't allow lambda
1986 ;; forms for menu commands, we should provide intern'ed
1987 ;; function symbols.
1988 (let ((command (intern (format "\
1989 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
1993 (let ((gnus-summary-show-article-charset-alist
1995 (gnus-summary-show-article 1))))
1996 `[,(symbol-name cs) ,command t]))
1997 (sort (if (fboundp 'coding-system-list)
1998 (coding-system-list)
1999 (mapcar 'car mm-mime-mule-charset-alist))
2001 (string< (symbol-name a)
2002 (symbol-name b)))))))
2005 ["Leading" gnus-article-strip-leading-blank-lines t]
2006 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2007 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2008 ["All of the above" gnus-article-strip-blank-lines t]
2009 ["All" gnus-article-strip-all-blank-lines t]
2010 ["Leading space" gnus-article-strip-leading-space t]
2011 ["Trailing space" gnus-article-strip-trailing-space t]
2012 ["Leading space in headers"
2013 gnus-article-remove-leading-whitespace t])
2014 ["Overstrike" gnus-article-treat-overstrike t]
2015 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2016 ["Emphasis" gnus-article-emphasize t]
2017 ["Word wrap" gnus-article-fill-cited-article t]
2018 ["Fill long lines" gnus-article-fill-long-lines t]
2019 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2020 ["CR" gnus-article-remove-cr t]
2021 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2022 ["Base64" gnus-article-de-base64-unreadable t]
2023 ["Rot 13" gnus-summary-caesar-message
2024 ,@(if (featurep 'xemacs) '(t)
2025 '(:help "\"Caesar rotate\" article by 13"))]
2026 ["Unix pipe" gnus-summary-pipe-message t]
2027 ["Add buttons" gnus-article-add-buttons t]
2028 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2029 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2030 ["Verbose header" gnus-summary-verbose-headers t]
2031 ["Toggle header" gnus-summary-toggle-header t]
2032 ["Unfold headers" gnus-article-treat-unfold-headers t]
2033 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2034 ["Html" gnus-article-wash-html t]
2035 ["URLs" gnus-article-unsplit-urls t]
2036 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2037 ["HZ" gnus-article-decode-HZ t]
2038 ["OutlooK deuglify" gnus-article-outlook-deuglify-article t]
2041 ["Save in default format" gnus-summary-save-article
2042 ,@(if (featurep 'xemacs) '(t)
2043 '(:help "Save article using default method"))]
2044 ["Save in file" gnus-summary-save-article-file
2045 ,@(if (featurep 'xemacs) '(t)
2046 '(:help "Save article in file"))]
2047 ["Save in Unix mail format" gnus-summary-save-article-mail t]
2048 ["Save in MH folder" gnus-summary-save-article-folder t]
2049 ["Save in VM folder" gnus-summary-save-article-vm t]
2050 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
2051 ["Save body in file" gnus-summary-save-article-body-file t]
2052 ["Pipe through a filter" gnus-summary-pipe-output t]
2053 ["Add to SOUP packet" gnus-soup-add-article t]
2054 ["Print with Muttprint" gnus-summary-muttprint t]
2055 ["Print" gnus-summary-print-article t])
2057 ["Respool article..." gnus-summary-respool-article t]
2058 ["Move article..." gnus-summary-move-article
2059 (gnus-check-backend-function
2060 'request-move-article gnus-newsgroup-name)]
2061 ["Copy article..." gnus-summary-copy-article t]
2062 ["Crosspost article..." gnus-summary-crosspost-article
2063 (gnus-check-backend-function
2064 'request-replace-article gnus-newsgroup-name)]
2065 ["Import file..." gnus-summary-import-article t]
2066 ["Create article..." gnus-summary-create-article t]
2067 ["Check if posted" gnus-summary-article-posted-p t]
2068 ["Edit article" gnus-summary-edit-article
2069 (not (gnus-group-read-only-p))]
2070 ["Delete article" gnus-summary-delete-article
2071 (gnus-check-backend-function
2072 'request-expire-articles gnus-newsgroup-name)]
2073 ["Query respool" gnus-summary-respool-query t]
2074 ["Trace respool" gnus-summary-respool-trace t]
2075 ["Delete expirable articles" gnus-summary-expire-articles-now
2076 (gnus-check-backend-function
2077 'request-expire-articles gnus-newsgroup-name)])
2079 ["Uudecode" gnus-uu-decode-uu
2080 ,@(if (featurep 'xemacs) '(t)
2081 '(:help "Decode uuencoded article(s)"))]
2082 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2083 ["Unshar" gnus-uu-decode-unshar t]
2084 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2085 ["Save" gnus-uu-decode-save t]
2086 ["Binhex" gnus-uu-decode-binhex t]
2087 ["Postscript" gnus-uu-decode-postscript t]
2088 ["All MIME parts" gnus-summary-save-parts t])
2090 ["Enter article" gnus-cache-enter-article t]
2091 ["Remove article" gnus-cache-remove-article t])
2092 ["Translate" gnus-article-babel t]
2093 ["Select article buffer" gnus-summary-select-article-buffer t]
2094 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2095 ["Isearch article..." gnus-summary-isearch-article t]
2096 ["Beginning of the article" gnus-summary-beginning-of-article t]
2097 ["End of the article" gnus-summary-end-of-article t]
2098 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2099 ["Fetch referenced articles" gnus-summary-refer-references t]
2100 ["Fetch current thread" gnus-summary-refer-thread t]
2101 ["Fetch article with id..." gnus-summary-refer-article t]
2102 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2103 ["Redisplay" gnus-summary-show-article t]
2104 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2106 gnus-summary-article-menu gnus-summary-mode-map ""
2107 (cons "Article" innards))
2109 (if (not (keymapp gnus-summary-article-menu))
2111 gnus-article-commands-menu gnus-article-mode-map ""
2112 (cons "Commands" innards))
2113 ;; in Emacs, don't share menu.
2114 (setq gnus-article-commands-menu
2115 (copy-keymap gnus-summary-article-menu))
2116 (define-key gnus-article-mode-map [menu-bar commands]
2117 (cons "Commands" gnus-article-commands-menu))))
2120 gnus-summary-thread-menu gnus-summary-mode-map ""
2122 ["Toggle threading" gnus-summary-toggle-threads t]
2123 ["Hide threads" gnus-summary-hide-all-threads t]
2124 ["Show threads" gnus-summary-show-all-threads t]
2125 ["Hide thread" gnus-summary-hide-thread t]
2126 ["Show thread" gnus-summary-show-thread t]
2127 ["Go to next thread" gnus-summary-next-thread t]
2128 ["Go to previous thread" gnus-summary-prev-thread t]
2129 ["Go down thread" gnus-summary-down-thread t]
2130 ["Go up thread" gnus-summary-up-thread t]
2131 ["Top of thread" gnus-summary-top-thread t]
2132 ["Mark thread as read" gnus-summary-kill-thread t]
2133 ["Lower thread score" gnus-summary-lower-thread t]
2134 ["Raise thread score" gnus-summary-raise-thread t]
2135 ["Rethread current" gnus-summary-rethread-current t]))
2138 gnus-summary-post-menu gnus-summary-mode-map ""
2140 ["Send a message (mail or news)" gnus-summary-post-news
2141 ,@(if (featurep 'xemacs) '(t)
2142 '(:help "Post an article"))]
2143 ["Followup" gnus-summary-followup
2144 ,@(if (featurep 'xemacs) '(t)
2145 '(:help "Post followup to this article"))]
2146 ["Followup and yank" gnus-summary-followup-with-original
2147 ,@(if (featurep 'xemacs) '(t)
2148 '(:help "Post followup to this article, quoting its contents"))]
2149 ["Supersede article" gnus-summary-supersede-article t]
2150 ["Cancel article" gnus-summary-cancel-article
2151 ,@(if (featurep 'xemacs) '(t)
2152 '(:help "Cancel an article you posted"))]
2153 ["Reply" gnus-summary-reply t]
2154 ["Reply and yank" gnus-summary-reply-with-original t]
2155 ["Wide reply" gnus-summary-wide-reply t]
2156 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2157 ,@(if (featurep 'xemacs) '(t)
2158 '(:help "Mail a reply, quoting this article"))]
2159 ["Very wide reply" gnus-summary-very-wide-reply t]
2160 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2161 ,@(if (featurep 'xemacs) '(t)
2162 '(:help "Mail a very wide reply, quoting this article"))]
2163 ["Mail forward" gnus-summary-mail-forward t]
2164 ["Post forward" gnus-summary-post-forward t]
2165 ["Digest and mail" gnus-uu-digest-mail-forward t]
2166 ["Digest and post" gnus-uu-digest-post-forward t]
2167 ["Resend message" gnus-summary-resend-message t]
2168 ["Resend message edit" gnus-summary-resend-message-edit t]
2169 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2170 ["Send a mail" gnus-summary-mail-other-window t]
2171 ["Create a local message" gnus-summary-news-other-window t]
2172 ["Uuencode and post" gnus-uu-post-news
2173 ,@(if (featurep 'xemacs) '(t)
2174 '(:help "Post a uuencoded article"))]
2175 ["Followup via news" gnus-summary-followup-to-mail t]
2176 ["Followup via news and yank"
2177 gnus-summary-followup-to-mail-with-original t]
2179 ;;["Send" gnus-summary-send-draft t]
2180 ;;["Send bounced" gnus-resend-bounced-mail t])
2184 ((not (keymapp gnus-summary-post-menu))
2185 (setq gnus-article-post-menu gnus-summary-post-menu))
2186 ((not gnus-article-post-menu)
2187 ;; Don't share post menu.
2188 (setq gnus-article-post-menu
2189 (copy-keymap gnus-summary-post-menu))))
2190 (define-key gnus-article-mode-map [menu-bar post]
2191 (cons "Post" gnus-article-post-menu))
2194 gnus-summary-misc-menu gnus-summary-mode-map ""
2197 ["Mark as read" gnus-summary-mark-as-read-forward t]
2198 ["Mark same subject and select"
2199 gnus-summary-kill-same-subject-and-select t]
2200 ["Mark same subject" gnus-summary-kill-same-subject t]
2201 ["Catchup" gnus-summary-catchup
2202 ,@(if (featurep 'xemacs) '(t)
2203 '(:help "Mark unread articles in this group as read"))]
2204 ["Catchup all" gnus-summary-catchup-all t]
2205 ["Catchup to here" gnus-summary-catchup-to-here t]
2206 ["Catchup from here" gnus-summary-catchup-from-here t]
2207 ["Catchup region" gnus-summary-mark-region-as-read t]
2208 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2210 ["Tick" gnus-summary-tick-article-forward t]
2211 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2212 ["Remove marks" gnus-summary-clear-mark-forward t]
2213 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2214 ["Set bookmark" gnus-summary-set-bookmark t]
2215 ["Remove bookmark" gnus-summary-remove-bookmark t])
2217 ["Marks..." gnus-summary-limit-to-marks t]
2218 ["Subject..." gnus-summary-limit-to-subject t]
2219 ["Author..." gnus-summary-limit-to-author t]
2220 ["Age..." gnus-summary-limit-to-age t]
2221 ["Extra..." gnus-summary-limit-to-extra t]
2222 ["Score" gnus-summary-limit-to-score t]
2223 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2224 ["Unread" gnus-summary-limit-to-unread t]
2225 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2226 ["Articles" gnus-summary-limit-to-articles t]
2227 ["Pop limit" gnus-summary-pop-limit t]
2228 ["Show dormant" gnus-summary-limit-include-dormant t]
2229 ["Hide childless dormant"
2230 gnus-summary-limit-exclude-childless-dormant t]
2231 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2232 ["Hide marked" gnus-summary-limit-exclude-marks t]
2233 ["Show expunged" gnus-summary-limit-include-expunged t])
2235 ["Set mark" gnus-summary-mark-as-processable t]
2236 ["Remove mark" gnus-summary-unmark-as-processable t]
2237 ["Remove all marks" gnus-summary-unmark-all-processable t]
2238 ["Mark above" gnus-uu-mark-over t]
2239 ["Mark series" gnus-uu-mark-series t]
2240 ["Mark region" gnus-uu-mark-region t]
2241 ["Unmark region" gnus-uu-unmark-region t]
2242 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2243 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2244 ["Mark all" gnus-uu-mark-all t]
2245 ["Mark buffer" gnus-uu-mark-buffer t]
2246 ["Mark sparse" gnus-uu-mark-sparse t]
2247 ["Mark thread" gnus-uu-mark-thread t]
2248 ["Unmark thread" gnus-uu-unmark-thread t]
2249 ("Process Mark Sets"
2250 ["Kill" gnus-summary-kill-process-mark t]
2251 ["Yank" gnus-summary-yank-process-mark
2252 gnus-newsgroup-process-stack]
2253 ["Save" gnus-summary-save-process-mark t]))
2255 ["Page forward" gnus-summary-next-page
2256 ,@(if (featurep 'xemacs) '(t)
2257 '(:help "Show next page of article"))]
2258 ["Page backward" gnus-summary-prev-page
2259 ,@(if (featurep 'xemacs) '(t)
2260 '(:help "Show previous page of article"))]
2261 ["Line forward" gnus-summary-scroll-up t])
2263 ["Next unread article" gnus-summary-next-unread-article t]
2264 ["Previous unread article" gnus-summary-prev-unread-article t]
2265 ["Next article" gnus-summary-next-article t]
2266 ["Previous article" gnus-summary-prev-article t]
2267 ["Next unread subject" gnus-summary-next-unread-subject t]
2268 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2269 ["Next article same subject" gnus-summary-next-same-subject t]
2270 ["Previous article same subject" gnus-summary-prev-same-subject t]
2271 ["First unread article" gnus-summary-first-unread-article t]
2272 ["Best unread article" gnus-summary-best-unread-article t]
2273 ["Go to subject number..." gnus-summary-goto-subject t]
2274 ["Go to article number..." gnus-summary-goto-article t]
2275 ["Go to the last article" gnus-summary-goto-last-article t]
2276 ["Pop article off history" gnus-summary-pop-article t])
2278 ["Sort by number" gnus-summary-sort-by-number t]
2279 ["Sort by author" gnus-summary-sort-by-author t]
2280 ["Sort by subject" gnus-summary-sort-by-subject t]
2281 ["Sort by date" gnus-summary-sort-by-date t]
2282 ["Sort by score" gnus-summary-sort-by-score t]
2283 ["Sort by lines" gnus-summary-sort-by-lines t]
2284 ["Sort by characters" gnus-summary-sort-by-chars t]
2285 ["Original sort" gnus-summary-sort-by-original t])
2287 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2288 ["Describe group" gnus-summary-describe-group t]
2289 ["Read manual" gnus-info-find-node t])
2291 ["Pick and read" gnus-pick-mode t]
2292 ["Binary" gnus-binary-mode t])
2294 ["Regenerate" gnus-summary-prepare t]
2295 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2296 ["Toggle threading" gnus-summary-toggle-threads t])
2297 ["See old articles" gnus-summary-insert-old-articles t]
2298 ["See new articles" gnus-summary-insert-new-articles t]
2299 ["Filter articles..." gnus-summary-execute-command t]
2300 ["Run command on subjects..." gnus-summary-universal-argument t]
2301 ["Search articles forward..." gnus-summary-search-article-forward t]
2302 ["Search articles backward..." gnus-summary-search-article-backward t]
2303 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2304 ["Expand window" gnus-summary-expand-window t]
2305 ["Expire expirable articles" gnus-summary-expire-articles
2306 (gnus-check-backend-function
2307 'request-expire-articles gnus-newsgroup-name)]
2308 ["Edit local kill file" gnus-summary-edit-local-kill t]
2309 ["Edit main kill file" gnus-summary-edit-global-kill t]
2310 ["Edit group parameters" gnus-summary-edit-parameters t]
2311 ["Customize group parameters" gnus-summary-customize-parameters t]
2312 ["Send a bug report" gnus-bug t]
2314 ["Catchup and exit" gnus-summary-catchup-and-exit
2315 ,@(if (featurep 'xemacs) '(t)
2316 '(:help "Mark unread articles in this group as read, then exit"))]
2317 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2318 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2319 ["Exit group" gnus-summary-exit
2320 ,@(if (featurep 'xemacs) '(t)
2321 '(:help "Exit current group, return to group selection mode"))]
2322 ["Exit group without updating" gnus-summary-exit-no-update t]
2323 ["Exit and goto next group" gnus-summary-next-group t]
2324 ["Exit and goto prev group" gnus-summary-prev-group t]
2325 ["Reselect group" gnus-summary-reselect-current-group t]
2326 ["Rescan group" gnus-summary-rescan-group t]
2327 ["Update dribble" gnus-summary-save-newsrc t])))
2329 (gnus-run-hooks 'gnus-summary-menu-hook)))
2331 (defvar gnus-summary-tool-bar-map nil)
2333 ;; Emacs 21 tool bar. Should be no-op otherwise.
2334 (defun gnus-summary-make-tool-bar ()
2335 (if (and (fboundp 'tool-bar-add-item-from-menu)
2336 (default-value 'tool-bar-mode)
2337 (not gnus-summary-tool-bar-map))
2338 (setq gnus-summary-tool-bar-map
2339 (let ((tool-bar-map (make-sparse-keymap))
2340 (load-path (mm-image-load-path)))
2341 (tool-bar-add-item-from-menu
2342 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2343 (tool-bar-add-item-from-menu
2344 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2345 (tool-bar-add-item-from-menu
2346 'gnus-summary-post-news "post" gnus-summary-mode-map)
2347 (tool-bar-add-item-from-menu
2348 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2349 (tool-bar-add-item-from-menu
2350 'gnus-summary-followup "followup" gnus-summary-mode-map)
2351 (tool-bar-add-item-from-menu
2352 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2353 (tool-bar-add-item-from-menu
2354 'gnus-summary-reply "reply" gnus-summary-mode-map)
2355 (tool-bar-add-item-from-menu
2356 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2357 (tool-bar-add-item-from-menu
2358 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2359 (tool-bar-add-item-from-menu
2360 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2361 (tool-bar-add-item-from-menu
2362 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2363 (tool-bar-add-item-from-menu
2364 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2365 (tool-bar-add-item-from-menu
2366 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2367 (tool-bar-add-item-from-menu
2368 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2369 (tool-bar-add-item-from-menu
2370 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2372 (if gnus-summary-tool-bar-map
2373 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2375 (defun gnus-score-set-default (var value)
2376 "A version of set that updates the GNU Emacs menu-bar."
2378 ;; It is the message that forces the active status to be updated.
2381 (defun gnus-make-score-map (type)
2382 "Make a summary score map of type TYPE."
2385 (let ((headers '(("author" "from" string)
2386 ("subject" "subject" string)
2387 ("article body" "body" string)
2388 ("article head" "head" string)
2389 ("xref" "xref" string)
2390 ("extra header" "extra" string)
2391 ("lines" "lines" number)
2392 ("followups to author" "followup" string)))
2393 (types '((number ("less than" <)
2396 (string ("substring" s)
2400 (perms '(("temporary" (current-time-string))
2408 (if (eq type 'lower)
2413 (setq header (car headers))
2419 (let ((ts (cdr (assoc (nth 2 header) types)))
2435 'gnus-summary-score-entry
2437 (if (or (string= (nth 1 header)
2439 (string= (nth 1 header)
2442 (list 'gnus-summary-header
2444 (list 'quote (nth 1 (car ts)))
2445 (list 'gnus-score-delta-default
2452 (list (nreverse outp))))
2455 (list (nreverse outt))))
2457 (setq headers (cdr headers)))
2458 (list (nreverse outh))))))))
2462 (defun gnus-summary-mode (&optional group)
2463 "Major mode for reading articles.
2465 All normal editing commands are switched off.
2466 \\<gnus-summary-mode-map>
2467 Each line in this buffer represents one article. To read an
2468 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2469 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2472 You can also post articles and send mail from this buffer. To
2473 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2474 of an article, type `\\[gnus-summary-reply]'.
2476 There are approx. one gazillion commands you can execute in this
2477 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2479 The following commands are available:
2481 \\{gnus-summary-mode-map}"
2483 (kill-all-local-variables)
2484 (when (gnus-visual-p 'summary-menu 'menu)
2485 (gnus-summary-make-menu-bar)
2486 (gnus-summary-make-tool-bar))
2487 (gnus-summary-make-local-variables)
2488 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2489 (gnus-summary-make-local-variables))
2490 (gnus-make-thread-indent-array)
2491 (gnus-simplify-mode-line)
2492 (setq major-mode 'gnus-summary-mode)
2493 (setq mode-name "Summary")
2494 (make-local-variable 'minor-mode-alist)
2495 (use-local-map gnus-summary-mode-map)
2496 (buffer-disable-undo)
2497 (setq buffer-read-only t) ;Disable modification
2498 (setq truncate-lines t)
2499 (setq selective-display t)
2500 (setq selective-display-ellipses t) ;Display `...'
2501 (gnus-summary-set-display-table)
2502 (gnus-set-default-directory)
2503 (setq gnus-newsgroup-name group)
2504 (make-local-variable 'gnus-summary-line-format)
2505 (make-local-variable 'gnus-summary-line-format-spec)
2506 (make-local-variable 'gnus-summary-dummy-line-format)
2507 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2508 (make-local-variable 'gnus-summary-mark-positions)
2509 (make-local-hook 'pre-command-hook)
2510 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2511 (gnus-run-hooks 'gnus-summary-mode-hook)
2512 (turn-on-gnus-mailing-list-mode)
2513 (mm-enable-multibyte)
2514 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2515 (gnus-update-summary-mark-positions))
2517 (defun gnus-summary-make-local-variables ()
2518 "Make all the local summary buffer variables."
2520 (dolist (local gnus-summary-local-variables)
2523 (if (eq (cdr local) 'global)
2524 ;; Copy the global value of the variable.
2525 (setq global (symbol-value (car local)))
2526 ;; Use the value from the list.
2527 (setq global (eval (cdr local))))
2528 (set (make-local-variable (car local)) global))
2529 ;; Simple nil-valued local variable.
2530 (set (make-local-variable local) nil)))))
2532 (defun gnus-summary-clear-local-variables ()
2533 (let ((locals gnus-summary-local-variables))
2535 (if (consp (car locals))
2536 (and (vectorp (caar locals))
2537 (set (caar locals) nil))
2538 (and (vectorp (car locals))
2539 (set (car locals) nil)))
2540 (setq locals (cdr locals)))))
2542 ;; Summary data functions.
2544 (defmacro gnus-data-number (data)
2547 (defmacro gnus-data-set-number (data number)
2548 `(setcar ,data ,number))
2550 (defmacro gnus-data-mark (data)
2553 (defmacro gnus-data-set-mark (data mark)
2554 `(setcar (nthcdr 1 ,data) ,mark))
2556 (defmacro gnus-data-pos (data)
2559 (defmacro gnus-data-set-pos (data pos)
2560 `(setcar (nthcdr 2 ,data) ,pos))
2562 (defmacro gnus-data-header (data)
2565 (defmacro gnus-data-set-header (data header)
2566 `(setf (nth 3 ,data) ,header))
2568 (defmacro gnus-data-level (data)
2571 (defmacro gnus-data-unread-p (data)
2572 `(= (nth 1 ,data) gnus-unread-mark))
2574 (defmacro gnus-data-read-p (data)
2575 `(/= (nth 1 ,data) gnus-unread-mark))
2577 (defmacro gnus-data-pseudo-p (data)
2578 `(consp (nth 3 ,data)))
2580 (defmacro gnus-data-find (number)
2581 `(assq ,number gnus-newsgroup-data))
2583 (defmacro gnus-data-find-list (number &optional data)
2584 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2585 (memq (assq ,number bdata)
2588 (defmacro gnus-data-make (number mark pos header level)
2589 `(list ,number ,mark ,pos ,header ,level))
2591 (defun gnus-data-enter (after-article number mark pos header level offset)
2592 (let ((data (gnus-data-find-list after-article)))
2594 (error "No such article: %d" after-article))
2595 (setcdr data (cons (gnus-data-make number mark pos header level)
2597 (setq gnus-newsgroup-data-reverse nil)
2598 (gnus-data-update-list (cddr data) offset)))
2600 (defun gnus-data-enter-list (after-article list &optional offset)
2602 (let ((data (and after-article (gnus-data-find-list after-article)))
2606 (let ((odata gnus-newsgroup-data))
2607 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2609 (gnus-data-update-list odata offset)))
2610 ;; Find the last element in the list to be spliced into the main
2613 (setq list (cdr list)))
2616 (setcdr list gnus-newsgroup-data)
2617 (setq gnus-newsgroup-data ilist)
2619 (gnus-data-update-list (cdr list) offset)))
2620 (setcdr list (cdr data))
2623 (gnus-data-update-list (cdr list) offset))))
2624 (setq gnus-newsgroup-data-reverse nil))))
2626 (defun gnus-data-remove (article &optional offset)
2627 (let ((data gnus-newsgroup-data))
2628 (if (= (gnus-data-number (car data)) article)
2630 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2631 gnus-newsgroup-data-reverse nil)
2633 (gnus-data-update-list gnus-newsgroup-data offset)))
2635 (when (= (gnus-data-number (cadr data)) article)
2636 (setcdr data (cddr data))
2638 (gnus-data-update-list (cdr data) offset))
2640 gnus-newsgroup-data-reverse nil))
2641 (setq data (cdr data))))))
2643 (defmacro gnus-data-list (backward)
2645 (or gnus-newsgroup-data-reverse
2646 (setq gnus-newsgroup-data-reverse
2647 (reverse gnus-newsgroup-data)))
2648 gnus-newsgroup-data))
2650 (defun gnus-data-update-list (data offset)
2651 "Add OFFSET to the POS of all data entries in DATA."
2652 (setq gnus-newsgroup-data-reverse nil)
2654 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2655 (setq data (cdr data))))
2657 (defun gnus-summary-article-pseudo-p (article)
2658 "Say whether this article is a pseudo article or not."
2659 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2661 (defmacro gnus-summary-article-sparse-p (article)
2662 "Say whether this article is a sparse article or not."
2663 `(memq ,article gnus-newsgroup-sparse))
2665 (defmacro gnus-summary-article-ancient-p (article)
2666 "Say whether this article is a sparse article or not."
2667 `(memq ,article gnus-newsgroup-ancient))
2669 (defun gnus-article-parent-p (number)
2670 "Say whether this article is a parent or not."
2671 (let ((data (gnus-data-find-list number)))
2672 (and (cdr data) ; There has to be an article after...
2673 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2674 (gnus-data-level (nth 1 data))))))
2676 (defun gnus-article-children (number)
2677 "Return a list of all children to NUMBER."
2678 (let* ((data (gnus-data-find-list number))
2679 (level (gnus-data-level (car data)))
2681 (setq data (cdr data))
2683 (= (gnus-data-level (car data)) (1+ level)))
2684 (push (gnus-data-number (car data)) children)
2685 (setq data (cdr data)))
2688 (defmacro gnus-summary-skip-intangible ()
2689 "If the current article is intangible, then jump to a different article."
2690 '(let ((to (get-text-property (point) 'gnus-intangible)))
2691 (and to (gnus-summary-goto-subject to))))
2693 (defmacro gnus-summary-article-intangible-p ()
2694 "Say whether this article is intangible or not."
2695 '(get-text-property (point) 'gnus-intangible))
2697 (defun gnus-article-read-p (article)
2698 "Say whether ARTICLE is read or not."
2699 (not (or (memq article gnus-newsgroup-marked)
2700 (memq article gnus-newsgroup-unreads)
2701 (memq article gnus-newsgroup-unselected)
2702 (memq article gnus-newsgroup-dormant))))
2704 ;; Some summary mode macros.
2706 (defmacro gnus-summary-article-number ()
2707 "The article number of the article on the current line.
2708 If there isn's an article number here, then we return the current
2711 (gnus-summary-skip-intangible)
2712 (or (get-text-property (point) 'gnus-number)
2713 (gnus-summary-last-subject))))
2715 (defmacro gnus-summary-article-header (&optional number)
2716 "Return the header of article NUMBER."
2717 `(gnus-data-header (gnus-data-find
2718 ,(or number '(gnus-summary-article-number)))))
2720 (defmacro gnus-summary-thread-level (&optional number)
2721 "Return the level of thread that starts with article NUMBER."
2722 `(if (and (eq gnus-summary-make-false-root 'dummy)
2723 (get-text-property (point) 'gnus-intangible))
2725 (gnus-data-level (gnus-data-find
2726 ,(or number '(gnus-summary-article-number))))))
2728 (defmacro gnus-summary-article-mark (&optional number)
2729 "Return the mark of article NUMBER."
2730 `(gnus-data-mark (gnus-data-find
2731 ,(or number '(gnus-summary-article-number)))))
2733 (defmacro gnus-summary-article-pos (&optional number)
2734 "Return the position of the line of article NUMBER."
2735 `(gnus-data-pos (gnus-data-find
2736 ,(or number '(gnus-summary-article-number)))))
2738 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2739 (defmacro gnus-summary-article-subject (&optional number)
2740 "Return current subject string or nil if nothing."
2743 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2744 '(gnus-data-header (assq (gnus-summary-article-number)
2745 gnus-newsgroup-data)))))
2748 (mail-header-subject headers))))
2750 (defmacro gnus-summary-article-score (&optional number)
2751 "Return current article score."
2752 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2753 gnus-newsgroup-scored))
2754 gnus-summary-default-score 0))
2756 (defun gnus-summary-article-children (&optional number)
2757 "Return a list of article numbers that are children of article NUMBER."
2758 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2759 (level (gnus-data-level (car data)))
2761 (while (and (setq data (cdr data))
2762 (> (setq l (gnus-data-level (car data))) level))
2763 (and (= (1+ level) l)
2764 (push (gnus-data-number (car data))
2766 (nreverse children)))
2768 (defun gnus-summary-article-parent (&optional number)
2769 "Return the article number of the parent of article NUMBER."
2770 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2771 (gnus-data-list t)))
2772 (level (gnus-data-level (car data))))
2774 () ; This is a root.
2775 ;; We search until we find an article with a level less than
2776 ;; this one. That function has to be the parent.
2777 (while (and (setq data (cdr data))
2778 (not (< (gnus-data-level (car data)) level))))
2779 (and data (gnus-data-number (car data))))))
2781 (defun gnus-unread-mark-p (mark)
2782 "Say whether MARK is the unread mark."
2783 (= mark gnus-unread-mark))
2785 (defun gnus-read-mark-p (mark)
2786 "Say whether MARK is one of the marks that mark as read.
2787 This is all marks except unread, ticked, dormant, and expirable."
2788 (not (or (= mark gnus-unread-mark)
2789 (= mark gnus-ticked-mark)
2790 (= mark gnus-dormant-mark)
2791 (= mark gnus-expirable-mark))))
2793 (defmacro gnus-article-mark (number)
2794 "Return the MARK of article NUMBER.
2795 This macro should only be used when computing the mark the \"first\"
2796 time; i.e., when generating the summary lines. After that,
2797 `gnus-summary-article-mark' should be used to examine the
2800 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2801 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2802 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2803 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2804 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2805 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2806 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2807 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2808 gnus-ancient-mark))))
2810 ;; Saving hidden threads.
2812 (defmacro gnus-save-hidden-threads (&rest forms)
2813 "Save hidden threads, eval FORMS, and restore the hidden threads."
2814 (let ((config (make-symbol "config")))
2815 `(let ((,config (gnus-hidden-threads-configuration)))
2819 (gnus-restore-hidden-threads-configuration ,config)))))
2820 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2821 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2823 (defun gnus-data-compute-positions ()
2824 "Compute the positions of all articles."
2825 (setq gnus-newsgroup-data-reverse nil)
2826 (let ((data gnus-newsgroup-data))
2828 (gnus-save-hidden-threads
2829 (gnus-summary-show-all-threads)
2830 (goto-char (point-min))
2832 (while (get-text-property (point) 'gnus-intangible)
2834 (gnus-data-set-pos (car data) (+ (point) 3))
2835 (setq data (cdr data))
2836 (forward-line 1))))))
2838 (defun gnus-hidden-threads-configuration ()
2839 "Return the current hidden threads configuration."
2842 (goto-char (point-min))
2843 (while (search-forward "\r" nil t)
2844 (push (1- (point)) config))
2847 (defun gnus-restore-hidden-threads-configuration (config)
2848 "Restore hidden threads configuration from CONFIG."
2850 (let (point buffer-read-only)
2851 (while (setq point (pop config))
2852 (when (and (< point (point-max))
2854 (eq (char-after) ?\n))
2855 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2857 ;; Various summary mode internalish functions.
2859 (defun gnus-mouse-pick-article (e)
2862 (gnus-summary-next-page nil t))
2864 (defun gnus-summary-set-display-table ()
2865 "Change the display table.
2866 Odd characters have a tendency to mess
2867 up nicely formatted displays - we make all possible glyphs
2868 display only a single character."
2870 ;; We start from the standard display table, if any.
2871 (let ((table (or (copy-sequence standard-display-table)
2872 (make-display-table)))
2874 ;; Nix out all the control chars...
2875 (while (>= (setq i (1- i)) 0)
2876 (aset table i [??]))
2877 ;; ... but not newline and cr, of course. (cr is necessary for the
2878 ;; selective display).
2879 (aset table ?\n nil)
2880 (aset table ?\r nil)
2881 ;; We keep TAB as well.
2882 (aset table ?\t nil)
2883 ;; We nix out any glyphs over 126 that are not set already.
2885 (while (>= (setq i (1- i)) 127)
2886 ;; Only modify if the entry is nil.
2887 (unless (aref table i)
2888 (aset table i [??]))))
2889 (setq buffer-display-table table)))
2891 (defun gnus-summary-set-article-display-arrow (pos)
2892 "Update the overlay arrow to point to line at position POS."
2893 (when (and gnus-summary-display-arrow
2894 (boundp 'overlay-arrow-position)
2895 (boundp 'overlay-arrow-string))
2899 (unless overlay-arrow-position
2900 (setq overlay-arrow-position (make-marker)))
2901 (setq overlay-arrow-string "=>"
2902 overlay-arrow-position (set-marker overlay-arrow-position
2904 (current-buffer))))))
2906 (defun gnus-summary-buffer-name (group)
2907 "Return the summary buffer name of GROUP."
2908 (concat "*Summary " (gnus-group-decoded-name group) "*"))
2910 (defun gnus-summary-setup-buffer (group)
2911 "Initialize summary buffer."
2912 (let ((buffer (gnus-summary-buffer-name group))
2913 (dead-name (concat "*Dead Summary "
2914 (gnus-group-decoded-name group) "*")))
2915 ;; If a dead summary buffer exists, we kill it.
2916 (when (gnus-buffer-live-p dead-name)
2917 (gnus-kill-buffer dead-name))
2918 (if (get-buffer buffer)
2921 (setq gnus-summary-buffer (current-buffer))
2922 (not gnus-newsgroup-prepared))
2923 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2924 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2925 (gnus-summary-mode group)
2927 (gnus-carpal-setup-buffer 'summary))
2928 (unless gnus-single-article-buffer
2929 (make-local-variable 'gnus-article-buffer)
2930 (make-local-variable 'gnus-article-current)
2931 (make-local-variable 'gnus-original-article-buffer))
2932 (setq gnus-newsgroup-name group)
2933 ;; Set any local variables in the group parameters.
2934 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2937 (defun gnus-set-global-variables ()
2938 "Set the global equivalents of the buffer-local variables.
2939 They are set to the latest values they had. These reflect the summary
2940 buffer that was in action when the last article was fetched."
2941 (when (eq major-mode 'gnus-summary-mode)
2942 (setq gnus-summary-buffer (current-buffer))
2943 (let ((name gnus-newsgroup-name)
2944 (marked gnus-newsgroup-marked)
2945 (unread gnus-newsgroup-unreads)
2946 (headers gnus-current-headers)
2947 (data gnus-newsgroup-data)
2948 (summary gnus-summary-buffer)
2949 (article-buffer gnus-article-buffer)
2950 (original gnus-original-article-buffer)
2951 (gac gnus-article-current)
2952 (reffed gnus-reffed-article-number)
2953 (score-file gnus-current-score-file)
2954 (default-charset gnus-newsgroup-charset)
2956 (let ((locals gnus-newsgroup-variables))
2958 (if (consp (car locals))
2959 (push (eval (caar locals)) vlist)
2960 (push (eval (car locals)) vlist))
2961 (setq locals (cdr locals)))
2962 (setq vlist (nreverse vlist)))
2964 (set-buffer gnus-group-buffer)
2965 (setq gnus-newsgroup-name name
2966 gnus-newsgroup-marked marked
2967 gnus-newsgroup-unreads unread
2968 gnus-current-headers headers
2969 gnus-newsgroup-data data
2970 gnus-article-current gac
2971 gnus-summary-buffer summary
2972 gnus-article-buffer article-buffer
2973 gnus-original-article-buffer original
2974 gnus-reffed-article-number reffed
2975 gnus-current-score-file score-file
2976 gnus-newsgroup-charset default-charset)
2977 (let ((locals gnus-newsgroup-variables))
2979 (if (consp (car locals))
2980 (set (caar locals) (pop vlist))
2981 (set (car locals) (pop vlist)))
2982 (setq locals (cdr locals))))
2983 ;; The article buffer also has local variables.
2984 (when (gnus-buffer-live-p gnus-article-buffer)
2985 (set-buffer gnus-article-buffer)
2986 (setq gnus-summary-buffer summary))))))
2988 (defun gnus-summary-article-unread-p (article)
2989 "Say whether ARTICLE is unread or not."
2990 (memq article gnus-newsgroup-unreads))
2992 (defun gnus-summary-first-article-p (&optional article)
2993 "Return whether ARTICLE is the first article in the buffer."
2994 (if (not (setq article (or article (gnus-summary-article-number))))
2996 (eq article (caar gnus-newsgroup-data))))
2998 (defun gnus-summary-last-article-p (&optional article)
2999 "Return whether ARTICLE is the last article in the buffer."
3000 (if (not (setq article (or article (gnus-summary-article-number))))
3001 ;; All non-existent numbers are the last article. :-)
3003 (not (cdr (gnus-data-find-list article)))))
3005 (defun gnus-make-thread-indent-array ()
3007 (unless (and gnus-thread-indent-array
3008 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3009 (setq gnus-thread-indent-array (make-vector 201 "")
3010 gnus-thread-indent-array-level gnus-thread-indent-level)
3012 (aset gnus-thread-indent-array n
3013 (make-string (* n gnus-thread-indent-level) ? ))
3016 (defun gnus-update-summary-mark-positions ()
3017 "Compute where the summary marks are to go."
3019 (when (gnus-buffer-exists-p gnus-summary-buffer)
3020 (set-buffer gnus-summary-buffer))
3021 (let ((gnus-replied-mark 129)
3022 (gnus-score-below-mark 130)
3023 (gnus-score-over-mark 130)
3024 (gnus-download-mark 131)
3025 (spec gnus-summary-line-format-spec)
3028 (gnus-set-work-buffer)
3029 (let ((gnus-summary-line-format-spec spec)
3030 (gnus-newsgroup-downloadable '((0 . t))))
3031 (gnus-summary-insert-line
3032 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3033 0 nil 128 t nil "" nil 1)
3034 (goto-char (point-min))
3035 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3036 (- (point) (point-min) 1)))))
3037 (goto-char (point-min))
3038 (push (cons 'replied (and (search-forward "\201" nil t)
3039 (- (point) (point-min) 1)))
3041 (goto-char (point-min))
3042 (push (cons 'score (and (search-forward "\202" nil t)
3043 (- (point) (point-min) 1)))
3045 (goto-char (point-min))
3046 (push (cons 'download
3047 (and (search-forward "\203" nil t)
3048 (- (point) (point-min) 1)))
3050 (setq gnus-summary-mark-positions pos))))
3052 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3053 "Insert a dummy root in the summary buffer."
3055 (gnus-add-text-properties
3056 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3057 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3059 (defun gnus-summary-extract-address-component (from)
3060 (or (car (funcall gnus-extract-address-components from))
3063 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3064 (let ((mail-parse-charset gnus-newsgroup-charset)
3065 ; Is it really necessary to do this next part for each summary line?
3066 ; Luckily, doesn't seem to slow things down much.
3067 (mail-parse-ignored-charsets
3068 (save-excursion (set-buffer gnus-summary-buffer)
3069 gnus-newsgroup-ignored-charsets)))
3071 (and gnus-ignored-from-addresses
3072 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3073 (let ((extra-headers (mail-header-extra header))
3077 ((setq to (cdr (assq 'To extra-headers)))
3080 (gnus-summary-extract-address-component
3081 (funcall gnus-decode-encoded-word-function to)))))
3082 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3083 (concat "=> " newsgroups)))))
3084 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3086 (defun gnus-summary-insert-line (gnus-tmp-header
3087 gnus-tmp-level gnus-tmp-current
3088 gnus-tmp-unread gnus-tmp-replied
3089 gnus-tmp-expirable gnus-tmp-subject-or-nil
3090 &optional gnus-tmp-dummy gnus-tmp-score
3092 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3093 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3094 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3095 (gnus-tmp-score-char
3096 (if (or (null gnus-summary-default-score)
3097 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3098 gnus-summary-zcore-fuzz))
3100 (if (< gnus-tmp-score gnus-summary-default-score)
3101 gnus-score-below-mark gnus-score-over-mark)))
3102 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3104 (cond (gnus-tmp-process gnus-process-mark)
3105 ((memq gnus-tmp-current gnus-newsgroup-cached)
3107 (gnus-tmp-replied gnus-replied-mark)
3108 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3109 gnus-forwarded-mark)
3110 ((memq gnus-tmp-current gnus-newsgroup-saved)
3112 ((memq gnus-tmp-number gnus-newsgroup-recent)
3114 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3117 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3120 ((string-match "<[^>]+> *$" gnus-tmp-from)
3121 (let ((beg (match-beginning 0)))
3122 (or (and (string-match "^\".+\"" gnus-tmp-from)
3123 (substring gnus-tmp-from 1 (1- (match-end 0))))
3124 (substring gnus-tmp-from 0 beg))))
3125 ((string-match "(.+)" gnus-tmp-from)
3126 (substring gnus-tmp-from
3127 (1+ (match-beginning 0)) (1- (match-end 0))))
3129 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3130 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3131 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3132 (buffer-read-only nil))
3133 (when (string= gnus-tmp-name "")
3134 (setq gnus-tmp-name gnus-tmp-from))
3135 (unless (numberp gnus-tmp-lines)
3136 (setq gnus-tmp-lines -1))
3137 (if (= gnus-tmp-lines -1)
3138 (setq gnus-tmp-lines "?")
3139 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3140 (gnus-put-text-property
3142 (progn (eval gnus-summary-line-format-spec) (point))
3143 'gnus-number gnus-tmp-number)
3144 (when (gnus-visual-p 'summary-highlight 'highlight)
3146 (gnus-run-hooks 'gnus-summary-update-hook)
3149 (defun gnus-summary-update-line (&optional dont-update)
3150 "Update summary line after change."
3151 (when (and gnus-summary-default-score
3152 (not gnus-summary-inhibit-highlight))
3153 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3154 (article (gnus-summary-article-number))
3155 (score (gnus-summary-article-score article)))
3157 (if (and gnus-summary-mark-below
3158 (< (gnus-summary-article-score)
3159 gnus-summary-mark-below))
3160 ;; This article has a low score, so we mark it as read.
3161 (when (memq article gnus-newsgroup-unreads)
3162 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3163 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3164 ;; This article was previously marked as read on account
3165 ;; of a low score, but now it has risen, so we mark it as
3167 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3168 (gnus-summary-update-mark
3169 (if (or (null gnus-summary-default-score)
3170 (<= (abs (- score gnus-summary-default-score))
3171 gnus-summary-zcore-fuzz))
3173 (if (< score gnus-summary-default-score)
3174 gnus-score-below-mark gnus-score-over-mark))
3176 ;; Do visual highlighting.
3177 (when (gnus-visual-p 'summary-highlight 'highlight)
3178 (gnus-run-hooks 'gnus-summary-update-hook)))))
3180 (defvar gnus-tmp-new-adopts nil)
3182 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3183 "Return the number of articles in THREAD.
3184 This may be 0 in some cases -- if none of the articles in
3185 the thread are to be displayed."
3187 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3189 ((not (listp thread))
3191 ((and (consp thread) (cdr thread))
3194 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3197 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3200 (when (and level (zerop level) gnus-tmp-new-adopts)
3203 'gnus-summary-number-of-articles-in-thread
3204 gnus-tmp-new-adopts))))
3206 (if (> number 1) gnus-not-empty-thread-mark
3207 gnus-empty-thread-mark)
3210 (defun gnus-summary-set-local-parameters (group)
3211 "Go through the local params of GROUP and set all variable specs in that list."
3212 (let ((params (gnus-group-find-parameter group))
3213 (vars '(quit-config)) ; Ignore quit-config.
3216 (setq elem (car params)
3217 params (cdr params))
3218 (and (consp elem) ; Has to be a cons.
3219 (consp (cdr elem)) ; The cdr has to be a list.
3220 (symbolp (car elem)) ; Has to be a symbol in there.
3221 (not (memq (car elem) vars))
3222 (ignore-errors ; So we set it.
3223 (push (car elem) vars)
3224 (make-local-variable (car elem))
3225 (set (car elem) (eval (nth 1 elem))))))))
3227 (defun gnus-summary-read-group (group &optional show-all no-article
3228 kill-buffer no-display backward
3230 "Start reading news in newsgroup GROUP.
3231 If SHOW-ALL is non-nil, already read articles are also listed.
3232 If NO-ARTICLE is non-nil, no article is selected initially.
3233 If NO-DISPLAY, don't generate a summary buffer."
3237 (let ((gnus-auto-select-next nil))
3238 (or (gnus-summary-read-group-1
3239 group show-all no-article
3240 kill-buffer no-display
3243 select-articles nil)))))
3244 (eq gnus-auto-select-next 'quietly))
3245 (set-buffer gnus-group-buffer)
3246 ;; The entry function called above goes to the next
3247 ;; group automatically, so we go two groups back
3248 ;; if we are searching for the previous group.
3250 (gnus-group-prev-unread-group 2))
3251 (if (not (equal group (gnus-group-group-name)))
3252 (setq group (gnus-group-group-name))
3256 (defun gnus-summary-read-group-1 (group show-all no-article
3257 kill-buffer no-display
3258 &optional select-articles)
3259 ;; Killed foreign groups can't be entered.
3260 ;; (when (and (not (gnus-group-native-p group))
3261 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3262 ;; (error "Dead non-native groups can't be entered"))
3263 (gnus-message 5 "Retrieving newsgroup: %s..."
3264 (gnus-group-decoded-name group))
3265 (let* ((new-group (gnus-summary-setup-buffer group))
3266 (quit-config (gnus-group-quit-config group))
3267 (did-select (and new-group (gnus-select-newsgroup
3268 group show-all select-articles))))
3270 ;; This summary buffer exists already, so we just select it.
3272 (gnus-set-global-variables)
3274 (gnus-kill-or-deaden-summary kill-buffer))
3275 (gnus-configure-windows 'summary 'force)
3276 (gnus-set-mode-line 'summary)
3277 (gnus-summary-position-point)
3280 ;; We couldn't select this group.
3282 (when (and (eq major-mode 'gnus-summary-mode)
3283 (not (equal (current-buffer) kill-buffer)))
3284 (kill-buffer (current-buffer))
3285 (if (not quit-config)
3287 ;; Update the info -- marks might need to be removed,
3289 (gnus-summary-update-info)
3290 (set-buffer gnus-group-buffer)
3291 (gnus-group-jump-to-group group)
3292 (gnus-group-next-unread-group 1))
3293 (gnus-handle-ephemeral-exit quit-config)))
3294 (let ((grpinfo (gnus-get-info group)))
3295 (if (null (gnus-info-read grpinfo))
3296 (gnus-message 3 "Group %s contains no messages"
3297 (gnus-group-decoded-name group))
3298 (gnus-message 3 "Can't select group")))
3300 ;; The user did a `C-g' while prompting for number of articles,
3301 ;; so we exit this group.
3302 ((eq did-select 'quit)
3303 (and (eq major-mode 'gnus-summary-mode)
3304 (not (equal (current-buffer) kill-buffer))
3305 (kill-buffer (current-buffer)))
3307 (gnus-kill-or-deaden-summary kill-buffer))
3308 (if (not quit-config)
3310 (set-buffer gnus-group-buffer)
3311 (gnus-group-jump-to-group group)
3312 (gnus-group-next-unread-group 1)
3313 (gnus-configure-windows 'group 'force))
3314 (gnus-handle-ephemeral-exit quit-config))
3315 ;; Finally signal the quit.
3317 ;; The group was successfully selected.
3319 (gnus-set-global-variables)
3320 ;; Save the active value in effect when the group was entered.
3321 (setq gnus-newsgroup-active
3323 (gnus-active gnus-newsgroup-name)))
3324 ;; You can change the summary buffer in some way with this hook.
3325 (gnus-run-hooks 'gnus-select-group-hook)
3326 (gnus-update-format-specifications
3327 nil 'summary 'summary-mode 'summary-dummy)
3328 (gnus-update-summary-mark-positions)
3329 ;; Do score processing.
3330 (when gnus-use-scoring
3331 (gnus-possibly-score-headers))
3332 ;; Check whether to fill in the gaps in the threads.
3333 (when gnus-build-sparse-threads
3334 (gnus-build-sparse-threads))
3335 ;; Find the initial limit.
3336 (if gnus-show-threads
3338 (let ((gnus-newsgroup-dormant nil))
3339 (gnus-summary-initial-limit show-all))
3340 (gnus-summary-initial-limit show-all))
3341 ;; When untreaded, all articles are always shown.
3342 (setq gnus-newsgroup-limit
3344 (lambda (header) (mail-header-number header))
3345 gnus-newsgroup-headers)))
3346 ;; Generate the summary buffer.
3348 (gnus-summary-prepare))
3349 (when gnus-use-trees
3350 (gnus-tree-open group)
3351 (setq gnus-summary-highlight-line-function
3352 'gnus-tree-highlight-article))
3353 ;; If the summary buffer is empty, but there are some low-scored
3354 ;; articles or some excluded dormants, we include these in the
3356 (when (and (zerop (buffer-size))
3358 (cond (gnus-newsgroup-dormant
3359 (gnus-summary-limit-include-dormant))
3360 ((and gnus-newsgroup-scored show-all)
3361 (gnus-summary-limit-include-expunged t))))
3362 ;; Function `gnus-apply-kill-file' must be called in this hook.
3363 (gnus-run-hooks 'gnus-apply-kill-hook)
3364 (if (and (zerop (buffer-size))
3367 ;; This newsgroup is empty.
3368 (gnus-summary-catchup-and-exit nil t)
3369 (gnus-message 6 "No unread news")
3371 (gnus-kill-or-deaden-summary kill-buffer))
3372 ;; Return nil from this function.
3374 ;; Hide conversation thread subtrees. We cannot do this in
3375 ;; gnus-summary-prepare-hook since kill processing may not
3376 ;; work with hidden articles.
3377 (gnus-summary-maybe-hide-threads)
3379 (gnus-kill-or-deaden-summary kill-buffer))
3380 (gnus-summary-auto-select-subject)
3381 ;; Show first unread article if requested.
3382 (if (and (not no-article)
3384 gnus-newsgroup-unreads
3385 gnus-auto-select-first)
3387 (gnus-configure-windows 'summary)
3388 (let ((art (gnus-summary-article-number)))
3389 (unless (or (memq art gnus-newsgroup-undownloaded)
3390 (memq art gnus-newsgroup-downloadable))
3391 (gnus-summary-goto-article art))))
3392 ;; Don't select any articles.
3393 (gnus-summary-position-point)
3394 (gnus-configure-windows 'summary 'force)
3395 (gnus-set-mode-line 'summary))
3396 (when (get-buffer-window gnus-group-buffer t)
3397 ;; Gotta use windows, because recenter does weird stuff if
3398 ;; the current buffer ain't the displayed window.
3399 (let ((owin (selected-window)))
3400 (select-window (get-buffer-window gnus-group-buffer t))
3401 (when (gnus-group-goto-group group)
3403 (select-window owin)))
3404 ;; Mark this buffer as "prepared".
3405 (setq gnus-newsgroup-prepared t)
3406 (gnus-run-hooks 'gnus-summary-prepared-hook)
3409 (defun gnus-summary-auto-select-subject ()
3410 "Select the subject line on initial group entry."
3411 (goto-char (point-min))
3413 ((eq gnus-auto-select-subject 'best)
3414 (gnus-summary-best-unread-subject))
3415 ((eq gnus-auto-select-subject 'unread)
3416 (gnus-summary-first-unread-subject))
3417 ((eq gnus-auto-select-subject 'unseen)
3418 (gnus-summary-first-unseen-subject))
3419 ((eq gnus-auto-select-subject 'unseen-or-unread)
3420 (gnus-summary-first-unseen-or-unread-subject))
3421 ((eq gnus-auto-select-subject 'first)
3424 ((gnus-functionp gnus-auto-select-subject)
3425 (funcall gnus-auto-select-subject))))
3427 (defun gnus-summary-prepare ()
3428 "Generate the summary buffer."
3430 (let ((buffer-read-only nil))
3432 (setq gnus-newsgroup-data nil
3433 gnus-newsgroup-data-reverse nil)
3434 (gnus-run-hooks 'gnus-summary-generate-hook)
3435 ;; Generate the buffer, either with threads or without.
3436 (when gnus-newsgroup-headers
3437 (gnus-summary-prepare-threads
3438 (if gnus-show-threads
3439 (gnus-sort-gathered-threads
3440 (funcall gnus-summary-thread-gathering-function
3442 (gnus-cut-threads (gnus-make-threads)))))
3443 ;; Unthreaded display.
3444 (gnus-sort-articles gnus-newsgroup-headers))))
3445 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3446 ;; Call hooks for modifying summary buffer.
3447 (goto-char (point-min))
3448 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3450 (defsubst gnus-general-simplify-subject (subject)
3451 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3454 ;; Truncate the subject.
3455 (gnus-simplify-subject-functions
3456 (gnus-map-function gnus-simplify-subject-functions subject))
3457 ((numberp gnus-summary-gather-subject-limit)
3458 (setq subject (gnus-simplify-subject-re subject))
3459 (if (> (length subject) gnus-summary-gather-subject-limit)
3460 (substring subject 0 gnus-summary-gather-subject-limit)
3462 ;; Fuzzily simplify it.
3463 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3464 (gnus-simplify-subject-fuzzy subject))
3465 ;; Just remove the leading "Re:".
3467 (gnus-simplify-subject-re subject))))
3469 (if (and gnus-summary-gather-exclude-subject
3470 (string-match gnus-summary-gather-exclude-subject subject))
3471 nil ; This article shouldn't be gathered
3474 (defun gnus-summary-simplify-subject-query ()
3475 "Query where the respool algorithm would put this article."
3477 (gnus-summary-select-article)
3478 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3480 (defun gnus-gather-threads-by-subject (threads)
3481 "Gather threads by looking at Subject headers."
3482 (if (not gnus-summary-make-false-root)
3484 (let ((hashtb (gnus-make-hashtable 1024))
3487 subject hthread whole-subject)
3489 (setq subject (gnus-general-simplify-subject
3490 (setq whole-subject (mail-header-subject
3493 (if (setq hthread (gnus-gethash subject hashtb))
3495 ;; We enter a dummy root into the thread, if we
3496 ;; haven't done that already.
3497 (unless (stringp (caar hthread))
3498 (setcar hthread (list whole-subject (car hthread))))
3499 ;; We add this new gathered thread to this gathered
3501 (setcdr (car hthread)
3502 (nconc (cdar hthread) (list (car threads))))
3503 ;; Remove it from the list of threads.
3504 (setcdr prev (cdr threads))
3505 (setq threads prev))
3506 ;; Enter this thread into the hash table.
3507 (gnus-sethash subject threads hashtb)))
3509 (setq threads (cdr threads)))
3512 (defun gnus-gather-threads-by-references (threads)
3513 "Gather threads by looking at References headers."
3514 (let ((idhashtb (gnus-make-hashtable 1024))
3515 (thhashtb (gnus-make-hashtable 1024))
3518 ids references id gthread gid entered ref)
3520 (when (setq references (mail-header-references (caar threads)))
3521 (setq id (mail-header-id (caar threads))
3522 ids (inline (gnus-split-references references))
3524 (while (setq ref (pop ids))
3525 (setq ids (delete ref ids))
3526 (if (not (setq gid (gnus-gethash ref idhashtb)))
3528 (gnus-sethash ref id idhashtb)
3529 (gnus-sethash id threads thhashtb))
3530 (setq gthread (gnus-gethash gid thhashtb))
3532 ;; We enter a dummy root into the thread, if we
3533 ;; haven't done that already.
3534 (unless (stringp (caar gthread))
3535 (setcar gthread (list (mail-header-subject (caar gthread))
3537 ;; We add this new gathered thread to this gathered
3539 (setcdr (car gthread)
3540 (nconc (cdar gthread) (list (car threads)))))
3541 ;; Add it into the thread hash table.
3542 (gnus-sethash id gthread thhashtb)
3544 ;; Remove it from the list of threads.
3545 (setcdr prev (cdr threads))
3546 (setq threads prev))))
3548 (setq threads (cdr threads)))
3551 (defun gnus-sort-gathered-threads (threads)
3552 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3553 (let ((result threads))
3555 (when (stringp (caar threads))
3556 (setcdr (car threads)
3557 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3558 (setq threads (cdr threads)))
3561 (defun gnus-thread-loop-p (root thread)
3562 "Say whether ROOT is in THREAD."
3563 (let ((stack (list thread))
3566 (while (setq thread (pop stack))
3567 (setq th (cdr thread))
3569 (not (eq (caar th) root)))
3572 ;; We have found a loop.
3574 (setcdr thread (delq (car th) (cdr thread)))
3575 (if (boundp (setq ref-dep (intern "none"
3576 gnus-newsgroup-dependencies)))
3577 (setcdr (symbol-value ref-dep)
3578 (nconc (cdr (symbol-value ref-dep))
3580 (set ref-dep (list nil (car th))))
3583 ;; Push all the subthreads onto the stack.
3584 (push (cdr thread) stack)))
3587 (defun gnus-make-threads ()
3588 "Go through the dependency hashtb and find the roots. Return all threads."
3590 (while (catch 'infloop
3593 ;; Deal with self-referencing References loops.
3594 (when (and (car (symbol-value refs))
3601 (car (symbol-value refs)) thread))
3602 (cdr (symbol-value refs)))))))
3605 (unless (car (symbol-value refs))
3606 ;; These threads do not refer back to any other
3607 ;; articles, so they're roots.
3608 (setq threads (append (cdr (symbol-value refs)) threads))))
3609 gnus-newsgroup-dependencies)))
3612 ;; Build the thread tree.
3613 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3614 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3616 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3617 if it was already present.
3619 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3620 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3621 Message-IDs will be renamed to a unique Message-ID before being
3624 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3625 (let* ((id (mail-header-id header))
3626 (id-dep (and id (intern id dependencies)))
3627 ref ref-dep ref-header replaced)
3628 ;; Enter this `header' in the `dependencies' table.
3632 ;; The first two cases do the normal part: enter a new `header'
3633 ;; in the `dependencies' table.
3634 ((not (boundp id-dep))
3635 (set id-dep (list header)))
3636 ((null (car (symbol-value id-dep)))
3637 (setcar (symbol-value id-dep) header))
3639 ;; From here the `header' was already present in the
3640 ;; `dependencies' table.
3642 ;; Overrides an existing entry;
3643 ;; just set the header part of the entry.
3644 (setcar (symbol-value id-dep) header)
3647 ;; Renames the existing `header' to a unique Message-ID.
3648 ((not gnus-summary-ignore-duplicates)
3649 ;; An article with this Message-ID has already been seen.
3650 ;; We rename the Message-ID.
3651 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3653 (mail-header-set-id header id))
3655 ;; The last case ignores an existing entry, except it adds any
3656 ;; additional Xrefs (in case the two articles came from different
3658 ;; Also sets `header' to `nil' meaning that the `dependencies'
3659 ;; table was *not* modified.
3661 (mail-header-set-xref
3662 (car (symbol-value id-dep))
3663 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3665 (or (mail-header-xref header) "")))
3668 (when (and header (not replaced))
3669 ;; First check that we are not creating a References loop.
3670 (setq ref (gnus-parent-id (mail-header-references header)))
3672 (setq ref-dep (intern-soft ref dependencies))
3674 (setq ref-header (car (symbol-value ref-dep))))
3675 (if (string= id ref)
3676 ;; Yuk! This is a reference loop. Make the article be a
3679 (mail-header-set-references (car (symbol-value id-dep)) "none")
3681 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3682 (setq ref (gnus-parent-id (mail-header-references header)))
3683 (setq ref-dep (intern (or ref "none") dependencies))
3684 (if (boundp ref-dep)
3685 (setcdr (symbol-value ref-dep)
3686 (nconc (cdr (symbol-value ref-dep))
3687 (list (symbol-value id-dep))))
3688 (set ref-dep (list nil (symbol-value id-dep)))))
3691 (defun gnus-extract-message-id-from-in-reply-to (string)
3692 (if (string-match "<[^>]+>" string)
3693 (substring string (match-beginning 0) (match-end 0))
3696 (defun gnus-build-sparse-threads ()
3697 (let ((headers gnus-newsgroup-headers)
3698 (mail-parse-charset gnus-newsgroup-charset)
3699 (gnus-summary-ignore-duplicates t)
3700 header references generation relations
3701 subject child end new-child date)
3702 ;; First we create an alist of generations/relations, where
3703 ;; generations is how much we trust the relation, and the relation
3705 (gnus-message 7 "Making sparse threads...")
3707 (nnheader-set-temp-buffer " *gnus sparse threads*")
3708 (while (setq header (pop headers))
3709 (when (and (setq references (mail-header-references header))
3710 (not (string= references "")))
3712 (setq child (mail-header-id header)
3713 subject (mail-header-subject header)
3714 date (mail-header-date header)
3716 (while (search-backward ">" nil t)
3717 (setq end (1+ (point)))
3718 (when (search-backward "<" nil t)
3719 (setq new-child (buffer-substring (point) end))
3720 (push (list (incf generation)
3721 child (setq child new-child)
3725 (push (list (1+ generation) child nil subject) relations))
3727 (kill-buffer (current-buffer)))
3728 ;; Sort over trustworthiness.
3731 (when (gnus-dependencies-add-header
3732 (make-full-mail-header
3733 gnus-reffed-article-number
3734 (nth 3 relation) "" (or (nth 4 relation) "")
3736 (or (nth 2 relation) "") 0 0 "")
3737 gnus-newsgroup-dependencies nil)
3738 (push gnus-reffed-article-number gnus-newsgroup-limit)
3739 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3740 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3741 gnus-newsgroup-reads)
3742 (decf gnus-reffed-article-number)))
3743 (sort relations 'car-less-than-car))
3744 (gnus-message 7 "Making sparse threads...done")))
3746 (defun gnus-build-old-threads ()
3747 ;; Look at all the articles that refer back to old articles, and
3748 ;; fetch the headers for the articles that aren't there. This will
3749 ;; build complete threads - if the roots haven't been expired by the
3751 (let ((mail-parse-charset gnus-newsgroup-charset)
3755 (when (not (car (symbol-value refs)))
3756 (setq heads (cdr (symbol-value refs)))
3758 (if (memq (mail-header-number (caar heads))
3759 gnus-newsgroup-dormant)
3760 (setq heads (cdr heads))
3761 (setq id (symbol-name refs))
3762 (while (and (setq id (gnus-build-get-header id))
3763 (not (car (gnus-id-to-thread id)))))
3764 (setq heads nil)))))
3765 gnus-newsgroup-dependencies)))
3767 ;; This function has to be called with point after the article number
3768 ;; on the beginning of the line.
3769 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3770 (let ((eol (gnus-point-at-eol))
3771 (buffer (current-buffer))
3772 header references in-reply-to)
3774 ;; overview: [num subject from date id refs chars lines misc]
3777 (narrow-to-region (point) eol)
3782 (make-full-mail-header
3784 (funcall gnus-decode-encoded-word-function
3785 (nnheader-nov-field)) ; subject
3786 (funcall gnus-decode-encoded-word-function
3787 (nnheader-nov-field)) ; from
3788 (nnheader-nov-field) ; date
3789 (nnheader-nov-read-message-id) ; id
3790 (setq references (nnheader-nov-field)) ; refs
3791 (nnheader-nov-read-integer) ; chars
3792 (nnheader-nov-read-integer) ; lines
3794 (if (looking-at "Xref: ")
3795 (goto-char (match-end 0)))
3796 (nnheader-nov-field)) ; Xref
3797 (nnheader-nov-parse-extra)))) ; extra
3801 (when (and (string= references "")
3802 (setq in-reply-to (mail-header-extra header))
3803 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
3804 (mail-header-set-references
3805 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
3807 (when gnus-alter-header-function
3808 (funcall gnus-alter-header-function header))
3809 (gnus-dependencies-add-header header dependencies force-new)))
3811 (defun gnus-build-get-header (id)
3812 "Look through the buffer of NOV lines and find the header to ID.
3813 Enter this line into the dependencies hash table, and return
3814 the id of the parent article (if any)."
3815 (let ((deps gnus-newsgroup-dependencies)
3819 (set-buffer nntp-server-buffer)
3820 (let ((case-fold-search nil))
3821 (goto-char (point-min))
3822 (while (and (not found)
3823 (search-forward id nil t))
3825 (setq found (looking-at
3826 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3827 (regexp-quote id))))
3828 (or found (beginning-of-line 2)))
3832 (setq header (gnus-nov-parse-line
3833 (read (current-buffer)) deps))
3834 (gnus-parent-id (mail-header-references header))))))
3836 (let ((number (mail-header-number header)))
3837 (push number gnus-newsgroup-limit)
3838 (push header gnus-newsgroup-headers)
3839 (if (memq number gnus-newsgroup-unselected)
3841 (setq gnus-newsgroup-unreads
3842 (gnus-add-to-sorted-list gnus-newsgroup-unreads
3844 (setq gnus-newsgroup-unselected
3845 (delq number gnus-newsgroup-unselected)))
3846 (push number gnus-newsgroup-ancient)))))))
3848 (defun gnus-build-all-threads ()
3849 "Read all the headers."
3850 (let ((gnus-summary-ignore-duplicates t)
3851 (mail-parse-charset gnus-newsgroup-charset)
3852 (dependencies gnus-newsgroup-dependencies)
3855 (set-buffer nntp-server-buffer)
3856 (let ((case-fold-search nil))
3857 (goto-char (point-min))
3860 (setq article (read (current-buffer))
3861 header (gnus-nov-parse-line article dependencies)))
3864 (set-buffer gnus-summary-buffer)
3865 (push header gnus-newsgroup-headers)
3866 (if (memq (setq article (mail-header-number header))
3867 gnus-newsgroup-unselected)
3869 (setq gnus-newsgroup-unreads
3870 (gnus-add-to-sorted-list
3871 gnus-newsgroup-unreads article))
3872 (setq gnus-newsgroup-unselected
3873 (delq article gnus-newsgroup-unselected)))
3874 (push article gnus-newsgroup-ancient)))
3875 (forward-line 1)))))))
3877 (defun gnus-summary-update-article-line (article header)
3878 "Update the line for ARTICLE using HEADERS."
3879 (let* ((id (mail-header-id header))
3880 (thread (gnus-id-to-thread id)))
3882 (error "Article in no thread"))
3883 ;; Update the thread.
3884 (setcar thread header)
3885 (gnus-summary-goto-subject article)
3886 (let* ((datal (gnus-data-find-list article))
3888 (length (when (cdr datal)
3889 (- (gnus-data-pos data)
3890 (gnus-data-pos (cadr datal)))))
3891 (buffer-read-only nil)
3892 (level (gnus-summary-thread-level)))
3894 (gnus-summary-insert-line
3895 header level nil (gnus-article-mark article)
3896 (memq article gnus-newsgroup-replied)
3897 (memq article gnus-newsgroup-expirable)
3898 ;; Only insert the Subject string when it's different
3899 ;; from the previous Subject string.
3904 (mail-header-subject
3907 (gnus-data-find-list
3909 (gnus-data-list t)))))
3910 ;; Error on the side of excessive subjects.
3912 (mail-header-subject header)))
3914 (mail-header-subject header))
3915 nil (cdr (assq article gnus-newsgroup-scored))
3916 (memq article gnus-newsgroup-processable))
3918 (gnus-data-update-list
3919 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3921 (defun gnus-summary-update-article (article &optional iheader)
3922 "Update ARTICLE in the summary buffer."
3923 (set-buffer gnus-summary-buffer)
3924 (let* ((header (gnus-summary-article-header article))
3925 (id (mail-header-id header))
3926 (data (gnus-data-find article))
3927 (thread (gnus-id-to-thread id))
3928 (references (mail-header-references header))
3932 (when (and references
3933 (not (equal "" references)))
3936 (buffer-read-only nil)
3942 (delq thread parent)))
3943 (if (gnus-summary-insert-subject id header)
3944 ;; Set the (possibly) new article number in the data structure.
3945 (gnus-data-set-number data (gnus-id-to-article id))
3949 (defun gnus-rebuild-thread (id &optional line)
3950 "Rebuild the thread containing ID.
3951 If LINE, insert the rebuilt thread starting on line LINE."
3952 (let ((buffer-read-only nil)
3953 old-pos current thread data)
3954 (if (not gnus-show-threads)
3955 (setq thread (list (car (gnus-id-to-thread id))))
3956 ;; Get the thread this article is part of.
3957 (setq thread (gnus-remove-thread id)))
3958 (setq old-pos (gnus-point-at-bol))
3959 (setq current (save-excursion
3960 (and (re-search-backward "[\r\n]" nil t)
3961 (gnus-summary-article-number))))
3962 ;; If this is a gathered thread, we have to go some re-gathering.
3963 (when (stringp (car thread))
3964 (let ((subject (car thread))
3966 (setq thread (cdr thread))
3968 (unless (memq (setq thr (gnus-id-to-thread
3970 (mail-header-id (caar thread)))))
3973 (setq thread (cdr thread)))
3974 ;; We now have all (unique) roots.
3975 (if (= (length roots) 1)
3976 ;; All the loose roots are now one solid root.
3977 (setq thread (car roots))
3978 (setq thread (cons subject (gnus-sort-threads roots))))))
3980 ;; We then insert this thread into the summary buffer.
3982 (goto-char (point-min))
3983 (forward-line (1- line)))
3984 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3985 (if gnus-show-threads
3986 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3987 (gnus-summary-prepare-unthreaded thread))
3988 (setq data (nreverse gnus-newsgroup-data))
3989 (setq threads gnus-newsgroup-threads))
3990 ;; We splice the new data into the data structure.
3991 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3992 ;;!!! then we want to insert at the beginning of the buffer.
3993 ;;!!! That happens to be true with Gnus now, but that may
3994 ;;!!! change in the future. Perhaps.
3995 (gnus-data-enter-list
3996 (if line nil current) data (- (point) old-pos))
3997 (setq gnus-newsgroup-threads
3998 (nconc threads gnus-newsgroup-threads))
3999 (gnus-data-compute-positions))))
4001 (defun gnus-number-to-header (number)
4002 "Return the header for article NUMBER."
4003 (let ((headers gnus-newsgroup-headers))
4005 (not (= number (mail-header-number (car headers)))))
4010 (defun gnus-parent-headers (in-headers &optional generation)
4011 "Return the headers of the GENERATIONeth parent of HEADERS."
4013 (setq generation 1))
4015 (headers in-headers)
4018 (not (zerop generation))
4019 (setq references (mail-header-references headers)))
4020 (setq headers (if (and references
4021 (setq parent (gnus-parent-id references)))
4022 (car (gnus-id-to-thread parent))
4025 (and (not (eq headers in-headers))
4028 (defun gnus-id-to-thread (id)
4029 "Return the (sub-)thread where ID appears."
4030 (gnus-gethash id gnus-newsgroup-dependencies))
4032 (defun gnus-id-to-article (id)
4033 "Return the article number of ID."
4034 (let ((thread (gnus-id-to-thread id)))
4037 (mail-header-number (car thread)))))
4039 (defun gnus-id-to-header (id)
4040 "Return the article headers of ID."
4041 (car (gnus-id-to-thread id)))
4043 (defun gnus-article-displayed-root-p (article)
4044 "Say whether ARTICLE is a root(ish) article."
4045 (let ((level (gnus-summary-thread-level article))
4046 (refs (mail-header-references (gnus-summary-article-header article)))
4052 ((null (gnus-parent-id refs)) t)
4054 (null (setq particle (gnus-id-to-article
4055 (gnus-parent-id refs))))
4056 (null (gnus-summary-thread-level particle)))))))
4058 (defun gnus-root-id (id)
4059 "Return the id of the root of the thread where ID appears."
4061 (while (and id (setq prev (car (gnus-id-to-thread id))))
4063 id (gnus-parent-id (mail-header-references prev))))
4066 (defun gnus-articles-in-thread (thread)
4067 "Return the list of articles in THREAD."
4068 (cons (mail-header-number (car thread))
4069 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4071 (defun gnus-remove-thread (id &optional dont-remove)
4072 "Remove the thread that has ID in it."
4073 (let (headers thread last-id)
4074 ;; First go up in this thread until we find the root.
4075 (setq last-id (gnus-root-id id)
4076 headers (message-flatten-list (gnus-id-to-thread last-id)))
4077 ;; We have now found the real root of this thread. It might have
4078 ;; been gathered into some loose thread, so we have to search
4079 ;; through the threads to find the thread we wanted.
4080 (let ((threads gnus-newsgroup-threads)
4083 (setq sub (car threads))
4084 (if (stringp (car sub))
4085 ;; This is a gathered thread, so we look at the roots
4086 ;; below it to find whether this article is in this
4089 (setq sub (cdr sub))
4091 (when (member (caar sub) headers)
4092 (setq thread (car threads)
4095 (setq sub (cdr sub))))
4096 ;; It's an ordinary thread, so we check it.
4097 (when (eq (car sub) (car headers))
4100 (setq threads (cdr threads)))
4101 ;; If this article is in no thread, then it's a root.
4104 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4105 (setq thread (gnus-id-to-thread last-id)))
4108 thread ; We return this thread.
4110 (if (stringp (car thread))
4112 ;; If we use dummy roots, then we have to remove the
4113 ;; dummy root as well.
4114 (when (eq gnus-summary-make-false-root 'dummy)
4115 ;; We go to the dummy root by going to
4116 ;; the first sub-"thread", and then one line up.
4117 (gnus-summary-goto-article
4118 (mail-header-number (caadr thread)))
4121 (gnus-data-compute-positions))
4122 (setq thread (cdr thread))
4124 (gnus-remove-thread-1 (car thread))
4125 (setq thread (cdr thread))))
4126 (gnus-remove-thread-1 thread))))))))
4128 (defun gnus-remove-thread-1 (thread)
4129 "Remove the thread THREAD recursively."
4130 (let ((number (mail-header-number (pop thread)))
4132 (setq thread (reverse thread))
4134 (gnus-remove-thread-1 (pop thread)))
4135 (when (setq d (gnus-data-find number))
4136 (goto-char (gnus-data-pos d))
4137 (gnus-summary-show-thread)
4140 (- (gnus-point-at-bol)
4142 (1+ (gnus-point-at-eol))
4143 (gnus-delete-line)))))))
4145 (defun gnus-sort-threads-1 (threads func)
4146 (sort (mapcar (lambda (thread)
4149 (gnus-sort-threads-1 (cdr thread) func))))
4152 (defun gnus-sort-threads (threads)
4154 (if (not gnus-thread-sort-functions)
4156 (gnus-message 8 "Sorting threads...")
4158 (gnus-sort-threads-1
4160 (gnus-make-sort-function gnus-thread-sort-functions))
4161 (gnus-message 8 "Sorting threads...done"))))
4163 (defun gnus-sort-articles (articles)
4165 (when gnus-article-sort-functions
4166 (gnus-message 7 "Sorting articles...")
4168 (setq gnus-newsgroup-headers
4169 (sort articles (gnus-make-sort-function
4170 gnus-article-sort-functions)))
4171 (gnus-message 7 "Sorting articles...done"))))
4173 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4174 (defmacro gnus-thread-header (thread)
4175 "Return header of first article in THREAD.
4176 Note that THREAD must never, ever be anything else than a variable -
4177 using some other form will lead to serious barfage."
4178 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4179 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4180 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4183 (defsubst gnus-article-sort-by-number (h1 h2)
4184 "Sort articles by article number."
4185 (< (mail-header-number h1)
4186 (mail-header-number h2)))
4188 (defun gnus-thread-sort-by-number (h1 h2)
4189 "Sort threads by root article number."
4190 (gnus-article-sort-by-number
4191 (gnus-thread-header h1) (gnus-thread-header h2)))
4193 (defsubst gnus-article-sort-by-lines (h1 h2)
4194 "Sort articles by article Lines header."
4195 (< (mail-header-lines h1)
4196 (mail-header-lines h2)))
4198 (defun gnus-thread-sort-by-lines (h1 h2)
4199 "Sort threads by root article Lines header."
4200 (gnus-article-sort-by-lines
4201 (gnus-thread-header h1) (gnus-thread-header h2)))
4203 (defsubst gnus-article-sort-by-chars (h1 h2)
4204 "Sort articles by octet length."
4205 (< (mail-header-chars h1)
4206 (mail-header-chars h2)))
4208 (defun gnus-thread-sort-by-chars (h1 h2)
4209 "Sort threads by root article octet length."
4210 (gnus-article-sort-by-chars
4211 (gnus-thread-header h1) (gnus-thread-header h2)))
4213 (defsubst gnus-article-sort-by-author (h1 h2)
4214 "Sort articles by root author."
4216 (let ((extract (funcall
4217 gnus-extract-address-components
4218 (mail-header-from h1))))
4219 (or (car extract) (cadr extract) ""))
4220 (let ((extract (funcall
4221 gnus-extract-address-components
4222 (mail-header-from h2))))
4223 (or (car extract) (cadr extract) ""))))
4225 (defun gnus-thread-sort-by-author (h1 h2)
4226 "Sort threads by root author."
4227 (gnus-article-sort-by-author
4228 (gnus-thread-header h1) (gnus-thread-header h2)))
4230 (defsubst gnus-article-sort-by-subject (h1 h2)
4231 "Sort articles by root subject."
4233 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4234 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4236 (defun gnus-thread-sort-by-subject (h1 h2)
4237 "Sort threads by root subject."
4238 (gnus-article-sort-by-subject
4239 (gnus-thread-header h1) (gnus-thread-header h2)))
4241 (defsubst gnus-article-sort-by-date (h1 h2)
4242 "Sort articles by root article date."
4244 (gnus-date-get-time (mail-header-date h1))
4245 (gnus-date-get-time (mail-header-date h2))))
4247 (defun gnus-thread-sort-by-date (h1 h2)
4248 "Sort threads by root article date."
4249 (gnus-article-sort-by-date
4250 (gnus-thread-header h1) (gnus-thread-header h2)))
4252 (defsubst gnus-article-sort-by-score (h1 h2)
4253 "Sort articles by root article score.
4254 Unscored articles will be counted as having a score of zero."
4255 (> (or (cdr (assq (mail-header-number h1)
4256 gnus-newsgroup-scored))
4257 gnus-summary-default-score 0)
4258 (or (cdr (assq (mail-header-number h2)
4259 gnus-newsgroup-scored))
4260 gnus-summary-default-score 0)))
4262 (defun gnus-thread-sort-by-score (h1 h2)
4263 "Sort threads by root article score."
4264 (gnus-article-sort-by-score
4265 (gnus-thread-header h1) (gnus-thread-header h2)))
4267 (defun gnus-thread-sort-by-total-score (h1 h2)
4268 "Sort threads by the sum of all scores in the thread.
4269 Unscored articles will be counted as having a score of zero."
4270 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4272 (defun gnus-thread-total-score (thread)
4273 ;; This function find the total score of THREAD.
4278 (if (stringp (car thread))
4279 (apply gnus-thread-score-function 0
4280 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4281 (gnus-thread-total-score-1 thread)))
4283 (gnus-thread-total-score-1 (list thread)))))
4285 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4286 "Sort threads such that the thread with the most recently arrived article comes first."
4287 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4289 (defun gnus-thread-highest-number (thread)
4290 "Return the highest article number in THREAD."
4291 (apply 'max (mapcar (lambda (header)
4292 (mail-header-number header))
4293 (message-flatten-list thread))))
4295 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4296 "Sort threads such that the thread with the most recently dated article comes first."
4297 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4299 (defun gnus-thread-latest-date (thread)
4300 "Return the highest article date in THREAD."
4301 (let ((previous-time 0))
4306 (mail-header-parse-date
4308 (mail-header-date header)
4309 (error previous-time))))))
4311 (message-flatten-list thread)
4313 (< (mail-header-number h1)
4314 (mail-header-number h2))))))))
4316 (defun gnus-thread-total-score-1 (root)
4317 ;; This function find the total score of the thread below ROOT.
4318 (setq root (car root))
4319 (apply gnus-thread-score-function
4321 (mapcar 'gnus-thread-total-score
4322 (cdr (gnus-id-to-thread (mail-header-id root))))
4323 (when (> (mail-header-number root) 0)
4324 (list (or (cdr (assq (mail-header-number root)
4325 gnus-newsgroup-scored))
4326 gnus-summary-default-score 0))))
4327 (list gnus-summary-default-score)
4330 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4331 (defvar gnus-tmp-prev-subject nil)
4332 (defvar gnus-tmp-false-parent nil)
4333 (defvar gnus-tmp-root-expunged nil)
4334 (defvar gnus-tmp-dummy-line nil)
4336 (eval-when-compile (defvar gnus-tmp-header))
4337 (defun gnus-extra-header (type &optional header)
4338 "Return the extra header of TYPE."
4339 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4342 (defvar gnus-tmp-thread-tree-header-string "")
4344 (defcustom gnus-sum-thread-tree-root "> "
4345 "With %B spec, used for the root of a thread.
4346 If nil, use subject instead."
4348 :group 'gnus-thread)
4349 (defcustom gnus-sum-thread-tree-single-indent ""
4350 "With %B spec, used for a thread with just one message.
4351 If nil, use subject instead."
4353 :group 'gnus-thread)
4354 (defcustom gnus-sum-thread-tree-vertical "| "
4355 "With %B spec, used for drawing a vertical line."
4357 :group 'gnus-thread)
4358 (defcustom gnus-sum-thread-tree-indent " "
4359 "With %B spec, used for indenting."
4361 :group 'gnus-thread)
4362 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4363 "With %B spec, used for a leaf with brothers."
4365 :group 'gnus-thread)
4366 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4367 "With %B spec, used for a leaf without brothers."
4369 :group 'gnus-thread)
4371 (defun gnus-summary-prepare-threads (threads)
4372 "Prepare summary buffer from THREADS and indentation LEVEL.
4373 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4374 or a straight list of headers."
4375 (gnus-message 7 "Generating summary...")
4377 (setq gnus-newsgroup-threads threads)
4380 (let ((gnus-tmp-level 0)
4381 (default-score (or gnus-summary-default-score 0))
4382 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4383 thread number subject stack state gnus-tmp-gathered beg-match
4384 new-roots gnus-tmp-new-adopts thread-end
4385 gnus-tmp-header gnus-tmp-unread
4386 gnus-tmp-replied gnus-tmp-subject-or-nil
4387 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4388 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4389 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4392 (setq gnus-tmp-prev-subject nil)
4394 (if (vectorp (car threads))
4395 ;; If this is a straight (sic) list of headers, then a
4396 ;; threaded summary display isn't required, so we just create
4397 ;; an unthreaded one.
4398 (gnus-summary-prepare-unthreaded threads)
4400 ;; Do the threaded display.
4402 (while (or threads stack gnus-tmp-new-adopts new-roots)
4404 (if (and (= gnus-tmp-level 0)
4407 (not gnus-tmp-false-parent)
4408 (or gnus-tmp-new-adopts new-roots))
4409 (if gnus-tmp-new-adopts
4410 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4411 thread (list (car gnus-tmp-new-adopts))
4412 gnus-tmp-header (caar thread)
4413 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4415 (setq thread (list (car new-roots))
4416 gnus-tmp-header (caar thread)
4417 new-roots (cdr new-roots))))
4420 ;; If there are some threads, we do them before the
4421 ;; threads on the stack.
4422 (setq thread threads
4423 gnus-tmp-header (caar thread))
4424 ;; There were no current threads, so we pop something off
4426 (setq state (car stack)
4427 gnus-tmp-level (car state)
4428 tree-stack (cadr state)
4429 thread (caddr state)
4431 gnus-tmp-header (caar thread))))
4433 (setq gnus-tmp-false-parent nil)
4434 (setq gnus-tmp-root-expunged nil)
4435 (setq thread-end nil)
4437 (if (stringp gnus-tmp-header)
4438 ;; The header is a dummy root.
4440 ((eq gnus-summary-make-false-root 'adopt)
4441 ;; We let the first article adopt the rest.
4442 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4444 (setq gnus-tmp-gathered
4446 (lambda (h) (mail-header-number (car h)))
4449 (setq thread (cons (list (caar thread)
4452 (setq gnus-tmp-level -1
4453 gnus-tmp-false-parent t))
4454 ((eq gnus-summary-make-false-root 'empty)
4455 ;; We print adopted articles with empty subject fields.
4456 (setq gnus-tmp-gathered
4458 (lambda (h) (mail-header-number (car h)))
4461 (setq gnus-tmp-level -1))
4462 ((eq gnus-summary-make-false-root 'dummy)
4463 ;; We remember that we probably want to output a dummy
4465 (setq gnus-tmp-dummy-line gnus-tmp-header)
4466 (setq gnus-tmp-prev-subject gnus-tmp-header))
4468 ;; We do not make a root for the gathered
4469 ;; sub-threads at all.
4470 (setq gnus-tmp-level -1)))
4472 (setq number (mail-header-number gnus-tmp-header)
4473 subject (mail-header-subject gnus-tmp-header))
4476 ;; If the thread has changed subject, we might want to make
4477 ;; this subthread into a root.
4478 ((and (null gnus-thread-ignore-subject)
4479 (not (zerop gnus-tmp-level))
4480 gnus-tmp-prev-subject
4482 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4483 (setq new-roots (nconc new-roots (list (car thread)))
4485 gnus-tmp-header nil))
4486 ;; If the article lies outside the current limit,
4487 ;; then we do not display it.
4488 ((not (memq number gnus-newsgroup-limit))
4489 (setq gnus-tmp-gathered
4491 (lambda (h) (mail-header-number (car h)))
4494 (setq gnus-tmp-new-adopts (if (cdar thread)
4495 (append gnus-tmp-new-adopts
4497 gnus-tmp-new-adopts)
4499 gnus-tmp-header nil)
4500 (when (zerop gnus-tmp-level)
4501 (setq gnus-tmp-root-expunged t)))
4502 ;; Perhaps this article is to be marked as read?
4503 ((and gnus-summary-mark-below
4504 (< (or (cdr (assq number gnus-newsgroup-scored))
4506 gnus-summary-mark-below)
4507 ;; Don't touch sparse articles.
4508 (not (gnus-summary-article-sparse-p number))
4509 (not (gnus-summary-article-ancient-p number)))
4510 (setq gnus-newsgroup-unreads
4511 (delq number gnus-newsgroup-unreads))
4512 (if gnus-newsgroup-auto-expire
4513 (setq gnus-newsgroup-expirable
4514 (gnus-add-to-sorted-list
4515 gnus-newsgroup-expirable number))
4516 (push (cons number gnus-low-score-mark)
4517 gnus-newsgroup-reads))))
4519 (when gnus-tmp-header
4520 ;; We may have an old dummy line to output before this
4522 (when (and gnus-tmp-dummy-line
4525 (mail-header-subject gnus-tmp-header)))
4526 (gnus-summary-insert-dummy-line
4527 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4528 (setq gnus-tmp-dummy-line nil))
4530 ;; Compute the mark.
4531 (setq gnus-tmp-unread (gnus-article-mark number))
4533 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4534 gnus-tmp-header gnus-tmp-level)
4535 gnus-newsgroup-data)
4537 ;; Actually insert the line.
4539 gnus-tmp-subject-or-nil
4541 ((and gnus-thread-ignore-subject
4542 gnus-tmp-prev-subject
4543 (not (inline (gnus-subject-equal
4544 gnus-tmp-prev-subject subject))))
4546 ((zerop gnus-tmp-level)
4547 (if (and (eq gnus-summary-make-false-root 'empty)
4548 (memq number gnus-tmp-gathered)
4549 gnus-tmp-prev-subject
4550 (inline (gnus-subject-equal
4551 gnus-tmp-prev-subject subject)))
4552 gnus-summary-same-subject
4554 (t gnus-summary-same-subject)))
4555 (if (and (eq gnus-summary-make-false-root 'adopt)
4556 (= gnus-tmp-level 1)
4557 (memq number gnus-tmp-gathered))
4558 (setq gnus-tmp-opening-bracket ?\<
4559 gnus-tmp-closing-bracket ?\>)
4560 (setq gnus-tmp-opening-bracket ?\[
4561 gnus-tmp-closing-bracket ?\]))
4563 gnus-tmp-indentation
4564 (aref gnus-thread-indent-array gnus-tmp-level)
4565 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4566 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4567 gnus-summary-default-score 0)
4569 (if (or (null gnus-summary-default-score)
4570 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4571 gnus-summary-zcore-fuzz))
4573 (if (< gnus-tmp-score gnus-summary-default-score)
4574 gnus-score-below-mark gnus-score-over-mark))
4576 (cond ((memq number gnus-newsgroup-processable)
4578 ((memq number gnus-newsgroup-cached)
4580 ((memq number gnus-newsgroup-replied)
4582 ((memq number gnus-newsgroup-forwarded)
4583 gnus-forwarded-mark)
4584 ((memq number gnus-newsgroup-saved)
4586 ((memq number gnus-newsgroup-recent)
4588 ((memq number gnus-newsgroup-unseen)
4591 gnus-tmp-from (mail-header-from gnus-tmp-header)
4594 ((string-match "<[^>]+> *$" gnus-tmp-from)
4595 (setq beg-match (match-beginning 0))
4596 (or (and (string-match "^\".+\"" gnus-tmp-from)
4597 (substring gnus-tmp-from 1 (1- (match-end 0))))
4598 (substring gnus-tmp-from 0 beg-match)))
4599 ((string-match "(.+)" gnus-tmp-from)
4600 (substring gnus-tmp-from
4601 (1+ (match-beginning 0)) (1- (match-end 0))))
4603 gnus-tmp-thread-tree-header-string
4605 ((not gnus-show-threads) "")
4606 ((zerop gnus-tmp-level)
4608 (or gnus-sum-thread-tree-root subject)
4609 (or gnus-sum-thread-tree-single-indent subject)))
4611 (concat (apply 'concat
4612 (mapcar (lambda (item)
4614 gnus-sum-thread-tree-vertical
4615 gnus-sum-thread-tree-indent))
4616 (cdr (reverse tree-stack))))
4618 gnus-sum-thread-tree-leaf-with-other
4619 gnus-sum-thread-tree-single-leaf)))))
4620 (when (string= gnus-tmp-name "")
4621 (setq gnus-tmp-name gnus-tmp-from))
4622 (unless (numberp gnus-tmp-lines)
4623 (setq gnus-tmp-lines -1))
4624 (if (= gnus-tmp-lines -1)
4625 (setq gnus-tmp-lines "?")
4626 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4627 (gnus-put-text-property
4629 (progn (eval gnus-summary-line-format-spec) (point))
4630 'gnus-number number)
4633 (gnus-run-hooks 'gnus-summary-update-hook)
4636 (setq gnus-tmp-prev-subject subject)))
4638 (when (nth 1 thread)
4639 (push (list (max 0 gnus-tmp-level)
4640 (copy-list tree-stack)
4643 (push (if (nth 1 thread) 1 0) tree-stack)
4644 (incf gnus-tmp-level)
4645 (setq threads (if thread-end nil (cdar thread)))
4647 (setq gnus-tmp-level 0)))))
4648 (gnus-message 7 "Generating summary...done"))
4650 (defun gnus-summary-prepare-unthreaded (headers)
4651 "Generate an unthreaded summary buffer based on HEADERS."
4652 (let (header number mark)
4657 ;; We may have to root out some bad articles...
4658 (when (memq (setq number (mail-header-number
4659 (setq header (pop headers))))
4660 gnus-newsgroup-limit)
4661 ;; Mark article as read when it has a low score.
4662 (when (and gnus-summary-mark-below
4663 (< (or (cdr (assq number gnus-newsgroup-scored))
4664 gnus-summary-default-score 0)
4665 gnus-summary-mark-below)
4666 (not (gnus-summary-article-ancient-p number)))
4667 (setq gnus-newsgroup-unreads
4668 (delq number gnus-newsgroup-unreads))
4669 (if gnus-newsgroup-auto-expire
4670 (push number gnus-newsgroup-expirable)
4671 (push (cons number gnus-low-score-mark)
4672 gnus-newsgroup-reads)))
4674 (setq mark (gnus-article-mark number))
4675 (push (gnus-data-make number mark (1+ (point)) header 0)
4676 gnus-newsgroup-data)
4677 (gnus-summary-insert-line
4679 mark (memq number gnus-newsgroup-replied)
4680 (memq number gnus-newsgroup-expirable)
4681 (mail-header-subject header) nil
4682 (cdr (assq number gnus-newsgroup-scored))
4683 (memq number gnus-newsgroup-processable))))))
4685 (defun gnus-summary-remove-list-identifiers ()
4686 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4687 (let ((regexp (if (consp gnus-list-identifiers)
4688 (mapconcat 'identity gnus-list-identifiers " *\\|")
4689 gnus-list-identifiers))
4692 (dolist (header gnus-newsgroup-headers)
4693 (setq subject (mail-header-subject header)
4695 (while (string-match
4696 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4699 (concat (substring subject 0 (match-beginning 2))
4700 (substring subject (match-end 0)))
4704 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4706 (concat (substring subject 0 (match-beginning 1))
4707 (substring subject (match-end 1)))))
4709 (mail-header-set-subject header subject))))))
4711 (defun gnus-fetch-headers (articles)
4712 "Fetch headers of ARTICLES."
4713 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4714 (gnus-message 5 "Fetching headers for %s..." name)
4717 (setq gnus-headers-retrieved-by
4718 (gnus-retrieve-headers
4719 articles gnus-newsgroup-name
4720 ;; We might want to fetch old headers, but
4721 ;; not if there is only 1 article.
4723 (not (eq gnus-fetch-old-headers 'some))
4724 (not (numberp gnus-fetch-old-headers)))
4725 (> (length articles) 1))
4726 gnus-fetch-old-headers))))
4727 (gnus-get-newsgroup-headers-xover
4728 articles nil nil gnus-newsgroup-name t)
4729 (gnus-get-newsgroup-headers))
4730 (gnus-message 5 "Fetching headers for %s...done" name))))
4732 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4733 "Select newsgroup GROUP.
4734 If READ-ALL is non-nil, all articles in the group are selected.
4735 If SELECT-ARTICLES, only select those articles from GROUP."
4736 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4737 ;;!!! Dirty hack; should be removed.
4738 (gnus-summary-ignore-duplicates
4739 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4741 gnus-summary-ignore-duplicates))
4742 (info (nth 2 entry))
4743 articles fetched-articles cached)
4745 (unless (gnus-check-server
4746 (set (make-local-variable 'gnus-current-select-method)
4747 (gnus-find-method-for-group group)))
4748 (error "Couldn't open server"))
4750 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4751 (gnus-activate-group group) ; Or we can activate it...
4752 (progn ; Or we bug out.
4753 (when (equal major-mode 'gnus-summary-mode)
4754 (kill-buffer (current-buffer)))
4755 (error "Couldn't activate group %s: %s"
4756 group (gnus-status-message group))))
4758 (unless (gnus-request-group group t)
4759 (when (equal major-mode 'gnus-summary-mode)
4760 (kill-buffer (current-buffer)))
4761 (error "Couldn't request group %s: %s"
4762 group (gnus-status-message group)))
4764 (setq gnus-newsgroup-name group
4765 gnus-newsgroup-unselected nil
4766 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4768 (let ((display (gnus-group-find-parameter group 'display)))
4769 (setq gnus-newsgroup-display
4771 ((not (zerop (or (car-safe read-all) 0)))
4772 ;; The user entered the group with C-u SPC/RET, let's show
4778 (gnus-summary-display-make-predicate (mapcar 'identity display)))
4780 ;; The following is probably the "correct" solution, but
4781 ;; it makes Gnus fetch all headers and then limit the
4782 ;; articles (which is slow), so instead we hack the
4783 ;; select-articles parameter instead. -- Simon Josefsson
4786 ;; (gnus-byte-compile
4787 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
4789 (setq select-articles
4790 (gnus-uncompress-range
4791 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
4795 (cdr (gnus-active group)))))
4800 (gnus-summary-setup-default-charset)
4802 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4803 (when (gnus-virtual-group-p group)
4804 (setq cached gnus-newsgroup-cached))
4806 (setq gnus-newsgroup-unreads
4807 (gnus-sorted-ndifference
4808 (gnus-sorted-ndifference gnus-newsgroup-unreads
4809 gnus-newsgroup-marked)
4810 gnus-newsgroup-dormant))
4812 (setq gnus-newsgroup-processable nil)
4814 (gnus-update-read-articles group gnus-newsgroup-unreads)
4816 ;; Adjust and set lists of article marks.
4818 (gnus-adjust-marked-articles info))
4820 (if (setq articles select-articles)
4821 (setq gnus-newsgroup-unselected
4822 (gnus-sorted-difference gnus-newsgroup-unreads articles))
4823 (setq articles (gnus-articles-to-read group read-all)))
4827 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4829 ((eq articles 0) nil)
4831 ;; Init the dependencies hash table.
4832 (setq gnus-newsgroup-dependencies
4833 (gnus-make-hashtable (length articles)))
4834 (gnus-set-global-variables)
4835 ;; Retrieve the headers and read them in.
4836 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
4838 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4840 (setq gnus-newsgroup-cached cached))
4842 ;; Suppress duplicates?
4843 (when gnus-suppress-duplicates
4844 (gnus-dup-suppress-articles))
4846 ;; Set the initial limit.
4847 (setq gnus-newsgroup-limit (copy-sequence articles))
4848 ;; Remove canceled articles from the list of unread articles.
4849 (setq fetched-articles
4850 (mapcar (lambda (headers) (mail-header-number headers))
4851 gnus-newsgroup-headers))
4852 (setq gnus-newsgroup-articles fetched-articles)
4853 (setq gnus-newsgroup-unreads
4854 (gnus-sorted-nintersection
4855 gnus-newsgroup-unreads fetched-articles))
4856 (gnus-compute-unseen-list)
4858 ;; Removed marked articles that do not exist.
4859 (gnus-update-missing-marks
4860 (gnus-sorted-difference articles fetched-articles))
4861 ;; We might want to build some more threads first.
4862 (when (and gnus-fetch-old-headers
4863 (eq gnus-headers-retrieved-by 'nov))
4864 (if (eq gnus-fetch-old-headers 'invisible)
4865 (gnus-build-all-threads)
4866 (gnus-build-old-threads)))
4867 ;; Let the Gnus agent mark articles as read.
4869 (gnus-agent-get-undownloaded-list))
4870 ;; Remove list identifiers from subject
4871 (when gnus-list-identifiers
4872 (gnus-summary-remove-list-identifiers))
4873 ;; Check whether auto-expire is to be done in this group.
4874 (setq gnus-newsgroup-auto-expire
4875 (gnus-group-auto-expirable-p group))
4876 ;; Set up the article buffer now, if necessary.
4877 (unless gnus-single-article-buffer
4878 (gnus-article-setup-buffer))
4879 ;; First and last article in this newsgroup.
4880 (when gnus-newsgroup-headers
4881 (setq gnus-newsgroup-begin
4882 (mail-header-number (car gnus-newsgroup-headers))
4885 (gnus-last-element gnus-newsgroup-headers))))
4886 ;; GROUP is successfully selected.
4887 (or gnus-newsgroup-headers t)))))
4889 (defun gnus-compute-unseen-list ()
4890 ;; The `seen' marks are treated specially.
4891 (if (not gnus-newsgroup-seen)
4892 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
4893 (setq gnus-newsgroup-unseen
4894 (gnus-inverse-list-range-intersection
4895 gnus-newsgroup-articles gnus-newsgroup-seen))))
4897 (defun gnus-summary-display-make-predicate (display)
4898 (require 'gnus-agent)
4899 (when (= (length display) 1)
4900 (setq display (car display)))
4901 (unless gnus-summary-display-cache
4902 (dolist (elem (append '((unread . unread)
4905 gnus-article-mark-lists))
4906 (push (cons (cdr elem)
4908 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
4909 gnus-summary-display-cache)))
4910 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
4911 (gnus-category-predicate-cache gnus-summary-display-cache))
4912 (gnus-get-predicate display)))
4914 ;; Uses the dynamically bound `number' variable.
4916 (defun gnus-article-marked-p (type &optional article)
4917 (let ((article (or article number)))
4920 (memq article gnus-newsgroup-marked))
4922 (memq article gnus-newsgroup-unsendable))
4923 ((eq type 'undownload)
4924 (memq article gnus-newsgroup-undownloaded))
4925 ((eq type 'download)
4926 (memq article gnus-newsgroup-downloadable))
4928 (memq article gnus-newsgroup-unreads))
4930 (memq article gnus-newsgroup-reads))
4932 (memq article gnus-newsgroup-dormant) )
4934 (memq article gnus-newsgroup-expirable))
4936 (memq article gnus-newsgroup-replied))
4938 (memq article gnus-newsgroup-killed))
4939 ((eq type 'bookmark)
4940 (assq article gnus-newsgroup-bookmarks))
4942 (assq article gnus-newsgroup-scored))
4944 (memq article gnus-newsgroup-saved))
4946 (memq article gnus-newsgroup-cached))
4948 (memq article gnus-newsgroup-forwarded))
4950 (not (memq article gnus-newsgroup-unseen)))
4952 (memq article gnus-newsgroup-recent))
4955 (defun gnus-articles-to-read (group &optional read-all)
4956 "Find out what articles the user wants to read."
4958 ;; Select all articles if `read-all' is non-nil, or if there
4959 ;; are no unread articles.
4961 (and (zerop (length gnus-newsgroup-marked))
4962 (zerop (length gnus-newsgroup-unreads)))
4963 ;; Fetch all if the predicate is non-nil.
4964 gnus-newsgroup-display)
4965 ;; We want to select the headers for all the articles in
4966 ;; the group, so we select either all the active
4967 ;; articles in the group, or (if that's nil), the
4968 ;; articles in the cache.
4970 (gnus-uncompress-range (gnus-active group))
4971 (gnus-cache-articles-in-group group))
4972 ;; Select only the "normal" subset of articles.
4974 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
4975 gnus-newsgroup-unreads)))
4976 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4977 (scored (length scored-list))
4978 (number (length articles))
4979 (marked (+ (length gnus-newsgroup-marked)
4980 (length gnus-newsgroup-dormant)))
4985 ((numberp gnus-newsgroup-display)
4986 gnus-newsgroup-display)
4990 ((and (or (<= scored marked) (= scored number))
4991 (numberp gnus-large-newsgroup)
4992 (> number gnus-large-newsgroup))
4993 (let* ((cursor-in-echo-area nil)
4994 (initial (gnus-parameter-large-newsgroup-initial
4995 gnus-newsgroup-name))
4999 "How many articles from %s (%s %d): "
5001 (gnus-group-decoded-name gnus-newsgroup-name)
5003 (if initial "max" "default")
5006 (cons (number-to-string initial)
5008 (if (string-match "^[ \t]*$" input) number input)))
5009 ((and (> scored marked) (< scored number)
5010 (> (- scored number) 20))
5013 (format "%s %s (%d scored, %d total): "
5014 "How many articles from"
5015 (gnus-group-decoded-name group)
5017 (if (string-match "^[ \t]*$" input)
5021 (message "Quit getting the articles to read")
5023 (setq select (if (stringp select) (string-to-number select) select))
5024 (if (or (null select) (zerop select))
5026 (if (and (not (zerop scored)) (<= (abs select) scored))
5028 (setq articles (sort scored-list '<))
5029 (setq number (length articles)))
5030 (setq articles (copy-sequence articles)))
5032 (when (< (abs select) number)
5034 ;; Select the N oldest articles.
5035 (setcdr (nthcdr (1- (abs select)) articles) nil)
5036 ;; Select the N most recent articles.
5037 (setq articles (nthcdr (- number select) articles))))
5038 (setq gnus-newsgroup-unselected
5039 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5040 (when gnus-alter-articles-to-read-function
5041 (setq gnus-newsgroup-unreads
5043 (funcall gnus-alter-articles-to-read-function
5044 gnus-newsgroup-name gnus-newsgroup-unreads)
5048 (defun gnus-killed-articles (killed articles)
5051 (when (inline (gnus-member-of-range (car articles) killed))
5052 (push (car articles) out))
5053 (setq articles (cdr articles)))
5056 (defun gnus-uncompress-marks (marks)
5057 "Uncompress the mark ranges in MARKS."
5058 (let ((uncompressed '(score bookmark))
5061 (if (memq (caar marks) uncompressed)
5062 (push (car marks) out)
5063 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5064 (setq marks (cdr marks)))
5067 (defun gnus-article-mark-to-type (mark)
5068 "Return the type of MARK."
5069 (or (cadr (assq mark gnus-article-special-mark-lists))
5072 (defun gnus-article-unpropagatable-p (mark)
5073 "Return whether MARK should be propagated to backend."
5074 (memq mark gnus-article-unpropagated-mark-lists))
5076 (defun gnus-adjust-marked-articles (info)
5077 "Set all article lists and remove all marks that are no longer valid."
5078 (let* ((marked-lists (gnus-info-marks info))
5079 (active (gnus-active (gnus-info-group info)))
5082 (types gnus-article-mark-lists)
5083 marks var articles article mark mark-type)
5085 (dolist (marks marked-lists)
5086 (setq mark (car marks)
5087 mark-type (gnus-article-mark-to-type mark)
5088 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5090 ;; We set the variable according to the type of the marks list,
5091 ;; and then adjust the marks to a subset of the active articles.
5093 ;; Adjust "simple" lists.
5094 ((eq mark-type 'list)
5095 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5096 (when (memq mark '(tick dormant expire reply save))
5098 (when (or (< (setq article (pop articles)) min) (> article max))
5099 (set var (delq article (symbol-value var)))))))
5101 ((eq mark-type 'tuple)
5102 (set var (setq articles (cdr marks)))
5103 (when (not (listp (cdr (symbol-value var))))
5104 (set var (list (symbol-value var))))
5105 (when (not (listp (cdr articles)))
5106 (setq articles (list articles)))
5108 (when (or (not (consp (setq article (pop articles))))
5109 (< (car article) min)
5110 (> (car article) max))
5111 (set var (delq article (symbol-value var))))))
5112 ;; Adjust ranges (sloppily).
5113 ((eq mark-type 'range)
5116 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5117 ;; It should be (seen (NUM1 . NUM2)).
5118 (when (numberp (cddr marks))
5119 (setcdr marks (list (cdr marks))))
5120 (setq articles (cdr marks))
5121 (while (and articles
5122 (or (and (consp (car articles))
5123 (> min (cdar articles)))
5124 (and (numberp (car articles))
5125 (> min (car articles)))))
5127 (set var articles))))))))
5129 (defun gnus-update-missing-marks (missing)
5130 "Go through the list of MISSING articles and remove them from the mark lists."
5133 ;; Go through all types.
5134 (dolist (elem gnus-article-mark-lists)
5135 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5136 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5137 (when (symbol-value var)
5138 ;; This list has articles. So we delete all missing
5139 ;; articles from it.
5142 (set var (delq (pop m) (symbol-value var))))))))))
5144 (defun gnus-update-marks ()
5145 "Enter the various lists of marked articles into the newsgroup info list."
5146 (let ((types gnus-article-mark-lists)
5147 (info (gnus-get-info gnus-newsgroup-name))
5148 type list newmarked symbol delta-marks)
5150 ;; Add all marks lists to the list of marks lists.
5151 (while (setq type (pop types))
5152 (setq list (symbol-value
5154 (intern (format "gnus-newsgroup-%s" (car type))))))
5157 ;; Get rid of the entries of the articles that have the
5159 (when (and (eq (cdr type) 'score)
5163 (prev (cons nil list))
5166 (if (or (not (consp (car arts)))
5167 (= (cdar arts) gnus-summary-default-score))
5168 (setcdr prev (cdr arts))
5170 (setq arts (cdr arts)))
5171 (setq list (cdr all)))))
5173 (when (eq (cdr type) 'seen)
5174 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5176 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5177 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5179 (when (and (gnus-check-backend-function
5180 'request-set-mark gnus-newsgroup-name)
5181 (not (gnus-article-unpropagatable-p (cdr type))))
5182 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5183 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5184 (add (gnus-remove-from-range
5185 (gnus-copy-sequence list) old)))
5187 (push (list add 'add (list (cdr type))) delta-marks))
5189 (push (list del 'del (list (cdr type))) delta-marks))))
5192 (push (cons (cdr type) list) newmarked)))
5195 (unless (gnus-check-group gnus-newsgroup-name)
5196 (error "Can't open server for %s" gnus-newsgroup-name))
5197 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5199 ;; Enter these new marks into the info of the group.
5201 (setcar (nthcdr 3 info) newmarked)
5202 ;; Add the marks lists to the end of the info.
5204 (setcdr (nthcdr 2 info) (list newmarked))))
5206 ;; Cut off the end of the info if there's nothing else there.
5210 (when (nthcdr (decf i) info)
5211 (setcdr (nthcdr i info) nil)))))))
5213 (defun gnus-set-mode-line (where)
5214 "Set the mode line of the article or summary buffers.
5215 If WHERE is `summary', the summary mode line format will be used."
5216 ;; Is this mode line one we keep updated?
5217 (when (and (memq where gnus-updated-mode-lines)
5219 (intern (format "gnus-%s-mode-line-format-spec" where))))
5222 ;; We evaluate this in the summary buffer since these
5223 ;; variables are buffer-local to that buffer.
5224 (set-buffer gnus-summary-buffer)
5225 ;; We bind all these variables that are used in the `eval' form
5227 (let* ((mformat (symbol-value
5229 (format "gnus-%s-mode-line-format-spec" where))))
5230 (gnus-tmp-group-name (gnus-group-decoded-name
5231 gnus-newsgroup-name))
5232 (gnus-tmp-article-number (or gnus-current-article 0))
5233 (gnus-tmp-unread gnus-newsgroup-unreads)
5234 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5235 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5236 (gnus-tmp-unread-and-unselected
5237 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5238 (zerop gnus-tmp-unselected))
5240 ((zerop gnus-tmp-unselected)
5241 (format "{%d more}" gnus-tmp-unread-and-unticked))
5242 (t (format "{%d(+%d) more}"
5243 gnus-tmp-unread-and-unticked
5244 gnus-tmp-unselected))))
5246 (if (and gnus-current-headers
5247 (vectorp gnus-current-headers))
5248 (gnus-mode-string-quote
5249 (mail-header-subject gnus-current-headers))
5251 bufname-length max-len
5252 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5253 (setq mode-string (eval mformat))
5254 (setq bufname-length (if (string-match "%b" mode-string)
5257 (if (eq where 'summary)
5259 (get-buffer gnus-article-buffer))))
5262 (setq max-len (max 4 (if gnus-mode-non-string-length
5264 gnus-mode-non-string-length
5266 (length mode-string))))
5267 ;; We might have to chop a bit of the string off...
5268 (when (> (length mode-string) max-len)
5270 (concat (truncate-string-to-width mode-string (- max-len 3))
5272 ;; Pad the mode string a bit.
5273 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5274 ;; Update the mode line.
5275 (setq mode-line-buffer-identification
5276 (gnus-mode-line-buffer-identification (list mode-string)))
5277 (set-buffer-modified-p t))))
5279 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5280 "Go through the HEADERS list and add all Xrefs to a hash table.
5281 The resulting hash table is returned, or nil if no Xrefs were found."
5282 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5283 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5284 (xref-hashtb (gnus-make-hashtable))
5285 start group entry number xrefs header)
5287 (setq header (pop headers))
5288 (when (and (setq xrefs (mail-header-xref header))
5289 (not (memq (setq number (mail-header-number header))
5292 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5293 (setq start (match-end 0))
5294 (setq group (if prefix
5295 (concat prefix (substring xrefs (match-beginning 1)
5297 (substring xrefs (match-beginning 1) (match-end 1))))
5299 (string-to-int (substring xrefs (match-beginning 2)
5301 (if (setq entry (gnus-gethash group xref-hashtb))
5302 (setcdr entry (cons number (cdr entry)))
5303 (gnus-sethash group (cons number nil) xref-hashtb)))))
5304 (and start xref-hashtb)))
5306 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5307 "Look through all the headers and mark the Xrefs as read."
5308 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5309 name entry info xref-hashtb idlist method nth4)
5311 (set-buffer gnus-group-buffer)
5312 (when (setq xref-hashtb
5313 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5316 (unless (string= from-newsgroup (setq name (symbol-name group)))
5317 (setq idlist (symbol-value group))
5318 ;; Dead groups are not updated.
5320 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5322 (when (stringp (setq nth4 (gnus-info-method info)))
5323 (setq nth4 (gnus-server-to-method nth4))))
5324 ;; Only do the xrefs if the group has the same
5325 ;; select method as the group we have just read.
5326 (or (gnus-methods-equal-p
5327 nth4 (gnus-find-method-for-group from-newsgroup))
5329 (equal nth4 (setq method (gnus-find-method-for-group
5331 (and (equal (car nth4) (car method))
5332 (equal (nth 1 nth4) (nth 1 method))))
5333 gnus-use-cross-reference
5334 (or (not (eq gnus-use-cross-reference t))
5336 ;; Only do cross-references on subscribed
5337 ;; groups, if that is what is wanted.
5338 (<= (gnus-info-level info) gnus-level-subscribed))
5339 (gnus-group-make-articles-read name idlist))))
5342 (defun gnus-compute-read-articles (group articles)
5343 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5344 (info (nth 2 entry))
5345 (active (gnus-active group))
5348 ;; First peel off all invalid article numbers.
5350 (let ((ids articles)
5352 (while (setq id (pop ids))
5353 (when (and first (> id (cdr active)))
5354 ;; We'll end up in this situation in one particular
5355 ;; obscure situation. If you re-scan a group and get
5356 ;; a new article that is cross-posted to a different
5357 ;; group that has not been re-scanned, you might get
5358 ;; crossposted article that has a higher number than
5359 ;; Gnus believes possible. So we re-activate this
5360 ;; group as well. This might mean doing the
5361 ;; crossposting thingy will *increase* the number
5362 ;; of articles in some groups. Tsk, tsk.
5363 (setq active (or (gnus-activate-group group) active)))
5364 (when (or (> id (cdr active))
5365 (< id (car active)))
5366 (setq articles (delq id articles))))))
5367 ;; If the read list is nil, we init it.
5369 (null (gnus-info-read info))
5371 (setq ninfo (cons 1 (1- (car active))))
5372 (setq ninfo (gnus-info-read info)))
5373 ;; Then we add the read articles to the range.
5375 ninfo (setq articles (sort articles '<))))))
5377 (defun gnus-group-make-articles-read (group articles)
5378 "Update the info of GROUP to say that ARTICLES are read."
5380 (entry (gnus-gethash group gnus-newsrc-hashtb))
5381 (info (nth 2 entry))
5382 (active (gnus-active group))
5385 (setq range (gnus-compute-read-articles group articles))
5387 (set-buffer gnus-group-buffer)
5390 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5391 (gnus-info-set-read ',info ',(gnus-info-read info))
5392 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5393 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5394 (gnus-group-update-group ,group t))))
5395 ;; Add the read articles to the range.
5396 (gnus-info-set-read info range)
5397 (gnus-request-set-mark group (list (list range 'add '(read))))
5398 ;; Then we have to re-compute how many unread
5399 ;; articles there are in this group.
5403 (setq num (- (1+ (cdr active)) (car active))))
5404 ((not (listp (cdr range)))
5405 (setq num (- (cdr active) (- (1+ (cdr range))
5409 (if (numberp (car range))
5411 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5412 (setq range (cdr range)))
5413 (setq num (- (cdr active) num))))
5414 ;; Update the number of unread articles.
5416 ;; Update the group buffer.
5417 (gnus-group-update-group group t)))))
5419 (defvar gnus-newsgroup-none-id 0)
5421 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5422 (let ((cur nntp-server-buffer)
5425 (save-excursion (set-buffer gnus-summary-buffer)
5426 gnus-newsgroup-dependencies)))
5428 (mail-parse-charset gnus-newsgroup-charset)
5429 (mail-parse-ignored-charsets
5430 (save-excursion (condition-case nil
5431 (set-buffer gnus-summary-buffer)
5433 gnus-newsgroup-ignored-charsets)))
5435 (set-buffer nntp-server-buffer)
5436 ;; Translate all TAB characters into SPACE characters.
5437 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5438 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5439 (gnus-run-hooks 'gnus-parse-headers-hook)
5440 (let ((case-fold-search t)
5441 in-reply-to header p lines chars)
5442 (goto-char (point-min))
5443 ;; Search to the beginning of the next header. Error messages
5444 ;; do not begin with 2 or 3.
5445 (while (re-search-forward "^[23][0-9]+ " nil t)
5448 ;; This implementation of this function, with nine
5449 ;; search-forwards instead of the one re-search-forward and
5450 ;; a case (which basically was the old function) is actually
5451 ;; about twice as fast, even though it looks messier. You
5452 ;; can't have everything, I guess. Speed and elegance
5453 ;; doesn't always go hand in hand.
5462 (narrow-to-region (point)
5463 (or (and (search-forward "\n.\n" nil t)
5469 (if (search-forward "\nsubject:" nil t)
5470 (funcall gnus-decode-encoded-word-function
5471 (nnheader-header-value))
5476 (if (search-forward "\nfrom:" nil t)
5477 (funcall gnus-decode-encoded-word-function
5478 (nnheader-header-value))
5483 (if (search-forward "\ndate:" nil t)
5484 (nnheader-header-value) ""))
5488 (setq id (if (re-search-forward
5489 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5490 ;; We do it this way to make sure the Message-ID
5491 ;; is (somewhat) syntactically valid.
5492 (buffer-substring (match-beginning 1)
5494 ;; If there was no message-id, we just fake one
5495 ;; to make subsequent routines simpler.
5496 (nnheader-generate-fake-message-id))))
5500 (if (search-forward "\nreferences:" nil t)
5504 (nnheader-header-value)
5509 (search-backward ">" end t)
5512 (search-backward "<" end t)
5514 ;; Get the references from the in-reply-to header if there
5515 ;; were no references and the in-reply-to header looks
5517 (if (and (search-forward "\nin-reply-to:" nil t)
5518 (setq in-reply-to (nnheader-header-value))
5519 (string-match "<[^>]+>" in-reply-to))
5521 (setq ref (substring in-reply-to (match-beginning 0)
5523 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5524 (setq ref2 (substring in-reply-to (match-beginning 0)
5526 (when (> (length ref2) (length ref))
5533 (if (search-forward "\nchars: " nil t)
5534 (if (numberp (setq chars (ignore-errors (read cur))))
5540 (if (search-forward "\nlines: " nil t)
5541 (if (numberp (setq lines (ignore-errors (read cur))))
5547 (and (search-forward "\nxref:" nil t)
5548 (nnheader-header-value)))
5550 (when gnus-extra-headers
5551 (let ((extra gnus-extra-headers)
5555 (when (search-forward
5556 (concat "\n" (symbol-name (car extra)) ":") nil t)
5557 (push (cons (car extra) (nnheader-header-value))
5561 (when (equal id ref)
5564 (when gnus-alter-header-function
5565 (funcall gnus-alter-header-function header)
5566 (setq id (mail-header-id header)
5567 ref (gnus-parent-id (mail-header-references header))))
5570 (gnus-dependencies-add-header
5571 header dependencies force-new))
5572 (push header headers))
5573 (goto-char (point-max))
5575 (nreverse headers)))))
5577 ;; Goes through the xover lines and returns a list of vectors
5578 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5579 force-new dependencies
5580 group also-fetch-heads)
5581 "Parse the news overview data in the server buffer.
5582 Return a list of headers that match SEQUENCE (see
5583 `nntp-retrieve-headers')."
5584 ;; Get the Xref when the users reads the articles since most/some
5585 ;; NNTP servers do not include Xrefs when using XOVER.
5586 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5587 (let ((mail-parse-charset gnus-newsgroup-charset)
5588 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5589 (cur nntp-server-buffer)
5590 (dependencies (or dependencies gnus-newsgroup-dependencies))
5592 ((eq gnus-read-all-available-headers t)
5594 ((stringp gnus-read-all-available-headers)
5595 (string-match gnus-read-all-available-headers group))
5598 number headers header)
5600 (set-buffer nntp-server-buffer)
5601 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5602 ;; Allow the user to mangle the headers before parsing them.
5603 (gnus-run-hooks 'gnus-parse-headers-hook)
5604 (goto-char (point-min))
5605 (gnus-parse-without-error
5606 (while (and (or sequence allp)
5608 (setq number (read cur))
5610 (while (and sequence
5611 (< (car sequence) number))
5612 (setq sequence (cdr sequence))))
5615 (eq number (car sequence))))
5617 (setq sequence (cdr sequence))
5618 (setq header (inline
5619 (gnus-nov-parse-line
5620 number dependencies force-new)))))
5621 (push header headers))
5623 ;; A common bug in inn is that if you have posted an article and
5624 ;; then retrieves the active file, it will answer correctly --
5625 ;; the new article is included. However, a NOV entry for the
5626 ;; article may not have been generated yet, so this may fail.
5627 ;; We work around this problem by retrieving the last few
5628 ;; headers using HEAD.
5629 (if (or (not also-fetch-heads)
5631 ;; We (probably) got all the headers.
5633 (let ((gnus-nov-is-evil t))
5636 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5637 (gnus-get-newsgroup-headers))))))))
5639 (defun gnus-article-get-xrefs ()
5640 "Fill in the Xref value in `gnus-current-headers', if necessary.
5641 This is meant to be called in `gnus-article-internal-prepare-hook'."
5642 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5643 gnus-current-headers)))
5644 (or (not gnus-use-cross-reference)
5646 (and (mail-header-xref headers)
5647 (not (string= (mail-header-xref headers) "")))
5648 (let ((case-fold-search t)
5651 (nnheader-narrow-to-headers)
5652 (goto-char (point-min))
5653 (when (or (and (not (eobp))
5654 (eq (downcase (char-after)) ?x)
5655 (looking-at "Xref:"))
5656 (search-forward "\nXref:" nil t))
5657 (goto-char (1+ (match-end 0)))
5658 (setq xref (buffer-substring (point)
5659 (progn (end-of-line) (point))))
5660 (mail-header-set-xref headers xref)))))))
5662 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5663 "Find article ID and insert the summary line for that article.
5664 OLD-HEADER can either be a header or a line number to insert
5665 the subject line on."
5666 (let* ((line (and (numberp old-header) old-header))
5667 (old-header (and (vectorp old-header) old-header))
5668 (header (cond ((and old-header use-old-header)
5671 (gnus-number-to-header id))
5672 (gnus-number-to-header id))
5674 (gnus-read-header id))))
5675 (number (and (numberp id) id))
5678 ;; Rebuild the thread that this article is part of and go to the
5679 ;; article we have fetched.
5680 (when (and (not gnus-show-threads)
5683 (setq d (gnus-data-find (mail-header-number old-header))))
5684 (goto-char (gnus-data-pos d))
5687 (- (gnus-point-at-bol)
5689 (1+ (gnus-point-at-eol))
5690 (gnus-delete-line))))))
5692 (mail-header-set-number header (mail-header-number old-header)))
5693 (setq gnus-newsgroup-sparse
5694 (delq (setq number (mail-header-number header))
5695 gnus-newsgroup-sparse))
5696 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5697 (push number gnus-newsgroup-limit)
5698 (gnus-rebuild-thread (mail-header-id header) line)
5699 (gnus-summary-goto-subject number nil t))
5700 (when (and (numberp number)
5702 ;; We have to update the boundaries even if we can't fetch the
5703 ;; article if ID is a number -- so that the next `P' or `N'
5704 ;; command will fetch the previous (or next) article even
5705 ;; if the one we tried to fetch this time has been canceled.
5706 (when (> number gnus-newsgroup-end)
5707 (setq gnus-newsgroup-end number))
5708 (when (< number gnus-newsgroup-begin)
5709 (setq gnus-newsgroup-begin number))
5710 (setq gnus-newsgroup-unselected
5711 (delq number gnus-newsgroup-unselected)))
5712 ;; Report back a success?
5713 (and header (mail-header-number header))))
5715 ;;; Process/prefix in the summary buffer
5717 (defun gnus-summary-work-articles (n)
5718 "Return a list of articles to be worked upon.
5719 The prefix argument, the list of process marked articles, and the
5720 current article will be taken into consideration."
5722 (set-buffer gnus-summary-buffer)
5725 ;; A numerical prefix has been given.
5726 (setq n (prefix-numeric-value n))
5727 (let ((backward (< n 0))
5728 (n (abs (prefix-numeric-value n)))
5733 (push (setq article (gnus-summary-article-number))
5736 (gnus-summary-find-prev nil article)
5737 (gnus-summary-find-next nil article)))
5739 (nreverse articles)))
5740 ((and (gnus-region-active-p) (mark))
5741 (message "region active")
5742 ;; Work on the region between point and mark.
5743 (let ((max (max (point) (mark)))
5746 (goto-char (min (min (point) (mark))))
5749 (push (setq article (gnus-summary-article-number)) articles)
5750 (gnus-summary-find-next nil article)
5752 (nreverse articles))))
5753 (gnus-newsgroup-processable
5754 ;; There are process-marked articles present.
5755 ;; Save current state.
5756 (gnus-summary-save-process-mark)
5758 (reverse gnus-newsgroup-processable))
5760 ;; Just return the current article.
5761 (list (gnus-summary-article-number))))))
5763 (defmacro gnus-summary-iterate (arg &rest forms)
5764 "Iterate over the process/prefixed articles and do FORMS.
5765 ARG is the interactive prefix given to the command. FORMS will be
5766 executed with point over the summary line of the articles."
5767 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5768 `(let ((,articles (gnus-summary-work-articles ,arg)))
5770 (gnus-summary-goto-subject (car ,articles))
5774 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5775 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5777 (defun gnus-summary-save-process-mark ()
5778 "Push the current set of process marked articles on the stack."
5780 (push (copy-sequence gnus-newsgroup-processable)
5781 gnus-newsgroup-process-stack))
5783 (defun gnus-summary-kill-process-mark ()
5784 "Push the current set of process marked articles on the stack and unmark."
5786 (gnus-summary-save-process-mark)
5787 (gnus-summary-unmark-all-processable))
5789 (defun gnus-summary-yank-process-mark ()
5790 "Pop the last process mark state off the stack and restore it."
5792 (unless gnus-newsgroup-process-stack
5793 (error "Empty mark stack"))
5794 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5796 (defun gnus-summary-process-mark-set (set)
5797 "Make SET into the current process marked articles."
5798 (gnus-summary-unmark-all-processable)
5800 (gnus-summary-set-process-mark (pop set))))
5802 ;;; Searching and stuff
5804 (defun gnus-summary-search-group (&optional backward use-level)
5805 "Search for next unread newsgroup.
5806 If optional argument BACKWARD is non-nil, search backward instead."
5808 (set-buffer gnus-group-buffer)
5809 (when (gnus-group-search-forward
5810 backward nil (if use-level (gnus-group-group-level) nil))
5811 (gnus-group-group-name))))
5813 (defun gnus-summary-best-group (&optional exclude-group)
5814 "Find the name of the best unread group.
5815 If EXCLUDE-GROUP, do not go to this group."
5817 (set-buffer gnus-group-buffer)
5819 (gnus-group-best-unread-group exclude-group))))
5821 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5822 (if backward (gnus-summary-find-prev)
5823 (let* ((dummy (gnus-summary-article-intangible-p))
5824 (article (or article (gnus-summary-article-number)))
5825 (arts (gnus-data-find-list article))
5827 (when (and (not dummy)
5828 (or (not gnus-summary-check-current)
5830 (not (gnus-data-unread-p (car arts)))))
5831 (setq arts (cdr arts)))
5836 (when (or (and undownloaded
5837 (eq gnus-undownloaded-mark
5838 (gnus-data-mark (car arts))))
5839 (gnus-data-unread-p (car arts)))
5840 (setq result (car arts)
5842 (setq arts (cdr arts)))
5845 (goto-char (gnus-data-pos result))
5846 (gnus-data-number result)))))
5848 (defun gnus-summary-find-prev (&optional unread article)
5849 (let* ((eobp (eobp))
5850 (article (or article (gnus-summary-article-number)))
5851 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5853 (when (and (not eobp)
5854 (or (not gnus-summary-check-current)
5856 (not (gnus-data-unread-p (car arts)))))
5857 (setq arts (cdr arts)))
5862 (when (gnus-data-unread-p (car arts))
5863 (setq result (car arts)
5865 (setq arts (cdr arts)))
5868 (goto-char (gnus-data-pos result))
5869 (gnus-data-number result))))
5871 (defun gnus-summary-find-subject (subject &optional unread backward article)
5872 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5873 (article (or article (gnus-summary-article-number)))
5874 (articles (gnus-data-list backward))
5875 (arts (gnus-data-find-list article articles))
5877 (when (or (not gnus-summary-check-current)
5879 (not (gnus-data-unread-p (car arts))))
5880 (setq arts (cdr arts)))
5882 (and (or (not unread)
5883 (gnus-data-unread-p (car arts)))
5884 (vectorp (gnus-data-header (car arts)))
5886 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5887 (setq result (car arts)
5889 (setq arts (cdr arts)))
5891 (goto-char (gnus-data-pos result))
5892 (gnus-data-number result))))
5894 (defun gnus-summary-search-forward (&optional unread subject backward)
5895 "Search forward for an article.
5896 If UNREAD, look for unread articles. If SUBJECT, look for
5897 articles with that subject. If BACKWARD, search backward instead."
5898 (cond (subject (gnus-summary-find-subject subject unread backward))
5899 (backward (gnus-summary-find-prev unread))
5900 (t (gnus-summary-find-next unread))))
5902 (defun gnus-recenter (&optional n)
5903 "Center point in window and redisplay frame.
5904 Also do horizontal recentering."
5906 (when (and gnus-auto-center-summary
5907 (not (eq gnus-auto-center-summary 'vertical)))
5908 (gnus-horizontal-recenter))
5911 (defun gnus-summary-recenter ()
5912 "Center point in the summary window.
5913 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5914 displayed, no centering will be performed."
5915 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5916 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5918 (let* ((top (cond ((< (window-height) 4) 0)
5919 ((< (window-height) 7) 1)
5920 (t (if (numberp gnus-auto-center-summary)
5921 gnus-auto-center-summary
5923 (height (1- (window-height)))
5924 (bottom (save-excursion (goto-char (point-max))
5925 (forward-line (- height))
5927 (window (get-buffer-window (current-buffer))))
5928 ;; The user has to want it.
5929 (when gnus-auto-center-summary
5930 (when (get-buffer-window gnus-article-buffer)
5931 ;; Only do recentering when the article buffer is displayed,
5932 ;; Set the window start to either `bottom', which is the biggest
5933 ;; possible valid number, or the second line from the top,
5934 ;; whichever is the least.
5935 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5936 (if (> bottom top-pos)
5937 ;; Keep the second line from the top visible
5938 (set-window-start window top-pos t)
5939 ;; Try to keep the bottom line visible; if it's partially
5940 ;; obscured, either scroll one more line to make it fully
5941 ;; visible, or revert to using TOP-POS.
5943 (goto-char (point-max))
5945 (let ((last-line-start (point)))
5947 (set-window-start window (point) t)
5948 (when (not (pos-visible-in-window-p last-line-start window))
5950 (set-window-start window (min (point) top-pos) t)))))))
5951 ;; Do horizontal recentering while we're at it.
5952 (when (and (get-buffer-window (current-buffer) t)
5953 (not (eq gnus-auto-center-summary 'vertical)))
5954 (let ((selected (selected-window)))
5955 (select-window (get-buffer-window (current-buffer) t))
5956 (gnus-summary-position-point)
5957 (gnus-horizontal-recenter)
5958 (select-window selected))))))
5960 (defun gnus-summary-jump-to-group (newsgroup)
5961 "Move point to NEWSGROUP in group mode buffer."
5962 ;; Keep update point of group mode buffer if visible.
5963 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5964 (save-window-excursion
5965 ;; Take care of tree window mode.
5966 (when (get-buffer-window gnus-group-buffer)
5967 (pop-to-buffer gnus-group-buffer))
5968 (gnus-group-jump-to-group newsgroup))
5970 ;; Take care of tree window mode.
5971 (if (get-buffer-window gnus-group-buffer)
5972 (pop-to-buffer gnus-group-buffer)
5973 (set-buffer gnus-group-buffer))
5974 (gnus-group-jump-to-group newsgroup))))
5976 ;; This function returns a list of article numbers based on the
5977 ;; difference between the ranges of read articles in this group and
5978 ;; the range of active articles.
5979 (defun gnus-list-of-unread-articles (group)
5980 (let* ((read (gnus-info-read (gnus-get-info group)))
5981 (active (or (gnus-active group) (gnus-activate-group group)))
5984 ;; If none are read, then all are unread.
5986 (setq first (car active))
5987 ;; If the range of read articles is a single range, then the
5988 ;; first unread article is the article after the last read
5989 ;; article. Sounds logical, doesn't it?
5990 (if (and (not (listp (cdr read)))
5991 (or (< (car read) (car active))
5992 (progn (setq read (list read))
5994 (setq first (max (car active) (1+ (cdr read))))
5995 ;; `read' is a list of ranges.
5996 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5999 (setq first (car active)))
6002 (while (< first nlast)
6004 (setq first (1+ first))))
6005 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6006 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6007 (setq read (cdr read)))))
6008 ;; And add the last unread articles.
6009 (while (<= first last)
6011 (setq first (1+ first)))
6012 ;; Return the list of unread articles.
6013 (delq 0 (nreverse unread))))
6015 (defun gnus-list-of-read-articles (group)
6016 "Return a list of unread, unticked and non-dormant articles."
6017 (let* ((info (gnus-get-info group))
6018 (marked (gnus-info-marks info))
6019 (active (gnus-active group)))
6021 (gnus-list-range-difference
6022 (gnus-list-range-difference
6023 (gnus-sorted-complement
6024 (gnus-uncompress-range active)
6025 (gnus-list-of-unread-articles group))
6026 (cdr (assq 'dormant marked)))
6027 (cdr (assq 'tick marked))))))
6029 ;; Various summary commands
6031 (defun gnus-summary-select-article-buffer ()
6032 "Reconfigure windows to show article buffer."
6034 (if (not (gnus-buffer-live-p gnus-article-buffer))
6035 (error "There is no article buffer for this summary buffer")
6036 (gnus-configure-windows 'article)
6037 (select-window (get-buffer-window gnus-article-buffer))))
6039 (defun gnus-summary-universal-argument (arg)
6040 "Perform any operation on all articles that are process/prefixed."
6042 (let ((articles (gnus-summary-work-articles arg))
6049 (substitute-command-keys
6050 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6052 (gnus-error 1 "Undefined key")
6055 (gnus-summary-goto-subject (setq article (pop articles)))
6056 (let (gnus-newsgroup-processable)
6057 (command-execute func))
6058 (gnus-summary-remove-process-mark article)))))
6059 (gnus-summary-position-point))
6061 (defun gnus-summary-toggle-truncation (&optional arg)
6062 "Toggle truncation of summary lines.
6063 With arg, turn line truncation on iff arg is positive."
6065 (setq truncate-lines
6066 (if (null arg) (not truncate-lines)
6067 (> (prefix-numeric-value arg) 0)))
6070 (defun gnus-summary-reselect-current-group (&optional all rescan)
6071 "Exit and then reselect the current newsgroup.
6072 The prefix argument ALL means to select all articles."
6074 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6075 (error "Ephemeral groups can't be reselected"))
6076 (let ((current-subject (gnus-summary-article-number))
6077 (group gnus-newsgroup-name))
6078 (setq gnus-newsgroup-begin nil)
6080 ;; We have to adjust the point of group mode buffer because
6081 ;; point was moved to the next unread newsgroup by exiting.
6082 (gnus-summary-jump-to-group group)
6085 (gnus-group-get-new-news-this-group 1)))
6086 (gnus-group-read-group all t)
6087 (gnus-summary-goto-subject current-subject nil t)))
6089 (defun gnus-summary-rescan-group (&optional all)
6090 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6092 (gnus-summary-reselect-current-group all t))
6094 (defun gnus-summary-update-info (&optional non-destructive)
6096 (let ((group gnus-newsgroup-name))
6098 (when gnus-newsgroup-kill-headers
6099 (setq gnus-newsgroup-killed
6100 (gnus-compress-sequence
6102 (gnus-list-range-intersection
6103 gnus-newsgroup-unselected gnus-newsgroup-killed)
6104 gnus-newsgroup-unreads)
6106 (unless (listp (cdr gnus-newsgroup-killed))
6107 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6108 (let ((headers gnus-newsgroup-headers))
6109 ;; Set the new ranges of read articles.
6111 (set-buffer gnus-group-buffer)
6112 (gnus-undo-force-boundary))
6113 (gnus-update-read-articles
6114 group (gnus-sorted-union
6115 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6116 ;; Set the current article marks.
6117 (let ((gnus-newsgroup-scored
6118 (if (and (not gnus-save-score)
6119 (not non-destructive))
6121 gnus-newsgroup-scored)))
6123 (gnus-update-marks)))
6124 ;; Do the cross-ref thing.
6125 (when gnus-use-cross-reference
6126 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6127 ;; Do not switch windows but change the buffer to work.
6128 (set-buffer gnus-group-buffer)
6129 (unless (gnus-ephemeral-group-p group)
6130 (gnus-group-update-group group)))))))
6132 (defun gnus-summary-save-newsrc (&optional force)
6133 "Save the current number of read/marked articles in the dribble buffer.
6134 The dribble buffer will then be saved.
6135 If FORCE (the prefix), also save the .newsrc file(s)."
6137 (gnus-summary-update-info t)
6139 (gnus-save-newsrc-file)
6140 (gnus-dribble-save)))
6142 (defun gnus-summary-exit (&optional temporary)
6143 "Exit reading current newsgroup, and then return to group selection mode.
6144 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6146 (gnus-set-global-variables)
6147 (when (gnus-buffer-live-p gnus-article-buffer)
6149 (set-buffer gnus-article-buffer)
6150 (mm-destroy-parts gnus-article-mime-handles)
6151 ;; Set it to nil for safety reason.
6152 (setq gnus-article-mime-handle-alist nil)
6153 (setq gnus-article-mime-handles nil)))
6154 (gnus-kill-save-kill-buffer)
6155 (gnus-async-halt-prefetch)
6156 (let* ((group gnus-newsgroup-name)
6157 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6160 (buf (current-buffer)))
6162 ;; Do adaptive scoring, and possibly save score files.
6163 (when gnus-newsgroup-adaptive
6164 (gnus-score-adaptive))
6165 (when gnus-use-scoring
6167 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6168 ;; If we have several article buffers, we kill them at exit.
6169 (unless gnus-single-article-buffer
6170 (gnus-kill-buffer gnus-original-article-buffer)
6171 (setq gnus-article-current nil))
6172 (when gnus-use-cache
6173 (gnus-cache-possibly-remove-articles)
6174 (gnus-cache-save-buffers))
6175 (gnus-async-prefetch-remove-group group)
6176 (when gnus-suppress-duplicates
6177 (gnus-dup-enter-articles))
6178 (when gnus-use-trees
6179 (gnus-tree-close group))
6180 (when gnus-use-cache
6181 (gnus-cache-write-active))
6182 ;; Remove entries for this group.
6183 (nnmail-purge-split-history (gnus-group-real-name group))
6184 ;; Make all changes in this group permanent.
6186 (gnus-run-hooks 'gnus-exit-group-hook)
6187 (gnus-summary-update-info))
6188 (gnus-close-group group)
6189 ;; Make sure where we were, and go to next newsgroup.
6190 (set-buffer gnus-group-buffer)
6192 (gnus-group-jump-to-group group))
6193 (gnus-run-hooks 'gnus-summary-exit-hook)
6194 (unless (or quit-config
6195 ;; If this group has disappeared from the summary
6196 ;; buffer, don't skip forwards.
6197 (not (string= group (gnus-group-group-name))))
6198 (gnus-group-next-unread-group 1))
6199 (setq group-point (point))
6202 ;; If we have several article buffers, we kill them at exit.
6203 (unless gnus-single-article-buffer
6204 (gnus-kill-buffer gnus-article-buffer)
6205 (gnus-kill-buffer gnus-original-article-buffer)
6206 (setq gnus-article-current nil))
6208 (if (not gnus-kill-summary-on-exit)
6210 (gnus-deaden-summary)
6212 ;; We set all buffer-local variables to nil. It is unclear why
6213 ;; this is needed, but if we don't, buffer-local variables are
6214 ;; not garbage-collected, it seems. This would the lead to en
6215 ;; ever-growing Emacs.
6216 (gnus-summary-clear-local-variables)
6217 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6218 (gnus-summary-clear-local-variables))
6219 (when (get-buffer gnus-article-buffer)
6220 (bury-buffer gnus-article-buffer))
6221 ;; We clear the global counterparts of the buffer-local
6222 ;; variables as well, just to be on the safe side.
6223 (set-buffer gnus-group-buffer)
6224 (gnus-summary-clear-local-variables)
6225 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6226 (gnus-summary-clear-local-variables)))
6227 (setq gnus-current-select-method gnus-select-method)
6228 (pop-to-buffer gnus-group-buffer)
6229 (if (not quit-config)
6231 (goto-char group-point)
6232 (gnus-configure-windows 'group 'force))
6233 (gnus-handle-ephemeral-exit quit-config))
6234 ;; Return to group mode buffer.
6235 (when (eq mode 'gnus-summary-mode)
6236 (gnus-kill-buffer buf))
6237 ;; Clear the current group name.
6239 (setq gnus-newsgroup-name nil)))))
6241 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6242 (defun gnus-summary-exit-no-update (&optional no-questions)
6243 "Quit reading current newsgroup without updating read article info."
6245 (let* ((group gnus-newsgroup-name)
6246 (quit-config (gnus-group-quit-config group)))
6247 (when (or no-questions
6249 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6250 (gnus-async-halt-prefetch)
6252 (delq 'gnus-summary-expire-articles
6253 (copy-sequence gnus-summary-prepare-exit-hook)))
6254 (when (gnus-buffer-live-p gnus-article-buffer)
6256 (set-buffer gnus-article-buffer)
6257 (mm-destroy-parts gnus-article-mime-handles)
6258 ;; Set it to nil for safety reason.
6259 (setq gnus-article-mime-handle-alist nil)
6260 (setq gnus-article-mime-handles nil)))
6261 ;; If we have several article buffers, we kill them at exit.
6262 (unless gnus-single-article-buffer
6263 (gnus-kill-buffer gnus-article-buffer)
6264 (gnus-kill-buffer gnus-original-article-buffer)
6265 (setq gnus-article-current nil))
6266 (if (not gnus-kill-summary-on-exit)
6267 (gnus-deaden-summary)
6268 (gnus-close-group group)
6269 (gnus-summary-clear-local-variables)
6270 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6271 (gnus-summary-clear-local-variables))
6272 (set-buffer gnus-group-buffer)
6273 (gnus-summary-clear-local-variables)
6274 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6275 (gnus-summary-clear-local-variables))
6276 (when (get-buffer gnus-summary-buffer)
6277 (kill-buffer gnus-summary-buffer)))
6278 (unless gnus-single-article-buffer
6279 (setq gnus-article-current nil))
6280 (when gnus-use-trees
6281 (gnus-tree-close group))
6282 (gnus-async-prefetch-remove-group group)
6283 (when (get-buffer gnus-article-buffer)
6284 (bury-buffer gnus-article-buffer))
6285 ;; Return to the group buffer.
6286 (gnus-configure-windows 'group 'force)
6287 ;; Clear the current group name.
6288 (setq gnus-newsgroup-name nil)
6289 (when (equal (gnus-group-group-name) group)
6290 (gnus-group-next-unread-group 1))
6292 (gnus-handle-ephemeral-exit quit-config)))))
6294 (defun gnus-handle-ephemeral-exit (quit-config)
6295 "Handle movement when leaving an ephemeral group.
6296 The state which existed when entering the ephemeral is reset."
6297 (if (not (buffer-name (car quit-config)))
6298 (gnus-configure-windows 'group 'force)
6299 (set-buffer (car quit-config))
6300 (cond ((eq major-mode 'gnus-summary-mode)
6301 (gnus-set-global-variables))
6302 ((eq major-mode 'gnus-article-mode)
6304 ;; The `gnus-summary-buffer' variable may point
6305 ;; to the old summary buffer when using a single
6307 (unless (gnus-buffer-live-p gnus-summary-buffer)
6308 (set-buffer gnus-group-buffer))
6309 (set-buffer gnus-summary-buffer)
6310 (gnus-set-global-variables))))
6311 (if (or (eq (cdr quit-config) 'article)
6312 (eq (cdr quit-config) 'pick))
6314 ;; The current article may be from the ephemeral group
6315 ;; thus it is best that we reload this article
6316 (gnus-summary-show-article)
6317 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6318 (gnus-configure-windows 'pick 'force)
6319 (gnus-configure-windows (cdr quit-config) 'force)))
6320 (gnus-configure-windows (cdr quit-config) 'force))
6321 (when (eq major-mode 'gnus-summary-mode)
6322 (gnus-summary-next-subject 1 nil t)
6323 (gnus-summary-recenter)
6324 (gnus-summary-position-point))))
6328 (defvar gnus-dead-summary-mode-map nil)
6330 (unless gnus-dead-summary-mode-map
6331 (setq gnus-dead-summary-mode-map (make-keymap))
6332 (suppress-keymap gnus-dead-summary-mode-map)
6333 (substitute-key-definition
6334 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6335 (dolist (key '("\C-d" "\r" "\177" [delete]))
6336 (define-key gnus-dead-summary-mode-map
6337 key 'gnus-summary-wake-up-the-dead))
6338 (dolist (key '("q" "Q"))
6339 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6341 (defvar gnus-dead-summary-mode nil
6342 "Minor mode for Gnus summary buffers.")
6344 (defun gnus-dead-summary-mode (&optional arg)
6345 "Minor mode for Gnus summary buffers."
6347 (when (eq major-mode 'gnus-summary-mode)
6348 (make-local-variable 'gnus-dead-summary-mode)
6349 (setq gnus-dead-summary-mode
6350 (if (null arg) (not gnus-dead-summary-mode)
6351 (> (prefix-numeric-value arg) 0)))
6352 (when gnus-dead-summary-mode
6353 (gnus-add-minor-mode
6354 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6356 (defun gnus-deaden-summary ()
6357 "Make the current summary buffer into a dead summary buffer."
6358 ;; Kill any previous dead summary buffer.
6359 (when (and gnus-dead-summary
6360 (buffer-name gnus-dead-summary))
6362 (set-buffer gnus-dead-summary)
6363 (when gnus-dead-summary-mode
6364 (kill-buffer (current-buffer)))))
6365 ;; Make this the current dead summary.
6366 (setq gnus-dead-summary (current-buffer))
6367 (gnus-dead-summary-mode 1)
6368 (let ((name (buffer-name)))
6369 (when (string-match "Summary" name)
6371 (concat (substring name 0 (match-beginning 0)) "Dead "
6372 (substring name (match-beginning 0)))
6376 (defun gnus-kill-or-deaden-summary (buffer)
6377 "Kill or deaden the summary BUFFER."
6379 (when (and (buffer-name buffer)
6380 (not gnus-single-article-buffer))
6383 (gnus-kill-buffer gnus-article-buffer)
6384 (gnus-kill-buffer gnus-original-article-buffer)))
6387 (gnus-kill-summary-on-exit
6388 (when (and gnus-use-trees
6389 (gnus-buffer-exists-p buffer))
6392 (gnus-tree-close gnus-newsgroup-name)))
6393 (gnus-kill-buffer buffer))
6394 ;; Deaden the buffer.
6395 ((gnus-buffer-exists-p buffer)
6398 (gnus-deaden-summary))))))
6400 (defun gnus-summary-wake-up-the-dead (&rest args)
6401 "Wake up the dead summary buffer."
6403 (gnus-dead-summary-mode -1)
6404 (let ((name (buffer-name)))
6405 (when (string-match "Dead " name)
6407 (concat (substring name 0 (match-beginning 0))
6408 (substring name (match-end 0)))
6410 (gnus-message 3 "This dead summary is now alive again"))
6412 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6413 (defun gnus-summary-fetch-faq (&optional faq-dir)
6414 "Fetch the FAQ for the current group.
6415 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6419 (when current-prefix-arg
6421 "Faq dir: " (and (listp gnus-group-faq-directory)
6422 (mapcar (lambda (file) (list file))
6423 gnus-group-faq-directory))))))
6424 (let (gnus-faq-buffer)
6425 (when (setq gnus-faq-buffer
6426 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6427 (gnus-configure-windows 'summary-faq))))
6429 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6430 (defun gnus-summary-describe-group (&optional force)
6431 "Describe the current newsgroup."
6433 (gnus-group-describe-group force gnus-newsgroup-name))
6435 (defun gnus-summary-describe-briefly ()
6436 "Describe summary mode commands briefly."
6438 (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")))
6440 ;; Walking around group mode buffer from summary mode.
6442 (defun gnus-summary-next-group (&optional no-article target-group backward)
6443 "Exit current newsgroup and then select next unread newsgroup.
6444 If prefix argument NO-ARTICLE is non-nil, no article is selected
6445 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
6446 previous group instead."
6448 ;; Stop pre-fetching.
6449 (gnus-async-halt-prefetch)
6450 (let ((current-group gnus-newsgroup-name)
6451 (current-buffer (current-buffer))
6453 ;; First we semi-exit this group to update Xrefs and all variables.
6454 ;; We can't do a real exit, because the window conf must remain
6455 ;; the same in case the user is prompted for info, and we don't
6456 ;; want the window conf to change before that...
6457 (gnus-summary-exit t)
6458 (while (not entered)
6459 ;; Then we find what group we are supposed to enter.
6460 (set-buffer gnus-group-buffer)
6461 (gnus-group-jump-to-group current-group)
6464 (if (eq gnus-keep-same-level 'best)
6465 (gnus-summary-best-group gnus-newsgroup-name)
6466 (gnus-summary-search-group backward gnus-keep-same-level))))
6467 (if (not target-group)
6468 ;; There are no further groups, so we return to the group
6471 (gnus-message 5 "Returning to the group buffer")
6473 (when (gnus-buffer-live-p current-buffer)
6474 (set-buffer current-buffer)
6475 (gnus-summary-exit))
6476 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6477 ;; We try to enter the target group.
6478 (gnus-group-jump-to-group target-group)
6479 (let ((unreads (gnus-group-group-unread)))
6480 (if (and (or (eq t unreads)
6481 (and unreads (not (zerop unreads))))
6482 (gnus-summary-read-group
6483 target-group nil no-article
6484 (and (buffer-name current-buffer) current-buffer)
6487 (setq current-group target-group
6488 target-group nil)))))))
6490 (defun gnus-summary-prev-group (&optional no-article)
6491 "Exit current newsgroup and then select previous unread newsgroup.
6492 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6494 (gnus-summary-next-group no-article nil t))
6496 ;; Walking around summary lines.
6498 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6499 "Go to the first unread subject.
6500 If UNREAD is non-nil, go to the first unread article.
6501 Returns the article selected or nil if there are no unread articles."
6506 ((null gnus-newsgroup-data)
6507 (gnus-message 3 "No articles in the group")
6509 ;; Pick the first article.
6511 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6512 (gnus-data-number (car gnus-newsgroup-data)))
6513 ;; No unread articles.
6514 ((null gnus-newsgroup-unreads)
6515 (gnus-message 3 "No more unread articles")
6517 ;; Find the first unread article.
6519 (let ((data gnus-newsgroup-data))
6521 (and (not (and undownloaded
6522 (eq gnus-undownloaded-mark
6523 (gnus-data-mark (car data)))))
6526 (gnus-data-number (car data))
6527 gnus-newsgroup-unseen))
6528 (not (gnus-data-unread-p (car data))))
6529 (not (gnus-data-unread-p (car data))))))
6530 (setq data (cdr data)))
6532 (goto-char (gnus-data-pos (car data)))
6533 (gnus-data-number (car data))))))
6534 (gnus-summary-position-point)))
6536 (defun gnus-summary-next-subject (n &optional unread dont-display)
6537 "Go to next N'th summary line.
6538 If N is negative, go to the previous N'th subject line.
6539 If UNREAD is non-nil, only unread articles are selected.
6540 The difference between N and the actual number of steps taken is
6543 (let ((backward (< n 0))
6547 (gnus-summary-find-prev unread)
6548 (gnus-summary-find-next unread)))
6549 (unless (zerop (setq n (1- n)))
6550 (gnus-summary-show-thread)))
6552 (gnus-message 7 "No more%s articles"
6553 (if unread " unread" "")))
6554 (unless dont-display
6555 (gnus-summary-recenter)
6556 (gnus-summary-position-point))
6559 (defun gnus-summary-next-unread-subject (n)
6560 "Go to next N'th unread summary line."
6562 (gnus-summary-next-subject n t))
6564 (defun gnus-summary-prev-subject (n &optional unread)
6565 "Go to previous N'th summary line.
6566 If optional argument UNREAD is non-nil, only unread article is selected."
6568 (gnus-summary-next-subject (- n) unread))
6570 (defun gnus-summary-prev-unread-subject (n)
6571 "Go to previous N'th unread summary line."
6573 (gnus-summary-next-subject (- n) t))
6575 (defun gnus-summary-goto-subject (article &optional force silent)
6576 "Go the subject line of ARTICLE.
6577 If FORCE, also allow jumping to articles not currently shown."
6578 (interactive "nArticle number: ")
6579 (unless (numberp article)
6580 (error "Article %s is not a number" article))
6582 (data (gnus-data-find article)))
6583 ;; We read in the article if we have to.
6586 (gnus-summary-insert-subject
6588 (if (or (numberp force) (vectorp force)) force)
6590 (setq data (gnus-data-find article)))
6595 (gnus-message 3 "Can't find article %d" article))
6597 (let ((pt (gnus-data-pos data)))
6599 (gnus-summary-set-article-display-arrow pt))
6600 (gnus-summary-position-point)
6603 ;; Walking around summary lines with displaying articles.
6605 (defun gnus-summary-expand-window (&optional arg)
6606 "Make the summary buffer take up the entire Emacs frame.
6607 Given a prefix, will force an `article' buffer configuration."
6610 (gnus-configure-windows 'article 'force)
6611 (gnus-configure-windows 'summary 'force)))
6613 (defun gnus-summary-display-article (article &optional all-header)
6614 "Display ARTICLE in article buffer."
6615 (when (gnus-buffer-live-p gnus-article-buffer)
6616 (with-current-buffer gnus-article-buffer
6617 (mm-enable-multibyte)))
6618 (gnus-set-global-variables)
6619 (when (gnus-buffer-live-p gnus-article-buffer)
6620 (with-current-buffer gnus-article-buffer
6621 (setq gnus-article-charset gnus-newsgroup-charset)
6622 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6623 (mm-enable-multibyte)))
6627 (if gnus-summary-display-article-function
6628 (funcall gnus-summary-display-article-function article all-header)
6629 (gnus-article-prepare article all-header))
6630 (gnus-run-hooks 'gnus-select-article-hook)
6631 (when (and gnus-current-article
6632 (not (zerop gnus-current-article)))
6633 (gnus-summary-goto-subject gnus-current-article))
6634 (gnus-summary-recenter)
6635 (when (and gnus-use-trees gnus-show-threads)
6636 (gnus-possibly-generate-tree article)
6637 (gnus-highlight-selected-tree article))
6638 ;; Successfully display article.
6639 (gnus-article-set-window-start
6640 (cdr (assq article gnus-newsgroup-bookmarks))))))
6642 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
6643 "Select the current article.
6644 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
6645 non-nil, the article will be re-fetched even if it already present in
6646 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
6648 ;; Make sure we are in the summary buffer to work around bbdb bug.
6649 (unless (eq major-mode 'gnus-summary-mode)
6650 (set-buffer gnus-summary-buffer))
6651 (let ((article (or article (gnus-summary-article-number)))
6652 (all-headers (not (not all-headers))) ;Must be t or nil.
6653 gnus-summary-display-article-function)
6655 (gnus-summary-article-pseudo-p article)
6656 (error "This is a pseudo-article"))
6658 (set-buffer gnus-summary-buffer)
6659 (if (or (and gnus-single-article-buffer
6660 (or (null gnus-current-article)
6661 (null gnus-article-current)
6662 (null (get-buffer gnus-article-buffer))
6663 (not (eq article (cdr gnus-article-current)))
6664 (not (equal (car gnus-article-current)
6665 gnus-newsgroup-name))))
6666 (and (not gnus-single-article-buffer)
6667 (or (null gnus-current-article)
6668 (not (eq gnus-current-article article))))
6670 ;; The requested article is different from the current article.
6672 (gnus-summary-display-article article all-headers)
6673 (when (gnus-buffer-live-p gnus-article-buffer)
6674 (with-current-buffer gnus-article-buffer
6675 (if (not gnus-article-decoded-p) ;; a local variable
6676 (mm-disable-multibyte))))
6677 (gnus-article-set-window-start
6678 (cdr (assq article gnus-newsgroup-bookmarks)))
6682 (defun gnus-summary-force-verify-and-decrypt ()
6684 (let ((mm-verify-option 'known)
6685 (mm-decrypt-option 'known)
6686 (gnus-buttonized-mime-types (append (list "multipart/signed"
6687 "multipart/encrypted")
6688 gnus-buttonized-mime-types)))
6689 (gnus-summary-select-article nil 'force)))
6691 (defun gnus-summary-set-current-mark (&optional current-mark)
6692 "Obsolete function."
6695 (defun gnus-summary-next-article (&optional unread subject backward push)
6696 "Select the next article.
6697 If UNREAD, only unread articles are selected.
6698 If SUBJECT, only articles with SUBJECT are selected.
6699 If BACKWARD, the previous article is selected instead of the next."
6702 ;; Is there such an article?
6703 ((and (gnus-summary-search-forward unread subject backward)
6704 (or (gnus-summary-display-article (gnus-summary-article-number))
6705 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
6706 (gnus-summary-position-point))
6707 ;; If not, we try the first unread, if that is wanted.
6709 gnus-auto-select-same
6710 (gnus-summary-first-unread-article))
6711 (gnus-summary-position-point)
6712 (gnus-message 6 "Wrapped"))
6713 ;; Try to get next/previous article not displayed in this group.
6714 ((and gnus-auto-extend-newsgroup
6715 (not unread) (not subject))
6716 (gnus-summary-goto-article
6717 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
6718 nil (count-lines (point-min) (point))))
6719 ;; Go to next/previous group.
6721 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
6722 (gnus-summary-jump-to-group gnus-newsgroup-name))
6723 (let ((cmd last-command-char)
6726 (set-buffer gnus-group-buffer)
6729 (if (eq gnus-keep-same-level 'best)
6730 (gnus-summary-best-group gnus-newsgroup-name)
6731 (gnus-summary-search-group backward gnus-keep-same-level))))
6732 ;; For some reason, the group window gets selected. We change
6734 (select-window (get-buffer-window (current-buffer)))
6735 ;; Select next unread newsgroup automagically.
6737 ((or (not gnus-auto-select-next)
6739 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6740 ((or (eq gnus-auto-select-next 'quietly)
6741 (and (eq gnus-auto-select-next 'slightly-quietly)
6743 (and (eq gnus-auto-select-next 'almost-quietly)
6744 (gnus-summary-last-article-p)))
6746 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6748 (gnus-message 7 "No more%s articles (%s)..."
6749 (if unread " unread" "")
6750 (if group (concat "selecting " group)
6752 (gnus-summary-next-group nil group backward)))
6754 (when (gnus-key-press-event-p last-input-event)
6755 (gnus-summary-walk-group-buffer
6756 gnus-newsgroup-name cmd unread backward point))))))))
6758 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6759 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6760 (?\C-p (gnus-group-prev-unread-group 1))))
6761 (cursor-in-echo-area t)
6762 keve key group ended)
6764 (set-buffer gnus-group-buffer)
6767 (if (eq gnus-keep-same-level 'best)
6768 (gnus-summary-best-group gnus-newsgroup-name)
6769 (gnus-summary-search-group backward gnus-keep-same-level))))
6772 5 "No more%s articles%s" (if unread " unread" "")
6774 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
6775 (format " (Type %s for %s [%s])"
6776 (single-key-description cmd) group
6777 (car (gnus-gethash group gnus-newsrc-hashtb)))
6778 (format " (Type %s to exit %s)"
6779 (single-key-description cmd)
6780 gnus-newsgroup-name)))
6781 ;; Confirm auto selection.
6782 (setq key (car (setq keve (gnus-read-event-char))))
6785 ((assq key keystrokes)
6786 (let ((obuf (current-buffer)))
6787 (switch-to-buffer gnus-group-buffer)
6789 (gnus-group-jump-to-group group))
6790 (eval (cadr (assq key keystrokes)))
6791 (setq group (gnus-group-group-name))
6792 (switch-to-buffer obuf))
6796 (gnus-ephemeral-group-p gnus-newsgroup-name))
6798 (gnus-summary-next-group nil group backward)))
6800 (push (cdr keve) unread-command-events))))))
6802 (defun gnus-summary-next-unread-article ()
6803 "Select unread article after current one."
6805 (gnus-summary-next-article
6806 (or (not (eq gnus-summary-goto-unread 'never))
6807 (gnus-summary-last-article-p (gnus-summary-article-number)))
6808 (and gnus-auto-select-same
6809 (gnus-summary-article-subject))))
6811 (defun gnus-summary-prev-article (&optional unread subject)
6812 "Select the article after the current one.
6813 If UNREAD is non-nil, only unread articles are selected."
6815 (gnus-summary-next-article unread subject t))
6817 (defun gnus-summary-prev-unread-article ()
6818 "Select unread article before current one."
6820 (gnus-summary-prev-article
6821 (or (not (eq gnus-summary-goto-unread 'never))
6822 (gnus-summary-first-article-p (gnus-summary-article-number)))
6823 (and gnus-auto-select-same
6824 (gnus-summary-article-subject))))
6826 (defun gnus-summary-next-page (&optional lines circular)
6827 "Show next page of the selected article.
6828 If at the end of the current article, select the next article.
6829 LINES says how many lines should be scrolled up.
6831 If CIRCULAR is non-nil, go to the start of the article instead of
6832 selecting the next article when reaching the end of the current
6835 (setq gnus-summary-buffer (current-buffer))
6836 (gnus-set-global-variables)
6837 (let ((article (gnus-summary-article-number))
6838 (article-window (get-buffer-window gnus-article-buffer t))
6840 ;; If the buffer is empty, we have no article.
6842 (error "No article to select"))
6843 (gnus-configure-windows 'article)
6844 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6845 (if (and (eq gnus-summary-goto-unread 'never)
6846 (not (gnus-summary-last-article-p article)))
6847 (gnus-summary-next-article)
6848 (gnus-summary-next-unread-article))
6849 (if (or (null gnus-current-article)
6850 (null gnus-article-current)
6851 (/= article (cdr gnus-article-current))
6852 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6853 ;; Selected subject is different from current article's.
6854 (gnus-summary-display-article article)
6855 (when article-window
6856 (gnus-eval-in-buffer-window gnus-article-buffer
6857 (setq endp (gnus-article-next-page lines)))
6860 (gnus-summary-beginning-of-article))
6862 (gnus-message 3 "End of message"))
6864 (if (and (eq gnus-summary-goto-unread 'never)
6865 (not (gnus-summary-last-article-p article)))
6866 (gnus-summary-next-article)
6867 (gnus-summary-next-unread-article))))))))
6868 (gnus-summary-recenter)
6869 (gnus-summary-position-point)))
6871 (defun gnus-summary-prev-page (&optional lines move)
6872 "Show previous page of selected article.
6873 Argument LINES specifies lines to be scrolled down.
6874 If MOVE, move to the previous unread article if point is at
6875 the beginning of the buffer."
6877 (let ((article (gnus-summary-article-number))
6878 (article-window (get-buffer-window gnus-article-buffer t))
6880 (gnus-configure-windows 'article)
6881 (if (or (null gnus-current-article)
6882 (null gnus-article-current)
6883 (/= article (cdr gnus-article-current))
6884 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6885 ;; Selected subject is different from current article's.
6886 (gnus-summary-display-article article)
6887 (gnus-summary-recenter)
6888 (when article-window
6889 (gnus-eval-in-buffer-window gnus-article-buffer
6890 (setq endp (gnus-article-prev-page lines)))
6891 (when (and move endp)
6893 (gnus-message 3 "Beginning of message"))
6895 (if (and (eq gnus-summary-goto-unread 'never)
6896 (not (gnus-summary-first-article-p article)))
6897 (gnus-summary-prev-article)
6898 (gnus-summary-prev-unread-article))))))))
6899 (gnus-summary-position-point))
6901 (defun gnus-summary-prev-page-or-article (&optional lines)
6902 "Show previous page of selected article.
6903 Argument LINES specifies lines to be scrolled down.
6904 If at the beginning of the article, go to the next article."
6906 (gnus-summary-prev-page lines t))
6908 (defun gnus-summary-scroll-up (lines)
6909 "Scroll up (or down) one line current article.
6910 Argument LINES specifies lines to be scrolled up (or down if negative)."
6912 (gnus-configure-windows 'article)
6913 (gnus-summary-show-thread)
6914 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6915 (gnus-eval-in-buffer-window gnus-article-buffer
6917 (when (gnus-article-next-page lines)
6918 (gnus-message 3 "End of message")))
6920 (gnus-article-prev-page (- lines))))))
6921 (gnus-summary-recenter)
6922 (gnus-summary-position-point))
6924 (defun gnus-summary-scroll-down (lines)
6925 "Scroll down (or up) one line current article.
6926 Argument LINES specifies lines to be scrolled down (or up if negative)."
6928 (gnus-summary-scroll-up (- lines)))
6930 (defun gnus-summary-next-same-subject ()
6931 "Select next article which has the same subject as current one."
6933 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6935 (defun gnus-summary-prev-same-subject ()
6936 "Select previous article which has the same subject as current one."
6938 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6940 (defun gnus-summary-next-unread-same-subject ()
6941 "Select next unread article which has the same subject as current one."
6943 (gnus-summary-next-article t (gnus-summary-article-subject)))
6945 (defun gnus-summary-prev-unread-same-subject ()
6946 "Select previous unread article which has the same subject as current one."
6948 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6950 (defun gnus-summary-first-unread-article ()
6951 "Select the first unread article.
6952 Return nil if there are no unread articles."
6955 (when (gnus-summary-first-subject t)
6956 (gnus-summary-show-thread)
6957 (gnus-summary-first-subject t)
6958 (gnus-summary-display-article (gnus-summary-article-number)))
6959 (gnus-summary-position-point)))
6961 (defun gnus-summary-first-unread-subject ()
6962 "Place the point on the subject line of the first unread article.
6963 Return nil if there are no unread articles."
6966 (when (gnus-summary-first-subject t)
6967 (gnus-summary-show-thread)
6968 (gnus-summary-first-subject t))
6969 (gnus-summary-position-point)))
6971 (defun gnus-summary-first-unseen-subject ()
6972 "Place the point on the subject line of the first unseen article.
6973 Return nil if there are no unseen articles."
6976 (when (gnus-summary-first-subject t t t)
6977 (gnus-summary-show-thread)
6978 (gnus-summary-first-subject t t t))
6979 (gnus-summary-position-point)))
6981 (defun gnus-summary-first-unseen-or-unread-subject ()
6982 "Place the point on the subject line of the first unseen article.
6983 Return nil if there are no unseen articles."
6986 (unless (when (gnus-summary-first-subject t t t)
6987 (gnus-summary-show-thread)
6988 (gnus-summary-first-subject t t t))
6989 (when (gnus-summary-first-subject t)
6990 (gnus-summary-show-thread)
6991 (gnus-summary-first-subject t)))
6992 (gnus-summary-position-point)))
6994 (defun gnus-summary-first-article ()
6995 "Select the first article.
6996 Return nil if there are no articles."
6999 (when (gnus-summary-first-subject)
7000 (gnus-summary-show-thread)
7001 (gnus-summary-first-subject)
7002 (gnus-summary-display-article (gnus-summary-article-number)))
7003 (gnus-summary-position-point)))
7005 (defun gnus-summary-best-unread-article (&optional arg)
7006 "Select the unread article with the highest score.
7007 If given a prefix argument, select the next unread article that has a
7008 score higher than the default score."
7010 (let ((article (if arg
7011 (gnus-summary-better-unread-subject)
7012 (gnus-summary-best-unread-subject))))
7014 (gnus-summary-goto-article article)
7015 (error "No unread articles"))))
7017 (defun gnus-summary-best-unread-subject ()
7018 "Select the unread subject with the highest score."
7020 (let ((best -1000000)
7021 (data gnus-newsgroup-data)
7024 (and (gnus-data-unread-p (car data))
7026 (gnus-summary-article-score (gnus-data-number (car data))))
7029 article (gnus-data-number (car data))))
7030 (setq data (cdr data)))
7032 (gnus-summary-goto-subject article))
7033 (gnus-summary-position-point)
7036 (defun gnus-summary-better-unread-subject ()
7037 "Select the first unread subject that has a score over the default score."
7039 (let ((data gnus-newsgroup-data)
7041 (while (and (setq article (gnus-data-number (car data)))
7042 (or (gnus-data-read-p (car data))
7043 (not (> (gnus-summary-article-score article)
7044 gnus-summary-default-score))))
7045 (setq data (cdr data)))
7047 (gnus-summary-goto-subject article))
7048 (gnus-summary-position-point)
7051 (defun gnus-summary-last-subject ()
7052 "Go to the last displayed subject line in the group."
7053 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7055 (gnus-summary-goto-subject article))))
7057 (defun gnus-summary-goto-article (article &optional all-headers force)
7058 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7059 If ALL-HEADERS is non-nil, no header lines are hidden.
7060 If FORCE, go to the article even if it isn't displayed. If FORCE
7061 is a number, it is the line the article is to be displayed on."
7065 "Article number or Message-ID: "
7066 (mapcar (lambda (number) (list (int-to-string number)))
7067 gnus-newsgroup-limit))
7071 (if (and (stringp article)
7072 (string-match "@" article))
7073 (gnus-summary-refer-article article)
7074 (when (stringp article)
7075 (setq article (string-to-number article)))
7076 (if (gnus-summary-goto-subject article force)
7077 (gnus-summary-display-article article all-headers)
7078 (gnus-message 4 "Couldn't go to article %s" article) nil))
7079 (gnus-summary-position-point)))
7081 (defun gnus-summary-goto-last-article ()
7082 "Go to the previously read article."
7085 (when gnus-last-article
7086 (gnus-summary-goto-article gnus-last-article nil t))
7087 (gnus-summary-position-point)))
7089 (defun gnus-summary-pop-article (number)
7090 "Pop one article off the history and go to the previous.
7091 NUMBER articles will be popped off."
7094 (setq gnus-newsgroup-history
7095 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7097 (gnus-summary-goto-article (car to) nil t)
7098 (error "Article history empty")))
7099 (gnus-summary-position-point))
7101 ;; Summary commands and functions for limiting the summary buffer.
7103 (defun gnus-summary-limit-to-articles (n)
7104 "Limit the summary buffer to the next N articles.
7105 If not given a prefix, use the process marked articles instead."
7108 (let ((articles (gnus-summary-work-articles n)))
7109 (setq gnus-newsgroup-processable nil)
7110 (gnus-summary-limit articles))
7111 (gnus-summary-position-point)))
7113 (defun gnus-summary-pop-limit (&optional total)
7114 "Restore the previous limit.
7115 If given a prefix, remove all limits."
7118 (setq gnus-newsgroup-limits
7119 (list (mapcar (lambda (h) (mail-header-number h))
7120 gnus-newsgroup-headers))))
7121 (unless gnus-newsgroup-limits
7122 (error "No limit to pop"))
7124 (gnus-summary-limit nil 'pop)
7125 (gnus-summary-position-point)))
7127 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7128 "Limit the summary buffer to articles that have subjects that match a regexp.
7129 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7131 (list (read-string (if current-prefix-arg
7132 "Exclude subject (regexp): "
7133 "Limit to subject (regexp): "))
7134 nil current-prefix-arg))
7136 (setq header "subject"))
7137 (when (not (equal "" subject))
7139 (let ((articles (gnus-summary-find-matching
7140 (or header "subject") subject 'all nil nil
7143 (error "Found no matches for \"%s\"" subject))
7144 (gnus-summary-limit articles))
7145 (gnus-summary-position-point))))
7147 (defun gnus-summary-limit-to-author (from &optional not-matching)
7148 "Limit the summary buffer to articles that have authors that match a regexp.
7149 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7151 (list (read-string (if current-prefix-arg
7152 "Exclude author (regexp): "
7153 "Limit to author (regexp): "))
7154 current-prefix-arg))
7155 (gnus-summary-limit-to-subject from "from" not-matching))
7157 (defun gnus-summary-limit-to-age (age &optional younger-p)
7158 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7159 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7160 articles that are younger than AGE days."
7162 (let ((younger current-prefix-arg)
7165 (while (not days-got)
7166 (setq days (if younger
7167 (read-string "Limit to articles within (in days): ")
7168 (read-string "Limit to articles older than (in days): ")))
7169 (when (> (length days) 0)
7170 (setq days (read days)))
7176 (setq younger (not younger))
7177 (setq days (* days -1)))))
7178 (message "Please enter a number.")
7180 (list days younger)))
7182 (let ((data gnus-newsgroup-data)
7183 (cutoff (days-to-time age))
7184 articles d date is-younger)
7185 (while (setq d (pop data))
7186 (when (and (vectorp (gnus-data-header d))
7187 (setq date (mail-header-date (gnus-data-header d))))
7188 (setq is-younger (time-less-p
7189 (time-since (condition-case ()
7196 (push (gnus-data-number d) articles))))
7197 (gnus-summary-limit (nreverse articles)))
7198 (gnus-summary-position-point)))
7200 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7201 "Limit the summary buffer to articles that match an 'extra' header."
7205 (gnus-completing-read-with-default
7206 (symbol-name (car gnus-extra-headers))
7207 (if current-prefix-arg
7208 "Exclude extra header:"
7209 "Limit extra header:")
7211 (cons (symbol-name x) x))
7216 (read-string (format "%s header %s (regexp): "
7217 (if current-prefix-arg "Exclude" "Limit to")
7219 current-prefix-arg)))
7220 (when (not (equal "" regexp))
7222 (let ((articles (gnus-summary-find-matching
7223 (cons 'extra header) regexp 'all nil nil
7226 (error "Found no matches for \"%s\"" regexp))
7227 (gnus-summary-limit articles))
7228 (gnus-summary-position-point))))
7230 (defun gnus-summary-limit-to-display-predicate ()
7231 "Limit the summary buffer to the predicated in the `display' group parameter."
7233 (unless gnus-newsgroup-display
7234 (error "There is no `display' group parameter"))
7236 (dolist (number gnus-newsgroup-articles)
7237 (when (funcall gnus-newsgroup-display)
7238 (push number articles)))
7239 (gnus-summary-limit articles))
7240 (gnus-summary-position-point))
7242 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7244 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7246 (defun gnus-summary-limit-to-unread (&optional all)
7247 "Limit the summary buffer to articles that are not marked as read.
7248 If ALL is non-nil, limit strictly to unread articles."
7251 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7252 (gnus-summary-limit-to-marks
7253 ;; Concat all the marks that say that an article is read and have
7255 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7256 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7257 gnus-low-score-mark gnus-expirable-mark
7258 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7259 gnus-duplicate-mark gnus-souped-mark)
7262 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7263 (make-obsolete 'gnus-summary-delete-marked-with
7264 'gnus-summary-limit-exclude-marks)
7266 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7267 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7268 If REVERSE, limit the summary buffer to articles that are marked
7269 with MARKS. MARKS can either be a string of marks or a list of marks.
7270 Returns how many articles were removed."
7271 (interactive "sMarks: ")
7272 (gnus-summary-limit-to-marks marks t))
7274 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7275 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7276 If REVERSE (the prefix), limit the summary buffer to articles that are
7277 not marked with MARKS. MARKS can either be a string of marks or a
7279 Returns how many articles were removed."
7280 (interactive "sMarks: \nP")
7282 (let ((data gnus-newsgroup-data)
7283 (marks (if (listp marks) marks
7284 (append marks nil))) ; Transform to list.
7287 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7288 (memq (gnus-data-mark (car data)) marks))
7289 (push (gnus-data-number (car data)) articles))
7290 (setq data (cdr data)))
7291 (gnus-summary-limit articles))
7292 (gnus-summary-position-point)))
7294 (defun gnus-summary-limit-to-score (score)
7295 "Limit to articles with score at or above SCORE."
7296 (interactive "NLimit to articles with score of at least: ")
7297 (let ((data gnus-newsgroup-data)
7300 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7302 (push (gnus-data-number (car data)) articles))
7303 (setq data (cdr data)))
7305 (gnus-summary-limit articles)
7306 (gnus-summary-position-point))))
7308 (defun gnus-summary-limit-include-thread (id)
7309 "Display all the hidden articles that is in the thread with ID in it.
7310 When called interactively, ID is the Message-ID of the current
7312 (interactive (list (mail-header-id (gnus-summary-article-header))))
7313 (let ((articles (gnus-articles-in-thread
7314 (gnus-id-to-thread (gnus-root-id id)))))
7316 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7317 (gnus-summary-limit-include-matching-articles
7319 (regexp-quote (gnus-simplify-subject-re
7320 (mail-header-subject (gnus-id-to-header id)))))
7321 (gnus-summary-position-point))))
7323 (defun gnus-summary-limit-include-matching-articles (header regexp)
7324 "Display all the hidden articles that have HEADERs that match REGEXP."
7325 (interactive (list (read-string "Match on header: ")
7326 (read-string "Regexp: ")))
7327 (let ((articles (gnus-find-matching-articles header regexp)))
7329 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7330 (gnus-summary-position-point))))
7332 (defun gnus-summary-limit-include-dormant ()
7333 "Display all the hidden articles that are marked as dormant.
7334 Note that this command only works on a subset of the articles currently
7335 fetched for this group."
7337 (unless gnus-newsgroup-dormant
7338 (error "There are no dormant articles in this group"))
7340 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7341 (gnus-summary-position-point)))
7343 (defun gnus-summary-limit-exclude-dormant ()
7344 "Hide all dormant articles."
7347 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7348 (gnus-summary-position-point)))
7350 (defun gnus-summary-limit-exclude-childless-dormant ()
7351 "Hide all dormant articles that have no children."
7353 (let ((data (gnus-data-list t))
7354 articles d children)
7355 ;; Find all articles that are either not dormant or have
7357 (while (setq d (pop data))
7358 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7360 (gnus-article-children (gnus-data-number d)))
7363 (when (memq (car children) articles)
7368 (push (gnus-data-number d) articles)))
7371 (gnus-summary-limit articles)
7372 (gnus-summary-position-point))))
7374 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7375 "Mark all unread excluded articles as read.
7376 If ALL, mark even excluded ticked and dormants as read."
7378 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7379 (let ((articles (gnus-sorted-ndifference
7381 (mapcar (lambda (h) (mail-header-number h))
7382 gnus-newsgroup-headers)
7384 gnus-newsgroup-limit))
7386 (setq gnus-newsgroup-unreads
7387 (gnus-sorted-intersection gnus-newsgroup-unreads
7388 gnus-newsgroup-limit))
7390 (setq gnus-newsgroup-dormant nil
7391 gnus-newsgroup-marked nil
7392 gnus-newsgroup-reads
7394 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7395 gnus-newsgroup-reads))
7396 (while (setq article (pop articles))
7397 (unless (or (memq article gnus-newsgroup-dormant)
7398 (memq article gnus-newsgroup-marked))
7399 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7401 (defun gnus-summary-limit (articles &optional pop)
7403 ;; We pop the previous limit off the stack and use that.
7404 (setq articles (car gnus-newsgroup-limits)
7405 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7406 ;; We use the new limit, so we push the old limit on the stack.
7407 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7409 (setq gnus-newsgroup-limit articles)
7410 (let ((total (length gnus-newsgroup-data))
7411 (data (gnus-data-find-list (gnus-summary-article-number)))
7412 (gnus-summary-mark-below nil) ; Inhibit this.
7414 ;; This will do all the work of generating the new summary buffer
7415 ;; according to the new limit.
7416 (gnus-summary-prepare)
7417 ;; Hide any threads, possibly.
7418 (gnus-summary-maybe-hide-threads)
7419 ;; Try to return to the article you were at, or one in the
7422 ;; We try to find some article after the current one.
7424 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7427 (setq data (cdr data))))
7429 ;; If there is no data, that means that we were after the last
7430 ;; article. The same goes when we can't find any articles
7431 ;; after the current one.
7432 (goto-char (point-max))
7433 (gnus-summary-find-prev))
7434 (gnus-set-mode-line 'summary)
7435 ;; We return how many articles were removed from the summary
7436 ;; buffer as a result of the new limit.
7437 (- total (length gnus-newsgroup-data))))
7439 (defsubst gnus-invisible-cut-children (threads)
7442 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7447 (defsubst gnus-cut-thread (thread)
7448 "Go forwards in the thread until we find an article that we want to display."
7449 (when (or (eq gnus-fetch-old-headers 'some)
7450 (eq gnus-fetch-old-headers 'invisible)
7451 (numberp gnus-fetch-old-headers)
7452 (eq gnus-build-sparse-threads 'some)
7453 (eq gnus-build-sparse-threads 'more))
7454 ;; Deal with old-fetched headers and sparse threads.
7458 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7459 (gnus-summary-article-ancient-p
7460 (mail-header-number (car thread))))
7461 (if (or (<= (length (cdr thread)) 1)
7462 (eq gnus-fetch-old-headers 'invisible))
7463 (setq gnus-newsgroup-limit
7464 (delq (mail-header-number (car thread))
7465 gnus-newsgroup-limit)
7466 thread (cadr thread))
7467 (when (gnus-invisible-cut-children (cdr thread))
7468 (let ((th (cdr thread)))
7470 (if (memq (mail-header-number (caar th))
7471 gnus-newsgroup-limit)
7472 (setq thread (car th)
7474 (setq th (cdr th))))))))))
7477 (defun gnus-cut-threads (threads)
7478 "Cut off all uninteresting articles from the beginning of threads."
7479 (when (or (eq gnus-fetch-old-headers 'some)
7480 (eq gnus-fetch-old-headers 'invisible)
7481 (numberp gnus-fetch-old-headers)
7482 (eq gnus-build-sparse-threads 'some)
7483 (eq gnus-build-sparse-threads 'more))
7486 (setcar th (gnus-cut-thread (car th)))
7487 (setq th (cdr th)))))
7488 ;; Remove nixed out threads.
7491 (defun gnus-summary-initial-limit (&optional show-if-empty)
7492 "Figure out what the initial limit is supposed to be on group entry.
7493 This entails weeding out unwanted dormants, low-scored articles,
7494 fetch-old-headers verbiage, and so on."
7495 ;; Most groups have nothing to remove.
7496 (if (or gnus-inhibit-limiting
7497 (and (null gnus-newsgroup-dormant)
7498 (eq gnus-newsgroup-display 'gnus-not-ignore)
7499 (not (eq gnus-fetch-old-headers 'some))
7500 (not (numberp gnus-fetch-old-headers))
7501 (not (eq gnus-fetch-old-headers 'invisible))
7502 (null gnus-summary-expunge-below)
7503 (not (eq gnus-build-sparse-threads 'some))
7504 (not (eq gnus-build-sparse-threads 'more))
7505 (null gnus-thread-expunge-below)
7506 (not gnus-use-nocem)))
7508 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7509 (setq gnus-newsgroup-limit nil)
7512 (unless (car (symbol-value node))
7513 ;; These threads have no parents -- they are roots.
7514 (let ((nodes (cdr (symbol-value node)))
7517 (if (and gnus-thread-expunge-below
7518 (< (gnus-thread-total-score (car nodes))
7519 gnus-thread-expunge-below))
7520 (gnus-expunge-thread (pop nodes))
7521 (setq thread (pop nodes))
7522 (gnus-summary-limit-children thread))))))
7523 gnus-newsgroup-dependencies)
7524 ;; If this limitation resulted in an empty group, we might
7525 ;; pop the previous limit and use it instead.
7526 (when (and (not gnus-newsgroup-limit)
7528 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7529 gnus-newsgroup-limit))
7531 (defun gnus-summary-limit-children (thread)
7532 "Return 1 if this subthread is visible and 0 if it is not."
7533 ;; First we get the number of visible children to this thread. This
7534 ;; is done by recursing down the thread using this function, so this
7535 ;; will really go down to a leaf article first, before slowly
7536 ;; working its way up towards the root.
7540 (apply '+ (mapcar 'gnus-summary-limit-children
7543 (number (mail-header-number (car thread)))
7546 (not (memq number gnus-newsgroup-marked))
7548 ;; If this article is dormant and has absolutely no visible
7549 ;; children, then this article isn't visible.
7550 (and (memq number gnus-newsgroup-dormant)
7552 ;; If this is "fetch-old-headered" and there is no
7553 ;; visible children, then we don't want this article.
7554 (and (or (eq gnus-fetch-old-headers 'some)
7555 (numberp gnus-fetch-old-headers))
7556 (gnus-summary-article-ancient-p number)
7558 ;; If this is "fetch-old-headered" and `invisible', then
7559 ;; we don't want this article.
7560 (and (eq gnus-fetch-old-headers 'invisible)
7561 (gnus-summary-article-ancient-p number))
7562 ;; If this is a sparsely inserted article with no children,
7563 ;; we don't want it.
7564 (and (eq gnus-build-sparse-threads 'some)
7565 (gnus-summary-article-sparse-p number)
7567 ;; If we use expunging, and this article is really
7568 ;; low-scored, then we don't want this article.
7569 (when (and gnus-summary-expunge-below
7571 (or (cdr (assq number gnus-newsgroup-scored))
7572 gnus-summary-default-score))
7573 gnus-summary-expunge-below))
7574 ;; We increase the expunge-tally here, but that has
7575 ;; nothing to do with the limits, really.
7576 (incf gnus-newsgroup-expunged-tally)
7577 ;; We also mark as read here, if that's wanted.
7578 (when (and gnus-summary-mark-below
7579 (< score gnus-summary-mark-below))
7580 (setq gnus-newsgroup-unreads
7581 (delq number gnus-newsgroup-unreads))
7582 (if gnus-newsgroup-auto-expire
7583 (push number gnus-newsgroup-expirable)
7584 (push (cons number gnus-low-score-mark)
7585 gnus-newsgroup-reads)))
7587 ;; Do the `display' group parameter.
7588 (and gnus-newsgroup-display
7589 (not (funcall gnus-newsgroup-display)))
7590 ;; Check NoCeM things.
7591 (if (and gnus-use-nocem
7592 (gnus-nocem-unwanted-article-p
7593 (mail-header-id (car thread))))
7595 (setq gnus-newsgroup-unreads
7596 (delq number gnus-newsgroup-unreads))
7598 ;; Nope, invisible article.
7600 ;; Ok, this article is to be visible, so we add it to the limit
7602 (push number gnus-newsgroup-limit)
7605 (defun gnus-expunge-thread (thread)
7606 "Mark all articles in THREAD as read."
7607 (let* ((number (mail-header-number (car thread))))
7608 (incf gnus-newsgroup-expunged-tally)
7609 ;; We also mark as read here, if that's wanted.
7610 (setq gnus-newsgroup-unreads
7611 (delq number gnus-newsgroup-unreads))
7612 (if gnus-newsgroup-auto-expire
7613 (push number gnus-newsgroup-expirable)
7614 (push (cons number gnus-low-score-mark)
7615 gnus-newsgroup-reads)))
7616 ;; Go recursively through all subthreads.
7617 (mapcar 'gnus-expunge-thread (cdr thread)))
7619 ;; Summary article oriented commands
7621 (defun gnus-summary-refer-parent-article (n)
7622 "Refer parent article N times.
7623 If N is negative, go to ancestor -N instead.
7624 The difference between N and the number of articles fetched is returned."
7628 (when (not (natnump n))
7633 (setq header (gnus-summary-article-header))
7634 (if (and (eq (mail-header-number header)
7635 (cdr gnus-article-current))
7636 (equal gnus-newsgroup-name
7637 (car gnus-article-current)))
7638 ;; If we try to find the parent of the currently
7639 ;; displayed article, then we take a look at the actual
7640 ;; References header, since this is slightly more
7641 ;; reliable than the References field we got from the
7644 (set-buffer gnus-original-article-buffer)
7645 (nnheader-narrow-to-headers)
7646 (unless (setq ref (message-fetch-field "references"))
7647 (setq ref (message-fetch-field "in-reply-to")))
7650 ;; It's not the current article, so we take a bet on
7651 ;; the value we got from the server.
7652 (mail-header-references header)))
7654 (not (equal ref "")))
7655 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
7656 (gnus-message 1 "Couldn't find parent"))
7657 (gnus-message 1 "No references in article %d"
7658 (gnus-summary-article-number))
7661 (gnus-summary-position-point)
7664 (defun gnus-summary-refer-references ()
7665 "Fetch all articles mentioned in the References header.
7666 Return the number of articles fetched."
7668 (let ((ref (mail-header-references (gnus-summary-article-header)))
7669 (current (gnus-summary-article-number))
7673 (error "No References in the current article")
7674 ;; For each Message-ID in the References header...
7675 (while (string-match "<[^>]*>" ref)
7677 ;; ... fetch that article.
7678 (gnus-summary-refer-article
7679 (prog1 (match-string 0 ref)
7680 (setq ref (substring ref (match-end 0))))))
7681 (gnus-summary-goto-subject current)
7682 (gnus-summary-position-point)
7685 (defun gnus-summary-refer-thread (&optional limit)
7686 "Fetch all articles in the current thread.
7687 If LIMIT (the numerical prefix), fetch that many old headers instead
7688 of what's specified by the `gnus-refer-thread-limit' variable."
7690 (let ((id (mail-header-id (gnus-summary-article-header)))
7691 (limit (if limit (prefix-numeric-value limit)
7692 gnus-refer-thread-limit)))
7693 ;; We want to fetch LIMIT *old* headers, but we also have to
7694 ;; re-fetch all the headers in the current buffer, because many of
7695 ;; them may be undisplayed. So we adjust LIMIT.
7696 (when (numberp limit)
7697 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
7698 (unless (eq gnus-fetch-old-headers 'invisible)
7699 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
7700 ;; Retrieve the headers and read them in.
7701 (if (eq (gnus-retrieve-headers
7702 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
7704 (gnus-build-all-threads)
7705 (error "Can't fetch thread from backends that don't support NOV"))
7706 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
7707 (gnus-summary-limit-include-thread id)))
7709 (defun gnus-summary-refer-article (message-id)
7710 "Fetch an article specified by MESSAGE-ID."
7711 (interactive "sMessage-ID: ")
7712 (when (and (stringp message-id)
7713 (not (zerop (length message-id))))
7714 ;; Construct the correct Message-ID if necessary.
7715 ;; Suggested by tale@pawl.rpi.edu.
7716 (unless (string-match "^<" message-id)
7717 (setq message-id (concat "<" message-id)))
7718 (unless (string-match ">$" message-id)
7719 (setq message-id (concat message-id ">")))
7720 (let* ((header (gnus-id-to-header message-id))
7722 (gnus-summary-article-sparse-p
7723 (mail-header-number header))
7724 (memq (mail-header-number header)
7725 gnus-newsgroup-limit)))
7728 ;; If the article is present in the buffer we just go to it.
7730 (or (not (gnus-summary-article-sparse-p
7731 (mail-header-number header)))
7734 (gnus-summary-goto-article
7735 (mail-header-number header) nil t)
7737 (gnus-summary-update-article (mail-header-number header)))))
7739 ;; We fetch the article.
7741 (dolist (gnus-override-method (gnus-refer-article-methods))
7742 (gnus-check-server gnus-override-method)
7743 ;; Fetch the header, and display the article.
7744 (when (setq number (gnus-summary-insert-subject message-id))
7745 (gnus-summary-select-article nil nil nil number)
7747 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
7749 (defun gnus-refer-article-methods ()
7750 "Return a list of referrable methods."
7752 ;; No method, so we default to current and native.
7753 ((null gnus-refer-article-method)
7754 (list gnus-current-select-method gnus-select-method))
7756 ((eq 'current gnus-refer-article-method)
7757 (list gnus-current-select-method))
7758 ;; List of select methods.
7759 ((not (and (symbolp (car gnus-refer-article-method))
7760 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
7762 (dolist (method gnus-refer-article-method)
7763 (push (if (eq 'current method)
7764 gnus-current-select-method
7768 ;; One single select method.
7770 (list gnus-refer-article-method))))
7772 (defun gnus-summary-edit-parameters ()
7773 "Edit the group parameters of the current group."
7775 (gnus-group-edit-group gnus-newsgroup-name 'params))
7777 (defun gnus-summary-customize-parameters ()
7778 "Customize the group parameters of the current group."
7780 (gnus-group-customize gnus-newsgroup-name))
7782 (defun gnus-summary-enter-digest-group (&optional force)
7783 "Enter an nndoc group based on the current article.
7784 If FORCE, force a digest interpretation. If not, try
7785 to guess what the document format is."
7787 (let ((conf gnus-current-window-configuration))
7789 (gnus-summary-select-article))
7790 (setq gnus-current-window-configuration conf)
7791 (let* ((name (format "%s-%d"
7792 (gnus-group-prefixed-name
7793 gnus-newsgroup-name (list 'nndoc ""))
7795 (set-buffer gnus-summary-buffer)
7796 gnus-current-article)))
7797 (ogroup gnus-newsgroup-name)
7798 (params (append (gnus-info-params (gnus-get-info ogroup))
7799 (list (cons 'to-group ogroup))
7800 (list (cons 'save-article-group ogroup))))
7801 (case-fold-search t)
7802 (buf (current-buffer))
7805 (set-buffer gnus-original-article-buffer)
7806 ;; Have the digest group inherit the main mail address of
7807 ;; the parent article.
7808 (when (setq to-address (or (message-fetch-field "reply-to")
7809 (message-fetch-field "from")))
7810 (setq params (append
7811 (list (cons 'to-address
7812 (funcall gnus-decode-encoded-word-function
7814 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
7815 (insert-buffer-substring gnus-original-article-buffer)
7816 ;; Remove lines that may lead nndoc to misinterpret the
7819 (goto-char (point-min))
7820 (or (search-forward "\n\n" nil t) (point)))
7821 (goto-char (point-min))
7822 (delete-matching-lines "^Path:\\|^From ")
7825 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
7826 (gnus-newsgroup-ephemeral-ignored-charsets
7827 gnus-newsgroup-ignored-charsets))
7828 (gnus-group-read-ephemeral-group
7829 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
7831 ,(if force 'mbox 'guess)))
7833 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
7835 ;; Make all postings to this group go to the parent group.
7836 (nconc (gnus-info-params (gnus-get-info name))
7838 ;; Couldn't select this doc group.
7839 (switch-to-buffer buf)
7840 (gnus-set-global-variables)
7841 (gnus-configure-windows 'summary)
7842 (gnus-message 3 "Article couldn't be entered?"))
7843 (kill-buffer dig)))))
7845 (defun gnus-summary-read-document (n)
7846 "Open a new group based on the current article(s).
7847 This will allow you to read digests and other similar
7848 documents as newsgroups.
7849 Obeys the standard process/prefix convention."
7851 (let* ((articles (gnus-summary-work-articles n))
7852 (ogroup gnus-newsgroup-name)
7853 (params (append (gnus-info-params (gnus-get-info ogroup))
7854 (list (cons 'to-group ogroup))))
7855 article group egroup groups vgroup)
7856 (while (setq article (pop articles))
7857 (setq group (format "%s-%d" gnus-newsgroup-name article))
7858 (gnus-summary-remove-process-mark article)
7859 (when (gnus-summary-display-article article)
7862 (insert-buffer-substring gnus-original-article-buffer)
7863 ;; Remove some headers that may lead nndoc to make
7865 (message-narrow-to-head)
7866 (goto-char (point-min))
7867 (delete-matching-lines "^\\(Path\\):\\|^From ")
7870 (gnus-group-read-ephemeral-group
7871 group `(nndoc ,group (nndoc-address ,(current-buffer))
7872 (nndoc-article-type guess))
7875 ;; Make all postings to this group go to the parent group.
7876 (nconc (gnus-info-params (gnus-get-info egroup))
7878 (push egroup groups))
7879 ;; Couldn't select this doc group.
7880 (gnus-error 3 "Article couldn't be entered"))))))
7881 ;; Now we have selected all the documents.
7884 (error "None of the articles could be interpreted as documents"))
7885 ((gnus-group-read-ephemeral-group
7886 (setq vgroup (format
7887 "nnvirtual:%s-%s" gnus-newsgroup-name
7888 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7889 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
7891 (cons (current-buffer) 'summary)))
7893 (error "Couldn't select virtual nndoc group")))))
7895 (defun gnus-summary-isearch-article (&optional regexp-p)
7896 "Do incremental search forward on the current article.
7897 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7899 (gnus-summary-select-article)
7900 (gnus-configure-windows 'article)
7901 (gnus-eval-in-buffer-window gnus-article-buffer
7904 (isearch-forward regexp-p))))
7906 (defun gnus-summary-search-article-forward (regexp &optional backward)
7907 "Search for an article containing REGEXP forward.
7908 If BACKWARD, search backward instead."
7911 (format "Search article %s (regexp%s): "
7912 (if current-prefix-arg "backward" "forward")
7913 (if gnus-last-search-regexp
7914 (concat ", default " gnus-last-search-regexp)
7916 current-prefix-arg))
7917 (if (string-equal regexp "")
7918 (setq regexp (or gnus-last-search-regexp ""))
7919 (setq gnus-last-search-regexp regexp)
7920 (setq gnus-article-before-search gnus-current-article))
7921 ;; Intentionally set gnus-last-article.
7922 (setq gnus-last-article gnus-article-before-search)
7923 (let ((gnus-last-article gnus-last-article))
7924 (if (gnus-summary-search-article regexp backward)
7925 (gnus-summary-show-thread)
7926 (error "Search failed: \"%s\"" regexp))))
7928 (defun gnus-summary-search-article-backward (regexp)
7929 "Search for an article containing REGEXP backward."
7932 (format "Search article backward (regexp%s): "
7933 (if gnus-last-search-regexp
7934 (concat ", default " gnus-last-search-regexp)
7936 (gnus-summary-search-article-forward regexp 'backward))
7938 (defun gnus-summary-search-article (regexp &optional backward)
7939 "Search for an article containing REGEXP.
7940 Optional argument BACKWARD means do search for backward.
7941 `gnus-select-article-hook' is not called during the search."
7942 ;; We have to require this here to make sure that the following
7943 ;; dynamic binding isn't shadowed by autoloading.
7944 (require 'gnus-async)
7946 (let ((gnus-select-article-hook nil) ;Disable hook.
7947 (gnus-article-prepare-hook nil)
7948 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7949 (gnus-use-article-prefetch nil)
7950 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7951 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7952 (sum (current-buffer))
7953 (gnus-display-mime-function nil)
7956 (gnus-save-hidden-threads
7957 (gnus-summary-select-article)
7958 (set-buffer gnus-article-buffer)
7959 (goto-char (window-point (get-buffer-window (current-buffer))))
7963 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7965 (re-search-backward regexp nil t)
7966 (re-search-forward regexp nil t))
7967 ;; We found the regexp.
7972 (get-buffer-window (current-buffer))
7976 (get-buffer-window (current-buffer))
7979 (setq point (point)))
7980 ;; We didn't find it, so we go to the next article.
7983 (while (eq found 'not)
7984 (if (not (if backward (gnus-summary-find-prev)
7985 (gnus-summary-find-next)))
7986 ;; No more articles.
7988 ;; Select the next article and adjust point.
7989 (unless (gnus-summary-article-sparse-p
7990 (gnus-summary-article-number))
7992 (gnus-summary-select-article)
7993 (set-buffer gnus-article-buffer)
7995 (goto-char (if backward (point-max) (point-min))))))))
7996 (gnus-message 7 ""))
7997 ;; Return whether we found the regexp.
7998 (when (eq found 'found)
8000 (gnus-summary-show-thread)
8001 (gnus-summary-goto-subject gnus-current-article)
8002 (gnus-summary-position-point)
8005 (defun gnus-find-matching-articles (header regexp)
8006 "Return a list of all articles that match REGEXP on HEADER.
8007 This search includes all articles in the current group that Gnus has
8008 fetched headers for, whether they are displayed or not."
8009 (let ((articles nil)
8010 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8011 (case-fold-search t))
8012 (dolist (header gnus-newsgroup-headers)
8013 (when (string-match regexp (funcall func header))
8014 (push (mail-header-number header) articles)))
8015 (nreverse articles)))
8017 (defun gnus-summary-find-matching (header regexp &optional backward unread
8018 not-case-fold not-matching)
8019 "Return a list of all articles that match REGEXP on HEADER.
8020 The search stars on the current article and goes forwards unless
8021 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8022 If UNREAD is non-nil, only unread articles will
8023 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8024 in the comparisons. If NOT-MATCHING, return a list of all articles that
8025 not match REGEXP on HEADER."
8026 (let ((case-fold-search (not not-case-fold))
8029 (if (eq (car header) 'extra)
8032 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8034 (error "%s is an invalid header" header))
8035 (unless (fboundp (intern (concat "mail-header-" header)))
8036 (error "%s is not a valid header" header))
8037 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8038 (dolist (d (if (eq backward 'all)
8040 (gnus-data-find-list
8041 (gnus-summary-article-number)
8042 (gnus-data-list backward))))
8043 (when (and (or (not unread) ; We want all articles...
8044 (gnus-data-unread-p d)) ; Or just unreads.
8045 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8049 (funcall func (gnus-data-header d))))
8050 (string-match regexp
8051 (funcall func (gnus-data-header d)))))
8052 (push (gnus-data-number d) articles))) ; Success!
8053 (nreverse articles)))
8055 (defun gnus-summary-execute-command (header regexp command &optional backward)
8056 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8057 If HEADER is an empty string (or nil), the match is done on the entire
8058 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8060 (list (let ((completion-ignore-case t))
8063 (mapcar (lambda (header) (list (format "%s" header)))
8065 '("Number" "Subject" "From" "Lines" "Date"
8066 "Message-ID" "Xref" "References" "Body")
8067 gnus-extra-headers))
8068 nil 'require-match))
8069 (read-string "Regexp: ")
8070 (read-key-sequence "Command: ")
8071 current-prefix-arg))
8072 (when (equal header "Body")
8074 ;; Hidden thread subtrees must be searched as well.
8075 (gnus-summary-show-all-threads)
8076 ;; We don't want to change current point nor window configuration.
8078 (save-window-excursion
8079 (gnus-message 6 "Executing %s..." (key-description command))
8080 ;; We'd like to execute COMMAND interactively so as to give arguments.
8081 (gnus-execute header regexp
8082 `(call-interactively ',(key-binding command))
8084 (gnus-message 6 "Executing %s...done" (key-description command)))))
8086 (defun gnus-summary-beginning-of-article ()
8087 "Scroll the article back to the beginning."
8089 (gnus-summary-select-article)
8090 (gnus-configure-windows 'article)
8091 (gnus-eval-in-buffer-window gnus-article-buffer
8093 (goto-char (point-min))
8094 (when gnus-page-broken
8095 (gnus-narrow-to-page))))
8097 (defun gnus-summary-end-of-article ()
8098 "Scroll to the end of the article."
8100 (gnus-summary-select-article)
8101 (gnus-configure-windows 'article)
8102 (gnus-eval-in-buffer-window gnus-article-buffer
8104 (goto-char (point-max))
8106 (when gnus-page-broken
8107 (gnus-narrow-to-page))))
8109 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8110 "Truncate to LEN and quote all \"(\"'s in STRING."
8111 (gnus-replace-in-string (if (and len (> (length string) len))
8112 (substring string 0 len)
8116 (defun gnus-summary-print-article (&optional filename n)
8117 "Generate and print a PostScript image of the N next (mail) articles.
8119 If N is negative, print the N previous articles. If N is nil and articles
8120 have been marked with the process mark, print these instead.
8122 If the optional first argument FILENAME is nil, send the image to the
8123 printer. If FILENAME is a string, save the PostScript image in a file with
8124 that name. If FILENAME is a number, prompt the user for the name of the file
8126 (interactive (list (ps-print-preprint current-prefix-arg)))
8127 (dolist (article (gnus-summary-work-articles n))
8128 (gnus-summary-select-article nil nil 'pseudo article)
8129 (gnus-eval-in-buffer-window gnus-article-buffer
8130 (gnus-print-buffer))
8131 (gnus-summary-remove-process-mark article))
8132 (ps-despool filename))
8134 (defun gnus-print-buffer ()
8135 (let ((buffer (generate-new-buffer " *print*")))
8138 (copy-to-buffer buffer (point-min) (point-max))
8140 (gnus-article-delete-invisible-text)
8141 (gnus-remove-text-with-property 'gnus-decoration)
8142 (when (gnus-visual-p 'article-highlight 'highlight)
8143 ;; Copy-to-buffer doesn't copy overlay. So redo
8145 (let ((gnus-article-buffer buffer))
8146 (gnus-article-highlight-citation t)
8147 (gnus-article-highlight-signature)))
8148 (let ((ps-left-header
8151 (gnus-summary-print-truncate-and-quote
8152 (mail-header-subject gnus-current-headers)
8155 (gnus-summary-print-truncate-and-quote
8156 (mail-header-from gnus-current-headers)
8160 "/pagenumberstring load"
8162 (mail-header-date gnus-current-headers) ")"))))
8163 (gnus-run-hooks 'gnus-ps-print-hook)
8166 (ps-spool-buffer-with-faces)
8167 (ps-spool-buffer)))))
8168 (kill-buffer buffer))))
8170 (defun gnus-summary-show-article (&optional arg)
8171 "Force redisplaying of the current article.
8172 If ARG (the prefix) is a number, show the article with the charset
8173 defined in `gnus-summary-show-article-charset-alist', or the charset
8175 If ARG (the prefix) is non-nil and not a number, show the raw article
8176 without any article massaging functions being run. Normally, the key strokes
8181 (gnus-summary-show-article t)
8182 (let ((gnus-newsgroup-charset
8183 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8184 (mm-read-coding-system
8185 "View as charset: " ;; actually it is coding system.
8187 (set-buffer gnus-article-buffer)
8188 (mm-detect-coding-region (point) (point-max))))))
8189 (gnus-newsgroup-ignored-charsets 'gnus-all))
8190 (gnus-summary-select-article nil 'force)
8191 (let ((deps gnus-newsgroup-dependencies)
8194 (set-buffer gnus-original-article-buffer)
8196 (message-narrow-to-head)
8197 (setq head (buffer-string))
8198 (goto-char (point-min))
8199 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8200 (goto-char (point-max))
8202 (setq lines (1- (count-lines (point) (point-max))))))
8204 (insert (format "211 %d Article retrieved.\n"
8205 (cdr gnus-article-current)))
8207 (if lines (insert (format "Lines: %d\n" lines)))
8209 (let ((nntp-server-buffer (current-buffer)))
8210 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8211 (gnus-data-set-header
8212 (gnus-data-find (cdr gnus-article-current))
8214 (gnus-summary-update-article-line
8215 (cdr gnus-article-current) header)
8216 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8217 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8219 ;; Select the article the normal way.
8220 (gnus-summary-select-article nil 'force))
8222 ;; We have to require this here to make sure that the following
8223 ;; dynamic binding isn't shadowed by autoloading.
8224 (require 'gnus-async)
8226 ;; Bind the article treatment functions to nil.
8227 (let ((gnus-have-all-headers t)
8228 gnus-article-prepare-hook
8229 gnus-article-decode-hook
8230 gnus-display-mime-function
8232 ;; Destroy any MIME parts.
8233 (when (gnus-buffer-live-p gnus-article-buffer)
8235 (set-buffer gnus-article-buffer)
8236 (mm-destroy-parts gnus-article-mime-handles)
8237 ;; Set it to nil for safety reason.
8238 (setq gnus-article-mime-handle-alist nil)
8239 (setq gnus-article-mime-handles nil)))
8240 (gnus-summary-select-article nil 'force))))
8241 (gnus-summary-goto-subject gnus-current-article)
8242 (gnus-summary-position-point))
8244 (defun gnus-summary-show-raw-article ()
8245 "Show the raw article without any article massaging functions being run."
8247 (gnus-summary-show-article t))
8249 (defun gnus-summary-verbose-headers (&optional arg)
8250 "Toggle permanent full header display.
8251 If ARG is a positive number, turn header display on.
8252 If ARG is a negative number, turn header display off."
8254 (setq gnus-show-all-headers
8255 (cond ((or (not (numberp arg))
8257 (not gnus-show-all-headers))
8260 (gnus-summary-show-article))
8262 (defun gnus-summary-toggle-header (&optional arg)
8263 "Show the headers if they are hidden, or hide them if they are shown.
8264 If ARG is a positive number, show the entire header.
8265 If ARG is a negative number, hide the unwanted header lines."
8268 (set-buffer gnus-article-buffer)
8270 (let* ((buffer-read-only nil)
8271 (inhibit-point-motion-hooks t)
8274 (article-narrow-to-head)
8276 hidden (if (numberp arg)
8278 (gnus-article-hidden-text-p 'headers))))
8279 (delete-region (point-min) e)
8280 (goto-char (point-min))
8281 (with-current-buffer gnus-original-article-buffer
8282 (goto-char (setq s (point-min)))
8283 (setq e (search-forward "\n\n" nil t)
8284 e (if e (1- e) (point-max))))
8285 (insert-buffer-substring gnus-original-article-buffer s e)
8287 (narrow-to-region (point-min) (point))
8288 (article-decode-encoded-words)
8290 (let ((gnus-treat-hide-headers nil)
8291 (gnus-treat-hide-boring-headers nil))
8292 (gnus-delete-wash-type 'headers)
8293 (gnus-treat-article 'head))
8294 (gnus-treat-article 'head)))
8295 (gnus-set-mode-line 'article)))))
8297 (defun gnus-summary-show-all-headers ()
8298 "Make all header lines visible."
8300 (gnus-summary-toggle-header 1))
8302 (defun gnus-summary-caesar-message (&optional arg)
8303 "Caesar rotate the current article by 13.
8304 The numerical prefix specifies how many places to rotate each letter
8307 (gnus-summary-select-article)
8308 (let ((mail-header-separator ""))
8309 (gnus-eval-in-buffer-window gnus-article-buffer
8312 (let ((start (window-start))
8314 (message-caesar-buffer-body arg)
8315 (set-window-start (get-buffer-window (current-buffer)) start))))))
8317 (defun gnus-summary-stop-page-breaking ()
8318 "Stop page breaking in the current article."
8320 (gnus-summary-select-article)
8321 (gnus-eval-in-buffer-window gnus-article-buffer
8323 (when (gnus-visual-p 'page-marker)
8324 (let ((buffer-read-only nil))
8325 (gnus-remove-text-with-property 'gnus-prev)
8326 (gnus-remove-text-with-property 'gnus-next))
8327 (setq gnus-page-broken nil))))
8329 (defun gnus-summary-move-article (&optional n to-newsgroup
8330 select-method action)
8331 "Move the current article to a different newsgroup.
8332 If N is a positive number, move the N next articles.
8333 If N is a negative number, move the N previous articles.
8334 If N is nil and any articles have been marked with the process mark,
8335 move those articles instead.
8336 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8337 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8338 re-spool using this method.
8340 When called interactively with TO-NEWSGROUP being nil, the value of
8341 the variable `gnus-move-split-methods' is used for finding a default
8342 for the target newsgroup.
8344 For this function to work, both the current newsgroup and the
8345 newsgroup that you want to move to have to support the `request-move'
8346 and `request-accept' functions.
8348 ACTION can be either `move' (the default), `crosspost' or `copy'."
8351 (setq action 'move))
8352 ;; Check whether the source group supports the required functions.
8353 (cond ((and (eq action 'move)
8354 (not (gnus-check-backend-function
8355 'request-move-article gnus-newsgroup-name)))
8356 (error "The current group does not support article moving"))
8357 ((and (eq action 'crosspost)
8358 (not (gnus-check-backend-function
8359 'request-replace-article gnus-newsgroup-name)))
8360 (error "The current group does not support article editing")))
8361 (let ((articles (gnus-summary-work-articles n))
8362 (prefix (if (gnus-check-backend-function
8363 'request-move-article gnus-newsgroup-name)
8364 (gnus-group-real-prefix gnus-newsgroup-name)
8366 (names '((move "Move" "Moving")
8367 (copy "Copy" "Copying")
8368 (crosspost "Crosspost" "Crossposting")))
8369 (copy-buf (save-excursion
8370 (nnheader-set-temp-buffer " *copy article*")))
8371 art-group to-method new-xref article to-groups)
8372 (unless (assq action names)
8373 (error "Unknown action %s" action))
8374 ;; Read the newsgroup name.
8375 (when (and (not to-newsgroup)
8376 (not select-method))
8377 (if (and gnus-move-split-methods
8379 (and (memq gnus-current-article articles)
8380 (gnus-buffer-live-p gnus-original-article-buffer))))
8381 ;; When `gnus-move-split-methods' is non-nil, we have to
8382 ;; select an article to give `gnus-read-move-group-name' an
8383 ;; opportunity to suggest an appropriate default. However,
8384 ;; we needn't render or mark the article.
8385 (let ((gnus-display-mime-function nil)
8386 (gnus-article-prepare-hook nil)
8387 (gnus-mark-article-hook nil))
8388 (gnus-summary-select-article nil nil nil (car articles))))
8390 (gnus-read-move-group-name
8391 (cadr (assq action names))
8392 (symbol-value (intern (format "gnus-current-%s-group" action)))
8394 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8395 (setq to-method (or select-method
8396 (gnus-server-to-method
8397 (gnus-group-method to-newsgroup))))
8398 ;; Check the method we are to move this article to...
8399 (unless (gnus-check-backend-function
8400 'request-accept-article (car to-method))
8401 (error "%s does not support article copying" (car to-method)))
8402 (unless (gnus-check-server to-method)
8403 (error "Can't open server %s" (car to-method)))
8404 (gnus-message 6 "%s to %s: %s..."
8405 (caddr (assq action names))
8406 (or (car select-method) to-newsgroup) articles)
8408 (setq article (pop articles))
8412 ;; Move the article.
8414 ;; Remove this article from future suppression.
8415 (gnus-dup-unsuppress-article article)
8416 (gnus-request-move-article
8417 article ; Article to move
8418 gnus-newsgroup-name ; From newsgroup
8419 (nth 1 (gnus-find-method-for-group
8420 gnus-newsgroup-name)) ; Server
8421 (list 'gnus-request-accept-article
8422 to-newsgroup (list 'quote select-method)
8423 (not articles) t) ; Accept form
8424 (not articles))) ; Only save nov last time
8425 ;; Copy the article.
8428 (set-buffer copy-buf)
8429 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8430 (gnus-request-accept-article
8431 to-newsgroup select-method (not articles) t))))
8432 ;; Crosspost the article.
8433 ((eq action 'crosspost)
8434 (let ((xref (message-tokenize-header
8435 (mail-header-xref (gnus-summary-article-header article))
8437 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8438 ":" (number-to-string article)))
8440 (setq xref (list (system-name))))
8443 (mapconcat 'identity
8444 (delete "Xref:" (delete new-xref xref))
8448 (set-buffer copy-buf)
8449 ;; First put the article in the destination group.
8450 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8451 (when (consp (setq art-group
8452 (gnus-request-accept-article
8453 to-newsgroup select-method (not articles))))
8454 (setq new-xref (concat new-xref " " (car art-group)
8456 (number-to-string (cdr art-group))))
8457 ;; Now we have the new Xrefs header, so we insert
8458 ;; it and replace the new article.
8459 (nnheader-replace-header "Xref" new-xref)
8460 (gnus-request-replace-article
8461 (cdr art-group) to-newsgroup (current-buffer))
8465 (gnus-message 1 "Couldn't %s article %s: %s"
8466 (cadr (assq action names)) article
8467 (nnheader-get-report (car to-method))))
8468 ((eq art-group 'junk)
8469 (when (eq action 'move)
8470 (gnus-summary-mark-article article gnus-canceled-mark)
8471 (gnus-message 4 "Deleted article %s" article)))
8473 (let* ((pto-group (gnus-group-prefixed-name
8474 (car art-group) to-method))
8476 (gnus-gethash pto-group gnus-newsrc-hashtb))
8477 (info (nth 2 entry))
8478 (to-group (gnus-info-group info))
8480 ;; Update the group that has been moved to.
8482 (memq action '(move copy)))
8483 (unless (member to-group to-groups)
8484 (push to-group to-groups))
8486 (unless (memq article gnus-newsgroup-unreads)
8487 (push 'read to-marks)
8489 info (gnus-add-to-range (gnus-info-read info)
8490 (list (cdr art-group)))))
8492 ;; See whether the article is to be put in the cache.
8493 (let ((marks gnus-article-mark-lists)
8494 (to-article (cdr art-group)))
8496 ;; Enter the article into the cache in the new group,
8497 ;; if that is required.
8498 (when gnus-use-cache
8499 (gnus-cache-possibly-enter-article
8501 (memq article gnus-newsgroup-marked)
8502 (memq article gnus-newsgroup-dormant)
8503 (memq article gnus-newsgroup-unreads)))
8505 (when gnus-preserve-marks
8506 ;; Copy any marks over to the new group.
8507 (when (and (equal to-group gnus-newsgroup-name)
8508 (not (memq article gnus-newsgroup-unreads)))
8509 ;; Mark this article as read in this group.
8510 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8511 (setcdr (gnus-active to-group) to-article)
8512 (setcdr gnus-newsgroup-active to-article))
8515 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8516 (when (memq article (symbol-value
8517 (intern (format "gnus-newsgroup-%s"
8519 (push (cdar marks) to-marks)
8520 ;; If the other group is the same as this group,
8521 ;; then we have to add the mark to the list.
8522 (when (equal to-group gnus-newsgroup-name)
8523 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
8526 (intern (format "gnus-newsgroup-%s"
8528 ;; Copy the marks to other group.
8529 (gnus-add-marked-articles
8530 to-group (cdar marks) (list to-article) info)))
8531 (setq marks (cdr marks)))
8533 (gnus-request-set-mark to-group (list (list (list to-article)
8538 (concat "(gnus-group-set-info '"
8539 (gnus-prin1-to-string (gnus-get-info to-group))
8542 ;; Update the Xref header in this article to point to
8543 ;; the new crossposted article we have just created.
8544 (when (eq action 'crosspost)
8546 (set-buffer copy-buf)
8547 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8548 (nnheader-replace-header "Xref" new-xref)
8549 (gnus-request-replace-article
8550 article gnus-newsgroup-name (current-buffer)))))
8552 ;;;!!!Why is this necessary?
8553 (set-buffer gnus-summary-buffer)
8555 (gnus-summary-goto-subject article)
8556 (when (eq action 'move)
8557 (gnus-summary-mark-article article gnus-canceled-mark))))
8558 (gnus-summary-remove-process-mark article))
8559 ;; Re-activate all groups that have been moved to.
8561 (set-buffer gnus-group-buffer)
8562 (let ((gnus-group-marked to-groups))
8563 (gnus-group-get-new-news-this-group nil t)))
8565 (gnus-kill-buffer copy-buf)
8566 (gnus-summary-position-point)
8567 (gnus-set-mode-line 'summary)))
8569 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
8570 "Move the current article to a different newsgroup.
8571 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8572 When called interactively, if TO-NEWSGROUP is nil, use the value of
8573 the variable `gnus-move-split-methods' for finding a default target
8575 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8576 re-spool using this method."
8578 (gnus-summary-move-article n to-newsgroup select-method 'copy))
8580 (defun gnus-summary-crosspost-article (&optional n)
8581 "Crosspost the current article to some other group."
8583 (gnus-summary-move-article n nil nil 'crosspost))
8585 (defcustom gnus-summary-respool-default-method nil
8586 "Default method type for respooling an article.
8587 If nil, use to the current newsgroup method."
8589 :group 'gnus-summary-mail)
8591 (defun gnus-summary-respool-article (&optional n method)
8592 "Respool the current article.
8593 The article will be squeezed through the mail spooling process again,
8594 which means that it will be put in some mail newsgroup or other
8595 depending on `nnmail-split-methods'.
8596 If N is a positive number, respool the N next articles.
8597 If N is a negative number, respool the N previous articles.
8598 If N is nil and any articles have been marked with the process mark,
8599 respool those articles instead.
8601 Respooling can be done both from mail groups and \"real\" newsgroups.
8602 In the former case, the articles in question will be moved from the
8603 current group into whatever groups they are destined to. In the
8604 latter case, they will be copied into the relevant groups."
8606 (list current-prefix-arg
8607 (let* ((methods (gnus-methods-using 'respool))
8609 (symbol-name (or gnus-summary-respool-default-method
8610 (car (gnus-find-method-for-group
8611 gnus-newsgroup-name)))))
8613 (gnus-completing-read-with-default
8614 methname "What backend do you want to use when respooling?"
8615 methods nil t nil 'gnus-mail-method-history))
8618 ((zerop (length (setq ms (gnus-servers-using-backend
8620 (list (intern method) ""))
8624 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
8625 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
8628 (error "No method given for respooling"))
8629 (if (assoc (symbol-name
8630 (car (gnus-find-method-for-group gnus-newsgroup-name)))
8631 (gnus-methods-using 'respool))
8632 (gnus-summary-move-article n nil method)
8633 (gnus-summary-copy-article n nil method)))
8635 (defun gnus-summary-import-article (file &optional edit)
8636 "Import an arbitrary file into a mail newsgroup."
8637 (interactive "fImport file: \nP")
8638 (let ((group gnus-newsgroup-name)
8639 (now (current-time))
8640 atts lines group-art)
8641 (unless (gnus-check-backend-function 'request-accept-article group)
8642 (error "%s does not support article importing" group))
8643 (or (file-readable-p file)
8644 (not (file-regular-p file))
8645 (error "Can't read %s" file))
8647 (set-buffer (gnus-get-buffer-create " *import file*"))
8649 (nnheader-insert-file-contents file)
8650 (goto-char (point-min))
8651 (if (nnheader-article-p)
8653 (goto-char (point-min))
8654 (search-forward "\n\n" nil t)
8655 (narrow-to-region (point-min) (1- (point)))
8656 (goto-char (point-min))
8657 (unless (re-search-forward "^date:" nil t)
8658 (goto-char (point-max))
8659 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
8660 ;; This doesn't look like an article, so we fudge some headers.
8661 (setq atts (file-attributes file)
8662 lines (count-lines (point-min) (point-max)))
8663 (insert "From: " (read-string "From: ") "\n"
8664 "Subject: " (read-string "Subject: ") "\n"
8665 "Date: " (message-make-date (nth 5 atts)) "\n"
8666 "Message-ID: " (message-make-message-id) "\n"
8667 "Lines: " (int-to-string lines) "\n"
8668 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
8669 (setq group-art (gnus-request-accept-article group nil t))
8670 (kill-buffer (current-buffer)))
8671 (setq gnus-newsgroup-active (gnus-activate-group group))
8673 (gnus-summary-goto-article (cdr group-art) nil t)
8675 (gnus-summary-edit-article))))
8677 (defun gnus-summary-create-article ()
8678 "Create an article in a mail newsgroup."
8680 (let ((group gnus-newsgroup-name)
8681 (now (current-time))
8683 (unless (gnus-check-backend-function 'request-accept-article group)
8684 (error "%s does not support article importing" group))
8686 (set-buffer (gnus-get-buffer-create " *import file*"))
8688 (goto-char (point-min))
8689 ;; This doesn't look like an article, so we fudge some headers.
8690 (insert "From: " (read-string "From: ") "\n"
8691 "Subject: " (read-string "Subject: ") "\n"
8692 "Date: " (message-make-date now) "\n"
8693 "Message-ID: " (message-make-message-id) "\n")
8694 (setq group-art (gnus-request-accept-article group nil t))
8695 (kill-buffer (current-buffer)))
8696 (setq gnus-newsgroup-active (gnus-activate-group group))
8698 (gnus-summary-goto-article (cdr group-art) nil t)
8699 (gnus-summary-edit-article)))
8701 (defun gnus-summary-article-posted-p ()
8702 "Say whether the current (mail) article is available from news as well.
8703 This will be the case if the article has both been mailed and posted."
8705 (let ((id (mail-header-references (gnus-summary-article-header)))
8706 (gnus-override-method (car (gnus-refer-article-methods))))
8707 (if (gnus-request-head id "")
8708 (gnus-message 2 "The current message was found on %s"
8709 gnus-override-method)
8710 (gnus-message 2 "The current message couldn't be found on %s"
8711 gnus-override-method)
8714 (defun gnus-summary-expire-articles (&optional now)
8715 "Expire all articles that are marked as expirable in the current group."
8717 (when (gnus-check-backend-function
8718 'request-expire-articles gnus-newsgroup-name)
8719 ;; This backend supports expiry.
8720 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
8721 (expirable (if total
8723 ;; We need to update the info for
8724 ;; this group for `gnus-list-of-read-articles'
8725 ;; to give us the right answer.
8726 (gnus-run-hooks 'gnus-exit-group-hook)
8727 (gnus-summary-update-info)
8728 (gnus-list-of-read-articles gnus-newsgroup-name))
8729 (setq gnus-newsgroup-expirable
8730 (sort gnus-newsgroup-expirable '<))))
8731 (expiry-wait (if now 'immediate
8732 (gnus-group-find-parameter
8733 gnus-newsgroup-name 'expiry-wait)))
8734 (nnmail-expiry-target
8735 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
8736 nnmail-expiry-target))
8739 ;; There are expirable articles in this group, so we run them
8740 ;; through the expiry process.
8741 (gnus-message 6 "Expiring articles...")
8742 (unless (gnus-check-group gnus-newsgroup-name)
8743 (error "Can't open server for %s" gnus-newsgroup-name))
8744 ;; The list of articles that weren't expired is returned.
8747 (let ((nnmail-expiry-wait-function nil)
8748 (nnmail-expiry-wait expiry-wait))
8749 (setq es (gnus-request-expire-articles
8750 expirable gnus-newsgroup-name)))
8751 (setq es (gnus-request-expire-articles
8752 expirable gnus-newsgroup-name)))
8754 (setq gnus-newsgroup-expirable es))
8755 ;; We go through the old list of expirable, and mark all
8756 ;; really expired articles as nonexistent.
8757 (unless (eq es expirable) ;If nothing was expired, we don't mark.
8758 (let ((gnus-use-cache nil))
8759 (dolist (article expirable)
8760 (when (and (not (memq article es))
8761 (gnus-data-find article))
8762 (gnus-summary-mark-article article gnus-canceled-mark))))))
8763 (gnus-message 6 "Expiring articles...done")))))
8765 (defun gnus-summary-expire-articles-now ()
8766 "Expunge all expirable articles in the current group.
8767 This means that *all* articles that are marked as expirable will be
8768 deleted forever, right now."
8770 (or gnus-expert-user
8772 "Are you really, really, really sure you want to delete all these messages? ")
8774 (gnus-summary-expire-articles t))
8776 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
8777 (defun gnus-summary-delete-article (&optional n)
8778 "Delete the N next (mail) articles.
8779 This command actually deletes articles. This is not a marking
8780 command. The article will disappear forever from your life, never to
8782 If N is negative, delete backwards.
8783 If N is nil and articles have been marked with the process mark,
8784 delete these instead."
8786 (unless (gnus-check-backend-function 'request-expire-articles
8787 gnus-newsgroup-name)
8788 (error "The current newsgroup does not support article deletion"))
8789 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
8790 (error "Couldn't open server"))
8791 ;; Compute the list of articles to delete.
8792 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
8794 (if (and gnus-novice-user
8795 (not (gnus-yes-or-no-p
8796 (format "Do you really want to delete %s forever? "
8797 (if (> (length articles) 1)
8798 (format "these %s articles" (length articles))
8801 ;; Delete the articles.
8802 (setq not-deleted (gnus-request-expire-articles
8803 articles gnus-newsgroup-name 'force))
8805 (gnus-summary-remove-process-mark (car articles))
8806 ;; The backend might not have been able to delete the article
8808 (unless (memq (car articles) not-deleted)
8809 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
8810 (setq articles (cdr articles)))
8812 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
8813 (gnus-summary-position-point)
8814 (gnus-set-mode-line 'summary)
8817 (defun gnus-summary-edit-article (&optional arg)
8818 "Edit the current article.
8819 This will have permanent effect only in mail groups.
8820 If ARG is nil, edit the decoded articles.
8821 If ARG is 1, edit the raw articles.
8822 If ARG is 2, edit the raw articles even in read-only groups.
8823 If ARG is 3, edit the articles with the current handles.
8824 Otherwise, allow editing of articles even in read-only
8827 (let (force raw current-handles)
8836 (setq current-handles
8837 (and (gnus-buffer-live-p gnus-article-buffer)
8838 (with-current-buffer gnus-article-buffer
8840 gnus-article-mime-handles
8841 (setq gnus-article-mime-handles nil))))))
8844 (when (and raw (not force) (equal gnus-newsgroup-name "nndraft:drafts"))
8845 (error "Can't edit the raw article in group nndraft:drafts"))
8847 (set-buffer gnus-summary-buffer)
8848 (let ((mail-parse-charset gnus-newsgroup-charset)
8849 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
8850 (gnus-set-global-variables)
8851 (when (and (not force)
8852 (gnus-group-read-only-p))
8853 (error "The current newsgroup does not support article editing"))
8854 (gnus-summary-show-article t)
8855 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
8856 (with-current-buffer gnus-article-buffer
8857 (mm-enable-multibyte)))
8858 (if (equal gnus-newsgroup-name "nndraft:drafts")
8860 (gnus-article-edit-article
8863 (let ((mbl mml-buffer-list))
8864 (setq mml-buffer-list nil)
8865 (mime-to-mml ,'current-handles)
8866 (let ((mbl1 mml-buffer-list))
8867 (setq mml-buffer-list mbl)
8868 (set (make-local-variable 'mml-buffer-list) mbl1))
8869 (make-local-hook 'kill-buffer-hook)
8870 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
8871 `(lambda (no-highlight)
8872 (let ((mail-parse-charset ',gnus-newsgroup-charset)
8873 (message-options message-options)
8874 (message-options-set-recipient)
8875 (mail-parse-ignored-charsets
8876 ',gnus-newsgroup-ignored-charsets))
8877 ,(if (not raw) '(progn
8879 (mml-destroy-buffers)
8880 (remove-hook 'kill-buffer-hook
8881 'mml-destroy-buffers t)
8882 (kill-local-variable 'mml-buffer-list)))
8883 (gnus-summary-edit-article-done
8884 ,(or (mail-header-references gnus-current-headers) "")
8885 ,(gnus-group-read-only-p)
8886 ,gnus-summary-buffer no-highlight))))))))
8888 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
8890 (defun gnus-summary-edit-article-done (&optional references read-only buffer
8892 "Make edits to the current article permanent."
8895 ;; The buffer restriction contains the entire article if it exists.
8896 (when (article-goto-body)
8897 (let ((lines (count-lines (point) (point-max)))
8898 (length (- (point-max) (point)))
8899 (case-fold-search t)
8900 (body (copy-marker (point))))
8901 (goto-char (point-min))
8902 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
8903 (delete-region (match-beginning 1) (match-end 1))
8904 (insert (number-to-string length)))
8905 (goto-char (point-min))
8906 (when (re-search-forward
8907 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
8908 (delete-region (match-beginning 1) (match-end 1))
8909 (insert (number-to-string length)))
8910 (goto-char (point-min))
8911 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
8912 (delete-region (match-beginning 1) (match-end 1))
8913 (insert (number-to-string lines))))))
8914 ;; Replace the article.
8915 (let ((buf (current-buffer)))
8917 (insert-buffer-substring buf)
8919 (if (and (not read-only)
8920 (not (gnus-request-replace-article
8921 (cdr gnus-article-current) (car gnus-article-current)
8922 (current-buffer) t)))
8923 (error "Couldn't replace article")
8924 ;; Update the summary buffer.
8926 (equal (message-tokenize-header references " ")
8927 (message-tokenize-header
8928 (or (message-fetch-field "references") "") " ")))
8929 ;; We only have to update this line.
8932 (message-narrow-to-head)
8933 (let ((head (buffer-string))
8936 (insert (format "211 %d Article retrieved.\n"
8937 (cdr gnus-article-current)))
8940 (let ((nntp-server-buffer (current-buffer)))
8941 (setq header (car (gnus-get-newsgroup-headers
8944 (set-buffer gnus-summary-buffer)
8945 (gnus-data-set-header
8946 (gnus-data-find (cdr gnus-article-current))
8948 (gnus-summary-update-article-line
8949 (cdr gnus-article-current) header)
8950 (if (gnus-summary-goto-subject
8951 (cdr gnus-article-current) nil t)
8952 (gnus-summary-update-secondary-mark
8953 (cdr gnus-article-current))))))))
8955 (set-buffer (or buffer gnus-summary-buffer))
8956 (gnus-summary-update-article (cdr gnus-article-current))
8957 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8958 (gnus-summary-update-secondary-mark
8959 (cdr gnus-article-current))))
8960 ;; Prettify the article buffer again.
8961 (unless no-highlight
8963 (set-buffer gnus-article-buffer)
8964 ;;;!!! Fix this -- article should be rehighlighted.
8965 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8966 (set-buffer gnus-original-article-buffer)
8967 (gnus-request-article
8968 (cdr gnus-article-current)
8969 (car gnus-article-current) (current-buffer))))
8970 ;; Prettify the summary buffer line.
8971 (when (gnus-visual-p 'summary-highlight 'highlight)
8972 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
8974 (defun gnus-summary-edit-wash (key)
8975 "Perform editing command KEY in the article buffer."
8979 (message "%s" (concat (this-command-keys) "- "))
8982 (gnus-summary-edit-article)
8983 (execute-kbd-macro (concat (this-command-keys) key))
8984 (gnus-article-edit-done))
8988 (defun gnus-summary-respool-query (&optional silent trace)
8989 "Query where the respool algorithm would put this article."
8991 (let (gnus-mark-article-hook)
8992 (gnus-summary-select-article)
8994 (set-buffer gnus-original-article-buffer)
8996 (message-narrow-to-head)
8997 (let ((groups (nnmail-article-group 'identity trace)))
9000 (message "This message would go to %s"
9001 (mapconcat 'car groups ", "))
9002 (message "This message would go to no groups"))
9005 (defun gnus-summary-respool-trace ()
9006 "Trace where the respool algorithm would put this article.
9007 Display a buffer showing all fancy splitting patterns which matched."
9009 (gnus-summary-respool-query nil t))
9011 ;; Summary marking commands.
9013 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9014 "Mark articles which has the same subject as read, and then select the next.
9015 If UNMARK is positive, remove any kind of mark.
9016 If UNMARK is negative, tick articles."
9019 (setq unmark (prefix-numeric-value unmark)))
9021 (gnus-summary-mark-same-subject
9022 (gnus-summary-article-subject) unmark)))
9023 ;; Select next unread article. If auto-select-same mode, should
9024 ;; select the first unread article.
9025 (gnus-summary-next-article t (and gnus-auto-select-same
9026 (gnus-summary-article-subject)))
9027 (gnus-message 7 "%d article%s marked as %s"
9028 count (if (= count 1) " is" "s are")
9029 (if unmark "unread" "read"))))
9031 (defun gnus-summary-kill-same-subject (&optional unmark)
9032 "Mark articles which has the same subject as read.
9033 If UNMARK is positive, remove any kind of mark.
9034 If UNMARK is negative, tick articles."
9037 (setq unmark (prefix-numeric-value unmark)))
9039 (gnus-summary-mark-same-subject
9040 (gnus-summary-article-subject) unmark)))
9041 ;; If marked as read, go to next unread subject.
9043 ;; Go to next unread subject.
9044 (gnus-summary-next-subject 1 t))
9045 (gnus-message 7 "%d articles are marked as %s"
9046 count (if unmark "unread" "read"))))
9048 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9049 "Mark articles with same SUBJECT as read, and return marked number.
9050 If optional argument UNMARK is positive, remove any kinds of marks.
9051 If optional argument UNMARK is negative, mark articles as unread instead."
9055 ((null unmark) ; Mark as read.
9058 (gnus-summary-mark-article-as-read gnus-killed-mark)
9059 (gnus-summary-show-thread) t)
9060 (gnus-summary-find-subject subject))
9061 (setq count (1+ count))))
9062 ((> unmark 0) ; Tick.
9065 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9066 (gnus-summary-show-thread) t)
9067 (gnus-summary-find-subject subject))
9068 (setq count (1+ count))))
9069 (t ; Mark as unread.
9072 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9073 (gnus-summary-show-thread) t)
9074 (gnus-summary-find-subject subject))
9075 (setq count (1+ count)))))
9076 (gnus-set-mode-line 'summary)
9077 ;; Return the number of marked articles.
9080 (defun gnus-summary-mark-as-processable (n &optional unmark)
9081 "Set the process mark on the next N articles.
9082 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9083 the process mark instead. The difference between N and the actual
9084 number of articles marked is returned."
9086 (if (and (null n) (gnus-region-active-p))
9087 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9088 (setq n (prefix-numeric-value n))
9089 (let ((backward (< n 0))
9094 (gnus-summary-remove-process-mark
9095 (gnus-summary-article-number))
9096 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9097 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9100 (gnus-message 7 "No more articles"))
9101 (gnus-summary-recenter)
9102 (gnus-summary-position-point)
9105 (defun gnus-summary-unmark-as-processable (n)
9106 "Remove the process mark from the next N articles.
9107 If N is negative, unmark backward instead. The difference between N and
9108 the actual number of articles unmarked is returned."
9110 (gnus-summary-mark-as-processable n t))
9112 (defun gnus-summary-unmark-all-processable ()
9113 "Remove the process mark from all articles."
9116 (while gnus-newsgroup-processable
9117 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9118 (gnus-summary-position-point))
9120 (defun gnus-summary-add-mark (article type)
9121 "Mark ARTICLE with a mark of TYPE."
9122 (let ((vtype (car (assq type gnus-article-mark-lists)))
9125 (error "No such mark type: %s" type)
9126 (setq var (intern (format "gnus-newsgroup-%s" type)))
9127 (set var (cons article (symbol-value var)))
9128 (if (memq type '(processable cached replied forwarded recent saved))
9129 (gnus-summary-update-secondary-mark article)
9130 ;;; !!! This is bogus. We should find out what primary
9131 ;;; !!! mark we want to set.
9132 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9134 (defun gnus-summary-mark-as-expirable (n)
9135 "Mark N articles forward as expirable.
9136 If N is negative, mark backward instead. The difference between N and
9137 the actual number of articles marked is returned."
9139 (gnus-summary-mark-forward n gnus-expirable-mark))
9141 (defun gnus-summary-mark-as-spam (n)
9142 "Mark N articles forward as spam.
9143 If N is negative, mark backward instead. The difference between N and
9144 the actual number of articles marked is returned."
9146 (gnus-summary-mark-forward n gnus-spam-mark))
9148 (defun gnus-summary-mark-article-as-replied (article)
9149 "Mark ARTICLE as replied to and update the summary line.
9150 ARTICLE can also be a list of articles."
9151 (interactive (list (gnus-summary-article-number)))
9152 (let ((articles (if (listp article) article (list article))))
9153 (dolist (article articles)
9154 (push article gnus-newsgroup-replied)
9155 (let ((buffer-read-only nil))
9156 (when (gnus-summary-goto-subject article nil t)
9157 (gnus-summary-update-secondary-mark article))))))
9159 (defun gnus-summary-mark-article-as-forwarded (article)
9160 "Mark ARTICLE as forwarded and update the summary line.
9161 ARTICLE can also be a list of articles."
9162 (let ((articles (if (listp article) article (list article))))
9163 (dolist (article articles)
9164 (push article gnus-newsgroup-forwarded)
9165 (let ((buffer-read-only nil))
9166 (when (gnus-summary-goto-subject article nil t)
9167 (gnus-summary-update-secondary-mark article))))))
9169 (defun gnus-summary-set-bookmark (article)
9170 "Set a bookmark in current article."
9171 (interactive (list (gnus-summary-article-number)))
9172 (when (or (not (get-buffer gnus-article-buffer))
9173 (not gnus-current-article)
9174 (not gnus-article-current)
9175 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9176 (error "No current article selected"))
9177 ;; Remove old bookmark, if one exists.
9178 (let ((old (assq article gnus-newsgroup-bookmarks)))
9180 (setq gnus-newsgroup-bookmarks
9181 (delq old gnus-newsgroup-bookmarks))))
9182 ;; Set the new bookmark, which is on the form
9183 ;; (article-number . line-number-in-body).
9187 (set-buffer gnus-article-buffer)
9191 (goto-char (point-min))
9192 (search-forward "\n\n" nil t)
9195 gnus-newsgroup-bookmarks)
9196 (gnus-message 6 "A bookmark has been added to the current article."))
9198 (defun gnus-summary-remove-bookmark (article)
9199 "Remove the bookmark from the current article."
9200 (interactive (list (gnus-summary-article-number)))
9201 ;; Remove old bookmark, if one exists.
9202 (let ((old (assq article gnus-newsgroup-bookmarks)))
9205 (setq gnus-newsgroup-bookmarks
9206 (delq old gnus-newsgroup-bookmarks))
9207 (gnus-message 6 "Removed bookmark."))
9208 (gnus-message 6 "No bookmark in current article."))))
9210 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9211 (defun gnus-summary-mark-as-dormant (n)
9212 "Mark N articles forward as dormant.
9213 If N is negative, mark backward instead. The difference between N and
9214 the actual number of articles marked is returned."
9216 (gnus-summary-mark-forward n gnus-dormant-mark))
9218 (defun gnus-summary-set-process-mark (article)
9219 "Set the process mark on ARTICLE and update the summary line."
9220 (setq gnus-newsgroup-processable
9222 (delq article gnus-newsgroup-processable)))
9223 (when (gnus-summary-goto-subject article)
9224 (gnus-summary-show-thread)
9225 (gnus-summary-goto-subject article)
9226 (gnus-summary-update-secondary-mark article)))
9228 (defun gnus-summary-remove-process-mark (article)
9229 "Remove the process mark from ARTICLE and update the summary line."
9230 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9231 (when (gnus-summary-goto-subject article)
9232 (gnus-summary-show-thread)
9233 (gnus-summary-goto-subject article)
9234 (gnus-summary-update-secondary-mark article)))
9236 (defun gnus-summary-set-saved-mark (article)
9237 "Set the process mark on ARTICLE and update the summary line."
9238 (push article gnus-newsgroup-saved)
9239 (when (gnus-summary-goto-subject article)
9240 (gnus-summary-update-secondary-mark article)))
9242 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9243 "Mark N articles as read forwards.
9244 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9245 The difference between N and the actual number of articles marked is
9247 Iff NO-EXPIRE, auto-expiry will be inhibited."
9249 (gnus-summary-show-thread)
9250 (let ((backward (< n 0))
9251 (gnus-summary-goto-unread
9252 (and gnus-summary-goto-unread
9253 (not (eq gnus-summary-goto-unread 'never))
9254 (not (memq mark (list gnus-unread-mark
9255 gnus-ticked-mark gnus-dormant-mark)))))
9257 (mark (or mark gnus-del-mark)))
9259 (gnus-summary-mark-article nil mark no-expire)
9260 (zerop (gnus-summary-next-subject
9262 (and gnus-summary-goto-unread
9263 (not (eq gnus-summary-goto-unread 'never)))
9267 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9268 (gnus-summary-recenter)
9269 (gnus-summary-position-point)
9270 (gnus-set-mode-line 'summary)
9273 (defun gnus-summary-mark-article-as-read (mark)
9274 "Mark the current article quickly as read with MARK."
9275 (let ((article (gnus-summary-article-number)))
9276 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9277 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9278 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9279 (push (cons article mark) gnus-newsgroup-reads)
9280 ;; Possibly remove from cache, if that is used.
9281 (when gnus-use-cache
9282 (gnus-cache-enter-remove-article article))
9283 ;; Allow the backend to change the mark.
9284 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9285 ;; Check for auto-expiry.
9286 (when (and gnus-newsgroup-auto-expire
9287 (memq mark gnus-auto-expirable-marks))
9288 (setq mark gnus-expirable-mark)
9289 ;; Let the backend know about the mark change.
9290 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9291 (push article gnus-newsgroup-expirable))
9292 ;; Set the mark in the buffer.
9293 (gnus-summary-update-mark mark 'unread)
9296 (defun gnus-summary-mark-article-as-unread (mark)
9297 "Mark the current article quickly as unread with MARK."
9298 (let* ((article (gnus-summary-article-number))
9299 (old-mark (gnus-summary-article-mark article)))
9300 ;; Allow the backend to change the mark.
9301 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9302 (if (eq mark old-mark)
9306 (gnus-error 1 "Can't mark negative article numbers")
9308 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9309 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9310 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9311 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9312 (cond ((= mark gnus-ticked-mark)
9313 (setq gnus-newsgroup-marked
9314 (gnus-add-to-sorted-list gnus-newsgroup-marked
9316 ((= mark gnus-dormant-mark)
9317 (setq gnus-newsgroup-dormant
9318 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9321 (setq gnus-newsgroup-unreads
9322 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9324 (gnus-pull article gnus-newsgroup-reads)
9326 ;; See whether the article is to be put in the cache.
9328 (vectorp (gnus-summary-article-header article))
9330 (gnus-cache-possibly-enter-article
9331 gnus-newsgroup-name article
9332 (= mark gnus-ticked-mark)
9333 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9336 (gnus-summary-update-mark mark 'unread)
9339 (defun gnus-summary-mark-article (&optional article mark no-expire)
9340 "Mark ARTICLE with MARK. MARK can be any character.
9341 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9342 `??' (dormant) and `?E' (expirable).
9343 If MARK is nil, then the default character `?r' is used.
9344 If ARTICLE is nil, then the article on the current line will be
9346 Iff NO-EXPIRE, auto-expiry will be inhibited."
9347 ;; The mark might be a string.
9348 (when (stringp mark)
9349 (setq mark (aref mark 0)))
9350 ;; If no mark is given, then we check auto-expiring.
9352 (setq mark gnus-del-mark))
9353 (when (and (not no-expire)
9354 gnus-newsgroup-auto-expire
9355 (memq mark gnus-auto-expirable-marks))
9356 (setq mark gnus-expirable-mark))
9357 (let ((article (or article (gnus-summary-article-number)))
9358 (old-mark (gnus-summary-article-mark article)))
9359 ;; Allow the backend to change the mark.
9360 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9361 (if (eq mark old-mark)
9364 (error "No article on current line"))
9365 (if (not (if (or (= mark gnus-unread-mark)
9366 (= mark gnus-ticked-mark)
9367 (= mark gnus-dormant-mark))
9368 (gnus-mark-article-as-unread article mark)
9369 (gnus-mark-article-as-read article mark)))
9371 ;; See whether the article is to be put in the cache.
9373 (not (= mark gnus-canceled-mark))
9374 (vectorp (gnus-summary-article-header article))
9376 (gnus-cache-possibly-enter-article
9377 gnus-newsgroup-name article
9378 (= mark gnus-ticked-mark)
9379 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9381 (when (gnus-summary-goto-subject article nil t)
9382 (let ((buffer-read-only nil))
9383 (gnus-summary-show-thread)
9385 (gnus-summary-update-mark mark 'unread)
9388 (defun gnus-summary-update-secondary-mark (article)
9389 "Update the secondary (read, process, cache) mark."
9390 (gnus-summary-update-mark
9391 (cond ((memq article gnus-newsgroup-processable)
9393 ((memq article gnus-newsgroup-cached)
9395 ((memq article gnus-newsgroup-replied)
9397 ((memq article gnus-newsgroup-forwarded)
9398 gnus-forwarded-mark)
9399 ((memq article gnus-newsgroup-saved)
9401 ((memq article gnus-newsgroup-recent)
9403 ((memq article gnus-newsgroup-unseen)
9407 (when (gnus-visual-p 'summary-highlight 'highlight)
9408 (gnus-run-hooks 'gnus-summary-update-hook))
9411 (defun gnus-summary-update-mark (mark type)
9412 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9413 (buffer-read-only nil))
9414 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9416 (when (looking-at "\r")
9418 (when (<= (+ forward (point)) (point-max))
9419 ;; Go to the right position on the line.
9420 (goto-char (+ forward (point)))
9421 ;; Replace the old mark with the new mark.
9422 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9423 ;; Optionally update the marks by some user rule.
9424 (when (eq type 'unread)
9426 (gnus-data-find (gnus-summary-article-number)) mark)
9427 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9429 (defun gnus-mark-article-as-read (article &optional mark)
9430 "Enter ARTICLE in the pertinent lists and remove it from others."
9431 ;; Make the article expirable.
9432 (let ((mark (or mark gnus-del-mark)))
9433 (setq gnus-newsgroup-expirable
9434 (if (= mark gnus-expirable-mark)
9435 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9436 (delq article gnus-newsgroup-expirable)))
9437 ;; Remove from unread and marked lists.
9438 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9439 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9440 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9441 (push (cons article mark) gnus-newsgroup-reads)
9442 ;; Possibly remove from cache, if that is used.
9443 (when gnus-use-cache
9444 (gnus-cache-enter-remove-article article))
9447 (defun gnus-mark-article-as-unread (article &optional mark)
9448 "Enter ARTICLE in the pertinent lists and remove it from others."
9449 (let ((mark (or mark gnus-ticked-mark)))
9452 (gnus-error 1 "Can't mark negative article numbers")
9454 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9455 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9456 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9457 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9459 ;; Unsuppress duplicates?
9460 (when gnus-suppress-duplicates
9461 (gnus-dup-unsuppress-article article))
9463 (cond ((= mark gnus-ticked-mark)
9464 (setq gnus-newsgroup-marked
9465 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
9466 ((= mark gnus-dormant-mark)
9467 (setq gnus-newsgroup-dormant
9468 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
9470 (setq gnus-newsgroup-unreads
9471 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
9472 (gnus-pull article gnus-newsgroup-reads)
9475 (defalias 'gnus-summary-mark-as-unread-forward
9476 'gnus-summary-tick-article-forward)
9477 (make-obsolete 'gnus-summary-mark-as-unread-forward
9478 'gnus-summary-tick-article-forward)
9479 (defun gnus-summary-tick-article-forward (n)
9480 "Tick N articles forwards.
9481 If N is negative, tick backwards instead.
9482 The difference between N and the number of articles ticked is returned."
9484 (gnus-summary-mark-forward n gnus-ticked-mark))
9486 (defalias 'gnus-summary-mark-as-unread-backward
9487 'gnus-summary-tick-article-backward)
9488 (make-obsolete 'gnus-summary-mark-as-unread-backward
9489 'gnus-summary-tick-article-backward)
9490 (defun gnus-summary-tick-article-backward (n)
9491 "Tick N articles backwards.
9492 The difference between N and the number of articles ticked is returned."
9494 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
9496 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9497 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9498 (defun gnus-summary-tick-article (&optional article clear-mark)
9499 "Mark current article as unread.
9500 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9501 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9503 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
9506 (defun gnus-summary-mark-as-read-forward (n)
9507 "Mark N articles as read forwards.
9508 If N is negative, mark backwards instead.
9509 The difference between N and the actual number of articles marked is
9512 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
9514 (defun gnus-summary-mark-as-read-backward (n)
9515 "Mark the N articles as read backwards.
9516 The difference between N and the actual number of articles marked is
9519 (gnus-summary-mark-forward
9520 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
9522 (defun gnus-summary-mark-as-read (&optional article mark)
9523 "Mark current article as read.
9524 ARTICLE specifies the article to be marked as read.
9525 MARK specifies a string to be inserted at the beginning of the line."
9526 (gnus-summary-mark-article article mark))
9528 (defun gnus-summary-clear-mark-forward (n)
9529 "Clear marks from N articles forward.
9530 If N is negative, clear backward instead.
9531 The difference between N and the number of marks cleared is returned."
9533 (gnus-summary-mark-forward n gnus-unread-mark))
9535 (defun gnus-summary-clear-mark-backward (n)
9536 "Clear marks from N articles backward.
9537 The difference between N and the number of marks cleared is returned."
9539 (gnus-summary-mark-forward (- n) gnus-unread-mark))
9541 (defun gnus-summary-mark-unread-as-read ()
9542 "Intended to be used by `gnus-summary-mark-article-hook'."
9543 (when (memq gnus-current-article gnus-newsgroup-unreads)
9544 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
9546 (defun gnus-summary-mark-read-and-unread-as-read ()
9547 "Intended to be used by `gnus-summary-mark-article-hook'."
9548 (let ((mark (gnus-summary-article-mark)))
9549 (when (or (gnus-unread-mark-p mark)
9550 (gnus-read-mark-p mark))
9551 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
9553 (defun gnus-summary-mark-unread-as-ticked ()
9554 "Intended to be used by `gnus-summary-mark-article-hook'."
9555 (when (memq gnus-current-article gnus-newsgroup-unreads)
9556 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
9558 (defun gnus-summary-mark-region-as-read (point mark all)
9559 "Mark all unread articles between point and mark as read.
9560 If given a prefix, mark all articles between point and mark as read,
9561 even ticked and dormant ones."
9562 (interactive "r\nP")
9571 (memq (setq article (gnus-summary-article-number))
9572 gnus-newsgroup-unreads))
9573 (gnus-summary-mark-article article gnus-del-mark))
9575 (gnus-summary-find-next))))))
9577 (defun gnus-summary-mark-below (score mark)
9578 "Mark articles with score less than SCORE with MARK."
9579 (interactive "P\ncMark: ")
9580 (setq score (if score
9581 (prefix-numeric-value score)
9582 (or gnus-summary-default-score 0)))
9584 (set-buffer gnus-summary-buffer)
9585 (goto-char (point-min))
9588 (and (< (gnus-summary-article-score) score)
9589 (gnus-summary-mark-article nil mark))
9590 (gnus-summary-find-next)))))
9592 (defun gnus-summary-kill-below (&optional score)
9593 "Mark articles with score below SCORE as read."
9595 (gnus-summary-mark-below score gnus-killed-mark))
9597 (defun gnus-summary-clear-above (&optional score)
9598 "Clear all marks from articles with score above SCORE."
9600 (gnus-summary-mark-above score gnus-unread-mark))
9602 (defun gnus-summary-tick-above (&optional score)
9603 "Tick all articles with score above SCORE."
9605 (gnus-summary-mark-above score gnus-ticked-mark))
9607 (defun gnus-summary-mark-above (score mark)
9608 "Mark articles with score over SCORE with MARK."
9609 (interactive "P\ncMark: ")
9610 (setq score (if score
9611 (prefix-numeric-value score)
9612 (or gnus-summary-default-score 0)))
9614 (set-buffer gnus-summary-buffer)
9615 (goto-char (point-min))
9617 (when (> (gnus-summary-article-score) score)
9618 (gnus-summary-mark-article nil mark))
9620 (gnus-summary-find-next)))))
9622 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9623 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
9624 (defun gnus-summary-limit-include-expunged (&optional no-error)
9625 "Display all the hidden articles that were expunged for low scores."
9627 (let ((buffer-read-only nil))
9628 (let ((scored gnus-newsgroup-scored)
9631 (unless (gnus-summary-article-header (caar scored))
9632 (and (setq h (gnus-number-to-header (caar scored)))
9633 (< (cdar scored) gnus-summary-expunge-below)
9635 (setq scored (cdr scored)))
9637 (when (not no-error)
9638 (error "No expunged articles hidden"))
9639 (goto-char (point-min))
9640 (push gnus-newsgroup-limit gnus-newsgroup-limits)
9641 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
9642 (mapcar (lambda (x) (push (mail-header-number x)
9643 gnus-newsgroup-limit))
9645 (gnus-summary-prepare-unthreaded (nreverse headers))
9646 (goto-char (point-min))
9647 (gnus-summary-position-point)
9650 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
9651 "Mark all unread articles in this newsgroup as read.
9652 If prefix argument ALL is non-nil, ticked and dormant articles will
9653 also be marked as read.
9654 If QUIETLY is non-nil, no questions will be asked.
9655 If TO-HERE is non-nil, it should be a point in the buffer. All
9656 articles before (after, if REVERSE is set) this point will be marked as read.
9657 Note that this function will only catch up the unread article
9658 in the current summary buffer limitation.
9659 The number of articles marked as read is returned."
9664 (not gnus-interactive-catchup) ;Without confirmation?
9668 "Mark absolutely all articles as read? "
9669 "Mark all unread articles as read? ")))
9671 (not gnus-newsgroup-adaptive)
9672 (not gnus-newsgroup-auto-expire)
9673 (not gnus-suppress-duplicates)
9674 (or (not gnus-use-cache)
9675 (eq gnus-use-cache 'passive)))
9678 (setq gnus-newsgroup-marked nil
9679 gnus-newsgroup-dormant nil))
9680 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
9681 ;; We actually mark all articles as canceled, which we
9682 ;; have to do when using auto-expiry or adaptive scoring.
9683 (gnus-summary-show-all-threads)
9684 (if (and to-here reverse)
9688 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9689 (gnus-summary-find-next (not all) nil nil t))))
9690 (when (gnus-summary-first-subject (not all) t)
9692 (if to-here (< (point) to-here) t)
9693 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9694 (gnus-summary-find-next (not all) nil nil t)))))
9695 (gnus-set-mode-line 'summary))
9697 (gnus-summary-position-point)))
9699 (defun gnus-summary-catchup-to-here (&optional all)
9700 "Mark all unticked articles before the current one as read.
9701 If ALL is non-nil, also mark ticked and dormant articles as read."
9704 (gnus-save-hidden-threads
9705 (let ((beg (point)))
9706 ;; We check that there are unread articles.
9707 (when (or all (gnus-summary-find-prev))
9708 (gnus-summary-catchup all t beg)))))
9709 (gnus-summary-position-point))
9711 (defun gnus-summary-catchup-from-here (&optional all)
9712 "Mark all unticked articles after the current one as read.
9713 If ALL is non-nil, also mark ticked and dormant articles as read."
9716 (gnus-save-hidden-threads
9717 (let ((beg (point)))
9718 ;; We check that there are unread articles.
9719 (when (or all (gnus-summary-find-next))
9720 (gnus-summary-catchup all t beg nil t)))))
9722 (gnus-summary-position-point))
9723 (defun gnus-summary-catchup-all (&optional quietly)
9724 "Mark all articles in this newsgroup as read."
9726 (gnus-summary-catchup t quietly))
9728 (defun gnus-summary-catchup-and-exit (&optional all quietly)
9729 "Mark all unread articles in this group as read, then exit.
9730 If prefix argument ALL is non-nil, all articles are marked as read.
9731 If QUIETLY is non-nil, no questions will be asked."
9733 (when (gnus-summary-catchup all quietly nil 'fast)
9734 ;; Select next newsgroup or exit.
9735 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
9736 (eq gnus-auto-select-next 'quietly))
9737 (gnus-summary-next-group nil)
9738 (gnus-summary-exit))))
9740 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
9741 "Mark all articles in this newsgroup as read, and then exit."
9743 (gnus-summary-catchup-and-exit t quietly))
9745 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
9746 "Mark all articles in this group as read and select the next group.
9747 If given a prefix, mark all articles, unread as well as ticked, as
9751 (gnus-summary-catchup all))
9752 (gnus-summary-next-group))
9758 (defmacro gnus-with-article (article &rest forms)
9759 "Select ARTICLE and perform FORMS in the original article buffer.
9760 Then replace the article with the result."
9762 ;; We don't want the article to be marked as read.
9763 (let (gnus-mark-article-hook)
9764 (gnus-summary-select-article t t nil ,article))
9765 (set-buffer gnus-original-article-buffer)
9767 (if (not (gnus-check-backend-function
9768 'request-replace-article (car gnus-article-current)))
9769 (gnus-message 5 "Read-only group; not replacing")
9770 (unless (gnus-request-replace-article
9771 ,article (car gnus-article-current)
9773 (error "Couldn't replace article")))
9774 ;; The cache and backlog have to be flushed somewhat.
9775 (when gnus-keep-backlog
9776 (gnus-backlog-remove-article
9777 (car gnus-article-current) (cdr gnus-article-current)))
9778 (when gnus-use-cache
9779 (gnus-cache-update-article
9780 (car gnus-article-current) (cdr gnus-article-current)))))
9782 (put 'gnus-with-article 'lisp-indent-function 1)
9783 (put 'gnus-with-article 'edebug-form-spec '(form body))
9785 ;; Thread-based commands.
9787 (defun gnus-summary-articles-in-thread (&optional article)
9788 "Return a list of all articles in the current thread.
9789 If ARTICLE is non-nil, return all articles in the thread that starts
9791 (let* ((article (or article (gnus-summary-article-number)))
9792 (data (gnus-data-find-list article))
9793 (top-level (gnus-data-level (car data)))
9795 (cond ((null gnus-thread-operation-ignore-subject)
9796 (gnus-simplify-subject-re
9797 (mail-header-subject (gnus-data-header (car data)))))
9798 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
9799 (gnus-simplify-subject-fuzzy
9800 (mail-header-subject (gnus-data-header (car data)))))
9802 (end-point (save-excursion
9803 (if (gnus-summary-go-to-next-thread)
9804 (point) (point-max))))
9807 (< (gnus-data-pos (car data)) end-point))
9808 (when (or (not top-subject)
9809 (string= top-subject
9810 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
9811 (gnus-simplify-subject-fuzzy
9812 (mail-header-subject
9813 (gnus-data-header (car data))))
9814 (gnus-simplify-subject-re
9815 (mail-header-subject
9816 (gnus-data-header (car data)))))))
9817 (push (gnus-data-number (car data)) articles))
9818 (unless (and (setq data (cdr data))
9819 (> (gnus-data-level (car data)) top-level))
9821 ;; Return the list of articles.
9822 (nreverse articles)))
9824 (defun gnus-summary-rethread-current ()
9825 "Rethread the thread the current article is part of."
9827 (let* ((gnus-show-threads t)
9828 (article (gnus-summary-article-number))
9829 (id (mail-header-id (gnus-summary-article-header)))
9830 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
9832 (error "No article on the current line"))
9833 (gnus-rebuild-thread id)
9834 (gnus-summary-goto-subject article)))
9836 (defun gnus-summary-reparent-thread ()
9837 "Make the current article child of the marked (or previous) article.
9839 Note that the re-threading will only work if `gnus-thread-ignore-subject'
9840 is non-nil or the Subject: of both articles are the same."
9842 (unless (not (gnus-group-read-only-p))
9843 (error "The current newsgroup does not support article editing"))
9844 (unless (<= (length gnus-newsgroup-processable) 1)
9845 (error "No more than one article may be marked"))
9846 (save-window-excursion
9847 (let ((gnus-article-buffer " *reparent*")
9848 (current-article (gnus-summary-article-number))
9849 ;; First grab the marked article, otherwise one line up.
9850 (parent-article (if (not (null gnus-newsgroup-processable))
9851 (car gnus-newsgroup-processable)
9853 (if (eq (forward-line -1) 0)
9854 (gnus-summary-article-number)
9855 (error "Beginning of summary buffer"))))))
9856 (unless (not (eq current-article parent-article))
9857 (error "An article may not be self-referential"))
9858 (let ((message-id (mail-header-id
9859 (gnus-summary-article-header parent-article))))
9860 (unless (and message-id (not (equal message-id "")))
9861 (error "No message-id in desired parent"))
9862 (gnus-with-article current-article
9864 (goto-char (point-min))
9865 (message-narrow-to-head)
9866 (if (re-search-forward "^References: " nil t)
9868 (re-search-forward "^[^ \t]" nil t)
9871 (insert " " message-id))
9872 (insert "References: " message-id "\n"))))
9873 (set-buffer gnus-summary-buffer)
9874 (gnus-summary-unmark-all-processable)
9875 (gnus-summary-update-article current-article)
9876 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9877 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
9878 (gnus-summary-rethread-current)
9879 (gnus-message 3 "Article %d is now the child of article %d"
9880 current-article parent-article)))))
9882 (defun gnus-summary-toggle-threads (&optional arg)
9883 "Toggle showing conversation threads.
9884 If ARG is positive number, turn showing conversation threads on."
9886 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
9887 (setq gnus-show-threads
9888 (if (null arg) (not gnus-show-threads)
9889 (> (prefix-numeric-value arg) 0)))
9890 (gnus-summary-prepare)
9891 (gnus-summary-goto-subject current)
9892 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
9893 (gnus-summary-position-point)))
9895 (defun gnus-summary-show-all-threads ()
9899 (let ((buffer-read-only nil))
9900 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
9901 (gnus-summary-position-point))
9903 (defun gnus-summary-show-thread ()
9904 "Show thread subtrees.
9905 Returns nil if no thread was there to be shown."
9907 (let ((buffer-read-only nil)
9909 ;; first goto end then to beg, to have point at beg after let
9910 (end (progn (end-of-line) (point)))
9911 (beg (progn (beginning-of-line) (point))))
9913 ;; Any hidden lines here?
9914 (search-forward "\r" end t)
9915 (subst-char-in-region beg end ?\^M ?\n t)
9917 (gnus-summary-position-point))))
9919 (defun gnus-summary-maybe-hide-threads ()
9920 "If requested, hide the threads that should be hidden."
9921 (when (and gnus-show-threads
9922 gnus-thread-hide-subtree)
9923 (gnus-summary-hide-all-threads
9924 (if (or (consp gnus-thread-hide-subtree)
9925 (gnus-functionp gnus-thread-hide-subtree))
9926 (gnus-make-predicate gnus-thread-hide-subtree)
9929 ;;; Hiding predicates.
9931 (defun gnus-article-unread-p (header)
9932 (memq (mail-header-number header) gnus-newsgroup-unreads))
9934 (defun gnus-article-unseen-p (header)
9935 (memq (mail-header-number header) gnus-newsgroup-unseen))
9937 (defun gnus-map-articles (predicate articles)
9938 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
9939 (apply 'gnus-or (mapcar predicate
9940 (mapcar 'gnus-summary-article-header articles))))
9942 (defun gnus-summary-hide-all-threads (&optional predicate)
9943 "Hide all thread subtrees.
9944 If PREDICATE is supplied, threads that satisfy this predicate
9945 will not be hidden."
9948 (goto-char (point-min))
9951 (when (or (not predicate)
9953 predicate (gnus-summary-article-children)))
9954 (gnus-summary-hide-thread))
9955 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
9956 (gnus-summary-position-point))
9958 (defun gnus-summary-hide-thread ()
9959 "Hide thread subtrees.
9960 If PREDICATE is supplied, threads that satisfy this predicate
9962 Returns nil if no threads were there to be hidden."
9964 (let ((buffer-read-only nil)
9966 (article (gnus-summary-article-number)))
9968 ;; Go forward until either the buffer ends or the subthread
9970 (when (and (not (eobp))
9971 (or (zerop (gnus-summary-next-thread 1 t))
9972 (goto-char (point-max))))
9974 (if (and (> (point) start)
9975 (search-backward "\n" start t))
9977 (subst-char-in-region start (point) ?\n ?\^M)
9978 (gnus-summary-goto-subject article))
9982 (defun gnus-summary-go-to-next-thread (&optional previous)
9983 "Go to the same level (or less) next thread.
9984 If PREVIOUS is non-nil, go to previous thread instead.
9985 Return the article number moved to, or nil if moving was impossible."
9986 (let ((level (gnus-summary-thread-level))
9987 (way (if previous -1 1))
9990 (while (and (not (eobp))
9991 (< level (gnus-summary-thread-level)))
9999 (gnus-summary-article-number)
10000 (goto-char beg)))))
10002 (defun gnus-summary-next-thread (n &optional silent)
10003 "Go to the same level next N'th thread.
10004 If N is negative, search backward instead.
10005 Returns the difference between N and the number of skips actually
10008 If SILENT, don't output messages."
10010 (let ((backward (< n 0))
10012 (while (and (> n 0)
10013 (gnus-summary-go-to-next-thread backward))
10016 (gnus-summary-position-point))
10017 (when (and (not silent) (/= 0 n))
10018 (gnus-message 7 "No more threads"))
10021 (defun gnus-summary-prev-thread (n)
10022 "Go to the same level previous N'th thread.
10023 Returns the difference between N and the number of skips actually
10026 (gnus-summary-next-thread (- n)))
10028 (defun gnus-summary-go-down-thread ()
10029 "Go down one level in the current thread."
10030 (let ((children (gnus-summary-article-children)))
10032 (gnus-summary-goto-subject (car children)))))
10034 (defun gnus-summary-go-up-thread ()
10035 "Go up one level in the current thread."
10036 (let ((parent (gnus-summary-article-parent)))
10038 (gnus-summary-goto-subject parent))))
10040 (defun gnus-summary-down-thread (n)
10041 "Go down thread N steps.
10042 If N is negative, go up instead.
10043 Returns the difference between N and how many steps down that were
10048 (while (and (> n 0)
10049 (if up (gnus-summary-go-up-thread)
10050 (gnus-summary-go-down-thread)))
10052 (gnus-summary-position-point)
10054 (gnus-message 7 "Can't go further"))
10057 (defun gnus-summary-up-thread (n)
10058 "Go up thread N steps.
10059 If N is negative, go down instead.
10060 Returns the difference between N and how many steps down that were
10063 (gnus-summary-down-thread (- n)))
10065 (defun gnus-summary-top-thread ()
10066 "Go to the top of the thread."
10068 (while (gnus-summary-go-up-thread))
10069 (gnus-summary-article-number))
10071 (defun gnus-summary-kill-thread (&optional unmark)
10072 "Mark articles under current thread as read.
10073 If the prefix argument is positive, remove any kinds of marks.
10074 If the prefix argument is negative, tick articles instead."
10077 (setq unmark (prefix-numeric-value unmark)))
10078 (let ((articles (gnus-summary-articles-in-thread)))
10080 ;; Expand the thread.
10081 (gnus-summary-show-thread)
10082 ;; Mark all the articles.
10084 (gnus-summary-goto-subject (car articles))
10085 (cond ((null unmark)
10086 (gnus-summary-mark-article-as-read gnus-killed-mark))
10088 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10090 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10091 (setq articles (cdr articles))))
10092 ;; Hide killed subtrees.
10094 gnus-thread-hide-killed
10095 (gnus-summary-hide-thread))
10096 ;; If marked as read, go to next unread subject.
10097 (when (null unmark)
10098 ;; Go to next unread subject.
10099 (gnus-summary-next-subject 1 t)))
10100 (gnus-set-mode-line 'summary))
10102 ;; Summary sorting commands
10104 (defun gnus-summary-sort-by-number (&optional reverse)
10105 "Sort the summary buffer by article number.
10106 Argument REVERSE means reverse order."
10108 (gnus-summary-sort 'number reverse))
10110 (defun gnus-summary-sort-by-author (&optional reverse)
10111 "Sort the summary buffer by author name alphabetically.
10112 If `case-fold-search' is non-nil, case of letters is ignored.
10113 Argument REVERSE means reverse order."
10115 (gnus-summary-sort 'author reverse))
10117 (defun gnus-summary-sort-by-subject (&optional reverse)
10118 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10119 If `case-fold-search' is non-nil, case of letters is ignored.
10120 Argument REVERSE means reverse order."
10122 (gnus-summary-sort 'subject reverse))
10124 (defun gnus-summary-sort-by-date (&optional reverse)
10125 "Sort the summary buffer by date.
10126 Argument REVERSE means reverse order."
10128 (gnus-summary-sort 'date reverse))
10130 (defun gnus-summary-sort-by-score (&optional reverse)
10131 "Sort the summary buffer by score.
10132 Argument REVERSE means reverse order."
10134 (gnus-summary-sort 'score reverse))
10136 (defun gnus-summary-sort-by-lines (&optional reverse)
10137 "Sort the summary buffer by the number of lines.
10138 Argument REVERSE means reverse order."
10140 (gnus-summary-sort 'lines reverse))
10142 (defun gnus-summary-sort-by-chars (&optional reverse)
10143 "Sort the summary buffer by article length.
10144 Argument REVERSE means reverse order."
10146 (gnus-summary-sort 'chars reverse))
10148 (defun gnus-summary-sort-by-original (&optional reverse)
10149 "Sort the summary buffer using the default sorting method.
10150 Argument REVERSE means reverse order."
10152 (let* ((buffer-read-only)
10153 (gnus-summary-prepare-hook nil))
10154 ;; We do the sorting by regenerating the threads.
10155 (gnus-summary-prepare)
10156 ;; Hide subthreads if needed.
10157 (gnus-summary-maybe-hide-threads)))
10159 (defun gnus-summary-sort (predicate reverse)
10160 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10161 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10162 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10163 (gnus-thread-sort-functions
10168 (gnus-sort-gathered-threads-function
10169 gnus-thread-sort-functions)
10170 (gnus-article-sort-functions
10174 (,article t2 t1))))
10176 (gnus-summary-prepare-hook nil))
10177 ;; We do the sorting by regenerating the threads.
10178 (gnus-summary-prepare)
10179 ;; Hide subthreads if needed.
10180 (gnus-summary-maybe-hide-threads)))
10182 ;; Summary saving commands.
10184 (defun gnus-summary-save-article (&optional n not-saved)
10185 "Save the current article using the default saver function.
10186 If N is a positive number, save the N next articles.
10187 If N is a negative number, save the N previous articles.
10188 If N is nil and any articles have been marked with the process mark,
10189 save those articles instead.
10190 The variable `gnus-default-article-saver' specifies the saver function."
10192 (let* ((articles (gnus-summary-work-articles n))
10193 (save-buffer (save-excursion
10194 (nnheader-set-temp-buffer " *Gnus Save*")))
10195 (num (length articles))
10197 (dolist (article articles)
10198 (setq header (gnus-summary-article-header article))
10199 (if (not (vectorp header))
10200 ;; This is a pseudo-article.
10201 (if (assq 'name header)
10202 (gnus-copy-file (cdr (assq 'name header)))
10203 (gnus-message 1 "Article %d is unsaveable" article))
10204 ;; This is a real article.
10205 (save-window-excursion
10206 (let ((gnus-display-mime-function nil)
10207 (gnus-article-prepare-hook nil))
10208 (gnus-summary-select-article t nil nil article)))
10210 (set-buffer save-buffer)
10212 (insert-buffer-substring gnus-original-article-buffer))
10213 (setq file (gnus-article-save save-buffer file num))
10214 (gnus-summary-remove-process-mark article)
10216 (gnus-summary-set-saved-mark article))))
10217 (gnus-kill-buffer save-buffer)
10218 (gnus-summary-position-point)
10219 (gnus-set-mode-line 'summary)
10222 (defun gnus-summary-pipe-output (&optional arg)
10223 "Pipe the current article to a subprocess.
10224 If N is a positive number, pipe the N next articles.
10225 If N is a negative number, pipe the N previous articles.
10226 If N is nil and any articles have been marked with the process mark,
10227 pipe those articles instead."
10229 (require 'gnus-art)
10230 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
10231 (gnus-summary-save-article arg t))
10232 (let ((buffer (get-buffer "*Shell Command Output*")))
10234 (with-current-buffer buffer (> (point-max) (point-min))))
10235 (gnus-configure-windows 'pipe))))
10237 (defun gnus-summary-save-article-mail (&optional arg)
10238 "Append the current article to an mail file.
10239 If N is a positive number, save the N next articles.
10240 If N is a negative number, save the N previous articles.
10241 If N is nil and any articles have been marked with the process mark,
10242 save those articles instead."
10244 (require 'gnus-art)
10245 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10246 (gnus-summary-save-article arg)))
10248 (defun gnus-summary-save-article-rmail (&optional arg)
10249 "Append the current article to an rmail file.
10250 If N is a positive number, save the N next articles.
10251 If N is a negative number, save the N previous articles.
10252 If N is nil and any articles have been marked with the process mark,
10253 save those articles instead."
10255 (require 'gnus-art)
10256 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10257 (gnus-summary-save-article arg)))
10259 (defun gnus-summary-save-article-file (&optional arg)
10260 "Append the current article to a file.
10261 If N is a positive number, save the N next articles.
10262 If N is a negative number, save the N previous articles.
10263 If N is nil and any articles have been marked with the process mark,
10264 save those articles instead."
10266 (require 'gnus-art)
10267 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10268 (gnus-summary-save-article arg)))
10270 (defun gnus-summary-write-article-file (&optional arg)
10271 "Write the current article to a file, deleting the previous file.
10272 If N is a positive number, save the N next articles.
10273 If N is a negative number, save the N previous articles.
10274 If N is nil and any articles have been marked with the process mark,
10275 save those articles instead."
10277 (require 'gnus-art)
10278 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10279 (gnus-summary-save-article arg)))
10281 (defun gnus-summary-save-article-body-file (&optional arg)
10282 "Append the current article body to a file.
10283 If N is a positive number, save the N next articles.
10284 If N is a negative number, save the N previous articles.
10285 If N is nil and any articles have been marked with the process mark,
10286 save those articles instead."
10288 (require 'gnus-art)
10289 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10290 (gnus-summary-save-article arg)))
10292 (defun gnus-summary-muttprint (&optional arg)
10293 "Print the current article using Muttprint.
10294 If N is a positive number, save the N next articles.
10295 If N is a negative number, save the N previous articles.
10296 If N is nil and any articles have been marked with the process mark,
10297 save those articles instead."
10299 (require 'gnus-art)
10300 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10301 (gnus-summary-save-article arg t)))
10303 (defun gnus-summary-pipe-message (program)
10304 "Pipe the current article through PROGRAM."
10305 (interactive "sProgram: ")
10306 (gnus-summary-select-article)
10307 (let ((mail-header-separator ""))
10308 (gnus-eval-in-buffer-window gnus-article-buffer
10311 (let ((start (window-start))
10313 (message-pipe-buffer-body program)
10314 (set-window-start (get-buffer-window (current-buffer)) start))))))
10316 (defun gnus-get-split-value (methods)
10317 "Return a value based on the split METHODS."
10318 (let (split-name method result match)
10321 (set-buffer gnus-original-article-buffer)
10323 (nnheader-narrow-to-headers)
10324 (while (and methods (not split-name))
10325 (goto-char (point-min))
10326 (setq method (pop methods))
10327 (setq match (car method))
10330 ;; Regular expression.
10332 (re-search-forward match nil t)))
10333 ((gnus-functionp match)
10337 (setq result (funcall match gnus-newsgroup-name))))
10342 (setq result (eval match)))))
10343 (setq split-name (cdr method))
10344 (cond ((stringp result)
10345 (push (expand-file-name
10346 result gnus-article-save-directory)
10349 (setq split-name (append result split-name)))))))))
10350 (nreverse split-name)))
10352 (defun gnus-valid-move-group-p (group)
10353 (and (boundp group)
10354 (symbol-name group)
10355 (symbol-value group)
10356 (gnus-get-function (gnus-find-method-for-group
10357 (symbol-name group)) 'request-accept-article t)))
10359 (defun gnus-read-move-group-name (prompt default articles prefix)
10360 "Read a group name."
10361 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10362 (minibuffer-confirm-incomplete nil) ; XEmacs
10364 (format "%s %s to:"
10366 (if (> (length articles) 1)
10367 (format "these %d articles" (length articles))
10372 (gnus-completing-read-with-default
10375 'gnus-valid-move-group-p
10377 'gnus-group-history))
10378 ((= 1 (length split-name))
10379 (gnus-completing-read-with-default
10380 (car split-name) prom
10382 'gnus-valid-move-group-p
10384 'gnus-group-history))
10386 (gnus-completing-read-with-default
10388 (mapcar (lambda (el) (list el))
10389 (nreverse split-name))
10391 'gnus-group-history))))
10392 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10394 (if (or (string= to-newsgroup "")
10395 (string= to-newsgroup prefix))
10396 (setq to-newsgroup default))
10397 (unless to-newsgroup
10398 (error "No group name entered"))
10399 (or (gnus-active to-newsgroup)
10400 (gnus-activate-group to-newsgroup nil nil to-method)
10401 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10403 (or (and (gnus-request-create-group to-newsgroup to-method)
10404 (gnus-activate-group
10405 to-newsgroup nil nil to-method)
10406 (gnus-subscribe-group to-newsgroup))
10407 (error "Couldn't create group %s" to-newsgroup)))
10408 (error "No such group: %s" to-newsgroup)))
10411 (defun gnus-summary-save-parts (type dir n &optional reverse)
10412 "Save parts matching TYPE to DIR.
10413 If REVERSE, save parts that do not match TYPE."
10415 (list (read-string "Save parts of type: "
10416 (or (car gnus-summary-save-parts-type-history)
10417 gnus-summary-save-parts-default-mime)
10418 'gnus-summary-save-parts-type-history)
10419 (setq gnus-summary-save-parts-last-directory
10420 (read-file-name "Save to directory: "
10421 gnus-summary-save-parts-last-directory
10423 current-prefix-arg))
10424 (gnus-summary-iterate n
10425 (let ((gnus-display-mime-function nil)
10426 (gnus-inhibit-treatment t))
10427 (gnus-summary-select-article))
10429 (set-buffer gnus-article-buffer)
10430 (let ((handles (or gnus-article-mime-handles
10431 (mm-dissect-buffer nil gnus-article-loose-mime)
10434 (gnus-summary-save-parts-1 type dir handles reverse)
10435 (unless gnus-article-mime-handles ;; Don't destroy this case.
10436 (mm-destroy-parts handles)))))))
10438 (defun gnus-summary-save-parts-1 (type dir handle reverse)
10439 (if (stringp (car handle))
10440 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
10443 (not (string-match type (mm-handle-media-type handle)))
10444 (string-match type (mm-handle-media-type handle)))
10445 (let ((file (expand-file-name
10446 (file-name-nondirectory
10448 (mail-content-type-get
10449 (mm-handle-disposition handle) 'filename)
10450 (concat gnus-newsgroup-name
10451 "." (number-to-string
10452 (cdr gnus-article-current)))))
10454 (unless (file-exists-p file)
10455 (mm-save-part-to-file handle file))))))
10457 ;; Summary extract commands
10459 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
10460 (let ((buffer-read-only nil)
10461 (article (gnus-summary-article-number))
10463 (unless (gnus-summary-goto-subject article)
10464 (error "No such article: %d" article))
10465 (gnus-summary-position-point)
10466 ;; If all commands are to be bunched up on one line, we collect
10468 (unless gnus-view-pseudos-separately
10469 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
10472 (setq action (cdr (assq 'action (car ps))))
10473 (setq files (list (cdr (assq 'name (car ps)))))
10474 (while (and ps (cdr ps)
10475 (string= (or action "1")
10476 (or (cdr (assq 'action (cadr ps))) "2")))
10477 (push (cdr (assq 'name (cadr ps))) files)
10478 (setcdr ps (cddr ps)))
10480 (when (not (string-match "%s" action))
10483 (when (assq 'execute (car ps))
10484 (setcdr (assq 'execute (car ps))
10485 (funcall (if (string-match "%s" action)
10494 (setq ps (cdr ps)))))
10495 (if (and gnus-view-pseudos (not not-view))
10497 (when (assq 'execute (car pslist))
10498 (gnus-execute-command (cdr (assq 'execute (car pslist)))
10499 (eq gnus-view-pseudos 'not-confirm)))
10500 (setq pslist (cdr pslist)))
10503 (setq after-article (or (cdr (assq 'article (car pslist)))
10504 (gnus-summary-article-number)))
10505 (gnus-summary-goto-subject after-article)
10508 (insert " " (file-name-nondirectory
10509 (cdr (assq 'name (car pslist))))
10510 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
10512 (forward-line -1) ; back to `b'
10513 (gnus-add-text-properties
10514 b (1- e) (list 'gnus-number gnus-reffed-article-number
10515 gnus-mouse-face-prop gnus-mouse-face))
10517 after-article gnus-reffed-article-number
10518 gnus-unread-mark b (car pslist) 0 (- e b))
10519 (setq gnus-newsgroup-unreads
10520 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10521 gnus-reffed-article-number))
10522 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
10523 (setq pslist (cdr pslist)))))))
10525 (defun gnus-pseudos< (p1 p2)
10526 (let ((c1 (cdr (assq 'action p1)))
10527 (c2 (cdr (assq 'action p2))))
10528 (and c1 c2 (string< c1 c2))))
10530 (defun gnus-request-pseudo-article (props)
10531 (cond ((assq 'execute props)
10532 (gnus-execute-command (cdr (assq 'execute props)))))
10533 (let ((gnus-current-article (gnus-summary-article-number)))
10534 (gnus-run-hooks 'gnus-mark-article-hook)))
10536 (defun gnus-execute-command (command &optional automatic)
10538 (gnus-article-setup-buffer)
10539 (set-buffer gnus-article-buffer)
10540 (setq buffer-read-only nil)
10541 (let ((command (if automatic command
10542 (read-string "Command: " (cons command 0)))))
10544 (insert "$ " command "\n\n")
10545 (if gnus-view-pseudo-asynchronously
10546 (start-process "gnus-execute" (current-buffer) shell-file-name
10547 shell-command-switch command)
10548 (call-process shell-file-name nil t nil
10549 shell-command-switch command)))))
10551 ;; Summary kill commands.
10553 (defun gnus-summary-edit-global-kill (article)
10554 "Edit the \"global\" kill file."
10555 (interactive (list (gnus-summary-article-number)))
10556 (gnus-group-edit-global-kill article))
10558 (defun gnus-summary-edit-local-kill ()
10559 "Edit a local kill file applied to the current newsgroup."
10561 (setq gnus-current-headers (gnus-summary-article-header))
10562 (gnus-group-edit-local-kill
10563 (gnus-summary-article-number) gnus-newsgroup-name))
10565 ;;; Header reading.
10567 (defun gnus-read-header (id &optional header)
10568 "Read the headers of article ID and enter them into the Gnus system."
10569 (let ((group gnus-newsgroup-name)
10570 (gnus-override-method
10572 gnus-override-method
10573 (and (gnus-news-group-p gnus-newsgroup-name)
10574 (car (gnus-refer-article-methods)))))
10576 ;; First we check to see whether the header in question is already
10579 ;; This is a Message-ID.
10580 (setq header (or header (gnus-id-to-header id)))
10581 ;; This is an article number.
10582 (setq header (or header (gnus-summary-article-header id))))
10584 (not (gnus-summary-article-sparse-p (mail-header-number header))))
10585 ;; We have found the header.
10587 ;; If this is a sparse article, we have to nix out its
10588 ;; previous entry in the thread hashtb.
10590 (gnus-summary-article-sparse-p (mail-header-number header)))
10591 (let* ((parent (gnus-parent-id (mail-header-references header)))
10592 (thread (and parent (gnus-id-to-thread parent))))
10594 (delq (assq header thread) thread))))
10595 ;; We have to really fetch the header to this article.
10597 (set-buffer nntp-server-buffer)
10598 (when (setq where (gnus-request-head id group))
10599 (nnheader-fold-continuation-lines)
10600 (goto-char (point-max))
10602 (goto-char (point-min))
10606 ((cdr where) (cdr where))
10607 (header (mail-header-number header))
10608 (t gnus-reffed-article-number))
10610 (insert " Article retrieved.\n"))
10611 (if (or (not where)
10612 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
10613 () ; Malformed head.
10614 (unless (gnus-summary-article-sparse-p (mail-header-number header))
10615 (when (and (stringp id)
10616 (not (string= (gnus-group-real-name group)
10618 ;; If we fetched by Message-ID and the article came
10619 ;; from a different group, we fudge some bogus article
10620 ;; numbers for this article.
10621 (mail-header-set-number header gnus-reffed-article-number))
10623 (set-buffer gnus-summary-buffer)
10624 (decf gnus-reffed-article-number)
10625 (gnus-remove-header (mail-header-number header))
10626 (push header gnus-newsgroup-headers)
10627 (setq gnus-current-headers header)
10628 (push (mail-header-number header) gnus-newsgroup-limit)))
10631 (defun gnus-remove-header (number)
10632 "Remove header NUMBER from `gnus-newsgroup-headers'."
10633 (if (and gnus-newsgroup-headers
10634 (= number (mail-header-number (car gnus-newsgroup-headers))))
10635 (pop gnus-newsgroup-headers)
10636 (let ((headers gnus-newsgroup-headers))
10637 (while (and (cdr headers)
10638 (not (= number (mail-header-number (cadr headers)))))
10640 (when (cdr headers)
10641 (setcdr headers (cddr headers))))))
10644 ;;; summary highlights
10647 (defun gnus-highlight-selected-summary ()
10648 "Highlight selected article in summary buffer."
10649 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
10650 (when gnus-summary-selected-face
10652 (let* ((beg (progn (beginning-of-line) (point)))
10653 (end (progn (end-of-line) (point)))
10654 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
10655 (from (if (get-text-property beg gnus-mouse-face-prop)
10657 (or (next-single-property-change
10658 beg gnus-mouse-face-prop nil end)
10663 (or (next-single-property-change
10664 from gnus-mouse-face-prop nil end)
10666 ;; If no mouse-face prop on line we will have to = from = end,
10667 ;; so we highlight the entire line instead.
10668 (when (= (+ to 2) from)
10671 (if gnus-newsgroup-selected-overlay
10672 ;; Move old overlay.
10674 gnus-newsgroup-selected-overlay from to (current-buffer))
10675 ;; Create new overlay.
10677 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
10678 'face gnus-summary-selected-face))))))
10680 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
10681 (defun gnus-summary-highlight-line ()
10682 "Highlight current line according to `gnus-summary-highlight'."
10683 (let* ((list gnus-summary-highlight)
10684 (beg (gnus-point-at-bol))
10685 (article (gnus-summary-article-number))
10686 (score (or (cdr (assq (or article gnus-current-article)
10687 gnus-newsgroup-scored))
10688 gnus-summary-default-score 0))
10689 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
10690 (inhibit-read-only t)
10691 (default gnus-summary-default-score)
10692 (default-high gnus-summary-default-high-score)
10693 (default-low gnus-summary-default-low-score))
10694 ;; Eval the cars of the lists until we find a match.
10696 (not (eval (caar list))))
10697 (setq list (cdr list)))
10698 (let ((face (cdar list)))
10699 (unless (eq face (get-text-property beg 'face))
10700 (gnus-put-text-property-excluding-characters-with-faces
10701 beg (gnus-point-at-eol) 'face
10702 (setq face (if (boundp face) (symbol-value face) face)))
10703 (when gnus-summary-highlight-line-function
10704 (funcall gnus-summary-highlight-line-function article face))))))
10706 (defun gnus-update-read-articles (group unread &optional compute)
10707 "Update the list of read articles in GROUP.
10708 UNREAD is a sorted list."
10709 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
10710 (entry (gnus-gethash group gnus-newsrc-hashtb))
10711 (info (nth 2 entry))
10714 (if (or (not info) (not active))
10715 ;; There is no info on this group if it was, in fact,
10716 ;; killed. Gnus stores no information on killed groups, so
10717 ;; there's nothing to be done.
10718 ;; One could store the information somewhere temporarily,
10719 ;; perhaps... Hmmm...
10721 ;; Remove any negative articles numbers.
10722 (while (and unread (< (car unread) 0))
10723 (setq unread (cdr unread)))
10724 ;; Remove any expired article numbers
10725 (while (and unread (< (car unread) (car active)))
10726 (setq unread (cdr unread)))
10727 ;; Compute the ranges of read articles by looking at the list of
10728 ;; unread articles.
10730 (when (/= (car unread) prev)
10731 (push (if (= prev (1- (car unread))) prev
10732 (cons prev (1- (car unread))))
10734 (setq prev (1+ (car unread)))
10735 (setq unread (cdr unread)))
10736 (when (<= prev (cdr active))
10737 (push (cons prev (cdr active)) read))
10738 (setq read (if (> (length read) 1) (nreverse read) read))
10743 ;; Propagate the read marks to the backend.
10744 (when (gnus-check-backend-function 'request-set-mark group)
10745 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
10746 (add (gnus-remove-from-range read (gnus-info-read info))))
10748 (unless (gnus-check-group group)
10749 (error "Can't open server for %s" group))
10750 (gnus-request-set-mark
10751 group (delq nil (list (if add (list add 'add '(read)))
10752 (if del (list del 'del '(read))))))
10754 `(gnus-request-set-mark
10757 (if del (list del 'add '(read)))
10758 (if add (list add 'del '(read))))))))))
10759 (set-buffer gnus-group-buffer)
10760 (gnus-undo-register
10762 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
10763 (gnus-info-set-read ',info ',(gnus-info-read info))
10764 (gnus-get-unread-articles-in-group ',info
10765 (gnus-active ,group))
10766 (gnus-group-update-group ,group t)
10768 ;; Enter this list into the group info.
10769 (gnus-info-set-read info read)
10770 ;; Set the number of unread articles in gnus-newsrc-hashtb.
10771 (gnus-get-unread-articles-in-group info (gnus-active group))
10774 (defun gnus-offer-save-summaries ()
10775 "Offer to save all active summary buffers."
10777 ;; Go through all buffers and find all summaries.
10778 (dolist (buffer (buffer-list))
10779 (when (and (setq buffer (buffer-name buffer))
10780 (string-match "Summary" buffer)
10782 (set-buffer buffer)
10783 ;; We check that this is, indeed, a summary buffer.
10784 (and (eq major-mode 'gnus-summary-mode)
10785 ;; Also make sure this isn't bogus.
10786 gnus-newsgroup-prepared
10787 ;; Also make sure that this isn't a
10788 ;; dead summary buffer.
10789 (not gnus-dead-summary-mode))))
10790 (push buffer buffers)))
10791 ;; Go through all these summary buffers and offer to save them.
10795 "Update summary buffer %s? "
10797 (switch-to-buffer buf)
10798 (gnus-summary-exit))
10801 (defun gnus-summary-setup-default-charset ()
10802 "Setup newsgroup default charset."
10803 (if (equal gnus-newsgroup-name "nndraft:drafts")
10804 (setq gnus-newsgroup-charset nil)
10805 (let* ((ignored-charsets
10806 (or gnus-newsgroup-ephemeral-ignored-charsets
10808 (and gnus-newsgroup-name
10809 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
10810 gnus-newsgroup-ignored-charsets))))
10811 (setq gnus-newsgroup-charset
10812 (or gnus-newsgroup-ephemeral-charset
10813 (and gnus-newsgroup-name
10814 (gnus-parameter-charset gnus-newsgroup-name))
10815 gnus-default-charset))
10816 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
10817 ignored-charsets))))
10823 (defun gnus-summary-display-buttonized (&optional show-all-parts)
10824 "Display the current article buffer fully MIME-buttonized.
10825 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
10826 treated as multipart/mixed."
10828 (require 'gnus-art)
10829 (let ((gnus-unbuttonized-mime-types nil)
10830 (gnus-mime-display-multipart-as-mixed show-all-parts))
10831 (gnus-summary-show-article)))
10833 (defun gnus-summary-repair-multipart (article)
10834 "Add a Content-Type header to a multipart article without one."
10835 (interactive (list (gnus-summary-article-number)))
10836 (gnus-with-article article
10837 (message-narrow-to-head)
10838 (message-remove-header "Mime-Version")
10839 (goto-char (point-max))
10840 (insert "Mime-Version: 1.0\n")
10842 (when (search-forward "\n--" nil t)
10843 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
10844 (message-narrow-to-head)
10845 (message-remove-header "Content-Type")
10846 (goto-char (point-max))
10847 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
10850 (let (gnus-mark-article-hook)
10851 (gnus-summary-select-article t t nil article)))
10853 (defun gnus-summary-toggle-display-buttonized ()
10854 "Toggle the buttonizing of the article buffer."
10856 (require 'gnus-art)
10857 (if (setq gnus-inhibit-mime-unbuttonizing
10858 (not gnus-inhibit-mime-unbuttonizing))
10859 (let ((gnus-unbuttonized-mime-types nil))
10860 (gnus-summary-show-article))
10861 (gnus-summary-show-article)))
10864 ;;; Generic summary marking commands
10867 (defvar gnus-summary-marking-alist
10868 '((read gnus-del-mark "d")
10869 (unread gnus-unread-mark "u")
10870 (ticked gnus-ticked-mark "!")
10871 (dormant gnus-dormant-mark "?")
10872 (expirable gnus-expirable-mark "e"))
10873 "An alist of names/marks/keystrokes.")
10875 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
10876 (defvar gnus-summary-mark-map)
10878 (defun gnus-summary-make-all-marking-commands ()
10879 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
10880 (dolist (elem gnus-summary-marking-alist)
10881 (apply 'gnus-summary-make-marking-command elem)))
10883 (defun gnus-summary-make-marking-command (name mark keystroke)
10884 (let ((map (make-sparse-keymap)))
10885 (define-key gnus-summary-generic-mark-map keystroke map)
10886 (dolist (lway `((next "next" next nil "n")
10887 (next-unread "next unread" next t "N")
10888 (prev "previous" prev nil "p")
10889 (prev-unread "previous unread" prev t "P")
10890 (nomove "" nil nil ,keystroke)))
10891 (let ((func (gnus-summary-make-marking-command-1
10892 mark (car lway) lway name)))
10893 (setq func (eval func))
10894 (define-key map (nth 4 lway) func)))))
10896 (defun gnus-summary-make-marking-command-1 (mark way lway name)
10898 (format "gnus-summary-put-mark-as-%s%s"
10899 name (if (eq way 'nomove)
10901 (concat "-" (symbol-name way)))))
10904 "Mark the current article as %s%s.
10905 If N, the prefix, then repeat N times.
10906 If N is negative, move in reverse order.
10907 The difference between N and the actual number of articles marked is
10911 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
10913 (defun gnus-summary-generic-mark (n mark move unread)
10914 "Mark N articles with MARK."
10915 (unless (eq major-mode 'gnus-summary-mode)
10916 (error "This command can only be used in the summary buffer"))
10917 (gnus-summary-show-thread)
10920 ((eq move 'next) 1)
10921 ((eq move 'prev) -1)
10923 (if (zerop nummove)
10927 nummove (* -1 nummove))))
10928 (while (and (> n 0)
10929 (gnus-summary-mark-article nil mark)
10930 (zerop (gnus-summary-next-subject nummove unread t)))
10933 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10934 (gnus-summary-recenter)
10935 (gnus-summary-position-point)
10936 (gnus-set-mode-line 'summary)
10939 (defun gnus-summary-insert-articles (articles)
10940 (when (setq articles
10941 (gnus-sorted-difference articles
10942 (mapcar (lambda (h)
10943 (mail-header-number h))
10944 gnus-newsgroup-headers)))
10945 (setq gnus-newsgroup-headers
10947 gnus-newsgroup-headers
10948 (gnus-fetch-headers articles)
10949 'gnus-article-sort-by-number))
10950 ;; Suppress duplicates?
10951 (when gnus-suppress-duplicates
10952 (gnus-dup-suppress-articles))
10954 ;; We might want to build some more threads first.
10955 (when (and gnus-fetch-old-headers
10956 (eq gnus-headers-retrieved-by 'nov))
10957 (if (eq gnus-fetch-old-headers 'invisible)
10958 (gnus-build-all-threads)
10959 (gnus-build-old-threads)))
10960 ;; Let the Gnus agent mark articles as read.
10962 (gnus-agent-get-undownloaded-list))
10963 ;; Remove list identifiers from subject
10964 (when gnus-list-identifiers
10965 (gnus-summary-remove-list-identifiers))
10966 ;; First and last article in this newsgroup.
10967 (when gnus-newsgroup-headers
10968 (setq gnus-newsgroup-begin
10969 (mail-header-number (car gnus-newsgroup-headers))
10971 (mail-header-number
10972 (gnus-last-element gnus-newsgroup-headers))))
10973 (when gnus-use-scoring
10974 (gnus-possibly-score-headers))))
10976 (defun gnus-summary-insert-old-articles (&optional all)
10977 "Insert all old articles in this group.
10978 If ALL is non-nil, already read articles become readable.
10979 If ALL is a number, fetch this number of articles."
10982 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
10985 (gnus-sorted-difference
10986 (gnus-uncompress-range (list gnus-newsgroup-active))
10988 (setq len (length older))
10993 (setq older (last older all))))
10996 (if (and (numberp gnus-large-newsgroup)
10997 (> len gnus-large-newsgroup))
10998 (let* ((cursor-in-echo-area nil)
10999 (initial (gnus-parameter-large-newsgroup-initial
11000 gnus-newsgroup-name))
11004 "How many articles from %s (%s %d): "
11006 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11007 (if initial "max" "default")
11010 (cons (number-to-string initial)
11012 (unless (string-match "^[ \t]*$" input)
11013 (setq all (string-to-number input))
11015 (setq older (last older all))))))))
11017 (message "No old news.")
11018 (gnus-summary-insert-articles older)
11019 (gnus-summary-limit (gnus-sorted-nunion old older))))
11020 (gnus-summary-position-point)))
11022 (defun gnus-summary-insert-new-articles ()
11023 "Insert all new articles in this group."
11026 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11027 (old-active gnus-newsgroup-active)
11028 (nnmail-fetched-sources (list t))
11030 (setq gnus-newsgroup-active
11031 (gnus-activate-group gnus-newsgroup-name 'scan))
11032 (setq i (1+ (cdr old-active)))
11033 (while (<= i (cdr gnus-newsgroup-active))
11037 (message "No gnus is bad news.")
11038 (setq new (nreverse new))
11039 (gnus-summary-insert-articles new)
11040 (setq gnus-newsgroup-unreads
11041 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11042 (gnus-summary-limit (gnus-sorted-nunion old new))))
11043 (gnus-summary-position-point)))
11045 (gnus-summary-make-all-marking-commands)
11047 (gnus-ems-redefine)
11049 (provide 'gnus-sum)
11051 (run-hooks 'gnus-sum-load-hook)
11053 ;;; gnus-sum.el ends here