1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996-2013 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 ;; For Emacs <22.2 and XEmacs.
29 (unless (fboundp 'declare-function
) (defmacro declare-function
(&rest r
))))
33 (when (featurep 'xemacs
)
34 (require 'easy-mmode
))) ; for `define-minor-mode'
36 (defvar tool-bar-mode
)
37 (defvar gnus-tmp-header
)
50 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
51 (autoload 'gnus-cache-write-active
"gnus-cache")
52 (autoload 'gnus-mailing-list-insinuate
"gnus-ml" nil t
)
53 (autoload 'turn-on-gnus-mailing-list-mode
"gnus-ml" nil t
)
54 (autoload 'gnus-pick-line-number
"gnus-salt" nil t
)
55 (autoload 'mm-uu-dissect
"mm-uu")
56 (autoload 'gnus-article-outlook-deuglify-article
"deuglify"
57 "Deuglify broken Outlook (Express) articles and redisplay."
59 (autoload 'gnus-article-outlook-unwrap-lines
"deuglify" nil t
)
60 (autoload 'gnus-article-outlook-repair-attribution
"deuglify" nil t
)
61 (autoload 'gnus-article-outlook-rearrange-citation
"deuglify" nil t
)
62 (autoload 'nnir-article-rsv
"nnir" nil nil
'macro
)
63 (autoload 'nnir-article-group
"nnir" nil nil
'macro
)
65 (defcustom gnus-kill-summary-on-exit t
66 "*If non-nil, kill the summary buffer when you exit from it.
67 If nil, the summary will become a \"*Dead Summary*\" buffer, and
68 it will be killed sometime later."
69 :group
'gnus-summary-exit
72 (defcustom gnus-summary-next-group-on-exit t
73 "If non-nil, go to the next unread newsgroup on summary exit.
74 See `gnus-group-goto-unread'."
75 :link
'(custom-manual "(gnus)Group Maneuvering")
76 :group
'gnus-summary-exit
77 :version
"23.1" ;; No Gnus
80 (defcustom gnus-summary-stop-at-end-of-message nil
81 "If non-nil, don't select the next message when using `SPC'."
82 :link
'(custom-manual "(gnus)Group Maneuvering")
83 :group
'gnus-summary-maneuvering
87 (defcustom gnus-fetch-old-headers nil
88 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
89 If an unread article in the group refers to an older, already
90 read (or just marked as read) article, the old article will not
91 normally be displayed in the Summary buffer. If this variable is
92 t, Gnus will attempt to grab the headers to the old articles, and
93 thereby build complete threads. If it has the value `some', all
94 old headers will be fetched but only enough headers to connect
95 otherwise loose threads will be displayed. This variable can
96 also be a number. In that case, no more than that number of old
97 headers will be fetched. If it has the value `invisible', all
98 old headers will be fetched, but none will be displayed.
100 The server has to support NOV for any of this to work.
102 This feature can seriously impact performance it ignores all
103 locally cached header entries. Setting it to t for groups for a
104 server that doesn't expire articles (such as news.gmane.org),
105 leads to very slow summary generation."
107 :type
'(choice (const :tag
"off" nil
)
112 (sexp :menu-tag
"other" t
)))
114 (defcustom gnus-refer-thread-limit
500
115 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
116 If t, fetch all the available old headers."
118 :type
'(choice number
119 (sexp :menu-tag
"other" t
)))
121 (defcustom gnus-refer-thread-use-nnir nil
122 "*Use nnir to search an entire server when referring threads. A
123 nil value will only search for thread-related articles in the
129 (defcustom gnus-summary-make-false-root
'adopt
130 "*nil means that Gnus won't gather loose threads.
131 If the root of a thread has expired or been read in a previous
132 session, the information necessary to build a complete thread has been
133 lost. Instead of having many small sub-threads from this original thread
134 scattered all over the summary buffer, Gnus can gather them.
136 If non-nil, Gnus will try to gather all loose sub-threads from an
137 original thread into one large thread.
139 If this variable is non-nil, it should be one of `none', `adopt',
142 If this variable is `none', Gnus will not make a false root, but just
143 present the sub-threads after another.
144 If this variable is `dummy', Gnus will create a dummy root that will
145 have all the sub-threads as children.
146 If this variable is `adopt', Gnus will make one of the \"children\"
147 the parent and mark all the step-children as such.
148 If this variable is `empty', the \"children\" are printed with empty
149 subject fields. (Or rather, they will be printed with a string
150 given by the `gnus-summary-same-subject' variable.)"
152 :type
'(choice (const :tag
"off" nil
)
158 (defcustom gnus-summary-make-false-root-always nil
159 "Always make a false dummy root."
164 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
165 "*A regexp to match subjects to be excluded from loose thread gathering.
166 As loose thread gathering is done on subjects only, that means that
167 there can be many false gatherings performed. By rooting out certain
168 common subjects, gathering might become saner."
172 (defcustom gnus-summary-gather-subject-limit nil
173 "*Maximum length of subject comparisons when gathering loose threads.
174 Use nil to compare full subjects. Setting this variable to a low
175 number will help gather threads that have been corrupted by
176 newsreaders chopping off subject lines, but it might also mean that
177 unrelated articles that have subject that happen to begin with the
178 same few characters will be incorrectly gathered.
180 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
183 :type
'(choice (const :tag
"off" nil
)
185 (sexp :menu-tag
"on" t
)))
187 (defcustom gnus-simplify-subject-functions nil
188 "List of functions taking a string argument that simplify subjects.
189 The functions are applied recursively.
191 Useful functions to put in this list include:
192 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
193 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
195 :type
'(repeat function
))
197 (defcustom gnus-simplify-ignored-prefixes nil
198 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
200 :type
'(choice (const :tag
"off" nil
)
203 (defcustom gnus-build-sparse-threads nil
204 "*If non-nil, fill in the gaps in threads.
205 If `some', only fill in the gaps that are needed to tie loose threads
206 together. If `more', fill in all leaf nodes that Gnus can find. If
207 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
209 :type
'(choice (const :tag
"off" nil
)
212 (sexp :menu-tag
"all" t
)))
214 (defcustom gnus-summary-thread-gathering-function
215 'gnus-gather-threads-by-subject
216 "*Function used for gathering loose threads.
217 There are two pre-defined functions: `gnus-gather-threads-by-subject',
218 which only takes Subjects into consideration; and
219 `gnus-gather-threads-by-references', which compared the References
220 headers of the articles to find matches."
222 :type
'(radio (function-item gnus-gather-threads-by-subject
)
223 (function-item gnus-gather-threads-by-references
)
224 (function :tag
"other")))
226 (defcustom gnus-summary-same-subject
""
227 "*String indicating that the current article has the same subject as the previous.
228 This variable will only be used if the value of
229 `gnus-summary-make-false-root' is `empty'."
230 :group
'gnus-summary-format
233 (defcustom gnus-summary-goto-unread nil
234 "*If t, many commands will go to the next unread article.
235 This applies to marking commands as well as other commands that
236 \"naturally\" select the next article, like, for instance, `SPC' at
237 the end of an article.
239 If nil, the marking commands do NOT go to the next unread article
240 \(they go to the next article instead). If `never', commands that
241 usually go to the next unread article, will go to the next article,
242 whether it is read or not."
244 :group
'gnus-summary-marks
245 :link
'(custom-manual "(gnus)Setting Marks")
246 :type
'(choice (const :tag
"off" nil
)
248 (sexp :menu-tag
"on" t
)))
250 (defcustom gnus-summary-default-score
0
251 "*Default article score level.
252 All scores generated by the score files will be added to this score.
253 If this variable is nil, scoring will be disabled."
254 :group
'gnus-score-default
255 :type
'(choice (const :tag
"disable")
258 (defcustom gnus-summary-default-high-score
0
259 "*Default threshold for a high scored article.
260 An article will be highlighted as high scored if its score is greater
263 :group
'gnus-score-default
266 (defcustom gnus-summary-default-low-score
0
267 "*Default threshold for a low scored article.
268 An article will be highlighted as low scored if its score is smaller
271 :group
'gnus-score-default
274 (defcustom gnus-summary-zcore-fuzz
0
275 "*Fuzziness factor for the zcore in the summary buffer.
276 Articles with scores closer than this to `gnus-summary-default-score'
278 :group
'gnus-summary-format
281 (defcustom gnus-simplify-subject-fuzzy-regexp nil
282 "*Strings to be removed when doing fuzzy matches.
283 This can either be a regular expression or list of regular expressions
284 that will be removed from subject strings if fuzzy subject
285 simplification is selected."
287 :type
'(repeat regexp
))
289 (defcustom gnus-show-threads t
290 "*If non-nil, display threads in summary mode."
294 (defcustom gnus-thread-hide-subtree nil
295 "*If non-nil, hide all threads initially.
296 This can be a predicate specifier which says which threads to hide.
297 If threads are hidden, you have to run the command
298 `gnus-summary-show-thread' by hand or select an article."
300 :type
'(radio (sexp :format
"Non-nil\n"
301 :match
(lambda (widget value
)
302 (not (or (consp value
) (functionp value
))))
305 (sexp :tag
"Predicate specifier")))
307 (defcustom gnus-thread-hide-killed t
308 "*If non-nil, hide killed threads automatically."
312 (defcustom gnus-thread-ignore-subject t
313 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
314 If nil, articles that have different subjects from their parents will
315 start separate threads."
319 (defcustom gnus-thread-operation-ignore-subject t
320 "*If non-nil, subjects will be ignored when doing thread commands.
321 This affects commands like `gnus-summary-kill-thread' and
322 `gnus-summary-lower-thread'.
324 If this variable is nil, articles in the same thread with different
325 subjects will not be included in the operation in question. If this
326 variable is `fuzzy', only articles that have subjects that are fuzzily
327 equal will be included."
329 :type
'(choice (const :tag
"off" nil
)
333 (defcustom gnus-thread-indent-level
4
334 "*Number that says how much each sub-thread should be indented."
338 (defcustom gnus-auto-extend-newsgroup t
339 "*If non-nil, extend newsgroup forward and backward when requested."
340 :group
'gnus-summary-choose
343 (defcustom gnus-auto-select-first t
344 "If non-nil, select an article on group entry.
345 An article is selected automatically when entering a group
346 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
347 `gnus-summary-catchup-and-goto-next-group'.
349 Which article is selected is controlled by the variable
350 `gnus-auto-select-subject'.
352 If you want to prevent automatic selection of articles in some
353 newsgroups, set the variable to nil in `gnus-select-group-hook'."
354 ;; Commands include...
355 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
356 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
357 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
358 :group
'gnus-group-select
359 :type
'(choice (const :tag
"none" nil
)
360 (sexp :menu-tag
"first" t
)))
362 (defcustom gnus-auto-select-subject
'unseen-or-unread
363 "*Says what subject to place under point when entering a group.
365 This variable can either be the symbols `first' (place point on the
366 first subject), `unread' (place point on the subject line of the first
367 unread article), `best' (place point on the subject line of the
368 highest-scored article), `unseen' (place point on the subject line of
369 the first unseen article), `unseen-or-unread' (place point on the subject
370 line of the first unseen article or, if all articles have been seen, on the
371 subject line of the first unread article), or a function to be called to
372 place point on some subject line."
374 :group
'gnus-group-select
375 :type
'(choice (const best
)
379 (const unseen-or-unread
)
380 (function :tag
"Function to call")))
382 (defcustom gnus-auto-select-next t
383 "*If non-nil, offer to go to the next group from the end of the previous.
384 If the value is t and the next newsgroup is empty, Gnus will exit
385 summary mode and go back to group mode. If the value is neither nil
386 nor t, Gnus will select the following unread newsgroup. In
387 particular, if the value is the symbol `quietly', the next unread
388 newsgroup will be selected without any confirmation, and if it is
389 `almost-quietly', the next group will be selected without any
390 confirmation if you are located on the last article in the group.
391 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
392 will go to the next group without confirmation."
393 :group
'gnus-summary-maneuvering
394 :type
'(choice (const :tag
"off" nil
)
396 (const almost-quietly
)
397 (const slightly-quietly
)
398 (sexp :menu-tag
"on" t
)))
400 (defcustom gnus-auto-select-same nil
401 "*If non-nil, select the next article with the same subject.
402 If there are no more articles with the same subject, go to
403 the first unread article."
404 :group
'gnus-summary-maneuvering
407 (defcustom gnus-auto-select-on-ephemeral-exit
'next-noselect
408 "What article should be selected after exiting an ephemeral group.
409 Valid values include:
412 Select the next article.
414 Select the next unread article.
416 Move the cursor to the next article. This is the default.
417 `next-unread-noselect'
418 Move the cursor to the next unread article.
420 If it has any other value or there is no next (unread) article, the
421 article selected before entering to the ephemeral group will appear."
422 :version
"23.1" ;; No Gnus
423 :group
'gnus-summary-maneuvering
424 :type
'(choice :format
"%{%t%}:\n %[Value Menu%] %v"
425 (const next
) (const next-unread
)
426 (const next-noselect
) (const next-unread-noselect
)
427 (sexp :tag
"other" :value nil
)))
429 (defcustom gnus-auto-goto-ignores
'unfetched
430 "*Says how to handle unfetched articles when maneuvering.
432 This variable can either be the symbols nil (maneuver to any
433 article), `undownloaded' (maneuvering while unplugged ignores articles
434 that have not been fetched), `always-undownloaded' (maneuvering always
435 ignores articles that have not been fetched), `unfetched' (maneuvering
436 ignores articles whose headers have not been fetched).
438 NOTE: The list of unfetched articles will always be nil when plugged
439 and, when unplugged, a subset of the undownloaded article list."
441 :group
'gnus-summary-maneuvering
442 :type
'(choice (const :tag
"None" nil
)
443 (const :tag
"Undownloaded when unplugged" undownloaded
)
444 (const :tag
"Undownloaded" always-undownloaded
)
445 (const :tag
"Unfetched" unfetched
)))
447 (defcustom gnus-summary-check-current nil
448 "*If non-nil, consider the current article when moving.
449 The \"unread\" movement commands will stay on the same line if the
450 current article is unread."
451 :group
'gnus-summary-maneuvering
454 (defcustom gnus-auto-center-summary
455 (max (or (bound-and-true-p scroll-margin
) 0) 2)
456 "*If non-nil, always center the current summary buffer.
457 In particular, if `vertical' do only vertical recentering. If non-nil
458 and non-`vertical', do both horizontal and vertical recentering."
459 :group
'gnus-summary-maneuvering
460 :type
'(choice (const :tag
"none" nil
)
462 (integer :tag
"height")
463 (sexp :menu-tag
"both" t
)))
465 (defcustom gnus-auto-center-group t
466 "If non-nil, always center the group buffer."
467 :group
'gnus-summary-maneuvering
470 (defcustom gnus-show-all-headers nil
471 "*If non-nil, don't hide any headers."
472 :group
'gnus-article-hiding
473 :group
'gnus-article-headers
476 (defcustom gnus-summary-ignore-duplicates nil
477 "*If non-nil, ignore articles with identical Message-ID headers."
481 (defcustom gnus-single-article-buffer nil
482 "*If non-nil, display all articles in the same buffer.
483 If nil, each group will get its own article buffer."
485 :group
'gnus-article-various
488 (defcustom gnus-widen-article-window nil
489 "If non-nil, selecting the article buffer will display only the article buffer."
491 :group
'gnus-article-various
494 (defcustom gnus-break-pages t
495 "*If non-nil, do page breaking on articles.
496 The page delimiter is specified by the `gnus-page-delimiter'
498 :group
'gnus-article-various
501 (defcustom gnus-move-split-methods nil
502 "*Variable used to suggest where articles are to be moved to.
503 It uses the same syntax as the `gnus-split-methods' variable.
504 However, whereas `gnus-split-methods' specifies file names as targets,
505 this variable specifies group names."
506 :group
'gnus-summary-mail
507 :type
'(repeat (choice (list :value
(fun) function
)
508 (cons :value
("" "") regexp
(repeat string
))
511 (defcustom gnus-move-group-prefix-function
'gnus-group-real-prefix
512 "Function used to compute default prefix for article move/copy/etc prompts.
513 The function should take one argument, a group name, and return a
514 string with the suggested prefix."
515 :group
'gnus-summary-mail
518 ;; FIXME: Although the custom type is `character' for the following variables,
519 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
521 (defcustom gnus-unread-mark ?
;Whitespace
522 "*Mark used for unread articles."
523 :group
'gnus-summary-marks
526 (defcustom gnus-ticked-mark ?
!
527 "*Mark used for ticked articles."
528 :group
'gnus-summary-marks
531 (defcustom gnus-dormant-mark ??
532 "*Mark used for dormant articles."
533 :group
'gnus-summary-marks
536 (defcustom gnus-del-mark ?r
537 "*Mark used for del'd articles."
538 :group
'gnus-summary-marks
541 (defcustom gnus-read-mark ?R
542 "*Mark used for read articles."
543 :group
'gnus-summary-marks
546 (defcustom gnus-expirable-mark ?E
547 "*Mark used for expirable articles."
548 :group
'gnus-summary-marks
551 (defcustom gnus-killed-mark ?K
552 "*Mark used for killed articles."
553 :group
'gnus-summary-marks
556 (defcustom gnus-spam-mark ?$
557 "*Mark used for spam articles."
559 :group
'gnus-summary-marks
562 (defcustom gnus-kill-file-mark ?X
563 "*Mark used for articles killed by kill files."
564 :group
'gnus-summary-marks
567 (defcustom gnus-low-score-mark ?Y
568 "*Mark used for articles with a low score."
569 :group
'gnus-summary-marks
572 (defcustom gnus-catchup-mark ?C
573 "*Mark used for articles that are caught up."
574 :group
'gnus-summary-marks
577 (defcustom gnus-replied-mark ?A
578 "*Mark used for articles that have been replied to."
579 :group
'gnus-summary-marks
582 (defcustom gnus-forwarded-mark ?F
583 "*Mark used for articles that have been forwarded."
585 :group
'gnus-summary-marks
588 (defcustom gnus-recent-mark ?N
589 "*Mark used for articles that are recent."
591 :group
'gnus-summary-marks
594 (defcustom gnus-cached-mark ?
*
595 "*Mark used for articles that are in the cache."
596 :group
'gnus-summary-marks
599 (defcustom gnus-saved-mark ?S
600 "*Mark used for articles that have been saved."
601 :group
'gnus-summary-marks
604 (defcustom gnus-unseen-mark ?.
605 "*Mark used for articles that haven't been seen."
607 :group
'gnus-summary-marks
610 (defcustom gnus-no-mark ?
;Whitespace
611 "*Mark used for articles that have no other secondary mark."
613 :group
'gnus-summary-marks
616 (defcustom gnus-ancient-mark ?O
617 "*Mark used for ancient articles."
618 :group
'gnus-summary-marks
621 (defcustom gnus-sparse-mark ?Q
622 "*Mark used for sparsely reffed articles."
623 :group
'gnus-summary-marks
626 (defcustom gnus-canceled-mark ?G
627 "*Mark used for canceled articles."
628 :group
'gnus-summary-marks
631 (defcustom gnus-duplicate-mark ?M
632 "*Mark used for duplicate articles."
633 :group
'gnus-summary-marks
636 (defcustom gnus-undownloaded-mark ?-
637 "*Mark used for articles that weren't downloaded."
639 :group
'gnus-summary-marks
642 (defcustom gnus-downloaded-mark ?
+
643 "*Mark used for articles that were downloaded."
644 :group
'gnus-summary-marks
647 (defcustom gnus-downloadable-mark ?%
648 "*Mark used for articles that are to be downloaded."
649 :group
'gnus-summary-marks
652 (defcustom gnus-unsendable-mark ?
=
653 "*Mark used for articles that won't be sent."
654 :group
'gnus-summary-marks
657 (defcustom gnus-score-over-mark ?
+
658 "*Score mark used for articles with high scores."
659 :group
'gnus-summary-marks
662 (defcustom gnus-score-below-mark ?-
663 "*Score mark used for articles with low scores."
664 :group
'gnus-summary-marks
667 (defcustom gnus-empty-thread-mark ?
;Whitespace
668 "*There is no thread under the article."
669 :group
'gnus-summary-marks
672 (defcustom gnus-not-empty-thread-mark ?
=
673 "*There is a thread under the article."
674 :group
'gnus-summary-marks
677 (defcustom gnus-view-pseudo-asynchronously nil
678 "*If non-nil, Gnus will view pseudo-articles asynchronously."
679 :group
'gnus-extract-view
682 (defcustom gnus-auto-expirable-marks
683 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
684 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
686 "*The list of marks converted into expiration if a group is auto-expirable."
689 :type
'(repeat character
))
691 (defcustom gnus-inhibit-user-auto-expire t
692 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
697 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
698 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
699 If nil, the expirable marks will be unchanged except that the marks
700 will be removed when copying or moving articles to a group that has
701 not turned auto-expire on. If non-nil, articles that have been read
702 will be marked as expirable when being copied or moved to a group in
703 which auto-expire is turned on."
706 :group
'gnus-summary-marks
)
708 (defcustom gnus-view-pseudos nil
709 "*If `automatic', pseudo-articles will be viewed automatically.
710 If `not-confirm', pseudos will be viewed automatically, and the user
711 will not be asked to confirm the command."
712 :group
'gnus-extract-view
713 :type
'(choice (const :tag
"off" nil
)
715 (const not-confirm
)))
717 (defcustom gnus-view-pseudos-separately t
718 "*If non-nil, one pseudo-article will be created for each file to be viewed.
719 If nil, all files that use the same viewing command will be given as a
720 list of parameters to that command."
721 :group
'gnus-extract-view
724 (defcustom gnus-insert-pseudo-articles t
725 "*If non-nil, insert pseudo-articles when decoding articles."
726 :group
'gnus-extract-view
729 (defcustom gnus-summary-dummy-line-format
731 "*The format specification for the dummy roots in the summary buffer.
732 It works along the same lines as a normal formatting string,
733 with some simple extensions.
737 General format specifiers can also be used.
738 See `(gnus)Formatting Variables'."
739 :link
'(custom-manual "(gnus)Formatting Variables")
740 :group
'gnus-threading
743 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
744 "*The format specification for the summary mode line.
745 It works along the same lines as a normal formatting string,
746 with some simple extensions:
749 %p Unprefixed group name
750 %A Current article number
751 %z Current article score
753 %U Number of unread articles in the group
754 %e Number of unselected articles in the group
755 %Z A string with unread/unselected article counts
756 %g Shortish group name
757 %S Subject of the current article
759 %s Current score file name
760 %d Number of dormant articles
761 %r Number of articles that have been marked as read in this session
762 %E Number of articles expunged by the score files"
763 :group
'gnus-summary-format
766 (defcustom gnus-list-identifiers nil
767 "Regexp that matches list identifiers to be removed from subject.
768 This can also be a list of regexps."
770 :group
'gnus-summary-format
771 :group
'gnus-article-hiding
772 :type
'(choice (const :tag
"none" nil
)
774 (repeat :value
(".*") regexp
)))
776 (defcustom gnus-summary-mark-below
0
777 "*Mark all articles with a score below this variable as read.
778 This variable is local to each summary buffer and usually set by the
780 :group
'gnus-score-default
783 (defun gnus-widget-reversible-match (widget value
)
784 "Ignoring WIDGET, convert VALUE to internal form.
785 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
789 (eq (length value
) 2)
790 (eq (nth 0 value
) 'not
)
791 (symbolp (nth 1 value
)))))
793 (defun gnus-widget-reversible-to-internal (widget value
)
794 "Ignoring WIDGET, convert VALUE to internal form.
795 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
796 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
800 (list (nth 1 value
) t
)))
802 (defun gnus-widget-reversible-to-external (widget value
)
803 "Ignoring WIDGET, convert VALUE to external form.
804 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
805 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
808 (list 'not
(nth 0 value
))
811 (define-widget 'gnus-widget-reversible
'group
812 "A `group' that convert values."
813 :match
'gnus-widget-reversible-match
814 :value-to-internal
'gnus-widget-reversible-to-internal
815 :value-to-external
'gnus-widget-reversible-to-external
)
817 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
818 "*List of functions used for sorting articles in the summary buffer.
820 Each function takes two articles and returns non-nil if the first
821 article should be sorted before the other. If you use more than one
822 function, the primary sort function should be the last. You should
823 probably always include `gnus-article-sort-by-number' in the list of
824 sorting functions -- preferably first. Also note that sorting by date
825 is often much slower than sorting by number, and the sorting order is
826 very similar. (Sorting by date means sorting by the time the message
827 was sent, sorting by number means sorting by arrival time.)
829 Each item can also be a list `(not F)' where F is a function;
830 this reverses the sort order.
832 Ready-made functions include `gnus-article-sort-by-number',
833 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
834 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
835 and `gnus-article-sort-by-score'.
837 When threading is turned on, the variable `gnus-thread-sort-functions'
838 controls how articles are sorted."
839 :group
'gnus-summary-sort
840 :type
'(repeat (gnus-widget-reversible
841 (choice (function-item gnus-article-sort-by-number
)
842 (function-item gnus-article-sort-by-author
)
843 (function-item gnus-article-sort-by-subject
)
844 (function-item gnus-article-sort-by-date
)
845 (function-item gnus-article-sort-by-score
)
846 (function-item gnus-article-sort-by-random
)
847 (function :tag
"other"))
848 (boolean :tag
"Reverse order"))))
851 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
852 "*List of functions used for sorting threads in the summary buffer.
853 By default, threads are sorted by article number.
855 Each function takes two threads and returns non-nil if the first
856 thread should be sorted before the other. If you use more than one
857 function, the primary sort function should be the last. You should
858 probably always include `gnus-thread-sort-by-number' in the list of
859 sorting functions -- preferably first. Also note that sorting by date
860 is often much slower than sorting by number, and the sorting order is
861 very similar. (Sorting by date means sorting by the time the message
862 was sent, sorting by number means sorting by arrival time.)
864 Each list item can also be a list `(not F)' where F is a
865 function; this specifies reversed sort order.
867 Ready-made functions include `gnus-thread-sort-by-number',
868 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
869 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
870 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
871 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
872 and `gnus-thread-sort-by-total-score' (see
873 `gnus-thread-score-function').
875 When threading is turned off, the variable
876 `gnus-article-sort-functions' controls how articles are sorted."
877 :group
'gnus-summary-sort
879 (gnus-widget-reversible
880 (choice (function-item gnus-thread-sort-by-number
)
881 (function-item gnus-thread-sort-by-author
)
882 (function-item gnus-thread-sort-by-recipient
)
883 (function-item gnus-thread-sort-by-subject
)
884 (function-item gnus-thread-sort-by-date
)
885 (function-item gnus-thread-sort-by-score
)
886 (function-item gnus-thread-sort-by-most-recent-number
)
887 (function-item gnus-thread-sort-by-most-recent-date
)
888 (function-item gnus-thread-sort-by-random
)
889 (function-item gnus-thread-sort-by-total-score
)
890 (function :tag
"other"))
891 (boolean :tag
"Reverse order"))))
893 (defcustom gnus-thread-score-function
'+
894 "*Function used for calculating the total score of a thread.
896 The function is called with the scores of the article and each
897 subthread and should then return the score of the thread.
899 Some functions you can use are `+', `max', or `min'."
900 :group
'gnus-summary-sort
903 (defcustom gnus-summary-expunge-below nil
904 "All articles that have a score less than this variable will be expunged.
905 This variable is local to the summary buffers."
906 :group
'gnus-score-default
907 :type
'(choice (const :tag
"off" nil
)
910 (defcustom gnus-thread-expunge-below nil
911 "All threads that have a total score less than this variable will be expunged.
912 See `gnus-thread-score-function' for en explanation of what a
915 This variable is local to the summary buffers."
916 :group
'gnus-threading
917 :group
'gnus-score-default
918 :type
'(choice (const :tag
"off" nil
)
921 (defcustom gnus-summary-mode-hook nil
922 "*A hook for Gnus summary mode.
923 This hook is run before any variables are set in the summary buffer."
924 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
925 :group
'gnus-summary-various
928 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
929 (when (featurep 'xemacs
)
930 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
931 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
932 (add-hook 'gnus-summary-mode-hook
933 'gnus-xmas-switch-horizontal-scrollbar-off
))
935 (defcustom gnus-summary-menu-hook nil
936 "*Hook run after the creation of the summary mode menu."
937 :group
'gnus-summary-visual
940 (defcustom gnus-summary-exit-hook nil
941 "*A hook called on exit from the summary buffer.
942 It will be called with point in the group buffer."
943 :group
'gnus-summary-exit
946 (defcustom gnus-summary-prepare-hook nil
947 "*A hook called after the summary buffer has been generated.
948 If you want to modify the summary buffer, you can use this hook."
949 :group
'gnus-summary-various
952 (defcustom gnus-summary-prepared-hook nil
953 "*A hook called as the last thing after the summary buffer has been generated."
954 :group
'gnus-summary-various
957 (defcustom gnus-summary-generate-hook nil
958 "*A hook run just before generating the summary buffer.
959 This hook is commonly used to customize threading variables and the
961 :group
'gnus-summary-various
964 (defcustom gnus-select-group-hook nil
965 "*A hook called when a newsgroup is selected.
967 If you'd like to simplify subjects like the
968 `gnus-summary-next-same-subject' command does, you can use the
971 (add-hook gnus-select-group-hook
973 (mapcar (lambda (header)
974 (mail-header-set-subject
976 (gnus-simplify-subject
977 (mail-header-subject header) 're-only)))
978 gnus-newsgroup-headers)))"
979 :group
'gnus-group-select
982 (defcustom gnus-select-article-hook nil
983 "*A hook called when an article is selected."
984 :group
'gnus-summary-choose
985 :options
'(gnus-agent-fetch-selected-article)
988 (defcustom gnus-visual-mark-article-hook
989 (list 'gnus-highlight-selected-summary
)
990 "*Hook run after selecting an article in the summary buffer.
991 It is meant to be used for highlighting the article in some way. It
992 is not run if `gnus-visual' is nil."
993 :group
'gnus-summary-visual
996 (defcustom gnus-parse-headers-hook nil
997 "*A hook called before parsing the headers."
1001 (defcustom gnus-exit-group-hook nil
1002 "*A hook called when exiting summary mode.
1003 This hook is not called from the non-updating exit commands like `Q'."
1004 :group
'gnus-various
1007 (defcustom gnus-summary-update-hook nil
1008 "*A hook called when a summary line is changed.
1009 The hook will not be called if `gnus-visual' is nil.
1011 The default function `gnus-summary-highlight-line' will
1012 highlight the line according to the `gnus-summary-highlight'
1014 :group
'gnus-summary-visual
1017 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
1018 "*A hook called when an article is selected for the first time.
1019 The hook is intended to mark an article as read (or unread)
1020 automatically when it is selected."
1021 :group
'gnus-summary-choose
1024 (defcustom gnus-group-no-more-groups-hook nil
1025 "*A hook run when returning to group mode having no more (unread) groups."
1026 :group
'gnus-group-select
1029 (defcustom gnus-ps-print-hook nil
1030 "*A hook run before ps-printing something from Gnus."
1031 :group
'gnus-summary
1034 (defcustom gnus-summary-article-move-hook nil
1035 "*A hook called after an article is moved, copied, respooled, or crossposted."
1037 :group
'gnus-summary
1040 (defcustom gnus-summary-article-delete-hook nil
1041 "*A hook called after an article is deleted."
1043 :group
'gnus-summary
1046 (defcustom gnus-summary-article-expire-hook nil
1047 "*A hook called after an article is expired."
1049 :group
'gnus-summary
1052 (defcustom gnus-summary-display-arrow
1053 (and (fboundp 'display-graphic-p
)
1054 (display-graphic-p))
1055 "*If non-nil, display an arrow highlighting the current article."
1057 :group
'gnus-summary
1060 (defcustom gnus-summary-selected-face
'gnus-summary-selected
1061 "Face used for highlighting the current article in the summary buffer."
1062 :group
'gnus-summary-visual
1065 (defvar gnus-tmp-downloaded nil
)
1067 (defcustom gnus-summary-highlight
1068 '(((eq mark gnus-canceled-mark
)
1069 . gnus-summary-cancelled
)
1070 ((and uncached
(> score default-high
))
1071 . gnus-summary-high-undownloaded
)
1072 ((and uncached
(< score default-low
))
1073 . gnus-summary-low-undownloaded
)
1075 . gnus-summary-normal-undownloaded
)
1076 ((and (> score default-high
)
1077 (or (eq mark gnus-dormant-mark
)
1078 (eq mark gnus-ticked-mark
)))
1079 . gnus-summary-high-ticked
)
1080 ((and (< score default-low
)
1081 (or (eq mark gnus-dormant-mark
)
1082 (eq mark gnus-ticked-mark
)))
1083 . gnus-summary-low-ticked
)
1084 ((or (eq mark gnus-dormant-mark
)
1085 (eq mark gnus-ticked-mark
))
1086 . gnus-summary-normal-ticked
)
1087 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
1088 . gnus-summary-high-ancient
)
1089 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
1090 . gnus-summary-low-ancient
)
1091 ((eq mark gnus-ancient-mark
)
1092 . gnus-summary-normal-ancient
)
1093 ((and (> score default-high
) (eq mark gnus-unread-mark
))
1094 . gnus-summary-high-unread
)
1095 ((and (< score default-low
) (eq mark gnus-unread-mark
))
1096 . gnus-summary-low-unread
)
1097 ((eq mark gnus-unread-mark
)
1098 . gnus-summary-normal-unread
)
1099 ((> score default-high
)
1100 . gnus-summary-high-read
)
1101 ((< score default-low
)
1102 . gnus-summary-low-read
)
1104 . gnus-summary-normal-read
))
1105 "*Controls the highlighting of summary buffer lines.
1107 A list of (FORM . FACE) pairs. When deciding how a particular
1108 summary line should be displayed, each form is evaluated. The content
1109 of the face field after the first true form is used. You can change
1110 how those summary lines are displayed, by editing the face field.
1112 You can use the following variables in the FORM field.
1114 score: The article's score.
1115 default: The default article score.
1116 default-high: The default score for high scored articles.
1117 default-low: The default score for low scored articles.
1118 below: The score below which articles are automatically marked as read.
1119 mark: The article's mark.
1120 uncached: Non-nil if the article is uncached."
1121 :group
'gnus-summary-visual
1122 :type
'(repeat (cons (sexp :tag
"Form" nil
)
1124 (put 'gnus-summary-highlight
'risky-local-variable t
)
1126 (defcustom gnus-alter-header-function nil
1127 "Function called to allow alteration of article header structures.
1128 The function is called with one parameter, the article header vector,
1129 which it may alter in any way."
1130 :type
'(choice (const :tag
"None" nil
)
1132 :group
'gnus-summary
)
1134 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
1135 "Function used to decode a string with encoded words.")
1137 (defvar gnus-decode-encoded-address-function
1138 'mail-decode-encoded-address-string
1139 "Function used to decode addresses with encoded words.")
1141 (defcustom gnus-extra-headers
'(To Cc Keywords Gcc Newsgroups
)
1142 "*Extra headers to parse."
1143 :version
"24.1" ; added Cc Keywords Gcc
1144 :group
'gnus-summary
1145 :type
'(repeat symbol
))
1147 (defcustom gnus-ignored-from-addresses
1148 (and user-mail-address
1149 (not (string= user-mail-address
""))
1150 (regexp-quote user-mail-address
))
1151 "*From headers that may be suppressed in favor of To headers.
1152 This can be a regexp or a list of regexps."
1154 :group
'gnus-summary
1155 :type
'(choice regexp
1156 (repeat :tag
"Regexp List" regexp
)))
1158 (defsubst gnus-ignored-from-addresses
()
1159 (gmm-regexp-concat gnus-ignored-from-addresses
))
1161 (defcustom gnus-summary-to-prefix
"-> "
1162 "*String prefixed to the To field in the summary line when
1163 using `gnus-ignored-from-addresses'."
1165 :group
'gnus-summary
1168 (defcustom gnus-summary-newsgroup-prefix
"=> "
1169 "*String prefixed to the Newsgroup field in the summary
1170 line when using the option `gnus-ignored-from-addresses'."
1172 :group
'gnus-summary
1175 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1176 "List of charsets that should be ignored.
1177 When these charsets are used in the \"charset\" parameter, the
1178 default charset will be used instead."
1180 :type
'(repeat symbol
)
1181 :group
'gnus-charset
)
1183 (defcustom gnus-newsgroup-maximum-articles nil
1184 "The maximum number of articles a newsgroup.
1185 If this is a number, old articles in a newsgroup exceeding this number
1186 are silently ignored. If it is nil, no article is ignored. Note that
1187 setting this variable to a number might prevent you from reading very
1189 :group
'gnus-group-select
1191 :type
'(choice (const :tag
"No limit" nil
)
1194 (gnus-define-group-parameter
1198 "Return the ignored charsets of GROUP."
1199 :variable gnus-group-ignored-charsets-alist
1201 '(("alt\\.chinese\\.text" iso-8859-1
))
1203 "Alist of regexps (to match group names) and charsets that should be ignored.
1204 When these charsets are used in the \"charset\" parameter, the
1205 default charset will be used instead."
1206 :variable-group gnus-charset
1207 :variable-type
'(repeat (cons (regexp :tag
"Group")
1209 :parameter-type
'(choice :tag
"Ignored charsets"
1212 :parameter-document
"\
1213 List of charsets that should be ignored.
1215 When these charsets are used in the \"charset\" parameter, the
1216 default charset will be used instead.")
1218 (defcustom gnus-group-highlight-words-alist nil
1219 "Alist of group regexps and highlight regexps.
1220 This variable uses the same syntax as `gnus-emphasis-alist'."
1222 :type
'(repeat (cons (regexp :tag
"Group")
1223 (repeat (list (regexp :tag
"Highlight regexp")
1224 (number :tag
"Group for entire word" 0)
1225 (number :tag
"Group for displayed part" 0)
1227 gnus-emphasis-highlight-words
)))))
1228 :group
'gnus-summary-visual
)
1230 (defcustom gnus-summary-show-article-charset-alist
1232 "Alist of number and charset.
1233 The article will be shown with the charset corresponding to the
1235 For example: ((1 . cn-gb-2312) (2 . big5))."
1237 :type
'(repeat (cons (number :tag
"Argument" 1)
1238 (symbol :tag
"Charset")))
1239 :group
'gnus-charset
)
1241 (defcustom gnus-preserve-marks t
1242 "Whether marks are preserved when moving, copying and respooling messages."
1245 :group
'gnus-summary-marks
)
1247 (defcustom gnus-alter-articles-to-read-function nil
1248 "Function to be called to alter the list of articles to be selected."
1249 :type
'(choice (const nil
) function
)
1250 :group
'gnus-summary
)
1252 (defcustom gnus-orphan-score nil
1253 "*All orphans get this score added. Set in the score file."
1254 :group
'gnus-score-default
1255 :type
'(choice (const nil
)
1258 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1259 "*A regexp to match MIME parts when saving multiple parts of a
1260 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1261 This regexp will be used by default when prompting the user for which
1262 type of files to save."
1263 :group
'gnus-summary
1266 (defcustom gnus-read-all-available-headers nil
1267 "Whether Gnus should parse all headers made available to it.
1268 This is mostly relevant for slow back ends where the user may
1269 wish to widen the summary buffer to include all headers
1272 :group
'gnus-summary
1273 :type
'(choice boolean regexp
))
1275 (defcustom gnus-summary-pipe-output-default-command nil
1276 "Command (and optional arguments) used to pipe article to subprocess.
1277 This will be used as the default command if it is non-nil. The value
1278 will be updated if you modify it when executing the command
1279 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1280 :version
"23.1" ;; No Gnus
1281 :group
'gnus-summary
1282 :type
'(radio (const :tag
"None" nil
) (string :tag
"Command")))
1284 (defcustom gnus-summary-muttprint-program
"muttprint"
1285 "Command (and optional arguments) used to run Muttprint.
1286 The value will be updated if you modify it when executing the command
1287 `gnus-summary-muttprint'."
1289 :group
'gnus-summary
1292 (defcustom gnus-article-loose-mime t
1293 "If non-nil, don't require MIME-Version header.
1294 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1295 supply the MIME-Version header or deliberately strip it from the mail.
1296 If non-nil (the default), Gnus will treat some articles as MIME
1297 even if the MIME-Version header is missing."
1300 :group
'gnus-article-mime
)
1302 (defcustom gnus-article-emulate-mime t
1303 "If non-nil, use MIME emulation for uuencode and the like.
1304 This means that Gnus will search message bodies for text that look
1305 like uuencoded bits, yEncoded bits, and so on, and present that using
1306 the normal Gnus MIME machinery."
1309 :group
'gnus-article-mime
)
1311 ;;; Internal variables
1313 (defvar gnus-summary-display-cache nil
)
1314 (defvar gnus-article-mime-handles nil
)
1315 (defvar gnus-article-decoded-p nil
)
1316 (defvar gnus-article-charset nil
)
1317 (defvar gnus-article-ignored-charsets nil
)
1318 (defvar gnus-scores-exclude-files nil
)
1319 (defvar gnus-page-broken nil
)
1321 (defvar gnus-original-article nil
)
1322 (defvar gnus-article-internal-prepare-hook nil
)
1323 (defvar gnus-newsgroup-process-stack nil
)
1325 (defvar gnus-thread-indent-array nil
)
1326 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1327 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1328 "Function called to sort the articles within a thread after it has been gathered together.")
1330 (defvar gnus-summary-save-parts-type-history nil
)
1331 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1333 ;; Avoid highlighting in kill files.
1334 (defvar gnus-summary-inhibit-highlight nil
)
1335 (defvar gnus-newsgroup-selected-overlay nil
)
1336 (defvar gnus-inhibit-limiting nil
)
1337 (defvar gnus-newsgroup-adaptive-score-file nil
)
1338 (defvar gnus-current-score-file nil
)
1339 (defvar gnus-current-move-group nil
)
1340 (defvar gnus-current-copy-group nil
)
1341 (defvar gnus-current-crosspost-group nil
)
1342 (defvar gnus-newsgroup-display nil
)
1344 (defvar gnus-newsgroup-dependencies nil
)
1345 (defvar gnus-newsgroup-adaptive nil
)
1346 (defvar gnus-summary-display-article-function nil
)
1347 (defvar gnus-summary-highlight-line-function nil
1348 "Function called after highlighting a summary line.")
1350 (defvar gnus-summary-line-format-alist
1351 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1352 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1353 (?s gnus-tmp-subject-or-nil ?s
)
1354 (?n gnus-tmp-name ?s
)
1355 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1357 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1359 (?F gnus-tmp-from ?s
)
1360 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1361 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1362 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1363 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1364 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1365 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1366 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1367 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1368 (?L gnus-tmp-lines ?s
)
1369 (?Z
(or (nnir-article-rsv (mail-header-number gnus-tmp-header
))
1371 (?G
(or (nnir-article-group (mail-header-number gnus-tmp-header
))
1373 (?g
(or (gnus-group-short-name
1374 (nnir-article-group (mail-header-number gnus-tmp-header
)))
1376 (?O gnus-tmp-downloaded ?c
)
1377 (?I gnus-tmp-indentation ?s
)
1378 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1379 (?R gnus-tmp-replied ?c
)
1380 (?\
[ gnus-tmp-opening-bracket ?c
)
1381 (?\
] gnus-tmp-closing-bracket ?c
)
1382 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1383 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1384 (?i gnus-tmp-score ?d
)
1385 (?z gnus-tmp-score-char ?c
)
1386 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1387 (?U gnus-tmp-unread ?c
)
1388 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1390 (?t
(gnus-summary-number-of-articles-in-thread
1391 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1393 (?e
(gnus-summary-number-of-articles-in-thread
1394 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1396 (?u gnus-tmp-user-defined ?s
)
1397 (?P
(gnus-pick-line-number) ?d
)
1398 (?B gnus-tmp-thread-tree-header-string ?s
)
1399 (user-date (gnus-user-date
1400 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1401 "An alist of format specifications that can appear in summary lines.
1402 These are paired with what variables they correspond with, along with
1403 the type of the variable (string, integer, character, etc).")
1405 (defvar gnus-summary-dummy-line-format-alist
1406 `((?S gnus-tmp-subject ?s
)
1407 (?N gnus-tmp-number ?d
)
1408 (?u gnus-tmp-user-defined ?s
)))
1410 (defvar gnus-summary-mode-line-format-alist
1411 `((?G gnus-tmp-group-name ?s
)
1412 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1413 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1414 (?A gnus-tmp-article-number ?d
)
1415 (?Z gnus-tmp-unread-and-unselected ?s
)
1416 (?V gnus-version ?s
)
1417 (?U gnus-tmp-unread-and-unticked ?d
)
1418 (?S gnus-tmp-subject ?s
)
1419 (?e gnus-tmp-unselected ?d
)
1420 (?u gnus-tmp-user-defined ?s
)
1421 (?d
(length gnus-newsgroup-dormant
) ?d
)
1422 (?t
(length gnus-newsgroup-marked
) ?d
)
1423 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1424 (?r
(length gnus-newsgroup-reads
) ?d
)
1425 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1426 (?E gnus-newsgroup-expunged-tally ?d
)
1427 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1429 ;; This is here rather than in gnus-art for compilation reasons.
1430 (defvar gnus-article-mode-line-format-alist
1431 (nconc '((?w
(gnus-article-wash-status) ?s
)
1432 (?m
(gnus-article-mime-part-status) ?s
))
1433 gnus-summary-mode-line-format-alist
))
1435 (defvar gnus-last-search-regexp nil
1436 "Default regexp for article search command.")
1438 (defvar gnus-last-shell-command nil
1439 "Default shell command on article.")
1441 (defvar gnus-newsgroup-agentized nil
1442 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1443 (defvar gnus-newsgroup-begin nil
)
1444 (defvar gnus-newsgroup-end nil
)
1445 (defvar gnus-newsgroup-last-rmail nil
)
1446 (defvar gnus-newsgroup-last-mail nil
)
1447 (defvar gnus-newsgroup-last-folder nil
)
1448 (defvar gnus-newsgroup-last-file nil
)
1449 (defvar gnus-newsgroup-last-directory nil
)
1450 (defvar gnus-newsgroup-auto-expire nil
)
1451 (defvar gnus-newsgroup-active nil
)
1452 (defvar gnus-newsgroup-highest nil
)
1454 (defvar gnus-newsgroup-data nil
)
1455 (defvar gnus-newsgroup-data-reverse nil
)
1456 (defvar gnus-newsgroup-limit nil
)
1457 (defvar gnus-newsgroup-limits nil
)
1458 (defvar gnus-summary-use-undownloaded-faces nil
)
1460 (defvar gnus-newsgroup-unreads nil
1461 "Sorted list of unread articles in the current newsgroup.")
1463 (defvar gnus-newsgroup-unselected nil
1464 "Sorted list of unselected unread articles in the current newsgroup.")
1466 (defvar gnus-newsgroup-reads nil
1467 "Alist of read articles and article marks in the current newsgroup.")
1469 (defvar gnus-newsgroup-expunged-tally nil
)
1471 (defvar gnus-newsgroup-marked nil
1472 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1474 (defvar gnus-newsgroup-spam-marked nil
1475 "List of ranges of articles that have been marked as spam.")
1477 (defvar gnus-newsgroup-killed nil
1478 "List of ranges of articles that have been through the scoring process.")
1480 (defvar gnus-newsgroup-cached nil
1481 "Sorted list of articles that come from the article cache.")
1483 (defvar gnus-newsgroup-saved nil
1484 "List of articles that have been saved.")
1486 (defvar gnus-newsgroup-kill-headers nil
)
1488 (defvar gnus-newsgroup-replied nil
1489 "List of articles that have been replied to in the current newsgroup.")
1491 (defvar gnus-newsgroup-forwarded nil
1492 "List of articles that have been forwarded in the current newsgroup.")
1494 (defvar gnus-newsgroup-expirable nil
1495 "Sorted list of articles in the current newsgroup that can be expired.")
1497 (defvar gnus-newsgroup-processable nil
1498 "List of articles in the current newsgroup that can be processed.")
1500 (defvar gnus-newsgroup-downloadable nil
1501 "Sorted list of articles in the current newsgroup that can be processed.")
1503 (defvar gnus-newsgroup-unfetched nil
1504 "Sorted list of articles in the current newsgroup whose headers have
1505 not been fetched into the agent.
1507 This list will always be a subset of gnus-newsgroup-undownloaded.")
1509 (defvar gnus-newsgroup-undownloaded nil
1510 "List of articles in the current newsgroup that haven't been downloaded.")
1512 (defvar gnus-newsgroup-unsendable nil
1513 "List of articles in the current newsgroup that won't be sent.")
1515 (defvar gnus-newsgroup-bookmarks nil
1516 "List of articles in the current newsgroup that have bookmarks.")
1518 (defvar gnus-newsgroup-dormant nil
1519 "Sorted list of dormant articles in the current newsgroup.")
1521 (defvar gnus-newsgroup-unseen nil
1522 "List of unseen articles in the current newsgroup.")
1524 (defvar gnus-newsgroup-seen nil
1525 "Range of seen articles in the current newsgroup.")
1527 (defvar gnus-newsgroup-articles nil
1528 "List of articles in the current newsgroup.")
1530 (defvar gnus-newsgroup-scored nil
1531 "List of scored articles in the current newsgroup.")
1533 (defvar gnus-newsgroup-headers nil
1534 "List of article headers in the current newsgroup.")
1536 (defvar gnus-newsgroup-threads nil
)
1538 (defvar gnus-newsgroup-prepared nil
1539 "Whether the current group has been prepared properly.")
1541 (defvar gnus-newsgroup-ancient nil
1542 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1544 (defvar gnus-newsgroup-sparse nil
)
1546 (defvar gnus-current-article nil
)
1547 (defvar gnus-article-current nil
)
1548 (defvar gnus-current-headers nil
)
1549 (defvar gnus-have-all-headers nil
)
1550 (defvar gnus-last-article nil
)
1551 (defvar gnus-newsgroup-history nil
)
1552 (defvar gnus-newsgroup-charset nil
)
1553 (defvar gnus-newsgroup-ephemeral-charset nil
)
1554 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1556 (defvar gnus-article-before-search nil
)
1558 (defvar gnus-summary-local-variables
1559 '(gnus-newsgroup-name
1562 gnus-newsgroup-unreads
1563 gnus-newsgroup-unselected
1564 gnus-newsgroup-marked
1565 gnus-newsgroup-spam-marked
1566 gnus-newsgroup-reads
1567 gnus-newsgroup-saved
1568 gnus-newsgroup-replied
1569 gnus-newsgroup-forwarded
1570 gnus-newsgroup-expirable
1571 gnus-newsgroup-killed
1572 gnus-newsgroup-unseen
1574 gnus-newsgroup-cached
1575 gnus-newsgroup-downloadable
1576 gnus-newsgroup-undownloaded
1577 gnus-newsgroup-unsendable
1579 gnus-newsgroup-begin gnus-newsgroup-end
1580 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1581 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1582 gnus-newsgroup-last-directory
1583 gnus-newsgroup-auto-expire
1584 gnus-newsgroup-processable
1585 gnus-newsgroup-unfetched
1586 gnus-newsgroup-articles
1587 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1588 gnus-newsgroup-headers gnus-newsgroup-threads
1589 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1590 gnus-current-article gnus-current-headers gnus-have-all-headers
1591 gnus-last-article gnus-article-internal-prepare-hook
1592 (gnus-summary-article-delete-hook . global
)
1593 (gnus-summary-article-move-hook . global
)
1594 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1595 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1596 gnus-thread-expunge-below
1597 gnus-score-alist gnus-current-score-file
1598 (gnus-summary-expunge-below . global
)
1599 (gnus-summary-mark-below . global
)
1600 (gnus-orphan-score . global
)
1601 gnus-newsgroup-active gnus-scores-exclude-files
1602 gnus-newsgroup-highest
1603 gnus-newsgroup-history gnus-newsgroup-ancient
1604 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1605 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1606 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1607 (gnus-newsgroup-expunged-tally .
0)
1608 gnus-cache-removable-articles
1609 gnus-newsgroup-data gnus-newsgroup-data-reverse
1610 gnus-newsgroup-limit gnus-newsgroup-limits
1611 gnus-newsgroup-charset gnus-newsgroup-display
1612 gnus-summary-use-undownloaded-faces
)
1613 "Variables that are buffer-local to the summary buffers.")
1615 (defvar gnus-newsgroup-variables nil
1616 "A list of variables that have separate values in different newsgroups.
1617 A list of newsgroup (summary buffer) local variables, or cons of
1618 variables and their default expressions to be evalled (when the default
1619 values are not nil), that should be made global while the summary buffer
1622 Note: The default expressions will be evaluated (using function `eval')
1623 before assignment to the local variable rather than just assigned to it.
1624 If the default expression is the symbol `global', that symbol will not
1625 be evaluated but the global value of the local variable will be used
1628 These variables can be used to set variables in the group parameters
1629 while still allowing them to affect operations done in other buffers.
1632 \(setq gnus-newsgroup-variables
1633 '(message-use-followup-to
1634 (gnus-visible-headers .
1635 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1639 ;; Bind features so that require will believe that gnus-sum has
1640 ;; already been loaded (avoids infinite recursion)
1641 (let ((features (cons 'gnus-sum features
)))
1642 (require 'gnus-art
)))
1646 (defvar gnus-decode-encoded-word-methods
1647 '(mail-decode-encoded-word-string)
1648 "List of methods used to decode encoded words.
1650 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1651 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1652 \(REGEXP . FUNCTION), FUNCTION will be applied only to the newsgroups
1653 whose names match REGEXP.
1656 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1657 mail-decode-encoded-word-string
1658 (\"chinese\" . rfc1843-decode-string))")
1660 (defvar gnus-decode-encoded-word-methods-cache nil
)
1662 (defun gnus-multi-decode-encoded-word-string (string)
1663 "Apply the functions from `gnus-encoded-word-methods' that match."
1664 (unless (and gnus-decode-encoded-word-methods-cache
1665 (eq gnus-newsgroup-name
1666 (car gnus-decode-encoded-word-methods-cache
)))
1667 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1668 (dolist (method gnus-decode-encoded-word-methods
)
1669 (if (symbolp method
)
1670 (nconc gnus-decode-encoded-word-methods-cache
(list method
))
1671 (if (and gnus-newsgroup-name
1672 (string-match (car method
) gnus-newsgroup-name
))
1673 (nconc gnus-decode-encoded-word-methods-cache
1674 (list (cdr method
)))))))
1675 (dolist (method (cdr gnus-decode-encoded-word-methods-cache
) string
)
1676 (setq string
(funcall method string
))))
1678 ;; Subject simplification.
1680 (defun gnus-simplify-whitespace (str)
1681 "Remove excessive whitespace from STR."
1683 (while (string-match "[ \t][ \t]+" str
)
1684 (setq str
(concat (substring str
0 (match-beginning 0))
1686 (substring str
(match-end 0)))))
1688 (when (string-match "^[ \t]+" str
)
1689 (setq str
(substring str
(match-end 0))))
1691 (when (string-match "[ \t]+$" str
)
1692 (setq str
(substring str
0 (match-beginning 0))))
1695 (defun gnus-simplify-all-whitespace (str)
1696 "Remove all whitespace from STR."
1697 (while (string-match "[ \t\n]+" str
)
1698 (setq str
(replace-match "" nil nil str
)))
1701 (defsubst gnus-simplify-subject-re
(subject)
1702 "Remove \"Re:\" from subject lines."
1703 (if (string-match message-subject-re-regexp subject
)
1704 (substring subject
(match-end 0))
1707 (defun gnus-simplify-subject (subject &optional re-only
)
1708 "Remove `Re:' and words in parentheses.
1709 If RE-ONLY is non-nil, strip leading `Re:'s only."
1710 (let ((case-fold-search t
)) ;Ignore case.
1711 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1712 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1713 (setq subject
(substring subject
(match-end 0))))
1714 ;; Remove uninteresting prefixes.
1715 (when (and (not re-only
)
1716 gnus-simplify-ignored-prefixes
1717 (string-match gnus-simplify-ignored-prefixes subject
))
1718 (setq subject
(substring subject
(match-end 0))))
1719 ;; Remove words in parentheses from end.
1721 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1722 (setq subject
(substring subject
0 (match-beginning 0)))))
1723 ;; Return subject string.
1726 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1728 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1729 (goto-char (point-min))
1730 (while (re-search-forward regexp nil t
)
1731 (replace-match (or newtext
""))))
1733 (defun gnus-simplify-buffer-fuzzy (regexp)
1734 "Simplify string in the buffer fuzzily.
1735 The string in the accessible portion of the current buffer is simplified.
1736 It is assumed to be a single-line subject.
1737 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1738 matter is removed. Additional things can be deleted by setting
1739 `gnus-simplify-subject-fuzzy-regexp'."
1740 (let ((case-fold-search t
)
1742 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1744 (while (not (eq modified-tick
(buffer-modified-tick)))
1745 (setq modified-tick
(buffer-modified-tick))
1748 (mapc 'gnus-simplify-buffer-fuzzy-step regexp
))
1750 (gnus-simplify-buffer-fuzzy-step regexp
)))
1751 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1752 (gnus-simplify-buffer-fuzzy-step
1753 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1754 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1756 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1757 (gnus-simplify-buffer-fuzzy-step " +" " ")
1758 (gnus-simplify-buffer-fuzzy-step " $")
1759 (gnus-simplify-buffer-fuzzy-step "^ +")))
1761 (defun gnus-simplify-subject-fuzzy (subject)
1762 "Simplify a subject string fuzzily.
1763 See `gnus-simplify-buffer-fuzzy' for details."
1765 (let ((regexp gnus-simplify-subject-fuzzy-regexp
))
1766 (gnus-set-work-buffer)
1767 (let ((case-fold-search t
))
1768 ;; Remove uninteresting prefixes.
1769 (when (and gnus-simplify-ignored-prefixes
1770 (string-match gnus-simplify-ignored-prefixes subject
))
1771 (setq subject
(substring subject
(match-end 0))))
1773 (inline (gnus-simplify-buffer-fuzzy regexp
))
1776 (defsubst gnus-simplify-subject-fully
(subject)
1777 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1779 (gnus-simplify-subject-functions
1780 (gnus-map-function gnus-simplify-subject-functions subject
))
1781 ((null gnus-summary-gather-subject-limit
)
1782 (gnus-simplify-subject-re subject
))
1783 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1784 (gnus-simplify-subject-fuzzy subject
))
1785 ((numberp gnus-summary-gather-subject-limit
)
1786 (truncate-string-to-width (gnus-simplify-subject-re subject
)
1787 gnus-summary-gather-subject-limit
))
1791 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1792 "Check whether two subjects are equal.
1793 If optional argument SIMPLE-FIRST is t, first argument is already
1796 ((null simple-first
)
1797 (equal (gnus-simplify-subject-fully s1
)
1798 (gnus-simplify-subject-fully s2
)))
1801 (gnus-simplify-subject-fully s2
)))))
1803 (defun gnus-summary-bubble-group ()
1804 "Increase the score of the current group.
1805 This is a handy function to add to `gnus-summary-exit-hook' to
1806 increase the score of each group you read."
1807 (gnus-group-add-score gnus-newsgroup-name
))
1811 ;;; Gnus summary mode
1814 (put 'gnus-summary-mode
'mode-class
'special
)
1816 (defvar gnus-article-commands-menu
)
1818 ;; Non-orthogonal keys
1820 (gnus-define-keys gnus-summary-mode-map
1821 " " gnus-summary-next-page
1822 [?\S-\
] gnus-summary-prev-page
1823 "\177" gnus-summary-prev-page
1824 [delete] gnus-summary-prev-page
1825 [backspace] gnus-summary-prev-page
1826 "\r" gnus-summary-scroll-up
1827 "\M-\r" gnus-summary-scroll-down
1828 "n" gnus-summary-next-unread-article
1829 "p" gnus-summary-prev-unread-article
1830 "N" gnus-summary-next-article
1831 "P" gnus-summary-prev-article
1832 "\M-\C-n" gnus-summary-next-same-subject
1833 "\M-\C-p" gnus-summary-prev-same-subject
1834 "\M-n" gnus-summary-next-unread-subject
1835 "\M-p" gnus-summary-prev-unread-subject
1836 "." gnus-summary-first-unread-article
1837 "," gnus-summary-best-unread-article
1838 "\M-s" gnus-summary-search-article-forward
1839 "\M-r" gnus-summary-search-article-backward
1840 "\M-S" gnus-summary-repeat-search-article-forward
1841 "\M-R" gnus-summary-repeat-search-article-backward
1842 "<" gnus-summary-beginning-of-article
1843 ">" gnus-summary-end-of-article
1844 "j" gnus-summary-goto-article
1845 "^" gnus-summary-refer-parent-article
1846 "\M-^" gnus-summary-refer-article
1847 "u" gnus-summary-tick-article-forward
1848 "!" gnus-summary-tick-article-forward
1849 "U" gnus-summary-tick-article-backward
1850 "d" gnus-summary-mark-as-read-forward
1851 "D" gnus-summary-mark-as-read-backward
1852 "E" gnus-summary-mark-as-expirable
1853 "\M-u" gnus-summary-clear-mark-forward
1854 "\M-U" gnus-summary-clear-mark-backward
1855 "k" gnus-summary-kill-same-subject-and-select
1856 "\C-k" gnus-summary-kill-same-subject
1857 "\M-\C-k" gnus-summary-kill-thread
1858 "\M-\C-l" gnus-summary-lower-thread
1859 "e" gnus-summary-edit-article
1860 "#" gnus-summary-mark-as-processable
1861 "\M-#" gnus-summary-unmark-as-processable
1862 "\M-\C-t" gnus-summary-toggle-threads
1863 "\M-\C-s" gnus-summary-show-thread
1864 "\M-\C-h" gnus-summary-hide-thread
1865 "\M-\C-f" gnus-summary-next-thread
1866 "\M-\C-b" gnus-summary-prev-thread
1867 [(meta down)] gnus-summary-next-thread
1868 [(meta up)] gnus-summary-prev-thread
1869 "\M-\C-u" gnus-summary-up-thread
1870 "\M-\C-d" gnus-summary-down-thread
1871 "&" gnus-summary-execute-command
1872 "c" gnus-summary-catchup-and-exit
1873 "\C-w" gnus-summary-mark-region-as-read
1874 "\C-t" gnus-summary-toggle-truncation
1875 "?" gnus-summary-mark-as-dormant
1876 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1877 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1878 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1879 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1880 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1881 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1882 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1883 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1884 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1885 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1886 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1887 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1888 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1889 "=" gnus-summary-expand-window
1890 "\C-x\C-s" gnus-summary-reselect-current-group
1891 "\M-g" gnus-summary-rescan-group
1892 "\C-c\C-r" gnus-summary-caesar-message
1893 "f" gnus-summary-followup
1894 "F" gnus-summary-followup-with-original
1895 "C" gnus-summary-cancel-article
1896 "r" gnus-summary-reply
1897 "R" gnus-summary-reply-with-original
1898 "\C-c\C-f" gnus-summary-mail-forward
1899 "o" gnus-summary-save-article
1900 "\C-o" gnus-summary-save-article-mail
1901 "|" gnus-summary-pipe-output
1902 "\M-k" gnus-summary-edit-local-kill
1903 "\M-K" gnus-summary-edit-global-kill
1905 "\C-c\C-d" gnus-summary-describe-group
1906 "q" gnus-summary-exit
1907 "Q" gnus-summary-exit-no-update
1908 "\C-c\C-i" gnus-info-find-node
1909 gnus-mouse-2 gnus-mouse-pick-article
1910 [follow-link] mouse-face
1911 "m" gnus-summary-mail-other-window
1912 "a" gnus-summary-post-news
1913 "x" gnus-summary-limit-to-unread
1914 "s" gnus-summary-isearch-article
1915 "\t" gnus-summary-widget-forward
1916 [backtab] gnus-summary-widget-backward
1917 "t" gnus-summary-toggle-header
1918 "g" gnus-summary-show-article
1919 "l" gnus-summary-goto-last-article
1920 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1921 "\C-d" gnus-summary-enter-digest-group
1922 "\M-\C-d" gnus-summary-read-document
1923 "\M-\C-e" gnus-summary-edit-parameters
1924 "\M-\C-a" gnus-summary-customize-parameters
1926 "*" gnus-cache-enter-article
1927 "\M-*" gnus-cache-remove-article
1928 "\M-&" gnus-summary-universal-argument
1929 "\C-l" gnus-recenter
1930 "I" gnus-summary-increase-score
1931 "L" gnus-summary-lower-score
1932 "\M-i" gnus-symbolic-argument
1933 "h" gnus-summary-select-article-buffer
1935 "b" gnus-article-view-part
1936 "\M-t" gnus-summary-toggle-display-buttonized
1938 "V" gnus-summary-score-map
1939 "X" gnus-uu-extract-map
1940 "S" gnus-summary-send-map)
1942 ;; Sort of orthogonal keymap
1943 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1944 "t" gnus-summary-tick-article-forward
1945 "!" gnus-summary-tick-article-forward
1946 "d" gnus-summary-mark-as-read-forward
1947 "r" gnus-summary-mark-as-read-forward
1948 "c" gnus-summary-clear-mark-forward
1949 " " gnus-summary-clear-mark-forward
1950 "e" gnus-summary-mark-as-expirable
1951 "x" gnus-summary-mark-as-expirable
1952 "?" gnus-summary-mark-as-dormant
1953 "b" gnus-summary-set-bookmark
1954 "B" gnus-summary-remove-bookmark
1955 "#" gnus-summary-mark-as-processable
1956 "\M-#" gnus-summary-unmark-as-processable
1957 "S" gnus-summary-limit-include-expunged
1958 "C" gnus-summary-catchup
1959 "H" gnus-summary-catchup-to-here
1960 "h" gnus-summary-catchup-from-here
1961 "\C-c" gnus-summary-catchup-all
1962 "k" gnus-summary-kill-same-subject-and-select
1963 "K" gnus-summary-kill-same-subject
1964 "P" gnus-uu-mark-map)
1966 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1967 "c" gnus-summary-clear-above
1968 "u" gnus-summary-tick-above
1969 "m" gnus-summary-mark-above
1970 "k" gnus-summary-kill-below)
1972 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1973 "/" gnus-summary-limit-to-subject
1974 "n" gnus-summary-limit-to-articles
1975 "b" gnus-summary-limit-to-bodies
1976 "h" gnus-summary-limit-to-headers
1977 "w" gnus-summary-pop-limit
1978 "s" gnus-summary-limit-to-subject
1979 "a" gnus-summary-limit-to-author
1980 "u" gnus-summary-limit-to-unread
1981 "m" gnus-summary-limit-to-marks
1982 "M" gnus-summary-limit-exclude-marks
1983 "v" gnus-summary-limit-to-score
1984 "*" gnus-summary-limit-include-cached
1985 "D" gnus-summary-limit-include-dormant
1986 "T" gnus-summary-limit-include-thread
1987 "d" gnus-summary-limit-exclude-dormant
1988 "t" gnus-summary-limit-to-age
1989 "." gnus-summary-limit-to-unseen
1990 "x" gnus-summary-limit-to-extra
1991 "p" gnus-summary-limit-to-display-predicate
1992 "E" gnus-summary-limit-include-expunged
1993 "c" gnus-summary-limit-exclude-childless-dormant
1994 "C" gnus-summary-limit-mark-excluded-as-read
1995 "o" gnus-summary-insert-old-articles
1996 "N" gnus-summary-insert-new-articles
1997 "S" gnus-summary-limit-to-singletons
1998 "r" gnus-summary-limit-to-replied
1999 "R" gnus-summary-limit-to-recipient
2000 "A" gnus-summary-limit-to-address)
2002 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
2003 "n" gnus-summary-next-unread-article
2004 "p" gnus-summary-prev-unread-article
2005 "N" gnus-summary-next-article
2006 "P" gnus-summary-prev-article
2007 "\C-n" gnus-summary-next-same-subject
2008 "\C-p" gnus-summary-prev-same-subject
2009 "\M-n" gnus-summary-next-unread-subject
2010 "\M-p" gnus-summary-prev-unread-subject
2011 "f" gnus-summary-first-unread-article
2012 "b" gnus-summary-best-unread-article
2013 "j" gnus-summary-goto-article
2014 "g" gnus-summary-goto-subject
2015 "l" gnus-summary-goto-last-article
2016 "o" gnus-summary-pop-article)
2018 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2019 "k" gnus-summary-kill-thread
2020 "E" gnus-summary-expire-thread
2021 "l" gnus-summary-lower-thread
2022 "i" gnus-summary-raise-thread
2023 "T" gnus-summary-toggle-threads
2024 "t" gnus-summary-rethread-current
2025 "^" gnus-summary-reparent-thread
2026 "\M-^" gnus-summary-reparent-children
2027 "s" gnus-summary-show-thread
2028 "S" gnus-summary-show-all-threads
2029 "h" gnus-summary-hide-thread
2030 "H" gnus-summary-hide-all-threads
2031 "n" gnus-summary-next-thread
2032 "p" gnus-summary-prev-thread
2033 "u" gnus-summary-up-thread
2034 "o" gnus-summary-top-thread
2035 "d" gnus-summary-down-thread
2036 "#" gnus-uu-mark-thread
2037 "\M-#" gnus-uu-unmark-thread)
2039 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2040 "g" gnus-summary-prepare
2041 "c" gnus-summary-insert-cached-articles
2042 "d" gnus-summary-insert-dormant-articles
2043 "t" gnus-summary-insert-ticked-articles)
2045 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2046 "c" gnus-summary-catchup-and-exit
2047 "C" gnus-summary-catchup-all-and-exit
2048 "E" gnus-summary-exit-no-update
2049 "Q" gnus-summary-exit
2050 "Z" gnus-summary-exit
2051 "n" gnus-summary-catchup-and-goto-next-group
2052 "p" gnus-summary-catchup-and-goto-prev-group
2053 "R" gnus-summary-reselect-current-group
2054 "G" gnus-summary-rescan-group
2055 "N" gnus-summary-next-group
2056 "s" gnus-summary-save-newsrc
2057 "P" gnus-summary-prev-group)
2059 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2060 " " gnus-summary-next-page
2061 "n" gnus-summary-next-page
2062 [?\S-\ ] gnus-summary-prev-page
2063 "\177" gnus-summary-prev-page
2064 [delete] gnus-summary-prev-page
2065 "p" gnus-summary-prev-page
2066 "\r" gnus-summary-scroll-up
2067 "\M-\r" gnus-summary-scroll-down
2068 "<" gnus-summary-beginning-of-article
2069 ">" gnus-summary-end-of-article
2070 "b" gnus-summary-beginning-of-article
2071 "e" gnus-summary-end-of-article
2072 "^" gnus-summary-refer-parent-article
2073 "r" gnus-summary-refer-parent-article
2074 "C" gnus-summary-show-complete-article
2075 "D" gnus-summary-enter-digest-group
2076 "R" gnus-summary-refer-references
2077 "T" gnus-summary-refer-thread
2078 "W" gnus-warp-to-article
2079 "g" gnus-summary-show-article
2080 "s" gnus-summary-isearch-article
2081 "\t" gnus-summary-widget-forward
2082 [backtab] gnus-summary-widget-backward
2083 "P" gnus-summary-print-article
2084 "S" gnus-sticky-article
2085 "M" gnus-mailing-list-insinuate
2086 "t" gnus-article-babel)
2088 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2089 "b" gnus-article-add-buttons
2090 "B" gnus-article-add-buttons-to-head
2091 "o" gnus-article-treat-overstrike
2092 "e" gnus-article-emphasize
2093 "w" gnus-article-fill-cited-article
2094 "Q" gnus-article-fill-long-lines
2095 "L" gnus-article-toggle-truncate-lines
2096 "C" gnus-article-capitalize-sentences
2097 "c" gnus-article-remove-cr
2098 "q" gnus-article-de-quoted-unreadable
2099 "6" gnus-article-de-base64-unreadable
2100 "Z" gnus-article-decode-HZ
2101 "A" gnus-article-treat-ansi-sequences
2102 "h" gnus-article-wash-html
2103 "u" gnus-article-unsplit-urls
2104 "s" gnus-summary-force-verify-and-decrypt
2105 "f" gnus-article-display-x-face
2106 "l" gnus-summary-stop-page-breaking
2107 "r" gnus-summary-caesar-message
2108 "m" gnus-summary-morse-message
2109 "t" gnus-summary-toggle-header
2110 "g" gnus-treat-smiley
2111 "v" gnus-summary-verbose-headers
2112 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2113 "p" gnus-article-verify-x-pgp-sig
2114 "d" gnus-article-treat-dumbquotes
2115 "U" gnus-article-treat-non-ascii
2116 "i" gnus-summary-idna-message)
2118 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2119 ;; mnemonic: deuglif*Y*
2120 "u" gnus-article-outlook-unwrap-lines
2121 "a" gnus-article-outlook-repair-attribution
2122 "c" gnus-article-outlook-rearrange-citation
2123 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2125 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2126 "a" gnus-article-hide
2127 "h" gnus-article-hide-headers
2128 "b" gnus-article-hide-boring-headers
2129 "s" gnus-article-hide-signature
2130 "c" gnus-article-hide-citation
2131 "C" gnus-article-hide-citation-in-followups
2132 "l" gnus-article-hide-list-identifiers
2133 "B" gnus-article-strip-banner
2134 "P" gnus-article-hide-pem
2135 "\C-c" gnus-article-hide-citation-maybe)
2137 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2138 "a" gnus-article-highlight
2139 "h" gnus-article-highlight-headers
2140 "c" gnus-article-highlight-citation
2141 "s" gnus-article-highlight-signature)
2143 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2144 "f" gnus-article-treat-fold-headers
2145 "u" gnus-article-treat-unfold-headers
2146 "n" gnus-article-treat-fold-newsgroups)
2148 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2149 "x" gnus-article-display-x-face
2150 "d" gnus-article-display-face
2151 "s" gnus-treat-smiley
2152 "D" gnus-article-remove-images
2153 "W" gnus-article-show-images
2154 "f" gnus-treat-from-picon
2155 "m" gnus-treat-mail-picon
2156 "n" gnus-treat-newsgroups-picon
2157 "g" gnus-treat-from-gravatar
2158 "h" gnus-treat-mail-gravatar)
2160 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2161 "w" gnus-article-decode-mime-words
2162 "c" gnus-article-decode-charset
2163 "v" gnus-mime-view-all-parts
2164 "b" gnus-article-view-part)
2166 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2167 "z" gnus-article-date-ut
2168 "u" gnus-article-date-ut
2169 "l" gnus-article-date-local
2170 "p" gnus-article-date-english
2171 "e" gnus-article-date-lapsed
2172 "o" gnus-article-date-original
2173 "i" gnus-article-date-iso8601
2174 "s" gnus-article-date-user)
2176 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2177 "t" gnus-article-remove-trailing-blank-lines
2178 "l" gnus-article-strip-leading-blank-lines
2179 "m" gnus-article-strip-multiple-blank-lines
2180 "a" gnus-article-strip-blank-lines
2181 "A" gnus-article-strip-all-blank-lines
2182 "s" gnus-article-strip-leading-space
2183 "e" gnus-article-strip-trailing-space
2184 "w" gnus-article-remove-leading-whitespace)
2186 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2188 "d" gnus-summary-describe-group
2189 "h" gnus-summary-describe-briefly
2190 "i" gnus-info-find-node)
2192 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2193 "e" gnus-summary-expire-articles
2194 "\M-\C-e" gnus-summary-expire-articles-now
2195 "\177" gnus-summary-delete-article
2196 [delete] gnus-summary-delete-article
2197 [backspace] gnus-summary-delete-article
2198 "m" gnus-summary-move-article
2199 "r" gnus-summary-respool-article
2200 "w" gnus-summary-edit-article
2201 "c" gnus-summary-copy-article
2202 "B" gnus-summary-crosspost-article
2203 "q" gnus-summary-respool-query
2204 "t" gnus-summary-respool-trace
2205 "i" gnus-summary-import-article
2206 "I" gnus-summary-create-article
2207 "p" gnus-summary-article-posted-p)
2209 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2210 "o" gnus-summary-save-article
2211 "m" gnus-summary-save-article-mail
2212 "F" gnus-summary-write-article-file
2213 "r" gnus-summary-save-article-rmail
2214 "f" gnus-summary-save-article-file
2215 "b" gnus-summary-save-article-body-file
2216 "B" gnus-summary-write-article-body-file
2217 "h" gnus-summary-save-article-folder
2218 "v" gnus-summary-save-article-vm
2219 "p" gnus-summary-pipe-output
2220 "P" gnus-summary-muttprint)
2222 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2223 "b" gnus-summary-display-buttonized
2224 "m" gnus-summary-repair-multipart
2225 "v" gnus-article-view-part
2226 "o" gnus-article-save-part
2227 "O" gnus-article-save-part-and-strip
2228 "r" gnus-article-replace-part
2229 "d" gnus-article-delete-part
2230 "t" gnus-article-view-part-as-type
2231 "j" gnus-article-jump-to-part
2232 "c" gnus-article-copy-part
2233 "C" gnus-article-view-part-as-charset
2234 "e" gnus-article-view-part-externally
2235 "H" gnus-article-browse-html-article
2236 "E" gnus-article-encrypt-body
2237 "i" gnus-article-inline-part
2238 "|" gnus-article-pipe-part)
2240 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2241 "p" gnus-summary-mark-as-processable
2242 "u" gnus-summary-unmark-as-processable
2243 "U" gnus-summary-unmark-all-processable
2244 "v" gnus-uu-mark-over
2245 "s" gnus-uu-mark-series
2246 "r" gnus-uu-mark-region
2247 "g" gnus-uu-unmark-region
2248 "R" gnus-uu-mark-by-regexp
2249 "G" gnus-uu-unmark-by-regexp
2250 "t" gnus-uu-mark-thread
2251 "T" gnus-uu-unmark-thread
2252 "a" gnus-uu-mark-all
2253 "b" gnus-uu-mark-buffer
2254 "S" gnus-uu-mark-sparse
2255 "k" gnus-summary-kill-process-mark
2256 "y" gnus-summary-yank-process-mark
2257 "w" gnus-summary-save-process-mark
2258 "i" gnus-uu-invert-processable)
2260 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2261 ;;"x" gnus-uu-extract-any
2262 "m" gnus-summary-save-parts
2263 "u" gnus-uu-decode-uu
2264 "U" gnus-uu-decode-uu-and-save
2265 "s" gnus-uu-decode-unshar
2266 "S" gnus-uu-decode-unshar-and-save
2267 "o" gnus-uu-decode-save
2268 "O" gnus-uu-decode-save
2269 "b" gnus-uu-decode-binhex
2270 "B" gnus-uu-decode-binhex
2271 "Y" gnus-uu-decode-yenc
2272 "p" gnus-uu-decode-postscript
2273 "P" gnus-uu-decode-postscript-and-save)
2276 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2277 "u" gnus-uu-decode-uu-view
2278 "U" gnus-uu-decode-uu-and-save-view
2279 "s" gnus-uu-decode-unshar-view
2280 "S" gnus-uu-decode-unshar-and-save-view
2281 "o" gnus-uu-decode-save-view
2282 "O" gnus-uu-decode-save-view
2283 "b" gnus-uu-decode-binhex-view
2284 "B" gnus-uu-decode-binhex-view
2285 "p" gnus-uu-decode-postscript-view
2286 "P" gnus-uu-decode-postscript-and-save-view)
2288 (defvar gnus-article-post-menu nil)
2290 (defconst gnus-summary-menu-maxlen 20)
2292 (defun gnus-summary-menu-split (menu)
2293 ;; If we have lots of elements, divide them into groups of 20
2294 ;; and make a pane (or submenu) for each one.
2295 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2296 (let ((menu menu) sublists next
2299 ;; Pull off the next gnus-summary-menu-maxlen elements
2300 ;; and make them the next element of sublist.
2301 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2303 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2305 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2306 (aref (car (last menu)) 0)) menu)
2310 (nreverse sublists))
2311 ;; Few elements--put them all in one pane.
2314 (defun gnus-summary-make-menu-bar ()
2315 (gnus-turn-off-edit-menu 'summary)
2317 (unless (boundp 'gnus-summary-misc-menu)
2320 gnus-summary-kill-menu gnus-summary-mode-map ""
2325 ["Customize" gnus-score-customize t])
2326 (gnus-make-score-map 'increase)
2327 (gnus-make-score-map 'lower)
2329 ["Kill below" gnus-summary-kill-below t]
2330 ["Mark above" gnus-summary-mark-above t]
2331 ["Tick above" gnus-summary-tick-above t]
2332 ["Clear above" gnus-summary-clear-above t])
2333 ["Current score" gnus-summary-current-score t]
2334 ["Set score" gnus-summary-set-score t]
2335 ["Switch current score file..." gnus-score-change-score-file t]
2336 ["Set mark below..." gnus-score-set-mark-below t]
2337 ["Set expunge below..." gnus-score-set-expunge-below t]
2338 ["Edit current score file" gnus-score-edit-current-scores t]
2339 ["Edit score file..." gnus-score-edit-file t]
2340 ["Trace score" gnus-score-find-trace t]
2341 ["Find words" gnus-score-find-favourite-words t]
2342 ["Rescore buffer" gnus-summary-rescore t]
2343 ["Increase score..." gnus-summary-increase-score t]
2344 ["Lower score..." gnus-summary-lower-score t]))))
2346 ;; Define both the Article menu in the summary buffer and the
2347 ;; equivalent Commands menu in the article buffer here for
2351 ["All" gnus-article-hide t]
2352 ["Headers" gnus-article-hide-headers t]
2353 ["Signature" gnus-article-hide-signature t]
2354 ["Citation" gnus-article-hide-citation t]
2355 ["List identifiers" gnus-article-hide-list-identifiers t]
2356 ["Banner" gnus-article-strip-banner t]
2357 ["Boring headers" gnus-article-hide-boring-headers t])
2359 ["All" gnus-article-highlight t]
2360 ["Headers" gnus-article-highlight-headers t]
2361 ["Signature" gnus-article-highlight-signature t]
2362 ["Citation" gnus-article-highlight-citation t])
2364 ["Words" gnus-article-decode-mime-words t]
2365 ["Charset" gnus-article-decode-charset t]
2366 ["QP" gnus-article-de-quoted-unreadable t]
2367 ["Base64" gnus-article-de-base64-unreadable t]
2368 ["View MIME buttons" gnus-summary-display-buttonized t]
2369 ["View all" gnus-mime-view-all-parts t]
2370 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2371 ["Encrypt body" gnus-article-encrypt-body
2372 :active (not (gnus-group-read-only-p))
2373 ,@(if (featurep 'xemacs) nil
2374 '(:help "Encrypt the message body on disk"))]
2375 ["Extract all parts..." gnus-summary-save-parts t]
2377 ["Repair multipart" gnus-summary-repair-multipart t]
2378 ["Pipe part..." gnus-article-pipe-part t]
2379 ["Inline part" gnus-article-inline-part t]
2380 ["View part as type..." gnus-article-view-part-as-type t]
2381 ["Encrypt body" gnus-article-encrypt-body
2382 :active (not (gnus-group-read-only-p))
2383 ,@(if (featurep 'xemacs) nil
2384 '(:help "Encrypt the message body on disk"))]
2385 ["View part externally" gnus-article-view-part-externally t]
2386 ["View HTML parts in browser" gnus-article-browse-html-article t]
2387 ["View part with charset..." gnus-article-view-part-as-charset t]
2388 ["Copy part" gnus-article-copy-part t]
2389 ["Save part..." gnus-article-save-part t]
2390 ["View part" gnus-article-view-part t]))
2392 ["Local" gnus-article-date-local t]
2393 ["ISO8601" gnus-article-date-iso8601 t]
2394 ["UT" gnus-article-date-ut t]
2395 ["Original" gnus-article-date-original t]
2396 ["Lapsed" gnus-article-date-lapsed t]
2397 ["User-defined" gnus-article-date-user t])
2399 ["Remove images" gnus-article-remove-images t]
2400 ["Toggle smiley" gnus-treat-smiley t]
2401 ["Show X-Face" gnus-article-display-x-face t]
2402 ["Show picons in From" gnus-treat-from-picon t]
2403 ["Show picons in mail headers" gnus-treat-mail-picon t]
2404 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2405 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2406 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2407 ("View as different encoding"
2408 ,@(gnus-summary-menu-split
2411 ;; Since easymenu under Emacs doesn't allow
2412 ;; lambda forms for menu commands, we should
2413 ;; provide intern'ed function symbols.
2414 (let ((command (intern (format "\
2415 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2419 (let ((gnus-summary-show-article-charset-alist
2421 (gnus-summary-show-article 1))))
2422 `[,(symbol-name cs) ,command t]))
2423 (sort (if (fboundp 'coding-system-list)
2424 (coding-system-list)
2425 (mapcar 'car mm-mime-mule-charset-alist))
2429 ["Leading" gnus-article-strip-leading-blank-lines t]
2430 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2431 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2432 ["All of the above" gnus-article-strip-blank-lines t]
2433 ["All" gnus-article-strip-all-blank-lines t]
2434 ["Leading space" gnus-article-strip-leading-space t]
2435 ["Trailing space" gnus-article-strip-trailing-space t]
2436 ["Leading space in headers"
2437 gnus-article-remove-leading-whitespace t])
2438 ["Overstrike" gnus-article-treat-overstrike t]
2439 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2440 ["Non-ASCII" gnus-article-treat-non-ascii t]
2441 ["Emphasis" gnus-article-emphasize t]
2442 ["Word wrap" gnus-article-fill-cited-article t]
2443 ["Fill long lines" gnus-article-fill-long-lines t]
2444 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2445 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2446 ["Remove CR" gnus-article-remove-cr t]
2447 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2448 ["Base64" gnus-article-de-base64-unreadable t]
2449 ["Rot 13" gnus-summary-caesar-message
2450 ,@(if (featurep 'xemacs) '(t)
2451 '(:help "\"Caesar rotate\" article by 13"))]
2452 ["De-IDNA" gnus-summary-idna-message t]
2453 ["Morse decode" gnus-summary-morse-message t]
2454 ["Unix pipe..." gnus-summary-pipe-message t]
2455 ["Add buttons" gnus-article-add-buttons t]
2456 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2457 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2458 ["Verbose header" gnus-summary-verbose-headers t]
2459 ["Toggle header" gnus-summary-toggle-header t]
2460 ["Unfold headers" gnus-article-treat-unfold-headers t]
2461 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2462 ["Html" gnus-article-wash-html t]
2463 ["Unsplit URLs" gnus-article-unsplit-urls t]
2464 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2465 ["Decode HZ" gnus-article-decode-HZ t]
2466 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2467 ("(Outlook) Deuglify"
2468 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2469 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2470 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2471 ["Full (Outlook) deuglify"
2472 gnus-article-outlook-deuglify-article t])
2475 ["Save in default format..." gnus-summary-save-article
2476 ,@(if (featurep 'xemacs) '(t)
2477 '(:help "Save article using default method"))]
2478 ["Save in file..." gnus-summary-save-article-file
2479 ,@(if (featurep 'xemacs) '(t)
2480 '(:help "Save article in file"))]
2481 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2482 ["Save in MH folder..." gnus-summary-save-article-folder t]
2483 ["Save in VM folder..." gnus-summary-save-article-vm t]
2484 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2485 ["Save body in file..." gnus-summary-save-article-body-file t]
2486 ["Pipe through a filter..." gnus-summary-pipe-output t]
2487 ["Print with Muttprint..." gnus-summary-muttprint t]
2488 ["Print" gnus-summary-print-article
2489 ,@(if (featurep 'xemacs) '(t)
2490 '(:help "Generate and print a PostScript image"))])
2491 ("Copy, move,... (Backend)"
2492 ,@(if (featurep 'xemacs) nil
2493 '(:help "Copying, moving, expiring articles..."))
2494 ["Respool article..." gnus-summary-respool-article t]
2495 ["Move article..." gnus-summary-move-article
2496 (gnus-check-backend-function
2497 'request-move-article gnus-newsgroup-name)]
2498 ["Copy article..." gnus-summary-copy-article t]
2499 ["Crosspost article..." gnus-summary-crosspost-article
2500 (gnus-check-backend-function
2501 'request-replace-article gnus-newsgroup-name)]
2502 ["Import file..." gnus-summary-import-article
2503 (gnus-check-backend-function
2504 'request-accept-article gnus-newsgroup-name)]
2505 ["Create article..." gnus-summary-create-article
2506 (gnus-check-backend-function
2507 'request-accept-article gnus-newsgroup-name)]
2508 ["Check if posted" gnus-summary-article-posted-p t]
2509 ["Edit article" gnus-summary-edit-article
2510 (not (gnus-group-read-only-p))]
2511 ["Delete article" gnus-summary-delete-article
2512 (gnus-check-backend-function
2513 'request-expire-articles gnus-newsgroup-name)]
2514 ["Query respool" gnus-summary-respool-query t]
2515 ["Trace respool" gnus-summary-respool-trace t]
2516 ["Delete expirable articles" gnus-summary-expire-articles-now
2517 (gnus-check-backend-function
2518 'request-expire-articles gnus-newsgroup-name)])
2520 ["Uudecode" gnus-uu-decode-uu
2521 ,@(if (featurep 'xemacs) '(t)
2522 '(:help "Decode uuencoded article(s)"))]
2523 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2524 ["Unshar" gnus-uu-decode-unshar t]
2525 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2526 ["Save" gnus-uu-decode-save t]
2527 ["Binhex" gnus-uu-decode-binhex t]
2528 ["PostScript" gnus-uu-decode-postscript t]
2529 ["All MIME parts" gnus-summary-save-parts t])
2531 ["Enter article" gnus-cache-enter-article t]
2532 ["Remove article" gnus-cache-remove-article t])
2533 ["Translate" gnus-article-babel t]
2534 ["Select article buffer" gnus-summary-select-article-buffer t]
2535 ["Make article buffer sticky" gnus-sticky-article t]
2536 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2537 ["Isearch article..." gnus-summary-isearch-article t]
2538 ["Beginning of the article" gnus-summary-beginning-of-article t]
2539 ["End of the article" gnus-summary-end-of-article t]
2540 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2541 ["Fetch referenced articles" gnus-summary-refer-references t]
2542 ["Fetch current thread" gnus-summary-refer-thread t]
2543 ["Fetch article with id..." gnus-summary-refer-article t]
2544 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2545 ["Redisplay" gnus-summary-show-article t]
2546 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2548 gnus-summary-article-menu gnus-summary-mode-map ""
2549 (cons "Article" innards))
2551 (if (not (keymapp gnus-summary-article-menu))
2553 gnus-article-commands-menu gnus-article-mode-map ""
2554 (cons "Commands" innards))
2555 ;; in Emacs, don't share menu.
2556 (setq gnus-article-commands-menu
2557 (copy-keymap gnus-summary-article-menu))
2558 (define-key gnus-article-mode-map [menu-bar commands]
2559 (cons "Commands" gnus-article-commands-menu))))
2562 gnus-summary-thread-menu gnus-summary-mode-map ""
2564 ["Find all messages in thread" gnus-summary-refer-thread t]
2565 ["Toggle threading" gnus-summary-toggle-threads t]
2566 ["Hide threads" gnus-summary-hide-all-threads t]
2567 ["Show threads" gnus-summary-show-all-threads t]
2568 ["Hide thread" gnus-summary-hide-thread t]
2569 ["Show thread" gnus-summary-show-thread t]
2570 ["Go to next thread" gnus-summary-next-thread t]
2571 ["Go to previous thread" gnus-summary-prev-thread t]
2572 ["Go down thread" gnus-summary-down-thread t]
2573 ["Go up thread" gnus-summary-up-thread t]
2574 ["Top of thread" gnus-summary-top-thread t]
2575 ["Mark thread as read" gnus-summary-kill-thread t]
2576 ["Mark thread as expired" gnus-summary-expire-thread t]
2577 ["Lower thread score" gnus-summary-lower-thread t]
2578 ["Raise thread score" gnus-summary-raise-thread t]
2579 ["Rethread current" gnus-summary-rethread-current t]))
2582 gnus-summary-post-menu gnus-summary-mode-map ""
2584 ["Send a message (mail or news)" gnus-summary-post-news
2585 ,@(if (featurep 'xemacs) '(t)
2586 '(:help "Compose a new message (mail or news)"))]
2587 ["Followup" gnus-summary-followup
2588 ,@(if (featurep 'xemacs) '(t)
2589 '(:help "Post followup to this article"))]
2590 ["Followup and yank" gnus-summary-followup-with-original
2591 ,@(if (featurep 'xemacs) '(t)
2592 '(:help "Post followup to this article, quoting its contents"))]
2593 ["Supersede article" gnus-summary-supersede-article t]
2594 ["Cancel article" gnus-summary-cancel-article
2595 ,@(if (featurep 'xemacs) '(t)
2596 '(:help "Cancel an article you posted"))]
2597 ["Reply" gnus-summary-reply t]
2598 ["Reply and yank" gnus-summary-reply-with-original t]
2599 ["Wide reply" gnus-summary-wide-reply t]
2600 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2601 ,@(if (featurep 'xemacs) '(t)
2602 '(:help "Mail a reply, quoting this article"))]
2603 ["Very wide reply" gnus-summary-very-wide-reply t]
2604 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2605 ,@(if (featurep 'xemacs) '(t)
2606 '(:help "Mail a very wide reply, quoting this article"))]
2607 ["Mail forward" gnus-summary-mail-forward t]
2608 ["Post forward" gnus-summary-post-forward t]
2609 ["Digest and mail" gnus-uu-digest-mail-forward t]
2610 ["Digest and post" gnus-uu-digest-post-forward t]
2611 ["Resend message" gnus-summary-resend-message t]
2612 ["Resend message edit" gnus-summary-resend-message-edit t]
2613 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2614 ["Send a mail" gnus-summary-mail-other-window t]
2615 ["Create a local message" gnus-summary-news-other-window t]
2616 ["Uuencode and post" gnus-uu-post-news
2617 ,@(if (featurep 'xemacs) '(t)
2618 '(:help "Post a uuencoded article"))]
2619 ["Followup via news" gnus-summary-followup-to-mail t]
2620 ["Followup via news and yank"
2621 gnus-summary-followup-to-mail-with-original t]
2622 ["Strip signature on reply"
2625 (if (not (memq message-cite-function
2626 '(message-cite-original-without-signature
2627 message-cite-original)))
2628 ;; Stupid workaround for XEmacs not honoring :visible.
2629 (message "Can't toggle this value of `message-cite-function'")
2630 (setq message-cite-function
2631 (if (eq message-cite-function
2632 'message-cite-original-without-signature)
2633 'message-cite-original
2634 'message-cite-original-without-signature))))
2635 ;; XEmacs barfs on :visible.
2636 ,@(if (featurep 'xemacs) nil
2637 '(:visible (memq message-cite-function
2638 '(message-cite-original-without-signature
2639 message-cite-original))))
2641 :selected (eq message-cite-function
2642 'message-cite-original-without-signature)
2643 ,@(if (featurep 'xemacs) nil
2644 '(:help "Strip signature from cited article when replying."))]
2646 ;;["Send" gnus-summary-send-draft t]
2647 ;;["Send bounced" gnus-resend-bounced-mail t])
2651 ((not (keymapp gnus-summary-post-menu))
2652 (setq gnus-article-post-menu gnus-summary-post-menu))
2653 ((not gnus-article-post-menu)
2654 ;; Don't share post menu.
2655 (setq gnus-article-post-menu
2656 (copy-keymap gnus-summary-post-menu))))
2657 (define-key gnus-article-mode-map [menu-bar post]
2658 (cons "Post" gnus-article-post-menu))
2661 gnus-summary-misc-menu gnus-summary-mode-map ""
2664 ["Mark as read" gnus-summary-mark-as-read-forward t]
2665 ["Mark same subject and select"
2666 gnus-summary-kill-same-subject-and-select t]
2667 ["Mark same subject" gnus-summary-kill-same-subject t]
2668 ["Catchup" gnus-summary-catchup
2669 ,@(if (featurep 'xemacs) '(t)
2670 '(:help "Mark unread articles in this group as read"))]
2671 ["Catchup all" gnus-summary-catchup-all t]
2672 ["Catchup to here" gnus-summary-catchup-to-here t]
2673 ["Catchup from here" gnus-summary-catchup-from-here t]
2674 ["Catchup region" gnus-summary-mark-region-as-read
2675 (gnus-mark-active-p)]
2676 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2678 ["Tick" gnus-summary-tick-article-forward t]
2679 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2680 ["Remove marks" gnus-summary-clear-mark-forward t]
2681 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2682 ["Set bookmark" gnus-summary-set-bookmark t]
2683 ["Remove bookmark" gnus-summary-remove-bookmark t])
2685 ["Marks..." gnus-summary-limit-to-marks t]
2686 ["Subject..." gnus-summary-limit-to-subject t]
2687 ["Author..." gnus-summary-limit-to-author t]
2688 ["Recipient..." gnus-summary-limit-to-recipient t]
2689 ["Address..." gnus-summary-limit-to-address t]
2690 ["Age..." gnus-summary-limit-to-age t]
2691 ["Extra..." gnus-summary-limit-to-extra t]
2692 ["Score..." gnus-summary-limit-to-score t]
2693 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2694 ["Unread" gnus-summary-limit-to-unread t]
2695 ["Unseen" gnus-summary-limit-to-unseen t]
2696 ["Singletons" gnus-summary-limit-to-singletons t]
2697 ["Replied" gnus-summary-limit-to-replied t]
2698 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2699 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2700 ["Pop limit" gnus-summary-pop-limit t]
2701 ["Show dormant" gnus-summary-limit-include-dormant t]
2702 ["Hide childless dormant"
2703 gnus-summary-limit-exclude-childless-dormant t]
2704 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2705 ["Hide marked" gnus-summary-limit-exclude-marks t]
2706 ["Show expunged" gnus-summary-limit-include-expunged t])
2708 ["Set mark" gnus-summary-mark-as-processable t]
2709 ["Remove mark" gnus-summary-unmark-as-processable t]
2710 ["Remove all marks" gnus-summary-unmark-all-processable t]
2711 ["Invert marks" gnus-uu-invert-processable t]
2712 ["Mark above" gnus-uu-mark-over t]
2713 ["Mark series" gnus-uu-mark-series t]
2714 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2715 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2716 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2717 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2718 ["Mark all" gnus-uu-mark-all t]
2719 ["Mark buffer" gnus-uu-mark-buffer t]
2720 ["Mark sparse" gnus-uu-mark-sparse t]
2721 ["Mark thread" gnus-uu-mark-thread t]
2722 ["Unmark thread" gnus-uu-unmark-thread t]
2723 ("Process Mark Sets"
2724 ["Kill" gnus-summary-kill-process-mark t]
2725 ["Yank" gnus-summary-yank-process-mark
2726 gnus-newsgroup-process-stack]
2727 ["Save" gnus-summary-save-process-mark t]
2728 ["Run command on marked..." gnus-summary-universal-argument t]))
2731 ["Page forward" gnus-summary-next-page
2732 ,@(if (featurep 'xemacs) '(t)
2733 '(:help "Show next page of article"))]
2734 ["Page backward" gnus-summary-prev-page
2735 ,@(if (featurep 'xemacs) '(t)
2736 '(:help "Show previous page of article"))]
2737 ["Line forward" gnus-summary-scroll-up t])
2739 ["Next unread article" gnus-summary-next-unread-article t]
2740 ["Previous unread article" gnus-summary-prev-unread-article t]
2741 ["Next article" gnus-summary-next-article t]
2742 ["Previous article" gnus-summary-prev-article t]
2743 ["Next unread subject" gnus-summary-next-unread-subject t]
2744 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2745 ["Next article same subject" gnus-summary-next-same-subject t]
2746 ["Previous article same subject" gnus-summary-prev-same-subject t]
2747 ["First unread article" gnus-summary-first-unread-article t]
2748 ["Best unread article" gnus-summary-best-unread-article t]
2749 ["Go to subject number..." gnus-summary-goto-subject t]
2750 ["Go to article number..." gnus-summary-goto-article t]
2751 ["Go to the last article" gnus-summary-goto-last-article t]
2752 ["Pop article off history" gnus-summary-pop-article t])
2754 ["Sort by number" gnus-summary-sort-by-number t]
2755 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2756 ["Sort by author" gnus-summary-sort-by-author t]
2757 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2758 ["Sort by subject" gnus-summary-sort-by-subject t]
2759 ["Sort by date" gnus-summary-sort-by-date t]
2760 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2761 ["Sort by score" gnus-summary-sort-by-score t]
2762 ["Sort by lines" gnus-summary-sort-by-lines t]
2763 ["Sort by characters" gnus-summary-sort-by-chars t]
2764 ["Randomize" gnus-summary-sort-by-random t]
2765 ["Original sort" gnus-summary-sort-by-original t])
2767 ["Describe group" gnus-summary-describe-group t]
2768 ["Read manual" gnus-info-find-node t])
2770 ["Pick and read" gnus-pick-mode t]
2771 ["Binary" gnus-binary-mode t])
2773 ["Regenerate" gnus-summary-prepare t]
2774 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2775 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2776 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2777 ["Toggle threading" gnus-summary-toggle-threads t])
2778 ["See old articles" gnus-summary-insert-old-articles t]
2779 ["See new articles" gnus-summary-insert-new-articles t]
2780 ["Filter articles..." gnus-summary-execute-command t]
2781 ["Run command on articles..." gnus-summary-universal-argument t]
2782 ["Search articles forward..." gnus-summary-search-article-forward t]
2783 ["Search articles backward..." gnus-summary-search-article-backward t]
2784 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2785 ["Expand window" gnus-summary-expand-window t]
2786 ["Expire expirable articles" gnus-summary-expire-articles
2787 (gnus-check-backend-function
2788 'request-expire-articles gnus-newsgroup-name)]
2789 ["Edit local kill file" gnus-summary-edit-local-kill t]
2790 ["Edit main kill file" gnus-summary-edit-global-kill t]
2791 ["Edit group parameters" gnus-summary-edit-parameters t]
2792 ["Customize group parameters" gnus-summary-customize-parameters t]
2793 ["Send a bug report" gnus-bug t]
2795 ["Catchup and exit" gnus-summary-catchup-and-exit
2796 ,@(if (featurep 'xemacs) '(t)
2797 '(:help "Mark unread articles in this group as read, then exit"))]
2798 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2799 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2800 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2801 ["Exit group" gnus-summary-exit
2802 ,@(if (featurep 'xemacs) '(t)
2803 '(:help "Exit current group, return to group selection mode"))]
2804 ["Exit group without updating" gnus-summary-exit-no-update t]
2805 ["Exit and goto next group" gnus-summary-next-group t]
2806 ["Exit and goto prev group" gnus-summary-prev-group t]
2807 ["Reselect group" gnus-summary-reselect-current-group t]
2808 ["Rescan group" gnus-summary-rescan-group t]
2809 ["Update dribble" gnus-summary-save-newsrc t])))
2811 (gnus-run-hooks 'gnus-summary-menu-hook)))
2813 (defvar gnus-summary-tool-bar-map nil)
2815 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2816 ;; affect _new_ message buffers. We might add a function that walks thru all
2817 ;; summary-mode buffers and force the update.
2818 (defun gnus-summary-tool-bar-update (&optional symbol value)
2819 "Update summary mode toolbar.
2820 Setter function for custom variables."
2821 (setq-default gnus-summary-tool-bar-map nil)
2823 ;; When used as ":set" function:
2824 (set-default symbol value))
2825 (when (gnus-buffer-live-p gnus-summary-buffer)
2826 (with-current-buffer gnus-summary-buffer
2827 (gnus-summary-make-tool-bar))))
2829 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2830 'gnus-summary-tool-bar-gnome
2831 'gnus-summary-tool-bar-retro)
2832 "Specifies the Gnus summary tool bar.
2834 It can be either a list or a symbol referring to a list. See
2835 `gmm-tool-bar-from-list' for the format of the list. The
2836 default key map is `gnus-summary-mode-map'.
2838 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2839 `gnus-summary-tool-bar-retro'."
2840 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2841 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2842 (repeat :tag "User defined list" gmm-tool-bar-item)
2844 :version "23.1" ;; No Gnus
2845 :initialize 'custom-initialize-default
2846 :set 'gnus-summary-tool-bar-update
2847 :group 'gnus-summary)
2849 (defcustom gnus-summary-tool-bar-gnome
2850 '((gnus-summary-post-news "mail/compose" nil)
2851 (gnus-summary-insert-new-articles "mail/inbox" nil
2852 :visible (or (not gnus-agent)
2854 (gnus-summary-reply-with-original "mail/reply")
2855 (gnus-summary-reply "mail/reply" nil :visible nil)
2856 (gnus-summary-followup-with-original "mail/reply-all")
2857 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2858 (gnus-summary-mail-forward "mail/forward")
2859 (gnus-summary-save-article "mail/save")
2860 (gnus-summary-search-article-forward "search" nil :visible nil)
2861 (gnus-summary-print-article "print")
2862 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2863 ;; Some new commands that may need more suitable icons:
2864 (gnus-summary-save-newsrc "save" nil :visible nil)
2865 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2866 (gnus-summary-prev-article "left-arrow")
2867 (gnus-summary-next-article "right-arrow")
2868 (gnus-summary-next-page "next-page")
2869 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2871 ;; Maybe some sort-by-... could be added:
2872 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2873 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2874 (gnus-summary-mark-as-expirable
2876 :visible (gnus-check-backend-function 'request-expire-articles
2877 gnus-newsgroup-name))
2878 (gnus-summary-mark-as-spam
2880 :visible (and (fboundp 'spam-group-ham-contents-p)
2881 (spam-group-ham-contents-p gnus-newsgroup-name))
2882 :help "Mark as spam")
2883 (gnus-summary-mark-as-read-forward
2885 :visible (and (fboundp 'spam-group-spam-contents-p)
2886 (spam-group-spam-contents-p gnus-newsgroup-name)))
2888 (gnus-summary-exit "exit")
2889 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2890 (gnus-info-find-node "help"))
2891 "List of functions for the summary tool bar (GNOME style).
2893 See `gmm-tool-bar-from-list' for the format of the list."
2894 :type '(repeat gmm-tool-bar-item)
2895 :version "23.1" ;; No Gnus
2896 :initialize 'custom-initialize-default
2897 :set 'gnus-summary-tool-bar-update
2898 :group 'gnus-summary)
2900 (defcustom gnus-summary-tool-bar-retro
2901 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2902 (gnus-summary-next-unread-article "gnus/next-ur")
2903 (gnus-summary-post-news "gnus/post")
2904 (gnus-summary-followup-with-original "gnus/fuwo")
2905 (gnus-summary-followup "gnus/followup")
2906 (gnus-summary-reply-with-original "gnus/reply-wo")
2907 (gnus-summary-reply "gnus/reply")
2908 (gnus-summary-caesar-message "gnus/rot13")
2909 (gnus-uu-decode-uu "gnus/uu-decode")
2910 (gnus-summary-save-article-file "gnus/save-aif")
2911 (gnus-summary-save-article "gnus/save-art")
2912 (gnus-uu-post-news "gnus/uu-post")
2913 (gnus-summary-catchup "gnus/catchup")
2914 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2915 (gnus-summary-exit "gnus/exit-summ")
2916 ;; Some new command that may need more suitable icons:
2917 (gnus-summary-print-article "gnus/print" nil :visible nil)
2918 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2919 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2920 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2921 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2922 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2923 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2925 (gnus-info-find-node "gnus/help" nil :visible nil))
2926 "List of functions for the summary tool bar (retro look).
2928 See `gmm-tool-bar-from-list' for the format of the list."
2929 :type '(repeat gmm-tool-bar-item)
2930 :version "23.1" ;; No Gnus
2931 :initialize 'custom-initialize-default
2932 :set 'gnus-summary-tool-bar-update
2933 :group 'gnus-summary)
2935 (defcustom gnus-summary-tool-bar-zap-list t
2936 "List of icon items from the global tool bar.
2937 These items are not displayed in the Gnus summary mode tool bar.
2939 See `gmm-tool-bar-from-list' for the format of the list."
2940 :type 'gmm-tool-bar-zap-list
2941 :version "23.1" ;; No Gnus
2942 :initialize 'custom-initialize-default
2943 :set 'gnus-summary-tool-bar-update
2944 :group 'gnus-summary)
2946 (defvar image-load-path)
2947 (defvar tool-bar-map)
2949 (defun gnus-summary-make-tool-bar (&optional force)
2950 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2951 When FORCE, rebuild the tool bar."
2952 (when (and (not (featurep 'xemacs))
2953 (boundp 'tool-bar-mode)
2955 (or (not gnus-summary-tool-bar-map) force))
2957 (gmm-image-load-path-for-library "gnus"
2960 (image-load-path (cons (car load-path)
2961 (when (boundp 'image-load-path)
2963 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2964 gnus-summary-tool-bar-zap-list
2965 'gnus-summary-mode-map)))
2967 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2969 (setq gnus-summary-tool-bar-map map))))
2970 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2972 (defun gnus-make-score-map (type)
2973 "Make a summary score map of type TYPE."
2976 (let ((headers '(("author" "from" string)
2977 ("subject" "subject" string)
2978 ("article body" "body" string)
2979 ("article head" "head" string)
2980 ("xref" "xref" string)
2981 ("extra header" "extra" string)
2982 ("lines" "lines" number)
2983 ("followups to author" "followup" string)))
2984 (types '((number ("less than" <)
2987 (string ("substring" s)
2991 (perms '(("temporary" (current-time-string))
2999 (if (eq type 'lower)
3004 (setq header (car headers))
3010 (let ((ts (cdr (assoc (nth 2 header) types)))
3026 'gnus-summary-score-entry
3028 (if (or (string= (nth 1 header)
3030 (string= (nth 1 header)
3033 (list 'gnus-summary-header
3035 (list 'quote (nth 1 (car ts)))
3036 (list 'gnus-score-delta-default
3043 (list (nreverse outp))))
3046 (list (nreverse outt))))
3048 (setq headers (cdr headers)))
3049 (list (nreverse outh))))))))
3052 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3053 (defvar bookmark-make-record-function)
3055 (defvar bidi-paragraph-direction)
3057 (defun gnus-summary-mode (&optional group)
3058 "Major mode for reading articles.
3060 All normal editing commands are switched off.
3061 \\<gnus-summary-mode-map>
3062 Each line in this buffer represents one article. To read an
3063 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3064 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3067 You can also post articles and send mail from this buffer. To
3068 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3069 of an article, type `\\[gnus-summary-reply]'.
3071 There are approx. one gazillion commands you can execute in this
3072 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3074 The following commands are available:
3076 \\{gnus-summary-mode-map}"
3078 (kill-all-local-variables)
3079 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3080 (gnus-summary-make-local-variables))
3081 (gnus-summary-make-local-variables)
3082 (setq gnus-newsgroup-name group)
3083 (when (gnus-visual-p 'summary-menu 'menu)
3084 (gnus-summary-make-menu-bar)
3085 (gnus-summary-make-tool-bar))
3086 (gnus-make-thread-indent-array)
3087 (gnus-simplify-mode-line)
3088 (setq major-mode 'gnus-summary-mode)
3089 (setq mode-name "Summary")
3090 (use-local-map gnus-summary-mode-map)
3091 (buffer-disable-undo)
3092 (setq buffer-read-only t ;Disable modification
3093 show-trailing-whitespace nil)
3094 (setq truncate-lines t)
3095 ;; Force paragraph direction to be left-to-right. Don't make it
3096 ;; bound globally in old Emacsen and XEmacsen.
3097 (set (make-local-variable 'bidi-paragraph-direction) 'left-to-right)
3098 (add-to-invisibility-spec '(gnus-sum . t))
3099 (gnus-summary-set-display-table)
3100 (gnus-set-default-directory)
3101 (make-local-variable 'gnus-summary-line-format)
3102 (make-local-variable 'gnus-summary-line-format-spec)
3103 (make-local-variable 'gnus-summary-dummy-line-format)
3104 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3105 (make-local-variable 'gnus-summary-mark-positions)
3106 (gnus-make-local-hook 'pre-command-hook)
3107 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3108 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3109 (turn-on-gnus-mailing-list-mode)
3110 (mm-enable-multibyte)
3111 (set (make-local-variable 'bookmark-make-record-function)
3112 'gnus-summary-bookmark-make-record)
3113 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3114 (gnus-update-summary-mark-positions))
3116 (defun gnus-summary-make-local-variables ()
3117 "Make all the local summary buffer variables."
3119 (dolist (local gnus-summary-local-variables)
3122 (if (eq (cdr local) 'global)
3123 ;; Copy the global value of the variable.
3124 (setq global (symbol-value (car local)))
3125 ;; Use the value from the list.
3126 (setq global (eval (cdr local))))
3127 (set (make-local-variable (car local)) global))
3128 ;; Simple nil-valued local variable.
3129 (set (make-local-variable local) nil)))))
3131 ;; Summary data functions.
3133 (defmacro gnus-data-number (data)
3136 (defmacro gnus-data-set-number (data number)
3137 `(setcar ,data ,number))
3139 (defmacro gnus-data-mark (data)
3142 (defmacro gnus-data-set-mark (data mark)
3143 `(setcar (nthcdr 1 ,data) ,mark))
3145 (defmacro gnus-data-pos (data)
3148 (defmacro gnus-data-set-pos (data pos)
3149 `(setcar (nthcdr 2 ,data) ,pos))
3151 (defmacro gnus-data-header (data)
3154 (defmacro gnus-data-set-header (data header)
3155 `(setf (nth 3 ,data) ,header))
3157 (defmacro gnus-data-level (data)
3160 (defmacro gnus-data-unread-p (data)
3161 `(= (nth 1 ,data) gnus-unread-mark))
3163 (defmacro gnus-data-read-p (data)
3164 `(/= (nth 1 ,data) gnus-unread-mark))
3166 (defmacro gnus-data-pseudo-p (data)
3167 `(consp (nth 3 ,data)))
3169 (defmacro gnus-data-find (number)
3170 `(assq ,number gnus-newsgroup-data))
3172 (defmacro gnus-data-find-list (number &optional data)
3173 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3174 (memq (assq ,number bdata)
3177 (defmacro gnus-data-make (number mark pos header level)
3178 `(list ,number ,mark ,pos ,header ,level))
3180 (defun gnus-data-enter (after-article number mark pos header level offset)
3181 (let ((data (gnus-data-find-list after-article)))
3183 (error "No such article: %d" after-article))
3184 (setcdr data (cons (gnus-data-make number mark pos header level)
3186 (setq gnus-newsgroup-data-reverse nil)
3187 (gnus-data-update-list (cddr data) offset)))
3189 (defun gnus-data-enter-list (after-article list &optional offset)
3191 (let ((data (and after-article (gnus-data-find-list after-article)))
3195 (let ((odata gnus-newsgroup-data))
3196 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3198 (gnus-data-update-list odata offset)))
3199 ;; Find the last element in the list to be spliced into the main
3201 (setq list (last list))
3204 (setcdr list gnus-newsgroup-data)
3205 (setq gnus-newsgroup-data ilist)
3207 (gnus-data-update-list (cdr list) offset)))
3208 (setcdr list (cdr data))
3211 (gnus-data-update-list (cdr list) offset))))
3212 (setq gnus-newsgroup-data-reverse nil))))
3214 (defun gnus-data-remove (article &optional offset)
3215 (let ((data gnus-newsgroup-data))
3216 (if (= (gnus-data-number (car data)) article)
3218 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3219 gnus-newsgroup-data-reverse nil)
3221 (gnus-data-update-list gnus-newsgroup-data offset)))
3223 (when (= (gnus-data-number (cadr data)) article)
3224 (setcdr data (cddr data))
3226 (gnus-data-update-list (cdr data) offset))
3228 gnus-newsgroup-data-reverse nil))
3229 (setq data (cdr data))))))
3231 (defmacro gnus-data-list (backward)
3233 (or gnus-newsgroup-data-reverse
3234 (setq gnus-newsgroup-data-reverse
3235 (reverse gnus-newsgroup-data)))
3236 gnus-newsgroup-data))
3238 (defun gnus-data-update-list (data offset)
3239 "Add OFFSET to the POS of all data entries in DATA."
3240 (setq gnus-newsgroup-data-reverse nil)
3242 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3243 (setq data (cdr data))))
3245 (defun gnus-summary-article-pseudo-p (article)
3246 "Say whether this article is a pseudo article or not."
3247 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3249 (defmacro gnus-summary-article-sparse-p (article)
3250 "Say whether this article is a sparse article or not."
3251 `(memq ,article gnus-newsgroup-sparse))
3253 (defmacro gnus-summary-article-ancient-p (article)
3254 "Say whether this article is a sparse article or not."
3255 `(memq ,article gnus-newsgroup-ancient))
3257 (defun gnus-article-children (number)
3258 "Return a list of all children to NUMBER."
3259 (let* ((data (gnus-data-find-list number))
3260 (level (gnus-data-level (car data)))
3262 (setq data (cdr data))
3264 (= (gnus-data-level (car data)) (1+ level)))
3265 (push (gnus-data-number (car data)) children)
3266 (setq data (cdr data)))
3269 (defmacro gnus-summary-skip-intangible ()
3270 "If the current article is intangible, then jump to a different article."
3271 '(let ((to (get-text-property (point) 'gnus-intangible)))
3272 (and to (gnus-summary-goto-subject to))))
3274 (defmacro gnus-summary-article-intangible-p ()
3275 "Say whether this article is intangible or not."
3276 '(get-text-property (point) 'gnus-intangible))
3278 ;; Some summary mode macros.
3280 (defmacro gnus-summary-article-number ()
3281 "The article number of the article on the current line.
3282 If there isn't an article number here, then we return the current
3285 (gnus-summary-skip-intangible)
3286 (or (get-text-property (point) 'gnus-number)
3287 (gnus-summary-last-subject))))
3289 (defmacro gnus-summary-article-header (&optional number)
3290 "Return the header of article NUMBER."
3291 `(gnus-data-header (gnus-data-find
3292 ,(or number '(gnus-summary-article-number)))))
3294 (defmacro gnus-summary-thread-level (&optional number)
3295 "Return the level of thread that starts with article NUMBER."
3296 `(if (and (eq gnus-summary-make-false-root 'dummy)
3297 (get-text-property (point) 'gnus-intangible))
3299 (gnus-data-level (gnus-data-find
3300 ,(or number '(gnus-summary-article-number))))))
3302 (defmacro gnus-summary-article-mark (&optional number)
3303 "Return the mark of article NUMBER."
3304 `(gnus-data-mark (gnus-data-find
3305 ,(or number '(gnus-summary-article-number)))))
3307 (defmacro gnus-summary-article-pos (&optional number)
3308 "Return the position of the line of article NUMBER."
3309 `(gnus-data-pos (gnus-data-find
3310 ,(or number '(gnus-summary-article-number)))))
3312 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3313 (defmacro gnus-summary-article-subject (&optional number)
3314 "Return current subject string or nil if nothing."
3317 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3318 '(gnus-data-header (assq (gnus-summary-article-number)
3319 gnus-newsgroup-data)))))
3322 (mail-header-subject headers))))
3324 (defmacro gnus-summary-article-score (&optional number)
3325 "Return current article score."
3326 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3327 gnus-newsgroup-scored))
3328 gnus-summary-default-score 0))
3330 (defun gnus-summary-article-children (&optional number)
3331 "Return a list of article numbers that are children of article NUMBER."
3332 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3333 (level (gnus-data-level (car data)))
3335 (while (and (setq data (cdr data))
3336 (> (setq l (gnus-data-level (car data))) level))
3337 (and (= (1+ level) l)
3338 (push (gnus-data-number (car data))
3340 (nreverse children)))
3342 (defun gnus-summary-article-parent (&optional number)
3343 "Return the article number of the parent of article NUMBER."
3344 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3345 (gnus-data-list t)))
3346 (level (gnus-data-level (car data))))
3348 () ; This is a root.
3349 ;; We search until we find an article with a level less than
3350 ;; this one. That function has to be the parent.
3351 (while (and (setq data (cdr data))
3352 (not (< (gnus-data-level (car data)) level))))
3353 (and data (gnus-data-number (car data))))))
3355 (defun gnus-unread-mark-p (mark)
3356 "Say whether MARK is the unread mark."
3357 (= mark gnus-unread-mark))
3359 (defun gnus-read-mark-p (mark)
3360 "Say whether MARK is one of the marks that mark as read.
3361 This is all marks except unread, ticked, dormant, and expirable."
3362 (not (or (= mark gnus-unread-mark)
3363 (= mark gnus-ticked-mark)
3364 (= mark gnus-spam-mark)
3365 (= mark gnus-dormant-mark)
3366 (= mark gnus-expirable-mark))))
3368 (defmacro gnus-article-mark (number)
3369 "Return the MARK of article NUMBER.
3370 This macro should only be used when computing the mark the \"first\"
3371 time; i.e., when generating the summary lines. After that,
3372 `gnus-summary-article-mark' should be used to examine the
3375 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3376 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3377 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3378 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3379 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3380 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3381 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3382 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3383 gnus-ancient-mark))))
3385 ;; Saving hidden threads.
3387 (defmacro gnus-save-hidden-threads (&rest forms)
3388 "Save hidden threads, eval FORMS, and restore the hidden threads."
3389 (let ((config (make-symbol "config")))
3390 `(let ((,config (gnus-hidden-threads-configuration)))
3394 (gnus-restore-hidden-threads-configuration ,config)))))
3395 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3396 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3398 (defun gnus-data-compute-positions ()
3399 "Compute the positions of all articles."
3400 (setq gnus-newsgroup-data-reverse nil)
3401 (let ((data gnus-newsgroup-data))
3403 (gnus-save-hidden-threads
3404 (gnus-summary-show-all-threads)
3405 (goto-char (point-min))
3407 (while (get-text-property (point) 'gnus-intangible)
3409 (gnus-data-set-pos (car data) (+ (point) 3))
3410 (setq data (cdr data))
3411 (forward-line 1))))))
3413 (defun gnus-hidden-threads-configuration ()
3414 "Return the current hidden threads configuration."
3417 (goto-char (point-min))
3419 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3420 (push (save-excursion (forward-line 0) (point)) config))
3424 (defun gnus-restore-hidden-threads-configuration (config)
3425 "Restore hidden threads configuration from CONFIG."
3427 (let (point (inhibit-read-only t))
3428 (while (setq point (pop config))
3430 (gnus-summary-hide-thread)))))
3432 ;; Various summary mode internalish functions.
3434 (defun gnus-mouse-pick-article (e)
3437 (gnus-summary-next-page nil t))
3439 (defun gnus-summary-set-display-table ()
3440 "Change the display table.
3441 Odd characters have a tendency to mess
3442 up nicely formatted displays - we make all possible glyphs
3443 display only a single character."
3445 ;; We start from the standard display table, if any.
3446 (let ((table (or (copy-sequence standard-display-table)
3447 (make-display-table)))
3449 ;; Nix out all the control chars...
3450 (while (>= (setq i (1- i)) 0)
3451 (gnus-put-display-table i [??] table))
3452 ;; ... but not newline and cr, of course. (cr is necessary for the
3453 ;; selective display).
3454 (gnus-put-display-table ?\n nil table)
3455 (gnus-put-display-table ?\r nil table)
3456 ;; We keep TAB as well.
3457 (gnus-put-display-table ?\t nil table)
3458 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3459 ;; Emacs 23 (unicode), that are not set already.
3460 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3463 (while (>= (setq i (1- i)) 127)
3464 ;; Only modify if the entry is nil.
3465 (unless (gnus-get-display-table i table)
3466 (gnus-put-display-table i [??] table))))
3467 (setq buffer-display-table table)))
3469 (defun gnus-summary-set-article-display-arrow (pos)
3470 "Update the overlay arrow to point to line at position POS."
3471 (when gnus-summary-display-arrow
3472 (make-local-variable 'overlay-arrow-position)
3473 (make-local-variable 'overlay-arrow-string)
3477 (unless overlay-arrow-position
3478 (setq overlay-arrow-position (make-marker)))
3479 (setq overlay-arrow-string "=>"
3480 overlay-arrow-position (set-marker overlay-arrow-position
3482 (current-buffer))))))
3484 (defun gnus-summary-setup-buffer (group)
3485 "Initialize summary buffer.
3486 If the setup was successful, non-nil is returned."
3487 (let ((buffer (gnus-summary-buffer-name group))
3488 (dead-name (concat "*Dead Summary "
3489 (gnus-group-decoded-name group) "*")))
3490 ;; If a dead summary buffer exists, we kill it.
3491 (when (gnus-buffer-live-p dead-name)
3492 (gnus-kill-buffer dead-name))
3493 (if (get-buffer buffer)
3496 (setq gnus-summary-buffer (current-buffer))
3497 (not gnus-newsgroup-prepared))
3498 (set-buffer (gnus-get-buffer-create buffer))
3499 (setq gnus-summary-buffer (current-buffer))
3500 (gnus-summary-mode group)
3501 (when (gnus-group-quit-config group)
3502 (set (make-local-variable 'gnus-single-article-buffer) nil))
3503 (make-local-variable 'gnus-article-buffer)
3504 (make-local-variable 'gnus-article-current)
3505 (make-local-variable 'gnus-original-article-buffer)
3506 (setq gnus-newsgroup-name group)
3507 ;; Set any local variables in the group parameters.
3508 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3511 (defun gnus-set-global-variables ()
3512 "Set the global equivalents of the buffer-local variables.
3513 They are set to the latest values they had. These reflect the summary
3514 buffer that was in action when the last article was fetched."
3515 (when (eq major-mode 'gnus-summary-mode)
3516 (setq gnus-summary-buffer (current-buffer))
3517 (let ((name gnus-newsgroup-name)
3518 (marked gnus-newsgroup-marked)
3519 (spam gnus-newsgroup-spam-marked)
3520 (unread gnus-newsgroup-unreads)
3521 (headers gnus-current-headers)
3522 (data gnus-newsgroup-data)
3523 (summary gnus-summary-buffer)
3524 (article-buffer gnus-article-buffer)
3525 (original gnus-original-article-buffer)
3526 (gac gnus-article-current)
3527 (reffed gnus-reffed-article-number)
3528 (score-file gnus-current-score-file)
3529 (default-charset gnus-newsgroup-charset)
3531 (let ((locals gnus-newsgroup-variables))
3533 (if (consp (car locals))
3534 (push (eval (caar locals)) vlist)
3535 (push (eval (car locals)) vlist))
3536 (setq locals (cdr locals)))
3537 (setq vlist (nreverse vlist)))
3539 (setq gnus-newsgroup-name name
3540 gnus-newsgroup-marked marked
3541 gnus-newsgroup-spam-marked spam
3542 gnus-newsgroup-unreads unread
3543 gnus-current-headers headers
3544 gnus-newsgroup-data data
3545 gnus-article-current gac
3546 gnus-summary-buffer summary
3547 gnus-article-buffer article-buffer
3548 gnus-original-article-buffer original
3549 gnus-reffed-article-number reffed
3550 gnus-current-score-file score-file
3551 gnus-newsgroup-charset default-charset)
3552 (let ((locals gnus-newsgroup-variables))
3554 (if (consp (car locals))
3555 (set (caar locals) (pop vlist))
3556 (set (car locals) (pop vlist)))
3557 (setq locals (cdr locals))))))))
3559 (defun gnus-summary-article-unread-p (article)
3560 "Say whether ARTICLE is unread or not."
3561 (memq article gnus-newsgroup-unreads))
3563 (defun gnus-summary-first-article-p (&optional article)
3564 "Return whether ARTICLE is the first article in the buffer."
3565 (if (not (setq article (or article (gnus-summary-article-number))))
3567 (eq article (caar gnus-newsgroup-data))))
3569 (defun gnus-summary-last-article-p (&optional article)
3570 "Return whether ARTICLE is the last article in the buffer."
3571 (if (not (setq article (or article (gnus-summary-article-number))))
3572 ;; All non-existent numbers are the last article. :-)
3574 (not (cdr (gnus-data-find-list article)))))
3576 (defun gnus-make-thread-indent-array (&optional n)
3578 (progn (setq n 200) nil)
3579 (null gnus-thread-indent-array)
3580 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3581 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3582 gnus-thread-indent-array-level gnus-thread-indent-level)
3584 (aset gnus-thread-indent-array n
3585 (make-string (* n gnus-thread-indent-level) ? ))
3588 (defun gnus-update-summary-mark-positions ()
3589 "Compute where the summary marks are to go."
3591 (when (gnus-buffer-exists-p gnus-summary-buffer)
3592 (set-buffer gnus-summary-buffer))
3593 (let ((spec gnus-summary-line-format-spec)
3596 (gnus-set-work-buffer)
3597 (let ((gnus-tmp-unread ?Z)
3598 (gnus-replied-mark ?Z)
3599 (gnus-score-below-mark ?Z)
3600 (gnus-score-over-mark ?Z)
3601 (gnus-undownloaded-mark ?Z)
3602 (gnus-summary-line-format-spec spec)
3603 (gnus-newsgroup-downloadable '(0))
3604 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3605 case-fold-search ignores)
3606 ;; Here, all marks are bound to Z.
3607 (gnus-summary-insert-line header
3608 0 nil t gnus-tmp-unread t nil "" nil 1)
3609 (goto-char (point-min))
3610 ;; Memorize the positions of the same characters as dummy marks.
3611 (while (re-search-forward "[A-D]" nil t)
3612 (push (point) ignores))
3614 ;; We use A-D as dummy marks in order to know column positions
3615 ;; where marks should be inserted.
3616 (setq gnus-tmp-unread ?A
3617 gnus-replied-mark ?B
3618 gnus-score-below-mark ?C
3619 gnus-score-over-mark ?C
3620 gnus-undownloaded-mark ?D)
3621 (gnus-summary-insert-line header
3622 0 nil t gnus-tmp-unread t nil "" nil 1)
3623 ;; Ignore characters which aren't dummy marks.
3625 (delete-region (goto-char (1- p)) p)
3627 (goto-char (point-min))
3628 (setq pos (list (cons 'unread
3629 (and (search-forward "A" nil t)
3630 (- (point) (point-min) 1)))))
3631 (goto-char (point-min))
3632 (push (cons 'replied (and (search-forward "B" nil t)
3633 (- (point) (point-min) 1)))
3635 (goto-char (point-min))
3636 (push (cons 'score (and (search-forward "C" nil t)
3637 (- (point) (point-min) 1)))
3639 (goto-char (point-min))
3640 (push (cons 'download (and (search-forward "D" nil t)
3641 (- (point) (point-min) 1)))
3643 (setq gnus-summary-mark-positions pos))))
3645 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3646 "Insert a dummy root in the summary buffer."
3648 (gnus-add-text-properties
3649 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3650 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3652 (defun gnus-summary-extract-address-component (from)
3653 (or (car (funcall gnus-extract-address-components from))
3656 (defun gnus-summary-from-or-to-or-newsgroups (header from)
3657 (let ((mail-parse-charset gnus-newsgroup-charset)
3658 (ignored-from-addresses (gnus-ignored-from-addresses))
3659 ;; Is it really necessary to do this next part for each summary line?
3660 ;; Luckily, doesn't seem to slow things down much.
3661 (mail-parse-ignored-charsets
3662 (with-current-buffer gnus-summary-buffer
3663 gnus-newsgroup-ignored-charsets))
3664 (address (cadr (gnus-extract-address-components from))))
3666 (and ignored-from-addresses
3667 (string-match ignored-from-addresses address)
3668 (let ((extra-headers (mail-header-extra header))
3672 ((setq to (cdr (assq 'To extra-headers)))
3673 (concat gnus-summary-to-prefix
3675 (gnus-summary-extract-address-component
3676 (funcall gnus-decode-encoded-address-function to)))))
3679 (cdr (assq 'Newsgroups extra-headers))
3681 (memq 'Newsgroups gnus-extra-headers)
3682 (eq (car (gnus-find-method-for-group
3683 gnus-newsgroup-name)) 'nntp)
3684 (gnus-group-real-name gnus-newsgroup-name))))
3685 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3686 (gnus-string-mark-left-to-right (gnus-summary-extract-address-component from)))))
3688 (defun gnus-summary-insert-line (gnus-tmp-header
3689 gnus-tmp-level gnus-tmp-current
3690 undownloaded gnus-tmp-unread gnus-tmp-replied
3691 gnus-tmp-expirable gnus-tmp-subject-or-nil
3692 &optional gnus-tmp-dummy gnus-tmp-score
3694 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3695 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3697 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3698 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3699 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3700 (gnus-tmp-score-char
3701 (if (or (null gnus-summary-default-score)
3702 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3703 gnus-summary-zcore-fuzz))
3705 (if (< gnus-tmp-score gnus-summary-default-score)
3706 gnus-score-below-mark gnus-score-over-mark)))
3707 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3709 (cond (gnus-tmp-process gnus-process-mark)
3710 ((memq gnus-tmp-current gnus-newsgroup-cached)
3712 (gnus-tmp-replied gnus-replied-mark)
3713 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3714 gnus-forwarded-mark)
3715 ((memq gnus-tmp-current gnus-newsgroup-saved)
3717 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3720 (gnus-tmp-downloaded
3722 gnus-undownloaded-mark)
3723 (gnus-newsgroup-agentized
3724 gnus-downloaded-mark)
3727 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3730 ((string-match "<[^>]+> *$" gnus-tmp-from)
3731 (let ((beg (match-beginning 0)))
3732 (or (and (string-match "^\".+\"" gnus-tmp-from)
3733 (substring gnus-tmp-from 1 (1- (match-end 0))))
3734 (substring gnus-tmp-from 0 beg))))
3735 ((string-match "(.+)" gnus-tmp-from)
3736 (substring gnus-tmp-from
3737 (1+ (match-beginning 0)) (1- (match-end 0))))
3739 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3740 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3741 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3742 (inhibit-read-only t))
3743 (when (string= gnus-tmp-name "")
3744 (setq gnus-tmp-name gnus-tmp-from))
3745 (unless (numberp gnus-tmp-lines)
3746 (setq gnus-tmp-lines -1))
3747 (if (= gnus-tmp-lines -1)
3748 (setq gnus-tmp-lines "?")
3749 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3751 (gnus-put-text-property
3753 (progn (eval gnus-summary-line-format-spec) (point))
3754 'gnus-number gnus-tmp-number)
3755 (error (gnus-message 5 "Error updating the summary line")))
3756 (when (gnus-visual-p 'summary-highlight 'highlight)
3758 (gnus-summary-highlight-line)
3759 (gnus-run-hooks 'gnus-summary-update-hook)
3762 (defun gnus-summary-update-line (&optional dont-update)
3763 "Update summary line after change."
3764 (when (and gnus-summary-default-score
3765 (not gnus-summary-inhibit-highlight))
3766 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3767 (article (gnus-summary-article-number))
3768 (score (gnus-summary-article-score article)))
3770 (if (and gnus-summary-mark-below
3771 (< (gnus-summary-article-score)
3772 gnus-summary-mark-below))
3773 ;; This article has a low score, so we mark it as read.
3774 (when (memq article gnus-newsgroup-unreads)
3775 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3776 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3777 ;; This article was previously marked as read on account
3778 ;; of a low score, but now it has risen, so we mark it as
3780 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3781 (gnus-summary-update-mark
3782 (if (or (null gnus-summary-default-score)
3783 (<= (abs (- score gnus-summary-default-score))
3784 gnus-summary-zcore-fuzz))
3786 (if (< score gnus-summary-default-score)
3787 gnus-score-below-mark gnus-score-over-mark))
3789 ;; Do visual highlighting.
3790 (when (gnus-visual-p 'summary-highlight 'highlight)
3791 (gnus-summary-highlight-line)
3792 (gnus-run-hooks 'gnus-summary-update-hook)))))
3794 (defvar gnus-tmp-new-adopts nil)
3796 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3797 "Return the number of articles in THREAD.
3798 This may be 0 in some cases -- if none of the articles in
3799 the thread are to be displayed."
3801 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3803 ((not (listp thread))
3805 ((and (consp thread) (cdr thread))
3808 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3811 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3814 (when (and level (zerop level) gnus-tmp-new-adopts)
3817 'gnus-summary-number-of-articles-in-thread
3818 gnus-tmp-new-adopts))))
3820 (if (> number 1) gnus-not-empty-thread-mark
3821 gnus-empty-thread-mark)
3824 (defsubst gnus-summary-line-message-size (head)
3825 "Return pretty-printed version of message size.
3826 This function is intended to be used in
3827 `gnus-summary-line-format-alist'."
3828 (let ((c (or (mail-header-chars head) -1)))
3829 (cond ((< c 0) "n/a") ; chars not available
3830 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3831 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3832 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3833 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3835 (defcustom gnus-user-date-format-alist
3836 '(((gnus-seconds-today) . "Today, %H:%M")
3837 ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M")
3838 (604800 . "%A %H:%M") ; That's one week
3839 ((gnus-seconds-month) . "%A %d")
3840 ((gnus-seconds-year) . "%B %d")
3841 (t . "%b %d %Y")) ; This one is used when no other
3843 "Specifies date format depending on age of article.
3844 This is an alist of items (AGE . FORMAT). AGE can be a number (of
3845 seconds) or a Lisp expression evaluating to a number. When the age of
3846 the article is less than this number, then use `format-time-string'
3847 with the corresponding FORMAT for displaying the date of the article.
3848 If AGE is not a number or a Lisp expression evaluating to a
3849 non-number, then the corresponding FORMAT is used as a default value.
3851 Note that the list is processed from the beginning, so it should be
3852 sorted by ascending AGE. Also note that items following the first
3853 non-number AGE will be ignored.
3855 You can use the functions `gnus-seconds-today', `gnus-seconds-month'
3856 and `gnus-seconds-year' in the AGE spec. They return the number of
3857 seconds passed since the start of today, of this month, of this year,
3860 :group 'gnus-summary-format
3861 :type '(alist :key-type sexp :value-type string))
3863 (defun gnus-user-date (messy-date)
3864 "Format the messy-date according to `gnus-user-date-format-alist'.
3865 Returns \" ? \" if there's bad input or if another error occurs.
3866 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3868 (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date)))
3869 (now (gnus-float-time))
3870 ;;If we don't find something suitable we'll use this one
3871 (my-format "%b %d '%y"))
3872 (let* ((difference (- now messy-date))
3873 (templist gnus-user-date-format-alist)
3874 (top (eval (caar templist))))
3875 (while (if (numberp top) (< top difference) (not top))
3877 (setq templist (cdr templist))
3878 (setq top (eval (caar templist)))))
3879 (if (stringp (cdr (car templist)))
3880 (setq my-format (cdr (car templist)))))
3881 (format-time-string (eval my-format) (seconds-to-time messy-date)))
3884 (defun gnus-summary-set-local-parameters (group)
3885 "Go through the local params of GROUP and set all variable specs in that list."
3886 (let ((vars '(quit-config active))) ; Ignore things that aren't
3888 (dolist (elem (gnus-group-find-parameter group))
3889 (and (consp elem) ; Has to be a cons.
3890 (consp (cdr elem)) ; The cdr has to be a list.
3891 (symbolp (car elem)) ; Has to be a symbol in there.
3892 (not (memq (car elem) vars))
3894 (push (car elem) vars)
3895 ;; Variables like `gnus-show-threads' that are globally
3896 ;; bound, if used as group parameters, need to get to be
3897 ;; buffer-local, whereas just parameters like `gcc-self',
3898 ;; `timestamp', etc. should not be bound as variables.
3899 (if (boundp (car elem))
3900 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3901 (eval (nth 1 elem))))))))
3903 (defun gnus-summary-read-group (group &optional show-all no-article
3904 kill-buffer no-display backward
3906 "Start reading news in newsgroup GROUP.
3907 If SHOW-ALL is non-nil, already read articles are also listed.
3908 If NO-ARTICLE is non-nil, no article is selected initially.
3909 If NO-DISPLAY, don't generate the summary buffer contents.
3910 If KILL-BUFFER, it should be a buffer that's killed once the new
3911 summary buffer has been generated.
3912 If BACKWARD, move point to the previous group in the group buffer
3913 If SELECT-ARTICLES, only select those articles from GROUP."
3917 (let ((gnus-auto-select-next nil))
3918 (or (gnus-summary-read-group-1
3919 group show-all no-article
3920 kill-buffer no-display
3923 select-articles nil)))))
3924 (eq gnus-auto-select-next 'quietly))
3925 (set-buffer gnus-group-buffer)
3926 ;; The entry function called above goes to the next
3927 ;; group automatically, so we go two groups back
3928 ;; if we are searching for the previous group.
3930 (gnus-group-prev-unread-group 2))
3931 (if (not (equal group (gnus-group-group-name)))
3932 (setq group (gnus-group-group-name))
3936 (defun gnus-summary-read-group-1 (group show-all no-article
3937 kill-buffer no-display
3938 &optional select-articles)
3939 ;; Killed foreign groups can't be entered.
3940 ;; (when (and (not (gnus-group-native-p group))
3941 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3942 ;; (error "Dead non-native groups can't be entered"))
3943 (gnus-message 7 "Retrieving newsgroup: %s..."
3944 (gnus-group-decoded-name group))
3945 (let* ((new-group (gnus-summary-setup-buffer group))
3946 (quit-config (gnus-group-quit-config group))
3947 (did-select (and new-group (gnus-select-newsgroup
3948 group show-all select-articles))))
3950 ;; This summary buffer exists already, so we just select it.
3952 (gnus-set-global-variables)
3954 (gnus-kill-or-deaden-summary kill-buffer))
3955 (gnus-configure-windows 'summary 'force)
3956 (gnus-set-mode-line 'summary)
3957 (gnus-summary-position-point)
3960 ;; We couldn't select this group.
3962 (when (and (eq major-mode 'gnus-summary-mode)
3963 (not (equal (current-buffer) kill-buffer)))
3964 (kill-buffer (current-buffer))
3965 (if (not quit-config)
3967 ;; Update the info -- marks might need to be removed,
3969 (gnus-summary-update-info)
3970 (set-buffer gnus-group-buffer)
3971 (gnus-group-jump-to-group group)
3972 (gnus-group-next-unread-group 1))
3973 (gnus-handle-ephemeral-exit quit-config)))
3974 (if (null (gnus-list-of-unread-articles group))
3975 (gnus-message 3 "Group %s contains no messages" group)
3976 (gnus-message 3 "Can't select group"))
3978 ;; The user did a `C-g' while prompting for number of articles,
3979 ;; so we exit this group.
3980 ((eq did-select 'quit)
3981 (and (eq major-mode 'gnus-summary-mode)
3982 (not (equal (current-buffer) kill-buffer))
3983 (kill-buffer (current-buffer)))
3985 (gnus-kill-or-deaden-summary kill-buffer))
3986 (if (not quit-config)
3988 (set-buffer gnus-group-buffer)
3989 (gnus-group-jump-to-group group)
3990 (gnus-configure-windows 'group 'force))
3991 (gnus-handle-ephemeral-exit quit-config))
3992 ;; Finally signal the quit.
3994 ;; The group was successfully selected.
3996 (gnus-set-global-variables)
3997 ;; Save the active value in effect when the group was entered.
3998 (setq gnus-newsgroup-active
4000 (gnus-active gnus-newsgroup-name)))
4001 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
4002 ;; You can change the summary buffer in some way with this hook.
4003 (gnus-run-hooks 'gnus-select-group-hook)
4004 (when (memq 'summary (gnus-update-format-specifications
4005 nil 'summary 'summary-mode 'summary-dummy))
4006 ;; The format specification for the summary line was updated,
4007 ;; so we need to update the mark positions as well.
4008 (gnus-update-summary-mark-positions))
4009 ;; Do score processing.
4010 (when gnus-use-scoring
4011 (gnus-possibly-score-headers))
4012 ;; Check whether to fill in the gaps in the threads.
4013 (when gnus-build-sparse-threads
4014 (gnus-build-sparse-threads))
4015 ;; Find the initial limit.
4017 (let ((gnus-newsgroup-dormant nil))
4018 (gnus-summary-initial-limit show-all))
4019 (gnus-summary-initial-limit show-all))
4020 ;; Generate the summary buffer.
4022 (gnus-summary-prepare))
4023 (when gnus-use-trees
4024 (gnus-tree-open group)
4025 (setq gnus-summary-highlight-line-function
4026 'gnus-tree-highlight-article))
4027 ;; If the summary buffer is empty, but there are some low-scored
4028 ;; articles or some excluded dormants, we include these in the
4030 (when (and (zerop (buffer-size))
4032 (cond (gnus-newsgroup-dormant
4033 (gnus-summary-limit-include-dormant))
4034 ((and gnus-newsgroup-scored show-all)
4035 (gnus-summary-limit-include-expunged t))))
4036 ;; Function `gnus-apply-kill-file' must be called in this hook.
4037 (gnus-run-hooks 'gnus-apply-kill-hook)
4038 (if (and (zerop (buffer-size))
4041 ;; This newsgroup is empty.
4042 (gnus-summary-catchup-and-exit nil t)
4043 (gnus-message 6 "No unread news")
4045 (gnus-kill-or-deaden-summary kill-buffer))
4046 ;; Return nil from this function.
4048 ;; Hide conversation thread subtrees. We cannot do this in
4049 ;; gnus-summary-prepare-hook since kill processing may not
4050 ;; work with hidden articles.
4051 (gnus-summary-maybe-hide-threads)
4052 (gnus-configure-windows 'summary)
4054 (gnus-kill-or-deaden-summary kill-buffer))
4055 (gnus-summary-auto-select-subject)
4056 ;; Show first unread article if requested.
4057 (if (and (not no-article)
4059 gnus-newsgroup-unreads
4060 gnus-auto-select-first)
4062 (let ((art (gnus-summary-article-number)))
4065 (not (memq art gnus-newsgroup-undownloaded))
4066 (not (memq art gnus-newsgroup-downloadable)))
4067 (gnus-summary-goto-article art))))
4068 ;; Don't select any articles.
4069 (gnus-summary-position-point)
4070 (gnus-configure-windows 'summary 'force)
4071 (gnus-set-mode-line 'summary))
4072 (when (and gnus-auto-center-group
4073 (get-buffer-window gnus-group-buffer t))
4074 ;; Gotta use windows, because recenter does weird stuff if
4075 ;; the current buffer ain't the displayed window.
4076 (let ((owin (selected-window)))
4077 (select-window (get-buffer-window gnus-group-buffer t))
4078 (when (gnus-group-goto-group group)
4080 (select-window owin)))
4081 ;; Mark this buffer as "prepared".
4082 (setq gnus-newsgroup-prepared t)
4083 (gnus-run-hooks 'gnus-summary-prepared-hook)
4084 (unless (gnus-ephemeral-group-p group)
4085 (gnus-group-update-group group nil t))
4088 (defun gnus-summary-auto-select-subject ()
4089 "Select the subject line on initial group entry."
4090 (goto-char (point-min))
4092 ((eq gnus-auto-select-subject 'best)
4093 (gnus-summary-best-unread-subject))
4094 ((eq gnus-auto-select-subject 'unread)
4095 (gnus-summary-first-unread-subject))
4096 ((eq gnus-auto-select-subject 'unseen)
4097 (gnus-summary-first-unseen-subject))
4098 ((eq gnus-auto-select-subject 'unseen-or-unread)
4099 (gnus-summary-first-unseen-or-unread-subject))
4100 ((eq gnus-auto-select-subject 'first)
4103 ((functionp gnus-auto-select-subject)
4104 (funcall gnus-auto-select-subject))))
4106 (defun gnus-summary-prepare ()
4107 "Generate the summary buffer."
4109 (let ((inhibit-read-only t))
4111 (setq gnus-newsgroup-data nil
4112 gnus-newsgroup-data-reverse nil)
4113 (gnus-run-hooks 'gnus-summary-generate-hook)
4114 ;; Generate the buffer, either with threads or without.
4115 (when gnus-newsgroup-headers
4116 (gnus-summary-prepare-threads
4117 (if gnus-show-threads
4118 (gnus-sort-gathered-threads
4119 (funcall gnus-summary-thread-gathering-function
4121 (gnus-cut-threads (gnus-make-threads)))))
4122 ;; Unthreaded display.
4123 (gnus-sort-articles gnus-newsgroup-headers))))
4124 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4125 ;; Call hooks for modifying summary buffer.
4126 (goto-char (point-min))
4127 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4129 (defsubst gnus-general-simplify-subject (subject)
4130 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4133 ;; Truncate the subject.
4134 (gnus-simplify-subject-functions
4135 (gnus-map-function gnus-simplify-subject-functions subject))
4136 ((numberp gnus-summary-gather-subject-limit)
4137 (setq subject (gnus-simplify-subject-re subject))
4138 (if (> (length subject) gnus-summary-gather-subject-limit)
4139 (substring subject 0 gnus-summary-gather-subject-limit)
4141 ;; Fuzzily simplify it.
4142 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4143 (gnus-simplify-subject-fuzzy subject))
4144 ;; Just remove the leading "Re:".
4146 (gnus-simplify-subject-re subject))))
4148 (if (and gnus-summary-gather-exclude-subject
4149 (string-match gnus-summary-gather-exclude-subject subject))
4150 nil ; This article shouldn't be gathered
4153 (defun gnus-summary-simplify-subject-query ()
4154 "Query where the respool algorithm would put this article."
4156 (gnus-summary-select-article)
4157 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4159 (defun gnus-gather-threads-by-subject (threads)
4160 "Gather threads by looking at Subject headers."
4161 (if (not gnus-summary-make-false-root)
4163 (let ((hashtb (gnus-make-hashtable 1024))
4166 subject hthread whole-subject)
4168 (setq subject (gnus-general-simplify-subject
4169 (setq whole-subject (mail-header-subject
4172 (if (setq hthread (gnus-gethash subject hashtb))
4174 ;; We enter a dummy root into the thread, if we
4175 ;; haven't done that already.
4176 (unless (stringp (caar hthread))
4177 (setcar hthread (list whole-subject (car hthread))))
4178 ;; We add this new gathered thread to this gathered
4180 (setcdr (car hthread)
4181 (nconc (cdar hthread) (list (car threads))))
4182 ;; Remove it from the list of threads.
4183 (setcdr prev (cdr threads))
4184 (setq threads prev))
4185 ;; Enter this thread into the hash table.
4186 (gnus-sethash subject
4187 (if gnus-summary-make-false-root-always
4189 ;; If you want a dummy root above all
4191 (setcar threads (list whole-subject
4197 (setq threads (cdr threads)))
4200 (defun gnus-gather-threads-by-references (threads)
4201 "Gather threads by looking at References headers."
4202 (let ((idhashtb (gnus-make-hashtable 1024))
4203 (thhashtb (gnus-make-hashtable 1024))
4206 ids references id gthread gid entered ref)
4208 (when (setq references (mail-header-references (caar threads)))
4209 (setq id (mail-header-id (caar threads))
4210 ids (inline (gnus-split-references references))
4212 (while (setq ref (pop ids))
4213 (setq ids (delete ref ids))
4214 (if (not (setq gid (gnus-gethash ref idhashtb)))
4216 (gnus-sethash ref id idhashtb)
4217 (gnus-sethash id threads thhashtb))
4218 (setq gthread (gnus-gethash gid thhashtb))
4220 ;; We enter a dummy root into the thread, if we
4221 ;; haven't done that already.
4222 (unless (stringp (caar gthread))
4223 (setcar gthread (list (mail-header-subject (caar gthread))
4225 ;; We add this new gathered thread to this gathered
4227 (setcdr (car gthread)
4228 (nconc (cdar gthread) (list (car threads)))))
4229 ;; Add it into the thread hash table.
4230 (gnus-sethash id gthread thhashtb)
4232 ;; Remove it from the list of threads.
4233 (setcdr prev (cdr threads))
4234 (setq threads prev))))
4236 (setq threads (cdr threads)))
4239 (defun gnus-sort-gathered-threads (threads)
4240 "Sort subthreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4241 (let ((result threads))
4243 (when (stringp (caar threads))
4244 (setcdr (car threads)
4245 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4246 (setq threads (cdr threads)))
4249 (defun gnus-thread-loop-p (root thread)
4250 "Say whether ROOT is in THREAD."
4251 (let ((stack (list thread))
4254 (while (setq thread (pop stack))
4255 (setq th (cdr thread))
4257 (not (eq (caar th) root)))
4260 ;; We have found a loop.
4262 (setcdr thread (delq (car th) (cdr thread)))
4263 (if (boundp (setq ref-dep (intern "none"
4264 gnus-newsgroup-dependencies)))
4265 (setcdr (symbol-value ref-dep)
4266 (nconc (cdr (symbol-value ref-dep))
4268 (set ref-dep (list nil (car th))))
4271 ;; Push all the subthreads onto the stack.
4272 (push (cdr thread) stack)))
4275 (defun gnus-make-threads ()
4276 "Go through the dependency hashtb and find the roots. Return all threads."
4278 (while (catch 'infloop
4281 ;; Deal with self-referencing References loops.
4282 (when (and (car (symbol-value refs))
4289 (car (symbol-value refs)) thread))
4290 (cdr (symbol-value refs)))))))
4293 (unless (car (symbol-value refs))
4294 ;; These threads do not refer back to any other
4295 ;; articles, so they're roots.
4296 (setq threads (append (cdr (symbol-value refs)) threads))))
4297 gnus-newsgroup-dependencies)))
4300 ;; Build the thread tree.
4301 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4302 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4304 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4305 if it was already present.
4307 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4308 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4309 Message-IDs will be renamed to a unique Message-ID before being
4312 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4313 (let* ((id (mail-header-id header))
4314 (id-dep (and id (intern id dependencies)))
4315 parent-id ref ref-dep ref-header replaced)
4316 ;; Enter this `header' in the `dependencies' table.
4320 ;; The first two cases do the normal part: enter a new `header'
4321 ;; in the `dependencies' table.
4322 ((not (boundp id-dep))
4323 (set id-dep (list header)))
4324 ((null (car (symbol-value id-dep)))
4325 (setcar (symbol-value id-dep) header))
4327 ;; From here the `header' was already present in the
4328 ;; `dependencies' table.
4330 ;; Overrides an existing entry;
4331 ;; just set the header part of the entry.
4332 (setcar (symbol-value id-dep) header)
4335 ;; Renames the existing `header' to a unique Message-ID.
4336 ((not gnus-summary-ignore-duplicates)
4337 ;; An article with this Message-ID has already been seen.
4338 ;; We rename the Message-ID.
4339 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4341 (mail-header-set-id header id))
4343 ;; The last case ignores an existing entry, except it adds any
4344 ;; additional Xrefs (in case the two articles came from different
4346 ;; Also sets `header' to `nil' meaning that the `dependencies'
4347 ;; table was *not* modified.
4349 (mail-header-set-xref
4350 (car (symbol-value id-dep))
4351 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4353 (or (mail-header-xref header) "")))
4356 (when (and header (not replaced))
4357 ;; First check that we are not creating a References loop.
4358 (setq parent-id (gnus-parent-id (mail-header-references header)))
4359 (setq ref parent-id)
4361 (setq ref-dep (intern-soft ref dependencies))
4363 (setq ref-header (car (symbol-value ref-dep))))
4364 (if (string= id ref)
4365 ;; Yuk! This is a reference loop. Make the article be a
4368 (mail-header-set-references (car (symbol-value id-dep)) "none")
4370 (setq parent-id nil))
4371 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4372 (setq ref-dep (intern (or parent-id "none") dependencies))
4373 (if (boundp ref-dep)
4374 (setcdr (symbol-value ref-dep)
4375 (nconc (cdr (symbol-value ref-dep))
4376 (list (symbol-value id-dep))))
4377 (set ref-dep (list nil (symbol-value id-dep)))))
4380 (defun gnus-extract-message-id-from-in-reply-to (string)
4381 (if (string-match "<[^>]+>" string)
4382 (substring string (match-beginning 0) (match-end 0))
4385 (defun gnus-build-sparse-threads ()
4386 (let ((headers gnus-newsgroup-headers)
4387 (mail-parse-charset gnus-newsgroup-charset)
4388 (gnus-summary-ignore-duplicates t)
4389 header references generation relations
4390 subject child end new-child date)
4391 ;; First we create an alist of generations/relations, where
4392 ;; generations is how much we trust the relation, and the relation
4394 (gnus-message 7 "Making sparse threads...")
4396 (nnheader-set-temp-buffer " *gnus sparse threads*")
4397 (while (setq header (pop headers))
4398 (when (and (setq references (mail-header-references header))
4399 (not (string= references "")))
4401 (setq child (mail-header-id header)
4402 subject (mail-header-subject header)
4403 date (mail-header-date header)
4405 (while (search-backward ">" nil t)
4406 (setq end (1+ (point)))
4407 (when (search-backward "<" nil t)
4408 (setq new-child (buffer-substring (point) end))
4409 (push (list (incf generation)
4410 child (setq child new-child)
4414 (push (list (1+ generation) child nil subject) relations))
4416 (kill-buffer (current-buffer)))
4417 ;; Sort over trustworthiness.
4418 (dolist (relation (sort relations 'car-less-than-car))
4419 (when (gnus-dependencies-add-header
4420 (make-full-mail-header
4421 gnus-reffed-article-number
4422 (nth 3 relation) "" (or (nth 4 relation) "")
4424 (or (nth 2 relation) "") 0 0 "")
4425 gnus-newsgroup-dependencies nil)
4426 (push gnus-reffed-article-number gnus-newsgroup-limit)
4427 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4428 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4429 gnus-newsgroup-reads)
4430 (decf gnus-reffed-article-number)))
4431 (gnus-message 7 "Making sparse threads...done")))
4433 (defun gnus-build-old-threads ()
4434 ;; Look at all the articles that refer back to old articles, and
4435 ;; fetch the headers for the articles that aren't there. This will
4436 ;; build complete threads - if the roots haven't been expired by the
4438 (let ((mail-parse-charset gnus-newsgroup-charset)
4442 (when (not (car (symbol-value refs)))
4443 (setq heads (cdr (symbol-value refs)))
4445 (if (memq (mail-header-number (caar heads))
4446 gnus-newsgroup-dormant)
4447 (setq heads (cdr heads))
4448 (setq id (symbol-name refs))
4449 (while (and (setq id (gnus-build-get-header id))
4450 (not (car (gnus-id-to-thread id)))))
4451 (setq heads nil)))))
4452 gnus-newsgroup-dependencies)))
4454 (defsubst gnus-remove-odd-characters (string)
4455 "Translate STRING into something that doesn't contain weird characters."
4456 (mm-subst-char-in-string
4458 (mm-subst-char-in-string ?\n ?\- string t) t))
4460 ;; This function has to be called with point after the article number
4461 ;; on the beginning of the line.
4462 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4463 (let ((eol (point-at-eol))
4464 (buffer (current-buffer))
4465 header references in-reply-to)
4467 ;; overview: [num subject from date id refs chars lines misc]
4470 (narrow-to-region (point) eol)
4475 (make-full-mail-header
4477 (condition-case () ; subject
4478 (gnus-remove-odd-characters
4479 (funcall gnus-decode-encoded-word-function
4480 (setq x (nnheader-nov-field))))
4482 (condition-case () ; from
4483 (gnus-remove-odd-characters
4484 (funcall gnus-decode-encoded-address-function
4485 (setq x (nnheader-nov-field))))
4487 (nnheader-nov-field) ; date
4488 (nnheader-nov-read-message-id number) ; id
4489 (setq references (nnheader-nov-field)) ; refs
4490 (nnheader-nov-read-integer) ; chars
4491 (nnheader-nov-read-integer) ; lines
4493 (if (looking-at "Xref: ")
4494 (goto-char (match-end 0)))
4495 (nnheader-nov-field)) ; Xref
4496 (nnheader-nov-parse-extra)))) ; extra
4500 (when (and (string= references "")
4501 (setq in-reply-to (mail-header-extra header))
4502 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4503 (mail-header-set-references
4504 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4506 (when gnus-alter-header-function
4507 (funcall gnus-alter-header-function header))
4508 (gnus-dependencies-add-header header dependencies force-new)))
4510 (defun gnus-build-get-header (id)
4511 "Look through the buffer of NOV lines and find the header to ID.
4512 Enter this line into the dependencies hash table, and return
4513 the id of the parent article (if any)."
4514 (let ((deps gnus-newsgroup-dependencies)
4517 (with-current-buffer nntp-server-buffer
4518 (let ((case-fold-search nil))
4519 (goto-char (point-min))
4520 (while (and (not found)
4521 (search-forward id nil t))
4523 (setq found (looking-at
4524 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4525 (regexp-quote id))))
4526 (or found (beginning-of-line 2)))
4530 (setq header (gnus-nov-parse-line
4531 (read (current-buffer)) deps))
4532 (gnus-parent-id (mail-header-references header))))))
4534 (let ((number (mail-header-number header)))
4535 (push number gnus-newsgroup-limit)
4536 (push header gnus-newsgroup-headers)
4537 (if (memq number gnus-newsgroup-unselected)
4539 (setq gnus-newsgroup-unreads
4540 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4542 (setq gnus-newsgroup-unselected
4543 (delq number gnus-newsgroup-unselected)))
4544 (push number gnus-newsgroup-ancient)))))))
4546 (defun gnus-build-all-threads ()
4547 "Read all the headers."
4548 (let ((gnus-summary-ignore-duplicates t)
4549 (mail-parse-charset gnus-newsgroup-charset)
4550 (dependencies gnus-newsgroup-dependencies)
4552 (with-current-buffer nntp-server-buffer
4553 (let ((case-fold-search nil))
4554 (goto-char (point-min))
4557 (setq article (read (current-buffer))
4558 header (gnus-nov-parse-line article dependencies t)))
4560 (with-current-buffer gnus-summary-buffer
4561 (push header gnus-newsgroup-headers)
4562 (if (memq (setq article (mail-header-number header))
4563 gnus-newsgroup-unselected)
4565 (setq gnus-newsgroup-unreads
4566 (gnus-add-to-sorted-list
4567 gnus-newsgroup-unreads article))
4568 (setq gnus-newsgroup-unselected
4569 (delq article gnus-newsgroup-unselected)))
4570 (push article gnus-newsgroup-ancient)))
4571 (forward-line 1)))))))
4573 (defun gnus-summary-update-article-line (article header)
4574 "Update the line for ARTICLE using HEADER."
4575 (let* ((id (mail-header-id header))
4576 (thread (gnus-id-to-thread id)))
4578 (error "Article in no thread"))
4579 ;; Update the thread.
4580 (setcar thread header)
4581 (gnus-summary-goto-subject article)
4582 (let* ((datal (gnus-data-find-list article))
4584 (inhibit-read-only t)
4585 (level (gnus-summary-thread-level)))
4587 (let ((inserted (- (point)
4589 (gnus-summary-insert-line
4591 (memq article gnus-newsgroup-undownloaded)
4592 (gnus-article-mark article)
4593 (memq article gnus-newsgroup-replied)
4594 (memq article gnus-newsgroup-expirable)
4595 ;; Only insert the Subject string when it's different
4596 ;; from the previous Subject string.
4601 (mail-header-subject
4604 (gnus-data-find-list
4606 (gnus-data-list t)))))
4607 ;; Error on the side of excessive subjects.
4609 (mail-header-subject header)))
4611 (mail-header-subject header))
4612 nil (cdr (assq article gnus-newsgroup-scored))
4613 (memq article gnus-newsgroup-processable))
4616 (gnus-data-update-list
4618 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4620 (defun gnus-summary-update-article (article &optional iheader)
4621 "Update ARTICLE in the summary buffer."
4622 (set-buffer gnus-summary-buffer)
4623 (let* ((header (gnus-summary-article-header article))
4624 (id (mail-header-id header))
4625 (data (gnus-data-find article))
4626 (thread (gnus-id-to-thread id))
4627 (references (mail-header-references header))
4631 (when (and references
4632 (not (equal "" references)))
4635 (inhibit-read-only t)
4641 (delq thread parent)))
4642 (if (gnus-summary-insert-subject id header)
4643 ;; Set the (possibly) new article number in the data structure.
4644 (gnus-data-set-number data (gnus-id-to-article id))
4648 (defun gnus-rebuild-thread (id &optional line)
4649 "Rebuild the thread containing ID.
4650 If LINE, insert the rebuilt thread starting on line LINE."
4651 (let ((inhibit-read-only t)
4652 old-pos current thread data)
4653 (if (not gnus-show-threads)
4654 (setq thread (list (car (gnus-id-to-thread id))))
4655 ;; Get the thread this article is part of.
4656 (setq thread (gnus-remove-thread id)))
4657 (setq old-pos (point-at-bol))
4658 (setq current (save-excursion
4659 (and (re-search-backward "[\r\n]" nil t)
4660 (gnus-summary-article-number))))
4661 ;; If this is a gathered thread, we have to go some re-gathering.
4662 (when (stringp (car thread))
4663 (let ((subject (car thread))
4665 (setq thread (cdr thread))
4667 (unless (memq (setq thr (gnus-id-to-thread
4669 (mail-header-id (caar thread)))))
4672 (setq thread (cdr thread)))
4673 ;; We now have all (unique) roots.
4674 (if (= (length roots) 1)
4675 ;; All the loose roots are now one solid root.
4676 (setq thread (car roots))
4677 (setq thread (cons subject (gnus-sort-threads roots))))))
4679 ;; We then insert this thread into the summary buffer.
4681 (goto-char (point-min))
4682 (forward-line (1- line)))
4683 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4684 (if gnus-show-threads
4685 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4686 (gnus-summary-prepare-unthreaded thread))
4687 (setq data (nreverse gnus-newsgroup-data))
4688 (setq threads gnus-newsgroup-threads))
4689 ;; We splice the new data into the data structure.
4690 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4691 ;;!!! then we want to insert at the beginning of the buffer.
4692 ;;!!! That happens to be true with Gnus now, but that may
4693 ;;!!! change in the future. Perhaps.
4694 (gnus-data-enter-list
4695 (if line nil current) data (- (point) old-pos))
4696 (setq gnus-newsgroup-threads
4697 (nconc threads gnus-newsgroup-threads))
4698 (gnus-data-compute-positions))))
4700 (defun gnus-number-to-header (number)
4701 "Return the header for article NUMBER."
4702 (let ((headers gnus-newsgroup-headers))
4704 (not (= number (mail-header-number (car headers)))))
4709 (defun gnus-parent-headers (in-headers &optional generation)
4710 "Return the headers of the GENERATIONth parent of HEADERS."
4712 (setq generation 1))
4714 (headers in-headers)
4717 (not (zerop generation))
4718 (setq references (mail-header-references headers)))
4719 (setq headers (if (and references
4720 (setq parent (gnus-parent-id references)))
4721 (car (gnus-id-to-thread parent))
4724 (and (not (eq headers in-headers))
4727 (defun gnus-id-to-thread (id)
4728 "Return the (sub-)thread where ID appears."
4729 (gnus-gethash id gnus-newsgroup-dependencies))
4731 (defun gnus-id-to-article (id)
4732 "Return the article number of ID."
4733 (let ((thread (gnus-id-to-thread id)))
4736 (mail-header-number (car thread)))))
4738 (defun gnus-id-to-header (id)
4739 "Return the article headers of ID."
4740 (car (gnus-id-to-thread id)))
4742 (defun gnus-article-displayed-root-p (article)
4743 "Say whether ARTICLE is a root(ish) article."
4744 (let ((level (gnus-summary-thread-level article))
4745 (refs (mail-header-references (gnus-summary-article-header article)))
4751 ((null (gnus-parent-id refs)) t)
4753 (null (setq particle (gnus-id-to-article
4754 (gnus-parent-id refs))))
4755 (null (gnus-summary-thread-level particle)))))))
4757 (defun gnus-root-id (id)
4758 "Return the id of the root of the thread where ID appears."
4760 (while (and id (setq prev (car (gnus-id-to-thread id))))
4762 id (gnus-parent-id (mail-header-references prev))))
4765 (defun gnus-articles-in-thread (thread)
4766 "Return the list of articles in THREAD."
4767 (cons (mail-header-number (car thread))
4768 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4770 (defun gnus-remove-thread (id &optional dont-remove)
4771 "Remove the thread that has ID in it."
4772 (let (headers thread last-id)
4773 ;; First go up in this thread until we find the root.
4774 (setq last-id (gnus-root-id id)
4775 headers (message-flatten-list (gnus-id-to-thread last-id)))
4776 ;; We have now found the real root of this thread. It might have
4777 ;; been gathered into some loose thread, so we have to search
4778 ;; through the threads to find the thread we wanted.
4779 (let ((threads gnus-newsgroup-threads)
4782 (setq sub (car threads))
4783 (if (stringp (car sub))
4784 ;; This is a gathered thread, so we look at the roots
4785 ;; below it to find whether this article is in this
4788 (setq sub (cdr sub))
4790 (when (member (caar sub) headers)
4791 (setq thread (car threads)
4794 (setq sub (cdr sub))))
4795 ;; It's an ordinary thread, so we check it.
4796 (when (eq (car sub) (car headers))
4799 (setq threads (cdr threads)))
4800 ;; If this article is in no thread, then it's a root.
4803 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4804 (setq thread (gnus-id-to-thread last-id)))
4807 thread ; We return this thread.
4809 (if (stringp (car thread))
4811 ;; If we use dummy roots, then we have to remove the
4812 ;; dummy root as well.
4813 (when (eq gnus-summary-make-false-root 'dummy)
4814 ;; We go to the dummy root by going to
4815 ;; the first sub-"thread", and then one line up.
4816 (gnus-summary-goto-article
4817 (mail-header-number (caadr thread)))
4820 (gnus-data-compute-positions))
4821 (setq thread (cdr thread))
4823 (gnus-remove-thread-1 (car thread))
4824 (setq thread (cdr thread))))
4825 (gnus-remove-thread-1 thread))))))))
4827 (defun gnus-remove-thread-1 (thread)
4828 "Remove the thread THREAD recursively."
4829 (let ((number (mail-header-number (pop thread)))
4831 (setq thread (reverse thread))
4833 (gnus-remove-thread-1 (pop thread)))
4834 (when (setq d (gnus-data-find number))
4835 (goto-char (gnus-data-pos d))
4836 (gnus-summary-show-thread)
4842 (gnus-delete-line)))))))
4844 (defun gnus-sort-threads-recursive (threads func)
4845 (sort (mapcar (lambda (thread)
4848 (gnus-sort-threads-recursive (cdr thread) func))))
4851 (defun gnus-sort-threads-loop (threads func)
4852 (let* ((superthread (cons nil threads))
4853 (stack (list (cons superthread threads)))
4854 remaining-threads thread)
4856 (setq remaining-threads (cdr (car stack)))
4857 (if remaining-threads
4858 (progn (setq thread (car remaining-threads))
4859 (setcdr (car stack) (cdr remaining-threads))
4861 (push (cons thread (cdr thread)) stack)))
4862 (setq thread (caar stack))
4863 (setcdr thread (sort (cdr thread) func))
4867 (defun gnus-sort-threads (threads)
4869 (if (not gnus-thread-sort-functions)
4871 (gnus-message 8 "Sorting threads...")
4874 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4875 (gnus-sort-threads-recursive
4876 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4877 ;; Even after binding max-lisp-eval-depth, the recursive
4878 ;; sorter might fail for very long threads. In that case,
4879 ;; try using a (less well-tested) non-recursive sorter.
4880 (error (gnus-message 9 "Sorting threads with loop...")
4881 (gnus-sort-threads-loop
4882 threads (gnus-make-sort-function
4883 gnus-thread-sort-functions))))
4884 (gnus-message 8 "Sorting threads...done"))))
4886 (defun gnus-sort-articles (articles)
4888 (when gnus-article-sort-functions
4889 (gnus-message 7 "Sorting articles...")
4891 (setq gnus-newsgroup-headers
4892 (sort articles (gnus-make-sort-function
4893 gnus-article-sort-functions)))
4894 (gnus-message 7 "Sorting articles...done"))))
4896 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4897 (defmacro gnus-thread-header (thread)
4898 "Return header of first article in THREAD.
4899 Note that THREAD must never, ever be anything else than a variable -
4900 using some other form will lead to serious barfage."
4901 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4902 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4903 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4906 (defsubst gnus-article-sort-by-number (h1 h2)
4907 "Sort articles by article number."
4908 (< (mail-header-number h1)
4909 (mail-header-number h2)))
4911 (defun gnus-thread-sort-by-number (h1 h2)
4912 "Sort threads by root article number."
4913 (gnus-article-sort-by-number
4914 (gnus-thread-header h1) (gnus-thread-header h2)))
4916 (defsubst gnus-article-sort-by-random (h1 h2)
4917 "Sort articles randomly."
4920 (defun gnus-thread-sort-by-random (h1 h2)
4921 "Sort threads randomly."
4922 (gnus-article-sort-by-random
4923 (gnus-thread-header h1) (gnus-thread-header h2)))
4925 (defsubst gnus-article-sort-by-lines (h1 h2)
4926 "Sort articles by article Lines header."
4927 (< (mail-header-lines h1)
4928 (mail-header-lines h2)))
4930 (defun gnus-thread-sort-by-lines (h1 h2)
4931 "Sort threads by root article Lines header."
4932 (gnus-article-sort-by-lines
4933 (gnus-thread-header h1) (gnus-thread-header h2)))
4935 (defsubst gnus-article-sort-by-chars (h1 h2)
4936 "Sort articles by octet length."
4937 (< (mail-header-chars h1)
4938 (mail-header-chars h2)))
4940 (defun gnus-thread-sort-by-chars (h1 h2)
4941 "Sort threads by root article octet length."
4942 (gnus-article-sort-by-chars
4943 (gnus-thread-header h1) (gnus-thread-header h2)))
4945 (defsubst gnus-article-sort-by-author (h1 h2)
4946 "Sort articles by root author."
4948 (let ((extract (funcall
4949 gnus-extract-address-components
4950 (mail-header-from h1))))
4951 (or (car extract) (cadr extract) ""))
4952 (let ((extract (funcall
4953 gnus-extract-address-components
4954 (mail-header-from h2))))
4955 (or (car extract) (cadr extract) ""))))
4957 (defun gnus-thread-sort-by-author (h1 h2)
4958 "Sort threads by root author."
4959 (gnus-article-sort-by-author
4960 (gnus-thread-header h1) (gnus-thread-header h2)))
4962 (defsubst gnus-article-sort-by-recipient (h1 h2)
4963 "Sort articles by recipient."
4965 (let ((extract (funcall
4966 gnus-extract-address-components
4967 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4968 (or (car extract) (cadr extract)))
4969 (let ((extract (funcall
4970 gnus-extract-address-components
4971 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4972 (or (car extract) (cadr extract)))))
4974 (defun gnus-thread-sort-by-recipient (h1 h2)
4975 "Sort threads by root recipient."
4976 (gnus-article-sort-by-recipient
4977 (gnus-thread-header h1) (gnus-thread-header h2)))
4979 (defsubst gnus-article-sort-by-subject (h1 h2)
4980 "Sort articles by root subject."
4982 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4983 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4985 (defun gnus-thread-sort-by-subject (h1 h2)
4986 "Sort threads by root subject."
4987 (gnus-article-sort-by-subject
4988 (gnus-thread-header h1) (gnus-thread-header h2)))
4990 (defsubst gnus-article-sort-by-date (h1 h2)
4991 "Sort articles by root article date."
4993 (gnus-date-get-time (mail-header-date h1))
4994 (gnus-date-get-time (mail-header-date h2))))
4996 (defun gnus-thread-sort-by-date (h1 h2)
4997 "Sort threads by root article date."
4998 (gnus-article-sort-by-date
4999 (gnus-thread-header h1) (gnus-thread-header h2)))
5001 (defsubst gnus-article-sort-by-score (h1 h2)
5002 "Sort articles by root article score.
5003 Unscored articles will be counted as having a score of zero."
5004 (> (or (cdr (assq (mail-header-number h1)
5005 gnus-newsgroup-scored))
5006 gnus-summary-default-score 0)
5007 (or (cdr (assq (mail-header-number h2)
5008 gnus-newsgroup-scored))
5009 gnus-summary-default-score 0)))
5011 (defun gnus-thread-sort-by-score (h1 h2)
5012 "Sort threads by root article score."
5013 (gnus-article-sort-by-score
5014 (gnus-thread-header h1) (gnus-thread-header h2)))
5016 (defun gnus-thread-sort-by-total-score (h1 h2)
5017 "Sort threads by the sum of all scores in the thread.
5018 Unscored articles will be counted as having a score of zero."
5019 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
5021 (defun gnus-thread-total-score (thread)
5022 ;; This function find the total score of THREAD.
5027 (if (stringp (car thread))
5028 (apply gnus-thread-score-function 0
5029 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
5030 (gnus-thread-total-score-1 thread)))
5032 (gnus-thread-total-score-1 (list thread)))))
5034 (defun gnus-article-sort-by-most-recent-number (h1 h2)
5035 "Sort articles by number."
5036 (gnus-article-sort-by-number h1 h2))
5038 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
5039 "Sort threads such that the thread with the most recently arrived article comes first."
5040 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5042 (defun gnus-thread-highest-number (thread)
5043 "Return the highest article number in THREAD."
5044 (apply 'max (mapcar (lambda (header)
5045 (mail-header-number header))
5046 (message-flatten-list thread))))
5048 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5049 "Sort articles by number."
5050 (gnus-article-sort-by-date h1 h2))
5052 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5053 "Sort threads such that the thread with the most recently dated article comes first."
5054 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5056 ; Since this is called not only to sort the top-level threads, but
5057 ; also in recursive sorts to order the articles within a thread, each
5058 ; article will be processed many times. Thus it speeds things up
5059 ; quite a bit to use gnus-date-get-time, which caches the time value.
5060 (defun gnus-thread-latest-date (thread)
5061 "Return the highest article date in THREAD."
5063 (mapcar (lambda (header) (gnus-float-time
5065 (mail-header-date header))))
5066 (message-flatten-list thread))))
5068 (defun gnus-thread-total-score-1 (root)
5069 ;; This function find the total score of the thread below ROOT.
5070 (setq root (car root))
5071 (apply gnus-thread-score-function
5073 (mapcar 'gnus-thread-total-score
5074 (cdr (gnus-id-to-thread (mail-header-id root))))
5075 (when (> (mail-header-number root) 0)
5076 (list (or (cdr (assq (mail-header-number root)
5077 gnus-newsgroup-scored))
5078 gnus-summary-default-score 0))))
5079 (list gnus-summary-default-score)
5082 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5083 (defvar gnus-tmp-prev-subject nil)
5084 (defvar gnus-tmp-false-parent nil)
5085 (defvar gnus-tmp-root-expunged nil)
5086 (defvar gnus-tmp-dummy-line nil)
5088 (defun gnus-extra-header (type &optional header)
5089 "Return the extra header of TYPE."
5090 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5093 (defvar gnus-tmp-thread-tree-header-string "")
5095 (defcustom gnus-sum-thread-tree-root "> "
5096 "With %B spec, used for the root of a thread.
5097 If nil, use subject instead."
5099 :type '(radio (const :format "%v " nil) string)
5100 :group 'gnus-thread)
5102 (defcustom gnus-sum-thread-tree-false-root "> "
5103 "With %B spec, used for a false root of a thread.
5104 If nil, use subject instead."
5106 :type '(radio (const :format "%v " nil) string)
5107 :group 'gnus-thread)
5109 (defcustom gnus-sum-thread-tree-single-indent ""
5110 "With %B spec, used for a thread with just one message.
5111 If nil, use subject instead."
5113 :type '(radio (const :format "%v " nil) string)
5114 :group 'gnus-thread)
5116 (defcustom gnus-sum-thread-tree-vertical "| "
5117 "With %B spec, used for drawing a vertical line."
5120 :group 'gnus-thread)
5122 (defcustom gnus-sum-thread-tree-indent " "
5123 "With %B spec, used for indenting."
5126 :group 'gnus-thread)
5128 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5129 "With %B spec, used for a leaf with brothers."
5132 :group 'gnus-thread)
5134 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5135 "With %B spec, used for a leaf without brothers."
5138 :group 'gnus-thread)
5140 (defcustom gnus-summary-display-while-building nil
5141 "If non-nil, show and update the summary buffer as it's being built.
5142 If the value is t, update the buffer after every line is inserted. If
5143 the value is an integer (N), update the display every N lines."
5146 :type '(choice (const :tag "off" nil)
5148 (const :tag "frequently" t)))
5150 (defun gnus-summary-prepare-threads (threads)
5151 "Prepare summary buffer from THREADS and indentation LEVEL.
5152 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5153 or a straight list of headers."
5154 (gnus-message 7 "Generating summary...")
5156 (setq gnus-newsgroup-threads threads)
5159 (let ((gnus-tmp-level 0)
5160 (default-score (or gnus-summary-default-score 0))
5161 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5162 (building-line-count gnus-summary-display-while-building)
5163 (building-count (integerp gnus-summary-display-while-building))
5164 thread number subject stack state gnus-tmp-gathered beg-match
5165 new-roots gnus-tmp-new-adopts thread-end simp-subject
5166 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5167 gnus-tmp-replied gnus-tmp-subject-or-nil
5168 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5169 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5170 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5173 (setq gnus-tmp-prev-subject nil
5174 gnus-tmp-thread-tree-header-string "")
5176 (if (vectorp (car threads))
5177 ;; If this is a straight (sic) list of headers, then a
5178 ;; threaded summary display isn't required, so we just create
5179 ;; an unthreaded one.
5180 (gnus-summary-prepare-unthreaded threads)
5182 ;; Do the threaded display.
5184 (if gnus-summary-display-while-building
5185 (switch-to-buffer (buffer-name)))
5186 (while (or threads stack gnus-tmp-new-adopts new-roots)
5188 (if (and (= gnus-tmp-level 0)
5191 (not gnus-tmp-false-parent)
5192 (or gnus-tmp-new-adopts new-roots))
5193 (if gnus-tmp-new-adopts
5194 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5195 thread (list (car gnus-tmp-new-adopts))
5196 gnus-tmp-header (caar thread)
5197 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5199 (setq thread (list (car new-roots))
5200 gnus-tmp-header (caar thread)
5201 new-roots (cdr new-roots))))
5204 ;; If there are some threads, we do them before the
5205 ;; threads on the stack.
5206 (setq thread threads
5207 gnus-tmp-header (caar thread))
5208 ;; There were no current threads, so we pop something off
5210 (setq state (car stack)
5211 gnus-tmp-level (car state)
5212 tree-stack (cadr state)
5213 thread (caddr state)
5215 gnus-tmp-header (caar thread))))
5217 (setq gnus-tmp-false-parent nil)
5218 (setq gnus-tmp-root-expunged nil)
5219 (setq thread-end nil)
5221 (if (stringp gnus-tmp-header)
5222 ;; The header is a dummy root.
5224 ((eq gnus-summary-make-false-root 'adopt)
5225 ;; We let the first article adopt the rest.
5226 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5228 (setq gnus-tmp-gathered
5230 (lambda (h) (mail-header-number (car h)))
5233 (setq thread (cons (list (caar thread)
5236 (setq gnus-tmp-level -1
5237 gnus-tmp-false-parent t))
5238 ((eq gnus-summary-make-false-root 'empty)
5239 ;; We print adopted articles with empty subject fields.
5240 (setq gnus-tmp-gathered
5242 (lambda (h) (mail-header-number (car h)))
5245 (setq gnus-tmp-level -1))
5246 ((eq gnus-summary-make-false-root 'dummy)
5247 ;; We remember that we probably want to output a dummy
5249 (setq gnus-tmp-dummy-line gnus-tmp-header)
5250 (setq gnus-tmp-prev-subject gnus-tmp-header))
5252 ;; We do not make a root for the gathered
5253 ;; sub-threads at all.
5254 (setq gnus-tmp-level -1)))
5256 (setq number (mail-header-number gnus-tmp-header)
5257 subject (mail-header-subject gnus-tmp-header)
5258 simp-subject (gnus-simplify-subject-fully subject))
5261 ;; If the thread has changed subject, we might want to make
5262 ;; this subthread into a root.
5263 ((and (null gnus-thread-ignore-subject)
5264 (not (zerop gnus-tmp-level))
5265 gnus-tmp-prev-subject
5266 (not (string= gnus-tmp-prev-subject simp-subject)))
5267 (setq new-roots (nconc new-roots (list (car thread)))
5269 gnus-tmp-header nil))
5270 ;; If the article lies outside the current limit,
5271 ;; then we do not display it.
5272 ((not (memq number gnus-newsgroup-limit))
5273 (setq gnus-tmp-gathered
5275 (lambda (h) (mail-header-number (car h)))
5278 (setq gnus-tmp-new-adopts (if (cdar thread)
5279 (append gnus-tmp-new-adopts
5281 gnus-tmp-new-adopts)
5283 gnus-tmp-header nil)
5284 (when (zerop gnus-tmp-level)
5285 (setq gnus-tmp-root-expunged t)))
5286 ;; Perhaps this article is to be marked as read?
5287 ((and gnus-summary-mark-below
5288 (< (or (cdr (assq number gnus-newsgroup-scored))
5290 gnus-summary-mark-below)
5291 ;; Don't touch sparse articles.
5292 (not (gnus-summary-article-sparse-p number))
5293 (not (gnus-summary-article-ancient-p number)))
5294 (setq gnus-newsgroup-unreads
5295 (delq number gnus-newsgroup-unreads))
5296 (if gnus-newsgroup-auto-expire
5297 (setq gnus-newsgroup-expirable
5298 (gnus-add-to-sorted-list
5299 gnus-newsgroup-expirable number))
5300 (push (cons number gnus-low-score-mark)
5301 gnus-newsgroup-reads))))
5303 (when gnus-tmp-header
5304 ;; We may have an old dummy line to output before this
5306 (when (and gnus-tmp-dummy-line
5309 (mail-header-subject gnus-tmp-header)))
5310 (gnus-summary-insert-dummy-line
5311 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5312 (setq gnus-tmp-dummy-line nil))
5314 ;; Compute the mark.
5315 (setq gnus-tmp-unread (gnus-article-mark number))
5317 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5318 gnus-tmp-header gnus-tmp-level)
5319 gnus-newsgroup-data)
5321 ;; Actually insert the line.
5323 gnus-tmp-subject-or-nil
5325 ((and gnus-thread-ignore-subject
5326 gnus-tmp-prev-subject
5327 (not (string= gnus-tmp-prev-subject simp-subject)))
5329 ((zerop gnus-tmp-level)
5330 (if (and (eq gnus-summary-make-false-root 'empty)
5331 (memq number gnus-tmp-gathered)
5332 gnus-tmp-prev-subject
5333 (string= gnus-tmp-prev-subject simp-subject))
5334 gnus-summary-same-subject
5336 (t gnus-summary-same-subject)))
5337 (if (and (eq gnus-summary-make-false-root 'adopt)
5338 (= gnus-tmp-level 1)
5339 (memq number gnus-tmp-gathered))
5340 (setq gnus-tmp-opening-bracket ?\<
5341 gnus-tmp-closing-bracket ?\>)
5342 (setq gnus-tmp-opening-bracket ?\[
5343 gnus-tmp-closing-bracket ?\]))
5344 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5345 (gnus-make-thread-indent-array
5346 (max (* 2 (length gnus-thread-indent-array))
5349 gnus-tmp-indentation
5350 (aref gnus-thread-indent-array gnus-tmp-level)
5351 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5352 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5353 gnus-summary-default-score 0)
5355 (if (or (null gnus-summary-default-score)
5356 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5357 gnus-summary-zcore-fuzz))
5359 (if (< gnus-tmp-score gnus-summary-default-score)
5360 gnus-score-below-mark gnus-score-over-mark))
5362 (cond ((memq number gnus-newsgroup-processable)
5364 ((memq number gnus-newsgroup-cached)
5366 ((memq number gnus-newsgroup-replied)
5368 ((memq number gnus-newsgroup-forwarded)
5369 gnus-forwarded-mark)
5370 ((memq number gnus-newsgroup-saved)
5372 ((memq number gnus-newsgroup-unseen)
5376 (cond ((memq number gnus-newsgroup-undownloaded)
5377 gnus-undownloaded-mark)
5378 (gnus-newsgroup-agentized
5379 gnus-downloaded-mark)
5382 gnus-tmp-from (mail-header-from gnus-tmp-header)
5385 ((string-match "<[^>]+> *$" gnus-tmp-from)
5386 (setq beg-match (match-beginning 0))
5387 (or (and (string-match "^\".+\"" gnus-tmp-from)
5388 (substring gnus-tmp-from 1 (1- (match-end 0))))
5389 (substring gnus-tmp-from 0 beg-match)))
5390 ((string-match "(.+)" gnus-tmp-from)
5391 (substring gnus-tmp-from
5392 (1+ (match-beginning 0)) (1- (match-end 0))))
5396 gnus-tmp-thread-tree-header-string
5398 ((not gnus-show-threads) "")
5399 ((zerop gnus-tmp-level)
5400 (cond ((cdar thread)
5401 (or gnus-sum-thread-tree-root subject))
5402 (gnus-tmp-new-adopts
5403 (or gnus-sum-thread-tree-false-root subject))
5405 (or gnus-sum-thread-tree-single-indent subject))))
5407 (concat (apply 'concat
5408 (mapcar (lambda (item)
5410 gnus-sum-thread-tree-vertical
5411 gnus-sum-thread-tree-indent))
5412 (cdr (reverse tree-stack))))
5414 gnus-sum-thread-tree-leaf-with-other
5415 gnus-sum-thread-tree-single-leaf)))))
5416 (when (string= gnus-tmp-name "")
5417 (setq gnus-tmp-name gnus-tmp-from))
5418 (unless (numberp gnus-tmp-lines)
5419 (setq gnus-tmp-lines -1))
5420 (if (= gnus-tmp-lines -1)
5421 (setq gnus-tmp-lines "?")
5422 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5423 (gnus-put-text-property
5425 (progn (eval gnus-summary-line-format-spec) (point))
5426 'gnus-number number)
5429 (gnus-summary-highlight-line)
5430 (when gnus-summary-update-hook
5431 (gnus-run-hooks 'gnus-summary-update-hook))
5434 (setq gnus-tmp-prev-subject simp-subject)))
5436 (when (nth 1 thread)
5437 (push (list (max 0 gnus-tmp-level)
5438 (copy-sequence tree-stack)
5441 (push (if (nth 1 thread) 1 0) tree-stack)
5442 (incf gnus-tmp-level)
5443 (setq threads (if thread-end nil (cdar thread)))
5444 (if gnus-summary-display-while-building
5447 ;; use a set frequency
5448 (setq building-line-count (1- building-line-count))
5449 (when (= building-line-count 0)
5451 (setq building-line-count
5452 gnus-summary-display-while-building)))
5456 (setq gnus-tmp-level 0)))))
5457 (gnus-message 7 "Generating summary...done"))
5459 (defun gnus-summary-prepare-unthreaded (headers)
5460 "Generate an unthreaded summary buffer based on HEADERS."
5461 (let (header number mark)
5466 ;; We may have to root out some bad articles...
5467 (when (memq (setq number (mail-header-number
5468 (setq header (pop headers))))
5469 gnus-newsgroup-limit)
5470 ;; Mark article as read when it has a low score.
5471 (when (and gnus-summary-mark-below
5472 (< (or (cdr (assq number gnus-newsgroup-scored))
5473 gnus-summary-default-score 0)
5474 gnus-summary-mark-below)
5475 (not (gnus-summary-article-ancient-p number)))
5476 (setq gnus-newsgroup-unreads
5477 (delq number gnus-newsgroup-unreads))
5478 (if gnus-newsgroup-auto-expire
5479 (push number gnus-newsgroup-expirable)
5480 (push (cons number gnus-low-score-mark)
5481 gnus-newsgroup-reads)))
5483 (setq mark (gnus-article-mark number))
5484 (push (gnus-data-make number mark (1+ (point)) header 0)
5485 gnus-newsgroup-data)
5486 (gnus-summary-insert-line
5488 (memq number gnus-newsgroup-undownloaded)
5489 mark (memq number gnus-newsgroup-replied)
5490 (memq number gnus-newsgroup-expirable)
5491 (mail-header-subject header) nil
5492 (cdr (assq number gnus-newsgroup-scored))
5493 (memq number gnus-newsgroup-processable))))))
5495 (declare-function gnus-parameter-list-identifier "gnus-art" (name) t)
5497 (defun gnus-group-get-list-identifiers (group)
5498 "Get list identifier regexp for GROUP."
5499 (or (gnus-parameter-list-identifier group)
5500 (if (consp gnus-list-identifiers)
5501 (mapconcat 'identity gnus-list-identifiers " *\\|")
5502 gnus-list-identifiers)))
5504 (defun gnus-summary-remove-list-identifiers ()
5505 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5506 (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name))
5509 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5510 (dolist (header gnus-newsgroup-headers)
5511 (setq subject (mail-header-subject header)
5513 (while (string-match regexp subject)
5515 (concat (substring subject 0 (match-beginning 1))
5516 (substring subject (match-end 0)))
5519 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5521 (concat (substring subject 0 (match-beginning 1))
5522 (substring subject (match-end 1)))))
5523 (mail-header-set-subject header subject))))))
5525 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5526 "Fetch headers of ARTICLES."
5527 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5528 (gnus-message 7 "Fetching headers for %s..." name)
5531 (setq gnus-headers-retrieved-by
5532 (gnus-retrieve-headers
5533 articles gnus-newsgroup-name
5535 ;; We might want to fetch old headers, but
5536 ;; not if there is only 1 article.
5538 (not (eq gnus-fetch-old-headers 'some))
5539 (not (numberp gnus-fetch-old-headers)))
5540 (> (length articles) 1))
5541 gnus-fetch-old-headers)))))
5542 (gnus-get-newsgroup-headers-xover
5543 articles force-new dependencies gnus-newsgroup-name t)
5544 (gnus-get-newsgroup-headers dependencies force-new))
5545 (gnus-message 7 "Fetching headers for %s...done" name))))
5547 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5548 "Select newsgroup GROUP.
5549 If READ-ALL is non-nil, all articles in the group are selected.
5550 If SELECT-ARTICLES, only select those articles from GROUP."
5551 (let* ((entry (gnus-group-entry group))
5552 ;;!!! Dirty hack; should be removed.
5553 (gnus-summary-ignore-duplicates
5554 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5556 gnus-summary-ignore-duplicates))
5557 (info (nth 2 entry))
5558 charset articles fetched-articles cached)
5560 (unless (gnus-check-server
5561 (set (make-local-variable 'gnus-current-select-method)
5562 (gnus-find-method-for-group group)))
5563 (error "Couldn't open server"))
5564 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5566 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5567 (gnus-activate-group group) ; Or we can activate it...
5568 (progn ; Or we bug out.
5569 (when (equal major-mode 'gnus-summary-mode)
5570 (gnus-kill-buffer (current-buffer)))
5572 "Couldn't activate group %s: %s"
5573 (mm-decode-coding-string group charset)
5574 (mm-decode-coding-string (gnus-status-message group) charset))))
5576 (unless (gnus-request-group group t)
5577 (when (equal major-mode 'gnus-summary-mode)
5578 (gnus-kill-buffer (current-buffer)))
5579 (error "Couldn't request group %s: %s"
5580 (mm-decode-coding-string group charset)
5581 (mm-decode-coding-string (gnus-status-message group) charset)))
5583 (when (and gnus-agent
5584 (gnus-active group))
5585 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5587 (setq gnus-summary-use-undownloaded-faces
5588 (gnus-agent-find-parameter
5590 'agent-enable-undownloaded-faces)))
5592 (setq gnus-newsgroup-name group
5593 gnus-newsgroup-unselected nil
5594 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5596 (let ((display (gnus-group-find-parameter group 'display)))
5597 (setq gnus-newsgroup-display
5599 ((not (zerop (or (car-safe read-all) 0)))
5600 ;; The user entered the group with C-u SPC/RET, let's show
5606 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5608 ;; The following is probably the "correct" solution, but
5609 ;; it makes Gnus fetch all headers and then limit the
5610 ;; articles (which is slow), so instead we hack the
5611 ;; select-articles parameter instead. -- Simon Josefsson
5614 ;; (gnus-byte-compile
5615 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5617 (setq select-articles
5618 (gnus-uncompress-range
5619 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5623 (cdr (gnus-active group)))))
5628 (gnus-summary-setup-default-charset)
5630 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5631 (when (gnus-virtual-group-p group)
5632 (setq cached gnus-newsgroup-cached))
5634 (setq gnus-newsgroup-unreads
5635 (gnus-sorted-ndifference
5636 (gnus-sorted-ndifference gnus-newsgroup-unreads
5637 gnus-newsgroup-marked)
5638 gnus-newsgroup-dormant))
5640 (setq gnus-newsgroup-processable nil)
5642 (gnus-update-read-articles group gnus-newsgroup-unreads t)
5644 ;; Adjust and set lists of article marks.
5646 (gnus-adjust-marked-articles info))
5647 (if (setq articles select-articles)
5648 (setq gnus-newsgroup-unselected
5649 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5650 (setq articles (gnus-articles-to-read group read-all)))
5654 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5656 ((eq articles 0) nil)
5658 ;; Init the dependencies hash table.
5659 (setq gnus-newsgroup-dependencies
5660 (gnus-make-hashtable (length articles)))
5661 (if (gnus-buffer-live-p gnus-group-buffer)
5662 (gnus-set-global-variables)
5663 (set-default 'gnus-newsgroup-name gnus-newsgroup-name))
5664 ;; Retrieve the headers and read them in.
5666 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5668 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5670 (setq gnus-newsgroup-cached cached))
5672 ;; Suppress duplicates?
5673 (when gnus-suppress-duplicates
5674 (gnus-dup-suppress-articles))
5676 ;; Set the initial limit.
5677 (setq gnus-newsgroup-limit (copy-sequence articles))
5678 ;; Remove canceled articles from the list of unread articles.
5679 (setq fetched-articles
5680 (mapcar (lambda (headers) (mail-header-number headers))
5681 gnus-newsgroup-headers))
5682 (setq gnus-newsgroup-articles fetched-articles)
5683 (setq gnus-newsgroup-unreads
5684 (gnus-sorted-nintersection
5685 gnus-newsgroup-unreads fetched-articles))
5686 (gnus-compute-unseen-list)
5688 ;; Removed marked articles that do not exist.
5689 (gnus-update-missing-marks
5690 (gnus-sorted-difference articles fetched-articles))
5691 ;; We might want to build some more threads first.
5692 (when (and gnus-fetch-old-headers
5693 (eq gnus-headers-retrieved-by 'nov))
5694 (if (eq gnus-fetch-old-headers 'invisible)
5695 (gnus-build-all-threads)
5696 (gnus-build-old-threads)))
5697 ;; Let the Gnus agent mark articles as read.
5699 (gnus-agent-get-undownloaded-list))
5700 ;; Remove list identifiers from subject
5701 (gnus-summary-remove-list-identifiers)
5702 ;; Check whether auto-expire is to be done in this group.
5703 (setq gnus-newsgroup-auto-expire
5704 (and (gnus-group-auto-expirable-p group)
5705 (not (gnus-group-read-only-p group))))
5706 ;; Set up the article buffer now, if necessary.
5707 (unless (and gnus-single-article-buffer
5708 (equal gnus-article-buffer "*Article*"))
5709 (gnus-article-setup-buffer))
5710 ;; First and last article in this newsgroup.
5711 (when gnus-newsgroup-headers
5712 (setq gnus-newsgroup-begin
5713 (mail-header-number (car gnus-newsgroup-headers))
5716 (gnus-last-element gnus-newsgroup-headers))))
5717 ;; GROUP is successfully selected.
5718 (or gnus-newsgroup-headers t)))))
5720 (defun gnus-compute-unseen-list ()
5721 ;; The `seen' marks are treated specially.
5722 (if (not gnus-newsgroup-seen)
5723 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5724 (setq gnus-newsgroup-unseen
5725 (gnus-inverse-list-range-intersection
5726 gnus-newsgroup-articles gnus-newsgroup-seen))))
5728 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5730 (defun gnus-summary-display-make-predicate (display)
5731 (require 'gnus-agent)
5732 (when (= (length display) 1)
5733 (setq display (car display)))
5734 (unless gnus-summary-display-cache
5735 (dolist (elem (append '((unread . unread)
5738 gnus-article-mark-lists))
5739 (push (cons (cdr elem)
5740 (gnus-byte-compile ;Why bother?
5741 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5742 gnus-summary-display-cache)))
5743 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5744 (gnus-category-predicate-cache gnus-summary-display-cache))
5745 (gnus-get-predicate display)))
5747 ;; Uses the dynamically bound `gnus-number' variable.
5748 (defvar gnus-number)
5749 (defun gnus-article-marked-p (type &optional article)
5750 (let ((article (or article gnus-number)))
5753 (memq article gnus-newsgroup-marked))
5755 (memq article gnus-newsgroup-spam-marked))
5757 (memq article gnus-newsgroup-unsendable))
5758 ((eq type 'undownload)
5759 (memq article gnus-newsgroup-undownloaded))
5760 ((eq type 'download)
5761 (memq article gnus-newsgroup-downloadable))
5763 (memq article gnus-newsgroup-unreads))
5765 (memq article gnus-newsgroup-reads))
5767 (memq article gnus-newsgroup-dormant) )
5769 (memq article gnus-newsgroup-expirable))
5771 (memq article gnus-newsgroup-replied))
5773 (memq article gnus-newsgroup-killed))
5774 ((eq type 'bookmark)
5775 (assq article gnus-newsgroup-bookmarks))
5777 (assq article gnus-newsgroup-scored))
5779 (memq article gnus-newsgroup-saved))
5781 (memq article gnus-newsgroup-cached))
5783 (memq article gnus-newsgroup-forwarded))
5785 (not (memq article gnus-newsgroup-unseen)))
5788 (defun gnus-articles-to-read (group &optional read-all)
5789 "Find out what articles the user wants to read."
5790 (let* ((only-read-p t)
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 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5820 (scored (length scored-list))
5821 (number (length articles))
5822 (marked (+ (length gnus-newsgroup-marked)
5823 (length gnus-newsgroup-dormant)))
5828 ((numberp gnus-newsgroup-display)
5829 gnus-newsgroup-display)
5833 ((and (or (<= scored marked) (= scored number))
5834 (numberp gnus-large-newsgroup)
5835 (> number gnus-large-newsgroup))
5836 (let* ((cursor-in-echo-area nil)
5837 (initial (gnus-parameter-large-newsgroup-initial
5838 gnus-newsgroup-name))
5839 (default (if only-read-p
5840 (or initial gnus-large-newsgroup)
5846 "How many articles from %s (available %d, default %d): "
5847 (gnus-group-decoded-name
5848 (gnus-group-real-name gnus-newsgroup-name))
5851 "How many articles from %s (%d default): "
5852 (gnus-group-decoded-name
5853 (gnus-group-real-name gnus-newsgroup-name))
5857 (number-to-string default))))
5858 (if (string-match "^[ \t]*$" input) number input)))
5859 ((and (> scored marked) (< scored number)
5860 (> (- scored number) 20))
5863 (format "%s %s (%d scored, %d total): "
5864 "How many articles from"
5865 (gnus-group-decoded-name
5866 (gnus-group-real-name gnus-newsgroup-name))
5868 (if (string-match "^[ \t]*$" input)
5872 (message "Quit getting the articles to read")
5874 (setq select (if (stringp select) (string-to-number select) select))
5875 (if (or (null select) (zerop select))
5877 (if (and (not (zerop scored)) (<= (abs select) scored))
5879 (setq articles (sort scored-list '<))
5880 (setq number (length articles)))
5881 (setq articles (copy-sequence articles)))
5883 (when (< (abs select) number)
5885 ;; Select the N oldest articles.
5886 (setcdr (nthcdr (1- (abs select)) articles) nil)
5887 ;; Select the N most recent articles.
5888 (setq articles (nthcdr (- number select) articles))))
5889 (setq gnus-newsgroup-unselected
5890 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5891 (when gnus-alter-articles-to-read-function
5894 (funcall gnus-alter-articles-to-read-function
5895 gnus-newsgroup-name articles)
5899 (defun gnus-killed-articles (killed articles)
5902 (when (inline (gnus-member-of-range (car articles) killed))
5903 (push (car articles) out))
5904 (setq articles (cdr articles)))
5907 (defun gnus-article-mark-to-type (mark)
5908 "Return the type of MARK."
5909 (or (cadr (assq mark gnus-article-special-mark-lists))
5912 (defun gnus-article-unpropagatable-p (mark)
5913 "Return whether MARK should be propagated to back end."
5914 (memq mark gnus-article-unpropagated-mark-lists))
5916 (defun gnus-adjust-marked-articles (info)
5917 "Set all article lists and remove all marks that are no longer valid."
5918 (let* ((marked-lists (gnus-info-marks info))
5919 (active (gnus-active (gnus-info-group info)))
5922 (types gnus-article-mark-lists)
5923 marks var articles article mark mark-type
5925 ;; Hack to avoid adjusting marks for imap.
5926 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5930 (dolist (marks marked-lists)
5931 (setq mark (car marks)
5932 mark-type (gnus-article-mark-to-type mark)
5933 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5934 ;; We set the variable according to the type of the marks list,
5935 ;; and then adjust the marks to a subset of the active articles.
5937 ;; Adjust "simple" lists - compressed yet unsorted
5938 ((eq mark-type 'list)
5939 ;; Simultaneously uncompress and clip to active range
5940 ;; See gnus-uncompress-range for a description of possible marks
5942 (if (not (cadr marks))
5944 (setq articles (if (numberp (cddr marks))
5950 (while (setq article (pop articles))
5951 (cond ((consp article)
5952 (setq bgn (max (car article) min)
5953 end (min (cdr article) max))
5955 (setq l (setcdr l (cons bgn nil))
5957 ((and (<= min article)
5959 (setq l (setcdr l (cons article nil))))))
5960 (set var (cdr lh)))))
5962 ((eq mark-type 'tuple)
5963 (set var (setq articles (cdr marks)))
5964 (when (not (listp (cdr (symbol-value var))))
5965 (set var (list (symbol-value var))))
5966 (when (not (listp (cdr articles)))
5967 (setq articles (list articles)))
5969 (when (or (not (consp (setq article (pop articles))))
5970 (< (car article) min)
5971 (> (car article) max))
5972 (set var (delq article (symbol-value var))))))
5973 ;; Adjust ranges (sloppily).
5974 ((eq mark-type 'range)
5977 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5978 ;; It should be (seen (NUM1 . NUM2)).
5979 (when (numberp (cddr marks))
5980 (setcdr marks (list (cdr marks))))
5981 (setq articles (cdr marks))
5982 (while (and articles
5983 (or (and (consp (car articles))
5984 (> min (cdar articles)))
5985 (and (numberp (car articles))
5986 (> min (car articles)))))
5988 (set var articles))))))))
5990 (defun gnus-update-missing-marks (missing)
5991 "Go through the list of MISSING articles and remove them from the mark lists."
5994 ;; Go through all types.
5995 (dolist (elem gnus-article-mark-lists)
5996 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5997 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5998 (when (symbol-value var)
5999 ;; This list has articles. So we delete all missing
6000 ;; articles from it.
6003 (set var (delq (pop m) (symbol-value var))))))))))
6005 (defun gnus-update-marks ()
6006 "Enter the various lists of marked articles into the newsgroup info list."
6007 (let ((types gnus-article-mark-lists)
6008 (info (gnus-get-info gnus-newsgroup-name))
6009 type list newmarked symbol delta-marks)
6011 ;; Add all marks lists to the list of marks lists.
6012 (while (setq type (pop types))
6013 (setq list (symbol-value
6015 (intern (format "gnus-newsgroup-%s" (car type))))))
6018 ;; Get rid of the entries of the articles that have the
6020 (when (and (eq (cdr type) 'score)
6024 (prev (cons nil list))
6027 (if (or (not (consp (car arts)))
6028 (= (cdar arts) gnus-summary-default-score))
6029 (setcdr prev (cdr arts))
6031 (setq arts (cdr arts)))
6032 (setq list (cdr all)))))
6034 (when (eq (cdr type) 'seen)
6035 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
6037 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
6038 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
6040 (when (and (gnus-check-backend-function
6041 'request-set-mark gnus-newsgroup-name)
6042 (not (gnus-article-unpropagatable-p (cdr type))))
6043 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
6044 ;; Don't do anything about marks for articles we
6045 ;; didn't actually get any headers for.
6047 (gnus-list-range-intersection
6048 gnus-newsgroup-articles
6049 (gnus-remove-from-range (gnus-copy-sequence old) list)))
6051 (gnus-list-range-intersection
6052 gnus-newsgroup-articles
6053 (gnus-remove-from-range
6054 (gnus-copy-sequence list) old))))
6056 (push (list add 'add (list (cdr type))) delta-marks))
6058 ;; Don't delete marks from outside the active range.
6059 ;; This shouldn't happen, but is a sanity check.
6060 (setq del (gnus-sorted-range-intersection
6061 (gnus-active gnus-newsgroup-name) del))
6062 (push (list del 'del (list (cdr type))) delta-marks))))
6065 (push (cons (cdr type) list) newmarked)))
6068 (unless (gnus-check-group gnus-newsgroup-name)
6069 (error "Can't open server for %s" gnus-newsgroup-name))
6070 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6072 ;; Enter these new marks into the info of the group.
6074 (setcar (nthcdr 3 info) newmarked)
6075 ;; Add the marks lists to the end of the info.
6077 (setcdr (nthcdr 2 info) (list newmarked))))
6079 ;; Cut off the end of the info if there's nothing else there.
6083 (when (nthcdr (decf i) info)
6084 (setcdr (nthcdr i info) nil)))))))
6086 (defun gnus-set-mode-line (where)
6087 "Set the mode line of the article or summary buffers.
6088 If WHERE is `summary', the summary mode line format will be used."
6089 ;; Is this mode line one we keep updated?
6090 (when (and (memq where gnus-updated-mode-lines)
6092 (intern (format "gnus-%s-mode-line-format-spec" where))))
6094 ;; We evaluate this in the summary buffer since these
6095 ;; variables are buffer-local to that buffer.
6096 (with-current-buffer gnus-summary-buffer
6097 ;; We bind all these variables that are used in the `eval' form
6099 (let* ((mformat (symbol-value
6101 (format "gnus-%s-mode-line-format-spec" where))))
6102 (gnus-tmp-group-name (gnus-mode-string-quote
6103 (gnus-group-decoded-name
6104 gnus-newsgroup-name)))
6105 (gnus-tmp-article-number (or gnus-current-article 0))
6106 (gnus-tmp-unread gnus-newsgroup-unreads)
6107 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6108 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6109 (gnus-tmp-unread-and-unselected
6110 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6111 (zerop gnus-tmp-unselected))
6113 ((zerop gnus-tmp-unselected)
6114 (format "{%d more}" gnus-tmp-unread-and-unticked))
6115 (t (format "{%d(+%d) more}"
6116 gnus-tmp-unread-and-unticked
6117 gnus-tmp-unselected))))
6119 (if (and gnus-current-headers
6120 (vectorp gnus-current-headers))
6121 (gnus-mode-string-quote
6122 (mail-header-subject gnus-current-headers))
6124 bufname-length max-len
6125 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6126 (setq mode-string (eval mformat))
6127 (setq bufname-length (if (string-match "%b" mode-string)
6130 (if (eq where 'summary)
6132 (get-buffer gnus-article-buffer))))
6135 (setq max-len (max 4 (if gnus-mode-non-string-length
6137 gnus-mode-non-string-length
6139 (length mode-string))))
6140 ;; We might have to chop a bit of the string off...
6141 (when (> (length mode-string) max-len)
6143 (concat (truncate-string-to-width mode-string (- max-len 3))
6145 ;; Update the mode line.
6146 (setq mode-line-buffer-identification
6147 (gnus-mode-line-buffer-identification (list mode-string)))
6148 (set-buffer-modified-p t))))
6150 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6151 "Go through the HEADERS list and add all Xrefs to a hash table.
6152 The resulting hash table is returned, or nil if no Xrefs were found."
6153 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6154 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6155 (xref-hashtb (gnus-make-hashtable))
6156 start group entry number xrefs header)
6158 (setq header (pop headers))
6159 (when (and (setq xrefs (mail-header-xref header))
6160 (not (memq (setq number (mail-header-number header))
6163 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6164 (setq start (match-end 0))
6165 (setq group (if prefix
6166 (concat prefix (substring xrefs (match-beginning 1)
6168 (substring xrefs (match-beginning 1) (match-end 1))))
6170 (string-to-number (substring xrefs (match-beginning 2)
6172 (if (setq entry (gnus-gethash group xref-hashtb))
6173 (setcdr entry (cons number (cdr entry)))
6174 (gnus-sethash group (cons number nil) xref-hashtb)))))
6175 (and start xref-hashtb)))
6177 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6178 "Look through all the headers and mark the Xrefs as read."
6179 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6180 name info xref-hashtb idlist method nth4)
6181 (with-current-buffer gnus-group-buffer
6182 (when (setq xref-hashtb
6183 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6186 (unless (string= from-newsgroup (setq name (symbol-name group)))
6187 (setq idlist (symbol-value group))
6188 ;; Dead groups are not updated.
6190 (setq info (gnus-get-info name))
6191 (when (stringp (setq nth4 (gnus-info-method info)))
6192 (setq nth4 (gnus-server-to-method nth4))))
6193 ;; Only do the xrefs if the group has the same
6194 ;; select method as the group we have just read.
6195 (or (gnus-methods-equal-p
6196 nth4 (gnus-find-method-for-group from-newsgroup))
6198 (equal nth4 (setq method (gnus-find-method-for-group
6200 (and (equal (car nth4) (car method))
6201 (equal (nth 1 nth4) (nth 1 method))))
6202 gnus-use-cross-reference
6203 (or (not (eq gnus-use-cross-reference t))
6205 ;; Only do cross-references on subscribed
6206 ;; groups, if that is what is wanted.
6207 (<= (gnus-info-level info) gnus-level-subscribed))
6208 (gnus-group-make-articles-read name idlist))))
6211 (defun gnus-compute-read-articles (group articles)
6212 (let* ((entry (gnus-group-entry group))
6213 (info (nth 2 entry))
6214 (active (gnus-active group))
6217 ;; First peel off all invalid article numbers.
6219 (let ((ids articles)
6221 (while (setq id (pop ids))
6222 (when (and first (> id (cdr active)))
6223 ;; We'll end up in this situation in one particular
6224 ;; obscure situation. If you re-scan a group and get
6225 ;; a new article that is cross-posted to a different
6226 ;; group that has not been re-scanned, you might get
6227 ;; crossposted article that has a higher number than
6228 ;; Gnus believes possible. So we re-activate this
6229 ;; group as well. This might mean doing the
6230 ;; crossposting thingy will *increase* the number
6231 ;; of articles in some groups. Tsk, tsk.
6232 (setq active (or (gnus-activate-group group) active)))
6233 (when (or (> id (cdr active))
6234 (< id (car active)))
6235 (setq articles (delq id articles))))))
6236 ;; If the read list is nil, we init it.
6238 (null (gnus-info-read info))
6240 (setq ninfo (cons 1 (1- (car active))))
6241 (setq ninfo (gnus-info-read info)))
6242 ;; Then we add the read articles to the range.
6244 ninfo (setq articles (sort articles '<))))))
6246 (defun gnus-group-make-articles-read (group articles)
6247 "Update the info of GROUP to say that ARTICLES are read."
6249 (entry (gnus-group-entry group))
6250 (info (nth 2 entry))
6251 (active (gnus-active group))
6253 (gnus-method-option-p
6254 (gnus-find-method-for-group group)
6258 ;; Group that Gnus doesn't know exists, but still allow the
6259 ;; backend to set marks.
6261 (gnus-request-set-mark
6262 group (list (list (gnus-compress-sequence (sort articles #'<))
6264 ;; Normal, subscribed groups.
6265 (setq range (gnus-compute-read-articles group articles))
6266 (with-current-buffer gnus-group-buffer
6269 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6270 (gnus-info-set-read ',info ',(gnus-info-read info))
6271 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6273 (gnus-request-set-mark
6274 ,group (list (list ',range 'del '(read)))))
6275 (gnus-group-update-group ,group t))))
6276 ;; Add the read articles to the range.
6277 (gnus-info-set-read info range)
6279 (gnus-request-set-mark group (list (list range 'add '(read)))))
6280 ;; Then we have to re-compute how many unread
6281 ;; articles there are in this group.
6285 (setq num (- (1+ (cdr active)) (car active))))
6286 ((not (listp (cdr range)))
6287 (setq num (- (cdr active) (- (1+ (cdr range))
6291 (if (numberp (car range))
6293 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6294 (setq range (cdr range)))
6295 (setq num (- (cdr active) num))))
6296 ;; Update the number of unread articles.
6298 ;; Update the group buffer.
6299 (unless (gnus-ephemeral-group-p group)
6300 (gnus-group-update-group group t))))))
6302 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6303 (let ((cur nntp-server-buffer)
6306 (with-current-buffer gnus-summary-buffer
6307 gnus-newsgroup-dependencies)))
6308 headers id end ref number
6309 (mail-parse-charset gnus-newsgroup-charset)
6310 (mail-parse-ignored-charsets
6311 (save-current-buffer (condition-case nil
6312 (set-buffer gnus-summary-buffer)
6314 gnus-newsgroup-ignored-charsets)))
6315 (with-current-buffer nntp-server-buffer
6316 ;; Translate all TAB characters into SPACE characters.
6317 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6318 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6319 (ietf-drums-unfold-fws)
6320 (gnus-run-hooks 'gnus-parse-headers-hook)
6321 (let ((case-fold-search t)
6322 in-reply-to header p lines chars)
6323 (goto-char (point-min))
6324 ;; Search to the beginning of the next header. Error messages
6325 ;; do not begin with 2 or 3.
6326 (while (re-search-forward "^[23][0-9]+ " nil t)
6329 ;; This implementation of this function, with nine
6330 ;; search-forwards instead of the one re-search-forward and
6331 ;; a case (which basically was the old function) is actually
6332 ;; about twice as fast, even though it looks messier. You
6333 ;; can't have everything, I guess. Speed and elegance
6334 ;; doesn't always go hand in hand.
6340 (setq number (read cur))
6343 (narrow-to-region (point)
6344 (or (and (search-forward "\n.\n" nil t)
6350 (if (search-forward "\nsubject:" nil t)
6351 (funcall gnus-decode-encoded-word-function
6352 (nnheader-header-value))
6357 (if (search-forward "\nfrom:" nil t)
6358 (funcall gnus-decode-encoded-address-function
6359 (nnheader-header-value))
6364 (if (search-forward "\ndate:" nil t)
6365 (nnheader-header-value) ""))
6369 (setq id (if (re-search-forward
6370 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6371 ;; We do it this way to make sure the Message-ID
6372 ;; is (somewhat) syntactically valid.
6373 (buffer-substring (match-beginning 1)
6375 ;; If there was no message-id, we just fake one
6376 ;; to make subsequent routines simpler.
6377 (nnheader-generate-fake-message-id number))))
6381 (if (search-forward "\nreferences:" nil t)
6385 (nnheader-header-value)
6390 (search-backward ">" end t)
6393 (search-backward "<" end t)
6395 ;; Get the references from the in-reply-to header if there
6396 ;; were no references and the in-reply-to header looks
6398 (if (and (search-forward "\nin-reply-to:" nil t)
6399 (setq in-reply-to (nnheader-header-value))
6400 (string-match "<[^>]+>" in-reply-to))
6402 (setq ref (substring in-reply-to (match-beginning 0)
6404 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6405 (setq ref2 (substring in-reply-to (match-beginning 0)
6407 (when (> (length ref2) (length ref))
6414 (if (search-forward "\nchars: " nil t)
6415 (if (numberp (setq chars (ignore-errors (read cur))))
6421 (if (search-forward "\nlines: " nil t)
6422 (if (numberp (setq lines (ignore-errors (read cur))))
6428 (and (search-forward "\nxref:" nil t)
6429 (nnheader-header-value)))
6431 (when gnus-extra-headers
6432 (let ((extra gnus-extra-headers)
6436 (when (search-forward
6437 (concat "\n" (symbol-name (car extra)) ":") nil t)
6438 (push (cons (car extra) (nnheader-header-value))
6442 (when (equal id ref)
6445 (when gnus-alter-header-function
6446 (funcall gnus-alter-header-function header)
6447 (setq id (mail-header-id header)
6448 ref (gnus-parent-id (mail-header-references header))))
6451 (gnus-dependencies-add-header
6452 header dependencies force-new))
6453 (push header headers))
6454 (goto-char (point-max))
6456 (nreverse headers)))))
6458 ;; Goes through the xover lines and returns a list of vectors
6459 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6460 force-new dependencies
6461 group also-fetch-heads)
6462 "Parse the news overview data in the server buffer.
6463 Return a list of headers that match SEQUENCE (see
6464 `nntp-retrieve-headers')."
6465 ;; Get the Xref when the users reads the articles since most/some
6466 ;; NNTP servers do not include Xrefs when using XOVER.
6467 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6468 (let ((mail-parse-charset gnus-newsgroup-charset)
6469 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6470 (cur nntp-server-buffer)
6471 (dependencies (or dependencies gnus-newsgroup-dependencies))
6473 ((eq gnus-read-all-available-headers t)
6475 ((and (stringp gnus-read-all-available-headers)
6477 (string-match gnus-read-all-available-headers group))
6480 number headers header)
6481 (with-current-buffer nntp-server-buffer
6482 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6483 ;; Allow the user to mangle the headers before parsing them.
6484 (gnus-run-hooks 'gnus-parse-headers-hook)
6485 (goto-char (point-min))
6486 (gnus-parse-without-error
6487 (while (and (or sequence allp)
6489 (setq number (read cur))
6491 (while (and sequence
6492 (< (car sequence) number))
6493 (setq sequence (cdr sequence))))
6496 (eq number (car sequence))))
6498 (setq sequence (cdr sequence))
6499 (setq header (inline
6500 (gnus-nov-parse-line
6501 number dependencies force-new)))))
6502 (push header headers))
6504 ;; A common bug in inn is that if you have posted an article and
6505 ;; then retrieves the active file, it will answer correctly --
6506 ;; the new article is included. However, a NOV entry for the
6507 ;; article may not have been generated yet, so this may fail.
6508 ;; We work around this problem by retrieving the last few
6509 ;; headers using HEAD.
6510 (if (or (not also-fetch-heads)
6512 ;; We (probably) got all the headers.
6514 (let ((gnus-nov-is-evil t))
6517 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6518 (gnus-get-newsgroup-headers))))))))
6520 (defun gnus-article-get-xrefs ()
6521 "Fill in the Xref value in `gnus-current-headers', if necessary.
6522 This is meant to be called in `gnus-article-internal-prepare-hook'."
6523 (let ((headers (with-current-buffer gnus-summary-buffer
6524 gnus-current-headers)))
6525 (or (not gnus-use-cross-reference)
6527 (and (mail-header-xref headers)
6528 (not (string= (mail-header-xref headers) "")))
6529 (let ((case-fold-search t)
6532 (nnheader-narrow-to-headers)
6533 (goto-char (point-min))
6534 (when (or (and (not (eobp))
6535 (eq (downcase (char-after)) ?x)
6536 (looking-at "Xref:"))
6537 (search-forward "\nXref:" nil t))
6538 (goto-char (1+ (match-end 0)))
6539 (setq xref (buffer-substring (point) (point-at-eol)))
6540 (mail-header-set-xref headers xref)))))))
6542 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6543 "Find article ID and insert the summary line for that article.
6544 OLD-HEADER can either be a header or a line number to insert
6545 the subject line on.
6546 If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a header,
6547 and OLD-HEADER will be used when the summary line is inserted,
6548 too, instead of trying to fetch new headers."
6549 (let* ((line (and (numberp old-header) old-header))
6550 (old-header (and (vectorp old-header) old-header))
6551 (header (cond ((and old-header use-old-header)
6554 (gnus-number-to-header id))
6555 (gnus-number-to-header id))
6557 (gnus-read-header id))))
6558 (number (and (numberp id) id))
6561 ;; Rebuild the thread that this article is part of and go to the
6562 ;; article we have fetched.
6563 (when (and (not gnus-show-threads)
6566 (setq d (gnus-data-find (mail-header-number old-header))))
6567 (goto-char (gnus-data-pos d))
6573 (gnus-delete-line))))))
6574 ;; Remove list identifiers from subject.
6575 (let ((gnus-newsgroup-headers (list header)))
6576 (gnus-summary-remove-list-identifiers))
6578 (mail-header-set-number header (mail-header-number old-header)))
6579 (setq gnus-newsgroup-sparse
6580 (delq (setq number (mail-header-number header))
6581 gnus-newsgroup-sparse))
6582 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6583 (push number gnus-newsgroup-limit)
6584 (gnus-rebuild-thread (mail-header-id header) line)
6585 (gnus-summary-goto-subject number nil t))
6586 (when (and (numberp number)
6588 ;; We have to update the boundaries even if we can't fetch the
6589 ;; article if ID is a number -- so that the next `P' or `N'
6590 ;; command will fetch the previous (or next) article even
6591 ;; if the one we tried to fetch this time has been canceled.
6592 (unless (and gnus-newsgroup-end (< number gnus-newsgroup-end))
6593 (setq gnus-newsgroup-end number))
6594 (unless (and gnus-newsgroup-begin (> number gnus-newsgroup-begin))
6595 (setq gnus-newsgroup-begin number))
6596 (setq gnus-newsgroup-unselected
6597 (delq number gnus-newsgroup-unselected)))
6598 ;; Report back a success?
6599 (and header (mail-header-number header))))
6601 ;;; Process/prefix in the summary buffer
6603 (defun gnus-summary-work-articles (n)
6604 "Return a list of articles to be worked upon.
6605 The prefix argument, the list of process marked articles, and the
6606 current article will be taken into consideration."
6607 (with-current-buffer gnus-summary-buffer
6610 ;; A numerical prefix has been given.
6611 (setq n (prefix-numeric-value n))
6612 (let ((backward (< n 0))
6613 (n (abs (prefix-numeric-value n)))
6618 (push (setq article (gnus-summary-article-number))
6621 (gnus-summary-find-prev nil article)
6622 (gnus-summary-find-next nil article)))
6624 (nreverse articles)))
6625 ((and (gnus-region-active-p) (mark))
6626 (message "region active")
6627 ;; Work on the region between point and mark.
6628 (let ((max (max (point) (mark)))
6631 (goto-char (min (point) (mark)))
6634 (push (setq article (gnus-summary-article-number)) articles)
6635 (gnus-summary-find-next nil article)
6637 (nreverse articles))))
6638 (gnus-newsgroup-processable
6639 ;; There are process-marked articles present.
6640 ;; Save current state.
6641 (gnus-summary-save-process-mark)
6643 (reverse gnus-newsgroup-processable))
6645 ;; Just return the current article.
6646 (list (gnus-summary-article-number))))))
6648 (defmacro gnus-summary-iterate (arg &rest forms)
6649 "Iterate over the process/prefixed articles and do FORMS.
6650 ARG is the interactive prefix given to the command. FORMS will be
6651 executed with point over the summary line of the articles."
6652 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6653 `(let ((,articles (gnus-summary-work-articles ,arg)))
6655 (gnus-summary-goto-subject (car ,articles))
6659 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6660 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6662 (defun gnus-summary-save-process-mark ()
6663 "Push the current set of process marked articles on the stack."
6665 (push (copy-sequence gnus-newsgroup-processable)
6666 gnus-newsgroup-process-stack))
6668 (defun gnus-summary-kill-process-mark ()
6669 "Push the current set of process marked articles on the stack and unmark."
6671 (gnus-summary-save-process-mark)
6672 (gnus-summary-unmark-all-processable))
6674 (defun gnus-summary-yank-process-mark ()
6675 "Pop the last process mark state off the stack and restore it."
6677 (unless gnus-newsgroup-process-stack
6678 (error "Empty mark stack"))
6679 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6681 (defun gnus-summary-process-mark-set (set)
6682 "Make SET into the current process marked articles."
6683 (gnus-summary-unmark-all-processable)
6684 (mapc 'gnus-summary-set-process-mark set))
6686 ;;; Searching and stuff
6688 (defun gnus-summary-search-group (&optional backward use-level)
6689 "Search for next unread newsgroup.
6690 If optional argument BACKWARD is non-nil, search backward instead."
6691 (with-current-buffer gnus-group-buffer
6692 (when (gnus-group-search-forward
6693 backward nil (if use-level (gnus-group-group-level) nil))
6694 (gnus-group-group-name))))
6696 (defun gnus-summary-best-group (&optional exclude-group)
6697 "Find the name of the best unread group.
6698 If EXCLUDE-GROUP, do not go to this group."
6699 (with-current-buffer gnus-group-buffer
6701 (gnus-group-best-unread-group exclude-group))))
6703 (defun gnus-summary-find-next (&optional unread article backward)
6705 (gnus-summary-find-prev unread article)
6706 (let* ((dummy (gnus-summary-article-intangible-p))
6707 (article (or article (gnus-summary-article-number)))
6708 (data (gnus-data-find-list article))
6710 (when (and (not dummy)
6711 (or (not gnus-summary-check-current)
6713 (not (gnus-data-unread-p (car data)))))
6714 (setq data (cdr data)))
6719 (unless (memq (gnus-data-number (car data))
6721 ((eq gnus-auto-goto-ignores
6722 'always-undownloaded)
6723 gnus-newsgroup-undownloaded)
6726 ((eq gnus-auto-goto-ignores
6728 gnus-newsgroup-unfetched)
6729 ((eq gnus-auto-goto-ignores
6731 gnus-newsgroup-undownloaded)))
6732 (when (gnus-data-unread-p (car data))
6733 (setq result (car data)
6735 (setq data (cdr data)))
6738 (goto-char (gnus-data-pos result))
6739 (gnus-data-number result)))))
6741 (defun gnus-summary-find-prev (&optional unread article)
6742 (let* ((eobp (eobp))
6743 (article (or article (gnus-summary-article-number)))
6744 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6746 (when (and (not eobp)
6747 (or (not gnus-summary-check-current)
6749 (not (gnus-data-unread-p (car data)))))
6750 (setq data (cdr data)))
6755 (unless (memq (gnus-data-number (car data))
6757 ((eq gnus-auto-goto-ignores
6758 'always-undownloaded)
6759 gnus-newsgroup-undownloaded)
6762 ((eq gnus-auto-goto-ignores
6764 gnus-newsgroup-unfetched)
6765 ((eq gnus-auto-goto-ignores
6767 gnus-newsgroup-undownloaded)))
6768 (when (gnus-data-unread-p (car data))
6769 (setq result (car data)
6771 (setq data (cdr data)))
6774 (goto-char (gnus-data-pos result))
6775 (gnus-data-number result))))
6777 (defun gnus-summary-find-subject (subject &optional unread backward article)
6778 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6779 (article (or article (gnus-summary-article-number)))
6780 (articles (gnus-data-list backward))
6781 (arts (gnus-data-find-list article articles))
6783 (when (or (not gnus-summary-check-current)
6785 (not (gnus-data-unread-p (car arts))))
6786 (setq arts (cdr arts)))
6788 (and (or (not unread)
6789 (gnus-data-unread-p (car arts)))
6790 (vectorp (gnus-data-header (car arts)))
6792 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6793 (setq result (car arts)
6795 (setq arts (cdr arts)))
6797 (goto-char (gnus-data-pos result))
6798 (gnus-data-number result))))
6800 (defun gnus-summary-search-forward (&optional unread subject backward)
6801 "Search forward for an article.
6802 If UNREAD, look for unread articles. If SUBJECT, look for
6803 articles with that subject. If BACKWARD, search backward instead."
6804 (cond (subject (gnus-summary-find-subject subject unread backward))
6805 (backward (gnus-summary-find-prev unread))
6806 (t (gnus-summary-find-next unread))))
6808 (defun gnus-recenter (&optional n)
6809 "Center point in window and redisplay frame.
6810 Also do horizontal recentering."
6812 (when (and gnus-auto-center-summary
6813 (not (eq gnus-auto-center-summary 'vertical)))
6814 (gnus-horizontal-recenter))
6815 (if (fboundp 'recenter-top-bottom)
6816 (recenter-top-bottom n)
6819 (put 'gnus-recenter 'isearch-scroll t)
6821 (defun gnus-forward-line-ignore-invisible (n)
6822 "Move N lines forward (backward if N is negative).
6823 Like forward-line, but skip over (and don't count) invisible lines."
6825 (while (and (> n 0) (not done))
6826 ;; If the following character is currently invisible,
6827 ;; skip all characters with that same `invisible' property value.
6828 (while (gnus-invisible-p (point))
6829 (goto-char (gnus-next-char-property-change (point))))
6834 (while (and (< n 0) (not done))
6836 (if (bobp) (setq done t)
6838 (while (and (not (bobp)) (gnus-invisible-p (1- (point))))
6839 (goto-char (gnus-previous-char-property-change (point))))))))
6841 (defun gnus-summary-recenter ()
6842 "Center point in the summary window.
6843 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6844 displayed, no centering will be performed."
6845 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6846 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6848 ;; The user has to want it.
6849 (when gnus-auto-center-summary
6850 (let* ((top (cond ((< (window-height) 4) 0)
6851 ((< (window-height) 7) 1)
6852 (t (if (numberp gnus-auto-center-summary)
6853 gnus-auto-center-summary
6854 (/ (1- (window-height)) 2)))))
6855 (height (1- (window-height)))
6856 (bottom (save-excursion
6857 (goto-char (point-max))
6858 (gnus-forward-line-ignore-invisible (- height))
6860 (window (get-buffer-window (current-buffer))))
6861 (when (get-buffer-window gnus-article-buffer)
6862 ;; Only do recentering when the article buffer is displayed,
6863 ;; Set the window start to either `bottom', which is the biggest
6864 ;; possible valid number, or the second line from the top,
6865 ;; whichever is the least.
6866 (let ((top-pos (save-excursion
6867 (gnus-forward-line-ignore-invisible (- top))
6869 (if (> bottom top-pos)
6870 ;; Keep the second line from the top visible
6871 (set-window-start window top-pos)
6872 ;; Try to keep the bottom line visible; if it's partially
6873 ;; obscured, either scroll one more line to make it fully
6874 ;; visible, or revert to using TOP-POS.
6876 (goto-char (point-max))
6877 (gnus-forward-line-ignore-invisible -1)
6878 (let ((last-line-start (point)))
6880 (set-window-start window (point) t)
6881 (when (not (pos-visible-in-window-p last-line-start window))
6882 (gnus-forward-line-ignore-invisible 1)
6883 (set-window-start window (min (point) top-pos) t)))))))
6884 ;; Do horizontal recentering while we're at it.
6885 (when (and (get-buffer-window (current-buffer) t)
6886 (not (eq gnus-auto-center-summary 'vertical)))
6887 (let ((selected (selected-window)))
6888 (select-window (get-buffer-window (current-buffer) t))
6889 (gnus-summary-position-point)
6890 (gnus-horizontal-recenter)
6891 (select-window selected))))))
6893 (defun gnus-summary-jump-to-group (newsgroup)
6894 "Move point to NEWSGROUP in group mode buffer."
6895 ;; Keep update point of group mode buffer if visible.
6896 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6897 (save-window-excursion
6898 ;; Take care of tree window mode.
6899 (when (get-buffer-window gnus-group-buffer)
6900 (pop-to-buffer gnus-group-buffer))
6901 (gnus-group-jump-to-group newsgroup))
6903 ;; Take care of tree window mode.
6904 (if (get-buffer-window gnus-group-buffer 0)
6905 (pop-to-buffer gnus-group-buffer)
6906 (set-buffer gnus-group-buffer))
6907 (gnus-group-jump-to-group newsgroup))))
6909 ;; This function returns a list of article numbers based on the
6910 ;; difference between the ranges of read articles in this group and
6911 ;; the range of active articles.
6912 (defun gnus-list-of-unread-articles (group)
6913 (let* ((read (gnus-info-read (gnus-get-info group)))
6914 (active (or (gnus-active group) (gnus-activate-group group)))
6915 (last (or (cdr active)
6916 (error "Group %s couldn't be activated " group)))
6917 (bottom (if gnus-newsgroup-maximum-articles
6919 (- last gnus-newsgroup-maximum-articles -1))
6922 ;; If none are read, then all are unread.
6925 ;; If the range of read articles is a single range, then the
6926 ;; first unread article is the article after the last read
6927 ;; article. Sounds logical, doesn't it?
6928 (if (and (not (listp (cdr read)))
6929 (or (< (car read) bottom)
6930 (progn (setq read (list read))
6932 (setq first (max bottom (1+ (cdr read))))
6933 ;; `read' is a list of ranges.
6934 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6937 (setq first bottom))
6940 (while (< first nlast)
6941 (setq unread (cons first unread)
6943 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6944 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6945 (setq read (cdr read)))))
6946 ;; And add the last unread articles.
6947 (while (<= first last)
6948 (setq unread (cons first unread)
6950 ;; Return the list of unread articles.
6951 (delq 0 (nreverse unread))))
6953 (defun gnus-list-of-read-articles (group)
6954 "Return a list of unread, unticked and non-dormant articles."
6955 (let* ((info (gnus-get-info group))
6956 (marked (gnus-info-marks info))
6957 (active (gnus-active group)))
6959 (gnus-list-range-difference
6960 (gnus-list-range-difference
6961 (gnus-sorted-complement
6962 (gnus-uncompress-range
6963 (if gnus-newsgroup-maximum-articles
6964 (cons (max (car active)
6966 gnus-newsgroup-maximum-articles
6970 (gnus-list-of-unread-articles group))
6971 (cdr (assq 'dormant marked)))
6972 (cdr (assq 'tick marked))))))
6974 ;; This function returns a sequence of article numbers based on the
6975 ;; difference between the ranges of read articles in this group and
6976 ;; the range of active articles.
6977 (defun gnus-sequence-of-unread-articles (group)
6978 (let* ((read (gnus-info-read (gnus-get-info group)))
6979 (active (or (gnus-active group) (gnus-activate-group group)))
6981 (bottom (if gnus-newsgroup-maximum-articles
6983 (- last gnus-newsgroup-maximum-articles -1))
6986 ;; If none are read, then all are unread.
6989 ;; If the range of read articles is a single range, then the
6990 ;; first unread article is the article after the last read
6991 ;; article. Sounds logical, doesn't it?
6992 (if (and (not (listp (cdr read)))
6993 (or (< (car read) bottom)
6994 (progn (setq read (list read))
6996 (setq first (max bottom (1+ (cdr read))))
6997 ;; `read' is a list of ranges.
6998 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
7001 (setq first bottom))
7004 (push (cons first nlast) unread))
7005 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
7006 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
7007 (setq read (cdr read)))))
7008 ;; And add the last unread articles.
7009 (cond ((not (and first last))
7012 (push (cons first last) unread))
7014 (push first unread)))
7015 ;; Return the sequence of unread articles.
7016 (delq 0 (nreverse unread))))
7018 ;; Various summary commands
7020 (defun gnus-summary-select-article-buffer ()
7021 "Reconfigure windows to show the article buffer.
7022 If `gnus-widen-article-window' is set, show only the article
7025 (if (not (gnus-buffer-live-p gnus-article-buffer))
7026 (error "There is no article buffer for this summary buffer")
7027 (unless (get-buffer-window gnus-article-buffer)
7028 (gnus-summary-show-article))
7029 (gnus-configure-windows
7030 (if gnus-widen-article-window
7034 (select-window (get-buffer-window gnus-article-buffer))))
7036 (defun gnus-summary-universal-argument (arg)
7037 "Perform any operation on all articles that are process/prefixed."
7039 (let ((articles (gnus-summary-work-articles arg))
7046 (substitute-command-keys
7047 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
7049 (gnus-error 1 "Undefined key")
7052 (gnus-summary-goto-subject (setq article (pop articles)))
7053 (let (gnus-newsgroup-processable)
7054 (command-execute func))
7055 (gnus-summary-remove-process-mark article)))))
7056 (gnus-summary-position-point))
7058 (defun gnus-summary-toggle-truncation (&optional arg)
7059 "Toggle truncation of summary lines.
7060 With ARG, turn line truncation on if ARG is positive."
7062 (setq truncate-lines
7063 (if (null arg) (not truncate-lines)
7064 (> (prefix-numeric-value arg) 0)))
7067 (defun gnus-summary-find-for-reselect ()
7068 "Return the number of an article to stay on across a reselect.
7069 The current article is considered, then following articles, then previous
7070 articles. An article is sought which is not canceled and isn't a temporary
7071 insertion from another group. If there's no such then return a dummy 0."
7073 (dolist (rev '(nil t))
7074 (unless found ; don't demand the reverse list if we don't need it
7075 (let ((data (gnus-data-find-list
7076 (gnus-summary-article-number) (gnus-data-list rev))))
7077 (while (and data (not found))
7078 (if (and (< 0 (gnus-data-number (car data)))
7079 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
7080 (setq found (gnus-data-number (car data))))
7081 (setq data (cdr data))))))
7084 (defun gnus-summary-reselect-current-group (&optional all rescan)
7085 "Exit and then reselect the current newsgroup.
7086 The prefix argument ALL means to select all articles."
7088 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
7089 (error "Ephemeral groups can't be reselected"))
7090 (let ((current-subject (gnus-summary-find-for-reselect))
7091 (group gnus-newsgroup-name))
7092 (setq gnus-newsgroup-begin nil)
7093 (gnus-summary-exit nil 'leave-hidden)
7094 ;; We have to adjust the point of group mode buffer because
7095 ;; point was moved to the next unread newsgroup by exiting.
7096 (gnus-summary-jump-to-group group)
7099 (gnus-group-get-new-news-this-group 1)))
7100 (gnus-group-read-group all t)
7101 (gnus-summary-goto-subject current-subject nil t)))
7103 (defun gnus-summary-rescan-group (&optional all)
7104 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7106 (let ((config gnus-current-window-configuration))
7107 (gnus-summary-reselect-current-group all t)
7108 (gnus-configure-windows config)
7109 (when (eq config 'article)
7110 (gnus-summary-select-article))))
7112 (defun gnus-summary-update-info (&optional non-destructive)
7114 (let ((group gnus-newsgroup-name))
7116 (when gnus-newsgroup-kill-headers
7117 (setq gnus-newsgroup-killed
7118 (gnus-compress-sequence
7120 (gnus-list-range-intersection
7121 gnus-newsgroup-unselected gnus-newsgroup-killed)
7122 gnus-newsgroup-unreads)
7124 (unless (listp (cdr gnus-newsgroup-killed))
7125 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7126 (let ((headers gnus-newsgroup-headers)
7127 (ephemeral-p (gnus-ephemeral-group-p group))
7130 (setq info (copy-sequence (gnus-get-info group))
7131 info (delq (gnus-info-params info) info)))
7132 ;; Set the new ranges of read articles.
7133 (with-current-buffer gnus-group-buffer
7134 (gnus-undo-force-boundary))
7135 (gnus-update-read-articles
7136 group (gnus-sorted-union
7137 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7138 ;; Set the current article marks.
7139 (let ((gnus-newsgroup-scored
7140 (if (and (not gnus-save-score)
7141 (not non-destructive))
7143 gnus-newsgroup-scored)))
7145 (gnus-update-marks)))
7146 ;; Do the cross-ref thing.
7147 (when gnus-use-cross-reference
7148 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7149 ;; Do not switch windows but change the buffer to work.
7150 (set-buffer gnus-group-buffer)
7152 (gnus-group-update-group
7155 (setq info (copy-sequence (gnus-get-info group))
7156 info (delq (gnus-info-params info) info))))))))))
7158 (defun gnus-summary-save-newsrc (&optional force)
7159 "Save the current number of read/marked articles in the dribble buffer.
7160 The dribble buffer will then be saved.
7161 If FORCE (the prefix), also save the .newsrc file(s)."
7163 (gnus-summary-update-info t)
7165 (gnus-save-newsrc-file)
7166 (gnus-dribble-save)))
7168 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7170 (defun gnus-summary-exit (&optional temporary leave-hidden)
7171 "Exit reading current newsgroup, and then return to group selection mode.
7172 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7174 (gnus-set-global-variables)
7175 (when (gnus-buffer-live-p gnus-article-buffer)
7176 (with-current-buffer gnus-article-buffer
7177 (mm-destroy-parts gnus-article-mime-handles)
7178 ;; Set it to nil for safety reason.
7179 (setq gnus-article-mime-handle-alist nil)
7180 (setq gnus-article-mime-handles nil)))
7181 (gnus-kill-save-kill-buffer)
7182 (gnus-async-halt-prefetch)
7183 (let* ((group gnus-newsgroup-name)
7184 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7185 (gnus-group-is-exiting-p t)
7186 (article-buffer gnus-article-buffer)
7187 (original-article-buffer gnus-original-article-buffer)
7190 (buf (current-buffer))
7191 ;; `gnus-single-article-buffer' is nil buffer-locally in
7192 ;; ephemeral group of which summary buffer will be killed,
7193 ;; but the global value may be non-nil.
7194 (single-article-buffer gnus-single-article-buffer))
7196 ;; Do adaptive scoring, and possibly save score files.
7197 (when gnus-newsgroup-adaptive
7198 (gnus-score-adaptive))
7199 (when gnus-use-scoring
7201 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7202 (when gnus-use-cache
7203 (gnus-cache-possibly-remove-articles)
7204 (gnus-cache-save-buffers))
7205 (gnus-async-prefetch-remove-group group)
7206 (when gnus-suppress-duplicates
7207 (gnus-dup-enter-articles))
7208 (when gnus-use-trees
7209 (gnus-tree-close group))
7210 (when gnus-use-cache
7211 (gnus-cache-write-active))
7212 ;; Remove entries for this group.
7213 (nnmail-purge-split-history (gnus-group-real-name group))
7214 ;; Make all changes in this group permanent.
7216 (gnus-run-hooks 'gnus-exit-group-hook)
7217 (gnus-summary-update-info))
7218 (gnus-close-group group)
7219 ;; Make sure where we were, and go to next newsgroup.
7220 (when (buffer-live-p (get-buffer gnus-group-buffer))
7221 (set-buffer gnus-group-buffer))
7223 (gnus-group-jump-to-group group))
7224 (gnus-run-hooks 'gnus-summary-exit-hook)
7225 (unless (or quit-config
7226 (not gnus-summary-next-group-on-exit)
7227 ;; If this group has disappeared from the summary
7228 ;; buffer, don't skip forwards.
7229 (not (string= group (gnus-group-group-name))))
7230 (gnus-group-next-unread-group 1))
7231 (setq group-point (point))
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-article-stop-animations "gnus-art" ())
7273 (declare-function gnus-stop-downloads "gnus-art" ())
7275 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7276 (defun gnus-summary-exit-no-update (&optional no-questions)
7277 "Quit reading current newsgroup without updating read article info."
7279 (let* ((group gnus-newsgroup-name)
7280 (gnus-group-is-exiting-p t)
7281 (gnus-group-is-exiting-without-update-p t)
7282 (quit-config (gnus-group-quit-config group)))
7283 (when (or no-questions
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
7312 (gnus-tree-close group))
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))
7323 (gnus-handle-ephemeral-exit quit-config)))))
7325 (defun gnus-handle-ephemeral-exit (quit-config)
7326 "Handle movement when leaving an ephemeral group.
7327 The state which existed when entering the ephemeral is reset."
7328 (if (not (buffer-live-p (car quit-config)))
7329 (when (gnus-buffer-live-p gnus-group-buffer)
7330 (gnus-configure-windows 'group 'force))
7331 (set-buffer (car quit-config))
7332 (unless (eq (cdr quit-config) 'group)
7333 (setq gnus-current-select-method
7334 (gnus-find-method-for-group gnus-newsgroup-name)))
7335 (cond ((eq major-mode 'gnus-summary-mode)
7336 (gnus-set-global-variables))
7337 ((eq major-mode 'gnus-article-mode)
7338 (save-current-buffer
7339 ;; The `gnus-summary-buffer' variable may point
7340 ;; to the old summary buffer when using a single
7342 (unless (gnus-buffer-live-p gnus-summary-buffer)
7343 (set-buffer gnus-group-buffer))
7344 (set-buffer gnus-summary-buffer)
7345 (gnus-set-global-variables))))
7346 (if (or (eq (cdr quit-config) 'article)
7347 (eq (cdr quit-config) 'pick))
7348 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7349 (gnus-configure-windows 'pick 'force)
7350 (gnus-configure-windows (cdr quit-config) 'force))
7351 (gnus-configure-windows (cdr quit-config) 'force))
7352 (when (eq major-mode 'gnus-summary-mode)
7353 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7354 next-unread-noselect))
7355 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7357 (gnus-summary-next-subject 1 nil t))
7358 ((eq gnus-auto-select-on-ephemeral-exit
7359 'next-unread-noselect)
7360 (gnus-summary-next-subject 1 t t))))
7361 ;; Hide the article buffer which displays the article different
7362 ;; from the one that the cursor points to in the summary buffer.
7363 (gnus-configure-windows 'summary 'force))
7364 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7365 (gnus-summary-next-subject 1))
7366 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7367 (gnus-summary-next-subject 1 t))))
7368 (gnus-summary-recenter)
7369 (gnus-summary-position-point))))
7373 (defvar gnus-dead-summary-mode-map
7374 (let ((map (make-keymap)))
7375 (suppress-keymap map)
7376 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7377 (dolist (key '("\C-d" "\r" "\177" [delete]))
7378 (define-key map key 'gnus-summary-wake-up-the-dead))
7379 (dolist (key '("q" "Q"))
7380 (define-key map key 'bury-buffer))
7383 (define-minor-mode gnus-dead-summary-mode
7384 "Minor mode for Gnus summary buffers."
7385 :lighter " Dead" :keymap gnus-dead-summary-mode-map
7386 (unless (derived-mode-p 'gnus-summary-mode)
7387 (setq gnus-dead-summary-mode nil)))
7389 (defun gnus-deaden-summary ()
7390 "Make the current summary buffer into a dead summary buffer."
7391 ;; Kill any previous dead summary buffer.
7392 (when (and gnus-dead-summary
7393 (buffer-name gnus-dead-summary))
7394 (with-current-buffer gnus-dead-summary
7395 (when gnus-dead-summary-mode
7396 (kill-buffer (current-buffer)))))
7397 ;; Make this the current dead summary.
7398 (setq gnus-dead-summary (current-buffer))
7399 (gnus-dead-summary-mode 1)
7400 (let ((name (buffer-name)))
7401 (when (string-match "Summary" name)
7403 (concat (substring name 0 (match-beginning 0)) "Dead "
7404 (substring name (match-beginning 0)))
7408 (defun gnus-kill-or-deaden-summary (buffer)
7409 "Kill or deaden the summary BUFFER."
7411 (when (and (buffer-name buffer)
7412 (not gnus-single-article-buffer))
7413 (with-current-buffer buffer
7414 (gnus-kill-buffer gnus-article-buffer)
7415 (gnus-kill-buffer gnus-original-article-buffer)))
7418 (gnus-kill-summary-on-exit
7419 (when (and gnus-use-trees
7420 (gnus-buffer-exists-p buffer))
7421 (with-current-buffer buffer
7422 (gnus-tree-close gnus-newsgroup-name)))
7423 (gnus-kill-buffer buffer))
7424 ;; Deaden the buffer.
7425 ((gnus-buffer-exists-p buffer)
7426 (with-current-buffer buffer
7427 (gnus-deaden-summary))))))
7429 (defun gnus-summary-wake-up-the-dead (&rest args)
7430 "Wake up the dead summary buffer."
7432 (gnus-dead-summary-mode -1)
7433 (let ((name (buffer-name)))
7434 (when (string-match "Dead " name)
7436 (concat (substring name 0 (match-beginning 0))
7437 (substring name (match-end 0)))
7439 (gnus-message 3 "This dead summary is now alive again"))
7441 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7442 (defun gnus-summary-describe-group (&optional force)
7443 "Describe the current newsgroup."
7445 (gnus-group-describe-group force gnus-newsgroup-name))
7447 (defun gnus-summary-describe-briefly ()
7448 "Describe summary mode commands briefly."
7450 (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")))
7452 ;; Walking around group mode buffer from summary mode.
7454 (defun gnus-summary-next-group (&optional no-article target-group backward)
7455 "Exit current newsgroup and then select next unread newsgroup.
7456 If prefix argument NO-ARTICLE is non-nil, no article is selected
7457 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7458 previous group instead."
7460 ;; Stop pre-fetching.
7461 (gnus-async-halt-prefetch)
7462 (let ((current-group gnus-newsgroup-name)
7463 (current-buffer (current-buffer))
7465 ;; First we semi-exit this group to update Xrefs and all variables.
7466 ;; We can't do a real exit, because the window conf must remain
7467 ;; the same in case the user is prompted for info, and we don't
7468 ;; want the window conf to change before that...
7469 (gnus-summary-exit t)
7470 (while (not entered)
7471 ;; Then we find what group we are supposed to enter.
7472 (set-buffer gnus-group-buffer)
7473 (gnus-group-jump-to-group current-group)
7476 (if (eq gnus-keep-same-level 'best)
7477 (gnus-summary-best-group gnus-newsgroup-name)
7478 (gnus-summary-search-group backward gnus-keep-same-level))))
7479 (if (not target-group)
7480 ;; There are no further groups, so we return to the group
7483 (gnus-message 5 "Returning to the group buffer")
7485 (when (gnus-buffer-live-p current-buffer)
7486 (set-buffer current-buffer)
7487 (gnus-summary-exit))
7488 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7489 ;; We try to enter the target group.
7490 (gnus-group-jump-to-group target-group)
7491 (let ((unreads (gnus-group-group-unread)))
7492 (if (and (or (eq t unreads)
7493 (and unreads (not (zerop unreads))))
7494 (gnus-summary-read-group
7495 target-group nil no-article
7496 (and (buffer-name current-buffer) current-buffer)
7499 (setq current-group target-group
7500 target-group nil)))))))
7502 (defun gnus-summary-prev-group (&optional no-article)
7503 "Exit current newsgroup and then select previous unread newsgroup.
7504 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7506 (gnus-summary-next-group no-article nil t))
7508 ;; Walking around summary lines.
7510 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7511 "Go to the first subject satisfying any non-nil constraint.
7512 If UNREAD is non-nil, the article should be unread.
7513 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7514 If UNSEEN is non-nil, the article should be unseen as well as unread.
7515 Returns the article selected or nil if there are no matching articles."
7519 ((null gnus-newsgroup-data)
7520 (gnus-message 3 "No articles in the group")
7522 ;; Pick the first article.
7523 ((not (or unread undownloaded unseen))
7524 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7525 (gnus-data-number (car gnus-newsgroup-data)))
7526 ;; Find the first unread article.
7528 (let ((data gnus-newsgroup-data))
7530 (let ((num (gnus-data-number (car data))))
7531 (or (memq num gnus-newsgroup-unfetched)
7532 (not (or (and unread
7533 (memq num gnus-newsgroup-unreads))
7535 (memq num gnus-newsgroup-undownloaded))
7537 (memq num gnus-newsgroup-unseen)
7538 (memq num gnus-newsgroup-unreads)))))))
7539 (setq data (cdr data)))
7543 (goto-char (gnus-data-pos (car data)))
7544 (gnus-data-number (car data)))
7545 (gnus-message 3 "No more%s articles"
7546 (let* ((r (when unread " unread"))
7547 (d (when undownloaded " undownloaded"))
7548 (s (when unseen " unseen"))
7549 (l (delq nil (list r d s))))
7550 (cond ((= 3 (length l))
7551 (concat r "," d ", or" s))
7553 (concat (car l) ", or" (cadr l)))
7560 (gnus-summary-position-point))))))
7562 (defun gnus-summary-next-subject (n &optional unread dont-display)
7563 "Go to next N'th summary line.
7564 If N is negative, go to the previous N'th subject line.
7565 If UNREAD is non-nil, only unread articles are selected.
7566 The difference between N and the actual number of steps taken is
7569 (let ((backward (< n 0))
7573 (gnus-summary-find-prev unread)
7574 (gnus-summary-find-next unread)))
7575 (unless (zerop (setq n (1- n)))
7576 (gnus-summary-show-thread)))
7578 (gnus-message 7 "No more%s articles"
7579 (if unread " unread" "")))
7580 (unless dont-display
7581 (gnus-summary-recenter)
7582 (gnus-summary-position-point))
7585 (defun gnus-summary-next-unread-subject (n)
7586 "Go to next N'th unread summary line."
7588 (gnus-summary-next-subject n t))
7590 (defun gnus-summary-prev-subject (n &optional unread)
7591 "Go to previous N'th summary line.
7592 If optional argument UNREAD is non-nil, only unread article is selected."
7594 (gnus-summary-next-subject (- n) unread))
7596 (defun gnus-summary-prev-unread-subject (n)
7597 "Go to previous N'th unread summary line."
7599 (gnus-summary-next-subject (- n) t))
7601 (defun gnus-summary-goto-subjects (articles)
7602 "Insert the subject header for ARTICLES in the current buffer."
7604 (dolist (article articles)
7605 (gnus-summary-goto-subject article t)))
7606 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7607 (gnus-summary-position-point))
7609 (defun gnus-summary-goto-subject (article &optional force silent)
7610 "Go to the subject line of ARTICLE.
7611 If FORCE, also allow jumping to articles not currently shown."
7612 (interactive "nArticle number: ")
7613 (unless (numberp article)
7614 (error "Article %s is not a number" article))
7616 (data (gnus-data-find article)))
7617 ;; We read in the article if we have to.
7620 (gnus-summary-insert-subject
7622 (if (or (numberp force) (vectorp force)) force)
7624 (setq data (gnus-data-find article)))
7629 (gnus-message 3 "Can't find article %d" article))
7631 (let ((pt (gnus-data-pos data)))
7633 (gnus-summary-set-article-display-arrow pt))
7634 (gnus-summary-position-point)
7637 ;; Walking around summary lines with displaying articles.
7639 (defun gnus-summary-expand-window (&optional arg)
7640 "Make the summary buffer take up the entire Emacs frame.
7641 Given a prefix, will force an `article' buffer configuration."
7644 (gnus-configure-windows 'article 'force)
7645 (gnus-configure-windows 'summary 'force)))
7647 (defun gnus-summary-display-article (article &optional all-header)
7648 "Display ARTICLE in article buffer."
7649 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7650 (with-current-buffer gnus-article-buffer
7651 (eq major-mode 'gnus-article-mode)))
7652 (gnus-article-setup-buffer))
7653 (gnus-set-global-variables)
7654 (with-current-buffer gnus-article-buffer
7655 (setq gnus-article-charset gnus-newsgroup-charset)
7656 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7657 (mm-enable-multibyte))
7661 (if gnus-summary-display-article-function
7662 (funcall gnus-summary-display-article-function article all-header)
7663 (gnus-article-prepare article all-header))
7664 (gnus-run-hooks 'gnus-select-article-hook)
7665 (when (and gnus-current-article
7666 (not (zerop gnus-current-article)))
7667 (gnus-summary-goto-subject gnus-current-article))
7668 (gnus-summary-recenter)
7669 (when (and gnus-use-trees gnus-show-threads)
7670 (gnus-possibly-generate-tree article)
7671 (gnus-highlight-selected-tree article))
7672 ;; Successfully display article.
7673 (gnus-article-set-window-start
7674 (cdr (assq article gnus-newsgroup-bookmarks))))))
7676 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7677 "Select the current article.
7678 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7679 non-nil, the article will be re-fetched even if it already present in
7680 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7682 ;; Make sure we are in the summary buffer to work around bbdb bug.
7683 (unless (eq major-mode 'gnus-summary-mode)
7684 (set-buffer gnus-summary-buffer))
7685 (let ((article (or article (gnus-summary-article-number)))
7686 (all-headers (not (not all-headers))) ;Must be t or nil.
7687 gnus-summary-display-article-function)
7689 (gnus-summary-article-pseudo-p article)
7690 (error "This is a pseudo-article"))
7691 (with-current-buffer gnus-summary-buffer
7692 (if (or (and gnus-single-article-buffer
7693 (or (null gnus-current-article)
7694 (null gnus-article-current)
7695 (null (get-buffer gnus-article-buffer))
7696 (not (eq article (cdr gnus-article-current)))
7697 (not (equal (car gnus-article-current)
7698 gnus-newsgroup-name))
7699 (not (get-buffer gnus-original-article-buffer))))
7700 (and (not gnus-single-article-buffer)
7701 (or (null gnus-current-article)
7702 (not (get-buffer gnus-original-article-buffer))
7703 (not (eq gnus-current-article article))))
7705 ;; The requested article is different from the current article.
7707 (gnus-summary-display-article article all-headers)
7708 (when (gnus-buffer-live-p gnus-article-buffer)
7709 (with-current-buffer gnus-article-buffer
7710 (if (not gnus-article-decoded-p) ;; a local variable
7711 (mm-disable-multibyte))))
7712 (gnus-article-set-window-start
7713 (cdr (assq article gnus-newsgroup-bookmarks)))
7717 (defun gnus-summary-force-verify-and-decrypt ()
7718 "Display buttons for signed/encrypted parts and verify/decrypt them."
7720 (let ((mm-verify-option 'known)
7721 (mm-decrypt-option 'known)
7722 (gnus-article-emulate-mime t)
7723 (gnus-buttonized-mime-types (append (list "multipart/signed"
7724 "multipart/encrypted")
7725 gnus-buttonized-mime-types)))
7726 (gnus-summary-select-article nil 'force)))
7728 (defun gnus-summary-next-article (&optional unread subject backward push)
7729 "Select the next article.
7730 If UNREAD, only unread articles are selected.
7731 If SUBJECT, only articles with SUBJECT are selected.
7732 If BACKWARD, the previous article is selected instead of the next."
7734 ;; Make sure we are in the summary buffer.
7735 (unless (eq major-mode 'gnus-summary-mode)
7736 (set-buffer gnus-summary-buffer))
7738 ;; Is there such an article?
7739 ((and (gnus-summary-search-forward unread subject backward)
7740 (or (gnus-summary-display-article (gnus-summary-article-number))
7741 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7742 (gnus-summary-position-point))
7743 ;; If not, we try the first unread, if that is wanted.
7745 gnus-auto-select-same
7746 (gnus-summary-first-unread-article))
7747 (gnus-summary-position-point)
7748 (gnus-message 6 "Wrapped"))
7749 ;; Try to get next/previous article not displayed in this group.
7750 ((and gnus-auto-extend-newsgroup
7751 (not unread) (not subject))
7752 (gnus-summary-goto-article
7753 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7754 nil (count-lines (point-min) (point))))
7755 ;; Go to next/previous group.
7757 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7758 (gnus-summary-jump-to-group gnus-newsgroup-name))
7759 (let ((cmd (if (featurep 'xemacs)
7761 last-command-event))
7763 (with-current-buffer gnus-group-buffer
7765 (current-summary (current-buffer))
7767 (if (eq gnus-keep-same-level 'best)
7768 (gnus-summary-best-group gnus-newsgroup-name)
7769 (gnus-summary-search-group backward gnus-keep-same-level))))
7770 ;; Select next unread newsgroup automagically.
7772 ((or (not gnus-auto-select-next)
7774 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7775 ((or (eq gnus-auto-select-next 'quietly)
7776 (and (eq gnus-auto-select-next 'slightly-quietly)
7778 (and (eq gnus-auto-select-next 'almost-quietly)
7779 (gnus-summary-last-article-p)))
7781 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7783 (gnus-message 7 "No more%s articles (%s)..."
7784 (if unread " unread" "")
7785 (if group (concat "selecting " group)
7787 (gnus-summary-next-group nil group backward)))
7789 (when (gnus-key-press-event-p last-input-event)
7790 ;; Somehow or other, we may now have selected a different
7791 ;; window. Make point go back to the summary buffer.
7792 (when (eq current-summary (current-buffer))
7793 ;; FIXME: This burps when get-buffer-window returns nil.
7794 (select-window (get-buffer-window current-summary 0)))
7795 (gnus-summary-walk-group-buffer
7796 gnus-newsgroup-name cmd unread backward point))))))))
7798 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7799 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7800 (?\C-p (gnus-group-prev-unread-group 1))))
7801 (cursor-in-echo-area t)
7802 keve key group ended prompt)
7803 (with-current-buffer gnus-group-buffer
7806 (if (eq gnus-keep-same-level 'best)
7807 (gnus-summary-best-group gnus-newsgroup-name)
7808 (gnus-summary-search-group backward gnus-keep-same-level))))
7812 "No more%s articles%s " (if unread " unread" "")
7814 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7815 (format " (Type %s for %s [%s])"
7816 (single-key-description cmd)
7817 (gnus-group-decoded-name group)
7818 (gnus-group-unread group))
7819 (format " (Type %s to exit %s)"
7820 (single-key-description cmd)
7821 (gnus-group-decoded-name gnus-newsgroup-name)))))
7822 ;; Confirm auto selection.
7823 (setq key (car (setq keve (gnus-read-event-char prompt)))
7826 ((assq key keystrokes)
7827 (let ((obuf (current-buffer)))
7828 (switch-to-buffer gnus-group-buffer)
7830 (gnus-group-jump-to-group group))
7831 (eval (cadr (assq key keystrokes)))
7832 (setq group (gnus-group-group-name))
7833 (switch-to-buffer obuf))
7837 (gnus-ephemeral-group-p gnus-newsgroup-name))
7839 (gnus-summary-next-group nil group backward)))
7841 (push (cdr keve) unread-command-events))))))
7843 (defun gnus-summary-next-unread-article ()
7844 "Select unread article after current one."
7846 (gnus-summary-next-article
7847 (or (not (eq gnus-summary-goto-unread 'never))
7848 (gnus-summary-last-article-p (gnus-summary-article-number)))
7849 (and gnus-auto-select-same
7850 (gnus-summary-article-subject))))
7852 (defun gnus-summary-prev-article (&optional unread subject)
7853 "Select the article before the current one.
7854 If UNREAD is non-nil, only unread articles are selected."
7856 (gnus-summary-next-article unread subject t))
7858 (defun gnus-summary-prev-unread-article ()
7859 "Select unread article before current one."
7861 (gnus-summary-prev-article
7862 (or (not (eq gnus-summary-goto-unread 'never))
7863 (gnus-summary-first-article-p (gnus-summary-article-number)))
7864 (and gnus-auto-select-same
7865 (gnus-summary-article-subject))))
7867 (declare-function gnus-article-only-boring-p "gnus-art" ())
7869 (defun gnus-summary-next-page (&optional lines circular stop)
7870 "Show next page of the selected article.
7871 If at the end of the current article, select the next article.
7872 LINES says how many lines should be scrolled up.
7874 If CIRCULAR is non-nil, go to the start of the article instead of
7875 selecting the next article when reaching the end of the current
7878 If STOP is non-nil, just stop when reaching the end of the message.
7880 Also see the variable `gnus-article-skip-boring'."
7882 (gnus-set-global-variables)
7883 (let ((article (gnus-summary-article-number))
7884 (article-window (get-buffer-window gnus-article-buffer t))
7886 ;; If the buffer is empty, we have no article.
7888 (error "No article to select"))
7889 (gnus-configure-windows 'article)
7890 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7891 (if (and (eq gnus-summary-goto-unread 'never)
7892 (not (gnus-summary-last-article-p article)))
7893 (gnus-summary-next-article)
7894 (gnus-summary-next-unread-article))
7895 (if (or (null gnus-current-article)
7896 (null gnus-article-current)
7897 (/= article (cdr gnus-article-current))
7898 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7899 ;; Selected subject is different from current article's.
7900 (gnus-summary-display-article article)
7901 (when article-window
7902 (gnus-eval-in-buffer-window gnus-article-buffer
7903 (setq endp (or (gnus-article-next-page lines)
7904 (gnus-article-only-boring-p))))
7906 (cond ((or stop gnus-summary-stop-at-end-of-message)
7907 (gnus-message 3 "End of message"))
7909 (gnus-summary-beginning-of-article))
7911 (gnus-message 3 "End of message"))
7913 (if (and (eq gnus-summary-goto-unread 'never)
7914 (not (gnus-summary-last-article-p article)))
7915 (gnus-summary-next-article)
7916 (gnus-summary-next-unread-article))))))))
7917 (gnus-summary-recenter)
7918 (gnus-summary-position-point)))
7920 (defun gnus-summary-prev-page (&optional lines move)
7921 "Show previous page of selected article.
7922 Argument LINES specifies lines to be scrolled down.
7923 If MOVE, move to the previous unread article if point is at
7924 the beginning of the buffer."
7926 (let ((article (gnus-summary-article-number))
7927 (article-window (get-buffer-window gnus-article-buffer t))
7929 (gnus-configure-windows 'article)
7930 (if (or (null gnus-current-article)
7931 (null gnus-article-current)
7932 (/= article (cdr gnus-article-current))
7933 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7934 ;; Selected subject is different from current article's.
7935 (gnus-summary-display-article article)
7936 (gnus-summary-recenter)
7937 (when article-window
7938 (gnus-eval-in-buffer-window gnus-article-buffer
7939 (setq endp (gnus-article-prev-page lines)))
7940 (when (and move endp)
7942 (gnus-message 3 "Beginning of message"))
7944 (if (and (eq gnus-summary-goto-unread 'never)
7945 (not (gnus-summary-first-article-p article)))
7946 (gnus-summary-prev-article)
7947 (gnus-summary-prev-unread-article))))))))
7948 (gnus-summary-position-point))
7950 (defun gnus-summary-prev-page-or-article (&optional lines)
7951 "Show previous page of selected article.
7952 Argument LINES specifies lines to be scrolled down.
7953 If at the beginning of the article, go to the next article."
7955 (gnus-summary-prev-page lines t))
7957 (defun gnus-summary-scroll-up (lines)
7958 "Scroll up (or down) one line current article.
7959 Argument LINES specifies lines to be scrolled up (or down if negative).
7960 If no article is selected, then the current article will be selected first."
7962 (gnus-configure-windows 'article)
7963 (gnus-summary-show-thread)
7964 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7965 (gnus-eval-in-buffer-window gnus-article-buffer
7967 (when (gnus-article-next-page lines)
7968 (gnus-message 3 "End of message")))
7970 (gnus-article-prev-page (- lines))))))
7971 (gnus-summary-recenter)
7972 (gnus-summary-position-point))
7974 (defun gnus-summary-scroll-down (lines)
7975 "Scroll down (or up) one line current article.
7976 Argument LINES specifies lines to be scrolled down (or up if negative).
7977 If no article is selected, then the current article will be selected first."
7979 (gnus-summary-scroll-up (- lines)))
7981 (defun gnus-summary-next-same-subject ()
7982 "Select next article which has the same subject as current one."
7984 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7986 (defun gnus-summary-prev-same-subject ()
7987 "Select previous article which has the same subject as current one."
7989 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7991 (defun gnus-summary-next-unread-same-subject ()
7992 "Select next unread article which has the same subject as current one."
7994 (gnus-summary-next-article t (gnus-summary-article-subject)))
7996 (defun gnus-summary-prev-unread-same-subject ()
7997 "Select previous unread article which has the same subject as current one."
7999 (gnus-summary-prev-article t (gnus-summary-article-subject)))
8001 (defun gnus-summary-first-unread-article ()
8002 "Select the first unread article.
8003 Return nil if there are no unread articles."
8006 (when (gnus-summary-first-subject t)
8007 (gnus-summary-show-thread)
8008 (gnus-summary-first-subject t)
8009 (gnus-summary-display-article (gnus-summary-article-number)))
8010 (gnus-summary-position-point)))
8012 (defun gnus-summary-first-unread-subject ()
8013 "Place the point on the subject line of the first unread article.
8014 Return nil if there are no unread articles."
8017 (when (gnus-summary-first-subject t)
8018 (gnus-summary-show-thread)
8019 (gnus-summary-first-subject t))
8020 (gnus-summary-position-point)))
8022 (defun gnus-summary-first-unseen-subject ()
8023 "Place the point on the subject line of the first unseen article.
8024 Return nil if there are no unseen articles."
8027 (when (gnus-summary-first-subject nil nil t)
8028 (gnus-summary-show-thread)
8029 (gnus-summary-first-subject nil nil t))
8030 (gnus-summary-position-point)))
8032 (defun gnus-summary-first-unseen-or-unread-subject ()
8033 "Place the point on the subject line of the first unseen and unread article.
8034 If all article have been seen, on the subject line of the first unread
8038 (unless (when (gnus-summary-first-subject nil nil t)
8039 (gnus-summary-show-thread)
8040 (gnus-summary-first-subject nil nil t))
8041 (when (gnus-summary-first-subject t)
8042 (gnus-summary-show-thread)
8043 (gnus-summary-first-subject t)))
8044 (gnus-summary-position-point)))
8046 (defun gnus-summary-first-article ()
8047 "Select the first article.
8048 Return nil if there are no articles."
8051 (when (gnus-summary-first-subject)
8052 (gnus-summary-show-thread)
8053 (gnus-summary-first-subject)
8054 (gnus-summary-display-article (gnus-summary-article-number)))
8055 (gnus-summary-position-point)))
8057 (defun gnus-summary-best-unread-article (&optional arg)
8058 "Select the unread article with the highest score.
8059 If given a prefix argument, select the next unread article that has a
8060 score higher than the default score."
8062 (let ((article (if arg
8063 (gnus-summary-better-unread-subject)
8064 (gnus-summary-best-unread-subject))))
8066 (gnus-summary-goto-article article)
8067 (error "No unread articles"))))
8069 (defun gnus-summary-best-unread-subject ()
8070 "Select the unread subject with the highest score."
8072 (let ((best -1000000)
8073 (data gnus-newsgroup-data)
8076 (and (gnus-data-unread-p (car data))
8078 (gnus-summary-article-score (gnus-data-number (car data))))
8081 article (gnus-data-number (car data))))
8082 (setq data (cdr data)))
8084 (gnus-summary-goto-subject article))
8085 (gnus-summary-position-point)
8088 (defun gnus-summary-better-unread-subject ()
8089 "Select the first unread subject that has a score over the default score."
8091 (let ((data gnus-newsgroup-data)
8093 (while (and (setq article (gnus-data-number (car data)))
8094 (or (gnus-data-read-p (car data))
8095 (not (> (gnus-summary-article-score article)
8096 gnus-summary-default-score))))
8097 (setq data (cdr data)))
8099 (gnus-summary-goto-subject article))
8100 (gnus-summary-position-point)
8103 (defun gnus-summary-last-subject ()
8104 "Go to the last displayed subject line in the group."
8105 (let ((article (gnus-data-number (car (gnus-data-list t)))))
8107 (gnus-summary-goto-subject article))))
8109 (defun gnus-summary-goto-article (article &optional all-headers force)
8110 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
8111 If ALL-HEADERS is non-nil, no header lines are hidden.
8112 If FORCE, go to the article even if it isn't displayed. If FORCE
8113 is a number, it is the line the article is to be displayed on."
8116 (gnus-completing-read
8117 "Article number or Message-ID"
8118 (mapcar 'int-to-string gnus-newsgroup-limit))
8122 (if (and (stringp article)
8123 (string-match "@\\|%40" article))
8124 (gnus-summary-refer-article article)
8125 (when (stringp article)
8126 (setq article (string-to-number article)))
8127 (if (gnus-summary-goto-subject article force)
8128 (gnus-summary-display-article article all-headers)
8129 (gnus-message 4 "Couldn't go to article %s" article) nil))
8130 (gnus-summary-position-point)))
8132 (defun gnus-summary-goto-last-article ()
8133 "Go to the previously read article."
8136 (when gnus-last-article
8137 (gnus-summary-goto-article gnus-last-article nil t))
8138 (gnus-summary-position-point)))
8140 (defun gnus-summary-pop-article (number)
8141 "Pop one article off the history and go to the previous.
8142 NUMBER articles will be popped off."
8145 (setq gnus-newsgroup-history
8146 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
8148 (gnus-summary-goto-article (car to) nil t)
8149 (error "Article history empty")))
8150 (gnus-summary-position-point))
8152 ;; Summary commands and functions for limiting the summary buffer.
8154 (defun gnus-summary-limit-to-articles (n)
8155 "Limit the summary buffer to the next N articles.
8156 If not given a prefix, use the process marked articles instead."
8159 (let ((articles (gnus-summary-work-articles n)))
8160 (setq gnus-newsgroup-processable nil)
8161 (gnus-summary-limit articles))
8162 (gnus-summary-position-point)))
8164 (defun gnus-summary-pop-limit (&optional total)
8165 "Restore the previous limit.
8166 If given a prefix, remove all limits."
8169 (setq gnus-newsgroup-limits
8170 (list (mapcar (lambda (h) (mail-header-number h))
8171 gnus-newsgroup-headers))))
8172 (unless gnus-newsgroup-limits
8173 (error "No limit to pop"))
8175 (gnus-summary-limit nil 'pop)
8176 (gnus-summary-position-point)))
8178 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
8179 "Limit the summary buffer to articles that have subjects that match a regexp.
8180 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8182 (list (read-string (if current-prefix-arg
8183 "Exclude subject (regexp): "
8184 "Limit to subject (regexp): "))
8185 nil current-prefix-arg))
8187 (setq header "subject"))
8188 (when (not (equal "" subject))
8190 (let ((articles (gnus-summary-find-matching
8191 (or header "subject") subject 'all nil nil
8194 (error "Found no matches for \"%s\"" subject))
8195 (gnus-summary-limit articles))
8196 (gnus-summary-position-point))))
8198 (defun gnus-summary-limit-to-author (from &optional not-matching)
8199 "Limit the summary buffer to articles that have authors that match a regexp.
8200 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8202 (list (let* ((header (gnus-summary-article-header))
8203 (default (and header (car (mail-header-parse-address
8204 (mail-header-from header))))))
8205 (read-string (concat (if current-prefix-arg
8206 "Exclude author (regexp"
8207 "Limit to author (regexp")
8209 (concat ", default \"" default "\"): ")
8213 current-prefix-arg))
8214 (gnus-summary-limit-to-subject from "from" not-matching))
8216 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
8217 "Limit the summary buffer to articles with the given RECIPIENT.
8219 If NOT-MATCHING, exclude RECIPIENT.
8221 To and Cc headers are checked. You need to include them in
8222 `nnmail-extra-headers'."
8223 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8225 (list (read-string (format "%s recipient (regexp): "
8226 (if current-prefix-arg "Exclude" "Limit to")))
8227 current-prefix-arg))
8228 (when (not (equal "" recipient))
8230 (if (memq 'To nnmail-extra-headers)
8231 (gnus-summary-find-matching
8232 (cons 'extra 'To) recipient 'all nil nil
8235 1 "`To' isn't present in `nnmail-extra-headers'")
8239 (if (memq 'Cc nnmail-extra-headers)
8240 (gnus-summary-find-matching
8241 (cons 'extra 'Cc) recipient 'all nil nil
8244 1 "`Cc' isn't present in `nnmail-extra-headers'")
8249 ;; We need the numbers that are in both lists:
8251 (and (memq a to) a))
8255 (error "Found no matches for \"%s\"" recipient))
8256 (gnus-summary-limit articles))
8257 (gnus-summary-position-point))))
8259 (defun gnus-summary-limit-to-address (address &optional not-matching)
8260 "Limit the summary buffer to articles with the given ADDRESS.
8262 If NOT-MATCHING, exclude ADDRESS.
8264 To, Cc and From headers are checked. You need to include `To' and `Cc'
8265 in `nnmail-extra-headers'."
8267 (list (read-string (format "%s address (regexp): "
8268 (if current-prefix-arg "Exclude" "Limit to")))
8269 current-prefix-arg))
8270 (when (not (equal "" address))
8272 (if (memq 'To nnmail-extra-headers)
8273 (gnus-summary-find-matching
8274 (cons 'extra 'To) address 'all nil nil
8277 1 "`To' isn't present in `nnmail-extra-headers'")
8281 (if (memq 'Cc nnmail-extra-headers)
8282 (gnus-summary-find-matching
8283 (cons 'extra 'Cc) address 'all nil nil
8286 1 "`Cc' isn't present in `nnmail-extra-headers'")
8290 (gnus-summary-find-matching "from" address
8291 'all nil nil not-matching))
8294 ;; We need the numbers that are in all lists:
8298 (mapcar (lambda (a) (car (memq a from))) to))
8300 (mapcar (lambda (a) (car (memq a from))) cc)
8301 (mapcar (lambda (a) (car (memq a from)))
8302 (mapcar (lambda (a) (car (memq a to)))
8304 (nconc (if (eq to t) nil to)
8305 (if (eq cc t) nil cc)
8308 (error "Found no matches for \"%s\"" address))
8309 (gnus-summary-limit articles))
8310 (gnus-summary-position-point))))
8312 (defun gnus-summary-limit-strange-charsets-predicate (header)
8313 (when (fboundp 'char-charset)
8314 (let ((string (concat (mail-header-subject header)
8315 (mail-header-from header)))
8317 (dotimes (i (1- (length string)))
8318 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8319 (when (string-match "unicode\\|big\\|japanese" charset)
8323 (defun gnus-summary-limit-to-predicate (predicate)
8324 "Limit to articles where PREDICATE returns non-nil.
8325 PREDICATE will be called with the header structures of the
8327 (let ((articles nil)
8328 (case-fold-search t))
8329 (dolist (header gnus-newsgroup-headers)
8330 (when (funcall predicate header)
8331 (push (mail-header-number header) articles)))
8332 (gnus-summary-limit (nreverse articles))))
8334 (defun gnus-summary-limit-to-age (age &optional younger-p)
8335 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8336 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8337 articles that are younger than AGE days."
8339 (let ((younger current-prefix-arg)
8342 (while (not days-got)
8343 (setq days (if younger
8344 (read-string "Limit to articles younger than (in days, older when negative): ")
8346 "Limit to articles older than (in days, younger when negative): ")))
8347 (when (> (length days) 0)
8348 (setq days (read days)))
8353 (setq younger (not younger))
8354 (setq days (* days -1))))
8355 (message "Please enter a number.")
8357 (list days younger)))
8359 (let ((data gnus-newsgroup-data)
8360 (cutoff (days-to-time age))
8361 articles d date is-younger)
8362 (while (setq d (pop data))
8363 (when (and (vectorp (gnus-data-header d))
8364 (setq date (mail-header-date (gnus-data-header d))))
8365 (setq is-younger (time-less-p
8366 (time-since (gnus-date-get-time date))
8371 (push (gnus-data-number d) articles))))
8372 (gnus-summary-limit (nreverse articles)))
8373 (gnus-summary-position-point)))
8375 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8376 "Limit the summary buffer to articles that match an 'extra' header."
8380 (gnus-completing-read
8381 (if current-prefix-arg
8382 "Exclude extra header"
8383 "Limit extra header")
8384 (mapcar 'symbol-name gnus-extra-headers)
8386 (symbol-name (car gnus-extra-headers))))))
8388 (read-string (format "%s header %s (regexp): "
8389 (if current-prefix-arg "Exclude" "Limit to")
8391 current-prefix-arg)))
8392 (when (not (equal "" regexp))
8394 (let ((articles (gnus-summary-find-matching
8395 (cons 'extra header) regexp 'all nil nil
8398 (error "Found no matches for \"%s\"" regexp))
8399 (gnus-summary-limit articles))
8400 (gnus-summary-position-point))))
8402 (defun gnus-summary-limit-to-display-predicate ()
8403 "Limit the summary buffer to the predicated in the `display' group parameter."
8405 (unless gnus-newsgroup-display
8406 (error "There is no `display' group parameter"))
8408 (dolist (gnus-number gnus-newsgroup-articles)
8409 (when (funcall gnus-newsgroup-display)
8410 (push gnus-number articles)))
8411 (gnus-summary-limit articles))
8412 (gnus-summary-position-point))
8414 (defun gnus-summary-limit-to-unread (&optional all)
8415 "Limit the summary buffer to articles that are not marked as read.
8416 If ALL is non-nil, limit strictly to unread articles."
8419 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8420 (gnus-summary-limit-to-marks
8421 ;; Concat all the marks that say that an article is read and have
8423 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8424 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8425 gnus-low-score-mark gnus-expirable-mark
8426 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8427 gnus-duplicate-mark)
8430 (defun gnus-summary-limit-to-headers (match &optional reverse)
8431 "Limit the summary buffer to articles that have headers that match MATCH.
8432 If REVERSE (the prefix), limit to articles that don't match."
8433 (interactive "sMatch headers (regexp): \nP")
8434 (gnus-summary-limit-to-bodies match reverse t))
8436 (declare-function article-goto-body "gnus-art" ())
8438 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8439 "Limit the summary buffer to articles that have bodies that match MATCH.
8440 If REVERSE (the prefix), limit to articles that don't match."
8441 (interactive "sMatch body (regexp): \nP")
8442 (let ((articles nil)
8443 (gnus-select-article-hook nil) ;Disable hook.
8444 (gnus-article-prepare-hook nil)
8445 (gnus-use-article-prefetch nil)
8446 (gnus-keep-backlog nil)
8447 (gnus-break-pages nil)
8448 (gnus-summary-display-arrow nil)
8449 (gnus-updated-mode-lines nil)
8450 (gnus-auto-center-summary nil)
8451 (gnus-display-mime-function nil))
8452 (dolist (data gnus-newsgroup-data)
8453 (let (gnus-mark-article-hook)
8454 (gnus-summary-select-article t t nil (gnus-data-number data)))
8455 (with-current-buffer gnus-article-buffer
8457 (let* ((case-fold-search t)
8459 (re-search-backward match nil t)
8460 (re-search-forward match nil t))))
8461 (when (or (and found
8465 (push (gnus-data-number data) articles)))))
8467 (message "No messages matched")
8468 (gnus-summary-limit articles)))
8469 (gnus-summary-position-point))
8471 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8472 "Limit the summary buffer to articles that aren't part on any thread.
8473 If THREADSP (the prefix), limit to articles that are in threads."
8475 (let ((articles nil)
8478 (dolist (thread gnus-newsgroup-threads)
8479 (if (stringp (car thread))
8480 (dolist (thread (cdr thread))
8481 (push thread threads))
8482 (push thread threads)))
8483 (dolist (thread threads)
8484 (setq thread-articles (gnus-articles-in-thread thread))
8485 (when (or (and threadsp
8486 (> (length thread-articles) 1))
8488 (= (length thread-articles) 1)))
8489 (setq articles (nconc thread-articles articles))))
8491 (message "No messages matched")
8492 (gnus-summary-limit articles))
8493 (gnus-summary-position-point)))
8495 (defun gnus-summary-limit-to-replied (&optional unreplied)
8496 "Limit the summary buffer to replied articles.
8497 If UNREPLIED (the prefix), limit to unreplied articles."
8501 (gnus-set-difference gnus-newsgroup-articles
8502 gnus-newsgroup-replied))
8503 (gnus-summary-limit gnus-newsgroup-replied))
8504 (gnus-summary-position-point))
8506 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8507 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8508 If REVERSE, limit the summary buffer to articles that are marked
8509 with MARKS. MARKS can either be a string of marks or a list of marks.
8510 Returns how many articles were removed."
8511 (interactive "sMarks: ")
8512 (gnus-summary-limit-to-marks marks t))
8514 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8515 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8516 If REVERSE (the prefix), limit the summary buffer to articles that are
8517 not marked with MARKS. MARKS can either be a string of marks or a
8519 Returns how many articles were removed."
8520 (interactive "sMarks: \nP")
8522 (let ((data gnus-newsgroup-data)
8523 (marks (if (listp marks) marks
8524 (append marks nil))) ; Transform to list.
8527 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8528 (memq (gnus-data-mark (car data)) marks))
8529 (push (gnus-data-number (car data)) articles))
8530 (setq data (cdr data)))
8531 (gnus-summary-limit articles))
8532 (gnus-summary-position-point)))
8534 (defun gnus-summary-limit-to-score (score)
8535 "Limit to articles with score at or above SCORE."
8536 (interactive "NLimit to articles with score of at least: ")
8537 (let ((data gnus-newsgroup-data)
8540 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8542 (push (gnus-data-number (car data)) articles))
8543 (setq data (cdr data)))
8545 (gnus-summary-limit articles)
8546 (gnus-summary-position-point))))
8548 (defun gnus-summary-limit-to-unseen ()
8549 "Limit to unseen articles."
8552 (gnus-summary-limit gnus-newsgroup-unseen)
8553 (gnus-summary-position-point)))
8555 (defun gnus-summary-limit-include-thread (id)
8556 "Display all the hidden articles that is in the thread with ID in it.
8557 When called interactively, ID is the Message-ID of the current
8559 (interactive (list (mail-header-id (gnus-summary-article-header))))
8560 (let ((articles (gnus-articles-in-thread
8561 (gnus-id-to-thread (gnus-root-id id))))
8562 ;;we REALLY want the whole thread---this prevents cut-threads
8563 ;;from removing the thread we want to include.
8564 (gnus-fetch-old-headers nil)
8565 (gnus-build-sparse-threads nil))
8567 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8568 (gnus-summary-limit-include-matching-articles
8570 (regexp-quote (gnus-simplify-subject-re
8571 (mail-header-subject (gnus-id-to-header id)))))
8572 (gnus-summary-position-point))))
8574 (defun gnus-summary-limit-include-matching-articles (header regexp)
8575 "Display all the hidden articles that have HEADERs that match REGEXP."
8576 (interactive (list (read-string "Match on header: ")
8577 (read-string "Regexp: ")))
8578 (let ((articles (gnus-find-matching-articles header regexp)))
8580 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8581 (gnus-summary-position-point))))
8583 (defun gnus-summary-insert-dormant-articles ()
8584 "Insert all the dormant articles for this group into the current buffer."
8586 (let ((gnus-verbose (max 6 gnus-verbose)))
8587 (if (not gnus-newsgroup-dormant)
8588 (gnus-message 3 "No dormant articles for this group")
8589 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8591 (defun gnus-summary-insert-ticked-articles ()
8592 "Insert ticked articles for this group into the current buffer."
8594 (let ((gnus-verbose (max 6 gnus-verbose)))
8595 (if (not gnus-newsgroup-marked)
8596 (gnus-message 3 "No ticked articles for this group")
8597 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8599 (defun gnus-summary-limit-include-dormant ()
8600 "Display all the hidden articles that are marked as dormant.
8601 Note that this command only works on a subset of the articles currently
8602 fetched for this group."
8604 (unless gnus-newsgroup-dormant
8605 (error "There are no dormant articles in this group"))
8607 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8608 (gnus-summary-position-point)))
8610 (defun gnus-summary-include-articles (articles)
8611 "Fetch the headers for ARTICLES and then display the summary lines."
8612 (let ((gnus-inhibit-demon t)
8614 (gnus-read-all-available-headers t))
8615 (setq gnus-newsgroup-headers
8617 'list gnus-newsgroup-headers
8618 (gnus-fetch-headers articles nil t)
8619 'gnus-article-sort-by-number))
8620 (setq gnus-newsgroup-articles
8621 (gnus-sorted-nunion gnus-newsgroup-articles articles))
8622 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8624 (defun gnus-summary-limit-exclude-dormant ()
8625 "Hide all dormant articles."
8628 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8629 (gnus-summary-position-point)))
8631 (defun gnus-summary-limit-exclude-childless-dormant ()
8632 "Hide all dormant articles that have no children."
8634 (let ((data (gnus-data-list t))
8635 articles d children)
8636 ;; Find all articles that are either not dormant or have
8638 (while (setq d (pop data))
8639 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8641 (gnus-article-children (gnus-data-number d)))
8644 (when (memq (car children) articles)
8649 (push (gnus-data-number d) articles)))
8652 (gnus-summary-limit articles)
8653 (gnus-summary-position-point))))
8655 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8656 "Mark all unread excluded articles as read.
8657 If ALL, mark even excluded ticked and dormants as read."
8659 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8660 (let ((articles (gnus-sorted-ndifference
8662 (mapcar (lambda (h) (mail-header-number h))
8663 gnus-newsgroup-headers)
8665 gnus-newsgroup-limit))
8667 (setq gnus-newsgroup-unreads
8668 (gnus-sorted-intersection gnus-newsgroup-unreads
8669 gnus-newsgroup-limit))
8671 (setq gnus-newsgroup-dormant nil
8672 gnus-newsgroup-marked nil
8673 gnus-newsgroup-reads
8675 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8676 gnus-newsgroup-reads))
8677 (while (setq article (pop articles))
8678 (unless (or (memq article gnus-newsgroup-dormant)
8679 (memq article gnus-newsgroup-marked))
8680 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8682 (defun gnus-summary-limit (articles &optional pop)
8684 ;; We pop the previous limit off the stack and use that.
8685 (setq articles (car gnus-newsgroup-limits)
8686 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8687 ;; We use the new limit, so we push the old limit on the stack.
8688 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8690 (setq gnus-newsgroup-limit articles)
8691 (let ((total (length gnus-newsgroup-data))
8692 (data (gnus-data-find-list (gnus-summary-article-number)))
8693 (gnus-summary-mark-below nil) ; Inhibit this.
8695 ;; This will do all the work of generating the new summary buffer
8696 ;; according to the new limit.
8697 (gnus-summary-prepare)
8698 ;; Hide any threads, possibly.
8699 (gnus-summary-maybe-hide-threads)
8700 ;; Try to return to the article you were at, or one in the
8703 ;; We try to find some article after the current one.
8705 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8708 (setq data (cdr data))))
8710 ;; If there is no data, that means that we were after the last
8711 ;; article. The same goes when we can't find any articles
8712 ;; after the current one.
8713 (goto-char (point-max))
8714 (gnus-summary-find-prev))
8715 (gnus-set-mode-line 'summary)
8716 ;; We return how many articles were removed from the summary
8717 ;; buffer as a result of the new limit.
8718 (- total (length gnus-newsgroup-data))))
8720 (defsubst gnus-invisible-cut-children (threads)
8723 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8728 (defsubst gnus-cut-thread (thread)
8729 "Go forwards in the thread until we find an article that we want to display."
8730 (when (or (eq gnus-fetch-old-headers 'some)
8731 (eq gnus-fetch-old-headers 'invisible)
8732 (numberp gnus-fetch-old-headers)
8733 (eq gnus-build-sparse-threads 'some)
8734 (eq gnus-build-sparse-threads 'more))
8735 ;; Deal with old-fetched headers and sparse threads.
8739 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8740 (gnus-summary-article-ancient-p
8741 (mail-header-number (car thread))))
8742 (if (or (<= (length (cdr thread)) 1)
8743 (eq gnus-fetch-old-headers 'invisible))
8744 (setq gnus-newsgroup-limit
8745 (delq (mail-header-number (car thread))
8746 gnus-newsgroup-limit)
8747 thread (cadr thread))
8748 (when (gnus-invisible-cut-children (cdr thread))
8749 (let ((th (cdr thread)))
8751 (if (memq (mail-header-number (caar th))
8752 gnus-newsgroup-limit)
8753 (setq thread (car th)
8755 (setq th (cdr th))))))))))
8758 (defun gnus-cut-threads (threads)
8759 "Cut off all uninteresting articles from the beginning of THREADS."
8760 (when (or (eq gnus-fetch-old-headers 'some)
8761 (eq gnus-fetch-old-headers 'invisible)
8762 (numberp gnus-fetch-old-headers)
8763 (eq gnus-build-sparse-threads 'some)
8764 (eq gnus-build-sparse-threads 'more))
8767 (setcar th (gnus-cut-thread (car th)))
8768 (setq th (cdr th)))))
8769 ;; Remove nixed out threads.
8772 (defun gnus-summary-initial-limit (&optional show-if-empty)
8773 "Figure out what the initial limit is supposed to be on group entry.
8774 This entails weeding out unwanted dormants, low-scored articles,
8775 fetch-old-headers verbiage, and so on."
8776 ;; Most groups have nothing to remove.
8777 (unless (or gnus-inhibit-limiting
8778 (and (null gnus-newsgroup-dormant)
8779 (eq gnus-newsgroup-display 'gnus-not-ignore)
8780 (not (eq gnus-fetch-old-headers 'some))
8781 (not (numberp gnus-fetch-old-headers))
8782 (not (eq gnus-fetch-old-headers 'invisible))
8783 (null gnus-summary-expunge-below)
8784 (not (eq gnus-build-sparse-threads 'some))
8785 (not (eq gnus-build-sparse-threads 'more))
8786 (null gnus-thread-expunge-below)))
8787 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8788 (setq gnus-newsgroup-limit nil)
8791 (unless (car (symbol-value node))
8792 ;; These threads have no parents -- they are roots.
8793 (let ((nodes (cdr (symbol-value node)))
8796 (if (and gnus-thread-expunge-below
8797 (< (gnus-thread-total-score (car nodes))
8798 gnus-thread-expunge-below))
8799 (gnus-expunge-thread (pop nodes))
8800 (setq thread (pop nodes))
8801 (gnus-summary-limit-children thread))))))
8802 gnus-newsgroup-dependencies)
8803 ;; If this limitation resulted in an empty group, we might
8804 ;; pop the previous limit and use it instead.
8805 (when (and (not gnus-newsgroup-limit)
8807 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8808 gnus-newsgroup-limit))
8810 (defun gnus-summary-limit-children (thread)
8811 "Return 1 if this subthread is visible and 0 if it is not."
8812 ;; First we get the number of visible children to this thread. This
8813 ;; is done by recursing down the thread using this function, so this
8814 ;; will really go down to a leaf article first, before slowly
8815 ;; working its way up towards the root.
8817 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8820 (apply '+ (mapcar 'gnus-summary-limit-children
8823 (number (mail-header-number (car thread)))
8826 (not (memq number gnus-newsgroup-marked))
8828 ;; If this article is dormant and has absolutely no visible
8829 ;; children, then this article isn't visible.
8830 (and (memq number gnus-newsgroup-dormant)
8832 ;; If this is "fetch-old-headered" and there is no
8833 ;; visible children, then we don't want this article.
8834 (and (or (eq gnus-fetch-old-headers 'some)
8835 (numberp gnus-fetch-old-headers))
8836 (gnus-summary-article-ancient-p number)
8838 ;; If this is "fetch-old-headered" and `invisible', then
8839 ;; we don't want this article.
8840 (and (eq gnus-fetch-old-headers 'invisible)
8841 (gnus-summary-article-ancient-p number))
8842 ;; If this is a sparsely inserted article with no children,
8843 ;; we don't want it.
8844 (and (eq gnus-build-sparse-threads 'some)
8845 (gnus-summary-article-sparse-p number)
8847 ;; If we use expunging, and this article is really
8848 ;; low-scored, then we don't want this article.
8849 (when (and gnus-summary-expunge-below
8851 (or (cdr (assq number gnus-newsgroup-scored))
8852 gnus-summary-default-score))
8853 gnus-summary-expunge-below))
8854 ;; We increase the expunge-tally here, but that has
8855 ;; nothing to do with the limits, really.
8856 (incf gnus-newsgroup-expunged-tally)
8857 ;; We also mark as read here, if that's wanted.
8858 (when (and gnus-summary-mark-below
8859 (< score gnus-summary-mark-below))
8860 (setq gnus-newsgroup-unreads
8861 (delq number gnus-newsgroup-unreads))
8862 (if gnus-newsgroup-auto-expire
8863 (push number gnus-newsgroup-expirable)
8864 (push (cons number gnus-low-score-mark)
8865 gnus-newsgroup-reads)))
8867 ;; Do the `display' group parameter.
8868 (and gnus-newsgroup-display
8869 (let ((gnus-number number))
8870 (not (funcall gnus-newsgroup-display))))))
8871 ;; Nope, invisible article.
8873 ;; Ok, this article is to be visible, so we add it to the limit
8875 (push number gnus-newsgroup-limit)
8878 (defun gnus-expunge-thread (thread)
8879 "Mark all articles in THREAD as read."
8880 (let* ((number (mail-header-number (car thread))))
8881 (incf gnus-newsgroup-expunged-tally)
8882 ;; We also mark as read here, if that's wanted.
8883 (setq gnus-newsgroup-unreads
8884 (delq number gnus-newsgroup-unreads))
8885 (if gnus-newsgroup-auto-expire
8886 (push number gnus-newsgroup-expirable)
8887 (push (cons number gnus-low-score-mark)
8888 gnus-newsgroup-reads)))
8889 ;; Go recursively through all subthreads.
8890 (mapcar 'gnus-expunge-thread (cdr thread)))
8892 ;; Summary article oriented commands
8894 (defun gnus-summary-refer-parent-article (n)
8895 "Refer parent article N times.
8896 If N is negative, go to ancestor -N instead.
8897 The difference between N and the number of articles fetched is returned."
8901 (when (not (natnump n))
8906 (setq header (gnus-summary-article-header))
8907 (if (and (eq (mail-header-number header)
8908 (cdr gnus-article-current))
8909 (equal gnus-newsgroup-name
8910 (car gnus-article-current)))
8911 ;; If we try to find the parent of the currently
8912 ;; displayed article, then we take a look at the actual
8913 ;; References header, since this is slightly more
8914 ;; reliable than the References field we got from the
8916 (with-current-buffer gnus-original-article-buffer
8917 (nnheader-narrow-to-headers)
8918 (unless (setq ref (message-fetch-field "references"))
8919 (when (setq ref (message-fetch-field "in-reply-to"))
8920 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8923 ;; It's not the current article, so we take a bet on
8924 ;; the value we got from the server.
8925 (mail-header-references header)))
8927 (not (equal ref "")))
8928 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8929 (gnus-message 1 "Couldn't find parent"))
8930 (gnus-message 1 "No references in article %d"
8931 (gnus-summary-article-number))
8934 (gnus-summary-position-point)
8937 (defun gnus-summary-refer-references ()
8938 "Fetch all articles mentioned in the References header.
8939 Return the number of articles fetched."
8941 (let ((ref (mail-header-references (gnus-summary-article-header)))
8942 (current (gnus-summary-article-number))
8946 (error "No References in the current article")
8947 ;; For each Message-ID in the References header...
8948 (while (string-match "<[^>]*>" ref)
8950 ;; ... fetch that article.
8951 (gnus-summary-refer-article
8952 (prog1 (match-string 0 ref)
8953 (setq ref (substring ref (match-end 0))))))
8954 (gnus-summary-goto-subject current)
8955 (gnus-summary-position-point)
8958 (defun gnus-delete-duplicate-headers (headers)
8959 ;; First remove leading duplicates.
8960 (while (and (> (length headers) 1)
8961 (= (mail-header-number (car headers))
8962 (mail-header-number (cadr headers))))
8965 (let ((result headers))
8966 (while (> (length headers) 1)
8967 (if (= (mail-header-number (car headers))
8968 (mail-header-number (cadr headers)))
8969 (setcdr headers (cddr headers))
8973 (defun gnus-summary-refer-thread (&optional limit)
8974 "Fetch all articles in the current thread. For backends that
8975 know how to search for threads (currently only 'nnimap) a
8976 non-numeric prefix arg will use nnir to search the entire
8977 server; without a prefix arg only the current group is
8978 searched. If the variable `gnus-refer-thread-use-nnir' is
8979 non-nil the prefix arg has the reverse meaning. If no
8980 backend-specific 'request-thread function is available fetch
8981 LIMIT (the numerical prefix) old headers. If LIMIT is
8982 non-numeric or nil fetch the number specified by the
8983 `gnus-refer-thread-limit' variable."
8985 (gnus-warp-to-article)
8986 (let* ((header (gnus-summary-article-header))
8987 (id (mail-header-id header))
8988 (gnus-inhibit-demon t)
8989 (gnus-summary-ignore-duplicates t)
8990 (gnus-read-all-available-headers t)
8991 (gnus-refer-thread-use-nnir
8992 (if (and (not (null limit)) (listp limit))
8993 (not gnus-refer-thread-use-nnir) gnus-refer-thread-use-nnir))
8995 (if (gnus-check-backend-function
8996 'request-thread gnus-newsgroup-name)
8997 (gnus-request-thread header gnus-newsgroup-name)
8998 (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
8999 gnus-refer-thread-limit))
9000 (last (if (numberp limit)
9001 (min (+ (mail-header-number header)
9003 gnus-newsgroup-highest)
9004 gnus-newsgroup-highest))
9005 (subject (gnus-simplify-subject
9006 (mail-header-subject header)))
9007 (refs (split-string (or (mail-header-references header)
9009 (gnus-parse-headers-hook
9010 `(lambda () (goto-char (point-min))
9012 (regexp-opt ',(append refs (list id subject)))))))
9013 (gnus-fetch-headers (list last) (if (numberp limit)
9014 (* 2 limit) limit) t))))
9016 (when (listp new-headers)
9017 (dolist (header new-headers)
9018 (push (mail-header-number header) article-ids)
9019 (when (member (mail-header-number header) gnus-newsgroup-unselected)
9020 (push (mail-header-number header) gnus-newsgroup-unreads)
9021 (setq gnus-newsgroup-unselected
9022 (delete (mail-header-number header)
9023 gnus-newsgroup-unselected))))
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 (nreverse article-ids)))
9031 (gnus-summary-limit-include-thread id)))
9032 (gnus-summary-show-thread))
9034 (defun gnus-summary-refer-article (message-id)
9035 "Fetch an article specified by MESSAGE-ID."
9036 (interactive "sMessage-ID: ")
9037 (gnus-warp-to-article)
9038 (when (and (stringp message-id)
9039 (not (zerop (length message-id))))
9040 (setq message-id (gnus-replace-in-string message-id " " ""))
9041 ;; Construct the correct Message-ID if necessary.
9042 ;; Suggested by tale@pawl.rpi.edu.
9043 (unless (string-match "^<" message-id)
9044 (setq message-id (concat "<" message-id)))
9045 (unless (string-match ">$" message-id)
9046 (setq message-id (concat message-id ">")))
9047 ;; People often post MIDs from URLs, so unhex it:
9048 (unless (string-match "@" message-id)
9049 (setq message-id (gnus-url-unhex-string message-id)))
9050 (let* ((header (gnus-id-to-header message-id))
9052 (gnus-summary-article-sparse-p
9053 (mail-header-number header))
9054 (memq (mail-header-number header)
9055 gnus-newsgroup-limit)))
9058 ;; If the article is present in the buffer we just go to it.
9060 (or (not (gnus-summary-article-sparse-p
9061 (mail-header-number header)))
9064 (gnus-summary-goto-article
9065 (mail-header-number header) nil t)
9067 (gnus-summary-update-article (mail-header-number header)))))
9069 ;; We fetch the article.
9071 (dolist (gnus-override-method (gnus-refer-article-methods))
9072 (when (and (gnus-check-server gnus-override-method)
9073 ;; Fetch the header,
9074 (setq number (gnus-summary-insert-subject message-id)))
9075 ;; and display the article.
9076 (gnus-summary-select-article nil nil nil number)
9078 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
9080 (defun gnus-refer-article-methods ()
9081 "Return a list of referable methods."
9083 ;; No method, so we default to current and native.
9084 ((null gnus-refer-article-method)
9085 (list gnus-current-select-method gnus-select-method))
9087 ((eq 'current gnus-refer-article-method)
9088 (list gnus-current-select-method))
9089 ;; List of select methods.
9090 ((not (and (symbolp (car gnus-refer-article-method))
9091 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
9093 (dolist (method gnus-refer-article-method)
9094 (push (if (eq 'current method)
9095 gnus-current-select-method
9096 (if (eq 'nnir (car method))
9100 (gnus-method-to-server gnus-current-select-method)))
9104 ;; One single select method.
9106 (list gnus-refer-article-method))))
9108 (defun gnus-summary-edit-parameters ()
9109 "Edit the group parameters of the current group."
9111 (gnus-group-edit-group gnus-newsgroup-name 'params))
9113 (defun gnus-summary-customize-parameters ()
9114 "Customize the group parameters of the current group."
9116 (gnus-group-customize gnus-newsgroup-name))
9118 (defun gnus-summary-enter-digest-group (&optional force)
9119 "Enter an nndoc group based on the current article.
9120 If FORCE, force a digest interpretation. If not, try to guess
9121 what the document format is.
9123 To control what happens when you exit the group, see the
9124 `gnus-auto-select-on-ephemeral-exit' variable."
9126 (let ((conf gnus-current-window-configuration))
9127 (save-window-excursion
9129 (let (gnus-article-prepare-hook
9130 gnus-display-mime-function
9132 (gnus-summary-select-article))))
9133 (setq gnus-current-window-configuration conf)
9134 (let* ((name (format "%s-%d"
9135 (gnus-group-prefixed-name
9136 gnus-newsgroup-name (list 'nndoc ""))
9137 (with-current-buffer gnus-summary-buffer
9138 gnus-current-article)))
9139 (ogroup gnus-newsgroup-name)
9140 (params (append (gnus-info-params (gnus-get-info ogroup))
9141 (list (cons 'to-group ogroup))
9142 (list (cons 'parent-group ogroup))
9143 (list (cons 'save-article-group ogroup))))
9144 (case-fold-search t)
9145 (buf (current-buffer))
9146 dig to-address charset)
9147 (with-current-buffer gnus-original-article-buffer
9148 ;; Have the digest group inherit the main mail address of
9149 ;; the parent article.
9150 (when (setq to-address (or (gnus-fetch-field "reply-to")
9151 (gnus-fetch-field "from")))
9154 (list (cons 'to-address
9155 (funcall gnus-decode-encoded-address-function
9157 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
9158 (insert-buffer-substring gnus-original-article-buffer)
9160 (goto-char (point-min))
9161 (or (search-forward "\n\n" nil t) (point)))
9162 ;; Remove lines that may lead nndoc to misinterpret the
9164 (goto-char (point-min))
9165 (delete-matching-lines "^Path:\\|^From ")
9166 ;; Parse charset, and decode content transfer encoding.
9167 (setq charset (mail-content-type-get
9168 (mail-header-parse-content-type
9169 (or (gnus-fetch-field "content-type") ""))
9171 (let ((encoding (gnus-fetch-field "content-transfer-encoding")))
9173 (message-remove-header "content-transfer-encoding")
9174 (goto-char (point-max))
9176 (narrow-to-region (point) (point-max))
9177 (mm-decode-content-transfer-encoding
9178 (intern (downcase (mail-header-strip encoding))))))
9181 (if (let ((gnus-newsgroup-ephemeral-charset
9183 (intern (downcase (gnus-strip-whitespace charset)))
9184 gnus-newsgroup-charset))
9185 (gnus-newsgroup-ephemeral-ignored-charsets
9186 gnus-newsgroup-ignored-charsets))
9187 (gnus-group-read-ephemeral-group
9188 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
9190 ,(if force 'mbox 'guess)))
9192 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
9194 ;; Make all postings to this group go to the parent group.
9195 (nconc (gnus-info-params (gnus-get-info name))
9197 ;; Couldn't select this doc group.
9198 (switch-to-buffer buf)
9199 (gnus-set-global-variables)
9200 (gnus-configure-windows 'summary)
9201 (gnus-message 3 "Article couldn't be entered?"))
9202 (kill-buffer dig)))))
9204 (defun gnus-summary-read-document (n)
9205 "Open a new group based on the current article(s).
9206 This will allow you to read digests and other similar
9207 documents as newsgroups.
9208 Obeys the standard process/prefix convention."
9210 (let* ((ogroup gnus-newsgroup-name)
9211 (params (append (gnus-info-params (gnus-get-info ogroup))
9212 (list (cons 'to-group ogroup))))
9213 group egroup groups vgroup)
9214 (dolist (article (gnus-summary-work-articles n))
9215 (setq group (format "%s-%d" gnus-newsgroup-name article))
9216 (gnus-summary-remove-process-mark article)
9217 (when (gnus-summary-display-article article)
9218 (save-excursion ;;What for?
9220 (insert-buffer-substring gnus-original-article-buffer)
9221 ;; Remove some headers that may lead nndoc to make
9223 (message-narrow-to-head)
9224 (goto-char (point-min))
9225 (delete-matching-lines "^Path:\\|^From ")
9228 (gnus-group-read-ephemeral-group
9229 group `(nndoc ,group (nndoc-address ,(current-buffer))
9230 (nndoc-article-type guess))
9233 ;; Make all postings to this group go to the parent group.
9234 (nconc (gnus-info-params (gnus-get-info egroup))
9236 (push egroup groups))
9237 ;; Couldn't select this doc group.
9238 (gnus-error 3 "Article couldn't be entered"))))))
9239 ;; Now we have selected all the documents.
9242 (error "None of the articles could be interpreted as documents"))
9243 ((gnus-group-read-ephemeral-group
9244 (setq vgroup (format
9245 "nnvirtual:%s-%s" gnus-newsgroup-name
9246 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
9247 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
9249 (cons (current-buffer) 'summary)))
9251 (error "Couldn't select virtual nndoc group")))))
9253 (defun gnus-summary-widget-forward (arg)
9254 "Move point to the next field or button in the article.
9255 With optional ARG, move across that many fields."
9257 (gnus-summary-select-article)
9258 (gnus-configure-windows 'article)
9259 (select-window (gnus-get-buffer-window gnus-article-buffer))
9260 (widget-forward arg))
9262 (defun gnus-summary-widget-backward (arg)
9263 "Move point to the previous field or button in the article.
9264 With optional ARG, move across that many fields."
9266 (gnus-summary-select-article)
9267 (gnus-configure-windows 'article)
9268 (select-window (gnus-get-buffer-window gnus-article-buffer))
9269 (unless (widget-at (point))
9270 (goto-char (point-max)))
9271 (widget-backward arg))
9273 (defun gnus-summary-isearch-article (&optional regexp-p)
9274 "Do incremental search forward on the current article.
9275 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9277 (gnus-summary-select-article)
9278 (gnus-configure-windows 'article)
9279 (gnus-eval-in-buffer-window gnus-article-buffer
9282 (isearch-forward regexp-p))))
9284 (defun gnus-summary-repeat-search-article-forward ()
9285 "Repeat the previous search forwards."
9287 (unless gnus-last-search-regexp
9288 (error "No previous search"))
9289 (gnus-summary-search-article-forward gnus-last-search-regexp))
9291 (defun gnus-summary-repeat-search-article-backward ()
9292 "Repeat the previous search backwards."
9294 (unless gnus-last-search-regexp
9295 (error "No previous search"))
9296 (gnus-summary-search-article-forward gnus-last-search-regexp t))
9298 (defun gnus-summary-search-article-forward (regexp &optional backward)
9299 "Search for an article containing REGEXP forward.
9300 If BACKWARD, search backward instead."
9303 (format "Search article %s (regexp%s): "
9304 (if current-prefix-arg "backward" "forward")
9305 (if gnus-last-search-regexp
9306 (concat ", default " gnus-last-search-regexp)
9308 current-prefix-arg))
9309 (if (string-equal regexp "")
9310 (setq regexp (or gnus-last-search-regexp ""))
9311 (setq gnus-last-search-regexp regexp)
9312 (setq gnus-article-before-search gnus-current-article))
9313 ;; Intentionally set gnus-last-article.
9314 (setq gnus-last-article gnus-article-before-search)
9315 (let ((gnus-last-article gnus-last-article))
9316 (if (gnus-summary-search-article regexp backward)
9317 (gnus-summary-show-thread)
9318 (signal 'search-failed (list regexp)))))
9320 (defun gnus-summary-search-article-backward (regexp)
9321 "Search for an article containing REGEXP backward."
9324 (format "Search article backward (regexp%s): "
9325 (if gnus-last-search-regexp
9326 (concat ", default " gnus-last-search-regexp)
9328 (gnus-summary-search-article-forward regexp 'backward))
9330 (defun gnus-summary-search-article (regexp &optional backward)
9331 "Search for an article containing REGEXP.
9332 Optional argument BACKWARD means do search for backward.
9333 `gnus-select-article-hook' is not called during the search."
9334 ;; We have to require this here to make sure that the following
9335 ;; dynamic binding isn't shadowed by autoloading.
9336 (require 'gnus-async)
9338 (let ((gnus-select-article-hook nil) ;Disable hook.
9339 (gnus-article-prepare-hook nil)
9340 (gnus-mark-article-hook nil) ;Inhibit marking as read.
9341 (gnus-use-article-prefetch nil)
9342 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
9343 (gnus-use-trees nil) ;Inhibit updating tree buffer.
9345 (gnus-keep-backlog nil)
9346 (gnus-break-pages nil)
9347 (gnus-summary-display-arrow nil)
9348 (gnus-updated-mode-lines nil)
9349 (gnus-auto-center-summary nil)
9350 (sum (current-buffer))
9351 (gnus-display-mime-function nil)
9354 (gnus-save-hidden-threads
9355 (gnus-summary-select-article)
9356 (set-buffer gnus-article-buffer)
9357 (goto-char (window-point (get-buffer-window (current-buffer))))
9361 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
9363 (re-search-backward regexp nil t)
9364 (re-search-forward regexp nil t))
9365 ;; We found the regexp.
9370 (get-buffer-window (current-buffer))
9374 (get-buffer-window (current-buffer))
9377 (setq point (point)))
9378 ;; We didn't find it, so we go to the next article.
9381 (while (eq found 'not)
9382 (if (not (if backward (gnus-summary-find-prev)
9383 (gnus-summary-find-next)))
9384 ;; No more articles.
9386 ;; Select the next article and adjust point.
9387 (unless (gnus-summary-article-sparse-p
9388 (gnus-summary-article-number))
9390 (gnus-summary-select-article)
9391 (set-buffer gnus-article-buffer)
9393 (goto-char (if backward (point-max) (point-min))))))))
9394 (gnus-message 7 ""))
9395 ;; Return whether we found the regexp.
9396 (when (eq found 'found)
9398 (gnus-summary-show-thread)
9399 (gnus-summary-goto-subject gnus-current-article)
9400 (gnus-summary-position-point)
9403 (defun gnus-find-matching-articles (header regexp)
9404 "Return a list of all articles that match REGEXP on HEADER.
9405 This search includes all articles in the current group that Gnus has
9406 fetched headers for, whether they are displayed or not."
9407 (let ((articles nil)
9408 ;; Can't eta-reduce because it's a macro.
9409 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9410 (case-fold-search t))
9411 (dolist (header gnus-newsgroup-headers)
9412 (when (string-match regexp (funcall func header))
9413 (push (mail-header-number header) articles)))
9414 (nreverse articles)))
9416 (defun gnus-summary-find-matching (header regexp &optional backward unread
9417 not-case-fold not-matching)
9418 "Return a list of all articles that match REGEXP on HEADER.
9419 The search stars on the current article and goes forwards unless
9420 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9421 If UNREAD is non-nil, only unread articles will
9422 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9423 in the comparisons. If NOT-MATCHING, return a list of all articles that
9424 not match REGEXP on HEADER."
9425 (let ((case-fold-search (not not-case-fold))
9428 (if (eq (car header) 'extra)
9431 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9433 (error "%s is an invalid header" header))
9434 (unless (fboundp (intern (concat "mail-header-" header)))
9435 (error "%s is not a valid header" header))
9436 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9437 (dolist (d (if (eq backward 'all)
9439 (gnus-data-find-list
9440 (gnus-summary-article-number)
9441 (gnus-data-list backward))))
9442 (when (and (or (not unread) ; We want all articles...
9443 (gnus-data-unread-p d)) ; Or just unreads.
9444 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9448 (funcall func (gnus-data-header d))))
9449 (string-match regexp
9450 (funcall func (gnus-data-header d)))))
9451 (push (gnus-data-number d) articles))) ; Success!
9452 (nreverse articles)))
9454 (defun gnus-summary-execute-command (header regexp command &optional backward)
9455 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9456 If HEADER is an empty string (or nil), the match is done on the entire
9457 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9459 (list (let ((completion-ignore-case t))
9460 (gnus-completing-read
9462 (mapcar 'symbol-name
9464 '(Number Subject From Lines Date
9465 Message-ID Xref References Body)
9466 gnus-extra-headers))
9468 (read-string "Regexp: ")
9469 (read-key-sequence "Command: ")
9470 current-prefix-arg))
9471 (when (equal header "Body")
9473 ;; Hidden thread subtrees must be searched as well.
9474 (gnus-summary-show-all-threads)
9475 ;; We don't want to change current point nor window configuration.
9477 (save-window-excursion
9479 gnus-treat-strip-trailing-blank-lines
9480 gnus-treat-strip-leading-blank-lines
9481 gnus-treat-strip-multiple-blank-lines
9482 gnus-treat-hide-boring-headers
9483 gnus-treat-fold-newsgroups
9484 gnus-article-prepare-hook)
9485 (gnus-message 6 "Executing %s..." (key-description command))
9486 ;; We'd like to execute COMMAND interactively so as to give arguments.
9487 (gnus-execute header regexp
9488 `(call-interactively ',(key-binding command))
9490 (gnus-message 6 "Executing %s...done" (key-description command))))))
9492 (defun gnus-summary-beginning-of-article ()
9493 "Scroll the article back to the beginning."
9495 (gnus-summary-select-article)
9496 (gnus-configure-windows 'article)
9497 (gnus-eval-in-buffer-window gnus-article-buffer
9499 (goto-char (point-min))
9500 (when gnus-break-pages
9501 (gnus-narrow-to-page))))
9503 (defun gnus-summary-end-of-article ()
9504 "Scroll to the end of the article."
9506 (gnus-summary-select-article)
9507 (gnus-configure-windows 'article)
9508 (gnus-eval-in-buffer-window gnus-article-buffer
9510 (goto-char (point-max))
9512 (when gnus-break-pages
9513 (gnus-narrow-to-page))))
9515 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9516 "Truncate to LEN and quote all \"(\"'s in STRING."
9517 (gnus-replace-in-string (if (and len (> (length string) len))
9518 (substring string 0 len)
9522 (defun gnus-summary-print-article (&optional filename n)
9523 "Generate and print a PostScript image of the process-marked (mail) articles.
9525 If used interactively, print the current article if none are
9526 process-marked. With prefix arg, prompt the user for the name of the
9529 When used from Lisp, accept two optional args FILENAME and N. N means
9530 to print the next N articles. If N is negative, print the N previous
9531 articles. If N is nil and articles have been marked with the process
9532 mark, print these instead.
9534 If the optional first argument FILENAME is nil, send the image to the
9535 printer. If FILENAME is a string, save the PostScript image in a file with
9536 that name. If FILENAME is a number, prompt the user for the name of the file
9538 (interactive (list (ps-print-preprint current-prefix-arg)))
9539 (dolist (article (gnus-summary-work-articles n))
9540 (gnus-summary-select-article nil nil 'pseudo article)
9541 (gnus-eval-in-buffer-window gnus-article-buffer
9542 (gnus-print-buffer))
9543 (gnus-summary-remove-process-mark article))
9544 (ps-despool filename))
9546 (defun gnus-print-buffer ()
9547 (let ((ps-left-header
9550 (gnus-summary-print-truncate-and-quote
9551 (mail-header-subject gnus-current-headers)
9554 (gnus-summary-print-truncate-and-quote
9555 (mail-header-from gnus-current-headers)
9559 "/pagenumberstring load"
9561 (mail-header-date gnus-current-headers) ")"))))
9562 (gnus-run-hooks 'gnus-ps-print-hook)
9564 (if ps-print-color-p
9565 (ps-spool-buffer-with-faces)
9566 (ps-spool-buffer)))))
9568 (declare-function gnus-flush-original-article-buffer "gnus-art" ())
9570 (defun gnus-summary-show-complete-article ()
9571 "Show a complete version of the current article.
9572 This is only useful if you're looking at a partial version of the
9575 (let ((gnus-keep-backlog nil)
9576 (gnus-use-cache nil)
9579 (format "%s-fetch-partial-articles"
9580 (car (gnus-find-method-for-group
9581 gnus-newsgroup-name)))
9586 (setq old-val (symbol-value variable))
9588 (gnus-flush-original-article-buffer)
9589 (gnus-summary-show-article))
9590 (set variable old-val))))
9592 (defun gnus-summary-show-article (&optional arg)
9593 "Force redisplaying of the current article.
9594 If ARG (the prefix) is a number, show the article with the charset
9595 defined in `gnus-summary-show-article-charset-alist', or the charset
9597 If ARG (the prefix) is non-nil and not a number, show the article,
9598 but without running any of the article treatment functions
9599 article. Normally, the keystroke is `C-u g'. When using `C-u
9600 C-u g', show the raw article."
9604 (gnus-summary-show-article t)
9605 (let ((gnus-newsgroup-charset
9606 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9607 (mm-read-coding-system
9608 "View as charset: " ;; actually it is coding system.
9609 (with-current-buffer gnus-article-buffer
9610 (mm-detect-coding-region (point) (point-max))))))
9611 (gnus-newsgroup-ignored-charsets 'gnus-all))
9612 (gnus-summary-select-article nil 'force)
9613 (let ((deps gnus-newsgroup-dependencies)
9615 (with-current-buffer gnus-original-article-buffer
9617 (message-narrow-to-head)
9618 (setq head (buffer-string))
9619 (goto-char (point-min))
9620 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9621 (goto-char (point-max))
9623 (setq lines (1- (count-lines (point) (point-max))))))
9625 (insert (format "211 %d Article retrieved.\n"
9626 (cdr gnus-article-current)))
9628 (if lines (insert (format "Lines: %d\n" lines)))
9630 (let ((nntp-server-buffer (current-buffer)))
9631 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9632 (gnus-data-set-header
9633 (gnus-data-find (cdr gnus-article-current))
9635 (gnus-summary-update-article-line
9636 (cdr gnus-article-current) header)
9637 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9638 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9640 ;; Select the article the normal way.
9641 (if (eq mm-text-html-renderer 'shr)
9644 (let ((shr-ignore-cache t))
9645 (gnus-summary-select-article nil 'force)))
9646 (gnus-summary-select-article nil 'force)))
9649 (let ((gnus-inhibit-article-treatments t))
9650 (gnus-summary-select-article nil 'force)))
9652 ;; We have to require this here to make sure that the following
9653 ;; dynamic binding isn't shadowed by autoloading.
9654 (require 'gnus-async)
9656 ;; Bind the article treatment functions to nil.
9657 (let ((gnus-have-all-headers t)
9658 gnus-article-prepare-hook
9659 gnus-article-decode-hook
9660 gnus-display-mime-function
9662 ;; Destroy any MIME parts.
9663 (when (gnus-buffer-live-p gnus-article-buffer)
9664 (with-current-buffer gnus-article-buffer
9665 (gnus-article-stop-animations)
9666 (gnus-stop-downloads)
9667 (mm-destroy-parts gnus-article-mime-handles)
9668 ;; Set it to nil for safety reason.
9669 (setq gnus-article-mime-handle-alist nil)
9670 (setq gnus-article-mime-handles nil)))
9671 (gnus-summary-select-article nil 'force))))
9672 (gnus-summary-goto-subject gnus-current-article)
9673 (gnus-summary-position-point))
9675 (defun gnus-summary-show-raw-article ()
9676 "Show the raw article without any article massaging functions being run."
9678 (gnus-summary-show-article t))
9680 (defun gnus-summary-verbose-headers (&optional arg)
9681 "Toggle permanent full header display.
9682 If ARG is a positive number, turn header display on.
9683 If ARG is a negative number, turn header display off."
9685 (setq gnus-show-all-headers
9686 (cond ((or (not (numberp arg))
9688 (not gnus-show-all-headers))
9691 (gnus-summary-show-article))
9693 (declare-function article-narrow-to-head "gnus-art" ())
9694 (declare-function gnus-article-hidden-text-p "gnus-art" (type))
9695 (declare-function gnus-delete-wash-type "gnus-art" (type))
9697 (defun gnus-summary-toggle-header (&optional arg)
9698 "Show the headers if they are hidden, or hide them if they are shown.
9699 If ARG is a positive number, show the entire header.
9700 If ARG is a negative number, hide the unwanted header lines."
9702 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9703 (get-buffer-window gnus-article-buffer t))))
9704 (with-current-buffer gnus-article-buffer
9706 (article-narrow-to-head)
9707 (let* ((inhibit-read-only t)
9708 (inhibit-point-motion-hooks t)
9709 (hidden (if (numberp arg)
9711 (or (not (looking-at "[^ \t\n]+:"))
9712 (gnus-article-hidden-text-p 'headers))))
9714 (delete-region (point-min) (point-max))
9715 (with-current-buffer gnus-original-article-buffer
9716 (goto-char (setq s (point-min)))
9717 (setq e (if (search-forward "\n\n" nil t)
9720 (insert-buffer-substring gnus-original-article-buffer s e)
9721 (run-hooks 'gnus-article-decode-hook)
9723 (let ((gnus-treat-hide-headers nil)
9724 (gnus-treat-hide-boring-headers nil))
9725 (gnus-delete-wash-type 'headers)
9726 (gnus-treat-article 'head))
9727 (gnus-treat-article 'head))
9730 (set-window-start window (goto-char (point-min))))
9731 (if gnus-break-pages
9732 (gnus-narrow-to-page)
9733 (when (gnus-visual-p 'page-marker)
9734 (let ((inhibit-read-only t))
9735 (gnus-remove-text-with-property 'gnus-prev)
9736 (gnus-remove-text-with-property 'gnus-next))))
9737 (gnus-set-mode-line 'article)))))
9739 (defun gnus-summary-show-all-headers ()
9740 "Make all header lines visible."
9742 (gnus-summary-toggle-header 1))
9744 (defun gnus-summary-caesar-message (&optional arg)
9745 "Caesar rotate the current article by 13.
9746 With a non-numerical prefix, also rotate headers. A numerical
9747 prefix specifies how many places to rotate each letter forward."
9749 (gnus-summary-select-article)
9750 (let ((mail-header-separator ""))
9751 (gnus-eval-in-buffer-window gnus-article-buffer
9754 (let ((start (window-start))
9755 (inhibit-read-only t))
9756 (if (equal arg '(4))
9757 (message-caesar-buffer-body nil t)
9758 (message-caesar-buffer-body arg))
9759 (set-window-start (get-buffer-window (current-buffer)) start)))))
9760 ;; Create buttons and stuff...
9761 (gnus-treat-article nil))
9763 (declare-function idna-to-unicode "ext:idna" (str))
9765 (defun gnus-summary-idna-message (&optional arg)
9766 "Decode IDNA encoded domain names in the current articles.
9767 IDNA encoded domain names looks like `xn--bar'. If a string
9768 remain unencoded after running this function, it is likely an
9769 invalid IDNA string (`xn--bar' is invalid).
9771 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9772 installed for this command to work."
9774 (if (not (and (condition-case nil (require 'idna)
9776 (mm-coding-system-p 'utf-8)
9777 (executable-find (symbol-value 'idna-program))))
9779 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9780 (gnus-summary-select-article)
9781 (let ((mail-header-separator ""))
9782 (gnus-eval-in-buffer-window gnus-article-buffer
9785 (let ((start (window-start))
9787 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9788 (replace-match (idna-to-unicode (match-string 1))))
9789 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9791 (defun gnus-summary-morse-message (&optional arg)
9792 "Morse decode the current article."
9794 (gnus-summary-select-article)
9795 (let ((mail-header-separator ""))
9796 (gnus-eval-in-buffer-window gnus-article-buffer
9800 (let ((pos (window-start))
9801 (inhibit-read-only t))
9802 (goto-char (point-min))
9803 (when (message-goto-body)
9804 (gnus-narrow-to-body))
9805 (goto-char (point-min))
9806 (while (search-forward "·" (point-max) t)
9807 (replace-match "."))
9808 (unmorse-region (point-min) (point-max))
9810 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9812 (defun gnus-summary-stop-page-breaking ()
9813 "Stop page breaking in the current article."
9815 (gnus-summary-select-article)
9816 (gnus-eval-in-buffer-window gnus-article-buffer
9818 (when (gnus-visual-p 'page-marker)
9819 (let ((inhibit-read-only t))
9820 (gnus-remove-text-with-property 'gnus-prev)
9821 (gnus-remove-text-with-property 'gnus-next))
9822 (setq gnus-page-broken nil))))
9824 (defun gnus-summary-move-article (&optional n to-newsgroup
9825 select-method action)
9826 "Move the current article to a different newsgroup.
9827 If N is a positive number, move the N next articles.
9828 If N is a negative number, move the N previous articles.
9829 If N is nil and any articles have been marked with the process mark,
9830 move those articles instead.
9831 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9832 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9833 re-spool using this method.
9835 When called interactively with TO-NEWSGROUP being nil, the value of
9836 the variable `gnus-move-split-methods' is used for finding a default
9837 for the target newsgroup.
9839 For this function to work, both the current newsgroup and the
9840 newsgroup that you want to move to have to support the `request-move'
9841 and `request-accept' functions.
9843 ACTION can be either `move' (the default), `crosspost' or `copy'."
9846 (setq action 'move))
9847 ;; Check whether the source group supports the required functions.
9848 (cond ((and (eq action 'move)
9849 (not (gnus-check-backend-function
9850 'request-move-article gnus-newsgroup-name)))
9851 (error "The current group does not support article moving"))
9852 ((and (eq action 'crosspost)
9853 (not (gnus-check-backend-function
9854 'request-replace-article gnus-newsgroup-name)))
9855 (error "The current group does not support article editing")))
9856 (let ((articles (gnus-summary-work-articles n))
9857 (prefix (if (gnus-check-backend-function
9858 'request-move-article gnus-newsgroup-name)
9859 (funcall gnus-move-group-prefix-function
9860 gnus-newsgroup-name)
9862 (names '((move "Move" "Moving")
9863 (copy "Copy" "Copying")
9864 (crosspost "Crosspost" "Crossposting")))
9865 (copy-buf (save-excursion
9866 (nnheader-set-temp-buffer " *copy article*")))
9867 art-group to-method new-xref article to-groups
9868 articles-to-update-marks encoded)
9869 (unless (assq action names)
9870 (error "Unknown action %s" action))
9871 ;; Read the newsgroup name.
9872 (when (and (not to-newsgroup)
9873 (not select-method))
9874 (if (and gnus-move-split-methods
9876 (and (memq gnus-current-article articles)
9877 (gnus-buffer-live-p gnus-original-article-buffer))))
9878 ;; When `gnus-move-split-methods' is non-nil, we have to
9879 ;; select an article to give `gnus-read-move-group-name' an
9880 ;; opportunity to suggest an appropriate default. However,
9881 ;; we needn't render or mark the article.
9882 (let ((gnus-display-mime-function nil)
9883 (gnus-article-prepare-hook nil)
9884 (gnus-mark-article-hook nil))
9885 (gnus-summary-select-article nil nil nil (car articles))))
9886 (setq to-newsgroup (gnus-read-move-group-name
9887 (cadr (assq action names))
9889 (intern (format "gnus-current-%s-group" action)))
9891 encoded to-newsgroup
9892 to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
9893 (set (intern (format "gnus-current-%s-group" action))
9894 (mm-decode-coding-string
9896 (gnus-group-name-charset to-method to-newsgroup))))
9898 (setq to-method (or select-method
9899 (gnus-server-to-method
9900 (gnus-group-method to-newsgroup)))))
9904 (mm-encode-coding-string
9906 (gnus-group-name-charset to-method to-newsgroup)))))
9907 ;; Check the method we are to move this article to...
9908 (unless (gnus-check-backend-function
9909 'request-accept-article (car to-method))
9910 (error "%s does not support article copying" (car to-method)))
9911 (unless (gnus-check-server to-method)
9912 (error "Can't open server %s" (car to-method)))
9913 (gnus-message 6 "%s to %s: %s..."
9914 (caddr (assq action names))
9915 (or (car select-method)
9916 (gnus-group-decoded-name to-newsgroup))
9919 (setq article (pop articles))
9920 ;; Set any marks that may have changed in the summary buffer.
9921 (when gnus-preserve-marks
9922 (gnus-summary-push-marks-to-backend article))
9926 ;; Move the article.
9928 ;; Remove this article from future suppression.
9929 (gnus-dup-unsuppress-article article)
9930 (let* ((from-method (gnus-find-method-for-group
9931 gnus-newsgroup-name))
9932 (to-method (or select-method
9933 (gnus-find-method-for-group to-newsgroup)))
9934 (move-is-internal (gnus-server-equal from-method to-method)))
9935 (gnus-request-move-article
9936 article ; Article to move
9937 gnus-newsgroup-name ; From newsgroup
9938 (nth 1 (gnus-find-method-for-group
9939 gnus-newsgroup-name)) ; Server
9940 (list 'gnus-request-accept-article
9941 to-newsgroup (list 'quote select-method)
9942 (not articles) t) ; Accept form
9943 (not articles) ; Only save nov last time
9944 (and move-is-internal
9945 to-newsgroup ; Not respooling
9946 ; Is this move internal?
9947 (gnus-group-real-name to-newsgroup)))))
9948 ;; Copy the article.
9950 (with-current-buffer copy-buf
9951 (when (gnus-request-article-this-buffer article
9952 gnus-newsgroup-name)
9954 (nnheader-narrow-to-headers)
9955 (dolist (hdr gnus-copy-article-ignored-headers)
9956 (message-remove-header hdr t)))
9957 (gnus-request-accept-article
9958 to-newsgroup select-method (not articles) t))))
9959 ;; Crosspost the article.
9960 ((eq action 'crosspost)
9961 (let ((xref (message-tokenize-header
9962 (mail-header-xref (gnus-summary-article-header
9965 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9966 ":" (number-to-string article)))
9968 (setq xref (list (system-name))))
9971 (mapconcat 'identity
9972 (delete "Xref:" (delete new-xref xref))
9975 (with-current-buffer copy-buf
9976 ;; First put the article in the destination group.
9977 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9978 (when (consp (setq art-group
9979 (gnus-request-accept-article
9980 to-newsgroup select-method (not articles)
9982 (setq new-xref (concat new-xref " " (car art-group)
9984 (number-to-string (cdr art-group))))
9985 ;; Now we have the new Xrefs header, so we insert
9986 ;; it and replace the new article.
9987 (nnheader-replace-header "Xref" new-xref)
9988 (gnus-request-replace-article
9989 (cdr art-group) to-newsgroup (current-buffer) t)
9993 (gnus-message 1 "Couldn't %s article %s: %s"
9994 (cadr (assq action names)) article
9995 (nnheader-get-report (car to-method))))
9996 ((eq art-group 'junk)
9997 (when (eq action 'move)
9998 (gnus-summary-mark-article article gnus-canceled-mark)
9999 (gnus-message 4 "Deleted article %s" article)
10000 ;; run the delete hook
10001 (run-hook-with-args 'gnus-summary-article-delete-hook
10004 (assoc article (gnus-data-list nil)))
10005 gnus-newsgroup-name nil
10008 (let* ((pto-group (gnus-group-prefixed-name
10009 (car art-group) to-method))
10010 (info (gnus-get-info pto-group))
10011 (to-group (gnus-info-group info))
10013 ;; Update the group that has been moved to.
10015 (memq action '(move copy)))
10016 (unless (member to-group to-groups)
10017 (push to-group to-groups))
10019 (when (and (not (memq article gnus-newsgroup-unreads))
10021 (push 'read to-marks)
10022 (gnus-info-set-read
10023 info (gnus-add-to-range (gnus-info-read info)
10024 (list (cdr art-group)))))
10026 ;; See whether the article is to be put in the cache.
10027 (let* ((expirable (gnus-group-auto-expirable-p to-group))
10028 (marks (if expirable
10029 gnus-article-mark-lists
10030 (delete '(expirable . expire)
10032 gnus-article-mark-lists))))
10033 (to-article (cdr art-group)))
10035 ;; Enter the article into the cache in the new group,
10036 ;; if that is required.
10037 (when (and to-article
10039 (gnus-cache-possibly-enter-article
10040 to-group to-article
10041 (memq article gnus-newsgroup-marked)
10042 (memq article gnus-newsgroup-dormant)
10043 (memq article gnus-newsgroup-unreads)))
10045 (when (and gnus-preserve-marks
10047 ;; Copy any marks over to the new group.
10048 (when (and (equal to-group gnus-newsgroup-name)
10049 (not (memq article gnus-newsgroup-unreads)))
10050 ;; Mark this article as read in this group.
10051 (push (cons to-article gnus-read-mark)
10052 gnus-newsgroup-reads)
10053 ;; Increase the active status of this group.
10054 (setcdr (gnus-active to-group) to-article)
10055 (setcdr gnus-newsgroup-active to-article))
10058 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10059 (when (memq article (symbol-value
10060 (intern (format "gnus-newsgroup-%s"
10062 (push (cdar marks) to-marks)
10063 ;; If the other group is the same as this group,
10064 ;; then we have to add the mark to the list.
10065 (when (equal to-group gnus-newsgroup-name)
10066 (set (intern (format "gnus-newsgroup-%s"
10070 (intern (format "gnus-newsgroup-%s"
10072 ;; Copy the marks to other group.
10073 (gnus-add-marked-articles
10074 to-group (cdar marks) (list to-article) info)))
10075 (setq marks (cdr marks)))
10077 (when (and expirable
10078 gnus-mark-copied-or-moved-articles-as-expirable
10079 (not (memq 'expire to-marks)))
10080 ;; Mark this article as expirable.
10081 (push 'expire to-marks)
10082 (when (equal to-group gnus-newsgroup-name)
10083 (push to-article gnus-newsgroup-expirable))
10084 ;; Copy the expirable mark to other group.
10085 (gnus-add-marked-articles
10086 to-group 'expire (list to-article) info))
10088 (when (and to-marks
10089 (gnus-method-option-p
10090 (gnus-find-method-for-group to-group)
10092 (gnus-request-set-mark
10093 to-group (list (list (list to-article) 'add to-marks)))))
10095 (gnus-dribble-enter
10096 (concat "(gnus-group-set-info '"
10097 (gnus-prin1-to-string (gnus-get-info to-group))
10099 (concat "^(gnus-group-set-info '(\""
10100 (regexp-quote to-group) "\""))))
10102 ;; Update the Xref header in this article to point to
10103 ;; the new crossposted article we have just created.
10104 (when (eq action 'crosspost)
10105 (with-current-buffer copy-buf
10106 (gnus-request-article-this-buffer article gnus-newsgroup-name)
10107 (nnheader-replace-header "Xref" new-xref)
10108 (gnus-request-replace-article
10109 article gnus-newsgroup-name (current-buffer) t)))
10111 ;; run the move/copy/crosspost/respool hook
10112 (run-hook-with-args 'gnus-summary-article-move-hook
10115 (assoc article (gnus-data-list nil)))
10116 gnus-newsgroup-name
10120 ;;;!!!Why is this necessary?
10121 (set-buffer gnus-summary-buffer)
10123 (when (eq action 'move)
10125 (gnus-summary-goto-subject article)
10126 (gnus-summary-mark-article article gnus-canceled-mark)))))
10127 (push article articles-to-update-marks))
10130 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
10131 ;; Re-activate all groups that have been moved to.
10132 (with-current-buffer gnus-group-buffer
10133 (let ((gnus-group-marked to-groups))
10134 (gnus-group-get-new-news-this-group nil t)))
10136 (gnus-kill-buffer copy-buf)
10137 (gnus-summary-position-point)
10138 (gnus-set-mode-line 'summary)))
10140 (defun gnus-summary-push-marks-to-backend (article)
10143 (marks gnus-article-mark-lists))
10144 (unless (memq article gnus-newsgroup-unreads)
10147 (if (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10148 (memq article (symbol-value
10149 (intern (format "gnus-newsgroup-%s"
10151 (push (cdar marks) set)
10152 (push (cdar marks) del))
10154 (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)
10155 ((,article) del ,del)))))
10157 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
10158 "Copy the current article to some other group.
10159 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
10160 When called interactively, if TO-NEWSGROUP is nil, use the value of
10161 the variable `gnus-move-split-methods' for finding a default target
10163 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
10164 re-spool using this method."
10166 (gnus-summary-move-article n to-newsgroup select-method 'copy))
10168 (defun gnus-summary-crosspost-article (&optional n)
10169 "Crosspost the current article to some other group."
10171 (gnus-summary-move-article n nil nil 'crosspost))
10173 (defcustom gnus-summary-respool-default-method nil
10174 "Default method type for respooling an article.
10175 If nil, use to the current newsgroup method."
10177 :group 'gnus-summary-mail)
10179 (defun gnus-summary-respool-article (&optional n method)
10180 "Respool the current article.
10181 The article will be squeezed through the mail spooling process again,
10182 which means that it will be put in some mail newsgroup or other
10183 depending on `nnmail-split-methods'.
10184 If N is a positive number, respool the N next articles.
10185 If N is a negative number, respool the N previous articles.
10186 If N is nil and any articles have been marked with the process mark,
10187 respool those articles instead.
10189 Respooling can be done both from mail groups and \"real\" newsgroups.
10190 In the former case, the articles in question will be moved from the
10191 current group into whatever groups they are destined to. In the
10192 latter case, they will be copied into the relevant groups."
10194 (list current-prefix-arg
10195 (let* ((methods (mapcar #'car (gnus-methods-using 'respool)))
10197 (symbol-name (or gnus-summary-respool-default-method
10198 (car (gnus-find-method-for-group
10199 gnus-newsgroup-name)))))
10201 (gnus-completing-read
10202 "Backend to use when respooling"
10203 methods t nil 'gnus-mail-method-history methname))
10206 ((zerop (length (setq ms (gnus-servers-using-backend
10207 (intern method)))))
10208 (list (intern method) ""))
10212 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
10213 (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
10216 (error "No method given for respooling"))
10217 (if (assoc (symbol-name
10218 (car (gnus-find-method-for-group gnus-newsgroup-name)))
10219 (gnus-methods-using 'respool))
10220 (gnus-summary-move-article n nil method)
10221 (gnus-summary-copy-article n nil method)))
10223 (defun gnus-summary-import-article (file &optional edit)
10224 "Import an arbitrary file into a mail newsgroup."
10225 (interactive "fImport file: \nP")
10226 (let ((group gnus-newsgroup-name)
10227 (now (current-time))
10228 atts lines group-art)
10229 (unless (gnus-check-backend-function 'request-accept-article group)
10230 (error "%s does not support article importing" group))
10231 (or (file-readable-p file)
10232 (not (file-regular-p file))
10233 (error "Can't read %s" file))
10234 (with-current-buffer (gnus-get-buffer-create " *import file*")
10236 (nnheader-insert-file-contents file)
10237 (goto-char (point-min))
10238 (if (nnheader-article-p)
10240 (goto-char (point-min))
10241 (search-forward "\n\n" nil t)
10242 (narrow-to-region (point-min) (1- (point)))
10243 (goto-char (point-min))
10244 (unless (re-search-forward "^date:" nil t)
10245 (goto-char (point-max))
10246 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
10247 ;; This doesn't look like an article, so we fudge some headers.
10248 (setq atts (file-attributes file)
10249 lines (count-lines (point-min) (point-max)))
10250 (insert "From: " (read-string "From: ") "\n"
10251 "Subject: " (read-string "Subject: ") "\n"
10252 "Date: " (message-make-date (nth 5 atts)) "\n"
10253 "Message-ID: " (message-make-message-id) "\n"
10254 "Lines: " (int-to-string lines) "\n"
10255 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
10256 (setq group-art (gnus-request-accept-article group nil t))
10257 (kill-buffer (current-buffer)))
10258 (setq gnus-newsgroup-active (gnus-activate-group group))
10260 (gnus-summary-goto-article (cdr group-art) nil t)
10262 (gnus-summary-edit-article))))
10264 (defun gnus-summary-create-article ()
10265 "Create an article in a mail newsgroup."
10267 (let ((group gnus-newsgroup-name)
10268 (now (current-time))
10270 (unless (gnus-check-backend-function 'request-accept-article group)
10271 (error "%s does not support article importing" group))
10272 (with-current-buffer (gnus-get-buffer-create " *import file*")
10274 (goto-char (point-min))
10275 ;; This doesn't look like an article, so we fudge some headers.
10276 (insert "From: " (read-string "From: ") "\n"
10277 "Subject: " (read-string "Subject: ") "\n"
10278 "Date: " (message-make-date now) "\n"
10279 "Message-ID: " (message-make-message-id) "\n")
10280 (setq group-art (gnus-request-accept-article group nil t))
10281 (kill-buffer (current-buffer)))
10282 (setq gnus-newsgroup-active (gnus-activate-group group))
10284 (gnus-summary-goto-article (cdr group-art) nil t)
10285 (gnus-summary-edit-article)))
10287 (defun gnus-summary-article-posted-p ()
10288 "Say whether the current (mail) article is available from news as well.
10289 This will be the case if the article has both been mailed and posted."
10291 (let ((id (mail-header-references (gnus-summary-article-header)))
10292 (gnus-override-method (car (gnus-refer-article-methods))))
10293 (if (gnus-request-head id "")
10294 (gnus-message 2 "The current message was found on %s"
10295 gnus-override-method)
10296 (gnus-message 2 "The current message couldn't be found on %s"
10297 gnus-override-method)
10300 (defun gnus-summary-expire-articles (&optional now)
10301 "Expire all articles that are marked as expirable in the current group."
10303 (when (and (not gnus-group-is-exiting-without-update-p)
10304 (gnus-check-backend-function
10305 'request-expire-articles gnus-newsgroup-name))
10306 ;; This backend supports expiry.
10307 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
10308 (expirable (if total
10310 ;; We need to update the info for
10311 ;; this group for `gnus-list-of-read-articles'
10312 ;; to give us the right answer.
10313 (gnus-run-hooks 'gnus-exit-group-hook)
10314 (gnus-summary-update-info)
10315 (gnus-list-of-read-articles gnus-newsgroup-name))
10316 (setq gnus-newsgroup-expirable
10317 (sort gnus-newsgroup-expirable '<))))
10318 (expiry-wait (if now 'immediate
10319 (gnus-group-find-parameter
10320 gnus-newsgroup-name 'expiry-wait)))
10321 (nnmail-expiry-target
10322 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
10323 nnmail-expiry-target))
10326 ;; There are expirable articles in this group, so we run them
10327 ;; through the expiry process.
10328 (gnus-message 6 "Expiring articles...")
10329 (when (gnus-check-group gnus-newsgroup-name)
10330 ;; The list of articles that weren't expired is returned.
10333 (let ((nnmail-expiry-wait-function nil)
10334 (nnmail-expiry-wait expiry-wait))
10335 (setq es (gnus-request-expire-articles
10336 expirable gnus-newsgroup-name)))
10337 (setq es (gnus-request-expire-articles
10338 expirable gnus-newsgroup-name)))
10340 (setq gnus-newsgroup-expirable es))
10341 ;; We go through the old list of expirable, and mark all
10342 ;; really expired articles as nonexistent.
10343 (unless (eq es expirable) ;If nothing was expired, we don't mark.
10344 (let ((gnus-use-cache nil))
10345 (dolist (article expirable)
10346 (when (and (not (memq article es))
10347 (gnus-data-find article))
10348 (gnus-summary-mark-article article gnus-canceled-mark)
10349 (run-hook-with-args 'gnus-summary-article-expire-hook
10352 (assoc article (gnus-data-list nil)))
10353 gnus-newsgroup-name
10356 (gnus-message 6 "Expiring articles...done")))))
10358 (defun gnus-summary-expire-articles-now ()
10359 "Expunge all expirable articles in the current group.
10360 This means that *all* articles that are marked as expirable will be
10361 deleted forever, right now."
10363 (or gnus-expert-user
10365 "Are you really, really sure you want to delete all expirable messages? ")
10367 (gnus-summary-expire-articles t))
10369 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10370 (defun gnus-summary-delete-article (&optional n)
10371 "Delete the N next (mail) articles.
10372 This command actually deletes articles. This is not a marking
10373 command. The article will disappear forever from your life, never to
10376 If N is negative, delete backwards.
10377 If N is nil and articles have been marked with the process mark,
10378 delete these instead.
10380 If `gnus-novice-user' is non-nil you will be asked for
10381 confirmation before the articles are deleted."
10383 (unless (gnus-check-backend-function 'request-expire-articles
10384 gnus-newsgroup-name)
10385 (error "The current newsgroup does not support article deletion"))
10386 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
10387 (error "Couldn't open server"))
10388 ;; Compute the list of articles to delete.
10389 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
10390 (nnmail-expiry-target 'delete)
10392 (if (and gnus-novice-user
10393 (not (gnus-yes-or-no-p
10394 (format "Do you really want to delete %s forever? "
10395 (if (> (length articles) 1)
10396 (format "these %s articles" (length articles))
10397 "this article")))))
10399 ;; Delete the articles.
10400 (setq not-deleted (gnus-request-expire-articles
10401 articles gnus-newsgroup-name 'force))
10404 (gnus-summary-remove-process-mark (car articles))
10405 ;; The backend might not have been able to delete the article
10407 (unless (memq (car articles) not-deleted)
10408 (gnus-summary-mark-article (car articles) gnus-canceled-mark)
10409 (let* ((article (car articles))
10410 (ghead (gnus-data-header
10411 (assoc article (gnus-data-list nil)))))
10412 (run-hook-with-args 'gnus-summary-article-delete-hook
10413 'delete ghead gnus-newsgroup-name nil
10415 (setq articles (cdr articles))))
10417 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10418 (gnus-summary-position-point)
10419 (gnus-set-mode-line 'summary)
10422 (defun gnus-summary-edit-article (&optional arg)
10423 "Edit the current article.
10424 This will have permanent effect only in mail groups.
10425 If ARG is nil, edit the decoded articles.
10426 If ARG is 1, edit the raw articles.
10427 If ARG is 2, edit the raw articles even in read-only groups.
10428 If ARG is 3, edit the articles with the current handles.
10429 Otherwise, allow editing of articles even in read-only
10432 (let (force raw current-handles)
10441 (setq current-handles
10442 (and (gnus-buffer-live-p gnus-article-buffer)
10443 (with-current-buffer gnus-article-buffer
10445 gnus-article-mime-handles
10446 (setq gnus-article-mime-handles nil))))))
10449 (when (and raw (not force)
10450 (member gnus-newsgroup-name '("nndraft:delayed"
10453 (error "Can't edit the raw article in group %s"
10454 gnus-newsgroup-name))
10455 (with-current-buffer gnus-summary-buffer
10456 (let ((mail-parse-charset gnus-newsgroup-charset)
10457 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
10458 (gnus-set-global-variables)
10459 (when (and (not force)
10460 (gnus-group-read-only-p))
10461 (error "The current newsgroup does not support article editing"))
10462 (gnus-summary-show-article t)
10463 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
10464 (with-current-buffer gnus-article-buffer
10465 (mm-enable-multibyte)))
10466 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10468 (gnus-article-edit-article
10471 (let ((mbl mml-buffer-list))
10472 (setq mml-buffer-list nil)
10473 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10474 (mime-to-mml ,'current-handles))
10475 (let ((mbl1 mml-buffer-list))
10476 (setq mml-buffer-list mbl)
10477 (set (make-local-variable 'mml-buffer-list) mbl1))
10478 (gnus-make-local-hook 'kill-buffer-hook)
10479 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10480 `(lambda (no-highlight)
10481 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10482 (message-options message-options)
10483 (message-options-set-recipient)
10484 (mail-parse-ignored-charsets
10485 ',gnus-newsgroup-ignored-charsets)
10486 (rfc2047-header-encoding-alist
10487 ',(let ((charset (gnus-group-name-charset
10488 (gnus-find-method-for-group
10489 gnus-newsgroup-name)
10490 gnus-newsgroup-name)))
10491 (append (list (cons "Newsgroups" charset)
10492 (cons "Followup-To" charset)
10493 (cons "Xref" charset))
10494 rfc2047-header-encoding-alist))))
10495 ,(if (not raw) '(progn
10497 (mml-destroy-buffers)
10498 (remove-hook 'kill-buffer-hook
10499 'mml-destroy-buffers t)
10500 (kill-local-variable 'mml-buffer-list)))
10501 (gnus-summary-edit-article-done
10502 ,(or (mail-header-references gnus-current-headers) "")
10503 ,(gnus-group-read-only-p)
10504 ,gnus-summary-buffer no-highlight))))))))
10506 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10508 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10510 "Make edits to the current article permanent."
10513 ;; The buffer restriction contains the entire article if it exists.
10514 (when (article-goto-body)
10515 (let ((lines (count-lines (point) (point-max)))
10516 (length (- (point-max) (point)))
10517 (case-fold-search t)
10518 (body (copy-marker (point))))
10519 (goto-char (point-min))
10520 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10521 (delete-region (match-beginning 1) (match-end 1))
10522 (insert (number-to-string length)))
10523 (goto-char (point-min))
10524 (when (re-search-forward
10525 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10526 (delete-region (match-beginning 1) (match-end 1))
10527 (insert (number-to-string length)))
10528 (goto-char (point-min))
10529 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10530 (delete-region (match-beginning 1) (match-end 1))
10531 (insert (number-to-string lines))))))
10532 ;; Replace the article.
10533 (let ((buf (current-buffer))
10534 (article (cdr gnus-article-current))
10537 (insert-buffer-substring buf)
10538 (if (and (not read-only)
10539 (not (setq replace-result
10540 (gnus-request-replace-article
10541 article (car gnus-article-current)
10542 (current-buffer) t))))
10543 (error "Couldn't replace article")
10544 ;; If we got a number back, then that's the new article number
10545 ;; for this article. Otherwise, the article number didn't change.
10546 (when (numberp replace-result)
10547 (with-current-buffer gnus-summary-buffer
10548 (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
10549 (gnus-summary-limit gnus-newsgroup-limit)
10550 (setq article replace-result)
10551 (gnus-summary-goto-subject article t)))
10552 ;; Update the summary buffer.
10553 (if (and references
10554 (equal (message-tokenize-header references " ")
10555 (message-tokenize-header
10556 (or (message-fetch-field "references") "") " ")))
10557 ;; We only have to update this line.
10560 (message-narrow-to-head)
10561 (let ((head (buffer-substring-no-properties
10562 (point-min) (point-max)))
10565 (insert (format "211 %d Article retrieved.\n" article))
10568 (let ((nntp-server-buffer (current-buffer)))
10569 (setq header (car (gnus-get-newsgroup-headers nil t))))
10570 (with-current-buffer gnus-summary-buffer
10571 (gnus-data-set-header (gnus-data-find article) header)
10572 (gnus-summary-update-article-line article header)
10573 (if (gnus-summary-goto-subject article nil t)
10574 (gnus-summary-update-secondary-mark article)))))))
10576 (set-buffer (or buffer gnus-summary-buffer))
10577 (gnus-summary-update-article article)
10578 (if (gnus-summary-goto-subject article nil t)
10579 (gnus-summary-update-secondary-mark article)))
10580 ;; Prettify the article buffer again.
10581 (unless no-highlight
10582 (with-current-buffer gnus-article-buffer
10583 ;;!!! Fix this -- article should be rehighlighted.
10584 ;;(gnus-run-hooks 'gnus-article-display-hook)
10585 (set-buffer gnus-original-article-buffer)
10586 (gnus-request-article
10587 article (car gnus-article-current) (current-buffer))))
10588 ;; Prettify the summary buffer line.
10589 (when (gnus-visual-p 'summary-highlight 'highlight)
10590 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10592 (defun gnus-summary-edit-wash (key)
10593 "Perform editing command KEY in the article buffer."
10597 (message "%s" (concat (this-command-keys) "- "))
10600 (gnus-summary-edit-article)
10601 (execute-kbd-macro (concat (this-command-keys) key))
10602 (gnus-article-edit-done))
10606 (defun gnus-summary-respool-query (&optional silent trace)
10607 "Query where the respool algorithm would put this article."
10609 (let (gnus-mark-article-hook)
10610 (gnus-summary-select-article)
10611 (with-current-buffer gnus-original-article-buffer
10612 (let ((groups (nnmail-article-group 'identity trace)))
10615 (message "This message would go to %s"
10616 (mapconcat 'car groups ", "))
10617 (message "This message would go to no groups"))
10620 (defun gnus-summary-respool-trace ()
10621 "Trace where the respool algorithm would put this article.
10622 Display a buffer showing all fancy splitting patterns which matched."
10624 (gnus-summary-respool-query nil t))
10626 ;; Summary marking commands.
10628 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10629 "Mark articles which has the same subject as read, and then select the next.
10630 If UNMARK is positive, remove any kind of mark.
10631 If UNMARK is negative, tick articles."
10634 (setq unmark (prefix-numeric-value unmark)))
10636 (gnus-summary-mark-same-subject
10637 (gnus-summary-article-subject) unmark)))
10638 ;; Select next unread article. If auto-select-same mode, should
10639 ;; select the first unread article.
10640 (gnus-summary-next-article t (and gnus-auto-select-same
10641 (gnus-summary-article-subject)))
10642 (gnus-message 7 "%d article%s marked as %s"
10643 count (if (= count 1) " is" "s are")
10644 (if unmark "unread" "read"))))
10646 (defun gnus-summary-kill-same-subject (&optional unmark)
10647 "Mark articles which has the same subject as read.
10648 If UNMARK is positive, remove any kind of mark.
10649 If UNMARK is negative, tick articles."
10652 (setq unmark (prefix-numeric-value unmark)))
10654 (gnus-summary-mark-same-subject
10655 (gnus-summary-article-subject) unmark)))
10656 ;; If marked as read, go to next unread subject.
10657 (when (null unmark)
10658 ;; Go to next unread subject.
10659 (gnus-summary-next-subject 1 t))
10660 (gnus-message 7 "%d articles are marked as %s"
10661 count (if unmark "unread" "read"))))
10663 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10664 "Mark articles with same SUBJECT as read, and return marked number.
10665 If optional argument UNMARK is positive, remove any kinds of marks.
10666 If optional argument UNMARK is negative, mark articles as unread instead."
10670 ((null unmark) ; Mark as read.
10673 (gnus-summary-mark-article-as-read gnus-killed-mark)
10674 (gnus-summary-show-thread) t)
10675 (gnus-summary-find-subject subject))
10676 (setq count (1+ count))))
10677 ((> unmark 0) ; Tick.
10680 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10681 (gnus-summary-show-thread) t)
10682 (gnus-summary-find-subject subject))
10683 (setq count (1+ count))))
10684 (t ; Mark as unread.
10687 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10688 (gnus-summary-show-thread) t)
10689 (gnus-summary-find-subject subject))
10690 (setq count (1+ count)))))
10691 (gnus-set-mode-line 'summary)
10692 ;; Return the number of marked articles.
10695 (defun gnus-summary-mark-as-processable (n &optional unmark)
10696 "Set the process mark on the next N articles.
10697 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10698 the process mark instead. The difference between N and the actual
10699 number of articles marked is returned."
10701 (if (and (null n) (gnus-region-active-p))
10702 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10703 (setq n (prefix-numeric-value n))
10704 (let ((backward (< n 0))
10709 (gnus-summary-remove-process-mark
10710 (gnus-summary-article-number))
10711 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10712 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10715 (gnus-message 7 "No more articles"))
10716 (gnus-summary-recenter)
10717 (gnus-summary-position-point)
10720 (defun gnus-summary-unmark-as-processable (n)
10721 "Remove the process mark from the next N articles.
10722 If N is negative, unmark backward instead. The difference between N and
10723 the actual number of articles unmarked is returned."
10725 (gnus-summary-mark-as-processable n t))
10727 (defun gnus-summary-unmark-all-processable ()
10728 "Remove the process mark from all articles."
10731 (while gnus-newsgroup-processable
10732 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10733 (gnus-summary-position-point))
10735 (defun gnus-summary-add-mark (article type)
10736 "Mark ARTICLE with a mark of TYPE."
10737 (let ((vtype (car (assq type gnus-article-mark-lists)))
10740 (error "No such mark type: %s" type)
10741 (setq var (intern (format "gnus-newsgroup-%s" type)))
10742 (set var (cons article (symbol-value var)))
10743 (if (memq type '(processable cached replied forwarded recent saved))
10744 (gnus-summary-update-secondary-mark article)
10745 ;;; !!! This is bogus. We should find out what primary
10746 ;;; !!! mark we want to set.
10747 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10749 (defun gnus-summary-mark-as-expirable (n)
10750 "Mark N articles forward as expirable.
10751 If N is negative, mark backward instead. The difference between N and
10752 the actual number of articles marked is returned."
10754 (gnus-summary-mark-forward n gnus-expirable-mark))
10756 (defun gnus-summary-mark-as-spam (n)
10757 "Mark N articles forward as spam.
10758 If N is negative, mark backward instead. The difference between N and
10759 the actual number of articles marked is returned."
10761 (gnus-summary-mark-forward n gnus-spam-mark))
10763 (defun gnus-summary-mark-article-as-replied (article)
10764 "Mark ARTICLE as replied to and update the summary line.
10765 ARTICLE can also be a list of articles."
10766 (interactive (list (gnus-summary-article-number)))
10767 (let ((articles (if (listp article) article (list article))))
10768 (dolist (article articles)
10769 (unless (numberp article)
10770 (error "%s is not a number" article))
10771 (push article gnus-newsgroup-replied)
10772 (let ((inhibit-read-only t))
10773 (when (gnus-summary-goto-subject article nil t)
10774 (gnus-summary-update-secondary-mark article))))))
10776 (defun gnus-summary-mark-article-as-forwarded (article)
10777 "Mark ARTICLE as forwarded and update the summary line.
10778 ARTICLE can also be a list of articles."
10779 (let ((articles (if (listp article) article (list article))))
10780 (dolist (article articles)
10781 (push article gnus-newsgroup-forwarded)
10782 (let ((inhibit-read-only t))
10783 (when (gnus-summary-goto-subject article nil t)
10784 (gnus-summary-update-secondary-mark article))))))
10786 (defun gnus-summary-set-bookmark (article)
10787 "Set a bookmark in current article."
10788 (interactive (list (gnus-summary-article-number)))
10789 (when (or (not (get-buffer gnus-article-buffer))
10790 (not gnus-current-article)
10791 (not gnus-article-current)
10792 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10793 (error "No current article selected"))
10794 ;; Remove old bookmark, if one exists.
10795 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10796 ;; Set the new bookmark, which is on the form
10797 ;; (article-number . line-number-in-body).
10800 (with-current-buffer gnus-article-buffer
10804 (article-goto-body)
10807 gnus-newsgroup-bookmarks)
10808 (gnus-message 6 "A bookmark has been added to the current article."))
10810 (defun gnus-summary-remove-bookmark (article)
10811 "Remove the bookmark from the current article."
10812 (interactive (list (gnus-summary-article-number)))
10813 ;; Remove old bookmark, if one exists.
10814 (if (not (assq article gnus-newsgroup-bookmarks))
10815 (gnus-message 6 "No bookmark in current article.")
10816 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10817 (gnus-message 6 "Removed bookmark.")))
10819 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10820 (defun gnus-summary-mark-as-dormant (n)
10821 "Mark N articles forward as dormant.
10822 If N is negative, mark backward instead. The difference between N and
10823 the actual number of articles marked is returned."
10825 (gnus-summary-mark-forward n gnus-dormant-mark))
10827 (defun gnus-summary-set-process-mark (article)
10828 "Set the process mark on ARTICLE and update the summary line."
10829 (setq gnus-newsgroup-processable
10831 (delq article gnus-newsgroup-processable)))
10832 (when (gnus-summary-goto-subject article)
10833 (gnus-summary-show-thread)
10834 (gnus-summary-goto-subject article)
10835 (gnus-summary-update-secondary-mark article)))
10837 (defun gnus-summary-remove-process-mark (&rest articles)
10838 "Remove the process mark from ARTICLES and update the summary line."
10839 (dolist (article articles)
10840 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10841 (when (gnus-summary-goto-subject article)
10842 (gnus-summary-show-thread)
10843 (gnus-summary-goto-subject article)
10844 (gnus-summary-update-secondary-mark article)))
10847 (defun gnus-summary-set-saved-mark (article)
10848 "Set the process mark on ARTICLE and update the summary line."
10849 (push article gnus-newsgroup-saved)
10850 (when (gnus-summary-goto-subject article)
10851 (gnus-summary-update-secondary-mark article)))
10853 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10854 "Mark N articles as read forwards.
10855 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10856 The difference between N and the actual number of articles marked is
10858 If NO-EXPIRE, auto-expiry will be inhibited."
10860 (gnus-summary-show-thread)
10861 (let ((backward (< n 0))
10862 (gnus-summary-goto-unread
10863 (and gnus-summary-goto-unread
10864 (not (eq gnus-summary-goto-unread 'never))
10865 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10866 gnus-ticked-mark gnus-dormant-mark)))))
10868 (mark (or mark gnus-del-mark)))
10869 (while (and (> n 0)
10870 (gnus-summary-mark-article nil mark no-expire)
10871 (zerop (gnus-summary-next-subject
10873 (and gnus-summary-goto-unread
10874 (not (eq gnus-summary-goto-unread 'never)))
10878 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10879 (gnus-summary-recenter)
10880 (gnus-summary-position-point)
10881 (gnus-set-mode-line 'summary)
10884 (defun gnus-summary-mark-article-as-read (mark)
10885 "Mark the current article quickly as read with MARK."
10886 (let ((article (gnus-summary-article-number)))
10887 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10888 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10889 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10890 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10891 (push (cons article mark) gnus-newsgroup-reads)
10892 ;; Possibly remove from cache, if that is used.
10893 (when gnus-use-cache
10894 (gnus-cache-enter-remove-article article))
10895 ;; Allow the backend to change the mark.
10896 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10897 ;; Check for auto-expiry.
10898 (when (and gnus-newsgroup-auto-expire
10899 (memq mark gnus-auto-expirable-marks))
10900 (setq mark gnus-expirable-mark)
10901 ;; Let the backend know about the mark change.
10902 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10903 (push article gnus-newsgroup-expirable))
10904 ;; Set the mark in the buffer.
10905 (gnus-summary-update-mark mark 'unread)
10908 (defun gnus-summary-mark-article-as-unread (mark)
10909 "Mark the current article quickly as unread with MARK."
10910 (let* ((article (gnus-summary-article-number))
10911 (old-mark (gnus-summary-article-mark article)))
10912 ;; Allow the backend to change the mark.
10913 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10914 (if (eq mark old-mark)
10918 (gnus-error 1 "Can't mark negative article numbers")
10920 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10921 (setq gnus-newsgroup-spam-marked
10922 (delq article gnus-newsgroup-spam-marked))
10923 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10924 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10925 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10926 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10927 (cond ((= mark gnus-ticked-mark)
10928 (setq gnus-newsgroup-marked
10929 (gnus-add-to-sorted-list gnus-newsgroup-marked
10931 ((= mark gnus-spam-mark)
10932 (setq gnus-newsgroup-spam-marked
10933 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10935 ((= mark gnus-dormant-mark)
10936 (setq gnus-newsgroup-dormant
10937 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10940 (setq gnus-newsgroup-unreads
10941 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10943 (gnus-alist-pull article gnus-newsgroup-reads)
10945 ;; See whether the article is to be put in the cache.
10946 (and gnus-use-cache
10947 (vectorp (gnus-summary-article-header article))
10949 (gnus-cache-possibly-enter-article
10950 gnus-newsgroup-name article
10951 (= mark gnus-ticked-mark)
10952 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10955 (gnus-summary-update-mark mark 'unread)
10958 (defun gnus-summary-mark-article (&optional article mark no-expire)
10959 "Mark ARTICLE with MARK. MARK can be any character.
10960 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10961 `??' (dormant) and `?E' (expirable).
10962 If MARK is nil, then the default character `?r' is used.
10963 If ARTICLE is nil, then the article on the current line will be
10965 If NO-EXPIRE, auto-expiry will be inhibited."
10966 ;; The mark might be a string.
10967 (when (stringp mark)
10968 (setq mark (aref mark 0)))
10969 ;; If no mark is given, then we check auto-expiring.
10971 (setq mark gnus-del-mark))
10972 (when (and (not no-expire)
10973 gnus-newsgroup-auto-expire
10974 (memq mark gnus-auto-expirable-marks))
10975 (setq mark gnus-expirable-mark))
10976 (let ((article (or article (gnus-summary-article-number)))
10977 (old-mark (gnus-summary-article-mark article)))
10978 ;; Allow the backend to change the mark.
10979 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10980 (if (eq mark old-mark)
10983 (error "No article on current line"))
10984 (if (not (if (or (= mark gnus-unread-mark)
10985 (= mark gnus-ticked-mark)
10986 (= mark gnus-spam-mark)
10987 (= mark gnus-dormant-mark))
10988 (gnus-mark-article-as-unread article mark)
10989 (gnus-mark-article-as-read article mark)))
10991 ;; See whether the article is to be put in the cache.
10992 (and gnus-use-cache
10993 (not (= mark gnus-canceled-mark))
10994 (vectorp (gnus-summary-article-header article))
10996 (gnus-cache-possibly-enter-article
10997 gnus-newsgroup-name article
10998 (= mark gnus-ticked-mark)
10999 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
11001 (when (gnus-summary-goto-subject article nil t)
11002 (let ((inhibit-read-only t))
11003 (gnus-summary-show-thread)
11005 (gnus-summary-update-mark mark 'unread)
11008 (defun gnus-summary-update-secondary-mark (article)
11009 "Update the secondary (read, process, cache) mark."
11010 (gnus-summary-update-mark
11011 (cond ((memq article gnus-newsgroup-processable)
11013 ((memq article gnus-newsgroup-cached)
11015 ((memq article gnus-newsgroup-replied)
11017 ((memq article gnus-newsgroup-forwarded)
11018 gnus-forwarded-mark)
11019 ((memq article gnus-newsgroup-saved)
11021 ((memq article gnus-newsgroup-unseen)
11025 (when (gnus-visual-p 'summary-highlight 'highlight)
11026 (gnus-summary-highlight-line)
11027 (gnus-run-hooks 'gnus-summary-update-hook))
11030 (defun gnus-summary-update-download-mark (article)
11031 "Update the download mark."
11032 (gnus-summary-update-mark
11033 (cond ((memq article gnus-newsgroup-undownloaded)
11034 gnus-undownloaded-mark)
11035 (gnus-newsgroup-agentized
11036 gnus-downloaded-mark)
11040 (gnus-summary-update-line t)
11043 (defun gnus-summary-update-mark (mark type)
11044 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
11045 (inhibit-read-only t))
11046 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
11048 (when (looking-at "\r")
11050 (when (<= (+ forward (point)) (point-max))
11051 ;; Go to the right position on the line.
11052 (goto-char (+ forward (point)))
11053 ;; Replace the old mark with the new mark.
11055 (mm-subst-char-in-string
11057 (buffer-substring (point) (1+ (point))))))
11058 (delete-region (point) (1+ (point)))
11059 (insert to-insert))
11060 ;; Optionally update the marks by some user rule.
11061 (when (eq type 'unread)
11062 (gnus-data-set-mark
11063 (gnus-data-find (gnus-summary-article-number)) mark)
11064 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
11066 (defun gnus-mark-article-as-read (article &optional mark)
11067 "Enter ARTICLE in the pertinent lists and remove it from others."
11068 ;; Make the article expirable.
11069 (let ((mark (or mark gnus-del-mark)))
11070 (setq gnus-newsgroup-expirable
11071 (if (= mark gnus-expirable-mark)
11072 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
11073 (delq article gnus-newsgroup-expirable)))
11074 ;; Remove from unread and marked lists.
11075 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11076 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
11077 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
11078 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
11079 (push (cons article mark) gnus-newsgroup-reads)
11080 ;; Possibly remove from cache, if that is used.
11081 (when gnus-use-cache
11082 (gnus-cache-enter-remove-article article))
11085 (defun gnus-mark-article-as-unread (article &optional mark)
11086 "Enter ARTICLE in the pertinent lists and remove it from others."
11087 (let ((mark (or mark gnus-ticked-mark)))
11090 (gnus-error 1 "Can't mark negative article numbers")
11092 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
11093 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
11094 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
11095 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
11096 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11098 ;; Unsuppress duplicates?
11099 (when gnus-suppress-duplicates
11100 (gnus-dup-unsuppress-article article))
11102 (cond ((= mark gnus-ticked-mark)
11103 (setq gnus-newsgroup-marked
11104 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
11105 ((= mark gnus-spam-mark)
11106 (setq gnus-newsgroup-spam-marked
11107 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
11109 ((= mark gnus-dormant-mark)
11110 (setq gnus-newsgroup-dormant
11111 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
11113 (setq gnus-newsgroup-unreads
11114 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
11115 (gnus-alist-pull article gnus-newsgroup-reads)
11118 (defun gnus-summary-tick-article-forward (n)
11119 "Tick N articles forwards.
11120 If N is negative, tick backwards instead.
11121 The difference between N and the number of articles ticked is returned."
11123 (gnus-summary-mark-forward n gnus-ticked-mark))
11125 (defun gnus-summary-tick-article-backward (n)
11126 "Tick N articles backwards.
11127 The difference between N and the number of articles ticked is returned."
11129 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
11131 (defun gnus-summary-tick-article (&optional article clear-mark)
11132 "Mark current article as unread.
11133 Optional 1st argument ARTICLE specifies article number to be marked as unread.
11134 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
11136 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
11137 gnus-ticked-mark)))
11139 (defun gnus-summary-mark-as-read-forward (n)
11140 "Mark N articles as read forwards.
11141 If N is negative, mark backwards instead.
11142 The difference between N and the actual number of articles marked is
11145 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
11147 (defun gnus-summary-mark-as-read-backward (n)
11148 "Mark the N articles as read backwards.
11149 The difference between N and the actual number of articles marked is
11152 (gnus-summary-mark-forward
11153 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
11155 (defun gnus-summary-mark-as-read (&optional article mark)
11156 "Mark current article as read.
11157 ARTICLE specifies the article to be marked as read.
11158 MARK specifies a string to be inserted at the beginning of the line."
11159 (gnus-summary-mark-article article mark))
11161 (defun gnus-summary-clear-mark-forward (n)
11162 "Clear marks from N articles forward.
11163 If N is negative, clear backward instead.
11164 The difference between N and the number of marks cleared is returned."
11166 (gnus-summary-mark-forward n gnus-unread-mark))
11168 (defun gnus-summary-clear-mark-backward (n)
11169 "Clear marks from N articles backward.
11170 The difference between N and the number of marks cleared is returned."
11172 (gnus-summary-mark-forward (- n) gnus-unread-mark))
11174 (defun gnus-summary-mark-unread-as-read ()
11175 "Intended to be used by `gnus-mark-article-hook'."
11176 (when (memq gnus-current-article gnus-newsgroup-unreads)
11177 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
11179 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
11180 "Intended to be used by `gnus-mark-article-hook'."
11181 (let ((mark (gnus-summary-article-mark)))
11182 (when (or (gnus-unread-mark-p mark)
11183 (gnus-read-mark-p mark))
11184 (gnus-summary-mark-article gnus-current-article
11185 (or new-mark gnus-read-mark)))))
11187 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
11188 "Intended to be used by `gnus-mark-article-hook'."
11189 (let ((mark (gnus-summary-article-mark)))
11190 (when (or (gnus-unread-mark-p mark)
11191 (gnus-read-mark-p mark))
11192 (gnus-summary-mark-article (gnus-summary-article-number)
11193 (or new-mark gnus-read-mark)))))
11195 (defun gnus-summary-mark-unread-as-ticked ()
11196 "Intended to be used by `gnus-mark-article-hook'."
11197 (when (memq gnus-current-article gnus-newsgroup-unreads)
11198 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
11200 (defun gnus-summary-mark-region-as-read (point mark all)
11201 "Mark all unread articles between point and mark as read.
11202 If given a prefix, mark all articles between point and mark as read,
11203 even ticked and dormant ones."
11204 (interactive "r\nP")
11208 (beginning-of-line)
11213 (memq (setq article (gnus-summary-article-number))
11214 gnus-newsgroup-unreads))
11215 (gnus-summary-mark-article article gnus-del-mark))
11217 (gnus-summary-find-next))))))
11219 (defun gnus-summary-mark-below (score mark)
11220 "Mark articles with score less than SCORE with MARK."
11221 (interactive "P\ncMark: ")
11222 (setq score (if score
11223 (prefix-numeric-value score)
11224 (or gnus-summary-default-score 0)))
11225 (with-current-buffer gnus-summary-buffer
11226 (goto-char (point-min))
11229 (and (< (gnus-summary-article-score) score)
11230 (gnus-summary-mark-article nil mark))
11231 (gnus-summary-find-next)))))
11233 (defun gnus-summary-kill-below (&optional score)
11234 "Mark articles with score below SCORE as read."
11236 (gnus-summary-mark-below score gnus-killed-mark))
11238 (defun gnus-summary-clear-above (&optional score)
11239 "Clear all marks from articles with score above SCORE."
11241 (gnus-summary-mark-above score gnus-unread-mark))
11243 (defun gnus-summary-tick-above (&optional score)
11244 "Tick all articles with score above SCORE."
11246 (gnus-summary-mark-above score gnus-ticked-mark))
11248 (defun gnus-summary-mark-above (score mark)
11249 "Mark articles with score over SCORE with MARK."
11250 (interactive "P\ncMark: ")
11251 (setq score (if score
11252 (prefix-numeric-value score)
11253 (or gnus-summary-default-score 0)))
11254 (with-current-buffer gnus-summary-buffer
11255 (goto-char (point-min))
11257 (when (> (gnus-summary-article-score) score)
11258 (gnus-summary-mark-article nil mark))
11260 (gnus-summary-find-next)))))
11262 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
11263 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
11264 (defun gnus-summary-limit-include-expunged (&optional no-error)
11265 "Display all the hidden articles that were expunged for low scores."
11267 (let ((inhibit-read-only t))
11268 (let ((scored gnus-newsgroup-scored)
11271 (unless (gnus-summary-article-header (caar scored))
11272 (and (setq h (gnus-number-to-header (caar scored)))
11273 (< (cdar scored) gnus-summary-expunge-below)
11275 (setq scored (cdr scored)))
11277 (when (not no-error)
11278 (error "No expunged articles hidden"))
11279 (goto-char (point-min))
11280 (push gnus-newsgroup-limit gnus-newsgroup-limits)
11281 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
11282 (dolist (x headers)
11283 (push (mail-header-number x) gnus-newsgroup-limit))
11284 (gnus-summary-prepare-unthreaded (nreverse headers))
11285 (goto-char (point-min))
11286 (gnus-summary-position-point)
11289 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
11290 "Mark all unread articles in this newsgroup as read.
11291 If prefix argument ALL is non-nil, ticked and dormant articles will
11292 also be marked as read.
11293 If QUIETLY is non-nil, no questions will be asked.
11295 If TO-HERE is non-nil, it should be a point in the buffer. All
11296 articles before (after, if REVERSE is set) this point will be marked
11299 Note that this function will only catch up the unread article
11300 in the current summary buffer limitation.
11302 The number of articles marked as read is returned."
11307 (not gnus-interactive-catchup) ;Without confirmation?
11311 "Mark absolutely all articles as read? "
11312 "Mark all unread articles as read? ")))
11314 (not gnus-newsgroup-adaptive)
11315 (not gnus-newsgroup-auto-expire)
11316 (not gnus-suppress-duplicates)
11317 (or (not gnus-use-cache)
11318 (eq gnus-use-cache 'passive)))
11321 (setq gnus-newsgroup-marked nil
11322 gnus-newsgroup-spam-marked nil
11323 gnus-newsgroup-dormant nil))
11324 (setq gnus-newsgroup-unreads
11325 (gnus-sorted-nunion
11326 (gnus-sorted-intersection gnus-newsgroup-unreads
11327 gnus-newsgroup-downloadable)
11328 (gnus-sorted-difference gnus-newsgroup-unfetched
11329 gnus-newsgroup-cached))))
11330 ;; We actually mark all articles as canceled, which we
11331 ;; have to do when using auto-expiry or adaptive scoring.
11332 (gnus-summary-show-all-threads)
11333 (if (and to-here reverse)
11335 (goto-char to-here)
11336 (gnus-summary-mark-current-read-and-unread-as-read
11338 (while (gnus-summary-find-next (not all))
11339 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
11340 (when (gnus-summary-first-subject (not all))
11342 (if to-here (< (point) to-here) t)
11343 (gnus-summary-mark-article-as-read gnus-catchup-mark)
11344 (gnus-summary-find-next (not all))))))
11345 (gnus-set-mode-line 'summary))
11347 (gnus-summary-position-point)))
11349 (defun gnus-summary-catchup-to-here (&optional all)
11350 "Mark all unticked articles before the current one as read.
11351 If ALL is non-nil, also mark ticked and dormant articles as read."
11354 (gnus-save-hidden-threads
11355 (let ((beg (point)))
11356 ;; We check that there are unread articles.
11357 (when (or all (gnus-summary-find-prev))
11358 (gnus-summary-catchup all t beg)))))
11359 (gnus-summary-position-point))
11361 (defun gnus-summary-catchup-from-here (&optional all)
11362 "Mark all unticked articles after (and including) the current one as read.
11363 If ALL is non-nil, also mark ticked and dormant articles as read."
11366 (gnus-save-hidden-threads
11367 (let ((beg (point)))
11368 ;; We check that there are unread articles.
11369 (when (or all (gnus-summary-find-next))
11370 (gnus-summary-catchup all t beg nil t)))))
11371 (gnus-summary-position-point))
11373 (defun gnus-summary-catchup-all (&optional quietly)
11374 "Mark all articles in this newsgroup as read.
11375 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11376 instead, which marks only unread articles as read."
11378 (gnus-summary-catchup t quietly))
11380 (defun gnus-summary-catchup-and-exit (&optional all quietly)
11381 "Mark all unread articles in this group as read, then exit.
11382 If prefix argument ALL is non-nil, all articles are marked as read.
11383 If QUIETLY is non-nil, no questions will be asked."
11385 (when (gnus-summary-catchup all quietly nil 'fast)
11386 ;; Select next newsgroup or exit.
11387 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
11388 (eq gnus-auto-select-next 'quietly))
11389 (gnus-summary-next-group nil)
11390 (gnus-summary-exit))))
11392 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
11393 "Mark all articles in this newsgroup as read, and then exit.
11394 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11395 instead, which marks only unread articles as read."
11397 (gnus-summary-catchup-and-exit t quietly))
11399 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
11400 "Mark all articles in this group as read and select the next group.
11401 If given a prefix, mark all articles, unread as well as ticked, as
11405 (gnus-summary-catchup all))
11406 (gnus-summary-next-group))
11408 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
11409 "Mark all articles in this group as read and select the previous group.
11410 If given a prefix, mark all articles, unread as well as ticked, as
11414 (gnus-summary-catchup all))
11415 (gnus-summary-next-group nil nil t))
11421 (defmacro gnus-with-article (article &rest forms)
11422 "Select ARTICLE and perform FORMS in the original article buffer.
11423 Then replace the article with the result."
11425 ;; We don't want the article to be marked as read.
11426 (let (gnus-mark-article-hook)
11427 (gnus-summary-select-article t t nil ,article))
11428 (set-buffer gnus-original-article-buffer)
11430 (if (not (gnus-check-backend-function
11431 'request-replace-article (car gnus-article-current)))
11432 (gnus-message 5 "Read-only group; not replacing")
11433 (unless (gnus-request-replace-article
11434 ,article (car gnus-article-current)
11435 (current-buffer) t)
11436 (error "Couldn't replace article")))
11437 ;; The cache and backlog have to be flushed somewhat.
11438 (when gnus-keep-backlog
11439 (gnus-backlog-remove-article
11440 (car gnus-article-current) (cdr gnus-article-current)))
11441 (when gnus-use-cache
11442 (gnus-cache-update-article
11443 (car gnus-article-current) (cdr gnus-article-current)))))
11445 (put 'gnus-with-article 'lisp-indent-function 1)
11446 (put 'gnus-with-article 'edebug-form-spec '(form body))
11448 ;; Thread-based commands.
11450 (defun gnus-summary-articles-in-thread (&optional article)
11451 "Return a list of all articles in the current thread.
11452 If ARTICLE is non-nil, return all articles in the thread that starts
11453 with that article."
11454 (let* ((article (or article (gnus-summary-article-number)))
11455 (data (gnus-data-find-list article))
11456 (top-level (gnus-data-level (car data)))
11458 (cond ((null gnus-thread-operation-ignore-subject)
11459 (gnus-simplify-subject-re
11460 (mail-header-subject (gnus-data-header (car data)))))
11461 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
11462 (gnus-simplify-subject-fuzzy
11463 (mail-header-subject (gnus-data-header (car data)))))
11465 (end-point (save-excursion
11466 (goto-char (gnus-data-pos (car data)))
11467 (if (gnus-summary-go-to-next-thread)
11468 (point) (point-max))))
11471 (< (gnus-data-pos (car data)) end-point))
11472 (when (or (not top-subject)
11473 (string= top-subject
11474 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11475 (gnus-simplify-subject-fuzzy
11476 (mail-header-subject
11477 (gnus-data-header (car data))))
11478 (gnus-simplify-subject-re
11479 (mail-header-subject
11480 (gnus-data-header (car data)))))))
11481 (push (gnus-data-number (car data)) articles))
11482 (unless (and (setq data (cdr data))
11483 (> (gnus-data-level (car data)) top-level))
11485 ;; Return the list of articles.
11486 (nreverse articles)))
11488 (defun gnus-summary-rethread-current ()
11489 "Rethread the thread the current article is part of."
11491 (let* ((gnus-show-threads t)
11492 (article (gnus-summary-article-number))
11493 (id (mail-header-id (gnus-summary-article-header)))
11494 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11496 (error "No article on the current line"))
11497 (gnus-rebuild-thread id)
11498 (gnus-summary-goto-subject article)))
11500 (defun gnus-summary-reparent-thread ()
11501 "Make the current article child of the marked (or previous) article.
11503 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11504 is non-nil or the Subject: of both articles are the same."
11506 (unless (not (gnus-group-read-only-p))
11507 (error "The current newsgroup does not support article editing"))
11508 (unless (<= (length gnus-newsgroup-processable) 1)
11509 (error "No more than one article may be marked"))
11510 (let ((child (gnus-summary-article-number))
11511 ;; First grab the marked article, otherwise one line up.
11512 (parent (if (not (null gnus-newsgroup-processable))
11513 (car gnus-newsgroup-processable)
11515 (if (eq (forward-line -1) 0)
11516 (gnus-summary-article-number)
11517 (error "Beginning of summary buffer"))))))
11518 (gnus-summary-reparent-children parent (list child))))
11520 (defun gnus-summary-reparent-children (parent children)
11521 "Make PARENT the parent of CHILDREN.
11522 When called interactively, PARENT is the current article and CHILDREN
11523 are the process-marked articles."
11525 (list (gnus-summary-article-number)
11526 (gnus-summary-work-articles nil)))
11527 (dolist (child children)
11528 (save-window-excursion
11529 (let ((gnus-article-buffer " *reparent*"))
11530 (unless (not (eq parent child))
11531 (error "An article may not be self-referential"))
11532 (let ((message-id (mail-header-id
11533 (gnus-summary-article-header parent))))
11534 (unless (and message-id (not (equal message-id "")))
11535 (error "No message-id in desired parent"))
11536 (gnus-with-article child
11538 (goto-char (point-min))
11539 (message-narrow-to-head)
11540 (if (re-search-forward "^References: " nil t)
11542 (re-search-forward "^[^ \t]" nil t)
11545 (insert " " message-id))
11546 (insert "References: " message-id "\n"))))
11547 (set-buffer gnus-summary-buffer)
11548 (gnus-summary-unmark-all-processable)
11549 (gnus-summary-update-article child)
11550 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11551 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11552 (gnus-summary-rethread-current)
11553 (gnus-message 3 "Article %d is now the child of article %d"
11556 (defun gnus-summary-toggle-threads (&optional arg)
11557 "Toggle showing conversation threads.
11558 If ARG is positive number, turn showing conversation threads on."
11560 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11561 (setq gnus-show-threads
11562 (if (null arg) (not gnus-show-threads)
11563 (> (prefix-numeric-value arg) 0)))
11564 (gnus-summary-prepare)
11565 (gnus-summary-goto-subject current)
11566 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11567 (gnus-summary-position-point)))
11570 (if (fboundp 'remove-overlays)
11571 (defalias 'gnus-remove-overlays 'remove-overlays)
11572 (defun gnus-remove-overlays (beg end name val)
11573 "Clear BEG and END of overlays whose property NAME has value VAL.
11574 For compatibility with XEmacs."
11575 (dolist (ov (gnus-overlays-in beg end))
11576 (when (eq (gnus-overlay-get ov name) val)
11577 (gnus-delete-overlay ov))))))
11579 (defun gnus-summary-show-all-threads ()
11580 "Show all threads."
11582 (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
11583 (gnus-summary-position-point))
11585 (defsubst gnus-summary--inv (p)
11586 (and (eq (get-char-property p 'invisible) 'gnus-sum) p))
11588 (defun gnus-summary-show-thread ()
11589 "Show thread subtrees.
11590 Returns nil if no thread was there to be shown."
11592 (let* ((orig (point))
11593 (end (point-at-eol))
11594 (end (or (gnus-summary--inv end) (gnus-summary--inv (1- end))))
11595 ;; Leave point at bol
11596 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11598 (if (fboundp 'next-single-char-property-change)
11599 ;; Note: XEmacs version of n-s-c-p-c may return nil
11600 (or (next-single-char-property-change end 'invisible)
11605 (eq (get-char-property (point) 'invisible)
11609 (gnus-remove-overlays beg eoi 'invisible 'gnus-sum)
11611 (gnus-summary-position-point)
11614 (defun gnus-summary-maybe-hide-threads ()
11615 "If requested, hide the threads that should be hidden."
11616 (when (and gnus-show-threads
11617 gnus-thread-hide-subtree)
11618 (gnus-summary-hide-all-threads
11619 (if (or (consp gnus-thread-hide-subtree)
11620 (functionp gnus-thread-hide-subtree))
11621 (gnus-make-predicate gnus-thread-hide-subtree)
11624 ;;; Hiding predicates.
11626 (defun gnus-article-unread-p (header)
11627 (memq (mail-header-number header) gnus-newsgroup-unreads))
11629 (defun gnus-article-unseen-p (header)
11630 (memq (mail-header-number header) gnus-newsgroup-unseen))
11632 (defun gnus-map-articles (predicate articles)
11633 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11634 (apply 'gnus-or (mapcar predicate
11635 (mapcar (lambda (number)
11636 (gnus-summary-article-header number))
11639 (defun gnus-summary-hide-all-threads (&optional predicate)
11640 "Hide all thread subtrees.
11641 If PREDICATE is supplied, threads that satisfy this predicate
11642 will not be hidden."
11645 (goto-char (point-min))
11650 (when (zerop (mod count 1000))
11651 (message "Hiding all threads... %d" count))
11652 (when (or (not predicate)
11654 predicate (gnus-summary-article-children)))
11655 (gnus-summary-hide-thread))
11656 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11657 (gnus-summary-position-point))
11659 (defun gnus-summary-hide-thread ()
11660 "Hide thread subtrees.
11661 If PREDICATE is supplied, threads that satisfy this predicate
11662 will not be hidden.
11663 Returns nil if no threads were there to be hidden."
11665 (beginning-of-line)
11666 (let ((start (point))
11667 (starteol (line-end-position))
11668 (article (gnus-summary-article-number)))
11669 ;; Go forward until either the buffer ends or the subthread ends.
11670 (when (and (not (eobp))
11671 (or (zerop (gnus-summary-next-thread 1 t))
11672 (goto-char (point-max))))
11673 (if (and (> (point) start)
11674 ;; FIXME: this should actually search for a non-invisible \n.
11675 (search-backward "\n" start t))
11677 (when (> (point) starteol)
11678 (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum)
11679 (let ((ol (gnus-make-overlay starteol (point) nil t nil)))
11680 (gnus-overlay-put ol 'invisible 'gnus-sum)
11681 (gnus-overlay-put ol 'evaporate t)))
11682 (gnus-summary-goto-subject article)
11683 (when (> start (point))
11684 (message "Hiding the thread moved us backwards, aborting!")
11685 (goto-char (point-max))))
11689 (defun gnus-summary-go-to-next-thread (&optional previous)
11690 "Go to the same level (or less) next thread.
11691 If PREVIOUS is non-nil, go to previous thread instead.
11692 Return the article number moved to, or nil if moving was impossible."
11693 (let ((level (gnus-summary-thread-level))
11694 (way (if previous -1 1))
11697 (while (and (not (eobp))
11698 (< level (gnus-summary-thread-level)))
11699 (forward-line way))
11706 (gnus-summary-article-number)
11707 (goto-char beg)))))
11709 (defun gnus-summary-next-thread (n &optional silent)
11710 "Go to the same level next N'th thread.
11711 If N is negative, search backward instead.
11712 Returns the difference between N and the number of skips actually
11715 If SILENT, don't output messages."
11717 (let ((backward (< n 0))
11719 (while (and (> n 0)
11720 (gnus-summary-go-to-next-thread backward))
11723 (gnus-summary-position-point))
11724 (when (and (not silent) (/= 0 n))
11725 (gnus-message 7 "No more threads"))
11728 (defun gnus-summary-prev-thread (n)
11729 "Go to the same level previous N'th thread.
11730 Returns the difference between N and the number of skips actually
11733 (gnus-summary-next-thread (- n)))
11735 (defun gnus-summary-go-down-thread ()
11736 "Go down one level in the current thread."
11737 (let ((children (gnus-summary-article-children)))
11739 (gnus-summary-goto-subject (car children)))))
11741 (defun gnus-summary-go-up-thread ()
11742 "Go up one level in the current thread."
11743 (let ((parent (gnus-summary-article-parent)))
11745 (gnus-summary-goto-subject parent))))
11747 (defun gnus-summary-down-thread (n)
11748 "Go down thread N steps.
11749 If N is negative, go up instead.
11750 Returns the difference between N and how many steps down that were
11755 (while (and (> n 0)
11756 (if up (gnus-summary-go-up-thread)
11757 (gnus-summary-go-down-thread)))
11759 (gnus-summary-position-point)
11761 (gnus-message 7 "Can't go further"))
11764 (defun gnus-summary-up-thread (n)
11765 "Go up thread N steps.
11766 If N is negative, go down instead.
11767 Returns the difference between N and how many steps down that were
11770 (gnus-summary-down-thread (- n)))
11772 (defun gnus-summary-top-thread ()
11773 "Go to the top of the thread."
11775 (while (gnus-summary-go-up-thread))
11776 (gnus-summary-article-number))
11778 (defun gnus-summary-expire-thread ()
11779 "Mark articles under current thread as expired."
11781 (gnus-summary-kill-thread 0))
11783 (defun gnus-summary-kill-thread (&optional unmark)
11784 "Mark articles under current thread as read.
11785 If the prefix argument is positive, remove any kinds of marks.
11786 If the prefix argument is zero, mark thread as expired.
11787 If the prefix argument is negative, tick articles instead."
11790 (setq unmark (prefix-numeric-value unmark)))
11791 (let ((articles (gnus-summary-articles-in-thread))
11792 (hide (or (null unmark) (= unmark 0))))
11794 ;; Expand the thread.
11795 (gnus-summary-show-thread)
11796 ;; Mark all the articles.
11798 (gnus-summary-goto-subject (car articles))
11799 (cond ((null unmark)
11800 (gnus-summary-mark-article-as-read gnus-killed-mark))
11802 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11804 (gnus-summary-mark-article nil gnus-expirable-mark))
11806 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11807 (setq articles (cdr articles))))
11808 ;; Hide killed subtrees when hide is true.
11810 gnus-thread-hide-killed
11811 (gnus-summary-hide-thread))
11812 ;; If hide is t, go to next unread subject.
11814 ;; Go to next unread subject.
11815 (gnus-summary-next-subject 1 t)))
11816 (gnus-set-mode-line 'summary))
11818 ;; Summary sorting commands
11820 (defun gnus-summary-sort-by-number (&optional reverse)
11821 "Sort the summary buffer by article number.
11822 Argument REVERSE means reverse order."
11824 (gnus-summary-sort 'number reverse))
11826 (defun gnus-summary-sort-by-most-recent-number (&optional reverse)
11827 "Sort the summary buffer by most recent article number.
11828 Argument REVERSE means reverse order."
11830 (gnus-summary-sort 'most-recent-number reverse))
11832 (defun gnus-summary-sort-by-random (&optional reverse)
11833 "Randomize the order in the summary buffer.
11834 Argument REVERSE means to randomize in reverse order."
11836 (gnus-summary-sort 'random reverse))
11838 (defun gnus-summary-sort-by-author (&optional reverse)
11839 "Sort the summary buffer by author name alphabetically.
11840 If `case-fold-search' is non-nil, case of letters is ignored.
11841 Argument REVERSE means reverse order."
11843 (gnus-summary-sort 'author reverse))
11845 (defun gnus-summary-sort-by-recipient (&optional reverse)
11846 "Sort the summary buffer by recipient name alphabetically.
11847 If `case-fold-search' is non-nil, case of letters is ignored.
11848 Argument REVERSE means reverse order."
11850 (gnus-summary-sort 'recipient reverse))
11852 (defun gnus-summary-sort-by-subject (&optional reverse)
11853 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11854 If `case-fold-search' is non-nil, case of letters is ignored.
11855 Argument REVERSE means reverse order."
11857 (gnus-summary-sort 'subject reverse))
11859 (defun gnus-summary-sort-by-date (&optional reverse)
11860 "Sort the summary buffer by date.
11861 Argument REVERSE means reverse order."
11863 (gnus-summary-sort 'date reverse))
11865 (defun gnus-summary-sort-by-most-recent-date (&optional reverse)
11866 "Sort the summary buffer by most recent date.
11867 Argument REVERSE means reverse order."
11869 (gnus-summary-sort 'most-recent-date reverse))
11871 (defun gnus-summary-sort-by-score (&optional reverse)
11872 "Sort the summary buffer by score.
11873 Argument REVERSE means reverse order."
11875 (gnus-summary-sort 'score reverse))
11877 (defun gnus-summary-sort-by-lines (&optional reverse)
11878 "Sort the summary buffer by the number of lines.
11879 Argument REVERSE means reverse order."
11881 (gnus-summary-sort 'lines reverse))
11883 (defun gnus-summary-sort-by-chars (&optional reverse)
11884 "Sort the summary buffer by article length.
11885 Argument REVERSE means reverse order."
11887 (gnus-summary-sort 'chars reverse))
11889 (defun gnus-summary-sort-by-original (&optional reverse)
11890 "Sort the summary buffer using the default sorting method.
11891 Argument REVERSE means reverse order."
11893 (let* ((inhibit-read-only t)
11894 (gnus-summary-prepare-hook nil))
11895 ;; We do the sorting by regenerating the threads.
11896 (gnus-summary-prepare)
11897 ;; Hide subthreads if needed.
11898 (gnus-summary-maybe-hide-threads)))
11900 (defun gnus-summary-sort (predicate reverse)
11901 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11902 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11903 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11904 (gnus-thread-sort-functions
11909 (gnus-sort-gathered-threads-function
11910 gnus-thread-sort-functions)
11911 (gnus-article-sort-functions
11915 (,article t2 t1))))
11916 (inhibit-read-only t)
11917 (gnus-summary-prepare-hook nil))
11918 ;; We do the sorting by regenerating the threads.
11919 (gnus-summary-prepare)
11920 ;; Hide subthreads if needed.
11921 (gnus-summary-maybe-hide-threads)))
11923 ;; Summary saving commands.
11925 (defun gnus-summary-save-article (&optional n not-saved)
11926 "Save the current article using the default saver function.
11927 If N is a positive number, save the N next articles.
11928 If N is a negative number, save the N previous articles.
11929 If N is nil and any articles have been marked with the process mark,
11930 save those articles instead.
11931 The variable `gnus-default-article-saver' specifies the saver function.
11933 If the optional second argument NOT-SAVED is non-nil, articles saved
11934 will not be marked as saved."
11936 (require 'gnus-art)
11937 (let* ((articles (gnus-summary-work-articles n))
11938 (save-buffer (save-excursion
11939 (nnheader-set-temp-buffer " *Gnus Save*")))
11940 (num (length articles))
11941 ;; Whether to save decoded articles or raw articles.
11942 (decode (when gnus-article-save-coding-system
11943 (get gnus-default-article-saver :decode)))
11944 ;; When saving many articles in a single file, use the other
11945 ;; function to save articles other than the first one.
11946 (saver2 (get gnus-default-article-saver :function))
11947 (gnus-prompt-before-saving (if saver2
11949 gnus-prompt-before-saving))
11950 (gnus-default-article-saver gnus-default-article-saver)
11952 (dolist (article articles)
11953 (setq header (gnus-summary-article-header article))
11954 (if (not (vectorp header))
11955 ;; This is a pseudo-article.
11956 (if (assq 'name header)
11957 (gnus-copy-file (cdr (assq 'name header)))
11958 (gnus-message 1 "Article %d is unsavable" article))
11959 ;; This is a real article.
11960 (save-window-excursion
11961 (gnus-summary-select-article decode decode nil article)
11962 (gnus-summary-goto-subject article))
11963 (with-current-buffer save-buffer
11965 (insert-buffer-substring (if decode
11966 gnus-article-buffer
11967 gnus-original-article-buffer)))
11968 (setq file (gnus-article-save save-buffer file num))
11969 (gnus-summary-remove-process-mark article)
11971 (gnus-summary-set-saved-mark article)))
11973 (setq gnus-default-article-saver saver2
11975 (gnus-kill-buffer save-buffer)
11976 (gnus-summary-position-point)
11977 (gnus-set-mode-line 'summary)
11980 (declare-function gnus-summary-save-in-pipe "gnus-art" (&optional command raw))
11982 (defun gnus-summary-pipe-output (&optional n sym)
11983 "Pipe the current article to a subprocess.
11984 If N is a positive number, pipe the N next articles.
11985 If N is a negative number, pipe the N previous articles.
11986 If N is nil and any articles have been marked with the process mark,
11987 pipe those articles instead.
11988 The default command to which articles are piped is specified by the
11989 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
11990 will be prompted for the command.
11992 The properties `:decode' and `:headers' that are put to the function
11993 symbol `gnus-summary-save-in-pipe' control whether this function
11994 decodes articles and what headers to keep (see the doc string for the
11995 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
11996 is neither omitted nor the symbol `r', force including all headers
11997 regardless of the `:headers' property. If it is the symbol `r',
11998 articles that are not decoded and include all headers will be piped
11999 no matter what the properties `:decode' and `:headers' are."
12000 (interactive (gnus-interactive "P\ny"))
12001 (require 'gnus-art)
12002 (let* ((articles (gnus-summary-work-articles n))
12003 (result-buffer "*Shell Command Output*")
12004 (all-headers (not (memq sym '(nil r))))
12005 (gnus-save-all-headers (or all-headers gnus-save-all-headers))
12007 (headers (get 'gnus-summary-save-in-pipe :headers))
12009 (unless (numberp (car articles))
12010 (error "No article to pipe"))
12011 (setq command (gnus-read-shell-command
12012 (concat "Shell command on "
12014 (format "these %d articles" (length articles))
12017 gnus-summary-pipe-output-default-command))
12018 (when (string-equal command "")
12019 (error "A command is required"))
12021 (put 'gnus-summary-save-in-pipe :headers nil))
12024 (gnus-summary-goto-subject (pop articles))
12025 (save-window-excursion (gnus-summary-save-in-pipe command raw))
12026 (when (and (get-buffer result-buffer)
12027 (not (zerop (buffer-size (get-buffer result-buffer)))))
12028 (setq result (concat result (with-current-buffer result-buffer
12029 (buffer-string))))))
12030 (put 'gnus-summary-save-in-pipe :headers headers))
12031 (unless (zerop (length result))
12032 (if (with-current-buffer (get-buffer-create result-buffer)
12036 (and (= (count-lines (point-min) (point)) 1)
12039 (<= (current-column)
12040 (window-width (minibuffer-window)))))
12041 (goto-char (point-min))))
12042 (message "%s" (substring result 0 -1))
12044 (gnus-configure-windows 'pipe)))))
12046 (defun gnus-summary-save-article-mail (&optional arg)
12047 "Append the current article to a Unix mail box file.
12048 If N is a positive number, save the N next articles.
12049 If N is a negative number, save the N previous articles.
12050 If N is nil and any articles have been marked with the process mark,
12051 save those articles instead."
12053 (require 'gnus-art)
12054 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
12055 (gnus-summary-save-article arg)))
12057 (defun gnus-summary-save-article-rmail (&optional arg)
12058 "Append the current article to an rmail file.
12059 If N is a positive number, save the N next articles.
12060 If N is a negative number, save the N previous articles.
12061 If N is nil and any articles have been marked with the process mark,
12062 save those articles instead."
12064 (require 'gnus-art)
12065 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
12066 (gnus-summary-save-article arg)))
12068 (defun gnus-summary-save-article-file (&optional arg)
12069 "Append the current article to a file.
12070 If N is a positive number, save the N next articles.
12071 If N is a negative number, save the N previous articles.
12072 If N is nil and any articles have been marked with the process mark,
12073 save those articles instead."
12075 (require 'gnus-art)
12076 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
12077 (gnus-summary-save-article arg)))
12079 (defun gnus-summary-write-article-file (&optional arg)
12080 "Write the current article to a file, deleting the previous file.
12081 If N is a positive number, save the N next articles.
12082 If N is a negative number, save the N previous articles.
12083 If N is nil and any articles have been marked with the process mark,
12084 save those articles instead."
12086 (require 'gnus-art)
12087 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
12088 (gnus-summary-save-article arg)))
12090 (defun gnus-summary-save-article-body-file (&optional arg)
12091 "Append the current article body to a file.
12092 If N is a positive number, save the N next articles.
12093 If N is a negative number, save the N previous articles.
12094 If N is nil and any articles have been marked with the process mark,
12095 save those articles instead."
12097 (require 'gnus-art)
12098 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
12099 (gnus-summary-save-article arg)))
12101 (defun gnus-summary-write-article-body-file (&optional arg)
12102 "Write the current article body to a file, deleting the previous file.
12103 If N is a positive number, save the N next articles.
12104 If N is a negative number, save the N previous articles.
12105 If N is nil and any articles have been marked with the process mark,
12106 save those articles instead."
12108 (require 'gnus-art)
12109 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
12110 (gnus-summary-save-article arg)))
12112 (defun gnus-summary-muttprint (&optional arg)
12113 "Print the current article using Muttprint.
12114 If N is a positive number, save the N next articles.
12115 If N is a negative number, save the N previous articles.
12116 If N is nil and any articles have been marked with the process mark,
12117 save those articles instead."
12119 (require 'gnus-art)
12120 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
12121 (gnus-summary-save-article arg t)))
12123 (defun gnus-summary-pipe-message (program)
12124 "Pipe the current article through PROGRAM."
12125 (interactive "sProgram: ")
12126 (gnus-summary-select-article)
12127 (let ((mail-header-separator ""))
12128 (gnus-eval-in-buffer-window gnus-article-buffer
12131 (let ((start (window-start))
12132 (inhibit-read-only t))
12133 (message-pipe-buffer-body program)
12134 (set-window-start (get-buffer-window (current-buffer)) start))))))
12136 (defun gnus-get-split-value (methods)
12137 "Return a value based on the split METHODS."
12138 (let (split-name method result match)
12140 (with-current-buffer gnus-original-article-buffer
12142 (nnheader-narrow-to-headers)
12143 (while (and methods (not split-name))
12144 (goto-char (point-min))
12145 (setq method (pop methods))
12146 (setq match (car method))
12149 ;; Regular expression.
12151 (re-search-forward match nil t)))
12156 (setq result (funcall match gnus-newsgroup-name))))
12161 (setq result (eval match)))))
12162 (setq split-name (cdr method))
12163 (cond ((stringp result)
12164 (push (expand-file-name
12165 result gnus-article-save-directory)
12168 (setq split-name (append result split-name)))))))))
12169 (nreverse split-name)))
12171 (defun gnus-valid-move-group-p (group)
12172 (and (symbolp group)
12174 (symbol-name group)
12175 (symbol-value group)
12176 (gnus-get-function (gnus-find-method-for-group
12177 (symbol-name group)) 'request-accept-article t)))
12179 (defun gnus-read-move-group-name (prompt default articles prefix)
12180 "Read a group name."
12181 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
12182 (minibuffer-confirm-incomplete nil) ; XEmacs
12186 (if (> (length articles) 1)
12187 (format "these %d articles" (length articles))
12192 (gnus-group-completing-read
12194 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12195 nil prefix nil default))
12196 ((= 1 (length split-name))
12197 (gnus-group-completing-read
12199 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12200 nil prefix 'gnus-group-history (car split-name)))
12202 (gnus-completing-read
12203 prom (nreverse split-name) nil nil 'gnus-group-history))))
12204 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
12207 (if (or (string= to-newsgroup "")
12208 (string= to-newsgroup prefix))
12209 (setq to-newsgroup default))
12210 (unless to-newsgroup
12211 (error "No group name entered"))
12212 (setq encoded (mm-encode-coding-string
12214 (gnus-group-name-charset to-method to-newsgroup)))
12215 (or (gnus-active encoded)
12216 (gnus-activate-group encoded nil nil to-method)
12217 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
12219 (or (and (gnus-request-create-group encoded to-method)
12220 (gnus-activate-group encoded nil nil to-method)
12221 (gnus-subscribe-group encoded))
12222 (error "Couldn't create group %s" to-newsgroup)))
12223 (error "No such group: %s" to-newsgroup))
12226 (defvar gnus-summary-save-parts-counter)
12227 (declare-function mm-uu-dissect "mm-uu" (&optional noheader mime-type))
12229 (defun gnus-summary-save-parts (type dir n &optional reverse)
12230 "Save parts matching TYPE to DIR.
12231 If REVERSE, save parts that do not match TYPE."
12233 (list (read-string "Save parts of type: "
12234 (or (car gnus-summary-save-parts-type-history)
12235 gnus-summary-save-parts-default-mime)
12236 'gnus-summary-save-parts-type-history)
12237 (setq gnus-summary-save-parts-last-directory
12238 (read-directory-name "Save to directory: "
12239 gnus-summary-save-parts-last-directory
12241 current-prefix-arg))
12242 (gnus-summary-iterate n
12243 (let ((gnus-display-mime-function nil)
12244 gnus-article-prepare-hook
12245 gnus-article-decode-hook
12246 gnus-display-mime-function
12248 (gnus-inhibit-treatment t))
12249 (gnus-summary-select-article))
12250 (with-current-buffer gnus-article-buffer
12251 (let ((handles (or gnus-article-mime-handles
12252 (mm-dissect-buffer nil gnus-article-loose-mime)
12253 (and gnus-article-emulate-mime
12255 (gnus-summary-save-parts-counter 1))
12257 (gnus-summary-save-parts-1 type dir handles reverse)
12258 (unless gnus-article-mime-handles ;; Don't destroy this case.
12259 (mm-destroy-parts handles)))))))
12261 (defun gnus-summary-save-parts-1 (type dir handle reverse)
12262 (if (stringp (car handle))
12263 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
12266 (not (string-match type (mm-handle-media-type handle)))
12267 (string-match type (mm-handle-media-type handle)))
12268 (let ((file (expand-file-name
12270 mm-file-name-rewrite-functions
12271 (file-name-nondirectory
12273 (mm-handle-filename handle)
12274 (format "%s.%d.%d" gnus-newsgroup-name
12275 (cdr gnus-article-current)
12276 gnus-summary-save-parts-counter))))
12278 (incf gnus-summary-save-parts-counter)
12279 (unless (file-exists-p file)
12280 (mm-save-part-to-file handle file))))))
12282 ;; Summary extract commands
12284 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
12285 (let ((inhibit-read-only t)
12286 (article (gnus-summary-article-number))
12288 (unless (gnus-summary-goto-subject article)
12289 (error "No such article: %d" article))
12290 (gnus-summary-position-point)
12291 ;; If all commands are to be bunched up on one line, we collect
12293 (unless gnus-view-pseudos-separately
12294 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
12297 (setq action (cdr (assq 'action (car ps))))
12298 (setq files (list (cdr (assq 'name (car ps)))))
12299 (while (and ps (cdr ps)
12300 (string= (or action "1")
12301 (or (cdr (assq 'action (cadr ps))) "2")))
12302 (push (cdr (assq 'name (cadr ps))) files)
12303 (setcdr ps (cddr ps)))
12305 (when (not (string-match "%s" action))
12308 (when (assq 'execute (car ps))
12309 (setcdr (assq 'execute (car ps))
12310 (funcall (if (string-match "%s" action)
12317 (shell-quote-argument f)))
12319 (setq ps (cdr ps)))))
12320 (if (and gnus-view-pseudos (not not-view))
12322 (when (assq 'execute (car pslist))
12323 (gnus-execute-command (cdr (assq 'execute (car pslist)))
12324 (eq gnus-view-pseudos 'not-confirm)))
12325 (setq pslist (cdr pslist)))
12328 (setq after-article (or (cdr (assq 'article (car pslist)))
12329 (gnus-summary-article-number)))
12330 (gnus-summary-goto-subject after-article)
12333 (insert " " (file-name-nondirectory
12334 (cdr (assq 'name (car pslist))))
12335 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
12337 (forward-line -1) ; back to `b'
12338 (gnus-add-text-properties
12339 b (1- e) (list 'gnus-number gnus-reffed-article-number
12340 gnus-mouse-face-prop gnus-mouse-face))
12342 after-article gnus-reffed-article-number
12343 gnus-unread-mark b (car pslist) 0 (- e b))
12344 (setq gnus-newsgroup-unreads
12345 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12346 gnus-reffed-article-number))
12347 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
12348 (setq pslist (cdr pslist)))))))
12350 (defun gnus-pseudos< (p1 p2)
12351 (let ((c1 (cdr (assq 'action p1)))
12352 (c2 (cdr (assq 'action p2))))
12353 (and c1 c2 (string< c1 c2))))
12355 (defun gnus-request-pseudo-article (props)
12356 (cond ((assq 'execute props)
12357 (gnus-execute-command (cdr (assq 'execute props)))))
12358 (let ((gnus-current-article (gnus-summary-article-number)))
12359 (gnus-run-hooks 'gnus-mark-article-hook)))
12361 (defun gnus-execute-command (command &optional automatic)
12363 (gnus-article-setup-buffer)
12364 (set-buffer gnus-article-buffer)
12365 (setq buffer-read-only nil)
12366 (let ((command (if automatic command
12367 (read-string "Command: " (cons command 0)))))
12369 (insert "$ " command "\n\n")
12370 (if gnus-view-pseudo-asynchronously
12371 (start-process "gnus-execute" (current-buffer) shell-file-name
12372 shell-command-switch command)
12373 (call-process shell-file-name nil t nil
12374 shell-command-switch command)))))
12376 ;; Summary kill commands.
12378 (defun gnus-summary-edit-global-kill (article)
12379 "Edit the \"global\" kill file."
12380 (interactive (list (gnus-summary-article-number)))
12381 (gnus-group-edit-global-kill article))
12383 (defun gnus-summary-edit-local-kill ()
12384 "Edit a local kill file applied to the current newsgroup."
12386 (setq gnus-current-headers (gnus-summary-article-header))
12387 (gnus-group-edit-local-kill
12388 (gnus-summary-article-number) gnus-newsgroup-name))
12390 ;;; Header reading.
12392 (defun gnus-read-header (id &optional header)
12393 "Read the headers of article ID and enter them into the Gnus system."
12394 (let ((group gnus-newsgroup-name)
12395 (gnus-override-method
12397 gnus-override-method
12398 (and (gnus-news-group-p gnus-newsgroup-name)
12399 (car (gnus-refer-article-methods)))))
12401 ;; First we check to see whether the header in question is already
12404 ;; This is a Message-ID.
12405 (setq header (or header (gnus-id-to-header id)))
12406 ;; This is an article number.
12407 (setq header (or header (gnus-summary-article-header id))))
12409 (not (gnus-summary-article-sparse-p (mail-header-number header))))
12410 ;; We have found the header.
12412 ;; We have to really fetch the header to this article.
12413 (with-current-buffer nntp-server-buffer
12414 (when (setq where (gnus-request-head id group))
12415 (nnheader-fold-continuation-lines)
12416 (goto-char (point-max))
12418 (goto-char (point-min))
12422 ((cdr where) (cdr where))
12423 (header (mail-header-number header))
12424 (t gnus-reffed-article-number))
12426 (insert " Article retrieved.\n"))
12427 (if (or (not where)
12428 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
12429 () ; Malformed head.
12430 (unless (gnus-summary-article-sparse-p (mail-header-number header))
12431 (when (and (bound-and-true-p gnus-registry-enabled)
12432 (not (gnus-ephemeral-group-p (car where))))
12433 (gnus-registry-handle-action
12434 (mail-header-id header) nil
12435 (gnus-group-prefixed-name
12437 (or gnus-override-method (gnus-find-method-for-group group)))
12438 (mail-header-subject header)
12439 (mail-header-from header)))
12440 (when (and (stringp id)
12442 (not (string= (gnus-group-real-name group)
12444 (not (gnus-server-equal gnus-override-method
12445 (gnus-group-method group)))))
12446 ;; If we fetched by Message-ID and the article came from
12447 ;; a different group (or server), we fudge some bogus
12448 ;; article numbers for this article.
12449 (mail-header-set-number header gnus-reffed-article-number))
12450 (with-current-buffer gnus-summary-buffer
12451 (decf gnus-reffed-article-number)
12452 (gnus-remove-header (mail-header-number header))
12453 (push header gnus-newsgroup-headers)
12454 (setq gnus-current-headers header)
12455 (push (mail-header-number header) gnus-newsgroup-limit)))
12458 (defun gnus-remove-header (number)
12459 "Remove header NUMBER from `gnus-newsgroup-headers'."
12460 (if (and gnus-newsgroup-headers
12461 (= number (mail-header-number (car gnus-newsgroup-headers))))
12462 (pop gnus-newsgroup-headers)
12463 (let ((headers gnus-newsgroup-headers))
12464 (while (and (cdr headers)
12465 (not (= number (mail-header-number (cadr headers)))))
12467 (when (cdr headers)
12468 (setcdr headers (cddr headers))))))
12471 ;;; summary highlights
12474 (defun gnus-highlight-selected-summary ()
12475 "Highlight selected article in summary buffer."
12476 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12477 (when gnus-summary-selected-face
12479 (let* ((beg (point-at-bol))
12480 (end (point-at-eol))
12481 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12482 (from (if (get-text-property beg gnus-mouse-face-prop)
12484 (or (next-single-property-change
12485 beg gnus-mouse-face-prop nil end)
12490 (or (next-single-property-change
12491 from gnus-mouse-face-prop nil end)
12493 ;; If no mouse-face prop on line we will have to = from = end,
12494 ;; so we highlight the entire line instead.
12495 (when (= (+ to 2) from)
12498 (if gnus-newsgroup-selected-overlay
12499 ;; Move old overlay.
12501 gnus-newsgroup-selected-overlay from to (current-buffer))
12502 ;; Create new overlay.
12504 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
12505 'face gnus-summary-selected-face))))))
12507 (defvar gnus-summary-highlight-line-cached nil)
12508 (defvar gnus-summary-highlight-line-trigger nil)
12510 (defun gnus-summary-highlight-line-0 ()
12511 (if (and (eq gnus-summary-highlight-line-trigger
12512 gnus-summary-highlight)
12513 gnus-summary-highlight-line-cached)
12514 gnus-summary-highlight-line-cached
12515 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12516 gnus-summary-highlight-line-cached
12517 (let* ((cond (list 'cond))
12519 (list gnus-summary-highlight))
12521 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
12525 (gnus-byte-compile (list 'lambda nil cond))))))
12527 (defun gnus-summary-highlight-line ()
12528 "Highlight current line according to `gnus-summary-highlight'."
12529 (let* ((beg (point-at-bol))
12530 (article (or (gnus-summary-article-number) gnus-current-article))
12531 (score (or (cdr (assq article
12532 gnus-newsgroup-scored))
12533 gnus-summary-default-score 0))
12534 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
12535 (inhibit-read-only t)
12536 (default gnus-summary-default-score)
12537 (default-high gnus-summary-default-high-score)
12538 (default-low gnus-summary-default-low-score)
12539 (uncached (and gnus-summary-use-undownloaded-faces
12540 (memq article gnus-newsgroup-undownloaded)
12541 (not (memq article gnus-newsgroup-cached)))))
12542 (let ((face (funcall (gnus-summary-highlight-line-0))))
12543 (unless (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face))
12544 (gnus-put-text-property-excluding-characters-with-faces
12545 beg (point-at-eol) 'face
12546 (setq face (if (boundp face) (symbol-value face) face)))
12547 (when gnus-summary-highlight-line-function
12548 (funcall gnus-summary-highlight-line-function article face))))))
12550 (defun gnus-update-read-articles (group unread &optional compute)
12551 "Update the list of read articles in GROUP.
12552 UNREAD is a sorted list."
12553 (let ((active (or gnus-newsgroup-active (gnus-active group)))
12554 (info (gnus-get-info group))
12557 (if (or (not info) (not active))
12558 ;; There is no info on this group if it was, in fact,
12559 ;; killed. Gnus stores no information on killed groups, so
12560 ;; there's nothing to be done.
12561 ;; One could store the information somewhere temporarily,
12562 ;; perhaps... Hmmm...
12564 ;; Remove any negative articles numbers.
12565 (while (and unread (< (car unread) 0))
12566 (setq unread (cdr unread)))
12567 ;; Remove any expired article numbers
12568 (while (and unread (< (car unread) (car active)))
12569 (setq unread (cdr unread)))
12570 ;; Compute the ranges of read articles by looking at the list of
12571 ;; unread articles.
12573 (when (/= (car unread) prev)
12574 (push (if (= prev (1- (car unread))) prev
12575 (cons prev (1- (car unread))))
12577 (setq prev (1+ (car unread)))
12578 (setq unread (cdr unread)))
12579 (when (<= prev (cdr active))
12580 (push (cons prev (cdr active)) read))
12581 (setq read (if (> (length read) 1) (nreverse read) read))
12586 ;; Propagate the read marks to the backend.
12587 (when (and (gnus-method-option-p
12588 (gnus-find-method-for-group group)
12590 (gnus-check-backend-function 'request-set-mark group))
12591 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12592 (add (gnus-remove-from-range read (gnus-info-read info))))
12594 (unless (gnus-check-group group)
12595 (error "Can't open server for %s" group))
12596 (gnus-request-set-mark
12597 group (delq nil (list (if add (list add 'add '(read)))
12598 (if del (list del 'del '(read))))))
12600 `(gnus-request-set-mark
12603 (if del (list del 'add '(read)))
12604 (if add (list add 'del '(read))))))))))
12605 (set-buffer gnus-group-buffer)
12606 (gnus-undo-register
12608 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12609 (gnus-info-set-read ',info ',(gnus-info-read info))
12610 (gnus-get-unread-articles-in-group ',info
12611 (gnus-active ,group))
12612 (gnus-group-update-group ,group t)
12614 ;; Enter this list into the group info.
12615 (gnus-info-set-read info read)
12616 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12617 (gnus-get-unread-articles-in-group info (gnus-active group))
12620 (defun gnus-offer-save-summaries ()
12621 "Offer to save all active summary buffers."
12623 ;; Go through all buffers and find all summaries.
12624 (dolist (buffer (buffer-list))
12625 (when (and (setq buffer (buffer-name buffer))
12626 (string-match "Summary" buffer)
12627 (with-current-buffer buffer
12628 ;; We check that this is, indeed, a summary buffer.
12629 (and (eq major-mode 'gnus-summary-mode)
12630 ;; Also make sure this isn't bogus.
12631 gnus-newsgroup-prepared
12632 ;; Also make sure that this isn't a
12633 ;; dead summary buffer.
12634 (not gnus-dead-summary-mode))))
12635 (push buffer buffers)))
12636 ;; Go through all these summary buffers and offer to save them.
12639 (if (eq gnus-interactive-exit 'quiet)
12640 (dolist (buffer buffers)
12641 (switch-to-buffer buffer)
12642 (gnus-summary-exit))
12644 "Update summary buffer %s? "
12646 (switch-to-buffer buf)
12647 (gnus-summary-exit))
12650 (defun gnus-summary-setup-default-charset ()
12651 "Setup newsgroup default charset."
12652 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12653 (setq gnus-newsgroup-charset nil)
12654 (let* ((ignored-charsets
12655 (or gnus-newsgroup-ephemeral-ignored-charsets
12657 (and gnus-newsgroup-name
12658 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12659 gnus-newsgroup-ignored-charsets))))
12660 (setq gnus-newsgroup-charset
12661 (or gnus-newsgroup-ephemeral-charset
12662 (and gnus-newsgroup-name
12663 (gnus-parameter-charset gnus-newsgroup-name))
12664 gnus-default-charset))
12665 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12666 ignored-charsets))))
12672 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12673 "Display the current article buffer fully MIME-buttonized.
12674 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12675 treated as multipart/mixed."
12677 (require 'gnus-art)
12678 (let ((gnus-unbuttonized-mime-types nil)
12679 (gnus-mime-display-multipart-as-mixed show-all-parts))
12680 (gnus-summary-show-article)))
12682 (defun gnus-summary-repair-multipart (article)
12683 "Add a Content-Type header to a multipart article without one."
12684 (interactive (list (gnus-summary-article-number)))
12685 (gnus-with-article article
12686 (message-narrow-to-head)
12687 (message-remove-header "Mime-Version")
12688 (goto-char (point-max))
12689 (insert "Mime-Version: 1.0\n")
12691 (when (search-forward "\n--" nil t)
12692 (let ((separator (buffer-substring (point) (point-at-eol))))
12693 (message-narrow-to-head)
12694 (message-remove-header "Content-Type")
12695 (goto-char (point-max))
12696 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12699 (let (gnus-mark-article-hook)
12700 (gnus-summary-select-article t t nil article)))
12702 (defun gnus-summary-toggle-display-buttonized ()
12703 "Toggle the buttonizing of the article buffer."
12705 (require 'gnus-art)
12706 (if (setq gnus-inhibit-mime-unbuttonizing
12707 (not gnus-inhibit-mime-unbuttonizing))
12708 (let ((gnus-unbuttonized-mime-types nil))
12709 (gnus-summary-show-article))
12710 (gnus-summary-show-article)))
12713 ;;; Generic summary marking commands
12716 (defvar gnus-summary-marking-alist
12717 '((read gnus-del-mark "d")
12718 (unread gnus-unread-mark "u")
12719 (ticked gnus-ticked-mark "!")
12720 (dormant gnus-dormant-mark "?")
12721 (expirable gnus-expirable-mark "e"))
12722 "An alist of names/marks/keystrokes.")
12724 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12725 (defvar gnus-summary-mark-map)
12727 (defun gnus-summary-make-all-marking-commands ()
12728 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12729 (dolist (elem gnus-summary-marking-alist)
12730 (apply 'gnus-summary-make-marking-command elem)))
12732 (defun gnus-summary-make-marking-command (name mark keystroke)
12733 (let ((map (make-sparse-keymap)))
12734 (define-key gnus-summary-generic-mark-map keystroke map)
12735 (dolist (lway `((next "next" next nil "n")
12736 (next-unread "next unread" next t "N")
12737 (prev "previous" prev nil "p")
12738 (prev-unread "previous unread" prev t "P")
12739 (nomove "" nil nil ,keystroke)))
12740 (let ((func (gnus-summary-make-marking-command-1
12741 mark (car lway) lway name)))
12742 (setq func (eval func))
12743 (define-key map (nth 4 lway) func)))))
12745 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12747 (format "gnus-summary-put-mark-as-%s%s"
12748 name (if (eq way 'nomove)
12750 (concat "-" (symbol-name way)))))
12753 "Mark the current article as %s%s.
12754 If N, the prefix, then repeat N times.
12755 If N is negative, move in reverse order.
12756 The difference between N and the actual number of articles marked is
12760 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12762 (defun gnus-summary-generic-mark (n mark move unread)
12763 "Mark N articles with MARK."
12764 (unless (eq major-mode 'gnus-summary-mode)
12765 (error "This command can only be used in the summary buffer"))
12766 (gnus-summary-show-thread)
12769 ((eq move 'next) 1)
12770 ((eq move 'prev) -1)
12772 (if (zerop nummove)
12776 nummove (* -1 nummove))))
12777 (while (and (> n 0)
12778 (gnus-summary-mark-article nil mark)
12779 (zerop (gnus-summary-next-subject nummove unread t)))
12782 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12783 (gnus-summary-recenter)
12784 (gnus-summary-position-point)
12785 (gnus-set-mode-line 'summary)
12788 (defun gnus-summary-insert-articles (articles)
12789 (when (setq articles
12790 (gnus-sorted-difference articles
12791 (mapcar (lambda (h)
12792 (mail-header-number h))
12793 gnus-newsgroup-headers)))
12794 (setq gnus-newsgroup-headers
12796 gnus-newsgroup-headers
12797 (gnus-fetch-headers articles nil t)
12798 'gnus-article-sort-by-number))
12799 (setq gnus-newsgroup-articles
12800 (gnus-sorted-nunion gnus-newsgroup-articles articles))
12801 ;; Suppress duplicates?
12802 (when gnus-suppress-duplicates
12803 (gnus-dup-suppress-articles))
12805 (if (and gnus-fetch-old-headers
12806 (eq gnus-headers-retrieved-by 'nov))
12807 ;; We might want to build some more threads first.
12808 (if (eq gnus-fetch-old-headers 'invisible)
12809 (gnus-build-all-threads)
12810 (gnus-build-old-threads))
12811 ;; Mark the inserted articles that are unread as unread.
12812 (setq gnus-newsgroup-unreads
12813 (gnus-sorted-nunion
12814 gnus-newsgroup-unreads
12815 (gnus-sorted-nintersection
12816 (gnus-list-of-unread-articles gnus-newsgroup-name)
12818 ;; Mark the inserted articles as selected so that the information
12819 ;; of the marks having been changed by a user may be updated when
12820 ;; exiting this group. See `gnus-summary-update-info'.
12821 (dolist (art articles)
12822 (setq gnus-newsgroup-unselected (delq art gnus-newsgroup-unselected))))
12823 ;; Let the Gnus agent mark articles as read.
12825 (gnus-agent-get-undownloaded-list))
12826 ;; Remove list identifiers from subject
12827 (gnus-summary-remove-list-identifiers)
12828 ;; First and last article in this newsgroup.
12829 (when gnus-newsgroup-headers
12830 (setq gnus-newsgroup-begin
12831 (mail-header-number (car gnus-newsgroup-headers))
12833 (mail-header-number
12834 (gnus-last-element gnus-newsgroup-headers))))
12835 (when gnus-use-scoring
12836 (gnus-possibly-score-headers))))
12838 (defun gnus-summary-insert-old-articles (&optional all)
12839 "Insert all old articles in this group.
12840 If ALL is non-nil, already read articles become readable.
12841 If ALL is a number, fetch this number of articles."
12844 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12847 ;; Some nntp servers lie about their active range. When
12848 ;; this happens, the active range can be in the millions.
12849 ;; Use a compressed range to avoid creating a huge list.
12850 (gnus-range-difference (list gnus-newsgroup-active) old))
12851 (setq len (gnus-range-length older))
12856 (let ((older-range (nreverse older)))
12860 (let* ((r (pop older-range))
12861 (min (if (numberp r) r (car r)))
12862 (max (if (numberp r) r (cdr r))))
12863 (while (and (<= min max)
12868 (setq older (gnus-uncompress-range older))))
12870 (setq older (gnus-uncompress-range older)))
12872 (when (and (numberp gnus-large-newsgroup)
12873 (> len gnus-large-newsgroup))
12874 (let* ((cursor-in-echo-area nil)
12875 (initial (gnus-parameter-large-newsgroup-initial
12876 gnus-newsgroup-name))
12880 "How many articles from %s (%s %d): "
12881 (gnus-group-decoded-name gnus-newsgroup-name)
12882 (if initial "max" "default")
12886 (number-to-string initial)))))
12887 (unless (string-match "^[ \t]*$" input)
12888 (setq all (string-to-number input))
12890 (let ((older-range (nreverse older)))
12894 (let* ((r (pop older-range))
12895 (min (if (numberp r) r (car r)))
12896 (max (if (numberp r) r (cdr r))))
12897 (while (and (<= min max)
12901 max (1- max))))))))))
12902 (setq older (gnus-uncompress-range older))))
12904 (message "No old news.")
12905 (gnus-summary-insert-articles older)
12906 (gnus-summary-limit (gnus-sorted-nunion old older))))
12907 (gnus-summary-position-point)))
12909 (defun gnus-summary-insert-new-articles ()
12910 "Insert all new articles in this group."
12912 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12913 (old-high gnus-newsgroup-highest)
12914 (nnmail-fetched-sources (list t))
12915 (new-active (gnus-activate-group gnus-newsgroup-name 'scan))
12918 (error "Couldn't fetch new data"))
12919 (setq gnus-newsgroup-active (gnus-copy-sequence new-active))
12920 (setq i (cdr gnus-newsgroup-active)
12921 gnus-newsgroup-highest i)
12922 (while (> i old-high)
12926 (message "No gnus is bad news")
12927 (gnus-summary-insert-articles new)
12928 (setq gnus-newsgroup-unreads
12929 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12930 (gnus-summary-limit (gnus-sorted-nunion old new))))
12931 (gnus-summary-position-point))
12933 ;;; Bookmark support for Gnus.
12934 (declare-function gnus-article-show-summary "gnus-art" ())
12935 (declare-function bookmark-make-record-default
12936 "bookmark" (&optional no-file no-context posn))
12937 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
12938 (declare-function bookmark-default-handler "bookmark" (bmk))
12939 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
12940 (defvar bookmark-yank-point)
12941 (defvar bookmark-current-buffer)
12943 (defun gnus-summary-bookmark-make-record ()
12944 "Make a bookmark entry for a Gnus summary buffer."
12946 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
12947 (save-restriction ; FIXME is it necessary to widen?
12948 (widen) (setq pos (point))) ; Set position in gnus-article buffer.
12949 (setq buf "art") ; We are recording bookmark from article buffer.
12950 (setq bookmark-yank-point (point))
12951 (setq bookmark-current-buffer (current-buffer))
12952 (gnus-article-show-summary)) ; Go back in summary buffer.
12953 ;; We are now recording bookmark from summary buffer.
12954 (unless buf (setq buf "sum"))
12955 (let* ((subject (elt (gnus-summary-article-header) 1))
12956 (grp (car gnus-article-current))
12957 (art (cdr gnus-article-current))
12958 (head (gnus-summary-article-header art))
12959 (id (mail-header-id head)))
12961 ,@(condition-case nil
12962 (bookmark-make-record-default 'no-file 'no-context pos)
12963 (wrong-number-of-arguments
12964 (bookmark-make-record-default 'point-only)))
12965 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
12966 (group . ,grp) (article . ,art)
12967 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
12970 (defun gnus-summary-bookmark-jump (bookmark)
12971 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12972 BOOKMARK is a bookmark name or a bookmark record."
12973 (let ((group (bookmark-prop-get bookmark 'group))
12974 (article (bookmark-prop-get bookmark 'article))
12975 (id (bookmark-prop-get bookmark 'message-id))
12976 (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
12977 (gnus-fetch-group group (list article))
12978 (gnus-summary-insert-cached-articles)
12979 (gnus-summary-goto-article id nil 'force)
12980 ;; FIXME we have to wait article buffer is ready (only large buffer)
12981 ;; Is there a better solution to know that?
12982 ;; If we don't wait `bookmark-default-handler' will have no chance
12983 ;; to set position. However there is no error, just wrong pos.
12985 (when (string= buf "Gnus-art")
12987 (bookmark-default-handler
12989 (buffer . ,(current-buffer))
12990 . ,(bookmark-get-bookmark-record bookmark)))))
12992 (gnus-summary-make-all-marking-commands)
12994 (gnus-ems-redefine)
12996 (provide 'gnus-sum)
12998 (run-hooks 'gnus-sum-load-hook)
13000 ;; Local Variables:
13004 ;;; gnus-sum.el ends here