1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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.
31 (defvar tool-bar-map))
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-cache-write-active "gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
48 (autoload 'mm-uu-dissect "mm-uu")
49 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
50 "Deuglify broken Outlook (Express) articles and redisplay."
52 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
53 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
54 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
56 (defcustom gnus-kill-summary-on-exit t
57 "*If non-nil, kill the summary buffer when you exit from it.
58 If nil, the summary will become a \"*Dead Summary*\" buffer, and
59 it will be killed sometime later."
60 :group 'gnus-summary-exit
63 (defcustom gnus-fetch-old-headers nil
64 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
65 If an unread article in the group refers to an older, already read (or
66 just marked as read) article, the old article will not normally be
67 displayed in the Summary buffer. If this variable is non-nil, Gnus
68 will attempt to grab the headers to the old articles, and thereby
69 build complete threads. If it has the value `some', only enough
70 headers to connect otherwise loose threads will be displayed. This
71 variable can also be a number. In that case, no more than that number
72 of old headers will be fetched. If it has the value `invisible', all
73 old headers will be fetched, but none will be displayed.
75 The server has to support NOV for any of this to work."
77 :type '(choice (const :tag "off" nil)
80 (sexp :menu-tag "other" t)))
82 (defcustom gnus-refer-thread-limit 200
83 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
84 If t, fetch all the available old headers."
87 (sexp :menu-tag "other" t)))
89 (defcustom gnus-summary-make-false-root 'adopt
90 "*nil means that Gnus won't gather loose threads.
91 If the root of a thread has expired or been read in a previous
92 session, the information necessary to build a complete thread has been
93 lost. Instead of having many small sub-threads from this original thread
94 scattered all over the summary buffer, Gnus can gather them.
96 If non-nil, Gnus will try to gather all loose sub-threads from an
97 original thread into one large thread.
99 If this variable is non-nil, it should be one of `none', `adopt',
102 If this variable is `none', Gnus will not make a false root, but just
103 present the sub-threads after another.
104 If this variable is `dummy', Gnus will create a dummy root that will
105 have all the sub-threads as children.
106 If this variable is `adopt', Gnus will make one of the \"children\"
107 the parent and mark all the step-children as such.
108 If this variable is `empty', the \"children\" are printed with empty
109 subject fields. (Or rather, they will be printed with a string
110 given by the `gnus-summary-same-subject' variable.)"
112 :type '(choice (const :tag "off" nil)
118 (defcustom gnus-summary-make-false-root-always nil
119 "Always make a false dummy root."
123 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
124 "*A regexp to match subjects to be excluded from loose thread gathering.
125 As loose thread gathering is done on subjects only, that means that
126 there can be many false gatherings performed. By rooting out certain
127 common subjects, gathering might become saner."
131 (defcustom gnus-summary-gather-subject-limit nil
132 "*Maximum length of subject comparisons when gathering loose threads.
133 Use nil to compare full subjects. Setting this variable to a low
134 number will help gather threads that have been corrupted by
135 newsreaders chopping off subject lines, but it might also mean that
136 unrelated articles that have subject that happen to begin with the
137 same few characters will be incorrectly gathered.
139 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
142 :type '(choice (const :tag "off" nil)
144 (sexp :menu-tag "on" t)))
146 (defcustom gnus-simplify-subject-functions nil
147 "List of functions taking a string argument that simplify subjects.
148 The functions are applied recursively.
150 Useful functions to put in this list include:
151 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
152 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
154 :type '(repeat function))
156 (defcustom gnus-simplify-ignored-prefixes nil
157 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
159 :type '(choice (const :tag "off" nil)
162 (defcustom gnus-build-sparse-threads nil
163 "*If non-nil, fill in the gaps in threads.
164 If `some', only fill in the gaps that are needed to tie loose threads
165 together. If `more', fill in all leaf nodes that Gnus can find. If
166 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
168 :type '(choice (const :tag "off" nil)
171 (sexp :menu-tag "all" t)))
173 (defcustom gnus-summary-thread-gathering-function
174 'gnus-gather-threads-by-subject
175 "*Function used for gathering loose threads.
176 There are two pre-defined functions: `gnus-gather-threads-by-subject',
177 which only takes Subjects into consideration; and
178 `gnus-gather-threads-by-references', which compared the References
179 headers of the articles to find matches."
181 :type '(radio (function-item gnus-gather-threads-by-subject)
182 (function-item gnus-gather-threads-by-references)
183 (function :tag "other")))
185 (defcustom gnus-summary-same-subject ""
186 "*String indicating that the current article has the same subject as the previous.
187 This variable will only be used if the value of
188 `gnus-summary-make-false-root' is `empty'."
189 :group 'gnus-summary-format
192 (defcustom gnus-summary-goto-unread t
193 "*If t, many commands will go to the next unread article.
194 This applies to marking commands as well as other commands that
195 \"naturally\" select the next article, like, for instance, `SPC' at
196 the end of an article.
198 If nil, the marking commands do NOT go to the next unread article
199 \(they go to the next article instead). If `never', commands that
200 usually go to the next unread article, will go to the next article,
201 whether it is read or not."
202 :group 'gnus-summary-marks
203 :link '(custom-manual "(gnus)Setting Marks")
204 :type '(choice (const :tag "off" nil)
206 (sexp :menu-tag "on" t)))
208 (defcustom gnus-summary-default-score 0
209 "*Default article score level.
210 All scores generated by the score files will be added to this score.
211 If this variable is nil, scoring will be disabled."
212 :group 'gnus-score-default
213 :type '(choice (const :tag "disable")
216 (defcustom gnus-summary-default-high-score 0
217 "*Default threshold for a high scored article.
218 An article will be highlighted as high scored if its score is greater
220 :group 'gnus-score-default
223 (defcustom gnus-summary-default-low-score 0
224 "*Default threshold for a low scored article.
225 An article will be highlighted as low scored if its score is smaller
227 :group 'gnus-score-default
230 (defcustom gnus-summary-zcore-fuzz 0
231 "*Fuzziness factor for the zcore in the summary buffer.
232 Articles with scores closer than this to `gnus-summary-default-score'
234 :group 'gnus-summary-format
237 (defcustom gnus-simplify-subject-fuzzy-regexp nil
238 "*Strings to be removed when doing fuzzy matches.
239 This can either be a regular expression or list of regular expressions
240 that will be removed from subject strings if fuzzy subject
241 simplification is selected."
243 :type '(repeat regexp))
245 (defcustom gnus-show-threads t
246 "*If non-nil, display threads in summary mode."
250 (defcustom gnus-thread-hide-subtree nil
251 "*If non-nil, hide all threads initially.
252 This can be a predicate specifier which says which threads to hide.
253 If threads are hidden, you have to run the command
254 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
255 to expose hidden threads."
257 :type '(radio (sexp :format "Non-nil\n"
258 :match (lambda (widget value)
259 (not (or (consp value) (functionp value))))
262 (sexp :tag "Predicate specifier" :size 0)))
264 (defcustom gnus-thread-hide-killed t
265 "*If non-nil, hide killed threads automatically."
269 (defcustom gnus-thread-ignore-subject t
270 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
271 If nil, articles that have different subjects from their parents will
272 start separate threads."
276 (defcustom gnus-thread-operation-ignore-subject t
277 "*If non-nil, subjects will be ignored when doing thread commands.
278 This affects commands like `gnus-summary-kill-thread' and
279 `gnus-summary-lower-thread'.
281 If this variable is nil, articles in the same thread with different
282 subjects will not be included in the operation in question. If this
283 variable is `fuzzy', only articles that have subjects that are fuzzily
284 equal will be included."
286 :type '(choice (const :tag "off" nil)
290 (defcustom gnus-thread-indent-level 4
291 "*Number that says how much each sub-thread should be indented."
295 (defcustom gnus-auto-extend-newsgroup t
296 "*If non-nil, extend newsgroup forward and backward when requested."
297 :group 'gnus-summary-choose
300 (defcustom gnus-auto-select-first t
301 "*If non-nil, select the article under point.
302 Which article this is is controlled by the `gnus-auto-select-subject'
305 If you want to prevent automatic selection of articles in some
306 newsgroups, set the variable to nil in `gnus-select-group-hook'."
307 :group 'gnus-group-select
308 :type '(choice (const :tag "none" nil)
309 (sexp :menu-tag "first" t)))
311 (defcustom gnus-auto-select-subject 'unread
312 "*Says what subject to place under point when entering a group.
314 This variable can either be the symbols `first' (place point on the
315 first subject), `unread' (place point on the subject line of the first
316 unread article), `best' (place point on the subject line of the
317 higest-scored article), `unseen' (place point on the subject line of
318 the first unseen article), 'unseen-or-unread' (place point on the subject
319 line of the first unseen article or, if all article have been seen, on the
320 subject line of the first unread article), or a function to be called to
321 place point on some subject line."
322 :group 'gnus-group-select
323 :type '(choice (const best)
327 (const unseen-or-unread)))
329 (defcustom gnus-auto-select-next t
330 "*If non-nil, offer to go to the next group from the end of the previous.
331 If the value is t and the next newsgroup is empty, Gnus will exit
332 summary mode and go back to group mode. If the value is neither nil
333 nor t, Gnus will select the following unread newsgroup. In
334 particular, if the value is the symbol `quietly', the next unread
335 newsgroup will be selected without any confirmation, and if it is
336 `almost-quietly', the next group will be selected without any
337 confirmation if you are located on the last article in the group.
338 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
339 will go to the next group without confirmation."
340 :group 'gnus-summary-maneuvering
341 :type '(choice (const :tag "off" nil)
343 (const almost-quietly)
344 (const slightly-quietly)
345 (sexp :menu-tag "on" t)))
347 (defcustom gnus-auto-select-same nil
348 "*If non-nil, select the next article with the same subject.
349 If there are no more articles with the same subject, go to
350 the first unread article."
351 :group 'gnus-summary-maneuvering
354 (defcustom gnus-auto-goto-ignores 'unfetched
355 "*Says how to handle unfetched articles when maneuvering.
357 This variable can either be the symbols nil (maneuver to any
358 article), `undownloaded' (maneuvering while unplugged ignores articles
359 that have not been fetched), `always-undownloaded' (maneuvering always
360 ignores articles that have not been fetched), `unfetched' (maneuvering
361 ignores articles whose headers have not been fetched).
363 NOTE: The list of unfetched articles will always be nil when plugged
364 and, when unplugged, a subset of the undownloaded article list."
365 :group 'gnus-summary-maneuvering
366 :type '(choice (const :tag "None" nil)
367 (const :tag "Undownloaded when unplugged" undownloaded)
368 (const :tag "Undownloaded" always-undownloaded)
369 (const :tag "Unfetched" unfetched)))
371 (defcustom gnus-summary-check-current nil
372 "*If non-nil, consider the current article when moving.
373 The \"unread\" movement commands will stay on the same line if the
374 current article is unread."
375 :group 'gnus-summary-maneuvering
378 (defcustom gnus-auto-center-summary t
379 "*If non-nil, always center the current summary buffer.
380 In particular, if `vertical' do only vertical recentering. If non-nil
381 and non-`vertical', do both horizontal and vertical recentering."
382 :group 'gnus-summary-maneuvering
383 :type '(choice (const :tag "none" nil)
385 (integer :tag "height")
386 (sexp :menu-tag "both" t)))
388 (defvar gnus-auto-center-group t
389 "*If non-nil, always center the group buffer.")
391 (defcustom gnus-show-all-headers nil
392 "*If non-nil, don't hide any headers."
393 :group 'gnus-article-hiding
394 :group 'gnus-article-headers
397 (defcustom gnus-summary-ignore-duplicates nil
398 "*If non-nil, ignore articles with identical Message-ID headers."
402 (defcustom gnus-single-article-buffer t
403 "*If non-nil, display all articles in the same buffer.
404 If nil, each group will get its own article buffer."
405 :group 'gnus-article-various
408 (defcustom gnus-break-pages t
409 "*If non-nil, do page breaking on articles.
410 The page delimiter is specified by the `gnus-page-delimiter'
412 :group 'gnus-article-various
415 (defcustom gnus-move-split-methods nil
416 "*Variable used to suggest where articles are to be moved to.
417 It uses the same syntax as the `gnus-split-methods' variable.
418 However, whereas `gnus-split-methods' specifies file names as targets,
419 this variable specifies group names."
420 :group 'gnus-summary-mail
421 :type '(repeat (choice (list :value (fun) function)
422 (cons :value ("" "") regexp (repeat string))
425 (defcustom gnus-unread-mark ? ;Whitespace
426 "*Mark used for unread articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-ticked-mark ?!
431 "*Mark used for ticked articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-dormant-mark ??
436 "*Mark used for dormant articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-del-mark ?r
441 "*Mark used for del'd articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-read-mark ?R
446 "*Mark used for read articles."
447 :group 'gnus-summary-marks
450 (defcustom gnus-expirable-mark ?E
451 "*Mark used for expirable articles."
452 :group 'gnus-summary-marks
455 (defcustom gnus-killed-mark ?K
456 "*Mark used for killed articles."
457 :group 'gnus-summary-marks
460 (defcustom gnus-spam-mark ?$
461 "*Mark used for spam articles."
462 :group 'gnus-summary-marks
465 (defcustom gnus-souped-mark ?F
466 "*Mark used for souped articles."
467 :group 'gnus-summary-marks
470 (defcustom gnus-kill-file-mark ?X
471 "*Mark used for articles killed by kill files."
472 :group 'gnus-summary-marks
475 (defcustom gnus-low-score-mark ?Y
476 "*Mark used for articles with a low score."
477 :group 'gnus-summary-marks
480 (defcustom gnus-catchup-mark ?C
481 "*Mark used for articles that are caught up."
482 :group 'gnus-summary-marks
485 (defcustom gnus-replied-mark ?A
486 "*Mark used for articles that have been replied to."
487 :group 'gnus-summary-marks
490 (defcustom gnus-forwarded-mark ?F
491 "*Mark used for articles that have been forwarded."
492 :group 'gnus-summary-marks
495 (defcustom gnus-recent-mark ?N
496 "*Mark used for articles that are recent."
497 :group 'gnus-summary-marks
500 (defcustom gnus-cached-mark ?*
501 "*Mark used for articles that are in the cache."
502 :group 'gnus-summary-marks
505 (defcustom gnus-saved-mark ?S
506 "*Mark used for articles that have been saved."
507 :group 'gnus-summary-marks
510 (defcustom gnus-unseen-mark ?.
511 "*Mark used for articles that haven't been seen."
512 :group 'gnus-summary-marks
515 (defcustom gnus-no-mark ? ;Whitespace
516 "*Mark used for articles that have no other secondary mark."
517 :group 'gnus-summary-marks
520 (defcustom gnus-ancient-mark ?O
521 "*Mark used for ancient articles."
522 :group 'gnus-summary-marks
525 (defcustom gnus-sparse-mark ?Q
526 "*Mark used for sparsely reffed articles."
527 :group 'gnus-summary-marks
530 (defcustom gnus-canceled-mark ?G
531 "*Mark used for canceled articles."
532 :group 'gnus-summary-marks
535 (defcustom gnus-duplicate-mark ?M
536 "*Mark used for duplicate articles."
537 :group 'gnus-summary-marks
540 (defcustom gnus-undownloaded-mark ?-
541 "*Mark used for articles that weren't downloaded."
542 :group 'gnus-summary-marks
545 (defcustom gnus-downloaded-mark ?+
546 "*Mark used for articles that were downloaded."
547 :group 'gnus-summary-marks
550 (defcustom gnus-downloadable-mark ?%
551 "*Mark used for articles that are to be downloaded."
552 :group 'gnus-summary-marks
555 (defcustom gnus-unsendable-mark ?=
556 "*Mark used for articles that won't be sent."
557 :group 'gnus-summary-marks
560 (defcustom gnus-score-over-mark ?+
561 "*Score mark used for articles with high scores."
562 :group 'gnus-summary-marks
565 (defcustom gnus-score-below-mark ?-
566 "*Score mark used for articles with low scores."
567 :group 'gnus-summary-marks
570 (defcustom gnus-empty-thread-mark ? ;Whitespace
571 "*There is no thread under the article."
572 :group 'gnus-summary-marks
575 (defcustom gnus-not-empty-thread-mark ?=
576 "*There is a thread under the article."
577 :group 'gnus-summary-marks
580 (defcustom gnus-view-pseudo-asynchronously nil
581 "*If non-nil, Gnus will view pseudo-articles asynchronously."
582 :group 'gnus-extract-view
585 (defcustom gnus-auto-expirable-marks
586 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
587 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
588 gnus-souped-mark gnus-duplicate-mark)
589 "*The list of marks converted into expiration if a group is auto-expirable."
592 :type '(repeat character))
594 (defcustom gnus-inhibit-user-auto-expire t
595 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
600 (defcustom gnus-view-pseudos nil
601 "*If `automatic', pseudo-articles will be viewed automatically.
602 If `not-confirm', pseudos will be viewed automatically, and the user
603 will not be asked to confirm the command."
604 :group 'gnus-extract-view
605 :type '(choice (const :tag "off" nil)
607 (const not-confirm)))
609 (defcustom gnus-view-pseudos-separately t
610 "*If non-nil, one pseudo-article will be created for each file to be viewed.
611 If nil, all files that use the same viewing command will be given as a
612 list of parameters to that command."
613 :group 'gnus-extract-view
616 (defcustom gnus-insert-pseudo-articles t
617 "*If non-nil, insert pseudo-articles when decoding articles."
618 :group 'gnus-extract-view
621 (defcustom gnus-summary-dummy-line-format
623 "*The format specification for the dummy roots in the summary buffer.
624 It works along the same lines as a normal formatting string,
625 with some simple extensions.
629 General format specifiers can also be used.
630 See `(gnus)Formatting Variables'."
631 :link '(custom-manual "(gnus)Formatting Variables")
632 :group 'gnus-threading
635 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
636 "*The format specification for the summary mode line.
637 It works along the same lines as a normal formatting string,
638 with some simple extensions:
641 %p Unprefixed group name
642 %A Current article number
643 %z Current article score
645 %U Number of unread articles in the group
646 %e Number of unselected articles in the group
647 %Z A string with unread/unselected article counts
648 %g Shortish group name
649 %S Subject of the current article
651 %s Current score file name
652 %d Number of dormant articles
653 %r Number of articles that have been marked as read in this session
654 %E Number of articles expunged by the score files"
655 :group 'gnus-summary-format
658 (defcustom gnus-list-identifiers nil
659 "Regexp that matches list identifiers to be removed from subject.
660 This can also be a list of regexps."
662 :group 'gnus-summary-format
663 :group 'gnus-article-hiding
664 :type '(choice (const :tag "none" nil)
666 (repeat :value (".*") regexp)))
668 (defcustom gnus-summary-mark-below 0
669 "*Mark all articles with a score below this variable as read.
670 This variable is local to each summary buffer and usually set by the
672 :group 'gnus-score-default
675 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
676 "*List of functions used for sorting articles in the summary buffer.
678 Each function takes two articles and returns non-nil if the first
679 article should be sorted before the other. If you use more than one
680 function, the primary sort function should be the last. You should
681 probably always include `gnus-article-sort-by-number' in the list of
682 sorting functions -- preferably first. Also note that sorting by date
683 is often much slower than sorting by number, and the sorting order is
684 very similar. (Sorting by date means sorting by the time the message
685 was sent, sorting by number means sorting by arrival time.)
687 Ready-made functions include `gnus-article-sort-by-number',
688 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
689 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
690 and `gnus-article-sort-by-score'.
692 When threading is turned on, the variable `gnus-thread-sort-functions'
693 controls how articles are sorted."
694 :group 'gnus-summary-sort
695 :type '(repeat (choice (function-item gnus-article-sort-by-number)
696 (function-item gnus-article-sort-by-author)
697 (function-item gnus-article-sort-by-subject)
698 (function-item gnus-article-sort-by-date)
699 (function-item gnus-article-sort-by-score)
700 (function-item gnus-article-sort-by-random)
701 (function :tag "other"))))
703 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
704 "*List of functions used for sorting threads in the summary buffer.
705 By default, threads are sorted by article number.
707 Each function takes two threads and returns non-nil if the first
708 thread should be sorted before the other. If you use more than one
709 function, the primary sort function should be the last. You should
710 probably always include `gnus-thread-sort-by-number' in the list of
711 sorting functions -- preferably first. Also note that sorting by date
712 is often much slower than sorting by number, and the sorting order is
713 very similar. (Sorting by date means sorting by the time the message
714 was sent, sorting by number means sorting by arrival time.)
716 Ready-made functions include `gnus-thread-sort-by-number',
717 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
718 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
719 `gnus-thread-sort-by-most-recent-number',
720 `gnus-thread-sort-by-most-recent-date',
721 `gnus-thread-sort-by-random', and
722 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
724 When threading is turned off, the variable
725 `gnus-article-sort-functions' controls how articles are sorted."
726 :group 'gnus-summary-sort
727 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
728 (function-item gnus-thread-sort-by-author)
729 (function-item gnus-thread-sort-by-subject)
730 (function-item gnus-thread-sort-by-date)
731 (function-item gnus-thread-sort-by-score)
732 (function-item gnus-thread-sort-by-total-score)
733 (function-item gnus-thread-sort-by-random)
734 (function :tag "other"))))
736 (defcustom gnus-thread-score-function '+
737 "*Function used for calculating the total score of a thread.
739 The function is called with the scores of the article and each
740 subthread and should then return the score of the thread.
742 Some functions you can use are `+', `max', or `min'."
743 :group 'gnus-summary-sort
746 (defcustom gnus-summary-expunge-below nil
747 "All articles that have a score less than this variable will be expunged.
748 This variable is local to the summary buffers."
749 :group 'gnus-score-default
750 :type '(choice (const :tag "off" nil)
753 (defcustom gnus-thread-expunge-below nil
754 "All threads that have a total score less than this variable will be expunged.
755 See `gnus-thread-score-function' for en explanation of what a
758 This variable is local to the summary buffers."
759 :group 'gnus-threading
760 :group 'gnus-score-default
761 :type '(choice (const :tag "off" nil)
764 (defcustom gnus-summary-mode-hook nil
765 "*A hook for Gnus summary mode.
766 This hook is run before any variables are set in the summary buffer."
767 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
768 :group 'gnus-summary-various
771 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
772 (when (featurep 'xemacs)
773 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
774 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
775 (add-hook 'gnus-summary-mode-hook
776 'gnus-xmas-switch-horizontal-scrollbar-off))
778 (defcustom gnus-summary-menu-hook nil
779 "*Hook run after the creation of the summary mode menu."
780 :group 'gnus-summary-visual
783 (defcustom gnus-summary-exit-hook nil
784 "*A hook called on exit from the summary buffer.
785 It will be called with point in the group buffer."
786 :group 'gnus-summary-exit
789 (defcustom gnus-summary-prepare-hook nil
790 "*A hook called after the summary buffer has been generated.
791 If you want to modify the summary buffer, you can use this hook."
792 :group 'gnus-summary-various
795 (defcustom gnus-summary-prepared-hook nil
796 "*A hook called as the last thing after the summary buffer has been generated."
797 :group 'gnus-summary-various
800 (defcustom gnus-summary-generate-hook nil
801 "*A hook run just before generating the summary buffer.
802 This hook is commonly used to customize threading variables and the
804 :group 'gnus-summary-various
807 (defcustom gnus-select-group-hook nil
808 "*A hook called when a newsgroup is selected.
810 If you'd like to simplify subjects like the
811 `gnus-summary-next-same-subject' command does, you can use the
814 (add-hook gnus-select-group-hook
816 (mapcar (lambda (header)
817 (mail-header-set-subject
819 (gnus-simplify-subject
820 (mail-header-subject header) 're-only)))
821 gnus-newsgroup-headers)))"
822 :group 'gnus-group-select
825 (defcustom gnus-select-article-hook nil
826 "*A hook called when an article is selected."
827 :group 'gnus-summary-choose
828 :options '(gnus-agent-fetch-selected-article)
831 (defcustom gnus-visual-mark-article-hook
832 (list 'gnus-highlight-selected-summary)
833 "*Hook run after selecting an article in the summary buffer.
834 It is meant to be used for highlighting the article in some way. It
835 is not run if `gnus-visual' is nil."
836 :group 'gnus-summary-visual
839 (defcustom gnus-parse-headers-hook nil
840 "*A hook called before parsing the headers."
844 (defcustom gnus-exit-group-hook nil
845 "*A hook called when exiting summary mode.
846 This hook is not called from the non-updating exit commands like `Q'."
850 (defcustom gnus-summary-update-hook
851 (list 'gnus-summary-highlight-line)
852 "*A hook called when a summary line is changed.
853 The hook will not be called if `gnus-visual' is nil.
855 The default function `gnus-summary-highlight-line' will
856 highlight the line according to the `gnus-summary-highlight'
858 :group 'gnus-summary-visual
861 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
862 "*A hook called when an article is selected for the first time.
863 The hook is intended to mark an article as read (or unread)
864 automatically when it is selected."
865 :group 'gnus-summary-choose
868 (defcustom gnus-group-no-more-groups-hook nil
869 "*A hook run when returning to group mode having no more (unread) groups."
870 :group 'gnus-group-select
873 (defcustom gnus-ps-print-hook nil
874 "*A hook run before ps-printing something from Gnus."
878 (defcustom gnus-summary-article-move-hook nil
879 "*A hook called after an article is moved, copied, respooled, or crossposted."
883 (defcustom gnus-summary-article-delete-hook nil
884 "*A hook called after an article is deleted."
888 (defcustom gnus-summary-article-expire-hook nil
889 "*A hook called after an article is expired."
893 (defcustom gnus-summary-display-arrow
894 (and (fboundp 'display-graphic-p)
896 "*If non-nil, display an arrow highlighting the current article."
901 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
902 "Face used for highlighting the current article in the summary buffer."
903 :group 'gnus-summary-visual
906 (defvar gnus-tmp-downloaded nil)
908 (defcustom gnus-summary-highlight
909 '(((eq mark gnus-canceled-mark)
910 . gnus-summary-cancelled-face)
911 ((and uncached (> score default-high))
912 . gnus-summary-high-undownloaded-face)
913 ((and uncached (< score default-low))
914 . gnus-summary-low-undownloaded-face)
916 . gnus-summary-normal-undownloaded-face)
917 ((and (> score default-high)
918 (or (eq mark gnus-dormant-mark)
919 (eq mark gnus-ticked-mark)))
920 . gnus-summary-high-ticked-face)
921 ((and (< score default-low)
922 (or (eq mark gnus-dormant-mark)
923 (eq mark gnus-ticked-mark)))
924 . gnus-summary-low-ticked-face)
925 ((or (eq mark gnus-dormant-mark)
926 (eq mark gnus-ticked-mark))
927 . gnus-summary-normal-ticked-face)
928 ((and (> score default-high) (eq mark gnus-ancient-mark))
929 . gnus-summary-high-ancient-face)
930 ((and (< score default-low) (eq mark gnus-ancient-mark))
931 . gnus-summary-low-ancient-face)
932 ((eq mark gnus-ancient-mark)
933 . gnus-summary-normal-ancient-face)
934 ((and (> score default-high) (eq mark gnus-unread-mark))
935 . gnus-summary-high-unread-face)
936 ((and (< score default-low) (eq mark gnus-unread-mark))
937 . gnus-summary-low-unread-face)
938 ((eq mark gnus-unread-mark)
939 . gnus-summary-normal-unread-face)
940 ((> score default-high)
941 . gnus-summary-high-read-face)
942 ((< score default-low)
943 . gnus-summary-low-read-face)
945 . gnus-summary-normal-read-face))
946 "*Controls the highlighting of summary buffer lines.
948 A list of (FORM . FACE) pairs. When deciding how a a particular
949 summary line should be displayed, each form is evaluated. The content
950 of the face field after the first true form is used. You can change
951 how those summary lines are displayed, by editing the face field.
953 You can use the following variables in the FORM field.
955 score: The article's score
956 default: The default article score.
957 default-high: The default score for high scored articles.
958 default-low: The default score for low scored articles.
959 below: The score below which articles are automatically marked as read.
960 mark: The article's mark.
961 uncached: Non-nil if the article is uncached."
962 :group 'gnus-summary-visual
963 :type '(repeat (cons (sexp :tag "Form" nil)
966 (defcustom gnus-alter-header-function nil
967 "Function called to allow alteration of article header structures.
968 The function is called with one parameter, the article header vector,
969 which it may alter in any way."
970 :type '(choice (const :tag "None" nil)
972 :group 'gnus-summary)
974 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
975 "Variable that says which function should be used to decode a string with encoded words.")
977 (defcustom gnus-extra-headers '(To Newsgroups)
978 "*Extra headers to parse."
981 :type '(repeat symbol))
983 (defcustom gnus-ignored-from-addresses
984 (and user-mail-address (regexp-quote user-mail-address))
985 "*Regexp of From headers that may be suppressed in favor of To headers."
990 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
991 "List of charsets that should be ignored.
992 When these charsets are used in the \"charset\" parameter, the
993 default charset will be used instead."
995 :type '(repeat symbol)
996 :group 'gnus-charset)
998 (gnus-define-group-parameter
1002 "Return the ignored charsets of GROUP."
1003 :variable gnus-group-ignored-charsets-alist
1005 '(("alt\\.chinese\\.text" iso-8859-1))
1007 "Alist of regexps (to match group names) and charsets that should be ignored.
1008 When these charsets are used in the \"charset\" parameter, the
1009 default charset will be used instead."
1010 :variable-group gnus-charset
1011 :variable-type '(repeat (cons (regexp :tag "Group")
1013 :parameter-type '(choice :tag "Ignored charsets"
1016 :parameter-document "\
1017 List of charsets that should be ignored.
1019 When these charsets are used in the \"charset\" parameter, the
1020 default charset will be used instead.")
1022 (defcustom gnus-group-highlight-words-alist nil
1023 "Alist of group regexps and highlight regexps.
1024 This variable uses the same syntax as `gnus-emphasis-alist'."
1026 :type '(repeat (cons (regexp :tag "Group")
1027 (repeat (list (regexp :tag "Highlight regexp")
1028 (number :tag "Group for entire word" 0)
1029 (number :tag "Group for displayed part" 0)
1031 gnus-emphasis-highlight-words)))))
1032 :group 'gnus-summary-visual)
1034 (defcustom gnus-summary-show-article-charset-alist
1036 "Alist of number and charset.
1037 The article will be shown with the charset corresponding to the
1039 For example: ((1 . cn-gb-2312) (2 . big5))."
1041 :type '(repeat (cons (number :tag "Argument" 1)
1042 (symbol :tag "Charset")))
1043 :group 'gnus-charset)
1045 (defcustom gnus-preserve-marks t
1046 "Whether marks are preserved when moving, copying and respooling messages."
1049 :group 'gnus-summary-marks)
1051 (defcustom gnus-alter-articles-to-read-function nil
1052 "Function to be called to alter the list of articles to be selected."
1053 :type '(choice (const nil) function)
1054 :group 'gnus-summary)
1056 (defcustom gnus-orphan-score nil
1057 "*All orphans get this score added. Set in the score file."
1058 :group 'gnus-score-default
1059 :type '(choice (const nil)
1062 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1063 "*A regexp to match MIME parts when saving multiple parts of a
1064 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1065 This regexp will be used by default when prompting the user for which
1066 type of files to save."
1067 :group 'gnus-summary
1070 (defcustom gnus-read-all-available-headers nil
1071 "Whether Gnus should parse all headers made available to it.
1072 This is mostly relevant for slow back ends where the user may
1073 wish to widen the summary buffer to include all headers
1074 that were fetched. Say, for nnultimate groups."
1075 :group 'gnus-summary
1076 :type '(choice boolean regexp))
1078 (defcustom gnus-summary-muttprint-program "muttprint"
1079 "Command (and optional arguments) used to run Muttprint."
1081 :group 'gnus-summary
1084 (defcustom gnus-article-loose-mime nil
1085 "If non-nil, don't require MIME-Version header.
1086 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1087 supply the MIME-Version header or deliberately strip it From the mail.
1088 Set it to non-nil, Gnus will treat some articles as MIME even if
1089 the MIME-Version header is missed."
1092 :group 'gnus-article-mime)
1094 (defcustom gnus-article-emulate-mime t
1095 "If non-nil, use MIME emulation for uuencode and the like.
1096 This means that Gnus will search message bodies for text that look
1097 like uuencoded bits, yEncoded bits, and so on, and present that using
1098 the normal Gnus MIME machinery."
1100 :group 'gnus-article-mime)
1102 ;;; Internal variables
1104 (defvar gnus-summary-display-cache nil)
1105 (defvar gnus-article-mime-handles nil)
1106 (defvar gnus-article-decoded-p nil)
1107 (defvar gnus-article-charset nil)
1108 (defvar gnus-article-ignored-charsets nil)
1109 (defvar gnus-scores-exclude-files nil)
1110 (defvar gnus-page-broken nil)
1112 (defvar gnus-original-article nil)
1113 (defvar gnus-article-internal-prepare-hook nil)
1114 (defvar gnus-newsgroup-process-stack nil)
1116 (defvar gnus-thread-indent-array nil)
1117 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1118 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1119 "Function called to sort the articles within a thread after it has been gathered together.")
1121 (defvar gnus-summary-save-parts-type-history nil)
1122 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1124 ;; Avoid highlighting in kill files.
1125 (defvar gnus-summary-inhibit-highlight nil)
1126 (defvar gnus-newsgroup-selected-overlay nil)
1127 (defvar gnus-inhibit-limiting nil)
1128 (defvar gnus-newsgroup-adaptive-score-file nil)
1129 (defvar gnus-current-score-file nil)
1130 (defvar gnus-current-move-group nil)
1131 (defvar gnus-current-copy-group nil)
1132 (defvar gnus-current-crosspost-group nil)
1133 (defvar gnus-newsgroup-display nil)
1135 (defvar gnus-newsgroup-dependencies nil)
1136 (defvar gnus-newsgroup-adaptive nil)
1137 (defvar gnus-summary-display-article-function nil)
1138 (defvar gnus-summary-highlight-line-function nil
1139 "Function called after highlighting a summary line.")
1141 (defvar gnus-summary-line-format-alist
1142 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1143 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1144 (?s gnus-tmp-subject-or-nil ?s)
1145 (?n gnus-tmp-name ?s)
1146 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1148 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1150 (?F gnus-tmp-from ?s)
1151 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1152 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1153 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1154 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1155 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1156 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1157 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1158 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1159 (?L gnus-tmp-lines ?s)
1160 (?O gnus-tmp-downloaded ?c)
1161 (?I gnus-tmp-indentation ?s)
1162 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1163 (?R gnus-tmp-replied ?c)
1164 (?\[ gnus-tmp-opening-bracket ?c)
1165 (?\] gnus-tmp-closing-bracket ?c)
1166 (?\> (make-string gnus-tmp-level ? ) ?s)
1167 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1168 (?i gnus-tmp-score ?d)
1169 (?z gnus-tmp-score-char ?c)
1170 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1171 (?U gnus-tmp-unread ?c)
1172 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1174 (?t (gnus-summary-number-of-articles-in-thread
1175 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1177 (?e (gnus-summary-number-of-articles-in-thread
1178 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1180 (?u gnus-tmp-user-defined ?s)
1181 (?P (gnus-pick-line-number) ?d)
1182 (?B gnus-tmp-thread-tree-header-string ?s)
1183 (user-date (gnus-user-date
1184 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1185 "An alist of format specifications that can appear in summary lines.
1186 These are paired with what variables they correspond with, along with
1187 the type of the variable (string, integer, character, etc).")
1189 (defvar gnus-summary-dummy-line-format-alist
1190 `((?S gnus-tmp-subject ?s)
1191 (?N gnus-tmp-number ?d)
1192 (?u gnus-tmp-user-defined ?s)))
1194 (defvar gnus-summary-mode-line-format-alist
1195 `((?G gnus-tmp-group-name ?s)
1196 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1197 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1198 (?A gnus-tmp-article-number ?d)
1199 (?Z gnus-tmp-unread-and-unselected ?s)
1200 (?V gnus-version ?s)
1201 (?U gnus-tmp-unread-and-unticked ?d)
1202 (?S gnus-tmp-subject ?s)
1203 (?e gnus-tmp-unselected ?d)
1204 (?u gnus-tmp-user-defined ?s)
1205 (?d (length gnus-newsgroup-dormant) ?d)
1206 (?t (length gnus-newsgroup-marked) ?d)
1207 (?h (length gnus-newsgroup-spam-marked) ?d)
1208 (?r (length gnus-newsgroup-reads) ?d)
1209 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1210 (?E gnus-newsgroup-expunged-tally ?d)
1211 (?s (gnus-current-score-file-nondirectory) ?s)))
1213 (defvar gnus-last-search-regexp nil
1214 "Default regexp for article search command.")
1216 (defvar gnus-last-shell-command nil
1217 "Default shell command on article.")
1219 (defvar gnus-newsgroup-agentized nil
1220 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1221 (defvar gnus-newsgroup-begin nil)
1222 (defvar gnus-newsgroup-end nil)
1223 (defvar gnus-newsgroup-last-rmail nil)
1224 (defvar gnus-newsgroup-last-mail nil)
1225 (defvar gnus-newsgroup-last-folder nil)
1226 (defvar gnus-newsgroup-last-file nil)
1227 (defvar gnus-newsgroup-auto-expire nil)
1228 (defvar gnus-newsgroup-active nil)
1230 (defvar gnus-newsgroup-data nil)
1231 (defvar gnus-newsgroup-data-reverse nil)
1232 (defvar gnus-newsgroup-limit nil)
1233 (defvar gnus-newsgroup-limits nil)
1234 (defvar gnus-summary-use-undownloaded-faces nil)
1236 (defvar gnus-newsgroup-unreads nil
1237 "Sorted list of unread articles in the current newsgroup.")
1239 (defvar gnus-newsgroup-unselected nil
1240 "Sorted list of unselected unread articles in the current newsgroup.")
1242 (defvar gnus-newsgroup-reads nil
1243 "Alist of read articles and article marks in the current newsgroup.")
1245 (defvar gnus-newsgroup-expunged-tally nil)
1247 (defvar gnus-newsgroup-marked nil
1248 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1250 (defvar gnus-newsgroup-spam-marked nil
1251 "List of ranges of articles that have been marked as spam.")
1253 (defvar gnus-newsgroup-killed nil
1254 "List of ranges of articles that have been through the scoring process.")
1256 (defvar gnus-newsgroup-cached nil
1257 "Sorted list of articles that come from the article cache.")
1259 (defvar gnus-newsgroup-saved nil
1260 "List of articles that have been saved.")
1262 (defvar gnus-newsgroup-kill-headers nil)
1264 (defvar gnus-newsgroup-replied nil
1265 "List of articles that have been replied to in the current newsgroup.")
1267 (defvar gnus-newsgroup-forwarded nil
1268 "List of articles that have been forwarded in the current newsgroup.")
1270 (defvar gnus-newsgroup-recent nil
1271 "List of articles that have are recent in the current newsgroup.")
1273 (defvar gnus-newsgroup-expirable nil
1274 "Sorted list of articles in the current newsgroup that can be expired.")
1276 (defvar gnus-newsgroup-processable nil
1277 "List of articles in the current newsgroup that can be processed.")
1279 (defvar gnus-newsgroup-downloadable nil
1280 "Sorted list of articles in the current newsgroup that can be processed.")
1282 (defvar gnus-newsgroup-unfetched nil
1283 "Sorted list of articles in the current newsgroup whose headers have
1284 not been fetched into the agent.
1286 This list will always be a subset of gnus-newsgroup-undownloaded.")
1288 (defvar gnus-newsgroup-undownloaded nil
1289 "List of articles in the current newsgroup that haven't been downloaded.")
1291 (defvar gnus-newsgroup-unsendable nil
1292 "List of articles in the current newsgroup that won't be sent.")
1294 (defvar gnus-newsgroup-bookmarks nil
1295 "List of articles in the current newsgroup that have bookmarks.")
1297 (defvar gnus-newsgroup-dormant nil
1298 "Sorted list of dormant articles in the current newsgroup.")
1300 (defvar gnus-newsgroup-unseen nil
1301 "List of unseen articles in the current newsgroup.")
1303 (defvar gnus-newsgroup-seen nil
1304 "Range of seen articles in the current newsgroup.")
1306 (defvar gnus-newsgroup-articles nil
1307 "List of articles in the current newsgroup.")
1309 (defvar gnus-newsgroup-scored nil
1310 "List of scored articles in the current newsgroup.")
1312 (defvar gnus-newsgroup-headers nil
1313 "List of article headers in the current newsgroup.")
1315 (defvar gnus-newsgroup-threads nil)
1317 (defvar gnus-newsgroup-prepared nil
1318 "Whether the current group has been prepared properly.")
1320 (defvar gnus-newsgroup-ancient nil
1321 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1323 (defvar gnus-newsgroup-sparse nil)
1325 (defvar gnus-current-article nil)
1326 (defvar gnus-article-current nil)
1327 (defvar gnus-current-headers nil)
1328 (defvar gnus-have-all-headers nil)
1329 (defvar gnus-last-article nil)
1330 (defvar gnus-newsgroup-history nil)
1331 (defvar gnus-newsgroup-charset nil)
1332 (defvar gnus-newsgroup-ephemeral-charset nil)
1333 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1335 (defvar gnus-article-before-search nil)
1337 (defvar gnus-summary-local-variables
1338 '(gnus-newsgroup-name
1339 gnus-newsgroup-begin gnus-newsgroup-end
1340 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1341 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1342 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1343 gnus-newsgroup-unselected gnus-newsgroup-marked
1344 gnus-newsgroup-spam-marked
1345 gnus-newsgroup-reads gnus-newsgroup-saved
1346 gnus-newsgroup-replied gnus-newsgroup-forwarded
1347 gnus-newsgroup-recent
1348 gnus-newsgroup-expirable
1349 gnus-newsgroup-processable gnus-newsgroup-killed
1350 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1351 gnus-newsgroup-unfetched
1352 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1353 gnus-newsgroup-seen gnus-newsgroup-articles
1354 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1355 gnus-newsgroup-headers gnus-newsgroup-threads
1356 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1357 gnus-current-article gnus-current-headers gnus-have-all-headers
1358 gnus-last-article gnus-article-internal-prepare-hook
1359 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1360 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1361 gnus-thread-expunge-below
1362 gnus-score-alist gnus-current-score-file
1363 (gnus-summary-expunge-below . global)
1364 (gnus-summary-mark-below . global)
1365 (gnus-orphan-score . global)
1366 gnus-newsgroup-active gnus-scores-exclude-files
1367 gnus-newsgroup-history gnus-newsgroup-ancient
1368 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1369 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1370 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1371 (gnus-newsgroup-expunged-tally . 0)
1372 gnus-cache-removable-articles gnus-newsgroup-cached
1373 gnus-newsgroup-data gnus-newsgroup-data-reverse
1374 gnus-newsgroup-limit gnus-newsgroup-limits
1375 gnus-newsgroup-charset gnus-newsgroup-display
1376 gnus-summary-use-undownloaded-faces)
1377 "Variables that are buffer-local to the summary buffers.")
1379 (defvar gnus-newsgroup-variables nil
1380 "A list of variables that have separate values in different newsgroups.
1381 A list of newsgroup (summary buffer) local variables, or cons of
1382 variables and their default values (when the default values are not
1383 nil), that should be made global while the summary buffer is active.
1384 These variables can be used to set variables in the group parameters
1385 while still allowing them to affect operations done in other
1386 buffers. For example:
1388 \(setq gnus-newsgroup-variables
1389 '(message-use-followup-to
1390 (gnus-visible-headers .
1391 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1394 ;; Byte-compiler warning.
1396 ;; Bind features so that require will believe that gnus-sum has
1397 ;; already been loaded (avoids infinite recursion)
1398 (let ((features (cons 'gnus-sum features)))
1399 ;; Several of the declarations in gnus-sum are needed to load the
1400 ;; following files. Right now, these definitions have been
1401 ;; compiled but not defined (evaluated). We could either do a
1402 ;; eval-and-compile about all of the declarations or evaluate the
1404 (if (boundp 'gnus-newsgroup-variables)
1406 (load "gnus-sum.el" t t t))
1408 (require 'gnus-agent)
1409 (require 'gnus-art)))
1413 (defvar gnus-decode-encoded-word-methods
1414 '(mail-decode-encoded-word-string)
1415 "List of methods used to decode encoded words.
1417 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1418 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1419 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1420 whose names match REGEXP.
1423 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1424 mail-decode-encoded-word-string
1425 (\"chinese\" . rfc1843-decode-string))")
1427 (defvar gnus-decode-encoded-word-methods-cache nil)
1429 (defun gnus-multi-decode-encoded-word-string (string)
1430 "Apply the functions from `gnus-encoded-word-methods' that match."
1431 (unless (and gnus-decode-encoded-word-methods-cache
1432 (eq gnus-newsgroup-name
1433 (car gnus-decode-encoded-word-methods-cache)))
1434 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1437 (nconc gnus-decode-encoded-word-methods-cache (list x))
1438 (if (and gnus-newsgroup-name
1439 (string-match (car x) gnus-newsgroup-name))
1440 (nconc gnus-decode-encoded-word-methods-cache
1442 gnus-decode-encoded-word-methods))
1443 (let ((xlist gnus-decode-encoded-word-methods-cache))
1446 (setq string (funcall (pop xlist) string))))
1449 ;; Subject simplification.
1451 (defun gnus-simplify-whitespace (str)
1452 "Remove excessive whitespace from STR."
1454 (while (string-match "[ \t][ \t]+" str)
1455 (setq str (concat (substring str 0 (match-beginning 0))
1457 (substring str (match-end 0)))))
1459 (when (string-match "^[ \t]+" str)
1460 (setq str (substring str (match-end 0))))
1462 (when (string-match "[ \t]+$" str)
1463 (setq str (substring str 0 (match-beginning 0))))
1466 (defun gnus-simplify-all-whitespace (str)
1467 "Remove all whitespace from STR."
1468 (while (string-match "[ \t\n]+" str)
1469 (setq str (replace-match "" nil nil str)))
1472 (defsubst gnus-simplify-subject-re (subject)
1473 "Remove \"Re:\" from subject lines."
1474 (if (string-match message-subject-re-regexp subject)
1475 (substring subject (match-end 0))
1478 (defun gnus-simplify-subject (subject &optional re-only)
1479 "Remove `Re:' and words in parentheses.
1480 If RE-ONLY is non-nil, strip leading `Re:'s only."
1481 (let ((case-fold-search t)) ;Ignore case.
1482 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1483 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1484 (setq subject (substring subject (match-end 0))))
1485 ;; Remove uninteresting prefixes.
1486 (when (and (not re-only)
1487 gnus-simplify-ignored-prefixes
1488 (string-match gnus-simplify-ignored-prefixes subject))
1489 (setq subject (substring subject (match-end 0))))
1490 ;; Remove words in parentheses from end.
1492 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1493 (setq subject (substring subject 0 (match-beginning 0)))))
1494 ;; Return subject string.
1497 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1499 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1500 (goto-char (point-min))
1501 (while (re-search-forward regexp nil t)
1502 (replace-match (or newtext ""))))
1504 (defun gnus-simplify-buffer-fuzzy ()
1505 "Simplify string in the buffer fuzzily.
1506 The string in the accessible portion of the current buffer is simplified.
1507 It is assumed to be a single-line subject.
1508 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1509 matter is removed. Additional things can be deleted by setting
1510 `gnus-simplify-subject-fuzzy-regexp'."
1511 (let ((case-fold-search t)
1513 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1515 (while (not (eq modified-tick (buffer-modified-tick)))
1516 (setq modified-tick (buffer-modified-tick))
1518 ((listp gnus-simplify-subject-fuzzy-regexp)
1519 (mapcar 'gnus-simplify-buffer-fuzzy-step
1520 gnus-simplify-subject-fuzzy-regexp))
1521 (gnus-simplify-subject-fuzzy-regexp
1522 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1523 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1524 (gnus-simplify-buffer-fuzzy-step
1525 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1526 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1528 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1529 (gnus-simplify-buffer-fuzzy-step " +" " ")
1530 (gnus-simplify-buffer-fuzzy-step " $")
1531 (gnus-simplify-buffer-fuzzy-step "^ +")))
1533 (defun gnus-simplify-subject-fuzzy (subject)
1534 "Simplify a subject string fuzzily.
1535 See `gnus-simplify-buffer-fuzzy' for details."
1537 (gnus-set-work-buffer)
1538 (let ((case-fold-search t))
1539 ;; Remove uninteresting prefixes.
1540 (when (and gnus-simplify-ignored-prefixes
1541 (string-match gnus-simplify-ignored-prefixes subject))
1542 (setq subject (substring subject (match-end 0))))
1544 (inline (gnus-simplify-buffer-fuzzy))
1547 (defsubst gnus-simplify-subject-fully (subject)
1548 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1550 (gnus-simplify-subject-functions
1551 (gnus-map-function gnus-simplify-subject-functions subject))
1552 ((null gnus-summary-gather-subject-limit)
1553 (gnus-simplify-subject-re subject))
1554 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1555 (gnus-simplify-subject-fuzzy subject))
1556 ((numberp gnus-summary-gather-subject-limit)
1557 (gnus-limit-string (gnus-simplify-subject-re subject)
1558 gnus-summary-gather-subject-limit))
1562 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1563 "Check whether two subjects are equal.
1564 If optional argument SIMPLE-FIRST is t, first argument is already
1567 ((null simple-first)
1568 (equal (gnus-simplify-subject-fully s1)
1569 (gnus-simplify-subject-fully s2)))
1572 (gnus-simplify-subject-fully s2)))))
1574 (defun gnus-summary-bubble-group ()
1575 "Increase the score of the current group.
1576 This is a handy function to add to `gnus-summary-exit-hook' to
1577 increase the score of each group you read."
1578 (gnus-group-add-score gnus-newsgroup-name))
1582 ;;; Gnus summary mode
1585 (put 'gnus-summary-mode 'mode-class 'special)
1587 (defvar gnus-article-commands-menu)
1589 ;; Non-orthogonal keys
1591 (gnus-define-keys gnus-summary-mode-map
1592 " " gnus-summary-next-page
1593 "\177" gnus-summary-prev-page
1594 [delete] gnus-summary-prev-page
1595 [backspace] gnus-summary-prev-page
1596 "\r" gnus-summary-scroll-up
1597 "\M-\r" gnus-summary-scroll-down
1598 "n" gnus-summary-next-unread-article
1599 "p" gnus-summary-prev-unread-article
1600 "N" gnus-summary-next-article
1601 "P" gnus-summary-prev-article
1602 "\M-\C-n" gnus-summary-next-same-subject
1603 "\M-\C-p" gnus-summary-prev-same-subject
1604 "\M-n" gnus-summary-next-unread-subject
1605 "\M-p" gnus-summary-prev-unread-subject
1606 "." gnus-summary-first-unread-article
1607 "," gnus-summary-best-unread-article
1608 "\M-s" gnus-summary-search-article-forward
1609 "\M-r" gnus-summary-search-article-backward
1610 "<" gnus-summary-beginning-of-article
1611 ">" gnus-summary-end-of-article
1612 "j" gnus-summary-goto-article
1613 "^" gnus-summary-refer-parent-article
1614 "\M-^" gnus-summary-refer-article
1615 "u" gnus-summary-tick-article-forward
1616 "!" gnus-summary-tick-article-forward
1617 "U" gnus-summary-tick-article-backward
1618 "d" gnus-summary-mark-as-read-forward
1619 "D" gnus-summary-mark-as-read-backward
1620 "E" gnus-summary-mark-as-expirable
1621 "\M-u" gnus-summary-clear-mark-forward
1622 "\M-U" gnus-summary-clear-mark-backward
1623 "k" gnus-summary-kill-same-subject-and-select
1624 "\C-k" gnus-summary-kill-same-subject
1625 "\M-\C-k" gnus-summary-kill-thread
1626 "\M-\C-l" gnus-summary-lower-thread
1627 "e" gnus-summary-edit-article
1628 "#" gnus-summary-mark-as-processable
1629 "\M-#" gnus-summary-unmark-as-processable
1630 "\M-\C-t" gnus-summary-toggle-threads
1631 "\M-\C-s" gnus-summary-show-thread
1632 "\M-\C-h" gnus-summary-hide-thread
1633 "\M-\C-f" gnus-summary-next-thread
1634 "\M-\C-b" gnus-summary-prev-thread
1635 [(meta down)] gnus-summary-next-thread
1636 [(meta up)] gnus-summary-prev-thread
1637 "\M-\C-u" gnus-summary-up-thread
1638 "\M-\C-d" gnus-summary-down-thread
1639 "&" gnus-summary-execute-command
1640 "c" gnus-summary-catchup-and-exit
1641 "\C-w" gnus-summary-mark-region-as-read
1642 "\C-t" gnus-summary-toggle-truncation
1643 "?" gnus-summary-mark-as-dormant
1644 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1645 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1646 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1647 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1648 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1649 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1650 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1651 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1652 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1653 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1654 "=" gnus-summary-expand-window
1655 "\C-x\C-s" gnus-summary-reselect-current-group
1656 "\M-g" gnus-summary-rescan-group
1657 "w" gnus-summary-stop-page-breaking
1658 "\C-c\C-r" gnus-summary-caesar-message
1659 "f" gnus-summary-followup
1660 "F" gnus-summary-followup-with-original
1661 "C" gnus-summary-cancel-article
1662 "r" gnus-summary-reply
1663 "R" gnus-summary-reply-with-original
1664 "\C-c\C-f" gnus-summary-mail-forward
1665 "o" gnus-summary-save-article
1666 "\C-o" gnus-summary-save-article-mail
1667 "|" gnus-summary-pipe-output
1668 "\M-k" gnus-summary-edit-local-kill
1669 "\M-K" gnus-summary-edit-global-kill
1671 "\C-c\C-d" gnus-summary-describe-group
1672 "q" gnus-summary-exit
1673 "Q" gnus-summary-exit-no-update
1674 "\C-c\C-i" gnus-info-find-node
1675 gnus-mouse-2 gnus-mouse-pick-article
1676 "m" gnus-summary-mail-other-window
1677 "a" gnus-summary-post-news
1678 "i" gnus-summary-news-other-window
1679 "x" gnus-summary-limit-to-unread
1680 "s" gnus-summary-isearch-article
1681 "t" gnus-summary-toggle-header
1682 "g" gnus-summary-show-article
1683 "l" gnus-summary-goto-last-article
1684 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1685 "\C-d" gnus-summary-enter-digest-group
1686 "\M-\C-d" gnus-summary-read-document
1687 "\M-\C-e" gnus-summary-edit-parameters
1688 "\M-\C-a" gnus-summary-customize-parameters
1690 "*" gnus-cache-enter-article
1691 "\M-*" gnus-cache-remove-article
1692 "\M-&" gnus-summary-universal-argument
1693 "\C-l" gnus-recenter
1694 "I" gnus-summary-increase-score
1695 "L" gnus-summary-lower-score
1696 "\M-i" gnus-symbolic-argument
1697 "h" gnus-summary-select-article-buffer
1699 "b" gnus-article-view-part
1700 "\M-t" gnus-summary-toggle-display-buttonized
1702 "V" gnus-summary-score-map
1703 "X" gnus-uu-extract-map
1704 "S" gnus-summary-send-map)
1706 ;; Sort of orthogonal keymap
1707 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1708 "t" gnus-summary-tick-article-forward
1709 "!" gnus-summary-tick-article-forward
1710 "d" gnus-summary-mark-as-read-forward
1711 "r" gnus-summary-mark-as-read-forward
1712 "c" gnus-summary-clear-mark-forward
1713 " " gnus-summary-clear-mark-forward
1714 "e" gnus-summary-mark-as-expirable
1715 "x" gnus-summary-mark-as-expirable
1716 "?" gnus-summary-mark-as-dormant
1717 "b" gnus-summary-set-bookmark
1718 "B" gnus-summary-remove-bookmark
1719 "#" gnus-summary-mark-as-processable
1720 "\M-#" gnus-summary-unmark-as-processable
1721 "S" gnus-summary-limit-include-expunged
1722 "C" gnus-summary-catchup
1723 "H" gnus-summary-catchup-to-here
1724 "h" gnus-summary-catchup-from-here
1725 "\C-c" gnus-summary-catchup-all
1726 "k" gnus-summary-kill-same-subject-and-select
1727 "K" gnus-summary-kill-same-subject
1728 "P" gnus-uu-mark-map)
1730 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1731 "c" gnus-summary-clear-above
1732 "u" gnus-summary-tick-above
1733 "m" gnus-summary-mark-above
1734 "k" gnus-summary-kill-below)
1736 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1737 "/" gnus-summary-limit-to-subject
1738 "n" gnus-summary-limit-to-articles
1739 "w" gnus-summary-pop-limit
1740 "s" gnus-summary-limit-to-subject
1741 "a" gnus-summary-limit-to-author
1742 "u" gnus-summary-limit-to-unread
1743 "m" gnus-summary-limit-to-marks
1744 "M" gnus-summary-limit-exclude-marks
1745 "v" gnus-summary-limit-to-score
1746 "*" gnus-summary-limit-include-cached
1747 "D" gnus-summary-limit-include-dormant
1748 "T" gnus-summary-limit-include-thread
1749 "d" gnus-summary-limit-exclude-dormant
1750 "t" gnus-summary-limit-to-age
1751 "." gnus-summary-limit-to-unseen
1752 "x" gnus-summary-limit-to-extra
1753 "p" gnus-summary-limit-to-display-predicate
1754 "E" gnus-summary-limit-include-expunged
1755 "c" gnus-summary-limit-exclude-childless-dormant
1756 "C" gnus-summary-limit-mark-excluded-as-read
1757 "o" gnus-summary-insert-old-articles
1758 "N" gnus-summary-insert-new-articles
1759 "r" gnus-summary-limit-to-replied)
1761 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1762 "n" gnus-summary-next-unread-article
1763 "p" gnus-summary-prev-unread-article
1764 "N" gnus-summary-next-article
1765 "P" gnus-summary-prev-article
1766 "\C-n" gnus-summary-next-same-subject
1767 "\C-p" gnus-summary-prev-same-subject
1768 "\M-n" gnus-summary-next-unread-subject
1769 "\M-p" gnus-summary-prev-unread-subject
1770 "f" gnus-summary-first-unread-article
1771 "b" gnus-summary-best-unread-article
1772 "j" gnus-summary-goto-article
1773 "g" gnus-summary-goto-subject
1774 "l" gnus-summary-goto-last-article
1775 "o" gnus-summary-pop-article)
1777 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1778 "k" gnus-summary-kill-thread
1779 "l" gnus-summary-lower-thread
1780 "i" gnus-summary-raise-thread
1781 "T" gnus-summary-toggle-threads
1782 "t" gnus-summary-rethread-current
1783 "^" gnus-summary-reparent-thread
1784 "s" gnus-summary-show-thread
1785 "S" gnus-summary-show-all-threads
1786 "h" gnus-summary-hide-thread
1787 "H" gnus-summary-hide-all-threads
1788 "n" gnus-summary-next-thread
1789 "p" gnus-summary-prev-thread
1790 "u" gnus-summary-up-thread
1791 "o" gnus-summary-top-thread
1792 "d" gnus-summary-down-thread
1793 "#" gnus-uu-mark-thread
1794 "\M-#" gnus-uu-unmark-thread)
1796 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1797 "g" gnus-summary-prepare
1798 "c" gnus-summary-insert-cached-articles
1799 "d" gnus-summary-insert-dormant-articles)
1801 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1802 "c" gnus-summary-catchup-and-exit
1803 "C" gnus-summary-catchup-all-and-exit
1804 "E" gnus-summary-exit-no-update
1805 "Q" gnus-summary-exit
1806 "Z" gnus-summary-exit
1807 "n" gnus-summary-catchup-and-goto-next-group
1808 "R" gnus-summary-reselect-current-group
1809 "G" gnus-summary-rescan-group
1810 "N" gnus-summary-next-group
1811 "s" gnus-summary-save-newsrc
1812 "P" gnus-summary-prev-group)
1814 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1815 " " gnus-summary-next-page
1816 "n" gnus-summary-next-page
1817 "\177" gnus-summary-prev-page
1818 [delete] gnus-summary-prev-page
1819 "p" gnus-summary-prev-page
1820 "\r" gnus-summary-scroll-up
1821 "\M-\r" gnus-summary-scroll-down
1822 "<" gnus-summary-beginning-of-article
1823 ">" gnus-summary-end-of-article
1824 "b" gnus-summary-beginning-of-article
1825 "e" gnus-summary-end-of-article
1826 "^" gnus-summary-refer-parent-article
1827 "r" gnus-summary-refer-parent-article
1828 "D" gnus-summary-enter-digest-group
1829 "R" gnus-summary-refer-references
1830 "T" gnus-summary-refer-thread
1831 "g" gnus-summary-show-article
1832 "s" gnus-summary-isearch-article
1833 "P" gnus-summary-print-article
1834 "M" gnus-mailing-list-insinuate
1835 "t" gnus-article-babel)
1837 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1838 "b" gnus-article-add-buttons
1839 "B" gnus-article-add-buttons-to-head
1840 "o" gnus-article-treat-overstrike
1841 "e" gnus-article-emphasize
1842 "w" gnus-article-fill-cited-article
1843 "Q" gnus-article-fill-long-lines
1844 "C" gnus-article-capitalize-sentences
1845 "c" gnus-article-remove-cr
1846 "q" gnus-article-de-quoted-unreadable
1847 "6" gnus-article-de-base64-unreadable
1848 "Z" gnus-article-decode-HZ
1849 "A" gnus-article-treat-ansi-sequences
1850 "h" gnus-article-wash-html
1851 "u" gnus-article-unsplit-urls
1852 "s" gnus-summary-force-verify-and-decrypt
1853 "f" gnus-article-display-x-face
1854 "l" gnus-summary-stop-page-breaking
1855 "r" gnus-summary-caesar-message
1856 "m" gnus-summary-morse-message
1857 "t" gnus-summary-toggle-header
1858 "g" gnus-treat-smiley
1859 "v" gnus-summary-verbose-headers
1860 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1861 "p" gnus-article-verify-x-pgp-sig
1862 "d" gnus-article-treat-dumbquotes)
1864 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1865 ;; mnemonic: deuglif*Y*
1866 "u" gnus-article-outlook-unwrap-lines
1867 "a" gnus-article-outlook-repair-attribution
1868 "c" gnus-article-outlook-rearrange-citation
1869 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1871 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1872 "a" gnus-article-hide
1873 "h" gnus-article-hide-headers
1874 "b" gnus-article-hide-boring-headers
1875 "s" gnus-article-hide-signature
1876 "c" gnus-article-hide-citation
1877 "C" gnus-article-hide-citation-in-followups
1878 "l" gnus-article-hide-list-identifiers
1879 "B" gnus-article-strip-banner
1880 "P" gnus-article-hide-pem
1881 "\C-c" gnus-article-hide-citation-maybe)
1883 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1884 "a" gnus-article-highlight
1885 "h" gnus-article-highlight-headers
1886 "c" gnus-article-highlight-citation
1887 "s" gnus-article-highlight-signature)
1889 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1890 "f" gnus-article-treat-fold-headers
1891 "u" gnus-article-treat-unfold-headers
1892 "n" gnus-article-treat-fold-newsgroups)
1894 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1895 "x" gnus-article-display-x-face
1896 "d" gnus-article-display-face
1897 "s" gnus-treat-smiley
1898 "D" gnus-article-remove-images
1899 "f" gnus-treat-from-picon
1900 "m" gnus-treat-mail-picon
1901 "n" gnus-treat-newsgroups-picon)
1903 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1904 "w" gnus-article-decode-mime-words
1905 "c" gnus-article-decode-charset
1906 "v" gnus-mime-view-all-parts
1907 "b" gnus-article-view-part)
1909 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1910 "z" gnus-article-date-ut
1911 "u" gnus-article-date-ut
1912 "l" gnus-article-date-local
1913 "p" gnus-article-date-english
1914 "e" gnus-article-date-lapsed
1915 "o" gnus-article-date-original
1916 "i" gnus-article-date-iso8601
1917 "s" gnus-article-date-user)
1919 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1920 "t" gnus-article-remove-trailing-blank-lines
1921 "l" gnus-article-strip-leading-blank-lines
1922 "m" gnus-article-strip-multiple-blank-lines
1923 "a" gnus-article-strip-blank-lines
1924 "A" gnus-article-strip-all-blank-lines
1925 "s" gnus-article-strip-leading-space
1926 "e" gnus-article-strip-trailing-space
1927 "w" gnus-article-remove-leading-whitespace)
1929 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1931 "f" gnus-summary-fetch-faq
1932 "d" gnus-summary-describe-group
1933 "h" gnus-summary-describe-briefly
1934 "i" gnus-info-find-node
1935 "c" gnus-group-fetch-charter
1936 "C" gnus-group-fetch-control)
1938 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1939 "e" gnus-summary-expire-articles
1940 "\M-\C-e" gnus-summary-expire-articles-now
1941 "\177" gnus-summary-delete-article
1942 [delete] gnus-summary-delete-article
1943 [backspace] gnus-summary-delete-article
1944 "m" gnus-summary-move-article
1945 "r" gnus-summary-respool-article
1946 "w" gnus-summary-edit-article
1947 "c" gnus-summary-copy-article
1948 "B" gnus-summary-crosspost-article
1949 "q" gnus-summary-respool-query
1950 "t" gnus-summary-respool-trace
1951 "i" gnus-summary-import-article
1952 "I" gnus-summary-create-article
1953 "p" gnus-summary-article-posted-p)
1955 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1956 "o" gnus-summary-save-article
1957 "m" gnus-summary-save-article-mail
1958 "F" gnus-summary-write-article-file
1959 "r" gnus-summary-save-article-rmail
1960 "f" gnus-summary-save-article-file
1961 "b" gnus-summary-save-article-body-file
1962 "h" gnus-summary-save-article-folder
1963 "v" gnus-summary-save-article-vm
1964 "p" gnus-summary-pipe-output
1965 "P" gnus-summary-muttprint
1966 "s" gnus-soup-add-article)
1968 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1969 "b" gnus-summary-display-buttonized
1970 "m" gnus-summary-repair-multipart
1971 "v" gnus-article-view-part
1972 "o" gnus-article-save-part
1973 "c" gnus-article-copy-part
1974 "C" gnus-article-view-part-as-charset
1975 "e" gnus-article-view-part-externally
1976 "E" gnus-article-encrypt-body
1977 "i" gnus-article-inline-part
1978 "|" gnus-article-pipe-part)
1980 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1981 "p" gnus-summary-mark-as-processable
1982 "u" gnus-summary-unmark-as-processable
1983 "U" gnus-summary-unmark-all-processable
1984 "v" gnus-uu-mark-over
1985 "s" gnus-uu-mark-series
1986 "r" gnus-uu-mark-region
1987 "g" gnus-uu-unmark-region
1988 "R" gnus-uu-mark-by-regexp
1989 "G" gnus-uu-unmark-by-regexp
1990 "t" gnus-uu-mark-thread
1991 "T" gnus-uu-unmark-thread
1992 "a" gnus-uu-mark-all
1993 "b" gnus-uu-mark-buffer
1994 "S" gnus-uu-mark-sparse
1995 "k" gnus-summary-kill-process-mark
1996 "y" gnus-summary-yank-process-mark
1997 "w" gnus-summary-save-process-mark
1998 "i" gnus-uu-invert-processable)
2000 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2001 ;;"x" gnus-uu-extract-any
2002 "m" gnus-summary-save-parts
2003 "u" gnus-uu-decode-uu
2004 "U" gnus-uu-decode-uu-and-save
2005 "s" gnus-uu-decode-unshar
2006 "S" gnus-uu-decode-unshar-and-save
2007 "o" gnus-uu-decode-save
2008 "O" gnus-uu-decode-save
2009 "b" gnus-uu-decode-binhex
2010 "B" gnus-uu-decode-binhex
2011 "p" gnus-uu-decode-postscript
2012 "P" gnus-uu-decode-postscript-and-save)
2015 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2016 "u" gnus-uu-decode-uu-view
2017 "U" gnus-uu-decode-uu-and-save-view
2018 "s" gnus-uu-decode-unshar-view
2019 "S" gnus-uu-decode-unshar-and-save-view
2020 "o" gnus-uu-decode-save-view
2021 "O" gnus-uu-decode-save-view
2022 "b" gnus-uu-decode-binhex-view
2023 "B" gnus-uu-decode-binhex-view
2024 "p" gnus-uu-decode-postscript-view
2025 "P" gnus-uu-decode-postscript-and-save-view)
2027 (defvar gnus-article-post-menu nil)
2029 (defconst gnus-summary-menu-maxlen 20)
2031 (defun gnus-summary-menu-split (menu)
2032 ;; If we have lots of elements, divide them into groups of 20
2033 ;; and make a pane (or submenu) for each one.
2034 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2035 (let ((menu menu) sublists next
2038 ;; Pull off the next gnus-summary-menu-maxlen elements
2039 ;; and make them the next element of sublist.
2040 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2042 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2044 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2045 (aref (car (last menu)) 0)) menu)
2049 (nreverse sublists))
2050 ;; Few elements--put them all in one pane.
2053 (defun gnus-summary-make-menu-bar ()
2054 (gnus-turn-off-edit-menu 'summary)
2056 (unless (boundp 'gnus-summary-misc-menu)
2059 gnus-summary-kill-menu gnus-summary-mode-map ""
2064 ["Customize" gnus-score-customize t])
2065 (gnus-make-score-map 'increase)
2066 (gnus-make-score-map 'lower)
2068 ["Kill below" gnus-summary-kill-below t]
2069 ["Mark above" gnus-summary-mark-above t]
2070 ["Tick above" gnus-summary-tick-above t]
2071 ["Clear above" gnus-summary-clear-above t])
2072 ["Current score" gnus-summary-current-score t]
2073 ["Set score" gnus-summary-set-score t]
2074 ["Switch current score file..." gnus-score-change-score-file t]
2075 ["Set mark below..." gnus-score-set-mark-below t]
2076 ["Set expunge below..." gnus-score-set-expunge-below t]
2077 ["Edit current score file" gnus-score-edit-current-scores t]
2078 ["Edit score file" gnus-score-edit-file t]
2079 ["Trace score" gnus-score-find-trace t]
2080 ["Find words" gnus-score-find-favourite-words t]
2081 ["Rescore buffer" gnus-summary-rescore t]
2082 ["Increase score..." gnus-summary-increase-score t]
2083 ["Lower score..." gnus-summary-lower-score t]))))
2085 ;; Define both the Article menu in the summary buffer and the
2086 ;; equivalent Commands menu in the article buffer here for
2090 ["All" gnus-article-hide t]
2091 ["Headers" gnus-article-hide-headers t]
2092 ["Signature" gnus-article-hide-signature t]
2093 ["Citation" gnus-article-hide-citation t]
2094 ["List identifiers" gnus-article-hide-list-identifiers t]
2095 ["Banner" gnus-article-strip-banner t]
2096 ["Boring headers" gnus-article-hide-boring-headers t])
2098 ["All" gnus-article-highlight t]
2099 ["Headers" gnus-article-highlight-headers t]
2100 ["Signature" gnus-article-highlight-signature t]
2101 ["Citation" gnus-article-highlight-citation t])
2103 ["Words" gnus-article-decode-mime-words t]
2104 ["Charset" gnus-article-decode-charset t]
2105 ["QP" gnus-article-de-quoted-unreadable t]
2106 ["Base64" gnus-article-de-base64-unreadable t]
2107 ["View MIME buttons" gnus-summary-display-buttonized t]
2108 ["View all" gnus-mime-view-all-parts t]
2109 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2110 ["Encrypt body" gnus-article-encrypt-body
2111 :active (not (gnus-group-read-only-p))
2112 ,@(if (featurep 'xemacs) nil
2113 '(:help "Encrypt the message body on disk"))]
2114 ["Extract all parts..." gnus-summary-save-parts t]
2116 ["Repair multipart" gnus-summary-repair-multipart t]
2117 ["Pipe part..." gnus-article-pipe-part t]
2118 ["Inline part" gnus-article-inline-part t]
2119 ["Encrypt body" gnus-article-encrypt-body
2120 :active (not (gnus-group-read-only-p))
2121 ,@(if (featurep 'xemacs) nil
2122 '(:help "Encrypt the message body on disk"))]
2123 ["View part externally" gnus-article-view-part-externally t]
2124 ["View part with charset..." gnus-article-view-part-as-charset t]
2125 ["Copy part" gnus-article-copy-part t]
2126 ["Save part..." gnus-article-save-part t]
2127 ["View part" gnus-article-view-part t]))
2129 ["Local" gnus-article-date-local t]
2130 ["ISO8601" gnus-article-date-iso8601 t]
2131 ["UT" gnus-article-date-ut t]
2132 ["Original" gnus-article-date-original t]
2133 ["Lapsed" gnus-article-date-lapsed t]
2134 ["User-defined" gnus-article-date-user t])
2136 ["Remove images" gnus-article-remove-images t]
2137 ["Toggle smiley" gnus-treat-smiley t]
2138 ["Show X-Face" gnus-article-display-x-face t]
2139 ["Show picons in From" gnus-treat-from-picon t]
2140 ["Show picons in mail headers" gnus-treat-mail-picon t]
2141 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2142 ("View as different encoding"
2143 ,@(gnus-summary-menu-split
2146 ;; Since easymenu under Emacs doesn't allow
2147 ;; lambda forms for menu commands, we should
2148 ;; provide intern'ed function symbols.
2149 (let ((command (intern (format "\
2150 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2154 (let ((gnus-summary-show-article-charset-alist
2156 (gnus-summary-show-article 1))))
2157 `[,(symbol-name cs) ,command t]))
2158 (sort (if (fboundp 'coding-system-list)
2159 (coding-system-list)
2160 (mapcar 'car mm-mime-mule-charset-alist))
2164 ["Leading" gnus-article-strip-leading-blank-lines t]
2165 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2166 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2167 ["All of the above" gnus-article-strip-blank-lines t]
2168 ["All" gnus-article-strip-all-blank-lines t]
2169 ["Leading space" gnus-article-strip-leading-space t]
2170 ["Trailing space" gnus-article-strip-trailing-space t]
2171 ["Leading space in headers"
2172 gnus-article-remove-leading-whitespace t])
2173 ["Overstrike" gnus-article-treat-overstrike t]
2174 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2175 ["Emphasis" gnus-article-emphasize t]
2176 ["Word wrap" gnus-article-fill-cited-article t]
2177 ["Fill long lines" gnus-article-fill-long-lines t]
2178 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2179 ["Remove CR" gnus-article-remove-cr t]
2180 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2181 ["Base64" gnus-article-de-base64-unreadable t]
2182 ["Rot 13" gnus-summary-caesar-message
2183 ,@(if (featurep 'xemacs) '(t)
2184 '(:help "\"Caesar rotate\" article by 13"))]
2185 ["Morse decode" gnus-summary-morse-message t]
2186 ["Unix pipe..." gnus-summary-pipe-message t]
2187 ["Add buttons" gnus-article-add-buttons t]
2188 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2189 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2190 ["Verbose header" gnus-summary-verbose-headers t]
2191 ["Toggle header" gnus-summary-toggle-header t]
2192 ["Unfold headers" gnus-article-treat-unfold-headers t]
2193 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2194 ["Html" gnus-article-wash-html t]
2195 ["Unsplit URLs" gnus-article-unsplit-urls t]
2196 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2197 ["Decode HZ" gnus-article-decode-HZ t]
2198 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2199 ("(Outlook) Deuglify"
2200 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2201 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2202 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2203 ["Full (Outlook) deuglify"
2204 gnus-article-outlook-deuglify-article t])
2207 ["Save in default format..." gnus-summary-save-article
2208 ,@(if (featurep 'xemacs) '(t)
2209 '(:help "Save article using default method"))]
2210 ["Save in file..." gnus-summary-save-article-file
2211 ,@(if (featurep 'xemacs) '(t)
2212 '(:help "Save article in file"))]
2213 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2214 ["Save in MH folder..." gnus-summary-save-article-folder t]
2215 ["Save in VM folder..." gnus-summary-save-article-vm t]
2216 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2217 ["Save body in file..." gnus-summary-save-article-body-file t]
2218 ["Pipe through a filter..." gnus-summary-pipe-output t]
2219 ["Add to SOUP packet" gnus-soup-add-article t]
2220 ["Print with Muttprint..." gnus-summary-muttprint t]
2221 ["Print" gnus-summary-print-article t])
2223 ["Respool article..." gnus-summary-respool-article t]
2224 ["Move article..." gnus-summary-move-article
2225 (gnus-check-backend-function
2226 'request-move-article gnus-newsgroup-name)]
2227 ["Copy article..." gnus-summary-copy-article t]
2228 ["Crosspost article..." gnus-summary-crosspost-article
2229 (gnus-check-backend-function
2230 'request-replace-article gnus-newsgroup-name)]
2231 ["Import file..." gnus-summary-import-article
2232 (gnus-check-backend-function
2233 'request-accept-article gnus-newsgroup-name)]
2234 ["Create article..." gnus-summary-create-article
2235 (gnus-check-backend-function
2236 'request-accept-article gnus-newsgroup-name)]
2237 ["Check if posted" gnus-summary-article-posted-p t]
2238 ["Edit article" gnus-summary-edit-article
2239 (not (gnus-group-read-only-p))]
2240 ["Delete article" gnus-summary-delete-article
2241 (gnus-check-backend-function
2242 'request-expire-articles gnus-newsgroup-name)]
2243 ["Query respool" gnus-summary-respool-query t]
2244 ["Trace respool" gnus-summary-respool-trace t]
2245 ["Delete expirable articles" gnus-summary-expire-articles-now
2246 (gnus-check-backend-function
2247 'request-expire-articles gnus-newsgroup-name)])
2249 ["Uudecode" gnus-uu-decode-uu
2250 ,@(if (featurep 'xemacs) '(t)
2251 '(:help "Decode uuencoded article(s)"))]
2252 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2253 ["Unshar" gnus-uu-decode-unshar t]
2254 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2255 ["Save" gnus-uu-decode-save t]
2256 ["Binhex" gnus-uu-decode-binhex t]
2257 ["Postscript" gnus-uu-decode-postscript t]
2258 ["All MIME parts" gnus-summary-save-parts t])
2260 ["Enter article" gnus-cache-enter-article t]
2261 ["Remove article" gnus-cache-remove-article t])
2262 ["Translate" gnus-article-babel t]
2263 ["Select article buffer" gnus-summary-select-article-buffer t]
2264 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2265 ["Isearch article..." gnus-summary-isearch-article t]
2266 ["Beginning of the article" gnus-summary-beginning-of-article t]
2267 ["End of the article" gnus-summary-end-of-article t]
2268 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2269 ["Fetch referenced articles" gnus-summary-refer-references t]
2270 ["Fetch current thread" gnus-summary-refer-thread t]
2271 ["Fetch article with id..." gnus-summary-refer-article t]
2272 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2273 ["Redisplay" gnus-summary-show-article t]
2274 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2276 gnus-summary-article-menu gnus-summary-mode-map ""
2277 (cons "Article" innards))
2279 (if (not (keymapp gnus-summary-article-menu))
2281 gnus-article-commands-menu gnus-article-mode-map ""
2282 (cons "Commands" innards))
2283 ;; in Emacs, don't share menu.
2284 (setq gnus-article-commands-menu
2285 (copy-keymap gnus-summary-article-menu))
2286 (define-key gnus-article-mode-map [menu-bar commands]
2287 (cons "Commands" gnus-article-commands-menu))))
2290 gnus-summary-thread-menu gnus-summary-mode-map ""
2292 ["Find all messages in thread" gnus-summary-refer-thread t]
2293 ["Toggle threading" gnus-summary-toggle-threads t]
2294 ["Hide threads" gnus-summary-hide-all-threads t]
2295 ["Show threads" gnus-summary-show-all-threads t]
2296 ["Hide thread" gnus-summary-hide-thread t]
2297 ["Show thread" gnus-summary-show-thread t]
2298 ["Go to next thread" gnus-summary-next-thread t]
2299 ["Go to previous thread" gnus-summary-prev-thread t]
2300 ["Go down thread" gnus-summary-down-thread t]
2301 ["Go up thread" gnus-summary-up-thread t]
2302 ["Top of thread" gnus-summary-top-thread t]
2303 ["Mark thread as read" gnus-summary-kill-thread t]
2304 ["Lower thread score" gnus-summary-lower-thread t]
2305 ["Raise thread score" gnus-summary-raise-thread t]
2306 ["Rethread current" gnus-summary-rethread-current t]))
2309 gnus-summary-post-menu gnus-summary-mode-map ""
2311 ["Send a message (mail or news)" gnus-summary-post-news
2312 ,@(if (featurep 'xemacs) '(t)
2313 '(:help "Post an article"))]
2314 ["Followup" gnus-summary-followup
2315 ,@(if (featurep 'xemacs) '(t)
2316 '(:help "Post followup to this article"))]
2317 ["Followup and yank" gnus-summary-followup-with-original
2318 ,@(if (featurep 'xemacs) '(t)
2319 '(:help "Post followup to this article, quoting its contents"))]
2320 ["Supersede article" gnus-summary-supersede-article t]
2321 ["Cancel article" gnus-summary-cancel-article
2322 ,@(if (featurep 'xemacs) '(t)
2323 '(:help "Cancel an article you posted"))]
2324 ["Reply" gnus-summary-reply t]
2325 ["Reply and yank" gnus-summary-reply-with-original t]
2326 ["Wide reply" gnus-summary-wide-reply t]
2327 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2328 ,@(if (featurep 'xemacs) '(t)
2329 '(:help "Mail a reply, quoting this article"))]
2330 ["Very wide reply" gnus-summary-very-wide-reply t]
2331 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2332 ,@(if (featurep 'xemacs) '(t)
2333 '(:help "Mail a very wide reply, quoting this article"))]
2334 ["Mail forward" gnus-summary-mail-forward t]
2335 ["Post forward" gnus-summary-post-forward t]
2336 ["Digest and mail" gnus-uu-digest-mail-forward t]
2337 ["Digest and post" gnus-uu-digest-post-forward t]
2338 ["Resend message" gnus-summary-resend-message t]
2339 ["Resend message edit" gnus-summary-resend-message-edit t]
2340 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2341 ["Send a mail" gnus-summary-mail-other-window t]
2342 ["Create a local message" gnus-summary-news-other-window t]
2343 ["Uuencode and post" gnus-uu-post-news
2344 ,@(if (featurep 'xemacs) '(t)
2345 '(:help "Post a uuencoded article"))]
2346 ["Followup via news" gnus-summary-followup-to-mail t]
2347 ["Followup via news and yank"
2348 gnus-summary-followup-to-mail-with-original t]
2350 ;;["Send" gnus-summary-send-draft t]
2351 ;;["Send bounced" gnus-resend-bounced-mail t])
2355 ((not (keymapp gnus-summary-post-menu))
2356 (setq gnus-article-post-menu gnus-summary-post-menu))
2357 ((not gnus-article-post-menu)
2358 ;; Don't share post menu.
2359 (setq gnus-article-post-menu
2360 (copy-keymap gnus-summary-post-menu))))
2361 (define-key gnus-article-mode-map [menu-bar post]
2362 (cons "Post" gnus-article-post-menu))
2365 gnus-summary-misc-menu gnus-summary-mode-map ""
2368 ["Mark as read" gnus-summary-mark-as-read-forward t]
2369 ["Mark same subject and select"
2370 gnus-summary-kill-same-subject-and-select t]
2371 ["Mark same subject" gnus-summary-kill-same-subject t]
2372 ["Catchup" gnus-summary-catchup
2373 ,@(if (featurep 'xemacs) '(t)
2374 '(:help "Mark unread articles in this group as read"))]
2375 ["Catchup all" gnus-summary-catchup-all t]
2376 ["Catchup to here" gnus-summary-catchup-to-here t]
2377 ["Catchup from here" gnus-summary-catchup-from-here t]
2378 ["Catchup region" gnus-summary-mark-region-as-read
2379 (gnus-mark-active-p)]
2380 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2382 ["Tick" gnus-summary-tick-article-forward t]
2383 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2384 ["Remove marks" gnus-summary-clear-mark-forward t]
2385 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2386 ["Set bookmark" gnus-summary-set-bookmark t]
2387 ["Remove bookmark" gnus-summary-remove-bookmark t])
2389 ["Marks..." gnus-summary-limit-to-marks t]
2390 ["Subject..." gnus-summary-limit-to-subject t]
2391 ["Author..." gnus-summary-limit-to-author t]
2392 ["Age..." gnus-summary-limit-to-age t]
2393 ["Extra..." gnus-summary-limit-to-extra t]
2394 ["Score..." gnus-summary-limit-to-score t]
2395 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2396 ["Unread" gnus-summary-limit-to-unread t]
2397 ["Unseen" gnus-summary-limit-to-unseen t]
2398 ["Replied" gnus-summary-limit-to-replied t]
2399 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2400 ["Next articles" gnus-summary-limit-to-articles t]
2401 ["Pop limit" gnus-summary-pop-limit t]
2402 ["Show dormant" gnus-summary-limit-include-dormant t]
2403 ["Hide childless dormant"
2404 gnus-summary-limit-exclude-childless-dormant t]
2405 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2406 ["Hide marked" gnus-summary-limit-exclude-marks t]
2407 ["Show expunged" gnus-summary-limit-include-expunged t])
2409 ["Set mark" gnus-summary-mark-as-processable t]
2410 ["Remove mark" gnus-summary-unmark-as-processable t]
2411 ["Remove all marks" gnus-summary-unmark-all-processable t]
2412 ["Mark above" gnus-uu-mark-over t]
2413 ["Mark series" gnus-uu-mark-series t]
2414 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2415 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2416 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2417 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2418 ["Mark all" gnus-uu-mark-all t]
2419 ["Mark buffer" gnus-uu-mark-buffer t]
2420 ["Mark sparse" gnus-uu-mark-sparse t]
2421 ["Mark thread" gnus-uu-mark-thread t]
2422 ["Unmark thread" gnus-uu-unmark-thread t]
2423 ("Process Mark Sets"
2424 ["Kill" gnus-summary-kill-process-mark t]
2425 ["Yank" gnus-summary-yank-process-mark
2426 gnus-newsgroup-process-stack]
2427 ["Save" gnus-summary-save-process-mark t]
2428 ["Run command on marked..." gnus-summary-universal-argument t]))
2430 ["Page forward" gnus-summary-next-page
2431 ,@(if (featurep 'xemacs) '(t)
2432 '(:help "Show next page of article"))]
2433 ["Page backward" gnus-summary-prev-page
2434 ,@(if (featurep 'xemacs) '(t)
2435 '(:help "Show previous page of article"))]
2436 ["Line forward" gnus-summary-scroll-up t])
2438 ["Next unread article" gnus-summary-next-unread-article t]
2439 ["Previous unread article" gnus-summary-prev-unread-article t]
2440 ["Next article" gnus-summary-next-article t]
2441 ["Previous article" gnus-summary-prev-article t]
2442 ["Next unread subject" gnus-summary-next-unread-subject t]
2443 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2444 ["Next article same subject" gnus-summary-next-same-subject t]
2445 ["Previous article same subject" gnus-summary-prev-same-subject t]
2446 ["First unread article" gnus-summary-first-unread-article t]
2447 ["Best unread article" gnus-summary-best-unread-article t]
2448 ["Go to subject number..." gnus-summary-goto-subject t]
2449 ["Go to article number..." gnus-summary-goto-article t]
2450 ["Go to the last article" gnus-summary-goto-last-article t]
2451 ["Pop article off history" gnus-summary-pop-article t])
2453 ["Sort by number" gnus-summary-sort-by-number t]
2454 ["Sort by author" gnus-summary-sort-by-author t]
2455 ["Sort by subject" gnus-summary-sort-by-subject t]
2456 ["Sort by date" gnus-summary-sort-by-date t]
2457 ["Sort by score" gnus-summary-sort-by-score t]
2458 ["Sort by lines" gnus-summary-sort-by-lines t]
2459 ["Sort by characters" gnus-summary-sort-by-chars t]
2460 ["Randomize" gnus-summary-sort-by-random t]
2461 ["Original sort" gnus-summary-sort-by-original t])
2463 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2464 ["Describe group" gnus-summary-describe-group t]
2465 ["Fetch charter" gnus-group-fetch-charter
2466 ,@(if (featurep 'xemacs) nil
2467 '(:help "Display the charter of the current group"))]
2468 ["Fetch control message" gnus-group-fetch-control
2469 ,@(if (featurep 'xemacs) nil
2470 '(:help "Display the archived control message for the current group"))]
2471 ["Read manual" gnus-info-find-node t])
2473 ["Pick and read" gnus-pick-mode t]
2474 ["Binary" gnus-binary-mode t])
2476 ["Regenerate" gnus-summary-prepare t]
2477 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2478 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2479 ["Toggle threading" gnus-summary-toggle-threads t])
2480 ["See old articles" gnus-summary-insert-old-articles t]
2481 ["See new articles" gnus-summary-insert-new-articles t]
2482 ["Filter articles..." gnus-summary-execute-command t]
2483 ["Run command on articles..." gnus-summary-universal-argument t]
2484 ["Search articles forward..." gnus-summary-search-article-forward t]
2485 ["Search articles backward..." gnus-summary-search-article-backward t]
2486 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2487 ["Expand window" gnus-summary-expand-window t]
2488 ["Expire expirable articles" gnus-summary-expire-articles
2489 (gnus-check-backend-function
2490 'request-expire-articles gnus-newsgroup-name)]
2491 ["Edit local kill file" gnus-summary-edit-local-kill t]
2492 ["Edit main kill file" gnus-summary-edit-global-kill t]
2493 ["Edit group parameters" gnus-summary-edit-parameters t]
2494 ["Customize group parameters" gnus-summary-customize-parameters t]
2495 ["Send a bug report" gnus-bug t]
2497 ["Catchup and exit" gnus-summary-catchup-and-exit
2498 ,@(if (featurep 'xemacs) '(t)
2499 '(:help "Mark unread articles in this group as read, then exit"))]
2500 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2501 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2502 ["Exit group" gnus-summary-exit
2503 ,@(if (featurep 'xemacs) '(t)
2504 '(:help "Exit current group, return to group selection mode"))]
2505 ["Exit group without updating" gnus-summary-exit-no-update t]
2506 ["Exit and goto next group" gnus-summary-next-group t]
2507 ["Exit and goto prev group" gnus-summary-prev-group t]
2508 ["Reselect group" gnus-summary-reselect-current-group t]
2509 ["Rescan group" gnus-summary-rescan-group t]
2510 ["Update dribble" gnus-summary-save-newsrc t])))
2512 (gnus-run-hooks 'gnus-summary-menu-hook)))
2514 (defvar gnus-summary-tool-bar-map nil)
2516 ;; Emacs 21 tool bar. Should be no-op otherwise.
2517 (defun gnus-summary-make-tool-bar ()
2518 (if (and (fboundp 'tool-bar-add-item-from-menu)
2519 (default-value 'tool-bar-mode)
2520 (not gnus-summary-tool-bar-map))
2521 (setq gnus-summary-tool-bar-map
2522 (let ((tool-bar-map (make-sparse-keymap))
2523 (load-path (mm-image-load-path)))
2524 (tool-bar-add-item-from-menu
2525 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2526 (tool-bar-add-item-from-menu
2527 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2528 (tool-bar-add-item-from-menu
2529 'gnus-summary-post-news "post" gnus-summary-mode-map)
2530 (tool-bar-add-item-from-menu
2531 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2532 (tool-bar-add-item-from-menu
2533 'gnus-summary-followup "followup" gnus-summary-mode-map)
2534 (tool-bar-add-item-from-menu
2535 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2536 (tool-bar-add-item-from-menu
2537 'gnus-summary-reply "reply" gnus-summary-mode-map)
2538 (tool-bar-add-item-from-menu
2539 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2540 (tool-bar-add-item-from-menu
2541 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2542 (tool-bar-add-item-from-menu
2543 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2544 (tool-bar-add-item-from-menu
2545 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2546 (tool-bar-add-item-from-menu
2547 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2548 (tool-bar-add-item-from-menu
2549 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2550 (tool-bar-add-item-from-menu
2551 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2552 (tool-bar-add-item-from-menu
2553 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2555 (if gnus-summary-tool-bar-map
2556 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2558 (defun gnus-score-set-default (var value)
2559 "A version of set that updates the GNU Emacs menu-bar."
2561 ;; It is the message that forces the active status to be updated.
2564 (defun gnus-make-score-map (type)
2565 "Make a summary score map of type TYPE."
2568 (let ((headers '(("author" "from" string)
2569 ("subject" "subject" string)
2570 ("article body" "body" string)
2571 ("article head" "head" string)
2572 ("xref" "xref" string)
2573 ("extra header" "extra" string)
2574 ("lines" "lines" number)
2575 ("followups to author" "followup" string)))
2576 (types '((number ("less than" <)
2579 (string ("substring" s)
2583 (perms '(("temporary" (current-time-string))
2591 (if (eq type 'lower)
2596 (setq header (car headers))
2602 (let ((ts (cdr (assoc (nth 2 header) types)))
2618 'gnus-summary-score-entry
2620 (if (or (string= (nth 1 header)
2622 (string= (nth 1 header)
2625 (list 'gnus-summary-header
2627 (list 'quote (nth 1 (car ts)))
2628 (list 'gnus-score-delta-default
2635 (list (nreverse outp))))
2638 (list (nreverse outt))))
2640 (setq headers (cdr headers)))
2641 (list (nreverse outh))))))))
2645 (defun gnus-summary-mode (&optional group)
2646 "Major mode for reading articles.
2648 All normal editing commands are switched off.
2649 \\<gnus-summary-mode-map>
2650 Each line in this buffer represents one article. To read an
2651 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2652 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2655 You can also post articles and send mail from this buffer. To
2656 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2657 of an article, type `\\[gnus-summary-reply]'.
2659 There are approx. one gazillion commands you can execute in this
2660 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2662 The following commands are available:
2664 \\{gnus-summary-mode-map}"
2666 (kill-all-local-variables)
2667 (when (gnus-visual-p 'summary-menu 'menu)
2668 (gnus-summary-make-menu-bar)
2669 (gnus-summary-make-tool-bar))
2670 (gnus-summary-make-local-variables)
2671 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2672 (gnus-summary-make-local-variables))
2673 (gnus-make-thread-indent-array)
2674 (gnus-simplify-mode-line)
2675 (setq major-mode 'gnus-summary-mode)
2676 (setq mode-name "Summary")
2677 (make-local-variable 'minor-mode-alist)
2678 (use-local-map gnus-summary-mode-map)
2679 (buffer-disable-undo)
2680 (setq buffer-read-only t) ;Disable modification
2681 (setq truncate-lines t)
2682 (setq selective-display t)
2683 (setq selective-display-ellipses t) ;Display `...'
2684 (gnus-summary-set-display-table)
2685 (gnus-set-default-directory)
2686 (setq gnus-newsgroup-name group)
2687 (make-local-variable 'gnus-summary-line-format)
2688 (make-local-variable 'gnus-summary-line-format-spec)
2689 (make-local-variable 'gnus-summary-dummy-line-format)
2690 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2691 (make-local-variable 'gnus-summary-mark-positions)
2692 (gnus-make-local-hook 'pre-command-hook)
2693 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2694 (gnus-run-hooks 'gnus-summary-mode-hook)
2695 (turn-on-gnus-mailing-list-mode)
2696 (mm-enable-multibyte)
2697 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2698 (gnus-update-summary-mark-positions))
2700 (defun gnus-summary-make-local-variables ()
2701 "Make all the local summary buffer variables."
2703 (dolist (local gnus-summary-local-variables)
2706 (if (eq (cdr local) 'global)
2707 ;; Copy the global value of the variable.
2708 (setq global (symbol-value (car local)))
2709 ;; Use the value from the list.
2710 (setq global (eval (cdr local))))
2711 (set (make-local-variable (car local)) global))
2712 ;; Simple nil-valued local variable.
2713 (set (make-local-variable local) nil)))))
2715 (defun gnus-summary-clear-local-variables ()
2716 (let ((locals gnus-summary-local-variables))
2718 (if (consp (car locals))
2719 (and (vectorp (caar locals))
2720 (set (caar locals) nil))
2721 (and (vectorp (car locals))
2722 (set (car locals) nil)))
2723 (setq locals (cdr locals)))))
2725 ;; Summary data functions.
2727 (defmacro gnus-data-number (data)
2730 (defmacro gnus-data-set-number (data number)
2731 `(setcar ,data ,number))
2733 (defmacro gnus-data-mark (data)
2736 (defmacro gnus-data-set-mark (data mark)
2737 `(setcar (nthcdr 1 ,data) ,mark))
2739 (defmacro gnus-data-pos (data)
2742 (defmacro gnus-data-set-pos (data pos)
2743 `(setcar (nthcdr 2 ,data) ,pos))
2745 (defmacro gnus-data-header (data)
2748 (defmacro gnus-data-set-header (data header)
2749 `(setf (nth 3 ,data) ,header))
2751 (defmacro gnus-data-level (data)
2754 (defmacro gnus-data-unread-p (data)
2755 `(= (nth 1 ,data) gnus-unread-mark))
2757 (defmacro gnus-data-read-p (data)
2758 `(/= (nth 1 ,data) gnus-unread-mark))
2760 (defmacro gnus-data-pseudo-p (data)
2761 `(consp (nth 3 ,data)))
2763 (defmacro gnus-data-find (number)
2764 `(assq ,number gnus-newsgroup-data))
2766 (defmacro gnus-data-find-list (number &optional data)
2767 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2768 (memq (assq ,number bdata)
2771 (defmacro gnus-data-make (number mark pos header level)
2772 `(list ,number ,mark ,pos ,header ,level))
2774 (defun gnus-data-enter (after-article number mark pos header level offset)
2775 (let ((data (gnus-data-find-list after-article)))
2777 (error "No such article: %d" after-article))
2778 (setcdr data (cons (gnus-data-make number mark pos header level)
2780 (setq gnus-newsgroup-data-reverse nil)
2781 (gnus-data-update-list (cddr data) offset)))
2783 (defun gnus-data-enter-list (after-article list &optional offset)
2785 (let ((data (and after-article (gnus-data-find-list after-article)))
2789 (let ((odata gnus-newsgroup-data))
2790 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2792 (gnus-data-update-list odata offset)))
2793 ;; Find the last element in the list to be spliced into the main
2796 (setq list (cdr list)))
2799 (setcdr list gnus-newsgroup-data)
2800 (setq gnus-newsgroup-data ilist)
2802 (gnus-data-update-list (cdr list) offset)))
2803 (setcdr list (cdr data))
2806 (gnus-data-update-list (cdr list) offset))))
2807 (setq gnus-newsgroup-data-reverse nil))))
2809 (defun gnus-data-remove (article &optional offset)
2810 (let ((data gnus-newsgroup-data))
2811 (if (= (gnus-data-number (car data)) article)
2813 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2814 gnus-newsgroup-data-reverse nil)
2816 (gnus-data-update-list gnus-newsgroup-data offset)))
2818 (when (= (gnus-data-number (cadr data)) article)
2819 (setcdr data (cddr data))
2821 (gnus-data-update-list (cdr data) offset))
2823 gnus-newsgroup-data-reverse nil))
2824 (setq data (cdr data))))))
2826 (defmacro gnus-data-list (backward)
2828 (or gnus-newsgroup-data-reverse
2829 (setq gnus-newsgroup-data-reverse
2830 (reverse gnus-newsgroup-data)))
2831 gnus-newsgroup-data))
2833 (defun gnus-data-update-list (data offset)
2834 "Add OFFSET to the POS of all data entries in DATA."
2835 (setq gnus-newsgroup-data-reverse nil)
2837 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2838 (setq data (cdr data))))
2840 (defun gnus-summary-article-pseudo-p (article)
2841 "Say whether this article is a pseudo article or not."
2842 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2844 (defmacro gnus-summary-article-sparse-p (article)
2845 "Say whether this article is a sparse article or not."
2846 `(memq ,article gnus-newsgroup-sparse))
2848 (defmacro gnus-summary-article-ancient-p (article)
2849 "Say whether this article is a sparse article or not."
2850 `(memq ,article gnus-newsgroup-ancient))
2852 (defun gnus-article-parent-p (number)
2853 "Say whether this article is a parent or not."
2854 (let ((data (gnus-data-find-list number)))
2855 (and (cdr data) ; There has to be an article after...
2856 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2857 (gnus-data-level (nth 1 data))))))
2859 (defun gnus-article-children (number)
2860 "Return a list of all children to NUMBER."
2861 (let* ((data (gnus-data-find-list number))
2862 (level (gnus-data-level (car data)))
2864 (setq data (cdr data))
2866 (= (gnus-data-level (car data)) (1+ level)))
2867 (push (gnus-data-number (car data)) children)
2868 (setq data (cdr data)))
2871 (defmacro gnus-summary-skip-intangible ()
2872 "If the current article is intangible, then jump to a different article."
2873 '(let ((to (get-text-property (point) 'gnus-intangible)))
2874 (and to (gnus-summary-goto-subject to))))
2876 (defmacro gnus-summary-article-intangible-p ()
2877 "Say whether this article is intangible or not."
2878 '(get-text-property (point) 'gnus-intangible))
2880 (defun gnus-article-read-p (article)
2881 "Say whether ARTICLE is read or not."
2882 (not (or (memq article gnus-newsgroup-marked)
2883 (memq article gnus-newsgroup-spam-marked)
2884 (memq article gnus-newsgroup-unreads)
2885 (memq article gnus-newsgroup-unselected)
2886 (memq article gnus-newsgroup-dormant))))
2888 ;; Some summary mode macros.
2890 (defmacro gnus-summary-article-number ()
2891 "The article number of the article on the current line.
2892 If there isn't an article number here, then we return the current
2895 (gnus-summary-skip-intangible)
2896 (or (get-text-property (point) 'gnus-number)
2897 (gnus-summary-last-subject))))
2899 (defmacro gnus-summary-article-header (&optional number)
2900 "Return the header of article NUMBER."
2901 `(gnus-data-header (gnus-data-find
2902 ,(or number '(gnus-summary-article-number)))))
2904 (defmacro gnus-summary-thread-level (&optional number)
2905 "Return the level of thread that starts with article NUMBER."
2906 `(if (and (eq gnus-summary-make-false-root 'dummy)
2907 (get-text-property (point) 'gnus-intangible))
2909 (gnus-data-level (gnus-data-find
2910 ,(or number '(gnus-summary-article-number))))))
2912 (defmacro gnus-summary-article-mark (&optional number)
2913 "Return the mark of article NUMBER."
2914 `(gnus-data-mark (gnus-data-find
2915 ,(or number '(gnus-summary-article-number)))))
2917 (defmacro gnus-summary-article-pos (&optional number)
2918 "Return the position of the line of article NUMBER."
2919 `(gnus-data-pos (gnus-data-find
2920 ,(or number '(gnus-summary-article-number)))))
2922 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2923 (defmacro gnus-summary-article-subject (&optional number)
2924 "Return current subject string or nil if nothing."
2927 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2928 '(gnus-data-header (assq (gnus-summary-article-number)
2929 gnus-newsgroup-data)))))
2932 (mail-header-subject headers))))
2934 (defmacro gnus-summary-article-score (&optional number)
2935 "Return current article score."
2936 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2937 gnus-newsgroup-scored))
2938 gnus-summary-default-score 0))
2940 (defun gnus-summary-article-children (&optional number)
2941 "Return a list of article numbers that are children of article NUMBER."
2942 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2943 (level (gnus-data-level (car data)))
2945 (while (and (setq data (cdr data))
2946 (> (setq l (gnus-data-level (car data))) level))
2947 (and (= (1+ level) l)
2948 (push (gnus-data-number (car data))
2950 (nreverse children)))
2952 (defun gnus-summary-article-parent (&optional number)
2953 "Return the article number of the parent of article NUMBER."
2954 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2955 (gnus-data-list t)))
2956 (level (gnus-data-level (car data))))
2958 () ; This is a root.
2959 ;; We search until we find an article with a level less than
2960 ;; this one. That function has to be the parent.
2961 (while (and (setq data (cdr data))
2962 (not (< (gnus-data-level (car data)) level))))
2963 (and data (gnus-data-number (car data))))))
2965 (defun gnus-unread-mark-p (mark)
2966 "Say whether MARK is the unread mark."
2967 (= mark gnus-unread-mark))
2969 (defun gnus-read-mark-p (mark)
2970 "Say whether MARK is one of the marks that mark as read.
2971 This is all marks except unread, ticked, dormant, and expirable."
2972 (not (or (= mark gnus-unread-mark)
2973 (= mark gnus-ticked-mark)
2974 (= mark gnus-spam-mark)
2975 (= mark gnus-dormant-mark)
2976 (= mark gnus-expirable-mark))))
2978 (defmacro gnus-article-mark (number)
2979 "Return the MARK of article NUMBER.
2980 This macro should only be used when computing the mark the \"first\"
2981 time; i.e., when generating the summary lines. After that,
2982 `gnus-summary-article-mark' should be used to examine the
2985 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2986 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2987 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2988 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2989 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2990 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2991 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2992 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2993 gnus-ancient-mark))))
2995 ;; Saving hidden threads.
2997 (defmacro gnus-save-hidden-threads (&rest forms)
2998 "Save hidden threads, eval FORMS, and restore the hidden threads."
2999 (let ((config (make-symbol "config")))
3000 `(let ((,config (gnus-hidden-threads-configuration)))
3004 (gnus-restore-hidden-threads-configuration ,config)))))
3005 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3006 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3008 (defun gnus-data-compute-positions ()
3009 "Compute the positions of all articles."
3010 (setq gnus-newsgroup-data-reverse nil)
3011 (let ((data gnus-newsgroup-data))
3013 (gnus-save-hidden-threads
3014 (gnus-summary-show-all-threads)
3015 (goto-char (point-min))
3017 (while (get-text-property (point) 'gnus-intangible)
3019 (gnus-data-set-pos (car data) (+ (point) 3))
3020 (setq data (cdr data))
3021 (forward-line 1))))))
3023 (defun gnus-hidden-threads-configuration ()
3024 "Return the current hidden threads configuration."
3027 (goto-char (point-min))
3028 (while (search-forward "\r" nil t)
3029 (push (1- (point)) config))
3032 (defun gnus-restore-hidden-threads-configuration (config)
3033 "Restore hidden threads configuration from CONFIG."
3035 (let (point buffer-read-only)
3036 (while (setq point (pop config))
3037 (when (and (< point (point-max))
3039 (eq (char-after) ?\n))
3040 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3042 ;; Various summary mode internalish functions.
3044 (defun gnus-mouse-pick-article (e)
3047 (gnus-summary-next-page nil t))
3049 (defun gnus-summary-set-display-table ()
3050 "Change the display table.
3051 Odd characters have a tendency to mess
3052 up nicely formatted displays - we make all possible glyphs
3053 display only a single character."
3055 ;; We start from the standard display table, if any.
3056 (let ((table (or (copy-sequence standard-display-table)
3057 (make-display-table)))
3059 ;; Nix out all the control chars...
3060 (while (>= (setq i (1- i)) 0)
3061 (aset table i [??]))
3062 ;; ... but not newline and cr, of course. (cr is necessary for the
3063 ;; selective display).
3064 (aset table ?\n nil)
3065 (aset table ?\r nil)
3066 ;; We keep TAB as well.
3067 (aset table ?\t nil)
3068 ;; We nix out any glyphs over 126 that are not set already.
3070 (while (>= (setq i (1- i)) 127)
3071 ;; Only modify if the entry is nil.
3072 (unless (aref table i)
3073 (aset table i [??]))))
3074 (setq buffer-display-table table)))
3076 (defun gnus-summary-set-article-display-arrow (pos)
3077 "Update the overlay arrow to point to line at position POS."
3078 (when (and gnus-summary-display-arrow
3079 (boundp 'overlay-arrow-position)
3080 (boundp 'overlay-arrow-string))
3084 (unless overlay-arrow-position
3085 (setq overlay-arrow-position (make-marker)))
3086 (setq overlay-arrow-string "=>"
3087 overlay-arrow-position (set-marker overlay-arrow-position
3089 (current-buffer))))))
3091 (defun gnus-summary-setup-buffer (group)
3092 "Initialize summary buffer."
3093 (let ((buffer (gnus-summary-buffer-name group))
3094 (dead-name (concat "*Dead Summary "
3095 (gnus-group-decoded-name group) "*")))
3096 ;; If a dead summary buffer exists, we kill it.
3097 (when (gnus-buffer-live-p dead-name)
3098 (gnus-kill-buffer dead-name))
3099 (if (get-buffer buffer)
3102 (setq gnus-summary-buffer (current-buffer))
3103 (not gnus-newsgroup-prepared))
3104 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3105 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3106 (gnus-summary-mode group)
3108 (gnus-carpal-setup-buffer 'summary))
3109 (unless gnus-single-article-buffer
3110 (make-local-variable 'gnus-article-buffer)
3111 (make-local-variable 'gnus-article-current)
3112 (make-local-variable 'gnus-original-article-buffer))
3113 (setq gnus-newsgroup-name group)
3114 ;; Set any local variables in the group parameters.
3115 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3118 (defun gnus-set-global-variables ()
3119 "Set the global equivalents of the buffer-local variables.
3120 They are set to the latest values they had. These reflect the summary
3121 buffer that was in action when the last article was fetched."
3122 (when (eq major-mode 'gnus-summary-mode)
3123 (setq gnus-summary-buffer (current-buffer))
3124 (let ((name gnus-newsgroup-name)
3125 (marked gnus-newsgroup-marked)
3126 (spam gnus-newsgroup-spam-marked)
3127 (unread gnus-newsgroup-unreads)
3128 (headers gnus-current-headers)
3129 (data gnus-newsgroup-data)
3130 (summary gnus-summary-buffer)
3131 (article-buffer gnus-article-buffer)
3132 (original gnus-original-article-buffer)
3133 (gac gnus-article-current)
3134 (reffed gnus-reffed-article-number)
3135 (score-file gnus-current-score-file)
3136 (default-charset gnus-newsgroup-charset)
3138 (let ((locals gnus-newsgroup-variables))
3140 (if (consp (car locals))
3141 (push (eval (caar locals)) vlist)
3142 (push (eval (car locals)) vlist))
3143 (setq locals (cdr locals)))
3144 (setq vlist (nreverse vlist)))
3146 (set-buffer gnus-group-buffer)
3147 (setq gnus-newsgroup-name name
3148 gnus-newsgroup-marked marked
3149 gnus-newsgroup-spam-marked spam
3150 gnus-newsgroup-unreads unread
3151 gnus-current-headers headers
3152 gnus-newsgroup-data data
3153 gnus-article-current gac
3154 gnus-summary-buffer summary
3155 gnus-article-buffer article-buffer
3156 gnus-original-article-buffer original
3157 gnus-reffed-article-number reffed
3158 gnus-current-score-file score-file
3159 gnus-newsgroup-charset default-charset)
3160 (let ((locals gnus-newsgroup-variables))
3162 (if (consp (car locals))
3163 (set (caar locals) (pop vlist))
3164 (set (car locals) (pop vlist)))
3165 (setq locals (cdr locals))))
3166 ;; The article buffer also has local variables.
3167 (when (gnus-buffer-live-p gnus-article-buffer)
3168 (set-buffer gnus-article-buffer)
3169 (setq gnus-summary-buffer summary))))))
3171 (defun gnus-summary-article-unread-p (article)
3172 "Say whether ARTICLE is unread or not."
3173 (memq article gnus-newsgroup-unreads))
3175 (defun gnus-summary-first-article-p (&optional article)
3176 "Return whether ARTICLE is the first article in the buffer."
3177 (if (not (setq article (or article (gnus-summary-article-number))))
3179 (eq article (caar gnus-newsgroup-data))))
3181 (defun gnus-summary-last-article-p (&optional article)
3182 "Return whether ARTICLE is the last article in the buffer."
3183 (if (not (setq article (or article (gnus-summary-article-number))))
3184 ;; All non-existent numbers are the last article. :-)
3186 (not (cdr (gnus-data-find-list article)))))
3188 (defun gnus-make-thread-indent-array ()
3190 (unless (and gnus-thread-indent-array
3191 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3192 (setq gnus-thread-indent-array (make-vector 201 "")
3193 gnus-thread-indent-array-level gnus-thread-indent-level)
3195 (aset gnus-thread-indent-array n
3196 (make-string (* n gnus-thread-indent-level) ? ))
3199 (defun gnus-update-summary-mark-positions ()
3200 "Compute where the summary marks are to go."
3202 (when (gnus-buffer-exists-p gnus-summary-buffer)
3203 (set-buffer gnus-summary-buffer))
3204 (let ((gnus-replied-mark 129)
3205 (gnus-score-below-mark 130)
3206 (gnus-score-over-mark 130)
3207 (gnus-undownloaded-mark 131)
3208 (spec gnus-summary-line-format-spec)
3211 (gnus-set-work-buffer)
3212 (let ((gnus-summary-line-format-spec spec)
3213 (gnus-newsgroup-downloadable '(0)))
3214 (gnus-summary-insert-line
3215 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3216 0 nil t 128 t nil "" nil 1)
3217 (goto-char (point-min))
3218 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3219 (- (point) (point-min) 1)))))
3220 (goto-char (point-min))
3221 (push (cons 'replied (and (search-forward "\201" nil t)
3222 (- (point) (point-min) 1)))
3224 (goto-char (point-min))
3225 (push (cons 'score (and (search-forward "\202" nil t)
3226 (- (point) (point-min) 1)))
3228 (goto-char (point-min))
3229 (push (cons 'download
3230 (and (search-forward "\203" nil t)
3231 (- (point) (point-min) 1)))
3233 (setq gnus-summary-mark-positions pos))))
3235 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3236 "Insert a dummy root in the summary buffer."
3238 (gnus-add-text-properties
3239 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3240 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3242 (defun gnus-summary-extract-address-component (from)
3243 (or (car (funcall gnus-extract-address-components from))
3246 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3247 (let ((mail-parse-charset gnus-newsgroup-charset)
3248 ; Is it really necessary to do this next part for each summary line?
3249 ; Luckily, doesn't seem to slow things down much.
3250 (mail-parse-ignored-charsets
3251 (with-current-buffer gnus-summary-buffer
3252 gnus-newsgroup-ignored-charsets)))
3254 (and gnus-ignored-from-addresses
3255 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3256 (let ((extra-headers (mail-header-extra header))
3260 ((setq to (cdr (assq 'To extra-headers)))
3263 (gnus-summary-extract-address-component
3264 (funcall gnus-decode-encoded-word-function to)))))
3265 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3266 (concat "=> " newsgroups)))))
3267 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3269 (defun gnus-summary-insert-line (gnus-tmp-header
3270 gnus-tmp-level gnus-tmp-current
3271 undownloaded gnus-tmp-unread gnus-tmp-replied
3272 gnus-tmp-expirable gnus-tmp-subject-or-nil
3273 &optional gnus-tmp-dummy gnus-tmp-score
3275 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3276 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3277 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3278 (gnus-tmp-score-char
3279 (if (or (null gnus-summary-default-score)
3280 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3281 gnus-summary-zcore-fuzz))
3283 (if (< gnus-tmp-score gnus-summary-default-score)
3284 gnus-score-below-mark gnus-score-over-mark)))
3285 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3287 (cond (gnus-tmp-process gnus-process-mark)
3288 ((memq gnus-tmp-current gnus-newsgroup-cached)
3290 (gnus-tmp-replied gnus-replied-mark)
3291 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3292 gnus-forwarded-mark)
3293 ((memq gnus-tmp-current gnus-newsgroup-saved)
3295 ((memq gnus-tmp-number gnus-newsgroup-recent)
3297 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3300 (gnus-tmp-downloaded
3302 gnus-undownloaded-mark)
3303 (gnus-newsgroup-agentized
3304 gnus-downloaded-mark)
3307 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3310 ((string-match "<[^>]+> *$" gnus-tmp-from)
3311 (let ((beg (match-beginning 0)))
3312 (or (and (string-match "^\".+\"" gnus-tmp-from)
3313 (substring gnus-tmp-from 1 (1- (match-end 0))))
3314 (substring gnus-tmp-from 0 beg))))
3315 ((string-match "(.+)" gnus-tmp-from)
3316 (substring gnus-tmp-from
3317 (1+ (match-beginning 0)) (1- (match-end 0))))
3319 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3320 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3321 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3322 (buffer-read-only nil))
3323 (when (string= gnus-tmp-name "")
3324 (setq gnus-tmp-name gnus-tmp-from))
3325 (unless (numberp gnus-tmp-lines)
3326 (setq gnus-tmp-lines -1))
3327 (if (= gnus-tmp-lines -1)
3328 (setq gnus-tmp-lines "?")
3329 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3330 (gnus-put-text-property
3332 (progn (eval gnus-summary-line-format-spec) (point))
3333 'gnus-number gnus-tmp-number)
3334 (when (gnus-visual-p 'summary-highlight 'highlight)
3336 (gnus-run-hooks 'gnus-summary-update-hook)
3339 (defun gnus-summary-update-line (&optional dont-update)
3340 "Update summary line after change."
3341 (when (and gnus-summary-default-score
3342 (not gnus-summary-inhibit-highlight))
3343 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3344 (article (gnus-summary-article-number))
3345 (score (gnus-summary-article-score article)))
3347 (if (and gnus-summary-mark-below
3348 (< (gnus-summary-article-score)
3349 gnus-summary-mark-below))
3350 ;; This article has a low score, so we mark it as read.
3351 (when (memq article gnus-newsgroup-unreads)
3352 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3353 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3354 ;; This article was previously marked as read on account
3355 ;; of a low score, but now it has risen, so we mark it as
3357 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3358 (gnus-summary-update-mark
3359 (if (or (null gnus-summary-default-score)
3360 (<= (abs (- score gnus-summary-default-score))
3361 gnus-summary-zcore-fuzz))
3363 (if (< score gnus-summary-default-score)
3364 gnus-score-below-mark gnus-score-over-mark))
3366 ;; Do visual highlighting.
3367 (when (gnus-visual-p 'summary-highlight 'highlight)
3368 (gnus-run-hooks 'gnus-summary-update-hook)))))
3370 (defvar gnus-tmp-new-adopts nil)
3372 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3373 "Return the number of articles in THREAD.
3374 This may be 0 in some cases -- if none of the articles in
3375 the thread are to be displayed."
3377 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3379 ((not (listp thread))
3381 ((and (consp thread) (cdr thread))
3384 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3387 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3390 (when (and level (zerop level) gnus-tmp-new-adopts)
3393 'gnus-summary-number-of-articles-in-thread
3394 gnus-tmp-new-adopts))))
3396 (if (> number 1) gnus-not-empty-thread-mark
3397 gnus-empty-thread-mark)
3400 (defsubst gnus-summary-line-message-size (head)
3401 "Return pretty-printed version of message size.
3402 This function is intended to be used in
3403 `gnus-summary-line-format-alist'."
3404 (let ((c (or (mail-header-chars head) -1)))
3405 (cond ((< c 0) "n/a") ; chars not available
3406 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3407 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3408 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3409 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3412 (defun gnus-summary-set-local-parameters (group)
3413 "Go through the local params of GROUP and set all variable specs in that list."
3414 (let ((params (gnus-group-find-parameter group))
3415 (vars '(quit-config)) ; Ignore quit-config.
3418 (setq elem (car params)
3419 params (cdr params))
3420 (and (consp elem) ; Has to be a cons.
3421 (consp (cdr elem)) ; The cdr has to be a list.
3422 (symbolp (car elem)) ; Has to be a symbol in there.
3423 (not (memq (car elem) vars))
3424 (ignore-errors ; So we set it.
3425 (push (car elem) vars)
3426 (make-local-variable (car elem))
3427 (set (car elem) (eval (nth 1 elem))))))))
3429 (defun gnus-summary-read-group (group &optional show-all no-article
3430 kill-buffer no-display backward
3432 "Start reading news in newsgroup GROUP.
3433 If SHOW-ALL is non-nil, already read articles are also listed.
3434 If NO-ARTICLE is non-nil, no article is selected initially.
3435 If NO-DISPLAY, don't generate a summary buffer."
3439 (let ((gnus-auto-select-next nil))
3440 (or (gnus-summary-read-group-1
3441 group show-all no-article
3442 kill-buffer no-display
3445 select-articles nil)))))
3446 (eq gnus-auto-select-next 'quietly))
3447 (set-buffer gnus-group-buffer)
3448 ;; The entry function called above goes to the next
3449 ;; group automatically, so we go two groups back
3450 ;; if we are searching for the previous group.
3452 (gnus-group-prev-unread-group 2))
3453 (if (not (equal group (gnus-group-group-name)))
3454 (setq group (gnus-group-group-name))
3458 (defun gnus-summary-read-group-1 (group show-all no-article
3459 kill-buffer no-display
3460 &optional select-articles)
3461 ;; Killed foreign groups can't be entered.
3462 ;; (when (and (not (gnus-group-native-p group))
3463 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3464 ;; (error "Dead non-native groups can't be entered"))
3465 (gnus-message 5 "Retrieving newsgroup: %s..."
3466 (gnus-group-decoded-name group))
3467 (let* ((new-group (gnus-summary-setup-buffer group))
3468 (quit-config (gnus-group-quit-config group))
3469 (did-select (and new-group (gnus-select-newsgroup
3470 group show-all select-articles))))
3472 ;; This summary buffer exists already, so we just select it.
3474 (gnus-set-global-variables)
3476 (gnus-kill-or-deaden-summary kill-buffer))
3477 (gnus-configure-windows 'summary 'force)
3478 (gnus-set-mode-line 'summary)
3479 (gnus-summary-position-point)
3482 ;; We couldn't select this group.
3484 (when (and (eq major-mode 'gnus-summary-mode)
3485 (not (equal (current-buffer) kill-buffer)))
3486 (kill-buffer (current-buffer))
3487 (if (not quit-config)
3489 ;; Update the info -- marks might need to be removed,
3491 (gnus-summary-update-info)
3492 (set-buffer gnus-group-buffer)
3493 (gnus-group-jump-to-group group)
3494 (gnus-group-next-unread-group 1))
3495 (gnus-handle-ephemeral-exit quit-config)))
3496 (let ((grpinfo (gnus-get-info group)))
3497 (if (null (gnus-info-read grpinfo))
3498 (gnus-message 3 "Group %s contains no messages"
3499 (gnus-group-decoded-name group))
3500 (gnus-message 3 "Can't select group")))
3502 ;; The user did a `C-g' while prompting for number of articles,
3503 ;; so we exit this group.
3504 ((eq did-select 'quit)
3505 (and (eq major-mode 'gnus-summary-mode)
3506 (not (equal (current-buffer) kill-buffer))
3507 (kill-buffer (current-buffer)))
3509 (gnus-kill-or-deaden-summary kill-buffer))
3510 (if (not quit-config)
3512 (set-buffer gnus-group-buffer)
3513 (gnus-group-jump-to-group group)
3514 (gnus-group-next-unread-group 1)
3515 (gnus-configure-windows 'group 'force))
3516 (gnus-handle-ephemeral-exit quit-config))
3517 ;; Finally signal the quit.
3519 ;; The group was successfully selected.
3521 (gnus-set-global-variables)
3522 ;; Save the active value in effect when the group was entered.
3523 (setq gnus-newsgroup-active
3525 (gnus-active gnus-newsgroup-name)))
3526 ;; You can change the summary buffer in some way with this hook.
3527 (gnus-run-hooks 'gnus-select-group-hook)
3528 (gnus-update-format-specifications
3529 nil 'summary 'summary-mode 'summary-dummy)
3530 (gnus-update-summary-mark-positions)
3531 ;; Do score processing.
3532 (when gnus-use-scoring
3533 (gnus-possibly-score-headers))
3534 ;; Check whether to fill in the gaps in the threads.
3535 (when gnus-build-sparse-threads
3536 (gnus-build-sparse-threads))
3537 ;; Find the initial limit.
3538 (if gnus-show-threads
3540 (let ((gnus-newsgroup-dormant nil))
3541 (gnus-summary-initial-limit show-all))
3542 (gnus-summary-initial-limit show-all))
3543 ;; When unthreaded, all articles are always shown.
3544 (setq gnus-newsgroup-limit
3546 (lambda (header) (mail-header-number header))
3547 gnus-newsgroup-headers)))
3548 ;; Generate the summary buffer.
3550 (gnus-summary-prepare))
3551 (when gnus-use-trees
3552 (gnus-tree-open group)
3553 (setq gnus-summary-highlight-line-function
3554 'gnus-tree-highlight-article))
3555 ;; If the summary buffer is empty, but there are some low-scored
3556 ;; articles or some excluded dormants, we include these in the
3558 (when (and (zerop (buffer-size))
3560 (cond (gnus-newsgroup-dormant
3561 (gnus-summary-limit-include-dormant))
3562 ((and gnus-newsgroup-scored show-all)
3563 (gnus-summary-limit-include-expunged t))))
3564 ;; Function `gnus-apply-kill-file' must be called in this hook.
3565 (gnus-run-hooks 'gnus-apply-kill-hook)
3566 (if (and (zerop (buffer-size))
3569 ;; This newsgroup is empty.
3570 (gnus-summary-catchup-and-exit nil t)
3571 (gnus-message 6 "No unread news")
3573 (gnus-kill-or-deaden-summary kill-buffer))
3574 ;; Return nil from this function.
3576 ;; Hide conversation thread subtrees. We cannot do this in
3577 ;; gnus-summary-prepare-hook since kill processing may not
3578 ;; work with hidden articles.
3579 (gnus-summary-maybe-hide-threads)
3581 (gnus-kill-or-deaden-summary kill-buffer))
3582 (gnus-summary-auto-select-subject)
3583 ;; Show first unread article if requested.
3584 (if (and (not no-article)
3586 gnus-newsgroup-unreads
3587 gnus-auto-select-first)
3589 (gnus-configure-windows 'summary)
3590 (let ((art (gnus-summary-article-number)))
3591 (unless (and (not gnus-plugged)
3592 (or (memq art gnus-newsgroup-undownloaded)
3593 (memq art gnus-newsgroup-downloadable)))
3594 (gnus-summary-goto-article art))))
3595 ;; Don't select any articles.
3596 (gnus-summary-position-point)
3597 (gnus-configure-windows 'summary 'force)
3598 (gnus-set-mode-line 'summary))
3599 (when (and gnus-auto-center-group
3600 (get-buffer-window gnus-group-buffer t))
3601 ;; Gotta use windows, because recenter does weird stuff if
3602 ;; the current buffer ain't the displayed window.
3603 (let ((owin (selected-window)))
3604 (select-window (get-buffer-window gnus-group-buffer t))
3605 (when (gnus-group-goto-group group)
3607 (select-window owin)))
3608 ;; Mark this buffer as "prepared".
3609 (setq gnus-newsgroup-prepared t)
3610 (gnus-run-hooks 'gnus-summary-prepared-hook)
3611 (unless (gnus-ephemeral-group-p group)
3612 (gnus-group-update-group group))
3615 (defun gnus-summary-auto-select-subject ()
3616 "Select the subject line on initial group entry."
3617 (goto-char (point-min))
3619 ((eq gnus-auto-select-subject 'best)
3620 (gnus-summary-best-unread-subject))
3621 ((eq gnus-auto-select-subject 'unread)
3622 (gnus-summary-first-unread-subject))
3623 ((eq gnus-auto-select-subject 'unseen)
3624 (gnus-summary-first-unseen-subject))
3625 ((eq gnus-auto-select-subject 'unseen-or-unread)
3626 (gnus-summary-first-unseen-or-unread-subject))
3627 ((eq gnus-auto-select-subject 'first)
3630 ((functionp gnus-auto-select-subject)
3631 (funcall gnus-auto-select-subject))))
3633 (defun gnus-summary-prepare ()
3634 "Generate the summary buffer."
3636 (let ((buffer-read-only nil))
3638 (setq gnus-newsgroup-data nil
3639 gnus-newsgroup-data-reverse nil)
3640 (gnus-run-hooks 'gnus-summary-generate-hook)
3641 ;; Generate the buffer, either with threads or without.
3642 (when gnus-newsgroup-headers
3643 (gnus-summary-prepare-threads
3644 (if gnus-show-threads
3645 (gnus-sort-gathered-threads
3646 (funcall gnus-summary-thread-gathering-function
3648 (gnus-cut-threads (gnus-make-threads)))))
3649 ;; Unthreaded display.
3650 (gnus-sort-articles gnus-newsgroup-headers))))
3651 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3652 ;; Call hooks for modifying summary buffer.
3653 (goto-char (point-min))
3654 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3656 (defsubst gnus-general-simplify-subject (subject)
3657 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3660 ;; Truncate the subject.
3661 (gnus-simplify-subject-functions
3662 (gnus-map-function gnus-simplify-subject-functions subject))
3663 ((numberp gnus-summary-gather-subject-limit)
3664 (setq subject (gnus-simplify-subject-re subject))
3665 (if (> (length subject) gnus-summary-gather-subject-limit)
3666 (substring subject 0 gnus-summary-gather-subject-limit)
3668 ;; Fuzzily simplify it.
3669 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3670 (gnus-simplify-subject-fuzzy subject))
3671 ;; Just remove the leading "Re:".
3673 (gnus-simplify-subject-re subject))))
3675 (if (and gnus-summary-gather-exclude-subject
3676 (string-match gnus-summary-gather-exclude-subject subject))
3677 nil ; This article shouldn't be gathered
3680 (defun gnus-summary-simplify-subject-query ()
3681 "Query where the respool algorithm would put this article."
3683 (gnus-summary-select-article)
3684 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3686 (defun gnus-gather-threads-by-subject (threads)
3687 "Gather threads by looking at Subject headers."
3688 (if (not gnus-summary-make-false-root)
3690 (let ((hashtb (gnus-make-hashtable 1024))
3693 subject hthread whole-subject)
3695 (setq subject (gnus-general-simplify-subject
3696 (setq whole-subject (mail-header-subject
3699 (if (setq hthread (gnus-gethash subject hashtb))
3701 ;; We enter a dummy root into the thread, if we
3702 ;; haven't done that already.
3703 (unless (stringp (caar hthread))
3704 (setcar hthread (list whole-subject (car hthread))))
3705 ;; We add this new gathered thread to this gathered
3707 (setcdr (car hthread)
3708 (nconc (cdar hthread) (list (car threads))))
3709 ;; Remove it from the list of threads.
3710 (setcdr prev (cdr threads))
3711 (setq threads prev))
3712 ;; Enter this thread into the hash table.
3713 (gnus-sethash subject
3714 (if gnus-summary-make-false-root-always
3716 ;; If you want a dummy root above all
3718 (setcar threads (list whole-subject
3724 (setq threads (cdr threads)))
3727 (defun gnus-gather-threads-by-references (threads)
3728 "Gather threads by looking at References headers."
3729 (let ((idhashtb (gnus-make-hashtable 1024))
3730 (thhashtb (gnus-make-hashtable 1024))
3733 ids references id gthread gid entered ref)
3735 (when (setq references (mail-header-references (caar threads)))
3736 (setq id (mail-header-id (caar threads))
3737 ids (inline (gnus-split-references references))
3739 (while (setq ref (pop ids))
3740 (setq ids (delete ref ids))
3741 (if (not (setq gid (gnus-gethash ref idhashtb)))
3743 (gnus-sethash ref id idhashtb)
3744 (gnus-sethash id threads thhashtb))
3745 (setq gthread (gnus-gethash gid thhashtb))
3747 ;; We enter a dummy root into the thread, if we
3748 ;; haven't done that already.
3749 (unless (stringp (caar gthread))
3750 (setcar gthread (list (mail-header-subject (caar gthread))
3752 ;; We add this new gathered thread to this gathered
3754 (setcdr (car gthread)
3755 (nconc (cdar gthread) (list (car threads)))))
3756 ;; Add it into the thread hash table.
3757 (gnus-sethash id gthread thhashtb)
3759 ;; Remove it from the list of threads.
3760 (setcdr prev (cdr threads))
3761 (setq threads prev))))
3763 (setq threads (cdr threads)))
3766 (defun gnus-sort-gathered-threads (threads)
3767 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3768 (let ((result threads))
3770 (when (stringp (caar threads))
3771 (setcdr (car threads)
3772 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3773 (setq threads (cdr threads)))
3776 (defun gnus-thread-loop-p (root thread)
3777 "Say whether ROOT is in THREAD."
3778 (let ((stack (list thread))
3781 (while (setq thread (pop stack))
3782 (setq th (cdr thread))
3784 (not (eq (caar th) root)))
3787 ;; We have found a loop.
3789 (setcdr thread (delq (car th) (cdr thread)))
3790 (if (boundp (setq ref-dep (intern "none"
3791 gnus-newsgroup-dependencies)))
3792 (setcdr (symbol-value ref-dep)
3793 (nconc (cdr (symbol-value ref-dep))
3795 (set ref-dep (list nil (car th))))
3798 ;; Push all the subthreads onto the stack.
3799 (push (cdr thread) stack)))
3802 (defun gnus-make-threads ()
3803 "Go through the dependency hashtb and find the roots. Return all threads."
3805 (while (catch 'infloop
3808 ;; Deal with self-referencing References loops.
3809 (when (and (car (symbol-value refs))
3816 (car (symbol-value refs)) thread))
3817 (cdr (symbol-value refs)))))))
3820 (unless (car (symbol-value refs))
3821 ;; These threads do not refer back to any other
3822 ;; articles, so they're roots.
3823 (setq threads (append (cdr (symbol-value refs)) threads))))
3824 gnus-newsgroup-dependencies)))
3827 ;; Build the thread tree.
3828 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3829 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3831 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3832 if it was already present.
3834 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3835 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3836 Message-IDs will be renamed to a unique Message-ID before being
3839 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3840 (let* ((id (mail-header-id header))
3841 (id-dep (and id (intern id dependencies)))
3842 parent-id ref ref-dep ref-header replaced)
3843 ;; Enter this `header' in the `dependencies' table.
3847 ;; The first two cases do the normal part: enter a new `header'
3848 ;; in the `dependencies' table.
3849 ((not (boundp id-dep))
3850 (set id-dep (list header)))
3851 ((null (car (symbol-value id-dep)))
3852 (setcar (symbol-value id-dep) header))
3854 ;; From here the `header' was already present in the
3855 ;; `dependencies' table.
3857 ;; Overrides an existing entry;
3858 ;; just set the header part of the entry.
3859 (setcar (symbol-value id-dep) header)
3862 ;; Renames the existing `header' to a unique Message-ID.
3863 ((not gnus-summary-ignore-duplicates)
3864 ;; An article with this Message-ID has already been seen.
3865 ;; We rename the Message-ID.
3866 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3868 (mail-header-set-id header id))
3870 ;; The last case ignores an existing entry, except it adds any
3871 ;; additional Xrefs (in case the two articles came from different
3873 ;; Also sets `header' to `nil' meaning that the `dependencies'
3874 ;; table was *not* modified.
3876 (mail-header-set-xref
3877 (car (symbol-value id-dep))
3878 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3880 (or (mail-header-xref header) "")))
3883 (when (and header (not replaced))
3884 ;; First check that we are not creating a References loop.
3885 (setq parent-id (gnus-parent-id (mail-header-references header)))
3886 (setq ref parent-id)
3888 (setq ref-dep (intern-soft ref dependencies))
3890 (setq ref-header (car (symbol-value ref-dep))))
3891 (if (string= id ref)
3892 ;; Yuk! This is a reference loop. Make the article be a
3895 (mail-header-set-references (car (symbol-value id-dep)) "none")
3897 (setq parent-id nil))
3898 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3899 (setq ref-dep (intern (or parent-id "none") dependencies))
3900 (if (boundp ref-dep)
3901 (setcdr (symbol-value ref-dep)
3902 (nconc (cdr (symbol-value ref-dep))
3903 (list (symbol-value id-dep))))
3904 (set ref-dep (list nil (symbol-value id-dep)))))
3907 (defun gnus-extract-message-id-from-in-reply-to (string)
3908 (if (string-match "<[^>]+>" string)
3909 (substring string (match-beginning 0) (match-end 0))
3912 (defun gnus-build-sparse-threads ()
3913 (let ((headers gnus-newsgroup-headers)
3914 (mail-parse-charset gnus-newsgroup-charset)
3915 (gnus-summary-ignore-duplicates t)
3916 header references generation relations
3917 subject child end new-child date)
3918 ;; First we create an alist of generations/relations, where
3919 ;; generations is how much we trust the relation, and the relation
3921 (gnus-message 7 "Making sparse threads...")
3923 (nnheader-set-temp-buffer " *gnus sparse threads*")
3924 (while (setq header (pop headers))
3925 (when (and (setq references (mail-header-references header))
3926 (not (string= references "")))
3928 (setq child (mail-header-id header)
3929 subject (mail-header-subject header)
3930 date (mail-header-date header)
3932 (while (search-backward ">" nil t)
3933 (setq end (1+ (point)))
3934 (when (search-backward "<" nil t)
3935 (setq new-child (buffer-substring (point) end))
3936 (push (list (incf generation)
3937 child (setq child new-child)
3941 (push (list (1+ generation) child nil subject) relations))
3943 (kill-buffer (current-buffer)))
3944 ;; Sort over trustworthiness.
3947 (when (gnus-dependencies-add-header
3948 (make-full-mail-header
3949 gnus-reffed-article-number
3950 (nth 3 relation) "" (or (nth 4 relation) "")
3952 (or (nth 2 relation) "") 0 0 "")
3953 gnus-newsgroup-dependencies nil)
3954 (push gnus-reffed-article-number gnus-newsgroup-limit)
3955 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3956 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3957 gnus-newsgroup-reads)
3958 (decf gnus-reffed-article-number)))
3959 (sort relations 'car-less-than-car))
3960 (gnus-message 7 "Making sparse threads...done")))
3962 (defun gnus-build-old-threads ()
3963 ;; Look at all the articles that refer back to old articles, and
3964 ;; fetch the headers for the articles that aren't there. This will
3965 ;; build complete threads - if the roots haven't been expired by the
3967 (let ((mail-parse-charset gnus-newsgroup-charset)
3971 (when (not (car (symbol-value refs)))
3972 (setq heads (cdr (symbol-value refs)))
3974 (if (memq (mail-header-number (caar heads))
3975 gnus-newsgroup-dormant)
3976 (setq heads (cdr heads))
3977 (setq id (symbol-name refs))
3978 (while (and (setq id (gnus-build-get-header id))
3979 (not (car (gnus-id-to-thread id)))))
3980 (setq heads nil)))))
3981 gnus-newsgroup-dependencies)))
3983 (defsubst gnus-remove-odd-characters (string)
3984 "Translate STRING into something that doesn't contain weird characters."
3985 (mm-subst-char-in-string
3987 (mm-subst-char-in-string ?\n ?\- string t) t))
3989 ;; This function has to be called with point after the article number
3990 ;; on the beginning of the line.
3991 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3992 (let ((eol (point-at-eol))
3993 (buffer (current-buffer))
3994 header references in-reply-to)
3996 ;; overview: [num subject from date id refs chars lines misc]
3999 (narrow-to-region (point) eol)
4004 (make-full-mail-header
4006 (condition-case () ; subject
4007 (gnus-remove-odd-characters
4008 (funcall gnus-decode-encoded-word-function
4009 (setq x (nnheader-nov-field))))
4011 (condition-case () ; from
4012 (gnus-remove-odd-characters
4013 (funcall gnus-decode-encoded-word-function
4014 (setq x (nnheader-nov-field))))
4016 (nnheader-nov-field) ; date
4017 (nnheader-nov-read-message-id) ; id
4018 (setq references (nnheader-nov-field)) ; refs
4019 (nnheader-nov-read-integer) ; chars
4020 (nnheader-nov-read-integer) ; lines
4022 (if (looking-at "Xref: ")
4023 (goto-char (match-end 0)))
4024 (nnheader-nov-field)) ; Xref
4025 (nnheader-nov-parse-extra)))) ; extra
4029 (when (and (string= references "")
4030 (setq in-reply-to (mail-header-extra header))
4031 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4032 (mail-header-set-references
4033 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4035 (when gnus-alter-header-function
4036 (funcall gnus-alter-header-function header))
4037 (gnus-dependencies-add-header header dependencies force-new)))
4039 (defun gnus-build-get-header (id)
4040 "Look through the buffer of NOV lines and find the header to ID.
4041 Enter this line into the dependencies hash table, and return
4042 the id of the parent article (if any)."
4043 (let ((deps gnus-newsgroup-dependencies)
4047 (set-buffer nntp-server-buffer)
4048 (let ((case-fold-search nil))
4049 (goto-char (point-min))
4050 (while (and (not found)
4051 (search-forward id nil t))
4053 (setq found (looking-at
4054 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4055 (regexp-quote id))))
4056 (or found (beginning-of-line 2)))
4060 (setq header (gnus-nov-parse-line
4061 (read (current-buffer)) deps))
4062 (gnus-parent-id (mail-header-references header))))))
4064 (let ((number (mail-header-number header)))
4065 (push number gnus-newsgroup-limit)
4066 (push header gnus-newsgroup-headers)
4067 (if (memq number gnus-newsgroup-unselected)
4069 (setq gnus-newsgroup-unreads
4070 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4072 (setq gnus-newsgroup-unselected
4073 (delq number gnus-newsgroup-unselected)))
4074 (push number gnus-newsgroup-ancient)))))))
4076 (defun gnus-build-all-threads ()
4077 "Read all the headers."
4078 (let ((gnus-summary-ignore-duplicates t)
4079 (mail-parse-charset gnus-newsgroup-charset)
4080 (dependencies gnus-newsgroup-dependencies)
4083 (set-buffer nntp-server-buffer)
4084 (let ((case-fold-search nil))
4085 (goto-char (point-min))
4088 (setq article (read (current-buffer))
4089 header (gnus-nov-parse-line article dependencies)))
4092 (set-buffer gnus-summary-buffer)
4093 (push header gnus-newsgroup-headers)
4094 (if (memq (setq article (mail-header-number header))
4095 gnus-newsgroup-unselected)
4097 (setq gnus-newsgroup-unreads
4098 (gnus-add-to-sorted-list
4099 gnus-newsgroup-unreads article))
4100 (setq gnus-newsgroup-unselected
4101 (delq article gnus-newsgroup-unselected)))
4102 (push article gnus-newsgroup-ancient)))
4103 (forward-line 1)))))))
4105 (defun gnus-summary-update-article-line (article header)
4106 "Update the line for ARTICLE using HEADER."
4107 (let* ((id (mail-header-id header))
4108 (thread (gnus-id-to-thread id)))
4110 (error "Article in no thread"))
4111 ;; Update the thread.
4112 (setcar thread header)
4113 (gnus-summary-goto-subject article)
4114 (let* ((datal (gnus-data-find-list article))
4116 (buffer-read-only nil)
4117 (level (gnus-summary-thread-level)))
4119 (let ((inserted (- (point)
4121 (gnus-summary-insert-line
4123 (memq article gnus-newsgroup-undownloaded)
4124 (gnus-article-mark article)
4125 (memq article gnus-newsgroup-replied)
4126 (memq article gnus-newsgroup-expirable)
4127 ;; Only insert the Subject string when it's different
4128 ;; from the previous Subject string.
4133 (mail-header-subject
4136 (gnus-data-find-list
4138 (gnus-data-list t)))))
4139 ;; Error on the side of excessive subjects.
4141 (mail-header-subject header)))
4143 (mail-header-subject header))
4144 nil (cdr (assq article gnus-newsgroup-scored))
4145 (memq article gnus-newsgroup-processable))
4148 (gnus-data-update-list
4150 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4152 (defun gnus-summary-update-article (article &optional iheader)
4153 "Update ARTICLE in the summary buffer."
4154 (set-buffer gnus-summary-buffer)
4155 (let* ((header (gnus-summary-article-header article))
4156 (id (mail-header-id header))
4157 (data (gnus-data-find article))
4158 (thread (gnus-id-to-thread id))
4159 (references (mail-header-references header))
4163 (when (and references
4164 (not (equal "" references)))
4167 (buffer-read-only nil)
4173 (delq thread parent)))
4174 (if (gnus-summary-insert-subject id header)
4175 ;; Set the (possibly) new article number in the data structure.
4176 (gnus-data-set-number data (gnus-id-to-article id))
4180 (defun gnus-rebuild-thread (id &optional line)
4181 "Rebuild the thread containing ID.
4182 If LINE, insert the rebuilt thread starting on line LINE."
4183 (let ((buffer-read-only nil)
4184 old-pos current thread data)
4185 (if (not gnus-show-threads)
4186 (setq thread (list (car (gnus-id-to-thread id))))
4187 ;; Get the thread this article is part of.
4188 (setq thread (gnus-remove-thread id)))
4189 (setq old-pos (point-at-bol))
4190 (setq current (save-excursion
4191 (and (re-search-backward "[\r\n]" nil t)
4192 (gnus-summary-article-number))))
4193 ;; If this is a gathered thread, we have to go some re-gathering.
4194 (when (stringp (car thread))
4195 (let ((subject (car thread))
4197 (setq thread (cdr thread))
4199 (unless (memq (setq thr (gnus-id-to-thread
4201 (mail-header-id (caar thread)))))
4204 (setq thread (cdr thread)))
4205 ;; We now have all (unique) roots.
4206 (if (= (length roots) 1)
4207 ;; All the loose roots are now one solid root.
4208 (setq thread (car roots))
4209 (setq thread (cons subject (gnus-sort-threads roots))))))
4211 ;; We then insert this thread into the summary buffer.
4213 (goto-char (point-min))
4214 (forward-line (1- line)))
4215 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4216 (if gnus-show-threads
4217 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4218 (gnus-summary-prepare-unthreaded thread))
4219 (setq data (nreverse gnus-newsgroup-data))
4220 (setq threads gnus-newsgroup-threads))
4221 ;; We splice the new data into the data structure.
4222 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4223 ;;!!! then we want to insert at the beginning of the buffer.
4224 ;;!!! That happens to be true with Gnus now, but that may
4225 ;;!!! change in the future. Perhaps.
4226 (gnus-data-enter-list
4227 (if line nil current) data (- (point) old-pos))
4228 (setq gnus-newsgroup-threads
4229 (nconc threads gnus-newsgroup-threads))
4230 (gnus-data-compute-positions))))
4232 (defun gnus-number-to-header (number)
4233 "Return the header for article NUMBER."
4234 (let ((headers gnus-newsgroup-headers))
4236 (not (= number (mail-header-number (car headers)))))
4241 (defun gnus-parent-headers (in-headers &optional generation)
4242 "Return the headers of the GENERATIONeth parent of HEADERS."
4244 (setq generation 1))
4246 (headers in-headers)
4249 (not (zerop generation))
4250 (setq references (mail-header-references headers)))
4251 (setq headers (if (and references
4252 (setq parent (gnus-parent-id references)))
4253 (car (gnus-id-to-thread parent))
4256 (and (not (eq headers in-headers))
4259 (defun gnus-id-to-thread (id)
4260 "Return the (sub-)thread where ID appears."
4261 (gnus-gethash id gnus-newsgroup-dependencies))
4263 (defun gnus-id-to-article (id)
4264 "Return the article number of ID."
4265 (let ((thread (gnus-id-to-thread id)))
4268 (mail-header-number (car thread)))))
4270 (defun gnus-id-to-header (id)
4271 "Return the article headers of ID."
4272 (car (gnus-id-to-thread id)))
4274 (defun gnus-article-displayed-root-p (article)
4275 "Say whether ARTICLE is a root(ish) article."
4276 (let ((level (gnus-summary-thread-level article))
4277 (refs (mail-header-references (gnus-summary-article-header article)))
4283 ((null (gnus-parent-id refs)) t)
4285 (null (setq particle (gnus-id-to-article
4286 (gnus-parent-id refs))))
4287 (null (gnus-summary-thread-level particle)))))))
4289 (defun gnus-root-id (id)
4290 "Return the id of the root of the thread where ID appears."
4292 (while (and id (setq prev (car (gnus-id-to-thread id))))
4294 id (gnus-parent-id (mail-header-references prev))))
4297 (defun gnus-articles-in-thread (thread)
4298 "Return the list of articles in THREAD."
4299 (cons (mail-header-number (car thread))
4300 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4302 (defun gnus-remove-thread (id &optional dont-remove)
4303 "Remove the thread that has ID in it."
4304 (let (headers thread last-id)
4305 ;; First go up in this thread until we find the root.
4306 (setq last-id (gnus-root-id id)
4307 headers (message-flatten-list (gnus-id-to-thread last-id)))
4308 ;; We have now found the real root of this thread. It might have
4309 ;; been gathered into some loose thread, so we have to search
4310 ;; through the threads to find the thread we wanted.
4311 (let ((threads gnus-newsgroup-threads)
4314 (setq sub (car threads))
4315 (if (stringp (car sub))
4316 ;; This is a gathered thread, so we look at the roots
4317 ;; below it to find whether this article is in this
4320 (setq sub (cdr sub))
4322 (when (member (caar sub) headers)
4323 (setq thread (car threads)
4326 (setq sub (cdr sub))))
4327 ;; It's an ordinary thread, so we check it.
4328 (when (eq (car sub) (car headers))
4331 (setq threads (cdr threads)))
4332 ;; If this article is in no thread, then it's a root.
4335 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4336 (setq thread (gnus-id-to-thread last-id)))
4339 thread ; We return this thread.
4341 (if (stringp (car thread))
4343 ;; If we use dummy roots, then we have to remove the
4344 ;; dummy root as well.
4345 (when (eq gnus-summary-make-false-root 'dummy)
4346 ;; We go to the dummy root by going to
4347 ;; the first sub-"thread", and then one line up.
4348 (gnus-summary-goto-article
4349 (mail-header-number (caadr thread)))
4352 (gnus-data-compute-positions))
4353 (setq thread (cdr thread))
4355 (gnus-remove-thread-1 (car thread))
4356 (setq thread (cdr thread))))
4357 (gnus-remove-thread-1 thread))))))))
4359 (defun gnus-remove-thread-1 (thread)
4360 "Remove the thread THREAD recursively."
4361 (let ((number (mail-header-number (pop thread)))
4363 (setq thread (reverse thread))
4365 (gnus-remove-thread-1 (pop thread)))
4366 (when (setq d (gnus-data-find number))
4367 (goto-char (gnus-data-pos d))
4368 (gnus-summary-show-thread)
4374 (gnus-delete-line)))))))
4376 (defun gnus-sort-threads-1 (threads func)
4377 (sort (mapcar (lambda (thread)
4380 (gnus-sort-threads-1 (cdr thread) func))))
4383 (defun gnus-sort-threads (threads)
4385 (if (not gnus-thread-sort-functions)
4387 (gnus-message 8 "Sorting threads...")
4388 (let ((max-lisp-eval-depth 5000))
4389 (prog1 (gnus-sort-threads-1
4391 (gnus-make-sort-function gnus-thread-sort-functions))
4392 (gnus-message 8 "Sorting threads...done")))))
4394 (defun gnus-sort-articles (articles)
4396 (when gnus-article-sort-functions
4397 (gnus-message 7 "Sorting articles...")
4399 (setq gnus-newsgroup-headers
4400 (sort articles (gnus-make-sort-function
4401 gnus-article-sort-functions)))
4402 (gnus-message 7 "Sorting articles...done"))))
4404 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4405 (defmacro gnus-thread-header (thread)
4406 "Return header of first article in THREAD.
4407 Note that THREAD must never, ever be anything else than a variable -
4408 using some other form will lead to serious barfage."
4409 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4410 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4411 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4414 (defsubst gnus-article-sort-by-number (h1 h2)
4415 "Sort articles by article number."
4416 (< (mail-header-number h1)
4417 (mail-header-number h2)))
4419 (defun gnus-thread-sort-by-number (h1 h2)
4420 "Sort threads by root article number."
4421 (gnus-article-sort-by-number
4422 (gnus-thread-header h1) (gnus-thread-header h2)))
4424 (defsubst gnus-article-sort-by-random (h1 h2)
4425 "Sort articles by article number."
4428 (defun gnus-thread-sort-by-random (h1 h2)
4429 "Sort threads by root article number."
4430 (gnus-article-sort-by-random
4431 (gnus-thread-header h1) (gnus-thread-header h2)))
4433 (defsubst gnus-article-sort-by-lines (h1 h2)
4434 "Sort articles by article Lines header."
4435 (< (mail-header-lines h1)
4436 (mail-header-lines h2)))
4438 (defun gnus-thread-sort-by-lines (h1 h2)
4439 "Sort threads by root article Lines header."
4440 (gnus-article-sort-by-lines
4441 (gnus-thread-header h1) (gnus-thread-header h2)))
4443 (defsubst gnus-article-sort-by-chars (h1 h2)
4444 "Sort articles by octet length."
4445 (< (mail-header-chars h1)
4446 (mail-header-chars h2)))
4448 (defun gnus-thread-sort-by-chars (h1 h2)
4449 "Sort threads by root article octet length."
4450 (gnus-article-sort-by-chars
4451 (gnus-thread-header h1) (gnus-thread-header h2)))
4453 (defsubst gnus-article-sort-by-author (h1 h2)
4454 "Sort articles by root author."
4456 (let ((extract (funcall
4457 gnus-extract-address-components
4458 (mail-header-from h1))))
4459 (or (car extract) (cadr extract) ""))
4460 (let ((extract (funcall
4461 gnus-extract-address-components
4462 (mail-header-from h2))))
4463 (or (car extract) (cadr extract) ""))))
4465 (defun gnus-thread-sort-by-author (h1 h2)
4466 "Sort threads by root author."
4467 (gnus-article-sort-by-author
4468 (gnus-thread-header h1) (gnus-thread-header h2)))
4470 (defsubst gnus-article-sort-by-subject (h1 h2)
4471 "Sort articles by root subject."
4473 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4474 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4476 (defun gnus-thread-sort-by-subject (h1 h2)
4477 "Sort threads by root subject."
4478 (gnus-article-sort-by-subject
4479 (gnus-thread-header h1) (gnus-thread-header h2)))
4481 (defsubst gnus-article-sort-by-date (h1 h2)
4482 "Sort articles by root article date."
4484 (gnus-date-get-time (mail-header-date h1))
4485 (gnus-date-get-time (mail-header-date h2))))
4487 (defun gnus-thread-sort-by-date (h1 h2)
4488 "Sort threads by root article date."
4489 (gnus-article-sort-by-date
4490 (gnus-thread-header h1) (gnus-thread-header h2)))
4492 (defsubst gnus-article-sort-by-score (h1 h2)
4493 "Sort articles by root article score.
4494 Unscored articles will be counted as having a score of zero."
4495 (> (or (cdr (assq (mail-header-number h1)
4496 gnus-newsgroup-scored))
4497 gnus-summary-default-score 0)
4498 (or (cdr (assq (mail-header-number h2)
4499 gnus-newsgroup-scored))
4500 gnus-summary-default-score 0)))
4502 (defun gnus-thread-sort-by-score (h1 h2)
4503 "Sort threads by root article score."
4504 (gnus-article-sort-by-score
4505 (gnus-thread-header h1) (gnus-thread-header h2)))
4507 (defun gnus-thread-sort-by-total-score (h1 h2)
4508 "Sort threads by the sum of all scores in the thread.
4509 Unscored articles will be counted as having a score of zero."
4510 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4512 (defun gnus-thread-total-score (thread)
4513 ;; This function find the total score of THREAD.
4518 (if (stringp (car thread))
4519 (apply gnus-thread-score-function 0
4520 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4521 (gnus-thread-total-score-1 thread)))
4523 (gnus-thread-total-score-1 (list thread)))))
4525 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4526 "Sort threads such that the thread with the most recently arrived article comes first."
4527 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4529 (defun gnus-thread-highest-number (thread)
4530 "Return the highest article number in THREAD."
4531 (apply 'max (mapcar (lambda (header)
4532 (mail-header-number header))
4533 (message-flatten-list thread))))
4535 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4536 "Sort threads such that the thread with the most recently dated article comes first."
4537 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4539 (defun gnus-thread-latest-date (thread)
4540 "Return the highest article date in THREAD."
4541 (let ((previous-time 0))
4547 (time-to-seconds (mail-header-parse-date
4548 (mail-header-date header)))
4549 (error previous-time))))
4551 (message-flatten-list thread)
4553 (< (mail-header-number h1)
4554 (mail-header-number h2))))))))
4556 (defun gnus-thread-total-score-1 (root)
4557 ;; This function find the total score of the thread below ROOT.
4558 (setq root (car root))
4559 (apply gnus-thread-score-function
4561 (mapcar 'gnus-thread-total-score
4562 (cdr (gnus-id-to-thread (mail-header-id root))))
4563 (when (> (mail-header-number root) 0)
4564 (list (or (cdr (assq (mail-header-number root)
4565 gnus-newsgroup-scored))
4566 gnus-summary-default-score 0))))
4567 (list gnus-summary-default-score)
4570 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4571 (defvar gnus-tmp-prev-subject nil)
4572 (defvar gnus-tmp-false-parent nil)
4573 (defvar gnus-tmp-root-expunged nil)
4574 (defvar gnus-tmp-dummy-line nil)
4576 (eval-when-compile (defvar gnus-tmp-header))
4577 (defun gnus-extra-header (type &optional header)
4578 "Return the extra header of TYPE."
4579 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4582 (defvar gnus-tmp-thread-tree-header-string "")
4584 (defcustom gnus-sum-thread-tree-root "> "
4585 "With %B spec, used for the root of a thread.
4586 If nil, use subject instead."
4587 :type '(radio (const :format "%v " nil) (string :size 0))
4588 :group 'gnus-thread)
4589 (defcustom gnus-sum-thread-tree-false-root "> "
4590 "With %B spec, used for a false root of a thread.
4591 If nil, use subject instead."
4592 :type '(radio (const :format "%v " nil) (string :size 0))
4593 :group 'gnus-thread)
4594 (defcustom gnus-sum-thread-tree-single-indent ""
4595 "With %B spec, used for a thread with just one message.
4596 If nil, use subject instead."
4597 :type '(radio (const :format "%v " nil) (string :size 0))
4598 :group 'gnus-thread)
4599 (defcustom gnus-sum-thread-tree-vertical "| "
4600 "With %B spec, used for drawing a vertical line."
4602 :group 'gnus-thread)
4603 (defcustom gnus-sum-thread-tree-indent " "
4604 "With %B spec, used for indenting."
4606 :group 'gnus-thread)
4607 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4608 "With %B spec, used for a leaf with brothers."
4610 :group 'gnus-thread)
4611 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4612 "With %B spec, used for a leaf without brothers."
4614 :group 'gnus-thread)
4616 (defun gnus-summary-prepare-threads (threads)
4617 "Prepare summary buffer from THREADS and indentation LEVEL.
4618 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4619 or a straight list of headers."
4620 (gnus-message 7 "Generating summary...")
4622 (setq gnus-newsgroup-threads threads)
4625 (let ((gnus-tmp-level 0)
4626 (default-score (or gnus-summary-default-score 0))
4627 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4628 (building-line-count gnus-summary-display-while-building)
4629 (building-count (integerp gnus-summary-display-while-building))
4630 thread number subject stack state gnus-tmp-gathered beg-match
4631 new-roots gnus-tmp-new-adopts thread-end simp-subject
4632 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4633 gnus-tmp-replied gnus-tmp-subject-or-nil
4634 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4635 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4636 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4639 (setq gnus-tmp-prev-subject nil
4640 gnus-tmp-thread-tree-header-string "")
4642 (if (vectorp (car threads))
4643 ;; If this is a straight (sic) list of headers, then a
4644 ;; threaded summary display isn't required, so we just create
4645 ;; an unthreaded one.
4646 (gnus-summary-prepare-unthreaded threads)
4648 ;; Do the threaded display.
4650 (if gnus-summary-display-while-building
4651 (switch-to-buffer (buffer-name)))
4652 (while (or threads stack gnus-tmp-new-adopts new-roots)
4654 (if (and (= gnus-tmp-level 0)
4657 (not gnus-tmp-false-parent)
4658 (or gnus-tmp-new-adopts new-roots))
4659 (if gnus-tmp-new-adopts
4660 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4661 thread (list (car gnus-tmp-new-adopts))
4662 gnus-tmp-header (caar thread)
4663 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4665 (setq thread (list (car new-roots))
4666 gnus-tmp-header (caar thread)
4667 new-roots (cdr new-roots))))
4670 ;; If there are some threads, we do them before the
4671 ;; threads on the stack.
4672 (setq thread threads
4673 gnus-tmp-header (caar thread))
4674 ;; There were no current threads, so we pop something off
4676 (setq state (car stack)
4677 gnus-tmp-level (car state)
4678 tree-stack (cadr state)
4679 thread (caddr state)
4681 gnus-tmp-header (caar thread))))
4683 (setq gnus-tmp-false-parent nil)
4684 (setq gnus-tmp-root-expunged nil)
4685 (setq thread-end nil)
4687 (if (stringp gnus-tmp-header)
4688 ;; The header is a dummy root.
4690 ((eq gnus-summary-make-false-root 'adopt)
4691 ;; We let the first article adopt the rest.
4692 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4694 (setq gnus-tmp-gathered
4696 (lambda (h) (mail-header-number (car h)))
4699 (setq thread (cons (list (caar thread)
4702 (setq gnus-tmp-level -1
4703 gnus-tmp-false-parent t))
4704 ((eq gnus-summary-make-false-root 'empty)
4705 ;; We print adopted articles with empty subject fields.
4706 (setq gnus-tmp-gathered
4708 (lambda (h) (mail-header-number (car h)))
4711 (setq gnus-tmp-level -1))
4712 ((eq gnus-summary-make-false-root 'dummy)
4713 ;; We remember that we probably want to output a dummy
4715 (setq gnus-tmp-dummy-line gnus-tmp-header)
4716 (setq gnus-tmp-prev-subject gnus-tmp-header))
4718 ;; We do not make a root for the gathered
4719 ;; sub-threads at all.
4720 (setq gnus-tmp-level -1)))
4722 (setq number (mail-header-number gnus-tmp-header)
4723 subject (mail-header-subject gnus-tmp-header)
4724 simp-subject (gnus-simplify-subject-fully subject))
4727 ;; If the thread has changed subject, we might want to make
4728 ;; this subthread into a root.
4729 ((and (null gnus-thread-ignore-subject)
4730 (not (zerop gnus-tmp-level))
4731 gnus-tmp-prev-subject
4732 (not (string= gnus-tmp-prev-subject simp-subject)))
4733 (setq new-roots (nconc new-roots (list (car thread)))
4735 gnus-tmp-header nil))
4736 ;; If the article lies outside the current limit,
4737 ;; then we do not display it.
4738 ((not (memq number gnus-newsgroup-limit))
4739 (setq gnus-tmp-gathered
4741 (lambda (h) (mail-header-number (car h)))
4744 (setq gnus-tmp-new-adopts (if (cdar thread)
4745 (append gnus-tmp-new-adopts
4747 gnus-tmp-new-adopts)
4749 gnus-tmp-header nil)
4750 (when (zerop gnus-tmp-level)
4751 (setq gnus-tmp-root-expunged t)))
4752 ;; Perhaps this article is to be marked as read?
4753 ((and gnus-summary-mark-below
4754 (< (or (cdr (assq number gnus-newsgroup-scored))
4756 gnus-summary-mark-below)
4757 ;; Don't touch sparse articles.
4758 (not (gnus-summary-article-sparse-p number))
4759 (not (gnus-summary-article-ancient-p number)))
4760 (setq gnus-newsgroup-unreads
4761 (delq number gnus-newsgroup-unreads))
4762 (if gnus-newsgroup-auto-expire
4763 (setq gnus-newsgroup-expirable
4764 (gnus-add-to-sorted-list
4765 gnus-newsgroup-expirable number))
4766 (push (cons number gnus-low-score-mark)
4767 gnus-newsgroup-reads))))
4769 (when gnus-tmp-header
4770 ;; We may have an old dummy line to output before this
4772 (when (and gnus-tmp-dummy-line
4775 (mail-header-subject gnus-tmp-header)))
4776 (gnus-summary-insert-dummy-line
4777 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4778 (setq gnus-tmp-dummy-line nil))
4780 ;; Compute the mark.
4781 (setq gnus-tmp-unread (gnus-article-mark number))
4783 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4784 gnus-tmp-header gnus-tmp-level)
4785 gnus-newsgroup-data)
4787 ;; Actually insert the line.
4789 gnus-tmp-subject-or-nil
4791 ((and gnus-thread-ignore-subject
4792 gnus-tmp-prev-subject
4793 (not (string= gnus-tmp-prev-subject simp-subject)))
4795 ((zerop gnus-tmp-level)
4796 (if (and (eq gnus-summary-make-false-root 'empty)
4797 (memq number gnus-tmp-gathered)
4798 gnus-tmp-prev-subject
4799 (string= gnus-tmp-prev-subject simp-subject))
4800 gnus-summary-same-subject
4802 (t gnus-summary-same-subject)))
4803 (if (and (eq gnus-summary-make-false-root 'adopt)
4804 (= gnus-tmp-level 1)
4805 (memq number gnus-tmp-gathered))
4806 (setq gnus-tmp-opening-bracket ?\<
4807 gnus-tmp-closing-bracket ?\>)
4808 (setq gnus-tmp-opening-bracket ?\[
4809 gnus-tmp-closing-bracket ?\]))
4811 gnus-tmp-indentation
4812 (aref gnus-thread-indent-array gnus-tmp-level)
4813 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4814 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4815 gnus-summary-default-score 0)
4817 (if (or (null gnus-summary-default-score)
4818 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4819 gnus-summary-zcore-fuzz))
4821 (if (< gnus-tmp-score gnus-summary-default-score)
4822 gnus-score-below-mark gnus-score-over-mark))
4824 (cond ((memq number gnus-newsgroup-processable)
4826 ((memq number gnus-newsgroup-cached)
4828 ((memq number gnus-newsgroup-replied)
4830 ((memq number gnus-newsgroup-forwarded)
4831 gnus-forwarded-mark)
4832 ((memq number gnus-newsgroup-saved)
4834 ((memq number gnus-newsgroup-recent)
4836 ((memq number gnus-newsgroup-unseen)
4840 (cond ((memq number gnus-newsgroup-undownloaded)
4841 gnus-undownloaded-mark)
4842 (gnus-newsgroup-agentized
4843 gnus-downloaded-mark)
4846 gnus-tmp-from (mail-header-from gnus-tmp-header)
4849 ((string-match "<[^>]+> *$" gnus-tmp-from)
4850 (setq beg-match (match-beginning 0))
4851 (or (and (string-match "^\".+\"" gnus-tmp-from)
4852 (substring gnus-tmp-from 1 (1- (match-end 0))))
4853 (substring gnus-tmp-from 0 beg-match)))
4854 ((string-match "(.+)" gnus-tmp-from)
4855 (substring gnus-tmp-from
4856 (1+ (match-beginning 0)) (1- (match-end 0))))
4860 gnus-tmp-thread-tree-header-string
4862 ((not gnus-show-threads) "")
4863 ((zerop gnus-tmp-level)
4864 (cond ((cdar thread)
4865 (or gnus-sum-thread-tree-root subject))
4866 (gnus-tmp-new-adopts
4867 (or gnus-sum-thread-tree-false-root subject))
4869 (or gnus-sum-thread-tree-single-indent subject))))
4871 (concat (apply 'concat
4872 (mapcar (lambda (item)
4874 gnus-sum-thread-tree-vertical
4875 gnus-sum-thread-tree-indent))
4876 (cdr (reverse tree-stack))))
4878 gnus-sum-thread-tree-leaf-with-other
4879 gnus-sum-thread-tree-single-leaf)))))
4880 (when (string= gnus-tmp-name "")
4881 (setq gnus-tmp-name gnus-tmp-from))
4882 (unless (numberp gnus-tmp-lines)
4883 (setq gnus-tmp-lines -1))
4884 (if (= gnus-tmp-lines -1)
4885 (setq gnus-tmp-lines "?")
4886 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4887 (gnus-put-text-property
4889 (progn (eval gnus-summary-line-format-spec) (point))
4890 'gnus-number number)
4893 (gnus-run-hooks 'gnus-summary-update-hook)
4896 (setq gnus-tmp-prev-subject simp-subject)))
4898 (when (nth 1 thread)
4899 (push (list (max 0 gnus-tmp-level)
4900 (copy-sequence tree-stack)
4903 (push (if (nth 1 thread) 1 0) tree-stack)
4904 (incf gnus-tmp-level)
4905 (setq threads (if thread-end nil (cdar thread)))
4906 (if gnus-summary-display-while-building
4909 ;; use a set frequency
4910 (setq building-line-count (1- building-line-count))
4911 (when (= building-line-count 0)
4913 (setq building-line-count
4914 gnus-summary-display-while-building)))
4918 (setq gnus-tmp-level 0)))))
4919 (gnus-message 7 "Generating summary...done"))
4921 (defun gnus-summary-prepare-unthreaded (headers)
4922 "Generate an unthreaded summary buffer based on HEADERS."
4923 (let (header number mark)
4928 ;; We may have to root out some bad articles...
4929 (when (memq (setq number (mail-header-number
4930 (setq header (pop headers))))
4931 gnus-newsgroup-limit)
4932 ;; Mark article as read when it has a low score.
4933 (when (and gnus-summary-mark-below
4934 (< (or (cdr (assq number gnus-newsgroup-scored))
4935 gnus-summary-default-score 0)
4936 gnus-summary-mark-below)
4937 (not (gnus-summary-article-ancient-p number)))
4938 (setq gnus-newsgroup-unreads
4939 (delq number gnus-newsgroup-unreads))
4940 (if gnus-newsgroup-auto-expire
4941 (push number gnus-newsgroup-expirable)
4942 (push (cons number gnus-low-score-mark)
4943 gnus-newsgroup-reads)))
4945 (setq mark (gnus-article-mark number))
4946 (push (gnus-data-make number mark (1+ (point)) header 0)
4947 gnus-newsgroup-data)
4948 (gnus-summary-insert-line
4950 (memq number gnus-newsgroup-undownloaded)
4951 mark (memq number gnus-newsgroup-replied)
4952 (memq number gnus-newsgroup-expirable)
4953 (mail-header-subject header) nil
4954 (cdr (assq number gnus-newsgroup-scored))
4955 (memq number gnus-newsgroup-processable))))))
4957 (defun gnus-summary-remove-list-identifiers ()
4958 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4959 (let ((regexp (if (consp gnus-list-identifiers)
4960 (mapconcat 'identity gnus-list-identifiers " *\\|")
4961 gnus-list-identifiers))
4964 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
4965 (dolist (header gnus-newsgroup-headers)
4966 (setq subject (mail-header-subject header)
4968 (while (string-match regexp subject)
4970 (concat (substring subject 0 (match-beginning 1))
4971 (substring subject (match-end 0)))
4974 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
4976 (concat (substring subject 0 (match-beginning 1))
4977 (substring subject (match-end 1)))))
4978 (mail-header-set-subject header subject))))))
4980 (defun gnus-fetch-headers (articles)
4981 "Fetch headers of ARTICLES."
4982 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4983 (gnus-message 5 "Fetching headers for %s..." name)
4986 (setq gnus-headers-retrieved-by
4987 (gnus-retrieve-headers
4988 articles gnus-newsgroup-name
4989 ;; We might want to fetch old headers, but
4990 ;; not if there is only 1 article.
4992 (not (eq gnus-fetch-old-headers 'some))
4993 (not (numberp gnus-fetch-old-headers)))
4994 (> (length articles) 1))
4995 gnus-fetch-old-headers))))
4996 (gnus-get-newsgroup-headers-xover
4997 articles nil nil gnus-newsgroup-name t)
4998 (gnus-get-newsgroup-headers))
4999 (gnus-message 5 "Fetching headers for %s...done" name))))
5001 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5002 "Select newsgroup GROUP.
5003 If READ-ALL is non-nil, all articles in the group are selected.
5004 If SELECT-ARTICLES, only select those articles from GROUP."
5005 (let* ((entry (gnus-group-entry group))
5006 ;;!!! Dirty hack; should be removed.
5007 (gnus-summary-ignore-duplicates
5008 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5010 gnus-summary-ignore-duplicates))
5011 (info (nth 2 entry))
5012 articles fetched-articles cached)
5014 (unless (gnus-check-server
5015 (set (make-local-variable 'gnus-current-select-method)
5016 (gnus-find-method-for-group group)))
5017 (error "Couldn't open server"))
5019 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5020 (gnus-activate-group group) ; Or we can activate it...
5021 (progn ; Or we bug out.
5022 (when (equal major-mode 'gnus-summary-mode)
5023 (gnus-kill-buffer (current-buffer)))
5024 (error "Couldn't activate group %s: %s"
5025 group (gnus-status-message group))))
5027 (unless (gnus-request-group group t)
5028 (when (equal major-mode 'gnus-summary-mode)
5029 (gnus-kill-buffer (current-buffer)))
5030 (error "Couldn't request group %s: %s"
5031 group (gnus-status-message group)))
5034 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5036 (setq gnus-summary-use-undownloaded-faces
5037 (gnus-agent-find-parameter
5039 'agent-enable-undownloaded-faces)))
5041 (setq gnus-newsgroup-name group
5042 gnus-newsgroup-unselected nil
5043 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5045 (let ((display (gnus-group-find-parameter group 'display)))
5046 (setq gnus-newsgroup-display
5048 ((not (zerop (or (car-safe read-all) 0)))
5049 ;; The user entered the group with C-u SPC/RET, let's show
5055 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5057 ;; The following is probably the "correct" solution, but
5058 ;; it makes Gnus fetch all headers and then limit the
5059 ;; articles (which is slow), so instead we hack the
5060 ;; select-articles parameter instead. -- Simon Josefsson
5063 ;; (gnus-byte-compile
5064 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5066 (setq select-articles
5067 (gnus-uncompress-range
5068 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5072 (cdr (gnus-active group)))))
5077 (gnus-summary-setup-default-charset)
5079 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5080 (when (gnus-virtual-group-p group)
5081 (setq cached gnus-newsgroup-cached))
5083 (setq gnus-newsgroup-unreads
5084 (gnus-sorted-ndifference
5085 (gnus-sorted-ndifference gnus-newsgroup-unreads
5086 gnus-newsgroup-marked)
5087 gnus-newsgroup-dormant))
5089 (setq gnus-newsgroup-processable nil)
5091 (gnus-update-read-articles group gnus-newsgroup-unreads)
5093 ;; Adjust and set lists of article marks.
5095 (gnus-adjust-marked-articles info))
5096 (if (setq articles select-articles)
5097 (setq gnus-newsgroup-unselected
5098 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5099 (setq articles (gnus-articles-to-read group read-all)))
5103 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5105 ((eq articles 0) nil)
5107 ;; Init the dependencies hash table.
5108 (setq gnus-newsgroup-dependencies
5109 (gnus-make-hashtable (length articles)))
5110 (gnus-set-global-variables)
5111 ;; Retrieve the headers and read them in.
5113 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5115 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5117 (setq gnus-newsgroup-cached cached))
5119 ;; Suppress duplicates?
5120 (when gnus-suppress-duplicates
5121 (gnus-dup-suppress-articles))
5123 ;; Set the initial limit.
5124 (setq gnus-newsgroup-limit (copy-sequence articles))
5125 ;; Remove canceled articles from the list of unread articles.
5126 (setq fetched-articles
5127 (mapcar (lambda (headers) (mail-header-number headers))
5128 gnus-newsgroup-headers))
5129 (setq gnus-newsgroup-articles fetched-articles)
5130 (setq gnus-newsgroup-unreads
5131 (gnus-sorted-nintersection
5132 gnus-newsgroup-unreads fetched-articles))
5133 (gnus-compute-unseen-list)
5135 ;; Removed marked articles that do not exist.
5136 (gnus-update-missing-marks
5137 (gnus-sorted-difference articles fetched-articles))
5138 ;; We might want to build some more threads first.
5139 (when (and gnus-fetch-old-headers
5140 (eq gnus-headers-retrieved-by 'nov))
5141 (if (eq gnus-fetch-old-headers 'invisible)
5142 (gnus-build-all-threads)
5143 (gnus-build-old-threads)))
5144 ;; Let the Gnus agent mark articles as read.
5146 (gnus-agent-get-undownloaded-list))
5147 ;; Remove list identifiers from subject
5148 (when gnus-list-identifiers
5149 (gnus-summary-remove-list-identifiers))
5150 ;; Check whether auto-expire is to be done in this group.
5151 (setq gnus-newsgroup-auto-expire
5152 (gnus-group-auto-expirable-p group))
5153 ;; Set up the article buffer now, if necessary.
5154 (unless gnus-single-article-buffer
5155 (gnus-article-setup-buffer))
5156 ;; First and last article in this newsgroup.
5157 (when gnus-newsgroup-headers
5158 (setq gnus-newsgroup-begin
5159 (mail-header-number (car gnus-newsgroup-headers))
5162 (gnus-last-element gnus-newsgroup-headers))))
5163 ;; GROUP is successfully selected.
5164 (or gnus-newsgroup-headers t)))))
5166 (defun gnus-compute-unseen-list ()
5167 ;; The `seen' marks are treated specially.
5168 (if (not gnus-newsgroup-seen)
5169 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5170 (setq gnus-newsgroup-unseen
5171 (gnus-inverse-list-range-intersection
5172 gnus-newsgroup-articles gnus-newsgroup-seen))))
5174 (defun gnus-summary-display-make-predicate (display)
5175 (require 'gnus-agent)
5176 (when (= (length display) 1)
5177 (setq display (car display)))
5178 (unless gnus-summary-display-cache
5179 (dolist (elem (append '((unread . unread)
5182 gnus-article-mark-lists))
5183 (push (cons (cdr elem)
5185 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5186 gnus-summary-display-cache)))
5187 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5188 (gnus-category-predicate-cache gnus-summary-display-cache))
5189 (gnus-get-predicate display)))
5191 ;; Uses the dynamically bound `number' variable.
5194 (defun gnus-article-marked-p (type &optional article)
5195 (let ((article (or article number)))
5198 (memq article gnus-newsgroup-marked))
5200 (memq article gnus-newsgroup-spam-marked))
5202 (memq article gnus-newsgroup-unsendable))
5203 ((eq type 'undownload)
5204 (memq article gnus-newsgroup-undownloaded))
5205 ((eq type 'download)
5206 (memq article gnus-newsgroup-downloadable))
5208 (memq article gnus-newsgroup-unreads))
5210 (memq article gnus-newsgroup-reads))
5212 (memq article gnus-newsgroup-dormant) )
5214 (memq article gnus-newsgroup-expirable))
5216 (memq article gnus-newsgroup-replied))
5218 (memq article gnus-newsgroup-killed))
5219 ((eq type 'bookmark)
5220 (assq article gnus-newsgroup-bookmarks))
5222 (assq article gnus-newsgroup-scored))
5224 (memq article gnus-newsgroup-saved))
5226 (memq article gnus-newsgroup-cached))
5228 (memq article gnus-newsgroup-forwarded))
5230 (not (memq article gnus-newsgroup-unseen)))
5232 (memq article gnus-newsgroup-recent))
5235 (defun gnus-articles-to-read (group &optional read-all)
5236 "Find out what articles the user wants to read."
5237 (let* ((display (gnus-group-find-parameter group 'display))
5239 ;; Select all articles if `read-all' is non-nil, or if there
5240 ;; are no unread articles.
5242 (and (zerop (length gnus-newsgroup-marked))
5243 (zerop (length gnus-newsgroup-unreads)))
5244 ;; Fetch all if the predicate is non-nil.
5245 gnus-newsgroup-display)
5246 ;; We want to select the headers for all the articles in
5247 ;; the group, so we select either all the active
5248 ;; articles in the group, or (if that's nil), the
5249 ;; articles in the cache.
5251 (gnus-uncompress-range (gnus-active group))
5252 (gnus-cache-articles-in-group group))
5253 ;; Select only the "normal" subset of articles.
5255 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5256 gnus-newsgroup-unreads)))
5257 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5258 (scored (length scored-list))
5259 (number (length articles))
5260 (marked (+ (length gnus-newsgroup-marked)
5261 (length gnus-newsgroup-dormant)))
5266 ((numberp gnus-newsgroup-display)
5267 gnus-newsgroup-display)
5271 ((and (or (<= scored marked) (= scored number))
5272 (numberp gnus-large-newsgroup)
5273 (> number gnus-large-newsgroup))
5274 (let* ((cursor-in-echo-area nil)
5275 (initial (gnus-parameter-large-newsgroup-initial
5276 gnus-newsgroup-name))
5280 "How many articles from %s (%s %d): "
5282 (gnus-group-decoded-name gnus-newsgroup-name)
5284 (if initial "max" "default")
5287 (cons (number-to-string initial)
5289 (if (string-match "^[ \t]*$" input) number input)))
5290 ((and (> scored marked) (< scored number)
5291 (> (- scored number) 20))
5294 (format "%s %s (%d scored, %d total): "
5295 "How many articles from"
5296 (gnus-group-decoded-name group)
5298 (if (string-match "^[ \t]*$" input)
5302 (message "Quit getting the articles to read")
5304 (setq select (if (stringp select) (string-to-number select) select))
5305 (if (or (null select) (zerop select))
5307 (if (and (not (zerop scored)) (<= (abs select) scored))
5309 (setq articles (sort scored-list '<))
5310 (setq number (length articles)))
5311 (setq articles (copy-sequence articles)))
5313 (when (< (abs select) number)
5315 ;; Select the N oldest articles.
5316 (setcdr (nthcdr (1- (abs select)) articles) nil)
5317 ;; Select the N most recent articles.
5318 (setq articles (nthcdr (- number select) articles))))
5319 (setq gnus-newsgroup-unselected
5320 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5321 (when gnus-alter-articles-to-read-function
5324 (funcall gnus-alter-articles-to-read-function
5325 gnus-newsgroup-name articles)
5329 (defun gnus-killed-articles (killed articles)
5332 (when (inline (gnus-member-of-range (car articles) killed))
5333 (push (car articles) out))
5334 (setq articles (cdr articles)))
5337 (defun gnus-uncompress-marks (marks)
5338 "Uncompress the mark ranges in MARKS."
5339 (let ((uncompressed '(score bookmark))
5342 (if (memq (caar marks) uncompressed)
5343 (push (car marks) out)
5344 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5345 (setq marks (cdr marks)))
5348 (defun gnus-article-mark-to-type (mark)
5349 "Return the type of MARK."
5350 (or (cadr (assq mark gnus-article-special-mark-lists))
5353 (defun gnus-article-unpropagatable-p (mark)
5354 "Return whether MARK should be propagated to back end."
5355 (memq mark gnus-article-unpropagated-mark-lists))
5357 (defun gnus-adjust-marked-articles (info)
5358 "Set all article lists and remove all marks that are no longer valid."
5359 (let* ((marked-lists (gnus-info-marks info))
5360 (active (gnus-active (gnus-info-group info)))
5363 (types gnus-article-mark-lists)
5364 marks var articles article mark mark-type
5367 (dolist (marks marked-lists)
5368 (setq mark (car marks)
5369 mark-type (gnus-article-mark-to-type mark)
5370 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5372 ;; We set the variable according to the type of the marks list,
5373 ;; and then adjust the marks to a subset of the active articles.
5375 ;; Adjust "simple" lists - compressed yet unsorted
5376 ((eq mark-type 'list)
5377 ;; Simultaneously uncompress and clip to active range
5378 ;; See gnus-uncompress-range for a description of possible marks
5380 (if (not (cadr marks))
5382 (setq articles (if (numberp (cddr marks))
5388 (while (setq article (pop articles))
5389 (cond ((consp article)
5390 (setq bgn (max (car article) min)
5391 end (min (cdr article) max))
5393 (setq l (setcdr l (cons bgn nil))
5395 ((and (<= min article)
5397 (setq l (setcdr l (cons article nil))))))
5398 (set var (cdr lh)))))
5400 ((eq mark-type 'tuple)
5401 (set var (setq articles (cdr marks)))
5402 (when (not (listp (cdr (symbol-value var))))
5403 (set var (list (symbol-value var))))
5404 (when (not (listp (cdr articles)))
5405 (setq articles (list articles)))
5407 (when (or (not (consp (setq article (pop articles))))
5408 (< (car article) min)
5409 (> (car article) max))
5410 (set var (delq article (symbol-value var))))))
5411 ;; Adjust ranges (sloppily).
5412 ((eq mark-type 'range)
5415 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5416 ;; It should be (seen (NUM1 . NUM2)).
5417 (when (numberp (cddr marks))
5418 (setcdr marks (list (cdr marks))))
5419 (setq articles (cdr marks))
5420 (while (and articles
5421 (or (and (consp (car articles))
5422 (> min (cdar articles)))
5423 (and (numberp (car articles))
5424 (> min (car articles)))))
5426 (set var articles))))))))
5428 (defun gnus-update-missing-marks (missing)
5429 "Go through the list of MISSING articles and remove them from the mark lists."
5432 ;; Go through all types.
5433 (dolist (elem gnus-article-mark-lists)
5434 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5435 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5436 (when (symbol-value var)
5437 ;; This list has articles. So we delete all missing
5438 ;; articles from it.
5441 (set var (delq (pop m) (symbol-value var))))))))))
5443 (defun gnus-update-marks ()
5444 "Enter the various lists of marked articles into the newsgroup info list."
5445 (let ((types gnus-article-mark-lists)
5446 (info (gnus-get-info gnus-newsgroup-name))
5447 type list newmarked symbol delta-marks)
5449 ;; Add all marks lists to the list of marks lists.
5450 (while (setq type (pop types))
5451 (setq list (symbol-value
5453 (intern (format "gnus-newsgroup-%s" (car type))))))
5456 ;; Get rid of the entries of the articles that have the
5458 (when (and (eq (cdr type) 'score)
5462 (prev (cons nil list))
5465 (if (or (not (consp (car arts)))
5466 (= (cdar arts) gnus-summary-default-score))
5467 (setcdr prev (cdr arts))
5469 (setq arts (cdr arts)))
5470 (setq list (cdr all)))))
5472 (when (eq (cdr type) 'seen)
5473 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5475 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5476 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5478 (when (and (gnus-check-backend-function
5479 'request-set-mark gnus-newsgroup-name)
5480 (not (gnus-article-unpropagatable-p (cdr type))))
5481 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5482 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5483 (add (gnus-remove-from-range
5484 (gnus-copy-sequence list) old)))
5486 (push (list add 'add (list (cdr type))) delta-marks))
5488 (push (list del 'del (list (cdr type))) delta-marks))))
5491 (push (cons (cdr type) list) newmarked)))
5494 (unless (gnus-check-group gnus-newsgroup-name)
5495 (error "Can't open server for %s" gnus-newsgroup-name))
5496 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5498 ;; Enter these new marks into the info of the group.
5500 (setcar (nthcdr 3 info) newmarked)
5501 ;; Add the marks lists to the end of the info.
5503 (setcdr (nthcdr 2 info) (list newmarked))))
5505 ;; Cut off the end of the info if there's nothing else there.
5509 (when (nthcdr (decf i) info)
5510 (setcdr (nthcdr i info) nil)))))))
5512 (defun gnus-set-mode-line (where)
5513 "Set the mode line of the article or summary buffers.
5514 If WHERE is `summary', the summary mode line format will be used."
5515 ;; Is this mode line one we keep updated?
5516 (when (and (memq where gnus-updated-mode-lines)
5518 (intern (format "gnus-%s-mode-line-format-spec" where))))
5521 ;; We evaluate this in the summary buffer since these
5522 ;; variables are buffer-local to that buffer.
5523 (set-buffer gnus-summary-buffer)
5524 ;; We bind all these variables that are used in the `eval' form
5526 (let* ((mformat (symbol-value
5528 (format "gnus-%s-mode-line-format-spec" where))))
5529 (gnus-tmp-group-name (gnus-group-decoded-name
5530 gnus-newsgroup-name))
5531 (gnus-tmp-article-number (or gnus-current-article 0))
5532 (gnus-tmp-unread gnus-newsgroup-unreads)
5533 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5534 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5535 (gnus-tmp-unread-and-unselected
5536 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5537 (zerop gnus-tmp-unselected))
5539 ((zerop gnus-tmp-unselected)
5540 (format "{%d more}" gnus-tmp-unread-and-unticked))
5541 (t (format "{%d(+%d) more}"
5542 gnus-tmp-unread-and-unticked
5543 gnus-tmp-unselected))))
5545 (if (and gnus-current-headers
5546 (vectorp gnus-current-headers))
5547 (gnus-mode-string-quote
5548 (mail-header-subject gnus-current-headers))
5550 bufname-length max-len
5551 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5552 (setq mode-string (eval mformat))
5553 (setq bufname-length (if (string-match "%b" mode-string)
5556 (if (eq where 'summary)
5558 (get-buffer gnus-article-buffer))))
5561 (setq max-len (max 4 (if gnus-mode-non-string-length
5563 gnus-mode-non-string-length
5565 (length mode-string))))
5566 ;; We might have to chop a bit of the string off...
5567 (when (> (length mode-string) max-len)
5569 (concat (truncate-string-to-width mode-string (- max-len 3))
5571 ;; Pad the mode string a bit.
5572 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5573 ;; Update the mode line.
5574 (setq mode-line-buffer-identification
5575 (gnus-mode-line-buffer-identification (list mode-string)))
5576 (set-buffer-modified-p t))))
5578 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5579 "Go through the HEADERS list and add all Xrefs to a hash table.
5580 The resulting hash table is returned, or nil if no Xrefs were found."
5581 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5582 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5583 (xref-hashtb (gnus-make-hashtable))
5584 start group entry number xrefs header)
5586 (setq header (pop headers))
5587 (when (and (setq xrefs (mail-header-xref header))
5588 (not (memq (setq number (mail-header-number header))
5591 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5592 (setq start (match-end 0))
5593 (setq group (if prefix
5594 (concat prefix (substring xrefs (match-beginning 1)
5596 (substring xrefs (match-beginning 1) (match-end 1))))
5598 (string-to-int (substring xrefs (match-beginning 2)
5600 (if (setq entry (gnus-gethash group xref-hashtb))
5601 (setcdr entry (cons number (cdr entry)))
5602 (gnus-sethash group (cons number nil) xref-hashtb)))))
5603 (and start xref-hashtb)))
5605 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5606 "Look through all the headers and mark the Xrefs as read."
5607 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5608 name info xref-hashtb idlist method nth4)
5610 (set-buffer gnus-group-buffer)
5611 (when (setq xref-hashtb
5612 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5615 (unless (string= from-newsgroup (setq name (symbol-name group)))
5616 (setq idlist (symbol-value group))
5617 ;; Dead groups are not updated.
5619 (setq info (gnus-get-info name))
5620 (when (stringp (setq nth4 (gnus-info-method info)))
5621 (setq nth4 (gnus-server-to-method nth4))))
5622 ;; Only do the xrefs if the group has the same
5623 ;; select method as the group we have just read.
5624 (or (gnus-methods-equal-p
5625 nth4 (gnus-find-method-for-group from-newsgroup))
5627 (equal nth4 (setq method (gnus-find-method-for-group
5629 (and (equal (car nth4) (car method))
5630 (equal (nth 1 nth4) (nth 1 method))))
5631 gnus-use-cross-reference
5632 (or (not (eq gnus-use-cross-reference t))
5634 ;; Only do cross-references on subscribed
5635 ;; groups, if that is what is wanted.
5636 (<= (gnus-info-level info) gnus-level-subscribed))
5637 (gnus-group-make-articles-read name idlist))))
5640 (defun gnus-compute-read-articles (group articles)
5641 (let* ((entry (gnus-group-entry group))
5642 (info (nth 2 entry))
5643 (active (gnus-active group))
5646 ;; First peel off all invalid article numbers.
5648 (let ((ids articles)
5650 (while (setq id (pop ids))
5651 (when (and first (> id (cdr active)))
5652 ;; We'll end up in this situation in one particular
5653 ;; obscure situation. If you re-scan a group and get
5654 ;; a new article that is cross-posted to a different
5655 ;; group that has not been re-scanned, you might get
5656 ;; crossposted article that has a higher number than
5657 ;; Gnus believes possible. So we re-activate this
5658 ;; group as well. This might mean doing the
5659 ;; crossposting thingy will *increase* the number
5660 ;; of articles in some groups. Tsk, tsk.
5661 (setq active (or (gnus-activate-group group) active)))
5662 (when (or (> id (cdr active))
5663 (< id (car active)))
5664 (setq articles (delq id articles))))))
5665 ;; If the read list is nil, we init it.
5667 (null (gnus-info-read info))
5669 (setq ninfo (cons 1 (1- (car active))))
5670 (setq ninfo (gnus-info-read info)))
5671 ;; Then we add the read articles to the range.
5673 ninfo (setq articles (sort articles '<))))))
5675 (defun gnus-group-make-articles-read (group articles)
5676 "Update the info of GROUP to say that ARTICLES are read."
5678 (entry (gnus-group-entry group))
5679 (info (nth 2 entry))
5680 (active (gnus-active group))
5683 (setq range (gnus-compute-read-articles group articles))
5684 (with-current-buffer gnus-group-buffer
5687 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5688 (gnus-info-set-read ',info ',(gnus-info-read info))
5689 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5690 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5691 (gnus-group-update-group ,group t))))
5692 ;; Add the read articles to the range.
5693 (gnus-info-set-read info range)
5694 (gnus-request-set-mark group (list (list range 'add '(read))))
5695 ;; Then we have to re-compute how many unread
5696 ;; articles there are in this group.
5700 (setq num (- (1+ (cdr active)) (car active))))
5701 ((not (listp (cdr range)))
5702 (setq num (- (cdr active) (- (1+ (cdr range))
5706 (if (numberp (car range))
5708 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5709 (setq range (cdr range)))
5710 (setq num (- (cdr active) num))))
5711 ;; Update the number of unread articles.
5713 ;; Update the group buffer.
5714 (unless (gnus-ephemeral-group-p group)
5715 (gnus-group-update-group group t))))))
5717 (defvar gnus-newsgroup-none-id 0)
5719 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5720 (let ((cur nntp-server-buffer)
5723 (save-excursion (set-buffer gnus-summary-buffer)
5724 gnus-newsgroup-dependencies)))
5726 (mail-parse-charset gnus-newsgroup-charset)
5727 (mail-parse-ignored-charsets
5728 (save-excursion (condition-case nil
5729 (set-buffer gnus-summary-buffer)
5731 gnus-newsgroup-ignored-charsets)))
5733 (set-buffer nntp-server-buffer)
5734 ;; Translate all TAB characters into SPACE characters.
5735 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5736 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5737 (ietf-drums-unfold-fws)
5738 (gnus-run-hooks 'gnus-parse-headers-hook)
5739 (let ((case-fold-search t)
5740 in-reply-to header p lines chars)
5741 (goto-char (point-min))
5742 ;; Search to the beginning of the next header. Error messages
5743 ;; do not begin with 2 or 3.
5744 (while (re-search-forward "^[23][0-9]+ " nil t)
5747 ;; This implementation of this function, with nine
5748 ;; search-forwards instead of the one re-search-forward and
5749 ;; a case (which basically was the old function) is actually
5750 ;; about twice as fast, even though it looks messier. You
5751 ;; can't have everything, I guess. Speed and elegance
5752 ;; doesn't always go hand in hand.
5761 (narrow-to-region (point)
5762 (or (and (search-forward "\n.\n" nil t)
5768 (if (search-forward "\nsubject:" nil t)
5769 (funcall gnus-decode-encoded-word-function
5770 (nnheader-header-value))
5775 (if (search-forward "\nfrom:" nil t)
5776 (funcall gnus-decode-encoded-word-function
5777 (nnheader-header-value))
5782 (if (search-forward "\ndate:" nil t)
5783 (nnheader-header-value) ""))
5787 (setq id (if (re-search-forward
5788 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5789 ;; We do it this way to make sure the Message-ID
5790 ;; is (somewhat) syntactically valid.
5791 (buffer-substring (match-beginning 1)
5793 ;; If there was no message-id, we just fake one
5794 ;; to make subsequent routines simpler.
5795 (nnheader-generate-fake-message-id))))
5799 (if (search-forward "\nreferences:" nil t)
5803 (nnheader-header-value)
5808 (search-backward ">" end t)
5811 (search-backward "<" end t)
5813 ;; Get the references from the in-reply-to header if there
5814 ;; were no references and the in-reply-to header looks
5816 (if (and (search-forward "\nin-reply-to:" nil t)
5817 (setq in-reply-to (nnheader-header-value))
5818 (string-match "<[^>]+>" in-reply-to))
5820 (setq ref (substring in-reply-to (match-beginning 0)
5822 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5823 (setq ref2 (substring in-reply-to (match-beginning 0)
5825 (when (> (length ref2) (length ref))
5832 (if (search-forward "\nchars: " nil t)
5833 (if (numberp (setq chars (ignore-errors (read cur))))
5839 (if (search-forward "\nlines: " nil t)
5840 (if (numberp (setq lines (ignore-errors (read cur))))
5846 (and (search-forward "\nxref:" nil t)
5847 (nnheader-header-value)))
5849 (when gnus-extra-headers
5850 (let ((extra gnus-extra-headers)
5854 (when (search-forward
5855 (concat "\n" (symbol-name (car extra)) ":") nil t)
5856 (push (cons (car extra) (nnheader-header-value))
5860 (when (equal id ref)
5863 (when gnus-alter-header-function
5864 (funcall gnus-alter-header-function header)
5865 (setq id (mail-header-id header)
5866 ref (gnus-parent-id (mail-header-references header))))
5869 (gnus-dependencies-add-header
5870 header dependencies force-new))
5871 (push header headers))
5872 (goto-char (point-max))
5874 (nreverse headers)))))
5876 ;; Goes through the xover lines and returns a list of vectors
5877 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5878 force-new dependencies
5879 group also-fetch-heads)
5880 "Parse the news overview data in the server buffer.
5881 Return a list of headers that match SEQUENCE (see
5882 `nntp-retrieve-headers')."
5883 ;; Get the Xref when the users reads the articles since most/some
5884 ;; NNTP servers do not include Xrefs when using XOVER.
5885 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5886 (let ((mail-parse-charset gnus-newsgroup-charset)
5887 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5888 (cur nntp-server-buffer)
5889 (dependencies (or dependencies gnus-newsgroup-dependencies))
5891 ((eq gnus-read-all-available-headers t)
5893 ((stringp gnus-read-all-available-headers)
5894 (string-match gnus-read-all-available-headers group))
5897 number headers header)
5899 (set-buffer nntp-server-buffer)
5900 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5901 ;; Allow the user to mangle the headers before parsing them.
5902 (gnus-run-hooks 'gnus-parse-headers-hook)
5903 (goto-char (point-min))
5904 (gnus-parse-without-error
5905 (while (and (or sequence allp)
5907 (setq number (read cur))
5909 (while (and sequence
5910 (< (car sequence) number))
5911 (setq sequence (cdr sequence))))
5914 (eq number (car sequence))))
5916 (setq sequence (cdr sequence))
5917 (setq header (inline
5918 (gnus-nov-parse-line
5919 number dependencies force-new)))))
5920 (push header headers))
5922 ;; A common bug in inn is that if you have posted an article and
5923 ;; then retrieves the active file, it will answer correctly --
5924 ;; the new article is included. However, a NOV entry for the
5925 ;; article may not have been generated yet, so this may fail.
5926 ;; We work around this problem by retrieving the last few
5927 ;; headers using HEAD.
5928 (if (or (not also-fetch-heads)
5930 ;; We (probably) got all the headers.
5932 (let ((gnus-nov-is-evil t))
5935 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5936 (gnus-get-newsgroup-headers))))))))
5938 (defun gnus-article-get-xrefs ()
5939 "Fill in the Xref value in `gnus-current-headers', if necessary.
5940 This is meant to be called in `gnus-article-internal-prepare-hook'."
5941 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5942 gnus-current-headers)))
5943 (or (not gnus-use-cross-reference)
5945 (and (mail-header-xref headers)
5946 (not (string= (mail-header-xref headers) "")))
5947 (let ((case-fold-search t)
5950 (nnheader-narrow-to-headers)
5951 (goto-char (point-min))
5952 (when (or (and (not (eobp))
5953 (eq (downcase (char-after)) ?x)
5954 (looking-at "Xref:"))
5955 (search-forward "\nXref:" nil t))
5956 (goto-char (1+ (match-end 0)))
5957 (setq xref (buffer-substring (point) (point-at-eol)))
5958 (mail-header-set-xref headers xref)))))))
5960 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5961 "Find article ID and insert the summary line for that article.
5962 OLD-HEADER can either be a header or a line number to insert
5963 the subject line on."
5964 (let* ((line (and (numberp old-header) old-header))
5965 (old-header (and (vectorp old-header) old-header))
5966 (header (cond ((and old-header use-old-header)
5969 (gnus-number-to-header id))
5970 (gnus-number-to-header id))
5972 (gnus-read-header id))))
5973 (number (and (numberp id) id))
5976 ;; Rebuild the thread that this article is part of and go to the
5977 ;; article we have fetched.
5978 (when (and (not gnus-show-threads)
5981 (setq d (gnus-data-find (mail-header-number old-header))))
5982 (goto-char (gnus-data-pos d))
5988 (gnus-delete-line))))))
5990 (mail-header-set-number header (mail-header-number old-header)))
5991 (setq gnus-newsgroup-sparse
5992 (delq (setq number (mail-header-number header))
5993 gnus-newsgroup-sparse))
5994 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5995 (push number gnus-newsgroup-limit)
5996 (gnus-rebuild-thread (mail-header-id header) line)
5997 (gnus-summary-goto-subject number nil t))
5998 (when (and (numberp number)
6000 ;; We have to update the boundaries even if we can't fetch the
6001 ;; article if ID is a number -- so that the next `P' or `N'
6002 ;; command will fetch the previous (or next) article even
6003 ;; if the one we tried to fetch this time has been canceled.
6004 (when (> number gnus-newsgroup-end)
6005 (setq gnus-newsgroup-end number))
6006 (when (< number gnus-newsgroup-begin)
6007 (setq gnus-newsgroup-begin number))
6008 (setq gnus-newsgroup-unselected
6009 (delq number gnus-newsgroup-unselected)))
6010 ;; Report back a success?
6011 (and header (mail-header-number header))))
6013 ;;; Process/prefix in the summary buffer
6015 (defun gnus-summary-work-articles (n)
6016 "Return a list of articles to be worked upon.
6017 The prefix argument, the list of process marked articles, and the
6018 current article will be taken into consideration."
6020 (set-buffer gnus-summary-buffer)
6023 ;; A numerical prefix has been given.
6024 (setq n (prefix-numeric-value n))
6025 (let ((backward (< n 0))
6026 (n (abs (prefix-numeric-value n)))
6031 (push (setq article (gnus-summary-article-number))
6034 (gnus-summary-find-prev nil article)
6035 (gnus-summary-find-next nil article)))
6037 (nreverse articles)))
6038 ((and (gnus-region-active-p) (mark))
6039 (message "region active")
6040 ;; Work on the region between point and mark.
6041 (let ((max (max (point) (mark)))
6044 (goto-char (min (min (point) (mark))))
6047 (push (setq article (gnus-summary-article-number)) articles)
6048 (gnus-summary-find-next nil article)
6050 (nreverse articles))))
6051 (gnus-newsgroup-processable
6052 ;; There are process-marked articles present.
6053 ;; Save current state.
6054 (gnus-summary-save-process-mark)
6056 (reverse gnus-newsgroup-processable))
6058 ;; Just return the current article.
6059 (list (gnus-summary-article-number))))))
6061 (defmacro gnus-summary-iterate (arg &rest forms)
6062 "Iterate over the process/prefixed articles and do FORMS.
6063 ARG is the interactive prefix given to the command. FORMS will be
6064 executed with point over the summary line of the articles."
6065 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6066 `(let ((,articles (gnus-summary-work-articles ,arg)))
6068 (gnus-summary-goto-subject (car ,articles))
6072 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6073 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6075 (defun gnus-summary-save-process-mark ()
6076 "Push the current set of process marked articles on the stack."
6078 (push (copy-sequence gnus-newsgroup-processable)
6079 gnus-newsgroup-process-stack))
6081 (defun gnus-summary-kill-process-mark ()
6082 "Push the current set of process marked articles on the stack and unmark."
6084 (gnus-summary-save-process-mark)
6085 (gnus-summary-unmark-all-processable))
6087 (defun gnus-summary-yank-process-mark ()
6088 "Pop the last process mark state off the stack and restore it."
6090 (unless gnus-newsgroup-process-stack
6091 (error "Empty mark stack"))
6092 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6094 (defun gnus-summary-process-mark-set (set)
6095 "Make SET into the current process marked articles."
6096 (gnus-summary-unmark-all-processable)
6098 (gnus-summary-set-process-mark (pop set))))
6100 ;;; Searching and stuff
6102 (defun gnus-summary-search-group (&optional backward use-level)
6103 "Search for next unread newsgroup.
6104 If optional argument BACKWARD is non-nil, search backward instead."
6106 (set-buffer gnus-group-buffer)
6107 (when (gnus-group-search-forward
6108 backward nil (if use-level (gnus-group-group-level) nil))
6109 (gnus-group-group-name))))
6111 (defun gnus-summary-best-group (&optional exclude-group)
6112 "Find the name of the best unread group.
6113 If EXCLUDE-GROUP, do not go to this group."
6115 (set-buffer gnus-group-buffer)
6117 (gnus-group-best-unread-group exclude-group))))
6119 (defun gnus-summary-find-next (&optional unread article backward)
6121 (gnus-summary-find-prev unread article)
6122 (let* ((dummy (gnus-summary-article-intangible-p))
6123 (article (or article (gnus-summary-article-number)))
6124 (data (gnus-data-find-list article))
6126 (when (and (not dummy)
6127 (or (not gnus-summary-check-current)
6129 (not (gnus-data-unread-p (car data)))))
6130 (setq data (cdr data)))
6135 (unless (memq (gnus-data-number (car data))
6137 ((eq gnus-auto-goto-ignores
6138 'always-undownloaded)
6139 gnus-newsgroup-undownloaded)
6142 ((eq gnus-auto-goto-ignores
6144 gnus-newsgroup-unfetched)
6145 ((eq gnus-auto-goto-ignores
6147 gnus-newsgroup-undownloaded)))
6148 (when (gnus-data-unread-p (car data))
6149 (setq result (car data)
6151 (setq data (cdr data)))
6154 (goto-char (gnus-data-pos result))
6155 (gnus-data-number result)))))
6157 (defun gnus-summary-find-prev (&optional unread article)
6158 (let* ((eobp (eobp))
6159 (article (or article (gnus-summary-article-number)))
6160 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6162 (when (and (not eobp)
6163 (or (not gnus-summary-check-current)
6165 (not (gnus-data-unread-p (car data)))))
6166 (setq data (cdr data)))
6171 (unless (memq (gnus-data-number (car data))
6173 ((eq gnus-auto-goto-ignores
6174 'always-undownloaded)
6175 gnus-newsgroup-undownloaded)
6178 ((eq gnus-auto-goto-ignores
6180 gnus-newsgroup-unfetched)
6181 ((eq gnus-auto-goto-ignores
6183 gnus-newsgroup-undownloaded)))
6184 (when (gnus-data-unread-p (car data))
6185 (setq result (car data)
6187 (setq data (cdr data)))
6190 (goto-char (gnus-data-pos result))
6191 (gnus-data-number result))))
6193 (defun gnus-summary-find-subject (subject &optional unread backward article)
6194 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6195 (article (or article (gnus-summary-article-number)))
6196 (articles (gnus-data-list backward))
6197 (arts (gnus-data-find-list article articles))
6199 (when (or (not gnus-summary-check-current)
6201 (not (gnus-data-unread-p (car arts))))
6202 (setq arts (cdr arts)))
6204 (and (or (not unread)
6205 (gnus-data-unread-p (car arts)))
6206 (vectorp (gnus-data-header (car arts)))
6208 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6209 (setq result (car arts)
6211 (setq arts (cdr arts)))
6213 (goto-char (gnus-data-pos result))
6214 (gnus-data-number result))))
6216 (defun gnus-summary-search-forward (&optional unread subject backward)
6217 "Search forward for an article.
6218 If UNREAD, look for unread articles. If SUBJECT, look for
6219 articles with that subject. If BACKWARD, search backward instead."
6220 (cond (subject (gnus-summary-find-subject subject unread backward))
6221 (backward (gnus-summary-find-prev unread))
6222 (t (gnus-summary-find-next unread))))
6224 (defun gnus-recenter (&optional n)
6225 "Center point in window and redisplay frame.
6226 Also do horizontal recentering."
6228 (when (and gnus-auto-center-summary
6229 (not (eq gnus-auto-center-summary 'vertical)))
6230 (gnus-horizontal-recenter))
6233 (defun gnus-summary-recenter ()
6234 "Center point in the summary window.
6235 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6236 displayed, no centering will be performed."
6237 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6238 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6240 ;; The user has to want it.
6241 (when gnus-auto-center-summary
6242 (let* ((top (cond ((< (window-height) 4) 0)
6243 ((< (window-height) 7) 1)
6244 (t (if (numberp gnus-auto-center-summary)
6245 gnus-auto-center-summary
6247 (height (1- (window-height)))
6248 (bottom (save-excursion (goto-char (point-max))
6249 (forward-line (- height))
6251 (window (get-buffer-window (current-buffer))))
6252 (when (get-buffer-window gnus-article-buffer)
6253 ;; Only do recentering when the article buffer is displayed,
6254 ;; Set the window start to either `bottom', which is the biggest
6255 ;; possible valid number, or the second line from the top,
6256 ;; whichever is the least.
6257 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6258 (if (> bottom top-pos)
6259 ;; Keep the second line from the top visible
6260 (set-window-start window top-pos t)
6261 ;; Try to keep the bottom line visible; if it's partially
6262 ;; obscured, either scroll one more line to make it fully
6263 ;; visible, or revert to using TOP-POS.
6265 (goto-char (point-max))
6267 (let ((last-line-start (point)))
6269 (set-window-start window (point) t)
6270 (when (not (pos-visible-in-window-p last-line-start window))
6272 (set-window-start window (min (point) top-pos) t)))))))
6273 ;; Do horizontal recentering while we're at it.
6274 (when (and (get-buffer-window (current-buffer) t)
6275 (not (eq gnus-auto-center-summary 'vertical)))
6276 (let ((selected (selected-window)))
6277 (select-window (get-buffer-window (current-buffer) t))
6278 (gnus-summary-position-point)
6279 (gnus-horizontal-recenter)
6280 (select-window selected))))))
6282 (defun gnus-summary-jump-to-group (newsgroup)
6283 "Move point to NEWSGROUP in group mode buffer."
6284 ;; Keep update point of group mode buffer if visible.
6285 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6286 (save-window-excursion
6287 ;; Take care of tree window mode.
6288 (when (get-buffer-window gnus-group-buffer)
6289 (pop-to-buffer gnus-group-buffer))
6290 (gnus-group-jump-to-group newsgroup))
6292 ;; Take care of tree window mode.
6293 (if (get-buffer-window gnus-group-buffer)
6294 (pop-to-buffer gnus-group-buffer)
6295 (set-buffer gnus-group-buffer))
6296 (gnus-group-jump-to-group newsgroup))))
6298 ;; This function returns a list of article numbers based on the
6299 ;; difference between the ranges of read articles in this group and
6300 ;; the range of active articles.
6301 (defun gnus-list-of-unread-articles (group)
6302 (let* ((read (gnus-info-read (gnus-get-info group)))
6303 (active (or (gnus-active group) (gnus-activate-group group)))
6306 ;; If none are read, then all are unread.
6308 (setq first (car active))
6309 ;; If the range of read articles is a single range, then the
6310 ;; first unread article is the article after the last read
6311 ;; article. Sounds logical, doesn't it?
6312 (if (and (not (listp (cdr read)))
6313 (or (< (car read) (car active))
6314 (progn (setq read (list read))
6316 (setq first (max (car active) (1+ (cdr read))))
6317 ;; `read' is a list of ranges.
6318 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6321 (setq first (car active)))
6324 (while (< first nlast)
6325 (setq unread (cons first unread)
6327 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6328 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6329 (setq read (cdr read)))))
6330 ;; And add the last unread articles.
6331 (while (<= first last)
6332 (setq unread (cons first unread)
6334 ;; Return the list of unread articles.
6335 (delq 0 (nreverse unread))))
6337 (defun gnus-list-of-read-articles (group)
6338 "Return a list of unread, unticked and non-dormant articles."
6339 (let* ((info (gnus-get-info group))
6340 (marked (gnus-info-marks info))
6341 (active (gnus-active group)))
6343 (gnus-list-range-difference
6344 (gnus-list-range-difference
6345 (gnus-sorted-complement
6346 (gnus-uncompress-range active)
6347 (gnus-list-of-unread-articles group))
6348 (cdr (assq 'dormant marked)))
6349 (cdr (assq 'tick marked))))))
6351 ;; This function returns a sequence of article numbers based on the
6352 ;; difference between the ranges of read articles in this group and
6353 ;; the range of active articles.
6354 (defun gnus-sequence-of-unread-articles (group)
6355 (let* ((read (gnus-info-read (gnus-get-info group)))
6356 (active (or (gnus-active group) (gnus-activate-group group)))
6359 ;; If none are read, then all are unread.
6361 (setq first (car active))
6362 ;; If the range of read articles is a single range, then the
6363 ;; first unread article is the article after the last read
6364 ;; article. Sounds logical, doesn't it?
6365 (if (and (not (listp (cdr read)))
6366 (or (< (car read) (car active))
6367 (progn (setq read (list read))
6369 (setq first (max (car active) (1+ (cdr read))))
6370 ;; `read' is a list of ranges.
6371 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6374 (setq first (car active)))
6377 (push (cons first nlast) unread))
6378 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6379 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6380 (setq read (cdr read)))))
6381 ;; And add the last unread articles.
6382 (cond ((< first last)
6383 (push (cons first last) unread))
6385 (push first unread)))
6386 ;; Return the sequence of unread articles.
6387 (delq 0 (nreverse unread))))
6389 ;; Various summary commands
6391 (defun gnus-summary-select-article-buffer ()
6392 "Reconfigure windows to show article buffer."
6394 (if (not (gnus-buffer-live-p gnus-article-buffer))
6395 (error "There is no article buffer for this summary buffer")
6396 (gnus-configure-windows 'article)
6397 (select-window (get-buffer-window gnus-article-buffer))))
6399 (defun gnus-summary-universal-argument (arg)
6400 "Perform any operation on all articles that are process/prefixed."
6402 (let ((articles (gnus-summary-work-articles arg))
6409 (substitute-command-keys
6410 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6412 (gnus-error 1 "Undefined key")
6415 (gnus-summary-goto-subject (setq article (pop articles)))
6416 (let (gnus-newsgroup-processable)
6417 (command-execute func))
6418 (gnus-summary-remove-process-mark article)))))
6419 (gnus-summary-position-point))
6421 (defun gnus-summary-toggle-truncation (&optional arg)
6422 "Toggle truncation of summary lines.
6423 With ARG, turn line truncation on if ARG is positive."
6425 (setq truncate-lines
6426 (if (null arg) (not truncate-lines)
6427 (> (prefix-numeric-value arg) 0)))
6430 (defun gnus-summary-find-for-reselect ()
6431 "Return the number of an article to stay on across a reselect.
6432 The current article is considered, then following articles, then previous
6433 articles. An article is sought which is not cancelled and isn't a temporary
6434 insertion from another group. If there's no such then return a dummy 0."
6436 (dolist (rev '(nil t))
6437 (unless found ; don't demand the reverse list if we don't need it
6438 (let ((data (gnus-data-find-list
6439 (gnus-summary-article-number) (gnus-data-list rev))))
6440 (while (and data (not found))
6441 (if (and (< 0 (gnus-data-number (car data)))
6442 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6443 (setq found (gnus-data-number (car data))))
6444 (setq data (cdr data))))))
6447 (defun gnus-summary-reselect-current-group (&optional all rescan)
6448 "Exit and then reselect the current newsgroup.
6449 The prefix argument ALL means to select all articles."
6451 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6452 (error "Ephemeral groups can't be reselected"))
6453 (let ((current-subject (gnus-summary-find-for-reselect))
6454 (group gnus-newsgroup-name))
6455 (setq gnus-newsgroup-begin nil)
6456 (gnus-summary-exit nil 'leave-hidden)
6457 ;; We have to adjust the point of group mode buffer because
6458 ;; point was moved to the next unread newsgroup by exiting.
6459 (gnus-summary-jump-to-group group)
6462 (gnus-group-get-new-news-this-group 1)))
6463 (gnus-group-read-group all t)
6464 (gnus-summary-goto-subject current-subject nil t)))
6466 (defun gnus-summary-rescan-group (&optional all)
6467 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6469 (gnus-summary-reselect-current-group all t))
6471 (defun gnus-summary-update-info (&optional non-destructive)
6473 (let ((group gnus-newsgroup-name))
6475 (when gnus-newsgroup-kill-headers
6476 (setq gnus-newsgroup-killed
6477 (gnus-compress-sequence
6479 (gnus-list-range-intersection
6480 gnus-newsgroup-unselected gnus-newsgroup-killed)
6481 gnus-newsgroup-unreads)
6483 (unless (listp (cdr gnus-newsgroup-killed))
6484 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6485 (let ((headers gnus-newsgroup-headers))
6486 ;; Set the new ranges of read articles.
6488 (set-buffer gnus-group-buffer)
6489 (gnus-undo-force-boundary))
6490 (gnus-update-read-articles
6491 group (gnus-sorted-union
6492 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6493 ;; Set the current article marks.
6494 (let ((gnus-newsgroup-scored
6495 (if (and (not gnus-save-score)
6496 (not non-destructive))
6498 gnus-newsgroup-scored)))
6500 (gnus-update-marks)))
6501 ;; Do the cross-ref thing.
6502 (when gnus-use-cross-reference
6503 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6504 ;; Do not switch windows but change the buffer to work.
6505 (set-buffer gnus-group-buffer)
6506 (unless (gnus-ephemeral-group-p group)
6507 (gnus-group-update-group group)))))))
6509 (defun gnus-summary-save-newsrc (&optional force)
6510 "Save the current number of read/marked articles in the dribble buffer.
6511 The dribble buffer will then be saved.
6512 If FORCE (the prefix), also save the .newsrc file(s)."
6514 (gnus-summary-update-info t)
6516 (gnus-save-newsrc-file)
6517 (gnus-dribble-save)))
6519 (defun gnus-summary-exit (&optional temporary leave-hidden)
6520 "Exit reading current newsgroup, and then return to group selection mode.
6521 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6523 (gnus-set-global-variables)
6524 (when (gnus-buffer-live-p gnus-article-buffer)
6526 (set-buffer gnus-article-buffer)
6527 (mm-destroy-parts gnus-article-mime-handles)
6528 ;; Set it to nil for safety reason.
6529 (setq gnus-article-mime-handle-alist nil)
6530 (setq gnus-article-mime-handles nil)))
6531 (gnus-kill-save-kill-buffer)
6532 (gnus-async-halt-prefetch)
6533 (let* ((group gnus-newsgroup-name)
6534 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6535 (gnus-group-is-exiting-p t)
6538 (buf (current-buffer)))
6540 ;; Do adaptive scoring, and possibly save score files.
6541 (when gnus-newsgroup-adaptive
6542 (gnus-score-adaptive))
6543 (when gnus-use-scoring
6545 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6546 ;; If we have several article buffers, we kill them at exit.
6547 (unless gnus-single-article-buffer
6548 (gnus-kill-buffer gnus-original-article-buffer)
6549 (setq gnus-article-current nil))
6550 (when gnus-use-cache
6551 (gnus-cache-possibly-remove-articles)
6552 (gnus-cache-save-buffers))
6553 (gnus-async-prefetch-remove-group group)
6554 (when gnus-suppress-duplicates
6555 (gnus-dup-enter-articles))
6556 (when gnus-use-trees
6557 (gnus-tree-close group))
6558 (when gnus-use-cache
6559 (gnus-cache-write-active))
6560 ;; Remove entries for this group.
6561 (nnmail-purge-split-history (gnus-group-real-name group))
6562 ;; Make all changes in this group permanent.
6564 (gnus-run-hooks 'gnus-exit-group-hook)
6565 (gnus-summary-update-info))
6566 (gnus-close-group group)
6567 ;; Make sure where we were, and go to next newsgroup.
6568 (set-buffer gnus-group-buffer)
6570 (gnus-group-jump-to-group group))
6571 (gnus-run-hooks 'gnus-summary-exit-hook)
6572 (unless (or quit-config
6573 ;; If this group has disappeared from the summary
6574 ;; buffer, don't skip forwards.
6575 (not (string= group (gnus-group-group-name))))
6576 (gnus-group-next-unread-group 1))
6577 (setq group-point (point))
6580 ;; If we have several article buffers, we kill them at exit.
6581 (unless gnus-single-article-buffer
6582 (gnus-kill-buffer gnus-article-buffer)
6583 (gnus-kill-buffer gnus-original-article-buffer)
6584 (setq gnus-article-current nil))
6586 (if (not gnus-kill-summary-on-exit)
6588 (gnus-deaden-summary)
6590 ;; We set all buffer-local variables to nil. It is unclear why
6591 ;; this is needed, but if we don't, buffer-local variables are
6592 ;; not garbage-collected, it seems. This would the lead to en
6593 ;; ever-growing Emacs.
6594 (gnus-summary-clear-local-variables)
6595 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6596 (gnus-summary-clear-local-variables))
6597 (when (get-buffer gnus-article-buffer)
6598 (bury-buffer gnus-article-buffer))
6599 ;; We clear the global counterparts of the buffer-local
6600 ;; variables as well, just to be on the safe side.
6601 (set-buffer gnus-group-buffer)
6602 (gnus-summary-clear-local-variables)
6603 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6604 (gnus-summary-clear-local-variables))
6605 ;; Return to group mode buffer.
6606 (when (eq mode 'gnus-summary-mode)
6607 (gnus-kill-buffer buf)))
6608 (setq gnus-current-select-method gnus-select-method)
6610 (set-buffer gnus-group-buffer)
6611 (pop-to-buffer gnus-group-buffer))
6612 (if (not quit-config)
6614 (goto-char group-point)
6615 (unless leave-hidden
6616 (gnus-configure-windows 'group 'force)))
6617 (gnus-handle-ephemeral-exit quit-config))
6618 ;; Clear the current group name.
6620 (setq gnus-newsgroup-name nil)))))
6622 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6623 (defun gnus-summary-exit-no-update (&optional no-questions)
6624 "Quit reading current newsgroup without updating read article info."
6626 (let* ((group gnus-newsgroup-name)
6627 (gnus-group-is-exiting-p t)
6628 (gnus-group-is-exiting-without-update-p t)
6629 (quit-config (gnus-group-quit-config group)))
6630 (when (or no-questions
6632 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6633 (gnus-async-halt-prefetch)
6634 (run-hooks 'gnus-summary-prepare-exit-hook)
6635 (when (gnus-buffer-live-p gnus-article-buffer)
6637 (set-buffer gnus-article-buffer)
6638 (mm-destroy-parts gnus-article-mime-handles)
6639 ;; Set it to nil for safety reason.
6640 (setq gnus-article-mime-handle-alist nil)
6641 (setq gnus-article-mime-handles nil)))
6642 ;; If we have several article buffers, we kill them at exit.
6643 (unless gnus-single-article-buffer
6644 (gnus-kill-buffer gnus-article-buffer)
6645 (gnus-kill-buffer gnus-original-article-buffer)
6646 (setq gnus-article-current nil))
6647 (if (not gnus-kill-summary-on-exit)
6648 (gnus-deaden-summary)
6649 (gnus-close-group group)
6650 (gnus-summary-clear-local-variables)
6651 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6652 (gnus-summary-clear-local-variables))
6653 (set-buffer gnus-group-buffer)
6654 (gnus-summary-clear-local-variables)
6655 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6656 (gnus-summary-clear-local-variables))
6657 (gnus-kill-buffer gnus-summary-buffer))
6658 (unless gnus-single-article-buffer
6659 (setq gnus-article-current nil))
6660 (when gnus-use-trees
6661 (gnus-tree-close group))
6662 (gnus-async-prefetch-remove-group group)
6663 (when (get-buffer gnus-article-buffer)
6664 (bury-buffer gnus-article-buffer))
6665 ;; Return to the group buffer.
6666 (gnus-configure-windows 'group 'force)
6667 ;; Clear the current group name.
6668 (setq gnus-newsgroup-name nil)
6669 (unless (gnus-ephemeral-group-p group)
6670 (gnus-group-update-group group))
6671 (when (equal (gnus-group-group-name) group)
6672 (gnus-group-next-unread-group 1))
6674 (gnus-handle-ephemeral-exit quit-config)))))
6676 (defun gnus-handle-ephemeral-exit (quit-config)
6677 "Handle movement when leaving an ephemeral group.
6678 The state which existed when entering the ephemeral is reset."
6679 (if (not (buffer-name (car quit-config)))
6680 (gnus-configure-windows 'group 'force)
6681 (set-buffer (car quit-config))
6682 (cond ((eq major-mode 'gnus-summary-mode)
6683 (gnus-set-global-variables))
6684 ((eq major-mode 'gnus-article-mode)
6686 ;; The `gnus-summary-buffer' variable may point
6687 ;; to the old summary buffer when using a single
6689 (unless (gnus-buffer-live-p gnus-summary-buffer)
6690 (set-buffer gnus-group-buffer))
6691 (set-buffer gnus-summary-buffer)
6692 (gnus-set-global-variables))))
6693 (if (or (eq (cdr quit-config) 'article)
6694 (eq (cdr quit-config) 'pick))
6696 ;; The current article may be from the ephemeral group
6697 ;; thus it is best that we reload this article
6699 ;; If we're exiting from a large digest, this can be
6700 ;; extremely slow. So, it's better not to reload it. -- jh.
6701 ;;(gnus-summary-show-article)
6702 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6703 (gnus-configure-windows 'pick 'force)
6704 (gnus-configure-windows (cdr quit-config) 'force)))
6705 (gnus-configure-windows (cdr quit-config) 'force))
6706 (when (eq major-mode 'gnus-summary-mode)
6707 (gnus-summary-next-subject 1 nil t)
6708 (gnus-summary-recenter)
6709 (gnus-summary-position-point))))
6713 (defvar gnus-dead-summary-mode-map nil)
6715 (unless gnus-dead-summary-mode-map
6716 (setq gnus-dead-summary-mode-map (make-keymap))
6717 (suppress-keymap gnus-dead-summary-mode-map)
6718 (substitute-key-definition
6719 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6720 (dolist (key '("\C-d" "\r" "\177" [delete]))
6721 (define-key gnus-dead-summary-mode-map
6722 key 'gnus-summary-wake-up-the-dead))
6723 (dolist (key '("q" "Q"))
6724 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6726 (defvar gnus-dead-summary-mode nil
6727 "Minor mode for Gnus summary buffers.")
6729 (defun gnus-dead-summary-mode (&optional arg)
6730 "Minor mode for Gnus summary buffers."
6732 (when (eq major-mode 'gnus-summary-mode)
6733 (make-local-variable 'gnus-dead-summary-mode)
6734 (setq gnus-dead-summary-mode
6735 (if (null arg) (not gnus-dead-summary-mode)
6736 (> (prefix-numeric-value arg) 0)))
6737 (when gnus-dead-summary-mode
6739 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6741 (defun gnus-deaden-summary ()
6742 "Make the current summary buffer into a dead summary buffer."
6743 ;; Kill any previous dead summary buffer.
6744 (when (and gnus-dead-summary
6745 (buffer-name gnus-dead-summary))
6747 (set-buffer gnus-dead-summary)
6748 (when gnus-dead-summary-mode
6749 (kill-buffer (current-buffer)))))
6750 ;; Make this the current dead summary.
6751 (setq gnus-dead-summary (current-buffer))
6752 (gnus-dead-summary-mode 1)
6753 (let ((name (buffer-name)))
6754 (when (string-match "Summary" name)
6756 (concat (substring name 0 (match-beginning 0)) "Dead "
6757 (substring name (match-beginning 0)))
6761 (defun gnus-kill-or-deaden-summary (buffer)
6762 "Kill or deaden the summary BUFFER."
6764 (when (and (buffer-name buffer)
6765 (not gnus-single-article-buffer))
6768 (gnus-kill-buffer gnus-article-buffer)
6769 (gnus-kill-buffer gnus-original-article-buffer)))
6772 (gnus-kill-summary-on-exit
6773 (when (and gnus-use-trees
6774 (gnus-buffer-exists-p buffer))
6777 (gnus-tree-close gnus-newsgroup-name)))
6778 (gnus-kill-buffer buffer))
6779 ;; Deaden the buffer.
6780 ((gnus-buffer-exists-p buffer)
6783 (gnus-deaden-summary))))))
6785 (defun gnus-summary-wake-up-the-dead (&rest args)
6786 "Wake up the dead summary buffer."
6788 (gnus-dead-summary-mode -1)
6789 (let ((name (buffer-name)))
6790 (when (string-match "Dead " name)
6792 (concat (substring name 0 (match-beginning 0))
6793 (substring name (match-end 0)))
6795 (gnus-message 3 "This dead summary is now alive again"))
6797 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6798 (defun gnus-summary-fetch-faq (&optional faq-dir)
6799 "Fetch the FAQ for the current group.
6800 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6804 (when current-prefix-arg
6806 "FAQ dir: " (and (listp gnus-group-faq-directory)
6807 (mapcar (lambda (file) (list file))
6808 gnus-group-faq-directory))))))
6809 (let (gnus-faq-buffer)
6810 (when (setq gnus-faq-buffer
6811 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6812 (gnus-configure-windows 'summary-faq))))
6814 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6815 (defun gnus-summary-describe-group (&optional force)
6816 "Describe the current newsgroup."
6818 (gnus-group-describe-group force gnus-newsgroup-name))
6820 (defun gnus-summary-describe-briefly ()
6821 "Describe summary mode commands briefly."
6823 (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")))
6825 ;; Walking around group mode buffer from summary mode.
6827 (defun gnus-summary-next-group (&optional no-article target-group backward)
6828 "Exit current newsgroup and then select next unread newsgroup.
6829 If prefix argument NO-ARTICLE is non-nil, no article is selected
6830 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6831 previous group instead."
6833 ;; Stop pre-fetching.
6834 (gnus-async-halt-prefetch)
6835 (let ((current-group gnus-newsgroup-name)
6836 (current-buffer (current-buffer))
6838 ;; First we semi-exit this group to update Xrefs and all variables.
6839 ;; We can't do a real exit, because the window conf must remain
6840 ;; the same in case the user is prompted for info, and we don't
6841 ;; want the window conf to change before that...
6842 (gnus-summary-exit t)
6843 (while (not entered)
6844 ;; Then we find what group we are supposed to enter.
6845 (set-buffer gnus-group-buffer)
6846 (gnus-group-jump-to-group current-group)
6849 (if (eq gnus-keep-same-level 'best)
6850 (gnus-summary-best-group gnus-newsgroup-name)
6851 (gnus-summary-search-group backward gnus-keep-same-level))))
6852 (if (not target-group)
6853 ;; There are no further groups, so we return to the group
6856 (gnus-message 5 "Returning to the group buffer")
6858 (when (gnus-buffer-live-p current-buffer)
6859 (set-buffer current-buffer)
6860 (gnus-summary-exit))
6861 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6862 ;; We try to enter the target group.
6863 (gnus-group-jump-to-group target-group)
6864 (let ((unreads (gnus-group-group-unread)))
6865 (if (and (or (eq t unreads)
6866 (and unreads (not (zerop unreads))))
6867 (gnus-summary-read-group
6868 target-group nil no-article
6869 (and (buffer-name current-buffer) current-buffer)
6872 (setq current-group target-group
6873 target-group nil)))))))
6875 (defun gnus-summary-prev-group (&optional no-article)
6876 "Exit current newsgroup and then select previous unread newsgroup.
6877 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6879 (gnus-summary-next-group no-article nil t))
6881 ;; Walking around summary lines.
6883 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6884 "Go to the first subject satisfying any non-nil constraint.
6885 If UNREAD is non-nil, the article should be unread.
6886 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6887 If UNSEEN is non-nil, the article should be unseen.
6888 Returns the article selected or nil if there are no matching articles."
6892 ((null gnus-newsgroup-data)
6893 (gnus-message 3 "No articles in the group")
6895 ;; Pick the first article.
6896 ((not (or unread undownloaded unseen))
6897 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6898 (gnus-data-number (car gnus-newsgroup-data)))
6899 ;; Find the first unread article.
6901 (let ((data gnus-newsgroup-data))
6903 (let ((num (gnus-data-number (car data))))
6904 (or (memq num gnus-newsgroup-unfetched)
6905 (not (or (and unread
6906 (memq num gnus-newsgroup-unreads))
6908 (memq num gnus-newsgroup-undownloaded))
6910 (memq num gnus-newsgroup-unseen)))))))
6911 (setq data (cdr data)))
6915 (goto-char (gnus-data-pos (car data)))
6916 (gnus-data-number (car data)))
6917 (gnus-message 3 "No more%s articles"
6918 (let* ((r (when unread " unread"))
6919 (d (when undownloaded " undownloaded"))
6920 (s (when unseen " unseen"))
6921 (l (delq nil (list r d s))))
6922 (cond ((= 3 (length l))
6923 (concat r "," d ", or" s))
6925 (concat (car l) ", or" (cadr l)))
6932 (gnus-summary-position-point))))))
6934 (defun gnus-summary-next-subject (n &optional unread dont-display)
6935 "Go to next N'th summary line.
6936 If N is negative, go to the previous N'th subject line.
6937 If UNREAD is non-nil, only unread articles are selected.
6938 The difference between N and the actual number of steps taken is
6941 (let ((backward (< n 0))
6945 (gnus-summary-find-prev unread)
6946 (gnus-summary-find-next unread)))
6947 (unless (zerop (setq n (1- n)))
6948 (gnus-summary-show-thread)))
6950 (gnus-message 7 "No more%s articles"
6951 (if unread " unread" "")))
6952 (unless dont-display
6953 (gnus-summary-recenter)
6954 (gnus-summary-position-point))
6957 (defun gnus-summary-next-unread-subject (n)
6958 "Go to next N'th unread summary line."
6960 (gnus-summary-next-subject n t))
6962 (defun gnus-summary-prev-subject (n &optional unread)
6963 "Go to previous N'th summary line.
6964 If optional argument UNREAD is non-nil, only unread article is selected."
6966 (gnus-summary-next-subject (- n) unread))
6968 (defun gnus-summary-prev-unread-subject (n)
6969 "Go to previous N'th unread summary line."
6971 (gnus-summary-next-subject (- n) t))
6973 (defun gnus-summary-goto-subjects (articles)
6974 "Insert the subject header for ARTICLES in the current buffer."
6976 (dolist (article articles)
6977 (gnus-summary-goto-subject article t)))
6978 (gnus-summary-limit (append articles gnus-newsgroup-limit))
6979 (gnus-summary-position-point))
6981 (defun gnus-summary-goto-subject (article &optional force silent)
6982 "Go the subject line of ARTICLE.
6983 If FORCE, also allow jumping to articles not currently shown."
6984 (interactive "nArticle number: ")
6985 (unless (numberp article)
6986 (error "Article %s is not a number" article))
6988 (data (gnus-data-find article)))
6989 ;; We read in the article if we have to.
6992 (gnus-summary-insert-subject
6994 (if (or (numberp force) (vectorp force)) force)
6996 (setq data (gnus-data-find article)))
7001 (gnus-message 3 "Can't find article %d" article))
7003 (let ((pt (gnus-data-pos data)))
7005 (gnus-summary-set-article-display-arrow pt))
7006 (gnus-summary-position-point)
7009 ;; Walking around summary lines with displaying articles.
7011 (defun gnus-summary-expand-window (&optional arg)
7012 "Make the summary buffer take up the entire Emacs frame.
7013 Given a prefix, will force an `article' buffer configuration."
7016 (gnus-configure-windows 'article 'force)
7017 (gnus-configure-windows 'summary 'force)))
7019 (defun gnus-summary-display-article (article &optional all-header)
7020 "Display ARTICLE in article buffer."
7021 (when (gnus-buffer-live-p gnus-article-buffer)
7022 (with-current-buffer gnus-article-buffer
7023 (mm-enable-multibyte)))
7024 (gnus-set-global-variables)
7025 (when (gnus-buffer-live-p gnus-article-buffer)
7026 (with-current-buffer gnus-article-buffer
7027 (setq gnus-article-charset gnus-newsgroup-charset)
7028 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7029 (mm-enable-multibyte)))
7033 (if gnus-summary-display-article-function
7034 (funcall gnus-summary-display-article-function article all-header)
7035 (gnus-article-prepare article all-header))
7036 (gnus-run-hooks 'gnus-select-article-hook)
7037 (when (and gnus-current-article
7038 (not (zerop gnus-current-article)))
7039 (gnus-summary-goto-subject gnus-current-article))
7040 (gnus-summary-recenter)
7041 (when (and gnus-use-trees gnus-show-threads)
7042 (gnus-possibly-generate-tree article)
7043 (gnus-highlight-selected-tree article))
7044 ;; Successfully display article.
7045 (gnus-article-set-window-start
7046 (cdr (assq article gnus-newsgroup-bookmarks))))))
7048 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7049 "Select the current article.
7050 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7051 non-nil, the article will be re-fetched even if it already present in
7052 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7054 ;; Make sure we are in the summary buffer to work around bbdb bug.
7055 (unless (eq major-mode 'gnus-summary-mode)
7056 (set-buffer gnus-summary-buffer))
7057 (let ((article (or article (gnus-summary-article-number)))
7058 (all-headers (not (not all-headers))) ;Must be t or nil.
7059 gnus-summary-display-article-function)
7061 (gnus-summary-article-pseudo-p article)
7062 (error "This is a pseudo-article"))
7064 (set-buffer gnus-summary-buffer)
7065 (if (or (and gnus-single-article-buffer
7066 (or (null gnus-current-article)
7067 (null gnus-article-current)
7068 (null (get-buffer gnus-article-buffer))
7069 (not (eq article (cdr gnus-article-current)))
7070 (not (equal (car gnus-article-current)
7071 gnus-newsgroup-name))))
7072 (and (not gnus-single-article-buffer)
7073 (or (null gnus-current-article)
7074 (not (eq gnus-current-article article))))
7076 ;; The requested article is different from the current article.
7078 (gnus-summary-display-article article all-headers)
7079 (when (gnus-buffer-live-p gnus-article-buffer)
7080 (with-current-buffer gnus-article-buffer
7081 (if (not gnus-article-decoded-p) ;; a local variable
7082 (mm-disable-multibyte))))
7083 (gnus-article-set-window-start
7084 (cdr (assq article gnus-newsgroup-bookmarks)))
7088 (defun gnus-summary-force-verify-and-decrypt ()
7089 "Display buttons for signed/encrypted parts and verify/decrypt them."
7091 (let ((mm-verify-option 'known)
7092 (mm-decrypt-option 'known)
7093 (gnus-article-emulate-mime t)
7094 (gnus-buttonized-mime-types (append (list "multipart/signed"
7095 "multipart/encrypted")
7096 gnus-buttonized-mime-types)))
7097 (gnus-summary-select-article nil 'force)))
7099 (defun gnus-summary-set-current-mark (&optional current-mark)
7100 "Obsolete function."
7103 (defun gnus-summary-next-article (&optional unread subject backward push)
7104 "Select the next article.
7105 If UNREAD, only unread articles are selected.
7106 If SUBJECT, only articles with SUBJECT are selected.
7107 If BACKWARD, the previous article is selected instead of the next."
7110 ;; Is there such an article?
7111 ((and (gnus-summary-search-forward unread subject backward)
7112 (or (gnus-summary-display-article (gnus-summary-article-number))
7113 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7114 (gnus-summary-position-point))
7115 ;; If not, we try the first unread, if that is wanted.
7117 gnus-auto-select-same
7118 (gnus-summary-first-unread-article))
7119 (gnus-summary-position-point)
7120 (gnus-message 6 "Wrapped"))
7121 ;; Try to get next/previous article not displayed in this group.
7122 ((and gnus-auto-extend-newsgroup
7123 (not unread) (not subject))
7124 (gnus-summary-goto-article
7125 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7126 nil (count-lines (point-min) (point))))
7127 ;; Go to next/previous group.
7129 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7130 (gnus-summary-jump-to-group gnus-newsgroup-name))
7131 (let ((cmd last-command-char)
7134 (set-buffer gnus-group-buffer)
7137 (if (eq gnus-keep-same-level 'best)
7138 (gnus-summary-best-group gnus-newsgroup-name)
7139 (gnus-summary-search-group backward gnus-keep-same-level))))
7140 ;; For some reason, the group window gets selected. We change
7142 (select-window (get-buffer-window (current-buffer)))
7143 ;; Select next unread newsgroup automagically.
7145 ((or (not gnus-auto-select-next)
7147 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7148 ((or (eq gnus-auto-select-next 'quietly)
7149 (and (eq gnus-auto-select-next 'slightly-quietly)
7151 (and (eq gnus-auto-select-next 'almost-quietly)
7152 (gnus-summary-last-article-p)))
7154 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7156 (gnus-message 7 "No more%s articles (%s)..."
7157 (if unread " unread" "")
7158 (if group (concat "selecting " group)
7160 (gnus-summary-next-group nil group backward)))
7162 (when (gnus-key-press-event-p last-input-event)
7163 (gnus-summary-walk-group-buffer
7164 gnus-newsgroup-name cmd unread backward point))))))))
7166 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7167 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7168 (?\C-p (gnus-group-prev-unread-group 1))))
7169 (cursor-in-echo-area t)
7170 keve key group ended prompt)
7172 (set-buffer gnus-group-buffer)
7175 (if (eq gnus-keep-same-level 'best)
7176 (gnus-summary-best-group gnus-newsgroup-name)
7177 (gnus-summary-search-group backward gnus-keep-same-level))))
7181 "No more%s articles%s " (if unread " unread" "")
7183 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7184 (format " (Type %s for %s [%s])"
7185 (single-key-description cmd) group
7186 (gnus-group-unread group))
7187 (format " (Type %s to exit %s)"
7188 (single-key-description cmd)
7189 gnus-newsgroup-name))))
7190 ;; Confirm auto selection.
7191 (setq key (car (setq keve (gnus-read-event-char prompt)))
7194 ((assq key keystrokes)
7195 (let ((obuf (current-buffer)))
7196 (switch-to-buffer gnus-group-buffer)
7198 (gnus-group-jump-to-group group))
7199 (eval (cadr (assq key keystrokes)))
7200 (setq group (gnus-group-group-name))
7201 (switch-to-buffer obuf))
7205 (gnus-ephemeral-group-p gnus-newsgroup-name))
7207 (gnus-summary-next-group nil group backward)))
7209 (push (cdr keve) unread-command-events))))))
7211 (defun gnus-summary-next-unread-article ()
7212 "Select unread article after current one."
7214 (gnus-summary-next-article
7215 (or (not (eq gnus-summary-goto-unread 'never))
7216 (gnus-summary-last-article-p (gnus-summary-article-number)))
7217 (and gnus-auto-select-same
7218 (gnus-summary-article-subject))))
7220 (defun gnus-summary-prev-article (&optional unread subject)
7221 "Select the article after the current one.
7222 If UNREAD is non-nil, only unread articles are selected."
7224 (gnus-summary-next-article unread subject t))
7226 (defun gnus-summary-prev-unread-article ()
7227 "Select unread article before current one."
7229 (gnus-summary-prev-article
7230 (or (not (eq gnus-summary-goto-unread 'never))
7231 (gnus-summary-first-article-p (gnus-summary-article-number)))
7232 (and gnus-auto-select-same
7233 (gnus-summary-article-subject))))
7235 (defun gnus-summary-next-page (&optional lines circular stop)
7236 "Show next page of the selected article.
7237 If at the end of the current article, select the next article.
7238 LINES says how many lines should be scrolled up.
7240 If CIRCULAR is non-nil, go to the start of the article instead of
7241 selecting the next article when reaching the end of the current
7244 If STOP is non-nil, just stop when reaching the end of the message.
7246 Also see the variable `gnus-article-skip-boring'."
7248 (setq gnus-summary-buffer (current-buffer))
7249 (gnus-set-global-variables)
7250 (let ((article (gnus-summary-article-number))
7251 (article-window (get-buffer-window gnus-article-buffer t))
7253 ;; If the buffer is empty, we have no article.
7255 (error "No article to select"))
7256 (gnus-configure-windows 'article)
7257 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7258 (if (and (eq gnus-summary-goto-unread 'never)
7259 (not (gnus-summary-last-article-p article)))
7260 (gnus-summary-next-article)
7261 (gnus-summary-next-unread-article))
7262 (if (or (null gnus-current-article)
7263 (null gnus-article-current)
7264 (/= article (cdr gnus-article-current))
7265 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7266 ;; Selected subject is different from current article's.
7267 (gnus-summary-display-article article)
7268 (when article-window
7269 (gnus-eval-in-buffer-window gnus-article-buffer
7270 (setq endp (or (gnus-article-next-page lines)
7271 (gnus-article-only-boring-p))))
7274 (gnus-message 3 "End of message"))
7276 (gnus-summary-beginning-of-article))
7278 (gnus-message 3 "End of message"))
7280 (if (and (eq gnus-summary-goto-unread 'never)
7281 (not (gnus-summary-last-article-p article)))
7282 (gnus-summary-next-article)
7283 (gnus-summary-next-unread-article))))))))
7284 (gnus-summary-recenter)
7285 (gnus-summary-position-point)))
7287 (defun gnus-summary-prev-page (&optional lines move)
7288 "Show previous page of selected article.
7289 Argument LINES specifies lines to be scrolled down.
7290 If MOVE, move to the previous unread article if point is at
7291 the beginning of the buffer."
7293 (let ((article (gnus-summary-article-number))
7294 (article-window (get-buffer-window gnus-article-buffer t))
7296 (gnus-configure-windows 'article)
7297 (if (or (null gnus-current-article)
7298 (null gnus-article-current)
7299 (/= article (cdr gnus-article-current))
7300 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7301 ;; Selected subject is different from current article's.
7302 (gnus-summary-display-article article)
7303 (gnus-summary-recenter)
7304 (when article-window
7305 (gnus-eval-in-buffer-window gnus-article-buffer
7306 (setq endp (gnus-article-prev-page lines)))
7307 (when (and move endp)
7309 (gnus-message 3 "Beginning of message"))
7311 (if (and (eq gnus-summary-goto-unread 'never)
7312 (not (gnus-summary-first-article-p article)))
7313 (gnus-summary-prev-article)
7314 (gnus-summary-prev-unread-article))))))))
7315 (gnus-summary-position-point))
7317 (defun gnus-summary-prev-page-or-article (&optional lines)
7318 "Show previous page of selected article.
7319 Argument LINES specifies lines to be scrolled down.
7320 If at the beginning of the article, go to the next article."
7322 (gnus-summary-prev-page lines t))
7324 (defun gnus-summary-scroll-up (lines)
7325 "Scroll up (or down) one line current article.
7326 Argument LINES specifies lines to be scrolled up (or down if negative)."
7328 (gnus-configure-windows 'article)
7329 (gnus-summary-show-thread)
7330 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7331 (gnus-eval-in-buffer-window gnus-article-buffer
7333 (when (gnus-article-next-page lines)
7334 (gnus-message 3 "End of message")))
7336 (gnus-article-prev-page (- lines))))))
7337 (gnus-summary-recenter)
7338 (gnus-summary-position-point))
7340 (defun gnus-summary-scroll-down (lines)
7341 "Scroll down (or up) one line current article.
7342 Argument LINES specifies lines to be scrolled down (or up if negative)."
7344 (gnus-summary-scroll-up (- lines)))
7346 (defun gnus-summary-next-same-subject ()
7347 "Select next article which has the same subject as current one."
7349 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7351 (defun gnus-summary-prev-same-subject ()
7352 "Select previous article which has the same subject as current one."
7354 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7356 (defun gnus-summary-next-unread-same-subject ()
7357 "Select next unread article which has the same subject as current one."
7359 (gnus-summary-next-article t (gnus-summary-article-subject)))
7361 (defun gnus-summary-prev-unread-same-subject ()
7362 "Select previous unread article which has the same subject as current one."
7364 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7366 (defun gnus-summary-first-unread-article ()
7367 "Select the first unread article.
7368 Return nil if there are no unread articles."
7371 (when (gnus-summary-first-subject t)
7372 (gnus-summary-show-thread)
7373 (gnus-summary-first-subject t)
7374 (gnus-summary-display-article (gnus-summary-article-number)))
7375 (gnus-summary-position-point)))
7377 (defun gnus-summary-first-unread-subject ()
7378 "Place the point on the subject line of the first unread article.
7379 Return nil if there are no unread articles."
7382 (when (gnus-summary-first-subject t)
7383 (gnus-summary-show-thread)
7384 (gnus-summary-first-subject t))
7385 (gnus-summary-position-point)))
7387 (defun gnus-summary-first-unseen-subject ()
7388 "Place the point on the subject line of the first unseen article.
7389 Return nil if there are no unseen articles."
7392 (when (gnus-summary-first-subject nil nil t)
7393 (gnus-summary-show-thread)
7394 (gnus-summary-first-subject nil nil t))
7395 (gnus-summary-position-point)))
7397 (defun gnus-summary-first-unseen-or-unread-subject ()
7398 "Place the point on the subject line of the first unseen article or,
7399 if all article have been seen, on the subject line of the first unread
7403 (unless (when (gnus-summary-first-subject nil nil t)
7404 (gnus-summary-show-thread)
7405 (gnus-summary-first-subject nil nil t))
7406 (when (gnus-summary-first-subject t)
7407 (gnus-summary-show-thread)
7408 (gnus-summary-first-subject t)))
7409 (gnus-summary-position-point)))
7411 (defun gnus-summary-first-article ()
7412 "Select the first article.
7413 Return nil if there are no articles."
7416 (when (gnus-summary-first-subject)
7417 (gnus-summary-show-thread)
7418 (gnus-summary-first-subject)
7419 (gnus-summary-display-article (gnus-summary-article-number)))
7420 (gnus-summary-position-point)))
7422 (defun gnus-summary-best-unread-article (&optional arg)
7423 "Select the unread article with the highest score.
7424 If given a prefix argument, select the next unread article that has a
7425 score higher than the default score."
7427 (let ((article (if arg
7428 (gnus-summary-better-unread-subject)
7429 (gnus-summary-best-unread-subject))))
7431 (gnus-summary-goto-article article)
7432 (error "No unread articles"))))
7434 (defun gnus-summary-best-unread-subject ()
7435 "Select the unread subject with the highest score."
7437 (let ((best -1000000)
7438 (data gnus-newsgroup-data)
7441 (and (gnus-data-unread-p (car data))
7443 (gnus-summary-article-score (gnus-data-number (car data))))
7446 article (gnus-data-number (car data))))
7447 (setq data (cdr data)))
7449 (gnus-summary-goto-subject article))
7450 (gnus-summary-position-point)
7453 (defun gnus-summary-better-unread-subject ()
7454 "Select the first unread subject that has a score over the default score."
7456 (let ((data gnus-newsgroup-data)
7458 (while (and (setq article (gnus-data-number (car data)))
7459 (or (gnus-data-read-p (car data))
7460 (not (> (gnus-summary-article-score article)
7461 gnus-summary-default-score))))
7462 (setq data (cdr data)))
7464 (gnus-summary-goto-subject article))
7465 (gnus-summary-position-point)
7468 (defun gnus-summary-last-subject ()
7469 "Go to the last displayed subject line in the group."
7470 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7472 (gnus-summary-goto-subject article))))
7474 (defun gnus-summary-goto-article (article &optional all-headers force)
7475 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7476 If ALL-HEADERS is non-nil, no header lines are hidden.
7477 If FORCE, go to the article even if it isn't displayed. If FORCE
7478 is a number, it is the line the article is to be displayed on."
7482 "Article number or Message-ID: "
7483 (mapcar (lambda (number) (list (int-to-string number)))
7484 gnus-newsgroup-limit))
7488 (if (and (stringp article)
7489 (string-match "@\\|%40" article))
7490 (gnus-summary-refer-article article)
7491 (when (stringp article)
7492 (setq article (string-to-number article)))
7493 (if (gnus-summary-goto-subject article force)
7494 (gnus-summary-display-article article all-headers)
7495 (gnus-message 4 "Couldn't go to article %s" article) nil))
7496 (gnus-summary-position-point)))
7498 (defun gnus-summary-goto-last-article ()
7499 "Go to the previously read article."
7502 (when gnus-last-article
7503 (gnus-summary-goto-article gnus-last-article nil t))
7504 (gnus-summary-position-point)))
7506 (defun gnus-summary-pop-article (number)
7507 "Pop one article off the history and go to the previous.
7508 NUMBER articles will be popped off."
7511 (setq gnus-newsgroup-history
7512 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7514 (gnus-summary-goto-article (car to) nil t)
7515 (error "Article history empty")))
7516 (gnus-summary-position-point))
7518 ;; Summary commands and functions for limiting the summary buffer.
7520 (defun gnus-summary-limit-to-articles (n)
7521 "Limit the summary buffer to the next N articles.
7522 If not given a prefix, use the process marked articles instead."
7525 (let ((articles (gnus-summary-work-articles n)))
7526 (setq gnus-newsgroup-processable nil)
7527 (gnus-summary-limit articles))
7528 (gnus-summary-position-point)))
7530 (defun gnus-summary-pop-limit (&optional total)
7531 "Restore the previous limit.
7532 If given a prefix, remove all limits."
7535 (setq gnus-newsgroup-limits
7536 (list (mapcar (lambda (h) (mail-header-number h))
7537 gnus-newsgroup-headers))))
7538 (unless gnus-newsgroup-limits
7539 (error "No limit to pop"))
7541 (gnus-summary-limit nil 'pop)
7542 (gnus-summary-position-point)))
7544 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7545 "Limit the summary buffer to articles that have subjects that match a regexp.
7546 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7548 (list (read-string (if current-prefix-arg
7549 "Exclude subject (regexp): "
7550 "Limit to subject (regexp): "))
7551 nil current-prefix-arg))
7553 (setq header "subject"))
7554 (when (not (equal "" subject))
7556 (let ((articles (gnus-summary-find-matching
7557 (or header "subject") subject 'all nil nil
7560 (error "Found no matches for \"%s\"" subject))
7561 (gnus-summary-limit articles))
7562 (gnus-summary-position-point))))
7564 (defun gnus-summary-limit-to-author (from &optional not-matching)
7565 "Limit the summary buffer to articles that have authors that match a regexp.
7566 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7568 (list (read-string (if current-prefix-arg
7569 "Exclude author (regexp): "
7570 "Limit to author (regexp): "))
7571 current-prefix-arg))
7572 (gnus-summary-limit-to-subject from "from" not-matching))
7574 (defun gnus-summary-limit-to-age (age &optional younger-p)
7575 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7576 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7577 articles that are younger than AGE days."
7579 (let ((younger current-prefix-arg)
7582 (while (not days-got)
7583 (setq days (if younger
7584 (read-string "Limit to articles younger than (in days, older when negative): ")
7586 "Limit to articles older than (in days, younger when negative): ")))
7587 (when (> (length days) 0)
7588 (setq days (read days)))
7593 (setq younger (not younger))
7594 (setq days (* days -1))))
7595 (message "Please enter a number.")
7597 (list days younger)))
7599 (let ((data gnus-newsgroup-data)
7600 (cutoff (days-to-time age))
7601 articles d date is-younger)
7602 (while (setq d (pop data))
7603 (when (and (vectorp (gnus-data-header d))
7604 (setq date (mail-header-date (gnus-data-header d))))
7605 (setq is-younger (time-less-p
7606 (time-since (condition-case ()
7613 (push (gnus-data-number d) articles))))
7614 (gnus-summary-limit (nreverse articles)))
7615 (gnus-summary-position-point)))
7617 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7618 "Limit the summary buffer to articles that match an 'extra' header."
7622 (gnus-completing-read-with-default
7623 (symbol-name (car gnus-extra-headers))
7624 (if current-prefix-arg
7625 "Exclude extra header:"
7626 "Limit extra header:")
7628 (cons (symbol-name x) x))
7633 (read-string (format "%s header %s (regexp): "
7634 (if current-prefix-arg "Exclude" "Limit to")
7636 current-prefix-arg)))
7637 (when (not (equal "" regexp))
7639 (let ((articles (gnus-summary-find-matching
7640 (cons 'extra header) regexp 'all nil nil
7643 (error "Found no matches for \"%s\"" regexp))
7644 (gnus-summary-limit articles))
7645 (gnus-summary-position-point))))
7647 (defun gnus-summary-limit-to-display-predicate ()
7648 "Limit the summary buffer to the predicated in the `display' group parameter."
7650 (unless gnus-newsgroup-display
7651 (error "There is no `display' group parameter"))
7653 (dolist (number gnus-newsgroup-articles)
7654 (when (funcall gnus-newsgroup-display)
7655 (push number articles)))
7656 (gnus-summary-limit articles))
7657 (gnus-summary-position-point))
7659 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7661 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7663 (defun gnus-summary-limit-to-unread (&optional all)
7664 "Limit the summary buffer to articles that are not marked as read.
7665 If ALL is non-nil, limit strictly to unread articles."
7668 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7669 (gnus-summary-limit-to-marks
7670 ;; Concat all the marks that say that an article is read and have
7672 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7673 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7674 gnus-low-score-mark gnus-expirable-mark
7675 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7676 gnus-duplicate-mark gnus-souped-mark)
7679 (defun gnus-summary-limit-to-replied (&optional unreplied)
7680 "Limit the summary buffer to replied articles.
7681 If UNREPLIED (the prefix), limit to unreplied articles."
7685 (gnus-set-difference gnus-newsgroup-articles
7686 gnus-newsgroup-replied))
7687 (gnus-summary-limit gnus-newsgroup-replied))
7688 (gnus-summary-position-point))
7690 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7691 (make-obsolete 'gnus-summary-delete-marked-with
7692 'gnus-summary-limit-exclude-marks)
7694 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7695 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7696 If REVERSE, limit the summary buffer to articles that are marked
7697 with MARKS. MARKS can either be a string of marks or a list of marks.
7698 Returns how many articles were removed."
7699 (interactive "sMarks: ")
7700 (gnus-summary-limit-to-marks marks t))
7702 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7703 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7704 If REVERSE (the prefix), limit the summary buffer to articles that are
7705 not marked with MARKS. MARKS can either be a string of marks or a
7707 Returns how many articles were removed."
7708 (interactive "sMarks: \nP")
7710 (let ((data gnus-newsgroup-data)
7711 (marks (if (listp marks) marks
7712 (append marks nil))) ; Transform to list.
7715 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7716 (memq (gnus-data-mark (car data)) marks))
7717 (push (gnus-data-number (car data)) articles))
7718 (setq data (cdr data)))
7719 (gnus-summary-limit articles))
7720 (gnus-summary-position-point)))
7722 (defun gnus-summary-limit-to-score (score)
7723 "Limit to articles with score at or above SCORE."
7724 (interactive "NLimit to articles with score of at least: ")
7725 (let ((data gnus-newsgroup-data)
7728 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7730 (push (gnus-data-number (car data)) articles))
7731 (setq data (cdr data)))
7733 (gnus-summary-limit articles)
7734 (gnus-summary-position-point))))
7736 (defun gnus-summary-limit-to-unseen ()
7737 "Limit to unseen articles."
7740 (gnus-summary-limit gnus-newsgroup-unseen)
7741 (gnus-summary-position-point)))
7743 (defun gnus-summary-limit-include-thread (id)
7744 "Display all the hidden articles that is in the thread with ID in it.
7745 When called interactively, ID is the Message-ID of the current
7747 (interactive (list (mail-header-id (gnus-summary-article-header))))
7748 (let ((articles (gnus-articles-in-thread
7749 (gnus-id-to-thread (gnus-root-id id)))))
7751 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7752 (gnus-summary-limit-include-matching-articles
7754 (regexp-quote (gnus-simplify-subject-re
7755 (mail-header-subject (gnus-id-to-header id)))))
7756 (gnus-summary-position-point))))
7758 (defun gnus-summary-limit-include-matching-articles (header regexp)
7759 "Display all the hidden articles that have HEADERs that match REGEXP."
7760 (interactive (list (read-string "Match on header: ")
7761 (read-string "Regexp: ")))
7762 (let ((articles (gnus-find-matching-articles header regexp)))
7764 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7765 (gnus-summary-position-point))))
7767 (defun gnus-summary-insert-dormant-articles ()
7768 "Insert all the dormant articles for this group into the current buffer."
7770 (let ((gnus-verbose (max 6 gnus-verbose)))
7771 (if (not gnus-newsgroup-dormant)
7772 (gnus-message 3 "No cached articles for this group")
7773 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7775 (defun gnus-summary-limit-include-dormant ()
7776 "Display all the hidden articles that are marked as dormant.
7777 Note that this command only works on a subset of the articles currently
7778 fetched for this group."
7780 (unless gnus-newsgroup-dormant
7781 (error "There are no dormant articles in this group"))
7783 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7784 (gnus-summary-position-point)))
7786 (defun gnus-summary-limit-exclude-dormant ()
7787 "Hide all dormant articles."
7790 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7791 (gnus-summary-position-point)))
7793 (defun gnus-summary-limit-exclude-childless-dormant ()
7794 "Hide all dormant articles that have no children."
7796 (let ((data (gnus-data-list t))
7797 articles d children)
7798 ;; Find all articles that are either not dormant or have
7800 (while (setq d (pop data))
7801 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7803 (gnus-article-children (gnus-data-number d)))
7806 (when (memq (car children) articles)
7811 (push (gnus-data-number d) articles)))
7814 (gnus-summary-limit articles)
7815 (gnus-summary-position-point))))
7817 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7818 "Mark all unread excluded articles as read.
7819 If ALL, mark even excluded ticked and dormants as read."
7821 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7822 (let ((articles (gnus-sorted-ndifference
7824 (mapcar (lambda (h) (mail-header-number h))
7825 gnus-newsgroup-headers)
7827 gnus-newsgroup-limit))
7829 (setq gnus-newsgroup-unreads
7830 (gnus-sorted-intersection gnus-newsgroup-unreads
7831 gnus-newsgroup-limit))
7833 (setq gnus-newsgroup-dormant nil
7834 gnus-newsgroup-marked nil
7835 gnus-newsgroup-reads
7837 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7838 gnus-newsgroup-reads))
7839 (while (setq article (pop articles))
7840 (unless (or (memq article gnus-newsgroup-dormant)
7841 (memq article gnus-newsgroup-marked))
7842 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7844 (defun gnus-summary-limit (articles &optional pop)
7846 ;; We pop the previous limit off the stack and use that.
7847 (setq articles (car gnus-newsgroup-limits)
7848 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7849 ;; We use the new limit, so we push the old limit on the stack.
7850 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7852 (setq gnus-newsgroup-limit articles)
7853 (let ((total (length gnus-newsgroup-data))
7854 (data (gnus-data-find-list (gnus-summary-article-number)))
7855 (gnus-summary-mark-below nil) ; Inhibit this.
7857 ;; This will do all the work of generating the new summary buffer
7858 ;; according to the new limit.
7859 (gnus-summary-prepare)
7860 ;; Hide any threads, possibly.
7861 (gnus-summary-maybe-hide-threads)
7862 ;; Try to return to the article you were at, or one in the
7865 ;; We try to find some article after the current one.
7867 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7870 (setq data (cdr data))))
7872 ;; If there is no data, that means that we were after the last
7873 ;; article. The same goes when we can't find any articles
7874 ;; after the current one.
7875 (goto-char (point-max))
7876 (gnus-summary-find-prev))
7877 (gnus-set-mode-line 'summary)
7878 ;; We return how many articles were removed from the summary
7879 ;; buffer as a result of the new limit.
7880 (- total (length gnus-newsgroup-data))))
7882 (defsubst gnus-invisible-cut-children (threads)
7885 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7890 (defsubst gnus-cut-thread (thread)
7891 "Go forwards in the thread until we find an article that we want to display."
7892 (when (or (eq gnus-fetch-old-headers 'some)
7893 (eq gnus-fetch-old-headers 'invisible)
7894 (numberp gnus-fetch-old-headers)
7895 (eq gnus-build-sparse-threads 'some)
7896 (eq gnus-build-sparse-threads 'more))
7897 ;; Deal with old-fetched headers and sparse threads.
7901 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7902 (gnus-summary-article-ancient-p
7903 (mail-header-number (car thread))))
7904 (if (or (<= (length (cdr thread)) 1)
7905 (eq gnus-fetch-old-headers 'invisible))
7906 (setq gnus-newsgroup-limit
7907 (delq (mail-header-number (car thread))
7908 gnus-newsgroup-limit)
7909 thread (cadr thread))
7910 (when (gnus-invisible-cut-children (cdr thread))
7911 (let ((th (cdr thread)))
7913 (if (memq (mail-header-number (caar th))
7914 gnus-newsgroup-limit)
7915 (setq thread (car th)
7917 (setq th (cdr th))))))))))
7920 (defun gnus-cut-threads (threads)
7921 "Cut off all uninteresting articles from the beginning of THREADS."
7922 (when (or (eq gnus-fetch-old-headers 'some)
7923 (eq gnus-fetch-old-headers 'invisible)
7924 (numberp gnus-fetch-old-headers)
7925 (eq gnus-build-sparse-threads 'some)
7926 (eq gnus-build-sparse-threads 'more))
7929 (setcar th (gnus-cut-thread (car th)))
7930 (setq th (cdr th)))))
7931 ;; Remove nixed out threads.
7934 (defun gnus-summary-initial-limit (&optional show-if-empty)
7935 "Figure out what the initial limit is supposed to be on group entry.
7936 This entails weeding out unwanted dormants, low-scored articles,
7937 fetch-old-headers verbiage, and so on."
7938 ;; Most groups have nothing to remove.
7939 (if (or gnus-inhibit-limiting
7940 (and (null gnus-newsgroup-dormant)
7941 (eq gnus-newsgroup-display 'gnus-not-ignore)
7942 (not (eq gnus-fetch-old-headers 'some))
7943 (not (numberp gnus-fetch-old-headers))
7944 (not (eq gnus-fetch-old-headers 'invisible))
7945 (null gnus-summary-expunge-below)
7946 (not (eq gnus-build-sparse-threads 'some))
7947 (not (eq gnus-build-sparse-threads 'more))
7948 (null gnus-thread-expunge-below)
7949 (not gnus-use-nocem)))
7951 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7952 (setq gnus-newsgroup-limit nil)
7955 (unless (car (symbol-value node))
7956 ;; These threads have no parents -- they are roots.
7957 (let ((nodes (cdr (symbol-value node)))
7960 (if (and gnus-thread-expunge-below
7961 (< (gnus-thread-total-score (car nodes))
7962 gnus-thread-expunge-below))
7963 (gnus-expunge-thread (pop nodes))
7964 (setq thread (pop nodes))
7965 (gnus-summary-limit-children thread))))))
7966 gnus-newsgroup-dependencies)
7967 ;; If this limitation resulted in an empty group, we might
7968 ;; pop the previous limit and use it instead.
7969 (when (and (not gnus-newsgroup-limit)
7971 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7972 gnus-newsgroup-limit))
7974 (defun gnus-summary-limit-children (thread)
7975 "Return 1 if this subthread is visible and 0 if it is not."
7976 ;; First we get the number of visible children to this thread. This
7977 ;; is done by recursing down the thread using this function, so this
7978 ;; will really go down to a leaf article first, before slowly
7979 ;; working its way up towards the root.
7981 (let* ((max-lisp-eval-depth 5000)
7984 (apply '+ (mapcar 'gnus-summary-limit-children
7987 (number (mail-header-number (car thread)))
7990 (not (memq number gnus-newsgroup-marked))
7992 ;; If this article is dormant and has absolutely no visible
7993 ;; children, then this article isn't visible.
7994 (and (memq number gnus-newsgroup-dormant)
7996 ;; If this is "fetch-old-headered" and there is no
7997 ;; visible children, then we don't want this article.
7998 (and (or (eq gnus-fetch-old-headers 'some)
7999 (numberp gnus-fetch-old-headers))
8000 (gnus-summary-article-ancient-p number)
8002 ;; If this is "fetch-old-headered" and `invisible', then
8003 ;; we don't want this article.
8004 (and (eq gnus-fetch-old-headers 'invisible)
8005 (gnus-summary-article-ancient-p number))
8006 ;; If this is a sparsely inserted article with no children,
8007 ;; we don't want it.
8008 (and (eq gnus-build-sparse-threads 'some)
8009 (gnus-summary-article-sparse-p number)
8011 ;; If we use expunging, and this article is really
8012 ;; low-scored, then we don't want this article.
8013 (when (and gnus-summary-expunge-below
8015 (or (cdr (assq number gnus-newsgroup-scored))
8016 gnus-summary-default-score))
8017 gnus-summary-expunge-below))
8018 ;; We increase the expunge-tally here, but that has
8019 ;; nothing to do with the limits, really.
8020 (incf gnus-newsgroup-expunged-tally)
8021 ;; We also mark as read here, if that's wanted.
8022 (when (and gnus-summary-mark-below
8023 (< score gnus-summary-mark-below))
8024 (setq gnus-newsgroup-unreads
8025 (delq number gnus-newsgroup-unreads))
8026 (if gnus-newsgroup-auto-expire
8027 (push number gnus-newsgroup-expirable)
8028 (push (cons number gnus-low-score-mark)
8029 gnus-newsgroup-reads)))
8031 ;; Do the `display' group parameter.
8032 (and gnus-newsgroup-display
8033 (not (funcall gnus-newsgroup-display)))
8034 ;; Check NoCeM things.
8035 (when (and gnus-use-nocem
8036 (gnus-nocem-unwanted-article-p
8037 (mail-header-id (car thread))))
8038 (setq gnus-newsgroup-unreads
8039 (delq number gnus-newsgroup-unreads))
8041 ;; Nope, invisible article.
8043 ;; Ok, this article is to be visible, so we add it to the limit
8045 (push number gnus-newsgroup-limit)
8048 (defun gnus-expunge-thread (thread)
8049 "Mark all articles in THREAD as read."
8050 (let* ((number (mail-header-number (car thread))))
8051 (incf gnus-newsgroup-expunged-tally)
8052 ;; We also mark as read here, if that's wanted.
8053 (setq gnus-newsgroup-unreads
8054 (delq number gnus-newsgroup-unreads))
8055 (if gnus-newsgroup-auto-expire
8056 (push number gnus-newsgroup-expirable)
8057 (push (cons number gnus-low-score-mark)
8058 gnus-newsgroup-reads)))
8059 ;; Go recursively through all subthreads.
8060 (mapcar 'gnus-expunge-thread (cdr thread)))
8062 ;; Summary article oriented commands
8064 (defun gnus-summary-refer-parent-article (n)
8065 "Refer parent article N times.
8066 If N is negative, go to ancestor -N instead.
8067 The difference between N and the number of articles fetched is returned."
8071 (when (not (natnump n))
8076 (setq header (gnus-summary-article-header))
8077 (if (and (eq (mail-header-number header)
8078 (cdr gnus-article-current))
8079 (equal gnus-newsgroup-name
8080 (car gnus-article-current)))
8081 ;; If we try to find the parent of the currently
8082 ;; displayed article, then we take a look at the actual
8083 ;; References header, since this is slightly more
8084 ;; reliable than the References field we got from the
8087 (set-buffer gnus-original-article-buffer)
8088 (nnheader-narrow-to-headers)
8089 (unless (setq ref (message-fetch-field "references"))
8090 (when (setq ref (message-fetch-field "in-reply-to"))
8091 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8094 ;; It's not the current article, so we take a bet on
8095 ;; the value we got from the server.
8096 (mail-header-references header)))
8098 (not (equal ref "")))
8099 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8100 (gnus-message 1 "Couldn't find parent"))
8101 (gnus-message 1 "No references in article %d"
8102 (gnus-summary-article-number))
8105 (gnus-summary-position-point)
8108 (defun gnus-summary-refer-references ()
8109 "Fetch all articles mentioned in the References header.
8110 Return the number of articles fetched."
8112 (let ((ref (mail-header-references (gnus-summary-article-header)))
8113 (current (gnus-summary-article-number))
8117 (error "No References in the current article")
8118 ;; For each Message-ID in the References header...
8119 (while (string-match "<[^>]*>" ref)
8121 ;; ... fetch that article.
8122 (gnus-summary-refer-article
8123 (prog1 (match-string 0 ref)
8124 (setq ref (substring ref (match-end 0))))))
8125 (gnus-summary-goto-subject current)
8126 (gnus-summary-position-point)
8129 (defun gnus-summary-refer-thread (&optional limit)
8130 "Fetch all articles in the current thread.
8131 If LIMIT (the numerical prefix), fetch that many old headers instead
8132 of what's specified by the `gnus-refer-thread-limit' variable."
8134 (let ((id (mail-header-id (gnus-summary-article-header)))
8135 (limit (if limit (prefix-numeric-value limit)
8136 gnus-refer-thread-limit)))
8137 (unless (eq gnus-fetch-old-headers 'invisible)
8138 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8139 ;; Retrieve the headers and read them in.
8140 (if (eq (if (numberp limit)
8141 (gnus-retrieve-headers
8143 (+ (mail-header-number
8144 (gnus-summary-article-header))
8146 gnus-newsgroup-end))
8147 gnus-newsgroup-name (* limit 2))
8148 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8150 (gnus-retrieve-headers (list gnus-newsgroup-end)
8151 gnus-newsgroup-name limit))
8153 (gnus-build-all-threads)
8154 (error "Can't fetch thread from back ends that don't support NOV"))
8155 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8156 (gnus-summary-limit-include-thread id)))
8158 (defun gnus-summary-refer-article (message-id)
8159 "Fetch an article specified by MESSAGE-ID."
8160 (interactive "sMessage-ID: ")
8161 (when (and (stringp message-id)
8162 (not (zerop (length message-id))))
8163 (setq message-id (gnus-replace-in-string message-id " " ""))
8164 ;; Construct the correct Message-ID if necessary.
8165 ;; Suggested by tale@pawl.rpi.edu.
8166 (unless (string-match "^<" message-id)
8167 (setq message-id (concat "<" message-id)))
8168 (unless (string-match ">$" message-id)
8169 (setq message-id (concat message-id ">")))
8170 ;; People often post MIDs from URLs, so unhex it:
8171 (unless (string-match "@" message-id)
8172 (setq message-id (gnus-url-unhex-string message-id)))
8173 (let* ((header (gnus-id-to-header message-id))
8175 (gnus-summary-article-sparse-p
8176 (mail-header-number header))
8177 (memq (mail-header-number header)
8178 gnus-newsgroup-limit)))
8181 ;; If the article is present in the buffer we just go to it.
8183 (or (not (gnus-summary-article-sparse-p
8184 (mail-header-number header)))
8187 (gnus-summary-goto-article
8188 (mail-header-number header) nil t)
8190 (gnus-summary-update-article (mail-header-number header)))))
8192 ;; We fetch the article.
8194 (dolist (gnus-override-method (gnus-refer-article-methods))
8195 (when (and (gnus-check-server gnus-override-method)
8196 ;; Fetch the header,
8197 (setq number (gnus-summary-insert-subject message-id)))
8198 ;; and display the article.
8199 (gnus-summary-select-article nil nil nil number)
8201 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8203 (defun gnus-refer-article-methods ()
8204 "Return a list of referable methods."
8206 ;; No method, so we default to current and native.
8207 ((null gnus-refer-article-method)
8208 (list gnus-current-select-method gnus-select-method))
8210 ((eq 'current gnus-refer-article-method)
8211 (list gnus-current-select-method))
8212 ;; List of select methods.
8213 ((not (and (symbolp (car gnus-refer-article-method))
8214 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8216 (dolist (method gnus-refer-article-method)
8217 (push (if (eq 'current method)
8218 gnus-current-select-method
8222 ;; One single select method.
8224 (list gnus-refer-article-method))))
8226 (defun gnus-summary-edit-parameters ()
8227 "Edit the group parameters of the current group."
8229 (gnus-group-edit-group gnus-newsgroup-name 'params))
8231 (defun gnus-summary-customize-parameters ()
8232 "Customize the group parameters of the current group."
8234 (gnus-group-customize gnus-newsgroup-name))
8236 (defun gnus-summary-enter-digest-group (&optional force)
8237 "Enter an nndoc group based on the current article.
8238 If FORCE, force a digest interpretation. If not, try
8239 to guess what the document format is."
8241 (let ((conf gnus-current-window-configuration))
8242 (save-window-excursion
8244 (let (gnus-article-prepare-hook
8245 gnus-display-mime-function
8247 (gnus-summary-select-article))))
8248 (setq gnus-current-window-configuration conf)
8249 (let* ((name (format "%s-%d"
8250 (gnus-group-prefixed-name
8251 gnus-newsgroup-name (list 'nndoc ""))
8253 (set-buffer gnus-summary-buffer)
8254 gnus-current-article)))
8255 (ogroup gnus-newsgroup-name)
8256 (params (append (gnus-info-params (gnus-get-info ogroup))
8257 (list (cons 'to-group ogroup))
8258 (list (cons 'parent-group ogroup))
8259 (list (cons 'save-article-group ogroup))))
8260 (case-fold-search t)
8261 (buf (current-buffer))
8264 (set-buffer gnus-original-article-buffer)
8265 ;; Have the digest group inherit the main mail address of
8266 ;; the parent article.
8267 (when (setq to-address (or (gnus-fetch-field "reply-to")
8268 (gnus-fetch-field "from")))
8269 (setq params (append
8270 (list (cons 'to-address
8271 (funcall gnus-decode-encoded-word-function
8273 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8274 (insert-buffer-substring gnus-original-article-buffer)
8275 ;; Remove lines that may lead nndoc to misinterpret the
8278 (goto-char (point-min))
8279 (or (search-forward "\n\n" nil t) (point)))
8280 (goto-char (point-min))
8281 (delete-matching-lines "^Path:\\|^From ")
8284 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8285 (gnus-newsgroup-ephemeral-ignored-charsets
8286 gnus-newsgroup-ignored-charsets))
8287 (gnus-group-read-ephemeral-group
8288 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8290 ,(if force 'mbox 'guess)))
8292 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8294 ;; Make all postings to this group go to the parent group.
8295 (nconc (gnus-info-params (gnus-get-info name))
8297 ;; Couldn't select this doc group.
8298 (switch-to-buffer buf)
8299 (gnus-set-global-variables)
8300 (gnus-configure-windows 'summary)
8301 (gnus-message 3 "Article couldn't be entered?"))
8302 (kill-buffer dig)))))
8304 (defun gnus-summary-read-document (n)
8305 "Open a new group based on the current article(s).
8306 This will allow you to read digests and other similar
8307 documents as newsgroups.
8308 Obeys the standard process/prefix convention."
8310 (let* ((articles (gnus-summary-work-articles n))
8311 (ogroup gnus-newsgroup-name)
8312 (params (append (gnus-info-params (gnus-get-info ogroup))
8313 (list (cons 'to-group ogroup))))
8314 article group egroup groups vgroup)
8315 (while (setq article (pop articles))
8316 (setq group (format "%s-%d" gnus-newsgroup-name article))
8317 (gnus-summary-remove-process-mark article)
8318 (when (gnus-summary-display-article article)
8321 (insert-buffer-substring gnus-original-article-buffer)
8322 ;; Remove some headers that may lead nndoc to make
8324 (message-narrow-to-head)
8325 (goto-char (point-min))
8326 (delete-matching-lines "^Path:\\|^From ")
8329 (gnus-group-read-ephemeral-group
8330 group `(nndoc ,group (nndoc-address ,(current-buffer))
8331 (nndoc-article-type guess))
8334 ;; Make all postings to this group go to the parent group.
8335 (nconc (gnus-info-params (gnus-get-info egroup))
8337 (push egroup groups))
8338 ;; Couldn't select this doc group.
8339 (gnus-error 3 "Article couldn't be entered"))))))
8340 ;; Now we have selected all the documents.
8343 (error "None of the articles could be interpreted as documents"))
8344 ((gnus-group-read-ephemeral-group
8345 (setq vgroup (format
8346 "nnvirtual:%s-%s" gnus-newsgroup-name
8347 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8348 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8350 (cons (current-buffer) 'summary)))
8352 (error "Couldn't select virtual nndoc group")))))
8354 (defun gnus-summary-isearch-article (&optional regexp-p)
8355 "Do incremental search forward on the current article.
8356 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8358 (gnus-summary-select-article)
8359 (gnus-configure-windows 'article)
8360 (gnus-eval-in-buffer-window gnus-article-buffer
8363 (isearch-forward regexp-p))))
8365 (defun gnus-summary-search-article-forward (regexp &optional backward)
8366 "Search for an article containing REGEXP forward.
8367 If BACKWARD, search backward instead."
8370 (format "Search article %s (regexp%s): "
8371 (if current-prefix-arg "backward" "forward")
8372 (if gnus-last-search-regexp
8373 (concat ", default " gnus-last-search-regexp)
8375 current-prefix-arg))
8376 (if (string-equal regexp "")
8377 (setq regexp (or gnus-last-search-regexp ""))
8378 (setq gnus-last-search-regexp regexp)
8379 (setq gnus-article-before-search gnus-current-article))
8380 ;; Intentionally set gnus-last-article.
8381 (setq gnus-last-article gnus-article-before-search)
8382 (let ((gnus-last-article gnus-last-article))
8383 (if (gnus-summary-search-article regexp backward)
8384 (gnus-summary-show-thread)
8385 (error "Search failed: \"%s\"" regexp))))
8387 (defun gnus-summary-search-article-backward (regexp)
8388 "Search for an article containing REGEXP backward."
8391 (format "Search article backward (regexp%s): "
8392 (if gnus-last-search-regexp
8393 (concat ", default " gnus-last-search-regexp)
8395 (gnus-summary-search-article-forward regexp 'backward))
8397 (defun gnus-summary-search-article (regexp &optional backward)
8398 "Search for an article containing REGEXP.
8399 Optional argument BACKWARD means do search for backward.
8400 `gnus-select-article-hook' is not called during the search."
8401 ;; We have to require this here to make sure that the following
8402 ;; dynamic binding isn't shadowed by autoloading.
8403 (require 'gnus-async)
8405 (let ((gnus-select-article-hook nil) ;Disable hook.
8406 (gnus-article-prepare-hook nil)
8407 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8408 (gnus-use-article-prefetch nil)
8409 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8410 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8412 (gnus-keep-backlog nil)
8413 (gnus-break-pages nil)
8414 (gnus-summary-display-arrow nil)
8415 (gnus-updated-mode-lines nil)
8416 (gnus-auto-center-summary nil)
8417 (sum (current-buffer))
8418 (gnus-display-mime-function nil)
8421 (gnus-save-hidden-threads
8422 (gnus-summary-select-article)
8423 (set-buffer gnus-article-buffer)
8424 (goto-char (window-point (get-buffer-window (current-buffer))))
8428 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8430 (re-search-backward regexp nil t)
8431 (re-search-forward regexp nil t))
8432 ;; We found the regexp.
8437 (get-buffer-window (current-buffer))
8441 (get-buffer-window (current-buffer))
8444 (setq point (point)))
8445 ;; We didn't find it, so we go to the next article.
8448 (while (eq found 'not)
8449 (if (not (if backward (gnus-summary-find-prev)
8450 (gnus-summary-find-next)))
8451 ;; No more articles.
8453 ;; Select the next article and adjust point.
8454 (unless (gnus-summary-article-sparse-p
8455 (gnus-summary-article-number))
8457 (gnus-summary-select-article)
8458 (set-buffer gnus-article-buffer)
8460 (goto-char (if backward (point-max) (point-min))))))))
8461 (gnus-message 7 ""))
8462 ;; Return whether we found the regexp.
8463 (when (eq found 'found)
8465 (gnus-summary-show-thread)
8466 (gnus-summary-goto-subject gnus-current-article)
8467 (gnus-summary-position-point)
8470 (defun gnus-find-matching-articles (header regexp)
8471 "Return a list of all articles that match REGEXP on HEADER.
8472 This search includes all articles in the current group that Gnus has
8473 fetched headers for, whether they are displayed or not."
8474 (let ((articles nil)
8475 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8476 (case-fold-search t))
8477 (dolist (header gnus-newsgroup-headers)
8478 (when (string-match regexp (funcall func header))
8479 (push (mail-header-number header) articles)))
8480 (nreverse articles)))
8482 (defun gnus-summary-find-matching (header regexp &optional backward unread
8483 not-case-fold not-matching)
8484 "Return a list of all articles that match REGEXP on HEADER.
8485 The search stars on the current article and goes forwards unless
8486 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8487 If UNREAD is non-nil, only unread articles will
8488 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8489 in the comparisons. If NOT-MATCHING, return a list of all articles that
8490 not match REGEXP on HEADER."
8491 (let ((case-fold-search (not not-case-fold))
8494 (if (eq (car header) 'extra)
8497 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8499 (error "%s is an invalid header" header))
8500 (unless (fboundp (intern (concat "mail-header-" header)))
8501 (error "%s is not a valid header" header))
8502 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8503 (dolist (d (if (eq backward 'all)
8505 (gnus-data-find-list
8506 (gnus-summary-article-number)
8507 (gnus-data-list backward))))
8508 (when (and (or (not unread) ; We want all articles...
8509 (gnus-data-unread-p d)) ; Or just unreads.
8510 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8514 (funcall func (gnus-data-header d))))
8515 (string-match regexp
8516 (funcall func (gnus-data-header d)))))
8517 (push (gnus-data-number d) articles))) ; Success!
8518 (nreverse articles)))
8520 (defun gnus-summary-execute-command (header regexp command &optional backward)
8521 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8522 If HEADER is an empty string (or nil), the match is done on the entire
8523 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8525 (list (let ((completion-ignore-case t))
8528 (mapcar (lambda (header) (list (format "%s" header)))
8530 '("Number" "Subject" "From" "Lines" "Date"
8531 "Message-ID" "Xref" "References" "Body")
8532 gnus-extra-headers))
8533 nil 'require-match))
8534 (read-string "Regexp: ")
8535 (read-key-sequence "Command: ")
8536 current-prefix-arg))
8537 (when (equal header "Body")
8539 ;; Hidden thread subtrees must be searched as well.
8540 (gnus-summary-show-all-threads)
8541 ;; We don't want to change current point nor window configuration.
8543 (save-window-excursion
8545 gnus-treat-strip-trailing-blank-lines
8546 gnus-treat-strip-leading-blank-lines
8547 gnus-treat-strip-multiple-blank-lines
8548 gnus-treat-hide-boring-headers
8549 gnus-treat-fold-newsgroups
8550 gnus-article-prepare-hook)
8551 (gnus-message 6 "Executing %s..." (key-description command))
8552 ;; We'd like to execute COMMAND interactively so as to give arguments.
8553 (gnus-execute header regexp
8554 `(call-interactively ',(key-binding command))
8556 (gnus-message 6 "Executing %s...done" (key-description command))))))
8558 (defun gnus-summary-beginning-of-article ()
8559 "Scroll the article back to the beginning."
8561 (gnus-summary-select-article)
8562 (gnus-configure-windows 'article)
8563 (gnus-eval-in-buffer-window gnus-article-buffer
8565 (goto-char (point-min))
8566 (when gnus-break-pages
8567 (gnus-narrow-to-page))))
8569 (defun gnus-summary-end-of-article ()
8570 "Scroll to the end of the article."
8572 (gnus-summary-select-article)
8573 (gnus-configure-windows 'article)
8574 (gnus-eval-in-buffer-window gnus-article-buffer
8576 (goto-char (point-max))
8578 (when gnus-break-pages
8579 (when (re-search-backward page-delimiter nil t)
8580 (narrow-to-region (match-end 0) (point-max)))
8581 (gnus-narrow-to-page))))
8583 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8584 "Truncate to LEN and quote all \"(\"'s in STRING."
8585 (gnus-replace-in-string (if (and len (> (length string) len))
8586 (substring string 0 len)
8590 (defun gnus-summary-print-article (&optional filename n)
8591 "Generate and print a PostScript image of the process-marked (mail) articles.
8593 If used interactively, print the current article if none are
8594 process-marked. With prefix arg, prompt the user for the name of the
8597 When used from Lisp, accept two optional args FILENAME and N. N means
8598 to print the next N articles. If N is negative, print the N previous
8599 articles. If N is nil and articles have been marked with the process
8600 mark, print these instead.
8602 If the optional first argument FILENAME is nil, send the image to the
8603 printer. If FILENAME is a string, save the PostScript image in a file with
8604 that name. If FILENAME is a number, prompt the user for the name of the file
8606 (interactive (list (ps-print-preprint current-prefix-arg)))
8607 (dolist (article (gnus-summary-work-articles n))
8608 (gnus-summary-select-article nil nil 'pseudo article)
8609 (gnus-eval-in-buffer-window gnus-article-buffer
8610 (gnus-print-buffer))
8611 (gnus-summary-remove-process-mark article))
8612 (ps-despool filename))
8614 (defun gnus-print-buffer ()
8615 (let ((buffer (generate-new-buffer " *print*")))
8618 (copy-to-buffer buffer (point-min) (point-max))
8620 (gnus-remove-text-with-property 'gnus-decoration)
8621 (when (gnus-visual-p 'article-highlight 'highlight)
8622 ;; Copy-to-buffer doesn't copy overlay. So redo
8624 (let ((gnus-article-buffer buffer))
8625 (gnus-article-highlight-citation t)
8626 (gnus-article-highlight-signature)
8627 (gnus-article-emphasize)
8628 (gnus-article-delete-invisible-text)))
8629 (let ((ps-left-header
8632 (gnus-summary-print-truncate-and-quote
8633 (mail-header-subject gnus-current-headers)
8636 (gnus-summary-print-truncate-and-quote
8637 (mail-header-from gnus-current-headers)
8641 "/pagenumberstring load"
8643 (mail-header-date gnus-current-headers) ")"))))
8644 (gnus-run-hooks 'gnus-ps-print-hook)
8647 (ps-spool-buffer-with-faces)
8648 (ps-spool-buffer)))))
8649 (kill-buffer buffer))))
8651 (defun gnus-summary-show-article (&optional arg)
8652 "Force redisplaying of the current article.
8653 If ARG (the prefix) is a number, show the article with the charset
8654 defined in `gnus-summary-show-article-charset-alist', or the charset
8656 If ARG (the prefix) is non-nil and not a number, show the raw article
8657 without any article massaging functions being run. Normally, the key
8658 strokes are `C-u g'."
8662 (gnus-summary-show-article t)
8663 (let ((gnus-newsgroup-charset
8664 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8665 (mm-read-coding-system
8666 "View as charset: " ;; actually it is coding system.
8668 (set-buffer gnus-article-buffer)
8669 (mm-detect-coding-region (point) (point-max))))))
8670 (gnus-newsgroup-ignored-charsets 'gnus-all))
8671 (gnus-summary-select-article nil 'force)
8672 (let ((deps gnus-newsgroup-dependencies)
8675 (set-buffer gnus-original-article-buffer)
8677 (message-narrow-to-head)
8678 (setq head (buffer-string))
8679 (goto-char (point-min))
8680 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8681 (goto-char (point-max))
8683 (setq lines (1- (count-lines (point) (point-max))))))
8685 (insert (format "211 %d Article retrieved.\n"
8686 (cdr gnus-article-current)))
8688 (if lines (insert (format "Lines: %d\n" lines)))
8690 (let ((nntp-server-buffer (current-buffer)))
8691 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8692 (gnus-data-set-header
8693 (gnus-data-find (cdr gnus-article-current))
8695 (gnus-summary-update-article-line
8696 (cdr gnus-article-current) header)
8697 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8698 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8700 ;; Select the article the normal way.
8701 (gnus-summary-select-article nil 'force))
8703 ;; We have to require this here to make sure that the following
8704 ;; dynamic binding isn't shadowed by autoloading.
8705 (require 'gnus-async)
8707 ;; Bind the article treatment functions to nil.
8708 (let ((gnus-have-all-headers t)
8709 gnus-article-prepare-hook
8710 gnus-article-decode-hook
8711 gnus-display-mime-function
8713 ;; Destroy any MIME parts.
8714 (when (gnus-buffer-live-p gnus-article-buffer)
8716 (set-buffer gnus-article-buffer)
8717 (mm-destroy-parts gnus-article-mime-handles)
8718 ;; Set it to nil for safety reason.
8719 (setq gnus-article-mime-handle-alist nil)
8720 (setq gnus-article-mime-handles nil)))
8721 (gnus-summary-select-article nil 'force))))
8722 (gnus-summary-goto-subject gnus-current-article)
8723 (gnus-summary-position-point))
8725 (defun gnus-summary-show-raw-article ()
8726 "Show the raw article without any article massaging functions being run."
8728 (gnus-summary-show-article t))
8730 (defun gnus-summary-verbose-headers (&optional arg)
8731 "Toggle permanent full header display.
8732 If ARG is a positive number, turn header display on.
8733 If ARG is a negative number, turn header display off."
8735 (setq gnus-show-all-headers
8736 (cond ((or (not (numberp arg))
8738 (not gnus-show-all-headers))
8741 (gnus-summary-show-article))
8743 (defun gnus-summary-toggle-header (&optional arg)
8744 "Show the headers if they are hidden, or hide them if they are shown.
8745 If ARG is a positive number, show the entire header.
8746 If ARG is a negative number, hide the unwanted header lines."
8748 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8749 (get-buffer-window gnus-article-buffer t))))
8750 (with-current-buffer gnus-article-buffer
8752 (article-narrow-to-head)
8753 (let* ((buffer-read-only nil)
8754 (inhibit-point-motion-hooks t)
8755 (hidden (if (numberp arg)
8757 (gnus-article-hidden-text-p 'headers)))
8759 (delete-region (point-min) (point-max))
8760 (with-current-buffer gnus-original-article-buffer
8761 (goto-char (setq s (point-min)))
8762 (setq e (if (search-forward "\n\n" nil t)
8765 (insert-buffer-substring gnus-original-article-buffer s e)
8766 (run-hooks 'gnus-article-decode-hook)
8768 (let ((gnus-treat-hide-headers nil)
8769 (gnus-treat-hide-boring-headers nil))
8770 (gnus-delete-wash-type 'headers)
8771 (gnus-treat-article 'head))
8772 (gnus-treat-article 'head))
8775 (set-window-start window (goto-char (point-min))))
8776 (if gnus-break-pages
8777 (gnus-narrow-to-page)
8778 (when (gnus-visual-p 'page-marker)
8779 (let ((buffer-read-only nil))
8780 (gnus-remove-text-with-property 'gnus-prev)
8781 (gnus-remove-text-with-property 'gnus-next))))
8782 (gnus-set-mode-line 'article)))))
8784 (defun gnus-summary-show-all-headers ()
8785 "Make all header lines visible."
8787 (gnus-summary-toggle-header 1))
8789 (defun gnus-summary-caesar-message (&optional arg)
8790 "Caesar rotate the current article by 13.
8791 The numerical prefix specifies how many places to rotate each letter
8794 (gnus-summary-select-article)
8795 (let ((mail-header-separator ""))
8796 (gnus-eval-in-buffer-window gnus-article-buffer
8799 (let ((start (window-start))
8801 (message-caesar-buffer-body arg)
8802 (set-window-start (get-buffer-window (current-buffer)) start))))))
8804 (autoload 'unmorse-region "morse"
8805 "Convert morse coded text in region to ordinary ASCII text."
8808 (defun gnus-summary-morse-message (&optional arg)
8809 "Morse decode the current article."
8811 (gnus-summary-select-article)
8812 (let ((mail-header-separator ""))
8813 (gnus-eval-in-buffer-window gnus-article-buffer
8817 (let ((pos (window-start))
8819 (goto-char (point-min))
8820 (when (message-goto-body)
8821 (gnus-narrow-to-body))
8822 (goto-char (point-min))
8823 (while (re-search-forward "·" (point-max) t)
8824 (replace-match "."))
8825 (unmorse-region (point-min) (point-max))
8827 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8829 (defun gnus-summary-stop-page-breaking ()
8830 "Stop page breaking in the current article."
8832 (gnus-summary-select-article)
8833 (gnus-eval-in-buffer-window gnus-article-buffer
8835 (when (gnus-visual-p 'page-marker)
8836 (let ((buffer-read-only nil))
8837 (gnus-remove-text-with-property 'gnus-prev)
8838 (gnus-remove-text-with-property 'gnus-next))
8839 (setq gnus-page-broken nil))))
8841 (defun gnus-summary-move-article (&optional n to-newsgroup
8842 select-method action)
8843 "Move the current article to a different newsgroup.
8844 If N is a positive number, move the N next articles.
8845 If N is a negative number, move the N previous articles.
8846 If N is nil and any articles have been marked with the process mark,
8847 move those articles instead.
8848 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8849 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8850 re-spool using this method.
8852 When called interactively with TO-NEWSGROUP being nil, the value of
8853 the variable `gnus-move-split-methods' is used for finding a default
8854 for the target newsgroup.
8856 For this function to work, both the current newsgroup and the
8857 newsgroup that you want to move to have to support the `request-move'
8858 and `request-accept' functions.
8860 ACTION can be either `move' (the default), `crosspost' or `copy'."
8863 (setq action 'move))
8864 ;; Check whether the source group supports the required functions.
8865 (cond ((and (eq action 'move)
8866 (not (gnus-check-backend-function
8867 'request-move-article gnus-newsgroup-name)))
8868 (error "The current group does not support article moving"))
8869 ((and (eq action 'crosspost)
8870 (not (gnus-check-backend-function
8871 'request-replace-article gnus-newsgroup-name)))
8872 (error "The current group does not support article editing")))
8873 (let ((articles (gnus-summary-work-articles n))
8874 (prefix (if (gnus-check-backend-function
8875 'request-move-article gnus-newsgroup-name)
8876 (gnus-group-real-prefix gnus-newsgroup-name)
8878 (names '((move "Move" "Moving")
8879 (copy "Copy" "Copying")
8880 (crosspost "Crosspost" "Crossposting")))
8881 (copy-buf (save-excursion
8882 (nnheader-set-temp-buffer " *copy article*")))
8883 art-group to-method new-xref article to-groups)
8884 (unless (assq action names)
8885 (error "Unknown action %s" action))
8886 ;; Read the newsgroup name.
8887 (when (and (not to-newsgroup)
8888 (not select-method))
8889 (if (and gnus-move-split-methods
8891 (and (memq gnus-current-article articles)
8892 (gnus-buffer-live-p gnus-original-article-buffer))))
8893 ;; When `gnus-move-split-methods' is non-nil, we have to
8894 ;; select an article to give `gnus-read-move-group-name' an
8895 ;; opportunity to suggest an appropriate default. However,
8896 ;; we needn't render or mark the article.
8897 (let ((gnus-display-mime-function nil)
8898 (gnus-article-prepare-hook nil)
8899 (gnus-mark-article-hook nil))
8900 (gnus-summary-select-article nil nil nil (car articles))))
8902 (gnus-read-move-group-name
8903 (cadr (assq action names))
8904 (symbol-value (intern (format "gnus-current-%s-group" action)))
8906 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8907 (setq to-method (or select-method
8908 (gnus-server-to-method
8909 (gnus-group-method to-newsgroup))))
8910 ;; Check the method we are to move this article to...
8911 (unless (gnus-check-backend-function
8912 'request-accept-article (car to-method))
8913 (error "%s does not support article copying" (car to-method)))
8914 (unless (gnus-check-server to-method)
8915 (error "Can't open server %s" (car to-method)))
8916 (gnus-message 6 "%s to %s: %s..."
8917 (caddr (assq action names))
8918 (or (car select-method) to-newsgroup) articles)
8920 (setq article (pop articles))
8924 ;; Move the article.
8926 ;; Remove this article from future suppression.
8927 (gnus-dup-unsuppress-article article)
8928 (gnus-request-move-article
8929 article ; Article to move
8930 gnus-newsgroup-name ; From newsgroup
8931 (nth 1 (gnus-find-method-for-group
8932 gnus-newsgroup-name)) ; Server
8933 (list 'gnus-request-accept-article
8934 to-newsgroup (list 'quote select-method)
8935 (not articles) t) ; Accept form
8936 (not articles))) ; Only save nov last time
8937 ;; Copy the article.
8940 (set-buffer copy-buf)
8941 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8942 (gnus-request-accept-article
8943 to-newsgroup select-method (not articles) t))))
8944 ;; Crosspost the article.
8945 ((eq action 'crosspost)
8946 (let ((xref (message-tokenize-header
8947 (mail-header-xref (gnus-summary-article-header article))
8949 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8950 ":" (number-to-string article)))
8952 (setq xref (list (system-name))))
8955 (mapconcat 'identity
8956 (delete "Xref:" (delete new-xref xref))
8960 (set-buffer copy-buf)
8961 ;; First put the article in the destination group.
8962 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8963 (when (consp (setq art-group
8964 (gnus-request-accept-article
8965 to-newsgroup select-method (not articles))))
8966 (setq new-xref (concat new-xref " " (car art-group)
8968 (number-to-string (cdr art-group))))
8969 ;; Now we have the new Xrefs header, so we insert
8970 ;; it and replace the new article.
8971 (nnheader-replace-header "Xref" new-xref)
8972 (gnus-request-replace-article
8973 (cdr art-group) to-newsgroup (current-buffer))
8977 (gnus-message 1 "Couldn't %s article %s: %s"
8978 (cadr (assq action names)) article
8979 (nnheader-get-report (car to-method))))
8980 ((eq art-group 'junk)
8981 (when (eq action 'move)
8982 (gnus-summary-mark-article article gnus-canceled-mark)
8983 (gnus-message 4 "Deleted article %s" article)
8984 ;; run the delete hook
8985 (run-hook-with-args 'gnus-summary-article-delete-hook
8988 (assoc article (gnus-data-list nil)))
8989 gnus-newsgroup-name nil
8992 (let* ((pto-group (gnus-group-prefixed-name
8993 (car art-group) to-method))
8994 (info (gnus-get-info pto-group))
8995 (to-group (gnus-info-group info))
8997 ;; Update the group that has been moved to.
8999 (memq action '(move copy)))
9000 (unless (member to-group to-groups)
9001 (push to-group to-groups))
9003 (unless (memq article gnus-newsgroup-unreads)
9004 (push 'read to-marks)
9006 info (gnus-add-to-range (gnus-info-read info)
9007 (list (cdr art-group)))))
9009 ;; See whether the article is to be put in the cache.
9010 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9011 gnus-article-mark-lists
9012 (delete '(expirable . expire)
9013 (copy-sequence gnus-article-mark-lists))))
9014 (to-article (cdr art-group)))
9016 ;; Enter the article into the cache in the new group,
9017 ;; if that is required.
9018 (when gnus-use-cache
9019 (gnus-cache-possibly-enter-article
9021 (memq article gnus-newsgroup-marked)
9022 (memq article gnus-newsgroup-dormant)
9023 (memq article gnus-newsgroup-unreads)))
9025 (when gnus-preserve-marks
9026 ;; Copy any marks over to the new group.
9027 (when (and (equal to-group gnus-newsgroup-name)
9028 (not (memq article gnus-newsgroup-unreads)))
9029 ;; Mark this article as read in this group.
9030 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9031 (setcdr (gnus-active to-group) to-article)
9032 (setcdr gnus-newsgroup-active to-article))
9035 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9036 (when (memq article (symbol-value
9037 (intern (format "gnus-newsgroup-%s"
9039 (push (cdar marks) to-marks)
9040 ;; If the other group is the same as this group,
9041 ;; then we have to add the mark to the list.
9042 (when (equal to-group gnus-newsgroup-name)
9043 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9046 (intern (format "gnus-newsgroup-%s"
9048 ;; Copy the marks to other group.
9049 (gnus-add-marked-articles
9050 to-group (cdar marks) (list to-article) info)))
9051 (setq marks (cdr marks)))
9053 (gnus-request-set-mark
9054 to-group (list (list (list to-article) 'add to-marks))))
9057 (concat "(gnus-group-set-info '"
9058 (gnus-prin1-to-string (gnus-get-info to-group))
9061 ;; Update the Xref header in this article to point to
9062 ;; the new crossposted article we have just created.
9063 (when (eq action 'crosspost)
9065 (set-buffer copy-buf)
9066 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9067 (nnheader-replace-header "Xref" new-xref)
9068 (gnus-request-replace-article
9069 article gnus-newsgroup-name (current-buffer))))
9071 ;; run the move/copy/crosspost/respool hook
9072 (run-hook-with-args 'gnus-summary-article-move-hook
9075 (assoc article (gnus-data-list nil)))
9080 ;;;!!!Why is this necessary?
9081 (set-buffer gnus-summary-buffer)
9083 (gnus-summary-goto-subject article)
9084 (when (eq action 'move)
9085 (gnus-summary-mark-article article gnus-canceled-mark))))
9086 (gnus-summary-remove-process-mark article))
9087 ;; Re-activate all groups that have been moved to.
9089 (set-buffer gnus-group-buffer)
9090 (let ((gnus-group-marked to-groups))
9091 (gnus-group-get-new-news-this-group nil t)))
9093 (gnus-kill-buffer copy-buf)
9094 (gnus-summary-position-point)
9095 (gnus-set-mode-line 'summary)))
9097 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9098 "Move the current article to a different newsgroup.
9099 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9100 When called interactively, if TO-NEWSGROUP is nil, use the value of
9101 the variable `gnus-move-split-methods' for finding a default target
9103 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9104 re-spool using this method."
9106 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9108 (defun gnus-summary-crosspost-article (&optional n)
9109 "Crosspost the current article to some other group."
9111 (gnus-summary-move-article n nil nil 'crosspost))
9113 (defcustom gnus-summary-respool-default-method nil
9114 "Default method type for respooling an article.
9115 If nil, use to the current newsgroup method."
9117 :group 'gnus-summary-mail)
9119 (defcustom gnus-summary-display-while-building nil
9120 "If non-nil, show and update the summary buffer as it's being built.
9121 If the value is t, update the buffer after every line is inserted. If
9122 the value is an integer (N), update the display every N lines."
9124 :type '(choice (const :tag "off" nil)
9126 (const :tag "frequently" t)))
9128 (defun gnus-summary-respool-article (&optional n method)
9129 "Respool the current article.
9130 The article will be squeezed through the mail spooling process again,
9131 which means that it will be put in some mail newsgroup or other
9132 depending on `nnmail-split-methods'.
9133 If N is a positive number, respool the N next articles.
9134 If N is a negative number, respool the N previous articles.
9135 If N is nil and any articles have been marked with the process mark,
9136 respool those articles instead.
9138 Respooling can be done both from mail groups and \"real\" newsgroups.
9139 In the former case, the articles in question will be moved from the
9140 current group into whatever groups they are destined to. In the
9141 latter case, they will be copied into the relevant groups."
9143 (list current-prefix-arg
9144 (let* ((methods (gnus-methods-using 'respool))
9146 (symbol-name (or gnus-summary-respool-default-method
9147 (car (gnus-find-method-for-group
9148 gnus-newsgroup-name)))))
9150 (gnus-completing-read-with-default
9151 methname "What backend do you want to use when respooling?"
9152 methods nil t nil 'gnus-mail-method-history))
9155 ((zerop (length (setq ms (gnus-servers-using-backend
9157 (list (intern method) ""))
9161 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9162 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9165 (error "No method given for respooling"))
9166 (if (assoc (symbol-name
9167 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9168 (gnus-methods-using 'respool))
9169 (gnus-summary-move-article n nil method)
9170 (gnus-summary-copy-article n nil method)))
9172 (defun gnus-summary-import-article (file &optional edit)
9173 "Import an arbitrary file into a mail newsgroup."
9174 (interactive "fImport file: \nP")
9175 (let ((group gnus-newsgroup-name)
9176 (now (current-time))
9177 atts lines group-art)
9178 (unless (gnus-check-backend-function 'request-accept-article group)
9179 (error "%s does not support article importing" group))
9180 (or (file-readable-p file)
9181 (not (file-regular-p file))
9182 (error "Can't read %s" file))
9184 (set-buffer (gnus-get-buffer-create " *import file*"))
9186 (nnheader-insert-file-contents file)
9187 (goto-char (point-min))
9188 (if (nnheader-article-p)
9190 (goto-char (point-min))
9191 (search-forward "\n\n" nil t)
9192 (narrow-to-region (point-min) (1- (point)))
9193 (goto-char (point-min))
9194 (unless (re-search-forward "^date:" nil t)
9195 (goto-char (point-max))
9196 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9197 ;; This doesn't look like an article, so we fudge some headers.
9198 (setq atts (file-attributes file)
9199 lines (count-lines (point-min) (point-max)))
9200 (insert "From: " (read-string "From: ") "\n"
9201 "Subject: " (read-string "Subject: ") "\n"
9202 "Date: " (message-make-date (nth 5 atts)) "\n"
9203 "Message-ID: " (message-make-message-id) "\n"
9204 "Lines: " (int-to-string lines) "\n"
9205 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9206 (setq group-art (gnus-request-accept-article group nil t))
9207 (kill-buffer (current-buffer)))
9208 (setq gnus-newsgroup-active (gnus-activate-group group))
9210 (gnus-summary-goto-article (cdr group-art) nil t)
9212 (gnus-summary-edit-article))))
9214 (defun gnus-summary-create-article ()
9215 "Create an article in a mail newsgroup."
9217 (let ((group gnus-newsgroup-name)
9218 (now (current-time))
9220 (unless (gnus-check-backend-function 'request-accept-article group)
9221 (error "%s does not support article importing" group))
9223 (set-buffer (gnus-get-buffer-create " *import file*"))
9225 (goto-char (point-min))
9226 ;; This doesn't look like an article, so we fudge some headers.
9227 (insert "From: " (read-string "From: ") "\n"
9228 "Subject: " (read-string "Subject: ") "\n"
9229 "Date: " (message-make-date now) "\n"
9230 "Message-ID: " (message-make-message-id) "\n")
9231 (setq group-art (gnus-request-accept-article group nil t))
9232 (kill-buffer (current-buffer)))
9233 (setq gnus-newsgroup-active (gnus-activate-group group))
9235 (gnus-summary-goto-article (cdr group-art) nil t)
9236 (gnus-summary-edit-article)))
9238 (defun gnus-summary-article-posted-p ()
9239 "Say whether the current (mail) article is available from news as well.
9240 This will be the case if the article has both been mailed and posted."
9242 (let ((id (mail-header-references (gnus-summary-article-header)))
9243 (gnus-override-method (car (gnus-refer-article-methods))))
9244 (if (gnus-request-head id "")
9245 (gnus-message 2 "The current message was found on %s"
9246 gnus-override-method)
9247 (gnus-message 2 "The current message couldn't be found on %s"
9248 gnus-override-method)
9251 (defun gnus-summary-expire-articles (&optional now)
9252 "Expire all articles that are marked as expirable in the current group."
9254 (when (and (not gnus-group-is-exiting-without-update-p)
9255 (gnus-check-backend-function
9256 'request-expire-articles gnus-newsgroup-name))
9257 ;; This backend supports expiry.
9258 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9259 (expirable (if total
9261 ;; We need to update the info for
9262 ;; this group for `gnus-list-of-read-articles'
9263 ;; to give us the right answer.
9264 (gnus-run-hooks 'gnus-exit-group-hook)
9265 (gnus-summary-update-info)
9266 (gnus-list-of-read-articles gnus-newsgroup-name))
9267 (setq gnus-newsgroup-expirable
9268 (sort gnus-newsgroup-expirable '<))))
9269 (expiry-wait (if now 'immediate
9270 (gnus-group-find-parameter
9271 gnus-newsgroup-name 'expiry-wait)))
9272 (nnmail-expiry-target
9273 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9274 nnmail-expiry-target))
9277 ;; There are expirable articles in this group, so we run them
9278 ;; through the expiry process.
9279 (gnus-message 6 "Expiring articles...")
9280 (unless (gnus-check-group gnus-newsgroup-name)
9281 (error "Can't open server for %s" gnus-newsgroup-name))
9282 ;; The list of articles that weren't expired is returned.
9285 (let ((nnmail-expiry-wait-function nil)
9286 (nnmail-expiry-wait expiry-wait))
9287 (setq es (gnus-request-expire-articles
9288 expirable gnus-newsgroup-name)))
9289 (setq es (gnus-request-expire-articles
9290 expirable gnus-newsgroup-name)))
9292 (setq gnus-newsgroup-expirable es))
9293 ;; We go through the old list of expirable, and mark all
9294 ;; really expired articles as nonexistent.
9295 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9296 (let ((gnus-use-cache nil))
9297 (dolist (article expirable)
9298 (when (and (not (memq article es))
9299 (gnus-data-find article))
9300 (gnus-summary-mark-article article gnus-canceled-mark)
9301 (run-hook-with-args 'gnus-summary-article-expire-hook
9304 (assoc article (gnus-data-list nil)))
9308 (gnus-message 6 "Expiring articles...done")))))
9310 (defun gnus-summary-expire-articles-now ()
9311 "Expunge all expirable articles in the current group.
9312 This means that *all* articles that are marked as expirable will be
9313 deleted forever, right now."
9315 (or gnus-expert-user
9317 "Are you really, really, really sure you want to delete all these messages? ")
9319 (gnus-summary-expire-articles t))
9321 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9322 (defun gnus-summary-delete-article (&optional n)
9323 "Delete the N next (mail) articles.
9324 This command actually deletes articles. This is not a marking
9325 command. The article will disappear forever from your life, never to
9328 If N is negative, delete backwards.
9329 If N is nil and articles have been marked with the process mark,
9330 delete these instead.
9332 If `gnus-novice-user' is non-nil you will be asked for
9333 confirmation before the articles are deleted."
9335 (unless (gnus-check-backend-function 'request-expire-articles
9336 gnus-newsgroup-name)
9337 (error "The current newsgroup does not support article deletion"))
9338 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9339 (error "Couldn't open server"))
9340 ;; Compute the list of articles to delete.
9341 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9342 (nnmail-expiry-target 'delete)
9344 (if (and gnus-novice-user
9345 (not (gnus-yes-or-no-p
9346 (format "Do you really want to delete %s forever? "
9347 (if (> (length articles) 1)
9348 (format "these %s articles" (length articles))
9351 ;; Delete the articles.
9352 (setq not-deleted (gnus-request-expire-articles
9353 articles gnus-newsgroup-name 'force))
9355 (gnus-summary-remove-process-mark (car articles))
9356 ;; The backend might not have been able to delete the article
9358 (unless (memq (car articles) not-deleted)
9359 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9360 (let* ((article (car articles))
9361 (id (mail-header-id (gnus-data-header
9362 (assoc article (gnus-data-list nil))))))
9363 (run-hook-with-args 'gnus-summary-article-delete-hook
9364 'delete id gnus-newsgroup-name nil
9366 (setq articles (cdr articles)))
9368 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9369 (gnus-summary-position-point)
9370 (gnus-set-mode-line 'summary)
9373 (defun gnus-summary-edit-article (&optional arg)
9374 "Edit the current article.
9375 This will have permanent effect only in mail groups.
9376 If ARG is nil, edit the decoded articles.
9377 If ARG is 1, edit the raw articles.
9378 If ARG is 2, edit the raw articles even in read-only groups.
9379 If ARG is 3, edit the articles with the current handles.
9380 Otherwise, allow editing of articles even in read-only
9383 (let (force raw current-handles)
9392 (setq current-handles
9393 (and (gnus-buffer-live-p gnus-article-buffer)
9394 (with-current-buffer gnus-article-buffer
9396 gnus-article-mime-handles
9397 (setq gnus-article-mime-handles nil))))))
9400 (when (and raw (not force)
9401 (member gnus-newsgroup-name '("nndraft:delayed"
9404 (error "Can't edit the raw article in group %s"
9405 gnus-newsgroup-name))
9407 (set-buffer gnus-summary-buffer)
9408 (let ((mail-parse-charset gnus-newsgroup-charset)
9409 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9410 (gnus-set-global-variables)
9411 (when (and (not force)
9412 (gnus-group-read-only-p))
9413 (error "The current newsgroup does not support article editing"))
9414 (gnus-summary-show-article t)
9415 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9416 (with-current-buffer gnus-article-buffer
9417 (mm-enable-multibyte)))
9418 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9420 (gnus-article-edit-article
9423 (let ((mbl mml-buffer-list))
9424 (setq mml-buffer-list nil)
9425 (mime-to-mml ,'current-handles)
9426 (let ((mbl1 mml-buffer-list))
9427 (setq mml-buffer-list mbl)
9428 (set (make-local-variable 'mml-buffer-list) mbl1))
9429 (gnus-make-local-hook 'kill-buffer-hook)
9430 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9431 `(lambda (no-highlight)
9432 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9433 (message-options message-options)
9434 (message-options-set-recipient)
9435 (mail-parse-ignored-charsets
9436 ',gnus-newsgroup-ignored-charsets))
9437 ,(if (not raw) '(progn
9439 (mml-destroy-buffers)
9440 (remove-hook 'kill-buffer-hook
9441 'mml-destroy-buffers t)
9442 (kill-local-variable 'mml-buffer-list)))
9443 (gnus-summary-edit-article-done
9444 ,(or (mail-header-references gnus-current-headers) "")
9445 ,(gnus-group-read-only-p)
9446 ,gnus-summary-buffer no-highlight))))))))
9448 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9450 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9452 "Make edits to the current article permanent."
9455 ;; The buffer restriction contains the entire article if it exists.
9456 (when (article-goto-body)
9457 (let ((lines (count-lines (point) (point-max)))
9458 (length (- (point-max) (point)))
9459 (case-fold-search t)
9460 (body (copy-marker (point))))
9461 (goto-char (point-min))
9462 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9463 (delete-region (match-beginning 1) (match-end 1))
9464 (insert (number-to-string length)))
9465 (goto-char (point-min))
9466 (when (re-search-forward
9467 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9468 (delete-region (match-beginning 1) (match-end 1))
9469 (insert (number-to-string length)))
9470 (goto-char (point-min))
9471 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9472 (delete-region (match-beginning 1) (match-end 1))
9473 (insert (number-to-string lines))))))
9474 ;; Replace the article.
9475 (let ((buf (current-buffer)))
9477 (insert-buffer-substring buf)
9479 (if (and (not read-only)
9480 (not (gnus-request-replace-article
9481 (cdr gnus-article-current) (car gnus-article-current)
9482 (current-buffer) t)))
9483 (error "Couldn't replace article")
9484 ;; Update the summary buffer.
9486 (equal (message-tokenize-header references " ")
9487 (message-tokenize-header
9488 (or (message-fetch-field "references") "") " ")))
9489 ;; We only have to update this line.
9492 (message-narrow-to-head)
9493 (let ((head (buffer-string))
9496 (insert (format "211 %d Article retrieved.\n"
9497 (cdr gnus-article-current)))
9500 (let ((nntp-server-buffer (current-buffer)))
9501 (setq header (car (gnus-get-newsgroup-headers
9504 (set-buffer gnus-summary-buffer)
9505 (gnus-data-set-header
9506 (gnus-data-find (cdr gnus-article-current))
9508 (gnus-summary-update-article-line
9509 (cdr gnus-article-current) header)
9510 (if (gnus-summary-goto-subject
9511 (cdr gnus-article-current) nil t)
9512 (gnus-summary-update-secondary-mark
9513 (cdr gnus-article-current))))))))
9515 (set-buffer (or buffer gnus-summary-buffer))
9516 (gnus-summary-update-article (cdr gnus-article-current))
9517 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9518 (gnus-summary-update-secondary-mark
9519 (cdr gnus-article-current))))
9520 ;; Prettify the article buffer again.
9521 (unless no-highlight
9523 (set-buffer gnus-article-buffer)
9524 ;;;!!! Fix this -- article should be rehighlighted.
9525 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9526 (set-buffer gnus-original-article-buffer)
9527 (gnus-request-article
9528 (cdr gnus-article-current)
9529 (car gnus-article-current) (current-buffer))))
9530 ;; Prettify the summary buffer line.
9531 (when (gnus-visual-p 'summary-highlight 'highlight)
9532 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9534 (defun gnus-summary-edit-wash (key)
9535 "Perform editing command KEY in the article buffer."
9539 (message "%s" (concat (this-command-keys) "- "))
9542 (gnus-summary-edit-article)
9543 (execute-kbd-macro (concat (this-command-keys) key))
9544 (gnus-article-edit-done))
9548 (defun gnus-summary-respool-query (&optional silent trace)
9549 "Query where the respool algorithm would put this article."
9551 (let (gnus-mark-article-hook)
9552 (gnus-summary-select-article)
9554 (set-buffer gnus-original-article-buffer)
9555 (let ((groups (nnmail-article-group 'identity trace)))
9558 (message "This message would go to %s"
9559 (mapconcat 'car groups ", "))
9560 (message "This message would go to no groups"))
9563 (defun gnus-summary-respool-trace ()
9564 "Trace where the respool algorithm would put this article.
9565 Display a buffer showing all fancy splitting patterns which matched."
9567 (gnus-summary-respool-query nil t))
9569 ;; Summary marking commands.
9571 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9572 "Mark articles which has the same subject as read, and then select the next.
9573 If UNMARK is positive, remove any kind of mark.
9574 If UNMARK is negative, tick articles."
9577 (setq unmark (prefix-numeric-value unmark)))
9579 (gnus-summary-mark-same-subject
9580 (gnus-summary-article-subject) unmark)))
9581 ;; Select next unread article. If auto-select-same mode, should
9582 ;; select the first unread article.
9583 (gnus-summary-next-article t (and gnus-auto-select-same
9584 (gnus-summary-article-subject)))
9585 (gnus-message 7 "%d article%s marked as %s"
9586 count (if (= count 1) " is" "s are")
9587 (if unmark "unread" "read"))))
9589 (defun gnus-summary-kill-same-subject (&optional unmark)
9590 "Mark articles which has the same subject as read.
9591 If UNMARK is positive, remove any kind of mark.
9592 If UNMARK is negative, tick articles."
9595 (setq unmark (prefix-numeric-value unmark)))
9597 (gnus-summary-mark-same-subject
9598 (gnus-summary-article-subject) unmark)))
9599 ;; If marked as read, go to next unread subject.
9601 ;; Go to next unread subject.
9602 (gnus-summary-next-subject 1 t))
9603 (gnus-message 7 "%d articles are marked as %s"
9604 count (if unmark "unread" "read"))))
9606 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9607 "Mark articles with same SUBJECT as read, and return marked number.
9608 If optional argument UNMARK is positive, remove any kinds of marks.
9609 If optional argument UNMARK is negative, mark articles as unread instead."
9613 ((null unmark) ; Mark as read.
9616 (gnus-summary-mark-article-as-read gnus-killed-mark)
9617 (gnus-summary-show-thread) t)
9618 (gnus-summary-find-subject subject))
9619 (setq count (1+ count))))
9620 ((> unmark 0) ; Tick.
9623 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9624 (gnus-summary-show-thread) t)
9625 (gnus-summary-find-subject subject))
9626 (setq count (1+ count))))
9627 (t ; Mark as unread.
9630 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9631 (gnus-summary-show-thread) t)
9632 (gnus-summary-find-subject subject))
9633 (setq count (1+ count)))))
9634 (gnus-set-mode-line 'summary)
9635 ;; Return the number of marked articles.
9638 (defun gnus-summary-mark-as-processable (n &optional unmark)
9639 "Set the process mark on the next N articles.
9640 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9641 the process mark instead. The difference between N and the actual
9642 number of articles marked is returned."
9644 (if (and (null n) (gnus-region-active-p))
9645 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9646 (setq n (prefix-numeric-value n))
9647 (let ((backward (< n 0))
9652 (gnus-summary-remove-process-mark
9653 (gnus-summary-article-number))
9654 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9655 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9658 (gnus-message 7 "No more articles"))
9659 (gnus-summary-recenter)
9660 (gnus-summary-position-point)
9663 (defun gnus-summary-unmark-as-processable (n)
9664 "Remove the process mark from the next N articles.
9665 If N is negative, unmark backward instead. The difference between N and
9666 the actual number of articles unmarked is returned."
9668 (gnus-summary-mark-as-processable n t))
9670 (defun gnus-summary-unmark-all-processable ()
9671 "Remove the process mark from all articles."
9674 (while gnus-newsgroup-processable
9675 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9676 (gnus-summary-position-point))
9678 (defun gnus-summary-add-mark (article type)
9679 "Mark ARTICLE with a mark of TYPE."
9680 (let ((vtype (car (assq type gnus-article-mark-lists)))
9683 (error "No such mark type: %s" type)
9684 (setq var (intern (format "gnus-newsgroup-%s" type)))
9685 (set var (cons article (symbol-value var)))
9686 (if (memq type '(processable cached replied forwarded recent saved))
9687 (gnus-summary-update-secondary-mark article)
9688 ;;; !!! This is bogus. We should find out what primary
9689 ;;; !!! mark we want to set.
9690 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9692 (defun gnus-summary-mark-as-expirable (n)
9693 "Mark N articles forward as expirable.
9694 If N is negative, mark backward instead. The difference between N and
9695 the actual number of articles marked is returned."
9697 (gnus-summary-mark-forward n gnus-expirable-mark))
9699 (defun gnus-summary-mark-as-spam (n)
9700 "Mark N articles forward as spam.
9701 If N is negative, mark backward instead. The difference between N and
9702 the actual number of articles marked is returned."
9704 (gnus-summary-mark-forward n gnus-spam-mark))
9706 (defun gnus-summary-mark-article-as-replied (article)
9707 "Mark ARTICLE as replied to and update the summary line.
9708 ARTICLE can also be a list of articles."
9709 (interactive (list (gnus-summary-article-number)))
9710 (let ((articles (if (listp article) article (list article))))
9711 (dolist (article articles)
9712 (unless (numberp article)
9713 (error "%s is not a number" article))
9714 (push article gnus-newsgroup-replied)
9715 (let ((buffer-read-only nil))
9716 (when (gnus-summary-goto-subject article nil t)
9717 (gnus-summary-update-secondary-mark article))))))
9719 (defun gnus-summary-mark-article-as-forwarded (article)
9720 "Mark ARTICLE as forwarded and update the summary line.
9721 ARTICLE can also be a list of articles."
9722 (let ((articles (if (listp article) article (list article))))
9723 (dolist (article articles)
9724 (push article gnus-newsgroup-forwarded)
9725 (let ((buffer-read-only nil))
9726 (when (gnus-summary-goto-subject article nil t)
9727 (gnus-summary-update-secondary-mark article))))))
9729 (defun gnus-summary-set-bookmark (article)
9730 "Set a bookmark in current article."
9731 (interactive (list (gnus-summary-article-number)))
9732 (when (or (not (get-buffer gnus-article-buffer))
9733 (not gnus-current-article)
9734 (not gnus-article-current)
9735 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9736 (error "No current article selected"))
9737 ;; Remove old bookmark, if one exists.
9738 (gnus-pull article gnus-newsgroup-bookmarks)
9739 ;; Set the new bookmark, which is on the form
9740 ;; (article-number . line-number-in-body).
9744 (set-buffer gnus-article-buffer)
9751 gnus-newsgroup-bookmarks)
9752 (gnus-message 6 "A bookmark has been added to the current article."))
9754 (defun gnus-summary-remove-bookmark (article)
9755 "Remove the bookmark from the current article."
9756 (interactive (list (gnus-summary-article-number)))
9757 ;; Remove old bookmark, if one exists.
9758 (if (not (assq article gnus-newsgroup-bookmarks))
9759 (gnus-message 6 "No bookmark in current article.")
9760 (gnus-pull article gnus-newsgroup-bookmarks)
9761 (gnus-message 6 "Removed bookmark.")))
9763 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9764 (defun gnus-summary-mark-as-dormant (n)
9765 "Mark N articles forward as dormant.
9766 If N is negative, mark backward instead. The difference between N and
9767 the actual number of articles marked is returned."
9769 (gnus-summary-mark-forward n gnus-dormant-mark))
9771 (defun gnus-summary-set-process-mark (article)
9772 "Set the process mark on ARTICLE and update the summary line."
9773 (setq gnus-newsgroup-processable
9775 (delq article gnus-newsgroup-processable)))
9776 (when (gnus-summary-goto-subject article)
9777 (gnus-summary-show-thread)
9778 (gnus-summary-goto-subject article)
9779 (gnus-summary-update-secondary-mark article)))
9781 (defun gnus-summary-remove-process-mark (article)
9782 "Remove the process mark from ARTICLE and update the summary line."
9783 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9784 (when (gnus-summary-goto-subject article)
9785 (gnus-summary-show-thread)
9786 (gnus-summary-goto-subject article)
9787 (gnus-summary-update-secondary-mark article)))
9789 (defun gnus-summary-set-saved-mark (article)
9790 "Set the process mark on ARTICLE and update the summary line."
9791 (push article gnus-newsgroup-saved)
9792 (when (gnus-summary-goto-subject article)
9793 (gnus-summary-update-secondary-mark article)))
9795 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9796 "Mark N articles as read forwards.
9797 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9798 The difference between N and the actual number of articles marked is
9800 If NO-EXPIRE, auto-expiry will be inhibited."
9802 (gnus-summary-show-thread)
9803 (let ((backward (< n 0))
9804 (gnus-summary-goto-unread
9805 (and gnus-summary-goto-unread
9806 (not (eq gnus-summary-goto-unread 'never))
9807 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9808 gnus-ticked-mark gnus-dormant-mark)))))
9810 (mark (or mark gnus-del-mark)))
9812 (gnus-summary-mark-article nil mark no-expire)
9813 (zerop (gnus-summary-next-subject
9815 (and gnus-summary-goto-unread
9816 (not (eq gnus-summary-goto-unread 'never)))
9820 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9821 (gnus-summary-recenter)
9822 (gnus-summary-position-point)
9823 (gnus-set-mode-line 'summary)
9826 (defun gnus-summary-mark-article-as-read (mark)
9827 "Mark the current article quickly as read with MARK."
9828 (let ((article (gnus-summary-article-number)))
9829 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9830 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9831 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9832 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9833 (push (cons article mark) gnus-newsgroup-reads)
9834 ;; Possibly remove from cache, if that is used.
9835 (when gnus-use-cache
9836 (gnus-cache-enter-remove-article article))
9837 ;; Allow the backend to change the mark.
9838 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9839 ;; Check for auto-expiry.
9840 (when (and gnus-newsgroup-auto-expire
9841 (memq mark gnus-auto-expirable-marks))
9842 (setq mark gnus-expirable-mark)
9843 ;; Let the backend know about the mark change.
9844 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9845 (push article gnus-newsgroup-expirable))
9846 ;; Set the mark in the buffer.
9847 (gnus-summary-update-mark mark 'unread)
9850 (defun gnus-summary-mark-article-as-unread (mark)
9851 "Mark the current article quickly as unread with MARK."
9852 (let* ((article (gnus-summary-article-number))
9853 (old-mark (gnus-summary-article-mark article)))
9854 ;; Allow the backend to change the mark.
9855 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9856 (if (eq mark old-mark)
9860 (gnus-error 1 "Can't mark negative article numbers")
9862 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9863 (setq gnus-newsgroup-spam-marked
9864 (delq article gnus-newsgroup-spam-marked))
9865 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9866 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9867 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9868 (cond ((= mark gnus-ticked-mark)
9869 (setq gnus-newsgroup-marked
9870 (gnus-add-to-sorted-list gnus-newsgroup-marked
9872 ((= mark gnus-spam-mark)
9873 (setq gnus-newsgroup-spam-marked
9874 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9876 ((= mark gnus-dormant-mark)
9877 (setq gnus-newsgroup-dormant
9878 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9881 (setq gnus-newsgroup-unreads
9882 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9884 (gnus-pull article gnus-newsgroup-reads)
9886 ;; See whether the article is to be put in the cache.
9888 (vectorp (gnus-summary-article-header article))
9890 (gnus-cache-possibly-enter-article
9891 gnus-newsgroup-name article
9892 (= mark gnus-ticked-mark)
9893 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9896 (gnus-summary-update-mark mark 'unread)
9899 (defun gnus-summary-mark-article (&optional article mark no-expire)
9900 "Mark ARTICLE with MARK. MARK can be any character.
9901 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9902 `??' (dormant) and `?E' (expirable).
9903 If MARK is nil, then the default character `?r' is used.
9904 If ARTICLE is nil, then the article on the current line will be
9906 If NO-EXPIRE, auto-expiry will be inhibited."
9907 ;; The mark might be a string.
9908 (when (stringp mark)
9909 (setq mark (aref mark 0)))
9910 ;; If no mark is given, then we check auto-expiring.
9912 (setq mark gnus-del-mark))
9913 (when (and (not no-expire)
9914 gnus-newsgroup-auto-expire
9915 (memq mark gnus-auto-expirable-marks))
9916 (setq mark gnus-expirable-mark))
9917 (let ((article (or article (gnus-summary-article-number)))
9918 (old-mark (gnus-summary-article-mark article)))
9919 ;; Allow the backend to change the mark.
9920 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9921 (if (eq mark old-mark)
9924 (error "No article on current line"))
9925 (if (not (if (or (= mark gnus-unread-mark)
9926 (= mark gnus-ticked-mark)
9927 (= mark gnus-spam-mark)
9928 (= mark gnus-dormant-mark))
9929 (gnus-mark-article-as-unread article mark)
9930 (gnus-mark-article-as-read article mark)))
9932 ;; See whether the article is to be put in the cache.
9934 (not (= mark gnus-canceled-mark))
9935 (vectorp (gnus-summary-article-header article))
9937 (gnus-cache-possibly-enter-article
9938 gnus-newsgroup-name article
9939 (= mark gnus-ticked-mark)
9940 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9942 (when (gnus-summary-goto-subject article nil t)
9943 (let ((buffer-read-only nil))
9944 (gnus-summary-show-thread)
9946 (gnus-summary-update-mark mark 'unread)
9949 (defun gnus-summary-update-secondary-mark (article)
9950 "Update the secondary (read, process, cache) mark."
9951 (gnus-summary-update-mark
9952 (cond ((memq article gnus-newsgroup-processable)
9954 ((memq article gnus-newsgroup-cached)
9956 ((memq article gnus-newsgroup-replied)
9958 ((memq article gnus-newsgroup-forwarded)
9959 gnus-forwarded-mark)
9960 ((memq article gnus-newsgroup-saved)
9962 ((memq article gnus-newsgroup-recent)
9964 ((memq article gnus-newsgroup-unseen)
9968 (when (gnus-visual-p 'summary-highlight 'highlight)
9969 (gnus-run-hooks 'gnus-summary-update-hook))
9972 (defun gnus-summary-update-download-mark (article)
9973 "Update the download mark."
9974 (gnus-summary-update-mark
9975 (cond ((memq article gnus-newsgroup-undownloaded)
9976 gnus-undownloaded-mark)
9977 (gnus-newsgroup-agentized
9978 gnus-downloaded-mark)
9982 (gnus-summary-update-line t)
9985 (defun gnus-summary-update-mark (mark type)
9986 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9987 (buffer-read-only nil))
9988 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
9990 (when (looking-at "\r")
9992 (when (<= (+ forward (point)) (point-max))
9993 ;; Go to the right position on the line.
9994 (goto-char (+ forward (point)))
9995 ;; Replace the old mark with the new mark.
9996 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9997 ;; Optionally update the marks by some user rule.
9998 (when (eq type 'unread)
10000 (gnus-data-find (gnus-summary-article-number)) mark)
10001 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10003 (defun gnus-mark-article-as-read (article &optional mark)
10004 "Enter ARTICLE in the pertinent lists and remove it from others."
10005 ;; Make the article expirable.
10006 (let ((mark (or mark gnus-del-mark)))
10007 (setq gnus-newsgroup-expirable
10008 (if (= mark gnus-expirable-mark)
10009 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10010 (delq article gnus-newsgroup-expirable)))
10011 ;; Remove from unread and marked lists.
10012 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10013 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10014 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10015 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10016 (push (cons article mark) gnus-newsgroup-reads)
10017 ;; Possibly remove from cache, if that is used.
10018 (when gnus-use-cache
10019 (gnus-cache-enter-remove-article article))
10022 (defun gnus-mark-article-as-unread (article &optional mark)
10023 "Enter ARTICLE in the pertinent lists and remove it from others."
10024 (let ((mark (or mark gnus-ticked-mark)))
10027 (gnus-error 1 "Can't mark negative article numbers")
10029 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10030 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10031 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10032 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10033 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10035 ;; Unsuppress duplicates?
10036 (when gnus-suppress-duplicates
10037 (gnus-dup-unsuppress-article article))
10039 (cond ((= mark gnus-ticked-mark)
10040 (setq gnus-newsgroup-marked
10041 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10042 ((= mark gnus-spam-mark)
10043 (setq gnus-newsgroup-spam-marked
10044 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10046 ((= mark gnus-dormant-mark)
10047 (setq gnus-newsgroup-dormant
10048 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10050 (setq gnus-newsgroup-unreads
10051 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10052 (gnus-pull article gnus-newsgroup-reads)
10055 (defalias 'gnus-summary-mark-as-unread-forward
10056 'gnus-summary-tick-article-forward)
10057 (make-obsolete 'gnus-summary-mark-as-unread-forward
10058 'gnus-summary-tick-article-forward)
10059 (defun gnus-summary-tick-article-forward (n)
10060 "Tick N articles forwards.
10061 If N is negative, tick backwards instead.
10062 The difference between N and the number of articles ticked is returned."
10064 (gnus-summary-mark-forward n gnus-ticked-mark))
10066 (defalias 'gnus-summary-mark-as-unread-backward
10067 'gnus-summary-tick-article-backward)
10068 (make-obsolete 'gnus-summary-mark-as-unread-backward
10069 'gnus-summary-tick-article-backward)
10070 (defun gnus-summary-tick-article-backward (n)
10071 "Tick N articles backwards.
10072 The difference between N and the number of articles ticked is returned."
10074 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10076 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10077 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10078 (defun gnus-summary-tick-article (&optional article clear-mark)
10079 "Mark current article as unread.
10080 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10081 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10083 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10084 gnus-ticked-mark)))
10086 (defun gnus-summary-mark-as-read-forward (n)
10087 "Mark N articles as read forwards.
10088 If N is negative, mark backwards instead.
10089 The difference between N and the actual number of articles marked is
10092 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10094 (defun gnus-summary-mark-as-read-backward (n)
10095 "Mark the N articles as read backwards.
10096 The difference between N and the actual number of articles marked is
10099 (gnus-summary-mark-forward
10100 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10102 (defun gnus-summary-mark-as-read (&optional article mark)
10103 "Mark current article as read.
10104 ARTICLE specifies the article to be marked as read.
10105 MARK specifies a string to be inserted at the beginning of the line."
10106 (gnus-summary-mark-article article mark))
10108 (defun gnus-summary-clear-mark-forward (n)
10109 "Clear marks from N articles forward.
10110 If N is negative, clear backward instead.
10111 The difference between N and the number of marks cleared is returned."
10113 (gnus-summary-mark-forward n gnus-unread-mark))
10115 (defun gnus-summary-clear-mark-backward (n)
10116 "Clear marks from N articles backward.
10117 The difference between N and the number of marks cleared is returned."
10119 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10121 (defun gnus-summary-mark-unread-as-read ()
10122 "Intended to be used by `gnus-summary-mark-article-hook'."
10123 (when (memq gnus-current-article gnus-newsgroup-unreads)
10124 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10126 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10127 "Intended to be used by `gnus-summary-mark-article-hook'."
10128 (let ((mark (gnus-summary-article-mark)))
10129 (when (or (gnus-unread-mark-p mark)
10130 (gnus-read-mark-p mark))
10131 (gnus-summary-mark-article gnus-current-article
10132 (or new-mark gnus-read-mark)))))
10134 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10135 "Intended to be used by `gnus-summary-mark-article-hook'."
10136 (let ((mark (gnus-summary-article-mark)))
10137 (when (or (gnus-unread-mark-p mark)
10138 (gnus-read-mark-p mark))
10139 (gnus-summary-mark-article (gnus-summary-article-number)
10140 (or new-mark gnus-read-mark)))))
10142 (defun gnus-summary-mark-unread-as-ticked ()
10143 "Intended to be used by `gnus-summary-mark-article-hook'."
10144 (when (memq gnus-current-article gnus-newsgroup-unreads)
10145 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10147 (defun gnus-summary-mark-region-as-read (point mark all)
10148 "Mark all unread articles between point and mark as read.
10149 If given a prefix, mark all articles between point and mark as read,
10150 even ticked and dormant ones."
10151 (interactive "r\nP")
10155 (beginning-of-line)
10160 (memq (setq article (gnus-summary-article-number))
10161 gnus-newsgroup-unreads))
10162 (gnus-summary-mark-article article gnus-del-mark))
10164 (gnus-summary-find-next))))))
10166 (defun gnus-summary-mark-below (score mark)
10167 "Mark articles with score less than SCORE with MARK."
10168 (interactive "P\ncMark: ")
10169 (setq score (if score
10170 (prefix-numeric-value score)
10171 (or gnus-summary-default-score 0)))
10173 (set-buffer gnus-summary-buffer)
10174 (goto-char (point-min))
10177 (and (< (gnus-summary-article-score) score)
10178 (gnus-summary-mark-article nil mark))
10179 (gnus-summary-find-next)))))
10181 (defun gnus-summary-kill-below (&optional score)
10182 "Mark articles with score below SCORE as read."
10184 (gnus-summary-mark-below score gnus-killed-mark))
10186 (defun gnus-summary-clear-above (&optional score)
10187 "Clear all marks from articles with score above SCORE."
10189 (gnus-summary-mark-above score gnus-unread-mark))
10191 (defun gnus-summary-tick-above (&optional score)
10192 "Tick all articles with score above SCORE."
10194 (gnus-summary-mark-above score gnus-ticked-mark))
10196 (defun gnus-summary-mark-above (score mark)
10197 "Mark articles with score over SCORE with MARK."
10198 (interactive "P\ncMark: ")
10199 (setq score (if score
10200 (prefix-numeric-value score)
10201 (or gnus-summary-default-score 0)))
10203 (set-buffer gnus-summary-buffer)
10204 (goto-char (point-min))
10206 (when (> (gnus-summary-article-score) score)
10207 (gnus-summary-mark-article nil mark))
10209 (gnus-summary-find-next)))))
10211 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10212 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10213 (defun gnus-summary-limit-include-expunged (&optional no-error)
10214 "Display all the hidden articles that were expunged for low scores."
10216 (let ((buffer-read-only nil))
10217 (let ((scored gnus-newsgroup-scored)
10220 (unless (gnus-summary-article-header (caar scored))
10221 (and (setq h (gnus-number-to-header (caar scored)))
10222 (< (cdar scored) gnus-summary-expunge-below)
10224 (setq scored (cdr scored)))
10226 (when (not no-error)
10227 (error "No expunged articles hidden"))
10228 (goto-char (point-min))
10229 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10230 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10231 (mapcar (lambda (x) (push (mail-header-number x)
10232 gnus-newsgroup-limit))
10234 (gnus-summary-prepare-unthreaded (nreverse headers))
10235 (goto-char (point-min))
10236 (gnus-summary-position-point)
10239 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10240 "Mark all unread articles in this newsgroup as read.
10241 If prefix argument ALL is non-nil, ticked and dormant articles will
10242 also be marked as read.
10243 If QUIETLY is non-nil, no questions will be asked.
10245 If TO-HERE is non-nil, it should be a point in the buffer. All
10246 articles before (after, if REVERSE is set) this point will be marked
10249 Note that this function will only catch up the unread article
10250 in the current summary buffer limitation.
10252 The number of articles marked as read is returned."
10257 (not gnus-interactive-catchup) ;Without confirmation?
10261 "Mark absolutely all articles as read? "
10262 "Mark all unread articles as read? ")))
10264 (not gnus-newsgroup-adaptive)
10265 (not gnus-newsgroup-auto-expire)
10266 (not gnus-suppress-duplicates)
10267 (or (not gnus-use-cache)
10268 (eq gnus-use-cache 'passive)))
10271 (setq gnus-newsgroup-marked nil
10272 gnus-newsgroup-spam-marked nil
10273 gnus-newsgroup-dormant nil))
10274 (setq gnus-newsgroup-unreads
10275 (gnus-sorted-nunion
10276 (gnus-intersection gnus-newsgroup-unreads
10277 gnus-newsgroup-downloadable)
10278 gnus-newsgroup-unfetched)))
10279 ;; We actually mark all articles as canceled, which we
10280 ;; have to do when using auto-expiry or adaptive scoring.
10281 (gnus-summary-show-all-threads)
10282 (if (and to-here reverse)
10284 (goto-char to-here)
10285 (gnus-summary-mark-current-read-and-unread-as-read
10287 (while (gnus-summary-find-next (not all))
10288 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10289 (when (gnus-summary-first-subject (not all))
10291 (if to-here (< (point) to-here) t)
10292 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10293 (gnus-summary-find-next (not all))))))
10294 (gnus-set-mode-line 'summary))
10296 (gnus-summary-position-point)))
10298 (defun gnus-summary-catchup-to-here (&optional all)
10299 "Mark all unticked articles before the current one as read.
10300 If ALL is non-nil, also mark ticked and dormant articles as read."
10303 (gnus-save-hidden-threads
10304 (let ((beg (point)))
10305 ;; We check that there are unread articles.
10306 (when (or all (gnus-summary-find-prev))
10307 (gnus-summary-catchup all t beg)))))
10308 (gnus-summary-position-point))
10310 (defun gnus-summary-catchup-from-here (&optional all)
10311 "Mark all unticked articles after (and including) the current one as read.
10312 If ALL is non-nil, also mark ticked and dormant articles as read."
10315 (gnus-save-hidden-threads
10316 (let ((beg (point)))
10317 ;; We check that there are unread articles.
10318 (when (or all (gnus-summary-find-next))
10319 (gnus-summary-catchup all t beg nil t)))))
10320 (gnus-summary-position-point))
10322 (defun gnus-summary-catchup-all (&optional quietly)
10323 "Mark all articles in this newsgroup as read.
10324 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10325 instead, which marks only unread articles as read."
10327 (gnus-summary-catchup t quietly))
10329 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10330 "Mark all unread articles in this group as read, then exit.
10331 If prefix argument ALL is non-nil, all articles are marked as read.
10332 If QUIETLY is non-nil, no questions will be asked."
10334 (when (gnus-summary-catchup all quietly nil 'fast)
10335 ;; Select next newsgroup or exit.
10336 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10337 (eq gnus-auto-select-next 'quietly))
10338 (gnus-summary-next-group nil)
10339 (gnus-summary-exit))))
10341 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10342 "Mark all articles in this newsgroup as read, and then exit.
10343 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10344 instead, which marks only unread articles as read."
10346 (gnus-summary-catchup-and-exit t quietly))
10348 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10349 "Mark all articles in this group as read and select the next group.
10350 If given a prefix, mark all articles, unread as well as ticked, as
10354 (gnus-summary-catchup all))
10355 (gnus-summary-next-group))
10361 (defmacro gnus-with-article (article &rest forms)
10362 "Select ARTICLE and perform FORMS in the original article buffer.
10363 Then replace the article with the result."
10365 ;; We don't want the article to be marked as read.
10366 (let (gnus-mark-article-hook)
10367 (gnus-summary-select-article t t nil ,article))
10368 (set-buffer gnus-original-article-buffer)
10370 (if (not (gnus-check-backend-function
10371 'request-replace-article (car gnus-article-current)))
10372 (gnus-message 5 "Read-only group; not replacing")
10373 (unless (gnus-request-replace-article
10374 ,article (car gnus-article-current)
10375 (current-buffer) t)
10376 (error "Couldn't replace article")))
10377 ;; The cache and backlog have to be flushed somewhat.
10378 (when gnus-keep-backlog
10379 (gnus-backlog-remove-article
10380 (car gnus-article-current) (cdr gnus-article-current)))
10381 (when gnus-use-cache
10382 (gnus-cache-update-article
10383 (car gnus-article-current) (cdr gnus-article-current)))))
10385 (put 'gnus-with-article 'lisp-indent-function 1)
10386 (put 'gnus-with-article 'edebug-form-spec '(form body))
10388 ;; Thread-based commands.
10390 (defun gnus-summary-articles-in-thread (&optional article)
10391 "Return a list of all articles in the current thread.
10392 If ARTICLE is non-nil, return all articles in the thread that starts
10393 with that article."
10394 (let* ((article (or article (gnus-summary-article-number)))
10395 (data (gnus-data-find-list article))
10396 (top-level (gnus-data-level (car data)))
10398 (cond ((null gnus-thread-operation-ignore-subject)
10399 (gnus-simplify-subject-re
10400 (mail-header-subject (gnus-data-header (car data)))))
10401 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10402 (gnus-simplify-subject-fuzzy
10403 (mail-header-subject (gnus-data-header (car data)))))
10405 (end-point (save-excursion
10406 (if (gnus-summary-go-to-next-thread)
10407 (point) (point-max))))
10410 (< (gnus-data-pos (car data)) end-point))
10411 (when (or (not top-subject)
10412 (string= top-subject
10413 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10414 (gnus-simplify-subject-fuzzy
10415 (mail-header-subject
10416 (gnus-data-header (car data))))
10417 (gnus-simplify-subject-re
10418 (mail-header-subject
10419 (gnus-data-header (car data)))))))
10420 (push (gnus-data-number (car data)) articles))
10421 (unless (and (setq data (cdr data))
10422 (> (gnus-data-level (car data)) top-level))
10424 ;; Return the list of articles.
10425 (nreverse articles)))
10427 (defun gnus-summary-rethread-current ()
10428 "Rethread the thread the current article is part of."
10430 (let* ((gnus-show-threads t)
10431 (article (gnus-summary-article-number))
10432 (id (mail-header-id (gnus-summary-article-header)))
10433 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10435 (error "No article on the current line"))
10436 (gnus-rebuild-thread id)
10437 (gnus-summary-goto-subject article)))
10439 (defun gnus-summary-reparent-thread ()
10440 "Make the current article child of the marked (or previous) article.
10442 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10443 is non-nil or the Subject: of both articles are the same."
10445 (unless (not (gnus-group-read-only-p))
10446 (error "The current newsgroup does not support article editing"))
10447 (unless (<= (length gnus-newsgroup-processable) 1)
10448 (error "No more than one article may be marked"))
10449 (save-window-excursion
10450 (let ((gnus-article-buffer " *reparent*")
10451 (current-article (gnus-summary-article-number))
10452 ;; First grab the marked article, otherwise one line up.
10453 (parent-article (if (not (null gnus-newsgroup-processable))
10454 (car gnus-newsgroup-processable)
10456 (if (eq (forward-line -1) 0)
10457 (gnus-summary-article-number)
10458 (error "Beginning of summary buffer"))))))
10459 (unless (not (eq current-article parent-article))
10460 (error "An article may not be self-referential"))
10461 (let ((message-id (mail-header-id
10462 (gnus-summary-article-header parent-article))))
10463 (unless (and message-id (not (equal message-id "")))
10464 (error "No message-id in desired parent"))
10465 (gnus-with-article current-article
10467 (goto-char (point-min))
10468 (message-narrow-to-head)
10469 (if (re-search-forward "^References: " nil t)
10471 (re-search-forward "^[^ \t]" nil t)
10474 (insert " " message-id))
10475 (insert "References: " message-id "\n"))))
10476 (set-buffer gnus-summary-buffer)
10477 (gnus-summary-unmark-all-processable)
10478 (gnus-summary-update-article current-article)
10479 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10480 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10481 (gnus-summary-rethread-current)
10482 (gnus-message 3 "Article %d is now the child of article %d"
10483 current-article parent-article)))))
10485 (defun gnus-summary-toggle-threads (&optional arg)
10486 "Toggle showing conversation threads.
10487 If ARG is positive number, turn showing conversation threads on."
10489 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10490 (setq gnus-show-threads
10491 (if (null arg) (not gnus-show-threads)
10492 (> (prefix-numeric-value arg) 0)))
10493 (gnus-summary-prepare)
10494 (gnus-summary-goto-subject current)
10495 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10496 (gnus-summary-position-point)))
10498 (defun gnus-summary-show-all-threads ()
10499 "Show all threads."
10502 (let ((buffer-read-only nil))
10503 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10504 (gnus-summary-position-point))
10506 (defun gnus-summary-show-thread ()
10507 "Show thread subtrees.
10508 Returns nil if no thread was there to be shown."
10510 (let ((buffer-read-only nil)
10512 (end (point-at-eol))
10513 ;; Leave point at bol
10514 (beg (progn (beginning-of-line) (point))))
10516 ;; Any hidden lines here?
10517 (search-forward "\r" end t)
10518 (subst-char-in-region beg end ?\^M ?\n t)
10520 (gnus-summary-position-point))))
10522 (defun gnus-summary-maybe-hide-threads ()
10523 "If requested, hide the threads that should be hidden."
10524 (when (and gnus-show-threads
10525 gnus-thread-hide-subtree)
10526 (gnus-summary-hide-all-threads
10527 (if (or (consp gnus-thread-hide-subtree)
10528 (functionp gnus-thread-hide-subtree))
10529 (gnus-make-predicate gnus-thread-hide-subtree)
10532 ;;; Hiding predicates.
10534 (defun gnus-article-unread-p (header)
10535 (memq (mail-header-number header) gnus-newsgroup-unreads))
10537 (defun gnus-article-unseen-p (header)
10538 (memq (mail-header-number header) gnus-newsgroup-unseen))
10540 (defun gnus-map-articles (predicate articles)
10541 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10542 (apply 'gnus-or (mapcar predicate
10543 (mapcar 'gnus-summary-article-header articles))))
10545 (defun gnus-summary-hide-all-threads (&optional predicate)
10546 "Hide all thread subtrees.
10547 If PREDICATE is supplied, threads that satisfy this predicate
10548 will not be hidden."
10551 (goto-char (point-min))
10554 (when (or (not predicate)
10556 predicate (gnus-summary-article-children)))
10557 (gnus-summary-hide-thread))
10558 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10559 (gnus-summary-position-point))
10561 (defun gnus-summary-hide-thread ()
10562 "Hide thread subtrees.
10563 If PREDICATE is supplied, threads that satisfy this predicate
10564 will not be hidden.
10565 Returns nil if no threads were there to be hidden."
10567 (let ((buffer-read-only nil)
10569 (article (gnus-summary-article-number)))
10571 ;; Go forward until either the buffer ends or the subthread
10573 (when (and (not (eobp))
10574 (or (zerop (gnus-summary-next-thread 1 t))
10575 (goto-char (point-max))))
10577 (if (and (> (point) start)
10578 (search-backward "\n" start t))
10580 (subst-char-in-region start (point) ?\n ?\^M)
10581 (gnus-summary-goto-subject article))
10585 (defun gnus-summary-go-to-next-thread (&optional previous)
10586 "Go to the same level (or less) next thread.
10587 If PREVIOUS is non-nil, go to previous thread instead.
10588 Return the article number moved to, or nil if moving was impossible."
10589 (let ((level (gnus-summary-thread-level))
10590 (way (if previous -1 1))
10593 (while (and (not (eobp))
10594 (< level (gnus-summary-thread-level)))
10595 (forward-line way))
10602 (gnus-summary-article-number)
10603 (goto-char beg)))))
10605 (defun gnus-summary-next-thread (n &optional silent)
10606 "Go to the same level next N'th thread.
10607 If N is negative, search backward instead.
10608 Returns the difference between N and the number of skips actually
10611 If SILENT, don't output messages."
10613 (let ((backward (< n 0))
10615 (while (and (> n 0)
10616 (gnus-summary-go-to-next-thread backward))
10619 (gnus-summary-position-point))
10620 (when (and (not silent) (/= 0 n))
10621 (gnus-message 7 "No more threads"))
10624 (defun gnus-summary-prev-thread (n)
10625 "Go to the same level previous N'th thread.
10626 Returns the difference between N and the number of skips actually
10629 (gnus-summary-next-thread (- n)))
10631 (defun gnus-summary-go-down-thread ()
10632 "Go down one level in the current thread."
10633 (let ((children (gnus-summary-article-children)))
10635 (gnus-summary-goto-subject (car children)))))
10637 (defun gnus-summary-go-up-thread ()
10638 "Go up one level in the current thread."
10639 (let ((parent (gnus-summary-article-parent)))
10641 (gnus-summary-goto-subject parent))))
10643 (defun gnus-summary-down-thread (n)
10644 "Go down thread N steps.
10645 If N is negative, go up instead.
10646 Returns the difference between N and how many steps down that were
10651 (while (and (> n 0)
10652 (if up (gnus-summary-go-up-thread)
10653 (gnus-summary-go-down-thread)))
10655 (gnus-summary-position-point)
10657 (gnus-message 7 "Can't go further"))
10660 (defun gnus-summary-up-thread (n)
10661 "Go up thread N steps.
10662 If N is negative, go down instead.
10663 Returns the difference between N and how many steps down that were
10666 (gnus-summary-down-thread (- n)))
10668 (defun gnus-summary-top-thread ()
10669 "Go to the top of the thread."
10671 (while (gnus-summary-go-up-thread))
10672 (gnus-summary-article-number))
10674 (defun gnus-summary-kill-thread (&optional unmark)
10675 "Mark articles under current thread as read.
10676 If the prefix argument is positive, remove any kinds of marks.
10677 If the prefix argument is negative, tick articles instead."
10680 (setq unmark (prefix-numeric-value unmark)))
10681 (let ((articles (gnus-summary-articles-in-thread)))
10683 ;; Expand the thread.
10684 (gnus-summary-show-thread)
10685 ;; Mark all the articles.
10687 (gnus-summary-goto-subject (car articles))
10688 (cond ((null unmark)
10689 (gnus-summary-mark-article-as-read gnus-killed-mark))
10691 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10693 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10694 (setq articles (cdr articles))))
10695 ;; Hide killed subtrees.
10697 gnus-thread-hide-killed
10698 (gnus-summary-hide-thread))
10699 ;; If marked as read, go to next unread subject.
10700 (when (null unmark)
10701 ;; Go to next unread subject.
10702 (gnus-summary-next-subject 1 t)))
10703 (gnus-set-mode-line 'summary))
10705 ;; Summary sorting commands
10707 (defun gnus-summary-sort-by-number (&optional reverse)
10708 "Sort the summary buffer by article number.
10709 Argument REVERSE means reverse order."
10711 (gnus-summary-sort 'number reverse))
10713 (defun gnus-summary-sort-by-random (&optional reverse)
10714 "Randomize the order in the summary buffer.
10715 Argument REVERSE means to randomize in reverse order."
10717 (gnus-summary-sort 'random reverse))
10719 (defun gnus-summary-sort-by-author (&optional reverse)
10720 "Sort the summary buffer by author name alphabetically.
10721 If `case-fold-search' is non-nil, case of letters is ignored.
10722 Argument REVERSE means reverse order."
10724 (gnus-summary-sort 'author reverse))
10726 (defun gnus-summary-sort-by-subject (&optional reverse)
10727 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10728 If `case-fold-search' is non-nil, case of letters is ignored.
10729 Argument REVERSE means reverse order."
10731 (gnus-summary-sort 'subject reverse))
10733 (defun gnus-summary-sort-by-date (&optional reverse)
10734 "Sort the summary buffer by date.
10735 Argument REVERSE means reverse order."
10737 (gnus-summary-sort 'date reverse))
10739 (defun gnus-summary-sort-by-score (&optional reverse)
10740 "Sort the summary buffer by score.
10741 Argument REVERSE means reverse order."
10743 (gnus-summary-sort 'score reverse))
10745 (defun gnus-summary-sort-by-lines (&optional reverse)
10746 "Sort the summary buffer by the number of lines.
10747 Argument REVERSE means reverse order."
10749 (gnus-summary-sort 'lines reverse))
10751 (defun gnus-summary-sort-by-chars (&optional reverse)
10752 "Sort the summary buffer by article length.
10753 Argument REVERSE means reverse order."
10755 (gnus-summary-sort 'chars reverse))
10757 (defun gnus-summary-sort-by-original (&optional reverse)
10758 "Sort the summary buffer using the default sorting method.
10759 Argument REVERSE means reverse order."
10761 (let* ((buffer-read-only)
10762 (gnus-summary-prepare-hook nil))
10763 ;; We do the sorting by regenerating the threads.
10764 (gnus-summary-prepare)
10765 ;; Hide subthreads if needed.
10766 (gnus-summary-maybe-hide-threads)))
10768 (defun gnus-summary-sort (predicate reverse)
10769 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10770 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10771 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10772 (gnus-thread-sort-functions
10777 (gnus-sort-gathered-threads-function
10778 gnus-thread-sort-functions)
10779 (gnus-article-sort-functions
10783 (,article t2 t1))))
10785 (gnus-summary-prepare-hook nil))
10786 ;; We do the sorting by regenerating the threads.
10787 (gnus-summary-prepare)
10788 ;; Hide subthreads if needed.
10789 (gnus-summary-maybe-hide-threads)))
10791 ;; Summary saving commands.
10793 (defun gnus-summary-save-article (&optional n not-saved)
10794 "Save the current article using the default saver function.
10795 If N is a positive number, save the N next articles.
10796 If N is a negative number, save the N previous articles.
10797 If N is nil and any articles have been marked with the process mark,
10798 save those articles instead.
10799 The variable `gnus-default-article-saver' specifies the saver function."
10801 (let* ((articles (gnus-summary-work-articles n))
10802 (save-buffer (save-excursion
10803 (nnheader-set-temp-buffer " *Gnus Save*")))
10804 (num (length articles))
10806 (dolist (article articles)
10807 (setq header (gnus-summary-article-header article))
10808 (if (not (vectorp header))
10809 ;; This is a pseudo-article.
10810 (if (assq 'name header)
10811 (gnus-copy-file (cdr (assq 'name header)))
10812 (gnus-message 1 "Article %d is unsaveable" article))
10813 ;; This is a real article.
10814 (save-window-excursion
10815 (let ((gnus-display-mime-function nil)
10816 (gnus-article-prepare-hook nil))
10817 (gnus-summary-select-article t nil nil article)))
10819 (set-buffer save-buffer)
10821 (insert-buffer-substring gnus-original-article-buffer))
10822 (setq file (gnus-article-save save-buffer file num))
10823 (gnus-summary-remove-process-mark article)
10825 (gnus-summary-set-saved-mark article))))
10826 (gnus-kill-buffer save-buffer)
10827 (gnus-summary-position-point)
10828 (gnus-set-mode-line 'summary)
10831 (defun gnus-summary-pipe-output (&optional arg headers)
10832 "Pipe the current article to a subprocess.
10833 If N is a positive number, pipe the N next articles.
10834 If N is a negative number, pipe the N previous articles.
10835 If N is nil and any articles have been marked with the process mark,
10836 pipe those articles instead.
10837 If HEADERS (the symbolic prefix), include the headers, too."
10838 (interactive (gnus-interactive "P\ny"))
10839 (require 'gnus-art)
10840 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10841 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10842 (gnus-summary-save-article arg t))
10843 (let ((buffer (get-buffer "*Shell Command Output*")))
10845 (not (zerop (buffer-size buffer))))
10846 (gnus-configure-windows 'pipe))))
10848 (defun gnus-summary-save-article-mail (&optional arg)
10849 "Append the current article to an mail file.
10850 If N is a positive number, save the N next articles.
10851 If N is a negative number, save the N previous articles.
10852 If N is nil and any articles have been marked with the process mark,
10853 save those articles instead."
10855 (require 'gnus-art)
10856 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10857 (gnus-summary-save-article arg)))
10859 (defun gnus-summary-save-article-rmail (&optional arg)
10860 "Append the current article to an rmail file.
10861 If N is a positive number, save the N next articles.
10862 If N is a negative number, save the N previous articles.
10863 If N is nil and any articles have been marked with the process mark,
10864 save those articles instead."
10866 (require 'gnus-art)
10867 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10868 (gnus-summary-save-article arg)))
10870 (defun gnus-summary-save-article-file (&optional arg)
10871 "Append the current article to a file.
10872 If N is a positive number, save the N next articles.
10873 If N is a negative number, save the N previous articles.
10874 If N is nil and any articles have been marked with the process mark,
10875 save those articles instead."
10877 (require 'gnus-art)
10878 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10879 (gnus-summary-save-article arg)))
10881 (defun gnus-summary-write-article-file (&optional arg)
10882 "Write the current article to a file, deleting the previous file.
10883 If N is a positive number, save the N next articles.
10884 If N is a negative number, save the N previous articles.
10885 If N is nil and any articles have been marked with the process mark,
10886 save those articles instead."
10888 (require 'gnus-art)
10889 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10890 (gnus-summary-save-article arg)))
10892 (defun gnus-summary-save-article-body-file (&optional arg)
10893 "Append the current article body to a file.
10894 If N is a positive number, save the N next articles.
10895 If N is a negative number, save the N previous articles.
10896 If N is nil and any articles have been marked with the process mark,
10897 save those articles instead."
10899 (require 'gnus-art)
10900 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10901 (gnus-summary-save-article arg)))
10903 (defun gnus-summary-muttprint (&optional arg)
10904 "Print the current article using Muttprint.
10905 If N is a positive number, save the N next articles.
10906 If N is a negative number, save the N previous articles.
10907 If N is nil and any articles have been marked with the process mark,
10908 save those articles instead."
10910 (require 'gnus-art)
10911 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10912 (gnus-summary-save-article arg t)))
10914 (defun gnus-summary-pipe-message (program)
10915 "Pipe the current article through PROGRAM."
10916 (interactive "sProgram: ")
10917 (gnus-summary-select-article)
10918 (let ((mail-header-separator ""))
10919 (gnus-eval-in-buffer-window gnus-article-buffer
10922 (let ((start (window-start))
10924 (message-pipe-buffer-body program)
10925 (set-window-start (get-buffer-window (current-buffer)) start))))))
10927 (defun gnus-get-split-value (methods)
10928 "Return a value based on the split METHODS."
10929 (let (split-name method result match)
10932 (set-buffer gnus-original-article-buffer)
10934 (nnheader-narrow-to-headers)
10935 (while (and methods (not split-name))
10936 (goto-char (point-min))
10937 (setq method (pop methods))
10938 (setq match (car method))
10941 ;; Regular expression.
10943 (re-search-forward match nil t)))
10948 (setq result (funcall match gnus-newsgroup-name))))
10953 (setq result (eval match)))))
10954 (setq split-name (cdr method))
10955 (cond ((stringp result)
10956 (push (expand-file-name
10957 result gnus-article-save-directory)
10960 (setq split-name (append result split-name)))))))))
10961 (nreverse split-name)))
10963 (defun gnus-valid-move-group-p (group)
10964 (and (boundp group)
10965 (symbol-name group)
10966 (symbol-value group)
10967 (gnus-get-function (gnus-find-method-for-group
10968 (symbol-name group)) 'request-accept-article t)))
10970 (defun gnus-read-move-group-name (prompt default articles prefix)
10971 "Read a group name."
10972 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10973 (minibuffer-confirm-incomplete nil) ; XEmacs
10975 (format "%s %s to:"
10977 (if (> (length articles) 1)
10978 (format "these %d articles" (length articles))
10983 (gnus-completing-read-with-default
10986 'gnus-valid-move-group-p
10988 'gnus-group-history))
10989 ((= 1 (length split-name))
10990 (gnus-completing-read-with-default
10991 (car split-name) prom
10993 'gnus-valid-move-group-p
10995 'gnus-group-history))
10997 (gnus-completing-read-with-default
10999 (mapcar (lambda (el) (list el))
11000 (nreverse split-name))
11002 'gnus-group-history))))
11003 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11005 (if (or (string= to-newsgroup "")
11006 (string= to-newsgroup prefix))
11007 (setq to-newsgroup default))
11008 (unless to-newsgroup
11009 (error "No group name entered"))
11010 (or (gnus-active to-newsgroup)
11011 (gnus-activate-group to-newsgroup nil nil to-method)
11012 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11014 (or (and (gnus-request-create-group to-newsgroup to-method)
11015 (gnus-activate-group
11016 to-newsgroup nil nil to-method)
11017 (gnus-subscribe-group to-newsgroup))
11018 (error "Couldn't create group %s" to-newsgroup)))
11019 (error "No such group: %s" to-newsgroup)))
11022 (defun gnus-summary-save-parts (type dir n &optional reverse)
11023 "Save parts matching TYPE to DIR.
11024 If REVERSE, save parts that do not match TYPE."
11026 (list (read-string "Save parts of type: "
11027 (or (car gnus-summary-save-parts-type-history)
11028 gnus-summary-save-parts-default-mime)
11029 'gnus-summary-save-parts-type-history)
11030 (setq gnus-summary-save-parts-last-directory
11031 (read-file-name "Save to directory: "
11032 gnus-summary-save-parts-last-directory
11034 current-prefix-arg))
11035 (gnus-summary-iterate n
11036 (let ((gnus-display-mime-function nil)
11037 (gnus-inhibit-treatment t))
11038 (gnus-summary-select-article))
11040 (set-buffer gnus-article-buffer)
11041 (let ((handles (or gnus-article-mime-handles
11042 (mm-dissect-buffer nil gnus-article-loose-mime)
11043 (and gnus-article-emulate-mime
11044 (mm-uu-dissect)))))
11046 (gnus-summary-save-parts-1 type dir handles reverse)
11047 (unless gnus-article-mime-handles ;; Don't destroy this case.
11048 (mm-destroy-parts handles)))))))
11050 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11051 (if (stringp (car handle))
11052 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11055 (not (string-match type (mm-handle-media-type handle)))
11056 (string-match type (mm-handle-media-type handle)))
11057 (let ((file (expand-file-name
11059 mm-file-name-rewrite-functions
11060 (file-name-nondirectory
11062 (mail-content-type-get
11063 (mm-handle-disposition handle) 'filename)
11064 (mail-content-type-get
11065 (mm-handle-type handle) 'name)
11066 (concat gnus-newsgroup-name
11067 "." (number-to-string
11068 (cdr gnus-article-current))))))
11070 (unless (file-exists-p file)
11071 (mm-save-part-to-file handle file))))))
11073 ;; Summary extract commands
11075 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11076 (let ((buffer-read-only nil)
11077 (article (gnus-summary-article-number))
11079 (unless (gnus-summary-goto-subject article)
11080 (error "No such article: %d" article))
11081 (gnus-summary-position-point)
11082 ;; If all commands are to be bunched up on one line, we collect
11084 (unless gnus-view-pseudos-separately
11085 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11088 (setq action (cdr (assq 'action (car ps))))
11089 (setq files (list (cdr (assq 'name (car ps)))))
11090 (while (and ps (cdr ps)
11091 (string= (or action "1")
11092 (or (cdr (assq 'action (cadr ps))) "2")))
11093 (push (cdr (assq 'name (cadr ps))) files)
11094 (setcdr ps (cddr ps)))
11096 (when (not (string-match "%s" action))
11099 (when (assq 'execute (car ps))
11100 (setcdr (assq 'execute (car ps))
11101 (funcall (if (string-match "%s" action)
11108 (shell-quote-argument f)))
11110 (setq ps (cdr ps)))))
11111 (if (and gnus-view-pseudos (not not-view))
11113 (when (assq 'execute (car pslist))
11114 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11115 (eq gnus-view-pseudos 'not-confirm)))
11116 (setq pslist (cdr pslist)))
11119 (setq after-article (or (cdr (assq 'article (car pslist)))
11120 (gnus-summary-article-number)))
11121 (gnus-summary-goto-subject after-article)
11124 (insert " " (file-name-nondirectory
11125 (cdr (assq 'name (car pslist))))
11126 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11128 (forward-line -1) ; back to `b'
11129 (gnus-add-text-properties
11130 b (1- e) (list 'gnus-number gnus-reffed-article-number
11131 gnus-mouse-face-prop gnus-mouse-face))
11133 after-article gnus-reffed-article-number
11134 gnus-unread-mark b (car pslist) 0 (- e b))
11135 (setq gnus-newsgroup-unreads
11136 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11137 gnus-reffed-article-number))
11138 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11139 (setq pslist (cdr pslist)))))))
11141 (defun gnus-pseudos< (p1 p2)
11142 (let ((c1 (cdr (assq 'action p1)))
11143 (c2 (cdr (assq 'action p2))))
11144 (and c1 c2 (string< c1 c2))))
11146 (defun gnus-request-pseudo-article (props)
11147 (cond ((assq 'execute props)
11148 (gnus-execute-command (cdr (assq 'execute props)))))
11149 (let ((gnus-current-article (gnus-summary-article-number)))
11150 (gnus-run-hooks 'gnus-mark-article-hook)))
11152 (defun gnus-execute-command (command &optional automatic)
11154 (gnus-article-setup-buffer)
11155 (set-buffer gnus-article-buffer)
11156 (setq buffer-read-only nil)
11157 (let ((command (if automatic command
11158 (read-string "Command: " (cons command 0)))))
11160 (insert "$ " command "\n\n")
11161 (if gnus-view-pseudo-asynchronously
11162 (start-process "gnus-execute" (current-buffer) shell-file-name
11163 shell-command-switch command)
11164 (call-process shell-file-name nil t nil
11165 shell-command-switch command)))))
11167 ;; Summary kill commands.
11169 (defun gnus-summary-edit-global-kill (article)
11170 "Edit the \"global\" kill file."
11171 (interactive (list (gnus-summary-article-number)))
11172 (gnus-group-edit-global-kill article))
11174 (defun gnus-summary-edit-local-kill ()
11175 "Edit a local kill file applied to the current newsgroup."
11177 (setq gnus-current-headers (gnus-summary-article-header))
11178 (gnus-group-edit-local-kill
11179 (gnus-summary-article-number) gnus-newsgroup-name))
11181 ;;; Header reading.
11183 (defun gnus-read-header (id &optional header)
11184 "Read the headers of article ID and enter them into the Gnus system."
11185 (let ((group gnus-newsgroup-name)
11186 (gnus-override-method
11188 gnus-override-method
11189 (and (gnus-news-group-p gnus-newsgroup-name)
11190 (car (gnus-refer-article-methods)))))
11192 ;; First we check to see whether the header in question is already
11195 ;; This is a Message-ID.
11196 (setq header (or header (gnus-id-to-header id)))
11197 ;; This is an article number.
11198 (setq header (or header (gnus-summary-article-header id))))
11200 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11201 ;; We have found the header.
11203 ;; If this is a sparse article, we have to nix out its
11204 ;; previous entry in the thread hashtb.
11206 (gnus-summary-article-sparse-p (mail-header-number header)))
11207 (let* ((parent (gnus-parent-id (mail-header-references header)))
11208 (thread (and parent (gnus-id-to-thread parent))))
11210 (delq (assq header thread) thread))))
11211 ;; We have to really fetch the header to this article.
11213 (set-buffer nntp-server-buffer)
11214 (when (setq where (gnus-request-head id group))
11215 (nnheader-fold-continuation-lines)
11216 (goto-char (point-max))
11218 (goto-char (point-min))
11222 ((cdr where) (cdr where))
11223 (header (mail-header-number header))
11224 (t gnus-reffed-article-number))
11226 (insert " Article retrieved.\n"))
11227 (if (or (not where)
11228 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11229 () ; Malformed head.
11230 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11231 (when (and (stringp id)
11232 (not (string= (gnus-group-real-name group)
11234 ;; If we fetched by Message-ID and the article came
11235 ;; from a different group, we fudge some bogus article
11236 ;; numbers for this article.
11237 (mail-header-set-number header gnus-reffed-article-number))
11239 (set-buffer gnus-summary-buffer)
11240 (decf gnus-reffed-article-number)
11241 (gnus-remove-header (mail-header-number header))
11242 (push header gnus-newsgroup-headers)
11243 (setq gnus-current-headers header)
11244 (push (mail-header-number header) gnus-newsgroup-limit)))
11247 (defun gnus-remove-header (number)
11248 "Remove header NUMBER from `gnus-newsgroup-headers'."
11249 (if (and gnus-newsgroup-headers
11250 (= number (mail-header-number (car gnus-newsgroup-headers))))
11251 (pop gnus-newsgroup-headers)
11252 (let ((headers gnus-newsgroup-headers))
11253 (while (and (cdr headers)
11254 (not (= number (mail-header-number (cadr headers)))))
11256 (when (cdr headers)
11257 (setcdr headers (cddr headers))))))
11260 ;;; summary highlights
11263 (defun gnus-highlight-selected-summary ()
11264 "Highlight selected article in summary buffer."
11265 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11266 (when gnus-summary-selected-face
11268 (let* ((beg (point-at-bol))
11269 (end (point-at-eol))
11270 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11271 (from (if (get-text-property beg gnus-mouse-face-prop)
11273 (or (next-single-property-change
11274 beg gnus-mouse-face-prop nil end)
11279 (or (next-single-property-change
11280 from gnus-mouse-face-prop nil end)
11282 ;; If no mouse-face prop on line we will have to = from = end,
11283 ;; so we highlight the entire line instead.
11284 (when (= (+ to 2) from)
11287 (if gnus-newsgroup-selected-overlay
11288 ;; Move old overlay.
11290 gnus-newsgroup-selected-overlay from to (current-buffer))
11291 ;; Create new overlay.
11293 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11294 'face gnus-summary-selected-face))))))
11296 (defvar gnus-summary-highlight-line-cached nil)
11297 (defvar gnus-summary-highlight-line-trigger nil)
11299 (defun gnus-summary-highlight-line-0 ()
11300 (if (and (eq gnus-summary-highlight-line-trigger
11301 gnus-summary-highlight)
11302 gnus-summary-highlight-line-cached)
11303 gnus-summary-highlight-line-cached
11304 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11305 gnus-summary-highlight-line-cached
11306 (let* ((cond (list 'cond))
11308 (list gnus-summary-highlight))
11310 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11314 (gnus-byte-compile (list 'lambda nil cond))))))
11316 (defun gnus-summary-highlight-line ()
11317 "Highlight current line according to `gnus-summary-highlight'."
11318 (let* ((beg (point-at-bol))
11319 (article (or (gnus-summary-article-number) gnus-current-article))
11320 (score (or (cdr (assq article
11321 gnus-newsgroup-scored))
11322 gnus-summary-default-score 0))
11323 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11324 (inhibit-read-only t)
11325 (default gnus-summary-default-score)
11326 (default-high gnus-summary-default-high-score)
11327 (default-low gnus-summary-default-low-score)
11328 (uncached (and gnus-summary-use-undownloaded-faces
11329 (memq article gnus-newsgroup-undownloaded))))
11330 (let ((face (funcall (gnus-summary-highlight-line-0))))
11331 (unless (eq face (get-text-property beg 'face))
11332 (gnus-put-text-property-excluding-characters-with-faces
11333 beg (point-at-eol) 'face
11334 (setq face (if (boundp face) (symbol-value face) face)))
11335 (when gnus-summary-highlight-line-function
11336 (funcall gnus-summary-highlight-line-function article face))))))
11338 (defun gnus-update-read-articles (group unread &optional compute)
11339 "Update the list of read articles in GROUP.
11340 UNREAD is a sorted list."
11341 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11342 (info (gnus-get-info group))
11345 (if (or (not info) (not active))
11346 ;; There is no info on this group if it was, in fact,
11347 ;; killed. Gnus stores no information on killed groups, so
11348 ;; there's nothing to be done.
11349 ;; One could store the information somewhere temporarily,
11350 ;; perhaps... Hmmm...
11352 ;; Remove any negative articles numbers.
11353 (while (and unread (< (car unread) 0))
11354 (setq unread (cdr unread)))
11355 ;; Remove any expired article numbers
11356 (while (and unread (< (car unread) (car active)))
11357 (setq unread (cdr unread)))
11358 ;; Compute the ranges of read articles by looking at the list of
11359 ;; unread articles.
11361 (when (/= (car unread) prev)
11362 (push (if (= prev (1- (car unread))) prev
11363 (cons prev (1- (car unread))))
11365 (setq prev (1+ (car unread)))
11366 (setq unread (cdr unread)))
11367 (when (<= prev (cdr active))
11368 (push (cons prev (cdr active)) read))
11369 (setq read (if (> (length read) 1) (nreverse read) read))
11374 ;; Propagate the read marks to the backend.
11375 (when (gnus-check-backend-function 'request-set-mark group)
11376 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11377 (add (gnus-remove-from-range read (gnus-info-read info))))
11379 (unless (gnus-check-group group)
11380 (error "Can't open server for %s" group))
11381 (gnus-request-set-mark
11382 group (delq nil (list (if add (list add 'add '(read)))
11383 (if del (list del 'del '(read))))))
11385 `(gnus-request-set-mark
11388 (if del (list del 'add '(read)))
11389 (if add (list add 'del '(read))))))))))
11390 (set-buffer gnus-group-buffer)
11391 (gnus-undo-register
11393 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11394 (gnus-info-set-read ',info ',(gnus-info-read info))
11395 (gnus-get-unread-articles-in-group ',info
11396 (gnus-active ,group))
11397 (gnus-group-update-group ,group t)
11399 ;; Enter this list into the group info.
11400 (gnus-info-set-read info read)
11401 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11402 (gnus-get-unread-articles-in-group info (gnus-active group))
11405 (defun gnus-offer-save-summaries ()
11406 "Offer to save all active summary buffers."
11408 ;; Go through all buffers and find all summaries.
11409 (dolist (buffer (buffer-list))
11410 (when (and (setq buffer (buffer-name buffer))
11411 (string-match "Summary" buffer)
11413 (set-buffer buffer)
11414 ;; We check that this is, indeed, a summary buffer.
11415 (and (eq major-mode 'gnus-summary-mode)
11416 ;; Also make sure this isn't bogus.
11417 gnus-newsgroup-prepared
11418 ;; Also make sure that this isn't a
11419 ;; dead summary buffer.
11420 (not gnus-dead-summary-mode))))
11421 (push buffer buffers)))
11422 ;; Go through all these summary buffers and offer to save them.
11426 "Update summary buffer %s? "
11428 (switch-to-buffer buf)
11429 (gnus-summary-exit))
11432 (defun gnus-summary-setup-default-charset ()
11433 "Setup newsgroup default charset."
11434 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11435 (setq gnus-newsgroup-charset nil)
11436 (let* ((ignored-charsets
11437 (or gnus-newsgroup-ephemeral-ignored-charsets
11439 (and gnus-newsgroup-name
11440 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11441 gnus-newsgroup-ignored-charsets))))
11442 (setq gnus-newsgroup-charset
11443 (or gnus-newsgroup-ephemeral-charset
11444 (and gnus-newsgroup-name
11445 (gnus-parameter-charset gnus-newsgroup-name))
11446 gnus-default-charset))
11447 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11448 ignored-charsets))))
11454 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11455 "Display the current article buffer fully MIME-buttonized.
11456 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11457 treated as multipart/mixed."
11459 (require 'gnus-art)
11460 (let ((gnus-unbuttonized-mime-types nil)
11461 (gnus-mime-display-multipart-as-mixed show-all-parts))
11462 (gnus-summary-show-article)))
11464 (defun gnus-summary-repair-multipart (article)
11465 "Add a Content-Type header to a multipart article without one."
11466 (interactive (list (gnus-summary-article-number)))
11467 (gnus-with-article article
11468 (message-narrow-to-head)
11469 (message-remove-header "Mime-Version")
11470 (goto-char (point-max))
11471 (insert "Mime-Version: 1.0\n")
11473 (when (search-forward "\n--" nil t)
11474 (let ((separator (buffer-substring (point) (point-at-eol))))
11475 (message-narrow-to-head)
11476 (message-remove-header "Content-Type")
11477 (goto-char (point-max))
11478 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11481 (let (gnus-mark-article-hook)
11482 (gnus-summary-select-article t t nil article)))
11484 (defun gnus-summary-toggle-display-buttonized ()
11485 "Toggle the buttonizing of the article buffer."
11487 (require 'gnus-art)
11488 (if (setq gnus-inhibit-mime-unbuttonizing
11489 (not gnus-inhibit-mime-unbuttonizing))
11490 (let ((gnus-unbuttonized-mime-types nil))
11491 (gnus-summary-show-article))
11492 (gnus-summary-show-article)))
11495 ;;; Generic summary marking commands
11498 (defvar gnus-summary-marking-alist
11499 '((read gnus-del-mark "d")
11500 (unread gnus-unread-mark "u")
11501 (ticked gnus-ticked-mark "!")
11502 (dormant gnus-dormant-mark "?")
11503 (expirable gnus-expirable-mark "e"))
11504 "An alist of names/marks/keystrokes.")
11506 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11507 (defvar gnus-summary-mark-map)
11509 (defun gnus-summary-make-all-marking-commands ()
11510 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11511 (dolist (elem gnus-summary-marking-alist)
11512 (apply 'gnus-summary-make-marking-command elem)))
11514 (defun gnus-summary-make-marking-command (name mark keystroke)
11515 (let ((map (make-sparse-keymap)))
11516 (define-key gnus-summary-generic-mark-map keystroke map)
11517 (dolist (lway `((next "next" next nil "n")
11518 (next-unread "next unread" next t "N")
11519 (prev "previous" prev nil "p")
11520 (prev-unread "previous unread" prev t "P")
11521 (nomove "" nil nil ,keystroke)))
11522 (let ((func (gnus-summary-make-marking-command-1
11523 mark (car lway) lway name)))
11524 (setq func (eval func))
11525 (define-key map (nth 4 lway) func)))))
11527 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11529 (format "gnus-summary-put-mark-as-%s%s"
11530 name (if (eq way 'nomove)
11532 (concat "-" (symbol-name way)))))
11535 "Mark the current article as %s%s.
11536 If N, the prefix, then repeat N times.
11537 If N is negative, move in reverse order.
11538 The difference between N and the actual number of articles marked is
11542 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11544 (defun gnus-summary-generic-mark (n mark move unread)
11545 "Mark N articles with MARK."
11546 (unless (eq major-mode 'gnus-summary-mode)
11547 (error "This command can only be used in the summary buffer"))
11548 (gnus-summary-show-thread)
11551 ((eq move 'next) 1)
11552 ((eq move 'prev) -1)
11554 (if (zerop nummove)
11558 nummove (* -1 nummove))))
11559 (while (and (> n 0)
11560 (gnus-summary-mark-article nil mark)
11561 (zerop (gnus-summary-next-subject nummove unread t)))
11564 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11565 (gnus-summary-recenter)
11566 (gnus-summary-position-point)
11567 (gnus-set-mode-line 'summary)
11570 (defun gnus-summary-insert-articles (articles)
11571 (when (setq articles
11572 (gnus-sorted-difference articles
11573 (mapcar (lambda (h)
11574 (mail-header-number h))
11575 gnus-newsgroup-headers)))
11576 (setq gnus-newsgroup-headers
11578 gnus-newsgroup-headers
11579 (gnus-fetch-headers articles)
11580 'gnus-article-sort-by-number))
11581 ;; Suppress duplicates?
11582 (when gnus-suppress-duplicates
11583 (gnus-dup-suppress-articles))
11585 ;; We might want to build some more threads first.
11586 (when (and gnus-fetch-old-headers
11587 (eq gnus-headers-retrieved-by 'nov))
11588 (if (eq gnus-fetch-old-headers 'invisible)
11589 (gnus-build-all-threads)
11590 (gnus-build-old-threads)))
11591 ;; Let the Gnus agent mark articles as read.
11593 (gnus-agent-get-undownloaded-list))
11594 ;; Remove list identifiers from subject
11595 (when gnus-list-identifiers
11596 (gnus-summary-remove-list-identifiers))
11597 ;; First and last article in this newsgroup.
11598 (when gnus-newsgroup-headers
11599 (setq gnus-newsgroup-begin
11600 (mail-header-number (car gnus-newsgroup-headers))
11602 (mail-header-number
11603 (gnus-last-element gnus-newsgroup-headers))))
11604 (when gnus-use-scoring
11605 (gnus-possibly-score-headers))))
11607 (defun gnus-summary-insert-old-articles (&optional all)
11608 "Insert all old articles in this group.
11609 If ALL is non-nil, already read articles become readable.
11610 If ALL is a number, fetch this number of articles."
11613 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11616 ;; Some nntp servers lie about their active range. When
11617 ;; this happens, the active range can be in the millions.
11618 ;; Use a compressed range to avoid creating a huge list.
11619 (gnus-range-difference (list gnus-newsgroup-active) old))
11620 (setq len (gnus-range-length older))
11625 (let ((older-range (nreverse older)))
11629 (let* ((r (pop older-range))
11630 (min (if (numberp r) r (car r)))
11631 (max (if (numberp r) r (cdr r))))
11632 (while (and (<= min max)
11637 (setq older (gnus-uncompress-range older))))
11639 (setq older (gnus-uncompress-range older)))
11641 (when (and (numberp gnus-large-newsgroup)
11642 (> len gnus-large-newsgroup))
11643 (let* ((cursor-in-echo-area nil)
11644 (initial (gnus-parameter-large-newsgroup-initial
11645 gnus-newsgroup-name))
11649 "How many articles from %s (%s %d): "
11651 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11652 (if initial "max" "default")
11655 (cons (number-to-string initial)
11657 (unless (string-match "^[ \t]*$" input)
11658 (setq all (string-to-number input))
11660 (let ((older-range (nreverse older)))
11664 (let* ((r (pop older-range))
11665 (min (if (numberp r) r (car r)))
11666 (max (if (numberp r) r (cdr r))))
11667 (while (and (<= min max)
11671 max (1- max))))))))))
11672 (setq older (gnus-uncompress-range older))))
11674 (message "No old news.")
11675 (gnus-summary-insert-articles older)
11676 (gnus-summary-limit (gnus-sorted-nunion old older))))
11677 (gnus-summary-position-point)))
11679 (defun gnus-summary-insert-new-articles ()
11680 "Insert all new articles in this group."
11683 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11684 (old-active gnus-newsgroup-active)
11685 (nnmail-fetched-sources (list t))
11687 (setq gnus-newsgroup-active
11688 (gnus-activate-group gnus-newsgroup-name 'scan))
11689 (setq i (cdr gnus-newsgroup-active))
11690 (while (> i (cdr old-active))
11694 (message "No gnus is bad news")
11695 (gnus-summary-insert-articles new)
11696 (setq gnus-newsgroup-unreads
11697 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11698 (gnus-summary-limit (gnus-sorted-nunion old new))))
11699 (gnus-summary-position-point)))
11701 (gnus-summary-make-all-marking-commands)
11703 (gnus-ems-redefine)
11705 (provide 'gnus-sum)
11707 (run-hooks 'gnus-sum-load-hook)
11709 ;; Local Variables:
11710 ;; coding: iso-8859-1
11713 ;;; gnus-sum.el ends here