1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (unless (fboundp 'declare-function
) (defmacro declare-function
(&rest r
))))
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
)
63 (defcustom gnus-kill-summary-on-exit t
64 "*If non-nil, kill the summary buffer when you exit from it.
65 If nil, the summary will become a \"*Dead Summary*\" buffer, and
66 it will be killed sometime later."
67 :group
'gnus-summary-exit
70 (defcustom gnus-summary-next-group-on-exit t
71 "If non-nil, go to the next unread newsgroup on summary exit.
72 See `gnus-group-goto-unread'."
73 :link
'(custom-manual "(gnus)Group Maneuvering")
74 :group
'gnus-summary-exit
75 :version
"23.1" ;; No Gnus
78 (defcustom gnus-fetch-old-headers nil
79 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
80 If an unread article in the group refers to an older, already
81 read (or just marked as read) article, the old article will not
82 normally be displayed in the Summary buffer. If this variable is
83 t, Gnus will attempt to grab the headers to the old articles, and
84 thereby build complete threads. If it has the value `some', all
85 old headers will be fetched but only enough headers to connect
86 otherwise loose threads will be displayed. This variable can
87 also be a number. In that case, no more than that number of old
88 headers will be fetched. If it has the value `invisible', all
89 old headers will be fetched, but none will be displayed.
91 The server has to support NOV for any of this to work.
93 This feature can seriously impact performance it ignores all
94 locally cached header entries."
96 :type
'(choice (const :tag
"off" nil
)
101 (sexp :menu-tag
"other" t
)))
103 (defcustom gnus-refer-thread-limit
500
104 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
105 If t, fetch all the available old headers."
107 :type
'(choice number
108 (sexp :menu-tag
"other" t
)))
110 (defcustom gnus-summary-make-false-root
'adopt
111 "*nil means that Gnus won't gather loose threads.
112 If the root of a thread has expired or been read in a previous
113 session, the information necessary to build a complete thread has been
114 lost. Instead of having many small sub-threads from this original thread
115 scattered all over the summary buffer, Gnus can gather them.
117 If non-nil, Gnus will try to gather all loose sub-threads from an
118 original thread into one large thread.
120 If this variable is non-nil, it should be one of `none', `adopt',
123 If this variable is `none', Gnus will not make a false root, but just
124 present the sub-threads after another.
125 If this variable is `dummy', Gnus will create a dummy root that will
126 have all the sub-threads as children.
127 If this variable is `adopt', Gnus will make one of the \"children\"
128 the parent and mark all the step-children as such.
129 If this variable is `empty', the \"children\" are printed with empty
130 subject fields. (Or rather, they will be printed with a string
131 given by the `gnus-summary-same-subject' variable.)"
133 :type
'(choice (const :tag
"off" nil
)
139 (defcustom gnus-summary-make-false-root-always nil
140 "Always make a false dummy root."
145 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
146 "*A regexp to match subjects to be excluded from loose thread gathering.
147 As loose thread gathering is done on subjects only, that means that
148 there can be many false gatherings performed. By rooting out certain
149 common subjects, gathering might become saner."
153 (defcustom gnus-summary-gather-subject-limit nil
154 "*Maximum length of subject comparisons when gathering loose threads.
155 Use nil to compare full subjects. Setting this variable to a low
156 number will help gather threads that have been corrupted by
157 newsreaders chopping off subject lines, but it might also mean that
158 unrelated articles that have subject that happen to begin with the
159 same few characters will be incorrectly gathered.
161 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
164 :type
'(choice (const :tag
"off" nil
)
166 (sexp :menu-tag
"on" t
)))
168 (defcustom gnus-simplify-subject-functions nil
169 "List of functions taking a string argument that simplify subjects.
170 The functions are applied recursively.
172 Useful functions to put in this list include:
173 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
174 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
176 :type
'(repeat function
))
178 (defcustom gnus-simplify-ignored-prefixes nil
179 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
181 :type
'(choice (const :tag
"off" nil
)
184 (defcustom gnus-build-sparse-threads nil
185 "*If non-nil, fill in the gaps in threads.
186 If `some', only fill in the gaps that are needed to tie loose threads
187 together. If `more', fill in all leaf nodes that Gnus can find. If
188 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
190 :type
'(choice (const :tag
"off" nil
)
193 (sexp :menu-tag
"all" t
)))
195 (defcustom gnus-summary-thread-gathering-function
196 'gnus-gather-threads-by-subject
197 "*Function used for gathering loose threads.
198 There are two pre-defined functions: `gnus-gather-threads-by-subject',
199 which only takes Subjects into consideration; and
200 `gnus-gather-threads-by-references', which compared the References
201 headers of the articles to find matches."
203 :type
'(radio (function-item gnus-gather-threads-by-subject
)
204 (function-item gnus-gather-threads-by-references
)
205 (function :tag
"other")))
207 (defcustom gnus-summary-same-subject
""
208 "*String indicating that the current article has the same subject as the previous.
209 This variable will only be used if the value of
210 `gnus-summary-make-false-root' is `empty'."
211 :group
'gnus-summary-format
214 (defcustom gnus-summary-goto-unread t
215 "*If t, many commands will go to the next unread article.
216 This applies to marking commands as well as other commands that
217 \"naturally\" select the next article, like, for instance, `SPC' at
218 the end of an article.
220 If nil, the marking commands do NOT go to the next unread article
221 \(they go to the next article instead). If `never', commands that
222 usually go to the next unread article, will go to the next article,
223 whether it is read or not."
224 :group
'gnus-summary-marks
225 :link
'(custom-manual "(gnus)Setting Marks")
226 :type
'(choice (const :tag
"off" nil
)
228 (sexp :menu-tag
"on" t
)))
230 (defcustom gnus-summary-default-score
0
231 "*Default article score level.
232 All scores generated by the score files will be added to this score.
233 If this variable is nil, scoring will be disabled."
234 :group
'gnus-score-default
235 :type
'(choice (const :tag
"disable")
238 (defcustom gnus-summary-default-high-score
0
239 "*Default threshold for a high scored article.
240 An article will be highlighted as high scored if its score is greater
243 :group
'gnus-score-default
246 (defcustom gnus-summary-default-low-score
0
247 "*Default threshold for a low scored article.
248 An article will be highlighted as low scored if its score is smaller
251 :group
'gnus-score-default
254 (defcustom gnus-summary-zcore-fuzz
0
255 "*Fuzziness factor for the zcore in the summary buffer.
256 Articles with scores closer than this to `gnus-summary-default-score'
258 :group
'gnus-summary-format
261 (defcustom gnus-simplify-subject-fuzzy-regexp nil
262 "*Strings to be removed when doing fuzzy matches.
263 This can either be a regular expression or list of regular expressions
264 that will be removed from subject strings if fuzzy subject
265 simplification is selected."
267 :type
'(repeat regexp
))
269 (defcustom gnus-show-threads t
270 "*If non-nil, display threads in summary mode."
274 (defcustom gnus-thread-hide-subtree nil
275 "*If non-nil, hide all threads initially.
276 This can be a predicate specifier which says which threads to hide.
277 If threads are hidden, you have to run the command
278 `gnus-summary-show-thread' by hand or select an article."
280 :type
'(radio (sexp :format
"Non-nil\n"
281 :match
(lambda (widget value
)
282 (not (or (consp value
) (functionp value
))))
285 (sexp :tag
"Predicate specifier")))
287 (defcustom gnus-thread-hide-killed t
288 "*If non-nil, hide killed threads automatically."
292 (defcustom gnus-thread-ignore-subject t
293 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
294 If nil, articles that have different subjects from their parents will
295 start separate threads."
299 (defcustom gnus-thread-operation-ignore-subject t
300 "*If non-nil, subjects will be ignored when doing thread commands.
301 This affects commands like `gnus-summary-kill-thread' and
302 `gnus-summary-lower-thread'.
304 If this variable is nil, articles in the same thread with different
305 subjects will not be included in the operation in question. If this
306 variable is `fuzzy', only articles that have subjects that are fuzzily
307 equal will be included."
309 :type
'(choice (const :tag
"off" nil
)
313 (defcustom gnus-thread-indent-level
4
314 "*Number that says how much each sub-thread should be indented."
318 (defcustom gnus-auto-extend-newsgroup t
319 "*If non-nil, extend newsgroup forward and backward when requested."
320 :group
'gnus-summary-choose
323 (defcustom gnus-auto-select-first t
324 "If non-nil, select an article on group entry.
325 An article is selected automatically when entering a group
326 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
327 `gnus-summary-catchup-and-goto-next-group'.
329 Which article is selected is controlled by the variable
330 `gnus-auto-select-subject'.
332 If you want to prevent automatic selection of articles in some
333 newsgroups, set the variable to nil in `gnus-select-group-hook'."
334 ;; Commands include...
335 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
336 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
337 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
338 :group
'gnus-group-select
339 :type
'(choice (const :tag
"none" nil
)
340 (sexp :menu-tag
"first" t
)))
342 (defcustom gnus-auto-select-subject
'unread
343 "*Says what subject to place under point when entering a group.
345 This variable can either be the symbols `first' (place point on the
346 first subject), `unread' (place point on the subject line of the first
347 unread article), `best' (place point on the subject line of the
348 higest-scored article), `unseen' (place point on the subject line of
349 the first unseen article), `unseen-or-unread' (place point on the subject
350 line of the first unseen article or, if all article have been seen, on the
351 subject line of the first unread article), or a function to be called to
352 place point on some subject line."
354 :group
'gnus-group-select
355 :type
'(choice (const best
)
359 (const unseen-or-unread
)))
361 (defcustom gnus-auto-select-next t
362 "*If non-nil, offer to go to the next group from the end of the previous.
363 If the value is t and the next newsgroup is empty, Gnus will exit
364 summary mode and go back to group mode. If the value is neither nil
365 nor t, Gnus will select the following unread newsgroup. In
366 particular, if the value is the symbol `quietly', the next unread
367 newsgroup will be selected without any confirmation, and if it is
368 `almost-quietly', the next group will be selected without any
369 confirmation if you are located on the last article in the group.
370 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
371 will go to the next group without confirmation."
372 :group
'gnus-summary-maneuvering
373 :type
'(choice (const :tag
"off" nil
)
375 (const almost-quietly
)
376 (const slightly-quietly
)
377 (sexp :menu-tag
"on" t
)))
379 (defcustom gnus-auto-select-same nil
380 "*If non-nil, select the next article with the same subject.
381 If there are no more articles with the same subject, go to
382 the first unread article."
383 :group
'gnus-summary-maneuvering
386 (defcustom gnus-auto-select-on-ephemeral-exit
'next-noselect
387 "What article should be selected after exiting an ephemeral group.
388 Valid values include:
391 Select the next article.
393 Select the next unread article.
395 Move the cursor to the next article. This is the default.
396 `next-unread-noselect'
397 Move the cursor to the next unread article.
399 If it has any other value or there is no next (unread) article, the
400 article selected before entering to the ephemeral group will appear."
401 :version
"23.1" ;; No Gnus
402 :group
'gnus-summary-maneuvering
403 :type
'(choice :format
"%{%t%}:\n %[Value Menu%] %v"
404 (const next
) (const next-unread
)
405 (const next-noselect
) (const next-unread-noselect
)
406 (sexp :tag
"other" :value nil
)))
408 (defcustom gnus-auto-goto-ignores
'unfetched
409 "*Says how to handle unfetched articles when maneuvering.
411 This variable can either be the symbols nil (maneuver to any
412 article), `undownloaded' (maneuvering while unplugged ignores articles
413 that have not been fetched), `always-undownloaded' (maneuvering always
414 ignores articles that have not been fetched), `unfetched' (maneuvering
415 ignores articles whose headers have not been fetched).
417 NOTE: The list of unfetched articles will always be nil when plugged
418 and, when unplugged, a subset of the undownloaded article list."
420 :group
'gnus-summary-maneuvering
421 :type
'(choice (const :tag
"None" nil
)
422 (const :tag
"Undownloaded when unplugged" undownloaded
)
423 (const :tag
"Undownloaded" always-undownloaded
)
424 (const :tag
"Unfetched" unfetched
)))
426 (defcustom gnus-summary-check-current nil
427 "*If non-nil, consider the current article when moving.
428 The \"unread\" movement commands will stay on the same line if the
429 current article is unread."
430 :group
'gnus-summary-maneuvering
433 (defcustom gnus-auto-center-summary
2
434 "*If non-nil, always center the current summary buffer.
435 In particular, if `vertical' do only vertical recentering. If non-nil
436 and non-`vertical', do both horizontal and vertical recentering."
437 :group
'gnus-summary-maneuvering
438 :type
'(choice (const :tag
"none" nil
)
440 (integer :tag
"height")
441 (sexp :menu-tag
"both" t
)))
443 (defvar gnus-auto-center-group t
444 "*If non-nil, always center the group buffer.")
446 (defcustom gnus-show-all-headers nil
447 "*If non-nil, don't hide any headers."
448 :group
'gnus-article-hiding
449 :group
'gnus-article-headers
452 (defcustom gnus-summary-ignore-duplicates nil
453 "*If non-nil, ignore articles with identical Message-ID headers."
457 (defcustom gnus-single-article-buffer t
458 "*If non-nil, display all articles in the same buffer.
459 If nil, each group will get its own article buffer."
460 :group
'gnus-article-various
463 (defcustom gnus-break-pages t
464 "*If non-nil, do page breaking on articles.
465 The page delimiter is specified by the `gnus-page-delimiter'
467 :group
'gnus-article-various
470 (defcustom gnus-move-split-methods nil
471 "*Variable used to suggest where articles are to be moved to.
472 It uses the same syntax as the `gnus-split-methods' variable.
473 However, whereas `gnus-split-methods' specifies file names as targets,
474 this variable specifies group names."
475 :group
'gnus-summary-mail
476 :type
'(repeat (choice (list :value
(fun) function
)
477 (cons :value
("" "") regexp
(repeat string
))
480 (defcustom gnus-move-group-prefix-function
'gnus-group-real-prefix
481 "Function used to compute default prefix for article move/copy/etc prompts.
482 The function should take one argument, a group name, and return a
483 string with the suggested prefix."
484 :group
'gnus-summary-mail
487 ;; FIXME: Although the custom type is `character' for the following variables,
488 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
490 (defcustom gnus-unread-mark ?
;Whitespace
491 "*Mark used for unread articles."
492 :group
'gnus-summary-marks
495 (defcustom gnus-ticked-mark ?
!
496 "*Mark used for ticked articles."
497 :group
'gnus-summary-marks
500 (defcustom gnus-dormant-mark ??
501 "*Mark used for dormant articles."
502 :group
'gnus-summary-marks
505 (defcustom gnus-del-mark ?r
506 "*Mark used for del'd articles."
507 :group
'gnus-summary-marks
510 (defcustom gnus-read-mark ?R
511 "*Mark used for read articles."
512 :group
'gnus-summary-marks
515 (defcustom gnus-expirable-mark ?E
516 "*Mark used for expirable articles."
517 :group
'gnus-summary-marks
520 (defcustom gnus-killed-mark ?K
521 "*Mark used for killed articles."
522 :group
'gnus-summary-marks
525 (defcustom gnus-spam-mark ?$
526 "*Mark used for spam articles."
528 :group
'gnus-summary-marks
531 (defcustom gnus-souped-mark ?F
532 "*Mark used for souped articles."
533 :group
'gnus-summary-marks
536 (defcustom gnus-kill-file-mark ?X
537 "*Mark used for articles killed by kill files."
538 :group
'gnus-summary-marks
541 (defcustom gnus-low-score-mark ?Y
542 "*Mark used for articles with a low score."
543 :group
'gnus-summary-marks
546 (defcustom gnus-catchup-mark ?C
547 "*Mark used for articles that are caught up."
548 :group
'gnus-summary-marks
551 (defcustom gnus-replied-mark ?A
552 "*Mark used for articles that have been replied to."
553 :group
'gnus-summary-marks
556 (defcustom gnus-forwarded-mark ?F
557 "*Mark used for articles that have been forwarded."
559 :group
'gnus-summary-marks
562 (defcustom gnus-recent-mark ?N
563 "*Mark used for articles that are recent."
565 :group
'gnus-summary-marks
568 (defcustom gnus-cached-mark ?
*
569 "*Mark used for articles that are in the cache."
570 :group
'gnus-summary-marks
573 (defcustom gnus-saved-mark ?S
574 "*Mark used for articles that have been saved."
575 :group
'gnus-summary-marks
578 (defcustom gnus-unseen-mark ?.
579 "*Mark used for articles that haven't been seen."
581 :group
'gnus-summary-marks
584 (defcustom gnus-no-mark ?
;Whitespace
585 "*Mark used for articles that have no other secondary mark."
587 :group
'gnus-summary-marks
590 (defcustom gnus-ancient-mark ?O
591 "*Mark used for ancient articles."
592 :group
'gnus-summary-marks
595 (defcustom gnus-sparse-mark ?Q
596 "*Mark used for sparsely reffed articles."
597 :group
'gnus-summary-marks
600 (defcustom gnus-canceled-mark ?G
601 "*Mark used for canceled articles."
602 :group
'gnus-summary-marks
605 (defcustom gnus-duplicate-mark ?M
606 "*Mark used for duplicate articles."
607 :group
'gnus-summary-marks
610 (defcustom gnus-undownloaded-mark ?-
611 "*Mark used for articles that weren't downloaded."
613 :group
'gnus-summary-marks
616 (defcustom gnus-downloaded-mark ?
+
617 "*Mark used for articles that were downloaded."
618 :group
'gnus-summary-marks
621 (defcustom gnus-downloadable-mark ?%
622 "*Mark used for articles that are to be downloaded."
623 :group
'gnus-summary-marks
626 (defcustom gnus-unsendable-mark ?
=
627 "*Mark used for articles that won't be sent."
628 :group
'gnus-summary-marks
631 (defcustom gnus-score-over-mark ?
+
632 "*Score mark used for articles with high scores."
633 :group
'gnus-summary-marks
636 (defcustom gnus-score-below-mark ?-
637 "*Score mark used for articles with low scores."
638 :group
'gnus-summary-marks
641 (defcustom gnus-empty-thread-mark ?
;Whitespace
642 "*There is no thread under the article."
643 :group
'gnus-summary-marks
646 (defcustom gnus-not-empty-thread-mark ?
=
647 "*There is a thread under the article."
648 :group
'gnus-summary-marks
651 (defcustom gnus-view-pseudo-asynchronously nil
652 "*If non-nil, Gnus will view pseudo-articles asynchronously."
653 :group
'gnus-extract-view
656 (defcustom gnus-auto-expirable-marks
657 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
658 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
659 gnus-souped-mark gnus-duplicate-mark
)
660 "*The list of marks converted into expiration if a group is auto-expirable."
663 :type
'(repeat character
))
665 (defcustom gnus-inhibit-user-auto-expire t
666 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
671 (defcustom gnus-view-pseudos nil
672 "*If `automatic', pseudo-articles will be viewed automatically.
673 If `not-confirm', pseudos will be viewed automatically, and the user
674 will not be asked to confirm the command."
675 :group
'gnus-extract-view
676 :type
'(choice (const :tag
"off" nil
)
678 (const not-confirm
)))
680 (defcustom gnus-view-pseudos-separately t
681 "*If non-nil, one pseudo-article will be created for each file to be viewed.
682 If nil, all files that use the same viewing command will be given as a
683 list of parameters to that command."
684 :group
'gnus-extract-view
687 (defcustom gnus-insert-pseudo-articles t
688 "*If non-nil, insert pseudo-articles when decoding articles."
689 :group
'gnus-extract-view
692 (defcustom gnus-summary-dummy-line-format
694 "*The format specification for the dummy roots in the summary buffer.
695 It works along the same lines as a normal formatting string,
696 with some simple extensions.
700 General format specifiers can also be used.
701 See `(gnus)Formatting Variables'."
702 :link
'(custom-manual "(gnus)Formatting Variables")
703 :group
'gnus-threading
706 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
707 "*The format specification for the summary mode line.
708 It works along the same lines as a normal formatting string,
709 with some simple extensions:
712 %p Unprefixed group name
713 %A Current article number
714 %z Current article score
716 %U Number of unread articles in the group
717 %e Number of unselected articles in the group
718 %Z A string with unread/unselected article counts
719 %g Shortish group name
720 %S Subject of the current article
722 %s Current score file name
723 %d Number of dormant articles
724 %r Number of articles that have been marked as read in this session
725 %E Number of articles expunged by the score files"
726 :group
'gnus-summary-format
729 (defcustom gnus-list-identifiers nil
730 "Regexp that matches list identifiers to be removed from subject.
731 This can also be a list of regexps."
733 :group
'gnus-summary-format
734 :group
'gnus-article-hiding
735 :type
'(choice (const :tag
"none" nil
)
737 (repeat :value
(".*") regexp
)))
739 (defcustom gnus-summary-mark-below
0
740 "*Mark all articles with a score below this variable as read.
741 This variable is local to each summary buffer and usually set by the
743 :group
'gnus-score-default
746 (defun gnus-widget-reversible-match (widget value
)
747 "Ignoring WIDGET, convert VALUE to internal form.
748 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
752 (eq (length value
) 2)
753 (eq (nth 0 value
) 'not
)
754 (symbolp (nth 1 value
)))))
756 (defun gnus-widget-reversible-to-internal (widget value
)
757 "Ignoring WIDGET, convert VALUE to internal form.
758 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
759 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
763 (list (nth 1 value
) t
)))
765 (defun gnus-widget-reversible-to-external (widget value
)
766 "Ignoring WIDGET, convert VALUE to external form.
767 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
768 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
771 (list 'not
(nth 0 value
))
774 (define-widget 'gnus-widget-reversible
'group
775 "A `group' that convert values."
776 :match
'gnus-widget-reversible-match
777 :value-to-internal
'gnus-widget-reversible-to-internal
778 :value-to-external
'gnus-widget-reversible-to-external
)
780 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
781 "*List of functions used for sorting articles in the summary buffer.
783 Each function takes two articles and returns non-nil if the first
784 article should be sorted before the other. If you use more than one
785 function, the primary sort function should be the last. You should
786 probably always include `gnus-article-sort-by-number' in the list of
787 sorting functions -- preferably first. Also note that sorting by date
788 is often much slower than sorting by number, and the sorting order is
789 very similar. (Sorting by date means sorting by the time the message
790 was sent, sorting by number means sorting by arrival time.)
792 Each item can also be a list `(not F)' where F is a function;
793 this reverses the sort order.
795 Ready-made functions include `gnus-article-sort-by-number',
796 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
797 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
798 and `gnus-article-sort-by-score'.
800 When threading is turned on, the variable `gnus-thread-sort-functions'
801 controls how articles are sorted."
802 :group
'gnus-summary-sort
803 :type
'(repeat (gnus-widget-reversible
804 (choice (function-item gnus-article-sort-by-number
)
805 (function-item gnus-article-sort-by-author
)
806 (function-item gnus-article-sort-by-subject
)
807 (function-item gnus-article-sort-by-date
)
808 (function-item gnus-article-sort-by-score
)
809 (function-item gnus-article-sort-by-random
)
810 (function :tag
"other"))
811 (boolean :tag
"Reverse order"))))
814 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
815 "*List of functions used for sorting threads in the summary buffer.
816 By default, threads are sorted by article number.
818 Each function takes two threads and returns non-nil if the first
819 thread should be sorted before the other. If you use more than one
820 function, the primary sort function should be the last. You should
821 probably always include `gnus-thread-sort-by-number' in the list of
822 sorting functions -- preferably first. Also note that sorting by date
823 is often much slower than sorting by number, and the sorting order is
824 very similar. (Sorting by date means sorting by the time the message
825 was sent, sorting by number means sorting by arrival time.)
827 Each list item can also be a list `(not F)' where F is a
828 function; this specifies reversed sort order.
830 Ready-made functions include `gnus-thread-sort-by-number',
831 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
832 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
833 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
834 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
835 and `gnus-thread-sort-by-total-score' (see
836 `gnus-thread-score-function').
838 When threading is turned off, the variable
839 `gnus-article-sort-functions' controls how articles are sorted."
840 :group
'gnus-summary-sort
842 (gnus-widget-reversible
843 (choice (function-item gnus-thread-sort-by-number
)
844 (function-item gnus-thread-sort-by-author
)
845 (function-item gnus-thread-sort-by-recipient
)
846 (function-item gnus-thread-sort-by-subject
)
847 (function-item gnus-thread-sort-by-date
)
848 (function-item gnus-thread-sort-by-score
)
849 (function-item gnus-thread-sort-by-most-recent-number
)
850 (function-item gnus-thread-sort-by-most-recent-date
)
851 (function-item gnus-thread-sort-by-random
)
852 (function-item gnus-thread-sort-by-total-score
)
853 (function :tag
"other"))
854 (boolean :tag
"Reverse order"))))
856 (defcustom gnus-thread-score-function
'+
857 "*Function used for calculating the total score of a thread.
859 The function is called with the scores of the article and each
860 subthread and should then return the score of the thread.
862 Some functions you can use are `+', `max', or `min'."
863 :group
'gnus-summary-sort
866 (defcustom gnus-summary-expunge-below nil
867 "All articles that have a score less than this variable will be expunged.
868 This variable is local to the summary buffers."
869 :group
'gnus-score-default
870 :type
'(choice (const :tag
"off" nil
)
873 (defcustom gnus-thread-expunge-below nil
874 "All threads that have a total score less than this variable will be expunged.
875 See `gnus-thread-score-function' for en explanation of what a
878 This variable is local to the summary buffers."
879 :group
'gnus-threading
880 :group
'gnus-score-default
881 :type
'(choice (const :tag
"off" nil
)
884 (defcustom gnus-summary-mode-hook nil
885 "*A hook for Gnus summary mode.
886 This hook is run before any variables are set in the summary buffer."
887 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
888 :group
'gnus-summary-various
891 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
892 (when (featurep 'xemacs
)
893 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
894 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
895 (add-hook 'gnus-summary-mode-hook
896 'gnus-xmas-switch-horizontal-scrollbar-off
))
898 (defcustom gnus-summary-menu-hook nil
899 "*Hook run after the creation of the summary mode menu."
900 :group
'gnus-summary-visual
903 (defcustom gnus-summary-exit-hook nil
904 "*A hook called on exit from the summary buffer.
905 It will be called with point in the group buffer."
906 :group
'gnus-summary-exit
909 (defcustom gnus-summary-prepare-hook nil
910 "*A hook called after the summary buffer has been generated.
911 If you want to modify the summary buffer, you can use this hook."
912 :group
'gnus-summary-various
915 (defcustom gnus-summary-prepared-hook nil
916 "*A hook called as the last thing after the summary buffer has been generated."
917 :group
'gnus-summary-various
920 (defcustom gnus-summary-generate-hook nil
921 "*A hook run just before generating the summary buffer.
922 This hook is commonly used to customize threading variables and the
924 :group
'gnus-summary-various
927 (defcustom gnus-select-group-hook nil
928 "*A hook called when a newsgroup is selected.
930 If you'd like to simplify subjects like the
931 `gnus-summary-next-same-subject' command does, you can use the
934 (add-hook gnus-select-group-hook
936 (mapcar (lambda (header)
937 (mail-header-set-subject
939 (gnus-simplify-subject
940 (mail-header-subject header) 're-only)))
941 gnus-newsgroup-headers)))"
942 :group
'gnus-group-select
945 (defcustom gnus-select-article-hook nil
946 "*A hook called when an article is selected."
947 :group
'gnus-summary-choose
948 :options
'(gnus-agent-fetch-selected-article)
951 (defcustom gnus-visual-mark-article-hook
952 (list 'gnus-highlight-selected-summary
)
953 "*Hook run after selecting an article in the summary buffer.
954 It is meant to be used for highlighting the article in some way. It
955 is not run if `gnus-visual' is nil."
956 :group
'gnus-summary-visual
959 (defcustom gnus-parse-headers-hook nil
960 "*A hook called before parsing the headers."
964 (defcustom gnus-exit-group-hook nil
965 "*A hook called when exiting summary mode.
966 This hook is not called from the non-updating exit commands like `Q'."
970 (defcustom gnus-summary-update-hook
971 (list 'gnus-summary-highlight-line
)
972 "*A hook called when a summary line is changed.
973 The hook will not be called if `gnus-visual' is nil.
975 The default function `gnus-summary-highlight-line' will
976 highlight the line according to the `gnus-summary-highlight'
978 :group
'gnus-summary-visual
981 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
982 "*A hook called when an article is selected for the first time.
983 The hook is intended to mark an article as read (or unread)
984 automatically when it is selected."
985 :group
'gnus-summary-choose
988 (defcustom gnus-group-no-more-groups-hook nil
989 "*A hook run when returning to group mode having no more (unread) groups."
990 :group
'gnus-group-select
993 (defcustom gnus-ps-print-hook nil
994 "*A hook run before ps-printing something from Gnus."
998 (defcustom gnus-summary-article-move-hook nil
999 "*A hook called after an article is moved, copied, respooled, or crossposted."
1001 :group
'gnus-summary
1004 (defcustom gnus-summary-article-delete-hook nil
1005 "*A hook called after an article is deleted."
1007 :group
'gnus-summary
1010 (defcustom gnus-summary-article-expire-hook nil
1011 "*A hook called after an article is expired."
1013 :group
'gnus-summary
1016 (defcustom gnus-summary-display-arrow
1017 (and (fboundp 'display-graphic-p
)
1018 (display-graphic-p))
1019 "*If non-nil, display an arrow highlighting the current article."
1021 :group
'gnus-summary
1024 (defcustom gnus-summary-selected-face
'gnus-summary-selected
1025 "Face used for highlighting the current article in the summary buffer."
1026 :group
'gnus-summary-visual
1029 (defvar gnus-tmp-downloaded nil
)
1031 (defcustom gnus-summary-highlight
1032 '(((eq mark gnus-canceled-mark
)
1033 . gnus-summary-cancelled
)
1034 ((and uncached
(> score default-high
))
1035 . gnus-summary-high-undownloaded
)
1036 ((and uncached
(< score default-low
))
1037 . gnus-summary-low-undownloaded
)
1039 . gnus-summary-normal-undownloaded
)
1040 ((and (> score default-high
)
1041 (or (eq mark gnus-dormant-mark
)
1042 (eq mark gnus-ticked-mark
)))
1043 . gnus-summary-high-ticked
)
1044 ((and (< score default-low
)
1045 (or (eq mark gnus-dormant-mark
)
1046 (eq mark gnus-ticked-mark
)))
1047 . gnus-summary-low-ticked
)
1048 ((or (eq mark gnus-dormant-mark
)
1049 (eq mark gnus-ticked-mark
))
1050 . gnus-summary-normal-ticked
)
1051 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
1052 . gnus-summary-high-ancient
)
1053 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
1054 . gnus-summary-low-ancient
)
1055 ((eq mark gnus-ancient-mark
)
1056 . gnus-summary-normal-ancient
)
1057 ((and (> score default-high
) (eq mark gnus-unread-mark
))
1058 . gnus-summary-high-unread
)
1059 ((and (< score default-low
) (eq mark gnus-unread-mark
))
1060 . gnus-summary-low-unread
)
1061 ((eq mark gnus-unread-mark
)
1062 . gnus-summary-normal-unread
)
1063 ((> score default-high
)
1064 . gnus-summary-high-read
)
1065 ((< score default-low
)
1066 . gnus-summary-low-read
)
1068 . gnus-summary-normal-read
))
1069 "*Controls the highlighting of summary buffer lines.
1071 A list of (FORM . FACE) pairs. When deciding how a particular
1072 summary line should be displayed, each form is evaluated. The content
1073 of the face field after the first true form is used. You can change
1074 how those summary lines are displayed, by editing the face field.
1076 You can use the following variables in the FORM field.
1078 score: The article's score.
1079 default: The default article score.
1080 default-high: The default score for high scored articles.
1081 default-low: The default score for low scored articles.
1082 below: The score below which articles are automatically marked as read.
1083 mark: The article's mark.
1084 uncached: Non-nil if the article is uncached."
1085 :group
'gnus-summary-visual
1086 :type
'(repeat (cons (sexp :tag
"Form" nil
)
1088 (put 'gnus-summary-highlight
'risky-local-variable t
)
1090 (defcustom gnus-alter-header-function nil
1091 "Function called to allow alteration of article header structures.
1092 The function is called with one parameter, the article header vector,
1093 which it may alter in any way."
1094 :type
'(choice (const :tag
"None" nil
)
1096 :group
'gnus-summary
)
1098 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
1099 "Function used to decode a string with encoded words.")
1101 (defvar gnus-decode-encoded-address-function
1102 'mail-decode-encoded-address-string
1103 "Function used to decode addresses with encoded words.")
1105 (defcustom gnus-extra-headers
'(To Newsgroups
)
1106 "*Extra headers to parse."
1108 :group
'gnus-summary
1109 :type
'(repeat symbol
))
1111 (defcustom gnus-ignored-from-addresses
1112 (and user-mail-address
1113 (not (string= user-mail-address
""))
1114 (regexp-quote user-mail-address
))
1115 "*From headers that may be suppressed in favor of To headers.
1116 This can be a regexp or a list of regexps."
1118 :group
'gnus-summary
1119 :type
'(choice regexp
1120 (repeat :tag
"Regexp List" regexp
)))
1122 (defsubst gnus-ignored-from-addresses
()
1123 (gmm-regexp-concat gnus-ignored-from-addresses
))
1125 (defcustom gnus-summary-to-prefix
"-> "
1126 "*String prefixed to the To field in the summary line when
1127 using `gnus-ignored-from-addresses'."
1129 :group
'gnus-summary
1132 (defcustom gnus-summary-newsgroup-prefix
"=> "
1133 "*String prefixed to the Newsgroup field in the summary
1134 line when using `gnus-ignored-from-addresses'."
1136 :group
'gnus-summary
1139 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1140 "List of charsets that should be ignored.
1141 When these charsets are used in the \"charset\" parameter, the
1142 default charset will be used instead."
1144 :type
'(repeat symbol
)
1145 :group
'gnus-charset
)
1147 (defcustom gnus-newsgroup-maximum-articles nil
1148 "The maximum number of articles a newsgroup.
1149 If this is a number, old articles in a newsgroup exceeding this number
1150 are silently ignored. If it is nil, no article is ignored. Note that
1151 setting this variable to a number might prevent you from reading very
1153 :group
'gnus-group-select
1155 :type
'(choice (const :tag
"No limit" nil
)
1158 (gnus-define-group-parameter
1162 "Return the ignored charsets of GROUP."
1163 :variable gnus-group-ignored-charsets-alist
1165 '(("alt\\.chinese\\.text" iso-8859-1
))
1167 "Alist of regexps (to match group names) and charsets that should be ignored.
1168 When these charsets are used in the \"charset\" parameter, the
1169 default charset will be used instead."
1170 :variable-group gnus-charset
1171 :variable-type
'(repeat (cons (regexp :tag
"Group")
1173 :parameter-type
'(choice :tag
"Ignored charsets"
1176 :parameter-document
"\
1177 List of charsets that should be ignored.
1179 When these charsets are used in the \"charset\" parameter, the
1180 default charset will be used instead.")
1182 (defcustom gnus-group-highlight-words-alist nil
1183 "Alist of group regexps and highlight regexps.
1184 This variable uses the same syntax as `gnus-emphasis-alist'."
1186 :type
'(repeat (cons (regexp :tag
"Group")
1187 (repeat (list (regexp :tag
"Highlight regexp")
1188 (number :tag
"Group for entire word" 0)
1189 (number :tag
"Group for displayed part" 0)
1191 gnus-emphasis-highlight-words
)))))
1192 :group
'gnus-summary-visual
)
1194 (defcustom gnus-summary-show-article-charset-alist
1196 "Alist of number and charset.
1197 The article will be shown with the charset corresponding to the
1199 For example: ((1 . cn-gb-2312) (2 . big5))."
1201 :type
'(repeat (cons (number :tag
"Argument" 1)
1202 (symbol :tag
"Charset")))
1203 :group
'gnus-charset
)
1205 (defcustom gnus-preserve-marks t
1206 "Whether marks are preserved when moving, copying and respooling messages."
1209 :group
'gnus-summary-marks
)
1211 (defcustom gnus-alter-articles-to-read-function nil
1212 "Function to be called to alter the list of articles to be selected."
1213 :type
'(choice (const nil
) function
)
1214 :group
'gnus-summary
)
1216 (defcustom gnus-orphan-score nil
1217 "*All orphans get this score added. Set in the score file."
1218 :group
'gnus-score-default
1219 :type
'(choice (const nil
)
1222 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1223 "*A regexp to match MIME parts when saving multiple parts of a
1224 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1225 This regexp will be used by default when prompting the user for which
1226 type of files to save."
1227 :group
'gnus-summary
1230 (defcustom gnus-read-all-available-headers nil
1231 "Whether Gnus should parse all headers made available to it.
1232 This is mostly relevant for slow back ends where the user may
1233 wish to widen the summary buffer to include all headers
1234 that were fetched. Say, for nnultimate groups."
1236 :group
'gnus-summary
1237 :type
'(choice boolean regexp
))
1239 (defcustom gnus-summary-muttprint-program
"muttprint"
1240 "Command (and optional arguments) used to run Muttprint."
1242 :group
'gnus-summary
1245 (defcustom gnus-article-loose-mime t
1246 "If non-nil, don't require MIME-Version header.
1247 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1248 supply the MIME-Version header or deliberately strip it from the mail.
1249 If non-nil (the default), Gnus will treat some articles as MIME
1250 even if the MIME-Version header is missing."
1253 :group
'gnus-article-mime
)
1255 (defcustom gnus-article-emulate-mime t
1256 "If non-nil, use MIME emulation for uuencode and the like.
1257 This means that Gnus will search message bodies for text that look
1258 like uuencoded bits, yEncoded bits, and so on, and present that using
1259 the normal Gnus MIME machinery."
1262 :group
'gnus-article-mime
)
1264 ;;; Internal variables
1266 (defvar gnus-summary-display-cache nil
)
1267 (defvar gnus-article-mime-handles nil
)
1268 (defvar gnus-article-decoded-p nil
)
1269 (defvar gnus-article-charset nil
)
1270 (defvar gnus-article-ignored-charsets nil
)
1271 (defvar gnus-scores-exclude-files nil
)
1272 (defvar gnus-page-broken nil
)
1274 (defvar gnus-original-article nil
)
1275 (defvar gnus-article-internal-prepare-hook nil
)
1276 (defvar gnus-newsgroup-process-stack nil
)
1278 (defvar gnus-thread-indent-array nil
)
1279 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1280 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1281 "Function called to sort the articles within a thread after it has been gathered together.")
1283 (defvar gnus-summary-save-parts-type-history nil
)
1284 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1286 ;; Avoid highlighting in kill files.
1287 (defvar gnus-summary-inhibit-highlight nil
)
1288 (defvar gnus-newsgroup-selected-overlay nil
)
1289 (defvar gnus-inhibit-limiting nil
)
1290 (defvar gnus-newsgroup-adaptive-score-file nil
)
1291 (defvar gnus-current-score-file nil
)
1292 (defvar gnus-current-move-group nil
)
1293 (defvar gnus-current-copy-group nil
)
1294 (defvar gnus-current-crosspost-group nil
)
1295 (defvar gnus-newsgroup-display nil
)
1297 (defvar gnus-newsgroup-dependencies nil
)
1298 (defvar gnus-newsgroup-adaptive nil
)
1299 (defvar gnus-summary-display-article-function nil
)
1300 (defvar gnus-summary-highlight-line-function nil
1301 "Function called after highlighting a summary line.")
1303 (defvar gnus-summary-line-format-alist
1304 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1305 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1306 (?s gnus-tmp-subject-or-nil ?s
)
1307 (?n gnus-tmp-name ?s
)
1308 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1310 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1312 (?F gnus-tmp-from ?s
)
1313 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1314 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1315 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1316 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1317 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1318 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1319 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1320 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1321 (?L gnus-tmp-lines ?s
)
1322 (?O gnus-tmp-downloaded ?c
)
1323 (?I gnus-tmp-indentation ?s
)
1324 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1325 (?R gnus-tmp-replied ?c
)
1326 (?\
[ gnus-tmp-opening-bracket ?c
)
1327 (?\
] gnus-tmp-closing-bracket ?c
)
1328 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1329 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1330 (?i gnus-tmp-score ?d
)
1331 (?z gnus-tmp-score-char ?c
)
1332 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1333 (?U gnus-tmp-unread ?c
)
1334 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1336 (?t
(gnus-summary-number-of-articles-in-thread
1337 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1339 (?e
(gnus-summary-number-of-articles-in-thread
1340 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1342 (?u gnus-tmp-user-defined ?s
)
1343 (?P
(gnus-pick-line-number) ?d
)
1344 (?B gnus-tmp-thread-tree-header-string ?s
)
1345 (user-date (gnus-user-date
1346 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1347 "An alist of format specifications that can appear in summary lines.
1348 These are paired with what variables they correspond with, along with
1349 the type of the variable (string, integer, character, etc).")
1351 (defvar gnus-summary-dummy-line-format-alist
1352 `((?S gnus-tmp-subject ?s
)
1353 (?N gnus-tmp-number ?d
)
1354 (?u gnus-tmp-user-defined ?s
)))
1356 (defvar gnus-summary-mode-line-format-alist
1357 `((?G gnus-tmp-group-name ?s
)
1358 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1359 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1360 (?A gnus-tmp-article-number ?d
)
1361 (?Z gnus-tmp-unread-and-unselected ?s
)
1362 (?V gnus-version ?s
)
1363 (?U gnus-tmp-unread-and-unticked ?d
)
1364 (?S gnus-tmp-subject ?s
)
1365 (?e gnus-tmp-unselected ?d
)
1366 (?u gnus-tmp-user-defined ?s
)
1367 (?d
(length gnus-newsgroup-dormant
) ?d
)
1368 (?t
(length gnus-newsgroup-marked
) ?d
)
1369 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1370 (?r
(length gnus-newsgroup-reads
) ?d
)
1371 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1372 (?E gnus-newsgroup-expunged-tally ?d
)
1373 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1375 ;; This is here rather than in gnus-art for compilation reasons.
1376 (defvar gnus-article-mode-line-format-alist
1377 (nconc '((?w
(gnus-article-wash-status) ?s
)
1378 (?m
(gnus-article-mime-part-status) ?s
))
1379 gnus-summary-mode-line-format-alist
))
1381 (defvar gnus-last-search-regexp nil
1382 "Default regexp for article search command.")
1384 (defvar gnus-last-shell-command nil
1385 "Default shell command on article.")
1387 (defvar gnus-newsgroup-agentized nil
1388 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1389 (defvar gnus-newsgroup-begin nil
)
1390 (defvar gnus-newsgroup-end nil
)
1391 (defvar gnus-newsgroup-last-rmail nil
)
1392 (defvar gnus-newsgroup-last-mail nil
)
1393 (defvar gnus-newsgroup-last-folder nil
)
1394 (defvar gnus-newsgroup-last-file nil
)
1395 (defvar gnus-newsgroup-last-directory nil
)
1396 (defvar gnus-newsgroup-auto-expire nil
)
1397 (defvar gnus-newsgroup-active nil
)
1399 (defvar gnus-newsgroup-data nil
)
1400 (defvar gnus-newsgroup-data-reverse nil
)
1401 (defvar gnus-newsgroup-limit nil
)
1402 (defvar gnus-newsgroup-limits nil
)
1403 (defvar gnus-summary-use-undownloaded-faces nil
)
1405 (defvar gnus-newsgroup-unreads nil
1406 "Sorted list of unread articles in the current newsgroup.")
1408 (defvar gnus-newsgroup-unselected nil
1409 "Sorted list of unselected unread articles in the current newsgroup.")
1411 (defvar gnus-newsgroup-reads nil
1412 "Alist of read articles and article marks in the current newsgroup.")
1414 (defvar gnus-newsgroup-expunged-tally nil
)
1416 (defvar gnus-newsgroup-marked nil
1417 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1419 (defvar gnus-newsgroup-spam-marked nil
1420 "List of ranges of articles that have been marked as spam.")
1422 (defvar gnus-newsgroup-killed nil
1423 "List of ranges of articles that have been through the scoring process.")
1425 (defvar gnus-newsgroup-cached nil
1426 "Sorted list of articles that come from the article cache.")
1428 (defvar gnus-newsgroup-saved nil
1429 "List of articles that have been saved.")
1431 (defvar gnus-newsgroup-kill-headers nil
)
1433 (defvar gnus-newsgroup-replied nil
1434 "List of articles that have been replied to in the current newsgroup.")
1436 (defvar gnus-newsgroup-forwarded nil
1437 "List of articles that have been forwarded in the current newsgroup.")
1439 (defvar gnus-newsgroup-recent nil
1440 "List of articles that have are recent in the current newsgroup.")
1442 (defvar gnus-newsgroup-expirable nil
1443 "Sorted list of articles in the current newsgroup that can be expired.")
1445 (defvar gnus-newsgroup-processable nil
1446 "List of articles in the current newsgroup that can be processed.")
1448 (defvar gnus-newsgroup-downloadable nil
1449 "Sorted list of articles in the current newsgroup that can be processed.")
1451 (defvar gnus-newsgroup-unfetched nil
1452 "Sorted list of articles in the current newsgroup whose headers have
1453 not been fetched into the agent.
1455 This list will always be a subset of gnus-newsgroup-undownloaded.")
1457 (defvar gnus-newsgroup-undownloaded nil
1458 "List of articles in the current newsgroup that haven't been downloaded.")
1460 (defvar gnus-newsgroup-unsendable nil
1461 "List of articles in the current newsgroup that won't be sent.")
1463 (defvar gnus-newsgroup-bookmarks nil
1464 "List of articles in the current newsgroup that have bookmarks.")
1466 (defvar gnus-newsgroup-dormant nil
1467 "Sorted list of dormant articles in the current newsgroup.")
1469 (defvar gnus-newsgroup-unseen nil
1470 "List of unseen articles in the current newsgroup.")
1472 (defvar gnus-newsgroup-seen nil
1473 "Range of seen articles in the current newsgroup.")
1475 (defvar gnus-newsgroup-articles nil
1476 "List of articles in the current newsgroup.")
1478 (defvar gnus-newsgroup-scored nil
1479 "List of scored articles in the current newsgroup.")
1481 (defvar gnus-newsgroup-headers nil
1482 "List of article headers in the current newsgroup.")
1484 (defvar gnus-newsgroup-threads nil
)
1486 (defvar gnus-newsgroup-prepared nil
1487 "Whether the current group has been prepared properly.")
1489 (defvar gnus-newsgroup-ancient nil
1490 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1492 (defvar gnus-newsgroup-sparse nil
)
1494 (defvar gnus-current-article nil
)
1495 (defvar gnus-article-current nil
)
1496 (defvar gnus-current-headers nil
)
1497 (defvar gnus-have-all-headers nil
)
1498 (defvar gnus-last-article nil
)
1499 (defvar gnus-newsgroup-history nil
)
1500 (defvar gnus-newsgroup-charset nil
)
1501 (defvar gnus-newsgroup-ephemeral-charset nil
)
1502 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1504 (defvar gnus-article-before-search nil
)
1506 (defvar gnus-summary-local-variables
1507 '(gnus-newsgroup-name
1508 gnus-newsgroup-begin gnus-newsgroup-end
1509 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1510 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1511 gnus-newsgroup-last-directory
1512 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1513 gnus-newsgroup-unselected gnus-newsgroup-marked
1514 gnus-newsgroup-spam-marked
1515 gnus-newsgroup-reads gnus-newsgroup-saved
1516 gnus-newsgroup-replied gnus-newsgroup-forwarded
1517 gnus-newsgroup-recent
1518 gnus-newsgroup-expirable
1519 gnus-newsgroup-processable gnus-newsgroup-killed
1520 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1521 gnus-newsgroup-unfetched
1522 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1523 gnus-newsgroup-seen gnus-newsgroup-articles
1524 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1525 gnus-newsgroup-headers gnus-newsgroup-threads
1526 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1527 gnus-current-article gnus-current-headers gnus-have-all-headers
1528 gnus-last-article gnus-article-internal-prepare-hook
1529 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1530 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1531 gnus-thread-expunge-below
1532 gnus-score-alist gnus-current-score-file
1533 (gnus-summary-expunge-below . global
)
1534 (gnus-summary-mark-below . global
)
1535 (gnus-orphan-score . global
)
1536 gnus-newsgroup-active gnus-scores-exclude-files
1537 gnus-newsgroup-history gnus-newsgroup-ancient
1538 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1539 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1540 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1541 (gnus-newsgroup-expunged-tally .
0)
1542 gnus-cache-removable-articles gnus-newsgroup-cached
1543 gnus-newsgroup-data gnus-newsgroup-data-reverse
1544 gnus-newsgroup-limit gnus-newsgroup-limits
1545 gnus-newsgroup-charset gnus-newsgroup-display
1546 gnus-summary-use-undownloaded-faces
)
1547 "Variables that are buffer-local to the summary buffers.")
1549 (defvar gnus-newsgroup-variables nil
1550 "A list of variables that have separate values in different newsgroups.
1551 A list of newsgroup (summary buffer) local variables, or cons of
1552 variables and their default expressions to be evalled (when the default
1553 values are not nil), that should be made global while the summary buffer
1556 Note: The default expressions will be evaluated (using function `eval')
1557 before assignment to the local variable rather than just assigned to it.
1558 If the default expression is the symbol `global', that symbol will not
1559 be evaluated but the global value of the local variable will be used
1562 These variables can be used to set variables in the group parameters
1563 while still allowing them to affect operations done in other buffers.
1566 \(setq gnus-newsgroup-variables
1567 '(message-use-followup-to
1568 (gnus-visible-headers .
1569 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1573 ;; Bind features so that require will believe that gnus-sum has
1574 ;; already been loaded (avoids infinite recursion)
1575 (let ((features (cons 'gnus-sum features
)))
1576 (require 'gnus-art
)))
1580 (defvar gnus-decode-encoded-word-methods
1581 '(mail-decode-encoded-word-string)
1582 "List of methods used to decode encoded words.
1584 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1585 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1586 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1587 whose names match REGEXP.
1590 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1591 mail-decode-encoded-word-string
1592 (\"chinese\" . rfc1843-decode-string))")
1594 (defvar gnus-decode-encoded-word-methods-cache nil
)
1596 (defun gnus-multi-decode-encoded-word-string (string)
1597 "Apply the functions from `gnus-encoded-word-methods' that match."
1598 (unless (and gnus-decode-encoded-word-methods-cache
1599 (eq gnus-newsgroup-name
1600 (car gnus-decode-encoded-word-methods-cache
)))
1601 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1602 (dolist (method gnus-decode-encoded-word-methods
)
1603 (if (symbolp method
)
1604 (nconc gnus-decode-encoded-word-methods-cache
(list method
))
1605 (if (and gnus-newsgroup-name
1606 (string-match (car method
) gnus-newsgroup-name
))
1607 (nconc gnus-decode-encoded-word-methods-cache
1608 (list (cdr method
)))))))
1609 (dolist (method (cdr gnus-decode-encoded-word-methods-cache
) string
)
1610 (setq string
(funcall method string
))))
1612 ;; Subject simplification.
1614 (defun gnus-simplify-whitespace (str)
1615 "Remove excessive whitespace from STR."
1617 (while (string-match "[ \t][ \t]+" str
)
1618 (setq str
(concat (substring str
0 (match-beginning 0))
1620 (substring str
(match-end 0)))))
1622 (when (string-match "^[ \t]+" str
)
1623 (setq str
(substring str
(match-end 0))))
1625 (when (string-match "[ \t]+$" str
)
1626 (setq str
(substring str
0 (match-beginning 0))))
1629 (defun gnus-simplify-all-whitespace (str)
1630 "Remove all whitespace from STR."
1631 (while (string-match "[ \t\n]+" str
)
1632 (setq str
(replace-match "" nil nil str
)))
1635 (defsubst gnus-simplify-subject-re
(subject)
1636 "Remove \"Re:\" from subject lines."
1637 (if (string-match message-subject-re-regexp subject
)
1638 (substring subject
(match-end 0))
1641 (defun gnus-simplify-subject (subject &optional re-only
)
1642 "Remove `Re:' and words in parentheses.
1643 If RE-ONLY is non-nil, strip leading `Re:'s only."
1644 (let ((case-fold-search t
)) ;Ignore case.
1645 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1646 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1647 (setq subject
(substring subject
(match-end 0))))
1648 ;; Remove uninteresting prefixes.
1649 (when (and (not re-only
)
1650 gnus-simplify-ignored-prefixes
1651 (string-match gnus-simplify-ignored-prefixes subject
))
1652 (setq subject
(substring subject
(match-end 0))))
1653 ;; Remove words in parentheses from end.
1655 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1656 (setq subject
(substring subject
0 (match-beginning 0)))))
1657 ;; Return subject string.
1660 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1662 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1663 (goto-char (point-min))
1664 (while (re-search-forward regexp nil t
)
1665 (replace-match (or newtext
""))))
1667 (defun gnus-simplify-buffer-fuzzy ()
1668 "Simplify string in the buffer fuzzily.
1669 The string in the accessible portion of the current buffer is simplified.
1670 It is assumed to be a single-line subject.
1671 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1672 matter is removed. Additional things can be deleted by setting
1673 `gnus-simplify-subject-fuzzy-regexp'."
1674 (let ((case-fold-search t
)
1676 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1678 (while (not (eq modified-tick
(buffer-modified-tick)))
1679 (setq modified-tick
(buffer-modified-tick))
1681 ((listp gnus-simplify-subject-fuzzy-regexp
)
1682 (mapc 'gnus-simplify-buffer-fuzzy-step
1683 gnus-simplify-subject-fuzzy-regexp
))
1684 (gnus-simplify-subject-fuzzy-regexp
1685 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1686 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1687 (gnus-simplify-buffer-fuzzy-step
1688 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1689 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1691 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1692 (gnus-simplify-buffer-fuzzy-step " +" " ")
1693 (gnus-simplify-buffer-fuzzy-step " $")
1694 (gnus-simplify-buffer-fuzzy-step "^ +")))
1696 (defun gnus-simplify-subject-fuzzy (subject)
1697 "Simplify a subject string fuzzily.
1698 See `gnus-simplify-buffer-fuzzy' for details."
1700 (gnus-set-work-buffer)
1701 (let ((case-fold-search t
))
1702 ;; Remove uninteresting prefixes.
1703 (when (and gnus-simplify-ignored-prefixes
1704 (string-match gnus-simplify-ignored-prefixes subject
))
1705 (setq subject
(substring subject
(match-end 0))))
1707 (inline (gnus-simplify-buffer-fuzzy))
1710 (defsubst gnus-simplify-subject-fully
(subject)
1711 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1713 (gnus-simplify-subject-functions
1714 (gnus-map-function gnus-simplify-subject-functions subject
))
1715 ((null gnus-summary-gather-subject-limit
)
1716 (gnus-simplify-subject-re subject
))
1717 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1718 (gnus-simplify-subject-fuzzy subject
))
1719 ((numberp gnus-summary-gather-subject-limit
)
1720 (truncate-string-to-width (gnus-simplify-subject-re subject
)
1721 gnus-summary-gather-subject-limit
))
1725 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1726 "Check whether two subjects are equal.
1727 If optional argument SIMPLE-FIRST is t, first argument is already
1730 ((null simple-first
)
1731 (equal (gnus-simplify-subject-fully s1
)
1732 (gnus-simplify-subject-fully s2
)))
1735 (gnus-simplify-subject-fully s2
)))))
1737 (defun gnus-summary-bubble-group ()
1738 "Increase the score of the current group.
1739 This is a handy function to add to `gnus-summary-exit-hook' to
1740 increase the score of each group you read."
1741 (gnus-group-add-score gnus-newsgroup-name
))
1745 ;;; Gnus summary mode
1748 (put 'gnus-summary-mode
'mode-class
'special
)
1750 (defvar gnus-article-commands-menu
)
1752 ;; Non-orthogonal keys
1754 (gnus-define-keys gnus-summary-mode-map
1755 " " gnus-summary-next-page
1756 "\177" gnus-summary-prev-page
1757 [delete] gnus-summary-prev-page
1758 [backspace] gnus-summary-prev-page
1759 "\r" gnus-summary-scroll-up
1760 "\M-\r" gnus-summary-scroll-down
1761 "n" gnus-summary-next-unread-article
1762 "p" gnus-summary-prev-unread-article
1763 "N" gnus-summary-next-article
1764 "P" gnus-summary-prev-article
1765 "\M-\C-n" gnus-summary-next-same-subject
1766 "\M-\C-p" gnus-summary-prev-same-subject
1767 "\M-n" gnus-summary-next-unread-subject
1768 "\M-p" gnus-summary-prev-unread-subject
1769 "." gnus-summary-first-unread-article
1770 "," gnus-summary-best-unread-article
1771 "\M-s" gnus-summary-search-article-forward
1772 "\M-r" gnus-summary-search-article-backward
1773 "\M-S" gnus-summary-repeat-search-article-forward
1774 "\M-R" gnus-summary-repeat-search-article-backward
1775 "<" gnus-summary-beginning-of-article
1776 ">" gnus-summary-end-of-article
1777 "j" gnus-summary-goto-article
1778 "^" gnus-summary-refer-parent-article
1779 "\M-^" gnus-summary-refer-article
1780 "u" gnus-summary-tick-article-forward
1781 "!" gnus-summary-tick-article-forward
1782 "U" gnus-summary-tick-article-backward
1783 "d" gnus-summary-mark-as-read-forward
1784 "D" gnus-summary-mark-as-read-backward
1785 "E" gnus-summary-mark-as-expirable
1786 "\M-u" gnus-summary-clear-mark-forward
1787 "\M-U" gnus-summary-clear-mark-backward
1788 "k" gnus-summary-kill-same-subject-and-select
1789 "\C-k" gnus-summary-kill-same-subject
1790 "\M-\C-k" gnus-summary-kill-thread
1791 "\M-\C-l" gnus-summary-lower-thread
1792 "e" gnus-summary-edit-article
1793 "#" gnus-summary-mark-as-processable
1794 "\M-#" gnus-summary-unmark-as-processable
1795 "\M-\C-t" gnus-summary-toggle-threads
1796 "\M-\C-s" gnus-summary-show-thread
1797 "\M-\C-h" gnus-summary-hide-thread
1798 "\M-\C-f" gnus-summary-next-thread
1799 "\M-\C-b" gnus-summary-prev-thread
1800 [(meta down)] gnus-summary-next-thread
1801 [(meta up)] gnus-summary-prev-thread
1802 "\M-\C-u" gnus-summary-up-thread
1803 "\M-\C-d" gnus-summary-down-thread
1804 "&" gnus-summary-execute-command
1805 "c" gnus-summary-catchup-and-exit
1806 "\C-w" gnus-summary-mark-region-as-read
1807 "\C-t" gnus-summary-toggle-truncation
1808 "?" gnus-summary-mark-as-dormant
1809 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1810 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1811 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1812 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1813 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1814 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1815 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1816 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1817 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1818 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1819 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1820 "=" gnus-summary-expand-window
1821 "\C-x\C-s" gnus-summary-reselect-current-group
1822 "\M-g" gnus-summary-rescan-group
1823 "w" gnus-summary-stop-page-breaking
1824 "\C-c\C-r" gnus-summary-caesar-message
1825 "f" gnus-summary-followup
1826 "F" gnus-summary-followup-with-original
1827 "C" gnus-summary-cancel-article
1828 "r" gnus-summary-reply
1829 "R" gnus-summary-reply-with-original
1830 "\C-c\C-f" gnus-summary-mail-forward
1831 "o" gnus-summary-save-article
1832 "\C-o" gnus-summary-save-article-mail
1833 "|" gnus-summary-pipe-output
1834 "\M-k" gnus-summary-edit-local-kill
1835 "\M-K" gnus-summary-edit-global-kill
1837 "\C-c\C-d" gnus-summary-describe-group
1838 "q" gnus-summary-exit
1839 "Q" gnus-summary-exit-no-update
1840 "\C-c\C-i" gnus-info-find-node
1841 gnus-mouse-2 gnus-mouse-pick-article
1842 [follow-link] mouse-face
1843 "m" gnus-summary-mail-other-window
1844 "a" gnus-summary-post-news
1845 "i" gnus-summary-news-other-window
1846 "x" gnus-summary-limit-to-unread
1847 "s" gnus-summary-isearch-article
1848 "t" gnus-summary-toggle-header
1849 "g" gnus-summary-show-article
1850 "l" gnus-summary-goto-last-article
1851 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1852 "\C-d" gnus-summary-enter-digest-group
1853 "\M-\C-d" gnus-summary-read-document
1854 "\M-\C-e" gnus-summary-edit-parameters
1855 "\M-\C-a" gnus-summary-customize-parameters
1857 "*" gnus-cache-enter-article
1858 "\M-*" gnus-cache-remove-article
1859 "\M-&" gnus-summary-universal-argument
1860 "\C-l" gnus-recenter
1861 "I" gnus-summary-increase-score
1862 "L" gnus-summary-lower-score
1863 "\M-i" gnus-symbolic-argument
1864 "h" gnus-summary-select-article-buffer
1866 "b" gnus-article-view-part
1867 "\M-t" gnus-summary-toggle-display-buttonized
1869 "V" gnus-summary-score-map
1870 "X" gnus-uu-extract-map
1871 "S" gnus-summary-send-map)
1873 ;; Sort of orthogonal keymap
1874 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1875 "t" gnus-summary-tick-article-forward
1876 "!" gnus-summary-tick-article-forward
1877 "d" gnus-summary-mark-as-read-forward
1878 "r" gnus-summary-mark-as-read-forward
1879 "c" gnus-summary-clear-mark-forward
1880 " " gnus-summary-clear-mark-forward
1881 "e" gnus-summary-mark-as-expirable
1882 "x" gnus-summary-mark-as-expirable
1883 "?" gnus-summary-mark-as-dormant
1884 "b" gnus-summary-set-bookmark
1885 "B" gnus-summary-remove-bookmark
1886 "#" gnus-summary-mark-as-processable
1887 "\M-#" gnus-summary-unmark-as-processable
1888 "S" gnus-summary-limit-include-expunged
1889 "C" gnus-summary-catchup
1890 "H" gnus-summary-catchup-to-here
1891 "h" gnus-summary-catchup-from-here
1892 "\C-c" gnus-summary-catchup-all
1893 "k" gnus-summary-kill-same-subject-and-select
1894 "K" gnus-summary-kill-same-subject
1895 "P" gnus-uu-mark-map)
1897 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1898 "c" gnus-summary-clear-above
1899 "u" gnus-summary-tick-above
1900 "m" gnus-summary-mark-above
1901 "k" gnus-summary-kill-below)
1903 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1904 "/" gnus-summary-limit-to-subject
1905 "n" gnus-summary-limit-to-articles
1906 "b" gnus-summary-limit-to-bodies
1907 "h" gnus-summary-limit-to-headers
1908 "w" gnus-summary-pop-limit
1909 "s" gnus-summary-limit-to-subject
1910 "a" gnus-summary-limit-to-author
1911 "u" gnus-summary-limit-to-unread
1912 "m" gnus-summary-limit-to-marks
1913 "M" gnus-summary-limit-exclude-marks
1914 "v" gnus-summary-limit-to-score
1915 "*" gnus-summary-limit-include-cached
1916 "D" gnus-summary-limit-include-dormant
1917 "T" gnus-summary-limit-include-thread
1918 "d" gnus-summary-limit-exclude-dormant
1919 "t" gnus-summary-limit-to-age
1920 "." gnus-summary-limit-to-unseen
1921 "x" gnus-summary-limit-to-extra
1922 "p" gnus-summary-limit-to-display-predicate
1923 "E" gnus-summary-limit-include-expunged
1924 "c" gnus-summary-limit-exclude-childless-dormant
1925 "C" gnus-summary-limit-mark-excluded-as-read
1926 "o" gnus-summary-insert-old-articles
1927 "N" gnus-summary-insert-new-articles
1928 "S" gnus-summary-limit-to-singletons
1929 "r" gnus-summary-limit-to-replied
1930 "R" gnus-summary-limit-to-recipient
1931 "A" gnus-summary-limit-to-address)
1933 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1934 "n" gnus-summary-next-unread-article
1935 "p" gnus-summary-prev-unread-article
1936 "N" gnus-summary-next-article
1937 "P" gnus-summary-prev-article
1938 "\C-n" gnus-summary-next-same-subject
1939 "\C-p" gnus-summary-prev-same-subject
1940 "\M-n" gnus-summary-next-unread-subject
1941 "\M-p" gnus-summary-prev-unread-subject
1942 "f" gnus-summary-first-unread-article
1943 "b" gnus-summary-best-unread-article
1944 "j" gnus-summary-goto-article
1945 "g" gnus-summary-goto-subject
1946 "l" gnus-summary-goto-last-article
1947 "o" gnus-summary-pop-article)
1949 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1950 "k" gnus-summary-kill-thread
1951 "E" gnus-summary-expire-thread
1952 "l" gnus-summary-lower-thread
1953 "i" gnus-summary-raise-thread
1954 "T" gnus-summary-toggle-threads
1955 "t" gnus-summary-rethread-current
1956 "^" gnus-summary-reparent-thread
1957 "\M-^" gnus-summary-reparent-children
1958 "s" gnus-summary-show-thread
1959 "S" gnus-summary-show-all-threads
1960 "h" gnus-summary-hide-thread
1961 "H" gnus-summary-hide-all-threads
1962 "n" gnus-summary-next-thread
1963 "p" gnus-summary-prev-thread
1964 "u" gnus-summary-up-thread
1965 "o" gnus-summary-top-thread
1966 "d" gnus-summary-down-thread
1967 "#" gnus-uu-mark-thread
1968 "\M-#" gnus-uu-unmark-thread)
1970 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1971 "g" gnus-summary-prepare
1972 "c" gnus-summary-insert-cached-articles
1973 "d" gnus-summary-insert-dormant-articles
1974 "t" gnus-summary-insert-ticked-articles)
1976 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1977 "c" gnus-summary-catchup-and-exit
1978 "C" gnus-summary-catchup-all-and-exit
1979 "E" gnus-summary-exit-no-update
1980 "Q" gnus-summary-exit
1981 "Z" gnus-summary-exit
1982 "n" gnus-summary-catchup-and-goto-next-group
1983 "p" gnus-summary-catchup-and-goto-prev-group
1984 "R" gnus-summary-reselect-current-group
1985 "G" gnus-summary-rescan-group
1986 "N" gnus-summary-next-group
1987 "s" gnus-summary-save-newsrc
1988 "P" gnus-summary-prev-group)
1990 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1991 " " gnus-summary-next-page
1992 "n" gnus-summary-next-page
1993 "\177" gnus-summary-prev-page
1994 [delete] gnus-summary-prev-page
1995 "p" gnus-summary-prev-page
1996 "\r" gnus-summary-scroll-up
1997 "\M-\r" gnus-summary-scroll-down
1998 "<" gnus-summary-beginning-of-article
1999 ">" gnus-summary-end-of-article
2000 "b" gnus-summary-beginning-of-article
2001 "e" gnus-summary-end-of-article
2002 "^" gnus-summary-refer-parent-article
2003 "r" gnus-summary-refer-parent-article
2004 "D" gnus-summary-enter-digest-group
2005 "R" gnus-summary-refer-references
2006 "T" gnus-summary-refer-thread
2007 "g" gnus-summary-show-article
2008 "s" gnus-summary-isearch-article
2009 "P" gnus-summary-print-article
2010 "S" gnus-sticky-article
2011 "M" gnus-mailing-list-insinuate
2012 "t" gnus-article-babel
)
2014 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
2015 "b" gnus-article-add-buttons
2016 "B" gnus-article-add-buttons-to-head
2017 "o" gnus-article-treat-overstrike
2018 "e" gnus-article-emphasize
2019 "w" gnus-article-fill-cited-article
2020 "Q" gnus-article-fill-long-lines
2021 "L" gnus-article-toggle-truncate-lines
2022 "C" gnus-article-capitalize-sentences
2023 "c" gnus-article-remove-cr
2024 "q" gnus-article-de-quoted-unreadable
2025 "6" gnus-article-de-base64-unreadable
2026 "Z" gnus-article-decode-HZ
2027 "A" gnus-article-treat-ansi-sequences
2028 "h" gnus-article-wash-html
2029 "u" gnus-article-unsplit-urls
2030 "s" gnus-summary-force-verify-and-decrypt
2031 "f" gnus-article-display-x-face
2032 "l" gnus-summary-stop-page-breaking
2033 "r" gnus-summary-caesar-message
2034 "m" gnus-summary-morse-message
2035 "t" gnus-summary-toggle-header
2036 "g" gnus-treat-smiley
2037 "v" gnus-summary-verbose-headers
2038 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
2039 "p" gnus-article-verify-x-pgp-sig
2040 "d" gnus-article-treat-dumbquotes
2041 "i" gnus-summary-idna-message
)
2043 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
2044 ;; mnemonic: deuglif*Y*
2045 "u" gnus-article-outlook-unwrap-lines
2046 "a" gnus-article-outlook-repair-attribution
2047 "c" gnus-article-outlook-rearrange-citation
2048 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
2050 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
2051 "a" gnus-article-hide
2052 "h" gnus-article-hide-headers
2053 "b" gnus-article-hide-boring-headers
2054 "s" gnus-article-hide-signature
2055 "c" gnus-article-hide-citation
2056 "C" gnus-article-hide-citation-in-followups
2057 "l" gnus-article-hide-list-identifiers
2058 "B" gnus-article-strip-banner
2059 "P" gnus-article-hide-pem
2060 "\C-c" gnus-article-hide-citation-maybe
)
2062 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
2063 "a" gnus-article-highlight
2064 "h" gnus-article-highlight-headers
2065 "c" gnus-article-highlight-citation
2066 "s" gnus-article-highlight-signature
)
2068 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
2069 "f" gnus-article-treat-fold-headers
2070 "u" gnus-article-treat-unfold-headers
2071 "n" gnus-article-treat-fold-newsgroups
)
2073 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
2074 "x" gnus-article-display-x-face
2075 "d" gnus-article-display-face
2076 "s" gnus-treat-smiley
2077 "D" gnus-article-remove-images
2078 "f" gnus-treat-from-picon
2079 "m" gnus-treat-mail-picon
2080 "n" gnus-treat-newsgroups-picon
)
2082 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
2083 "w" gnus-article-decode-mime-words
2084 "c" gnus-article-decode-charset
2085 "v" gnus-mime-view-all-parts
2086 "b" gnus-article-view-part
)
2088 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
2089 "z" gnus-article-date-ut
2090 "u" gnus-article-date-ut
2091 "l" gnus-article-date-local
2092 "p" gnus-article-date-english
2093 "e" gnus-article-date-lapsed
2094 "o" gnus-article-date-original
2095 "i" gnus-article-date-iso8601
2096 "s" gnus-article-date-user
)
2098 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
2099 "t" gnus-article-remove-trailing-blank-lines
2100 "l" gnus-article-strip-leading-blank-lines
2101 "m" gnus-article-strip-multiple-blank-lines
2102 "a" gnus-article-strip-blank-lines
2103 "A" gnus-article-strip-all-blank-lines
2104 "s" gnus-article-strip-leading-space
2105 "e" gnus-article-strip-trailing-space
2106 "w" gnus-article-remove-leading-whitespace
)
2108 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
2110 "f" gnus-summary-fetch-faq
2111 "d" gnus-summary-describe-group
2112 "h" gnus-summary-describe-briefly
2113 "i" gnus-info-find-node
2114 "c" gnus-group-fetch-charter
2115 "C" gnus-group-fetch-control
)
2117 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
2118 "e" gnus-summary-expire-articles
2119 "\M-\C-e" gnus-summary-expire-articles-now
2120 "\177" gnus-summary-delete-article
2121 [delete] gnus-summary-delete-article
2122 [backspace] gnus-summary-delete-article
2123 "m" gnus-summary-move-article
2124 "r" gnus-summary-respool-article
2125 "w" gnus-summary-edit-article
2126 "c" gnus-summary-copy-article
2127 "B" gnus-summary-crosspost-article
2128 "q" gnus-summary-respool-query
2129 "t" gnus-summary-respool-trace
2130 "i" gnus-summary-import-article
2131 "I" gnus-summary-create-article
2132 "p" gnus-summary-article-posted-p)
2134 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2135 "o" gnus-summary-save-article
2136 "m" gnus-summary-save-article-mail
2137 "F" gnus-summary-write-article-file
2138 "r" gnus-summary-save-article-rmail
2139 "f" gnus-summary-save-article-file
2140 "b" gnus-summary-save-article-body-file
2141 "B" gnus-summary-write-article-body-file
2142 "h" gnus-summary-save-article-folder
2143 "v" gnus-summary-save-article-vm
2144 "p" gnus-summary-pipe-output
2145 "P" gnus-summary-muttprint
2146 "s" gnus-soup-add-article)
2148 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2149 "b" gnus-summary-display-buttonized
2150 "m" gnus-summary-repair-multipart
2151 "v" gnus-article-view-part
2152 "o" gnus-article-save-part
2153 "O" gnus-article-save-part-and-strip
2154 "r" gnus-article-replace-part
2155 "d" gnus-article-delete-part
2156 "t" gnus-article-view-part-as-type
2157 "j" gnus-article-jump-to-part
2158 "c" gnus-article-copy-part
2159 "C" gnus-article-view-part-as-charset
2160 "e" gnus-article-view-part-externally
2161 "H" gnus-article-browse-html-article
2162 "E" gnus-article-encrypt-body
2163 "i" gnus-article-inline-part
2164 "|" gnus-article-pipe-part)
2166 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2167 "p" gnus-summary-mark-as-processable
2168 "u" gnus-summary-unmark-as-processable
2169 "U" gnus-summary-unmark-all-processable
2170 "v" gnus-uu-mark-over
2171 "s" gnus-uu-mark-series
2172 "r" gnus-uu-mark-region
2173 "g" gnus-uu-unmark-region
2174 "R" gnus-uu-mark-by-regexp
2175 "G" gnus-uu-unmark-by-regexp
2176 "t" gnus-uu-mark-thread
2177 "T" gnus-uu-unmark-thread
2178 "a" gnus-uu-mark-all
2179 "b" gnus-uu-mark-buffer
2180 "S" gnus-uu-mark-sparse
2181 "k" gnus-summary-kill-process-mark
2182 "y" gnus-summary-yank-process-mark
2183 "w" gnus-summary-save-process-mark
2184 "i" gnus-uu-invert-processable)
2186 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2187 ;;"x" gnus-uu-extract-any
2188 "m" gnus-summary-save-parts
2189 "u" gnus-uu-decode-uu
2190 "U" gnus-uu-decode-uu-and-save
2191 "s" gnus-uu-decode-unshar
2192 "S" gnus-uu-decode-unshar-and-save
2193 "o" gnus-uu-decode-save
2194 "O" gnus-uu-decode-save
2195 "b" gnus-uu-decode-binhex
2196 "B" gnus-uu-decode-binhex
2197 "Y" gnus-uu-decode-yenc
2198 "p" gnus-uu-decode-postscript
2199 "P" gnus-uu-decode-postscript-and-save)
2202 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2203 "u" gnus-uu-decode-uu-view
2204 "U" gnus-uu-decode-uu-and-save-view
2205 "s" gnus-uu-decode-unshar-view
2206 "S" gnus-uu-decode-unshar-and-save-view
2207 "o" gnus-uu-decode-save-view
2208 "O" gnus-uu-decode-save-view
2209 "b" gnus-uu-decode-binhex-view
2210 "B" gnus-uu-decode-binhex-view
2211 "p" gnus-uu-decode-postscript-view
2212 "P" gnus-uu-decode-postscript-and-save-view)
2214 (defvar gnus-article-post-menu nil)
2216 (defconst gnus-summary-menu-maxlen 20)
2218 (defun gnus-summary-menu-split (menu)
2219 ;; If we have lots of elements, divide them into groups of 20
2220 ;; and make a pane (or submenu) for each one.
2221 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2222 (let ((menu menu) sublists next
2225 ;; Pull off the next gnus-summary-menu-maxlen elements
2226 ;; and make them the next element of sublist.
2227 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2229 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2231 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2232 (aref (car (last menu)) 0)) menu)
2236 (nreverse sublists))
2237 ;; Few elements--put them all in one pane.
2240 (defun gnus-summary-make-menu-bar ()
2241 (gnus-turn-off-edit-menu 'summary)
2243 (unless (boundp 'gnus-summary-misc-menu)
2246 gnus-summary-kill-menu gnus-summary-mode-map ""
2251 ["Customize" gnus-score-customize t])
2252 (gnus-make-score-map 'increase)
2253 (gnus-make-score-map 'lower)
2255 ["Kill below" gnus-summary-kill-below t]
2256 ["Mark above" gnus-summary-mark-above t]
2257 ["Tick above" gnus-summary-tick-above t]
2258 ["Clear above" gnus-summary-clear-above t])
2259 ["Current score" gnus-summary-current-score t]
2260 ["Set score" gnus-summary-set-score t]
2261 ["Switch current score file..." gnus-score-change-score-file t]
2262 ["Set mark below..." gnus-score-set-mark-below t]
2263 ["Set expunge below..." gnus-score-set-expunge-below t]
2264 ["Edit current score file" gnus-score-edit-current-scores t]
2265 ["Edit score file" gnus-score-edit-file t]
2266 ["Trace score" gnus-score-find-trace t]
2267 ["Find words" gnus-score-find-favourite-words t]
2268 ["Rescore buffer" gnus-summary-rescore t]
2269 ["Increase score..." gnus-summary-increase-score t]
2270 ["Lower score..." gnus-summary-lower-score t]))))
2272 ;; Define both the Article menu in the summary buffer and the
2273 ;; equivalent Commands menu in the article buffer here for
2277 ["All" gnus-article-hide t]
2278 ["Headers" gnus-article-hide-headers t]
2279 ["Signature" gnus-article-hide-signature t]
2280 ["Citation" gnus-article-hide-citation t]
2281 ["List identifiers" gnus-article-hide-list-identifiers t]
2282 ["Banner" gnus-article-strip-banner t]
2283 ["Boring headers" gnus-article-hide-boring-headers t])
2285 ["All" gnus-article-highlight t]
2286 ["Headers" gnus-article-highlight-headers t]
2287 ["Signature" gnus-article-highlight-signature t]
2288 ["Citation" gnus-article-highlight-citation t])
2290 ["Words" gnus-article-decode-mime-words t]
2291 ["Charset" gnus-article-decode-charset t]
2292 ["QP" gnus-article-de-quoted-unreadable t]
2293 ["Base64" gnus-article-de-base64-unreadable t]
2294 ["View MIME buttons" gnus-summary-display-buttonized t]
2295 ["View all" gnus-mime-view-all-parts t]
2296 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2297 ["Encrypt body" gnus-article-encrypt-body
2298 :active (not (gnus-group-read-only-p))
2299 ,@(if (featurep 'xemacs) nil
2300 '(:help "Encrypt the message body on disk"))]
2301 ["Extract all parts..." gnus-summary-save-parts t]
2303 ["Repair multipart" gnus-summary-repair-multipart t]
2304 ["Pipe part..." gnus-article-pipe-part t]
2305 ["Inline part" gnus-article-inline-part t]
2306 ["View part as type..." gnus-article-view-part-as-type t]
2307 ["Encrypt body" gnus-article-encrypt-body
2308 :active (not (gnus-group-read-only-p))
2309 ,@(if (featurep 'xemacs) nil
2310 '(:help "Encrypt the message body on disk"))]
2311 ["View part externally" gnus-article-view-part-externally t]
2312 ["View HTML parts in browser" gnus-article-browse-html-article t]
2313 ["View part with charset..." gnus-article-view-part-as-charset t]
2314 ["Copy part" gnus-article-copy-part t]
2315 ["Save part..." gnus-article-save-part t]
2316 ["View part" gnus-article-view-part t]))
2318 ["Local" gnus-article-date-local t]
2319 ["ISO8601" gnus-article-date-iso8601 t]
2320 ["UT" gnus-article-date-ut t]
2321 ["Original" gnus-article-date-original t]
2322 ["Lapsed" gnus-article-date-lapsed t]
2323 ["User-defined" gnus-article-date-user t])
2325 ["Remove images" gnus-article-remove-images t]
2326 ["Toggle smiley" gnus-treat-smiley t]
2327 ["Show X-Face" gnus-article-display-x-face t]
2328 ["Show picons in From" gnus-treat-from-picon t]
2329 ["Show picons in mail headers" gnus-treat-mail-picon t]
2330 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2331 ("View as different encoding"
2332 ,@(gnus-summary-menu-split
2335 ;; Since easymenu under Emacs doesn't allow
2336 ;; lambda forms for menu commands, we should
2337 ;; provide intern'ed function symbols.
2338 (let ((command (intern (format "\
2339 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2343 (let ((gnus-summary-show-article-charset-alist
2345 (gnus-summary-show-article 1))))
2346 `[,(symbol-name cs) ,command t]))
2347 (sort (if (fboundp 'coding-system-list)
2348 (coding-system-list)
2349 (mapcar 'car mm-mime-mule-charset-alist))
2353 ["Leading" gnus-article-strip-leading-blank-lines t]
2354 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2355 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2356 ["All of the above" gnus-article-strip-blank-lines t]
2357 ["All" gnus-article-strip-all-blank-lines t]
2358 ["Leading space" gnus-article-strip-leading-space t]
2359 ["Trailing space" gnus-article-strip-trailing-space t]
2360 ["Leading space in headers"
2361 gnus-article-remove-leading-whitespace t])
2362 ["Overstrike" gnus-article-treat-overstrike t]
2363 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2364 ["Emphasis" gnus-article-emphasize t]
2365 ["Word wrap" gnus-article-fill-cited-article t]
2366 ["Fill long lines" gnus-article-fill-long-lines t]
2367 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2368 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2369 ["Remove CR" gnus-article-remove-cr t]
2370 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2371 ["Base64" gnus-article-de-base64-unreadable t]
2372 ["Rot 13" gnus-summary-caesar-message
2373 ,@(if (featurep 'xemacs) '(t)
2374 '(:help "\"Caesar rotate\" article by 13"))]
2375 ["De-IDNA" gnus-summary-idna-message t]
2376 ["Morse decode" gnus-summary-morse-message t]
2377 ["Unix pipe..." gnus-summary-pipe-message t]
2378 ["Add buttons" gnus-article-add-buttons t]
2379 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2380 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2381 ["Verbose header" gnus-summary-verbose-headers t]
2382 ["Toggle header" gnus-summary-toggle-header t]
2383 ["Unfold headers" gnus-article-treat-unfold-headers t]
2384 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2385 ["Html" gnus-article-wash-html t]
2386 ["Unsplit URLs" gnus-article-unsplit-urls t]
2387 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2388 ["Decode HZ" gnus-article-decode-HZ t]
2389 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2390 ("(Outlook) Deuglify"
2391 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2392 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2393 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2394 ["Full (Outlook) deuglify"
2395 gnus-article-outlook-deuglify-article t])
2398 ["Save in default format..." gnus-summary-save-article
2399 ,@(if (featurep 'xemacs) '(t)
2400 '(:help "Save article using default method"))]
2401 ["Save in file..." gnus-summary-save-article-file
2402 ,@(if (featurep 'xemacs) '(t)
2403 '(:help "Save article in file"))]
2404 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2405 ["Save in MH folder..." gnus-summary-save-article-folder t]
2406 ["Save in VM folder..." gnus-summary-save-article-vm t]
2407 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2408 ["Save body in file..." gnus-summary-save-article-body-file t]
2409 ["Pipe through a filter..." gnus-summary-pipe-output t]
2410 ["Add to SOUP packet" gnus-soup-add-article t]
2411 ["Print with Muttprint..." gnus-summary-muttprint t]
2412 ["Print" gnus-summary-print-article
2413 ,@(if (featurep 'xemacs) '(t)
2414 '(:help "Generate and print a PostScript image"))])
2415 ("Copy, move,... (Backend)"
2416 ,@(if (featurep 'xemacs) nil
2417 '(:help "Copying, moving, expiring articles..."))
2418 ["Respool article..." gnus-summary-respool-article t]
2419 ["Move article..." gnus-summary-move-article
2420 (gnus-check-backend-function
2421 'request-move-article gnus-newsgroup-name)]
2422 ["Copy article..." gnus-summary-copy-article t]
2423 ["Crosspost article..." gnus-summary-crosspost-article
2424 (gnus-check-backend-function
2425 'request-replace-article gnus-newsgroup-name)]
2426 ["Import file..." gnus-summary-import-article
2427 (gnus-check-backend-function
2428 'request-accept-article gnus-newsgroup-name)]
2429 ["Create article..." gnus-summary-create-article
2430 (gnus-check-backend-function
2431 'request-accept-article gnus-newsgroup-name)]
2432 ["Check if posted" gnus-summary-article-posted-p t]
2433 ["Edit article" gnus-summary-edit-article
2434 (not (gnus-group-read-only-p))]
2435 ["Delete article" gnus-summary-delete-article
2436 (gnus-check-backend-function
2437 'request-expire-articles gnus-newsgroup-name)]
2438 ["Query respool" gnus-summary-respool-query t]
2439 ["Trace respool" gnus-summary-respool-trace t]
2440 ["Delete expirable articles" gnus-summary-expire-articles-now
2441 (gnus-check-backend-function
2442 'request-expire-articles gnus-newsgroup-name)])
2444 ["Uudecode" gnus-uu-decode-uu
2445 ,@(if (featurep 'xemacs) '(t)
2446 '(:help "Decode uuencoded article(s)"))]
2447 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2448 ["Unshar" gnus-uu-decode-unshar t]
2449 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2450 ["Save" gnus-uu-decode-save t]
2451 ["Binhex" gnus-uu-decode-binhex t]
2452 ["Postscript" gnus-uu-decode-postscript t]
2453 ["All MIME parts" gnus-summary-save-parts t])
2455 ["Enter article" gnus-cache-enter-article t]
2456 ["Remove article" gnus-cache-remove-article t])
2457 ["Translate" gnus-article-babel t]
2458 ["Select article buffer" gnus-summary-select-article-buffer t]
2459 ["Make article buffer sticky" gnus-sticky-article t]
2460 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2461 ["Isearch article..." gnus-summary-isearch-article t]
2462 ["Beginning of the article" gnus-summary-beginning-of-article t]
2463 ["End of the article" gnus-summary-end-of-article t]
2464 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2465 ["Fetch referenced articles" gnus-summary-refer-references t]
2466 ["Fetch current thread" gnus-summary-refer-thread t]
2467 ["Fetch article with id..." gnus-summary-refer-article t]
2468 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2469 ["Redisplay" gnus-summary-show-article t]
2470 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2472 gnus-summary-article-menu gnus-summary-mode-map ""
2473 (cons "Article" innards))
2475 (if (not (keymapp gnus-summary-article-menu))
2477 gnus-article-commands-menu gnus-article-mode-map ""
2478 (cons "Commands" innards))
2479 ;; in Emacs, don't share menu.
2480 (setq gnus-article-commands-menu
2481 (copy-keymap gnus-summary-article-menu))
2482 (define-key gnus-article-mode-map [menu-bar commands]
2483 (cons "Commands" gnus-article-commands-menu))))
2486 gnus-summary-thread-menu gnus-summary-mode-map ""
2488 ["Find all messages in thread" gnus-summary-refer-thread t]
2489 ["Toggle threading" gnus-summary-toggle-threads t]
2490 ["Hide threads" gnus-summary-hide-all-threads t]
2491 ["Show threads" gnus-summary-show-all-threads t]
2492 ["Hide thread" gnus-summary-hide-thread t]
2493 ["Show thread" gnus-summary-show-thread t]
2494 ["Go to next thread" gnus-summary-next-thread t]
2495 ["Go to previous thread" gnus-summary-prev-thread t]
2496 ["Go down thread" gnus-summary-down-thread t]
2497 ["Go up thread" gnus-summary-up-thread t]
2498 ["Top of thread" gnus-summary-top-thread t]
2499 ["Mark thread as read" gnus-summary-kill-thread t]
2500 ["Mark thread as expired" gnus-summary-expire-thread t]
2501 ["Lower thread score" gnus-summary-lower-thread t]
2502 ["Raise thread score" gnus-summary-raise-thread t]
2503 ["Rethread current" gnus-summary-rethread-current t]))
2506 gnus-summary-post-menu gnus-summary-mode-map ""
2508 ["Send a message (mail or news)" gnus-summary-post-news
2509 ,@(if (featurep 'xemacs) '(t)
2510 '(:help "Compose a new message (mail or news)"))]
2511 ["Followup" gnus-summary-followup
2512 ,@(if (featurep 'xemacs) '(t)
2513 '(:help "Post followup to this article"))]
2514 ["Followup and yank" gnus-summary-followup-with-original
2515 ,@(if (featurep 'xemacs) '(t)
2516 '(:help "Post followup to this article, quoting its contents"))]
2517 ["Supersede article" gnus-summary-supersede-article t]
2518 ["Cancel article" gnus-summary-cancel-article
2519 ,@(if (featurep 'xemacs) '(t)
2520 '(:help "Cancel an article you posted"))]
2521 ["Reply" gnus-summary-reply t]
2522 ["Reply and yank" gnus-summary-reply-with-original t]
2523 ["Wide reply" gnus-summary-wide-reply t]
2524 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2525 ,@(if (featurep 'xemacs) '(t)
2526 '(:help "Mail a reply, quoting this article"))]
2527 ["Very wide reply" gnus-summary-very-wide-reply t]
2528 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2529 ,@(if (featurep 'xemacs) '(t)
2530 '(:help "Mail a very wide reply, quoting this article"))]
2531 ["Mail forward" gnus-summary-mail-forward t]
2532 ["Post forward" gnus-summary-post-forward t]
2533 ["Digest and mail" gnus-uu-digest-mail-forward t]
2534 ["Digest and post" gnus-uu-digest-post-forward t]
2535 ["Resend message" gnus-summary-resend-message t]
2536 ["Resend message edit" gnus-summary-resend-message-edit t]
2537 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2538 ["Send a mail" gnus-summary-mail-other-window t]
2539 ["Create a local message" gnus-summary-news-other-window t]
2540 ["Uuencode and post" gnus-uu-post-news
2541 ,@(if (featurep 'xemacs) '(t)
2542 '(:help "Post a uuencoded article"))]
2543 ["Followup via news" gnus-summary-followup-to-mail t]
2544 ["Followup via news and yank"
2545 gnus-summary-followup-to-mail-with-original t]
2547 ;;["Send" gnus-summary-send-draft t]
2548 ;;["Send bounced" gnus-resend-bounced-mail t])
2552 ((not (keymapp gnus-summary-post-menu))
2553 (setq gnus-article-post-menu gnus-summary-post-menu))
2554 ((not gnus-article-post-menu)
2555 ;; Don't share post menu.
2556 (setq gnus-article-post-menu
2557 (copy-keymap gnus-summary-post-menu))))
2558 (define-key gnus-article-mode-map [menu-bar post]
2559 (cons "Post" gnus-article-post-menu))
2562 gnus-summary-misc-menu gnus-summary-mode-map ""
2565 ["Mark as read" gnus-summary-mark-as-read-forward t]
2566 ["Mark same subject and select"
2567 gnus-summary-kill-same-subject-and-select t]
2568 ["Mark same subject" gnus-summary-kill-same-subject t]
2569 ["Catchup" gnus-summary-catchup
2570 ,@(if (featurep 'xemacs) '(t)
2571 '(:help "Mark unread articles in this group as read"))]
2572 ["Catchup all" gnus-summary-catchup-all t]
2573 ["Catchup to here" gnus-summary-catchup-to-here t]
2574 ["Catchup from here" gnus-summary-catchup-from-here t]
2575 ["Catchup region" gnus-summary-mark-region-as-read
2576 (gnus-mark-active-p)]
2577 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2579 ["Tick" gnus-summary-tick-article-forward t]
2580 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2581 ["Remove marks" gnus-summary-clear-mark-forward t]
2582 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2583 ["Set bookmark" gnus-summary-set-bookmark t]
2584 ["Remove bookmark" gnus-summary-remove-bookmark t])
2586 ["Important" gnus-registry-set-article-Important-mark t]
2587 ["Not Important" gnus-registry-remove-article-Important-mark t]
2588 ["Work" gnus-registry-set-article-Work-mark t]
2589 ["Not Work" gnus-registry-remove-article-Work-mark t]
2590 ["Later" gnus-registry-set-article-Later-mark t]
2591 ["Not Later" gnus-registry-remove-article-Later-mark t]
2592 ["Personal" gnus-registry-set-article-Personal-mark t]
2593 ["Not Personal" gnus-registry-remove-article-Personal-mark t]
2594 ["To Do" gnus-registry-set-article-To-Do-mark t]
2595 ["Not To Do" gnus-registry-remove-article-To-Do-mark t])
2597 ["Marks..." gnus-summary-limit-to-marks t]
2598 ["Subject..." gnus-summary-limit-to-subject t]
2599 ["Author..." gnus-summary-limit-to-author t]
2600 ["Recipient..." gnus-summary-limit-to-recipient t]
2601 ["Address..." gnus-summary-limit-to-address t]
2602 ["Age..." gnus-summary-limit-to-age t]
2603 ["Extra..." gnus-summary-limit-to-extra t]
2604 ["Score..." gnus-summary-limit-to-score t]
2605 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2606 ["Unread" gnus-summary-limit-to-unread t]
2607 ["Unseen" gnus-summary-limit-to-unseen t]
2608 ["Singletons" gnus-summary-limit-to-singletons t]
2609 ["Replied" gnus-summary-limit-to-replied t]
2610 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2611 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2612 ["Pop limit" gnus-summary-pop-limit t]
2613 ["Show dormant" gnus-summary-limit-include-dormant t]
2614 ["Hide childless dormant"
2615 gnus-summary-limit-exclude-childless-dormant t]
2616 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2617 ["Hide marked" gnus-summary-limit-exclude-marks t]
2618 ["Show expunged" gnus-summary-limit-include-expunged t])
2620 ["Set mark" gnus-summary-mark-as-processable t]
2621 ["Remove mark" gnus-summary-unmark-as-processable t]
2622 ["Remove all marks" gnus-summary-unmark-all-processable t]
2623 ["Invert marks" gnus-uu-invert-processable t]
2624 ["Mark above" gnus-uu-mark-over t]
2625 ["Mark series" gnus-uu-mark-series t]
2626 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2627 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2628 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2629 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2630 ["Mark all" gnus-uu-mark-all t]
2631 ["Mark buffer" gnus-uu-mark-buffer t]
2632 ["Mark sparse" gnus-uu-mark-sparse t]
2633 ["Mark thread" gnus-uu-mark-thread t]
2634 ["Unmark thread" gnus-uu-unmark-thread t]
2635 ("Process Mark Sets"
2636 ["Kill" gnus-summary-kill-process-mark t]
2637 ["Yank" gnus-summary-yank-process-mark
2638 gnus-newsgroup-process-stack]
2639 ["Save" gnus-summary-save-process-mark t]
2640 ["Run command on marked..." gnus-summary-universal-argument t]))
2642 ["Page forward" gnus-summary-next-page
2643 ,@(if (featurep 'xemacs) '(t)
2644 '(:help "Show next page of article"))]
2645 ["Page backward" gnus-summary-prev-page
2646 ,@(if (featurep 'xemacs) '(t)
2647 '(:help "Show previous page of article"))]
2648 ["Line forward" gnus-summary-scroll-up t])
2650 ["Next unread article" gnus-summary-next-unread-article t]
2651 ["Previous unread article" gnus-summary-prev-unread-article t]
2652 ["Next article" gnus-summary-next-article t]
2653 ["Previous article" gnus-summary-prev-article t]
2654 ["Next unread subject" gnus-summary-next-unread-subject t]
2655 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2656 ["Next article same subject" gnus-summary-next-same-subject t]
2657 ["Previous article same subject" gnus-summary-prev-same-subject t]
2658 ["First unread article" gnus-summary-first-unread-article t]
2659 ["Best unread article" gnus-summary-best-unread-article t]
2660 ["Go to subject number..." gnus-summary-goto-subject t]
2661 ["Go to article number..." gnus-summary-goto-article t]
2662 ["Go to the last article" gnus-summary-goto-last-article t]
2663 ["Pop article off history" gnus-summary-pop-article t])
2665 ["Sort by number" gnus-summary-sort-by-number t]
2666 ["Sort by author" gnus-summary-sort-by-author t]
2667 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2668 ["Sort by subject" gnus-summary-sort-by-subject t]
2669 ["Sort by date" gnus-summary-sort-by-date t]
2670 ["Sort by score" gnus-summary-sort-by-score t]
2671 ["Sort by lines" gnus-summary-sort-by-lines t]
2672 ["Sort by characters" gnus-summary-sort-by-chars t]
2673 ["Randomize" gnus-summary-sort-by-random t]
2674 ["Original sort" gnus-summary-sort-by-original t])
2676 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2677 ["Describe group" gnus-summary-describe-group t]
2678 ["Fetch charter" gnus-group-fetch-charter
2679 ,@(if (featurep 'xemacs) nil
2680 '(:help "Display the charter of the current group"))]
2681 ["Fetch control message" gnus-group-fetch-control
2682 ,@(if (featurep 'xemacs) nil
2683 '(:help "Display the archived control message for the current group"))]
2684 ["Read manual" gnus-info-find-node t])
2686 ["Pick and read" gnus-pick-mode t]
2687 ["Binary" gnus-binary-mode t])
2689 ["Regenerate" gnus-summary-prepare t]
2690 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2691 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2692 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2693 ["Toggle threading" gnus-summary-toggle-threads t])
2694 ["See old articles" gnus-summary-insert-old-articles t]
2695 ["See new articles" gnus-summary-insert-new-articles t]
2696 ["Filter articles..." gnus-summary-execute-command t]
2697 ["Run command on articles..." gnus-summary-universal-argument t]
2698 ["Search articles forward..." gnus-summary-search-article-forward t]
2699 ["Search articles backward..." gnus-summary-search-article-backward t]
2700 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2701 ["Expand window" gnus-summary-expand-window t]
2702 ["Expire expirable articles" gnus-summary-expire-articles
2703 (gnus-check-backend-function
2704 'request-expire-articles gnus-newsgroup-name)]
2705 ["Edit local kill file" gnus-summary-edit-local-kill t]
2706 ["Edit main kill file" gnus-summary-edit-global-kill t]
2707 ["Edit group parameters" gnus-summary-edit-parameters t]
2708 ["Customize group parameters" gnus-summary-customize-parameters t]
2709 ["Send a bug report" gnus-bug t]
2711 ["Catchup and exit" gnus-summary-catchup-and-exit
2712 ,@(if (featurep 'xemacs) '(t)
2713 '(:help "Mark unread articles in this group as read, then exit"))]
2714 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2715 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2716 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2717 ["Exit group" gnus-summary-exit
2718 ,@(if (featurep 'xemacs) '(t)
2719 '(:help "Exit current group, return to group selection mode"))]
2720 ["Exit group without updating" gnus-summary-exit-no-update t]
2721 ["Exit and goto next group" gnus-summary-next-group t]
2722 ["Exit and goto prev group" gnus-summary-prev-group t]
2723 ["Reselect group" gnus-summary-reselect-current-group t]
2724 ["Rescan group" gnus-summary-rescan-group t]
2725 ["Update dribble" gnus-summary-save-newsrc t])))
2727 (gnus-run-hooks 'gnus-summary-menu-hook)))
2729 (defvar gnus-summary-tool-bar-map nil)
2731 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2732 ;; affect _new_ message buffers. We might add a function that walks thru all
2733 ;; summary-mode buffers and force the update.
2734 (defun gnus-summary-tool-bar-update (&optional symbol value)
2735 "Update summary mode toolbar.
2736 Setter function for custom variables."
2737 (setq-default gnus-summary-tool-bar-map nil)
2739 ;; When used as ":set" function:
2740 (set-default symbol value))
2741 (when (gnus-buffer-live-p gnus-summary-buffer)
2742 (with-current-buffer gnus-summary-buffer
2743 (gnus-summary-make-tool-bar))))
2745 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2746 'gnus-summary-tool-bar-gnome
2747 'gnus-summary-tool-bar-retro)
2748 "Specifies the Gnus summary tool bar.
2750 It can be either a list or a symbol refering to a list. See
2751 `gmm-tool-bar-from-list' for the format of the list. The
2752 default key map is `gnus-summary-mode-map'.
2754 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2755 `gnus-summary-tool-bar-retro'."
2756 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2757 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2758 (repeat :tag "User defined list" gmm-tool-bar-item)
2760 :version "23.1" ;; No Gnus
2761 :initialize 'custom-initialize-default
2762 :set 'gnus-summary-tool-bar-update
2763 :group 'gnus-summary)
2765 (defcustom gnus-summary-tool-bar-gnome
2766 '((gnus-summary-post-news "mail/compose" nil)
2767 (gnus-summary-insert-new-articles "mail/inbox" nil
2768 :visible (or (not gnus-agent)
2770 (gnus-summary-reply-with-original "mail/reply")
2771 (gnus-summary-reply "mail/reply" nil :visible nil)
2772 (gnus-summary-followup-with-original "mail/reply-all")
2773 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2774 (gnus-summary-mail-forward "mail/forward")
2775 (gnus-summary-save-article "mail/save")
2776 (gnus-summary-search-article-forward "search" nil :visible nil)
2777 (gnus-summary-print-article "print")
2778 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2779 ;; Some new commands that may need more suitable icons:
2780 (gnus-summary-save-newsrc "save" nil :visible nil)
2781 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2782 (gnus-summary-prev-article "left-arrow")
2783 (gnus-summary-next-article "right-arrow")
2784 (gnus-summary-next-page "next-page")
2785 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2787 ;; Maybe some sort-by-... could be added:
2788 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2789 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2790 (gnus-summary-mark-as-expirable
2792 :visible (gnus-check-backend-function 'request-expire-articles
2793 gnus-newsgroup-name))
2794 (gnus-summary-mark-as-spam
2796 :visible (and (fboundp 'spam-group-ham-contents-p)
2797 (spam-group-ham-contents-p gnus-newsgroup-name))
2798 :help "Mark as spam")
2799 (gnus-summary-mark-as-read-forward
2801 :visible (and (fboundp 'spam-group-spam-contents-p)
2802 (spam-group-spam-contents-p gnus-newsgroup-name)))
2804 (gnus-summary-exit "exit")
2805 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2806 (gnus-info-find-node "help"))
2807 "List of functions for the summary tool bar (GNOME style).
2809 See `gmm-tool-bar-from-list' for the format of the list."
2810 :type '(repeat gmm-tool-bar-item)
2811 :version "23.1" ;; No Gnus
2812 :initialize 'custom-initialize-default
2813 :set 'gnus-summary-tool-bar-update
2814 :group 'gnus-summary)
2816 (defcustom gnus-summary-tool-bar-retro
2817 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2818 (gnus-summary-next-unread-article "gnus/next-ur")
2819 (gnus-summary-post-news "gnus/post")
2820 (gnus-summary-followup-with-original "gnus/fuwo")
2821 (gnus-summary-followup "gnus/followup")
2822 (gnus-summary-reply-with-original "gnus/reply-wo")
2823 (gnus-summary-reply "gnus/reply")
2824 (gnus-summary-caesar-message "gnus/rot13")
2825 (gnus-uu-decode-uu "gnus/uu-decode")
2826 (gnus-summary-save-article-file "gnus/save-aif")
2827 (gnus-summary-save-article "gnus/save-art")
2828 (gnus-uu-post-news "gnus/uu-post")
2829 (gnus-summary-catchup "gnus/catchup")
2830 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2831 (gnus-summary-exit "gnus/exit-summ")
2832 ;; Some new command that may need more suitable icons:
2833 (gnus-summary-print-article "gnus/print" nil :visible nil)
2834 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2835 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2836 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2837 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2838 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2839 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2841 (gnus-info-find-node "gnus/help" nil :visible nil))
2842 "List of functions for the summary tool bar (retro look).
2844 See `gmm-tool-bar-from-list' for the format of the list."
2845 :type '(repeat gmm-tool-bar-item)
2846 :version "23.1" ;; No Gnus
2847 :initialize 'custom-initialize-default
2848 :set 'gnus-summary-tool-bar-update
2849 :group 'gnus-summary)
2851 (defcustom gnus-summary-tool-bar-zap-list t
2852 "List of icon items from the global tool bar.
2853 These items are not displayed in the Gnus summary mode tool bar.
2855 See `gmm-tool-bar-from-list' for the format of the list."
2856 :type 'gmm-tool-bar-zap-list
2857 :version "23.1" ;; No Gnus
2858 :initialize 'custom-initialize-default
2859 :set 'gnus-summary-tool-bar-update
2860 :group 'gnus-summary)
2862 (defvar image-load-path)
2864 (defun gnus-summary-make-tool-bar (&optional force)
2865 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2866 When FORCE, rebuild the tool bar."
2867 (when (and (not (featurep 'xemacs))
2868 (boundp 'tool-bar-mode)
2870 (or (not gnus-summary-tool-bar-map) force))
2872 (gmm-image-load-path-for-library "gnus"
2875 (image-load-path (cons (car load-path)
2876 (when (boundp 'image-load-path)
2878 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2879 gnus-summary-tool-bar-zap-list
2880 'gnus-summary-mode-map)))
2882 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2884 (setq gnus-summary-tool-bar-map map))))
2885 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2887 (defun gnus-score-set-default (var value)
2888 "A version of set that updates the GNU Emacs menu-bar."
2890 ;; It is the message that forces the active status to be updated.
2893 (defun gnus-make-score-map (type)
2894 "Make a summary score map of type TYPE."
2897 (let ((headers '(("author" "from" string)
2898 ("subject" "subject" string)
2899 ("article body" "body" string)
2900 ("article head" "head" string)
2901 ("xref" "xref" string)
2902 ("extra header" "extra" string)
2903 ("lines" "lines" number)
2904 ("followups to author" "followup" string)))
2905 (types '((number ("less than" <)
2908 (string ("substring" s)
2912 (perms '(("temporary" (current-time-string))
2920 (if (eq type 'lower)
2925 (setq header (car headers))
2931 (let ((ts (cdr (assoc (nth 2 header) types)))
2947 'gnus-summary-score-entry
2949 (if (or (string= (nth 1 header)
2951 (string= (nth 1 header)
2954 (list 'gnus-summary-header
2956 (list 'quote (nth 1 (car ts)))
2957 (list 'gnus-score-delta-default
2964 (list (nreverse outp))))
2967 (list (nreverse outt))))
2969 (setq headers (cdr headers)))
2970 (list (nreverse outh))))))))
2973 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
2977 (defun gnus-summary-mode (&optional group)
2978 "Major mode for reading articles.
2980 All normal editing commands are switched off.
2981 \\<gnus-summary-mode-map>
2982 Each line in this buffer represents one article. To read an
2983 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2984 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2987 You can also post articles and send mail from this buffer. To
2988 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2989 of an article, type `\\[gnus-summary-reply]'.
2991 There are approx. one gazillion commands you can execute in this
2992 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2994 The following commands are available:
2996 \\{gnus-summary-mode-map}"
2998 (kill-all-local-variables)
2999 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3000 (gnus-summary-make-local-variables))
3001 (gnus-summary-make-local-variables)
3002 (setq gnus-newsgroup-name group)
3003 (when (gnus-visual-p 'summary-menu 'menu)
3004 (gnus-summary-make-menu-bar)
3005 (gnus-summary-make-tool-bar))
3006 (gnus-make-thread-indent-array)
3007 (gnus-simplify-mode-line)
3008 (setq major-mode 'gnus-summary-mode)
3009 (setq mode-name "Summary")
3010 (make-local-variable 'minor-mode-alist)
3011 (use-local-map gnus-summary-mode-map)
3012 (buffer-disable-undo)
3013 (setq buffer-read-only t ;Disable modification
3014 show-trailing-whitespace nil)
3015 (setq truncate-lines t)
3016 (setq selective-display t)
3017 (setq selective-display-ellipses t) ;Display `...'
3018 (gnus-summary-set-display-table)
3019 (gnus-set-default-directory)
3020 (make-local-variable 'gnus-summary-line-format)
3021 (make-local-variable 'gnus-summary-line-format-spec)
3022 (make-local-variable 'gnus-summary-dummy-line-format)
3023 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3024 (make-local-variable 'gnus-summary-mark-positions)
3025 (gnus-make-local-hook 'pre-command-hook)
3026 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3027 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3028 (turn-on-gnus-mailing-list-mode)
3029 (mm-enable-multibyte)
3030 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3031 (gnus-update-summary-mark-positions))
3033 (defun gnus-summary-make-local-variables ()
3034 "Make all the local summary buffer variables."
3036 (dolist (local gnus-summary-local-variables)
3039 (if (eq (cdr local) 'global)
3040 ;; Copy the global value of the variable.
3041 (setq global (symbol-value (car local)))
3042 ;; Use the value from the list.
3043 (setq global (eval (cdr local))))
3044 (set (make-local-variable (car local)) global))
3045 ;; Simple nil-valued local variable.
3046 (set (make-local-variable local) nil)))))
3048 (defun gnus-summary-clear-local-variables ()
3049 (let ((locals gnus-summary-local-variables))
3051 (if (consp (car locals))
3052 (and (symbolp (caar locals))
3053 (set (caar locals) nil))
3054 (and (symbolp (car locals))
3055 (set (car locals) nil)))
3056 (setq locals (cdr locals)))))
3058 ;; Summary data functions.
3060 (defmacro gnus-data-number (data)
3063 (defmacro gnus-data-set-number (data number)
3064 `(setcar ,data ,number))
3066 (defmacro gnus-data-mark (data)
3069 (defmacro gnus-data-set-mark (data mark)
3070 `(setcar (nthcdr 1 ,data) ,mark))
3072 (defmacro gnus-data-pos (data)
3075 (defmacro gnus-data-set-pos (data pos)
3076 `(setcar (nthcdr 2 ,data) ,pos))
3078 (defmacro gnus-data-header (data)
3081 (defmacro gnus-data-set-header (data header)
3082 `(setf (nth 3 ,data) ,header))
3084 (defmacro gnus-data-level (data)
3087 (defmacro gnus-data-unread-p (data)
3088 `(= (nth 1 ,data) gnus-unread-mark))
3090 (defmacro gnus-data-read-p (data)
3091 `(/= (nth 1 ,data) gnus-unread-mark))
3093 (defmacro gnus-data-pseudo-p (data)
3094 `(consp (nth 3 ,data)))
3096 (defmacro gnus-data-find (number)
3097 `(assq ,number gnus-newsgroup-data))
3099 (defmacro gnus-data-find-list (number &optional data)
3100 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3101 (memq (assq ,number bdata)
3104 (defmacro gnus-data-make (number mark pos header level)
3105 `(list ,number ,mark ,pos ,header ,level))
3107 (defun gnus-data-enter (after-article number mark pos header level offset)
3108 (let ((data (gnus-data-find-list after-article)))
3110 (error "No such article: %d" after-article))
3111 (setcdr data (cons (gnus-data-make number mark pos header level)
3113 (setq gnus-newsgroup-data-reverse nil)
3114 (gnus-data-update-list (cddr data) offset)))
3116 (defun gnus-data-enter-list (after-article list &optional offset)
3118 (let ((data (and after-article (gnus-data-find-list after-article)))
3122 (let ((odata gnus-newsgroup-data))
3123 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3125 (gnus-data-update-list odata offset)))
3126 ;; Find the last element in the list to be spliced into the main
3128 (setq list (last list))
3131 (setcdr list gnus-newsgroup-data)
3132 (setq gnus-newsgroup-data ilist)
3134 (gnus-data-update-list (cdr list) offset)))
3135 (setcdr list (cdr data))
3138 (gnus-data-update-list (cdr list) offset))))
3139 (setq gnus-newsgroup-data-reverse nil))))
3141 (defun gnus-data-remove (article &optional offset)
3142 (let ((data gnus-newsgroup-data))
3143 (if (= (gnus-data-number (car data)) article)
3145 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3146 gnus-newsgroup-data-reverse nil)
3148 (gnus-data-update-list gnus-newsgroup-data offset)))
3150 (when (= (gnus-data-number (cadr data)) article)
3151 (setcdr data (cddr data))
3153 (gnus-data-update-list (cdr data) offset))
3155 gnus-newsgroup-data-reverse nil))
3156 (setq data (cdr data))))))
3158 (defmacro gnus-data-list (backward)
3160 (or gnus-newsgroup-data-reverse
3161 (setq gnus-newsgroup-data-reverse
3162 (reverse gnus-newsgroup-data)))
3163 gnus-newsgroup-data))
3165 (defun gnus-data-update-list (data offset)
3166 "Add OFFSET to the POS of all data entries in DATA."
3167 (setq gnus-newsgroup-data-reverse nil)
3169 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3170 (setq data (cdr data))))
3172 (defun gnus-summary-article-pseudo-p (article)
3173 "Say whether this article is a pseudo article or not."
3174 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3176 (defmacro gnus-summary-article-sparse-p (article)
3177 "Say whether this article is a sparse article or not."
3178 `(memq ,article gnus-newsgroup-sparse))
3180 (defmacro gnus-summary-article-ancient-p (article)
3181 "Say whether this article is a sparse article or not."
3182 `(memq ,article gnus-newsgroup-ancient))
3184 (defun gnus-article-parent-p (number)
3185 "Say whether this article is a parent or not."
3186 (let ((data (gnus-data-find-list number)))
3187 (and (cdr data) ; There has to be an article after...
3188 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3189 (gnus-data-level (nth 1 data))))))
3191 (defun gnus-article-children (number)
3192 "Return a list of all children to NUMBER."
3193 (let* ((data (gnus-data-find-list number))
3194 (level (gnus-data-level (car data)))
3196 (setq data (cdr data))
3198 (= (gnus-data-level (car data)) (1+ level)))
3199 (push (gnus-data-number (car data)) children)
3200 (setq data (cdr data)))
3203 (defmacro gnus-summary-skip-intangible ()
3204 "If the current article is intangible, then jump to a different article."
3205 '(let ((to (get-text-property (point) 'gnus-intangible)))
3206 (and to (gnus-summary-goto-subject to))))
3208 (defmacro gnus-summary-article-intangible-p ()
3209 "Say whether this article is intangible or not."
3210 '(get-text-property (point) 'gnus-intangible))
3212 (defun gnus-article-read-p (article)
3213 "Say whether ARTICLE is read or not."
3214 (not (or (memq article gnus-newsgroup-marked)
3215 (memq article gnus-newsgroup-spam-marked)
3216 (memq article gnus-newsgroup-unreads)
3217 (memq article gnus-newsgroup-unselected)
3218 (memq article gnus-newsgroup-dormant))))
3220 ;; Some summary mode macros.
3222 (defmacro gnus-summary-article-number ()
3223 "The article number of the article on the current line.
3224 If there isn't an article number here, then we return the current
3227 (gnus-summary-skip-intangible)
3228 (or (get-text-property (point) 'gnus-number)
3229 (gnus-summary-last-subject))))
3231 (defmacro gnus-summary-article-header (&optional number)
3232 "Return the header of article NUMBER."
3233 `(gnus-data-header (gnus-data-find
3234 ,(or number '(gnus-summary-article-number)))))
3236 (defmacro gnus-summary-thread-level (&optional number)
3237 "Return the level of thread that starts with article NUMBER."
3238 `(if (and (eq gnus-summary-make-false-root 'dummy)
3239 (get-text-property (point) 'gnus-intangible))
3241 (gnus-data-level (gnus-data-find
3242 ,(or number '(gnus-summary-article-number))))))
3244 (defmacro gnus-summary-article-mark (&optional number)
3245 "Return the mark of article NUMBER."
3246 `(gnus-data-mark (gnus-data-find
3247 ,(or number '(gnus-summary-article-number)))))
3249 (defmacro gnus-summary-article-pos (&optional number)
3250 "Return the position of the line of article NUMBER."
3251 `(gnus-data-pos (gnus-data-find
3252 ,(or number '(gnus-summary-article-number)))))
3254 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3255 (defmacro gnus-summary-article-subject (&optional number)
3256 "Return current subject string or nil if nothing."
3259 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3260 '(gnus-data-header (assq (gnus-summary-article-number)
3261 gnus-newsgroup-data)))))
3264 (mail-header-subject headers))))
3266 (defmacro gnus-summary-article-score (&optional number)
3267 "Return current article score."
3268 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3269 gnus-newsgroup-scored))
3270 gnus-summary-default-score 0))
3272 (defun gnus-summary-article-children (&optional number)
3273 "Return a list of article numbers that are children of article NUMBER."
3274 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3275 (level (gnus-data-level (car data)))
3277 (while (and (setq data (cdr data))
3278 (> (setq l (gnus-data-level (car data))) level))
3279 (and (= (1+ level) l)
3280 (push (gnus-data-number (car data))
3282 (nreverse children)))
3284 (defun gnus-summary-article-parent (&optional number)
3285 "Return the article number of the parent of article NUMBER."
3286 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3287 (gnus-data-list t)))
3288 (level (gnus-data-level (car data))))
3290 () ; This is a root.
3291 ;; We search until we find an article with a level less than
3292 ;; this one. That function has to be the parent.
3293 (while (and (setq data (cdr data))
3294 (not (< (gnus-data-level (car data)) level))))
3295 (and data (gnus-data-number (car data))))))
3297 (defun gnus-unread-mark-p (mark)
3298 "Say whether MARK is the unread mark."
3299 (= mark gnus-unread-mark))
3301 (defun gnus-read-mark-p (mark)
3302 "Say whether MARK is one of the marks that mark as read.
3303 This is all marks except unread, ticked, dormant, and expirable."
3304 (not (or (= mark gnus-unread-mark)
3305 (= mark gnus-ticked-mark)
3306 (= mark gnus-spam-mark)
3307 (= mark gnus-dormant-mark)
3308 (= mark gnus-expirable-mark))))
3310 (defmacro gnus-article-mark (number)
3311 "Return the MARK of article NUMBER.
3312 This macro should only be used when computing the mark the \"first\"
3313 time; i.e., when generating the summary lines. After that,
3314 `gnus-summary-article-mark' should be used to examine the
3317 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3318 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3319 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3320 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3321 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3322 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3323 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3324 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3325 gnus-ancient-mark))))
3327 ;; Saving hidden threads.
3329 (defmacro gnus-save-hidden-threads (&rest forms)
3330 "Save hidden threads, eval FORMS, and restore the hidden threads."
3331 (let ((config (make-symbol "config")))
3332 `(let ((,config (gnus-hidden-threads-configuration)))
3336 (gnus-restore-hidden-threads-configuration ,config)))))
3337 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3338 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3340 (defun gnus-data-compute-positions ()
3341 "Compute the positions of all articles."
3342 (setq gnus-newsgroup-data-reverse nil)
3343 (let ((data gnus-newsgroup-data))
3345 (gnus-save-hidden-threads
3346 (gnus-summary-show-all-threads)
3347 (goto-char (point-min))
3349 (while (get-text-property (point) 'gnus-intangible)
3351 (gnus-data-set-pos (car data) (+ (point) 3))
3352 (setq data (cdr data))
3353 (forward-line 1))))))
3355 (defun gnus-hidden-threads-configuration ()
3356 "Return the current hidden threads configuration."
3359 (goto-char (point-min))
3360 (while (search-forward "\r" nil t)
3361 (push (1- (point)) config))
3364 (defun gnus-restore-hidden-threads-configuration (config)
3365 "Restore hidden threads configuration from CONFIG."
3367 (let (point (inhibit-read-only t))
3368 (while (setq point (pop config))
3369 (when (and (< point (point-max))
3371 (eq (char-after) ?\n))
3372 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3374 ;; Various summary mode internalish functions.
3376 (defun gnus-mouse-pick-article (e)
3379 (gnus-summary-next-page nil t))
3381 (defun gnus-summary-set-display-table ()
3382 "Change the display table.
3383 Odd characters have a tendency to mess
3384 up nicely formatted displays - we make all possible glyphs
3385 display only a single character."
3387 ;; We start from the standard display table, if any.
3388 (let ((table (or (copy-sequence standard-display-table)
3389 (make-display-table)))
3391 ;; Nix out all the control chars...
3392 (while (>= (setq i (1- i)) 0)
3393 (aset table i [??]))
3394 ;; ... but not newline and cr, of course. (cr is necessary for the
3395 ;; selective display).
3396 (aset table ?\n nil)
3397 (aset table ?\r nil)
3398 ;; We keep TAB as well.
3399 (aset table ?\t nil)
3400 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3401 ;; Emacs 23 (unicode), that are not set already.
3402 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3405 (while (>= (setq i (1- i)) 127)
3406 ;; Only modify if the entry is nil.
3407 (unless (aref table i)
3408 (aset table i [??]))))
3409 (setq buffer-display-table table)))
3411 (defun gnus-summary-set-article-display-arrow (pos)
3412 "Update the overlay arrow to point to line at position POS."
3413 (when (and gnus-summary-display-arrow
3414 (boundp 'overlay-arrow-position)
3415 (boundp 'overlay-arrow-string))
3419 (unless overlay-arrow-position
3420 (setq overlay-arrow-position (make-marker)))
3421 (setq overlay-arrow-string "=>"
3422 overlay-arrow-position (set-marker overlay-arrow-position
3424 (current-buffer))))))
3426 (defun gnus-summary-setup-buffer (group)
3427 "Initialize summary buffer."
3428 (let ((buffer (gnus-summary-buffer-name group))
3429 (dead-name (concat "*Dead Summary "
3430 (gnus-group-decoded-name group) "*")))
3431 ;; If a dead summary buffer exists, we kill it.
3432 (when (gnus-buffer-live-p dead-name)
3433 (gnus-kill-buffer dead-name))
3434 (if (get-buffer buffer)
3437 (setq gnus-summary-buffer (current-buffer))
3438 (not gnus-newsgroup-prepared))
3439 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3440 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3441 (gnus-summary-mode group)
3443 (gnus-carpal-setup-buffer 'summary))
3444 (when (gnus-group-quit-config group)
3445 (set (make-local-variable 'gnus-single-article-buffer) nil))
3446 (make-local-variable 'gnus-article-buffer)
3447 (make-local-variable 'gnus-article-current)
3448 (make-local-variable 'gnus-original-article-buffer)
3449 (setq gnus-newsgroup-name group)
3450 ;; Set any local variables in the group parameters.
3451 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3454 (defun gnus-set-global-variables ()
3455 "Set the global equivalents of the buffer-local variables.
3456 They are set to the latest values they had. These reflect the summary
3457 buffer that was in action when the last article was fetched."
3458 (when (eq major-mode 'gnus-summary-mode)
3459 (setq gnus-summary-buffer (current-buffer))
3460 (let ((name gnus-newsgroup-name)
3461 (marked gnus-newsgroup-marked)
3462 (spam gnus-newsgroup-spam-marked)
3463 (unread gnus-newsgroup-unreads)
3464 (headers gnus-current-headers)
3465 (data gnus-newsgroup-data)
3466 (summary gnus-summary-buffer)
3467 (article-buffer gnus-article-buffer)
3468 (original gnus-original-article-buffer)
3469 (gac gnus-article-current)
3470 (reffed gnus-reffed-article-number)
3471 (score-file gnus-current-score-file)
3472 (default-charset gnus-newsgroup-charset)
3474 (let ((locals gnus-newsgroup-variables))
3476 (if (consp (car locals))
3477 (push (eval (caar locals)) vlist)
3478 (push (eval (car locals)) vlist))
3479 (setq locals (cdr locals)))
3480 (setq vlist (nreverse vlist)))
3481 (with-current-buffer gnus-group-buffer
3482 (setq gnus-newsgroup-name name
3483 gnus-newsgroup-marked marked
3484 gnus-newsgroup-spam-marked spam
3485 gnus-newsgroup-unreads unread
3486 gnus-current-headers headers
3487 gnus-newsgroup-data data
3488 gnus-article-current gac
3489 gnus-summary-buffer summary
3490 gnus-article-buffer article-buffer
3491 gnus-original-article-buffer original
3492 gnus-reffed-article-number reffed
3493 gnus-current-score-file score-file
3494 gnus-newsgroup-charset default-charset)
3495 (let ((locals gnus-newsgroup-variables))
3497 (if (consp (car locals))
3498 (set (caar locals) (pop vlist))
3499 (set (car locals) (pop vlist)))
3500 (setq locals (cdr locals))))
3501 ;; The article buffer also has local variables.
3502 (when (gnus-buffer-live-p gnus-article-buffer)
3503 (set-buffer gnus-article-buffer)
3504 (setq gnus-summary-buffer summary))))))
3506 (defun gnus-summary-article-unread-p (article)
3507 "Say whether ARTICLE is unread or not."
3508 (memq article gnus-newsgroup-unreads))
3510 (defun gnus-summary-first-article-p (&optional article)
3511 "Return whether ARTICLE is the first article in the buffer."
3512 (if (not (setq article (or article (gnus-summary-article-number))))
3514 (eq article (caar gnus-newsgroup-data))))
3516 (defun gnus-summary-last-article-p (&optional article)
3517 "Return whether ARTICLE is the last article in the buffer."
3518 (if (not (setq article (or article (gnus-summary-article-number))))
3519 ;; All non-existent numbers are the last article. :-)
3521 (not (cdr (gnus-data-find-list article)))))
3523 (defun gnus-make-thread-indent-array (&optional n)
3525 (progn (setq n 200) nil)
3526 (null gnus-thread-indent-array)
3527 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3528 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3529 gnus-thread-indent-array-level gnus-thread-indent-level)
3531 (aset gnus-thread-indent-array n
3532 (make-string (* n gnus-thread-indent-level) ? ))
3535 (defun gnus-update-summary-mark-positions ()
3536 "Compute where the summary marks are to go."
3538 (when (gnus-buffer-exists-p gnus-summary-buffer)
3539 (set-buffer gnus-summary-buffer))
3540 (let ((spec gnus-summary-line-format-spec)
3543 (gnus-set-work-buffer)
3544 (let ((gnus-tmp-unread ?Z)
3545 (gnus-replied-mark ?Z)
3546 (gnus-score-below-mark ?Z)
3547 (gnus-score-over-mark ?Z)
3548 (gnus-undownloaded-mark ?Z)
3549 (gnus-summary-line-format-spec spec)
3550 (gnus-newsgroup-downloadable '(0))
3551 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3552 case-fold-search ignores)
3553 ;; Here, all marks are bound to Z.
3554 (gnus-summary-insert-line header
3555 0 nil t gnus-tmp-unread t nil "" nil 1)
3556 (goto-char (point-min))
3557 ;; Memorize the positions of the same characters as dummy marks.
3558 (while (re-search-forward "[A-D]" nil t)
3559 (push (point) ignores))
3561 ;; We use A-D as dummy marks in order to know column positions
3562 ;; where marks should be inserted.
3563 (setq gnus-tmp-unread ?A
3564 gnus-replied-mark ?B
3565 gnus-score-below-mark ?C
3566 gnus-score-over-mark ?C
3567 gnus-undownloaded-mark ?D)
3568 (gnus-summary-insert-line header
3569 0 nil t gnus-tmp-unread t nil "" nil 1)
3570 ;; Ignore characters which aren't dummy marks.
3572 (delete-region (goto-char (1- p)) p)
3574 (goto-char (point-min))
3575 (setq pos (list (cons 'unread
3576 (and (search-forward "A" nil t)
3577 (- (point) (point-min) 1)))))
3578 (goto-char (point-min))
3579 (push (cons 'replied (and (search-forward "B" nil t)
3580 (- (point) (point-min) 1)))
3582 (goto-char (point-min))
3583 (push (cons 'score (and (search-forward "C" nil t)
3584 (- (point) (point-min) 1)))
3586 (goto-char (point-min))
3587 (push (cons 'download (and (search-forward "D" nil t)
3588 (- (point) (point-min) 1)))
3590 (setq gnus-summary-mark-positions pos))))
3592 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3593 "Insert a dummy root in the summary buffer."
3595 (gnus-add-text-properties
3596 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3597 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3599 (defun gnus-summary-extract-address-component (from)
3600 (or (car (funcall gnus-extract-address-components from))
3603 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3604 (let ((mail-parse-charset gnus-newsgroup-charset)
3605 (ignored-from-addresses (gnus-ignored-from-addresses))
3606 ; Is it really necessary to do this next part for each summary line?
3607 ; Luckily, doesn't seem to slow things down much.
3608 (mail-parse-ignored-charsets
3609 (with-current-buffer gnus-summary-buffer
3610 gnus-newsgroup-ignored-charsets)))
3612 (and ignored-from-addresses
3613 (string-match ignored-from-addresses gnus-tmp-from)
3614 (let ((extra-headers (mail-header-extra header))
3618 ((setq to (cdr (assq 'To extra-headers)))
3619 (concat gnus-summary-to-prefix
3621 (gnus-summary-extract-address-component
3622 (funcall gnus-decode-encoded-address-function to)))))
3625 (cdr (assq 'Newsgroups extra-headers))
3627 (memq 'Newsgroups gnus-extra-headers)
3628 (eq (car (gnus-find-method-for-group
3629 gnus-newsgroup-name)) 'nntp)
3630 (gnus-group-real-name gnus-newsgroup-name))))
3631 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3632 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3634 (defun gnus-summary-insert-line (gnus-tmp-header
3635 gnus-tmp-level gnus-tmp-current
3636 undownloaded gnus-tmp-unread gnus-tmp-replied
3637 gnus-tmp-expirable gnus-tmp-subject-or-nil
3638 &optional gnus-tmp-dummy gnus-tmp-score
3640 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3641 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3643 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3644 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3645 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3646 (gnus-tmp-score-char
3647 (if (or (null gnus-summary-default-score)
3648 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3649 gnus-summary-zcore-fuzz))
3651 (if (< gnus-tmp-score gnus-summary-default-score)
3652 gnus-score-below-mark gnus-score-over-mark)))
3653 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3655 (cond (gnus-tmp-process gnus-process-mark)
3656 ((memq gnus-tmp-current gnus-newsgroup-cached)
3658 (gnus-tmp-replied gnus-replied-mark)
3659 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3660 gnus-forwarded-mark)
3661 ((memq gnus-tmp-current gnus-newsgroup-saved)
3663 ((memq gnus-tmp-number gnus-newsgroup-recent)
3665 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3668 (gnus-tmp-downloaded
3670 gnus-undownloaded-mark)
3671 (gnus-newsgroup-agentized
3672 gnus-downloaded-mark)
3675 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3678 ((string-match "<[^>]+> *$" gnus-tmp-from)
3679 (let ((beg (match-beginning 0)))
3680 (or (and (string-match "^\".+\"" gnus-tmp-from)
3681 (substring gnus-tmp-from 1 (1- (match-end 0))))
3682 (substring gnus-tmp-from 0 beg))))
3683 ((string-match "(.+)" gnus-tmp-from)
3684 (substring gnus-tmp-from
3685 (1+ (match-beginning 0)) (1- (match-end 0))))
3687 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3688 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3689 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3690 (inhibit-read-only t))
3691 (when (string= gnus-tmp-name "")
3692 (setq gnus-tmp-name gnus-tmp-from))
3693 (unless (numberp gnus-tmp-lines)
3694 (setq gnus-tmp-lines -1))
3695 (if (= gnus-tmp-lines -1)
3696 (setq gnus-tmp-lines "?")
3697 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3698 (gnus-put-text-property
3700 (progn (eval gnus-summary-line-format-spec) (point))
3701 'gnus-number gnus-tmp-number)
3702 (when (gnus-visual-p 'summary-highlight 'highlight)
3704 (gnus-run-hooks 'gnus-summary-update-hook)
3707 (defun gnus-summary-update-line (&optional dont-update)
3708 "Update summary line after change."
3709 (when (and gnus-summary-default-score
3710 (not gnus-summary-inhibit-highlight))
3711 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3712 (article (gnus-summary-article-number))
3713 (score (gnus-summary-article-score article)))
3715 (if (and gnus-summary-mark-below
3716 (< (gnus-summary-article-score)
3717 gnus-summary-mark-below))
3718 ;; This article has a low score, so we mark it as read.
3719 (when (memq article gnus-newsgroup-unreads)
3720 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3721 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3722 ;; This article was previously marked as read on account
3723 ;; of a low score, but now it has risen, so we mark it as
3725 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3726 (gnus-summary-update-mark
3727 (if (or (null gnus-summary-default-score)
3728 (<= (abs (- score gnus-summary-default-score))
3729 gnus-summary-zcore-fuzz))
3731 (if (< score gnus-summary-default-score)
3732 gnus-score-below-mark gnus-score-over-mark))
3734 ;; Do visual highlighting.
3735 (when (gnus-visual-p 'summary-highlight 'highlight)
3736 (gnus-run-hooks 'gnus-summary-update-hook)))))
3738 (defvar gnus-tmp-new-adopts nil)
3740 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3741 "Return the number of articles in THREAD.
3742 This may be 0 in some cases -- if none of the articles in
3743 the thread are to be displayed."
3745 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3747 ((not (listp thread))
3749 ((and (consp thread) (cdr thread))
3752 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3755 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3758 (when (and level (zerop level) gnus-tmp-new-adopts)
3761 'gnus-summary-number-of-articles-in-thread
3762 gnus-tmp-new-adopts))))
3764 (if (> number 1) gnus-not-empty-thread-mark
3765 gnus-empty-thread-mark)
3768 (defsubst gnus-summary-line-message-size (head)
3769 "Return pretty-printed version of message size.
3770 This function is intended to be used in
3771 `gnus-summary-line-format-alist'."
3772 (let ((c (or (mail-header-chars head) -1)))
3773 (cond ((< c 0) "n/a") ; chars not available
3774 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3775 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3776 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3777 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3780 (defun gnus-summary-set-local-parameters (group)
3781 "Go through the local params of GROUP and set all variable specs in that list."
3782 (let ((vars '(quit-config))) ; Ignore quit-config.
3783 (dolist (elem (gnus-group-find-parameter group))
3784 (and (consp elem) ; Has to be a cons.
3785 (consp (cdr elem)) ; The cdr has to be a list.
3786 (symbolp (car elem)) ; Has to be a symbol in there.
3787 (not (memq (car elem) vars))
3788 (ignore-errors ; So we set it.
3789 (push (car elem) vars)
3790 (make-local-variable (car elem))
3791 (set (car elem) (eval (nth 1 elem))))))))
3793 (defun gnus-summary-read-group (group &optional show-all no-article
3794 kill-buffer no-display backward
3796 "Start reading news in newsgroup GROUP.
3797 If SHOW-ALL is non-nil, already read articles are also listed.
3798 If NO-ARTICLE is non-nil, no article is selected initially.
3799 If NO-DISPLAY, don't generate a summary buffer."
3803 (let ((gnus-auto-select-next nil))
3804 (or (gnus-summary-read-group-1
3805 group show-all no-article
3806 kill-buffer no-display
3809 select-articles nil)))))
3810 (eq gnus-auto-select-next 'quietly))
3811 (set-buffer gnus-group-buffer)
3812 ;; The entry function called above goes to the next
3813 ;; group automatically, so we go two groups back
3814 ;; if we are searching for the previous group.
3816 (gnus-group-prev-unread-group 2))
3817 (if (not (equal group (gnus-group-group-name)))
3818 (setq group (gnus-group-group-name))
3822 (defun gnus-summary-read-group-1 (group show-all no-article
3823 kill-buffer no-display
3824 &optional select-articles)
3825 ;; Killed foreign groups can't be entered.
3826 ;; (when (and (not (gnus-group-native-p group))
3827 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3828 ;; (error "Dead non-native groups can't be entered"))
3829 (gnus-message 5 "Retrieving newsgroup: %s..."
3830 (gnus-group-decoded-name group))
3831 (let* ((new-group (gnus-summary-setup-buffer group))
3832 (quit-config (gnus-group-quit-config group))
3833 (did-select (and new-group (gnus-select-newsgroup
3834 group show-all select-articles))))
3836 ;; This summary buffer exists already, so we just select it.
3838 (gnus-set-global-variables)
3840 (gnus-kill-or-deaden-summary kill-buffer))
3841 (gnus-configure-windows 'summary 'force)
3842 (gnus-set-mode-line 'summary)
3843 (gnus-summary-position-point)
3846 ;; We couldn't select this group.
3848 (when (and (eq major-mode 'gnus-summary-mode)
3849 (not (equal (current-buffer) kill-buffer)))
3850 (kill-buffer (current-buffer))
3851 (if (not quit-config)
3853 ;; Update the info -- marks might need to be removed,
3855 (gnus-summary-update-info)
3856 (set-buffer gnus-group-buffer)
3857 (gnus-group-jump-to-group group)
3858 (gnus-group-next-unread-group 1))
3859 (gnus-handle-ephemeral-exit quit-config)))
3860 (let ((grpinfo (gnus-get-info group)))
3861 (if (null (gnus-info-read grpinfo))
3862 (gnus-message 3 "Group %s contains no messages"
3863 (gnus-group-decoded-name group))
3864 (gnus-message 3 "Can't select group")))
3866 ;; The user did a `C-g' while prompting for number of articles,
3867 ;; so we exit this group.
3868 ((eq did-select 'quit)
3869 (and (eq major-mode 'gnus-summary-mode)
3870 (not (equal (current-buffer) kill-buffer))
3871 (kill-buffer (current-buffer)))
3873 (gnus-kill-or-deaden-summary kill-buffer))
3874 (if (not quit-config)
3876 (set-buffer gnus-group-buffer)
3877 (gnus-group-jump-to-group group)
3878 (gnus-group-next-unread-group 1)
3879 (gnus-configure-windows 'group 'force))
3880 (gnus-handle-ephemeral-exit quit-config))
3881 ;; Finally signal the quit.
3883 ;; The group was successfully selected.
3885 (gnus-set-global-variables)
3886 ;; Save the active value in effect when the group was entered.
3887 (setq gnus-newsgroup-active
3889 (gnus-active gnus-newsgroup-name)))
3890 ;; You can change the summary buffer in some way with this hook.
3891 (gnus-run-hooks 'gnus-select-group-hook)
3892 (when (memq 'summary (gnus-update-format-specifications
3893 nil 'summary 'summary-mode 'summary-dummy))
3894 ;; The format specification for the summary line was updated,
3895 ;; so we need to update the mark positions as well.
3896 (gnus-update-summary-mark-positions))
3897 ;; Do score processing.
3898 (when gnus-use-scoring
3899 (gnus-possibly-score-headers))
3900 ;; Check whether to fill in the gaps in the threads.
3901 (when gnus-build-sparse-threads
3902 (gnus-build-sparse-threads))
3903 ;; Find the initial limit.
3905 (let ((gnus-newsgroup-dormant nil))
3906 (gnus-summary-initial-limit show-all))
3907 (gnus-summary-initial-limit show-all))
3908 ;; Generate the summary buffer.
3910 (gnus-summary-prepare))
3911 (when gnus-use-trees
3912 (gnus-tree-open group)
3913 (setq gnus-summary-highlight-line-function
3914 'gnus-tree-highlight-article))
3915 ;; If the summary buffer is empty, but there are some low-scored
3916 ;; articles or some excluded dormants, we include these in the
3918 (when (and (zerop (buffer-size))
3920 (cond (gnus-newsgroup-dormant
3921 (gnus-summary-limit-include-dormant))
3922 ((and gnus-newsgroup-scored show-all)
3923 (gnus-summary-limit-include-expunged t))))
3924 ;; Function `gnus-apply-kill-file' must be called in this hook.
3925 (gnus-run-hooks 'gnus-apply-kill-hook)
3926 (if (and (zerop (buffer-size))
3929 ;; This newsgroup is empty.
3930 (gnus-summary-catchup-and-exit nil t)
3931 (gnus-message 6 "No unread news")
3933 (gnus-kill-or-deaden-summary kill-buffer))
3934 ;; Return nil from this function.
3936 ;; Hide conversation thread subtrees. We cannot do this in
3937 ;; gnus-summary-prepare-hook since kill processing may not
3938 ;; work with hidden articles.
3939 (gnus-summary-maybe-hide-threads)
3941 (gnus-kill-or-deaden-summary kill-buffer))
3942 (gnus-summary-auto-select-subject)
3943 ;; Show first unread article if requested.
3944 (if (and (not no-article)
3946 gnus-newsgroup-unreads
3947 gnus-auto-select-first)
3949 (gnus-configure-windows 'summary)
3950 (let ((art (gnus-summary-article-number)))
3951 (unless (and (not gnus-plugged)
3952 (or (memq art gnus-newsgroup-undownloaded)
3953 (memq art gnus-newsgroup-downloadable)))
3954 (gnus-summary-goto-article art))))
3955 ;; Don't select any articles.
3956 (gnus-summary-position-point)
3957 (gnus-configure-windows 'summary 'force)
3958 (gnus-set-mode-line 'summary))
3959 (when (and gnus-auto-center-group
3960 (get-buffer-window gnus-group-buffer t))
3961 ;; Gotta use windows, because recenter does weird stuff if
3962 ;; the current buffer ain't the displayed window.
3963 (let ((owin (selected-window)))
3964 (select-window (get-buffer-window gnus-group-buffer t))
3965 (when (gnus-group-goto-group group)
3967 (select-window owin)))
3968 ;; Mark this buffer as "prepared".
3969 (setq gnus-newsgroup-prepared t)
3970 (gnus-run-hooks 'gnus-summary-prepared-hook)
3971 (unless (gnus-ephemeral-group-p group)
3972 (gnus-group-update-group group))
3975 (defun gnus-summary-auto-select-subject ()
3976 "Select the subject line on initial group entry."
3977 (goto-char (point-min))
3979 ((eq gnus-auto-select-subject 'best)
3980 (gnus-summary-best-unread-subject))
3981 ((eq gnus-auto-select-subject 'unread)
3982 (gnus-summary-first-unread-subject))
3983 ((eq gnus-auto-select-subject 'unseen)
3984 (gnus-summary-first-unseen-subject))
3985 ((eq gnus-auto-select-subject 'unseen-or-unread)
3986 (gnus-summary-first-unseen-or-unread-subject))
3987 ((eq gnus-auto-select-subject 'first)
3990 ((functionp gnus-auto-select-subject)
3991 (funcall gnus-auto-select-subject))))
3993 (defun gnus-summary-prepare ()
3994 "Generate the summary buffer."
3996 (let ((inhibit-read-only t))
3998 (setq gnus-newsgroup-data nil
3999 gnus-newsgroup-data-reverse nil)
4000 (gnus-run-hooks 'gnus-summary-generate-hook)
4001 ;; Generate the buffer, either with threads or without.
4002 (when gnus-newsgroup-headers
4003 (gnus-summary-prepare-threads
4004 (if gnus-show-threads
4005 (gnus-sort-gathered-threads
4006 (funcall gnus-summary-thread-gathering-function
4008 (gnus-cut-threads (gnus-make-threads)))))
4009 ;; Unthreaded display.
4010 (gnus-sort-articles gnus-newsgroup-headers))))
4011 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4012 ;; Call hooks for modifying summary buffer.
4013 (goto-char (point-min))
4014 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4016 (defsubst gnus-general-simplify-subject (subject)
4017 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4020 ;; Truncate the subject.
4021 (gnus-simplify-subject-functions
4022 (gnus-map-function gnus-simplify-subject-functions subject))
4023 ((numberp gnus-summary-gather-subject-limit)
4024 (setq subject (gnus-simplify-subject-re subject))
4025 (if (> (length subject) gnus-summary-gather-subject-limit)
4026 (substring subject 0 gnus-summary-gather-subject-limit)
4028 ;; Fuzzily simplify it.
4029 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4030 (gnus-simplify-subject-fuzzy subject))
4031 ;; Just remove the leading "Re:".
4033 (gnus-simplify-subject-re subject))))
4035 (if (and gnus-summary-gather-exclude-subject
4036 (string-match gnus-summary-gather-exclude-subject subject))
4037 nil ; This article shouldn't be gathered
4040 (defun gnus-summary-simplify-subject-query ()
4041 "Query where the respool algorithm would put this article."
4043 (gnus-summary-select-article)
4044 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4046 (defun gnus-gather-threads-by-subject (threads)
4047 "Gather threads by looking at Subject headers."
4048 (if (not gnus-summary-make-false-root)
4050 (let ((hashtb (gnus-make-hashtable 1024))
4053 subject hthread whole-subject)
4055 (setq subject (gnus-general-simplify-subject
4056 (setq whole-subject (mail-header-subject
4059 (if (setq hthread (gnus-gethash subject hashtb))
4061 ;; We enter a dummy root into the thread, if we
4062 ;; haven't done that already.
4063 (unless (stringp (caar hthread))
4064 (setcar hthread (list whole-subject (car hthread))))
4065 ;; We add this new gathered thread to this gathered
4067 (setcdr (car hthread)
4068 (nconc (cdar hthread) (list (car threads))))
4069 ;; Remove it from the list of threads.
4070 (setcdr prev (cdr threads))
4071 (setq threads prev))
4072 ;; Enter this thread into the hash table.
4073 (gnus-sethash subject
4074 (if gnus-summary-make-false-root-always
4076 ;; If you want a dummy root above all
4078 (setcar threads (list whole-subject
4084 (setq threads (cdr threads)))
4087 (defun gnus-gather-threads-by-references (threads)
4088 "Gather threads by looking at References headers."
4089 (let ((idhashtb (gnus-make-hashtable 1024))
4090 (thhashtb (gnus-make-hashtable 1024))
4093 ids references id gthread gid entered ref)
4095 (when (setq references (mail-header-references (caar threads)))
4096 (setq id (mail-header-id (caar threads))
4097 ids (inline (gnus-split-references references))
4099 (while (setq ref (pop ids))
4100 (setq ids (delete ref ids))
4101 (if (not (setq gid (gnus-gethash ref idhashtb)))
4103 (gnus-sethash ref id idhashtb)
4104 (gnus-sethash id threads thhashtb))
4105 (setq gthread (gnus-gethash gid thhashtb))
4107 ;; We enter a dummy root into the thread, if we
4108 ;; haven't done that already.
4109 (unless (stringp (caar gthread))
4110 (setcar gthread (list (mail-header-subject (caar gthread))
4112 ;; We add this new gathered thread to this gathered
4114 (setcdr (car gthread)
4115 (nconc (cdar gthread) (list (car threads)))))
4116 ;; Add it into the thread hash table.
4117 (gnus-sethash id gthread thhashtb)
4119 ;; Remove it from the list of threads.
4120 (setcdr prev (cdr threads))
4121 (setq threads prev))))
4123 (setq threads (cdr threads)))
4126 (defun gnus-sort-gathered-threads (threads)
4127 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4128 (let ((result threads))
4130 (when (stringp (caar threads))
4131 (setcdr (car threads)
4132 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4133 (setq threads (cdr threads)))
4136 (defun gnus-thread-loop-p (root thread)
4137 "Say whether ROOT is in THREAD."
4138 (let ((stack (list thread))
4141 (while (setq thread (pop stack))
4142 (setq th (cdr thread))
4144 (not (eq (caar th) root)))
4147 ;; We have found a loop.
4149 (setcdr thread (delq (car th) (cdr thread)))
4150 (if (boundp (setq ref-dep (intern "none"
4151 gnus-newsgroup-dependencies)))
4152 (setcdr (symbol-value ref-dep)
4153 (nconc (cdr (symbol-value ref-dep))
4155 (set ref-dep (list nil (car th))))
4158 ;; Push all the subthreads onto the stack.
4159 (push (cdr thread) stack)))
4162 (defun gnus-make-threads ()
4163 "Go through the dependency hashtb and find the roots. Return all threads."
4165 (while (catch 'infloop
4168 ;; Deal with self-referencing References loops.
4169 (when (and (car (symbol-value refs))
4176 (car (symbol-value refs)) thread))
4177 (cdr (symbol-value refs)))))))
4180 (unless (car (symbol-value refs))
4181 ;; These threads do not refer back to any other
4182 ;; articles, so they're roots.
4183 (setq threads (append (cdr (symbol-value refs)) threads))))
4184 gnus-newsgroup-dependencies)))
4187 ;; Build the thread tree.
4188 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4189 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4191 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4192 if it was already present.
4194 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4195 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4196 Message-IDs will be renamed to a unique Message-ID before being
4199 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4200 (let* ((id (mail-header-id header))
4201 (id-dep (and id (intern id dependencies)))
4202 parent-id ref ref-dep ref-header replaced)
4203 ;; Enter this `header' in the `dependencies' table.
4207 ;; The first two cases do the normal part: enter a new `header'
4208 ;; in the `dependencies' table.
4209 ((not (boundp id-dep))
4210 (set id-dep (list header)))
4211 ((null (car (symbol-value id-dep)))
4212 (setcar (symbol-value id-dep) header))
4214 ;; From here the `header' was already present in the
4215 ;; `dependencies' table.
4217 ;; Overrides an existing entry;
4218 ;; just set the header part of the entry.
4219 (setcar (symbol-value id-dep) header)
4222 ;; Renames the existing `header' to a unique Message-ID.
4223 ((not gnus-summary-ignore-duplicates)
4224 ;; An article with this Message-ID has already been seen.
4225 ;; We rename the Message-ID.
4226 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4228 (mail-header-set-id header id))
4230 ;; The last case ignores an existing entry, except it adds any
4231 ;; additional Xrefs (in case the two articles came from different
4233 ;; Also sets `header' to `nil' meaning that the `dependencies'
4234 ;; table was *not* modified.
4236 (mail-header-set-xref
4237 (car (symbol-value id-dep))
4238 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4240 (or (mail-header-xref header) "")))
4243 (when (and header (not replaced))
4244 ;; First check that we are not creating a References loop.
4245 (setq parent-id (gnus-parent-id (mail-header-references header)))
4246 (setq ref parent-id)
4248 (setq ref-dep (intern-soft ref dependencies))
4250 (setq ref-header (car (symbol-value ref-dep))))
4251 (if (string= id ref)
4252 ;; Yuk! This is a reference loop. Make the article be a
4255 (mail-header-set-references (car (symbol-value id-dep)) "none")
4257 (setq parent-id nil))
4258 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4259 (setq ref-dep (intern (or parent-id "none") dependencies))
4260 (if (boundp ref-dep)
4261 (setcdr (symbol-value ref-dep)
4262 (nconc (cdr (symbol-value ref-dep))
4263 (list (symbol-value id-dep))))
4264 (set ref-dep (list nil (symbol-value id-dep)))))
4267 (defun gnus-extract-message-id-from-in-reply-to (string)
4268 (if (string-match "<[^>]+>" string)
4269 (substring string (match-beginning 0) (match-end 0))
4272 (defun gnus-build-sparse-threads ()
4273 (let ((headers gnus-newsgroup-headers)
4274 (mail-parse-charset gnus-newsgroup-charset)
4275 (gnus-summary-ignore-duplicates t)
4276 header references generation relations
4277 subject child end new-child date)
4278 ;; First we create an alist of generations/relations, where
4279 ;; generations is how much we trust the relation, and the relation
4281 (gnus-message 7 "Making sparse threads...")
4283 (nnheader-set-temp-buffer " *gnus sparse threads*")
4284 (while (setq header (pop headers))
4285 (when (and (setq references (mail-header-references header))
4286 (not (string= references "")))
4288 (setq child (mail-header-id header)
4289 subject (mail-header-subject header)
4290 date (mail-header-date header)
4292 (while (search-backward ">" nil t)
4293 (setq end (1+ (point)))
4294 (when (search-backward "<" nil t)
4295 (setq new-child (buffer-substring (point) end))
4296 (push (list (incf generation)
4297 child (setq child new-child)
4301 (push (list (1+ generation) child nil subject) relations))
4303 (kill-buffer (current-buffer)))
4304 ;; Sort over trustworthiness.
4305 (dolist (relation (sort relations 'car-less-than-car))
4306 (when (gnus-dependencies-add-header
4307 (make-full-mail-header
4308 gnus-reffed-article-number
4309 (nth 3 relation) "" (or (nth 4 relation) "")
4311 (or (nth 2 relation) "") 0 0 "")
4312 gnus-newsgroup-dependencies nil)
4313 (push gnus-reffed-article-number gnus-newsgroup-limit)
4314 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4315 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4316 gnus-newsgroup-reads)
4317 (decf gnus-reffed-article-number)))
4318 (gnus-message 7 "Making sparse threads...done")))
4320 (defun gnus-build-old-threads ()
4321 ;; Look at all the articles that refer back to old articles, and
4322 ;; fetch the headers for the articles that aren't there. This will
4323 ;; build complete threads - if the roots haven't been expired by the
4325 (let ((mail-parse-charset gnus-newsgroup-charset)
4329 (when (not (car (symbol-value refs)))
4330 (setq heads (cdr (symbol-value refs)))
4332 (if (memq (mail-header-number (caar heads))
4333 gnus-newsgroup-dormant)
4334 (setq heads (cdr heads))
4335 (setq id (symbol-name refs))
4336 (while (and (setq id (gnus-build-get-header id))
4337 (not (car (gnus-id-to-thread id)))))
4338 (setq heads nil)))))
4339 gnus-newsgroup-dependencies)))
4341 (defsubst gnus-remove-odd-characters (string)
4342 "Translate STRING into something that doesn't contain weird characters."
4343 (mm-subst-char-in-string
4345 (mm-subst-char-in-string ?\n ?\- string t) t))
4347 ;; This function has to be called with point after the article number
4348 ;; on the beginning of the line.
4349 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4350 (let ((eol (point-at-eol))
4351 (buffer (current-buffer))
4352 header references in-reply-to)
4354 ;; overview: [num subject from date id refs chars lines misc]
4357 (narrow-to-region (point) eol)
4362 (make-full-mail-header
4364 (condition-case () ; subject
4365 (gnus-remove-odd-characters
4366 (funcall gnus-decode-encoded-word-function
4367 (setq x (nnheader-nov-field))))
4369 (condition-case () ; from
4370 (gnus-remove-odd-characters
4371 (funcall gnus-decode-encoded-address-function
4372 (setq x (nnheader-nov-field))))
4374 (nnheader-nov-field) ; date
4375 (nnheader-nov-read-message-id number) ; id
4376 (setq references (nnheader-nov-field)) ; refs
4377 (nnheader-nov-read-integer) ; chars
4378 (nnheader-nov-read-integer) ; lines
4380 (if (looking-at "Xref: ")
4381 (goto-char (match-end 0)))
4382 (nnheader-nov-field)) ; Xref
4383 (nnheader-nov-parse-extra)))) ; extra
4387 (when (and (string= references "")
4388 (setq in-reply-to (mail-header-extra header))
4389 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4390 (mail-header-set-references
4391 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4393 (when gnus-alter-header-function
4394 (funcall gnus-alter-header-function header))
4395 (gnus-dependencies-add-header header dependencies force-new)))
4397 (defun gnus-build-get-header (id)
4398 "Look through the buffer of NOV lines and find the header to ID.
4399 Enter this line into the dependencies hash table, and return
4400 the id of the parent article (if any)."
4401 (let ((deps gnus-newsgroup-dependencies)
4404 (with-current-buffer nntp-server-buffer
4405 (let ((case-fold-search nil))
4406 (goto-char (point-min))
4407 (while (and (not found)
4408 (search-forward id nil t))
4410 (setq found (looking-at
4411 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4412 (regexp-quote id))))
4413 (or found (beginning-of-line 2)))
4417 (setq header (gnus-nov-parse-line
4418 (read (current-buffer)) deps))
4419 (gnus-parent-id (mail-header-references header))))))
4421 (let ((number (mail-header-number header)))
4422 (push number gnus-newsgroup-limit)
4423 (push header gnus-newsgroup-headers)
4424 (if (memq number gnus-newsgroup-unselected)
4426 (setq gnus-newsgroup-unreads
4427 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4429 (setq gnus-newsgroup-unselected
4430 (delq number gnus-newsgroup-unselected)))
4431 (push number gnus-newsgroup-ancient)))))))
4433 (defun gnus-build-all-threads ()
4434 "Read all the headers."
4435 (let ((gnus-summary-ignore-duplicates t)
4436 (mail-parse-charset gnus-newsgroup-charset)
4437 (dependencies gnus-newsgroup-dependencies)
4439 (with-current-buffer nntp-server-buffer
4440 (let ((case-fold-search nil))
4441 (goto-char (point-min))
4444 (setq article (read (current-buffer))
4445 header (gnus-nov-parse-line article dependencies)))
4447 (with-current-buffer gnus-summary-buffer
4448 (push header gnus-newsgroup-headers)
4449 (if (memq (setq article (mail-header-number header))
4450 gnus-newsgroup-unselected)
4452 (setq gnus-newsgroup-unreads
4453 (gnus-add-to-sorted-list
4454 gnus-newsgroup-unreads article))
4455 (setq gnus-newsgroup-unselected
4456 (delq article gnus-newsgroup-unselected)))
4457 (push article gnus-newsgroup-ancient)))
4458 (forward-line 1)))))))
4460 (defun gnus-summary-update-article-line (article header)
4461 "Update the line for ARTICLE using HEADER."
4462 (let* ((id (mail-header-id header))
4463 (thread (gnus-id-to-thread id)))
4465 (error "Article in no thread"))
4466 ;; Update the thread.
4467 (setcar thread header)
4468 (gnus-summary-goto-subject article)
4469 (let* ((datal (gnus-data-find-list article))
4471 (inhibit-read-only t)
4472 (level (gnus-summary-thread-level)))
4474 (let ((inserted (- (point)
4476 (gnus-summary-insert-line
4478 (memq article gnus-newsgroup-undownloaded)
4479 (gnus-article-mark article)
4480 (memq article gnus-newsgroup-replied)
4481 (memq article gnus-newsgroup-expirable)
4482 ;; Only insert the Subject string when it's different
4483 ;; from the previous Subject string.
4488 (mail-header-subject
4491 (gnus-data-find-list
4493 (gnus-data-list t)))))
4494 ;; Error on the side of excessive subjects.
4496 (mail-header-subject header)))
4498 (mail-header-subject header))
4499 nil (cdr (assq article gnus-newsgroup-scored))
4500 (memq article gnus-newsgroup-processable))
4503 (gnus-data-update-list
4505 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4507 (defun gnus-summary-update-article (article &optional iheader)
4508 "Update ARTICLE in the summary buffer."
4509 (set-buffer gnus-summary-buffer)
4510 (let* ((header (gnus-summary-article-header article))
4511 (id (mail-header-id header))
4512 (data (gnus-data-find article))
4513 (thread (gnus-id-to-thread id))
4514 (references (mail-header-references header))
4518 (when (and references
4519 (not (equal "" references)))
4522 (inhibit-read-only t)
4528 (delq thread parent)))
4529 (if (gnus-summary-insert-subject id header)
4530 ;; Set the (possibly) new article number in the data structure.
4531 (gnus-data-set-number data (gnus-id-to-article id))
4535 (defun gnus-rebuild-thread (id &optional line)
4536 "Rebuild the thread containing ID.
4537 If LINE, insert the rebuilt thread starting on line LINE."
4538 (let ((inhibit-read-only t)
4539 old-pos current thread data)
4540 (if (not gnus-show-threads)
4541 (setq thread (list (car (gnus-id-to-thread id))))
4542 ;; Get the thread this article is part of.
4543 (setq thread (gnus-remove-thread id)))
4544 (setq old-pos (point-at-bol))
4545 (setq current (save-excursion
4546 (and (re-search-backward "[\r\n]" nil t)
4547 (gnus-summary-article-number))))
4548 ;; If this is a gathered thread, we have to go some re-gathering.
4549 (when (stringp (car thread))
4550 (let ((subject (car thread))
4552 (setq thread (cdr thread))
4554 (unless (memq (setq thr (gnus-id-to-thread
4556 (mail-header-id (caar thread)))))
4559 (setq thread (cdr thread)))
4560 ;; We now have all (unique) roots.
4561 (if (= (length roots) 1)
4562 ;; All the loose roots are now one solid root.
4563 (setq thread (car roots))
4564 (setq thread (cons subject (gnus-sort-threads roots))))))
4566 ;; We then insert this thread into the summary buffer.
4568 (goto-char (point-min))
4569 (forward-line (1- line)))
4570 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4571 (if gnus-show-threads
4572 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4573 (gnus-summary-prepare-unthreaded thread))
4574 (setq data (nreverse gnus-newsgroup-data))
4575 (setq threads gnus-newsgroup-threads))
4576 ;; We splice the new data into the data structure.
4577 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4578 ;;!!! then we want to insert at the beginning of the buffer.
4579 ;;!!! That happens to be true with Gnus now, but that may
4580 ;;!!! change in the future. Perhaps.
4581 (gnus-data-enter-list
4582 (if line nil current) data (- (point) old-pos))
4583 (setq gnus-newsgroup-threads
4584 (nconc threads gnus-newsgroup-threads))
4585 (gnus-data-compute-positions))))
4587 (defun gnus-number-to-header (number)
4588 "Return the header for article NUMBER."
4589 (let ((headers gnus-newsgroup-headers))
4591 (not (= number (mail-header-number (car headers)))))
4596 (defun gnus-parent-headers (in-headers &optional generation)
4597 "Return the headers of the GENERATIONeth parent of HEADERS."
4599 (setq generation 1))
4601 (headers in-headers)
4604 (not (zerop generation))
4605 (setq references (mail-header-references headers)))
4606 (setq headers (if (and references
4607 (setq parent (gnus-parent-id references)))
4608 (car (gnus-id-to-thread parent))
4611 (and (not (eq headers in-headers))
4614 (defun gnus-id-to-thread (id)
4615 "Return the (sub-)thread where ID appears."
4616 (gnus-gethash id gnus-newsgroup-dependencies))
4618 (defun gnus-id-to-article (id)
4619 "Return the article number of ID."
4620 (let ((thread (gnus-id-to-thread id)))
4623 (mail-header-number (car thread)))))
4625 (defun gnus-id-to-header (id)
4626 "Return the article headers of ID."
4627 (car (gnus-id-to-thread id)))
4629 (defun gnus-article-displayed-root-p (article)
4630 "Say whether ARTICLE is a root(ish) article."
4631 (let ((level (gnus-summary-thread-level article))
4632 (refs (mail-header-references (gnus-summary-article-header article)))
4638 ((null (gnus-parent-id refs)) t)
4640 (null (setq particle (gnus-id-to-article
4641 (gnus-parent-id refs))))
4642 (null (gnus-summary-thread-level particle)))))))
4644 (defun gnus-root-id (id)
4645 "Return the id of the root of the thread where ID appears."
4647 (while (and id (setq prev (car (gnus-id-to-thread id))))
4649 id (gnus-parent-id (mail-header-references prev))))
4652 (defun gnus-articles-in-thread (thread)
4653 "Return the list of articles in THREAD."
4654 (cons (mail-header-number (car thread))
4655 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4657 (defun gnus-remove-thread (id &optional dont-remove)
4658 "Remove the thread that has ID in it."
4659 (let (headers thread last-id)
4660 ;; First go up in this thread until we find the root.
4661 (setq last-id (gnus-root-id id)
4662 headers (message-flatten-list (gnus-id-to-thread last-id)))
4663 ;; We have now found the real root of this thread. It might have
4664 ;; been gathered into some loose thread, so we have to search
4665 ;; through the threads to find the thread we wanted.
4666 (let ((threads gnus-newsgroup-threads)
4669 (setq sub (car threads))
4670 (if (stringp (car sub))
4671 ;; This is a gathered thread, so we look at the roots
4672 ;; below it to find whether this article is in this
4675 (setq sub (cdr sub))
4677 (when (member (caar sub) headers)
4678 (setq thread (car threads)
4681 (setq sub (cdr sub))))
4682 ;; It's an ordinary thread, so we check it.
4683 (when (eq (car sub) (car headers))
4686 (setq threads (cdr threads)))
4687 ;; If this article is in no thread, then it's a root.
4690 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4691 (setq thread (gnus-id-to-thread last-id)))
4694 thread ; We return this thread.
4696 (if (stringp (car thread))
4698 ;; If we use dummy roots, then we have to remove the
4699 ;; dummy root as well.
4700 (when (eq gnus-summary-make-false-root 'dummy)
4701 ;; We go to the dummy root by going to
4702 ;; the first sub-"thread", and then one line up.
4703 (gnus-summary-goto-article
4704 (mail-header-number (caadr thread)))
4707 (gnus-data-compute-positions))
4708 (setq thread (cdr thread))
4710 (gnus-remove-thread-1 (car thread))
4711 (setq thread (cdr thread))))
4712 (gnus-remove-thread-1 thread))))))))
4714 (defun gnus-remove-thread-1 (thread)
4715 "Remove the thread THREAD recursively."
4716 (let ((number (mail-header-number (pop thread)))
4718 (setq thread (reverse thread))
4720 (gnus-remove-thread-1 (pop thread)))
4721 (when (setq d (gnus-data-find number))
4722 (goto-char (gnus-data-pos d))
4723 (gnus-summary-show-thread)
4729 (gnus-delete-line)))))))
4731 (defun gnus-sort-threads-recursive (threads func)
4732 (sort (mapcar (lambda (thread)
4735 (gnus-sort-threads-recursive (cdr thread) func))))
4738 (defun gnus-sort-threads-loop (threads func)
4739 (let* ((superthread (cons nil threads))
4740 (stack (list (cons superthread threads)))
4741 remaining-threads thread)
4743 (setq remaining-threads (cdr (car stack)))
4744 (if remaining-threads
4745 (progn (setq thread (car remaining-threads))
4746 (setcdr (car stack) (cdr remaining-threads))
4748 (push (cons thread (cdr thread)) stack)))
4749 (setq thread (caar stack))
4750 (setcdr thread (sort (cdr thread) func))
4754 (defun gnus-sort-threads (threads)
4756 (if (not gnus-thread-sort-functions)
4758 (gnus-message 8 "Sorting threads...")
4761 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4762 (gnus-sort-threads-recursive
4763 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4764 ;; Even after binding max-lisp-eval-depth, the recursive
4765 ;; sorter might fail for very long threads. In that case,
4766 ;; try using a (less well-tested) non-recursive sorter.
4767 (error (gnus-sort-threads-loop
4768 threads (gnus-make-sort-function
4769 gnus-thread-sort-functions))))
4770 (gnus-message 8 "Sorting threads...done"))))
4772 (defun gnus-sort-articles (articles)
4774 (when gnus-article-sort-functions
4775 (gnus-message 7 "Sorting articles...")
4777 (setq gnus-newsgroup-headers
4778 (sort articles (gnus-make-sort-function
4779 gnus-article-sort-functions)))
4780 (gnus-message 7 "Sorting articles...done"))))
4782 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4783 (defmacro gnus-thread-header (thread)
4784 "Return header of first article in THREAD.
4785 Note that THREAD must never, ever be anything else than a variable -
4786 using some other form will lead to serious barfage."
4787 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4788 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4789 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4792 (defsubst gnus-article-sort-by-number (h1 h2)
4793 "Sort articles by article number."
4794 (< (mail-header-number h1)
4795 (mail-header-number h2)))
4797 (defun gnus-thread-sort-by-number (h1 h2)
4798 "Sort threads by root article number."
4799 (gnus-article-sort-by-number
4800 (gnus-thread-header h1) (gnus-thread-header h2)))
4802 (defsubst gnus-article-sort-by-random (h1 h2)
4803 "Sort articles randomly."
4806 (defun gnus-thread-sort-by-random (h1 h2)
4807 "Sort threads randomly."
4808 (gnus-article-sort-by-random
4809 (gnus-thread-header h1) (gnus-thread-header h2)))
4811 (defsubst gnus-article-sort-by-lines (h1 h2)
4812 "Sort articles by article Lines header."
4813 (< (mail-header-lines h1)
4814 (mail-header-lines h2)))
4816 (defun gnus-thread-sort-by-lines (h1 h2)
4817 "Sort threads by root article Lines header."
4818 (gnus-article-sort-by-lines
4819 (gnus-thread-header h1) (gnus-thread-header h2)))
4821 (defsubst gnus-article-sort-by-chars (h1 h2)
4822 "Sort articles by octet length."
4823 (< (mail-header-chars h1)
4824 (mail-header-chars h2)))
4826 (defun gnus-thread-sort-by-chars (h1 h2)
4827 "Sort threads by root article octet length."
4828 (gnus-article-sort-by-chars
4829 (gnus-thread-header h1) (gnus-thread-header h2)))
4831 (defsubst gnus-article-sort-by-author (h1 h2)
4832 "Sort articles by root author."
4834 (let ((extract (funcall
4835 gnus-extract-address-components
4836 (mail-header-from h1))))
4837 (or (car extract) (cadr extract) ""))
4838 (let ((extract (funcall
4839 gnus-extract-address-components
4840 (mail-header-from h2))))
4841 (or (car extract) (cadr extract) ""))))
4843 (defun gnus-thread-sort-by-author (h1 h2)
4844 "Sort threads by root author."
4845 (gnus-article-sort-by-author
4846 (gnus-thread-header h1) (gnus-thread-header h2)))
4848 (defsubst gnus-article-sort-by-recipient (h1 h2)
4849 "Sort articles by recipient."
4851 (let ((extract (funcall
4852 gnus-extract-address-components
4853 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4854 (or (car extract) (cadr extract)))
4855 (let ((extract (funcall
4856 gnus-extract-address-components
4857 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4858 (or (car extract) (cadr extract)))))
4860 (defun gnus-thread-sort-by-recipient (h1 h2)
4861 "Sort threads by root recipient."
4862 (gnus-article-sort-by-recipient
4863 (gnus-thread-header h1) (gnus-thread-header h2)))
4865 (defsubst gnus-article-sort-by-subject (h1 h2)
4866 "Sort articles by root subject."
4868 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4869 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4871 (defun gnus-thread-sort-by-subject (h1 h2)
4872 "Sort threads by root subject."
4873 (gnus-article-sort-by-subject
4874 (gnus-thread-header h1) (gnus-thread-header h2)))
4876 (defsubst gnus-article-sort-by-date (h1 h2)
4877 "Sort articles by root article date."
4879 (gnus-date-get-time (mail-header-date h1))
4880 (gnus-date-get-time (mail-header-date h2))))
4882 (defun gnus-thread-sort-by-date (h1 h2)
4883 "Sort threads by root article date."
4884 (gnus-article-sort-by-date
4885 (gnus-thread-header h1) (gnus-thread-header h2)))
4887 (defsubst gnus-article-sort-by-score (h1 h2)
4888 "Sort articles by root article score.
4889 Unscored articles will be counted as having a score of zero."
4890 (> (or (cdr (assq (mail-header-number h1)
4891 gnus-newsgroup-scored))
4892 gnus-summary-default-score 0)
4893 (or (cdr (assq (mail-header-number h2)
4894 gnus-newsgroup-scored))
4895 gnus-summary-default-score 0)))
4897 (defun gnus-thread-sort-by-score (h1 h2)
4898 "Sort threads by root article score."
4899 (gnus-article-sort-by-score
4900 (gnus-thread-header h1) (gnus-thread-header h2)))
4902 (defun gnus-thread-sort-by-total-score (h1 h2)
4903 "Sort threads by the sum of all scores in the thread.
4904 Unscored articles will be counted as having a score of zero."
4905 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4907 (defun gnus-thread-total-score (thread)
4908 ;; This function find the total score of THREAD.
4913 (if (stringp (car thread))
4914 (apply gnus-thread-score-function 0
4915 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4916 (gnus-thread-total-score-1 thread)))
4918 (gnus-thread-total-score-1 (list thread)))))
4920 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4921 "Sort threads such that the thread with the most recently arrived article comes first."
4922 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4924 (defun gnus-thread-highest-number (thread)
4925 "Return the highest article number in THREAD."
4926 (apply 'max (mapcar (lambda (header)
4927 (mail-header-number header))
4928 (message-flatten-list thread))))
4930 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4931 "Sort threads such that the thread with the most recently dated article comes first."
4932 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4934 (defun gnus-thread-latest-date (thread)
4935 "Return the highest article date in THREAD."
4936 (let ((previous-time 0))
4942 (time-to-seconds (mail-header-parse-date
4943 (mail-header-date header)))
4944 (error previous-time))))
4946 (message-flatten-list thread)
4948 (< (mail-header-number h1)
4949 (mail-header-number h2))))))))
4951 (defun gnus-thread-total-score-1 (root)
4952 ;; This function find the total score of the thread below ROOT.
4953 (setq root (car root))
4954 (apply gnus-thread-score-function
4956 (mapcar 'gnus-thread-total-score
4957 (cdr (gnus-id-to-thread (mail-header-id root))))
4958 (when (> (mail-header-number root) 0)
4959 (list (or (cdr (assq (mail-header-number root)
4960 gnus-newsgroup-scored))
4961 gnus-summary-default-score 0))))
4962 (list gnus-summary-default-score)
4965 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4966 (defvar gnus-tmp-prev-subject nil)
4967 (defvar gnus-tmp-false-parent nil)
4968 (defvar gnus-tmp-root-expunged nil)
4969 (defvar gnus-tmp-dummy-line nil)
4971 (defun gnus-extra-header (type &optional header)
4972 "Return the extra header of TYPE."
4973 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4976 (defvar gnus-tmp-thread-tree-header-string "")
4978 (defcustom gnus-sum-thread-tree-root "> "
4979 "With %B spec, used for the root of a thread.
4980 If nil, use subject instead."
4982 :type '(radio (const :format "%v " nil) string)
4983 :group 'gnus-thread)
4985 (defcustom gnus-sum-thread-tree-false-root "> "
4986 "With %B spec, used for a false root of a thread.
4987 If nil, use subject instead."
4989 :type '(radio (const :format "%v " nil) string)
4990 :group 'gnus-thread)
4992 (defcustom gnus-sum-thread-tree-single-indent ""
4993 "With %B spec, used for a thread with just one message.
4994 If nil, use subject instead."
4996 :type '(radio (const :format "%v " nil) string)
4997 :group 'gnus-thread)
4999 (defcustom gnus-sum-thread-tree-vertical "| "
5000 "With %B spec, used for drawing a vertical line."
5003 :group 'gnus-thread)
5005 (defcustom gnus-sum-thread-tree-indent " "
5006 "With %B spec, used for indenting."
5009 :group 'gnus-thread)
5011 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5012 "With %B spec, used for a leaf with brothers."
5015 :group 'gnus-thread)
5017 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5018 "With %B spec, used for a leaf without brothers."
5021 :group 'gnus-thread)
5023 (defcustom gnus-summary-display-while-building nil
5024 "If non-nil, show and update the summary buffer as it's being built.
5025 If the value is t, update the buffer after every line is inserted. If
5026 the value is an integer (N), update the display every N lines."
5029 :type '(choice (const :tag "off" nil)
5031 (const :tag "frequently" t)))
5033 (defun gnus-summary-prepare-threads (threads)
5034 "Prepare summary buffer from THREADS and indentation LEVEL.
5035 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5036 or a straight list of headers."
5037 (gnus-message 7 "Generating summary...")
5039 (setq gnus-newsgroup-threads threads)
5042 (let ((gnus-tmp-level 0)
5043 (default-score (or gnus-summary-default-score 0))
5044 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5045 (building-line-count gnus-summary-display-while-building)
5046 (building-count (integerp gnus-summary-display-while-building))
5047 thread number subject stack state gnus-tmp-gathered beg-match
5048 new-roots gnus-tmp-new-adopts thread-end simp-subject
5049 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5050 gnus-tmp-replied gnus-tmp-subject-or-nil
5051 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5052 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5053 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5056 (setq gnus-tmp-prev-subject nil
5057 gnus-tmp-thread-tree-header-string "")
5059 (if (vectorp (car threads))
5060 ;; If this is a straight (sic) list of headers, then a
5061 ;; threaded summary display isn't required, so we just create
5062 ;; an unthreaded one.
5063 (gnus-summary-prepare-unthreaded threads)
5065 ;; Do the threaded display.
5067 (if gnus-summary-display-while-building
5068 (switch-to-buffer (buffer-name)))
5069 (while (or threads stack gnus-tmp-new-adopts new-roots)
5071 (if (and (= gnus-tmp-level 0)
5074 (not gnus-tmp-false-parent)
5075 (or gnus-tmp-new-adopts new-roots))
5076 (if gnus-tmp-new-adopts
5077 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5078 thread (list (car gnus-tmp-new-adopts))
5079 gnus-tmp-header (caar thread)
5080 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5082 (setq thread (list (car new-roots))
5083 gnus-tmp-header (caar thread)
5084 new-roots (cdr new-roots))))
5087 ;; If there are some threads, we do them before the
5088 ;; threads on the stack.
5089 (setq thread threads
5090 gnus-tmp-header (caar thread))
5091 ;; There were no current threads, so we pop something off
5093 (setq state (car stack)
5094 gnus-tmp-level (car state)
5095 tree-stack (cadr state)
5096 thread (caddr state)
5098 gnus-tmp-header (caar thread))))
5100 (setq gnus-tmp-false-parent nil)
5101 (setq gnus-tmp-root-expunged nil)
5102 (setq thread-end nil)
5104 (if (stringp gnus-tmp-header)
5105 ;; The header is a dummy root.
5107 ((eq gnus-summary-make-false-root 'adopt)
5108 ;; We let the first article adopt the rest.
5109 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5111 (setq gnus-tmp-gathered
5113 (lambda (h) (mail-header-number (car h)))
5116 (setq thread (cons (list (caar thread)
5119 (setq gnus-tmp-level -1
5120 gnus-tmp-false-parent t))
5121 ((eq gnus-summary-make-false-root 'empty)
5122 ;; We print adopted articles with empty subject fields.
5123 (setq gnus-tmp-gathered
5125 (lambda (h) (mail-header-number (car h)))
5128 (setq gnus-tmp-level -1))
5129 ((eq gnus-summary-make-false-root 'dummy)
5130 ;; We remember that we probably want to output a dummy
5132 (setq gnus-tmp-dummy-line gnus-tmp-header)
5133 (setq gnus-tmp-prev-subject gnus-tmp-header))
5135 ;; We do not make a root for the gathered
5136 ;; sub-threads at all.
5137 (setq gnus-tmp-level -1)))
5139 (setq number (mail-header-number gnus-tmp-header)
5140 subject (mail-header-subject gnus-tmp-header)
5141 simp-subject (gnus-simplify-subject-fully subject))
5144 ;; If the thread has changed subject, we might want to make
5145 ;; this subthread into a root.
5146 ((and (null gnus-thread-ignore-subject)
5147 (not (zerop gnus-tmp-level))
5148 gnus-tmp-prev-subject
5149 (not (string= gnus-tmp-prev-subject simp-subject)))
5150 (setq new-roots (nconc new-roots (list (car thread)))
5152 gnus-tmp-header nil))
5153 ;; If the article lies outside the current limit,
5154 ;; then we do not display it.
5155 ((not (memq number gnus-newsgroup-limit))
5156 (setq gnus-tmp-gathered
5158 (lambda (h) (mail-header-number (car h)))
5161 (setq gnus-tmp-new-adopts (if (cdar thread)
5162 (append gnus-tmp-new-adopts
5164 gnus-tmp-new-adopts)
5166 gnus-tmp-header nil)
5167 (when (zerop gnus-tmp-level)
5168 (setq gnus-tmp-root-expunged t)))
5169 ;; Perhaps this article is to be marked as read?
5170 ((and gnus-summary-mark-below
5171 (< (or (cdr (assq number gnus-newsgroup-scored))
5173 gnus-summary-mark-below)
5174 ;; Don't touch sparse articles.
5175 (not (gnus-summary-article-sparse-p number))
5176 (not (gnus-summary-article-ancient-p number)))
5177 (setq gnus-newsgroup-unreads
5178 (delq number gnus-newsgroup-unreads))
5179 (if gnus-newsgroup-auto-expire
5180 (setq gnus-newsgroup-expirable
5181 (gnus-add-to-sorted-list
5182 gnus-newsgroup-expirable number))
5183 (push (cons number gnus-low-score-mark)
5184 gnus-newsgroup-reads))))
5186 (when gnus-tmp-header
5187 ;; We may have an old dummy line to output before this
5189 (when (and gnus-tmp-dummy-line
5192 (mail-header-subject gnus-tmp-header)))
5193 (gnus-summary-insert-dummy-line
5194 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5195 (setq gnus-tmp-dummy-line nil))
5197 ;; Compute the mark.
5198 (setq gnus-tmp-unread (gnus-article-mark number))
5200 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5201 gnus-tmp-header gnus-tmp-level)
5202 gnus-newsgroup-data)
5204 ;; Actually insert the line.
5206 gnus-tmp-subject-or-nil
5208 ((and gnus-thread-ignore-subject
5209 gnus-tmp-prev-subject
5210 (not (string= gnus-tmp-prev-subject simp-subject)))
5212 ((zerop gnus-tmp-level)
5213 (if (and (eq gnus-summary-make-false-root 'empty)
5214 (memq number gnus-tmp-gathered)
5215 gnus-tmp-prev-subject
5216 (string= gnus-tmp-prev-subject simp-subject))
5217 gnus-summary-same-subject
5219 (t gnus-summary-same-subject)))
5220 (if (and (eq gnus-summary-make-false-root 'adopt)
5221 (= gnus-tmp-level 1)
5222 (memq number gnus-tmp-gathered))
5223 (setq gnus-tmp-opening-bracket ?\<
5224 gnus-tmp-closing-bracket ?\>)
5225 (setq gnus-tmp-opening-bracket ?\[
5226 gnus-tmp-closing-bracket ?\]))
5227 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5228 (gnus-make-thread-indent-array
5229 (max (* 2 (length gnus-thread-indent-array))
5232 gnus-tmp-indentation
5233 (aref gnus-thread-indent-array gnus-tmp-level)
5234 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5235 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5236 gnus-summary-default-score 0)
5238 (if (or (null gnus-summary-default-score)
5239 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5240 gnus-summary-zcore-fuzz))
5242 (if (< gnus-tmp-score gnus-summary-default-score)
5243 gnus-score-below-mark gnus-score-over-mark))
5245 (cond ((memq number gnus-newsgroup-processable)
5247 ((memq number gnus-newsgroup-cached)
5249 ((memq number gnus-newsgroup-replied)
5251 ((memq number gnus-newsgroup-forwarded)
5252 gnus-forwarded-mark)
5253 ((memq number gnus-newsgroup-saved)
5255 ((memq number gnus-newsgroup-recent)
5257 ((memq number gnus-newsgroup-unseen)
5261 (cond ((memq number gnus-newsgroup-undownloaded)
5262 gnus-undownloaded-mark)
5263 (gnus-newsgroup-agentized
5264 gnus-downloaded-mark)
5267 gnus-tmp-from (mail-header-from gnus-tmp-header)
5270 ((string-match "<[^>]+> *$" gnus-tmp-from)
5271 (setq beg-match (match-beginning 0))
5272 (or (and (string-match "^\".+\"" gnus-tmp-from)
5273 (substring gnus-tmp-from 1 (1- (match-end 0))))
5274 (substring gnus-tmp-from 0 beg-match)))
5275 ((string-match "(.+)" gnus-tmp-from)
5276 (substring gnus-tmp-from
5277 (1+ (match-beginning 0)) (1- (match-end 0))))
5281 gnus-tmp-thread-tree-header-string
5283 ((not gnus-show-threads) "")
5284 ((zerop gnus-tmp-level)
5285 (cond ((cdar thread)
5286 (or gnus-sum-thread-tree-root subject))
5287 (gnus-tmp-new-adopts
5288 (or gnus-sum-thread-tree-false-root subject))
5290 (or gnus-sum-thread-tree-single-indent subject))))
5292 (concat (apply 'concat
5293 (mapcar (lambda (item)
5295 gnus-sum-thread-tree-vertical
5296 gnus-sum-thread-tree-indent))
5297 (cdr (reverse tree-stack))))
5299 gnus-sum-thread-tree-leaf-with-other
5300 gnus-sum-thread-tree-single-leaf)))))
5301 (when (string= gnus-tmp-name "")
5302 (setq gnus-tmp-name gnus-tmp-from))
5303 (unless (numberp gnus-tmp-lines)
5304 (setq gnus-tmp-lines -1))
5305 (if (= gnus-tmp-lines -1)
5306 (setq gnus-tmp-lines "?")
5307 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5308 (gnus-put-text-property
5310 (progn (eval gnus-summary-line-format-spec) (point))
5311 'gnus-number number)
5314 (gnus-run-hooks 'gnus-summary-update-hook)
5317 (setq gnus-tmp-prev-subject simp-subject)))
5319 (when (nth 1 thread)
5320 (push (list (max 0 gnus-tmp-level)
5321 (copy-sequence tree-stack)
5324 (push (if (nth 1 thread) 1 0) tree-stack)
5325 (incf gnus-tmp-level)
5326 (setq threads (if thread-end nil (cdar thread)))
5327 (if gnus-summary-display-while-building
5330 ;; use a set frequency
5331 (setq building-line-count (1- building-line-count))
5332 (when (= building-line-count 0)
5334 (setq building-line-count
5335 gnus-summary-display-while-building)))
5339 (setq gnus-tmp-level 0)))))
5340 (gnus-message 7 "Generating summary...done"))
5342 (defun gnus-summary-prepare-unthreaded (headers)
5343 "Generate an unthreaded summary buffer based on HEADERS."
5344 (let (header number mark)
5349 ;; We may have to root out some bad articles...
5350 (when (memq (setq number (mail-header-number
5351 (setq header (pop headers))))
5352 gnus-newsgroup-limit)
5353 ;; Mark article as read when it has a low score.
5354 (when (and gnus-summary-mark-below
5355 (< (or (cdr (assq number gnus-newsgroup-scored))
5356 gnus-summary-default-score 0)
5357 gnus-summary-mark-below)
5358 (not (gnus-summary-article-ancient-p number)))
5359 (setq gnus-newsgroup-unreads
5360 (delq number gnus-newsgroup-unreads))
5361 (if gnus-newsgroup-auto-expire
5362 (push number gnus-newsgroup-expirable)
5363 (push (cons number gnus-low-score-mark)
5364 gnus-newsgroup-reads)))
5366 (setq mark (gnus-article-mark number))
5367 (push (gnus-data-make number mark (1+ (point)) header 0)
5368 gnus-newsgroup-data)
5369 (gnus-summary-insert-line
5371 (memq number gnus-newsgroup-undownloaded)
5372 mark (memq number gnus-newsgroup-replied)
5373 (memq number gnus-newsgroup-expirable)
5374 (mail-header-subject header) nil
5375 (cdr (assq number gnus-newsgroup-scored))
5376 (memq number gnus-newsgroup-processable))))))
5378 (defun gnus-summary-remove-list-identifiers ()
5379 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5380 (let ((regexp (if (consp gnus-list-identifiers)
5381 (mapconcat 'identity gnus-list-identifiers " *\\|")
5382 gnus-list-identifiers))
5385 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5386 (dolist (header gnus-newsgroup-headers)
5387 (setq subject (mail-header-subject header)
5389 (while (string-match regexp subject)
5391 (concat (substring subject 0 (match-beginning 1))
5392 (substring subject (match-end 0)))
5395 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5397 (concat (substring subject 0 (match-beginning 1))
5398 (substring subject (match-end 1)))))
5399 (mail-header-set-subject header subject))))))
5401 (defun gnus-fetch-headers (articles)
5402 "Fetch headers of ARTICLES."
5403 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5404 (gnus-message 5 "Fetching headers for %s..." name)
5407 (setq gnus-headers-retrieved-by
5408 (gnus-retrieve-headers
5409 articles gnus-newsgroup-name
5410 ;; We might want to fetch old headers, but
5411 ;; not if there is only 1 article.
5413 (not (eq gnus-fetch-old-headers 'some))
5414 (not (numberp gnus-fetch-old-headers)))
5415 (> (length articles) 1))
5416 gnus-fetch-old-headers))))
5417 (gnus-get-newsgroup-headers-xover
5418 articles nil nil gnus-newsgroup-name t)
5419 (gnus-get-newsgroup-headers))
5420 (gnus-message 5 "Fetching headers for %s...done" name))))
5422 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5423 "Select newsgroup GROUP.
5424 If READ-ALL is non-nil, all articles in the group are selected.
5425 If SELECT-ARTICLES, only select those articles from GROUP."
5426 (let* ((entry (gnus-group-entry group))
5427 ;;!!! Dirty hack; should be removed.
5428 (gnus-summary-ignore-duplicates
5429 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5431 gnus-summary-ignore-duplicates))
5432 (info (nth 2 entry))
5433 charset articles fetched-articles cached)
5435 (unless (gnus-check-server
5436 (set (make-local-variable 'gnus-current-select-method)
5437 (gnus-find-method-for-group group)))
5438 (error "Couldn't open server"))
5439 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5441 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5442 (gnus-activate-group group) ; Or we can activate it...
5443 (progn ; Or we bug out.
5444 (when (equal major-mode 'gnus-summary-mode)
5445 (gnus-kill-buffer (current-buffer)))
5447 "Couldn't activate group %s: %s"
5448 (mm-decode-coding-string group charset)
5449 (mm-decode-coding-string (gnus-status-message group) charset))))
5451 (unless (gnus-request-group group t)
5452 (when (equal major-mode 'gnus-summary-mode)
5453 (gnus-kill-buffer (current-buffer)))
5454 (error "Couldn't request group %s: %s"
5455 (mm-decode-coding-string group charset)
5456 (mm-decode-coding-string (gnus-status-message group) charset)))
5459 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5461 (setq gnus-summary-use-undownloaded-faces
5462 (gnus-agent-find-parameter
5464 'agent-enable-undownloaded-faces)))
5466 (setq gnus-newsgroup-name group
5467 gnus-newsgroup-unselected nil
5468 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5470 (let ((display (gnus-group-find-parameter group 'display)))
5471 (setq gnus-newsgroup-display
5473 ((not (zerop (or (car-safe read-all) 0)))
5474 ;; The user entered the group with C-u SPC/RET, let's show
5480 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5482 ;; The following is probably the "correct" solution, but
5483 ;; it makes Gnus fetch all headers and then limit the
5484 ;; articles (which is slow), so instead we hack the
5485 ;; select-articles parameter instead. -- Simon Josefsson
5488 ;; (gnus-byte-compile
5489 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5491 (setq select-articles
5492 (gnus-uncompress-range
5493 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5497 (cdr (gnus-active group)))))
5502 (gnus-summary-setup-default-charset)
5504 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5505 (when (gnus-virtual-group-p group)
5506 (setq cached gnus-newsgroup-cached))
5508 (setq gnus-newsgroup-unreads
5509 (gnus-sorted-ndifference
5510 (gnus-sorted-ndifference gnus-newsgroup-unreads
5511 gnus-newsgroup-marked)
5512 gnus-newsgroup-dormant))
5514 (setq gnus-newsgroup-processable nil)
5516 (gnus-update-read-articles group gnus-newsgroup-unreads)
5518 ;; Adjust and set lists of article marks.
5520 (gnus-adjust-marked-articles info))
5521 (if (setq articles select-articles)
5522 (setq gnus-newsgroup-unselected
5523 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5524 (setq articles (gnus-articles-to-read group read-all)))
5528 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5530 ((eq articles 0) nil)
5532 ;; Init the dependencies hash table.
5533 (setq gnus-newsgroup-dependencies
5534 (gnus-make-hashtable (length articles)))
5535 (gnus-set-global-variables)
5536 ;; Retrieve the headers and read them in.
5538 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5540 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5542 (setq gnus-newsgroup-cached cached))
5544 ;; Suppress duplicates?
5545 (when gnus-suppress-duplicates
5546 (gnus-dup-suppress-articles))
5548 ;; Set the initial limit.
5549 (setq gnus-newsgroup-limit (copy-sequence articles))
5550 ;; Remove canceled articles from the list of unread articles.
5551 (setq fetched-articles
5552 (mapcar (lambda (headers) (mail-header-number headers))
5553 gnus-newsgroup-headers))
5554 (setq gnus-newsgroup-articles fetched-articles)
5555 (setq gnus-newsgroup-unreads
5556 (gnus-sorted-nintersection
5557 gnus-newsgroup-unreads fetched-articles))
5558 (gnus-compute-unseen-list)
5560 ;; Removed marked articles that do not exist.
5561 (gnus-update-missing-marks
5562 (gnus-sorted-difference articles fetched-articles))
5563 ;; We might want to build some more threads first.
5564 (when (and gnus-fetch-old-headers
5565 (eq gnus-headers-retrieved-by 'nov))
5566 (if (eq gnus-fetch-old-headers 'invisible)
5567 (gnus-build-all-threads)
5568 (gnus-build-old-threads)))
5569 ;; Let the Gnus agent mark articles as read.
5571 (gnus-agent-get-undownloaded-list))
5572 ;; Remove list identifiers from subject
5573 (when gnus-list-identifiers
5574 (gnus-summary-remove-list-identifiers))
5575 ;; Check whether auto-expire is to be done in this group.
5576 (setq gnus-newsgroup-auto-expire
5577 (gnus-group-auto-expirable-p group))
5578 ;; Set up the article buffer now, if necessary.
5579 (unless (and gnus-single-article-buffer
5580 (equal gnus-article-buffer "*Article*"))
5581 (gnus-article-setup-buffer))
5582 ;; First and last article in this newsgroup.
5583 (when gnus-newsgroup-headers
5584 (setq gnus-newsgroup-begin
5585 (mail-header-number (car gnus-newsgroup-headers))
5588 (gnus-last-element gnus-newsgroup-headers))))
5589 ;; GROUP is successfully selected.
5590 (or gnus-newsgroup-headers t)))))
5592 (defun gnus-compute-unseen-list ()
5593 ;; The `seen' marks are treated specially.
5594 (if (not gnus-newsgroup-seen)
5595 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5596 (setq gnus-newsgroup-unseen
5597 (gnus-inverse-list-range-intersection
5598 gnus-newsgroup-articles gnus-newsgroup-seen))))
5600 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5602 (defun gnus-summary-display-make-predicate (display)
5603 (require 'gnus-agent)
5604 (when (= (length display) 1)
5605 (setq display (car display)))
5606 (unless gnus-summary-display-cache
5607 (dolist (elem (append '((unread . unread)
5610 gnus-article-mark-lists))
5611 (push (cons (cdr elem)
5613 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5614 gnus-summary-display-cache)))
5615 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5616 (gnus-category-predicate-cache gnus-summary-display-cache))
5617 (gnus-get-predicate display)))
5619 ;; Uses the dynamically bound `number' variable.
5621 (defun gnus-article-marked-p (type &optional article)
5622 (let ((article (or article number)))
5625 (memq article gnus-newsgroup-marked))
5627 (memq article gnus-newsgroup-spam-marked))
5629 (memq article gnus-newsgroup-unsendable))
5630 ((eq type 'undownload)
5631 (memq article gnus-newsgroup-undownloaded))
5632 ((eq type 'download)
5633 (memq article gnus-newsgroup-downloadable))
5635 (memq article gnus-newsgroup-unreads))
5637 (memq article gnus-newsgroup-reads))
5639 (memq article gnus-newsgroup-dormant) )
5641 (memq article gnus-newsgroup-expirable))
5643 (memq article gnus-newsgroup-replied))
5645 (memq article gnus-newsgroup-killed))
5646 ((eq type 'bookmark)
5647 (assq article gnus-newsgroup-bookmarks))
5649 (assq article gnus-newsgroup-scored))
5651 (memq article gnus-newsgroup-saved))
5653 (memq article gnus-newsgroup-cached))
5655 (memq article gnus-newsgroup-forwarded))
5657 (not (memq article gnus-newsgroup-unseen)))
5659 (memq article gnus-newsgroup-recent))
5662 (defun gnus-articles-to-read (group &optional read-all)
5663 "Find out what articles the user wants to read."
5665 ;; Select all articles if `read-all' is non-nil, or if there
5666 ;; are no unread articles.
5668 (and (zerop (length gnus-newsgroup-marked))
5669 (zerop (length gnus-newsgroup-unreads)))
5670 ;; Fetch all if the predicate is non-nil.
5671 gnus-newsgroup-display)
5672 ;; We want to select the headers for all the articles in
5673 ;; the group, so we select either all the active
5674 ;; articles in the group, or (if that's nil), the
5675 ;; articles in the cache.
5677 (if gnus-newsgroup-maximum-articles
5678 (let ((active (gnus-active group)))
5679 (gnus-uncompress-range
5680 (cons (max (car active)
5682 gnus-newsgroup-maximum-articles
5685 (gnus-uncompress-range (gnus-active group)))
5686 (gnus-cache-articles-in-group group))
5687 ;; Select only the "normal" subset of articles.
5689 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5690 gnus-newsgroup-unreads)))
5691 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5692 (scored (length scored-list))
5693 (number (length articles))
5694 (marked (+ (length gnus-newsgroup-marked)
5695 (length gnus-newsgroup-dormant)))
5700 ((numberp gnus-newsgroup-display)
5701 gnus-newsgroup-display)
5705 ((and (or (<= scored marked) (= scored number))
5706 (numberp gnus-large-newsgroup)
5707 (> number gnus-large-newsgroup))
5708 (let* ((cursor-in-echo-area nil)
5709 (initial (gnus-parameter-large-newsgroup-initial
5710 gnus-newsgroup-name))
5714 "How many articles from %s (%s %d): "
5715 (gnus-group-decoded-name gnus-newsgroup-name)
5716 (if initial "max" "default")
5719 (cons (number-to-string initial)
5721 (if (string-match "^[ \t]*$" input) number input)))
5722 ((and (> scored marked) (< scored number)
5723 (> (- scored number) 20))
5726 (format "%s %s (%d scored, %d total): "
5727 "How many articles from"
5728 (gnus-group-decoded-name group)
5730 (if (string-match "^[ \t]*$" input)
5734 (message "Quit getting the articles to read")
5736 (setq select (if (stringp select) (string-to-number select) select))
5737 (if (or (null select) (zerop select))
5739 (if (and (not (zerop scored)) (<= (abs select) scored))
5741 (setq articles (sort scored-list '<))
5742 (setq number (length articles)))
5743 (setq articles (copy-sequence articles)))
5745 (when (< (abs select) number)
5747 ;; Select the N oldest articles.
5748 (setcdr (nthcdr (1- (abs select)) articles) nil)
5749 ;; Select the N most recent articles.
5750 (setq articles (nthcdr (- number select) articles))))
5751 (setq gnus-newsgroup-unselected
5752 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5753 (when gnus-alter-articles-to-read-function
5756 (funcall gnus-alter-articles-to-read-function
5757 gnus-newsgroup-name articles)
5761 (defun gnus-killed-articles (killed articles)
5764 (when (inline (gnus-member-of-range (car articles) killed))
5765 (push (car articles) out))
5766 (setq articles (cdr articles)))
5769 (defun gnus-uncompress-marks (marks)
5770 "Uncompress the mark ranges in MARKS."
5771 (let ((uncompressed '(score bookmark))
5774 (if (memq (caar marks) uncompressed)
5775 (push (car marks) out)
5776 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5777 (setq marks (cdr marks)))
5780 (defun gnus-article-mark-to-type (mark)
5781 "Return the type of MARK."
5782 (or (cadr (assq mark gnus-article-special-mark-lists))
5785 (defun gnus-article-unpropagatable-p (mark)
5786 "Return whether MARK should be propagated to back end."
5787 (memq mark gnus-article-unpropagated-mark-lists))
5789 (defun gnus-adjust-marked-articles (info)
5790 "Set all article lists and remove all marks that are no longer valid."
5791 (let* ((marked-lists (gnus-info-marks info))
5792 (active (gnus-active (gnus-info-group info)))
5795 (types gnus-article-mark-lists)
5796 marks var articles article mark mark-type
5799 (dolist (marks marked-lists)
5800 (setq mark (car marks)
5801 mark-type (gnus-article-mark-to-type mark)
5802 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5804 ;; We set the variable according to the type of the marks list,
5805 ;; and then adjust the marks to a subset of the active articles.
5807 ;; Adjust "simple" lists - compressed yet unsorted
5808 ((eq mark-type 'list)
5809 ;; Simultaneously uncompress and clip to active range
5810 ;; See gnus-uncompress-range for a description of possible marks
5812 (if (not (cadr marks))
5814 (setq articles (if (numberp (cddr marks))
5820 (while (setq article (pop articles))
5821 (cond ((consp article)
5822 (setq bgn (max (car article) min)
5823 end (min (cdr article) max))
5825 (setq l (setcdr l (cons bgn nil))
5827 ((and (<= min article)
5829 (setq l (setcdr l (cons article nil))))))
5830 (set var (cdr lh)))))
5832 ((eq mark-type 'tuple)
5833 (set var (setq articles (cdr marks)))
5834 (when (not (listp (cdr (symbol-value var))))
5835 (set var (list (symbol-value var))))
5836 (when (not (listp (cdr articles)))
5837 (setq articles (list articles)))
5839 (when (or (not (consp (setq article (pop articles))))
5840 (< (car article) min)
5841 (> (car article) max))
5842 (set var (delq article (symbol-value var))))))
5843 ;; Adjust ranges (sloppily).
5844 ((eq mark-type 'range)
5847 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5848 ;; It should be (seen (NUM1 . NUM2)).
5849 (when (numberp (cddr marks))
5850 (setcdr marks (list (cdr marks))))
5851 (setq articles (cdr marks))
5852 (while (and articles
5853 (or (and (consp (car articles))
5854 (> min (cdar articles)))
5855 (and (numberp (car articles))
5856 (> min (car articles)))))
5858 (set var articles))))))))
5860 (defun gnus-update-missing-marks (missing)
5861 "Go through the list of MISSING articles and remove them from the mark lists."
5864 ;; Go through all types.
5865 (dolist (elem gnus-article-mark-lists)
5866 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5867 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5868 (when (symbol-value var)
5869 ;; This list has articles. So we delete all missing
5870 ;; articles from it.
5873 (set var (delq (pop m) (symbol-value var))))))))))
5875 (defun gnus-update-marks ()
5876 "Enter the various lists of marked articles into the newsgroup info list."
5877 (let ((types gnus-article-mark-lists)
5878 (info (gnus-get-info gnus-newsgroup-name))
5879 type list newmarked symbol delta-marks)
5881 ;; Add all marks lists to the list of marks lists.
5882 (while (setq type (pop types))
5883 (setq list (symbol-value
5885 (intern (format "gnus-newsgroup-%s" (car type))))))
5888 ;; Get rid of the entries of the articles that have the
5890 (when (and (eq (cdr type) 'score)
5894 (prev (cons nil list))
5897 (if (or (not (consp (car arts)))
5898 (= (cdar arts) gnus-summary-default-score))
5899 (setcdr prev (cdr arts))
5901 (setq arts (cdr arts)))
5902 (setq list (cdr all)))))
5904 (when (eq (cdr type) 'seen)
5905 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5907 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5908 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5910 (when (and (gnus-check-backend-function
5911 'request-set-mark gnus-newsgroup-name)
5912 (not (gnus-article-unpropagatable-p (cdr type))))
5913 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5914 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5915 (add (gnus-remove-from-range
5916 (gnus-copy-sequence list) old)))
5918 (push (list add 'add (list (cdr type))) delta-marks))
5920 (push (list del 'del (list (cdr type))) delta-marks))))
5923 (push (cons (cdr type) list) newmarked)))
5926 (unless (gnus-check-group gnus-newsgroup-name)
5927 (error "Can't open server for %s" gnus-newsgroup-name))
5928 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5930 ;; Enter these new marks into the info of the group.
5932 (setcar (nthcdr 3 info) newmarked)
5933 ;; Add the marks lists to the end of the info.
5935 (setcdr (nthcdr 2 info) (list newmarked))))
5937 ;; Cut off the end of the info if there's nothing else there.
5941 (when (nthcdr (decf i) info)
5942 (setcdr (nthcdr i info) nil)))))))
5944 (defun gnus-set-mode-line (where)
5945 "Set the mode line of the article or summary buffers.
5946 If WHERE is `summary', the summary mode line format will be used."
5947 ;; Is this mode line one we keep updated?
5948 (when (and (memq where gnus-updated-mode-lines)
5950 (intern (format "gnus-%s-mode-line-format-spec" where))))
5952 ;; We evaluate this in the summary buffer since these
5953 ;; variables are buffer-local to that buffer.
5954 (with-current-buffer gnus-summary-buffer
5955 ;; We bind all these variables that are used in the `eval' form
5957 (let* ((mformat (symbol-value
5959 (format "gnus-%s-mode-line-format-spec" where))))
5960 (gnus-tmp-group-name (gnus-mode-string-quote
5961 (gnus-group-decoded-name
5962 gnus-newsgroup-name)))
5963 (gnus-tmp-article-number (or gnus-current-article 0))
5964 (gnus-tmp-unread gnus-newsgroup-unreads)
5965 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5966 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5967 (gnus-tmp-unread-and-unselected
5968 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5969 (zerop gnus-tmp-unselected))
5971 ((zerop gnus-tmp-unselected)
5972 (format "{%d more}" gnus-tmp-unread-and-unticked))
5973 (t (format "{%d(+%d) more}"
5974 gnus-tmp-unread-and-unticked
5975 gnus-tmp-unselected))))
5977 (if (and gnus-current-headers
5978 (vectorp gnus-current-headers))
5979 (gnus-mode-string-quote
5980 (mail-header-subject gnus-current-headers))
5982 bufname-length max-len
5983 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5984 (setq mode-string (eval mformat))
5985 (setq bufname-length (if (string-match "%b" mode-string)
5988 (if (eq where 'summary)
5990 (get-buffer gnus-article-buffer))))
5993 (setq max-len (max 4 (if gnus-mode-non-string-length
5995 gnus-mode-non-string-length
5997 (length mode-string))))
5998 ;; We might have to chop a bit of the string off...
5999 (when (> (length mode-string) max-len)
6001 (concat (truncate-string-to-width mode-string (- max-len 3))
6003 ;; Pad the mode string a bit.
6004 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
6005 ;; Update the mode line.
6006 (setq mode-line-buffer-identification
6007 (gnus-mode-line-buffer-identification (list mode-string)))
6008 (set-buffer-modified-p t))))
6010 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6011 "Go through the HEADERS list and add all Xrefs to a hash table.
6012 The resulting hash table is returned, or nil if no Xrefs were found."
6013 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6014 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6015 (xref-hashtb (gnus-make-hashtable))
6016 start group entry number xrefs header)
6018 (setq header (pop headers))
6019 (when (and (setq xrefs (mail-header-xref header))
6020 (not (memq (setq number (mail-header-number header))
6023 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6024 (setq start (match-end 0))
6025 (setq group (if prefix
6026 (concat prefix (substring xrefs (match-beginning 1)
6028 (substring xrefs (match-beginning 1) (match-end 1))))
6030 (string-to-number (substring xrefs (match-beginning 2)
6032 (if (setq entry (gnus-gethash group xref-hashtb))
6033 (setcdr entry (cons number (cdr entry)))
6034 (gnus-sethash group (cons number nil) xref-hashtb)))))
6035 (and start xref-hashtb)))
6037 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6038 "Look through all the headers and mark the Xrefs as read."
6039 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6040 name info xref-hashtb idlist method nth4)
6042 (set-buffer gnus-group-buffer)
6043 (when (setq xref-hashtb
6044 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6047 (unless (string= from-newsgroup (setq name (symbol-name group)))
6048 (setq idlist (symbol-value group))
6049 ;; Dead groups are not updated.
6051 (setq info (gnus-get-info name))
6052 (when (stringp (setq nth4 (gnus-info-method info)))
6053 (setq nth4 (gnus-server-to-method nth4))))
6054 ;; Only do the xrefs if the group has the same
6055 ;; select method as the group we have just read.
6056 (or (gnus-methods-equal-p
6057 nth4 (gnus-find-method-for-group from-newsgroup))
6059 (equal nth4 (setq method (gnus-find-method-for-group
6061 (and (equal (car nth4) (car method))
6062 (equal (nth 1 nth4) (nth 1 method))))
6063 gnus-use-cross-reference
6064 (or (not (eq gnus-use-cross-reference t))
6066 ;; Only do cross-references on subscribed
6067 ;; groups, if that is what is wanted.
6068 (<= (gnus-info-level info) gnus-level-subscribed))
6069 (gnus-group-make-articles-read name idlist))))
6072 (defun gnus-compute-read-articles (group articles)
6073 (let* ((entry (gnus-group-entry group))
6074 (info (nth 2 entry))
6075 (active (gnus-active group))
6078 ;; First peel off all invalid article numbers.
6080 (let ((ids articles)
6082 (while (setq id (pop ids))
6083 (when (and first (> id (cdr active)))
6084 ;; We'll end up in this situation in one particular
6085 ;; obscure situation. If you re-scan a group and get
6086 ;; a new article that is cross-posted to a different
6087 ;; group that has not been re-scanned, you might get
6088 ;; crossposted article that has a higher number than
6089 ;; Gnus believes possible. So we re-activate this
6090 ;; group as well. This might mean doing the
6091 ;; crossposting thingy will *increase* the number
6092 ;; of articles in some groups. Tsk, tsk.
6093 (setq active (or (gnus-activate-group group) active)))
6094 (when (or (> id (cdr active))
6095 (< id (car active)))
6096 (setq articles (delq id articles))))))
6097 ;; If the read list is nil, we init it.
6099 (null (gnus-info-read info))
6101 (setq ninfo (cons 1 (1- (car active))))
6102 (setq ninfo (gnus-info-read info)))
6103 ;; Then we add the read articles to the range.
6105 ninfo (setq articles (sort articles '<))))))
6107 (defun gnus-group-make-articles-read (group articles)
6108 "Update the info of GROUP to say that ARTICLES are read."
6110 (entry (gnus-group-entry group))
6111 (info (nth 2 entry))
6112 (active (gnus-active group))
6115 (setq range (gnus-compute-read-articles group articles))
6116 (with-current-buffer gnus-group-buffer
6119 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6120 (gnus-info-set-read ',info ',(gnus-info-read info))
6121 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6122 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6123 (gnus-group-update-group ,group t))))
6124 ;; Add the read articles to the range.
6125 (gnus-info-set-read info range)
6126 (gnus-request-set-mark group (list (list range 'add '(read))))
6127 ;; Then we have to re-compute how many unread
6128 ;; articles there are in this group.
6132 (setq num (- (1+ (cdr active)) (car active))))
6133 ((not (listp (cdr range)))
6134 (setq num (- (cdr active) (- (1+ (cdr range))
6138 (if (numberp (car range))
6140 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6141 (setq range (cdr range)))
6142 (setq num (- (cdr active) num))))
6143 ;; Update the number of unread articles.
6145 ;; Update the group buffer.
6146 (unless (gnus-ephemeral-group-p group)
6147 (gnus-group-update-group group t))))))
6149 (defvar gnus-newsgroup-none-id 0)
6151 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6152 (let ((cur nntp-server-buffer)
6155 (with-current-buffer gnus-summary-buffer
6156 gnus-newsgroup-dependencies)))
6157 headers id end ref number
6158 (mail-parse-charset gnus-newsgroup-charset)
6159 (mail-parse-ignored-charsets
6160 (save-current-buffer (condition-case nil
6161 (set-buffer gnus-summary-buffer)
6163 gnus-newsgroup-ignored-charsets)))
6164 (with-current-buffer nntp-server-buffer
6165 ;; Translate all TAB characters into SPACE characters.
6166 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6167 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6168 (ietf-drums-unfold-fws)
6169 (gnus-run-hooks 'gnus-parse-headers-hook)
6170 (let ((case-fold-search t)
6171 in-reply-to header p lines chars)
6172 (goto-char (point-min))
6173 ;; Search to the beginning of the next header. Error messages
6174 ;; do not begin with 2 or 3.
6175 (while (re-search-forward "^[23][0-9]+ " nil t)
6178 ;; This implementation of this function, with nine
6179 ;; search-forwards instead of the one re-search-forward and
6180 ;; a case (which basically was the old function) is actually
6181 ;; about twice as fast, even though it looks messier. You
6182 ;; can't have everything, I guess. Speed and elegance
6183 ;; doesn't always go hand in hand.
6189 (setq number (read cur))
6192 (narrow-to-region (point)
6193 (or (and (search-forward "\n.\n" nil t)
6199 (if (search-forward "\nsubject:" nil t)
6200 (funcall gnus-decode-encoded-word-function
6201 (nnheader-header-value))
6206 (if (search-forward "\nfrom:" nil t)
6207 (funcall gnus-decode-encoded-address-function
6208 (nnheader-header-value))
6213 (if (search-forward "\ndate:" nil t)
6214 (nnheader-header-value) ""))
6218 (setq id (if (re-search-forward
6219 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6220 ;; We do it this way to make sure the Message-ID
6221 ;; is (somewhat) syntactically valid.
6222 (buffer-substring (match-beginning 1)
6224 ;; If there was no message-id, we just fake one
6225 ;; to make subsequent routines simpler.
6226 (nnheader-generate-fake-message-id number))))
6230 (if (search-forward "\nreferences:" nil t)
6234 (nnheader-header-value)
6239 (search-backward ">" end t)
6242 (search-backward "<" end t)
6244 ;; Get the references from the in-reply-to header if there
6245 ;; were no references and the in-reply-to header looks
6247 (if (and (search-forward "\nin-reply-to:" nil t)
6248 (setq in-reply-to (nnheader-header-value))
6249 (string-match "<[^>]+>" in-reply-to))
6251 (setq ref (substring in-reply-to (match-beginning 0)
6253 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6254 (setq ref2 (substring in-reply-to (match-beginning 0)
6256 (when (> (length ref2) (length ref))
6263 (if (search-forward "\nchars: " nil t)
6264 (if (numberp (setq chars (ignore-errors (read cur))))
6270 (if (search-forward "\nlines: " nil t)
6271 (if (numberp (setq lines (ignore-errors (read cur))))
6277 (and (search-forward "\nxref:" nil t)
6278 (nnheader-header-value)))
6280 (when gnus-extra-headers
6281 (let ((extra gnus-extra-headers)
6285 (when (search-forward
6286 (concat "\n" (symbol-name (car extra)) ":") nil t)
6287 (push (cons (car extra) (nnheader-header-value))
6291 (when (equal id ref)
6294 (when gnus-alter-header-function
6295 (funcall gnus-alter-header-function header)
6296 (setq id (mail-header-id header)
6297 ref (gnus-parent-id (mail-header-references header))))
6300 (gnus-dependencies-add-header
6301 header dependencies force-new))
6302 (push header headers))
6303 (goto-char (point-max))
6305 (nreverse headers)))))
6307 ;; Goes through the xover lines and returns a list of vectors
6308 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6309 force-new dependencies
6310 group also-fetch-heads)
6311 "Parse the news overview data in the server buffer.
6312 Return a list of headers that match SEQUENCE (see
6313 `nntp-retrieve-headers')."
6314 ;; Get the Xref when the users reads the articles since most/some
6315 ;; NNTP servers do not include Xrefs when using XOVER.
6316 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6317 (let ((mail-parse-charset gnus-newsgroup-charset)
6318 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6319 (cur nntp-server-buffer)
6320 (dependencies (or dependencies gnus-newsgroup-dependencies))
6322 ((eq gnus-read-all-available-headers t)
6324 ((and (stringp gnus-read-all-available-headers)
6326 (string-match gnus-read-all-available-headers group))
6329 number headers header)
6330 (with-current-buffer nntp-server-buffer
6331 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6332 ;; Allow the user to mangle the headers before parsing them.
6333 (gnus-run-hooks 'gnus-parse-headers-hook)
6334 (goto-char (point-min))
6335 (gnus-parse-without-error
6336 (while (and (or sequence allp)
6338 (setq number (read cur))
6340 (while (and sequence
6341 (< (car sequence) number))
6342 (setq sequence (cdr sequence))))
6345 (eq number (car sequence))))
6347 (setq sequence (cdr sequence))
6348 (setq header (inline
6349 (gnus-nov-parse-line
6350 number dependencies force-new)))))
6351 (push header headers))
6353 ;; A common bug in inn is that if you have posted an article and
6354 ;; then retrieves the active file, it will answer correctly --
6355 ;; the new article is included. However, a NOV entry for the
6356 ;; article may not have been generated yet, so this may fail.
6357 ;; We work around this problem by retrieving the last few
6358 ;; headers using HEAD.
6359 (if (or (not also-fetch-heads)
6361 ;; We (probably) got all the headers.
6363 (let ((gnus-nov-is-evil t))
6366 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6367 (gnus-get-newsgroup-headers))))))))
6369 (defun gnus-article-get-xrefs ()
6370 "Fill in the Xref value in `gnus-current-headers', if necessary.
6371 This is meant to be called in `gnus-article-internal-prepare-hook'."
6372 (let ((headers (with-current-buffer gnus-summary-buffer
6373 gnus-current-headers)))
6374 (or (not gnus-use-cross-reference)
6376 (and (mail-header-xref headers)
6377 (not (string= (mail-header-xref headers) "")))
6378 (let ((case-fold-search t)
6381 (nnheader-narrow-to-headers)
6382 (goto-char (point-min))
6383 (when (or (and (not (eobp))
6384 (eq (downcase (char-after)) ?x)
6385 (looking-at "Xref:"))
6386 (search-forward "\nXref:" nil t))
6387 (goto-char (1+ (match-end 0)))
6388 (setq xref (buffer-substring (point) (point-at-eol)))
6389 (mail-header-set-xref headers xref)))))))
6391 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6392 "Find article ID and insert the summary line for that article.
6393 OLD-HEADER can either be a header or a line number to insert
6394 the subject line on."
6395 (let* ((line (and (numberp old-header) old-header))
6396 (old-header (and (vectorp old-header) old-header))
6397 (header (cond ((and old-header use-old-header)
6400 (gnus-number-to-header id))
6401 (gnus-number-to-header id))
6403 (gnus-read-header id))))
6404 (number (and (numberp id) id))
6407 ;; Rebuild the thread that this article is part of and go to the
6408 ;; article we have fetched.
6409 (when (and (not gnus-show-threads)
6412 (setq d (gnus-data-find (mail-header-number old-header))))
6413 (goto-char (gnus-data-pos d))
6419 (gnus-delete-line))))))
6420 ;; Remove list identifiers from subject.
6421 (when gnus-list-identifiers
6422 (let ((gnus-newsgroup-headers (list header)))
6423 (gnus-summary-remove-list-identifiers)))
6425 (mail-header-set-number header (mail-header-number old-header)))
6426 (setq gnus-newsgroup-sparse
6427 (delq (setq number (mail-header-number header))
6428 gnus-newsgroup-sparse))
6429 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6430 (push number gnus-newsgroup-limit)
6431 (gnus-rebuild-thread (mail-header-id header) line)
6432 (gnus-summary-goto-subject number nil t))
6433 (when (and (numberp number)
6435 ;; We have to update the boundaries even if we can't fetch the
6436 ;; article if ID is a number -- so that the next `P' or `N'
6437 ;; command will fetch the previous (or next) article even
6438 ;; if the one we tried to fetch this time has been canceled.
6439 (when (> number gnus-newsgroup-end)
6440 (setq gnus-newsgroup-end number))
6441 (when (< number gnus-newsgroup-begin)
6442 (setq gnus-newsgroup-begin number))
6443 (setq gnus-newsgroup-unselected
6444 (delq number gnus-newsgroup-unselected)))
6445 ;; Report back a success?
6446 (and header (mail-header-number header))))
6448 ;;; Process/prefix in the summary buffer
6450 (defun gnus-summary-work-articles (n)
6451 "Return a list of articles to be worked upon.
6452 The prefix argument, the list of process marked articles, and the
6453 current article will be taken into consideration."
6454 (with-current-buffer gnus-summary-buffer
6457 ;; A numerical prefix has been given.
6458 (setq n (prefix-numeric-value n))
6459 (let ((backward (< n 0))
6460 (n (abs (prefix-numeric-value n)))
6465 (push (setq article (gnus-summary-article-number))
6468 (gnus-summary-find-prev nil article)
6469 (gnus-summary-find-next nil article)))
6471 (nreverse articles)))
6472 ((and (gnus-region-active-p) (mark))
6473 (message "region active")
6474 ;; Work on the region between point and mark.
6475 (let ((max (max (point) (mark)))
6478 (goto-char (min (point) (mark)))
6481 (push (setq article (gnus-summary-article-number)) articles)
6482 (gnus-summary-find-next nil article)
6484 (nreverse articles))))
6485 (gnus-newsgroup-processable
6486 ;; There are process-marked articles present.
6487 ;; Save current state.
6488 (gnus-summary-save-process-mark)
6490 (reverse gnus-newsgroup-processable))
6492 ;; Just return the current article.
6493 (list (gnus-summary-article-number))))))
6495 (defmacro gnus-summary-iterate (arg &rest forms)
6496 "Iterate over the process/prefixed articles and do FORMS.
6497 ARG is the interactive prefix given to the command. FORMS will be
6498 executed with point over the summary line of the articles."
6499 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6500 `(let ((,articles (gnus-summary-work-articles ,arg)))
6502 (gnus-summary-goto-subject (car ,articles))
6506 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6507 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6509 (defun gnus-summary-save-process-mark ()
6510 "Push the current set of process marked articles on the stack."
6512 (push (copy-sequence gnus-newsgroup-processable)
6513 gnus-newsgroup-process-stack))
6515 (defun gnus-summary-kill-process-mark ()
6516 "Push the current set of process marked articles on the stack and unmark."
6518 (gnus-summary-save-process-mark)
6519 (gnus-summary-unmark-all-processable))
6521 (defun gnus-summary-yank-process-mark ()
6522 "Pop the last process mark state off the stack and restore it."
6524 (unless gnus-newsgroup-process-stack
6525 (error "Empty mark stack"))
6526 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6528 (defun gnus-summary-process-mark-set (set)
6529 "Make SET into the current process marked articles."
6530 (gnus-summary-unmark-all-processable)
6531 (mapc 'gnus-summary-set-process-mark set))
6533 ;;; Searching and stuff
6535 (defun gnus-summary-search-group (&optional backward use-level)
6536 "Search for next unread newsgroup.
6537 If optional argument BACKWARD is non-nil, search backward instead."
6538 (with-current-buffer gnus-group-buffer
6539 (when (gnus-group-search-forward
6540 backward nil (if use-level (gnus-group-group-level) nil))
6541 (gnus-group-group-name))))
6543 (defun gnus-summary-best-group (&optional exclude-group)
6544 "Find the name of the best unread group.
6545 If EXCLUDE-GROUP, do not go to this group."
6546 (with-current-buffer gnus-group-buffer
6548 (gnus-group-best-unread-group exclude-group))))
6550 (defun gnus-summary-find-next (&optional unread article backward)
6552 (gnus-summary-find-prev unread article)
6553 (let* ((dummy (gnus-summary-article-intangible-p))
6554 (article (or article (gnus-summary-article-number)))
6555 (data (gnus-data-find-list article))
6557 (when (and (not dummy)
6558 (or (not gnus-summary-check-current)
6560 (not (gnus-data-unread-p (car data)))))
6561 (setq data (cdr data)))
6566 (unless (memq (gnus-data-number (car data))
6568 ((eq gnus-auto-goto-ignores
6569 'always-undownloaded)
6570 gnus-newsgroup-undownloaded)
6573 ((eq gnus-auto-goto-ignores
6575 gnus-newsgroup-unfetched)
6576 ((eq gnus-auto-goto-ignores
6578 gnus-newsgroup-undownloaded)))
6579 (when (gnus-data-unread-p (car data))
6580 (setq result (car data)
6582 (setq data (cdr data)))
6585 (goto-char (gnus-data-pos result))
6586 (gnus-data-number result)))))
6588 (defun gnus-summary-find-prev (&optional unread article)
6589 (let* ((eobp (eobp))
6590 (article (or article (gnus-summary-article-number)))
6591 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6593 (when (and (not eobp)
6594 (or (not gnus-summary-check-current)
6596 (not (gnus-data-unread-p (car data)))))
6597 (setq data (cdr data)))
6602 (unless (memq (gnus-data-number (car data))
6604 ((eq gnus-auto-goto-ignores
6605 'always-undownloaded)
6606 gnus-newsgroup-undownloaded)
6609 ((eq gnus-auto-goto-ignores
6611 gnus-newsgroup-unfetched)
6612 ((eq gnus-auto-goto-ignores
6614 gnus-newsgroup-undownloaded)))
6615 (when (gnus-data-unread-p (car data))
6616 (setq result (car data)
6618 (setq data (cdr data)))
6621 (goto-char (gnus-data-pos result))
6622 (gnus-data-number result))))
6624 (defun gnus-summary-find-subject (subject &optional unread backward article)
6625 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6626 (article (or article (gnus-summary-article-number)))
6627 (articles (gnus-data-list backward))
6628 (arts (gnus-data-find-list article articles))
6630 (when (or (not gnus-summary-check-current)
6632 (not (gnus-data-unread-p (car arts))))
6633 (setq arts (cdr arts)))
6635 (and (or (not unread)
6636 (gnus-data-unread-p (car arts)))
6637 (vectorp (gnus-data-header (car arts)))
6639 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6640 (setq result (car arts)
6642 (setq arts (cdr arts)))
6644 (goto-char (gnus-data-pos result))
6645 (gnus-data-number result))))
6647 (defun gnus-summary-search-forward (&optional unread subject backward)
6648 "Search forward for an article.
6649 If UNREAD, look for unread articles. If SUBJECT, look for
6650 articles with that subject. If BACKWARD, search backward instead."
6651 (cond (subject (gnus-summary-find-subject subject unread backward))
6652 (backward (gnus-summary-find-prev unread))
6653 (t (gnus-summary-find-next unread))))
6655 (defun gnus-recenter (&optional n)
6656 "Center point in window and redisplay frame.
6657 Also do horizontal recentering."
6659 (when (and gnus-auto-center-summary
6660 (not (eq gnus-auto-center-summary 'vertical)))
6661 (gnus-horizontal-recenter))
6664 (defun gnus-summary-recenter ()
6665 "Center point in the summary window.
6666 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6667 displayed, no centering will be performed."
6668 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6669 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6671 ;; The user has to want it.
6672 (when gnus-auto-center-summary
6673 (let* ((top (cond ((< (window-height) 4) 0)
6674 ((< (window-height) 7) 1)
6675 (t (if (numberp gnus-auto-center-summary)
6676 gnus-auto-center-summary
6677 (/ (1- (window-height)) 2)))))
6678 (height (1- (window-height)))
6679 (bottom (save-excursion (goto-char (point-max))
6680 (forward-line (- height))
6682 (window (get-buffer-window (current-buffer))))
6683 (when (get-buffer-window gnus-article-buffer)
6684 ;; Only do recentering when the article buffer is displayed,
6685 ;; Set the window start to either `bottom', which is the biggest
6686 ;; possible valid number, or the second line from the top,
6687 ;; whichever is the least.
6688 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6689 (if (> bottom top-pos)
6690 ;; Keep the second line from the top visible
6691 (set-window-start window top-pos)
6692 ;; Try to keep the bottom line visible; if it's partially
6693 ;; obscured, either scroll one more line to make it fully
6694 ;; visible, or revert to using TOP-POS.
6696 (goto-char (point-max))
6698 (let ((last-line-start (point)))
6700 (set-window-start window (point) t)
6701 (when (not (pos-visible-in-window-p last-line-start window))
6703 (set-window-start window (min (point) top-pos) t)))))))
6704 ;; Do horizontal recentering while we're at it.
6705 (when (and (get-buffer-window (current-buffer) t)
6706 (not (eq gnus-auto-center-summary 'vertical)))
6707 (let ((selected (selected-window)))
6708 (select-window (get-buffer-window (current-buffer) t))
6709 (gnus-summary-position-point)
6710 (gnus-horizontal-recenter)
6711 (select-window selected))))))
6713 (defun gnus-summary-jump-to-group (newsgroup)
6714 "Move point to NEWSGROUP in group mode buffer."
6715 ;; Keep update point of group mode buffer if visible.
6716 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6717 (save-window-excursion
6718 ;; Take care of tree window mode.
6719 (when (get-buffer-window gnus-group-buffer)
6720 (pop-to-buffer gnus-group-buffer))
6721 (gnus-group-jump-to-group newsgroup))
6723 ;; Take care of tree window mode.
6724 (if (get-buffer-window gnus-group-buffer 0)
6725 (pop-to-buffer gnus-group-buffer)
6726 (set-buffer gnus-group-buffer))
6727 (gnus-group-jump-to-group newsgroup))))
6729 ;; This function returns a list of article numbers based on the
6730 ;; difference between the ranges of read articles in this group and
6731 ;; the range of active articles.
6732 (defun gnus-list-of-unread-articles (group)
6733 (let* ((read (gnus-info-read (gnus-get-info group)))
6734 (active (or (gnus-active group) (gnus-activate-group group)))
6735 (last (or (cdr active)
6736 (error "Group %s couldn't be activated " group)))
6737 (bottom (if gnus-newsgroup-maximum-articles
6739 (- last gnus-newsgroup-maximum-articles -1))
6742 ;; If none are read, then all are unread.
6745 ;; If the range of read articles is a single range, then the
6746 ;; first unread article is the article after the last read
6747 ;; article. Sounds logical, doesn't it?
6748 (if (and (not (listp (cdr read)))
6749 (or (< (car read) bottom)
6750 (progn (setq read (list read))
6752 (setq first (max bottom (1+ (cdr read))))
6753 ;; `read' is a list of ranges.
6754 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6757 (setq first bottom))
6760 (while (< first nlast)
6761 (setq unread (cons first unread)
6763 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6764 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6765 (setq read (cdr read)))))
6766 ;; And add the last unread articles.
6767 (while (<= first last)
6768 (setq unread (cons first unread)
6770 ;; Return the list of unread articles.
6771 (delq 0 (nreverse unread))))
6773 (defun gnus-list-of-read-articles (group)
6774 "Return a list of unread, unticked and non-dormant articles."
6775 (let* ((info (gnus-get-info group))
6776 (marked (gnus-info-marks info))
6777 (active (gnus-active group)))
6779 (gnus-list-range-difference
6780 (gnus-list-range-difference
6781 (gnus-sorted-complement
6782 (gnus-uncompress-range
6783 (if gnus-newsgroup-maximum-articles
6784 (cons (max (car active)
6786 gnus-newsgroup-maximum-articles
6790 (gnus-list-of-unread-articles group))
6791 (cdr (assq 'dormant marked)))
6792 (cdr (assq 'tick marked))))))
6794 ;; This function returns a sequence of article numbers based on the
6795 ;; difference between the ranges of read articles in this group and
6796 ;; the range of active articles.
6797 (defun gnus-sequence-of-unread-articles (group)
6798 (let* ((read (gnus-info-read (gnus-get-info group)))
6799 (active (or (gnus-active group) (gnus-activate-group group)))
6801 (bottom (if gnus-newsgroup-maximum-articles
6803 (- last gnus-newsgroup-maximum-articles -1))
6806 ;; If none are read, then all are unread.
6809 ;; If the range of read articles is a single range, then the
6810 ;; first unread article is the article after the last read
6811 ;; article. Sounds logical, doesn't it?
6812 (if (and (not (listp (cdr read)))
6813 (or (< (car read) bottom)
6814 (progn (setq read (list read))
6816 (setq first (max bottom (1+ (cdr read))))
6817 ;; `read' is a list of ranges.
6818 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6821 (setq first bottom))
6824 (push (cons first nlast) unread))
6825 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6826 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6827 (setq read (cdr read)))))
6828 ;; And add the last unread articles.
6829 (cond ((not (and first last))
6832 (push (cons first last) unread))
6834 (push first unread)))
6835 ;; Return the sequence of unread articles.
6836 (delq 0 (nreverse unread))))
6838 ;; Various summary commands
6840 (defun gnus-summary-select-article-buffer ()
6841 "Reconfigure windows to show article buffer."
6843 (if (not (gnus-buffer-live-p gnus-article-buffer))
6844 (error "There is no article buffer for this summary buffer")
6845 (gnus-configure-windows 'article)
6846 (select-window (get-buffer-window gnus-article-buffer))))
6848 (defun gnus-summary-universal-argument (arg)
6849 "Perform any operation on all articles that are process/prefixed."
6851 (let ((articles (gnus-summary-work-articles arg))
6858 (substitute-command-keys
6859 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6861 (gnus-error 1 "Undefined key")
6864 (gnus-summary-goto-subject (setq article (pop articles)))
6865 (let (gnus-newsgroup-processable)
6866 (command-execute func))
6867 (gnus-summary-remove-process-mark article)))))
6868 (gnus-summary-position-point))
6870 (defun gnus-summary-toggle-truncation (&optional arg)
6871 "Toggle truncation of summary lines.
6872 With ARG, turn line truncation on if ARG is positive."
6874 (setq truncate-lines
6875 (if (null arg) (not truncate-lines)
6876 (> (prefix-numeric-value arg) 0)))
6879 (defun gnus-summary-find-for-reselect ()
6880 "Return the number of an article to stay on across a reselect.
6881 The current article is considered, then following articles, then previous
6882 articles. An article is sought which is not cancelled and isn't a temporary
6883 insertion from another group. If there's no such then return a dummy 0."
6885 (dolist (rev '(nil t))
6886 (unless found ; don't demand the reverse list if we don't need it
6887 (let ((data (gnus-data-find-list
6888 (gnus-summary-article-number) (gnus-data-list rev))))
6889 (while (and data (not found))
6890 (if (and (< 0 (gnus-data-number (car data)))
6891 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6892 (setq found (gnus-data-number (car data))))
6893 (setq data (cdr data))))))
6896 (defun gnus-summary-reselect-current-group (&optional all rescan)
6897 "Exit and then reselect the current newsgroup.
6898 The prefix argument ALL means to select all articles."
6900 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6901 (error "Ephemeral groups can't be reselected"))
6902 (let ((current-subject (gnus-summary-find-for-reselect))
6903 (group gnus-newsgroup-name))
6904 (setq gnus-newsgroup-begin nil)
6905 (gnus-summary-exit nil 'leave-hidden)
6906 ;; We have to adjust the point of group mode buffer because
6907 ;; point was moved to the next unread newsgroup by exiting.
6908 (gnus-summary-jump-to-group group)
6911 (gnus-group-get-new-news-this-group 1)))
6912 (gnus-group-read-group all t)
6913 (gnus-summary-goto-subject current-subject nil t)))
6915 (defun gnus-summary-rescan-group (&optional all)
6916 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6918 (gnus-summary-reselect-current-group all t))
6920 (defun gnus-summary-update-info (&optional non-destructive)
6922 (let ((group gnus-newsgroup-name))
6924 (when gnus-newsgroup-kill-headers
6925 (setq gnus-newsgroup-killed
6926 (gnus-compress-sequence
6928 (gnus-list-range-intersection
6929 gnus-newsgroup-unselected gnus-newsgroup-killed)
6930 gnus-newsgroup-unreads)
6932 (unless (listp (cdr gnus-newsgroup-killed))
6933 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6934 (let ((headers gnus-newsgroup-headers))
6935 ;; Set the new ranges of read articles.
6936 (with-current-buffer gnus-group-buffer
6937 (gnus-undo-force-boundary))
6938 (gnus-update-read-articles
6939 group (gnus-sorted-union
6940 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6941 ;; Set the current article marks.
6942 (let ((gnus-newsgroup-scored
6943 (if (and (not gnus-save-score)
6944 (not non-destructive))
6946 gnus-newsgroup-scored)))
6948 (gnus-update-marks)))
6949 ;; Do the cross-ref thing.
6950 (when gnus-use-cross-reference
6951 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6952 ;; Do not switch windows but change the buffer to work.
6953 (set-buffer gnus-group-buffer)
6954 (unless (gnus-ephemeral-group-p group)
6955 (gnus-group-update-group group)))))))
6957 (defun gnus-summary-save-newsrc (&optional force)
6958 "Save the current number of read/marked articles in the dribble buffer.
6959 The dribble buffer will then be saved.
6960 If FORCE (the prefix), also save the .newsrc file(s)."
6962 (gnus-summary-update-info t)
6964 (gnus-save-newsrc-file)
6965 (gnus-dribble-save)))
6967 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
6969 (defun gnus-summary-exit (&optional temporary leave-hidden)
6970 "Exit reading current newsgroup, and then return to group selection mode.
6971 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6973 (gnus-set-global-variables)
6974 (when (gnus-buffer-live-p gnus-article-buffer)
6975 (with-current-buffer gnus-article-buffer
6976 (mm-destroy-parts gnus-article-mime-handles)
6977 ;; Set it to nil for safety reason.
6978 (setq gnus-article-mime-handle-alist nil)
6979 (setq gnus-article-mime-handles nil)))
6980 (gnus-kill-save-kill-buffer)
6981 (gnus-async-halt-prefetch)
6982 (let* ((group gnus-newsgroup-name)
6983 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6984 (gnus-group-is-exiting-p t)
6987 (buf (current-buffer)))
6989 ;; Do adaptive scoring, and possibly save score files.
6990 (when gnus-newsgroup-adaptive
6991 (gnus-score-adaptive))
6992 (when gnus-use-scoring
6994 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6995 ;; If we have several article buffers, we kill them at exit.
6996 (unless gnus-single-article-buffer
6997 (when (gnus-buffer-live-p gnus-article-buffer)
6998 (with-current-buffer gnus-article-buffer
6999 ;; Don't kill sticky article buffers
7000 (unless (eq major-mode 'gnus-sticky-article-mode)
7001 (gnus-kill-buffer gnus-article-buffer)
7002 (setq gnus-article-current nil))))
7003 (gnus-kill-buffer gnus-original-article-buffer))
7004 (when gnus-use-cache
7005 (gnus-cache-possibly-remove-articles)
7006 (gnus-cache-save-buffers))
7007 (gnus-async-prefetch-remove-group group)
7008 (when gnus-suppress-duplicates
7009 (gnus-dup-enter-articles))
7010 (when gnus-use-trees
7011 (gnus-tree-close group))
7012 (when gnus-use-cache
7013 (gnus-cache-write-active))
7014 ;; Remove entries for this group.
7015 (nnmail-purge-split-history (gnus-group-real-name group))
7016 ;; Make all changes in this group permanent.
7018 (gnus-run-hooks 'gnus-exit-group-hook)
7019 (gnus-summary-update-info))
7020 (gnus-close-group group)
7021 ;; Make sure where we were, and go to next newsgroup.
7022 (set-buffer gnus-group-buffer)
7024 (gnus-group-jump-to-group group))
7025 (gnus-run-hooks 'gnus-summary-exit-hook)
7026 (unless (or quit-config
7027 (not gnus-summary-next-group-on-exit)
7028 ;; If this group has disappeared from the summary
7029 ;; buffer, don't skip forwards.
7030 (not (string= group (gnus-group-group-name))))
7031 (gnus-group-next-unread-group 1))
7032 (setq group-point (point))
7036 (if (not gnus-kill-summary-on-exit)
7038 (gnus-deaden-summary)
7040 ;; We set all buffer-local variables to nil. It is unclear why
7041 ;; this is needed, but if we don't, buffer-local variables are
7042 ;; not garbage-collected, it seems. This would the lead to en
7043 ;; ever-growing Emacs.
7044 (gnus-summary-clear-local-variables)
7045 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7046 (gnus-summary-clear-local-variables))
7047 (when (get-buffer gnus-article-buffer)
7048 (bury-buffer gnus-article-buffer))
7049 ;; Return to group mode buffer.
7050 (when (eq mode 'gnus-summary-mode)
7051 (gnus-kill-buffer buf)))
7052 (setq gnus-current-select-method gnus-select-method)
7053 (set-buffer gnus-group-buffer)
7055 (gnus-handle-ephemeral-exit quit-config)
7056 (goto-char group-point)
7057 ;; If gnus-group-buffer is already displayed, make sure we also move
7058 ;; the cursor in the window that displays it.
7059 (let ((win (get-buffer-window (current-buffer) 0)))
7060 (if win (set-window-point win (point))))
7061 (unless leave-hidden
7062 (gnus-configure-windows 'group 'force)))
7063 ;; Clear the current group name.
7065 (setq gnus-newsgroup-name nil)))))
7067 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7068 (defun gnus-summary-exit-no-update (&optional no-questions)
7069 "Quit reading current newsgroup without updating read article info."
7071 (let* ((group gnus-newsgroup-name)
7072 (gnus-group-is-exiting-p t)
7073 (gnus-group-is-exiting-without-update-p t)
7074 (quit-config (gnus-group-quit-config group)))
7075 (when (or no-questions
7077 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7078 (gnus-async-halt-prefetch)
7079 (run-hooks 'gnus-summary-prepare-exit-hook)
7080 (when (gnus-buffer-live-p gnus-article-buffer)
7081 (with-current-buffer gnus-article-buffer
7082 (mm-destroy-parts gnus-article-mime-handles)
7083 ;; Set it to nil for safety reason.
7084 (setq gnus-article-mime-handle-alist nil)
7085 (setq gnus-article-mime-handles nil)))
7086 ;; If we have several article buffers, we kill them at exit.
7087 (unless gnus-single-article-buffer
7088 (gnus-kill-buffer gnus-article-buffer)
7089 (gnus-kill-buffer gnus-original-article-buffer)
7090 (setq gnus-article-current nil))
7091 (if (not gnus-kill-summary-on-exit)
7092 (gnus-deaden-summary)
7093 (gnus-close-group group)
7094 (gnus-summary-clear-local-variables)
7095 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7096 (gnus-summary-clear-local-variables))
7097 (gnus-kill-buffer gnus-summary-buffer))
7098 (unless gnus-single-article-buffer
7099 (setq gnus-article-current nil))
7100 (when gnus-use-trees
7101 (gnus-tree-close group))
7102 (gnus-async-prefetch-remove-group group)
7103 (when (get-buffer gnus-article-buffer)
7104 (bury-buffer gnus-article-buffer))
7105 ;; Return to the group buffer.
7106 (gnus-configure-windows 'group 'force)
7107 ;; Clear the current group name.
7108 (setq gnus-newsgroup-name nil)
7109 (unless (gnus-ephemeral-group-p group)
7110 (gnus-group-update-group group))
7111 (when (equal (gnus-group-group-name) group)
7112 (gnus-group-next-unread-group 1))
7114 (gnus-handle-ephemeral-exit quit-config)))))
7116 (defun gnus-handle-ephemeral-exit (quit-config)
7117 "Handle movement when leaving an ephemeral group.
7118 The state which existed when entering the ephemeral is reset."
7119 (if (not (buffer-name (car quit-config)))
7120 (gnus-configure-windows 'group 'force)
7121 (set-buffer (car quit-config))
7122 (cond ((eq major-mode 'gnus-summary-mode)
7123 (gnus-set-global-variables))
7124 ((eq major-mode 'gnus-article-mode)
7125 (save-current-buffer
7126 ;; The `gnus-summary-buffer' variable may point
7127 ;; to the old summary buffer when using a single
7129 (unless (gnus-buffer-live-p gnus-summary-buffer)
7130 (set-buffer gnus-group-buffer))
7131 (set-buffer gnus-summary-buffer)
7132 (gnus-set-global-variables))))
7133 (if (or (eq (cdr quit-config) 'article)
7134 (eq (cdr quit-config) 'pick))
7135 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7136 (gnus-configure-windows 'pick 'force)
7137 (gnus-configure-windows (cdr quit-config) 'force))
7138 (gnus-configure-windows (cdr quit-config) 'force))
7139 (when (eq major-mode 'gnus-summary-mode)
7140 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7141 next-unread-noselect))
7142 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7144 (gnus-summary-next-subject 1 nil t))
7145 ((eq gnus-auto-select-on-ephemeral-exit
7146 'next-unread-noselect)
7147 (gnus-summary-next-subject 1 t t))))
7148 ;; Hide the article buffer which displays the article different
7149 ;; from the one that the cursor points to in the summary buffer.
7150 (gnus-configure-windows 'summary 'force))
7151 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7152 (gnus-summary-next-subject 1))
7153 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7154 (gnus-summary-next-subject 1 t))))
7155 (gnus-summary-recenter)
7156 (gnus-summary-position-point))))
7160 (defvar gnus-dead-summary-mode-map nil)
7162 (unless gnus-dead-summary-mode-map
7163 (setq gnus-dead-summary-mode-map (make-keymap))
7164 (suppress-keymap gnus-dead-summary-mode-map)
7165 (substitute-key-definition
7166 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7167 (dolist (key '("\C-d" "\r" "\177" [delete]))
7168 (define-key gnus-dead-summary-mode-map
7169 key
'gnus-summary-wake-up-the-dead
))
7170 (dolist (key '("q" "Q"))
7171 (define-key gnus-dead-summary-mode-map key
'bury-buffer
)))
7173 (defvar gnus-dead-summary-mode nil
7174 "Minor mode for Gnus summary buffers.")
7176 (defun gnus-dead-summary-mode (&optional arg
)
7177 "Minor mode for Gnus summary buffers."
7179 (when (eq major-mode
'gnus-summary-mode
)
7180 (make-local-variable 'gnus-dead-summary-mode
)
7181 (setq gnus-dead-summary-mode
7182 (if (null arg
) (not gnus-dead-summary-mode
)
7183 (> (prefix-numeric-value arg
) 0)))
7184 (when gnus-dead-summary-mode
7186 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
7188 (defun gnus-deaden-summary ()
7189 "Make the current summary buffer into a dead summary buffer."
7190 ;; Kill any previous dead summary buffer.
7191 (when (and gnus-dead-summary
7192 (buffer-name gnus-dead-summary
))
7193 (with-current-buffer gnus-dead-summary
7194 (when gnus-dead-summary-mode
7195 (kill-buffer (current-buffer)))))
7196 ;; Make this the current dead summary.
7197 (setq gnus-dead-summary
(current-buffer))
7198 (gnus-dead-summary-mode 1)
7199 (let ((name (buffer-name)))
7200 (when (string-match "Summary" name
)
7202 (concat (substring name
0 (match-beginning 0)) "Dead "
7203 (substring name
(match-beginning 0)))
7207 (defun gnus-kill-or-deaden-summary (buffer)
7208 "Kill or deaden the summary BUFFER."
7210 (when (and (buffer-name buffer
)
7211 (not gnus-single-article-buffer
))
7212 (with-current-buffer buffer
7213 (gnus-kill-buffer gnus-article-buffer
)
7214 (gnus-kill-buffer gnus-original-article-buffer
)))
7217 (gnus-kill-summary-on-exit
7218 (when (and gnus-use-trees
7219 (gnus-buffer-exists-p buffer
))
7220 (with-current-buffer buffer
7221 (gnus-tree-close gnus-newsgroup-name
)))
7222 (gnus-kill-buffer buffer
))
7223 ;; Deaden the buffer.
7224 ((gnus-buffer-exists-p buffer
)
7225 (with-current-buffer buffer
7226 (gnus-deaden-summary))))))
7228 (defun gnus-summary-wake-up-the-dead (&rest args
)
7229 "Wake up the dead summary buffer."
7231 (gnus-dead-summary-mode -
1)
7232 (let ((name (buffer-name)))
7233 (when (string-match "Dead " name
)
7235 (concat (substring name
0 (match-beginning 0))
7236 (substring name
(match-end 0)))
7238 (gnus-message 3 "This dead summary is now alive again"))
7240 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7241 (defun gnus-summary-fetch-faq (&optional faq-dir
)
7242 "Fetch the FAQ for the current group.
7243 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7247 (when current-prefix-arg
7249 "FAQ dir: " (and (listp gnus-group-faq-directory
)
7251 gnus-group-faq-directory
))))))
7252 (let (gnus-faq-buffer)
7253 (when (setq gnus-faq-buffer
7254 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
7255 (gnus-configure-windows 'summary-faq
))))
7257 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7258 (defun gnus-summary-describe-group (&optional force
)
7259 "Describe the current newsgroup."
7261 (gnus-group-describe-group force gnus-newsgroup-name
))
7263 (defun gnus-summary-describe-briefly ()
7264 "Describe summary mode commands briefly."
7266 (gnus-message 6 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
7268 ;; Walking around group mode buffer from summary mode.
7270 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7271 "Exit current newsgroup and then select next unread newsgroup.
7272 If prefix argument NO-ARTICLE is non-nil, no article is selected
7273 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7274 previous group instead."
7276 ;; Stop pre-fetching.
7277 (gnus-async-halt-prefetch)
7278 (let ((current-group gnus-newsgroup-name
)
7279 (current-buffer (current-buffer))
7281 ;; First we semi-exit this group to update Xrefs and all variables.
7282 ;; We can't do a real exit, because the window conf must remain
7283 ;; the same in case the user is prompted for info, and we don't
7284 ;; want the window conf to change before that...
7285 (gnus-summary-exit t
)
7286 (while (not entered
)
7287 ;; Then we find what group we are supposed to enter.
7288 (set-buffer gnus-group-buffer
)
7289 (gnus-group-jump-to-group current-group
)
7292 (if (eq gnus-keep-same-level
'best
)
7293 (gnus-summary-best-group gnus-newsgroup-name
)
7294 (gnus-summary-search-group backward gnus-keep-same-level
))))
7295 (if (not target-group
)
7296 ;; There are no further groups, so we return to the group
7299 (gnus-message 5 "Returning to the group buffer")
7301 (when (gnus-buffer-live-p current-buffer
)
7302 (set-buffer current-buffer
)
7303 (gnus-summary-exit))
7304 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
7305 ;; We try to enter the target group.
7306 (gnus-group-jump-to-group target-group
)
7307 (let ((unreads (gnus-group-group-unread)))
7308 (if (and (or (eq t unreads
)
7309 (and unreads
(not (zerop unreads
))))
7310 (gnus-summary-read-group
7311 target-group nil no-article
7312 (and (buffer-name current-buffer
) current-buffer
)
7315 (setq current-group target-group
7316 target-group nil
)))))))
7318 (defun gnus-summary-prev-group (&optional no-article
)
7319 "Exit current newsgroup and then select previous unread newsgroup.
7320 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7322 (gnus-summary-next-group no-article nil t
))
7324 ;; Walking around summary lines.
7326 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
7327 "Go to the first subject satisfying any non-nil constraint.
7328 If UNREAD is non-nil, the article should be unread.
7329 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7330 If UNSEEN is non-nil, the article should be unseen.
7331 Returns the article selected or nil if there are no matching articles."
7335 ((null gnus-newsgroup-data
)
7336 (gnus-message 3 "No articles in the group")
7338 ;; Pick the first article.
7339 ((not (or unread undownloaded unseen
))
7340 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
7341 (gnus-data-number (car gnus-newsgroup-data
)))
7342 ;; Find the first unread article.
7344 (let ((data gnus-newsgroup-data
))
7346 (let ((num (gnus-data-number (car data
))))
7347 (or (memq num gnus-newsgroup-unfetched
)
7348 (not (or (and unread
7349 (memq num gnus-newsgroup-unreads
))
7351 (memq num gnus-newsgroup-undownloaded
))
7353 (memq num gnus-newsgroup-unseen
)))))))
7354 (setq data
(cdr data
)))
7358 (goto-char (gnus-data-pos (car data
)))
7359 (gnus-data-number (car data
)))
7360 (gnus-message 3 "No more%s articles"
7361 (let* ((r (when unread
" unread"))
7362 (d (when undownloaded
" undownloaded"))
7363 (s (when unseen
" unseen"))
7364 (l (delq nil
(list r d s
))))
7365 (cond ((= 3 (length l
))
7366 (concat r
"," d
", or" s
))
7368 (concat (car l
) ", or" (cadr l
)))
7375 (gnus-summary-position-point))))))
7377 (defun gnus-summary-next-subject (n &optional unread dont-display
)
7378 "Go to next N'th summary line.
7379 If N is negative, go to the previous N'th subject line.
7380 If UNREAD is non-nil, only unread articles are selected.
7381 The difference between N and the actual number of steps taken is
7384 (let ((backward (< n
0))
7388 (gnus-summary-find-prev unread
)
7389 (gnus-summary-find-next unread
)))
7390 (unless (zerop (setq n
(1- n
)))
7391 (gnus-summary-show-thread)))
7393 (gnus-message 7 "No more%s articles"
7394 (if unread
" unread" "")))
7395 (unless dont-display
7396 (gnus-summary-recenter)
7397 (gnus-summary-position-point))
7400 (defun gnus-summary-next-unread-subject (n)
7401 "Go to next N'th unread summary line."
7403 (gnus-summary-next-subject n t
))
7405 (defun gnus-summary-prev-subject (n &optional unread
)
7406 "Go to previous N'th summary line.
7407 If optional argument UNREAD is non-nil, only unread article is selected."
7409 (gnus-summary-next-subject (- n
) unread
))
7411 (defun gnus-summary-prev-unread-subject (n)
7412 "Go to previous N'th unread summary line."
7414 (gnus-summary-next-subject (- n
) t
))
7416 (defun gnus-summary-goto-subjects (articles)
7417 "Insert the subject header for ARTICLES in the current buffer."
7419 (dolist (article articles
)
7420 (gnus-summary-goto-subject article t
)))
7421 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
7422 (gnus-summary-position-point))
7424 (defun gnus-summary-goto-subject (article &optional force silent
)
7425 "Go the subject line of ARTICLE.
7426 If FORCE, also allow jumping to articles not currently shown."
7427 (interactive "nArticle number: ")
7428 (unless (numberp article
)
7429 (error "Article %s is not a number" article
))
7431 (data (gnus-data-find article
)))
7432 ;; We read in the article if we have to.
7435 (gnus-summary-insert-subject
7437 (if (or (numberp force
) (vectorp force
)) force
)
7439 (setq data
(gnus-data-find article
)))
7444 (gnus-message 3 "Can't find article %d" article
))
7446 (let ((pt (gnus-data-pos data
)))
7448 (gnus-summary-set-article-display-arrow pt
))
7449 (gnus-summary-position-point)
7452 ;; Walking around summary lines with displaying articles.
7454 (defun gnus-summary-expand-window (&optional arg
)
7455 "Make the summary buffer take up the entire Emacs frame.
7456 Given a prefix, will force an `article' buffer configuration."
7459 (gnus-configure-windows 'article
'force
)
7460 (gnus-configure-windows 'summary
'force
)))
7462 (defun gnus-summary-display-article (article &optional all-header
)
7463 "Display ARTICLE in article buffer."
7464 (unless (and (gnus-buffer-live-p gnus-article-buffer
)
7465 (with-current-buffer gnus-article-buffer
7466 (eq major-mode
'gnus-article-mode
)))
7467 (gnus-article-setup-buffer))
7468 (gnus-set-global-variables)
7469 (with-current-buffer gnus-article-buffer
7470 (setq gnus-article-charset gnus-newsgroup-charset
)
7471 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7472 (mm-enable-multibyte))
7476 (if gnus-summary-display-article-function
7477 (funcall gnus-summary-display-article-function article all-header
)
7478 (gnus-article-prepare article all-header
))
7479 (gnus-run-hooks 'gnus-select-article-hook
)
7480 (when (and gnus-current-article
7481 (not (zerop gnus-current-article
)))
7482 (gnus-summary-goto-subject gnus-current-article
))
7483 (gnus-summary-recenter)
7484 (when (and gnus-use-trees gnus-show-threads
)
7485 (gnus-possibly-generate-tree article
)
7486 (gnus-highlight-selected-tree article
))
7487 ;; Successfully display article.
7488 (gnus-article-set-window-start
7489 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7491 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7492 "Select the current article.
7493 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7494 non-nil, the article will be re-fetched even if it already present in
7495 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7497 ;; Make sure we are in the summary buffer to work around bbdb bug.
7498 (unless (eq major-mode
'gnus-summary-mode
)
7499 (set-buffer gnus-summary-buffer
))
7500 (let ((article (or article
(gnus-summary-article-number)))
7501 (all-headers (not (not all-headers
))) ;Must be t or nil.
7502 gnus-summary-display-article-function
)
7504 (gnus-summary-article-pseudo-p article
)
7505 (error "This is a pseudo-article"))
7506 (with-current-buffer gnus-summary-buffer
7507 (if (or (and gnus-single-article-buffer
7508 (or (null gnus-current-article
)
7509 (null gnus-article-current
)
7510 (null (get-buffer gnus-article-buffer
))
7511 (not (eq article
(cdr gnus-article-current
)))
7512 (not (equal (car gnus-article-current
)
7513 gnus-newsgroup-name
))))
7514 (and (not gnus-single-article-buffer
)
7515 (or (null gnus-current-article
)
7516 (not (eq gnus-current-article article
))))
7518 ;; The requested article is different from the current article.
7520 (gnus-summary-display-article article all-headers
)
7521 (when (gnus-buffer-live-p gnus-article-buffer
)
7522 (with-current-buffer gnus-article-buffer
7523 (if (not gnus-article-decoded-p
) ;; a local variable
7524 (mm-disable-multibyte))))
7525 (gnus-article-set-window-start
7526 (cdr (assq article gnus-newsgroup-bookmarks
)))
7530 (defun gnus-summary-force-verify-and-decrypt ()
7531 "Display buttons for signed/encrypted parts and verify/decrypt them."
7533 (let ((mm-verify-option 'known
)
7534 (mm-decrypt-option 'known
)
7535 (gnus-article-emulate-mime t
)
7536 (gnus-buttonized-mime-types (append (list "multipart/signed"
7537 "multipart/encrypted")
7538 gnus-buttonized-mime-types
)))
7539 (gnus-summary-select-article nil
'force
)))
7541 (defun gnus-summary-set-current-mark (&optional current-mark
)
7542 "Obsolete function."
7545 (defun gnus-summary-next-article (&optional unread subject backward push
)
7546 "Select the next article.
7547 If UNREAD, only unread articles are selected.
7548 If SUBJECT, only articles with SUBJECT are selected.
7549 If BACKWARD, the previous article is selected instead of the next."
7551 ;; Make sure we are in the summary buffer.
7552 (unless (eq major-mode
'gnus-summary-mode
)
7553 (set-buffer gnus-summary-buffer
))
7555 ;; Is there such an article?
7556 ((and (gnus-summary-search-forward unread subject backward
)
7557 (or (gnus-summary-display-article (gnus-summary-article-number))
7558 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7559 (gnus-summary-position-point))
7560 ;; If not, we try the first unread, if that is wanted.
7562 gnus-auto-select-same
7563 (gnus-summary-first-unread-article))
7564 (gnus-summary-position-point)
7565 (gnus-message 6 "Wrapped"))
7566 ;; Try to get next/previous article not displayed in this group.
7567 ((and gnus-auto-extend-newsgroup
7568 (not unread
) (not subject
))
7569 (gnus-summary-goto-article
7570 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7571 nil
(count-lines (point-min) (point))))
7572 ;; Go to next/previous group.
7574 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7575 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7576 (let ((cmd last-command-char
)
7578 (with-current-buffer gnus-group-buffer
7581 (if (eq gnus-keep-same-level
'best
)
7582 (gnus-summary-best-group gnus-newsgroup-name
)
7583 (gnus-summary-search-group backward gnus-keep-same-level
))))
7584 ;; For some reason, the group window gets selected. We change
7586 (select-window (get-buffer-window (current-buffer)))
7587 ;; Select next unread newsgroup automagically.
7589 ((or (not gnus-auto-select-next
)
7591 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7592 ((or (eq gnus-auto-select-next
'quietly
)
7593 (and (eq gnus-auto-select-next
'slightly-quietly
)
7595 (and (eq gnus-auto-select-next
'almost-quietly
)
7596 (gnus-summary-last-article-p)))
7598 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7600 (gnus-message 7 "No more%s articles (%s)..."
7601 (if unread
" unread" "")
7602 (if group
(concat "selecting " group
)
7604 (gnus-summary-next-group nil group backward
)))
7606 (when (gnus-key-press-event-p last-input-event
)
7607 (gnus-summary-walk-group-buffer
7608 gnus-newsgroup-name cmd unread backward point
))))))))
7610 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7611 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7612 (?\C-p
(gnus-group-prev-unread-group 1))))
7613 (cursor-in-echo-area t
)
7614 keve key group ended prompt
)
7615 (with-current-buffer gnus-group-buffer
7618 (if (eq gnus-keep-same-level
'best
)
7619 (gnus-summary-best-group gnus-newsgroup-name
)
7620 (gnus-summary-search-group backward gnus-keep-same-level
))))
7624 "No more%s articles%s " (if unread
" unread" "")
7626 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7627 (format " (Type %s for %s [%s])"
7628 (single-key-description cmd
)
7629 (gnus-group-decoded-name group
)
7630 (gnus-group-unread group
))
7631 (format " (Type %s to exit %s)"
7632 (single-key-description cmd
)
7633 (gnus-group-decoded-name gnus-newsgroup-name
)))))
7634 ;; Confirm auto selection.
7635 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7638 ((assq key keystrokes
)
7639 (let ((obuf (current-buffer)))
7640 (switch-to-buffer gnus-group-buffer
)
7642 (gnus-group-jump-to-group group
))
7643 (eval (cadr (assq key keystrokes
)))
7644 (setq group
(gnus-group-group-name))
7645 (switch-to-buffer obuf
))
7649 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7651 (gnus-summary-next-group nil group backward
)))
7653 (push (cdr keve
) unread-command-events
))))))
7655 (defun gnus-summary-next-unread-article ()
7656 "Select unread article after current one."
7658 (gnus-summary-next-article
7659 (or (not (eq gnus-summary-goto-unread
'never
))
7660 (gnus-summary-last-article-p (gnus-summary-article-number)))
7661 (and gnus-auto-select-same
7662 (gnus-summary-article-subject))))
7664 (defun gnus-summary-prev-article (&optional unread subject
)
7665 "Select the article before the current one.
7666 If UNREAD is non-nil, only unread articles are selected."
7668 (gnus-summary-next-article unread subject t
))
7670 (defun gnus-summary-prev-unread-article ()
7671 "Select unread article before current one."
7673 (gnus-summary-prev-article
7674 (or (not (eq gnus-summary-goto-unread
'never
))
7675 (gnus-summary-first-article-p (gnus-summary-article-number)))
7676 (and gnus-auto-select-same
7677 (gnus-summary-article-subject))))
7679 (defun gnus-summary-next-page (&optional lines circular stop
)
7680 "Show next page of the selected article.
7681 If at the end of the current article, select the next article.
7682 LINES says how many lines should be scrolled up.
7684 If CIRCULAR is non-nil, go to the start of the article instead of
7685 selecting the next article when reaching the end of the current
7688 If STOP is non-nil, just stop when reaching the end of the message.
7690 Also see the variable `gnus-article-skip-boring'."
7692 (setq gnus-summary-buffer
(current-buffer))
7693 (gnus-set-global-variables)
7694 (let ((article (gnus-summary-article-number))
7695 (article-window (get-buffer-window gnus-article-buffer t
))
7697 ;; If the buffer is empty, we have no article.
7699 (error "No article to select"))
7700 (gnus-configure-windows 'article
)
7701 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7702 (if (and (eq gnus-summary-goto-unread
'never
)
7703 (not (gnus-summary-last-article-p article
)))
7704 (gnus-summary-next-article)
7705 (gnus-summary-next-unread-article))
7706 (if (or (null gnus-current-article
)
7707 (null gnus-article-current
)
7708 (/= article
(cdr gnus-article-current
))
7709 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7710 ;; Selected subject is different from current article's.
7711 (gnus-summary-display-article article
)
7712 (when article-window
7713 (gnus-eval-in-buffer-window gnus-article-buffer
7714 (setq endp
(or (gnus-article-next-page lines
)
7715 (gnus-article-only-boring-p))))
7718 (gnus-message 3 "End of message"))
7720 (gnus-summary-beginning-of-article))
7722 (gnus-message 3 "End of message"))
7724 (if (and (eq gnus-summary-goto-unread
'never
)
7725 (not (gnus-summary-last-article-p article
)))
7726 (gnus-summary-next-article)
7727 (gnus-summary-next-unread-article))))))))
7728 (gnus-summary-recenter)
7729 (gnus-summary-position-point)))
7731 (defun gnus-summary-prev-page (&optional lines move
)
7732 "Show previous page of selected article.
7733 Argument LINES specifies lines to be scrolled down.
7734 If MOVE, move to the previous unread article if point is at
7735 the beginning of the buffer."
7737 (let ((article (gnus-summary-article-number))
7738 (article-window (get-buffer-window gnus-article-buffer t
))
7740 (gnus-configure-windows 'article
)
7741 (if (or (null gnus-current-article
)
7742 (null gnus-article-current
)
7743 (/= article
(cdr gnus-article-current
))
7744 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7745 ;; Selected subject is different from current article's.
7746 (gnus-summary-display-article article
)
7747 (gnus-summary-recenter)
7748 (when article-window
7749 (gnus-eval-in-buffer-window gnus-article-buffer
7750 (setq endp
(gnus-article-prev-page lines
)))
7751 (when (and move endp
)
7753 (gnus-message 3 "Beginning of message"))
7755 (if (and (eq gnus-summary-goto-unread
'never
)
7756 (not (gnus-summary-first-article-p article
)))
7757 (gnus-summary-prev-article)
7758 (gnus-summary-prev-unread-article))))))))
7759 (gnus-summary-position-point))
7761 (defun gnus-summary-prev-page-or-article (&optional lines
)
7762 "Show previous page of selected article.
7763 Argument LINES specifies lines to be scrolled down.
7764 If at the beginning of the article, go to the next article."
7766 (gnus-summary-prev-page lines t
))
7768 (defun gnus-summary-scroll-up (lines)
7769 "Scroll up (or down) one line current article.
7770 Argument LINES specifies lines to be scrolled up (or down if negative)."
7772 (gnus-configure-windows 'article
)
7773 (gnus-summary-show-thread)
7774 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7775 (gnus-eval-in-buffer-window gnus-article-buffer
7777 (when (gnus-article-next-page lines
)
7778 (gnus-message 3 "End of message")))
7780 (gnus-article-prev-page (- lines
))))))
7781 (gnus-summary-recenter)
7782 (gnus-summary-position-point))
7784 (defun gnus-summary-scroll-down (lines)
7785 "Scroll down (or up) one line current article.
7786 Argument LINES specifies lines to be scrolled down (or up if negative)."
7788 (gnus-summary-scroll-up (- lines
)))
7790 (defun gnus-summary-next-same-subject ()
7791 "Select next article which has the same subject as current one."
7793 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7795 (defun gnus-summary-prev-same-subject ()
7796 "Select previous article which has the same subject as current one."
7798 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7800 (defun gnus-summary-next-unread-same-subject ()
7801 "Select next unread article which has the same subject as current one."
7803 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7805 (defun gnus-summary-prev-unread-same-subject ()
7806 "Select previous unread article which has the same subject as current one."
7808 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7810 (defun gnus-summary-first-unread-article ()
7811 "Select the first unread article.
7812 Return nil if there are no unread articles."
7815 (when (gnus-summary-first-subject t
)
7816 (gnus-summary-show-thread)
7817 (gnus-summary-first-subject t
)
7818 (gnus-summary-display-article (gnus-summary-article-number)))
7819 (gnus-summary-position-point)))
7821 (defun gnus-summary-first-unread-subject ()
7822 "Place the point on the subject line of the first unread article.
7823 Return nil if there are no unread articles."
7826 (when (gnus-summary-first-subject t
)
7827 (gnus-summary-show-thread)
7828 (gnus-summary-first-subject t
))
7829 (gnus-summary-position-point)))
7831 (defun gnus-summary-first-unseen-subject ()
7832 "Place the point on the subject line of the first unseen article.
7833 Return nil if there are no unseen articles."
7836 (when (gnus-summary-first-subject nil nil t
)
7837 (gnus-summary-show-thread)
7838 (gnus-summary-first-subject nil nil t
))
7839 (gnus-summary-position-point)))
7841 (defun gnus-summary-first-unseen-or-unread-subject ()
7842 "Place the point on the subject line of the first unseen article or,
7843 if all article have been seen, on the subject line of the first unread
7847 (unless (when (gnus-summary-first-subject nil nil t
)
7848 (gnus-summary-show-thread)
7849 (gnus-summary-first-subject nil nil t
))
7850 (when (gnus-summary-first-subject t
)
7851 (gnus-summary-show-thread)
7852 (gnus-summary-first-subject t
)))
7853 (gnus-summary-position-point)))
7855 (defun gnus-summary-first-article ()
7856 "Select the first article.
7857 Return nil if there are no articles."
7860 (when (gnus-summary-first-subject)
7861 (gnus-summary-show-thread)
7862 (gnus-summary-first-subject)
7863 (gnus-summary-display-article (gnus-summary-article-number)))
7864 (gnus-summary-position-point)))
7866 (defun gnus-summary-best-unread-article (&optional arg
)
7867 "Select the unread article with the highest score.
7868 If given a prefix argument, select the next unread article that has a
7869 score higher than the default score."
7871 (let ((article (if arg
7872 (gnus-summary-better-unread-subject)
7873 (gnus-summary-best-unread-subject))))
7875 (gnus-summary-goto-article article
)
7876 (error "No unread articles"))))
7878 (defun gnus-summary-best-unread-subject ()
7879 "Select the unread subject with the highest score."
7881 (let ((best -
1000000)
7882 (data gnus-newsgroup-data
)
7885 (and (gnus-data-unread-p (car data
))
7887 (gnus-summary-article-score (gnus-data-number (car data
))))
7890 article
(gnus-data-number (car data
))))
7891 (setq data
(cdr data
)))
7893 (gnus-summary-goto-subject article
))
7894 (gnus-summary-position-point)
7897 (defun gnus-summary-better-unread-subject ()
7898 "Select the first unread subject that has a score over the default score."
7900 (let ((data gnus-newsgroup-data
)
7902 (while (and (setq article
(gnus-data-number (car data
)))
7903 (or (gnus-data-read-p (car data
))
7904 (not (> (gnus-summary-article-score article
)
7905 gnus-summary-default-score
))))
7906 (setq data
(cdr data
)))
7908 (gnus-summary-goto-subject article
))
7909 (gnus-summary-position-point)
7912 (defun gnus-summary-last-subject ()
7913 "Go to the last displayed subject line in the group."
7914 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7916 (gnus-summary-goto-subject article
))))
7918 (defun gnus-summary-goto-article (article &optional all-headers force
)
7919 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7920 If ALL-HEADERS is non-nil, no header lines are hidden.
7921 If FORCE, go to the article even if it isn't displayed. If FORCE
7922 is a number, it is the line the article is to be displayed on."
7926 "Article number or Message-ID: "
7927 (mapcar (lambda (number) (list (int-to-string number
)))
7928 gnus-newsgroup-limit
))
7932 (if (and (stringp article
)
7933 (string-match "@\\|%40" article
))
7934 (gnus-summary-refer-article article
)
7935 (when (stringp article
)
7936 (setq article
(string-to-number article
)))
7937 (if (gnus-summary-goto-subject article force
)
7938 (gnus-summary-display-article article all-headers
)
7939 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
7940 (gnus-summary-position-point)))
7942 (defun gnus-summary-goto-last-article ()
7943 "Go to the previously read article."
7946 (when gnus-last-article
7947 (gnus-summary-goto-article gnus-last-article nil t
))
7948 (gnus-summary-position-point)))
7950 (defun gnus-summary-pop-article (number)
7951 "Pop one article off the history and go to the previous.
7952 NUMBER articles will be popped off."
7955 (setq gnus-newsgroup-history
7956 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
7958 (gnus-summary-goto-article (car to
) nil t
)
7959 (error "Article history empty")))
7960 (gnus-summary-position-point))
7962 ;; Summary commands and functions for limiting the summary buffer.
7964 (defun gnus-summary-limit-to-articles (n)
7965 "Limit the summary buffer to the next N articles.
7966 If not given a prefix, use the process marked articles instead."
7969 (let ((articles (gnus-summary-work-articles n
)))
7970 (setq gnus-newsgroup-processable nil
)
7971 (gnus-summary-limit articles
))
7972 (gnus-summary-position-point)))
7974 (defun gnus-summary-pop-limit (&optional total
)
7975 "Restore the previous limit.
7976 If given a prefix, remove all limits."
7979 (setq gnus-newsgroup-limits
7980 (list (mapcar (lambda (h) (mail-header-number h
))
7981 gnus-newsgroup-headers
))))
7982 (unless gnus-newsgroup-limits
7983 (error "No limit to pop"))
7985 (gnus-summary-limit nil
'pop
)
7986 (gnus-summary-position-point)))
7988 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
7989 "Limit the summary buffer to articles that have subjects that match a regexp.
7990 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7992 (list (read-string (if current-prefix-arg
7993 "Exclude subject (regexp): "
7994 "Limit to subject (regexp): "))
7995 nil current-prefix-arg
))
7997 (setq header
"subject"))
7998 (when (not (equal "" subject
))
8000 (let ((articles (gnus-summary-find-matching
8001 (or header
"subject") subject
'all nil nil
8004 (error "Found no matches for \"%s\"" subject
))
8005 (gnus-summary-limit articles
))
8006 (gnus-summary-position-point))))
8008 (defun gnus-summary-limit-to-author (from &optional not-matching
)
8009 "Limit the summary buffer to articles that have authors that match a regexp.
8010 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8012 (list (read-string (if current-prefix-arg
8013 "Exclude author (regexp): "
8014 "Limit to author (regexp): "))
8015 current-prefix-arg
))
8016 (gnus-summary-limit-to-subject from
"from" not-matching
))
8018 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching
)
8019 "Limit the summary buffer to articles with the given RECIPIENT.
8021 If NOT-MATCHING, exclude RECIPIENT.
8023 To and Cc headers are checked. You need to include them in
8024 `nnmail-extra-headers'."
8025 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8027 (list (read-string (format "%s recipient (regexp): "
8028 (if current-prefix-arg
"Exclude" "Limit to")))
8029 current-prefix-arg
))
8030 (when (not (equal "" recipient
))
8032 (if (memq 'To nnmail-extra-headers
)
8033 (gnus-summary-find-matching
8034 (cons 'extra
'To
) recipient
'all nil nil
8037 1 "`To' isn't present in `nnmail-extra-headers'")
8041 (if (memq 'Cc nnmail-extra-headers
)
8042 (gnus-summary-find-matching
8043 (cons 'extra
'Cc
) recipient
'all nil nil
8046 1 "`Cc' isn't present in `nnmail-extra-headers'")
8051 ;; We need the numbers that are in both lists:
8053 (and (memq a to
) a
))
8057 (error "Found no matches for \"%s\"" recipient
))
8058 (gnus-summary-limit articles
))
8059 (gnus-summary-position-point))))
8061 (defun gnus-summary-limit-to-address (address &optional not-matching
)
8062 "Limit the summary buffer to articles with the given ADDRESS.
8064 If NOT-MATCHING, exclude ADDRESS.
8066 To, Cc and From headers are checked. You need to include `To' and `Cc'
8067 in `nnmail-extra-headers'."
8069 (list (read-string (format "%s address (regexp): "
8070 (if current-prefix-arg
"Exclude" "Limit to")))
8071 current-prefix-arg
))
8072 (when (not (equal "" address
))
8074 (if (memq 'To nnmail-extra-headers
)
8075 (gnus-summary-find-matching
8076 (cons 'extra
'To
) address
'all nil nil
8079 1 "`To' isn't present in `nnmail-extra-headers'")
8083 (if (memq 'Cc nnmail-extra-headers
)
8084 (gnus-summary-find-matching
8085 (cons 'extra
'Cc
) address
'all nil nil
8088 1 "`Cc' isn't present in `nnmail-extra-headers'")
8092 (gnus-summary-find-matching "from" address
8093 'all nil nil not-matching
))
8096 ;; We need the numbers that are in all lists:
8100 (mapcar (lambda (a) (car (memq a from
))) to
))
8102 (mapcar (lambda (a) (car (memq a from
))) cc
)
8103 (mapcar (lambda (a) (car (memq a from
)))
8104 (mapcar (lambda (a) (car (memq a to
)))
8106 (nconc (if (eq to t
) nil to
)
8107 (if (eq cc t
) nil cc
)
8110 (error "Found no matches for \"%s\"" address
))
8111 (gnus-summary-limit articles
))
8112 (gnus-summary-position-point))))
8114 (defun gnus-summary-limit-strange-charsets-predicate (header)
8115 (let ((string (concat (mail-header-subject header
)
8116 (mail-header-from header
)))
8118 (dotimes (i (1- (length string
)))
8119 (setq charset
(format "%s" (char-charset (aref string
(1+ i
)))))
8120 (when (string-match "unicode\\|big\\|japanese" charset
)
8124 (defun gnus-summary-limit-to-predicate (predicate)
8125 "Limit to articles where PREDICATE returns non-nil.
8126 PREDICATE will be called with the header structures of the
8128 (let ((articles nil
)
8129 (case-fold-search t
))
8130 (dolist (header gnus-newsgroup-headers
)
8131 (when (funcall predicate header
)
8132 (push (mail-header-number header
) articles
)))
8133 (gnus-summary-limit (nreverse articles
))))
8135 (defun gnus-summary-limit-to-age (age &optional younger-p
)
8136 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8137 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8138 articles that are younger than AGE days."
8140 (let ((younger current-prefix-arg
)
8143 (while (not days-got
)
8144 (setq days
(if younger
8145 (read-string "Limit to articles younger than (in days, older when negative): ")
8147 "Limit to articles older than (in days, younger when negative): ")))
8148 (when (> (length days
) 0)
8149 (setq days
(read days
)))
8154 (setq younger
(not younger
))
8155 (setq days
(* days -
1))))
8156 (message "Please enter a number.")
8158 (list days younger
)))
8160 (let ((data gnus-newsgroup-data
)
8161 (cutoff (days-to-time age
))
8162 articles d date is-younger
)
8163 (while (setq d
(pop data
))
8164 (when (and (vectorp (gnus-data-header d
))
8165 (setq date
(mail-header-date (gnus-data-header d
))))
8166 (setq is-younger
(time-less-p
8167 (time-since (condition-case ()
8174 (push (gnus-data-number d
) articles
))))
8175 (gnus-summary-limit (nreverse articles
)))
8176 (gnus-summary-position-point)))
8178 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
8179 "Limit the summary buffer to articles that match an 'extra' header."
8183 (gnus-completing-read-with-default
8184 (symbol-name (car gnus-extra-headers
))
8185 (if current-prefix-arg
8186 "Exclude extra header"
8187 "Limit extra header")
8189 (cons (symbol-name x
) x
))
8194 (read-string (format "%s header %s (regexp): "
8195 (if current-prefix-arg
"Exclude" "Limit to")
8197 current-prefix-arg
)))
8198 (when (not (equal "" regexp
))
8200 (let ((articles (gnus-summary-find-matching
8201 (cons 'extra header
) regexp
'all nil nil
8204 (error "Found no matches for \"%s\"" regexp
))
8205 (gnus-summary-limit articles
))
8206 (gnus-summary-position-point))))
8208 (defun gnus-summary-limit-to-display-predicate ()
8209 "Limit the summary buffer to the predicated in the `display' group parameter."
8211 (unless gnus-newsgroup-display
8212 (error "There is no `display' group parameter"))
8214 (dolist (number gnus-newsgroup-articles
)
8215 (when (funcall gnus-newsgroup-display
)
8216 (push number articles
)))
8217 (gnus-summary-limit articles
))
8218 (gnus-summary-position-point))
8220 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
8222 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
8224 (defun gnus-summary-limit-to-unread (&optional all
)
8225 "Limit the summary buffer to articles that are not marked as read.
8226 If ALL is non-nil, limit strictly to unread articles."
8229 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
8230 (gnus-summary-limit-to-marks
8231 ;; Concat all the marks that say that an article is read and have
8233 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8234 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8235 gnus-low-score-mark gnus-expirable-mark
8236 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8237 gnus-duplicate-mark gnus-souped-mark
)
8240 (defun gnus-summary-limit-to-headers (match &optional reverse
)
8241 "Limit the summary buffer to articles that have headers that match MATCH.
8242 If REVERSE (the prefix), limit to articles that don't match."
8243 (interactive "sMatch headers (regexp): \nP")
8244 (gnus-summary-limit-to-bodies match reverse t
))
8246 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp
)
8247 "Limit the summary buffer to articles that have bodies that match MATCH.
8248 If REVERSE (the prefix), limit to articles that don't match."
8249 (interactive "sMatch body (regexp): \nP")
8250 (let ((articles nil
)
8251 (gnus-select-article-hook nil
) ;Disable hook.
8252 (gnus-article-prepare-hook nil
)
8253 (gnus-use-article-prefetch nil
)
8254 (gnus-keep-backlog nil
)
8255 (gnus-break-pages nil
)
8256 (gnus-summary-display-arrow nil
)
8257 (gnus-updated-mode-lines nil
)
8258 (gnus-auto-center-summary nil
)
8259 (gnus-display-mime-function nil
))
8260 (dolist (data gnus-newsgroup-data
)
8261 (let (gnus-mark-article-hook)
8262 (gnus-summary-select-article t t nil
(gnus-data-number data
)))
8264 (set-buffer gnus-article-buffer
)
8266 (let* ((case-fold-search t
)
8268 (re-search-backward match nil t
)
8269 (re-search-forward match nil t
))))
8270 (when (or (and found
8274 (push (gnus-data-number data
) articles
)))))
8276 (message "No messages matched")
8277 (gnus-summary-limit articles
)))
8278 (gnus-summary-position-point))
8280 (defun gnus-summary-limit-to-singletons (&optional threadsp
)
8281 "Limit the summary buffer to articles that aren't part on any thread.
8282 If THREADSP (the prefix), limit to articles that are in threads."
8284 (let ((articles nil
)
8287 (dolist (thread gnus-newsgroup-threads
)
8288 (if (stringp (car thread
))
8289 (dolist (thread (cdr thread
))
8290 (push thread threads
))
8291 (push thread threads
)))
8292 (dolist (thread threads
)
8293 (setq thread-articles
(gnus-articles-in-thread thread
))
8294 (when (or (and threadsp
8295 (> (length thread-articles
) 1))
8297 (= (length thread-articles
) 1)))
8298 (setq articles
(nconc thread-articles articles
))))
8300 (message "No messages matched")
8301 (gnus-summary-limit articles
))
8302 (gnus-summary-position-point)))
8304 (defun gnus-summary-limit-to-replied (&optional unreplied
)
8305 "Limit the summary buffer to replied articles.
8306 If UNREPLIED (the prefix), limit to unreplied articles."
8310 (gnus-set-difference gnus-newsgroup-articles
8311 gnus-newsgroup-replied
))
8312 (gnus-summary-limit gnus-newsgroup-replied
))
8313 (gnus-summary-position-point))
8315 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
8316 (make-obsolete 'gnus-summary-delete-marked-with
8317 'gnus-summary-limit-exclude-marks
)
8319 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
8320 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8321 If REVERSE, limit the summary buffer to articles that are marked
8322 with MARKS. MARKS can either be a string of marks or a list of marks.
8323 Returns how many articles were removed."
8324 (interactive "sMarks: ")
8325 (gnus-summary-limit-to-marks marks t
))
8327 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
8328 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8329 If REVERSE (the prefix), limit the summary buffer to articles that are
8330 not marked with MARKS. MARKS can either be a string of marks or a
8332 Returns how many articles were removed."
8333 (interactive "sMarks: \nP")
8335 (let ((data gnus-newsgroup-data
)
8336 (marks (if (listp marks
) marks
8337 (append marks nil
))) ; Transform to list.
8340 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
8341 (memq (gnus-data-mark (car data
)) marks
))
8342 (push (gnus-data-number (car data
)) articles
))
8343 (setq data
(cdr data
)))
8344 (gnus-summary-limit articles
))
8345 (gnus-summary-position-point)))
8347 (defun gnus-summary-limit-to-score (score)
8348 "Limit to articles with score at or above SCORE."
8349 (interactive "NLimit to articles with score of at least: ")
8350 (let ((data gnus-newsgroup-data
)
8353 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
8355 (push (gnus-data-number (car data
)) articles
))
8356 (setq data
(cdr data
)))
8358 (gnus-summary-limit articles
)
8359 (gnus-summary-position-point))))
8361 (defun gnus-summary-limit-to-unseen ()
8362 "Limit to unseen articles."
8365 (gnus-summary-limit gnus-newsgroup-unseen
)
8366 (gnus-summary-position-point)))
8368 (defun gnus-summary-limit-include-thread (id)
8369 "Display all the hidden articles that is in the thread with ID in it.
8370 When called interactively, ID is the Message-ID of the current
8372 (interactive (list (mail-header-id (gnus-summary-article-header))))
8373 (let ((articles (gnus-articles-in-thread
8374 (gnus-id-to-thread (gnus-root-id id
)))))
8376 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8377 (gnus-summary-limit-include-matching-articles
8379 (regexp-quote (gnus-simplify-subject-re
8380 (mail-header-subject (gnus-id-to-header id
)))))
8381 (gnus-summary-position-point))))
8383 (defun gnus-summary-limit-include-matching-articles (header regexp
)
8384 "Display all the hidden articles that have HEADERs that match REGEXP."
8385 (interactive (list (read-string "Match on header: ")
8386 (read-string "Regexp: ")))
8387 (let ((articles (gnus-find-matching-articles header regexp
)))
8389 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8390 (gnus-summary-position-point))))
8392 (defun gnus-summary-insert-dormant-articles ()
8393 "Insert all the dormant articles for this group into the current buffer."
8395 (let ((gnus-verbose (max 6 gnus-verbose
)))
8396 (if (not gnus-newsgroup-dormant
)
8397 (gnus-message 3 "No dormant articles for this group")
8398 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
8400 (defun gnus-summary-insert-ticked-articles ()
8401 "Insert ticked articles for this group into the current buffer."
8403 (let ((gnus-verbose (max 6 gnus-verbose
)))
8404 (if (not gnus-newsgroup-marked
)
8405 (gnus-message 3 "No ticked articles for this group")
8406 (gnus-summary-goto-subjects gnus-newsgroup-marked
))))
8408 (defun gnus-summary-limit-include-dormant ()
8409 "Display all the hidden articles that are marked as dormant.
8410 Note that this command only works on a subset of the articles currently
8411 fetched for this group."
8413 (unless gnus-newsgroup-dormant
8414 (error "There are no dormant articles in this group"))
8416 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
8417 (gnus-summary-position-point)))
8419 (defun gnus-summary-limit-exclude-dormant ()
8420 "Hide all dormant articles."
8423 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
8424 (gnus-summary-position-point)))
8426 (defun gnus-summary-limit-exclude-childless-dormant ()
8427 "Hide all dormant articles that have no children."
8429 (let ((data (gnus-data-list t
))
8430 articles d children
)
8431 ;; Find all articles that are either not dormant or have
8433 (while (setq d
(pop data
))
8434 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
8436 (gnus-article-children (gnus-data-number d
)))
8439 (when (memq (car children
) articles
)
8444 (push (gnus-data-number d
) articles
)))
8447 (gnus-summary-limit articles
)
8448 (gnus-summary-position-point))))
8450 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
8451 "Mark all unread excluded articles as read.
8452 If ALL, mark even excluded ticked and dormants as read."
8454 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
8455 (let ((articles (gnus-sorted-ndifference
8457 (mapcar (lambda (h) (mail-header-number h
))
8458 gnus-newsgroup-headers
)
8460 gnus-newsgroup-limit
))
8462 (setq gnus-newsgroup-unreads
8463 (gnus-sorted-intersection gnus-newsgroup-unreads
8464 gnus-newsgroup-limit
))
8466 (setq gnus-newsgroup-dormant nil
8467 gnus-newsgroup-marked nil
8468 gnus-newsgroup-reads
8470 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
8471 gnus-newsgroup-reads
))
8472 (while (setq article
(pop articles
))
8473 (unless (or (memq article gnus-newsgroup-dormant
)
8474 (memq article gnus-newsgroup-marked
))
8475 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
8477 (defun gnus-summary-limit (articles &optional pop
)
8479 ;; We pop the previous limit off the stack and use that.
8480 (setq articles
(car gnus-newsgroup-limits
)
8481 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
8482 ;; We use the new limit, so we push the old limit on the stack.
8483 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
8485 (setq gnus-newsgroup-limit articles
)
8486 (let ((total (length gnus-newsgroup-data
))
8487 (data (gnus-data-find-list (gnus-summary-article-number)))
8488 (gnus-summary-mark-below nil
) ; Inhibit this.
8490 ;; This will do all the work of generating the new summary buffer
8491 ;; according to the new limit.
8492 (gnus-summary-prepare)
8493 ;; Hide any threads, possibly.
8494 (gnus-summary-maybe-hide-threads)
8495 ;; Try to return to the article you were at, or one in the
8498 ;; We try to find some article after the current one.
8500 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
8503 (setq data
(cdr data
))))
8505 ;; If there is no data, that means that we were after the last
8506 ;; article. The same goes when we can't find any articles
8507 ;; after the current one.
8508 (goto-char (point-max))
8509 (gnus-summary-find-prev))
8510 (gnus-set-mode-line 'summary
)
8511 ;; We return how many articles were removed from the summary
8512 ;; buffer as a result of the new limit.
8513 (- total
(length gnus-newsgroup-data
))))
8515 (defsubst gnus-invisible-cut-children
(threads)
8518 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
8523 (defsubst gnus-cut-thread
(thread)
8524 "Go forwards in the thread until we find an article that we want to display."
8525 (when (or (eq gnus-fetch-old-headers
'some
)
8526 (eq gnus-fetch-old-headers
'invisible
)
8527 (numberp gnus-fetch-old-headers
)
8528 (eq gnus-build-sparse-threads
'some
)
8529 (eq gnus-build-sparse-threads
'more
))
8530 ;; Deal with old-fetched headers and sparse threads.
8534 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
8535 (gnus-summary-article-ancient-p
8536 (mail-header-number (car thread
))))
8537 (if (or (<= (length (cdr thread
)) 1)
8538 (eq gnus-fetch-old-headers
'invisible
))
8539 (setq gnus-newsgroup-limit
8540 (delq (mail-header-number (car thread
))
8541 gnus-newsgroup-limit
)
8542 thread
(cadr thread
))
8543 (when (gnus-invisible-cut-children (cdr thread
))
8544 (let ((th (cdr thread
)))
8546 (if (memq (mail-header-number (caar th
))
8547 gnus-newsgroup-limit
)
8548 (setq thread
(car th
)
8550 (setq th
(cdr th
))))))))))
8553 (defun gnus-cut-threads (threads)
8554 "Cut off all uninteresting articles from the beginning of THREADS."
8555 (when (or (eq gnus-fetch-old-headers
'some
)
8556 (eq gnus-fetch-old-headers
'invisible
)
8557 (numberp gnus-fetch-old-headers
)
8558 (eq gnus-build-sparse-threads
'some
)
8559 (eq gnus-build-sparse-threads
'more
))
8562 (setcar th
(gnus-cut-thread (car th
)))
8563 (setq th
(cdr th
)))))
8564 ;; Remove nixed out threads.
8567 (defun gnus-summary-initial-limit (&optional show-if-empty
)
8568 "Figure out what the initial limit is supposed to be on group entry.
8569 This entails weeding out unwanted dormants, low-scored articles,
8570 fetch-old-headers verbiage, and so on."
8571 ;; Most groups have nothing to remove.
8572 (if (or gnus-inhibit-limiting
8573 (and (null gnus-newsgroup-dormant
)
8574 (eq gnus-newsgroup-display
'gnus-not-ignore
)
8575 (not (eq gnus-fetch-old-headers
'some
))
8576 (not (numberp gnus-fetch-old-headers
))
8577 (not (eq gnus-fetch-old-headers
'invisible
))
8578 (null gnus-summary-expunge-below
)
8579 (not (eq gnus-build-sparse-threads
'some
))
8580 (not (eq gnus-build-sparse-threads
'more
))
8581 (null gnus-thread-expunge-below
)
8582 (not gnus-use-nocem
)))
8584 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
8585 (setq gnus-newsgroup-limit nil
)
8588 (unless (car (symbol-value node
))
8589 ;; These threads have no parents -- they are roots.
8590 (let ((nodes (cdr (symbol-value node
)))
8593 (if (and gnus-thread-expunge-below
8594 (< (gnus-thread-total-score (car nodes
))
8595 gnus-thread-expunge-below
))
8596 (gnus-expunge-thread (pop nodes
))
8597 (setq thread
(pop nodes
))
8598 (gnus-summary-limit-children thread
))))))
8599 gnus-newsgroup-dependencies
)
8600 ;; If this limitation resulted in an empty group, we might
8601 ;; pop the previous limit and use it instead.
8602 (when (and (not gnus-newsgroup-limit
)
8604 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
8605 gnus-newsgroup-limit
))
8607 (defun gnus-summary-limit-children (thread)
8608 "Return 1 if this subthread is visible and 0 if it is not."
8609 ;; First we get the number of visible children to this thread. This
8610 ;; is done by recursing down the thread using this function, so this
8611 ;; will really go down to a leaf article first, before slowly
8612 ;; working its way up towards the root.
8614 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth
))
8617 (apply '+ (mapcar 'gnus-summary-limit-children
8620 (number (mail-header-number (car thread
)))
8623 (not (memq number gnus-newsgroup-marked
))
8625 ;; If this article is dormant and has absolutely no visible
8626 ;; children, then this article isn't visible.
8627 (and (memq number gnus-newsgroup-dormant
)
8629 ;; If this is "fetch-old-headered" and there is no
8630 ;; visible children, then we don't want this article.
8631 (and (or (eq gnus-fetch-old-headers
'some
)
8632 (numberp gnus-fetch-old-headers
))
8633 (gnus-summary-article-ancient-p number
)
8635 ;; If this is "fetch-old-headered" and `invisible', then
8636 ;; we don't want this article.
8637 (and (eq gnus-fetch-old-headers
'invisible
)
8638 (gnus-summary-article-ancient-p number
))
8639 ;; If this is a sparsely inserted article with no children,
8640 ;; we don't want it.
8641 (and (eq gnus-build-sparse-threads
'some
)
8642 (gnus-summary-article-sparse-p number
)
8644 ;; If we use expunging, and this article is really
8645 ;; low-scored, then we don't want this article.
8646 (when (and gnus-summary-expunge-below
8648 (or (cdr (assq number gnus-newsgroup-scored
))
8649 gnus-summary-default-score
))
8650 gnus-summary-expunge-below
))
8651 ;; We increase the expunge-tally here, but that has
8652 ;; nothing to do with the limits, really.
8653 (incf gnus-newsgroup-expunged-tally
)
8654 ;; We also mark as read here, if that's wanted.
8655 (when (and gnus-summary-mark-below
8656 (< score gnus-summary-mark-below
))
8657 (setq gnus-newsgroup-unreads
8658 (delq number gnus-newsgroup-unreads
))
8659 (if gnus-newsgroup-auto-expire
8660 (push number gnus-newsgroup-expirable
)
8661 (push (cons number gnus-low-score-mark
)
8662 gnus-newsgroup-reads
)))
8664 ;; Do the `display' group parameter.
8665 (and gnus-newsgroup-display
8666 (not (funcall gnus-newsgroup-display
)))
8667 ;; Check NoCeM things.
8668 (when (and gnus-use-nocem
8669 (gnus-nocem-unwanted-article-p
8670 (mail-header-id (car thread
))))
8671 (setq gnus-newsgroup-unreads
8672 (delq number gnus-newsgroup-unreads
))
8674 ;; Nope, invisible article.
8676 ;; Ok, this article is to be visible, so we add it to the limit
8678 (push number gnus-newsgroup-limit
)
8681 (defun gnus-expunge-thread (thread)
8682 "Mark all articles in THREAD as read."
8683 (let* ((number (mail-header-number (car thread
))))
8684 (incf gnus-newsgroup-expunged-tally
)
8685 ;; We also mark as read here, if that's wanted.
8686 (setq gnus-newsgroup-unreads
8687 (delq number gnus-newsgroup-unreads
))
8688 (if gnus-newsgroup-auto-expire
8689 (push number gnus-newsgroup-expirable
)
8690 (push (cons number gnus-low-score-mark
)
8691 gnus-newsgroup-reads
)))
8692 ;; Go recursively through all subthreads.
8693 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8695 ;; Summary article oriented commands
8697 (defun gnus-summary-refer-parent-article (n)
8698 "Refer parent article N times.
8699 If N is negative, go to ancestor -N instead.
8700 The difference between N and the number of articles fetched is returned."
8704 (when (not (natnump n
))
8709 (setq header
(gnus-summary-article-header))
8710 (if (and (eq (mail-header-number header
)
8711 (cdr gnus-article-current
))
8712 (equal gnus-newsgroup-name
8713 (car gnus-article-current
)))
8714 ;; If we try to find the parent of the currently
8715 ;; displayed article, then we take a look at the actual
8716 ;; References header, since this is slightly more
8717 ;; reliable than the References field we got from the
8719 (with-current-buffer gnus-original-article-buffer
8720 (nnheader-narrow-to-headers)
8721 (unless (setq ref
(message-fetch-field "references"))
8722 (when (setq ref
(message-fetch-field "in-reply-to"))
8723 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8726 ;; It's not the current article, so we take a bet on
8727 ;; the value we got from the server.
8728 (mail-header-references header
)))
8730 (not (equal ref
"")))
8731 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8732 (gnus-message 1 "Couldn't find parent"))
8733 (gnus-message 1 "No references in article %d"
8734 (gnus-summary-article-number))
8737 (gnus-summary-position-point)
8740 (defun gnus-summary-refer-references ()
8741 "Fetch all articles mentioned in the References header.
8742 Return the number of articles fetched."
8744 (let ((ref (mail-header-references (gnus-summary-article-header)))
8745 (current (gnus-summary-article-number))
8749 (error "No References in the current article")
8750 ;; For each Message-ID in the References header...
8751 (while (string-match "<[^>]*>" ref
)
8753 ;; ... fetch that article.
8754 (gnus-summary-refer-article
8755 (prog1 (match-string 0 ref
)
8756 (setq ref
(substring ref
(match-end 0))))))
8757 (gnus-summary-goto-subject current
)
8758 (gnus-summary-position-point)
8761 (defun gnus-summary-refer-thread (&optional limit
)
8762 "Fetch all articles in the current thread.
8763 If LIMIT (the numerical prefix), fetch that many old headers instead
8764 of what's specified by the `gnus-refer-thread-limit' variable."
8766 (let ((id (mail-header-id (gnus-summary-article-header)))
8767 (limit (if limit
(prefix-numeric-value limit
)
8768 gnus-refer-thread-limit
)))
8769 (unless (eq gnus-fetch-old-headers
'invisible
)
8770 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8771 ;; Retrieve the headers and read them in.
8772 (if (eq (if (numberp limit
)
8773 (gnus-retrieve-headers
8775 (+ (mail-header-number
8776 (gnus-summary-article-header))
8778 gnus-newsgroup-end
))
8779 gnus-newsgroup-name
(* limit
2))
8780 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8782 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8783 gnus-newsgroup-name limit
))
8785 (gnus-build-all-threads)
8786 (error "Can't fetch thread from back ends that don't support NOV"))
8787 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8788 (gnus-summary-limit-include-thread id
)))
8790 (defun gnus-summary-refer-article (message-id)
8791 "Fetch an article specified by MESSAGE-ID."
8792 (interactive "sMessage-ID: ")
8793 (when (and (stringp message-id
)
8794 (not (zerop (length message-id
))))
8795 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8796 ;; Construct the correct Message-ID if necessary.
8797 ;; Suggested by tale@pawl.rpi.edu.
8798 (unless (string-match "^<" message-id
)
8799 (setq message-id
(concat "<" message-id
)))
8800 (unless (string-match ">$" message-id
)
8801 (setq message-id
(concat message-id
">")))
8802 ;; People often post MIDs from URLs, so unhex it:
8803 (unless (string-match "@" message-id
)
8804 (setq message-id
(gnus-url-unhex-string message-id
)))
8805 (let* ((header (gnus-id-to-header message-id
))
8807 (gnus-summary-article-sparse-p
8808 (mail-header-number header
))
8809 (memq (mail-header-number header
)
8810 gnus-newsgroup-limit
)))
8813 ;; If the article is present in the buffer we just go to it.
8815 (or (not (gnus-summary-article-sparse-p
8816 (mail-header-number header
)))
8819 (gnus-summary-goto-article
8820 (mail-header-number header
) nil t
)
8822 (gnus-summary-update-article (mail-header-number header
)))))
8824 ;; We fetch the article.
8826 (dolist (gnus-override-method (gnus-refer-article-methods))
8827 (when (and (gnus-check-server gnus-override-method
)
8828 ;; Fetch the header,
8829 (setq number
(gnus-summary-insert-subject message-id
)))
8830 ;; and display the article.
8831 (gnus-summary-select-article nil nil nil number
)
8833 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8835 (defun gnus-refer-article-methods ()
8836 "Return a list of referable methods."
8838 ;; No method, so we default to current and native.
8839 ((null gnus-refer-article-method
)
8840 (list gnus-current-select-method gnus-select-method
))
8842 ((eq 'current gnus-refer-article-method
)
8843 (list gnus-current-select-method
))
8844 ;; List of select methods.
8845 ((not (and (symbolp (car gnus-refer-article-method
))
8846 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8848 (dolist (method gnus-refer-article-method
)
8849 (push (if (eq 'current method
)
8850 gnus-current-select-method
8854 ;; One single select method.
8856 (list gnus-refer-article-method
))))
8858 (defun gnus-summary-edit-parameters ()
8859 "Edit the group parameters of the current group."
8861 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8863 (defun gnus-summary-customize-parameters ()
8864 "Customize the group parameters of the current group."
8866 (gnus-group-customize gnus-newsgroup-name
))
8868 (defun gnus-summary-enter-digest-group (&optional force
)
8869 "Enter an nndoc group based on the current article.
8870 If FORCE, force a digest interpretation. If not, try
8871 to guess what the document format is."
8873 (let ((conf gnus-current-window-configuration
))
8874 (save-window-excursion
8876 (let (gnus-article-prepare-hook
8877 gnus-display-mime-function
8879 (gnus-summary-select-article))))
8880 (setq gnus-current-window-configuration conf
)
8881 (let* ((name (format "%s-%d"
8882 (gnus-group-prefixed-name
8883 gnus-newsgroup-name
(list 'nndoc
""))
8884 (with-current-buffer gnus-summary-buffer
8885 gnus-current-article
)))
8886 (ogroup gnus-newsgroup-name
)
8887 (params (append (gnus-info-params (gnus-get-info ogroup
))
8888 (list (cons 'to-group ogroup
))
8889 (list (cons 'parent-group ogroup
))
8890 (list (cons 'save-article-group ogroup
))))
8891 (case-fold-search t
)
8892 (buf (current-buffer))
8894 (with-current-buffer gnus-original-article-buffer
8895 ;; Have the digest group inherit the main mail address of
8896 ;; the parent article.
8897 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8898 (gnus-fetch-field "from")))
8901 (list (cons 'to-address
8902 (funcall gnus-decode-encoded-address-function
8904 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8905 (insert-buffer-substring gnus-original-article-buffer
)
8906 ;; Remove lines that may lead nndoc to misinterpret the
8909 (goto-char (point-min))
8910 (or (search-forward "\n\n" nil t
) (point)))
8911 (goto-char (point-min))
8912 (delete-matching-lines "^Path:\\|^From ")
8915 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8916 (gnus-newsgroup-ephemeral-ignored-charsets
8917 gnus-newsgroup-ignored-charsets
))
8918 (gnus-group-read-ephemeral-group
8919 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8921 ,(if force
'mbox
'guess
)))
8923 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8925 ;; Make all postings to this group go to the parent group.
8926 (nconc (gnus-info-params (gnus-get-info name
))
8928 ;; Couldn't select this doc group.
8929 (switch-to-buffer buf
)
8930 (gnus-set-global-variables)
8931 (gnus-configure-windows 'summary
)
8932 (gnus-message 3 "Article couldn't be entered?"))
8933 (kill-buffer dig
)))))
8935 (defun gnus-summary-read-document (n)
8936 "Open a new group based on the current article(s).
8937 This will allow you to read digests and other similar
8938 documents as newsgroups.
8939 Obeys the standard process/prefix convention."
8941 (let* ((ogroup gnus-newsgroup-name
)
8942 (params (append (gnus-info-params (gnus-get-info ogroup
))
8943 (list (cons 'to-group ogroup
))))
8944 group egroup groups vgroup
)
8945 (dolist (article (gnus-summary-work-articles n
))
8946 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
8947 (gnus-summary-remove-process-mark article
)
8948 (when (gnus-summary-display-article article
)
8951 (insert-buffer-substring gnus-original-article-buffer
)
8952 ;; Remove some headers that may lead nndoc to make
8954 (message-narrow-to-head)
8955 (goto-char (point-min))
8956 (delete-matching-lines "^Path:\\|^From ")
8959 (gnus-group-read-ephemeral-group
8960 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
8961 (nndoc-article-type guess
))
8964 ;; Make all postings to this group go to the parent group.
8965 (nconc (gnus-info-params (gnus-get-info egroup
))
8967 (push egroup groups
))
8968 ;; Couldn't select this doc group.
8969 (gnus-error 3 "Article couldn't be entered"))))))
8970 ;; Now we have selected all the documents.
8973 (error "None of the articles could be interpreted as documents"))
8974 ((gnus-group-read-ephemeral-group
8975 (setq vgroup
(format
8976 "nnvirtual:%s-%s" gnus-newsgroup-name
8977 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8978 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
8980 (cons (current-buffer) 'summary
)))
8982 (error "Couldn't select virtual nndoc group")))))
8984 (defun gnus-summary-isearch-article (&optional regexp-p
)
8985 "Do incremental search forward on the current article.
8986 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8988 (gnus-summary-select-article)
8989 (gnus-configure-windows 'article
)
8990 (gnus-eval-in-buffer-window gnus-article-buffer
8993 (isearch-forward regexp-p
))))
8995 (defun gnus-summary-repeat-search-article-forward ()
8996 "Repeat the previous search forwards."
8998 (unless gnus-last-search-regexp
8999 (error "No previous search"))
9000 (gnus-summary-search-article-forward gnus-last-search-regexp
))
9002 (defun gnus-summary-repeat-search-article-backward ()
9003 "Repeat the previous search backwards."
9005 (unless gnus-last-search-regexp
9006 (error "No previous search"))
9007 (gnus-summary-search-article-forward gnus-last-search-regexp t
))
9009 (defun gnus-summary-search-article-forward (regexp &optional backward
)
9010 "Search for an article containing REGEXP forward.
9011 If BACKWARD, search backward instead."
9014 (format "Search article %s (regexp%s): "
9015 (if current-prefix-arg
"backward" "forward")
9016 (if gnus-last-search-regexp
9017 (concat ", default " gnus-last-search-regexp
)
9019 current-prefix-arg
))
9020 (if (string-equal regexp
"")
9021 (setq regexp
(or gnus-last-search-regexp
""))
9022 (setq gnus-last-search-regexp regexp
)
9023 (setq gnus-article-before-search gnus-current-article
))
9024 ;; Intentionally set gnus-last-article.
9025 (setq gnus-last-article gnus-article-before-search
)
9026 (let ((gnus-last-article gnus-last-article
))
9027 (if (gnus-summary-search-article regexp backward
)
9028 (gnus-summary-show-thread)
9029 (signal 'search-failed
(list regexp
)))))
9031 (defun gnus-summary-search-article-backward (regexp)
9032 "Search for an article containing REGEXP backward."
9035 (format "Search article backward (regexp%s): "
9036 (if gnus-last-search-regexp
9037 (concat ", default " gnus-last-search-regexp
)
9039 (gnus-summary-search-article-forward regexp
'backward
))
9041 (defun gnus-summary-search-article (regexp &optional backward
)
9042 "Search for an article containing REGEXP.
9043 Optional argument BACKWARD means do search for backward.
9044 `gnus-select-article-hook' is not called during the search."
9045 ;; We have to require this here to make sure that the following
9046 ;; dynamic binding isn't shadowed by autoloading.
9047 (require 'gnus-async
)
9049 (let ((gnus-select-article-hook nil
) ;Disable hook.
9050 (gnus-article-prepare-hook nil
)
9051 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
9052 (gnus-use-article-prefetch nil
)
9053 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
9054 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
9056 (gnus-keep-backlog nil
)
9057 (gnus-break-pages nil
)
9058 (gnus-summary-display-arrow nil
)
9059 (gnus-updated-mode-lines nil
)
9060 (gnus-auto-center-summary nil
)
9061 (sum (current-buffer))
9062 (gnus-display-mime-function nil
)
9065 (gnus-save-hidden-threads
9066 (gnus-summary-select-article)
9067 (set-buffer gnus-article-buffer
)
9068 (goto-char (window-point (get-buffer-window (current-buffer))))
9072 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
9074 (re-search-backward regexp nil t
)
9075 (re-search-forward regexp nil t
))
9076 ;; We found the regexp.
9081 (get-buffer-window (current-buffer))
9085 (get-buffer-window (current-buffer))
9088 (setq point
(point)))
9089 ;; We didn't find it, so we go to the next article.
9092 (while (eq found
'not
)
9093 (if (not (if backward
(gnus-summary-find-prev)
9094 (gnus-summary-find-next)))
9095 ;; No more articles.
9097 ;; Select the next article and adjust point.
9098 (unless (gnus-summary-article-sparse-p
9099 (gnus-summary-article-number))
9101 (gnus-summary-select-article)
9102 (set-buffer gnus-article-buffer
)
9104 (goto-char (if backward
(point-max) (point-min))))))))
9105 (gnus-message 7 ""))
9106 ;; Return whether we found the regexp.
9107 (when (eq found
'found
)
9109 (gnus-summary-show-thread)
9110 (gnus-summary-goto-subject gnus-current-article
)
9111 (gnus-summary-position-point)
9114 (defun gnus-find-matching-articles (header regexp
)
9115 "Return a list of all articles that match REGEXP on HEADER.
9116 This search includes all articles in the current group that Gnus has
9117 fetched headers for, whether they are displayed or not."
9118 (let ((articles nil
)
9119 ;; Can't eta-reduce because it's a macro.
9120 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
9121 (case-fold-search t
))
9122 (dolist (header gnus-newsgroup-headers
)
9123 (when (string-match regexp
(funcall func header
))
9124 (push (mail-header-number header
) articles
)))
9125 (nreverse articles
)))
9127 (defun gnus-summary-find-matching (header regexp
&optional backward unread
9128 not-case-fold not-matching
)
9129 "Return a list of all articles that match REGEXP on HEADER.
9130 The search stars on the current article and goes forwards unless
9131 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9132 If UNREAD is non-nil, only unread articles will
9133 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9134 in the comparisons. If NOT-MATCHING, return a list of all articles that
9135 not match REGEXP on HEADER."
9136 (let ((case-fold-search (not not-case-fold
))
9139 (if (eq (car header
) 'extra
)
9142 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
9144 (error "%s is an invalid header" header
))
9145 (unless (fboundp (intern (concat "mail-header-" header
)))
9146 (error "%s is not a valid header" header
))
9147 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
9148 (dolist (d (if (eq backward
'all
)
9150 (gnus-data-find-list
9151 (gnus-summary-article-number)
9152 (gnus-data-list backward
))))
9153 (when (and (or (not unread
) ; We want all articles...
9154 (gnus-data-unread-p d
)) ; Or just unreads.
9155 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
9159 (funcall func
(gnus-data-header d
))))
9160 (string-match regexp
9161 (funcall func
(gnus-data-header d
)))))
9162 (push (gnus-data-number d
) articles
))) ; Success!
9163 (nreverse articles
)))
9165 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
9166 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9167 If HEADER is an empty string (or nil), the match is done on the entire
9168 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9170 (list (let ((completion-ignore-case t
))
9173 (mapcar (lambda (header) (list (format "%s" header
)))
9175 '("Number" "Subject" "From" "Lines" "Date"
9176 "Message-ID" "Xref" "References" "Body")
9177 gnus-extra-headers
))
9178 nil
'require-match
))
9179 (read-string "Regexp: ")
9180 (read-key-sequence "Command: ")
9181 current-prefix-arg
))
9182 (when (equal header
"Body")
9184 ;; Hidden thread subtrees must be searched as well.
9185 (gnus-summary-show-all-threads)
9186 ;; We don't want to change current point nor window configuration.
9188 (save-window-excursion
9190 gnus-treat-strip-trailing-blank-lines
9191 gnus-treat-strip-leading-blank-lines
9192 gnus-treat-strip-multiple-blank-lines
9193 gnus-treat-hide-boring-headers
9194 gnus-treat-fold-newsgroups
9195 gnus-article-prepare-hook
)
9196 (gnus-message 6 "Executing %s..." (key-description command
))
9197 ;; We'd like to execute COMMAND interactively so as to give arguments.
9198 (gnus-execute header regexp
9199 `(call-interactively ',(key-binding command
))
9201 (gnus-message 6 "Executing %s...done" (key-description command
))))))
9203 (defun gnus-summary-beginning-of-article ()
9204 "Scroll the article back to the beginning."
9206 (gnus-summary-select-article)
9207 (gnus-configure-windows 'article
)
9208 (gnus-eval-in-buffer-window gnus-article-buffer
9210 (goto-char (point-min))
9211 (when gnus-break-pages
9212 (gnus-narrow-to-page))))
9214 (defun gnus-summary-end-of-article ()
9215 "Scroll to the end of the article."
9217 (gnus-summary-select-article)
9218 (gnus-configure-windows 'article
)
9219 (gnus-eval-in-buffer-window gnus-article-buffer
9221 (goto-char (point-max))
9223 (when gnus-break-pages
9224 (gnus-narrow-to-page))))
9226 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
9227 "Truncate to LEN and quote all \"(\"'s in STRING."
9228 (gnus-replace-in-string (if (and len
(> (length string
) len
))
9229 (substring string
0 len
)
9233 (defun gnus-summary-print-article (&optional filename n
)
9234 "Generate and print a PostScript image of the process-marked (mail) articles.
9236 If used interactively, print the current article if none are
9237 process-marked. With prefix arg, prompt the user for the name of the
9240 When used from Lisp, accept two optional args FILENAME and N. N means
9241 to print the next N articles. If N is negative, print the N previous
9242 articles. If N is nil and articles have been marked with the process
9243 mark, print these instead.
9245 If the optional first argument FILENAME is nil, send the image to the
9246 printer. If FILENAME is a string, save the PostScript image in a file with
9247 that name. If FILENAME is a number, prompt the user for the name of the file
9249 (interactive (list (ps-print-preprint current-prefix-arg
)))
9250 (dolist (article (gnus-summary-work-articles n
))
9251 (gnus-summary-select-article nil nil
'pseudo article
)
9252 (gnus-eval-in-buffer-window gnus-article-buffer
9253 (gnus-print-buffer))
9254 (gnus-summary-remove-process-mark article
))
9255 (ps-despool filename
))
9257 (defun gnus-print-buffer ()
9258 (let ((buffer (generate-new-buffer " *print*")))
9261 (copy-to-buffer buffer
(point-min) (point-max))
9263 (gnus-remove-text-with-property 'gnus-decoration
)
9264 (when (gnus-visual-p 'article-highlight
'highlight
)
9265 ;; Copy-to-buffer doesn't copy overlay. So redo
9267 (let ((gnus-article-buffer buffer
))
9268 (gnus-article-highlight-citation t
)
9269 (gnus-article-highlight-signature)
9270 (gnus-article-emphasize)
9271 (gnus-article-delete-invisible-text)))
9272 (let ((ps-left-header
9275 (gnus-summary-print-truncate-and-quote
9276 (mail-header-subject gnus-current-headers
)
9279 (gnus-summary-print-truncate-and-quote
9280 (mail-header-from gnus-current-headers
)
9284 "/pagenumberstring load"
9286 (mail-header-date gnus-current-headers
) ")"))))
9287 (gnus-run-hooks 'gnus-ps-print-hook
)
9289 (if ps-print-color-p
9290 (ps-spool-buffer-with-faces)
9291 (ps-spool-buffer)))))
9292 (kill-buffer buffer
))))
9294 (defun gnus-summary-show-article (&optional arg
)
9295 "Force redisplaying of the current article.
9296 If ARG (the prefix) is a number, show the article with the charset
9297 defined in `gnus-summary-show-article-charset-alist', or the charset
9299 If ARG (the prefix) is non-nil and not a number, show the raw article
9300 without any article massaging functions being run. Normally, the key
9301 strokes are `C-u g'."
9305 (gnus-summary-show-article t
)
9306 (let ((gnus-newsgroup-charset
9307 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
9308 (mm-read-coding-system
9309 "View as charset: " ;; actually it is coding system.
9310 (with-current-buffer gnus-article-buffer
9311 (mm-detect-coding-region (point) (point-max))))))
9312 (gnus-newsgroup-ignored-charsets 'gnus-all
))
9313 (gnus-summary-select-article nil
'force
)
9314 (let ((deps gnus-newsgroup-dependencies
)
9316 (with-current-buffer gnus-original-article-buffer
9318 (message-narrow-to-head)
9319 (setq head
(buffer-string))
9320 (goto-char (point-min))
9321 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
9322 (goto-char (point-max))
9324 (setq lines
(1- (count-lines (point) (point-max))))))
9326 (insert (format "211 %d Article retrieved.\n"
9327 (cdr gnus-article-current
)))
9329 (if lines
(insert (format "Lines: %d\n" lines
)))
9331 (let ((nntp-server-buffer (current-buffer)))
9332 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
9333 (gnus-data-set-header
9334 (gnus-data-find (cdr gnus-article-current
))
9336 (gnus-summary-update-article-line
9337 (cdr gnus-article-current
) header
)
9338 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9339 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
9341 ;; Select the article the normal way.
9342 (gnus-summary-select-article nil
'force
))
9344 ;; We have to require this here to make sure that the following
9345 ;; dynamic binding isn't shadowed by autoloading.
9346 (require 'gnus-async
)
9348 ;; Bind the article treatment functions to nil.
9349 (let ((gnus-have-all-headers t
)
9350 gnus-article-prepare-hook
9351 gnus-article-decode-hook
9352 gnus-display-mime-function
9354 ;; Destroy any MIME parts.
9355 (when (gnus-buffer-live-p gnus-article-buffer
)
9356 (with-current-buffer gnus-article-buffer
9357 (mm-destroy-parts gnus-article-mime-handles
)
9358 ;; Set it to nil for safety reason.
9359 (setq gnus-article-mime-handle-alist nil
)
9360 (setq gnus-article-mime-handles nil
)))
9361 (gnus-summary-select-article nil
'force
))))
9362 (gnus-summary-goto-subject gnus-current-article
)
9363 (gnus-summary-position-point))
9365 (defun gnus-summary-show-raw-article ()
9366 "Show the raw article without any article massaging functions being run."
9368 (gnus-summary-show-article t
))
9370 (defun gnus-summary-verbose-headers (&optional arg
)
9371 "Toggle permanent full header display.
9372 If ARG is a positive number, turn header display on.
9373 If ARG is a negative number, turn header display off."
9375 (setq gnus-show-all-headers
9376 (cond ((or (not (numberp arg
))
9378 (not gnus-show-all-headers
))
9381 (gnus-summary-show-article))
9383 (defun gnus-summary-toggle-header (&optional arg
)
9384 "Show the headers if they are hidden, or hide them if they are shown.
9385 If ARG is a positive number, show the entire header.
9386 If ARG is a negative number, hide the unwanted header lines."
9388 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
9389 (get-buffer-window gnus-article-buffer t
))))
9390 (with-current-buffer gnus-article-buffer
9392 (article-narrow-to-head)
9393 (let* ((inhibit-read-only t
)
9394 (inhibit-point-motion-hooks t
)
9395 (hidden (if (numberp arg
)
9397 (or (not (looking-at "[^ \t\n]+:"))
9398 (gnus-article-hidden-text-p 'headers
))))
9400 (delete-region (point-min) (point-max))
9401 (with-current-buffer gnus-original-article-buffer
9402 (goto-char (setq s
(point-min)))
9403 (setq e
(if (search-forward "\n\n" nil t
)
9406 (insert-buffer-substring gnus-original-article-buffer s e
)
9407 (run-hooks 'gnus-article-decode-hook
)
9409 (let ((gnus-treat-hide-headers nil
)
9410 (gnus-treat-hide-boring-headers nil
))
9411 (gnus-delete-wash-type 'headers
)
9412 (gnus-treat-article 'head
))
9413 (gnus-treat-article 'head
))
9416 (set-window-start window
(goto-char (point-min))))
9417 (if gnus-break-pages
9418 (gnus-narrow-to-page)
9419 (when (gnus-visual-p 'page-marker
)
9420 (let ((inhibit-read-only t
))
9421 (gnus-remove-text-with-property 'gnus-prev
)
9422 (gnus-remove-text-with-property 'gnus-next
))))
9423 (gnus-set-mode-line 'article
)))))
9425 (defun gnus-summary-show-all-headers ()
9426 "Make all header lines visible."
9428 (gnus-summary-toggle-header 1))
9430 (defun gnus-summary-caesar-message (&optional arg
)
9431 "Caesar rotate the current article by 13.
9432 With a non-numerical prefix, also rotate headers. A numerical
9433 prefix specifies how many places to rotate each letter forward."
9435 (gnus-summary-select-article)
9436 (let ((mail-header-separator ""))
9437 (gnus-eval-in-buffer-window gnus-article-buffer
9440 (let ((start (window-start))
9441 (inhibit-read-only t
))
9442 (if (equal arg
'(4))
9443 (message-caesar-buffer-body nil t
)
9444 (message-caesar-buffer-body arg
))
9445 (set-window-start (get-buffer-window (current-buffer)) start
)))))
9446 ;; Create buttons and stuff...
9447 (gnus-treat-article nil
))
9449 (declare-function idna-to-unicode
"ext:idna" (str))
9451 (defun gnus-summary-idna-message (&optional arg
)
9452 "Decode IDNA encoded domain names in the current articles.
9453 IDNA encoded domain names looks like `xn--bar'. If a string
9454 remain unencoded after running this function, it is likely an
9455 invalid IDNA string (`xn--bar' is invalid).
9457 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9458 installed for this command to work."
9460 (if (not (and (condition-case nil
(require 'idna
)
9462 (mm-coding-system-p 'utf-8
)
9463 (executable-find (symbol-value 'idna-program
))))
9465 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9466 (gnus-summary-select-article)
9467 (let ((mail-header-separator ""))
9468 (gnus-eval-in-buffer-window gnus-article-buffer
9471 (let ((start (window-start))
9473 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t
)
9474 (replace-match (idna-to-unicode (match-string 1))))
9475 (set-window-start (get-buffer-window (current-buffer)) start
)))))))
9477 (defun gnus-summary-morse-message (&optional arg
)
9478 "Morse decode the current article."
9480 (gnus-summary-select-article)
9481 (let ((mail-header-separator ""))
9482 (gnus-eval-in-buffer-window gnus-article-buffer
9486 (let ((pos (window-start))
9487 (inhibit-read-only t
))
9488 (goto-char (point-min))
9489 (when (message-goto-body)
9490 (gnus-narrow-to-body))
9491 (goto-char (point-min))
9492 (while (search-forward "·" (point-max) t
)
9493 (replace-match "."))
9494 (unmorse-region (point-min) (point-max))
9496 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
9498 (defun gnus-summary-stop-page-breaking ()
9499 "Stop page breaking in the current article."
9501 (gnus-summary-select-article)
9502 (gnus-eval-in-buffer-window gnus-article-buffer
9504 (when (gnus-visual-p 'page-marker
)
9505 (let ((inhibit-read-only t
))
9506 (gnus-remove-text-with-property 'gnus-prev
)
9507 (gnus-remove-text-with-property 'gnus-next
))
9508 (setq gnus-page-broken nil
))))
9510 (defun gnus-summary-move-article (&optional n to-newsgroup
9511 select-method action
)
9512 "Move the current article to a different newsgroup.
9513 If N is a positive number, move the N next articles.
9514 If N is a negative number, move the N previous articles.
9515 If N is nil and any articles have been marked with the process mark,
9516 move those articles instead.
9517 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9518 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9519 re-spool using this method.
9521 When called interactively with TO-NEWSGROUP being nil, the value of
9522 the variable `gnus-move-split-methods' is used for finding a default
9523 for the target newsgroup.
9525 For this function to work, both the current newsgroup and the
9526 newsgroup that you want to move to have to support the `request-move'
9527 and `request-accept' functions.
9529 ACTION can be either `move' (the default), `crosspost' or `copy'."
9532 (setq action
'move
))
9533 ;; Check whether the source group supports the required functions.
9534 (cond ((and (eq action
'move
)
9535 (not (gnus-check-backend-function
9536 'request-move-article gnus-newsgroup-name
)))
9537 (error "The current group does not support article moving"))
9538 ((and (eq action
'crosspost
)
9539 (not (gnus-check-backend-function
9540 'request-replace-article gnus-newsgroup-name
)))
9541 (error "The current group does not support article editing")))
9542 (let ((articles (gnus-summary-work-articles n
))
9543 (prefix (if (gnus-check-backend-function
9544 'request-move-article gnus-newsgroup-name
)
9545 (funcall gnus-move-group-prefix-function
9546 gnus-newsgroup-name
)
9548 (names '((move "Move" "Moving")
9549 (copy "Copy" "Copying")
9550 (crosspost "Crosspost" "Crossposting")))
9551 (copy-buf (save-excursion
9552 (nnheader-set-temp-buffer " *copy article*")))
9553 art-group to-method new-xref article to-groups
9554 articles-to-update-marks encoded
)
9555 (unless (assq action names
)
9556 (error "Unknown action %s" action
))
9557 ;; Read the newsgroup name.
9558 (when (and (not to-newsgroup
)
9559 (not select-method
))
9560 (if (and gnus-move-split-methods
9562 (and (memq gnus-current-article articles
)
9563 (gnus-buffer-live-p gnus-original-article-buffer
))))
9564 ;; When `gnus-move-split-methods' is non-nil, we have to
9565 ;; select an article to give `gnus-read-move-group-name' an
9566 ;; opportunity to suggest an appropriate default. However,
9567 ;; we needn't render or mark the article.
9568 (let ((gnus-display-mime-function nil
)
9569 (gnus-article-prepare-hook nil
)
9570 (gnus-mark-article-hook nil
))
9571 (gnus-summary-select-article nil nil nil
(car articles
))))
9572 (setq to-newsgroup
(gnus-read-move-group-name
9573 (cadr (assq action names
))
9575 (intern (format "gnus-current-%s-group" action
)))
9577 encoded to-newsgroup
9578 to-method
(gnus-server-to-method (gnus-group-method to-newsgroup
)))
9579 (set (intern (format "gnus-current-%s-group" action
))
9580 (mm-decode-coding-string
9582 (gnus-group-name-charset to-method to-newsgroup
))))
9584 (setq to-method
(or select-method
9585 (gnus-server-to-method
9586 (gnus-group-method to-newsgroup
)))))
9590 (mm-encode-coding-string
9592 (gnus-group-name-charset to-method to-newsgroup
)))))
9593 ;; Check the method we are to move this article to...
9594 (unless (gnus-check-backend-function
9595 'request-accept-article
(car to-method
))
9596 (error "%s does not support article copying" (car to-method
)))
9597 (unless (gnus-check-server to-method
)
9598 (error "Can't open server %s" (car to-method
)))
9599 (gnus-message 6 "%s to %s: %s..."
9600 (caddr (assq action names
))
9601 (or (car select-method
)
9602 (gnus-group-decoded-name to-newsgroup
))
9605 (setq article
(pop articles
))
9609 ;; Move the article.
9611 ;; Remove this article from future suppression.
9612 (gnus-dup-unsuppress-article article
)
9613 (let* ((from-method (gnus-find-method-for-group
9614 gnus-newsgroup-name
))
9615 (to-method (or select-method
9616 (gnus-find-method-for-group to-newsgroup
)))
9617 (move-is-internal (gnus-method-equal from-method to-method
)))
9618 (gnus-request-move-article
9619 article
; Article to move
9620 gnus-newsgroup-name
; From newsgroup
9621 (nth 1 (gnus-find-method-for-group
9622 gnus-newsgroup-name
)) ; Server
9623 (list 'gnus-request-accept-article
9624 to-newsgroup
(list 'quote select-method
)
9625 (not articles
) t
) ; Accept form
9626 (not articles
) ; Only save nov last time
9627 move-is-internal
))) ; is this move internal?
9628 ;; Copy the article.
9630 (with-current-buffer copy-buf
9631 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9633 (nnheader-narrow-to-headers)
9634 (dolist (hdr gnus-copy-article-ignored-headers
)
9635 (message-remove-header hdr t
)))
9636 (gnus-request-accept-article
9637 to-newsgroup select-method
(not articles
) t
))))
9638 ;; Crosspost the article.
9639 ((eq action
'crosspost
)
9640 (let ((xref (message-tokenize-header
9641 (mail-header-xref (gnus-summary-article-header article
))
9643 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
9644 ":" (number-to-string article
)))
9646 (setq xref
(list (system-name))))
9649 (mapconcat 'identity
9650 (delete "Xref:" (delete new-xref xref
))
9653 (with-current-buffer copy-buf
9654 ;; First put the article in the destination group.
9655 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9656 (when (consp (setq art-group
9657 (gnus-request-accept-article
9658 to-newsgroup select-method
(not articles
) t
)))
9659 (setq new-xref
(concat new-xref
" " (car art-group
)
9661 (number-to-string (cdr art-group
))))
9662 ;; Now we have the new Xrefs header, so we insert
9663 ;; it and replace the new article.
9664 (nnheader-replace-header "Xref" new-xref
)
9665 (gnus-request-replace-article
9666 (cdr art-group
) to-newsgroup
(current-buffer) t
)
9670 (gnus-message 1 "Couldn't %s article %s: %s"
9671 (cadr (assq action names
)) article
9672 (nnheader-get-report (car to-method
))))
9673 ((eq art-group
'junk
)
9674 (when (eq action
'move
)
9675 (gnus-summary-mark-article article gnus-canceled-mark
)
9676 (gnus-message 4 "Deleted article %s" article
)
9677 ;; run the delete hook
9678 (run-hook-with-args 'gnus-summary-article-delete-hook
9681 (assoc article
(gnus-data-list nil
)))
9682 gnus-newsgroup-name nil
9685 (let* ((pto-group (gnus-group-prefixed-name
9686 (car art-group
) to-method
))
9687 (info (gnus-get-info pto-group
))
9688 (to-group (gnus-info-group info
))
9690 ;; Update the group that has been moved to.
9692 (memq action
'(move copy
)))
9693 (unless (member to-group to-groups
)
9694 (push to-group to-groups
))
9696 (unless (memq article gnus-newsgroup-unreads
)
9697 (push 'read to-marks
)
9699 info
(gnus-add-to-range (gnus-info-read info
)
9700 (list (cdr art-group
)))))
9702 ;; See whether the article is to be put in the cache.
9703 (let ((marks (if (gnus-group-auto-expirable-p to-group
)
9704 gnus-article-mark-lists
9705 (delete '(expirable . expire
)
9706 (copy-sequence gnus-article-mark-lists
))))
9707 (to-article (cdr art-group
)))
9709 ;; Enter the article into the cache in the new group,
9710 ;; if that is required.
9711 (when gnus-use-cache
9712 (gnus-cache-possibly-enter-article
9714 (memq article gnus-newsgroup-marked
)
9715 (memq article gnus-newsgroup-dormant
)
9716 (memq article gnus-newsgroup-unreads
)))
9718 (when gnus-preserve-marks
9719 ;; Copy any marks over to the new group.
9720 (when (and (equal to-group gnus-newsgroup-name
)
9721 (not (memq article gnus-newsgroup-unreads
)))
9722 ;; Mark this article as read in this group.
9723 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9724 (setcdr (gnus-active to-group
) to-article
)
9725 (setcdr gnus-newsgroup-active to-article
))
9728 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9729 (when (memq article
(symbol-value
9730 (intern (format "gnus-newsgroup-%s"
9732 (push (cdar marks
) to-marks
)
9733 ;; If the other group is the same as this group,
9734 ;; then we have to add the mark to the list.
9735 (when (equal to-group gnus-newsgroup-name
)
9736 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9739 (intern (format "gnus-newsgroup-%s"
9741 ;; Copy the marks to other group.
9742 (gnus-add-marked-articles
9743 to-group
(cdar marks
) (list to-article
) info
)))
9744 (setq marks
(cdr marks
)))
9746 (gnus-request-set-mark
9747 to-group
(list (list (list to-article
) 'add to-marks
))))
9750 (concat "(gnus-group-set-info '"
9751 (gnus-prin1-to-string (gnus-get-info to-group
))
9754 ;; Update the Xref header in this article to point to
9755 ;; the new crossposted article we have just created.
9756 (when (eq action
'crosspost
)
9757 (with-current-buffer copy-buf
9758 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9759 (nnheader-replace-header "Xref" new-xref
)
9760 (gnus-request-replace-article
9761 article gnus-newsgroup-name
(current-buffer) t
)))
9763 ;; run the move/copy/crosspost/respool hook
9764 (run-hook-with-args 'gnus-summary-article-move-hook
9767 (assoc article
(gnus-data-list nil
)))
9772 ;;;!!!Why is this necessary?
9773 (set-buffer gnus-summary-buffer
)
9775 (gnus-summary-goto-subject article
)
9776 (when (eq action
'move
)
9777 (gnus-summary-mark-article article gnus-canceled-mark
))))
9778 (push article articles-to-update-marks
))
9780 (apply 'gnus-summary-remove-process-mark articles-to-update-marks
)
9781 ;; Re-activate all groups that have been moved to.
9782 (with-current-buffer gnus-group-buffer
9783 (let ((gnus-group-marked to-groups
))
9784 (gnus-group-get-new-news-this-group nil t
)))
9786 (gnus-kill-buffer copy-buf
)
9787 (gnus-summary-position-point)
9788 (gnus-set-mode-line 'summary
)))
9790 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9791 "Copy the current article to some other group.
9792 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9793 When called interactively, if TO-NEWSGROUP is nil, use the value of
9794 the variable `gnus-move-split-methods' for finding a default target
9796 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9797 re-spool using this method."
9799 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9801 (defun gnus-summary-crosspost-article (&optional n
)
9802 "Crosspost the current article to some other group."
9804 (gnus-summary-move-article n nil nil
'crosspost
))
9806 (defcustom gnus-summary-respool-default-method nil
9807 "Default method type for respooling an article.
9808 If nil, use to the current newsgroup method."
9810 :group
'gnus-summary-mail
)
9812 (defun gnus-summary-respool-article (&optional n method
)
9813 "Respool the current article.
9814 The article will be squeezed through the mail spooling process again,
9815 which means that it will be put in some mail newsgroup or other
9816 depending on `nnmail-split-methods'.
9817 If N is a positive number, respool the N next articles.
9818 If N is a negative number, respool the N previous articles.
9819 If N is nil and any articles have been marked with the process mark,
9820 respool those articles instead.
9822 Respooling can be done both from mail groups and \"real\" newsgroups.
9823 In the former case, the articles in question will be moved from the
9824 current group into whatever groups they are destined to. In the
9825 latter case, they will be copied into the relevant groups."
9827 (list current-prefix-arg
9828 (let* ((methods (gnus-methods-using 'respool
))
9830 (symbol-name (or gnus-summary-respool-default-method
9831 (car (gnus-find-method-for-group
9832 gnus-newsgroup-name
)))))
9834 (gnus-completing-read-with-default
9835 methname
"Backend to use when respooling"
9836 methods nil t nil
'gnus-mail-method-history
))
9839 ((zerop (length (setq ms
(gnus-servers-using-backend
9841 (list (intern method
) ""))
9845 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9846 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9849 (error "No method given for respooling"))
9850 (if (assoc (symbol-name
9851 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9852 (gnus-methods-using 'respool
))
9853 (gnus-summary-move-article n nil method
)
9854 (gnus-summary-copy-article n nil method
)))
9856 (defun gnus-summary-import-article (file &optional edit
)
9857 "Import an arbitrary file into a mail newsgroup."
9858 (interactive "fImport file: \nP")
9859 (let ((group gnus-newsgroup-name
)
9860 (now (current-time))
9861 atts lines group-art
)
9862 (unless (gnus-check-backend-function 'request-accept-article group
)
9863 (error "%s does not support article importing" group
))
9864 (or (file-readable-p file
)
9865 (not (file-regular-p file
))
9866 (error "Can't read %s" file
))
9867 (with-current-buffer (gnus-get-buffer-create " *import file*")
9869 (nnheader-insert-file-contents file
)
9870 (goto-char (point-min))
9871 (if (nnheader-article-p)
9873 (goto-char (point-min))
9874 (search-forward "\n\n" nil t
)
9875 (narrow-to-region (point-min) (1- (point)))
9876 (goto-char (point-min))
9877 (unless (re-search-forward "^date:" nil t
)
9878 (goto-char (point-max))
9879 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9880 ;; This doesn't look like an article, so we fudge some headers.
9881 (setq atts
(file-attributes file
)
9882 lines
(count-lines (point-min) (point-max)))
9883 (insert "From: " (read-string "From: ") "\n"
9884 "Subject: " (read-string "Subject: ") "\n"
9885 "Date: " (message-make-date (nth 5 atts
)) "\n"
9886 "Message-ID: " (message-make-message-id) "\n"
9887 "Lines: " (int-to-string lines
) "\n"
9888 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9889 (setq group-art
(gnus-request-accept-article group nil t
))
9890 (kill-buffer (current-buffer)))
9891 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9893 (gnus-summary-goto-article (cdr group-art
) nil t
)
9895 (gnus-summary-edit-article))))
9897 (defun gnus-summary-create-article ()
9898 "Create an article in a mail newsgroup."
9900 (let ((group gnus-newsgroup-name
)
9901 (now (current-time))
9903 (unless (gnus-check-backend-function 'request-accept-article group
)
9904 (error "%s does not support article importing" group
))
9905 (with-current-buffer (gnus-get-buffer-create " *import file*")
9907 (goto-char (point-min))
9908 ;; This doesn't look like an article, so we fudge some headers.
9909 (insert "From: " (read-string "From: ") "\n"
9910 "Subject: " (read-string "Subject: ") "\n"
9911 "Date: " (message-make-date now
) "\n"
9912 "Message-ID: " (message-make-message-id) "\n")
9913 (setq group-art
(gnus-request-accept-article group nil t
))
9914 (kill-buffer (current-buffer)))
9915 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9917 (gnus-summary-goto-article (cdr group-art
) nil t
)
9918 (gnus-summary-edit-article)))
9920 (defun gnus-summary-article-posted-p ()
9921 "Say whether the current (mail) article is available from news as well.
9922 This will be the case if the article has both been mailed and posted."
9924 (let ((id (mail-header-references (gnus-summary-article-header)))
9925 (gnus-override-method (car (gnus-refer-article-methods))))
9926 (if (gnus-request-head id
"")
9927 (gnus-message 2 "The current message was found on %s"
9928 gnus-override-method
)
9929 (gnus-message 2 "The current message couldn't be found on %s"
9930 gnus-override-method
)
9933 (defun gnus-summary-expire-articles (&optional now
)
9934 "Expire all articles that are marked as expirable in the current group."
9936 (when (and (not gnus-group-is-exiting-without-update-p
)
9937 (gnus-check-backend-function
9938 'request-expire-articles gnus-newsgroup-name
))
9939 ;; This backend supports expiry.
9940 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
9941 (expirable (if total
9943 ;; We need to update the info for
9944 ;; this group for `gnus-list-of-read-articles'
9945 ;; to give us the right answer.
9946 (gnus-run-hooks 'gnus-exit-group-hook
)
9947 (gnus-summary-update-info)
9948 (gnus-list-of-read-articles gnus-newsgroup-name
))
9949 (setq gnus-newsgroup-expirable
9950 (sort gnus-newsgroup-expirable
'<))))
9951 (expiry-wait (if now
'immediate
9952 (gnus-group-find-parameter
9953 gnus-newsgroup-name
'expiry-wait
)))
9954 (nnmail-expiry-target
9955 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
9956 nnmail-expiry-target
))
9959 ;; There are expirable articles in this group, so we run them
9960 ;; through the expiry process.
9961 (gnus-message 6 "Expiring articles...")
9962 (unless (gnus-check-group gnus-newsgroup-name
)
9963 (error "Can't open server for %s" gnus-newsgroup-name
))
9964 ;; The list of articles that weren't expired is returned.
9967 (let ((nnmail-expiry-wait-function nil
)
9968 (nnmail-expiry-wait expiry-wait
))
9969 (setq es
(gnus-request-expire-articles
9970 expirable gnus-newsgroup-name
)))
9971 (setq es
(gnus-request-expire-articles
9972 expirable gnus-newsgroup-name
)))
9974 (setq gnus-newsgroup-expirable es
))
9975 ;; We go through the old list of expirable, and mark all
9976 ;; really expired articles as nonexistent.
9977 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
9978 (let ((gnus-use-cache nil
))
9979 (dolist (article expirable
)
9980 (when (and (not (memq article es
))
9981 (gnus-data-find article
))
9982 (gnus-summary-mark-article article gnus-canceled-mark
)
9983 (run-hook-with-args 'gnus-summary-article-expire-hook
9986 (assoc article
(gnus-data-list nil
)))
9990 (gnus-message 6 "Expiring articles...done")))))
9992 (defun gnus-summary-expire-articles-now ()
9993 "Expunge all expirable articles in the current group.
9994 This means that *all* articles that are marked as expirable will be
9995 deleted forever, right now."
9997 (or gnus-expert-user
9999 "Are you really, really sure you want to delete all expirable messages? ")
10001 (gnus-summary-expire-articles t
))
10003 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10004 (defun gnus-summary-delete-article (&optional n
)
10005 "Delete the N next (mail) articles.
10006 This command actually deletes articles. This is not a marking
10007 command. The article will disappear forever from your life, never to
10010 If N is negative, delete backwards.
10011 If N is nil and articles have been marked with the process mark,
10012 delete these instead.
10014 If `gnus-novice-user' is non-nil you will be asked for
10015 confirmation before the articles are deleted."
10017 (unless (gnus-check-backend-function 'request-expire-articles
10018 gnus-newsgroup-name
)
10019 (error "The current newsgroup does not support article deletion"))
10020 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
10021 (error "Couldn't open server"))
10022 ;; Compute the list of articles to delete.
10023 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
10024 (nnmail-expiry-target 'delete
)
10026 (if (and gnus-novice-user
10027 (not (gnus-yes-or-no-p
10028 (format "Do you really want to delete %s forever? "
10029 (if (> (length articles
) 1)
10030 (format "these %s articles" (length articles
))
10031 "this article")))))
10033 ;; Delete the articles.
10034 (setq not-deleted
(gnus-request-expire-articles
10035 articles gnus-newsgroup-name
'force
))
10037 (gnus-summary-remove-process-mark (car articles
))
10038 ;; The backend might not have been able to delete the article
10040 (unless (memq (car articles
) not-deleted
)
10041 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
10042 (let* ((article (car articles
))
10043 (ghead (gnus-data-header
10044 (assoc article
(gnus-data-list nil
)))))
10045 (run-hook-with-args 'gnus-summary-article-delete-hook
10046 'delete ghead gnus-newsgroup-name nil
10048 (setq articles
(cdr articles
)))
10050 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
10051 (gnus-summary-position-point)
10052 (gnus-set-mode-line 'summary
)
10055 (defun gnus-summary-edit-article (&optional arg
)
10056 "Edit the current article.
10057 This will have permanent effect only in mail groups.
10058 If ARG is nil, edit the decoded articles.
10059 If ARG is 1, edit the raw articles.
10060 If ARG is 2, edit the raw articles even in read-only groups.
10061 If ARG is 3, edit the articles with the current handles.
10062 Otherwise, allow editing of articles even in read-only
10065 (let (force raw current-handles
)
10074 (setq current-handles
10075 (and (gnus-buffer-live-p gnus-article-buffer
)
10076 (with-current-buffer gnus-article-buffer
10078 gnus-article-mime-handles
10079 (setq gnus-article-mime-handles nil
))))))
10082 (when (and raw
(not force
)
10083 (member gnus-newsgroup-name
'("nndraft:delayed"
10086 (error "Can't edit the raw article in group %s"
10087 gnus-newsgroup-name
))
10088 (with-current-buffer gnus-summary-buffer
10089 (let ((mail-parse-charset gnus-newsgroup-charset
)
10090 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
10091 (gnus-set-global-variables)
10092 (when (and (not force
)
10093 (gnus-group-read-only-p))
10094 (error "The current newsgroup does not support article editing"))
10095 (gnus-summary-show-article t
)
10096 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
10097 (with-current-buffer gnus-article-buffer
10098 (mm-enable-multibyte)))
10099 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
10101 (gnus-article-edit-article
10104 (let ((mbl mml-buffer-list
))
10105 (setq mml-buffer-list nil
)
10106 (let ((rfc2047-quote-decoded-words-containing-tspecials t
))
10107 (mime-to-mml ,'current-handles
))
10108 (let ((mbl1 mml-buffer-list
))
10109 (setq mml-buffer-list mbl
)
10110 (set (make-local-variable 'mml-buffer-list
) mbl1
))
10111 (gnus-make-local-hook 'kill-buffer-hook
)
10112 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
10113 `(lambda (no-highlight)
10114 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
10115 (message-options message-options
)
10116 (message-options-set-recipient)
10117 (mail-parse-ignored-charsets
10118 ',gnus-newsgroup-ignored-charsets
)
10119 (rfc2047-header-encoding-alist
10120 ',(let ((charset (gnus-group-name-charset
10121 (gnus-find-method-for-group
10122 gnus-newsgroup-name
)
10123 gnus-newsgroup-name
)))
10124 (append (list (cons "Newsgroups" charset
)
10125 (cons "Followup-To" charset
)
10126 (cons "Xref" charset
))
10127 rfc2047-header-encoding-alist
))))
10128 ,(if (not raw
) '(progn
10130 (mml-destroy-buffers)
10131 (remove-hook 'kill-buffer-hook
10132 'mml-destroy-buffers t
)
10133 (kill-local-variable 'mml-buffer-list
)))
10134 (gnus-summary-edit-article-done
10135 ,(or (mail-header-references gnus-current-headers
) "")
10136 ,(gnus-group-read-only-p)
10137 ,gnus-summary-buffer no-highlight
))))))))
10139 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
10141 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10143 "Make edits to the current article permanent."
10146 ;; The buffer restriction contains the entire article if it exists.
10147 (when (article-goto-body)
10148 (let ((lines (count-lines (point) (point-max)))
10149 (length (- (point-max) (point)))
10150 (case-fold-search t
)
10151 (body (copy-marker (point))))
10152 (goto-char (point-min))
10153 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
10154 (delete-region (match-beginning 1) (match-end 1))
10155 (insert (number-to-string length
)))
10156 (goto-char (point-min))
10157 (when (re-search-forward
10158 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
10159 (delete-region (match-beginning 1) (match-end 1))
10160 (insert (number-to-string length
)))
10161 (goto-char (point-min))
10162 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
10163 (delete-region (match-beginning 1) (match-end 1))
10164 (insert (number-to-string lines
))))))
10165 ;; Replace the article.
10166 (let ((buf (current-buffer)))
10168 (insert-buffer-substring buf
)
10170 (if (and (not read-only
)
10171 (not (gnus-request-replace-article
10172 (cdr gnus-article-current
) (car gnus-article-current
)
10173 (current-buffer) t
)))
10174 (error "Couldn't replace article")
10175 ;; Update the summary buffer.
10176 (if (and references
10177 (equal (message-tokenize-header references
" ")
10178 (message-tokenize-header
10179 (or (message-fetch-field "references") "") " ")))
10180 ;; We only have to update this line.
10183 (message-narrow-to-head)
10184 (let ((head (buffer-substring-no-properties
10185 (point-min) (point-max)))
10188 (insert (format "211 %d Article retrieved.\n"
10189 (cdr gnus-article-current
)))
10192 (let ((nntp-server-buffer (current-buffer)))
10193 (setq header
(car (gnus-get-newsgroup-headers
10195 (with-current-buffer gnus-summary-buffer
10196 (gnus-data-set-header
10197 (gnus-data-find (cdr gnus-article-current
))
10199 (gnus-summary-update-article-line
10200 (cdr gnus-article-current
) header
)
10201 (if (gnus-summary-goto-subject
10202 (cdr gnus-article-current
) nil t
)
10203 (gnus-summary-update-secondary-mark
10204 (cdr gnus-article-current
))))))))
10206 (set-buffer (or buffer gnus-summary-buffer
))
10207 (gnus-summary-update-article (cdr gnus-article-current
))
10208 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10209 (gnus-summary-update-secondary-mark
10210 (cdr gnus-article-current
))))
10211 ;; Prettify the article buffer again.
10212 (unless no-highlight
10213 (with-current-buffer gnus-article-buffer
10214 ;;;!!! Fix this -- article should be rehighlighted.
10215 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10216 (set-buffer gnus-original-article-buffer
)
10217 (gnus-request-article
10218 (cdr gnus-article-current
)
10219 (car gnus-article-current
) (current-buffer))))
10220 ;; Prettify the summary buffer line.
10221 (when (gnus-visual-p 'summary-highlight
'highlight
)
10222 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
10224 (defun gnus-summary-edit-wash (key)
10225 "Perform editing command KEY in the article buffer."
10229 (message "%s" (concat (this-command-keys) "- "))
10232 (gnus-summary-edit-article)
10233 (execute-kbd-macro (concat (this-command-keys) key
))
10234 (gnus-article-edit-done))
10238 (defun gnus-summary-respool-query (&optional silent trace
)
10239 "Query where the respool algorithm would put this article."
10241 (let (gnus-mark-article-hook)
10242 (gnus-summary-select-article)
10243 (with-current-buffer gnus-original-article-buffer
10244 (let ((groups (nnmail-article-group 'identity trace
)))
10247 (message "This message would go to %s"
10248 (mapconcat 'car groups
", "))
10249 (message "This message would go to no groups"))
10252 (defun gnus-summary-respool-trace ()
10253 "Trace where the respool algorithm would put this article.
10254 Display a buffer showing all fancy splitting patterns which matched."
10256 (gnus-summary-respool-query nil t
))
10258 ;; Summary marking commands.
10260 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
10261 "Mark articles which has the same subject as read, and then select the next.
10262 If UNMARK is positive, remove any kind of mark.
10263 If UNMARK is negative, tick articles."
10266 (setq unmark
(prefix-numeric-value unmark
)))
10268 (gnus-summary-mark-same-subject
10269 (gnus-summary-article-subject) unmark
)))
10270 ;; Select next unread article. If auto-select-same mode, should
10271 ;; select the first unread article.
10272 (gnus-summary-next-article t
(and gnus-auto-select-same
10273 (gnus-summary-article-subject)))
10274 (gnus-message 7 "%d article%s marked as %s"
10275 count
(if (= count
1) " is" "s are")
10276 (if unmark
"unread" "read"))))
10278 (defun gnus-summary-kill-same-subject (&optional unmark
)
10279 "Mark articles which has the same subject as read.
10280 If UNMARK is positive, remove any kind of mark.
10281 If UNMARK is negative, tick articles."
10284 (setq unmark
(prefix-numeric-value unmark
)))
10286 (gnus-summary-mark-same-subject
10287 (gnus-summary-article-subject) unmark
)))
10288 ;; If marked as read, go to next unread subject.
10289 (when (null unmark
)
10290 ;; Go to next unread subject.
10291 (gnus-summary-next-subject 1 t
))
10292 (gnus-message 7 "%d articles are marked as %s"
10293 count
(if unmark
"unread" "read"))))
10295 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
10296 "Mark articles with same SUBJECT as read, and return marked number.
10297 If optional argument UNMARK is positive, remove any kinds of marks.
10298 If optional argument UNMARK is negative, mark articles as unread instead."
10302 ((null unmark
) ; Mark as read.
10305 (gnus-summary-mark-article-as-read gnus-killed-mark
)
10306 (gnus-summary-show-thread) t
)
10307 (gnus-summary-find-subject subject
))
10308 (setq count
(1+ count
))))
10309 ((> unmark
0) ; Tick.
10312 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
10313 (gnus-summary-show-thread) t
)
10314 (gnus-summary-find-subject subject
))
10315 (setq count
(1+ count
))))
10316 (t ; Mark as unread.
10319 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
10320 (gnus-summary-show-thread) t
)
10321 (gnus-summary-find-subject subject
))
10322 (setq count
(1+ count
)))))
10323 (gnus-set-mode-line 'summary
)
10324 ;; Return the number of marked articles.
10327 (defun gnus-summary-mark-as-processable (n &optional unmark
)
10328 "Set the process mark on the next N articles.
10329 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10330 the process mark instead. The difference between N and the actual
10331 number of articles marked is returned."
10333 (if (and (null n
) (gnus-region-active-p))
10334 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
10335 (setq n
(prefix-numeric-value n
))
10336 (let ((backward (< n
0))
10341 (gnus-summary-remove-process-mark
10342 (gnus-summary-article-number))
10343 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10344 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
10347 (gnus-message 7 "No more articles"))
10348 (gnus-summary-recenter)
10349 (gnus-summary-position-point)
10352 (defun gnus-summary-unmark-as-processable (n)
10353 "Remove the process mark from the next N articles.
10354 If N is negative, unmark backward instead. The difference between N and
10355 the actual number of articles unmarked is returned."
10357 (gnus-summary-mark-as-processable n t
))
10359 (defun gnus-summary-unmark-all-processable ()
10360 "Remove the process mark from all articles."
10363 (while gnus-newsgroup-processable
10364 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
10365 (gnus-summary-position-point))
10367 (defun gnus-summary-add-mark (article type
)
10368 "Mark ARTICLE with a mark of TYPE."
10369 (let ((vtype (car (assq type gnus-article-mark-lists
)))
10372 (error "No such mark type: %s" type
)
10373 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
10374 (set var
(cons article
(symbol-value var
)))
10375 (if (memq type
'(processable cached replied forwarded recent saved
))
10376 (gnus-summary-update-secondary-mark article
)
10377 ;;; !!! This is bogus. We should find out what primary
10378 ;;; !!! mark we want to set.
10379 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
10381 (defun gnus-summary-mark-as-expirable (n)
10382 "Mark N articles forward as expirable.
10383 If N is negative, mark backward instead. The difference between N and
10384 the actual number of articles marked is returned."
10386 (gnus-summary-mark-forward n gnus-expirable-mark
))
10388 (defun gnus-summary-mark-as-spam (n)
10389 "Mark N articles forward as spam.
10390 If N is negative, mark backward instead. The difference between N and
10391 the actual number of articles marked is returned."
10393 (gnus-summary-mark-forward n gnus-spam-mark
))
10395 (defun gnus-summary-mark-article-as-replied (article)
10396 "Mark ARTICLE as replied to and update the summary line.
10397 ARTICLE can also be a list of articles."
10398 (interactive (list (gnus-summary-article-number)))
10399 (let ((articles (if (listp article
) article
(list article
))))
10400 (dolist (article articles
)
10401 (unless (numberp article
)
10402 (error "%s is not a number" article
))
10403 (push article gnus-newsgroup-replied
)
10404 (let ((inhibit-read-only t
))
10405 (when (gnus-summary-goto-subject article nil t
)
10406 (gnus-summary-update-secondary-mark article
))))))
10408 (defun gnus-summary-mark-article-as-forwarded (article)
10409 "Mark ARTICLE as forwarded and update the summary line.
10410 ARTICLE can also be a list of articles."
10411 (let ((articles (if (listp article
) article
(list article
))))
10412 (dolist (article articles
)
10413 (push article gnus-newsgroup-forwarded
)
10414 (let ((inhibit-read-only t
))
10415 (when (gnus-summary-goto-subject article nil t
)
10416 (gnus-summary-update-secondary-mark article
))))))
10418 (defun gnus-summary-set-bookmark (article)
10419 "Set a bookmark in current article."
10420 (interactive (list (gnus-summary-article-number)))
10421 (when (or (not (get-buffer gnus-article-buffer
))
10422 (not gnus-current-article
)
10423 (not gnus-article-current
)
10424 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
10425 (error "No current article selected"))
10426 ;; Remove old bookmark, if one exists.
10427 (gnus-pull article gnus-newsgroup-bookmarks
)
10428 ;; Set the new bookmark, which is on the form
10429 ;; (article-number . line-number-in-body).
10432 (with-current-buffer gnus-article-buffer
10436 (article-goto-body)
10439 gnus-newsgroup-bookmarks
)
10440 (gnus-message 6 "A bookmark has been added to the current article."))
10442 (defun gnus-summary-remove-bookmark (article)
10443 "Remove the bookmark from the current article."
10444 (interactive (list (gnus-summary-article-number)))
10445 ;; Remove old bookmark, if one exists.
10446 (if (not (assq article gnus-newsgroup-bookmarks
))
10447 (gnus-message 6 "No bookmark in current article.")
10448 (gnus-pull article gnus-newsgroup-bookmarks
)
10449 (gnus-message 6 "Removed bookmark.")))
10451 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10452 (defun gnus-summary-mark-as-dormant (n)
10453 "Mark N articles forward as dormant.
10454 If N is negative, mark backward instead. The difference between N and
10455 the actual number of articles marked is returned."
10457 (gnus-summary-mark-forward n gnus-dormant-mark
))
10459 (defun gnus-summary-set-process-mark (article)
10460 "Set the process mark on ARTICLE and update the summary line."
10461 (setq gnus-newsgroup-processable
10463 (delq article gnus-newsgroup-processable
)))
10464 (when (gnus-summary-goto-subject article
)
10465 (gnus-summary-show-thread)
10466 (gnus-summary-goto-subject article
)
10467 (gnus-summary-update-secondary-mark article
)))
10469 (defun gnus-summary-remove-process-mark (&rest articles
)
10470 "Remove the process mark from ARTICLES and update the summary line."
10471 (dolist (article articles
)
10472 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
10473 (when (gnus-summary-goto-subject article
)
10474 (gnus-summary-show-thread)
10475 (gnus-summary-goto-subject article
)
10476 (gnus-summary-update-secondary-mark article
)))
10479 (defun gnus-summary-set-saved-mark (article)
10480 "Set the process mark on ARTICLE and update the summary line."
10481 (push article gnus-newsgroup-saved
)
10482 (when (gnus-summary-goto-subject article
)
10483 (gnus-summary-update-secondary-mark article
)))
10485 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
10486 "Mark N articles as read forwards.
10487 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10488 The difference between N and the actual number of articles marked is
10490 If NO-EXPIRE, auto-expiry will be inhibited."
10492 (gnus-summary-show-thread)
10493 (let ((backward (< n
0))
10494 (gnus-summary-goto-unread
10495 (and gnus-summary-goto-unread
10496 (not (eq gnus-summary-goto-unread
'never
))
10497 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
10498 gnus-ticked-mark gnus-dormant-mark
)))))
10500 (mark (or mark gnus-del-mark
)))
10501 (while (and (> n
0)
10502 (gnus-summary-mark-article nil mark no-expire
)
10503 (zerop (gnus-summary-next-subject
10505 (and gnus-summary-goto-unread
10506 (not (eq gnus-summary-goto-unread
'never
)))
10510 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
10511 (gnus-summary-recenter)
10512 (gnus-summary-position-point)
10513 (gnus-set-mode-line 'summary
)
10516 (defun gnus-summary-mark-article-as-read (mark)
10517 "Mark the current article quickly as read with MARK."
10518 (let ((article (gnus-summary-article-number)))
10519 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10520 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10521 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10522 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10523 (push (cons article mark
) gnus-newsgroup-reads
)
10524 ;; Possibly remove from cache, if that is used.
10525 (when gnus-use-cache
10526 (gnus-cache-enter-remove-article article
))
10527 ;; Allow the backend to change the mark.
10528 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10529 ;; Check for auto-expiry.
10530 (when (and gnus-newsgroup-auto-expire
10531 (memq mark gnus-auto-expirable-marks
))
10532 (setq mark gnus-expirable-mark
)
10533 ;; Let the backend know about the mark change.
10534 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10535 (push article gnus-newsgroup-expirable
))
10536 ;; Set the mark in the buffer.
10537 (gnus-summary-update-mark mark
'unread
)
10540 (defun gnus-summary-mark-article-as-unread (mark)
10541 "Mark the current article quickly as unread with MARK."
10542 (let* ((article (gnus-summary-article-number))
10543 (old-mark (gnus-summary-article-mark article
)))
10544 ;; Allow the backend to change the mark.
10545 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10546 (if (eq mark old-mark
)
10550 (gnus-error 1 "Can't mark negative article numbers")
10552 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10553 (setq gnus-newsgroup-spam-marked
10554 (delq article gnus-newsgroup-spam-marked
))
10555 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10556 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
10557 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
10558 (cond ((= mark gnus-ticked-mark
)
10559 (setq gnus-newsgroup-marked
10560 (gnus-add-to-sorted-list gnus-newsgroup-marked
10562 ((= mark gnus-spam-mark
)
10563 (setq gnus-newsgroup-spam-marked
10564 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10566 ((= mark gnus-dormant-mark
)
10567 (setq gnus-newsgroup-dormant
10568 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10571 (setq gnus-newsgroup-unreads
10572 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10574 (gnus-pull article gnus-newsgroup-reads
)
10576 ;; See whether the article is to be put in the cache.
10577 (and gnus-use-cache
10578 (vectorp (gnus-summary-article-header article
))
10580 (gnus-cache-possibly-enter-article
10581 gnus-newsgroup-name article
10582 (= mark gnus-ticked-mark
)
10583 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10586 (gnus-summary-update-mark mark
'unread
)
10589 (defun gnus-summary-mark-article (&optional article mark no-expire
)
10590 "Mark ARTICLE with MARK. MARK can be any character.
10591 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10592 `??' (dormant) and `?E' (expirable).
10593 If MARK is nil, then the default character `?r' is used.
10594 If ARTICLE is nil, then the article on the current line will be
10596 If NO-EXPIRE, auto-expiry will be inhibited."
10597 ;; The mark might be a string.
10598 (when (stringp mark
)
10599 (setq mark
(aref mark
0)))
10600 ;; If no mark is given, then we check auto-expiring.
10602 (setq mark gnus-del-mark
))
10603 (when (and (not no-expire
)
10604 gnus-newsgroup-auto-expire
10605 (memq mark gnus-auto-expirable-marks
))
10606 (setq mark gnus-expirable-mark
))
10607 (let ((article (or article
(gnus-summary-article-number)))
10608 (old-mark (gnus-summary-article-mark article
)))
10609 ;; Allow the backend to change the mark.
10610 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10611 (if (eq mark old-mark
)
10614 (error "No article on current line"))
10615 (if (not (if (or (= mark gnus-unread-mark
)
10616 (= mark gnus-ticked-mark
)
10617 (= mark gnus-spam-mark
)
10618 (= mark gnus-dormant-mark
))
10619 (gnus-mark-article-as-unread article mark
)
10620 (gnus-mark-article-as-read article mark
)))
10622 ;; See whether the article is to be put in the cache.
10623 (and gnus-use-cache
10624 (not (= mark gnus-canceled-mark
))
10625 (vectorp (gnus-summary-article-header article
))
10627 (gnus-cache-possibly-enter-article
10628 gnus-newsgroup-name article
10629 (= mark gnus-ticked-mark
)
10630 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10632 (when (gnus-summary-goto-subject article nil t
)
10633 (let ((inhibit-read-only t
))
10634 (gnus-summary-show-thread)
10636 (gnus-summary-update-mark mark
'unread
)
10639 (defun gnus-summary-update-secondary-mark (article)
10640 "Update the secondary (read, process, cache) mark."
10641 (gnus-summary-update-mark
10642 (cond ((memq article gnus-newsgroup-processable
)
10644 ((memq article gnus-newsgroup-cached
)
10646 ((memq article gnus-newsgroup-replied
)
10648 ((memq article gnus-newsgroup-forwarded
)
10649 gnus-forwarded-mark
)
10650 ((memq article gnus-newsgroup-saved
)
10652 ((memq article gnus-newsgroup-recent
)
10654 ((memq article gnus-newsgroup-unseen
)
10658 (when (gnus-visual-p 'summary-highlight
'highlight
)
10659 (gnus-run-hooks 'gnus-summary-update-hook
))
10662 (defun gnus-summary-update-download-mark (article)
10663 "Update the download mark."
10664 (gnus-summary-update-mark
10665 (cond ((memq article gnus-newsgroup-undownloaded
)
10666 gnus-undownloaded-mark
)
10667 (gnus-newsgroup-agentized
10668 gnus-downloaded-mark
)
10672 (gnus-summary-update-line t
)
10675 (defun gnus-summary-update-mark (mark type
)
10676 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
10677 (inhibit-read-only t
))
10678 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit
)
10680 (when (looking-at "\r")
10682 (when (<= (+ forward
(point)) (point-max))
10683 ;; Go to the right position on the line.
10684 (goto-char (+ forward
(point)))
10685 ;; Replace the old mark with the new mark.
10686 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
10687 ;; Optionally update the marks by some user rule.
10688 (when (eq type
'unread
)
10689 (gnus-data-set-mark
10690 (gnus-data-find (gnus-summary-article-number)) mark
)
10691 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
10693 (defun gnus-mark-article-as-read (article &optional mark
)
10694 "Enter ARTICLE in the pertinent lists and remove it from others."
10695 ;; Make the article expirable.
10696 (let ((mark (or mark gnus-del-mark
)))
10697 (setq gnus-newsgroup-expirable
10698 (if (= mark gnus-expirable-mark
)
10699 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
10700 (delq article gnus-newsgroup-expirable
)))
10701 ;; Remove from unread and marked lists.
10702 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10703 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10704 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10705 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10706 (push (cons article mark
) gnus-newsgroup-reads
)
10707 ;; Possibly remove from cache, if that is used.
10708 (when gnus-use-cache
10709 (gnus-cache-enter-remove-article article
))
10712 (defun gnus-mark-article-as-unread (article &optional mark
)
10713 "Enter ARTICLE in the pertinent lists and remove it from others."
10714 (let ((mark (or mark gnus-ticked-mark
)))
10717 (gnus-error 1 "Can't mark negative article numbers")
10719 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10720 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10721 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10722 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10723 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10725 ;; Unsuppress duplicates?
10726 (when gnus-suppress-duplicates
10727 (gnus-dup-unsuppress-article article
))
10729 (cond ((= mark gnus-ticked-mark
)
10730 (setq gnus-newsgroup-marked
10731 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10732 ((= mark gnus-spam-mark
)
10733 (setq gnus-newsgroup-spam-marked
10734 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10736 ((= mark gnus-dormant-mark
)
10737 (setq gnus-newsgroup-dormant
10738 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10740 (setq gnus-newsgroup-unreads
10741 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10742 (gnus-pull article gnus-newsgroup-reads
)
10745 (defalias 'gnus-summary-mark-as-unread-forward
10746 'gnus-summary-tick-article-forward
)
10747 (make-obsolete 'gnus-summary-mark-as-unread-forward
10748 'gnus-summary-tick-article-forward
)
10749 (defun gnus-summary-tick-article-forward (n)
10750 "Tick N articles forwards.
10751 If N is negative, tick backwards instead.
10752 The difference between N and the number of articles ticked is returned."
10754 (gnus-summary-mark-forward n gnus-ticked-mark
))
10756 (defalias 'gnus-summary-mark-as-unread-backward
10757 'gnus-summary-tick-article-backward
)
10758 (make-obsolete 'gnus-summary-mark-as-unread-backward
10759 'gnus-summary-tick-article-backward
)
10760 (defun gnus-summary-tick-article-backward (n)
10761 "Tick N articles backwards.
10762 The difference between N and the number of articles ticked is returned."
10764 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10766 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10767 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10768 (defun gnus-summary-tick-article (&optional article clear-mark
)
10769 "Mark current article as unread.
10770 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10771 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10773 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10774 gnus-ticked-mark
)))
10776 (defun gnus-summary-mark-as-read-forward (n)
10777 "Mark N articles as read forwards.
10778 If N is negative, mark backwards instead.
10779 The difference between N and the actual number of articles marked is
10782 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10784 (defun gnus-summary-mark-as-read-backward (n)
10785 "Mark the N articles as read backwards.
10786 The difference between N and the actual number of articles marked is
10789 (gnus-summary-mark-forward
10790 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10792 (defun gnus-summary-mark-as-read (&optional article mark
)
10793 "Mark current article as read.
10794 ARTICLE specifies the article to be marked as read.
10795 MARK specifies a string to be inserted at the beginning of the line."
10796 (gnus-summary-mark-article article mark
))
10798 (defun gnus-summary-clear-mark-forward (n)
10799 "Clear marks from N articles forward.
10800 If N is negative, clear backward instead.
10801 The difference between N and the number of marks cleared is returned."
10803 (gnus-summary-mark-forward n gnus-unread-mark
))
10805 (defun gnus-summary-clear-mark-backward (n)
10806 "Clear marks from N articles backward.
10807 The difference between N and the number of marks cleared is returned."
10809 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
10811 (defun gnus-summary-mark-unread-as-read ()
10812 "Intended to be used by `gnus-mark-article-hook'."
10813 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10814 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10816 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10817 "Intended to be used by `gnus-mark-article-hook'."
10818 (let ((mark (gnus-summary-article-mark)))
10819 (when (or (gnus-unread-mark-p mark
)
10820 (gnus-read-mark-p mark
))
10821 (gnus-summary-mark-article gnus-current-article
10822 (or new-mark gnus-read-mark
)))))
10824 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10825 "Intended to be used by `gnus-mark-article-hook'."
10826 (let ((mark (gnus-summary-article-mark)))
10827 (when (or (gnus-unread-mark-p mark
)
10828 (gnus-read-mark-p mark
))
10829 (gnus-summary-mark-article (gnus-summary-article-number)
10830 (or new-mark gnus-read-mark
)))))
10832 (defun gnus-summary-mark-unread-as-ticked ()
10833 "Intended to be used by `gnus-mark-article-hook'."
10834 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10835 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10837 (defun gnus-summary-mark-region-as-read (point mark all
)
10838 "Mark all unread articles between point and mark as read.
10839 If given a prefix, mark all articles between point and mark as read,
10840 even ticked and dormant ones."
10841 (interactive "r\nP")
10845 (beginning-of-line)
10850 (memq (setq article
(gnus-summary-article-number))
10851 gnus-newsgroup-unreads
))
10852 (gnus-summary-mark-article article gnus-del-mark
))
10854 (gnus-summary-find-next))))))
10856 (defun gnus-summary-mark-below (score mark
)
10857 "Mark articles with score less than SCORE with MARK."
10858 (interactive "P\ncMark: ")
10859 (setq score
(if score
10860 (prefix-numeric-value score
)
10861 (or gnus-summary-default-score
0)))
10862 (with-current-buffer gnus-summary-buffer
10863 (goto-char (point-min))
10866 (and (< (gnus-summary-article-score) score
)
10867 (gnus-summary-mark-article nil mark
))
10868 (gnus-summary-find-next)))))
10870 (defun gnus-summary-kill-below (&optional score
)
10871 "Mark articles with score below SCORE as read."
10873 (gnus-summary-mark-below score gnus-killed-mark
))
10875 (defun gnus-summary-clear-above (&optional score
)
10876 "Clear all marks from articles with score above SCORE."
10878 (gnus-summary-mark-above score gnus-unread-mark
))
10880 (defun gnus-summary-tick-above (&optional score
)
10881 "Tick all articles with score above SCORE."
10883 (gnus-summary-mark-above score gnus-ticked-mark
))
10885 (defun gnus-summary-mark-above (score mark
)
10886 "Mark articles with score over SCORE with MARK."
10887 (interactive "P\ncMark: ")
10888 (setq score
(if score
10889 (prefix-numeric-value score
)
10890 (or gnus-summary-default-score
0)))
10891 (with-current-buffer gnus-summary-buffer
10892 (goto-char (point-min))
10894 (when (> (gnus-summary-article-score) score
)
10895 (gnus-summary-mark-article nil mark
))
10897 (gnus-summary-find-next)))))
10899 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10900 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10901 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10902 "Display all the hidden articles that were expunged for low scores."
10904 (let ((inhibit-read-only t
))
10905 (let ((scored gnus-newsgroup-scored
)
10908 (unless (gnus-summary-article-header (caar scored
))
10909 (and (setq h
(gnus-number-to-header (caar scored
)))
10910 (< (cdar scored
) gnus-summary-expunge-below
)
10912 (setq scored
(cdr scored
)))
10914 (when (not no-error
)
10915 (error "No expunged articles hidden"))
10916 (goto-char (point-min))
10917 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
10918 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
10919 (dolist (x headers
)
10920 (push (mail-header-number x
) gnus-newsgroup-limit
))
10921 (gnus-summary-prepare-unthreaded (nreverse headers
))
10922 (goto-char (point-min))
10923 (gnus-summary-position-point)
10926 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
10927 "Mark all unread articles in this newsgroup as read.
10928 If prefix argument ALL is non-nil, ticked and dormant articles will
10929 also be marked as read.
10930 If QUIETLY is non-nil, no questions will be asked.
10932 If TO-HERE is non-nil, it should be a point in the buffer. All
10933 articles before (after, if REVERSE is set) this point will be marked
10936 Note that this function will only catch up the unread article
10937 in the current summary buffer limitation.
10939 The number of articles marked as read is returned."
10944 (not gnus-interactive-catchup
) ;Without confirmation?
10948 "Mark absolutely all articles as read? "
10949 "Mark all unread articles as read? ")))
10951 (not gnus-newsgroup-adaptive
)
10952 (not gnus-newsgroup-auto-expire
)
10953 (not gnus-suppress-duplicates
)
10954 (or (not gnus-use-cache
)
10955 (eq gnus-use-cache
'passive
)))
10958 (setq gnus-newsgroup-marked nil
10959 gnus-newsgroup-spam-marked nil
10960 gnus-newsgroup-dormant nil
))
10961 (setq gnus-newsgroup-unreads
10962 (gnus-sorted-nunion
10963 (gnus-sorted-intersection gnus-newsgroup-unreads
10964 gnus-newsgroup-downloadable
)
10965 (gnus-sorted-difference gnus-newsgroup-unfetched
10966 gnus-newsgroup-cached
))))
10967 ;; We actually mark all articles as canceled, which we
10968 ;; have to do when using auto-expiry or adaptive scoring.
10969 (gnus-summary-show-all-threads)
10970 (if (and to-here reverse
)
10972 (goto-char to-here
)
10973 (gnus-summary-mark-current-read-and-unread-as-read
10975 (while (gnus-summary-find-next (not all
))
10976 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
10977 (when (gnus-summary-first-subject (not all
))
10979 (if to-here
(< (point) to-here
) t
)
10980 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
10981 (gnus-summary-find-next (not all
))))))
10982 (gnus-set-mode-line 'summary
))
10984 (gnus-summary-position-point)))
10986 (defun gnus-summary-catchup-to-here (&optional all
)
10987 "Mark all unticked articles before the current one as read.
10988 If ALL is non-nil, also mark ticked and dormant articles as read."
10991 (gnus-save-hidden-threads
10992 (let ((beg (point)))
10993 ;; We check that there are unread articles.
10994 (when (or all
(gnus-summary-find-prev))
10995 (gnus-summary-catchup all t beg
)))))
10996 (gnus-summary-position-point))
10998 (defun gnus-summary-catchup-from-here (&optional all
)
10999 "Mark all unticked articles after (and including) the current one as read.
11000 If ALL is non-nil, also mark ticked and dormant articles as read."
11003 (gnus-save-hidden-threads
11004 (let ((beg (point)))
11005 ;; We check that there are unread articles.
11006 (when (or all
(gnus-summary-find-next))
11007 (gnus-summary-catchup all t beg nil t
)))))
11008 (gnus-summary-position-point))
11010 (defun gnus-summary-catchup-all (&optional quietly
)
11011 "Mark all articles in this newsgroup as read.
11012 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11013 instead, which marks only unread articles as read."
11015 (gnus-summary-catchup t quietly
))
11017 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
11018 "Mark all unread articles in this group as read, then exit.
11019 If prefix argument ALL is non-nil, all articles are marked as read.
11020 If QUIETLY is non-nil, no questions will be asked."
11022 (when (gnus-summary-catchup all quietly nil
'fast
)
11023 ;; Select next newsgroup or exit.
11024 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
11025 (eq gnus-auto-select-next
'quietly
))
11026 (gnus-summary-next-group nil
)
11027 (gnus-summary-exit))))
11029 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
11030 "Mark all articles in this newsgroup as read, and then exit.
11031 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11032 instead, which marks only unread articles as read."
11034 (gnus-summary-catchup-and-exit t quietly
))
11036 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
11037 "Mark all articles in this group as read and select the next group.
11038 If given a prefix, mark all articles, unread as well as ticked, as
11042 (gnus-summary-catchup all
))
11043 (gnus-summary-next-group))
11045 (defun gnus-summary-catchup-and-goto-prev-group (&optional all
)
11046 "Mark all articles in this group as read and select the previous group.
11047 If given a prefix, mark all articles, unread as well as ticked, as
11051 (gnus-summary-catchup all
))
11052 (gnus-summary-next-group nil nil t
))
11058 (defmacro gnus-with-article
(article &rest forms
)
11059 "Select ARTICLE and perform FORMS in the original article buffer.
11060 Then replace the article with the result."
11062 ;; We don't want the article to be marked as read.
11063 (let (gnus-mark-article-hook)
11064 (gnus-summary-select-article t t nil
,article
))
11065 (set-buffer gnus-original-article-buffer
)
11067 (if (not (gnus-check-backend-function
11068 'request-replace-article
(car gnus-article-current
)))
11069 (gnus-message 5 "Read-only group; not replacing")
11070 (unless (gnus-request-replace-article
11071 ,article
(car gnus-article-current
)
11072 (current-buffer) t
)
11073 (error "Couldn't replace article")))
11074 ;; The cache and backlog have to be flushed somewhat.
11075 (when gnus-keep-backlog
11076 (gnus-backlog-remove-article
11077 (car gnus-article-current
) (cdr gnus-article-current
)))
11078 (when gnus-use-cache
11079 (gnus-cache-update-article
11080 (car gnus-article-current
) (cdr gnus-article-current
)))))
11082 (put 'gnus-with-article
'lisp-indent-function
1)
11083 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
11085 ;; Thread-based commands.
11087 (defun gnus-summary-articles-in-thread (&optional article
)
11088 "Return a list of all articles in the current thread.
11089 If ARTICLE is non-nil, return all articles in the thread that starts
11090 with that article."
11091 (let* ((article (or article
(gnus-summary-article-number)))
11092 (data (gnus-data-find-list article
))
11093 (top-level (gnus-data-level (car data
)))
11095 (cond ((null gnus-thread-operation-ignore-subject
)
11096 (gnus-simplify-subject-re
11097 (mail-header-subject (gnus-data-header (car data
)))))
11098 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
11099 (gnus-simplify-subject-fuzzy
11100 (mail-header-subject (gnus-data-header (car data
)))))
11102 (end-point (save-excursion
11103 (if (gnus-summary-go-to-next-thread)
11104 (point) (point-max))))
11107 (< (gnus-data-pos (car data
)) end-point
))
11108 (when (or (not top-subject
)
11109 (string= top-subject
11110 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
11111 (gnus-simplify-subject-fuzzy
11112 (mail-header-subject
11113 (gnus-data-header (car data
))))
11114 (gnus-simplify-subject-re
11115 (mail-header-subject
11116 (gnus-data-header (car data
)))))))
11117 (push (gnus-data-number (car data
)) articles
))
11118 (unless (and (setq data
(cdr data
))
11119 (> (gnus-data-level (car data
)) top-level
))
11121 ;; Return the list of articles.
11122 (nreverse articles
)))
11124 (defun gnus-summary-rethread-current ()
11125 "Rethread the thread the current article is part of."
11127 (let* ((gnus-show-threads t
)
11128 (article (gnus-summary-article-number))
11129 (id (mail-header-id (gnus-summary-article-header)))
11130 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
11132 (error "No article on the current line"))
11133 (gnus-rebuild-thread id
)
11134 (gnus-summary-goto-subject article
)))
11136 (defun gnus-summary-reparent-thread ()
11137 "Make the current article child of the marked (or previous) article.
11139 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11140 is non-nil or the Subject: of both articles are the same."
11142 (unless (not (gnus-group-read-only-p))
11143 (error "The current newsgroup does not support article editing"))
11144 (unless (<= (length gnus-newsgroup-processable
) 1)
11145 (error "No more than one article may be marked"))
11146 (let ((child (gnus-summary-article-number))
11147 ;; First grab the marked article, otherwise one line up.
11148 (parent (if (not (null gnus-newsgroup-processable
))
11149 (car gnus-newsgroup-processable
)
11151 (if (eq (forward-line -
1) 0)
11152 (gnus-summary-article-number)
11153 (error "Beginning of summary buffer"))))))
11154 (gnus-summary-reparent-children parent
(list child
))))
11156 (defun gnus-summary-reparent-children (parent children
)
11157 "Make PARENT the parent of CHILDREN.
11158 When called interactively, PARENT is the current article and CHILDREN
11159 are the process-marked articles."
11161 (list (gnus-summary-article-number)
11162 (gnus-summary-work-articles nil
)))
11163 (dolist (child children
)
11164 (save-window-excursion
11165 (let ((gnus-article-buffer " *reparent*"))
11166 (unless (not (eq parent child
))
11167 (error "An article may not be self-referential"))
11168 (let ((message-id (mail-header-id
11169 (gnus-summary-article-header parent
))))
11170 (unless (and message-id
(not (equal message-id
"")))
11171 (error "No message-id in desired parent"))
11172 (gnus-with-article child
11174 (goto-char (point-min))
11175 (message-narrow-to-head)
11176 (if (re-search-forward "^References: " nil t
)
11178 (re-search-forward "^[^ \t]" nil t
)
11181 (insert " " message-id
))
11182 (insert "References: " message-id
"\n"))))
11183 (set-buffer gnus-summary-buffer
)
11184 (gnus-summary-unmark-all-processable)
11185 (gnus-summary-update-article child
)
11186 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
11187 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
11188 (gnus-summary-rethread-current)
11189 (gnus-message 3 "Article %d is now the child of article %d"
11192 (defun gnus-summary-toggle-threads (&optional arg
)
11193 "Toggle showing conversation threads.
11194 If ARG is positive number, turn showing conversation threads on."
11196 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
11197 (setq gnus-show-threads
11198 (if (null arg
) (not gnus-show-threads
)
11199 (> (prefix-numeric-value arg
) 0)))
11200 (gnus-summary-prepare)
11201 (gnus-summary-goto-subject current
)
11202 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
11203 (gnus-summary-position-point)))
11205 (defun gnus-summary-show-all-threads ()
11206 "Show all threads."
11209 (let ((buffer-read-only nil
))
11210 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
11211 (gnus-summary-position-point))
11213 (defun gnus-summary-show-thread ()
11214 "Show thread subtrees.
11215 Returns nil if no thread was there to be shown."
11217 (let ((buffer-read-only nil
)
11219 (end (point-at-eol))
11220 ;; Leave point at bol
11221 (beg (progn (beginning-of-line) (point))))
11223 ;; Any hidden lines here?
11224 (search-forward "\r" end t
)
11225 (subst-char-in-region beg end ?\^M ?
\n t
)
11227 (gnus-summary-position-point))))
11229 (defun gnus-summary-maybe-hide-threads ()
11230 "If requested, hide the threads that should be hidden."
11231 (when (and gnus-show-threads
11232 gnus-thread-hide-subtree
)
11233 (gnus-summary-hide-all-threads
11234 (if (or (consp gnus-thread-hide-subtree
)
11235 (functionp gnus-thread-hide-subtree
))
11236 (gnus-make-predicate gnus-thread-hide-subtree
)
11239 ;;; Hiding predicates.
11241 (defun gnus-article-unread-p (header)
11242 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
11244 (defun gnus-article-unseen-p (header)
11245 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
11247 (defun gnus-map-articles (predicate articles
)
11248 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11249 (apply 'gnus-or
(mapcar predicate
11250 (mapcar (lambda (number)
11251 (gnus-summary-article-header number
))
11254 (defun gnus-summary-hide-all-threads (&optional predicate
)
11255 "Hide all thread subtrees.
11256 If PREDICATE is supplied, threads that satisfy this predicate
11257 will not be hidden."
11260 (goto-char (point-min))
11263 (when (or (not predicate
)
11265 predicate
(gnus-summary-article-children)))
11266 (gnus-summary-hide-thread))
11267 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
11268 (gnus-summary-position-point))
11270 (defun gnus-summary-hide-thread ()
11271 "Hide thread subtrees.
11272 If PREDICATE is supplied, threads that satisfy this predicate
11273 will not be hidden.
11274 Returns nil if no threads were there to be hidden."
11276 (let ((buffer-read-only nil
)
11278 (article (gnus-summary-article-number)))
11280 ;; Go forward until either the buffer ends or the subthread ends.
11281 (when (and (not (eobp))
11282 (or (zerop (gnus-summary-next-thread 1 t
))
11283 (goto-char (point-max))))
11285 (if (and (> (point) start
)
11286 (search-backward "\n" start t
))
11288 (subst-char-in-region start
(point) ?
\n ?\^M
)
11289 (gnus-summary-goto-subject article
))
11293 (defun gnus-summary-go-to-next-thread (&optional previous
)
11294 "Go to the same level (or less) next thread.
11295 If PREVIOUS is non-nil, go to previous thread instead.
11296 Return the article number moved to, or nil if moving was impossible."
11297 (let ((level (gnus-summary-thread-level))
11298 (way (if previous -
1 1))
11301 (while (and (not (eobp))
11302 (< level
(gnus-summary-thread-level)))
11303 (forward-line way
))
11310 (gnus-summary-article-number)
11311 (goto-char beg
)))))
11313 (defun gnus-summary-next-thread (n &optional silent
)
11314 "Go to the same level next N'th thread.
11315 If N is negative, search backward instead.
11316 Returns the difference between N and the number of skips actually
11319 If SILENT, don't output messages."
11321 (let ((backward (< n
0))
11323 (while (and (> n
0)
11324 (gnus-summary-go-to-next-thread backward
))
11327 (gnus-summary-position-point))
11328 (when (and (not silent
) (/= 0 n
))
11329 (gnus-message 7 "No more threads"))
11332 (defun gnus-summary-prev-thread (n)
11333 "Go to the same level previous N'th thread.
11334 Returns the difference between N and the number of skips actually
11337 (gnus-summary-next-thread (- n
)))
11339 (defun gnus-summary-go-down-thread ()
11340 "Go down one level in the current thread."
11341 (let ((children (gnus-summary-article-children)))
11343 (gnus-summary-goto-subject (car children
)))))
11345 (defun gnus-summary-go-up-thread ()
11346 "Go up one level in the current thread."
11347 (let ((parent (gnus-summary-article-parent)))
11349 (gnus-summary-goto-subject parent
))))
11351 (defun gnus-summary-down-thread (n)
11352 "Go down thread N steps.
11353 If N is negative, go up instead.
11354 Returns the difference between N and how many steps down that were
11359 (while (and (> n
0)
11360 (if up
(gnus-summary-go-up-thread)
11361 (gnus-summary-go-down-thread)))
11363 (gnus-summary-position-point)
11365 (gnus-message 7 "Can't go further"))
11368 (defun gnus-summary-up-thread (n)
11369 "Go up thread N steps.
11370 If N is negative, go down instead.
11371 Returns the difference between N and how many steps down that were
11374 (gnus-summary-down-thread (- n
)))
11376 (defun gnus-summary-top-thread ()
11377 "Go to the top of the thread."
11379 (while (gnus-summary-go-up-thread))
11380 (gnus-summary-article-number))
11382 (defun gnus-summary-expire-thread ()
11383 "Mark articles under current thread as expired."
11385 (gnus-summary-kill-thread 0))
11387 (defun gnus-summary-kill-thread (&optional unmark
)
11388 "Mark articles under current thread as read.
11389 If the prefix argument is positive, remove any kinds of marks.
11390 If the prefix argument is zero, mark thread as expired.
11391 If the prefix argument is negative, tick articles instead."
11394 (setq unmark
(prefix-numeric-value unmark
)))
11395 (let ((articles (gnus-summary-articles-in-thread))
11396 (hide (or (null unmark
) (= unmark
0))))
11398 ;; Expand the thread.
11399 (gnus-summary-show-thread)
11400 ;; Mark all the articles.
11402 (gnus-summary-goto-subject (car articles
))
11403 (cond ((null unmark
)
11404 (gnus-summary-mark-article-as-read gnus-killed-mark
))
11406 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
11408 (gnus-summary-mark-article-as-unread gnus-expirable-mark
))
11410 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
11411 (setq articles
(cdr articles
))))
11412 ;; Hide killed subtrees when hide is true.
11414 gnus-thread-hide-killed
11415 (gnus-summary-hide-thread))
11416 ;; If hide is t, go to next unread subject.
11418 ;; Go to next unread subject.
11419 (gnus-summary-next-subject 1 t
)))
11420 (gnus-set-mode-line 'summary
))
11422 ;; Summary sorting commands
11424 (defun gnus-summary-sort-by-number (&optional reverse
)
11425 "Sort the summary buffer by article number.
11426 Argument REVERSE means reverse order."
11428 (gnus-summary-sort 'number reverse
))
11430 (defun gnus-summary-sort-by-random (&optional reverse
)
11431 "Randomize the order in the summary buffer.
11432 Argument REVERSE means to randomize in reverse order."
11434 (gnus-summary-sort 'random reverse
))
11436 (defun gnus-summary-sort-by-author (&optional reverse
)
11437 "Sort the summary buffer by author name alphabetically.
11438 If `case-fold-search' is non-nil, case of letters is ignored.
11439 Argument REVERSE means reverse order."
11441 (gnus-summary-sort 'author reverse
))
11443 (defun gnus-summary-sort-by-recipient (&optional reverse
)
11444 "Sort the summary buffer by recipient name alphabetically.
11445 If `case-fold-search' is non-nil, case of letters is ignored.
11446 Argument REVERSE means reverse order."
11448 (gnus-summary-sort 'recipient reverse
))
11450 (defun gnus-summary-sort-by-subject (&optional reverse
)
11451 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11452 If `case-fold-search' is non-nil, case of letters is ignored.
11453 Argument REVERSE means reverse order."
11455 (gnus-summary-sort 'subject reverse
))
11457 (defun gnus-summary-sort-by-date (&optional reverse
)
11458 "Sort the summary buffer by date.
11459 Argument REVERSE means reverse order."
11461 (gnus-summary-sort 'date reverse
))
11463 (defun gnus-summary-sort-by-score (&optional reverse
)
11464 "Sort the summary buffer by score.
11465 Argument REVERSE means reverse order."
11467 (gnus-summary-sort 'score reverse
))
11469 (defun gnus-summary-sort-by-lines (&optional reverse
)
11470 "Sort the summary buffer by the number of lines.
11471 Argument REVERSE means reverse order."
11473 (gnus-summary-sort 'lines reverse
))
11475 (defun gnus-summary-sort-by-chars (&optional reverse
)
11476 "Sort the summary buffer by article length.
11477 Argument REVERSE means reverse order."
11479 (gnus-summary-sort 'chars reverse
))
11481 (defun gnus-summary-sort-by-original (&optional reverse
)
11482 "Sort the summary buffer using the default sorting method.
11483 Argument REVERSE means reverse order."
11485 (let* ((inhibit-read-only t
)
11486 (gnus-summary-prepare-hook nil
))
11487 ;; We do the sorting by regenerating the threads.
11488 (gnus-summary-prepare)
11489 ;; Hide subthreads if needed.
11490 (gnus-summary-maybe-hide-threads)))
11492 (defun gnus-summary-sort (predicate reverse
)
11493 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11494 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
11495 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
11496 (gnus-thread-sort-functions
11501 (gnus-sort-gathered-threads-function
11502 gnus-thread-sort-functions
)
11503 (gnus-article-sort-functions
11507 (,article t2 t1
))))
11508 (inhibit-read-only t
)
11509 (gnus-summary-prepare-hook nil
))
11510 ;; We do the sorting by regenerating the threads.
11511 (gnus-summary-prepare)
11512 ;; Hide subthreads if needed.
11513 (gnus-summary-maybe-hide-threads)))
11515 ;; Summary saving commands.
11517 (defun gnus-summary-save-article (&optional n not-saved
)
11518 "Save the current article using the default saver function.
11519 If N is a positive number, save the N next articles.
11520 If N is a negative number, save the N previous articles.
11521 If N is nil and any articles have been marked with the process mark,
11522 save those articles instead.
11523 The variable `gnus-default-article-saver' specifies the saver function.
11525 If the optional second argument NOT-SAVED is non-nil, articles saved
11526 will not be marked as saved."
11528 (require 'gnus-art
)
11529 (let* ((articles (gnus-summary-work-articles n
))
11530 (save-buffer (save-excursion
11531 (nnheader-set-temp-buffer " *Gnus Save*")))
11532 (num (length articles
))
11533 ;; Whether to save decoded articles or raw articles.
11534 (decode (when gnus-article-save-coding-system
11535 (get gnus-default-article-saver
:decode
)))
11536 ;; When saving many articles in a single file, use the other
11537 ;; function to save articles other than the first one.
11538 (saver2 (get gnus-default-article-saver
:function
))
11539 (gnus-prompt-before-saving (if saver2
11541 gnus-prompt-before-saving
))
11542 (gnus-default-article-saver gnus-default-article-saver
)
11544 (dolist (article articles
)
11545 (setq header
(gnus-summary-article-header article
))
11546 (if (not (vectorp header
))
11547 ;; This is a pseudo-article.
11548 (if (assq 'name header
)
11549 (gnus-copy-file (cdr (assq 'name header
)))
11550 (gnus-message 1 "Article %d is unsaveable" article
))
11551 ;; This is a real article.
11552 (save-window-excursion
11553 (let ((gnus-display-mime-function (when decode
11554 gnus-display-mime-function
))
11555 (gnus-article-prepare-hook (when decode
11556 gnus-article-prepare-hook
)))
11557 (gnus-summary-select-article t nil nil article
)
11558 (gnus-summary-goto-subject article
)))
11559 (with-current-buffer save-buffer
11561 (insert-buffer-substring (if decode
11562 gnus-article-buffer
11563 gnus-original-article-buffer
)))
11564 (setq file
(gnus-article-save save-buffer file num
))
11565 (gnus-summary-remove-process-mark article
)
11567 (gnus-summary-set-saved-mark article
)))
11569 (setq gnus-default-article-saver saver2
11571 (gnus-kill-buffer save-buffer
)
11572 (gnus-summary-position-point)
11573 (gnus-set-mode-line 'summary
)
11576 (defun gnus-summary-pipe-output (&optional arg headers
)
11577 "Pipe the current article to a subprocess.
11578 If N is a positive number, pipe the N next articles.
11579 If N is a negative number, pipe the N previous articles.
11580 If N is nil and any articles have been marked with the process mark,
11581 pipe those articles instead.
11582 If HEADERS (the symbolic prefix), include the headers, too."
11583 (interactive (gnus-interactive "P\ny"))
11584 (require 'gnus-art
)
11585 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
)
11586 (gnus-save-all-headers (or headers gnus-save-all-headers
)))
11587 (gnus-summary-save-article arg t
))
11588 (let ((buffer (get-buffer "*Shell Command Output*")))
11590 (not (zerop (buffer-size buffer
))))
11591 (gnus-configure-windows 'pipe
))))
11593 (defun gnus-summary-save-article-mail (&optional arg
)
11594 "Append the current article to a Unix mail box file.
11595 If N is a positive number, save the N next articles.
11596 If N is a negative number, save the N previous articles.
11597 If N is nil and any articles have been marked with the process mark,
11598 save those articles instead."
11600 (require 'gnus-art
)
11601 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
11602 (gnus-summary-save-article arg
)))
11604 (defun gnus-summary-save-article-rmail (&optional arg
)
11605 "Append the current article to an rmail file.
11606 If N is a positive number, save the N next articles.
11607 If N is a negative number, save the N previous articles.
11608 If N is nil and any articles have been marked with the process mark,
11609 save those articles instead."
11611 (require 'gnus-art
)
11612 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
11613 (gnus-summary-save-article arg
)))
11615 (defun gnus-summary-save-article-file (&optional arg
)
11616 "Append the current article to a file.
11617 If N is a positive number, save the N next articles.
11618 If N is a negative number, save the N previous articles.
11619 If N is nil and any articles have been marked with the process mark,
11620 save those articles instead."
11622 (require 'gnus-art
)
11623 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
11624 (gnus-summary-save-article arg
)))
11626 (defun gnus-summary-write-article-file (&optional arg
)
11627 "Write the current article to a file, deleting the previous file.
11628 If N is a positive number, save the N next articles.
11629 If N is a negative number, save the N previous articles.
11630 If N is nil and any articles have been marked with the process mark,
11631 save those articles instead."
11633 (require 'gnus-art
)
11634 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
11635 (gnus-summary-save-article arg
)))
11637 (defun gnus-summary-save-article-body-file (&optional arg
)
11638 "Append the current article body to a file.
11639 If N is a positive number, save the N next articles.
11640 If N is a negative number, save the N previous articles.
11641 If N is nil and any articles have been marked with the process mark,
11642 save those articles instead."
11644 (require 'gnus-art
)
11645 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
11646 (gnus-summary-save-article arg
)))
11648 (defun gnus-summary-write-article-body-file (&optional arg
)
11649 "Write the current article body to a file, deleting the previous file.
11650 If N is a positive number, save the N next articles.
11651 If N is a negative number, save the N previous articles.
11652 If N is nil and any articles have been marked with the process mark,
11653 save those articles instead."
11655 (require 'gnus-art
)
11656 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file
))
11657 (gnus-summary-save-article arg
)))
11659 (defun gnus-summary-muttprint (&optional arg
)
11660 "Print the current article using Muttprint.
11661 If N is a positive number, save the N next articles.
11662 If N is a negative number, save the N previous articles.
11663 If N is nil and any articles have been marked with the process mark,
11664 save those articles instead."
11666 (require 'gnus-art
)
11667 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
11668 (gnus-summary-save-article arg t
)))
11670 (defun gnus-summary-pipe-message (program)
11671 "Pipe the current article through PROGRAM."
11672 (interactive "sProgram: ")
11673 (gnus-summary-select-article)
11674 (let ((mail-header-separator ""))
11675 (gnus-eval-in-buffer-window gnus-article-buffer
11678 (let ((start (window-start))
11679 (inhibit-read-only t
))
11680 (message-pipe-buffer-body program
)
11681 (set-window-start (get-buffer-window (current-buffer)) start
))))))
11683 (defun gnus-get-split-value (methods)
11684 "Return a value based on the split METHODS."
11685 (let (split-name method result match
)
11687 (with-current-buffer gnus-original-article-buffer
11689 (nnheader-narrow-to-headers)
11690 (while (and methods
(not split-name
))
11691 (goto-char (point-min))
11692 (setq method
(pop methods
))
11693 (setq match
(car method
))
11696 ;; Regular expression.
11698 (re-search-forward match nil t
)))
11703 (setq result
(funcall match gnus-newsgroup-name
))))
11708 (setq result
(eval match
)))))
11709 (setq split-name
(cdr method
))
11710 (cond ((stringp result
)
11711 (push (expand-file-name
11712 result gnus-article-save-directory
)
11715 (setq split-name
(append result split-name
)))))))))
11716 (nreverse split-name
)))
11718 (defun gnus-valid-move-group-p (group)
11719 (and (boundp group
)
11720 (symbol-name group
)
11721 (symbol-value group
)
11722 (gnus-get-function (gnus-find-method-for-group
11723 (symbol-name group
)) 'request-accept-article t
)))
11725 (defun gnus-read-move-group-name (prompt default articles prefix
)
11726 "Read a group name."
11727 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
11728 (minibuffer-confirm-incomplete nil
) ; XEmacs
11732 (if (> (length articles
) 1)
11733 (format "these %d articles" (length articles
))
11736 (let (active group
)
11737 (when (or (null split-name
) (= 1 (length split-name
)))
11738 (setq active
(gnus-make-hashtable (length gnus-active-hashtb
)))
11739 (mapatoms (lambda (symbol)
11740 (setq group
(symbol-name symbol
))
11741 (when (string-match "[^\000-\177]" group
)
11742 (setq group
(gnus-group-decoded-name group
)))
11743 (set (intern group active
) group
))
11744 gnus-active-hashtb
))
11747 (gnus-completing-read-with-default
11748 default prom active
'gnus-valid-move-group-p nil prefix
11749 'gnus-group-history
))
11750 ((= 1 (length split-name
))
11751 (gnus-completing-read-with-default
11752 (car split-name
) prom active
'gnus-valid-move-group-p nil nil
11753 'gnus-group-history
))
11755 (gnus-completing-read-with-default
11756 nil prom
(mapcar 'list
(nreverse split-name
)) nil nil nil
11757 'gnus-group-history
)))))
11758 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
)))
11761 (if (or (string= to-newsgroup
"")
11762 (string= to-newsgroup prefix
))
11763 (setq to-newsgroup default
))
11764 (unless to-newsgroup
11765 (error "No group name entered"))
11766 (setq encoded
(mm-encode-coding-string
11768 (gnus-group-name-charset to-method to-newsgroup
)))
11769 (or (gnus-active encoded
)
11770 (gnus-activate-group encoded nil nil to-method
)
11771 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11773 (or (and (gnus-request-create-group encoded to-method
)
11774 (gnus-activate-group encoded nil nil to-method
)
11775 (gnus-subscribe-group encoded
))
11776 (error "Couldn't create group %s" to-newsgroup
)))
11777 (error "No such group: %s" to-newsgroup
))
11780 (defvar gnus-summary-save-parts-counter
)
11781 (declare-function mm-uu-dissect
"mm-uu" (&optional noheader mime-type
))
11783 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11784 "Save parts matching TYPE to DIR.
11785 If REVERSE, save parts that do not match TYPE."
11787 (list (read-string "Save parts of type: "
11788 (or (car gnus-summary-save-parts-type-history
)
11789 gnus-summary-save-parts-default-mime
)
11790 'gnus-summary-save-parts-type-history
)
11791 (setq gnus-summary-save-parts-last-directory
11792 (read-file-name "Save to directory: "
11793 gnus-summary-save-parts-last-directory
11795 current-prefix-arg
))
11796 (gnus-summary-iterate n
11797 (let ((gnus-display-mime-function nil
)
11798 (gnus-inhibit-treatment t
))
11799 (gnus-summary-select-article))
11800 (with-current-buffer gnus-article-buffer
11801 (let ((handles (or gnus-article-mime-handles
11802 (mm-dissect-buffer nil gnus-article-loose-mime
)
11803 (and gnus-article-emulate-mime
11805 (gnus-summary-save-parts-counter 1))
11807 (gnus-summary-save-parts-1 type dir handles reverse
)
11808 (unless gnus-article-mime-handles
;; Don't destroy this case.
11809 (mm-destroy-parts handles
)))))))
11811 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11812 (if (stringp (car handle
))
11813 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11816 (not (string-match type
(mm-handle-media-type handle
)))
11817 (string-match type
(mm-handle-media-type handle
)))
11818 (let ((file (expand-file-name
11820 mm-file-name-rewrite-functions
11821 (file-name-nondirectory
11823 (mail-content-type-get
11824 (mm-handle-disposition handle
) 'filename
)
11825 (mail-content-type-get
11826 (mm-handle-type handle
) 'name
)
11827 (format "%s.%d.%d" gnus-newsgroup-name
11828 (cdr gnus-article-current
)
11829 gnus-summary-save-parts-counter
))))
11831 (incf gnus-summary-save-parts-counter
)
11832 (unless (file-exists-p file
)
11833 (mm-save-part-to-file handle file
))))))
11835 ;; Summary extract commands
11837 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
11838 (let ((inhibit-read-only t
)
11839 (article (gnus-summary-article-number))
11841 (unless (gnus-summary-goto-subject article
)
11842 (error "No such article: %d" article
))
11843 (gnus-summary-position-point)
11844 ;; If all commands are to be bunched up on one line, we collect
11846 (unless gnus-view-pseudos-separately
11847 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
11850 (setq action
(cdr (assq 'action
(car ps
))))
11851 (setq files
(list (cdr (assq 'name
(car ps
)))))
11852 (while (and ps
(cdr ps
)
11853 (string= (or action
"1")
11854 (or (cdr (assq 'action
(cadr ps
))) "2")))
11855 (push (cdr (assq 'name
(cadr ps
))) files
)
11856 (setcdr ps
(cddr ps
)))
11858 (when (not (string-match "%s" action
))
11861 (when (assq 'execute
(car ps
))
11862 (setcdr (assq 'execute
(car ps
))
11863 (funcall (if (string-match "%s" action
)
11870 (shell-quote-argument f
)))
11872 (setq ps
(cdr ps
)))))
11873 (if (and gnus-view-pseudos
(not not-view
))
11875 (when (assq 'execute
(car pslist
))
11876 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
11877 (eq gnus-view-pseudos
'not-confirm
)))
11878 (setq pslist
(cdr pslist
)))
11881 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
11882 (gnus-summary-article-number)))
11883 (gnus-summary-goto-subject after-article
)
11886 (insert " " (file-name-nondirectory
11887 (cdr (assq 'name
(car pslist
))))
11888 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
11890 (forward-line -
1) ; back to `b'
11891 (gnus-add-text-properties
11892 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
11893 gnus-mouse-face-prop gnus-mouse-face
))
11895 after-article gnus-reffed-article-number
11896 gnus-unread-mark b
(car pslist
) 0 (- e b
))
11897 (setq gnus-newsgroup-unreads
11898 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11899 gnus-reffed-article-number
))
11900 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
11901 (setq pslist
(cdr pslist
)))))))
11903 (defun gnus-pseudos< (p1 p2
)
11904 (let ((c1 (cdr (assq 'action p1
)))
11905 (c2 (cdr (assq 'action p2
))))
11906 (and c1 c2
(string< c1 c2
))))
11908 (defun gnus-request-pseudo-article (props)
11909 (cond ((assq 'execute props
)
11910 (gnus-execute-command (cdr (assq 'execute props
)))))
11911 (let ((gnus-current-article (gnus-summary-article-number)))
11912 (gnus-run-hooks 'gnus-mark-article-hook
)))
11914 (defun gnus-execute-command (command &optional automatic
)
11916 (gnus-article-setup-buffer)
11917 (set-buffer gnus-article-buffer
)
11918 (setq buffer-read-only nil
)
11919 (let ((command (if automatic command
11920 (read-string "Command: " (cons command
0)))))
11922 (insert "$ " command
"\n\n")
11923 (if gnus-view-pseudo-asynchronously
11924 (start-process "gnus-execute" (current-buffer) shell-file-name
11925 shell-command-switch command
)
11926 (call-process shell-file-name nil t nil
11927 shell-command-switch command
)))))
11929 ;; Summary kill commands.
11931 (defun gnus-summary-edit-global-kill (article)
11932 "Edit the \"global\" kill file."
11933 (interactive (list (gnus-summary-article-number)))
11934 (gnus-group-edit-global-kill article
))
11936 (defun gnus-summary-edit-local-kill ()
11937 "Edit a local kill file applied to the current newsgroup."
11939 (setq gnus-current-headers
(gnus-summary-article-header))
11940 (gnus-group-edit-local-kill
11941 (gnus-summary-article-number) gnus-newsgroup-name
))
11943 ;;; Header reading.
11945 (defun gnus-read-header (id &optional header
)
11946 "Read the headers of article ID and enter them into the Gnus system."
11947 (let ((group gnus-newsgroup-name
)
11948 (gnus-override-method
11950 gnus-override-method
11951 (and (gnus-news-group-p gnus-newsgroup-name
)
11952 (car (gnus-refer-article-methods)))))
11954 ;; First we check to see whether the header in question is already
11957 ;; This is a Message-ID.
11958 (setq header
(or header
(gnus-id-to-header id
)))
11959 ;; This is an article number.
11960 (setq header
(or header
(gnus-summary-article-header id
))))
11962 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
11963 ;; We have found the header.
11965 ;; We have to really fetch the header to this article.
11966 (with-current-buffer nntp-server-buffer
11967 (when (setq where
(gnus-request-head id group
))
11968 (nnheader-fold-continuation-lines)
11969 (goto-char (point-max))
11971 (goto-char (point-min))
11975 ((cdr where
) (cdr where
))
11976 (header (mail-header-number header
))
11977 (t gnus-reffed-article-number
))
11979 (insert " Article retrieved.\n"))
11980 (if (or (not where
)
11981 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
11982 () ; Malformed head.
11983 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
11984 (when (and (stringp id
)
11986 (not (string= (gnus-group-real-name group
)
11988 (not (gnus-server-equal gnus-override-method
11989 (gnus-group-method group
)))))
11990 ;; If we fetched by Message-ID and the article came from
11991 ;; a different group (or server), we fudge some bogus
11992 ;; article numbers for this article.
11993 (mail-header-set-number header gnus-reffed-article-number
))
11994 (with-current-buffer gnus-summary-buffer
11995 (decf gnus-reffed-article-number
)
11996 (gnus-remove-header (mail-header-number header
))
11997 (push header gnus-newsgroup-headers
)
11998 (setq gnus-current-headers header
)
11999 (push (mail-header-number header
) gnus-newsgroup-limit
)))
12002 (defun gnus-remove-header (number)
12003 "Remove header NUMBER from `gnus-newsgroup-headers'."
12004 (if (and gnus-newsgroup-headers
12005 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
12006 (pop gnus-newsgroup-headers
)
12007 (let ((headers gnus-newsgroup-headers
))
12008 (while (and (cdr headers
)
12009 (not (= number
(mail-header-number (cadr headers
)))))
12011 (when (cdr headers
)
12012 (setcdr headers
(cddr headers
))))))
12015 ;;; summary highlights
12018 (defun gnus-highlight-selected-summary ()
12019 "Highlight selected article in summary buffer."
12020 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12021 (when gnus-summary-selected-face
12023 (let* ((beg (point-at-bol))
12024 (end (point-at-eol))
12025 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12026 (from (if (get-text-property beg gnus-mouse-face-prop
)
12028 (or (next-single-property-change
12029 beg gnus-mouse-face-prop nil end
)
12034 (or (next-single-property-change
12035 from gnus-mouse-face-prop nil end
)
12037 ;; If no mouse-face prop on line we will have to = from = end,
12038 ;; so we highlight the entire line instead.
12039 (when (= (+ to
2) from
)
12042 (if gnus-newsgroup-selected-overlay
12043 ;; Move old overlay.
12045 gnus-newsgroup-selected-overlay from to
(current-buffer))
12046 ;; Create new overlay.
12048 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
12049 'face gnus-summary-selected-face
))))))
12051 (defvar gnus-summary-highlight-line-cached nil
)
12052 (defvar gnus-summary-highlight-line-trigger nil
)
12054 (defun gnus-summary-highlight-line-0 ()
12055 (if (and (eq gnus-summary-highlight-line-trigger
12056 gnus-summary-highlight
)
12057 gnus-summary-highlight-line-cached
)
12058 gnus-summary-highlight-line-cached
12059 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12060 gnus-summary-highlight-line-cached
12061 (let* ((cond (list 'cond
))
12063 (list gnus-summary-highlight
))
12065 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
12069 (gnus-byte-compile (list 'lambda nil cond
))))))
12071 (defun gnus-summary-highlight-line ()
12072 "Highlight current line according to `gnus-summary-highlight'."
12073 (let* ((beg (point-at-bol))
12074 (article (or (gnus-summary-article-number) gnus-current-article
))
12075 (score (or (cdr (assq article
12076 gnus-newsgroup-scored
))
12077 gnus-summary-default-score
0))
12078 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
12079 (inhibit-read-only t
)
12080 (default gnus-summary-default-score
)
12081 (default-high gnus-summary-default-high-score
)
12082 (default-low gnus-summary-default-low-score
)
12083 (uncached (and gnus-summary-use-undownloaded-faces
12084 (memq article gnus-newsgroup-undownloaded
)
12085 (not (memq article gnus-newsgroup-cached
)))))
12086 (let ((face (funcall (gnus-summary-highlight-line-0))))
12087 (unless (eq face
(get-text-property beg
'face
))
12088 (gnus-put-text-property-excluding-characters-with-faces
12089 beg
(point-at-eol) 'face
12090 (setq face
(if (boundp face
) (symbol-value face
) face
)))
12091 (when gnus-summary-highlight-line-function
12092 (funcall gnus-summary-highlight-line-function article face
))))))
12094 (defun gnus-update-read-articles (group unread
&optional compute
)
12095 "Update the list of read articles in GROUP.
12096 UNREAD is a sorted list."
12097 (let ((active (or gnus-newsgroup-active
(gnus-active group
)))
12098 (info (gnus-get-info group
))
12101 (if (or (not info
) (not active
))
12102 ;; There is no info on this group if it was, in fact,
12103 ;; killed. Gnus stores no information on killed groups, so
12104 ;; there's nothing to be done.
12105 ;; One could store the information somewhere temporarily,
12106 ;; perhaps... Hmmm...
12108 ;; Remove any negative articles numbers.
12109 (while (and unread
(< (car unread
) 0))
12110 (setq unread
(cdr unread
)))
12111 ;; Remove any expired article numbers
12112 (while (and unread
(< (car unread
) (car active
)))
12113 (setq unread
(cdr unread
)))
12114 ;; Compute the ranges of read articles by looking at the list of
12115 ;; unread articles.
12117 (when (/= (car unread
) prev
)
12118 (push (if (= prev
(1- (car unread
))) prev
12119 (cons prev
(1- (car unread
))))
12121 (setq prev
(1+ (car unread
)))
12122 (setq unread
(cdr unread
)))
12123 (when (<= prev
(cdr active
))
12124 (push (cons prev
(cdr active
)) read
))
12125 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
12130 ;; Propagate the read marks to the backend.
12131 (when (gnus-check-backend-function 'request-set-mark group
)
12132 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
12133 (add (gnus-remove-from-range read
(gnus-info-read info
))))
12135 (unless (gnus-check-group group
)
12136 (error "Can't open server for %s" group
))
12137 (gnus-request-set-mark
12138 group
(delq nil
(list (if add
(list add
'add
'(read)))
12139 (if del
(list del
'del
'(read))))))
12141 `(gnus-request-set-mark
12144 (if del
(list del
'add
'(read)))
12145 (if add
(list add
'del
'(read))))))))))
12146 (set-buffer gnus-group-buffer
)
12147 (gnus-undo-register
12149 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
12150 (gnus-info-set-read ',info
',(gnus-info-read info
))
12151 (gnus-get-unread-articles-in-group ',info
12152 (gnus-active ,group
))
12153 (gnus-group-update-group ,group t
)
12155 ;; Enter this list into the group info.
12156 (gnus-info-set-read info read
)
12157 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12158 (gnus-get-unread-articles-in-group info
(gnus-active group
))
12161 (defun gnus-offer-save-summaries ()
12162 "Offer to save all active summary buffers."
12164 ;; Go through all buffers and find all summaries.
12165 (dolist (buffer (buffer-list))
12166 (when (and (setq buffer
(buffer-name buffer
))
12167 (string-match "Summary" buffer
)
12168 (with-current-buffer buffer
12169 ;; We check that this is, indeed, a summary buffer.
12170 (and (eq major-mode
'gnus-summary-mode
)
12171 ;; Also make sure this isn't bogus.
12172 gnus-newsgroup-prepared
12173 ;; Also make sure that this isn't a
12174 ;; dead summary buffer.
12175 (not gnus-dead-summary-mode
))))
12176 (push buffer buffers
)))
12177 ;; Go through all these summary buffers and offer to save them.
12181 "Update summary buffer %s? "
12183 (switch-to-buffer buf
)
12184 (gnus-summary-exit))
12187 (defun gnus-summary-setup-default-charset ()
12188 "Setup newsgroup default charset."
12189 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
12190 (setq gnus-newsgroup-charset nil
)
12191 (let* ((ignored-charsets
12192 (or gnus-newsgroup-ephemeral-ignored-charsets
12194 (and gnus-newsgroup-name
12195 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
12196 gnus-newsgroup-ignored-charsets
))))
12197 (setq gnus-newsgroup-charset
12198 (or gnus-newsgroup-ephemeral-charset
12199 (and gnus-newsgroup-name
12200 (gnus-parameter-charset gnus-newsgroup-name
))
12201 gnus-default-charset
))
12202 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
12203 ignored-charsets
))))
12209 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
12210 "Display the current article buffer fully MIME-buttonized.
12211 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12212 treated as multipart/mixed."
12214 (require 'gnus-art
)
12215 (let ((gnus-unbuttonized-mime-types nil
)
12216 (gnus-mime-display-multipart-as-mixed show-all-parts
))
12217 (gnus-summary-show-article)))
12219 (defun gnus-summary-repair-multipart (article)
12220 "Add a Content-Type header to a multipart article without one."
12221 (interactive (list (gnus-summary-article-number)))
12222 (gnus-with-article article
12223 (message-narrow-to-head)
12224 (message-remove-header "Mime-Version")
12225 (goto-char (point-max))
12226 (insert "Mime-Version: 1.0\n")
12228 (when (search-forward "\n--" nil t
)
12229 (let ((separator (buffer-substring (point) (point-at-eol))))
12230 (message-narrow-to-head)
12231 (message-remove-header "Content-Type")
12232 (goto-char (point-max))
12233 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12236 (let (gnus-mark-article-hook)
12237 (gnus-summary-select-article t t nil article
)))
12239 (defun gnus-summary-toggle-display-buttonized ()
12240 "Toggle the buttonizing of the article buffer."
12242 (require 'gnus-art
)
12243 (if (setq gnus-inhibit-mime-unbuttonizing
12244 (not gnus-inhibit-mime-unbuttonizing
))
12245 (let ((gnus-unbuttonized-mime-types nil
))
12246 (gnus-summary-show-article))
12247 (gnus-summary-show-article)))
12250 ;;; Generic summary marking commands
12253 (defvar gnus-summary-marking-alist
12254 '((read gnus-del-mark
"d")
12255 (unread gnus-unread-mark
"u")
12256 (ticked gnus-ticked-mark
"!")
12257 (dormant gnus-dormant-mark
"?")
12258 (expirable gnus-expirable-mark
"e"))
12259 "An alist of names/marks/keystrokes.")
12261 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
12262 (defvar gnus-summary-mark-map
)
12264 (defun gnus-summary-make-all-marking-commands ()
12265 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
12266 (dolist (elem gnus-summary-marking-alist
)
12267 (apply 'gnus-summary-make-marking-command elem
)))
12269 (defun gnus-summary-make-marking-command (name mark keystroke
)
12270 (let ((map (make-sparse-keymap)))
12271 (define-key gnus-summary-generic-mark-map keystroke map
)
12272 (dolist (lway `((next "next" next nil
"n")
12273 (next-unread "next unread" next t
"N")
12274 (prev "previous" prev nil
"p")
12275 (prev-unread "previous unread" prev t
"P")
12276 (nomove "" nil nil
,keystroke
)))
12277 (let ((func (gnus-summary-make-marking-command-1
12278 mark
(car lway
) lway name
)))
12279 (setq func
(eval func
))
12280 (define-key map
(nth 4 lway
) func
)))))
12282 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
12284 (format "gnus-summary-put-mark-as-%s%s"
12285 name
(if (eq way
'nomove
)
12287 (concat "-" (symbol-name way
)))))
12290 "Mark the current article as %s%s.
12291 If N, the prefix, then repeat N times.
12292 If N is negative, move in reverse order.
12293 The difference between N and the actual number of articles marked is
12297 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
12299 (defun gnus-summary-generic-mark (n mark move unread
)
12300 "Mark N articles with MARK."
12301 (unless (eq major-mode
'gnus-summary-mode
)
12302 (error "This command can only be used in the summary buffer"))
12303 (gnus-summary-show-thread)
12306 ((eq move
'next
) 1)
12307 ((eq move
'prev
) -
1)
12309 (if (zerop nummove
)
12313 nummove
(* -
1 nummove
))))
12314 (while (and (> n
0)
12315 (gnus-summary-mark-article nil mark
)
12316 (zerop (gnus-summary-next-subject nummove unread t
)))
12319 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
12320 (gnus-summary-recenter)
12321 (gnus-summary-position-point)
12322 (gnus-set-mode-line 'summary
)
12325 (defun gnus-summary-insert-articles (articles)
12326 (when (setq articles
12327 (gnus-sorted-difference articles
12328 (mapcar (lambda (h)
12329 (mail-header-number h
))
12330 gnus-newsgroup-headers
)))
12331 (setq gnus-newsgroup-headers
12333 gnus-newsgroup-headers
12334 (gnus-fetch-headers articles
)
12335 'gnus-article-sort-by-number
))
12336 ;; Suppress duplicates?
12337 (when gnus-suppress-duplicates
12338 (gnus-dup-suppress-articles))
12340 (if (and gnus-fetch-old-headers
12341 (eq gnus-headers-retrieved-by
'nov
))
12342 ;; We might want to build some more threads first.
12343 (if (eq gnus-fetch-old-headers
'invisible
)
12344 (gnus-build-all-threads)
12345 (gnus-build-old-threads))
12346 ;; Mark the inserted articles that are unread as unread.
12347 (setq gnus-newsgroup-unreads
12348 (gnus-sorted-nunion
12349 gnus-newsgroup-unreads
12350 (gnus-sorted-nintersection
12351 (gnus-list-of-unread-articles gnus-newsgroup-name
)
12353 ;; Mark the inserted articles as selected so that the information
12354 ;; of the marks having been changed by a user may be updated when
12355 ;; exiting this group. See `gnus-summary-update-info'.
12356 (dolist (art articles
)
12357 (setq gnus-newsgroup-unselected
(delq art gnus-newsgroup-unselected
))))
12358 ;; Let the Gnus agent mark articles as read.
12360 (gnus-agent-get-undownloaded-list))
12361 ;; Remove list identifiers from subject
12362 (when gnus-list-identifiers
12363 (gnus-summary-remove-list-identifiers))
12364 ;; First and last article in this newsgroup.
12365 (when gnus-newsgroup-headers
12366 (setq gnus-newsgroup-begin
12367 (mail-header-number (car gnus-newsgroup-headers
))
12369 (mail-header-number
12370 (gnus-last-element gnus-newsgroup-headers
))))
12371 (when gnus-use-scoring
12372 (gnus-possibly-score-headers))))
12374 (defun gnus-summary-insert-old-articles (&optional all
)
12375 "Insert all old articles in this group.
12376 If ALL is non-nil, already read articles become readable.
12377 If ALL is a number, fetch this number of articles."
12380 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
12383 ;; Some nntp servers lie about their active range. When
12384 ;; this happens, the active range can be in the millions.
12385 ;; Use a compressed range to avoid creating a huge list.
12386 (gnus-range-difference (list gnus-newsgroup-active
) old
))
12387 (setq len
(gnus-range-length older
))
12392 (let ((older-range (nreverse older
)))
12396 (let* ((r (pop older-range
))
12397 (min (if (numberp r
) r
(car r
)))
12398 (max (if (numberp r
) r
(cdr r
))))
12399 (while (and (<= min max
)
12404 (setq older
(gnus-uncompress-range older
))))
12406 (setq older
(gnus-uncompress-range older
)))
12408 (when (and (numberp gnus-large-newsgroup
)
12409 (> len gnus-large-newsgroup
))
12410 (let* ((cursor-in-echo-area nil
)
12411 (initial (gnus-parameter-large-newsgroup-initial
12412 gnus-newsgroup-name
))
12416 "How many articles from %s (%s %d): "
12417 (gnus-group-decoded-name gnus-newsgroup-name
)
12418 (if initial
"max" "default")
12421 (cons (number-to-string initial
)
12423 (unless (string-match "^[ \t]*$" input
)
12424 (setq all
(string-to-number input
))
12426 (let ((older-range (nreverse older
)))
12430 (let* ((r (pop older-range
))
12431 (min (if (numberp r
) r
(car r
)))
12432 (max (if (numberp r
) r
(cdr r
))))
12433 (while (and (<= min max
)
12437 max
(1- max
))))))))))
12438 (setq older
(gnus-uncompress-range older
))))
12440 (message "No old news.")
12441 (gnus-summary-insert-articles older
)
12442 (gnus-summary-limit (gnus-sorted-nunion old older
))))
12443 (gnus-summary-position-point)))
12445 (defun gnus-summary-insert-new-articles ()
12446 "Insert all new articles in this group."
12449 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
12450 (old-active gnus-newsgroup-active
)
12451 (nnmail-fetched-sources (list t
))
12453 (setq gnus-newsgroup-active
12454 (gnus-activate-group gnus-newsgroup-name
'scan
))
12455 (setq i
(cdr gnus-newsgroup-active
))
12456 (while (> i
(cdr old-active
))
12460 (message "No gnus is bad news")
12461 (gnus-summary-insert-articles new
)
12462 (setq gnus-newsgroup-unreads
12463 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
12464 (gnus-summary-limit (gnus-sorted-nunion old new
))))
12465 (gnus-summary-position-point)))
12467 (gnus-summary-make-all-marking-commands)
12469 (gnus-ems-redefine)
12471 (provide 'gnus-sum
)
12473 (run-hooks 'gnus-sum-load-hook
)
12475 ;; Local Variables:
12476 ;; coding: iso-8859-1
12479 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12480 ;;; gnus-sum.el ends here