1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996-2016 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 3 of the License, or
13 ;; (at your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>.
27 (eval-when-compile (require 'cl
))
29 (defvar tool-bar-mode
)
30 (defvar gnus-tmp-header
)
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
)
55 (autoload 'nnir-article-rsv
"nnir" nil nil
'macro
)
56 (autoload 'nnir-article-group
"nnir" nil nil
'macro
)
58 (defcustom gnus-kill-summary-on-exit t
59 "If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group
'gnus-summary-exit
65 (defcustom gnus-summary-next-group-on-exit t
66 "If non-nil, go to the next unread newsgroup on summary exit.
67 See `gnus-group-goto-unread'."
68 :link
'(custom-manual "(gnus)Group Maneuvering")
69 :group
'gnus-summary-exit
70 :version
"23.1" ;; No Gnus
73 (defcustom gnus-summary-stop-at-end-of-message nil
74 "If non-nil, don't select the next message when using `SPC'."
75 :link
'(custom-manual "(gnus)Group Maneuvering")
76 :group
'gnus-summary-maneuvering
80 (defcustom gnus-fetch-old-headers nil
81 "Non-nil means that Gnus will try to build threads by grabbing old headers.
82 If an unread article in the group refers to an older, already
83 read (or just marked as read) article, the old article will not
84 normally be displayed in the Summary buffer. If this variable is
85 t, Gnus will attempt to grab the headers to the old articles, and
86 thereby build complete threads. If it has the value `some', all
87 old headers will be fetched but only enough headers to connect
88 otherwise loose threads will be displayed. This variable can
89 also be a number. In that case, no more than that number of old
90 headers will be fetched. If it has the value `invisible', all
91 old headers will be fetched, but none will be displayed.
93 The server has to support NOV for any of this to work.
95 This feature can seriously impact performance it ignores all
96 locally cached header entries. Setting it to t for groups for a
97 server that doesn't expire articles (such as news.gmane.org),
98 leads to very slow summary generation."
100 :type
'(choice (const :tag
"off" nil
)
105 (sexp :menu-tag
"other" t
)))
107 (defcustom gnus-refer-thread-limit
500
108 "The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
109 If t, fetch all the available old headers."
111 :type
'(choice number
112 (sexp :menu-tag
"other" t
)))
114 (defcustom gnus-refer-thread-use-nnir nil
115 "Use nnir to search an entire server when referring threads. A
116 nil value will only search for thread-related articles in the
122 (defcustom gnus-summary-make-false-root
'adopt
123 "nil means that Gnus won't gather loose threads.
124 If the root of a thread has expired or been read in a previous
125 session, the information necessary to build a complete thread has been
126 lost. Instead of having many small sub-threads from this original thread
127 scattered all over the summary buffer, Gnus can gather them.
129 If non-nil, Gnus will try to gather all loose sub-threads from an
130 original thread into one large thread.
132 If this variable is non-nil, it should be one of `none', `adopt',
135 If this variable is `none', Gnus will not make a false root, but just
136 present the sub-threads after another.
137 If this variable is `dummy', Gnus will create a dummy root that will
138 have all the sub-threads as children.
139 If this variable is `adopt', Gnus will make one of the \"children\"
140 the parent and mark all the step-children as such.
141 If this variable is `empty', the \"children\" are printed with empty
142 subject fields. (Or rather, they will be printed with a string
143 given by the `gnus-summary-same-subject' variable.)"
145 :type
'(choice (const :tag
"off" nil
)
151 (defcustom gnus-summary-make-false-root-always nil
152 "Always make a false dummy root."
157 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
158 "A regexp to match subjects to be excluded from loose thread gathering.
159 As loose thread gathering is done on subjects only, that means that
160 there can be many false gatherings performed. By rooting out certain
161 common subjects, gathering might become saner."
165 (defcustom gnus-summary-gather-subject-limit nil
166 "Maximum length of subject comparisons when gathering loose threads.
167 Use nil to compare full subjects. Setting this variable to a low
168 number will help gather threads that have been corrupted by
169 newsreaders chopping off subject lines, but it might also mean that
170 unrelated articles that have subject that happen to begin with the
171 same few characters will be incorrectly gathered.
173 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
176 :type
'(choice (const :tag
"off" nil
)
178 (sexp :menu-tag
"on" t
)))
180 (defcustom gnus-simplify-subject-functions nil
181 "List of functions taking a string argument that simplify subjects.
182 The functions are applied recursively.
184 Useful functions to put in this list include:
185 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
186 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
188 :type
'(repeat function
))
190 (defcustom gnus-simplify-ignored-prefixes nil
191 "Remove matches for this regexp from subject lines when simplifying fuzzily."
193 :type
'(choice (const :tag
"off" nil
)
196 (defcustom gnus-build-sparse-threads nil
197 "If non-nil, fill in the gaps in threads.
198 If `some', only fill in the gaps that are needed to tie loose threads
199 together. If `more', fill in all leaf nodes that Gnus can find. If
200 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
202 :type
'(choice (const :tag
"off" nil
)
205 (sexp :menu-tag
"all" t
)))
207 (defcustom gnus-summary-thread-gathering-function
208 'gnus-gather-threads-by-subject
209 "Function used for gathering loose threads.
210 There are two pre-defined functions: `gnus-gather-threads-by-subject',
211 which only takes Subjects into consideration; and
212 `gnus-gather-threads-by-references', which compared the References
213 headers of the articles to find matches."
215 :type
'(radio (function-item gnus-gather-threads-by-subject
)
216 (function-item gnus-gather-threads-by-references
)
217 (function :tag
"other")))
219 (defcustom gnus-summary-same-subject
""
220 "String indicating that the current article has the same subject as the previous.
221 This variable will only be used if the value of
222 `gnus-summary-make-false-root' is `empty'."
223 :group
'gnus-summary-format
226 (defcustom gnus-summary-goto-unread nil
227 "If t, many commands will go to the next unread article.
228 This applies to marking commands as well as other commands that
229 \"naturally\" select the next article, like, for instance, `SPC' at
230 the end of an article.
232 If nil, the marking commands do NOT go to the next unread article
233 \(they go to the next article instead). If `never', commands that
234 usually go to the next unread article, will go to the next article,
235 whether it is read or not."
237 :group
'gnus-summary-marks
238 :link
'(custom-manual "(gnus)Setting Marks")
239 :type
'(choice (const :tag
"off" nil
)
241 (sexp :menu-tag
"on" t
)))
243 (defcustom gnus-summary-default-score
0
244 "Default article score level.
245 All scores generated by the score files will be added to this score.
246 If this variable is nil, scoring will be disabled."
247 :group
'gnus-score-default
248 :type
'(choice (const :tag
"disable")
251 (defcustom gnus-summary-default-high-score
0
252 "Default threshold for a high scored article.
253 An article will be highlighted as high scored if its score is greater
256 :group
'gnus-score-default
259 (defcustom gnus-summary-default-low-score
0
260 "Default threshold for a low scored article.
261 An article will be highlighted as low scored if its score is smaller
264 :group
'gnus-score-default
267 (defcustom gnus-summary-zcore-fuzz
0
268 "Fuzziness factor for the zcore in the summary buffer.
269 Articles with scores closer than this to `gnus-summary-default-score'
271 :group
'gnus-summary-format
274 (defcustom gnus-simplify-subject-fuzzy-regexp nil
275 "Strings to be removed when doing fuzzy matches.
276 This can either be a regular expression or list of regular expressions
277 that will be removed from subject strings if fuzzy subject
278 simplification is selected."
280 :type
'(repeat regexp
))
282 (defcustom gnus-show-threads t
283 "If non-nil, display threads in summary mode."
287 (defcustom gnus-thread-hide-subtree nil
288 "If non-nil, hide all threads initially.
289 This can be a predicate specifier which says which threads to hide.
290 If threads are hidden, you have to run the command
291 `gnus-summary-show-thread' by hand or select an article."
293 :type
'(radio (sexp :format
"Non-nil\n"
294 :match
(lambda (widget value
)
295 (not (or (consp value
) (functionp value
))))
298 (sexp :tag
"Predicate specifier")))
300 (defcustom gnus-thread-hide-killed t
301 "If non-nil, hide killed threads automatically."
305 (defcustom gnus-thread-ignore-subject t
306 "If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
307 If nil, articles that have different subjects from their parents will
308 start separate threads."
312 (defcustom gnus-thread-operation-ignore-subject t
313 "If non-nil, subjects will be ignored when doing thread commands.
314 This affects commands like `gnus-summary-kill-thread' and
315 `gnus-summary-lower-thread'.
317 If this variable is nil, articles in the same thread with different
318 subjects will not be included in the operation in question. If this
319 variable is `fuzzy', only articles that have subjects that are fuzzily
320 equal will be included."
322 :type
'(choice (const :tag
"off" nil
)
326 (defcustom gnus-thread-indent-level
4
327 "Number that says how much each sub-thread should be indented."
331 (defcustom gnus-auto-extend-newsgroup t
332 "If non-nil, extend newsgroup forward and backward when requested."
333 :group
'gnus-summary-choose
336 (defcustom gnus-auto-select-first t
337 "If non-nil, select an article on group entry.
338 An article is selected automatically when entering a group
339 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
340 `gnus-summary-catchup-and-goto-next-group'.
342 Which article is selected is controlled by the variable
343 `gnus-auto-select-subject'.
345 If you want to prevent automatic selection of articles in some
346 newsgroups, set the variable to nil in `gnus-select-group-hook'."
347 ;; Commands include...
348 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
349 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
350 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
351 :group
'gnus-group-select
352 :type
'(choice (const :tag
"none" nil
)
353 (sexp :menu-tag
"first" t
)))
355 (defcustom gnus-auto-select-subject
'unseen-or-unread
356 "Says what subject to place under point when entering a group.
358 This variable can either be the symbols `first' (place point on the
359 first subject), `unread' (place point on the subject line of the first
360 unread article), `best' (place point on the subject line of the
361 highest-scored article), `unseen' (place point on the subject line of
362 the first unseen article), `unseen-or-unread' (place point on the subject
363 line of the first unseen article or, if all articles have been seen, on the
364 subject line of the first unread article), or a function to be called to
365 place point on some subject line."
367 :group
'gnus-group-select
368 :type
'(choice (const best
)
372 (const unseen-or-unread
)
373 (function :tag
"Function to call")))
375 (defcustom gnus-auto-select-next t
376 "If non-nil, offer to go to the next group from the end of the previous.
377 If the value is t and the next newsgroup is empty, Gnus will exit
378 summary mode and go back to group mode. If the value is neither nil
379 nor t, Gnus will select the following unread newsgroup. In
380 particular, if the value is the symbol `quietly', the next unread
381 newsgroup will be selected without any confirmation, and if it is
382 `almost-quietly', the next group will be selected without any
383 confirmation if you are located on the last article in the group.
384 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
385 will go to the next group without confirmation."
386 :group
'gnus-summary-maneuvering
387 :type
'(choice (const :tag
"off" nil
)
389 (const almost-quietly
)
390 (const slightly-quietly
)
391 (sexp :menu-tag
"on" t
)))
393 (defcustom gnus-auto-select-same nil
394 "If non-nil, select the next article with the same subject.
395 If there are no more articles with the same subject, go to
396 the first unread article."
397 :group
'gnus-summary-maneuvering
400 (defcustom gnus-auto-select-on-ephemeral-exit
'next-noselect
401 "What article should be selected after exiting an ephemeral group.
402 Valid values include:
405 Select the next article.
407 Select the next unread article.
409 Move the cursor to the next article. This is the default.
410 `next-unread-noselect'
411 Move the cursor to the next unread article.
413 If it has any other value or there is no next (unread) article, the
414 article selected before entering to the ephemeral group will appear."
415 :version
"23.1" ;; No Gnus
416 :group
'gnus-summary-maneuvering
417 :type
'(choice :format
"%{%t%}:\n %[Value Menu%] %v"
418 (const next
) (const next-unread
)
419 (const next-noselect
) (const next-unread-noselect
)
420 (sexp :tag
"other" :value nil
)))
422 (defcustom gnus-auto-goto-ignores
'unfetched
423 "Says how to handle unfetched articles when maneuvering.
425 This variable can either be the symbols nil (maneuver to any
426 article), `undownloaded' (maneuvering while unplugged ignores articles
427 that have not been fetched), `always-undownloaded' (maneuvering always
428 ignores articles that have not been fetched), `unfetched' (maneuvering
429 ignores articles whose headers have not been fetched).
431 NOTE: The list of unfetched articles will always be nil when plugged
432 and, when unplugged, a subset of the undownloaded article list."
434 :group
'gnus-summary-maneuvering
435 :type
'(choice (const :tag
"None" nil
)
436 (const :tag
"Undownloaded when unplugged" undownloaded
)
437 (const :tag
"Undownloaded" always-undownloaded
)
438 (const :tag
"Unfetched" unfetched
)))
440 (defcustom gnus-summary-check-current nil
441 "If non-nil, consider the current article when moving.
442 The \"unread\" movement commands will stay on the same line if the
443 current article is unread."
444 :group
'gnus-summary-maneuvering
447 (defcustom gnus-auto-center-summary
448 (max (or (bound-and-true-p scroll-margin
) 0) 2)
449 "If non-nil, always center the current summary buffer.
450 In particular, if `vertical' do only vertical recentering. If non-nil
451 and non-`vertical', do both horizontal and vertical recentering."
452 :group
'gnus-summary-maneuvering
453 :type
'(choice (const :tag
"none" nil
)
455 (integer :tag
"height")
456 (sexp :menu-tag
"both" t
)))
458 (defcustom gnus-auto-center-group t
459 "If non-nil, always center the group buffer."
460 :group
'gnus-summary-maneuvering
463 (defcustom gnus-show-all-headers nil
464 "If non-nil, don't hide any headers."
465 :group
'gnus-article-hiding
466 :group
'gnus-article-headers
469 (defcustom gnus-summary-ignore-duplicates nil
470 "If non-nil, ignore articles with identical Message-ID headers."
474 (defcustom gnus-single-article-buffer nil
475 "If non-nil, display all articles in the same buffer.
476 If nil, each group will get its own article buffer."
478 :group
'gnus-article-various
481 (defcustom gnus-widen-article-window nil
482 "If non-nil, selecting the article buffer will display only the article buffer."
484 :group
'gnus-article-various
487 (defcustom gnus-break-pages t
488 "If non-nil, do page breaking on articles.
489 The page delimiter is specified by the `gnus-page-delimiter'
491 :group
'gnus-article-various
494 (defcustom gnus-move-split-methods nil
495 "Variable used to suggest where articles are to be moved to.
496 It uses the same syntax as the `gnus-split-methods' variable.
497 However, whereas `gnus-split-methods' specifies file names as targets,
498 this variable specifies group names."
499 :group
'gnus-summary-mail
500 :type
'(repeat (choice (list :value
(fun) function
)
501 (cons :value
("" "") regexp
(repeat string
))
504 (defcustom gnus-move-group-prefix-function
'gnus-group-real-prefix
505 "Function used to compute default prefix for article move/copy/etc prompts.
506 The function should take one argument, a group name, and return a
507 string with the suggested prefix."
508 :group
'gnus-summary-mail
511 ;; FIXME: Although the custom type is `character' for the following variables,
512 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
514 (defcustom gnus-unread-mark ?
;Whitespace
515 "Mark used for unread articles."
516 :group
'gnus-summary-marks
519 (defcustom gnus-ticked-mark ?
!
520 "Mark used for ticked articles."
521 :group
'gnus-summary-marks
524 (defcustom gnus-dormant-mark ??
525 "Mark used for dormant articles."
526 :group
'gnus-summary-marks
529 (defcustom gnus-del-mark ?r
530 "Mark used for del'd articles."
531 :group
'gnus-summary-marks
534 (defcustom gnus-read-mark ?R
535 "Mark used for read articles."
536 :group
'gnus-summary-marks
539 (defcustom gnus-expirable-mark ?E
540 "Mark used for expirable articles."
541 :group
'gnus-summary-marks
544 (defcustom gnus-killed-mark ?K
545 "Mark used for killed articles."
546 :group
'gnus-summary-marks
549 (defcustom gnus-spam-mark ?$
550 "Mark used for spam articles."
552 :group
'gnus-summary-marks
555 (defcustom gnus-kill-file-mark ?X
556 "Mark used for articles killed by kill files."
557 :group
'gnus-summary-marks
560 (defcustom gnus-low-score-mark ?Y
561 "Mark used for articles with a low score."
562 :group
'gnus-summary-marks
565 (defcustom gnus-catchup-mark ?C
566 "Mark used for articles that are caught up."
567 :group
'gnus-summary-marks
570 (defcustom gnus-replied-mark ?A
571 "Mark used for articles that have been replied to."
572 :group
'gnus-summary-marks
575 (defcustom gnus-forwarded-mark ?F
576 "Mark used for articles that have been forwarded."
578 :group
'gnus-summary-marks
581 (defcustom gnus-recent-mark ?N
582 "Mark used for articles that are recent."
584 :group
'gnus-summary-marks
587 (defcustom gnus-cached-mark ?
*
588 "Mark used for articles that are in the cache."
589 :group
'gnus-summary-marks
592 (defcustom gnus-saved-mark ?S
593 "Mark used for articles that have been saved."
594 :group
'gnus-summary-marks
597 (defcustom gnus-unseen-mark ?.
598 "Mark used for articles that haven't been seen."
600 :group
'gnus-summary-marks
603 (defcustom gnus-no-mark ?
;Whitespace
604 "Mark used for articles that have no other secondary mark."
606 :group
'gnus-summary-marks
609 (defcustom gnus-ancient-mark ?O
610 "Mark used for ancient articles."
611 :group
'gnus-summary-marks
614 (defcustom gnus-sparse-mark ?Q
615 "Mark used for sparsely reffed articles."
616 :group
'gnus-summary-marks
619 (defcustom gnus-canceled-mark ?G
620 "Mark used for canceled articles."
621 :group
'gnus-summary-marks
624 (defcustom gnus-duplicate-mark ?M
625 "Mark used for duplicate articles."
626 :group
'gnus-summary-marks
629 (defcustom gnus-undownloaded-mark ?-
630 "Mark used for articles that weren't downloaded."
632 :group
'gnus-summary-marks
635 (defcustom gnus-downloaded-mark ?
+
636 "Mark used for articles that were downloaded."
637 :group
'gnus-summary-marks
640 (defcustom gnus-downloadable-mark ?%
641 "Mark used for articles that are to be downloaded."
642 :group
'gnus-summary-marks
645 (defcustom gnus-unsendable-mark ?
=
646 "Mark used for articles that won't be sent."
647 :group
'gnus-summary-marks
650 (defcustom gnus-score-over-mark ?
+
651 "Score mark used for articles with high scores."
652 :group
'gnus-summary-marks
655 (defcustom gnus-score-below-mark ?-
656 "Score mark used for articles with low scores."
657 :group
'gnus-summary-marks
660 (defcustom gnus-empty-thread-mark ?
;Whitespace
661 "There is no thread under the article."
662 :group
'gnus-summary-marks
665 (defcustom gnus-not-empty-thread-mark ?
=
666 "There is a thread under the article."
667 :group
'gnus-summary-marks
670 (defcustom gnus-view-pseudo-asynchronously nil
671 "If non-nil, Gnus will view pseudo-articles asynchronously."
672 :group
'gnus-extract-view
675 (defcustom gnus-auto-expirable-marks
676 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
677 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
679 "The list of marks converted into expiration if a group is auto-expirable."
682 :type
'(repeat character
))
684 (defcustom gnus-inhibit-user-auto-expire t
685 "If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
690 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
691 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
692 If nil, the expirable marks will be unchanged except that the marks
693 will be removed when copying or moving articles to a group that has
694 not turned auto-expire on. If non-nil, articles that have been read
695 will be marked as expirable when being copied or moved to a group in
696 which auto-expire is turned on."
699 :group
'gnus-summary-marks
)
701 (defcustom gnus-view-pseudos nil
702 "If `automatic', pseudo-articles will be viewed automatically.
703 If `not-confirm', pseudos will be viewed automatically, and the user
704 will not be asked to confirm the command."
705 :group
'gnus-extract-view
706 :type
'(choice (const :tag
"off" nil
)
708 (const not-confirm
)))
710 (defcustom gnus-view-pseudos-separately t
711 "If non-nil, one pseudo-article will be created for each file to be viewed.
712 If nil, all files that use the same viewing command will be given as a
713 list of parameters to that command."
714 :group
'gnus-extract-view
717 (defcustom gnus-insert-pseudo-articles t
718 "If non-nil, insert pseudo-articles when decoding articles."
719 :group
'gnus-extract-view
722 (defcustom gnus-summary-dummy-line-format
724 "The format specification for the dummy roots in the summary buffer.
725 It works along the same lines as a normal formatting string,
726 with some simple extensions.
730 General format specifiers can also be used.
731 See `(gnus)Formatting Variables'."
732 :link
'(custom-manual "(gnus)Formatting Variables")
733 :group
'gnus-threading
736 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
737 "The format specification for the summary mode line.
738 It works along the same lines as a normal formatting string,
739 with some simple extensions:
742 %p Unprefixed group name
743 %A Current article number
744 %z Current article score
746 %U Number of unread articles in the group
747 %e Number of unselected articles in the group
748 %Z A string with unread/unselected article counts
749 %g Shortish group name
750 %S Subject of the current article
752 %s Current score file name
753 %d Number of dormant articles
754 %r Number of articles that have been marked as read in this session
755 %E Number of articles expunged by the score files"
756 :group
'gnus-summary-format
759 (defcustom gnus-list-identifiers nil
760 "Regexp that matches list identifiers to be removed from subject.
761 This can also be a list of regexps."
763 :group
'gnus-summary-format
764 :group
'gnus-article-hiding
765 :type
'(choice (const :tag
"none" nil
)
767 (repeat :value
(".*") regexp
)))
769 (defcustom gnus-summary-mark-below
0
770 "Mark all articles with a score below this variable as read.
771 This variable is local to each summary buffer and usually set by the
773 :group
'gnus-score-default
776 (defun gnus-widget-reversible-match (widget value
)
777 "Ignoring WIDGET, convert VALUE to internal form.
778 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
782 (eq (length value
) 2)
783 (eq (nth 0 value
) 'not
)
784 (symbolp (nth 1 value
)))))
786 (defun gnus-widget-reversible-to-internal (widget value
)
787 "Ignoring WIDGET, convert VALUE to internal form.
788 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
789 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
793 (list (nth 1 value
) t
)))
795 (defun gnus-widget-reversible-to-external (widget value
)
796 "Ignoring WIDGET, convert VALUE to external form.
797 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
798 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
801 (list 'not
(nth 0 value
))
804 (define-widget 'gnus-widget-reversible
'group
805 "A `group' that convert values."
806 :match
'gnus-widget-reversible-match
807 :value-to-internal
'gnus-widget-reversible-to-internal
808 :value-to-external
'gnus-widget-reversible-to-external
)
810 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
811 "List of functions used for sorting articles in the summary buffer.
813 Each function takes two articles and returns non-nil if the first
814 article should be sorted before the other. If you use more than one
815 function, the primary sort function should be the last. You should
816 probably always include `gnus-article-sort-by-number' in the list of
817 sorting functions -- preferably first. Also note that sorting by date
818 is often much slower than sorting by number, and the sorting order is
819 very similar. (Sorting by date means sorting by the time the message
820 was sent, sorting by number means sorting by arrival time.)
822 Each item can also be a list `(not F)' where F is a function;
823 this reverses the sort order.
825 Ready-made functions include `gnus-article-sort-by-number',
826 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
827 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
828 and `gnus-article-sort-by-score'.
830 When threading is turned on, the variable `gnus-thread-sort-functions'
831 controls how articles are sorted."
832 :group
'gnus-summary-sort
833 :type
'(repeat (gnus-widget-reversible
834 (choice (function-item gnus-article-sort-by-number
)
835 (function-item gnus-article-sort-by-author
)
836 (function-item gnus-article-sort-by-subject
)
837 (function-item gnus-article-sort-by-date
)
838 (function-item gnus-article-sort-by-score
)
839 (function-item gnus-article-sort-by-random
)
840 (function :tag
"other"))
841 (boolean :tag
"Reverse order"))))
843 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
844 "List of functions used for sorting threads in the summary buffer.
845 By default, threads are sorted by article number.
847 Each function takes two threads and returns non-nil if the first
848 thread should be sorted before the other. If you use more than one
849 function, the primary sort function should be the last. You should
850 probably always include `gnus-thread-sort-by-number' in the list of
851 sorting functions -- preferably first. Also note that sorting by date
852 is often much slower than sorting by number, and the sorting order is
853 very similar. (Sorting by date means sorting by the time the message
854 was sent, sorting by number means sorting by arrival time.)
856 Each list item can also be a list `(not F)' where F is a
857 function; this specifies reversed sort order.
859 Ready-made functions include `gnus-thread-sort-by-number',
860 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
861 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
862 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
863 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
864 and `gnus-thread-sort-by-total-score' (see
865 `gnus-thread-score-function').
867 When threading is turned off, the variable
868 `gnus-article-sort-functions' controls how articles are sorted.
870 By default, threads and their subthreads are sorted according to
871 the value of this variable. To use a different sorting order for
872 subthreads, customize `gnus-subthread-sort-functions'."
873 :group
'gnus-summary-sort
875 (gnus-widget-reversible
876 (choice (function-item gnus-thread-sort-by-number
)
877 (function-item gnus-thread-sort-by-author
)
878 (function-item gnus-thread-sort-by-recipient
)
879 (function-item gnus-thread-sort-by-subject
)
880 (function-item gnus-thread-sort-by-date
)
881 (function-item gnus-thread-sort-by-score
)
882 (function-item gnus-thread-sort-by-most-recent-number
)
883 (function-item gnus-thread-sort-by-most-recent-date
)
884 (function-item gnus-thread-sort-by-random
)
885 (function-item gnus-thread-sort-by-total-score
)
886 (function :tag
"other"))
887 (boolean :tag
"Reverse order"))))
889 (defcustom gnus-subthread-sort-functions
'gnus-thread-sort-functions
890 "List of functions used for sorting subthreads in the summary buffer.
891 By default, subthreads are sorted the same as threads, i.e.,
892 according to the value of `gnus-thread-sort-functions'."
894 :group
'gnus-summary-sort
896 (const :tag
"Sort subthreads like threads" gnus-thread-sort-functions
)
898 (gnus-widget-reversible
899 (choice (function-item gnus-thread-sort-by-number
)
900 (function-item gnus-thread-sort-by-author
)
901 (function-item gnus-thread-sort-by-recipient
)
902 (function-item gnus-thread-sort-by-subject
)
903 (function-item gnus-thread-sort-by-date
)
904 (function-item gnus-thread-sort-by-score
)
905 (function-item gnus-thread-sort-by-most-recent-number
)
906 (function-item gnus-thread-sort-by-most-recent-date
)
907 (function-item gnus-thread-sort-by-random
)
908 (function-item gnus-thread-sort-by-total-score
)
909 (function :tag
"other"))
910 (boolean :tag
"Reverse order")))))
912 (defcustom gnus-thread-score-function
'+
913 "Function used for calculating the total score of a thread.
915 The function is called with the scores of the article and each
916 subthread and should then return the score of the thread.
918 Some functions you can use are `+', `max', or `min'."
919 :group
'gnus-summary-sort
922 (defcustom gnus-summary-expunge-below nil
923 "All articles that have a score less than this variable will be expunged.
924 This variable is local to the summary buffers."
925 :group
'gnus-score-default
926 :type
'(choice (const :tag
"off" nil
)
929 (defcustom gnus-thread-expunge-below nil
930 "All threads that have a total score less than this variable will be expunged.
931 See `gnus-thread-score-function' for en explanation of what a
934 This variable is local to the summary buffers."
935 :group
'gnus-threading
936 :group
'gnus-score-default
937 :type
'(choice (const :tag
"off" nil
)
940 (defcustom gnus-summary-mode-hook nil
941 "A hook for Gnus summary mode.
942 This hook is run before any variables are set in the summary buffer."
943 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
944 :group
'gnus-summary-various
947 (defcustom gnus-summary-menu-hook nil
948 "Hook run after the creation of the summary mode menu."
949 :group
'gnus-summary-visual
952 (defcustom gnus-summary-exit-hook nil
953 "A hook called on exit from the summary buffer.
954 It will be called with point in the group buffer."
955 :group
'gnus-summary-exit
958 (defcustom gnus-summary-prepare-hook nil
959 "A hook called after the summary buffer has been generated.
960 If you want to modify the summary buffer, you can use this hook."
961 :group
'gnus-summary-various
964 (defcustom gnus-summary-prepared-hook nil
965 "A hook called as the last thing after the summary buffer has been generated."
966 :group
'gnus-summary-various
969 (defcustom gnus-summary-generate-hook nil
970 "A hook run just before generating the summary buffer.
971 This hook is commonly used to customize threading variables and the
973 :group
'gnus-summary-various
976 (defcustom gnus-select-group-hook nil
977 "A hook called when a newsgroup is selected.
979 If you'd like to simplify subjects like the
980 `gnus-summary-next-same-subject' command does, you can use the
983 (add-hook gnus-select-group-hook
985 (mapcar (lambda (header)
986 (mail-header-set-subject
988 (gnus-simplify-subject
989 (mail-header-subject header) \\='re-only)))
990 gnus-newsgroup-headers)))"
991 :group
'gnus-group-select
994 (defcustom gnus-select-article-hook nil
995 "A hook called when an article is selected."
996 :group
'gnus-summary-choose
997 :options
'(gnus-agent-fetch-selected-article)
1000 (defcustom gnus-visual-mark-article-hook
1001 (list 'gnus-highlight-selected-summary
)
1002 "Hook run after selecting an article in the summary buffer.
1003 It is meant to be used for highlighting the article in some way. It
1004 is not run if `gnus-visual' is nil."
1005 :group
'gnus-summary-visual
1008 (defcustom gnus-parse-headers-hook nil
1009 "A hook called before parsing the headers."
1010 :group
'gnus-various
1013 (defcustom gnus-exit-group-hook nil
1014 "A hook called when exiting summary mode.
1015 This hook is not called from the non-updating exit commands like `Q'."
1016 :group
'gnus-various
1019 (defcustom gnus-summary-update-hook nil
1020 "A hook called when a summary line is changed.
1021 The hook will not be called if `gnus-visual' is nil.
1023 The default function `gnus-summary-highlight-line' will
1024 highlight the line according to the `gnus-summary-highlight'
1026 :group
'gnus-summary-visual
1029 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
1030 "A hook called when an article is selected for the first time.
1031 The hook is intended to mark an article as read (or unread)
1032 automatically when it is selected."
1033 :group
'gnus-summary-choose
1036 (defcustom gnus-group-no-more-groups-hook nil
1037 "A hook run when returning to group mode having no more (unread) groups."
1038 :group
'gnus-group-select
1041 (defcustom gnus-ps-print-hook nil
1042 "A hook run before ps-printing something from Gnus."
1043 :group
'gnus-summary
1046 (defcustom gnus-summary-article-move-hook nil
1047 "A hook called after an article is moved, copied, respooled, or crossposted."
1049 :group
'gnus-summary
1052 (defcustom gnus-summary-article-delete-hook nil
1053 "A hook called after an article is deleted."
1055 :group
'gnus-summary
1058 (defcustom gnus-summary-article-expire-hook nil
1059 "A hook called after an article is expired."
1061 :group
'gnus-summary
1064 (defcustom gnus-summary-display-arrow
(display-graphic-p)
1065 "If non-nil, display an arrow highlighting the current article."
1067 :group
'gnus-summary
1070 (defcustom gnus-summary-selected-face
'gnus-summary-selected
1071 "Face used for highlighting the current article in the summary buffer."
1072 :group
'gnus-summary-visual
1075 (defvar gnus-tmp-downloaded nil
)
1077 (defcustom gnus-summary-highlight
1078 '(((eq mark gnus-canceled-mark
)
1079 . gnus-summary-cancelled
)
1080 ((and uncached
(> score default-high
))
1081 . gnus-summary-high-undownloaded
)
1082 ((and uncached
(< score default-low
))
1083 . gnus-summary-low-undownloaded
)
1085 . gnus-summary-normal-undownloaded
)
1086 ((and (> score default-high
)
1087 (or (eq mark gnus-dormant-mark
)
1088 (eq mark gnus-ticked-mark
)))
1089 . gnus-summary-high-ticked
)
1090 ((and (< score default-low
)
1091 (or (eq mark gnus-dormant-mark
)
1092 (eq mark gnus-ticked-mark
)))
1093 . gnus-summary-low-ticked
)
1094 ((or (eq mark gnus-dormant-mark
)
1095 (eq mark gnus-ticked-mark
))
1096 . gnus-summary-normal-ticked
)
1097 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
1098 . gnus-summary-high-ancient
)
1099 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
1100 . gnus-summary-low-ancient
)
1101 ((eq mark gnus-ancient-mark
)
1102 . gnus-summary-normal-ancient
)
1103 ((and (> score default-high
) (eq mark gnus-unread-mark
))
1104 . gnus-summary-high-unread
)
1105 ((and (< score default-low
) (eq mark gnus-unread-mark
))
1106 . gnus-summary-low-unread
)
1107 ((eq mark gnus-unread-mark
)
1108 . gnus-summary-normal-unread
)
1109 ((> score default-high
)
1110 . gnus-summary-high-read
)
1111 ((< score default-low
)
1112 . gnus-summary-low-read
)
1114 . gnus-summary-normal-read
))
1115 "Controls the highlighting of summary buffer lines.
1117 A list of (FORM . FACE) pairs. When deciding how a particular
1118 summary line should be displayed, each form is evaluated. The content
1119 of the face field after the first true form is used. You can change
1120 how those summary lines are displayed, by editing the face field.
1122 You can use the following variables in the FORM field.
1124 score: The article's score.
1125 default: The default article score.
1126 default-high: The default score for high scored articles.
1127 default-low: The default score for low scored articles.
1128 mark: The article's mark.
1129 uncached: Non-nil if the article is uncached."
1130 :group
'gnus-summary-visual
1131 :type
'(repeat (cons (sexp :tag
"Form" nil
)
1133 (put 'gnus-summary-highlight
'risky-local-variable t
)
1135 (defcustom gnus-alter-header-function nil
1136 "Function called to allow alteration of article header structures.
1137 The function is called with one parameter, the article header vector,
1138 which it may alter in any way."
1139 :type
'(choice (const :tag
"None" nil
)
1141 :group
'gnus-summary
)
1143 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
1144 "Function used to decode a string with encoded words.")
1146 (defvar gnus-decode-encoded-address-function
1147 'mail-decode-encoded-address-string
1148 "Function used to decode addresses with encoded words.")
1150 (defcustom gnus-extra-headers
'(To Cc Keywords Gcc Newsgroups X-GM-LABELS
)
1151 "Extra headers to parse."
1153 :group
'gnus-summary
1154 :type
'(repeat symbol
))
1156 (defcustom gnus-ignored-from-addresses
1157 (and user-mail-address
1158 (not (string= user-mail-address
""))
1159 (regexp-quote user-mail-address
))
1160 "From headers that may be suppressed in favor of To headers.
1161 This can be a regexp, a list of regexps or a function.
1163 If a function, an email string is passed as the argument."
1165 :group
'gnus-summary
1166 :type
'(choice regexp
1167 (repeat :tag
"Regexp List" regexp
)
1170 (defsubst gnus-ignored-from-addresses
()
1171 (cond ((functionp gnus-ignored-from-addresses
)
1172 gnus-ignored-from-addresses
)
1173 (t (gmm-regexp-concat gnus-ignored-from-addresses
))))
1175 (defcustom gnus-summary-to-prefix
"-> "
1176 "String prefixed to the To field in the summary line when
1177 using `gnus-ignored-from-addresses'."
1179 :group
'gnus-summary
1182 (defcustom gnus-summary-newsgroup-prefix
"=> "
1183 "String prefixed to the Newsgroup field in the summary
1184 line when using the option `gnus-ignored-from-addresses'."
1186 :group
'gnus-summary
1189 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1190 "List of charsets that should be ignored.
1191 When these charsets are used in the \"charset\" parameter, the
1192 default charset will be used instead."
1194 :type
'(repeat symbol
)
1195 :group
'gnus-charset
)
1197 (defcustom gnus-newsgroup-maximum-articles nil
1198 "The maximum number of articles a newsgroup.
1199 If this is a number, old articles in a newsgroup exceeding this number
1200 are silently ignored. If it is nil, no article is ignored. Note that
1201 setting this variable to a number might prevent you from reading very
1203 :group
'gnus-group-select
1205 :type
'(choice (const :tag
"No limit" nil
)
1208 (gnus-define-group-parameter
1212 "Return the ignored charsets of GROUP."
1213 :variable gnus-group-ignored-charsets-alist
1215 '(("alt\\.chinese\\.text" iso-8859-1
))
1217 "Alist of regexps (to match group names) and charsets that should be ignored.
1218 When these charsets are used in the \"charset\" parameter, the
1219 default charset will be used instead."
1220 :variable-group gnus-charset
1221 :variable-type
'(repeat (cons (regexp :tag
"Group")
1223 :parameter-type
'(choice :tag
"Ignored charsets"
1226 :parameter-document
"\
1227 List of charsets that should be ignored.
1229 When these charsets are used in the \"charset\" parameter, the
1230 default charset will be used instead.")
1232 (defcustom gnus-group-highlight-words-alist nil
1233 "Alist of group regexps and highlight regexps.
1234 This variable uses the same syntax as `gnus-emphasis-alist'."
1236 :type
'(repeat (cons (regexp :tag
"Group")
1237 (repeat (list (regexp :tag
"Highlight regexp")
1238 (number :tag
"Group for entire word" 0)
1239 (number :tag
"Group for displayed part" 0)
1241 gnus-emphasis-highlight-words
)))))
1242 :group
'gnus-summary-visual
)
1244 (defcustom gnus-summary-show-article-charset-alist
1246 "Alist of number and charset.
1247 The article will be shown with the charset corresponding to the
1249 For example: ((1 . cn-gb-2312) (2 . big5))."
1251 :type
'(repeat (cons (number :tag
"Argument" 1)
1252 (symbol :tag
"Charset")))
1253 :group
'gnus-charset
)
1255 (defcustom gnus-preserve-marks t
1256 "Whether marks are preserved when moving, copying and respooling messages."
1259 :group
'gnus-summary-marks
)
1261 (defcustom gnus-alter-articles-to-read-function nil
1262 "Function to be called to alter the list of articles to be selected."
1263 :type
'(choice (const nil
) function
)
1264 :group
'gnus-summary
)
1266 (defcustom gnus-orphan-score nil
1267 "All orphans get this score added. Set in the score file."
1268 :group
'gnus-score-default
1269 :type
'(choice (const nil
)
1272 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1273 "A regexp to match MIME parts when saving multiple parts of a
1274 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1275 This regexp will be used by default when prompting the user for which
1276 type of files to save."
1277 :group
'gnus-summary
1280 (defcustom gnus-read-all-available-headers nil
1281 "Whether Gnus should parse all headers made available to it.
1282 This is mostly relevant for slow back ends where the user may
1283 wish to widen the summary buffer to include all headers
1286 :group
'gnus-summary
1287 :type
'(choice boolean regexp
))
1289 (defcustom gnus-summary-pipe-output-default-command nil
1290 "Command (and optional arguments) used to pipe article to subprocess.
1291 This will be used as the default command if it is non-nil. The value
1292 will be updated if you modify it when executing the command
1293 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1294 :version
"23.1" ;; No Gnus
1295 :group
'gnus-summary
1296 :type
'(radio (const :tag
"None" nil
) (string :tag
"Command")))
1298 (defcustom gnus-summary-muttprint-program
"muttprint"
1299 "Command (and optional arguments) used to run Muttprint.
1300 The value will be updated if you modify it when executing the command
1301 `gnus-summary-muttprint'."
1303 :group
'gnus-summary
1306 (defcustom gnus-article-loose-mime t
1307 "If non-nil, don't require MIME-Version header.
1308 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1309 supply the MIME-Version header or deliberately strip it from the mail.
1310 If non-nil (the default), Gnus will treat some articles as MIME
1311 even if the MIME-Version header is missing."
1314 :group
'gnus-article-mime
)
1316 (defcustom gnus-article-emulate-mime t
1317 "If non-nil, use MIME emulation for uuencode and the like.
1318 This means that Gnus will search message bodies for text that look
1319 like uuencoded bits, yEncoded bits, and so on, and present that using
1320 the normal Gnus MIME machinery."
1323 :group
'gnus-article-mime
)
1325 ;;; Internal variables
1327 (defvar gnus-summary-display-cache nil
)
1328 (defvar gnus-article-mime-handles nil
)
1329 (defvar gnus-article-decoded-p nil
)
1330 (defvar gnus-article-charset nil
)
1331 (defvar gnus-article-ignored-charsets nil
)
1332 (defvar gnus-scores-exclude-files nil
)
1333 (defvar gnus-page-broken nil
)
1335 (defvar gnus-original-article nil
)
1336 (defvar gnus-article-internal-prepare-hook nil
)
1337 (defvar gnus-newsgroup-process-stack nil
)
1339 (defvar gnus-thread-indent-array nil
)
1340 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1341 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1342 "Function called to sort the articles within a thread after it has been gathered together.")
1344 (defvar gnus-summary-save-parts-type-history nil
)
1345 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1347 ;; Avoid highlighting in kill files.
1348 (defvar gnus-summary-inhibit-highlight nil
)
1349 (defvar gnus-newsgroup-selected-overlay nil
)
1350 (defvar gnus-inhibit-limiting nil
)
1351 (defvar gnus-newsgroup-adaptive-score-file nil
)
1352 (defvar gnus-current-score-file nil
)
1353 (defvar gnus-current-move-group nil
)
1354 (defvar gnus-current-copy-group nil
)
1355 (defvar gnus-current-crosspost-group nil
)
1356 (defvar gnus-newsgroup-display nil
)
1358 (defvar gnus-newsgroup-dependencies nil
)
1359 (defvar gnus-newsgroup-adaptive nil
)
1360 (defvar gnus-summary-display-article-function nil
)
1361 (defvar gnus-summary-highlight-line-function nil
1362 "Function called after highlighting a summary line.")
1364 (defvar gnus-summary-line-format-alist
1365 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1366 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1367 (?s gnus-tmp-subject-or-nil ?s
)
1368 (?n gnus-tmp-name ?s
)
1369 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1371 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1373 (?F gnus-tmp-from ?s
)
1374 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1375 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1376 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1377 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1378 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1379 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1380 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1381 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1382 (?L gnus-tmp-lines ?s
)
1383 (?Z
(or (nnir-article-rsv (mail-header-number gnus-tmp-header
))
1385 (?G
(or (nnir-article-group (mail-header-number gnus-tmp-header
))
1387 (?g
(or (gnus-group-short-name
1388 (nnir-article-group (mail-header-number gnus-tmp-header
)))
1390 (?O gnus-tmp-downloaded ?c
)
1391 (?I gnus-tmp-indentation ?s
)
1392 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1393 (?R gnus-tmp-replied ?c
)
1394 (?\
[ gnus-tmp-opening-bracket ?c
)
1395 (?\
] gnus-tmp-closing-bracket ?c
)
1396 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1397 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1398 (?i gnus-tmp-score ?d
)
1399 (?z gnus-tmp-score-char ?c
)
1400 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1401 (?U gnus-tmp-unread ?c
)
1402 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1404 (?t
(gnus-summary-number-of-articles-in-thread
1405 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1407 (?e
(gnus-summary-number-of-articles-in-thread
1408 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1410 (?u gnus-tmp-user-defined ?s
)
1411 (?P
(gnus-pick-line-number) ?d
)
1412 (?B gnus-tmp-thread-tree-header-string ?s
)
1413 (user-date (gnus-user-date
1414 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1415 "An alist of format specifications that can appear in summary lines.
1416 These are paired with what variables they correspond with, along with
1417 the type of the variable (string, integer, character, etc).")
1419 (defvar gnus-summary-dummy-line-format-alist
1420 `((?S gnus-tmp-subject ?s
)
1421 (?N gnus-tmp-number ?d
)
1422 (?u gnus-tmp-user-defined ?s
)))
1424 (defvar gnus-summary-mode-line-format-alist
1425 `((?G gnus-tmp-group-name ?s
)
1426 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1427 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1428 (?A gnus-tmp-article-number ?d
)
1429 (?Z gnus-tmp-unread-and-unselected ?s
)
1430 (?V gnus-version ?s
)
1431 (?U gnus-tmp-unread-and-unticked ?d
)
1432 (?S gnus-tmp-subject ?s
)
1433 (?e gnus-tmp-unselected ?d
)
1434 (?u gnus-tmp-user-defined ?s
)
1435 (?d
(length gnus-newsgroup-dormant
) ?d
)
1436 (?t
(length gnus-newsgroup-marked
) ?d
)
1437 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1438 (?r
(length gnus-newsgroup-reads
) ?d
)
1439 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1440 (?E gnus-newsgroup-expunged-tally ?d
)
1441 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1443 ;; This is here rather than in gnus-art for compilation reasons.
1444 (defvar gnus-article-mode-line-format-alist
1445 (nconc '((?w
(gnus-article-wash-status) ?s
)
1446 (?m
(gnus-article-mime-part-status) ?s
))
1447 gnus-summary-mode-line-format-alist
))
1449 (defvar gnus-last-search-regexp nil
1450 "Default regexp for article search command.")
1452 (defvar gnus-last-shell-command nil
1453 "Default shell command on article.")
1455 (defvar gnus-newsgroup-agentized nil
1456 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1457 (defvar gnus-newsgroup-begin nil
)
1458 (defvar gnus-newsgroup-end nil
)
1459 (defvar gnus-newsgroup-last-rmail nil
)
1460 (defvar gnus-newsgroup-last-mail nil
)
1461 (defvar gnus-newsgroup-last-folder nil
)
1462 (defvar gnus-newsgroup-last-file nil
)
1463 (defvar gnus-newsgroup-last-directory nil
)
1464 (defvar gnus-newsgroup-auto-expire nil
)
1465 (defvar gnus-newsgroup-active nil
)
1466 (defvar gnus-newsgroup-highest nil
)
1468 (defvar gnus-newsgroup-data nil
)
1469 (defvar gnus-newsgroup-data-reverse nil
)
1470 (defvar gnus-newsgroup-limit nil
)
1471 (defvar gnus-newsgroup-limits nil
)
1472 (defvar gnus-summary-use-undownloaded-faces nil
)
1474 (defvar gnus-newsgroup-unreads nil
1475 "Sorted list of unread articles in the current newsgroup.")
1477 (defvar gnus-newsgroup-unselected nil
1478 "Sorted list of unselected unread articles in the current newsgroup.")
1480 (defvar gnus-newsgroup-reads nil
1481 "Alist of read articles and article marks in the current newsgroup.")
1483 (defvar gnus-newsgroup-expunged-tally nil
)
1485 (defvar gnus-newsgroup-marked nil
1486 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1488 (defvar gnus-newsgroup-spam-marked nil
1489 "List of ranges of articles that have been marked as spam.")
1491 (defvar gnus-newsgroup-killed nil
1492 "List of ranges of articles that have been through the scoring process.")
1494 (defvar gnus-newsgroup-cached nil
1495 "Sorted list of articles that come from the article cache.")
1497 (defvar gnus-newsgroup-saved nil
1498 "List of articles that have been saved.")
1500 (defvar gnus-newsgroup-kill-headers nil
)
1502 (defvar gnus-newsgroup-replied nil
1503 "List of articles that have been replied to in the current newsgroup.")
1505 (defvar gnus-newsgroup-forwarded nil
1506 "List of articles that have been forwarded in the current newsgroup.")
1508 (defvar gnus-newsgroup-expirable nil
1509 "Sorted list of articles in the current newsgroup that can be expired.")
1511 (defvar gnus-newsgroup-processable nil
1512 "List of articles in the current newsgroup that can be processed.")
1514 (defvar gnus-newsgroup-downloadable nil
1515 "Sorted list of articles in the current newsgroup that can be processed.")
1517 (defvar gnus-newsgroup-unfetched nil
1518 "Sorted list of articles in the current newsgroup whose headers have
1519 not been fetched into the agent.
1521 This list will always be a subset of gnus-newsgroup-undownloaded.")
1523 (defvar gnus-newsgroup-undownloaded nil
1524 "List of articles in the current newsgroup that haven't been downloaded.")
1526 (defvar gnus-newsgroup-unsendable nil
1527 "List of articles in the current newsgroup that won't be sent.")
1529 (defvar gnus-newsgroup-bookmarks nil
1530 "List of articles in the current newsgroup that have bookmarks.")
1532 (defvar gnus-newsgroup-dormant nil
1533 "Sorted list of dormant articles in the current newsgroup.")
1535 (defvar gnus-newsgroup-unseen nil
1536 "List of unseen articles in the current newsgroup.")
1538 (defvar gnus-newsgroup-seen nil
1539 "Range of seen articles in the current newsgroup.")
1541 (defvar gnus-newsgroup-unexist nil
1542 "Range of unexisting articles in the current newsgroup.")
1544 (defvar gnus-newsgroup-articles nil
1545 "List of articles in the current newsgroup.")
1547 (defvar gnus-newsgroup-scored nil
1548 "List of scored articles in the current newsgroup.")
1550 (defvar gnus-newsgroup-headers nil
1551 "List of article headers in the current newsgroup.")
1553 (defvar gnus-newsgroup-threads nil
)
1555 (defvar gnus-newsgroup-prepared nil
1556 "Whether the current group has been prepared properly.")
1558 (defvar gnus-newsgroup-ancient nil
1559 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1561 (defvar gnus-newsgroup-sparse nil
)
1563 (defvar gnus-current-article nil
)
1564 (defvar gnus-article-current nil
)
1565 (defvar gnus-current-headers nil
)
1566 (defvar gnus-have-all-headers nil
)
1567 (defvar gnus-last-article nil
)
1568 (defvar gnus-newsgroup-history nil
)
1569 (defvar gnus-newsgroup-charset nil
)
1570 (defvar gnus-newsgroup-ephemeral-charset nil
)
1571 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1573 (defvar gnus-article-before-search nil
)
1575 (defvar gnus-summary-local-variables
1576 '(gnus-newsgroup-name
1579 gnus-newsgroup-unreads
1580 gnus-newsgroup-unselected
1581 gnus-newsgroup-marked
1582 gnus-newsgroup-spam-marked
1583 gnus-newsgroup-reads
1584 gnus-newsgroup-saved
1585 gnus-newsgroup-replied
1586 gnus-newsgroup-forwarded
1587 gnus-newsgroup-expirable
1588 gnus-newsgroup-killed
1589 gnus-newsgroup-unseen
1591 gnus-newsgroup-unexist
1592 gnus-newsgroup-cached
1593 gnus-newsgroup-downloadable
1594 gnus-newsgroup-undownloaded
1595 gnus-newsgroup-unsendable
1597 gnus-newsgroup-begin gnus-newsgroup-end
1598 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1599 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1600 gnus-newsgroup-last-directory
1601 gnus-newsgroup-auto-expire
1602 gnus-newsgroup-processable
1603 gnus-newsgroup-unfetched
1604 gnus-newsgroup-articles
1605 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1606 gnus-newsgroup-headers gnus-newsgroup-threads
1607 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1608 gnus-current-article gnus-current-headers gnus-have-all-headers
1609 gnus-last-article gnus-article-internal-prepare-hook
1610 (gnus-summary-article-delete-hook . global
)
1611 (gnus-summary-article-move-hook . global
)
1612 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1613 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1614 gnus-thread-expunge-below
1615 gnus-score-alist gnus-current-score-file
1616 (gnus-summary-expunge-below . global
)
1617 (gnus-summary-mark-below . global
)
1618 (gnus-orphan-score . global
)
1619 gnus-newsgroup-active gnus-scores-exclude-files
1620 gnus-newsgroup-highest
1621 gnus-newsgroup-history gnus-newsgroup-ancient
1622 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1623 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1624 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1625 (gnus-newsgroup-expunged-tally .
0)
1626 gnus-cache-removable-articles
1627 gnus-newsgroup-data gnus-newsgroup-data-reverse
1628 gnus-newsgroup-limit gnus-newsgroup-limits
1629 gnus-newsgroup-charset gnus-newsgroup-display
1630 gnus-summary-use-undownloaded-faces
)
1631 "Variables that are buffer-local to the summary buffers.")
1633 (defvar gnus-newsgroup-variables nil
1634 "A list of variables that have separate values in different newsgroups.
1635 A list of newsgroup (summary buffer) local variables, or cons of
1636 variables and their default expressions to be evalled (when the default
1637 values are not nil), that should be made global while the summary buffer
1640 Note: The default expressions will be evaluated (using function `eval')
1641 before assignment to the local variable rather than just assigned to it.
1642 If the default expression is the symbol `global', that symbol will not
1643 be evaluated but the global value of the local variable will be used
1646 These variables can be used to set variables in the group parameters
1647 while still allowing them to affect operations done in other buffers.
1650 \(setq gnus-newsgroup-variables
1651 \\='(message-use-followup-to
1652 (gnus-visible-headers .
1653 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1657 ;; Bind features so that require will believe that gnus-sum has
1658 ;; already been loaded (avoids infinite recursion)
1659 (let ((features (cons 'gnus-sum features
)))
1660 (require 'gnus-art
)))
1664 (defvar gnus-decode-encoded-word-methods
1665 '(mail-decode-encoded-word-string)
1666 "List of methods used to decode encoded words.
1668 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1669 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1670 \(REGEXP . FUNCTION), FUNCTION will be applied only to the newsgroups
1671 whose names match REGEXP.
1674 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1675 mail-decode-encoded-word-string
1676 (\"chinese\" . rfc1843-decode-string))")
1678 (defvar gnus-decode-encoded-word-methods-cache nil
)
1680 (defun gnus-multi-decode-encoded-word-string (string)
1681 "Apply the functions from `gnus-encoded-word-methods' that match."
1682 (unless (and gnus-decode-encoded-word-methods-cache
1683 (eq gnus-newsgroup-name
1684 (car gnus-decode-encoded-word-methods-cache
)))
1685 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1686 (dolist (method gnus-decode-encoded-word-methods
)
1687 (if (symbolp method
)
1688 (nconc gnus-decode-encoded-word-methods-cache
(list method
))
1689 (if (and gnus-newsgroup-name
1690 (string-match (car method
) gnus-newsgroup-name
))
1691 (nconc gnus-decode-encoded-word-methods-cache
1692 (list (cdr method
)))))))
1693 (dolist (method (cdr gnus-decode-encoded-word-methods-cache
) string
)
1694 (setq string
(funcall method string
))))
1696 ;; Subject simplification.
1698 (defun gnus-simplify-whitespace (str)
1699 "Remove excessive whitespace from STR."
1701 (while (string-match "[ \t][ \t]+" str
)
1702 (setq str
(concat (substring str
0 (match-beginning 0))
1704 (substring str
(match-end 0)))))
1706 (when (string-match "^[ \t]+" str
)
1707 (setq str
(substring str
(match-end 0))))
1709 (when (string-match "[ \t]+$" str
)
1710 (setq str
(substring str
0 (match-beginning 0))))
1713 (defun gnus-simplify-all-whitespace (str)
1714 "Remove all whitespace from STR."
1715 (while (string-match "[ \t\n]+" str
)
1716 (setq str
(replace-match "" nil nil str
)))
1719 (defsubst gnus-simplify-subject-re
(subject)
1720 "Remove \"Re:\" from subject lines."
1721 (if (string-match message-subject-re-regexp subject
)
1722 (substring subject
(match-end 0))
1725 (defun gnus-simplify-subject (subject &optional re-only
)
1726 "Remove `Re:' and words in parentheses.
1727 If RE-ONLY is non-nil, strip leading `Re:'s only."
1728 (let ((case-fold-search t
)) ;Ignore case.
1729 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1730 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1731 (setq subject
(substring subject
(match-end 0))))
1732 ;; Remove uninteresting prefixes.
1733 (when (and (not re-only
)
1734 gnus-simplify-ignored-prefixes
1735 (string-match gnus-simplify-ignored-prefixes subject
))
1736 (setq subject
(substring subject
(match-end 0))))
1737 ;; Remove words in parentheses from end.
1739 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1740 (setq subject
(substring subject
0 (match-beginning 0)))))
1741 ;; Return subject string.
1744 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1746 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1747 (goto-char (point-min))
1748 (while (re-search-forward regexp nil t
)
1749 (replace-match (or newtext
""))))
1751 (defun gnus-simplify-buffer-fuzzy (regexp)
1752 "Simplify string in the buffer fuzzily.
1753 The string in the accessible portion of the current buffer is simplified.
1754 It is assumed to be a single-line subject.
1755 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1756 matter is removed. Additional things can be deleted by setting
1757 `gnus-simplify-subject-fuzzy-regexp'."
1758 (let ((case-fold-search t
)
1760 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1762 (while (not (eq modified-tick
(buffer-modified-tick)))
1763 (setq modified-tick
(buffer-modified-tick))
1766 (mapc 'gnus-simplify-buffer-fuzzy-step regexp
))
1768 (gnus-simplify-buffer-fuzzy-step regexp
)))
1769 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1770 (gnus-simplify-buffer-fuzzy-step
1771 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1772 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1774 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1775 (gnus-simplify-buffer-fuzzy-step " +" " ")
1776 (gnus-simplify-buffer-fuzzy-step " $")
1777 (gnus-simplify-buffer-fuzzy-step "^ +")))
1779 (defun gnus-simplify-subject-fuzzy (subject)
1780 "Simplify a subject string fuzzily.
1781 See `gnus-simplify-buffer-fuzzy' for details."
1783 (let ((regexp gnus-simplify-subject-fuzzy-regexp
))
1784 (gnus-set-work-buffer)
1785 (let ((case-fold-search t
))
1786 ;; Remove uninteresting prefixes.
1787 (when (and gnus-simplify-ignored-prefixes
1788 (string-match gnus-simplify-ignored-prefixes subject
))
1789 (setq subject
(substring subject
(match-end 0))))
1791 (inline (gnus-simplify-buffer-fuzzy regexp
))
1794 (defsubst gnus-simplify-subject-fully
(subject)
1795 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1797 (gnus-simplify-subject-functions
1798 (gnus-map-function gnus-simplify-subject-functions subject
))
1799 ((null gnus-summary-gather-subject-limit
)
1800 (gnus-simplify-subject-re subject
))
1801 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1802 (gnus-simplify-subject-fuzzy subject
))
1803 ((numberp gnus-summary-gather-subject-limit
)
1804 (truncate-string-to-width (gnus-simplify-subject-re subject
)
1805 gnus-summary-gather-subject-limit
))
1809 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1810 "Check whether two subjects are equal.
1811 If optional argument SIMPLE-FIRST is t, first argument is already
1814 ((null simple-first
)
1815 (equal (gnus-simplify-subject-fully s1
)
1816 (gnus-simplify-subject-fully s2
)))
1819 (gnus-simplify-subject-fully s2
)))))
1821 (defun gnus-summary-bubble-group ()
1822 "Increase the score of the current group.
1823 This is a handy function to add to `gnus-summary-exit-hook' to
1824 increase the score of each group you read."
1825 (gnus-group-add-score gnus-newsgroup-name
))
1829 ;;; Gnus summary mode
1832 (put 'gnus-summary-mode
'mode-class
'special
)
1834 (defvar gnus-article-commands-menu
)
1836 ;; Non-orthogonal keys
1838 (gnus-define-keys gnus-summary-mode-map
1839 " " gnus-summary-next-page
1840 [?\S-\
] gnus-summary-prev-page
1841 "\177" gnus-summary-prev-page
1842 [delete] gnus-summary-prev-page
1843 "\r" gnus-summary-scroll-up
1844 "\M-\r" gnus-summary-scroll-down
1845 "n" gnus-summary-next-unread-article
1846 "p" gnus-summary-prev-unread-article
1847 "N" gnus-summary-next-article
1848 "P" gnus-summary-prev-article
1849 "\M-\C-n" gnus-summary-next-same-subject
1850 "\M-\C-p" gnus-summary-prev-same-subject
1851 "\M-n" gnus-summary-next-unread-subject
1852 "\M-p" gnus-summary-prev-unread-subject
1853 "." gnus-summary-first-unread-article
1854 "," gnus-summary-best-unread-article
1855 "\M-s" gnus-summary-search-article-forward
1856 "\M-r" gnus-summary-search-article-backward
1857 "\M-S" gnus-summary-repeat-search-article-forward
1858 "\M-R" gnus-summary-repeat-search-article-backward
1859 "<" gnus-summary-beginning-of-article
1860 ">" gnus-summary-end-of-article
1861 "j" gnus-summary-goto-article
1862 "^" gnus-summary-refer-parent-article
1863 "\M-^" gnus-summary-refer-article
1864 "u" gnus-summary-tick-article-forward
1865 "!" gnus-summary-tick-article-forward
1866 "U" gnus-summary-tick-article-backward
1867 "d" gnus-summary-mark-as-read-forward
1868 "D" gnus-summary-mark-as-read-backward
1869 "E" gnus-summary-mark-as-expirable
1870 "\M-u" gnus-summary-clear-mark-forward
1871 "\M-U" gnus-summary-clear-mark-backward
1872 "k" gnus-summary-kill-same-subject-and-select
1873 "\C-k" gnus-summary-kill-same-subject
1874 "\M-\C-k" gnus-summary-kill-thread
1875 "\M-\C-l" gnus-summary-lower-thread
1876 "e" gnus-summary-edit-article
1877 "#" gnus-summary-mark-as-processable
1878 "\M-#" gnus-summary-unmark-as-processable
1879 "\M-\C-t" gnus-summary-toggle-threads
1880 "\M-\C-s" gnus-summary-show-thread
1881 "\M-\C-h" gnus-summary-hide-thread
1882 "\M-\C-f" gnus-summary-next-thread
1883 "\M-\C-b" gnus-summary-prev-thread
1884 [(meta down)] gnus-summary-next-thread
1885 [(meta up)] gnus-summary-prev-thread
1886 "\M-\C-u" gnus-summary-up-thread
1887 "\M-\C-d" gnus-summary-down-thread
1888 "&" gnus-summary-execute-command
1889 "c" gnus-summary-catchup-and-exit
1890 "\C-w" gnus-summary-mark-region-as-read
1891 "\C-t" toggle-truncate-lines
1892 "?" gnus-summary-mark-as-dormant
1893 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1894 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1895 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1896 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1897 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1898 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1899 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1900 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1901 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1902 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1903 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1904 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1905 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1906 "=" gnus-summary-expand-window
1907 "\C-x\C-s" gnus-summary-reselect-current-group
1908 "\M-g" gnus-summary-rescan-group
1909 "\C-c\C-r" gnus-summary-caesar-message
1910 "f" gnus-summary-followup
1911 "F" gnus-summary-followup-with-original
1912 "C" gnus-summary-cancel-article
1913 "r" gnus-summary-reply
1914 "R" gnus-summary-reply-with-original
1915 "\C-c\C-f" gnus-summary-mail-forward
1916 "o" gnus-summary-save-article
1917 "\C-o" gnus-summary-save-article-mail
1918 "|" gnus-summary-pipe-output
1919 "\M-k" gnus-summary-edit-local-kill
1920 "\M-K" gnus-summary-edit-global-kill
1922 "\C-c\C-d" gnus-summary-describe-group
1923 "q" gnus-summary-exit
1924 "Q" gnus-summary-exit-no-update
1925 "\C-c\C-i" gnus-info-find-node
1926 [mouse-2] gnus-mouse-pick-article
1927 [follow-link] mouse-face
1928 "m" gnus-summary-mail-other-window
1929 "a" gnus-summary-post-news
1930 "x" gnus-summary-limit-to-unread
1931 "s" gnus-summary-isearch-article
1932 "\t" gnus-summary-widget-forward
1933 [backtab] gnus-summary-widget-backward
1934 "t" gnus-summary-toggle-header
1935 "g" gnus-summary-show-article
1936 "l" gnus-summary-goto-last-article
1937 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1938 "\C-d" gnus-summary-enter-digest-group
1939 "\M-\C-d" gnus-summary-read-document
1940 "\M-\C-e" gnus-summary-edit-parameters
1941 "\M-\C-a" gnus-summary-customize-parameters
1943 "*" gnus-cache-enter-article
1944 "\M-*" gnus-cache-remove-article
1945 "\M-&" gnus-summary-universal-argument
1946 "\C-l" gnus-recenter
1947 "I" gnus-summary-increase-score
1948 "L" gnus-summary-lower-score
1949 "\M-i" gnus-symbolic-argument
1950 "h" gnus-summary-select-article-buffer
1952 "b" gnus-article-view-part
1953 "\M-t" gnus-summary-toggle-display-buttonized
1955 "V" gnus-summary-score-map
1956 "X" gnus-uu-extract-map
1957 "S" gnus-summary-send-map)
1959 ;; Sort of orthogonal keymap
1960 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1961 "t" gnus-summary-tick-article-forward
1962 "!" gnus-summary-tick-article-forward
1963 "d" gnus-summary-mark-as-read-forward
1964 "r" gnus-summary-mark-as-read-forward
1965 "c" gnus-summary-clear-mark-forward
1966 " " gnus-summary-clear-mark-forward
1967 "e" gnus-summary-mark-as-expirable
1968 "x" gnus-summary-mark-as-expirable
1969 "?" gnus-summary-mark-as-dormant
1970 "b" gnus-summary-set-bookmark
1971 "B" gnus-summary-remove-bookmark
1972 "#" gnus-summary-mark-as-processable
1973 "\M-#" gnus-summary-unmark-as-processable
1974 "S" gnus-summary-limit-include-expunged
1975 "C" gnus-summary-catchup
1976 "H" gnus-summary-catchup-to-here
1977 "h" gnus-summary-catchup-from-here
1978 "\C-c" gnus-summary-catchup-all
1979 "k" gnus-summary-kill-same-subject-and-select
1980 "K" gnus-summary-kill-same-subject
1981 "P" gnus-uu-mark-map)
1983 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1984 "c" gnus-summary-clear-above
1985 "u" gnus-summary-tick-above
1986 "m" gnus-summary-mark-above
1987 "k" gnus-summary-kill-below)
1989 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1990 "/" gnus-summary-limit-to-subject
1991 "n" gnus-summary-limit-to-articles
1992 "b" gnus-summary-limit-to-bodies
1993 "h" gnus-summary-limit-to-headers
1994 "w" gnus-summary-pop-limit
1995 "s" gnus-summary-limit-to-subject
1996 "a" gnus-summary-limit-to-author
1997 "u" gnus-summary-limit-to-unread
1998 "m" gnus-summary-limit-to-marks
1999 "M" gnus-summary-limit-exclude-marks
2000 "v" gnus-summary-limit-to-score
2001 "*" gnus-summary-limit-include-cached
2002 "D" gnus-summary-limit-include-dormant
2003 "T" gnus-summary-limit-include-thread
2004 "d" gnus-summary-limit-exclude-dormant
2005 "t" gnus-summary-limit-to-age
2006 "." gnus-summary-limit-to-unseen
2007 "x" gnus-summary-limit-to-extra
2008 "p" gnus-summary-limit-to-display-predicate
2009 "E" gnus-summary-limit-include-expunged
2010 "c" gnus-summary-limit-exclude-childless-dormant
2011 "C" gnus-summary-limit-mark-excluded-as-read
2012 "o" gnus-summary-insert-old-articles
2013 "N" gnus-summary-insert-new-articles
2014 "S" gnus-summary-limit-to-singletons
2015 "r" gnus-summary-limit-to-replied
2016 "R" gnus-summary-limit-to-recipient
2017 "A" gnus-summary-limit-to-address)
2019 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
2020 "n" gnus-summary-next-unread-article
2021 "p" gnus-summary-prev-unread-article
2022 "N" gnus-summary-next-article
2023 "P" gnus-summary-prev-article
2024 "\C-n" gnus-summary-next-same-subject
2025 "\C-p" gnus-summary-prev-same-subject
2026 "\M-n" gnus-summary-next-unread-subject
2027 "\M-p" gnus-summary-prev-unread-subject
2028 "f" gnus-summary-first-unread-article
2029 "b" gnus-summary-best-unread-article
2030 "j" gnus-summary-goto-article
2031 "g" gnus-summary-goto-subject
2032 "l" gnus-summary-goto-last-article
2033 "o" gnus-summary-pop-article)
2035 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2036 "k" gnus-summary-kill-thread
2037 "E" gnus-summary-expire-thread
2038 "l" gnus-summary-lower-thread
2039 "i" gnus-summary-raise-thread
2040 "T" gnus-summary-toggle-threads
2041 "t" gnus-summary-rethread-current
2042 "^" gnus-summary-reparent-thread
2043 "\M-^" gnus-summary-reparent-children
2044 "s" gnus-summary-show-thread
2045 "S" gnus-summary-show-all-threads
2046 "h" gnus-summary-hide-thread
2047 "H" gnus-summary-hide-all-threads
2048 "n" gnus-summary-next-thread
2049 "p" gnus-summary-prev-thread
2050 "u" gnus-summary-up-thread
2051 "o" gnus-summary-top-thread
2052 "d" gnus-summary-down-thread
2053 "#" gnus-uu-mark-thread
2054 "\M-#" gnus-uu-unmark-thread)
2056 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2057 "g" gnus-summary-prepare
2058 "c" gnus-summary-insert-cached-articles
2059 "d" gnus-summary-insert-dormant-articles
2060 "t" gnus-summary-insert-ticked-articles)
2062 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2063 "c" gnus-summary-catchup-and-exit
2064 "C" gnus-summary-catchup-all-and-exit
2065 "E" gnus-summary-exit-no-update
2066 "Q" gnus-summary-exit
2067 "Z" gnus-summary-exit
2068 "n" gnus-summary-catchup-and-goto-next-group
2069 "p" gnus-summary-catchup-and-goto-prev-group
2070 "R" gnus-summary-reselect-current-group
2071 "G" gnus-summary-rescan-group
2072 "N" gnus-summary-next-group
2073 "s" gnus-summary-save-newsrc
2074 "P" gnus-summary-prev-group)
2076 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2077 " " gnus-summary-next-page
2078 "n" gnus-summary-next-page
2079 [?\S-\ ] gnus-summary-prev-page
2080 "\177" gnus-summary-prev-page
2081 [delete] gnus-summary-prev-page
2082 "p" gnus-summary-prev-page
2083 "\r" gnus-summary-scroll-up
2084 "\M-\r" gnus-summary-scroll-down
2085 "<" gnus-summary-beginning-of-article
2086 ">" gnus-summary-end-of-article
2087 "b" gnus-summary-beginning-of-article
2088 "e" gnus-summary-end-of-article
2089 "^" gnus-summary-refer-parent-article
2090 "r" gnus-summary-refer-parent-article
2091 "C" gnus-summary-show-complete-article
2092 "D" gnus-summary-enter-digest-group
2093 "R" gnus-summary-refer-references
2094 "T" gnus-summary-refer-thread
2095 "W" gnus-warp-to-article
2096 "g" gnus-summary-show-article
2097 "s" gnus-summary-isearch-article
2098 "\t" gnus-summary-widget-forward
2099 [backtab] gnus-summary-widget-backward
2100 "P" gnus-summary-print-article
2101 "S" gnus-sticky-article
2102 "M" gnus-mailing-list-insinuate
2103 "t" gnus-article-babel)
2105 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2106 "b" gnus-article-add-buttons
2107 "B" gnus-article-add-buttons-to-head
2108 "o" gnus-article-treat-overstrike
2109 "e" gnus-article-emphasize
2110 "w" gnus-article-fill-cited-article
2111 "Q" gnus-article-fill-long-lines
2112 "L" gnus-article-toggle-truncate-lines
2113 "C" gnus-article-capitalize-sentences
2114 "c" gnus-article-remove-cr
2115 "q" gnus-article-de-quoted-unreadable
2116 "6" gnus-article-de-base64-unreadable
2117 "Z" gnus-article-decode-HZ
2118 "A" gnus-article-treat-ansi-sequences
2119 "h" gnus-article-wash-html
2120 "u" gnus-article-unsplit-urls
2121 "s" gnus-summary-force-verify-and-decrypt
2122 "f" gnus-article-display-x-face
2123 "l" gnus-summary-stop-page-breaking
2124 "r" gnus-summary-caesar-message
2125 "m" gnus-summary-morse-message
2126 "t" gnus-summary-toggle-header
2127 "g" gnus-treat-smiley
2128 "v" gnus-summary-verbose-headers
2129 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2130 "p" gnus-article-verify-x-pgp-sig
2131 "d" gnus-article-treat-dumbquotes
2132 "U" gnus-article-treat-non-ascii
2133 "i" gnus-summary-idna-message)
2135 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2136 ;; mnemonic: deuglif*Y*
2137 "u" gnus-article-outlook-unwrap-lines
2138 "a" gnus-article-outlook-repair-attribution
2139 "c" gnus-article-outlook-rearrange-citation
2140 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2142 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2143 "a" gnus-article-hide
2144 "h" gnus-article-hide-headers
2145 "b" gnus-article-hide-boring-headers
2146 "s" gnus-article-hide-signature
2147 "c" gnus-article-hide-citation
2148 "C" gnus-article-hide-citation-in-followups
2149 "l" gnus-article-hide-list-identifiers
2150 "B" gnus-article-strip-banner
2151 "P" gnus-article-hide-pem
2152 "\C-c" gnus-article-hide-citation-maybe)
2154 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2155 "a" gnus-article-highlight
2156 "h" gnus-article-highlight-headers
2157 "c" gnus-article-highlight-citation
2158 "s" gnus-article-highlight-signature)
2160 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2161 "f" gnus-article-treat-fold-headers
2162 "u" gnus-article-treat-unfold-headers
2163 "n" gnus-article-treat-fold-newsgroups)
2165 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2166 "x" gnus-article-display-x-face
2167 "d" gnus-article-display-face
2168 "s" gnus-treat-smiley
2169 "D" gnus-article-remove-images
2170 "W" gnus-article-show-images
2171 "f" gnus-treat-from-picon
2172 "m" gnus-treat-mail-picon
2173 "n" gnus-treat-newsgroups-picon
2174 "g" gnus-treat-from-gravatar
2175 "h" gnus-treat-mail-gravatar)
2177 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2178 "w" gnus-article-decode-mime-words
2179 "c" gnus-article-decode-charset
2180 "h" gnus-mime-buttonize-attachments-in-header
2181 "v" gnus-mime-view-all-parts
2182 "b" gnus-article-view-part)
2184 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2185 "z" gnus-article-date-ut
2186 "u" gnus-article-date-ut
2187 "l" gnus-article-date-local
2188 "p" gnus-article-date-english
2189 "e" gnus-article-date-lapsed
2190 "o" gnus-article-date-original
2191 "i" gnus-article-date-iso8601
2192 "s" gnus-article-date-user)
2194 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2195 "t" gnus-article-remove-trailing-blank-lines
2196 "l" gnus-article-strip-leading-blank-lines
2197 "m" gnus-article-strip-multiple-blank-lines
2198 "a" gnus-article-strip-blank-lines
2199 "A" gnus-article-strip-all-blank-lines
2200 "s" gnus-article-strip-leading-space
2201 "e" gnus-article-strip-trailing-space
2202 "w" gnus-article-remove-leading-whitespace)
2204 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2206 "d" gnus-summary-describe-group
2207 "h" gnus-summary-describe-briefly
2208 "i" gnus-info-find-node)
2210 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2211 "e" gnus-summary-expire-articles
2212 "\M-\C-e" gnus-summary-expire-articles-now
2213 "\177" gnus-summary-delete-article
2214 [delete] gnus-summary-delete-article
2215 [backspace] gnus-summary-delete-article
2216 "m" gnus-summary-move-article
2217 "r" gnus-summary-respool-article
2218 "w" gnus-summary-edit-article
2219 "c" gnus-summary-copy-article
2220 "B" gnus-summary-crosspost-article
2221 "q" gnus-summary-respool-query
2222 "t" gnus-summary-respool-trace
2223 "i" gnus-summary-import-article
2224 "I" gnus-summary-create-article
2225 "p" gnus-summary-article-posted-p)
2227 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2228 "o" gnus-summary-save-article
2229 "m" gnus-summary-save-article-mail
2230 "F" gnus-summary-write-article-file
2231 "r" gnus-summary-save-article-rmail
2232 "f" gnus-summary-save-article-file
2233 "b" gnus-summary-save-article-body-file
2234 "B" gnus-summary-write-article-body-file
2235 "h" gnus-summary-save-article-folder
2236 "v" gnus-summary-save-article-vm
2237 "p" gnus-summary-pipe-output
2238 "P" gnus-summary-muttprint)
2240 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2241 "b" gnus-summary-display-buttonized
2242 "m" gnus-summary-repair-multipart
2243 "v" gnus-article-view-part
2244 "o" gnus-article-save-part
2245 "O" gnus-article-save-part-and-strip
2246 "r" gnus-article-replace-part
2247 "d" gnus-article-delete-part
2248 "t" gnus-article-view-part-as-type
2249 "j" gnus-article-jump-to-part
2250 "c" gnus-article-copy-part
2251 "C" gnus-article-view-part-as-charset
2252 "e" gnus-article-view-part-externally
2253 "H" gnus-article-browse-html-article
2254 "E" gnus-article-encrypt-body
2255 "i" gnus-article-inline-part
2256 "|" gnus-article-pipe-part)
2258 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2259 "p" gnus-summary-mark-as-processable
2260 "u" gnus-summary-unmark-as-processable
2261 "U" gnus-summary-unmark-all-processable
2262 "v" gnus-uu-mark-over
2263 "s" gnus-uu-mark-series
2264 "r" gnus-uu-mark-region
2265 "g" gnus-uu-unmark-region
2266 "R" gnus-uu-mark-by-regexp
2267 "G" gnus-uu-unmark-by-regexp
2268 "t" gnus-uu-mark-thread
2269 "T" gnus-uu-unmark-thread
2270 "a" gnus-uu-mark-all
2271 "b" gnus-uu-mark-buffer
2272 "S" gnus-uu-mark-sparse
2273 "k" gnus-summary-kill-process-mark
2274 "y" gnus-summary-yank-process-mark
2275 "w" gnus-summary-save-process-mark
2276 "i" gnus-uu-invert-processable)
2278 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2279 ;;"x" gnus-uu-extract-any
2280 "m" gnus-summary-save-parts
2281 "u" gnus-uu-decode-uu
2282 "U" gnus-uu-decode-uu-and-save
2283 "s" gnus-uu-decode-unshar
2284 "S" gnus-uu-decode-unshar-and-save
2285 "o" gnus-uu-decode-save
2286 "O" gnus-uu-decode-save
2287 "b" gnus-uu-decode-binhex
2288 "B" gnus-uu-decode-binhex
2289 "Y" gnus-uu-decode-yenc
2290 "p" gnus-uu-decode-postscript
2291 "P" gnus-uu-decode-postscript-and-save)
2294 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2295 "u" gnus-uu-decode-uu-view
2296 "U" gnus-uu-decode-uu-and-save-view
2297 "s" gnus-uu-decode-unshar-view
2298 "S" gnus-uu-decode-unshar-and-save-view
2299 "o" gnus-uu-decode-save-view
2300 "O" gnus-uu-decode-save-view
2301 "b" gnus-uu-decode-binhex-view
2302 "B" gnus-uu-decode-binhex-view
2303 "p" gnus-uu-decode-postscript-view
2304 "P" gnus-uu-decode-postscript-and-save-view)
2306 (defvar gnus-article-post-menu nil)
2308 (defconst gnus-summary-menu-maxlen 20)
2310 (defun gnus-summary-menu-split (menu)
2311 ;; If we have lots of elements, divide them into groups of 20
2312 ;; and make a pane (or submenu) for each one.
2313 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2314 (let ((menu menu) sublists next
2317 ;; Pull off the next gnus-summary-menu-maxlen elements
2318 ;; and make them the next element of sublist.
2319 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2321 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2323 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2324 (aref (car (last menu)) 0)) menu)
2328 (nreverse sublists))
2329 ;; Few elements--put them all in one pane.
2332 (defun gnus-summary-make-menu-bar ()
2333 (gnus-turn-off-edit-menu 'summary)
2335 (unless (boundp 'gnus-summary-misc-menu)
2338 gnus-summary-kill-menu gnus-summary-mode-map ""
2343 ["Customize" gnus-score-customize t])
2344 (gnus-make-score-map 'increase)
2345 (gnus-make-score-map 'lower)
2347 ["Kill below" gnus-summary-kill-below t]
2348 ["Mark above" gnus-summary-mark-above t]
2349 ["Tick above" gnus-summary-tick-above t]
2350 ["Clear above" gnus-summary-clear-above t])
2351 ["Current article score" gnus-summary-current-score t]
2352 ["Current thread score" (gnus-summary-current-score 'total) t]
2353 ["Set score" gnus-summary-set-score t]
2354 ["Switch current score file..." gnus-score-change-score-file t]
2355 ["Set mark below..." gnus-score-set-mark-below t]
2356 ["Set expunge below..." gnus-score-set-expunge-below t]
2357 ["Edit current score file" gnus-score-edit-current-scores t]
2358 ["Edit score file..." gnus-score-edit-file t]
2359 ["Trace score" gnus-score-find-trace t]
2360 ["Find words" gnus-score-find-favourite-words t]
2361 ["Rescore buffer" gnus-summary-rescore t]
2362 ["Increase score..." gnus-summary-increase-score t]
2363 ["Lower score..." gnus-summary-lower-score t]))))
2365 ;; Define both the Article menu in the summary buffer and the
2366 ;; equivalent Commands menu in the article buffer here for
2370 ["All" gnus-article-hide t]
2371 ["Headers" gnus-article-hide-headers t]
2372 ["Signature" gnus-article-hide-signature t]
2373 ["Citation" gnus-article-hide-citation t]
2374 ["List identifiers" gnus-article-hide-list-identifiers t]
2375 ["Banner" gnus-article-strip-banner t]
2376 ["Boring headers" gnus-article-hide-boring-headers t])
2378 ["All" gnus-article-highlight t]
2379 ["Headers" gnus-article-highlight-headers t]
2380 ["Signature" gnus-article-highlight-signature t]
2381 ["Citation" gnus-article-highlight-citation t])
2383 ["Words" gnus-article-decode-mime-words t]
2384 ["Charset" gnus-article-decode-charset t]
2385 ["QP" gnus-article-de-quoted-unreadable t]
2386 ["Base64" gnus-article-de-base64-unreadable t]
2387 ["View MIME buttons" gnus-summary-display-buttonized t]
2388 ["View MIME buttons in header"
2389 gnus-mime-buttonize-attachments-in-header t]
2390 ["View all" gnus-mime-view-all-parts t]
2391 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2392 ["Encrypt body" gnus-article-encrypt-body
2393 :active (not (gnus-group-read-only-p))
2394 :help "Encrypt the message body on disk"]
2395 ["Extract all parts..." gnus-summary-save-parts t]
2397 ["Repair multipart" gnus-summary-repair-multipart t]
2398 ["Pipe part..." gnus-article-pipe-part t]
2399 ["Inline part" gnus-article-inline-part t]
2400 ["View part as type..." gnus-article-view-part-as-type t]
2401 ["Encrypt body" gnus-article-encrypt-body
2402 :active (not (gnus-group-read-only-p))
2403 :help "Encrypt the message body on disk"]
2404 ["View part externally" gnus-article-view-part-externally t]
2405 ["View HTML parts in browser" gnus-article-browse-html-article t]
2406 ["View part with charset..." gnus-article-view-part-as-charset t]
2407 ["Copy part" gnus-article-copy-part t]
2408 ["Save part..." gnus-article-save-part t]
2409 ["View part" gnus-article-view-part t]))
2411 ["Local" gnus-article-date-local t]
2412 ["ISO8601" gnus-article-date-iso8601 t]
2413 ["UT" gnus-article-date-ut t]
2414 ["Original" gnus-article-date-original t]
2415 ["Lapsed" gnus-article-date-lapsed t]
2416 ["User-defined" gnus-article-date-user t])
2418 ["Display HTML images" gnus-article-show-images t]
2419 ["Remove images" gnus-article-remove-images t]
2420 ["Toggle smiley" gnus-treat-smiley t]
2421 ["Show X-Face" gnus-article-display-x-face t]
2422 ["Show picons in From" gnus-treat-from-picon t]
2423 ["Show picons in mail headers" gnus-treat-mail-picon t]
2424 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2425 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2426 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2427 ("View as different encoding"
2428 ,@(gnus-summary-menu-split
2431 ;; Since easymenu under Emacs doesn't allow
2432 ;; lambda forms for menu commands, we should
2433 ;; provide intern'ed function symbols.
2434 (let ((command (intern (format "\
2435 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2439 (let ((gnus-summary-show-article-charset-alist
2441 (gnus-summary-show-article 1))))
2442 `[,(symbol-name cs) ,command t]))
2443 (sort (coding-system-list) 'string<)))))
2446 ["Leading" gnus-article-strip-leading-blank-lines t]
2447 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2448 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2449 ["All of the above" gnus-article-strip-blank-lines t]
2450 ["All" gnus-article-strip-all-blank-lines t]
2451 ["Leading space" gnus-article-strip-leading-space t]
2452 ["Trailing space" gnus-article-strip-trailing-space t]
2453 ["Leading space in headers"
2454 gnus-article-remove-leading-whitespace t])
2455 ["Overstrike" gnus-article-treat-overstrike t]
2456 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2457 ["Non-ASCII" gnus-article-treat-non-ascii t]
2458 ["Emphasis" gnus-article-emphasize t]
2459 ["Word wrap" gnus-article-fill-cited-article t]
2460 ["Fill long lines" gnus-article-fill-long-lines t]
2461 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2462 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2463 ["Remove CR" gnus-article-remove-cr t]
2464 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2465 ["Base64" gnus-article-de-base64-unreadable t]
2466 ["Rot 13" gnus-summary-caesar-message
2467 :help "\"Caesar rotate\" article by 13"]
2468 ["De-IDNA" gnus-summary-idna-message t]
2469 ["Morse decode" gnus-summary-morse-message t]
2470 ["Unix pipe..." gnus-summary-pipe-message t]
2471 ["Add buttons" gnus-article-add-buttons t]
2472 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2473 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2474 ["Verbose header" gnus-summary-verbose-headers t]
2475 ["Toggle header" gnus-summary-toggle-header t]
2476 ["Unfold headers" gnus-article-treat-unfold-headers t]
2477 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2478 ["Html" gnus-article-wash-html t]
2479 ["Unsplit URLs" gnus-article-unsplit-urls t]
2480 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2481 ["Decode HZ" gnus-article-decode-HZ t]
2482 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2483 ("(Outlook) Deuglify"
2484 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2485 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2486 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2487 ["Full (Outlook) deuglify"
2488 gnus-article-outlook-deuglify-article t])
2491 ["Save in default format..." gnus-summary-save-article
2492 :help "Save article using default method"]
2493 ["Save in file..." gnus-summary-save-article-file
2494 :help "Save article in file"]
2495 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2496 ["Save in MH folder..." gnus-summary-save-article-folder t]
2497 ["Save in VM folder..." gnus-summary-save-article-vm t]
2498 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2499 ["Save body in file..." gnus-summary-save-article-body-file t]
2500 ["Pipe through a filter..." gnus-summary-pipe-output t]
2501 ["Print with Muttprint..." gnus-summary-muttprint t]
2502 ["Print" gnus-summary-print-article
2503 :help "Generate and print a PostScript image"])
2504 ("Copy, move,... (Backend)"
2505 :help "Copying, moving, expiring articles..."
2506 ["Respool article..." gnus-summary-respool-article t]
2507 ["Move article..." gnus-summary-move-article
2508 (gnus-check-backend-function
2509 'request-move-article gnus-newsgroup-name)]
2510 ["Copy article..." gnus-summary-copy-article t]
2511 ["Crosspost article..." gnus-summary-crosspost-article
2512 (gnus-check-backend-function
2513 'request-replace-article gnus-newsgroup-name)]
2514 ["Import file..." gnus-summary-import-article
2515 (gnus-check-backend-function
2516 'request-accept-article gnus-newsgroup-name)]
2517 ["Create article..." gnus-summary-create-article
2518 (gnus-check-backend-function
2519 'request-accept-article gnus-newsgroup-name)]
2520 ["Check if posted" gnus-summary-article-posted-p t]
2521 ["Edit article" gnus-summary-edit-article
2522 (not (gnus-group-read-only-p))]
2523 ["Delete article" gnus-summary-delete-article
2524 (gnus-check-backend-function
2525 'request-expire-articles gnus-newsgroup-name)]
2526 ["Query respool" gnus-summary-respool-query t]
2527 ["Trace respool" gnus-summary-respool-trace t]
2528 ["Delete expirable articles" gnus-summary-expire-articles-now
2529 (gnus-check-backend-function
2530 'request-expire-articles gnus-newsgroup-name)])
2532 ["Uudecode" gnus-uu-decode-uu :help "Decode uuencoded article(s)"]
2533 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2534 ["Unshar" gnus-uu-decode-unshar t]
2535 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2536 ["Save" gnus-uu-decode-save t]
2537 ["Binhex" gnus-uu-decode-binhex t]
2538 ["PostScript" gnus-uu-decode-postscript t]
2539 ["All MIME parts" gnus-summary-save-parts t])
2541 ["Enter article" gnus-cache-enter-article t]
2542 ["Remove article" gnus-cache-remove-article t])
2543 ["Translate" gnus-article-babel t]
2544 ["Select article buffer" gnus-summary-select-article-buffer t]
2545 ["Make article buffer sticky" gnus-sticky-article t]
2546 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2547 ["Isearch article..." gnus-summary-isearch-article t]
2548 ["Beginning of the article" gnus-summary-beginning-of-article t]
2549 ["End of the article" gnus-summary-end-of-article t]
2550 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2551 ["Fetch referenced articles" gnus-summary-refer-references t]
2552 ["Fetch current thread" gnus-summary-refer-thread t]
2553 ["Fetch article with id..." gnus-summary-refer-article t]
2554 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2555 ["Redisplay" gnus-summary-show-article t]
2556 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2558 gnus-summary-article-menu gnus-summary-mode-map ""
2559 (cons "Article" innards))
2561 (if (not (keymapp gnus-summary-article-menu))
2563 gnus-article-commands-menu gnus-article-mode-map ""
2564 (cons "Commands" innards))
2565 ;; Don't share the menu.
2566 (setq gnus-article-commands-menu
2567 (copy-keymap gnus-summary-article-menu))
2568 (define-key gnus-article-mode-map [menu-bar commands]
2569 (cons "Commands" gnus-article-commands-menu))))
2572 gnus-summary-thread-menu gnus-summary-mode-map ""
2574 ["Find all messages in thread" gnus-summary-refer-thread t]
2575 ["Toggle threading" gnus-summary-toggle-threads t]
2576 ["Hide threads" gnus-summary-hide-all-threads t]
2577 ["Show threads" gnus-summary-show-all-threads t]
2578 ["Hide thread" gnus-summary-hide-thread t]
2579 ["Show thread" gnus-summary-show-thread t]
2580 ["Go to next thread" gnus-summary-next-thread t]
2581 ["Go to previous thread" gnus-summary-prev-thread t]
2582 ["Go down thread" gnus-summary-down-thread t]
2583 ["Go up thread" gnus-summary-up-thread t]
2584 ["Top of thread" gnus-summary-top-thread t]
2585 ["Mark thread as read" gnus-summary-kill-thread t]
2586 ["Mark thread as expired" gnus-summary-expire-thread t]
2587 ["Lower thread score" gnus-summary-lower-thread t]
2588 ["Raise thread score" gnus-summary-raise-thread t]
2589 ["Rethread current" gnus-summary-rethread-current t]))
2592 gnus-summary-post-menu gnus-summary-mode-map ""
2594 ["Send a message (mail or news)" gnus-summary-post-news
2595 :help "Compose a new message (mail or news)"]
2596 ["Followup" gnus-summary-followup
2597 :help "Post followup to this article"]
2598 ["Followup and yank" gnus-summary-followup-with-original
2599 :help "Post followup to this article, quoting its contents"]
2600 ["Supersede article" gnus-summary-supersede-article t]
2601 ["Cancel article" gnus-summary-cancel-article
2602 :help "Cancel an article you posted"]
2603 ["Reply" gnus-summary-reply t]
2604 ["Reply and yank" gnus-summary-reply-with-original t]
2605 ["Wide reply" gnus-summary-wide-reply t]
2606 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2607 :help "Mail a reply, quoting this article"]
2608 ["Very wide reply" gnus-summary-very-wide-reply t]
2609 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2610 :help "Mail a very wide reply, quoting this article"]
2611 ["Mail forward" gnus-summary-mail-forward t]
2612 ["Post forward" gnus-summary-post-forward t]
2613 ["Digest and mail" gnus-uu-digest-mail-forward t]
2614 ["Digest and post" gnus-uu-digest-post-forward t]
2615 ["Resend message" gnus-summary-resend-message t]
2616 ["Resend message edit" gnus-summary-resend-message-edit t]
2617 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2618 ["Send a mail" gnus-summary-mail-other-window t]
2619 ["Create a local message" gnus-summary-news-other-window t]
2620 ["Uuencode and post" gnus-uu-post-news
2621 :help "Post a uuencoded article"]
2622 ["Followup via news" gnus-summary-followup-to-mail t]
2623 ["Followup via news and yank"
2624 gnus-summary-followup-to-mail-with-original t]
2625 ["Strip signature on reply"
2628 (setq message-cite-function
2629 (if (eq message-cite-function
2630 'message-cite-original-without-signature)
2631 'message-cite-original
2632 'message-cite-original-without-signature)))
2633 :visible (memq message-cite-function
2634 '(message-cite-original-without-signature
2635 message-cite-original))
2637 :selected (eq message-cite-function
2638 'message-cite-original-without-signature)
2639 :help "Strip signature from cited article when replying."]))
2642 ((not (keymapp gnus-summary-post-menu))
2643 (setq gnus-article-post-menu gnus-summary-post-menu))
2644 ((not gnus-article-post-menu)
2645 ;; Don't share post menu.
2646 (setq gnus-article-post-menu
2647 (copy-keymap gnus-summary-post-menu))))
2648 (define-key gnus-article-mode-map [menu-bar post]
2649 (cons "Post" gnus-article-post-menu))
2652 gnus-summary-misc-menu gnus-summary-mode-map ""
2655 ["Mark as read" gnus-summary-mark-as-read-forward t]
2656 ["Mark same subject and select"
2657 gnus-summary-kill-same-subject-and-select t]
2658 ["Mark same subject" gnus-summary-kill-same-subject t]
2659 ["Catchup" gnus-summary-catchup
2660 :help "Mark unread articles in this group as read"]
2661 ["Catchup all" gnus-summary-catchup-all t]
2662 ["Catchup to here" gnus-summary-catchup-to-here t]
2663 ["Catchup from here" gnus-summary-catchup-from-here t]
2664 ["Catchup region" gnus-summary-mark-region-as-read mark-active]
2665 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2667 ["Tick" gnus-summary-tick-article-forward t]
2668 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2669 ["Remove marks" gnus-summary-clear-mark-forward t]
2670 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2671 ["Set bookmark" gnus-summary-set-bookmark t]
2672 ["Remove bookmark" gnus-summary-remove-bookmark t])
2674 ["Marks..." gnus-summary-limit-to-marks t]
2675 ["Subject..." gnus-summary-limit-to-subject t]
2676 ["Author..." gnus-summary-limit-to-author t]
2677 ["Recipient..." gnus-summary-limit-to-recipient t]
2678 ["Address..." gnus-summary-limit-to-address t]
2679 ["Age..." gnus-summary-limit-to-age t]
2680 ["Extra..." gnus-summary-limit-to-extra t]
2681 ["Score..." gnus-summary-limit-to-score t]
2682 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2683 ["Unread" gnus-summary-limit-to-unread t]
2684 ["Unseen" gnus-summary-limit-to-unseen t]
2685 ["Singletons" gnus-summary-limit-to-singletons t]
2686 ["Replied" gnus-summary-limit-to-replied t]
2687 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2688 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2689 ["Pop limit" gnus-summary-pop-limit t]
2690 ["Show dormant" gnus-summary-limit-include-dormant t]
2691 ["Hide childless dormant"
2692 gnus-summary-limit-exclude-childless-dormant t]
2693 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2694 ["Hide marked" gnus-summary-limit-exclude-marks t]
2695 ["Show expunged" gnus-summary-limit-include-expunged t])
2697 ["Set mark" gnus-summary-mark-as-processable t]
2698 ["Remove mark" gnus-summary-unmark-as-processable t]
2699 ["Remove all marks" gnus-summary-unmark-all-processable t]
2700 ["Invert marks" gnus-uu-invert-processable t]
2701 ["Mark above" gnus-uu-mark-over t]
2702 ["Mark series" gnus-uu-mark-series t]
2703 ["Mark region" gnus-uu-mark-region mark-active]
2704 ["Unmark region" gnus-uu-unmark-region mark-active]
2705 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2706 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2707 ["Mark all" gnus-uu-mark-all t]
2708 ["Mark buffer" gnus-uu-mark-buffer t]
2709 ["Mark sparse" gnus-uu-mark-sparse t]
2710 ["Mark thread" gnus-uu-mark-thread t]
2711 ["Unmark thread" gnus-uu-unmark-thread t]
2712 ("Process Mark Sets"
2713 ["Kill" gnus-summary-kill-process-mark t]
2714 ["Yank" gnus-summary-yank-process-mark
2715 gnus-newsgroup-process-stack]
2716 ["Save" gnus-summary-save-process-mark t]
2717 ["Run command on marked..." gnus-summary-universal-argument t]))
2720 ["Page forward" gnus-summary-next-page
2721 :help "Show next page of article"]
2722 ["Page backward" gnus-summary-prev-page
2723 :help "Show previous page of article"]
2724 ["Line forward" gnus-summary-scroll-up t])
2726 ["Next unread article" gnus-summary-next-unread-article t]
2727 ["Previous unread article" gnus-summary-prev-unread-article t]
2728 ["Next article" gnus-summary-next-article t]
2729 ["Previous article" gnus-summary-prev-article t]
2730 ["Next unread subject" gnus-summary-next-unread-subject t]
2731 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2732 ["Next article same subject" gnus-summary-next-same-subject t]
2733 ["Previous article same subject" gnus-summary-prev-same-subject t]
2734 ["First unread article" gnus-summary-first-unread-article t]
2735 ["Best unread article" gnus-summary-best-unread-article t]
2736 ["Go to subject number..." gnus-summary-goto-subject t]
2737 ["Go to article number..." gnus-summary-goto-article t]
2738 ["Go to the last article" gnus-summary-goto-last-article t]
2739 ["Pop article off history" gnus-summary-pop-article t])
2741 ["Sort by number" gnus-summary-sort-by-number t]
2742 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2743 ["Sort by author" gnus-summary-sort-by-author t]
2744 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2745 ["Sort by subject" gnus-summary-sort-by-subject t]
2746 ["Sort by date" gnus-summary-sort-by-date t]
2747 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2748 ["Sort by score" gnus-summary-sort-by-score t]
2749 ["Sort by lines" gnus-summary-sort-by-lines t]
2750 ["Sort by characters" gnus-summary-sort-by-chars t]
2751 ["Randomize" gnus-summary-sort-by-random t]
2752 ["Original sort" gnus-summary-sort-by-original t])
2754 ["Describe group" gnus-summary-describe-group t]
2755 ["Read manual" gnus-info-find-node t])
2757 ["Pick and read" gnus-pick-mode t]
2758 ["Binary" gnus-binary-mode t])
2760 ["Regenerate" gnus-summary-prepare t]
2761 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2762 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2763 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2764 ["Toggle threading" gnus-summary-toggle-threads t])
2765 ["See old articles" gnus-summary-insert-old-articles t]
2766 ["See new articles" gnus-summary-insert-new-articles t]
2767 ["Filter articles..." gnus-summary-execute-command t]
2768 ["Run command on articles..." gnus-summary-universal-argument t]
2769 ["Search articles forward..." gnus-summary-search-article-forward t]
2770 ["Search articles backward..." gnus-summary-search-article-backward t]
2771 ["Toggle line truncation" toggle-truncate-lines t]
2772 ["Expand window" gnus-summary-expand-window t]
2773 ["Expire expirable articles" gnus-summary-expire-articles
2774 (gnus-check-backend-function
2775 'request-expire-articles gnus-newsgroup-name)]
2776 ["Edit local kill file" gnus-summary-edit-local-kill t]
2777 ["Edit main kill file" gnus-summary-edit-global-kill t]
2778 ["Edit group parameters" gnus-summary-edit-parameters t]
2779 ["Customize group parameters" gnus-summary-customize-parameters t]
2780 ["Send a bug report" gnus-bug t]
2782 ["Catchup and exit" gnus-summary-catchup-and-exit
2783 :help "Mark unread articles in this group as read, then exit"]
2784 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2785 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2786 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2787 ["Exit group" gnus-summary-exit
2788 :help "Exit current group, return to group selection mode"]
2789 ["Exit group without updating" gnus-summary-exit-no-update t]
2790 ["Exit and goto next group" gnus-summary-next-group t]
2791 ["Exit and goto prev group" gnus-summary-prev-group t]
2792 ["Reselect group" gnus-summary-reselect-current-group t]
2793 ["Rescan group" gnus-summary-rescan-group t]
2794 ["Update dribble" gnus-summary-save-newsrc t])))
2796 (gnus-run-hooks 'gnus-summary-menu-hook)))
2798 (defvar gnus-summary-tool-bar-map nil)
2800 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2801 ;; affect _new_ message buffers. We might add a function that walks thru all
2802 ;; summary-mode buffers and force the update.
2803 (defun gnus-summary-tool-bar-update (&optional symbol value)
2804 "Update summary mode toolbar.
2805 Setter function for custom variables."
2806 (setq-default gnus-summary-tool-bar-map nil)
2808 ;; When used as ":set" function:
2809 (set-default symbol value))
2810 (when (gnus-buffer-live-p gnus-summary-buffer)
2811 (with-current-buffer gnus-summary-buffer
2812 (gnus-summary-make-tool-bar))))
2814 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2815 'gnus-summary-tool-bar-gnome
2816 'gnus-summary-tool-bar-retro)
2817 "Specifies the Gnus summary tool bar.
2819 It can be either a list or a symbol referring to a list. See
2820 `gmm-tool-bar-from-list' for the format of the list. The
2821 default key map is `gnus-summary-mode-map'.
2823 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2824 `gnus-summary-tool-bar-retro'."
2825 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2826 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2827 (repeat :tag "User defined list" gmm-tool-bar-item)
2829 :version "23.1" ;; No Gnus
2830 :initialize 'custom-initialize-default
2831 :set 'gnus-summary-tool-bar-update
2832 :group 'gnus-summary)
2834 (defcustom gnus-summary-tool-bar-gnome
2835 '((gnus-summary-post-news "mail/compose" nil)
2836 (gnus-summary-insert-new-articles "mail/inbox" nil
2837 :visible (or (not gnus-agent)
2839 (gnus-summary-reply-with-original "mail/reply")
2840 (gnus-summary-reply "mail/reply" nil :visible nil)
2841 (gnus-summary-followup-with-original "mail/reply-all")
2842 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2843 (gnus-summary-mail-forward "mail/forward")
2844 (gnus-summary-save-article "mail/save")
2845 (gnus-summary-search-article-forward "search" nil :visible nil)
2846 (gnus-summary-print-article "print")
2847 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2848 ;; Some new commands that may need more suitable icons:
2849 (gnus-summary-save-newsrc "save" nil :visible nil)
2850 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2851 (gnus-summary-prev-article "left-arrow")
2852 (gnus-summary-next-article "right-arrow")
2853 (gnus-summary-next-page "next-page")
2854 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2856 ;; Maybe some sort-by-... could be added:
2857 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2858 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2859 (gnus-summary-mark-as-expirable
2861 :visible (gnus-check-backend-function 'request-expire-articles
2862 gnus-newsgroup-name))
2863 (gnus-summary-mark-as-spam
2865 :visible (and (fboundp 'spam-group-ham-contents-p)
2866 (spam-group-ham-contents-p gnus-newsgroup-name))
2867 :help "Mark as spam")
2868 (gnus-summary-mark-as-read-forward
2870 :visible (and (fboundp 'spam-group-spam-contents-p)
2871 (spam-group-spam-contents-p gnus-newsgroup-name)))
2873 (gnus-summary-exit "exit")
2874 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2875 (gnus-info-find-node "help"))
2876 "List of functions for the summary tool bar (GNOME style).
2878 See `gmm-tool-bar-from-list' for the format of the list."
2879 :type '(repeat gmm-tool-bar-item)
2880 :version "23.1" ;; No Gnus
2881 :initialize 'custom-initialize-default
2882 :set 'gnus-summary-tool-bar-update
2883 :group 'gnus-summary)
2885 (defcustom gnus-summary-tool-bar-retro
2886 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2887 (gnus-summary-next-unread-article "gnus/next-ur")
2888 (gnus-summary-post-news "gnus/post")
2889 (gnus-summary-followup-with-original "gnus/fuwo")
2890 (gnus-summary-followup "gnus/followup")
2891 (gnus-summary-reply-with-original "gnus/reply-wo")
2892 (gnus-summary-reply "gnus/reply")
2893 (gnus-summary-caesar-message "gnus/rot13")
2894 (gnus-uu-decode-uu "gnus/uu-decode")
2895 (gnus-summary-save-article-file "gnus/save-aif")
2896 (gnus-summary-save-article "gnus/save-art")
2897 (gnus-uu-post-news "gnus/uu-post")
2898 (gnus-summary-catchup "gnus/catchup")
2899 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2900 (gnus-summary-exit "gnus/exit-summ")
2901 ;; Some new command that may need more suitable icons:
2902 (gnus-summary-print-article "gnus/print" nil :visible nil)
2903 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2904 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2905 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2906 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2907 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2908 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2910 (gnus-info-find-node "gnus/help" nil :visible nil))
2911 "List of functions for the summary tool bar (retro look).
2913 See `gmm-tool-bar-from-list' for the format of the list."
2914 :type '(repeat gmm-tool-bar-item)
2915 :version "23.1" ;; No Gnus
2916 :initialize 'custom-initialize-default
2917 :set 'gnus-summary-tool-bar-update
2918 :group 'gnus-summary)
2920 (defcustom gnus-summary-tool-bar-zap-list t
2921 "List of icon items from the global tool bar.
2922 These items are not displayed in the Gnus summary mode tool bar.
2924 See `gmm-tool-bar-from-list' for the format of the list."
2925 :type 'gmm-tool-bar-zap-list
2926 :version "23.1" ;; No Gnus
2927 :initialize 'custom-initialize-default
2928 :set 'gnus-summary-tool-bar-update
2929 :group 'gnus-summary)
2931 (defvar image-load-path)
2932 (defvar tool-bar-map)
2934 (defun gnus-summary-make-tool-bar (&optional force)
2935 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2936 When FORCE, rebuild the tool bar."
2937 (when (and (boundp 'tool-bar-mode)
2939 (or (not gnus-summary-tool-bar-map) force))
2941 (image-load-path-for-library "gnus" "mail/save.xpm" nil t))
2942 (image-load-path (cons (car load-path) image-load-path))
2943 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2944 gnus-summary-tool-bar-zap-list
2945 'gnus-summary-mode-map)))
2947 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2949 (setq gnus-summary-tool-bar-map map))))
2950 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2952 (defun gnus-make-score-map (type)
2953 "Make a summary score map of type TYPE."
2956 (let ((headers '(("author" "from" string)
2957 ("subject" "subject" string)
2958 ("article body" "body" string)
2959 ("article head" "head" string)
2960 ("xref" "xref" string)
2961 ("extra header" "extra" string)
2962 ("lines" "lines" number)
2963 ("followups to author" "followup" string)))
2964 (types '((number ("less than" <)
2967 (string ("substring" s)
2971 (perms '(("temporary" (current-time-string))
2979 (if (eq type 'lower)
2984 (setq header (car headers))
2990 (let ((ts (cdr (assoc (nth 2 header) types)))
3006 'gnus-summary-score-entry
3008 (if (or (string= (nth 1 header)
3010 (string= (nth 1 header)
3013 (list 'gnus-summary-header
3015 (list 'quote (nth 1 (car ts)))
3016 (list 'gnus-score-delta-default
3023 (list (nreverse outp))))
3026 (list (nreverse outt))))
3028 (setq headers (cdr headers)))
3029 (list (nreverse outh))))))))
3032 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3033 (defvar bookmark-make-record-function)
3035 (defvar bidi-paragraph-direction)
3037 (defun gnus-summary-mode (&optional group)
3038 "Major mode for reading articles.
3040 All normal editing commands are switched off.
3041 \\<gnus-summary-mode-map>
3042 Each line in this buffer represents one article. To read an
3043 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3044 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3047 You can also post articles and send mail from this buffer. To
3048 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3049 of an article, type `\\[gnus-summary-reply]'.
3051 There are approx. one gazillion commands you can execute in this
3052 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3054 The following commands are available:
3056 \\{gnus-summary-mode-map}"
3057 ;; FIXME: Use define-derived-mode.
3059 (kill-all-local-variables)
3060 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3061 (gnus-summary-make-local-variables))
3062 (gnus-summary-make-local-variables)
3063 (setq gnus-newsgroup-name group)
3064 (when (gnus-visual-p 'summary-menu 'menu)
3065 (gnus-summary-make-menu-bar)
3066 (gnus-summary-make-tool-bar))
3067 (gnus-make-thread-indent-array)
3068 (gnus-simplify-mode-line)
3069 (setq major-mode 'gnus-summary-mode)
3070 (setq mode-name "Summary")
3071 (use-local-map gnus-summary-mode-map)
3072 (buffer-disable-undo)
3073 (setq buffer-read-only t
3074 show-trailing-whitespace nil
3076 bidi-paragraph-direction 'left-to-right)
3077 (add-to-invisibility-spec '(gnus-sum . t))
3078 (gnus-summary-set-display-table)
3079 (gnus-set-default-directory)
3080 (make-local-variable 'gnus-summary-line-format)
3081 (make-local-variable 'gnus-summary-line-format-spec)
3082 (make-local-variable 'gnus-summary-dummy-line-format)
3083 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3084 (make-local-variable 'gnus-summary-mark-positions)
3085 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3086 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3087 (turn-on-gnus-mailing-list-mode)
3088 (mm-enable-multibyte)
3089 (set (make-local-variable 'bookmark-make-record-function)
3090 'gnus-summary-bookmark-make-record)
3091 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3092 (gnus-update-summary-mark-positions))
3094 (defun gnus-summary-make-local-variables ()
3095 "Make all the local summary buffer variables."
3097 (dolist (local gnus-summary-local-variables)
3100 (if (eq (cdr local) 'global)
3101 ;; Copy the global value of the variable.
3102 (setq global (symbol-value (car local)))
3103 ;; Use the value from the list.
3104 (setq global (eval (cdr local))))
3105 (set (make-local-variable (car local)) global))
3106 ;; Simple nil-valued local variable.
3107 (set (make-local-variable local) nil)))))
3109 ;; Summary data functions.
3111 (defmacro gnus-data-number (data)
3114 (defmacro gnus-data-set-number (data number)
3115 `(setcar ,data ,number))
3117 (defmacro gnus-data-mark (data)
3120 (defmacro gnus-data-set-mark (data mark)
3121 `(setcar (nthcdr 1 ,data) ,mark))
3123 (defmacro gnus-data-pos (data)
3126 (defmacro gnus-data-set-pos (data pos)
3127 `(setcar (nthcdr 2 ,data) ,pos))
3129 (defmacro gnus-data-header (data)
3132 (defmacro gnus-data-set-header (data header)
3133 `(setf (nth 3 ,data) ,header))
3135 (defmacro gnus-data-level (data)
3138 (defmacro gnus-data-unread-p (data)
3139 `(= (nth 1 ,data) gnus-unread-mark))
3141 (defmacro gnus-data-read-p (data)
3142 `(/= (nth 1 ,data) gnus-unread-mark))
3144 (defmacro gnus-data-pseudo-p (data)
3145 `(consp (nth 3 ,data)))
3147 (defmacro gnus-data-find (number)
3148 `(assq ,number gnus-newsgroup-data))
3150 (defmacro gnus-data-find-list (number &optional data)
3151 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3152 (memq (assq ,number bdata)
3155 (defmacro gnus-data-make (number mark pos header level)
3156 `(list ,number ,mark ,pos ,header ,level))
3158 (defun gnus-data-enter (after-article number mark pos header level offset)
3159 (let ((data (gnus-data-find-list after-article)))
3161 (error "No such article: %d" after-article))
3162 (setcdr data (cons (gnus-data-make number mark pos header level)
3164 (setq gnus-newsgroup-data-reverse nil)
3165 (gnus-data-update-list (cddr data) offset)))
3167 (defun gnus-data-enter-list (after-article list &optional offset)
3169 (let ((data (and after-article (gnus-data-find-list after-article)))
3173 (let ((odata gnus-newsgroup-data))
3174 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3176 (gnus-data-update-list odata offset)))
3177 ;; Find the last element in the list to be spliced into the main
3179 (setq list (last list))
3182 (setcdr list gnus-newsgroup-data)
3183 (setq gnus-newsgroup-data ilist)
3185 (gnus-data-update-list (cdr list) offset)))
3186 (setcdr list (cdr data))
3189 (gnus-data-update-list (cdr list) offset))))
3190 (setq gnus-newsgroup-data-reverse nil))))
3192 (defun gnus-data-remove (article &optional offset)
3193 (let ((data gnus-newsgroup-data))
3194 (if (= (gnus-data-number (car data)) article)
3196 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3197 gnus-newsgroup-data-reverse nil)
3199 (gnus-data-update-list gnus-newsgroup-data offset)))
3201 (when (= (gnus-data-number (cadr data)) article)
3202 (setcdr data (cddr data))
3204 (gnus-data-update-list (cdr data) offset))
3206 gnus-newsgroup-data-reverse nil))
3207 (setq data (cdr data))))))
3209 (defmacro gnus-data-list (backward)
3211 (or gnus-newsgroup-data-reverse
3212 (setq gnus-newsgroup-data-reverse
3213 (reverse gnus-newsgroup-data)))
3214 gnus-newsgroup-data))
3216 (defun gnus-data-update-list (data offset)
3217 "Add OFFSET to the POS of all data entries in DATA."
3218 (setq gnus-newsgroup-data-reverse nil)
3220 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3221 (setq data (cdr data))))
3223 (defun gnus-summary-article-pseudo-p (article)
3224 "Say whether this article is a pseudo article or not."
3225 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3227 (defmacro gnus-summary-article-sparse-p (article)
3228 "Say whether this article is a sparse article or not."
3229 `(memq ,article gnus-newsgroup-sparse))
3231 (defmacro gnus-summary-article-ancient-p (article)
3232 "Say whether this article is a sparse article or not."
3233 `(memq ,article gnus-newsgroup-ancient))
3235 (defun gnus-article-children (number)
3236 "Return a list of all children to NUMBER."
3237 (let* ((data (gnus-data-find-list number))
3238 (level (gnus-data-level (car data)))
3240 (setq data (cdr data))
3242 (= (gnus-data-level (car data)) (1+ level)))
3243 (push (gnus-data-number (car data)) children)
3244 (setq data (cdr data)))
3247 (defmacro gnus-summary-skip-intangible ()
3248 "If the current article is intangible, then jump to a different article."
3249 '(let ((to (get-text-property (point) 'gnus-intangible)))
3250 (and to (gnus-summary-goto-subject to))))
3252 (defmacro gnus-summary-article-intangible-p ()
3253 "Say whether this article is intangible or not."
3254 '(get-text-property (point) 'gnus-intangible))
3256 ;; Some summary mode macros.
3258 (defmacro gnus-summary-article-number ()
3259 "The article number of the article on the current line.
3260 If there isn't an article number here, then we return the current
3263 (gnus-summary-skip-intangible)
3264 (or (get-text-property (point) 'gnus-number)
3265 (gnus-summary-last-subject))))
3267 (defmacro gnus-summary-article-header (&optional number)
3268 "Return the header of article NUMBER."
3269 `(gnus-data-header (gnus-data-find
3270 ,(or number '(gnus-summary-article-number)))))
3272 (defmacro gnus-summary-thread-level (&optional number)
3273 "Return the level of thread that starts with article NUMBER."
3274 `(if (and (eq gnus-summary-make-false-root 'dummy)
3275 (get-text-property (point) 'gnus-intangible))
3277 (gnus-data-level (gnus-data-find
3278 ,(or number '(gnus-summary-article-number))))))
3280 (defmacro gnus-summary-article-mark (&optional number)
3281 "Return the mark of article NUMBER."
3282 `(gnus-data-mark (gnus-data-find
3283 ,(or number '(gnus-summary-article-number)))))
3285 (defmacro gnus-summary-article-pos (&optional number)
3286 "Return the position of the line of article NUMBER."
3287 `(gnus-data-pos (gnus-data-find
3288 ,(or number '(gnus-summary-article-number)))))
3290 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3291 (defmacro gnus-summary-article-subject (&optional number)
3292 "Return current subject string or nil if nothing."
3295 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3296 '(gnus-data-header (assq (gnus-summary-article-number)
3297 gnus-newsgroup-data)))))
3300 (mail-header-subject headers))))
3302 (defmacro gnus-summary-article-score (&optional number)
3303 "Return current article score."
3304 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3305 gnus-newsgroup-scored))
3306 gnus-summary-default-score 0))
3308 (defun gnus-summary-article-children (&optional number)
3309 "Return a list of article numbers that are children of article NUMBER."
3310 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3311 (level (gnus-data-level (car data)))
3313 (while (and (setq data (cdr data))
3314 (> (setq l (gnus-data-level (car data))) level))
3315 (and (= (1+ level) l)
3316 (push (gnus-data-number (car data))
3318 (nreverse children)))
3320 (defun gnus-summary-article-parent (&optional number)
3321 "Return the article number of the parent of article NUMBER."
3322 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3323 (gnus-data-list t)))
3324 (level (gnus-data-level (car data))))
3326 () ; This is a root.
3327 ;; We search until we find an article with a level less than
3328 ;; this one. That function has to be the parent.
3329 (while (and (setq data (cdr data))
3330 (not (< (gnus-data-level (car data)) level))))
3331 (and data (gnus-data-number (car data))))))
3333 (defun gnus-unread-mark-p (mark)
3334 "Say whether MARK is the unread mark."
3335 (= mark gnus-unread-mark))
3337 (defun gnus-read-mark-p (mark)
3338 "Say whether MARK is one of the marks that mark as read.
3339 This is all marks except unread, ticked, dormant, and expirable."
3340 (not (or (= mark gnus-unread-mark)
3341 (= mark gnus-ticked-mark)
3342 (= mark gnus-spam-mark)
3343 (= mark gnus-dormant-mark)
3344 (= mark gnus-expirable-mark))))
3346 (defmacro gnus-article-mark (number)
3347 "Return the MARK of article NUMBER.
3348 This macro should only be used when computing the mark the \"first\"
3349 time; i.e., when generating the summary lines. After that,
3350 `gnus-summary-article-mark' should be used to examine the
3353 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3354 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3355 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3356 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3357 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3358 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3359 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3360 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3361 gnus-ancient-mark))))
3363 ;; Saving hidden threads.
3365 (defmacro gnus-save-hidden-threads (&rest forms)
3366 "Save hidden threads, eval FORMS, and restore the hidden threads."
3367 (let ((config (make-symbol "config")))
3368 `(let ((,config (gnus-hidden-threads-configuration)))
3372 (gnus-restore-hidden-threads-configuration ,config)))))
3373 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3374 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3376 (defun gnus-data-compute-positions ()
3377 "Compute the positions of all articles."
3378 (setq gnus-newsgroup-data-reverse nil)
3379 (let ((data gnus-newsgroup-data))
3381 (gnus-save-hidden-threads
3382 (gnus-summary-show-all-threads)
3383 (goto-char (point-min))
3385 (while (get-text-property (point) 'gnus-intangible)
3387 (gnus-data-set-pos (car data) (+ (point) 3))
3388 (setq data (cdr data))
3389 (forward-line 1))))))
3391 (defun gnus-hidden-threads-configuration ()
3392 "Return the current hidden threads configuration."
3395 (goto-char (point-min))
3397 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3398 (push (save-excursion (forward-line 0) (point)) config))
3402 (defun gnus-restore-hidden-threads-configuration (config)
3403 "Restore hidden threads configuration from CONFIG."
3405 (let (point (inhibit-read-only t))
3406 (while (setq point (pop config))
3408 (gnus-summary-hide-thread)))))
3410 ;; Various summary mode internalish functions.
3412 (defun gnus-mouse-pick-article (e)
3415 (gnus-summary-next-page nil t))
3417 (defun gnus-summary-set-display-table ()
3418 "Change the display table.
3419 Odd characters have a tendency to mess
3420 up nicely formatted displays - we make all possible glyphs
3421 display only a single character."
3423 ;; We start from the standard display table, if any.
3424 (let ((table (or (copy-sequence standard-display-table)
3425 (make-display-table)))
3427 ;; Nix out all the control chars...
3428 (while (>= (setq i (1- i)) 0)
3429 (aset table i [??]))
3430 ;; ... but not newline and cr, of course. (cr is necessary for the
3431 ;; selective display).
3432 (aset table ?\n nil)
3433 (aset table ?\r nil)
3434 ;; We keep TAB as well.
3435 (aset table ?\t nil)
3436 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3437 ;; Emacs 23 (unicode), that are not set already.
3438 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3441 (while (>= (setq i (1- i)) 127)
3442 ;; Only modify if the entry is nil.
3443 (unless (aref table i)
3444 (aset table i [??]))))
3445 (setq buffer-display-table table)))
3447 (defun gnus-summary-set-article-display-arrow (pos)
3448 "Update the overlay arrow to point to line at position POS."
3449 (when gnus-summary-display-arrow
3450 (make-local-variable 'overlay-arrow-position)
3451 (make-local-variable 'overlay-arrow-string)
3455 (unless overlay-arrow-position
3456 (setq overlay-arrow-position (make-marker)))
3457 (setq overlay-arrow-string "=>"
3458 overlay-arrow-position (set-marker overlay-arrow-position
3460 (current-buffer))))))
3462 (defun gnus-summary-setup-buffer (group)
3463 "Initialize summary buffer.
3464 If the setup was successful, non-nil is returned."
3465 (let ((buffer (gnus-summary-buffer-name group))
3466 (dead-name (concat "*Dead Summary "
3467 (gnus-group-decoded-name group) "*")))
3468 ;; If a dead summary buffer exists, we kill it.
3469 (when (gnus-buffer-live-p dead-name)
3470 (gnus-kill-buffer dead-name))
3471 (if (get-buffer buffer)
3474 (setq gnus-summary-buffer (current-buffer))
3475 (not gnus-newsgroup-prepared))
3476 (set-buffer (gnus-get-buffer-create buffer))
3477 (setq gnus-summary-buffer (current-buffer))
3478 (gnus-summary-mode group)
3479 (when (gnus-group-quit-config group)
3480 (set (make-local-variable 'gnus-single-article-buffer) nil))
3481 (make-local-variable 'gnus-article-buffer)
3482 (make-local-variable 'gnus-article-current)
3483 (make-local-variable 'gnus-original-article-buffer)
3484 (setq gnus-newsgroup-name group)
3485 ;; Set any local variables in the group parameters.
3486 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3489 (defun gnus-set-global-variables ()
3490 "Set the global equivalents of the buffer-local variables.
3491 They are set to the latest values they had. These reflect the summary
3492 buffer that was in action when the last article was fetched."
3493 (when (derived-mode-p 'gnus-summary-mode)
3494 (setq gnus-summary-buffer (current-buffer))
3495 (let ((name gnus-newsgroup-name)
3496 (marked gnus-newsgroup-marked)
3497 (spam gnus-newsgroup-spam-marked)
3498 (unread gnus-newsgroup-unreads)
3499 (headers gnus-current-headers)
3500 (data gnus-newsgroup-data)
3501 (summary gnus-summary-buffer)
3502 (article-buffer gnus-article-buffer)
3503 (original gnus-original-article-buffer)
3504 (gac gnus-article-current)
3505 (reffed gnus-reffed-article-number)
3506 (score-file gnus-current-score-file)
3507 (default-charset gnus-newsgroup-charset)
3509 (let ((locals gnus-newsgroup-variables))
3511 (if (consp (car locals))
3512 (push (eval (caar locals)) vlist)
3513 (push (eval (car locals)) vlist))
3514 (setq locals (cdr locals)))
3515 (setq vlist (nreverse vlist)))
3517 (setq gnus-newsgroup-name name
3518 gnus-newsgroup-marked marked
3519 gnus-newsgroup-spam-marked spam
3520 gnus-newsgroup-unreads unread
3521 gnus-current-headers headers
3522 gnus-newsgroup-data data
3523 gnus-article-current gac
3524 gnus-summary-buffer summary
3525 gnus-article-buffer article-buffer
3526 gnus-original-article-buffer original
3527 gnus-reffed-article-number reffed
3528 gnus-current-score-file score-file
3529 gnus-newsgroup-charset default-charset)
3530 (let ((locals gnus-newsgroup-variables))
3532 (if (consp (car locals))
3533 (set (caar locals) (pop vlist))
3534 (set (car locals) (pop vlist)))
3535 (setq locals (cdr locals))))))))
3537 (defun gnus-summary-article-unread-p (article)
3538 "Say whether ARTICLE is unread or not."
3539 (memq article gnus-newsgroup-unreads))
3541 (defun gnus-summary-first-article-p (&optional article)
3542 "Return whether ARTICLE is the first article in the buffer."
3543 (if (not (setq article (or article (gnus-summary-article-number))))
3545 (eq article (caar gnus-newsgroup-data))))
3547 (defun gnus-summary-last-article-p (&optional article)
3548 "Return whether ARTICLE is the last article in the buffer."
3549 (if (not (setq article (or article (gnus-summary-article-number))))
3550 ;; All non-existent numbers are the last article. :-)
3552 (not (cdr (gnus-data-find-list article)))))
3554 (defun gnus-make-thread-indent-array (&optional n)
3556 (progn (setq n 200) nil)
3557 (null gnus-thread-indent-array)
3558 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3559 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3560 gnus-thread-indent-array-level gnus-thread-indent-level)
3562 (aset gnus-thread-indent-array n
3563 (make-string (* n gnus-thread-indent-level) ? ))
3566 (defun gnus-update-summary-mark-positions ()
3567 "Compute where the summary marks are to go."
3569 (when (gnus-buffer-exists-p gnus-summary-buffer)
3570 (set-buffer gnus-summary-buffer))
3571 (let ((spec gnus-summary-line-format-spec)
3574 (gnus-set-work-buffer)
3575 (let ((gnus-tmp-unread ?Z)
3576 (gnus-replied-mark ?Z)
3577 (gnus-score-below-mark ?Z)
3578 (gnus-score-over-mark ?Z)
3579 (gnus-undownloaded-mark ?Z)
3580 (gnus-summary-line-format-spec spec)
3581 (gnus-newsgroup-downloadable '(0))
3582 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3583 case-fold-search ignores)
3584 ;; Here, all marks are bound to Z.
3585 (gnus-summary-insert-line header
3586 0 nil t gnus-tmp-unread t nil "" nil 1)
3587 (goto-char (point-min))
3588 ;; Memorize the positions of the same characters as dummy marks.
3589 (while (re-search-forward "[A-D]" nil t)
3590 (push (point) ignores))
3592 ;; We use A-D as dummy marks in order to know column positions
3593 ;; where marks should be inserted.
3594 (setq gnus-tmp-unread ?A
3595 gnus-replied-mark ?B
3596 gnus-score-below-mark ?C
3597 gnus-score-over-mark ?C
3598 gnus-undownloaded-mark ?D)
3599 (gnus-summary-insert-line header
3600 0 nil t gnus-tmp-unread t nil "" nil 1)
3601 ;; Ignore characters which aren't dummy marks.
3603 (delete-region (goto-char (1- p)) p)
3605 (goto-char (point-min))
3606 (setq pos (list (cons 'unread
3607 (and (search-forward "A" nil t)
3608 (- (point) (point-min) 1)))))
3609 (goto-char (point-min))
3610 (push (cons 'replied (and (search-forward "B" nil t)
3611 (- (point) (point-min) 1)))
3613 (goto-char (point-min))
3614 (push (cons 'score (and (search-forward "C" nil t)
3615 (- (point) (point-min) 1)))
3617 (goto-char (point-min))
3618 (push (cons 'download (and (search-forward "D" nil t)
3619 (- (point) (point-min) 1)))
3621 (setq gnus-summary-mark-positions pos))))
3623 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3624 "Insert a dummy root in the summary buffer."
3626 (add-text-properties
3627 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3628 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3630 (defun gnus-summary-extract-address-component (from)
3631 (or (car (funcall gnus-extract-address-components from))
3634 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3635 (let ((mail-parse-charset gnus-newsgroup-charset)
3636 ;; Is it really necessary to do this next part for each summary line?
3637 ;; Luckily, doesn't seem to slow things down much.
3638 (mail-parse-ignored-charsets
3639 (with-current-buffer gnus-summary-buffer
3640 gnus-newsgroup-ignored-charsets)))
3642 (and gnus-ignored-from-addresses
3643 (cond ((functionp gnus-ignored-from-addresses)
3644 (funcall gnus-ignored-from-addresses
3645 (mail-strip-quoted-names gnus-tmp-from)))
3646 (t (string-match (gnus-ignored-from-addresses) gnus-tmp-from)))
3647 (let ((extra-headers (mail-header-extra header))
3651 ((setq to (cdr (assq 'To extra-headers)))
3652 (concat gnus-summary-to-prefix
3654 (gnus-summary-extract-address-component
3655 (funcall gnus-decode-encoded-address-function to)))))
3658 (cdr (assq 'Newsgroups extra-headers))
3660 (memq 'Newsgroups gnus-extra-headers)
3661 (eq (car (gnus-find-method-for-group
3662 gnus-newsgroup-name)) 'nntp)
3663 (gnus-group-real-name gnus-newsgroup-name))))
3664 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3665 (bidi-string-mark-left-to-right
3667 (gnus-summary-extract-address-component gnus-tmp-from))))))
3669 (defun gnus-summary-insert-line (gnus-tmp-header
3670 gnus-tmp-level gnus-tmp-current
3671 undownloaded gnus-tmp-unread gnus-tmp-replied
3672 gnus-tmp-expirable gnus-tmp-subject-or-nil
3673 &optional gnus-tmp-dummy gnus-tmp-score
3675 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3676 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3678 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3679 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3680 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3681 (gnus-tmp-score-char
3682 (if (or (null gnus-summary-default-score)
3683 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3684 gnus-summary-zcore-fuzz))
3686 (if (< gnus-tmp-score gnus-summary-default-score)
3687 gnus-score-below-mark gnus-score-over-mark)))
3688 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3690 (cond (gnus-tmp-process gnus-process-mark)
3691 ((memq gnus-tmp-current gnus-newsgroup-cached)
3693 (gnus-tmp-replied gnus-replied-mark)
3694 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3695 gnus-forwarded-mark)
3696 ((memq gnus-tmp-current gnus-newsgroup-saved)
3698 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3701 (gnus-tmp-downloaded
3703 gnus-undownloaded-mark)
3704 (gnus-newsgroup-agentized
3705 gnus-downloaded-mark)
3708 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3711 ((string-match "<[^>]+> *$" gnus-tmp-from)
3712 (let ((beg (match-beginning 0)))
3713 (or (and (string-match "^\".+\"" gnus-tmp-from)
3714 (substring gnus-tmp-from 1 (1- (match-end 0))))
3715 (substring gnus-tmp-from 0 beg))))
3716 ((string-match "(.+)" gnus-tmp-from)
3717 (substring gnus-tmp-from
3718 (1+ (match-beginning 0)) (1- (match-end 0))))
3720 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3721 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3722 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3723 (inhibit-read-only t))
3724 (when (string= gnus-tmp-name "")
3725 (setq gnus-tmp-name gnus-tmp-from))
3726 (unless (numberp gnus-tmp-lines)
3727 (setq gnus-tmp-lines -1))
3728 (if (= gnus-tmp-lines -1)
3729 (setq gnus-tmp-lines "?")
3730 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3734 (progn (eval gnus-summary-line-format-spec) (point))
3735 'gnus-number gnus-tmp-number)
3736 (error (gnus-message 5 "Error updating the summary line")))
3737 (when (gnus-visual-p 'summary-highlight 'highlight)
3739 (gnus-summary-highlight-line)
3740 (gnus-run-hooks 'gnus-summary-update-hook)
3743 (defun gnus-summary-update-line (&optional dont-update)
3744 "Update summary line after change."
3745 (when (and gnus-summary-default-score
3746 (not gnus-summary-inhibit-highlight))
3747 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3748 (article (gnus-summary-article-number))
3749 (score (gnus-summary-article-score article)))
3751 (if (and gnus-summary-mark-below
3752 (< (gnus-summary-article-score)
3753 gnus-summary-mark-below))
3754 ;; This article has a low score, so we mark it as read.
3755 (when (memq article gnus-newsgroup-unreads)
3756 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3757 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3758 ;; This article was previously marked as read on account
3759 ;; of a low score, but now it has risen, so we mark it as
3761 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3762 (gnus-summary-update-mark
3763 (if (or (null gnus-summary-default-score)
3764 (<= (abs (- score gnus-summary-default-score))
3765 gnus-summary-zcore-fuzz))
3767 (if (< score gnus-summary-default-score)
3768 gnus-score-below-mark gnus-score-over-mark))
3770 ;; Do visual highlighting.
3771 (when (gnus-visual-p 'summary-highlight 'highlight)
3772 (gnus-summary-highlight-line)
3773 (gnus-run-hooks 'gnus-summary-update-hook)))))
3775 (defvar gnus-tmp-new-adopts nil)
3777 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3778 "Return the number of articles in THREAD.
3779 This may be 0 in some cases -- if none of the articles in
3780 the thread are to be displayed."
3782 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3784 ((not (listp thread))
3786 ((and (consp thread) (cdr thread))
3789 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3792 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3795 (when (and level (zerop level) gnus-tmp-new-adopts)
3798 'gnus-summary-number-of-articles-in-thread
3799 gnus-tmp-new-adopts))))
3801 (if (> number 1) gnus-not-empty-thread-mark
3802 gnus-empty-thread-mark)
3805 (defsubst gnus-summary-line-message-size (head)
3806 "Return pretty-printed version of message size.
3807 This function is intended to be used in
3808 `gnus-summary-line-format-alist'."
3809 (let ((c (or (mail-header-chars head) -1)))
3810 (cond ((< c 0) "n/a") ; chars not available
3811 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3812 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3813 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3814 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3816 (defcustom gnus-user-date-format-alist
3817 '(((gnus-seconds-today) . "Today, %H:%M")
3818 ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M")
3819 (604800 . "%A %H:%M") ; That's one week
3820 ((gnus-seconds-month) . "%A %d")
3821 ((gnus-seconds-year) . "%B %d")
3822 (t . "%b %d %Y")) ; This one is used when no other
3824 "Specifies date format depending on age of article.
3825 This is an alist of items (AGE . FORMAT). AGE can be a number (of
3826 seconds) or a Lisp expression evaluating to a number. When the age of
3827 the article is less than this number, then use `format-time-string'
3828 with the corresponding FORMAT for displaying the date of the article.
3829 If AGE is not a number or a Lisp expression evaluating to a
3830 non-number, then the corresponding FORMAT is used as a default value.
3832 Note that the list is processed from the beginning, so it should be
3833 sorted by ascending AGE. Also note that items following the first
3834 non-number AGE will be ignored.
3836 You can use the functions `gnus-seconds-today', `gnus-seconds-month'
3837 and `gnus-seconds-year' in the AGE spec. They return the number of
3838 seconds passed since the start of today, of this month, of this year,
3841 :group 'gnus-summary-format
3842 :type '(alist :key-type sexp :value-type string))
3844 (defun gnus-user-date (messy-date)
3845 "Format the messy-date according to `gnus-user-date-format-alist'.
3846 Returns \" ? \" if there's bad input or if another error occurs.
3847 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3849 (let* ((messy-date (float-time (gnus-date-get-time messy-date)))
3851 ;;If we don't find something suitable we'll use this one
3852 (my-format "%b %d '%y"))
3853 (let* ((difference (- now messy-date))
3854 (templist gnus-user-date-format-alist)
3855 (top (eval (caar templist))))
3856 (while (if (numberp top) (< top difference) (not top))
3858 (setq templist (cdr templist))
3859 (setq top (eval (caar templist)))))
3860 (if (stringp (cdr (car templist)))
3861 (setq my-format (cdr (car templist)))))
3862 (format-time-string (eval my-format) (seconds-to-time messy-date)))
3865 (defun gnus-summary-set-local-parameters (group)
3866 "Go through the local params of GROUP and set all variable specs in that list."
3867 (let ((vars '(quit-config active))) ; Ignore things that aren't
3869 (dolist (elem (gnus-group-find-parameter group))
3870 (and (consp elem) ; Has to be a cons.
3871 (consp (cdr elem)) ; The cdr has to be a list.
3872 (symbolp (car elem)) ; Has to be a symbol in there.
3873 (not (memq (car elem) vars))
3875 (push (car elem) vars)
3876 ;; Variables like `gnus-show-threads' that are globally
3877 ;; bound, if used as group parameters, need to get to be
3878 ;; buffer-local, whereas just parameters like `gcc-self',
3879 ;; `timestamp', etc. should not be bound as variables.
3880 (if (boundp (car elem))
3881 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3882 (eval (nth 1 elem))))))))
3884 (defun gnus-summary-read-group (group &optional show-all no-article
3885 kill-buffer no-display backward
3887 "Start reading news in newsgroup GROUP.
3888 If SHOW-ALL is non-nil, already read articles are also listed.
3889 If NO-ARTICLE is non-nil, no article is selected initially.
3890 If NO-DISPLAY, don't generate the summary buffer contents.
3891 If KILL-BUFFER, it should be a buffer that's killed once the new
3892 summary buffer has been generated.
3893 If BACKWARD, move point to the previous group in the group buffer
3894 If SELECT-ARTICLES, only select those articles from GROUP."
3898 (let ((gnus-auto-select-next nil))
3899 (or (gnus-summary-read-group-1
3900 group show-all no-article
3901 kill-buffer no-display
3904 select-articles nil)))))
3905 (eq gnus-auto-select-next 'quietly))
3906 (set-buffer gnus-group-buffer)
3907 ;; The entry function called above goes to the next
3908 ;; group automatically, so we go two groups back
3909 ;; if we are searching for the previous group.
3911 (gnus-group-prev-unread-group 2))
3912 (if (not (equal group (gnus-group-group-name)))
3913 (setq group (gnus-group-group-name))
3917 (defun gnus-summary-read-group-1 (group show-all no-article
3918 kill-buffer no-display
3919 &optional select-articles)
3920 ;; Killed foreign groups can't be entered.
3921 ;; (when (and (not (gnus-group-native-p group))
3922 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3923 ;; (error "Dead non-native groups can't be entered"))
3924 (gnus-message 7 "Retrieving newsgroup: %s..."
3925 (gnus-group-decoded-name group))
3926 (let* ((new-group (gnus-summary-setup-buffer group))
3927 (quit-config (gnus-group-quit-config group))
3928 (did-select (and new-group (gnus-select-newsgroup
3929 group show-all select-articles))))
3931 ;; This summary buffer exists already, so we just select it.
3933 (gnus-set-global-variables)
3935 (gnus-kill-or-deaden-summary kill-buffer))
3936 (gnus-configure-windows 'summary 'force)
3937 (gnus-set-mode-line 'summary)
3938 (gnus-summary-position-point)
3941 ;; We couldn't select this group.
3943 (when (and (derived-mode-p 'gnus-summary-mode)
3944 (not (equal (current-buffer) kill-buffer)))
3945 (kill-buffer (current-buffer))
3946 (if (not quit-config)
3948 ;; Update the info -- marks might need to be removed,
3950 (gnus-summary-update-info)
3951 (set-buffer gnus-group-buffer)
3952 (gnus-group-jump-to-group group)
3953 (gnus-group-next-unread-group 1))
3954 (gnus-handle-ephemeral-exit quit-config)))
3955 (if (null (gnus-list-of-unread-articles group))
3956 (gnus-message 3 "Group %s contains no messages"
3957 (gnus-group-decoded-name group))
3958 (gnus-message 3 "Can't select group"))
3960 ;; The user did a `C-g' while prompting for number of articles,
3961 ;; so we exit this group.
3962 ((eq did-select 'quit)
3963 (and (derived-mode-p 'gnus-summary-mode)
3964 (not (equal (current-buffer) kill-buffer))
3965 (kill-buffer (current-buffer)))
3967 (gnus-kill-or-deaden-summary kill-buffer))
3968 (if (not quit-config)
3970 (set-buffer gnus-group-buffer)
3971 (gnus-group-jump-to-group group)
3972 (gnus-configure-windows 'group 'force))
3973 (gnus-handle-ephemeral-exit quit-config))
3974 ;; Finally signal the quit.
3976 ;; The group was successfully selected.
3978 (gnus-set-global-variables)
3979 (when (boundp 'spam-install-hooks)
3981 ;; Save the active value in effect when the group was entered.
3982 (setq gnus-newsgroup-active
3984 (gnus-active gnus-newsgroup-name)))
3985 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
3986 ;; You can change the summary buffer in some way with this hook.
3987 (gnus-run-hooks 'gnus-select-group-hook)
3988 (when (memq 'summary (gnus-update-format-specifications
3989 nil 'summary 'summary-mode 'summary-dummy))
3990 ;; The format specification for the summary line was updated,
3991 ;; so we need to update the mark positions as well.
3992 (gnus-update-summary-mark-positions))
3993 ;; Do score processing.
3994 (when gnus-use-scoring
3995 (gnus-possibly-score-headers))
3996 ;; Check whether to fill in the gaps in the threads.
3997 (when gnus-build-sparse-threads
3998 (gnus-build-sparse-threads))
3999 ;; Find the initial limit.
4001 (let ((gnus-newsgroup-dormant nil))
4002 (gnus-summary-initial-limit show-all))
4003 (gnus-summary-initial-limit show-all))
4004 ;; Generate the summary buffer.
4006 (gnus-summary-prepare))
4007 (when gnus-use-trees
4009 (setq gnus-summary-highlight-line-function
4010 'gnus-tree-highlight-article))
4011 ;; If the summary buffer is empty, but there are some low-scored
4012 ;; articles or some excluded dormants, we include these in the
4014 (when (and (zerop (buffer-size))
4016 (cond (gnus-newsgroup-dormant
4017 (gnus-summary-limit-include-dormant))
4018 ((and gnus-newsgroup-scored show-all)
4019 (gnus-summary-limit-include-expunged t))))
4020 ;; Function `gnus-apply-kill-file' must be called in this hook.
4021 (gnus-run-hooks 'gnus-apply-kill-hook)
4022 (if (and (zerop (buffer-size))
4025 ;; This newsgroup is empty.
4026 (gnus-summary-catchup-and-exit nil t)
4027 (gnus-message 6 "No unread news")
4029 (gnus-kill-or-deaden-summary kill-buffer))
4030 ;; Return nil from this function.
4032 ;; Hide conversation thread subtrees. We cannot do this in
4033 ;; gnus-summary-prepare-hook since kill processing may not
4034 ;; work with hidden articles.
4035 (gnus-summary-maybe-hide-threads)
4036 (gnus-configure-windows 'summary)
4038 (gnus-kill-or-deaden-summary kill-buffer))
4039 (gnus-summary-auto-select-subject)
4040 ;; Show first unread article if requested.
4041 (if (and (not no-article)
4043 gnus-newsgroup-unreads
4044 gnus-auto-select-first)
4046 (let ((art (gnus-summary-article-number)))
4049 (not (memq art gnus-newsgroup-undownloaded))
4050 (not (memq art gnus-newsgroup-downloadable)))
4051 (gnus-summary-goto-article art))))
4052 ;; Don't select any articles.
4053 (gnus-summary-position-point)
4054 (gnus-configure-windows 'summary 'force)
4055 (gnus-set-mode-line 'summary))
4056 (when (and gnus-auto-center-group
4057 (get-buffer-window gnus-group-buffer t))
4058 ;; Gotta use windows, because recenter does weird stuff if
4059 ;; the current buffer ain't the displayed window.
4060 (let ((owin (selected-window)))
4061 (select-window (get-buffer-window gnus-group-buffer t))
4062 (when (gnus-group-goto-group group)
4064 (select-window owin)))
4065 ;; Mark this buffer as "prepared".
4066 (setq gnus-newsgroup-prepared t)
4067 (gnus-run-hooks 'gnus-summary-prepared-hook)
4068 (unless (gnus-ephemeral-group-p group)
4069 (gnus-group-update-group group nil t))
4072 (defun gnus-summary-auto-select-subject ()
4073 "Select the subject line on initial group entry."
4074 (goto-char (point-min))
4076 ((eq gnus-auto-select-subject 'best)
4077 (gnus-summary-best-unread-subject))
4078 ((eq gnus-auto-select-subject 'unread)
4079 (gnus-summary-first-unread-subject))
4080 ((eq gnus-auto-select-subject 'unseen)
4081 (gnus-summary-first-unseen-subject))
4082 ((eq gnus-auto-select-subject 'unseen-or-unread)
4083 (gnus-summary-first-unseen-or-unread-subject))
4084 ((eq gnus-auto-select-subject 'first)
4087 ((functionp gnus-auto-select-subject)
4088 (funcall gnus-auto-select-subject))))
4090 (defun gnus-summary-prepare ()
4091 "Generate the summary buffer."
4093 (let ((inhibit-read-only t))
4095 (setq gnus-newsgroup-data nil
4096 gnus-newsgroup-data-reverse nil)
4097 (gnus-run-hooks 'gnus-summary-generate-hook)
4098 ;; Generate the buffer, either with threads or without.
4099 (when gnus-newsgroup-headers
4100 (gnus-summary-prepare-threads
4101 (if gnus-show-threads
4102 (gnus-sort-gathered-threads
4103 (funcall gnus-summary-thread-gathering-function
4105 (gnus-cut-threads (gnus-make-threads)))))
4106 ;; Unthreaded display.
4107 (gnus-sort-articles gnus-newsgroup-headers))))
4108 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4109 ;; Call hooks for modifying summary buffer.
4110 (goto-char (point-min))
4111 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4113 (defsubst gnus-general-simplify-subject (subject)
4114 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4117 ;; Truncate the subject.
4118 (gnus-simplify-subject-functions
4119 (gnus-map-function gnus-simplify-subject-functions subject))
4120 ((numberp gnus-summary-gather-subject-limit)
4121 (setq subject (gnus-simplify-subject-re subject))
4122 (if (> (length subject) gnus-summary-gather-subject-limit)
4123 (substring subject 0 gnus-summary-gather-subject-limit)
4125 ;; Fuzzily simplify it.
4126 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4127 (gnus-simplify-subject-fuzzy subject))
4128 ;; Just remove the leading "Re:".
4130 (gnus-simplify-subject-re subject))))
4132 (if (and gnus-summary-gather-exclude-subject
4133 (string-match gnus-summary-gather-exclude-subject subject))
4134 nil ; This article shouldn't be gathered
4137 (defun gnus-summary-simplify-subject-query ()
4138 "Query where the respool algorithm would put this article."
4140 (gnus-summary-select-article)
4141 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4143 (defun gnus-gather-threads-by-subject (threads)
4144 "Gather threads by looking at Subject headers."
4145 (if (not gnus-summary-make-false-root)
4147 (let ((hashtb (gnus-make-hashtable 1024))
4150 subject hthread whole-subject)
4152 (setq subject (gnus-general-simplify-subject
4153 (setq whole-subject (mail-header-subject
4156 (if (setq hthread (gnus-gethash subject hashtb))
4158 ;; We enter a dummy root into the thread, if we
4159 ;; haven't done that already.
4160 (unless (stringp (caar hthread))
4161 (setcar hthread (list whole-subject (car hthread))))
4162 ;; We add this new gathered thread to this gathered
4164 (setcdr (car hthread)
4165 (nconc (cdar hthread) (list (car threads))))
4166 ;; Remove it from the list of threads.
4167 (setcdr prev (cdr threads))
4168 (setq threads prev))
4169 ;; Enter this thread into the hash table.
4170 (gnus-sethash subject
4171 (if gnus-summary-make-false-root-always
4173 ;; If you want a dummy root above all
4175 (setcar threads (list whole-subject
4181 (setq threads (cdr threads)))
4184 (defun gnus-gather-threads-by-references (threads)
4185 "Gather threads by looking at References headers."
4186 (let ((idhashtb (gnus-make-hashtable 1024))
4187 (thhashtb (gnus-make-hashtable 1024))
4190 ids references id gthread gid entered ref)
4192 (when (setq references (mail-header-references (caar threads)))
4193 (setq id (mail-header-id (caar threads))
4194 ids (inline (gnus-split-references references))
4196 (while (setq ref (pop ids))
4197 (setq ids (delete ref ids))
4198 (if (not (setq gid (gnus-gethash ref idhashtb)))
4200 (gnus-sethash ref id idhashtb)
4201 (gnus-sethash id threads thhashtb))
4202 (setq gthread (gnus-gethash gid thhashtb))
4204 ;; We enter a dummy root into the thread, if we
4205 ;; haven't done that already.
4206 (unless (stringp (caar gthread))
4207 (setcar gthread (list (mail-header-subject (caar gthread))
4209 ;; We add this new gathered thread to this gathered
4211 (setcdr (car gthread)
4212 (nconc (cdar gthread) (list (car threads)))))
4213 ;; Add it into the thread hash table.
4214 (gnus-sethash id gthread thhashtb)
4216 ;; Remove it from the list of threads.
4217 (setcdr prev (cdr threads))
4218 (setq threads prev))))
4220 (setq threads (cdr threads)))
4223 (defun gnus-sort-gathered-threads (threads)
4224 "Sort subthreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4225 (let ((result threads))
4227 (when (stringp (caar threads))
4228 (setcdr (car threads)
4229 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4230 (setq threads (cdr threads)))
4233 (defun gnus-thread-loop-p (root thread)
4234 "Say whether ROOT is in THREAD."
4235 (let ((stack (list thread))
4238 (while (setq thread (pop stack))
4239 (setq th (cdr thread))
4241 (not (eq (caar th) root)))
4244 ;; We have found a loop.
4246 (setcdr thread (delq (car th) (cdr thread)))
4247 (if (boundp (setq ref-dep (intern "none"
4248 gnus-newsgroup-dependencies)))
4249 (setcdr (symbol-value ref-dep)
4250 (nconc (cdr (symbol-value ref-dep))
4252 (set ref-dep (list nil (car th))))
4255 ;; Push all the subthreads onto the stack.
4256 (push (cdr thread) stack)))
4259 (defun gnus-make-threads ()
4260 "Go through the dependency hashtb and find the roots. Return all threads."
4262 (while (catch 'infloop
4265 ;; Deal with self-referencing References loops.
4266 (when (and (car (symbol-value refs))
4273 (car (symbol-value refs)) thread))
4274 (cdr (symbol-value refs)))))))
4277 (unless (car (symbol-value refs))
4278 ;; These threads do not refer back to any other
4279 ;; articles, so they're roots.
4280 (setq threads (append (cdr (symbol-value refs)) threads))))
4281 gnus-newsgroup-dependencies)))
4284 ;; Build the thread tree.
4285 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4286 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4288 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4289 if it was already present.
4291 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4292 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4293 Message-IDs will be renamed to a unique Message-ID before being
4296 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4297 (let* ((id (mail-header-id header))
4298 (id-dep (and id (intern id dependencies)))
4299 parent-id ref ref-dep ref-header replaced)
4300 ;; Enter this `header' in the `dependencies' table.
4304 ;; The first two cases do the normal part: enter a new `header'
4305 ;; in the `dependencies' table.
4306 ((not (boundp id-dep))
4307 (set id-dep (list header)))
4308 ((null (car (symbol-value id-dep)))
4309 (setcar (symbol-value id-dep) header))
4311 ;; From here the `header' was already present in the
4312 ;; `dependencies' table.
4314 ;; Overrides an existing entry;
4315 ;; just set the header part of the entry.
4316 (setcar (symbol-value id-dep) header)
4319 ;; Renames the existing `header' to a unique Message-ID.
4320 ((not gnus-summary-ignore-duplicates)
4321 ;; An article with this Message-ID has already been seen.
4322 ;; We rename the Message-ID.
4323 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4325 (mail-header-set-id header id))
4327 ;; The last case ignores an existing entry, except it adds any
4328 ;; additional Xrefs (in case the two articles came from different
4330 ;; Also sets `header' to nil meaning that the `dependencies'
4331 ;; table was *not* modified.
4333 (mail-header-set-xref
4334 (car (symbol-value id-dep))
4335 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4337 (or (mail-header-xref header) "")))
4340 (when (and header (not replaced))
4341 ;; First check that we are not creating a References loop.
4342 (setq parent-id (gnus-parent-id (mail-header-references header)))
4343 (setq ref parent-id)
4345 (setq ref-dep (intern-soft ref dependencies))
4347 (setq ref-header (car (symbol-value ref-dep))))
4348 (if (string= id ref)
4349 ;; Yuk! This is a reference loop. Make the article be a
4352 (mail-header-set-references (car (symbol-value id-dep)) "none")
4354 (setq parent-id nil))
4355 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4356 (setq ref-dep (intern (or parent-id "none") dependencies))
4357 (if (boundp ref-dep)
4358 (setcdr (symbol-value ref-dep)
4359 (nconc (cdr (symbol-value ref-dep))
4360 (list (symbol-value id-dep))))
4361 (set ref-dep (list nil (symbol-value id-dep)))))
4364 (defun gnus-extract-message-id-from-in-reply-to (string)
4365 (if (string-match "<[^>]+>" string)
4366 (substring string (match-beginning 0) (match-end 0))
4369 (defun gnus-build-sparse-threads ()
4370 (let ((headers gnus-newsgroup-headers)
4371 (mail-parse-charset gnus-newsgroup-charset)
4372 (gnus-summary-ignore-duplicates t)
4373 header references generation relations
4374 subject child end new-child date)
4375 ;; First we create an alist of generations/relations, where
4376 ;; generations is how much we trust the relation, and the relation
4378 (gnus-message 7 "Making sparse threads...")
4380 (nnheader-set-temp-buffer " *gnus sparse threads*")
4381 (while (setq header (pop headers))
4382 (when (and (setq references (mail-header-references header))
4383 (not (string= references "")))
4385 (setq child (mail-header-id header)
4386 subject (mail-header-subject header)
4387 date (mail-header-date header)
4389 (while (search-backward ">" nil t)
4390 (setq end (1+ (point)))
4391 (when (search-backward "<" nil t)
4392 (setq new-child (buffer-substring (point) end))
4393 (push (list (incf generation)
4394 child (setq child new-child)
4398 (push (list (1+ generation) child nil subject) relations))
4400 (kill-buffer (current-buffer)))
4401 ;; Sort over trustworthiness.
4402 (dolist (relation (sort relations 'car-less-than-car))
4403 (when (gnus-dependencies-add-header
4404 (make-full-mail-header
4405 gnus-reffed-article-number
4406 (nth 3 relation) "" (or (nth 4 relation) "")
4408 (or (nth 2 relation) "") 0 0 "")
4409 gnus-newsgroup-dependencies nil)
4410 (push gnus-reffed-article-number gnus-newsgroup-limit)
4411 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4412 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4413 gnus-newsgroup-reads)
4414 (decf gnus-reffed-article-number)))
4415 (gnus-message 7 "Making sparse threads...done")))
4417 (defun gnus-build-old-threads ()
4418 ;; Look at all the articles that refer back to old articles, and
4419 ;; fetch the headers for the articles that aren't there. This will
4420 ;; build complete threads - if the roots haven't been expired by the
4422 (let ((mail-parse-charset gnus-newsgroup-charset)
4426 (when (not (car (symbol-value refs)))
4427 (setq heads (cdr (symbol-value refs)))
4429 (if (memq (mail-header-number (caar heads))
4430 gnus-newsgroup-dormant)
4431 (setq heads (cdr heads))
4432 (setq id (symbol-name refs))
4433 (while (and (setq id (gnus-build-get-header id))
4434 (not (car (gnus-id-to-thread id)))))
4435 (setq heads nil)))))
4436 gnus-newsgroup-dependencies)))
4438 (defsubst gnus-remove-odd-characters (string)
4439 "Translate STRING into something that doesn't contain weird characters."
4440 (subst-char-in-string
4442 (subst-char-in-string ?\n ?\- string t) t))
4444 ;; This function has to be called with point after the article number
4445 ;; on the beginning of the line.
4446 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4447 (let ((eol (point-at-eol))
4448 (buffer (current-buffer))
4449 header references in-reply-to)
4451 ;; overview: [num subject from date id refs chars lines misc]
4454 (narrow-to-region (point) eol)
4459 (make-full-mail-header
4461 (condition-case () ; subject
4462 (gnus-remove-odd-characters
4463 (funcall gnus-decode-encoded-word-function
4464 (setq x (nnheader-nov-field))))
4466 (condition-case () ; from
4467 (gnus-remove-odd-characters
4468 (funcall gnus-decode-encoded-address-function
4469 (setq x (nnheader-nov-field))))
4471 (nnheader-nov-field) ; date
4472 (nnheader-nov-read-message-id number) ; id
4473 (setq references (nnheader-nov-field)) ; refs
4474 (nnheader-nov-read-integer) ; chars
4475 (nnheader-nov-read-integer) ; lines
4477 (if (looking-at "Xref: ")
4478 (goto-char (match-end 0)))
4479 (nnheader-nov-field)) ; Xref
4480 (nnheader-nov-parse-extra)))) ; extra
4484 (when (and (string= references "")
4485 (setq in-reply-to (mail-header-extra header))
4486 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4487 (mail-header-set-references
4488 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4490 (when gnus-alter-header-function
4491 (funcall gnus-alter-header-function header))
4492 (gnus-dependencies-add-header header dependencies force-new)))
4494 (defun gnus-build-get-header (id)
4495 "Look through the buffer of NOV lines and find the header to ID.
4496 Enter this line into the dependencies hash table, and return
4497 the id of the parent article (if any)."
4498 (let ((deps gnus-newsgroup-dependencies)
4501 (with-current-buffer nntp-server-buffer
4502 (let ((case-fold-search nil))
4503 (goto-char (point-min))
4504 (while (and (not found)
4505 (search-forward id nil t))
4507 (setq found (looking-at
4508 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4509 (regexp-quote id))))
4510 (or found (beginning-of-line 2)))
4514 (setq header (gnus-nov-parse-line
4515 (read (current-buffer)) deps))
4516 (gnus-parent-id (mail-header-references header))))))
4518 (let ((number (mail-header-number header)))
4519 (push number gnus-newsgroup-limit)
4520 (push header gnus-newsgroup-headers)
4521 (if (memq number gnus-newsgroup-unselected)
4523 (setq gnus-newsgroup-unreads
4524 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4526 (setq gnus-newsgroup-unselected
4527 (delq number gnus-newsgroup-unselected)))
4528 (push number gnus-newsgroup-ancient)))))))
4530 (defun gnus-build-all-threads ()
4531 "Read all the headers."
4532 (let ((gnus-summary-ignore-duplicates t)
4533 (mail-parse-charset gnus-newsgroup-charset)
4534 (dependencies gnus-newsgroup-dependencies)
4536 (with-current-buffer nntp-server-buffer
4537 (let ((case-fold-search nil))
4538 (goto-char (point-min))
4541 (setq article (read (current-buffer))
4542 header (gnus-nov-parse-line article dependencies t)))
4544 (with-current-buffer gnus-summary-buffer
4545 (push header gnus-newsgroup-headers)
4546 (if (memq (setq article (mail-header-number header))
4547 gnus-newsgroup-unselected)
4549 (setq gnus-newsgroup-unreads
4550 (gnus-add-to-sorted-list
4551 gnus-newsgroup-unreads article))
4552 (setq gnus-newsgroup-unselected
4553 (delq article gnus-newsgroup-unselected)))
4554 (push article gnus-newsgroup-ancient)))
4555 (forward-line 1)))))))
4557 (defun gnus-summary-update-article-line (article header)
4558 "Update the line for ARTICLE using HEADER."
4559 (let* ((id (mail-header-id header))
4560 (thread (gnus-id-to-thread id)))
4562 (error "Article in no thread"))
4563 ;; Update the thread.
4564 (setcar thread header)
4565 (gnus-summary-goto-subject article)
4566 (let* ((datal (gnus-data-find-list article))
4568 (inhibit-read-only t)
4569 (level (gnus-summary-thread-level)))
4571 (let ((inserted (- (point)
4573 (gnus-summary-insert-line
4575 (memq article gnus-newsgroup-undownloaded)
4576 (gnus-article-mark article)
4577 (memq article gnus-newsgroup-replied)
4578 (memq article gnus-newsgroup-expirable)
4579 ;; Only insert the Subject string when it's different
4580 ;; from the previous Subject string.
4585 (mail-header-subject
4588 (gnus-data-find-list
4590 (gnus-data-list t)))))
4591 ;; Error on the side of excessive subjects.
4593 (mail-header-subject header)))
4595 (mail-header-subject header))
4596 nil (cdr (assq article gnus-newsgroup-scored))
4597 (memq article gnus-newsgroup-processable))
4600 (gnus-data-update-list
4602 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4604 (defun gnus-summary-update-article (article &optional iheader)
4605 "Update ARTICLE in the summary buffer."
4606 (set-buffer gnus-summary-buffer)
4607 (let* ((header (gnus-summary-article-header article))
4608 (id (mail-header-id header))
4609 (data (gnus-data-find article))
4610 (thread (gnus-id-to-thread id))
4611 (references (mail-header-references header))
4615 (when (and references
4616 (not (equal "" references)))
4619 (inhibit-read-only t)
4625 (delq thread parent)))
4626 (if (gnus-summary-insert-subject id header)
4627 ;; Set the (possibly) new article number in the data structure.
4628 (gnus-data-set-number data (gnus-id-to-article id))
4632 (defun gnus-rebuild-thread (id &optional line)
4633 "Rebuild the thread containing ID.
4634 If LINE, insert the rebuilt thread starting on line LINE."
4635 (let ((inhibit-read-only t)
4636 old-pos current thread data)
4637 (if (not gnus-show-threads)
4638 (setq thread (list (car (gnus-id-to-thread id))))
4639 ;; Get the thread this article is part of.
4640 (setq thread (gnus-remove-thread id)))
4641 (setq old-pos (point-at-bol))
4642 (setq current (save-excursion
4643 (and (re-search-backward "[\r\n]" nil t)
4644 (gnus-summary-article-number))))
4645 ;; If this is a gathered thread, we have to go some re-gathering.
4646 (when (stringp (car thread))
4647 (let ((subject (car thread))
4649 (setq thread (cdr thread))
4651 (unless (memq (setq thr (gnus-id-to-thread
4653 (mail-header-id (caar thread)))))
4656 (setq thread (cdr thread)))
4657 ;; We now have all (unique) roots.
4658 (if (= (length roots) 1)
4659 ;; All the loose roots are now one solid root.
4660 (setq thread (car roots))
4661 (setq thread (cons subject (gnus-sort-threads roots))))))
4663 ;; We then insert this thread into the summary buffer.
4665 (goto-char (point-min))
4666 (forward-line (1- line)))
4667 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4668 (if gnus-show-threads
4669 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4670 (gnus-summary-prepare-unthreaded thread))
4671 (setq data (nreverse gnus-newsgroup-data))
4672 (setq threads gnus-newsgroup-threads))
4673 ;; We splice the new data into the data structure.
4674 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4675 ;;!!! then we want to insert at the beginning of the buffer.
4676 ;;!!! That happens to be true with Gnus now, but that may
4677 ;;!!! change in the future. Perhaps.
4678 (gnus-data-enter-list
4679 (if line nil current) data (- (point) old-pos))
4680 (setq gnus-newsgroup-threads
4681 (nconc threads gnus-newsgroup-threads))
4682 (gnus-data-compute-positions))))
4684 (defun gnus-number-to-header (number)
4685 "Return the header for article NUMBER."
4686 (let ((headers gnus-newsgroup-headers))
4688 (not (= number (mail-header-number (car headers)))))
4693 (defun gnus-parent-headers (in-headers &optional generation)
4694 "Return the headers of the GENERATIONth parent of HEADERS."
4696 (setq generation 1))
4698 (headers in-headers)
4701 (not (zerop generation))
4702 (setq references (mail-header-references headers)))
4703 (setq headers (if (and references
4704 (setq parent (gnus-parent-id references)))
4705 (car (gnus-id-to-thread parent))
4708 (and (not (eq headers in-headers))
4711 (defun gnus-id-to-thread (id)
4712 "Return the (sub-)thread where ID appears."
4713 (gnus-gethash id gnus-newsgroup-dependencies))
4715 (defun gnus-id-to-article (id)
4716 "Return the article number of ID."
4717 (let ((thread (gnus-id-to-thread id)))
4720 (mail-header-number (car thread)))))
4722 (defun gnus-id-to-header (id)
4723 "Return the article headers of ID."
4724 (car (gnus-id-to-thread id)))
4726 (defun gnus-article-displayed-root-p (article)
4727 "Say whether ARTICLE is a root(ish) article."
4728 (let ((level (gnus-summary-thread-level article))
4729 (refs (mail-header-references (gnus-summary-article-header article)))
4735 ((null (gnus-parent-id refs)) t)
4737 (null (setq particle (gnus-id-to-article
4738 (gnus-parent-id refs))))
4739 (null (gnus-summary-thread-level particle)))))))
4741 (defun gnus-root-id (id)
4742 "Return the id of the root of the thread where ID appears."
4744 (while (and id (setq prev (car (gnus-id-to-thread id))))
4746 id (gnus-parent-id (mail-header-references prev))))
4749 (defun gnus-articles-in-thread (thread)
4750 "Return the list of articles in THREAD."
4751 (cons (mail-header-number (car thread))
4752 (mapcan 'gnus-articles-in-thread (cdr thread))))
4754 (defun gnus-remove-thread (id &optional dont-remove)
4755 "Remove the thread that has ID in it."
4756 (let (headers thread last-id)
4757 ;; First go up in this thread until we find the root.
4758 (setq last-id (gnus-root-id id)
4759 headers (message-flatten-list (gnus-id-to-thread last-id)))
4760 ;; We have now found the real root of this thread. It might have
4761 ;; been gathered into some loose thread, so we have to search
4762 ;; through the threads to find the thread we wanted.
4763 (let ((threads gnus-newsgroup-threads)
4766 (setq sub (car threads))
4767 (if (stringp (car sub))
4768 ;; This is a gathered thread, so we look at the roots
4769 ;; below it to find whether this article is in this
4772 (setq sub (cdr sub))
4774 (when (member (caar sub) headers)
4775 (setq thread (car threads)
4778 (setq sub (cdr sub))))
4779 ;; It's an ordinary thread, so we check it.
4780 (when (eq (car sub) (car headers))
4783 (setq threads (cdr threads)))
4784 ;; If this article is in no thread, then it's a root.
4787 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4788 (setq thread (gnus-id-to-thread last-id)))
4791 thread ; We return this thread.
4793 (if (stringp (car thread))
4795 ;; If we use dummy roots, then we have to remove the
4796 ;; dummy root as well.
4797 (when (eq gnus-summary-make-false-root 'dummy)
4798 ;; We go to the dummy root by going to
4799 ;; the first sub-"thread", and then one line up.
4800 (gnus-summary-goto-article
4801 (mail-header-number (caadr thread)))
4804 (gnus-data-compute-positions))
4805 (setq thread (cdr thread))
4807 (gnus-remove-thread-1 (car thread))
4808 (setq thread (cdr thread))))
4809 (gnus-remove-thread-1 thread))))))))
4811 (defun gnus-remove-thread-1 (thread)
4812 "Remove the thread THREAD recursively."
4813 (let ((number (mail-header-number (pop thread)))
4815 (setq thread (reverse thread))
4817 (gnus-remove-thread-1 (pop thread)))
4818 (when (setq d (gnus-data-find number))
4819 (goto-char (gnus-data-pos d))
4820 (gnus-summary-show-thread)
4826 (gnus-delete-line)))))))
4828 (defun gnus-sort-threads-recursive (threads func)
4829 ;; Responsible for sorting the root articles of threads.
4830 (let ((subthread-sort-func (if (eq gnus-subthread-sort-functions
4831 'gnus-thread-sort-functions)
4833 (gnus-make-sort-function
4834 gnus-subthread-sort-functions))))
4835 (sort (mapcar (lambda (thread)
4838 (gnus-sort-subthreads-recursive
4839 (cdr thread) subthread-sort-func))))
4842 (defun gnus-sort-subthreads-recursive (threads func)
4843 ;; Responsible for sorting subthreads.
4844 (sort (mapcar (lambda (thread)
4847 (gnus-sort-subthreads-recursive (cdr thread) func))))
4850 (defun gnus-sort-threads-loop (threads func)
4851 (let* ((superthread (cons nil threads))
4852 (stack (list (cons superthread threads)))
4853 remaining-threads thread)
4855 (setq remaining-threads (cdr (car stack)))
4856 (if remaining-threads
4857 (progn (setq thread (car remaining-threads))
4858 (setcdr (car stack) (cdr remaining-threads))
4860 (push (cons thread (cdr thread)) stack)))
4861 (setq thread (caar stack))
4862 (setcdr thread (sort (cdr thread) func))
4866 (defun gnus-sort-threads (threads)
4868 (if (not gnus-thread-sort-functions)
4870 (gnus-message 8 "Sorting threads...")
4873 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000))
4874 (sort-func (gnus-make-sort-function gnus-thread-sort-functions)))
4875 (gnus-sort-threads-recursive threads sort-func))
4876 ;; Even after binding max-lisp-eval-depth, the recursive
4877 ;; sorter might fail for very long threads. In that case,
4878 ;; try using a (less well-tested) non-recursive sorter.
4879 (error (gnus-message 9 "Sorting threads with loop...")
4880 (gnus-sort-threads-loop
4881 threads (gnus-make-sort-function
4882 gnus-thread-sort-functions))))
4883 (gnus-message 8 "Sorting threads...done"))))
4885 (defun gnus-sort-articles (articles)
4887 (when gnus-article-sort-functions
4888 (gnus-message 7 "Sorting articles...")
4890 (setq gnus-newsgroup-headers
4891 (sort articles (gnus-make-sort-function
4892 gnus-article-sort-functions)))
4893 (gnus-message 7 "Sorting articles...done"))))
4895 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4896 (defmacro gnus-thread-header (thread)
4897 "Return header of first article in THREAD.
4898 Note that THREAD must never, ever be anything else than a variable -
4899 using some other form will lead to serious barfage."
4900 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4901 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4902 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4905 (defsubst gnus-article-sort-by-number (h1 h2)
4906 "Sort articles by article number."
4907 (< (mail-header-number h1)
4908 (mail-header-number h2)))
4910 (defun gnus-thread-sort-by-number (h1 h2)
4911 "Sort threads by root article number."
4912 (gnus-article-sort-by-number
4913 (gnus-thread-header h1) (gnus-thread-header h2)))
4915 (defsubst gnus-article-sort-by-random (h1 h2)
4916 "Sort articles randomly."
4919 (defun gnus-thread-sort-by-random (h1 h2)
4920 "Sort threads randomly."
4921 (gnus-article-sort-by-random
4922 (gnus-thread-header h1) (gnus-thread-header h2)))
4924 (defsubst gnus-article-sort-by-lines (h1 h2)
4925 "Sort articles by article Lines header."
4926 (< (mail-header-lines h1)
4927 (mail-header-lines h2)))
4929 (defun gnus-thread-sort-by-lines (h1 h2)
4930 "Sort threads by root article Lines header."
4931 (gnus-article-sort-by-lines
4932 (gnus-thread-header h1) (gnus-thread-header h2)))
4934 (defsubst gnus-article-sort-by-chars (h1 h2)
4935 "Sort articles by octet length."
4936 (< (mail-header-chars h1)
4937 (mail-header-chars h2)))
4939 (defun gnus-thread-sort-by-chars (h1 h2)
4940 "Sort threads by root article octet length."
4941 (gnus-article-sort-by-chars
4942 (gnus-thread-header h1) (gnus-thread-header h2)))
4944 (defsubst gnus-article-sort-by-author (h1 h2)
4945 "Sort articles by root author."
4947 (let ((extract (funcall
4948 gnus-extract-address-components
4949 (mail-header-from h1))))
4950 (or (car extract) (cadr extract) ""))
4951 (let ((extract (funcall
4952 gnus-extract-address-components
4953 (mail-header-from h2))))
4954 (or (car extract) (cadr extract) ""))))
4956 (defun gnus-thread-sort-by-author (h1 h2)
4957 "Sort threads by root author."
4958 (gnus-article-sort-by-author
4959 (gnus-thread-header h1) (gnus-thread-header h2)))
4961 (defsubst gnus-article-sort-by-recipient (h1 h2)
4962 "Sort articles by recipient."
4964 (let ((extract (funcall
4965 gnus-extract-address-components
4966 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4967 (or (car extract) (cadr extract)))
4968 (let ((extract (funcall
4969 gnus-extract-address-components
4970 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4971 (or (car extract) (cadr extract)))))
4973 (defun gnus-thread-sort-by-recipient (h1 h2)
4974 "Sort threads by root recipient."
4975 (gnus-article-sort-by-recipient
4976 (gnus-thread-header h1) (gnus-thread-header h2)))
4978 (defsubst gnus-article-sort-by-subject (h1 h2)
4979 "Sort articles by root subject."
4981 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4982 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4984 (defun gnus-thread-sort-by-subject (h1 h2)
4985 "Sort threads by root subject."
4986 (gnus-article-sort-by-subject
4987 (gnus-thread-header h1) (gnus-thread-header h2)))
4989 (defsubst gnus-article-sort-by-date (h1 h2)
4990 "Sort articles by root article date."
4992 (gnus-date-get-time (mail-header-date h1))
4993 (gnus-date-get-time (mail-header-date h2))))
4995 (defun gnus-thread-sort-by-date (h1 h2)
4996 "Sort threads by root article date."
4997 (gnus-article-sort-by-date
4998 (gnus-thread-header h1) (gnus-thread-header h2)))
5000 (defsubst gnus-article-sort-by-score (h1 h2)
5001 "Sort articles by root article score.
5002 Unscored articles will be counted as having a score of zero."
5003 (> (or (cdr (assq (mail-header-number h1)
5004 gnus-newsgroup-scored))
5005 gnus-summary-default-score 0)
5006 (or (cdr (assq (mail-header-number h2)
5007 gnus-newsgroup-scored))
5008 gnus-summary-default-score 0)))
5010 (defun gnus-thread-sort-by-score (h1 h2)
5011 "Sort threads by root article score."
5012 (gnus-article-sort-by-score
5013 (gnus-thread-header h1) (gnus-thread-header h2)))
5015 (defun gnus-thread-sort-by-total-score (h1 h2)
5016 "Sort threads by the sum of all scores in the thread.
5017 Unscored articles will be counted as having a score of zero."
5018 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
5020 (defun gnus-thread-total-score (thread)
5021 ;; This function find the total score of THREAD.
5026 (if (stringp (car thread))
5027 (apply gnus-thread-score-function 0
5028 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
5029 (gnus-thread-total-score-1 thread)))
5031 (gnus-thread-total-score-1 (list thread)))))
5033 (defun gnus-article-sort-by-most-recent-number (h1 h2)
5034 "Sort articles by number."
5035 (gnus-article-sort-by-number h1 h2))
5037 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
5038 "Sort threads such that the thread with the most recently arrived article comes first."
5039 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5041 (defun gnus-thread-highest-number (thread)
5042 "Return the highest article number in THREAD."
5043 (apply 'max (mapcar (lambda (header)
5044 (mail-header-number header))
5045 (message-flatten-list thread))))
5047 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5048 "Sort articles by number."
5049 (gnus-article-sort-by-date h1 h2))
5051 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5052 "Sort threads such that the thread with the most recently dated article comes first."
5053 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5055 ; Since this is called not only to sort the top-level threads, but
5056 ; also in recursive sorts to order the articles within a thread, each
5057 ; article will be processed many times. Thus it speeds things up
5058 ; quite a bit to use gnus-date-get-time, which caches the time value.
5059 (defun gnus-thread-latest-date (thread)
5060 "Return the highest article date in THREAD."
5062 (mapcar (lambda (header) (float-time
5064 (mail-header-date header))))
5065 (message-flatten-list thread))))
5067 (defun gnus-thread-total-score-1 (root)
5068 ;; This function find the total score of the thread below ROOT.
5069 (setq root (car root))
5070 (apply gnus-thread-score-function
5072 (mapcar 'gnus-thread-total-score
5073 (cdr (gnus-id-to-thread (mail-header-id root))))
5074 (when (> (mail-header-number root) 0)
5075 (list (or (cdr (assq (mail-header-number root)
5076 gnus-newsgroup-scored))
5077 gnus-summary-default-score 0))))
5078 (list gnus-summary-default-score)
5081 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5082 (defvar gnus-tmp-prev-subject nil)
5083 (defvar gnus-tmp-false-parent nil)
5084 (defvar gnus-tmp-root-expunged nil)
5085 (defvar gnus-tmp-dummy-line nil)
5087 (defun gnus-extra-header (type &optional header)
5088 "Return the extra header of TYPE."
5089 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5092 (defvar gnus-tmp-thread-tree-header-string "")
5094 (defcustom gnus-sum-thread-tree-root "> "
5095 "With %B spec, used for the root of a thread.
5096 If nil, use subject instead."
5098 :type '(radio (const :format "%v " nil) string)
5099 :group 'gnus-thread)
5101 (defcustom gnus-sum-thread-tree-false-root "> "
5102 "With %B spec, used for a false root of a thread.
5103 If nil, use subject instead."
5105 :type '(radio (const :format "%v " nil) string)
5106 :group 'gnus-thread)
5108 (defcustom gnus-sum-thread-tree-single-indent ""
5109 "With %B spec, used for a thread with just one message.
5110 If nil, use subject instead."
5112 :type '(radio (const :format "%v " nil) string)
5113 :group 'gnus-thread)
5115 (defcustom gnus-sum-thread-tree-vertical "| "
5116 "With %B spec, used for drawing a vertical line."
5119 :group 'gnus-thread)
5121 (defcustom gnus-sum-thread-tree-indent " "
5122 "With %B spec, used for indenting."
5125 :group 'gnus-thread)
5127 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5128 "With %B spec, used for a leaf with brothers."
5131 :group 'gnus-thread)
5133 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5134 "With %B spec, used for a leaf without brothers."
5137 :group 'gnus-thread)
5139 (defcustom gnus-summary-display-while-building nil
5140 "If non-nil, show and update the summary buffer as it's being built.
5141 If the value is t, update the buffer after every line is inserted. If
5142 the value is an integer (N), update the display every N lines."
5145 :type '(choice (const :tag "off" nil)
5147 (const :tag "frequently" t)))
5149 (defun gnus-summary-prepare-threads (threads)
5150 "Prepare summary buffer from THREADS and indentation LEVEL.
5151 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5152 or a straight list of headers."
5153 (gnus-message 7 "Generating summary...")
5155 (setq gnus-newsgroup-threads threads)
5158 (let ((gnus-tmp-level 0)
5159 (default-score (or gnus-summary-default-score 0))
5160 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5161 (building-line-count gnus-summary-display-while-building)
5162 (building-count (integerp gnus-summary-display-while-building))
5163 thread number subject stack state gnus-tmp-gathered beg-match
5164 new-roots gnus-tmp-new-adopts thread-end simp-subject
5165 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5166 gnus-tmp-replied gnus-tmp-subject-or-nil
5167 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5168 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5169 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5172 (setq gnus-tmp-prev-subject nil
5173 gnus-tmp-thread-tree-header-string "")
5175 (if (vectorp (car threads))
5176 ;; If this is a straight (sic) list of headers, then a
5177 ;; threaded summary display isn't required, so we just create
5178 ;; an unthreaded one.
5179 (gnus-summary-prepare-unthreaded threads)
5181 ;; Do the threaded display.
5183 (if gnus-summary-display-while-building
5184 (switch-to-buffer (buffer-name)))
5185 (while (or threads stack gnus-tmp-new-adopts new-roots)
5187 (if (and (= gnus-tmp-level 0)
5190 (not gnus-tmp-false-parent)
5191 (or gnus-tmp-new-adopts new-roots))
5192 (if gnus-tmp-new-adopts
5193 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5194 thread (list (car gnus-tmp-new-adopts))
5195 gnus-tmp-header (caar thread)
5196 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5198 (setq thread (list (car new-roots))
5199 gnus-tmp-header (caar thread)
5200 new-roots (cdr new-roots))))
5203 ;; If there are some threads, we do them before the
5204 ;; threads on the stack.
5205 (setq thread threads
5206 gnus-tmp-header (caar thread))
5207 ;; There were no current threads, so we pop something off
5209 (setq state (car stack)
5210 gnus-tmp-level (car state)
5211 tree-stack (cadr state)
5212 thread (caddr state)
5214 gnus-tmp-header (caar thread))))
5216 (setq gnus-tmp-false-parent nil)
5217 (setq gnus-tmp-root-expunged nil)
5218 (setq thread-end nil)
5220 (if (stringp gnus-tmp-header)
5221 ;; The header is a dummy root.
5223 ((eq gnus-summary-make-false-root 'adopt)
5224 ;; We let the first article adopt the rest.
5225 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5227 (setq gnus-tmp-gathered
5229 (lambda (h) (mail-header-number (car h)))
5232 (setq thread (cons (list (caar thread)
5235 (setq gnus-tmp-level -1
5236 gnus-tmp-false-parent t))
5237 ((eq gnus-summary-make-false-root 'empty)
5238 ;; We print adopted articles with empty subject fields.
5239 (setq gnus-tmp-gathered
5241 (lambda (h) (mail-header-number (car h)))
5244 (setq gnus-tmp-level -1))
5245 ((eq gnus-summary-make-false-root 'dummy)
5246 ;; We remember that we probably want to output a dummy
5248 (setq gnus-tmp-dummy-line gnus-tmp-header)
5249 (setq gnus-tmp-prev-subject gnus-tmp-header))
5251 ;; We do not make a root for the gathered
5252 ;; sub-threads at all.
5253 (setq gnus-tmp-level -1)))
5255 (setq number (mail-header-number gnus-tmp-header)
5256 subject (mail-header-subject gnus-tmp-header)
5257 simp-subject (gnus-simplify-subject-fully subject))
5260 ;; If the thread has changed subject, we might want to make
5261 ;; this subthread into a root.
5262 ((and (null gnus-thread-ignore-subject)
5263 (not (zerop gnus-tmp-level))
5264 gnus-tmp-prev-subject
5265 (not (string= gnus-tmp-prev-subject simp-subject)))
5266 (setq new-roots (nconc new-roots (list (car thread)))
5268 gnus-tmp-header nil))
5269 ;; If the article lies outside the current limit,
5270 ;; then we do not display it.
5271 ((not (memq number gnus-newsgroup-limit))
5272 (setq gnus-tmp-gathered
5274 (lambda (h) (mail-header-number (car h)))
5277 (setq gnus-tmp-new-adopts (if (cdar thread)
5278 (append gnus-tmp-new-adopts
5280 gnus-tmp-new-adopts)
5282 gnus-tmp-header nil)
5283 (when (zerop gnus-tmp-level)
5284 (setq gnus-tmp-root-expunged t)))
5285 ;; Perhaps this article is to be marked as read?
5286 ((and gnus-summary-mark-below
5287 (< (or (cdr (assq number gnus-newsgroup-scored))
5289 gnus-summary-mark-below)
5290 ;; Don't touch sparse articles.
5291 (not (gnus-summary-article-sparse-p number))
5292 (not (gnus-summary-article-ancient-p number)))
5293 (setq gnus-newsgroup-unreads
5294 (delq number gnus-newsgroup-unreads))
5295 (if gnus-newsgroup-auto-expire
5296 (setq gnus-newsgroup-expirable
5297 (gnus-add-to-sorted-list
5298 gnus-newsgroup-expirable number))
5299 (push (cons number gnus-low-score-mark)
5300 gnus-newsgroup-reads))))
5302 (when gnus-tmp-header
5303 ;; We may have an old dummy line to output before this
5305 (when (and gnus-tmp-dummy-line
5308 (mail-header-subject gnus-tmp-header)))
5309 (gnus-summary-insert-dummy-line
5310 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5311 (setq gnus-tmp-dummy-line nil))
5313 ;; Compute the mark.
5314 (setq gnus-tmp-unread (gnus-article-mark number))
5316 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5317 gnus-tmp-header gnus-tmp-level)
5318 gnus-newsgroup-data)
5320 ;; Actually insert the line.
5322 gnus-tmp-subject-or-nil
5324 ((and gnus-thread-ignore-subject
5325 gnus-tmp-prev-subject
5326 (not (string= gnus-tmp-prev-subject simp-subject)))
5328 ((zerop gnus-tmp-level)
5329 (if (and (eq gnus-summary-make-false-root 'empty)
5330 (memq number gnus-tmp-gathered)
5331 gnus-tmp-prev-subject
5332 (string= gnus-tmp-prev-subject simp-subject))
5333 gnus-summary-same-subject
5335 (t gnus-summary-same-subject)))
5336 (if (and (eq gnus-summary-make-false-root 'adopt)
5337 (= gnus-tmp-level 1)
5338 (memq number gnus-tmp-gathered))
5339 (setq gnus-tmp-opening-bracket ?\<
5340 gnus-tmp-closing-bracket ?\>)
5341 (setq gnus-tmp-opening-bracket ?\[
5342 gnus-tmp-closing-bracket ?\]))
5343 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5344 (gnus-make-thread-indent-array
5345 (max (* 2 (length gnus-thread-indent-array))
5348 gnus-tmp-indentation
5349 (aref gnus-thread-indent-array gnus-tmp-level)
5350 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5351 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5352 gnus-summary-default-score 0)
5354 (if (or (null gnus-summary-default-score)
5355 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5356 gnus-summary-zcore-fuzz))
5358 (if (< gnus-tmp-score gnus-summary-default-score)
5359 gnus-score-below-mark gnus-score-over-mark))
5361 (cond ((memq number gnus-newsgroup-processable)
5363 ((memq number gnus-newsgroup-cached)
5365 ((memq number gnus-newsgroup-replied)
5367 ((memq number gnus-newsgroup-forwarded)
5368 gnus-forwarded-mark)
5369 ((memq number gnus-newsgroup-saved)
5371 ((memq number gnus-newsgroup-unseen)
5375 (cond ((memq number gnus-newsgroup-undownloaded)
5376 gnus-undownloaded-mark)
5377 (gnus-newsgroup-agentized
5378 gnus-downloaded-mark)
5381 gnus-tmp-from (mail-header-from gnus-tmp-header)
5384 ((string-match "<[^>]+> *$" gnus-tmp-from)
5385 (setq beg-match (match-beginning 0))
5386 (or (and (string-match "^\".+\"" gnus-tmp-from)
5387 (substring gnus-tmp-from 1 (1- (match-end 0))))
5388 (substring gnus-tmp-from 0 beg-match)))
5389 ((string-match "(.+)" gnus-tmp-from)
5390 (substring gnus-tmp-from
5391 (1+ (match-beginning 0)) (1- (match-end 0))))
5395 gnus-tmp-thread-tree-header-string
5397 ((not gnus-show-threads) "")
5398 ((zerop gnus-tmp-level)
5399 (cond ((cdar thread)
5400 (or gnus-sum-thread-tree-root subject))
5401 (gnus-tmp-new-adopts
5402 (or gnus-sum-thread-tree-false-root subject))
5404 (or gnus-sum-thread-tree-single-indent subject))))
5406 (concat (apply 'concat
5407 (mapcar (lambda (item)
5409 gnus-sum-thread-tree-vertical
5410 gnus-sum-thread-tree-indent))
5411 (cdr (reverse tree-stack))))
5413 gnus-sum-thread-tree-leaf-with-other
5414 gnus-sum-thread-tree-single-leaf)))))
5415 (when (string= gnus-tmp-name "")
5416 (setq gnus-tmp-name gnus-tmp-from))
5417 (unless (numberp gnus-tmp-lines)
5418 (setq gnus-tmp-lines -1))
5419 (if (= gnus-tmp-lines -1)
5420 (setq gnus-tmp-lines "?")
5421 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5424 (progn (eval gnus-summary-line-format-spec) (point))
5425 'gnus-number number)
5428 (gnus-summary-highlight-line)
5429 (when gnus-summary-update-hook
5430 (gnus-run-hooks 'gnus-summary-update-hook))
5433 (setq gnus-tmp-prev-subject simp-subject)))
5435 (when (nth 1 thread)
5436 (push (list (max 0 gnus-tmp-level)
5437 (copy-sequence tree-stack)
5440 (push (if (nth 1 thread) 1 0) tree-stack)
5441 (incf gnus-tmp-level)
5442 (setq threads (if thread-end nil (cdar thread)))
5443 (if gnus-summary-display-while-building
5446 ;; use a set frequency
5447 (setq building-line-count (1- building-line-count))
5448 (when (= building-line-count 0)
5450 (setq building-line-count
5451 gnus-summary-display-while-building)))
5455 (setq gnus-tmp-level 0)))))
5456 (gnus-message 7 "Generating summary...done"))
5458 (defun gnus-summary-prepare-unthreaded (headers)
5459 "Generate an unthreaded summary buffer based on HEADERS."
5460 (let (header number mark)
5465 ;; We may have to root out some bad articles...
5466 (when (memq (setq number (mail-header-number
5467 (setq header (pop headers))))
5468 gnus-newsgroup-limit)
5469 ;; Mark article as read when it has a low score.
5470 (when (and gnus-summary-mark-below
5471 (< (or (cdr (assq number gnus-newsgroup-scored))
5472 gnus-summary-default-score 0)
5473 gnus-summary-mark-below)
5474 (not (gnus-summary-article-ancient-p number)))
5475 (setq gnus-newsgroup-unreads
5476 (delq number gnus-newsgroup-unreads))
5477 (if gnus-newsgroup-auto-expire
5478 (push number gnus-newsgroup-expirable)
5479 (push (cons number gnus-low-score-mark)
5480 gnus-newsgroup-reads)))
5482 (setq mark (gnus-article-mark number))
5483 (push (gnus-data-make number mark (1+ (point)) header 0)
5484 gnus-newsgroup-data)
5485 (gnus-summary-insert-line
5487 (memq number gnus-newsgroup-undownloaded)
5488 mark (memq number gnus-newsgroup-replied)
5489 (memq number gnus-newsgroup-expirable)
5490 (mail-header-subject header) nil
5491 (cdr (assq number gnus-newsgroup-scored))
5492 (memq number gnus-newsgroup-processable))))))
5494 (declare-function gnus-parameter-list-identifier "gnus-art" (name) t)
5496 (defun gnus-group-get-list-identifiers (group)
5497 "Get list identifier regexp for GROUP."
5498 (or (gnus-parameter-list-identifier group)
5499 (if (consp gnus-list-identifiers)
5500 (mapconcat 'identity gnus-list-identifiers " *\\|")
5501 gnus-list-identifiers)))
5503 (defun gnus-summary-remove-list-identifiers ()
5504 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5505 (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name))
5508 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5509 (dolist (header gnus-newsgroup-headers)
5510 (setq subject (mail-header-subject header)
5512 (while (string-match regexp subject)
5514 (concat (substring subject 0 (match-beginning 1))
5515 (substring subject (match-end 0)))
5518 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5520 (concat (substring subject 0 (match-beginning 1))
5521 (substring subject (match-end 1)))))
5522 (mail-header-set-subject header subject))))))
5524 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5525 "Fetch headers of ARTICLES."
5526 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5527 (gnus-message 7 "Fetching headers for %s..." name)
5530 (setq gnus-headers-retrieved-by
5531 (gnus-retrieve-headers
5532 articles gnus-newsgroup-name
5534 ;; We might want to fetch old headers, but
5535 ;; not if there is only 1 article.
5537 (not (eq gnus-fetch-old-headers 'some))
5538 (not (numberp gnus-fetch-old-headers)))
5539 (> (length articles) 1))
5540 gnus-fetch-old-headers)))))
5541 (gnus-get-newsgroup-headers-xover
5542 articles force-new dependencies gnus-newsgroup-name t)
5543 (gnus-get-newsgroup-headers dependencies force-new))
5544 (gnus-message 7 "Fetching headers for %s...done" name))))
5546 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5547 "Select newsgroup GROUP.
5548 If READ-ALL is non-nil, all articles in the group are selected.
5549 If SELECT-ARTICLES, only select those articles from GROUP."
5550 (let* ((entry (gnus-group-entry group))
5551 ;;!!! Dirty hack; should be removed.
5552 (gnus-summary-ignore-duplicates
5553 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5555 gnus-summary-ignore-duplicates))
5556 (info (nth 2 entry))
5557 charset articles fetched-articles cached)
5559 (unless (gnus-check-server
5560 (set (make-local-variable 'gnus-current-select-method)
5561 (gnus-find-method-for-group group)))
5562 (error "Couldn't open server"))
5563 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5565 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5566 (gnus-activate-group group) ; Or we can activate it...
5567 (progn ; Or we bug out.
5568 (when (derived-mode-p 'gnus-summary-mode)
5569 (gnus-kill-buffer (current-buffer)))
5571 "Couldn't activate group %s: %s"
5572 (decode-coding-string group charset)
5573 (decode-coding-string (gnus-status-message group) charset))))
5575 (unless (gnus-request-group group t nil (gnus-get-info group))
5576 (when (derived-mode-p 'gnus-summary-mode)
5577 (gnus-kill-buffer (current-buffer)))
5578 (error "Couldn't request group %s: %s"
5579 (decode-coding-string group charset)
5580 (decode-coding-string (gnus-status-message group) charset)))
5582 (when (and gnus-agent
5583 (gnus-active group))
5584 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5586 (setq gnus-summary-use-undownloaded-faces
5587 (gnus-agent-find-parameter
5589 'agent-enable-undownloaded-faces)))
5591 (setq gnus-newsgroup-name group
5592 gnus-newsgroup-unselected nil
5593 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5595 (let ((display (gnus-group-find-parameter group 'display)))
5596 (setq gnus-newsgroup-display
5598 ((not (zerop (or (car-safe read-all) 0)))
5599 ;; The user entered the group with C-u SPC/RET, let's show
5605 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5607 ;; The following is probably the "correct" solution, but
5608 ;; it makes Gnus fetch all headers and then limit the
5609 ;; articles (which is slow), so instead we hack the
5610 ;; select-articles parameter instead. -- Simon Josefsson
5613 ;; (gnus-byte-compile
5614 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5616 (setq select-articles
5617 (gnus-uncompress-range
5618 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5622 (cdr (gnus-active group)))))
5627 (gnus-summary-setup-default-charset)
5629 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5630 (when (gnus-virtual-group-p group)
5631 (setq cached gnus-newsgroup-cached))
5633 (setq gnus-newsgroup-unreads
5634 (gnus-sorted-ndifference
5635 (gnus-sorted-ndifference gnus-newsgroup-unreads
5636 gnus-newsgroup-marked)
5637 gnus-newsgroup-dormant))
5639 (setq gnus-newsgroup-processable nil)
5641 (gnus-update-read-articles group gnus-newsgroup-unreads t)
5643 ;; Adjust and set lists of article marks.
5645 (gnus-adjust-marked-articles info))
5646 (if (setq articles select-articles)
5647 (setq gnus-newsgroup-unselected
5648 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5649 (setq articles (gnus-articles-to-read group read-all)))
5653 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5655 ((eq articles 0) nil)
5657 ;; Init the dependencies hash table.
5658 (setq gnus-newsgroup-dependencies
5659 (gnus-make-hashtable (length articles)))
5660 (if (gnus-buffer-live-p gnus-group-buffer)
5661 (gnus-set-global-variables)
5662 (set-default 'gnus-newsgroup-name gnus-newsgroup-name))
5663 ;; Retrieve the headers and read them in.
5665 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5667 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5669 (setq gnus-newsgroup-cached cached))
5671 ;; Suppress duplicates?
5672 (when gnus-suppress-duplicates
5673 (gnus-dup-suppress-articles))
5675 ;; Set the initial limit.
5676 (setq gnus-newsgroup-limit (copy-sequence articles))
5677 ;; Remove canceled articles from the list of unread articles.
5678 (setq fetched-articles
5679 (mapcar (lambda (headers) (mail-header-number headers))
5680 gnus-newsgroup-headers))
5681 (setq gnus-newsgroup-articles fetched-articles)
5682 (setq gnus-newsgroup-unreads
5683 (gnus-sorted-nintersection
5684 gnus-newsgroup-unreads fetched-articles))
5685 (gnus-compute-unseen-list)
5687 ;; Removed marked articles that do not exist.
5688 (gnus-update-missing-marks
5689 (gnus-sorted-difference articles fetched-articles))
5690 ;; We might want to build some more threads first.
5691 (when (and gnus-fetch-old-headers
5692 (eq gnus-headers-retrieved-by 'nov))
5693 (if (eq gnus-fetch-old-headers 'invisible)
5694 (gnus-build-all-threads)
5695 (gnus-build-old-threads)))
5696 ;; Let the Gnus agent mark articles as read.
5698 (gnus-agent-get-undownloaded-list))
5699 ;; Remove list identifiers from subject
5700 (gnus-summary-remove-list-identifiers)
5701 ;; Check whether auto-expire is to be done in this group.
5702 (setq gnus-newsgroup-auto-expire
5703 (and (gnus-group-auto-expirable-p group)
5704 (not (gnus-group-read-only-p group))))
5705 ;; Set up the article buffer now, if necessary.
5706 (unless (and gnus-single-article-buffer
5707 (equal gnus-article-buffer "*Article*"))
5708 (gnus-article-setup-buffer))
5709 ;; First and last article in this newsgroup.
5710 (when gnus-newsgroup-headers
5711 (setq gnus-newsgroup-begin
5712 (mail-header-number (car gnus-newsgroup-headers))
5715 (gnus-last-element gnus-newsgroup-headers))))
5716 ;; GROUP is successfully selected.
5717 (or gnus-newsgroup-headers t)))))
5719 (defun gnus-compute-unseen-list ()
5720 ;; The `seen' marks are treated specially.
5721 (if (not gnus-newsgroup-seen)
5722 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5723 (setq gnus-newsgroup-unseen
5724 (gnus-inverse-list-range-intersection
5725 gnus-newsgroup-articles gnus-newsgroup-seen))))
5727 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5729 (defun gnus-summary-display-make-predicate (display)
5730 (require 'gnus-agent)
5731 (when (= (length display) 1)
5732 (setq display (car display)))
5733 (unless gnus-summary-display-cache
5734 (dolist (elem (append '((unread . unread)
5737 gnus-article-mark-lists))
5738 (push (cons (cdr elem)
5739 (gnus-byte-compile ;Why bother?
5740 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5741 gnus-summary-display-cache)))
5742 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5743 (gnus-category-predicate-cache gnus-summary-display-cache))
5744 (gnus-get-predicate display)))
5746 ;; Uses the dynamically bound `gnus-number' variable.
5747 (defvar gnus-number)
5748 (defun gnus-article-marked-p (type &optional article)
5749 (let ((article (or article gnus-number)))
5752 (memq article gnus-newsgroup-marked))
5754 (memq article gnus-newsgroup-spam-marked))
5756 (memq article gnus-newsgroup-unsendable))
5757 ((eq type 'undownload)
5758 (memq article gnus-newsgroup-undownloaded))
5759 ((eq type 'download)
5760 (memq article gnus-newsgroup-downloadable))
5762 (memq article gnus-newsgroup-unreads))
5764 (memq article gnus-newsgroup-reads))
5766 (memq article gnus-newsgroup-dormant) )
5768 (memq article gnus-newsgroup-expirable))
5770 (memq article gnus-newsgroup-replied))
5772 (memq article gnus-newsgroup-killed))
5773 ((eq type 'bookmark)
5774 (assq article gnus-newsgroup-bookmarks))
5776 (assq article gnus-newsgroup-scored))
5778 (memq article gnus-newsgroup-saved))
5780 (memq article gnus-newsgroup-cached))
5782 (memq article gnus-newsgroup-forwarded))
5784 (not (memq article gnus-newsgroup-unseen)))
5787 (defun gnus-articles-to-read (group &optional read-all)
5788 "Find out what articles the user wants to read."
5789 (let* ((only-read-p t)
5791 (gnus-list-range-difference
5792 ;; Select all articles if `read-all' is non-nil, or if there
5793 ;; are no unread articles.
5795 (and (zerop (length gnus-newsgroup-marked))
5796 (zerop (length gnus-newsgroup-unreads)))
5797 ;; Fetch all if the predicate is non-nil.
5798 gnus-newsgroup-display)
5799 ;; We want to select the headers for all the articles in
5800 ;; the group, so we select either all the active
5801 ;; articles in the group, or (if that's nil), the
5802 ;; articles in the cache.
5804 (if gnus-newsgroup-maximum-articles
5805 (let ((active (gnus-active group)))
5806 (gnus-uncompress-range
5807 (cons (max (car active)
5809 gnus-newsgroup-maximum-articles
5812 (gnus-uncompress-range (gnus-active group)))
5813 (gnus-cache-articles-in-group group))
5814 ;; Select only the "normal" subset of articles.
5815 (setq only-read-p nil)
5817 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5818 gnus-newsgroup-unreads))
5819 (cdr (assq 'unexist (gnus-info-marks (gnus-get-info group))))))
5820 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5821 (scored (length scored-list))
5822 (number (length articles))
5823 (marked (+ (length gnus-newsgroup-marked)
5824 (length gnus-newsgroup-dormant)))
5829 ((numberp gnus-newsgroup-display)
5830 gnus-newsgroup-display)
5834 ((and (or (<= scored marked) (= scored number))
5835 (numberp gnus-large-newsgroup)
5836 (> number gnus-large-newsgroup))
5837 (let* ((cursor-in-echo-area nil)
5838 (initial (gnus-parameter-large-newsgroup-initial
5839 gnus-newsgroup-name))
5840 (default (if only-read-p
5841 (or initial gnus-large-newsgroup)
5847 "How many articles from %s (available %d, default %d): "
5848 (gnus-group-real-name
5849 (gnus-group-decoded-name gnus-newsgroup-name))
5852 "How many articles from %s (%d default): "
5853 (gnus-group-real-name
5854 (gnus-group-decoded-name gnus-newsgroup-name))
5858 (number-to-string default))))
5859 (if (string-match "^[ \t]*$" input) number input)))
5860 ((and (> scored marked) (< scored number)
5861 (> (- scored number) 20))
5864 (format "%s %s (%d scored, %d total): "
5865 "How many articles from"
5866 (gnus-group-decoded-name
5867 (gnus-group-real-name gnus-newsgroup-name))
5869 (if (string-match "^[ \t]*$" input)
5873 (message "Quit getting the articles to read")
5875 (setq select (if (stringp select) (string-to-number select) select))
5876 (if (or (null select) (zerop select))
5878 (if (and (not (zerop scored)) (<= (abs select) scored))
5880 (setq articles (sort scored-list '<))
5881 (setq number (length articles)))
5882 (setq articles (copy-sequence articles)))
5884 (when (< (abs select) number)
5886 ;; Select the N oldest articles.
5887 (setcdr (nthcdr (1- (abs select)) articles) nil)
5888 ;; Select the N most recent articles.
5889 (setq articles (nthcdr (- number select) articles))))
5890 (setq gnus-newsgroup-unselected
5891 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5892 (when gnus-alter-articles-to-read-function
5895 (funcall gnus-alter-articles-to-read-function
5896 gnus-newsgroup-name articles)
5900 (defun gnus-killed-articles (killed articles)
5903 (when (inline (gnus-member-of-range (car articles) killed))
5904 (push (car articles) out))
5905 (setq articles (cdr articles)))
5908 (defun gnus-article-mark-to-type (mark)
5909 "Return the type of MARK."
5910 (or (cadr (assq mark gnus-article-special-mark-lists))
5913 (defun gnus-article-unpropagatable-p (mark)
5914 "Return whether MARK should be propagated to back end."
5915 (memq mark gnus-article-unpropagated-mark-lists))
5917 (defun gnus-adjust-marked-articles (info)
5918 "Set all article lists and remove all marks that are no longer valid."
5919 (let* ((marked-lists (gnus-info-marks info))
5920 (active (gnus-active (gnus-info-group info)))
5923 (types gnus-article-mark-lists)
5924 marks var articles article mark mark-type
5926 ;; Hack to avoid adjusting marks for imap.
5927 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5931 (dolist (marks marked-lists)
5932 (setq mark (car marks)
5933 mark-type (gnus-article-mark-to-type mark)
5934 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5935 ;; We set the variable according to the type of the marks list,
5936 ;; and then adjust the marks to a subset of the active articles.
5938 ;; Adjust "simple" lists - compressed yet unsorted
5939 ((eq mark-type 'list)
5940 ;; Simultaneously uncompress and clip to active range
5941 ;; See gnus-uncompress-range for a description of possible marks
5943 (if (not (cadr marks))
5945 (setq articles (if (numberp (cddr marks))
5951 (while (setq article (pop articles))
5952 (cond ((consp article)
5953 (setq bgn (max (car article) min)
5954 end (min (cdr article) max))
5956 (setq l (setcdr l (cons bgn nil))
5958 ((and (<= min article)
5960 (setq l (setcdr l (cons article nil))))))
5961 (set var (cdr lh)))))
5963 ((eq mark-type 'tuple)
5964 (set var (setq articles (cdr marks)))
5965 (when (not (listp (cdr (symbol-value var))))
5966 (set var (list (symbol-value var))))
5967 (when (not (listp (cdr articles)))
5968 (setq articles (list articles)))
5970 (when (or (not (consp (setq article (pop articles))))
5971 (< (car article) min)
5972 (> (car article) max))
5973 (set var (delq article (symbol-value var))))))
5974 ;; Adjust ranges (sloppily).
5975 ((eq mark-type 'range)
5978 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5979 ;; It should be (seen (NUM1 . NUM2)).
5980 (when (numberp (cddr marks))
5981 (setcdr marks (list (cdr marks))))
5982 (setq articles (cdr marks))
5983 (while (and articles
5984 (or (and (consp (car articles))
5985 (> min (cdar articles)))
5986 (and (numberp (car articles))
5987 (> min (car articles)))))
5991 (set var (cdr marks)))))))))
5993 (defun gnus-update-missing-marks (missing)
5994 "Go through the list of MISSING articles and remove them from the mark lists."
5997 ;; Go through all types.
5998 (dolist (elem gnus-article-mark-lists)
5999 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
6000 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
6001 (when (symbol-value var)
6002 ;; This list has articles. So we delete all missing
6003 ;; articles from it.
6006 (set var (delq (pop m) (symbol-value var))))))))))
6008 (defun gnus-update-marks ()
6009 "Enter the various lists of marked articles into the newsgroup info list."
6010 (let ((types gnus-article-mark-lists)
6011 (info (gnus-get-info gnus-newsgroup-name))
6012 type list newmarked symbol delta-marks)
6014 ;; Add all marks lists to the list of marks lists.
6015 (while (setq type (pop types))
6016 (setq list (symbol-value
6018 (intern (format "gnus-newsgroup-%s" (car type))))))
6021 ;; Get rid of the entries of the articles that have the
6023 (when (and (eq (cdr type) 'score)
6027 (prev (cons nil list))
6030 (if (or (not (consp (car arts)))
6031 (= (cdar arts) gnus-summary-default-score))
6032 (setcdr prev (cdr arts))
6034 (setq arts (cdr arts)))
6035 (setq list (cdr all)))))
6037 ;; When exiting the group, everything that's previously been
6038 ;; unseen is now seen.
6039 (when (eq (cdr type) 'seen)
6040 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
6042 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
6043 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
6045 (when (and (gnus-check-backend-function
6046 'request-set-mark gnus-newsgroup-name)
6047 (not (gnus-article-unpropagatable-p (cdr type))))
6048 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
6049 ;; Don't do anything about marks for articles we
6050 ;; didn't actually get any headers for.
6052 (gnus-list-range-intersection
6053 gnus-newsgroup-articles
6054 (gnus-remove-from-range (gnus-copy-sequence old) list)))
6056 (gnus-list-range-intersection
6057 gnus-newsgroup-articles
6058 (gnus-remove-from-range
6059 (gnus-copy-sequence list) old))))
6061 (push (list add 'add (list (cdr type))) delta-marks))
6063 ;; Don't delete marks from outside the active range.
6064 ;; This shouldn't happen, but is a sanity check.
6065 (setq del (gnus-sorted-range-intersection
6066 (gnus-active gnus-newsgroup-name) del))
6067 (push (list del 'del (list (cdr type))) delta-marks))))
6070 (eq (cdr type) 'unexist))
6071 (push (cons (cdr type) list) newmarked)))
6074 (unless (gnus-check-group gnus-newsgroup-name)
6075 (error "Can't open server for %s" gnus-newsgroup-name))
6076 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6078 ;; Enter these new marks into the info of the group.
6080 (setcar (nthcdr 3 info) newmarked)
6081 ;; Add the marks lists to the end of the info.
6083 (setcdr (nthcdr 2 info) (list newmarked))))
6085 ;; Cut off the end of the info if there's nothing else there.
6089 (when (nthcdr (decf i) info)
6090 (setcdr (nthcdr i info) nil)))))))
6092 (defun gnus-set-mode-line (where)
6093 "Set the mode line of the article or summary buffers.
6094 If WHERE is `summary', the summary mode line format will be used."
6095 ;; Is this mode line one we keep updated?
6096 (when (and (memq where gnus-updated-mode-lines)
6098 (intern (format "gnus-%s-mode-line-format-spec" where))))
6100 ;; We evaluate this in the summary buffer since these
6101 ;; variables are buffer-local to that buffer.
6102 (with-current-buffer gnus-summary-buffer
6103 ;; We bind all these variables that are used in the `eval' form
6105 (let* ((mformat (symbol-value
6107 (format "gnus-%s-mode-line-format-spec" where))))
6108 (gnus-tmp-group-name (gnus-mode-string-quote
6109 (gnus-group-decoded-name
6110 gnus-newsgroup-name)))
6111 (gnus-tmp-article-number (or gnus-current-article 0))
6112 (gnus-tmp-unread gnus-newsgroup-unreads)
6113 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6114 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6115 (gnus-tmp-unread-and-unselected
6116 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6117 (zerop gnus-tmp-unselected))
6119 ((zerop gnus-tmp-unselected)
6120 (format "{%d more}" gnus-tmp-unread-and-unticked))
6121 (t (format "{%d(+%d) more}"
6122 gnus-tmp-unread-and-unticked
6123 gnus-tmp-unselected))))
6125 (if (and gnus-current-headers
6126 (vectorp gnus-current-headers))
6127 (gnus-mode-string-quote
6128 (mail-header-subject gnus-current-headers))
6130 bufname-length max-len
6131 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6132 (setq mode-string (eval mformat))
6133 (setq bufname-length (if (string-match "%b" mode-string)
6136 (if (eq where 'summary)
6138 (get-buffer gnus-article-buffer))))
6141 (setq max-len (max 4 (if gnus-mode-non-string-length
6143 gnus-mode-non-string-length
6145 (length mode-string))))
6146 ;; We might have to chop a bit of the string off...
6147 (when (> (length mode-string) max-len)
6149 (concat (truncate-string-to-width mode-string (- max-len 3))
6151 ;; Update the mode line.
6152 (setq mode-line-buffer-identification
6153 (gnus-mode-line-buffer-identification (list mode-string)))
6154 (set-buffer-modified-p t))))
6156 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6157 "Go through the HEADERS list and add all Xrefs to a hash table.
6158 The resulting hash table is returned, or nil if no Xrefs were found."
6159 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6160 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6161 (xref-hashtb (gnus-make-hashtable))
6162 start group entry number xrefs header)
6164 (setq header (pop headers))
6165 (when (and (setq xrefs (mail-header-xref header))
6166 (not (memq (setq number (mail-header-number header))
6169 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6170 (setq start (match-end 0))
6171 (setq group (if prefix
6172 (concat prefix (substring xrefs (match-beginning 1)
6174 (substring xrefs (match-beginning 1) (match-end 1))))
6176 (string-to-number (substring xrefs (match-beginning 2)
6178 (if (setq entry (gnus-gethash group xref-hashtb))
6179 (setcdr entry (cons number (cdr entry)))
6180 (gnus-sethash group (cons number nil) xref-hashtb)))))
6181 (and start xref-hashtb)))
6183 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6184 "Look through all the headers and mark the Xrefs as read."
6185 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6186 name info xref-hashtb idlist method nth4)
6187 (with-current-buffer gnus-group-buffer
6188 (when (setq xref-hashtb
6189 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6192 (unless (string= from-newsgroup (setq name (symbol-name group)))
6193 (setq idlist (symbol-value group))
6194 ;; Dead groups are not updated.
6196 (setq info (gnus-get-info name))
6197 (when (stringp (setq nth4 (gnus-info-method info)))
6198 (setq nth4 (gnus-server-to-method nth4))))
6199 ;; Only do the xrefs if the group has the same
6200 ;; select method as the group we have just read.
6201 (or (gnus-methods-equal-p
6202 nth4 (gnus-find-method-for-group from-newsgroup))
6204 (equal nth4 (setq method (gnus-find-method-for-group
6206 (and (equal (car nth4) (car method))
6207 (equal (nth 1 nth4) (nth 1 method))))
6208 gnus-use-cross-reference
6209 (or (not (eq gnus-use-cross-reference t))
6211 ;; Only do cross-references on subscribed
6212 ;; groups, if that is what is wanted.
6213 (<= (gnus-info-level info) gnus-level-subscribed))
6214 (gnus-group-make-articles-read name idlist))))
6217 (defun gnus-compute-read-articles (group articles)
6218 (let* ((entry (gnus-group-entry group))
6219 (info (nth 2 entry))
6220 (active (gnus-active group))
6223 ;; First peel off all invalid article numbers.
6225 (let ((ids articles)
6227 (while (setq id (pop ids))
6228 (when (and first (> id (cdr active)))
6229 ;; We'll end up in this situation in one particular
6230 ;; obscure situation. If you re-scan a group and get
6231 ;; a new article that is cross-posted to a different
6232 ;; group that has not been re-scanned, you might get
6233 ;; crossposted article that has a higher number than
6234 ;; Gnus believes possible. So we re-activate this
6235 ;; group as well. This might mean doing the
6236 ;; crossposting thingy will *increase* the number
6237 ;; of articles in some groups. Tsk, tsk.
6238 (setq active (or (gnus-activate-group group) active)))
6239 (when (or (> id (cdr active))
6240 (< id (car active)))
6241 (setq articles (delq id articles))))))
6242 ;; If the read list is nil, we init it.
6244 (null (gnus-info-read info))
6246 (setq ninfo (cons 1 (1- (car active))))
6247 (setq ninfo (gnus-info-read info)))
6248 ;; Then we add the read articles to the range.
6250 ninfo (setq articles (sort articles '<))))))
6252 (defun gnus-group-make-articles-read (group articles)
6253 "Update the info of GROUP to say that ARTICLES are read."
6255 (entry (gnus-group-entry group))
6256 (info (nth 2 entry))
6257 (active (gnus-active group))
6259 (gnus-method-option-p
6260 (gnus-find-method-for-group group)
6264 ;; Group that Gnus doesn't know exists, but still allow the
6265 ;; backend to set marks.
6267 (gnus-request-set-mark
6268 group (list (list (gnus-compress-sequence (sort articles #'<))
6270 ;; Normal, subscribed groups.
6271 (setq range (gnus-compute-read-articles group articles))
6272 (with-current-buffer gnus-group-buffer
6275 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6276 (gnus-info-set-read ',info ',(gnus-info-read info))
6277 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6279 (gnus-request-set-mark
6280 ,group (list (list ',range 'del '(read)))))
6281 (gnus-group-update-group ,group t))))
6282 ;; Add the read articles to the range.
6283 (gnus-info-set-read info range)
6285 (gnus-request-set-mark group (list (list range 'add '(read)))))
6286 ;; Then we have to re-compute how many unread
6287 ;; articles there are in this group.
6291 (setq num (- (1+ (cdr active)) (car active))))
6292 ((not (listp (cdr range)))
6293 (setq num (- (cdr active) (- (1+ (cdr range))
6297 (if (numberp (car range))
6299 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6300 (setq range (cdr range)))
6301 (setq num (- (cdr active) num))))
6302 ;; Update the number of unread articles.
6304 ;; Update the group buffer.
6305 (unless (gnus-ephemeral-group-p group)
6306 (gnus-group-update-group group t))))))
6308 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6309 (let ((cur nntp-server-buffer)
6312 (with-current-buffer gnus-summary-buffer
6313 gnus-newsgroup-dependencies)))
6314 headers id end ref number
6315 (mail-parse-charset gnus-newsgroup-charset)
6316 (mail-parse-ignored-charsets
6317 (save-current-buffer (condition-case nil
6318 (set-buffer gnus-summary-buffer)
6320 gnus-newsgroup-ignored-charsets)))
6321 (with-current-buffer nntp-server-buffer
6322 ;; Translate all TAB characters into SPACE characters.
6323 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6324 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6325 (ietf-drums-unfold-fws)
6326 (gnus-run-hooks 'gnus-parse-headers-hook)
6327 (let ((case-fold-search t)
6328 in-reply-to header p lines chars)
6329 (goto-char (point-min))
6330 ;; Search to the beginning of the next header. Error messages
6331 ;; do not begin with 2 or 3.
6332 (while (re-search-forward "^[23][0-9]+ " nil t)
6335 ;; This implementation of this function, with nine
6336 ;; search-forwards instead of the one re-search-forward and
6337 ;; a case (which basically was the old function) is actually
6338 ;; about twice as fast, even though it looks messier. You
6339 ;; can't have everything, I guess. Speed and elegance
6340 ;; doesn't always go hand in hand.
6346 (setq number (read cur))
6349 (narrow-to-region (point)
6350 (or (and (search-forward "\n.\n" nil t)
6356 (if (search-forward "\nsubject:" nil t)
6357 (funcall gnus-decode-encoded-word-function
6358 (nnheader-header-value))
6363 (if (search-forward "\nfrom:" nil t)
6364 (funcall gnus-decode-encoded-address-function
6365 (nnheader-header-value))
6370 (if (search-forward "\ndate:" nil t)
6371 (nnheader-header-value) ""))
6375 (setq id (if (re-search-forward
6376 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6377 ;; We do it this way to make sure the Message-ID
6378 ;; is (somewhat) syntactically valid.
6379 (buffer-substring (match-beginning 1)
6381 ;; If there was no message-id, we just fake one
6382 ;; to make subsequent routines simpler.
6383 (nnheader-generate-fake-message-id number))))
6387 (if (search-forward "\nreferences:" nil t)
6391 (nnheader-header-value)
6396 (search-backward ">" end t)
6399 (search-backward "<" end t)
6401 ;; Get the references from the in-reply-to header if there
6402 ;; were no references and the in-reply-to header looks
6404 (if (and (search-forward "\nin-reply-to:" nil t)
6405 (setq in-reply-to (nnheader-header-value))
6406 (string-match "<[^>]+>" in-reply-to))
6408 (setq ref (substring in-reply-to (match-beginning 0)
6410 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6411 (setq ref2 (substring in-reply-to (match-beginning 0)
6413 (when (> (length ref2) (length ref))
6420 (if (search-forward "\nchars: " nil t)
6421 (if (numberp (setq chars (ignore-errors (read cur))))
6427 (if (search-forward "\nlines: " nil t)
6428 (if (numberp (setq lines (ignore-errors (read cur))))
6434 (and (search-forward "\nxref:" nil t)
6435 (nnheader-header-value)))
6437 (when gnus-extra-headers
6438 (let ((extra gnus-extra-headers)
6442 (when (search-forward
6443 (concat "\n" (symbol-name (car extra)) ":") nil t)
6444 (push (cons (car extra) (nnheader-header-value))
6448 (when (equal id ref)
6451 (when gnus-alter-header-function
6452 (funcall gnus-alter-header-function header)
6453 (setq id (mail-header-id header)
6454 ref (gnus-parent-id (mail-header-references header))))
6457 (gnus-dependencies-add-header
6458 header dependencies force-new))
6459 (push header headers))
6460 (goto-char (point-max))
6462 (nreverse headers)))))
6464 ;; Goes through the xover lines and returns a list of vectors
6465 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6466 force-new dependencies
6467 group also-fetch-heads)
6468 "Parse the news overview data in the server buffer.
6469 Return a list of headers that match SEQUENCE (see
6470 `nntp-retrieve-headers')."
6471 ;; Get the Xref when the users reads the articles since most/some
6472 ;; NNTP servers do not include Xrefs when using XOVER.
6473 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6474 (let ((mail-parse-charset gnus-newsgroup-charset)
6475 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6476 (cur nntp-server-buffer)
6477 (dependencies (or dependencies gnus-newsgroup-dependencies))
6479 ((eq gnus-read-all-available-headers t)
6481 ((and (stringp gnus-read-all-available-headers)
6483 (string-match gnus-read-all-available-headers group))
6486 number headers header)
6487 (with-current-buffer nntp-server-buffer
6488 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6489 ;; Allow the user to mangle the headers before parsing them.
6490 (gnus-run-hooks 'gnus-parse-headers-hook)
6491 (goto-char (point-min))
6492 (gnus-parse-without-error
6493 (while (and (or sequence allp)
6495 (setq number (read cur))
6497 (while (and sequence
6498 (< (car sequence) number))
6499 (setq sequence (cdr sequence))))
6502 (eq number (car sequence))))
6504 (setq sequence (cdr sequence))
6505 (setq header (inline
6506 (gnus-nov-parse-line
6507 number dependencies force-new)))))
6508 (push header headers))
6510 ;; A common bug in inn is that if you have posted an article and
6511 ;; then retrieves the active file, it will answer correctly --
6512 ;; the new article is included. However, a NOV entry for the
6513 ;; article may not have been generated yet, so this may fail.
6514 ;; We work around this problem by retrieving the last few
6515 ;; headers using HEAD.
6516 (if (or (not also-fetch-heads)
6518 ;; We (probably) got all the headers.
6520 (let ((gnus-nov-is-evil t))
6523 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6524 (gnus-get-newsgroup-headers))))))))
6526 (defun gnus-article-get-xrefs ()
6527 "Fill in the Xref value in `gnus-current-headers', if necessary.
6528 This is meant to be called in `gnus-article-internal-prepare-hook'."
6529 (let ((headers (with-current-buffer gnus-summary-buffer
6530 gnus-current-headers)))
6531 (or (not gnus-use-cross-reference)
6533 (and (mail-header-xref headers)
6534 (not (string= (mail-header-xref headers) "")))
6535 (let ((case-fold-search t)
6538 (nnheader-narrow-to-headers)
6539 (goto-char (point-min))
6540 (when (or (and (not (eobp))
6541 (eq (downcase (char-after)) ?x)
6542 (looking-at "Xref:"))
6543 (search-forward "\nXref:" nil t))
6544 (goto-char (1+ (match-end 0)))
6545 (setq xref (buffer-substring (point) (point-at-eol)))
6546 (mail-header-set-xref headers xref)))))))
6548 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6549 "Find article ID and insert the summary line for that article.
6550 OLD-HEADER can either be a header or a line number to insert
6551 the subject line on.
6552 If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a header,
6553 and OLD-HEADER will be used when the summary line is inserted,
6554 too, instead of trying to fetch new headers."
6555 (let* ((line (and (numberp old-header) old-header))
6556 (old-header (and (vectorp old-header) old-header))
6557 (header (cond ((and old-header use-old-header)
6560 (gnus-number-to-header id))
6561 (gnus-number-to-header id))
6563 (gnus-read-header id))))
6564 (number (and (numberp id) id))
6567 ;; Rebuild the thread that this article is part of and go to the
6568 ;; article we have fetched.
6569 (when (and (not gnus-show-threads)
6572 (setq d (gnus-data-find (mail-header-number old-header))))
6573 (goto-char (gnus-data-pos d))
6579 (gnus-delete-line))))))
6580 ;; Remove list identifiers from subject.
6581 (let ((gnus-newsgroup-headers (list header)))
6582 (gnus-summary-remove-list-identifiers))
6584 (mail-header-set-number header (mail-header-number old-header)))
6585 (setq gnus-newsgroup-sparse
6586 (delq (setq number (mail-header-number header))
6587 gnus-newsgroup-sparse))
6588 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6589 (push number gnus-newsgroup-limit)
6590 (gnus-rebuild-thread (mail-header-id header) line)
6591 (gnus-summary-goto-subject number nil t))
6592 (when (and (numberp number)
6594 ;; We have to update the boundaries even if we can't fetch the
6595 ;; article if ID is a number -- so that the next `P' or `N'
6596 ;; command will fetch the previous (or next) article even
6597 ;; if the one we tried to fetch this time has been canceled.
6598 (unless (and gnus-newsgroup-end (< number gnus-newsgroup-end))
6599 (setq gnus-newsgroup-end number))
6600 (unless (and gnus-newsgroup-begin (> number gnus-newsgroup-begin))
6601 (setq gnus-newsgroup-begin number))
6602 (setq gnus-newsgroup-unselected
6603 (delq number gnus-newsgroup-unselected)))
6604 ;; Report back a success?
6605 (and header (mail-header-number header))))
6607 ;;; Process/prefix in the summary buffer
6609 (defun gnus-summary-work-articles (n)
6610 "Return a list of articles to be worked upon.
6611 The prefix argument, the list of process marked articles, and the
6612 current article will be taken into consideration."
6613 (with-current-buffer gnus-summary-buffer
6616 ;; A numerical prefix has been given.
6617 (setq n (prefix-numeric-value n))
6618 (let ((backward (< n 0))
6619 (n (abs (prefix-numeric-value n)))
6624 (push (setq article (gnus-summary-article-number))
6627 (gnus-summary-find-prev nil article)
6628 (gnus-summary-find-next nil article)))
6630 (nreverse articles)))
6631 ((and (and transient-mark-mode mark-active) (mark))
6632 (message "region active")
6633 ;; Work on the region between point and mark.
6634 (let ((max (max (point) (mark)))
6637 (goto-char (min (point) (mark)))
6640 (push (setq article (gnus-summary-article-number)) articles)
6641 (gnus-summary-find-next nil article)
6643 (nreverse articles))))
6644 (gnus-newsgroup-processable
6645 ;; There are process-marked articles present.
6646 ;; Save current state.
6647 (gnus-summary-save-process-mark)
6649 (reverse gnus-newsgroup-processable))
6651 ;; Just return the current article.
6652 (list (gnus-summary-article-number))))))
6654 (defmacro gnus-summary-iterate (arg &rest forms)
6655 "Iterate over the process/prefixed articles and do FORMS.
6656 ARG is the interactive prefix given to the command. FORMS will be
6657 executed with point over the summary line of the articles."
6658 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6659 `(let ((,articles (gnus-summary-work-articles ,arg)))
6661 (gnus-summary-goto-subject (car ,articles))
6665 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6666 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6668 (defun gnus-summary-save-process-mark ()
6669 "Push the current set of process marked articles on the stack."
6671 (push (copy-sequence gnus-newsgroup-processable)
6672 gnus-newsgroup-process-stack))
6674 (defun gnus-summary-kill-process-mark ()
6675 "Push the current set of process marked articles on the stack and unmark."
6677 (gnus-summary-save-process-mark)
6678 (gnus-summary-unmark-all-processable))
6680 (defun gnus-summary-yank-process-mark ()
6681 "Pop the last process mark state off the stack and restore it."
6683 (unless gnus-newsgroup-process-stack
6684 (error "Empty mark stack"))
6685 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6687 (defun gnus-summary-process-mark-set (set)
6688 "Make SET into the current process marked articles."
6689 (gnus-summary-unmark-all-processable)
6690 (mapc 'gnus-summary-set-process-mark set))
6692 ;;; Searching and stuff
6694 (defun gnus-summary-search-group (&optional backward use-level)
6695 "Search for next unread newsgroup.
6696 If optional argument BACKWARD is non-nil, search backward instead."
6697 (with-current-buffer gnus-group-buffer
6698 (when (gnus-group-search-forward
6699 backward nil (if use-level (gnus-group-group-level) nil))
6700 (gnus-group-group-name))))
6702 (defun gnus-summary-best-group (&optional exclude-group)
6703 "Find the name of the best unread group.
6704 If EXCLUDE-GROUP, do not go to this group."
6705 (with-current-buffer gnus-group-buffer
6707 (gnus-group-best-unread-group exclude-group))))
6709 (defun gnus-summary-find-next (&optional unread article backward)
6711 (gnus-summary-find-prev unread article)
6712 (let* ((dummy (gnus-summary-article-intangible-p))
6713 (article (or article (gnus-summary-article-number)))
6714 (data (gnus-data-find-list article))
6716 (when (and (not dummy)
6717 (or (not gnus-summary-check-current)
6719 (not (gnus-data-unread-p (car data)))))
6720 (setq data (cdr data)))
6725 (unless (memq (gnus-data-number (car data))
6727 ((eq gnus-auto-goto-ignores
6728 'always-undownloaded)
6729 gnus-newsgroup-undownloaded)
6732 ((eq gnus-auto-goto-ignores
6734 gnus-newsgroup-unfetched)
6735 ((eq gnus-auto-goto-ignores
6737 gnus-newsgroup-undownloaded)))
6738 (when (gnus-data-unread-p (car data))
6739 (setq result (car data)
6741 (setq data (cdr data)))
6744 (goto-char (gnus-data-pos result))
6745 (gnus-data-number result)))))
6747 (defun gnus-summary-find-prev (&optional unread article)
6748 (let* ((eobp (eobp))
6749 (article (or article (gnus-summary-article-number)))
6750 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6752 (when (and (not eobp)
6753 (or (not gnus-summary-check-current)
6755 (not (gnus-data-unread-p (car data)))))
6756 (setq data (cdr data)))
6761 (unless (memq (gnus-data-number (car data))
6763 ((eq gnus-auto-goto-ignores
6764 'always-undownloaded)
6765 gnus-newsgroup-undownloaded)
6768 ((eq gnus-auto-goto-ignores
6770 gnus-newsgroup-unfetched)
6771 ((eq gnus-auto-goto-ignores
6773 gnus-newsgroup-undownloaded)))
6774 (when (gnus-data-unread-p (car data))
6775 (setq result (car data)
6777 (setq data (cdr data)))
6780 (goto-char (gnus-data-pos result))
6781 (gnus-data-number result))))
6783 (defun gnus-summary-find-subject (subject &optional unread backward article)
6784 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6785 (article (or article (gnus-summary-article-number)))
6786 (articles (gnus-data-list backward))
6787 (arts (gnus-data-find-list article articles))
6789 (when (or (not gnus-summary-check-current)
6791 (not (gnus-data-unread-p (car arts))))
6792 (setq arts (cdr arts)))
6794 (and (or (not unread)
6795 (gnus-data-unread-p (car arts)))
6796 (vectorp (gnus-data-header (car arts)))
6798 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6799 (setq result (car arts)
6801 (setq arts (cdr arts)))
6803 (goto-char (gnus-data-pos result))
6804 (gnus-data-number result))))
6806 (defun gnus-summary-search-forward (&optional unread subject backward)
6807 "Search forward for an article.
6808 If UNREAD, look for unread articles. If SUBJECT, look for
6809 articles with that subject. If BACKWARD, search backward instead."
6810 (cond (subject (gnus-summary-find-subject subject unread backward))
6811 (backward (gnus-summary-find-prev unread))
6812 (t (gnus-summary-find-next unread))))
6814 (defun gnus-recenter (&optional n)
6815 "Center point in window and redisplay frame.
6816 Also do horizontal recentering."
6818 (when (and gnus-auto-center-summary
6819 (not (eq gnus-auto-center-summary 'vertical)))
6820 (gnus-horizontal-recenter))
6821 (recenter-top-bottom n))
6823 (put 'gnus-recenter 'isearch-scroll t)
6825 (defun gnus-forward-line-ignore-invisible (n)
6826 "Move N lines forward (backward if N is negative).
6827 Like forward-line, but skip over (and don't count) invisible lines."
6829 (while (and (> n 0) (not done))
6830 ;; If the following character is currently invisible,
6831 ;; skip all characters with that same `invisible' property value.
6832 (while (invisible-p (point))
6833 (goto-char (next-char-property-change (point))))
6838 (while (and (< n 0) (not done))
6840 (if (bobp) (setq done t)
6842 (while (and (not (bobp)) (invisible-p (1- (point))))
6843 (goto-char (previous-char-property-change (point))))))))
6845 (defun gnus-summary-recenter ()
6846 "Center point in the summary window.
6847 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6848 displayed, no centering will be performed."
6849 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6850 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6852 ;; The user has to want it.
6853 (when gnus-auto-center-summary
6854 (let* ((top (cond ((< (window-height) 4) 0)
6855 ((< (window-height) 7) 1)
6856 (t (if (numberp gnus-auto-center-summary)
6857 gnus-auto-center-summary
6858 (/ (1- (window-height)) 2)))))
6859 (height (1- (window-height)))
6860 (bottom (save-excursion
6861 (goto-char (point-max))
6862 (gnus-forward-line-ignore-invisible (- height))
6864 (window (get-buffer-window (current-buffer))))
6865 (when (get-buffer-window gnus-article-buffer)
6866 ;; Only do recentering when the article buffer is displayed,
6867 ;; Set the window start to either `bottom', which is the biggest
6868 ;; possible valid number, or the second line from the top,
6869 ;; whichever is the least.
6870 (let ((top-pos (save-excursion
6871 (gnus-forward-line-ignore-invisible (- top))
6873 (if (> bottom top-pos)
6874 ;; Keep the second line from the top visible
6875 (set-window-start window top-pos)
6876 ;; Try to keep the bottom line visible; if it's partially
6877 ;; obscured, either scroll one more line to make it fully
6878 ;; visible, or revert to using TOP-POS.
6880 (goto-char (point-max))
6881 (gnus-forward-line-ignore-invisible -1)
6882 (let ((last-line-start (point)))
6884 (set-window-start window (point) t)
6885 (when (not (pos-visible-in-window-p last-line-start window))
6886 (gnus-forward-line-ignore-invisible 1)
6887 (set-window-start window (min (point) top-pos) t)))))))
6888 ;; Do horizontal recentering while we're at it.
6889 (when (and (get-buffer-window (current-buffer) t)
6890 (not (eq gnus-auto-center-summary 'vertical)))
6891 (let ((selected (selected-window)))
6892 (select-window (get-buffer-window (current-buffer) t))
6893 (gnus-summary-position-point)
6894 (gnus-horizontal-recenter)
6895 (select-window selected))))))
6897 (defun gnus-summary-jump-to-group (newsgroup)
6898 "Move point to NEWSGROUP in group mode buffer."
6899 ;; Keep update point of group mode buffer if visible.
6900 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6901 (save-window-excursion
6902 ;; Take care of tree window mode.
6903 (when (get-buffer-window gnus-group-buffer)
6904 (pop-to-buffer gnus-group-buffer))
6905 (gnus-group-jump-to-group newsgroup))
6907 ;; Take care of tree window mode.
6908 (if (get-buffer-window gnus-group-buffer 0)
6909 (pop-to-buffer gnus-group-buffer)
6910 (set-buffer gnus-group-buffer))
6911 (gnus-group-jump-to-group newsgroup))))
6913 ;; This function returns a list of article numbers based on the
6914 ;; difference between the ranges of read articles in this group and
6915 ;; the range of active articles.
6916 (defun gnus-list-of-unread-articles (group)
6917 (let* ((read (gnus-info-read (gnus-get-info group)))
6918 (active (or (gnus-active group) (gnus-activate-group group)))
6919 (last (or (cdr active)
6920 (error "Group %s couldn't be activated " group)))
6921 (bottom (if gnus-newsgroup-maximum-articles
6923 (- last gnus-newsgroup-maximum-articles -1))
6926 ;; If none are read, then all are unread.
6929 ;; If the range of read articles is a single range, then the
6930 ;; first unread article is the article after the last read
6931 ;; article. Sounds logical, doesn't it?
6932 (if (and (not (listp (cdr read)))
6933 (or (< (car read) bottom)
6934 (progn (setq read (list read))
6936 (setq first (max bottom (1+ (cdr read))))
6937 ;; `read' is a list of ranges.
6938 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6941 (setq first bottom))
6944 (while (< first nlast)
6945 (setq unread (cons first unread)
6947 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6948 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6949 (setq read (cdr read)))))
6950 ;; And add the last unread articles.
6951 (while (<= first last)
6952 (setq unread (cons first unread)
6954 ;; Return the list of unread articles.
6955 (delq 0 (nreverse unread))))
6957 (defun gnus-list-of-read-articles (group)
6958 "Return a list of unread, unticked and non-dormant articles."
6959 (let* ((info (gnus-get-info group))
6960 (marked (gnus-info-marks info))
6961 (active (gnus-active group)))
6963 (gnus-list-range-difference
6964 (gnus-list-range-difference
6965 (gnus-sorted-complement
6966 (gnus-uncompress-range
6967 (if gnus-newsgroup-maximum-articles
6968 (cons (max (car active)
6970 gnus-newsgroup-maximum-articles
6974 (gnus-list-of-unread-articles group))
6975 (cdr (assq 'dormant marked)))
6976 (cdr (assq 'tick marked))))))
6978 ;; This function returns a sequence of article numbers based on the
6979 ;; difference between the ranges of read articles in this group and
6980 ;; the range of active articles.
6981 (defun gnus-sequence-of-unread-articles (group)
6982 (let* ((read (gnus-info-read (gnus-get-info group)))
6983 (active (or (gnus-active group) (gnus-activate-group group)))
6985 (bottom (if gnus-newsgroup-maximum-articles
6987 (- last gnus-newsgroup-maximum-articles -1))
6990 ;; If none are read, then all are unread.
6993 ;; If the range of read articles is a single range, then the
6994 ;; first unread article is the article after the last read
6995 ;; article. Sounds logical, doesn't it?
6996 (if (and (not (listp (cdr read)))
6997 (or (< (car read) bottom)
6998 (progn (setq read (list read))
7000 (setq first (max bottom (1+ (cdr read))))
7001 ;; `read' is a list of ranges.
7002 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
7005 (setq first bottom))
7008 (push (cons first nlast) unread))
7009 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
7010 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
7011 (setq read (cdr read)))))
7012 ;; And add the last unread articles.
7013 (cond ((not (and first last))
7016 (push (cons first last) unread))
7018 (push first unread)))
7019 ;; Return the sequence of unread articles.
7020 (delq 0 (nreverse unread))))
7022 ;; Various summary commands
7024 (defun gnus-summary-select-article-buffer ()
7025 "Reconfigure windows to show the article buffer.
7026 If `gnus-widen-article-window' is set, show only the article
7029 (if (not (gnus-buffer-live-p gnus-article-buffer))
7030 (error "There is no article buffer for this summary buffer")
7031 (unless (get-buffer-window gnus-article-buffer)
7032 (gnus-summary-show-article))
7033 (gnus-configure-windows
7034 (if gnus-widen-article-window
7038 (select-window (get-buffer-window gnus-article-buffer))))
7040 (defun gnus-summary-universal-argument (arg)
7041 "Perform any operation on all articles that are process/prefixed."
7043 (let ((articles (gnus-summary-work-articles arg))
7050 (substitute-command-keys
7051 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
7053 (gnus-error 1 "Undefined key")
7056 (gnus-summary-goto-subject (setq article (pop articles)))
7057 (let (gnus-newsgroup-processable)
7058 (command-execute func))
7059 (gnus-summary-remove-process-mark article)))))
7060 (gnus-summary-position-point))
7062 (define-obsolete-function-alias
7063 'gnus-summary-toggle-truncation 'toggle-truncate-lines "26.1")
7065 (defun gnus-summary-find-for-reselect ()
7066 "Return the number of an article to stay on across a reselect.
7067 The current article is considered, then following articles, then previous
7068 articles. An article is sought which is not canceled and isn't a temporary
7069 insertion from another group. If there's no such then return a dummy 0."
7071 (dolist (rev '(nil t))
7072 (unless found ; don't demand the reverse list if we don't need it
7073 (let ((data (gnus-data-find-list
7074 (gnus-summary-article-number) (gnus-data-list rev))))
7075 (while (and data (not found))
7076 (if (and (< 0 (gnus-data-number (car data)))
7077 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
7078 (setq found (gnus-data-number (car data))))
7079 (setq data (cdr data))))))
7082 (defun gnus-summary-reselect-current-group (&optional all rescan)
7083 "Exit and then reselect the current newsgroup.
7084 The prefix argument ALL means to select all articles."
7086 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
7087 (error "Ephemeral groups can't be reselected"))
7088 (let ((current-subject (gnus-summary-find-for-reselect))
7089 (group gnus-newsgroup-name))
7090 (setq gnus-newsgroup-begin nil)
7091 (gnus-summary-exit nil 'leave-hidden)
7092 ;; We have to adjust the point of group mode buffer because
7093 ;; point was moved to the next unread newsgroup by exiting.
7094 (gnus-summary-jump-to-group group)
7097 (gnus-group-get-new-news-this-group 1)))
7098 (gnus-group-read-group all t)
7099 (gnus-summary-goto-subject current-subject nil t)))
7101 (defun gnus-summary-rescan-group (&optional all)
7102 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7104 (let ((config gnus-current-window-configuration))
7105 (gnus-summary-reselect-current-group all t)
7106 (gnus-configure-windows config)
7107 (when (eq config 'article)
7108 (gnus-summary-select-article))))
7110 (defun gnus-summary-update-info (&optional non-destructive)
7112 (let ((group gnus-newsgroup-name))
7114 (when gnus-newsgroup-kill-headers
7115 (setq gnus-newsgroup-killed
7116 (gnus-compress-sequence
7118 (gnus-list-range-intersection
7119 gnus-newsgroup-unselected gnus-newsgroup-killed)
7120 gnus-newsgroup-unreads)
7122 (unless (listp (cdr gnus-newsgroup-killed))
7123 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7124 (let ((headers gnus-newsgroup-headers)
7125 (ephemeral-p (gnus-ephemeral-group-p group))
7128 (setq info (copy-sequence (gnus-get-info group))
7129 info (delq (gnus-info-params info) info)))
7130 ;; Set the new ranges of read articles.
7131 (with-current-buffer gnus-group-buffer
7132 (gnus-undo-force-boundary))
7133 (gnus-update-read-articles
7134 group (gnus-sorted-union
7135 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7136 ;; Set the current article marks.
7137 (let ((gnus-newsgroup-scored
7138 (if (and (not gnus-save-score)
7139 (not non-destructive))
7141 gnus-newsgroup-scored)))
7143 (gnus-update-marks)))
7144 ;; Do the cross-ref thing.
7145 (when gnus-use-cross-reference
7146 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7147 ;; Do not switch windows but change the buffer to work.
7148 (set-buffer gnus-group-buffer)
7150 (gnus-group-update-group
7153 (setq info (copy-sequence (gnus-get-info group))
7154 info (delq (gnus-info-params info) info))))))))))
7156 (defun gnus-summary-save-newsrc (&optional force)
7157 "Save the current number of read/marked articles in the dribble buffer.
7158 The dribble buffer will then be saved.
7159 If FORCE (the prefix), also save the .newsrc file(s)."
7161 (gnus-summary-update-info t)
7163 (gnus-save-newsrc-file)
7164 (gnus-dribble-save)))
7166 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7167 (declare-function gnus-article-stop-animations "gnus-art" ())
7169 (defun gnus-summary-exit (&optional temporary leave-hidden)
7170 "Exit reading current newsgroup, and then return to group selection mode.
7171 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7173 (gnus-set-global-variables)
7174 (when (gnus-buffer-live-p gnus-article-buffer)
7175 (with-current-buffer gnus-article-buffer
7176 (mm-destroy-parts gnus-article-mime-handles)
7177 ;; Set it to nil for safety reason.
7178 (setq gnus-article-mime-handle-alist nil)
7179 (setq gnus-article-mime-handles nil)))
7180 (gnus-kill-save-kill-buffer)
7181 (gnus-async-halt-prefetch)
7182 (let* ((group gnus-newsgroup-name)
7183 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7184 (gnus-group-is-exiting-p t)
7185 (article-buffer gnus-article-buffer)
7186 (original-article-buffer gnus-original-article-buffer)
7189 (buf (current-buffer))
7190 ;; `gnus-single-article-buffer' is nil buffer-locally in
7191 ;; ephemeral group of which summary buffer will be killed,
7192 ;; but the global value may be non-nil.
7193 (single-article-buffer gnus-single-article-buffer))
7195 ;; Do adaptive scoring, and possibly save score files.
7196 (when gnus-newsgroup-adaptive
7197 (gnus-score-adaptive))
7198 (when gnus-use-scoring
7200 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7201 (when gnus-use-cache
7202 (gnus-cache-possibly-remove-articles)
7203 (gnus-cache-save-buffers))
7204 (gnus-async-prefetch-remove-group group)
7205 (when gnus-suppress-duplicates
7206 (gnus-dup-enter-articles))
7207 (when gnus-use-trees
7209 (when gnus-use-cache
7210 (gnus-cache-write-active))
7211 ;; Remove entries for this group.
7212 (nnmail-purge-split-history (gnus-group-real-name group))
7213 ;; Make all changes in this group permanent.
7215 (gnus-run-hooks 'gnus-exit-group-hook)
7216 (gnus-summary-update-info))
7217 (gnus-close-group group)
7218 ;; Make sure where we were, and go to next newsgroup.
7219 (when (buffer-live-p (get-buffer gnus-group-buffer))
7220 (set-buffer gnus-group-buffer))
7222 (gnus-group-jump-to-group group))
7223 (gnus-run-hooks 'gnus-summary-exit-hook)
7224 (unless (or quit-config
7225 (not gnus-summary-next-group-on-exit)
7226 ;; If this group has disappeared from the summary
7227 ;; buffer, don't skip forwards.
7228 (not (string= group (gnus-group-group-name))))
7229 (gnus-group-next-unread-group 1))
7230 (setq group-point (point))
7231 (gnus-article-stop-animations)
7235 (if (not gnus-kill-summary-on-exit)
7237 (gnus-deaden-summary)
7239 (when (get-buffer gnus-article-buffer)
7240 (bury-buffer gnus-article-buffer))
7241 ;; Return to group mode buffer.
7242 (when (eq mode 'gnus-summary-mode)
7243 (gnus-kill-buffer buf)))
7245 (setq gnus-current-select-method gnus-select-method)
7246 (when (gnus-buffer-live-p gnus-group-buffer)
7247 (set-buffer gnus-group-buffer))
7249 (gnus-handle-ephemeral-exit quit-config)
7250 (goto-char group-point)
7251 ;; If gnus-group-buffer is already displayed, make sure we also move
7252 ;; the cursor in the window that displays it.
7253 (let ((win (get-buffer-window (current-buffer) 0)))
7254 (if win (set-window-point win (point))))
7255 (unless leave-hidden
7256 (gnus-configure-windows 'group 'force)))
7258 ;; If we have several article buffers, we kill them at exit.
7259 (unless single-article-buffer
7260 (when (gnus-buffer-live-p article-buffer)
7261 (with-current-buffer article-buffer
7262 ;; Don't kill sticky article buffers
7263 (unless (eq major-mode 'gnus-sticky-article-mode)
7264 (gnus-kill-buffer article-buffer)
7265 (setq gnus-article-current nil))))
7266 (gnus-kill-buffer original-article-buffer))
7268 ;; Clear the current group name.
7270 (setq gnus-newsgroup-name nil)))))
7272 (declare-function gnus-stop-downloads "gnus-art" ())
7274 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7275 (defun gnus-summary-exit-no-update (&optional no-questions)
7276 "Quit reading current newsgroup without updating read article info."
7278 (let* ((group gnus-newsgroup-name)
7279 (gnus-group-is-exiting-p t)
7280 (gnus-group-is-exiting-without-update-p t)
7281 (quit-config (gnus-group-quit-config group)))
7282 (when (or no-questions
7283 (gnus-ephemeral-group-p group)
7285 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7286 (gnus-async-halt-prefetch)
7287 (run-hooks 'gnus-summary-prepare-exit-hook)
7288 (when (gnus-buffer-live-p gnus-article-buffer)
7289 (with-current-buffer gnus-article-buffer
7290 (gnus-article-stop-animations)
7291 (gnus-stop-downloads)
7292 (mm-destroy-parts gnus-article-mime-handles)
7293 ;; Set it to nil for safety reason.
7294 (setq gnus-article-mime-handle-alist nil)
7295 (setq gnus-article-mime-handles nil)))
7296 ;; If we have several article buffers, we kill them at exit.
7297 (unless gnus-single-article-buffer
7298 (gnus-kill-buffer gnus-article-buffer)
7299 (gnus-kill-buffer gnus-original-article-buffer)
7300 (setq gnus-article-current nil))
7301 ;; Return to the group buffer.
7302 (if (not gnus-kill-summary-on-exit)
7304 (gnus-deaden-summary)
7305 (gnus-configure-windows 'group 'force))
7306 (gnus-configure-windows 'group 'force)
7307 (gnus-close-group group)
7308 (gnus-kill-buffer gnus-summary-buffer))
7309 (unless gnus-single-article-buffer
7310 (setq gnus-article-current nil))
7311 (when gnus-use-trees
7313 (gnus-async-prefetch-remove-group group)
7314 (when (get-buffer gnus-article-buffer)
7315 (bury-buffer gnus-article-buffer))
7316 ;; Clear the current group name.
7317 (setq gnus-newsgroup-name nil)
7318 (unless (gnus-ephemeral-group-p group)
7319 (gnus-group-update-group group nil t))
7320 (when (equal (gnus-group-group-name) group)
7321 (gnus-group-next-unread-group 1))
7322 (gnus-article-stop-animations)
7324 (gnus-handle-ephemeral-exit quit-config)))))
7326 (defun gnus-handle-ephemeral-exit (quit-config)
7327 "Handle movement when leaving an ephemeral group.
7328 The state which existed when entering the ephemeral is reset."
7329 (if (not (buffer-live-p (car quit-config)))
7330 (when (gnus-buffer-live-p gnus-group-buffer)
7331 (gnus-configure-windows 'group 'force))
7332 (set-buffer (car quit-config))
7333 (unless (eq (cdr quit-config) 'group)
7334 (setq gnus-current-select-method
7335 (gnus-find-method-for-group gnus-newsgroup-name)))
7336 (cond ((derived-mode-p 'gnus-summary-mode)
7337 (gnus-set-global-variables))
7338 ((derived-mode-p 'gnus-article-mode)
7339 (save-current-buffer
7340 ;; The `gnus-summary-buffer' variable may point
7341 ;; to the old summary buffer when using a single
7343 (unless (gnus-buffer-live-p gnus-summary-buffer)
7344 (set-buffer gnus-group-buffer))
7345 (set-buffer gnus-summary-buffer)
7346 (gnus-set-global-variables))))
7347 (if (or (eq (cdr quit-config) 'article)
7348 (eq (cdr quit-config) 'pick))
7349 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7350 (gnus-configure-windows 'pick 'force)
7351 (gnus-configure-windows (cdr quit-config) 'force))
7352 (gnus-configure-windows (cdr quit-config) 'force))
7353 (when (derived-mode-p 'gnus-summary-mode)
7354 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7355 next-unread-noselect))
7356 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7358 (gnus-summary-next-subject 1 nil t))
7359 ((eq gnus-auto-select-on-ephemeral-exit
7360 'next-unread-noselect)
7361 (gnus-summary-next-subject 1 t t))))
7362 ;; Hide the article buffer which displays the article different
7363 ;; from the one that the cursor points to in the summary buffer.
7364 (gnus-configure-windows 'summary 'force))
7365 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7366 (gnus-summary-next-subject 1))
7367 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7368 (gnus-summary-next-subject 1 t))))
7369 (gnus-summary-recenter)
7370 (gnus-summary-position-point))))
7374 (defvar gnus-dead-summary-mode-map
7375 (let ((map (make-keymap)))
7376 (suppress-keymap map)
7377 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7378 (dolist (key '("\C-d" "\r" "\177" [delete]))
7379 (define-key map key 'gnus-summary-wake-up-the-dead))
7380 (dolist (key '("q" "Q"))
7381 (define-key map key 'bury-buffer))
7384 (define-minor-mode gnus-dead-summary-mode
7385 "Minor mode for Gnus summary buffers."
7386 :lighter " Dead" :keymap gnus-dead-summary-mode-map
7387 (unless (derived-mode-p 'gnus-summary-mode)
7388 (setq gnus-dead-summary-mode nil)))
7390 (defun gnus-deaden-summary ()
7391 "Make the current summary buffer into a dead summary buffer."
7392 ;; Kill any previous dead summary buffer.
7393 (when (and gnus-dead-summary
7394 (buffer-name gnus-dead-summary))
7395 (with-current-buffer gnus-dead-summary
7396 (when gnus-dead-summary-mode
7397 (kill-buffer (current-buffer)))))
7398 ;; Make this the current dead summary.
7399 (setq gnus-dead-summary (current-buffer))
7400 (gnus-dead-summary-mode 1)
7401 (let ((name (buffer-name)))
7402 (when (string-match "Summary" name)
7404 (concat (substring name 0 (match-beginning 0)) "Dead "
7405 (substring name (match-beginning 0)))
7409 (defun gnus-kill-or-deaden-summary (buffer)
7410 "Kill or deaden the summary BUFFER."
7412 (when (and (buffer-name buffer)
7413 (not gnus-single-article-buffer))
7414 (with-current-buffer buffer
7415 (gnus-kill-buffer gnus-article-buffer)
7416 (gnus-kill-buffer gnus-original-article-buffer)))
7419 (gnus-kill-summary-on-exit
7420 (when (and gnus-use-trees
7421 (gnus-buffer-exists-p buffer))
7422 (with-current-buffer buffer
7424 (gnus-kill-buffer buffer))
7425 ;; Deaden the buffer.
7426 ((gnus-buffer-exists-p buffer)
7427 (with-current-buffer buffer
7428 (gnus-deaden-summary))))))
7430 (defun gnus-summary-wake-up-the-dead (&rest args)
7431 "Wake up the dead summary buffer."
7433 (gnus-dead-summary-mode -1)
7434 (let ((name (buffer-name)))
7435 (when (string-match "Dead " name)
7437 (concat (substring name 0 (match-beginning 0))
7438 (substring name (match-end 0)))
7440 (gnus-message 3 "This dead summary is now alive again"))
7442 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7443 (defun gnus-summary-describe-group (&optional force)
7444 "Describe the current newsgroup."
7446 (gnus-group-describe-group force gnus-newsgroup-name))
7448 (defun gnus-summary-describe-briefly ()
7449 "Describe summary mode commands briefly."
7451 (gnus-message 6 "%s" (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")))
7453 ;; Walking around group mode buffer from summary mode.
7455 (defun gnus-summary-next-group (&optional no-article target-group backward)
7456 "Exit current newsgroup and then select next unread newsgroup.
7457 If prefix argument NO-ARTICLE is non-nil, no article is selected
7458 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7459 previous group instead."
7461 ;; Stop pre-fetching.
7462 (gnus-async-halt-prefetch)
7463 (let ((current-group gnus-newsgroup-name)
7464 (current-buffer (current-buffer))
7466 ;; First we semi-exit this group to update Xrefs and all variables.
7467 ;; We can't do a real exit, because the window conf must remain
7468 ;; the same in case the user is prompted for info, and we don't
7469 ;; want the window conf to change before that...
7470 (gnus-summary-exit t)
7471 (while (not entered)
7472 ;; Then we find what group we are supposed to enter.
7473 (set-buffer gnus-group-buffer)
7474 (gnus-group-jump-to-group current-group)
7477 (if (eq gnus-keep-same-level 'best)
7478 (gnus-summary-best-group gnus-newsgroup-name)
7479 (gnus-summary-search-group backward gnus-keep-same-level))))
7480 (if (not target-group)
7481 ;; There are no further groups, so we return to the group
7484 (gnus-message 5 "Returning to the group buffer")
7486 (when (gnus-buffer-live-p current-buffer)
7487 (set-buffer current-buffer)
7488 (gnus-summary-exit))
7489 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7490 ;; We try to enter the target group.
7491 (gnus-group-jump-to-group target-group)
7492 (let ((unreads (gnus-group-group-unread)))
7493 (if (and (or (eq t unreads)
7494 (and unreads (not (zerop unreads))))
7495 (gnus-summary-read-group
7496 target-group nil no-article
7497 (and (buffer-name current-buffer) current-buffer)
7500 (setq current-group target-group
7501 target-group nil)))))))
7503 (defun gnus-summary-prev-group (&optional no-article)
7504 "Exit current newsgroup and then select previous unread newsgroup.
7505 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7507 (gnus-summary-next-group no-article nil t))
7509 ;; Walking around summary lines.
7511 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7512 "Go to the first subject satisfying any non-nil constraint.
7513 If UNREAD is non-nil, the article should be unread.
7514 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7515 If UNSEEN is non-nil, the article should be unseen as well as unread.
7516 Returns the article selected or nil if there are no matching articles."
7520 ((null gnus-newsgroup-data)
7521 (gnus-message 3 "No articles in the group")
7523 ;; Pick the first article.
7524 ((not (or unread undownloaded unseen))
7525 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7526 (gnus-data-number (car gnus-newsgroup-data)))
7527 ;; Find the first unread article.
7529 (let ((data gnus-newsgroup-data))
7531 (let ((num (gnus-data-number (car data))))
7532 (or (memq num gnus-newsgroup-unfetched)
7533 (not (or (and unread
7534 (memq num gnus-newsgroup-unreads))
7536 (memq num gnus-newsgroup-undownloaded))
7538 (memq num gnus-newsgroup-unseen)
7539 (memq num gnus-newsgroup-unreads)))))))
7540 (setq data (cdr data)))
7544 (goto-char (gnus-data-pos (car data)))
7545 (gnus-data-number (car data)))
7546 (gnus-message 3 "No more%s articles"
7547 (let* ((r (when unread " unread"))
7548 (d (when undownloaded " undownloaded"))
7549 (s (when unseen " unseen"))
7550 (l (delq nil (list r d s))))
7551 (cond ((= 3 (length l))
7552 (concat r "," d ", or" s))
7554 (concat (car l) ", or" (cadr l)))
7561 (gnus-summary-position-point))))))
7563 (defun gnus-summary-next-subject (n &optional unread dont-display)
7564 "Go to next N'th summary line.
7565 If N is negative, go to the previous N'th subject line.
7566 If UNREAD is non-nil, only unread articles are selected.
7567 The difference between N and the actual number of steps taken is
7570 (let ((backward (< n 0))
7574 (gnus-summary-find-prev unread)
7575 (gnus-summary-find-next unread)))
7576 (unless (zerop (setq n (1- n)))
7577 (gnus-summary-show-thread)))
7579 (gnus-message 7 "No more%s articles"
7580 (if unread " unread" "")))
7581 (unless dont-display
7582 (gnus-summary-recenter)
7583 (gnus-summary-position-point))
7586 (defun gnus-summary-next-unread-subject (n)
7587 "Go to next N'th unread summary line."
7589 (gnus-summary-next-subject n t))
7591 (defun gnus-summary-prev-subject (n &optional unread)
7592 "Go to previous N'th summary line.
7593 If optional argument UNREAD is non-nil, only unread article is selected."
7595 (gnus-summary-next-subject (- n) unread))
7597 (defun gnus-summary-prev-unread-subject (n)
7598 "Go to previous N'th unread summary line."
7600 (gnus-summary-next-subject (- n) t))
7602 (defun gnus-summary-goto-subjects (articles)
7603 "Insert the subject header for ARTICLES in the current buffer."
7605 (dolist (article articles)
7606 (gnus-summary-goto-subject article t)))
7607 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7608 (gnus-summary-position-point))
7610 (defun gnus-summary-goto-subject (article &optional force silent)
7611 "Go to the subject line of ARTICLE.
7612 If FORCE, also allow jumping to articles not currently shown."
7613 (interactive "nArticle number: ")
7614 (unless (numberp article)
7615 (error "Article %s is not a number" article))
7617 (data (gnus-data-find article)))
7618 ;; We read in the article if we have to.
7621 (gnus-summary-insert-subject
7623 (if (or (numberp force) (vectorp force)) force)
7625 (setq data (gnus-data-find article)))
7630 (gnus-message 3 "Can't find article %d" article))
7632 (let ((pt (gnus-data-pos data)))
7634 (gnus-summary-set-article-display-arrow pt))
7635 (gnus-summary-position-point)
7638 ;; Walking around summary lines with displaying articles.
7640 (defun gnus-summary-expand-window (&optional arg)
7641 "Make the summary buffer take up the entire Emacs frame.
7642 Given a prefix, will force an `article' buffer configuration."
7645 (gnus-configure-windows 'article 'force)
7646 (gnus-configure-windows 'summary 'force)))
7648 (defun gnus-summary-display-article (article &optional all-header)
7649 "Display ARTICLE in article buffer."
7650 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7651 (with-current-buffer gnus-article-buffer
7652 (derived-mode-p 'gnus-article-mode)))
7653 (gnus-article-setup-buffer))
7654 (gnus-set-global-variables)
7655 (with-current-buffer gnus-article-buffer
7656 (setq gnus-article-charset gnus-newsgroup-charset)
7657 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7658 (mm-enable-multibyte))
7662 (if gnus-summary-display-article-function
7663 (funcall gnus-summary-display-article-function article all-header)
7664 (gnus-article-prepare article all-header))
7665 (gnus-run-hooks 'gnus-select-article-hook)
7666 (when (and gnus-current-article
7667 (not (zerop gnus-current-article)))
7668 (gnus-summary-goto-subject gnus-current-article))
7669 (gnus-summary-recenter)
7670 (when (and gnus-use-trees gnus-show-threads)
7671 (gnus-possibly-generate-tree article)
7672 (gnus-highlight-selected-tree article))
7673 ;; Successfully display article.
7674 (gnus-article-set-window-start
7675 (cdr (assq article gnus-newsgroup-bookmarks))))))
7677 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7678 "Select the current article.
7679 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7680 non-nil, the article will be re-fetched even if it already present in
7681 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7683 ;; Make sure we are in the summary buffer to work around bbdb bug.
7684 (unless (derived-mode-p 'gnus-summary-mode)
7685 (set-buffer gnus-summary-buffer))
7686 (let ((article (or article (gnus-summary-article-number)))
7687 (all-headers (not (not all-headers))) ;Must be t or nil.
7688 gnus-summary-display-article-function)
7690 (gnus-summary-article-pseudo-p article)
7691 (error "This is a pseudo-article"))
7692 (with-current-buffer gnus-summary-buffer
7693 (if (or (and gnus-single-article-buffer
7694 (or (null gnus-current-article)
7695 (null gnus-article-current)
7696 (null (get-buffer gnus-article-buffer))
7697 (not (eq article (cdr gnus-article-current)))
7698 (not (equal (car gnus-article-current)
7699 gnus-newsgroup-name))
7700 (not (get-buffer gnus-original-article-buffer))))
7701 (and (not gnus-single-article-buffer)
7702 (or (null gnus-current-article)
7703 (not (get-buffer gnus-original-article-buffer))
7704 (not (eq gnus-current-article article))))
7706 ;; The requested article is different from the current article.
7708 (gnus-summary-display-article article all-headers)
7709 (when (gnus-buffer-live-p gnus-article-buffer)
7710 (with-current-buffer gnus-article-buffer
7711 (if (not gnus-article-decoded-p) ;; a local variable
7712 (mm-disable-multibyte))))
7713 (gnus-article-set-window-start
7714 (cdr (assq article gnus-newsgroup-bookmarks)))
7718 (defun gnus-summary-force-verify-and-decrypt ()
7719 "Display buttons for signed/encrypted parts and verify/decrypt them."
7721 (let ((mm-verify-option 'known)
7722 (mm-decrypt-option 'known)
7723 (gnus-article-emulate-mime t)
7724 (gnus-buttonized-mime-types (append (list "multipart/signed"
7725 "multipart/encrypted")
7726 gnus-buttonized-mime-types)))
7727 (gnus-summary-select-article nil 'force)))
7729 (defun gnus-summary-next-article (&optional unread subject backward push)
7730 "Select the next article.
7731 If UNREAD, only unread articles are selected.
7732 If SUBJECT, only articles with SUBJECT are selected.
7733 If BACKWARD, the previous article is selected instead of the next."
7735 ;; Make sure we are in the summary buffer.
7736 (unless (derived-mode-p 'gnus-summary-mode)
7737 (set-buffer gnus-summary-buffer))
7739 ;; Is there such an article?
7740 ((and (gnus-summary-search-forward unread subject backward)
7741 (or (gnus-summary-display-article (gnus-summary-article-number))
7742 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7743 (gnus-summary-position-point))
7744 ;; If not, we try the first unread, if that is wanted.
7746 gnus-auto-select-same
7747 (gnus-summary-first-unread-article))
7748 (gnus-summary-position-point)
7749 (gnus-message 6 "Wrapped"))
7750 ;; Try to get next/previous article not displayed in this group.
7751 ((and gnus-auto-extend-newsgroup
7752 (not unread) (not subject))
7753 (gnus-summary-goto-article
7754 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7755 nil (count-lines (point-min) (point))))
7756 ;; Go to next/previous group.
7758 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7759 (gnus-summary-jump-to-group gnus-newsgroup-name))
7760 (let ((cmd last-command-event)
7762 (with-current-buffer gnus-group-buffer
7764 (current-summary (current-buffer))
7766 (if (eq gnus-keep-same-level 'best)
7767 (gnus-summary-best-group gnus-newsgroup-name)
7768 (gnus-summary-search-group backward gnus-keep-same-level))))
7769 ;; Select next unread newsgroup automagically.
7771 ((or (not gnus-auto-select-next)
7773 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7774 ((or (eq gnus-auto-select-next 'quietly)
7775 (and (eq gnus-auto-select-next 'slightly-quietly)
7777 (and (eq gnus-auto-select-next 'almost-quietly)
7778 (gnus-summary-last-article-p)))
7780 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7782 (gnus-message 7 "No more%s articles (%s)..."
7783 (if unread " unread" "")
7784 (if group (concat "selecting " group)
7786 (gnus-summary-next-group nil group backward)))
7788 (when (numberp last-input-event)
7789 ;; Somehow or other, we may now have selected a different
7790 ;; window. Make point go back to the summary buffer.
7791 (when (eq current-summary (current-buffer))
7792 ;; FIXME: This burps when get-buffer-window returns nil.
7793 (select-window (get-buffer-window current-summary 0)))
7794 (gnus-summary-walk-group-buffer
7795 gnus-newsgroup-name cmd unread backward point))))))))
7797 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7798 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7799 (?\C-p (gnus-group-prev-unread-group 1))))
7800 (cursor-in-echo-area t)
7801 keve key group ended prompt)
7802 (with-current-buffer gnus-group-buffer
7805 (if (eq gnus-keep-same-level 'best)
7806 (gnus-summary-best-group gnus-newsgroup-name)
7807 (gnus-summary-search-group backward gnus-keep-same-level))))
7811 "No more%s articles%s " (if unread " unread" "")
7813 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7814 (format " (Type %s for %s [%s])"
7815 (single-key-description cmd)
7816 (gnus-group-decoded-name group)
7817 (gnus-group-unread group))
7818 (format " (Type %s to exit %s)"
7819 (single-key-description cmd)
7820 (gnus-group-decoded-name gnus-newsgroup-name)))))
7821 ;; Confirm auto selection.
7822 (setq key (car (setq keve (gnus-read-event-char prompt)))
7825 ((assq key keystrokes)
7826 (let ((obuf (current-buffer)))
7827 (switch-to-buffer gnus-group-buffer)
7829 (gnus-group-jump-to-group group))
7830 (eval (cadr (assq key keystrokes)))
7831 (setq group (gnus-group-group-name))
7832 (switch-to-buffer obuf))
7836 (gnus-ephemeral-group-p gnus-newsgroup-name))
7838 (gnus-summary-next-group nil group backward)))
7840 (push (cdr keve) unread-command-events))))))
7842 (defun gnus-summary-next-unread-article ()
7843 "Select unread article after current one."
7845 (gnus-summary-next-article
7846 (or (not (eq gnus-summary-goto-unread 'never))
7847 (gnus-summary-last-article-p (gnus-summary-article-number)))
7848 (and gnus-auto-select-same
7849 (gnus-summary-article-subject))))
7851 (defun gnus-summary-prev-article (&optional unread subject)
7852 "Select the article before the current one.
7853 If UNREAD is non-nil, only unread articles are selected."
7855 (gnus-summary-next-article unread subject t))
7857 (defun gnus-summary-prev-unread-article ()
7858 "Select unread article before current one."
7860 (gnus-summary-prev-article
7861 (or (not (eq gnus-summary-goto-unread 'never))
7862 (gnus-summary-first-article-p (gnus-summary-article-number)))
7863 (and gnus-auto-select-same
7864 (gnus-summary-article-subject))))
7866 (declare-function gnus-article-only-boring-p "gnus-art" ())
7868 (defun gnus-summary-next-page (&optional lines circular stop)
7869 "Show next page of the selected article.
7870 If at the end of the current article, select the next article.
7871 LINES says how many lines should be scrolled up.
7873 If CIRCULAR is non-nil, go to the start of the article instead of
7874 selecting the next article when reaching the end of the current
7877 If STOP is non-nil, just stop when reaching the end of the message.
7879 Also see the variable `gnus-article-skip-boring'."
7881 (gnus-set-global-variables)
7882 (let ((article (gnus-summary-article-number))
7883 (article-window (get-buffer-window gnus-article-buffer t))
7885 ;; If the buffer is empty, we have no article.
7887 (error "No article to select"))
7888 (gnus-configure-windows 'article)
7889 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7890 (if (and (eq gnus-summary-goto-unread 'never)
7891 (not (gnus-summary-last-article-p article)))
7892 (gnus-summary-next-article)
7893 (gnus-summary-next-unread-article))
7894 (if (or (null gnus-current-article)
7895 (null gnus-article-current)
7896 (/= article (cdr gnus-article-current))
7897 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7898 ;; Selected subject is different from current article's.
7899 (gnus-summary-display-article article)
7900 (when article-window
7901 (gnus-eval-in-buffer-window gnus-article-buffer
7902 (setq endp (or (gnus-article-next-page lines)
7903 (gnus-article-only-boring-p))))
7905 (cond ((or stop gnus-summary-stop-at-end-of-message)
7906 (gnus-message 3 "End of message"))
7908 (gnus-summary-beginning-of-article))
7910 (gnus-message 3 "End of message"))
7912 (if (and (eq gnus-summary-goto-unread 'never)
7913 (not (gnus-summary-last-article-p article)))
7914 (gnus-summary-next-article)
7915 (gnus-summary-next-unread-article))))))))
7916 (gnus-summary-recenter)
7917 (gnus-summary-position-point)))
7919 (defun gnus-summary-prev-page (&optional lines move)
7920 "Show previous page of selected article.
7921 Argument LINES specifies lines to be scrolled down.
7922 If MOVE, move to the previous unread article if point is at
7923 the beginning of the buffer."
7925 (let ((article (gnus-summary-article-number))
7926 (article-window (get-buffer-window gnus-article-buffer t))
7928 (gnus-configure-windows 'article)
7929 (if (or (null gnus-current-article)
7930 (null gnus-article-current)
7931 (/= article (cdr gnus-article-current))
7932 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7933 ;; Selected subject is different from current article's.
7934 (gnus-summary-display-article article)
7935 (gnus-summary-recenter)
7936 (when article-window
7937 (gnus-eval-in-buffer-window gnus-article-buffer
7938 (setq endp (gnus-article-prev-page lines)))
7939 (when (and move endp)
7941 (gnus-message 3 "Beginning of message"))
7943 (if (and (eq gnus-summary-goto-unread 'never)
7944 (not (gnus-summary-first-article-p article)))
7945 (gnus-summary-prev-article)
7946 (gnus-summary-prev-unread-article))))))))
7947 (gnus-summary-position-point))
7949 (defun gnus-summary-prev-page-or-article (&optional lines)
7950 "Show previous page of selected article.
7951 Argument LINES specifies lines to be scrolled down.
7952 If at the beginning of the article, go to the next article."
7954 (gnus-summary-prev-page lines t))
7956 (defun gnus-summary-scroll-up (lines)
7957 "Scroll up (or down) one line current article.
7958 Argument LINES specifies lines to be scrolled up (or down if negative).
7959 If no article is selected, then the current article will be selected first."
7961 (gnus-configure-windows 'article)
7962 (gnus-summary-show-thread)
7963 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7964 (gnus-eval-in-buffer-window gnus-article-buffer
7966 (when (gnus-article-next-page lines)
7967 (gnus-message 3 "End of message")))
7969 (gnus-article-prev-page (- lines))))))
7970 (gnus-summary-recenter)
7971 (gnus-summary-position-point))
7973 (defun gnus-summary-scroll-down (lines)
7974 "Scroll down (or up) one line current article.
7975 Argument LINES specifies lines to be scrolled down (or up if negative).
7976 If no article is selected, then the current article will be selected first."
7978 (gnus-summary-scroll-up (- lines)))
7980 (defun gnus-summary-next-same-subject ()
7981 "Select next article which has the same subject as current one."
7983 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7985 (defun gnus-summary-prev-same-subject ()
7986 "Select previous article which has the same subject as current one."
7988 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7990 (defun gnus-summary-next-unread-same-subject ()
7991 "Select next unread article which has the same subject as current one."
7993 (gnus-summary-next-article t (gnus-summary-article-subject)))
7995 (defun gnus-summary-prev-unread-same-subject ()
7996 "Select previous unread article which has the same subject as current one."
7998 (gnus-summary-prev-article t (gnus-summary-article-subject)))
8000 (defun gnus-summary-first-unread-article ()
8001 "Select the first unread article.
8002 Return nil if there are no unread articles."
8005 (when (gnus-summary-first-subject t)
8006 (gnus-summary-show-thread)
8007 (gnus-summary-first-subject t)
8008 (gnus-summary-display-article (gnus-summary-article-number)))
8009 (gnus-summary-position-point)))
8011 (defun gnus-summary-first-unread-subject ()
8012 "Place the point on the subject line of the first unread article.
8013 Return nil if there are no unread articles."
8016 (when (gnus-summary-first-subject t)
8017 (gnus-summary-show-thread)
8018 (gnus-summary-first-subject t))
8019 (gnus-summary-position-point)))
8021 (defun gnus-summary-first-unseen-subject ()
8022 "Place the point on the subject line of the first unseen article.
8023 Return nil if there are no unseen articles."
8026 (when (gnus-summary-first-subject nil nil t)
8027 (gnus-summary-show-thread)
8028 (gnus-summary-first-subject nil nil t))
8029 (gnus-summary-position-point)))
8031 (defun gnus-summary-first-unseen-or-unread-subject ()
8032 "Place the point on the subject line of the first unseen and unread article.
8033 If all article have been seen, on the subject line of the first unread
8037 (unless (when (gnus-summary-first-subject nil nil t)
8038 (gnus-summary-show-thread)
8039 (gnus-summary-first-subject nil nil t))
8040 (when (gnus-summary-first-subject t)
8041 (gnus-summary-show-thread)
8042 (gnus-summary-first-subject t)))
8043 (gnus-summary-position-point)))
8045 (defun gnus-summary-first-article ()
8046 "Select the first article.
8047 Return nil if there are no articles."
8050 (when (gnus-summary-first-subject)
8051 (gnus-summary-show-thread)
8052 (gnus-summary-first-subject)
8053 (gnus-summary-display-article (gnus-summary-article-number)))
8054 (gnus-summary-position-point)))
8056 (defun gnus-summary-best-unread-article (&optional arg)
8057 "Select the unread article with the highest score.
8058 If given a prefix argument, select the next unread article that has a
8059 score higher than the default score."
8061 (let ((article (if arg
8062 (gnus-summary-better-unread-subject)
8063 (gnus-summary-best-unread-subject))))
8065 (gnus-summary-goto-article article)
8066 (error "No unread articles"))))
8068 (defun gnus-summary-best-unread-subject ()
8069 "Select the unread subject with the highest score."
8071 (let ((best -1000000)
8072 (data gnus-newsgroup-data)
8075 (and (gnus-data-unread-p (car data))
8077 (gnus-summary-article-score (gnus-data-number (car data))))
8080 article (gnus-data-number (car data))))
8081 (setq data (cdr data)))
8083 (gnus-summary-goto-subject article))
8084 (gnus-summary-position-point)
8087 (defun gnus-summary-better-unread-subject ()
8088 "Select the first unread subject that has a score over the default score."
8090 (let ((data gnus-newsgroup-data)
8092 (while (and (setq article (gnus-data-number (car data)))
8093 (or (gnus-data-read-p (car data))
8094 (not (> (gnus-summary-article-score article)
8095 gnus-summary-default-score))))
8096 (setq data (cdr data)))
8098 (gnus-summary-goto-subject article))
8099 (gnus-summary-position-point)
8102 (defun gnus-summary-last-subject ()
8103 "Go to the last displayed subject line in the group."
8104 (let ((article (gnus-data-number (car (gnus-data-list t)))))
8106 (gnus-summary-goto-subject article))))
8108 (defun gnus-summary-goto-article (article &optional all-headers force)
8109 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
8110 If ALL-HEADERS is non-nil, no header lines are hidden.
8111 If FORCE, go to the article even if it isn't displayed. If FORCE
8112 is a number, it is the line the article is to be displayed on."
8115 (gnus-completing-read
8116 "Article number or Message-ID"
8117 (mapcar 'int-to-string gnus-newsgroup-limit))
8121 (if (and (stringp article)
8122 (string-match "@\\|%40" article))
8123 (gnus-summary-refer-article article)
8124 (when (stringp article)
8125 (setq article (string-to-number article)))
8126 (if (gnus-summary-goto-subject article force)
8127 (gnus-summary-display-article article all-headers)
8128 (gnus-message 4 "Couldn't go to article %s" article) nil))
8129 (gnus-summary-position-point)))
8131 (defun gnus-summary-goto-last-article ()
8132 "Go to the previously read article."
8135 (when gnus-last-article
8136 (gnus-summary-goto-article gnus-last-article nil t))
8137 (gnus-summary-position-point)))
8139 (defun gnus-summary-pop-article (number)
8140 "Pop one article off the history and go to the previous.
8141 NUMBER articles will be popped off."
8144 (setq gnus-newsgroup-history
8145 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
8147 (gnus-summary-goto-article (car to) nil t)
8148 (error "Article history empty")))
8149 (gnus-summary-position-point))
8151 ;; Summary commands and functions for limiting the summary buffer.
8153 (defun gnus-summary-limit-to-articles (n)
8154 "Limit the summary buffer to the next N articles.
8155 If not given a prefix, use the process marked articles instead."
8158 (let ((articles (gnus-summary-work-articles n)))
8159 (setq gnus-newsgroup-processable nil)
8160 (gnus-summary-limit articles))
8161 (gnus-summary-position-point)))
8163 (defun gnus-summary-pop-limit (&optional total)
8164 "Restore the previous limit.
8165 If given a prefix, remove all limits."
8168 (setq gnus-newsgroup-limits
8169 (list (mapcar (lambda (h) (mail-header-number h))
8170 gnus-newsgroup-headers))))
8171 (unless gnus-newsgroup-limits
8172 (error "No limit to pop"))
8174 (gnus-summary-limit nil 'pop)
8175 (gnus-summary-position-point)))
8177 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
8178 "Limit the summary buffer to articles that have subjects that match a regexp.
8179 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8181 (list (read-string (if current-prefix-arg
8182 "Exclude subject (regexp): "
8183 "Limit to subject (regexp): "))
8184 nil current-prefix-arg))
8186 (setq header "subject"))
8187 (when (not (equal "" subject))
8189 (let ((articles (gnus-summary-find-matching
8190 (or header "subject") subject 'all nil nil
8193 (error "Found no matches for \"%s\"" subject))
8194 (gnus-summary-limit articles))
8195 (gnus-summary-position-point))))
8197 (defun gnus-summary-limit-to-author (from &optional not-matching)
8198 "Limit the summary buffer to articles that have authors that match a regexp.
8199 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8201 (list (let* ((header (gnus-summary-article-header))
8202 (default (and header (car (mail-header-parse-address
8203 (mail-header-from header))))))
8204 (read-string (concat (if current-prefix-arg
8205 "Exclude author (regexp"
8206 "Limit to author (regexp")
8208 (concat ", default \"" default "\"): ")
8212 current-prefix-arg))
8213 (gnus-summary-limit-to-subject from "from" not-matching))
8215 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
8216 "Limit the summary buffer to articles with the given RECIPIENT.
8218 If NOT-MATCHING, exclude RECIPIENT.
8220 To and Cc headers are checked. You need to include them in
8221 `nnmail-extra-headers'."
8222 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8224 (list (read-string (format "%s recipient (regexp): "
8225 (if current-prefix-arg "Exclude" "Limit to")))
8226 current-prefix-arg))
8227 (when (not (equal "" recipient))
8229 (if (memq 'To nnmail-extra-headers)
8230 (gnus-summary-find-matching
8231 (cons 'extra 'To) recipient 'all nil nil
8234 1 "`To' isn't present in `nnmail-extra-headers'")
8238 (if (memq 'Cc nnmail-extra-headers)
8239 (gnus-summary-find-matching
8240 (cons 'extra 'Cc) recipient 'all nil nil
8243 1 "`Cc' isn't present in `nnmail-extra-headers'")
8248 ;; We need the numbers that are in both lists:
8250 (and (memq a to) a))
8254 (error "Found no matches for \"%s\"" recipient))
8255 (gnus-summary-limit articles))
8256 (gnus-summary-position-point))))
8258 (defun gnus-summary-limit-to-address (address &optional not-matching)
8259 "Limit the summary buffer to articles with the given ADDRESS.
8261 If NOT-MATCHING, exclude ADDRESS.
8263 To, Cc and From headers are checked. You need to include `To' and `Cc'
8264 in `nnmail-extra-headers'."
8266 (list (read-string (format "%s address (regexp): "
8267 (if current-prefix-arg "Exclude" "Limit to")))
8268 current-prefix-arg))
8269 (when (not (equal "" address))
8271 (if (memq 'To nnmail-extra-headers)
8272 (gnus-summary-find-matching
8273 (cons 'extra 'To) address 'all nil nil
8276 1 "`To' isn't present in `nnmail-extra-headers'")
8280 (if (memq 'Cc nnmail-extra-headers)
8281 (gnus-summary-find-matching
8282 (cons 'extra 'Cc) address 'all nil nil
8285 1 "`Cc' isn't present in `nnmail-extra-headers'")
8289 (gnus-summary-find-matching "from" address
8290 'all nil nil not-matching))
8293 ;; We need the numbers that are in all lists:
8297 (mapcar (lambda (a) (car (memq a from))) to))
8299 (mapcar (lambda (a) (car (memq a from))) cc)
8300 (mapcar (lambda (a) (car (memq a from)))
8301 (mapcar (lambda (a) (car (memq a to)))
8303 (nconc (if (eq to t) nil to)
8304 (if (eq cc t) nil cc)
8307 (error "Found no matches for \"%s\"" address))
8308 (gnus-summary-limit articles))
8309 (gnus-summary-position-point))))
8311 (defun gnus-summary-limit-strange-charsets-predicate (header)
8312 (let ((string (concat (mail-header-subject header)
8313 (mail-header-from header)))
8315 (dotimes (i (1- (length string)))
8316 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8317 (when (string-match "unicode\\|big\\|japanese" charset)
8321 (defun gnus-summary-limit-to-predicate (predicate)
8322 "Limit to articles where PREDICATE returns non-nil.
8323 PREDICATE will be called with the header structures of the
8325 (let ((articles nil)
8326 (case-fold-search t))
8327 (dolist (header gnus-newsgroup-headers)
8328 (when (funcall predicate header)
8329 (push (mail-header-number header) articles)))
8330 (gnus-summary-limit (nreverse articles))))
8332 (defun gnus-summary-limit-to-age (age &optional younger-p)
8333 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8334 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8335 articles that are younger than AGE days."
8337 (let ((younger current-prefix-arg)
8340 (while (not days-got)
8341 (setq days (if younger
8342 (read-string "Limit to articles younger than (in days, older when negative): ")
8344 "Limit to articles older than (in days, younger when negative): ")))
8345 (when (> (length days) 0)
8346 (setq days (read days)))
8351 (setq younger (not younger))
8352 (setq days (* days -1))))
8353 (message "Please enter a number.")
8355 (list days younger)))
8357 (let ((data gnus-newsgroup-data)
8358 (cutoff (days-to-time age))
8359 articles d date is-younger)
8360 (while (setq d (pop data))
8361 (when (and (vectorp (gnus-data-header d))
8362 (setq date (mail-header-date (gnus-data-header d))))
8363 (setq is-younger (time-less-p
8364 (time-since (gnus-date-get-time date))
8369 (push (gnus-data-number d) articles))))
8370 (gnus-summary-limit (nreverse articles)))
8371 (gnus-summary-position-point)))
8373 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8374 "Limit the summary buffer to articles that match an `extra' header."
8378 (gnus-completing-read
8379 (if current-prefix-arg
8380 "Exclude extra header"
8381 "Limit extra header")
8382 (mapcar 'symbol-name gnus-extra-headers)
8384 (symbol-name (car gnus-extra-headers))))))
8386 (read-string (format "%s header %s (regexp): "
8387 (if current-prefix-arg "Exclude" "Limit to")
8389 current-prefix-arg)))
8390 (when (not (equal "" regexp))
8392 (let ((articles (gnus-summary-find-matching
8393 (cons 'extra header) regexp 'all nil nil
8396 (error "Found no matches for \"%s\"" regexp))
8397 (gnus-summary-limit articles))
8398 (gnus-summary-position-point))))
8400 (defun gnus-summary-limit-to-display-predicate ()
8401 "Limit the summary buffer to the predicated in the `display' group parameter."
8403 (unless gnus-newsgroup-display
8404 (error "There is no `display' group parameter"))
8406 (dolist (gnus-number gnus-newsgroup-articles)
8407 (when (funcall gnus-newsgroup-display)
8408 (push gnus-number articles)))
8409 (gnus-summary-limit articles))
8410 (gnus-summary-position-point))
8412 (defun gnus-summary-limit-to-unread (&optional all)
8413 "Limit the summary buffer to articles that are not marked as read.
8414 If ALL is non-nil, limit strictly to unread articles."
8417 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8418 (gnus-summary-limit-to-marks
8419 ;; Concat all the marks that say that an article is read and have
8421 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8422 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8423 gnus-low-score-mark gnus-expirable-mark
8424 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8425 gnus-duplicate-mark)
8428 (defun gnus-summary-limit-to-headers (match &optional reverse)
8429 "Limit the summary buffer to articles that have headers that match MATCH.
8430 If REVERSE (the prefix), limit to articles that don't match."
8431 (interactive "sMatch headers (regexp): \nP")
8432 (gnus-summary-limit-to-bodies match reverse t))
8434 (declare-function article-goto-body "gnus-art" ())
8436 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8437 "Limit the summary buffer to articles that have bodies that match MATCH.
8438 If REVERSE (the prefix), limit to articles that don't match."
8439 (interactive "sMatch body (regexp): \nP")
8440 (let ((articles nil)
8441 (gnus-select-article-hook nil) ;Disable hook.
8442 (gnus-article-prepare-hook nil)
8443 (gnus-use-article-prefetch nil)
8444 (gnus-keep-backlog nil)
8445 (gnus-break-pages nil)
8446 (gnus-summary-display-arrow nil)
8447 (gnus-updated-mode-lines nil)
8448 (gnus-auto-center-summary nil)
8449 (gnus-display-mime-function nil))
8450 (dolist (data gnus-newsgroup-data)
8451 (let (gnus-mark-article-hook)
8452 (gnus-summary-select-article t t nil (gnus-data-number data)))
8453 (with-current-buffer gnus-article-buffer
8455 (let* ((case-fold-search t)
8457 (re-search-backward match nil t)
8458 (re-search-forward match nil t))))
8459 (when (or (and found
8463 (push (gnus-data-number data) articles)))))
8465 (message "No messages matched")
8466 (gnus-summary-limit articles)))
8467 (gnus-summary-position-point))
8469 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8470 "Limit the summary buffer to articles that aren't part on any thread.
8471 If THREADSP (the prefix), limit to articles that are in threads."
8473 (let ((articles nil)
8476 (dolist (thread gnus-newsgroup-threads)
8477 (if (stringp (car thread))
8478 (dolist (thread (cdr thread))
8479 (push thread threads))
8480 (push thread threads)))
8481 (dolist (thread threads)
8482 (setq thread-articles (gnus-articles-in-thread thread))
8483 (when (or (and threadsp
8484 (> (length thread-articles) 1))
8486 (= (length thread-articles) 1)))
8487 (setq articles (nconc thread-articles articles))))
8489 (message "No messages matched")
8490 (gnus-summary-limit articles))
8491 (gnus-summary-position-point)))
8493 (defun gnus-summary-limit-to-replied (&optional unreplied)
8494 "Limit the summary buffer to replied articles.
8495 If UNREPLIED (the prefix), limit to unreplied articles."
8499 (gnus-set-difference gnus-newsgroup-articles
8500 gnus-newsgroup-replied))
8501 (gnus-summary-limit gnus-newsgroup-replied))
8502 (gnus-summary-position-point))
8504 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8505 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8506 If REVERSE, limit the summary buffer to articles that are marked
8507 with MARKS. MARKS can either be a string of marks or a list of marks.
8508 Returns how many articles were removed."
8509 (interactive "sMarks: ")
8510 (gnus-summary-limit-to-marks marks t))
8512 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8513 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8514 If REVERSE (the prefix), limit the summary buffer to articles that are
8515 not marked with MARKS. MARKS can either be a string of marks or a
8517 Returns how many articles were removed."
8518 (interactive "sMarks: \nP")
8520 (let ((data gnus-newsgroup-data)
8521 (marks (if (listp marks) marks
8522 (append marks nil))) ; Transform to list.
8525 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8526 (memq (gnus-data-mark (car data)) marks))
8527 (push (gnus-data-number (car data)) articles))
8528 (setq data (cdr data)))
8529 (gnus-summary-limit articles))
8530 (gnus-summary-position-point)))
8532 (defun gnus-summary-limit-to-score (score)
8533 "Limit to articles with score at or above SCORE."
8534 (interactive "NLimit to articles with score of at least: ")
8535 (let ((data gnus-newsgroup-data)
8538 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8540 (push (gnus-data-number (car data)) articles))
8541 (setq data (cdr data)))
8543 (gnus-summary-limit articles)
8544 (gnus-summary-position-point))))
8546 (defun gnus-summary-limit-to-unseen ()
8547 "Limit to unseen articles."
8550 (gnus-summary-limit gnus-newsgroup-unseen)
8551 (gnus-summary-position-point)))
8553 (defun gnus-summary-limit-include-thread (id)
8554 "Display all the hidden articles that is in the thread with ID in it.
8555 When called interactively, ID is the Message-ID of the current
8557 (interactive (list (mail-header-id (gnus-summary-article-header))))
8558 (let ((articles (gnus-articles-in-thread
8559 (gnus-id-to-thread (gnus-root-id id))))
8560 ;;we REALLY want the whole thread---this prevents cut-threads
8561 ;;from removing the thread we want to include.
8562 (gnus-fetch-old-headers nil)
8563 (gnus-build-sparse-threads nil))
8565 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8566 (gnus-summary-limit-include-matching-articles
8568 (regexp-quote (gnus-simplify-subject-re
8569 (mail-header-subject (gnus-id-to-header id)))))
8570 (gnus-summary-position-point))))
8572 (defun gnus-summary-limit-include-matching-articles (header regexp)
8573 "Display all the hidden articles that have HEADERs that match REGEXP."
8574 (interactive (list (read-string "Match on header: ")
8575 (read-string "Regexp: ")))
8576 (let ((articles (gnus-find-matching-articles header regexp)))
8578 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8579 (gnus-summary-position-point))))
8581 (defun gnus-summary-insert-dormant-articles ()
8582 "Insert all the dormant articles for this group into the current buffer."
8584 (let ((gnus-verbose (max 6 gnus-verbose)))
8585 (if (not gnus-newsgroup-dormant)
8586 (gnus-message 3 "No dormant articles for this group")
8587 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8589 (defun gnus-summary-insert-ticked-articles ()
8590 "Insert ticked articles for this group into the current buffer."
8592 (let ((gnus-verbose (max 6 gnus-verbose)))
8593 (if (not gnus-newsgroup-marked)
8594 (gnus-message 3 "No ticked articles for this group")
8595 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8597 (defun gnus-summary-limit-include-dormant ()
8598 "Display all the hidden articles that are marked as dormant.
8599 Note that this command only works on a subset of the articles currently
8600 fetched for this group."
8602 (unless gnus-newsgroup-dormant
8603 (error "There are no dormant articles in this group"))
8605 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8606 (gnus-summary-position-point)))
8608 (defun gnus-summary-include-articles (articles)
8609 "Fetch the headers for ARTICLES and then display the summary lines."
8610 (let ((gnus-inhibit-demon t)
8612 (gnus-read-all-available-headers t))
8613 (setq gnus-newsgroup-headers
8615 'list gnus-newsgroup-headers
8616 (gnus-fetch-headers articles nil t)
8617 'gnus-article-sort-by-number))
8618 (setq gnus-newsgroup-articles
8619 (gnus-sorted-nunion gnus-newsgroup-articles articles))
8620 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8622 (defun gnus-summary-limit-exclude-dormant ()
8623 "Hide all dormant articles."
8626 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8627 (gnus-summary-position-point)))
8629 (defun gnus-summary-limit-exclude-childless-dormant ()
8630 "Hide all dormant articles that have no children."
8632 (let ((data (gnus-data-list t))
8633 articles d children)
8634 ;; Find all articles that are either not dormant or have
8636 (while (setq d (pop data))
8637 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8639 (gnus-article-children (gnus-data-number d)))
8642 (when (memq (car children) articles)
8647 (push (gnus-data-number d) articles)))
8650 (gnus-summary-limit articles)
8651 (gnus-summary-position-point))))
8653 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8654 "Mark all unread excluded articles as read.
8655 If ALL, mark even excluded ticked and dormants as read."
8657 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8658 (let ((articles (gnus-sorted-ndifference
8660 (mapcar (lambda (h) (mail-header-number h))
8661 gnus-newsgroup-headers)
8663 gnus-newsgroup-limit))
8665 (setq gnus-newsgroup-unreads
8666 (gnus-sorted-intersection gnus-newsgroup-unreads
8667 gnus-newsgroup-limit))
8669 (setq gnus-newsgroup-dormant nil
8670 gnus-newsgroup-marked nil
8671 gnus-newsgroup-reads
8673 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8674 gnus-newsgroup-reads))
8675 (while (setq article (pop articles))
8676 (unless (or (memq article gnus-newsgroup-dormant)
8677 (memq article gnus-newsgroup-marked))
8678 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8680 (defun gnus-summary-limit (articles &optional pop)
8682 ;; We pop the previous limit off the stack and use that.
8683 (setq articles (car gnus-newsgroup-limits)
8684 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8685 ;; We use the new limit, so we push the old limit on the stack.
8686 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8688 (setq gnus-newsgroup-limit articles)
8689 (let ((total (length gnus-newsgroup-data))
8690 (data (gnus-data-find-list (gnus-summary-article-number)))
8691 (gnus-summary-mark-below nil) ; Inhibit this.
8693 ;; This will do all the work of generating the new summary buffer
8694 ;; according to the new limit.
8695 (gnus-summary-prepare)
8696 ;; Hide any threads, possibly.
8697 (gnus-summary-maybe-hide-threads)
8698 ;; Try to return to the article you were at, or one in the
8701 ;; We try to find some article after the current one.
8703 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8706 (setq data (cdr data))))
8708 ;; If there is no data, that means that we were after the last
8709 ;; article. The same goes when we can't find any articles
8710 ;; after the current one.
8711 (goto-char (point-max))
8712 (gnus-summary-find-prev))
8713 (gnus-set-mode-line 'summary)
8714 ;; We return how many articles were removed from the summary
8715 ;; buffer as a result of the new limit.
8716 (- total (length gnus-newsgroup-data))))
8718 (defsubst gnus-invisible-cut-children (threads)
8721 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8726 (defsubst gnus-cut-thread (thread)
8727 "Go forwards in the thread until we find an article that we want to display."
8728 (when (or (eq gnus-fetch-old-headers 'some)
8729 (eq gnus-fetch-old-headers 'invisible)
8730 (numberp gnus-fetch-old-headers)
8731 (eq gnus-build-sparse-threads 'some)
8732 (eq gnus-build-sparse-threads 'more))
8733 ;; Deal with old-fetched headers and sparse threads.
8737 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8738 (gnus-summary-article-ancient-p
8739 (mail-header-number (car thread))))
8740 (if (or (<= (length (cdr thread)) 1)
8741 (eq gnus-fetch-old-headers 'invisible))
8742 (setq gnus-newsgroup-limit
8743 (delq (mail-header-number (car thread))
8744 gnus-newsgroup-limit)
8745 thread (cadr thread))
8746 (when (gnus-invisible-cut-children (cdr thread))
8747 (let ((th (cdr thread)))
8749 (if (memq (mail-header-number (caar th))
8750 gnus-newsgroup-limit)
8751 (setq thread (car th)
8753 (setq th (cdr th))))))))))
8756 (defun gnus-cut-threads (threads)
8757 "Cut off all uninteresting articles from the beginning of THREADS."
8758 (when (or (eq gnus-fetch-old-headers 'some)
8759 (eq gnus-fetch-old-headers 'invisible)
8760 (numberp gnus-fetch-old-headers)
8761 (eq gnus-build-sparse-threads 'some)
8762 (eq gnus-build-sparse-threads 'more))
8765 (setcar th (gnus-cut-thread (car th)))
8766 (setq th (cdr th)))))
8767 ;; Remove nixed out threads.
8770 (defun gnus-summary-initial-limit (&optional show-if-empty)
8771 "Figure out what the initial limit is supposed to be on group entry.
8772 This entails weeding out unwanted dormants, low-scored articles,
8773 fetch-old-headers verbiage, and so on."
8774 ;; Most groups have nothing to remove.
8775 (unless (or gnus-inhibit-limiting
8776 (and (null gnus-newsgroup-dormant)
8777 (eq gnus-newsgroup-display 'gnus-not-ignore)
8778 (not (eq gnus-fetch-old-headers 'some))
8779 (not (numberp gnus-fetch-old-headers))
8780 (not (eq gnus-fetch-old-headers 'invisible))
8781 (null gnus-summary-expunge-below)
8782 (not (eq gnus-build-sparse-threads 'some))
8783 (not (eq gnus-build-sparse-threads 'more))
8784 (null gnus-thread-expunge-below)))
8785 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8786 (setq gnus-newsgroup-limit nil)
8789 (unless (car (symbol-value node))
8790 ;; These threads have no parents -- they are roots.
8791 (let ((nodes (cdr (symbol-value node)))
8794 (if (and gnus-thread-expunge-below
8795 (< (gnus-thread-total-score (car nodes))
8796 gnus-thread-expunge-below))
8797 (gnus-expunge-thread (pop nodes))
8798 (setq thread (pop nodes))
8799 (gnus-summary-limit-children thread))))))
8800 gnus-newsgroup-dependencies)
8801 ;; If this limitation resulted in an empty group, we might
8802 ;; pop the previous limit and use it instead.
8803 (when (and (not gnus-newsgroup-limit)
8805 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8806 gnus-newsgroup-limit))
8808 (defun gnus-summary-limit-children (thread)
8809 "Return 1 if this subthread is visible and 0 if it is not."
8810 ;; First we get the number of visible children to this thread. This
8811 ;; is done by recursing down the thread using this function, so this
8812 ;; will really go down to a leaf article first, before slowly
8813 ;; working its way up towards the root.
8815 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8818 (apply '+ (mapcar 'gnus-summary-limit-children
8821 (number (mail-header-number (car thread)))
8824 (not (memq number gnus-newsgroup-marked))
8826 ;; If this article is dormant and has absolutely no visible
8827 ;; children, then this article isn't visible.
8828 (and (memq number gnus-newsgroup-dormant)
8830 ;; If this is "fetch-old-headered" and there is no
8831 ;; visible children, then we don't want this article.
8832 (and (or (eq gnus-fetch-old-headers 'some)
8833 (numberp gnus-fetch-old-headers))
8834 (gnus-summary-article-ancient-p number)
8836 ;; If this is "fetch-old-headered" and `invisible', then
8837 ;; we don't want this article.
8838 (and (eq gnus-fetch-old-headers 'invisible)
8839 (gnus-summary-article-ancient-p number))
8840 ;; If this is a sparsely inserted article with no children,
8841 ;; we don't want it.
8842 (and (eq gnus-build-sparse-threads 'some)
8843 (gnus-summary-article-sparse-p number)
8845 ;; If we use expunging, and this article is really
8846 ;; low-scored, then we don't want this article.
8847 (when (and gnus-summary-expunge-below
8849 (or (cdr (assq number gnus-newsgroup-scored))
8850 gnus-summary-default-score))
8851 gnus-summary-expunge-below))
8852 ;; We increase the expunge-tally here, but that has
8853 ;; nothing to do with the limits, really.
8854 (incf gnus-newsgroup-expunged-tally)
8855 ;; We also mark as read here, if that's wanted.
8856 (when (and gnus-summary-mark-below
8857 (< score gnus-summary-mark-below))
8858 (setq gnus-newsgroup-unreads
8859 (delq number gnus-newsgroup-unreads))
8860 (if gnus-newsgroup-auto-expire
8861 (push number gnus-newsgroup-expirable)
8862 (push (cons number gnus-low-score-mark)
8863 gnus-newsgroup-reads)))
8865 ;; Do the `display' group parameter.
8866 (and gnus-newsgroup-display
8867 (let ((gnus-number number))
8868 (not (funcall gnus-newsgroup-display))))))
8869 ;; Nope, invisible article.
8871 ;; Ok, this article is to be visible, so we add it to the limit
8873 (push number gnus-newsgroup-limit)
8876 (defun gnus-expunge-thread (thread)
8877 "Mark all articles in THREAD as read."
8878 (let* ((number (mail-header-number (car thread))))
8879 (incf gnus-newsgroup-expunged-tally)
8880 ;; We also mark as read here, if that's wanted.
8881 (setq gnus-newsgroup-unreads
8882 (delq number gnus-newsgroup-unreads))
8883 (if gnus-newsgroup-auto-expire
8884 (push number gnus-newsgroup-expirable)
8885 (push (cons number gnus-low-score-mark)
8886 gnus-newsgroup-reads)))
8887 ;; Go recursively through all subthreads.
8888 (mapcar 'gnus-expunge-thread (cdr thread)))
8890 ;; Summary article oriented commands
8892 (defun gnus-summary-refer-parent-article (n)
8893 "Refer parent article N times.
8894 If N is negative, go to ancestor -N instead.
8895 The difference between N and the number of articles fetched is returned."
8899 (when (not (natnump n))
8904 (setq header (gnus-summary-article-header))
8905 (if (and (eq (mail-header-number header)
8906 (cdr gnus-article-current))
8907 (equal gnus-newsgroup-name
8908 (car gnus-article-current)))
8909 ;; If we try to find the parent of the currently
8910 ;; displayed article, then we take a look at the actual
8911 ;; References header, since this is slightly more
8912 ;; reliable than the References field we got from the
8914 (with-current-buffer gnus-original-article-buffer
8915 (nnheader-narrow-to-headers)
8916 (unless (setq ref (message-fetch-field "references"))
8917 (when (setq ref (message-fetch-field "in-reply-to"))
8918 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8921 ;; It's not the current article, so we take a bet on
8922 ;; the value we got from the server.
8923 (mail-header-references header)))
8925 (not (equal ref "")))
8926 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8927 (gnus-message 1 "Couldn't find parent"))
8928 (gnus-message 1 "No references in article %d"
8929 (gnus-summary-article-number))
8932 (gnus-summary-position-point)
8935 (defun gnus-summary-refer-references ()
8936 "Fetch all articles mentioned in the References header.
8937 Return the number of articles fetched."
8939 (let ((ref (mail-header-references (gnus-summary-article-header)))
8940 (current (gnus-summary-article-number))
8944 (error "No References in the current article")
8945 ;; For each Message-ID in the References header...
8946 (while (string-match "<[^>]*>" ref)
8948 ;; ... fetch that article.
8949 (gnus-summary-refer-article
8950 (prog1 (match-string 0 ref)
8951 (setq ref (substring ref (match-end 0))))))
8952 (gnus-summary-goto-subject current)
8953 (gnus-summary-position-point)
8956 (defun gnus-delete-duplicate-headers (headers)
8957 ;; First remove leading duplicates.
8958 (while (and (> (length headers) 1)
8959 (= (mail-header-number (car headers))
8960 (mail-header-number (cadr headers))))
8963 (let ((result headers))
8964 (while (> (length headers) 1)
8965 (if (= (mail-header-number (car headers))
8966 (mail-header-number (cadr headers)))
8967 (setcdr headers (cddr headers))
8971 (defun gnus-summary-refer-thread (&optional limit)
8972 "Fetch all articles in the current thread. For backends that
8973 know how to search for threads (currently only 'nnimap) a
8974 non-numeric prefix arg will use nnir to search the entire
8975 server; without a prefix arg only the current group is
8976 searched. If the variable `gnus-refer-thread-use-nnir' is
8977 non-nil the prefix arg has the reverse meaning. If no
8978 backend-specific 'request-thread function is available fetch
8979 LIMIT (the numerical prefix) old headers. If LIMIT is
8980 non-numeric or nil fetch the number specified by the
8981 `gnus-refer-thread-limit' variable."
8983 (gnus-warp-to-article)
8984 (let* ((header (gnus-summary-article-header))
8985 (id (mail-header-id header))
8986 (gnus-inhibit-demon t)
8987 (gnus-summary-ignore-duplicates t)
8988 (gnus-read-all-available-headers t)
8989 (gnus-refer-thread-use-nnir
8990 (if (and (not (null limit)) (listp limit))
8991 (not gnus-refer-thread-use-nnir) gnus-refer-thread-use-nnir))
8993 (if (gnus-check-backend-function
8994 'request-thread gnus-newsgroup-name)
8995 (gnus-request-thread header gnus-newsgroup-name)
8996 (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
8997 gnus-refer-thread-limit))
8998 (last (if (numberp limit)
8999 (min (+ (mail-header-number header)
9001 gnus-newsgroup-highest)
9002 gnus-newsgroup-highest))
9003 (subject (gnus-simplify-subject
9004 (mail-header-subject header)))
9005 (refs (split-string (or (mail-header-references header)
9007 (gnus-parse-headers-hook
9008 `(lambda () (goto-char (point-min))
9010 (regexp-opt ',(append refs (list id subject)))))))
9011 (gnus-fetch-headers (list last) (if (numberp limit)
9012 (* 2 limit) limit) t))))
9013 article-ids new-unreads)
9014 (when (listp new-headers)
9015 (dolist (header new-headers)
9016 (push (mail-header-number header) article-ids))
9017 (setq article-ids (nreverse article-ids))
9019 (gnus-sorted-intersection gnus-newsgroup-unselected article-ids))
9020 (setq gnus-newsgroup-unselected
9021 (gnus-sorted-ndifference gnus-newsgroup-unselected new-unreads))
9022 (setq gnus-newsgroup-unreads
9023 (gnus-sorted-nunion gnus-newsgroup-unreads new-unreads))
9024 (setq gnus-newsgroup-headers
9025 (gnus-delete-duplicate-headers
9027 'list gnus-newsgroup-headers new-headers
9028 'gnus-article-sort-by-number)))
9029 (setq gnus-newsgroup-articles
9030 (gnus-sorted-nunion gnus-newsgroup-articles article-ids))
9031 (gnus-summary-limit-include-thread id)))
9032 (gnus-summary-show-thread))
9034 (defun gnus-summary-open-group-with-article (message-id)
9035 "Open a group containing the article with the given MESSAGE-ID."
9036 (interactive "sMessage-ID: ")
9039 ;; Prepare a dummy article
9041 (insert "From nobody Tue Sep 13 22:05:34 2011\n\n")
9043 ;; Prepare pretty modelines for summary and article buffers
9044 (let ((gnus-summary-mode-line-format "Found %G")
9045 (gnus-article-mode-line-format
9046 ;; Group names just get in the way here, especially the
9048 (if (string-match "%[gG]" gnus-article-mode-line-format)
9049 (concat (substring gnus-article-mode-line-format
9050 0 (match-beginning 0))
9051 (substring gnus-article-mode-line-format (match-end 0)))
9052 gnus-article-mode-line-format)))
9054 ;; Build an ephemeral group containing the dummy article (hidden)
9055 (gnus-group-read-ephemeral-group
9058 (nndoc-address ,(current-buffer))
9059 (nndoc-article-type mbox))
9061 (cons (current-buffer) gnus-current-window-configuration)
9063 '(-1) ; :select-articles
9066 ;; Fetch the desired article
9067 (gnus-summary-refer-article message-id)))
9069 (defun gnus-summary-refer-article (message-id)
9070 "Fetch an article specified by MESSAGE-ID."
9071 (interactive "sMessage-ID: ")
9072 (gnus-warp-to-article)
9073 (when (and (stringp message-id)
9074 (not (zerop (length message-id))))
9075 (setq message-id (replace-regexp-in-string " " "" message-id))
9076 ;; Construct the correct Message-ID if necessary.
9077 ;; Suggested by tale@pawl.rpi.edu.
9078 (unless (string-match "^<" message-id)
9079 (setq message-id (concat "<" message-id)))
9080 (unless (string-match ">$" message-id)
9081 (setq message-id (concat message-id ">")))
9082 ;; People often post MIDs from URLs, so unhex it:
9083 (unless (string-match "@" message-id)
9084 (setq message-id (gnus-url-unhex-string message-id)))
9085 (let* ((header (gnus-id-to-header message-id))
9087 (gnus-summary-article-sparse-p
9088 (mail-header-number header))
9089 (memq (mail-header-number header)
9090 gnus-newsgroup-limit)))
9093 ;; If the article is present in the buffer we just go to it.
9095 (or (not (gnus-summary-article-sparse-p
9096 (mail-header-number header)))
9099 (gnus-summary-goto-article
9100 (mail-header-number header) nil t)
9102 (gnus-summary-update-article (mail-header-number header)))))
9104 ;; We fetch the article.
9106 (dolist (gnus-override-method (gnus-refer-article-methods))
9107 (when (and (gnus-check-server gnus-override-method)
9108 ;; Fetch the header,
9109 (setq number (gnus-summary-insert-subject message-id)))
9110 ;; and display the article.
9111 (gnus-summary-select-article nil nil nil number)
9113 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
9115 (defun gnus-refer-article-methods ()
9116 "Return a list of referable methods."
9118 ;; No method, so we default to current and native.
9119 ((null gnus-refer-article-method)
9120 (list gnus-current-select-method gnus-select-method))
9122 ((eq 'current gnus-refer-article-method)
9123 (list gnus-current-select-method))
9124 ;; List of select methods.
9125 ((not (and (symbolp (car gnus-refer-article-method))
9126 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
9128 (dolist (method gnus-refer-article-method)
9129 (push (if (eq 'current method)
9130 gnus-current-select-method
9131 (if (eq 'nnir (car method))
9135 (gnus-method-to-server gnus-current-select-method)))
9139 ;; One single select method.
9141 (list gnus-refer-article-method))))
9143 (defun gnus-summary-edit-parameters ()
9144 "Edit the group parameters of the current group."
9146 (gnus-group-edit-group gnus-newsgroup-name 'params))
9148 (defun gnus-summary-customize-parameters ()
9149 "Customize the group parameters of the current group."
9151 (gnus-group-customize gnus-newsgroup-name))
9153 (defun gnus-summary-enter-digest-group (&optional force)
9154 "Enter an nndoc group based on the current article.
9155 If FORCE, force a digest interpretation. If not, try to guess
9156 what the document format is.
9158 To control what happens when you exit the group, see the
9159 `gnus-auto-select-on-ephemeral-exit' variable."
9161 (let ((conf gnus-current-window-configuration))
9162 (save-window-excursion
9164 (let (gnus-article-prepare-hook
9165 gnus-display-mime-function
9167 (gnus-summary-select-article))))
9168 (setq gnus-current-window-configuration conf)
9169 (let* ((name (format "%s-%d"
9170 (gnus-group-prefixed-name
9171 gnus-newsgroup-name (list 'nndoc ""))
9172 (with-current-buffer gnus-summary-buffer
9173 gnus-current-article)))
9174 (ogroup gnus-newsgroup-name)
9175 (params (append (gnus-info-params (gnus-get-info ogroup))
9176 (list (cons 'to-group ogroup))
9177 (list (cons 'parent-group ogroup))
9178 (list (cons 'save-article-group ogroup))))
9179 (case-fold-search t)
9180 (buf (current-buffer))
9181 dig to-address charset)
9182 (with-current-buffer gnus-original-article-buffer
9183 ;; Have the digest group inherit the main mail address of
9184 ;; the parent article.
9185 (when (setq to-address (or (gnus-fetch-field "reply-to")
9186 (gnus-fetch-field "from")))
9190 (list (cons 'to-address
9191 (funcall gnus-decode-encoded-address-function
9193 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
9194 (insert-buffer-substring gnus-original-article-buffer)
9196 (goto-char (point-min))
9197 (or (search-forward "\n\n" nil t) (point)))
9198 ;; Remove lines that may lead nndoc to misinterpret the
9200 (goto-char (point-min))
9201 (delete-matching-lines "^Path:\\|^From ")
9202 ;; Parse charset, and decode content transfer encoding.
9203 (setq charset (mail-content-type-get
9204 (mail-header-parse-content-type
9205 (or (gnus-fetch-field "content-type") ""))
9207 (let ((encoding (gnus-fetch-field "content-transfer-encoding")))
9209 (message-remove-header "content-transfer-encoding")
9210 (goto-char (point-max))
9212 (narrow-to-region (point) (point-max))
9213 (mm-decode-content-transfer-encoding
9214 (intern (downcase (mail-header-strip encoding))))))
9217 (if (let ((gnus-newsgroup-ephemeral-charset
9219 (intern (downcase (gnus-strip-whitespace charset)))
9220 gnus-newsgroup-charset))
9221 (gnus-newsgroup-ephemeral-ignored-charsets
9222 gnus-newsgroup-ignored-charsets))
9223 (gnus-group-read-ephemeral-group
9224 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
9226 ,(if force 'mbox 'guess)))
9228 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
9230 ;; Make all postings to this group go to the parent group.
9231 (nconc (gnus-info-params (gnus-get-info name))
9233 ;; Couldn't select this doc group.
9234 (switch-to-buffer buf)
9235 (gnus-set-global-variables)
9236 (gnus-configure-windows 'summary)
9237 (gnus-message 3 "Article couldn't be entered?"))
9238 (kill-buffer dig)))))
9240 (defun gnus-summary-read-document (n)
9241 "Open a new group based on the current article(s).
9242 This will allow you to read digests and other similar
9243 documents as newsgroups.
9244 Obeys the standard process/prefix convention."
9246 (let* ((ogroup gnus-newsgroup-name)
9247 (params (append (gnus-info-params (gnus-get-info ogroup))
9248 (list (cons 'to-group ogroup))))
9249 group egroup groups vgroup)
9250 (dolist (article (gnus-summary-work-articles n))
9251 (setq group (format "%s-%d" gnus-newsgroup-name article))
9252 (gnus-summary-remove-process-mark article)
9253 (when (gnus-summary-display-article article)
9254 (save-excursion ;;What for?
9256 (insert-buffer-substring gnus-original-article-buffer)
9257 ;; Remove some headers that may lead nndoc to make
9259 (message-narrow-to-head)
9260 (goto-char (point-min))
9261 (delete-matching-lines "^Path:\\|^From ")
9264 (gnus-group-read-ephemeral-group
9265 group `(nndoc ,group (nndoc-address ,(current-buffer))
9266 (nndoc-article-type guess))
9269 ;; Make all postings to this group go to the parent group.
9270 (nconc (gnus-info-params (gnus-get-info egroup))
9272 (push egroup groups))
9273 ;; Couldn't select this doc group.
9274 (gnus-error 3 "Article couldn't be entered"))))))
9275 ;; Now we have selected all the documents.
9278 (error "None of the articles could be interpreted as documents"))
9279 ((gnus-group-read-ephemeral-group
9280 (setq vgroup (format
9281 "nnvirtual:%s-%s" gnus-newsgroup-name
9282 (format-time-string "%Y%m%dT%H%M%S")))
9283 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
9285 (cons (current-buffer) 'summary)))
9287 (error "Couldn't select virtual nndoc group")))))
9289 (defun gnus-summary-widget-forward (arg)
9290 "Move point to the next field or button in the article.
9291 With optional ARG, move across that many fields."
9293 (gnus-summary-select-article)
9294 (gnus-configure-windows 'article)
9295 (select-window (gnus-get-buffer-window gnus-article-buffer))
9296 (widget-forward arg))
9298 (defun gnus-summary-widget-backward (arg)
9299 "Move point to the previous field or button in the article.
9300 With optional ARG, move across that many fields."
9302 (gnus-summary-select-article)
9303 (gnus-configure-windows 'article)
9304 (select-window (gnus-get-buffer-window gnus-article-buffer))
9305 (unless (widget-at (point))
9306 (goto-char (point-max)))
9307 (widget-backward arg))
9309 (defun gnus-summary-isearch-article (&optional regexp-p)
9310 "Do incremental search forward on the current article.
9311 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9313 (gnus-summary-select-article)
9314 (gnus-configure-windows 'article)
9315 (gnus-eval-in-buffer-window gnus-article-buffer
9318 (isearch-forward regexp-p))))
9320 (defun gnus-summary-repeat-search-article-forward ()
9321 "Repeat the previous search forwards."
9323 (unless gnus-last-search-regexp
9324 (error "No previous search"))
9325 (gnus-summary-search-article-forward gnus-last-search-regexp))
9327 (defun gnus-summary-repeat-search-article-backward ()
9328 "Repeat the previous search backwards."
9330 (unless gnus-last-search-regexp
9331 (error "No previous search"))
9332 (gnus-summary-search-article-forward gnus-last-search-regexp t))
9334 (defun gnus-summary-search-article-forward (regexp &optional backward)
9335 "Search for an article containing REGEXP forward.
9336 If BACKWARD, search backward instead."
9339 (format "Search article %s (regexp%s): "
9340 (if current-prefix-arg "backward" "forward")
9341 (if gnus-last-search-regexp
9342 (concat ", default " gnus-last-search-regexp)
9344 current-prefix-arg))
9345 (if (string-equal regexp "")
9346 (setq regexp (or gnus-last-search-regexp ""))
9347 (setq gnus-last-search-regexp regexp)
9348 (setq gnus-article-before-search gnus-current-article))
9349 ;; Intentionally set gnus-last-article.
9350 (setq gnus-last-article gnus-article-before-search)
9351 (let ((gnus-last-article gnus-last-article))
9352 (if (gnus-summary-search-article regexp backward)
9353 (gnus-summary-show-thread)
9354 (signal 'search-failed (list regexp)))))
9356 (defun gnus-summary-search-article-backward (regexp)
9357 "Search for an article containing REGEXP backward."
9360 (format "Search article backward (regexp%s): "
9361 (if gnus-last-search-regexp
9362 (concat ", default " gnus-last-search-regexp)
9364 (gnus-summary-search-article-forward regexp 'backward))
9366 (defun gnus-summary-search-article (regexp &optional backward)
9367 "Search for an article containing REGEXP.
9368 Optional argument BACKWARD means do search for backward.
9369 `gnus-select-article-hook' is not called during the search."
9370 ;; We have to require this here to make sure that the following
9371 ;; dynamic binding isn't shadowed by autoloading.
9372 (require 'gnus-async)
9374 (let ((gnus-select-article-hook nil) ;Disable hook.
9375 (gnus-article-prepare-hook nil)
9376 (gnus-mark-article-hook nil) ;Inhibit marking as read.
9377 (gnus-use-article-prefetch nil)
9378 (gnus-use-trees nil) ;Inhibit updating tree buffer.
9380 (gnus-keep-backlog nil)
9381 (gnus-break-pages nil)
9382 (gnus-summary-display-arrow nil)
9383 (gnus-updated-mode-lines nil)
9384 (gnus-auto-center-summary nil)
9385 (sum (current-buffer))
9386 (gnus-display-mime-function nil)
9389 (gnus-save-hidden-threads
9390 (gnus-summary-select-article)
9391 (set-buffer gnus-article-buffer)
9392 (goto-char (window-point (get-buffer-window (current-buffer))))
9396 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
9398 (re-search-backward regexp nil t)
9399 (re-search-forward regexp nil t))
9400 ;; We found the regexp.
9405 (get-buffer-window (current-buffer))
9409 (get-buffer-window (current-buffer))
9412 (setq point (point)))
9413 ;; We didn't find it, so we go to the next article.
9416 (while (eq found 'not)
9417 (if (not (if backward (gnus-summary-find-prev)
9418 (gnus-summary-find-next)))
9419 ;; No more articles.
9421 ;; Select the next article and adjust point.
9422 (unless (gnus-summary-article-sparse-p
9423 (gnus-summary-article-number))
9425 (gnus-summary-select-article)
9426 (set-buffer gnus-article-buffer)
9428 (goto-char (if backward (point-max) (point-min))))))))
9429 (gnus-message 7 ""))
9430 ;; Return whether we found the regexp.
9431 (when (eq found 'found)
9433 (sit-for 0) ;; Ensure that the point is visible in the summary window.
9434 (gnus-summary-show-thread)
9435 (gnus-summary-goto-subject gnus-current-article)
9436 (gnus-summary-position-point)
9439 (defun gnus-find-matching-articles (header regexp)
9440 "Return a list of all articles that match REGEXP on HEADER.
9441 This search includes all articles in the current group that Gnus has
9442 fetched headers for, whether they are displayed or not."
9443 (let ((articles nil)
9444 ;; Can't eta-reduce because it's a macro.
9445 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9446 (case-fold-search t))
9447 (dolist (header gnus-newsgroup-headers)
9448 (when (string-match regexp (funcall func header))
9449 (push (mail-header-number header) articles)))
9450 (nreverse articles)))
9452 (defun gnus-summary-find-matching (header regexp &optional backward unread
9453 not-case-fold not-matching)
9454 "Return a list of all articles that match REGEXP on HEADER.
9455 The search stars on the current article and goes forwards unless
9456 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9457 If UNREAD is non-nil, only unread articles will
9458 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9459 in the comparisons. If NOT-MATCHING, return a list of all articles that
9460 not match REGEXP on HEADER."
9461 (let ((case-fold-search (not not-case-fold))
9464 (if (eq (car header) 'extra)
9467 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9469 (error "%s is an invalid header" header))
9470 (unless (fboundp (intern (concat "mail-header-" header)))
9471 (error "%s is not a valid header" header))
9472 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9473 (dolist (d (if (eq backward 'all)
9475 (gnus-data-find-list
9476 (gnus-summary-article-number)
9477 (gnus-data-list backward))))
9478 (when (and (or (not unread) ; We want all articles...
9479 (gnus-data-unread-p d)) ; Or just unreads.
9480 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9484 (funcall func (gnus-data-header d))))
9485 (string-match regexp
9486 (funcall func (gnus-data-header d)))))
9487 (push (gnus-data-number d) articles))) ; Success!
9488 (nreverse articles)))
9490 (defun gnus-summary-execute-command (header regexp command &optional backward)
9491 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9492 If HEADER is an empty string (or nil), the match is done on the entire
9493 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9495 (list (let ((completion-ignore-case t))
9496 (gnus-completing-read
9498 (mapcar 'symbol-name
9500 '(Number Subject From Lines Date
9501 Message-ID Xref References Body)
9502 gnus-extra-headers))
9504 (read-string "Regexp: ")
9505 (read-key-sequence "Command: ")
9506 current-prefix-arg))
9507 (when (equal header "Body")
9509 ;; Hidden thread subtrees must be searched as well.
9510 (gnus-summary-show-all-threads)
9511 ;; We don't want to change current point nor window configuration.
9513 (save-window-excursion
9515 gnus-treat-strip-trailing-blank-lines
9516 gnus-treat-strip-leading-blank-lines
9517 gnus-treat-strip-multiple-blank-lines
9518 gnus-treat-hide-boring-headers
9519 gnus-treat-fold-newsgroups
9520 gnus-article-prepare-hook)
9521 (gnus-message 6 "Executing %s..." (key-description command))
9522 ;; We'd like to execute COMMAND interactively so as to give arguments.
9523 (gnus-execute header regexp
9524 `(call-interactively ',(key-binding command))
9526 (gnus-message 6 "Executing %s...done" (key-description command))))))
9528 (defun gnus-summary-beginning-of-article ()
9529 "Scroll the article back to the beginning."
9531 (gnus-summary-select-article)
9532 (gnus-configure-windows 'article)
9533 (gnus-eval-in-buffer-window gnus-article-buffer
9535 (goto-char (point-min))
9536 (when gnus-break-pages
9537 (gnus-narrow-to-page))))
9539 (defun gnus-summary-end-of-article ()
9540 "Scroll to the end of the article."
9542 (gnus-summary-select-article)
9543 (gnus-configure-windows 'article)
9544 (gnus-eval-in-buffer-window gnus-article-buffer
9546 (goto-char (point-max))
9548 (when gnus-break-pages
9549 (gnus-narrow-to-page))))
9551 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9552 "Truncate to LEN and quote all \"(\"'s in STRING."
9553 (replace-regexp-in-string "[()]" "\\\\\\&"
9554 (if (and len (> (length string) len))
9555 (substring string 0 len)
9558 (defun gnus-summary-print-article (&optional filename n)
9559 "Generate and print a PostScript image of the process-marked (mail) articles.
9561 If used interactively, print the current article if none are
9562 process-marked. With prefix arg, prompt the user for the name of the
9565 When used from Lisp, accept two optional args FILENAME and N. N means
9566 to print the next N articles. If N is negative, print the N previous
9567 articles. If N is nil and articles have been marked with the process
9568 mark, print these instead.
9570 If the optional first argument FILENAME is nil, send the image to the
9571 printer. If FILENAME is a string, save the PostScript image in a file with
9572 that name. If FILENAME is a number, prompt the user for the name of the file
9574 (interactive (list (ps-print-preprint current-prefix-arg)))
9575 (dolist (article (gnus-summary-work-articles n))
9576 (gnus-summary-select-article nil nil 'pseudo article)
9577 (gnus-eval-in-buffer-window gnus-article-buffer
9578 (gnus-print-buffer))
9579 (gnus-summary-remove-process-mark article))
9580 (ps-despool filename))
9582 (defun gnus-print-buffer ()
9583 (let ((ps-left-header
9586 (gnus-summary-print-truncate-and-quote
9587 (mail-header-subject gnus-current-headers)
9590 (gnus-summary-print-truncate-and-quote
9591 (mail-header-from gnus-current-headers)
9595 "/pagenumberstring load"
9597 (mail-header-date gnus-current-headers) ")"))))
9598 (gnus-run-hooks 'gnus-ps-print-hook)
9600 (if ps-print-color-p
9601 (ps-spool-buffer-with-faces)
9602 (ps-spool-buffer)))))
9604 (declare-function gnus-flush-original-article-buffer "gnus-art" ())
9606 (defun gnus-summary-show-complete-article ()
9607 "Show a complete version of the current article.
9608 This is only useful if you're looking at a partial version of the
9611 (let ((gnus-keep-backlog nil)
9612 (gnus-use-cache nil)
9615 (format "%s-fetch-partial-articles"
9616 (car (gnus-find-method-for-group
9617 gnus-newsgroup-name)))
9622 (setq old-val (symbol-value variable))
9624 (gnus-flush-original-article-buffer)
9625 (gnus-summary-show-article))
9626 (set variable old-val))))
9628 (defun gnus-summary-show-article (&optional arg)
9629 "Force redisplaying of the current article.
9630 If ARG (the prefix) is a number, show the article with the charset
9631 defined in `gnus-summary-show-article-charset-alist', or the charset
9633 If ARG (the prefix) is non-nil and not a number, show the article,
9634 but without running any of the article treatment functions
9635 article. Normally, the keystroke is `C-u g'. When using `C-u
9636 C-u g', show the raw article."
9640 (gnus-summary-show-article t)
9641 (let ((gnus-newsgroup-charset
9642 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9644 "View as charset: " ;; actually it is coding system.
9645 (with-current-buffer gnus-article-buffer
9646 (mm-detect-coding-region (point) (point-max))))))
9647 (gnus-newsgroup-ignored-charsets 'gnus-all))
9648 (gnus-summary-select-article nil 'force)
9649 (let ((deps gnus-newsgroup-dependencies)
9651 (with-current-buffer gnus-original-article-buffer
9653 (message-narrow-to-head)
9654 (setq head (buffer-string))
9655 (goto-char (point-min))
9656 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9657 (goto-char (point-max))
9659 (setq lines (1- (count-lines (point) (point-max))))))
9661 (insert (format "211 %d Article retrieved.\n"
9662 (cdr gnus-article-current)))
9664 (if lines (insert (format "Lines: %d\n" lines)))
9666 (let ((nntp-server-buffer (current-buffer)))
9667 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9668 (gnus-data-set-header
9669 (gnus-data-find (cdr gnus-article-current))
9671 (gnus-summary-update-article-line
9672 (cdr gnus-article-current) header)
9673 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9674 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9676 ;; Select the article the normal way.
9677 (if (eq mm-text-html-renderer 'shr)
9680 (let ((shr-ignore-cache t))
9681 (gnus-summary-select-article nil 'force)))
9682 (gnus-summary-select-article nil 'force)))
9685 (let ((gnus-inhibit-article-treatments t))
9686 (gnus-summary-select-article nil 'force)))
9688 ;; We have to require this here to make sure that the following
9689 ;; dynamic binding isn't shadowed by autoloading.
9690 (require 'gnus-async)
9692 ;; Bind the article treatment functions to nil.
9693 (let ((gnus-have-all-headers t)
9694 gnus-article-prepare-hook
9695 gnus-article-decode-hook
9696 gnus-display-mime-function
9698 ;; Destroy any MIME parts.
9699 (when (gnus-buffer-live-p gnus-article-buffer)
9700 (with-current-buffer gnus-article-buffer
9701 (gnus-article-stop-animations)
9702 (gnus-stop-downloads)
9703 (mm-destroy-parts gnus-article-mime-handles)
9704 ;; Set it to nil for safety reason.
9705 (setq gnus-article-mime-handle-alist nil)
9706 (setq gnus-article-mime-handles nil)))
9707 (gnus-summary-select-article nil 'force))))
9708 (gnus-summary-goto-subject gnus-current-article)
9709 (gnus-summary-position-point))
9711 (defun gnus-summary-show-raw-article ()
9712 "Show the raw article without any article massaging functions being run."
9714 (gnus-summary-show-article t))
9716 (defun gnus-summary-verbose-headers (&optional arg)
9717 "Toggle permanent full header display.
9718 If ARG is a positive number, turn header display on.
9719 If ARG is a negative number, turn header display off."
9721 (setq gnus-show-all-headers
9722 (cond ((or (not (numberp arg))
9724 (not gnus-show-all-headers))
9727 (gnus-summary-show-article))
9729 (declare-function article-narrow-to-head "gnus-art" ())
9730 (declare-function gnus-article-hidden-text-p "gnus-art" (type))
9731 (declare-function gnus-delete-wash-type "gnus-art" (type))
9732 (declare-function gnus-mime-buttonize-attachments-in-header
9733 "gnus-art" (&optional interactive))
9735 (defun gnus-summary-toggle-header (&optional arg)
9736 "Show the headers if they are hidden, or hide them if they are shown.
9737 If ARG is a positive number, show the entire header.
9738 If ARG is a negative number, hide the unwanted header lines."
9740 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9741 (get-buffer-window gnus-article-buffer t))))
9742 (with-current-buffer gnus-article-buffer
9744 (article-narrow-to-head)
9745 (let* ((inhibit-read-only t)
9746 (inhibit-point-motion-hooks t)
9747 (hidden (if (numberp arg)
9749 (or (not (looking-at "[^ \t\n]+:"))
9750 (gnus-article-hidden-text-p 'headers))))
9752 (delete-region (point-min) (point-max))
9753 (with-current-buffer gnus-original-article-buffer
9754 (goto-char (setq s (point-min)))
9755 (setq e (if (search-forward "\n\n" nil t)
9758 (insert-buffer-substring gnus-original-article-buffer s e)
9759 (run-hooks 'gnus-article-decode-hook)
9761 (let ((gnus-treat-hide-headers nil)
9762 (gnus-treat-hide-boring-headers nil))
9763 (gnus-delete-wash-type 'headers)
9764 (gnus-treat-article 'head))
9765 (gnus-treat-article 'head)
9766 ;; Add attachment buttons to the header.
9767 (when gnus-mime-display-attachment-buttons-in-header
9768 (gnus-mime-buttonize-attachments-in-header)))
9771 (set-window-start window (goto-char (point-min))))
9772 (if gnus-break-pages
9773 (gnus-narrow-to-page)
9774 (when (gnus-visual-p 'page-marker)
9775 (let ((inhibit-read-only t))
9776 (gnus-remove-text-with-property 'gnus-prev)
9777 (gnus-remove-text-with-property 'gnus-next))))
9778 (gnus-set-mode-line 'article)))))
9780 (defun gnus-summary-show-all-headers ()
9781 "Make all header lines visible."
9783 (gnus-summary-toggle-header 1))
9785 (defun gnus-summary-caesar-message (&optional arg)
9786 "Caesar rotate the current article by 13.
9787 With a non-numerical prefix, also rotate headers. A numerical
9788 prefix specifies how many places to rotate each letter forward."
9790 (gnus-summary-select-article)
9791 (let ((mail-header-separator ""))
9792 (gnus-eval-in-buffer-window gnus-article-buffer
9795 (let ((start (window-start))
9796 (inhibit-read-only t))
9797 (if (equal arg '(4))
9798 (message-caesar-buffer-body nil t)
9799 (message-caesar-buffer-body arg))
9800 (set-window-start (get-buffer-window (current-buffer)) start)))))
9801 ;; Create buttons and stuff...
9802 (gnus-treat-article nil))
9804 (defun gnus-summary-idna-message (&optional arg)
9805 "Decode IDNA encoded domain names in the current articles.
9806 IDNA encoded domain names looks like `xn--bar'. If a string
9807 remain unencoded after running this function, it is likely an
9808 invalid IDNA string (`xn--bar' is invalid).
9810 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9811 installed for this command to work."
9813 (gnus-summary-select-article)
9814 (let ((mail-header-separator ""))
9815 (gnus-eval-in-buffer-window gnus-article-buffer
9818 (let ((start (window-start))
9820 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9821 (replace-match (puny-decode-domain (match-string 1))))
9822 (set-window-start (get-buffer-window (current-buffer)) start))))))
9824 (defun gnus-summary-morse-message (&optional arg)
9825 "Morse decode the current article."
9827 (gnus-summary-select-article)
9828 (let ((mail-header-separator ""))
9829 (gnus-eval-in-buffer-window gnus-article-buffer
9833 (let ((pos (window-start))
9834 (inhibit-read-only t))
9835 (goto-char (point-min))
9836 (when (message-goto-body)
9837 (gnus-narrow-to-body))
9838 (goto-char (point-min))
9839 (while (search-forward "·" (point-max) t)
9840 (replace-match "."))
9841 (unmorse-region (point-min) (point-max))
9843 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9845 (defun gnus-summary-stop-page-breaking ()
9846 "Stop page breaking in the current article."
9848 (gnus-summary-select-article)
9849 (gnus-eval-in-buffer-window gnus-article-buffer
9851 (when (gnus-visual-p 'page-marker)
9852 (let ((inhibit-read-only t))
9853 (gnus-remove-text-with-property 'gnus-prev)
9854 (gnus-remove-text-with-property 'gnus-next))
9855 (setq gnus-page-broken nil))))
9857 (defun gnus-summary-move-article (&optional n to-newsgroup
9858 select-method action)
9859 "Move the current article to a different newsgroup.
9860 If N is a positive number, move the N next articles.
9861 If N is a negative number, move the N previous articles.
9862 If N is nil and any articles have been marked with the process mark,
9863 move those articles instead.
9864 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9865 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9866 re-spool using this method.
9868 When called interactively with TO-NEWSGROUP being nil, the value of
9869 the variable `gnus-move-split-methods' is used for finding a default
9870 for the target newsgroup.
9872 For this function to work, both the current newsgroup and the
9873 newsgroup that you want to move to have to support the `request-move'
9874 and `request-accept' functions.
9876 ACTION can be either `move' (the default), `crosspost' or `copy'."
9879 (setq action 'move))
9880 ;; Check whether the source group supports the required functions.
9881 (cond ((and (eq action 'move)
9882 (not (gnus-check-backend-function
9883 'request-move-article gnus-newsgroup-name)))
9884 (error "The current group does not support article moving"))
9885 ((and (eq action 'crosspost)
9886 (not (gnus-check-backend-function
9887 'request-replace-article gnus-newsgroup-name)))
9888 (error "The current group does not support article editing")))
9889 (let ((articles (gnus-summary-work-articles n))
9890 (prefix (if (gnus-check-backend-function
9891 'request-move-article gnus-newsgroup-name)
9892 (funcall gnus-move-group-prefix-function
9893 gnus-newsgroup-name)
9895 (names '((move "Move" "Moving")
9896 (copy "Copy" "Copying")
9897 (crosspost "Crosspost" "Crossposting")))
9898 (copy-buf (save-excursion
9899 (nnheader-set-temp-buffer " *copy article*")))
9900 art-group to-method new-xref article to-groups
9901 articles-to-update-marks encoded)
9902 (unless (assq action names)
9903 (error "Unknown action %s" action))
9904 ;; Read the newsgroup name.
9905 (when (and (not to-newsgroup)
9906 (not select-method))
9907 (if (and gnus-move-split-methods
9909 (and (memq gnus-current-article articles)
9910 (gnus-buffer-live-p gnus-original-article-buffer))))
9911 ;; When `gnus-move-split-methods' is non-nil, we have to
9912 ;; select an article to give `gnus-read-move-group-name' an
9913 ;; opportunity to suggest an appropriate default. However,
9914 ;; we needn't render or mark the article.
9915 (let ((gnus-display-mime-function nil)
9916 (gnus-article-prepare-hook nil)
9917 (gnus-mark-article-hook nil))
9918 (gnus-summary-select-article nil nil nil (car articles))))
9919 (setq to-newsgroup (gnus-read-move-group-name
9920 (cadr (assq action names))
9922 (intern (format "gnus-current-%s-group" action)))
9924 encoded to-newsgroup
9925 to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
9926 (set (intern (format "gnus-current-%s-group" action))
9927 (decode-coding-string
9929 (gnus-group-name-charset to-method to-newsgroup))))
9931 (setq to-method (or select-method
9932 (gnus-server-to-method
9933 (gnus-group-method to-newsgroup)))))
9937 (encode-coding-string
9939 (gnus-group-name-charset to-method to-newsgroup)))))
9940 ;; Check the method we are to move this article to...
9941 (unless (gnus-check-backend-function
9942 'request-accept-article (car to-method))
9943 (error "%s does not support article copying" (car to-method)))
9944 (unless (gnus-check-server to-method)
9945 (error "Can't open server %s" (car to-method)))
9946 (gnus-message 6 "%s to %s: %s..."
9947 (caddr (assq action names))
9948 (or (car select-method)
9949 (gnus-group-decoded-name to-newsgroup))
9952 (setq article (pop articles))
9953 ;; Set any marks that may have changed in the summary buffer.
9954 (when gnus-preserve-marks
9955 (gnus-summary-push-marks-to-backend article))
9959 ;; Move the article.
9961 ;; Remove this article from future suppression.
9962 (gnus-dup-unsuppress-article article)
9963 (let* ((from-method (gnus-find-method-for-group
9964 gnus-newsgroup-name))
9965 (to-method (or select-method
9966 (gnus-find-method-for-group to-newsgroup)))
9967 (move-is-internal (gnus-server-equal from-method to-method)))
9968 (gnus-request-move-article
9969 article ; Article to move
9970 gnus-newsgroup-name ; From newsgroup
9971 (nth 1 (gnus-find-method-for-group
9972 gnus-newsgroup-name)) ; Server
9973 (list 'gnus-request-accept-article
9974 to-newsgroup (list 'quote select-method)
9975 (not articles) t) ; Accept form
9976 (not articles) ; Only save nov last time
9977 (and move-is-internal
9978 to-newsgroup ; Not respooling
9979 ; Is this move internal?
9980 (gnus-group-real-name to-newsgroup)))))
9981 ;; Copy the article.
9983 (with-current-buffer copy-buf
9984 (when (gnus-request-article-this-buffer article
9985 gnus-newsgroup-name)
9987 (nnheader-narrow-to-headers)
9988 (dolist (hdr gnus-copy-article-ignored-headers)
9989 (message-remove-header hdr t)))
9990 (gnus-request-accept-article
9991 to-newsgroup select-method (not articles) t))))
9992 ;; Crosspost the article.
9993 ((eq action 'crosspost)
9994 (let ((xref (message-tokenize-header
9995 (mail-header-xref (gnus-summary-article-header
9998 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9999 ":" (number-to-string article)))
10001 (setq xref (list (system-name))))
10004 (mapconcat 'identity
10005 (delete "Xref:" (delete new-xref xref))
10008 (with-current-buffer copy-buf
10009 ;; First put the article in the destination group.
10010 (gnus-request-article-this-buffer article gnus-newsgroup-name)
10011 (when (consp (setq art-group
10012 (gnus-request-accept-article
10013 to-newsgroup select-method (not articles)
10015 (setq new-xref (concat new-xref " " (car art-group)
10017 (number-to-string (cdr art-group))))
10018 ;; Now we have the new Xrefs header, so we insert
10019 ;; it and replace the new article.
10020 (nnheader-replace-header "Xref" new-xref)
10021 (gnus-request-replace-article
10022 (cdr art-group) to-newsgroup (current-buffer) t)
10026 (gnus-message 1 "Couldn't %s article %s: %s"
10027 (cadr (assq action names)) article
10028 (nnheader-get-report (car to-method))))
10029 ((eq art-group 'junk)
10030 (when (eq action 'move)
10031 (gnus-summary-mark-article article gnus-canceled-mark)
10032 (gnus-message 4 "Deleted article %s" article)
10033 ;; run the delete hook
10034 (run-hook-with-args 'gnus-summary-article-delete-hook
10037 (assoc article (gnus-data-list nil)))
10038 gnus-newsgroup-name nil
10041 (let* ((pto-group (gnus-group-prefixed-name
10042 (car art-group) to-method))
10043 (info (gnus-get-info pto-group))
10044 (to-group (gnus-info-group info))
10046 ;; Update the group that has been moved to.
10048 (memq action '(move copy)))
10049 (unless (member to-group to-groups)
10050 (push to-group to-groups))
10052 (when (and (not (memq article gnus-newsgroup-unreads))
10054 (push 'read to-marks)
10055 (gnus-info-set-read
10056 info (gnus-add-to-range (gnus-info-read info)
10057 (list (cdr art-group)))))
10059 ;; See whether the article is to be put in the cache.
10060 (let* ((expirable (gnus-group-auto-expirable-p to-group))
10061 (marks (if expirable
10062 gnus-article-mark-lists
10063 (delete '(expirable . expire)
10065 gnus-article-mark-lists))))
10066 (to-article (cdr art-group)))
10068 ;; Enter the article into the cache in the new group,
10069 ;; if that is required.
10070 (when (and to-article
10072 (gnus-cache-possibly-enter-article
10073 to-group to-article
10074 (memq article gnus-newsgroup-marked)
10075 (memq article gnus-newsgroup-dormant)
10076 (memq article gnus-newsgroup-unreads)))
10078 (when (and gnus-preserve-marks
10080 ;; Copy any marks over to the new group.
10081 (when (and (equal to-group gnus-newsgroup-name)
10082 (not (memq article gnus-newsgroup-unreads)))
10083 ;; Mark this article as read in this group.
10084 (push (cons to-article gnus-read-mark)
10085 gnus-newsgroup-reads)
10086 ;; Increase the active status of this group.
10087 (setcdr (gnus-active to-group) to-article)
10088 (setcdr gnus-newsgroup-active to-article))
10091 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10092 (when (memq article (symbol-value
10093 (intern (format "gnus-newsgroup-%s"
10095 (push (cdar marks) to-marks)
10096 ;; If the other group is the same as this group,
10097 ;; then we have to add the mark to the list.
10098 (when (equal to-group gnus-newsgroup-name)
10099 (set (intern (format "gnus-newsgroup-%s"
10103 (intern (format "gnus-newsgroup-%s"
10105 ;; Copy the marks to other group.
10106 (gnus-add-marked-articles
10107 to-group (cdar marks) (list to-article) info)))
10108 (setq marks (cdr marks)))
10110 (when (and expirable
10111 gnus-mark-copied-or-moved-articles-as-expirable
10112 (not (memq 'expire to-marks)))
10113 ;; Mark this article as expirable.
10114 (push 'expire to-marks)
10115 (when (equal to-group gnus-newsgroup-name)
10116 (push to-article gnus-newsgroup-expirable))
10117 ;; Copy the expirable mark to other group.
10118 (gnus-add-marked-articles
10119 to-group 'expire (list to-article) info))
10121 (when (and to-marks
10122 (gnus-method-option-p
10123 (gnus-find-method-for-group to-group)
10125 (gnus-request-set-mark
10126 to-group (list (list (list to-article) 'add to-marks)))))
10128 (gnus-dribble-enter
10129 (concat "(gnus-group-set-info '"
10130 (gnus-prin1-to-string (gnus-get-info to-group))
10132 (concat "^(gnus-group-set-info '(\""
10133 (regexp-quote to-group) "\""))))
10135 ;; Update the Xref header in this article to point to
10136 ;; the new crossposted article we have just created.
10137 (when (eq action 'crosspost)
10138 (with-current-buffer copy-buf
10139 (gnus-request-article-this-buffer article gnus-newsgroup-name)
10140 (nnheader-replace-header "Xref" new-xref)
10141 (gnus-request-replace-article
10142 article gnus-newsgroup-name (current-buffer) t)))
10144 ;; run the move/copy/crosspost/respool hook
10145 (run-hook-with-args 'gnus-summary-article-move-hook
10148 (assoc article (gnus-data-list nil)))
10149 gnus-newsgroup-name
10153 ;;;!!!Why is this necessary?
10154 (set-buffer gnus-summary-buffer)
10156 (when (eq action 'move)
10158 (gnus-summary-goto-subject article)
10159 (gnus-summary-mark-article article gnus-canceled-mark)))))
10160 (push article articles-to-update-marks))
10163 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
10164 ;; Re-activate all groups that have been moved to.
10165 (with-current-buffer gnus-group-buffer
10166 (let ((gnus-group-marked to-groups))
10167 (gnus-group-get-new-news-this-group nil t)))
10169 (gnus-kill-buffer copy-buf)
10170 (gnus-summary-position-point)
10171 (gnus-set-mode-line 'summary)))
10173 (defun gnus-summary-push-marks-to-backend (article)
10176 (marks gnus-article-mark-lists))
10177 (unless (memq article gnus-newsgroup-unreads)
10180 (if (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10181 (memq article (symbol-value
10182 (intern (format "gnus-newsgroup-%s"
10184 (push (cdar marks) set)
10185 (push (cdar marks) del))
10187 (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)
10188 ((,article) del ,del)))))
10190 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
10191 "Copy the current article to some other group.
10192 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
10193 When called interactively, if TO-NEWSGROUP is nil, use the value of
10194 the variable `gnus-move-split-methods' for finding a default target
10196 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
10197 re-spool using this method."
10199 (gnus-summary-move-article n to-newsgroup select-method 'copy))
10201 (defun gnus-summary-crosspost-article (&optional n)
10202 "Crosspost the current article to some other group."
10204 (gnus-summary-move-article n nil nil 'crosspost))
10206 (defcustom gnus-summary-respool-default-method nil
10207 "Default method type for respooling an article.
10208 If nil, use to the current newsgroup method."
10210 :group 'gnus-summary-mail)
10212 (defun gnus-summary-respool-article (&optional n method)
10213 "Respool the current article.
10214 The article will be squeezed through the mail spooling process again,
10215 which means that it will be put in some mail newsgroup or other
10216 depending on `nnmail-split-methods'.
10217 If N is a positive number, respool the N next articles.
10218 If N is a negative number, respool the N previous articles.
10219 If N is nil and any articles have been marked with the process mark,
10220 respool those articles instead.
10222 Respooling can be done both from mail groups and \"real\" newsgroups.
10223 In the former case, the articles in question will be moved from the
10224 current group into whatever groups they are destined to. In the
10225 latter case, they will be copied into the relevant groups."
10227 (list current-prefix-arg
10228 (let* ((methods (mapcar #'car (gnus-methods-using 'respool)))
10230 (symbol-name (or gnus-summary-respool-default-method
10231 (car (gnus-find-method-for-group
10232 gnus-newsgroup-name)))))
10234 (gnus-completing-read
10235 "Backend to use when respooling"
10236 methods t nil 'gnus-mail-method-history methname))
10239 ((zerop (length (setq ms (gnus-servers-using-backend
10240 (intern method)))))
10241 (list (intern method) ""))
10245 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
10246 (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
10249 (error "No method given for respooling"))
10250 (if (assoc (symbol-name
10251 (car (gnus-find-method-for-group gnus-newsgroup-name)))
10252 (gnus-methods-using 'respool))
10253 (gnus-summary-move-article n nil method)
10254 (gnus-summary-copy-article n nil method)))
10256 (defun gnus-summary-import-article (file &optional edit)
10257 "Import an arbitrary file into a mail newsgroup."
10258 (interactive "fImport file: \nP")
10259 (let ((group gnus-newsgroup-name)
10260 (now (current-time))
10261 atts lines group-art)
10262 (unless (gnus-check-backend-function 'request-accept-article group)
10263 (error "%s does not support article importing" group))
10264 (or (file-readable-p file)
10265 (not (file-regular-p file))
10266 (error "Can't read %s" file))
10267 (with-current-buffer (gnus-get-buffer-create " *import file*")
10269 (nnheader-insert-file-contents file)
10270 (goto-char (point-min))
10271 (if (nnheader-article-p)
10273 (goto-char (point-min))
10274 (search-forward "\n\n" nil t)
10275 (narrow-to-region (point-min) (1- (point)))
10276 (goto-char (point-min))
10277 (unless (re-search-forward "^date:" nil t)
10278 (goto-char (point-max))
10279 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
10280 ;; This doesn't look like an article, so we fudge some headers.
10281 (setq atts (file-attributes file)
10282 lines (count-lines (point-min) (point-max)))
10283 (insert "From: " (read-string "From: ") "\n"
10284 "Subject: " (read-string "Subject: ") "\n"
10285 "Date: " (message-make-date (nth 5 atts)) "\n"
10286 "Message-ID: " (message-make-message-id) "\n"
10287 "Lines: " (int-to-string lines) "\n"
10288 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
10289 (setq group-art (gnus-request-accept-article group nil t))
10290 (kill-buffer (current-buffer)))
10291 (setq gnus-newsgroup-active (gnus-activate-group group))
10293 (gnus-summary-goto-article (cdr group-art) nil t)
10295 (gnus-summary-edit-article))))
10297 (defun gnus-summary-create-article ()
10298 "Create an article in a mail newsgroup."
10300 (let ((group gnus-newsgroup-name)
10301 (now (current-time))
10303 (unless (gnus-check-backend-function 'request-accept-article group)
10304 (error "%s does not support article importing" group))
10305 (with-current-buffer (gnus-get-buffer-create " *import file*")
10307 (goto-char (point-min))
10308 ;; This doesn't look like an article, so we fudge some headers.
10309 (insert "From: " (read-string "From: ") "\n"
10310 "Subject: " (read-string "Subject: ") "\n"
10311 "Date: " (message-make-date now) "\n"
10312 "Message-ID: " (message-make-message-id) "\n")
10313 (setq group-art (gnus-request-accept-article group nil t))
10314 (kill-buffer (current-buffer)))
10315 (setq gnus-newsgroup-active (gnus-activate-group group))
10317 (gnus-summary-goto-article (cdr group-art) nil t)
10318 (gnus-summary-edit-article)))
10320 (defun gnus-summary-article-posted-p ()
10321 "Say whether the current (mail) article is available from news as well.
10322 This will be the case if the article has both been mailed and posted."
10324 (let ((id (mail-header-references (gnus-summary-article-header)))
10325 (gnus-override-method (car (gnus-refer-article-methods))))
10326 (if (gnus-request-head id "")
10327 (gnus-message 2 "The current message was found on %s"
10328 gnus-override-method)
10329 (gnus-message 2 "The current message couldn't be found on %s"
10330 gnus-override-method)
10333 (defun gnus-summary-expire-articles (&optional now)
10334 "Expire all articles that are marked as expirable in the current group."
10336 (when (and (not gnus-group-is-exiting-without-update-p)
10337 (gnus-check-backend-function
10338 'request-expire-articles gnus-newsgroup-name))
10339 ;; This backend supports expiry.
10340 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
10342 (gnus-list-range-difference
10345 ;; We need to update the info for
10346 ;; this group for `gnus-list-of-read-articles'
10347 ;; to give us the right answer.
10348 (gnus-run-hooks 'gnus-exit-group-hook)
10349 (gnus-summary-update-info)
10350 (gnus-list-of-read-articles gnus-newsgroup-name))
10351 (setq gnus-newsgroup-expirable
10352 (sort gnus-newsgroup-expirable '<)))
10353 gnus-newsgroup-unexist))
10354 (expiry-wait (if now 'immediate
10355 (gnus-group-find-parameter
10356 gnus-newsgroup-name 'expiry-wait)))
10357 (nnmail-expiry-target
10358 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
10359 nnmail-expiry-target))
10362 ;; There are expirable articles in this group, so we run them
10363 ;; through the expiry process.
10364 (gnus-message 6 "Expiring articles...")
10365 (when (gnus-check-group gnus-newsgroup-name)
10366 ;; The list of articles that weren't expired is returned.
10369 (let ((nnmail-expiry-wait-function nil)
10370 (nnmail-expiry-wait expiry-wait))
10371 (setq es (gnus-request-expire-articles
10372 expirable gnus-newsgroup-name)))
10373 (setq es (gnus-request-expire-articles
10374 expirable gnus-newsgroup-name)))
10376 (setq gnus-newsgroup-expirable es))
10377 ;; We go through the old list of expirable, and mark all
10378 ;; really expired articles as nonexistent.
10379 (unless (eq es expirable) ;If nothing was expired, we don't mark.
10380 (let ((gnus-use-cache nil))
10381 (dolist (article expirable)
10382 (when (and (not (memq article es))
10383 (gnus-data-find article))
10384 (gnus-summary-mark-article article gnus-canceled-mark)
10385 (run-hook-with-args
10386 'gnus-summary-article-expire-hook
10388 (gnus-data-header (assoc article (gnus-data-list nil)))
10389 gnus-newsgroup-name
10391 ((stringp nnmail-expiry-target) nnmail-expiry-target)
10392 ((eq nnmail-expiry-target 'delete) nil)
10394 (let ((rescall (funcall nnmail-expiry-target
10395 gnus-newsgroup-name)))
10396 (if (stringp rescall) rescall nil))))
10398 (gnus-message 6 "Expiring articles...done")))))
10400 (defun gnus-summary-expire-articles-now ()
10401 "Expunge all expirable articles in the current group.
10402 This means that *all* articles that are marked as expirable will be
10403 deleted forever, right now."
10405 (or gnus-expert-user
10407 "Are you really, really sure you want to delete all expirable messages? ")
10409 (gnus-summary-expire-articles t))
10411 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10412 (defun gnus-summary-delete-article (&optional n)
10413 "Delete the N next (mail) articles.
10414 This command actually deletes articles. This is not a marking
10415 command. The article will disappear forever from your life, never to
10418 If N is negative, delete backwards.
10419 If N is nil and articles have been marked with the process mark,
10420 delete these instead.
10422 If `gnus-novice-user' is non-nil you will be asked for
10423 confirmation before the articles are deleted."
10425 (unless (gnus-check-backend-function 'request-expire-articles
10426 gnus-newsgroup-name)
10427 (error "The current newsgroup does not support article deletion"))
10428 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
10429 (error "Couldn't open server"))
10430 ;; Compute the list of articles to delete.
10431 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
10432 (nnmail-expiry-target 'delete)
10434 (if (and gnus-novice-user
10435 (not (gnus-yes-or-no-p
10436 (format "Do you really want to delete %s forever? "
10437 (if (> (length articles) 1)
10438 (format "these %s articles" (length articles))
10439 "this article")))))
10441 ;; Delete the articles.
10442 (setq not-deleted (gnus-request-expire-articles
10443 articles gnus-newsgroup-name 'force))
10446 (gnus-summary-remove-process-mark (car articles))
10447 ;; The backend might not have been able to delete the article
10449 (unless (memq (car articles) not-deleted)
10450 (gnus-summary-mark-article (car articles) gnus-canceled-mark)
10451 (let* ((article (car articles))
10452 (ghead (gnus-data-header
10453 (assoc article (gnus-data-list nil)))))
10454 (run-hook-with-args 'gnus-summary-article-delete-hook
10455 'delete ghead gnus-newsgroup-name nil
10457 (setq articles (cdr articles))))
10459 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10460 (gnus-summary-position-point)
10461 (gnus-set-mode-line 'summary)
10464 (defun gnus-summary-edit-article (&optional arg)
10465 "Edit the current article.
10466 This will have permanent effect only in mail groups.
10467 If ARG is nil, edit the decoded articles.
10468 If ARG is 1, edit the raw articles.
10469 If ARG is 2, edit the raw articles even in read-only groups.
10470 If ARG is 3, edit the articles with the current handles.
10471 Otherwise, allow editing of articles even in read-only
10474 (let (force raw current-handles)
10483 (setq current-handles
10484 (and (gnus-buffer-live-p gnus-article-buffer)
10485 (with-current-buffer gnus-article-buffer
10487 gnus-article-mime-handles
10488 (setq gnus-article-mime-handles nil))))))
10491 (when (and raw (not force)
10492 (member gnus-newsgroup-name '("nndraft:delayed"
10495 (error "Can't edit the raw article in group %s"
10496 gnus-newsgroup-name))
10497 (with-current-buffer gnus-summary-buffer
10498 (let ((mail-parse-charset gnus-newsgroup-charset)
10499 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
10500 (gnus-set-global-variables)
10501 (when (and (not force)
10502 (gnus-group-read-only-p))
10503 (error "The current newsgroup does not support article editing"))
10504 (gnus-summary-show-article t)
10505 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
10506 (with-current-buffer gnus-article-buffer
10507 (mm-enable-multibyte)))
10508 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10510 (gnus-article-edit-article
10513 (let ((mbl mml-buffer-list))
10514 (setq mml-buffer-list nil)
10515 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10516 (mime-to-mml ,'current-handles))
10517 (let ((mbl1 mml-buffer-list))
10518 (setq mml-buffer-list mbl)
10519 (set (make-local-variable 'mml-buffer-list) mbl1))
10520 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10521 `(lambda (no-highlight)
10522 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10523 (message-options message-options)
10524 (message-options-set-recipient)
10525 (mail-parse-ignored-charsets
10526 ',gnus-newsgroup-ignored-charsets)
10527 (rfc2047-header-encoding-alist
10528 ',(let ((charset (gnus-group-name-charset
10529 (gnus-find-method-for-group
10530 gnus-newsgroup-name)
10531 gnus-newsgroup-name)))
10532 (append (list (cons "Newsgroups" charset)
10533 (cons "Followup-To" charset)
10534 (cons "Xref" charset))
10535 rfc2047-header-encoding-alist))))
10536 ,(if (not raw) '(progn
10538 (mml-destroy-buffers)
10539 (remove-hook 'kill-buffer-hook
10540 'mml-destroy-buffers t)
10541 (kill-local-variable 'mml-buffer-list)))
10542 (gnus-summary-edit-article-done
10543 ,(or (mail-header-references gnus-current-headers) "")
10544 ,(gnus-group-read-only-p)
10545 ,gnus-summary-buffer no-highlight))))))))
10547 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10549 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10551 "Make edits to the current article permanent."
10554 ;; The buffer restriction contains the entire article if it exists.
10555 (when (article-goto-body)
10556 (let ((lines (count-lines (point) (point-max)))
10557 (length (- (point-max) (point)))
10558 (case-fold-search t)
10559 (body (point-marker)))
10560 (goto-char (point-min))
10561 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10562 (delete-region (match-beginning 1) (match-end 1))
10563 (insert (number-to-string length)))
10564 (goto-char (point-min))
10565 (when (re-search-forward
10566 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10567 (delete-region (match-beginning 1) (match-end 1))
10568 (insert (number-to-string length)))
10569 (goto-char (point-min))
10570 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10571 (delete-region (match-beginning 1) (match-end 1))
10572 (insert (number-to-string lines))))))
10573 ;; Replace the article.
10574 (let ((buf (current-buffer))
10575 (article (cdr gnus-article-current))
10578 (insert-buffer-substring buf)
10579 (if (and (not read-only)
10580 (not (setq replace-result
10581 (gnus-request-replace-article
10582 article (car gnus-article-current)
10583 (current-buffer) t))))
10584 (error "Couldn't replace article")
10585 ;; If we got a number back, then that's the new article number
10586 ;; for this article. Otherwise, the article number didn't change.
10587 (when (numberp replace-result)
10588 (with-current-buffer gnus-summary-buffer
10589 (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
10590 (gnus-summary-limit gnus-newsgroup-limit)
10591 (setq article replace-result)
10592 (gnus-summary-goto-subject article t)))
10593 ;; Update the summary buffer.
10594 (if (and references
10595 (equal (message-tokenize-header references " ")
10596 (message-tokenize-header
10597 (or (message-fetch-field "references") "") " ")))
10598 ;; We only have to update this line.
10601 (message-narrow-to-head)
10602 (let ((head (buffer-substring-no-properties
10603 (point-min) (point-max)))
10606 (insert (format "211 %d Article retrieved.\n" article))
10609 (let ((nntp-server-buffer (current-buffer)))
10610 (setq header (car (gnus-get-newsgroup-headers nil t))))
10611 (with-current-buffer gnus-summary-buffer
10612 (gnus-data-set-header (gnus-data-find article) header)
10613 (gnus-summary-update-article-line article header)
10614 (if (gnus-summary-goto-subject article nil t)
10615 (gnus-summary-update-secondary-mark article)))))))
10617 (set-buffer (or buffer gnus-summary-buffer))
10618 (gnus-summary-update-article article)
10619 (if (gnus-summary-goto-subject article nil t)
10620 (gnus-summary-update-secondary-mark article)))
10621 ;; Prettify the article buffer again.
10622 (unless no-highlight
10623 (with-current-buffer gnus-article-buffer
10624 ;;!!! Fix this -- article should be rehighlighted.
10625 ;;(gnus-run-hooks 'gnus-article-display-hook)
10626 (set-buffer gnus-original-article-buffer)
10627 (gnus-request-article
10628 article (car gnus-article-current) (current-buffer))))
10629 ;; Prettify the summary buffer line.
10630 (when (gnus-visual-p 'summary-highlight 'highlight)
10631 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10633 (defun gnus-summary-edit-wash (key)
10634 "Perform editing command KEY in the article buffer."
10638 (message "%s" (concat (this-command-keys) "- "))
10641 (gnus-summary-edit-article)
10642 (execute-kbd-macro (concat (this-command-keys) key))
10643 (gnus-article-edit-done))
10647 (defvar nnimap-split-fancy)
10648 (defvar nnimap-split-methods)
10650 (defun gnus-summary-respool-query (&optional silent trace)
10651 "Query where the respool algorithm would put this article."
10653 (let (gnus-mark-article-hook)
10654 (gnus-summary-select-article)
10655 (with-current-buffer gnus-original-article-buffer
10657 (if (eq (car (gnus-find-method-for-group gnus-newsgroup-name))
10659 ;; nnimap has its own splitting variables.
10660 (let ((nnmail-split-methods
10662 ((eq nnimap-split-methods 'default)
10663 nnmail-split-methods)
10664 (nnimap-split-methods
10665 nnimap-split-methods)
10666 (nnimap-split-fancy
10667 'nnmail-split-fancy)))
10668 (nnmail-split-fancy (or nnimap-split-fancy
10669 nnmail-split-fancy)))
10670 (nnmail-article-group 'identity trace))
10671 (nnmail-article-group 'identity trace))))
10674 (message "This message would go to %s"
10675 (mapconcat 'car groups ", "))
10676 (message "This message would go to no groups"))
10679 (defun gnus-summary-respool-trace ()
10680 "Trace where the respool algorithm would put this article.
10681 Display a buffer showing all fancy splitting patterns which matched."
10683 (gnus-summary-respool-query nil t))
10685 ;; Summary marking commands.
10687 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10688 "Mark articles which has the same subject as read, and then select the next.
10689 If UNMARK is positive, remove any kind of mark.
10690 If UNMARK is negative, tick articles."
10693 (setq unmark (prefix-numeric-value unmark)))
10695 (gnus-summary-mark-same-subject
10696 (gnus-summary-article-subject) unmark)))
10697 ;; Select next unread article. If auto-select-same mode, should
10698 ;; select the first unread article.
10699 (gnus-summary-next-article t (and gnus-auto-select-same
10700 (gnus-summary-article-subject)))
10701 (gnus-message 7 "%d article%s marked as %s"
10702 count (if (= count 1) " is" "s are")
10703 (if unmark "unread" "read"))))
10705 (defun gnus-summary-kill-same-subject (&optional unmark)
10706 "Mark articles which has the same subject as read.
10707 If UNMARK is positive, remove any kind of mark.
10708 If UNMARK is negative, tick articles."
10711 (setq unmark (prefix-numeric-value unmark)))
10713 (gnus-summary-mark-same-subject
10714 (gnus-summary-article-subject) unmark)))
10715 ;; If marked as read, go to next unread subject.
10716 (when (null unmark)
10717 ;; Go to next unread subject.
10718 (gnus-summary-next-subject 1 t))
10719 (gnus-message 7 "%d articles are marked as %s"
10720 count (if unmark "unread" "read"))))
10722 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10723 "Mark articles with same SUBJECT as read, and return marked number.
10724 If optional argument UNMARK is positive, remove any kinds of marks.
10725 If optional argument UNMARK is negative, mark articles as unread instead."
10729 ((null unmark) ; Mark as read.
10732 (gnus-summary-mark-article-as-read gnus-killed-mark)
10733 (gnus-summary-show-thread) t)
10734 (gnus-summary-find-subject subject))
10735 (setq count (1+ count))))
10736 ((> unmark 0) ; Tick.
10739 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10740 (gnus-summary-show-thread) t)
10741 (gnus-summary-find-subject subject))
10742 (setq count (1+ count))))
10743 (t ; Mark as unread.
10746 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10747 (gnus-summary-show-thread) t)
10748 (gnus-summary-find-subject subject))
10749 (setq count (1+ count)))))
10750 (gnus-set-mode-line 'summary)
10751 ;; Return the number of marked articles.
10754 (defun gnus-summary-mark-as-processable (n &optional unmark)
10755 "Set the process mark on the next N articles.
10756 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10757 the process mark instead. The difference between N and the actual
10758 number of articles marked is returned."
10760 (if (and (null n) (and transient-mark-mode mark-active))
10761 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10762 (setq n (prefix-numeric-value n))
10763 (let ((backward (< n 0))
10768 (gnus-summary-remove-process-mark
10769 (gnus-summary-article-number))
10770 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10771 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10774 (gnus-message 7 "No more articles"))
10775 (gnus-summary-recenter)
10776 (gnus-summary-position-point)
10779 (defun gnus-summary-unmark-as-processable (n)
10780 "Remove the process mark from the next N articles.
10781 If N is negative, unmark backward instead. The difference between N and
10782 the actual number of articles unmarked is returned."
10784 (gnus-summary-mark-as-processable n t))
10786 (defun gnus-summary-unmark-all-processable ()
10787 "Remove the process mark from all articles."
10790 (while gnus-newsgroup-processable
10791 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10792 (gnus-summary-position-point))
10794 (defun gnus-summary-add-mark (article type)
10795 "Mark ARTICLE with a mark of TYPE."
10796 (let ((vtype (car (assq type gnus-article-mark-lists)))
10799 (error "No such mark type: %s" type)
10800 (setq var (intern (format "gnus-newsgroup-%s" type)))
10801 (set var (cons article (symbol-value var)))
10802 (if (memq type '(processable cached replied forwarded recent saved))
10803 (gnus-summary-update-secondary-mark article)
10804 ;;; !!! This is bogus. We should find out what primary
10805 ;;; !!! mark we want to set.
10806 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10808 (defun gnus-summary-mark-as-expirable (n)
10809 "Mark N articles forward as expirable.
10810 If N is negative, mark backward instead. The difference between N and
10811 the actual number of articles marked is returned."
10813 (gnus-summary-mark-forward n gnus-expirable-mark))
10815 (defun gnus-summary-mark-as-spam (n)
10816 "Mark N articles forward as spam.
10817 If N is negative, mark backward instead. The difference between N and
10818 the actual number of articles marked is returned."
10820 (gnus-summary-mark-forward n gnus-spam-mark))
10822 (defun gnus-summary-mark-article-as-replied (article)
10823 "Mark ARTICLE as replied to and update the summary line.
10824 ARTICLE can also be a list of articles."
10825 (interactive (list (gnus-summary-article-number)))
10826 (let ((articles (if (listp article) article (list article))))
10827 (dolist (article articles)
10828 (unless (numberp article)
10829 (error "%s is not a number" article))
10830 (push article gnus-newsgroup-replied)
10831 (let ((inhibit-read-only t))
10832 (when (gnus-summary-goto-subject article nil t)
10833 (gnus-summary-update-secondary-mark article))))))
10835 (defun gnus-summary-mark-article-as-forwarded (article)
10836 "Mark ARTICLE as forwarded and update the summary line.
10837 ARTICLE can also be a list of articles."
10838 (let ((articles (if (listp article) article (list article))))
10839 (dolist (article articles)
10840 (push article gnus-newsgroup-forwarded)
10841 (let ((inhibit-read-only t))
10842 (when (gnus-summary-goto-subject article nil t)
10843 (gnus-summary-update-secondary-mark article))))))
10845 (defun gnus-summary-set-bookmark (article)
10846 "Set a bookmark in current article."
10847 (interactive (list (gnus-summary-article-number)))
10848 (when (or (not (get-buffer gnus-article-buffer))
10849 (not gnus-current-article)
10850 (not gnus-article-current)
10851 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10852 (error "No current article selected"))
10853 ;; Remove old bookmark, if one exists.
10854 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10855 ;; Set the new bookmark, which is on the form
10856 ;; (article-number . line-number-in-body).
10859 (with-current-buffer gnus-article-buffer
10863 (article-goto-body)
10866 gnus-newsgroup-bookmarks)
10867 (gnus-message 6 "A bookmark has been added to the current article."))
10869 (defun gnus-summary-remove-bookmark (article)
10870 "Remove the bookmark from the current article."
10871 (interactive (list (gnus-summary-article-number)))
10872 ;; Remove old bookmark, if one exists.
10873 (if (not (assq article gnus-newsgroup-bookmarks))
10874 (gnus-message 6 "No bookmark in current article.")
10875 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10876 (gnus-message 6 "Removed bookmark.")))
10878 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10879 (defun gnus-summary-mark-as-dormant (n)
10880 "Mark N articles forward as dormant.
10881 If N is negative, mark backward instead. The difference between N and
10882 the actual number of articles marked is returned."
10884 (gnus-summary-mark-forward n gnus-dormant-mark))
10886 (defun gnus-summary-set-process-mark (article)
10887 "Set the process mark on ARTICLE and update the summary line."
10888 (setq gnus-newsgroup-processable
10890 (delq article gnus-newsgroup-processable)))
10891 (when (gnus-summary-goto-subject article)
10892 (gnus-summary-show-thread)
10893 (gnus-summary-goto-subject article)
10894 (gnus-summary-update-secondary-mark article)))
10896 (defun gnus-summary-remove-process-mark (&rest articles)
10897 "Remove the process mark from ARTICLES and update the summary line."
10898 (dolist (article articles)
10899 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10900 (when (gnus-summary-goto-subject article)
10901 (gnus-summary-show-thread)
10902 (gnus-summary-goto-subject article)
10903 (gnus-summary-update-secondary-mark article)))
10906 (defun gnus-summary-set-saved-mark (article)
10907 "Set the process mark on ARTICLE and update the summary line."
10908 (push article gnus-newsgroup-saved)
10909 (when (gnus-summary-goto-subject article)
10910 (gnus-summary-update-secondary-mark article)))
10912 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10913 "Mark N articles as read forwards.
10914 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10915 The difference between N and the actual number of articles marked is
10917 If NO-EXPIRE, auto-expiry will be inhibited."
10919 (gnus-summary-show-thread)
10920 (let ((backward (< n 0))
10921 (gnus-summary-goto-unread
10922 (and gnus-summary-goto-unread
10923 (not (eq gnus-summary-goto-unread 'never))
10924 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10925 gnus-ticked-mark gnus-dormant-mark)))))
10927 (mark (or mark gnus-del-mark)))
10928 (while (and (> n 0)
10929 (gnus-summary-mark-article nil mark no-expire)
10930 (zerop (gnus-summary-next-subject
10932 (and gnus-summary-goto-unread
10933 (not (eq gnus-summary-goto-unread 'never)))
10937 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10938 (gnus-summary-recenter)
10939 (gnus-summary-position-point)
10940 (gnus-set-mode-line 'summary)
10943 (defun gnus-summary-mark-article-as-read (mark)
10944 "Mark the current article quickly as read with MARK."
10945 (let ((article (gnus-summary-article-number)))
10946 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10947 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10948 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10949 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10950 (push (cons article mark) gnus-newsgroup-reads)
10951 ;; Possibly remove from cache, if that is used.
10952 (when gnus-use-cache
10953 (gnus-cache-enter-remove-article article))
10954 ;; Allow the backend to change the mark.
10955 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10956 ;; Check for auto-expiry.
10957 (when (and gnus-newsgroup-auto-expire
10958 (memq mark gnus-auto-expirable-marks))
10959 (setq mark gnus-expirable-mark)
10960 ;; Let the backend know about the mark change.
10961 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10962 (push article gnus-newsgroup-expirable))
10963 ;; Set the mark in the buffer.
10964 (gnus-summary-update-mark mark 'unread)
10967 (defun gnus-summary-mark-article-as-unread (mark)
10968 "Mark the current article quickly as unread with MARK."
10969 (let* ((article (gnus-summary-article-number))
10970 (old-mark (gnus-summary-article-mark article)))
10971 ;; Allow the backend to change the mark.
10972 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10973 (if (eq mark old-mark)
10977 (gnus-error 1 "Can't mark negative article numbers")
10979 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10980 (setq gnus-newsgroup-spam-marked
10981 (delq article gnus-newsgroup-spam-marked))
10982 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10983 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10984 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10985 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10986 (cond ((= mark gnus-ticked-mark)
10987 (setq gnus-newsgroup-marked
10988 (gnus-add-to-sorted-list gnus-newsgroup-marked
10990 ((= mark gnus-spam-mark)
10991 (setq gnus-newsgroup-spam-marked
10992 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10994 ((= mark gnus-dormant-mark)
10995 (setq gnus-newsgroup-dormant
10996 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10999 (setq gnus-newsgroup-unreads
11000 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11002 (gnus-alist-pull article gnus-newsgroup-reads)
11004 ;; See whether the article is to be put in the cache.
11005 (and gnus-use-cache
11006 (vectorp (gnus-summary-article-header article))
11008 (gnus-cache-possibly-enter-article
11009 gnus-newsgroup-name article
11010 (= mark gnus-ticked-mark)
11011 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
11014 (gnus-summary-update-mark mark 'unread)
11017 (defun gnus-summary-mark-article (&optional article mark no-expire)
11018 "Mark ARTICLE with MARK. MARK can be any character.
11019 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
11020 `??' (dormant) and `?E' (expirable).
11021 If MARK is nil, then the default character `?r' is used.
11022 If ARTICLE is nil, then the article on the current line will be
11024 If NO-EXPIRE, auto-expiry will be inhibited."
11025 ;; The mark might be a string.
11026 (when (stringp mark)
11027 (setq mark (aref mark 0)))
11028 ;; If no mark is given, then we check auto-expiring.
11030 (setq mark gnus-del-mark))
11031 (when (and (not no-expire)
11032 gnus-newsgroup-auto-expire
11033 (memq mark gnus-auto-expirable-marks))
11034 (setq mark gnus-expirable-mark))
11035 (let ((article (or article (gnus-summary-article-number)))
11036 (old-mark (gnus-summary-article-mark article)))
11037 ;; Allow the backend to change the mark.
11038 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
11039 (if (eq mark old-mark)
11042 (error "No article on current line"))
11043 (if (not (if (or (= mark gnus-unread-mark)
11044 (= mark gnus-ticked-mark)
11045 (= mark gnus-spam-mark)
11046 (= mark gnus-dormant-mark))
11047 (gnus-mark-article-as-unread article mark)
11048 (gnus-mark-article-as-read article mark)))
11050 ;; See whether the article is to be put in the cache.
11051 (and gnus-use-cache
11052 (not (= mark gnus-canceled-mark))
11053 (vectorp (gnus-summary-article-header article))
11055 (gnus-cache-possibly-enter-article
11056 gnus-newsgroup-name article
11057 (= mark gnus-ticked-mark)
11058 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
11060 (when (gnus-summary-goto-subject article nil t)
11061 (let ((inhibit-read-only t))
11062 (gnus-summary-show-thread)
11064 (gnus-summary-update-mark mark 'unread)
11067 (defun gnus-summary-update-secondary-mark (article)
11068 "Update the secondary (read, process, cache) mark."
11069 (gnus-summary-update-mark
11070 (cond ((memq article gnus-newsgroup-processable)
11072 ((memq article gnus-newsgroup-cached)
11074 ((memq article gnus-newsgroup-replied)
11076 ((memq article gnus-newsgroup-forwarded)
11077 gnus-forwarded-mark)
11078 ((memq article gnus-newsgroup-saved)
11080 ((memq article gnus-newsgroup-unseen)
11084 (when (gnus-visual-p 'summary-highlight 'highlight)
11085 (gnus-summary-highlight-line)
11086 (gnus-run-hooks 'gnus-summary-update-hook))
11089 (defun gnus-summary-update-download-mark (article)
11090 "Update the download mark."
11091 (gnus-summary-update-mark
11092 (cond ((memq article gnus-newsgroup-undownloaded)
11093 gnus-undownloaded-mark)
11094 (gnus-newsgroup-agentized
11095 gnus-downloaded-mark)
11099 (gnus-summary-update-line t)
11102 (defun gnus-summary-update-mark (mark type)
11103 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
11104 (inhibit-read-only t))
11105 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
11107 (when (looking-at "\r")
11109 (when (<= (+ forward (point)) (point-max))
11110 ;; Go to the right position on the line.
11111 (goto-char (+ forward (point)))
11112 ;; Replace the old mark with the new mark.
11114 (subst-char-in-string
11116 (buffer-substring (point) (1+ (point))))))
11117 (delete-region (point) (1+ (point)))
11118 (insert to-insert))
11119 ;; Optionally update the marks by some user rule.
11120 (when (eq type 'unread)
11121 (gnus-data-set-mark
11122 (gnus-data-find (gnus-summary-article-number)) mark)
11123 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
11125 (defun gnus-mark-article-as-read (article &optional mark)
11126 "Enter ARTICLE in the pertinent lists and remove it from others."
11127 ;; Make the article expirable.
11128 (let ((mark (or mark gnus-del-mark)))
11129 (setq gnus-newsgroup-expirable
11130 (if (= mark gnus-expirable-mark)
11131 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
11132 (delq article gnus-newsgroup-expirable)))
11133 ;; Remove from unread and marked lists.
11134 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11135 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
11136 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
11137 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
11138 (push (cons article mark) gnus-newsgroup-reads)
11139 ;; Possibly remove from cache, if that is used.
11140 (when gnus-use-cache
11141 (gnus-cache-enter-remove-article article))
11144 (defun gnus-mark-article-as-unread (article &optional mark)
11145 "Enter ARTICLE in the pertinent lists and remove it from others."
11146 (let ((mark (or mark gnus-ticked-mark)))
11149 (gnus-error 1 "Can't mark negative article numbers")
11151 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
11152 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
11153 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
11154 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
11155 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11157 ;; Unsuppress duplicates?
11158 (when gnus-suppress-duplicates
11159 (gnus-dup-unsuppress-article article))
11161 (cond ((= mark gnus-ticked-mark)
11162 (setq gnus-newsgroup-marked
11163 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
11164 ((= mark gnus-spam-mark)
11165 (setq gnus-newsgroup-spam-marked
11166 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
11168 ((= mark gnus-dormant-mark)
11169 (setq gnus-newsgroup-dormant
11170 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
11172 (setq gnus-newsgroup-unreads
11173 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
11174 (gnus-alist-pull article gnus-newsgroup-reads)
11177 (defun gnus-summary-tick-article-forward (n)
11178 "Tick N articles forwards.
11179 If N is negative, tick backwards instead.
11180 The difference between N and the number of articles ticked is returned."
11182 (gnus-summary-mark-forward n gnus-ticked-mark))
11184 (defun gnus-summary-tick-article-backward (n)
11185 "Tick N articles backwards.
11186 The difference between N and the number of articles ticked is returned."
11188 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
11190 (defun gnus-summary-tick-article (&optional article clear-mark)
11191 "Mark current article as unread.
11192 Optional 1st argument ARTICLE specifies article number to be marked as unread.
11193 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
11195 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
11196 gnus-ticked-mark)))
11198 (defun gnus-summary-mark-as-read-forward (n)
11199 "Mark N articles as read forwards.
11200 If N is negative, mark backwards instead.
11201 The difference between N and the actual number of articles marked is
11204 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
11206 (defun gnus-summary-mark-as-read-backward (n)
11207 "Mark the N articles as read backwards.
11208 The difference between N and the actual number of articles marked is
11211 (gnus-summary-mark-forward
11212 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
11214 (defun gnus-summary-mark-as-read (&optional article mark)
11215 "Mark current article as read.
11216 ARTICLE specifies the article to be marked as read.
11217 MARK specifies a string to be inserted at the beginning of the line."
11218 (gnus-summary-mark-article article mark))
11220 (defun gnus-summary-clear-mark-forward (n)
11221 "Clear marks from N articles forward.
11222 If N is negative, clear backward instead.
11223 The difference between N and the number of marks cleared is returned."
11225 (gnus-summary-mark-forward n gnus-unread-mark))
11227 (defun gnus-summary-clear-mark-backward (n)
11228 "Clear marks from N articles backward.
11229 The difference between N and the number of marks cleared is returned."
11231 (gnus-summary-mark-forward (- n) gnus-unread-mark))
11233 (defun gnus-summary-mark-unread-as-read ()
11234 "Intended to be used by `gnus-mark-article-hook'."
11235 (when (memq gnus-current-article gnus-newsgroup-unreads)
11236 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
11238 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
11239 "Intended to be used by `gnus-mark-article-hook'."
11240 (let ((mark (gnus-summary-article-mark)))
11241 (when (or (gnus-unread-mark-p mark)
11242 (gnus-read-mark-p mark))
11243 (gnus-summary-mark-article gnus-current-article
11244 (or new-mark gnus-read-mark)))))
11246 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
11247 "Intended to be used by `gnus-mark-article-hook'."
11248 (let ((mark (gnus-summary-article-mark)))
11249 (when (or (gnus-unread-mark-p mark)
11250 (gnus-read-mark-p mark))
11251 (gnus-summary-mark-article (gnus-summary-article-number)
11252 (or new-mark gnus-read-mark)))))
11254 (defun gnus-summary-mark-unread-as-ticked ()
11255 "Intended to be used by `gnus-mark-article-hook'."
11256 (when (memq gnus-current-article gnus-newsgroup-unreads)
11257 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
11259 (defun gnus-summary-mark-region-as-read (point mark all)
11260 "Mark all unread articles between point and mark as read.
11261 If given a prefix, mark all articles between point and mark as read,
11262 even ticked and dormant ones."
11263 (interactive "r\nP")
11267 (beginning-of-line)
11272 (memq (setq article (gnus-summary-article-number))
11273 gnus-newsgroup-unreads))
11274 (gnus-summary-mark-article article gnus-del-mark))
11276 (gnus-summary-find-next))))))
11278 (defun gnus-summary-mark-below (score mark)
11279 "Mark articles with score less than SCORE with MARK."
11280 (interactive "P\ncMark: ")
11281 (setq score (if score
11282 (prefix-numeric-value score)
11283 (or gnus-summary-default-score 0)))
11284 (with-current-buffer gnus-summary-buffer
11285 (goto-char (point-min))
11288 (and (< (gnus-summary-article-score) score)
11289 (gnus-summary-mark-article nil mark))
11290 (gnus-summary-find-next)))))
11292 (defun gnus-summary-kill-below (&optional score)
11293 "Mark articles with score below SCORE as read."
11295 (gnus-summary-mark-below score gnus-killed-mark))
11297 (defun gnus-summary-clear-above (&optional score)
11298 "Clear all marks from articles with score above SCORE."
11300 (gnus-summary-mark-above score gnus-unread-mark))
11302 (defun gnus-summary-tick-above (&optional score)
11303 "Tick all articles with score above SCORE."
11305 (gnus-summary-mark-above score gnus-ticked-mark))
11307 (defun gnus-summary-mark-above (score mark)
11308 "Mark articles with score over SCORE with MARK."
11309 (interactive "P\ncMark: ")
11310 (setq score (if score
11311 (prefix-numeric-value score)
11312 (or gnus-summary-default-score 0)))
11313 (with-current-buffer gnus-summary-buffer
11314 (goto-char (point-min))
11316 (when (> (gnus-summary-article-score) score)
11317 (gnus-summary-mark-article nil mark))
11319 (gnus-summary-find-next)))))
11321 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
11322 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
11323 (defun gnus-summary-limit-include-expunged (&optional no-error)
11324 "Display all the hidden articles that were expunged for low scores."
11326 (let ((inhibit-read-only t))
11327 (let ((scored gnus-newsgroup-scored)
11330 (unless (gnus-summary-article-header (caar scored))
11331 (and (setq h (gnus-number-to-header (caar scored)))
11332 (< (cdar scored) gnus-summary-expunge-below)
11334 (setq scored (cdr scored)))
11336 (when (not no-error)
11337 (error "No expunged articles hidden"))
11338 (goto-char (point-min))
11339 (push gnus-newsgroup-limit gnus-newsgroup-limits)
11340 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
11341 (dolist (x headers)
11342 (push (mail-header-number x) gnus-newsgroup-limit))
11343 (gnus-summary-prepare-unthreaded (nreverse headers))
11344 (goto-char (point-min))
11345 (gnus-summary-position-point)
11348 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
11349 "Mark all unread articles in this newsgroup as read.
11350 If prefix argument ALL is non-nil, ticked and dormant articles will
11351 also be marked as read.
11352 If QUIETLY is non-nil, no questions will be asked.
11354 If TO-HERE is non-nil, it should be a point in the buffer. All
11355 articles before (after, if REVERSE is set) this point will be marked
11358 Note that this function will only catch up the unread article
11359 in the current summary buffer limitation.
11361 The number of articles marked as read is returned."
11366 (not gnus-interactive-catchup) ;Without confirmation?
11370 "Mark absolutely all articles as read? "
11371 "Mark all unread articles as read? ")))
11373 (not gnus-newsgroup-adaptive)
11374 (not gnus-newsgroup-auto-expire)
11375 (not gnus-suppress-duplicates)
11376 (or (not gnus-use-cache)
11377 (eq gnus-use-cache 'passive)))
11380 (setq gnus-newsgroup-marked nil
11381 gnus-newsgroup-spam-marked nil
11382 gnus-newsgroup-dormant nil))
11383 (setq gnus-newsgroup-unreads
11384 (gnus-sorted-nunion
11385 (gnus-sorted-intersection gnus-newsgroup-unreads
11386 gnus-newsgroup-downloadable)
11387 (gnus-sorted-difference gnus-newsgroup-unfetched
11388 gnus-newsgroup-cached))))
11389 ;; We actually mark all articles as canceled, which we
11390 ;; have to do when using auto-expiry or adaptive scoring.
11391 (gnus-summary-show-all-threads)
11392 (if (and to-here reverse)
11394 (goto-char to-here)
11395 (gnus-summary-mark-current-read-and-unread-as-read
11397 (while (gnus-summary-find-next (not all))
11398 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
11399 (when (gnus-summary-first-subject (not all))
11401 (if to-here (< (point) to-here) t)
11402 (gnus-summary-mark-article-as-read gnus-catchup-mark)
11403 (gnus-summary-find-next (not all))))))
11404 (gnus-set-mode-line 'summary))
11406 (gnus-summary-position-point)))
11408 (defun gnus-summary-catchup-to-here (&optional all)
11409 "Mark all unticked articles before the current one as read.
11410 If ALL is non-nil, also mark ticked and dormant articles as read."
11413 (gnus-save-hidden-threads
11414 (let ((beg (point)))
11415 ;; We check that there are unread articles.
11416 (when (or all (gnus-summary-find-prev))
11417 (gnus-summary-catchup all t beg)))))
11418 (gnus-summary-position-point))
11420 (defun gnus-summary-catchup-from-here (&optional all)
11421 "Mark all unticked articles after (and including) the current one as read.
11422 If ALL is non-nil, also mark ticked and dormant articles as read."
11425 (gnus-save-hidden-threads
11426 (let ((beg (point)))
11427 ;; We check that there are unread articles.
11428 (when (or all (gnus-summary-find-next))
11429 (gnus-summary-catchup all t beg nil t)))))
11430 (gnus-summary-position-point))
11432 (defun gnus-summary-catchup-all (&optional quietly)
11433 "Mark all articles in this newsgroup as read.
11434 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11435 instead, which marks only unread articles as read."
11437 (gnus-summary-catchup t quietly))
11439 (defun gnus-summary-catchup-and-exit (&optional all quietly)
11440 "Mark all unread articles in this group as read, then exit.
11441 If prefix argument ALL is non-nil, all articles are marked as read.
11442 If QUIETLY is non-nil, no questions will be asked."
11444 (when (gnus-summary-catchup all quietly nil 'fast)
11445 ;; Select next newsgroup or exit.
11446 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
11447 (eq gnus-auto-select-next 'quietly))
11448 (gnus-summary-next-group nil)
11449 (gnus-summary-exit))))
11451 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
11452 "Mark all articles in this newsgroup as read, and then exit.
11453 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11454 instead, which marks only unread articles as read."
11456 (gnus-summary-catchup-and-exit t quietly))
11458 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
11459 "Mark all articles in this group as read and select the next group.
11460 If given a prefix, mark all articles, unread as well as ticked, as
11464 (gnus-summary-catchup all))
11465 (gnus-summary-next-group))
11467 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
11468 "Mark all articles in this group as read and select the previous group.
11469 If given a prefix, mark all articles, unread as well as ticked, as
11473 (gnus-summary-catchup all))
11474 (gnus-summary-next-group nil nil t))
11480 (defmacro gnus-with-article (article &rest forms)
11481 "Select ARTICLE and perform FORMS in the original article buffer.
11482 Then replace the article with the result."
11484 ;; We don't want the article to be marked as read.
11485 (let (gnus-mark-article-hook)
11486 (gnus-summary-select-article t t nil ,article))
11487 (set-buffer gnus-original-article-buffer)
11489 (if (not (gnus-check-backend-function
11490 'request-replace-article (car gnus-article-current)))
11491 (gnus-message 5 "Read-only group; not replacing")
11492 (unless (gnus-request-replace-article
11493 ,article (car gnus-article-current)
11494 (current-buffer) t)
11495 (error "Couldn't replace article")))
11496 ;; The cache and backlog have to be flushed somewhat.
11497 (when gnus-keep-backlog
11498 (gnus-backlog-remove-article
11499 (car gnus-article-current) (cdr gnus-article-current)))
11500 (when gnus-use-cache
11501 (gnus-cache-update-article
11502 (car gnus-article-current) (cdr gnus-article-current)))))
11504 (put 'gnus-with-article 'lisp-indent-function 1)
11505 (put 'gnus-with-article 'edebug-form-spec '(form body))
11507 ;; Thread-based commands.
11509 (defun gnus-summary-articles-in-thread (&optional article)
11510 "Return a list of all articles in the current thread.
11511 If ARTICLE is non-nil, return all articles in the thread that starts
11512 with that article."
11513 (let* ((article (or article (gnus-summary-article-number)))
11514 (data (gnus-data-find-list article))
11515 (top-level (gnus-data-level (car data)))
11517 (cond ((null gnus-thread-operation-ignore-subject)
11518 (gnus-simplify-subject-re
11519 (mail-header-subject (gnus-data-header (car data)))))
11520 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
11521 (gnus-simplify-subject-fuzzy
11522 (mail-header-subject (gnus-data-header (car data)))))
11524 (end-point (save-excursion
11525 (goto-char (gnus-data-pos (car data)))
11526 (if (gnus-summary-go-to-next-thread)
11527 (point) (point-max))))
11530 (< (gnus-data-pos (car data)) end-point))
11531 (when (or (not top-subject)
11532 (string= top-subject
11533 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11534 (gnus-simplify-subject-fuzzy
11535 (mail-header-subject
11536 (gnus-data-header (car data))))
11537 (gnus-simplify-subject-re
11538 (mail-header-subject
11539 (gnus-data-header (car data)))))))
11540 (push (gnus-data-number (car data)) articles))
11541 (unless (and (setq data (cdr data))
11542 (> (gnus-data-level (car data)) top-level))
11544 ;; Return the list of articles.
11545 (nreverse articles)))
11547 (defun gnus-summary-rethread-current ()
11548 "Rethread the thread the current article is part of."
11550 (let* ((gnus-show-threads t)
11551 (article (gnus-summary-article-number))
11552 (id (mail-header-id (gnus-summary-article-header)))
11553 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11555 (error "No article on the current line"))
11556 (gnus-rebuild-thread id)
11557 (gnus-summary-goto-subject article)))
11559 (defun gnus-summary-reparent-thread ()
11560 "Make the current article child of the marked (or previous) article.
11562 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11563 is non-nil or the Subject: of both articles are the same."
11565 (unless (not (gnus-group-read-only-p))
11566 (error "The current newsgroup does not support article editing"))
11567 (unless (<= (length gnus-newsgroup-processable) 1)
11568 (error "No more than one article may be marked"))
11569 (let ((child (gnus-summary-article-number))
11570 ;; First grab the marked article, otherwise one line up.
11571 (parent (if (not (null gnus-newsgroup-processable))
11572 (car gnus-newsgroup-processable)
11574 (if (eq (forward-line -1) 0)
11575 (gnus-summary-article-number)
11576 (error "Beginning of summary buffer"))))))
11577 (gnus-summary-reparent-children parent (list child))))
11579 (defun gnus-summary-reparent-children (parent children)
11580 "Make PARENT the parent of CHILDREN.
11581 When called interactively, PARENT is the current article and CHILDREN
11582 are the process-marked articles."
11584 (list (gnus-summary-article-number)
11585 (gnus-summary-work-articles nil)))
11586 (dolist (child children)
11587 (save-window-excursion
11588 (let ((gnus-article-buffer " *reparent*"))
11589 (unless (not (eq parent child))
11590 (error "An article may not be self-referential"))
11591 (let ((message-id (mail-header-id
11592 (gnus-summary-article-header parent))))
11593 (unless (and message-id (not (equal message-id "")))
11594 (error "No message-id in desired parent"))
11595 (gnus-with-article child
11597 (goto-char (point-min))
11598 (message-narrow-to-head)
11599 (if (re-search-forward "^References: " nil t)
11601 (re-search-forward "^[^ \t]" nil t)
11604 (insert " " message-id))
11605 (insert "References: " message-id "\n"))))
11606 (set-buffer gnus-summary-buffer)
11607 (gnus-summary-unmark-all-processable)
11608 (gnus-summary-update-article child)
11609 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11610 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11611 (gnus-summary-rethread-current)
11612 (gnus-message 3 "Article %d is now the child of article %d"
11615 (defun gnus-summary-toggle-threads (&optional arg)
11616 "Toggle showing conversation threads.
11617 If ARG is positive number, turn showing conversation threads on."
11619 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11620 (setq gnus-show-threads
11621 (if (null arg) (not gnus-show-threads)
11622 (> (prefix-numeric-value arg) 0)))
11623 (gnus-summary-prepare)
11624 (gnus-summary-goto-subject current)
11625 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11626 (gnus-summary-position-point)))
11628 (defun gnus-summary-show-all-threads ()
11629 "Show all threads."
11631 (remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
11632 (gnus-summary-position-point))
11634 (defsubst gnus-summary--inv (p)
11635 (and (eq (get-char-property p 'invisible) 'gnus-sum) p))
11637 (defun gnus-summary-show-thread ()
11638 "Show thread subtrees.
11639 Returns nil if no thread was there to be shown."
11641 (let* ((orig (point))
11642 (end (point-at-eol))
11643 (end (or (gnus-summary--inv end) (gnus-summary--inv (1- end))))
11644 ;; Leave point at bol
11645 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11646 (eoi (and end (next-single-char-property-change end 'invisible))))
11648 (remove-overlays beg eoi 'invisible 'gnus-sum)
11650 (gnus-summary-position-point)
11653 (defun gnus-summary-maybe-hide-threads ()
11654 "If requested, hide the threads that should be hidden."
11655 (when (and gnus-show-threads
11656 gnus-thread-hide-subtree)
11657 (gnus-summary-hide-all-threads
11658 (if (or (consp gnus-thread-hide-subtree)
11659 (functionp gnus-thread-hide-subtree))
11660 (gnus-make-predicate gnus-thread-hide-subtree)
11663 ;;; Hiding predicates.
11665 (defun gnus-article-unread-p (header)
11666 (memq (mail-header-number header) gnus-newsgroup-unreads))
11668 (defun gnus-article-unseen-p (header)
11669 (memq (mail-header-number header) gnus-newsgroup-unseen))
11671 (defun gnus-map-articles (predicate articles)
11672 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11673 (apply 'gnus-or (mapcar predicate
11674 (mapcar (lambda (number)
11675 (gnus-summary-article-header number))
11678 (defun gnus-summary-hide-all-threads (&optional predicate)
11679 "Hide all thread subtrees.
11680 If PREDICATE is supplied, threads that satisfy this predicate
11681 will not be hidden."
11684 (goto-char (point-min))
11689 (when (zerop (mod count 1000))
11690 (message "Hiding all threads... %d" count))
11691 (when (or (not predicate)
11693 predicate (gnus-summary-article-children)))
11694 (gnus-summary-hide-thread))
11695 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11696 (gnus-summary-position-point))
11698 (defun gnus-summary-hide-thread ()
11699 "Hide thread subtrees.
11700 If PREDICATE is supplied, threads that satisfy this predicate
11701 will not be hidden.
11702 Returns nil if no threads were there to be hidden."
11704 (beginning-of-line)
11705 (let ((start (point))
11706 (starteol (line-end-position))
11707 (article (gnus-summary-article-number)))
11708 ;; Go forward until either the buffer ends or the subthread ends.
11709 (when (and (not (eobp))
11710 (or (zerop (gnus-summary-next-thread 1 t))
11711 (goto-char (point-max))))
11712 (if (and (> (point) start)
11713 ;; FIXME: this should actually search for a non-invisible \n.
11714 (search-backward "\n" start t))
11716 (when (> (point) starteol)
11717 (remove-overlays starteol (point) 'invisible 'gnus-sum)
11718 (let ((ol (make-overlay starteol (point) nil t nil)))
11719 (overlay-put ol 'invisible 'gnus-sum)
11720 (overlay-put ol 'evaporate t)))
11721 (gnus-summary-goto-subject article)
11722 (when (> start (point))
11723 (message "Hiding the thread moved us backwards, aborting!")
11724 (goto-char (point-max))))
11728 (defun gnus-summary-go-to-next-thread (&optional previous)
11729 "Go to the same level (or less) next thread.
11730 If PREVIOUS is non-nil, go to previous thread instead.
11731 Return the article number moved to, or nil if moving was impossible."
11732 (let ((level (gnus-summary-thread-level))
11733 (way (if previous -1 1))
11736 (while (and (not (eobp))
11737 (< level (gnus-summary-thread-level)))
11738 (forward-line way))
11745 (gnus-summary-article-number)
11746 (goto-char beg)))))
11748 (defun gnus-summary-next-thread (n &optional silent)
11749 "Go to the same level next N'th thread.
11750 If N is negative, search backward instead.
11751 Returns the difference between N and the number of skips actually
11754 If SILENT, don't output messages."
11756 (let ((backward (< n 0))
11758 (while (and (> n 0)
11759 (gnus-summary-go-to-next-thread backward))
11762 (gnus-summary-position-point))
11763 (when (and (not silent) (/= 0 n))
11764 (gnus-message 7 "No more threads"))
11767 (defun gnus-summary-prev-thread (n)
11768 "Go to the same level previous N'th thread.
11769 Returns the difference between N and the number of skips actually
11772 (gnus-summary-next-thread (- n)))
11774 (defun gnus-summary-go-down-thread ()
11775 "Go down one level in the current thread."
11776 (let ((children (gnus-summary-article-children)))
11778 (gnus-summary-goto-subject (car children)))))
11780 (defun gnus-summary-go-up-thread ()
11781 "Go up one level in the current thread."
11782 (let ((parent (gnus-summary-article-parent)))
11784 (gnus-summary-goto-subject parent))))
11786 (defun gnus-summary-down-thread (n)
11787 "Go down thread N steps.
11788 If N is negative, go up instead.
11789 Returns the difference between N and how many steps down that were
11794 (while (and (> n 0)
11795 (if up (gnus-summary-go-up-thread)
11796 (gnus-summary-go-down-thread)))
11798 (gnus-summary-position-point)
11800 (gnus-message 7 "Can't go further"))
11803 (defun gnus-summary-up-thread (n)
11804 "Go up thread N steps.
11805 If N is negative, go down instead.
11806 Returns the difference between N and how many steps down that were
11809 (gnus-summary-down-thread (- n)))
11811 (defun gnus-summary-top-thread ()
11812 "Go to the top of the thread."
11814 (while (gnus-summary-go-up-thread))
11815 (gnus-summary-article-number))
11817 (defun gnus-summary-expire-thread ()
11818 "Mark articles under current thread as expired."
11820 (gnus-summary-kill-thread 0))
11822 (defun gnus-summary-kill-thread (&optional unmark)
11823 "Mark articles under current thread as read.
11824 If the prefix argument is positive, remove any kinds of marks.
11825 If the prefix argument is zero, mark thread as expired.
11826 If the prefix argument is negative, tick articles instead."
11829 (setq unmark (prefix-numeric-value unmark)))
11830 (let ((articles (gnus-summary-articles-in-thread))
11831 (hide (or (null unmark) (= unmark 0))))
11833 ;; Expand the thread.
11834 (gnus-summary-show-thread)
11835 ;; Mark all the articles.
11837 (gnus-summary-goto-subject (car articles))
11838 (cond ((null unmark)
11839 (gnus-summary-mark-article-as-read gnus-killed-mark))
11841 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11843 (gnus-summary-mark-article nil gnus-expirable-mark))
11845 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11846 (setq articles (cdr articles))))
11847 ;; Hide killed subtrees when hide is true.
11849 gnus-thread-hide-killed
11850 (gnus-summary-hide-thread))
11851 ;; If hide is t, go to next unread subject.
11853 ;; Go to next unread subject.
11854 (gnus-summary-next-subject 1 t)))
11855 (gnus-set-mode-line 'summary))
11857 ;; Summary sorting commands
11859 (defun gnus-summary-sort-by-number (&optional reverse)
11860 "Sort the summary buffer by article number.
11861 Argument REVERSE means reverse order."
11863 (gnus-summary-sort 'number reverse))
11865 (defun gnus-summary-sort-by-most-recent-number (&optional reverse)
11866 "Sort the summary buffer by most recent article number.
11867 Argument REVERSE means reverse order."
11869 (gnus-summary-sort 'most-recent-number reverse))
11871 (defun gnus-summary-sort-by-random (&optional reverse)
11872 "Randomize the order in the summary buffer.
11873 Argument REVERSE means to randomize in reverse order."
11875 (gnus-summary-sort 'random reverse))
11877 (defun gnus-summary-sort-by-author (&optional reverse)
11878 "Sort the summary buffer by author name alphabetically.
11879 If `case-fold-search' is non-nil, case of letters is ignored.
11880 Argument REVERSE means reverse order."
11882 (gnus-summary-sort 'author reverse))
11884 (defun gnus-summary-sort-by-recipient (&optional reverse)
11885 "Sort the summary buffer by recipient name alphabetically.
11886 If `case-fold-search' is non-nil, case of letters is ignored.
11887 Argument REVERSE means reverse order."
11889 (gnus-summary-sort 'recipient reverse))
11891 (defun gnus-summary-sort-by-subject (&optional reverse)
11892 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11893 If `case-fold-search' is non-nil, case of letters is ignored.
11894 Argument REVERSE means reverse order."
11896 (gnus-summary-sort 'subject reverse))
11898 (defun gnus-summary-sort-by-date (&optional reverse)
11899 "Sort the summary buffer by date.
11900 Argument REVERSE means reverse order."
11902 (gnus-summary-sort 'date reverse))
11904 (defun gnus-summary-sort-by-most-recent-date (&optional reverse)
11905 "Sort the summary buffer by most recent date.
11906 Argument REVERSE means reverse order."
11908 (gnus-summary-sort 'most-recent-date reverse))
11910 (defun gnus-summary-sort-by-score (&optional reverse)
11911 "Sort the summary buffer by score.
11912 Argument REVERSE means reverse order."
11914 (gnus-summary-sort 'score reverse))
11916 (defun gnus-summary-sort-by-lines (&optional reverse)
11917 "Sort the summary buffer by the number of lines.
11918 Argument REVERSE means reverse order."
11920 (gnus-summary-sort 'lines reverse))
11922 (defun gnus-summary-sort-by-chars (&optional reverse)
11923 "Sort the summary buffer by article length.
11924 Argument REVERSE means reverse order."
11926 (gnus-summary-sort 'chars reverse))
11928 (defun gnus-summary-sort-by-original (&optional reverse)
11929 "Sort the summary buffer using the default sorting method.
11930 Argument REVERSE means reverse order."
11932 (let* ((inhibit-read-only t)
11933 (gnus-summary-prepare-hook nil))
11934 ;; We do the sorting by regenerating the threads.
11935 (gnus-summary-prepare)
11936 ;; Hide subthreads if needed.
11937 (gnus-summary-maybe-hide-threads)))
11939 (defun gnus-summary-sort (predicate reverse)
11940 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11941 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11942 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11943 (gnus-thread-sort-functions
11948 (gnus-sort-gathered-threads-function
11949 gnus-thread-sort-functions)
11950 (gnus-article-sort-functions
11954 (,article t2 t1))))
11955 (inhibit-read-only t)
11956 (gnus-summary-prepare-hook nil))
11957 ;; We do the sorting by regenerating the threads.
11958 (gnus-summary-prepare)
11959 ;; Hide subthreads if needed.
11960 (gnus-summary-maybe-hide-threads)))
11962 ;; Summary saving commands.
11964 (defun gnus-summary-save-article (&optional n not-saved)
11965 "Save the current article using the default saver function.
11966 If N is a positive number, save the N next articles.
11967 If N is a negative number, save the N previous articles.
11968 If N is nil and any articles have been marked with the process mark,
11969 save those articles instead.
11970 The variable `gnus-default-article-saver' specifies the saver function.
11972 If the optional second argument NOT-SAVED is non-nil, articles saved
11973 will not be marked as saved."
11975 (require 'gnus-art)
11976 (let* ((articles (gnus-summary-work-articles n))
11977 (save-buffer (save-excursion
11978 (nnheader-set-temp-buffer " *Gnus Save*")))
11979 (num (length articles))
11980 ;; Whether to save decoded articles or raw articles.
11981 (decode (when gnus-article-save-coding-system
11982 (get gnus-default-article-saver :decode)))
11983 ;; When saving many articles in a single file, use the other
11984 ;; function to save articles other than the first one.
11985 (saver2 (get gnus-default-article-saver :function))
11986 (gnus-prompt-before-saving (if saver2
11988 gnus-prompt-before-saving))
11989 (gnus-default-article-saver gnus-default-article-saver)
11991 (dolist (article articles)
11992 (setq header (gnus-summary-article-header article))
11993 (if (not (vectorp header))
11994 ;; This is a pseudo-article.
11995 (if (assq 'name header)
11996 (gnus-copy-file (cdr (assq 'name header)))
11997 (gnus-message 1 "Article %d is unsavable" article))
11998 ;; This is a real article.
11999 (save-window-excursion
12000 (gnus-summary-select-article decode decode nil article)
12001 (gnus-summary-goto-subject article))
12002 (with-current-buffer save-buffer
12004 (insert-buffer-substring (if decode
12005 gnus-article-buffer
12006 gnus-original-article-buffer)))
12007 (setq file (gnus-article-save save-buffer file num))
12008 (gnus-summary-remove-process-mark article)
12010 (gnus-summary-set-saved-mark article)))
12012 (setq gnus-default-article-saver saver2
12014 (gnus-kill-buffer save-buffer)
12015 (gnus-summary-position-point)
12016 (gnus-set-mode-line 'summary)
12019 (declare-function gnus-summary-save-in-pipe "gnus-art" (&optional command raw))
12021 (defun gnus-summary-pipe-output (&optional n sym)
12022 "Pipe the current article to a subprocess.
12023 If N is a positive number, pipe the N next articles.
12024 If N is a negative number, pipe the N previous articles.
12025 If N is nil and any articles have been marked with the process mark,
12026 pipe those articles instead.
12027 The default command to which articles are piped is specified by the
12028 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
12029 will be prompted for the command.
12031 The properties `:decode' and `:headers' that are put to the function
12032 symbol `gnus-summary-save-in-pipe' control whether this function
12033 decodes articles and what headers to keep (see the doc string for the
12034 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
12035 is neither omitted nor the symbol `r', force including all headers
12036 regardless of the `:headers' property. If it is the symbol `r',
12037 articles that are not decoded and include all headers will be piped
12038 no matter what the properties `:decode' and `:headers' are."
12039 (interactive (gnus-interactive "P\ny"))
12040 (require 'gnus-art)
12041 (let* ((articles (gnus-summary-work-articles n))
12042 (result-buffer "*Shell Command Output*")
12043 (all-headers (not (memq sym '(nil r))))
12044 (gnus-save-all-headers (or all-headers gnus-save-all-headers))
12046 (headers (get 'gnus-summary-save-in-pipe :headers))
12048 (unless (numberp (car articles))
12049 (error "No article to pipe"))
12050 (setq command (read-shell-command
12051 (concat "Shell command on "
12053 (format "these %d articles" (length articles))
12056 gnus-summary-pipe-output-default-command))
12057 (when (string-equal command "")
12058 (error "A command is required"))
12060 (put 'gnus-summary-save-in-pipe :headers nil))
12063 (gnus-summary-goto-subject (pop articles))
12064 (save-window-excursion (gnus-summary-save-in-pipe command raw))
12065 (when (and (get-buffer result-buffer)
12066 (not (zerop (buffer-size (get-buffer result-buffer)))))
12067 (setq result (concat result (with-current-buffer result-buffer
12068 (buffer-string))))))
12069 (put 'gnus-summary-save-in-pipe :headers headers))
12070 (unless (zerop (length result))
12071 (if (with-current-buffer (get-buffer-create result-buffer)
12075 (and (= (count-lines (point-min) (point)) 1)
12078 (<= (current-column)
12079 (window-width (minibuffer-window)))))
12080 (goto-char (point-min))))
12081 (message "%s" (substring result 0 -1))
12083 (gnus-configure-windows 'pipe)))))
12085 (defun gnus-summary-save-article-mail (&optional arg)
12086 "Append the current article to a Unix mail box file.
12087 If N is a positive number, save the N next articles.
12088 If N is a negative number, save the N previous articles.
12089 If N is nil and any articles have been marked with the process mark,
12090 save those articles instead."
12092 (require 'gnus-art)
12093 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
12094 (gnus-summary-save-article arg)))
12096 (defun gnus-summary-save-article-rmail (&optional arg)
12097 "Append the current article to an rmail file.
12098 If N is a positive number, save the N next articles.
12099 If N is a negative number, save the N previous articles.
12100 If N is nil and any articles have been marked with the process mark,
12101 save those articles instead."
12103 (require 'gnus-art)
12104 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
12105 (gnus-summary-save-article arg)))
12107 (defun gnus-summary-save-article-file (&optional arg)
12108 "Append the current article to a file.
12109 If N is a positive number, save the N next articles.
12110 If N is a negative number, save the N previous articles.
12111 If N is nil and any articles have been marked with the process mark,
12112 save those articles instead."
12114 (require 'gnus-art)
12115 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
12116 (gnus-summary-save-article arg)))
12118 (defun gnus-summary-write-article-file (&optional arg)
12119 "Write the current article to a file, deleting the previous file.
12120 If N is a positive number, save the N next articles.
12121 If N is a negative number, save the N previous articles.
12122 If N is nil and any articles have been marked with the process mark,
12123 save those articles instead."
12125 (require 'gnus-art)
12126 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
12127 (gnus-summary-save-article arg)))
12129 (defun gnus-summary-save-article-body-file (&optional arg)
12130 "Append the current article body to a file.
12131 If N is a positive number, save the N next articles.
12132 If N is a negative number, save the N previous articles.
12133 If N is nil and any articles have been marked with the process mark,
12134 save those articles instead."
12136 (require 'gnus-art)
12137 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
12138 (gnus-summary-save-article arg)))
12140 (defun gnus-summary-write-article-body-file (&optional arg)
12141 "Write the current article body to a file, deleting the previous file.
12142 If N is a positive number, save the N next articles.
12143 If N is a negative number, save the N previous articles.
12144 If N is nil and any articles have been marked with the process mark,
12145 save those articles instead."
12147 (require 'gnus-art)
12148 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
12149 (gnus-summary-save-article arg)))
12151 (defun gnus-summary-muttprint (&optional arg)
12152 "Print the current article using Muttprint.
12153 If N is a positive number, save the N next articles.
12154 If N is a negative number, save the N previous articles.
12155 If N is nil and any articles have been marked with the process mark,
12156 save those articles instead."
12158 (require 'gnus-art)
12159 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
12160 (gnus-summary-save-article arg t)))
12162 (defun gnus-summary-pipe-message (program)
12163 "Pipe the current article through PROGRAM."
12164 (interactive "sProgram: ")
12165 (gnus-summary-select-article)
12166 (let ((mail-header-separator ""))
12167 (gnus-eval-in-buffer-window gnus-article-buffer
12170 (let ((start (window-start))
12171 (inhibit-read-only t))
12172 (message-pipe-buffer-body program)
12173 (set-window-start (get-buffer-window (current-buffer)) start))))))
12175 (defun gnus-get-split-value (methods)
12176 "Return a value based on the split METHODS."
12177 (let (split-name method result match)
12179 (with-current-buffer gnus-original-article-buffer
12181 (nnheader-narrow-to-headers)
12182 (while (and methods (not split-name))
12183 (goto-char (point-min))
12184 (setq method (pop methods))
12185 (setq match (car method))
12188 ;; Regular expression.
12190 (re-search-forward match nil t)))
12195 (setq result (funcall match gnus-newsgroup-name))))
12200 (setq result (eval match)))))
12201 (setq split-name (cdr method))
12202 (cond ((stringp result)
12203 (push (expand-file-name
12204 result gnus-article-save-directory)
12207 (setq split-name (append result split-name)))))))))
12208 (nreverse split-name)))
12210 (defun gnus-valid-move-group-p (group)
12211 (and (symbolp group)
12213 (symbol-name group)
12214 (symbol-value group)
12215 (gnus-get-function (gnus-find-method-for-group
12216 (symbol-name group)) 'request-accept-article t)))
12218 (defun gnus-read-move-group-name (prompt default articles prefix)
12219 "Read a group name."
12220 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
12224 (if (> (length articles) 1)
12225 (format "these %d articles" (length articles))
12230 (gnus-group-completing-read
12232 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12233 nil prefix nil default))
12234 ((= 1 (length split-name))
12235 (gnus-group-completing-read
12237 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12238 nil prefix 'gnus-group-history (car split-name)))
12240 (gnus-completing-read
12241 prom (nreverse split-name) nil nil 'gnus-group-history))))
12242 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
12245 (if (or (string= to-newsgroup "")
12246 (string= to-newsgroup prefix))
12247 (setq to-newsgroup default))
12248 (unless to-newsgroup
12249 (error "No group name entered"))
12250 (setq encoded (encode-coding-string
12252 (gnus-group-name-charset to-method to-newsgroup)))
12253 (or (gnus-active encoded)
12254 (gnus-activate-group encoded nil nil to-method)
12255 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
12257 (or (and (gnus-request-create-group encoded to-method)
12258 (gnus-activate-group encoded nil nil to-method)
12259 (gnus-subscribe-group encoded))
12260 (error "Couldn't create group %s" to-newsgroup)))
12261 (error "No such group: %s" to-newsgroup))
12264 (defvar gnus-summary-save-parts-counter)
12265 (declare-function mm-uu-dissect "mm-uu" (&optional noheader mime-type))
12267 (defun gnus-summary-save-parts (type dir n &optional reverse)
12268 "Save parts matching TYPE to DIR.
12269 If REVERSE, save parts that do not match TYPE."
12271 (list (read-string "Save parts of type: "
12272 (or (car gnus-summary-save-parts-type-history)
12273 gnus-summary-save-parts-default-mime)
12274 'gnus-summary-save-parts-type-history)
12275 (setq gnus-summary-save-parts-last-directory
12276 (read-directory-name "Save to directory: "
12277 gnus-summary-save-parts-last-directory
12279 current-prefix-arg))
12280 (gnus-summary-iterate n
12281 (let ((gnus-display-mime-function nil)
12282 gnus-article-prepare-hook
12283 gnus-article-decode-hook
12284 gnus-display-mime-function
12286 (gnus-inhibit-treatment t))
12287 (gnus-summary-select-article))
12288 (with-current-buffer gnus-article-buffer
12289 (let ((handles (or gnus-article-mime-handles
12290 (mm-dissect-buffer nil gnus-article-loose-mime)
12291 (and gnus-article-emulate-mime
12293 (gnus-summary-save-parts-counter 1))
12295 (gnus-summary-save-parts-1 type dir handles reverse)
12296 (unless gnus-article-mime-handles ;; Don't destroy this case.
12297 (mm-destroy-parts handles)))))))
12299 (defun gnus-summary-save-parts-1 (type dir handle reverse)
12300 (if (stringp (car handle))
12301 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
12304 (not (string-match type (mm-handle-media-type handle)))
12305 (string-match type (mm-handle-media-type handle)))
12306 (let ((file (expand-file-name
12308 mm-file-name-rewrite-functions
12309 (file-name-nondirectory
12311 (mm-handle-filename handle)
12312 (format "%s.%d.%d" gnus-newsgroup-name
12313 (cdr gnus-article-current)
12314 gnus-summary-save-parts-counter))))
12316 (incf gnus-summary-save-parts-counter)
12317 (unless (file-exists-p file)
12318 (mm-save-part-to-file handle file))))))
12320 ;; Summary extract commands
12322 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
12323 (let ((inhibit-read-only t)
12324 (article (gnus-summary-article-number))
12326 (unless (gnus-summary-goto-subject article)
12327 (error "No such article: %d" article))
12328 (gnus-summary-position-point)
12329 ;; If all commands are to be bunched up on one line, we collect
12331 (unless gnus-view-pseudos-separately
12332 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
12335 (setq action (cdr (assq 'action (car ps))))
12336 (setq files (list (cdr (assq 'name (car ps)))))
12337 (while (and ps (cdr ps)
12338 (string= (or action "1")
12339 (or (cdr (assq 'action (cadr ps))) "2")))
12340 (push (cdr (assq 'name (cadr ps))) files)
12341 (setcdr ps (cddr ps)))
12343 (when (not (string-match "%s" action))
12346 (when (assq 'execute (car ps))
12347 (setcdr (assq 'execute (car ps))
12348 (funcall (if (string-match "%s" action)
12355 (shell-quote-argument f)))
12357 (setq ps (cdr ps)))))
12358 (if (and gnus-view-pseudos (not not-view))
12360 (when (assq 'execute (car pslist))
12361 (gnus-execute-command (cdr (assq 'execute (car pslist)))
12362 (eq gnus-view-pseudos 'not-confirm)))
12363 (setq pslist (cdr pslist)))
12366 (setq after-article (or (cdr (assq 'article (car pslist)))
12367 (gnus-summary-article-number)))
12368 (gnus-summary-goto-subject after-article)
12371 (insert " " (file-name-nondirectory
12372 (cdr (assq 'name (car pslist))))
12373 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
12375 (forward-line -1) ; back to `b'
12376 (add-text-properties
12377 b (1- e) (list 'gnus-number gnus-reffed-article-number
12378 'mouse-face gnus-mouse-face))
12380 after-article gnus-reffed-article-number
12381 gnus-unread-mark b (car pslist) 0 (- e b))
12382 (setq gnus-newsgroup-unreads
12383 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12384 gnus-reffed-article-number))
12385 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
12386 (setq pslist (cdr pslist)))))))
12388 (defun gnus-pseudos< (p1 p2)
12389 (let ((c1 (cdr (assq 'action p1)))
12390 (c2 (cdr (assq 'action p2))))
12391 (and c1 c2 (string< c1 c2))))
12393 (defun gnus-request-pseudo-article (props)
12394 (cond ((assq 'execute props)
12395 (gnus-execute-command (cdr (assq 'execute props)))))
12396 (let ((gnus-current-article (gnus-summary-article-number)))
12397 (gnus-run-hooks 'gnus-mark-article-hook)))
12399 (defun gnus-execute-command (command &optional automatic)
12401 (gnus-article-setup-buffer)
12402 (set-buffer gnus-article-buffer)
12403 (setq buffer-read-only nil)
12404 (let ((command (if automatic command
12405 (read-string "Command: " (cons command 0)))))
12407 (insert "$ " command "\n\n")
12408 (if gnus-view-pseudo-asynchronously
12409 (start-process "gnus-execute" (current-buffer) shell-file-name
12410 shell-command-switch command)
12411 (call-process shell-file-name nil t nil
12412 shell-command-switch command)))))
12414 ;; Summary kill commands.
12416 (defun gnus-summary-edit-global-kill (article)
12417 "Edit the \"global\" kill file."
12418 (interactive (list (gnus-summary-article-number)))
12419 (gnus-group-edit-global-kill article))
12421 (defun gnus-summary-edit-local-kill ()
12422 "Edit a local kill file applied to the current newsgroup."
12424 (setq gnus-current-headers (gnus-summary-article-header))
12425 (gnus-group-edit-local-kill
12426 (gnus-summary-article-number) gnus-newsgroup-name))
12428 ;;; Header reading.
12430 (defun gnus-read-header (id &optional header)
12431 "Read the headers of article ID and enter them into the Gnus system."
12432 (let ((group gnus-newsgroup-name)
12433 (gnus-override-method
12435 gnus-override-method
12436 (and (gnus-news-group-p gnus-newsgroup-name)
12437 (car (gnus-refer-article-methods)))))
12439 ;; First we check to see whether the header in question is already
12442 ;; This is a Message-ID.
12443 (setq header (or header (gnus-id-to-header id)))
12444 ;; This is an article number.
12445 (setq header (or header (gnus-summary-article-header id))))
12447 (not (gnus-summary-article-sparse-p (mail-header-number header))))
12448 ;; We have found the header.
12450 ;; We have to really fetch the header to this article.
12451 (with-current-buffer nntp-server-buffer
12452 (when (setq where (gnus-request-head id group))
12453 (nnheader-fold-continuation-lines)
12454 (goto-char (point-max))
12456 (goto-char (point-min))
12460 ((cdr where) (cdr where))
12461 (header (mail-header-number header))
12462 (t gnus-reffed-article-number))
12464 (insert " Article retrieved.\n"))
12465 (if (or (not where)
12466 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
12467 () ; Malformed head.
12468 (unless (gnus-summary-article-sparse-p (mail-header-number header))
12469 (when (and (bound-and-true-p gnus-registry-enabled)
12470 (not (gnus-ephemeral-group-p (car where))))
12471 (gnus-registry-handle-action
12472 (mail-header-id header) nil
12473 (gnus-group-prefixed-name
12475 (or gnus-override-method (gnus-find-method-for-group group)))
12476 (mail-header-subject header)
12477 (mail-header-from header)))
12478 (when (and (stringp id)
12480 (not (string= (gnus-group-real-name group)
12482 (not (gnus-server-equal gnus-override-method
12483 (gnus-group-method group)))))
12484 ;; If we fetched by Message-ID and the article came from
12485 ;; a different group (or server), we fudge some bogus
12486 ;; article numbers for this article.
12487 (mail-header-set-number header gnus-reffed-article-number))
12488 (with-current-buffer gnus-summary-buffer
12489 (decf gnus-reffed-article-number)
12490 (gnus-remove-header (mail-header-number header))
12491 (push header gnus-newsgroup-headers)
12492 (setq gnus-current-headers header)
12493 (push (mail-header-number header) gnus-newsgroup-limit)))
12496 (defun gnus-remove-header (number)
12497 "Remove header NUMBER from `gnus-newsgroup-headers'."
12498 (if (and gnus-newsgroup-headers
12499 (= number (mail-header-number (car gnus-newsgroup-headers))))
12500 (pop gnus-newsgroup-headers)
12501 (let ((headers gnus-newsgroup-headers))
12502 (while (and (cdr headers)
12503 (not (= number (mail-header-number (cadr headers)))))
12505 (when (cdr headers)
12506 (setcdr headers (cddr headers))))))
12509 ;;; summary highlights
12512 (defun gnus-highlight-selected-summary ()
12513 "Highlight selected article in summary buffer."
12514 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12515 (when gnus-summary-selected-face
12517 (let* ((beg (point-at-bol))
12518 (end (point-at-eol))
12519 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12520 (from (if (get-text-property beg 'mouse-face)
12522 (or (next-single-property-change
12523 beg 'mouse-face nil end)
12528 (or (next-single-property-change
12529 from 'mouse-face nil end)
12531 ;; If no mouse-face prop on line we will have to = from = end,
12532 ;; so we highlight the entire line instead.
12533 (when (= (+ to 2) from)
12536 (if gnus-newsgroup-selected-overlay
12537 ;; Move old overlay.
12539 gnus-newsgroup-selected-overlay from to (current-buffer))
12540 ;; Create new overlay.
12542 (setq gnus-newsgroup-selected-overlay (make-overlay from to))
12543 'face gnus-summary-selected-face))))))
12545 (defvar gnus-summary-highlight-line-cached nil)
12546 (defvar gnus-summary-highlight-line-trigger nil)
12548 (defun gnus-summary-highlight-line-0 ()
12549 (if (and (eq gnus-summary-highlight-line-trigger
12550 gnus-summary-highlight)
12551 gnus-summary-highlight-line-cached)
12552 gnus-summary-highlight-line-cached
12553 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12554 gnus-summary-highlight-line-cached
12555 (let* ((cond (list 'cond))
12557 (list gnus-summary-highlight))
12559 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
12563 (gnus-byte-compile (list 'lambda nil cond))))))
12565 (defun gnus-summary-highlight-line ()
12566 "Highlight current line according to `gnus-summary-highlight'."
12567 (let* ((beg (point-at-bol))
12568 (article (or (gnus-summary-article-number) gnus-current-article))
12569 (score (or (cdr (assq article
12570 gnus-newsgroup-scored))
12571 gnus-summary-default-score 0))
12572 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
12573 (inhibit-read-only t)
12574 (default gnus-summary-default-score)
12575 (default-high gnus-summary-default-high-score)
12576 (default-low gnus-summary-default-low-score)
12577 (uncached (and gnus-summary-use-undownloaded-faces
12578 (memq article gnus-newsgroup-undownloaded)
12579 (not (memq article gnus-newsgroup-cached)))))
12580 (let ((face (funcall (gnus-summary-highlight-line-0))))
12581 (unless (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face))
12582 (gnus-put-text-property-excluding-characters-with-faces
12583 beg (point-at-eol) 'face
12584 (setq face (if (boundp face) (symbol-value face) face)))
12585 (when gnus-summary-highlight-line-function
12586 (funcall gnus-summary-highlight-line-function article face))))))
12588 (defun gnus-update-read-articles (group unread &optional compute)
12589 "Update the list of read articles in GROUP.
12590 UNREAD is a sorted list."
12591 (let ((active (or gnus-newsgroup-active (gnus-active group)))
12592 (info (gnus-get-info group))
12595 (if (or (not info) (not active))
12596 ;; There is no info on this group if it was, in fact,
12597 ;; killed. Gnus stores no information on killed groups, so
12598 ;; there's nothing to be done.
12599 ;; One could store the information somewhere temporarily,
12600 ;; perhaps... Hmmm...
12602 ;; Remove any negative articles numbers.
12603 (while (and unread (< (car unread) 0))
12604 (setq unread (cdr unread)))
12605 ;; Remove any expired article numbers
12606 (while (and unread (< (car unread) (car active)))
12607 (setq unread (cdr unread)))
12608 ;; Compute the ranges of read articles by looking at the list of
12609 ;; unread articles.
12611 (when (/= (car unread) prev)
12612 (push (if (= prev (1- (car unread))) prev
12613 (cons prev (1- (car unread))))
12615 (setq prev (1+ (car unread)))
12616 (setq unread (cdr unread)))
12617 (when (<= prev (cdr active))
12618 (push (cons prev (cdr active)) read))
12619 (setq read (if (> (length read) 1) (nreverse read) read))
12624 ;; Propagate the read marks to the backend.
12625 (when (and (gnus-method-option-p
12626 (gnus-find-method-for-group group)
12628 (gnus-check-backend-function 'request-set-mark group))
12629 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12630 (add (gnus-remove-from-range read (gnus-info-read info))))
12632 (unless (gnus-check-group group)
12633 (error "Can't open server for %s" group))
12634 (gnus-request-set-mark
12635 group (delq nil (list (if add (list add 'add '(read)))
12636 (if del (list del 'del '(read))))))
12638 `(gnus-request-set-mark
12641 (if del (list del 'add '(read)))
12642 (if add (list add 'del '(read))))))))))
12643 (set-buffer gnus-group-buffer)
12644 (gnus-undo-register
12646 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12647 (gnus-info-set-read ',info ',(gnus-info-read info))
12648 (gnus-get-unread-articles-in-group ',info
12649 (gnus-active ,group))
12650 (gnus-group-update-group ,group t)
12652 ;; Enter this list into the group info.
12653 (gnus-info-set-read info read)
12654 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12655 (gnus-get-unread-articles-in-group info (gnus-active group))
12658 (defun gnus-offer-save-summaries ()
12659 "Offer to save all active summary buffers."
12661 ;; Go through all buffers and find all summaries.
12662 (dolist (buffer (buffer-list))
12663 (when (and (setq buffer (buffer-name buffer))
12664 (string-match "Summary" buffer)
12665 (with-current-buffer buffer
12666 ;; We check that this is, indeed, a summary buffer.
12667 (and (derived-mode-p 'gnus-summary-mode)
12668 ;; Also make sure this isn't bogus.
12669 gnus-newsgroup-prepared
12670 ;; Also make sure that this isn't a
12671 ;; dead summary buffer.
12672 (not gnus-dead-summary-mode))))
12673 (push buffer buffers)))
12674 ;; Go through all these summary buffers and offer to save them.
12677 (if (eq gnus-interactive-exit 'quiet)
12678 (dolist (buffer buffers)
12679 (switch-to-buffer buffer)
12680 (gnus-summary-exit))
12682 "Update summary buffer %s? "
12684 (switch-to-buffer buf)
12685 (gnus-summary-exit))
12688 (defun gnus-summary-setup-default-charset ()
12689 "Setup newsgroup default charset."
12690 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12691 (setq gnus-newsgroup-charset nil)
12692 (let* ((ignored-charsets
12693 (or gnus-newsgroup-ephemeral-ignored-charsets
12695 (and gnus-newsgroup-name
12696 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12697 gnus-newsgroup-ignored-charsets))))
12698 (setq gnus-newsgroup-charset
12699 (or gnus-newsgroup-ephemeral-charset
12700 (and gnus-newsgroup-name
12701 (gnus-parameter-charset gnus-newsgroup-name))
12702 gnus-default-charset))
12703 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12704 ignored-charsets))))
12710 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12711 "Display the current article buffer fully MIME-buttonized.
12712 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12713 treated as multipart/mixed."
12715 (require 'gnus-art)
12716 (let ((gnus-unbuttonized-mime-types nil)
12717 (gnus-mime-display-multipart-as-mixed show-all-parts))
12718 (gnus-summary-show-article)))
12720 (defun gnus-summary-repair-multipart (article)
12721 "Add a Content-Type header to a multipart article without one."
12722 (interactive (list (gnus-summary-article-number)))
12723 (gnus-with-article article
12724 (message-narrow-to-head)
12725 (message-remove-header "Mime-Version")
12726 (goto-char (point-max))
12727 (insert "Mime-Version: 1.0\n")
12729 (when (search-forward "\n--" nil t)
12730 (let ((separator (buffer-substring (point) (point-at-eol))))
12731 (message-narrow-to-head)
12732 (message-remove-header "Content-Type")
12733 (goto-char (point-max))
12734 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12737 (let (gnus-mark-article-hook)
12738 (gnus-summary-select-article t t nil article)))
12740 (defun gnus-summary-toggle-display-buttonized ()
12741 "Toggle the buttonizing of the article buffer."
12743 (require 'gnus-art)
12744 (if (setq gnus-inhibit-mime-unbuttonizing
12745 (not gnus-inhibit-mime-unbuttonizing))
12746 (let ((gnus-unbuttonized-mime-types nil))
12747 (gnus-summary-show-article))
12748 (gnus-summary-show-article)))
12751 ;;; Generic summary marking commands
12754 (defvar gnus-summary-marking-alist
12755 '((read gnus-del-mark "d")
12756 (unread gnus-unread-mark "u")
12757 (ticked gnus-ticked-mark "!")
12758 (dormant gnus-dormant-mark "?")
12759 (expirable gnus-expirable-mark "e"))
12760 "An alist of names/marks/keystrokes.")
12762 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12763 (defvar gnus-summary-mark-map)
12765 (defun gnus-summary-make-all-marking-commands ()
12766 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12767 (dolist (elem gnus-summary-marking-alist)
12768 (apply 'gnus-summary-make-marking-command elem)))
12770 (defun gnus-summary-make-marking-command (name mark keystroke)
12771 (let ((map (make-sparse-keymap)))
12772 (define-key gnus-summary-generic-mark-map keystroke map)
12773 (dolist (lway `((next "next" next nil "n")
12774 (next-unread "next unread" next t "N")
12775 (prev "previous" prev nil "p")
12776 (prev-unread "previous unread" prev t "P")
12777 (nomove "" nil nil ,keystroke)))
12778 (let ((func (gnus-summary-make-marking-command-1
12779 mark (car lway) lway name)))
12780 (setq func (eval func))
12781 (define-key map (nth 4 lway) func)))))
12783 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12785 (format "gnus-summary-put-mark-as-%s%s"
12786 name (if (eq way 'nomove)
12788 (concat "-" (symbol-name way)))))
12791 "Mark the current article as %s%s.
12792 If N, the prefix, then repeat N times.
12793 If N is negative, move in reverse order.
12794 The difference between N and the actual number of articles marked is
12798 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12800 (defun gnus-summary-generic-mark (n mark move unread)
12801 "Mark N articles with MARK."
12802 (unless (derived-mode-p 'gnus-summary-mode)
12803 (error "This command can only be used in the summary buffer"))
12804 (gnus-summary-show-thread)
12807 ((eq move 'next) 1)
12808 ((eq move 'prev) -1)
12810 (if (zerop nummove)
12814 nummove (* -1 nummove))))
12815 (while (and (> n 0)
12816 (gnus-summary-mark-article nil mark)
12817 (zerop (gnus-summary-next-subject nummove unread t)))
12820 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12821 (gnus-summary-recenter)
12822 (gnus-summary-position-point)
12823 (gnus-set-mode-line 'summary)
12826 (defun gnus-summary-insert-articles (articles)
12827 (when (setq articles
12828 (gnus-sorted-difference articles
12829 (mapcar (lambda (h)
12830 (mail-header-number h))
12831 gnus-newsgroup-headers)))
12832 (setq gnus-newsgroup-headers
12834 gnus-newsgroup-headers
12835 (gnus-fetch-headers articles nil t)
12836 'gnus-article-sort-by-number))
12837 (setq gnus-newsgroup-articles
12838 (gnus-sorted-nunion gnus-newsgroup-articles articles))
12839 ;; Suppress duplicates?
12840 (when gnus-suppress-duplicates
12841 (gnus-dup-suppress-articles))
12843 (if (and gnus-fetch-old-headers
12844 (eq gnus-headers-retrieved-by 'nov))
12845 ;; We might want to build some more threads first.
12846 (if (eq gnus-fetch-old-headers 'invisible)
12847 (gnus-build-all-threads)
12848 (gnus-build-old-threads))
12849 ;; Mark the inserted articles that are unread as unread.
12850 (setq gnus-newsgroup-unreads
12851 (gnus-sorted-nunion
12852 gnus-newsgroup-unreads
12853 (gnus-sorted-nintersection
12854 (gnus-list-of-unread-articles gnus-newsgroup-name)
12856 ;; Mark the inserted articles as selected so that the information
12857 ;; of the marks having been changed by a user may be updated when
12858 ;; exiting this group. See `gnus-summary-update-info'.
12859 (dolist (art articles)
12860 (setq gnus-newsgroup-unselected (delq art gnus-newsgroup-unselected))))
12861 ;; Let the Gnus agent mark articles as read.
12863 (gnus-agent-get-undownloaded-list))
12864 ;; Remove list identifiers from subject
12865 (gnus-summary-remove-list-identifiers)
12866 ;; First and last article in this newsgroup.
12867 (when gnus-newsgroup-headers
12868 (setq gnus-newsgroup-begin
12869 (mail-header-number (car gnus-newsgroup-headers))
12871 (mail-header-number
12872 (gnus-last-element gnus-newsgroup-headers))))
12873 (when gnus-use-scoring
12874 (gnus-possibly-score-headers))))
12876 (defun gnus-summary-insert-old-articles (&optional all)
12877 "Insert all old articles in this group.
12878 If ALL is non-nil, already read articles become readable.
12879 If ALL is a number, fetch this number of articles."
12882 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12885 ;; Some nntp servers lie about their active range. When
12886 ;; this happens, the active range can be in the millions.
12887 ;; Use a compressed range to avoid creating a huge list.
12888 (gnus-range-difference
12889 (gnus-range-difference (list gnus-newsgroup-active) old)
12890 gnus-newsgroup-unexist))
12891 (setq len (gnus-range-length older))
12896 (let ((older-range (nreverse older)))
12900 (let* ((r (pop older-range))
12901 (min (if (numberp r) r (car r)))
12902 (max (if (numberp r) r (cdr r))))
12903 (while (and (<= min max)
12908 (setq older (gnus-uncompress-range older))))
12910 (setq older (gnus-uncompress-range older)))
12912 (when (and (numberp gnus-large-newsgroup)
12913 (> len gnus-large-newsgroup))
12914 (let* ((cursor-in-echo-area nil)
12915 (initial (gnus-parameter-large-newsgroup-initial
12916 gnus-newsgroup-name))
12920 "How many articles from %s (%s %d): "
12921 (gnus-group-decoded-name gnus-newsgroup-name)
12922 (if initial "max" "default")
12926 (number-to-string initial)))))
12927 (unless (string-match "^[ \t]*$" input)
12928 (setq all (string-to-number input))
12930 (let ((older-range (nreverse older)))
12934 (let* ((r (pop older-range))
12935 (min (if (numberp r) r (car r)))
12936 (max (if (numberp r) r (cdr r))))
12937 (while (and (<= min max)
12941 max (1- max))))))))))
12942 (setq older (gnus-uncompress-range older))))
12944 (message "No old news.")
12945 (gnus-summary-insert-articles older)
12946 (gnus-summary-limit (gnus-sorted-nunion old older))))
12947 (gnus-summary-position-point)))
12949 (defun gnus-summary-insert-new-articles ()
12950 "Insert all new articles in this group."
12952 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12953 (old-high gnus-newsgroup-highest)
12954 (nnmail-fetched-sources (list t))
12955 (new-active (gnus-activate-group gnus-newsgroup-name 'scan))
12958 (error "Couldn't fetch new data"))
12959 (setq gnus-newsgroup-active (gnus-copy-sequence new-active))
12960 (setq i (cdr gnus-newsgroup-active)
12961 gnus-newsgroup-highest i)
12962 (while (> i old-high)
12966 (message "No gnus is bad news")
12967 (gnus-summary-insert-articles new)
12968 (setq gnus-newsgroup-unreads
12969 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12970 (gnus-summary-limit (gnus-sorted-nunion old new))))
12971 (gnus-summary-position-point))
12973 ;;; Bookmark support for Gnus.
12974 (declare-function gnus-article-show-summary "gnus-art" ())
12975 (declare-function bookmark-make-record-default
12976 "bookmark" (&optional no-file no-context posn))
12977 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
12978 (declare-function bookmark-default-handler "bookmark" (bmk))
12979 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
12980 (defvar bookmark-yank-point)
12981 (defvar bookmark-current-buffer)
12983 (defun gnus-summary-bookmark-make-record ()
12984 "Make a bookmark entry for a Gnus summary buffer."
12986 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
12987 (save-restriction ; FIXME is it necessary to widen?
12988 (widen) (setq pos (point))) ; Set position in gnus-article buffer.
12989 (setq buf "art") ; We are recording bookmark from article buffer.
12990 (setq bookmark-yank-point (point))
12991 (setq bookmark-current-buffer (current-buffer))
12992 (gnus-article-show-summary)) ; Go back in summary buffer.
12993 ;; We are now recording bookmark from summary buffer.
12994 (unless buf (setq buf "sum"))
12995 (let* ((subject (elt (gnus-summary-article-header) 1))
12996 (grp (car gnus-article-current))
12997 (art (cdr gnus-article-current))
12998 (head (gnus-summary-article-header art))
12999 (id (mail-header-id head)))
13001 ,@(condition-case nil
13002 (bookmark-make-record-default 'no-file 'no-context pos)
13003 (wrong-number-of-arguments
13004 (bookmark-make-record-default 'point-only)))
13005 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
13006 (group . ,grp) (article . ,art)
13007 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
13010 (defun gnus-summary-bookmark-jump (bookmark)
13011 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
13012 BOOKMARK is a bookmark name or a bookmark record."
13013 (let ((group (bookmark-prop-get bookmark 'group))
13014 (article (bookmark-prop-get bookmark 'article))
13015 (id (bookmark-prop-get bookmark 'message-id))
13016 (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
13017 (gnus-fetch-group group (list article))
13018 (gnus-summary-insert-cached-articles)
13019 (gnus-summary-goto-article id nil 'force)
13020 ;; FIXME we have to wait article buffer is ready (only large buffer)
13021 ;; Is there a better solution to know that?
13022 ;; If we don't wait `bookmark-default-handler' will have no chance
13023 ;; to set position. However there is no error, just wrong pos.
13025 (when (string= buf "Gnus-art")
13027 (bookmark-default-handler
13029 (buffer . ,(current-buffer))
13030 . ,(bookmark-get-bookmark-record bookmark)))))
13032 (gnus-summary-make-all-marking-commands)
13034 (provide 'gnus-sum)
13036 (run-hooks 'gnus-sum-load-hook)
13038 ;; Local Variables:
13042 ;;; gnus-sum.el ends here