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-move-group-prefix-function 'gnus-group-real-prefix
426 "Function used to compute default prefix for article move/copy/etc prompts.
427 The function should take one argument, a group name, and return a
428 string with the suggested prefix."
429 :group 'gnus-summary-mail
432 (defcustom gnus-unread-mark ? ;Whitespace
433 "*Mark used for unread articles."
434 :group 'gnus-summary-marks
437 (defcustom gnus-ticked-mark ?!
438 "*Mark used for ticked articles."
439 :group 'gnus-summary-marks
442 (defcustom gnus-dormant-mark ??
443 "*Mark used for dormant articles."
444 :group 'gnus-summary-marks
447 (defcustom gnus-del-mark ?r
448 "*Mark used for del'd articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-read-mark ?R
453 "*Mark used for read articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-expirable-mark ?E
458 "*Mark used for expirable articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-killed-mark ?K
463 "*Mark used for killed articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-spam-mark ?$
468 "*Mark used for spam articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-souped-mark ?F
473 "*Mark used for souped articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-kill-file-mark ?X
478 "*Mark used for articles killed by kill files."
479 :group 'gnus-summary-marks
482 (defcustom gnus-low-score-mark ?Y
483 "*Mark used for articles with a low score."
484 :group 'gnus-summary-marks
487 (defcustom gnus-catchup-mark ?C
488 "*Mark used for articles that are caught up."
489 :group 'gnus-summary-marks
492 (defcustom gnus-replied-mark ?A
493 "*Mark used for articles that have been replied to."
494 :group 'gnus-summary-marks
497 (defcustom gnus-forwarded-mark ?F
498 "*Mark used for articles that have been forwarded."
499 :group 'gnus-summary-marks
502 (defcustom gnus-recent-mark ?N
503 "*Mark used for articles that are recent."
504 :group 'gnus-summary-marks
507 (defcustom gnus-cached-mark ?*
508 "*Mark used for articles that are in the cache."
509 :group 'gnus-summary-marks
512 (defcustom gnus-saved-mark ?S
513 "*Mark used for articles that have been saved."
514 :group 'gnus-summary-marks
517 (defcustom gnus-unseen-mark ?.
518 "*Mark used for articles that haven't been seen."
519 :group 'gnus-summary-marks
522 (defcustom gnus-no-mark ? ;Whitespace
523 "*Mark used for articles that have no other secondary mark."
524 :group 'gnus-summary-marks
527 (defcustom gnus-ancient-mark ?O
528 "*Mark used for ancient articles."
529 :group 'gnus-summary-marks
532 (defcustom gnus-sparse-mark ?Q
533 "*Mark used for sparsely reffed articles."
534 :group 'gnus-summary-marks
537 (defcustom gnus-canceled-mark ?G
538 "*Mark used for canceled articles."
539 :group 'gnus-summary-marks
542 (defcustom gnus-duplicate-mark ?M
543 "*Mark used for duplicate articles."
544 :group 'gnus-summary-marks
547 (defcustom gnus-undownloaded-mark ?-
548 "*Mark used for articles that weren't downloaded."
549 :group 'gnus-summary-marks
552 (defcustom gnus-downloaded-mark ?+
553 "*Mark used for articles that were downloaded."
554 :group 'gnus-summary-marks
557 (defcustom gnus-downloadable-mark ?%
558 "*Mark used for articles that are to be downloaded."
559 :group 'gnus-summary-marks
562 (defcustom gnus-unsendable-mark ?=
563 "*Mark used for articles that won't be sent."
564 :group 'gnus-summary-marks
567 (defcustom gnus-score-over-mark ?+
568 "*Score mark used for articles with high scores."
569 :group 'gnus-summary-marks
572 (defcustom gnus-score-below-mark ?-
573 "*Score mark used for articles with low scores."
574 :group 'gnus-summary-marks
577 (defcustom gnus-empty-thread-mark ? ;Whitespace
578 "*There is no thread under the article."
579 :group 'gnus-summary-marks
582 (defcustom gnus-not-empty-thread-mark ?=
583 "*There is a thread under the article."
584 :group 'gnus-summary-marks
587 (defcustom gnus-view-pseudo-asynchronously nil
588 "*If non-nil, Gnus will view pseudo-articles asynchronously."
589 :group 'gnus-extract-view
592 (defcustom gnus-auto-expirable-marks
593 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
594 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
595 gnus-souped-mark gnus-duplicate-mark)
596 "*The list of marks converted into expiration if a group is auto-expirable."
599 :type '(repeat character))
601 (defcustom gnus-inhibit-user-auto-expire t
602 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
607 (defcustom gnus-view-pseudos nil
608 "*If `automatic', pseudo-articles will be viewed automatically.
609 If `not-confirm', pseudos will be viewed automatically, and the user
610 will not be asked to confirm the command."
611 :group 'gnus-extract-view
612 :type '(choice (const :tag "off" nil)
614 (const not-confirm)))
616 (defcustom gnus-view-pseudos-separately t
617 "*If non-nil, one pseudo-article will be created for each file to be viewed.
618 If nil, all files that use the same viewing command will be given as a
619 list of parameters to that command."
620 :group 'gnus-extract-view
623 (defcustom gnus-insert-pseudo-articles t
624 "*If non-nil, insert pseudo-articles when decoding articles."
625 :group 'gnus-extract-view
628 (defcustom gnus-summary-dummy-line-format
630 "*The format specification for the dummy roots in the summary buffer.
631 It works along the same lines as a normal formatting string,
632 with some simple extensions.
636 General format specifiers can also be used.
637 See `(gnus)Formatting Variables'."
638 :link '(custom-manual "(gnus)Formatting Variables")
639 :group 'gnus-threading
642 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
643 "*The format specification for the summary mode line.
644 It works along the same lines as a normal formatting string,
645 with some simple extensions:
648 %p Unprefixed group name
649 %A Current article number
650 %z Current article score
652 %U Number of unread articles in the group
653 %e Number of unselected articles in the group
654 %Z A string with unread/unselected article counts
655 %g Shortish group name
656 %S Subject of the current article
658 %s Current score file name
659 %d Number of dormant articles
660 %r Number of articles that have been marked as read in this session
661 %E Number of articles expunged by the score files"
662 :group 'gnus-summary-format
665 (defcustom gnus-list-identifiers nil
666 "Regexp that matches list identifiers to be removed from subject.
667 This can also be a list of regexps."
669 :group 'gnus-summary-format
670 :group 'gnus-article-hiding
671 :type '(choice (const :tag "none" nil)
673 (repeat :value (".*") regexp)))
675 (defcustom gnus-summary-mark-below 0
676 "*Mark all articles with a score below this variable as read.
677 This variable is local to each summary buffer and usually set by the
679 :group 'gnus-score-default
682 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
683 "*List of functions used for sorting articles in the summary buffer.
685 Each function takes two articles and returns non-nil if the first
686 article should be sorted before the other. If you use more than one
687 function, the primary sort function should be the last. You should
688 probably always include `gnus-article-sort-by-number' in the list of
689 sorting functions -- preferably first. Also note that sorting by date
690 is often much slower than sorting by number, and the sorting order is
691 very similar. (Sorting by date means sorting by the time the message
692 was sent, sorting by number means sorting by arrival time.)
694 Ready-made functions include `gnus-article-sort-by-number',
695 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
696 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
697 and `gnus-article-sort-by-score'.
699 When threading is turned on, the variable `gnus-thread-sort-functions'
700 controls how articles are sorted."
701 :group 'gnus-summary-sort
702 :type '(repeat (choice (function-item gnus-article-sort-by-number)
703 (function-item gnus-article-sort-by-author)
704 (function-item gnus-article-sort-by-subject)
705 (function-item gnus-article-sort-by-date)
706 (function-item gnus-article-sort-by-score)
707 (function-item gnus-article-sort-by-random)
708 (function :tag "other"))))
710 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
711 "*List of functions used for sorting threads in the summary buffer.
712 By default, threads are sorted by article number.
714 Each function takes two threads and returns non-nil if the first
715 thread should be sorted before the other. If you use more than one
716 function, the primary sort function should be the last. You should
717 probably always include `gnus-thread-sort-by-number' in the list of
718 sorting functions -- preferably first. Also note that sorting by date
719 is often much slower than sorting by number, and the sorting order is
720 very similar. (Sorting by date means sorting by the time the message
721 was sent, sorting by number means sorting by arrival time.)
723 Ready-made functions include `gnus-thread-sort-by-number',
724 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
725 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
726 `gnus-thread-sort-by-most-recent-number',
727 `gnus-thread-sort-by-most-recent-date',
728 `gnus-thread-sort-by-random', and
729 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
731 When threading is turned off, the variable
732 `gnus-article-sort-functions' controls how articles are sorted."
733 :group 'gnus-summary-sort
734 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
735 (function-item gnus-thread-sort-by-author)
736 (function-item gnus-thread-sort-by-subject)
737 (function-item gnus-thread-sort-by-date)
738 (function-item gnus-thread-sort-by-score)
739 (function-item gnus-thread-sort-by-total-score)
740 (function-item gnus-thread-sort-by-random)
741 (function :tag "other"))))
743 (defcustom gnus-thread-score-function '+
744 "*Function used for calculating the total score of a thread.
746 The function is called with the scores of the article and each
747 subthread and should then return the score of the thread.
749 Some functions you can use are `+', `max', or `min'."
750 :group 'gnus-summary-sort
753 (defcustom gnus-summary-expunge-below nil
754 "All articles that have a score less than this variable will be expunged.
755 This variable is local to the summary buffers."
756 :group 'gnus-score-default
757 :type '(choice (const :tag "off" nil)
760 (defcustom gnus-thread-expunge-below nil
761 "All threads that have a total score less than this variable will be expunged.
762 See `gnus-thread-score-function' for en explanation of what a
765 This variable is local to the summary buffers."
766 :group 'gnus-threading
767 :group 'gnus-score-default
768 :type '(choice (const :tag "off" nil)
771 (defcustom gnus-summary-mode-hook nil
772 "*A hook for Gnus summary mode.
773 This hook is run before any variables are set in the summary buffer."
774 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
775 :group 'gnus-summary-various
778 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
779 (when (featurep 'xemacs)
780 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
781 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
782 (add-hook 'gnus-summary-mode-hook
783 'gnus-xmas-switch-horizontal-scrollbar-off))
785 (defcustom gnus-summary-menu-hook nil
786 "*Hook run after the creation of the summary mode menu."
787 :group 'gnus-summary-visual
790 (defcustom gnus-summary-exit-hook nil
791 "*A hook called on exit from the summary buffer.
792 It will be called with point in the group buffer."
793 :group 'gnus-summary-exit
796 (defcustom gnus-summary-prepare-hook nil
797 "*A hook called after the summary buffer has been generated.
798 If you want to modify the summary buffer, you can use this hook."
799 :group 'gnus-summary-various
802 (defcustom gnus-summary-prepared-hook nil
803 "*A hook called as the last thing after the summary buffer has been generated."
804 :group 'gnus-summary-various
807 (defcustom gnus-summary-generate-hook nil
808 "*A hook run just before generating the summary buffer.
809 This hook is commonly used to customize threading variables and the
811 :group 'gnus-summary-various
814 (defcustom gnus-select-group-hook nil
815 "*A hook called when a newsgroup is selected.
817 If you'd like to simplify subjects like the
818 `gnus-summary-next-same-subject' command does, you can use the
821 (add-hook gnus-select-group-hook
823 (mapcar (lambda (header)
824 (mail-header-set-subject
826 (gnus-simplify-subject
827 (mail-header-subject header) 're-only)))
828 gnus-newsgroup-headers)))"
829 :group 'gnus-group-select
832 (defcustom gnus-select-article-hook nil
833 "*A hook called when an article is selected."
834 :group 'gnus-summary-choose
835 :options '(gnus-agent-fetch-selected-article)
838 (defcustom gnus-visual-mark-article-hook
839 (list 'gnus-highlight-selected-summary)
840 "*Hook run after selecting an article in the summary buffer.
841 It is meant to be used for highlighting the article in some way. It
842 is not run if `gnus-visual' is nil."
843 :group 'gnus-summary-visual
846 (defcustom gnus-parse-headers-hook nil
847 "*A hook called before parsing the headers."
851 (defcustom gnus-exit-group-hook nil
852 "*A hook called when exiting summary mode.
853 This hook is not called from the non-updating exit commands like `Q'."
857 (defcustom gnus-summary-update-hook
858 (list 'gnus-summary-highlight-line)
859 "*A hook called when a summary line is changed.
860 The hook will not be called if `gnus-visual' is nil.
862 The default function `gnus-summary-highlight-line' will
863 highlight the line according to the `gnus-summary-highlight'
865 :group 'gnus-summary-visual
868 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
869 "*A hook called when an article is selected for the first time.
870 The hook is intended to mark an article as read (or unread)
871 automatically when it is selected."
872 :group 'gnus-summary-choose
875 (defcustom gnus-group-no-more-groups-hook nil
876 "*A hook run when returning to group mode having no more (unread) groups."
877 :group 'gnus-group-select
880 (defcustom gnus-ps-print-hook nil
881 "*A hook run before ps-printing something from Gnus."
885 (defcustom gnus-summary-article-move-hook nil
886 "*A hook called after an article is moved, copied, respooled, or crossposted."
890 (defcustom gnus-summary-article-delete-hook nil
891 "*A hook called after an article is deleted."
895 (defcustom gnus-summary-article-expire-hook nil
896 "*A hook called after an article is expired."
900 (defcustom gnus-summary-display-arrow
901 (and (fboundp 'display-graphic-p)
903 "*If non-nil, display an arrow highlighting the current article."
908 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
909 "Face used for highlighting the current article in the summary buffer."
910 :group 'gnus-summary-visual
913 (defvar gnus-tmp-downloaded nil)
915 (defcustom gnus-summary-highlight
916 '(((eq mark gnus-canceled-mark)
917 . gnus-summary-cancelled-face)
918 ((and uncached (> score default-high))
919 . gnus-summary-high-undownloaded-face)
920 ((and uncached (< score default-low))
921 . gnus-summary-low-undownloaded-face)
923 . gnus-summary-normal-undownloaded-face)
924 ((and (> score default-high)
925 (or (eq mark gnus-dormant-mark)
926 (eq mark gnus-ticked-mark)))
927 . gnus-summary-high-ticked-face)
928 ((and (< score default-low)
929 (or (eq mark gnus-dormant-mark)
930 (eq mark gnus-ticked-mark)))
931 . gnus-summary-low-ticked-face)
932 ((or (eq mark gnus-dormant-mark)
933 (eq mark gnus-ticked-mark))
934 . gnus-summary-normal-ticked-face)
935 ((and (> score default-high) (eq mark gnus-ancient-mark))
936 . gnus-summary-high-ancient-face)
937 ((and (< score default-low) (eq mark gnus-ancient-mark))
938 . gnus-summary-low-ancient-face)
939 ((eq mark gnus-ancient-mark)
940 . gnus-summary-normal-ancient-face)
941 ((and (> score default-high) (eq mark gnus-unread-mark))
942 . gnus-summary-high-unread-face)
943 ((and (< score default-low) (eq mark gnus-unread-mark))
944 . gnus-summary-low-unread-face)
945 ((eq mark gnus-unread-mark)
946 . gnus-summary-normal-unread-face)
947 ((> score default-high)
948 . gnus-summary-high-read-face)
949 ((< score default-low)
950 . gnus-summary-low-read-face)
952 . gnus-summary-normal-read-face))
953 "*Controls the highlighting of summary buffer lines.
955 A list of (FORM . FACE) pairs. When deciding how a a particular
956 summary line should be displayed, each form is evaluated. The content
957 of the face field after the first true form is used. You can change
958 how those summary lines are displayed, by editing the face field.
960 You can use the following variables in the FORM field.
962 score: The article's score
963 default: The default article score.
964 default-high: The default score for high scored articles.
965 default-low: The default score for low scored articles.
966 below: The score below which articles are automatically marked as read.
967 mark: The article's mark.
968 uncached: Non-nil if the article is uncached."
969 :group 'gnus-summary-visual
970 :type '(repeat (cons (sexp :tag "Form" nil)
973 (defcustom gnus-alter-header-function nil
974 "Function called to allow alteration of article header structures.
975 The function is called with one parameter, the article header vector,
976 which it may alter in any way."
977 :type '(choice (const :tag "None" nil)
979 :group 'gnus-summary)
981 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
982 "Variable that says which function should be used to decode a string with encoded words.")
984 (defcustom gnus-extra-headers '(To Newsgroups)
985 "*Extra headers to parse."
988 :type '(repeat symbol))
990 (defcustom gnus-ignored-from-addresses
991 (and user-mail-address (regexp-quote user-mail-address))
992 "*Regexp of From headers that may be suppressed in favor of To headers."
997 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
998 "List of charsets that should be ignored.
999 When these charsets are used in the \"charset\" parameter, the
1000 default charset will be used instead."
1002 :type '(repeat symbol)
1003 :group 'gnus-charset)
1005 (gnus-define-group-parameter
1009 "Return the ignored charsets of GROUP."
1010 :variable gnus-group-ignored-charsets-alist
1012 '(("alt\\.chinese\\.text" iso-8859-1))
1014 "Alist of regexps (to match group names) and charsets that should be ignored.
1015 When these charsets are used in the \"charset\" parameter, the
1016 default charset will be used instead."
1017 :variable-group gnus-charset
1018 :variable-type '(repeat (cons (regexp :tag "Group")
1020 :parameter-type '(choice :tag "Ignored charsets"
1023 :parameter-document "\
1024 List of charsets that should be ignored.
1026 When these charsets are used in the \"charset\" parameter, the
1027 default charset will be used instead.")
1029 (defcustom gnus-group-highlight-words-alist nil
1030 "Alist of group regexps and highlight regexps.
1031 This variable uses the same syntax as `gnus-emphasis-alist'."
1033 :type '(repeat (cons (regexp :tag "Group")
1034 (repeat (list (regexp :tag "Highlight regexp")
1035 (number :tag "Group for entire word" 0)
1036 (number :tag "Group for displayed part" 0)
1038 gnus-emphasis-highlight-words)))))
1039 :group 'gnus-summary-visual)
1041 (defcustom gnus-summary-show-article-charset-alist
1043 "Alist of number and charset.
1044 The article will be shown with the charset corresponding to the
1046 For example: ((1 . cn-gb-2312) (2 . big5))."
1048 :type '(repeat (cons (number :tag "Argument" 1)
1049 (symbol :tag "Charset")))
1050 :group 'gnus-charset)
1052 (defcustom gnus-preserve-marks t
1053 "Whether marks are preserved when moving, copying and respooling messages."
1056 :group 'gnus-summary-marks)
1058 (defcustom gnus-alter-articles-to-read-function nil
1059 "Function to be called to alter the list of articles to be selected."
1060 :type '(choice (const nil) function)
1061 :group 'gnus-summary)
1063 (defcustom gnus-orphan-score nil
1064 "*All orphans get this score added. Set in the score file."
1065 :group 'gnus-score-default
1066 :type '(choice (const nil)
1069 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1070 "*A regexp to match MIME parts when saving multiple parts of a
1071 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1072 This regexp will be used by default when prompting the user for which
1073 type of files to save."
1074 :group 'gnus-summary
1077 (defcustom gnus-read-all-available-headers nil
1078 "Whether Gnus should parse all headers made available to it.
1079 This is mostly relevant for slow back ends where the user may
1080 wish to widen the summary buffer to include all headers
1081 that were fetched. Say, for nnultimate groups."
1082 :group 'gnus-summary
1083 :type '(choice boolean regexp))
1085 (defcustom gnus-summary-muttprint-program "muttprint"
1086 "Command (and optional arguments) used to run Muttprint."
1088 :group 'gnus-summary
1091 (defcustom gnus-article-loose-mime nil
1092 "If non-nil, don't require MIME-Version header.
1093 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1094 supply the MIME-Version header or deliberately strip it From the mail.
1095 Set it to non-nil, Gnus will treat some articles as MIME even if
1096 the MIME-Version header is missed."
1099 :group 'gnus-article-mime)
1101 (defcustom gnus-article-emulate-mime t
1102 "If non-nil, use MIME emulation for uuencode and the like.
1103 This means that Gnus will search message bodies for text that look
1104 like uuencoded bits, yEncoded bits, and so on, and present that using
1105 the normal Gnus MIME machinery."
1107 :group 'gnus-article-mime)
1109 ;;; Internal variables
1111 (defvar gnus-summary-display-cache nil)
1112 (defvar gnus-article-mime-handles nil)
1113 (defvar gnus-article-decoded-p nil)
1114 (defvar gnus-article-charset nil)
1115 (defvar gnus-article-ignored-charsets nil)
1116 (defvar gnus-scores-exclude-files nil)
1117 (defvar gnus-page-broken nil)
1119 (defvar gnus-original-article nil)
1120 (defvar gnus-article-internal-prepare-hook nil)
1121 (defvar gnus-newsgroup-process-stack nil)
1123 (defvar gnus-thread-indent-array nil)
1124 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1125 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1126 "Function called to sort the articles within a thread after it has been gathered together.")
1128 (defvar gnus-summary-save-parts-type-history nil)
1129 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1131 ;; Avoid highlighting in kill files.
1132 (defvar gnus-summary-inhibit-highlight nil)
1133 (defvar gnus-newsgroup-selected-overlay nil)
1134 (defvar gnus-inhibit-limiting nil)
1135 (defvar gnus-newsgroup-adaptive-score-file nil)
1136 (defvar gnus-current-score-file nil)
1137 (defvar gnus-current-move-group nil)
1138 (defvar gnus-current-copy-group nil)
1139 (defvar gnus-current-crosspost-group nil)
1140 (defvar gnus-newsgroup-display nil)
1142 (defvar gnus-newsgroup-dependencies nil)
1143 (defvar gnus-newsgroup-adaptive nil)
1144 (defvar gnus-summary-display-article-function nil)
1145 (defvar gnus-summary-highlight-line-function nil
1146 "Function called after highlighting a summary line.")
1148 (defvar gnus-summary-line-format-alist
1149 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1150 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1151 (?s gnus-tmp-subject-or-nil ?s)
1152 (?n gnus-tmp-name ?s)
1153 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1155 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1157 (?F gnus-tmp-from ?s)
1158 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1159 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1160 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1161 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1162 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1163 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1164 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1165 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1166 (?L gnus-tmp-lines ?s)
1167 (?O gnus-tmp-downloaded ?c)
1168 (?I gnus-tmp-indentation ?s)
1169 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1170 (?R gnus-tmp-replied ?c)
1171 (?\[ gnus-tmp-opening-bracket ?c)
1172 (?\] gnus-tmp-closing-bracket ?c)
1173 (?\> (make-string gnus-tmp-level ? ) ?s)
1174 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1175 (?i gnus-tmp-score ?d)
1176 (?z gnus-tmp-score-char ?c)
1177 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1178 (?U gnus-tmp-unread ?c)
1179 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1181 (?t (gnus-summary-number-of-articles-in-thread
1182 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1184 (?e (gnus-summary-number-of-articles-in-thread
1185 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1187 (?u gnus-tmp-user-defined ?s)
1188 (?P (gnus-pick-line-number) ?d)
1189 (?B gnus-tmp-thread-tree-header-string ?s)
1190 (user-date (gnus-user-date
1191 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1192 "An alist of format specifications that can appear in summary lines.
1193 These are paired with what variables they correspond with, along with
1194 the type of the variable (string, integer, character, etc).")
1196 (defvar gnus-summary-dummy-line-format-alist
1197 `((?S gnus-tmp-subject ?s)
1198 (?N gnus-tmp-number ?d)
1199 (?u gnus-tmp-user-defined ?s)))
1201 (defvar gnus-summary-mode-line-format-alist
1202 `((?G gnus-tmp-group-name ?s)
1203 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1204 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1205 (?A gnus-tmp-article-number ?d)
1206 (?Z gnus-tmp-unread-and-unselected ?s)
1207 (?V gnus-version ?s)
1208 (?U gnus-tmp-unread-and-unticked ?d)
1209 (?S gnus-tmp-subject ?s)
1210 (?e gnus-tmp-unselected ?d)
1211 (?u gnus-tmp-user-defined ?s)
1212 (?d (length gnus-newsgroup-dormant) ?d)
1213 (?t (length gnus-newsgroup-marked) ?d)
1214 (?h (length gnus-newsgroup-spam-marked) ?d)
1215 (?r (length gnus-newsgroup-reads) ?d)
1216 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1217 (?E gnus-newsgroup-expunged-tally ?d)
1218 (?s (gnus-current-score-file-nondirectory) ?s)))
1220 (defvar gnus-last-search-regexp nil
1221 "Default regexp for article search command.")
1223 (defvar gnus-last-shell-command nil
1224 "Default shell command on article.")
1226 (defvar gnus-newsgroup-agentized nil
1227 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1228 (defvar gnus-newsgroup-begin nil)
1229 (defvar gnus-newsgroup-end nil)
1230 (defvar gnus-newsgroup-last-rmail nil)
1231 (defvar gnus-newsgroup-last-mail nil)
1232 (defvar gnus-newsgroup-last-folder nil)
1233 (defvar gnus-newsgroup-last-file nil)
1234 (defvar gnus-newsgroup-auto-expire nil)
1235 (defvar gnus-newsgroup-active nil)
1237 (defvar gnus-newsgroup-data nil)
1238 (defvar gnus-newsgroup-data-reverse nil)
1239 (defvar gnus-newsgroup-limit nil)
1240 (defvar gnus-newsgroup-limits nil)
1241 (defvar gnus-summary-use-undownloaded-faces nil)
1243 (defvar gnus-newsgroup-unreads nil
1244 "Sorted list of unread articles in the current newsgroup.")
1246 (defvar gnus-newsgroup-unselected nil
1247 "Sorted list of unselected unread articles in the current newsgroup.")
1249 (defvar gnus-newsgroup-reads nil
1250 "Alist of read articles and article marks in the current newsgroup.")
1252 (defvar gnus-newsgroup-expunged-tally nil)
1254 (defvar gnus-newsgroup-marked nil
1255 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1257 (defvar gnus-newsgroup-spam-marked nil
1258 "List of ranges of articles that have been marked as spam.")
1260 (defvar gnus-newsgroup-killed nil
1261 "List of ranges of articles that have been through the scoring process.")
1263 (defvar gnus-newsgroup-cached nil
1264 "Sorted list of articles that come from the article cache.")
1266 (defvar gnus-newsgroup-saved nil
1267 "List of articles that have been saved.")
1269 (defvar gnus-newsgroup-kill-headers nil)
1271 (defvar gnus-newsgroup-replied nil
1272 "List of articles that have been replied to in the current newsgroup.")
1274 (defvar gnus-newsgroup-forwarded nil
1275 "List of articles that have been forwarded in the current newsgroup.")
1277 (defvar gnus-newsgroup-recent nil
1278 "List of articles that have are recent in the current newsgroup.")
1280 (defvar gnus-newsgroup-expirable nil
1281 "Sorted list of articles in the current newsgroup that can be expired.")
1283 (defvar gnus-newsgroup-processable nil
1284 "List of articles in the current newsgroup that can be processed.")
1286 (defvar gnus-newsgroup-downloadable nil
1287 "Sorted list of articles in the current newsgroup that can be processed.")
1289 (defvar gnus-newsgroup-unfetched nil
1290 "Sorted list of articles in the current newsgroup whose headers have
1291 not been fetched into the agent.
1293 This list will always be a subset of gnus-newsgroup-undownloaded.")
1295 (defvar gnus-newsgroup-undownloaded nil
1296 "List of articles in the current newsgroup that haven't been downloaded.")
1298 (defvar gnus-newsgroup-unsendable nil
1299 "List of articles in the current newsgroup that won't be sent.")
1301 (defvar gnus-newsgroup-bookmarks nil
1302 "List of articles in the current newsgroup that have bookmarks.")
1304 (defvar gnus-newsgroup-dormant nil
1305 "Sorted list of dormant articles in the current newsgroup.")
1307 (defvar gnus-newsgroup-unseen nil
1308 "List of unseen articles in the current newsgroup.")
1310 (defvar gnus-newsgroup-seen nil
1311 "Range of seen articles in the current newsgroup.")
1313 (defvar gnus-newsgroup-articles nil
1314 "List of articles in the current newsgroup.")
1316 (defvar gnus-newsgroup-scored nil
1317 "List of scored articles in the current newsgroup.")
1319 (defvar gnus-newsgroup-headers nil
1320 "List of article headers in the current newsgroup.")
1322 (defvar gnus-newsgroup-threads nil)
1324 (defvar gnus-newsgroup-prepared nil
1325 "Whether the current group has been prepared properly.")
1327 (defvar gnus-newsgroup-ancient nil
1328 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1330 (defvar gnus-newsgroup-sparse nil)
1332 (defvar gnus-current-article nil)
1333 (defvar gnus-article-current nil)
1334 (defvar gnus-current-headers nil)
1335 (defvar gnus-have-all-headers nil)
1336 (defvar gnus-last-article nil)
1337 (defvar gnus-newsgroup-history nil)
1338 (defvar gnus-newsgroup-charset nil)
1339 (defvar gnus-newsgroup-ephemeral-charset nil)
1340 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1342 (defvar gnus-article-before-search nil)
1344 (defvar gnus-summary-local-variables
1345 '(gnus-newsgroup-name
1346 gnus-newsgroup-begin gnus-newsgroup-end
1347 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1348 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1349 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1350 gnus-newsgroup-unselected gnus-newsgroup-marked
1351 gnus-newsgroup-spam-marked
1352 gnus-newsgroup-reads gnus-newsgroup-saved
1353 gnus-newsgroup-replied gnus-newsgroup-forwarded
1354 gnus-newsgroup-recent
1355 gnus-newsgroup-expirable
1356 gnus-newsgroup-processable gnus-newsgroup-killed
1357 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1358 gnus-newsgroup-unfetched
1359 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1360 gnus-newsgroup-seen gnus-newsgroup-articles
1361 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1362 gnus-newsgroup-headers gnus-newsgroup-threads
1363 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1364 gnus-current-article gnus-current-headers gnus-have-all-headers
1365 gnus-last-article gnus-article-internal-prepare-hook
1366 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1367 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1368 gnus-thread-expunge-below
1369 gnus-score-alist gnus-current-score-file
1370 (gnus-summary-expunge-below . global)
1371 (gnus-summary-mark-below . global)
1372 (gnus-orphan-score . global)
1373 gnus-newsgroup-active gnus-scores-exclude-files
1374 gnus-newsgroup-history gnus-newsgroup-ancient
1375 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1376 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1377 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1378 (gnus-newsgroup-expunged-tally . 0)
1379 gnus-cache-removable-articles gnus-newsgroup-cached
1380 gnus-newsgroup-data gnus-newsgroup-data-reverse
1381 gnus-newsgroup-limit gnus-newsgroup-limits
1382 gnus-newsgroup-charset gnus-newsgroup-display
1383 gnus-summary-use-undownloaded-faces)
1384 "Variables that are buffer-local to the summary buffers.")
1386 (defvar gnus-newsgroup-variables nil
1387 "A list of variables that have separate values in different newsgroups.
1388 A list of newsgroup (summary buffer) local variables, or cons of
1389 variables and their default values (when the default values are not
1390 nil), that should be made global while the summary buffer is active.
1391 These variables can be used to set variables in the group parameters
1392 while still allowing them to affect operations done in other
1393 buffers. For example:
1395 \(setq gnus-newsgroup-variables
1396 '(message-use-followup-to
1397 (gnus-visible-headers .
1398 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1401 ;; Byte-compiler warning.
1403 ;; Bind features so that require will believe that gnus-sum has
1404 ;; already been loaded (avoids infinite recursion)
1405 (let ((features (cons 'gnus-sum features)))
1406 ;; Several of the declarations in gnus-sum are needed to load the
1407 ;; following files. Right now, these definitions have been
1408 ;; compiled but not defined (evaluated). We could either do a
1409 ;; eval-and-compile about all of the declarations or evaluate the
1411 (if (boundp 'gnus-newsgroup-variables)
1413 (load "gnus-sum.el" t t t))
1415 (require 'gnus-agent)
1416 (require 'gnus-art)))
1420 (defvar gnus-decode-encoded-word-methods
1421 '(mail-decode-encoded-word-string)
1422 "List of methods used to decode encoded words.
1424 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1425 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1426 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1427 whose names match REGEXP.
1430 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1431 mail-decode-encoded-word-string
1432 (\"chinese\" . rfc1843-decode-string))")
1434 (defvar gnus-decode-encoded-word-methods-cache nil)
1436 (defun gnus-multi-decode-encoded-word-string (string)
1437 "Apply the functions from `gnus-encoded-word-methods' that match."
1438 (unless (and gnus-decode-encoded-word-methods-cache
1439 (eq gnus-newsgroup-name
1440 (car gnus-decode-encoded-word-methods-cache)))
1441 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1444 (nconc gnus-decode-encoded-word-methods-cache (list x))
1445 (if (and gnus-newsgroup-name
1446 (string-match (car x) gnus-newsgroup-name))
1447 (nconc gnus-decode-encoded-word-methods-cache
1449 gnus-decode-encoded-word-methods))
1450 (let ((xlist gnus-decode-encoded-word-methods-cache))
1453 (setq string (funcall (pop xlist) string))))
1456 ;; Subject simplification.
1458 (defun gnus-simplify-whitespace (str)
1459 "Remove excessive whitespace from STR."
1461 (while (string-match "[ \t][ \t]+" str)
1462 (setq str (concat (substring str 0 (match-beginning 0))
1464 (substring str (match-end 0)))))
1466 (when (string-match "^[ \t]+" str)
1467 (setq str (substring str (match-end 0))))
1469 (when (string-match "[ \t]+$" str)
1470 (setq str (substring str 0 (match-beginning 0))))
1473 (defun gnus-simplify-all-whitespace (str)
1474 "Remove all whitespace from STR."
1475 (while (string-match "[ \t\n]+" str)
1476 (setq str (replace-match "" nil nil str)))
1479 (defsubst gnus-simplify-subject-re (subject)
1480 "Remove \"Re:\" from subject lines."
1481 (if (string-match message-subject-re-regexp subject)
1482 (substring subject (match-end 0))
1485 (defun gnus-simplify-subject (subject &optional re-only)
1486 "Remove `Re:' and words in parentheses.
1487 If RE-ONLY is non-nil, strip leading `Re:'s only."
1488 (let ((case-fold-search t)) ;Ignore case.
1489 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1490 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1491 (setq subject (substring subject (match-end 0))))
1492 ;; Remove uninteresting prefixes.
1493 (when (and (not re-only)
1494 gnus-simplify-ignored-prefixes
1495 (string-match gnus-simplify-ignored-prefixes subject))
1496 (setq subject (substring subject (match-end 0))))
1497 ;; Remove words in parentheses from end.
1499 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1500 (setq subject (substring subject 0 (match-beginning 0)))))
1501 ;; Return subject string.
1504 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1506 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1507 (goto-char (point-min))
1508 (while (re-search-forward regexp nil t)
1509 (replace-match (or newtext ""))))
1511 (defun gnus-simplify-buffer-fuzzy ()
1512 "Simplify string in the buffer fuzzily.
1513 The string in the accessible portion of the current buffer is simplified.
1514 It is assumed to be a single-line subject.
1515 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1516 matter is removed. Additional things can be deleted by setting
1517 `gnus-simplify-subject-fuzzy-regexp'."
1518 (let ((case-fold-search t)
1520 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1522 (while (not (eq modified-tick (buffer-modified-tick)))
1523 (setq modified-tick (buffer-modified-tick))
1525 ((listp gnus-simplify-subject-fuzzy-regexp)
1526 (mapcar 'gnus-simplify-buffer-fuzzy-step
1527 gnus-simplify-subject-fuzzy-regexp))
1528 (gnus-simplify-subject-fuzzy-regexp
1529 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1530 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1531 (gnus-simplify-buffer-fuzzy-step
1532 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1533 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1535 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1536 (gnus-simplify-buffer-fuzzy-step " +" " ")
1537 (gnus-simplify-buffer-fuzzy-step " $")
1538 (gnus-simplify-buffer-fuzzy-step "^ +")))
1540 (defun gnus-simplify-subject-fuzzy (subject)
1541 "Simplify a subject string fuzzily.
1542 See `gnus-simplify-buffer-fuzzy' for details."
1544 (gnus-set-work-buffer)
1545 (let ((case-fold-search t))
1546 ;; Remove uninteresting prefixes.
1547 (when (and gnus-simplify-ignored-prefixes
1548 (string-match gnus-simplify-ignored-prefixes subject))
1549 (setq subject (substring subject (match-end 0))))
1551 (inline (gnus-simplify-buffer-fuzzy))
1554 (defsubst gnus-simplify-subject-fully (subject)
1555 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1557 (gnus-simplify-subject-functions
1558 (gnus-map-function gnus-simplify-subject-functions subject))
1559 ((null gnus-summary-gather-subject-limit)
1560 (gnus-simplify-subject-re subject))
1561 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1562 (gnus-simplify-subject-fuzzy subject))
1563 ((numberp gnus-summary-gather-subject-limit)
1564 (gnus-limit-string (gnus-simplify-subject-re subject)
1565 gnus-summary-gather-subject-limit))
1569 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1570 "Check whether two subjects are equal.
1571 If optional argument SIMPLE-FIRST is t, first argument is already
1574 ((null simple-first)
1575 (equal (gnus-simplify-subject-fully s1)
1576 (gnus-simplify-subject-fully s2)))
1579 (gnus-simplify-subject-fully s2)))))
1581 (defun gnus-summary-bubble-group ()
1582 "Increase the score of the current group.
1583 This is a handy function to add to `gnus-summary-exit-hook' to
1584 increase the score of each group you read."
1585 (gnus-group-add-score gnus-newsgroup-name))
1589 ;;; Gnus summary mode
1592 (put 'gnus-summary-mode 'mode-class 'special)
1594 (defvar gnus-article-commands-menu)
1596 ;; Non-orthogonal keys
1598 (gnus-define-keys gnus-summary-mode-map
1599 " " gnus-summary-next-page
1600 "\177" gnus-summary-prev-page
1601 [delete] gnus-summary-prev-page
1602 [backspace] gnus-summary-prev-page
1603 "\r" gnus-summary-scroll-up
1604 "\M-\r" gnus-summary-scroll-down
1605 "n" gnus-summary-next-unread-article
1606 "p" gnus-summary-prev-unread-article
1607 "N" gnus-summary-next-article
1608 "P" gnus-summary-prev-article
1609 "\M-\C-n" gnus-summary-next-same-subject
1610 "\M-\C-p" gnus-summary-prev-same-subject
1611 "\M-n" gnus-summary-next-unread-subject
1612 "\M-p" gnus-summary-prev-unread-subject
1613 "." gnus-summary-first-unread-article
1614 "," gnus-summary-best-unread-article
1615 "\M-s" gnus-summary-search-article-forward
1616 "\M-r" gnus-summary-search-article-backward
1617 "<" gnus-summary-beginning-of-article
1618 ">" gnus-summary-end-of-article
1619 "j" gnus-summary-goto-article
1620 "^" gnus-summary-refer-parent-article
1621 "\M-^" gnus-summary-refer-article
1622 "u" gnus-summary-tick-article-forward
1623 "!" gnus-summary-tick-article-forward
1624 "U" gnus-summary-tick-article-backward
1625 "d" gnus-summary-mark-as-read-forward
1626 "D" gnus-summary-mark-as-read-backward
1627 "E" gnus-summary-mark-as-expirable
1628 "\M-u" gnus-summary-clear-mark-forward
1629 "\M-U" gnus-summary-clear-mark-backward
1630 "k" gnus-summary-kill-same-subject-and-select
1631 "\C-k" gnus-summary-kill-same-subject
1632 "\M-\C-k" gnus-summary-kill-thread
1633 "\M-\C-l" gnus-summary-lower-thread
1634 "e" gnus-summary-edit-article
1635 "#" gnus-summary-mark-as-processable
1636 "\M-#" gnus-summary-unmark-as-processable
1637 "\M-\C-t" gnus-summary-toggle-threads
1638 "\M-\C-s" gnus-summary-show-thread
1639 "\M-\C-h" gnus-summary-hide-thread
1640 "\M-\C-f" gnus-summary-next-thread
1641 "\M-\C-b" gnus-summary-prev-thread
1642 [(meta down)] gnus-summary-next-thread
1643 [(meta up)] gnus-summary-prev-thread
1644 "\M-\C-u" gnus-summary-up-thread
1645 "\M-\C-d" gnus-summary-down-thread
1646 "&" gnus-summary-execute-command
1647 "c" gnus-summary-catchup-and-exit
1648 "\C-w" gnus-summary-mark-region-as-read
1649 "\C-t" gnus-summary-toggle-truncation
1650 "?" gnus-summary-mark-as-dormant
1651 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1652 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1653 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1654 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1655 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1656 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1657 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1658 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1659 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1660 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1661 "=" gnus-summary-expand-window
1662 "\C-x\C-s" gnus-summary-reselect-current-group
1663 "\M-g" gnus-summary-rescan-group
1664 "w" gnus-summary-stop-page-breaking
1665 "\C-c\C-r" gnus-summary-caesar-message
1666 "f" gnus-summary-followup
1667 "F" gnus-summary-followup-with-original
1668 "C" gnus-summary-cancel-article
1669 "r" gnus-summary-reply
1670 "R" gnus-summary-reply-with-original
1671 "\C-c\C-f" gnus-summary-mail-forward
1672 "o" gnus-summary-save-article
1673 "\C-o" gnus-summary-save-article-mail
1674 "|" gnus-summary-pipe-output
1675 "\M-k" gnus-summary-edit-local-kill
1676 "\M-K" gnus-summary-edit-global-kill
1678 "\C-c\C-d" gnus-summary-describe-group
1679 "q" gnus-summary-exit
1680 "Q" gnus-summary-exit-no-update
1681 "\C-c\C-i" gnus-info-find-node
1682 gnus-mouse-2 gnus-mouse-pick-article
1683 "m" gnus-summary-mail-other-window
1684 "a" gnus-summary-post-news
1685 "i" gnus-summary-news-other-window
1686 "x" gnus-summary-limit-to-unread
1687 "s" gnus-summary-isearch-article
1688 "t" gnus-summary-toggle-header
1689 "g" gnus-summary-show-article
1690 "l" gnus-summary-goto-last-article
1691 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1692 "\C-d" gnus-summary-enter-digest-group
1693 "\M-\C-d" gnus-summary-read-document
1694 "\M-\C-e" gnus-summary-edit-parameters
1695 "\M-\C-a" gnus-summary-customize-parameters
1697 "*" gnus-cache-enter-article
1698 "\M-*" gnus-cache-remove-article
1699 "\M-&" gnus-summary-universal-argument
1700 "\C-l" gnus-recenter
1701 "I" gnus-summary-increase-score
1702 "L" gnus-summary-lower-score
1703 "\M-i" gnus-symbolic-argument
1704 "h" gnus-summary-select-article-buffer
1706 "b" gnus-article-view-part
1707 "\M-t" gnus-summary-toggle-display-buttonized
1709 "V" gnus-summary-score-map
1710 "X" gnus-uu-extract-map
1711 "S" gnus-summary-send-map)
1713 ;; Sort of orthogonal keymap
1714 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1715 "t" gnus-summary-tick-article-forward
1716 "!" gnus-summary-tick-article-forward
1717 "d" gnus-summary-mark-as-read-forward
1718 "r" gnus-summary-mark-as-read-forward
1719 "c" gnus-summary-clear-mark-forward
1720 " " gnus-summary-clear-mark-forward
1721 "e" gnus-summary-mark-as-expirable
1722 "x" gnus-summary-mark-as-expirable
1723 "?" gnus-summary-mark-as-dormant
1724 "b" gnus-summary-set-bookmark
1725 "B" gnus-summary-remove-bookmark
1726 "#" gnus-summary-mark-as-processable
1727 "\M-#" gnus-summary-unmark-as-processable
1728 "S" gnus-summary-limit-include-expunged
1729 "C" gnus-summary-catchup
1730 "H" gnus-summary-catchup-to-here
1731 "h" gnus-summary-catchup-from-here
1732 "\C-c" gnus-summary-catchup-all
1733 "k" gnus-summary-kill-same-subject-and-select
1734 "K" gnus-summary-kill-same-subject
1735 "P" gnus-uu-mark-map)
1737 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1738 "c" gnus-summary-clear-above
1739 "u" gnus-summary-tick-above
1740 "m" gnus-summary-mark-above
1741 "k" gnus-summary-kill-below)
1743 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1744 "/" gnus-summary-limit-to-subject
1745 "n" gnus-summary-limit-to-articles
1746 "w" gnus-summary-pop-limit
1747 "s" gnus-summary-limit-to-subject
1748 "a" gnus-summary-limit-to-author
1749 "u" gnus-summary-limit-to-unread
1750 "m" gnus-summary-limit-to-marks
1751 "M" gnus-summary-limit-exclude-marks
1752 "v" gnus-summary-limit-to-score
1753 "*" gnus-summary-limit-include-cached
1754 "D" gnus-summary-limit-include-dormant
1755 "T" gnus-summary-limit-include-thread
1756 "d" gnus-summary-limit-exclude-dormant
1757 "t" gnus-summary-limit-to-age
1758 "." gnus-summary-limit-to-unseen
1759 "x" gnus-summary-limit-to-extra
1760 "p" gnus-summary-limit-to-display-predicate
1761 "E" gnus-summary-limit-include-expunged
1762 "c" gnus-summary-limit-exclude-childless-dormant
1763 "C" gnus-summary-limit-mark-excluded-as-read
1764 "o" gnus-summary-insert-old-articles
1765 "N" gnus-summary-insert-new-articles
1766 "r" gnus-summary-limit-to-replied)
1768 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1769 "n" gnus-summary-next-unread-article
1770 "p" gnus-summary-prev-unread-article
1771 "N" gnus-summary-next-article
1772 "P" gnus-summary-prev-article
1773 "\C-n" gnus-summary-next-same-subject
1774 "\C-p" gnus-summary-prev-same-subject
1775 "\M-n" gnus-summary-next-unread-subject
1776 "\M-p" gnus-summary-prev-unread-subject
1777 "f" gnus-summary-first-unread-article
1778 "b" gnus-summary-best-unread-article
1779 "j" gnus-summary-goto-article
1780 "g" gnus-summary-goto-subject
1781 "l" gnus-summary-goto-last-article
1782 "o" gnus-summary-pop-article)
1784 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1785 "k" gnus-summary-kill-thread
1786 "l" gnus-summary-lower-thread
1787 "i" gnus-summary-raise-thread
1788 "T" gnus-summary-toggle-threads
1789 "t" gnus-summary-rethread-current
1790 "^" gnus-summary-reparent-thread
1791 "s" gnus-summary-show-thread
1792 "S" gnus-summary-show-all-threads
1793 "h" gnus-summary-hide-thread
1794 "H" gnus-summary-hide-all-threads
1795 "n" gnus-summary-next-thread
1796 "p" gnus-summary-prev-thread
1797 "u" gnus-summary-up-thread
1798 "o" gnus-summary-top-thread
1799 "d" gnus-summary-down-thread
1800 "#" gnus-uu-mark-thread
1801 "\M-#" gnus-uu-unmark-thread)
1803 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1804 "g" gnus-summary-prepare
1805 "c" gnus-summary-insert-cached-articles
1806 "d" gnus-summary-insert-dormant-articles)
1808 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1809 "c" gnus-summary-catchup-and-exit
1810 "C" gnus-summary-catchup-all-and-exit
1811 "E" gnus-summary-exit-no-update
1812 "Q" gnus-summary-exit
1813 "Z" gnus-summary-exit
1814 "n" gnus-summary-catchup-and-goto-next-group
1815 "R" gnus-summary-reselect-current-group
1816 "G" gnus-summary-rescan-group
1817 "N" gnus-summary-next-group
1818 "s" gnus-summary-save-newsrc
1819 "P" gnus-summary-prev-group)
1821 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1822 " " gnus-summary-next-page
1823 "n" gnus-summary-next-page
1824 "\177" gnus-summary-prev-page
1825 [delete] gnus-summary-prev-page
1826 "p" gnus-summary-prev-page
1827 "\r" gnus-summary-scroll-up
1828 "\M-\r" gnus-summary-scroll-down
1829 "<" gnus-summary-beginning-of-article
1830 ">" gnus-summary-end-of-article
1831 "b" gnus-summary-beginning-of-article
1832 "e" gnus-summary-end-of-article
1833 "^" gnus-summary-refer-parent-article
1834 "r" gnus-summary-refer-parent-article
1835 "D" gnus-summary-enter-digest-group
1836 "R" gnus-summary-refer-references
1837 "T" gnus-summary-refer-thread
1838 "g" gnus-summary-show-article
1839 "s" gnus-summary-isearch-article
1840 "P" gnus-summary-print-article
1841 "M" gnus-mailing-list-insinuate
1842 "t" gnus-article-babel)
1844 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1845 "b" gnus-article-add-buttons
1846 "B" gnus-article-add-buttons-to-head
1847 "o" gnus-article-treat-overstrike
1848 "e" gnus-article-emphasize
1849 "w" gnus-article-fill-cited-article
1850 "Q" gnus-article-fill-long-lines
1851 "C" gnus-article-capitalize-sentences
1852 "c" gnus-article-remove-cr
1853 "q" gnus-article-de-quoted-unreadable
1854 "6" gnus-article-de-base64-unreadable
1855 "Z" gnus-article-decode-HZ
1856 "A" gnus-article-treat-ansi-sequences
1857 "h" gnus-article-wash-html
1858 "u" gnus-article-unsplit-urls
1859 "s" gnus-summary-force-verify-and-decrypt
1860 "f" gnus-article-display-x-face
1861 "l" gnus-summary-stop-page-breaking
1862 "r" gnus-summary-caesar-message
1863 "m" gnus-summary-morse-message
1864 "t" gnus-summary-toggle-header
1865 "g" gnus-treat-smiley
1866 "v" gnus-summary-verbose-headers
1867 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1868 "p" gnus-article-verify-x-pgp-sig
1869 "d" gnus-article-treat-dumbquotes)
1871 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1872 ;; mnemonic: deuglif*Y*
1873 "u" gnus-article-outlook-unwrap-lines
1874 "a" gnus-article-outlook-repair-attribution
1875 "c" gnus-article-outlook-rearrange-citation
1876 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1878 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1879 "a" gnus-article-hide
1880 "h" gnus-article-hide-headers
1881 "b" gnus-article-hide-boring-headers
1882 "s" gnus-article-hide-signature
1883 "c" gnus-article-hide-citation
1884 "C" gnus-article-hide-citation-in-followups
1885 "l" gnus-article-hide-list-identifiers
1886 "B" gnus-article-strip-banner
1887 "P" gnus-article-hide-pem
1888 "\C-c" gnus-article-hide-citation-maybe)
1890 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1891 "a" gnus-article-highlight
1892 "h" gnus-article-highlight-headers
1893 "c" gnus-article-highlight-citation
1894 "s" gnus-article-highlight-signature)
1896 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1897 "f" gnus-article-treat-fold-headers
1898 "u" gnus-article-treat-unfold-headers
1899 "n" gnus-article-treat-fold-newsgroups)
1901 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1902 "x" gnus-article-display-x-face
1903 "d" gnus-article-display-face
1904 "s" gnus-treat-smiley
1905 "D" gnus-article-remove-images
1906 "f" gnus-treat-from-picon
1907 "m" gnus-treat-mail-picon
1908 "n" gnus-treat-newsgroups-picon)
1910 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1911 "w" gnus-article-decode-mime-words
1912 "c" gnus-article-decode-charset
1913 "v" gnus-mime-view-all-parts
1914 "b" gnus-article-view-part)
1916 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1917 "z" gnus-article-date-ut
1918 "u" gnus-article-date-ut
1919 "l" gnus-article-date-local
1920 "p" gnus-article-date-english
1921 "e" gnus-article-date-lapsed
1922 "o" gnus-article-date-original
1923 "i" gnus-article-date-iso8601
1924 "s" gnus-article-date-user)
1926 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1927 "t" gnus-article-remove-trailing-blank-lines
1928 "l" gnus-article-strip-leading-blank-lines
1929 "m" gnus-article-strip-multiple-blank-lines
1930 "a" gnus-article-strip-blank-lines
1931 "A" gnus-article-strip-all-blank-lines
1932 "s" gnus-article-strip-leading-space
1933 "e" gnus-article-strip-trailing-space
1934 "w" gnus-article-remove-leading-whitespace)
1936 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1938 "f" gnus-summary-fetch-faq
1939 "d" gnus-summary-describe-group
1940 "h" gnus-summary-describe-briefly
1941 "i" gnus-info-find-node
1942 "c" gnus-group-fetch-charter
1943 "C" gnus-group-fetch-control)
1945 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1946 "e" gnus-summary-expire-articles
1947 "\M-\C-e" gnus-summary-expire-articles-now
1948 "\177" gnus-summary-delete-article
1949 [delete] gnus-summary-delete-article
1950 [backspace] gnus-summary-delete-article
1951 "m" gnus-summary-move-article
1952 "r" gnus-summary-respool-article
1953 "w" gnus-summary-edit-article
1954 "c" gnus-summary-copy-article
1955 "B" gnus-summary-crosspost-article
1956 "q" gnus-summary-respool-query
1957 "t" gnus-summary-respool-trace
1958 "i" gnus-summary-import-article
1959 "I" gnus-summary-create-article
1960 "p" gnus-summary-article-posted-p)
1962 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1963 "o" gnus-summary-save-article
1964 "m" gnus-summary-save-article-mail
1965 "F" gnus-summary-write-article-file
1966 "r" gnus-summary-save-article-rmail
1967 "f" gnus-summary-save-article-file
1968 "b" gnus-summary-save-article-body-file
1969 "h" gnus-summary-save-article-folder
1970 "v" gnus-summary-save-article-vm
1971 "p" gnus-summary-pipe-output
1972 "P" gnus-summary-muttprint
1973 "s" gnus-soup-add-article)
1975 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1976 "b" gnus-summary-display-buttonized
1977 "m" gnus-summary-repair-multipart
1978 "v" gnus-article-view-part
1979 "o" gnus-article-save-part
1980 "c" gnus-article-copy-part
1981 "C" gnus-article-view-part-as-charset
1982 "e" gnus-article-view-part-externally
1983 "E" gnus-article-encrypt-body
1984 "i" gnus-article-inline-part
1985 "|" gnus-article-pipe-part)
1987 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1988 "p" gnus-summary-mark-as-processable
1989 "u" gnus-summary-unmark-as-processable
1990 "U" gnus-summary-unmark-all-processable
1991 "v" gnus-uu-mark-over
1992 "s" gnus-uu-mark-series
1993 "r" gnus-uu-mark-region
1994 "g" gnus-uu-unmark-region
1995 "R" gnus-uu-mark-by-regexp
1996 "G" gnus-uu-unmark-by-regexp
1997 "t" gnus-uu-mark-thread
1998 "T" gnus-uu-unmark-thread
1999 "a" gnus-uu-mark-all
2000 "b" gnus-uu-mark-buffer
2001 "S" gnus-uu-mark-sparse
2002 "k" gnus-summary-kill-process-mark
2003 "y" gnus-summary-yank-process-mark
2004 "w" gnus-summary-save-process-mark
2005 "i" gnus-uu-invert-processable)
2007 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2008 ;;"x" gnus-uu-extract-any
2009 "m" gnus-summary-save-parts
2010 "u" gnus-uu-decode-uu
2011 "U" gnus-uu-decode-uu-and-save
2012 "s" gnus-uu-decode-unshar
2013 "S" gnus-uu-decode-unshar-and-save
2014 "o" gnus-uu-decode-save
2015 "O" gnus-uu-decode-save
2016 "b" gnus-uu-decode-binhex
2017 "B" gnus-uu-decode-binhex
2018 "p" gnus-uu-decode-postscript
2019 "P" gnus-uu-decode-postscript-and-save)
2022 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2023 "u" gnus-uu-decode-uu-view
2024 "U" gnus-uu-decode-uu-and-save-view
2025 "s" gnus-uu-decode-unshar-view
2026 "S" gnus-uu-decode-unshar-and-save-view
2027 "o" gnus-uu-decode-save-view
2028 "O" gnus-uu-decode-save-view
2029 "b" gnus-uu-decode-binhex-view
2030 "B" gnus-uu-decode-binhex-view
2031 "p" gnus-uu-decode-postscript-view
2032 "P" gnus-uu-decode-postscript-and-save-view)
2034 (defvar gnus-article-post-menu nil)
2036 (defconst gnus-summary-menu-maxlen 20)
2038 (defun gnus-summary-menu-split (menu)
2039 ;; If we have lots of elements, divide them into groups of 20
2040 ;; and make a pane (or submenu) for each one.
2041 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2042 (let ((menu menu) sublists next
2045 ;; Pull off the next gnus-summary-menu-maxlen elements
2046 ;; and make them the next element of sublist.
2047 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2049 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2051 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2052 (aref (car (last menu)) 0)) menu)
2056 (nreverse sublists))
2057 ;; Few elements--put them all in one pane.
2060 (defun gnus-summary-make-menu-bar ()
2061 (gnus-turn-off-edit-menu 'summary)
2063 (unless (boundp 'gnus-summary-misc-menu)
2066 gnus-summary-kill-menu gnus-summary-mode-map ""
2071 ["Customize" gnus-score-customize t])
2072 (gnus-make-score-map 'increase)
2073 (gnus-make-score-map 'lower)
2075 ["Kill below" gnus-summary-kill-below t]
2076 ["Mark above" gnus-summary-mark-above t]
2077 ["Tick above" gnus-summary-tick-above t]
2078 ["Clear above" gnus-summary-clear-above t])
2079 ["Current score" gnus-summary-current-score t]
2080 ["Set score" gnus-summary-set-score t]
2081 ["Switch current score file..." gnus-score-change-score-file t]
2082 ["Set mark below..." gnus-score-set-mark-below t]
2083 ["Set expunge below..." gnus-score-set-expunge-below t]
2084 ["Edit current score file" gnus-score-edit-current-scores t]
2085 ["Edit score file" gnus-score-edit-file t]
2086 ["Trace score" gnus-score-find-trace t]
2087 ["Find words" gnus-score-find-favourite-words t]
2088 ["Rescore buffer" gnus-summary-rescore t]
2089 ["Increase score..." gnus-summary-increase-score t]
2090 ["Lower score..." gnus-summary-lower-score t]))))
2092 ;; Define both the Article menu in the summary buffer and the
2093 ;; equivalent Commands menu in the article buffer here for
2097 ["All" gnus-article-hide t]
2098 ["Headers" gnus-article-hide-headers t]
2099 ["Signature" gnus-article-hide-signature t]
2100 ["Citation" gnus-article-hide-citation t]
2101 ["List identifiers" gnus-article-hide-list-identifiers t]
2102 ["Banner" gnus-article-strip-banner t]
2103 ["Boring headers" gnus-article-hide-boring-headers t])
2105 ["All" gnus-article-highlight t]
2106 ["Headers" gnus-article-highlight-headers t]
2107 ["Signature" gnus-article-highlight-signature t]
2108 ["Citation" gnus-article-highlight-citation t])
2110 ["Words" gnus-article-decode-mime-words t]
2111 ["Charset" gnus-article-decode-charset t]
2112 ["QP" gnus-article-de-quoted-unreadable t]
2113 ["Base64" gnus-article-de-base64-unreadable t]
2114 ["View MIME buttons" gnus-summary-display-buttonized t]
2115 ["View all" gnus-mime-view-all-parts t]
2116 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2117 ["Encrypt body" gnus-article-encrypt-body
2118 :active (not (gnus-group-read-only-p))
2119 ,@(if (featurep 'xemacs) nil
2120 '(:help "Encrypt the message body on disk"))]
2121 ["Extract all parts..." gnus-summary-save-parts t]
2123 ["Repair multipart" gnus-summary-repair-multipart t]
2124 ["Pipe part..." gnus-article-pipe-part t]
2125 ["Inline part" gnus-article-inline-part t]
2126 ["Encrypt body" gnus-article-encrypt-body
2127 :active (not (gnus-group-read-only-p))
2128 ,@(if (featurep 'xemacs) nil
2129 '(:help "Encrypt the message body on disk"))]
2130 ["View part externally" gnus-article-view-part-externally t]
2131 ["View part with charset..." gnus-article-view-part-as-charset t]
2132 ["Copy part" gnus-article-copy-part t]
2133 ["Save part..." gnus-article-save-part t]
2134 ["View part" gnus-article-view-part t]))
2136 ["Local" gnus-article-date-local t]
2137 ["ISO8601" gnus-article-date-iso8601 t]
2138 ["UT" gnus-article-date-ut t]
2139 ["Original" gnus-article-date-original t]
2140 ["Lapsed" gnus-article-date-lapsed t]
2141 ["User-defined" gnus-article-date-user t])
2143 ["Remove images" gnus-article-remove-images t]
2144 ["Toggle smiley" gnus-treat-smiley t]
2145 ["Show X-Face" gnus-article-display-x-face t]
2146 ["Show picons in From" gnus-treat-from-picon t]
2147 ["Show picons in mail headers" gnus-treat-mail-picon t]
2148 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2149 ("View as different encoding"
2150 ,@(gnus-summary-menu-split
2153 ;; Since easymenu under Emacs doesn't allow
2154 ;; lambda forms for menu commands, we should
2155 ;; provide intern'ed function symbols.
2156 (let ((command (intern (format "\
2157 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2161 (let ((gnus-summary-show-article-charset-alist
2163 (gnus-summary-show-article 1))))
2164 `[,(symbol-name cs) ,command t]))
2165 (sort (if (fboundp 'coding-system-list)
2166 (coding-system-list)
2167 (mapcar 'car mm-mime-mule-charset-alist))
2171 ["Leading" gnus-article-strip-leading-blank-lines t]
2172 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2173 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2174 ["All of the above" gnus-article-strip-blank-lines t]
2175 ["All" gnus-article-strip-all-blank-lines t]
2176 ["Leading space" gnus-article-strip-leading-space t]
2177 ["Trailing space" gnus-article-strip-trailing-space t]
2178 ["Leading space in headers"
2179 gnus-article-remove-leading-whitespace t])
2180 ["Overstrike" gnus-article-treat-overstrike t]
2181 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2182 ["Emphasis" gnus-article-emphasize t]
2183 ["Word wrap" gnus-article-fill-cited-article t]
2184 ["Fill long lines" gnus-article-fill-long-lines t]
2185 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2186 ["Remove CR" gnus-article-remove-cr t]
2187 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2188 ["Base64" gnus-article-de-base64-unreadable t]
2189 ["Rot 13" gnus-summary-caesar-message
2190 ,@(if (featurep 'xemacs) '(t)
2191 '(:help "\"Caesar rotate\" article by 13"))]
2192 ["Morse decode" gnus-summary-morse-message t]
2193 ["Unix pipe..." gnus-summary-pipe-message t]
2194 ["Add buttons" gnus-article-add-buttons t]
2195 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2196 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2197 ["Verbose header" gnus-summary-verbose-headers t]
2198 ["Toggle header" gnus-summary-toggle-header t]
2199 ["Unfold headers" gnus-article-treat-unfold-headers t]
2200 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2201 ["Html" gnus-article-wash-html t]
2202 ["Unsplit URLs" gnus-article-unsplit-urls t]
2203 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2204 ["Decode HZ" gnus-article-decode-HZ t]
2205 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2206 ("(Outlook) Deuglify"
2207 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2208 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2209 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2210 ["Full (Outlook) deuglify"
2211 gnus-article-outlook-deuglify-article t])
2214 ["Save in default format..." gnus-summary-save-article
2215 ,@(if (featurep 'xemacs) '(t)
2216 '(:help "Save article using default method"))]
2217 ["Save in file..." gnus-summary-save-article-file
2218 ,@(if (featurep 'xemacs) '(t)
2219 '(:help "Save article in file"))]
2220 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2221 ["Save in MH folder..." gnus-summary-save-article-folder t]
2222 ["Save in VM folder..." gnus-summary-save-article-vm t]
2223 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2224 ["Save body in file..." gnus-summary-save-article-body-file t]
2225 ["Pipe through a filter..." gnus-summary-pipe-output t]
2226 ["Add to SOUP packet" gnus-soup-add-article t]
2227 ["Print with Muttprint..." gnus-summary-muttprint t]
2228 ["Print" gnus-summary-print-article t])
2230 ["Respool article..." gnus-summary-respool-article t]
2231 ["Move article..." gnus-summary-move-article
2232 (gnus-check-backend-function
2233 'request-move-article gnus-newsgroup-name)]
2234 ["Copy article..." gnus-summary-copy-article t]
2235 ["Crosspost article..." gnus-summary-crosspost-article
2236 (gnus-check-backend-function
2237 'request-replace-article gnus-newsgroup-name)]
2238 ["Import file..." gnus-summary-import-article
2239 (gnus-check-backend-function
2240 'request-accept-article gnus-newsgroup-name)]
2241 ["Create article..." gnus-summary-create-article
2242 (gnus-check-backend-function
2243 'request-accept-article gnus-newsgroup-name)]
2244 ["Check if posted" gnus-summary-article-posted-p t]
2245 ["Edit article" gnus-summary-edit-article
2246 (not (gnus-group-read-only-p))]
2247 ["Delete article" gnus-summary-delete-article
2248 (gnus-check-backend-function
2249 'request-expire-articles gnus-newsgroup-name)]
2250 ["Query respool" gnus-summary-respool-query t]
2251 ["Trace respool" gnus-summary-respool-trace t]
2252 ["Delete expirable articles" gnus-summary-expire-articles-now
2253 (gnus-check-backend-function
2254 'request-expire-articles gnus-newsgroup-name)])
2256 ["Uudecode" gnus-uu-decode-uu
2257 ,@(if (featurep 'xemacs) '(t)
2258 '(:help "Decode uuencoded article(s)"))]
2259 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2260 ["Unshar" gnus-uu-decode-unshar t]
2261 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2262 ["Save" gnus-uu-decode-save t]
2263 ["Binhex" gnus-uu-decode-binhex t]
2264 ["Postscript" gnus-uu-decode-postscript t]
2265 ["All MIME parts" gnus-summary-save-parts t])
2267 ["Enter article" gnus-cache-enter-article t]
2268 ["Remove article" gnus-cache-remove-article t])
2269 ["Translate" gnus-article-babel t]
2270 ["Select article buffer" gnus-summary-select-article-buffer t]
2271 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2272 ["Isearch article..." gnus-summary-isearch-article t]
2273 ["Beginning of the article" gnus-summary-beginning-of-article t]
2274 ["End of the article" gnus-summary-end-of-article t]
2275 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2276 ["Fetch referenced articles" gnus-summary-refer-references t]
2277 ["Fetch current thread" gnus-summary-refer-thread t]
2278 ["Fetch article with id..." gnus-summary-refer-article t]
2279 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2280 ["Redisplay" gnus-summary-show-article t]
2281 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2283 gnus-summary-article-menu gnus-summary-mode-map ""
2284 (cons "Article" innards))
2286 (if (not (keymapp gnus-summary-article-menu))
2288 gnus-article-commands-menu gnus-article-mode-map ""
2289 (cons "Commands" innards))
2290 ;; in Emacs, don't share menu.
2291 (setq gnus-article-commands-menu
2292 (copy-keymap gnus-summary-article-menu))
2293 (define-key gnus-article-mode-map [menu-bar commands]
2294 (cons "Commands" gnus-article-commands-menu))))
2297 gnus-summary-thread-menu gnus-summary-mode-map ""
2299 ["Find all messages in thread" gnus-summary-refer-thread t]
2300 ["Toggle threading" gnus-summary-toggle-threads t]
2301 ["Hide threads" gnus-summary-hide-all-threads t]
2302 ["Show threads" gnus-summary-show-all-threads t]
2303 ["Hide thread" gnus-summary-hide-thread t]
2304 ["Show thread" gnus-summary-show-thread t]
2305 ["Go to next thread" gnus-summary-next-thread t]
2306 ["Go to previous thread" gnus-summary-prev-thread t]
2307 ["Go down thread" gnus-summary-down-thread t]
2308 ["Go up thread" gnus-summary-up-thread t]
2309 ["Top of thread" gnus-summary-top-thread t]
2310 ["Mark thread as read" gnus-summary-kill-thread t]
2311 ["Lower thread score" gnus-summary-lower-thread t]
2312 ["Raise thread score" gnus-summary-raise-thread t]
2313 ["Rethread current" gnus-summary-rethread-current t]))
2316 gnus-summary-post-menu gnus-summary-mode-map ""
2318 ["Send a message (mail or news)" gnus-summary-post-news
2319 ,@(if (featurep 'xemacs) '(t)
2320 '(:help "Post an article"))]
2321 ["Followup" gnus-summary-followup
2322 ,@(if (featurep 'xemacs) '(t)
2323 '(:help "Post followup to this article"))]
2324 ["Followup and yank" gnus-summary-followup-with-original
2325 ,@(if (featurep 'xemacs) '(t)
2326 '(:help "Post followup to this article, quoting its contents"))]
2327 ["Supersede article" gnus-summary-supersede-article t]
2328 ["Cancel article" gnus-summary-cancel-article
2329 ,@(if (featurep 'xemacs) '(t)
2330 '(:help "Cancel an article you posted"))]
2331 ["Reply" gnus-summary-reply t]
2332 ["Reply and yank" gnus-summary-reply-with-original t]
2333 ["Wide reply" gnus-summary-wide-reply t]
2334 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2335 ,@(if (featurep 'xemacs) '(t)
2336 '(:help "Mail a reply, quoting this article"))]
2337 ["Very wide reply" gnus-summary-very-wide-reply t]
2338 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2339 ,@(if (featurep 'xemacs) '(t)
2340 '(:help "Mail a very wide reply, quoting this article"))]
2341 ["Mail forward" gnus-summary-mail-forward t]
2342 ["Post forward" gnus-summary-post-forward t]
2343 ["Digest and mail" gnus-uu-digest-mail-forward t]
2344 ["Digest and post" gnus-uu-digest-post-forward t]
2345 ["Resend message" gnus-summary-resend-message t]
2346 ["Resend message edit" gnus-summary-resend-message-edit t]
2347 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2348 ["Send a mail" gnus-summary-mail-other-window t]
2349 ["Create a local message" gnus-summary-news-other-window t]
2350 ["Uuencode and post" gnus-uu-post-news
2351 ,@(if (featurep 'xemacs) '(t)
2352 '(:help "Post a uuencoded article"))]
2353 ["Followup via news" gnus-summary-followup-to-mail t]
2354 ["Followup via news and yank"
2355 gnus-summary-followup-to-mail-with-original t]
2357 ;;["Send" gnus-summary-send-draft t]
2358 ;;["Send bounced" gnus-resend-bounced-mail t])
2362 ((not (keymapp gnus-summary-post-menu))
2363 (setq gnus-article-post-menu gnus-summary-post-menu))
2364 ((not gnus-article-post-menu)
2365 ;; Don't share post menu.
2366 (setq gnus-article-post-menu
2367 (copy-keymap gnus-summary-post-menu))))
2368 (define-key gnus-article-mode-map [menu-bar post]
2369 (cons "Post" gnus-article-post-menu))
2372 gnus-summary-misc-menu gnus-summary-mode-map ""
2375 ["Mark as read" gnus-summary-mark-as-read-forward t]
2376 ["Mark same subject and select"
2377 gnus-summary-kill-same-subject-and-select t]
2378 ["Mark same subject" gnus-summary-kill-same-subject t]
2379 ["Catchup" gnus-summary-catchup
2380 ,@(if (featurep 'xemacs) '(t)
2381 '(:help "Mark unread articles in this group as read"))]
2382 ["Catchup all" gnus-summary-catchup-all t]
2383 ["Catchup to here" gnus-summary-catchup-to-here t]
2384 ["Catchup from here" gnus-summary-catchup-from-here t]
2385 ["Catchup region" gnus-summary-mark-region-as-read
2386 (gnus-mark-active-p)]
2387 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2389 ["Tick" gnus-summary-tick-article-forward t]
2390 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2391 ["Remove marks" gnus-summary-clear-mark-forward t]
2392 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2393 ["Set bookmark" gnus-summary-set-bookmark t]
2394 ["Remove bookmark" gnus-summary-remove-bookmark t])
2396 ["Marks..." gnus-summary-limit-to-marks t]
2397 ["Subject..." gnus-summary-limit-to-subject t]
2398 ["Author..." gnus-summary-limit-to-author t]
2399 ["Age..." gnus-summary-limit-to-age t]
2400 ["Extra..." gnus-summary-limit-to-extra t]
2401 ["Score..." gnus-summary-limit-to-score t]
2402 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2403 ["Unread" gnus-summary-limit-to-unread t]
2404 ["Unseen" gnus-summary-limit-to-unseen t]
2405 ["Replied" gnus-summary-limit-to-replied t]
2406 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2407 ["Next articles" gnus-summary-limit-to-articles t]
2408 ["Pop limit" gnus-summary-pop-limit t]
2409 ["Show dormant" gnus-summary-limit-include-dormant t]
2410 ["Hide childless dormant"
2411 gnus-summary-limit-exclude-childless-dormant t]
2412 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2413 ["Hide marked" gnus-summary-limit-exclude-marks t]
2414 ["Show expunged" gnus-summary-limit-include-expunged t])
2416 ["Set mark" gnus-summary-mark-as-processable t]
2417 ["Remove mark" gnus-summary-unmark-as-processable t]
2418 ["Remove all marks" gnus-summary-unmark-all-processable t]
2419 ["Mark above" gnus-uu-mark-over t]
2420 ["Mark series" gnus-uu-mark-series t]
2421 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2422 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2423 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2424 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2425 ["Mark all" gnus-uu-mark-all t]
2426 ["Mark buffer" gnus-uu-mark-buffer t]
2427 ["Mark sparse" gnus-uu-mark-sparse t]
2428 ["Mark thread" gnus-uu-mark-thread t]
2429 ["Unmark thread" gnus-uu-unmark-thread t]
2430 ("Process Mark Sets"
2431 ["Kill" gnus-summary-kill-process-mark t]
2432 ["Yank" gnus-summary-yank-process-mark
2433 gnus-newsgroup-process-stack]
2434 ["Save" gnus-summary-save-process-mark t]
2435 ["Run command on marked..." gnus-summary-universal-argument t]))
2437 ["Page forward" gnus-summary-next-page
2438 ,@(if (featurep 'xemacs) '(t)
2439 '(:help "Show next page of article"))]
2440 ["Page backward" gnus-summary-prev-page
2441 ,@(if (featurep 'xemacs) '(t)
2442 '(:help "Show previous page of article"))]
2443 ["Line forward" gnus-summary-scroll-up t])
2445 ["Next unread article" gnus-summary-next-unread-article t]
2446 ["Previous unread article" gnus-summary-prev-unread-article t]
2447 ["Next article" gnus-summary-next-article t]
2448 ["Previous article" gnus-summary-prev-article t]
2449 ["Next unread subject" gnus-summary-next-unread-subject t]
2450 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2451 ["Next article same subject" gnus-summary-next-same-subject t]
2452 ["Previous article same subject" gnus-summary-prev-same-subject t]
2453 ["First unread article" gnus-summary-first-unread-article t]
2454 ["Best unread article" gnus-summary-best-unread-article t]
2455 ["Go to subject number..." gnus-summary-goto-subject t]
2456 ["Go to article number..." gnus-summary-goto-article t]
2457 ["Go to the last article" gnus-summary-goto-last-article t]
2458 ["Pop article off history" gnus-summary-pop-article t])
2460 ["Sort by number" gnus-summary-sort-by-number t]
2461 ["Sort by author" gnus-summary-sort-by-author t]
2462 ["Sort by subject" gnus-summary-sort-by-subject t]
2463 ["Sort by date" gnus-summary-sort-by-date t]
2464 ["Sort by score" gnus-summary-sort-by-score t]
2465 ["Sort by lines" gnus-summary-sort-by-lines t]
2466 ["Sort by characters" gnus-summary-sort-by-chars t]
2467 ["Randomize" gnus-summary-sort-by-random t]
2468 ["Original sort" gnus-summary-sort-by-original t])
2470 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2471 ["Describe group" gnus-summary-describe-group t]
2472 ["Fetch charter" gnus-group-fetch-charter
2473 ,@(if (featurep 'xemacs) nil
2474 '(:help "Display the charter of the current group"))]
2475 ["Fetch control message" gnus-group-fetch-control
2476 ,@(if (featurep 'xemacs) nil
2477 '(:help "Display the archived control message for the current group"))]
2478 ["Read manual" gnus-info-find-node t])
2480 ["Pick and read" gnus-pick-mode t]
2481 ["Binary" gnus-binary-mode t])
2483 ["Regenerate" gnus-summary-prepare t]
2484 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2485 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2486 ["Toggle threading" gnus-summary-toggle-threads t])
2487 ["See old articles" gnus-summary-insert-old-articles t]
2488 ["See new articles" gnus-summary-insert-new-articles t]
2489 ["Filter articles..." gnus-summary-execute-command t]
2490 ["Run command on articles..." gnus-summary-universal-argument t]
2491 ["Search articles forward..." gnus-summary-search-article-forward t]
2492 ["Search articles backward..." gnus-summary-search-article-backward t]
2493 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2494 ["Expand window" gnus-summary-expand-window t]
2495 ["Expire expirable articles" gnus-summary-expire-articles
2496 (gnus-check-backend-function
2497 'request-expire-articles gnus-newsgroup-name)]
2498 ["Edit local kill file" gnus-summary-edit-local-kill t]
2499 ["Edit main kill file" gnus-summary-edit-global-kill t]
2500 ["Edit group parameters" gnus-summary-edit-parameters t]
2501 ["Customize group parameters" gnus-summary-customize-parameters t]
2502 ["Send a bug report" gnus-bug t]
2504 ["Catchup and exit" gnus-summary-catchup-and-exit
2505 ,@(if (featurep 'xemacs) '(t)
2506 '(:help "Mark unread articles in this group as read, then exit"))]
2507 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2508 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2509 ["Exit group" gnus-summary-exit
2510 ,@(if (featurep 'xemacs) '(t)
2511 '(:help "Exit current group, return to group selection mode"))]
2512 ["Exit group without updating" gnus-summary-exit-no-update t]
2513 ["Exit and goto next group" gnus-summary-next-group t]
2514 ["Exit and goto prev group" gnus-summary-prev-group t]
2515 ["Reselect group" gnus-summary-reselect-current-group t]
2516 ["Rescan group" gnus-summary-rescan-group t]
2517 ["Update dribble" gnus-summary-save-newsrc t])))
2519 (gnus-run-hooks 'gnus-summary-menu-hook)))
2521 (defvar gnus-summary-tool-bar-map nil)
2523 ;; Emacs 21 tool bar. Should be no-op otherwise.
2524 (defun gnus-summary-make-tool-bar ()
2525 (if (and (fboundp 'tool-bar-add-item-from-menu)
2526 (default-value 'tool-bar-mode)
2527 (not gnus-summary-tool-bar-map))
2528 (setq gnus-summary-tool-bar-map
2529 (let ((tool-bar-map (make-sparse-keymap))
2530 (load-path (mm-image-load-path)))
2531 (tool-bar-add-item-from-menu
2532 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2533 (tool-bar-add-item-from-menu
2534 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2535 (tool-bar-add-item-from-menu
2536 'gnus-summary-post-news "post" gnus-summary-mode-map)
2537 (tool-bar-add-item-from-menu
2538 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2539 (tool-bar-add-item-from-menu
2540 'gnus-summary-followup "followup" gnus-summary-mode-map)
2541 (tool-bar-add-item-from-menu
2542 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2543 (tool-bar-add-item-from-menu
2544 'gnus-summary-reply "reply" gnus-summary-mode-map)
2545 (tool-bar-add-item-from-menu
2546 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2547 (tool-bar-add-item-from-menu
2548 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2549 (tool-bar-add-item-from-menu
2550 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2551 (tool-bar-add-item-from-menu
2552 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2553 (tool-bar-add-item-from-menu
2554 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2555 (tool-bar-add-item-from-menu
2556 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2557 (tool-bar-add-item-from-menu
2558 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2559 (tool-bar-add-item-from-menu
2560 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2562 (if gnus-summary-tool-bar-map
2563 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2565 (defun gnus-score-set-default (var value)
2566 "A version of set that updates the GNU Emacs menu-bar."
2568 ;; It is the message that forces the active status to be updated.
2571 (defun gnus-make-score-map (type)
2572 "Make a summary score map of type TYPE."
2575 (let ((headers '(("author" "from" string)
2576 ("subject" "subject" string)
2577 ("article body" "body" string)
2578 ("article head" "head" string)
2579 ("xref" "xref" string)
2580 ("extra header" "extra" string)
2581 ("lines" "lines" number)
2582 ("followups to author" "followup" string)))
2583 (types '((number ("less than" <)
2586 (string ("substring" s)
2590 (perms '(("temporary" (current-time-string))
2598 (if (eq type 'lower)
2603 (setq header (car headers))
2609 (let ((ts (cdr (assoc (nth 2 header) types)))
2625 'gnus-summary-score-entry
2627 (if (or (string= (nth 1 header)
2629 (string= (nth 1 header)
2632 (list 'gnus-summary-header
2634 (list 'quote (nth 1 (car ts)))
2635 (list 'gnus-score-delta-default
2642 (list (nreverse outp))))
2645 (list (nreverse outt))))
2647 (setq headers (cdr headers)))
2648 (list (nreverse outh))))))))
2652 (defun gnus-summary-mode (&optional group)
2653 "Major mode for reading articles.
2655 All normal editing commands are switched off.
2656 \\<gnus-summary-mode-map>
2657 Each line in this buffer represents one article. To read an
2658 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2659 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2662 You can also post articles and send mail from this buffer. To
2663 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2664 of an article, type `\\[gnus-summary-reply]'.
2666 There are approx. one gazillion commands you can execute in this
2667 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2669 The following commands are available:
2671 \\{gnus-summary-mode-map}"
2673 (kill-all-local-variables)
2674 (when (gnus-visual-p 'summary-menu 'menu)
2675 (gnus-summary-make-menu-bar)
2676 (gnus-summary-make-tool-bar))
2677 (gnus-summary-make-local-variables)
2678 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2679 (gnus-summary-make-local-variables))
2680 (gnus-make-thread-indent-array)
2681 (gnus-simplify-mode-line)
2682 (setq major-mode 'gnus-summary-mode)
2683 (setq mode-name "Summary")
2684 (make-local-variable 'minor-mode-alist)
2685 (use-local-map gnus-summary-mode-map)
2686 (buffer-disable-undo)
2687 (setq buffer-read-only t) ;Disable modification
2688 (setq truncate-lines t)
2689 (setq selective-display t)
2690 (setq selective-display-ellipses t) ;Display `...'
2691 (gnus-summary-set-display-table)
2692 (gnus-set-default-directory)
2693 (setq gnus-newsgroup-name group)
2694 (make-local-variable 'gnus-summary-line-format)
2695 (make-local-variable 'gnus-summary-line-format-spec)
2696 (make-local-variable 'gnus-summary-dummy-line-format)
2697 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2698 (make-local-variable 'gnus-summary-mark-positions)
2699 (gnus-make-local-hook 'pre-command-hook)
2700 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2701 (gnus-run-hooks 'gnus-summary-mode-hook)
2702 (turn-on-gnus-mailing-list-mode)
2703 (mm-enable-multibyte)
2704 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2705 (gnus-update-summary-mark-positions))
2707 (defun gnus-summary-make-local-variables ()
2708 "Make all the local summary buffer variables."
2710 (dolist (local gnus-summary-local-variables)
2713 (if (eq (cdr local) 'global)
2714 ;; Copy the global value of the variable.
2715 (setq global (symbol-value (car local)))
2716 ;; Use the value from the list.
2717 (setq global (eval (cdr local))))
2718 (set (make-local-variable (car local)) global))
2719 ;; Simple nil-valued local variable.
2720 (set (make-local-variable local) nil)))))
2722 (defun gnus-summary-clear-local-variables ()
2723 (let ((locals gnus-summary-local-variables))
2725 (if (consp (car locals))
2726 (and (vectorp (caar locals))
2727 (set (caar locals) nil))
2728 (and (vectorp (car locals))
2729 (set (car locals) nil)))
2730 (setq locals (cdr locals)))))
2732 ;; Summary data functions.
2734 (defmacro gnus-data-number (data)
2737 (defmacro gnus-data-set-number (data number)
2738 `(setcar ,data ,number))
2740 (defmacro gnus-data-mark (data)
2743 (defmacro gnus-data-set-mark (data mark)
2744 `(setcar (nthcdr 1 ,data) ,mark))
2746 (defmacro gnus-data-pos (data)
2749 (defmacro gnus-data-set-pos (data pos)
2750 `(setcar (nthcdr 2 ,data) ,pos))
2752 (defmacro gnus-data-header (data)
2755 (defmacro gnus-data-set-header (data header)
2756 `(setf (nth 3 ,data) ,header))
2758 (defmacro gnus-data-level (data)
2761 (defmacro gnus-data-unread-p (data)
2762 `(= (nth 1 ,data) gnus-unread-mark))
2764 (defmacro gnus-data-read-p (data)
2765 `(/= (nth 1 ,data) gnus-unread-mark))
2767 (defmacro gnus-data-pseudo-p (data)
2768 `(consp (nth 3 ,data)))
2770 (defmacro gnus-data-find (number)
2771 `(assq ,number gnus-newsgroup-data))
2773 (defmacro gnus-data-find-list (number &optional data)
2774 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2775 (memq (assq ,number bdata)
2778 (defmacro gnus-data-make (number mark pos header level)
2779 `(list ,number ,mark ,pos ,header ,level))
2781 (defun gnus-data-enter (after-article number mark pos header level offset)
2782 (let ((data (gnus-data-find-list after-article)))
2784 (error "No such article: %d" after-article))
2785 (setcdr data (cons (gnus-data-make number mark pos header level)
2787 (setq gnus-newsgroup-data-reverse nil)
2788 (gnus-data-update-list (cddr data) offset)))
2790 (defun gnus-data-enter-list (after-article list &optional offset)
2792 (let ((data (and after-article (gnus-data-find-list after-article)))
2796 (let ((odata gnus-newsgroup-data))
2797 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2799 (gnus-data-update-list odata offset)))
2800 ;; Find the last element in the list to be spliced into the main
2803 (setq list (cdr list)))
2806 (setcdr list gnus-newsgroup-data)
2807 (setq gnus-newsgroup-data ilist)
2809 (gnus-data-update-list (cdr list) offset)))
2810 (setcdr list (cdr data))
2813 (gnus-data-update-list (cdr list) offset))))
2814 (setq gnus-newsgroup-data-reverse nil))))
2816 (defun gnus-data-remove (article &optional offset)
2817 (let ((data gnus-newsgroup-data))
2818 (if (= (gnus-data-number (car data)) article)
2820 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2821 gnus-newsgroup-data-reverse nil)
2823 (gnus-data-update-list gnus-newsgroup-data offset)))
2825 (when (= (gnus-data-number (cadr data)) article)
2826 (setcdr data (cddr data))
2828 (gnus-data-update-list (cdr data) offset))
2830 gnus-newsgroup-data-reverse nil))
2831 (setq data (cdr data))))))
2833 (defmacro gnus-data-list (backward)
2835 (or gnus-newsgroup-data-reverse
2836 (setq gnus-newsgroup-data-reverse
2837 (reverse gnus-newsgroup-data)))
2838 gnus-newsgroup-data))
2840 (defun gnus-data-update-list (data offset)
2841 "Add OFFSET to the POS of all data entries in DATA."
2842 (setq gnus-newsgroup-data-reverse nil)
2844 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2845 (setq data (cdr data))))
2847 (defun gnus-summary-article-pseudo-p (article)
2848 "Say whether this article is a pseudo article or not."
2849 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2851 (defmacro gnus-summary-article-sparse-p (article)
2852 "Say whether this article is a sparse article or not."
2853 `(memq ,article gnus-newsgroup-sparse))
2855 (defmacro gnus-summary-article-ancient-p (article)
2856 "Say whether this article is a sparse article or not."
2857 `(memq ,article gnus-newsgroup-ancient))
2859 (defun gnus-article-parent-p (number)
2860 "Say whether this article is a parent or not."
2861 (let ((data (gnus-data-find-list number)))
2862 (and (cdr data) ; There has to be an article after...
2863 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2864 (gnus-data-level (nth 1 data))))))
2866 (defun gnus-article-children (number)
2867 "Return a list of all children to NUMBER."
2868 (let* ((data (gnus-data-find-list number))
2869 (level (gnus-data-level (car data)))
2871 (setq data (cdr data))
2873 (= (gnus-data-level (car data)) (1+ level)))
2874 (push (gnus-data-number (car data)) children)
2875 (setq data (cdr data)))
2878 (defmacro gnus-summary-skip-intangible ()
2879 "If the current article is intangible, then jump to a different article."
2880 '(let ((to (get-text-property (point) 'gnus-intangible)))
2881 (and to (gnus-summary-goto-subject to))))
2883 (defmacro gnus-summary-article-intangible-p ()
2884 "Say whether this article is intangible or not."
2885 '(get-text-property (point) 'gnus-intangible))
2887 (defun gnus-article-read-p (article)
2888 "Say whether ARTICLE is read or not."
2889 (not (or (memq article gnus-newsgroup-marked)
2890 (memq article gnus-newsgroup-spam-marked)
2891 (memq article gnus-newsgroup-unreads)
2892 (memq article gnus-newsgroup-unselected)
2893 (memq article gnus-newsgroup-dormant))))
2895 ;; Some summary mode macros.
2897 (defmacro gnus-summary-article-number ()
2898 "The article number of the article on the current line.
2899 If there isn't an article number here, then we return the current
2902 (gnus-summary-skip-intangible)
2903 (or (get-text-property (point) 'gnus-number)
2904 (gnus-summary-last-subject))))
2906 (defmacro gnus-summary-article-header (&optional number)
2907 "Return the header of article NUMBER."
2908 `(gnus-data-header (gnus-data-find
2909 ,(or number '(gnus-summary-article-number)))))
2911 (defmacro gnus-summary-thread-level (&optional number)
2912 "Return the level of thread that starts with article NUMBER."
2913 `(if (and (eq gnus-summary-make-false-root 'dummy)
2914 (get-text-property (point) 'gnus-intangible))
2916 (gnus-data-level (gnus-data-find
2917 ,(or number '(gnus-summary-article-number))))))
2919 (defmacro gnus-summary-article-mark (&optional number)
2920 "Return the mark of article NUMBER."
2921 `(gnus-data-mark (gnus-data-find
2922 ,(or number '(gnus-summary-article-number)))))
2924 (defmacro gnus-summary-article-pos (&optional number)
2925 "Return the position of the line of article NUMBER."
2926 `(gnus-data-pos (gnus-data-find
2927 ,(or number '(gnus-summary-article-number)))))
2929 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2930 (defmacro gnus-summary-article-subject (&optional number)
2931 "Return current subject string or nil if nothing."
2934 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2935 '(gnus-data-header (assq (gnus-summary-article-number)
2936 gnus-newsgroup-data)))))
2939 (mail-header-subject headers))))
2941 (defmacro gnus-summary-article-score (&optional number)
2942 "Return current article score."
2943 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2944 gnus-newsgroup-scored))
2945 gnus-summary-default-score 0))
2947 (defun gnus-summary-article-children (&optional number)
2948 "Return a list of article numbers that are children of article NUMBER."
2949 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2950 (level (gnus-data-level (car data)))
2952 (while (and (setq data (cdr data))
2953 (> (setq l (gnus-data-level (car data))) level))
2954 (and (= (1+ level) l)
2955 (push (gnus-data-number (car data))
2957 (nreverse children)))
2959 (defun gnus-summary-article-parent (&optional number)
2960 "Return the article number of the parent of article NUMBER."
2961 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2962 (gnus-data-list t)))
2963 (level (gnus-data-level (car data))))
2965 () ; This is a root.
2966 ;; We search until we find an article with a level less than
2967 ;; this one. That function has to be the parent.
2968 (while (and (setq data (cdr data))
2969 (not (< (gnus-data-level (car data)) level))))
2970 (and data (gnus-data-number (car data))))))
2972 (defun gnus-unread-mark-p (mark)
2973 "Say whether MARK is the unread mark."
2974 (= mark gnus-unread-mark))
2976 (defun gnus-read-mark-p (mark)
2977 "Say whether MARK is one of the marks that mark as read.
2978 This is all marks except unread, ticked, dormant, and expirable."
2979 (not (or (= mark gnus-unread-mark)
2980 (= mark gnus-ticked-mark)
2981 (= mark gnus-spam-mark)
2982 (= mark gnus-dormant-mark)
2983 (= mark gnus-expirable-mark))))
2985 (defmacro gnus-article-mark (number)
2986 "Return the MARK of article NUMBER.
2987 This macro should only be used when computing the mark the \"first\"
2988 time; i.e., when generating the summary lines. After that,
2989 `gnus-summary-article-mark' should be used to examine the
2992 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2993 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2994 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2995 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2996 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2997 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2998 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2999 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3000 gnus-ancient-mark))))
3002 ;; Saving hidden threads.
3004 (defmacro gnus-save-hidden-threads (&rest forms)
3005 "Save hidden threads, eval FORMS, and restore the hidden threads."
3006 (let ((config (make-symbol "config")))
3007 `(let ((,config (gnus-hidden-threads-configuration)))
3011 (gnus-restore-hidden-threads-configuration ,config)))))
3012 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3013 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3015 (defun gnus-data-compute-positions ()
3016 "Compute the positions of all articles."
3017 (setq gnus-newsgroup-data-reverse nil)
3018 (let ((data gnus-newsgroup-data))
3020 (gnus-save-hidden-threads
3021 (gnus-summary-show-all-threads)
3022 (goto-char (point-min))
3024 (while (get-text-property (point) 'gnus-intangible)
3026 (gnus-data-set-pos (car data) (+ (point) 3))
3027 (setq data (cdr data))
3028 (forward-line 1))))))
3030 (defun gnus-hidden-threads-configuration ()
3031 "Return the current hidden threads configuration."
3034 (goto-char (point-min))
3035 (while (search-forward "\r" nil t)
3036 (push (1- (point)) config))
3039 (defun gnus-restore-hidden-threads-configuration (config)
3040 "Restore hidden threads configuration from CONFIG."
3042 (let (point buffer-read-only)
3043 (while (setq point (pop config))
3044 (when (and (< point (point-max))
3046 (eq (char-after) ?\n))
3047 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3049 ;; Various summary mode internalish functions.
3051 (defun gnus-mouse-pick-article (e)
3054 (gnus-summary-next-page nil t))
3056 (defun gnus-summary-set-display-table ()
3057 "Change the display table.
3058 Odd characters have a tendency to mess
3059 up nicely formatted displays - we make all possible glyphs
3060 display only a single character."
3062 ;; We start from the standard display table, if any.
3063 (let ((table (or (copy-sequence standard-display-table)
3064 (make-display-table)))
3066 ;; Nix out all the control chars...
3067 (while (>= (setq i (1- i)) 0)
3068 (aset table i [??]))
3069 ;; ... but not newline and cr, of course. (cr is necessary for the
3070 ;; selective display).
3071 (aset table ?\n nil)
3072 (aset table ?\r nil)
3073 ;; We keep TAB as well.
3074 (aset table ?\t nil)
3075 ;; We nix out any glyphs over 126 that are not set already.
3077 (while (>= (setq i (1- i)) 127)
3078 ;; Only modify if the entry is nil.
3079 (unless (aref table i)
3080 (aset table i [??]))))
3081 (setq buffer-display-table table)))
3083 (defun gnus-summary-set-article-display-arrow (pos)
3084 "Update the overlay arrow to point to line at position POS."
3085 (when (and gnus-summary-display-arrow
3086 (boundp 'overlay-arrow-position)
3087 (boundp 'overlay-arrow-string))
3091 (unless overlay-arrow-position
3092 (setq overlay-arrow-position (make-marker)))
3093 (setq overlay-arrow-string "=>"
3094 overlay-arrow-position (set-marker overlay-arrow-position
3096 (current-buffer))))))
3098 (defun gnus-summary-setup-buffer (group)
3099 "Initialize summary buffer."
3100 (let ((buffer (gnus-summary-buffer-name group))
3101 (dead-name (concat "*Dead Summary "
3102 (gnus-group-decoded-name group) "*")))
3103 ;; If a dead summary buffer exists, we kill it.
3104 (when (gnus-buffer-live-p dead-name)
3105 (gnus-kill-buffer dead-name))
3106 (if (get-buffer buffer)
3109 (setq gnus-summary-buffer (current-buffer))
3110 (not gnus-newsgroup-prepared))
3111 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3112 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3113 (gnus-summary-mode group)
3115 (gnus-carpal-setup-buffer 'summary))
3116 (unless gnus-single-article-buffer
3117 (make-local-variable 'gnus-article-buffer)
3118 (make-local-variable 'gnus-article-current)
3119 (make-local-variable 'gnus-original-article-buffer))
3120 (setq gnus-newsgroup-name group)
3121 ;; Set any local variables in the group parameters.
3122 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3125 (defun gnus-set-global-variables ()
3126 "Set the global equivalents of the buffer-local variables.
3127 They are set to the latest values they had. These reflect the summary
3128 buffer that was in action when the last article was fetched."
3129 (when (eq major-mode 'gnus-summary-mode)
3130 (setq gnus-summary-buffer (current-buffer))
3131 (let ((name gnus-newsgroup-name)
3132 (marked gnus-newsgroup-marked)
3133 (spam gnus-newsgroup-spam-marked)
3134 (unread gnus-newsgroup-unreads)
3135 (headers gnus-current-headers)
3136 (data gnus-newsgroup-data)
3137 (summary gnus-summary-buffer)
3138 (article-buffer gnus-article-buffer)
3139 (original gnus-original-article-buffer)
3140 (gac gnus-article-current)
3141 (reffed gnus-reffed-article-number)
3142 (score-file gnus-current-score-file)
3143 (default-charset gnus-newsgroup-charset)
3145 (let ((locals gnus-newsgroup-variables))
3147 (if (consp (car locals))
3148 (push (eval (caar locals)) vlist)
3149 (push (eval (car locals)) vlist))
3150 (setq locals (cdr locals)))
3151 (setq vlist (nreverse vlist)))
3153 (set-buffer gnus-group-buffer)
3154 (setq gnus-newsgroup-name name
3155 gnus-newsgroup-marked marked
3156 gnus-newsgroup-spam-marked spam
3157 gnus-newsgroup-unreads unread
3158 gnus-current-headers headers
3159 gnus-newsgroup-data data
3160 gnus-article-current gac
3161 gnus-summary-buffer summary
3162 gnus-article-buffer article-buffer
3163 gnus-original-article-buffer original
3164 gnus-reffed-article-number reffed
3165 gnus-current-score-file score-file
3166 gnus-newsgroup-charset default-charset)
3167 (let ((locals gnus-newsgroup-variables))
3169 (if (consp (car locals))
3170 (set (caar locals) (pop vlist))
3171 (set (car locals) (pop vlist)))
3172 (setq locals (cdr locals))))
3173 ;; The article buffer also has local variables.
3174 (when (gnus-buffer-live-p gnus-article-buffer)
3175 (set-buffer gnus-article-buffer)
3176 (setq gnus-summary-buffer summary))))))
3178 (defun gnus-summary-article-unread-p (article)
3179 "Say whether ARTICLE is unread or not."
3180 (memq article gnus-newsgroup-unreads))
3182 (defun gnus-summary-first-article-p (&optional article)
3183 "Return whether ARTICLE is the first article in the buffer."
3184 (if (not (setq article (or article (gnus-summary-article-number))))
3186 (eq article (caar gnus-newsgroup-data))))
3188 (defun gnus-summary-last-article-p (&optional article)
3189 "Return whether ARTICLE is the last article in the buffer."
3190 (if (not (setq article (or article (gnus-summary-article-number))))
3191 ;; All non-existent numbers are the last article. :-)
3193 (not (cdr (gnus-data-find-list article)))))
3195 (defun gnus-make-thread-indent-array ()
3197 (unless (and gnus-thread-indent-array
3198 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3199 (setq gnus-thread-indent-array (make-vector 201 "")
3200 gnus-thread-indent-array-level gnus-thread-indent-level)
3202 (aset gnus-thread-indent-array n
3203 (make-string (* n gnus-thread-indent-level) ? ))
3206 (defun gnus-update-summary-mark-positions ()
3207 "Compute where the summary marks are to go."
3209 (when (gnus-buffer-exists-p gnus-summary-buffer)
3210 (set-buffer gnus-summary-buffer))
3211 (let ((gnus-replied-mark 129)
3212 (gnus-score-below-mark 130)
3213 (gnus-score-over-mark 130)
3214 (gnus-undownloaded-mark 131)
3215 (spec gnus-summary-line-format-spec)
3218 (gnus-set-work-buffer)
3219 (let ((gnus-summary-line-format-spec spec)
3220 (gnus-newsgroup-downloadable '(0)))
3221 (gnus-summary-insert-line
3222 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3223 0 nil t 128 t nil "" nil 1)
3224 (goto-char (point-min))
3225 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3226 (- (point) (point-min) 1)))))
3227 (goto-char (point-min))
3228 (push (cons 'replied (and (search-forward "\201" nil t)
3229 (- (point) (point-min) 1)))
3231 (goto-char (point-min))
3232 (push (cons 'score (and (search-forward "\202" nil t)
3233 (- (point) (point-min) 1)))
3235 (goto-char (point-min))
3236 (push (cons 'download
3237 (and (search-forward "\203" nil t)
3238 (- (point) (point-min) 1)))
3240 (setq gnus-summary-mark-positions pos))))
3242 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3243 "Insert a dummy root in the summary buffer."
3245 (gnus-add-text-properties
3246 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3247 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3249 (defun gnus-summary-extract-address-component (from)
3250 (or (car (funcall gnus-extract-address-components from))
3253 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3254 (let ((mail-parse-charset gnus-newsgroup-charset)
3255 ; Is it really necessary to do this next part for each summary line?
3256 ; Luckily, doesn't seem to slow things down much.
3257 (mail-parse-ignored-charsets
3258 (with-current-buffer gnus-summary-buffer
3259 gnus-newsgroup-ignored-charsets)))
3261 (and gnus-ignored-from-addresses
3262 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3263 (let ((extra-headers (mail-header-extra header))
3267 ((setq to (cdr (assq 'To extra-headers)))
3270 (gnus-summary-extract-address-component
3271 (funcall gnus-decode-encoded-word-function to)))))
3272 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3273 (concat "=> " newsgroups)))))
3274 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3276 (defun gnus-summary-insert-line (gnus-tmp-header
3277 gnus-tmp-level gnus-tmp-current
3278 undownloaded gnus-tmp-unread gnus-tmp-replied
3279 gnus-tmp-expirable gnus-tmp-subject-or-nil
3280 &optional gnus-tmp-dummy gnus-tmp-score
3282 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3283 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3284 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3285 (gnus-tmp-score-char
3286 (if (or (null gnus-summary-default-score)
3287 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3288 gnus-summary-zcore-fuzz))
3290 (if (< gnus-tmp-score gnus-summary-default-score)
3291 gnus-score-below-mark gnus-score-over-mark)))
3292 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3294 (cond (gnus-tmp-process gnus-process-mark)
3295 ((memq gnus-tmp-current gnus-newsgroup-cached)
3297 (gnus-tmp-replied gnus-replied-mark)
3298 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3299 gnus-forwarded-mark)
3300 ((memq gnus-tmp-current gnus-newsgroup-saved)
3302 ((memq gnus-tmp-number gnus-newsgroup-recent)
3304 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3307 (gnus-tmp-downloaded
3309 gnus-undownloaded-mark)
3310 (gnus-newsgroup-agentized
3311 gnus-downloaded-mark)
3314 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3317 ((string-match "<[^>]+> *$" gnus-tmp-from)
3318 (let ((beg (match-beginning 0)))
3319 (or (and (string-match "^\".+\"" gnus-tmp-from)
3320 (substring gnus-tmp-from 1 (1- (match-end 0))))
3321 (substring gnus-tmp-from 0 beg))))
3322 ((string-match "(.+)" gnus-tmp-from)
3323 (substring gnus-tmp-from
3324 (1+ (match-beginning 0)) (1- (match-end 0))))
3326 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3327 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3328 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3329 (buffer-read-only nil))
3330 (when (string= gnus-tmp-name "")
3331 (setq gnus-tmp-name gnus-tmp-from))
3332 (unless (numberp gnus-tmp-lines)
3333 (setq gnus-tmp-lines -1))
3334 (if (= gnus-tmp-lines -1)
3335 (setq gnus-tmp-lines "?")
3336 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3337 (gnus-put-text-property
3339 (progn (eval gnus-summary-line-format-spec) (point))
3340 'gnus-number gnus-tmp-number)
3341 (when (gnus-visual-p 'summary-highlight 'highlight)
3343 (gnus-run-hooks 'gnus-summary-update-hook)
3346 (defun gnus-summary-update-line (&optional dont-update)
3347 "Update summary line after change."
3348 (when (and gnus-summary-default-score
3349 (not gnus-summary-inhibit-highlight))
3350 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3351 (article (gnus-summary-article-number))
3352 (score (gnus-summary-article-score article)))
3354 (if (and gnus-summary-mark-below
3355 (< (gnus-summary-article-score)
3356 gnus-summary-mark-below))
3357 ;; This article has a low score, so we mark it as read.
3358 (when (memq article gnus-newsgroup-unreads)
3359 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3360 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3361 ;; This article was previously marked as read on account
3362 ;; of a low score, but now it has risen, so we mark it as
3364 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3365 (gnus-summary-update-mark
3366 (if (or (null gnus-summary-default-score)
3367 (<= (abs (- score gnus-summary-default-score))
3368 gnus-summary-zcore-fuzz))
3370 (if (< score gnus-summary-default-score)
3371 gnus-score-below-mark gnus-score-over-mark))
3373 ;; Do visual highlighting.
3374 (when (gnus-visual-p 'summary-highlight 'highlight)
3375 (gnus-run-hooks 'gnus-summary-update-hook)))))
3377 (defvar gnus-tmp-new-adopts nil)
3379 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3380 "Return the number of articles in THREAD.
3381 This may be 0 in some cases -- if none of the articles in
3382 the thread are to be displayed."
3384 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3386 ((not (listp thread))
3388 ((and (consp thread) (cdr thread))
3391 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3394 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3397 (when (and level (zerop level) gnus-tmp-new-adopts)
3400 'gnus-summary-number-of-articles-in-thread
3401 gnus-tmp-new-adopts))))
3403 (if (> number 1) gnus-not-empty-thread-mark
3404 gnus-empty-thread-mark)
3407 (defsubst gnus-summary-line-message-size (head)
3408 "Return pretty-printed version of message size.
3409 This function is intended to be used in
3410 `gnus-summary-line-format-alist'."
3411 (let ((c (or (mail-header-chars head) -1)))
3412 (cond ((< c 0) "n/a") ; chars not available
3413 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3414 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3415 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3416 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3419 (defun gnus-summary-set-local-parameters (group)
3420 "Go through the local params of GROUP and set all variable specs in that list."
3421 (let ((params (gnus-group-find-parameter group))
3422 (vars '(quit-config)) ; Ignore quit-config.
3425 (setq elem (car params)
3426 params (cdr params))
3427 (and (consp elem) ; Has to be a cons.
3428 (consp (cdr elem)) ; The cdr has to be a list.
3429 (symbolp (car elem)) ; Has to be a symbol in there.
3430 (not (memq (car elem) vars))
3431 (ignore-errors ; So we set it.
3432 (push (car elem) vars)
3433 (make-local-variable (car elem))
3434 (set (car elem) (eval (nth 1 elem))))))))
3436 (defun gnus-summary-read-group (group &optional show-all no-article
3437 kill-buffer no-display backward
3439 "Start reading news in newsgroup GROUP.
3440 If SHOW-ALL is non-nil, already read articles are also listed.
3441 If NO-ARTICLE is non-nil, no article is selected initially.
3442 If NO-DISPLAY, don't generate a summary buffer."
3446 (let ((gnus-auto-select-next nil))
3447 (or (gnus-summary-read-group-1
3448 group show-all no-article
3449 kill-buffer no-display
3452 select-articles nil)))))
3453 (eq gnus-auto-select-next 'quietly))
3454 (set-buffer gnus-group-buffer)
3455 ;; The entry function called above goes to the next
3456 ;; group automatically, so we go two groups back
3457 ;; if we are searching for the previous group.
3459 (gnus-group-prev-unread-group 2))
3460 (if (not (equal group (gnus-group-group-name)))
3461 (setq group (gnus-group-group-name))
3465 (defun gnus-summary-read-group-1 (group show-all no-article
3466 kill-buffer no-display
3467 &optional select-articles)
3468 ;; Killed foreign groups can't be entered.
3469 ;; (when (and (not (gnus-group-native-p group))
3470 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3471 ;; (error "Dead non-native groups can't be entered"))
3472 (gnus-message 5 "Retrieving newsgroup: %s..."
3473 (gnus-group-decoded-name group))
3474 (let* ((new-group (gnus-summary-setup-buffer group))
3475 (quit-config (gnus-group-quit-config group))
3476 (did-select (and new-group (gnus-select-newsgroup
3477 group show-all select-articles))))
3479 ;; This summary buffer exists already, so we just select it.
3481 (gnus-set-global-variables)
3483 (gnus-kill-or-deaden-summary kill-buffer))
3484 (gnus-configure-windows 'summary 'force)
3485 (gnus-set-mode-line 'summary)
3486 (gnus-summary-position-point)
3489 ;; We couldn't select this group.
3491 (when (and (eq major-mode 'gnus-summary-mode)
3492 (not (equal (current-buffer) kill-buffer)))
3493 (kill-buffer (current-buffer))
3494 (if (not quit-config)
3496 ;; Update the info -- marks might need to be removed,
3498 (gnus-summary-update-info)
3499 (set-buffer gnus-group-buffer)
3500 (gnus-group-jump-to-group group)
3501 (gnus-group-next-unread-group 1))
3502 (gnus-handle-ephemeral-exit quit-config)))
3503 (let ((grpinfo (gnus-get-info group)))
3504 (if (null (gnus-info-read grpinfo))
3505 (gnus-message 3 "Group %s contains no messages"
3506 (gnus-group-decoded-name group))
3507 (gnus-message 3 "Can't select group")))
3509 ;; The user did a `C-g' while prompting for number of articles,
3510 ;; so we exit this group.
3511 ((eq did-select 'quit)
3512 (and (eq major-mode 'gnus-summary-mode)
3513 (not (equal (current-buffer) kill-buffer))
3514 (kill-buffer (current-buffer)))
3516 (gnus-kill-or-deaden-summary kill-buffer))
3517 (if (not quit-config)
3519 (set-buffer gnus-group-buffer)
3520 (gnus-group-jump-to-group group)
3521 (gnus-group-next-unread-group 1)
3522 (gnus-configure-windows 'group 'force))
3523 (gnus-handle-ephemeral-exit quit-config))
3524 ;; Finally signal the quit.
3526 ;; The group was successfully selected.
3528 (gnus-set-global-variables)
3529 ;; Save the active value in effect when the group was entered.
3530 (setq gnus-newsgroup-active
3532 (gnus-active gnus-newsgroup-name)))
3533 ;; You can change the summary buffer in some way with this hook.
3534 (gnus-run-hooks 'gnus-select-group-hook)
3535 (gnus-update-format-specifications
3536 nil 'summary 'summary-mode 'summary-dummy)
3537 (gnus-update-summary-mark-positions)
3538 ;; Do score processing.
3539 (when gnus-use-scoring
3540 (gnus-possibly-score-headers))
3541 ;; Check whether to fill in the gaps in the threads.
3542 (when gnus-build-sparse-threads
3543 (gnus-build-sparse-threads))
3544 ;; Find the initial limit.
3545 (if gnus-show-threads
3547 (let ((gnus-newsgroup-dormant nil))
3548 (gnus-summary-initial-limit show-all))
3549 (gnus-summary-initial-limit show-all))
3550 ;; When unthreaded, all articles are always shown.
3551 (setq gnus-newsgroup-limit
3553 (lambda (header) (mail-header-number header))
3554 gnus-newsgroup-headers)))
3555 ;; Generate the summary buffer.
3557 (gnus-summary-prepare))
3558 (when gnus-use-trees
3559 (gnus-tree-open group)
3560 (setq gnus-summary-highlight-line-function
3561 'gnus-tree-highlight-article))
3562 ;; If the summary buffer is empty, but there are some low-scored
3563 ;; articles or some excluded dormants, we include these in the
3565 (when (and (zerop (buffer-size))
3567 (cond (gnus-newsgroup-dormant
3568 (gnus-summary-limit-include-dormant))
3569 ((and gnus-newsgroup-scored show-all)
3570 (gnus-summary-limit-include-expunged t))))
3571 ;; Function `gnus-apply-kill-file' must be called in this hook.
3572 (gnus-run-hooks 'gnus-apply-kill-hook)
3573 (if (and (zerop (buffer-size))
3576 ;; This newsgroup is empty.
3577 (gnus-summary-catchup-and-exit nil t)
3578 (gnus-message 6 "No unread news")
3580 (gnus-kill-or-deaden-summary kill-buffer))
3581 ;; Return nil from this function.
3583 ;; Hide conversation thread subtrees. We cannot do this in
3584 ;; gnus-summary-prepare-hook since kill processing may not
3585 ;; work with hidden articles.
3586 (gnus-summary-maybe-hide-threads)
3588 (gnus-kill-or-deaden-summary kill-buffer))
3589 (gnus-summary-auto-select-subject)
3590 ;; Show first unread article if requested.
3591 (if (and (not no-article)
3593 gnus-newsgroup-unreads
3594 gnus-auto-select-first)
3596 (gnus-configure-windows 'summary)
3597 (let ((art (gnus-summary-article-number)))
3598 (unless (and (not gnus-plugged)
3599 (or (memq art gnus-newsgroup-undownloaded)
3600 (memq art gnus-newsgroup-downloadable)))
3601 (gnus-summary-goto-article art))))
3602 ;; Don't select any articles.
3603 (gnus-summary-position-point)
3604 (gnus-configure-windows 'summary 'force)
3605 (gnus-set-mode-line 'summary))
3606 (when (and gnus-auto-center-group
3607 (get-buffer-window gnus-group-buffer t))
3608 ;; Gotta use windows, because recenter does weird stuff if
3609 ;; the current buffer ain't the displayed window.
3610 (let ((owin (selected-window)))
3611 (select-window (get-buffer-window gnus-group-buffer t))
3612 (when (gnus-group-goto-group group)
3614 (select-window owin)))
3615 ;; Mark this buffer as "prepared".
3616 (setq gnus-newsgroup-prepared t)
3617 (gnus-run-hooks 'gnus-summary-prepared-hook)
3618 (unless (gnus-ephemeral-group-p group)
3619 (gnus-group-update-group group))
3622 (defun gnus-summary-auto-select-subject ()
3623 "Select the subject line on initial group entry."
3624 (goto-char (point-min))
3626 ((eq gnus-auto-select-subject 'best)
3627 (gnus-summary-best-unread-subject))
3628 ((eq gnus-auto-select-subject 'unread)
3629 (gnus-summary-first-unread-subject))
3630 ((eq gnus-auto-select-subject 'unseen)
3631 (gnus-summary-first-unseen-subject))
3632 ((eq gnus-auto-select-subject 'unseen-or-unread)
3633 (gnus-summary-first-unseen-or-unread-subject))
3634 ((eq gnus-auto-select-subject 'first)
3637 ((functionp gnus-auto-select-subject)
3638 (funcall gnus-auto-select-subject))))
3640 (defun gnus-summary-prepare ()
3641 "Generate the summary buffer."
3643 (let ((buffer-read-only nil))
3645 (setq gnus-newsgroup-data nil
3646 gnus-newsgroup-data-reverse nil)
3647 (gnus-run-hooks 'gnus-summary-generate-hook)
3648 ;; Generate the buffer, either with threads or without.
3649 (when gnus-newsgroup-headers
3650 (gnus-summary-prepare-threads
3651 (if gnus-show-threads
3652 (gnus-sort-gathered-threads
3653 (funcall gnus-summary-thread-gathering-function
3655 (gnus-cut-threads (gnus-make-threads)))))
3656 ;; Unthreaded display.
3657 (gnus-sort-articles gnus-newsgroup-headers))))
3658 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3659 ;; Call hooks for modifying summary buffer.
3660 (goto-char (point-min))
3661 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3663 (defsubst gnus-general-simplify-subject (subject)
3664 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3667 ;; Truncate the subject.
3668 (gnus-simplify-subject-functions
3669 (gnus-map-function gnus-simplify-subject-functions subject))
3670 ((numberp gnus-summary-gather-subject-limit)
3671 (setq subject (gnus-simplify-subject-re subject))
3672 (if (> (length subject) gnus-summary-gather-subject-limit)
3673 (substring subject 0 gnus-summary-gather-subject-limit)
3675 ;; Fuzzily simplify it.
3676 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3677 (gnus-simplify-subject-fuzzy subject))
3678 ;; Just remove the leading "Re:".
3680 (gnus-simplify-subject-re subject))))
3682 (if (and gnus-summary-gather-exclude-subject
3683 (string-match gnus-summary-gather-exclude-subject subject))
3684 nil ; This article shouldn't be gathered
3687 (defun gnus-summary-simplify-subject-query ()
3688 "Query where the respool algorithm would put this article."
3690 (gnus-summary-select-article)
3691 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3693 (defun gnus-gather-threads-by-subject (threads)
3694 "Gather threads by looking at Subject headers."
3695 (if (not gnus-summary-make-false-root)
3697 (let ((hashtb (gnus-make-hashtable 1024))
3700 subject hthread whole-subject)
3702 (setq subject (gnus-general-simplify-subject
3703 (setq whole-subject (mail-header-subject
3706 (if (setq hthread (gnus-gethash subject hashtb))
3708 ;; We enter a dummy root into the thread, if we
3709 ;; haven't done that already.
3710 (unless (stringp (caar hthread))
3711 (setcar hthread (list whole-subject (car hthread))))
3712 ;; We add this new gathered thread to this gathered
3714 (setcdr (car hthread)
3715 (nconc (cdar hthread) (list (car threads))))
3716 ;; Remove it from the list of threads.
3717 (setcdr prev (cdr threads))
3718 (setq threads prev))
3719 ;; Enter this thread into the hash table.
3720 (gnus-sethash subject
3721 (if gnus-summary-make-false-root-always
3723 ;; If you want a dummy root above all
3725 (setcar threads (list whole-subject
3731 (setq threads (cdr threads)))
3734 (defun gnus-gather-threads-by-references (threads)
3735 "Gather threads by looking at References headers."
3736 (let ((idhashtb (gnus-make-hashtable 1024))
3737 (thhashtb (gnus-make-hashtable 1024))
3740 ids references id gthread gid entered ref)
3742 (when (setq references (mail-header-references (caar threads)))
3743 (setq id (mail-header-id (caar threads))
3744 ids (inline (gnus-split-references references))
3746 (while (setq ref (pop ids))
3747 (setq ids (delete ref ids))
3748 (if (not (setq gid (gnus-gethash ref idhashtb)))
3750 (gnus-sethash ref id idhashtb)
3751 (gnus-sethash id threads thhashtb))
3752 (setq gthread (gnus-gethash gid thhashtb))
3754 ;; We enter a dummy root into the thread, if we
3755 ;; haven't done that already.
3756 (unless (stringp (caar gthread))
3757 (setcar gthread (list (mail-header-subject (caar gthread))
3759 ;; We add this new gathered thread to this gathered
3761 (setcdr (car gthread)
3762 (nconc (cdar gthread) (list (car threads)))))
3763 ;; Add it into the thread hash table.
3764 (gnus-sethash id gthread thhashtb)
3766 ;; Remove it from the list of threads.
3767 (setcdr prev (cdr threads))
3768 (setq threads prev))))
3770 (setq threads (cdr threads)))
3773 (defun gnus-sort-gathered-threads (threads)
3774 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3775 (let ((result threads))
3777 (when (stringp (caar threads))
3778 (setcdr (car threads)
3779 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3780 (setq threads (cdr threads)))
3783 (defun gnus-thread-loop-p (root thread)
3784 "Say whether ROOT is in THREAD."
3785 (let ((stack (list thread))
3788 (while (setq thread (pop stack))
3789 (setq th (cdr thread))
3791 (not (eq (caar th) root)))
3794 ;; We have found a loop.
3796 (setcdr thread (delq (car th) (cdr thread)))
3797 (if (boundp (setq ref-dep (intern "none"
3798 gnus-newsgroup-dependencies)))
3799 (setcdr (symbol-value ref-dep)
3800 (nconc (cdr (symbol-value ref-dep))
3802 (set ref-dep (list nil (car th))))
3805 ;; Push all the subthreads onto the stack.
3806 (push (cdr thread) stack)))
3809 (defun gnus-make-threads ()
3810 "Go through the dependency hashtb and find the roots. Return all threads."
3812 (while (catch 'infloop
3815 ;; Deal with self-referencing References loops.
3816 (when (and (car (symbol-value refs))
3823 (car (symbol-value refs)) thread))
3824 (cdr (symbol-value refs)))))))
3827 (unless (car (symbol-value refs))
3828 ;; These threads do not refer back to any other
3829 ;; articles, so they're roots.
3830 (setq threads (append (cdr (symbol-value refs)) threads))))
3831 gnus-newsgroup-dependencies)))
3834 ;; Build the thread tree.
3835 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3836 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3838 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3839 if it was already present.
3841 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3842 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3843 Message-IDs will be renamed to a unique Message-ID before being
3846 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3847 (let* ((id (mail-header-id header))
3848 (id-dep (and id (intern id dependencies)))
3849 parent-id ref ref-dep ref-header replaced)
3850 ;; Enter this `header' in the `dependencies' table.
3854 ;; The first two cases do the normal part: enter a new `header'
3855 ;; in the `dependencies' table.
3856 ((not (boundp id-dep))
3857 (set id-dep (list header)))
3858 ((null (car (symbol-value id-dep)))
3859 (setcar (symbol-value id-dep) header))
3861 ;; From here the `header' was already present in the
3862 ;; `dependencies' table.
3864 ;; Overrides an existing entry;
3865 ;; just set the header part of the entry.
3866 (setcar (symbol-value id-dep) header)
3869 ;; Renames the existing `header' to a unique Message-ID.
3870 ((not gnus-summary-ignore-duplicates)
3871 ;; An article with this Message-ID has already been seen.
3872 ;; We rename the Message-ID.
3873 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3875 (mail-header-set-id header id))
3877 ;; The last case ignores an existing entry, except it adds any
3878 ;; additional Xrefs (in case the two articles came from different
3880 ;; Also sets `header' to `nil' meaning that the `dependencies'
3881 ;; table was *not* modified.
3883 (mail-header-set-xref
3884 (car (symbol-value id-dep))
3885 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3887 (or (mail-header-xref header) "")))
3890 (when (and header (not replaced))
3891 ;; First check that we are not creating a References loop.
3892 (setq parent-id (gnus-parent-id (mail-header-references header)))
3893 (setq ref parent-id)
3895 (setq ref-dep (intern-soft ref dependencies))
3897 (setq ref-header (car (symbol-value ref-dep))))
3898 (if (string= id ref)
3899 ;; Yuk! This is a reference loop. Make the article be a
3902 (mail-header-set-references (car (symbol-value id-dep)) "none")
3904 (setq parent-id nil))
3905 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3906 (setq ref-dep (intern (or parent-id "none") dependencies))
3907 (if (boundp ref-dep)
3908 (setcdr (symbol-value ref-dep)
3909 (nconc (cdr (symbol-value ref-dep))
3910 (list (symbol-value id-dep))))
3911 (set ref-dep (list nil (symbol-value id-dep)))))
3914 (defun gnus-extract-message-id-from-in-reply-to (string)
3915 (if (string-match "<[^>]+>" string)
3916 (substring string (match-beginning 0) (match-end 0))
3919 (defun gnus-build-sparse-threads ()
3920 (let ((headers gnus-newsgroup-headers)
3921 (mail-parse-charset gnus-newsgroup-charset)
3922 (gnus-summary-ignore-duplicates t)
3923 header references generation relations
3924 subject child end new-child date)
3925 ;; First we create an alist of generations/relations, where
3926 ;; generations is how much we trust the relation, and the relation
3928 (gnus-message 7 "Making sparse threads...")
3930 (nnheader-set-temp-buffer " *gnus sparse threads*")
3931 (while (setq header (pop headers))
3932 (when (and (setq references (mail-header-references header))
3933 (not (string= references "")))
3935 (setq child (mail-header-id header)
3936 subject (mail-header-subject header)
3937 date (mail-header-date header)
3939 (while (search-backward ">" nil t)
3940 (setq end (1+ (point)))
3941 (when (search-backward "<" nil t)
3942 (setq new-child (buffer-substring (point) end))
3943 (push (list (incf generation)
3944 child (setq child new-child)
3948 (push (list (1+ generation) child nil subject) relations))
3950 (kill-buffer (current-buffer)))
3951 ;; Sort over trustworthiness.
3954 (when (gnus-dependencies-add-header
3955 (make-full-mail-header
3956 gnus-reffed-article-number
3957 (nth 3 relation) "" (or (nth 4 relation) "")
3959 (or (nth 2 relation) "") 0 0 "")
3960 gnus-newsgroup-dependencies nil)
3961 (push gnus-reffed-article-number gnus-newsgroup-limit)
3962 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3963 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3964 gnus-newsgroup-reads)
3965 (decf gnus-reffed-article-number)))
3966 (sort relations 'car-less-than-car))
3967 (gnus-message 7 "Making sparse threads...done")))
3969 (defun gnus-build-old-threads ()
3970 ;; Look at all the articles that refer back to old articles, and
3971 ;; fetch the headers for the articles that aren't there. This will
3972 ;; build complete threads - if the roots haven't been expired by the
3974 (let ((mail-parse-charset gnus-newsgroup-charset)
3978 (when (not (car (symbol-value refs)))
3979 (setq heads (cdr (symbol-value refs)))
3981 (if (memq (mail-header-number (caar heads))
3982 gnus-newsgroup-dormant)
3983 (setq heads (cdr heads))
3984 (setq id (symbol-name refs))
3985 (while (and (setq id (gnus-build-get-header id))
3986 (not (car (gnus-id-to-thread id)))))
3987 (setq heads nil)))))
3988 gnus-newsgroup-dependencies)))
3990 (defsubst gnus-remove-odd-characters (string)
3991 "Translate STRING into something that doesn't contain weird characters."
3992 (mm-subst-char-in-string
3994 (mm-subst-char-in-string ?\n ?\- string t) t))
3996 ;; This function has to be called with point after the article number
3997 ;; on the beginning of the line.
3998 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3999 (let ((eol (point-at-eol))
4000 (buffer (current-buffer))
4001 header references in-reply-to)
4003 ;; overview: [num subject from date id refs chars lines misc]
4006 (narrow-to-region (point) eol)
4011 (make-full-mail-header
4013 (condition-case () ; subject
4014 (gnus-remove-odd-characters
4015 (funcall gnus-decode-encoded-word-function
4016 (setq x (nnheader-nov-field))))
4018 (condition-case () ; from
4019 (gnus-remove-odd-characters
4020 (funcall gnus-decode-encoded-word-function
4021 (setq x (nnheader-nov-field))))
4023 (nnheader-nov-field) ; date
4024 (nnheader-nov-read-message-id) ; id
4025 (setq references (nnheader-nov-field)) ; refs
4026 (nnheader-nov-read-integer) ; chars
4027 (nnheader-nov-read-integer) ; lines
4029 (if (looking-at "Xref: ")
4030 (goto-char (match-end 0)))
4031 (nnheader-nov-field)) ; Xref
4032 (nnheader-nov-parse-extra)))) ; extra
4036 (when (and (string= references "")
4037 (setq in-reply-to (mail-header-extra header))
4038 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4039 (mail-header-set-references
4040 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4042 (when gnus-alter-header-function
4043 (funcall gnus-alter-header-function header))
4044 (gnus-dependencies-add-header header dependencies force-new)))
4046 (defun gnus-build-get-header (id)
4047 "Look through the buffer of NOV lines and find the header to ID.
4048 Enter this line into the dependencies hash table, and return
4049 the id of the parent article (if any)."
4050 (let ((deps gnus-newsgroup-dependencies)
4054 (set-buffer nntp-server-buffer)
4055 (let ((case-fold-search nil))
4056 (goto-char (point-min))
4057 (while (and (not found)
4058 (search-forward id nil t))
4060 (setq found (looking-at
4061 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4062 (regexp-quote id))))
4063 (or found (beginning-of-line 2)))
4067 (setq header (gnus-nov-parse-line
4068 (read (current-buffer)) deps))
4069 (gnus-parent-id (mail-header-references header))))))
4071 (let ((number (mail-header-number header)))
4072 (push number gnus-newsgroup-limit)
4073 (push header gnus-newsgroup-headers)
4074 (if (memq number gnus-newsgroup-unselected)
4076 (setq gnus-newsgroup-unreads
4077 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4079 (setq gnus-newsgroup-unselected
4080 (delq number gnus-newsgroup-unselected)))
4081 (push number gnus-newsgroup-ancient)))))))
4083 (defun gnus-build-all-threads ()
4084 "Read all the headers."
4085 (let ((gnus-summary-ignore-duplicates t)
4086 (mail-parse-charset gnus-newsgroup-charset)
4087 (dependencies gnus-newsgroup-dependencies)
4090 (set-buffer nntp-server-buffer)
4091 (let ((case-fold-search nil))
4092 (goto-char (point-min))
4095 (setq article (read (current-buffer))
4096 header (gnus-nov-parse-line article dependencies)))
4099 (set-buffer gnus-summary-buffer)
4100 (push header gnus-newsgroup-headers)
4101 (if (memq (setq article (mail-header-number header))
4102 gnus-newsgroup-unselected)
4104 (setq gnus-newsgroup-unreads
4105 (gnus-add-to-sorted-list
4106 gnus-newsgroup-unreads article))
4107 (setq gnus-newsgroup-unselected
4108 (delq article gnus-newsgroup-unselected)))
4109 (push article gnus-newsgroup-ancient)))
4110 (forward-line 1)))))))
4112 (defun gnus-summary-update-article-line (article header)
4113 "Update the line for ARTICLE using HEADER."
4114 (let* ((id (mail-header-id header))
4115 (thread (gnus-id-to-thread id)))
4117 (error "Article in no thread"))
4118 ;; Update the thread.
4119 (setcar thread header)
4120 (gnus-summary-goto-subject article)
4121 (let* ((datal (gnus-data-find-list article))
4123 (buffer-read-only nil)
4124 (level (gnus-summary-thread-level)))
4126 (let ((inserted (- (point)
4128 (gnus-summary-insert-line
4130 (memq article gnus-newsgroup-undownloaded)
4131 (gnus-article-mark article)
4132 (memq article gnus-newsgroup-replied)
4133 (memq article gnus-newsgroup-expirable)
4134 ;; Only insert the Subject string when it's different
4135 ;; from the previous Subject string.
4140 (mail-header-subject
4143 (gnus-data-find-list
4145 (gnus-data-list t)))))
4146 ;; Error on the side of excessive subjects.
4148 (mail-header-subject header)))
4150 (mail-header-subject header))
4151 nil (cdr (assq article gnus-newsgroup-scored))
4152 (memq article gnus-newsgroup-processable))
4155 (gnus-data-update-list
4157 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4159 (defun gnus-summary-update-article (article &optional iheader)
4160 "Update ARTICLE in the summary buffer."
4161 (set-buffer gnus-summary-buffer)
4162 (let* ((header (gnus-summary-article-header article))
4163 (id (mail-header-id header))
4164 (data (gnus-data-find article))
4165 (thread (gnus-id-to-thread id))
4166 (references (mail-header-references header))
4170 (when (and references
4171 (not (equal "" references)))
4174 (buffer-read-only nil)
4180 (delq thread parent)))
4181 (if (gnus-summary-insert-subject id header)
4182 ;; Set the (possibly) new article number in the data structure.
4183 (gnus-data-set-number data (gnus-id-to-article id))
4187 (defun gnus-rebuild-thread (id &optional line)
4188 "Rebuild the thread containing ID.
4189 If LINE, insert the rebuilt thread starting on line LINE."
4190 (let ((buffer-read-only nil)
4191 old-pos current thread data)
4192 (if (not gnus-show-threads)
4193 (setq thread (list (car (gnus-id-to-thread id))))
4194 ;; Get the thread this article is part of.
4195 (setq thread (gnus-remove-thread id)))
4196 (setq old-pos (point-at-bol))
4197 (setq current (save-excursion
4198 (and (re-search-backward "[\r\n]" nil t)
4199 (gnus-summary-article-number))))
4200 ;; If this is a gathered thread, we have to go some re-gathering.
4201 (when (stringp (car thread))
4202 (let ((subject (car thread))
4204 (setq thread (cdr thread))
4206 (unless (memq (setq thr (gnus-id-to-thread
4208 (mail-header-id (caar thread)))))
4211 (setq thread (cdr thread)))
4212 ;; We now have all (unique) roots.
4213 (if (= (length roots) 1)
4214 ;; All the loose roots are now one solid root.
4215 (setq thread (car roots))
4216 (setq thread (cons subject (gnus-sort-threads roots))))))
4218 ;; We then insert this thread into the summary buffer.
4220 (goto-char (point-min))
4221 (forward-line (1- line)))
4222 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4223 (if gnus-show-threads
4224 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4225 (gnus-summary-prepare-unthreaded thread))
4226 (setq data (nreverse gnus-newsgroup-data))
4227 (setq threads gnus-newsgroup-threads))
4228 ;; We splice the new data into the data structure.
4229 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4230 ;;!!! then we want to insert at the beginning of the buffer.
4231 ;;!!! That happens to be true with Gnus now, but that may
4232 ;;!!! change in the future. Perhaps.
4233 (gnus-data-enter-list
4234 (if line nil current) data (- (point) old-pos))
4235 (setq gnus-newsgroup-threads
4236 (nconc threads gnus-newsgroup-threads))
4237 (gnus-data-compute-positions))))
4239 (defun gnus-number-to-header (number)
4240 "Return the header for article NUMBER."
4241 (let ((headers gnus-newsgroup-headers))
4243 (not (= number (mail-header-number (car headers)))))
4248 (defun gnus-parent-headers (in-headers &optional generation)
4249 "Return the headers of the GENERATIONeth parent of HEADERS."
4251 (setq generation 1))
4253 (headers in-headers)
4256 (not (zerop generation))
4257 (setq references (mail-header-references headers)))
4258 (setq headers (if (and references
4259 (setq parent (gnus-parent-id references)))
4260 (car (gnus-id-to-thread parent))
4263 (and (not (eq headers in-headers))
4266 (defun gnus-id-to-thread (id)
4267 "Return the (sub-)thread where ID appears."
4268 (gnus-gethash id gnus-newsgroup-dependencies))
4270 (defun gnus-id-to-article (id)
4271 "Return the article number of ID."
4272 (let ((thread (gnus-id-to-thread id)))
4275 (mail-header-number (car thread)))))
4277 (defun gnus-id-to-header (id)
4278 "Return the article headers of ID."
4279 (car (gnus-id-to-thread id)))
4281 (defun gnus-article-displayed-root-p (article)
4282 "Say whether ARTICLE is a root(ish) article."
4283 (let ((level (gnus-summary-thread-level article))
4284 (refs (mail-header-references (gnus-summary-article-header article)))
4290 ((null (gnus-parent-id refs)) t)
4292 (null (setq particle (gnus-id-to-article
4293 (gnus-parent-id refs))))
4294 (null (gnus-summary-thread-level particle)))))))
4296 (defun gnus-root-id (id)
4297 "Return the id of the root of the thread where ID appears."
4299 (while (and id (setq prev (car (gnus-id-to-thread id))))
4301 id (gnus-parent-id (mail-header-references prev))))
4304 (defun gnus-articles-in-thread (thread)
4305 "Return the list of articles in THREAD."
4306 (cons (mail-header-number (car thread))
4307 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4309 (defun gnus-remove-thread (id &optional dont-remove)
4310 "Remove the thread that has ID in it."
4311 (let (headers thread last-id)
4312 ;; First go up in this thread until we find the root.
4313 (setq last-id (gnus-root-id id)
4314 headers (message-flatten-list (gnus-id-to-thread last-id)))
4315 ;; We have now found the real root of this thread. It might have
4316 ;; been gathered into some loose thread, so we have to search
4317 ;; through the threads to find the thread we wanted.
4318 (let ((threads gnus-newsgroup-threads)
4321 (setq sub (car threads))
4322 (if (stringp (car sub))
4323 ;; This is a gathered thread, so we look at the roots
4324 ;; below it to find whether this article is in this
4327 (setq sub (cdr sub))
4329 (when (member (caar sub) headers)
4330 (setq thread (car threads)
4333 (setq sub (cdr sub))))
4334 ;; It's an ordinary thread, so we check it.
4335 (when (eq (car sub) (car headers))
4338 (setq threads (cdr threads)))
4339 ;; If this article is in no thread, then it's a root.
4342 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4343 (setq thread (gnus-id-to-thread last-id)))
4346 thread ; We return this thread.
4348 (if (stringp (car thread))
4350 ;; If we use dummy roots, then we have to remove the
4351 ;; dummy root as well.
4352 (when (eq gnus-summary-make-false-root 'dummy)
4353 ;; We go to the dummy root by going to
4354 ;; the first sub-"thread", and then one line up.
4355 (gnus-summary-goto-article
4356 (mail-header-number (caadr thread)))
4359 (gnus-data-compute-positions))
4360 (setq thread (cdr thread))
4362 (gnus-remove-thread-1 (car thread))
4363 (setq thread (cdr thread))))
4364 (gnus-remove-thread-1 thread))))))))
4366 (defun gnus-remove-thread-1 (thread)
4367 "Remove the thread THREAD recursively."
4368 (let ((number (mail-header-number (pop thread)))
4370 (setq thread (reverse thread))
4372 (gnus-remove-thread-1 (pop thread)))
4373 (when (setq d (gnus-data-find number))
4374 (goto-char (gnus-data-pos d))
4375 (gnus-summary-show-thread)
4381 (gnus-delete-line)))))))
4383 (defun gnus-sort-threads-1 (threads func)
4384 (sort (mapcar (lambda (thread)
4387 (gnus-sort-threads-1 (cdr thread) func))))
4390 (defun gnus-sort-threads (threads)
4392 (if (not gnus-thread-sort-functions)
4394 (gnus-message 8 "Sorting threads...")
4395 (let ((max-lisp-eval-depth 5000))
4396 (prog1 (gnus-sort-threads-1
4398 (gnus-make-sort-function gnus-thread-sort-functions))
4399 (gnus-message 8 "Sorting threads...done")))))
4401 (defun gnus-sort-articles (articles)
4403 (when gnus-article-sort-functions
4404 (gnus-message 7 "Sorting articles...")
4406 (setq gnus-newsgroup-headers
4407 (sort articles (gnus-make-sort-function
4408 gnus-article-sort-functions)))
4409 (gnus-message 7 "Sorting articles...done"))))
4411 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4412 (defmacro gnus-thread-header (thread)
4413 "Return header of first article in THREAD.
4414 Note that THREAD must never, ever be anything else than a variable -
4415 using some other form will lead to serious barfage."
4416 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4417 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4418 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4421 (defsubst gnus-article-sort-by-number (h1 h2)
4422 "Sort articles by article number."
4423 (< (mail-header-number h1)
4424 (mail-header-number h2)))
4426 (defun gnus-thread-sort-by-number (h1 h2)
4427 "Sort threads by root article number."
4428 (gnus-article-sort-by-number
4429 (gnus-thread-header h1) (gnus-thread-header h2)))
4431 (defsubst gnus-article-sort-by-random (h1 h2)
4432 "Sort articles by article number."
4435 (defun gnus-thread-sort-by-random (h1 h2)
4436 "Sort threads by root article number."
4437 (gnus-article-sort-by-random
4438 (gnus-thread-header h1) (gnus-thread-header h2)))
4440 (defsubst gnus-article-sort-by-lines (h1 h2)
4441 "Sort articles by article Lines header."
4442 (< (mail-header-lines h1)
4443 (mail-header-lines h2)))
4445 (defun gnus-thread-sort-by-lines (h1 h2)
4446 "Sort threads by root article Lines header."
4447 (gnus-article-sort-by-lines
4448 (gnus-thread-header h1) (gnus-thread-header h2)))
4450 (defsubst gnus-article-sort-by-chars (h1 h2)
4451 "Sort articles by octet length."
4452 (< (mail-header-chars h1)
4453 (mail-header-chars h2)))
4455 (defun gnus-thread-sort-by-chars (h1 h2)
4456 "Sort threads by root article octet length."
4457 (gnus-article-sort-by-chars
4458 (gnus-thread-header h1) (gnus-thread-header h2)))
4460 (defsubst gnus-article-sort-by-author (h1 h2)
4461 "Sort articles by root author."
4463 (let ((extract (funcall
4464 gnus-extract-address-components
4465 (mail-header-from h1))))
4466 (or (car extract) (cadr extract) ""))
4467 (let ((extract (funcall
4468 gnus-extract-address-components
4469 (mail-header-from h2))))
4470 (or (car extract) (cadr extract) ""))))
4472 (defun gnus-thread-sort-by-author (h1 h2)
4473 "Sort threads by root author."
4474 (gnus-article-sort-by-author
4475 (gnus-thread-header h1) (gnus-thread-header h2)))
4477 (defsubst gnus-article-sort-by-subject (h1 h2)
4478 "Sort articles by root subject."
4480 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4481 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4483 (defun gnus-thread-sort-by-subject (h1 h2)
4484 "Sort threads by root subject."
4485 (gnus-article-sort-by-subject
4486 (gnus-thread-header h1) (gnus-thread-header h2)))
4488 (defsubst gnus-article-sort-by-date (h1 h2)
4489 "Sort articles by root article date."
4491 (gnus-date-get-time (mail-header-date h1))
4492 (gnus-date-get-time (mail-header-date h2))))
4494 (defun gnus-thread-sort-by-date (h1 h2)
4495 "Sort threads by root article date."
4496 (gnus-article-sort-by-date
4497 (gnus-thread-header h1) (gnus-thread-header h2)))
4499 (defsubst gnus-article-sort-by-score (h1 h2)
4500 "Sort articles by root article score.
4501 Unscored articles will be counted as having a score of zero."
4502 (> (or (cdr (assq (mail-header-number h1)
4503 gnus-newsgroup-scored))
4504 gnus-summary-default-score 0)
4505 (or (cdr (assq (mail-header-number h2)
4506 gnus-newsgroup-scored))
4507 gnus-summary-default-score 0)))
4509 (defun gnus-thread-sort-by-score (h1 h2)
4510 "Sort threads by root article score."
4511 (gnus-article-sort-by-score
4512 (gnus-thread-header h1) (gnus-thread-header h2)))
4514 (defun gnus-thread-sort-by-total-score (h1 h2)
4515 "Sort threads by the sum of all scores in the thread.
4516 Unscored articles will be counted as having a score of zero."
4517 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4519 (defun gnus-thread-total-score (thread)
4520 ;; This function find the total score of THREAD.
4525 (if (stringp (car thread))
4526 (apply gnus-thread-score-function 0
4527 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4528 (gnus-thread-total-score-1 thread)))
4530 (gnus-thread-total-score-1 (list thread)))))
4532 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4533 "Sort threads such that the thread with the most recently arrived article comes first."
4534 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4536 (defun gnus-thread-highest-number (thread)
4537 "Return the highest article number in THREAD."
4538 (apply 'max (mapcar (lambda (header)
4539 (mail-header-number header))
4540 (message-flatten-list thread))))
4542 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4543 "Sort threads such that the thread with the most recently dated article comes first."
4544 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4546 (defun gnus-thread-latest-date (thread)
4547 "Return the highest article date in THREAD."
4548 (let ((previous-time 0))
4554 (time-to-seconds (mail-header-parse-date
4555 (mail-header-date header)))
4556 (error previous-time))))
4558 (message-flatten-list thread)
4560 (< (mail-header-number h1)
4561 (mail-header-number h2))))))))
4563 (defun gnus-thread-total-score-1 (root)
4564 ;; This function find the total score of the thread below ROOT.
4565 (setq root (car root))
4566 (apply gnus-thread-score-function
4568 (mapcar 'gnus-thread-total-score
4569 (cdr (gnus-id-to-thread (mail-header-id root))))
4570 (when (> (mail-header-number root) 0)
4571 (list (or (cdr (assq (mail-header-number root)
4572 gnus-newsgroup-scored))
4573 gnus-summary-default-score 0))))
4574 (list gnus-summary-default-score)
4577 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4578 (defvar gnus-tmp-prev-subject nil)
4579 (defvar gnus-tmp-false-parent nil)
4580 (defvar gnus-tmp-root-expunged nil)
4581 (defvar gnus-tmp-dummy-line nil)
4583 (eval-when-compile (defvar gnus-tmp-header))
4584 (defun gnus-extra-header (type &optional header)
4585 "Return the extra header of TYPE."
4586 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4589 (defvar gnus-tmp-thread-tree-header-string "")
4591 (defcustom gnus-sum-thread-tree-root "> "
4592 "With %B spec, used for the root of a thread.
4593 If nil, use subject instead."
4594 :type '(radio (const :format "%v " nil) (string :size 0))
4595 :group 'gnus-thread)
4596 (defcustom gnus-sum-thread-tree-false-root "> "
4597 "With %B spec, used for a false root of a thread.
4598 If nil, use subject instead."
4599 :type '(radio (const :format "%v " nil) (string :size 0))
4600 :group 'gnus-thread)
4601 (defcustom gnus-sum-thread-tree-single-indent ""
4602 "With %B spec, used for a thread with just one message.
4603 If nil, use subject instead."
4604 :type '(radio (const :format "%v " nil) (string :size 0))
4605 :group 'gnus-thread)
4606 (defcustom gnus-sum-thread-tree-vertical "| "
4607 "With %B spec, used for drawing a vertical line."
4609 :group 'gnus-thread)
4610 (defcustom gnus-sum-thread-tree-indent " "
4611 "With %B spec, used for indenting."
4613 :group 'gnus-thread)
4614 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4615 "With %B spec, used for a leaf with brothers."
4617 :group 'gnus-thread)
4618 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4619 "With %B spec, used for a leaf without brothers."
4621 :group 'gnus-thread)
4623 (defun gnus-summary-prepare-threads (threads)
4624 "Prepare summary buffer from THREADS and indentation LEVEL.
4625 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4626 or a straight list of headers."
4627 (gnus-message 7 "Generating summary...")
4629 (setq gnus-newsgroup-threads threads)
4632 (let ((gnus-tmp-level 0)
4633 (default-score (or gnus-summary-default-score 0))
4634 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4635 (building-line-count gnus-summary-display-while-building)
4636 (building-count (integerp gnus-summary-display-while-building))
4637 thread number subject stack state gnus-tmp-gathered beg-match
4638 new-roots gnus-tmp-new-adopts thread-end simp-subject
4639 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4640 gnus-tmp-replied gnus-tmp-subject-or-nil
4641 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4642 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4643 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4646 (setq gnus-tmp-prev-subject nil
4647 gnus-tmp-thread-tree-header-string "")
4649 (if (vectorp (car threads))
4650 ;; If this is a straight (sic) list of headers, then a
4651 ;; threaded summary display isn't required, so we just create
4652 ;; an unthreaded one.
4653 (gnus-summary-prepare-unthreaded threads)
4655 ;; Do the threaded display.
4657 (if gnus-summary-display-while-building
4658 (switch-to-buffer (buffer-name)))
4659 (while (or threads stack gnus-tmp-new-adopts new-roots)
4661 (if (and (= gnus-tmp-level 0)
4664 (not gnus-tmp-false-parent)
4665 (or gnus-tmp-new-adopts new-roots))
4666 (if gnus-tmp-new-adopts
4667 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4668 thread (list (car gnus-tmp-new-adopts))
4669 gnus-tmp-header (caar thread)
4670 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4672 (setq thread (list (car new-roots))
4673 gnus-tmp-header (caar thread)
4674 new-roots (cdr new-roots))))
4677 ;; If there are some threads, we do them before the
4678 ;; threads on the stack.
4679 (setq thread threads
4680 gnus-tmp-header (caar thread))
4681 ;; There were no current threads, so we pop something off
4683 (setq state (car stack)
4684 gnus-tmp-level (car state)
4685 tree-stack (cadr state)
4686 thread (caddr state)
4688 gnus-tmp-header (caar thread))))
4690 (setq gnus-tmp-false-parent nil)
4691 (setq gnus-tmp-root-expunged nil)
4692 (setq thread-end nil)
4694 (if (stringp gnus-tmp-header)
4695 ;; The header is a dummy root.
4697 ((eq gnus-summary-make-false-root 'adopt)
4698 ;; We let the first article adopt the rest.
4699 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4701 (setq gnus-tmp-gathered
4703 (lambda (h) (mail-header-number (car h)))
4706 (setq thread (cons (list (caar thread)
4709 (setq gnus-tmp-level -1
4710 gnus-tmp-false-parent t))
4711 ((eq gnus-summary-make-false-root 'empty)
4712 ;; We print adopted articles with empty subject fields.
4713 (setq gnus-tmp-gathered
4715 (lambda (h) (mail-header-number (car h)))
4718 (setq gnus-tmp-level -1))
4719 ((eq gnus-summary-make-false-root 'dummy)
4720 ;; We remember that we probably want to output a dummy
4722 (setq gnus-tmp-dummy-line gnus-tmp-header)
4723 (setq gnus-tmp-prev-subject gnus-tmp-header))
4725 ;; We do not make a root for the gathered
4726 ;; sub-threads at all.
4727 (setq gnus-tmp-level -1)))
4729 (setq number (mail-header-number gnus-tmp-header)
4730 subject (mail-header-subject gnus-tmp-header)
4731 simp-subject (gnus-simplify-subject-fully subject))
4734 ;; If the thread has changed subject, we might want to make
4735 ;; this subthread into a root.
4736 ((and (null gnus-thread-ignore-subject)
4737 (not (zerop gnus-tmp-level))
4738 gnus-tmp-prev-subject
4739 (not (string= gnus-tmp-prev-subject simp-subject)))
4740 (setq new-roots (nconc new-roots (list (car thread)))
4742 gnus-tmp-header nil))
4743 ;; If the article lies outside the current limit,
4744 ;; then we do not display it.
4745 ((not (memq number gnus-newsgroup-limit))
4746 (setq gnus-tmp-gathered
4748 (lambda (h) (mail-header-number (car h)))
4751 (setq gnus-tmp-new-adopts (if (cdar thread)
4752 (append gnus-tmp-new-adopts
4754 gnus-tmp-new-adopts)
4756 gnus-tmp-header nil)
4757 (when (zerop gnus-tmp-level)
4758 (setq gnus-tmp-root-expunged t)))
4759 ;; Perhaps this article is to be marked as read?
4760 ((and gnus-summary-mark-below
4761 (< (or (cdr (assq number gnus-newsgroup-scored))
4763 gnus-summary-mark-below)
4764 ;; Don't touch sparse articles.
4765 (not (gnus-summary-article-sparse-p number))
4766 (not (gnus-summary-article-ancient-p number)))
4767 (setq gnus-newsgroup-unreads
4768 (delq number gnus-newsgroup-unreads))
4769 (if gnus-newsgroup-auto-expire
4770 (setq gnus-newsgroup-expirable
4771 (gnus-add-to-sorted-list
4772 gnus-newsgroup-expirable number))
4773 (push (cons number gnus-low-score-mark)
4774 gnus-newsgroup-reads))))
4776 (when gnus-tmp-header
4777 ;; We may have an old dummy line to output before this
4779 (when (and gnus-tmp-dummy-line
4782 (mail-header-subject gnus-tmp-header)))
4783 (gnus-summary-insert-dummy-line
4784 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4785 (setq gnus-tmp-dummy-line nil))
4787 ;; Compute the mark.
4788 (setq gnus-tmp-unread (gnus-article-mark number))
4790 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4791 gnus-tmp-header gnus-tmp-level)
4792 gnus-newsgroup-data)
4794 ;; Actually insert the line.
4796 gnus-tmp-subject-or-nil
4798 ((and gnus-thread-ignore-subject
4799 gnus-tmp-prev-subject
4800 (not (string= gnus-tmp-prev-subject simp-subject)))
4802 ((zerop gnus-tmp-level)
4803 (if (and (eq gnus-summary-make-false-root 'empty)
4804 (memq number gnus-tmp-gathered)
4805 gnus-tmp-prev-subject
4806 (string= gnus-tmp-prev-subject simp-subject))
4807 gnus-summary-same-subject
4809 (t gnus-summary-same-subject)))
4810 (if (and (eq gnus-summary-make-false-root 'adopt)
4811 (= gnus-tmp-level 1)
4812 (memq number gnus-tmp-gathered))
4813 (setq gnus-tmp-opening-bracket ?\<
4814 gnus-tmp-closing-bracket ?\>)
4815 (setq gnus-tmp-opening-bracket ?\[
4816 gnus-tmp-closing-bracket ?\]))
4818 gnus-tmp-indentation
4819 (aref gnus-thread-indent-array gnus-tmp-level)
4820 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4821 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4822 gnus-summary-default-score 0)
4824 (if (or (null gnus-summary-default-score)
4825 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4826 gnus-summary-zcore-fuzz))
4828 (if (< gnus-tmp-score gnus-summary-default-score)
4829 gnus-score-below-mark gnus-score-over-mark))
4831 (cond ((memq number gnus-newsgroup-processable)
4833 ((memq number gnus-newsgroup-cached)
4835 ((memq number gnus-newsgroup-replied)
4837 ((memq number gnus-newsgroup-forwarded)
4838 gnus-forwarded-mark)
4839 ((memq number gnus-newsgroup-saved)
4841 ((memq number gnus-newsgroup-recent)
4843 ((memq number gnus-newsgroup-unseen)
4847 (cond ((memq number gnus-newsgroup-undownloaded)
4848 gnus-undownloaded-mark)
4849 (gnus-newsgroup-agentized
4850 gnus-downloaded-mark)
4853 gnus-tmp-from (mail-header-from gnus-tmp-header)
4856 ((string-match "<[^>]+> *$" gnus-tmp-from)
4857 (setq beg-match (match-beginning 0))
4858 (or (and (string-match "^\".+\"" gnus-tmp-from)
4859 (substring gnus-tmp-from 1 (1- (match-end 0))))
4860 (substring gnus-tmp-from 0 beg-match)))
4861 ((string-match "(.+)" gnus-tmp-from)
4862 (substring gnus-tmp-from
4863 (1+ (match-beginning 0)) (1- (match-end 0))))
4867 gnus-tmp-thread-tree-header-string
4869 ((not gnus-show-threads) "")
4870 ((zerop gnus-tmp-level)
4871 (cond ((cdar thread)
4872 (or gnus-sum-thread-tree-root subject))
4873 (gnus-tmp-new-adopts
4874 (or gnus-sum-thread-tree-false-root subject))
4876 (or gnus-sum-thread-tree-single-indent subject))))
4878 (concat (apply 'concat
4879 (mapcar (lambda (item)
4881 gnus-sum-thread-tree-vertical
4882 gnus-sum-thread-tree-indent))
4883 (cdr (reverse tree-stack))))
4885 gnus-sum-thread-tree-leaf-with-other
4886 gnus-sum-thread-tree-single-leaf)))))
4887 (when (string= gnus-tmp-name "")
4888 (setq gnus-tmp-name gnus-tmp-from))
4889 (unless (numberp gnus-tmp-lines)
4890 (setq gnus-tmp-lines -1))
4891 (if (= gnus-tmp-lines -1)
4892 (setq gnus-tmp-lines "?")
4893 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4894 (gnus-put-text-property
4896 (progn (eval gnus-summary-line-format-spec) (point))
4897 'gnus-number number)
4900 (gnus-run-hooks 'gnus-summary-update-hook)
4903 (setq gnus-tmp-prev-subject simp-subject)))
4905 (when (nth 1 thread)
4906 (push (list (max 0 gnus-tmp-level)
4907 (copy-sequence tree-stack)
4910 (push (if (nth 1 thread) 1 0) tree-stack)
4911 (incf gnus-tmp-level)
4912 (setq threads (if thread-end nil (cdar thread)))
4913 (if gnus-summary-display-while-building
4916 ;; use a set frequency
4917 (setq building-line-count (1- building-line-count))
4918 (when (= building-line-count 0)
4920 (setq building-line-count
4921 gnus-summary-display-while-building)))
4925 (setq gnus-tmp-level 0)))))
4926 (gnus-message 7 "Generating summary...done"))
4928 (defun gnus-summary-prepare-unthreaded (headers)
4929 "Generate an unthreaded summary buffer based on HEADERS."
4930 (let (header number mark)
4935 ;; We may have to root out some bad articles...
4936 (when (memq (setq number (mail-header-number
4937 (setq header (pop headers))))
4938 gnus-newsgroup-limit)
4939 ;; Mark article as read when it has a low score.
4940 (when (and gnus-summary-mark-below
4941 (< (or (cdr (assq number gnus-newsgroup-scored))
4942 gnus-summary-default-score 0)
4943 gnus-summary-mark-below)
4944 (not (gnus-summary-article-ancient-p number)))
4945 (setq gnus-newsgroup-unreads
4946 (delq number gnus-newsgroup-unreads))
4947 (if gnus-newsgroup-auto-expire
4948 (push number gnus-newsgroup-expirable)
4949 (push (cons number gnus-low-score-mark)
4950 gnus-newsgroup-reads)))
4952 (setq mark (gnus-article-mark number))
4953 (push (gnus-data-make number mark (1+ (point)) header 0)
4954 gnus-newsgroup-data)
4955 (gnus-summary-insert-line
4957 (memq number gnus-newsgroup-undownloaded)
4958 mark (memq number gnus-newsgroup-replied)
4959 (memq number gnus-newsgroup-expirable)
4960 (mail-header-subject header) nil
4961 (cdr (assq number gnus-newsgroup-scored))
4962 (memq number gnus-newsgroup-processable))))))
4964 (defun gnus-summary-remove-list-identifiers ()
4965 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4966 (let ((regexp (if (consp gnus-list-identifiers)
4967 (mapconcat 'identity gnus-list-identifiers " *\\|")
4968 gnus-list-identifiers))
4971 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
4972 (dolist (header gnus-newsgroup-headers)
4973 (setq subject (mail-header-subject header)
4975 (while (string-match regexp subject)
4977 (concat (substring subject 0 (match-beginning 1))
4978 (substring subject (match-end 0)))
4981 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
4983 (concat (substring subject 0 (match-beginning 1))
4984 (substring subject (match-end 1)))))
4985 (mail-header-set-subject header subject))))))
4987 (defun gnus-fetch-headers (articles)
4988 "Fetch headers of ARTICLES."
4989 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4990 (gnus-message 5 "Fetching headers for %s..." name)
4993 (setq gnus-headers-retrieved-by
4994 (gnus-retrieve-headers
4995 articles gnus-newsgroup-name
4996 ;; We might want to fetch old headers, but
4997 ;; not if there is only 1 article.
4999 (not (eq gnus-fetch-old-headers 'some))
5000 (not (numberp gnus-fetch-old-headers)))
5001 (> (length articles) 1))
5002 gnus-fetch-old-headers))))
5003 (gnus-get-newsgroup-headers-xover
5004 articles nil nil gnus-newsgroup-name t)
5005 (gnus-get-newsgroup-headers))
5006 (gnus-message 5 "Fetching headers for %s...done" name))))
5008 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5009 "Select newsgroup GROUP.
5010 If READ-ALL is non-nil, all articles in the group are selected.
5011 If SELECT-ARTICLES, only select those articles from GROUP."
5012 (let* ((entry (gnus-group-entry group))
5013 ;;!!! Dirty hack; should be removed.
5014 (gnus-summary-ignore-duplicates
5015 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5017 gnus-summary-ignore-duplicates))
5018 (info (nth 2 entry))
5019 articles fetched-articles cached)
5021 (unless (gnus-check-server
5022 (set (make-local-variable 'gnus-current-select-method)
5023 (gnus-find-method-for-group group)))
5024 (error "Couldn't open server"))
5026 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5027 (gnus-activate-group group) ; Or we can activate it...
5028 (progn ; Or we bug out.
5029 (when (equal major-mode 'gnus-summary-mode)
5030 (gnus-kill-buffer (current-buffer)))
5031 (error "Couldn't activate group %s: %s"
5032 group (gnus-status-message group))))
5034 (unless (gnus-request-group group t)
5035 (when (equal major-mode 'gnus-summary-mode)
5036 (gnus-kill-buffer (current-buffer)))
5037 (error "Couldn't request group %s: %s"
5038 group (gnus-status-message group)))
5041 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5043 (setq gnus-summary-use-undownloaded-faces
5044 (gnus-agent-find-parameter
5046 'agent-enable-undownloaded-faces)))
5048 (setq gnus-newsgroup-name group
5049 gnus-newsgroup-unselected nil
5050 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5052 (let ((display (gnus-group-find-parameter group 'display)))
5053 (setq gnus-newsgroup-display
5055 ((not (zerop (or (car-safe read-all) 0)))
5056 ;; The user entered the group with C-u SPC/RET, let's show
5062 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5064 ;; The following is probably the "correct" solution, but
5065 ;; it makes Gnus fetch all headers and then limit the
5066 ;; articles (which is slow), so instead we hack the
5067 ;; select-articles parameter instead. -- Simon Josefsson
5070 ;; (gnus-byte-compile
5071 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5073 (setq select-articles
5074 (gnus-uncompress-range
5075 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5079 (cdr (gnus-active group)))))
5084 (gnus-summary-setup-default-charset)
5086 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5087 (when (gnus-virtual-group-p group)
5088 (setq cached gnus-newsgroup-cached))
5090 (setq gnus-newsgroup-unreads
5091 (gnus-sorted-ndifference
5092 (gnus-sorted-ndifference gnus-newsgroup-unreads
5093 gnus-newsgroup-marked)
5094 gnus-newsgroup-dormant))
5096 (setq gnus-newsgroup-processable nil)
5098 (gnus-update-read-articles group gnus-newsgroup-unreads)
5100 ;; Adjust and set lists of article marks.
5102 (gnus-adjust-marked-articles info))
5103 (if (setq articles select-articles)
5104 (setq gnus-newsgroup-unselected
5105 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5106 (setq articles (gnus-articles-to-read group read-all)))
5110 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5112 ((eq articles 0) nil)
5114 ;; Init the dependencies hash table.
5115 (setq gnus-newsgroup-dependencies
5116 (gnus-make-hashtable (length articles)))
5117 (gnus-set-global-variables)
5118 ;; Retrieve the headers and read them in.
5120 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5122 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5124 (setq gnus-newsgroup-cached cached))
5126 ;; Suppress duplicates?
5127 (when gnus-suppress-duplicates
5128 (gnus-dup-suppress-articles))
5130 ;; Set the initial limit.
5131 (setq gnus-newsgroup-limit (copy-sequence articles))
5132 ;; Remove canceled articles from the list of unread articles.
5133 (setq fetched-articles
5134 (mapcar (lambda (headers) (mail-header-number headers))
5135 gnus-newsgroup-headers))
5136 (setq gnus-newsgroup-articles fetched-articles)
5137 (setq gnus-newsgroup-unreads
5138 (gnus-sorted-nintersection
5139 gnus-newsgroup-unreads fetched-articles))
5140 (gnus-compute-unseen-list)
5142 ;; Removed marked articles that do not exist.
5143 (gnus-update-missing-marks
5144 (gnus-sorted-difference articles fetched-articles))
5145 ;; We might want to build some more threads first.
5146 (when (and gnus-fetch-old-headers
5147 (eq gnus-headers-retrieved-by 'nov))
5148 (if (eq gnus-fetch-old-headers 'invisible)
5149 (gnus-build-all-threads)
5150 (gnus-build-old-threads)))
5151 ;; Let the Gnus agent mark articles as read.
5153 (gnus-agent-get-undownloaded-list))
5154 ;; Remove list identifiers from subject
5155 (when gnus-list-identifiers
5156 (gnus-summary-remove-list-identifiers))
5157 ;; Check whether auto-expire is to be done in this group.
5158 (setq gnus-newsgroup-auto-expire
5159 (gnus-group-auto-expirable-p group))
5160 ;; Set up the article buffer now, if necessary.
5161 (unless gnus-single-article-buffer
5162 (gnus-article-setup-buffer))
5163 ;; First and last article in this newsgroup.
5164 (when gnus-newsgroup-headers
5165 (setq gnus-newsgroup-begin
5166 (mail-header-number (car gnus-newsgroup-headers))
5169 (gnus-last-element gnus-newsgroup-headers))))
5170 ;; GROUP is successfully selected.
5171 (or gnus-newsgroup-headers t)))))
5173 (defun gnus-compute-unseen-list ()
5174 ;; The `seen' marks are treated specially.
5175 (if (not gnus-newsgroup-seen)
5176 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5177 (setq gnus-newsgroup-unseen
5178 (gnus-inverse-list-range-intersection
5179 gnus-newsgroup-articles gnus-newsgroup-seen))))
5181 (defun gnus-summary-display-make-predicate (display)
5182 (require 'gnus-agent)
5183 (when (= (length display) 1)
5184 (setq display (car display)))
5185 (unless gnus-summary-display-cache
5186 (dolist (elem (append '((unread . unread)
5189 gnus-article-mark-lists))
5190 (push (cons (cdr elem)
5192 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5193 gnus-summary-display-cache)))
5194 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5195 (gnus-category-predicate-cache gnus-summary-display-cache))
5196 (gnus-get-predicate display)))
5198 ;; Uses the dynamically bound `number' variable.
5201 (defun gnus-article-marked-p (type &optional article)
5202 (let ((article (or article number)))
5205 (memq article gnus-newsgroup-marked))
5207 (memq article gnus-newsgroup-spam-marked))
5209 (memq article gnus-newsgroup-unsendable))
5210 ((eq type 'undownload)
5211 (memq article gnus-newsgroup-undownloaded))
5212 ((eq type 'download)
5213 (memq article gnus-newsgroup-downloadable))
5215 (memq article gnus-newsgroup-unreads))
5217 (memq article gnus-newsgroup-reads))
5219 (memq article gnus-newsgroup-dormant) )
5221 (memq article gnus-newsgroup-expirable))
5223 (memq article gnus-newsgroup-replied))
5225 (memq article gnus-newsgroup-killed))
5226 ((eq type 'bookmark)
5227 (assq article gnus-newsgroup-bookmarks))
5229 (assq article gnus-newsgroup-scored))
5231 (memq article gnus-newsgroup-saved))
5233 (memq article gnus-newsgroup-cached))
5235 (memq article gnus-newsgroup-forwarded))
5237 (not (memq article gnus-newsgroup-unseen)))
5239 (memq article gnus-newsgroup-recent))
5242 (defun gnus-articles-to-read (group &optional read-all)
5243 "Find out what articles the user wants to read."
5244 (let* ((display (gnus-group-find-parameter group 'display))
5246 ;; Select all articles if `read-all' is non-nil, or if there
5247 ;; are no unread articles.
5249 (and (zerop (length gnus-newsgroup-marked))
5250 (zerop (length gnus-newsgroup-unreads)))
5251 ;; Fetch all if the predicate is non-nil.
5252 gnus-newsgroup-display)
5253 ;; We want to select the headers for all the articles in
5254 ;; the group, so we select either all the active
5255 ;; articles in the group, or (if that's nil), the
5256 ;; articles in the cache.
5258 (gnus-uncompress-range (gnus-active group))
5259 (gnus-cache-articles-in-group group))
5260 ;; Select only the "normal" subset of articles.
5262 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5263 gnus-newsgroup-unreads)))
5264 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5265 (scored (length scored-list))
5266 (number (length articles))
5267 (marked (+ (length gnus-newsgroup-marked)
5268 (length gnus-newsgroup-dormant)))
5273 ((numberp gnus-newsgroup-display)
5274 gnus-newsgroup-display)
5278 ((and (or (<= scored marked) (= scored number))
5279 (numberp gnus-large-newsgroup)
5280 (> number gnus-large-newsgroup))
5281 (let* ((cursor-in-echo-area nil)
5282 (initial (gnus-parameter-large-newsgroup-initial
5283 gnus-newsgroup-name))
5287 "How many articles from %s (%s %d): "
5289 (gnus-group-decoded-name gnus-newsgroup-name)
5291 (if initial "max" "default")
5294 (cons (number-to-string initial)
5296 (if (string-match "^[ \t]*$" input) number input)))
5297 ((and (> scored marked) (< scored number)
5298 (> (- scored number) 20))
5301 (format "%s %s (%d scored, %d total): "
5302 "How many articles from"
5303 (gnus-group-decoded-name group)
5305 (if (string-match "^[ \t]*$" input)
5309 (message "Quit getting the articles to read")
5311 (setq select (if (stringp select) (string-to-number select) select))
5312 (if (or (null select) (zerop select))
5314 (if (and (not (zerop scored)) (<= (abs select) scored))
5316 (setq articles (sort scored-list '<))
5317 (setq number (length articles)))
5318 (setq articles (copy-sequence articles)))
5320 (when (< (abs select) number)
5322 ;; Select the N oldest articles.
5323 (setcdr (nthcdr (1- (abs select)) articles) nil)
5324 ;; Select the N most recent articles.
5325 (setq articles (nthcdr (- number select) articles))))
5326 (setq gnus-newsgroup-unselected
5327 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5328 (when gnus-alter-articles-to-read-function
5331 (funcall gnus-alter-articles-to-read-function
5332 gnus-newsgroup-name articles)
5336 (defun gnus-killed-articles (killed articles)
5339 (when (inline (gnus-member-of-range (car articles) killed))
5340 (push (car articles) out))
5341 (setq articles (cdr articles)))
5344 (defun gnus-uncompress-marks (marks)
5345 "Uncompress the mark ranges in MARKS."
5346 (let ((uncompressed '(score bookmark))
5349 (if (memq (caar marks) uncompressed)
5350 (push (car marks) out)
5351 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5352 (setq marks (cdr marks)))
5355 (defun gnus-article-mark-to-type (mark)
5356 "Return the type of MARK."
5357 (or (cadr (assq mark gnus-article-special-mark-lists))
5360 (defun gnus-article-unpropagatable-p (mark)
5361 "Return whether MARK should be propagated to back end."
5362 (memq mark gnus-article-unpropagated-mark-lists))
5364 (defun gnus-adjust-marked-articles (info)
5365 "Set all article lists and remove all marks that are no longer valid."
5366 (let* ((marked-lists (gnus-info-marks info))
5367 (active (gnus-active (gnus-info-group info)))
5370 (types gnus-article-mark-lists)
5371 marks var articles article mark mark-type
5374 (dolist (marks marked-lists)
5375 (setq mark (car marks)
5376 mark-type (gnus-article-mark-to-type mark)
5377 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5379 ;; We set the variable according to the type of the marks list,
5380 ;; and then adjust the marks to a subset of the active articles.
5382 ;; Adjust "simple" lists - compressed yet unsorted
5383 ((eq mark-type 'list)
5384 ;; Simultaneously uncompress and clip to active range
5385 ;; See gnus-uncompress-range for a description of possible marks
5387 (if (not (cadr marks))
5389 (setq articles (if (numberp (cddr marks))
5395 (while (setq article (pop articles))
5396 (cond ((consp article)
5397 (setq bgn (max (car article) min)
5398 end (min (cdr article) max))
5400 (setq l (setcdr l (cons bgn nil))
5402 ((and (<= min article)
5404 (setq l (setcdr l (cons article nil))))))
5405 (set var (cdr lh)))))
5407 ((eq mark-type 'tuple)
5408 (set var (setq articles (cdr marks)))
5409 (when (not (listp (cdr (symbol-value var))))
5410 (set var (list (symbol-value var))))
5411 (when (not (listp (cdr articles)))
5412 (setq articles (list articles)))
5414 (when (or (not (consp (setq article (pop articles))))
5415 (< (car article) min)
5416 (> (car article) max))
5417 (set var (delq article (symbol-value var))))))
5418 ;; Adjust ranges (sloppily).
5419 ((eq mark-type 'range)
5422 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5423 ;; It should be (seen (NUM1 . NUM2)).
5424 (when (numberp (cddr marks))
5425 (setcdr marks (list (cdr marks))))
5426 (setq articles (cdr marks))
5427 (while (and articles
5428 (or (and (consp (car articles))
5429 (> min (cdar articles)))
5430 (and (numberp (car articles))
5431 (> min (car articles)))))
5433 (set var articles))))))))
5435 (defun gnus-update-missing-marks (missing)
5436 "Go through the list of MISSING articles and remove them from the mark lists."
5439 ;; Go through all types.
5440 (dolist (elem gnus-article-mark-lists)
5441 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5442 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5443 (when (symbol-value var)
5444 ;; This list has articles. So we delete all missing
5445 ;; articles from it.
5448 (set var (delq (pop m) (symbol-value var))))))))))
5450 (defun gnus-update-marks ()
5451 "Enter the various lists of marked articles into the newsgroup info list."
5452 (let ((types gnus-article-mark-lists)
5453 (info (gnus-get-info gnus-newsgroup-name))
5454 type list newmarked symbol delta-marks)
5456 ;; Add all marks lists to the list of marks lists.
5457 (while (setq type (pop types))
5458 (setq list (symbol-value
5460 (intern (format "gnus-newsgroup-%s" (car type))))))
5463 ;; Get rid of the entries of the articles that have the
5465 (when (and (eq (cdr type) 'score)
5469 (prev (cons nil list))
5472 (if (or (not (consp (car arts)))
5473 (= (cdar arts) gnus-summary-default-score))
5474 (setcdr prev (cdr arts))
5476 (setq arts (cdr arts)))
5477 (setq list (cdr all)))))
5479 (when (eq (cdr type) 'seen)
5480 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5482 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5483 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5485 (when (and (gnus-check-backend-function
5486 'request-set-mark gnus-newsgroup-name)
5487 (not (gnus-article-unpropagatable-p (cdr type))))
5488 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5489 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5490 (add (gnus-remove-from-range
5491 (gnus-copy-sequence list) old)))
5493 (push (list add 'add (list (cdr type))) delta-marks))
5495 (push (list del 'del (list (cdr type))) delta-marks))))
5498 (push (cons (cdr type) list) newmarked)))
5501 (unless (gnus-check-group gnus-newsgroup-name)
5502 (error "Can't open server for %s" gnus-newsgroup-name))
5503 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5505 ;; Enter these new marks into the info of the group.
5507 (setcar (nthcdr 3 info) newmarked)
5508 ;; Add the marks lists to the end of the info.
5510 (setcdr (nthcdr 2 info) (list newmarked))))
5512 ;; Cut off the end of the info if there's nothing else there.
5516 (when (nthcdr (decf i) info)
5517 (setcdr (nthcdr i info) nil)))))))
5519 (defun gnus-set-mode-line (where)
5520 "Set the mode line of the article or summary buffers.
5521 If WHERE is `summary', the summary mode line format will be used."
5522 ;; Is this mode line one we keep updated?
5523 (when (and (memq where gnus-updated-mode-lines)
5525 (intern (format "gnus-%s-mode-line-format-spec" where))))
5528 ;; We evaluate this in the summary buffer since these
5529 ;; variables are buffer-local to that buffer.
5530 (set-buffer gnus-summary-buffer)
5531 ;; We bind all these variables that are used in the `eval' form
5533 (let* ((mformat (symbol-value
5535 (format "gnus-%s-mode-line-format-spec" where))))
5536 (gnus-tmp-group-name (gnus-group-decoded-name
5537 gnus-newsgroup-name))
5538 (gnus-tmp-article-number (or gnus-current-article 0))
5539 (gnus-tmp-unread gnus-newsgroup-unreads)
5540 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5541 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5542 (gnus-tmp-unread-and-unselected
5543 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5544 (zerop gnus-tmp-unselected))
5546 ((zerop gnus-tmp-unselected)
5547 (format "{%d more}" gnus-tmp-unread-and-unticked))
5548 (t (format "{%d(+%d) more}"
5549 gnus-tmp-unread-and-unticked
5550 gnus-tmp-unselected))))
5552 (if (and gnus-current-headers
5553 (vectorp gnus-current-headers))
5554 (gnus-mode-string-quote
5555 (mail-header-subject gnus-current-headers))
5557 bufname-length max-len
5558 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5559 (setq mode-string (eval mformat))
5560 (setq bufname-length (if (string-match "%b" mode-string)
5563 (if (eq where 'summary)
5565 (get-buffer gnus-article-buffer))))
5568 (setq max-len (max 4 (if gnus-mode-non-string-length
5570 gnus-mode-non-string-length
5572 (length mode-string))))
5573 ;; We might have to chop a bit of the string off...
5574 (when (> (length mode-string) max-len)
5576 (concat (truncate-string-to-width mode-string (- max-len 3))
5578 ;; Pad the mode string a bit.
5579 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5580 ;; Update the mode line.
5581 (setq mode-line-buffer-identification
5582 (gnus-mode-line-buffer-identification (list mode-string)))
5583 (set-buffer-modified-p t))))
5585 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5586 "Go through the HEADERS list and add all Xrefs to a hash table.
5587 The resulting hash table is returned, or nil if no Xrefs were found."
5588 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5589 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5590 (xref-hashtb (gnus-make-hashtable))
5591 start group entry number xrefs header)
5593 (setq header (pop headers))
5594 (when (and (setq xrefs (mail-header-xref header))
5595 (not (memq (setq number (mail-header-number header))
5598 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5599 (setq start (match-end 0))
5600 (setq group (if prefix
5601 (concat prefix (substring xrefs (match-beginning 1)
5603 (substring xrefs (match-beginning 1) (match-end 1))))
5605 (string-to-int (substring xrefs (match-beginning 2)
5607 (if (setq entry (gnus-gethash group xref-hashtb))
5608 (setcdr entry (cons number (cdr entry)))
5609 (gnus-sethash group (cons number nil) xref-hashtb)))))
5610 (and start xref-hashtb)))
5612 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5613 "Look through all the headers and mark the Xrefs as read."
5614 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5615 name info xref-hashtb idlist method nth4)
5617 (set-buffer gnus-group-buffer)
5618 (when (setq xref-hashtb
5619 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5622 (unless (string= from-newsgroup (setq name (symbol-name group)))
5623 (setq idlist (symbol-value group))
5624 ;; Dead groups are not updated.
5626 (setq info (gnus-get-info name))
5627 (when (stringp (setq nth4 (gnus-info-method info)))
5628 (setq nth4 (gnus-server-to-method nth4))))
5629 ;; Only do the xrefs if the group has the same
5630 ;; select method as the group we have just read.
5631 (or (gnus-methods-equal-p
5632 nth4 (gnus-find-method-for-group from-newsgroup))
5634 (equal nth4 (setq method (gnus-find-method-for-group
5636 (and (equal (car nth4) (car method))
5637 (equal (nth 1 nth4) (nth 1 method))))
5638 gnus-use-cross-reference
5639 (or (not (eq gnus-use-cross-reference t))
5641 ;; Only do cross-references on subscribed
5642 ;; groups, if that is what is wanted.
5643 (<= (gnus-info-level info) gnus-level-subscribed))
5644 (gnus-group-make-articles-read name idlist))))
5647 (defun gnus-compute-read-articles (group articles)
5648 (let* ((entry (gnus-group-entry group))
5649 (info (nth 2 entry))
5650 (active (gnus-active group))
5653 ;; First peel off all invalid article numbers.
5655 (let ((ids articles)
5657 (while (setq id (pop ids))
5658 (when (and first (> id (cdr active)))
5659 ;; We'll end up in this situation in one particular
5660 ;; obscure situation. If you re-scan a group and get
5661 ;; a new article that is cross-posted to a different
5662 ;; group that has not been re-scanned, you might get
5663 ;; crossposted article that has a higher number than
5664 ;; Gnus believes possible. So we re-activate this
5665 ;; group as well. This might mean doing the
5666 ;; crossposting thingy will *increase* the number
5667 ;; of articles in some groups. Tsk, tsk.
5668 (setq active (or (gnus-activate-group group) active)))
5669 (when (or (> id (cdr active))
5670 (< id (car active)))
5671 (setq articles (delq id articles))))))
5672 ;; If the read list is nil, we init it.
5674 (null (gnus-info-read info))
5676 (setq ninfo (cons 1 (1- (car active))))
5677 (setq ninfo (gnus-info-read info)))
5678 ;; Then we add the read articles to the range.
5680 ninfo (setq articles (sort articles '<))))))
5682 (defun gnus-group-make-articles-read (group articles)
5683 "Update the info of GROUP to say that ARTICLES are read."
5685 (entry (gnus-group-entry group))
5686 (info (nth 2 entry))
5687 (active (gnus-active group))
5690 (setq range (gnus-compute-read-articles group articles))
5691 (with-current-buffer gnus-group-buffer
5694 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5695 (gnus-info-set-read ',info ',(gnus-info-read info))
5696 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5697 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5698 (gnus-group-update-group ,group t))))
5699 ;; Add the read articles to the range.
5700 (gnus-info-set-read info range)
5701 (gnus-request-set-mark group (list (list range 'add '(read))))
5702 ;; Then we have to re-compute how many unread
5703 ;; articles there are in this group.
5707 (setq num (- (1+ (cdr active)) (car active))))
5708 ((not (listp (cdr range)))
5709 (setq num (- (cdr active) (- (1+ (cdr range))
5713 (if (numberp (car range))
5715 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5716 (setq range (cdr range)))
5717 (setq num (- (cdr active) num))))
5718 ;; Update the number of unread articles.
5720 ;; Update the group buffer.
5721 (unless (gnus-ephemeral-group-p group)
5722 (gnus-group-update-group group t))))))
5724 (defvar gnus-newsgroup-none-id 0)
5726 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5727 (let ((cur nntp-server-buffer)
5730 (save-excursion (set-buffer gnus-summary-buffer)
5731 gnus-newsgroup-dependencies)))
5733 (mail-parse-charset gnus-newsgroup-charset)
5734 (mail-parse-ignored-charsets
5735 (save-excursion (condition-case nil
5736 (set-buffer gnus-summary-buffer)
5738 gnus-newsgroup-ignored-charsets)))
5740 (set-buffer nntp-server-buffer)
5741 ;; Translate all TAB characters into SPACE characters.
5742 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5743 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5744 (ietf-drums-unfold-fws)
5745 (gnus-run-hooks 'gnus-parse-headers-hook)
5746 (let ((case-fold-search t)
5747 in-reply-to header p lines chars)
5748 (goto-char (point-min))
5749 ;; Search to the beginning of the next header. Error messages
5750 ;; do not begin with 2 or 3.
5751 (while (re-search-forward "^[23][0-9]+ " nil t)
5754 ;; This implementation of this function, with nine
5755 ;; search-forwards instead of the one re-search-forward and
5756 ;; a case (which basically was the old function) is actually
5757 ;; about twice as fast, even though it looks messier. You
5758 ;; can't have everything, I guess. Speed and elegance
5759 ;; doesn't always go hand in hand.
5768 (narrow-to-region (point)
5769 (or (and (search-forward "\n.\n" nil t)
5775 (if (search-forward "\nsubject:" nil t)
5776 (funcall gnus-decode-encoded-word-function
5777 (nnheader-header-value))
5782 (if (search-forward "\nfrom:" nil t)
5783 (funcall gnus-decode-encoded-word-function
5784 (nnheader-header-value))
5789 (if (search-forward "\ndate:" nil t)
5790 (nnheader-header-value) ""))
5794 (setq id (if (re-search-forward
5795 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5796 ;; We do it this way to make sure the Message-ID
5797 ;; is (somewhat) syntactically valid.
5798 (buffer-substring (match-beginning 1)
5800 ;; If there was no message-id, we just fake one
5801 ;; to make subsequent routines simpler.
5802 (nnheader-generate-fake-message-id))))
5806 (if (search-forward "\nreferences:" nil t)
5810 (nnheader-header-value)
5815 (search-backward ">" end t)
5818 (search-backward "<" end t)
5820 ;; Get the references from the in-reply-to header if there
5821 ;; were no references and the in-reply-to header looks
5823 (if (and (search-forward "\nin-reply-to:" nil t)
5824 (setq in-reply-to (nnheader-header-value))
5825 (string-match "<[^>]+>" in-reply-to))
5827 (setq ref (substring in-reply-to (match-beginning 0)
5829 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5830 (setq ref2 (substring in-reply-to (match-beginning 0)
5832 (when (> (length ref2) (length ref))
5839 (if (search-forward "\nchars: " nil t)
5840 (if (numberp (setq chars (ignore-errors (read cur))))
5846 (if (search-forward "\nlines: " nil t)
5847 (if (numberp (setq lines (ignore-errors (read cur))))
5853 (and (search-forward "\nxref:" nil t)
5854 (nnheader-header-value)))
5856 (when gnus-extra-headers
5857 (let ((extra gnus-extra-headers)
5861 (when (search-forward
5862 (concat "\n" (symbol-name (car extra)) ":") nil t)
5863 (push (cons (car extra) (nnheader-header-value))
5867 (when (equal id ref)
5870 (when gnus-alter-header-function
5871 (funcall gnus-alter-header-function header)
5872 (setq id (mail-header-id header)
5873 ref (gnus-parent-id (mail-header-references header))))
5876 (gnus-dependencies-add-header
5877 header dependencies force-new))
5878 (push header headers))
5879 (goto-char (point-max))
5881 (nreverse headers)))))
5883 ;; Goes through the xover lines and returns a list of vectors
5884 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5885 force-new dependencies
5886 group also-fetch-heads)
5887 "Parse the news overview data in the server buffer.
5888 Return a list of headers that match SEQUENCE (see
5889 `nntp-retrieve-headers')."
5890 ;; Get the Xref when the users reads the articles since most/some
5891 ;; NNTP servers do not include Xrefs when using XOVER.
5892 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5893 (let ((mail-parse-charset gnus-newsgroup-charset)
5894 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5895 (cur nntp-server-buffer)
5896 (dependencies (or dependencies gnus-newsgroup-dependencies))
5898 ((eq gnus-read-all-available-headers t)
5900 ((stringp gnus-read-all-available-headers)
5901 (string-match gnus-read-all-available-headers group))
5904 number headers header)
5906 (set-buffer nntp-server-buffer)
5907 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5908 ;; Allow the user to mangle the headers before parsing them.
5909 (gnus-run-hooks 'gnus-parse-headers-hook)
5910 (goto-char (point-min))
5911 (gnus-parse-without-error
5912 (while (and (or sequence allp)
5914 (setq number (read cur))
5916 (while (and sequence
5917 (< (car sequence) number))
5918 (setq sequence (cdr sequence))))
5921 (eq number (car sequence))))
5923 (setq sequence (cdr sequence))
5924 (setq header (inline
5925 (gnus-nov-parse-line
5926 number dependencies force-new)))))
5927 (push header headers))
5929 ;; A common bug in inn is that if you have posted an article and
5930 ;; then retrieves the active file, it will answer correctly --
5931 ;; the new article is included. However, a NOV entry for the
5932 ;; article may not have been generated yet, so this may fail.
5933 ;; We work around this problem by retrieving the last few
5934 ;; headers using HEAD.
5935 (if (or (not also-fetch-heads)
5937 ;; We (probably) got all the headers.
5939 (let ((gnus-nov-is-evil t))
5942 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5943 (gnus-get-newsgroup-headers))))))))
5945 (defun gnus-article-get-xrefs ()
5946 "Fill in the Xref value in `gnus-current-headers', if necessary.
5947 This is meant to be called in `gnus-article-internal-prepare-hook'."
5948 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5949 gnus-current-headers)))
5950 (or (not gnus-use-cross-reference)
5952 (and (mail-header-xref headers)
5953 (not (string= (mail-header-xref headers) "")))
5954 (let ((case-fold-search t)
5957 (nnheader-narrow-to-headers)
5958 (goto-char (point-min))
5959 (when (or (and (not (eobp))
5960 (eq (downcase (char-after)) ?x)
5961 (looking-at "Xref:"))
5962 (search-forward "\nXref:" nil t))
5963 (goto-char (1+ (match-end 0)))
5964 (setq xref (buffer-substring (point) (point-at-eol)))
5965 (mail-header-set-xref headers xref)))))))
5967 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5968 "Find article ID and insert the summary line for that article.
5969 OLD-HEADER can either be a header or a line number to insert
5970 the subject line on."
5971 (let* ((line (and (numberp old-header) old-header))
5972 (old-header (and (vectorp old-header) old-header))
5973 (header (cond ((and old-header use-old-header)
5976 (gnus-number-to-header id))
5977 (gnus-number-to-header id))
5979 (gnus-read-header id))))
5980 (number (and (numberp id) id))
5983 ;; Rebuild the thread that this article is part of and go to the
5984 ;; article we have fetched.
5985 (when (and (not gnus-show-threads)
5988 (setq d (gnus-data-find (mail-header-number old-header))))
5989 (goto-char (gnus-data-pos d))
5995 (gnus-delete-line))))))
5997 (mail-header-set-number header (mail-header-number old-header)))
5998 (setq gnus-newsgroup-sparse
5999 (delq (setq number (mail-header-number header))
6000 gnus-newsgroup-sparse))
6001 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6002 (push number gnus-newsgroup-limit)
6003 (gnus-rebuild-thread (mail-header-id header) line)
6004 (gnus-summary-goto-subject number nil t))
6005 (when (and (numberp number)
6007 ;; We have to update the boundaries even if we can't fetch the
6008 ;; article if ID is a number -- so that the next `P' or `N'
6009 ;; command will fetch the previous (or next) article even
6010 ;; if the one we tried to fetch this time has been canceled.
6011 (when (> number gnus-newsgroup-end)
6012 (setq gnus-newsgroup-end number))
6013 (when (< number gnus-newsgroup-begin)
6014 (setq gnus-newsgroup-begin number))
6015 (setq gnus-newsgroup-unselected
6016 (delq number gnus-newsgroup-unselected)))
6017 ;; Report back a success?
6018 (and header (mail-header-number header))))
6020 ;;; Process/prefix in the summary buffer
6022 (defun gnus-summary-work-articles (n)
6023 "Return a list of articles to be worked upon.
6024 The prefix argument, the list of process marked articles, and the
6025 current article will be taken into consideration."
6027 (set-buffer gnus-summary-buffer)
6030 ;; A numerical prefix has been given.
6031 (setq n (prefix-numeric-value n))
6032 (let ((backward (< n 0))
6033 (n (abs (prefix-numeric-value n)))
6038 (push (setq article (gnus-summary-article-number))
6041 (gnus-summary-find-prev nil article)
6042 (gnus-summary-find-next nil article)))
6044 (nreverse articles)))
6045 ((and (gnus-region-active-p) (mark))
6046 (message "region active")
6047 ;; Work on the region between point and mark.
6048 (let ((max (max (point) (mark)))
6051 (goto-char (min (min (point) (mark))))
6054 (push (setq article (gnus-summary-article-number)) articles)
6055 (gnus-summary-find-next nil article)
6057 (nreverse articles))))
6058 (gnus-newsgroup-processable
6059 ;; There are process-marked articles present.
6060 ;; Save current state.
6061 (gnus-summary-save-process-mark)
6063 (reverse gnus-newsgroup-processable))
6065 ;; Just return the current article.
6066 (list (gnus-summary-article-number))))))
6068 (defmacro gnus-summary-iterate (arg &rest forms)
6069 "Iterate over the process/prefixed articles and do FORMS.
6070 ARG is the interactive prefix given to the command. FORMS will be
6071 executed with point over the summary line of the articles."
6072 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6073 `(let ((,articles (gnus-summary-work-articles ,arg)))
6075 (gnus-summary-goto-subject (car ,articles))
6079 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6080 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6082 (defun gnus-summary-save-process-mark ()
6083 "Push the current set of process marked articles on the stack."
6085 (push (copy-sequence gnus-newsgroup-processable)
6086 gnus-newsgroup-process-stack))
6088 (defun gnus-summary-kill-process-mark ()
6089 "Push the current set of process marked articles on the stack and unmark."
6091 (gnus-summary-save-process-mark)
6092 (gnus-summary-unmark-all-processable))
6094 (defun gnus-summary-yank-process-mark ()
6095 "Pop the last process mark state off the stack and restore it."
6097 (unless gnus-newsgroup-process-stack
6098 (error "Empty mark stack"))
6099 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6101 (defun gnus-summary-process-mark-set (set)
6102 "Make SET into the current process marked articles."
6103 (gnus-summary-unmark-all-processable)
6105 (gnus-summary-set-process-mark (pop set))))
6107 ;;; Searching and stuff
6109 (defun gnus-summary-search-group (&optional backward use-level)
6110 "Search for next unread newsgroup.
6111 If optional argument BACKWARD is non-nil, search backward instead."
6113 (set-buffer gnus-group-buffer)
6114 (when (gnus-group-search-forward
6115 backward nil (if use-level (gnus-group-group-level) nil))
6116 (gnus-group-group-name))))
6118 (defun gnus-summary-best-group (&optional exclude-group)
6119 "Find the name of the best unread group.
6120 If EXCLUDE-GROUP, do not go to this group."
6122 (set-buffer gnus-group-buffer)
6124 (gnus-group-best-unread-group exclude-group))))
6126 (defun gnus-summary-find-next (&optional unread article backward)
6128 (gnus-summary-find-prev unread article)
6129 (let* ((dummy (gnus-summary-article-intangible-p))
6130 (article (or article (gnus-summary-article-number)))
6131 (data (gnus-data-find-list article))
6133 (when (and (not dummy)
6134 (or (not gnus-summary-check-current)
6136 (not (gnus-data-unread-p (car data)))))
6137 (setq data (cdr data)))
6142 (unless (memq (gnus-data-number (car data))
6144 ((eq gnus-auto-goto-ignores
6145 'always-undownloaded)
6146 gnus-newsgroup-undownloaded)
6149 ((eq gnus-auto-goto-ignores
6151 gnus-newsgroup-unfetched)
6152 ((eq gnus-auto-goto-ignores
6154 gnus-newsgroup-undownloaded)))
6155 (when (gnus-data-unread-p (car data))
6156 (setq result (car data)
6158 (setq data (cdr data)))
6161 (goto-char (gnus-data-pos result))
6162 (gnus-data-number result)))))
6164 (defun gnus-summary-find-prev (&optional unread article)
6165 (let* ((eobp (eobp))
6166 (article (or article (gnus-summary-article-number)))
6167 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6169 (when (and (not eobp)
6170 (or (not gnus-summary-check-current)
6172 (not (gnus-data-unread-p (car data)))))
6173 (setq data (cdr data)))
6178 (unless (memq (gnus-data-number (car data))
6180 ((eq gnus-auto-goto-ignores
6181 'always-undownloaded)
6182 gnus-newsgroup-undownloaded)
6185 ((eq gnus-auto-goto-ignores
6187 gnus-newsgroup-unfetched)
6188 ((eq gnus-auto-goto-ignores
6190 gnus-newsgroup-undownloaded)))
6191 (when (gnus-data-unread-p (car data))
6192 (setq result (car data)
6194 (setq data (cdr data)))
6197 (goto-char (gnus-data-pos result))
6198 (gnus-data-number result))))
6200 (defun gnus-summary-find-subject (subject &optional unread backward article)
6201 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6202 (article (or article (gnus-summary-article-number)))
6203 (articles (gnus-data-list backward))
6204 (arts (gnus-data-find-list article articles))
6206 (when (or (not gnus-summary-check-current)
6208 (not (gnus-data-unread-p (car arts))))
6209 (setq arts (cdr arts)))
6211 (and (or (not unread)
6212 (gnus-data-unread-p (car arts)))
6213 (vectorp (gnus-data-header (car arts)))
6215 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6216 (setq result (car arts)
6218 (setq arts (cdr arts)))
6220 (goto-char (gnus-data-pos result))
6221 (gnus-data-number result))))
6223 (defun gnus-summary-search-forward (&optional unread subject backward)
6224 "Search forward for an article.
6225 If UNREAD, look for unread articles. If SUBJECT, look for
6226 articles with that subject. If BACKWARD, search backward instead."
6227 (cond (subject (gnus-summary-find-subject subject unread backward))
6228 (backward (gnus-summary-find-prev unread))
6229 (t (gnus-summary-find-next unread))))
6231 (defun gnus-recenter (&optional n)
6232 "Center point in window and redisplay frame.
6233 Also do horizontal recentering."
6235 (when (and gnus-auto-center-summary
6236 (not (eq gnus-auto-center-summary 'vertical)))
6237 (gnus-horizontal-recenter))
6240 (defun gnus-summary-recenter ()
6241 "Center point in the summary window.
6242 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6243 displayed, no centering will be performed."
6244 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6245 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6247 ;; The user has to want it.
6248 (when gnus-auto-center-summary
6249 (let* ((top (cond ((< (window-height) 4) 0)
6250 ((< (window-height) 7) 1)
6251 (t (if (numberp gnus-auto-center-summary)
6252 gnus-auto-center-summary
6254 (height (1- (window-height)))
6255 (bottom (save-excursion (goto-char (point-max))
6256 (forward-line (- height))
6258 (window (get-buffer-window (current-buffer))))
6259 (when (get-buffer-window gnus-article-buffer)
6260 ;; Only do recentering when the article buffer is displayed,
6261 ;; Set the window start to either `bottom', which is the biggest
6262 ;; possible valid number, or the second line from the top,
6263 ;; whichever is the least.
6264 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6265 (if (> bottom top-pos)
6266 ;; Keep the second line from the top visible
6267 (set-window-start window top-pos t)
6268 ;; Try to keep the bottom line visible; if it's partially
6269 ;; obscured, either scroll one more line to make it fully
6270 ;; visible, or revert to using TOP-POS.
6272 (goto-char (point-max))
6274 (let ((last-line-start (point)))
6276 (set-window-start window (point) t)
6277 (when (not (pos-visible-in-window-p last-line-start window))
6279 (set-window-start window (min (point) top-pos) t)))))))
6280 ;; Do horizontal recentering while we're at it.
6281 (when (and (get-buffer-window (current-buffer) t)
6282 (not (eq gnus-auto-center-summary 'vertical)))
6283 (let ((selected (selected-window)))
6284 (select-window (get-buffer-window (current-buffer) t))
6285 (gnus-summary-position-point)
6286 (gnus-horizontal-recenter)
6287 (select-window selected))))))
6289 (defun gnus-summary-jump-to-group (newsgroup)
6290 "Move point to NEWSGROUP in group mode buffer."
6291 ;; Keep update point of group mode buffer if visible.
6292 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6293 (save-window-excursion
6294 ;; Take care of tree window mode.
6295 (when (get-buffer-window gnus-group-buffer)
6296 (pop-to-buffer gnus-group-buffer))
6297 (gnus-group-jump-to-group newsgroup))
6299 ;; Take care of tree window mode.
6300 (if (get-buffer-window gnus-group-buffer)
6301 (pop-to-buffer gnus-group-buffer)
6302 (set-buffer gnus-group-buffer))
6303 (gnus-group-jump-to-group newsgroup))))
6305 ;; This function returns a list of article numbers based on the
6306 ;; difference between the ranges of read articles in this group and
6307 ;; the range of active articles.
6308 (defun gnus-list-of-unread-articles (group)
6309 (let* ((read (gnus-info-read (gnus-get-info group)))
6310 (active (or (gnus-active group) (gnus-activate-group group)))
6313 ;; If none are read, then all are unread.
6315 (setq first (car active))
6316 ;; If the range of read articles is a single range, then the
6317 ;; first unread article is the article after the last read
6318 ;; article. Sounds logical, doesn't it?
6319 (if (and (not (listp (cdr read)))
6320 (or (< (car read) (car active))
6321 (progn (setq read (list read))
6323 (setq first (max (car active) (1+ (cdr read))))
6324 ;; `read' is a list of ranges.
6325 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6328 (setq first (car active)))
6331 (while (< first nlast)
6332 (setq unread (cons first unread)
6334 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6335 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6336 (setq read (cdr read)))))
6337 ;; And add the last unread articles.
6338 (while (<= first last)
6339 (setq unread (cons first unread)
6341 ;; Return the list of unread articles.
6342 (delq 0 (nreverse unread))))
6344 (defun gnus-list-of-read-articles (group)
6345 "Return a list of unread, unticked and non-dormant articles."
6346 (let* ((info (gnus-get-info group))
6347 (marked (gnus-info-marks info))
6348 (active (gnus-active group)))
6350 (gnus-list-range-difference
6351 (gnus-list-range-difference
6352 (gnus-sorted-complement
6353 (gnus-uncompress-range active)
6354 (gnus-list-of-unread-articles group))
6355 (cdr (assq 'dormant marked)))
6356 (cdr (assq 'tick marked))))))
6358 ;; This function returns a sequence of article numbers based on the
6359 ;; difference between the ranges of read articles in this group and
6360 ;; the range of active articles.
6361 (defun gnus-sequence-of-unread-articles (group)
6362 (let* ((read (gnus-info-read (gnus-get-info group)))
6363 (active (or (gnus-active group) (gnus-activate-group group)))
6366 ;; If none are read, then all are unread.
6368 (setq first (car active))
6369 ;; If the range of read articles is a single range, then the
6370 ;; first unread article is the article after the last read
6371 ;; article. Sounds logical, doesn't it?
6372 (if (and (not (listp (cdr read)))
6373 (or (< (car read) (car active))
6374 (progn (setq read (list read))
6376 (setq first (max (car active) (1+ (cdr read))))
6377 ;; `read' is a list of ranges.
6378 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6381 (setq first (car active)))
6384 (push (cons first nlast) unread))
6385 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6386 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6387 (setq read (cdr read)))))
6388 ;; And add the last unread articles.
6389 (cond ((< first last)
6390 (push (cons first last) unread))
6392 (push first unread)))
6393 ;; Return the sequence of unread articles.
6394 (delq 0 (nreverse unread))))
6396 ;; Various summary commands
6398 (defun gnus-summary-select-article-buffer ()
6399 "Reconfigure windows to show article buffer."
6401 (if (not (gnus-buffer-live-p gnus-article-buffer))
6402 (error "There is no article buffer for this summary buffer")
6403 (gnus-configure-windows 'article)
6404 (select-window (get-buffer-window gnus-article-buffer))))
6406 (defun gnus-summary-universal-argument (arg)
6407 "Perform any operation on all articles that are process/prefixed."
6409 (let ((articles (gnus-summary-work-articles arg))
6416 (substitute-command-keys
6417 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6419 (gnus-error 1 "Undefined key")
6422 (gnus-summary-goto-subject (setq article (pop articles)))
6423 (let (gnus-newsgroup-processable)
6424 (command-execute func))
6425 (gnus-summary-remove-process-mark article)))))
6426 (gnus-summary-position-point))
6428 (defun gnus-summary-toggle-truncation (&optional arg)
6429 "Toggle truncation of summary lines.
6430 With ARG, turn line truncation on if ARG is positive."
6432 (setq truncate-lines
6433 (if (null arg) (not truncate-lines)
6434 (> (prefix-numeric-value arg) 0)))
6437 (defun gnus-summary-find-for-reselect ()
6438 "Return the number of an article to stay on across a reselect.
6439 The current article is considered, then following articles, then previous
6440 articles. An article is sought which is not cancelled and isn't a temporary
6441 insertion from another group. If there's no such then return a dummy 0."
6443 (dolist (rev '(nil t))
6444 (unless found ; don't demand the reverse list if we don't need it
6445 (let ((data (gnus-data-find-list
6446 (gnus-summary-article-number) (gnus-data-list rev))))
6447 (while (and data (not found))
6448 (if (and (< 0 (gnus-data-number (car data)))
6449 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6450 (setq found (gnus-data-number (car data))))
6451 (setq data (cdr data))))))
6454 (defun gnus-summary-reselect-current-group (&optional all rescan)
6455 "Exit and then reselect the current newsgroup.
6456 The prefix argument ALL means to select all articles."
6458 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6459 (error "Ephemeral groups can't be reselected"))
6460 (let ((current-subject (gnus-summary-find-for-reselect))
6461 (group gnus-newsgroup-name))
6462 (setq gnus-newsgroup-begin nil)
6463 (gnus-summary-exit nil 'leave-hidden)
6464 ;; We have to adjust the point of group mode buffer because
6465 ;; point was moved to the next unread newsgroup by exiting.
6466 (gnus-summary-jump-to-group group)
6469 (gnus-group-get-new-news-this-group 1)))
6470 (gnus-group-read-group all t)
6471 (gnus-summary-goto-subject current-subject nil t)))
6473 (defun gnus-summary-rescan-group (&optional all)
6474 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6476 (gnus-summary-reselect-current-group all t))
6478 (defun gnus-summary-update-info (&optional non-destructive)
6480 (let ((group gnus-newsgroup-name))
6482 (when gnus-newsgroup-kill-headers
6483 (setq gnus-newsgroup-killed
6484 (gnus-compress-sequence
6486 (gnus-list-range-intersection
6487 gnus-newsgroup-unselected gnus-newsgroup-killed)
6488 gnus-newsgroup-unreads)
6490 (unless (listp (cdr gnus-newsgroup-killed))
6491 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6492 (let ((headers gnus-newsgroup-headers))
6493 ;; Set the new ranges of read articles.
6495 (set-buffer gnus-group-buffer)
6496 (gnus-undo-force-boundary))
6497 (gnus-update-read-articles
6498 group (gnus-sorted-union
6499 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6500 ;; Set the current article marks.
6501 (let ((gnus-newsgroup-scored
6502 (if (and (not gnus-save-score)
6503 (not non-destructive))
6505 gnus-newsgroup-scored)))
6507 (gnus-update-marks)))
6508 ;; Do the cross-ref thing.
6509 (when gnus-use-cross-reference
6510 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6511 ;; Do not switch windows but change the buffer to work.
6512 (set-buffer gnus-group-buffer)
6513 (unless (gnus-ephemeral-group-p group)
6514 (gnus-group-update-group group)))))))
6516 (defun gnus-summary-save-newsrc (&optional force)
6517 "Save the current number of read/marked articles in the dribble buffer.
6518 The dribble buffer will then be saved.
6519 If FORCE (the prefix), also save the .newsrc file(s)."
6521 (gnus-summary-update-info t)
6523 (gnus-save-newsrc-file)
6524 (gnus-dribble-save)))
6526 (defun gnus-summary-exit (&optional temporary leave-hidden)
6527 "Exit reading current newsgroup, and then return to group selection mode.
6528 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6530 (gnus-set-global-variables)
6531 (when (gnus-buffer-live-p gnus-article-buffer)
6533 (set-buffer gnus-article-buffer)
6534 (mm-destroy-parts gnus-article-mime-handles)
6535 ;; Set it to nil for safety reason.
6536 (setq gnus-article-mime-handle-alist nil)
6537 (setq gnus-article-mime-handles nil)))
6538 (gnus-kill-save-kill-buffer)
6539 (gnus-async-halt-prefetch)
6540 (let* ((group gnus-newsgroup-name)
6541 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6542 (gnus-group-is-exiting-p t)
6545 (buf (current-buffer)))
6547 ;; Do adaptive scoring, and possibly save score files.
6548 (when gnus-newsgroup-adaptive
6549 (gnus-score-adaptive))
6550 (when gnus-use-scoring
6552 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6553 ;; If we have several article buffers, we kill them at exit.
6554 (unless gnus-single-article-buffer
6555 (gnus-kill-buffer gnus-original-article-buffer)
6556 (setq gnus-article-current nil))
6557 (when gnus-use-cache
6558 (gnus-cache-possibly-remove-articles)
6559 (gnus-cache-save-buffers))
6560 (gnus-async-prefetch-remove-group group)
6561 (when gnus-suppress-duplicates
6562 (gnus-dup-enter-articles))
6563 (when gnus-use-trees
6564 (gnus-tree-close group))
6565 (when gnus-use-cache
6566 (gnus-cache-write-active))
6567 ;; Remove entries for this group.
6568 (nnmail-purge-split-history (gnus-group-real-name group))
6569 ;; Make all changes in this group permanent.
6571 (gnus-run-hooks 'gnus-exit-group-hook)
6572 (gnus-summary-update-info))
6573 (gnus-close-group group)
6574 ;; Make sure where we were, and go to next newsgroup.
6575 (set-buffer gnus-group-buffer)
6577 (gnus-group-jump-to-group group))
6578 (gnus-run-hooks 'gnus-summary-exit-hook)
6579 (unless (or quit-config
6580 ;; If this group has disappeared from the summary
6581 ;; buffer, don't skip forwards.
6582 (not (string= group (gnus-group-group-name))))
6583 (gnus-group-next-unread-group 1))
6584 (setq group-point (point))
6587 ;; If we have several article buffers, we kill them at exit.
6588 (unless gnus-single-article-buffer
6589 (gnus-kill-buffer gnus-article-buffer)
6590 (gnus-kill-buffer gnus-original-article-buffer)
6591 (setq gnus-article-current nil))
6593 (if (not gnus-kill-summary-on-exit)
6595 (gnus-deaden-summary)
6597 ;; We set all buffer-local variables to nil. It is unclear why
6598 ;; this is needed, but if we don't, buffer-local variables are
6599 ;; not garbage-collected, it seems. This would the lead to en
6600 ;; ever-growing Emacs.
6601 (gnus-summary-clear-local-variables)
6602 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6603 (gnus-summary-clear-local-variables))
6604 (when (get-buffer gnus-article-buffer)
6605 (bury-buffer gnus-article-buffer))
6606 ;; We clear the global counterparts of the buffer-local
6607 ;; variables as well, just to be on the safe side.
6608 (set-buffer gnus-group-buffer)
6609 (gnus-summary-clear-local-variables)
6610 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6611 (gnus-summary-clear-local-variables))
6612 ;; Return to group mode buffer.
6613 (when (eq mode 'gnus-summary-mode)
6614 (gnus-kill-buffer buf)))
6615 (setq gnus-current-select-method gnus-select-method)
6617 (set-buffer gnus-group-buffer)
6618 (pop-to-buffer gnus-group-buffer))
6619 (if (not quit-config)
6621 (goto-char group-point)
6622 (unless leave-hidden
6623 (gnus-configure-windows 'group 'force)))
6624 (gnus-handle-ephemeral-exit quit-config))
6625 ;; Clear the current group name.
6627 (setq gnus-newsgroup-name nil)))))
6629 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6630 (defun gnus-summary-exit-no-update (&optional no-questions)
6631 "Quit reading current newsgroup without updating read article info."
6633 (let* ((group gnus-newsgroup-name)
6634 (gnus-group-is-exiting-p t)
6635 (gnus-group-is-exiting-without-update-p t)
6636 (quit-config (gnus-group-quit-config group)))
6637 (when (or no-questions
6639 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6640 (gnus-async-halt-prefetch)
6641 (run-hooks 'gnus-summary-prepare-exit-hook)
6642 (when (gnus-buffer-live-p gnus-article-buffer)
6644 (set-buffer gnus-article-buffer)
6645 (mm-destroy-parts gnus-article-mime-handles)
6646 ;; Set it to nil for safety reason.
6647 (setq gnus-article-mime-handle-alist nil)
6648 (setq gnus-article-mime-handles nil)))
6649 ;; If we have several article buffers, we kill them at exit.
6650 (unless gnus-single-article-buffer
6651 (gnus-kill-buffer gnus-article-buffer)
6652 (gnus-kill-buffer gnus-original-article-buffer)
6653 (setq gnus-article-current nil))
6654 (if (not gnus-kill-summary-on-exit)
6655 (gnus-deaden-summary)
6656 (gnus-close-group group)
6657 (gnus-summary-clear-local-variables)
6658 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6659 (gnus-summary-clear-local-variables))
6660 (set-buffer gnus-group-buffer)
6661 (gnus-summary-clear-local-variables)
6662 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6663 (gnus-summary-clear-local-variables))
6664 (gnus-kill-buffer gnus-summary-buffer))
6665 (unless gnus-single-article-buffer
6666 (setq gnus-article-current nil))
6667 (when gnus-use-trees
6668 (gnus-tree-close group))
6669 (gnus-async-prefetch-remove-group group)
6670 (when (get-buffer gnus-article-buffer)
6671 (bury-buffer gnus-article-buffer))
6672 ;; Return to the group buffer.
6673 (gnus-configure-windows 'group 'force)
6674 ;; Clear the current group name.
6675 (setq gnus-newsgroup-name nil)
6676 (unless (gnus-ephemeral-group-p group)
6677 (gnus-group-update-group group))
6678 (when (equal (gnus-group-group-name) group)
6679 (gnus-group-next-unread-group 1))
6681 (gnus-handle-ephemeral-exit quit-config)))))
6683 (defun gnus-handle-ephemeral-exit (quit-config)
6684 "Handle movement when leaving an ephemeral group.
6685 The state which existed when entering the ephemeral is reset."
6686 (if (not (buffer-name (car quit-config)))
6687 (gnus-configure-windows 'group 'force)
6688 (set-buffer (car quit-config))
6689 (cond ((eq major-mode 'gnus-summary-mode)
6690 (gnus-set-global-variables))
6691 ((eq major-mode 'gnus-article-mode)
6693 ;; The `gnus-summary-buffer' variable may point
6694 ;; to the old summary buffer when using a single
6696 (unless (gnus-buffer-live-p gnus-summary-buffer)
6697 (set-buffer gnus-group-buffer))
6698 (set-buffer gnus-summary-buffer)
6699 (gnus-set-global-variables))))
6700 (if (or (eq (cdr quit-config) 'article)
6701 (eq (cdr quit-config) 'pick))
6703 ;; The current article may be from the ephemeral group
6704 ;; thus it is best that we reload this article
6706 ;; If we're exiting from a large digest, this can be
6707 ;; extremely slow. So, it's better not to reload it. -- jh.
6708 ;;(gnus-summary-show-article)
6709 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6710 (gnus-configure-windows 'pick 'force)
6711 (gnus-configure-windows (cdr quit-config) 'force)))
6712 (gnus-configure-windows (cdr quit-config) 'force))
6713 (when (eq major-mode 'gnus-summary-mode)
6714 (gnus-summary-next-subject 1 nil t)
6715 (gnus-summary-recenter)
6716 (gnus-summary-position-point))))
6720 (defvar gnus-dead-summary-mode-map nil)
6722 (unless gnus-dead-summary-mode-map
6723 (setq gnus-dead-summary-mode-map (make-keymap))
6724 (suppress-keymap gnus-dead-summary-mode-map)
6725 (substitute-key-definition
6726 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6727 (dolist (key '("\C-d" "\r" "\177" [delete]))
6728 (define-key gnus-dead-summary-mode-map
6729 key 'gnus-summary-wake-up-the-dead))
6730 (dolist (key '("q" "Q"))
6731 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6733 (defvar gnus-dead-summary-mode nil
6734 "Minor mode for Gnus summary buffers.")
6736 (defun gnus-dead-summary-mode (&optional arg)
6737 "Minor mode for Gnus summary buffers."
6739 (when (eq major-mode 'gnus-summary-mode)
6740 (make-local-variable 'gnus-dead-summary-mode)
6741 (setq gnus-dead-summary-mode
6742 (if (null arg) (not gnus-dead-summary-mode)
6743 (> (prefix-numeric-value arg) 0)))
6744 (when gnus-dead-summary-mode
6746 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6748 (defun gnus-deaden-summary ()
6749 "Make the current summary buffer into a dead summary buffer."
6750 ;; Kill any previous dead summary buffer.
6751 (when (and gnus-dead-summary
6752 (buffer-name gnus-dead-summary))
6754 (set-buffer gnus-dead-summary)
6755 (when gnus-dead-summary-mode
6756 (kill-buffer (current-buffer)))))
6757 ;; Make this the current dead summary.
6758 (setq gnus-dead-summary (current-buffer))
6759 (gnus-dead-summary-mode 1)
6760 (let ((name (buffer-name)))
6761 (when (string-match "Summary" name)
6763 (concat (substring name 0 (match-beginning 0)) "Dead "
6764 (substring name (match-beginning 0)))
6768 (defun gnus-kill-or-deaden-summary (buffer)
6769 "Kill or deaden the summary BUFFER."
6771 (when (and (buffer-name buffer)
6772 (not gnus-single-article-buffer))
6775 (gnus-kill-buffer gnus-article-buffer)
6776 (gnus-kill-buffer gnus-original-article-buffer)))
6779 (gnus-kill-summary-on-exit
6780 (when (and gnus-use-trees
6781 (gnus-buffer-exists-p buffer))
6784 (gnus-tree-close gnus-newsgroup-name)))
6785 (gnus-kill-buffer buffer))
6786 ;; Deaden the buffer.
6787 ((gnus-buffer-exists-p buffer)
6790 (gnus-deaden-summary))))))
6792 (defun gnus-summary-wake-up-the-dead (&rest args)
6793 "Wake up the dead summary buffer."
6795 (gnus-dead-summary-mode -1)
6796 (let ((name (buffer-name)))
6797 (when (string-match "Dead " name)
6799 (concat (substring name 0 (match-beginning 0))
6800 (substring name (match-end 0)))
6802 (gnus-message 3 "This dead summary is now alive again"))
6804 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6805 (defun gnus-summary-fetch-faq (&optional faq-dir)
6806 "Fetch the FAQ for the current group.
6807 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6811 (when current-prefix-arg
6813 "FAQ dir: " (and (listp gnus-group-faq-directory)
6814 (mapcar (lambda (file) (list file))
6815 gnus-group-faq-directory))))))
6816 (let (gnus-faq-buffer)
6817 (when (setq gnus-faq-buffer
6818 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6819 (gnus-configure-windows 'summary-faq))))
6821 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6822 (defun gnus-summary-describe-group (&optional force)
6823 "Describe the current newsgroup."
6825 (gnus-group-describe-group force gnus-newsgroup-name))
6827 (defun gnus-summary-describe-briefly ()
6828 "Describe summary mode commands briefly."
6830 (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")))
6832 ;; Walking around group mode buffer from summary mode.
6834 (defun gnus-summary-next-group (&optional no-article target-group backward)
6835 "Exit current newsgroup and then select next unread newsgroup.
6836 If prefix argument NO-ARTICLE is non-nil, no article is selected
6837 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6838 previous group instead."
6840 ;; Stop pre-fetching.
6841 (gnus-async-halt-prefetch)
6842 (let ((current-group gnus-newsgroup-name)
6843 (current-buffer (current-buffer))
6845 ;; First we semi-exit this group to update Xrefs and all variables.
6846 ;; We can't do a real exit, because the window conf must remain
6847 ;; the same in case the user is prompted for info, and we don't
6848 ;; want the window conf to change before that...
6849 (gnus-summary-exit t)
6850 (while (not entered)
6851 ;; Then we find what group we are supposed to enter.
6852 (set-buffer gnus-group-buffer)
6853 (gnus-group-jump-to-group current-group)
6856 (if (eq gnus-keep-same-level 'best)
6857 (gnus-summary-best-group gnus-newsgroup-name)
6858 (gnus-summary-search-group backward gnus-keep-same-level))))
6859 (if (not target-group)
6860 ;; There are no further groups, so we return to the group
6863 (gnus-message 5 "Returning to the group buffer")
6865 (when (gnus-buffer-live-p current-buffer)
6866 (set-buffer current-buffer)
6867 (gnus-summary-exit))
6868 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6869 ;; We try to enter the target group.
6870 (gnus-group-jump-to-group target-group)
6871 (let ((unreads (gnus-group-group-unread)))
6872 (if (and (or (eq t unreads)
6873 (and unreads (not (zerop unreads))))
6874 (gnus-summary-read-group
6875 target-group nil no-article
6876 (and (buffer-name current-buffer) current-buffer)
6879 (setq current-group target-group
6880 target-group nil)))))))
6882 (defun gnus-summary-prev-group (&optional no-article)
6883 "Exit current newsgroup and then select previous unread newsgroup.
6884 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6886 (gnus-summary-next-group no-article nil t))
6888 ;; Walking around summary lines.
6890 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6891 "Go to the first subject satisfying any non-nil constraint.
6892 If UNREAD is non-nil, the article should be unread.
6893 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6894 If UNSEEN is non-nil, the article should be unseen.
6895 Returns the article selected or nil if there are no matching articles."
6899 ((null gnus-newsgroup-data)
6900 (gnus-message 3 "No articles in the group")
6902 ;; Pick the first article.
6903 ((not (or unread undownloaded unseen))
6904 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6905 (gnus-data-number (car gnus-newsgroup-data)))
6906 ;; Find the first unread article.
6908 (let ((data gnus-newsgroup-data))
6910 (let ((num (gnus-data-number (car data))))
6911 (or (memq num gnus-newsgroup-unfetched)
6912 (not (or (and unread
6913 (memq num gnus-newsgroup-unreads))
6915 (memq num gnus-newsgroup-undownloaded))
6917 (memq num gnus-newsgroup-unseen)))))))
6918 (setq data (cdr data)))
6922 (goto-char (gnus-data-pos (car data)))
6923 (gnus-data-number (car data)))
6924 (gnus-message 3 "No more%s articles"
6925 (let* ((r (when unread " unread"))
6926 (d (when undownloaded " undownloaded"))
6927 (s (when unseen " unseen"))
6928 (l (delq nil (list r d s))))
6929 (cond ((= 3 (length l))
6930 (concat r "," d ", or" s))
6932 (concat (car l) ", or" (cadr l)))
6939 (gnus-summary-position-point))))))
6941 (defun gnus-summary-next-subject (n &optional unread dont-display)
6942 "Go to next N'th summary line.
6943 If N is negative, go to the previous N'th subject line.
6944 If UNREAD is non-nil, only unread articles are selected.
6945 The difference between N and the actual number of steps taken is
6948 (let ((backward (< n 0))
6952 (gnus-summary-find-prev unread)
6953 (gnus-summary-find-next unread)))
6954 (unless (zerop (setq n (1- n)))
6955 (gnus-summary-show-thread)))
6957 (gnus-message 7 "No more%s articles"
6958 (if unread " unread" "")))
6959 (unless dont-display
6960 (gnus-summary-recenter)
6961 (gnus-summary-position-point))
6964 (defun gnus-summary-next-unread-subject (n)
6965 "Go to next N'th unread summary line."
6967 (gnus-summary-next-subject n t))
6969 (defun gnus-summary-prev-subject (n &optional unread)
6970 "Go to previous N'th summary line.
6971 If optional argument UNREAD is non-nil, only unread article is selected."
6973 (gnus-summary-next-subject (- n) unread))
6975 (defun gnus-summary-prev-unread-subject (n)
6976 "Go to previous N'th unread summary line."
6978 (gnus-summary-next-subject (- n) t))
6980 (defun gnus-summary-goto-subjects (articles)
6981 "Insert the subject header for ARTICLES in the current buffer."
6983 (dolist (article articles)
6984 (gnus-summary-goto-subject article t)))
6985 (gnus-summary-limit (append articles gnus-newsgroup-limit))
6986 (gnus-summary-position-point))
6988 (defun gnus-summary-goto-subject (article &optional force silent)
6989 "Go the subject line of ARTICLE.
6990 If FORCE, also allow jumping to articles not currently shown."
6991 (interactive "nArticle number: ")
6992 (unless (numberp article)
6993 (error "Article %s is not a number" article))
6995 (data (gnus-data-find article)))
6996 ;; We read in the article if we have to.
6999 (gnus-summary-insert-subject
7001 (if (or (numberp force) (vectorp force)) force)
7003 (setq data (gnus-data-find article)))
7008 (gnus-message 3 "Can't find article %d" article))
7010 (let ((pt (gnus-data-pos data)))
7012 (gnus-summary-set-article-display-arrow pt))
7013 (gnus-summary-position-point)
7016 ;; Walking around summary lines with displaying articles.
7018 (defun gnus-summary-expand-window (&optional arg)
7019 "Make the summary buffer take up the entire Emacs frame.
7020 Given a prefix, will force an `article' buffer configuration."
7023 (gnus-configure-windows 'article 'force)
7024 (gnus-configure-windows 'summary 'force)))
7026 (defun gnus-summary-display-article (article &optional all-header)
7027 "Display ARTICLE in article buffer."
7028 (when (gnus-buffer-live-p gnus-article-buffer)
7029 (with-current-buffer gnus-article-buffer
7030 (mm-enable-multibyte)))
7031 (gnus-set-global-variables)
7032 (when (gnus-buffer-live-p gnus-article-buffer)
7033 (with-current-buffer gnus-article-buffer
7034 (setq gnus-article-charset gnus-newsgroup-charset)
7035 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7036 (mm-enable-multibyte)))
7040 (if gnus-summary-display-article-function
7041 (funcall gnus-summary-display-article-function article all-header)
7042 (gnus-article-prepare article all-header))
7043 (gnus-run-hooks 'gnus-select-article-hook)
7044 (when (and gnus-current-article
7045 (not (zerop gnus-current-article)))
7046 (gnus-summary-goto-subject gnus-current-article))
7047 (gnus-summary-recenter)
7048 (when (and gnus-use-trees gnus-show-threads)
7049 (gnus-possibly-generate-tree article)
7050 (gnus-highlight-selected-tree article))
7051 ;; Successfully display article.
7052 (gnus-article-set-window-start
7053 (cdr (assq article gnus-newsgroup-bookmarks))))))
7055 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7056 "Select the current article.
7057 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7058 non-nil, the article will be re-fetched even if it already present in
7059 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7061 ;; Make sure we are in the summary buffer to work around bbdb bug.
7062 (unless (eq major-mode 'gnus-summary-mode)
7063 (set-buffer gnus-summary-buffer))
7064 (let ((article (or article (gnus-summary-article-number)))
7065 (all-headers (not (not all-headers))) ;Must be t or nil.
7066 gnus-summary-display-article-function)
7068 (gnus-summary-article-pseudo-p article)
7069 (error "This is a pseudo-article"))
7071 (set-buffer gnus-summary-buffer)
7072 (if (or (and gnus-single-article-buffer
7073 (or (null gnus-current-article)
7074 (null gnus-article-current)
7075 (null (get-buffer gnus-article-buffer))
7076 (not (eq article (cdr gnus-article-current)))
7077 (not (equal (car gnus-article-current)
7078 gnus-newsgroup-name))))
7079 (and (not gnus-single-article-buffer)
7080 (or (null gnus-current-article)
7081 (not (eq gnus-current-article article))))
7083 ;; The requested article is different from the current article.
7085 (gnus-summary-display-article article all-headers)
7086 (when (gnus-buffer-live-p gnus-article-buffer)
7087 (with-current-buffer gnus-article-buffer
7088 (if (not gnus-article-decoded-p) ;; a local variable
7089 (mm-disable-multibyte))))
7090 (gnus-article-set-window-start
7091 (cdr (assq article gnus-newsgroup-bookmarks)))
7095 (defun gnus-summary-force-verify-and-decrypt ()
7096 "Display buttons for signed/encrypted parts and verify/decrypt them."
7098 (let ((mm-verify-option 'known)
7099 (mm-decrypt-option 'known)
7100 (gnus-article-emulate-mime t)
7101 (gnus-buttonized-mime-types (append (list "multipart/signed"
7102 "multipart/encrypted")
7103 gnus-buttonized-mime-types)))
7104 (gnus-summary-select-article nil 'force)))
7106 (defun gnus-summary-set-current-mark (&optional current-mark)
7107 "Obsolete function."
7110 (defun gnus-summary-next-article (&optional unread subject backward push)
7111 "Select the next article.
7112 If UNREAD, only unread articles are selected.
7113 If SUBJECT, only articles with SUBJECT are selected.
7114 If BACKWARD, the previous article is selected instead of the next."
7117 ;; Is there such an article?
7118 ((and (gnus-summary-search-forward unread subject backward)
7119 (or (gnus-summary-display-article (gnus-summary-article-number))
7120 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7121 (gnus-summary-position-point))
7122 ;; If not, we try the first unread, if that is wanted.
7124 gnus-auto-select-same
7125 (gnus-summary-first-unread-article))
7126 (gnus-summary-position-point)
7127 (gnus-message 6 "Wrapped"))
7128 ;; Try to get next/previous article not displayed in this group.
7129 ((and gnus-auto-extend-newsgroup
7130 (not unread) (not subject))
7131 (gnus-summary-goto-article
7132 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7133 nil (count-lines (point-min) (point))))
7134 ;; Go to next/previous group.
7136 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7137 (gnus-summary-jump-to-group gnus-newsgroup-name))
7138 (let ((cmd last-command-char)
7141 (set-buffer gnus-group-buffer)
7144 (if (eq gnus-keep-same-level 'best)
7145 (gnus-summary-best-group gnus-newsgroup-name)
7146 (gnus-summary-search-group backward gnus-keep-same-level))))
7147 ;; For some reason, the group window gets selected. We change
7149 (select-window (get-buffer-window (current-buffer)))
7150 ;; Select next unread newsgroup automagically.
7152 ((or (not gnus-auto-select-next)
7154 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7155 ((or (eq gnus-auto-select-next 'quietly)
7156 (and (eq gnus-auto-select-next 'slightly-quietly)
7158 (and (eq gnus-auto-select-next 'almost-quietly)
7159 (gnus-summary-last-article-p)))
7161 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7163 (gnus-message 7 "No more%s articles (%s)..."
7164 (if unread " unread" "")
7165 (if group (concat "selecting " group)
7167 (gnus-summary-next-group nil group backward)))
7169 (when (gnus-key-press-event-p last-input-event)
7170 (gnus-summary-walk-group-buffer
7171 gnus-newsgroup-name cmd unread backward point))))))))
7173 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7174 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7175 (?\C-p (gnus-group-prev-unread-group 1))))
7176 (cursor-in-echo-area t)
7177 keve key group ended prompt)
7179 (set-buffer gnus-group-buffer)
7182 (if (eq gnus-keep-same-level 'best)
7183 (gnus-summary-best-group gnus-newsgroup-name)
7184 (gnus-summary-search-group backward gnus-keep-same-level))))
7188 "No more%s articles%s " (if unread " unread" "")
7190 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7191 (format " (Type %s for %s [%s])"
7192 (single-key-description cmd) group
7193 (gnus-group-unread group))
7194 (format " (Type %s to exit %s)"
7195 (single-key-description cmd)
7196 gnus-newsgroup-name))))
7197 ;; Confirm auto selection.
7198 (setq key (car (setq keve (gnus-read-event-char prompt)))
7201 ((assq key keystrokes)
7202 (let ((obuf (current-buffer)))
7203 (switch-to-buffer gnus-group-buffer)
7205 (gnus-group-jump-to-group group))
7206 (eval (cadr (assq key keystrokes)))
7207 (setq group (gnus-group-group-name))
7208 (switch-to-buffer obuf))
7212 (gnus-ephemeral-group-p gnus-newsgroup-name))
7214 (gnus-summary-next-group nil group backward)))
7216 (push (cdr keve) unread-command-events))))))
7218 (defun gnus-summary-next-unread-article ()
7219 "Select unread article after current one."
7221 (gnus-summary-next-article
7222 (or (not (eq gnus-summary-goto-unread 'never))
7223 (gnus-summary-last-article-p (gnus-summary-article-number)))
7224 (and gnus-auto-select-same
7225 (gnus-summary-article-subject))))
7227 (defun gnus-summary-prev-article (&optional unread subject)
7228 "Select the article after the current one.
7229 If UNREAD is non-nil, only unread articles are selected."
7231 (gnus-summary-next-article unread subject t))
7233 (defun gnus-summary-prev-unread-article ()
7234 "Select unread article before current one."
7236 (gnus-summary-prev-article
7237 (or (not (eq gnus-summary-goto-unread 'never))
7238 (gnus-summary-first-article-p (gnus-summary-article-number)))
7239 (and gnus-auto-select-same
7240 (gnus-summary-article-subject))))
7242 (defun gnus-summary-next-page (&optional lines circular stop)
7243 "Show next page of the selected article.
7244 If at the end of the current article, select the next article.
7245 LINES says how many lines should be scrolled up.
7247 If CIRCULAR is non-nil, go to the start of the article instead of
7248 selecting the next article when reaching the end of the current
7251 If STOP is non-nil, just stop when reaching the end of the message.
7253 Also see the variable `gnus-article-skip-boring'."
7255 (setq gnus-summary-buffer (current-buffer))
7256 (gnus-set-global-variables)
7257 (let ((article (gnus-summary-article-number))
7258 (article-window (get-buffer-window gnus-article-buffer t))
7260 ;; If the buffer is empty, we have no article.
7262 (error "No article to select"))
7263 (gnus-configure-windows 'article)
7264 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7265 (if (and (eq gnus-summary-goto-unread 'never)
7266 (not (gnus-summary-last-article-p article)))
7267 (gnus-summary-next-article)
7268 (gnus-summary-next-unread-article))
7269 (if (or (null gnus-current-article)
7270 (null gnus-article-current)
7271 (/= article (cdr gnus-article-current))
7272 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7273 ;; Selected subject is different from current article's.
7274 (gnus-summary-display-article article)
7275 (when article-window
7276 (gnus-eval-in-buffer-window gnus-article-buffer
7277 (setq endp (or (gnus-article-next-page lines)
7278 (gnus-article-only-boring-p))))
7281 (gnus-message 3 "End of message"))
7283 (gnus-summary-beginning-of-article))
7285 (gnus-message 3 "End of message"))
7287 (if (and (eq gnus-summary-goto-unread 'never)
7288 (not (gnus-summary-last-article-p article)))
7289 (gnus-summary-next-article)
7290 (gnus-summary-next-unread-article))))))))
7291 (gnus-summary-recenter)
7292 (gnus-summary-position-point)))
7294 (defun gnus-summary-prev-page (&optional lines move)
7295 "Show previous page of selected article.
7296 Argument LINES specifies lines to be scrolled down.
7297 If MOVE, move to the previous unread article if point is at
7298 the beginning of the buffer."
7300 (let ((article (gnus-summary-article-number))
7301 (article-window (get-buffer-window gnus-article-buffer t))
7303 (gnus-configure-windows 'article)
7304 (if (or (null gnus-current-article)
7305 (null gnus-article-current)
7306 (/= article (cdr gnus-article-current))
7307 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7308 ;; Selected subject is different from current article's.
7309 (gnus-summary-display-article article)
7310 (gnus-summary-recenter)
7311 (when article-window
7312 (gnus-eval-in-buffer-window gnus-article-buffer
7313 (setq endp (gnus-article-prev-page lines)))
7314 (when (and move endp)
7316 (gnus-message 3 "Beginning of message"))
7318 (if (and (eq gnus-summary-goto-unread 'never)
7319 (not (gnus-summary-first-article-p article)))
7320 (gnus-summary-prev-article)
7321 (gnus-summary-prev-unread-article))))))))
7322 (gnus-summary-position-point))
7324 (defun gnus-summary-prev-page-or-article (&optional lines)
7325 "Show previous page of selected article.
7326 Argument LINES specifies lines to be scrolled down.
7327 If at the beginning of the article, go to the next article."
7329 (gnus-summary-prev-page lines t))
7331 (defun gnus-summary-scroll-up (lines)
7332 "Scroll up (or down) one line current article.
7333 Argument LINES specifies lines to be scrolled up (or down if negative)."
7335 (gnus-configure-windows 'article)
7336 (gnus-summary-show-thread)
7337 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7338 (gnus-eval-in-buffer-window gnus-article-buffer
7340 (when (gnus-article-next-page lines)
7341 (gnus-message 3 "End of message")))
7343 (gnus-article-prev-page (- lines))))))
7344 (gnus-summary-recenter)
7345 (gnus-summary-position-point))
7347 (defun gnus-summary-scroll-down (lines)
7348 "Scroll down (or up) one line current article.
7349 Argument LINES specifies lines to be scrolled down (or up if negative)."
7351 (gnus-summary-scroll-up (- lines)))
7353 (defun gnus-summary-next-same-subject ()
7354 "Select next article which has the same subject as current one."
7356 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7358 (defun gnus-summary-prev-same-subject ()
7359 "Select previous article which has the same subject as current one."
7361 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7363 (defun gnus-summary-next-unread-same-subject ()
7364 "Select next unread article which has the same subject as current one."
7366 (gnus-summary-next-article t (gnus-summary-article-subject)))
7368 (defun gnus-summary-prev-unread-same-subject ()
7369 "Select previous unread article which has the same subject as current one."
7371 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7373 (defun gnus-summary-first-unread-article ()
7374 "Select the first unread article.
7375 Return nil if there are no unread articles."
7378 (when (gnus-summary-first-subject t)
7379 (gnus-summary-show-thread)
7380 (gnus-summary-first-subject t)
7381 (gnus-summary-display-article (gnus-summary-article-number)))
7382 (gnus-summary-position-point)))
7384 (defun gnus-summary-first-unread-subject ()
7385 "Place the point on the subject line of the first unread article.
7386 Return nil if there are no unread articles."
7389 (when (gnus-summary-first-subject t)
7390 (gnus-summary-show-thread)
7391 (gnus-summary-first-subject t))
7392 (gnus-summary-position-point)))
7394 (defun gnus-summary-first-unseen-subject ()
7395 "Place the point on the subject line of the first unseen article.
7396 Return nil if there are no unseen articles."
7399 (when (gnus-summary-first-subject nil nil t)
7400 (gnus-summary-show-thread)
7401 (gnus-summary-first-subject nil nil t))
7402 (gnus-summary-position-point)))
7404 (defun gnus-summary-first-unseen-or-unread-subject ()
7405 "Place the point on the subject line of the first unseen article or,
7406 if all article have been seen, on the subject line of the first unread
7410 (unless (when (gnus-summary-first-subject nil nil t)
7411 (gnus-summary-show-thread)
7412 (gnus-summary-first-subject nil nil t))
7413 (when (gnus-summary-first-subject t)
7414 (gnus-summary-show-thread)
7415 (gnus-summary-first-subject t)))
7416 (gnus-summary-position-point)))
7418 (defun gnus-summary-first-article ()
7419 "Select the first article.
7420 Return nil if there are no articles."
7423 (when (gnus-summary-first-subject)
7424 (gnus-summary-show-thread)
7425 (gnus-summary-first-subject)
7426 (gnus-summary-display-article (gnus-summary-article-number)))
7427 (gnus-summary-position-point)))
7429 (defun gnus-summary-best-unread-article (&optional arg)
7430 "Select the unread article with the highest score.
7431 If given a prefix argument, select the next unread article that has a
7432 score higher than the default score."
7434 (let ((article (if arg
7435 (gnus-summary-better-unread-subject)
7436 (gnus-summary-best-unread-subject))))
7438 (gnus-summary-goto-article article)
7439 (error "No unread articles"))))
7441 (defun gnus-summary-best-unread-subject ()
7442 "Select the unread subject with the highest score."
7444 (let ((best -1000000)
7445 (data gnus-newsgroup-data)
7448 (and (gnus-data-unread-p (car data))
7450 (gnus-summary-article-score (gnus-data-number (car data))))
7453 article (gnus-data-number (car data))))
7454 (setq data (cdr data)))
7456 (gnus-summary-goto-subject article))
7457 (gnus-summary-position-point)
7460 (defun gnus-summary-better-unread-subject ()
7461 "Select the first unread subject that has a score over the default score."
7463 (let ((data gnus-newsgroup-data)
7465 (while (and (setq article (gnus-data-number (car data)))
7466 (or (gnus-data-read-p (car data))
7467 (not (> (gnus-summary-article-score article)
7468 gnus-summary-default-score))))
7469 (setq data (cdr data)))
7471 (gnus-summary-goto-subject article))
7472 (gnus-summary-position-point)
7475 (defun gnus-summary-last-subject ()
7476 "Go to the last displayed subject line in the group."
7477 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7479 (gnus-summary-goto-subject article))))
7481 (defun gnus-summary-goto-article (article &optional all-headers force)
7482 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7483 If ALL-HEADERS is non-nil, no header lines are hidden.
7484 If FORCE, go to the article even if it isn't displayed. If FORCE
7485 is a number, it is the line the article is to be displayed on."
7489 "Article number or Message-ID: "
7490 (mapcar (lambda (number) (list (int-to-string number)))
7491 gnus-newsgroup-limit))
7495 (if (and (stringp article)
7496 (string-match "@\\|%40" article))
7497 (gnus-summary-refer-article article)
7498 (when (stringp article)
7499 (setq article (string-to-number article)))
7500 (if (gnus-summary-goto-subject article force)
7501 (gnus-summary-display-article article all-headers)
7502 (gnus-message 4 "Couldn't go to article %s" article) nil))
7503 (gnus-summary-position-point)))
7505 (defun gnus-summary-goto-last-article ()
7506 "Go to the previously read article."
7509 (when gnus-last-article
7510 (gnus-summary-goto-article gnus-last-article nil t))
7511 (gnus-summary-position-point)))
7513 (defun gnus-summary-pop-article (number)
7514 "Pop one article off the history and go to the previous.
7515 NUMBER articles will be popped off."
7518 (setq gnus-newsgroup-history
7519 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7521 (gnus-summary-goto-article (car to) nil t)
7522 (error "Article history empty")))
7523 (gnus-summary-position-point))
7525 ;; Summary commands and functions for limiting the summary buffer.
7527 (defun gnus-summary-limit-to-articles (n)
7528 "Limit the summary buffer to the next N articles.
7529 If not given a prefix, use the process marked articles instead."
7532 (let ((articles (gnus-summary-work-articles n)))
7533 (setq gnus-newsgroup-processable nil)
7534 (gnus-summary-limit articles))
7535 (gnus-summary-position-point)))
7537 (defun gnus-summary-pop-limit (&optional total)
7538 "Restore the previous limit.
7539 If given a prefix, remove all limits."
7542 (setq gnus-newsgroup-limits
7543 (list (mapcar (lambda (h) (mail-header-number h))
7544 gnus-newsgroup-headers))))
7545 (unless gnus-newsgroup-limits
7546 (error "No limit to pop"))
7548 (gnus-summary-limit nil 'pop)
7549 (gnus-summary-position-point)))
7551 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7552 "Limit the summary buffer to articles that have subjects that match a regexp.
7553 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7555 (list (read-string (if current-prefix-arg
7556 "Exclude subject (regexp): "
7557 "Limit to subject (regexp): "))
7558 nil current-prefix-arg))
7560 (setq header "subject"))
7561 (when (not (equal "" subject))
7563 (let ((articles (gnus-summary-find-matching
7564 (or header "subject") subject 'all nil nil
7567 (error "Found no matches for \"%s\"" subject))
7568 (gnus-summary-limit articles))
7569 (gnus-summary-position-point))))
7571 (defun gnus-summary-limit-to-author (from &optional not-matching)
7572 "Limit the summary buffer to articles that have authors that match a regexp.
7573 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7575 (list (read-string (if current-prefix-arg
7576 "Exclude author (regexp): "
7577 "Limit to author (regexp): "))
7578 current-prefix-arg))
7579 (gnus-summary-limit-to-subject from "from" not-matching))
7581 (defun gnus-summary-limit-to-age (age &optional younger-p)
7582 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7583 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7584 articles that are younger than AGE days."
7586 (let ((younger current-prefix-arg)
7589 (while (not days-got)
7590 (setq days (if younger
7591 (read-string "Limit to articles younger than (in days, older when negative): ")
7593 "Limit to articles older than (in days, younger when negative): ")))
7594 (when (> (length days) 0)
7595 (setq days (read days)))
7600 (setq younger (not younger))
7601 (setq days (* days -1))))
7602 (message "Please enter a number.")
7604 (list days younger)))
7606 (let ((data gnus-newsgroup-data)
7607 (cutoff (days-to-time age))
7608 articles d date is-younger)
7609 (while (setq d (pop data))
7610 (when (and (vectorp (gnus-data-header d))
7611 (setq date (mail-header-date (gnus-data-header d))))
7612 (setq is-younger (time-less-p
7613 (time-since (condition-case ()
7620 (push (gnus-data-number d) articles))))
7621 (gnus-summary-limit (nreverse articles)))
7622 (gnus-summary-position-point)))
7624 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7625 "Limit the summary buffer to articles that match an 'extra' header."
7629 (gnus-completing-read-with-default
7630 (symbol-name (car gnus-extra-headers))
7631 (if current-prefix-arg
7632 "Exclude extra header:"
7633 "Limit extra header:")
7635 (cons (symbol-name x) x))
7640 (read-string (format "%s header %s (regexp): "
7641 (if current-prefix-arg "Exclude" "Limit to")
7643 current-prefix-arg)))
7644 (when (not (equal "" regexp))
7646 (let ((articles (gnus-summary-find-matching
7647 (cons 'extra header) regexp 'all nil nil
7650 (error "Found no matches for \"%s\"" regexp))
7651 (gnus-summary-limit articles))
7652 (gnus-summary-position-point))))
7654 (defun gnus-summary-limit-to-display-predicate ()
7655 "Limit the summary buffer to the predicated in the `display' group parameter."
7657 (unless gnus-newsgroup-display
7658 (error "There is no `display' group parameter"))
7660 (dolist (number gnus-newsgroup-articles)
7661 (when (funcall gnus-newsgroup-display)
7662 (push number articles)))
7663 (gnus-summary-limit articles))
7664 (gnus-summary-position-point))
7666 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7668 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7670 (defun gnus-summary-limit-to-unread (&optional all)
7671 "Limit the summary buffer to articles that are not marked as read.
7672 If ALL is non-nil, limit strictly to unread articles."
7675 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7676 (gnus-summary-limit-to-marks
7677 ;; Concat all the marks that say that an article is read and have
7679 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7680 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7681 gnus-low-score-mark gnus-expirable-mark
7682 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7683 gnus-duplicate-mark gnus-souped-mark)
7686 (defun gnus-summary-limit-to-replied (&optional unreplied)
7687 "Limit the summary buffer to replied articles.
7688 If UNREPLIED (the prefix), limit to unreplied articles."
7692 (gnus-set-difference gnus-newsgroup-articles
7693 gnus-newsgroup-replied))
7694 (gnus-summary-limit gnus-newsgroup-replied))
7695 (gnus-summary-position-point))
7697 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7698 (make-obsolete 'gnus-summary-delete-marked-with
7699 'gnus-summary-limit-exclude-marks)
7701 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7702 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7703 If REVERSE, limit the summary buffer to articles that are marked
7704 with MARKS. MARKS can either be a string of marks or a list of marks.
7705 Returns how many articles were removed."
7706 (interactive "sMarks: ")
7707 (gnus-summary-limit-to-marks marks t))
7709 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7710 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7711 If REVERSE (the prefix), limit the summary buffer to articles that are
7712 not marked with MARKS. MARKS can either be a string of marks or a
7714 Returns how many articles were removed."
7715 (interactive "sMarks: \nP")
7717 (let ((data gnus-newsgroup-data)
7718 (marks (if (listp marks) marks
7719 (append marks nil))) ; Transform to list.
7722 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7723 (memq (gnus-data-mark (car data)) marks))
7724 (push (gnus-data-number (car data)) articles))
7725 (setq data (cdr data)))
7726 (gnus-summary-limit articles))
7727 (gnus-summary-position-point)))
7729 (defun gnus-summary-limit-to-score (score)
7730 "Limit to articles with score at or above SCORE."
7731 (interactive "NLimit to articles with score of at least: ")
7732 (let ((data gnus-newsgroup-data)
7735 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7737 (push (gnus-data-number (car data)) articles))
7738 (setq data (cdr data)))
7740 (gnus-summary-limit articles)
7741 (gnus-summary-position-point))))
7743 (defun gnus-summary-limit-to-unseen ()
7744 "Limit to unseen articles."
7747 (gnus-summary-limit gnus-newsgroup-unseen)
7748 (gnus-summary-position-point)))
7750 (defun gnus-summary-limit-include-thread (id)
7751 "Display all the hidden articles that is in the thread with ID in it.
7752 When called interactively, ID is the Message-ID of the current
7754 (interactive (list (mail-header-id (gnus-summary-article-header))))
7755 (let ((articles (gnus-articles-in-thread
7756 (gnus-id-to-thread (gnus-root-id id)))))
7758 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7759 (gnus-summary-limit-include-matching-articles
7761 (regexp-quote (gnus-simplify-subject-re
7762 (mail-header-subject (gnus-id-to-header id)))))
7763 (gnus-summary-position-point))))
7765 (defun gnus-summary-limit-include-matching-articles (header regexp)
7766 "Display all the hidden articles that have HEADERs that match REGEXP."
7767 (interactive (list (read-string "Match on header: ")
7768 (read-string "Regexp: ")))
7769 (let ((articles (gnus-find-matching-articles header regexp)))
7771 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7772 (gnus-summary-position-point))))
7774 (defun gnus-summary-insert-dormant-articles ()
7775 "Insert all the dormant articles for this group into the current buffer."
7777 (let ((gnus-verbose (max 6 gnus-verbose)))
7778 (if (not gnus-newsgroup-dormant)
7779 (gnus-message 3 "No cached articles for this group")
7780 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7782 (defun gnus-summary-limit-include-dormant ()
7783 "Display all the hidden articles that are marked as dormant.
7784 Note that this command only works on a subset of the articles currently
7785 fetched for this group."
7787 (unless gnus-newsgroup-dormant
7788 (error "There are no dormant articles in this group"))
7790 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7791 (gnus-summary-position-point)))
7793 (defun gnus-summary-limit-exclude-dormant ()
7794 "Hide all dormant articles."
7797 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7798 (gnus-summary-position-point)))
7800 (defun gnus-summary-limit-exclude-childless-dormant ()
7801 "Hide all dormant articles that have no children."
7803 (let ((data (gnus-data-list t))
7804 articles d children)
7805 ;; Find all articles that are either not dormant or have
7807 (while (setq d (pop data))
7808 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7810 (gnus-article-children (gnus-data-number d)))
7813 (when (memq (car children) articles)
7818 (push (gnus-data-number d) articles)))
7821 (gnus-summary-limit articles)
7822 (gnus-summary-position-point))))
7824 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7825 "Mark all unread excluded articles as read.
7826 If ALL, mark even excluded ticked and dormants as read."
7828 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7829 (let ((articles (gnus-sorted-ndifference
7831 (mapcar (lambda (h) (mail-header-number h))
7832 gnus-newsgroup-headers)
7834 gnus-newsgroup-limit))
7836 (setq gnus-newsgroup-unreads
7837 (gnus-sorted-intersection gnus-newsgroup-unreads
7838 gnus-newsgroup-limit))
7840 (setq gnus-newsgroup-dormant nil
7841 gnus-newsgroup-marked nil
7842 gnus-newsgroup-reads
7844 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7845 gnus-newsgroup-reads))
7846 (while (setq article (pop articles))
7847 (unless (or (memq article gnus-newsgroup-dormant)
7848 (memq article gnus-newsgroup-marked))
7849 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7851 (defun gnus-summary-limit (articles &optional pop)
7853 ;; We pop the previous limit off the stack and use that.
7854 (setq articles (car gnus-newsgroup-limits)
7855 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7856 ;; We use the new limit, so we push the old limit on the stack.
7857 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7859 (setq gnus-newsgroup-limit articles)
7860 (let ((total (length gnus-newsgroup-data))
7861 (data (gnus-data-find-list (gnus-summary-article-number)))
7862 (gnus-summary-mark-below nil) ; Inhibit this.
7864 ;; This will do all the work of generating the new summary buffer
7865 ;; according to the new limit.
7866 (gnus-summary-prepare)
7867 ;; Hide any threads, possibly.
7868 (gnus-summary-maybe-hide-threads)
7869 ;; Try to return to the article you were at, or one in the
7872 ;; We try to find some article after the current one.
7874 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7877 (setq data (cdr data))))
7879 ;; If there is no data, that means that we were after the last
7880 ;; article. The same goes when we can't find any articles
7881 ;; after the current one.
7882 (goto-char (point-max))
7883 (gnus-summary-find-prev))
7884 (gnus-set-mode-line 'summary)
7885 ;; We return how many articles were removed from the summary
7886 ;; buffer as a result of the new limit.
7887 (- total (length gnus-newsgroup-data))))
7889 (defsubst gnus-invisible-cut-children (threads)
7892 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7897 (defsubst gnus-cut-thread (thread)
7898 "Go forwards in the thread until we find an article that we want to display."
7899 (when (or (eq gnus-fetch-old-headers 'some)
7900 (eq gnus-fetch-old-headers 'invisible)
7901 (numberp gnus-fetch-old-headers)
7902 (eq gnus-build-sparse-threads 'some)
7903 (eq gnus-build-sparse-threads 'more))
7904 ;; Deal with old-fetched headers and sparse threads.
7908 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7909 (gnus-summary-article-ancient-p
7910 (mail-header-number (car thread))))
7911 (if (or (<= (length (cdr thread)) 1)
7912 (eq gnus-fetch-old-headers 'invisible))
7913 (setq gnus-newsgroup-limit
7914 (delq (mail-header-number (car thread))
7915 gnus-newsgroup-limit)
7916 thread (cadr thread))
7917 (when (gnus-invisible-cut-children (cdr thread))
7918 (let ((th (cdr thread)))
7920 (if (memq (mail-header-number (caar th))
7921 gnus-newsgroup-limit)
7922 (setq thread (car th)
7924 (setq th (cdr th))))))))))
7927 (defun gnus-cut-threads (threads)
7928 "Cut off all uninteresting articles from the beginning of THREADS."
7929 (when (or (eq gnus-fetch-old-headers 'some)
7930 (eq gnus-fetch-old-headers 'invisible)
7931 (numberp gnus-fetch-old-headers)
7932 (eq gnus-build-sparse-threads 'some)
7933 (eq gnus-build-sparse-threads 'more))
7936 (setcar th (gnus-cut-thread (car th)))
7937 (setq th (cdr th)))))
7938 ;; Remove nixed out threads.
7941 (defun gnus-summary-initial-limit (&optional show-if-empty)
7942 "Figure out what the initial limit is supposed to be on group entry.
7943 This entails weeding out unwanted dormants, low-scored articles,
7944 fetch-old-headers verbiage, and so on."
7945 ;; Most groups have nothing to remove.
7946 (if (or gnus-inhibit-limiting
7947 (and (null gnus-newsgroup-dormant)
7948 (eq gnus-newsgroup-display 'gnus-not-ignore)
7949 (not (eq gnus-fetch-old-headers 'some))
7950 (not (numberp gnus-fetch-old-headers))
7951 (not (eq gnus-fetch-old-headers 'invisible))
7952 (null gnus-summary-expunge-below)
7953 (not (eq gnus-build-sparse-threads 'some))
7954 (not (eq gnus-build-sparse-threads 'more))
7955 (null gnus-thread-expunge-below)
7956 (not gnus-use-nocem)))
7958 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7959 (setq gnus-newsgroup-limit nil)
7962 (unless (car (symbol-value node))
7963 ;; These threads have no parents -- they are roots.
7964 (let ((nodes (cdr (symbol-value node)))
7967 (if (and gnus-thread-expunge-below
7968 (< (gnus-thread-total-score (car nodes))
7969 gnus-thread-expunge-below))
7970 (gnus-expunge-thread (pop nodes))
7971 (setq thread (pop nodes))
7972 (gnus-summary-limit-children thread))))))
7973 gnus-newsgroup-dependencies)
7974 ;; If this limitation resulted in an empty group, we might
7975 ;; pop the previous limit and use it instead.
7976 (when (and (not gnus-newsgroup-limit)
7978 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7979 gnus-newsgroup-limit))
7981 (defun gnus-summary-limit-children (thread)
7982 "Return 1 if this subthread is visible and 0 if it is not."
7983 ;; First we get the number of visible children to this thread. This
7984 ;; is done by recursing down the thread using this function, so this
7985 ;; will really go down to a leaf article first, before slowly
7986 ;; working its way up towards the root.
7988 (let* ((max-lisp-eval-depth 5000)
7991 (apply '+ (mapcar 'gnus-summary-limit-children
7994 (number (mail-header-number (car thread)))
7997 (not (memq number gnus-newsgroup-marked))
7999 ;; If this article is dormant and has absolutely no visible
8000 ;; children, then this article isn't visible.
8001 (and (memq number gnus-newsgroup-dormant)
8003 ;; If this is "fetch-old-headered" and there is no
8004 ;; visible children, then we don't want this article.
8005 (and (or (eq gnus-fetch-old-headers 'some)
8006 (numberp gnus-fetch-old-headers))
8007 (gnus-summary-article-ancient-p number)
8009 ;; If this is "fetch-old-headered" and `invisible', then
8010 ;; we don't want this article.
8011 (and (eq gnus-fetch-old-headers 'invisible)
8012 (gnus-summary-article-ancient-p number))
8013 ;; If this is a sparsely inserted article with no children,
8014 ;; we don't want it.
8015 (and (eq gnus-build-sparse-threads 'some)
8016 (gnus-summary-article-sparse-p number)
8018 ;; If we use expunging, and this article is really
8019 ;; low-scored, then we don't want this article.
8020 (when (and gnus-summary-expunge-below
8022 (or (cdr (assq number gnus-newsgroup-scored))
8023 gnus-summary-default-score))
8024 gnus-summary-expunge-below))
8025 ;; We increase the expunge-tally here, but that has
8026 ;; nothing to do with the limits, really.
8027 (incf gnus-newsgroup-expunged-tally)
8028 ;; We also mark as read here, if that's wanted.
8029 (when (and gnus-summary-mark-below
8030 (< score gnus-summary-mark-below))
8031 (setq gnus-newsgroup-unreads
8032 (delq number gnus-newsgroup-unreads))
8033 (if gnus-newsgroup-auto-expire
8034 (push number gnus-newsgroup-expirable)
8035 (push (cons number gnus-low-score-mark)
8036 gnus-newsgroup-reads)))
8038 ;; Do the `display' group parameter.
8039 (and gnus-newsgroup-display
8040 (not (funcall gnus-newsgroup-display)))
8041 ;; Check NoCeM things.
8042 (when (and gnus-use-nocem
8043 (gnus-nocem-unwanted-article-p
8044 (mail-header-id (car thread))))
8045 (setq gnus-newsgroup-unreads
8046 (delq number gnus-newsgroup-unreads))
8048 ;; Nope, invisible article.
8050 ;; Ok, this article is to be visible, so we add it to the limit
8052 (push number gnus-newsgroup-limit)
8055 (defun gnus-expunge-thread (thread)
8056 "Mark all articles in THREAD as read."
8057 (let* ((number (mail-header-number (car thread))))
8058 (incf gnus-newsgroup-expunged-tally)
8059 ;; We also mark as read here, if that's wanted.
8060 (setq gnus-newsgroup-unreads
8061 (delq number gnus-newsgroup-unreads))
8062 (if gnus-newsgroup-auto-expire
8063 (push number gnus-newsgroup-expirable)
8064 (push (cons number gnus-low-score-mark)
8065 gnus-newsgroup-reads)))
8066 ;; Go recursively through all subthreads.
8067 (mapcar 'gnus-expunge-thread (cdr thread)))
8069 ;; Summary article oriented commands
8071 (defun gnus-summary-refer-parent-article (n)
8072 "Refer parent article N times.
8073 If N is negative, go to ancestor -N instead.
8074 The difference between N and the number of articles fetched is returned."
8078 (when (not (natnump n))
8083 (setq header (gnus-summary-article-header))
8084 (if (and (eq (mail-header-number header)
8085 (cdr gnus-article-current))
8086 (equal gnus-newsgroup-name
8087 (car gnus-article-current)))
8088 ;; If we try to find the parent of the currently
8089 ;; displayed article, then we take a look at the actual
8090 ;; References header, since this is slightly more
8091 ;; reliable than the References field we got from the
8094 (set-buffer gnus-original-article-buffer)
8095 (nnheader-narrow-to-headers)
8096 (unless (setq ref (message-fetch-field "references"))
8097 (when (setq ref (message-fetch-field "in-reply-to"))
8098 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8101 ;; It's not the current article, so we take a bet on
8102 ;; the value we got from the server.
8103 (mail-header-references header)))
8105 (not (equal ref "")))
8106 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8107 (gnus-message 1 "Couldn't find parent"))
8108 (gnus-message 1 "No references in article %d"
8109 (gnus-summary-article-number))
8112 (gnus-summary-position-point)
8115 (defun gnus-summary-refer-references ()
8116 "Fetch all articles mentioned in the References header.
8117 Return the number of articles fetched."
8119 (let ((ref (mail-header-references (gnus-summary-article-header)))
8120 (current (gnus-summary-article-number))
8124 (error "No References in the current article")
8125 ;; For each Message-ID in the References header...
8126 (while (string-match "<[^>]*>" ref)
8128 ;; ... fetch that article.
8129 (gnus-summary-refer-article
8130 (prog1 (match-string 0 ref)
8131 (setq ref (substring ref (match-end 0))))))
8132 (gnus-summary-goto-subject current)
8133 (gnus-summary-position-point)
8136 (defun gnus-summary-refer-thread (&optional limit)
8137 "Fetch all articles in the current thread.
8138 If LIMIT (the numerical prefix), fetch that many old headers instead
8139 of what's specified by the `gnus-refer-thread-limit' variable."
8141 (let ((id (mail-header-id (gnus-summary-article-header)))
8142 (limit (if limit (prefix-numeric-value limit)
8143 gnus-refer-thread-limit)))
8144 (unless (eq gnus-fetch-old-headers 'invisible)
8145 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8146 ;; Retrieve the headers and read them in.
8147 (if (eq (if (numberp limit)
8148 (gnus-retrieve-headers
8150 (+ (mail-header-number
8151 (gnus-summary-article-header))
8153 gnus-newsgroup-end))
8154 gnus-newsgroup-name (* limit 2))
8155 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8157 (gnus-retrieve-headers (list gnus-newsgroup-end)
8158 gnus-newsgroup-name limit))
8160 (gnus-build-all-threads)
8161 (error "Can't fetch thread from back ends that don't support NOV"))
8162 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8163 (gnus-summary-limit-include-thread id)))
8165 (defun gnus-summary-refer-article (message-id)
8166 "Fetch an article specified by MESSAGE-ID."
8167 (interactive "sMessage-ID: ")
8168 (when (and (stringp message-id)
8169 (not (zerop (length message-id))))
8170 (setq message-id (gnus-replace-in-string message-id " " ""))
8171 ;; Construct the correct Message-ID if necessary.
8172 ;; Suggested by tale@pawl.rpi.edu.
8173 (unless (string-match "^<" message-id)
8174 (setq message-id (concat "<" message-id)))
8175 (unless (string-match ">$" message-id)
8176 (setq message-id (concat message-id ">")))
8177 ;; People often post MIDs from URLs, so unhex it:
8178 (unless (string-match "@" message-id)
8179 (setq message-id (gnus-url-unhex-string message-id)))
8180 (let* ((header (gnus-id-to-header message-id))
8182 (gnus-summary-article-sparse-p
8183 (mail-header-number header))
8184 (memq (mail-header-number header)
8185 gnus-newsgroup-limit)))
8188 ;; If the article is present in the buffer we just go to it.
8190 (or (not (gnus-summary-article-sparse-p
8191 (mail-header-number header)))
8194 (gnus-summary-goto-article
8195 (mail-header-number header) nil t)
8197 (gnus-summary-update-article (mail-header-number header)))))
8199 ;; We fetch the article.
8201 (dolist (gnus-override-method (gnus-refer-article-methods))
8202 (when (and (gnus-check-server gnus-override-method)
8203 ;; Fetch the header,
8204 (setq number (gnus-summary-insert-subject message-id)))
8205 ;; and display the article.
8206 (gnus-summary-select-article nil nil nil number)
8208 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8210 (defun gnus-refer-article-methods ()
8211 "Return a list of referable methods."
8213 ;; No method, so we default to current and native.
8214 ((null gnus-refer-article-method)
8215 (list gnus-current-select-method gnus-select-method))
8217 ((eq 'current gnus-refer-article-method)
8218 (list gnus-current-select-method))
8219 ;; List of select methods.
8220 ((not (and (symbolp (car gnus-refer-article-method))
8221 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8223 (dolist (method gnus-refer-article-method)
8224 (push (if (eq 'current method)
8225 gnus-current-select-method
8229 ;; One single select method.
8231 (list gnus-refer-article-method))))
8233 (defun gnus-summary-edit-parameters ()
8234 "Edit the group parameters of the current group."
8236 (gnus-group-edit-group gnus-newsgroup-name 'params))
8238 (defun gnus-summary-customize-parameters ()
8239 "Customize the group parameters of the current group."
8241 (gnus-group-customize gnus-newsgroup-name))
8243 (defun gnus-summary-enter-digest-group (&optional force)
8244 "Enter an nndoc group based on the current article.
8245 If FORCE, force a digest interpretation. If not, try
8246 to guess what the document format is."
8248 (let ((conf gnus-current-window-configuration))
8249 (save-window-excursion
8251 (let (gnus-article-prepare-hook
8252 gnus-display-mime-function
8254 (gnus-summary-select-article))))
8255 (setq gnus-current-window-configuration conf)
8256 (let* ((name (format "%s-%d"
8257 (gnus-group-prefixed-name
8258 gnus-newsgroup-name (list 'nndoc ""))
8260 (set-buffer gnus-summary-buffer)
8261 gnus-current-article)))
8262 (ogroup gnus-newsgroup-name)
8263 (params (append (gnus-info-params (gnus-get-info ogroup))
8264 (list (cons 'to-group ogroup))
8265 (list (cons 'parent-group ogroup))
8266 (list (cons 'save-article-group ogroup))))
8267 (case-fold-search t)
8268 (buf (current-buffer))
8271 (set-buffer gnus-original-article-buffer)
8272 ;; Have the digest group inherit the main mail address of
8273 ;; the parent article.
8274 (when (setq to-address (or (gnus-fetch-field "reply-to")
8275 (gnus-fetch-field "from")))
8276 (setq params (append
8277 (list (cons 'to-address
8278 (funcall gnus-decode-encoded-word-function
8280 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8281 (insert-buffer-substring gnus-original-article-buffer)
8282 ;; Remove lines that may lead nndoc to misinterpret the
8285 (goto-char (point-min))
8286 (or (search-forward "\n\n" nil t) (point)))
8287 (goto-char (point-min))
8288 (delete-matching-lines "^Path:\\|^From ")
8291 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8292 (gnus-newsgroup-ephemeral-ignored-charsets
8293 gnus-newsgroup-ignored-charsets))
8294 (gnus-group-read-ephemeral-group
8295 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8297 ,(if force 'mbox 'guess)))
8299 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8301 ;; Make all postings to this group go to the parent group.
8302 (nconc (gnus-info-params (gnus-get-info name))
8304 ;; Couldn't select this doc group.
8305 (switch-to-buffer buf)
8306 (gnus-set-global-variables)
8307 (gnus-configure-windows 'summary)
8308 (gnus-message 3 "Article couldn't be entered?"))
8309 (kill-buffer dig)))))
8311 (defun gnus-summary-read-document (n)
8312 "Open a new group based on the current article(s).
8313 This will allow you to read digests and other similar
8314 documents as newsgroups.
8315 Obeys the standard process/prefix convention."
8317 (let* ((articles (gnus-summary-work-articles n))
8318 (ogroup gnus-newsgroup-name)
8319 (params (append (gnus-info-params (gnus-get-info ogroup))
8320 (list (cons 'to-group ogroup))))
8321 article group egroup groups vgroup)
8322 (while (setq article (pop articles))
8323 (setq group (format "%s-%d" gnus-newsgroup-name article))
8324 (gnus-summary-remove-process-mark article)
8325 (when (gnus-summary-display-article article)
8328 (insert-buffer-substring gnus-original-article-buffer)
8329 ;; Remove some headers that may lead nndoc to make
8331 (message-narrow-to-head)
8332 (goto-char (point-min))
8333 (delete-matching-lines "^Path:\\|^From ")
8336 (gnus-group-read-ephemeral-group
8337 group `(nndoc ,group (nndoc-address ,(current-buffer))
8338 (nndoc-article-type guess))
8341 ;; Make all postings to this group go to the parent group.
8342 (nconc (gnus-info-params (gnus-get-info egroup))
8344 (push egroup groups))
8345 ;; Couldn't select this doc group.
8346 (gnus-error 3 "Article couldn't be entered"))))))
8347 ;; Now we have selected all the documents.
8350 (error "None of the articles could be interpreted as documents"))
8351 ((gnus-group-read-ephemeral-group
8352 (setq vgroup (format
8353 "nnvirtual:%s-%s" gnus-newsgroup-name
8354 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8355 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8357 (cons (current-buffer) 'summary)))
8359 (error "Couldn't select virtual nndoc group")))))
8361 (defun gnus-summary-isearch-article (&optional regexp-p)
8362 "Do incremental search forward on the current article.
8363 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8365 (gnus-summary-select-article)
8366 (gnus-configure-windows 'article)
8367 (gnus-eval-in-buffer-window gnus-article-buffer
8370 (isearch-forward regexp-p))))
8372 (defun gnus-summary-search-article-forward (regexp &optional backward)
8373 "Search for an article containing REGEXP forward.
8374 If BACKWARD, search backward instead."
8377 (format "Search article %s (regexp%s): "
8378 (if current-prefix-arg "backward" "forward")
8379 (if gnus-last-search-regexp
8380 (concat ", default " gnus-last-search-regexp)
8382 current-prefix-arg))
8383 (if (string-equal regexp "")
8384 (setq regexp (or gnus-last-search-regexp ""))
8385 (setq gnus-last-search-regexp regexp)
8386 (setq gnus-article-before-search gnus-current-article))
8387 ;; Intentionally set gnus-last-article.
8388 (setq gnus-last-article gnus-article-before-search)
8389 (let ((gnus-last-article gnus-last-article))
8390 (if (gnus-summary-search-article regexp backward)
8391 (gnus-summary-show-thread)
8392 (error "Search failed: \"%s\"" regexp))))
8394 (defun gnus-summary-search-article-backward (regexp)
8395 "Search for an article containing REGEXP backward."
8398 (format "Search article backward (regexp%s): "
8399 (if gnus-last-search-regexp
8400 (concat ", default " gnus-last-search-regexp)
8402 (gnus-summary-search-article-forward regexp 'backward))
8404 (defun gnus-summary-search-article (regexp &optional backward)
8405 "Search for an article containing REGEXP.
8406 Optional argument BACKWARD means do search for backward.
8407 `gnus-select-article-hook' is not called during the search."
8408 ;; We have to require this here to make sure that the following
8409 ;; dynamic binding isn't shadowed by autoloading.
8410 (require 'gnus-async)
8412 (let ((gnus-select-article-hook nil) ;Disable hook.
8413 (gnus-article-prepare-hook nil)
8414 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8415 (gnus-use-article-prefetch nil)
8416 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8417 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8419 (gnus-keep-backlog nil)
8420 (gnus-break-pages nil)
8421 (gnus-summary-display-arrow nil)
8422 (gnus-updated-mode-lines nil)
8423 (gnus-auto-center-summary nil)
8424 (sum (current-buffer))
8425 (gnus-display-mime-function nil)
8428 (gnus-save-hidden-threads
8429 (gnus-summary-select-article)
8430 (set-buffer gnus-article-buffer)
8431 (goto-char (window-point (get-buffer-window (current-buffer))))
8435 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8437 (re-search-backward regexp nil t)
8438 (re-search-forward regexp nil t))
8439 ;; We found the regexp.
8444 (get-buffer-window (current-buffer))
8448 (get-buffer-window (current-buffer))
8451 (setq point (point)))
8452 ;; We didn't find it, so we go to the next article.
8455 (while (eq found 'not)
8456 (if (not (if backward (gnus-summary-find-prev)
8457 (gnus-summary-find-next)))
8458 ;; No more articles.
8460 ;; Select the next article and adjust point.
8461 (unless (gnus-summary-article-sparse-p
8462 (gnus-summary-article-number))
8464 (gnus-summary-select-article)
8465 (set-buffer gnus-article-buffer)
8467 (goto-char (if backward (point-max) (point-min))))))))
8468 (gnus-message 7 ""))
8469 ;; Return whether we found the regexp.
8470 (when (eq found 'found)
8472 (gnus-summary-show-thread)
8473 (gnus-summary-goto-subject gnus-current-article)
8474 (gnus-summary-position-point)
8477 (defun gnus-find-matching-articles (header regexp)
8478 "Return a list of all articles that match REGEXP on HEADER.
8479 This search includes all articles in the current group that Gnus has
8480 fetched headers for, whether they are displayed or not."
8481 (let ((articles nil)
8482 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8483 (case-fold-search t))
8484 (dolist (header gnus-newsgroup-headers)
8485 (when (string-match regexp (funcall func header))
8486 (push (mail-header-number header) articles)))
8487 (nreverse articles)))
8489 (defun gnus-summary-find-matching (header regexp &optional backward unread
8490 not-case-fold not-matching)
8491 "Return a list of all articles that match REGEXP on HEADER.
8492 The search stars on the current article and goes forwards unless
8493 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8494 If UNREAD is non-nil, only unread articles will
8495 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8496 in the comparisons. If NOT-MATCHING, return a list of all articles that
8497 not match REGEXP on HEADER."
8498 (let ((case-fold-search (not not-case-fold))
8501 (if (eq (car header) 'extra)
8504 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8506 (error "%s is an invalid header" header))
8507 (unless (fboundp (intern (concat "mail-header-" header)))
8508 (error "%s is not a valid header" header))
8509 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8510 (dolist (d (if (eq backward 'all)
8512 (gnus-data-find-list
8513 (gnus-summary-article-number)
8514 (gnus-data-list backward))))
8515 (when (and (or (not unread) ; We want all articles...
8516 (gnus-data-unread-p d)) ; Or just unreads.
8517 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8521 (funcall func (gnus-data-header d))))
8522 (string-match regexp
8523 (funcall func (gnus-data-header d)))))
8524 (push (gnus-data-number d) articles))) ; Success!
8525 (nreverse articles)))
8527 (defun gnus-summary-execute-command (header regexp command &optional backward)
8528 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8529 If HEADER is an empty string (or nil), the match is done on the entire
8530 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8532 (list (let ((completion-ignore-case t))
8535 (mapcar (lambda (header) (list (format "%s" header)))
8537 '("Number" "Subject" "From" "Lines" "Date"
8538 "Message-ID" "Xref" "References" "Body")
8539 gnus-extra-headers))
8540 nil 'require-match))
8541 (read-string "Regexp: ")
8542 (read-key-sequence "Command: ")
8543 current-prefix-arg))
8544 (when (equal header "Body")
8546 ;; Hidden thread subtrees must be searched as well.
8547 (gnus-summary-show-all-threads)
8548 ;; We don't want to change current point nor window configuration.
8550 (save-window-excursion
8552 gnus-treat-strip-trailing-blank-lines
8553 gnus-treat-strip-leading-blank-lines
8554 gnus-treat-strip-multiple-blank-lines
8555 gnus-treat-hide-boring-headers
8556 gnus-treat-fold-newsgroups
8557 gnus-article-prepare-hook)
8558 (gnus-message 6 "Executing %s..." (key-description command))
8559 ;; We'd like to execute COMMAND interactively so as to give arguments.
8560 (gnus-execute header regexp
8561 `(call-interactively ',(key-binding command))
8563 (gnus-message 6 "Executing %s...done" (key-description command))))))
8565 (defun gnus-summary-beginning-of-article ()
8566 "Scroll the article back to the beginning."
8568 (gnus-summary-select-article)
8569 (gnus-configure-windows 'article)
8570 (gnus-eval-in-buffer-window gnus-article-buffer
8572 (goto-char (point-min))
8573 (when gnus-break-pages
8574 (gnus-narrow-to-page))))
8576 (defun gnus-summary-end-of-article ()
8577 "Scroll to the end of the article."
8579 (gnus-summary-select-article)
8580 (gnus-configure-windows 'article)
8581 (gnus-eval-in-buffer-window gnus-article-buffer
8583 (goto-char (point-max))
8585 (when gnus-break-pages
8586 (when (re-search-backward page-delimiter nil t)
8587 (narrow-to-region (match-end 0) (point-max)))
8588 (gnus-narrow-to-page))))
8590 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8591 "Truncate to LEN and quote all \"(\"'s in STRING."
8592 (gnus-replace-in-string (if (and len (> (length string) len))
8593 (substring string 0 len)
8597 (defun gnus-summary-print-article (&optional filename n)
8598 "Generate and print a PostScript image of the process-marked (mail) articles.
8600 If used interactively, print the current article if none are
8601 process-marked. With prefix arg, prompt the user for the name of the
8604 When used from Lisp, accept two optional args FILENAME and N. N means
8605 to print the next N articles. If N is negative, print the N previous
8606 articles. If N is nil and articles have been marked with the process
8607 mark, print these instead.
8609 If the optional first argument FILENAME is nil, send the image to the
8610 printer. If FILENAME is a string, save the PostScript image in a file with
8611 that name. If FILENAME is a number, prompt the user for the name of the file
8613 (interactive (list (ps-print-preprint current-prefix-arg)))
8614 (dolist (article (gnus-summary-work-articles n))
8615 (gnus-summary-select-article nil nil 'pseudo article)
8616 (gnus-eval-in-buffer-window gnus-article-buffer
8617 (gnus-print-buffer))
8618 (gnus-summary-remove-process-mark article))
8619 (ps-despool filename))
8621 (defun gnus-print-buffer ()
8622 (let ((buffer (generate-new-buffer " *print*")))
8625 (copy-to-buffer buffer (point-min) (point-max))
8627 (gnus-remove-text-with-property 'gnus-decoration)
8628 (when (gnus-visual-p 'article-highlight 'highlight)
8629 ;; Copy-to-buffer doesn't copy overlay. So redo
8631 (let ((gnus-article-buffer buffer))
8632 (gnus-article-highlight-citation t)
8633 (gnus-article-highlight-signature)
8634 (gnus-article-emphasize)
8635 (gnus-article-delete-invisible-text)))
8636 (let ((ps-left-header
8639 (gnus-summary-print-truncate-and-quote
8640 (mail-header-subject gnus-current-headers)
8643 (gnus-summary-print-truncate-and-quote
8644 (mail-header-from gnus-current-headers)
8648 "/pagenumberstring load"
8650 (mail-header-date gnus-current-headers) ")"))))
8651 (gnus-run-hooks 'gnus-ps-print-hook)
8654 (ps-spool-buffer-with-faces)
8655 (ps-spool-buffer)))))
8656 (kill-buffer buffer))))
8658 (defun gnus-summary-show-article (&optional arg)
8659 "Force redisplaying of the current article.
8660 If ARG (the prefix) is a number, show the article with the charset
8661 defined in `gnus-summary-show-article-charset-alist', or the charset
8663 If ARG (the prefix) is non-nil and not a number, show the raw article
8664 without any article massaging functions being run. Normally, the key
8665 strokes are `C-u g'."
8669 (gnus-summary-show-article t)
8670 (let ((gnus-newsgroup-charset
8671 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8672 (mm-read-coding-system
8673 "View as charset: " ;; actually it is coding system.
8675 (set-buffer gnus-article-buffer)
8676 (mm-detect-coding-region (point) (point-max))))))
8677 (gnus-newsgroup-ignored-charsets 'gnus-all))
8678 (gnus-summary-select-article nil 'force)
8679 (let ((deps gnus-newsgroup-dependencies)
8682 (set-buffer gnus-original-article-buffer)
8684 (message-narrow-to-head)
8685 (setq head (buffer-string))
8686 (goto-char (point-min))
8687 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8688 (goto-char (point-max))
8690 (setq lines (1- (count-lines (point) (point-max))))))
8692 (insert (format "211 %d Article retrieved.\n"
8693 (cdr gnus-article-current)))
8695 (if lines (insert (format "Lines: %d\n" lines)))
8697 (let ((nntp-server-buffer (current-buffer)))
8698 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8699 (gnus-data-set-header
8700 (gnus-data-find (cdr gnus-article-current))
8702 (gnus-summary-update-article-line
8703 (cdr gnus-article-current) header)
8704 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8705 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8707 ;; Select the article the normal way.
8708 (gnus-summary-select-article nil 'force))
8710 ;; We have to require this here to make sure that the following
8711 ;; dynamic binding isn't shadowed by autoloading.
8712 (require 'gnus-async)
8714 ;; Bind the article treatment functions to nil.
8715 (let ((gnus-have-all-headers t)
8716 gnus-article-prepare-hook
8717 gnus-article-decode-hook
8718 gnus-display-mime-function
8720 ;; Destroy any MIME parts.
8721 (when (gnus-buffer-live-p gnus-article-buffer)
8723 (set-buffer gnus-article-buffer)
8724 (mm-destroy-parts gnus-article-mime-handles)
8725 ;; Set it to nil for safety reason.
8726 (setq gnus-article-mime-handle-alist nil)
8727 (setq gnus-article-mime-handles nil)))
8728 (gnus-summary-select-article nil 'force))))
8729 (gnus-summary-goto-subject gnus-current-article)
8730 (gnus-summary-position-point))
8732 (defun gnus-summary-show-raw-article ()
8733 "Show the raw article without any article massaging functions being run."
8735 (gnus-summary-show-article t))
8737 (defun gnus-summary-verbose-headers (&optional arg)
8738 "Toggle permanent full header display.
8739 If ARG is a positive number, turn header display on.
8740 If ARG is a negative number, turn header display off."
8742 (setq gnus-show-all-headers
8743 (cond ((or (not (numberp arg))
8745 (not gnus-show-all-headers))
8748 (gnus-summary-show-article))
8750 (defun gnus-summary-toggle-header (&optional arg)
8751 "Show the headers if they are hidden, or hide them if they are shown.
8752 If ARG is a positive number, show the entire header.
8753 If ARG is a negative number, hide the unwanted header lines."
8755 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8756 (get-buffer-window gnus-article-buffer t))))
8757 (with-current-buffer gnus-article-buffer
8759 (article-narrow-to-head)
8760 (let* ((buffer-read-only nil)
8761 (inhibit-point-motion-hooks t)
8762 (hidden (if (numberp arg)
8764 (gnus-article-hidden-text-p 'headers)))
8766 (delete-region (point-min) (point-max))
8767 (with-current-buffer gnus-original-article-buffer
8768 (goto-char (setq s (point-min)))
8769 (setq e (if (search-forward "\n\n" nil t)
8772 (insert-buffer-substring gnus-original-article-buffer s e)
8773 (run-hooks 'gnus-article-decode-hook)
8775 (let ((gnus-treat-hide-headers nil)
8776 (gnus-treat-hide-boring-headers nil))
8777 (gnus-delete-wash-type 'headers)
8778 (gnus-treat-article 'head))
8779 (gnus-treat-article 'head))
8782 (set-window-start window (goto-char (point-min))))
8783 (if gnus-break-pages
8784 (gnus-narrow-to-page)
8785 (when (gnus-visual-p 'page-marker)
8786 (let ((buffer-read-only nil))
8787 (gnus-remove-text-with-property 'gnus-prev)
8788 (gnus-remove-text-with-property 'gnus-next))))
8789 (gnus-set-mode-line 'article)))))
8791 (defun gnus-summary-show-all-headers ()
8792 "Make all header lines visible."
8794 (gnus-summary-toggle-header 1))
8796 (defun gnus-summary-caesar-message (&optional arg)
8797 "Caesar rotate the current article by 13.
8798 The numerical prefix specifies how many places to rotate each letter
8801 (gnus-summary-select-article)
8802 (let ((mail-header-separator ""))
8803 (gnus-eval-in-buffer-window gnus-article-buffer
8806 (let ((start (window-start))
8808 (message-caesar-buffer-body arg)
8809 (set-window-start (get-buffer-window (current-buffer)) start))))))
8811 (autoload 'unmorse-region "morse"
8812 "Convert morse coded text in region to ordinary ASCII text."
8815 (defun gnus-summary-morse-message (&optional arg)
8816 "Morse decode the current article."
8818 (gnus-summary-select-article)
8819 (let ((mail-header-separator ""))
8820 (gnus-eval-in-buffer-window gnus-article-buffer
8824 (let ((pos (window-start))
8826 (goto-char (point-min))
8827 (when (message-goto-body)
8828 (gnus-narrow-to-body))
8829 (goto-char (point-min))
8830 (while (re-search-forward "·" (point-max) t)
8831 (replace-match "."))
8832 (unmorse-region (point-min) (point-max))
8834 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8836 (defun gnus-summary-stop-page-breaking ()
8837 "Stop page breaking in the current article."
8839 (gnus-summary-select-article)
8840 (gnus-eval-in-buffer-window gnus-article-buffer
8842 (when (gnus-visual-p 'page-marker)
8843 (let ((buffer-read-only nil))
8844 (gnus-remove-text-with-property 'gnus-prev)
8845 (gnus-remove-text-with-property 'gnus-next))
8846 (setq gnus-page-broken nil))))
8848 (defun gnus-summary-move-article (&optional n to-newsgroup
8849 select-method action)
8850 "Move the current article to a different newsgroup.
8851 If N is a positive number, move the N next articles.
8852 If N is a negative number, move the N previous articles.
8853 If N is nil and any articles have been marked with the process mark,
8854 move those articles instead.
8855 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8856 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8857 re-spool using this method.
8859 When called interactively with TO-NEWSGROUP being nil, the value of
8860 the variable `gnus-move-split-methods' is used for finding a default
8861 for the target newsgroup.
8863 For this function to work, both the current newsgroup and the
8864 newsgroup that you want to move to have to support the `request-move'
8865 and `request-accept' functions.
8867 ACTION can be either `move' (the default), `crosspost' or `copy'."
8870 (setq action 'move))
8871 ;; Check whether the source group supports the required functions.
8872 (cond ((and (eq action 'move)
8873 (not (gnus-check-backend-function
8874 'request-move-article gnus-newsgroup-name)))
8875 (error "The current group does not support article moving"))
8876 ((and (eq action 'crosspost)
8877 (not (gnus-check-backend-function
8878 'request-replace-article gnus-newsgroup-name)))
8879 (error "The current group does not support article editing")))
8880 (let ((articles (gnus-summary-work-articles n))
8881 (prefix (if (gnus-check-backend-function
8882 'request-move-article gnus-newsgroup-name)
8883 (funcall gnus-move-group-prefix-function
8884 gnus-newsgroup-name)
8886 (names '((move "Move" "Moving")
8887 (copy "Copy" "Copying")
8888 (crosspost "Crosspost" "Crossposting")))
8889 (copy-buf (save-excursion
8890 (nnheader-set-temp-buffer " *copy article*")))
8891 art-group to-method new-xref article to-groups)
8892 (unless (assq action names)
8893 (error "Unknown action %s" action))
8894 ;; Read the newsgroup name.
8895 (when (and (not to-newsgroup)
8896 (not select-method))
8897 (if (and gnus-move-split-methods
8899 (and (memq gnus-current-article articles)
8900 (gnus-buffer-live-p gnus-original-article-buffer))))
8901 ;; When `gnus-move-split-methods' is non-nil, we have to
8902 ;; select an article to give `gnus-read-move-group-name' an
8903 ;; opportunity to suggest an appropriate default. However,
8904 ;; we needn't render or mark the article.
8905 (let ((gnus-display-mime-function nil)
8906 (gnus-article-prepare-hook nil)
8907 (gnus-mark-article-hook nil))
8908 (gnus-summary-select-article nil nil nil (car articles))))
8910 (gnus-read-move-group-name
8911 (cadr (assq action names))
8912 (symbol-value (intern (format "gnus-current-%s-group" action)))
8914 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8915 (setq to-method (or select-method
8916 (gnus-server-to-method
8917 (gnus-group-method to-newsgroup))))
8918 ;; Check the method we are to move this article to...
8919 (unless (gnus-check-backend-function
8920 'request-accept-article (car to-method))
8921 (error "%s does not support article copying" (car to-method)))
8922 (unless (gnus-check-server to-method)
8923 (error "Can't open server %s" (car to-method)))
8924 (gnus-message 6 "%s to %s: %s..."
8925 (caddr (assq action names))
8926 (or (car select-method) to-newsgroup) articles)
8928 (setq article (pop articles))
8932 ;; Move the article.
8934 ;; Remove this article from future suppression.
8935 (gnus-dup-unsuppress-article article)
8936 (gnus-request-move-article
8937 article ; Article to move
8938 gnus-newsgroup-name ; From newsgroup
8939 (nth 1 (gnus-find-method-for-group
8940 gnus-newsgroup-name)) ; Server
8941 (list 'gnus-request-accept-article
8942 to-newsgroup (list 'quote select-method)
8943 (not articles) t) ; Accept form
8944 (not articles))) ; Only save nov last time
8945 ;; Copy the article.
8948 (set-buffer copy-buf)
8949 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8950 (gnus-request-accept-article
8951 to-newsgroup select-method (not articles) t))))
8952 ;; Crosspost the article.
8953 ((eq action 'crosspost)
8954 (let ((xref (message-tokenize-header
8955 (mail-header-xref (gnus-summary-article-header article))
8957 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8958 ":" (number-to-string article)))
8960 (setq xref (list (system-name))))
8963 (mapconcat 'identity
8964 (delete "Xref:" (delete new-xref xref))
8968 (set-buffer copy-buf)
8969 ;; First put the article in the destination group.
8970 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8971 (when (consp (setq art-group
8972 (gnus-request-accept-article
8973 to-newsgroup select-method (not articles))))
8974 (setq new-xref (concat new-xref " " (car art-group)
8976 (number-to-string (cdr art-group))))
8977 ;; Now we have the new Xrefs header, so we insert
8978 ;; it and replace the new article.
8979 (nnheader-replace-header "Xref" new-xref)
8980 (gnus-request-replace-article
8981 (cdr art-group) to-newsgroup (current-buffer))
8985 (gnus-message 1 "Couldn't %s article %s: %s"
8986 (cadr (assq action names)) article
8987 (nnheader-get-report (car to-method))))
8988 ((eq art-group 'junk)
8989 (when (eq action 'move)
8990 (gnus-summary-mark-article article gnus-canceled-mark)
8991 (gnus-message 4 "Deleted article %s" article)
8992 ;; run the delete hook
8993 (run-hook-with-args 'gnus-summary-article-delete-hook
8996 (assoc article (gnus-data-list nil)))
8997 gnus-newsgroup-name nil
9000 (let* ((pto-group (gnus-group-prefixed-name
9001 (car art-group) to-method))
9002 (info (gnus-get-info pto-group))
9003 (to-group (gnus-info-group info))
9005 ;; Update the group that has been moved to.
9007 (memq action '(move copy)))
9008 (unless (member to-group to-groups)
9009 (push to-group to-groups))
9011 (unless (memq article gnus-newsgroup-unreads)
9012 (push 'read to-marks)
9014 info (gnus-add-to-range (gnus-info-read info)
9015 (list (cdr art-group)))))
9017 ;; See whether the article is to be put in the cache.
9018 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9019 gnus-article-mark-lists
9020 (delete '(expirable . expire)
9021 (copy-sequence gnus-article-mark-lists))))
9022 (to-article (cdr art-group)))
9024 ;; Enter the article into the cache in the new group,
9025 ;; if that is required.
9026 (when gnus-use-cache
9027 (gnus-cache-possibly-enter-article
9029 (memq article gnus-newsgroup-marked)
9030 (memq article gnus-newsgroup-dormant)
9031 (memq article gnus-newsgroup-unreads)))
9033 (when gnus-preserve-marks
9034 ;; Copy any marks over to the new group.
9035 (when (and (equal to-group gnus-newsgroup-name)
9036 (not (memq article gnus-newsgroup-unreads)))
9037 ;; Mark this article as read in this group.
9038 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9039 (setcdr (gnus-active to-group) to-article)
9040 (setcdr gnus-newsgroup-active to-article))
9043 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9044 (when (memq article (symbol-value
9045 (intern (format "gnus-newsgroup-%s"
9047 (push (cdar marks) to-marks)
9048 ;; If the other group is the same as this group,
9049 ;; then we have to add the mark to the list.
9050 (when (equal to-group gnus-newsgroup-name)
9051 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9054 (intern (format "gnus-newsgroup-%s"
9056 ;; Copy the marks to other group.
9057 (gnus-add-marked-articles
9058 to-group (cdar marks) (list to-article) info)))
9059 (setq marks (cdr marks)))
9061 (gnus-request-set-mark
9062 to-group (list (list (list to-article) 'add to-marks))))
9065 (concat "(gnus-group-set-info '"
9066 (gnus-prin1-to-string (gnus-get-info to-group))
9069 ;; Update the Xref header in this article to point to
9070 ;; the new crossposted article we have just created.
9071 (when (eq action 'crosspost)
9073 (set-buffer copy-buf)
9074 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9075 (nnheader-replace-header "Xref" new-xref)
9076 (gnus-request-replace-article
9077 article gnus-newsgroup-name (current-buffer))))
9079 ;; run the move/copy/crosspost/respool hook
9080 (run-hook-with-args 'gnus-summary-article-move-hook
9083 (assoc article (gnus-data-list nil)))
9088 ;;;!!!Why is this necessary?
9089 (set-buffer gnus-summary-buffer)
9091 (gnus-summary-goto-subject article)
9092 (when (eq action 'move)
9093 (gnus-summary-mark-article article gnus-canceled-mark))))
9094 (gnus-summary-remove-process-mark article))
9095 ;; Re-activate all groups that have been moved to.
9097 (set-buffer gnus-group-buffer)
9098 (let ((gnus-group-marked to-groups))
9099 (gnus-group-get-new-news-this-group nil t)))
9101 (gnus-kill-buffer copy-buf)
9102 (gnus-summary-position-point)
9103 (gnus-set-mode-line 'summary)))
9105 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9106 "Move the current article to a different newsgroup.
9107 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9108 When called interactively, if TO-NEWSGROUP is nil, use the value of
9109 the variable `gnus-move-split-methods' for finding a default target
9111 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9112 re-spool using this method."
9114 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9116 (defun gnus-summary-crosspost-article (&optional n)
9117 "Crosspost the current article to some other group."
9119 (gnus-summary-move-article n nil nil 'crosspost))
9121 (defcustom gnus-summary-respool-default-method nil
9122 "Default method type for respooling an article.
9123 If nil, use to the current newsgroup method."
9125 :group 'gnus-summary-mail)
9127 (defcustom gnus-summary-display-while-building nil
9128 "If non-nil, show and update the summary buffer as it's being built.
9129 If the value is t, update the buffer after every line is inserted. If
9130 the value is an integer (N), update the display every N lines."
9132 :type '(choice (const :tag "off" nil)
9134 (const :tag "frequently" t)))
9136 (defun gnus-summary-respool-article (&optional n method)
9137 "Respool the current article.
9138 The article will be squeezed through the mail spooling process again,
9139 which means that it will be put in some mail newsgroup or other
9140 depending on `nnmail-split-methods'.
9141 If N is a positive number, respool the N next articles.
9142 If N is a negative number, respool the N previous articles.
9143 If N is nil and any articles have been marked with the process mark,
9144 respool those articles instead.
9146 Respooling can be done both from mail groups and \"real\" newsgroups.
9147 In the former case, the articles in question will be moved from the
9148 current group into whatever groups they are destined to. In the
9149 latter case, they will be copied into the relevant groups."
9151 (list current-prefix-arg
9152 (let* ((methods (gnus-methods-using 'respool))
9154 (symbol-name (or gnus-summary-respool-default-method
9155 (car (gnus-find-method-for-group
9156 gnus-newsgroup-name)))))
9158 (gnus-completing-read-with-default
9159 methname "What backend do you want to use when respooling?"
9160 methods nil t nil 'gnus-mail-method-history))
9163 ((zerop (length (setq ms (gnus-servers-using-backend
9165 (list (intern method) ""))
9169 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9170 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9173 (error "No method given for respooling"))
9174 (if (assoc (symbol-name
9175 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9176 (gnus-methods-using 'respool))
9177 (gnus-summary-move-article n nil method)
9178 (gnus-summary-copy-article n nil method)))
9180 (defun gnus-summary-import-article (file &optional edit)
9181 "Import an arbitrary file into a mail newsgroup."
9182 (interactive "fImport file: \nP")
9183 (let ((group gnus-newsgroup-name)
9184 (now (current-time))
9185 atts lines group-art)
9186 (unless (gnus-check-backend-function 'request-accept-article group)
9187 (error "%s does not support article importing" group))
9188 (or (file-readable-p file)
9189 (not (file-regular-p file))
9190 (error "Can't read %s" file))
9192 (set-buffer (gnus-get-buffer-create " *import file*"))
9194 (nnheader-insert-file-contents file)
9195 (goto-char (point-min))
9196 (if (nnheader-article-p)
9198 (goto-char (point-min))
9199 (search-forward "\n\n" nil t)
9200 (narrow-to-region (point-min) (1- (point)))
9201 (goto-char (point-min))
9202 (unless (re-search-forward "^date:" nil t)
9203 (goto-char (point-max))
9204 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9205 ;; This doesn't look like an article, so we fudge some headers.
9206 (setq atts (file-attributes file)
9207 lines (count-lines (point-min) (point-max)))
9208 (insert "From: " (read-string "From: ") "\n"
9209 "Subject: " (read-string "Subject: ") "\n"
9210 "Date: " (message-make-date (nth 5 atts)) "\n"
9211 "Message-ID: " (message-make-message-id) "\n"
9212 "Lines: " (int-to-string lines) "\n"
9213 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9214 (setq group-art (gnus-request-accept-article group nil t))
9215 (kill-buffer (current-buffer)))
9216 (setq gnus-newsgroup-active (gnus-activate-group group))
9218 (gnus-summary-goto-article (cdr group-art) nil t)
9220 (gnus-summary-edit-article))))
9222 (defun gnus-summary-create-article ()
9223 "Create an article in a mail newsgroup."
9225 (let ((group gnus-newsgroup-name)
9226 (now (current-time))
9228 (unless (gnus-check-backend-function 'request-accept-article group)
9229 (error "%s does not support article importing" group))
9231 (set-buffer (gnus-get-buffer-create " *import file*"))
9233 (goto-char (point-min))
9234 ;; This doesn't look like an article, so we fudge some headers.
9235 (insert "From: " (read-string "From: ") "\n"
9236 "Subject: " (read-string "Subject: ") "\n"
9237 "Date: " (message-make-date now) "\n"
9238 "Message-ID: " (message-make-message-id) "\n")
9239 (setq group-art (gnus-request-accept-article group nil t))
9240 (kill-buffer (current-buffer)))
9241 (setq gnus-newsgroup-active (gnus-activate-group group))
9243 (gnus-summary-goto-article (cdr group-art) nil t)
9244 (gnus-summary-edit-article)))
9246 (defun gnus-summary-article-posted-p ()
9247 "Say whether the current (mail) article is available from news as well.
9248 This will be the case if the article has both been mailed and posted."
9250 (let ((id (mail-header-references (gnus-summary-article-header)))
9251 (gnus-override-method (car (gnus-refer-article-methods))))
9252 (if (gnus-request-head id "")
9253 (gnus-message 2 "The current message was found on %s"
9254 gnus-override-method)
9255 (gnus-message 2 "The current message couldn't be found on %s"
9256 gnus-override-method)
9259 (defun gnus-summary-expire-articles (&optional now)
9260 "Expire all articles that are marked as expirable in the current group."
9262 (when (and (not gnus-group-is-exiting-without-update-p)
9263 (gnus-check-backend-function
9264 'request-expire-articles gnus-newsgroup-name))
9265 ;; This backend supports expiry.
9266 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9267 (expirable (if total
9269 ;; We need to update the info for
9270 ;; this group for `gnus-list-of-read-articles'
9271 ;; to give us the right answer.
9272 (gnus-run-hooks 'gnus-exit-group-hook)
9273 (gnus-summary-update-info)
9274 (gnus-list-of-read-articles gnus-newsgroup-name))
9275 (setq gnus-newsgroup-expirable
9276 (sort gnus-newsgroup-expirable '<))))
9277 (expiry-wait (if now 'immediate
9278 (gnus-group-find-parameter
9279 gnus-newsgroup-name 'expiry-wait)))
9280 (nnmail-expiry-target
9281 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9282 nnmail-expiry-target))
9285 ;; There are expirable articles in this group, so we run them
9286 ;; through the expiry process.
9287 (gnus-message 6 "Expiring articles...")
9288 (unless (gnus-check-group gnus-newsgroup-name)
9289 (error "Can't open server for %s" gnus-newsgroup-name))
9290 ;; The list of articles that weren't expired is returned.
9293 (let ((nnmail-expiry-wait-function nil)
9294 (nnmail-expiry-wait expiry-wait))
9295 (setq es (gnus-request-expire-articles
9296 expirable gnus-newsgroup-name)))
9297 (setq es (gnus-request-expire-articles
9298 expirable gnus-newsgroup-name)))
9300 (setq gnus-newsgroup-expirable es))
9301 ;; We go through the old list of expirable, and mark all
9302 ;; really expired articles as nonexistent.
9303 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9304 (let ((gnus-use-cache nil))
9305 (dolist (article expirable)
9306 (when (and (not (memq article es))
9307 (gnus-data-find article))
9308 (gnus-summary-mark-article article gnus-canceled-mark)
9309 (run-hook-with-args 'gnus-summary-article-expire-hook
9312 (assoc article (gnus-data-list nil)))
9316 (gnus-message 6 "Expiring articles...done")))))
9318 (defun gnus-summary-expire-articles-now ()
9319 "Expunge all expirable articles in the current group.
9320 This means that *all* articles that are marked as expirable will be
9321 deleted forever, right now."
9323 (or gnus-expert-user
9325 "Are you really, really, really sure you want to delete all these messages? ")
9327 (gnus-summary-expire-articles t))
9329 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9330 (defun gnus-summary-delete-article (&optional n)
9331 "Delete the N next (mail) articles.
9332 This command actually deletes articles. This is not a marking
9333 command. The article will disappear forever from your life, never to
9336 If N is negative, delete backwards.
9337 If N is nil and articles have been marked with the process mark,
9338 delete these instead.
9340 If `gnus-novice-user' is non-nil you will be asked for
9341 confirmation before the articles are deleted."
9343 (unless (gnus-check-backend-function 'request-expire-articles
9344 gnus-newsgroup-name)
9345 (error "The current newsgroup does not support article deletion"))
9346 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9347 (error "Couldn't open server"))
9348 ;; Compute the list of articles to delete.
9349 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9350 (nnmail-expiry-target 'delete)
9352 (if (and gnus-novice-user
9353 (not (gnus-yes-or-no-p
9354 (format "Do you really want to delete %s forever? "
9355 (if (> (length articles) 1)
9356 (format "these %s articles" (length articles))
9359 ;; Delete the articles.
9360 (setq not-deleted (gnus-request-expire-articles
9361 articles gnus-newsgroup-name 'force))
9363 (gnus-summary-remove-process-mark (car articles))
9364 ;; The backend might not have been able to delete the article
9366 (unless (memq (car articles) not-deleted)
9367 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9368 (let* ((article (car articles))
9369 (id (mail-header-id (gnus-data-header
9370 (assoc article (gnus-data-list nil))))))
9371 (run-hook-with-args 'gnus-summary-article-delete-hook
9372 'delete id gnus-newsgroup-name nil
9374 (setq articles (cdr articles)))
9376 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9377 (gnus-summary-position-point)
9378 (gnus-set-mode-line 'summary)
9381 (defun gnus-summary-edit-article (&optional arg)
9382 "Edit the current article.
9383 This will have permanent effect only in mail groups.
9384 If ARG is nil, edit the decoded articles.
9385 If ARG is 1, edit the raw articles.
9386 If ARG is 2, edit the raw articles even in read-only groups.
9387 If ARG is 3, edit the articles with the current handles.
9388 Otherwise, allow editing of articles even in read-only
9391 (let (force raw current-handles)
9400 (setq current-handles
9401 (and (gnus-buffer-live-p gnus-article-buffer)
9402 (with-current-buffer gnus-article-buffer
9404 gnus-article-mime-handles
9405 (setq gnus-article-mime-handles nil))))))
9408 (when (and raw (not force)
9409 (member gnus-newsgroup-name '("nndraft:delayed"
9412 (error "Can't edit the raw article in group %s"
9413 gnus-newsgroup-name))
9415 (set-buffer gnus-summary-buffer)
9416 (let ((mail-parse-charset gnus-newsgroup-charset)
9417 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9418 (gnus-set-global-variables)
9419 (when (and (not force)
9420 (gnus-group-read-only-p))
9421 (error "The current newsgroup does not support article editing"))
9422 (gnus-summary-show-article t)
9423 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9424 (with-current-buffer gnus-article-buffer
9425 (mm-enable-multibyte)))
9426 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9428 (gnus-article-edit-article
9431 (let ((mbl mml-buffer-list))
9432 (setq mml-buffer-list nil)
9433 (mime-to-mml ,'current-handles)
9434 (let ((mbl1 mml-buffer-list))
9435 (setq mml-buffer-list mbl)
9436 (set (make-local-variable 'mml-buffer-list) mbl1))
9437 (gnus-make-local-hook 'kill-buffer-hook)
9438 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9439 `(lambda (no-highlight)
9440 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9441 (message-options message-options)
9442 (message-options-set-recipient)
9443 (mail-parse-ignored-charsets
9444 ',gnus-newsgroup-ignored-charsets))
9445 ,(if (not raw) '(progn
9447 (mml-destroy-buffers)
9448 (remove-hook 'kill-buffer-hook
9449 'mml-destroy-buffers t)
9450 (kill-local-variable 'mml-buffer-list)))
9451 (gnus-summary-edit-article-done
9452 ,(or (mail-header-references gnus-current-headers) "")
9453 ,(gnus-group-read-only-p)
9454 ,gnus-summary-buffer no-highlight))))))))
9456 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9458 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9460 "Make edits to the current article permanent."
9463 ;; The buffer restriction contains the entire article if it exists.
9464 (when (article-goto-body)
9465 (let ((lines (count-lines (point) (point-max)))
9466 (length (- (point-max) (point)))
9467 (case-fold-search t)
9468 (body (copy-marker (point))))
9469 (goto-char (point-min))
9470 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9471 (delete-region (match-beginning 1) (match-end 1))
9472 (insert (number-to-string length)))
9473 (goto-char (point-min))
9474 (when (re-search-forward
9475 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9476 (delete-region (match-beginning 1) (match-end 1))
9477 (insert (number-to-string length)))
9478 (goto-char (point-min))
9479 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9480 (delete-region (match-beginning 1) (match-end 1))
9481 (insert (number-to-string lines))))))
9482 ;; Replace the article.
9483 (let ((buf (current-buffer)))
9485 (insert-buffer-substring buf)
9487 (if (and (not read-only)
9488 (not (gnus-request-replace-article
9489 (cdr gnus-article-current) (car gnus-article-current)
9490 (current-buffer) t)))
9491 (error "Couldn't replace article")
9492 ;; Update the summary buffer.
9494 (equal (message-tokenize-header references " ")
9495 (message-tokenize-header
9496 (or (message-fetch-field "references") "") " ")))
9497 ;; We only have to update this line.
9500 (message-narrow-to-head)
9501 (let ((head (buffer-string))
9504 (insert (format "211 %d Article retrieved.\n"
9505 (cdr gnus-article-current)))
9508 (let ((nntp-server-buffer (current-buffer)))
9509 (setq header (car (gnus-get-newsgroup-headers
9512 (set-buffer gnus-summary-buffer)
9513 (gnus-data-set-header
9514 (gnus-data-find (cdr gnus-article-current))
9516 (gnus-summary-update-article-line
9517 (cdr gnus-article-current) header)
9518 (if (gnus-summary-goto-subject
9519 (cdr gnus-article-current) nil t)
9520 (gnus-summary-update-secondary-mark
9521 (cdr gnus-article-current))))))))
9523 (set-buffer (or buffer gnus-summary-buffer))
9524 (gnus-summary-update-article (cdr gnus-article-current))
9525 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9526 (gnus-summary-update-secondary-mark
9527 (cdr gnus-article-current))))
9528 ;; Prettify the article buffer again.
9529 (unless no-highlight
9531 (set-buffer gnus-article-buffer)
9532 ;;;!!! Fix this -- article should be rehighlighted.
9533 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9534 (set-buffer gnus-original-article-buffer)
9535 (gnus-request-article
9536 (cdr gnus-article-current)
9537 (car gnus-article-current) (current-buffer))))
9538 ;; Prettify the summary buffer line.
9539 (when (gnus-visual-p 'summary-highlight 'highlight)
9540 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9542 (defun gnus-summary-edit-wash (key)
9543 "Perform editing command KEY in the article buffer."
9547 (message "%s" (concat (this-command-keys) "- "))
9550 (gnus-summary-edit-article)
9551 (execute-kbd-macro (concat (this-command-keys) key))
9552 (gnus-article-edit-done))
9556 (defun gnus-summary-respool-query (&optional silent trace)
9557 "Query where the respool algorithm would put this article."
9559 (let (gnus-mark-article-hook)
9560 (gnus-summary-select-article)
9562 (set-buffer gnus-original-article-buffer)
9563 (let ((groups (nnmail-article-group 'identity trace)))
9566 (message "This message would go to %s"
9567 (mapconcat 'car groups ", "))
9568 (message "This message would go to no groups"))
9571 (defun gnus-summary-respool-trace ()
9572 "Trace where the respool algorithm would put this article.
9573 Display a buffer showing all fancy splitting patterns which matched."
9575 (gnus-summary-respool-query nil t))
9577 ;; Summary marking commands.
9579 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9580 "Mark articles which has the same subject as read, and then select the next.
9581 If UNMARK is positive, remove any kind of mark.
9582 If UNMARK is negative, tick articles."
9585 (setq unmark (prefix-numeric-value unmark)))
9587 (gnus-summary-mark-same-subject
9588 (gnus-summary-article-subject) unmark)))
9589 ;; Select next unread article. If auto-select-same mode, should
9590 ;; select the first unread article.
9591 (gnus-summary-next-article t (and gnus-auto-select-same
9592 (gnus-summary-article-subject)))
9593 (gnus-message 7 "%d article%s marked as %s"
9594 count (if (= count 1) " is" "s are")
9595 (if unmark "unread" "read"))))
9597 (defun gnus-summary-kill-same-subject (&optional unmark)
9598 "Mark articles which has the same subject as read.
9599 If UNMARK is positive, remove any kind of mark.
9600 If UNMARK is negative, tick articles."
9603 (setq unmark (prefix-numeric-value unmark)))
9605 (gnus-summary-mark-same-subject
9606 (gnus-summary-article-subject) unmark)))
9607 ;; If marked as read, go to next unread subject.
9609 ;; Go to next unread subject.
9610 (gnus-summary-next-subject 1 t))
9611 (gnus-message 7 "%d articles are marked as %s"
9612 count (if unmark "unread" "read"))))
9614 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9615 "Mark articles with same SUBJECT as read, and return marked number.
9616 If optional argument UNMARK is positive, remove any kinds of marks.
9617 If optional argument UNMARK is negative, mark articles as unread instead."
9621 ((null unmark) ; Mark as read.
9624 (gnus-summary-mark-article-as-read gnus-killed-mark)
9625 (gnus-summary-show-thread) t)
9626 (gnus-summary-find-subject subject))
9627 (setq count (1+ count))))
9628 ((> unmark 0) ; Tick.
9631 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9632 (gnus-summary-show-thread) t)
9633 (gnus-summary-find-subject subject))
9634 (setq count (1+ count))))
9635 (t ; Mark as unread.
9638 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9639 (gnus-summary-show-thread) t)
9640 (gnus-summary-find-subject subject))
9641 (setq count (1+ count)))))
9642 (gnus-set-mode-line 'summary)
9643 ;; Return the number of marked articles.
9646 (defun gnus-summary-mark-as-processable (n &optional unmark)
9647 "Set the process mark on the next N articles.
9648 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9649 the process mark instead. The difference between N and the actual
9650 number of articles marked is returned."
9652 (if (and (null n) (gnus-region-active-p))
9653 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9654 (setq n (prefix-numeric-value n))
9655 (let ((backward (< n 0))
9660 (gnus-summary-remove-process-mark
9661 (gnus-summary-article-number))
9662 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9663 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9666 (gnus-message 7 "No more articles"))
9667 (gnus-summary-recenter)
9668 (gnus-summary-position-point)
9671 (defun gnus-summary-unmark-as-processable (n)
9672 "Remove the process mark from the next N articles.
9673 If N is negative, unmark backward instead. The difference between N and
9674 the actual number of articles unmarked is returned."
9676 (gnus-summary-mark-as-processable n t))
9678 (defun gnus-summary-unmark-all-processable ()
9679 "Remove the process mark from all articles."
9682 (while gnus-newsgroup-processable
9683 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9684 (gnus-summary-position-point))
9686 (defun gnus-summary-add-mark (article type)
9687 "Mark ARTICLE with a mark of TYPE."
9688 (let ((vtype (car (assq type gnus-article-mark-lists)))
9691 (error "No such mark type: %s" type)
9692 (setq var (intern (format "gnus-newsgroup-%s" type)))
9693 (set var (cons article (symbol-value var)))
9694 (if (memq type '(processable cached replied forwarded recent saved))
9695 (gnus-summary-update-secondary-mark article)
9696 ;;; !!! This is bogus. We should find out what primary
9697 ;;; !!! mark we want to set.
9698 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9700 (defun gnus-summary-mark-as-expirable (n)
9701 "Mark N articles forward as expirable.
9702 If N is negative, mark backward instead. The difference between N and
9703 the actual number of articles marked is returned."
9705 (gnus-summary-mark-forward n gnus-expirable-mark))
9707 (defun gnus-summary-mark-as-spam (n)
9708 "Mark N articles forward as spam.
9709 If N is negative, mark backward instead. The difference between N and
9710 the actual number of articles marked is returned."
9712 (gnus-summary-mark-forward n gnus-spam-mark))
9714 (defun gnus-summary-mark-article-as-replied (article)
9715 "Mark ARTICLE as replied to and update the summary line.
9716 ARTICLE can also be a list of articles."
9717 (interactive (list (gnus-summary-article-number)))
9718 (let ((articles (if (listp article) article (list article))))
9719 (dolist (article articles)
9720 (unless (numberp article)
9721 (error "%s is not a number" article))
9722 (push article gnus-newsgroup-replied)
9723 (let ((buffer-read-only nil))
9724 (when (gnus-summary-goto-subject article nil t)
9725 (gnus-summary-update-secondary-mark article))))))
9727 (defun gnus-summary-mark-article-as-forwarded (article)
9728 "Mark ARTICLE as forwarded and update the summary line.
9729 ARTICLE can also be a list of articles."
9730 (let ((articles (if (listp article) article (list article))))
9731 (dolist (article articles)
9732 (push article gnus-newsgroup-forwarded)
9733 (let ((buffer-read-only nil))
9734 (when (gnus-summary-goto-subject article nil t)
9735 (gnus-summary-update-secondary-mark article))))))
9737 (defun gnus-summary-set-bookmark (article)
9738 "Set a bookmark in current article."
9739 (interactive (list (gnus-summary-article-number)))
9740 (when (or (not (get-buffer gnus-article-buffer))
9741 (not gnus-current-article)
9742 (not gnus-article-current)
9743 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9744 (error "No current article selected"))
9745 ;; Remove old bookmark, if one exists.
9746 (gnus-pull article gnus-newsgroup-bookmarks)
9747 ;; Set the new bookmark, which is on the form
9748 ;; (article-number . line-number-in-body).
9752 (set-buffer gnus-article-buffer)
9759 gnus-newsgroup-bookmarks)
9760 (gnus-message 6 "A bookmark has been added to the current article."))
9762 (defun gnus-summary-remove-bookmark (article)
9763 "Remove the bookmark from the current article."
9764 (interactive (list (gnus-summary-article-number)))
9765 ;; Remove old bookmark, if one exists.
9766 (if (not (assq article gnus-newsgroup-bookmarks))
9767 (gnus-message 6 "No bookmark in current article.")
9768 (gnus-pull article gnus-newsgroup-bookmarks)
9769 (gnus-message 6 "Removed bookmark.")))
9771 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9772 (defun gnus-summary-mark-as-dormant (n)
9773 "Mark N articles forward as dormant.
9774 If N is negative, mark backward instead. The difference between N and
9775 the actual number of articles marked is returned."
9777 (gnus-summary-mark-forward n gnus-dormant-mark))
9779 (defun gnus-summary-set-process-mark (article)
9780 "Set the process mark on ARTICLE and update the summary line."
9781 (setq gnus-newsgroup-processable
9783 (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-remove-process-mark (article)
9790 "Remove the process mark from ARTICLE and update the summary line."
9791 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9792 (when (gnus-summary-goto-subject article)
9793 (gnus-summary-show-thread)
9794 (gnus-summary-goto-subject article)
9795 (gnus-summary-update-secondary-mark article)))
9797 (defun gnus-summary-set-saved-mark (article)
9798 "Set the process mark on ARTICLE and update the summary line."
9799 (push article gnus-newsgroup-saved)
9800 (when (gnus-summary-goto-subject article)
9801 (gnus-summary-update-secondary-mark article)))
9803 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9804 "Mark N articles as read forwards.
9805 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9806 The difference between N and the actual number of articles marked is
9808 If NO-EXPIRE, auto-expiry will be inhibited."
9810 (gnus-summary-show-thread)
9811 (let ((backward (< n 0))
9812 (gnus-summary-goto-unread
9813 (and gnus-summary-goto-unread
9814 (not (eq gnus-summary-goto-unread 'never))
9815 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9816 gnus-ticked-mark gnus-dormant-mark)))))
9818 (mark (or mark gnus-del-mark)))
9820 (gnus-summary-mark-article nil mark no-expire)
9821 (zerop (gnus-summary-next-subject
9823 (and gnus-summary-goto-unread
9824 (not (eq gnus-summary-goto-unread 'never)))
9828 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9829 (gnus-summary-recenter)
9830 (gnus-summary-position-point)
9831 (gnus-set-mode-line 'summary)
9834 (defun gnus-summary-mark-article-as-read (mark)
9835 "Mark the current article quickly as read with MARK."
9836 (let ((article (gnus-summary-article-number)))
9837 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9838 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9839 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9840 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9841 (push (cons article mark) gnus-newsgroup-reads)
9842 ;; Possibly remove from cache, if that is used.
9843 (when gnus-use-cache
9844 (gnus-cache-enter-remove-article article))
9845 ;; Allow the backend to change the mark.
9846 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9847 ;; Check for auto-expiry.
9848 (when (and gnus-newsgroup-auto-expire
9849 (memq mark gnus-auto-expirable-marks))
9850 (setq mark gnus-expirable-mark)
9851 ;; Let the backend know about the mark change.
9852 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9853 (push article gnus-newsgroup-expirable))
9854 ;; Set the mark in the buffer.
9855 (gnus-summary-update-mark mark 'unread)
9858 (defun gnus-summary-mark-article-as-unread (mark)
9859 "Mark the current article quickly as unread with MARK."
9860 (let* ((article (gnus-summary-article-number))
9861 (old-mark (gnus-summary-article-mark article)))
9862 ;; Allow the backend to change the mark.
9863 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9864 (if (eq mark old-mark)
9868 (gnus-error 1 "Can't mark negative article numbers")
9870 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9871 (setq gnus-newsgroup-spam-marked
9872 (delq article gnus-newsgroup-spam-marked))
9873 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9874 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9875 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9876 (cond ((= mark gnus-ticked-mark)
9877 (setq gnus-newsgroup-marked
9878 (gnus-add-to-sorted-list gnus-newsgroup-marked
9880 ((= mark gnus-spam-mark)
9881 (setq gnus-newsgroup-spam-marked
9882 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9884 ((= mark gnus-dormant-mark)
9885 (setq gnus-newsgroup-dormant
9886 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9889 (setq gnus-newsgroup-unreads
9890 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9892 (gnus-pull article gnus-newsgroup-reads)
9894 ;; See whether the article is to be put in the cache.
9896 (vectorp (gnus-summary-article-header article))
9898 (gnus-cache-possibly-enter-article
9899 gnus-newsgroup-name article
9900 (= mark gnus-ticked-mark)
9901 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9904 (gnus-summary-update-mark mark 'unread)
9907 (defun gnus-summary-mark-article (&optional article mark no-expire)
9908 "Mark ARTICLE with MARK. MARK can be any character.
9909 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9910 `??' (dormant) and `?E' (expirable).
9911 If MARK is nil, then the default character `?r' is used.
9912 If ARTICLE is nil, then the article on the current line will be
9914 If NO-EXPIRE, auto-expiry will be inhibited."
9915 ;; The mark might be a string.
9916 (when (stringp mark)
9917 (setq mark (aref mark 0)))
9918 ;; If no mark is given, then we check auto-expiring.
9920 (setq mark gnus-del-mark))
9921 (when (and (not no-expire)
9922 gnus-newsgroup-auto-expire
9923 (memq mark gnus-auto-expirable-marks))
9924 (setq mark gnus-expirable-mark))
9925 (let ((article (or article (gnus-summary-article-number)))
9926 (old-mark (gnus-summary-article-mark article)))
9927 ;; Allow the backend to change the mark.
9928 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9929 (if (eq mark old-mark)
9932 (error "No article on current line"))
9933 (if (not (if (or (= mark gnus-unread-mark)
9934 (= mark gnus-ticked-mark)
9935 (= mark gnus-spam-mark)
9936 (= mark gnus-dormant-mark))
9937 (gnus-mark-article-as-unread article mark)
9938 (gnus-mark-article-as-read article mark)))
9940 ;; See whether the article is to be put in the cache.
9942 (not (= mark gnus-canceled-mark))
9943 (vectorp (gnus-summary-article-header article))
9945 (gnus-cache-possibly-enter-article
9946 gnus-newsgroup-name article
9947 (= mark gnus-ticked-mark)
9948 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9950 (when (gnus-summary-goto-subject article nil t)
9951 (let ((buffer-read-only nil))
9952 (gnus-summary-show-thread)
9954 (gnus-summary-update-mark mark 'unread)
9957 (defun gnus-summary-update-secondary-mark (article)
9958 "Update the secondary (read, process, cache) mark."
9959 (gnus-summary-update-mark
9960 (cond ((memq article gnus-newsgroup-processable)
9962 ((memq article gnus-newsgroup-cached)
9964 ((memq article gnus-newsgroup-replied)
9966 ((memq article gnus-newsgroup-forwarded)
9967 gnus-forwarded-mark)
9968 ((memq article gnus-newsgroup-saved)
9970 ((memq article gnus-newsgroup-recent)
9972 ((memq article gnus-newsgroup-unseen)
9976 (when (gnus-visual-p 'summary-highlight 'highlight)
9977 (gnus-run-hooks 'gnus-summary-update-hook))
9980 (defun gnus-summary-update-download-mark (article)
9981 "Update the download mark."
9982 (gnus-summary-update-mark
9983 (cond ((memq article gnus-newsgroup-undownloaded)
9984 gnus-undownloaded-mark)
9985 (gnus-newsgroup-agentized
9986 gnus-downloaded-mark)
9990 (gnus-summary-update-line t)
9993 (defun gnus-summary-update-mark (mark type)
9994 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9995 (buffer-read-only nil))
9996 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
9998 (when (looking-at "\r")
10000 (when (<= (+ forward (point)) (point-max))
10001 ;; Go to the right position on the line.
10002 (goto-char (+ forward (point)))
10003 ;; Replace the old mark with the new mark.
10004 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10005 ;; Optionally update the marks by some user rule.
10006 (when (eq type 'unread)
10007 (gnus-data-set-mark
10008 (gnus-data-find (gnus-summary-article-number)) mark)
10009 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10011 (defun gnus-mark-article-as-read (article &optional mark)
10012 "Enter ARTICLE in the pertinent lists and remove it from others."
10013 ;; Make the article expirable.
10014 (let ((mark (or mark gnus-del-mark)))
10015 (setq gnus-newsgroup-expirable
10016 (if (= mark gnus-expirable-mark)
10017 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10018 (delq article gnus-newsgroup-expirable)))
10019 ;; Remove from unread and marked lists.
10020 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10021 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10022 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10023 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10024 (push (cons article mark) gnus-newsgroup-reads)
10025 ;; Possibly remove from cache, if that is used.
10026 (when gnus-use-cache
10027 (gnus-cache-enter-remove-article article))
10030 (defun gnus-mark-article-as-unread (article &optional mark)
10031 "Enter ARTICLE in the pertinent lists and remove it from others."
10032 (let ((mark (or mark gnus-ticked-mark)))
10035 (gnus-error 1 "Can't mark negative article numbers")
10037 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10038 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10039 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10040 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10041 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10043 ;; Unsuppress duplicates?
10044 (when gnus-suppress-duplicates
10045 (gnus-dup-unsuppress-article article))
10047 (cond ((= mark gnus-ticked-mark)
10048 (setq gnus-newsgroup-marked
10049 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10050 ((= mark gnus-spam-mark)
10051 (setq gnus-newsgroup-spam-marked
10052 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10054 ((= mark gnus-dormant-mark)
10055 (setq gnus-newsgroup-dormant
10056 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10058 (setq gnus-newsgroup-unreads
10059 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10060 (gnus-pull article gnus-newsgroup-reads)
10063 (defalias 'gnus-summary-mark-as-unread-forward
10064 'gnus-summary-tick-article-forward)
10065 (make-obsolete 'gnus-summary-mark-as-unread-forward
10066 'gnus-summary-tick-article-forward)
10067 (defun gnus-summary-tick-article-forward (n)
10068 "Tick N articles forwards.
10069 If N is negative, tick backwards instead.
10070 The difference between N and the number of articles ticked is returned."
10072 (gnus-summary-mark-forward n gnus-ticked-mark))
10074 (defalias 'gnus-summary-mark-as-unread-backward
10075 'gnus-summary-tick-article-backward)
10076 (make-obsolete 'gnus-summary-mark-as-unread-backward
10077 'gnus-summary-tick-article-backward)
10078 (defun gnus-summary-tick-article-backward (n)
10079 "Tick N articles backwards.
10080 The difference between N and the number of articles ticked is returned."
10082 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10084 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10085 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10086 (defun gnus-summary-tick-article (&optional article clear-mark)
10087 "Mark current article as unread.
10088 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10089 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10091 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10092 gnus-ticked-mark)))
10094 (defun gnus-summary-mark-as-read-forward (n)
10095 "Mark N articles as read forwards.
10096 If N is negative, mark backwards instead.
10097 The difference between N and the actual number of articles marked is
10100 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10102 (defun gnus-summary-mark-as-read-backward (n)
10103 "Mark the N articles as read backwards.
10104 The difference between N and the actual number of articles marked is
10107 (gnus-summary-mark-forward
10108 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10110 (defun gnus-summary-mark-as-read (&optional article mark)
10111 "Mark current article as read.
10112 ARTICLE specifies the article to be marked as read.
10113 MARK specifies a string to be inserted at the beginning of the line."
10114 (gnus-summary-mark-article article mark))
10116 (defun gnus-summary-clear-mark-forward (n)
10117 "Clear marks from N articles forward.
10118 If N is negative, clear backward instead.
10119 The difference between N and the number of marks cleared is returned."
10121 (gnus-summary-mark-forward n gnus-unread-mark))
10123 (defun gnus-summary-clear-mark-backward (n)
10124 "Clear marks from N articles backward.
10125 The difference between N and the number of marks cleared is returned."
10127 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10129 (defun gnus-summary-mark-unread-as-read ()
10130 "Intended to be used by `gnus-summary-mark-article-hook'."
10131 (when (memq gnus-current-article gnus-newsgroup-unreads)
10132 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10134 (defun gnus-summary-mark-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-current-article
10140 (or new-mark gnus-read-mark)))))
10142 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10143 "Intended to be used by `gnus-summary-mark-article-hook'."
10144 (let ((mark (gnus-summary-article-mark)))
10145 (when (or (gnus-unread-mark-p mark)
10146 (gnus-read-mark-p mark))
10147 (gnus-summary-mark-article (gnus-summary-article-number)
10148 (or new-mark gnus-read-mark)))))
10150 (defun gnus-summary-mark-unread-as-ticked ()
10151 "Intended to be used by `gnus-summary-mark-article-hook'."
10152 (when (memq gnus-current-article gnus-newsgroup-unreads)
10153 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10155 (defun gnus-summary-mark-region-as-read (point mark all)
10156 "Mark all unread articles between point and mark as read.
10157 If given a prefix, mark all articles between point and mark as read,
10158 even ticked and dormant ones."
10159 (interactive "r\nP")
10163 (beginning-of-line)
10168 (memq (setq article (gnus-summary-article-number))
10169 gnus-newsgroup-unreads))
10170 (gnus-summary-mark-article article gnus-del-mark))
10172 (gnus-summary-find-next))))))
10174 (defun gnus-summary-mark-below (score mark)
10175 "Mark articles with score less than SCORE with MARK."
10176 (interactive "P\ncMark: ")
10177 (setq score (if score
10178 (prefix-numeric-value score)
10179 (or gnus-summary-default-score 0)))
10181 (set-buffer gnus-summary-buffer)
10182 (goto-char (point-min))
10185 (and (< (gnus-summary-article-score) score)
10186 (gnus-summary-mark-article nil mark))
10187 (gnus-summary-find-next)))))
10189 (defun gnus-summary-kill-below (&optional score)
10190 "Mark articles with score below SCORE as read."
10192 (gnus-summary-mark-below score gnus-killed-mark))
10194 (defun gnus-summary-clear-above (&optional score)
10195 "Clear all marks from articles with score above SCORE."
10197 (gnus-summary-mark-above score gnus-unread-mark))
10199 (defun gnus-summary-tick-above (&optional score)
10200 "Tick all articles with score above SCORE."
10202 (gnus-summary-mark-above score gnus-ticked-mark))
10204 (defun gnus-summary-mark-above (score mark)
10205 "Mark articles with score over SCORE with MARK."
10206 (interactive "P\ncMark: ")
10207 (setq score (if score
10208 (prefix-numeric-value score)
10209 (or gnus-summary-default-score 0)))
10211 (set-buffer gnus-summary-buffer)
10212 (goto-char (point-min))
10214 (when (> (gnus-summary-article-score) score)
10215 (gnus-summary-mark-article nil mark))
10217 (gnus-summary-find-next)))))
10219 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10220 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10221 (defun gnus-summary-limit-include-expunged (&optional no-error)
10222 "Display all the hidden articles that were expunged for low scores."
10224 (let ((buffer-read-only nil))
10225 (let ((scored gnus-newsgroup-scored)
10228 (unless (gnus-summary-article-header (caar scored))
10229 (and (setq h (gnus-number-to-header (caar scored)))
10230 (< (cdar scored) gnus-summary-expunge-below)
10232 (setq scored (cdr scored)))
10234 (when (not no-error)
10235 (error "No expunged articles hidden"))
10236 (goto-char (point-min))
10237 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10238 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10239 (mapcar (lambda (x) (push (mail-header-number x)
10240 gnus-newsgroup-limit))
10242 (gnus-summary-prepare-unthreaded (nreverse headers))
10243 (goto-char (point-min))
10244 (gnus-summary-position-point)
10247 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10248 "Mark all unread articles in this newsgroup as read.
10249 If prefix argument ALL is non-nil, ticked and dormant articles will
10250 also be marked as read.
10251 If QUIETLY is non-nil, no questions will be asked.
10253 If TO-HERE is non-nil, it should be a point in the buffer. All
10254 articles before (after, if REVERSE is set) this point will be marked
10257 Note that this function will only catch up the unread article
10258 in the current summary buffer limitation.
10260 The number of articles marked as read is returned."
10265 (not gnus-interactive-catchup) ;Without confirmation?
10269 "Mark absolutely all articles as read? "
10270 "Mark all unread articles as read? ")))
10272 (not gnus-newsgroup-adaptive)
10273 (not gnus-newsgroup-auto-expire)
10274 (not gnus-suppress-duplicates)
10275 (or (not gnus-use-cache)
10276 (eq gnus-use-cache 'passive)))
10279 (setq gnus-newsgroup-marked nil
10280 gnus-newsgroup-spam-marked nil
10281 gnus-newsgroup-dormant nil))
10282 (setq gnus-newsgroup-unreads
10283 (gnus-sorted-nunion
10284 (gnus-intersection gnus-newsgroup-unreads
10285 gnus-newsgroup-downloadable)
10286 gnus-newsgroup-unfetched)))
10287 ;; We actually mark all articles as canceled, which we
10288 ;; have to do when using auto-expiry or adaptive scoring.
10289 (gnus-summary-show-all-threads)
10290 (if (and to-here reverse)
10292 (goto-char to-here)
10293 (gnus-summary-mark-current-read-and-unread-as-read
10295 (while (gnus-summary-find-next (not all))
10296 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10297 (when (gnus-summary-first-subject (not all))
10299 (if to-here (< (point) to-here) t)
10300 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10301 (gnus-summary-find-next (not all))))))
10302 (gnus-set-mode-line 'summary))
10304 (gnus-summary-position-point)))
10306 (defun gnus-summary-catchup-to-here (&optional all)
10307 "Mark all unticked articles before the current one as read.
10308 If ALL is non-nil, also mark ticked and dormant articles as read."
10311 (gnus-save-hidden-threads
10312 (let ((beg (point)))
10313 ;; We check that there are unread articles.
10314 (when (or all (gnus-summary-find-prev))
10315 (gnus-summary-catchup all t beg)))))
10316 (gnus-summary-position-point))
10318 (defun gnus-summary-catchup-from-here (&optional all)
10319 "Mark all unticked articles after (and including) the current one as read.
10320 If ALL is non-nil, also mark ticked and dormant articles as read."
10323 (gnus-save-hidden-threads
10324 (let ((beg (point)))
10325 ;; We check that there are unread articles.
10326 (when (or all (gnus-summary-find-next))
10327 (gnus-summary-catchup all t beg nil t)))))
10328 (gnus-summary-position-point))
10330 (defun gnus-summary-catchup-all (&optional quietly)
10331 "Mark all articles in this newsgroup as read.
10332 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10333 instead, which marks only unread articles as read."
10335 (gnus-summary-catchup t quietly))
10337 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10338 "Mark all unread articles in this group as read, then exit.
10339 If prefix argument ALL is non-nil, all articles are marked as read.
10340 If QUIETLY is non-nil, no questions will be asked."
10342 (when (gnus-summary-catchup all quietly nil 'fast)
10343 ;; Select next newsgroup or exit.
10344 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10345 (eq gnus-auto-select-next 'quietly))
10346 (gnus-summary-next-group nil)
10347 (gnus-summary-exit))))
10349 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10350 "Mark all articles in this newsgroup as read, and then exit.
10351 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10352 instead, which marks only unread articles as read."
10354 (gnus-summary-catchup-and-exit t quietly))
10356 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10357 "Mark all articles in this group as read and select the next group.
10358 If given a prefix, mark all articles, unread as well as ticked, as
10362 (gnus-summary-catchup all))
10363 (gnus-summary-next-group))
10369 (defmacro gnus-with-article (article &rest forms)
10370 "Select ARTICLE and perform FORMS in the original article buffer.
10371 Then replace the article with the result."
10373 ;; We don't want the article to be marked as read.
10374 (let (gnus-mark-article-hook)
10375 (gnus-summary-select-article t t nil ,article))
10376 (set-buffer gnus-original-article-buffer)
10378 (if (not (gnus-check-backend-function
10379 'request-replace-article (car gnus-article-current)))
10380 (gnus-message 5 "Read-only group; not replacing")
10381 (unless (gnus-request-replace-article
10382 ,article (car gnus-article-current)
10383 (current-buffer) t)
10384 (error "Couldn't replace article")))
10385 ;; The cache and backlog have to be flushed somewhat.
10386 (when gnus-keep-backlog
10387 (gnus-backlog-remove-article
10388 (car gnus-article-current) (cdr gnus-article-current)))
10389 (when gnus-use-cache
10390 (gnus-cache-update-article
10391 (car gnus-article-current) (cdr gnus-article-current)))))
10393 (put 'gnus-with-article 'lisp-indent-function 1)
10394 (put 'gnus-with-article 'edebug-form-spec '(form body))
10396 ;; Thread-based commands.
10398 (defun gnus-summary-articles-in-thread (&optional article)
10399 "Return a list of all articles in the current thread.
10400 If ARTICLE is non-nil, return all articles in the thread that starts
10401 with that article."
10402 (let* ((article (or article (gnus-summary-article-number)))
10403 (data (gnus-data-find-list article))
10404 (top-level (gnus-data-level (car data)))
10406 (cond ((null gnus-thread-operation-ignore-subject)
10407 (gnus-simplify-subject-re
10408 (mail-header-subject (gnus-data-header (car data)))))
10409 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10410 (gnus-simplify-subject-fuzzy
10411 (mail-header-subject (gnus-data-header (car data)))))
10413 (end-point (save-excursion
10414 (if (gnus-summary-go-to-next-thread)
10415 (point) (point-max))))
10418 (< (gnus-data-pos (car data)) end-point))
10419 (when (or (not top-subject)
10420 (string= top-subject
10421 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10422 (gnus-simplify-subject-fuzzy
10423 (mail-header-subject
10424 (gnus-data-header (car data))))
10425 (gnus-simplify-subject-re
10426 (mail-header-subject
10427 (gnus-data-header (car data)))))))
10428 (push (gnus-data-number (car data)) articles))
10429 (unless (and (setq data (cdr data))
10430 (> (gnus-data-level (car data)) top-level))
10432 ;; Return the list of articles.
10433 (nreverse articles)))
10435 (defun gnus-summary-rethread-current ()
10436 "Rethread the thread the current article is part of."
10438 (let* ((gnus-show-threads t)
10439 (article (gnus-summary-article-number))
10440 (id (mail-header-id (gnus-summary-article-header)))
10441 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10443 (error "No article on the current line"))
10444 (gnus-rebuild-thread id)
10445 (gnus-summary-goto-subject article)))
10447 (defun gnus-summary-reparent-thread ()
10448 "Make the current article child of the marked (or previous) article.
10450 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10451 is non-nil or the Subject: of both articles are the same."
10453 (unless (not (gnus-group-read-only-p))
10454 (error "The current newsgroup does not support article editing"))
10455 (unless (<= (length gnus-newsgroup-processable) 1)
10456 (error "No more than one article may be marked"))
10457 (save-window-excursion
10458 (let ((gnus-article-buffer " *reparent*")
10459 (current-article (gnus-summary-article-number))
10460 ;; First grab the marked article, otherwise one line up.
10461 (parent-article (if (not (null gnus-newsgroup-processable))
10462 (car gnus-newsgroup-processable)
10464 (if (eq (forward-line -1) 0)
10465 (gnus-summary-article-number)
10466 (error "Beginning of summary buffer"))))))
10467 (unless (not (eq current-article parent-article))
10468 (error "An article may not be self-referential"))
10469 (let ((message-id (mail-header-id
10470 (gnus-summary-article-header parent-article))))
10471 (unless (and message-id (not (equal message-id "")))
10472 (error "No message-id in desired parent"))
10473 (gnus-with-article current-article
10475 (goto-char (point-min))
10476 (message-narrow-to-head)
10477 (if (re-search-forward "^References: " nil t)
10479 (re-search-forward "^[^ \t]" nil t)
10482 (insert " " message-id))
10483 (insert "References: " message-id "\n"))))
10484 (set-buffer gnus-summary-buffer)
10485 (gnus-summary-unmark-all-processable)
10486 (gnus-summary-update-article current-article)
10487 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10488 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10489 (gnus-summary-rethread-current)
10490 (gnus-message 3 "Article %d is now the child of article %d"
10491 current-article parent-article)))))
10493 (defun gnus-summary-toggle-threads (&optional arg)
10494 "Toggle showing conversation threads.
10495 If ARG is positive number, turn showing conversation threads on."
10497 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10498 (setq gnus-show-threads
10499 (if (null arg) (not gnus-show-threads)
10500 (> (prefix-numeric-value arg) 0)))
10501 (gnus-summary-prepare)
10502 (gnus-summary-goto-subject current)
10503 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10504 (gnus-summary-position-point)))
10506 (defun gnus-summary-show-all-threads ()
10507 "Show all threads."
10510 (let ((buffer-read-only nil))
10511 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10512 (gnus-summary-position-point))
10514 (defun gnus-summary-show-thread ()
10515 "Show thread subtrees.
10516 Returns nil if no thread was there to be shown."
10518 (let ((buffer-read-only nil)
10520 (end (point-at-eol))
10521 ;; Leave point at bol
10522 (beg (progn (beginning-of-line) (point))))
10524 ;; Any hidden lines here?
10525 (search-forward "\r" end t)
10526 (subst-char-in-region beg end ?\^M ?\n t)
10528 (gnus-summary-position-point))))
10530 (defun gnus-summary-maybe-hide-threads ()
10531 "If requested, hide the threads that should be hidden."
10532 (when (and gnus-show-threads
10533 gnus-thread-hide-subtree)
10534 (gnus-summary-hide-all-threads
10535 (if (or (consp gnus-thread-hide-subtree)
10536 (functionp gnus-thread-hide-subtree))
10537 (gnus-make-predicate gnus-thread-hide-subtree)
10540 ;;; Hiding predicates.
10542 (defun gnus-article-unread-p (header)
10543 (memq (mail-header-number header) gnus-newsgroup-unreads))
10545 (defun gnus-article-unseen-p (header)
10546 (memq (mail-header-number header) gnus-newsgroup-unseen))
10548 (defun gnus-map-articles (predicate articles)
10549 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10550 (apply 'gnus-or (mapcar predicate
10551 (mapcar 'gnus-summary-article-header articles))))
10553 (defun gnus-summary-hide-all-threads (&optional predicate)
10554 "Hide all thread subtrees.
10555 If PREDICATE is supplied, threads that satisfy this predicate
10556 will not be hidden."
10559 (goto-char (point-min))
10562 (when (or (not predicate)
10564 predicate (gnus-summary-article-children)))
10565 (gnus-summary-hide-thread))
10566 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10567 (gnus-summary-position-point))
10569 (defun gnus-summary-hide-thread ()
10570 "Hide thread subtrees.
10571 If PREDICATE is supplied, threads that satisfy this predicate
10572 will not be hidden.
10573 Returns nil if no threads were there to be hidden."
10575 (let ((buffer-read-only nil)
10577 (article (gnus-summary-article-number)))
10579 ;; Go forward until either the buffer ends or the subthread
10581 (when (and (not (eobp))
10582 (or (zerop (gnus-summary-next-thread 1 t))
10583 (goto-char (point-max))))
10585 (if (and (> (point) start)
10586 (search-backward "\n" start t))
10588 (subst-char-in-region start (point) ?\n ?\^M)
10589 (gnus-summary-goto-subject article))
10593 (defun gnus-summary-go-to-next-thread (&optional previous)
10594 "Go to the same level (or less) next thread.
10595 If PREVIOUS is non-nil, go to previous thread instead.
10596 Return the article number moved to, or nil if moving was impossible."
10597 (let ((level (gnus-summary-thread-level))
10598 (way (if previous -1 1))
10601 (while (and (not (eobp))
10602 (< level (gnus-summary-thread-level)))
10603 (forward-line way))
10610 (gnus-summary-article-number)
10611 (goto-char beg)))))
10613 (defun gnus-summary-next-thread (n &optional silent)
10614 "Go to the same level next N'th thread.
10615 If N is negative, search backward instead.
10616 Returns the difference between N and the number of skips actually
10619 If SILENT, don't output messages."
10621 (let ((backward (< n 0))
10623 (while (and (> n 0)
10624 (gnus-summary-go-to-next-thread backward))
10627 (gnus-summary-position-point))
10628 (when (and (not silent) (/= 0 n))
10629 (gnus-message 7 "No more threads"))
10632 (defun gnus-summary-prev-thread (n)
10633 "Go to the same level previous N'th thread.
10634 Returns the difference between N and the number of skips actually
10637 (gnus-summary-next-thread (- n)))
10639 (defun gnus-summary-go-down-thread ()
10640 "Go down one level in the current thread."
10641 (let ((children (gnus-summary-article-children)))
10643 (gnus-summary-goto-subject (car children)))))
10645 (defun gnus-summary-go-up-thread ()
10646 "Go up one level in the current thread."
10647 (let ((parent (gnus-summary-article-parent)))
10649 (gnus-summary-goto-subject parent))))
10651 (defun gnus-summary-down-thread (n)
10652 "Go down thread N steps.
10653 If N is negative, go up instead.
10654 Returns the difference between N and how many steps down that were
10659 (while (and (> n 0)
10660 (if up (gnus-summary-go-up-thread)
10661 (gnus-summary-go-down-thread)))
10663 (gnus-summary-position-point)
10665 (gnus-message 7 "Can't go further"))
10668 (defun gnus-summary-up-thread (n)
10669 "Go up thread N steps.
10670 If N is negative, go down instead.
10671 Returns the difference between N and how many steps down that were
10674 (gnus-summary-down-thread (- n)))
10676 (defun gnus-summary-top-thread ()
10677 "Go to the top of the thread."
10679 (while (gnus-summary-go-up-thread))
10680 (gnus-summary-article-number))
10682 (defun gnus-summary-kill-thread (&optional unmark)
10683 "Mark articles under current thread as read.
10684 If the prefix argument is positive, remove any kinds of marks.
10685 If the prefix argument is negative, tick articles instead."
10688 (setq unmark (prefix-numeric-value unmark)))
10689 (let ((articles (gnus-summary-articles-in-thread)))
10691 ;; Expand the thread.
10692 (gnus-summary-show-thread)
10693 ;; Mark all the articles.
10695 (gnus-summary-goto-subject (car articles))
10696 (cond ((null unmark)
10697 (gnus-summary-mark-article-as-read gnus-killed-mark))
10699 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10701 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10702 (setq articles (cdr articles))))
10703 ;; Hide killed subtrees.
10705 gnus-thread-hide-killed
10706 (gnus-summary-hide-thread))
10707 ;; If marked as read, go to next unread subject.
10708 (when (null unmark)
10709 ;; Go to next unread subject.
10710 (gnus-summary-next-subject 1 t)))
10711 (gnus-set-mode-line 'summary))
10713 ;; Summary sorting commands
10715 (defun gnus-summary-sort-by-number (&optional reverse)
10716 "Sort the summary buffer by article number.
10717 Argument REVERSE means reverse order."
10719 (gnus-summary-sort 'number reverse))
10721 (defun gnus-summary-sort-by-random (&optional reverse)
10722 "Randomize the order in the summary buffer.
10723 Argument REVERSE means to randomize in reverse order."
10725 (gnus-summary-sort 'random reverse))
10727 (defun gnus-summary-sort-by-author (&optional reverse)
10728 "Sort the summary buffer by author name alphabetically.
10729 If `case-fold-search' is non-nil, case of letters is ignored.
10730 Argument REVERSE means reverse order."
10732 (gnus-summary-sort 'author reverse))
10734 (defun gnus-summary-sort-by-subject (&optional reverse)
10735 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10736 If `case-fold-search' is non-nil, case of letters is ignored.
10737 Argument REVERSE means reverse order."
10739 (gnus-summary-sort 'subject reverse))
10741 (defun gnus-summary-sort-by-date (&optional reverse)
10742 "Sort the summary buffer by date.
10743 Argument REVERSE means reverse order."
10745 (gnus-summary-sort 'date reverse))
10747 (defun gnus-summary-sort-by-score (&optional reverse)
10748 "Sort the summary buffer by score.
10749 Argument REVERSE means reverse order."
10751 (gnus-summary-sort 'score reverse))
10753 (defun gnus-summary-sort-by-lines (&optional reverse)
10754 "Sort the summary buffer by the number of lines.
10755 Argument REVERSE means reverse order."
10757 (gnus-summary-sort 'lines reverse))
10759 (defun gnus-summary-sort-by-chars (&optional reverse)
10760 "Sort the summary buffer by article length.
10761 Argument REVERSE means reverse order."
10763 (gnus-summary-sort 'chars reverse))
10765 (defun gnus-summary-sort-by-original (&optional reverse)
10766 "Sort the summary buffer using the default sorting method.
10767 Argument REVERSE means reverse order."
10769 (let* ((buffer-read-only)
10770 (gnus-summary-prepare-hook nil))
10771 ;; We do the sorting by regenerating the threads.
10772 (gnus-summary-prepare)
10773 ;; Hide subthreads if needed.
10774 (gnus-summary-maybe-hide-threads)))
10776 (defun gnus-summary-sort (predicate reverse)
10777 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10778 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10779 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10780 (gnus-thread-sort-functions
10785 (gnus-sort-gathered-threads-function
10786 gnus-thread-sort-functions)
10787 (gnus-article-sort-functions
10791 (,article t2 t1))))
10793 (gnus-summary-prepare-hook nil))
10794 ;; We do the sorting by regenerating the threads.
10795 (gnus-summary-prepare)
10796 ;; Hide subthreads if needed.
10797 (gnus-summary-maybe-hide-threads)))
10799 ;; Summary saving commands.
10801 (defun gnus-summary-save-article (&optional n not-saved)
10802 "Save the current article using the default saver function.
10803 If N is a positive number, save the N next articles.
10804 If N is a negative number, save the N previous articles.
10805 If N is nil and any articles have been marked with the process mark,
10806 save those articles instead.
10807 The variable `gnus-default-article-saver' specifies the saver function."
10809 (let* ((articles (gnus-summary-work-articles n))
10810 (save-buffer (save-excursion
10811 (nnheader-set-temp-buffer " *Gnus Save*")))
10812 (num (length articles))
10814 (dolist (article articles)
10815 (setq header (gnus-summary-article-header article))
10816 (if (not (vectorp header))
10817 ;; This is a pseudo-article.
10818 (if (assq 'name header)
10819 (gnus-copy-file (cdr (assq 'name header)))
10820 (gnus-message 1 "Article %d is unsaveable" article))
10821 ;; This is a real article.
10822 (save-window-excursion
10823 (let ((gnus-display-mime-function nil)
10824 (gnus-article-prepare-hook nil))
10825 (gnus-summary-select-article t nil nil article)))
10827 (set-buffer save-buffer)
10829 (insert-buffer-substring gnus-original-article-buffer))
10830 (setq file (gnus-article-save save-buffer file num))
10831 (gnus-summary-remove-process-mark article)
10833 (gnus-summary-set-saved-mark article))))
10834 (gnus-kill-buffer save-buffer)
10835 (gnus-summary-position-point)
10836 (gnus-set-mode-line 'summary)
10839 (defun gnus-summary-pipe-output (&optional arg headers)
10840 "Pipe the current article to a subprocess.
10841 If N is a positive number, pipe the N next articles.
10842 If N is a negative number, pipe the N previous articles.
10843 If N is nil and any articles have been marked with the process mark,
10844 pipe those articles instead.
10845 If HEADERS (the symbolic prefix), include the headers, too."
10846 (interactive (gnus-interactive "P\ny"))
10847 (require 'gnus-art)
10848 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10849 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10850 (gnus-summary-save-article arg t))
10851 (let ((buffer (get-buffer "*Shell Command Output*")))
10853 (not (zerop (buffer-size buffer))))
10854 (gnus-configure-windows 'pipe))))
10856 (defun gnus-summary-save-article-mail (&optional arg)
10857 "Append the current article to an mail file.
10858 If N is a positive number, save the N next articles.
10859 If N is a negative number, save the N previous articles.
10860 If N is nil and any articles have been marked with the process mark,
10861 save those articles instead."
10863 (require 'gnus-art)
10864 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10865 (gnus-summary-save-article arg)))
10867 (defun gnus-summary-save-article-rmail (&optional arg)
10868 "Append the current article to an rmail file.
10869 If N is a positive number, save the N next articles.
10870 If N is a negative number, save the N previous articles.
10871 If N is nil and any articles have been marked with the process mark,
10872 save those articles instead."
10874 (require 'gnus-art)
10875 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10876 (gnus-summary-save-article arg)))
10878 (defun gnus-summary-save-article-file (&optional arg)
10879 "Append the current article to a file.
10880 If N is a positive number, save the N next articles.
10881 If N is a negative number, save the N previous articles.
10882 If N is nil and any articles have been marked with the process mark,
10883 save those articles instead."
10885 (require 'gnus-art)
10886 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10887 (gnus-summary-save-article arg)))
10889 (defun gnus-summary-write-article-file (&optional arg)
10890 "Write the current article to a file, deleting the previous file.
10891 If N is a positive number, save the N next articles.
10892 If N is a negative number, save the N previous articles.
10893 If N is nil and any articles have been marked with the process mark,
10894 save those articles instead."
10896 (require 'gnus-art)
10897 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10898 (gnus-summary-save-article arg)))
10900 (defun gnus-summary-save-article-body-file (&optional arg)
10901 "Append the current article body to a file.
10902 If N is a positive number, save the N next articles.
10903 If N is a negative number, save the N previous articles.
10904 If N is nil and any articles have been marked with the process mark,
10905 save those articles instead."
10907 (require 'gnus-art)
10908 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10909 (gnus-summary-save-article arg)))
10911 (defun gnus-summary-muttprint (&optional arg)
10912 "Print the current article using Muttprint.
10913 If N is a positive number, save the N next articles.
10914 If N is a negative number, save the N previous articles.
10915 If N is nil and any articles have been marked with the process mark,
10916 save those articles instead."
10918 (require 'gnus-art)
10919 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10920 (gnus-summary-save-article arg t)))
10922 (defun gnus-summary-pipe-message (program)
10923 "Pipe the current article through PROGRAM."
10924 (interactive "sProgram: ")
10925 (gnus-summary-select-article)
10926 (let ((mail-header-separator ""))
10927 (gnus-eval-in-buffer-window gnus-article-buffer
10930 (let ((start (window-start))
10932 (message-pipe-buffer-body program)
10933 (set-window-start (get-buffer-window (current-buffer)) start))))))
10935 (defun gnus-get-split-value (methods)
10936 "Return a value based on the split METHODS."
10937 (let (split-name method result match)
10940 (set-buffer gnus-original-article-buffer)
10942 (nnheader-narrow-to-headers)
10943 (while (and methods (not split-name))
10944 (goto-char (point-min))
10945 (setq method (pop methods))
10946 (setq match (car method))
10949 ;; Regular expression.
10951 (re-search-forward match nil t)))
10956 (setq result (funcall match gnus-newsgroup-name))))
10961 (setq result (eval match)))))
10962 (setq split-name (cdr method))
10963 (cond ((stringp result)
10964 (push (expand-file-name
10965 result gnus-article-save-directory)
10968 (setq split-name (append result split-name)))))))))
10969 (nreverse split-name)))
10971 (defun gnus-valid-move-group-p (group)
10972 (and (boundp group)
10973 (symbol-name group)
10974 (symbol-value group)
10975 (gnus-get-function (gnus-find-method-for-group
10976 (symbol-name group)) 'request-accept-article t)))
10978 (defun gnus-read-move-group-name (prompt default articles prefix)
10979 "Read a group name."
10980 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10981 (minibuffer-confirm-incomplete nil) ; XEmacs
10983 (format "%s %s to:"
10985 (if (> (length articles) 1)
10986 (format "these %d articles" (length articles))
10991 (gnus-completing-read-with-default
10994 'gnus-valid-move-group-p
10996 'gnus-group-history))
10997 ((= 1 (length split-name))
10998 (gnus-completing-read-with-default
10999 (car split-name) prom
11001 'gnus-valid-move-group-p
11003 'gnus-group-history))
11005 (gnus-completing-read-with-default
11007 (mapcar (lambda (el) (list el))
11008 (nreverse split-name))
11010 'gnus-group-history))))
11011 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11013 (if (or (string= to-newsgroup "")
11014 (string= to-newsgroup prefix))
11015 (setq to-newsgroup default))
11016 (unless to-newsgroup
11017 (error "No group name entered"))
11018 (or (gnus-active to-newsgroup)
11019 (gnus-activate-group to-newsgroup nil nil to-method)
11020 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11022 (or (and (gnus-request-create-group to-newsgroup to-method)
11023 (gnus-activate-group
11024 to-newsgroup nil nil to-method)
11025 (gnus-subscribe-group to-newsgroup))
11026 (error "Couldn't create group %s" to-newsgroup)))
11027 (error "No such group: %s" to-newsgroup)))
11030 (defun gnus-summary-save-parts (type dir n &optional reverse)
11031 "Save parts matching TYPE to DIR.
11032 If REVERSE, save parts that do not match TYPE."
11034 (list (read-string "Save parts of type: "
11035 (or (car gnus-summary-save-parts-type-history)
11036 gnus-summary-save-parts-default-mime)
11037 'gnus-summary-save-parts-type-history)
11038 (setq gnus-summary-save-parts-last-directory
11039 (read-file-name "Save to directory: "
11040 gnus-summary-save-parts-last-directory
11042 current-prefix-arg))
11043 (gnus-summary-iterate n
11044 (let ((gnus-display-mime-function nil)
11045 (gnus-inhibit-treatment t))
11046 (gnus-summary-select-article))
11048 (set-buffer gnus-article-buffer)
11049 (let ((handles (or gnus-article-mime-handles
11050 (mm-dissect-buffer nil gnus-article-loose-mime)
11051 (and gnus-article-emulate-mime
11052 (mm-uu-dissect)))))
11054 (gnus-summary-save-parts-1 type dir handles reverse)
11055 (unless gnus-article-mime-handles ;; Don't destroy this case.
11056 (mm-destroy-parts handles)))))))
11058 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11059 (if (stringp (car handle))
11060 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11063 (not (string-match type (mm-handle-media-type handle)))
11064 (string-match type (mm-handle-media-type handle)))
11065 (let ((file (expand-file-name
11067 mm-file-name-rewrite-functions
11068 (file-name-nondirectory
11070 (mail-content-type-get
11071 (mm-handle-disposition handle) 'filename)
11072 (mail-content-type-get
11073 (mm-handle-type handle) 'name)
11074 (concat gnus-newsgroup-name
11075 "." (number-to-string
11076 (cdr gnus-article-current))))))
11078 (unless (file-exists-p file)
11079 (mm-save-part-to-file handle file))))))
11081 ;; Summary extract commands
11083 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11084 (let ((buffer-read-only nil)
11085 (article (gnus-summary-article-number))
11087 (unless (gnus-summary-goto-subject article)
11088 (error "No such article: %d" article))
11089 (gnus-summary-position-point)
11090 ;; If all commands are to be bunched up on one line, we collect
11092 (unless gnus-view-pseudos-separately
11093 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11096 (setq action (cdr (assq 'action (car ps))))
11097 (setq files (list (cdr (assq 'name (car ps)))))
11098 (while (and ps (cdr ps)
11099 (string= (or action "1")
11100 (or (cdr (assq 'action (cadr ps))) "2")))
11101 (push (cdr (assq 'name (cadr ps))) files)
11102 (setcdr ps (cddr ps)))
11104 (when (not (string-match "%s" action))
11107 (when (assq 'execute (car ps))
11108 (setcdr (assq 'execute (car ps))
11109 (funcall (if (string-match "%s" action)
11116 (shell-quote-argument f)))
11118 (setq ps (cdr ps)))))
11119 (if (and gnus-view-pseudos (not not-view))
11121 (when (assq 'execute (car pslist))
11122 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11123 (eq gnus-view-pseudos 'not-confirm)))
11124 (setq pslist (cdr pslist)))
11127 (setq after-article (or (cdr (assq 'article (car pslist)))
11128 (gnus-summary-article-number)))
11129 (gnus-summary-goto-subject after-article)
11132 (insert " " (file-name-nondirectory
11133 (cdr (assq 'name (car pslist))))
11134 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11136 (forward-line -1) ; back to `b'
11137 (gnus-add-text-properties
11138 b (1- e) (list 'gnus-number gnus-reffed-article-number
11139 gnus-mouse-face-prop gnus-mouse-face))
11141 after-article gnus-reffed-article-number
11142 gnus-unread-mark b (car pslist) 0 (- e b))
11143 (setq gnus-newsgroup-unreads
11144 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11145 gnus-reffed-article-number))
11146 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11147 (setq pslist (cdr pslist)))))))
11149 (defun gnus-pseudos< (p1 p2)
11150 (let ((c1 (cdr (assq 'action p1)))
11151 (c2 (cdr (assq 'action p2))))
11152 (and c1 c2 (string< c1 c2))))
11154 (defun gnus-request-pseudo-article (props)
11155 (cond ((assq 'execute props)
11156 (gnus-execute-command (cdr (assq 'execute props)))))
11157 (let ((gnus-current-article (gnus-summary-article-number)))
11158 (gnus-run-hooks 'gnus-mark-article-hook)))
11160 (defun gnus-execute-command (command &optional automatic)
11162 (gnus-article-setup-buffer)
11163 (set-buffer gnus-article-buffer)
11164 (setq buffer-read-only nil)
11165 (let ((command (if automatic command
11166 (read-string "Command: " (cons command 0)))))
11168 (insert "$ " command "\n\n")
11169 (if gnus-view-pseudo-asynchronously
11170 (start-process "gnus-execute" (current-buffer) shell-file-name
11171 shell-command-switch command)
11172 (call-process shell-file-name nil t nil
11173 shell-command-switch command)))))
11175 ;; Summary kill commands.
11177 (defun gnus-summary-edit-global-kill (article)
11178 "Edit the \"global\" kill file."
11179 (interactive (list (gnus-summary-article-number)))
11180 (gnus-group-edit-global-kill article))
11182 (defun gnus-summary-edit-local-kill ()
11183 "Edit a local kill file applied to the current newsgroup."
11185 (setq gnus-current-headers (gnus-summary-article-header))
11186 (gnus-group-edit-local-kill
11187 (gnus-summary-article-number) gnus-newsgroup-name))
11189 ;;; Header reading.
11191 (defun gnus-read-header (id &optional header)
11192 "Read the headers of article ID and enter them into the Gnus system."
11193 (let ((group gnus-newsgroup-name)
11194 (gnus-override-method
11196 gnus-override-method
11197 (and (gnus-news-group-p gnus-newsgroup-name)
11198 (car (gnus-refer-article-methods)))))
11200 ;; First we check to see whether the header in question is already
11203 ;; This is a Message-ID.
11204 (setq header (or header (gnus-id-to-header id)))
11205 ;; This is an article number.
11206 (setq header (or header (gnus-summary-article-header id))))
11208 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11209 ;; We have found the header.
11211 ;; If this is a sparse article, we have to nix out its
11212 ;; previous entry in the thread hashtb.
11214 (gnus-summary-article-sparse-p (mail-header-number header)))
11215 (let* ((parent (gnus-parent-id (mail-header-references header)))
11216 (thread (and parent (gnus-id-to-thread parent))))
11218 (delq (assq header thread) thread))))
11219 ;; We have to really fetch the header to this article.
11221 (set-buffer nntp-server-buffer)
11222 (when (setq where (gnus-request-head id group))
11223 (nnheader-fold-continuation-lines)
11224 (goto-char (point-max))
11226 (goto-char (point-min))
11230 ((cdr where) (cdr where))
11231 (header (mail-header-number header))
11232 (t gnus-reffed-article-number))
11234 (insert " Article retrieved.\n"))
11235 (if (or (not where)
11236 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11237 () ; Malformed head.
11238 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11239 (when (and (stringp id)
11240 (not (string= (gnus-group-real-name group)
11242 ;; If we fetched by Message-ID and the article came
11243 ;; from a different group, we fudge some bogus article
11244 ;; numbers for this article.
11245 (mail-header-set-number header gnus-reffed-article-number))
11247 (set-buffer gnus-summary-buffer)
11248 (decf gnus-reffed-article-number)
11249 (gnus-remove-header (mail-header-number header))
11250 (push header gnus-newsgroup-headers)
11251 (setq gnus-current-headers header)
11252 (push (mail-header-number header) gnus-newsgroup-limit)))
11255 (defun gnus-remove-header (number)
11256 "Remove header NUMBER from `gnus-newsgroup-headers'."
11257 (if (and gnus-newsgroup-headers
11258 (= number (mail-header-number (car gnus-newsgroup-headers))))
11259 (pop gnus-newsgroup-headers)
11260 (let ((headers gnus-newsgroup-headers))
11261 (while (and (cdr headers)
11262 (not (= number (mail-header-number (cadr headers)))))
11264 (when (cdr headers)
11265 (setcdr headers (cddr headers))))))
11268 ;;; summary highlights
11271 (defun gnus-highlight-selected-summary ()
11272 "Highlight selected article in summary buffer."
11273 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11274 (when gnus-summary-selected-face
11276 (let* ((beg (point-at-bol))
11277 (end (point-at-eol))
11278 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11279 (from (if (get-text-property beg gnus-mouse-face-prop)
11281 (or (next-single-property-change
11282 beg gnus-mouse-face-prop nil end)
11287 (or (next-single-property-change
11288 from gnus-mouse-face-prop nil end)
11290 ;; If no mouse-face prop on line we will have to = from = end,
11291 ;; so we highlight the entire line instead.
11292 (when (= (+ to 2) from)
11295 (if gnus-newsgroup-selected-overlay
11296 ;; Move old overlay.
11298 gnus-newsgroup-selected-overlay from to (current-buffer))
11299 ;; Create new overlay.
11301 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11302 'face gnus-summary-selected-face))))))
11304 (defvar gnus-summary-highlight-line-cached nil)
11305 (defvar gnus-summary-highlight-line-trigger nil)
11307 (defun gnus-summary-highlight-line-0 ()
11308 (if (and (eq gnus-summary-highlight-line-trigger
11309 gnus-summary-highlight)
11310 gnus-summary-highlight-line-cached)
11311 gnus-summary-highlight-line-cached
11312 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11313 gnus-summary-highlight-line-cached
11314 (let* ((cond (list 'cond))
11316 (list gnus-summary-highlight))
11318 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11322 (gnus-byte-compile (list 'lambda nil cond))))))
11324 (defun gnus-summary-highlight-line ()
11325 "Highlight current line according to `gnus-summary-highlight'."
11326 (let* ((beg (point-at-bol))
11327 (article (or (gnus-summary-article-number) gnus-current-article))
11328 (score (or (cdr (assq article
11329 gnus-newsgroup-scored))
11330 gnus-summary-default-score 0))
11331 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11332 (inhibit-read-only t)
11333 (default gnus-summary-default-score)
11334 (default-high gnus-summary-default-high-score)
11335 (default-low gnus-summary-default-low-score)
11336 (uncached (and gnus-summary-use-undownloaded-faces
11337 (memq article gnus-newsgroup-undownloaded))))
11338 (let ((face (funcall (gnus-summary-highlight-line-0))))
11339 (unless (eq face (get-text-property beg 'face))
11340 (gnus-put-text-property-excluding-characters-with-faces
11341 beg (point-at-eol) 'face
11342 (setq face (if (boundp face) (symbol-value face) face)))
11343 (when gnus-summary-highlight-line-function
11344 (funcall gnus-summary-highlight-line-function article face))))))
11346 (defun gnus-update-read-articles (group unread &optional compute)
11347 "Update the list of read articles in GROUP.
11348 UNREAD is a sorted list."
11349 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11350 (info (gnus-get-info group))
11353 (if (or (not info) (not active))
11354 ;; There is no info on this group if it was, in fact,
11355 ;; killed. Gnus stores no information on killed groups, so
11356 ;; there's nothing to be done.
11357 ;; One could store the information somewhere temporarily,
11358 ;; perhaps... Hmmm...
11360 ;; Remove any negative articles numbers.
11361 (while (and unread (< (car unread) 0))
11362 (setq unread (cdr unread)))
11363 ;; Remove any expired article numbers
11364 (while (and unread (< (car unread) (car active)))
11365 (setq unread (cdr unread)))
11366 ;; Compute the ranges of read articles by looking at the list of
11367 ;; unread articles.
11369 (when (/= (car unread) prev)
11370 (push (if (= prev (1- (car unread))) prev
11371 (cons prev (1- (car unread))))
11373 (setq prev (1+ (car unread)))
11374 (setq unread (cdr unread)))
11375 (when (<= prev (cdr active))
11376 (push (cons prev (cdr active)) read))
11377 (setq read (if (> (length read) 1) (nreverse read) read))
11382 ;; Propagate the read marks to the backend.
11383 (when (gnus-check-backend-function 'request-set-mark group)
11384 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11385 (add (gnus-remove-from-range read (gnus-info-read info))))
11387 (unless (gnus-check-group group)
11388 (error "Can't open server for %s" group))
11389 (gnus-request-set-mark
11390 group (delq nil (list (if add (list add 'add '(read)))
11391 (if del (list del 'del '(read))))))
11393 `(gnus-request-set-mark
11396 (if del (list del 'add '(read)))
11397 (if add (list add 'del '(read))))))))))
11398 (set-buffer gnus-group-buffer)
11399 (gnus-undo-register
11401 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11402 (gnus-info-set-read ',info ',(gnus-info-read info))
11403 (gnus-get-unread-articles-in-group ',info
11404 (gnus-active ,group))
11405 (gnus-group-update-group ,group t)
11407 ;; Enter this list into the group info.
11408 (gnus-info-set-read info read)
11409 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11410 (gnus-get-unread-articles-in-group info (gnus-active group))
11413 (defun gnus-offer-save-summaries ()
11414 "Offer to save all active summary buffers."
11416 ;; Go through all buffers and find all summaries.
11417 (dolist (buffer (buffer-list))
11418 (when (and (setq buffer (buffer-name buffer))
11419 (string-match "Summary" buffer)
11421 (set-buffer buffer)
11422 ;; We check that this is, indeed, a summary buffer.
11423 (and (eq major-mode 'gnus-summary-mode)
11424 ;; Also make sure this isn't bogus.
11425 gnus-newsgroup-prepared
11426 ;; Also make sure that this isn't a
11427 ;; dead summary buffer.
11428 (not gnus-dead-summary-mode))))
11429 (push buffer buffers)))
11430 ;; Go through all these summary buffers and offer to save them.
11434 "Update summary buffer %s? "
11436 (switch-to-buffer buf)
11437 (gnus-summary-exit))
11440 (defun gnus-summary-setup-default-charset ()
11441 "Setup newsgroup default charset."
11442 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11443 (setq gnus-newsgroup-charset nil)
11444 (let* ((ignored-charsets
11445 (or gnus-newsgroup-ephemeral-ignored-charsets
11447 (and gnus-newsgroup-name
11448 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11449 gnus-newsgroup-ignored-charsets))))
11450 (setq gnus-newsgroup-charset
11451 (or gnus-newsgroup-ephemeral-charset
11452 (and gnus-newsgroup-name
11453 (gnus-parameter-charset gnus-newsgroup-name))
11454 gnus-default-charset))
11455 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11456 ignored-charsets))))
11462 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11463 "Display the current article buffer fully MIME-buttonized.
11464 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11465 treated as multipart/mixed."
11467 (require 'gnus-art)
11468 (let ((gnus-unbuttonized-mime-types nil)
11469 (gnus-mime-display-multipart-as-mixed show-all-parts))
11470 (gnus-summary-show-article)))
11472 (defun gnus-summary-repair-multipart (article)
11473 "Add a Content-Type header to a multipart article without one."
11474 (interactive (list (gnus-summary-article-number)))
11475 (gnus-with-article article
11476 (message-narrow-to-head)
11477 (message-remove-header "Mime-Version")
11478 (goto-char (point-max))
11479 (insert "Mime-Version: 1.0\n")
11481 (when (search-forward "\n--" nil t)
11482 (let ((separator (buffer-substring (point) (point-at-eol))))
11483 (message-narrow-to-head)
11484 (message-remove-header "Content-Type")
11485 (goto-char (point-max))
11486 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11489 (let (gnus-mark-article-hook)
11490 (gnus-summary-select-article t t nil article)))
11492 (defun gnus-summary-toggle-display-buttonized ()
11493 "Toggle the buttonizing of the article buffer."
11495 (require 'gnus-art)
11496 (if (setq gnus-inhibit-mime-unbuttonizing
11497 (not gnus-inhibit-mime-unbuttonizing))
11498 (let ((gnus-unbuttonized-mime-types nil))
11499 (gnus-summary-show-article))
11500 (gnus-summary-show-article)))
11503 ;;; Generic summary marking commands
11506 (defvar gnus-summary-marking-alist
11507 '((read gnus-del-mark "d")
11508 (unread gnus-unread-mark "u")
11509 (ticked gnus-ticked-mark "!")
11510 (dormant gnus-dormant-mark "?")
11511 (expirable gnus-expirable-mark "e"))
11512 "An alist of names/marks/keystrokes.")
11514 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11515 (defvar gnus-summary-mark-map)
11517 (defun gnus-summary-make-all-marking-commands ()
11518 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11519 (dolist (elem gnus-summary-marking-alist)
11520 (apply 'gnus-summary-make-marking-command elem)))
11522 (defun gnus-summary-make-marking-command (name mark keystroke)
11523 (let ((map (make-sparse-keymap)))
11524 (define-key gnus-summary-generic-mark-map keystroke map)
11525 (dolist (lway `((next "next" next nil "n")
11526 (next-unread "next unread" next t "N")
11527 (prev "previous" prev nil "p")
11528 (prev-unread "previous unread" prev t "P")
11529 (nomove "" nil nil ,keystroke)))
11530 (let ((func (gnus-summary-make-marking-command-1
11531 mark (car lway) lway name)))
11532 (setq func (eval func))
11533 (define-key map (nth 4 lway) func)))))
11535 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11537 (format "gnus-summary-put-mark-as-%s%s"
11538 name (if (eq way 'nomove)
11540 (concat "-" (symbol-name way)))))
11543 "Mark the current article as %s%s.
11544 If N, the prefix, then repeat N times.
11545 If N is negative, move in reverse order.
11546 The difference between N and the actual number of articles marked is
11550 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11552 (defun gnus-summary-generic-mark (n mark move unread)
11553 "Mark N articles with MARK."
11554 (unless (eq major-mode 'gnus-summary-mode)
11555 (error "This command can only be used in the summary buffer"))
11556 (gnus-summary-show-thread)
11559 ((eq move 'next) 1)
11560 ((eq move 'prev) -1)
11562 (if (zerop nummove)
11566 nummove (* -1 nummove))))
11567 (while (and (> n 0)
11568 (gnus-summary-mark-article nil mark)
11569 (zerop (gnus-summary-next-subject nummove unread t)))
11572 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11573 (gnus-summary-recenter)
11574 (gnus-summary-position-point)
11575 (gnus-set-mode-line 'summary)
11578 (defun gnus-summary-insert-articles (articles)
11579 (when (setq articles
11580 (gnus-sorted-difference articles
11581 (mapcar (lambda (h)
11582 (mail-header-number h))
11583 gnus-newsgroup-headers)))
11584 (setq gnus-newsgroup-headers
11586 gnus-newsgroup-headers
11587 (gnus-fetch-headers articles)
11588 'gnus-article-sort-by-number))
11589 ;; Suppress duplicates?
11590 (when gnus-suppress-duplicates
11591 (gnus-dup-suppress-articles))
11593 ;; We might want to build some more threads first.
11594 (when (and gnus-fetch-old-headers
11595 (eq gnus-headers-retrieved-by 'nov))
11596 (if (eq gnus-fetch-old-headers 'invisible)
11597 (gnus-build-all-threads)
11598 (gnus-build-old-threads)))
11599 ;; Let the Gnus agent mark articles as read.
11601 (gnus-agent-get-undownloaded-list))
11602 ;; Remove list identifiers from subject
11603 (when gnus-list-identifiers
11604 (gnus-summary-remove-list-identifiers))
11605 ;; First and last article in this newsgroup.
11606 (when gnus-newsgroup-headers
11607 (setq gnus-newsgroup-begin
11608 (mail-header-number (car gnus-newsgroup-headers))
11610 (mail-header-number
11611 (gnus-last-element gnus-newsgroup-headers))))
11612 (when gnus-use-scoring
11613 (gnus-possibly-score-headers))))
11615 (defun gnus-summary-insert-old-articles (&optional all)
11616 "Insert all old articles in this group.
11617 If ALL is non-nil, already read articles become readable.
11618 If ALL is a number, fetch this number of articles."
11621 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11624 ;; Some nntp servers lie about their active range. When
11625 ;; this happens, the active range can be in the millions.
11626 ;; Use a compressed range to avoid creating a huge list.
11627 (gnus-range-difference (list gnus-newsgroup-active) old))
11628 (setq len (gnus-range-length older))
11633 (let ((older-range (nreverse older)))
11637 (let* ((r (pop older-range))
11638 (min (if (numberp r) r (car r)))
11639 (max (if (numberp r) r (cdr r))))
11640 (while (and (<= min max)
11645 (setq older (gnus-uncompress-range older))))
11647 (setq older (gnus-uncompress-range older)))
11649 (when (and (numberp gnus-large-newsgroup)
11650 (> len gnus-large-newsgroup))
11651 (let* ((cursor-in-echo-area nil)
11652 (initial (gnus-parameter-large-newsgroup-initial
11653 gnus-newsgroup-name))
11657 "How many articles from %s (%s %d): "
11659 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11660 (if initial "max" "default")
11663 (cons (number-to-string initial)
11665 (unless (string-match "^[ \t]*$" input)
11666 (setq all (string-to-number input))
11668 (let ((older-range (nreverse older)))
11672 (let* ((r (pop older-range))
11673 (min (if (numberp r) r (car r)))
11674 (max (if (numberp r) r (cdr r))))
11675 (while (and (<= min max)
11679 max (1- max))))))))))
11680 (setq older (gnus-uncompress-range older))))
11682 (message "No old news.")
11683 (gnus-summary-insert-articles older)
11684 (gnus-summary-limit (gnus-sorted-nunion old older))))
11685 (gnus-summary-position-point)))
11687 (defun gnus-summary-insert-new-articles ()
11688 "Insert all new articles in this group."
11691 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11692 (old-active gnus-newsgroup-active)
11693 (nnmail-fetched-sources (list t))
11695 (setq gnus-newsgroup-active
11696 (gnus-activate-group gnus-newsgroup-name 'scan))
11697 (setq i (cdr gnus-newsgroup-active))
11698 (while (> i (cdr old-active))
11702 (message "No gnus is bad news")
11703 (gnus-summary-insert-articles new)
11704 (setq gnus-newsgroup-unreads
11705 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11706 (gnus-summary-limit (gnus-sorted-nunion old new))))
11707 (gnus-summary-position-point)))
11709 (gnus-summary-make-all-marking-commands)
11711 (gnus-ems-redefine)
11713 (provide 'gnus-sum)
11715 (run-hooks 'gnus-sum-load-hook)
11717 ;; Local Variables:
11718 ;; coding: iso-8859-1
11721 ;;; gnus-sum.el ends here