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-souped-mark ?F
424 "*Mark used for souped articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-kill-file-mark ?X
429 "*Mark used for articles killed by kill files."
430 :group 'gnus-summary-marks
433 (defcustom gnus-low-score-mark ?Y
434 "*Mark used for articles with a low score."
435 :group 'gnus-summary-marks
438 (defcustom gnus-catchup-mark ?C
439 "*Mark used for articles that are caught up."
440 :group 'gnus-summary-marks
443 (defcustom gnus-replied-mark ?A
444 "*Mark used for articles that have been replied to."
445 :group 'gnus-summary-marks
448 (defcustom gnus-forwarded-mark ?F
449 "*Mark used for articles that have been forwarded."
450 :group 'gnus-summary-marks
453 (defcustom gnus-recent-mark ?N
454 "*Mark used for articles that are recent."
455 :group 'gnus-summary-marks
458 (defcustom gnus-cached-mark ?*
459 "*Mark used for articles that are in the cache."
460 :group 'gnus-summary-marks
463 (defcustom gnus-saved-mark ?S
464 "*Mark used for articles that have been saved."
465 :group 'gnus-summary-marks
468 (defcustom gnus-unseen-mark ?.
469 "*Mark used for articles that haven't been seen."
470 :group 'gnus-summary-marks
473 (defcustom gnus-no-mark ? ;Whitespace
474 "*Mark used for articles that have no other secondary mark."
475 :group 'gnus-summary-marks
478 (defcustom gnus-ancient-mark ?O
479 "*Mark used for ancient articles."
480 :group 'gnus-summary-marks
483 (defcustom gnus-sparse-mark ?Q
484 "*Mark used for sparsely reffed articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-canceled-mark ?G
489 "*Mark used for canceled articles."
490 :group 'gnus-summary-marks
493 (defcustom gnus-duplicate-mark ?M
494 "*Mark used for duplicate articles."
495 :group 'gnus-summary-marks
498 (defcustom gnus-undownloaded-mark ?@
499 "*Mark used for articles that weren't downloaded."
500 :group 'gnus-summary-marks
503 (defcustom gnus-downloadable-mark ?%
504 "*Mark used for articles that are to be downloaded."
505 :group 'gnus-summary-marks
508 (defcustom gnus-unsendable-mark ?=
509 "*Mark used for articles that won't be sent."
510 :group 'gnus-summary-marks
513 (defcustom gnus-score-over-mark ?+
514 "*Score mark used for articles with high scores."
515 :group 'gnus-summary-marks
518 (defcustom gnus-score-below-mark ?-
519 "*Score mark used for articles with low scores."
520 :group 'gnus-summary-marks
523 (defcustom gnus-empty-thread-mark ? ;Whitespace
524 "*There is no thread under the article."
525 :group 'gnus-summary-marks
528 (defcustom gnus-not-empty-thread-mark ?=
529 "*There is a thread under the article."
530 :group 'gnus-summary-marks
533 (defcustom gnus-view-pseudo-asynchronously nil
534 "*If non-nil, Gnus will view pseudo-articles asynchronously."
535 :group 'gnus-extract-view
538 (defcustom gnus-auto-expirable-marks
539 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
540 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
541 gnus-souped-mark gnus-duplicate-mark)
542 "*The list of marks converted into expiration if a group is auto-expirable."
545 :type '(repeat character))
547 (defcustom gnus-inhibit-user-auto-expire t
548 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
553 (defcustom gnus-view-pseudos nil
554 "*If `automatic', pseudo-articles will be viewed automatically.
555 If `not-confirm', pseudos will be viewed automatically, and the user
556 will not be asked to confirm the command."
557 :group 'gnus-extract-view
558 :type '(choice (const :tag "off" nil)
560 (const not-confirm)))
562 (defcustom gnus-view-pseudos-separately t
563 "*If non-nil, one pseudo-article will be created for each file to be viewed.
564 If nil, all files that use the same viewing command will be given as a
565 list of parameters to that command."
566 :group 'gnus-extract-view
569 (defcustom gnus-insert-pseudo-articles t
570 "*If non-nil, insert pseudo-articles when decoding articles."
571 :group 'gnus-extract-view
574 (defcustom gnus-summary-dummy-line-format
576 "*The format specification for the dummy roots in the summary buffer.
577 It works along the same lines as a normal formatting string,
578 with some simple extensions.
582 General format specifiers can also be used.
583 See `(gnus)Formatting Variables'."
584 :link '(custom-manual "(gnus)Formatting Variables")
585 :group 'gnus-threading
588 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
589 "*The format specification for the summary mode line.
590 It works along the same lines as a normal formatting string,
591 with some simple extensions:
594 %p Unprefixed group name
595 %A Current article number
596 %z Current article score
598 %U Number of unread articles in the group
599 %e Number of unselected articles in the group
600 %Z A string with unread/unselected article counts
601 %g Shortish group name
602 %S Subject of the current article
604 %s Current score file name
605 %d Number of dormant articles
606 %r Number of articles that have been marked as read in this session
607 %E Number of articles expunged by the score files"
608 :group 'gnus-summary-format
611 (defcustom gnus-list-identifiers nil
612 "Regexp that matches list identifiers to be removed from subject.
613 This can also be a list of regexps."
615 :group 'gnus-summary-format
616 :group 'gnus-article-hiding
617 :type '(choice (const :tag "none" nil)
619 (repeat :value (".*") regexp)))
621 (defcustom gnus-summary-mark-below 0
622 "*Mark all articles with a score below this variable as read.
623 This variable is local to each summary buffer and usually set by the
625 :group 'gnus-score-default
628 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
629 "*List of functions used for sorting articles in the summary buffer.
631 Each function takes two articles and returns non-nil if the first
632 article should be sorted before the other. If you use more than one
633 function, the primary sort function should be the last. You should
634 probably always include `gnus-article-sort-by-number' in the list of
635 sorting functions -- preferably first. Also note that sorting by date
636 is often much slower than sorting by number, and the sorting order is
637 very similar. (Sorting by date means sorting by the time the message
638 was sent, sorting by number means sorting by arrival time.)
640 Ready-made functions include `gnus-article-sort-by-number',
641 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
642 `gnus-article-sort-by-date' and `gnus-article-sort-by-score'.
644 When threading is turned on, the variable `gnus-thread-sort-functions'
645 controls how articles are sorted."
646 :group 'gnus-summary-sort
647 :type '(repeat (choice (function-item gnus-article-sort-by-number)
648 (function-item gnus-article-sort-by-author)
649 (function-item gnus-article-sort-by-subject)
650 (function-item gnus-article-sort-by-date)
651 (function-item gnus-article-sort-by-score)
652 (function :tag "other"))))
654 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
655 "*List of functions used for sorting threads in the summary buffer.
656 By default, threads are sorted by article number.
658 Each function takes two threads and returns non-nil if the first
659 thread should be sorted before the other. If you use more than one
660 function, the primary sort function should be the last. You should
661 probably always include `gnus-thread-sort-by-number' in the list of
662 sorting functions -- preferably first. Also note that sorting by date
663 is often much slower than sorting by number, and the sorting order is
664 very similar. (Sorting by date means sorting by the time the message
665 was sent, sorting by number means sorting by arrival time.)
667 Ready-made functions include `gnus-thread-sort-by-number',
668 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
669 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
670 `gnus-thread-sort-by-most-recent-number',
671 `gnus-thread-sort-by-most-recent-date', and
672 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
674 When threading is turned off, the variable
675 `gnus-article-sort-functions' controls how articles are sorted."
676 :group 'gnus-summary-sort
677 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
678 (function-item gnus-thread-sort-by-author)
679 (function-item gnus-thread-sort-by-subject)
680 (function-item gnus-thread-sort-by-date)
681 (function-item gnus-thread-sort-by-score)
682 (function-item gnus-thread-sort-by-total-score)
683 (function :tag "other"))))
685 (defcustom gnus-thread-score-function '+
686 "*Function used for calculating the total score of a thread.
688 The function is called with the scores of the article and each
689 subthread and should then return the score of the thread.
691 Some functions you can use are `+', `max', or `min'."
692 :group 'gnus-summary-sort
695 (defcustom gnus-summary-expunge-below nil
696 "All articles that have a score less than this variable will be expunged.
697 This variable is local to the summary buffers."
698 :group 'gnus-score-default
699 :type '(choice (const :tag "off" nil)
702 (defcustom gnus-thread-expunge-below nil
703 "All threads that have a total score less than this variable will be expunged.
704 See `gnus-thread-score-function' for en explanation of what a
707 This variable is local to the summary buffers."
708 :group 'gnus-threading
709 :group 'gnus-score-default
710 :type '(choice (const :tag "off" nil)
713 (defcustom gnus-summary-mode-hook nil
714 "*A hook for Gnus summary mode.
715 This hook is run before any variables are set in the summary buffer."
716 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
717 :group 'gnus-summary-various
720 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
721 (when (featurep 'xemacs)
722 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
723 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
724 (add-hook 'gnus-summary-mode-hook
725 'gnus-xmas-switch-horizontal-scrollbar-off))
727 (defcustom gnus-summary-menu-hook nil
728 "*Hook run after the creation of the summary mode menu."
729 :group 'gnus-summary-visual
732 (defcustom gnus-summary-exit-hook nil
733 "*A hook called on exit from the summary buffer.
734 It will be called with point in the group buffer."
735 :group 'gnus-summary-exit
738 (defcustom gnus-summary-prepare-hook nil
739 "*A hook called after the summary buffer has been generated.
740 If you want to modify the summary buffer, you can use this hook."
741 :group 'gnus-summary-various
744 (defcustom gnus-summary-prepared-hook nil
745 "*A hook called as the last thing after the summary buffer has been generated."
746 :group 'gnus-summary-various
749 (defcustom gnus-summary-generate-hook nil
750 "*A hook run just before generating the summary buffer.
751 This hook is commonly used to customize threading variables and the
753 :group 'gnus-summary-various
756 (defcustom gnus-select-group-hook nil
757 "*A hook called when a newsgroup is selected.
759 If you'd like to simplify subjects like the
760 `gnus-summary-next-same-subject' command does, you can use the
763 (add-hook gnus-select-group-hook
765 (mapcar (lambda (header)
766 (mail-header-set-subject
768 (gnus-simplify-subject
769 (mail-header-subject header) 're-only)))
770 gnus-newsgroup-headers)))"
771 :group 'gnus-group-select
774 (defcustom gnus-select-article-hook nil
775 "*A hook called when an article is selected."
776 :group 'gnus-summary-choose
779 (defcustom gnus-visual-mark-article-hook
780 (list 'gnus-highlight-selected-summary)
781 "*Hook run after selecting an article in the summary buffer.
782 It is meant to be used for highlighting the article in some way. It
783 is not run if `gnus-visual' is nil."
784 :group 'gnus-summary-visual
787 (defcustom gnus-parse-headers-hook nil
788 "*A hook called before parsing the headers."
792 (defcustom gnus-exit-group-hook nil
793 "*A hook called when exiting summary mode.
794 This hook is not called from the non-updating exit commands like `Q'."
798 (defcustom gnus-summary-update-hook
799 (list 'gnus-summary-highlight-line)
800 "*A hook called when a summary line is changed.
801 The hook will not be called if `gnus-visual' is nil.
803 The default function `gnus-summary-highlight-line' will
804 highlight the line according to the `gnus-summary-highlight'
806 :group 'gnus-summary-visual
809 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
810 "*A hook called when an article is selected for the first time.
811 The hook is intended to mark an article as read (or unread)
812 automatically when it is selected."
813 :group 'gnus-summary-choose
816 (defcustom gnus-group-no-more-groups-hook nil
817 "*A hook run when returning to group mode having no more (unread) groups."
818 :group 'gnus-group-select
821 (defcustom gnus-ps-print-hook nil
822 "*A hook run before ps-printing something from Gnus."
826 (defcustom gnus-summary-display-arrow
827 (and (fboundp 'display-graphic-p)
829 "*If non-nil, display an arrow highlighting the current article."
834 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
835 "Face used for highlighting the current article in the summary buffer."
836 :group 'gnus-summary-visual
839 (defcustom gnus-summary-highlight
840 '(((eq mark gnus-canceled-mark)
841 . gnus-summary-cancelled-face)
842 ((and (> score default-high)
843 (or (eq mark gnus-dormant-mark)
844 (eq mark gnus-ticked-mark)))
845 . gnus-summary-high-ticked-face)
846 ((and (< score default-low)
847 (or (eq mark gnus-dormant-mark)
848 (eq mark gnus-ticked-mark)))
849 . gnus-summary-low-ticked-face)
850 ((or (eq mark gnus-dormant-mark)
851 (eq mark gnus-ticked-mark))
852 . gnus-summary-normal-ticked-face)
853 ((and (> score default-high) (eq mark gnus-ancient-mark))
854 . gnus-summary-high-ancient-face)
855 ((and (< score default-low) (eq mark gnus-ancient-mark))
856 . gnus-summary-low-ancient-face)
857 ((eq mark gnus-ancient-mark)
858 . gnus-summary-normal-ancient-face)
859 ((and (> score default-high) (eq mark gnus-unread-mark))
860 . gnus-summary-high-unread-face)
861 ((and (< score default-low) (eq mark gnus-unread-mark))
862 . gnus-summary-low-unread-face)
863 ((eq mark gnus-unread-mark)
864 . gnus-summary-normal-unread-face)
865 ((and (> score default-high) (memq mark (list gnus-downloadable-mark
866 gnus-undownloaded-mark)))
867 . gnus-summary-high-unread-face)
868 ((and (< score default-low) (memq mark (list gnus-downloadable-mark
869 gnus-undownloaded-mark)))
870 . gnus-summary-low-unread-face)
871 ((and (memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
872 (memq article gnus-newsgroup-unreads))
873 . gnus-summary-normal-unread-face)
874 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
875 . gnus-summary-normal-read-face)
876 ((> score default-high)
877 . gnus-summary-high-read-face)
878 ((< score default-low)
879 . gnus-summary-low-read-face)
881 . gnus-summary-normal-read-face))
882 "*Controls the highlighting of summary buffer lines.
884 A list of (FORM . FACE) pairs. When deciding how a a particular
885 summary line should be displayed, each form is evaluated. The content
886 of the face field after the first true form is used. You can change
887 how those summary lines are displayed, by editing the face field.
889 You can use the following variables in the FORM field.
891 score: The article's score
892 default: The default article score.
893 default-high: The default score for high scored articles.
894 default-low: The default score for low scored articles.
895 below: The score below which articles are automatically marked as read.
896 mark: The articles mark."
897 :group 'gnus-summary-visual
898 :type '(repeat (cons (sexp :tag "Form" nil)
901 (defcustom gnus-alter-header-function nil
902 "Function called to allow alteration of article header structures.
903 The function is called with one parameter, the article header vector,
904 which it may alter in any way.")
906 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
907 "Variable that says which function should be used to decode a string with encoded words.")
909 (defcustom gnus-extra-headers '(To Newsgroups)
910 "*Extra headers to parse."
913 :type '(repeat symbol))
915 (defcustom gnus-ignored-from-addresses
916 (and user-mail-address (regexp-quote user-mail-address))
917 "*Regexp of From headers that may be suppressed in favor of To headers."
922 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
923 "List of charsets that should be ignored.
924 When these charsets are used in the \"charset\" parameter, the
925 default charset will be used instead."
927 :type '(repeat symbol)
928 :group 'gnus-charset)
930 (gnus-define-group-parameter
934 "Return the ignored charsets of GROUP."
935 :variable gnus-group-ignored-charsets-alist
937 '(("alt\\.chinese\\.text" iso-8859-1))
939 "Alist of regexps (to match group names) and charsets that should be ignored.
940 When these charsets are used in the \"charset\" parameter, the
941 default charset will be used instead."
942 :variable-group gnus-charset
943 :variable-type '(repeat (cons (regexp :tag "Group")
945 :parameter-type '(choice :tag "Ignored charsets"
948 :parameter-document "\
949 List of charsets that should be ignored.
951 When these charsets are used in the \"charset\" parameter, the
952 default charset will be used instead.")
954 (defcustom gnus-group-highlight-words-alist nil
955 "Alist of group regexps and highlight regexps.
956 This variable uses the same syntax as `gnus-emphasis-alist'."
958 :type '(repeat (cons (regexp :tag "Group")
959 (repeat (list (regexp :tag "Highlight regexp")
960 (number :tag "Group for entire word" 0)
961 (number :tag "Group for displayed part" 0)
963 gnus-emphasis-highlight-words)))))
964 :group 'gnus-summary-visual)
966 (defcustom gnus-summary-show-article-charset-alist
968 "Alist of number and charset.
969 The article will be shown with the charset corresponding to the
971 For example: ((1 . cn-gb-2312) (2 . big5))."
973 :type '(repeat (cons (number :tag "Argument" 1)
974 (symbol :tag "Charset")))
975 :group 'gnus-charset)
977 (defcustom gnus-preserve-marks t
978 "Whether marks are preserved when moving, copying and respooling messages."
981 :group 'gnus-summary-marks)
983 (defcustom gnus-alter-articles-to-read-function nil
984 "Function to be called to alter the list of articles to be selected."
985 :type '(choice (const nil) function)
986 :group 'gnus-summary)
988 (defcustom gnus-orphan-score nil
989 "*All orphans get this score added. Set in the score file."
990 :group 'gnus-score-default
991 :type '(choice (const nil)
994 (defcustom gnus-summary-save-parts-default-mime "image/.*"
995 "*A regexp to match MIME parts when saving multiple parts of a message
996 with gnus-summary-save-parts (X m). This regexp will be used by default
997 when prompting the user for which type of files to save."
1001 (defcustom gnus-read-all-available-headers nil
1002 "Whether Gnus should parse all headers made available to it.
1003 This is mostly relevant for slow backends where the user may
1004 wish to widen the summary buffer to include all headers
1005 that were fetched. Say, for nnultimate groups."
1006 :group 'gnus-summary
1007 :type '(choice boolean regexp))
1009 (defcustom gnus-summary-muttprint-program "muttprint"
1010 "Command (and optional arguments) used to run Muttprint."
1012 :group 'gnus-summary
1015 (defcustom gnus-article-loose-mime nil
1016 "If non-nil, don't require MIME-Version header.
1017 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1018 supply the MIME-Version header or deliberately strip it From the mail.
1019 Set it to non-nil, Gnus will treat some articles as MIME even if
1020 the MIME-Version header is missed."
1023 :group 'gnus-article)
1025 ;;; Internal variables
1027 (defvar gnus-summary-display-cache nil)
1028 (defvar gnus-article-mime-handles nil)
1029 (defvar gnus-article-decoded-p nil)
1030 (defvar gnus-article-charset nil)
1031 (defvar gnus-article-ignored-charsets nil)
1032 (defvar gnus-scores-exclude-files nil)
1033 (defvar gnus-page-broken nil)
1034 (defvar gnus-inhibit-mime-unbuttonizing nil)
1036 (defvar gnus-original-article nil)
1037 (defvar gnus-article-internal-prepare-hook nil)
1038 (defvar gnus-newsgroup-process-stack nil)
1040 (defvar gnus-thread-indent-array nil)
1041 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1042 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1043 "Function called to sort the articles within a thread after it has been gathered together.")
1045 (defvar gnus-summary-save-parts-type-history nil)
1046 (defvar gnus-summary-save-parts-last-directory nil)
1048 ;; Avoid highlighting in kill files.
1049 (defvar gnus-summary-inhibit-highlight nil)
1050 (defvar gnus-newsgroup-selected-overlay nil)
1051 (defvar gnus-inhibit-limiting nil)
1052 (defvar gnus-newsgroup-adaptive-score-file nil)
1053 (defvar gnus-current-score-file nil)
1054 (defvar gnus-current-move-group nil)
1055 (defvar gnus-current-copy-group nil)
1056 (defvar gnus-current-crosspost-group nil)
1057 (defvar gnus-newsgroup-display nil)
1059 (defvar gnus-newsgroup-dependencies nil)
1060 (defvar gnus-newsgroup-adaptive nil)
1061 (defvar gnus-summary-display-article-function nil)
1062 (defvar gnus-summary-highlight-line-function nil
1063 "Function called after highlighting a summary line.")
1065 (defvar gnus-summary-line-format-alist
1066 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1067 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1068 (?s gnus-tmp-subject-or-nil ?s)
1069 (?n gnus-tmp-name ?s)
1070 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1072 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1074 (?F gnus-tmp-from ?s)
1075 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1076 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1077 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1078 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1079 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1080 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1081 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1082 (?L gnus-tmp-lines ?s)
1083 (?I gnus-tmp-indentation ?s)
1084 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1085 (?R gnus-tmp-replied ?c)
1086 (?\[ gnus-tmp-opening-bracket ?c)
1087 (?\] gnus-tmp-closing-bracket ?c)
1088 (?\> (make-string gnus-tmp-level ? ) ?s)
1089 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1090 (?i gnus-tmp-score ?d)
1091 (?z gnus-tmp-score-char ?c)
1092 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1093 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1094 (?U gnus-tmp-unread ?c)
1095 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1097 (?t (gnus-summary-number-of-articles-in-thread
1098 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1100 (?e (gnus-summary-number-of-articles-in-thread
1101 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1103 (?u gnus-tmp-user-defined ?s)
1104 (?P (gnus-pick-line-number) ?d)
1105 (?B gnus-tmp-thread-tree-header-string ?s)
1106 (user-date (gnus-user-date
1107 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1108 "An alist of format specifications that can appear in summary lines.
1109 These are paired with what variables they correspond with, along with
1110 the type of the variable (string, integer, character, etc).")
1112 (defvar gnus-summary-dummy-line-format-alist
1113 `((?S gnus-tmp-subject ?s)
1114 (?N gnus-tmp-number ?d)
1115 (?u gnus-tmp-user-defined ?s)))
1117 (defvar gnus-summary-mode-line-format-alist
1118 `((?G gnus-tmp-group-name ?s)
1119 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1120 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1121 (?A gnus-tmp-article-number ?d)
1122 (?Z gnus-tmp-unread-and-unselected ?s)
1123 (?V gnus-version ?s)
1124 (?U gnus-tmp-unread-and-unticked ?d)
1125 (?S gnus-tmp-subject ?s)
1126 (?e gnus-tmp-unselected ?d)
1127 (?u gnus-tmp-user-defined ?s)
1128 (?d (length gnus-newsgroup-dormant) ?d)
1129 (?t (length gnus-newsgroup-marked) ?d)
1130 (?r (length gnus-newsgroup-reads) ?d)
1131 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1132 (?E gnus-newsgroup-expunged-tally ?d)
1133 (?s (gnus-current-score-file-nondirectory) ?s)))
1135 (defvar gnus-last-search-regexp nil
1136 "Default regexp for article search command.")
1138 (defvar gnus-last-shell-command nil
1139 "Default shell command on article.")
1141 (defvar gnus-newsgroup-begin nil)
1142 (defvar gnus-newsgroup-end nil)
1143 (defvar gnus-newsgroup-last-rmail nil)
1144 (defvar gnus-newsgroup-last-mail nil)
1145 (defvar gnus-newsgroup-last-folder nil)
1146 (defvar gnus-newsgroup-last-file nil)
1147 (defvar gnus-newsgroup-auto-expire nil)
1148 (defvar gnus-newsgroup-active nil)
1150 (defvar gnus-newsgroup-data nil)
1151 (defvar gnus-newsgroup-data-reverse nil)
1152 (defvar gnus-newsgroup-limit nil)
1153 (defvar gnus-newsgroup-limits nil)
1155 (defvar gnus-newsgroup-unreads nil
1156 "Sorted list of unread articles in the current newsgroup.")
1158 (defvar gnus-newsgroup-unselected nil
1159 "Sorted list of unselected unread articles in the current newsgroup.")
1161 (defvar gnus-newsgroup-reads nil
1162 "Alist of read articles and article marks in the current newsgroup.")
1164 (defvar gnus-newsgroup-expunged-tally nil)
1166 (defvar gnus-newsgroup-marked nil
1167 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1169 (defvar gnus-newsgroup-killed nil
1170 "List of ranges of articles that have been through the scoring process.")
1172 (defvar gnus-newsgroup-cached nil
1173 "Sorted list of articles that come from the article cache.")
1175 (defvar gnus-newsgroup-saved nil
1176 "List of articles that have been saved.")
1178 (defvar gnus-newsgroup-kill-headers nil)
1180 (defvar gnus-newsgroup-replied nil
1181 "List of articles that have been replied to in the current newsgroup.")
1183 (defvar gnus-newsgroup-forwarded nil
1184 "List of articles that have been forwarded in the current newsgroup.")
1186 (defvar gnus-newsgroup-recent nil
1187 "List of articles that have are recent in the current newsgroup.")
1189 (defvar gnus-newsgroup-expirable nil
1190 "Sorted list of articles in the current newsgroup that can be expired.")
1192 (defvar gnus-newsgroup-processable nil
1193 "List of articles in the current newsgroup that can be processed.")
1195 (defvar gnus-newsgroup-downloadable nil
1196 "Sorted list of articles in the current newsgroup that can be processed.")
1198 (defvar gnus-newsgroup-undownloaded nil
1199 "List of articles in the current newsgroup that haven't been downloaded..")
1201 (defvar gnus-newsgroup-unsendable nil
1202 "List of articles in the current newsgroup that won't be sent.")
1204 (defvar gnus-newsgroup-bookmarks nil
1205 "List of articles in the current newsgroup that have bookmarks.")
1207 (defvar gnus-newsgroup-dormant nil
1208 "Sorted list of dormant articles in the current newsgroup.")
1210 (defvar gnus-newsgroup-unseen nil
1211 "List of unseen articles in the current newsgroup.")
1213 (defvar gnus-newsgroup-seen nil
1214 "Range of seen articles in the current newsgroup.")
1216 (defvar gnus-newsgroup-articles nil
1217 "List of articles in the current newsgroup.")
1219 (defvar gnus-newsgroup-scored nil
1220 "List of scored articles in the current newsgroup.")
1222 (defvar gnus-newsgroup-headers nil
1223 "List of article headers in the current newsgroup.")
1225 (defvar gnus-newsgroup-threads nil)
1227 (defvar gnus-newsgroup-prepared nil
1228 "Whether the current group has been prepared properly.")
1230 (defvar gnus-newsgroup-ancient nil
1231 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1233 (defvar gnus-newsgroup-sparse nil)
1235 (defvar gnus-current-article nil)
1236 (defvar gnus-article-current nil)
1237 (defvar gnus-current-headers nil)
1238 (defvar gnus-have-all-headers nil)
1239 (defvar gnus-last-article nil)
1240 (defvar gnus-newsgroup-history nil)
1241 (defvar gnus-newsgroup-charset nil)
1242 (defvar gnus-newsgroup-ephemeral-charset nil)
1243 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1245 (defvar gnus-article-before-search nil)
1247 (defconst gnus-summary-local-variables
1248 '(gnus-newsgroup-name
1249 gnus-newsgroup-begin gnus-newsgroup-end
1250 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1251 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1252 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1253 gnus-newsgroup-unselected gnus-newsgroup-marked
1254 gnus-newsgroup-reads gnus-newsgroup-saved
1255 gnus-newsgroup-replied gnus-newsgroup-forwarded
1256 gnus-newsgroup-recent
1257 gnus-newsgroup-expirable
1258 gnus-newsgroup-processable gnus-newsgroup-killed
1259 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1260 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1261 gnus-newsgroup-seen gnus-newsgroup-articles
1262 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1263 gnus-newsgroup-headers gnus-newsgroup-threads
1264 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1265 gnus-current-article gnus-current-headers gnus-have-all-headers
1266 gnus-last-article gnus-article-internal-prepare-hook
1267 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1268 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1269 gnus-thread-expunge-below
1270 gnus-score-alist gnus-current-score-file
1271 (gnus-summary-expunge-below . global)
1272 (gnus-summary-mark-below . global)
1273 (gnus-orphan-score . global)
1274 gnus-newsgroup-active gnus-scores-exclude-files
1275 gnus-newsgroup-history gnus-newsgroup-ancient
1276 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1277 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1278 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1279 (gnus-newsgroup-expunged-tally . 0)
1280 gnus-cache-removable-articles gnus-newsgroup-cached
1281 gnus-newsgroup-data gnus-newsgroup-data-reverse
1282 gnus-newsgroup-limit gnus-newsgroup-limits
1283 gnus-newsgroup-charset gnus-newsgroup-display)
1284 "Variables that are buffer-local to the summary buffers.")
1286 (defvar gnus-newsgroup-variables nil
1287 "A list of variables that have separate values in different newsgroups.
1288 A list of newsgroup (summary buffer) local variables, or cons of
1289 variables and their default values (when the default values are not
1290 nil), that should be made global while the summary buffer is active.
1291 These variables can be used to set variables in the group parameters
1292 while still allowing them to affect operations done in other
1293 buffers. For example:
1295 \(setq gnus-newsgroup-variables
1296 '(message-use-followup-to
1297 (gnus-visible-headers .
1298 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1301 ;; Byte-compiler warning.
1302 (eval-when-compile (defvar gnus-article-mode-map))
1306 (defvar gnus-decode-encoded-word-methods
1307 '(mail-decode-encoded-word-string)
1308 "List of methods used to decode encoded words.
1310 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1311 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1312 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1313 whose names match REGEXP.
1316 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1317 mail-decode-encoded-word-string
1318 (\"chinese\" . rfc1843-decode-string))")
1320 (defvar gnus-decode-encoded-word-methods-cache nil)
1322 (defun gnus-multi-decode-encoded-word-string (string)
1323 "Apply the functions from `gnus-encoded-word-methods' that match."
1324 (unless (and gnus-decode-encoded-word-methods-cache
1325 (eq gnus-newsgroup-name
1326 (car gnus-decode-encoded-word-methods-cache)))
1327 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1330 (nconc gnus-decode-encoded-word-methods-cache (list x))
1331 (if (and gnus-newsgroup-name
1332 (string-match (car x) gnus-newsgroup-name))
1333 (nconc gnus-decode-encoded-word-methods-cache
1335 gnus-decode-encoded-word-methods))
1336 (let ((xlist gnus-decode-encoded-word-methods-cache))
1339 (setq string (funcall (pop xlist) string))))
1342 ;; Subject simplification.
1344 (defun gnus-simplify-whitespace (str)
1345 "Remove excessive whitespace from STR."
1348 (while (string-match "[ \t][ \t]+" mystr)
1349 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1351 (substring mystr (match-end 0)))))
1353 (when (string-match "^[ \t]+" mystr)
1354 (setq mystr (substring mystr (match-end 0))))
1356 (when (string-match "[ \t]+$" mystr)
1357 (setq mystr (substring mystr 0 (match-beginning 0))))
1360 (defsubst gnus-simplify-subject-re (subject)
1361 "Remove \"Re:\" from subject lines."
1362 (if (string-match message-subject-re-regexp subject)
1363 (substring subject (match-end 0))
1366 (defun gnus-simplify-subject (subject &optional re-only)
1367 "Remove `Re:' and words in parentheses.
1368 If RE-ONLY is non-nil, strip leading `Re:'s only."
1369 (let ((case-fold-search t)) ;Ignore case.
1370 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1371 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1372 (setq subject (substring subject (match-end 0))))
1373 ;; Remove uninteresting prefixes.
1374 (when (and (not re-only)
1375 gnus-simplify-ignored-prefixes
1376 (string-match gnus-simplify-ignored-prefixes subject))
1377 (setq subject (substring subject (match-end 0))))
1378 ;; Remove words in parentheses from end.
1380 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1381 (setq subject (substring subject 0 (match-beginning 0)))))
1382 ;; Return subject string.
1385 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1387 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1388 (goto-char (point-min))
1389 (while (re-search-forward regexp nil t)
1390 (replace-match (or newtext ""))))
1392 (defun gnus-simplify-buffer-fuzzy ()
1393 "Simplify string in the buffer fuzzily.
1394 The string in the accessible portion of the current buffer is simplified.
1395 It is assumed to be a single-line subject.
1396 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1397 matter is removed. Additional things can be deleted by setting
1398 `gnus-simplify-subject-fuzzy-regexp'."
1399 (let ((case-fold-search t)
1401 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1403 (while (not (eq modified-tick (buffer-modified-tick)))
1404 (setq modified-tick (buffer-modified-tick))
1406 ((listp gnus-simplify-subject-fuzzy-regexp)
1407 (mapcar 'gnus-simplify-buffer-fuzzy-step
1408 gnus-simplify-subject-fuzzy-regexp))
1409 (gnus-simplify-subject-fuzzy-regexp
1410 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1411 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1412 (gnus-simplify-buffer-fuzzy-step
1413 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1414 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1416 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1417 (gnus-simplify-buffer-fuzzy-step " +" " ")
1418 (gnus-simplify-buffer-fuzzy-step " $")
1419 (gnus-simplify-buffer-fuzzy-step "^ +")))
1421 (defun gnus-simplify-subject-fuzzy (subject)
1422 "Simplify a subject string fuzzily.
1423 See `gnus-simplify-buffer-fuzzy' for details."
1425 (gnus-set-work-buffer)
1426 (let ((case-fold-search t))
1427 ;; Remove uninteresting prefixes.
1428 (when (and gnus-simplify-ignored-prefixes
1429 (string-match gnus-simplify-ignored-prefixes subject))
1430 (setq subject (substring subject (match-end 0))))
1432 (inline (gnus-simplify-buffer-fuzzy))
1435 (defsubst gnus-simplify-subject-fully (subject)
1436 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1438 (gnus-simplify-subject-functions
1439 (gnus-map-function gnus-simplify-subject-functions subject))
1440 ((null gnus-summary-gather-subject-limit)
1441 (gnus-simplify-subject-re subject))
1442 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1443 (gnus-simplify-subject-fuzzy subject))
1444 ((numberp gnus-summary-gather-subject-limit)
1445 (gnus-limit-string (gnus-simplify-subject-re subject)
1446 gnus-summary-gather-subject-limit))
1450 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1451 "Check whether two subjects are equal.
1452 If optional argument simple-first is t, first argument is already
1455 ((null simple-first)
1456 (equal (gnus-simplify-subject-fully s1)
1457 (gnus-simplify-subject-fully s2)))
1460 (gnus-simplify-subject-fully s2)))))
1462 (defun gnus-summary-bubble-group ()
1463 "Increase the score of the current group.
1464 This is a handy function to add to `gnus-summary-exit-hook' to
1465 increase the score of each group you read."
1466 (gnus-group-add-score gnus-newsgroup-name))
1470 ;;; Gnus summary mode
1473 (put 'gnus-summary-mode 'mode-class 'special)
1475 (defvar gnus-article-commands-menu)
1478 ;; Non-orthogonal keys
1480 (gnus-define-keys gnus-summary-mode-map
1481 " " gnus-summary-next-page
1482 "\177" gnus-summary-prev-page
1483 [delete] gnus-summary-prev-page
1484 [backspace] gnus-summary-prev-page
1485 "\r" gnus-summary-scroll-up
1486 "\M-\r" gnus-summary-scroll-down
1487 "n" gnus-summary-next-unread-article
1488 "p" gnus-summary-prev-unread-article
1489 "N" gnus-summary-next-article
1490 "P" gnus-summary-prev-article
1491 "\M-\C-n" gnus-summary-next-same-subject
1492 "\M-\C-p" gnus-summary-prev-same-subject
1493 "\M-n" gnus-summary-next-unread-subject
1494 "\M-p" gnus-summary-prev-unread-subject
1495 "." gnus-summary-first-unread-article
1496 "," gnus-summary-best-unread-article
1497 "\M-s" gnus-summary-search-article-forward
1498 "\M-r" gnus-summary-search-article-backward
1499 "<" gnus-summary-beginning-of-article
1500 ">" gnus-summary-end-of-article
1501 "j" gnus-summary-goto-article
1502 "^" gnus-summary-refer-parent-article
1503 "\M-^" gnus-summary-refer-article
1504 "u" gnus-summary-tick-article-forward
1505 "!" gnus-summary-tick-article-forward
1506 "U" gnus-summary-tick-article-backward
1507 "d" gnus-summary-mark-as-read-forward
1508 "D" gnus-summary-mark-as-read-backward
1509 "E" gnus-summary-mark-as-expirable
1510 "\M-u" gnus-summary-clear-mark-forward
1511 "\M-U" gnus-summary-clear-mark-backward
1512 "k" gnus-summary-kill-same-subject-and-select
1513 "\C-k" gnus-summary-kill-same-subject
1514 "\M-\C-k" gnus-summary-kill-thread
1515 "\M-\C-l" gnus-summary-lower-thread
1516 "e" gnus-summary-edit-article
1517 "#" gnus-summary-mark-as-processable
1518 "\M-#" gnus-summary-unmark-as-processable
1519 "\M-\C-t" gnus-summary-toggle-threads
1520 "\M-\C-s" gnus-summary-show-thread
1521 "\M-\C-h" gnus-summary-hide-thread
1522 "\M-\C-f" gnus-summary-next-thread
1523 "\M-\C-b" gnus-summary-prev-thread
1524 [(meta down)] gnus-summary-next-thread
1525 [(meta up)] gnus-summary-prev-thread
1526 "\M-\C-u" gnus-summary-up-thread
1527 "\M-\C-d" gnus-summary-down-thread
1528 "&" gnus-summary-execute-command
1529 "c" gnus-summary-catchup-and-exit
1530 "\C-w" gnus-summary-mark-region-as-read
1531 "\C-t" gnus-summary-toggle-truncation
1532 "?" gnus-summary-mark-as-dormant
1533 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1534 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1535 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1536 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1537 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1538 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1539 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1540 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1541 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1542 "=" gnus-summary-expand-window
1543 "\C-x\C-s" gnus-summary-reselect-current-group
1544 "\M-g" gnus-summary-rescan-group
1545 "w" gnus-summary-stop-page-breaking
1546 "\C-c\C-r" gnus-summary-caesar-message
1547 "f" gnus-summary-followup
1548 "F" gnus-summary-followup-with-original
1549 "C" gnus-summary-cancel-article
1550 "r" gnus-summary-reply
1551 "R" gnus-summary-reply-with-original
1552 "\C-c\C-f" gnus-summary-mail-forward
1553 "o" gnus-summary-save-article
1554 "\C-o" gnus-summary-save-article-mail
1555 "|" gnus-summary-pipe-output
1556 "\M-k" gnus-summary-edit-local-kill
1557 "\M-K" gnus-summary-edit-global-kill
1559 "\C-c\C-d" gnus-summary-describe-group
1560 "q" gnus-summary-exit
1561 "Q" gnus-summary-exit-no-update
1562 "\C-c\C-i" gnus-info-find-node
1563 gnus-mouse-2 gnus-mouse-pick-article
1564 "m" gnus-summary-mail-other-window
1565 "a" gnus-summary-post-news
1566 "i" gnus-summary-news-other-window
1567 "x" gnus-summary-limit-to-unread
1568 "s" gnus-summary-isearch-article
1569 "t" gnus-summary-toggle-header
1570 "g" gnus-summary-show-article
1571 "l" gnus-summary-goto-last-article
1572 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1573 "\C-d" gnus-summary-enter-digest-group
1574 "\M-\C-d" gnus-summary-read-document
1575 "\M-\C-e" gnus-summary-edit-parameters
1576 "\M-\C-a" gnus-summary-customize-parameters
1578 "*" gnus-cache-enter-article
1579 "\M-*" gnus-cache-remove-article
1580 "\M-&" gnus-summary-universal-argument
1581 "\C-l" gnus-recenter
1582 "I" gnus-summary-increase-score
1583 "L" gnus-summary-lower-score
1584 "\M-i" gnus-symbolic-argument
1585 "h" gnus-summary-select-article-buffer
1587 "b" gnus-article-view-part
1588 "\M-t" gnus-summary-toggle-display-buttonized
1590 "V" gnus-summary-score-map
1591 "X" gnus-uu-extract-map
1592 "S" gnus-summary-send-map)
1594 ;; Sort of orthogonal keymap
1595 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1596 "t" gnus-summary-tick-article-forward
1597 "!" gnus-summary-tick-article-forward
1598 "d" gnus-summary-mark-as-read-forward
1599 "r" gnus-summary-mark-as-read-forward
1600 "c" gnus-summary-clear-mark-forward
1601 " " gnus-summary-clear-mark-forward
1602 "e" gnus-summary-mark-as-expirable
1603 "x" gnus-summary-mark-as-expirable
1604 "?" gnus-summary-mark-as-dormant
1605 "b" gnus-summary-set-bookmark
1606 "B" gnus-summary-remove-bookmark
1607 "#" gnus-summary-mark-as-processable
1608 "\M-#" gnus-summary-unmark-as-processable
1609 "S" gnus-summary-limit-include-expunged
1610 "C" gnus-summary-catchup
1611 "H" gnus-summary-catchup-to-here
1612 "h" gnus-summary-catchup-from-here
1613 "\C-c" gnus-summary-catchup-all
1614 "k" gnus-summary-kill-same-subject-and-select
1615 "K" gnus-summary-kill-same-subject
1616 "P" gnus-uu-mark-map)
1618 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1619 "c" gnus-summary-clear-above
1620 "u" gnus-summary-tick-above
1621 "m" gnus-summary-mark-above
1622 "k" gnus-summary-kill-below)
1624 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1625 "/" gnus-summary-limit-to-subject
1626 "n" gnus-summary-limit-to-articles
1627 "w" gnus-summary-pop-limit
1628 "s" gnus-summary-limit-to-subject
1629 "a" gnus-summary-limit-to-author
1630 "u" gnus-summary-limit-to-unread
1631 "m" gnus-summary-limit-to-marks
1632 "M" gnus-summary-limit-exclude-marks
1633 "v" gnus-summary-limit-to-score
1634 "*" gnus-summary-limit-include-cached
1635 "D" gnus-summary-limit-include-dormant
1636 "T" gnus-summary-limit-include-thread
1637 "d" gnus-summary-limit-exclude-dormant
1638 "t" gnus-summary-limit-to-age
1639 "x" gnus-summary-limit-to-extra
1640 "p" gnus-summary-limit-to-display-predicate
1641 "E" gnus-summary-limit-include-expunged
1642 "c" gnus-summary-limit-exclude-childless-dormant
1643 "C" gnus-summary-limit-mark-excluded-as-read
1644 "o" gnus-summary-insert-old-articles
1645 "N" gnus-summary-insert-new-articles)
1647 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1648 "n" gnus-summary-next-unread-article
1649 "p" gnus-summary-prev-unread-article
1650 "N" gnus-summary-next-article
1651 "P" gnus-summary-prev-article
1652 "\C-n" gnus-summary-next-same-subject
1653 "\C-p" gnus-summary-prev-same-subject
1654 "\M-n" gnus-summary-next-unread-subject
1655 "\M-p" gnus-summary-prev-unread-subject
1656 "f" gnus-summary-first-unread-article
1657 "b" gnus-summary-best-unread-article
1658 "j" gnus-summary-goto-article
1659 "g" gnus-summary-goto-subject
1660 "l" gnus-summary-goto-last-article
1661 "o" gnus-summary-pop-article)
1663 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1664 "k" gnus-summary-kill-thread
1665 "l" gnus-summary-lower-thread
1666 "i" gnus-summary-raise-thread
1667 "T" gnus-summary-toggle-threads
1668 "t" gnus-summary-rethread-current
1669 "^" gnus-summary-reparent-thread
1670 "s" gnus-summary-show-thread
1671 "S" gnus-summary-show-all-threads
1672 "h" gnus-summary-hide-thread
1673 "H" gnus-summary-hide-all-threads
1674 "n" gnus-summary-next-thread
1675 "p" gnus-summary-prev-thread
1676 "u" gnus-summary-up-thread
1677 "o" gnus-summary-top-thread
1678 "d" gnus-summary-down-thread
1679 "#" gnus-uu-mark-thread
1680 "\M-#" gnus-uu-unmark-thread)
1682 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1683 "g" gnus-summary-prepare
1684 "c" gnus-summary-insert-cached-articles)
1686 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1687 "c" gnus-summary-catchup-and-exit
1688 "C" gnus-summary-catchup-all-and-exit
1689 "E" gnus-summary-exit-no-update
1690 "Q" gnus-summary-exit
1691 "Z" gnus-summary-exit
1692 "n" gnus-summary-catchup-and-goto-next-group
1693 "R" gnus-summary-reselect-current-group
1694 "G" gnus-summary-rescan-group
1695 "N" gnus-summary-next-group
1696 "s" gnus-summary-save-newsrc
1697 "P" gnus-summary-prev-group)
1699 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1700 " " gnus-summary-next-page
1701 "n" gnus-summary-next-page
1702 "\177" gnus-summary-prev-page
1703 [delete] gnus-summary-prev-page
1704 "p" gnus-summary-prev-page
1705 "\r" gnus-summary-scroll-up
1706 "\M-\r" gnus-summary-scroll-down
1707 "<" gnus-summary-beginning-of-article
1708 ">" gnus-summary-end-of-article
1709 "b" gnus-summary-beginning-of-article
1710 "e" gnus-summary-end-of-article
1711 "^" gnus-summary-refer-parent-article
1712 "r" gnus-summary-refer-parent-article
1713 "D" gnus-summary-enter-digest-group
1714 "R" gnus-summary-refer-references
1715 "T" gnus-summary-refer-thread
1716 "g" gnus-summary-show-article
1717 "s" gnus-summary-isearch-article
1718 "P" gnus-summary-print-article
1719 "M" gnus-mailing-list-insinuate
1720 "t" gnus-article-babel)
1722 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1723 "b" gnus-article-add-buttons
1724 "B" gnus-article-add-buttons-to-head
1725 "o" gnus-article-treat-overstrike
1726 "e" gnus-article-emphasize
1727 "w" gnus-article-fill-cited-article
1728 "Q" gnus-article-fill-long-lines
1729 "C" gnus-article-capitalize-sentences
1730 "c" gnus-article-remove-cr
1731 "q" gnus-article-de-quoted-unreadable
1732 "6" gnus-article-de-base64-unreadable
1733 "Z" gnus-article-decode-HZ
1734 "h" gnus-article-wash-html
1735 "u" gnus-article-unsplit-urls
1736 "s" gnus-summary-force-verify-and-decrypt
1737 "f" gnus-article-display-x-face
1738 "l" gnus-summary-stop-page-breaking
1739 "r" gnus-summary-caesar-message
1740 "t" gnus-summary-toggle-header
1741 "g" gnus-treat-smiley
1742 "v" gnus-summary-verbose-headers
1743 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1744 "p" gnus-article-verify-x-pgp-sig
1745 "d" gnus-article-treat-dumbquotes
1746 "k" gnus-article-outlook-deuglify-article)
1748 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1749 "a" gnus-article-hide
1750 "h" gnus-article-hide-headers
1751 "b" gnus-article-hide-boring-headers
1752 "s" gnus-article-hide-signature
1753 "c" gnus-article-hide-citation
1754 "C" gnus-article-hide-citation-in-followups
1755 "l" gnus-article-hide-list-identifiers
1756 "p" gnus-article-hide-pgp
1757 "B" gnus-article-strip-banner
1758 "P" gnus-article-hide-pem
1759 "\C-c" gnus-article-hide-citation-maybe)
1761 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1762 "a" gnus-article-highlight
1763 "h" gnus-article-highlight-headers
1764 "c" gnus-article-highlight-citation
1765 "s" gnus-article-highlight-signature)
1767 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1768 "f" gnus-article-treat-fold-headers
1769 "u" gnus-article-treat-unfold-headers
1770 "n" gnus-article-treat-fold-newsgroups)
1772 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1773 "x" gnus-article-display-x-face
1774 "s" gnus-treat-smiley
1775 "D" gnus-article-remove-images
1776 "f" gnus-treat-from-picon
1777 "m" gnus-treat-mail-picon
1778 "n" gnus-treat-newsgroups-picon)
1780 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1781 "w" gnus-article-decode-mime-words
1782 "c" gnus-article-decode-charset
1783 "v" gnus-mime-view-all-parts
1784 "b" gnus-article-view-part)
1786 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1787 "z" gnus-article-date-ut
1788 "u" gnus-article-date-ut
1789 "l" gnus-article-date-local
1790 "p" gnus-article-date-english
1791 "e" gnus-article-date-lapsed
1792 "o" gnus-article-date-original
1793 "i" gnus-article-date-iso8601
1794 "s" gnus-article-date-user)
1796 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1797 "t" gnus-article-remove-trailing-blank-lines
1798 "l" gnus-article-strip-leading-blank-lines
1799 "m" gnus-article-strip-multiple-blank-lines
1800 "a" gnus-article-strip-blank-lines
1801 "A" gnus-article-strip-all-blank-lines
1802 "s" gnus-article-strip-leading-space
1803 "e" gnus-article-strip-trailing-space
1804 "w" gnus-article-remove-leading-whitespace)
1806 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1808 "f" gnus-summary-fetch-faq
1809 "d" gnus-summary-describe-group
1810 "h" gnus-summary-describe-briefly
1811 "i" gnus-info-find-node)
1813 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1814 "e" gnus-summary-expire-articles
1815 "\M-\C-e" gnus-summary-expire-articles-now
1816 "\177" gnus-summary-delete-article
1817 [delete] gnus-summary-delete-article
1818 [backspace] gnus-summary-delete-article
1819 "m" gnus-summary-move-article
1820 "r" gnus-summary-respool-article
1821 "w" gnus-summary-edit-article
1822 "c" gnus-summary-copy-article
1823 "B" gnus-summary-crosspost-article
1824 "q" gnus-summary-respool-query
1825 "t" gnus-summary-respool-trace
1826 "i" gnus-summary-import-article
1827 "I" gnus-summary-create-article
1828 "p" gnus-summary-article-posted-p)
1830 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1831 "o" gnus-summary-save-article
1832 "m" gnus-summary-save-article-mail
1833 "F" gnus-summary-write-article-file
1834 "r" gnus-summary-save-article-rmail
1835 "f" gnus-summary-save-article-file
1836 "b" gnus-summary-save-article-body-file
1837 "h" gnus-summary-save-article-folder
1838 "v" gnus-summary-save-article-vm
1839 "p" gnus-summary-pipe-output
1840 "P" gnus-summary-muttprint
1841 "s" gnus-soup-add-article)
1843 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1844 "b" gnus-summary-display-buttonized
1845 "m" gnus-summary-repair-multipart
1846 "v" gnus-article-view-part
1847 "o" gnus-article-save-part
1848 "c" gnus-article-copy-part
1849 "C" gnus-article-view-part-as-charset
1850 "e" gnus-article-view-part-externally
1851 "E" gnus-article-encrypt-body
1852 "i" gnus-article-inline-part
1853 "|" gnus-article-pipe-part)
1855 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1856 "p" gnus-summary-mark-as-processable
1857 "u" gnus-summary-unmark-as-processable
1858 "U" gnus-summary-unmark-all-processable
1859 "v" gnus-uu-mark-over
1860 "s" gnus-uu-mark-series
1861 "r" gnus-uu-mark-region
1862 "g" gnus-uu-unmark-region
1863 "R" gnus-uu-mark-by-regexp
1864 "G" gnus-uu-unmark-by-regexp
1865 "t" gnus-uu-mark-thread
1866 "T" gnus-uu-unmark-thread
1867 "a" gnus-uu-mark-all
1868 "b" gnus-uu-mark-buffer
1869 "S" gnus-uu-mark-sparse
1870 "k" gnus-summary-kill-process-mark
1871 "y" gnus-summary-yank-process-mark
1872 "w" gnus-summary-save-process-mark
1873 "i" gnus-uu-invert-processable)
1875 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
1876 ;;"x" gnus-uu-extract-any
1877 "m" gnus-summary-save-parts
1878 "u" gnus-uu-decode-uu
1879 "U" gnus-uu-decode-uu-and-save
1880 "s" gnus-uu-decode-unshar
1881 "S" gnus-uu-decode-unshar-and-save
1882 "o" gnus-uu-decode-save
1883 "O" gnus-uu-decode-save
1884 "b" gnus-uu-decode-binhex
1885 "B" gnus-uu-decode-binhex
1886 "p" gnus-uu-decode-postscript
1887 "P" gnus-uu-decode-postscript-and-save)
1890 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
1891 "u" gnus-uu-decode-uu-view
1892 "U" gnus-uu-decode-uu-and-save-view
1893 "s" gnus-uu-decode-unshar-view
1894 "S" gnus-uu-decode-unshar-and-save-view
1895 "o" gnus-uu-decode-save-view
1896 "O" gnus-uu-decode-save-view
1897 "b" gnus-uu-decode-binhex-view
1898 "B" gnus-uu-decode-binhex-view
1899 "p" gnus-uu-decode-postscript-view
1900 "P" gnus-uu-decode-postscript-and-save-view))
1902 (defvar gnus-article-post-menu nil)
1904 (defun gnus-summary-make-menu-bar ()
1905 (gnus-turn-off-edit-menu 'summary)
1907 (unless (boundp 'gnus-summary-misc-menu)
1910 gnus-summary-kill-menu gnus-summary-mode-map ""
1915 ["Customize" gnus-score-customize t])
1916 (gnus-make-score-map 'increase)
1917 (gnus-make-score-map 'lower)
1919 ["Kill below" gnus-summary-kill-below t]
1920 ["Mark above" gnus-summary-mark-above t]
1921 ["Tick above" gnus-summary-tick-above t]
1922 ["Clear above" gnus-summary-clear-above t])
1923 ["Current score" gnus-summary-current-score t]
1924 ["Set score" gnus-summary-set-score t]
1925 ["Switch current score file..." gnus-score-change-score-file t]
1926 ["Set mark below..." gnus-score-set-mark-below t]
1927 ["Set expunge below..." gnus-score-set-expunge-below t]
1928 ["Edit current score file" gnus-score-edit-current-scores t]
1929 ["Edit score file" gnus-score-edit-file t]
1930 ["Trace score" gnus-score-find-trace t]
1931 ["Find words" gnus-score-find-favourite-words t]
1932 ["Rescore buffer" gnus-summary-rescore t]
1933 ["Increase score..." gnus-summary-increase-score t]
1934 ["Lower score..." gnus-summary-lower-score t]))))
1936 ;; Define both the Article menu in the summary buffer and the
1937 ;; equivalent Commands menu in the article buffer here for
1941 ["All" gnus-article-hide t]
1942 ["Headers" gnus-article-hide-headers t]
1943 ["Signature" gnus-article-hide-signature t]
1944 ["Citation" gnus-article-hide-citation t]
1945 ["List identifiers" gnus-article-hide-list-identifiers t]
1946 ["PGP" gnus-article-hide-pgp t]
1947 ["Banner" gnus-article-strip-banner t]
1948 ["Boring headers" gnus-article-hide-boring-headers t])
1950 ["All" gnus-article-highlight t]
1951 ["Headers" gnus-article-highlight-headers t]
1952 ["Signature" gnus-article-highlight-signature t]
1953 ["Citation" gnus-article-highlight-citation t])
1955 ["Words" gnus-article-decode-mime-words t]
1956 ["Charset" gnus-article-decode-charset t]
1957 ["QP" gnus-article-de-quoted-unreadable t]
1958 ["Base64" gnus-article-de-base64-unreadable t]
1959 ["View all" gnus-mime-view-all-parts t]
1960 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
1961 ["Encrypt body" gnus-article-encrypt-body t]
1962 ["Extract all parts" gnus-summary-save-parts t])
1964 ["Local" gnus-article-date-local t]
1965 ["ISO8601" gnus-article-date-iso8601 t]
1966 ["UT" gnus-article-date-ut t]
1967 ["Original" gnus-article-date-original t]
1968 ["Lapsed" gnus-article-date-lapsed t]
1969 ["User-defined" gnus-article-date-user t])
1971 ["Remove images" gnus-article-remove-images t]
1972 ["Toggle smiley" gnus-treat-smiley t]
1973 ["Show X-Face" gnus-article-display-x-face t]
1974 ["Show picons in From" gnus-treat-from-picon t]
1975 ["Show picons in mail headers" gnus-treat-mail-picon t]
1976 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
1977 ("View as different encoding"
1980 ;; Since easymenu under FSF Emacs doesn't allow lambda
1981 ;; forms for menu commands, we should provide intern'ed
1982 ;; function symbols.
1983 (let ((command (intern (format "\
1984 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
1988 (let ((gnus-summary-show-article-charset-alist
1990 (gnus-summary-show-article 1))))
1991 `[,(symbol-name cs) ,command t]))
1992 (sort (if (fboundp 'coding-system-list)
1993 (coding-system-list)
1994 (mapcar 'car mm-mime-mule-charset-alist))
1996 (string< (symbol-name a)
1997 (symbol-name b)))))))
2000 ["Leading" gnus-article-strip-leading-blank-lines t]
2001 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2002 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2003 ["All of the above" gnus-article-strip-blank-lines t]
2004 ["All" gnus-article-strip-all-blank-lines t]
2005 ["Leading space" gnus-article-strip-leading-space t]
2006 ["Trailing space" gnus-article-strip-trailing-space t]
2007 ["Leading space in headers"
2008 gnus-article-remove-leading-whitespace t])
2009 ["Overstrike" gnus-article-treat-overstrike t]
2010 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2011 ["Emphasis" gnus-article-emphasize t]
2012 ["Word wrap" gnus-article-fill-cited-article t]
2013 ["Fill long lines" gnus-article-fill-long-lines t]
2014 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2015 ["CR" gnus-article-remove-cr t]
2016 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2017 ["Base64" gnus-article-de-base64-unreadable t]
2018 ["Rot 13" gnus-summary-caesar-message
2019 ,@(if (featurep 'xemacs) '(t)
2020 '(:help "\"Caesar rotate\" article by 13"))]
2021 ["Unix pipe" gnus-summary-pipe-message t]
2022 ["Add buttons" gnus-article-add-buttons t]
2023 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2024 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2025 ["Verbose header" gnus-summary-verbose-headers t]
2026 ["Toggle header" gnus-summary-toggle-header t]
2027 ["Unfold headers" gnus-article-treat-unfold-headers t]
2028 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2029 ["Html" gnus-article-wash-html t]
2030 ["URLs" gnus-article-unsplit-urls t]
2031 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2032 ["HZ" gnus-article-decode-HZ t]
2033 ["OutlooK deuglify" gnus-article-outlook-deuglify-article t]
2036 ["Save in default format" gnus-summary-save-article
2037 ,@(if (featurep 'xemacs) '(t)
2038 '(:help "Save article using default method"))]
2039 ["Save in file" gnus-summary-save-article-file
2040 ,@(if (featurep 'xemacs) '(t)
2041 '(:help "Save article in file"))]
2042 ["Save in Unix mail format" gnus-summary-save-article-mail t]
2043 ["Save in MH folder" gnus-summary-save-article-folder t]
2044 ["Save in VM folder" gnus-summary-save-article-vm t]
2045 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
2046 ["Save body in file" gnus-summary-save-article-body-file t]
2047 ["Pipe through a filter" gnus-summary-pipe-output t]
2048 ["Add to SOUP packet" gnus-soup-add-article t]
2049 ["Print with Muttprint" gnus-summary-muttprint t]
2050 ["Print" gnus-summary-print-article t])
2052 ["Respool article..." gnus-summary-respool-article t]
2053 ["Move article..." gnus-summary-move-article
2054 (gnus-check-backend-function
2055 'request-move-article gnus-newsgroup-name)]
2056 ["Copy article..." gnus-summary-copy-article t]
2057 ["Crosspost article..." gnus-summary-crosspost-article
2058 (gnus-check-backend-function
2059 'request-replace-article gnus-newsgroup-name)]
2060 ["Import file..." gnus-summary-import-article t]
2061 ["Create article..." gnus-summary-create-article t]
2062 ["Check if posted" gnus-summary-article-posted-p t]
2063 ["Edit article" gnus-summary-edit-article
2064 (not (gnus-group-read-only-p))]
2065 ["Delete article" gnus-summary-delete-article
2066 (gnus-check-backend-function
2067 'request-expire-articles gnus-newsgroup-name)]
2068 ["Query respool" gnus-summary-respool-query t]
2069 ["Trace respool" gnus-summary-respool-trace t]
2070 ["Delete expirable articles" gnus-summary-expire-articles-now
2071 (gnus-check-backend-function
2072 'request-expire-articles gnus-newsgroup-name)])
2074 ["Uudecode" gnus-uu-decode-uu
2075 ,@(if (featurep 'xemacs) '(t)
2076 '(:help "Decode uuencoded article(s)"))]
2077 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2078 ["Unshar" gnus-uu-decode-unshar t]
2079 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2080 ["Save" gnus-uu-decode-save t]
2081 ["Binhex" gnus-uu-decode-binhex t]
2082 ["Postscript" gnus-uu-decode-postscript t]
2083 ["All MIME parts" gnus-summary-save-parts t])
2085 ["Enter article" gnus-cache-enter-article t]
2086 ["Remove article" gnus-cache-remove-article t])
2087 ["Translate" gnus-article-babel t]
2088 ["Select article buffer" gnus-summary-select-article-buffer t]
2089 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2090 ["Isearch article..." gnus-summary-isearch-article t]
2091 ["Beginning of the article" gnus-summary-beginning-of-article t]
2092 ["End of the article" gnus-summary-end-of-article t]
2093 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2094 ["Fetch referenced articles" gnus-summary-refer-references t]
2095 ["Fetch current thread" gnus-summary-refer-thread t]
2096 ["Fetch article with id..." gnus-summary-refer-article t]
2097 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2098 ["Redisplay" gnus-summary-show-article t]
2099 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2101 gnus-summary-article-menu gnus-summary-mode-map ""
2102 (cons "Article" innards))
2104 (if (not (keymapp gnus-summary-article-menu))
2106 gnus-article-commands-menu gnus-article-mode-map ""
2107 (cons "Commands" innards))
2108 ;; in Emacs, don't share menu.
2109 (setq gnus-article-commands-menu
2110 (copy-keymap gnus-summary-article-menu))
2111 (define-key gnus-article-mode-map [menu-bar commands]
2112 (cons "Commands" gnus-article-commands-menu))))
2115 gnus-summary-thread-menu gnus-summary-mode-map ""
2117 ["Toggle threading" gnus-summary-toggle-threads t]
2118 ["Hide threads" gnus-summary-hide-all-threads t]
2119 ["Show threads" gnus-summary-show-all-threads t]
2120 ["Hide thread" gnus-summary-hide-thread t]
2121 ["Show thread" gnus-summary-show-thread t]
2122 ["Go to next thread" gnus-summary-next-thread t]
2123 ["Go to previous thread" gnus-summary-prev-thread t]
2124 ["Go down thread" gnus-summary-down-thread t]
2125 ["Go up thread" gnus-summary-up-thread t]
2126 ["Top of thread" gnus-summary-top-thread t]
2127 ["Mark thread as read" gnus-summary-kill-thread t]
2128 ["Lower thread score" gnus-summary-lower-thread t]
2129 ["Raise thread score" gnus-summary-raise-thread t]
2130 ["Rethread current" gnus-summary-rethread-current t]))
2133 gnus-summary-post-menu gnus-summary-mode-map ""
2135 ["Send a message (mail or news)" gnus-summary-post-news
2136 ,@(if (featurep 'xemacs) '(t)
2137 '(:help "Post an article"))]
2138 ["Followup" gnus-summary-followup
2139 ,@(if (featurep 'xemacs) '(t)
2140 '(:help "Post followup to this article"))]
2141 ["Followup and yank" gnus-summary-followup-with-original
2142 ,@(if (featurep 'xemacs) '(t)
2143 '(:help "Post followup to this article, quoting its contents"))]
2144 ["Supersede article" gnus-summary-supersede-article t]
2145 ["Cancel article" gnus-summary-cancel-article
2146 ,@(if (featurep 'xemacs) '(t)
2147 '(:help "Cancel an article you posted"))]
2148 ["Reply" gnus-summary-reply t]
2149 ["Reply and yank" gnus-summary-reply-with-original t]
2150 ["Wide reply" gnus-summary-wide-reply t]
2151 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2152 ,@(if (featurep 'xemacs) '(t)
2153 '(:help "Mail a reply, quoting this article"))]
2154 ["Very wide reply" gnus-summary-very-wide-reply t]
2155 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2156 ,@(if (featurep 'xemacs) '(t)
2157 '(:help "Mail a very wide reply, quoting this article"))]
2158 ["Mail forward" gnus-summary-mail-forward t]
2159 ["Post forward" gnus-summary-post-forward t]
2160 ["Digest and mail" gnus-uu-digest-mail-forward t]
2161 ["Digest and post" gnus-uu-digest-post-forward t]
2162 ["Resend message" gnus-summary-resend-message t]
2163 ["Resend message edit" gnus-summary-resend-message-edit t]
2164 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2165 ["Send a mail" gnus-summary-mail-other-window t]
2166 ["Create a local message" gnus-summary-news-other-window t]
2167 ["Uuencode and post" gnus-uu-post-news
2168 ,@(if (featurep 'xemacs) '(t)
2169 '(:help "Post a uuencoded article"))]
2170 ["Followup via news" gnus-summary-followup-to-mail t]
2171 ["Followup via news and yank"
2172 gnus-summary-followup-to-mail-with-original t]
2174 ;;["Send" gnus-summary-send-draft t]
2175 ;;["Send bounced" gnus-resend-bounced-mail t])
2179 ((not (keymapp gnus-summary-post-menu))
2180 (setq gnus-article-post-menu gnus-summary-post-menu))
2181 ((not gnus-article-post-menu)
2182 ;; Don't share post menu.
2183 (setq gnus-article-post-menu
2184 (copy-keymap gnus-summary-post-menu))))
2185 (define-key gnus-article-mode-map [menu-bar post]
2186 (cons "Post" gnus-article-post-menu))
2189 gnus-summary-misc-menu gnus-summary-mode-map ""
2192 ["Mark as read" gnus-summary-mark-as-read-forward t]
2193 ["Mark same subject and select"
2194 gnus-summary-kill-same-subject-and-select t]
2195 ["Mark same subject" gnus-summary-kill-same-subject t]
2196 ["Catchup" gnus-summary-catchup
2197 ,@(if (featurep 'xemacs) '(t)
2198 '(:help "Mark unread articles in this group as read"))]
2199 ["Catchup all" gnus-summary-catchup-all t]
2200 ["Catchup to here" gnus-summary-catchup-to-here t]
2201 ["Catchup from here" gnus-summary-catchup-from-here t]
2202 ["Catchup region" gnus-summary-mark-region-as-read t]
2203 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2205 ["Tick" gnus-summary-tick-article-forward t]
2206 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2207 ["Remove marks" gnus-summary-clear-mark-forward t]
2208 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2209 ["Set bookmark" gnus-summary-set-bookmark t]
2210 ["Remove bookmark" gnus-summary-remove-bookmark t])
2212 ["Marks..." gnus-summary-limit-to-marks t]
2213 ["Subject..." gnus-summary-limit-to-subject t]
2214 ["Author..." gnus-summary-limit-to-author t]
2215 ["Age..." gnus-summary-limit-to-age t]
2216 ["Extra..." gnus-summary-limit-to-extra t]
2217 ["Score" gnus-summary-limit-to-score t]
2218 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2219 ["Unread" gnus-summary-limit-to-unread t]
2220 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2221 ["Articles" gnus-summary-limit-to-articles t]
2222 ["Pop limit" gnus-summary-pop-limit t]
2223 ["Show dormant" gnus-summary-limit-include-dormant t]
2224 ["Hide childless dormant"
2225 gnus-summary-limit-exclude-childless-dormant t]
2226 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2227 ["Hide marked" gnus-summary-limit-exclude-marks t]
2228 ["Show expunged" gnus-summary-limit-include-expunged t])
2230 ["Set mark" gnus-summary-mark-as-processable t]
2231 ["Remove mark" gnus-summary-unmark-as-processable t]
2232 ["Remove all marks" gnus-summary-unmark-all-processable t]
2233 ["Mark above" gnus-uu-mark-over t]
2234 ["Mark series" gnus-uu-mark-series t]
2235 ["Mark region" gnus-uu-mark-region t]
2236 ["Unmark region" gnus-uu-unmark-region t]
2237 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2238 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2239 ["Mark all" gnus-uu-mark-all t]
2240 ["Mark buffer" gnus-uu-mark-buffer t]
2241 ["Mark sparse" gnus-uu-mark-sparse t]
2242 ["Mark thread" gnus-uu-mark-thread t]
2243 ["Unmark thread" gnus-uu-unmark-thread t]
2244 ("Process Mark Sets"
2245 ["Kill" gnus-summary-kill-process-mark t]
2246 ["Yank" gnus-summary-yank-process-mark
2247 gnus-newsgroup-process-stack]
2248 ["Save" gnus-summary-save-process-mark t]))
2250 ["Page forward" gnus-summary-next-page
2251 ,@(if (featurep 'xemacs) '(t)
2252 '(:help "Show next page of article"))]
2253 ["Page backward" gnus-summary-prev-page
2254 ,@(if (featurep 'xemacs) '(t)
2255 '(:help "Show previous page of article"))]
2256 ["Line forward" gnus-summary-scroll-up t])
2258 ["Next unread article" gnus-summary-next-unread-article t]
2259 ["Previous unread article" gnus-summary-prev-unread-article t]
2260 ["Next article" gnus-summary-next-article t]
2261 ["Previous article" gnus-summary-prev-article t]
2262 ["Next unread subject" gnus-summary-next-unread-subject t]
2263 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2264 ["Next article same subject" gnus-summary-next-same-subject t]
2265 ["Previous article same subject" gnus-summary-prev-same-subject t]
2266 ["First unread article" gnus-summary-first-unread-article t]
2267 ["Best unread article" gnus-summary-best-unread-article t]
2268 ["Go to subject number..." gnus-summary-goto-subject t]
2269 ["Go to article number..." gnus-summary-goto-article t]
2270 ["Go to the last article" gnus-summary-goto-last-article t]
2271 ["Pop article off history" gnus-summary-pop-article t])
2273 ["Sort by number" gnus-summary-sort-by-number t]
2274 ["Sort by author" gnus-summary-sort-by-author t]
2275 ["Sort by subject" gnus-summary-sort-by-subject t]
2276 ["Sort by date" gnus-summary-sort-by-date t]
2277 ["Sort by score" gnus-summary-sort-by-score t]
2278 ["Sort by lines" gnus-summary-sort-by-lines t]
2279 ["Sort by characters" gnus-summary-sort-by-chars t]
2280 ["Original sort" gnus-summary-sort-by-original t])
2282 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2283 ["Describe group" gnus-summary-describe-group t]
2284 ["Read manual" gnus-info-find-node t])
2286 ["Pick and read" gnus-pick-mode t]
2287 ["Binary" gnus-binary-mode t])
2289 ["Regenerate" gnus-summary-prepare t]
2290 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2291 ["Toggle threading" gnus-summary-toggle-threads t])
2292 ["See old articles" gnus-summary-insert-old-articles t]
2293 ["See new articles" gnus-summary-insert-new-articles t]
2294 ["Filter articles..." gnus-summary-execute-command t]
2295 ["Run command on subjects..." gnus-summary-universal-argument t]
2296 ["Search articles forward..." gnus-summary-search-article-forward t]
2297 ["Search articles backward..." gnus-summary-search-article-backward t]
2298 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2299 ["Expand window" gnus-summary-expand-window t]
2300 ["Expire expirable articles" gnus-summary-expire-articles
2301 (gnus-check-backend-function
2302 'request-expire-articles gnus-newsgroup-name)]
2303 ["Edit local kill file" gnus-summary-edit-local-kill t]
2304 ["Edit main kill file" gnus-summary-edit-global-kill t]
2305 ["Edit group parameters" gnus-summary-edit-parameters t]
2306 ["Customize group parameters" gnus-summary-customize-parameters t]
2307 ["Send a bug report" gnus-bug t]
2309 ["Catchup and exit" gnus-summary-catchup-and-exit
2310 ,@(if (featurep 'xemacs) '(t)
2311 '(:help "Mark unread articles in this group as read, then exit"))]
2312 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2313 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2314 ["Exit group" gnus-summary-exit
2315 ,@(if (featurep 'xemacs) '(t)
2316 '(:help "Exit current group, return to group selection mode"))]
2317 ["Exit group without updating" gnus-summary-exit-no-update t]
2318 ["Exit and goto next group" gnus-summary-next-group t]
2319 ["Exit and goto prev group" gnus-summary-prev-group t]
2320 ["Reselect group" gnus-summary-reselect-current-group t]
2321 ["Rescan group" gnus-summary-rescan-group t]
2322 ["Update dribble" gnus-summary-save-newsrc t])))
2324 (gnus-run-hooks 'gnus-summary-menu-hook)))
2326 (defvar gnus-summary-tool-bar-map nil)
2328 ;; Emacs 21 tool bar. Should be no-op otherwise.
2329 (defun gnus-summary-make-tool-bar ()
2330 (if (and (fboundp 'tool-bar-add-item-from-menu)
2331 (default-value 'tool-bar-mode)
2332 (not gnus-summary-tool-bar-map))
2333 (setq gnus-summary-tool-bar-map
2334 (let ((tool-bar-map (make-sparse-keymap))
2335 (load-path (mm-image-load-path)))
2336 (tool-bar-add-item-from-menu
2337 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2338 (tool-bar-add-item-from-menu
2339 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2340 (tool-bar-add-item-from-menu
2341 'gnus-summary-post-news "post" gnus-summary-mode-map)
2342 (tool-bar-add-item-from-menu
2343 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2344 (tool-bar-add-item-from-menu
2345 'gnus-summary-followup "followup" gnus-summary-mode-map)
2346 (tool-bar-add-item-from-menu
2347 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2348 (tool-bar-add-item-from-menu
2349 'gnus-summary-reply "reply" gnus-summary-mode-map)
2350 (tool-bar-add-item-from-menu
2351 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2352 (tool-bar-add-item-from-menu
2353 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2354 (tool-bar-add-item-from-menu
2355 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2356 (tool-bar-add-item-from-menu
2357 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2358 (tool-bar-add-item-from-menu
2359 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2360 (tool-bar-add-item-from-menu
2361 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2362 (tool-bar-add-item-from-menu
2363 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2364 (tool-bar-add-item-from-menu
2365 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2367 (if gnus-summary-tool-bar-map
2368 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2370 (defun gnus-score-set-default (var value)
2371 "A version of set that updates the GNU Emacs menu-bar."
2373 ;; It is the message that forces the active status to be updated.
2376 (defun gnus-make-score-map (type)
2377 "Make a summary score map of type TYPE."
2380 (let ((headers '(("author" "from" string)
2381 ("subject" "subject" string)
2382 ("article body" "body" string)
2383 ("article head" "head" string)
2384 ("xref" "xref" string)
2385 ("extra header" "extra" string)
2386 ("lines" "lines" number)
2387 ("followups to author" "followup" string)))
2388 (types '((number ("less than" <)
2391 (string ("substring" s)
2395 (perms '(("temporary" (current-time-string))
2403 (if (eq type 'lower)
2408 (setq header (car headers))
2414 (let ((ts (cdr (assoc (nth 2 header) types)))
2430 'gnus-summary-score-entry
2432 (if (or (string= (nth 1 header)
2434 (string= (nth 1 header)
2437 (list 'gnus-summary-header
2439 (list 'quote (nth 1 (car ts)))
2440 (list 'gnus-score-delta-default
2447 (list (nreverse outp))))
2450 (list (nreverse outt))))
2452 (setq headers (cdr headers)))
2453 (list (nreverse outh))))))))
2457 (defun gnus-summary-mode (&optional group)
2458 "Major mode for reading articles.
2460 All normal editing commands are switched off.
2461 \\<gnus-summary-mode-map>
2462 Each line in this buffer represents one article. To read an
2463 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2464 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2467 You can also post articles and send mail from this buffer. To
2468 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2469 of an article, type `\\[gnus-summary-reply]'.
2471 There are approx. one gazillion commands you can execute in this
2472 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2474 The following commands are available:
2476 \\{gnus-summary-mode-map}"
2478 (kill-all-local-variables)
2479 (when (gnus-visual-p 'summary-menu 'menu)
2480 (gnus-summary-make-menu-bar)
2481 (gnus-summary-make-tool-bar))
2482 (gnus-summary-make-local-variables)
2483 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2484 (gnus-summary-make-local-variables))
2485 (gnus-make-thread-indent-array)
2486 (gnus-simplify-mode-line)
2487 (setq major-mode 'gnus-summary-mode)
2488 (setq mode-name "Summary")
2489 (make-local-variable 'minor-mode-alist)
2490 (use-local-map gnus-summary-mode-map)
2491 (buffer-disable-undo)
2492 (setq buffer-read-only t) ;Disable modification
2493 (setq truncate-lines t)
2494 (setq selective-display t)
2495 (setq selective-display-ellipses t) ;Display `...'
2496 (gnus-summary-set-display-table)
2497 (gnus-set-default-directory)
2498 (setq gnus-newsgroup-name group)
2499 (make-local-variable 'gnus-summary-line-format)
2500 (make-local-variable 'gnus-summary-line-format-spec)
2501 (make-local-variable 'gnus-summary-dummy-line-format)
2502 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2503 (make-local-variable 'gnus-summary-mark-positions)
2504 (make-local-hook 'pre-command-hook)
2505 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2506 (gnus-run-hooks 'gnus-summary-mode-hook)
2507 (turn-on-gnus-mailing-list-mode)
2508 (mm-enable-multibyte)
2509 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2510 (gnus-update-summary-mark-positions))
2512 (defun gnus-summary-make-local-variables ()
2513 "Make all the local summary buffer variables."
2515 (dolist (local gnus-summary-local-variables)
2518 (if (eq (cdr local) 'global)
2519 ;; Copy the global value of the variable.
2520 (setq global (symbol-value (car local)))
2521 ;; Use the value from the list.
2522 (setq global (eval (cdr local))))
2523 (set (make-local-variable (car local)) global))
2524 ;; Simple nil-valued local variable.
2525 (set (make-local-variable local) nil)))))
2527 (defun gnus-summary-clear-local-variables ()
2528 (let ((locals gnus-summary-local-variables))
2530 (if (consp (car locals))
2531 (and (vectorp (caar locals))
2532 (set (caar locals) nil))
2533 (and (vectorp (car locals))
2534 (set (car locals) nil)))
2535 (setq locals (cdr locals)))))
2537 ;; Summary data functions.
2539 (defmacro gnus-data-number (data)
2542 (defmacro gnus-data-set-number (data number)
2543 `(setcar ,data ,number))
2545 (defmacro gnus-data-mark (data)
2548 (defmacro gnus-data-set-mark (data mark)
2549 `(setcar (nthcdr 1 ,data) ,mark))
2551 (defmacro gnus-data-pos (data)
2554 (defmacro gnus-data-set-pos (data pos)
2555 `(setcar (nthcdr 2 ,data) ,pos))
2557 (defmacro gnus-data-header (data)
2560 (defmacro gnus-data-set-header (data header)
2561 `(setf (nth 3 ,data) ,header))
2563 (defmacro gnus-data-level (data)
2566 (defmacro gnus-data-unread-p (data)
2567 `(= (nth 1 ,data) gnus-unread-mark))
2569 (defmacro gnus-data-read-p (data)
2570 `(/= (nth 1 ,data) gnus-unread-mark))
2572 (defmacro gnus-data-pseudo-p (data)
2573 `(consp (nth 3 ,data)))
2575 (defmacro gnus-data-find (number)
2576 `(assq ,number gnus-newsgroup-data))
2578 (defmacro gnus-data-find-list (number &optional data)
2579 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2580 (memq (assq ,number bdata)
2583 (defmacro gnus-data-make (number mark pos header level)
2584 `(list ,number ,mark ,pos ,header ,level))
2586 (defun gnus-data-enter (after-article number mark pos header level offset)
2587 (let ((data (gnus-data-find-list after-article)))
2589 (error "No such article: %d" after-article))
2590 (setcdr data (cons (gnus-data-make number mark pos header level)
2592 (setq gnus-newsgroup-data-reverse nil)
2593 (gnus-data-update-list (cddr data) offset)))
2595 (defun gnus-data-enter-list (after-article list &optional offset)
2597 (let ((data (and after-article (gnus-data-find-list after-article)))
2601 (let ((odata gnus-newsgroup-data))
2602 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2604 (gnus-data-update-list odata offset)))
2605 ;; Find the last element in the list to be spliced into the main
2608 (setq list (cdr list)))
2611 (setcdr list gnus-newsgroup-data)
2612 (setq gnus-newsgroup-data ilist)
2614 (gnus-data-update-list (cdr list) offset)))
2615 (setcdr list (cdr data))
2618 (gnus-data-update-list (cdr list) offset))))
2619 (setq gnus-newsgroup-data-reverse nil))))
2621 (defun gnus-data-remove (article &optional offset)
2622 (let ((data gnus-newsgroup-data))
2623 (if (= (gnus-data-number (car data)) article)
2625 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2626 gnus-newsgroup-data-reverse nil)
2628 (gnus-data-update-list gnus-newsgroup-data offset)))
2630 (when (= (gnus-data-number (cadr data)) article)
2631 (setcdr data (cddr data))
2633 (gnus-data-update-list (cdr data) offset))
2635 gnus-newsgroup-data-reverse nil))
2636 (setq data (cdr data))))))
2638 (defmacro gnus-data-list (backward)
2640 (or gnus-newsgroup-data-reverse
2641 (setq gnus-newsgroup-data-reverse
2642 (reverse gnus-newsgroup-data)))
2643 gnus-newsgroup-data))
2645 (defun gnus-data-update-list (data offset)
2646 "Add OFFSET to the POS of all data entries in DATA."
2647 (setq gnus-newsgroup-data-reverse nil)
2649 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2650 (setq data (cdr data))))
2652 (defun gnus-summary-article-pseudo-p (article)
2653 "Say whether this article is a pseudo article or not."
2654 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2656 (defmacro gnus-summary-article-sparse-p (article)
2657 "Say whether this article is a sparse article or not."
2658 `(memq ,article gnus-newsgroup-sparse))
2660 (defmacro gnus-summary-article-ancient-p (article)
2661 "Say whether this article is a sparse article or not."
2662 `(memq ,article gnus-newsgroup-ancient))
2664 (defun gnus-article-parent-p (number)
2665 "Say whether this article is a parent or not."
2666 (let ((data (gnus-data-find-list number)))
2667 (and (cdr data) ; There has to be an article after...
2668 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2669 (gnus-data-level (nth 1 data))))))
2671 (defun gnus-article-children (number)
2672 "Return a list of all children to NUMBER."
2673 (let* ((data (gnus-data-find-list number))
2674 (level (gnus-data-level (car data)))
2676 (setq data (cdr data))
2678 (= (gnus-data-level (car data)) (1+ level)))
2679 (push (gnus-data-number (car data)) children)
2680 (setq data (cdr data)))
2683 (defmacro gnus-summary-skip-intangible ()
2684 "If the current article is intangible, then jump to a different article."
2685 '(let ((to (get-text-property (point) 'gnus-intangible)))
2686 (and to (gnus-summary-goto-subject to))))
2688 (defmacro gnus-summary-article-intangible-p ()
2689 "Say whether this article is intangible or not."
2690 '(get-text-property (point) 'gnus-intangible))
2692 (defun gnus-article-read-p (article)
2693 "Say whether ARTICLE is read or not."
2694 (not (or (memq article gnus-newsgroup-marked)
2695 (memq article gnus-newsgroup-unreads)
2696 (memq article gnus-newsgroup-unselected)
2697 (memq article gnus-newsgroup-dormant))))
2699 ;; Some summary mode macros.
2701 (defmacro gnus-summary-article-number ()
2702 "The article number of the article on the current line.
2703 If there isn's an article number here, then we return the current
2706 (gnus-summary-skip-intangible)
2707 (or (get-text-property (point) 'gnus-number)
2708 (gnus-summary-last-subject))))
2710 (defmacro gnus-summary-article-header (&optional number)
2711 "Return the header of article NUMBER."
2712 `(gnus-data-header (gnus-data-find
2713 ,(or number '(gnus-summary-article-number)))))
2715 (defmacro gnus-summary-thread-level (&optional number)
2716 "Return the level of thread that starts with article NUMBER."
2717 `(if (and (eq gnus-summary-make-false-root 'dummy)
2718 (get-text-property (point) 'gnus-intangible))
2720 (gnus-data-level (gnus-data-find
2721 ,(or number '(gnus-summary-article-number))))))
2723 (defmacro gnus-summary-article-mark (&optional number)
2724 "Return the mark of article NUMBER."
2725 `(gnus-data-mark (gnus-data-find
2726 ,(or number '(gnus-summary-article-number)))))
2728 (defmacro gnus-summary-article-pos (&optional number)
2729 "Return the position of the line of article NUMBER."
2730 `(gnus-data-pos (gnus-data-find
2731 ,(or number '(gnus-summary-article-number)))))
2733 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2734 (defmacro gnus-summary-article-subject (&optional number)
2735 "Return current subject string or nil if nothing."
2738 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2739 '(gnus-data-header (assq (gnus-summary-article-number)
2740 gnus-newsgroup-data)))))
2743 (mail-header-subject headers))))
2745 (defmacro gnus-summary-article-score (&optional number)
2746 "Return current article score."
2747 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2748 gnus-newsgroup-scored))
2749 gnus-summary-default-score 0))
2751 (defun gnus-summary-article-children (&optional number)
2752 "Return a list of article numbers that are children of article NUMBER."
2753 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2754 (level (gnus-data-level (car data)))
2756 (while (and (setq data (cdr data))
2757 (> (setq l (gnus-data-level (car data))) level))
2758 (and (= (1+ level) l)
2759 (push (gnus-data-number (car data))
2761 (nreverse children)))
2763 (defun gnus-summary-article-parent (&optional number)
2764 "Return the article number of the parent of article NUMBER."
2765 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2766 (gnus-data-list t)))
2767 (level (gnus-data-level (car data))))
2769 () ; This is a root.
2770 ;; We search until we find an article with a level less than
2771 ;; this one. That function has to be the parent.
2772 (while (and (setq data (cdr data))
2773 (not (< (gnus-data-level (car data)) level))))
2774 (and data (gnus-data-number (car data))))))
2776 (defun gnus-unread-mark-p (mark)
2777 "Say whether MARK is the unread mark."
2778 (= mark gnus-unread-mark))
2780 (defun gnus-read-mark-p (mark)
2781 "Say whether MARK is one of the marks that mark as read.
2782 This is all marks except unread, ticked, dormant, and expirable."
2783 (not (or (= mark gnus-unread-mark)
2784 (= mark gnus-ticked-mark)
2785 (= mark gnus-dormant-mark)
2786 (= mark gnus-expirable-mark))))
2788 (defmacro gnus-article-mark (number)
2789 "Return the MARK of article NUMBER.
2790 This macro should only be used when computing the mark the \"first\"
2791 time; i.e., when generating the summary lines. After that,
2792 `gnus-summary-article-mark' should be used to examine the
2795 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2796 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2797 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2798 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2799 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2800 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2801 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2802 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2803 gnus-ancient-mark))))
2805 ;; Saving hidden threads.
2807 (defmacro gnus-save-hidden-threads (&rest forms)
2808 "Save hidden threads, eval FORMS, and restore the hidden threads."
2809 (let ((config (make-symbol "config")))
2810 `(let ((,config (gnus-hidden-threads-configuration)))
2814 (gnus-restore-hidden-threads-configuration ,config)))))
2815 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2816 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2818 (defun gnus-data-compute-positions ()
2819 "Compute the positions of all articles."
2820 (setq gnus-newsgroup-data-reverse nil)
2821 (let ((data gnus-newsgroup-data))
2823 (gnus-save-hidden-threads
2824 (gnus-summary-show-all-threads)
2825 (goto-char (point-min))
2827 (while (get-text-property (point) 'gnus-intangible)
2829 (gnus-data-set-pos (car data) (+ (point) 3))
2830 (setq data (cdr data))
2831 (forward-line 1))))))
2833 (defun gnus-hidden-threads-configuration ()
2834 "Return the current hidden threads configuration."
2837 (goto-char (point-min))
2838 (while (search-forward "\r" nil t)
2839 (push (1- (point)) config))
2842 (defun gnus-restore-hidden-threads-configuration (config)
2843 "Restore hidden threads configuration from CONFIG."
2845 (let (point buffer-read-only)
2846 (while (setq point (pop config))
2847 (when (and (< point (point-max))
2849 (eq (char-after) ?\n))
2850 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2852 ;; Various summary mode internalish functions.
2854 (defun gnus-mouse-pick-article (e)
2857 (gnus-summary-next-page nil t))
2859 (defun gnus-summary-set-display-table ()
2860 "Change the display table.
2861 Odd characters have a tendency to mess
2862 up nicely formatted displays - we make all possible glyphs
2863 display only a single character."
2865 ;; We start from the standard display table, if any.
2866 (let ((table (or (copy-sequence standard-display-table)
2867 (make-display-table)))
2869 ;; Nix out all the control chars...
2870 (while (>= (setq i (1- i)) 0)
2871 (aset table i [??]))
2872 ;; ... but not newline and cr, of course. (cr is necessary for the
2873 ;; selective display).
2874 (aset table ?\n nil)
2875 (aset table ?\r nil)
2876 ;; We keep TAB as well.
2877 (aset table ?\t nil)
2878 ;; We nix out any glyphs over 126 that are not set already.
2880 (while (>= (setq i (1- i)) 127)
2881 ;; Only modify if the entry is nil.
2882 (unless (aref table i)
2883 (aset table i [??]))))
2884 (setq buffer-display-table table)))
2886 (defun gnus-summary-set-article-display-arrow (pos)
2887 "Update the overlay arrow to point to line at position POS."
2888 (when (and gnus-summary-display-arrow
2889 (boundp 'overlay-arrow-position)
2890 (boundp 'overlay-arrow-string))
2894 (unless overlay-arrow-position
2895 (setq overlay-arrow-position (make-marker)))
2896 (setq overlay-arrow-string "=>"
2897 overlay-arrow-position (set-marker overlay-arrow-position
2899 (current-buffer))))))
2901 (defun gnus-summary-buffer-name (group)
2902 "Return the summary buffer name of GROUP."
2903 (concat "*Summary " (gnus-group-decoded-name group) "*"))
2905 (defun gnus-summary-setup-buffer (group)
2906 "Initialize summary buffer."
2907 (let ((buffer (gnus-summary-buffer-name group))
2908 (dead-name (concat "*Dead Summary "
2909 (gnus-group-decoded-name group) "*")))
2910 ;; If a dead summary buffer exists, we kill it.
2911 (when (gnus-buffer-live-p dead-name)
2912 (gnus-kill-buffer dead-name))
2913 (if (get-buffer buffer)
2916 (setq gnus-summary-buffer (current-buffer))
2917 (not gnus-newsgroup-prepared))
2918 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2919 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2920 (gnus-summary-mode group)
2922 (gnus-carpal-setup-buffer 'summary))
2923 (unless gnus-single-article-buffer
2924 (make-local-variable 'gnus-article-buffer)
2925 (make-local-variable 'gnus-article-current)
2926 (make-local-variable 'gnus-original-article-buffer))
2927 (setq gnus-newsgroup-name group)
2928 ;; Set any local variables in the group parameters.
2929 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2932 (defun gnus-set-global-variables ()
2933 "Set the global equivalents of the buffer-local variables.
2934 They are set to the latest values they had. These reflect the summary
2935 buffer that was in action when the last article was fetched."
2936 (when (eq major-mode 'gnus-summary-mode)
2937 (setq gnus-summary-buffer (current-buffer))
2938 (let ((name gnus-newsgroup-name)
2939 (marked gnus-newsgroup-marked)
2940 (unread gnus-newsgroup-unreads)
2941 (headers gnus-current-headers)
2942 (data gnus-newsgroup-data)
2943 (summary gnus-summary-buffer)
2944 (article-buffer gnus-article-buffer)
2945 (original gnus-original-article-buffer)
2946 (gac gnus-article-current)
2947 (reffed gnus-reffed-article-number)
2948 (score-file gnus-current-score-file)
2949 (default-charset gnus-newsgroup-charset)
2951 (let ((locals gnus-newsgroup-variables))
2953 (if (consp (car locals))
2954 (push (eval (caar locals)) vlist)
2955 (push (eval (car locals)) vlist))
2956 (setq locals (cdr locals)))
2957 (setq vlist (nreverse vlist)))
2959 (set-buffer gnus-group-buffer)
2960 (setq gnus-newsgroup-name name
2961 gnus-newsgroup-marked marked
2962 gnus-newsgroup-unreads unread
2963 gnus-current-headers headers
2964 gnus-newsgroup-data data
2965 gnus-article-current gac
2966 gnus-summary-buffer summary
2967 gnus-article-buffer article-buffer
2968 gnus-original-article-buffer original
2969 gnus-reffed-article-number reffed
2970 gnus-current-score-file score-file
2971 gnus-newsgroup-charset default-charset)
2972 (let ((locals gnus-newsgroup-variables))
2974 (if (consp (car locals))
2975 (set (caar locals) (pop vlist))
2976 (set (car locals) (pop vlist)))
2977 (setq locals (cdr locals))))
2978 ;; The article buffer also has local variables.
2979 (when (gnus-buffer-live-p gnus-article-buffer)
2980 (set-buffer gnus-article-buffer)
2981 (setq gnus-summary-buffer summary))))))
2983 (defun gnus-summary-article-unread-p (article)
2984 "Say whether ARTICLE is unread or not."
2985 (memq article gnus-newsgroup-unreads))
2987 (defun gnus-summary-first-article-p (&optional article)
2988 "Return whether ARTICLE is the first article in the buffer."
2989 (if (not (setq article (or article (gnus-summary-article-number))))
2991 (eq article (caar gnus-newsgroup-data))))
2993 (defun gnus-summary-last-article-p (&optional article)
2994 "Return whether ARTICLE is the last article in the buffer."
2995 (if (not (setq article (or article (gnus-summary-article-number))))
2996 ;; All non-existent numbers are the last article. :-)
2998 (not (cdr (gnus-data-find-list article)))))
3000 (defun gnus-make-thread-indent-array ()
3002 (unless (and gnus-thread-indent-array
3003 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3004 (setq gnus-thread-indent-array (make-vector 201 "")
3005 gnus-thread-indent-array-level gnus-thread-indent-level)
3007 (aset gnus-thread-indent-array n
3008 (make-string (* n gnus-thread-indent-level) ? ))
3011 (defun gnus-update-summary-mark-positions ()
3012 "Compute where the summary marks are to go."
3014 (when (gnus-buffer-exists-p gnus-summary-buffer)
3015 (set-buffer gnus-summary-buffer))
3016 (let ((gnus-replied-mark 129)
3017 (gnus-score-below-mark 130)
3018 (gnus-score-over-mark 130)
3019 (gnus-download-mark 131)
3020 (spec gnus-summary-line-format-spec)
3023 (gnus-set-work-buffer)
3024 (let ((gnus-summary-line-format-spec spec)
3025 (gnus-newsgroup-downloadable '((0 . t))))
3026 (gnus-summary-insert-line
3027 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3028 0 nil 128 t nil "" nil 1)
3029 (goto-char (point-min))
3030 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3032 (goto-char (point-min))
3033 (push (cons 'replied (and (search-forward "\201" nil t)
3036 (goto-char (point-min))
3037 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
3039 (goto-char (point-min))
3040 (push (cons 'download
3041 (and (search-forward "\203" nil t) (- (point) 2)))
3043 (setq gnus-summary-mark-positions pos))))
3045 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3046 "Insert a dummy root in the summary buffer."
3048 (gnus-add-text-properties
3049 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3050 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3052 (defun gnus-summary-extract-address-component (from)
3053 (or (car (funcall gnus-extract-address-components from))
3056 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3057 (let ((mail-parse-charset gnus-newsgroup-charset)
3058 ; Is it really necessary to do this next part for each summary line?
3059 ; Luckily, doesn't seem to slow things down much.
3060 (mail-parse-ignored-charsets
3061 (save-excursion (set-buffer gnus-summary-buffer)
3062 gnus-newsgroup-ignored-charsets)))
3064 (and gnus-ignored-from-addresses
3065 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3066 (let ((extra-headers (mail-header-extra header))
3070 ((setq to (cdr (assq 'To extra-headers)))
3073 (gnus-summary-extract-address-component
3074 (funcall gnus-decode-encoded-word-function to)))))
3075 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3076 (concat "=> " newsgroups)))))
3077 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3079 (defun gnus-summary-insert-line (gnus-tmp-header
3080 gnus-tmp-level gnus-tmp-current
3081 gnus-tmp-unread gnus-tmp-replied
3082 gnus-tmp-expirable gnus-tmp-subject-or-nil
3083 &optional gnus-tmp-dummy gnus-tmp-score
3085 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3086 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3087 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3088 (gnus-tmp-score-char
3089 (if (or (null gnus-summary-default-score)
3090 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3091 gnus-summary-zcore-fuzz))
3093 (if (< gnus-tmp-score gnus-summary-default-score)
3094 gnus-score-below-mark gnus-score-over-mark)))
3095 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3097 (cond (gnus-tmp-process gnus-process-mark)
3098 ((memq gnus-tmp-current gnus-newsgroup-cached)
3100 (gnus-tmp-replied gnus-replied-mark)
3101 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3102 gnus-forwarded-mark)
3103 ((memq gnus-tmp-current gnus-newsgroup-saved)
3105 ((memq gnus-tmp-number gnus-newsgroup-recent)
3107 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3110 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3113 ((string-match "<[^>]+> *$" gnus-tmp-from)
3114 (let ((beg (match-beginning 0)))
3115 (or (and (string-match "^\".+\"" gnus-tmp-from)
3116 (substring gnus-tmp-from 1 (1- (match-end 0))))
3117 (substring gnus-tmp-from 0 beg))))
3118 ((string-match "(.+)" gnus-tmp-from)
3119 (substring gnus-tmp-from
3120 (1+ (match-beginning 0)) (1- (match-end 0))))
3122 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3123 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3124 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3125 (buffer-read-only nil))
3126 (when (string= gnus-tmp-name "")
3127 (setq gnus-tmp-name gnus-tmp-from))
3128 (unless (numberp gnus-tmp-lines)
3129 (setq gnus-tmp-lines -1))
3130 (if (= gnus-tmp-lines -1)
3131 (setq gnus-tmp-lines "?")
3132 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3133 (gnus-put-text-property
3135 (progn (eval gnus-summary-line-format-spec) (point))
3136 'gnus-number gnus-tmp-number)
3137 (when (gnus-visual-p 'summary-highlight 'highlight)
3139 (gnus-run-hooks 'gnus-summary-update-hook)
3142 (defun gnus-summary-update-line (&optional dont-update)
3143 "Update summary line after change."
3144 (when (and gnus-summary-default-score
3145 (not gnus-summary-inhibit-highlight))
3146 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3147 (article (gnus-summary-article-number))
3148 (score (gnus-summary-article-score article)))
3150 (if (and gnus-summary-mark-below
3151 (< (gnus-summary-article-score)
3152 gnus-summary-mark-below))
3153 ;; This article has a low score, so we mark it as read.
3154 (when (memq article gnus-newsgroup-unreads)
3155 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3156 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3157 ;; This article was previously marked as read on account
3158 ;; of a low score, but now it has risen, so we mark it as
3160 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3161 (gnus-summary-update-mark
3162 (if (or (null gnus-summary-default-score)
3163 (<= (abs (- score gnus-summary-default-score))
3164 gnus-summary-zcore-fuzz))
3166 (if (< score gnus-summary-default-score)
3167 gnus-score-below-mark gnus-score-over-mark))
3169 ;; Do visual highlighting.
3170 (when (gnus-visual-p 'summary-highlight 'highlight)
3171 (gnus-run-hooks 'gnus-summary-update-hook)))))
3173 (defvar gnus-tmp-new-adopts nil)
3175 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3176 "Return the number of articles in THREAD.
3177 This may be 0 in some cases -- if none of the articles in
3178 the thread are to be displayed."
3180 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3182 ((not (listp thread))
3184 ((and (consp thread) (cdr thread))
3187 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3190 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3193 (when (and level (zerop level) gnus-tmp-new-adopts)
3196 'gnus-summary-number-of-articles-in-thread
3197 gnus-tmp-new-adopts))))
3199 (if (> number 1) gnus-not-empty-thread-mark
3200 gnus-empty-thread-mark)
3203 (defun gnus-summary-set-local-parameters (group)
3204 "Go through the local params of GROUP and set all variable specs in that list."
3205 (let ((params (gnus-group-find-parameter group))
3206 (vars '(quit-config)) ; Ignore quit-config.
3209 (setq elem (car params)
3210 params (cdr params))
3211 (and (consp elem) ; Has to be a cons.
3212 (consp (cdr elem)) ; The cdr has to be a list.
3213 (symbolp (car elem)) ; Has to be a symbol in there.
3214 (not (memq (car elem) vars))
3215 (ignore-errors ; So we set it.
3216 (push (car elem) vars)
3217 (make-local-variable (car elem))
3218 (set (car elem) (eval (nth 1 elem))))))))
3220 (defun gnus-summary-read-group (group &optional show-all no-article
3221 kill-buffer no-display backward
3223 "Start reading news in newsgroup GROUP.
3224 If SHOW-ALL is non-nil, already read articles are also listed.
3225 If NO-ARTICLE is non-nil, no article is selected initially.
3226 If NO-DISPLAY, don't generate a summary buffer."
3230 (let ((gnus-auto-select-next nil))
3231 (or (gnus-summary-read-group-1
3232 group show-all no-article
3233 kill-buffer no-display
3236 select-articles nil)))))
3237 (eq gnus-auto-select-next 'quietly))
3238 (set-buffer gnus-group-buffer)
3239 ;; The entry function called above goes to the next
3240 ;; group automatically, so we go two groups back
3241 ;; if we are searching for the previous group.
3243 (gnus-group-prev-unread-group 2))
3244 (if (not (equal group (gnus-group-group-name)))
3245 (setq group (gnus-group-group-name))
3249 (defun gnus-summary-read-group-1 (group show-all no-article
3250 kill-buffer no-display
3251 &optional select-articles)
3252 ;; Killed foreign groups can't be entered.
3253 ;; (when (and (not (gnus-group-native-p group))
3254 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3255 ;; (error "Dead non-native groups can't be entered"))
3256 (gnus-message 5 "Retrieving newsgroup: %s..."
3257 (gnus-group-decoded-name group))
3258 (let* ((new-group (gnus-summary-setup-buffer group))
3259 (quit-config (gnus-group-quit-config group))
3260 (did-select (and new-group (gnus-select-newsgroup
3261 group show-all select-articles))))
3263 ;; This summary buffer exists already, so we just select it.
3265 (gnus-set-global-variables)
3267 (gnus-kill-or-deaden-summary kill-buffer))
3268 (gnus-configure-windows 'summary 'force)
3269 (gnus-set-mode-line 'summary)
3270 (gnus-summary-position-point)
3273 ;; We couldn't select this group.
3275 (when (and (eq major-mode 'gnus-summary-mode)
3276 (not (equal (current-buffer) kill-buffer)))
3277 (kill-buffer (current-buffer))
3278 (if (not quit-config)
3280 ;; Update the info -- marks might need to be removed,
3282 (gnus-summary-update-info)
3283 (set-buffer gnus-group-buffer)
3284 (gnus-group-jump-to-group group)
3285 (gnus-group-next-unread-group 1))
3286 (gnus-handle-ephemeral-exit quit-config)))
3287 (let ((grpinfo (gnus-get-info group)))
3288 (if (null (gnus-info-read grpinfo))
3289 (gnus-message 3 "Group %s contains no messages"
3290 (gnus-group-decoded-name group))
3291 (gnus-message 3 "Can't select group")))
3293 ;; The user did a `C-g' while prompting for number of articles,
3294 ;; so we exit this group.
3295 ((eq did-select 'quit)
3296 (and (eq major-mode 'gnus-summary-mode)
3297 (not (equal (current-buffer) kill-buffer))
3298 (kill-buffer (current-buffer)))
3300 (gnus-kill-or-deaden-summary kill-buffer))
3301 (if (not quit-config)
3303 (set-buffer gnus-group-buffer)
3304 (gnus-group-jump-to-group group)
3305 (gnus-group-next-unread-group 1)
3306 (gnus-configure-windows 'group 'force))
3307 (gnus-handle-ephemeral-exit quit-config))
3308 ;; Finally signal the quit.
3310 ;; The group was successfully selected.
3312 (gnus-set-global-variables)
3313 ;; Save the active value in effect when the group was entered.
3314 (setq gnus-newsgroup-active
3316 (gnus-active gnus-newsgroup-name)))
3317 ;; You can change the summary buffer in some way with this hook.
3318 (gnus-run-hooks 'gnus-select-group-hook)
3319 (gnus-update-format-specifications
3320 nil 'summary 'summary-mode 'summary-dummy)
3321 (gnus-update-summary-mark-positions)
3322 ;; Do score processing.
3323 (when gnus-use-scoring
3324 (gnus-possibly-score-headers))
3325 ;; Check whether to fill in the gaps in the threads.
3326 (when gnus-build-sparse-threads
3327 (gnus-build-sparse-threads))
3328 ;; Find the initial limit.
3329 (if gnus-show-threads
3331 (let ((gnus-newsgroup-dormant nil))
3332 (gnus-summary-initial-limit show-all))
3333 (gnus-summary-initial-limit show-all))
3334 ;; When untreaded, all articles are always shown.
3335 (setq gnus-newsgroup-limit
3337 (lambda (header) (mail-header-number header))
3338 gnus-newsgroup-headers)))
3339 ;; Generate the summary buffer.
3341 (gnus-summary-prepare))
3342 (when gnus-use-trees
3343 (gnus-tree-open group)
3344 (setq gnus-summary-highlight-line-function
3345 'gnus-tree-highlight-article))
3346 ;; If the summary buffer is empty, but there are some low-scored
3347 ;; articles or some excluded dormants, we include these in the
3349 (when (and (zerop (buffer-size))
3351 (cond (gnus-newsgroup-dormant
3352 (gnus-summary-limit-include-dormant))
3353 ((and gnus-newsgroup-scored show-all)
3354 (gnus-summary-limit-include-expunged t))))
3355 ;; Function `gnus-apply-kill-file' must be called in this hook.
3356 (gnus-run-hooks 'gnus-apply-kill-hook)
3357 (if (and (zerop (buffer-size))
3360 ;; This newsgroup is empty.
3361 (gnus-summary-catchup-and-exit nil t)
3362 (gnus-message 6 "No unread news")
3364 (gnus-kill-or-deaden-summary kill-buffer))
3365 ;; Return nil from this function.
3367 ;; Hide conversation thread subtrees. We cannot do this in
3368 ;; gnus-summary-prepare-hook since kill processing may not
3369 ;; work with hidden articles.
3370 (gnus-summary-maybe-hide-threads)
3372 (gnus-kill-or-deaden-summary kill-buffer))
3373 (gnus-summary-auto-select-subject)
3374 ;; Show first unread article if requested.
3375 (if (and (not no-article)
3377 gnus-newsgroup-unreads
3378 gnus-auto-select-first)
3380 (gnus-configure-windows 'summary)
3381 (let ((art (gnus-summary-article-number)))
3382 (unless (or (memq art gnus-newsgroup-undownloaded)
3383 (memq art gnus-newsgroup-downloadable))
3384 (gnus-summary-goto-article art))))
3385 ;; Don't select any articles.
3386 (gnus-summary-position-point)
3387 (gnus-configure-windows 'summary 'force)
3388 (gnus-set-mode-line 'summary))
3389 (when (get-buffer-window gnus-group-buffer t)
3390 ;; Gotta use windows, because recenter does weird stuff if
3391 ;; the current buffer ain't the displayed window.
3392 (let ((owin (selected-window)))
3393 (select-window (get-buffer-window gnus-group-buffer t))
3394 (when (gnus-group-goto-group group)
3396 (select-window owin)))
3397 ;; Mark this buffer as "prepared".
3398 (setq gnus-newsgroup-prepared t)
3399 (gnus-run-hooks 'gnus-summary-prepared-hook)
3402 (defun gnus-summary-auto-select-subject ()
3403 "Select the subject line on initial group entry."
3404 (goto-char (point-min))
3406 ((eq gnus-auto-select-subject 'best)
3407 (gnus-summary-best-unread-subject))
3408 ((eq gnus-auto-select-subject 'unread)
3409 (gnus-summary-first-unread-subject))
3410 ((eq gnus-auto-select-subject 'unseen)
3411 (gnus-summary-first-unseen-subject))
3412 ((eq gnus-auto-select-subject 'unseen-or-unread)
3413 (gnus-summary-first-unseen-or-unread-subject))
3414 ((eq gnus-auto-select-subject 'first)
3417 ((gnus-functionp gnus-auto-select-subject)
3418 (funcall gnus-auto-select-subject))))
3420 (defun gnus-summary-prepare ()
3421 "Generate the summary buffer."
3423 (let ((buffer-read-only nil))
3425 (setq gnus-newsgroup-data nil
3426 gnus-newsgroup-data-reverse nil)
3427 (gnus-run-hooks 'gnus-summary-generate-hook)
3428 ;; Generate the buffer, either with threads or without.
3429 (when gnus-newsgroup-headers
3430 (gnus-summary-prepare-threads
3431 (if gnus-show-threads
3432 (gnus-sort-gathered-threads
3433 (funcall gnus-summary-thread-gathering-function
3435 (gnus-cut-threads (gnus-make-threads)))))
3436 ;; Unthreaded display.
3437 (gnus-sort-articles gnus-newsgroup-headers))))
3438 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3439 ;; Call hooks for modifying summary buffer.
3440 (goto-char (point-min))
3441 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3443 (defsubst gnus-general-simplify-subject (subject)
3444 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3447 ;; Truncate the subject.
3448 (gnus-simplify-subject-functions
3449 (gnus-map-function gnus-simplify-subject-functions subject))
3450 ((numberp gnus-summary-gather-subject-limit)
3451 (setq subject (gnus-simplify-subject-re subject))
3452 (if (> (length subject) gnus-summary-gather-subject-limit)
3453 (substring subject 0 gnus-summary-gather-subject-limit)
3455 ;; Fuzzily simplify it.
3456 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3457 (gnus-simplify-subject-fuzzy subject))
3458 ;; Just remove the leading "Re:".
3460 (gnus-simplify-subject-re subject))))
3462 (if (and gnus-summary-gather-exclude-subject
3463 (string-match gnus-summary-gather-exclude-subject subject))
3464 nil ; This article shouldn't be gathered
3467 (defun gnus-summary-simplify-subject-query ()
3468 "Query where the respool algorithm would put this article."
3470 (gnus-summary-select-article)
3471 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3473 (defun gnus-gather-threads-by-subject (threads)
3474 "Gather threads by looking at Subject headers."
3475 (if (not gnus-summary-make-false-root)
3477 (let ((hashtb (gnus-make-hashtable 1024))
3480 subject hthread whole-subject)
3482 (setq subject (gnus-general-simplify-subject
3483 (setq whole-subject (mail-header-subject
3486 (if (setq hthread (gnus-gethash subject hashtb))
3488 ;; We enter a dummy root into the thread, if we
3489 ;; haven't done that already.
3490 (unless (stringp (caar hthread))
3491 (setcar hthread (list whole-subject (car hthread))))
3492 ;; We add this new gathered thread to this gathered
3494 (setcdr (car hthread)
3495 (nconc (cdar hthread) (list (car threads))))
3496 ;; Remove it from the list of threads.
3497 (setcdr prev (cdr threads))
3498 (setq threads prev))
3499 ;; Enter this thread into the hash table.
3500 (gnus-sethash subject threads hashtb)))
3502 (setq threads (cdr threads)))
3505 (defun gnus-gather-threads-by-references (threads)
3506 "Gather threads by looking at References headers."
3507 (let ((idhashtb (gnus-make-hashtable 1024))
3508 (thhashtb (gnus-make-hashtable 1024))
3511 ids references id gthread gid entered ref)
3513 (when (setq references (mail-header-references (caar threads)))
3514 (setq id (mail-header-id (caar threads))
3515 ids (inline (gnus-split-references references))
3517 (while (setq ref (pop ids))
3518 (setq ids (delete ref ids))
3519 (if (not (setq gid (gnus-gethash ref idhashtb)))
3521 (gnus-sethash ref id idhashtb)
3522 (gnus-sethash id threads thhashtb))
3523 (setq gthread (gnus-gethash gid thhashtb))
3525 ;; We enter a dummy root into the thread, if we
3526 ;; haven't done that already.
3527 (unless (stringp (caar gthread))
3528 (setcar gthread (list (mail-header-subject (caar gthread))
3530 ;; We add this new gathered thread to this gathered
3532 (setcdr (car gthread)
3533 (nconc (cdar gthread) (list (car threads)))))
3534 ;; Add it into the thread hash table.
3535 (gnus-sethash id gthread thhashtb)
3537 ;; Remove it from the list of threads.
3538 (setcdr prev (cdr threads))
3539 (setq threads prev))))
3541 (setq threads (cdr threads)))
3544 (defun gnus-sort-gathered-threads (threads)
3545 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3546 (let ((result threads))
3548 (when (stringp (caar threads))
3549 (setcdr (car threads)
3550 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3551 (setq threads (cdr threads)))
3554 (defun gnus-thread-loop-p (root thread)
3555 "Say whether ROOT is in THREAD."
3556 (let ((stack (list thread))
3559 (while (setq thread (pop stack))
3560 (setq th (cdr thread))
3562 (not (eq (caar th) root)))
3565 ;; We have found a loop.
3567 (setcdr thread (delq (car th) (cdr thread)))
3568 (if (boundp (setq ref-dep (intern "none"
3569 gnus-newsgroup-dependencies)))
3570 (setcdr (symbol-value ref-dep)
3571 (nconc (cdr (symbol-value ref-dep))
3573 (set ref-dep (list nil (car th))))
3576 ;; Push all the subthreads onto the stack.
3577 (push (cdr thread) stack)))
3580 (defun gnus-make-threads ()
3581 "Go through the dependency hashtb and find the roots. Return all threads."
3583 (while (catch 'infloop
3586 ;; Deal with self-referencing References loops.
3587 (when (and (car (symbol-value refs))
3594 (car (symbol-value refs)) thread))
3595 (cdr (symbol-value refs)))))))
3598 (unless (car (symbol-value refs))
3599 ;; These threads do not refer back to any other
3600 ;; articles, so they're roots.
3601 (setq threads (append (cdr (symbol-value refs)) threads))))
3602 gnus-newsgroup-dependencies)))
3605 ;; Build the thread tree.
3606 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3607 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3609 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3610 if it was already present.
3612 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3613 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3614 Message-IDs will be renamed to a unique Message-ID before being
3617 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3618 (let* ((id (mail-header-id header))
3619 (id-dep (and id (intern id dependencies)))
3620 ref ref-dep ref-header replaced)
3621 ;; Enter this `header' in the `dependencies' table.
3625 ;; The first two cases do the normal part: enter a new `header'
3626 ;; in the `dependencies' table.
3627 ((not (boundp id-dep))
3628 (set id-dep (list header)))
3629 ((null (car (symbol-value id-dep)))
3630 (setcar (symbol-value id-dep) header))
3632 ;; From here the `header' was already present in the
3633 ;; `dependencies' table.
3635 ;; Overrides an existing entry;
3636 ;; just set the header part of the entry.
3637 (setcar (symbol-value id-dep) header)
3640 ;; Renames the existing `header' to a unique Message-ID.
3641 ((not gnus-summary-ignore-duplicates)
3642 ;; An article with this Message-ID has already been seen.
3643 ;; We rename the Message-ID.
3644 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3646 (mail-header-set-id header id))
3648 ;; The last case ignores an existing entry, except it adds any
3649 ;; additional Xrefs (in case the two articles came from different
3651 ;; Also sets `header' to `nil' meaning that the `dependencies'
3652 ;; table was *not* modified.
3654 (mail-header-set-xref
3655 (car (symbol-value id-dep))
3656 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3658 (or (mail-header-xref header) "")))
3661 (when (and header (not replaced))
3662 ;; First check that we are not creating a References loop.
3663 (setq ref (gnus-parent-id (mail-header-references header)))
3665 (setq ref-dep (intern-soft ref dependencies))
3667 (setq ref-header (car (symbol-value ref-dep))))
3668 (if (string= id ref)
3669 ;; Yuk! This is a reference loop. Make the article be a
3672 (mail-header-set-references (car (symbol-value id-dep)) "none")
3674 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3675 (setq ref (gnus-parent-id (mail-header-references header)))
3676 (setq ref-dep (intern (or ref "none") dependencies))
3677 (if (boundp ref-dep)
3678 (setcdr (symbol-value ref-dep)
3679 (nconc (cdr (symbol-value ref-dep))
3680 (list (symbol-value id-dep))))
3681 (set ref-dep (list nil (symbol-value id-dep)))))
3684 (defun gnus-extract-message-id-from-in-reply-to (string)
3685 (if (string-match "<[^>]+>" string)
3686 (substring string (match-beginning 0) (match-end 0))
3689 (defun gnus-build-sparse-threads ()
3690 (let ((headers gnus-newsgroup-headers)
3691 (mail-parse-charset gnus-newsgroup-charset)
3692 (gnus-summary-ignore-duplicates t)
3693 header references generation relations
3694 subject child end new-child date)
3695 ;; First we create an alist of generations/relations, where
3696 ;; generations is how much we trust the relation, and the relation
3698 (gnus-message 7 "Making sparse threads...")
3700 (nnheader-set-temp-buffer " *gnus sparse threads*")
3701 (while (setq header (pop headers))
3702 (when (and (setq references (mail-header-references header))
3703 (not (string= references "")))
3705 (setq child (mail-header-id header)
3706 subject (mail-header-subject header)
3707 date (mail-header-date header)
3709 (while (search-backward ">" nil t)
3710 (setq end (1+ (point)))
3711 (when (search-backward "<" nil t)
3712 (setq new-child (buffer-substring (point) end))
3713 (push (list (incf generation)
3714 child (setq child new-child)
3718 (push (list (1+ generation) child nil subject) relations))
3720 (kill-buffer (current-buffer)))
3721 ;; Sort over trustworthiness.
3724 (when (gnus-dependencies-add-header
3725 (make-full-mail-header
3726 gnus-reffed-article-number
3727 (nth 3 relation) "" (or (nth 4 relation) "")
3729 (or (nth 2 relation) "") 0 0 "")
3730 gnus-newsgroup-dependencies nil)
3731 (push gnus-reffed-article-number gnus-newsgroup-limit)
3732 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3733 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3734 gnus-newsgroup-reads)
3735 (decf gnus-reffed-article-number)))
3736 (sort relations 'car-less-than-car))
3737 (gnus-message 7 "Making sparse threads...done")))
3739 (defun gnus-build-old-threads ()
3740 ;; Look at all the articles that refer back to old articles, and
3741 ;; fetch the headers for the articles that aren't there. This will
3742 ;; build complete threads - if the roots haven't been expired by the
3744 (let ((mail-parse-charset gnus-newsgroup-charset)
3748 (when (not (car (symbol-value refs)))
3749 (setq heads (cdr (symbol-value refs)))
3751 (if (memq (mail-header-number (caar heads))
3752 gnus-newsgroup-dormant)
3753 (setq heads (cdr heads))
3754 (setq id (symbol-name refs))
3755 (while (and (setq id (gnus-build-get-header id))
3756 (not (car (gnus-id-to-thread id)))))
3757 (setq heads nil)))))
3758 gnus-newsgroup-dependencies)))
3760 ;; This function has to be called with point after the article number
3761 ;; on the beginning of the line.
3762 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3763 (let ((eol (gnus-point-at-eol))
3764 (buffer (current-buffer))
3765 header references in-reply-to)
3767 ;; overview: [num subject from date id refs chars lines misc]
3770 (narrow-to-region (point) eol)
3775 (make-full-mail-header
3777 (funcall gnus-decode-encoded-word-function
3778 (nnheader-nov-field)) ; subject
3779 (funcall gnus-decode-encoded-word-function
3780 (nnheader-nov-field)) ; from
3781 (nnheader-nov-field) ; date
3782 (nnheader-nov-read-message-id) ; id
3783 (setq references (nnheader-nov-field)) ; refs
3784 (nnheader-nov-read-integer) ; chars
3785 (nnheader-nov-read-integer) ; lines
3787 (if (looking-at "Xref: ")
3788 (goto-char (match-end 0)))
3789 (nnheader-nov-field)) ; Xref
3790 (nnheader-nov-parse-extra)))) ; extra
3794 (when (and (string= references "")
3795 (setq in-reply-to (mail-header-extra header))
3796 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
3797 (mail-header-set-references
3798 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
3800 (when gnus-alter-header-function
3801 (funcall gnus-alter-header-function header))
3802 (gnus-dependencies-add-header header dependencies force-new)))
3804 (defun gnus-build-get-header (id)
3805 "Look through the buffer of NOV lines and find the header to ID.
3806 Enter this line into the dependencies hash table, and return
3807 the id of the parent article (if any)."
3808 (let ((deps gnus-newsgroup-dependencies)
3812 (set-buffer nntp-server-buffer)
3813 (let ((case-fold-search nil))
3814 (goto-char (point-min))
3815 (while (and (not found)
3816 (search-forward id nil t))
3818 (setq found (looking-at
3819 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3820 (regexp-quote id))))
3821 (or found (beginning-of-line 2)))
3825 (setq header (gnus-nov-parse-line
3826 (read (current-buffer)) deps))
3827 (gnus-parent-id (mail-header-references header))))))
3829 (let ((number (mail-header-number header)))
3830 (push number gnus-newsgroup-limit)
3831 (push header gnus-newsgroup-headers)
3832 (if (memq number gnus-newsgroup-unselected)
3834 (setq gnus-newsgroup-unreads
3835 (gnus-add-to-sorted-list gnus-newsgroup-unreads
3837 (setq gnus-newsgroup-unselected
3838 (delq number gnus-newsgroup-unselected)))
3839 (push number gnus-newsgroup-ancient)))))))
3841 (defun gnus-build-all-threads ()
3842 "Read all the headers."
3843 (let ((gnus-summary-ignore-duplicates t)
3844 (mail-parse-charset gnus-newsgroup-charset)
3845 (dependencies gnus-newsgroup-dependencies)
3848 (set-buffer nntp-server-buffer)
3849 (let ((case-fold-search nil))
3850 (goto-char (point-min))
3853 (setq article (read (current-buffer))
3854 header (gnus-nov-parse-line article dependencies)))
3857 (set-buffer gnus-summary-buffer)
3858 (push header gnus-newsgroup-headers)
3859 (if (memq (setq article (mail-header-number header))
3860 gnus-newsgroup-unselected)
3862 (setq gnus-newsgroup-unreads
3863 (gnus-add-to-sorted-list
3864 gnus-newsgroup-unreads article))
3865 (setq gnus-newsgroup-unselected
3866 (delq article gnus-newsgroup-unselected)))
3867 (push article gnus-newsgroup-ancient)))
3868 (forward-line 1)))))))
3870 (defun gnus-summary-update-article-line (article header)
3871 "Update the line for ARTICLE using HEADERS."
3872 (let* ((id (mail-header-id header))
3873 (thread (gnus-id-to-thread id)))
3875 (error "Article in no thread"))
3876 ;; Update the thread.
3877 (setcar thread header)
3878 (gnus-summary-goto-subject article)
3879 (let* ((datal (gnus-data-find-list article))
3881 (length (when (cdr datal)
3882 (- (gnus-data-pos data)
3883 (gnus-data-pos (cadr datal)))))
3884 (buffer-read-only nil)
3885 (level (gnus-summary-thread-level)))
3887 (gnus-summary-insert-line
3888 header level nil (gnus-article-mark article)
3889 (memq article gnus-newsgroup-replied)
3890 (memq article gnus-newsgroup-expirable)
3891 ;; Only insert the Subject string when it's different
3892 ;; from the previous Subject string.
3897 (mail-header-subject
3900 (gnus-data-find-list
3902 (gnus-data-list t)))))
3903 ;; Error on the side of excessive subjects.
3905 (mail-header-subject header)))
3907 (mail-header-subject header))
3908 nil (cdr (assq article gnus-newsgroup-scored))
3909 (memq article gnus-newsgroup-processable))
3911 (gnus-data-update-list
3912 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3914 (defun gnus-summary-update-article (article &optional iheader)
3915 "Update ARTICLE in the summary buffer."
3916 (set-buffer gnus-summary-buffer)
3917 (let* ((header (gnus-summary-article-header article))
3918 (id (mail-header-id header))
3919 (data (gnus-data-find article))
3920 (thread (gnus-id-to-thread id))
3921 (references (mail-header-references header))
3925 (when (and references
3926 (not (equal "" references)))
3929 (buffer-read-only nil)
3935 (delq thread parent)))
3936 (if (gnus-summary-insert-subject id header)
3937 ;; Set the (possibly) new article number in the data structure.
3938 (gnus-data-set-number data (gnus-id-to-article id))
3942 (defun gnus-rebuild-thread (id &optional line)
3943 "Rebuild the thread containing ID.
3944 If LINE, insert the rebuilt thread starting on line LINE."
3945 (let ((buffer-read-only nil)
3946 old-pos current thread data)
3947 (if (not gnus-show-threads)
3948 (setq thread (list (car (gnus-id-to-thread id))))
3949 ;; Get the thread this article is part of.
3950 (setq thread (gnus-remove-thread id)))
3951 (setq old-pos (gnus-point-at-bol))
3952 (setq current (save-excursion
3953 (and (re-search-backward "[\r\n]" nil t)
3954 (gnus-summary-article-number))))
3955 ;; If this is a gathered thread, we have to go some re-gathering.
3956 (when (stringp (car thread))
3957 (let ((subject (car thread))
3959 (setq thread (cdr thread))
3961 (unless (memq (setq thr (gnus-id-to-thread
3963 (mail-header-id (caar thread)))))
3966 (setq thread (cdr thread)))
3967 ;; We now have all (unique) roots.
3968 (if (= (length roots) 1)
3969 ;; All the loose roots are now one solid root.
3970 (setq thread (car roots))
3971 (setq thread (cons subject (gnus-sort-threads roots))))))
3973 ;; We then insert this thread into the summary buffer.
3975 (goto-char (point-min))
3976 (forward-line (1- line)))
3977 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3978 (if gnus-show-threads
3979 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3980 (gnus-summary-prepare-unthreaded thread))
3981 (setq data (nreverse gnus-newsgroup-data))
3982 (setq threads gnus-newsgroup-threads))
3983 ;; We splice the new data into the data structure.
3984 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3985 ;;!!! then we want to insert at the beginning of the buffer.
3986 ;;!!! That happens to be true with Gnus now, but that may
3987 ;;!!! change in the future. Perhaps.
3988 (gnus-data-enter-list
3989 (if line nil current) data (- (point) old-pos))
3990 (setq gnus-newsgroup-threads
3991 (nconc threads gnus-newsgroup-threads))
3992 (gnus-data-compute-positions))))
3994 (defun gnus-number-to-header (number)
3995 "Return the header for article NUMBER."
3996 (let ((headers gnus-newsgroup-headers))
3998 (not (= number (mail-header-number (car headers)))))
4003 (defun gnus-parent-headers (in-headers &optional generation)
4004 "Return the headers of the GENERATIONeth parent of HEADERS."
4006 (setq generation 1))
4008 (headers in-headers)
4011 (not (zerop generation))
4012 (setq references (mail-header-references headers)))
4013 (setq headers (if (and references
4014 (setq parent (gnus-parent-id references)))
4015 (car (gnus-id-to-thread parent))
4018 (and (not (eq headers in-headers))
4021 (defun gnus-id-to-thread (id)
4022 "Return the (sub-)thread where ID appears."
4023 (gnus-gethash id gnus-newsgroup-dependencies))
4025 (defun gnus-id-to-article (id)
4026 "Return the article number of ID."
4027 (let ((thread (gnus-id-to-thread id)))
4030 (mail-header-number (car thread)))))
4032 (defun gnus-id-to-header (id)
4033 "Return the article headers of ID."
4034 (car (gnus-id-to-thread id)))
4036 (defun gnus-article-displayed-root-p (article)
4037 "Say whether ARTICLE is a root(ish) article."
4038 (let ((level (gnus-summary-thread-level article))
4039 (refs (mail-header-references (gnus-summary-article-header article)))
4045 ((null (gnus-parent-id refs)) t)
4047 (null (setq particle (gnus-id-to-article
4048 (gnus-parent-id refs))))
4049 (null (gnus-summary-thread-level particle)))))))
4051 (defun gnus-root-id (id)
4052 "Return the id of the root of the thread where ID appears."
4054 (while (and id (setq prev (car (gnus-id-to-thread id))))
4056 id (gnus-parent-id (mail-header-references prev))))
4059 (defun gnus-articles-in-thread (thread)
4060 "Return the list of articles in THREAD."
4061 (cons (mail-header-number (car thread))
4062 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4064 (defun gnus-remove-thread (id &optional dont-remove)
4065 "Remove the thread that has ID in it."
4066 (let (headers thread last-id)
4067 ;; First go up in this thread until we find the root.
4068 (setq last-id (gnus-root-id id)
4069 headers (message-flatten-list (gnus-id-to-thread last-id)))
4070 ;; We have now found the real root of this thread. It might have
4071 ;; been gathered into some loose thread, so we have to search
4072 ;; through the threads to find the thread we wanted.
4073 (let ((threads gnus-newsgroup-threads)
4076 (setq sub (car threads))
4077 (if (stringp (car sub))
4078 ;; This is a gathered thread, so we look at the roots
4079 ;; below it to find whether this article is in this
4082 (setq sub (cdr sub))
4084 (when (member (caar sub) headers)
4085 (setq thread (car threads)
4088 (setq sub (cdr sub))))
4089 ;; It's an ordinary thread, so we check it.
4090 (when (eq (car sub) (car headers))
4093 (setq threads (cdr threads)))
4094 ;; If this article is in no thread, then it's a root.
4097 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4098 (setq thread (gnus-id-to-thread last-id)))
4101 thread ; We return this thread.
4103 (if (stringp (car thread))
4105 ;; If we use dummy roots, then we have to remove the
4106 ;; dummy root as well.
4107 (when (eq gnus-summary-make-false-root 'dummy)
4108 ;; We go to the dummy root by going to
4109 ;; the first sub-"thread", and then one line up.
4110 (gnus-summary-goto-article
4111 (mail-header-number (caadr thread)))
4114 (gnus-data-compute-positions))
4115 (setq thread (cdr thread))
4117 (gnus-remove-thread-1 (car thread))
4118 (setq thread (cdr thread))))
4119 (gnus-remove-thread-1 thread))))))))
4121 (defun gnus-remove-thread-1 (thread)
4122 "Remove the thread THREAD recursively."
4123 (let ((number (mail-header-number (pop thread)))
4125 (setq thread (reverse thread))
4127 (gnus-remove-thread-1 (pop thread)))
4128 (when (setq d (gnus-data-find number))
4129 (goto-char (gnus-data-pos d))
4130 (gnus-summary-show-thread)
4133 (- (gnus-point-at-bol)
4135 (1+ (gnus-point-at-eol))
4136 (gnus-delete-line)))))))
4138 (defun gnus-sort-threads-1 (threads func)
4139 (sort (mapcar (lambda (thread)
4142 (gnus-sort-threads-1 (cdr thread) func))))
4145 (defun gnus-sort-threads (threads)
4147 (if (not gnus-thread-sort-functions)
4149 (gnus-message 8 "Sorting threads...")
4151 (gnus-sort-threads-1
4153 (gnus-make-sort-function gnus-thread-sort-functions))
4154 (gnus-message 8 "Sorting threads...done"))))
4156 (defun gnus-sort-articles (articles)
4158 (when gnus-article-sort-functions
4159 (gnus-message 7 "Sorting articles...")
4161 (setq gnus-newsgroup-headers
4162 (sort articles (gnus-make-sort-function
4163 gnus-article-sort-functions)))
4164 (gnus-message 7 "Sorting articles...done"))))
4166 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4167 (defmacro gnus-thread-header (thread)
4168 "Return header of first article in THREAD.
4169 Note that THREAD must never, ever be anything else than a variable -
4170 using some other form will lead to serious barfage."
4171 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4172 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4173 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4176 (defsubst gnus-article-sort-by-number (h1 h2)
4177 "Sort articles by article number."
4178 (< (mail-header-number h1)
4179 (mail-header-number h2)))
4181 (defun gnus-thread-sort-by-number (h1 h2)
4182 "Sort threads by root article number."
4183 (gnus-article-sort-by-number
4184 (gnus-thread-header h1) (gnus-thread-header h2)))
4186 (defsubst gnus-article-sort-by-lines (h1 h2)
4187 "Sort articles by article Lines header."
4188 (< (mail-header-lines h1)
4189 (mail-header-lines h2)))
4191 (defun gnus-thread-sort-by-lines (h1 h2)
4192 "Sort threads by root article Lines header."
4193 (gnus-article-sort-by-lines
4194 (gnus-thread-header h1) (gnus-thread-header h2)))
4196 (defsubst gnus-article-sort-by-chars (h1 h2)
4197 "Sort articles by octet length."
4198 (< (mail-header-chars h1)
4199 (mail-header-chars h2)))
4201 (defun gnus-thread-sort-by-chars (h1 h2)
4202 "Sort threads by root article octet length."
4203 (gnus-article-sort-by-chars
4204 (gnus-thread-header h1) (gnus-thread-header h2)))
4206 (defsubst gnus-article-sort-by-author (h1 h2)
4207 "Sort articles by root author."
4209 (let ((extract (funcall
4210 gnus-extract-address-components
4211 (mail-header-from h1))))
4212 (or (car extract) (cadr extract) ""))
4213 (let ((extract (funcall
4214 gnus-extract-address-components
4215 (mail-header-from h2))))
4216 (or (car extract) (cadr extract) ""))))
4218 (defun gnus-thread-sort-by-author (h1 h2)
4219 "Sort threads by root author."
4220 (gnus-article-sort-by-author
4221 (gnus-thread-header h1) (gnus-thread-header h2)))
4223 (defsubst gnus-article-sort-by-subject (h1 h2)
4224 "Sort articles by root subject."
4226 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4227 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4229 (defun gnus-thread-sort-by-subject (h1 h2)
4230 "Sort threads by root subject."
4231 (gnus-article-sort-by-subject
4232 (gnus-thread-header h1) (gnus-thread-header h2)))
4234 (defsubst gnus-article-sort-by-date (h1 h2)
4235 "Sort articles by root article date."
4237 (gnus-date-get-time (mail-header-date h1))
4238 (gnus-date-get-time (mail-header-date h2))))
4240 (defun gnus-thread-sort-by-date (h1 h2)
4241 "Sort threads by root article date."
4242 (gnus-article-sort-by-date
4243 (gnus-thread-header h1) (gnus-thread-header h2)))
4245 (defsubst gnus-article-sort-by-score (h1 h2)
4246 "Sort articles by root article score.
4247 Unscored articles will be counted as having a score of zero."
4248 (> (or (cdr (assq (mail-header-number h1)
4249 gnus-newsgroup-scored))
4250 gnus-summary-default-score 0)
4251 (or (cdr (assq (mail-header-number h2)
4252 gnus-newsgroup-scored))
4253 gnus-summary-default-score 0)))
4255 (defun gnus-thread-sort-by-score (h1 h2)
4256 "Sort threads by root article score."
4257 (gnus-article-sort-by-score
4258 (gnus-thread-header h1) (gnus-thread-header h2)))
4260 (defun gnus-thread-sort-by-total-score (h1 h2)
4261 "Sort threads by the sum of all scores in the thread.
4262 Unscored articles will be counted as having a score of zero."
4263 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4265 (defun gnus-thread-total-score (thread)
4266 ;; This function find the total score of THREAD.
4271 (if (stringp (car thread))
4272 (apply gnus-thread-score-function 0
4273 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4274 (gnus-thread-total-score-1 thread)))
4276 (gnus-thread-total-score-1 (list thread)))))
4278 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4279 "Sort threads such that the thread with the most recently arrived article comes first."
4280 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4282 (defun gnus-thread-highest-number (thread)
4283 "Return the highest article number in THREAD."
4284 (apply 'max (mapcar (lambda (header)
4285 (mail-header-number header))
4286 (message-flatten-list thread))))
4288 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4289 "Sort threads such that the thread with the most recently dated article comes first."
4290 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4292 (defun gnus-thread-latest-date (thread)
4293 "Return the highest article date in THREAD."
4294 (let ((previous-time 0))
4299 (mail-header-parse-date
4301 (mail-header-date header)
4302 (error previous-time))))))
4304 (message-flatten-list thread)
4306 (< (mail-header-number h1)
4307 (mail-header-number h2))))))))
4309 (defun gnus-thread-total-score-1 (root)
4310 ;; This function find the total score of the thread below ROOT.
4311 (setq root (car root))
4312 (apply gnus-thread-score-function
4314 (mapcar 'gnus-thread-total-score
4315 (cdr (gnus-id-to-thread (mail-header-id root))))
4316 (when (> (mail-header-number root) 0)
4317 (list (or (cdr (assq (mail-header-number root)
4318 gnus-newsgroup-scored))
4319 gnus-summary-default-score 0))))
4320 (list gnus-summary-default-score)
4323 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4324 (defvar gnus-tmp-prev-subject nil)
4325 (defvar gnus-tmp-false-parent nil)
4326 (defvar gnus-tmp-root-expunged nil)
4327 (defvar gnus-tmp-dummy-line nil)
4329 (eval-when-compile (defvar gnus-tmp-header))
4330 (defun gnus-extra-header (type &optional header)
4331 "Return the extra header of TYPE."
4332 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4335 (defvar gnus-tmp-thread-tree-header-string "")
4337 (defcustom gnus-sum-thread-tree-root "> "
4338 "With %B spec, used for the root of a thread.
4339 If nil, use subject instead."
4341 :group 'gnus-thread)
4342 (defcustom gnus-sum-thread-tree-single-indent ""
4343 "With %B spec, used for a thread with just one message.
4344 If nil, use subject instead."
4346 :group 'gnus-thread)
4347 (defcustom gnus-sum-thread-tree-vertical "| "
4348 "With %B spec, used for drawing a vertical line."
4350 :group 'gnus-thread)
4351 (defcustom gnus-sum-thread-tree-indent " "
4352 "With %B spec, used for indenting."
4354 :group 'gnus-thread)
4355 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4356 "With %B spec, used for a leaf with brothers."
4358 :group 'gnus-thread)
4359 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4360 "With %B spec, used for a leaf without brothers."
4362 :group 'gnus-thread)
4364 (defun gnus-summary-prepare-threads (threads)
4365 "Prepare summary buffer from THREADS and indentation LEVEL.
4366 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4367 or a straight list of headers."
4368 (gnus-message 7 "Generating summary...")
4370 (setq gnus-newsgroup-threads threads)
4373 (let ((gnus-tmp-level 0)
4374 (default-score (or gnus-summary-default-score 0))
4375 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4376 thread number subject stack state gnus-tmp-gathered beg-match
4377 new-roots gnus-tmp-new-adopts thread-end
4378 gnus-tmp-header gnus-tmp-unread
4379 gnus-tmp-replied gnus-tmp-subject-or-nil
4380 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4381 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4382 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4385 (setq gnus-tmp-prev-subject nil)
4387 (if (vectorp (car threads))
4388 ;; If this is a straight (sic) list of headers, then a
4389 ;; threaded summary display isn't required, so we just create
4390 ;; an unthreaded one.
4391 (gnus-summary-prepare-unthreaded threads)
4393 ;; Do the threaded display.
4395 (while (or threads stack gnus-tmp-new-adopts new-roots)
4397 (if (and (= gnus-tmp-level 0)
4400 (not gnus-tmp-false-parent)
4401 (or gnus-tmp-new-adopts new-roots))
4402 (if gnus-tmp-new-adopts
4403 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4404 thread (list (car gnus-tmp-new-adopts))
4405 gnus-tmp-header (caar thread)
4406 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4408 (setq thread (list (car new-roots))
4409 gnus-tmp-header (caar thread)
4410 new-roots (cdr new-roots))))
4413 ;; If there are some threads, we do them before the
4414 ;; threads on the stack.
4415 (setq thread threads
4416 gnus-tmp-header (caar thread))
4417 ;; There were no current threads, so we pop something off
4419 (setq state (car stack)
4420 gnus-tmp-level (car state)
4421 tree-stack (cadr state)
4422 thread (caddr state)
4424 gnus-tmp-header (caar thread))))
4426 (setq gnus-tmp-false-parent nil)
4427 (setq gnus-tmp-root-expunged nil)
4428 (setq thread-end nil)
4430 (if (stringp gnus-tmp-header)
4431 ;; The header is a dummy root.
4433 ((eq gnus-summary-make-false-root 'adopt)
4434 ;; We let the first article adopt the rest.
4435 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4437 (setq gnus-tmp-gathered
4439 (lambda (h) (mail-header-number (car h)))
4442 (setq thread (cons (list (caar thread)
4445 (setq gnus-tmp-level -1
4446 gnus-tmp-false-parent t))
4447 ((eq gnus-summary-make-false-root 'empty)
4448 ;; We print adopted articles with empty subject fields.
4449 (setq gnus-tmp-gathered
4451 (lambda (h) (mail-header-number (car h)))
4454 (setq gnus-tmp-level -1))
4455 ((eq gnus-summary-make-false-root 'dummy)
4456 ;; We remember that we probably want to output a dummy
4458 (setq gnus-tmp-dummy-line gnus-tmp-header)
4459 (setq gnus-tmp-prev-subject gnus-tmp-header))
4461 ;; We do not make a root for the gathered
4462 ;; sub-threads at all.
4463 (setq gnus-tmp-level -1)))
4465 (setq number (mail-header-number gnus-tmp-header)
4466 subject (mail-header-subject gnus-tmp-header))
4469 ;; If the thread has changed subject, we might want to make
4470 ;; this subthread into a root.
4471 ((and (null gnus-thread-ignore-subject)
4472 (not (zerop gnus-tmp-level))
4473 gnus-tmp-prev-subject
4475 (gnus-subject-equal gnus-tmp-prev-subject subject))))
4476 (setq new-roots (nconc new-roots (list (car thread)))
4478 gnus-tmp-header nil))
4479 ;; If the article lies outside the current limit,
4480 ;; then we do not display it.
4481 ((not (memq number gnus-newsgroup-limit))
4482 (setq gnus-tmp-gathered
4484 (lambda (h) (mail-header-number (car h)))
4487 (setq gnus-tmp-new-adopts (if (cdar thread)
4488 (append gnus-tmp-new-adopts
4490 gnus-tmp-new-adopts)
4492 gnus-tmp-header nil)
4493 (when (zerop gnus-tmp-level)
4494 (setq gnus-tmp-root-expunged t)))
4495 ;; Perhaps this article is to be marked as read?
4496 ((and gnus-summary-mark-below
4497 (< (or (cdr (assq number gnus-newsgroup-scored))
4499 gnus-summary-mark-below)
4500 ;; Don't touch sparse articles.
4501 (not (gnus-summary-article-sparse-p number))
4502 (not (gnus-summary-article-ancient-p number)))
4503 (setq gnus-newsgroup-unreads
4504 (delq number gnus-newsgroup-unreads))
4505 (if gnus-newsgroup-auto-expire
4506 (setq gnus-newsgroup-expirable
4507 (gnus-add-to-sorted-list
4508 gnus-newsgroup-expirable number))
4509 (push (cons number gnus-low-score-mark)
4510 gnus-newsgroup-reads))))
4512 (when gnus-tmp-header
4513 ;; We may have an old dummy line to output before this
4515 (when (and gnus-tmp-dummy-line
4518 (mail-header-subject gnus-tmp-header)))
4519 (gnus-summary-insert-dummy-line
4520 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4521 (setq gnus-tmp-dummy-line nil))
4523 ;; Compute the mark.
4524 (setq gnus-tmp-unread (gnus-article-mark number))
4526 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4527 gnus-tmp-header gnus-tmp-level)
4528 gnus-newsgroup-data)
4530 ;; Actually insert the line.
4532 gnus-tmp-subject-or-nil
4534 ((and gnus-thread-ignore-subject
4535 gnus-tmp-prev-subject
4536 (not (inline (gnus-subject-equal
4537 gnus-tmp-prev-subject subject))))
4539 ((zerop gnus-tmp-level)
4540 (if (and (eq gnus-summary-make-false-root 'empty)
4541 (memq number gnus-tmp-gathered)
4542 gnus-tmp-prev-subject
4543 (inline (gnus-subject-equal
4544 gnus-tmp-prev-subject subject)))
4545 gnus-summary-same-subject
4547 (t gnus-summary-same-subject)))
4548 (if (and (eq gnus-summary-make-false-root 'adopt)
4549 (= gnus-tmp-level 1)
4550 (memq number gnus-tmp-gathered))
4551 (setq gnus-tmp-opening-bracket ?\<
4552 gnus-tmp-closing-bracket ?\>)
4553 (setq gnus-tmp-opening-bracket ?\[
4554 gnus-tmp-closing-bracket ?\]))
4556 gnus-tmp-indentation
4557 (aref gnus-thread-indent-array gnus-tmp-level)
4558 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4559 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4560 gnus-summary-default-score 0)
4562 (if (or (null gnus-summary-default-score)
4563 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4564 gnus-summary-zcore-fuzz))
4566 (if (< gnus-tmp-score gnus-summary-default-score)
4567 gnus-score-below-mark gnus-score-over-mark))
4569 (cond ((memq number gnus-newsgroup-processable)
4571 ((memq number gnus-newsgroup-cached)
4573 ((memq number gnus-newsgroup-replied)
4575 ((memq number gnus-newsgroup-forwarded)
4576 gnus-forwarded-mark)
4577 ((memq number gnus-newsgroup-saved)
4579 ((memq number gnus-newsgroup-recent)
4581 ((memq number gnus-newsgroup-unseen)
4584 gnus-tmp-from (mail-header-from gnus-tmp-header)
4587 ((string-match "<[^>]+> *$" gnus-tmp-from)
4588 (setq beg-match (match-beginning 0))
4589 (or (and (string-match "^\".+\"" gnus-tmp-from)
4590 (substring gnus-tmp-from 1 (1- (match-end 0))))
4591 (substring gnus-tmp-from 0 beg-match)))
4592 ((string-match "(.+)" gnus-tmp-from)
4593 (substring gnus-tmp-from
4594 (1+ (match-beginning 0)) (1- (match-end 0))))
4596 gnus-tmp-thread-tree-header-string
4598 ((not gnus-show-threads) "")
4599 ((zerop gnus-tmp-level)
4601 (or gnus-sum-thread-tree-root subject)
4602 (or gnus-sum-thread-tree-single-indent subject)))
4604 (concat (apply 'concat
4605 (mapcar (lambda (item)
4607 gnus-sum-thread-tree-vertical
4608 gnus-sum-thread-tree-indent))
4609 (cdr (reverse tree-stack))))
4611 gnus-sum-thread-tree-leaf-with-other
4612 gnus-sum-thread-tree-single-leaf)))))
4613 (when (string= gnus-tmp-name "")
4614 (setq gnus-tmp-name gnus-tmp-from))
4615 (unless (numberp gnus-tmp-lines)
4616 (setq gnus-tmp-lines -1))
4617 (if (= gnus-tmp-lines -1)
4618 (setq gnus-tmp-lines "?")
4619 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4620 (gnus-put-text-property
4622 (progn (eval gnus-summary-line-format-spec) (point))
4623 'gnus-number number)
4626 (gnus-run-hooks 'gnus-summary-update-hook)
4629 (setq gnus-tmp-prev-subject subject)))
4631 (when (nth 1 thread)
4632 (push (list (max 0 gnus-tmp-level)
4633 (copy-list tree-stack)
4636 (push (if (nth 1 thread) 1 0) tree-stack)
4637 (incf gnus-tmp-level)
4638 (setq threads (if thread-end nil (cdar thread)))
4640 (setq gnus-tmp-level 0)))))
4641 (gnus-message 7 "Generating summary...done"))
4643 (defun gnus-summary-prepare-unthreaded (headers)
4644 "Generate an unthreaded summary buffer based on HEADERS."
4645 (let (header number mark)
4650 ;; We may have to root out some bad articles...
4651 (when (memq (setq number (mail-header-number
4652 (setq header (pop headers))))
4653 gnus-newsgroup-limit)
4654 ;; Mark article as read when it has a low score.
4655 (when (and gnus-summary-mark-below
4656 (< (or (cdr (assq number gnus-newsgroup-scored))
4657 gnus-summary-default-score 0)
4658 gnus-summary-mark-below)
4659 (not (gnus-summary-article-ancient-p number)))
4660 (setq gnus-newsgroup-unreads
4661 (delq number gnus-newsgroup-unreads))
4662 (if gnus-newsgroup-auto-expire
4663 (push number gnus-newsgroup-expirable)
4664 (push (cons number gnus-low-score-mark)
4665 gnus-newsgroup-reads)))
4667 (setq mark (gnus-article-mark number))
4668 (push (gnus-data-make number mark (1+ (point)) header 0)
4669 gnus-newsgroup-data)
4670 (gnus-summary-insert-line
4672 mark (memq number gnus-newsgroup-replied)
4673 (memq number gnus-newsgroup-expirable)
4674 (mail-header-subject header) nil
4675 (cdr (assq number gnus-newsgroup-scored))
4676 (memq number gnus-newsgroup-processable))))))
4678 (defun gnus-summary-remove-list-identifiers ()
4679 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4680 (let ((regexp (if (consp gnus-list-identifiers)
4681 (mapconcat 'identity gnus-list-identifiers " *\\|")
4682 gnus-list-identifiers))
4685 (dolist (header gnus-newsgroup-headers)
4686 (setq subject (mail-header-subject header)
4688 (while (string-match
4689 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4692 (concat (substring subject 0 (match-beginning 2))
4693 (substring subject (match-end 0)))
4697 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4699 (concat (substring subject 0 (match-beginning 1))
4700 (substring subject (match-end 1)))))
4702 (mail-header-set-subject header subject))))))
4704 (defun gnus-fetch-headers (articles)
4705 "Fetch headers of ARTICLES."
4706 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4707 (gnus-message 5 "Fetching headers for %s..." name)
4710 (setq gnus-headers-retrieved-by
4711 (gnus-retrieve-headers
4712 articles gnus-newsgroup-name
4713 ;; We might want to fetch old headers, but
4714 ;; not if there is only 1 article.
4716 (not (eq gnus-fetch-old-headers 'some))
4717 (not (numberp gnus-fetch-old-headers)))
4718 (> (length articles) 1))
4719 gnus-fetch-old-headers))))
4720 (gnus-get-newsgroup-headers-xover
4721 articles nil nil gnus-newsgroup-name t)
4722 (gnus-get-newsgroup-headers))
4723 (gnus-message 5 "Fetching headers for %s...done" name))))
4725 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4726 "Select newsgroup GROUP.
4727 If READ-ALL is non-nil, all articles in the group are selected.
4728 If SELECT-ARTICLES, only select those articles from GROUP."
4729 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4730 ;;!!! Dirty hack; should be removed.
4731 (gnus-summary-ignore-duplicates
4732 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4734 gnus-summary-ignore-duplicates))
4735 (info (nth 2 entry))
4736 articles fetched-articles cached)
4738 (unless (gnus-check-server
4739 (set (make-local-variable 'gnus-current-select-method)
4740 (gnus-find-method-for-group group)))
4741 (error "Couldn't open server"))
4743 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4744 (gnus-activate-group group) ; Or we can activate it...
4745 (progn ; Or we bug out.
4746 (when (equal major-mode 'gnus-summary-mode)
4747 (kill-buffer (current-buffer)))
4748 (error "Couldn't activate group %s: %s"
4749 group (gnus-status-message group))))
4751 (unless (gnus-request-group group t)
4752 (when (equal major-mode 'gnus-summary-mode)
4753 (kill-buffer (current-buffer)))
4754 (error "Couldn't request group %s: %s"
4755 group (gnus-status-message group)))
4757 (setq gnus-newsgroup-name group
4758 gnus-newsgroup-unselected nil
4759 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4761 (let ((display (gnus-group-find-parameter group 'display)))
4762 (setq gnus-newsgroup-display
4764 ((not (zerop (or (car-safe read-all) 0)))
4765 ;; The user entered the group with C-u SPC/RET, let's show
4771 (gnus-summary-display-make-predicate (mapcar 'identity display)))
4773 ;; The following is probably the "correct" solution, but
4774 ;; it makes Gnus fetch all headers and then limit the
4775 ;; articles (which is slow), so instead we hack the
4776 ;; select-articles parameter instead. -- Simon Josefsson
4779 ;; (gnus-byte-compile
4780 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
4782 (setq select-articles
4783 (gnus-uncompress-range
4784 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
4788 (cdr (gnus-active group)))))
4793 (gnus-summary-setup-default-charset)
4795 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4796 (when (gnus-virtual-group-p group)
4797 (setq cached gnus-newsgroup-cached))
4799 (setq gnus-newsgroup-unreads
4800 (gnus-sorted-ndifference
4801 (gnus-sorted-ndifference gnus-newsgroup-unreads
4802 gnus-newsgroup-marked)
4803 gnus-newsgroup-dormant))
4805 (setq gnus-newsgroup-processable nil)
4807 (gnus-update-read-articles group gnus-newsgroup-unreads)
4809 ;; Adjust and set lists of article marks.
4811 (gnus-adjust-marked-articles info))
4813 (if (setq articles select-articles)
4814 (setq gnus-newsgroup-unselected
4815 (gnus-sorted-difference gnus-newsgroup-unreads articles))
4816 (setq articles (gnus-articles-to-read group read-all)))
4820 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4822 ((eq articles 0) nil)
4824 ;; Init the dependencies hash table.
4825 (setq gnus-newsgroup-dependencies
4826 (gnus-make-hashtable (length articles)))
4827 (gnus-set-global-variables)
4828 ;; Retrieve the headers and read them in.
4829 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
4831 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4833 (setq gnus-newsgroup-cached cached))
4835 ;; Suppress duplicates?
4836 (when gnus-suppress-duplicates
4837 (gnus-dup-suppress-articles))
4839 ;; Set the initial limit.
4840 (setq gnus-newsgroup-limit (copy-sequence articles))
4841 ;; Remove canceled articles from the list of unread articles.
4842 (setq fetched-articles
4843 (mapcar (lambda (headers) (mail-header-number headers))
4844 gnus-newsgroup-headers))
4845 (setq gnus-newsgroup-articles fetched-articles)
4846 (setq gnus-newsgroup-unreads
4847 (gnus-sorted-nintersection
4848 gnus-newsgroup-unreads fetched-articles))
4849 (gnus-compute-unseen-list)
4851 ;; Removed marked articles that do not exist.
4852 (gnus-update-missing-marks
4853 (gnus-sorted-difference articles fetched-articles))
4854 ;; We might want to build some more threads first.
4855 (when (and gnus-fetch-old-headers
4856 (eq gnus-headers-retrieved-by 'nov))
4857 (if (eq gnus-fetch-old-headers 'invisible)
4858 (gnus-build-all-threads)
4859 (gnus-build-old-threads)))
4860 ;; Let the Gnus agent mark articles as read.
4862 (gnus-agent-get-undownloaded-list))
4863 ;; Remove list identifiers from subject
4864 (when gnus-list-identifiers
4865 (gnus-summary-remove-list-identifiers))
4866 ;; Check whether auto-expire is to be done in this group.
4867 (setq gnus-newsgroup-auto-expire
4868 (gnus-group-auto-expirable-p group))
4869 ;; Set up the article buffer now, if necessary.
4870 (unless gnus-single-article-buffer
4871 (gnus-article-setup-buffer))
4872 ;; First and last article in this newsgroup.
4873 (when gnus-newsgroup-headers
4874 (setq gnus-newsgroup-begin
4875 (mail-header-number (car gnus-newsgroup-headers))
4878 (gnus-last-element gnus-newsgroup-headers))))
4879 ;; GROUP is successfully selected.
4880 (or gnus-newsgroup-headers t)))))
4882 (defun gnus-compute-unseen-list ()
4883 ;; The `seen' marks are treated specially.
4884 (if (not gnus-newsgroup-seen)
4885 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
4886 (setq gnus-newsgroup-unseen
4887 (gnus-inverse-list-range-intersection
4888 gnus-newsgroup-articles gnus-newsgroup-seen))))
4890 (defun gnus-summary-display-make-predicate (display)
4891 (require 'gnus-agent)
4892 (when (= (length display) 1)
4893 (setq display (car display)))
4894 (unless gnus-summary-display-cache
4895 (dolist (elem (append '((unread . unread)
4898 gnus-article-mark-lists))
4899 (push (cons (cdr elem)
4901 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
4902 gnus-summary-display-cache)))
4903 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
4904 (gnus-category-predicate-cache gnus-summary-display-cache))
4905 (gnus-get-predicate display)))
4907 ;; Uses the dynamically bound `number' variable.
4909 (defun gnus-article-marked-p (type &optional article)
4910 (let ((article (or article number)))
4913 (memq article gnus-newsgroup-marked))
4915 (memq article gnus-newsgroup-unsendable))
4916 ((eq type 'undownload)
4917 (memq article gnus-newsgroup-undownloaded))
4918 ((eq type 'download)
4919 (memq article gnus-newsgroup-downloadable))
4921 (memq article gnus-newsgroup-unreads))
4923 (memq article gnus-newsgroup-reads))
4925 (memq article gnus-newsgroup-dormant) )
4927 (memq article gnus-newsgroup-expirable))
4929 (memq article gnus-newsgroup-replied))
4931 (memq article gnus-newsgroup-killed))
4932 ((eq type 'bookmark)
4933 (assq article gnus-newsgroup-bookmarks))
4935 (assq article gnus-newsgroup-scored))
4937 (memq article gnus-newsgroup-saved))
4939 (memq article gnus-newsgroup-cached))
4941 (memq article gnus-newsgroup-forwarded))
4943 (not (memq article gnus-newsgroup-unseen)))
4945 (memq article gnus-newsgroup-recent))
4948 (defun gnus-articles-to-read (group &optional read-all)
4949 "Find out what articles the user wants to read."
4951 ;; Select all articles if `read-all' is non-nil, or if there
4952 ;; are no unread articles.
4954 (and (zerop (length gnus-newsgroup-marked))
4955 (zerop (length gnus-newsgroup-unreads)))
4956 ;; Fetch all if the predicate is non-nil.
4957 gnus-newsgroup-display)
4958 ;; We want to select the headers for all the articles in
4959 ;; the group, so we select either all the active
4960 ;; articles in the group, or (if that's nil), the
4961 ;; articles in the cache.
4963 (gnus-uncompress-range (gnus-active group))
4964 (gnus-cache-articles-in-group group))
4965 ;; Select only the "normal" subset of articles.
4967 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
4968 gnus-newsgroup-unreads)))
4969 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4970 (scored (length scored-list))
4971 (number (length articles))
4972 (marked (+ (length gnus-newsgroup-marked)
4973 (length gnus-newsgroup-dormant)))
4978 ((numberp gnus-newsgroup-display)
4979 gnus-newsgroup-display)
4983 ((and (or (<= scored marked) (= scored number))
4984 (numberp gnus-large-newsgroup)
4985 (> number gnus-large-newsgroup))
4986 (let* ((cursor-in-echo-area nil)
4987 (initial (gnus-parameter-large-newsgroup-initial
4988 gnus-newsgroup-name))
4992 "How many articles from %s (%s %d): "
4994 (gnus-group-decoded-name gnus-newsgroup-name)
4996 (if initial "max" "default")
4999 (cons (number-to-string initial)
5001 (if (string-match "^[ \t]*$" input) number input)))
5002 ((and (> scored marked) (< scored number)
5003 (> (- scored number) 20))
5006 (format "%s %s (%d scored, %d total): "
5007 "How many articles from"
5008 (gnus-group-decoded-name group)
5010 (if (string-match "^[ \t]*$" input)
5014 (message "Quit getting the articles to read")
5016 (setq select (if (stringp select) (string-to-number select) select))
5017 (if (or (null select) (zerop select))
5019 (if (and (not (zerop scored)) (<= (abs select) scored))
5021 (setq articles (sort scored-list '<))
5022 (setq number (length articles)))
5023 (setq articles (copy-sequence articles)))
5025 (when (< (abs select) number)
5027 ;; Select the N oldest articles.
5028 (setcdr (nthcdr (1- (abs select)) articles) nil)
5029 ;; Select the N most recent articles.
5030 (setq articles (nthcdr (- number select) articles))))
5031 (setq gnus-newsgroup-unselected
5032 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5033 (when gnus-alter-articles-to-read-function
5034 (setq gnus-newsgroup-unreads
5036 (funcall gnus-alter-articles-to-read-function
5037 gnus-newsgroup-name gnus-newsgroup-unreads)
5041 (defun gnus-killed-articles (killed articles)
5044 (when (inline (gnus-member-of-range (car articles) killed))
5045 (push (car articles) out))
5046 (setq articles (cdr articles)))
5049 (defun gnus-uncompress-marks (marks)
5050 "Uncompress the mark ranges in MARKS."
5051 (let ((uncompressed '(score bookmark))
5054 (if (memq (caar marks) uncompressed)
5055 (push (car marks) out)
5056 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5057 (setq marks (cdr marks)))
5060 (defun gnus-article-mark-to-type (mark)
5061 "Return the type of MARK."
5062 (or (cadr (assq mark gnus-article-special-mark-lists))
5065 (defun gnus-article-unpropagatable-p (mark)
5066 "Return whether MARK should be propagated to backend."
5067 (memq mark gnus-article-unpropagated-mark-lists))
5069 (defun gnus-adjust-marked-articles (info)
5070 "Set all article lists and remove all marks that are no longer valid."
5071 (let* ((marked-lists (gnus-info-marks info))
5072 (active (gnus-active (gnus-info-group info)))
5075 (types gnus-article-mark-lists)
5076 marks var articles article mark mark-type)
5078 (dolist (marks marked-lists)
5079 (setq mark (car marks)
5080 mark-type (gnus-article-mark-to-type mark)
5081 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5083 ;; We set the variable according to the type of the marks list,
5084 ;; and then adjust the marks to a subset of the active articles.
5086 ;; Adjust "simple" lists.
5087 ((eq mark-type 'list)
5088 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5089 (when (memq mark '(tick dormant expire reply save))
5091 (when (or (< (setq article (pop articles)) min) (> article max))
5092 (set var (delq article (symbol-value var)))))))
5094 ((eq mark-type 'tuple)
5095 (set var (setq articles (cdr marks)))
5096 (when (not (listp (cdr (symbol-value var))))
5097 (set var (list (symbol-value var))))
5098 (when (not (listp (cdr articles)))
5099 (setq articles (list articles)))
5101 (when (or (not (consp (setq article (pop articles))))
5102 (< (car article) min)
5103 (> (car article) max))
5104 (set var (delq article (symbol-value var))))))
5105 ;; Adjust ranges (sloppily).
5106 ((eq mark-type 'range)
5109 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5110 ;; It should be (seen (NUM1 . NUM2)).
5111 (when (numberp (cddr marks))
5112 (setcdr marks (list (cdr marks))))
5113 (setq articles (cdr marks))
5114 (while (and articles
5115 (or (and (consp (car articles))
5116 (> min (cdar articles)))
5117 (and (numberp (car articles))
5118 (> min (car articles)))))
5120 (set var articles))))))))
5122 (defun gnus-update-missing-marks (missing)
5123 "Go through the list of MISSING articles and remove them from the mark lists."
5126 ;; Go through all types.
5127 (dolist (elem gnus-article-mark-lists)
5128 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5129 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5130 (when (symbol-value var)
5131 ;; This list has articles. So we delete all missing
5132 ;; articles from it.
5135 (set var (delq (pop m) (symbol-value var))))))))))
5137 (defun gnus-update-marks ()
5138 "Enter the various lists of marked articles into the newsgroup info list."
5139 (let ((types gnus-article-mark-lists)
5140 (info (gnus-get-info gnus-newsgroup-name))
5141 type list newmarked symbol delta-marks)
5143 ;; Add all marks lists to the list of marks lists.
5144 (while (setq type (pop types))
5145 (setq list (symbol-value
5147 (intern (format "gnus-newsgroup-%s" (car type))))))
5150 ;; Get rid of the entries of the articles that have the
5152 (when (and (eq (cdr type) 'score)
5156 (prev (cons nil list))
5159 (if (or (not (consp (car arts)))
5160 (= (cdar arts) gnus-summary-default-score))
5161 (setcdr prev (cdr arts))
5163 (setq arts (cdr arts)))
5164 (setq list (cdr all)))))
5166 (when (eq (cdr type) 'seen)
5167 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5169 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5170 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5172 (when (and (gnus-check-backend-function
5173 'request-set-mark gnus-newsgroup-name)
5174 (not (gnus-article-unpropagatable-p (cdr type))))
5175 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5176 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5177 (add (gnus-remove-from-range
5178 (gnus-copy-sequence list) old)))
5180 (push (list add 'add (list (cdr type))) delta-marks))
5182 (push (list del 'del (list (cdr type))) delta-marks))))
5185 (push (cons (cdr type) list) newmarked)))
5188 (unless (gnus-check-group gnus-newsgroup-name)
5189 (error "Can't open server for %s" gnus-newsgroup-name))
5190 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5192 ;; Enter these new marks into the info of the group.
5194 (setcar (nthcdr 3 info) newmarked)
5195 ;; Add the marks lists to the end of the info.
5197 (setcdr (nthcdr 2 info) (list newmarked))))
5199 ;; Cut off the end of the info if there's nothing else there.
5203 (when (nthcdr (decf i) info)
5204 (setcdr (nthcdr i info) nil)))))))
5206 (defun gnus-set-mode-line (where)
5207 "Set the mode line of the article or summary buffers.
5208 If WHERE is `summary', the summary mode line format will be used."
5209 ;; Is this mode line one we keep updated?
5210 (when (and (memq where gnus-updated-mode-lines)
5212 (intern (format "gnus-%s-mode-line-format-spec" where))))
5215 ;; We evaluate this in the summary buffer since these
5216 ;; variables are buffer-local to that buffer.
5217 (set-buffer gnus-summary-buffer)
5218 ;; We bind all these variables that are used in the `eval' form
5220 (let* ((mformat (symbol-value
5222 (format "gnus-%s-mode-line-format-spec" where))))
5223 (gnus-tmp-group-name (gnus-group-decoded-name
5224 gnus-newsgroup-name))
5225 (gnus-tmp-article-number (or gnus-current-article 0))
5226 (gnus-tmp-unread gnus-newsgroup-unreads)
5227 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5228 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5229 (gnus-tmp-unread-and-unselected
5230 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5231 (zerop gnus-tmp-unselected))
5233 ((zerop gnus-tmp-unselected)
5234 (format "{%d more}" gnus-tmp-unread-and-unticked))
5235 (t (format "{%d(+%d) more}"
5236 gnus-tmp-unread-and-unticked
5237 gnus-tmp-unselected))))
5239 (if (and gnus-current-headers
5240 (vectorp gnus-current-headers))
5241 (gnus-mode-string-quote
5242 (mail-header-subject gnus-current-headers))
5244 bufname-length max-len
5245 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5246 (setq mode-string (eval mformat))
5247 (setq bufname-length (if (string-match "%b" mode-string)
5250 (if (eq where 'summary)
5252 (get-buffer gnus-article-buffer))))
5255 (setq max-len (max 4 (if gnus-mode-non-string-length
5257 gnus-mode-non-string-length
5259 (length mode-string))))
5260 ;; We might have to chop a bit of the string off...
5261 (when (> (length mode-string) max-len)
5263 (concat (truncate-string-to-width mode-string (- max-len 3))
5265 ;; Pad the mode string a bit.
5266 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5267 ;; Update the mode line.
5268 (setq mode-line-buffer-identification
5269 (gnus-mode-line-buffer-identification (list mode-string)))
5270 (set-buffer-modified-p t))))
5272 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5273 "Go through the HEADERS list and add all Xrefs to a hash table.
5274 The resulting hash table is returned, or nil if no Xrefs were found."
5275 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5276 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5277 (xref-hashtb (gnus-make-hashtable))
5278 start group entry number xrefs header)
5280 (setq header (pop headers))
5281 (when (and (setq xrefs (mail-header-xref header))
5282 (not (memq (setq number (mail-header-number header))
5285 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5286 (setq start (match-end 0))
5287 (setq group (if prefix
5288 (concat prefix (substring xrefs (match-beginning 1)
5290 (substring xrefs (match-beginning 1) (match-end 1))))
5292 (string-to-int (substring xrefs (match-beginning 2)
5294 (if (setq entry (gnus-gethash group xref-hashtb))
5295 (setcdr entry (cons number (cdr entry)))
5296 (gnus-sethash group (cons number nil) xref-hashtb)))))
5297 (and start xref-hashtb)))
5299 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5300 "Look through all the headers and mark the Xrefs as read."
5301 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5302 name entry info xref-hashtb idlist method nth4)
5304 (set-buffer gnus-group-buffer)
5305 (when (setq xref-hashtb
5306 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5309 (unless (string= from-newsgroup (setq name (symbol-name group)))
5310 (setq idlist (symbol-value group))
5311 ;; Dead groups are not updated.
5313 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5315 (when (stringp (setq nth4 (gnus-info-method info)))
5316 (setq nth4 (gnus-server-to-method nth4))))
5317 ;; Only do the xrefs if the group has the same
5318 ;; select method as the group we have just read.
5319 (or (gnus-methods-equal-p
5320 nth4 (gnus-find-method-for-group from-newsgroup))
5322 (equal nth4 (setq method (gnus-find-method-for-group
5324 (and (equal (car nth4) (car method))
5325 (equal (nth 1 nth4) (nth 1 method))))
5326 gnus-use-cross-reference
5327 (or (not (eq gnus-use-cross-reference t))
5329 ;; Only do cross-references on subscribed
5330 ;; groups, if that is what is wanted.
5331 (<= (gnus-info-level info) gnus-level-subscribed))
5332 (gnus-group-make-articles-read name idlist))))
5335 (defun gnus-compute-read-articles (group articles)
5336 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5337 (info (nth 2 entry))
5338 (active (gnus-active group))
5341 ;; First peel off all invalid article numbers.
5343 (let ((ids articles)
5345 (while (setq id (pop ids))
5346 (when (and first (> id (cdr active)))
5347 ;; We'll end up in this situation in one particular
5348 ;; obscure situation. If you re-scan a group and get
5349 ;; a new article that is cross-posted to a different
5350 ;; group that has not been re-scanned, you might get
5351 ;; crossposted article that has a higher number than
5352 ;; Gnus believes possible. So we re-activate this
5353 ;; group as well. This might mean doing the
5354 ;; crossposting thingy will *increase* the number
5355 ;; of articles in some groups. Tsk, tsk.
5356 (setq active (or (gnus-activate-group group) active)))
5357 (when (or (> id (cdr active))
5358 (< id (car active)))
5359 (setq articles (delq id articles))))))
5360 ;; If the read list is nil, we init it.
5362 (null (gnus-info-read info))
5364 (setq ninfo (cons 1 (1- (car active))))
5365 (setq ninfo (gnus-info-read info)))
5366 ;; Then we add the read articles to the range.
5368 ninfo (setq articles (sort articles '<))))))
5370 (defun gnus-group-make-articles-read (group articles)
5371 "Update the info of GROUP to say that ARTICLES are read."
5373 (entry (gnus-gethash group gnus-newsrc-hashtb))
5374 (info (nth 2 entry))
5375 (active (gnus-active group))
5378 (setq range (gnus-compute-read-articles group articles))
5380 (set-buffer gnus-group-buffer)
5383 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5384 (gnus-info-set-read ',info ',(gnus-info-read info))
5385 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5386 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5387 (gnus-group-update-group ,group t))))
5388 ;; Add the read articles to the range.
5389 (gnus-info-set-read info range)
5390 (gnus-request-set-mark group (list (list range 'add '(read))))
5391 ;; Then we have to re-compute how many unread
5392 ;; articles there are in this group.
5396 (setq num (- (1+ (cdr active)) (car active))))
5397 ((not (listp (cdr range)))
5398 (setq num (- (cdr active) (- (1+ (cdr range))
5402 (if (numberp (car range))
5404 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5405 (setq range (cdr range)))
5406 (setq num (- (cdr active) num))))
5407 ;; Update the number of unread articles.
5409 ;; Update the group buffer.
5410 (gnus-group-update-group group t)))))
5412 (defvar gnus-newsgroup-none-id 0)
5414 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5415 (let ((cur nntp-server-buffer)
5418 (save-excursion (set-buffer gnus-summary-buffer)
5419 gnus-newsgroup-dependencies)))
5421 (mail-parse-charset gnus-newsgroup-charset)
5422 (mail-parse-ignored-charsets
5423 (save-excursion (condition-case nil
5424 (set-buffer gnus-summary-buffer)
5426 gnus-newsgroup-ignored-charsets)))
5428 (set-buffer nntp-server-buffer)
5429 ;; Translate all TAB characters into SPACE characters.
5430 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5431 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5432 (gnus-run-hooks 'gnus-parse-headers-hook)
5433 (let ((case-fold-search t)
5434 in-reply-to header p lines chars)
5435 (goto-char (point-min))
5436 ;; Search to the beginning of the next header. Error messages
5437 ;; do not begin with 2 or 3.
5438 (while (re-search-forward "^[23][0-9]+ " nil t)
5441 ;; This implementation of this function, with nine
5442 ;; search-forwards instead of the one re-search-forward and
5443 ;; a case (which basically was the old function) is actually
5444 ;; about twice as fast, even though it looks messier. You
5445 ;; can't have everything, I guess. Speed and elegance
5446 ;; doesn't always go hand in hand.
5455 (narrow-to-region (point)
5456 (or (and (search-forward "\n.\n" nil t)
5462 (if (search-forward "\nsubject:" nil t)
5463 (funcall gnus-decode-encoded-word-function
5464 (nnheader-header-value))
5469 (if (search-forward "\nfrom:" nil t)
5470 (funcall gnus-decode-encoded-word-function
5471 (nnheader-header-value))
5476 (if (search-forward "\ndate:" nil t)
5477 (nnheader-header-value) ""))
5481 (setq id (if (re-search-forward
5482 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5483 ;; We do it this way to make sure the Message-ID
5484 ;; is (somewhat) syntactically valid.
5485 (buffer-substring (match-beginning 1)
5487 ;; If there was no message-id, we just fake one
5488 ;; to make subsequent routines simpler.
5489 (nnheader-generate-fake-message-id))))
5493 (if (search-forward "\nreferences:" nil t)
5497 (nnheader-header-value)
5502 (search-backward ">" end t)
5505 (search-backward "<" end t)
5507 ;; Get the references from the in-reply-to header if there
5508 ;; were no references and the in-reply-to header looks
5510 (if (and (search-forward "\nin-reply-to:" nil t)
5511 (setq in-reply-to (nnheader-header-value))
5512 (string-match "<[^>]+>" in-reply-to))
5514 (setq ref (substring in-reply-to (match-beginning 0)
5516 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5517 (setq ref2 (substring in-reply-to (match-beginning 0)
5519 (when (> (length ref2) (length ref))
5526 (if (search-forward "\nchars: " nil t)
5527 (if (numberp (setq chars (ignore-errors (read cur))))
5533 (if (search-forward "\nlines: " nil t)
5534 (if (numberp (setq lines (ignore-errors (read cur))))
5540 (and (search-forward "\nxref:" nil t)
5541 (nnheader-header-value)))
5543 (when gnus-extra-headers
5544 (let ((extra gnus-extra-headers)
5548 (when (search-forward
5549 (concat "\n" (symbol-name (car extra)) ":") nil t)
5550 (push (cons (car extra) (nnheader-header-value))
5554 (when (equal id ref)
5557 (when gnus-alter-header-function
5558 (funcall gnus-alter-header-function header)
5559 (setq id (mail-header-id header)
5560 ref (gnus-parent-id (mail-header-references header))))
5563 (gnus-dependencies-add-header
5564 header dependencies force-new))
5565 (push header headers))
5566 (goto-char (point-max))
5568 (nreverse headers)))))
5570 ;; Goes through the xover lines and returns a list of vectors
5571 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5572 force-new dependencies
5573 group also-fetch-heads)
5574 "Parse the news overview data in the server buffer.
5575 Return a list of headers that match SEQUENCE (see
5576 `nntp-retrieve-headers')."
5577 ;; Get the Xref when the users reads the articles since most/some
5578 ;; NNTP servers do not include Xrefs when using XOVER.
5579 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5580 (let ((mail-parse-charset gnus-newsgroup-charset)
5581 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5582 (cur nntp-server-buffer)
5583 (dependencies (or dependencies gnus-newsgroup-dependencies))
5585 ((eq gnus-read-all-available-headers t)
5587 ((stringp gnus-read-all-available-headers)
5588 (string-match gnus-read-all-available-headers group))
5591 number headers header)
5593 (set-buffer nntp-server-buffer)
5594 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5595 ;; Allow the user to mangle the headers before parsing them.
5596 (gnus-run-hooks 'gnus-parse-headers-hook)
5597 (goto-char (point-min))
5598 (gnus-parse-without-error
5599 (while (and (or sequence allp)
5601 (setq number (read cur))
5603 (while (and sequence
5604 (< (car sequence) number))
5605 (setq sequence (cdr sequence))))
5608 (eq number (car sequence))))
5610 (setq sequence (cdr sequence))
5611 (setq header (inline
5612 (gnus-nov-parse-line
5613 number dependencies force-new)))))
5614 (push header headers))
5616 ;; A common bug in inn is that if you have posted an article and
5617 ;; then retrieves the active file, it will answer correctly --
5618 ;; the new article is included. However, a NOV entry for the
5619 ;; article may not have been generated yet, so this may fail.
5620 ;; We work around this problem by retrieving the last few
5621 ;; headers using HEAD.
5622 (if (or (not also-fetch-heads)
5624 ;; We (probably) got all the headers.
5626 (let ((gnus-nov-is-evil t))
5629 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5630 (gnus-get-newsgroup-headers))))))))
5632 (defun gnus-article-get-xrefs ()
5633 "Fill in the Xref value in `gnus-current-headers', if necessary.
5634 This is meant to be called in `gnus-article-internal-prepare-hook'."
5635 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5636 gnus-current-headers)))
5637 (or (not gnus-use-cross-reference)
5639 (and (mail-header-xref headers)
5640 (not (string= (mail-header-xref headers) "")))
5641 (let ((case-fold-search t)
5644 (nnheader-narrow-to-headers)
5645 (goto-char (point-min))
5646 (when (or (and (not (eobp))
5647 (eq (downcase (char-after)) ?x)
5648 (looking-at "Xref:"))
5649 (search-forward "\nXref:" nil t))
5650 (goto-char (1+ (match-end 0)))
5651 (setq xref (buffer-substring (point)
5652 (progn (end-of-line) (point))))
5653 (mail-header-set-xref headers xref)))))))
5655 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5656 "Find article ID and insert the summary line for that article.
5657 OLD-HEADER can either be a header or a line number to insert
5658 the subject line on."
5659 (let* ((line (and (numberp old-header) old-header))
5660 (old-header (and (vectorp old-header) old-header))
5661 (header (cond ((and old-header use-old-header)
5664 (gnus-number-to-header id))
5665 (gnus-number-to-header id))
5667 (gnus-read-header id))))
5668 (number (and (numberp id) id))
5671 ;; Rebuild the thread that this article is part of and go to the
5672 ;; article we have fetched.
5673 (when (and (not gnus-show-threads)
5676 (setq d (gnus-data-find (mail-header-number old-header))))
5677 (goto-char (gnus-data-pos d))
5680 (- (gnus-point-at-bol)
5682 (1+ (gnus-point-at-eol))
5683 (gnus-delete-line))))))
5685 (mail-header-set-number header (mail-header-number old-header)))
5686 (setq gnus-newsgroup-sparse
5687 (delq (setq number (mail-header-number header))
5688 gnus-newsgroup-sparse))
5689 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5690 (push number gnus-newsgroup-limit)
5691 (gnus-rebuild-thread (mail-header-id header) line)
5692 (gnus-summary-goto-subject number nil t))
5693 (when (and (numberp number)
5695 ;; We have to update the boundaries even if we can't fetch the
5696 ;; article if ID is a number -- so that the next `P' or `N'
5697 ;; command will fetch the previous (or next) article even
5698 ;; if the one we tried to fetch this time has been canceled.
5699 (when (> number gnus-newsgroup-end)
5700 (setq gnus-newsgroup-end number))
5701 (when (< number gnus-newsgroup-begin)
5702 (setq gnus-newsgroup-begin number))
5703 (setq gnus-newsgroup-unselected
5704 (delq number gnus-newsgroup-unselected)))
5705 ;; Report back a success?
5706 (and header (mail-header-number header))))
5708 ;;; Process/prefix in the summary buffer
5710 (defun gnus-summary-work-articles (n)
5711 "Return a list of articles to be worked upon.
5712 The prefix argument, the list of process marked articles, and the
5713 current article will be taken into consideration."
5715 (set-buffer gnus-summary-buffer)
5718 ;; A numerical prefix has been given.
5719 (setq n (prefix-numeric-value n))
5720 (let ((backward (< n 0))
5721 (n (abs (prefix-numeric-value n)))
5726 (push (setq article (gnus-summary-article-number))
5729 (gnus-summary-find-prev nil article)
5730 (gnus-summary-find-next nil article)))
5732 (nreverse articles)))
5733 ((and (gnus-region-active-p) (mark))
5734 (message "region active")
5735 ;; Work on the region between point and mark.
5736 (let ((max (max (point) (mark)))
5739 (goto-char (min (min (point) (mark))))
5742 (push (setq article (gnus-summary-article-number)) articles)
5743 (gnus-summary-find-next nil article)
5745 (nreverse articles))))
5746 (gnus-newsgroup-processable
5747 ;; There are process-marked articles present.
5748 ;; Save current state.
5749 (gnus-summary-save-process-mark)
5751 (reverse gnus-newsgroup-processable))
5753 ;; Just return the current article.
5754 (list (gnus-summary-article-number))))))
5756 (defmacro gnus-summary-iterate (arg &rest forms)
5757 "Iterate over the process/prefixed articles and do FORMS.
5758 ARG is the interactive prefix given to the command. FORMS will be
5759 executed with point over the summary line of the articles."
5760 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5761 `(let ((,articles (gnus-summary-work-articles ,arg)))
5763 (gnus-summary-goto-subject (car ,articles))
5767 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5768 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5770 (defun gnus-summary-save-process-mark ()
5771 "Push the current set of process marked articles on the stack."
5773 (push (copy-sequence gnus-newsgroup-processable)
5774 gnus-newsgroup-process-stack))
5776 (defun gnus-summary-kill-process-mark ()
5777 "Push the current set of process marked articles on the stack and unmark."
5779 (gnus-summary-save-process-mark)
5780 (gnus-summary-unmark-all-processable))
5782 (defun gnus-summary-yank-process-mark ()
5783 "Pop the last process mark state off the stack and restore it."
5785 (unless gnus-newsgroup-process-stack
5786 (error "Empty mark stack"))
5787 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5789 (defun gnus-summary-process-mark-set (set)
5790 "Make SET into the current process marked articles."
5791 (gnus-summary-unmark-all-processable)
5793 (gnus-summary-set-process-mark (pop set))))
5795 ;;; Searching and stuff
5797 (defun gnus-summary-search-group (&optional backward use-level)
5798 "Search for next unread newsgroup.
5799 If optional argument BACKWARD is non-nil, search backward instead."
5801 (set-buffer gnus-group-buffer)
5802 (when (gnus-group-search-forward
5803 backward nil (if use-level (gnus-group-group-level) nil))
5804 (gnus-group-group-name))))
5806 (defun gnus-summary-best-group (&optional exclude-group)
5807 "Find the name of the best unread group.
5808 If EXCLUDE-GROUP, do not go to this group."
5810 (set-buffer gnus-group-buffer)
5812 (gnus-group-best-unread-group exclude-group))))
5814 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5815 (if backward (gnus-summary-find-prev)
5816 (let* ((dummy (gnus-summary-article-intangible-p))
5817 (article (or article (gnus-summary-article-number)))
5818 (arts (gnus-data-find-list article))
5820 (when (and (not dummy)
5821 (or (not gnus-summary-check-current)
5823 (not (gnus-data-unread-p (car arts)))))
5824 (setq arts (cdr arts)))
5829 (when (or (and undownloaded
5830 (eq gnus-undownloaded-mark
5831 (gnus-data-mark (car arts))))
5832 (gnus-data-unread-p (car arts)))
5833 (setq result (car arts)
5835 (setq arts (cdr arts)))
5838 (goto-char (gnus-data-pos result))
5839 (gnus-data-number result)))))
5841 (defun gnus-summary-find-prev (&optional unread article)
5842 (let* ((eobp (eobp))
5843 (article (or article (gnus-summary-article-number)))
5844 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5846 (when (and (not eobp)
5847 (or (not gnus-summary-check-current)
5849 (not (gnus-data-unread-p (car arts)))))
5850 (setq arts (cdr arts)))
5855 (when (gnus-data-unread-p (car arts))
5856 (setq result (car arts)
5858 (setq arts (cdr arts)))
5861 (goto-char (gnus-data-pos result))
5862 (gnus-data-number result))))
5864 (defun gnus-summary-find-subject (subject &optional unread backward article)
5865 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5866 (article (or article (gnus-summary-article-number)))
5867 (articles (gnus-data-list backward))
5868 (arts (gnus-data-find-list article articles))
5870 (when (or (not gnus-summary-check-current)
5872 (not (gnus-data-unread-p (car arts))))
5873 (setq arts (cdr arts)))
5875 (and (or (not unread)
5876 (gnus-data-unread-p (car arts)))
5877 (vectorp (gnus-data-header (car arts)))
5879 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5880 (setq result (car arts)
5882 (setq arts (cdr arts)))
5884 (goto-char (gnus-data-pos result))
5885 (gnus-data-number result))))
5887 (defun gnus-summary-search-forward (&optional unread subject backward)
5888 "Search forward for an article.
5889 If UNREAD, look for unread articles. If SUBJECT, look for
5890 articles with that subject. If BACKWARD, search backward instead."
5891 (cond (subject (gnus-summary-find-subject subject unread backward))
5892 (backward (gnus-summary-find-prev unread))
5893 (t (gnus-summary-find-next unread))))
5895 (defun gnus-recenter (&optional n)
5896 "Center point in window and redisplay frame.
5897 Also do horizontal recentering."
5899 (when (and gnus-auto-center-summary
5900 (not (eq gnus-auto-center-summary 'vertical)))
5901 (gnus-horizontal-recenter))
5904 (defun gnus-summary-recenter ()
5905 "Center point in the summary window.
5906 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5907 displayed, no centering will be performed."
5908 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5909 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5911 (let* ((top (cond ((< (window-height) 4) 0)
5912 ((< (window-height) 7) 1)
5913 (t (if (numberp gnus-auto-center-summary)
5914 gnus-auto-center-summary
5916 (height (1- (window-height)))
5917 (bottom (save-excursion (goto-char (point-max))
5918 (forward-line (- height))
5920 (window (get-buffer-window (current-buffer))))
5921 ;; The user has to want it.
5922 (when gnus-auto-center-summary
5923 (when (get-buffer-window gnus-article-buffer)
5924 ;; Only do recentering when the article buffer is displayed,
5925 ;; Set the window start to either `bottom', which is the biggest
5926 ;; possible valid number, or the second line from the top,
5927 ;; whichever is the least.
5928 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
5929 (if (> bottom top-pos)
5930 ;; Keep the second line from the top visible
5931 (set-window-start window top-pos t)
5932 ;; Try to keep the bottom line visible; if it's partially
5933 ;; obscured, either scroll one more line to make it fully
5934 ;; visible, or revert to using TOP-POS.
5936 (goto-char (point-max))
5938 (let ((last-line-start (point)))
5940 (set-window-start window (point) t)
5941 (when (not (pos-visible-in-window-p last-line-start window))
5943 (set-window-start window (min (point) top-pos) t)))))))
5944 ;; Do horizontal recentering while we're at it.
5945 (when (and (get-buffer-window (current-buffer) t)
5946 (not (eq gnus-auto-center-summary 'vertical)))
5947 (let ((selected (selected-window)))
5948 (select-window (get-buffer-window (current-buffer) t))
5949 (gnus-summary-position-point)
5950 (gnus-horizontal-recenter)
5951 (select-window selected))))))
5953 (defun gnus-summary-jump-to-group (newsgroup)
5954 "Move point to NEWSGROUP in group mode buffer."
5955 ;; Keep update point of group mode buffer if visible.
5956 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5957 (save-window-excursion
5958 ;; Take care of tree window mode.
5959 (when (get-buffer-window gnus-group-buffer)
5960 (pop-to-buffer gnus-group-buffer))
5961 (gnus-group-jump-to-group newsgroup))
5963 ;; Take care of tree window mode.
5964 (if (get-buffer-window gnus-group-buffer)
5965 (pop-to-buffer gnus-group-buffer)
5966 (set-buffer gnus-group-buffer))
5967 (gnus-group-jump-to-group newsgroup))))
5969 ;; This function returns a list of article numbers based on the
5970 ;; difference between the ranges of read articles in this group and
5971 ;; the range of active articles.
5972 (defun gnus-list-of-unread-articles (group)
5973 (let* ((read (gnus-info-read (gnus-get-info group)))
5974 (active (or (gnus-active group) (gnus-activate-group group)))
5977 ;; If none are read, then all are unread.
5979 (setq first (car active))
5980 ;; If the range of read articles is a single range, then the
5981 ;; first unread article is the article after the last read
5982 ;; article. Sounds logical, doesn't it?
5983 (if (and (not (listp (cdr read)))
5984 (or (< (car read) (car active))
5985 (progn (setq read (list read))
5987 (setq first (max (car active) (1+ (cdr read))))
5988 ;; `read' is a list of ranges.
5989 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5992 (setq first (car active)))
5995 (while (< first nlast)
5997 (setq first (1+ first))))
5998 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5999 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6000 (setq read (cdr read)))))
6001 ;; And add the last unread articles.
6002 (while (<= first last)
6004 (setq first (1+ first)))
6005 ;; Return the list of unread articles.
6006 (delq 0 (nreverse unread))))
6008 (defun gnus-list-of-read-articles (group)
6009 "Return a list of unread, unticked and non-dormant articles."
6010 (let* ((info (gnus-get-info group))
6011 (marked (gnus-info-marks info))
6012 (active (gnus-active group)))
6014 (gnus-list-range-difference
6015 (gnus-list-range-difference
6016 (gnus-sorted-complement
6017 (gnus-uncompress-range active)
6018 (gnus-list-of-unread-articles group))
6019 (cdr (assq 'dormant marked)))
6020 (cdr (assq 'tick marked))))))
6022 ;; Various summary commands
6024 (defun gnus-summary-select-article-buffer ()
6025 "Reconfigure windows to show article buffer."
6027 (if (not (gnus-buffer-live-p gnus-article-buffer))
6028 (error "There is no article buffer for this summary buffer")
6029 (gnus-configure-windows 'article)
6030 (select-window (get-buffer-window gnus-article-buffer))))
6032 (defun gnus-summary-universal-argument (arg)
6033 "Perform any operation on all articles that are process/prefixed."
6035 (let ((articles (gnus-summary-work-articles arg))
6042 (substitute-command-keys
6043 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6045 (gnus-error 1 "Undefined key")
6048 (gnus-summary-goto-subject (setq article (pop articles)))
6049 (let (gnus-newsgroup-processable)
6050 (command-execute func))
6051 (gnus-summary-remove-process-mark article)))))
6052 (gnus-summary-position-point))
6054 (defun gnus-summary-toggle-truncation (&optional arg)
6055 "Toggle truncation of summary lines.
6056 With arg, turn line truncation on iff arg is positive."
6058 (setq truncate-lines
6059 (if (null arg) (not truncate-lines)
6060 (> (prefix-numeric-value arg) 0)))
6063 (defun gnus-summary-reselect-current-group (&optional all rescan)
6064 "Exit and then reselect the current newsgroup.
6065 The prefix argument ALL means to select all articles."
6067 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6068 (error "Ephemeral groups can't be reselected"))
6069 (let ((current-subject (gnus-summary-article-number))
6070 (group gnus-newsgroup-name))
6071 (setq gnus-newsgroup-begin nil)
6073 ;; We have to adjust the point of group mode buffer because
6074 ;; point was moved to the next unread newsgroup by exiting.
6075 (gnus-summary-jump-to-group group)
6078 (gnus-group-get-new-news-this-group 1)))
6079 (gnus-group-read-group all t)
6080 (gnus-summary-goto-subject current-subject nil t)))
6082 (defun gnus-summary-rescan-group (&optional all)
6083 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6085 (gnus-summary-reselect-current-group all t))
6087 (defun gnus-summary-update-info (&optional non-destructive)
6089 (let ((group gnus-newsgroup-name))
6091 (when gnus-newsgroup-kill-headers
6092 (setq gnus-newsgroup-killed
6093 (gnus-compress-sequence
6095 (gnus-list-range-intersection
6096 gnus-newsgroup-unselected gnus-newsgroup-killed)
6097 gnus-newsgroup-unreads)
6099 (unless (listp (cdr gnus-newsgroup-killed))
6100 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6101 (let ((headers gnus-newsgroup-headers))
6102 ;; Set the new ranges of read articles.
6104 (set-buffer gnus-group-buffer)
6105 (gnus-undo-force-boundary))
6106 (gnus-update-read-articles
6107 group (gnus-sorted-union
6108 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6109 ;; Set the current article marks.
6110 (let ((gnus-newsgroup-scored
6111 (if (and (not gnus-save-score)
6112 (not non-destructive))
6114 gnus-newsgroup-scored)))
6116 (gnus-update-marks)))
6117 ;; Do the cross-ref thing.
6118 (when gnus-use-cross-reference
6119 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6120 ;; Do not switch windows but change the buffer to work.
6121 (set-buffer gnus-group-buffer)
6122 (unless (gnus-ephemeral-group-p group)
6123 (gnus-group-update-group group)))))))
6125 (defun gnus-summary-save-newsrc (&optional force)
6126 "Save the current number of read/marked articles in the dribble buffer.
6127 The dribble buffer will then be saved.
6128 If FORCE (the prefix), also save the .newsrc file(s)."
6130 (gnus-summary-update-info t)
6132 (gnus-save-newsrc-file)
6133 (gnus-dribble-save)))
6135 (defun gnus-summary-exit (&optional temporary)
6136 "Exit reading current newsgroup, and then return to group selection mode.
6137 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6139 (gnus-set-global-variables)
6140 (when (gnus-buffer-live-p gnus-article-buffer)
6142 (set-buffer gnus-article-buffer)
6143 (mm-destroy-parts gnus-article-mime-handles)
6144 ;; Set it to nil for safety reason.
6145 (setq gnus-article-mime-handle-alist nil)
6146 (setq gnus-article-mime-handles nil)))
6147 (gnus-kill-save-kill-buffer)
6148 (gnus-async-halt-prefetch)
6149 (let* ((group gnus-newsgroup-name)
6150 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6153 (buf (current-buffer)))
6155 ;; Do adaptive scoring, and possibly save score files.
6156 (when gnus-newsgroup-adaptive
6157 (gnus-score-adaptive))
6158 (when gnus-use-scoring
6160 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6161 ;; If we have several article buffers, we kill them at exit.
6162 (unless gnus-single-article-buffer
6163 (gnus-kill-buffer gnus-original-article-buffer)
6164 (setq gnus-article-current nil))
6165 (when gnus-use-cache
6166 (gnus-cache-possibly-remove-articles)
6167 (gnus-cache-save-buffers))
6168 (gnus-async-prefetch-remove-group group)
6169 (when gnus-suppress-duplicates
6170 (gnus-dup-enter-articles))
6171 (when gnus-use-trees
6172 (gnus-tree-close group))
6173 (when gnus-use-cache
6174 (gnus-cache-write-active))
6175 ;; Remove entries for this group.
6176 (nnmail-purge-split-history (gnus-group-real-name group))
6177 ;; Make all changes in this group permanent.
6179 (gnus-run-hooks 'gnus-exit-group-hook)
6180 (gnus-summary-update-info))
6181 (gnus-close-group group)
6182 ;; Make sure where we were, and go to next newsgroup.
6183 (set-buffer gnus-group-buffer)
6185 (gnus-group-jump-to-group group))
6186 (gnus-run-hooks 'gnus-summary-exit-hook)
6187 (unless (or quit-config
6188 ;; If this group has disappeared from the summary
6189 ;; buffer, don't skip forwards.
6190 (not (string= group (gnus-group-group-name))))
6191 (gnus-group-next-unread-group 1))
6192 (setq group-point (point))
6195 ;; If we have several article buffers, we kill them at exit.
6196 (unless gnus-single-article-buffer
6197 (gnus-kill-buffer gnus-article-buffer)
6198 (gnus-kill-buffer gnus-original-article-buffer)
6199 (setq gnus-article-current nil))
6201 (if (not gnus-kill-summary-on-exit)
6203 (gnus-deaden-summary)
6205 ;; We set all buffer-local variables to nil. It is unclear why
6206 ;; this is needed, but if we don't, buffer-local variables are
6207 ;; not garbage-collected, it seems. This would the lead to en
6208 ;; ever-growing Emacs.
6209 (gnus-summary-clear-local-variables)
6210 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6211 (gnus-summary-clear-local-variables))
6212 (when (get-buffer gnus-article-buffer)
6213 (bury-buffer gnus-article-buffer))
6214 ;; We clear the global counterparts of the buffer-local
6215 ;; variables as well, just to be on the safe side.
6216 (set-buffer gnus-group-buffer)
6217 (gnus-summary-clear-local-variables)
6218 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6219 (gnus-summary-clear-local-variables)))
6220 (setq gnus-current-select-method gnus-select-method)
6221 (pop-to-buffer gnus-group-buffer)
6222 (if (not quit-config)
6224 (goto-char group-point)
6225 (gnus-configure-windows 'group 'force))
6226 (gnus-handle-ephemeral-exit quit-config))
6227 ;; Return to group mode buffer.
6228 (when (eq mode 'gnus-summary-mode)
6229 (gnus-kill-buffer buf))
6230 ;; Clear the current group name.
6232 (setq gnus-newsgroup-name nil)))))
6234 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6235 (defun gnus-summary-exit-no-update (&optional no-questions)
6236 "Quit reading current newsgroup without updating read article info."
6238 (let* ((group gnus-newsgroup-name)
6239 (quit-config (gnus-group-quit-config group)))
6240 (when (or no-questions
6242 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6243 (gnus-async-halt-prefetch)
6245 (delq 'gnus-summary-expire-articles
6246 (copy-sequence gnus-summary-prepare-exit-hook)))
6247 (when (gnus-buffer-live-p gnus-article-buffer)
6249 (set-buffer gnus-article-buffer)
6250 (mm-destroy-parts gnus-article-mime-handles)
6251 ;; Set it to nil for safety reason.
6252 (setq gnus-article-mime-handle-alist nil)
6253 (setq gnus-article-mime-handles nil)))
6254 ;; If we have several article buffers, we kill them at exit.
6255 (unless gnus-single-article-buffer
6256 (gnus-kill-buffer gnus-article-buffer)
6257 (gnus-kill-buffer gnus-original-article-buffer)
6258 (setq gnus-article-current nil))
6259 (if (not gnus-kill-summary-on-exit)
6260 (gnus-deaden-summary)
6261 (gnus-close-group group)
6262 (gnus-summary-clear-local-variables)
6263 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6264 (gnus-summary-clear-local-variables))
6265 (set-buffer gnus-group-buffer)
6266 (gnus-summary-clear-local-variables)
6267 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6268 (gnus-summary-clear-local-variables))
6269 (when (get-buffer gnus-summary-buffer)
6270 (kill-buffer gnus-summary-buffer)))
6271 (unless gnus-single-article-buffer
6272 (setq gnus-article-current nil))
6273 (when gnus-use-trees
6274 (gnus-tree-close group))
6275 (gnus-async-prefetch-remove-group group)
6276 (when (get-buffer gnus-article-buffer)
6277 (bury-buffer gnus-article-buffer))
6278 ;; Return to the group buffer.
6279 (gnus-configure-windows 'group 'force)
6280 ;; Clear the current group name.
6281 (setq gnus-newsgroup-name nil)
6282 (when (equal (gnus-group-group-name) group)
6283 (gnus-group-next-unread-group 1))
6285 (gnus-handle-ephemeral-exit quit-config)))))
6287 (defun gnus-handle-ephemeral-exit (quit-config)
6288 "Handle movement when leaving an ephemeral group.
6289 The state which existed when entering the ephemeral is reset."
6290 (if (not (buffer-name (car quit-config)))
6291 (gnus-configure-windows 'group 'force)
6292 (set-buffer (car quit-config))
6293 (cond ((eq major-mode 'gnus-summary-mode)
6294 (gnus-set-global-variables))
6295 ((eq major-mode 'gnus-article-mode)
6297 ;; The `gnus-summary-buffer' variable may point
6298 ;; to the old summary buffer when using a single
6300 (unless (gnus-buffer-live-p gnus-summary-buffer)
6301 (set-buffer gnus-group-buffer))
6302 (set-buffer gnus-summary-buffer)
6303 (gnus-set-global-variables))))
6304 (if (or (eq (cdr quit-config) 'article)
6305 (eq (cdr quit-config) 'pick))
6307 ;; The current article may be from the ephemeral group
6308 ;; thus it is best that we reload this article
6309 (gnus-summary-show-article)
6310 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6311 (gnus-configure-windows 'pick 'force)
6312 (gnus-configure-windows (cdr quit-config) 'force)))
6313 (gnus-configure-windows (cdr quit-config) 'force))
6314 (when (eq major-mode 'gnus-summary-mode)
6315 (gnus-summary-next-subject 1 nil t)
6316 (gnus-summary-recenter)
6317 (gnus-summary-position-point))))
6321 (defvar gnus-dead-summary-mode-map nil)
6323 (unless gnus-dead-summary-mode-map
6324 (setq gnus-dead-summary-mode-map (make-keymap))
6325 (suppress-keymap gnus-dead-summary-mode-map)
6326 (substitute-key-definition
6327 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6328 (dolist (key '("\C-d" "\r" "\177" [delete]))
6329 (define-key gnus-dead-summary-mode-map
6330 key 'gnus-summary-wake-up-the-dead))
6331 (dolist (key '("q" "Q"))
6332 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6334 (defvar gnus-dead-summary-mode nil
6335 "Minor mode for Gnus summary buffers.")
6337 (defun gnus-dead-summary-mode (&optional arg)
6338 "Minor mode for Gnus summary buffers."
6340 (when (eq major-mode 'gnus-summary-mode)
6341 (make-local-variable 'gnus-dead-summary-mode)
6342 (setq gnus-dead-summary-mode
6343 (if (null arg) (not gnus-dead-summary-mode)
6344 (> (prefix-numeric-value arg) 0)))
6345 (when gnus-dead-summary-mode
6346 (gnus-add-minor-mode
6347 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6349 (defun gnus-deaden-summary ()
6350 "Make the current summary buffer into a dead summary buffer."
6351 ;; Kill any previous dead summary buffer.
6352 (when (and gnus-dead-summary
6353 (buffer-name gnus-dead-summary))
6355 (set-buffer gnus-dead-summary)
6356 (when gnus-dead-summary-mode
6357 (kill-buffer (current-buffer)))))
6358 ;; Make this the current dead summary.
6359 (setq gnus-dead-summary (current-buffer))
6360 (gnus-dead-summary-mode 1)
6361 (let ((name (buffer-name)))
6362 (when (string-match "Summary" name)
6364 (concat (substring name 0 (match-beginning 0)) "Dead "
6365 (substring name (match-beginning 0)))
6369 (defun gnus-kill-or-deaden-summary (buffer)
6370 "Kill or deaden the summary BUFFER."
6372 (when (and (buffer-name buffer)
6373 (not gnus-single-article-buffer))
6376 (gnus-kill-buffer gnus-article-buffer)
6377 (gnus-kill-buffer gnus-original-article-buffer)))
6380 (gnus-kill-summary-on-exit
6381 (when (and gnus-use-trees
6382 (gnus-buffer-exists-p buffer))
6385 (gnus-tree-close gnus-newsgroup-name)))
6386 (gnus-kill-buffer buffer))
6387 ;; Deaden the buffer.
6388 ((gnus-buffer-exists-p buffer)
6391 (gnus-deaden-summary))))))
6393 (defun gnus-summary-wake-up-the-dead (&rest args)
6394 "Wake up the dead summary buffer."
6396 (gnus-dead-summary-mode -1)
6397 (let ((name (buffer-name)))
6398 (when (string-match "Dead " name)
6400 (concat (substring name 0 (match-beginning 0))
6401 (substring name (match-end 0)))
6403 (gnus-message 3 "This dead summary is now alive again"))
6405 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6406 (defun gnus-summary-fetch-faq (&optional faq-dir)
6407 "Fetch the FAQ for the current group.
6408 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6412 (when current-prefix-arg
6414 "Faq dir: " (and (listp gnus-group-faq-directory)
6415 (mapcar (lambda (file) (list file))
6416 gnus-group-faq-directory))))))
6417 (let (gnus-faq-buffer)
6418 (when (setq gnus-faq-buffer
6419 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6420 (gnus-configure-windows 'summary-faq))))
6422 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6423 (defun gnus-summary-describe-group (&optional force)
6424 "Describe the current newsgroup."
6426 (gnus-group-describe-group force gnus-newsgroup-name))
6428 (defun gnus-summary-describe-briefly ()
6429 "Describe summary mode commands briefly."
6431 (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")))
6433 ;; Walking around group mode buffer from summary mode.
6435 (defun gnus-summary-next-group (&optional no-article target-group backward)
6436 "Exit current newsgroup and then select next unread newsgroup.
6437 If prefix argument NO-ARTICLE is non-nil, no article is selected
6438 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
6439 previous group instead."
6441 ;; Stop pre-fetching.
6442 (gnus-async-halt-prefetch)
6443 (let ((current-group gnus-newsgroup-name)
6444 (current-buffer (current-buffer))
6446 ;; First we semi-exit this group to update Xrefs and all variables.
6447 ;; We can't do a real exit, because the window conf must remain
6448 ;; the same in case the user is prompted for info, and we don't
6449 ;; want the window conf to change before that...
6450 (gnus-summary-exit t)
6451 (while (not entered)
6452 ;; Then we find what group we are supposed to enter.
6453 (set-buffer gnus-group-buffer)
6454 (gnus-group-jump-to-group current-group)
6457 (if (eq gnus-keep-same-level 'best)
6458 (gnus-summary-best-group gnus-newsgroup-name)
6459 (gnus-summary-search-group backward gnus-keep-same-level))))
6460 (if (not target-group)
6461 ;; There are no further groups, so we return to the group
6464 (gnus-message 5 "Returning to the group buffer")
6466 (when (gnus-buffer-live-p current-buffer)
6467 (set-buffer current-buffer)
6468 (gnus-summary-exit))
6469 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6470 ;; We try to enter the target group.
6471 (gnus-group-jump-to-group target-group)
6472 (let ((unreads (gnus-group-group-unread)))
6473 (if (and (or (eq t unreads)
6474 (and unreads (not (zerop unreads))))
6475 (gnus-summary-read-group
6476 target-group nil no-article
6477 (and (buffer-name current-buffer) current-buffer)
6480 (setq current-group target-group
6481 target-group nil)))))))
6483 (defun gnus-summary-prev-group (&optional no-article)
6484 "Exit current newsgroup and then select previous unread newsgroup.
6485 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6487 (gnus-summary-next-group no-article nil t))
6489 ;; Walking around summary lines.
6491 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6492 "Go to the first unread subject.
6493 If UNREAD is non-nil, go to the first unread article.
6494 Returns the article selected or nil if there are no unread articles."
6499 ((null gnus-newsgroup-data)
6500 (gnus-message 3 "No articles in the group")
6502 ;; Pick the first article.
6504 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6505 (gnus-data-number (car gnus-newsgroup-data)))
6506 ;; No unread articles.
6507 ((null gnus-newsgroup-unreads)
6508 (gnus-message 3 "No more unread articles")
6510 ;; Find the first unread article.
6512 (let ((data gnus-newsgroup-data))
6514 (and (not (and undownloaded
6515 (eq gnus-undownloaded-mark
6516 (gnus-data-mark (car data)))))
6519 (gnus-data-number (car data))
6520 gnus-newsgroup-unseen))
6521 (not (gnus-data-unread-p (car data))))
6522 (not (gnus-data-unread-p (car data))))))
6523 (setq data (cdr data)))
6525 (goto-char (gnus-data-pos (car data)))
6526 (gnus-data-number (car data))))))
6527 (gnus-summary-position-point)))
6529 (defun gnus-summary-next-subject (n &optional unread dont-display)
6530 "Go to next N'th summary line.
6531 If N is negative, go to the previous N'th subject line.
6532 If UNREAD is non-nil, only unread articles are selected.
6533 The difference between N and the actual number of steps taken is
6536 (let ((backward (< n 0))
6540 (gnus-summary-find-prev unread)
6541 (gnus-summary-find-next unread)))
6542 (unless (zerop (setq n (1- n)))
6543 (gnus-summary-show-thread)))
6545 (gnus-message 7 "No more%s articles"
6546 (if unread " unread" "")))
6547 (unless dont-display
6548 (gnus-summary-recenter)
6549 (gnus-summary-position-point))
6552 (defun gnus-summary-next-unread-subject (n)
6553 "Go to next N'th unread summary line."
6555 (gnus-summary-next-subject n t))
6557 (defun gnus-summary-prev-subject (n &optional unread)
6558 "Go to previous N'th summary line.
6559 If optional argument UNREAD is non-nil, only unread article is selected."
6561 (gnus-summary-next-subject (- n) unread))
6563 (defun gnus-summary-prev-unread-subject (n)
6564 "Go to previous N'th unread summary line."
6566 (gnus-summary-next-subject (- n) t))
6568 (defun gnus-summary-goto-subject (article &optional force silent)
6569 "Go the subject line of ARTICLE.
6570 If FORCE, also allow jumping to articles not currently shown."
6571 (interactive "nArticle number: ")
6572 (unless (numberp article)
6573 (error "Article %s is not a number" article))
6575 (data (gnus-data-find article)))
6576 ;; We read in the article if we have to.
6579 (gnus-summary-insert-subject
6581 (if (or (numberp force) (vectorp force)) force)
6583 (setq data (gnus-data-find article)))
6588 (gnus-message 3 "Can't find article %d" article))
6590 (let ((pt (gnus-data-pos data)))
6592 (gnus-summary-set-article-display-arrow pt))
6593 (gnus-summary-position-point)
6596 ;; Walking around summary lines with displaying articles.
6598 (defun gnus-summary-expand-window (&optional arg)
6599 "Make the summary buffer take up the entire Emacs frame.
6600 Given a prefix, will force an `article' buffer configuration."
6603 (gnus-configure-windows 'article 'force)
6604 (gnus-configure-windows 'summary 'force)))
6606 (defun gnus-summary-display-article (article &optional all-header)
6607 "Display ARTICLE in article buffer."
6608 (when (gnus-buffer-live-p gnus-article-buffer)
6609 (with-current-buffer gnus-article-buffer
6610 (mm-enable-multibyte)))
6611 (gnus-set-global-variables)
6612 (when (gnus-buffer-live-p gnus-article-buffer)
6613 (with-current-buffer gnus-article-buffer
6614 (setq gnus-article-charset gnus-newsgroup-charset)
6615 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6616 (mm-enable-multibyte)))
6620 (if gnus-summary-display-article-function
6621 (funcall gnus-summary-display-article-function article all-header)
6622 (gnus-article-prepare article all-header))
6623 (gnus-run-hooks 'gnus-select-article-hook)
6624 (when (and gnus-current-article
6625 (not (zerop gnus-current-article)))
6626 (gnus-summary-goto-subject gnus-current-article))
6627 (gnus-summary-recenter)
6628 (when (and gnus-use-trees gnus-show-threads)
6629 (gnus-possibly-generate-tree article)
6630 (gnus-highlight-selected-tree article))
6631 ;; Successfully display article.
6632 (gnus-article-set-window-start
6633 (cdr (assq article gnus-newsgroup-bookmarks))))))
6635 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
6636 "Select the current article.
6637 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
6638 non-nil, the article will be re-fetched even if it already present in
6639 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
6641 ;; Make sure we are in the summary buffer to work around bbdb bug.
6642 (unless (eq major-mode 'gnus-summary-mode)
6643 (set-buffer gnus-summary-buffer))
6644 (let ((article (or article (gnus-summary-article-number)))
6645 (all-headers (not (not all-headers))) ;Must be t or nil.
6646 gnus-summary-display-article-function)
6648 (gnus-summary-article-pseudo-p article)
6649 (error "This is a pseudo-article"))
6651 (set-buffer gnus-summary-buffer)
6652 (if (or (and gnus-single-article-buffer
6653 (or (null gnus-current-article)
6654 (null gnus-article-current)
6655 (null (get-buffer gnus-article-buffer))
6656 (not (eq article (cdr gnus-article-current)))
6657 (not (equal (car gnus-article-current)
6658 gnus-newsgroup-name))))
6659 (and (not gnus-single-article-buffer)
6660 (or (null gnus-current-article)
6661 (not (eq gnus-current-article article))))
6663 ;; The requested article is different from the current article.
6665 (gnus-summary-display-article article all-headers)
6666 (when (gnus-buffer-live-p gnus-article-buffer)
6667 (with-current-buffer gnus-article-buffer
6668 (if (not gnus-article-decoded-p) ;; a local variable
6669 (mm-disable-multibyte))))
6670 (gnus-article-set-window-start
6671 (cdr (assq article gnus-newsgroup-bookmarks)))
6675 (defun gnus-summary-force-verify-and-decrypt ()
6677 (let ((mm-verify-option 'known)
6678 (mm-decrypt-option 'known))
6679 (gnus-summary-select-article nil 'force)))
6681 (defun gnus-summary-set-current-mark (&optional current-mark)
6682 "Obsolete function."
6685 (defun gnus-summary-next-article (&optional unread subject backward push)
6686 "Select the next article.
6687 If UNREAD, only unread articles are selected.
6688 If SUBJECT, only articles with SUBJECT are selected.
6689 If BACKWARD, the previous article is selected instead of the next."
6692 ;; Is there such an article?
6693 ((and (gnus-summary-search-forward unread subject backward)
6694 (or (gnus-summary-display-article (gnus-summary-article-number))
6695 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
6696 (gnus-summary-position-point))
6697 ;; If not, we try the first unread, if that is wanted.
6699 gnus-auto-select-same
6700 (gnus-summary-first-unread-article))
6701 (gnus-summary-position-point)
6702 (gnus-message 6 "Wrapped"))
6703 ;; Try to get next/previous article not displayed in this group.
6704 ((and gnus-auto-extend-newsgroup
6705 (not unread) (not subject))
6706 (gnus-summary-goto-article
6707 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
6708 nil (count-lines (point-min) (point))))
6709 ;; Go to next/previous group.
6711 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
6712 (gnus-summary-jump-to-group gnus-newsgroup-name))
6713 (let ((cmd last-command-char)
6716 (set-buffer gnus-group-buffer)
6719 (if (eq gnus-keep-same-level 'best)
6720 (gnus-summary-best-group gnus-newsgroup-name)
6721 (gnus-summary-search-group backward gnus-keep-same-level))))
6722 ;; For some reason, the group window gets selected. We change
6724 (select-window (get-buffer-window (current-buffer)))
6725 ;; Select next unread newsgroup automagically.
6727 ((or (not gnus-auto-select-next)
6729 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6730 ((or (eq gnus-auto-select-next 'quietly)
6731 (and (eq gnus-auto-select-next 'slightly-quietly)
6733 (and (eq gnus-auto-select-next 'almost-quietly)
6734 (gnus-summary-last-article-p)))
6736 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6738 (gnus-message 7 "No more%s articles (%s)..."
6739 (if unread " unread" "")
6740 (if group (concat "selecting " group)
6742 (gnus-summary-next-group nil group backward)))
6744 (when (gnus-key-press-event-p last-input-event)
6745 (gnus-summary-walk-group-buffer
6746 gnus-newsgroup-name cmd unread backward point))))))))
6748 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6749 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6750 (?\C-p (gnus-group-prev-unread-group 1))))
6751 (cursor-in-echo-area t)
6752 keve key group ended)
6754 (set-buffer gnus-group-buffer)
6757 (if (eq gnus-keep-same-level 'best)
6758 (gnus-summary-best-group gnus-newsgroup-name)
6759 (gnus-summary-search-group backward gnus-keep-same-level))))
6762 5 "No more%s articles%s" (if unread " unread" "")
6764 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
6765 (format " (Type %s for %s [%s])"
6766 (single-key-description cmd) group
6767 (car (gnus-gethash group gnus-newsrc-hashtb)))
6768 (format " (Type %s to exit %s)"
6769 (single-key-description cmd)
6770 gnus-newsgroup-name)))
6771 ;; Confirm auto selection.
6772 (setq key (car (setq keve (gnus-read-event-char))))
6775 ((assq key keystrokes)
6776 (let ((obuf (current-buffer)))
6777 (switch-to-buffer gnus-group-buffer)
6779 (gnus-group-jump-to-group group))
6780 (eval (cadr (assq key keystrokes)))
6781 (setq group (gnus-group-group-name))
6782 (switch-to-buffer obuf))
6786 (gnus-ephemeral-group-p gnus-newsgroup-name))
6788 (gnus-summary-next-group nil group backward)))
6790 (push (cdr keve) unread-command-events))))))
6792 (defun gnus-summary-next-unread-article ()
6793 "Select unread article after current one."
6795 (gnus-summary-next-article
6796 (or (not (eq gnus-summary-goto-unread 'never))
6797 (gnus-summary-last-article-p (gnus-summary-article-number)))
6798 (and gnus-auto-select-same
6799 (gnus-summary-article-subject))))
6801 (defun gnus-summary-prev-article (&optional unread subject)
6802 "Select the article after the current one.
6803 If UNREAD is non-nil, only unread articles are selected."
6805 (gnus-summary-next-article unread subject t))
6807 (defun gnus-summary-prev-unread-article ()
6808 "Select unread article before current one."
6810 (gnus-summary-prev-article
6811 (or (not (eq gnus-summary-goto-unread 'never))
6812 (gnus-summary-first-article-p (gnus-summary-article-number)))
6813 (and gnus-auto-select-same
6814 (gnus-summary-article-subject))))
6816 (defun gnus-summary-next-page (&optional lines circular)
6817 "Show next page of the selected article.
6818 If at the end of the current article, select the next article.
6819 LINES says how many lines should be scrolled up.
6821 If CIRCULAR is non-nil, go to the start of the article instead of
6822 selecting the next article when reaching the end of the current
6825 (setq gnus-summary-buffer (current-buffer))
6826 (gnus-set-global-variables)
6827 (let ((article (gnus-summary-article-number))
6828 (article-window (get-buffer-window gnus-article-buffer t))
6830 ;; If the buffer is empty, we have no article.
6832 (error "No article to select"))
6833 (gnus-configure-windows 'article)
6834 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6835 (if (and (eq gnus-summary-goto-unread 'never)
6836 (not (gnus-summary-last-article-p article)))
6837 (gnus-summary-next-article)
6838 (gnus-summary-next-unread-article))
6839 (if (or (null gnus-current-article)
6840 (null gnus-article-current)
6841 (/= article (cdr gnus-article-current))
6842 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6843 ;; Selected subject is different from current article's.
6844 (gnus-summary-display-article article)
6845 (when article-window
6846 (gnus-eval-in-buffer-window gnus-article-buffer
6847 (setq endp (gnus-article-next-page lines)))
6850 (gnus-summary-beginning-of-article))
6852 (gnus-message 3 "End of message"))
6854 (if (and (eq gnus-summary-goto-unread 'never)
6855 (not (gnus-summary-last-article-p article)))
6856 (gnus-summary-next-article)
6857 (gnus-summary-next-unread-article))))))))
6858 (gnus-summary-recenter)
6859 (gnus-summary-position-point)))
6861 (defun gnus-summary-prev-page (&optional lines move)
6862 "Show previous page of selected article.
6863 Argument LINES specifies lines to be scrolled down.
6864 If MOVE, move to the previous unread article if point is at
6865 the beginning of the buffer."
6867 (let ((article (gnus-summary-article-number))
6868 (article-window (get-buffer-window gnus-article-buffer t))
6870 (gnus-configure-windows 'article)
6871 (if (or (null gnus-current-article)
6872 (null gnus-article-current)
6873 (/= article (cdr gnus-article-current))
6874 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6875 ;; Selected subject is different from current article's.
6876 (gnus-summary-display-article article)
6877 (gnus-summary-recenter)
6878 (when article-window
6879 (gnus-eval-in-buffer-window gnus-article-buffer
6880 (setq endp (gnus-article-prev-page lines)))
6881 (when (and move endp)
6883 (gnus-message 3 "Beginning of message"))
6885 (if (and (eq gnus-summary-goto-unread 'never)
6886 (not (gnus-summary-first-article-p article)))
6887 (gnus-summary-prev-article)
6888 (gnus-summary-prev-unread-article))))))))
6889 (gnus-summary-position-point))
6891 (defun gnus-summary-prev-page-or-article (&optional lines)
6892 "Show previous page of selected article.
6893 Argument LINES specifies lines to be scrolled down.
6894 If at the beginning of the article, go to the next article."
6896 (gnus-summary-prev-page lines t))
6898 (defun gnus-summary-scroll-up (lines)
6899 "Scroll up (or down) one line current article.
6900 Argument LINES specifies lines to be scrolled up (or down if negative)."
6902 (gnus-configure-windows 'article)
6903 (gnus-summary-show-thread)
6904 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6905 (gnus-eval-in-buffer-window gnus-article-buffer
6907 (when (gnus-article-next-page lines)
6908 (gnus-message 3 "End of message")))
6910 (gnus-article-prev-page (- lines))))))
6911 (gnus-summary-recenter)
6912 (gnus-summary-position-point))
6914 (defun gnus-summary-scroll-down (lines)
6915 "Scroll down (or up) one line current article.
6916 Argument LINES specifies lines to be scrolled down (or up if negative)."
6918 (gnus-summary-scroll-up (- lines)))
6920 (defun gnus-summary-next-same-subject ()
6921 "Select next article which has the same subject as current one."
6923 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6925 (defun gnus-summary-prev-same-subject ()
6926 "Select previous article which has the same subject as current one."
6928 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6930 (defun gnus-summary-next-unread-same-subject ()
6931 "Select next unread article which has the same subject as current one."
6933 (gnus-summary-next-article t (gnus-summary-article-subject)))
6935 (defun gnus-summary-prev-unread-same-subject ()
6936 "Select previous unread article which has the same subject as current one."
6938 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6940 (defun gnus-summary-first-unread-article ()
6941 "Select the first unread article.
6942 Return nil if there are no unread articles."
6945 (when (gnus-summary-first-subject t)
6946 (gnus-summary-show-thread)
6947 (gnus-summary-first-subject t)
6948 (gnus-summary-display-article (gnus-summary-article-number)))
6949 (gnus-summary-position-point)))
6951 (defun gnus-summary-first-unread-subject ()
6952 "Place the point on the subject line of the first unread article.
6953 Return nil if there are no unread articles."
6956 (when (gnus-summary-first-subject t)
6957 (gnus-summary-show-thread)
6958 (gnus-summary-first-subject t))
6959 (gnus-summary-position-point)))
6961 (defun gnus-summary-first-unseen-subject ()
6962 "Place the point on the subject line of the first unseen article.
6963 Return nil if there are no unseen articles."
6966 (when (gnus-summary-first-subject t t t)
6967 (gnus-summary-show-thread)
6968 (gnus-summary-first-subject t t t))
6969 (gnus-summary-position-point)))
6971 (defun gnus-summary-first-unseen-or-unread-subject ()
6972 "Place the point on the subject line of the first unseen article.
6973 Return nil if there are no unseen articles."
6976 (unless (when (gnus-summary-first-subject t t t)
6977 (gnus-summary-show-thread)
6978 (gnus-summary-first-subject t t t))
6979 (when (gnus-summary-first-subject t)
6980 (gnus-summary-show-thread)
6981 (gnus-summary-first-subject t)))
6982 (gnus-summary-position-point)))
6984 (defun gnus-summary-first-article ()
6985 "Select the first article.
6986 Return nil if there are no articles."
6989 (when (gnus-summary-first-subject)
6990 (gnus-summary-show-thread)
6991 (gnus-summary-first-subject)
6992 (gnus-summary-display-article (gnus-summary-article-number)))
6993 (gnus-summary-position-point)))
6995 (defun gnus-summary-best-unread-article (&optional arg)
6996 "Select the unread article with the highest score.
6997 If given a prefix argument, select the next unread article that has a
6998 score higher than the default score."
7000 (let ((article (if arg
7001 (gnus-summary-better-unread-subject)
7002 (gnus-summary-best-unread-subject))))
7004 (gnus-summary-goto-article article)
7005 (error "No unread articles"))))
7007 (defun gnus-summary-best-unread-subject ()
7008 "Select the unread subject with the highest score."
7010 (let ((best -1000000)
7011 (data gnus-newsgroup-data)
7014 (and (gnus-data-unread-p (car data))
7016 (gnus-summary-article-score (gnus-data-number (car data))))
7019 article (gnus-data-number (car data))))
7020 (setq data (cdr data)))
7022 (gnus-summary-goto-subject article))
7023 (gnus-summary-position-point)
7026 (defun gnus-summary-better-unread-subject ()
7027 "Select the first unread subject that has a score over the default score."
7029 (let ((data gnus-newsgroup-data)
7031 (while (and (setq article (gnus-data-number (car data)))
7032 (or (gnus-data-read-p (car data))
7033 (not (> (gnus-summary-article-score article)
7034 gnus-summary-default-score))))
7035 (setq data (cdr data)))
7037 (gnus-summary-goto-subject article))
7038 (gnus-summary-position-point)
7041 (defun gnus-summary-last-subject ()
7042 "Go to the last displayed subject line in the group."
7043 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7045 (gnus-summary-goto-subject article))))
7047 (defun gnus-summary-goto-article (article &optional all-headers force)
7048 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7049 If ALL-HEADERS is non-nil, no header lines are hidden.
7050 If FORCE, go to the article even if it isn't displayed. If FORCE
7051 is a number, it is the line the article is to be displayed on."
7055 "Article number or Message-ID: "
7056 (mapcar (lambda (number) (list (int-to-string number)))
7057 gnus-newsgroup-limit))
7061 (if (and (stringp article)
7062 (string-match "@" article))
7063 (gnus-summary-refer-article article)
7064 (when (stringp article)
7065 (setq article (string-to-number article)))
7066 (if (gnus-summary-goto-subject article force)
7067 (gnus-summary-display-article article all-headers)
7068 (gnus-message 4 "Couldn't go to article %s" article) nil))
7069 (gnus-summary-position-point)))
7071 (defun gnus-summary-goto-last-article ()
7072 "Go to the previously read article."
7075 (when gnus-last-article
7076 (gnus-summary-goto-article gnus-last-article nil t))
7077 (gnus-summary-position-point)))
7079 (defun gnus-summary-pop-article (number)
7080 "Pop one article off the history and go to the previous.
7081 NUMBER articles will be popped off."
7084 (setq gnus-newsgroup-history
7085 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7087 (gnus-summary-goto-article (car to) nil t)
7088 (error "Article history empty")))
7089 (gnus-summary-position-point))
7091 ;; Summary commands and functions for limiting the summary buffer.
7093 (defun gnus-summary-limit-to-articles (n)
7094 "Limit the summary buffer to the next N articles.
7095 If not given a prefix, use the process marked articles instead."
7098 (let ((articles (gnus-summary-work-articles n)))
7099 (setq gnus-newsgroup-processable nil)
7100 (gnus-summary-limit articles))
7101 (gnus-summary-position-point)))
7103 (defun gnus-summary-pop-limit (&optional total)
7104 "Restore the previous limit.
7105 If given a prefix, remove all limits."
7108 (setq gnus-newsgroup-limits
7109 (list (mapcar (lambda (h) (mail-header-number h))
7110 gnus-newsgroup-headers))))
7111 (unless gnus-newsgroup-limits
7112 (error "No limit to pop"))
7114 (gnus-summary-limit nil 'pop)
7115 (gnus-summary-position-point)))
7117 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7118 "Limit the summary buffer to articles that have subjects that match a regexp.
7119 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7121 (list (read-string (if current-prefix-arg
7122 "Exclude subject (regexp): "
7123 "Limit to subject (regexp): "))
7124 nil current-prefix-arg))
7126 (setq header "subject"))
7127 (when (not (equal "" subject))
7129 (let ((articles (gnus-summary-find-matching
7130 (or header "subject") subject 'all nil nil
7133 (error "Found no matches for \"%s\"" subject))
7134 (gnus-summary-limit articles))
7135 (gnus-summary-position-point))))
7137 (defun gnus-summary-limit-to-author (from &optional not-matching)
7138 "Limit the summary buffer to articles that have authors that match a regexp.
7139 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7141 (list (read-string (if current-prefix-arg
7142 "Exclude author (regexp): "
7143 "Limit to author (regexp): "))
7144 current-prefix-arg))
7145 (gnus-summary-limit-to-subject from "from" not-matching))
7147 (defun gnus-summary-limit-to-age (age &optional younger-p)
7148 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7149 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7150 articles that are younger than AGE days."
7152 (let ((younger current-prefix-arg)
7155 (while (not days-got)
7156 (setq days (if younger
7157 (read-string "Limit to articles within (in days): ")
7158 (read-string "Limit to articles older than (in days): ")))
7159 (when (> (length days) 0)
7160 (setq days (read days)))
7166 (setq younger (not younger))
7167 (setq days (* days -1)))))
7168 (message "Please enter a number.")
7170 (list days younger)))
7172 (let ((data gnus-newsgroup-data)
7173 (cutoff (days-to-time age))
7174 articles d date is-younger)
7175 (while (setq d (pop data))
7176 (when (and (vectorp (gnus-data-header d))
7177 (setq date (mail-header-date (gnus-data-header d))))
7178 (setq is-younger (time-less-p
7179 (time-since (condition-case ()
7186 (push (gnus-data-number d) articles))))
7187 (gnus-summary-limit (nreverse articles)))
7188 (gnus-summary-position-point)))
7190 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7191 "Limit the summary buffer to articles that match an 'extra' header."
7195 (gnus-completing-read-with-default
7196 (symbol-name (car gnus-extra-headers))
7197 (if current-prefix-arg
7198 "Exclude extra header:"
7199 "Limit extra header:")
7201 (cons (symbol-name x) x))
7206 (read-string (format "%s header %s (regexp): "
7207 (if current-prefix-arg "Exclude" "Limit to")
7209 current-prefix-arg)))
7210 (when (not (equal "" regexp))
7212 (let ((articles (gnus-summary-find-matching
7213 (cons 'extra header) regexp 'all nil nil
7216 (error "Found no matches for \"%s\"" regexp))
7217 (gnus-summary-limit articles))
7218 (gnus-summary-position-point))))
7220 (defun gnus-summary-limit-to-display-predicate ()
7221 "Limit the summary buffer to the predicated in the `display' group parameter."
7223 (unless gnus-newsgroup-display
7224 (error "There is no `display' group parameter"))
7226 (dolist (number gnus-newsgroup-articles)
7227 (when (funcall gnus-newsgroup-display)
7228 (push number articles)))
7229 (gnus-summary-limit articles))
7230 (gnus-summary-position-point))
7232 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7234 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7236 (defun gnus-summary-limit-to-unread (&optional all)
7237 "Limit the summary buffer to articles that are not marked as read.
7238 If ALL is non-nil, limit strictly to unread articles."
7241 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7242 (gnus-summary-limit-to-marks
7243 ;; Concat all the marks that say that an article is read and have
7245 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7246 gnus-killed-mark gnus-kill-file-mark
7247 gnus-low-score-mark gnus-expirable-mark
7248 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7249 gnus-duplicate-mark gnus-souped-mark)
7252 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7253 (make-obsolete 'gnus-summary-delete-marked-with
7254 'gnus-summary-limit-exlude-marks)
7256 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7257 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7258 If REVERSE, limit the summary buffer to articles that are marked
7259 with MARKS. MARKS can either be a string of marks or a list of marks.
7260 Returns how many articles were removed."
7261 (interactive "sMarks: ")
7262 (gnus-summary-limit-to-marks marks t))
7264 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7265 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7266 If REVERSE (the prefix), limit the summary buffer to articles that are
7267 not marked with MARKS. MARKS can either be a string of marks or a
7269 Returns how many articles were removed."
7270 (interactive "sMarks: \nP")
7272 (let ((data gnus-newsgroup-data)
7273 (marks (if (listp marks) marks
7274 (append marks nil))) ; Transform to list.
7277 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7278 (memq (gnus-data-mark (car data)) marks))
7279 (push (gnus-data-number (car data)) articles))
7280 (setq data (cdr data)))
7281 (gnus-summary-limit articles))
7282 (gnus-summary-position-point)))
7284 (defun gnus-summary-limit-to-score (score)
7285 "Limit to articles with score at or above SCORE."
7286 (interactive "NLimit to articles with score of at least: ")
7287 (let ((data gnus-newsgroup-data)
7290 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7292 (push (gnus-data-number (car data)) articles))
7293 (setq data (cdr data)))
7295 (gnus-summary-limit articles)
7296 (gnus-summary-position-point))))
7298 (defun gnus-summary-limit-include-thread (id)
7299 "Display all the hidden articles that is in the thread with ID in it.
7300 When called interactively, ID is the Message-ID of the current
7302 (interactive (list (mail-header-id (gnus-summary-article-header))))
7303 (let ((articles (gnus-articles-in-thread
7304 (gnus-id-to-thread (gnus-root-id id)))))
7306 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7307 (gnus-summary-limit-include-matching-articles
7309 (regexp-quote (gnus-simplify-subject-re
7310 (mail-header-subject (gnus-id-to-header id)))))
7311 (gnus-summary-position-point))))
7313 (defun gnus-summary-limit-include-matching-articles (header regexp)
7314 "Display all the hidden articles that have HEADERs that match REGEXP."
7315 (interactive (list (read-string "Match on header: ")
7316 (read-string "Regexp: ")))
7317 (let ((articles (gnus-find-matching-articles header regexp)))
7319 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7320 (gnus-summary-position-point))))
7322 (defun gnus-summary-limit-include-dormant ()
7323 "Display all the hidden articles that are marked as dormant.
7324 Note that this command only works on a subset of the articles currently
7325 fetched for this group."
7327 (unless gnus-newsgroup-dormant
7328 (error "There are no dormant articles in this group"))
7330 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7331 (gnus-summary-position-point)))
7333 (defun gnus-summary-limit-exclude-dormant ()
7334 "Hide all dormant articles."
7337 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7338 (gnus-summary-position-point)))
7340 (defun gnus-summary-limit-exclude-childless-dormant ()
7341 "Hide all dormant articles that have no children."
7343 (let ((data (gnus-data-list t))
7344 articles d children)
7345 ;; Find all articles that are either not dormant or have
7347 (while (setq d (pop data))
7348 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7350 (gnus-article-children (gnus-data-number d)))
7353 (when (memq (car children) articles)
7358 (push (gnus-data-number d) articles)))
7361 (gnus-summary-limit articles)
7362 (gnus-summary-position-point))))
7364 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7365 "Mark all unread excluded articles as read.
7366 If ALL, mark even excluded ticked and dormants as read."
7368 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7369 (let ((articles (gnus-sorted-ndifference
7371 (mapcar (lambda (h) (mail-header-number h))
7372 gnus-newsgroup-headers)
7374 gnus-newsgroup-limit))
7376 (setq gnus-newsgroup-unreads
7377 (gnus-sorted-intersection gnus-newsgroup-unreads
7378 gnus-newsgroup-limit))
7380 (setq gnus-newsgroup-dormant nil
7381 gnus-newsgroup-marked nil
7382 gnus-newsgroup-reads
7384 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7385 gnus-newsgroup-reads))
7386 (while (setq article (pop articles))
7387 (unless (or (memq article gnus-newsgroup-dormant)
7388 (memq article gnus-newsgroup-marked))
7389 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7391 (defun gnus-summary-limit (articles &optional pop)
7393 ;; We pop the previous limit off the stack and use that.
7394 (setq articles (car gnus-newsgroup-limits)
7395 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7396 ;; We use the new limit, so we push the old limit on the stack.
7397 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7399 (setq gnus-newsgroup-limit articles)
7400 (let ((total (length gnus-newsgroup-data))
7401 (data (gnus-data-find-list (gnus-summary-article-number)))
7402 (gnus-summary-mark-below nil) ; Inhibit this.
7404 ;; This will do all the work of generating the new summary buffer
7405 ;; according to the new limit.
7406 (gnus-summary-prepare)
7407 ;; Hide any threads, possibly.
7408 (gnus-summary-maybe-hide-threads)
7409 ;; Try to return to the article you were at, or one in the
7412 ;; We try to find some article after the current one.
7414 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7417 (setq data (cdr data))))
7419 ;; If there is no data, that means that we were after the last
7420 ;; article. The same goes when we can't find any articles
7421 ;; after the current one.
7422 (goto-char (point-max))
7423 (gnus-summary-find-prev))
7424 (gnus-set-mode-line 'summary)
7425 ;; We return how many articles were removed from the summary
7426 ;; buffer as a result of the new limit.
7427 (- total (length gnus-newsgroup-data))))
7429 (defsubst gnus-invisible-cut-children (threads)
7432 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7437 (defsubst gnus-cut-thread (thread)
7438 "Go forwards in the thread until we find an article that we want to display."
7439 (when (or (eq gnus-fetch-old-headers 'some)
7440 (eq gnus-fetch-old-headers 'invisible)
7441 (numberp gnus-fetch-old-headers)
7442 (eq gnus-build-sparse-threads 'some)
7443 (eq gnus-build-sparse-threads 'more))
7444 ;; Deal with old-fetched headers and sparse threads.
7448 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7449 (gnus-summary-article-ancient-p
7450 (mail-header-number (car thread))))
7451 (if (or (<= (length (cdr thread)) 1)
7452 (eq gnus-fetch-old-headers 'invisible))
7453 (setq gnus-newsgroup-limit
7454 (delq (mail-header-number (car thread))
7455 gnus-newsgroup-limit)
7456 thread (cadr thread))
7457 (when (gnus-invisible-cut-children (cdr thread))
7458 (let ((th (cdr thread)))
7460 (if (memq (mail-header-number (caar th))
7461 gnus-newsgroup-limit)
7462 (setq thread (car th)
7464 (setq th (cdr th))))))))))
7467 (defun gnus-cut-threads (threads)
7468 "Cut off all uninteresting articles from the beginning of threads."
7469 (when (or (eq gnus-fetch-old-headers 'some)
7470 (eq gnus-fetch-old-headers 'invisible)
7471 (numberp gnus-fetch-old-headers)
7472 (eq gnus-build-sparse-threads 'some)
7473 (eq gnus-build-sparse-threads 'more))
7476 (setcar th (gnus-cut-thread (car th)))
7477 (setq th (cdr th)))))
7478 ;; Remove nixed out threads.
7481 (defun gnus-summary-initial-limit (&optional show-if-empty)
7482 "Figure out what the initial limit is supposed to be on group entry.
7483 This entails weeding out unwanted dormants, low-scored articles,
7484 fetch-old-headers verbiage, and so on."
7485 ;; Most groups have nothing to remove.
7486 (if (or gnus-inhibit-limiting
7487 (and (null gnus-newsgroup-dormant)
7488 (eq gnus-newsgroup-display 'gnus-not-ignore)
7489 (not (eq gnus-fetch-old-headers 'some))
7490 (not (numberp gnus-fetch-old-headers))
7491 (not (eq gnus-fetch-old-headers 'invisible))
7492 (null gnus-summary-expunge-below)
7493 (not (eq gnus-build-sparse-threads 'some))
7494 (not (eq gnus-build-sparse-threads 'more))
7495 (null gnus-thread-expunge-below)
7496 (not gnus-use-nocem)))
7498 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7499 (setq gnus-newsgroup-limit nil)
7502 (unless (car (symbol-value node))
7503 ;; These threads have no parents -- they are roots.
7504 (let ((nodes (cdr (symbol-value node)))
7507 (if (and gnus-thread-expunge-below
7508 (< (gnus-thread-total-score (car nodes))
7509 gnus-thread-expunge-below))
7510 (gnus-expunge-thread (pop nodes))
7511 (setq thread (pop nodes))
7512 (gnus-summary-limit-children thread))))))
7513 gnus-newsgroup-dependencies)
7514 ;; If this limitation resulted in an empty group, we might
7515 ;; pop the previous limit and use it instead.
7516 (when (and (not gnus-newsgroup-limit)
7518 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7519 gnus-newsgroup-limit))
7521 (defun gnus-summary-limit-children (thread)
7522 "Return 1 if this subthread is visible and 0 if it is not."
7523 ;; First we get the number of visible children to this thread. This
7524 ;; is done by recursing down the thread using this function, so this
7525 ;; will really go down to a leaf article first, before slowly
7526 ;; working its way up towards the root.
7530 (apply '+ (mapcar 'gnus-summary-limit-children
7533 (number (mail-header-number (car thread)))
7536 (not (memq number gnus-newsgroup-marked))
7538 ;; If this article is dormant and has absolutely no visible
7539 ;; children, then this article isn't visible.
7540 (and (memq number gnus-newsgroup-dormant)
7542 ;; If this is "fetch-old-headered" and there is no
7543 ;; visible children, then we don't want this article.
7544 (and (or (eq gnus-fetch-old-headers 'some)
7545 (numberp gnus-fetch-old-headers))
7546 (gnus-summary-article-ancient-p number)
7548 ;; If this is "fetch-old-headered" and `invisible', then
7549 ;; we don't want this article.
7550 (and (eq gnus-fetch-old-headers 'invisible)
7551 (gnus-summary-article-ancient-p number))
7552 ;; If this is a sparsely inserted article with no children,
7553 ;; we don't want it.
7554 (and (eq gnus-build-sparse-threads 'some)
7555 (gnus-summary-article-sparse-p number)
7557 ;; If we use expunging, and this article is really
7558 ;; low-scored, then we don't want this article.
7559 (when (and gnus-summary-expunge-below
7561 (or (cdr (assq number gnus-newsgroup-scored))
7562 gnus-summary-default-score))
7563 gnus-summary-expunge-below))
7564 ;; We increase the expunge-tally here, but that has
7565 ;; nothing to do with the limits, really.
7566 (incf gnus-newsgroup-expunged-tally)
7567 ;; We also mark as read here, if that's wanted.
7568 (when (and gnus-summary-mark-below
7569 (< score gnus-summary-mark-below))
7570 (setq gnus-newsgroup-unreads
7571 (delq number gnus-newsgroup-unreads))
7572 (if gnus-newsgroup-auto-expire
7573 (push number gnus-newsgroup-expirable)
7574 (push (cons number gnus-low-score-mark)
7575 gnus-newsgroup-reads)))
7577 ;; Do the `display' group parameter.
7578 (and gnus-newsgroup-display
7579 (not (funcall gnus-newsgroup-display)))
7580 ;; Check NoCeM things.
7581 (if (and gnus-use-nocem
7582 (gnus-nocem-unwanted-article-p
7583 (mail-header-id (car thread))))
7585 (setq gnus-newsgroup-unreads
7586 (delq number gnus-newsgroup-unreads))
7588 ;; Nope, invisible article.
7590 ;; Ok, this article is to be visible, so we add it to the limit
7592 (push number gnus-newsgroup-limit)
7595 (defun gnus-expunge-thread (thread)
7596 "Mark all articles in THREAD as read."
7597 (let* ((number (mail-header-number (car thread))))
7598 (incf gnus-newsgroup-expunged-tally)
7599 ;; We also mark as read here, if that's wanted.
7600 (setq gnus-newsgroup-unreads
7601 (delq number gnus-newsgroup-unreads))
7602 (if gnus-newsgroup-auto-expire
7603 (push number gnus-newsgroup-expirable)
7604 (push (cons number gnus-low-score-mark)
7605 gnus-newsgroup-reads)))
7606 ;; Go recursively through all subthreads.
7607 (mapcar 'gnus-expunge-thread (cdr thread)))
7609 ;; Summary article oriented commands
7611 (defun gnus-summary-refer-parent-article (n)
7612 "Refer parent article N times.
7613 If N is negative, go to ancestor -N instead.
7614 The difference between N and the number of articles fetched is returned."
7618 (when (not (natnump n))
7623 (setq header (gnus-summary-article-header))
7624 (if (and (eq (mail-header-number header)
7625 (cdr gnus-article-current))
7626 (equal gnus-newsgroup-name
7627 (car gnus-article-current)))
7628 ;; If we try to find the parent of the currently
7629 ;; displayed article, then we take a look at the actual
7630 ;; References header, since this is slightly more
7631 ;; reliable than the References field we got from the
7634 (set-buffer gnus-original-article-buffer)
7635 (nnheader-narrow-to-headers)
7636 (unless (setq ref (message-fetch-field "references"))
7637 (setq ref (message-fetch-field "in-reply-to")))
7640 ;; It's not the current article, so we take a bet on
7641 ;; the value we got from the server.
7642 (mail-header-references header)))
7644 (not (equal ref "")))
7645 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
7646 (gnus-message 1 "Couldn't find parent"))
7647 (gnus-message 1 "No references in article %d"
7648 (gnus-summary-article-number))
7651 (gnus-summary-position-point)
7654 (defun gnus-summary-refer-references ()
7655 "Fetch all articles mentioned in the References header.
7656 Return the number of articles fetched."
7658 (let ((ref (mail-header-references (gnus-summary-article-header)))
7659 (current (gnus-summary-article-number))
7663 (error "No References in the current article")
7664 ;; For each Message-ID in the References header...
7665 (while (string-match "<[^>]*>" ref)
7667 ;; ... fetch that article.
7668 (gnus-summary-refer-article
7669 (prog1 (match-string 0 ref)
7670 (setq ref (substring ref (match-end 0))))))
7671 (gnus-summary-goto-subject current)
7672 (gnus-summary-position-point)
7675 (defun gnus-summary-refer-thread (&optional limit)
7676 "Fetch all articles in the current thread.
7677 If LIMIT (the numerical prefix), fetch that many old headers instead
7678 of what's specified by the `gnus-refer-thread-limit' variable."
7680 (let ((id (mail-header-id (gnus-summary-article-header)))
7681 (limit (if limit (prefix-numeric-value limit)
7682 gnus-refer-thread-limit)))
7683 ;; We want to fetch LIMIT *old* headers, but we also have to
7684 ;; re-fetch all the headers in the current buffer, because many of
7685 ;; them may be undisplayed. So we adjust LIMIT.
7686 (when (numberp limit)
7687 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
7688 (unless (eq gnus-fetch-old-headers 'invisible)
7689 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
7690 ;; Retrieve the headers and read them in.
7691 (if (eq (gnus-retrieve-headers
7692 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
7694 (gnus-build-all-threads)
7695 (error "Can't fetch thread from backends that don't support NOV"))
7696 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
7697 (gnus-summary-limit-include-thread id)))
7699 (defun gnus-summary-refer-article (message-id)
7700 "Fetch an article specified by MESSAGE-ID."
7701 (interactive "sMessage-ID: ")
7702 (when (and (stringp message-id)
7703 (not (zerop (length message-id))))
7704 ;; Construct the correct Message-ID if necessary.
7705 ;; Suggested by tale@pawl.rpi.edu.
7706 (unless (string-match "^<" message-id)
7707 (setq message-id (concat "<" message-id)))
7708 (unless (string-match ">$" message-id)
7709 (setq message-id (concat message-id ">")))
7710 (let* ((header (gnus-id-to-header message-id))
7712 (gnus-summary-article-sparse-p
7713 (mail-header-number header))
7714 (memq (mail-header-number header)
7715 gnus-newsgroup-limit)))
7718 ;; If the article is present in the buffer we just go to it.
7720 (or (not (gnus-summary-article-sparse-p
7721 (mail-header-number header)))
7724 (gnus-summary-goto-article
7725 (mail-header-number header) nil t)
7727 (gnus-summary-update-article (mail-header-number header)))))
7729 ;; We fetch the article.
7731 (dolist (gnus-override-method (gnus-refer-article-methods))
7732 (gnus-check-server gnus-override-method)
7733 ;; Fetch the header, and display the article.
7734 (when (setq number (gnus-summary-insert-subject message-id))
7735 (gnus-summary-select-article nil nil nil number)
7737 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
7739 (defun gnus-refer-article-methods ()
7740 "Return a list of referrable methods."
7742 ;; No method, so we default to current and native.
7743 ((null gnus-refer-article-method)
7744 (list gnus-current-select-method gnus-select-method))
7746 ((eq 'current gnus-refer-article-method)
7747 (list gnus-current-select-method))
7748 ;; List of select methods.
7749 ((not (and (symbolp (car gnus-refer-article-method))
7750 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
7752 (dolist (method gnus-refer-article-method)
7753 (push (if (eq 'current method)
7754 gnus-current-select-method
7758 ;; One single select method.
7760 (list gnus-refer-article-method))))
7762 (defun gnus-summary-edit-parameters ()
7763 "Edit the group parameters of the current group."
7765 (gnus-group-edit-group gnus-newsgroup-name 'params))
7767 (defun gnus-summary-customize-parameters ()
7768 "Customize the group parameters of the current group."
7770 (gnus-group-customize gnus-newsgroup-name))
7772 (defun gnus-summary-enter-digest-group (&optional force)
7773 "Enter an nndoc group based on the current article.
7774 If FORCE, force a digest interpretation. If not, try
7775 to guess what the document format is."
7777 (let ((conf gnus-current-window-configuration))
7779 (gnus-summary-select-article))
7780 (setq gnus-current-window-configuration conf)
7781 (let* ((name (format "%s-%d"
7782 (gnus-group-prefixed-name
7783 gnus-newsgroup-name (list 'nndoc ""))
7785 (set-buffer gnus-summary-buffer)
7786 gnus-current-article)))
7787 (ogroup gnus-newsgroup-name)
7788 (params (append (gnus-info-params (gnus-get-info ogroup))
7789 (list (cons 'to-group ogroup))
7790 (list (cons 'save-article-group ogroup))))
7791 (case-fold-search t)
7792 (buf (current-buffer))
7795 (set-buffer gnus-original-article-buffer)
7796 ;; Have the digest group inherit the main mail address of
7797 ;; the parent article.
7798 (when (setq to-address (or (message-fetch-field "reply-to")
7799 (message-fetch-field "from")))
7800 (setq params (append
7801 (list (cons 'to-address
7802 (funcall gnus-decode-encoded-word-function
7804 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
7805 (insert-buffer-substring gnus-original-article-buffer)
7806 ;; Remove lines that may lead nndoc to misinterpret the
7809 (goto-char (point-min))
7810 (or (search-forward "\n\n" nil t) (point)))
7811 (goto-char (point-min))
7812 (delete-matching-lines "^Path:\\|^From ")
7815 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
7816 (gnus-newsgroup-ephemeral-ignored-charsets
7817 gnus-newsgroup-ignored-charsets))
7818 (gnus-group-read-ephemeral-group
7819 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
7821 ,(if force 'mbox 'guess)))
7823 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
7825 ;; Make all postings to this group go to the parent group.
7826 (nconc (gnus-info-params (gnus-get-info name))
7828 ;; Couldn't select this doc group.
7829 (switch-to-buffer buf)
7830 (gnus-set-global-variables)
7831 (gnus-configure-windows 'summary)
7832 (gnus-message 3 "Article couldn't be entered?"))
7833 (kill-buffer dig)))))
7835 (defun gnus-summary-read-document (n)
7836 "Open a new group based on the current article(s).
7837 This will allow you to read digests and other similar
7838 documents as newsgroups.
7839 Obeys the standard process/prefix convention."
7841 (let* ((articles (gnus-summary-work-articles n))
7842 (ogroup gnus-newsgroup-name)
7843 (params (append (gnus-info-params (gnus-get-info ogroup))
7844 (list (cons 'to-group ogroup))))
7845 article group egroup groups vgroup)
7846 (while (setq article (pop articles))
7847 (setq group (format "%s-%d" gnus-newsgroup-name article))
7848 (gnus-summary-remove-process-mark article)
7849 (when (gnus-summary-display-article article)
7852 (insert-buffer-substring gnus-original-article-buffer)
7853 ;; Remove some headers that may lead nndoc to make
7855 (message-narrow-to-head)
7856 (goto-char (point-min))
7857 (delete-matching-lines "^\\(Path\\):\\|^From ")
7860 (gnus-group-read-ephemeral-group
7861 group `(nndoc ,group (nndoc-address ,(current-buffer))
7862 (nndoc-article-type guess))
7865 ;; Make all postings to this group go to the parent group.
7866 (nconc (gnus-info-params (gnus-get-info egroup))
7868 (push egroup groups))
7869 ;; Couldn't select this doc group.
7870 (gnus-error 3 "Article couldn't be entered"))))))
7871 ;; Now we have selected all the documents.
7874 (error "None of the articles could be interpreted as documents"))
7875 ((gnus-group-read-ephemeral-group
7876 (setq vgroup (format
7877 "nnvirtual:%s-%s" gnus-newsgroup-name
7878 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7879 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
7881 (cons (current-buffer) 'summary)))
7883 (error "Couldn't select virtual nndoc group")))))
7885 (defun gnus-summary-isearch-article (&optional regexp-p)
7886 "Do incremental search forward on the current article.
7887 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7889 (gnus-summary-select-article)
7890 (gnus-configure-windows 'article)
7891 (gnus-eval-in-buffer-window gnus-article-buffer
7894 (isearch-forward regexp-p))))
7896 (defun gnus-summary-search-article-forward (regexp &optional backward)
7897 "Search for an article containing REGEXP forward.
7898 If BACKWARD, search backward instead."
7901 (format "Search article %s (regexp%s): "
7902 (if current-prefix-arg "backward" "forward")
7903 (if gnus-last-search-regexp
7904 (concat ", default " gnus-last-search-regexp)
7906 current-prefix-arg))
7907 (if (string-equal regexp "")
7908 (setq regexp (or gnus-last-search-regexp ""))
7909 (setq gnus-last-search-regexp regexp)
7910 (setq gnus-article-before-search gnus-current-article))
7911 ;; Intentionally set gnus-last-article.
7912 (setq gnus-last-article gnus-article-before-search)
7913 (let ((gnus-last-article gnus-last-article))
7914 (if (gnus-summary-search-article regexp backward)
7915 (gnus-summary-show-thread)
7916 (error "Search failed: \"%s\"" regexp))))
7918 (defun gnus-summary-search-article-backward (regexp)
7919 "Search for an article containing REGEXP backward."
7922 (format "Search article backward (regexp%s): "
7923 (if gnus-last-search-regexp
7924 (concat ", default " gnus-last-search-regexp)
7926 (gnus-summary-search-article-forward regexp 'backward))
7928 (defun gnus-summary-search-article (regexp &optional backward)
7929 "Search for an article containing REGEXP.
7930 Optional argument BACKWARD means do search for backward.
7931 `gnus-select-article-hook' is not called during the search."
7932 ;; We have to require this here to make sure that the following
7933 ;; dynamic binding isn't shadowed by autoloading.
7934 (require 'gnus-async)
7936 (let ((gnus-select-article-hook nil) ;Disable hook.
7937 (gnus-article-prepare-hook nil)
7938 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7939 (gnus-use-article-prefetch nil)
7940 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7941 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7942 (sum (current-buffer))
7943 (gnus-display-mime-function nil)
7946 (gnus-save-hidden-threads
7947 (gnus-summary-select-article)
7948 (set-buffer gnus-article-buffer)
7949 (goto-char (window-point (get-buffer-window (current-buffer))))
7953 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7955 (re-search-backward regexp nil t)
7956 (re-search-forward regexp nil t))
7957 ;; We found the regexp.
7962 (get-buffer-window (current-buffer))
7966 (get-buffer-window (current-buffer))
7969 (setq point (point)))
7970 ;; We didn't find it, so we go to the next article.
7973 (while (eq found 'not)
7974 (if (not (if backward (gnus-summary-find-prev)
7975 (gnus-summary-find-next)))
7976 ;; No more articles.
7978 ;; Select the next article and adjust point.
7979 (unless (gnus-summary-article-sparse-p
7980 (gnus-summary-article-number))
7982 (gnus-summary-select-article)
7983 (set-buffer gnus-article-buffer)
7985 (goto-char (if backward (point-max) (point-min))))))))
7986 (gnus-message 7 ""))
7987 ;; Return whether we found the regexp.
7988 (when (eq found 'found)
7990 (gnus-summary-show-thread)
7991 (gnus-summary-goto-subject gnus-current-article)
7992 (gnus-summary-position-point)
7995 (defun gnus-find-matching-articles (header regexp)
7996 "Return a list of all articles that match REGEXP on HEADER.
7997 This search includes all articles in the current group that Gnus has
7998 fetched headers for, whether they are displayed or not."
7999 (let ((articles nil)
8000 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8001 (case-fold-search t))
8002 (dolist (header gnus-newsgroup-headers)
8003 (when (string-match regexp (funcall func header))
8004 (push (mail-header-number header) articles)))
8005 (nreverse articles)))
8007 (defun gnus-summary-find-matching (header regexp &optional backward unread
8008 not-case-fold not-matching)
8009 "Return a list of all articles that match REGEXP on HEADER.
8010 The search stars on the current article and goes forwards unless
8011 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8012 If UNREAD is non-nil, only unread articles will
8013 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8014 in the comparisons. If NOT-MATCHING, return a list of all articles that
8015 not match REGEXP on HEADER."
8016 (let ((case-fold-search (not not-case-fold))
8019 (if (eq (car header) 'extra)
8022 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8024 (error "%s is an invalid header" header))
8025 (unless (fboundp (intern (concat "mail-header-" header)))
8026 (error "%s is not a valid header" header))
8027 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8028 (dolist (d (if (eq backward 'all)
8030 (gnus-data-find-list
8031 (gnus-summary-article-number)
8032 (gnus-data-list backward))))
8033 (when (and (or (not unread) ; We want all articles...
8034 (gnus-data-unread-p d)) ; Or just unreads.
8035 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8039 (funcall func (gnus-data-header d))))
8040 (string-match regexp
8041 (funcall func (gnus-data-header d)))))
8042 (push (gnus-data-number d) articles))) ; Success!
8043 (nreverse articles)))
8045 (defun gnus-summary-execute-command (header regexp command &optional backward)
8046 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8047 If HEADER is an empty string (or nil), the match is done on the entire
8048 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8050 (list (let ((completion-ignore-case t))
8053 (mapcar (lambda (header) (list (format "%s" header)))
8055 '("Number" "Subject" "From" "Lines" "Date"
8056 "Message-ID" "Xref" "References" "Body")
8057 gnus-extra-headers))
8058 nil 'require-match))
8059 (read-string "Regexp: ")
8060 (read-key-sequence "Command: ")
8061 current-prefix-arg))
8062 (when (equal header "Body")
8064 ;; Hidden thread subtrees must be searched as well.
8065 (gnus-summary-show-all-threads)
8066 ;; We don't want to change current point nor window configuration.
8068 (save-window-excursion
8069 (gnus-message 6 "Executing %s..." (key-description command))
8070 ;; We'd like to execute COMMAND interactively so as to give arguments.
8071 (gnus-execute header regexp
8072 `(call-interactively ',(key-binding command))
8074 (gnus-message 6 "Executing %s...done" (key-description command)))))
8076 (defun gnus-summary-beginning-of-article ()
8077 "Scroll the article back to the beginning."
8079 (gnus-summary-select-article)
8080 (gnus-configure-windows 'article)
8081 (gnus-eval-in-buffer-window gnus-article-buffer
8083 (goto-char (point-min))
8084 (when gnus-page-broken
8085 (gnus-narrow-to-page))))
8087 (defun gnus-summary-end-of-article ()
8088 "Scroll to the end of the article."
8090 (gnus-summary-select-article)
8091 (gnus-configure-windows 'article)
8092 (gnus-eval-in-buffer-window gnus-article-buffer
8094 (goto-char (point-max))
8096 (when gnus-page-broken
8097 (gnus-narrow-to-page))))
8099 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8100 "Truncate to LEN and quote all \"(\"'s in STRING."
8101 (gnus-replace-in-string (if (and len (> (length string) len))
8102 (substring string 0 len)
8106 (defun gnus-summary-print-article (&optional filename n)
8107 "Generate and print a PostScript image of the N next (mail) articles.
8109 If N is negative, print the N previous articles. If N is nil and articles
8110 have been marked with the process mark, print these instead.
8112 If the optional first argument FILENAME is nil, send the image to the
8113 printer. If FILENAME is a string, save the PostScript image in a file with
8114 that name. If FILENAME is a number, prompt the user for the name of the file
8116 (interactive (list (ps-print-preprint current-prefix-arg)))
8117 (dolist (article (gnus-summary-work-articles n))
8118 (gnus-summary-select-article nil nil 'pseudo article)
8119 (gnus-eval-in-buffer-window gnus-article-buffer
8120 (gnus-print-buffer))
8121 (gnus-summary-remove-process-mark article))
8122 (ps-despool filename))
8124 (defun gnus-print-buffer ()
8125 (let ((buffer (generate-new-buffer " *print*")))
8128 (copy-to-buffer buffer (point-min) (point-max))
8130 (gnus-article-delete-invisible-text)
8131 (gnus-remove-text-with-property 'gnus-decoration)
8132 (when (gnus-visual-p 'article-highlight 'highlight)
8133 ;; Copy-to-buffer doesn't copy overlay. So redo
8135 (let ((gnus-article-buffer buffer))
8136 (gnus-article-highlight-citation t)
8137 (gnus-article-highlight-signature)))
8138 (let ((ps-left-header
8141 (gnus-summary-print-truncate-and-quote
8142 (mail-header-subject gnus-current-headers)
8145 (gnus-summary-print-truncate-and-quote
8146 (mail-header-from gnus-current-headers)
8150 "/pagenumberstring load"
8152 (mail-header-date gnus-current-headers) ")"))))
8153 (gnus-run-hooks 'gnus-ps-print-hook)
8156 (ps-spool-buffer-with-faces)
8157 (ps-spool-buffer)))))
8158 (kill-buffer buffer))))
8160 (defun gnus-summary-show-article (&optional arg)
8161 "Force redisplaying of the current article.
8162 If ARG (the prefix) is a number, show the article with the charset
8163 defined in `gnus-summary-show-article-charset-alist', or the charset
8165 If ARG (the prefix) is non-nil and not a number, show the raw article
8166 without any article massaging functions being run. Normally, the key strokes
8171 (gnus-summary-show-article t)
8172 (let ((gnus-newsgroup-charset
8173 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8174 (mm-read-coding-system
8175 "View as charset: " ;; actually it is coding system.
8177 (set-buffer gnus-article-buffer)
8178 (mm-detect-coding-region (point) (point-max))))))
8179 (gnus-newsgroup-ignored-charsets 'gnus-all))
8180 (gnus-summary-select-article nil 'force)
8181 (let ((deps gnus-newsgroup-dependencies)
8184 (set-buffer gnus-original-article-buffer)
8186 (message-narrow-to-head)
8187 (setq head (buffer-string))
8188 (goto-char (point-min))
8189 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8190 (goto-char (point-max))
8192 (setq lines (1- (count-lines (point) (point-max))))))
8194 (insert (format "211 %d Article retrieved.\n"
8195 (cdr gnus-article-current)))
8197 (if lines (insert (format "Lines: %d\n" lines)))
8199 (let ((nntp-server-buffer (current-buffer)))
8200 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8201 (gnus-data-set-header
8202 (gnus-data-find (cdr gnus-article-current))
8204 (gnus-summary-update-article-line
8205 (cdr gnus-article-current) header)
8206 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8207 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8209 ;; Select the article the normal way.
8210 (gnus-summary-select-article nil 'force))
8212 ;; We have to require this here to make sure that the following
8213 ;; dynamic binding isn't shadowed by autoloading.
8214 (require 'gnus-async)
8216 ;; Bind the article treatment functions to nil.
8217 (let ((gnus-have-all-headers t)
8218 gnus-article-prepare-hook
8219 gnus-article-decode-hook
8220 gnus-display-mime-function
8222 ;; Destroy any MIME parts.
8223 (when (gnus-buffer-live-p gnus-article-buffer)
8225 (set-buffer gnus-article-buffer)
8226 (mm-destroy-parts gnus-article-mime-handles)
8227 ;; Set it to nil for safety reason.
8228 (setq gnus-article-mime-handle-alist nil)
8229 (setq gnus-article-mime-handles nil)))
8230 (gnus-summary-select-article nil 'force))))
8231 (gnus-summary-goto-subject gnus-current-article)
8232 (gnus-summary-position-point))
8234 (defun gnus-summary-show-raw-article ()
8235 "Show the raw article without any article massaging functions being run."
8237 (gnus-summary-show-article t))
8239 (defun gnus-summary-verbose-headers (&optional arg)
8240 "Toggle permanent full header display.
8241 If ARG is a positive number, turn header display on.
8242 If ARG is a negative number, turn header display off."
8244 (setq gnus-show-all-headers
8245 (cond ((or (not (numberp arg))
8247 (not gnus-show-all-headers))
8250 (gnus-summary-show-article))
8252 (defun gnus-summary-toggle-header (&optional arg)
8253 "Show the headers if they are hidden, or hide them if they are shown.
8254 If ARG is a positive number, show the entire header.
8255 If ARG is a negative number, hide the unwanted header lines."
8258 (set-buffer gnus-article-buffer)
8260 (let* ((buffer-read-only nil)
8261 (inhibit-point-motion-hooks t)
8264 (article-narrow-to-head)
8266 hidden (if (numberp arg)
8268 (gnus-article-hidden-text-p 'headers))))
8269 (delete-region (point-min) e)
8270 (goto-char (point-min))
8272 (set-buffer gnus-original-article-buffer)
8273 (goto-char (point-min))
8274 (setq e (search-forward "\n\n" nil t)
8275 e (if e (1- e) (point-max))))
8276 (insert-buffer-substring gnus-original-article-buffer 1 e)
8278 (narrow-to-region (point-min) (point))
8279 (article-decode-encoded-words)
8281 (let ((gnus-treat-hide-headers nil)
8282 (gnus-treat-hide-boring-headers nil))
8283 (gnus-delete-wash-type 'headers)
8284 (gnus-treat-article 'head))
8285 (gnus-treat-article 'head)))
8286 (gnus-set-mode-line 'article)))))
8288 (defun gnus-summary-show-all-headers ()
8289 "Make all header lines visible."
8291 (gnus-summary-toggle-header 1))
8293 (defun gnus-summary-caesar-message (&optional arg)
8294 "Caesar rotate the current article by 13.
8295 The numerical prefix specifies how many places to rotate each letter
8298 (gnus-summary-select-article)
8299 (let ((mail-header-separator ""))
8300 (gnus-eval-in-buffer-window gnus-article-buffer
8303 (let ((start (window-start))
8305 (message-caesar-buffer-body arg)
8306 (set-window-start (get-buffer-window (current-buffer)) start))))))
8308 (defun gnus-summary-stop-page-breaking ()
8309 "Stop page breaking in the current article."
8311 (gnus-summary-select-article)
8312 (gnus-eval-in-buffer-window gnus-article-buffer
8314 (when (gnus-visual-p 'page-marker)
8315 (let ((buffer-read-only nil))
8316 (gnus-remove-text-with-property 'gnus-prev)
8317 (gnus-remove-text-with-property 'gnus-next))
8318 (setq gnus-page-broken nil))))
8320 (defun gnus-summary-move-article (&optional n to-newsgroup
8321 select-method action)
8322 "Move the current article to a different newsgroup.
8323 If N is a positive number, move the N next articles.
8324 If N is a negative number, move the N previous articles.
8325 If N is nil and any articles have been marked with the process mark,
8326 move those articles instead.
8327 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8328 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8329 re-spool using this method.
8331 When called interactively with TO-NEWSGROUP being nil, the value of
8332 the variable `gnus-move-split-methods' is used for finding a default
8333 for the target newsgroup.
8335 For this function to work, both the current newsgroup and the
8336 newsgroup that you want to move to have to support the `request-move'
8337 and `request-accept' functions.
8339 ACTION can be either `move' (the default), `crosspost' or `copy'."
8342 (setq action 'move))
8343 ;; Check whether the source group supports the required functions.
8344 (cond ((and (eq action 'move)
8345 (not (gnus-check-backend-function
8346 'request-move-article gnus-newsgroup-name)))
8347 (error "The current group does not support article moving"))
8348 ((and (eq action 'crosspost)
8349 (not (gnus-check-backend-function
8350 'request-replace-article gnus-newsgroup-name)))
8351 (error "The current group does not support article editing")))
8352 (let ((articles (gnus-summary-work-articles n))
8353 (prefix (if (gnus-check-backend-function
8354 'request-move-article gnus-newsgroup-name)
8355 (gnus-group-real-prefix gnus-newsgroup-name)
8357 (names '((move "Move" "Moving")
8358 (copy "Copy" "Copying")
8359 (crosspost "Crosspost" "Crossposting")))
8360 (copy-buf (save-excursion
8361 (nnheader-set-temp-buffer " *copy article*")))
8362 art-group to-method new-xref article to-groups)
8363 (unless (assq action names)
8364 (error "Unknown action %s" action))
8365 ;; Read the newsgroup name.
8366 (when (and (not to-newsgroup)
8367 (not select-method))
8368 (if (and gnus-move-split-methods
8370 (and (memq gnus-current-article articles)
8371 (gnus-buffer-live-p gnus-original-article-buffer))))
8372 ;; When `gnus-move-split-methods' is non-nil, we have to
8373 ;; select an article to give `gnus-read-move-group-name' an
8374 ;; opportunity to suggest an appropriate default. However,
8375 ;; we needn't render or mark the article.
8376 (let ((gnus-display-mime-function nil)
8377 (gnus-article-prepare-hook nil)
8378 (gnus-mark-article-hook nil))
8379 (gnus-summary-select-article nil nil nil (car articles))))
8381 (gnus-read-move-group-name
8382 (cadr (assq action names))
8383 (symbol-value (intern (format "gnus-current-%s-group" action)))
8385 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8386 (setq to-method (or select-method
8387 (gnus-server-to-method
8388 (gnus-group-method to-newsgroup))))
8389 ;; Check the method we are to move this article to...
8390 (unless (gnus-check-backend-function
8391 'request-accept-article (car to-method))
8392 (error "%s does not support article copying" (car to-method)))
8393 (unless (gnus-check-server to-method)
8394 (error "Can't open server %s" (car to-method)))
8395 (gnus-message 6 "%s to %s: %s..."
8396 (caddr (assq action names))
8397 (or (car select-method) to-newsgroup) articles)
8399 (setq article (pop articles))
8403 ;; Move the article.
8405 ;; Remove this article from future suppression.
8406 (gnus-dup-unsuppress-article article)
8407 (gnus-request-move-article
8408 article ; Article to move
8409 gnus-newsgroup-name ; From newsgroup
8410 (nth 1 (gnus-find-method-for-group
8411 gnus-newsgroup-name)) ; Server
8412 (list 'gnus-request-accept-article
8413 to-newsgroup (list 'quote select-method)
8414 (not articles) t) ; Accept form
8415 (not articles))) ; Only save nov last time
8416 ;; Copy the article.
8419 (set-buffer copy-buf)
8420 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8421 (gnus-request-accept-article
8422 to-newsgroup select-method (not articles) t))))
8423 ;; Crosspost the article.
8424 ((eq action 'crosspost)
8425 (let ((xref (message-tokenize-header
8426 (mail-header-xref (gnus-summary-article-header article))
8428 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8429 ":" (number-to-string article)))
8431 (setq xref (list (system-name))))
8434 (mapconcat 'identity
8435 (delete "Xref:" (delete new-xref xref))
8439 (set-buffer copy-buf)
8440 ;; First put the article in the destination group.
8441 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8442 (when (consp (setq art-group
8443 (gnus-request-accept-article
8444 to-newsgroup select-method (not articles))))
8445 (setq new-xref (concat new-xref " " (car art-group)
8447 (number-to-string (cdr art-group))))
8448 ;; Now we have the new Xrefs header, so we insert
8449 ;; it and replace the new article.
8450 (nnheader-replace-header "Xref" new-xref)
8451 (gnus-request-replace-article
8452 (cdr art-group) to-newsgroup (current-buffer))
8456 (gnus-message 1 "Couldn't %s article %s: %s"
8457 (cadr (assq action names)) article
8458 (nnheader-get-report (car to-method))))
8459 ((eq art-group 'junk)
8460 (when (eq action 'move)
8461 (gnus-summary-mark-article article gnus-canceled-mark)
8462 (gnus-message 4 "Deleted article %s" article)))
8464 (let* ((pto-group (gnus-group-prefixed-name
8465 (car art-group) to-method))
8467 (gnus-gethash pto-group gnus-newsrc-hashtb))
8468 (info (nth 2 entry))
8469 (to-group (gnus-info-group info))
8471 ;; Update the group that has been moved to.
8473 (memq action '(move copy)))
8474 (unless (member to-group to-groups)
8475 (push to-group to-groups))
8477 (unless (memq article gnus-newsgroup-unreads)
8478 (push 'read to-marks)
8480 info (gnus-add-to-range (gnus-info-read info)
8481 (list (cdr art-group)))))
8483 ;; See whether the article is to be put in the cache.
8484 (let ((marks gnus-article-mark-lists)
8485 (to-article (cdr art-group)))
8487 ;; Enter the article into the cache in the new group,
8488 ;; if that is required.
8489 (when gnus-use-cache
8490 (gnus-cache-possibly-enter-article
8492 (memq article gnus-newsgroup-marked)
8493 (memq article gnus-newsgroup-dormant)
8494 (memq article gnus-newsgroup-unreads)))
8496 (when gnus-preserve-marks
8497 ;; Copy any marks over to the new group.
8498 (when (and (equal to-group gnus-newsgroup-name)
8499 (not (memq article gnus-newsgroup-unreads)))
8500 ;; Mark this article as read in this group.
8501 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8502 (setcdr (gnus-active to-group) to-article)
8503 (setcdr gnus-newsgroup-active to-article))
8506 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8507 (when (memq article (symbol-value
8508 (intern (format "gnus-newsgroup-%s"
8510 (push (cdar marks) to-marks)
8511 ;; If the other group is the same as this group,
8512 ;; then we have to add the mark to the list.
8513 (when (equal to-group gnus-newsgroup-name)
8514 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
8517 (intern (format "gnus-newsgroup-%s"
8519 ;; Copy the marks to other group.
8520 (gnus-add-marked-articles
8521 to-group (cdar marks) (list to-article) info)))
8522 (setq marks (cdr marks)))
8524 (gnus-request-set-mark to-group (list (list (list to-article)
8529 (concat "(gnus-group-set-info '"
8530 (gnus-prin1-to-string (gnus-get-info to-group))
8533 ;; Update the Xref header in this article to point to
8534 ;; the new crossposted article we have just created.
8535 (when (eq action 'crosspost)
8537 (set-buffer copy-buf)
8538 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8539 (nnheader-replace-header "Xref" new-xref)
8540 (gnus-request-replace-article
8541 article gnus-newsgroup-name (current-buffer)))))
8543 ;;;!!!Why is this necessary?
8544 (set-buffer gnus-summary-buffer)
8546 (gnus-summary-goto-subject article)
8547 (when (eq action 'move)
8548 (gnus-summary-mark-article article gnus-canceled-mark))))
8549 (gnus-summary-remove-process-mark article))
8550 ;; Re-activate all groups that have been moved to.
8552 (set-buffer gnus-group-buffer)
8553 (let ((gnus-group-marked to-groups))
8554 (gnus-group-get-new-news-this-group nil t)))
8556 (gnus-kill-buffer copy-buf)
8557 (gnus-summary-position-point)
8558 (gnus-set-mode-line 'summary)))
8560 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
8561 "Move the current article to a different newsgroup.
8562 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8563 When called interactively, if TO-NEWSGROUP is nil, use the value of
8564 the variable `gnus-move-split-methods' for finding a default target
8566 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8567 re-spool using this method."
8569 (gnus-summary-move-article n to-newsgroup select-method 'copy))
8571 (defun gnus-summary-crosspost-article (&optional n)
8572 "Crosspost the current article to some other group."
8574 (gnus-summary-move-article n nil nil 'crosspost))
8576 (defcustom gnus-summary-respool-default-method nil
8577 "Default method type for respooling an article.
8578 If nil, use to the current newsgroup method."
8580 :group 'gnus-summary-mail)
8582 (defun gnus-summary-respool-article (&optional n method)
8583 "Respool the current article.
8584 The article will be squeezed through the mail spooling process again,
8585 which means that it will be put in some mail newsgroup or other
8586 depending on `nnmail-split-methods'.
8587 If N is a positive number, respool the N next articles.
8588 If N is a negative number, respool the N previous articles.
8589 If N is nil and any articles have been marked with the process mark,
8590 respool those articles instead.
8592 Respooling can be done both from mail groups and \"real\" newsgroups.
8593 In the former case, the articles in question will be moved from the
8594 current group into whatever groups they are destined to. In the
8595 latter case, they will be copied into the relevant groups."
8597 (list current-prefix-arg
8598 (let* ((methods (gnus-methods-using 'respool))
8600 (symbol-name (or gnus-summary-respool-default-method
8601 (car (gnus-find-method-for-group
8602 gnus-newsgroup-name)))))
8604 (gnus-completing-read-with-default
8605 methname "What backend do you want to use when respooling?"
8606 methods nil t nil 'gnus-mail-method-history))
8609 ((zerop (length (setq ms (gnus-servers-using-backend
8611 (list (intern method) ""))
8615 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
8616 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
8619 (error "No method given for respooling"))
8620 (if (assoc (symbol-name
8621 (car (gnus-find-method-for-group gnus-newsgroup-name)))
8622 (gnus-methods-using 'respool))
8623 (gnus-summary-move-article n nil method)
8624 (gnus-summary-copy-article n nil method)))
8626 (defun gnus-summary-import-article (file &optional edit)
8627 "Import an arbitrary file into a mail newsgroup."
8628 (interactive "fImport file: \nP")
8629 (let ((group gnus-newsgroup-name)
8630 (now (current-time))
8631 atts lines group-art)
8632 (unless (gnus-check-backend-function 'request-accept-article group)
8633 (error "%s does not support article importing" group))
8634 (or (file-readable-p file)
8635 (not (file-regular-p file))
8636 (error "Can't read %s" file))
8638 (set-buffer (gnus-get-buffer-create " *import file*"))
8640 (nnheader-insert-file-contents file)
8641 (goto-char (point-min))
8642 (if (nnheader-article-p)
8644 (goto-char (point-min))
8645 (search-forward "\n\n" nil t)
8646 (narrow-to-region (point-min) (1- (point)))
8647 (goto-char (point-min))
8648 (unless (re-search-forward "^date:" nil t)
8649 (goto-char (point-max))
8650 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
8651 ;; This doesn't look like an article, so we fudge some headers.
8652 (setq atts (file-attributes file)
8653 lines (count-lines (point-min) (point-max)))
8654 (insert "From: " (read-string "From: ") "\n"
8655 "Subject: " (read-string "Subject: ") "\n"
8656 "Date: " (message-make-date (nth 5 atts)) "\n"
8657 "Message-ID: " (message-make-message-id) "\n"
8658 "Lines: " (int-to-string lines) "\n"
8659 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
8660 (setq group-art (gnus-request-accept-article group nil t))
8661 (kill-buffer (current-buffer)))
8662 (setq gnus-newsgroup-active (gnus-activate-group group))
8664 (gnus-summary-goto-article (cdr group-art) nil t)
8666 (gnus-summary-edit-article))))
8668 (defun gnus-summary-create-article ()
8669 "Create an article in a mail newsgroup."
8671 (let ((group gnus-newsgroup-name)
8672 (now (current-time))
8674 (unless (gnus-check-backend-function 'request-accept-article group)
8675 (error "%s does not support article importing" group))
8677 (set-buffer (gnus-get-buffer-create " *import file*"))
8679 (goto-char (point-min))
8680 ;; This doesn't look like an article, so we fudge some headers.
8681 (insert "From: " (read-string "From: ") "\n"
8682 "Subject: " (read-string "Subject: ") "\n"
8683 "Date: " (message-make-date now) "\n"
8684 "Message-ID: " (message-make-message-id) "\n")
8685 (setq group-art (gnus-request-accept-article group nil t))
8686 (kill-buffer (current-buffer)))
8687 (setq gnus-newsgroup-active (gnus-activate-group group))
8689 (gnus-summary-goto-article (cdr group-art) nil t)
8690 (gnus-summary-edit-article)))
8692 (defun gnus-summary-article-posted-p ()
8693 "Say whether the current (mail) article is available from news as well.
8694 This will be the case if the article has both been mailed and posted."
8696 (let ((id (mail-header-references (gnus-summary-article-header)))
8697 (gnus-override-method (car (gnus-refer-article-methods))))
8698 (if (gnus-request-head id "")
8699 (gnus-message 2 "The current message was found on %s"
8700 gnus-override-method)
8701 (gnus-message 2 "The current message couldn't be found on %s"
8702 gnus-override-method)
8705 (defun gnus-summary-expire-articles (&optional now)
8706 "Expire all articles that are marked as expirable in the current group."
8708 (when (gnus-check-backend-function
8709 'request-expire-articles gnus-newsgroup-name)
8710 ;; This backend supports expiry.
8711 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
8712 (expirable (if total
8714 ;; We need to update the info for
8715 ;; this group for `gnus-list-of-read-articles'
8716 ;; to give us the right answer.
8717 (gnus-run-hooks 'gnus-exit-group-hook)
8718 (gnus-summary-update-info)
8719 (gnus-list-of-read-articles gnus-newsgroup-name))
8720 (setq gnus-newsgroup-expirable
8721 (sort gnus-newsgroup-expirable '<))))
8722 (expiry-wait (if now 'immediate
8723 (gnus-group-find-parameter
8724 gnus-newsgroup-name 'expiry-wait)))
8725 (nnmail-expiry-target
8726 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
8727 nnmail-expiry-target))
8730 ;; There are expirable articles in this group, so we run them
8731 ;; through the expiry process.
8732 (gnus-message 6 "Expiring articles...")
8733 (unless (gnus-check-group gnus-newsgroup-name)
8734 (error "Can't open server for %s" gnus-newsgroup-name))
8735 ;; The list of articles that weren't expired is returned.
8738 (let ((nnmail-expiry-wait-function nil)
8739 (nnmail-expiry-wait expiry-wait))
8740 (setq es (gnus-request-expire-articles
8741 expirable gnus-newsgroup-name)))
8742 (setq es (gnus-request-expire-articles
8743 expirable gnus-newsgroup-name)))
8745 (setq gnus-newsgroup-expirable es))
8746 ;; We go through the old list of expirable, and mark all
8747 ;; really expired articles as nonexistent.
8748 (unless (eq es expirable) ;If nothing was expired, we don't mark.
8749 (let ((gnus-use-cache nil))
8750 (dolist (article expirable)
8751 (when (and (not (memq article es))
8752 (gnus-data-find article))
8753 (gnus-summary-mark-article article gnus-canceled-mark))))))
8754 (gnus-message 6 "Expiring articles...done")))))
8756 (defun gnus-summary-expire-articles-now ()
8757 "Expunge all expirable articles in the current group.
8758 This means that *all* articles that are marked as expirable will be
8759 deleted forever, right now."
8761 (or gnus-expert-user
8763 "Are you really, really, really sure you want to delete all these messages? ")
8765 (gnus-summary-expire-articles t))
8767 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
8768 (defun gnus-summary-delete-article (&optional n)
8769 "Delete the N next (mail) articles.
8770 This command actually deletes articles. This is not a marking
8771 command. The article will disappear forever from your life, never to
8773 If N is negative, delete backwards.
8774 If N is nil and articles have been marked with the process mark,
8775 delete these instead."
8777 (unless (gnus-check-backend-function 'request-expire-articles
8778 gnus-newsgroup-name)
8779 (error "The current newsgroup does not support article deletion"))
8780 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
8781 (error "Couldn't open server"))
8782 ;; Compute the list of articles to delete.
8783 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
8785 (if (and gnus-novice-user
8786 (not (gnus-yes-or-no-p
8787 (format "Do you really want to delete %s forever? "
8788 (if (> (length articles) 1)
8789 (format "these %s articles" (length articles))
8792 ;; Delete the articles.
8793 (setq not-deleted (gnus-request-expire-articles
8794 articles gnus-newsgroup-name 'force))
8796 (gnus-summary-remove-process-mark (car articles))
8797 ;; The backend might not have been able to delete the article
8799 (unless (memq (car articles) not-deleted)
8800 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
8801 (setq articles (cdr articles)))
8803 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
8804 (gnus-summary-position-point)
8805 (gnus-set-mode-line 'summary)
8808 (defun gnus-summary-edit-article (&optional arg)
8809 "Edit the current article.
8810 This will have permanent effect only in mail groups.
8811 If ARG is nil, edit the decoded articles.
8812 If ARG is 1, edit the raw articles.
8813 If ARG is 2, edit the raw articles even in read-only groups.
8814 If ARG is 3, edit the articles with the current handles.
8815 Otherwise, allow editing of articles even in read-only
8818 (let (force raw current-handles)
8827 (setq current-handles
8828 (and (gnus-buffer-live-p gnus-article-buffer)
8829 (with-current-buffer gnus-article-buffer
8831 gnus-article-mime-handles
8832 (setq gnus-article-mime-handles nil))))))
8835 (when (and raw (not force) (equal gnus-newsgroup-name "nndraft:drafts"))
8836 (error "Can't edit the raw article in group nndraft:drafts"))
8838 (set-buffer gnus-summary-buffer)
8839 (let ((mail-parse-charset gnus-newsgroup-charset)
8840 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
8841 (gnus-set-global-variables)
8842 (when (and (not force)
8843 (gnus-group-read-only-p))
8844 (error "The current newsgroup does not support article editing"))
8845 (gnus-summary-show-article t)
8846 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
8847 (with-current-buffer gnus-article-buffer
8848 (mm-enable-multibyte)))
8849 (if (equal gnus-newsgroup-name "nndraft:drafts")
8851 (gnus-article-edit-article
8854 (let ((mbl mml-buffer-list))
8855 (setq mml-buffer-list nil)
8856 (mime-to-mml ,'current-handles)
8857 (let ((mbl1 mml-buffer-list))
8858 (setq mml-buffer-list mbl)
8859 (set (make-local-variable 'mml-buffer-list) mbl1))
8860 (make-local-hook 'kill-buffer-hook)
8861 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
8862 `(lambda (no-highlight)
8863 (let ((mail-parse-charset ',gnus-newsgroup-charset)
8864 (message-options message-options)
8865 (message-options-set-recipient)
8866 (mail-parse-ignored-charsets
8867 ',gnus-newsgroup-ignored-charsets))
8868 ,(if (not raw) '(progn
8870 (mml-destroy-buffers)
8871 (remove-hook 'kill-buffer-hook
8872 'mml-destroy-buffers t)
8873 (kill-local-variable 'mml-buffer-list)))
8874 (gnus-summary-edit-article-done
8875 ,(or (mail-header-references gnus-current-headers) "")
8876 ,(gnus-group-read-only-p)
8877 ,gnus-summary-buffer no-highlight))))))))
8879 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
8881 (defun gnus-summary-edit-article-done (&optional references read-only buffer
8883 "Make edits to the current article permanent."
8886 ;; The buffer restriction contains the entire article if it exists.
8887 (when (article-goto-body)
8888 (let ((lines (count-lines (point) (point-max)))
8889 (length (- (point-max) (point)))
8890 (case-fold-search t)
8891 (body (copy-marker (point))))
8892 (goto-char (point-min))
8893 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
8894 (delete-region (match-beginning 1) (match-end 1))
8895 (insert (number-to-string length)))
8896 (goto-char (point-min))
8897 (when (re-search-forward
8898 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
8899 (delete-region (match-beginning 1) (match-end 1))
8900 (insert (number-to-string length)))
8901 (goto-char (point-min))
8902 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
8903 (delete-region (match-beginning 1) (match-end 1))
8904 (insert (number-to-string lines))))))
8905 ;; Replace the article.
8906 (let ((buf (current-buffer)))
8908 (insert-buffer-substring buf)
8910 (if (and (not read-only)
8911 (not (gnus-request-replace-article
8912 (cdr gnus-article-current) (car gnus-article-current)
8913 (current-buffer) t)))
8914 (error "Couldn't replace article")
8915 ;; Update the summary buffer.
8917 (equal (message-tokenize-header references " ")
8918 (message-tokenize-header
8919 (or (message-fetch-field "references") "") " ")))
8920 ;; We only have to update this line.
8923 (message-narrow-to-head)
8924 (let ((head (buffer-string))
8927 (insert (format "211 %d Article retrieved.\n"
8928 (cdr gnus-article-current)))
8931 (let ((nntp-server-buffer (current-buffer)))
8932 (setq header (car (gnus-get-newsgroup-headers
8935 (set-buffer gnus-summary-buffer)
8936 (gnus-data-set-header
8937 (gnus-data-find (cdr gnus-article-current))
8939 (gnus-summary-update-article-line
8940 (cdr gnus-article-current) header)
8941 (if (gnus-summary-goto-subject
8942 (cdr gnus-article-current) nil t)
8943 (gnus-summary-update-secondary-mark
8944 (cdr gnus-article-current))))))))
8946 (set-buffer (or buffer gnus-summary-buffer))
8947 (gnus-summary-update-article (cdr gnus-article-current))
8948 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8949 (gnus-summary-update-secondary-mark
8950 (cdr gnus-article-current))))
8951 ;; Prettify the article buffer again.
8952 (unless no-highlight
8954 (set-buffer gnus-article-buffer)
8955 ;;;!!! Fix this -- article should be rehighlighted.
8956 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8957 (set-buffer gnus-original-article-buffer)
8958 (gnus-request-article
8959 (cdr gnus-article-current)
8960 (car gnus-article-current) (current-buffer))))
8961 ;; Prettify the summary buffer line.
8962 (when (gnus-visual-p 'summary-highlight 'highlight)
8963 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
8965 (defun gnus-summary-edit-wash (key)
8966 "Perform editing command KEY in the article buffer."
8970 (message "%s" (concat (this-command-keys) "- "))
8973 (gnus-summary-edit-article)
8974 (execute-kbd-macro (concat (this-command-keys) key))
8975 (gnus-article-edit-done))
8979 (defun gnus-summary-respool-query (&optional silent trace)
8980 "Query where the respool algorithm would put this article."
8982 (let (gnus-mark-article-hook)
8983 (gnus-summary-select-article)
8985 (set-buffer gnus-original-article-buffer)
8987 (message-narrow-to-head)
8988 (let ((groups (nnmail-article-group 'identity trace)))
8991 (message "This message would go to %s"
8992 (mapconcat 'car groups ", "))
8993 (message "This message would go to no groups"))
8996 (defun gnus-summary-respool-trace ()
8997 "Trace where the respool algorithm would put this article.
8998 Display a buffer showing all fancy splitting patterns which matched."
9000 (gnus-summary-respool-query nil t))
9002 ;; Summary marking commands.
9004 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9005 "Mark articles which has the same subject as read, and then select the next.
9006 If UNMARK is positive, remove any kind of mark.
9007 If UNMARK is negative, tick articles."
9010 (setq unmark (prefix-numeric-value unmark)))
9012 (gnus-summary-mark-same-subject
9013 (gnus-summary-article-subject) unmark)))
9014 ;; Select next unread article. If auto-select-same mode, should
9015 ;; select the first unread article.
9016 (gnus-summary-next-article t (and gnus-auto-select-same
9017 (gnus-summary-article-subject)))
9018 (gnus-message 7 "%d article%s marked as %s"
9019 count (if (= count 1) " is" "s are")
9020 (if unmark "unread" "read"))))
9022 (defun gnus-summary-kill-same-subject (&optional unmark)
9023 "Mark articles which has the same subject as read.
9024 If UNMARK is positive, remove any kind of mark.
9025 If UNMARK is negative, tick articles."
9028 (setq unmark (prefix-numeric-value unmark)))
9030 (gnus-summary-mark-same-subject
9031 (gnus-summary-article-subject) unmark)))
9032 ;; If marked as read, go to next unread subject.
9034 ;; Go to next unread subject.
9035 (gnus-summary-next-subject 1 t))
9036 (gnus-message 7 "%d articles are marked as %s"
9037 count (if unmark "unread" "read"))))
9039 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9040 "Mark articles with same SUBJECT as read, and return marked number.
9041 If optional argument UNMARK is positive, remove any kinds of marks.
9042 If optional argument UNMARK is negative, mark articles as unread instead."
9046 ((null unmark) ; Mark as read.
9049 (gnus-summary-mark-article-as-read gnus-killed-mark)
9050 (gnus-summary-show-thread) t)
9051 (gnus-summary-find-subject subject))
9052 (setq count (1+ count))))
9053 ((> unmark 0) ; Tick.
9056 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9057 (gnus-summary-show-thread) t)
9058 (gnus-summary-find-subject subject))
9059 (setq count (1+ count))))
9060 (t ; Mark as unread.
9063 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9064 (gnus-summary-show-thread) t)
9065 (gnus-summary-find-subject subject))
9066 (setq count (1+ count)))))
9067 (gnus-set-mode-line 'summary)
9068 ;; Return the number of marked articles.
9071 (defun gnus-summary-mark-as-processable (n &optional unmark)
9072 "Set the process mark on the next N articles.
9073 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9074 the process mark instead. The difference between N and the actual
9075 number of articles marked is returned."
9077 (if (and (null n) (gnus-region-active-p))
9078 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9079 (setq n (prefix-numeric-value n))
9080 (let ((backward (< n 0))
9085 (gnus-summary-remove-process-mark
9086 (gnus-summary-article-number))
9087 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9088 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9091 (gnus-message 7 "No more articles"))
9092 (gnus-summary-recenter)
9093 (gnus-summary-position-point)
9096 (defun gnus-summary-unmark-as-processable (n)
9097 "Remove the process mark from the next N articles.
9098 If N is negative, unmark backward instead. The difference between N and
9099 the actual number of articles unmarked is returned."
9101 (gnus-summary-mark-as-processable n t))
9103 (defun gnus-summary-unmark-all-processable ()
9104 "Remove the process mark from all articles."
9107 (while gnus-newsgroup-processable
9108 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9109 (gnus-summary-position-point))
9111 (defun gnus-summary-add-mark (article type)
9112 "Mark ARTICLE with a mark of TYPE."
9113 (let ((vtype (car (assq type gnus-article-mark-lists)))
9116 (error "No such mark type: %s" type)
9117 (setq var (intern (format "gnus-newsgroup-%s" type)))
9118 (set var (cons article (symbol-value var)))
9119 (if (memq type '(processable cached replied forwarded recent saved))
9120 (gnus-summary-update-secondary-mark article)
9121 ;;; !!! This is bogus. We should find out what primary
9122 ;;; !!! mark we want to set.
9123 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9125 (defun gnus-summary-mark-as-expirable (n)
9126 "Mark N articles forward as expirable.
9127 If N is negative, mark backward instead. The difference between N and
9128 the actual number of articles marked is returned."
9130 (gnus-summary-mark-forward n gnus-expirable-mark))
9132 (defun gnus-summary-mark-article-as-replied (article)
9133 "Mark ARTICLE as replied to and update the summary line.
9134 ARTICLE can also be a list of articles."
9135 (interactive (list (gnus-summary-article-number)))
9136 (let ((articles (if (listp article) article (list article))))
9137 (dolist (article articles)
9138 (push article gnus-newsgroup-replied)
9139 (let ((buffer-read-only nil))
9140 (when (gnus-summary-goto-subject article nil t)
9141 (gnus-summary-update-secondary-mark article))))))
9143 (defun gnus-summary-mark-article-as-forwarded (article)
9144 "Mark ARTICLE as forwarded and update the summary line.
9145 ARTICLE can also be a list of articles."
9146 (let ((articles (if (listp article) article (list article))))
9147 (dolist (article articles)
9148 (push article gnus-newsgroup-forwarded)
9149 (let ((buffer-read-only nil))
9150 (when (gnus-summary-goto-subject article nil t)
9151 (gnus-summary-update-secondary-mark article))))))
9153 (defun gnus-summary-set-bookmark (article)
9154 "Set a bookmark in current article."
9155 (interactive (list (gnus-summary-article-number)))
9156 (when (or (not (get-buffer gnus-article-buffer))
9157 (not gnus-current-article)
9158 (not gnus-article-current)
9159 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9160 (error "No current article selected"))
9161 ;; Remove old bookmark, if one exists.
9162 (let ((old (assq article gnus-newsgroup-bookmarks)))
9164 (setq gnus-newsgroup-bookmarks
9165 (delq old gnus-newsgroup-bookmarks))))
9166 ;; Set the new bookmark, which is on the form
9167 ;; (article-number . line-number-in-body).
9171 (set-buffer gnus-article-buffer)
9175 (goto-char (point-min))
9176 (search-forward "\n\n" nil t)
9179 gnus-newsgroup-bookmarks)
9180 (gnus-message 6 "A bookmark has been added to the current article."))
9182 (defun gnus-summary-remove-bookmark (article)
9183 "Remove the bookmark from the current article."
9184 (interactive (list (gnus-summary-article-number)))
9185 ;; Remove old bookmark, if one exists.
9186 (let ((old (assq article gnus-newsgroup-bookmarks)))
9189 (setq gnus-newsgroup-bookmarks
9190 (delq old gnus-newsgroup-bookmarks))
9191 (gnus-message 6 "Removed bookmark."))
9192 (gnus-message 6 "No bookmark in current article."))))
9194 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9195 (defun gnus-summary-mark-as-dormant (n)
9196 "Mark N articles forward as dormant.
9197 If N is negative, mark backward instead. The difference between N and
9198 the actual number of articles marked is returned."
9200 (gnus-summary-mark-forward n gnus-dormant-mark))
9202 (defun gnus-summary-set-process-mark (article)
9203 "Set the process mark on ARTICLE and update the summary line."
9204 (setq gnus-newsgroup-processable
9206 (delq article gnus-newsgroup-processable)))
9207 (when (gnus-summary-goto-subject article)
9208 (gnus-summary-show-thread)
9209 (gnus-summary-goto-subject article)
9210 (gnus-summary-update-secondary-mark article)))
9212 (defun gnus-summary-remove-process-mark (article)
9213 "Remove the process mark from ARTICLE and update the summary line."
9214 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9215 (when (gnus-summary-goto-subject article)
9216 (gnus-summary-show-thread)
9217 (gnus-summary-goto-subject article)
9218 (gnus-summary-update-secondary-mark article)))
9220 (defun gnus-summary-set-saved-mark (article)
9221 "Set the process mark on ARTICLE and update the summary line."
9222 (push article gnus-newsgroup-saved)
9223 (when (gnus-summary-goto-subject article)
9224 (gnus-summary-update-secondary-mark article)))
9226 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9227 "Mark N articles as read forwards.
9228 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9229 The difference between N and the actual number of articles marked is
9231 Iff NO-EXPIRE, auto-expiry will be inhibited."
9233 (gnus-summary-show-thread)
9234 (let ((backward (< n 0))
9235 (gnus-summary-goto-unread
9236 (and gnus-summary-goto-unread
9237 (not (eq gnus-summary-goto-unread 'never))
9238 (not (memq mark (list gnus-unread-mark
9239 gnus-ticked-mark gnus-dormant-mark)))))
9241 (mark (or mark gnus-del-mark)))
9243 (gnus-summary-mark-article nil mark no-expire)
9244 (zerop (gnus-summary-next-subject
9246 (and gnus-summary-goto-unread
9247 (not (eq gnus-summary-goto-unread 'never)))
9251 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9252 (gnus-summary-recenter)
9253 (gnus-summary-position-point)
9254 (gnus-set-mode-line 'summary)
9257 (defun gnus-summary-mark-article-as-read (mark)
9258 "Mark the current article quickly as read with MARK."
9259 (let ((article (gnus-summary-article-number)))
9260 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9261 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9262 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9263 (push (cons article mark) gnus-newsgroup-reads)
9264 ;; Possibly remove from cache, if that is used.
9265 (when gnus-use-cache
9266 (gnus-cache-enter-remove-article article))
9267 ;; Allow the backend to change the mark.
9268 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9269 ;; Check for auto-expiry.
9270 (when (and gnus-newsgroup-auto-expire
9271 (memq mark gnus-auto-expirable-marks))
9272 (setq mark gnus-expirable-mark)
9273 ;; Let the backend know about the mark change.
9274 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9275 (push article gnus-newsgroup-expirable))
9276 ;; Set the mark in the buffer.
9277 (gnus-summary-update-mark mark 'unread)
9280 (defun gnus-summary-mark-article-as-unread (mark)
9281 "Mark the current article quickly as unread with MARK."
9282 (let* ((article (gnus-summary-article-number))
9283 (old-mark (gnus-summary-article-mark article)))
9284 ;; Allow the backend to change the mark.
9285 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9286 (if (eq mark old-mark)
9290 (gnus-error 1 "Can't mark negative article numbers")
9292 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9293 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9294 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9295 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9296 (cond ((= mark gnus-ticked-mark)
9297 (setq gnus-newsgroup-marked
9298 (gnus-add-to-sorted-list gnus-newsgroup-marked
9300 ((= mark gnus-dormant-mark)
9301 (setq gnus-newsgroup-dormant
9302 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9305 (setq gnus-newsgroup-unreads
9306 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9308 (gnus-pull article gnus-newsgroup-reads)
9310 ;; See whether the article is to be put in the cache.
9312 (vectorp (gnus-summary-article-header article))
9314 (gnus-cache-possibly-enter-article
9315 gnus-newsgroup-name article
9316 (= mark gnus-ticked-mark)
9317 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9320 (gnus-summary-update-mark mark 'unread)
9323 (defun gnus-summary-mark-article (&optional article mark no-expire)
9324 "Mark ARTICLE with MARK. MARK can be any character.
9325 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9326 `??' (dormant) and `?E' (expirable).
9327 If MARK is nil, then the default character `?r' is used.
9328 If ARTICLE is nil, then the article on the current line will be
9330 Iff NO-EXPIRE, auto-expiry will be inhibited."
9331 ;; The mark might be a string.
9332 (when (stringp mark)
9333 (setq mark (aref mark 0)))
9334 ;; If no mark is given, then we check auto-expiring.
9336 (setq mark gnus-del-mark))
9337 (when (and (not no-expire)
9338 gnus-newsgroup-auto-expire
9339 (memq mark gnus-auto-expirable-marks))
9340 (setq mark gnus-expirable-mark))
9341 (let ((article (or article (gnus-summary-article-number)))
9342 (old-mark (gnus-summary-article-mark article)))
9343 ;; Allow the backend to change the mark.
9344 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9345 (if (eq mark old-mark)
9348 (error "No article on current line"))
9349 (if (not (if (or (= mark gnus-unread-mark)
9350 (= mark gnus-ticked-mark)
9351 (= mark gnus-dormant-mark))
9352 (gnus-mark-article-as-unread article mark)
9353 (gnus-mark-article-as-read article mark)))
9355 ;; See whether the article is to be put in the cache.
9357 (not (= mark gnus-canceled-mark))
9358 (vectorp (gnus-summary-article-header article))
9360 (gnus-cache-possibly-enter-article
9361 gnus-newsgroup-name article
9362 (= mark gnus-ticked-mark)
9363 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9365 (when (gnus-summary-goto-subject article nil t)
9366 (let ((buffer-read-only nil))
9367 (gnus-summary-show-thread)
9369 (gnus-summary-update-mark mark 'unread)
9372 (defun gnus-summary-update-secondary-mark (article)
9373 "Update the secondary (read, process, cache) mark."
9374 (gnus-summary-update-mark
9375 (cond ((memq article gnus-newsgroup-processable)
9377 ((memq article gnus-newsgroup-cached)
9379 ((memq article gnus-newsgroup-replied)
9381 ((memq article gnus-newsgroup-forwarded)
9382 gnus-forwarded-mark)
9383 ((memq article gnus-newsgroup-saved)
9385 ((memq article gnus-newsgroup-recent)
9387 ((memq article gnus-newsgroup-unseen)
9391 (when (gnus-visual-p 'summary-highlight 'highlight)
9392 (gnus-run-hooks 'gnus-summary-update-hook))
9395 (defun gnus-summary-update-mark (mark type)
9396 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9397 (buffer-read-only nil))
9398 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9400 (when (looking-at "\r")
9402 (when (<= (+ forward (point)) (point-max))
9403 ;; Go to the right position on the line.
9404 (goto-char (+ forward (point)))
9405 ;; Replace the old mark with the new mark.
9406 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9407 ;; Optionally update the marks by some user rule.
9408 (when (eq type 'unread)
9410 (gnus-data-find (gnus-summary-article-number)) mark)
9411 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9413 (defun gnus-mark-article-as-read (article &optional mark)
9414 "Enter ARTICLE in the pertinent lists and remove it from others."
9415 ;; Make the article expirable.
9416 (let ((mark (or mark gnus-del-mark)))
9417 (setq gnus-newsgroup-expirable
9418 (if (= mark gnus-expirable-mark)
9419 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9420 (delq article gnus-newsgroup-expirable)))
9421 ;; Remove from unread and marked lists.
9422 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9423 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9424 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9425 (push (cons article mark) gnus-newsgroup-reads)
9426 ;; Possibly remove from cache, if that is used.
9427 (when gnus-use-cache
9428 (gnus-cache-enter-remove-article article))
9431 (defun gnus-mark-article-as-unread (article &optional mark)
9432 "Enter ARTICLE in the pertinent lists and remove it from others."
9433 (let ((mark (or mark gnus-ticked-mark)))
9436 (gnus-error 1 "Can't mark negative article numbers")
9438 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9439 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9440 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9441 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9443 ;; Unsuppress duplicates?
9444 (when gnus-suppress-duplicates
9445 (gnus-dup-unsuppress-article article))
9447 (cond ((= mark gnus-ticked-mark)
9448 (setq gnus-newsgroup-marked
9449 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
9450 ((= mark gnus-dormant-mark)
9451 (setq gnus-newsgroup-dormant
9452 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
9454 (setq gnus-newsgroup-unreads
9455 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
9456 (gnus-pull article gnus-newsgroup-reads)
9459 (defalias 'gnus-summary-mark-as-unread-forward
9460 'gnus-summary-tick-article-forward)
9461 (make-obsolete 'gnus-summary-mark-as-unread-forward
9462 'gnus-summary-tick-article-forward)
9463 (defun gnus-summary-tick-article-forward (n)
9464 "Tick N articles forwards.
9465 If N is negative, tick backwards instead.
9466 The difference between N and the number of articles ticked is returned."
9468 (gnus-summary-mark-forward n gnus-ticked-mark))
9470 (defalias 'gnus-summary-mark-as-unread-backward
9471 'gnus-summary-tick-article-backward)
9472 (make-obsolete 'gnus-summary-mark-as-unread-backward
9473 'gnus-summary-tick-article-backward)
9474 (defun gnus-summary-tick-article-backward (n)
9475 "Tick N articles backwards.
9476 The difference between N and the number of articles ticked is returned."
9478 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
9480 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9481 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9482 (defun gnus-summary-tick-article (&optional article clear-mark)
9483 "Mark current article as unread.
9484 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9485 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9487 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
9490 (defun gnus-summary-mark-as-read-forward (n)
9491 "Mark N articles as read forwards.
9492 If N is negative, mark backwards instead.
9493 The difference between N and the actual number of articles marked is
9496 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
9498 (defun gnus-summary-mark-as-read-backward (n)
9499 "Mark the N articles as read backwards.
9500 The difference between N and the actual number of articles marked is
9503 (gnus-summary-mark-forward
9504 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
9506 (defun gnus-summary-mark-as-read (&optional article mark)
9507 "Mark current article as read.
9508 ARTICLE specifies the article to be marked as read.
9509 MARK specifies a string to be inserted at the beginning of the line."
9510 (gnus-summary-mark-article article mark))
9512 (defun gnus-summary-clear-mark-forward (n)
9513 "Clear marks from N articles forward.
9514 If N is negative, clear backward instead.
9515 The difference between N and the number of marks cleared is returned."
9517 (gnus-summary-mark-forward n gnus-unread-mark))
9519 (defun gnus-summary-clear-mark-backward (n)
9520 "Clear marks from N articles backward.
9521 The difference between N and the number of marks cleared is returned."
9523 (gnus-summary-mark-forward (- n) gnus-unread-mark))
9525 (defun gnus-summary-mark-unread-as-read ()
9526 "Intended to be used by `gnus-summary-mark-article-hook'."
9527 (when (memq gnus-current-article gnus-newsgroup-unreads)
9528 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
9530 (defun gnus-summary-mark-read-and-unread-as-read ()
9531 "Intended to be used by `gnus-summary-mark-article-hook'."
9532 (let ((mark (gnus-summary-article-mark)))
9533 (when (or (gnus-unread-mark-p mark)
9534 (gnus-read-mark-p mark))
9535 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
9537 (defun gnus-summary-mark-unread-as-ticked ()
9538 "Intended to be used by `gnus-summary-mark-article-hook'."
9539 (when (memq gnus-current-article gnus-newsgroup-unreads)
9540 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
9542 (defun gnus-summary-mark-region-as-read (point mark all)
9543 "Mark all unread articles between point and mark as read.
9544 If given a prefix, mark all articles between point and mark as read,
9545 even ticked and dormant ones."
9546 (interactive "r\nP")
9555 (memq (setq article (gnus-summary-article-number))
9556 gnus-newsgroup-unreads))
9557 (gnus-summary-mark-article article gnus-del-mark))
9559 (gnus-summary-find-next))))))
9561 (defun gnus-summary-mark-below (score mark)
9562 "Mark articles with score less than SCORE with MARK."
9563 (interactive "P\ncMark: ")
9564 (setq score (if score
9565 (prefix-numeric-value score)
9566 (or gnus-summary-default-score 0)))
9568 (set-buffer gnus-summary-buffer)
9569 (goto-char (point-min))
9572 (and (< (gnus-summary-article-score) score)
9573 (gnus-summary-mark-article nil mark))
9574 (gnus-summary-find-next)))))
9576 (defun gnus-summary-kill-below (&optional score)
9577 "Mark articles with score below SCORE as read."
9579 (gnus-summary-mark-below score gnus-killed-mark))
9581 (defun gnus-summary-clear-above (&optional score)
9582 "Clear all marks from articles with score above SCORE."
9584 (gnus-summary-mark-above score gnus-unread-mark))
9586 (defun gnus-summary-tick-above (&optional score)
9587 "Tick all articles with score above SCORE."
9589 (gnus-summary-mark-above score gnus-ticked-mark))
9591 (defun gnus-summary-mark-above (score mark)
9592 "Mark articles with score over SCORE with MARK."
9593 (interactive "P\ncMark: ")
9594 (setq score (if score
9595 (prefix-numeric-value score)
9596 (or gnus-summary-default-score 0)))
9598 (set-buffer gnus-summary-buffer)
9599 (goto-char (point-min))
9601 (when (> (gnus-summary-article-score) score)
9602 (gnus-summary-mark-article nil mark))
9604 (gnus-summary-find-next)))))
9606 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9607 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
9608 (defun gnus-summary-limit-include-expunged (&optional no-error)
9609 "Display all the hidden articles that were expunged for low scores."
9611 (let ((buffer-read-only nil))
9612 (let ((scored gnus-newsgroup-scored)
9615 (unless (gnus-summary-article-header (caar scored))
9616 (and (setq h (gnus-number-to-header (caar scored)))
9617 (< (cdar scored) gnus-summary-expunge-below)
9619 (setq scored (cdr scored)))
9621 (when (not no-error)
9622 (error "No expunged articles hidden"))
9623 (goto-char (point-min))
9624 (push gnus-newsgroup-limit gnus-newsgroup-limits)
9625 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
9626 (mapcar (lambda (x) (push (mail-header-number x)
9627 gnus-newsgroup-limit))
9629 (gnus-summary-prepare-unthreaded (nreverse headers))
9630 (goto-char (point-min))
9631 (gnus-summary-position-point)
9634 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
9635 "Mark all unread articles in this newsgroup as read.
9636 If prefix argument ALL is non-nil, ticked and dormant articles will
9637 also be marked as read.
9638 If QUIETLY is non-nil, no questions will be asked.
9639 If TO-HERE is non-nil, it should be a point in the buffer. All
9640 articles before (after, if REVERSE is set) this point will be marked as read.
9641 Note that this function will only catch up the unread article
9642 in the current summary buffer limitation.
9643 The number of articles marked as read is returned."
9648 (not gnus-interactive-catchup) ;Without confirmation?
9652 "Mark absolutely all articles as read? "
9653 "Mark all unread articles as read? ")))
9655 (not gnus-newsgroup-adaptive)
9656 (not gnus-newsgroup-auto-expire)
9657 (not gnus-suppress-duplicates)
9658 (or (not gnus-use-cache)
9659 (eq gnus-use-cache 'passive)))
9662 (setq gnus-newsgroup-marked nil
9663 gnus-newsgroup-dormant nil))
9664 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
9665 ;; We actually mark all articles as canceled, which we
9666 ;; have to do when using auto-expiry or adaptive scoring.
9667 (gnus-summary-show-all-threads)
9668 (if (and to-here reverse)
9672 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9673 (gnus-summary-find-next (not all) nil nil t))))
9674 (when (gnus-summary-first-subject (not all) t)
9676 (if to-here (< (point) to-here) t)
9677 (gnus-summary-mark-article-as-read gnus-catchup-mark)
9678 (gnus-summary-find-next (not all) nil nil t)))))
9679 (gnus-set-mode-line 'summary))
9681 (gnus-summary-position-point)))
9683 (defun gnus-summary-catchup-to-here (&optional all)
9684 "Mark all unticked articles before the current one as read.
9685 If ALL is non-nil, also mark ticked and dormant articles as read."
9688 (gnus-save-hidden-threads
9689 (let ((beg (point)))
9690 ;; We check that there are unread articles.
9691 (when (or all (gnus-summary-find-prev))
9692 (gnus-summary-catchup all t beg)))))
9693 (gnus-summary-position-point))
9695 (defun gnus-summary-catchup-from-here (&optional all)
9696 "Mark all unticked articles after the current one as read.
9697 If ALL is non-nil, also mark ticked and dormant articles as read."
9700 (gnus-save-hidden-threads
9701 (let ((beg (point)))
9702 ;; We check that there are unread articles.
9703 (when (or all (gnus-summary-find-next))
9704 (gnus-summary-catchup all t beg nil t)))))
9706 (gnus-summary-position-point))
9707 (defun gnus-summary-catchup-all (&optional quietly)
9708 "Mark all articles in this newsgroup as read."
9710 (gnus-summary-catchup t quietly))
9712 (defun gnus-summary-catchup-and-exit (&optional all quietly)
9713 "Mark all unread articles in this group as read, then exit.
9714 If prefix argument ALL is non-nil, all articles are marked as read.
9715 If QUIETLY is non-nil, no questions will be asked."
9717 (when (gnus-summary-catchup all quietly nil 'fast)
9718 ;; Select next newsgroup or exit.
9719 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
9720 (eq gnus-auto-select-next 'quietly))
9721 (gnus-summary-next-group nil)
9722 (gnus-summary-exit))))
9724 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
9725 "Mark all articles in this newsgroup as read, and then exit."
9727 (gnus-summary-catchup-and-exit t quietly))
9729 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
9730 "Mark all articles in this group as read and select the next group.
9731 If given a prefix, mark all articles, unread as well as ticked, as
9735 (gnus-summary-catchup all))
9736 (gnus-summary-next-group))
9742 (defmacro gnus-with-article (article &rest forms)
9743 "Select ARTICLE and perform FORMS in the original article buffer.
9744 Then replace the article with the result."
9746 ;; We don't want the article to be marked as read.
9747 (let (gnus-mark-article-hook)
9748 (gnus-summary-select-article t t nil ,article))
9749 (set-buffer gnus-original-article-buffer)
9751 (if (not (gnus-check-backend-function
9752 'request-replace-article (car gnus-article-current)))
9753 (gnus-message 5 "Read-only group; not replacing")
9754 (unless (gnus-request-replace-article
9755 ,article (car gnus-article-current)
9757 (error "Couldn't replace article")))
9758 ;; The cache and backlog have to be flushed somewhat.
9759 (when gnus-keep-backlog
9760 (gnus-backlog-remove-article
9761 (car gnus-article-current) (cdr gnus-article-current)))
9762 (when gnus-use-cache
9763 (gnus-cache-update-article
9764 (car gnus-article-current) (cdr gnus-article-current)))))
9766 (put 'gnus-with-article 'lisp-indent-function 1)
9767 (put 'gnus-with-article 'edebug-form-spec '(form body))
9769 ;; Thread-based commands.
9771 (defun gnus-summary-articles-in-thread (&optional article)
9772 "Return a list of all articles in the current thread.
9773 If ARTICLE is non-nil, return all articles in the thread that starts
9775 (let* ((article (or article (gnus-summary-article-number)))
9776 (data (gnus-data-find-list article))
9777 (top-level (gnus-data-level (car data)))
9779 (cond ((null gnus-thread-operation-ignore-subject)
9780 (gnus-simplify-subject-re
9781 (mail-header-subject (gnus-data-header (car data)))))
9782 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
9783 (gnus-simplify-subject-fuzzy
9784 (mail-header-subject (gnus-data-header (car data)))))
9786 (end-point (save-excursion
9787 (if (gnus-summary-go-to-next-thread)
9788 (point) (point-max))))
9791 (< (gnus-data-pos (car data)) end-point))
9792 (when (or (not top-subject)
9793 (string= top-subject
9794 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
9795 (gnus-simplify-subject-fuzzy
9796 (mail-header-subject
9797 (gnus-data-header (car data))))
9798 (gnus-simplify-subject-re
9799 (mail-header-subject
9800 (gnus-data-header (car data)))))))
9801 (push (gnus-data-number (car data)) articles))
9802 (unless (and (setq data (cdr data))
9803 (> (gnus-data-level (car data)) top-level))
9805 ;; Return the list of articles.
9806 (nreverse articles)))
9808 (defun gnus-summary-rethread-current ()
9809 "Rethread the thread the current article is part of."
9811 (let* ((gnus-show-threads t)
9812 (article (gnus-summary-article-number))
9813 (id (mail-header-id (gnus-summary-article-header)))
9814 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
9816 (error "No article on the current line"))
9817 (gnus-rebuild-thread id)
9818 (gnus-summary-goto-subject article)))
9820 (defun gnus-summary-reparent-thread ()
9821 "Make the current article child of the marked (or previous) article.
9823 Note that the re-threading will only work if `gnus-thread-ignore-subject'
9824 is non-nil or the Subject: of both articles are the same."
9826 (unless (not (gnus-group-read-only-p))
9827 (error "The current newsgroup does not support article editing"))
9828 (unless (<= (length gnus-newsgroup-processable) 1)
9829 (error "No more than one article may be marked"))
9830 (save-window-excursion
9831 (let ((gnus-article-buffer " *reparent*")
9832 (current-article (gnus-summary-article-number))
9833 ;; First grab the marked article, otherwise one line up.
9834 (parent-article (if (not (null gnus-newsgroup-processable))
9835 (car gnus-newsgroup-processable)
9837 (if (eq (forward-line -1) 0)
9838 (gnus-summary-article-number)
9839 (error "Beginning of summary buffer"))))))
9840 (unless (not (eq current-article parent-article))
9841 (error "An article may not be self-referential"))
9842 (let ((message-id (mail-header-id
9843 (gnus-summary-article-header parent-article))))
9844 (unless (and message-id (not (equal message-id "")))
9845 (error "No message-id in desired parent"))
9846 (gnus-with-article current-article
9848 (goto-char (point-min))
9849 (message-narrow-to-head)
9850 (if (re-search-forward "^References: " nil t)
9852 (re-search-forward "^[^ \t]" nil t)
9855 (insert " " message-id))
9856 (insert "References: " message-id "\n"))))
9857 (set-buffer gnus-summary-buffer)
9858 (gnus-summary-unmark-all-processable)
9859 (gnus-summary-update-article current-article)
9860 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9861 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
9862 (gnus-summary-rethread-current)
9863 (gnus-message 3 "Article %d is now the child of article %d"
9864 current-article parent-article)))))
9866 (defun gnus-summary-toggle-threads (&optional arg)
9867 "Toggle showing conversation threads.
9868 If ARG is positive number, turn showing conversation threads on."
9870 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
9871 (setq gnus-show-threads
9872 (if (null arg) (not gnus-show-threads)
9873 (> (prefix-numeric-value arg) 0)))
9874 (gnus-summary-prepare)
9875 (gnus-summary-goto-subject current)
9876 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
9877 (gnus-summary-position-point)))
9879 (defun gnus-summary-show-all-threads ()
9883 (let ((buffer-read-only nil))
9884 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
9885 (gnus-summary-position-point))
9887 (defun gnus-summary-show-thread ()
9888 "Show thread subtrees.
9889 Returns nil if no thread was there to be shown."
9891 (let ((buffer-read-only nil)
9893 ;; first goto end then to beg, to have point at beg after let
9894 (end (progn (end-of-line) (point)))
9895 (beg (progn (beginning-of-line) (point))))
9897 ;; Any hidden lines here?
9898 (search-forward "\r" end t)
9899 (subst-char-in-region beg end ?\^M ?\n t)
9901 (gnus-summary-position-point))))
9903 (defun gnus-summary-maybe-hide-threads ()
9904 "If requested, hide the threads that should be hidden."
9905 (when (and gnus-show-threads
9906 gnus-thread-hide-subtree)
9907 (gnus-summary-hide-all-threads
9908 (if (or (consp gnus-thread-hide-subtree)
9909 (gnus-functionp gnus-thread-hide-subtree))
9910 (gnus-make-predicate gnus-thread-hide-subtree)
9913 ;;; Hiding predicates.
9915 (defun gnus-article-unread-p (header)
9916 (memq (mail-header-number header) gnus-newsgroup-unreads))
9918 (defun gnus-article-unseen-p (header)
9919 (memq (mail-header-number header) gnus-newsgroup-unseen))
9921 (defun gnus-map-articles (predicate articles)
9922 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
9923 (apply 'gnus-or (mapcar predicate
9924 (mapcar 'gnus-summary-article-header articles))))
9926 (defun gnus-summary-hide-all-threads (&optional predicate)
9927 "Hide all thread subtrees.
9928 If PREDICATE is supplied, threads that satisfy this predicate
9929 will not be hidden."
9932 (goto-char (point-min))
9935 (when (or (not predicate)
9937 predicate (gnus-summary-article-children)))
9938 (gnus-summary-hide-thread))
9939 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
9940 (gnus-summary-position-point))
9942 (defun gnus-summary-hide-thread ()
9943 "Hide thread subtrees.
9944 If PREDICATE is supplied, threads that satisfy this predicate
9946 Returns nil if no threads were there to be hidden."
9948 (let ((buffer-read-only nil)
9950 (article (gnus-summary-article-number)))
9952 ;; Go forward until either the buffer ends or the subthread
9954 (when (and (not (eobp))
9955 (or (zerop (gnus-summary-next-thread 1 t))
9956 (goto-char (point-max))))
9958 (if (and (> (point) start)
9959 (search-backward "\n" start t))
9961 (subst-char-in-region start (point) ?\n ?\^M)
9962 (gnus-summary-goto-subject article))
9966 (defun gnus-summary-go-to-next-thread (&optional previous)
9967 "Go to the same level (or less) next thread.
9968 If PREVIOUS is non-nil, go to previous thread instead.
9969 Return the article number moved to, or nil if moving was impossible."
9970 (let ((level (gnus-summary-thread-level))
9971 (way (if previous -1 1))
9974 (while (and (not (eobp))
9975 (< level (gnus-summary-thread-level)))
9983 (gnus-summary-article-number)
9986 (defun gnus-summary-next-thread (n &optional silent)
9987 "Go to the same level next N'th thread.
9988 If N is negative, search backward instead.
9989 Returns the difference between N and the number of skips actually
9992 If SILENT, don't output messages."
9994 (let ((backward (< n 0))
9997 (gnus-summary-go-to-next-thread backward))
10000 (gnus-summary-position-point))
10001 (when (and (not silent) (/= 0 n))
10002 (gnus-message 7 "No more threads"))
10005 (defun gnus-summary-prev-thread (n)
10006 "Go to the same level previous N'th thread.
10007 Returns the difference between N and the number of skips actually
10010 (gnus-summary-next-thread (- n)))
10012 (defun gnus-summary-go-down-thread ()
10013 "Go down one level in the current thread."
10014 (let ((children (gnus-summary-article-children)))
10016 (gnus-summary-goto-subject (car children)))))
10018 (defun gnus-summary-go-up-thread ()
10019 "Go up one level in the current thread."
10020 (let ((parent (gnus-summary-article-parent)))
10022 (gnus-summary-goto-subject parent))))
10024 (defun gnus-summary-down-thread (n)
10025 "Go down thread N steps.
10026 If N is negative, go up instead.
10027 Returns the difference between N and how many steps down that were
10032 (while (and (> n 0)
10033 (if up (gnus-summary-go-up-thread)
10034 (gnus-summary-go-down-thread)))
10036 (gnus-summary-position-point)
10038 (gnus-message 7 "Can't go further"))
10041 (defun gnus-summary-up-thread (n)
10042 "Go up thread N steps.
10043 If N is negative, go down instead.
10044 Returns the difference between N and how many steps down that were
10047 (gnus-summary-down-thread (- n)))
10049 (defun gnus-summary-top-thread ()
10050 "Go to the top of the thread."
10052 (while (gnus-summary-go-up-thread))
10053 (gnus-summary-article-number))
10055 (defun gnus-summary-kill-thread (&optional unmark)
10056 "Mark articles under current thread as read.
10057 If the prefix argument is positive, remove any kinds of marks.
10058 If the prefix argument is negative, tick articles instead."
10061 (setq unmark (prefix-numeric-value unmark)))
10062 (let ((articles (gnus-summary-articles-in-thread)))
10064 ;; Expand the thread.
10065 (gnus-summary-show-thread)
10066 ;; Mark all the articles.
10068 (gnus-summary-goto-subject (car articles))
10069 (cond ((null unmark)
10070 (gnus-summary-mark-article-as-read gnus-killed-mark))
10072 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10074 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10075 (setq articles (cdr articles))))
10076 ;; Hide killed subtrees.
10078 gnus-thread-hide-killed
10079 (gnus-summary-hide-thread))
10080 ;; If marked as read, go to next unread subject.
10081 (when (null unmark)
10082 ;; Go to next unread subject.
10083 (gnus-summary-next-subject 1 t)))
10084 (gnus-set-mode-line 'summary))
10086 ;; Summary sorting commands
10088 (defun gnus-summary-sort-by-number (&optional reverse)
10089 "Sort the summary buffer by article number.
10090 Argument REVERSE means reverse order."
10092 (gnus-summary-sort 'number reverse))
10094 (defun gnus-summary-sort-by-author (&optional reverse)
10095 "Sort the summary buffer by author name alphabetically.
10096 If `case-fold-search' is non-nil, case of letters is ignored.
10097 Argument REVERSE means reverse order."
10099 (gnus-summary-sort 'author reverse))
10101 (defun gnus-summary-sort-by-subject (&optional reverse)
10102 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10103 If `case-fold-search' is non-nil, case of letters is ignored.
10104 Argument REVERSE means reverse order."
10106 (gnus-summary-sort 'subject reverse))
10108 (defun gnus-summary-sort-by-date (&optional reverse)
10109 "Sort the summary buffer by date.
10110 Argument REVERSE means reverse order."
10112 (gnus-summary-sort 'date reverse))
10114 (defun gnus-summary-sort-by-score (&optional reverse)
10115 "Sort the summary buffer by score.
10116 Argument REVERSE means reverse order."
10118 (gnus-summary-sort 'score reverse))
10120 (defun gnus-summary-sort-by-lines (&optional reverse)
10121 "Sort the summary buffer by the number of lines.
10122 Argument REVERSE means reverse order."
10124 (gnus-summary-sort 'lines reverse))
10126 (defun gnus-summary-sort-by-chars (&optional reverse)
10127 "Sort the summary buffer by article length.
10128 Argument REVERSE means reverse order."
10130 (gnus-summary-sort 'chars reverse))
10132 (defun gnus-summary-sort-by-original (&optional reverse)
10133 "Sort the summary buffer using the default sorting method.
10134 Argument REVERSE means reverse order."
10136 (let* ((buffer-read-only)
10137 (gnus-summary-prepare-hook nil))
10138 ;; We do the sorting by regenerating the threads.
10139 (gnus-summary-prepare)
10140 ;; Hide subthreads if needed.
10141 (gnus-summary-maybe-hide-threads)))
10143 (defun gnus-summary-sort (predicate reverse)
10144 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10145 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10146 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10147 (gnus-thread-sort-functions
10152 (gnus-sort-gathered-threads-function
10153 gnus-thread-sort-functions)
10154 (gnus-article-sort-functions
10158 (,article t2 t1))))
10160 (gnus-summary-prepare-hook nil))
10161 ;; We do the sorting by regenerating the threads.
10162 (gnus-summary-prepare)
10163 ;; Hide subthreads if needed.
10164 (gnus-summary-maybe-hide-threads)))
10166 ;; Summary saving commands.
10168 (defun gnus-summary-save-article (&optional n not-saved)
10169 "Save the current article using the default saver function.
10170 If N is a positive number, save the N next articles.
10171 If N is a negative number, save the N previous articles.
10172 If N is nil and any articles have been marked with the process mark,
10173 save those articles instead.
10174 The variable `gnus-default-article-saver' specifies the saver function."
10176 (let* ((articles (gnus-summary-work-articles n))
10177 (save-buffer (save-excursion
10178 (nnheader-set-temp-buffer " *Gnus Save*")))
10179 (num (length articles))
10181 (dolist (article articles)
10182 (setq header (gnus-summary-article-header article))
10183 (if (not (vectorp header))
10184 ;; This is a pseudo-article.
10185 (if (assq 'name header)
10186 (gnus-copy-file (cdr (assq 'name header)))
10187 (gnus-message 1 "Article %d is unsaveable" article))
10188 ;; This is a real article.
10189 (save-window-excursion
10190 (let ((gnus-display-mime-function nil)
10191 (gnus-article-prepare-hook nil))
10192 (gnus-summary-select-article t nil nil article)))
10194 (set-buffer save-buffer)
10196 (insert-buffer-substring gnus-original-article-buffer))
10197 (setq file (gnus-article-save save-buffer file num))
10198 (gnus-summary-remove-process-mark article)
10200 (gnus-summary-set-saved-mark article))))
10201 (gnus-kill-buffer save-buffer)
10202 (gnus-summary-position-point)
10203 (gnus-set-mode-line 'summary)
10206 (defun gnus-summary-pipe-output (&optional arg)
10207 "Pipe the current article to a subprocess.
10208 If N is a positive number, pipe the N next articles.
10209 If N is a negative number, pipe the N previous articles.
10210 If N is nil and any articles have been marked with the process mark,
10211 pipe those articles instead."
10213 (require 'gnus-art)
10214 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
10215 (gnus-summary-save-article arg t))
10216 (let ((buffer (get-buffer "*Shell Command Output*")))
10218 (with-current-buffer buffer (> (point-max) (point-min))))
10219 (gnus-configure-windows 'pipe))))
10221 (defun gnus-summary-save-article-mail (&optional arg)
10222 "Append the current article to an mail file.
10223 If N is a positive number, save the N next articles.
10224 If N is a negative number, save the N previous articles.
10225 If N is nil and any articles have been marked with the process mark,
10226 save those articles instead."
10228 (require 'gnus-art)
10229 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10230 (gnus-summary-save-article arg)))
10232 (defun gnus-summary-save-article-rmail (&optional arg)
10233 "Append the current article to an rmail file.
10234 If N is a positive number, save the N next articles.
10235 If N is a negative number, save the N previous articles.
10236 If N is nil and any articles have been marked with the process mark,
10237 save those articles instead."
10239 (require 'gnus-art)
10240 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10241 (gnus-summary-save-article arg)))
10243 (defun gnus-summary-save-article-file (&optional arg)
10244 "Append the current article to a file.
10245 If N is a positive number, save the N next articles.
10246 If N is a negative number, save the N previous articles.
10247 If N is nil and any articles have been marked with the process mark,
10248 save those articles instead."
10250 (require 'gnus-art)
10251 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10252 (gnus-summary-save-article arg)))
10254 (defun gnus-summary-write-article-file (&optional arg)
10255 "Write the current article to a file, deleting the previous file.
10256 If N is a positive number, save the N next articles.
10257 If N is a negative number, save the N previous articles.
10258 If N is nil and any articles have been marked with the process mark,
10259 save those articles instead."
10261 (require 'gnus-art)
10262 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10263 (gnus-summary-save-article arg)))
10265 (defun gnus-summary-save-article-body-file (&optional arg)
10266 "Append the current article body to a file.
10267 If N is a positive number, save the N next articles.
10268 If N is a negative number, save the N previous articles.
10269 If N is nil and any articles have been marked with the process mark,
10270 save those articles instead."
10272 (require 'gnus-art)
10273 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10274 (gnus-summary-save-article arg)))
10276 (defun gnus-summary-muttprint (&optional arg)
10277 "Print the current article using Muttprint.
10278 If N is a positive number, save the N next articles.
10279 If N is a negative number, save the N previous articles.
10280 If N is nil and any articles have been marked with the process mark,
10281 save those articles instead."
10283 (require 'gnus-art)
10284 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10285 (gnus-summary-save-article arg t)))
10287 (defun gnus-summary-pipe-message (program)
10288 "Pipe the current article through PROGRAM."
10289 (interactive "sProgram: ")
10290 (gnus-summary-select-article)
10291 (let ((mail-header-separator ""))
10292 (gnus-eval-in-buffer-window gnus-article-buffer
10295 (let ((start (window-start))
10297 (message-pipe-buffer-body program)
10298 (set-window-start (get-buffer-window (current-buffer)) start))))))
10300 (defun gnus-get-split-value (methods)
10301 "Return a value based on the split METHODS."
10302 (let (split-name method result match)
10305 (set-buffer gnus-original-article-buffer)
10307 (nnheader-narrow-to-headers)
10308 (while (and methods (not split-name))
10309 (goto-char (point-min))
10310 (setq method (pop methods))
10311 (setq match (car method))
10314 ;; Regular expression.
10316 (re-search-forward match nil t)))
10317 ((gnus-functionp match)
10321 (setq result (funcall match gnus-newsgroup-name))))
10326 (setq result (eval match)))))
10327 (setq split-name (cdr method))
10328 (cond ((stringp result)
10329 (push (expand-file-name
10330 result gnus-article-save-directory)
10333 (setq split-name (append result split-name)))))))))
10334 (nreverse split-name)))
10336 (defun gnus-valid-move-group-p (group)
10337 (and (boundp group)
10338 (symbol-name group)
10339 (symbol-value group)
10340 (gnus-get-function (gnus-find-method-for-group
10341 (symbol-name group)) 'request-accept-article t)))
10343 (defun gnus-read-move-group-name (prompt default articles prefix)
10344 "Read a group name."
10345 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10346 (minibuffer-confirm-incomplete nil) ; XEmacs
10348 (format "%s %s to:"
10350 (if (> (length articles) 1)
10351 (format "these %d articles" (length articles))
10356 (gnus-completing-read-with-default
10359 'gnus-valid-move-group-p
10361 'gnus-group-history))
10362 ((= 1 (length split-name))
10363 (gnus-completing-read-with-default
10364 (car split-name) prom
10366 'gnus-valid-move-group-p
10368 'gnus-group-history))
10370 (gnus-completing-read-with-default
10372 (mapcar (lambda (el) (list el))
10373 (nreverse split-name))
10375 'gnus-group-history))))
10376 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10378 (if (or (string= to-newsgroup "")
10379 (string= to-newsgroup prefix))
10380 (setq to-newsgroup default))
10381 (unless to-newsgroup
10382 (error "No group name entered"))
10383 (or (gnus-active to-newsgroup)
10384 (gnus-activate-group to-newsgroup nil nil to-method)
10385 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10387 (or (and (gnus-request-create-group to-newsgroup to-method)
10388 (gnus-activate-group
10389 to-newsgroup nil nil to-method)
10390 (gnus-subscribe-group to-newsgroup))
10391 (error "Couldn't create group %s" to-newsgroup)))
10392 (error "No such group: %s" to-newsgroup)))
10395 (defun gnus-summary-save-parts (type dir n &optional reverse)
10396 "Save parts matching TYPE to DIR.
10397 If REVERSE, save parts that do not match TYPE."
10399 (list (read-string "Save parts of type: "
10400 (or (car gnus-summary-save-parts-type-history)
10401 gnus-summary-save-parts-default-mime)
10402 'gnus-summary-save-parts-type-history)
10403 (setq gnus-summary-save-parts-last-directory
10404 (read-file-name "Save to directory: "
10405 gnus-summary-save-parts-last-directory
10407 current-prefix-arg))
10408 (gnus-summary-iterate n
10409 (let ((gnus-display-mime-function nil)
10410 (gnus-inhibit-treatment t))
10411 (gnus-summary-select-article))
10413 (set-buffer gnus-article-buffer)
10414 (let ((handles (or gnus-article-mime-handles
10415 (mm-dissect-buffer nil gnus-article-loose-mime)
10418 (gnus-summary-save-parts-1 type dir handles reverse)
10419 (unless gnus-article-mime-handles ;; Don't destroy this case.
10420 (mm-destroy-parts handles)))))))
10422 (defun gnus-summary-save-parts-1 (type dir handle reverse)
10423 (if (stringp (car handle))
10424 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
10427 (not (string-match type (mm-handle-media-type handle)))
10428 (string-match type (mm-handle-media-type handle)))
10429 (let ((file (expand-file-name
10430 (file-name-nondirectory
10432 (mail-content-type-get
10433 (mm-handle-disposition handle) 'filename)
10434 (concat gnus-newsgroup-name
10435 "." (number-to-string
10436 (cdr gnus-article-current)))))
10438 (unless (file-exists-p file)
10439 (mm-save-part-to-file handle file))))))
10441 ;; Summary extract commands
10443 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
10444 (let ((buffer-read-only nil)
10445 (article (gnus-summary-article-number))
10447 (unless (gnus-summary-goto-subject article)
10448 (error "No such article: %d" article))
10449 (gnus-summary-position-point)
10450 ;; If all commands are to be bunched up on one line, we collect
10452 (unless gnus-view-pseudos-separately
10453 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
10456 (setq action (cdr (assq 'action (car ps))))
10457 (setq files (list (cdr (assq 'name (car ps)))))
10458 (while (and ps (cdr ps)
10459 (string= (or action "1")
10460 (or (cdr (assq 'action (cadr ps))) "2")))
10461 (push (cdr (assq 'name (cadr ps))) files)
10462 (setcdr ps (cddr ps)))
10464 (when (not (string-match "%s" action))
10467 (when (assq 'execute (car ps))
10468 (setcdr (assq 'execute (car ps))
10469 (funcall (if (string-match "%s" action)
10478 (setq ps (cdr ps)))))
10479 (if (and gnus-view-pseudos (not not-view))
10481 (when (assq 'execute (car pslist))
10482 (gnus-execute-command (cdr (assq 'execute (car pslist)))
10483 (eq gnus-view-pseudos 'not-confirm)))
10484 (setq pslist (cdr pslist)))
10487 (setq after-article (or (cdr (assq 'article (car pslist)))
10488 (gnus-summary-article-number)))
10489 (gnus-summary-goto-subject after-article)
10492 (insert " " (file-name-nondirectory
10493 (cdr (assq 'name (car pslist))))
10494 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
10496 (forward-line -1) ; back to `b'
10497 (gnus-add-text-properties
10498 b (1- e) (list 'gnus-number gnus-reffed-article-number
10499 gnus-mouse-face-prop gnus-mouse-face))
10501 after-article gnus-reffed-article-number
10502 gnus-unread-mark b (car pslist) 0 (- e b))
10503 (setq gnus-newsgroup-unreads
10504 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10505 gnus-reffed-article-number))
10506 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
10507 (setq pslist (cdr pslist)))))))
10509 (defun gnus-pseudos< (p1 p2)
10510 (let ((c1 (cdr (assq 'action p1)))
10511 (c2 (cdr (assq 'action p2))))
10512 (and c1 c2 (string< c1 c2))))
10514 (defun gnus-request-pseudo-article (props)
10515 (cond ((assq 'execute props)
10516 (gnus-execute-command (cdr (assq 'execute props)))))
10517 (let ((gnus-current-article (gnus-summary-article-number)))
10518 (gnus-run-hooks 'gnus-mark-article-hook)))
10520 (defun gnus-execute-command (command &optional automatic)
10522 (gnus-article-setup-buffer)
10523 (set-buffer gnus-article-buffer)
10524 (setq buffer-read-only nil)
10525 (let ((command (if automatic command
10526 (read-string "Command: " (cons command 0)))))
10528 (insert "$ " command "\n\n")
10529 (if gnus-view-pseudo-asynchronously
10530 (start-process "gnus-execute" (current-buffer) shell-file-name
10531 shell-command-switch command)
10532 (call-process shell-file-name nil t nil
10533 shell-command-switch command)))))
10535 ;; Summary kill commands.
10537 (defun gnus-summary-edit-global-kill (article)
10538 "Edit the \"global\" kill file."
10539 (interactive (list (gnus-summary-article-number)))
10540 (gnus-group-edit-global-kill article))
10542 (defun gnus-summary-edit-local-kill ()
10543 "Edit a local kill file applied to the current newsgroup."
10545 (setq gnus-current-headers (gnus-summary-article-header))
10546 (gnus-group-edit-local-kill
10547 (gnus-summary-article-number) gnus-newsgroup-name))
10549 ;;; Header reading.
10551 (defun gnus-read-header (id &optional header)
10552 "Read the headers of article ID and enter them into the Gnus system."
10553 (let ((group gnus-newsgroup-name)
10554 (gnus-override-method
10556 gnus-override-method
10557 (and (gnus-news-group-p gnus-newsgroup-name)
10558 (car (gnus-refer-article-methods)))))
10560 ;; First we check to see whether the header in question is already
10563 ;; This is a Message-ID.
10564 (setq header (or header (gnus-id-to-header id)))
10565 ;; This is an article number.
10566 (setq header (or header (gnus-summary-article-header id))))
10568 (not (gnus-summary-article-sparse-p (mail-header-number header))))
10569 ;; We have found the header.
10571 ;; If this is a sparse article, we have to nix out its
10572 ;; previous entry in the thread hashtb.
10574 (gnus-summary-article-sparse-p (mail-header-number header)))
10575 (let* ((parent (gnus-parent-id (mail-header-references header)))
10576 (thread (and parent (gnus-id-to-thread parent))))
10578 (delq (assq header thread) thread))))
10579 ;; We have to really fetch the header to this article.
10581 (set-buffer nntp-server-buffer)
10582 (when (setq where (gnus-request-head id group))
10583 (nnheader-fold-continuation-lines)
10584 (goto-char (point-max))
10586 (goto-char (point-min))
10590 ((cdr where) (cdr where))
10591 (header (mail-header-number header))
10592 (t gnus-reffed-article-number))
10594 (insert " Article retrieved.\n"))
10595 (if (or (not where)
10596 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
10597 () ; Malformed head.
10598 (unless (gnus-summary-article-sparse-p (mail-header-number header))
10599 (when (and (stringp id)
10600 (not (string= (gnus-group-real-name group)
10602 ;; If we fetched by Message-ID and the article came
10603 ;; from a different group, we fudge some bogus article
10604 ;; numbers for this article.
10605 (mail-header-set-number header gnus-reffed-article-number))
10607 (set-buffer gnus-summary-buffer)
10608 (decf gnus-reffed-article-number)
10609 (gnus-remove-header (mail-header-number header))
10610 (push header gnus-newsgroup-headers)
10611 (setq gnus-current-headers header)
10612 (push (mail-header-number header) gnus-newsgroup-limit)))
10615 (defun gnus-remove-header (number)
10616 "Remove header NUMBER from `gnus-newsgroup-headers'."
10617 (if (and gnus-newsgroup-headers
10618 (= number (mail-header-number (car gnus-newsgroup-headers))))
10619 (pop gnus-newsgroup-headers)
10620 (let ((headers gnus-newsgroup-headers))
10621 (while (and (cdr headers)
10622 (not (= number (mail-header-number (cadr headers)))))
10624 (when (cdr headers)
10625 (setcdr headers (cddr headers))))))
10628 ;;; summary highlights
10631 (defun gnus-highlight-selected-summary ()
10632 "Highlight selected article in summary buffer."
10633 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
10634 (when gnus-summary-selected-face
10636 (let* ((beg (progn (beginning-of-line) (point)))
10637 (end (progn (end-of-line) (point)))
10638 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
10639 (from (if (get-text-property beg gnus-mouse-face-prop)
10641 (or (next-single-property-change
10642 beg gnus-mouse-face-prop nil end)
10647 (or (next-single-property-change
10648 from gnus-mouse-face-prop nil end)
10650 ;; If no mouse-face prop on line we will have to = from = end,
10651 ;; so we highlight the entire line instead.
10652 (when (= (+ to 2) from)
10655 (if gnus-newsgroup-selected-overlay
10656 ;; Move old overlay.
10658 gnus-newsgroup-selected-overlay from to (current-buffer))
10659 ;; Create new overlay.
10661 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
10662 'face gnus-summary-selected-face))))))
10664 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
10665 (defun gnus-summary-highlight-line ()
10666 "Highlight current line according to `gnus-summary-highlight'."
10667 (let* ((list gnus-summary-highlight)
10668 (beg (gnus-point-at-bol))
10669 (article (gnus-summary-article-number))
10670 (score (or (cdr (assq (or article gnus-current-article)
10671 gnus-newsgroup-scored))
10672 gnus-summary-default-score 0))
10673 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
10674 (inhibit-read-only t)
10675 (default gnus-summary-default-score)
10676 (default-high gnus-summary-default-high-score)
10677 (default-low gnus-summary-default-low-score))
10678 ;; Eval the cars of the lists until we find a match.
10680 (not (eval (caar list))))
10681 (setq list (cdr list)))
10682 (let ((face (cdar list)))
10683 (unless (eq face (get-text-property beg 'face))
10684 (gnus-put-text-property-excluding-characters-with-faces
10685 beg (gnus-point-at-eol) 'face
10686 (setq face (if (boundp face) (symbol-value face) face)))
10687 (when gnus-summary-highlight-line-function
10688 (funcall gnus-summary-highlight-line-function article face))))))
10690 (defun gnus-update-read-articles (group unread &optional compute)
10691 "Update the list of read articles in GROUP.
10692 UNREAD is a sorted list."
10693 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
10694 (entry (gnus-gethash group gnus-newsrc-hashtb))
10695 (info (nth 2 entry))
10698 (if (or (not info) (not active))
10699 ;; There is no info on this group if it was, in fact,
10700 ;; killed. Gnus stores no information on killed groups, so
10701 ;; there's nothing to be done.
10702 ;; One could store the information somewhere temporarily,
10703 ;; perhaps... Hmmm...
10705 ;; Remove any negative articles numbers.
10706 (while (and unread (< (car unread) 0))
10707 (setq unread (cdr unread)))
10708 ;; Remove any expired article numbers
10709 (while (and unread (< (car unread) (car active)))
10710 (setq unread (cdr unread)))
10711 ;; Compute the ranges of read articles by looking at the list of
10712 ;; unread articles.
10714 (when (/= (car unread) prev)
10715 (push (if (= prev (1- (car unread))) prev
10716 (cons prev (1- (car unread))))
10718 (setq prev (1+ (car unread)))
10719 (setq unread (cdr unread)))
10720 (when (<= prev (cdr active))
10721 (push (cons prev (cdr active)) read))
10722 (setq read (if (> (length read) 1) (nreverse read) read))
10727 ;; Propagate the read marks to the backend.
10728 (when (gnus-check-backend-function 'request-set-mark group)
10729 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
10730 (add (gnus-remove-from-range read (gnus-info-read info))))
10732 (unless (gnus-check-group group)
10733 (error "Can't open server for %s" group))
10734 (gnus-request-set-mark
10735 group (delq nil (list (if add (list add 'add '(read)))
10736 (if del (list del 'del '(read))))))
10738 `(gnus-request-set-mark
10741 (if del (list del 'add '(read)))
10742 (if add (list add 'del '(read))))))))))
10743 (set-buffer gnus-group-buffer)
10744 (gnus-undo-register
10746 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
10747 (gnus-info-set-read ',info ',(gnus-info-read info))
10748 (gnus-get-unread-articles-in-group ',info
10749 (gnus-active ,group))
10750 (gnus-group-update-group ,group t)
10752 ;; Enter this list into the group info.
10753 (gnus-info-set-read info read)
10754 ;; Set the number of unread articles in gnus-newsrc-hashtb.
10755 (gnus-get-unread-articles-in-group info (gnus-active group))
10758 (defun gnus-offer-save-summaries ()
10759 "Offer to save all active summary buffers."
10761 ;; Go through all buffers and find all summaries.
10762 (dolist (buffer (buffer-list))
10763 (when (and (setq buffer (buffer-name buffer))
10764 (string-match "Summary" buffer)
10766 (set-buffer buffer)
10767 ;; We check that this is, indeed, a summary buffer.
10768 (and (eq major-mode 'gnus-summary-mode)
10769 ;; Also make sure this isn't bogus.
10770 gnus-newsgroup-prepared
10771 ;; Also make sure that this isn't a
10772 ;; dead summary buffer.
10773 (not gnus-dead-summary-mode))))
10774 (push buffer buffers)))
10775 ;; Go through all these summary buffers and offer to save them.
10779 "Update summary buffer %s? "
10781 (switch-to-buffer buf)
10782 (gnus-summary-exit))
10785 (defun gnus-summary-setup-default-charset ()
10786 "Setup newsgroup default charset."
10787 (if (equal gnus-newsgroup-name "nndraft:drafts")
10788 (setq gnus-newsgroup-charset nil)
10789 (let* ((ignored-charsets
10790 (or gnus-newsgroup-ephemeral-ignored-charsets
10792 (and gnus-newsgroup-name
10793 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
10794 gnus-newsgroup-ignored-charsets))))
10795 (setq gnus-newsgroup-charset
10796 (or gnus-newsgroup-ephemeral-charset
10797 (and gnus-newsgroup-name
10798 (gnus-parameter-charset gnus-newsgroup-name))
10799 gnus-default-charset))
10800 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
10801 ignored-charsets))))
10807 (defun gnus-summary-display-buttonized (&optional show-all-parts)
10808 "Display the current article buffer fully MIME-buttonized.
10809 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
10810 treated as multipart/mixed."
10812 (require 'gnus-art)
10813 (let ((gnus-unbuttonized-mime-types nil)
10814 (gnus-mime-display-multipart-as-mixed show-all-parts))
10815 (gnus-summary-show-article)))
10817 (defun gnus-summary-repair-multipart (article)
10818 "Add a Content-Type header to a multipart article without one."
10819 (interactive (list (gnus-summary-article-number)))
10820 (gnus-with-article article
10821 (message-narrow-to-head)
10822 (message-remove-header "Mime-Version")
10823 (goto-char (point-max))
10824 (insert "Mime-Version: 1.0\n")
10826 (when (search-forward "\n--" nil t)
10827 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
10828 (message-narrow-to-head)
10829 (message-remove-header "Content-Type")
10830 (goto-char (point-max))
10831 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
10834 (let (gnus-mark-article-hook)
10835 (gnus-summary-select-article t t nil article)))
10837 (defun gnus-summary-toggle-display-buttonized ()
10838 "Toggle the buttonizing of the article buffer."
10840 (require 'gnus-art)
10841 (if (setq gnus-inhibit-mime-unbuttonizing
10842 (not gnus-inhibit-mime-unbuttonizing))
10843 (let ((gnus-unbuttonized-mime-types nil))
10844 (gnus-summary-show-article))
10845 (gnus-summary-show-article)))
10848 ;;; Generic summary marking commands
10851 (defvar gnus-summary-marking-alist
10852 '((read gnus-del-mark "d")
10853 (unread gnus-unread-mark "u")
10854 (ticked gnus-ticked-mark "!")
10855 (dormant gnus-dormant-mark "?")
10856 (expirable gnus-expirable-mark "e"))
10857 "An alist of names/marks/keystrokes.")
10859 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
10860 (defvar gnus-summary-mark-map)
10862 (defun gnus-summary-make-all-marking-commands ()
10863 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
10864 (dolist (elem gnus-summary-marking-alist)
10865 (apply 'gnus-summary-make-marking-command elem)))
10867 (defun gnus-summary-make-marking-command (name mark keystroke)
10868 (let ((map (make-sparse-keymap)))
10869 (define-key gnus-summary-generic-mark-map keystroke map)
10870 (dolist (lway `((next "next" next nil "n")
10871 (next-unread "next unread" next t "N")
10872 (prev "previous" prev nil "p")
10873 (prev-unread "previous unread" prev t "P")
10874 (nomove "" nil nil ,keystroke)))
10875 (let ((func (gnus-summary-make-marking-command-1
10876 mark (car lway) lway name)))
10877 (setq func (eval func))
10878 (define-key map (nth 4 lway) func)))))
10880 (defun gnus-summary-make-marking-command-1 (mark way lway name)
10882 (format "gnus-summary-put-mark-as-%s%s"
10883 name (if (eq way 'nomove)
10885 (concat "-" (symbol-name way)))))
10888 "Mark the current article as %s%s.
10889 If N, the prefix, then repeat N times.
10890 If N is negative, move in reverse order.
10891 The difference between N and the actual number of articles marked is
10895 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
10897 (defun gnus-summary-generic-mark (n mark move unread)
10898 "Mark N articles with MARK."
10899 (unless (eq major-mode 'gnus-summary-mode)
10900 (error "This command can only be used in the summary buffer"))
10901 (gnus-summary-show-thread)
10904 ((eq move 'next) 1)
10905 ((eq move 'prev) -1)
10907 (if (zerop nummove)
10911 nummove (* -1 nummove))))
10912 (while (and (> n 0)
10913 (gnus-summary-mark-article nil mark)
10914 (zerop (gnus-summary-next-subject nummove unread t)))
10917 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10918 (gnus-summary-recenter)
10919 (gnus-summary-position-point)
10920 (gnus-set-mode-line 'summary)
10923 (defun gnus-summary-insert-articles (articles)
10924 (when (setq articles
10925 (gnus-sorted-difference articles
10926 (mapcar (lambda (h)
10927 (mail-header-number h))
10928 gnus-newsgroup-headers)))
10929 (setq gnus-newsgroup-headers
10931 gnus-newsgroup-headers
10932 (gnus-fetch-headers articles)
10933 'gnus-article-sort-by-number))
10934 ;; Suppress duplicates?
10935 (when gnus-suppress-duplicates
10936 (gnus-dup-suppress-articles))
10938 ;; We might want to build some more threads first.
10939 (when (and gnus-fetch-old-headers
10940 (eq gnus-headers-retrieved-by 'nov))
10941 (if (eq gnus-fetch-old-headers 'invisible)
10942 (gnus-build-all-threads)
10943 (gnus-build-old-threads)))
10944 ;; Let the Gnus agent mark articles as read.
10946 (gnus-agent-get-undownloaded-list))
10947 ;; Remove list identifiers from subject
10948 (when gnus-list-identifiers
10949 (gnus-summary-remove-list-identifiers))
10950 ;; First and last article in this newsgroup.
10951 (when gnus-newsgroup-headers
10952 (setq gnus-newsgroup-begin
10953 (mail-header-number (car gnus-newsgroup-headers))
10955 (mail-header-number
10956 (gnus-last-element gnus-newsgroup-headers))))
10957 (when gnus-use-scoring
10958 (gnus-possibly-score-headers))))
10960 (defun gnus-summary-insert-old-articles (&optional all)
10961 "Insert all old articles in this group.
10962 If ALL is non-nil, already read articles become readable.
10963 If ALL is a number, fetch this number of articles."
10966 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
10969 (gnus-sorted-difference
10970 (gnus-uncompress-range (list gnus-newsgroup-active))
10972 (setq len (length older))
10977 (setq older (last older all))))
10980 (if (and (numberp gnus-large-newsgroup)
10981 (> len gnus-large-newsgroup))
10982 (let* ((cursor-in-echo-area nil)
10983 (initial (gnus-parameter-large-newsgroup-initial
10984 gnus-newsgroup-name))
10988 "How many articles from %s (%s %d): "
10990 (gnus-group-decoded-name gnus-newsgroup-name) 35)
10991 (if initial "max" "default")
10994 (cons (number-to-string initial)
10996 (unless (string-match "^[ \t]*$" input)
10997 (setq all (string-to-number input))
10999 (setq older (last older all))))))))
11001 (message "No old news.")
11002 (gnus-summary-insert-articles older)
11003 (gnus-summary-limit (gnus-sorted-nunion old older))))
11004 (gnus-summary-position-point)))
11006 (defun gnus-summary-insert-new-articles ()
11007 "Insert all new articles in this group."
11010 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11011 (old-active gnus-newsgroup-active)
11012 (nnmail-fetched-sources (list t))
11014 (setq gnus-newsgroup-active
11015 (gnus-activate-group gnus-newsgroup-name 'scan))
11016 (setq i (1+ (cdr old-active)))
11017 (while (<= i (cdr gnus-newsgroup-active))
11021 (message "No gnus is bad news.")
11022 (setq new (nreverse new))
11023 (gnus-summary-insert-articles new)
11024 (setq gnus-newsgroup-unreads
11025 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11026 (gnus-summary-limit (gnus-sorted-nunion old new))))
11027 (gnus-summary-position-point)))
11029 (gnus-summary-make-all-marking-commands)
11031 (gnus-ems-redefine)
11033 (provide 'gnus-sum)
11035 (run-hooks 'gnus-sum-load-hook)
11037 ;;; gnus-sum.el ends here